Skip to content

docs(list): render wt list statusline's help on the docs site - #3568

Merged
max-sixty merged 3 commits into
mainfrom
statusline-help-in-docs
Jul 24, 2026
Merged

max-sixty merged 3 commits into
mainfrom
statusline-help-in-docs

Conversation

@max-sixty

@max-sixty max-sixty commented Jul 24, 2026 •

Copy link
Copy Markdown
Owner

wt list statusline's after_long_help documents the three output formats, the Claude Code stdin JSON contract, and the pace segment, but wt list's help had no <!-- subdoc: statusline --> placeholder, so none of it reached docs/content/list.md or the skill reference. It was terminal-only.

Adding the placeholder pulls it in as a wt list statusline section under # Subcommands, matching how wt step and wt config expose theirs.

What reading it on the web surfaced

The help text needed edits once it rendered as a page rather than a block below an Options list. A context-blind agent was given the two rendered pages and asked to answer setup questions from them alone; three of its snags were real.

The format lists were stale and used private names. They read branch status ±working commits upstream ci url, while the Columns table higher up the same page calls those HEAD±, main↕, Remote⇅. They also omitted main…±, which format_statusline_segments has emitted since that column became a default. The lists now use the column names and include it, and claude-code is stated as a delta on table rather than repeating it.

The formats read as a fixed layout. The example line on the Claude Code page has nine segments against an eleven-name format string, with no explanation. Three rules were in the code and in no doc: empty cells are omitted, claude-code drops branch when dir already ends in .<branch> (filter_redundant_branch), and an overlong line drops whole cells worst-priority-first (fit_to_width). All three are now stated.

The latency caveat lived only on the Claude Code page. A reader of the command's own docs had no way to learn it reaches the network. It moves to the reference. That exposed a contradiction with the definition, "Single-line status for shell prompts", against a caveat saying it is too slow for a synchronous prompt — so the definition becomes "Single-line status for the current worktree". This is the one user-visible string change here; it lands in wt list --help and the three help snapshots.

Deduplication with the Claude Code page

The pace paragraph and the OSC 8 paragraph were near-verbatim on both pages, and would have rendered twice on the site. claude-code.md keeps what is Claude Code-side (install, demo, the example line, and a plain note that the links degrade to unclickable text where the terminal lacks support) and links to the reference for the rest.

Follow-ups folded in

The module docstring at src/commands/statusline.rs:4 carried ±working commits upstream, the last occurrence in the tree of the labels this branch retired, and opened "Statusline output for shell prompts" — the framing the definition dropped. Both now match the help text.

Not done

An audit of every after_long_help in src/cli/ found 46 that never reach a docs page. Most are editorial calls rather than oversights: wt config create alone would embed ~450 lines of example TOML into a page that already covers that ground by hand. The one that looks like a plain oversight is wt step rebase / wt step push, the only two of twelve step operations without a marker, and the only two the ## Operations list leaves unlinked. Covering them needs their openers rewritten first, since both currently restate their definition. Left for a follow-up.

Verified with wt hook pre-merge --yes (4499 tests) and a zola build, which checks internal anchors.

This was written by Claude Code on behalf of Maximilian Roos

🤖 Generated with Claude Code

Its `after_long_help` carried the output formats, the Claude Code stdin
contract, and the pace segment, but `wt list` had no `<!-- subdoc: -->`
placeholder, so none of it reached docs/content/list.md or the skill
reference. Adding the placeholder pulls it in as a `wt list statusline`
section.

Reading it on the web surfaced three problems in the help itself:

- The format lists were stale and used their own names for `wt list`
  columns documented higher up the same page. They now use those column
  names and include `main…±`, which the statusline has been emitting
  since it became a default column. Empty cells, the redundant-branch
  drop in `claude-code` mode, and width-driven cell dropping are stated
  rather than left to be inferred from an example that has fewer
  segments than the format string.
- The latency caveat lived only on the Claude Code page, so a reader of
  the command's own docs had no way to learn it fetches over the network.
  It moves to the reference, and the definition drops its "for shell
  prompts" promise, which the caveat contradicted.
- The moon-phase gauge was documented only on the Claude Code page and
  is now on the field it renders.

claude-code.md keeps what is Claude Code-side (install, demo, the
example line, OSC 8 pass-through) and links to the reference instead of
restating the pace mechanics and link behaviour.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

@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.

Reviewing as a draft — flagging anything that looks worth a quick fix. Mark ready for a full review.

Verified the reworked prose against the implementation — the new column labels (HEAD± main↕ main…± Remote⇅ CI URL) match ColumnKind::header() in src/commands/list/columns.rs, the moon gauge (🌔 at 52–77%) matches format_context_gauge, and the "claude-code drops branch where dir ends in .<branch>" claim matches filter_redundant_branch. The subdoc marker follows the existing wt config / wt step pattern, and the WORKTRUNK_TEST_PARENT_SHELL line added to help_list_short.snap just brings it in sync with the long/narrow_80 snaps that already carried it.

