Skip to content

feat(config): list all aliases when wt config alias show has no name - #2684

Merged
max-sixty merged 1 commit into
mainfrom
alias-show-listall
May 11, 2026
Merged

max-sixty merged 1 commit into
mainfrom
alias-show-listall

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

wt config alias show <name> shows one alias's configured template. With no name it now lists every configured alias — the same Aliases: block wt --help renders (name, source, one-line summary). This is the receiving end of a separate change that replaces the inline aliases block in wt --help with a pointer to wt config alias show.

Implementation: name becomes optional with a single internal branch — no --list or --all flag. The listing reuses render_aliases_section / load_aliases_for_listing from commands/alias.rs (promoted to pub(crate)) rather than duplicating. It tolerates running outside a repo (user-config aliases still list, project-config ones are skipped) or outside a config, prints No aliases configured when empty, and pages like wt hook show. Top-level shadowing is annotated (list → (shadowed by built-in)).

Audit of other show/view/info/print subcommands found nothing else to change: wt hook show [TYPE] already does this, wt config show / wt config shell show-theme / wt config state get take no positional and already show everything, and no view/info/print subcommands exist.

Help text and the auto-synced docs/skill reference are updated; new snapshot tests cover the populated and empty listings, and the four config_alias_show_unknown_* snapshots pick up the Usage: ... [NAME] change.

`wt config alias show <name>` shows one alias's template; with no name it
now prints the same `Aliases:` block `wt --help` renders (name, source,
one-line summary), reusing `render_aliases_section` / `load_aliases_for_listing`
rather than duplicating. `name` becomes optional with a single internal branch —
no `--list` flag. Tolerates running outside a repo or config; prints
`No aliases configured` when empty.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit a3733dc into main May 11, 2026
33 checks passed
@max-sixty
max-sixty deleted the alias-show-listall branch May 11, 2026 05:42
max-sixty added a commit that referenced this pull request May 11, 2026
The `Aliases:` section in `wt --help` / `wt step --help` printed each
alias's command template verbatim. Long one-liners (e.g. a `landed = "wt
up && wt hook post-merge; git merge ..."`) wrapped mid-token in an
80-column terminal and made the section look broken.

`wt --help` now shows just the alias names — deduped when the same name
is defined in both user and project config, with shadowed-by-builtin
still flagged inline — and points to `wt config alias show` for the full
listing:

```
Aliases:
  landed, list (shadowed by built-in), sw, up

Run wt config alias show for the full definitions.
```

The detailed per-alias listing (`name command-summary (source)`) stays
in `render_aliases_section`, which `wt config alias show` (no argument)
reuses after #2684 — so `--help` is the compact orientation view and `wt
config alias show` is the inspection view. A new
`render_aliases_help_section` produces the compact form.

While in there: each styled name ends with a full reset (`\e[0m`), and
the name list ends with a trailing space. The markdown pass over the
spliced help text (`wrap_styled_text`) strips the `\e[39m` that
`cformat!`'s `</>` emits and drops a reset that ends a line, so without
these the last name's color bled onto the "Run …" sentence below. This
also matches how clap closes each `Commands:` entry.

Merged `main` (which landed #2684's `wt config alias show` no-arg
listing) and resolved the overlap in `src/commands/alias.rs`.

---------

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request May 11, 2026
## Summary

`wt config alias show` with no name showed a compact one-line summary
listing (the `name command-summary (source)` table added in #2684). This
swaps it for the full per-alias view: the same `○ Alias <name>
(<source>):` header + gutter block that `wt config alias show <name>`
prints, emitted for every configured alias in name order (user entry
before project when a name is defined in both), with the
shadowed-by-built-in stderr warning preserved (once per name). `--help`
/ `wt step --help` keep the compact names-only `Aliases:` section and
point here.

```
○ Alias landed (user):
  wt up && wt hook post-merge; git merge {{ default_branch }} --no-edit && { git
   diff {{ default_branch }} --quiet && git reset {{ default_branch }}; :; }
○ Alias sw (user):
  wt switch {{ args }}
○ Alias up (user):
  git fetch --all --prune && wt step for-each -- sh -c '
    ...
  '
```

Also drops the blank line between consecutive `format_entry` blocks —
applied consistently to `wt config alias show` (the new listing), `wt
config alias show <name>` (had a blank line between the user and project
entries when a name is in both configs), and `wt config alias dry-run
<name>` (same). The `○ Alias …` header is the delimiter everywhere.

The compact-summary renderer (`render_aliases_section` +
`format_alias_summary`) and its unit tests are removed — only #2684's
no-arg listing used them; `--help`'s names-only section is the separate
`render_aliases_help_section`, which is untouched.

## Changes

- `src/commands/config/alias.rs` — `list_aliases()` rewritten to emit
`format_entry` per alias; `handle_alias_show` / `handle_alias_dry_run`
drop the inter-entry blank line; docstrings + module doc updated.
- `src/commands/alias.rs` — delete `render_aliases_section`,
`format_alias_summary`, and their tests; tidy the
`render_aliases_help_section` doc.
- `src/cli/config.rs` — `wt config alias show` help text reflects the
new behavior.
- Docs (`docs/content/config.md`, skill mirror) regenerated; three
snapshots updated (one content change + cosmetic env drift on two).

## Test plan

- [x] `cargo run -- hook pre-merge --yes` — 3581 tests pass, all lints
green
- [x] Manual: `wt config alias show`, `wt config alias show <name>`, `wt
config alias dry-run`, `wt config alias show --help`

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <[email protected]>
@max-sixty max-sixty mentioned this pull request May 13, 2026
max-sixty added a commit that referenced this pull request May 13, 2026
Release v0.50.0.

Highlights:

- Experimental Azure DevOps support (#1256, thanks @mikeyroush; fixes
#1144 from @dlecan) — `wt switch pr:<N>`, `wt list --full`, and `wt
config show --full` recognize Azure DevOps via the `az` CLI.
- Experimental Gitea CI-status detection (#2702) on top of the Gitea
`pr:` shortcut (#1320, thanks @SjB).
- Hooks now resolve `.config/wt.toml` from the worktree they act on —
the primary-worktree fallback is gone, and `post-remove` reads the
removed worktree's config (snapshotted before removal). Approval prompts
collect hook commands from the same worktree. Breaking change for setups
that relied on the primary-worktree fallback; the changelog entry has
the recovery action. (#2690, #2703, #2714, #2717, #2701, #2708, #2727,
#2736, #2748)
- The `wt switch` picker's `alt-r` removal no longer runs unapproved
project hooks (#2746) — the picker's removal path is now routed through
`handle_remove_output` and consults the existing approval state
read-only.
- `wt config alias show` with no name lists every alias's full
definition (#2684, #2691); `wt --help` switches to a compact aliases
pointer (#2688).
- `wt list --branches` warm-run perf: SHA-keyed cache for `main↕` and
`Remote⇅` ahead/behind counts; shared push-remote URL and local-branch
scan (#2704, #2718, #2673).
- Claude Code plugin ships the `wt-switch-create` skill (#2737, thanks
@onetom for #2631).

See `CHANGELOG.md` for the full list (8 Improved, 5 Fixed, 5 Internal).

semver-checks reports breaking library-API changes (new enum variants
without `#[non_exhaustive]`, removed `Branch::github_push_url`, new
trait method on `RemoteRefProvider`), which mandates at minimum a minor
bump pre-1.0.
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.

2 participants