@jeiemgi/cckit 0.6.1 → 0.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.
Files changed (114) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/AGENTS.md +34 -3
  3. package/README.md +86 -5
  4. package/bin/cckit +72 -3
  5. package/cckit.config.json +6 -1
  6. package/kit.config.schema.json +26 -1
  7. package/package.json +1 -1
  8. package/profiles/automation.json +2 -1
  9. package/profiles/content.json +2 -1
  10. package/profiles/minimal.json +2 -1
  11. package/profiles/research.json +2 -1
  12. package/profiles/software.json +2 -1
  13. package/scripts/init.sh +31 -1
  14. package/scripts/lib/board-view-test.sh +1 -0
  15. package/scripts/lib/board-view.sh +1 -0
  16. package/scripts/lib/captain-test.sh +62 -0
  17. package/scripts/lib/captain.sh +105 -17
  18. package/scripts/lib/cckit-output.sh +1 -0
  19. package/scripts/lib/commitlint.sh +1 -0
  20. package/scripts/lib/config-path-test.sh +1 -0
  21. package/scripts/lib/config-path.sh +1 -0
  22. package/scripts/lib/copilot-test.sh +1 -0
  23. package/scripts/lib/copilot.sh +1 -0
  24. package/scripts/lib/effort-dispatch-test.sh +10 -0
  25. package/scripts/lib/effort-flows-test.sh +1 -0
  26. package/scripts/lib/effort-metrics-test.sh +1 -0
  27. package/scripts/lib/effort-metrics.sh +1 -0
  28. package/scripts/lib/effort-ops-test.sh +360 -0
  29. package/scripts/lib/effort-ops.sh +372 -16
  30. package/scripts/lib/effort-parity-test.sh +1 -0
  31. package/scripts/lib/effort-plan.sh +1 -0
  32. package/scripts/lib/effort-slug-test.sh +32 -0
  33. package/scripts/lib/effort-slug.sh +72 -8
  34. package/scripts/lib/effort.sh +1 -0
  35. package/scripts/lib/engine-adapter.sh +1 -0
  36. package/scripts/lib/errors-header-test.sh +86 -0
  37. package/scripts/lib/gh-log.sh +1 -0
  38. package/scripts/lib/gh-project-test.sh +1 -0
  39. package/scripts/lib/gh-project.sh +1 -0
  40. package/scripts/lib/git-remote-test.sh +1 -0
  41. package/scripts/lib/git-remote.sh +1 -0
  42. package/scripts/lib/handoff.sh +23 -2
  43. package/scripts/lib/kit-brief-test.sh +292 -0
  44. package/scripts/lib/kit-brief.sh +376 -0
  45. package/scripts/lib/kit-cli-test.sh +1 -0
  46. package/scripts/lib/kit-cli.sh +1 -0
  47. package/scripts/lib/kit-config-resolve.sh +1 -0
  48. package/scripts/lib/kit-config-test.sh +14 -0
  49. package/scripts/lib/kit-config.sh +7 -0
  50. package/scripts/lib/kit-engine-test.sh +1 -0
  51. package/scripts/lib/kit-events.sh +1 -0
  52. package/scripts/lib/kit-gc-test.sh +125 -0
  53. package/scripts/lib/kit-gc.sh +193 -5
  54. package/scripts/lib/kit-interview-test.sh +1 -0
  55. package/scripts/lib/kit-interview.sh +1 -0
  56. package/scripts/lib/kit-lib-test.sh +226 -0
  57. package/scripts/lib/kit-lib.sh +308 -0
  58. package/scripts/lib/kit-local.sh +1 -0
  59. package/scripts/lib/kit-manifest.sh +1 -0
  60. package/scripts/lib/kit-mode-test.sh +1 -0
  61. package/scripts/lib/kit-mode.sh +1 -0
  62. package/scripts/lib/kit-msg-test.sh +1 -0
  63. package/scripts/lib/kit-msg.sh +1 -0
  64. package/scripts/lib/kit-operate.sh +1 -0
  65. package/scripts/lib/kit-profile-test.sh +1 -0
  66. package/scripts/lib/kit-profile.sh +1 -0
  67. package/scripts/lib/kit-state-test.sh +89 -0
  68. package/scripts/lib/kit-state.sh +61 -0
  69. package/scripts/lib/kit-status-test.sh +233 -0
  70. package/scripts/lib/kit-status.sh +415 -0
  71. package/scripts/lib/kit-task-ops-test.sh +1 -0
  72. package/scripts/lib/kit-task-ops.sh +1 -0
  73. package/scripts/lib/next.sh +1 -0
  74. package/scripts/lib/plan-machine-test.sh +54 -0
  75. package/scripts/lib/plan-machine.sh +86 -25
  76. package/scripts/lib/plan-next-test.sh +1 -0
  77. package/scripts/lib/plan-next.sh +1 -0
  78. package/scripts/lib/pr-evidence-test.sh +259 -0
  79. package/scripts/lib/pr-evidence.sh +220 -35
  80. package/scripts/lib/project-scan.sh +1 -0
  81. package/scripts/lib/react-detect.sh +1 -0
  82. package/scripts/lib/render-test.sh +1 -0
  83. package/scripts/lib/render.sh +1 -0
  84. package/scripts/lib/role-identity.sh +1 -0
  85. package/scripts/lib/secret-guard.sh +21 -1
  86. package/scripts/lib/toon.sh +1 -0
  87. package/scripts/lib/ui.sh +1 -0
  88. package/scripts/lib/version-bump-test.sh +1 -0
  89. package/scripts/lib/version-bump.sh +1 -0
  90. package/scripts/lib/worktree-bootstrap-test.sh +220 -0
  91. package/scripts/lib/worktree-issue-test.sh +15 -1
  92. package/scripts/lib/worktree-issue.sh +23 -8
  93. package/scripts/lib/worktree-start.sh +191 -7
  94. package/scripts/lib/zsh-safety-test.sh +10 -0
  95. package/scripts/portable-test.sh +13 -2
  96. package/scripts/self-install-test.sh +282 -0
  97. package/scripts/setup-labels.sh +1 -0
  98. package/scripts/status.sh +25 -10
  99. package/skills/kit-cleanup/SKILL.md +83 -0
  100. package/skills/kit-effort-close/SKILL.md +3 -0
  101. package/skills/kit-effort-new/SKILL.md +7 -0
  102. package/skills/kit-effort-start/SKILL.md +39 -4
  103. package/skills/kit-gc/SKILL.md +19 -0
  104. package/skills/kit-next/SKILL.md +5 -0
  105. package/skills/kit-status/SKILL.md +92 -0
  106. package/skills/kit-task-start/SKILL.md +7 -1
  107. package/templates/rules/branch-naming.md +20 -1
  108. package/templates/rules/communication-style.md +8 -0
  109. package/templates/rules/delegation-brief.md +38 -4
  110. package/templates/rules/effort-model.md +47 -4
  111. package/templates/rules/naming-and-ids.md +199 -0
  112. package/templates/rules/task-management.md +1 -1
  113. package/templates/skills/concrete/SKILL.md +117 -0
  114. package/templates/skills/karpathy-guidelines/SKILL.md +1 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cckit",
