Repository navigation
Support a wildcard segment in the remap command - #980
Conversation
A prefix rewrite preserves the tail, so it can never collapse a family of deleted worktrees onto their project root - only an exact cwd match uses `to` verbatim, which made it one entry per dead tree. Precedence is the length of the cwd a rule consumed rather than of the pattern, so a literal still wins a tie and stays usable as a per-path override inside a family.
An unquoted wildcard reaches the CLI already expanded, with no `*` left to detect it by - so the advice to quote is offered rather than diagnosed. `--remove` is the dangerous half: the first expanded path can name a real literal entry, and deleting one silently is worse than storing one.
PR Summary by QodoSupport single-segment wildcards in cwd remap rules
AI Description
Diagram
High-Level Assessment
Files changed (10)
|
Code Review by Qodo
1.
|
A session's cwd is not always the worktree root, so grouping by the immediate parent left one recorded in <worktree>/src in a group of one and no family formed. Walking up to the nearest checkout root makes the slug the unit, which also separates two dead worktrees from two dead directories inside one. And a suggested rule takes its separator from the path, since a mixed one never matches.
|
Two qodo findings are left open deliberately. Both ask the new tests to take a
Everything else qodo raised is addressed in |
AI-2878 — no GitHub issue exists for this; it was filed in Linear.
What & why
kcap remapis the only recovery when a transcript's recorded cwd is gone, but a literalfromcannot name a family: a prefix rewrite preserves the tail, so~/dev/repo/worktrees→~/dev/repoturns.../worktrees/ai-1into~/dev/repo/ai-1, which is equally missing. Only an exactcwd == fromhit usestoverbatim, making it one entry per dead worktree and a new one every time a tree is cleaned up — one machine needed 24 across two repos.fromnow takes a single*standing as a whole path segment, matching exactly one segment with the remainder preserved, and the missing-cwd report prints the rule for a family it can see rather than a truncated path list.Where to look
Rule selection is by how much of the cwd a rule consumed, not by pattern length, with a literal beating a wildcard of equal reach — that is what keeps one path overridable out of a family, and a literal-only config resolves exactly as it did. A malformed pattern is refused when typed and skipped when read back, but
--removedeliberately skips the grammar, so an entry hand-written into the config that no import can use stays removable.Verification
dotnet run --project test/Capacitor.Cli.Tests.Unit -- --treenode-filter '/*/*/*Remap*/*'… --treenode-filter '/*/*/ImportMissingCwdsReportTests/*'… --treenode-filter '/*/*/Import*/*'dotnet publish src/Capacitor.Cli/Capacitor.Cli.csproj -c Release