One leftover: the module docstring at src/commands/statusline.rs:4 still renders the old labels the rest of this PR retired —

//! `branch  status  ±working  commits  upstream  [ci]  [url]`

That's the last occurrence of ±working commits upstream in the tree; worth updating to HEAD± main↕ main…± Remote⇅ to match the docs and the actual headers (it's outside the diff, so I didn't inline a suggestion — happy to push the one-liner if useful).

Drop "OSC 8 links, which Claude Code re-emits to the terminal rather than
drawing itself" for "clickable links where the terminal supports them, plain
text where it doesn't" — the terminal-internals framing was jargon for an
end-user integration page.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@max-sixty
max-sixty marked this pull request as ready for review July 24, 2026 14:12
The docstring carried `±working  commits  upstream`, the last occurrence of
the old labels this branch retired, and opened "for shell prompts" — the
framing the definition dropped, since a stale CI cache makes it too slow for
a prompt the shell blocks on.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 11a1498 into main Jul 24, 2026
38 checks passed
@max-sixty
max-sixty deleted the statusline-help-in-docs branch July 24, 2026 14:45
max-sixty added a commit that referenced this pull request Jul 24, 2026
…tating them (#3576)

The `## Statusline` section of `claude-code.md` paraphrased three facts
that the `wt list statusline` reference already owns:

| Fact | `claude-code.md` said | `src/cli/list.rs` says |
|---|---|---|
| Pace maths | "1.4× the pace that would exactly fill that window,
coloured by how much of it would be spent locked out at the cap" | "2.9×
the pace that would exactly fill that window… colour deepens with
severity as the forecast lockout grows" |
| Link degradation | "clickable links where the terminal supports them,
plain text where it doesn't" | "Both links are OSC 8, which a terminal
that doesn't support them discards" |
| CI fetch latency | "runs it in the background… 1–2 second CI fetch
invisible" | "reach the network for a second or two, so it fits a
statusline the host renders in the background" |

#3568 removed the near-verbatim copies from this section but left these
paraphrases behind, which is arguably the worse state: two wordings of
one fact drift apart independently, and a reader can't tell whether
they're the same claim or two different ones.

## What stays

The cut isn't to zero. The page shows an example line, so it needs
enough gloss for a reader to parse the line in front of them — a bare
pointer would make the section a stub. It keeps one sentence naming what
the stdin JSON contributes, with "how the links behave" folded into the
pointer that was already there.

The latency clause also stays, though it is the third duplicated fact.
Without it the opening paragraph only restates the command name, and it
is the one "why" that justifies the `settings.json` block below it.

## Side effect

This leaves the `OSC 8` wording in `src/cli/list.rs` as the single home
for the link behaviour. A precise term earns its place in an exhaustive
`--help` reference and grated on an end-user integration page — so the
jargon was really a symptom of the fact living in two places.

Docs-only. Mirrors regenerated by `test_docs_are_in_sync`; `zola build`
clean (14 pages, anchors resolve).

> _This was written by Claude Code on behalf of Maximilian Roos_

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

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Jul 25, 2026
…#3578)

Follow-up from #3568, which named these two as the one plain oversight
in its audit of `after_long_help` bodies that never reach a docs page.

`wt step rebase` and `wt step push` were the only two of twelve step
operations with no `<!-- subdoc: -->` marker, so their help was
terminal-only, and the only two bullets in `## Operations` left
unlinked. Both markers are added between `squash` and `diff`, per the
ordering invariant in `src/cli/step.rs`.

Both openers restated their `about` line, which reads as immediate
self-repetition on the web where `combine_command_docs()` concatenates
the two. Both bodies are rewritten.

## What reviewing the text against the code turned up

The old rebase body said "Conflicts abort immediately; use `git rebase
--abort` to recover", which is self-contradictory and wrong. Nothing
aborts: the worktree is left mid-rebase with git's conflict markers, and
git's output names `--continue`, `--skip`, and `--abort`. `wt merge`'s
pipeline step 3 carried the same sentence.

Four review passes then falsified nine more claims, every one reproduced
against a scratch repo before editing:

- **`--no-ff` runs no `git push` at all.** It builds the merge with
`commit-tree` + `update-ref` and syncs the worktree with `read-tree`; a
`-vv` trace shows zero `git push` invocations. The opener attributed the
whole command to `git push` with `--no-ff` as an example four lines
below. Its worktree sync is also best-effort, so the ref can move while
the worktree stays behind.
- **The Outcomes table was falsified by the upstream-swap topology.**
With local `main` diverged and behind `origin/main`, `wt step rebase
main` prints `Already up to date with origin/main` — `main` is not an
ancestor of the branch, and the result names a ref never typed.
- **"Nothing here reaches a remote" was false on a fresh clone.** With
no target argument and no cached `worktrunk.default-branch`,
`default_branch()` falls through to `git ls-remote`. The claim is now
"no commits leave the repository", which holds unconditionally.
- **The generated Arguments table contradicted the prose.** `[TARGET]
Target branch` sat two paragraphs below "the target is any commit-ish";
a blind reader nearly concluded rebase needs a branch name.
- **The table implied mutually exclusive rows.** `is_rebased_onto` is
checked first, and a branch at the target's tip satisfies both of the
first two.
- Plus: an orphan branch matched no row; "git's own output names the
ways out" is false under `advice.mergeConflict false`; "refused rather
than forced" raised the force question without closing it.

Adjacent, in files this change already touched: `wt merge`'s step 3
contradicted the new table and step 5 restated `wt step push`'s rule
with no link, so half the pipeline deferred and half repeated. Step 2
promised a backup ref unconditionally, but `create_safety_backup` runs
only when working-tree changes were staged — a clean-tree squash
rewrites commits and writes no `refs/wt-backup/` ref. That is a
data-safety claim, so it is corrected rather than left.
`docs/CLAUDE.md`'s subdoc "Use cases" cited `wt config create`, which
has no marker and no section.

## The code changes

**An annotated-tag target was never peeled.** Adding a tag example to
the rebase help is what made it worth running, and it did not work.
`is_rebased_onto` compared `git merge-base`, which peels an annotated
tag to its commit, against a bare `rev-parse`, which returns the tag
object's SHA. Those never match, so an annotated-tag target always
looked like it needed a rebase:

```
annotated   v1.2.0     → "outcome": "rebased"     (HEAD unchanged)
lightweight v1.2.0-lw  → "outcome": "up_to_date"   (same graph, same commit)
```

Fixed at the root by peeling with `^{commit}`, rather than documenting
the quirk. The test pairs the two tag types on one commit so the control
is a single factor away; it fails without the fix.

The reviewer caught that this test had gone missing, and it was right
about the consequence — without it, removing the `^{commit}` peel passes
CI. The cause was a merge resolution on this branch: `checkout --theirs`
on `tests/integration_tests/merge.rs` took main's whole file, dropping
`test_step_rebase_annotated_tag_is_peeled` along with the duplicate
squash test it was meant to drop. Restored, and re-verified in both
directions.

**`wt step push` ran out of a half-finished operation.** Mid-rebase, the
detached HEAD is a linear extension of the target, so the fast-forward
check passed and `wt step push main` printed `✓ Pushed to main (1
commit)` — moving the target branch onto a half-replayed history while
the worktree kept its conflict markers and the rebase stayed open. It
now runs the `ensure_no_operation_in_progress` gate `wt step rebase` and
`wt merge` have used since 84cbb04.

#3579 landed while this was open and closed the same class for the
staging commands, with a better predicate for them: `git add -A`
collapses an unmerged path's stages, so the index is what knows, and an
index read also catches a conflicted `git stash pop` that writes no
state file. `wt step push` was scoped out of that, correctly — it stages
nothing, so an index read cannot speak for it. Its hazard is HEAD
itself, which is what the operation gate answers. The merge takes main's
`squash.rs` and its `test_step_squash_refuses_mid_merge` wholesale and
drops this branch's version of both; the gate's docstring now hands the
unresolved-conflict question to `WorkingTree::ensure_no_unmerged_paths`
instead of claiming it, and the rebase help enumerates all four gated
commands.

**A target worktree registered after its directory is gone got two
different answers.** The fast-forward died inside receive-pack — `fatal:
exec 'update-index': cd to '…' failed`, `! [remote rejected] HEAD ->
main (Up-to-date check failed)` — with the ref untouched, while
`--no-ff` moved the ref with plumbing of its own and skipped the sync,
so it succeeded over the same broken registration. Both refuse now with
the branch named and `git worktree prune` as the remedy, which is what
retires the two `.exists()` checks that papered over the state
downstream. `--no-ff` succeeding here is the one behavior this takes
away; a stale registration is worth one error rather than half a
success.

## Found and not fixed here

**Ignored files in a target worktree are silently overwritten, and `git
worktree lock` does not stop it.** `git status --porcelain` omits
ignored files, so the overlap check cannot see them and the stash does
not take them. Reproduced against the FAQ's own example
(`docs/content/faq.md:180` recommends the lock for "precious ignored
data"): a locked target worktree holding `db.sqlite` had it replaced by
the branch's tracked file, exit 0, no warning. The lock scopes to
removal only. A pathspec-limited probe of the push range detects it
without enumerating large ignored trees — `git -C <target-wt> ls-files
-o --ignored --exclude-standard -z -- <push_files>` names the colliding
file and stays silent about a 200-file ignored `target/` — but whether a
collision should refuse is a policy call, so it is left out.

## Verification

`wt hook pre-merge --yes` on the merged tree → exit 0, 4554 tests, no
pending snapshots. `zola build` clean, both anchors resolving and
merge.md's cross-page link landing. Every factual claim checked by
running `wt` against a purpose-built repo, and each of the three code
fixes has a test that fails without it.

> _This was written by Claude Code on behalf of Maximilian Roos_

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

---------

Co-authored-by: Claude Opus 4.8 (1M context) <[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.

2 participants