git-worktrees 0.13.0__tar.gz → 0.13.2__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.
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/AGENTS.md +22 -12
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/CHANGELOG.md +32 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/PKG-INFO +10 -7
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/README.md +9 -6
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/conf.d/worktrees.fish +1 -1
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/docs/commands/merge.md +14 -11
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/docs/commands/preflight.md +15 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/docs/commands/push.md +6 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/plugin/.claude-plugin/plugin.json +1 -1
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/plugin/.codex-plugin/plugin.json +1 -1
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/plugin/plugin.json +1 -1
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/plugin/skills/preflight/SKILL.md +81 -24
- git_worktrees-0.13.2/plugin/skills/preflight/merge_codex_rules.py +62 -0
- git_worktrees-0.13.2/plugin/skills/preflight/worktrees.rules +70 -0
- git_worktrees-0.13.2/plugin/skills/ship-it/rights.md +89 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/pyproject.toml +1 -1
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/src/worktrees/pr_merge.py +21 -16
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/src/worktrees/push.py +4 -2
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/tests/test_plugin.py +156 -12
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/tests/test_pr_merge.py +61 -4
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/tests/test_push.py +98 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/uv.lock +1 -1
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/zsh/plugins/worktrees/worktrees.plugin.zsh +1 -1
- git_worktrees-0.13.0/plugin/skills/ship-it/rights.md +0 -123
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/.claude/settings.json +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/.codex/config.toml +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/.github/workflows/codeql.yml +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/.github/workflows/publish.yml +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/.github/workflows/testpypi.yml +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/.github/workflows/tests.yml +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/.gitignore +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/.pre-commit-config.yaml +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/.python-version +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/.releasetools.yaml +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/LICENSE +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/Makefile +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/completions/gw.fish +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/completions/worktrees.fish +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/docs/BENCHMARK.md +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/docs/DEVELOPMENT.md +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/docs/REFERENCE.md +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/docs/commands/add.md +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/docs/commands/branch-create.md +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/docs/commands/branch-prune.md +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/docs/commands/branch-status.md +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/docs/commands/ci-checks.md +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/docs/commands/fast-forward.md +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/docs/commands/list.md +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/docs/commands/stack-link.md +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/docs/plans/2026-11-05-worktree-pruning-design.md +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/functions/gw.fish +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/functions/gwa.fish +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/functions/gwbc.fish +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/functions/gwbp.fish +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/functions/gwbs.fish +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/functions/gwff.fish +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/functions/gwl.fish +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/functions/gwm.fish +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/functions/gwp!.fish +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/functions/gwp.fish +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/functions/gwpa!.fish +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/functions/gwpa.fish +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/functions/gwpu.fish +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/functions/gwr!.fish +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/functions/gwr.fish +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/functions/gwrk!.fish +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/functions/gws.fish +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/hatch_build.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/plugin/README.md +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/plugin/hooks/codex.json +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/plugin/hooks/hooks.json +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/plugin/session.md +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/plugin/skills/ci-checks/SKILL.md +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/plugin/skills/describe-pr/SKILL.md +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/plugin/skills/describe-pr/format.md +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/plugin/skills/fast-forward/SKILL.md +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/plugin/skills/preflight/agents/openai.yaml +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/plugin/skills/preflight/config.toml +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/plugin/skills/preflight/project.json +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/plugin/skills/preflight/rules.json +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/plugin/skills/prune/SKILL.md +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/plugin/skills/ship-it/SKILL.md +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/renovate.json +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/scripts/README.md +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/scripts/benchmark.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/scripts/bump_version.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/scripts/verify-publish.bash +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/src/worktrees/__init__.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/src/worktrees/audit.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/src/worktrees/branch_cli.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/src/worktrees/branch_forge.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/src/worktrees/branches.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/src/worktrees/ci.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/src/worktrees/cli.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/src/worktrees/errors.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/src/worktrees/fast_forward.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/src/worktrees/forge.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/src/worktrees/git.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/src/worktrees/layout.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/src/worktrees/merged.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/src/worktrees/new_branch.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/src/worktrees/pick.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/src/worktrees/preflight.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/src/worktrees/progress.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/src/worktrees/prune.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/src/worktrees/render.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/src/worktrees/repo.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/src/worktrees/stack_link.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/src/worktrees/sync.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/src/worktrees/verdicts.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/src/worktrees/worktree.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/tests/audit_schema.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/tests/conftest.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/tests/test_assessment.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/tests/test_audit.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/tests/test_benchmark.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/tests/test_branch_forge.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/tests/test_branches.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/tests/test_ci.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/tests/test_cli.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/tests/test_command_defaults.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/tests/test_completions.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/tests/test_fast_forward.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/tests/test_fixture.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/tests/test_forge.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/tests/test_gates.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/tests/test_git_records.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/tests/test_new_branch.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/tests/test_partial_clone.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/tests/test_path_boundaries.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/tests/test_preflight.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/tests/test_removal.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/tests/test_render.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/tests/test_shims.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/tests/test_spec.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/tests/test_stack_link.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/tests/test_sync.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/tests/test_version.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/tests/test_worktree.py +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/zsh/plugins/worktrees/completions/_gw +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/zsh/plugins/worktrees/functions/gw +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/zsh/plugins/worktrees/functions/gwa +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/zsh/plugins/worktrees/functions/gwbc +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/zsh/plugins/worktrees/functions/gwbp +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/zsh/plugins/worktrees/functions/gwbs +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/zsh/plugins/worktrees/functions/gwff +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/zsh/plugins/worktrees/functions/gwl +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/zsh/plugins/worktrees/functions/gwm +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/zsh/plugins/worktrees/functions/gwp +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/zsh/plugins/worktrees/functions/gwp! +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/zsh/plugins/worktrees/functions/gwpa +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/zsh/plugins/worktrees/functions/gwpa! +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/zsh/plugins/worktrees/functions/gwpu +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/zsh/plugins/worktrees/functions/gwr +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/zsh/plugins/worktrees/functions/gwr! +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/zsh/plugins/worktrees/functions/gwrk! +0 -0
- {git_worktrees-0.13.0 → git_worktrees-0.13.2}/zsh/plugins/worktrees/functions/gws +0 -0
|
@@ -173,11 +173,12 @@ checked out: `--set-upstream` when the remote lacks it, otherwise
|
|
|
173
173
|
`--force-with-lease=refs/heads/BRANCH:SHA` on the sha the fetch read.
|
|
174
174
|
Two checks come first. `push.only_there` lists the remote copy's commits
|
|
175
175
|
that neither the branch nor the head ref holds by sha or patch-id, outside
|
|
176
|
-
the copy's own `merged.merged_part
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
176
|
+
the copy's own `merged.merged_part`. A merge or an empty commit has no
|
|
177
|
+
patch-id in this comparison and stays in that list without another proof.
|
|
178
|
+
Any that `push.made_here` does not find through the branch's reflog is a
|
|
179
|
+
refusal that `--replace` lifts. `merged.merged_part` of the branch itself,
|
|
180
|
+
the commits the head ref already has by the proofs `gw prune` reads, is a
|
|
181
|
+
refusal nothing lifts, and names `gw fast-forward`. `--force-if-includes` is not passed: git
|
|
181
182
|
ignores it beside an explicit lease, and the first check asks what it
|
|
182
183
|
would. [Push](docs/commands/push.md) has the outputs.
|
|
183
184
|
|
|
@@ -246,7 +247,7 @@ assumes a plugin root or a checkout at a known path.
|
|
|
246
247
|
| `describe-pr` | checks a review's title and body against its diff, and edits them |
|
|
247
248
|
| `prune` | `gw prune --json` and `gw branch status --json`, then the removals approved |
|
|
248
249
|
| `ship-it` | commits, `fast-forward`, `gw push`, `gh pr create`, `gw stack-link` for a stacked branch on GitHub, `describe-pr`, `ci-checks`, fixes on the branch, `gw merge` on GitHub or `glab mr merge` on GitLab, then `fast-forward` in the head branch's checkout, unassisted, for this checkout or each branch it is named; given numbers, those open reviews from `ci-checks` on |
|
|
249
|
-
| `preflight` | `gw preflight --json`, then, after asking,
|
|
250
|
+
| `preflight` | `gw preflight --json`, then, after asking, installs the current client's permission rules at user or project scope; project scope also writes the plugin setup in `.claude/settings.json` and `.codex/config.toml` |
|
|
250
251
|
|
|
251
252
|
`describe-pr` and `ship-it` share `describe-pr/format.md`: the
|
|
252
253
|
review's title and body are the squash commit's subject and body, so one set
|
|
@@ -266,15 +267,24 @@ reruns CI and merges, as its own test lists. None pre-approves a removal.
|
|
|
266
267
|
A plugin cannot grant a skill more than the turn that invoked it in Claude
|
|
267
268
|
Code, and nothing at all in Codex, so `ship-it/rights.md` lists the rules a
|
|
268
269
|
user adds to their own client configuration, and the skill checks for them
|
|
269
|
-
before it starts.
|
|
270
|
-
|
|
270
|
+
before it starts. Claude Code's rules live in `preflight/rules.json`;
|
|
271
|
+
Codex's live in `preflight/worktrees.rules`. The preflight skill merges
|
|
272
|
+
rules into the selected client's user or project file. For Codex,
|
|
273
|
+
`merge_codex_rules.py` prints a candidate with missing literal rules
|
|
274
|
+
appended, and `codex execpolicy check` validates it before approval and
|
|
275
|
+
copying. Existing rules remain; another run appends nothing. The CLI's
|
|
276
|
+
`codex` check covers plugin configuration, so the skill checks permission
|
|
277
|
+
rules even when that check passes. It runs only
|
|
271
278
|
when called by name, in both clients, and pre-approves no write, so the copy
|
|
272
279
|
over the settings file reaches the client's own prompt. Its allow patterns match prefixes, so a test holds the
|
|
273
280
|
skill's commands to never writing `--force`, `--admin`, `--auto`,
|
|
274
|
-
`--delete-branch` or `--replace`.
|
|
275
|
-
`
|
|
276
|
-
|
|
277
|
-
|
|
281
|
+
`--delete-branch` or `--replace`. Both clients deny direct `git rebase`,
|
|
282
|
+
`gh pr merge` and `gh stack merge` commands. Claude Code denies the forced
|
|
283
|
+
push forms in `preflight/rules.json` and `gh api` calls that name a merge;
|
|
284
|
+
Codex denies every direct `git push` and `gh api` command, regardless of
|
|
285
|
+
trailing arguments.
|
|
286
|
+
`rights.md` names the limits of prefix rules. A Claude Code deny rule
|
|
287
|
+
matches past a leading assignment, so the conflict loop
|
|
278
288
|
continues a rebase with `gw fast-forward --continue`.
|
|
279
289
|
`tests/test_preflight.py` holds `project.json` and `config.toml` to the
|
|
280
290
|
setup `preflight.py` checks for.
|
|
@@ -17,6 +17,38 @@ 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.13.2 - 2026-11-22
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
|
|
24
|
+
Single-PR `gw merge` commands preserve commit trailers, including agent
|
|
25
|
+
session IDs, when `--body-file` is omitted. An omitted subject uses the
|
|
26
|
+
pull request title with its number. Explicit message fields remain
|
|
27
|
+
unchanged.
|
|
28
|
+
|
|
29
|
+
Without a complete commit list, provide `--body-file`; otherwise the
|
|
30
|
+
command refuses at exit 3. It also refuses existing asynchronous merges
|
|
31
|
+
whose commit message cannot be verified.
|
|
32
|
+
|
|
33
|
+
## 0.13.1 - 2026-11-21
|
|
34
|
+
|
|
35
|
+
### Fixed
|
|
36
|
+
|
|
37
|
+
`gw push` checks remote merge and empty commits before replacing a
|
|
38
|
+
remote branch. A commit that the local branch and head do not account
|
|
39
|
+
for causes a `remote-only` refusal. Review the listed commits before
|
|
40
|
+
using `--replace`.
|
|
41
|
+
|
|
42
|
+
The supplied Codex rules deny direct `git push` and `gh api` commands
|
|
43
|
+
with any trailing arguments, including tag pushes and API reads.
|
|
44
|
+
Install the updated rules from `ship-it/rights.md` and restart Codex.
|
|
45
|
+
|
|
46
|
+
In Codex, `/worktrees:preflight user` installs Worktrees permission rules
|
|
47
|
+
in the user's Codex rules directory, and `/worktrees:preflight project`
|
|
48
|
+
uses the project's `.codex/rules/worktrees.rules`. Existing rules remain
|
|
49
|
+
in place. The skill validates and shows the additions before asking to
|
|
50
|
+
install them. Restart Codex after installation.
|
|
51
|
+
|
|
20
52
|
## 0.13.0 - 2026-11-21
|
|
21
53
|
|
|
22
54
|
### Added
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: git-worktrees
|
|
3
|
-
Version: 0.13.
|
|
3
|
+
Version: 0.13.2
|
|
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
|
|
@@ -108,7 +108,7 @@ the plugin's tag to the same release, as each manager below describes.
|
|
|
108
108
|
### fish
|
|
109
109
|
|
|
110
110
|
```console
|
|
111
|
-
fisher install MihaiBojin/worktrees@v0.13.
|
|
111
|
+
fisher install MihaiBojin/worktrees@v0.13.2
|
|
112
112
|
```
|
|
113
113
|
|
|
114
114
|
Fisher copies `functions/`, `completions/` and `conf.d/` from the repository
|
|
@@ -125,7 +125,7 @@ the untagged one holds the files.
|
|
|
125
125
|
Antidote takes a `path:` into the repository, and `branch:` takes a tag:
|
|
126
126
|
|
|
127
127
|
```
|
|
128
|
-
MihaiBojin/worktrees branch:v0.13.
|
|
128
|
+
MihaiBojin/worktrees branch:v0.13.2 path:zsh/plugins/worktrees # in zsh_plugins.txt
|
|
129
129
|
```
|
|
130
130
|
|
|
131
131
|
The plugin puts its own `functions/` and `completions/` on `fpath` and
|
|
@@ -200,8 +200,8 @@ its stdout stays the version alone for a script to read.
|
|
|
200
200
|
An excerpt of `gw --help`'s release lines with matching CLI and shell releases:
|
|
201
201
|
|
|
202
202
|
```console
|
|
203
|
-
worktrees 0.13.
|
|
204
|
-
The shell plugin here is 0.13.
|
|
203
|
+
worktrees 0.13.2: git worktree commands that refuse to lose work
|
|
204
|
+
The shell plugin here is 0.13.2, the same release as these commands.
|
|
205
205
|
```
|
|
206
206
|
|
|
207
207
|
A shell without the variable has no plugin loaded, or one older than the
|
|
@@ -729,8 +729,11 @@ Run `gw preflight` once in each repository. It says whether `gh` or `glab`
|
|
|
729
729
|
is signed in, whether GitHub squashes with each pull request's title and
|
|
730
730
|
body, whether the project's Claude Code and Codex settings enable the
|
|
731
731
|
plugin, and whether the shell plugin is this release.
|
|
732
|
-
`/worktrees:preflight
|
|
733
|
-
|
|
732
|
+
`/worktrees:preflight user` installs permission rules for the current
|
|
733
|
+
client. `/worktrees:preflight project` installs those rules and the plugin
|
|
734
|
+
setup in the repository. Both show the additions and ask before writing.
|
|
735
|
+
Codex uses `.rules` files and needs a restart to load them;
|
|
736
|
+
[preflight](docs/commands/preflight.md) lists every check and target path.
|
|
734
737
|
|
|
735
738
|
## Contributing
|
|
736
739
|
|
|
@@ -81,7 +81,7 @@ the plugin's tag to the same release, as each manager below describes.
|
|
|
81
81
|
### fish
|
|
82
82
|
|
|
83
83
|
```console
|
|
84
|
-
fisher install MihaiBojin/worktrees@v0.13.
|
|
84
|
+
fisher install MihaiBojin/worktrees@v0.13.2
|
|
85
85
|
```
|
|
86
86
|
|
|
87
87
|
Fisher copies `functions/`, `completions/` and `conf.d/` from the repository
|
|
@@ -98,7 +98,7 @@ the untagged one holds the files.
|
|
|
98
98
|
Antidote takes a `path:` into the repository, and `branch:` takes a tag:
|
|
99
99
|
|
|
100
100
|
```
|
|
101
|
-
MihaiBojin/worktrees branch:v0.13.
|
|
101
|
+
MihaiBojin/worktrees branch:v0.13.2 path:zsh/plugins/worktrees # in zsh_plugins.txt
|
|
102
102
|
```
|
|
103
103
|
|
|
104
104
|
The plugin puts its own `functions/` and `completions/` on `fpath` and
|
|
@@ -173,8 +173,8 @@ its stdout stays the version alone for a script to read.
|
|
|
173
173
|
An excerpt of `gw --help`'s release lines with matching CLI and shell releases:
|
|
174
174
|
|
|
175
175
|
```console
|
|
176
|
-
worktrees 0.13.
|
|
177
|
-
The shell plugin here is 0.13.
|
|
176
|
+
worktrees 0.13.2: git worktree commands that refuse to lose work
|
|
177
|
+
The shell plugin here is 0.13.2, the same release as these commands.
|
|
178
178
|
```
|
|
179
179
|
|
|
180
180
|
A shell without the variable has no plugin loaded, or one older than the
|
|
@@ -702,8 +702,11 @@ Run `gw preflight` once in each repository. It says whether `gh` or `glab`
|
|
|
702
702
|
is signed in, whether GitHub squashes with each pull request's title and
|
|
703
703
|
body, whether the project's Claude Code and Codex settings enable the
|
|
704
704
|
plugin, and whether the shell plugin is this release.
|
|
705
|
-
`/worktrees:preflight
|
|
706
|
-
|
|
705
|
+
`/worktrees:preflight user` installs permission rules for the current
|
|
706
|
+
client. `/worktrees:preflight project` installs those rules and the plugin
|
|
707
|
+
setup in the repository. Both show the additions and ask before writing.
|
|
708
|
+
Codex uses `.rules` files and needs a restart to load them;
|
|
709
|
+
[preflight](docs/commands/preflight.md) lists every check and target path.
|
|
707
710
|
|
|
708
711
|
## Contributing
|
|
709
712
|
|
|
@@ -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.13.
|
|
7
|
+
set -gx WORKTREES_PLUGIN_VERSION 0.13.2
|
|
@@ -10,20 +10,24 @@ gw merge 42 --match-head-commit FULL_SHA --subject 'Fix parser (#42)' --body-fil
|
|
|
10
10
|
gw merge 41 42 43 --json
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
With one `NUMBER`, `--match-head-commit` is required
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
`
|
|
13
|
+
With one `NUMBER`, `--match-head-commit` is required. An omitted
|
|
14
|
+
`--subject` or `--body-file` uses the corresponding field gw builds below.
|
|
15
|
+
An explicit subject is used as given, including its `(#NUMBER)` suffix.
|
|
16
|
+
`--body-file` reads UTF-8 text unchanged, including trailing newlines;
|
|
17
|
+
that file supplies the trailers the commit needs.
|
|
17
18
|
|
|
18
19
|
With several numbers, gw reads each pull request's head and CI and builds
|
|
19
20
|
each message itself, so `--match-head-commit`, `--subject` and
|
|
20
|
-
`--body-file` are a usage error at exit 2.
|
|
21
|
-
|
|
21
|
+
`--body-file` are a usage error at exit 2.
|
|
22
|
+
|
|
23
|
+
The generated subject is the title and ` (#NUMBER)`. The generated body
|
|
24
|
+
is the pull request's body without the
|
|
22
25
|
`🤖 Generated with` footer line, a bare `https://claude.ai/code/session_...`
|
|
23
26
|
line and the `<details><summary>Auto-resolution</summary>` block, keeping
|
|
24
27
|
any `release-note` block, followed by each of `pr.trailers` from
|
|
25
28
|
[`gw ci-checks`](ci-checks.md) that the body does not already hold. A pull
|
|
26
|
-
request whose `pr.trailers` is null
|
|
29
|
+
request whose `pr.trailers` is null needs an explicit `--body-file`: its
|
|
30
|
+
commit list was incomplete, so gw refuses to build its body.
|
|
27
31
|
|
|
28
32
|
The command always requests squash and accepts no strategy flag. A direct
|
|
29
33
|
squash receives the subject and body; a merge queue controls its own
|
|
@@ -178,10 +182,9 @@ An `enqueued` answer ends polling; it does not mean the PR merged.
|
|
|
178
182
|
|
|
179
183
|
HTTP 400 with `status: failed` is a failed outcome at exit 1, including when
|
|
180
184
|
`gh` exits nonzero. `details.message` supplies its reason. HTTP 409 identifies
|
|
181
|
-
an existing operation. The command
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
commit message.
|
|
185
|
+
an existing operation. The command refuses to adopt it because GitHub
|
|
186
|
+
does not echo that operation's commit message, so its trailers cannot be
|
|
187
|
+
verified.
|
|
185
188
|
|
|
186
189
|
With one number, a refusal exits 3 and prints its reason on stderr. Invalid
|
|
187
190
|
arguments exit 2. Unknown statuses, malformed responses and network failures
|
|
@@ -85,6 +85,21 @@ does not clone a marketplace declared there:
|
|
|
85
85
|
`codex plugin marketplace upgrade mihaibojin` clones it and installs the
|
|
86
86
|
plugins the project enables.
|
|
87
87
|
|
|
88
|
+
The `codex` check covers plugin configuration. The preflight skill checks
|
|
89
|
+
permissions separately, even when the CLI reports every check as `ok`.
|
|
90
|
+
In Codex, `/worktrees:preflight user` installs the bundled
|
|
91
|
+
[permission rules](../../plugin/skills/preflight/worktrees.rules) into
|
|
92
|
+
`${CODEX_HOME:-$HOME/.codex}/rules/worktrees.rules`.
|
|
93
|
+
`/worktrees:preflight project` uses `.codex/rules/worktrees.rules` under the
|
|
94
|
+
repository root. Claude Code uses its own settings files for those scopes.
|
|
95
|
+
|
|
96
|
+
The skill prepares a candidate with missing rules appended, preserves
|
|
97
|
+
existing rules and comments, and validates it with `codex execpolicy check`.
|
|
98
|
+
It shows the target and additions before asking to install them. Existing
|
|
99
|
+
`prompt` or `forbidden` decisions remain in effect where they match; an
|
|
100
|
+
allow rule cannot override them. Restart Codex after installation. Project
|
|
101
|
+
rules apply only in a trusted project.
|
|
102
|
+
|
|
88
103
|
## Shell plugin
|
|
89
104
|
|
|
90
105
|
The fish and zsh plugins export `WORKTREES_PLUGIN_VERSION`. The check
|
|
@@ -33,6 +33,12 @@ run refuses and lists them:
|
|
|
33
33
|
gw fast-forward takes a copy GitHub rewrote, or says what differs; gw push --replace pushes over them once each one is checked
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
+
Merge commits, including GitHub's "Update branch", and empty commits have
|
|
37
|
+
no patch-id in this comparison. They still count as remote work unless
|
|
38
|
+
the branch or the head already holds them, the merged-part proof covers
|
|
39
|
+
them, or the branch's reflog proves this clone made them. A merge can hold
|
|
40
|
+
conflict resolutions that none of its parents contains.
|
|
41
|
+
|
|
36
42
|
`git push --force-with-lease --force-if-includes` lets that push through
|
|
37
43
|
when the remote tip is in the branch's reflog: a branch that pulled the
|
|
38
44
|
commit and then dropped it in a rebase deletes it from the remote.
|
|
@@ -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.13.
|
|
4
|
+
"version": "0.13.2",
|
|
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",
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: preflight
|
|
3
3
|
description: >
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
user's or the project's settings.json, and the project's plugin setup to
|
|
8
|
-
its .claude/settings.json and .codex/config.toml. Runs only when the user
|
|
9
|
-
calls it by name.
|
|
4
|
+
Use when the user calls preflight by name to check or configure Worktrees
|
|
5
|
+
permissions and plugin setup in Claude Code or Codex, for one project or
|
|
6
|
+
the user account.
|
|
10
7
|
disable-model-invocation: true
|
|
11
8
|
argument-hint: "[user | project]"
|
|
12
9
|
allowed-tools:
|
|
@@ -26,19 +23,19 @@ defaults, the project's Claude Code and Codex plugin setup, and the shell
|
|
|
26
23
|
plugin's release. This skill reports what it finds and writes what a file
|
|
27
24
|
can hold, after asking.
|
|
28
25
|
|
|
29
|
-
[rules.json](rules.json) holds
|
|
30
|
-
|
|
31
|
-
publishes with
|
|
32
|
-
|
|
26
|
+
[rules.json](rules.json) holds Claude Code's permission rules;
|
|
27
|
+
[worktrees.rules](worktrees.rules) holds Codex's. They contain the allow
|
|
28
|
+
rules [ship-it](../ship-it/rights.md) publishes with and the deny rules
|
|
29
|
+
each client can match. [project.json](project.json) and
|
|
33
30
|
[config.toml](config.toml) hold the project's plugin setup for Claude Code
|
|
34
31
|
and Codex. A plugin can write none of them itself.
|
|
35
32
|
|
|
36
|
-
An allow rule lets every
|
|
33
|
+
An allow rule lets every session the file covers run that
|
|
37
34
|
command without asking, not just ship-it. Write only the lines the user
|
|
38
35
|
approves in this run, and only after they approve them.
|
|
39
36
|
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
Use the current client's permission files. After step 2, Codex uses step 7;
|
|
38
|
+
Claude Code uses steps 3 to 6. Both continue with step 8.
|
|
42
39
|
|
|
43
40
|
Below, `RULES`, `PROJECT` and `CONFIG` are the absolute paths of
|
|
44
41
|
`rules.json`, `project.json` and `config.toml` beside this file, and `TOP`
|
|
@@ -53,7 +50,10 @@ gw preflight --json
|
|
|
53
50
|
|
|
54
51
|
Report every check in `checks`: its `name`, `status` and `detail`, and its
|
|
55
52
|
`fix` when there is one. The status is `ok`, `missing`, `wrong` or
|
|
56
|
-
`skipped`.
|
|
53
|
+
`skipped`. Exit 1 reports setup gaps: continue with those checks. When gw
|
|
54
|
+
refuses at exit 3, report what it said and stop. The `codex` check covers
|
|
55
|
+
plugin configuration; permission rules are checked separately in step 7,
|
|
56
|
+
even when every CLI check is `ok`.
|
|
57
57
|
|
|
58
58
|
Two fixes are the user's to run, never this skill's:
|
|
59
59
|
|
|
@@ -73,12 +73,15 @@ shell.
|
|
|
73
73
|
|
|
74
74
|
## 2. Which file
|
|
75
75
|
|
|
76
|
-
The argument is the scope. With none, ask which one,
|
|
76
|
+
The argument is the scope. With none, ask which one, using the current
|
|
77
|
+
client's rows from this table:
|
|
77
78
|
|
|
78
|
-
| scope | file | reaches |
|
|
79
|
-
| --- | --- | --- |
|
|
80
|
-
| `user` | `~/.claude/settings.json` | every project on this machine |
|
|
81
|
-
| `project` |
|
|
79
|
+
| client | scope | permission file | reaches |
|
|
80
|
+
| --- | --- | --- | --- |
|
|
81
|
+
| Claude Code | `user` | `~/.claude/settings.json` | every project on this machine |
|
|
82
|
+
| Claude Code | `project` | `TOP/.claude/settings.json` | each trusted clone once committed |
|
|
83
|
+
| Codex | `user` | `${CODEX_HOME:-$HOME/.codex}/rules/worktrees.rules` | every project using that Codex home |
|
|
84
|
+
| Codex | `project` | `TOP/.codex/rules/worktrees.rules` | each trusted clone once committed |
|
|
82
85
|
|
|
83
86
|
Any other argument: say that it takes `user` or `project`, and stop.
|
|
84
87
|
|
|
@@ -94,7 +97,7 @@ jq --slurpfile want RULES '$want[0].permissions as $w | {allow: ($w.allow - (.pe
|
|
|
94
97
|
|
|
95
98
|
When jq cannot read the file, stop: name the file and what jq said, and
|
|
96
99
|
change nothing. When both lists are empty, say the file already carries
|
|
97
|
-
every rule, and go to step
|
|
100
|
+
every rule, and go to step 8.
|
|
98
101
|
|
|
99
102
|
## 4. Ask about the rules
|
|
100
103
|
|
|
@@ -125,13 +128,67 @@ permissions, which matters for a `~/.claude/settings.json` that holds
|
|
|
125
128
|
secrets in `env`.
|
|
126
129
|
|
|
127
130
|
Nothing here pre-approves the copy, so the client asks before it. Where it
|
|
128
|
-
refuses, print the `cp` command for the user to run with `!`,
|
|
131
|
+
refuses, print the `cp` command for the user to run with `!`, report the
|
|
132
|
+
rules as uninstalled, and continue with step 8.
|
|
129
133
|
|
|
130
134
|
## 6. Check the rules
|
|
131
135
|
|
|
132
|
-
Run step 3 again: both lists are empty.
|
|
136
|
+
Run step 3 again: both lists are empty. Continue with step 8.
|
|
133
137
|
|
|
134
|
-
## 7.
|
|
138
|
+
## 7. Codex permission rules
|
|
139
|
+
|
|
140
|
+
`MERGER` is the absolute path of [merge_codex_rules.py](merge_codex_rules.py)
|
|
141
|
+
beside this file. `TARGET` is the Codex permission file selected in step 2.
|
|
142
|
+
Prepare a candidate without changing `TARGET`:
|
|
143
|
+
|
|
144
|
+
```sh
|
|
145
|
+
mktemp
|
|
146
|
+
python3 MERGER TARGET > TEMP
|
|
147
|
+
codex execpolicy check --rules TEMP -- gw push --json
|
|
148
|
+
diff -u TARGET TEMP
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
`TEMP` is the path `mktemp` printed. Quote every path. If `TARGET` does not
|
|
152
|
+
exist, compare `/dev/null` with `TEMP`. A diff exits 1 when files differ;
|
|
153
|
+
that is the candidate to review. Stop this permission write if the merger
|
|
154
|
+
or Codex validation fails; show the error and leave `TARGET` unchanged.
|
|
155
|
+
If `codex` is unavailable, report that validation needs the Codex CLI and
|
|
156
|
+
leave the candidate for the user to validate and install.
|
|
157
|
+
|
|
158
|
+
The merger reads the bundled rules and appends missing literal patterns
|
|
159
|
+
and decisions. It preserves existing text, including comments and other
|
|
160
|
+
rules, and ignores formatting and justification differences when matching.
|
|
161
|
+
It never executes the target as Python. Codex validates the candidate's
|
|
162
|
+
rule syntax. An existing `prompt` or `forbidden` rule remains in effect:
|
|
163
|
+
the strictest matching decision wins. Do not remove such a rule to make an
|
|
164
|
+
allow rule effective.
|
|
165
|
+
|
|
166
|
+
If the diff is empty, report that the file already carries the rules and
|
|
167
|
+
continue with step 8. Otherwise show the target's absolute path and every
|
|
168
|
+
added rule, with `allow` and `forbidden` apart, then ask to install or skip
|
|
169
|
+
this candidate. Explain that allow rules permit matching commands outside
|
|
170
|
+
the sandbox without a prompt, subject to other policy restrictions. They
|
|
171
|
+
cover commits, pushes, pull request creation and merging, and CI reruns
|
|
172
|
+
for every session within the selected scope.
|
|
173
|
+
|
|
174
|
+
After approval, create the target's parent directory if needed and copy
|
|
175
|
+
the reviewed candidate:
|
|
176
|
+
|
|
177
|
+
```sh
|
|
178
|
+
cp TEMP TARGET
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
The copy preserves an existing file's permissions. Nothing here
|
|
182
|
+
pre-approves the copy. If the client refuses it, report the refusal and
|
|
183
|
+
give the exact command for the user to run. Never report an uncompleted
|
|
184
|
+
copy as installed.
|
|
185
|
+
|
|
186
|
+
After a successful copy, run the merger and comparison again: the diff
|
|
187
|
+
must be empty. Validate `TARGET` with the same `codex execpolicy check`
|
|
188
|
+
command and report its decision. Tell the user to restart Codex to load
|
|
189
|
+
the rules. Rules in a project apply only after the user trusts it.
|
|
190
|
+
|
|
191
|
+
## 8. The project's plugin setup
|
|
135
192
|
|
|
136
193
|
With the `user` scope, skip this step and say that
|
|
137
194
|
`/worktrees:preflight project` writes these files. With `project`, it
|
|
@@ -171,7 +228,7 @@ reads the file only in a trusted project, and that
|
|
|
171
228
|
`codex plugin marketplace upgrade mihaibojin` clones the marketplace and
|
|
172
229
|
installs the plugin.
|
|
173
230
|
|
|
174
|
-
##
|
|
231
|
+
## 9. Report
|
|
175
232
|
|
|
176
233
|
Run `gw preflight --json` again and report each check that changed. Name
|
|
177
234
|
each file this run wrote and the lines it gained. A file under `TOP` is not
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"""Print the target's rules with missing Worktrees rules appended."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import argparse
|
|
6
|
+
import ast
|
|
7
|
+
import sys
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def literal_rules(text: str) -> list[tuple[object, object, str]]:
|
|
12
|
+
rules = []
|
|
13
|
+
for node in ast.parse(text).body:
|
|
14
|
+
if not (
|
|
15
|
+
isinstance(node, ast.Expr)
|
|
16
|
+
and isinstance(node.value, ast.Call)
|
|
17
|
+
and isinstance(node.value.func, ast.Name)
|
|
18
|
+
and node.value.func.id == "prefix_rule"
|
|
19
|
+
):
|
|
20
|
+
continue
|
|
21
|
+
fields = {kw.arg: kw.value for kw in node.value.keywords}
|
|
22
|
+
try:
|
|
23
|
+
pattern = ast.literal_eval(fields["pattern"])
|
|
24
|
+
decision = (
|
|
25
|
+
ast.literal_eval(fields["decision"])
|
|
26
|
+
if "decision" in fields
|
|
27
|
+
else "allow"
|
|
28
|
+
)
|
|
29
|
+
except (KeyError, ValueError, TypeError):
|
|
30
|
+
continue
|
|
31
|
+
rules.append((pattern, decision, ast.get_source_segment(text, node) or ""))
|
|
32
|
+
return rules
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def main() -> int:
|
|
36
|
+
parser = argparse.ArgumentParser(description=__doc__)
|
|
37
|
+
parser.add_argument("target", type=Path)
|
|
38
|
+
target = parser.parse_args().target
|
|
39
|
+
source = Path(__file__).with_name("worktrees.rules")
|
|
40
|
+
try:
|
|
41
|
+
try:
|
|
42
|
+
held = target.read_bytes().decode("utf-8")
|
|
43
|
+
except FileNotFoundError:
|
|
44
|
+
held = ""
|
|
45
|
+
existing = [(pattern, decision) for pattern, decision, _ in literal_rules(held)]
|
|
46
|
+
wanted = source.read_text(encoding="utf-8")
|
|
47
|
+
missing = [
|
|
48
|
+
code
|
|
49
|
+
for pattern, decision, code in literal_rules(wanted)
|
|
50
|
+
if (pattern, decision) not in existing
|
|
51
|
+
]
|
|
52
|
+
except (OSError, UnicodeError, SyntaxError) as exc:
|
|
53
|
+
print(f"Cannot prepare rules for {target}: {exc}", file=sys.stderr)
|
|
54
|
+
return 1
|
|
55
|
+
if missing:
|
|
56
|
+
held += ("\n\n" if held else "") + "\n".join(missing) + "\n"
|
|
57
|
+
sys.stdout.buffer.write(held.encode("utf-8"))
|
|
58
|
+
return 0
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
if __name__ == "__main__":
|
|
62
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
prefix_rule(
|
|
2
|
+
pattern=["gw", "branch", "create"],
|
|
3
|
+
decision="allow",
|
|
4
|
+
justification="ship-it starts a branch",
|
|
5
|
+
)
|
|
6
|
+
prefix_rule(
|
|
7
|
+
pattern=["gw", ["sync", "fast-forward", "push", "ci-checks"]],
|
|
8
|
+
decision="allow",
|
|
9
|
+
justification="ship-it fetches, rebases, pushes and reads CI",
|
|
10
|
+
)
|
|
11
|
+
prefix_rule(
|
|
12
|
+
pattern=["git", "switch", ["--create", "--no-guess"]],
|
|
13
|
+
decision="allow",
|
|
14
|
+
justification="ship-it starts a branch or moves to a named one",
|
|
15
|
+
)
|
|
16
|
+
prefix_rule(
|
|
17
|
+
pattern=["git", ["add", "commit"]],
|
|
18
|
+
decision="allow",
|
|
19
|
+
justification="ship-it commits by path",
|
|
20
|
+
)
|
|
21
|
+
prefix_rule(
|
|
22
|
+
pattern=["gh", "pr", ["view", "diff", "create", "edit"]],
|
|
23
|
+
decision="allow",
|
|
24
|
+
justification="ship-it opens and describes the pull request",
|
|
25
|
+
)
|
|
26
|
+
prefix_rule(
|
|
27
|
+
pattern=["gw", "stack-link"],
|
|
28
|
+
decision="allow",
|
|
29
|
+
justification="ship-it links a stacked pull request into a native stack",
|
|
30
|
+
)
|
|
31
|
+
prefix_rule(
|
|
32
|
+
pattern=["gw", "merge"],
|
|
33
|
+
decision="allow",
|
|
34
|
+
justification="ship-it merges checked GitHub pull requests, a stack or several in one call",
|
|
35
|
+
)
|
|
36
|
+
prefix_rule(
|
|
37
|
+
pattern=["gh", "run", ["view", "rerun"]],
|
|
38
|
+
decision="allow",
|
|
39
|
+
justification="ship-it reads and reruns CI",
|
|
40
|
+
)
|
|
41
|
+
prefix_rule(
|
|
42
|
+
pattern=["glab", "mr", ["view", "diff", "create", "update", "merge"]],
|
|
43
|
+
decision="allow",
|
|
44
|
+
justification="ship-it opens and merges the merge request",
|
|
45
|
+
)
|
|
46
|
+
prefix_rule(
|
|
47
|
+
pattern=["glab", "ci", ["trace", "retry"]],
|
|
48
|
+
decision="allow",
|
|
49
|
+
justification="ship-it reads and reruns CI",
|
|
50
|
+
)
|
|
51
|
+
prefix_rule(
|
|
52
|
+
pattern=["git", "push"],
|
|
53
|
+
decision="forbidden",
|
|
54
|
+
justification="Use gw push.",
|
|
55
|
+
)
|
|
56
|
+
prefix_rule(
|
|
57
|
+
pattern=["git", "rebase"],
|
|
58
|
+
decision="forbidden",
|
|
59
|
+
justification="Use gw fast-forward, and gw fast-forward --continue.",
|
|
60
|
+
)
|
|
61
|
+
prefix_rule(
|
|
62
|
+
pattern=["gh", ["pr", "stack"], "merge"],
|
|
63
|
+
decision="forbidden",
|
|
64
|
+
justification="Use gw merge.",
|
|
65
|
+
)
|
|
66
|
+
prefix_rule(
|
|
67
|
+
pattern=["gh", "api"],
|
|
68
|
+
decision="forbidden",
|
|
69
|
+
justification="Use gw merge or gw stack-link for writes, and gh pr view or gw ci-checks for reads.",
|
|
70
|
+
)
|