git-worktrees 0.12.1__tar.gz → 0.12.3__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 (137) hide show
  1. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/AGENTS.md +5 -3
  2. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/CHANGELOG.md +22 -0
  3. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/Makefile +33 -13
  4. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/PKG-INFO +10 -8
  5. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/README.md +9 -7
  6. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/conf.d/worktrees.fish +1 -1
  7. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/docs/DEVELOPMENT.md +18 -7
  8. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/docs/commands/merge.md +2 -0
  9. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/plugin/.claude-plugin/plugin.json +1 -1
  10. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/plugin/.codex-plugin/plugin.json +1 -1
  11. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/plugin/README.md +8 -3
  12. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/plugin/plugin.json +1 -1
  13. git_worktrees-0.12.3/plugin/session.md +45 -0
  14. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/plugin/skills/ship-it/SKILL.md +8 -6
  15. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/plugin/skills/ship-it/rights.md +6 -1
  16. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/pyproject.toml +1 -1
  17. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/src/worktrees/pr_merge.py +5 -1
  18. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/tests/test_plugin.py +40 -0
  19. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/tests/test_pr_merge.py +13 -2
  20. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/uv.lock +1 -1
  21. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/zsh/plugins/worktrees/worktrees.plugin.zsh +1 -1
  22. git_worktrees-0.12.1/plugin/session.md +0 -32
  23. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/.claude/settings.json +0 -0
  24. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/.codex/config.toml +0 -0
  25. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/.github/workflows/codeql.yml +0 -0
  26. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/.github/workflows/publish.yml +0 -0
  27. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/.github/workflows/testpypi.yml +0 -0
  28. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/.github/workflows/tests.yml +0 -0
  29. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/.gitignore +0 -0
  30. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/.pre-commit-config.yaml +0 -0
  31. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/.python-version +0 -0
  32. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/.releasetools.yaml +0 -0
  33. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/LICENSE +0 -0
  34. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/completions/gw.fish +0 -0
  35. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/completions/worktrees.fish +0 -0
  36. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/docs/BENCHMARK.md +0 -0
  37. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/docs/REFERENCE.md +0 -0
  38. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/docs/commands/branch-prune.md +0 -0
  39. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/docs/commands/branch-status.md +0 -0
  40. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/docs/commands/ci-checks.md +0 -0
  41. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/docs/commands/fast-forward.md +0 -0
  42. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/docs/plans/2026-11-05-worktree-pruning-design.md +0 -0
  43. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/functions/gw.fish +0 -0
  44. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/functions/gwa.fish +0 -0
  45. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/functions/gwbc.fish +0 -0
  46. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/functions/gwbp.fish +0 -0
  47. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/functions/gwbs.fish +0 -0
  48. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/functions/gwff.fish +0 -0
  49. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/functions/gwl.fish +0 -0
  50. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/functions/gwm.fish +0 -0
  51. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/functions/gwp!.fish +0 -0
  52. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/functions/gwp.fish +0 -0
  53. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/functions/gwpa!.fish +0 -0
  54. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/functions/gwpa.fish +0 -0
  55. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/functions/gwr!.fish +0 -0
  56. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/functions/gwr.fish +0 -0
  57. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/functions/gws.fish +0 -0
  58. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/hatch_build.py +0 -0
  59. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/plugin/hooks/codex.json +0 -0
  60. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/plugin/hooks/hooks.json +0 -0
  61. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/plugin/skills/ci-checks/SKILL.md +0 -0
  62. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/plugin/skills/describe-pr/SKILL.md +0 -0
  63. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/plugin/skills/describe-pr/format.md +0 -0
  64. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/plugin/skills/fast-forward/SKILL.md +0 -0
  65. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/plugin/skills/preflight/SKILL.md +0 -0
  66. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/plugin/skills/preflight/agents/openai.yaml +0 -0
  67. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/plugin/skills/preflight/rules.json +0 -0
  68. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/plugin/skills/prune/SKILL.md +0 -0
  69. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/renovate.json +0 -0
  70. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/scripts/README.md +0 -0
  71. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/scripts/benchmark.py +0 -0
  72. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/scripts/bump_version.py +0 -0
  73. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/scripts/verify-publish.bash +0 -0
  74. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/src/worktrees/__init__.py +0 -0
  75. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/src/worktrees/audit.py +0 -0
  76. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/src/worktrees/branch_cli.py +0 -0
  77. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/src/worktrees/branch_forge.py +0 -0
  78. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/src/worktrees/branches.py +0 -0
  79. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/src/worktrees/ci.py +0 -0
  80. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/src/worktrees/cli.py +0 -0
  81. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/src/worktrees/errors.py +0 -0
  82. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/src/worktrees/fast_forward.py +0 -0
  83. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/src/worktrees/forge.py +0 -0
  84. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/src/worktrees/git.py +0 -0
  85. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/src/worktrees/layout.py +0 -0
  86. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/src/worktrees/merged.py +0 -0
  87. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/src/worktrees/new_branch.py +0 -0
  88. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/src/worktrees/pick.py +0 -0
  89. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/src/worktrees/progress.py +0 -0
  90. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/src/worktrees/prune.py +0 -0
  91. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/src/worktrees/render.py +0 -0
  92. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/src/worktrees/repo.py +0 -0
  93. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/src/worktrees/sync.py +0 -0
  94. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/src/worktrees/verdicts.py +0 -0
  95. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/src/worktrees/worktree.py +0 -0
  96. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/tests/audit_schema.py +0 -0
  97. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/tests/conftest.py +0 -0
  98. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/tests/test_assessment.py +0 -0
  99. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/tests/test_audit.py +0 -0
  100. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/tests/test_benchmark.py +0 -0
  101. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/tests/test_branch_forge.py +0 -0
  102. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/tests/test_branches.py +0 -0
  103. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/tests/test_ci.py +0 -0
  104. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/tests/test_cli.py +0 -0
  105. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/tests/test_command_defaults.py +0 -0
  106. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/tests/test_completions.py +0 -0
  107. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/tests/test_fast_forward.py +0 -0
  108. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/tests/test_fixture.py +0 -0
  109. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/tests/test_forge.py +0 -0
  110. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/tests/test_gates.py +0 -0
  111. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/tests/test_git_records.py +0 -0
  112. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/tests/test_new_branch.py +0 -0
  113. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/tests/test_partial_clone.py +0 -0
  114. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/tests/test_path_boundaries.py +0 -0
  115. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/tests/test_removal.py +0 -0
  116. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/tests/test_render.py +0 -0
  117. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/tests/test_shims.py +0 -0
  118. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/tests/test_spec.py +0 -0
  119. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/tests/test_sync.py +0 -0
  120. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/tests/test_version.py +0 -0
  121. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/tests/test_worktree.py +0 -0
  122. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/zsh/plugins/worktrees/completions/_gw +0 -0
  123. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/zsh/plugins/worktrees/functions/gw +0 -0
  124. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/zsh/plugins/worktrees/functions/gwa +0 -0
  125. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/zsh/plugins/worktrees/functions/gwbc +0 -0
  126. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/zsh/plugins/worktrees/functions/gwbp +0 -0
  127. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/zsh/plugins/worktrees/functions/gwbs +0 -0
  128. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/zsh/plugins/worktrees/functions/gwff +0 -0
  129. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/zsh/plugins/worktrees/functions/gwl +0 -0
  130. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/zsh/plugins/worktrees/functions/gwm +0 -0
  131. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/zsh/plugins/worktrees/functions/gwp +0 -0
  132. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/zsh/plugins/worktrees/functions/gwp! +0 -0
  133. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/zsh/plugins/worktrees/functions/gwpa +0 -0
  134. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/zsh/plugins/worktrees/functions/gwpa! +0 -0
  135. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/zsh/plugins/worktrees/functions/gwr +0 -0
  136. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/zsh/plugins/worktrees/functions/gwr! +0 -0
  137. {git_worktrees-0.12.1 → git_worktrees-0.12.3}/zsh/plugins/worktrees/functions/gws +0 -0
