Documentation
¶
Overview ¶
Package worktree implements Epic 12's launch-time isolation (S-3/R-3): Create prepares an isolated git worktree + branch for a session and Remove tears it down. Session ids are validated against path traversal (ADR-004) before anything ever touches git or disk.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Create ¶
Create makes an isolated git worktree for session id. When name has usable letters or numbers, its preferred directory is <name-slug> and its branch is swarm/<name-slug>-<id>. If that friendly directory is occupied by another same-named session, this session falls back to <name-slug>-<id>. An unnamed session retains the established id-only form. id is validated before anything touches git or disk, so a rejected id never creates so much as the .swarm directory.
func Remove ¶
Remove tears down session id's worktree under repoDir: `git worktree remove --force` followed by `git worktree prune` (R-3). Removing an unknown session errors.
func RemoveAt ¶
RemoveAt tears down the exact worktree path persisted in Meta.AgentCwd. It accepts only a direct child of <repoDir>/.swarm/worktrees, so corrupt or malicious metadata cannot make teardown remove an arbitrary path. Remove is retained for sessions created by older versions, whose id was their path.
Types ¶
This section is empty.