Skip to content

feat(list): configure wt list columns - #3065

Closed
Faria22 wants to merge 5 commits into
max-sixty:mainfrom
Faria22:feat/config-wt-list
Closed

Faria22 wants to merge 5 commits into
max-sixty:mainfrom
Faria22:feat/config-wt-list

Conversation

@Faria22

@Faria22 Faria22 commented Jun 13, 2026

Copy link
Copy Markdown

What

Adds user-configurable column visibility for wt list via a new [list.columns] user-config section.

The config can now enable or suppress each optional table column by key:

[list.columns]
status = true
head-diff = true
main-commits = true
main-diff = false
summary = false
remote-commits = true
ci = false
path = false
url = true
commit = true
age = true
message = true

Unset keys preserve the current defaults: the ordinary wt list columns stay visible, while the expensive main-diff, summary, and ci columns remain off unless enabled or --full is used. --full still forces the full-mode columns on for a single invocation, even when config disables them.

The path column keeps its existing automatic behavior when unset: it only appears for branch/worktree mismatches. Setting path = true makes it eligible whenever there is path data, and path = false hides it.

Why

wt list --full is intentionally broad: it turns on every expensive/full-mode column at once. That is useful for inspection, but it does not let users build a stable daily view like "show main diff, but keep CI and summaries hidden" or "hide message/path to make the table denser."

This keeps the existing defaults and CLI behavior intact while making the list layout configurable in user config.

Implementation

  • Adds ListColumnsConfig under [list.columns], including merge behavior for user/project override layering and env overrides such as WORKTRUNK__LIST__COLUMNS__MESSAGE=false.
  • Adds ColumnVisibility as the table-render-time policy object, so task selection and layout allocation agree on which columns are eligible.
  • Uses the visibility policy to skip unused expensive tasks (BranchDiff, CiStatus, SummaryGenerate, and URL status when hidden).
  • Preserves the legacy "all columns eligible with automatic path" behavior for picker/statusline-style callers that already pass explicit task skips.
  • Updates wt list and wt config help/docs plus generated mirrors and snapshots.

Verification

  • cargo run -- hook pre-merge --yes in a normal terminal reached the insta/nextest summary with 3,932 passing tests and 2 local timeouts.
  • Re-running the two timed-out tests with GIT_SSH_COMMAND='ssh -o BatchMode=yes -o ConnectTimeout=5' still timed out locally:
    • integration_tests::eval::test_eval_owner
    • integration_tests::list::test_list_json_repo_url_from_ssh_remote
  • The remaining local timeout pattern is limited to tests that rewrite origin to [email protected]:...; this branch does not touch SSH remote handling.
  • Earlier sandbox validation also showed docs/doctests passing, but the full sandbox gate was not usable because PTY and filesystem permission tests failed under Codex sandboxing.

This was written by Codex on behalf of faria.

Faria22 added 2 commits June 11, 2026 21:42
# Conflicts:
#	docs/content/list.md
#	skills/worktrunk/reference/list.md
#	src/cli/mod.rs
#	src/commands/list/collect/mod.rs
#	src/commands/list/layout.rs
#	tests/snapshots/integration__integration_tests__help__help_list_long.snap
#	tests/snapshots/integration__integration_tests__help__help_list_narrow_80.snap
@Faria22
Faria22 marked this pull request as ready for review June 13, 2026 02:39
Copilot AI review requested due to automatic review settings June 13, 2026 02:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds user-configurable column visibility for wt list via a new [list.columns] config section, wiring it into layout/collection and updating docs + integration snapshots accordingly.

Changes:

  • Introduces ListColumnsConfig in user config and merges it through config resolution.
  • Adds ColumnVisibility to decide which columns render and which tasks to skip (including --full overrides).
  • Updates CLI/docs/help text and adds integration tests + snapshots covering column toggles and env overrides.

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/config/user/sections.rs Adds [list.columns] config schema, accessors, and merge behavior.
src/commands/list/columns.rs Introduces ColumnVisibility to map config/--full to per-column visibility.
src/commands/list/collect/mod.rs Computes skip_tasks from column visibility and passes visibility into layout.
src/commands/list/layout.rs Filters candidate columns by visibility and refines Path “automatic” behavior.
tests/integration_tests/list_config.rs Adds integration tests for enabling/disabling columns and env overrides.
src/cli/mod.rs + docs/reference files Documents [list.columns] behavior and updates column descriptions.
tests/snapshots/** Records updated help + list outputs for the new column-visibility behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +775 to +788
let column_visibility = ColumnVisibility::from_config(config.list.columns(), show_full);
let mut skip_tasks = HashSet::new();
if !column_visibility.shows_branch_diff() {
skip_tasks.insert(TaskKind::BranchDiff);
}
if !column_visibility.shows_ci_status() {
skip_tasks.insert(TaskKind::CiStatus);
}
if !column_visibility.shows_summary() {
skip_tasks.insert(TaskKind::SummaryGenerate);
}
if !column_visibility.shows_url() {
skip_tasks.insert(TaskKind::UrlStatus);
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in the follow-up patch: the initial skip-task selection now computes summary_generation_enabled = config.list.summary() && config.commit_generation.command.is_some() and skips TaskKind::SummaryGenerate unless both the Summary column is visible and generation is enabled. Verified with cargo test --test integration list_config_summary_column_requires_generation_config.

Comment thread src/cli/mod.rs

The `main` header label is used regardless of the default branch's actual name.

Column visibility is configured in user config under `[list.columns]`. Branch and the left gutter are always shown. Unset keys use the current defaults: the ordinary `wt list` columns stay on, while `main-diff`, `summary`, and `ci` stay off unless enabled or `--full` is used. `path` is automatic when unset (shown when needed for branch/worktree mismatches); set `path = true` to always make it eligible, or `path = false` to hide it.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in the follow-up patch: the active examples now omit path, preserving automatic behavior for copy/paste users, and include a commented optional override note for path = true / path = false. Regenerated docs/reference mirrors and verified with cargo test --test integration test_docs_are_in_sync.

Comment on lines +41 to +59
pub fn all_with_automatic_path() -> Self {
Self::from_config(
ListColumnsConfig {
status: Some(true),
head_diff: Some(true),
main_commits: Some(true),
main_diff: Some(true),
summary: Some(true),
remote_commits: Some(true),
ci: Some(true),
path: None,
url: Some(true),
commit: Some(true),
age: Some(true),
message: Some(true),
},
false,
)
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in the follow-up patch: ColumnVisibility::all_with_automatic_path() now delegates to a centralized ListColumnsConfig::all_enabled_with_automatic_path() constructor, keeping the all-enabled policy in the config type instead of hard-coding it in the visibility layer. Added/expanded focused coverage in legacy_visibility_keeps_path_automatic.

@worktrunk-bot worktrunk-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The feature itself reads well — [list.columns] with per-column accessors, ColumnVisibility as the single render-time policy, env-override and merge coverage, and the --full precedence are all clean and well-tested. One inline note below (non-blocking).

The blocker is CI: 7 snapshot tests fail (test (linux), the advisory affected tests legs, and code-coverage all cascade from this). The feature code is producing correct output — the committed .snap files are stale relative to the merged branch, for two distinct reasons:

  1. Trailing ANSI resets (the five list_config_* snapshots + help_list_long): the committed snapshots end lines without the trailing ␛[0m reset, but the actual output now includes it. This branch already contains #3061 (refactor(tests): remove byte-normalization snapshot filters), which dropped the filters that used to strip those resets — so snapshots generated before that merge no longer match.

  2. A real content drift (help_list_narrow_80): the committed snapshot still renders CI Pipeline status; --full or ci = true, but the updated after_long_help in src/cli/mod.rs renders CI PR/MR number colored by pipeline status; --full or ci = true. The narrow-terminal help snapshot wasn't regenerated after the CI-row edit.

Both clear up by regenerating against the current branch tip and committing the result:

cargo run -- hook pre-merge --yes   # or: cargo insta test --accept
cargo insta accept

Happy to push the regenerated snapshots if you'd prefer — just say the word.

Comment thread src/commands/list/columns.rs Resolved

@worktrunk-bot worktrunk-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The summary-generation gating reads correctly — is_visible(Summary) && config.list.summary() && commit_generation.command.is_some() matches the documented two-key requirement (--full/[list.columns] summary for the column, plus [list] summary = true and a commit.generation command for generation), and the shows_* → is_visible consolidation resolves the prior single-source-of-truth note cleanly.

CI is still red, though, for a fresh reason: this commit edited the after_long_help config example in src/cli/mod.rs (dropped path = false, added the # Optional: path = true … comment) and regenerated the doc mirrors — check-docs is green — but the help-page snapshots that embed that same block weren't regenerated. test (linux), affected tests (linux, advisory), and code-coverage all fail on four stale snapshots:

  • help_config_long
  • help_config_create
  • help_list_long
  • help_list_narrow_80

Each still renders the old TOML with path = false. Regenerate and commit:

cargo run -- hook pre-merge --yes   # or: cargo insta test --accept

(.snap files shouldn't be hand-edited — the ANSI codes are hard to reproduce.) Happy to push the regenerated snapshots if you'd like — just say the word.

worktrunk-bot
worktrunk-bot previously approved these changes Jun 13, 2026

@worktrunk-bot worktrunk-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test (linux), test (macos), and code-coverage are failing on d050efd — a real regression, not a flake. The latest commit dropped the # Optional: path = true … line from the after_long_help config example in src/cli/mod.rs, but three of the help snapshots still contain that line, so cargo test --test integration help fails on help_list_long, help_config_long, and help_config_create.

I reproduced locally; the only diff in each is the stale comment line:

tests/snapshots/integration__integration_tests__help__help_list_long.snap
  - # Optional: path = true always makes Path eligible; path = false hides it.

tests/snapshots/integration__integration_tests__help__help_config_long.snap
  - # Optional: path = true always makes Path eligible; path = false hides it.

tests/snapshots/integration__integration_tests__help__help_config_create.snap
  - # # Optional: path = true always makes Path eligible; path = false hides it.

The list_config_* snapshots and the docs mirrors regenerated correctly — only these three help snapshots were missed. The line is inside the snapshot bodies (well outside this PR's diff hunks), so an inline suggestion won't attach cleanly; regenerate instead of hand-editing:

cargo insta test --accept --test integration help
# or: cargo run -- hook pre-merge --yes

I've dismissed my approval since CI is red. Want me to push the three regenerated snapshots to the branch? Otherwise the insta accept above will clear it.

@worktrunk-bot
worktrunk-bot dismissed their stale review June 13, 2026 03:38

CI failed — three help snapshots (help_list_long, help_config_long, help_config_create) still contain the # Optional: path line dropped from after_long_help; regenerate with cargo insta accept.

@max-sixty

Copy link
Copy Markdown
Owner

thanks @Faria22

I have been thinking of a general approach here; including a template that would allow for arbitrary vars, will publish something

this is an interesting approach. it's simple and flexible. But I wonder whether it's in an awkward place on the simplicity-flexibility frontier — its main role is in excluding columns. But when are times we want to always exclude a column? is there a specific case that gave you this idea or this is a general bid toward more flexibility?

@Faria22

Faria22 commented Jun 14, 2026

Copy link
Copy Markdown
Author

I noticed myself not really looking at certain columns, like the path or commit hash, but also waiting to see the line diff against main, or the AI summary. So I think having control over every column makes it easy to customize what each person wants to see without changing the default.

max-sixty added a commit that referenced this pull request Jun 14, 2026
The custom template columns feature claimed the `[list.columns]` user-config
key, which collides with the column-visibility toggles in open PR #3065 (also
`[list.columns]`, but a flat map of built-in-column bools). The two are
mutually exclusive serde shapes for the same protected key; namespacing custom
columns under `[list.custom-columns]` lets both land independently, and
"custom-columns" is the precise name for what this defines.

The key never shipped, so no migration is needed: a clean rename of the serde
key (field `columns` -> `custom_columns`, `rename = "custom-columns"`) plus
every user-facing string -- error messages, the --help source in cli/mod.rs,
config.example.toml, the docs mirrors, and snapshots. The JSON output field
stays `columns` (a separate surface: the item's rendered values, not the
column definitions).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Jun 19, 2026
…er (#3073)

Two display features for `wt list` and the interactive picker, developed
together because they share the column-layout and progressive-rendering
machinery.

## Custom columns (`[list.custom-columns]`)

Each `[list.custom-columns.<Header>]` entry in user config adds a `wt
list` column: a minijinja template rendered per row over `branch`,
`worktree_path`, `worktree_name`, and `vars.*`, with optional `width`
and drop priority. Values expand before the skeleton renders, from
in-memory data only — `vars` come from the bulk git-config snapshot, so
no subprocess runs per cell. Widths are measured from content like the
Branch and Path columns; a column that is empty on every row is dropped.

Unknown variables and misspelled filters abort `wt list` with the
available-variables hint; undefined values render as empty cells (the
intended sparse-column shape). `wt list --format json` gains a `columns`
map per item, and its `vars` field now reads from the snapshot too (the
previous `--get-regexp` line-parse truncated multiline values). The
picker shares the row renderer, so the columns appear there as well; a
broken definition degrades to no columns plus a stashed warning, since
collect runs while skim owns the terminal.

The key is `[list.custom-columns]`, not `[list.columns]`, to avoid
colliding with the column-visibility toggles in #3065 (which claims
`[list.columns]` as a flat map of built-in-column bools — a mutually
exclusive serde shape for the same protected key). Namespacing here lets
both land independently.

Ref #1982 — the custom-columns proposal lives in that thread. The
issue's own title is a separate directory-naming request, so this
doesn't close it.

## Cached PR/MR numbers in the picker

The picker skips the networked CiStatus task, so until now it had no CI
column at all. Cached statuses are local data, though: collect now fills
rows from `.git/wt/cache/ci-status/` when the task is skipped under a
progressive handler, so PR/MR numbers fetched by earlier `wt list
--full` or statusline runs render in the picker — aligned with the same
`MaxPrNumber` ratchet width `wt list` uses, and with zero network
access.

A valid cache entry renders as-is. An entry whose TTL passed or whose
branch head moved keeps its PR/MR number dimmed: the number still
identifies the PR when the pipeline color may be outdated. Expired
entries without a number are dropped. The CI column is allocated only
when some row had a usable entry, and rows the cache can't fill resolve
to blank rather than a pending placeholder, since no task repaints them.

## Key files

- `src/config/expansion.rs`, `src/config/user/sections.rs`,
`src/git/repository/config.rs` — column resolution, the template
environment, and the bulk git-config snapshot.
- `src/commands/list/layout.rs`, `src/commands/list/render.rs` — column
width allocation and cell rendering.
- `src/commands/list/ci_status/mod.rs` — `populate_from_cache`, the
cache-only fill.
- `src/commands/picker/mod.rs` — the dry-run dump
(`WORKTRUNK_PICKER_DRY_RUN`) that makes picker row content assertable in
tests.

## Testing

Integration tests cover both features: custom columns (table render,
JSON output, empty-column drop, invalid-template error) and the picker
(cached PR numbers appear in the dry-run dump, uncached branches stay
blank). Unit tests cover the cache-population logic (valid,
expired-with-number, head-moved, dropped). Verified against the full
`cargo run -- hook pre-merge --yes` gate locally.

> _This was written by Claude Code on behalf of max_

---------

Co-authored-by: Claude Fable 5 <[email protected]>
max-sixty added a commit that referenced this pull request Jun 22, 2026
…#3141)

Adds `[list] columns` — an ordered selection of which columns `wt list`
renders. A non-empty list is exhaustive: only the listed columns appear,
in the given order (a subset and/or reorder). Both built-in columns and
`[list.custom-columns]` headers are selectable in one list. This is the
follow-up to the merged `--config-set` work (#3138): a reduced "fast"
view is `wt --config-set 'list.columns=[…]' list`, or an alias over it.

## Usage

`columns` takes a TOML array in config files or `--config-set`:

```toml
[list]
columns = ["branch", "status", "ci", "path"]
```

Built-in names: `branch`, `status`, `working-diff`, `ahead-behind`,
`branch-diff`, `summary`, `upstream`, `ci`, `path`, `url`, `commit`,
`age`, `message`. A custom column is named by its
`[list.custom-columns]` header, so a selection can mix both (`columns =
["branch", "Ticket", "ci"]`); a built-in wins over a custom header that
collides with its name.

When `columns` is set it is exhaustive — a custom column omitted from a
non-empty list is hidden. Omit `columns` entirely to keep the default
set, where custom columns append automatically.

`WORKTRUNK__LIST__COLUMNS` is deferred for now: the env overlay only
delivers scalars, so the env var is rejected with a warning and ignored
rather than silently dropped. An inline TODO plans to add it later by
parsing the value as TOML (matching the array form), not by splitting on
commas.

## Design

- **Drop-priority threading by filter, not renumber:** selection filters
the `COLUMN_SPECS` candidate list and overrides only the display sort;
`base_priority` is left untouched, so the Summary drop-loop arithmetic
and the `EMPTY_PENALTY` tiers stay correct (the allocator sorts by
priority, never indexes it). Reorder is display-only — narrow-terminal
drops follow the built-in importance order.
- **Validation at the `wt list` edge** (`parse_selected_columns`),
mirroring `[list.custom-columns]`, because `ColumnKind` lives in the bin
crate and is unreachable from the config crate. Unknown/duplicate names
error with the valid-name list; the picker degrades, foreground aborts.
- Applies to `wt list` and the `wt switch` picker (cosmetic only — the
picker fuzzy-searches a separate field, so hiding Branch never breaks
search). Statusline and `--format json` are unaffected. Gated columns
(`ci` needs `--full`, `summary` needs `[commit.generation]`) stay
hidden; custom columns append when no selection is set.

## Key files

- `src/commands/list/columns.rs` — built-in/custom name ↔ `ColumnKind`,
`parse_selected_columns`, completeness test
- `src/commands/list/layout.rs` — `ColumnSelection`, candidate filter
(built-in + custom), display sort
- `src/config/user/sections.rs` — `columns` field (plain `Vec<String>`),
merge (replace-wholesale)
- `src/commands/list/collect/mod.rs` — parse + thread the selection

Supersedes #3065 (the earlier `[list.columns]`-as-bool-map design).

## Testing

Unit tests (parser incl. built-in/custom mix and collision shadowing,
completeness guard over `COLUMN_SPECS`, layout cases incl.
gated-column-stays-hidden, custom include/hide, and
drop-by-base-priority), integration tests (config file, custom-column
select, `--config-set`, unknown-name error, env-var-not-yet-supported),
plus regenerated config-doc mirrors and help snapshots. Full pre-merge
gate green: 4051 tests, clippy, fmt, doc, doctest, lychee.

> _This was written by Claude Code on behalf of max_

---------

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
@Faria22 Faria22 closed this Jun 22, 2026
@max-sixty

Copy link
Copy Markdown
Owner

@worktrunk-bot please draft a changelog and acknowledge @Faria22 as responsible for improvements in this area, even though this specific PR is closed

@worktrunk-bot

Copy link
Copy Markdown
Collaborator

Here's a draft, @max-sixty.

The work that grew out of this area shipped in 0.61.0 as the custom-columns feature (#3073) — a template-driven [list.custom-columns.<Header>] rather than the boolean per-column toggles here, but the same goal: let people shape wt list without changing the defaults. That entry currently carries no acknowledgment, so the natural place to credit @Faria22 is there.

Proposed edit to the existing 0.61.0 wt list custom columns line — append a thanks clause:

  • wt list custom columns: Each [list.custom-columns.<Header>] entry in user config adds a column to wt list (and the wt switch picker)… The feature is experimental, so the config shape may still change. (#3073, thanks @Faria22, whose #3065 prototyped configurable wt list column visibility and motivated this area)

This matches the existing thanks @user / thanks @user for reporting convention used elsewhere in the changelog (e.g. the 0.60.0 wt step relocate and cargo install entries).

If you'd rather keep the released 0.61.0 section frozen and credit @Faria22 in the next release instead, an alternative is a fresh line under an upcoming ### Improved:

  • Configurable wt list columns: groundwork from @Faria22's #3065 toward per-user wt list column visibility, building on the #3073 custom-columns work.

Happy to open a PR with whichever placement you prefer — just say which.

@max-sixty

Copy link
Copy Markdown
Owner

please PR

worktrunk-bot added a commit that referenced this pull request Jun 23, 2026
…work

Append a thanks clause to the 0.61.0 `wt list` custom columns entry,
acknowledging @Faria22's #3065 prototype of configurable column
visibility, which motivated the custom-columns work that shipped.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@worktrunk-bot

Copy link
Copy Markdown
Collaborator

Opened #3174 — appends the thanks clause to the 0.61.0 wt list custom columns entry, crediting @Faria22's prototype here. If you'd prefer to keep the released section frozen and credit in the next release instead, let me know and I'll move it.

max-sixty pushed a commit that referenced this pull request Jun 23, 2026
…work (#3174)

Credits @Faria22 in the changelog for the configurable-column work, per
@max-sixty's request in
[#3065](#3065 (comment)).

Appends a thanks clause to the existing 0.61.0 **`wt list` custom
columns** entry — the released feature that grew out of this area —
acknowledging @Faria22's
[#3065](#3065), which
prototyped configurable `wt list` column visibility and motivated the
custom-columns work. This matches the existing `thanks @user` convention
used throughout the changelog (e.g. the 0.61.0 `cargo install` and `wt
step relocate` entries).

This was the placement I recommended in the
[draft](#3065 (comment)).
If you'd rather keep the released 0.61.0 section frozen and credit
@Faria22 in the next release instead, say the word and I'll move it
under an upcoming section.

Co-authored-by: worktrunk-bot <[email protected]>
Co-authored-by: Claude Opus 4.8 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants