carson 1.0.1 → 2.7.0
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 +4 -4
- data/.github/copilot-instructions.md +1 -12
- data/.github/workflows/carson_policy.yml +1 -1
- data/API.md +50 -13
- data/MANUAL.md +140 -65
- data/README.md +108 -35
- data/RELEASE.md +410 -6
- data/SKILL.md +102 -0
- data/VERSION +1 -1
- data/carson.gemspec +3 -1
- data/{assets/hooks → hooks}/pre-commit +1 -1
- data/{assets/hooks → hooks}/pre-merge-commit +4 -0
- data/{assets/hooks → hooks}/pre-push +4 -0
- data/{assets/hooks → hooks}/prepare-commit-msg +4 -0
- data/icon.svg +651 -0
- data/lib/carson/adapters/agent.rb +15 -0
- data/lib/carson/adapters/claude.rb +45 -0
- data/lib/carson/adapters/codex.rb +45 -0
- data/lib/carson/adapters/prompt.rb +60 -0
- data/lib/carson/cli.rb +65 -20
- data/lib/carson/config.rb +100 -14
- data/lib/carson/policy/ruby/lint.rb +1 -1
- data/lib/carson/runtime/audit.rb +33 -10
- data/lib/carson/runtime/govern.rb +641 -0
- data/lib/carson/runtime/lint.rb +3 -3
- data/lib/carson/runtime/local.rb +51 -12
- data/lib/carson/runtime/review/gate_support.rb +14 -1
- data/lib/carson/runtime/review.rb +3 -3
- data/lib/carson/runtime.rb +10 -3
- data/lib/carson.rb +9 -0
- data/templates/.github/AGENTS.md +1 -0
- data/templates/.github/CLAUDE.md +1 -0
- data/templates/.github/carson-instructions.md +12 -0
- data/templates/.github/copilot-instructions.md +1 -12
- metadata +15 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fdf6978ed4ecdbef69aba67dba84b678d1145038ff47925a1dfbfdc777170135
|
|
4
|
+
data.tar.gz: a79ce86bc59f79528e0bf73d51098cd8f1ef1c96c2034d98900c282e26d047c7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5c11f2bd0fa18ca630b6c51bc23aae320e96bc63cfd24359c685b4664dd45594c68e3333554a9628c0411833de6c4a1779ef18cdd1d6b048516b116848a88484
|
|
7
|
+
data.tar.gz: c6d3810f02303d1dbe6f614bc85b6d4a4186a171fa08b9705f66a86cac206eaf1f7c63e67c8a346d5ec9fd0a4c3454fbedbf5fed7275e46a9f1d03f5bd6d55fb
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
- GitHub rulesets and required checks are merge authority.
|
|
4
|
-
- Carson runs as an outsider runtime for hook health, main sync, scope integrity, and gh visibility.
|
|
5
|
-
- Before commit and before push, run `carson audit`.
|
|
6
|
-
- At session start and again immediately before merge recommendation, run `gh pr list --state open --limit 50` and re-confirm active PR priorities.
|
|
7
|
-
- Before merge recommendation, run `carson review gate`; it enforces warm-up wait, unresolved-thread convergence, and `Disposition:` dispositions for actionable top-level findings.
|
|
8
|
-
- Actionable findings are unresolved review threads, any non-author `CHANGES_REQUESTED` review, or non-author comments/reviews with risk keywords (`bug`, `security`, `incorrect`, `block`, `fail`, `regression`).
|
|
9
|
-
- `Disposition:` dispositions must include one token (`accepted`, `rejected`, `deferred`) and the target review URL.
|
|
10
|
-
- Scheduled governance runs `carson review sweep` every 8 hours to track late actionable review activity on recent open/closed PRs.
|
|
11
|
-
- Do not treat green checks or `mergeStateStatus: CLEAN` as sufficient if unresolved review threads remain.
|
|
12
|
-
- Never suggest destructive operations on protected refs (`main`/`master`, local or remote).
|
|
1
|
+
Read `.github/carson-instructions.md` for repository governance rules enforced by Carson.
|
data/API.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# Carson API
|
|
2
2
|
|
|
3
3
|
This document defines Carson's user-facing interface contract for CLI commands, configuration inputs, and exit behaviour.
|
|
4
|
+
For operational usage and daily workflows, see `MANUAL.md`.
|
|
4
5
|
|
|
5
6
|
## Command interface
|
|
6
7
|
|
|
@@ -10,25 +11,53 @@ Command form:
|
|
|
10
11
|
carson <command> [subcommand] [arguments]
|
|
11
12
|
```
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
### Setup commands
|
|
15
|
+
|
|
16
|
+
| Command | Purpose |
|
|
17
|
+
|---|---|
|
|
18
|
+
| `carson lint setup --source <path-or-git-url> [--ref <git-ref>] [--force]` | Seed or refresh `~/.carson/lint` policy files from an explicit source. |
|
|
19
|
+
| `carson onboard [repo_path]` | Apply one-command baseline setup for a target git repository. |
|
|
20
|
+
| `carson prepare` | Install or refresh Carson-managed global hooks. |
|
|
21
|
+
| `carson refresh [repo_path]` | Re-apply hooks, templates, and audit after upgrading Carson. |
|
|
22
|
+
| `carson offboard [repo_path]` | Remove Carson-managed host artefacts and detach Carson hooks path where applicable. |
|
|
23
|
+
|
|
24
|
+
### Daily commands
|
|
14
25
|
|
|
15
26
|
| Command | Purpose |
|
|
16
27
|
|---|---|
|
|
17
|
-
| `carson version` | Print installed Carson version. |
|
|
18
|
-
| `carson init [repo_path]` | Apply one-command baseline setup for a target git repository. |
|
|
19
|
-
| `carson sync` | Fast-forward local `main` from configured remote when tree is clean. |
|
|
20
28
|
| `carson audit` | Evaluate governance status and generate report output. |
|
|
21
|
-
| `carson
|
|
22
|
-
| `carson check` | Run governance checks against current repository state. |
|
|
29
|
+
| `carson sync` | Fast-forward local `main` from configured remote when tree is clean. |
|
|
23
30
|
| `carson prune` | Remove stale local branches whose upstream refs no longer exist. |
|
|
24
31
|
| `carson template check` | Detect drift between managed templates and host `.github/*` files. |
|
|
25
32
|
| `carson template apply` | Write canonical managed template content into host `.github/*` files. |
|
|
26
|
-
|
|
33
|
+
|
|
34
|
+
### Govern commands
|
|
35
|
+
|
|
36
|
+
| Command | Purpose |
|
|
37
|
+
|---|---|
|
|
38
|
+
| `carson govern [--dry-run] [--json] [--loop SECONDS]` | Portfolio-level PR triage: classify, merge, dispatch agents, escalate. |
|
|
39
|
+
| `carson housekeep` | Sync main + prune stale branches (also runs automatically after govern merges). |
|
|
40
|
+
|
|
41
|
+
`--loop SECONDS` runs the govern cycle continuously, sleeping SECONDS between cycles. The loop isolates errors per cycle — a single failing cycle does not stop the daemon. `Ctrl-C` cleanly exits with a cycle count summary. SECONDS must be a positive integer.
|
|
42
|
+
|
|
43
|
+
`govern.merge.method` accepts `squash`, `merge`, or `rebase` (default: `squash`). Squash keeps main linear — one PR, one commit. When the target repository enforces linear history via branch protection, both `squash` and `rebase` are accepted by GitHub — only `merge` is rejected.
|
|
44
|
+
|
|
45
|
+
### Review commands
|
|
46
|
+
|
|
47
|
+
| Command | Purpose |
|
|
48
|
+
|---|---|
|
|
27
49
|
| `carson review gate` | Block until actionable review findings are resolved or convergence timeout is reached. |
|
|
28
50
|
| `carson review sweep` | Scan recent PR activity and update a rolling tracking issue for late actionable feedback. |
|
|
29
|
-
|
|
51
|
+
|
|
52
|
+
### Info commands
|
|
53
|
+
|
|
54
|
+
| Command | Purpose |
|
|
55
|
+
|---|---|
|
|
56
|
+
| `carson version` | Print installed Carson version. |
|
|
57
|
+
| `carson inspect` | Verify Carson-managed hook installation and repository setup. |
|
|
30
58
|
|
|
31
59
|
## Exit status contract
|
|
60
|
+
|
|
32
61
|
- `0`: success
|
|
33
62
|
- `1`: runtime/configuration/command error
|
|
34
63
|
- `2`: policy blocked (hard stop)
|
|
@@ -36,15 +65,21 @@ Supported commands:
|
|
|
36
65
|
Automation and CI integrations should treat exit `2` as an expected policy failure signal.
|
|
37
66
|
|
|
38
67
|
## Repository boundary contract
|
|
68
|
+
|
|
39
69
|
Blocked Carson artefacts in host repositories:
|
|
40
70
|
- `.carson.yml`
|
|
41
71
|
- `bin/carson`
|
|
42
72
|
- `.tools/carson/*`
|
|
43
73
|
|
|
44
74
|
Allowed Carson-managed persistence in host repositories:
|
|
45
|
-
-
|
|
75
|
+
- `.github/carson-instructions.md` — governance baseline (source of truth)
|
|
76
|
+
- `.github/copilot-instructions.md` — agent discovery pointer for Copilot
|
|
77
|
+
- `.github/CLAUDE.md` — agent discovery pointer for Claude Code
|
|
78
|
+
- `.github/AGENTS.md` — agent discovery pointer for Codex
|
|
79
|
+
- `.github/pull_request_template.md` — PR template
|
|
46
80
|
|
|
47
81
|
## Configuration interface
|
|
82
|
+
|
|
48
83
|
Default global configuration path:
|
|
49
84
|
- `~/.carson/config.json`
|
|
50
85
|
|
|
@@ -71,7 +106,7 @@ Environment overrides:
|
|
|
71
106
|
"enabled": true,
|
|
72
107
|
"globs": ["**/*.rb"],
|
|
73
108
|
"command": ["ruby", "/absolute/path/to/carson/lib/carson/policy/ruby/lint.rb", "{files}"],
|
|
74
|
-
"config_files": ["
|
|
109
|
+
"config_files": ["~/.carson/lint/rubocop.yml"]
|
|
75
110
|
}
|
|
76
111
|
}
|
|
77
112
|
}
|
|
@@ -84,7 +119,7 @@ Environment overrides:
|
|
|
84
119
|
- `command`: argv array executed without shell interpolation.
|
|
85
120
|
- `config_files`: required files that must exist before lint runs.
|
|
86
121
|
- `{files}` token: replaced with matched files; if omitted, matched files are appended at the end of argv.
|
|
87
|
-
- Default Ruby policy source is
|
|
122
|
+
- Default Ruby policy source is `~/.carson/lint/rubocop.yml`; Ruby execution logic is Carson-owned.
|
|
88
123
|
- Client repositories containing repo-local `.rubocop.yml` are hard-blocked by `carson audit` in outsider mode.
|
|
89
124
|
- Non-Ruby language entries (`javascript`, `css`, `html`, `erb`) are present but disabled by default.
|
|
90
125
|
|
|
@@ -101,14 +136,16 @@ Ruby source requirement for `carson lint setup` (when Ruby lint is enabled):
|
|
|
101
136
|
- `CODING/rubocop.yml` must exist in the source tree.
|
|
102
137
|
|
|
103
138
|
Policy layout requirement:
|
|
104
|
-
- Language policy files are stored directly under `CODING/` and copied to
|
|
139
|
+
- Language policy files are stored directly under `CODING/` and copied to `~/.carson/lint/` without language subdirectories.
|
|
105
140
|
|
|
106
141
|
## Output interface
|
|
142
|
+
|
|
107
143
|
Report output directory precedence:
|
|
108
|
-
- `~/.cache
|
|
144
|
+
- `~/.carson/cache`
|
|
109
145
|
- `TMPDIR/carson` (used when `HOME` is invalid and `TMPDIR` is absolute)
|
|
110
146
|
- `/tmp/carson` (fallback)
|
|
111
147
|
|
|
112
148
|
## Versioning and compatibility
|
|
149
|
+
|
|
113
150
|
- Pin Carson in automation by explicit release and version pair (`carson_ref`, `carson_version`).
|
|
114
151
|
- Review upgrade actions in `RELEASE.md` before moving to a newer minor or major version.
|
data/MANUAL.md
CHANGED
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
# Carson Manual
|
|
2
2
|
|
|
3
|
-
This manual
|
|
4
|
-
|
|
5
|
-
## Prerequisites
|
|
6
|
-
- Ruby `>= 4.0`
|
|
7
|
-
- `gem` in `PATH`
|
|
8
|
-
- `git` in `PATH`
|
|
9
|
-
- `gh` in `PATH` (recommended for full review governance features)
|
|
3
|
+
This manual covers installation, first-time setup, CI configuration, and daily operations.
|
|
4
|
+
For the mental model and command overview, see `README.md`. For formal interface definitions, see `API.md`.
|
|
10
5
|
|
|
11
6
|
## Install Carson
|
|
12
7
|
|
|
13
|
-
|
|
8
|
+
Prerequisites: Ruby `>= 4.0`, `gem` and `git` in `PATH`. `gh` (GitHub CLI) recommended for full review governance.
|
|
14
9
|
|
|
15
10
|
```bash
|
|
16
|
-
gem install --user-install carson
|
|
11
|
+
gem install --user-install carson
|
|
17
12
|
```
|
|
18
13
|
|
|
19
14
|
If `carson` is not found after installation:
|
|
@@ -22,53 +17,53 @@ If `carson` is not found after installation:
|
|
|
22
17
|
export PATH="$(ruby -e 'print Gem.user_dir')/bin:$PATH"
|
|
23
18
|
```
|
|
24
19
|
|
|
25
|
-
Verify
|
|
20
|
+
Verify:
|
|
26
21
|
|
|
27
22
|
```bash
|
|
28
23
|
carson version
|
|
29
24
|
```
|
|
30
25
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
## First-Time Setup
|
|
27
|
+
|
|
28
|
+
### Step 1: Prepare your lint policy
|
|
34
29
|
|
|
35
|
-
|
|
36
|
-
Assume your repository path is `/local/path/of/repo`.
|
|
30
|
+
Carson enforces lint rules from a central policy source — a directory or git repository you control that contains a `CODING/` folder. For Ruby governance, the required file is `CODING/rubocop.yml`.
|
|
37
31
|
|
|
38
|
-
|
|
32
|
+
Run `lint setup` to copy policy files into `~/.carson/lint/`:
|
|
39
33
|
|
|
40
34
|
```bash
|
|
41
|
-
carson lint setup --source /path/to/
|
|
35
|
+
carson lint setup --source /path/to/your-policy-repo
|
|
42
36
|
```
|
|
43
37
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
38
|
+
After this command, `~/.carson/lint/rubocop.yml` exists and is ready for Carson to use. Every governed repository will reference these same policy files — this is how Carson keeps lint consistent.
|
|
39
|
+
|
|
40
|
+
Options:
|
|
41
|
+
- `--source <path-or-git-url>` — where to read policy files from (required).
|
|
42
|
+
- `--ref <git-ref>` — branch or tag when `--source` is a git URL.
|
|
43
|
+
- `--force` — overwrite existing `~/.carson/lint` files.
|
|
49
44
|
|
|
50
|
-
|
|
51
|
-
- Ruby lint policy data lives only in `~/AI/CODING/rubocop.yml`; execution logic is Carson-owned.
|
|
52
|
-
- Client repositories must not contain repo-local `.rubocop.yml`; `carson audit` blocks when it exists.
|
|
53
|
-
- Non-Ruby language entries remain configured but disabled by default.
|
|
45
|
+
Policy layout: language config files sit directly under `CODING/` (flat layout, no language subfolders). Non-Ruby entries are present but disabled by default.
|
|
54
46
|
|
|
55
|
-
|
|
47
|
+
### Step 2: Onboard a repository
|
|
56
48
|
|
|
57
49
|
```bash
|
|
58
|
-
carson
|
|
50
|
+
carson onboard /path/to/your-repo
|
|
59
51
|
```
|
|
60
52
|
|
|
61
|
-
`
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
-
|
|
67
|
-
-
|
|
53
|
+
`onboard` performs:
|
|
54
|
+
- Remote alignment using configured `git.remote` (default `github`).
|
|
55
|
+
- Hook installation under `~/.carson/hooks/<version>/`.
|
|
56
|
+
- Repository `core.hooksPath` alignment to Carson global hooks.
|
|
57
|
+
- Commit-time governance gate via managed `pre-commit` hook.
|
|
58
|
+
- Managed `.github/*` template synchronisation.
|
|
59
|
+
- Initial governance audit.
|
|
60
|
+
|
|
61
|
+
### Step 3: Commit generated files
|
|
62
|
+
|
|
63
|
+
After `onboard`, commit the generated `.github/*` changes in your repository. From this point the repository is governed.
|
|
68
64
|
|
|
69
|
-
|
|
65
|
+
## CI Setup
|
|
70
66
|
|
|
71
|
-
## Pin Carson in CI
|
|
72
67
|
Use the reusable workflow with explicit release pins:
|
|
73
68
|
|
|
74
69
|
```yaml
|
|
@@ -79,7 +74,7 @@ on:
|
|
|
79
74
|
|
|
80
75
|
jobs:
|
|
81
76
|
governance:
|
|
82
|
-
uses: wanghailei/carson/.github/workflows/carson_policy.yml.
|
|
77
|
+
uses: wanghailei/carson/.github/workflows/carson_policy.yml@v1.0.0
|
|
83
78
|
secrets:
|
|
84
79
|
CARSON_READ_TOKEN: ${{ secrets.CARSON_READ_TOKEN }}
|
|
85
80
|
with:
|
|
@@ -88,20 +83,22 @@ jobs:
|
|
|
88
83
|
rubocop_version: "1.81.0"
|
|
89
84
|
```
|
|
90
85
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
86
|
+
Notes:
|
|
87
|
+
- When upgrading Carson, update both `carson_ref` and `carson_version` together.
|
|
88
|
+
- `CARSON_READ_TOKEN` must have read access to your policy source repository so CI can run `carson lint setup`.
|
|
89
|
+
- The reusable workflow installs a pinned RuboCop gem before `carson audit`; mirror the same pin in host governance workflows for deterministic checks.
|
|
94
90
|
|
|
95
|
-
## Daily
|
|
96
|
-
|
|
91
|
+
## Daily Operations
|
|
92
|
+
|
|
93
|
+
**Start of work:**
|
|
97
94
|
|
|
98
95
|
```bash
|
|
99
|
-
carson sync
|
|
100
|
-
carson lint setup --source /path/to/
|
|
101
|
-
carson audit
|
|
96
|
+
carson sync # fast-forward local main
|
|
97
|
+
carson lint setup --source /path/to/your-policy-repo # refresh policy if needed
|
|
98
|
+
carson audit # full governance check
|
|
102
99
|
```
|
|
103
100
|
|
|
104
|
-
Before push or PR update
|
|
101
|
+
**Before push or PR update:**
|
|
105
102
|
|
|
106
103
|
```bash
|
|
107
104
|
carson audit
|
|
@@ -114,57 +111,135 @@ If template drift is detected:
|
|
|
114
111
|
carson template apply
|
|
115
112
|
```
|
|
116
113
|
|
|
117
|
-
Before merge
|
|
114
|
+
**Before merge:**
|
|
118
115
|
|
|
119
116
|
```bash
|
|
120
|
-
gh pr list --state open --limit 50
|
|
121
117
|
carson review gate
|
|
122
118
|
```
|
|
123
119
|
|
|
124
|
-
|
|
120
|
+
**Periodic maintenance:**
|
|
125
121
|
|
|
126
122
|
```bash
|
|
127
|
-
carson review sweep
|
|
123
|
+
carson review sweep # update tracking issue for late review feedback
|
|
124
|
+
carson prune # remove stale local branches
|
|
128
125
|
```
|
|
129
126
|
|
|
130
|
-
|
|
127
|
+
## Running Carson Govern Continuously
|
|
128
|
+
|
|
129
|
+
Use `--loop SECONDS` to run `carson govern` as a persistent daemon that cycles on a schedule:
|
|
131
130
|
|
|
132
131
|
```bash
|
|
133
|
-
carson
|
|
132
|
+
carson govern --loop 300 # cycle every 5 minutes
|
|
133
|
+
carson govern --loop 300 --dry-run # observe mode, no merges or dispatches
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
The loop is built-in and cross-platform — no cron, launchd, or Task Scheduler required. Run it in a terminal, tmux, screen, or as a system service.
|
|
137
|
+
|
|
138
|
+
Each cycle runs independently: if one cycle fails (network error, GitHub API timeout), the error is logged and the next cycle proceeds normally. Press `Ctrl-C` to stop — Carson exits cleanly with a cycle count summary.
|
|
139
|
+
|
|
140
|
+
## Merge Method and Linear History
|
|
141
|
+
|
|
142
|
+
Carson's `govern.merge.method` controls how `carson govern` merges ready PRs. The options are `squash`, `merge`, and `rebase` (default: `squash`). Set this in `~/.carson/config.json`:
|
|
143
|
+
|
|
144
|
+
```json
|
|
145
|
+
{
|
|
146
|
+
"govern": {
|
|
147
|
+
"merge": {
|
|
148
|
+
"method": "squash"
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
134
152
|
```
|
|
135
153
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
- `
|
|
139
|
-
- `
|
|
154
|
+
**Why squash is the default.** Squash-to-main keeps history linear: one PR = one commit on main. Every commit on main corresponds to a reviewed, CI-passing unit of work. The benefits:
|
|
155
|
+
|
|
156
|
+
- `git log --oneline` on main tells the full story without merge noise or work-in-progress commits.
|
|
157
|
+
- Every commit is individually revertable — `git revert <sha>` undoes exactly one PR.
|
|
158
|
+
- `git bisect` operates on meaningful boundaries, not intermediate fixup commits.
|
|
159
|
+
- Individual branch commits are still preserved in the PR on GitHub for full traceability.
|
|
160
|
+
|
|
161
|
+
**When to use other methods:**
|
|
162
|
+
|
|
163
|
+
- `rebase` — if you want to preserve individual commits from the branch on main. Both `squash` and `rebase` are compatible with GitHub's "Require linear history" branch protection — only `merge` is rejected.
|
|
164
|
+
- `merge` — if you want explicit merge commits. This creates a non-linear graph but preserves branch topology.
|
|
165
|
+
|
|
166
|
+
**Important:** Carson's merge method must match your GitHub repository's allowed merge types. If your repo only allows squash merges and Carson is set to `merge`, govern will fail when it tries to auto-merge. Check your repository settings under Settings > General > Pull Requests.
|
|
140
167
|
|
|
141
|
-
|
|
168
|
+
## Agent Discovery
|
|
169
|
+
|
|
170
|
+
Carson writes managed files that help interactive agents (Claude Code, Codex, Copilot) discover the governance system when they work in a governed repository.
|
|
171
|
+
|
|
172
|
+
**How it works:**
|
|
173
|
+
|
|
174
|
+
- `.github/carson-instructions.md` — the single source of truth containing the full governance baseline. This file tells agents what Carson is, what commands to run, and what rules to follow.
|
|
175
|
+
- `.github/CLAUDE.md` — read by Claude Code at session start. Points to `carson-instructions.md`.
|
|
176
|
+
- `.github/AGENTS.md` — read by Codex at session start. Points to `carson-instructions.md`.
|
|
177
|
+
- `.github/copilot-instructions.md` — read by GitHub Copilot. Points to `carson-instructions.md`.
|
|
178
|
+
|
|
179
|
+
Each agent reads its own expected filename and follows the reference to the shared baseline. One file to maintain, zero drift across agents.
|
|
180
|
+
|
|
181
|
+
All four files are managed templates — `carson template check` detects drift, `carson template apply` writes them, and `carson offboard` removes them.
|
|
182
|
+
|
|
183
|
+
**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.
|
|
184
|
+
|
|
185
|
+
## Configuration
|
|
186
|
+
|
|
187
|
+
Default global config path: `~/.carson/config.json`.
|
|
188
|
+
|
|
189
|
+
Precedence (highest wins): environment variables > config file > built-in defaults.
|
|
190
|
+
|
|
191
|
+
Override the config file path with `CARSON_CONFIG_FILE=/absolute/path/to/config.json`.
|
|
192
|
+
|
|
193
|
+
Common environment overrides:
|
|
194
|
+
|
|
195
|
+
| Variable | Purpose |
|
|
196
|
+
|---|---|
|
|
197
|
+
| `CARSON_HOOKS_BASE_PATH` | Custom hooks installation directory. |
|
|
198
|
+
| `CARSON_REVIEW_WAIT_SECONDS` | Initial wait before first review poll. |
|
|
199
|
+
| `CARSON_REVIEW_POLL_SECONDS` | Interval between review polls. |
|
|
200
|
+
| `CARSON_REVIEW_MAX_POLLS` | Maximum review poll attempts. |
|
|
201
|
+
| `CARSON_REVIEW_DISPOSITION_PREFIX` | Required prefix for disposition comments. |
|
|
202
|
+
| `CARSON_REVIEW_SWEEP_WINDOW_DAYS` | Lookback window for review sweep. |
|
|
203
|
+
| `CARSON_REVIEW_SWEEP_STATES` | PR states to include in sweep. |
|
|
204
|
+
| `CARSON_RUBY_INDENTATION` | Ruby indentation policy (`tabs`, `spaces`, or `either`). |
|
|
205
|
+
|
|
206
|
+
For the full configuration schema and `lint.languages` definition, see `API.md`.
|
|
142
207
|
|
|
143
208
|
## Troubleshooting
|
|
144
|
-
|
|
209
|
+
|
|
210
|
+
**`carson: command not found`**
|
|
145
211
|
- Confirm Ruby and gem installation.
|
|
146
212
|
- Confirm `$(ruby -e 'print Gem.user_dir')/bin` is in `PATH`.
|
|
147
213
|
|
|
148
|
-
|
|
214
|
+
**`review gate` fails on actionable comments**
|
|
149
215
|
- Respond with a valid disposition comment using the required prefix.
|
|
150
216
|
- Re-run `carson review gate`.
|
|
151
217
|
|
|
152
|
-
Template drift blocks
|
|
218
|
+
**Template drift blocks**
|
|
153
219
|
|
|
154
220
|
```bash
|
|
155
221
|
carson template apply
|
|
156
222
|
carson template check
|
|
157
223
|
```
|
|
158
224
|
|
|
159
|
-
|
|
225
|
+
**Audit blocks on repo-local `.rubocop.yml`**
|
|
226
|
+
- Carson hard-blocks governed repositories that contain their own `.rubocop.yml`. Remove the repo-local file and rely on the central policy in `~/.carson/lint/rubocop.yml`.
|
|
227
|
+
|
|
228
|
+
**Hook version mismatch after upgrade**
|
|
229
|
+
- Run `carson refresh` to re-apply hooks and templates for the new Carson version.
|
|
230
|
+
|
|
231
|
+
## Offboard a Repository
|
|
232
|
+
|
|
160
233
|
To retire Carson from a repository:
|
|
161
234
|
|
|
162
235
|
```bash
|
|
163
|
-
carson offboard /
|
|
236
|
+
carson offboard /path/to/your-repo
|
|
164
237
|
```
|
|
165
238
|
|
|
166
239
|
This removes Carson-managed host artefacts and unsets `core.hooksPath` when it points to Carson-managed global hooks.
|
|
167
240
|
|
|
168
|
-
## Related
|
|
169
|
-
|
|
241
|
+
## Related Documents
|
|
242
|
+
|
|
243
|
+
- Mental model and command overview: `README.md`
|
|
244
|
+
- Formal interface contract: `API.md`
|
|
170
245
|
- Release notes: `RELEASE.md`
|