carson 3.21.1 → 3.22.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6e487779056ecbcf22d7aca1527c557051cd2ce94b31e030a515ffedcb8bbce5
4
- data.tar.gz: 9cc271426a2c241d855f9a11d7b583e1bb0db2a8041e2972e8bdb3b7df4b55a7
3
+ metadata.gz: 0e8e1399ec6024845aecc0b88bd5549a2dc2c4f9a4b8a9852a725a718eb837d9
4
+ data.tar.gz: cc4e9c3b9fe55e238c394d2056a2fe25afe100bdf1191a7b58cfd9b9f05e0fc6
5
5
  SHA512:
6
- metadata.gz: 1e9085ad4e193f0b0c09b5ea890bbbc708194c0ccaf9b5dea96e4daafa5b074f08790ac994d44fbcee3767641eb519cc97d4b05ae65bc29532a2c695a752807c
7
- data.tar.gz: 2bc2779bde9dabc17a79c2e0668f370a8f8aecd9ee41bbb56c51ebedf394d1546e029f611a7ffc2072e496a4d01ade6e390157ca4b4468bdf220a1ac4bb99393
6
+ metadata.gz: 63148df8fdf6cd881b4a63a9c3f330221a60481943e2ec97647242a791b0b672d86cc557fd38062e003d531c8ca2007390d0312731595cb24d115f806a73a6e0
7
+ data.tar.gz: 74df1a6e073a1c7d4cce7b227344295146d0a3d69c4941b3befe129660ab3eb50ccbbe5465cc35fbabaa7d56f6912ae2f9b6a38f6347e1b1ace2f9eae2e797ed
data/API.md CHANGED
@@ -84,12 +84,7 @@ Blocked Carson artefacts in host repositories:
84
84
  - `.tools/carson/*`
85
85
 
86
86
  Allowed Carson-managed persistence in host repositories:
87
- - `.github/carson.md` — governance baseline (source of truth)
88
- - `.github/copilot-instructions.md` — agent discovery pointer for Copilot
89
- - `.github/CLAUDE.md` — agent discovery pointer for Claude Code
90
- - `.github/AGENTS.md` — agent discovery pointer for Codex
91
- - `.github/pull_request_template.md` — PR template
92
- - Any file discovered from `template.canonical` — user's canonical `.github/` files
87
+ - Any file discovered from `lint.canonical` — user's canonical GitHub and lint-policy files
93
88
 
94
89
  ## Configuration interface
95
90
 
@@ -146,14 +141,14 @@ Environment overrides:
146
141
 
147
142
  ```json
148
143
  {
149
- "template": {
144
+ "lint": {
150
145
  "canonical": "~/AI/CODING/LINT"
151
146
  }
152
147
  }
153
148
  ```
154
149
 
155
- `template` semantics:
156
- - `canonical`: path to a directory of canonical `.github/` files. Carson discovers files in this directory and syncs them to governed repos alongside its own governance files. The directory mirrors `.github/` structure — `workflows/lint.yml` deploys to `.github/workflows/lint.yml`. Default: `nil` (no canonical files).
150
+ `lint` semantics:
151
+ - `canonical`: path to a directory of canonical GitHub and lint-policy files. Carson discovers files in this directory and syncs them to governed repos. Explicit GitHub paths stay under `.github/` (`workflows/lint.yml` `.github/workflows/lint.yml`, `.github/labeler.yml` → `.github/labeler.yml`); flat policy files default to `.github/linters/` (`rubocop.yml` → `.github/linters/rubocop.yml`). Legacy root lint configs become stale and are removed on apply. Default: `nil` (no canonical files). The deprecated alias `template.canonical` is still accepted when loading config.
157
152
 
158
153
  ## Output interface
159
154
 
data/MANUAL.md CHANGED
@@ -39,7 +39,7 @@ On first run (no `~/.carson/config.json` exists), `onboard` launches `carson set
39
39
  - Hook installation under `~/.carson/hooks/<version>/`.
40
40
  - Repository `core.hooksPath` alignment to Carson global hooks.
41
41
  - Commit-time governance gate via managed `pre-commit` hook.
42
- - Managed `.github/*` template synchronisation.
42
+ - Canonical `.github/*` template synchronisation (when `lint.canonical` is configured).
43
43
  - Initial governance audit.
44
44
 
45
45
  ### Reconfigure later
@@ -52,7 +52,7 @@ Re-run the interactive setup quiz to change your remote, main branch, workflow s
52
52
 
53
53
  ### Commit generated files
54
54
 
55
- After `onboard`, commit the generated `.github/*` changes in your repository. From this point the repository is governed.
55
+ After `onboard`, commit any `.github/*` changes in your repository. From this point the repository is governed.
56
56
 
57
57
  ## CI Setup
58
58
 
@@ -82,37 +82,70 @@ Notes:
82
82
 
83
83
  ### Canonical Templates
84
84
 
85
- Carson manages 5 governance files (carson.md, CLAUDE.md, AGENTS.md, copilot-instructions.md, pull_request_template.md). Beyond those, you can tell Carson about your own canonical `.github/` files CI workflows, linter configs, labeller rules, anything that belongs in `.github/`.
85
+ Carson has no built-in template files. Instead, you tell Carson about your own canonical GitHub and lint-policy files via `lint.canonical`.
86
86
 
87
- Set `template.canonical` in `~/.carson/config.json`:
87
+ Set `lint.canonical` in `~/.carson/config.json`:
88
88
 
89
89
  ```json
90
90
  {
91
- "template": {
91
+ "lint": {
92
92
  "canonical": "~/AI/CODING/LINT"
93
93
  }
94
94
  }
95
95
  ```
96
96
 
97
- That directory mirrors the `.github/` structure:
97
+ Flat lint-policy directories default to `.github/linters/`, while explicit GitHub paths stay under `.github/`:
98
98
 
99
99
  ```
100
100
  ~/AI/CODING/LINT/
101
+ ├── rubocop.yml → deployed to .github/linters/rubocop.yml
102
+ ├── ruff.toml → deployed to .github/linters/ruff.toml
101
103
  ├── workflows/
102
104
  │ └── lint.yml → deployed to .github/workflows/lint.yml
103
- ├── .mega-linter.yml → deployed to .github/.mega-linter.yml
104
- └── labeler.yml → deployed to .github/labeler.yml
105
+ └── .github/
106
+ └── labeler.yml → deployed to .github/labeler.yml
105
107
  ```
106
108
 
107
- Carson discovers files in this directory and syncs them to governed repos alongside its own governance files. `carson template check` detects drift, `carson template apply` writes them, and `carson refresh` propagates them to the remote.
109
+ Carson discovers files in this directory and syncs them to governed repos. Root files that are not recognised GitHub artefacts are treated as lint policy and written under `.github/linters/`; legacy root lint configs become stale and are removed on apply. `carson template check` detects drift, `carson template apply` writes them, and `carson refresh` propagates them to the remote. Carson still reads the deprecated `template.canonical` key for backwards compatibility, but new setup writes `lint.canonical`.
108
110
 
109
111
  **Why this design.** Lint, CI, and tooling config are personal decisions — not governance decisions. Carson's job is to deliver your canonical files reliably, not to decide what they should contain.
110
112
 
113
+ ## Operating Strategies
114
+
115
+ These strategies are the audit lens for Carson. If behaviour departs from them, either the product model or the implementation needs attention.
116
+
117
+ ### Git Strategist
118
+
119
+ - **Worktree-first discipline** — substantive work happens in worktrees, never on the main working tree. This keeps concurrent agent work isolated and makes cleanup explicit.
120
+ - **Deterministic base selection** — new work starts from the repo's chosen integration authority, not from whatever branch state happens to be lying around.
121
+ - **Single landing path per authority** — in `remote`, completed work rejoins through remote `main`; in `local`, completed work rejoins through local `main` and then pushes `main` as backup.
122
+ - **Content-aware merge detection** — Carson proves whether a branch's content is already on `main` without relying on commit SHAs, so squash and rebase merges are handled correctly.
123
+ - **Worktree-aware delivery** — Carson lands work without assuming `main` can be checked out in the active worktree, and cleanup is deferred to the correct context.
124
+ - **Exact post-merge guidance** — after a successful landing, Carson tells the caller the next clean-up command instead of leaving the lifecycle half-finished.
125
+
126
+ ### Repo Governor
127
+
128
+ - **Outsider boundary** — Carson governs repositories without writing Carson-specific config, scripts, or runtime payloads into them.
129
+ - **Command ownership** — in governed repositories, Carson owns worktree and delivery operations so agents do not mix raw git flows with governed ones.
130
+ - **Authority enforcement** — every governed repo has one integration authority at a time. That authority determines how work starts and how it returns to shared truth.
131
+ - **Active review gating** — when the repo uses PR-based delivery, review findings must be acknowledged before merge. Feedback is never silently buried.
132
+ - **Portfolio triage** — `carson govern` applies the same discipline across multiple repositories: classify, merge, dispatch, or escalate.
133
+ - **Template propagation** — Carson treats canonical policy files as managed infrastructure and keeps them consistent across repos.
134
+
135
+ ### Safety Strategies
136
+
137
+ - **Process-aware worktree removal** — Carson checks whether the current shell or another process has its CWD inside a worktree before attempting removal.
138
+ - **Stale worktree sweep** — Carson removes worktrees whose content has already been absorbed into `main` so dead state does not block later maintenance.
139
+ - **Protected branch preservation** — Carson never deletes protected branches and does not prune branches that are still held by active worktrees.
140
+ - **Hook bypass only for managed operations** — Carson uses controlled bypasses such as `--no-verify` only for its own managed flows, not as a general escape hatch.
141
+ - **Self-diagnosing errors** — blocks and failures must explain the condition and prescribe the exact recovery command.
142
+ - **Self-configuring guardrails** — running Carson should install and refresh its own safeguards rather than expecting manual post-install housekeeping.
143
+
111
144
  ## Agent Worktree Workflow
112
145
 
113
146
  The core workflow for coding agents using Carson. One command per step, full lifecycle.
114
147
 
115
- **1. Create a worktree** — Carson auto-syncs main before branching (3.13.0+), so the worktree always starts from the latest code:
148
+ **1. Create a worktree** — Carson starts new work from the repo's chosen integration authority rather than from the caller's current HEAD. When that authority requires sync, Carson checks it before branching:
116
149
 
117
150
  ```bash
118
151
  carson worktree create my-feature
@@ -121,7 +154,7 @@ cd /path/to/.claude/worktrees/my-feature
121
154
 
122
155
  **2. Work** — make changes, commit, iterate.
123
156
 
124
- **3. Deliver and merge** — push, create PR, merge when CI passes. After merge, Carson prints the exact next command (3.13.0+):
157
+ **3. Deliver and merge** — use Carson's landing path for the repo authority. In remote authority that means push, PR, and merge; in local authority that means integrate into local `main` and back it up by pushing `main`. Managed template drift is corrected and committed automatically before push (3.22.1+). After delivery, Carson prints the exact next command:
125
158
 
126
159
  ```bash
127
160
  carson deliver --merge
@@ -152,7 +185,7 @@ Claude Code has a built-in `EnterWorktree` tool. Both create a git worktree unde
152
185
 
153
186
  | Concern | EnterWorktree | Carson |
154
187
  |---|---|---|
155
- | Auto-sync main before branching | No — branches from current HEAD, which may be stale | Yes — `git pull --ff-only` before branch creation |
188
+ | Governed baseline before branching | No — branches from current HEAD, which may be stale | Yes — branches from the repo's governed baseline rather than the caller's current HEAD |
156
189
  | CWD guard on removal | No | Yes — blocks if shell is inside the worktree |
157
190
  | Unpushed-commits guard | No | Yes — blocks if work hasn't been pushed |
158
191
  | Content-aware squash/rebase detection | No | Yes — compares tree content, not SHAs |
@@ -362,22 +395,6 @@ How much Carson prints.
362
395
  - Default: **concise**. A healthy audit prints one line. Problems print actionable summaries with cause and fix.
363
396
  - `--verbose` restores full diagnostic key-value output for debugging.
364
397
 
365
- ## Agent Discovery
366
-
367
- Carson writes managed files that help interactive agents (Claude Code, Codex, Copilot) discover the governance system when they work in a governed repository.
368
-
369
- **How it works:**
370
-
371
- - `.github/AGENTS.md` — full governance baseline; read by Codex and other agents. Points to `carson.md`.
372
- - `.github/CLAUDE.md` — read by Claude Code at session start. Points to `AGENTS.md`.
373
- - `.github/copilot-instructions.md` — read by GitHub Copilot. Points to `AGENTS.md`.
374
-
375
- Each agent reads its own expected filename and follows the reference to the shared baseline. One file to maintain, zero drift across agents.
376
-
377
- All four files are managed templates — `carson template check` detects drift, `carson template apply` writes them, and `carson offboard` removes them.
378
-
379
- **Why this matters:** without discovery, agents working in governed repos hit Carson's hooks blindly and don't understand the governance contract. With discovery, agents know to run `carson audit` before committing, `carson review gate` before recommending a merge, and to respect protected refs.
380
-
381
398
  ## Configuration
382
399
 
383
400
  Default global config path: `~/.carson/config.json`.
data/README.md CHANGED
@@ -2,97 +2,92 @@
2
2
 
3
3
  # ⧓ Carson
4
4
 
5
- *Carson at your service.*
5
+ Named after the butler of Downton Abbey, Carson is a strategic governor for multiple agents working in one repo.
6
6
 
7
- Named after the head of household in Downton Abbey, Carson is your repositories' autonomous governance runtime — you write the code, Carson manages everything else. From commit-time checks through PR triage, agent dispatch, merge, and cleanup, Carson runs the household with discipline and professional standards. Carson itself has no intelligence it follows a deterministic decision tree. The intelligence comes from the coding agents it dispatches (Codex, Claude) to fix problems.
7
+ Carson is deterministic infrastructure for concurrent agent work. It governs how work starts, how it rejoins shared truth, and how the repo is cleaned up afterwards so agents can code without trampling each other. The agents provide the intelligence; Carson provides the discipline.
8
+
9
+ Carson was built in real work. Its strategies come from scars: more than ten agents running across multiple projects at once, with each repeated failure turned into a rule, guardrail, or recovery path.
8
10
 
9
11
  ## The Problem
10
12
 
11
- Managing a growing portfolio of repositories is rewarding work but the operational overhead scales faster than the code itself. PR templates go stale, reviewer feedback gets quietly buried, and what passes on a developer's laptop fails in CI. When coding agents start producing PRs across multiple projects, the coordination load multiplies: checking results, dispatching fixes, clicking merge, cleaning up branches.
13
+ When several agents work on one repository, plain Git leaves too much to habit. Branches start from different bases, work lands back on `main` through inconsistent paths, old worktrees linger, and one clean-up step can disrupt another session.
12
14
 
13
- Carson exists so you can focus on what matters building while governance runs itself.
15
+ Carson solves that single-repo concurrency problem first, then extends the same discipline across multiple repositories.
14
16
 
15
17
  ## What Carson Does
16
18
 
17
- Carson is an autonomous governance runtime that lives on your workstation and in CI, never inside the repositories it governs. It operates at two levels:
19
+ Carson lives on your workstation and in CI, never inside the repositories it governs. Two roles, one tool:
18
20
 
19
- **Per-commit governance** — Carson gates merges on unresolved review comments, synchronises templates, and keeps your local branches clean. Every commit triggers `carson audit` through managed hooks; the same checks run in GitHub Actions.
21
+ **Git strategist** — Carson decides how new work begins, which base it uses, how it returns to shared truth, and how cleanup happens safely.
20
22
 
21
- **Portfolio-level autonomy** — `carson govern` is a triage loop that scans your registered repositories, classifies every open PR, and acts: merge what's ready, dispatch coding agents (Codex or Claude) to fix what's failing, and escalate what needs human judgement. One command, all your projects, unmanned.
23
+ **Repo governor** — Carson enforces the repo's operating contract: worktree-first flow, Carson-owned delivery operations, policy checks, and exact recovery guidance when work cannot proceed.
22
24
 
23
25
  ```
24
26
  ~/.carson/ ← Carson lives here, never inside your repos
25
27
 
26
- ├─ hooks ──────────────► commit gates (every governed repo)
27
- └─ govern ─────────────► PR triage merge | dispatch agent | escalate
28
+ ├─ hooks ──────────────► commit gates and command guards
29
+ ├─ worktree flow ──────► creatework deliver clean up
30
+ └─ portfolio layer ────► status --all | refresh --all | govern
28
31
  ```
29
32
 
30
- This separation is Carson's defining trait — the **outsider boundary**: no Carson scripts, config files, or governance payloads are ever placed inside a governed repository.
31
-
32
- **Agent workspace management** — `carson worktree create` and `carson worktree remove` give coding agents safe, isolated workspaces. Unlike Claude Code's built-in `EnterWorktree`, Carson auto-syncs main before branching, guards against removing worktrees with unpushed work or an active shell inside, detects squash/rebase merges so removal doesn't falsely block, and cleans up the local and remote branch in one step. The two tools are complementary — see `MANUAL.md § Carson vs Claude Code EnterWorktree` for the full comparison.
33
-
34
- ### The Governance Loop
33
+ The outsider boundary still matters: Carson governs repositories without becoming a runtime dependency inside them.
35
34
 
36
- Carson orchestrates a closed governance loop across two layers:
35
+ ## Two Authorities
37
36
 
38
- 1. **CI enforcement** Carson's `audit` gates on CI check status reported by GitHub. The actual CI runs are delegated to GitHub Actions.
39
- 2. **Autonomous triage** — `carson govern` reads CI status, review disposition, and audit health for every open PR. Ready PRs are merged. Failing PRs get a coding agent (Codex or Claude) dispatched to fix them. Stuck PRs are escalated.
37
+ Each governed repo chooses one integration authority.
40
38
 
41
- Carson's role is governance orchestration gating on results and dispatching action. The actual CI runs and code fixes are delegated to specialised tools: GitHub Actions for CI and coding agents for remediation.
39
+ **Remote**remote `main` is the integration authority. Agents still work in local worktrees, but completed work rejoins through remote `main`.
42
40
 
43
- ### Principles
41
+ **Local** — local `main` is the integration authority. Agents still work in local worktrees, but completed work rejoins through local `main`, then `main` is pushed to the remote as backup.
44
42
 
45
- Carson is opinionated about governance. These are non-negotiable principles, not configurable defaults:
43
+ This is about where completed work rejoins shared truth, not about team size. Both authorities use worktrees. The authority changes how work lands, not whether Carson is needed.
46
44
 
47
- - **Outsider boundary** — Carson lives outside your repo, never inside. No Carson-owned artefacts in your repository. Offboarding leaves no trace.
48
- - **Active review** — undisposed reviewer findings block merge. Feedback must be acknowledged, not buried.
49
- - **Self-diagnosing output** — every warning and error names what went wrong, why, and what to do next. If you have to read source code to understand a message, that message is a bug.
50
- - **Transparent governance** — Carson prepares everything for merge but never oversteps. It does not make decisions for you without telling you.
45
+ ## Principles
51
46
 
52
- Everything else bends to your preference. Which branch is main, how PRs are merged, which repositories to govern, which coding agent to dispatch — Carson asks during setup and remembers. Sensible defaults are provided; you only change what matters to you. See `MANUAL.md` for the full list.
53
-
54
- ## When to Use Carson
55
-
56
- - **You run coding agents across multiple repositories** and need a single command that triages every open PR, merges what's ready, dispatches agents to fix what's broken, and reports what needs your attention.
57
- - **Your PR feedback gets buried.** Carson blocks merge until every reviewer comment is explicitly acknowledged — accepted, rejected, or deferred — so nothing is silently ignored.
58
- - **CI breaks and nobody notices.** `carson audit` runs on every commit via managed hooks, and `carson govern` watches CI status across your portfolio continuously.
59
- - **You onboard new repositories often** and want consistent hooks, templates, and governance from the first commit without manual setup.
60
- - **You want agent-safe worktree management.** `carson worktree create` auto-syncs, branches, and isolates; `carson worktree remove` guards against unpushed work and active shells before cleanup.
47
+ - **Worktree-first** substantive work happens in worktrees, not on `main`.
48
+ - **Carson-owned operations** — Carson owns worktree and delivery operations in governed repositories.
49
+ - **Self-diagnosing output** every block should say what happened and the exact next command.
50
+ - **Outsider boundary** — Carson governs repositories without becoming a host-repository runtime dependency.
61
51
 
62
52
  ## Quickstart
63
53
 
64
- Prerequisites: Ruby `>= 3.4`, `git`, and `gem` in your PATH. `gh` (GitHub CLI) is recommended for full review governance features.
54
+ Prerequisites: Ruby `>= 3.4`, `git`, and `gem` in your `PATH`. `gh` (GitHub CLI) is recommended for review governance features.
65
55
 
66
56
  ```bash
67
57
  gem install carson
68
- ```
58
+ carson onboard your/repo/path
69
59
 
70
- **Onboard a repository:**
60
+ # Optional: switch from the default remote authority
61
+ carson repo authority local
71
62
 
72
- ```bash
73
- carson onboard /path/to/your-repo
74
- ```
63
+ carson worktree create your-worktree
64
+ cd your/repo/path/.claude/worktrees/your-worktree
75
65
 
76
- On first run, Carson walks you through setup — remote, main branch, workflow style, merge method — then installs hooks, syncs templates, and runs an initial audit.
66
+ # work, test, commit
67
+ carson deliver --merge
77
68
 
78
- After `carson onboard`, your repository has:
79
- - Git hooks that run `carson audit` on every commit.
80
- - Managed `.github/*` templates synchronised from Carson.
81
- - An initial governance audit report.
69
+ cd your/repo/path
70
+ carson worktree remove your-worktree
71
+ carson prune
72
+ ```
82
73
 
83
- Commit the generated `.github/*` changes, and the repository is governed.
74
+ By default, repositories onboard as `remote`. In `remote`, `deliver` lands through remote `main`. In `local`, the same loop lands on local `main` and then pushes `main` to the remote as backup.
84
75
 
85
- **Govern your portfolio.** Once repositories are onboarded, `carson govern` is your recurring command. Run it whenever you want Carson to triage open PRs, enforce review policy, and dispatch coding agents across all governed repos:
76
+ ## Portfolio Layer
77
+
78
+ Single-repo depth comes first. Once multiple repositories are onboarded, the same discipline scales out across them:
86
79
 
87
80
  ```bash
88
- carson govern --dry-run # preview what Carson would do, change nothing
89
- carson govern # triage PRs, merge ready ones, dispatch agents
90
- carson govern --loop 300 # run continuously, cycling every 5 minutes
81
+ carson status --all
82
+ carson refresh --all
83
+ carson govern --dry-run
91
84
  ```
92
85
 
86
+ `carson govern` is the portfolio layer. It triages open PRs, merges what is ready, dispatches agents to fix what is failing, and reports what needs human judgement.
87
+
93
88
  ## Where to Read Next
94
89
 
95
- - **MANUAL.md** — installation, first-time setup, CI configuration, daily operations, full command reference, troubleshooting.
90
+ - **MANUAL.md** — installation, setup, operating strategies, daily workflows, command reference, troubleshooting.
96
91
  - **API.md** — formal interface contract: commands, exit codes, configuration schema.
97
92
 
98
93
  ## Support
data/RELEASE.md CHANGED
@@ -5,6 +5,29 @@ Release-note scope rule:
5
5
  - `RELEASE.md` records only version deltas, breaking changes, and migration actions.
6
6
  - Operational usage guides live in `MANUAL.md` and `API.md`.
7
7
 
8
+ ## 3.22.1
9
+
10
+ ### What changed
11
+
12
+ - **Template sync moved into deliver** — `deliver!` now runs `template_apply!` before push, restoring template drift detection that was lost when 3.21.0 added `--no-verify` to `push_branch!`. The pre-push hook's `template apply --push-prep` block was silently skipped; managed files with drifted content could reach the remote undetected. Canonical content is now written and committed automatically before the push.
13
+
14
+ ### No migration required
15
+
16
+ ## 3.22.0
17
+
18
+ ### What changed
19
+
20
+ - **Command-guard auto-install at CLI startup** — Carson now installs the command-guard hook automatically when any CLI command runs, removing the need for a manual `carson refresh` after install. The guard is installed once and skipped on subsequent invocations.
21
+ - **Stale worktree sweep before portfolio safety check** — `refresh --all` now sweeps stale worktrees before checking repo safety, preventing false "active worktree" skips for worktrees whose branches have already been merged.
22
+ - **Nested config path fix for merge method** — `govern.merge.method` is now read from the correct nested config path instead of the top-level key, fixing repos where the merge method setting was silently ignored.
23
+ - **Deliver proceeds when no CI checks configured** — `deliver --merge` no longer blocks on repos with no CI checks. Previously it waited indefinitely for checks that would never arrive.
24
+ - **Rebase-merge orphan branch pruning** — `prune` now detects branches absorbed into main via rebase merge (tip commit reachable from main) and cleans them up, not just squash-merged branches.
25
+ - **Pluralisation fix** — corrected "branchs" → "branches" in prune and status output.
26
+
27
+ ### UX improvement
28
+
29
+ - Carson is now fully self-configuring: installing the gem and running any command sets up all safety guards automatically. Batch operations on portfolios no longer false-skip repos with stale worktrees. Repos using rebase merge keep their branch list clean without manual intervention.
30
+
8
31
  ## 3.21.1
9
32
 
10
33
  ### What changed
@@ -16,7 +39,7 @@ Release-note scope rule:
16
39
  ### What changed
17
40
 
18
41
  - **Command guard for governed repositories** — Carson now detects and blocks raw `git push` and `gh pr create/merge` commands in governed repos, redirecting agents to `carson deliver` instead. Three enforcement layers:
19
- - **Pre-push hook** — blocks raw `git push` in governed repos. Carson sets `CARSON_PUSH=1` internally so its own pushes pass through.
42
+ - **Pre-push hook** — blocks raw `git push` unconditionally in governed repos. Carson uses `--no-verify` internally to skip its own hook. *(Side effect: `--no-verify` also skips the hook's `template apply --push-prep` block — template sync moved into `deliver!` in a later release to restore coverage.)*
20
43
  - **Command guard script** — a Claude Code `PreToolUse` hook that intercepts `gh pr create` and `gh pr merge` Bash commands in governed repos.
21
44
  - **Existing pre-push guard** — the main/master branch push block now uses the same `BLOCKED` message format with explicit recovery guidance.
22
45
  - **`with_env_var` helper** — new Runtime utility for temporarily setting environment variables with guaranteed cleanup.
data/SKILL.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Carson Skill
2
2
 
3
- You are working in a repository governed by Carson — a deterministic governance runtime. Carson handles git hooks, PR triage, agent dispatch, merge, and cleanup. You provide the intelligence; Carson provides the infrastructure.
3
+ You are working in a repository governed by Carson — an autonomous git strategist and repositories governor. Carson handles git hooks, PR triage, agent dispatch, merge, and cleanup. You provide the intelligence; Carson provides the infrastructure.
4
4
 
5
5
  ## When to use Carson commands
6
6
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.21.1
1
+ 3.22.1
data/carson.gemspec CHANGED
@@ -7,8 +7,8 @@ Gem::Specification.new do |spec|
7
7
  spec.version = Carson::VERSION
8
8
  spec.authors = [ "Hailei Wang", "Codex", "Claude Code" ]
9
9
  spec.email = [ "wanghailei@users.noreply.github.com" ]
10
- spec.summary = "Autonomous repository governance — you write the code, Carson manages everything else."
11
- spec.description = "Carson is a governance runtime that lives outside the repositories it governs — no Carson-owned artefacts in your repo. On every commit, managed hooks enforce centralised lint policy and review gates. At portfolio level, carson govern triages every open PR across your registered repositories: merge what's ready, dispatch coding agents to fix what's failing, escalate what needs human judgement. One command, all your projects, unmanned."
10
+ spec.summary = "Autonomous git strategist and repositories governor — you write the code, Carson manages everything else."
11
+ spec.description = "Carson is an autonomous git strategist and repositories governor that lives outside the repositories it governs — no Carson-owned artefacts in your repo. As strategist, Carson knows when to branch, how to isolate concurrent work, and how to recover from failures. As governor, it enforces review gates, manages templates, and triages every open PR across your portfolio: merge what's ready, dispatch coding agents to fix what's failing, escalate what needs human judgement. One command, all your projects, unmanned."
12
12
  spec.homepage = "https://github.com/wanghailei/carson"
13
13
  spec.license = "PolyForm-Shield-1.0.0"
14
14
  spec.required_ruby_version = ">= 3.4"
@@ -29,8 +29,6 @@ Gem::Specification.new do |spec|
29
29
  spec.executables = [ "carson" ]
30
30
  spec.require_paths = [ "lib" ]
31
31
  spec.files = Dir.glob( "{lib,exe,templates,hooks}/**/*", File::FNM_DOTMATCH ).select { |path| File.file?( path ) } + [
32
- ".github/copilot-instructions.md",
33
- ".github/pull_request_template.md",
34
32
  ".github/workflows/carson_policy.yml",
35
33
  "README.md",
36
34
  "MANUAL.md",
data/hooks/command-guard CHANGED
@@ -53,6 +53,6 @@ if ! grep -qF "\"$normalised\"" "$config_file" 2>/dev/null; then
53
53
  fi
54
54
 
55
55
  # This is a raw gh pr command in a governed repo — block it.
56
- echo "BLOCKED: raw \`gh pr create/merge\` in a Carson-governed repository." >&2
56
+ echo "This repo is Carson-governed — use \`carson deliver\` instead of raw \`gh pr\`." >&2
57
57
  echo "Use \`carson deliver\` instead — it handles push, PR, and merge with safety guards." >&2
58
58
  exit 2
data/hooks/pre-push CHANGED
@@ -4,9 +4,9 @@
4
4
  # Guards:
5
5
  # 1. Blocks direct push to main/master refs.
6
6
  # 2. Blocks raw git push in governed repos — agents must use `carson deliver`.
7
- # Carson sets CARSON_PUSH=1 internally so its own pushes pass through.
7
+ # Carson bypasses via --no-verify internally. No env-var signal to spoof.
8
8
  #
9
- # Bypass (emergency only): git push --no-verify
9
+ # Bypass: git push --no-verify
10
10
  set -euo pipefail
