git-worktrees 0.6.2__tar.gz → 0.7.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/AGENTS.md +17 -0
  2. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/CHANGELOG.md +11 -0
  3. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/PKG-INFO +20 -5
  4. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/README.md +19 -4
  5. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/conf.d/worktrees.fish +1 -1
  6. git_worktrees-0.7.0/plugin/.claude-plugin/plugin.json +13 -0
  7. git_worktrees-0.7.0/plugin/.codex-plugin/plugin.json +33 -0
  8. git_worktrees-0.7.0/plugin/README.md +68 -0
  9. git_worktrees-0.7.0/plugin/commands/prune.md +26 -0
  10. git_worktrees-0.7.0/plugin/plugin.json +20 -0
  11. git_worktrees-0.7.0/plugin/skills/worktrees/SKILL.md +137 -0
  12. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/pyproject.toml +1 -1
  13. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/scripts/bump_version.py +6 -1
  14. git_worktrees-0.7.0/tests/test_plugin.py +118 -0
  15. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/uv.lock +1 -1
  16. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/zsh/plugins/worktrees/worktrees.plugin.zsh +1 -1
  17. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/.claude/settings.json +0 -0
  18. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/.github/workflows/codeql.yml +0 -0
  19. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/.github/workflows/publish.yml +0 -0
  20. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/.github/workflows/testpypi.yml +0 -0
  21. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/.github/workflows/tests.yml +0 -0
  22. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/.gitignore +0 -0
  23. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/.pre-commit-config.yaml +0 -0
  24. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/.python-version +0 -0
  25. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/.releasetools.yaml +0 -0
  26. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/LICENSE +0 -0
  27. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/Makefile +0 -0
  28. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/completions/gw.fish +0 -0
  29. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/completions/gwa.fish +0 -0
  30. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/completions/gwbc.fish +0 -0
  31. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/completions/gwbd.fish +0 -0
  32. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/completions/gwbs.fish +0 -0
  33. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/completions/gwh.fish +0 -0
  34. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/completions/gwl.fish +0 -0
  35. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/completions/gwm.fish +0 -0
  36. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/completions/gwp.fish +0 -0
  37. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/completions/gwr.fish +0 -0
  38. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/completions/gwrot.fish +0 -0
  39. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/completions/gws.fish +0 -0
  40. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/completions/worktrees.fish +0 -0
  41. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/docs/BENCHMARK.md +0 -0
  42. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/docs/DEVELOPMENT.md +0 -0
  43. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/docs/REFERENCE.md +0 -0
  44. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/docs/commands/branch-delete.md +0 -0
  45. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/docs/commands/branch-status.md +0 -0
  46. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/functions/gwa.fish +0 -0
  47. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/functions/gwl.fish +0 -0
  48. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/functions/gwm.fish +0 -0
  49. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/functions/gwp!.fish +0 -0
  50. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/functions/gwr!.fish +0 -0
  51. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/functions/gwr.fish +0 -0
  52. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/hatch_build.py +0 -0
  53. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/renovate.json +0 -0
  54. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/scripts/README.md +0 -0
  55. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/scripts/benchmark.py +0 -0
  56. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/scripts/verify-publish.bash +0 -0
  57. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/src/worktrees/__init__.py +0 -0
  58. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/src/worktrees/branch_cli.py +0 -0
  59. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/src/worktrees/branch_forge.py +0 -0
  60. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/src/worktrees/branches.py +0 -0
  61. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/src/worktrees/cli.py +0 -0
  62. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/src/worktrees/errors.py +0 -0
  63. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/src/worktrees/forge.py +0 -0
  64. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/src/worktrees/git.py +0 -0
  65. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/src/worktrees/layout.py +0 -0
  66. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/src/worktrees/merged.py +0 -0
  67. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/src/worktrees/new_branch.py +0 -0
  68. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/src/worktrees/pick.py +0 -0
  69. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/src/worktrees/progress.py +0 -0
  70. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/src/worktrees/prune.py +0 -0
  71. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/src/worktrees/render.py +0 -0
  72. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/src/worktrees/repo.py +0 -0
  73. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/src/worktrees/rotate.py +0 -0
  74. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/src/worktrees/verdicts.py +0 -0
  75. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/src/worktrees/worktree.py +0 -0
  76. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/tests/conftest.py +0 -0
  77. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/tests/test_benchmark.py +0 -0
  78. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/tests/test_branch_forge.py +0 -0
  79. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/tests/test_branches.py +0 -0
  80. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/tests/test_cli.py +0 -0
  81. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/tests/test_completions.py +0 -0
  82. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/tests/test_fixture.py +0 -0
  83. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/tests/test_forge.py +0 -0
  84. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/tests/test_gates.py +0 -0
  85. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/tests/test_new_branch.py +0 -0
  86. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/tests/test_render.py +0 -0
  87. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/tests/test_rotate.py +0 -0
  88. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/tests/test_shims.py +0 -0
  89. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/tests/test_spec.py +0 -0
  90. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/tests/test_version.py +0 -0
  91. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/tests/test_worktree.py +0 -0
  92. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/zsh/plugins/worktrees/completions/_gw +0 -0
  93. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/zsh/plugins/worktrees/completions/_gwa +0 -0
  94. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/zsh/plugins/worktrees/completions/_gwbc +0 -0
  95. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/zsh/plugins/worktrees/completions/_gwbd +0 -0
  96. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/zsh/plugins/worktrees/completions/_gwbs +0 -0
  97. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/zsh/plugins/worktrees/completions/_gwh +0 -0
  98. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/zsh/plugins/worktrees/completions/_gwl +0 -0
  99. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/zsh/plugins/worktrees/completions/_gwm +0 -0
  100. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/zsh/plugins/worktrees/completions/_gwp +0 -0
  101. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/zsh/plugins/worktrees/completions/_gwr +0 -0
  102. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/zsh/plugins/worktrees/completions/_gwrot +0 -0
  103. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/zsh/plugins/worktrees/completions/_gws +0 -0
  104. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/zsh/plugins/worktrees/functions/gwa +0 -0
  105. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/zsh/plugins/worktrees/functions/gwl +0 -0
  106. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/zsh/plugins/worktrees/functions/gwm +0 -0
  107. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/zsh/plugins/worktrees/functions/gwp! +0 -0
  108. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/zsh/plugins/worktrees/functions/gwr +0 -0
  109. {git_worktrees-0.6.2 → git_worktrees-0.7.0}/zsh/plugins/worktrees/functions/gwr! +0 -0
