managedsidecar

package
v0.3.0-beta.27 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 15, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RelativeWithinRoot

func RelativeWithinRoot(root, target string) (string, bool)

RelativeWithinRoot returns a slash-normalized relative path and containment result.

func Resolve

func Resolve(workspaceRoot, targetPath string) (Path, *PathIssue)

Resolve constructs a root-relative managed path and rejects lexical escapes.

func RevisionSourcePath

func RevisionSourcePath(agentDefinitionPath, sidecarName string) (string, error)

RevisionSourcePath derives the authored sidecar source owned by an AGENT.md definition.

func SafePathWithoutRoot

func SafePathWithoutRoot(path string) string

SafePathWithoutRoot bounds absolute-path disclosure to the managed suffix.

func SidecarPath

func SidecarPath(agentPath, sidecarName string) (string, error)

SidecarPath derives a sidecar file path from an agent directory or AGENT.md path.

func ValidAgentName

func ValidAgentName(value string) bool

ValidAgentName reports whether value is one safe path component.

Types

type IssueKind

type IssueKind string

IssueKind classifies a managed-path failure without prescribing domain copy.

const (
	IssueInvalidNUL           IssueKind = "invalid_nul"
	IssueResolveRoot          IssueKind = "resolve_root"
	IssueResolveTarget        IssueKind = "resolve_target"
	IssueOutsideRoot          IssueKind = "outside_root"
	IssueInspect              IssueKind = "inspect"
	IssueSymlink              IssueKind = "symlink"
	IssueSymlinkTargetOutside IssueKind = "symlink_target_outside"
)

type Path

type Path struct {
	// contains filtered or unexported fields
}

Path is a workspace-rooted path whose relative name cannot escape its root.

func (Path) Absolute

func (p Path) Absolute() string

Absolute returns the display/read path. Mutations use the rooted methods below.

func (Path) Read

func (p Path) Read() (contents []byte, err error)

Read reads the managed regular file through a no-follow directory chain.

func (Path) Remove

func (p Path) Remove() (err error)

Remove deletes the managed regular file through a held no-follow parent.

func (Path) SourcePath

func (p Path) SourcePath() string

SourcePath returns the portable workspace-relative path.

func (p Path) ValidateNoSymlinks() (issue *PathIssue)

ValidateNoSymlinks rejects every existing symlink component while holding an os.Root.

func (Path) Write

func (p Path) Write(contents []byte, mode os.FileMode) (err error)

Write atomically replaces the managed file through a held no-follow parent.

type PathIssue

type PathIssue struct {
	Kind       IssueKind
	SourcePath string
	Err        error
}

PathIssue reports one safe, domain-neutral managed-path failure.

func SafeSourcePath

func SafeSourcePath(sourcePath, workspaceRoot string) (string, *PathIssue)

SafeSourcePath derives a display-safe path and checks workspace containment.

func (*PathIssue) Error

func (e *PathIssue) Error() string

func (*PathIssue) Unwrap

func (e *PathIssue) Unwrap() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL