pub fn worker_root(cwd: &Path) -> Result<PathBuf, String>Expand description
The tree a worker spawned at cwd runs in: the repo root when the
path is inside a repository, the path itself otherwise. Both are
canonical, because the claude CLI derives the session JSONL’s
directory from the canonical path - measured: a worktree under
/tmp writes its transcript under /private/tmp - so a record
holding the alias would name a directory the CLI never wrote to.
Err when the path is not there to canonicalize or is not a
directory, so a typo is refused where it was typed rather than
surfacing as claude’s own cwd failure at spawn.