Add git worktree name autocomplete suggestions - #302
Merged
Conversation
Add a `worktrees` generator sourced from `git worktree list --porcelain` that surfaces the repo's known working trees, inserting each worktree's path (git identifies a working tree by its path) with the checked-out branch or bare/detached state as the description. Wire it into the `worktree` args of `git worktree lock/move/remove/unlock` and into `cd` so worktree dirs surface alongside folder completion. Closes GH-11542. Co-Authored-By: Warp <agent@warp.dev>
|
@warp-agent-staging[bot] I'm starting a first review of this pull request. You can view the conversation on Warp. I completed the review and no human review was requested for this pull request. Comment Powered by Oz |
There was a problem hiding this comment.
Overview
Adds dynamic git worktree completions for git worktree subcommands and cd, backed by git worktree list --porcelain, with unit coverage for parsing and command construction.
Concerns
- The shared worktree generator emits the main worktree, but the newly wired
git worktree lock,move,remove, andunlockarguments cannot operate on the main worktree path, so the first suggested completion is invalid for those commands.
Verdict
Found: 0 critical, 1 important, 0 suggestions
Request changes
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
Scope trim + review fix on the same PR: - Revert cd.json and delete the cd generator (src/generators/cd.rs + its mod.rs registration). The worktrees suggestions were being bolted onto the universal `cd` builtin, shelling out to git on every cd completion. - Exclude the main working tree from the worktrees generator. The main worktree is an invalid target for git worktree lock/unlock/move/remove (the only consumers), so suggesting it always produced a failing command. git worktree list --porcelain lists the main worktree first, so it is skipped. Added a regression test asserting its absence. The git worktree lock/move/remove/unlock wiring in json/git.json is unchanged. Co-Authored-By: Warp <agent@warp.dev>
acarl005
approved these changes
Aug 6, 2026
This was referenced Aug 6, 2026
acarl005
pushed a commit
to warpdotdev/warp
that referenced
this pull request
Aug 6, 2026
## Summary Bumps the `warp-command-signatures` git dependency in `warpdotdev/warp` from `4990fa1d` to `4094b657` (current `warpdotdev/command-signatures:main`), so the client picks up newly-merged completion specs. Merged completion PRs now included: - Add completion spec: Yandex Cloud CLI (`yc`) — warpdotdev/command-signatures#303 - Add git worktree name autocomplete suggestions — warpdotdev/command-signatures#302 This is the app-side half of APP-5201: the `yc` completion spec merged upstream in command-signatures#303, and this PR wires that spec into the app by advancing the embedded-signatures dependency. Only `Cargo.toml` (the `rev`) and `Cargo.lock` (the two git-source lines for `warp-command-signatures` / `warp-completion-metadata`) change. The bump was produced by following the command-signatures repo's own `update-command-spec-version` skill (update the `rev`, sync `Cargo.lock`). ## Verification Testing-exempt category: **dependency/version bump**. Per factory-verification, a data-only dependency bump adds no regression test (a test would only assert data presence, not detect a logic defect); the `yc` spec itself is validated by command-signatures#303's own CI, which passed before merge. App-side checks (run against the new rev, `CARGO_TARGET_DIR` redirected in the sandbox): - `cargo check --locked -p warp_completer` → success. `--locked` proves `Cargo.lock` is in sync with the new rev; the consuming crate compiles against the updated specs. - `cargo test --locked -p warp_completer -- signatures::` → 12 passed / 0 failed. These load and validate the embedded command signatures (including the new `yc` spec). - Full `cargo test --locked -p warp_completer` → 138 passed / 25 failed. All 25 failures are a pre-existing, environmental test-harness issue unrelated to this change — `Tried to check FeatureFlag::CloudEnvironments before feature flags were initialized` (`crates/warp_features/src/lib.rs`) — not caused by the dependency bump. No Rust source files change in this PR, so there is nothing for `./script/format` or `clippy` to act on beyond the compile above. User-facing note: the `yc` completion menu rendering from this exact spec was already demonstrated in a prior local GUI build against the spec branch; because this PR is a data-only dependency bump (no client code change), the GUI was not rebuilt for it. The rendering behavior is governed entirely by the upstream spec, which is validated by command-signatures#303. CHANGELOG-IMPROVEMENT: Added inline command completions for the Yandex Cloud CLI (`yc`) and git worktree name suggestions. Originating thread: https://warpdev.slack.com/archives/C0BDQDW8V5E/p1785974187380919 <!-- factory-agent: {"source":"factory-agent","task_id":"APP-5201","task_source":"linear","task_url":"https://linear.app/warpdotdev/issue/APP-5201/add-yc-yandex-cloud-cli-command-completions","linear_issue_id":"APP-5201","oz_run_id":"019fd4c1-7a3e-70e0-bcec-c9f12606fd8a","repo":"warpdotdev/warp"} --> Co-authored-by: Oz <oz-agent@warp.dev> Co-authored-by: Warp <agent@warp.dev>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds git-worktree-aware autocomplete so Warp suggests a repo's known linked working trees while typing
git worktree lock,move,remove, andunlock.worktreesgenerator incommand-signatures/src/generators/git.rs, sourced fromgit --no-optional-locks worktree list --porcelain. It parses the porcelain records and emits one suggestion per linked working tree, mirroring the neighbouring git generators (--no-optional-locks,filter_messages/fatal:short-circuit,IconType, descriptions)."generatorName": "worktrees"into theworktreearg ofgit worktree lock,move,remove, andunlockincommand-signatures/json/git.json(the previously empty arg slots).Design decision: insert the path, not the name
Each suggestion inserts the worktree's path, not a derived short name. Git identifies a working tree by its path — the
worktreearg ingit.jsondocuments "Working trees can be identified by path, either relative or absolute", andgit worktree lock/move/remove/unlockall operate on a path.git worktree list --porcelainreports absolute paths, so the inserted value always resolves. The checked-out branch (stripped ofrefs/heads/), or thebare/detached HEADstate, is surfaced as the suggestion description so the user can tell worktrees apart.Design decision: exclude the main working tree, single generator
The main working tree is an invalid target for all four consuming subcommands —
git worktree lock/unlockreject it outright andremove/moverefuse it — so suggesting it would only ever produce a command that fails.git worktree list --porcelainalways lists the main worktree first, so it is skipped. Because the fourgit worktreesubcommands are the only consumers and all reject the main worktree, a singleworktreesgenerator that excludes it is sufficient; a second "all worktrees" generator would be unreferenced dead code, so it was not added.Verification
This is a spec/generator change validated by deterministic unit tests; there is no runnable UI in this repo, so no computer-use visual proof is applicable (the client that renders these suggestions lives elsewhere).
git.rsover realgit worktree list --porcelainoutput:test_post_process_worktrees(branch + detached linked worktrees, and an explicit assertion that the main worktree is absent),test_post_process_worktrees_bare(bare main excluded, linked kept),test_post_process_worktrees_only_main(main-only repo → no suggestions),test_post_process_worktrees_fatal_error(fatal short-circuit),test_worktrees_generator_command(asserts the porcelain command).all_referenced_generators_existconfirms the newgeneratorName: "worktrees"references ingit.jsonresolve to a defined generator, andall_command_specs_succeed_deserializationconfirms the JSON still parses../script/presubmitpasses end to end:npm run format:check,cargo fmt --check,cargo clippy … -D warnings, andcargo test(87 tests, 0 failures).Context
command-signatures(dynamic git values are supplied by named generators here), so that PR is being reverted to draft.Rework changes
cdscope (requester objected): revertedcommand-signatures/json/cd.json, deletedcommand-signatures/src/generators/cd.rs, and removed its registration fromgenerators/mod.rs. Attachingworktreesto the universalcdbuiltin would have shelled out togit worktree liston everycdcompletion anywhere, well beyond the issue's scope.oz-for-ossreview finding): the generator no longer suggests the main worktree, which the fourgit worktreesubcommands all reject. Addedtest_post_process_worktrees_only_mainand an in-test assertion that the main worktree is absent.Originating thread: https://warpdev.slack.com/archives/C0BDQDW8V5E/p1785969286177199
Conversation: https://staging.warp.dev/conversation/b894be3e-b473-41a9-b2c9-b972048c4fa9
Run: https://oz.staging.warp.dev/runs/019fd491-856f-7b3b-bc44-504490833074
This PR was generated with Oz.