@@ -275,9 +275,11 @@ Both clients hand each session `plugin/session.md` when it starts: a
275
275
  `SessionStart` hook in `plugin/hooks/hooks.json` for Claude Code and
276
276
  `plugin/hooks/codex.json`, which the Codex manifest names, wraps the file
277
277
  in the `additionalContext` JSON with `jq`. The rules say how a session uses
278
- its worktree, including the check it makes before editing: changes it did
279
- not make, or another process's lock, mean another session works there.
280
- Nothing locks a worktree for a session.
278
+ its worktree: one per repository, one branch at a time, another only where
279
+ it has none or another session works in it, and the check it makes before
280
+ editing and whenever changes appear: changes it did not make, or
281
+ another process's lock, mean another session works there. Nothing locks a
282
+ worktree for a session.
281
283
 
282
284
  The plugin carries the release version in three manifests, and
283
285
  `scripts/bump_version.py` stamps all three. `plugin/plugin.json` is the
@@ -17,6 +17,28 @@ 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.12.3 - 2026-11-21
21
+
22
+ ### Fixed
23
+
24
+ `gw merge` merges a pull request that has no checks at all, as in a
25
+ repository without CI, once it is open, ready and mergeable. Failed,
26
+ pending and blocked checks still refuse the merge.
27
+
28
+ ## 0.12.2 - 2026-11-17
29
+
30
+ ### Changed
31
+
32
+ A session keeps one worktree per repository and starts each branch in
33
+ it. It creates a worktree only in a repository where it has none, or
34
+ when another session is working in its own.
35
+
36
+ ### Fixed
37
+
38
+ Codex sessions that ship a change no longer stop for approval at
39
+ `gw sync` or `git switch --create` once the rules in ship-it's
40
+ `rights.md` are installed.
41
+
20
42
  ## 0.12.1 - 2026-11-16
