The Agent Integration page says the plugin's
`WorktreeCreate`/`WorktreeRemove` hooks route Claude Code worktrees
through `wt`, without saying that this doesn't apply to worktree
sessions started from the Claude desktop app. The app creates those
worktrees itself, under `.claude/worktrees/`, and doesn't call plugin
worktree hooks. Upstream tracks this in
[anthropics/claude-code#29716](https://github.com/anthropics/claude-code/issues/29716),
which is still open. This PR adds one sentence to the worktree isolation
section saying so and linking that issue, and regenerates the two skill
mirrors. `test_docs_are_in_sync` passes.
The page doesn't recommend the workaround from #4776, which is to copy
the hooks into `~/.claude/settings.json` and disable the plugin. Two
things count against it. Disabling the plugin drops `/wt-switch-create`
and `/wt-diff`, and the CLI runs both copies when both are enabled. The
upstream thread also disagrees on whether settings-file hooks run in the
desktop app: one report says they do, and a later one says they don't.
The workaround stays documented on the issue for anyone who wants that
trade.
Closes#4776 — automated triage
Co-authored-by: worktrunk-bot <254187624+worktrunk-bot@users.noreply.github.com>
`.worktreeinclude` now selects by git's own gitignore rules, including
paths inside a wholly ignored directory that an include line names, as
Claude Code does. `git ls-files --directory` lists such a directory as
one entry, so `.cache/claude-code-types/` under an ignored `.cache/`
matched nothing, and `copy-ignored` and `promote` skipped it. Claude
Code's own `.worktreeinclude` copy reaches it, and a team trialling the
Claude Code plugin lost that cache in every new worktree
(Rikmorn/sidekick#287).
Git now does all the matching. Discovery runs `git ls-files -o -i
--directory` once with the standard exclude sources and, when
`.worktreeinclude` exists, again with that file as the only source. An
entry is selected where the two listings overlap, taking the deeper path
of each pair where one holds the other. Inside a directory git lists
whole, only lines that name a path (a slash before the end, past any
leading `/` or `**/`) select, as found by a third listing of those lines
plus the negations. A name matched at any depth (`.env`, `types/`)
selects only outside such directories. Claude Code, which defines the
file, agrees on path-naming lines; it differs in opening a directory
from a line's text and then applying every line inside, so for
`packages/*/.cache/types/` plus `.env` it also copies
`packages/foo/node_modules/pkg/.env`. The `.worktreeinclude` parse error
goes away, since git takes any line as a pattern. So:
- A pattern naming a path inside an ignored directory (`.cache/types/`)
selects it, and its siblings stay behind.
- A pattern that matches at any depth (`.env`) selects the root `.env`
and any `.env` git lists on its own, but never a package's `.env` from
`node_modules/`.
- A negation can't re-include a path inside a selected directory.
- An include line naming a partly ignored directory (`build/` with only
`build/*.o` ignored) selects only its ignored files.
The cost is that each include listing walks every untracked directory:
0.33 s over 124k ignored files with a warm cache, against 0.03 s for the
standard listing. Without `.worktreeinclude`, discovery runs one listing
as before.
Reaching inside ignored directories needed boundaries that
whole-directory entries had made unnecessary:
- Built-in VCS and tool-state directories now exclude everything inside
them too, so `promote` no longer moves `.jj/repo`.
- `promote` refuses a destination that resolves outside its worktree
through a symlinked directory, and `copy-ignored` checks before creating
parent directories. The containment error now says "write" rather than
"copy".
The Claude Code page now says that hook-made worktrees ignore
`worktree.baseRef`, since the hook input carries the worktree's name and
no base.
Left alone, and older than this change: copying or promoting into a
destination where another worktree is checked out inside an ignored
directory writes into that worktree, with or without `.worktreeinclude`.
> _This was written by Claude Code on behalf of max-sixty_
The `wt list` docs never explained the shortened counts, so a value like
`↑3C` or `+∞` could only be decoded by reading
[`format_overflow`](https://github.com/max-sixty/worktrunk/blob/a6cbc2947852261ac22540c4016901bd2f885847/src/commands/list/render.rs#L72-L91).
This adds one paragraph under **Columns** in `wt list --help` and the
generated docs: `C` is hundreds and `K` thousands, both rounded down,
`∞` means 10,000 or more, line counts stay exact up to 999 and commit
counts up to 99, shortened values are drawn brighter, and
`--format=json` carries the exact counts.
The paragraph describes current behavior, so it needs only a one-line
edit if the column widths or the `C` notation change. The docs sync test
passes and the two `wt list --help` snapshots are refreshed.
Refs #4769 — automated triage. The issue's open questions (a third digit
place for commit counts to drop `C`, and giving the count columns
priority on narrow terminals) are rendering decisions this PR leaves
alone.
Co-authored-by: worktrunk-bot <254187624+worktrunk-bot@users.noreply.github.com>
`wt list` labelled its ahead/behind and branch-diff columns `main↕` and
`main…±` in every repository, so a repo whose default branch is `master`
or `develop` saw a header naming a branch it doesn't have (#4727).
Following the discussion there, the headers now use the symbols
worktrunk already gives these refs:
| Column | Before | After |
|--------|--------|-------|
| `working-diff` | `HEAD±` | `@±` |
| `ahead-behind` | `main↕` | `^↕` |
| `branch-diff` | `main…±` | `^…±` |
`^` is the default-branch shortcut `wt switch ^` accepts, and `@` is
both Git's and `wt switch`'s name for the current HEAD. The `## Columns`
section of the list docs now explains this in place of the sentence that
defended the fixed `main` label.
No column changes width. Each one is sized by its pre-allocated values
(`+999 -999`, `↑99 ↓99`), which were already wider than the old headers,
so the only layout change is where the shorter header is centred. Config
keys (`[list] columns`) and JSON output don't change.
The change itself is the three strings in `ColumnKind::header`. The rest
is regenerated snapshots and doc mirrors, plus comments and test
fixtures that quoted the old labels. One picker test,
`test_arrow_toward_row_ignores_the_column_header`, relied on the header
containing `main`; it now checks the same header exclusion with
`Remote`, which appears only in the header row.
The demo GIF snapshots under `docs/demos/snapshots/` still show the old
headers. They come from the demo build (`docs/demos/build`), which needs
VHS and isn't run here.
Locally, the list, picker, help and docs-sync tests pass, along with
clippy and fmt. Some `config_show`/`configure_shell` tests and a few
socket and signing tests fail in this sandbox, and they fail the same
way on `main`.
Refs #4727. The issue's other points are still open: how `C`/`K`/`∞`
overflow values are shown and documented.
Co-authored-by: worktrunk-bot <254187624+worktrunk-bot@users.noreply.github.com>
A session already in a worktree can enter only a worktree under its
repo's `.claude/worktrees/`, so `/wt-switch-create` step 3's
`EnterWorktree({path})` always hit the managed-location rejection there.
The `cd` recovery then left Claude Code tracking the old worktree: its
Bash guard, session exit, and `ExitWorktree` all kept acting on it. Step
3 now calls `ExitWorktree({action: "keep"})` before entering. That keeps
the old worktree on disk and makes the entry a first entry. With no repo
argument the session enters from where leaving put it, with no `cd`.
With a repo argument, `cd <repo>` follows as before.
This applies the patch from the issue verbatim:
`skills/wt-switch-create/SKILL.md` and `rationale.md`, plus the
`plugins/worktrunk/skills/` mirror regenerated by
`test_docs_are_in_sync`. That includes the follow-on edits: the handback
names the worktree the session left, `git stash pop` waits until the
session is in the new worktree, Cleanup covers the worktree that was
left, and rationale.md corrects the rejection list and the Known limits
entry.
Verification: the behavior depends on Claude Code's live
`EnterWorktree`/`ExitWorktree` tools, which CI can't run. The evidence
is the issue's live checks against Claude Code 2.1.316 and wt v0.81.0,
including a headless A/B where every already-in-a-worktree scenario went
from 0/3 (0/2 for `--worktree`) to 3/3 and plain sessions stayed 3/3.
Locally, the patch applied cleanly at `d022f7683` and
`test_docs_are_in_sync` passes with the regenerated mirror.
Closes#4713 — automated triage
---------
Co-authored-by: worktrunk-bot <254187624+worktrunk-bot@users.noreply.github.com>
## What
Nine in-page anchor links in the reference docs point at fragments that
no heading generates:
- `](#custom-columns)` - the heading is `### Custom columns
[experimental]` (`skills/worktrunk/reference/list.md:123`, `#### Custom
columns [experimental]` at `skills/worktrunk/reference/config.md:231`),
so the generated fragment is `#custom-columns-experimental`. 6 links
updated (list.md x2, config.md x1, plus the `plugins/worktrunk/` synced
copies).
- `](#default-branch-object)` - the heading is `### default_branch
object` (`skills/worktrunk/reference/list.md:331`,
`docs/src/content/docs/list.md:347`), so the fragment is
`#default_branch-object` (underscore, not hyphen). 3 links updated
(skills + plugins list.md, docs list.md).
The `docs/src/content/docs/list.md` copy of the custom-columns links was
left alone: its own heading is `### Custom columns` (no `[experimental]`
suffix), so `#custom-columns` resolves there.
## Why
Readers of the Columns table and the JSON object docs click these links
and land nowhere. The default_branch link is especially easy to miss
since `head-object` / `worktree-object` next to it do resolve.
## How it was verified
- Every heading was read from the current `main` files; fragment names
follow the GitHub slugger (`[` `]` stripped, spaces to hyphens, `_`
kept).
- An anchor checker over all 91 markdown files found exactly these nine
dead fragments (plus three template placeholders like `{{ env.LINK }}`
and literal `...` / `@/...` ellipses, which are intentional and
untouched).
- The `skills/worktrunk/reference/` and
`plugins/worktrunk/skills/worktrunk/reference/` copies were kept
byte-identical.
## Follow-ups deliberately left out
- The `[experimental]` suffix in the headings leaks into the fragments;
renaming headings would produce cleaner anchors but changes existing
inbound links elsewhere, so only the links were repaired.
---------
Co-authored-by: worktrunk-bot <254187624+worktrunk-bot@users.noreply.github.com>
Co-authored-by: viwe-monai <viwe-monai@users.noreply.github.com>
Refs #4656
Updates the `/wt-diff` hook's error handling to properly surface
`tool.call` tracking failures to the engine.
* **Let throws reach the engine:** Removed the `try/catch`,
`console.error`, and `.catch(...)` passthrough. Tracking errors now
propagate natively so the engine can catch them and accurately log `hook
skipped: threw <message>`.
* **Tested the subagent path:** Added a test to verify that a subagent
edit correctly tracks its worktree and shows its diff.
Codex 0.164+ ties plugin hook approval to a fingerprint of every file in
the plugin directory. The `worktrunk` plugin keeps the skills mirror and
docs next to its four marker hooks, so almost every release made Codex
ask users to approve hooks that hadn't changed (#4654). This PR moves
those hooks into a second plugin, `worktrunk-markers`. It holds only its
manifest and copies of the `wt.sh`/`wt.cmd` shims, so its fingerprint
changes only when the hooks or shims change. `wt config plugins codex
install` adds both plugins, and `uninstall` removes both.
The design follows the live test max-sixty posted in #4654 on Codex
0.166.0. A skill or README change re-prompted the combined plugin but
not a hooks-only one. That test also listed four requirements, and this
PR covers each one:
- **Existing installs.** When an existing user's `worktrunk` plugin
updates, its hooks go away silently. The installer adds the markers
plugin, and the Codex section of the agent-integration docs now names
`codex plugin add worktrunk-markers@worktrunk` for older installs.
- **No Claude hooks warning.** The `worktrunk` Codex manifest keeps
`"hooks": {"hooks": {}}`, so Codex does not read Claude's
`hooks/hooks.json` and warn.
- **Real shim files.** The shims are real copies, not symlinks. The new
`test_codex_markers_shims_match` checks that they match
`plugins/worktrunk/hooks/` byte for byte, that the directory holds only
those three files, and that the manifest has no `version`. Neither
manifest has a `version` today, and no release step edits `plugin.json`.
- **Uninstall.** `uninstall` removes the markers plugin first. `codex
plugin remove` already exits 0 for a plugin that isn't installed, so
older single-plugin installs uninstall cleanly.
Verification: the Codex plugin, layout, help and docs-sync tests pass
locally, with snapshots updated for the new install and uninstall
output. In the sandbox, the full `pre-merge` gate stopped on `cargo fmt`
(fixed in this commit) and on test failures that come from the sandbox
itself: blocked Unix sockets, a `0644` signing key, and a nushell
autoload file left in the shared home.
`test_config_show_codex_available` fails the same way on `main` here.
Two things are unverified. I haven't run a real Codex session against
this branch. I also haven't checked that running `wt config plugins
codex install` again succeeds when the marketplace is already
registered, which is why the upgrade note in the docs names the direct
`codex plugin add` command.
Closes#4654
Co-authored-by: worktrunk-bot <254187624+worktrunk-bot@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
`wt remove --force` now saves a worktree's uncommitted changes before
discarding them, using the same `refs/wt-backup/<branch>` ref and reflog
that the squash backup in `wt merge` / `wt step squash` already uses.
The output then prints the backup and a recovery command:
```
▲ Discarding uncommitted changes (--force):
?? devbox.lock
↳ Backup created @ refs/wt-backup/feature-untracked (690353c)
↳ To recover in a new worktree, run wt switch --create --base 690353c… --no-hooks recovery/690353c
```
Closes#4544.
## What gets saved
- Staged, unstaged, and untracked files go into the snapshot, which is
what `git add -A` would stage. The snapshot is built through a
`TempIndex`, so the real index and the stash list are left alone.
- Ignored files, such as build output, are not saved. For submodules,
only the checked-out commit is recorded; uncommitted changes inside a
submodule are not saved.
- The backup commit's parent is the worktree's `HEAD`, so the branch tip
also stays reachable after `-D` deletes the branch. On an unborn branch
the commit has no parent.
- The backup is taken only when `--force` actually discards something. A
clean `--force` removal creates no ref.
## Decisions for review
- **Always on, no flag.** This follows the issue thread: a flag would
grow the CLI, and always saving means `-f` loses nothing you can't get
back.
- **A failed backup refuses the removal.** The error is `Failed to back
up uncommitted changes; worktree not removed`, followed by git's own
error, and the "Discarding uncommitted changes" warning is printed only
after the backup succeeds. That follows the data-safety guidance in
AGENTS.md. It means `wt remove -f` now refuses a worktree that `git add
-A` can't snapshot, such as one holding an unreadable non-ignored file
or an untracked nested repo with no commits. A worktree whose `git
status` fails (for example, a corrupt index) still has no backup and is
removed as before (#4347). The alternative is to warn and continue.
- **Cost.** Untracked files that aren't ignored are written as blobs. A
large unignored artifact makes the removal slower and grows the object
store until the reflog entry expires. Nothing prunes `refs/wt-backup/`
today, and this PR doesn't change that.
## Code
`create_safety_backup` and the new `create_removal_backup`
(`src/git/repository/working_tree.rs`) share a `record_backup` helper
for the `commit-tree` / `update-ref` step. The helper looks up the
branch name without the cache, and falls back to `symbolic-ref` so an
unborn branch is still named. The removal side lives in
`stage_worktree_removal` (`src/git/remove.rs`). That function runs right
before the worktree is renamed into trash, so it covers `wt remove`, `wt
merge --remove`, and the foreground path.
## Tests
- `test_remove_force_with_untracked_files` now checks that the backup
ref holds the untracked file's content, that its parent is the removed
branch tip, and that an ignored file is excluded.
- A new unit test covers the unborn-branch case.
- `test_remove_force_refuses_when_backup_fails` checks that an untracked
nested repo with no commits leaves the worktree in place, and that no
discard warning is printed.
- The four `remove_force_with_*` snapshots and the `wt remove --help`
snapshot gain the new lines. The docs (`wt remove` help, FAQ) mention
the backup.
---------
Co-authored-by: worktrunk-bot <254187624+worktrunk-bot@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
`wt switch` now handles a fork PR or MR whose branch name is already
used locally on GitLab and Azure DevOps, matching the existing GitHub
and Gitea behavior. GitLab uses the source project's namespace as a
prefix, including nested groups; Azure DevOps uses the fork repository
name. The prefixed branch tracks the PR or MR ref and remains
fetch-only, so it cannot push to the fork.
The change also updates the `wt switch` help and its generated
documentation to describe the shared behavior. Integration tests cover
GitLab conflicts with and without existing tracking, Azure DevOps
conflicts, and the no-conflict Azure path. The prefixed-name unit tests,
docs sync test, and help snapshots pass locally.
---------
Co-authored-by: worktrunk-bot <254187624+worktrunk-bot@users.noreply.github.com>
Adds one sentence to `wt remove --help`, after the examples that remove
worktrees by name: it points readers who want to choose interactively to
`Alt-x` in the [`wt switch`
picker](https://worktrunk.dev/switch/#interactive-picker). This follows
the maintainer's request in #4635. Bare `wt remove` still removes the
current worktree.
The generated docs page, the skill reference mirrors, and the
`help_remove_long` snapshot were regenerated. `test_docs_are_in_sync`
and the help snapshot tests pass locally.
Closes#4635
Co-authored-by: worktrunk-bot <254187624+worktrunk-bot@users.noreply.github.com>
A branch deleted outside `wt` (for example with `git branch -D`) leaves
its `worktrunk.state.<branch>.marker` key in git config. A later `wt
switch --create` with the same name then showed the old 🤖/💬. Now `wt
switch --create` clears that branch's marker once `git worktree add -b`
succeeds. #4684 already clears the marker on every `wt` deletion path.
This is the follow-up the maintainer asked for when closing #4685.
- The deletion helper from #4684 moves to
`Repository::clear_branch_marker`, and both call sites use it. It is
still best effort: a failed unset is logged at debug level, and only
marker JSON is removed, so a `vars` entry named `marker` that shares the
key is left alone.
- Only `--create` clears the marker. Switching to an existing branch
keeps its marker, and so does a DWIM checkout from a remote branch or a
PR/MR ref.
- A branch deleted and recreated with plain `git` still keeps its marker
until `wt config state marker clear`. The marker help, its generated
docs, and the help snapshot now say so.
`test_switch_create_clears_stale_marker` sets a marker on a branch name
that has no branch and on an existing branch. It then runs `wt switch
--create` for the first and plain `wt switch` for the second. It fails
without the change, because the stale marker survives, and passes with
it. The existing `deletion_*` unit tests pass on the moved helper.
Refs #4683
Co-authored-by: worktrunk-bot <254187624+worktrunk-bot@users.noreply.github.com>
Calling /wt-diff before git init caches a null worktree lookup for the
session directory. Initializing the repository afterward does not help:
subsequent commands reuse that miss and report no Git worktree for the
rest of the module lifetime. A transient Git/process failure is
similarly cached permanently.
Cache only successful locate results. Successful worktree lookups still
avoid repeated Git subprocesses. This intentionally trades
negative-cache savings for recovery: three repeated non-repository
lookups now perform three Git probes rather than one. These probes occur
when locating for the command/open pane; passive hooks still only note
directories. Positive-cache invalidation behavior is unchanged.
Added a canonical Claude test for a failed command followed by a
now-available repository, opening the pane and retaining the successful
lookup cache.
Native plugin validation at `1e4d728a2c740b93c945c3f6a76cbde2c77899d5`
with Claude Code 2.1.316: `claude plugin validate plugins/worktrunk`
passes with the existing missing-version warning, and `claude plugin
test plugins/worktrunk` passes all 9 canonical tests. Restoring only the
relevant production file to upstream while retaining the new canonical
test gives 8 passes and 1 failure; the unchanged upstream suite passes
all 8 tests. The plugin snapshots were checked against every tracked Git
blob at the PR head. These local runs use the canonical mocked host
events, not a live terminal/provider session.
Additional Git-boundary evidence: Node 24 executes the actual locate
function body extracted from register.tsx, with TypeScript types
stripped, against real temporary Git repositories. Four checks cover git
init after a miss, a controlled transient process failure followed by
actual Git discovery, successful-cache reuse, and repeated
non-repository probe counts. Unchanged source: two failures/two passes.
Fixed: four passes in 490ms. That standalone runner checks the Git
boundary separately from the native plugin suite; no live-session or
maintainer acceptance is claimed.
AI disclosure: implementation, tests and description were prepared with
Codex and independently reviewed by another Codex agent. No
human-authorship or human-review claim is made.
The documented `move-changes` alias now stops when either stash
operation fails. A failed stash push no longer starts the new worktree,
and a failed stash pop no longer runs the forwarded command in a
partially restored worktree.
The docs sync test and site build passed. A shell reproduction confirmed
that the previous command ran its follow-up after a failed stash pop and
the revised command exits with that failure. The full pre-merge gate ran
5,476 tests: 5,469 passed, seven failed in local environment-sensitive
tests (including unavailable Unix sockets, shell snapshots, and signing
key permissions). This is a documentation-only edit, so the shell
reproduction covers the changed recipe; PR CI will verify the published
revision.
Co-authored-by: worktrunk-bot <254187624+worktrunk-bot@users.noreply.github.com>
`wt remove --delete-branch` already overrides `[remove] delete-branch =
false`, but the flag was hidden from help. This makes the override
visible in help and the generated remove guide, and makes the `-D`
conflict error point to it when the conflict comes from config. An
explicit `--no-delete-branch` conflict now names that flag directly.
The new help test failed before the change and passes now. The existing
merged-branch override test and a new unmerged `--delete-branch -D` test
pass, as do all 192 removal integration tests and the docs sync test.
The local docs build could not run: Astro requires Node >=22.23.4 and
this runner has 22.23.3.
Closes#4614 — automated triage
Co-authored-by: worktrunk-bot <254187624+worktrunk-bot@users.noreply.github.com>
The Claude Code plugin gains `/wt-diff`, a pane beside the conversation
that lists the worktrees the session has worked in, with the selected
one's `wt step diff` below it, drawn file by file with Claude Code's own
diff renderer. It is a hooks module, Claude Code's early-access function
hooks API, and the plugin's only one.
A worktree joins the list when the session starts or moves into it, or
when the session or a subagent edits a file there or runs a Bash command
there that isn't read-only. Until `/wt-diff` first runs, the hooks only
note those directories in session state: no `git` or `wt` process runs
and nothing is drawn, which a test asserts. While the pane is open, `wt
list --format=json` (once per repository) supplies the rows and `wt step
diff` the selected worktree's files; it refreshes on open, on selection,
after a burst of non-read-only tool calls goes quiet, and at the end of
each turn.
Keys: `1`–`9` select a worktree, `j`/`k` move between files
(`ctrl+↓`/`ctrl+↑` from the prompt, borrowing the chords of Claude
Code's own diff panel), `r` refreshes, and the arrows and page keys
scroll. Running `/wt-diff` again, or `ctrl+x tab`, gives the pane the
keyboard back. A plugin can't ship keybindings, so the pane has no
dedicated chord.
Compatibility: Claude Code releases without hooks modules drop the
`modules` key and still load the command hooks (checked on 2.1.100), so
the 🤖/💬 markers keep working there. Codex and Gemini never read the
module.
Where to look:
- `plugins/worktrunk/hooks/register.tsx` — the module, with its spec at
the top.
- `plugins/worktrunk/hooks/patch.ts` — splits the patch into files, with
rename and mode notes.
- `plugins/worktrunk/types/index.d.ts` — the state contract;
`tests/diff.test.tsx` — the suite.
- `hooks/hooks.json` gains `modules`, `plugin.json` gains `types`, and
the agent integration docs gain a `/wt-diff` section (skills mirrors
regenerated).
One drawing holds 100,000 characters, so the selected file always draws
(cut at whole hunks, or to the start of its first hunk, if it must be)
and the others draw within the remaining budget; a patch over the 4 MiB
that `$.process.run` captures drops its last file and says so.
Checked locally: `claude plugin validate plugins/worktrunk`, `claude
plugin test plugins/worktrunk` (8 pass), `test_docs_are_in_sync` and
`test_plugin_layout_is_consolidated`, and live sessions on Claude Code
2.1.314.
> _This was written by Claude Code on behalf of max-sixty_
Shell integration detection used partial shell-syntax heuristics to
decide whether an entire rc-file line belonged to Worktrunk. An alias
quoting initialization, or an initialization followed by another
command, could therefore be removed by uninstall.
Recognize complete generated, documented, and historical setup forms
instead. Current installer lines come directly from the generator;
install, diagnostics, and uninstall share the matcher, which also
supplies the shell identity. Preserve custom command names, `.exe`
names, Git dispatch, and older installer forms without adding a parser
dependency. Remove the syntax-variation heuristics and their tests.
Customized shell expressions remain user-managed: uninstall leaves them
alone, diagnostics explain that boundary, and installing over such a
setup may append the standard initialization line. Regression coverage
checks install idempotency and preservation of quoted aliases and
compound statements.
Validation: shell unit and install/uninstall integration tests,
independent CLI lifecycle probes, help snapshots, documentation
sync/build, doctests, and all pre-commit checks pass. The full local
gate ran 5,430 tests with 5,422 passing. Its documentation-sync failure
was resolved by regeneration and a passing repeat; remaining failures
were an unchanged startup test, two process-discovery preconditions, and
four PowerShell-related failures. The installed `pwsh` also
stack-overflows on standalone `1 + 1`, independently of Worktrunk. CI
must pass before merge.
Closes#4106.
> _This was written by Codex on behalf of max-sixty_
This PR fixes comments, user docs, and maintainer skills that no longer
match the code. There are no behavior changes. #4516 replaced the trash
sweep, and several references still describe the old one. A few other
docs were wrong before that.
- **Troubleshooting, `wt list` timeout example**: the warning prints
`TaskKind::display_name()` labels (`working-tree diff, working-tree
conflict check`), not the kebab-case names the example showed. The
snapshot in `format_drain_timeout_diag`'s tests uses the same labels.
- **Troubleshooting, config checklist**: dropped "path must be relative,
not absolute". No such validation exists, and `worktree-path` accepts
absolute paths.
- **`drain_trash` doc** (`src/git/remove.rs`): dropped "Every staged
removal starts a drain". That describes the behavior #4516 replaced.
Removals now skip spawning when a drain is already running.
- **State module doc**: the default-branch override key is
`worktrunk.default-branch`, not `worktrunk.default_branch.*`.
- **Summary tab number**: `PreviewMode::Summary = 6`, so the `[list]
summary` doc comment and a test comment now say tab 6 instead of 5.
- **`release` skill**: the safety-scan note named "the trash sweep in
`src/commands/process.rs`" as the densest destructive code outside
`src/git/`. That sweep now only spawns a drain; the deletion walk is in
`src/remove_dir.rs`, so the note points there. `unlinkat`, the walk's
primitive, is added to the keyword regex, which would otherwise miss
changes to it.
- **`writing-user-outputs` skill**: `sweep_stale_trash` is now
`run_internal_sweep`.
The plugin skills mirror was regenerated, and `test_docs_are_in_sync`
and the `switch_picker_dry_run` tests pass. No regression test is needed
because no behavior changed.
Co-authored-by: worktrunk-bot <254187624+worktrunk-bot@users.noreply.github.com>
Preserve confirmed work in JSON output when a later command step fails.
For example, a switch that creates a worktree before `--execute` fails
still reports the created path; push and merge retain a completed target
update if final verification fails. Command payloads stay on stdout,
readable diagnostics stay on stderr, and the exit status signals
failure.
Carry typed partial facts across mutation boundaries and serialize them
in the command handlers. This covers switch, commit/squash, merge/push,
remove/prune, relocation, and copy-ignored without adding a public
result/error envelope. Switch failures before any result exists now
leave stdout empty instead of returning an error-only JSON object. Help
and regression tests document the contract.
Validation: 309 focused tests and nine additional boundary cases passed,
including late commit/squash, prune, relocation, and detached-removal
failures and skipped-copy accounting. Clippy, pre-commit, documentation
checks, and doctests passed. The full local gate had 12 failures: nine
passed sequentially, while three PowerShell tests reproduced `Stack
overflow.`. After integrating current main, all-target/all-feature
compilation and a review of the overlapping changes passed. CI remains
the merge gate.
> _This was written by Codex on behalf of max-sixty_
Abruptly terminated commands can leave full temporary Git index copies
behind. The contributor reported 52,786 files totaling 127 GB after
three days of frequent statusline cancellations.
Reclaim index copies and their Git lock siblings older than one hour
when a command next creates a temporary index. Keep the existing
filename prefix so cleanup also handles files left by older versions.
Sweep the system temp directory once per process, without making other
probe threads wait, and retain best-effort cleanup in the Git-directory
fallback. Normal exits still remove their own temporary indexes.
This uses age alone: no PID-tagged filenames, process checks, or
platform-specific liveness behavior. Move commit-preview approval before
temporary-index creation so an unattended approval prompt cannot age out
an index needed afterward. The one-hour limit is a retention policy; a
suspended operation or unusually slow Git filter can still exceed it.
Statusline computations are unchanged.
Validation: regression tests cover stale indexes and locks,
recent/future/unrelated files, both storage locations, cleanup failures,
real-index preservation, and the actual approval wait. The approval test
fails with the old ordering and passes with the fix. Independent review,
lint, docs sync, and docs build passed. The local full gate passed 5,412
tests; three PowerShell tests failed because the installed pwsh also
crashes with Stack overflow on a standalone arithmetic command outside
the repository.
> _This was written by Codex on behalf of max-sixty_
---------
Co-authored-by: Jonah Eaton <49370794+jonaheaton@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Maximilian Roos <m@maxroos.com>
Trim repeated explanations in the verbosity FAQ, agent activity
tracking, statusline setup, custom columns, and hook ordering. Keep
setup commands, template namespaces, and hook failure and ordering
rules; update generated references and help snapshots.
Validated with the documentation sync test, all 56 help tests, the site
build, and an independent review of the served passages.
> _This was written by Codex on behalf of max-sixty_
Remove repeated explanations and implementation detail from the merge,
shell integration, extending, LLM commits, approvals, and tether guides.
Keep the usage examples and behavioral distinctions, and update
generated references and help snapshots.
Validated with the documentation sync test, all 56 help tests, and the
documentation site build. Reviewed the served passages in context.
> _This was written by Codex on behalf of max-sixty_
Cut the code signing policy from 636 to 260 words, keeping the required
attribution, roles, privacy statement, and existing section anchors.
Remove unsupported claims about Defender and reproducible builds, and
describe the workflow's current test certificate and unsigned-release
fallback.
Validated with the docs sync test, site build, and independent review of
the served copy.
> _This was written by Codex on behalf of max-sixty_
Hook name filters previously ran after template validation and argument
routing, so an excluded command could reject the invocation or consume
its arguments. Filtered background hooks also combined user and project
sources, and runtime template failures bypassed foreground Warn
handling.
Select raw commands before parsing or binding arguments. Live execution
and frozen approval plans share preparation; the announcer owns one
background pipeline per source. Runtime expansion follows the existing
Warn/FailFast policy, while errors retain hook identity and alias
diagnostics. Selected templates still receive syntax validation before
execution. No flags or configuration keys change.
The production change removes 24 lines overall (+183/−207 across 11
files). The full diff is +911/−267 across 34 files, mostly regression
tests and snapshots. It includes current main’s JSON output, stdin
ownership and Ctrl-C behavior.
Validation: the required project gate passed 5,411 tests with one
skipped, plus lint, lockfile, doctests and rustdoc. Independent
integration and simplification review found no unresolved defects.
Regression coverage includes excluded malformed templates, argument
binding, independent background sources, foreground serial/concurrent
failure policy, picker diagnostics and alias errors.
> _This was written by Codex on behalf of max-sixty_
Routes all eight Claude Code hook events through the existing Rust
dispatcher added in #4304. Hook commands become literal invocations that
pass the plugin directory validator, and the plugin no longer requires
`jq`. The README requires `wt` v0.81.0 or later.
On `wt` v0.80.0 or earlier, worktree creation and removal fail, and
activity markers and EnterWorktree auto-approval stop working. The
latter hooks retain `|| true`, so the failures stay nonblocking and
EnterWorktree falls back to a permission prompt. The dispatcher
preserves existing-branch reopening and safe removal of unmerged work.
Updates the hook layout assertions and the skill's create-or-reopen
guidance, and removes the obsolete shell pipeline explanation.
Local validation: the project gate passed for the corrected skills at
`1a9ebd12c` in an isolated target directory (5,392 tests passed, one
skipped, plus Clippy, formatting, docs, and snapshots). Docs mirror sync
and all five dispatcher integration tests pass. The later
documentation-only follow-ups clarify the README's attribution of
payload parsing and the measured cleanup behavior. `claude plugin
validate plugins/worktrunk` passed its directory checks with the
existing missing-version warning; it excludes the catalog's safety scan
and policy review.
Independent Opus 5.5 review found no code defects and verified the
older-version failure. Further passes reviewed the corrected skills,
mirrors and live cleanup evidence with no remaining findings.
Cleanup was verified live on Claude Code 2.1.308 in an isolated
repository: reopening an existing worktree through both `claude
--worktree` and `EnterWorktree({name})`, then `/exit`, shows Keep /
Remove with Keep selected. Keep leaves its branch and checkout intact
and emits no `WorktreeRemove`. A fresh CLI-created worktree shows the
same prompt; choosing Remove emits `WorktreeRemove` and removes the
synthetic checkout and merged branch. The rationale now reflects that
confirmation instead of claiming automatic cleanup.
Reopening is already present in the [base create
hook](https://github.com/max-sixty/worktrunk/blob/d965d819f226ad7ac853efed8b2a996bb0c880a6/plugins/worktrunk/hooks/hooks.json#L72):
it clears `--create` for an existing local branch. Both the [base remove
hook](https://github.com/max-sixty/worktrunk/blob/d965d819f226ad7ac853efed8b2a996bb0c880a6/plugins/worktrunk/hooks/hooks.json#L82)
and the dispatcher check for `.git` and invoke `wt -C <path> remove
--foreground <path>`, with no force flags. This cutover preserves that
deletion scope and its safeguards.
> _This was written by Codex on behalf of max-sixty_
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
JSON switches now emit one result after synchronous work, including any
--execute command, finishes. Accepted invocations return the existing
success fields, or an object with an `error` string when target
discovery, configuration, directory directives, or execution fails.
Execute output goes to stderr, and child errors retain exit and signal
metadata. Typed Git diagnostics retain captured Git details and recovery
hints, including commands for a branch left behind after failed worktree
creation. Argument errors and picker cancellation produce no JSON;
background hooks remain independent.
Validation: the full project gate passed (5,028 tests, one skipped),
plus focused checks covering early and late failures, child output and
signals, picker behavior, and plain output. Generated help,
documentation synchronization and build, and independent review passed.
The change also removes a synthetic stdin write from an existing
noninteractive alias-refusal test that raced with process exit.
> _This was written by Codex on behalf of max-sixty_
---------
Co-authored-by: worktrunk-bot <254187624+worktrunk-bot@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Applies the documentation review of the 0.81.0 candidate
(v0.80.0..15b1ed10c: CLI help, generated and authored site pages, skill
and plugin copies). Each claim was checked against the code, and the
behavioral ones against a build of this branch on scratch repos.
Generated pages, skill mirrors, `list-v2.json` and help snapshots are
regenerated from their sources.
- `wt hook` "Interactive hooks": says which hooks inherit stdin (a
command running alone in the foreground) and which get empty stdin
(concurrent commands, background `post-*` hooks, prune's fanned-out
hooks). The pass-values-as-arguments example moves to the end of
"Template variables".
- Extending: the hooks/aliases stdin row states the rule in the same
words for both.
- Shell integration: "Why shell integration exists" and "Checking
status" state their content instead of only linking away. "Files
created" again distinguishes appended lines (bash, zsh, PowerShell) from
whole files (fish, Nushell), and notes that the PowerShell profiles are
created if missing.
- `wt step prune` min-age guard: says what the guard prevents, where a
branch-only candidate's age comes from, and when a branch with no reflog
looks new again.
- `wt step squash` backup: covers everything staged (by hand or by
`--stage`), not only changes staged beforehand.
- `wt merge`: the long help defines the source before using it;
`--branch` help says "defaults to the current branch".
- `wt remove` JSON: `detached_worktree` is the detached worktree at the
branch's expected location, which the removal leaves in place.
- `wt switch`: shorter "Custom path" sentence; "Starting list-only"
becomes "Hiding the preview".
- `list-v2.json`: "probe" becomes "check", as in the list help.
- Agent integration page: drops the incomplete Codex hooks sentence;
OpenCode's `worktree.directory` "is ignored", and new branches start
from the default branch.
- Claude Code `WorktreeCreate` (site page and plugin README): the hook
runs plain `wt switch` when the branch already exists, which returns its
worktree.
- Plugin README: the activity-tracking example no longer repeats the
hook list above it.
No finding was skipped. Three were adapted: the squash text names
hand-staged changes as well as `--stage`; the `wt merge` text keeps the
word "source", which later paragraphs use; the plugin README keeps the
example's `wt list` sentence and drops only the repeated mechanism.
> _This was written by Claude Code on behalf of max-sixty_
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Since the minijinja 3 upgrade in #4442, `{{ vars.cfg }}` renders a JSON
object or array var in Python style (`{'port': 3000}`) where v0.80.0
rendered JSON, and `{{ vars.cfg | tojson }}` fails with "unknown filter"
because minijinja's `json` feature was off. Since #3129 removed JSON on
hook stdin, templates are how hooks get structured values, so they had
no way to pass one to `jq` or `curl -d`.
This enables the `json` feature and documents `tojson` beside the vars
dot-access example in `wt hook --help`. `tojson` writes `'`, `<`, `>`
and `&` inside strings as `\u` escapes, which JSON parsers decode; the
shell formatter still single-quotes the result, so `-d {{ vars.config |
tojson }}` passes one argument.
Two adjustments come with the feature. It makes minijinja choose JSON
autoescaping from a template name ending in `.json`, `.js`, `.yaml` or
`.yml`, as it already did HTML escaping for `.html`. Worktrunk's
template names are config keys, so a custom column named `json` would
have rendered JSON-quoted cells, and one named `html` already rendered
HTML-escaped cells; the shared template environment now turns name-based
autoescaping off. minijinja's `tojson` also writes an undefined value as
`null`, so a wrapper rejects it the way printing does, and a mistyped
`vars` key errors instead of sending `null`.
Verified by rerunning the release-review repro against the branch
binary: `{{ vars.cfg | tojson }}` now renders `{"list": [1, 2], "port":
3000}`, and a custom column named `json` or `html` renders the raw
value. New coverage: a doc-template test for the documented `curl`
example in POSIX mode, a missing-key `tojson` error case, and the
custom-column test now uses a header named `json`. Each of the three
fails with its part of the change reverted.
Bare `{{ vars.cfg }}` still renders Python-style; `tojson` is the
supported way to get JSON.
> _This was written by Claude Code on behalf of max-sixty_
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Since v0.80.0, pre-commit hooks during `wt merge` and `wt step squash`
no longer see the uncommitted changes in the index. #4321 moved the
squash path to run hooks before staging so a formatter hook's edits
would land in the squash commit. A hook that reads the index
(`pre-commit run`, lint-staged, `git diff --cached`) then saw nothing
staged and passed, so a merge that v0.80.0 blocked committed the
offending changes.
All commit paths now stage, run the pre-commit hooks, and stage again
with the same `--stage` mode. Hooks see the changes, formatter edits
still land in the commit, and the generated commit message reads the
post-hook index. The second staging warns only about untracked paths the
hooks created. This also applies to `wt step commit` and `wt merge
--no-squash`, which ran hooks before staging even in v0.80.0, so an
index-reading hook now blocks those commits too, and a failed hook
leaves the changes staged there as it already did for squash.
Verified with the release-review repros: a `git diff --cached` gate and
a pre-commit-framework `pre-commit run` gate both block `wt merge` and
`wt step squash` again, as on v0.80.0, where main committed the changes.
A `sed` formatter hook's edit is in the commit and in the prompt the
commit-message command receives, with a clean tree afterwards. The new
`test_pre_commit_hook_sees_staged_changes` covers `wt merge` and `wt
step commit` and fails without the fix.
`test_step_commit_refuses_hook_created_conflict` now unstages in its
hook, because `git merge` refuses to start once the index is staged. The
other snapshot changes move the auto-staging warning ahead of the hook
output.
> _This was written by Claude Code on behalf of max-sixty_
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A prune of many worktrees started one `rm -rf` per staged worktree. On a
193-worktree prune those processes competed for the disk: together they
deleted about 1,500 files/s on 3 cores, while a single `rm` alone
managed 3,000–5,400 files/s on under one core. Read-only directories
(`dr-xr-xr-x`, as installers leave them) also made `rm -rf` fail, so
those entries stayed in `.git/wt/trash/` and every later sweep retried
them.
Removal now starts a hidden `wt _drain-trash`, which holds
`.git/wt/trash.lock` and deletes every staged entry, including entries
staged while it runs. A removal or sweep that finds the lock held starts
nothing, so a prune runs about one deleter. The sweep after `wt remove`
drains leftovers immediately rather than waiting 24 hours. Priority is
unchanged (`taskpolicy -b` on macOS).
The drain uses wt's own walker (`src/remove_dir.rs`), which `wt remove
--foreground` and `wt config state clear` also use:
- On Unix it opens each directory relative to its parent's descriptor
with `O_NOFOLLOW` and unlinks relative to the holding directory. The old
path-based walker could follow a directory swapped for a symlink
mid-walk and delete outside the tree; a swap-race script reproduced
that, and the new walker lost nothing in 20 runs.
- It grants the owner `rwx` on each directory it enters, so read-only
and unreadable trees are deleted, never changing a symlink's target.
Linux's `fchmodat` has no `AT_SYMLINK_NOFOLLOW`, so there it opens the
directory with `O_PATH | O_NOFOLLOW` and changes the mode through
`/proc/self/fd`.
- Subdirectories are removed sequentially, so open descriptors stay
bounded by depth. On a 199k-entry pnpm `node_modules` it deleted about
twice as fast as `rm -rf`.
- On Windows it uses `std::fs::remove_dir_all`, which removes junctions
without following them.
> _This was written by Claude Code on behalf of max-sixty_
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Under OpenCode 2, the plugin that `wt config plugins opencode install`
writes now registers a `worktrunk` worktree strategy. Worktrees that
OpenCode creates and removes then go through `wt switch --create` and
`wt remove`, the same way the Claude Code plugin's
`WorktreeCreate`/`WorktreeRemove` hooks already route them. This was
requested in #4488. I ran the strategy locally against a scratch repo
with this branch's `wt` and a fake OpenCode context. I haven't run it
inside a real OpenCode 2 session, which CI can't drive.
How each callback maps
([`dev/opencode-plugin.ts`](https://github.com/max-sixty/worktrunk/blob/1c906f5599d7a16df832c56c51aa82d13c82bbd3/dev/opencode-plugin.ts)):
- **create**: runs `wt switch [--create] <name> [--base <ref>] --no-cd
--format=json` in the source checkout and returns `.path`. OpenCode's
`branch` input is a [starting ref, not a branch
name](https://github.com/anomalyco/opencode/blob/dev/packages/plugin/src/worktree.ts),
so `<name>` is the basename of the directory OpenCode suggests (the name
the user typed, or a generated slug). The path comes from
`worktree-path`, since OpenCode accepts a different directory than the
one it suggested. An existing branch is reopened, as in #4487. Passing a
starting ref for an existing branch is refused rather than ignored.
- **remove**: runs `wt remove --foreground [--force] <dir>`. It does
nothing if the checkout is already gone.
- **list**: reads `git worktree list --porcelain -z` and reports the
first record as `root`. Bare and prunable entries are skipped.
Things a maintainer may want to weigh:
- **On by default.** OpenCode selects a strategy as soon as a plugin
adds one. Every OpenCode 2 user with the plugin installed switches to
worktrunk-managed worktrees, and OpenCode's `worktree.directory` setting
stops applying. This matches the Claude Code plugin. The docs page says
so.
- **No force prompt on a dirty worktree.** OpenCode only offers to force
when the error is an instance of its own `Worktree.OperationError`
([`operationError`](https://github.com/anomalyco/opencode/blob/dev/packages/core/src/worktree.ts)
uses `instanceof`). A standalone plugin file can't import that class:
the CLI's runtime shim for `@opencode/plugin` doesn't export `Worktree`.
A dirty removal fails with worktrunk's own message instead (`Cannot
remove worktree: … has uncommitted changes`), and nothing is deleted.
- **Default base.** With no starting ref, the new branch starts from
worktrunk's default (the default branch). OpenCode's `git` strategy uses
the source checkout's HEAD instead.
<details><summary>Local check</summary>
A Node harness imported the plugin, called `setup` with a stub
`ctx.worktree.transform`, and ran each callback against a fresh repo
with `target/debug/wt` on PATH:
- create → `ocrepo.brave-tiger` (the `worktree-path` default), and
`list` returned root + that worktree
- create with `branch: "brave-tiger"` → a second worktree based on it
- create for an existing branch with a starting ref → refused. Without a
ref → reopened the existing worktree
- remove of a dirty worktree → wt's error. With `force` → removed. A
repeat remove → no-op
- final `list` → root only
`test_docs_are_in_sync` and the 14 `opencode` integration tests pass.
</details>
Closes#4488
Co-authored-by: worktrunk-bot <254187624+worktrunk-bot@users.noreply.github.com>
The help text for three features named only the original subset of what
the code supports. This updates the `after_long_help` sources and
regenerates the doc pages, skill mirrors, and help snapshots from them.
- **`wt config show --full`** said it checks whether `gh` or `glab` is
installed and authenticated. `render_diagnostics` in
`src/commands/config/show.rs` checks the CLI for the repository's forge,
which can also be `tea` (Gitea) or `az` (Azure DevOps). The text now
names all four.
- **First-run LLM offer** listed `claude` and `codex` as detected tools.
`detect_llm_tool_with` in `src/output/commit_generation.rs` also detects
`opencode`.
- **CI status** was described as "GitHub/GitLab" in the `wt config state
get` and `wt config state cache` help and in `wt list`'s Full mode
paragraph. CI status also covers Gitea and Azure DevOps
(`src/commands/list/ci_status/{gitea,azure}.rs`), so these now say
"forge CI".
No tests added: only help text changed. `test_docs_are_in_sync` and the
`help` snapshot tests pass locally.
---------
Co-authored-by: worktrunk-bot <254187624+worktrunk-bot@users.noreply.github.com>
Since #4436, any failed forge call shows ⚠. That includes a CLI that is
installed but not logged in, which then puts a permanent ⚠ in `wt list
--full`, the shell prompt, and the Claude Code statusline. This change
leaves the cell blank when the CLI holds no login for the forge's host,
and keeps ⚠ for a failure from a CLI that does (offline, rate limit,
expired token).
Each CLI answers from its own local state, so a lost connection never
reads as logged out:
- **GitHub**: `gh` exits with its documented code 4 when it has no login
for the host it resolved for the request. The backend reads that exit
code, so SSH host aliases resolve the way `gh` resolves them.
- **GitLab / Gitea / Azure DevOps**: after a failed call,
`remote_ref::is_authed_for(forge, host)` asks `glab config get token
--host`, `tea logins list --output json`, or `az account show`, for the
`forge.hostname` if configured, else the remote's host. The answer is
cached per forge and host for the process.
`wt config show --full` uses the same check for the repo's host and
names that host in its warning. It replaces `CiToolsStatus`, which
probed all four CLIs to report one, and asked `gh auth status` / `glab
auth status`, which contact the server and accept a login for any host.
`tea`'s host-agnostic `has_any_login` is gone with it.
Behavior changes:
- `wt list --full` / statusline: a CLI with no login for the host leaves
the CI cell blank instead of ⚠. The legend now lists that under blank,
and ⚠'s examples say "expired login".
- `wt config show --full`: a login for another host no longer counts,
and the warning says which host it checked (`gh installed but not
authenticated for github.com`).
Known limits: a GitLab or Gitea remote through an SSH host alias is
checked under the alias, so a failure there shows blank unless
`forge.hostname` names the real host; Azure DevOps counts only an `az
login`, not a PAT from `az devops login`.
Tests: the failed-list test now covers logged-in and logged-out cases
for `gh` (exit 1 vs 4) and `glab` (token vs none); the `tea` CI mocks
hold a login for the test host; the `tea` login-discovery test adds a
login for another host.
Follows #4436.
> _This was written by Claude Code on behalf of max-sixty_
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Applies `AGENTS.md`'s **Other Tools Own Their Conventions** (#4435) to
what #4106 left: where worktrunk refined how it handles a case outside
standard use, stop handling the case.
**CI status: a failed forge call shows the error indicator.** The
classifier that searched `gh`/`glab`/`az`/`tea` output for English
phrases ("rate limit", "403", "connection", …) to choose between ⚠ and a
blank "no CI" cell is deleted. Any failed call now shows ⚠. Gitea reads
only whether the HTTP status is an error, not which one. The two lookups
by commit SHA (GitHub check runs, Gitea combined status) now run only
when some remote-tracking ref contains the head, since the forge answers
a commit it doesn't have with an error and ordinary unpushed work would
otherwise show ⚠. GitLab and Azure look pipelines up by branch and are
unchanged.
**PowerShell on Unix.** When `pwsh` can't be queried there is no
PowerShell profile, rather than a guessed `~/.config/powershell` one
(left by #4422).
**Nushell.** When `nu` can't be queried there are no autoload
candidates, rather than a reconstruction of Nushell's data-dir rule.
Install can't write into a legacy directory, since the candidate list is
empty.
Behavior changes:
- `gh`/`glab`/`az` installed but not logged in now shows ⚠ under `wt
list --full` instead of a blank cell. Detection checks that the tool is
installed, and `wt config show` reports that it isn't logged in. The ⚠
legend now names "not logged in".
- A Gitea 404 shows ⚠.
- `wt config shell install powershell` (or `nu`) without the tool fails
with "No shell config files found", and uninstall no longer finds a
wrapper left behind after `nu` was removed.
**Fish's completion path.** `Shell::completion_path` answered for every
shell, but only fish installs a completion file; its other arms,
including the Nushell one this change touched, were dead.
`shell::fish_completion_path` replaces it.
Tests: the retriable-classifier unit tests are gone, and the Gitea test
that only distinguished a blanked 500 body. Mocks now answer for
branches other than the one under test, since those would otherwise show
⚠. New tests: a failed `gh pr list` / `glab mr list` shows ⚠; an
unpushed head skips the GitHub and Gitea lookups by SHA, each with a
pushed control. Shell unit tests and the PowerShell integration tests no
longer depend on a real `nu` or `pwsh`; they pass with only
`/usr/bin:/bin` on `PATH`. Full integration and unit suites pass
locally.
Ref #4106.
> _This was written by Claude Code on behalf of max-sixty_
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
`GitRemoteUrl::parse` split SSH authorities at the first `:`, so
`ssh://git@[2001:db8::1]/owner/repo.git` and
`ssh://git@[2001:db8::2]/owner/repo.git` both became `[2001/owner/repo`.
Because that identifier selects both saved approvals and `[projects]`
settings, the two servers shared them. The parser also dropped explicit
SSH ports, merging servers on different ports. The parser now delegates
transport syntax to `gix-url` 0.40, and the identity keeps the full IPv6
host and any non-default SSH port.
What changes:
- **Syntax from `gix-url`.** It handles scheme, SCP form, userinfo
(split at the final `@` of the authority, which is the host git connects
to), IPv6 literals and ports. Worktrunk still owns the namespace/repo
split and the forge policy. HTTP(S), git and SSH remotes are accepted,
plus SCP when it has a non-empty user (the existing rule). Remote
helpers, `file://`, local paths, option-like hosts and out-of-range
ports are rejected.
- **Escaped paths.** The path comes from `original_path()`, not the
decoded `path`, so `evil%2Frepo` stays a single segment in SSH, SCP and
git forms, as it already did for HTTPS.
- **IPv6 hosts** are always bracketed (`[2001:db8::1]`), since `gix-url`
strips the brackets for SSH but keeps them for HTTP(S).
- **SSH ports.** A new `ssh_port` field goes into `project_identifier()`
(`host:2222/owner/repo`) but not into `host()`, which feeds web and API
URLs; an SSH port is not the web port. An explicit `:22` is treated as
no port. HTTP(S) and git keep their explicit port in `host()`, as
before.
- **No new identity API.** `project_identifier()` is still the only
identity; there is no separate one.
Approvals and settings: the ordinary forms of one project still share an
identifier (`git@host:o/r`, `ssh://git@host/o/r`,
`ssh://git@host:22/o/r`, `https://host/o/r`). Corrected identities get
fresh keys, so old IPv6-truncated or port-merged approvals don't carry
over. The same applies to `[projects]` settings: a user on
`ssh://…:2222` with a `[projects."host/o/r"]` entry needs to re-key it
to `host:2222/o/r`. Nothing warns about this. The config docs now say
that a non-default port stays with the host.
Smaller identifier changes from delegating normalization:
- DNS-style hostnames are lowercased (`GitHub.com` → `github.com`).
- `git+ssh://` and `ssh+git://` now parse; before, they fell back to the
raw-URL identifier.
- Some inputs `gix-url` rejects now fall back to the raw-URL identifier
in `Repository::project_identifier`: URLs containing whitespace, and SCP
`user@[ipv6]:path`. Each still gets a distinct identifier.
Tests:
- New unit tests cover the IPv6 collision, port isolation (including a
port inside hostile userinfo), escaped paths across transports, and
rejected forms.
- `tests/integration_tests/repository.rs` checks that
`Repository::project_identifier` keeps the two IPv6 remotes apart. It
also checks that `Approvals::is_command_approved` and
`UserConfig::worktree_path_for_project` pick the right entry for port
2222 versus the shared SSH/HTTPS identifier.
- The full lib and integration suites pass locally, except for tests
that bind Unix sockets or sign commits. Those fail the same way on
`main` in this sandbox.
- Binary size was not measured; the issue's ~84 KiB figure is a
standalone probe.
Closes#4418 — automated triage
---------
Co-authored-by: worktrunk-bot <254187624+worktrunk-bot@users.noreply.github.com>
Windows Codex hooks failed before updating activity markers because
their cmd-specific command strings did not parse in PowerShell. The
Windows commands now invoke the quoted wrapper through `cmd /d /c call`;
the wrapper keeps marker failures best-effort by returning zero while
preserving stderr diagnostics.
The invocation rationale lives in `hooks/wt.cmd`. Regression coverage
runs the shipped commands through cmd, Windows PowerShell, and
PowerShell 7 from a plugin path containing spaces, checking marker
updates, Unicode arguments, and failures. This installed-shell coverage
uses the existing `shell-integration-tests` feature, enabled in CI; the
manifest guard runs on every platform. Shell discovery uses the existing
`which` dependency.
The invocation retains a documented tradeoff: in a cmd session, the bare
`cmd` name can resolve from the project directory. `/d` disables AutoRun
only for the cmd hop this command creates.
The tests reproduce Codex's process invocation; an installed Windows
Codex session has not been exercised.
Closes#4239. Thanks to [wstczyw](https://github.com/wstczyw) for the
report and reproduction.
> _This was written by Codex on behalf of max-sixty_
---------
Co-authored-by: worktrunk-bot <worktrunk-bot@users.noreply.github.com>
Co-authored-by: worktrunk-bot <254187624+worktrunk-bot@users.noreply.github.com>
Co-authored-by: Maximilian Roos <m@maxroos.com>
`wt config shell --help` provides setup, activation and current-shell
diagnostics. The generated config reference now includes the existing
init/install/uninstall help; the specialist shell-integration guide
links to those recipes while retaining installed-file locations,
warnings, wrapper internals and public anchors.
This consolidates the authored recipes and expands the reference. Of
+754/−183 lines across 11 files, +624 come from three generated
config-reference copies. Authored Rust help changes are +40/−12.
Latest main `913ff0547` is integrated, preserving Nushell’s newer 0.113+
requirement. Fresh documentation sync, Astro build and all 16 built-site
checks pass. The current candidate passed the full project gate: 5,196
tests passed and one skipped, with Clippy, formatting, lockfile and
doctest checks passing. The built binary’s help was reviewed at 80
columns.
> _This was written by Codex on behalf of max-sixty_
When `wt-switch-create` moves a Claude Code session into another repo's
worktree, the session keeps the launch repo's root `AGENTS.md` (and its
auto-memory) in context and never loads the new repo's root file; only
the new repo's nested instruction files load, lazily, as files under
them are read. So the agent ends up following the wrong project's
top-level rules mixed with the right project's nested ones.
With a repo argument, the skill now has the agent read whichever of the
new worktree's root `CLAUDE.md` and `AGENTS.md` exist once it is working
there, and treat them as superseding the launch repo's. `rationale.md`
records the verification against Claude Code 2.1.296: headless sessions
through `EnterWorktree({path})` and `EnterWorktree({name})` both kept
the launch repo's root file, a session started in the worktree loaded
the new one, and the `name` route can't cross repos anyway because the
`WorktreeCreate` hook creates in `$CLAUDE_PROJECT_DIR`.
> _This was written by Claude Code on behalf of max-sixty_
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
System config is now read from one fixed path per platform, and
`XDG_CONFIG_DIRS` is no longer consulted. The location is
`WORKTRUNK_SYSTEM_CONFIG_PATH` when set, otherwise:
- macOS: `/Library/Application Support/worktrunk/config.toml`
- Windows: `%PROGRAMDATA%\worktrunk\config.toml`
- other Unix: `/etc/xdg/worktrunk/config.toml`
This PR started as a filter for relative `XDG_CONFIG_DIRS` entries
(#4106, item 4). Removing the search path removes that case without a
filter, and git's `--system` file is a fixed path for the same reason.
`system_config_path()` now returns the location whether or not the file
exists, so `default_system_config_path()`, which repeated the lookup
order for the `wt config show` hint, is deleted, along with
`system_config_dirs()`, `platform_default_dirs()`, the three
`XDG_CONFIG_DIRS` tests and the env-var docs row.
Behavior changes: directories listed in `XDG_CONFIG_DIRS` are no longer
searched (common values such as NixOS's, Ubuntu's and Flatpak's already
include `/etc/xdg`), and macOS no longer falls back to `/etc/xdg` after
`/Library/Application Support`.
> _This was written by Claude Code on behalf of max-sixty_
---------
Co-authored-by: worktrunk-bot <254187624+worktrunk-bot@users.noreply.github.com>
Co-authored-by: worktrunk-bot <worktrunk-bot@users.noreply.github.com>
Co-authored-by: Maximilian Roos <m@maxroos.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>