@@ -131,6 +131,23 @@ command's flags, and `tests/test_completions.py` diffs those against `--help`
131
131
  in both directions for both shells: a renamed flag fails there rather than
132
132
  going quiet in a completion nobody is watching.
133
133
 
134
+ ## The agent plugin reads `--json`
135
+
136
+ `plugin/` is an agent plugin, installed from a release tag through the
137
+ `release-tools` marketplace. Its skill pipes `gwbs --json` and `gws --json`
138
+ each through a jq filter and removes only with `gwp` and `gwbd`, so the JSON
139
+ fields those filters name are an interface. `tests/test_plugin.py` runs both
140
+ filters, read out of `SKILL.md`, against the commands' output: a renamed or
141
+ dropped field fails there. They are two plain pipelines, and the head sha is
142
+ written into the second as a literal rather than passed as a jq variable,
143
+ because Claude Code refused both a `{ ...; } | jq` group and a jq program
144
+ holding a `$` under the command's `allowed-tools`.
145
+
146
+ The plugin carries the release version in three manifests, and
147
+ `scripts/bump_version.py` stamps all three. `plugin/plugin.json` is the
148
+ portable manifest, the Claude one with only the fields Agent Plugins v1 names;
149
+ the same test holds it to that.
150
+
134
151
  ## The picker is Python's, and there is no fzf
135
152
 
136
153
  Building the candidate list, matching a query against it, ranking, deciding
@@ -17,6 +17,17 @@ not in here, whatever it cost to build.
17
17
  A release closes with a `### Choices` section when a decision in it is worth
18
18
  the reader's time: what was chosen, and what the alternative failed to do.
19
19
 
20
+ ## 0.7.0 - 2026-11-05
21
+
22
+ ### Added
23
+
24
+ An agent plugin for Claude Code and Codex, in `plugin/`. `/worktrees:prune`
25
+ runs `gws` and `gwbs`, shows the worktrees and branches they proved
26
+ finished with the proof for each, asks which to remove, and removes those
27
+ with `gwp` and `gwbd`, then lists what was removed, what was refused and
28
+ the commands that restore each branch. Install it from the `release-tools`
29
+ marketplace as `worktrees@release-tools`.
30
+
20
31
  ## 0.6.2 - 2026-11-04
21
32
 
22
33
  ### Added
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: git-worktrees
3
- Version: 0.6.2
3
+ Version: 0.7.0
4
4
  Summary: Git worktree commands that refuse to lose work.
5
5
  Project-URL: Bug reports, https://github.com/MihaiBojin/worktrees/issues/new
6
6
  Project-URL: Source, https://github.com/MihaiBojin/worktrees
@@ -144,7 +144,7 @@ the plugin's tag to the same release, as each manager below describes.
144
144
  ### fish
145
145
 