3
- "version": "0.6.1",
3
+ "version": "0.7.0",
4
4
  "installationPreference": "beta",
5
5
  "description": "cckit — a project operating system for coding agents. The full GitHub work lifecycle (start/pr/close/sync, efforts, worktrees, orchestrate, gc) as agents + skills + rules, drivable by Claude Code and any other agent. Driven from cckit.config.json; no org or repo hardcoded.",
6
6
  "author": {
package/AGENTS.md CHANGED
@@ -11,6 +11,12 @@ adapter one) — is described in [the Adapters page](docs-site/src/content/docs/
11
11
  - **Read state before acting.** `cckit sync --llm` returns the board as TOON. Decide from data.
12
12
  - **One issue = one branch = one worktree = one PR.** `cckit start <issue>` creates the isolated
13
13
  worktree; do all work there; `cckit pr <issue>` opens the PR. Never commit to the base branch.
14
+ **The effort flow is the one exception, and it is deliberate:** an effort is *1 parent issue = 1
15
+ `effort/<N>` branch = 1 PR* covering **N sub-issues**. Sequential sub-issues commit straight onto
16
+ `effort/<N>` (one commit per sub-issue — that commit's diff is the sub's patch); parallel ones get
17
+ their own file-disjoint `sub/<N><letter>` worktree and merge back into `effort/<N>`. Either way
18
+ exactly one PR opens, from `effort/<N>` — never one per sub-issue. Full spec:
19
+ `.claude/rules/effort-model.md`.
14
20
  - **Structured output, TOON-first.** Append `--llm` to any verb for machine-readable output. List
15
21
  reads (sync, next, plan, wave) come back as **TOON** (token-cheap); single-result action verbs
16
22
  (start, pr, close) return one JSON object. Human (pretty) output is the default; agents prefer `--llm`.
@@ -19,6 +25,23 @@ adapter one) — is described in [the Adapters page](docs-site/src/content/docs/
19
25
  - **Hand off when you stop with unfinished work.** `cckit handoff "<what's pending, next step, refs>"`
20
26
  saves a local resume-here note; bare `cckit` (no verb) prints it so the next session resumes
21
27
  exactly where this one stopped.
28
+ - **Run durable prose through `concrete` before writing it.** Every durable artifact — a commit
29
+ message, a PR or issue body, a rule, an ADR, a knowledge doc — goes through
30
+ `.claude/skills/concrete/SKILL.md`: cut only by named offense, never by length;
31
+ evidence, commands, paths and numbers are untouchable; `O13` unverifiable claim and `O14` undecided
32
+ decision are fixed at the gap, not reworded. `cckit brief <issue>` emits this instruction in its
33
+ `## Durable prose` section, so a delegated agent gets it without being told twice.
34
+
35
+ ## What cckit installs for itself
36
+
37
+ `templates/` is what `cckit init` writes into a consuming project. `.claude/skills/` and
38
+ `.claude/rules/` in this repo are the subset cckit applies to its **own** work — `concrete`,
39
+ `karpathy-guidelines`, and the rules for branches, efforts, PR titles, delegation and communication
40
+ style. No agents are installed: this file plus `cckit brief` is the delegation contract here.
41
+
42
+ The manifest and the reason for every skipped template are in `scripts/self-install-test.sh`, which
43
+ also fails if an installed copy drifts from its template. Edit a template and its installed copy in
44
+ the same commit.
22
45
 
23
46
  ## Core verbs
24
47
 
@@ -27,24 +50,32 @@ adapter one) — is described in [the Adapters page](docs-site/src/content/docs/
27
50
  | `cckit init` | scaffold config + `.claude/` | — |
28
51
  | `cckit sync` | board state / what's unblocked | `--llm` → TOON |
29
52
  | `cckit next` | the next unblocked issue + how to start it | `--llm` → TOON |
30
- | `cckit plan` | wave plan: deps-ordered, file-disjoint, session-fit | `--llm` → TOON |
53
+ | `cckit plan` | wave plan: deps-ordered, priority-sorted within a wave, file-disjoint, session-fit | `--llm` → TOON |
31
54
  | `cckit plan-next` | forward plan: inventory current skills/verbs/rules/docs → propose what to build next | `--llm` → TOON |
55
+ | `cckit status` | where are we: local undone work, open PRs waiting on a human, cleanup available (local + remote) | `--llm` → JSON |
56
+ | `cckit brief <issue>` | the delegation brief for an issue, from real state: worktree, seed freshness, owned files, the helpers they sit on, standing gotchas | — |
32
57
  | `cckit wave` | read open efforts, propose incoming waves: fan-out brief + captain drive | `--llm` → TOON |
33
58
  | `cckit watch [--merge] [--loop]` | captain: gate open PRs, squash-merge CLEAN, advance the wave | — |
34
- | `cckit start <issue> [slug]` | isolated worktree + branch | `--llm` |
59
+ | `cckit start <issue> [slug]` | isolated worktree + branch, bootstrapped: env files copied, per-worktree dev PORT, deps installed at the selected targets. Precedence: **`worktree.installPaths` if set** (those dirs only, installed whether or not each declares dependencies — `[]` installs nothing, and the root/workspace checks are skipped entirely), **else** the root *only when* its manifest declares dependencies or it is a workspace root **with at least one member** (a non-empty `packages:` list, or a non-empty `workspaces` / `workspaces.packages` array), **else nothing** — so a dependency-free root never gets a stray empty `pnpm-lock.yaml`. `installPaths` entries that escape the worktree are refused. `KIT_WT_INSTALL=0` skips the install | `--llm` |
35
60
  | `cckit pr <issue> <summary>` | commit + push + open PR | `--llm` |
36
61
  | `cckit close <issue> <summary>` | close issue + mark done | `--llm` |
37
62
  | `cckit effort new "<name>" ["sub :: desc" …]` | parent (4-section body + ctx/kind/priority/role/flow labels) + linted native sub-issues — identical to `/kit-effort-new` (one shared core); `start`/`pr`/`close` take `<slug\|N>` | flags: `--flow/--role/--priority/--goal/--scope/--for-agents/--verification/--depends-on/--milestone`, `--slug` |
63
+ | `cckit effort chain <a> <b> [<c> …]` | wire 2+ issues into a linear order: `b` `blocked_by` `a`, `c` `blocked_by` `b`, plus a `- Depends on #<predecessor>` line in each successor's `## Relations` section. These are the edges `cckit plan` layers into waves. Idempotent (an edge or line already there is skipped); pre-existing blockers are kept, never replaced. Validates everything first — fewer than two numbers, a non-numeric arg, an issue that does not exist, a repeated number, or an edge that would close a cycle refuses the whole chain and writes nothing | — |
64
+ | `cckit effort start [--force] <slug\|N> [slug]` | effort branch + bootstrapped worktree, **WIP-limited**: refuses a NEW effort once `effort.wipLimit` (default 2) are already in progress. In progress = an `effort/<N>-<slug>` branch exists as a local head **or** on origin, read with `git ls-remote` rather than the cached `refs/remotes` (which is wrong both ways: it misses a branch pushed since the last fetch and keeps one deleted on origin until a prune). At the limit refuses; only strictly under it starts. Re-starting an effort that is already in progress is never gated. The check runs before the fetch/branch/worktree/bootstrap, so a refusal makes no branch, no worktree and no board change — it is not read-free (it queries origin, and a `<slug>` arg was resolved first, which can run `gh issue list`). `0` refuses every ordinary start; `--force` still starts. A non-integer value is ignored with a warning and the default 2 is used; `EFFORT_WIP_LIMIT` overrides the config per invocation. `EFFORT_WIP_REMOTE=0` — or an unreachable origin, which warns and proceeds — counts the cached refs instead. Does **not** gate `cckit start <issue>` | `--force`, or `KIT_FORCE=1` |
38
65
  | `cckit effort plan` | session-fit effort plan | `--llm` → JSON |
39
66
  | `cckit orchestrate <a> <b> …` | run N flows in parallel worktrees | — (use `--dry-run`) |
40
67
  | `cckit autopilot [<a> …]` | unattended multi-flow: drive (or auto-pick) issues under a cap | — (use `--dry-run`) |
41
- | `cckit gc` | report prunable branches + worktrees | `--llm` → JSON counts |
68
+ | `cckit gc` | report prunable branches + worktrees — never one whose issue is still open; aborts if the protection helper is missing | `--llm` → JSON counts |
69
+ | `cckit cleanup [--yes]` | the guided destructive sweep over that report: plan first, delete only the SAFE rows and prune the listed ZOMBIE metadata (staged work recovered to its branch first); ORPHAN / PROTECTED / stashes are never deletable | `--llm` → JSON counts + `applied` |
42
70
  | `cckit render` | stdin markdown → rich (glow on a TTY; verbatim when piped) | — |
43
71
  | `cckit version` | the installed cckit version | `--llm` |
44
72
 
45
73
  Every verb accepts a global `--llm` (alias `--output=json`); verbs that produce a result emit a
46
74
  single JSON object/array on stdout, with human text on stderr. Interactive/launch verbs
47
75
  (`init`, `orchestrate`, `autopilot`) have no JSON result — use `--dry-run` to inspect their plan.
76
+ `cckit brief` has no JSON form either, and deliberately: its output IS the prompt you hand a
77
+ delegated agent, so markdown is the machine-readable form. Read the facts behind it as data with
78
+ `cckit lib --llm` and `cckit status --llm`.
48
79
 
49
80
  > **`cckit plan-next` is the one exception to "feed verb output back to the model."** Its forward
50
81
  > plan is for the human/orchestrator's decision only — never inject it into a monitored model's
package/README.md CHANGED
@@ -90,17 +90,27 @@ cckit doctor # onboarding preflight: deps, gh auth
90
90
  cckit init --profile software # scaffold cckit.config.json + .claude/ for this repo
91
91
  # profiles: software · content · research · automation · minimal
92
92
  cckit plan-next # propose what to build next, grounded in current capabilities
93
+ cckit status # where are we: local undone work, PRs to attend, cleanup available
93
94
  cckit next # the next unblocked issue + how to start it
94
- cckit start 42 # isolated worktree + branch for issue #42
95
+ cckit start 42 # isolated worktree + branch for issue #42, bootstrapped:
96
+ # env files copied, dev port assigned, deps installed at the
97
+ # selected targets — worktree.installPaths if set (those dirs
98
+ # regardless of their manifests), else a root that declares
99
+ # deps or is a workspace root with members, else nothing
100
+ # (KIT_WT_INSTALL=0 skips the install entirely)
101
+ cckit brief 42 # the delegation brief for #42, read out of the repo not memory
102
+ cckit lib # every scripts/lib helper: functions, purpose, error contract
95
103
  cckit pr 42 "what changed" # commit, push, open the PR
96
104
  cckit sync # board state, what's unblocked
97
105
  cckit handoff "resume note" # save a handoff — bare `cckit` prints it next session
98
- cckit gc # prune merged branches + worktrees
106
+ cckit gc # report prunable branches + worktrees (deletes nothing)
107
+ cckit cleanup [--yes] # act on that report: delete the SAFE rows, prune listed zombies, keep orphans/stashes
99
108
  ```
100
109
 
101
110
  Adopting cckit in a repo that already has history? `cckit scan` detects the stack, `cckit adopt`
102
- records kit-shaped files the repo already has, and `cckit status` is the thin dashboard — board,
103
- worktrees, and the resume handoff in one screen. Run `cckit help` for the full verb list, or
111
+ records kit-shaped files the repo already has, and `cckit status` answers "where are we" — local
112
+ undone work, the open PRs waiting on a human, and the cleanup available, plus the board and the
113
+ resume handoff in one screen. Run `cckit help` for the full verb list, or
104
114
  `cckit <verb> --help` for any one.
105
115
 
106
116
  ## Efforts and slug handles
@@ -128,13 +138,72 @@ A pure-digits argument is always a number; anything else is resolved to the cano
128
138
  matching `effort/*` branches, the `slug:<slug>` label, then open effort titles. An unknown or
129
139
  ambiguous slug fails with a clear error rather than guessing. Efforts render as `slug #N`.
130
140
 
141
+ ### Ordering work — `cckit effort chain`
142
+
143
+ When several issues have to land in a set order, `cckit effort chain` declares that order once:
144
+
145
+ ```bash
146
+ cckit effort chain 241 242 243 # 242 blocked_by 241 · 243 blocked_by 242
147
+ ```
148
+
149
+ Each issue after the first gets a native GitHub `blocked_by` edge on its predecessor **and** a
150
+ `- Depends on #<predecessor>` line in its `## Relations` section — the same line
151
+ `cckit effort new --depends-on` writes, from the same formatter. Those `blocked_by` edges are
152
+ exactly what `cckit plan` reads, so a chained set lands one issue per wave, in the order you gave.
153
+
154
+ It is **idempotent**: an edge or a `Depends on` line that is already there is reported and skipped,
155
+ so re-running changes nothing. It only ever **adds** — an issue already blocked by something else
156
+ keeps that blocker and ends up with both. And it validates the whole chain before writing anything,
157
+ so a refusal leaves the board untouched: fewer than two numbers, an argument that is not an issue
158
+ number, an issue that does not exist, a number repeated in the list (`chain 1 2 1`), or an edge that
159
+ would close a cycle through dependencies GitHub already holds are all refused whole. A cycle is
160
+ refused rather than written because `cckit plan` cannot layer a cyclic graph into waves.
161
+
162
+ ### One at a time — the effort WIP limit
163
+
164
+ `cckit effort start` refuses to start a **new** effort once too many are already in progress:
165
+
166
+ ```console
167
+ $ cckit effort start 244
168
+ effort_start: 2 effort(s) already in progress and the WIP limit is 2.
169
+ · order-and-cadence #241 (effort/241-order-and-cadence)
170
+ · release-gates #257 (effort/257-release-gates)
171
+ → refusing to start #244 — nothing was created.
172
+ Close one with 'cckit effort close <N>', or start anyway with --force (or KIT_FORCE=1).
173
+ The limit is effort.wipLimit in the project config (default 2); EFFORT_WIP_LIMIT overrides it.
174
+ ```
175
+
176
+ **In progress** means an `effort/<N>-<slug>` branch exists — as a local head, **or** on origin, so
177
+ an effort another machine started counts too. `cckit effort start` creates the branch and
178
+ `cckit effort close` deletes it, so the set is exactly "started and not yet closed".
179
+
180
+ The origin half is read with `git ls-remote` on each `cckit effort start`, not from your cached
181
+ `refs/remotes`, because the cache is wrong in both directions: a branch pushed since your last fetch
182
+ is missing from it, and a branch deleted on origin lingers in it until a prune. One network
183
+ round-trip buys a count that is right either way.
184
+
185
+ - The check runs **before** the fetch, the branch, the worktree and the bootstrap, so a refusal
186
+ makes **no branch, no worktree and no board change**.
187
+ - **At** the limit refuses; only strictly under it starts. The default limit is `2`.
188
+ - Re-running `cckit effort start` on an effort that is **already** in progress is never gated — it
189
+ adds no WIP, so the verb stays safe to re-run even at or over the limit.
190
+ - `--force` (or `KIT_FORCE=1`, the same escape hatch `cckit effort close` uses) starts anyway.
191
+ - Set your own limit with `effort.wipLimit` in `cckit.config.json`; `0` refuses every ordinary
192
+ start, **though `--force` still works**. A value that is not a non-negative integer is ignored
193
+ with a warning and the default `2` is used. `EFFORT_WIP_LIMIT` in the environment overrides the
194
+ config per invocation.
195
+ - This gates **efforts only**. `cckit start <issue>` (a plain task worktree) has no WIP limit.
196
+ - **No network, no problem.** `EFFORT_WIP_REMOTE=0` skips the origin query and counts local heads
197
+ plus your cached `refs/remotes`. If origin is simply unreachable, the count falls back to those
198
+ same cached refs, prints one line saying the count may be stale, and the start proceeds.
199
+
131
200
  ## Waves — parallel agentic development
132
201
 
133
202
  `cckit wave` reads your open efforts and proposes the incoming waves of work — parallel agent tasks
134
203
  that gate and merge themselves. This is the part that turns one keyboard into a small team:
135
204
 
136
205
  ```bash
137
- cckit plan # the wave plan: deps-ordered, file-disjoint, session-fit
206
+ cckit plan # the wave plan: deps-ordered, p0-first inside a wave, file-disjoint
138
207
  cckit wave # a Task-subagent fan-out brief Claude Code enacts (proposes the next wave)
139
208
  cckit orchestrate 12 14 17 # run N flows in parallel worktrees (--dry-run / --cap / --agent)
140
209
  cckit watch --merge # the captain: gate open PRs, squash-merge the CLEAN ones, advance
@@ -168,6 +237,14 @@ public: [every issue closed in the repo →](https://github.com/jeiemgi/cckit/is
168
237
  — including [the effort that produced this README](https://github.com/jeiemgi/cckit/issues/160).
169
238
  The board is both the plan and the proof.
170
239
 
240
+ cckit also runs on the rules and skills it ships. `templates/` is what `cckit init` writes into a
241
+ project; `.claude/skills/` and `.claude/rules/` here are the subset cckit applies to its own work —
242
+ `concrete` (the anti-slop catalogue every commit and PR body goes through) and
243
+ `karpathy-guidelines`, plus the rules that govern this repo's branches, efforts, PR titles and
244
+ delegation. It is a subset on purpose: several templates target stacks cckit does not have.
245
+ `scripts/self-install-test.sh` holds the manifest, the reason for every skip, and the assertion that
246
+ the installed copies have not drifted from their templates.
247
+
171
248
  ## Documentation
172
249
 
173
250
  Full docs live at **[cckit.dev](https://cckit.dev)** — start with
@@ -184,12 +261,16 @@ prompt** you can paste straight into Claude Code — start exactly where you are
184
261
  cckit/
185
262
  bin/cckit # the CLI dispatcher
186
263
  scripts/lib/*.sh # the git-mechanics bundle (effort, worktree, gh, gc, …)
264
+ # each declares `# errors:` — see CONTRIBUTING.md
187
265
  scripts/benchmark/ # doc-retrieval benchmark harness (cckit bench)
188
266
  .claude-plugin/ # the Claude Code plugin manifest
189
267
  skills/ commands/ # Claude Code skills + slash commands
190
268
  profiles/ templates/ # init profiles + scaffold templates
191
269
  routines/ modules/ # scheduled routines + optional modules
192
270
  docs-site/ # documentation source — Astro/Starlight (deployed to cckit.dev)
271
+ .claude/skills/ # the subset of templates/skills/ cckit installs for ITSELF
272
+ .claude/rules/ # the subset of templates/rules/ cckit installs for ITSELF
273
+ # the manifest + every skip reason: scripts/self-install-test.sh
193
274
  cckit.config.json # project configuration (no hardcoded org/repo)
194
275
  ```
195
276
 
package/bin/cckit CHANGED
@@ -13,12 +13,20 @@
13
13
  # cckit close <issue> <summary> close issue + mark done
14
14
  # cckit contribute "<summary>" open a contribution PR to cckit, gated on scripts/check.sh
15
15
  # cckit sync [--llm] board state / what's unblocked
16
- # cckit plan [--llm] [--effort N] wave plan: deps-ordered, file-disjoint, session-fit (TOON --llm)
16
+ # cckit plan [--llm] [--effort N] wave plan: deps-ordered, p0-first in a wave, file-disjoint (TOON --llm)
17
17
  # cckit plan-next [--llm] forward plan: current skills/verbs/rules/docs -> what to build next
18
- # cckit effort <new|start|pr|close|plan> the effort lifecycle
18
+ # cckit effort <new|chain|start|pr|close|plan> the effort lifecycle
19
19
  # effort new [--flow F --role R --priority p1 --goal G --scope S --for-agents A
20
20
  # --verification V --depends-on "#1,#2" --milestone M] "<name>" ["sub :: desc" …]
21
21
  # parent (4-section body + ctx/kind/priority/role/flow labels) + linted native sub-issues
22
+ # effort chain <a> <b> [<c> …] linear order: b blocked_by a, c blocked_by b, + a
23
+ # `Depends on #<predecessor>` line in each body. Idempotent; refuses a cycle.
24
+ # effort start [--force] <slug|N> [slug] effort branch + worktree, WIP-limited: refuses a NEW
25
+ # effort once effort.wipLimit (default 2) are already in progress — an `effort/<N>-<slug>`
26
+ # branch exists locally or on origin (git ls-remote, not the cached refs/remotes;
27
+ # EFFORT_WIP_REMOTE=0 or an unreachable origin uses the cache and still starts). Refuses
28
+ # before writing anything; --force (or KIT_FORCE=1) starts anyway, at limit 0 too.
29
+ # `cckit start <issue>` is not affected.
22
30
  # cckit orchestrate <a> <b> … run N flows in parallel worktrees (--dry-run/--cap/--agent)
23
31
  # cckit autopilot [<a> …] unattended multi-flow: drive (or auto-pick) issues under a cap
24
32
  # cckit watch [--merge] [--loop] captain: gate open PRs, squash-merge CLEAN, advance the wave
@@ -26,6 +34,7 @@
26
34
  # cckit wave [--effort N] read open efforts, propose incoming waves: fan-out + captain drive
27
35
  # cckit msg <send|read|list> session mail across projects: steer a live session (--steer)
28
36
  # cckit gc [--prune [--yes]] report (default) or prune merged branches + worktrees
37
+ # cckit cleanup [--yes] guided destructive sweep over the gc report (plan first)
29
38
  # cckit status thin dashboard: board + worktrees + resume handoff
30
39
  # cckit scan [--llm] detect this repo's stack + kit state (JSON)
31
40
  # cckit debug [--check] <args> optional browser-debug via chrome-devtools-axi (auto-detected)
@@ -40,6 +49,8 @@
40
49
  # cckit release <ver> [--publish] cut a release (dry-run by default)
41
50
  # cckit version [--llm] the installed cckit version
42
51
  # cckit commands [--llm] list every verb (the command catalog)
52
+ # cckit lib [--llm] [--all] list every scripts/lib helper: functions, purpose, error contract
53
+ # cckit brief <issue> the delegation brief for an issue, from real state
43
54
  # cckit completions [bash|zsh] print a shell-completion script to source
44
55
  # cckit help
45
56
  set -eu
@@ -128,11 +139,12 @@ case "$cmd" in
128
139
  source "$LIB/role-identity.sh" 2>/dev/null || true
129
140
  fi
130
141
  effort_new "$@" ;;
142
+ chain) effort_chain "$@" ;;
131
143
  start) effort_start "$@" ;;
132
144
  pr) effort_pr "$@" ;;
133
145
  close) effort_close "$@" ;;
134
146
  plan) source "$LIB/effort-plan.sh"; effort_plan "$@" ;;
135
- *) echo "cckit effort <new|start|pr|close|plan>" >&2; exit 2 ;;
147
+ *) echo "cckit effort <new|chain|start|pr|close|plan>" >&2; exit 2 ;;
136
148
  esac
137
149
  ;;
138
150
  start)
@@ -189,6 +201,38 @@ case "$cmd" in
189
201
  # shellcheck source=/dev/null
190
202
  source "$LIB/plan-next.sh"; plan_next "$@"
191
203
  ;;
204
+ cleanup)
205
+ # ONE guided destructive sweep over the gc analysis: plan first, delete only the SAFE rows, and
206
+ # only with --yes. Orphans, protected branches and stashes are surfaced and left alone.
207
+ # shellcheck source=/dev/null
208
+ source "$LIB/kit-config.sh" && load_kit_config
209
+ # shellcheck source=/dev/null
210
+ source "$LIB/kit-gc.sh"
211
+ if cckit_is_json; then
212
+ # Keep BOTH the exit status and the diagnostic. `|| true` + `2>/dev/null` would turn a refusal
213
+ # (protection helper missing, analysis failed) or a partial run (a remote delete that failed)
214
+ # into `applied: yes` with zero counts and rc 0 — a JSON consumer would read that as a clean
215
+ # sweep. Reporting a wrong success is the failure mode this whole op exists to avoid.
216
+ cleanup_err="$(mktemp)"; cleanup_rc=0
217
+ out="$(kit_gc_cleanup "$@" 2>"$cleanup_err")" || cleanup_rc=$?
218
+ safe="$(printf '%s\n' "$out" | awk '/^ SAFE branches/{print $3}')"
219
+ wt="$(printf '%s\n' "$out" | awk '/^ SAFE worktrees/{print $3}')"
220
+ orphan="$(printf '%s\n' "$out" | awk '/^ ORPHAN kept/{print $3}')"
221
+ protected="$(printf '%s\n' "$out" | awk '/^ PROTECTED kept/{print $3}')"
222
+ stash="$(printf '%s\n' "$out" | awk '/^ stashes kept/{print $3}')"
223
+ zombie="$(printf '%s\n' "$out" | awk '/^ ZOMBIE worktrees/{print $3}')"
224
+ rfail="$(printf '%s\n' "$out" | awk '/^ remote deletes failed/{print $4}')"
225
+ applied=no
226
+ if [ "$cleanup_rc" -eq 0 ]; then case " $* " in *" --yes "*|*" -y "*) applied=yes ;; esac; fi
227
+ err="$(tr '\n' ' ' < "$cleanup_err" | sed 's/[[:space:]]*$//')"; rm -f "$cleanup_err"
228
+ cckit_json verb cleanup safe "${safe:-0}" worktrees "${wt:-0}" orphan "${orphan:-0}" \
229
+ protected "${protected:-0}" stash "${stash:-0}" zombie "${zombie:-0}" applied "$applied" \
230
+ remote_failed "${rfail:-0}" rc "$cleanup_rc" error "$err"
231
+ [ "$cleanup_rc" -eq 0 ] || exit "$cleanup_rc"
232
+ else
233
+ kit_gc_cleanup "$@"
234
+ fi
235
+ ;;
192
236
  gc)
193
237
  # shellcheck source=/dev/null
194
238
  source "$LIB/kit-config.sh" && load_kit_config
@@ -304,6 +348,31 @@ case "$cmd" in
304
348
  verbs="$(grep -oE '^ [a-z][a-z|-]*\)' "$BIN/cckit" | sed 's/[) ]//g' | tr '|' '\n' | grep -vE '^(-|$)' | sort -u)"
305
349
  if cckit_is_json; then printf '%s\n' "$verbs" | jq -R . | jq -cs .; else printf '%s\n' "$verbs" | tr '\n' ' '; echo; fi
306
350
  ;;
351
+ lib)
352
+ # The HELPER catalog — the companion to `commands` (#222). `commands` lists the verbs; this
353
+ # lists the library they are built from, so a helper like pr-evidence.sh is discoverable
354
+ # without an `ls`. Filesystem-only; config is loaded purely for the project-root inference
355
+ # (KIT_CONFIG), then it catalogs that project's scripts/lib, else cckit's own.
356
+ # shellcheck source=/dev/null
357
+ source "$LIB/kit-config.sh" && load_kit_config 2>/dev/null || true
358
+ # shellcheck source=/dev/null
359
+ source "$LIB/kit-lib.sh"; kit_lib "$@"
360
+ ;;
361
+ brief)
362
+ # The delegation BRIEF for an issue, generated from real state (#221). The companion to `lib`:
363
+ # `lib` says what helpers exist, this says which of them THIS issue's files sit on, where the
364
+ # work happens, and whether the branch's seed is stale. Reads the issue via gh; every other
365
+ # section degrades to an explicit line rather than going quietly missing.
366
+ # shellcheck source=/dev/null
367
+ source "$LIB/kit-config.sh" && load_kit_config 2>/dev/null || true
368
+ # shellcheck source=/dev/null
369
+ source "$LIB/worktree-issue.sh" 2>/dev/null || true
370
+ # shellcheck source=/dev/null
371
+ source "$LIB/kit-lib.sh"
372
+ # shellcheck source=/dev/null
373
+ source "$LIB/kit-brief.sh"
374
+ CCKIT_ROOT="$ROOT" kit_brief "$@"
375
+ ;;
307
376
  completions)
308
377
  case "${1:-bash}" in
309
378
  bash) cat "$ROOT/completions/cckit.bash" ;;
package/cckit.config.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "./kit.config.schema.json",
3
- "kitVersion": "0.6.1",
3
+ "kitVersion": "0.7.0",
4
4
  "project": {
5
5
  "name": "cckit",
6
6
  "slug": "cckit",
@@ -30,5 +30,10 @@
30
30
  },
31
31
  "engine": {
32
32
  "mode": "off"
33
+ },
34
+ "captain": {
35
+ "mergePolicy": {
36
+ "requireChecks": true
37
+ }
33
38
  }
34
39
  }
@@ -69,7 +69,8 @@
69
69
  "additionalProperties": true,
70
70
  "properties": {
71
71
  "flows": { "type": "array", "items": { "type": "string" }, "description": "Controlled flow vocabulary for effort titles — the values accepted by the leading [Flow] title tag and `--flow` (also the flow:<flow> labels). Replaces the built-in default (Core UI API Docs Infra Auth Data Web App); an explicit EFFORT_FLOWS env var still wins per invocation." },
72
- "knowledgeIngestHook": { "type": "string", "description": "Optional path to an executable run after `cckit effort close`, invoked as `<hook> <effort-number> <trace-dir>` to fold the closed effort's work record into a knowledge base. No-op when unset or not executable; the kit ships no default." }
72
+ "knowledgeIngestHook": { "type": "string", "description": "Optional path to an executable run after `cckit effort close`, invoked as `<hook> <effort-number> <trace-dir>` to fold the closed effort's work record into a knowledge base. No-op when unset or not executable; the kit ships no default." },
73
+ "wipLimit": { "type": "integer", "minimum": 0, "description": "How many efforts may be in progress at once before `cckit effort start` refuses a NEW effort (default 2). In progress = an `effort/<N>-<slug>` branch exists as a local head or on origin (read with `git ls-remote`, not the cached refs/remotes; EFFORT_WIP_REMOTE=0 or an unreachable origin counts the cached refs instead). Refusal happens before anything is written; `--force` (or KIT_FORCE=1) starts anyway. 0 refuses every ordinary start of a NEW effort but not a forced one, and not a re-start of an effort already in progress (that adds no WIP, so it is never gated); a non-integer value is ignored with a warning and the default is used. An explicit EFFORT_WIP_LIMIT env var wins per invocation. Does not affect `cckit start <issue>`." }
73
74
  }
74
75
  },
75
76
  "captain": {
@@ -125,6 +126,30 @@
125
126
  "description": "Map of original scaffolded path -> the project's new name. The original (key) is treated as removed (never re-added); the value documents where it went."
126
127
  }
127
128
  }
129
+ },
130
+ "worktree": {
131
+ "type": "object",
132
+ "additionalProperties": true,
133
+ "description": "How `cckit start` / `cckit effort start` bootstrap a fresh worktree (env copy, dev port, dependency install). Every key is optional; the kit hardcodes no project layout.",
134
+ "properties": {
135
+ "installPaths": {
136
+ "type": "array",
137
+ "items": { "type": "string" },
138
+ "description": "Worktree-relative directories to run `pnpm install` in during bootstrap (e.g. [\"docs-site\"]). Set, it wins outright — only these dirs are installed and the checks below are skipped; [] installs nothing. Entries MUST stay inside the worktree: an absolute path, a `..` that climbs out, or a symlink pointing outside is refused and skipped. Unset: install at the root only when its package.json declares dependencies or it is a workspace root WITH AT LEAST ONE MEMBER — a dependency-free root (or an empty `packages:` / `workspaces` list) is skipped so pnpm cannot plant an empty pnpm-lock.yaml (#255). KIT_WT_INSTALL=0 skips the install entirely."
139
+ },
140
+ "devPorts": {
141
+ "type": "array",
142
+ "description": "Per-app dev PORT lanes. Each entry assigns PORT = base + (issue % 40) * <count> into that app's .env.local, so parallel worktrees never fight for a port.",
143
+ "items": {
144
+ "type": "object",
145
+ "additionalProperties": true,
146
+ "properties": {
147
+ "path": { "type": "string", "description": "Repo-relative path to the app's .env.local file." },
148
+ "base": { "type": "integer", "description": "Base port for this app's lane." }
149
+ }
150
+ }
151
+ }
152
+ }
128
153
  }
129
154
  }
130
155
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jeiemgi/cckit",
3
- "version": "0.6.1",
3
+ "version": "0.7.0",
4
4
  "private": false,
5
5
  "license": "MIT OR Apache-2.0",
6
6
  "description": "cckit — a project operating system for coding agents (CLI + Claude Code plugin).",
@@ -9,7 +9,8 @@
9
9
  ],
10
10
  "skills": [
11
11
  "morning-briefing",
12
- "karpathy-guidelines"
12
+ "karpathy-guidelines",
13
+ "concrete"
13
14
  ],
14
15
  "rules": [
15
16
  "branch-naming",
@@ -11,7 +11,8 @@
11
11
  "skills": [
12
12
  "morning-briefing",
13
13
  "copywriting",
14
- "karpathy-guidelines"
14
+ "karpathy-guidelines",
15
+ "concrete"
15
16
  ],
16
17
  "rules": [
17
18
  "branch-naming",
@@ -7,7 +7,8 @@
7
7
  "generalist"
8
8
  ],
9
9
  "skills": [
10
- "karpathy-guidelines"
10
+ "karpathy-guidelines",
11
+ "concrete"
11
12
  ],
12
13
  "rules": [
13
14
  "communication-style",
@@ -9,7 +9,8 @@
9
9
  ],
10
10
  "skills": [
11
11
  "morning-briefing",
12
- "karpathy-guidelines"
12
+ "karpathy-guidelines",
13
+ "concrete"
13
14
  ],
14
15
  "rules": [
15
16
  "branch-naming",
@@ -8,7 +8,8 @@
8
8
  "speckit",
9
9
  "feature-build-refine",
10
10
  "supabase-patterns",
11
- "karpathy-guidelines"
11
+ "karpathy-guidelines",
12
+ "concrete"
12
13
  ],
13
14
  "rules": [
14
15
  "branch-naming",
package/scripts/init.sh CHANGED
@@ -367,6 +367,33 @@ if [[ -z "$GH_OWNER" ]]; then GH_OWNER="$(gh api user --jq .login 2>/dev/null ||
367
367
  [[ -z "$REPO" && -n "$GH_OWNER" ]] && REPO="$GH_OWNER/$SLUG"
368
368
  [[ -z "$REPO" ]] && REPO="$SLUG"
369
369
 
370
+ # ---- base branch ---------------------------------------------------------
371
+ # Rules that name the integration branch are TEMPLATED on it ({{BASE_BRANCH}}), so a project that
372
+ # integrates on `develop` does not scaffold a rule telling agents to branch from `main` (#283).
373
+ # Resolved the same way the rest of the kit resolves it (kit-config.sh: baseBranch -> integrationBranch
374
+ # -> flow -> "main"), then WRITTEN into the generated config below — a rendered rule that disagrees
375
+ # with KIT_BASE_BRANCH is the bug this parameterization exists to remove.
376
+ # 1. KIT_BASE_BRANCH from the environment (an explicit caller override)
377
+ # 2. the project's existing config, found by kit_config_path (re-init / --upgrade keeps the
378
+ # project's choice) — the ONE resolver, so this honors $KIT_CONFIG and finds a config in an
379
+ # ancestor directory. Hand-checking two TARGET-local filenames skipped both.
380
+ # 3. the repo's actual GitHub default branch (same source as REPO/GH_OWNER above)
381
+ # 4. "main"
382
+ # Unconditional, not `[[ -z ${BASE_BRANCH:-} ]]`: KIT_BASE_BRANCH is the DOCUMENTED override, and
383
+ # BASE_BRANCH is an internal name this script exports for `emit` — an inherited BASE_BRANCH from a
384
+ # caller's environment must not silently outrank it.
385
+ BASE_BRANCH="${KIT_BASE_BRANCH:-}"
386
+ if [[ -z "$BASE_BRANCH" ]]; then
387
+ # shellcheck source=/dev/null
388
+ . "$KIT_ROOT/scripts/lib/config-path.sh"
389
+ _bb_cfg="$(kit_config_path "$TARGET" 2>/dev/null || true)"
390
+ if [[ -n "$_bb_cfg" && -f "$_bb_cfg" ]]; then
391
+ BASE_BRANCH="$(jq -r '.github.baseBranch // .github.integrationBranch // .github.flow // empty' "$_bb_cfg" 2>/dev/null || true)"
392
+ fi
393
+ fi
394
+ [[ -z "$BASE_BRANCH" ]] && BASE_BRANCH="$(cd "$TARGET" 2>/dev/null && gh repo view --json defaultBranchRef -q .defaultBranchRef.name 2>/dev/null || true)"
395
+ [[ -z "$BASE_BRANCH" ]] && BASE_BRANCH="main"
396
+
370
397
  # profile defaults
371
398
  [[ -z "$PLANS_FORMAT" ]] && PLANS_FORMAT="$(jq -r '.defaults.plans_format' "$PROFILE_FILE")"
372
399
  [[ -z "$MEMORY" ]] && MEMORY="$(jq -r '.defaults.memory' "$PROFILE_FILE")"
@@ -465,6 +492,7 @@ done
465
492
  # ---- export vars for substitution ---------------------------------------
466
493
  export PROJECT_NAME="$NAME" PROJECT_SLUG="$SLUG" OWNER_NAME="$OWNER_NAME" COMMS_LANG="$LANG_PREF"
467
494
  export PROFILE GH_REPO="$REPO" GH_OWNER="$GH_OWNER" PROJECT_NUMBER PROJECT_BOARD_TITLE="$NAME"
495
+ export BASE_BRANCH
468
496
  export PLANS_DIR PLANS_FORMAT KNOWLEDGE_DIR="knowledge" WING="$SLUG" CLAUDE_PROJECT_SLUG
469
497
  export MILESTONES_HUMAN ROLES_HUMAN AGENT_TABLE SKILL_TABLE
470
498
  export KIT_FLAGS_ON="$FLAGS_ON"
@@ -538,6 +566,7 @@ if [[ $DRY_RUN -eq 1 ]]; then
538
566
  echo " Profile : $PROFILE"
539
567
  echo " Project : $NAME ($SLUG)"
540
568
  echo " Repo : $REPO"
569
+ echo " Base : $BASE_BRANCH (rules that name the integration branch render this)"
541
570
  echo " Board : $([[ "$PROJECTS_V2" == "true" ]] && echo "Projects v2 #$PROJECT_NUMBER" || echo "off (gh issues only)")"
542
571
  echo " Memory : $MEMORY_BOOL Plans: $PLANS_FORMAT Lang: $LANG_PREF"
543
572
  echo " Spec Kit: $SPECKIT_ON Pre-push gate: $PREPUSH_ENABLED Local model: $LOCAL_ON kitVersion: $PLUGIN_VERSION"
@@ -603,6 +632,7 @@ jq -n \
603
632
  --arg name "$NAME" --arg slug "$SLUG" --arg owner "$OWNER_NAME" --arg lang "$LANG_PREF" --arg path "$TARGET" \
604
633
  --arg profile "$PROFILE" --argjson roles "$ROLES_JSON" \
605
634
  --arg repo "$REPO" --arg ghowner "$GH_OWNER" \
635
+ --arg base "$BASE_BRANCH" \
606
636
  --argjson pv2 "$PROJECTS_V2" --argjson pnum "$PNUM_JSON" --arg ptitle "$NAME" \
607
637
  --argjson milestones "$MS_JSON" \
608
638
  --arg pfmt "$PLANS_FORMAT" --arg pdir "$PLANS_DIR" \
@@ -613,7 +643,7 @@ jq -n \
613
643
  '{kitVersion:$kitver,
614
644
  project:{name:$name,slug:$slug,owner:$owner,language:$lang,path:$path},
615
645
  profile:$profile, roles:$roles,
616
- github:{repo:$repo,owner:$ghowner,projectsV2:$pv2,projectNumber:$pnum,projectTitle:$ptitle},
646
+ github:{repo:$repo,owner:$ghowner,baseBranch:$base,projectsV2:$pv2,projectNumber:$pnum,projectTitle:$ptitle},
617
647
  milestones:$milestones,
618
648
  plans:{format:$pfmt,dir:$pdir},
619
649
  knowledge:{dir:"knowledge"},
@@ -3,6 +3,7 @@
3
3
  # board-view-test.sh — covers the pure board-view render helpers (#122): the merge-ordered open-PR
4
4
  # queue, the stale flag, the not-on-board flag, and Project Status lookup. Hermetic: canned JSON,
5
5
  # no gh. Run: bash scripts/lib/board-view-test.sh
6
+ # errors: strict — a test runner: rc 1 on any failed assertion
6
7
  set -u
7
8
  ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
8
9
  LIB="$ROOT/scripts/lib"
@@ -4,6 +4,7 @@
4
4
  # and emits markdown/text; none call gh, so they are unit-testable with canned fixtures (#122).
5
5
  # Ported from the host project's board view: a merge-ordered open-PR queue, a stale-issue flag, a
6
6
  # not-on-board flag, and Project Status per issue. bash 3.2 + zsh safe. Requires jq.
7
+ # errors: pure — JSON in, text out; no gh, no network
7
8
 
8
9
  # board_merge_queue <prs-json> — render the open-PR merge queue as a markdown table. <prs-json> is
9
10
  # `gh pr list --json number,title,labels,isDraft,headRefName,reviewDecision,mergeable` output.