paths

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2026 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package paths provides the safe-path and containment primitives (PRD §6, §15) the orchestration core builds on: canonical absolute paths with symlinks resolved, segment-aware containment checks for worktree enforcement, and discovery of the repository root that holds .orchestrator/. Every helper fails closed: a path that cannot be verified yields an error, never a permissive default.

Index

Constants

View Source
const OrchestratorDir = ".orchestrator"

OrchestratorDir is the name of the repo-root directory Orch owns.

Variables

View Source
var ErrNotFound = errors.New("no " + OrchestratorDir + " directory found")

ErrNotFound reports that no ancestor directory contains .orchestrator/. Callers test for it with errors.Is.

Functions

func Canonical

func Canonical(path string) (string, error)

Canonical returns path as an absolute, symlink-resolved, cleaned path. The target need not exist: the deepest existing ancestor is resolved and the remaining components are appended lexically, so a write destination can be checked before anything creates it. Any failure other than non-existence (for example permission denied) is an error so callers fail closed.

func FindOutermostRoot

func FindOutermostRoot(startDir string) (string, error)

FindOutermostRoot walks from startDir to the filesystem root and returns the outermost ancestor that contains an .orchestrator directory — the opposite selection from FindRoot, which stops at the innermost. The guard (PRD §23) needs the outermost hit: a Delivery worktree checkout carries the committed .orchestrator/config.toml, so an innermost search would resolve a path under <root>/.orchestrator/worktrees/issue-N/ to the worktree itself, whose missing machine-local state.json would read as Assist and wrongly deny every executor write. The same fail-closed rules as FindRoot apply: an unreadable ancestor, or an .orchestrator entry that is not a real directory (a symlink does not count), is an error; ErrNotFound wraps when no ancestor qualifies.

func FindRoot

func FindRoot(startDir string) (string, error)

FindRoot walks from startDir toward the filesystem root and returns the first directory containing an .orchestrator directory. It returns an error wrapping ErrNotFound when no ancestor qualifies, and fails closed on anything it cannot trust: an unreadable ancestor, or an .orchestrator entry that is not a real directory (a symlink does not count).

func Inside

func Inside(root, path string) (bool, error)

Inside reports whether path is contained in root; path equal to root counts as inside. Both arguments are canonicalized first, so a symlink cannot smuggle a path out of root and ".." segments cannot fake containment. The comparison is segment-aware: /repo-2 is not inside /repo. An unverifiable path is an error, and callers must treat it as "deny".

Types

This section is empty.

Jump to

Keyboard shortcuts

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