Repository navigation
fix(cli): keep repos/ clones on the workspace and read the current worktree everywhere (#612, #613) - #614
Merged
Conversation
…rktree everywhere (#612, #613) #585 fixed #582 for nested worktrees, but its resolver stopped at the first directory with its own .git. A clone under repos/ and each worktree of it then resolved to the clone, for the gate and for shared data, which landed in the clone's working tree. A nested worktree whose git directory was pruned, or whose checkout moved, still gated the main checkout. find_worktree_root now stops at the nearest linked worktree, live or stale, and otherwise keeps the workspace root, so the main checkout, clones under repos/, their worktrees and submodules resolve as before #585. main_worktree_root shares the workspace's data with them again. The gate names the root it checks before the cache lookup and for every single check, warns from a stale worktree with the fix for each cause, and resolves its root on each call instead of at import. Commands that read, index or deploy the current tree now use it too: repomap, the architecture diagram, the AST graph (which came back empty from a nested worktree), review auto-fix, tf deploys and Kube-linter locations. A tf deploy from a worktree that lacks the main checkout's untracked local state stops when auto-approved and asks otherwise, since apply would plan to create every resource again. Every case is tested against real git layouts, and an acceptance probe over eleven layouts matches the required gate and data roots. The #582 roadmap entry moves to v0.2.23 with a note on what #612 corrected. Closes #612 Closes #613
This was referenced Sep 25, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes two defects in work delivered for v0.2.23.
#612: #585's worktree resolution regressed clones under
repos/and missed stale worktrees. #585 fixed #582 for nested worktrees, but its resolver stopped at the first directory with its own.git. That contradicted what #582 required..claude/worktrees/repos/"Gate" is
find_worktree_rootand "data" ismain_worktree_root. The table rows come from an acceptance probe over eleven real layouts, which this PR matches exactly.#613: other commands still read the main checkout from a nested worktree.
devops ai repomap,devops ai diagram arch,devops ai ast graph(which came back empty, because the checkout's.gitignoreexcludes.claude/),devops review auto-fix,devops tfdeploys and Kube-linter locations all acted on the main checkout.Changes
find_worktree_root(core/repo.py) stops at the nearest linked worktree, live or stale, and otherwise keeps the workspace root. Relative-path worktrees, bare-repository worktrees, and.gitfiles that are unreadable or not UTF-8 are handled.main_worktree_rootstarts from the workspace root again.is_stale_linked_worktreeis new.commands/ci.py):devops ci testrun by the pre-commit hook, except--help;git worktree repair <path>if the checkout moved, or move it aside andgit worktree addif it was pruned;_ROOT.find_worktree_root. Kube-linter's parser is split into helpers to stay within the complexity cap.devops tfdeploy guard: a worktree lacks the main checkout's untrackedterraform.tfstate, soapplythere would plan to create every resource again. The deploy now stops when auto-approved, asks otherwise (default no), and only warns on a dry run. A remote backend is never stopped..gitrule. Worktree Gate Resolution Keeps repos/ Clones on the Workspace and Checks Stale Worktrees #612 and Code-Reading AI, IaC and Scan Commands Use the Worktree They Run In #613 are recorded as delivered, and both task files are included.Verification
repos/and their worktrees, and submodules;.gitfiles.rufftest shows that a lint error only in the worktree fails the check, while one only in the main checkout does not.devops cigate passed on push.Closes #612
Closes #613