21
43
 
22
44
  ### Changed
@@ -1,25 +1,39 @@
1
- .PHONY: install install-local
1
+ .PHONY: install install-latest install-pinned install-local
2
2
 
3
3
  VERSION := $(shell sed -n 's/^version = "\(.*\)"$$/\1/p' pyproject.toml)
4
4
  ZSH_PLUGINS ?= $(or $(ZDOTDIR),$(HOME))/.zsh_plugins.txt
5
5
 
6
+ install: install-latest
7
+
8
+ # The newest published CLI and the shell plugin from the default branch,
9
+ # none of them pinned, so `uv tool upgrade`, `fisher update` and
10
+ # `antidote update` move each one on.
11
+ install-latest:
12
+ $(call cli,git-worktrees)
13
+ $(call fish_plugin,MihaiBojin/worktrees)
14
+ $(call zsh_plugin,MihaiBojin/worktrees path:zsh/plugins/worktrees)
15
+
16
+ # This version as published: the CLI from PyPI and the shell plugin from
17
+ # GitHub at its tag, so the two match. An update leaves all three where
18
+ # they are.
19
+ install-pinned:
20
+ $(call cli,git-worktrees==$(VERSION))
21
+ $(call fish_plugin,MihaiBojin/worktrees@v$(VERSION))
22
+ $(call zsh_plugin,MihaiBojin/worktrees branch:v$(VERSION) path:zsh/plugins/worktrees)
23
+
6
24
  # The working copy, in place of anything published: the CLI from this
7
25
  # checkout, and Fisher and Antidote pointed at it. Run it again after a
8
26
  # change here, since uv and Fisher copy the files at install.
9
27
  install-local:
10
- uv tool install --force --from . git-worktrees
28
+ $(call cli,--from . git-worktrees)
11
29
  $(call fish_plugin,$(CURDIR))
12
30
  $(call zsh_plugin,$(CURDIR)/zsh/plugins/worktrees)
13
31
 
14
- # This version as published, in place of anything else: the CLI from PyPI
15
- # and the shell plugin from GitHub at its tag, so the two match. The
16
- # Antidote clone goes first, so the next shell clones it at that tag.
17
- install:
18
- uv tool install --force git-worktrees==$(VERSION)
19
- $(call fish_plugin,MihaiBojin/worktrees@v$(VERSION))
20
- -command -v zsh >/dev/null && test -f "$(ZSH_PLUGINS)" && \
21
- zsh -ic 'antidote purge MihaiBojin/worktrees' </dev/null
22
- $(call zsh_plugin,MihaiBojin/worktrees branch:v$(VERSION) path:zsh/plugins/worktrees)
32
+ # Uninstalls the CLI, if it is there, then installs $(1).
33
+ define cli
34
+ -uv tool uninstall git-worktrees
35
+ uv tool install $(1)
36
+ endef
23
37
 
24
38
  # Removes every installed copy of this plugin, published or local, then
25
39
  # installs $(1). Skipped where fish or Fisher is missing. Fisher reads
@@ -36,10 +50,16 @@ define fish_plugin
36
50
  fi
37
51
  endef
38
52
 
39
- # Replaces this plugin's line in zsh_plugins.txt, published or local, with
40
- # $(1), or appends it. Writes through cat, so a symlinked file stays one.
53
+ # Purges Antidote's clone of the published plugin, then replaces this
54
+ # plugin's line in zsh_plugins.txt, published or local, with $(1), or
55
+ # appends it. The clone goes first, since Antidote checks a branch or tag
56
+ # out only when it clones, and the next shell clones it anew. Writes
57
+ # through cat, so a symlinked file stays one.
41
58
  define zsh_plugin
42
59
  if test -f "$(ZSH_PLUGINS)"; then \