11
11
 
12
12
  hooks_dir="$(cd "$(dirname "$0")" && pwd)"
@@ -21,9 +21,9 @@ has_commit_push=false
21
21
  while read -r local_ref local_sha remote_ref remote_sha; do
22
22
  case "$remote_ref" in
23
23
  refs/heads/main|refs/heads/master)
24
- echo "BLOCKED: direct push to ${remote_ref#refs/heads/} is not allowed." >&2
24
+ echo "Pushes to ${remote_ref#refs/heads/} go through PRs, not direct push." >&2
25
25
  echo "Use \`carson deliver\` instead — it handles push, PR, and merge with safety guards." >&2
26
- echo "Bypass (emergency only): git push --no-verify" >&2
26
+ echo "Bypass: git push --no-verify" >&2
27
27
  exit 1
28
28
  ;;
29
29
  esac
@@ -31,23 +31,20 @@ while read -r local_ref local_sha remote_ref remote_sha; do
31
31
  done
32
32
 
33
33
  # --- Guard 2: block raw git push in governed repos ---
34
- # Carson sets CARSON_PUSH=1 when pushing internally via `deliver`.
35
- # If the variable is absent, this is a raw git push from an agent or human.
34
+ # All pushes in governed repos are blocked unconditionally.
35
+ # Carson bypasses this hook via --no-verify when pushing internally.
36
+ # No env-var bypass — cannot be spoofed.
36
37
 
