Skip to main content
New and experimental. File bugs and suggestions to aspect-build/aspect-cli/issues.
Print the directory a pooled worktree lives in, and nothing else, so a shell can step into it.
The two steps matter. cd "$(aspect worktree path fix/login)" returns 0 even when the command fails, because the substitution is empty and cd "" is a no-op, so a script carries on in whatever directory it was already in. A task runs as a child process and cannot change its caller’s directory, so this prints rather than moves. If you want one word, define a shell function:

Output

The directory goes to stdout with nothing else on it, which is what makes command substitution safe. Diagnostics go to stderr.
A slot id works as well as a branch, since the id is the first column of aspect worktree list; so does a unique prefix of four characters or more, the slot’s directory, and for a detached slot the ref it was taken at:
A name that resolves to nothing writes nothing to stdout and exits non-zero, naming what this clone does have out:
A free slot resolves, but there is no worktree in it to enter, so the refusal says so and names the one command that would give it one:

Refusals

Reading the pool does not wait for its lock, so path never returns pool_busy: it is safe to call while an add or a prune elsewhere is working. It tries the lock once only to take back a moved clone’s slots, and answers from the pool as it stands when that is busy. Run by a resumed session from a new process, path for a slot it may enter also moves that session’s leases off a stopped process onto its own, trying the lock once and leaving them for a later call when it is busy; see agent detection.

Flags

string
required
The branch checked out in the slot, the slot id aspect worktree list shows in its first column (or a unique prefix of four or more characters), or the slot’s directory. A detached slot also answers to the ref it was taken at, while no other slot is at it. A free slot’s last branch resolves too — to a refusal explaining that the slot is free, rather than to a path with nothing at it.
string
The agent harness asking, as given to add with the same flag. Needed only when the lease was taken with --agent-kind; detected otherwise.
string
The session or subagent asking, as given to add with the same flag. Needed only when the lease was taken with --agent-id; detected otherwise.
text | json
default:"text"
text writes only the directory to stdout, so a shell can step into it. json writes one document, which is how a harness gets a typed refusal rather than prose.

Knowing where you are

Once you are in a worktree, git will tell you which one. The slot directory is named by a hash, so the branch is the readable identity:
git worktree list also reports the slot path, and does not mark the current entry.