146
146
  ```console
147
- fisher install MihaiBojin/worktrees@v0.6.2
147
+ fisher install MihaiBojin/worktrees@v0.7.0
148
148
  ```
149
149
 
150
150
  Fisher copies `functions/`, `completions/` and `conf.d/` from the repository
@@ -161,7 +161,7 @@ the untagged one holds the files.
161
161
  Antidote takes a `path:` into the repository, and `branch:` takes a tag:
162
162
 
163
163
  ```
164
- MihaiBojin/worktrees branch:v0.6.2 path:zsh/plugins/worktrees # in zsh_plugins.txt
164
+ MihaiBojin/worktrees branch:v0.7.0 path:zsh/plugins/worktrees # in zsh_plugins.txt
165
165
  ```
166
166
 
167
167
  The plugin puts its own `functions/` and `completions/` on `fpath` and
@@ -533,7 +533,7 @@ their own and `gwbc` puts them on a branch.
533
533
 
534
534
  ```console
535
535
  $ gwh
536
- worktrees 0.6.2: git worktree commands that refuse to lose work
536
+ worktrees 0.7.0: git worktree commands that refuse to lose work
537
537
 
538
538
  COMMAND GW DOES
539
539
  gws gw status (s, st) which worktrees are finished, and why
@@ -552,7 +552,7 @@ gwbd [NAME ...] gw branch delete delete local branches proved finished
552
552
  gwa, gwl, gwm and gwr change the directory you are standing in.
553
553
  A binary cannot do that, so each needs the shell function of the same name
554
554
  from the plugin; the rest need nothing but $PATH.
555
- The shell plugin here is 0.6.2, the same release as these commands.
555
+ The shell plugin here is 0.7.0, the same release as these commands.
556
556
  ```
557
557
 
558
558
  `gw help`, `gw h` and `gw` with no subcommand print the same thing. One table
@@ -668,6 +668,21 @@ all refused, because git reads the empty string as "no old value" and takes
668
668
  the branch at exit 0, which is `branch -D` spelled longer. `update-ref --stdin`
669
669
  is refused with them: it deletes refs without `-d` appearing at all.
670
670
 
671
+ ## Agent plugin
672
+
673
+ `plugin/` is a plugin for Claude Code and Codex. `/worktrees:prune` runs `gws`
674
+ and `gwbs`, shows the worktrees and branches they proved finished, asks which
675
+ to remove, and removes those with `gwp` and `gwbd`. It is listed in the
676
+ `release-tools` marketplace:
677
+
678
+ ```console
679
+ claude plugin marketplace add releasetools/agent-plugins
680
+ claude plugin install worktrees@release-tools
681
+ ```
682
+
683
+ [plugin/README.md](plugin/README.md) covers Codex, what the command shows and
684
+ what it will not do.
685
+
671
686
  ## Contributing
672
687
 
673
688
  The Python, the tests and the release procedure are in
@@ -118,7 +118,7 @@ the plugin's tag to the same release, as each manager below describes.
118
118
  ### fish
119
119
 
120
120
  ```console
121
- fisher install MihaiBojin/worktrees@v0.6.2
121
+ fisher install MihaiBojin/worktrees@v0.7.0
122
122
  ```
123
123
 
124
124
  Fisher copies `functions/`, `completions/` and `conf.d/` from the repository
@@ -135,7 +135,7 @@ the untagged one holds the files.
135
135
  Antidote takes a `path:` into the repository, and `branch:` takes a tag:
136
136
 
137
137
  ```
138
- MihaiBojin/worktrees branch:v0.6.2 path:zsh/plugins/worktrees # in zsh_plugins.txt
138
+ MihaiBojin/worktrees branch:v0.7.0 path:zsh/plugins/worktrees # in zsh_plugins.txt
139
139
  ```
140
140
 
141
141
  The plugin puts its own `functions/` and `completions/` on `fpath` and
@@ -507,7 +507,7 @@ their own and `gwbc` puts them on a branch.
507
507
 
508
508
  ```console
509
509
  $ gwh
510
- worktrees 0.6.2: git worktree commands that refuse to lose work
510
+ worktrees 0.7.0: git worktree commands that refuse to lose work
511
511
 
512
512
  COMMAND GW DOES
513
513
  gws gw status (s, st) which worktrees are finished, and why
@@ -526,7 +526,7 @@ gwbd [NAME ...] gw branch delete delete local branches proved finished
526
526
  gwa, gwl, gwm and gwr change the directory you are standing in.
527
527
  A binary cannot do that, so each needs the shell function of the same name
528
528
  from the plugin; the rest need nothing but $PATH.
529
- The shell plugin here is 0.6.2, the same release as these commands.
529
+ The shell plugin here is 0.7.0, the same release as these commands.
530
530
  ```