37
- if [[ -z "${CARSON_PUSH:-}" ]]; then
38
- config_file="${HOME}/.carson/config.json"
39
- if [[ -f "$config_file" ]]; then
40
- repo_root="$(git rev-parse --show-toplevel 2>/dev/null || echo "")"
41
- if [[ -n "$repo_root" ]]; then
42
- # Check if this repo appears in govern.repos.
43
- # Uses a simple grep against the JSON no jq dependency required.
44
- normalised="$(cd "$repo_root" && pwd -P)"
45
- if grep -qF "\"$normalised\"" "$config_file" 2>/dev/null; then
46
- echo "BLOCKED: raw \`git push\` in a Carson-governed repository." >&2
47
- echo "Use \`carson deliver\` instead — it handles push, PR, and merge with safety guards." >&2
48
- echo "Bypass (emergency only): git push --no-verify" >&2
49
- exit 1
50
- fi
38
+ config_file="${HOME}/.carson/config.json"
39
+ if [[ -f "$config_file" ]]; then
40
+ repo_root="$(git rev-parse --show-toplevel 2>/dev/null || echo "")"
41
+ if [[ -n "$repo_root" ]]; then
42
+ normalised="$(cd "$repo_root" && pwd -P)"
43
+ if grep -qF "\"$normalised\"" "$config_file" 2>/dev/null; then
44
+ echo "This repo is Carson-governed use \`carson deliver\` instead of raw \`git push\`." >&2
45
+ echo "Use \`carson deliver\` instead — it handles push, PR, and merge with safety guards." >&2
46
+ echo "Bypass: git push --no-verify" >&2
47
+ exit 1
51
48
  fi
52
49
  fi
53
50
  fi