carson 1.0.1 → 2.6.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 +350 -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
data/SKILL.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Carson Skill
|
|
2
|
+
|
|
3
|
+
You are working in a repository governed by Carson — a deterministic governance runtime. Carson handles git hooks, lint enforcement, PR triage, agent dispatch, merge, and cleanup. You provide the intelligence; Carson provides the infrastructure.
|
|
4
|
+
|
|
5
|
+
## When to use Carson commands
|
|
6
|
+
|
|
7
|
+
| User intent | Command | What happens |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| "Check if my code is ready" | `carson audit` | Lint, scope, boundary checks. Exit 0 = clean. Exit 2 = policy block. |
|
|
10
|
+
| "Is my PR mergeable?" | `carson review gate` | Polls for unresolved review threads and actionable comments. Blocks until resolved. |
|
|
11
|
+
| "What's happening across my repos?" | `carson govern --dry-run` | Classifies every open PR without taking action. Read the summary. |
|
|
12
|
+
| "Run governance continuously" | `carson govern --loop 300` | Triage-dispatch-merge cycle every 300 seconds. Ctrl-C to stop. |
|
|
13
|
+
| "Merge ready PRs and dispatch fixes" | `carson govern` | Full autonomous cycle: merge, dispatch agents, escalate, housekeep. |
|
|
14
|
+
| "Set up Carson for a repo" | `carson onboard /path/to/repo` | Installs hooks, syncs templates, runs first audit. |
|
|
15
|
+
| "Refresh after upgrading Carson" | `carson refresh` | Re-applies hooks and templates for the current version. |
|
|
16
|
+
| "Update my local main" | `carson sync` | Fast-forward local main from remote. Blocks if tree is dirty. |
|
|
17
|
+
| "Clean up stale branches" | `carson prune` | Removes local branches whose upstream is gone. |
|
|
18
|
+
| "Check template drift" | `carson template check` then `carson template apply` | Detect and fix .github/* drift. |
|
|
19
|
+
| "Remove Carson from a repo" | `carson offboard /path/to/repo` | Removes hooks and managed files. |
|
|
20
|
+
| "What version?" | `carson version` | Prints installed version with ⧓ badge. |
|
|
21
|
+
| "Verify hook installation" | `carson inspect` | Checks hooks path, file existence, permissions. |
|
|
22
|
+
|
|
23
|
+
## Exit codes
|
|
24
|
+
|
|
25
|
+
- `0` — success, all clear.
|
|
26
|
+
- `1` — runtime or configuration error. Read the error message.
|
|
27
|
+
- `2` — policy block. Something must be fixed before proceeding (lint violation, unresolved review, boundary breach).
|
|
28
|
+
|
|
29
|
+
When you see exit 2, do NOT bypass it. Read the output, fix the root cause, and re-run.
|
|
30
|
+
|
|
31
|
+
## Interpreting audit output
|
|
32
|
+
|
|
33
|
+
Carson audit output is structured as labelled key-value lines prefixed with ⧓. Key sections:
|
|
34
|
+
|
|
35
|
+
- **Working Tree** — staged/unstaged status.
|
|
36
|
+
- **Local Lint Quality** — per-language lint results. `lint_ruby_status: ok` means clean.
|
|
37
|
+
- **Main Sync Status** — whether local main matches remote. If ahead, reset drift before committing.
|
|
38
|
+
- **Scope Integrity Guard** — checks that commits stay within a single business intent and scope group.
|
|
39
|
+
- **Audit Result** — final verdict: `status: ok` (clean), `status: attention` (advisory, not blocking), `status: block` (must fix).
|
|
40
|
+
|
|
41
|
+
## Interpreting govern output
|
|
42
|
+
|
|
43
|
+
`carson govern --dry-run` classifies each PR:
|
|
44
|
+
|
|
45
|
+
- **ready** → would merge. All gates pass.
|
|
46
|
+
- **ci_failing** → would dispatch agent to fix CI.
|
|
47
|
+
- **review_blocked** → would dispatch agent to address review comments.
|
|
48
|
+
- **pending** → skip. Checks still running (within check_wait window).
|
|
49
|
+
- **needs_attention** → escalate. Needs human judgement.
|
|
50
|
+
|
|
51
|
+
The summary line: `govern_summary: repos=N prs=N ready=N blocked=N`
|
|
52
|
+
|
|
53
|
+
## Configuration
|
|
54
|
+
|
|
55
|
+
Single config file: `~/.carson/config.json`. Key settings:
|
|
56
|
+
|
|
57
|
+
```json
|
|
58
|
+
{
|
|
59
|
+
"govern": {
|
|
60
|
+
"repos": ["~/Dev/repo-a", "~/Dev/repo-b"],
|
|
61
|
+
"merge": { "method": "rebase" },
|
|
62
|
+
"agent": { "provider": "auto" }
|
|
63
|
+
},
|
|
64
|
+
"review": {
|
|
65
|
+
"bot_usernames": ["gemini-code-assist"]
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
- `govern.merge.method` — must match GitHub branch protection. Use `rebase` if linear history is required.
|
|
71
|
+
- `govern.repos` — list of repo paths for portfolio-level governance. Empty = current repo only.
|
|
72
|
+
- `govern.agent.provider` — `auto` (tries codex then claude), `codex`, or `claude`.
|
|
73
|
+
- `review.bot_usernames` — bot logins to ignore in review gate. Use GraphQL login format (no `[bot]` suffix).
|
|
74
|
+
|
|
75
|
+
Environment overrides take precedence over config file. Common ones:
|
|
76
|
+
- `CARSON_GOVERN_MERGE_METHOD`
|
|
77
|
+
- `CARSON_REVIEW_BOT_USERNAMES`
|
|
78
|
+
- `CARSON_GOVERN_CHECK_WAIT`
|
|
79
|
+
|
|
80
|
+
## Common scenarios
|
|
81
|
+
|
|
82
|
+
**Commit blocked by audit:**
|
|
83
|
+
Run `carson audit`, read the block reason, fix it, then `git add` and `git commit` again. Do not skip the hook.
|
|
84
|
+
|
|
85
|
+
**Review gate blocked:**
|
|
86
|
+
Run `carson review gate` to see which comments need disposition. Respond to each with the required prefix (default: `Disposition:`), then re-run.
|
|
87
|
+
|
|
88
|
+
**Local main drifted ahead of remote:**
|
|
89
|
+
This means a commit was made to main that couldn't be pushed (branch protection). Reset: `git checkout main && git reset --hard github/main`.
|
|
90
|
+
|
|
91
|
+
**Hooks out of date after upgrade:**
|
|
92
|
+
Run `carson prepare` to write new hook versions, then `carson inspect` to verify.
|
|
93
|
+
|
|
94
|
+
**Govern merge fails:**
|
|
95
|
+
Check that `govern.merge.method` in config matches what GitHub allows. If the repo enforces linear history, only `rebase` works.
|
|
96
|
+
|
|
97
|
+
## Boundaries
|
|
98
|
+
|
|
99
|
+
- Carson never lives inside governed repositories. No `.carson.yml`, no `bin/carson`, no `.tools/carson/`.
|
|
100
|
+
- Carson-managed files in repos are limited to `.github/*` templates.
|
|
101
|
+
- Carson's hooks live at `~/.carson/hooks/<version>/`, never in `.git/hooks/`.
|
|
102
|
+
- Lint policy lives at `~/.carson/lint/`, seeded by `carson lint setup --source <policy-repo>`.
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
2.6.0
|
data/carson.gemspec
CHANGED
|
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
|
22
22
|
spec.bindir = "exe"
|
|
23
23
|
spec.executables = [ "carson" ]
|
|
24
24
|
spec.require_paths = [ "lib" ]
|
|
25
|
-
spec.files = Dir.glob( "{lib,exe,templates,
|
|
25
|
+
spec.files = Dir.glob( "{lib,exe,templates,hooks}/**/*", File::FNM_DOTMATCH ).select { |path| File.file?( path ) } + [
|
|
26
26
|
".github/copilot-instructions.md",
|
|
27
27
|
".github/pull_request_template.md",
|
|
28
28
|
".github/workflows/carson_policy.yml",
|
|
@@ -32,6 +32,8 @@ Gem::Specification.new do |spec|
|
|
|
32
32
|
"RELEASE.md",
|
|
33
33
|
"VERSION",
|
|
34
34
|
"LICENSE",
|
|
35
|
+
"SKILL.md",
|
|
36
|
+
"icon.svg",
|
|
35
37
|
"carson.gemspec"
|
|
36
38
|
]
|
|
37
39
|
end
|
|
@@ -7,7 +7,7 @@ elif command -v carson >/dev/null 2>&1; then
|
|
|
7
7
|
carson_command=( "carson" )
|
|
8
8
|
else
|
|
9
9
|
echo "Carson policy: 'carson' command is required for pre-commit governance checks." >&2
|
|
10
|
-
echo "Install Carson and rerun 'carson
|
|
10
|
+
echo "Install Carson and rerun 'carson prepare'." >&2
|
|
11
11
|
exit 1
|
|
12
12
|
fi
|
|
13
13
|
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
set -euo pipefail
|
|
3
3
|
|
|
4
|
+
hooks_dir="$(cd "$(dirname "$0")" && pwd)"
|
|
5
|
+
style="$(cat "$hooks_dir/workflow_style" 2>/dev/null || echo "trunk")"
|
|
6
|
+
[ "$style" = "trunk" ] && exit 0
|
|
7
|
+
|
|
4
8
|
branch_name="$(git rev-parse --abbrev-ref HEAD)"
|
|
5
9
|
if [[ "$branch_name" == "main" || "$branch_name" == "master" ]]; then
|
|
6
10
|
echo "Carson policy: direct merge commits on ${branch_name} are blocked. Merge through a pull request." >&2
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
set -euo pipefail
|
|
3
3
|
|
|
4
|
+
hooks_dir="$(cd "$(dirname "$0")" && pwd)"
|
|
5
|
+
style="$(cat "$hooks_dir/workflow_style" 2>/dev/null || echo "trunk")"
|
|
6
|
+
[ "$style" = "trunk" ] && exit 0
|
|
7
|
+
|
|
4
8
|
remote_name="${1:-unknown}"
|
|
5
9
|
remote_url="${2:-unknown}"
|
|
6
10
|
while read -r local_ref local_sha remote_ref remote_sha; do
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
set -euo pipefail
|
|
3
3
|
|
|
4
|
+
hooks_dir="$(cd "$(dirname "$0")" && pwd)"
|
|
5
|
+
style="$(cat "$hooks_dir/workflow_style" 2>/dev/null || echo "trunk")"
|
|
6
|
+
[ "$style" = "trunk" ] && exit 0
|
|
7
|
+
|
|
4
8
|
branch_name="$(git rev-parse --abbrev-ref HEAD)"
|
|
5
9
|
if [[ "$branch_name" == "main" || "$branch_name" == "master" ]]; then
|
|
6
10
|
echo "Carson policy: direct commits on ${branch_name} are blocked. Work on a feature branch and merge via PR." >&2
|