60
+ if command -v zsh >/dev/null; then \
61
+ zsh -ic 'antidote purge MihaiBojin/worktrees' </dev/null || true; \
62
+ fi; \
43
63
  awk -v entry='$(1)' ' \
44
64
  tolower($$1) == "mihaibojin/worktrees" || $$1 ~ /\/zsh\/plugins\/worktrees$$/ { \
45
65
  if (!done) print entry; done = 1; next \
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: git-worktrees
3
- Version: 0.12.1
3
+ Version: 0.12.3
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
@@ -104,7 +104,7 @@ the plugin's tag to the same release, as each manager below describes.
104
104
  ### fish
105
105
 
106
106
  ```console
107
- fisher install MihaiBojin/worktrees@v0.12.1
107
+ fisher install MihaiBojin/worktrees@v0.12.3
108
108
  ```
109
109
 
110
110
  Fisher copies `functions/`, `completions/` and `conf.d/` from the repository
@@ -121,7 +121,7 @@ the untagged one holds the files.
121
121
  Antidote takes a `path:` into the repository, and `branch:` takes a tag:
122
122
 
123
123
  ```
124
- MihaiBojin/worktrees branch:v0.12.1 path:zsh/plugins/worktrees # in zsh_plugins.txt
124
+ MihaiBojin/worktrees branch:v0.12.3 path:zsh/plugins/worktrees # in zsh_plugins.txt
125
125
  ```
126
126
 
127
127
  The plugin puts its own `functions/` and `completions/` on `fpath` and
@@ -196,8 +196,8 @@ its stdout stays the version alone for a script to read.
196
196
  An excerpt of `gw --help`'s release lines with matching CLI and shell releases:
197
197
 
198
198
  ```console
199
- worktrees 0.12.1: git worktree commands that refuse to lose work
200
- The shell plugin here is 0.12.1, the same release as these commands.
199
+ worktrees 0.12.3: git worktree commands that refuse to lose work
200
+ The shell plugin here is 0.12.3, the same release as these commands.
201
201
  ```
202
202
 
203
203
  A shell without the variable has no plugin loaded, or one older than the
@@ -708,9 +708,11 @@ asking, and add the permission rules shipping needs to Claude Code's
708
708
  settings.
709
709
 
710
710
  The skills handle branches, pull requests and merges in the checkout the
711
- session runs in, and never create a worktree. Creating and choosing
712
- worktrees is for a person, through `gw add` and `gw list`, or for the
713
- agent's client, as `claude --worktree` and `codex --worktree` do.
711
+ session runs in, and never create a worktree. A person creates and
712
+ chooses worktrees through `gw add` and `gw list`, and the agent's client
713
+ through `claude --worktree` and `codex --worktree`. A Claude Code session
714
+ keeps one worktree per repository and runs `gw add` itself only where it
715
+ has none yet, or when another session is working in the one it has.
714
716
 
715
717
  ## Contributing
716
718
 
@@ -77,7 +77,7 @@ the plugin's tag to the same release, as each manager below describes.
77
77
  ### fish
78
78
 
79
79
  ```console
80
- fisher install MihaiBojin/worktrees@v0.12.1
80
+ fisher install MihaiBojin/worktrees@v0.12.3
81
81
  ```
82
82
 
83
83
  Fisher copies `functions/`, `completions/` and `conf.d/` from the repository
@@ -94,7 +94,7 @@ the untagged one holds the files.
94
94
  Antidote takes a `path:` into the repository, and `branch:` takes a tag:
95
95
 
96
96
  ```
97
- MihaiBojin/worktrees branch:v0.12.1 path:zsh/plugins/worktrees # in zsh_plugins.txt
97
+ MihaiBojin/worktrees branch:v0.12.3 path:zsh/plugins/worktrees # in zsh_plugins.txt
98
98
  ```
99
99
 
100
100
  The plugin puts its own `functions/` and `completions/` on `fpath` and
@@ -169,8 +169,8 @@ its stdout stays the version alone for a script to read.
169
169
  An excerpt of `gw --help`'s release lines with matching CLI and shell releases:
170
170
 
171
171
  ```console
172
- worktrees 0.12.1: git worktree commands that refuse to lose work
173
- The shell plugin here is 0.12.1, the same release as these commands.
172
+ worktrees 0.12.3: git worktree commands that refuse to lose work
173
+ The shell plugin here is 0.12.3, the same release as these commands.
174
174
  ```
175
175
 
176
176
  A shell without the variable has no plugin loaded, or one older than the
@@ -681,9 +681,11 @@ asking, and add the permission rules shipping needs to Claude Code's
681
681
  settings.
682
682
 
683
683
  The skills handle branches, pull requests and merges in the checkout the
684
- session runs in, and never create a worktree. Creating and choosing
685
- worktrees is for a person, through `gw add` and `gw list`, or for the
686
- agent's client, as `claude --worktree` and `codex --worktree` do.
684
+ session runs in, and never create a worktree. A person creates and
685
+ chooses worktrees through `gw add` and `gw list`, and the agent's client
686
+ through `claude --worktree` and `codex --worktree`. A Claude Code session
687
+ keeps one worktree per repository and runs `gw add` itself only where it
688
+ has none yet, or when another session is working in the one it has.
687
689
 
688
690
  ## Contributing
689
691
 
@@ -4,4 +4,4 @@
4
4
  # The release this plugin came from, which `gw --help` 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.12.1
7
+ set -gx WORKTREES_PLUGIN_VERSION 0.12.3
@@ -71,20 +71,31 @@ interpreter comes from uv. [docs/BENCHMARK.md](BENCHMARK.md) is the last run.
71
71
  ## Working on a checkout
72
72
 
73
73
  ```console
74
- make install-local # this checkout's CLI and shell plugin
75
- make install # this version as published: the CLI and the shell plugin
74
+ make install # same as install-latest
75
+ make install-latest # the newest CLI and the shell plugin from the default branch
76
+ make install-pinned # this version as published: the CLI and the shell plugin
77
+ make install-local # this checkout's CLI and shell plugin
76
78
  ```
77
79
 
80
+ Each target first uninstalls the CLI and removes every copy of the shell
81
+ plugin, published or local, then installs its own.
82
+
83
+ `make install-latest` installs the newest `git-worktrees` from PyPI and the
84
+ shell plugin from GitHub's default branch, neither pinned, so
85
+ `uv tool upgrade git-worktrees`, `fisher update` and `antidote update` move
86
+ them forward. The default branch can hold plugin changes that no release
87
+ has yet, and `gw version` does not see them: both report the last release.
88
+
89
+ `make install-pinned` installs the release `pyproject.toml` names, from
90
+ PyPI, and the shell plugin from GitHub at that release's tag, so the CLI and
91
+ the plugin match. An update leaves all three where they are; run the target
92
+ again from a newer checkout to move them.
93
+
78
94
  `make install-local` installs the working copy in place of anything
79
95
  published. `gw` on your `$PATH` is the code in front of you, and Fisher and
80
96
  Antidote load the shell plugin from this checkout. Run it again after a
81
97
  change, since uv and Fisher copy the files at install.
82
98
 
83
- `make install` undoes it: the release `pyproject.toml` names, from PyPI,
84
- and the shell plugin from GitHub at that release's tag, so the CLI and the
85
- plugin match. A command only the working copy has, such as one renamed since that
86
- release, leaves `~/.local/bin` with it.
87
-
88
99
  The fish half is skipped where fish or Fisher is missing, and the zsh half
89
100
  where Antidote's list is: `$ZDOTDIR/.zsh_plugins.txt`, else
90
101
  `~/.zsh_plugins.txt`, or the file `ZSH_PLUGINS=` names.
@@ -50,6 +50,8 @@ movement.
50
50
 
51
51
  An unchanged head needs fresh checks with `checksState: passed`, an open
52
52
  review that is ready, and merge state `CLEAN`, `HAS_HOOKS` or `UNSTABLE`.
53
+ A review with no checks at all merges on those last two: a repository
54
+ without CI has nothing to wait for.
53
55
  The command reads membership and containment again immediately before
54
56
  submission and refuses changes between those reads. This containment check
55
57
  blocks submission during GitHub's retarget-before-rewrite interval. The API
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "worktrees",
3
- "version": "0.12.1",
3
+ "version": "0.12.3",
4
4
  "description": "Read CI, rebase onto the head branch, describe, ship and merge pull requests, and prune finished worktrees through the worktrees CLI",
5
5
  "author": {
6
6
  "name": "Mihai Bojin",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "worktrees",
3
- "version": "0.12.1",
3
+ "version": "0.12.3",
4
4
  "description": "Read CI, rebase onto the head branch, describe, ship and merge pull requests, and prune finished worktrees through the worktrees CLI",
5
5
  "author": {
6
6
  "name": "Mihai Bojin",
@@ -25,9 +25,14 @@ the next with `gw branch create` or `git switch --create`, and ship several at o
25
25
  `ship-it BRANCH ...`, which switches the worktree to each in turn.
26
26
 
27
27
  A hook in each client hands every session [these rules](session.md) when it
28
- starts. Before editing, the session checks whether another one is working
29
- in its worktree, from uncommitted changes it did not make or another
30
- process's lock, and moves to a new worktree when one is. The hook needs
28
+ starts. A session keeps one worktree per repository and works on one
29
+ branch at a time in it, starting the next branch there even while the last
30
+ one's pull request waits. It creates a worktree only in a repository where
31
+ it has none before its first change there, or when another session is
32
+ working in its own: uncommitted changes it did not make, or another
33
+ process's lock. In Claude Code it makes one with `EnterWorktree` or
34
+ `gw add`; in Codex it asks for a session started with `codex --worktree`.
35
+ The hook needs
31
36
  `jq`, and Codex asks you to review and trust it before it runs.
32
37
 
33
38
  ## Install
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
3
3
  "name": "worktrees",
4
- "version": "0.12.1",
4
+ "version": "0.12.3",
5
5
  "description": "Read CI, rebase onto the head branch, describe, ship and merge pull requests, and prune finished worktrees through the worktrees CLI",
6
6
  "author": {
7
7
  "name": "Mihai Bojin",
@@ -0,0 +1,45 @@
1
+ # How this session uses worktrees
2
+
3
+ The worktrees plugin hands every session these rules when it starts.
4
+
5
+ - This session keeps one worktree per repository and works on one branch at
6
+ a time in it. In the repository it starts in, that is the worktree it
7
+ starts in, unless that is the main checkout, which stays on the head
8
+ branch. In any repository where it has none, it creates one before its
9
+ first change there and keeps it for every later branch.
10
+ - Branches follow one another in that worktree. Commit and push a branch,
11
+ then start the next with `gw branch create NAME`, even while its pull
12
+ request waits on a review or a merge: switching a branch is much faster
13
+ than creating a worktree, and `git switch --no-guess BRANCH` goes back to
14
+ fix it. A branch that builds on work not merged yet starts from it:
15
+ `git switch --create NAME` while on that branch.
16
+ `/worktrees:ship-it BRANCH ...` ships several, switching to each in turn.
17
+ - When a change the user decided on is implemented and its tests and checks
18
+ pass, ship it without being asked: `/worktrees:ship-it` commits it on its
19
+ own branch, pushes it, opens the pull request, fixes CI and merges it once
20
+ it is ready.
21
+ - Check that no other session is working here before editing, and again
22
+ whenever changes appear that this session did not make. The worktree is
23
+ in use when `git status --short` shows changes this session did not make
24
+ and the user did not ask it to continue, or when
25
+ `git worktree list --porcelain` shows it `locked` by another process.
26
+ Then do not wait, and do not commit, stash or discard those changes:
27
+ create another worktree, run `git switch --create NEW BRANCH` there from
28
+ this worktree's branch, and decide when shipping whether NEW stacks on it.
29
+ - To create a worktree in the repository this session started in, in
30
+ Claude Code, call `EnterWorktree` with a `name`. Anywhere else, run
31
+ `command gw add NAME --quiet` from a checkout of the repository; it
32
+ prints the new worktree's path. Claude Code refuses git aimed outside a
33
+ worktree that `EnterWorktree` opened, and refuses to open a second, so
34
+ leave it first with `ExitWorktree` and `keep`. Its shell returns to the
35
+ start folder after a command that leaves the working directories, so give
36
+ each command the path in full. In Codex, whose sandbox keeps `.git`
37
+ read-only, report it and say to start a session there with
38
+ `codex --worktree`.
39
+ - A subagent that writes gets its own worktree (`isolation: "worktree"`).
40
+ Commit before starting it, and have it start its branch with
41
+ `git switch --create NAME PARENT_BRANCH`, since its worktree starts from
42
+ the default branch.
43
+ - Leave a worktree with `keep`. `gw prune` removes finished ones and lists
44
+ what it deletes first; `ExitWorktree` removal deletes ignored files without
45
+ asking. Never remove or switch another session's worktree.
@@ -291,9 +291,10 @@ Then wait for CI:
291
291
  gw ci-checks NUMBER --wait --json
292
292
  ```
293
293
 
294
- `passed` goes to step 8. `blocked`, or an `unknown` that stays, is a
295
- blocker: a manual job or missing CI is for a person to decide. `failed` is
296
- fixed, below.
294
+ `passed` goes to step 8, and so does an empty `checks` list once the wait
295
+ returns: a review with no CI ships on the request to ship it. `blocked`, or
296
+ an `unknown` with checks in it, is a blocker: a manual job is for a person
297
+ to decide. `failed` is fixed, below.
297
298
 
298
299
  ### Fixing a failure
299
300
 
@@ -342,7 +343,8 @@ it out yet, which is usual just after a push: read again a minute later,
342
343
  never merge on it, and report it only when it stays.
343
344
 
344
345
  Always squash on GitHub and GitLab. Require `stale: false`,
345
- `checksState: passed` and a non-null `pr.trailers` in that fresh snapshot.
346
+ `checksState: passed` or an empty `checks` list, and a non-null
347
+ `pr.trailers` in that fresh snapshot.
346
348
  Null trailers mean the complete commit list was unavailable: stop and
347
349
  report it. An empty array means the commits have no trailers.
348
350
 
@@ -411,8 +413,8 @@ On the first `head-moved` for this PR, record that its one retry is in use.
411
413
  gw ci-checks NUMBER --wait --json
412
414
  ```
413
415
 
414
- Require `pr.headSha` to equal `NEW_SHA`, `checksState` to be `passed`,
415
- `stale` to be false and `pr.trailers` to be non-null. A different head is
416
+ Require `pr.headSha` to equal `NEW_SHA`, `checksState` to be `passed` or
417
+ `checks` to be empty, `stale` to be false and `pr.trailers` to be non-null. A different head is
416
418
  another movement: stop and report it. Repeat steps 8 and 9 using that
417
419
  completed wait as step 9's fresh snapshot, including its merge-state check.
418
420
  Rebuild the message with that snapshot's `pr.trailers`, then call `gw merge`
@@ -47,10 +47,15 @@ prefix_rule(
47
47
  justification="ship-it starts a branch",
48
48
  )
49
49
  prefix_rule(
50
- pattern=["gw", ["fast-forward", "ci-checks"]],
50
+ pattern=["gw", ["sync", "fast-forward", "ci-checks"]],
51
51
  decision="allow",
52
52
  justification="ship-it fetches, rebases and reads CI",
53
53
  )
54
+ prefix_rule(
55
+ pattern=["git", "switch", ["--create", "--no-guess"]],
56
+ decision="allow",
57
+ justification="ship-it starts a branch or moves to a named one",
58
+ )
54
59
  prefix_rule(
55
60
  pattern=["git", ["add", "commit"]],
56
61
  decision="allow",
@@ -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.12.1"
12
+ version = "0.12.3"
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.
@@ -249,7 +249,11 @@ def _ready(snapshot: dict, sha: str) -> None:
249
249
  raise Refused(f"#{pr['number']} head changed from {sha}; read its CI again")
250
250
  if pr["state"] != "OPEN" or pr["draft"]:
251
251
  raise Refused(f"#{pr['number']} is not an open, ready pull request")
252
- if snapshot["stale"] or snapshot["checksState"] != "passed":
252
+ # A review with no checks at all has no CI to wait for: the caller's
253
+ # request to merge is the decision.
254
+ if snapshot["stale"] or (
255
+ snapshot["checks"] and snapshot["checksState"] != "passed"
256
+ ):
253
257
  raise Refused(
254
258
  f"#{pr['number']} checks are {snapshot['checksState']}; merge not submitted"
255
259
  )
@@ -522,6 +522,46 @@ def _codex_rules() -> list[dict]:
522
522
  return rules
523
523
 
524
524
 
525
+ def _codex_allows(command: str) -> bool:
526
+ words = shlex.split(command)
527
+ return any(
528
+ rule["decision"] == "allow"
529
+ and len(words) >= len(rule["pattern"])
530
+ and all(
531
+ word in part if isinstance(part, list) else word == part
532
+ for word, part in zip(words, rule["pattern"], strict=False)
533
+ )
534
+ for rule in _codex_rules()
535
+ )
536
+
537
+
538
+ @pytest.mark.parametrize(
539
+ "command",
540
+ [
541
+ "gw sync",
542
+ "gw fast-forward --autostash --json",
543
+ "gw branch create fix-parser --json",
544
+ "git switch --create fix-parser",
545
+ "git switch --no-guess fix-parser",
546
+ "git commit -m subject",
547
+ "git push --set-upstream origin fix-parser",
548
+ "gw merge 41 --subject s --body-file f --match-head-commit x --json",
549
+ ],
550
+ )
551
+ def test_codex_rules_cover_what_ship_it_writes_or_fetches(command: str) -> None:
552
+ """Codex has no per-skill pre-approval, and its sandbox keeps `.git`
553
+ read-only and offline, so each command that writes a ref or reaches the
554
+ remote needs a rule."""
555
+ assert _codex_allows(command), command
556
+
557
+
558
+ @pytest.mark.parametrize(
559
+ "command", ["git switch main", "git switch -", "gw prune --yes"]
560
+ )
561
+ def test_codex_rules_refuse_what_ship_it_never_runs(command: str) -> None:
562
+ assert not _codex_allows(command), command
563
+
564
+
525
565
  def test_codex_merge_rule_allows_only_the_merge_command() -> None:
526
566
  rules = _codex_rules()
527
567
  merge = [rule for rule in rules if rule["pattern"] == ["gw", "merge"]]
@@ -11,7 +11,7 @@ from pathlib import Path
11
11
  import pytest
12
12
  from conftest import argv
13
13
  from test_branches import cli
14
- from test_ci import BASE, HEAD, MERGE, _pr
14
+ from test_ci import BASE, HEAD, MERGE, _check, _pr
15
15
  from test_sync import origin
16
16
 
17
17
  PR = "repos/owner/repo/pulls/7"
@@ -209,7 +209,8 @@ def test_changed_pr_refuses_before_submission(world, github, changed) -> None:
209
209
  _pr(state="CLOSED"),
210
210
  _pr(isDraft=True),
211
211
  _pr(mergeStateStatus="UNKNOWN"),
212
- _pr(statusCheckRollup=[]),
212
+ _pr(statusCheckRollup=[_check(conclusion="FAILURE")]),
213
+ _pr(statusCheckRollup=[_check(status="IN_PROGRESS", conclusion="")]),
213
214
  ],
214
215
  )
215
216
  def test_requires_ready_ci_at_the_supplied_head(world, github, snapshot) -> None:
@@ -219,6 +220,16 @@ def test_requires_ready_ci_at_the_supplied_head(world, github, snapshot) -> None
219
220
  assert not writes(github)
220
221
 
221
222
 
223
+ def test_a_review_without_checks_merges(world, github) -> None:
224
+ github.answer(
225
+ {"$view": _pr(statusCheckRollup=[]), "$api": {PR: pull(), ASYNC: merged()}}
226
+ )
227
+ proc = run(world, github)
228
+ assert proc.returncode == 0, proc.stderr
229
+ assert json.loads(proc.stdout)["status"] == "merged"
230
+ assert writes(github)
231
+
232
+
222
233
  @pytest.mark.parametrize(
223
234
  "response,expected,code",
224
235
  [
@@ -49,7 +49,7 @@ wheels = [
49
49
 
50
50
  [[package]]
51
51
  name = "git-worktrees"
52
- version = "0.12.1"
52
+ version = "0.12.3"
53
53
  source = { editable = "." }
54
54
 
55
55
  [package.optional-dependencies]
@@ -12,4 +12,4 @@ autoload -Uz gw gwa gwbc gwbp gwbs gwff gwl gwm gwp 'gwp!' gwpa 'gwpa!' gwr 'gwr
12
12
  # The release this plugin came from, which `gw --help` and `gw version` compare
13
13
  # with their own. Exported, because the environment is all a binary can see
14
14
  # of the shell that started it.
15
- export WORKTREES_PLUGIN_VERSION=0.12.1
15
+ export WORKTREES_PLUGIN_VERSION=0.12.3
@@ -1,32 +0,0 @@
1
- # How this session uses worktrees
2
-
3
- The worktrees plugin hands every session these rules when it starts.
4
-
5
- - This session works in the worktree it starts in, and owns it. The client
6
- creates worktrees: `claude --worktree NAME` or the `EnterWorktree` tool
7
- with a `name` in Claude Code, `codex --worktree` in Codex. A person may
8
- create one with `gw add` before the session starts. Never run
9
- `git worktree add` or `gw add` yourself.
10
- - One worktree holds one branch after another. Ship a branch, then start the
11
- next with `gw branch create NAME`. A branch that builds on work not merged
12
- yet starts from it: `git switch --create NAME` while on that branch.
13
- `/worktrees:ship-it BRANCH ...` ships several, switching to each in turn.
14
- - When a change the user decided on is implemented and its tests and checks
15
- pass, ship it without being asked: `/worktrees:ship-it` commits it on its
16
- own branch, pushes it, opens the pull request, fixes CI and merges it once
17
- it is ready.
18
- - Before editing, check that no other session is working here. The
19
- worktree is in use when `git status --short` shows changes this session
20
- did not make and the user did not ask it to continue, or when
21
- `git worktree list --porcelain` shows it `locked` by another process.
22
- Then do not wait. In Claude Code, call `EnterWorktree` with a `name`, run
23
- `git switch --create NEW BRANCH` there from this worktree's branch, and
24
- decide when shipping whether NEW stacks on it. In Codex, report it and
25
- say to start a new session with `codex --worktree`.
26
- - A subagent that writes gets its own worktree (`isolation: "worktree"`).
27
- Commit before starting it, and have it start its branch with
28
- `git switch --create NAME PARENT_BRANCH`, since its worktree starts from
29
- the default branch.
30
- - Leave a worktree with `keep`. `gw prune` removes finished ones and lists
31
- what it deletes first; `ExitWorktree` removal deletes ignored files without
32
- asking.
File without changes