Add list ignore support for worktree paths and branch names#1743
Add list ignore support for worktree paths and branch names#1743willpote wants to merge 10 commits into
Conversation
worktrunk-bot
left a comment
There was a problem hiding this comment.
Nice feature — the implementation is clean and well-tested. Two issues worth addressing:
-
Invalid glob patterns are silently dropped. The
.filter_map(|s| glob::Pattern::new(s).ok())silently ignores malformed patterns. The project has precedent for surfacing pattern errors —step_commands.rsreturns an error for invalid[step.copy-ignored].excludepatterns. A typo in an ignore pattern (e.g.[tmp-*) would be silently ignored with no feedback, which is hard to debug. Consider at least logging a warning. -
[list].ignoreconfig option isn't documented in the list command'safter_long_help. The--ignoredflag is documented, but users discovering the[list].ignoreconfig option relies on them reading the--ignoredflag description and inferring the config key. A brief mention in theafter_long_help(and thus the docs page) would help discoverability — similar to how--full,--branches, etc. reference their config equivalents.
worktrunk-bot
left a comment
There was a problem hiding this comment.
CI is failing with three issues:
-
Cmd::output()doesn't exist —test_list_config_ignore_local_branchcalls.output()onworktrunk::shell_exec::Cmd(lines 598, 600), butCmddoesn't have that method. Use.run()instead (per project conventions, all commands go throughCmd::run()). -
clippy::too_many_arguments—handle_list_commandnow has too many parameters after addingignored. Consider grouping into a struct or using#[allow(clippy::too_many_arguments)]if the function is a thin dispatch layer. -
clippy::redundant_closure— likely the.unwrap_or_else(|| wt.path.clone())on the canonicalize result.
|
I think I get the motivation, and I've had a similar experience at times but I worry this might not quite pull its weight... hardly my style to suggest multiple checkouts, but one approach is to give cursor another base checkout OTOH I can't think of an easy way to do this without the feature. and we could make the downside less confusing with "X hidden" in the footer |
In the Cursor case, if you use the "Use multiple agents" feature when implementing something, it automatically spins up worktrees for you in Re: X hidden, i did add that to the summary message- not sure if this is what you meant but it says |
Hide worktrees and branches from `wt list` using glob patterns in user config. Patterns match against canonical worktree paths and branch names, with `--ignored` flag to bypass filtering. Configure in ~/.config/worktrunk/config.toml: [list] ignore = "*/tmp-*" # single pattern ignore = ["*/tmp-*", "*/scratch-*"] # multiple patterns
ad316ad to
67ef76a
Compare
worktrunk-bot
left a comment
There was a problem hiding this comment.
Previous review points were addressed (glob warning logging, docs in after_long_help, #[allow(clippy::too_many_arguments)]). One compile-blocking issue remains from the earlier review:
repo.git_command() returns Cmd, which has no .output() method — use .run() instead (lines 598, 600 in list_config.rs). This will fail to compile.
|
ok. let me think / let's see whether anyone else has thoughts feel free to use @worktrunk-bot to fix tests etc |
I was thinking "8 hidden" could be here |
|
CI is failing because The fix is in - .output();
+ .run();
}
- let _ = repo.git_command().args(["branch", "-D", branch]).output();
+ let _ = repo.git_command().args(["branch", "-D", branch]).run();The |
Right i added 'X ignored'. I can rename to 'X hidden' if you like |
sorry, not sure how I missed that! |
|
@worktrunk-bot can we fix the tests, so we have a working PR to review? |
|
Fixed — merged |
Made-with: Cursor
Made-with: Cursor
0e9f972 to
a238dba
Compare
worktrunk-bot
left a comment
There was a problem hiding this comment.
Previous review feedback has been addressed — glob warning, docs, clippy, and the .output() compile fix are all resolved. Implementation is clean.
One remaining gap: dev/config.example.toml doesn't document the new [list].ignore field. Per project guidelines, config field changes should update the example configs since they're embedded in CLI help via include_str! and used by wt config create. Adding a line under the [list] section (after timeout-ms) would make the option discoverable:
# ignore = ["tmp-*"] # Glob patterns to hide from output; use --ignored to show all|
@worktrunk-bot update dev/config.example.toml as suggested |
|
@max-sixty any thoughts on this change? |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Done — added
|
|
@worktrunk-bot do we label as experimental? can we do that if not? thanks @willpote |
|
@worktrunk-bot can we review whether this should be |
Mark the ignore filtering feature (config field, --ignored flag, and docs section) with [experimental] tags to signal the interface may change. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Done — labeled
All downstream files regenerated (docs, skills, help snapshots). |
worktrunk-bot
left a comment
There was a problem hiding this comment.
On the ignore vs hidden naming question:
ignore is the more accurate term for the current implementation. Matching items are filtered out at the collection stage — no git operations, diffstats, or CI status checks run against them. They're not processed and then hidden from display; they're skipped entirely. This is closer to .gitignore semantics (file exists on disk, git pretends it doesn't) than a "hidden" flag.
That said, the filtering only applies to wt list — other commands (switch, merge, etc.) still operate on these worktrees normally. From that angle, "hidden from list" is what users experience.
Precedent leans toward ignore: .gitignore, --ignored in git status, eslintignore, etc. all use "ignore" for "exists but excluded from default view, recoverable with a flag." The counterpart --ignored flag also reads naturally — --hidden would be less conventional.
This is a judgment call for the maintainer — leaving as COMMENT since the naming question is still open.
|
Reviewed the diff — the filtering only applies to Agree
The @willpote would you like to make this rename, or should I put up a commit on the branch? |
|
@worktrunk-bot let's make the naming change and then if @willpote disagrees we can revert |
The filtering only applies to `wt list` display — hidden worktrees are still accessible to switch, merge, remove, etc. "Hidden" better describes this display-level behavior than "ignore" (which implies the items are functionally excluded). Renames config field, CLI flag (--ignored → --hidden), all internal variables, tests, docs, and snapshots. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Done — renamed
All 1339 integration tests + 492 unit tests pass, lints clean. |
|
@worktrunk-bot merge and resolve conflicts |
Resolve conflicts from main's ListArgs struct refactoring: adopt the new `List(ListArgs)` pattern and add the `hidden` field to the ListArgs struct. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Merged |
|
let's remove |
The flag name and whether it should be a flag at all is TBD. The `[list].hidden` config functionality remains — only the CLI override is removed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Done — removed the |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@willpote is this version OK with you? |
…es (#3039) A CI monitor watching PR #3035 polled the combined-status API (`gh api .../commits/<sha>/status`) for `codecov/patch` and concluded codecov had stopped posting on PR heads. Investigation showed nothing is broken: codecov's GitHub App posts **check runs** on PR head commits (commit statuses appear only on main pushes), and check runs never show up in the legacy status API. This has been the case since at least April (oldest surviving PR head, #1743). The check run also lands several minutes after the `code-coverage` job finishes (~9 min on #3035). This adds one sentence to the Coverage section so merge gating polls `gh pr checks` rather than the status API. 🤖 Generated with [Claude Code](https://claude.com/claude-code) > _This was written by Claude Code on behalf of max_ Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Adds [list].ignore config. These are glob patterns that hide worktrees and branches from wt list output. Motivation is when using tools like Cursor, which generate worktrees for each agent running in parallel,
wt listbecomes cluttered with these temporary worktrees and un-usable.Per-project overrides work via the
[projects."..."]table (inherits through OverridableConfig).Each pattern is matched two ways:
A worktree or branch is hidden if either matches. Filtering applies uniformly to worktrees, local branches (--branches), and remote branches (--remotes).
wt list --ignoredbypasses all ignore filtering and shows everything.When items are filtered, the summary line includes the count: Showing 3 worktrees, 1 ignored.
Changes