pathutil

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanonicalizeExistingDirAbs

func CanonicalizeExistingDirAbs(path string) (string, error)

CanonicalizeExistingDirAbs returns a clean absolute path for an existing directory.

func CanonicalizeExistingPathAbs

func CanonicalizeExistingPathAbs(path string) (string, error)

CanonicalizeExistingPathAbs returns a clean absolute path for an existing filesystem entry.

func IsWithinScope

func IsWithinScope(pathAbs string, agentHomeAbs string) (bool, error)

IsWithinScope reports whether pathAbs stays inside agentHomeAbs.

func NormalizeUserPathInput

func NormalizeUserPathInput(path string, agentHomeAbs string) (string, error)

NormalizeUserPathInput expands "~/" against agentHomeAbs and requires an absolute path.

func ResolveExistingScopedDir

func ResolveExistingScopedDir(path string, agentHomeAbs string) (string, error)

ResolveExistingScopedDir validates an existing directory under agentHomeAbs.

func ResolveExistingScopedPath

func ResolveExistingScopedPath(path string, agentHomeAbs string) (string, error)

ResolveExistingScopedPath validates an existing path under agentHomeAbs.

func ResolveTargetScopedPath

func ResolveTargetScopedPath(path string, agentHomeAbs string) (string, error)

ResolveTargetScopedPath validates a destination path under agentHomeAbs.

The destination itself may not exist yet, so the nearest existing ancestor is canonicalized first to prevent symlink escapes.

Types

type PathScope

type PathScope struct {
	RuntimeHomeAbs string
	ProjectRootAbs string
}

PathScope captures the nested filesystem boundaries for a single Flower run.

func NewPathScope

func NewPathScope(runtimeHomeAbs string, projectRoot string) (PathScope, error)

NewPathScope canonicalizes the runtime home and project root and enforces that the project root stays inside the runtime home boundary.

func (PathScope) ResolveExistingDir

func (s PathScope) ResolveExistingDir(path string) (string, error)

ResolveExistingDir validates an existing directory inside both the runtime home and project root.

func (PathScope) ResolveExistingPath

func (s PathScope) ResolveExistingPath(path string) (string, error)

ResolveExistingPath validates an existing path inside both the runtime home and project root.

func (PathScope) ResolveTargetPath

func (s PathScope) ResolveTargetPath(path string) (string, error)

ResolveTargetPath validates a destination path inside both the runtime home and project root.

Jump to

Keyboard shortcuts

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