531
531
 
532
532
  `gw help`, `gw h` and `gw` with no subcommand print the same thing. One table
@@ -642,6 +642,21 @@ all refused, because git reads the empty string as "no old value" and takes
642
642
  the branch at exit 0, which is `branch -D` spelled longer. `update-ref --stdin`
643
643
  is refused with them: it deletes refs without `-d` appearing at all.
644
644
 
645
+ ## Agent plugin
646
+
647
+ `plugin/` is a plugin for Claude Code and Codex. `/worktrees:prune` runs `gws`
648
+ and `gwbs`, shows the worktrees and branches they proved finished, asks which
649
+ to remove, and removes those with `gwp` and `gwbd`. It is listed in the
650
+ `release-tools` marketplace:
651
+
652
+ ```console
653
+ claude plugin marketplace add releasetools/agent-plugins
654
+ claude plugin install worktrees@release-tools
655
+ ```
656
+
657
+ [plugin/README.md](plugin/README.md) covers Codex, what the command shows and
658
+ what it will not do.
659
+
645
660
  ## Contributing
646
661
 
647
662
  The Python, the tests and the release procedure are in
@@ -4,4 +4,4 @@
4
4
  # The release this plugin came from, which `gwh` and `gw version` compare
5
5
  # with their own. Exported, because the environment is all a binary can see
6
6
  # of the shell that started it.
