Skip to content

refactor(config): store bare-repo prompt opt-out as a hint - #3001

Merged
max-sixty merged 2 commits into
mainfrom
bare-repo-prompt-hint
Jun 7, 2026
Merged

max-sixty merged 2 commits into
mainfrom
bare-repo-prompt-hint

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

worktrunk.skip-bare-repo-prompt was stored as a top-level git-config key, which made it the only piece of persistent worktrunk.* state escaping the state get↔state clear parity invariant (documented at src/commands/config/state.rs:6-31). The hints subcommand globs the worktrunk.hints. prefix and the aggregate get/clear walk the same namespace, so a top-level key fell through both nets.

It's semantically a hint — a per-repo sticky "don't ask me this again" flag — so this stores it under worktrunk.hints.skip-bare-repo-prompt and reads/writes it via has_shown_hint / mark_hint_shown. It now lists under wt config state hints and clears with wt config state clear, with no new state category or docstring entry. The boolean opt-out maps onto the count-based hint API cleanly: has_shown_hint is count >= 1, and a single mark_hint_shown on decline sets the count to 1.

Migration: clean cutover, no migration. Existing users who already opted out get re-prompted once on their next wt switch --create in a dotted-name bare repo, after which the opt-out is recorded as a hint. Their orphaned legacy key is left in git config, unread. This is internal git-config state (flexible per project conventions), and the prompt only fires for bare repos with dotted names, so a single re-prompt is low-stakes.

Testing: the PTY decline test now asserts the hint key is written (and the legacy key is not), then round-trips the opt-out through wt config state hints → wt config state clear. Existing accept/preview/non-interactive prompt tests cover the unchanged paths.

This was written by Claude Code on behalf of max

`worktrunk.skip-bare-repo-prompt` was a top-level git-config key, the only
piece of persistent `worktrunk.*` state escaping the `state get`↔`state clear`
parity invariant: the `hints` subcommand globs `worktrunk.hints.*` and the
aggregate get/clear walk the same namespace, so a top-level key slipped through
both. The flag is semantically a hint (a per-repo "don't ask again"), so store
it under `worktrunk.hints.skip-bare-repo-prompt` and read/write it through
`has_shown_hint` / `mark_hint_shown`. It now lists under `wt config state hints`
and clears with `wt config state clear`, no new state category needed.

The boolean opt-out maps onto the count-based hint API cleanly: `has_shown_hint`
is `count >= 1`, and a single `mark_hint_shown` on decline sets the count to 1.

Clean cutover, no migration. Existing users who already opted out get
re-prompted once (the prompt only fires for dotted-name bare repos), then the
opt-out is recorded as a hint. The orphaned legacy key is left in their git
config, unread.

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.

Clean refactor — folding the bespoke opt-out key into the hint mechanism so it's listable/clearable via wt config state is a nice consolidation, and the test now covers the full round-trip plus the legacy-key-not-written assertion.

One behavior change worth a beat before merge: the old top-level key worktrunk.skip-bare-repo-prompt has shipped since v0.31.0, so users who already declined have it set. Since has_shown_hint reads worktrunk.hints.skip-bare-repo-prompt and nothing migrates the old value, those users get re-prompted once (and the orphaned legacy key lingers in their config). The population is narrow — bare repo with a hidden dir name, previously declined, interactive — and it's a one-time re-prompt rather than data loss, so accepting it is defensible and consistent with how hint_count already shrugs off legacy "true" values. But if you'd rather not surprise existing opt-outs, a few lines in the gate to carry the old key over (if old key set → mark_hint_shown + unset once) would do it. Your call — flagging since it's a silent change for a real set of users.

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

codecov/patch is red on this PR (66.66%, 1 line). The miss is the log::warn! inside the if let Err(e) = repo.mark_hint_shown(...) arm in offer_bare_repo_worktree_path_fix — and it's a pre-existing uncovered line that this PR only reworded ("…to git config" → "…hint to git config"), so the diff didn't add new untested logic. Covering it would mean forcing a git-config write to fail, which isn't worth a test for a best-effort warn. Flagging only because this repo treats codecov/patch as merge-gating despite the "not required" label — your call on whether to override.

Match the sibling shell-integration hint writer (`print_shell_integration_hint`):
a failed persist just means the prompt may reappear on the next switch, so drop
the `log::warn!` error branch. This also removes the only uncovered line that
`codecov/patch` flagged.