7
- set -gx WORKTREES_PLUGIN_VERSION 0.6.2
7
+ set -gx WORKTREES_PLUGIN_VERSION 0.7.0
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "worktrees",
3
+ "version": "0.7.0",
4
+ "description": "Remove the git worktrees and branches the worktrees CLI proves finished, after asking",
5
+ "author": {
6
+ "name": "Mihai Bojin",
7
+ "url": "https://github.com/MihaiBojin"
8
+ },
9
+ "homepage": "https://github.com/MihaiBojin/worktrees/tree/main/plugin#readme",
10
+ "repository": "https://github.com/MihaiBojin/worktrees",
11
+ "license": "Apache-2.0",
12
+ "keywords": ["git", "worktree", "branch", "prune", "squash-merge"]
13
+ }
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "worktrees",
3
+ "version": "0.7.0",
4
+ "description": "Remove the git worktrees and branches the worktrees CLI proves finished, after asking",
5
+ "author": {
6
+ "name": "Mihai Bojin",
7
+ "url": "https://github.com/MihaiBojin"
8
+ },
9
+ "homepage": "https://github.com/MihaiBojin/worktrees/tree/main/plugin#readme",
10
+ "repository": "https://github.com/MihaiBojin/worktrees",
11
+ "license": "Apache-2.0",
12
+ "keywords": ["git", "worktree", "branch", "prune", "squash-merge"],
13
+ "skills": "./skills/",
14
+ "commands": "./commands/",
15
+ "interface": {
16
+ "displayName": "worktrees",
17
+ "shortDescription": "Remove finished worktrees and branches, with proof",
18
+ "longDescription": "Ask the worktrees CLI which linked worktrees and local branches are finished, show the ones it proved with the proof it found, and remove only those you choose, through the CLI. A squash merge leaves branches behind that git branch -d calls unmerged; the CLI proves them merged by ancestry, by content or by the forge's merged request, and prints the command that puts each one back.",
19
+ "developerName": "Mihai Bojin",
20
+ "category": "Developer Tools",
21
+ "capabilities": [
22
+ "List the worktrees and branches proved finished, with the proof",
23
+ "Remove only the ones you choose, through the CLI",
24
+ "Print the command that restores each removed branch"
25
+ ],
26
+ "websiteURL": "https://github.com/MihaiBojin/worktrees/tree/main/plugin#readme",
27
+ "defaultPrompt": [
28
+ "Clean up the finished worktrees and branches here.",
29
+ "Which of my branches are already merged?",
30
+ "Prune the squash-merged branches in this repository."
31
+ ]
32
+ }
33
+ }
@@ -0,0 +1,68 @@
1
+ # worktrees, as an agent plugin
2
+
3
+ `/worktrees:prune` asks the `worktrees` CLI which linked worktrees and local
4
+ branches are finished, shows the ones it proved in one table with the proof,
5
+ and removes the ones you pick. The decision is the CLI's, so it is the same in
6
+ every repository, and the agent reads a filtered summary of about 4 KB for 30
7
+ branches rather than the full assessment.
8
+
9
+ ## Install
10
+
11
+ The plugin is listed in the `release-tools` marketplace, pinned to a release
12
+ of this repository.
13
+
14
+ Claude Code:
15
+
16
+ ```shell
17
+ claude plugin marketplace add releasetools/agent-plugins
18
+ claude plugin install worktrees@release-tools
19
+ ```
20
+
21
+ Codex:
22
+
23
+ ```shell
24
+ codex plugin marketplace add releasetools/agent-plugins
25
+ codex plugin add worktrees@release-tools
26
+ ```
27
+
28
+ ## What it needs
29
+
30
+ The commands, from the same release:
31
+
32
+ ```shell
33
+ uv tool install git-worktrees
34
+ ```
35
+
36
+ The plugin runs `gws`, `gwbs`, `gwp`, `gwbd` and `jq`. It installs none of
37
+ them.
38
+
39
+ ## What it does
40
+
41
+ 1. Runs `gws --json` and `gwbs --json`, fetching first unless you pass
42
+ `--no-fetch`, and keeps only the rows marked `remove`, with their proof,
43
+ plus counts of the rest.
44
+ 2. Shows them in one table. A worktree whose branch sits on the head branch's
45
+ tip, with no commits of its own, is marked: that is also what a worktree
46
+ somebody has just started looks like.
47
+ 3. Asks what to remove. Claude Code offers the choices as a question; Codex
48
+ asks in plain text.
49
+ 4. Removes each chosen worktree with `gwp --branch NAME --yes` and the chosen
50
+ branches with `gwbd NAME... --yes`. Both assess again before removing.
51
+ 5. Reports what was removed, what the CLI refused and why, and the
52
+ `git branch NAME SHA` line that restores each branch.
53
+
54
+ ## What it will not do
55
+
56
+ Remove anything before you answer, or anything the CLI did not prove. Delete a
57
+ remote branch. Run `git branch -D`, `git worktree remove` or `rm`. Pass
58
+ `--delete-ignored`, which deletes a worktree's gitignored files for good,
59
+ unless you ask for it.
60
+
61
+ ## Versions
62
+
63
+ The plugin carries the version of the release it ships in.
64
+ `scripts/bump_version.py` writes it into `.claude-plugin/plugin.json`,
65
+ `.codex-plugin/plugin.json` and `plugin.json` along with every other copy, so
66
+ a client sees an update whenever the marketplace moves to a newer tag.
67
+ `plugin.json` is the [Agent Plugins](https://agent-plugins.org) manifest and
68
+ holds only the fields that format names.
@@ -0,0 +1,26 @@
1
+ ---
2
+ name: prune
3
+ description: Remove the worktrees and branches the worktrees CLI proves finished, after asking
4
+ argument-hint: "[--no-fetch]"
5
+ allowed-tools:
6
+ - Bash(gws:*)
7
+ - Bash(gwbs:*)
8
+ - Bash(gwp:*)
9
+ - Bash(gwbd:*)
10
+ - Bash(jq:*)
11
+ - Bash(git status:*)
12
+ - Bash(git worktree list:*)
13
+ - Bash(git rev-parse:*)
14
+ - Bash(git log:*)
15
+ - Read
16
+ - AskUserQuestion
17
+ ---
18
+
19
+ Prune this repository with the worktrees skill. It carries the commands, the
20
+ jq filters, the question to ask and how to report. Nothing below repeats it.
21
+
22
+ `$ARGUMENTS` may say `--no-fetch`; pass it to every CLI command when it does.
23
+ Anything else in it names worktrees or branches the user wants considered:
24
+ offer only those.
25
+
26
+ Remove nothing until the user has answered.
@@ -0,0 +1,20 @@
1
+ {
2
+ "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
3
+ "name": "worktrees",
4
+ "version": "0.7.0",
5
+ "description": "Remove the git worktrees and branches the worktrees CLI proves finished, after asking",
6
+ "author": {
7
+ "name": "Mihai Bojin",
8
+ "url": "https://github.com/MihaiBojin"
9
+ },
10
+ "homepage": "https://github.com/MihaiBojin/worktrees/tree/main/plugin#readme",
11
+ "repository": "https://github.com/MihaiBojin/worktrees",
12
+ "license": "Apache-2.0",
13
+ "keywords": [
14
+ "git",
15
+ "worktree",
16
+ "branch",
17
+ "prune",
18
+ "squash-merge"
19
+ ]
20
+ }
@@ -0,0 +1,137 @@
1
+ ---
2
+ name: worktrees
3
+ description: >
4
+ Remove the linked git worktrees and local branches that the worktrees CLI
5
+ proves finished, after showing them and asking which to remove. Use when the
6
+ user asks to clean up, tidy or prune finished, merged or squash-merged
7
+ branches or worktrees, or asks which of them are done. Triggers on: clean up
8
+ branches, prune worktrees, delete merged branches, squash-merged branches
9
+ left behind, which branches are finished, gws, gwp, gwbs, gwbd.
10
+ ---
11
+
12
+ # worktrees: remove what is proved finished
13
+
14
+ The `worktrees` CLI decides. `gws` and `gwbs` say which worktrees and branches
15
+ are finished, with the proof; `gwp` and `gwbd` remove them, assessing each
16
+ again first and refusing anything that is no longer proved. This skill runs
17
+ those four, shows the answer compactly and asks before removing anything. It
18
+ makes no judgement of its own about whether a branch is merged.
19
+
20
+ The commands come from `uv tool install git-worktrees`. If `gws` is not
21
+ found, say so and stop.
22
+
23
+ ## 1. Assess
24
+
25
+ Run these two from inside the repository, in this order, each exactly as
26
+ written. Add `--no-fetch` to `gwbs` and `gws` only when the user asked for it.
27
+
28
+ Branches first:
29
+
30
+ ```sh
31
+ gwbs --json | jq -c '{
32
+ head_sha,
33
+ branches: [.verdicts[] | select(.verdict == "remove") | {branch, proof, undo}],
34
+ kept: [.verdicts[] | select(.verdict == "keep")] | length,
35
+ unknown: [.verdicts[] | select(.verdict == "unknown")] | length
36
+ }'
37
+ ```
38
+
39
+ Then worktrees, with the `head_sha` that printed written in place of
40
+ `HEAD_SHA`:
41
+
42
+ ```sh
43
+ gws --json | jq -c '{
44
+ worktrees: [.verdicts[] | select(.verdict == "remove")
45
+ | {branch, path, why, at_head: (.sha == "HEAD_SHA")}],
46
+ kept: [.verdicts[] | select(.verdict == "keep")] | length,
47
+ unknown: [.verdicts[] | select(.verdict == "unknown")] | length,
48
+ ignored: [.verdicts[] | select(.verdict == "keep" and .ignored > 0) | .branch]
49
+ }'
50
+ ```
51
+
52
+ - `branches` are local branches with no worktree that `gwbd` would delete.
53
+ `proof` is `ancestry`, `squash`, `content` or `forge`; `undo` recreates the
54
+ branch.
55
+ - `worktrees` are linked worktrees `gwp` would remove, together with their
56
+ branches. `why` is the proof, such as `squash-merged`.
57
+ - `at_head` is true when the worktree's branch sits exactly on the head
58
+ branch's tip. That is a worktree with no commits of its own, which is what
59
+ one somebody has just started looks like.
60
+ - `ignored` names worktrees kept only because they hold gitignored files.
61
+ - `kept` and `unknown` count the rest. The main checkout and the head branch
62
+ are always among the kept.
63
+
64
+ A branch checked out in a worktree is `keep` in `branches` and appears in
65
+ `worktrees` instead, so nothing is listed twice.
66
+
67
+ ## 2. Show
68
+
69
+ One table, worktrees first, then branches:
70
+
71
+ ```
72
+ KIND NAME PROOF PATH
73
+ worktree fix-parser squash-merged ~/git/.worktrees/fix-parser/repo
74
+ branch chore/old-renovate squash
75
+ ```
76
+
77
+ Shorten `$HOME` to `~`. Mark an `at_head` row `(no commits of its own)`.
78
+ Under the table, one line each: how many worktrees and branches were kept, how
79
+ many are unknown, and the `ignored` names if there are any. Then say that
80
+ nothing is removed without proof from the CLI, and that both commands assess
81
+ again before removing.
82
+
83
+ When both lists are empty, say so with the counts and stop.
84
+
85
+ ## 3. Ask
86
+
87
+ Never remove anything without an answer.
88
+
89
+ In Claude Code, use the AskUserQuestion tool. It takes two to four options;
90
+ offer the ones that apply:
91
+
92
+ - Remove all proven: every row except those marked `at_head`.
93
+ - Only branches: the `branches` rows.
94
+ - Only worktrees: the `worktrees` rows not marked `at_head`.
95
+ - Remove nothing.
96
+
97
+ "Other" carries names: a list to remove, or "all except" a list to keep. An
98
+ `at_head` worktree is removed only when the user names it.
99
+
100
+ Where there is no AskUserQuestion tool, as in Codex, ask the same question in
101
+ plain text and wait for the reply.
102
+
103
+ ## 4. Remove
104
+
105
+ Only through the CLI, and only what the user chose. Quote each name for the
106
+ shell. Add `--no-fetch` when the user asked for it in step 1.
107
+
108
+ - Each chosen worktree: `gwp --branch 'NAME' --yes 2>&1`. One call per
109
+ worktree. It removes the worktree and its branch.
110
+ - The chosen branches, in one call: `gwbd 'NAME' 'NAME' ... --yes 2>&1`.
111
+
112
+ Never `git branch -D`, `git worktree remove`, `git update-ref -d` or `rm`.
113
+ Never pass `--delete-ignored` unless the user asked for it by name: it deletes
114
+ the gitignored files in the worktree, and nothing restores them. When they do
115
+ ask for a worktree in `ignored`, it is `gwp --branch 'NAME' --delete-ignored
116
+ --yes 2>&1`.
117
+
118
+ What the output means:
119
+
120
+ - `gwp` prints `restore with: git branch NAME SHA` before removing, then
121
+ `removed 1 worktree(s): NAME`. `NAME kept: REASON` is a refusal. When the
122
+ worktree is no longer proved finished it removes nothing and prints
123
+ `nothing to remove`.
124
+ - `gwbd` prints `each comes back with:` and one `git branch NAME SHA` per
125
+ branch, then `deleted N branch: ...`. A branch it refuses prints
126
+ `NAME kept: REASON` and the command exits 3; the others are still deleted.
127
+
128
+ ## 5. Report
129
+
130
+ Three short parts:
131
+
132
+ - what was removed, worktrees and branches;
133
+ - what the CLI refused, with its reason;
134
+ - the undo commands, as printed, in one fenced block.
135
+
136
+ Say that an undo command recreates the branch while its commit is still in
137
+ the repository. It does not recreate a removed worktree's directory.
@@ -9,7 +9,7 @@ authors = [
9
9
  ]
10
10
  # Static, and the single source of truth for the version. Bump it in a pull
11
11
  # request and run `uv lock`; the release tag only has to agree with it.
12
- version = "0.6.2"
12
+ version = "0.7.0"
13
13
  # The standard library answers every question this asks. A dependency here
14
14
  # would be paid on every invocation, and an invocation is 67 ms of which 25 ms
15
15
  # is the interpreter starting.
@@ -5,7 +5,9 @@
5
5
  `uv version` writes `pyproject.toml` and `uv.lock`, and the wheel reads it
6
6
  from there. The shell plugins carry a copy of their own, because Fisher and
7
7
  Antidote install them from a git tag rather than from anything built, and the
8
- README's install lines name that tag. `.releasetools.yaml` runs this as the
8
+ README's install lines name that tag. The agent plugin's three manifests carry
9
+ one too: a marketplace installs it from a tag, and a client sees an update only
10
+ when the version moves. `.releasetools.yaml` runs this as the
9
11
  release's bump, and `tests/test_version.py` fails when a copy disagrees with
10
12
  `pyproject.toml`.
11
13
 
@@ -29,6 +31,9 @@ STAMPS: dict[str, tuple[str, ...]] = {
29
31
  "zsh/plugins/worktrees/worktrees.plugin.zsh": (
30
32
  "export WORKTREES_PLUGIN_VERSION={}",
31
33
  ),
34
+ "plugin/.claude-plugin/plugin.json": ('"version": "{}"',),
35
+ "plugin/.codex-plugin/plugin.json": ('"version": "{}"',),
36
+ "plugin/plugin.json": ('"version": "{}"',),
32
37
  "README.md": (
33
38
  "MihaiBojin/worktrees@v{}",
34
39
  "MihaiBojin/worktrees branch:v{}",
@@ -0,0 +1,118 @@
1
+ """The agent plugin in `plugin/`: its manifests agree, and the jq filters its
2
+ skill runs read the JSON `gws` and `gwbs` print today."""
3
+
4
+ from __future__ import annotations
5
+
6
+ import json
7
+ import re
8
+ import subprocess
9
+ import sys
10
+ from pathlib import Path
11
+
12
+ from conftest import env_for
13
+
14
+ ROOT = Path(__file__).resolve().parents[1]
15
+ PLUGIN = ROOT / "plugin"
16
+ SKILL = PLUGIN / "skills" / "worktrees" / "SKILL.md"
17
+
18
+ # The fields the Agent Plugins v1 manifest names, in the order
19
+ # releasetools/agent-plugins writes them.
20
+ PORTABLE = (
21
+ "name",
22
+ "version",
23
+ "description",
24
+ "author",
25
+ "homepage",
26
+ "repository",
27
+ "license",
28
+ "keywords",
29
+ )
30
+ SCHEMA = "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json"
31
+
32
+
33
+ def _manifest(relative: str) -> dict:
34
+ return json.loads((PLUGIN / relative).read_text())
35
+
36
+
37
+ def test_the_two_client_manifests_describe_one_plugin() -> None:
38
+ claude = _manifest(".claude-plugin/plugin.json")
39
+ codex = _manifest(".codex-plugin/plugin.json")
40
+ assert {k: claude[k] for k in PORTABLE} == {k: codex[k] for k in PORTABLE}
41
+ assert codex["skills"] == "./skills/"
42
+ assert codex["commands"] == "./commands/"
43
+
44
+
45
+ def test_the_portable_manifest_is_the_claude_one_rewritten() -> None:
46
+ """Byte for byte what agent-plugins' sync writes, which its validator
47
+ compares."""
48
+ claude = _manifest(".claude-plugin/plugin.json")
49
+ wanted = {"$schema": SCHEMA, **{k: claude[k] for k in PORTABLE}}
50
+ text = (PLUGIN / "plugin.json").read_text()
51
+ assert text == json.dumps(wanted, indent=2, ensure_ascii=False) + "\n"
52
+
53
+
54
+ def _filter(entry: str) -> str:
55
+ """The jq program the skill pipes `entry --json` into, as written."""
56
+ found = re.search(
57
+ rf"^{entry} --json \| jq -c '(.*?)'\n```",
58
+ SKILL.read_text(),
59
+ re.S | re.M,
60
+ )
61
+ assert found, f"the skill's {entry} command is not where this looks"
62
+ return found.group(1)
63
+
64
+
65
+ def _jq(program: str, piped: str, head: str = "") -> dict:
66
+ """Runs the program with `HEAD_SHA` written over, as the skill says."""
67
+ program = program.replace("HEAD_SHA", head)
68
+ proc = subprocess.run(
69
+ ["jq", "-c", program], input=piped, capture_output=True, text=True, check=True
70
+ )
71
+ return json.loads(proc.stdout)
72
+
73
+
74
+ def _json(world, entry: str) -> str:
75
+ proc = subprocess.run(
76
+ [
77
+ sys.executable,
78
+ "-c",
79
+ f"from worktrees.cli import {entry}; raise SystemExit({entry}())",
80
+ "--no-fetch",
81
+ "--no-forge",
82
+ "--json",
83
+ ],
84
+ cwd=world.repo,
85
+ env=env_for(world),
86
+ capture_output=True,
87
+ text=True,
88
+ )
89
+ assert proc.returncode == 0, proc.stderr
90
+ return proc.stdout
91
+
92
+
93
+ def test_the_skill_filter_keeps_what_the_user_decides_on(world) -> None:
94
+ squashed = world.worktree("squashed")
95
+ world.commit("squashed-file", at=squashed)
96
+ world.git("checkout", "-qb", "loose")
97
+ world.commit("loose-file")
98
+ world.git("checkout", "-q", "main")
99
+ for branch in ("squashed", "loose"):
100
+ world.git("merge", "--quiet", "--squash", branch)
101
+ world.git("commit", "--quiet", "-m", f"{branch} (#1)")
102
+ world.worktree("started")
103
+
104
+ branches = _jq(_filter("gwbs"), _json(world, "gwbs"))
105
+ out = _jq(_filter("gws"), _json(world, "gws"), branches["head_sha"])
106
+
107
+ worktrees = {row["branch"]: row for row in out["worktrees"]}
108
+ assert set(worktrees) == {"squashed", "started"}
109
+ assert worktrees["squashed"]["at_head"] is False
110
+ assert worktrees["started"]["at_head"] is True
111
+ assert worktrees["squashed"]["path"] == str(squashed)
112
+ assert (out["kept"], out["unknown"], out["ignored"]) == (1, 0, [])
113
+
114
+ # Checked out in a worktree, so gwbs keeps it and only gwp may take it.
115
+ assert [row["branch"] for row in branches["branches"]] == ["loose"]
116
+ assert branches["branches"][0]["proof"] == "squash"
117
+ assert branches["branches"][0]["undo"].startswith("git branch loose ")
118
+ assert (branches["kept"], branches["unknown"]) == (3, 0)
@@ -40,7 +40,7 @@ wheels = [
40
40
 
41
41
  [[package]]
42
42
  name = "git-worktrees"
43
- version = "0.6.2"
43
+ version = "0.7.0"
44
44
  source = { editable = "." }
45
45
 
46
46
  [package.optional-dependencies]
@@ -18,4 +18,4 @@ autoload -Uz gwa gwl gwm gwr 'gwr!' 'gwp!'
18
18
  # The release this plugin came from, which `gwh` and `gw version` compare
19
19
  # with their own. Exported, because the environment is all a binary can see
20
20
  # of the shell that started it.
21
- export WORKTREES_PLUGIN_VERSION=0.6.2
21
+ export WORKTREES_PLUGIN_VERSION=0.7.0
File without changes
File without changes
File without changes