Add a read-path test asserting an opted-out repo (hint set) doesn't re-show the
bare-repo prompt.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit c656d34 into main Jun 7, 2026
35 checks passed
@max-sixty
max-sixty deleted the bare-repo-prompt-hint branch June 7, 2026 03:13
@max-sixty max-sixty mentioned this pull request Jun 9, 2026
max-sixty added a commit that referenced this pull request Jun 9, 2026
v0.57.0.

`cargo semver-checks` reports breaking library API changes: the squash
refactor (#2983) renamed `Repository::commit_subjects` to
`commit_message_details`, and the new `GitError::UnbornDefaultBranch`
variant (#2990) shifts the discriminants of the exhaustive `GitError`
enum. Neither is intentional public API, but together they force a minor
bump pre-1.0.

## CHANGELOG

### Improved

- **`wt step diff --branch`**: `wt step diff` gained a `-b`/`--branch`
flag, mirroring `wt step commit`, so the diff can target another
worktree's branch without leaving the current one. The branch must have
a checked-out worktree.
([#2995](#2995))

- **Squash templates can use commit bodies**: The squash commit-message
template gains an experimental `{{ commit_details }}` variable — a list
of `{ subject, body }` objects for the commits being squashed —
alongside the existing `{{ commits }}` (now documented as the commit
subjects). Templates can incorporate full commit bodies, not just
subject lines.
([#2983](#2983), thanks
@florianilch)

- **Recommended Claude Code commit command drops the `CLAUDECODE=`
prefix**: Claude Code removed the nested-session check that rejected
`claude -p` launched from inside another session, so the workaround is
gone. The recommended `[commit.generation]` command shown by `wt config
create` no longer carries a leading `CLAUDECODE=`, and `wt` no longer
strips `CLAUDECODE` from the environment before running
commit-generation commands.
([#2979](#2979))

### Fixed

- **Nushell wrapper installs where Nushell actually autoloads it**: `wt
config shell install nu` wrote `wt.nu` to
`$nu.default-config-dir/vendor/autoload`, which Nushell never autoloads
— on Linux the wrapper was written but silently never loaded, so `wt`
was never wrapped (it happened to work on macOS/Windows by coincidence
of path layout). It now installs to `$nu.vendor-autoload-dirs | last`,
and install/uninstall clean up any worktrunk wrapper stranded at the old
location. ([#2992](#2992),
thanks @nnutter for reporting)

- **Claude Code hooks work for Fish shell users**: The plugin's hook
commands used `${CLAUDE_PLUGIN_ROOT}` brace syntax, which Fish doesn't
expand; they now use `$CLAUDE_PLUGIN_ROOT`, so the activity and
worktree-lifecycle hooks fire correctly under Fish.
([#2962](#2962), thanks @amw)

- **Pager no longer wedges the terminal on Ctrl-C (Windows)**:
Interrupting the `--help` pager (`less`) with Ctrl-C on Windows could
leave the terminal in a broken state; `less` now quits cleanly on
interrupt. ([#2969](#2969),
thanks @ofek for reporting)

- **Clearer error when the default branch has no commits**: In a freshly
initialized repo whose default branch is unborn,
`merge`/`rebase`/`squash`/`push` (and the diff report) failed with
`Default branch main does not exist locally` plus a misleading hint to
reset the cached value. They now report that the branch has no commits
yet, without the wrong cache-reset suggestion.
([#2990](#2990))

- **`diagnostic.md` uploads as a gist again**: The `-vv` diagnostic
report inlined raw NUL bytes from NUL-separated git output, so `gh gist
create` rejected it as a binary file. Control bytes in the subprocess
preview are now escaped.
([#2991](#2991))

- **`wt list` tolerates a missing index file**: A repo with no
`<gitdir>/index` (nothing ever staged) made the temp-index probe fail; a
missing index is now treated as an empty one, matching git's own
behavior. ([#2884](#2884))

- **Inline code renders in `--help` section headings**: Terminal
`--help` showed literal backticks in headings authored with inline code
(e.g. the `wt config state logs` heading `Command log
(`commands.jsonl`)`). Headings now reduce inline code to plain text
under the heading's uniform style. The `--stage`/`--dry-run` subsection
headings in `wt step commit`/`squash` were also renamed to sentence case
("Staging", "Dry run").
([#3003](#3003))

### Documentation

- **`wt switch` docs give forge PR/MR URLs equal billing with
`pr:`/`mr:`**: The switch docs now present the full forge-URL form
alongside the `pr:N` shortcut.
([#2970](#2970))

- **New FAQ entry on moving uncommitted changes to a new worktree**.
([#3002](#3002))

### Internal

- **Bare-repo prompt opt-out stored as a hint**:
`worktrunk.skip-bare-repo-prompt` moved under the `worktrunk.hints.`
namespace, so it now lists under `wt config state hints` and clears with
`wt config state clear` (previously a top-level key that escaped both).
Clean cutover: users who already opted out are re-prompted once on their
next `wt switch --create` in a dotted-name bare repo.
([#3001](#3001))

> _This was written by Claude Code on behalf of max_
social4hyq pushed a commit to social4hyq/homebrew-core that referenced this pull request Sep 20, 2026
worktrunk 0.57.0

Created-by: HarmonybrewBot
Commit-by: HarmonybrewBot
Merged-by: HarmonybrewBot
Description: Created by `brew bump`

---

Created with `brew bump-formula-pr`.<details>
  <summary>release notes</summary>
  <pre>## Release Notes

### Improved

- **`wt step diff --branch`**: `wt step diff` gained a `-b`/`--branch` flag, mirroring `wt step commit`, so the diff can target another worktree's branch without leaving the current one. The branch must have a checked-out worktree. ([#2995](max-sixty/worktrunk#2995))

- **Squash templates can use commit bodies**: The squash commit-message template gains an experimental `{{ commit_details }}` variable — a list of `{ subject, body }` objects for the commits being squashed — alongside the existing `{{ commits }}` (now documented as the commit subjects). Templates can incorporate full commit bodies, not just subject lines. ([#2983](max-sixty/worktrunk#2983), thanks @florianilch)

- **Recommended Claude Code commit command drops the `CLAUDECODE=` prefix**: Claude Code removed the nested-session check that rejected `claude -p` launched from inside another session, so the workaround is gone. The recommended `[commit.generation]` command shown by `wt config create` no longer carries a leading `CLAUDECODE=`, and `wt` no longer strips `CLAUDECODE` from the environment before running commit-generation commands. ([#2979](max-sixty/worktrunk#2979))

### Fixed

- **Nushell wrapper installs where Nushell actually autoloads it**: `wt config shell install nu` wrote `wt.nu` to `$nu.default-config-dir/vendor/autoload`, which Nushell never autoloads — on Linux the wrapper was written but silently never loaded, so `wt` was never wrapped (it happened to work on macOS/Windows by coincidence of path layout). It now installs to `$nu.vendor-autoload-dirs | last`, and install/uninstall clean up any worktrunk wrapper stranded at the old location. ([#2992](max-sixty/worktrunk#2992), thanks @nnutter for reporting)

- **Claude Code hooks work for Fish shell users**: The plugin's hook commands used `${CLAUDE_PLUGIN_ROOT}` brace syntax, which Fish doesn't expand; they now use `$CLAUDE_PLUGIN_ROOT`, so the activity and worktree-lifecycle hooks fire correctly under Fish. ([#2962](max-sixty/worktrunk#2962), thanks @amw)

- **Pager no longer wedges the terminal on Ctrl-C (Windows)**: Interrupting the `--help` pager (`less`) with Ctrl-C on Windows could leave the terminal in a broken state; `less` now quits cleanly on interrupt. ([#2969](max-sixty/worktrunk#2969), thanks @ofek for reporting)

- **Clearer error when the default branch has no commits**: In a freshly initialized repo whose default branch is unborn, `merge`/`rebase`/`squash`/`push` (and the diff report) failed with `Default branch main does not exist locally` plus a misleading hint to reset the cached value. They now report that the branch has no commits yet, without the wrong cache-reset suggestion. ([#2990](max-sixty/worktrunk#2990))

- **`diagnostic.md` uploads as a gist again**: The `-vv` diagnostic report inlined raw NUL bytes from NUL-separated git output, so `gh gist create` rejected it as a binary file. Control bytes in the subprocess preview are now escaped. ([#2991](max-sixty/worktrunk#2991))

- **`wt list` tolerates a missing index file**: A repo with no `<gitdir>/index` (nothing ever staged) made the temp-index probe fail; a missing index is now treated as an empty one, matching git's own behavior. ([#2884](max-sixty/worktrunk#2884))

- **Inline code renders in `--help` section headings**: Terminal `--help` showed literal backticks in headings authored with inline code (e.g. the `wt config state logs` heading `Command log (`commands.jsonl`)`). Headings now reduce inline code to plain text under the heading's uniform style. The `--stage`/`--dry-run` subsection headings in `wt step commit`/`squash` were also renamed to sentence case ("Staging", "Dry run"). ([#3003](max-sixty/worktrunk#3003))

### Documentation

- **`wt switch` docs give forge PR/MR URLs equal billing with `pr:`/`mr:`**: The switch docs now present the full forge-URL form alongside the `pr:N` shortcut. ([#2970](max-sixty/worktrunk#2970))

- **New FAQ entry on moving uncommitted changes to a new worktree**. ([#3002](max-sixty/worktrunk#3002))

### Internal

- **Bare-repo prompt opt-out stored as a hint**: `worktrunk.skip-bare-repo-prompt` moved under the `worktrunk.hints.` namespace, so it now lists under `wt config state hints` and clears with `wt config state clear` (previously a top-level key that escaped both). Clean cutover: users who already opted out are re-prompted once on their next `wt switch --create` in a dotted-name bare repo. ([#3001](max-sixty/worktrunk#3001))

## Install worktrunk 0.57.0

### Install prebuilt binaries via shell script

```sh
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/max-sixty/worktrunk/releases/download/v0.57.0/worktrunk-installer.sh | sh && wt config shell install
```

### Install prebuilt binaries via powershell script

```sh
powershell -ExecutionPolicy Bypass -c "irm https://github.com/max-sixty/worktrunk/releases/download/v0.57.0/worktrunk-installer.ps1 | iex"; git-wt config shell install
```

### Install prebuilt binaries via Homebrew

```sh
brew install worktrunk && wt config shell install
```

## Download worktrunk 0.57.0

|  File  | Platform | Checksum |
|--------|----------|----------|
| [worktrunk-aarch64-apple-darwin.tar.xz](https://github.com/max-sixty/worktrunk/releases/download/v0.57.0/worktrunk-aarch64-apple-darwin.tar.xz) | Apple Silicon macOS | [checksum](https://github.com/max-sixty/worktrunk/releases/download/v0.57.0/worktrunk-aarch64-apple-darwin.tar.xz.sha256) |
| [worktrunk-x86_64-apple-darwin.tar.xz](https://github.com/max-sixty/worktrunk/releases/download/v0.57.0/worktrunk-x86_64-apple-darwin.tar.xz) | Intel macOS | [checksum](https://github.com/max-sixty/worktrunk/releases/download/v0.57.0/worktrunk-x86_64-apple-darwin.tar.xz.sha256) |
| [worktrunk-x86_64-pc-windows-msvc.zip](https://github.com/max-sixty/worktrunk/releases/download/v0.57.0/worktrunk-x86_64-pc-windows-msvc.zip) | x64 Windows | [checksum](https://github.com/max-sixty/worktrunk/releases/download/v0.57.0/worktrunk-x86_64-pc-windows-msvc.zip.sha256) |
| [worktrunk-aarch64-unknown-linux-musl.tar.xz](https://github.com/max-sixty/worktrunk/releases/download/v0.57.0/worktrunk-aarch64-unknown-linux-musl.tar.xz) | ARM64 MUSL Linux | [checksum](https://github.com/max-sixty/worktrunk/releases/download/v0.57.0/worktrunk-aarch64-unknown-linux-musl.tar.xz.sha256) |
| [worktrunk-x86_64-unknown-linux-musl.tar.xz](https://github.com/max-sixty/worktrunk/releases/download/v0.57.0/worktrunk-x86_64-unknown-linux-musl.tar.xz) | x64 MUSL Linux | [checksum](https://github.com/max-sixty/worktrunk/releases/download/v0.57.0/worktrunk-x86_64-unknown-linux-musl.tar.xz.sha256) |



### Install via Cargo

```sh
cargo install worktrunk && wt config shell install
```

### Install via Winget (Windows)

```sh
winget install max-sixty.worktrunk && git-wt config shell install
```

### Install via AUR (Arch Linux)

```sh
paru worktrunk-bin && wt config shell install
```
</pre>
  <p>View the full release notes at <a href="https://github.com/max-sixty/worktrunk/releases/tag/v0.57.0">https://github.com/max-sixty/worktrunk/releases/tag/v0.57.0</a>.</p>
</details>
<hr>

See merge request: Harmonybrew/homebrew-core!11171
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