cohorte 3.0.0-dev.7 → 3.0.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.
- package/CHANGELOG.md +1532 -0
- package/README.md +106 -185
- package/bin/cli.js +212 -0
- package/bin/report.js +141 -0
- package/core/agents/cohorte-profile-reader.md +50 -0
- package/core/agents/cohorte-release.md +58 -0
- package/core/agents/cohorte-review.md +174 -0
- package/core/agents/implementer.template.md +146 -0
- package/core/commands/cohorte-align-ds.md +33 -0
- package/core/commands/cohorte-audit.md +67 -0
- package/core/commands/cohorte-brainstorm.md +73 -0
- package/core/commands/cohorte-build.md +241 -0
- package/core/commands/cohorte-doctor.md +133 -0
- package/core/commands/cohorte-fix.md +80 -0
- package/core/commands/cohorte-fleet.md +111 -0
- package/core/commands/cohorte-init-pipeline.md +30 -0
- package/core/commands/cohorte-intake.md +92 -0
- package/core/commands/cohorte-patch.md +118 -0
- package/core/commands/cohorte-refactor.md +57 -0
- package/core/commands/cohorte-retro.md +85 -0
- package/core/commands/cohorte-review.md +224 -0
- package/core/commands/cohorte-ship.md +155 -0
- package/core/commands/cohorte-spec.md +105 -0
- package/core/commands/cohorte-update-pipeline.md +115 -0
- package/core/hooks/gate.py +2931 -0
- package/core/templates/agent-handoff.md +34 -0
- package/core/templates/brainstorm-return.md +42 -0
- package/core/templates/decisions.template.md +42 -0
- package/core/templates/design-brief.md +37 -0
- package/core/templates/patch.template.md +86 -0
- package/core/templates/pr-body.md +25 -0
- package/core/templates/review-feedback.md +46 -0
- package/core/templates/spec.template.md +88 -0
- package/core/templates/steps/init-pipeline/01-detect-stack.md +44 -0
- package/core/templates/steps/init-pipeline/02-interview-gaps.md +55 -0
- package/core/templates/steps/init-pipeline/03-draft-profile.md +9 -0
- package/core/templates/steps/init-pipeline/04-write-render.md +91 -0
- package/core/templates/steps/init-pipeline/05-report.md +11 -0
- package/core/templates/steps/review-pr/01-pr-mode.md +54 -0
- package/core/workflows/audit.js +306 -0
- package/core/workflows/loop.js +687 -0
- package/core/workflows/refactor.js +291 -0
- package/core/workflows/review.js +491 -0
- package/install.ps1 +72 -0
- package/install.sh +69 -0
- package/lib/doctor.js +472 -0
- package/lib/install.js +377 -0
- package/lib/project.js +322 -0
- package/lib/render.js +121 -0
- package/lib/versions.js +145 -0
- package/lib/yaml.js +174 -0
- package/package.json +36 -17
- package/profile/PIPELINE.template.md +250 -0
- package/profile/SCHEMA.md +749 -0
- package/profile/cohorte.config.template.yaml +43 -0
- package/scripts/feature-diff.sh +118 -0
- package/scripts/kanban-move.sh +307 -0
- package/scripts/metrics/collect.mjs +542 -0
- package/scripts/metrics/prices.json +42 -0
- package/scripts/new-feature.sh.template +122 -0
- package/scripts/preflight.sh +114 -0
- package/scripts/remove-feature.sh.template +56 -0
- package/assets/manifest.json +0 -203
- package/assets/migrations/config/README.md +0 -12
- package/assets/migrations/state/0001_init.sql +0 -154
- package/assets/prompts/README.md +0 -11
- package/assets/prompts/agents/brainstormer.md +0 -3
- package/assets/prompts/agents/fixer.md +0 -7
- package/assets/prompts/agents/implementer.md +0 -12
- package/assets/prompts/agents/reviewer.md +0 -8
- package/assets/prompts/agents/security-reviewer.md +0 -7
- package/assets/prompts/agents/spec-author.md +0 -3
- package/assets/prompts/phases/build.md +0 -5
- package/assets/prompts/phases/review.md +0 -5
- package/assets/prompts/phases/test.md +0 -5
- package/assets/prompts/system.md +0 -11
- package/assets/schemas/agent-output.schema.json +0 -225
- package/assets/schemas/auth-status.schema.json +0 -87
- package/assets/schemas/command-result.schema.json +0 -192
- package/assets/schemas/commands.schema.json +0 -959
- package/assets/schemas/config.schema.json +0 -2281
- package/assets/schemas/doctor-report.schema.json +0 -104
- package/assets/schemas/events.schema.json +0 -8514
- package/assets/schemas/fake-script.schema.json +0 -549
- package/assets/schemas/inspect.schema.json +0 -3133
- package/assets/schemas/manifest.schema.json +0 -79
- package/assets/schemas/ownership.schema.json +0 -52
- package/assets/schemas/policy-verdict.schema.json +0 -282
- package/assets/schemas/project-model.schema.json +0 -783
- package/assets/schemas/project-status.schema.json +0 -217
- package/assets/schemas/reconcile-plan.schema.json +0 -154
- package/assets/schemas/run-diff.schema.json +0 -177
- package/assets/schemas/run-snapshot-manifest.schema.json +0 -2104
- package/assets/schemas/run-state.schema.json +0 -1755
- package/assets/schemas/runtime-capabilities.schema.json +0 -1545
- package/assets/schemas/sandbox-capabilities.schema.json +0 -116
- package/assets/schemas/skill.schema.json +0 -87
- package/assets/schemas/spec.schema.json +0 -202
- package/assets/schemas/tool-catalogue.schema.json +0 -655
- package/assets/schemas/trust-record.schema.json +0 -38
- package/assets/skills/README.md +0 -9
- package/assets/skills/inspect-surface.md +0 -4
- package/dist/agent-host.mjs +0 -2187
- package/dist/agent-host.mjs.map +0 -1
- package/dist/bundle-manifest.json +0 -128
- package/dist/chunks/__host-DgGPyco9.mjs +0 -18
- package/dist/chunks/__host-DgGPyco9.mjs.map +0 -1
- package/dist/chunks/align-ds-r_X_1aQ_.mjs +0 -93
- package/dist/chunks/align-ds-r_X_1aQ_.mjs.map +0 -1
- package/dist/chunks/approve-Cv135UqI.mjs +0 -19
- package/dist/chunks/approve-Cv135UqI.mjs.map +0 -1
- package/dist/chunks/audit-B4ZWQ_DI.mjs +0 -179
- package/dist/chunks/audit-B4ZWQ_DI.mjs.map +0 -1
- package/dist/chunks/auth-BT5oVp76.mjs +0 -132
- package/dist/chunks/auth-BT5oVp76.mjs.map +0 -1
- package/dist/chunks/auth-Dnlksuo5.mjs +0 -141
- package/dist/chunks/auth-Dnlksuo5.mjs.map +0 -1
- package/dist/chunks/brainstorm-DasVwI1D.mjs +0 -123
- package/dist/chunks/brainstorm-DasVwI1D.mjs.map +0 -1
- package/dist/chunks/build-crOld8gE.mjs +0 -19
- package/dist/chunks/build-crOld8gE.mjs.map +0 -1
- package/dist/chunks/cancel-KV_cpsqS.mjs +0 -15
- package/dist/chunks/cancel-KV_cpsqS.mjs.map +0 -1
- package/dist/chunks/canonical-C8UxeEmB.mjs +0 -57
- package/dist/chunks/canonical-C8UxeEmB.mjs.map +0 -1
- package/dist/chunks/catalogue-IaCJdfB8.mjs +0 -1549
- package/dist/chunks/catalogue-IaCJdfB8.mjs.map +0 -1
- package/dist/chunks/compose-DRKjQcn0.mjs +0 -7333
- package/dist/chunks/compose-DRKjQcn0.mjs.map +0 -1
- package/dist/chunks/config-Cqu5XQoP.mjs +0 -96
- package/dist/chunks/config-Cqu5XQoP.mjs.map +0 -1
- package/dist/chunks/contract-DjssDPpS.mjs +0 -335
- package/dist/chunks/contract-DjssDPpS.mjs.map +0 -1
- package/dist/chunks/contract-bQ9FJl4N.mjs +0 -123
- package/dist/chunks/contract-bQ9FJl4N.mjs.map +0 -1
- package/dist/chunks/deny-ClTxSvHJ.mjs +0 -15
- package/dist/chunks/deny-ClTxSvHJ.mjs.map +0 -1
- package/dist/chunks/diff-Qw0II0sj.mjs +0 -101
- package/dist/chunks/diff-Qw0II0sj.mjs.map +0 -1
- package/dist/chunks/discover-BZPolSZG.mjs +0 -21
- package/dist/chunks/discover-BZPolSZG.mjs.map +0 -1
- package/dist/chunks/doctor-DcDFPvQM.mjs +0 -222
- package/dist/chunks/doctor-DcDFPvQM.mjs.map +0 -1
- package/dist/chunks/fix-B_oGzGVn.mjs +0 -82
- package/dist/chunks/fix-B_oGzGVn.mjs.map +0 -1
- package/dist/chunks/fleet-yWHQY2ya.mjs +0 -297
- package/dist/chunks/fleet-yWHQY2ya.mjs.map +0 -1
- package/dist/chunks/gc-BBXlBF5w.mjs +0 -161
- package/dist/chunks/gc-BBXlBF5w.mjs.map +0 -1
- package/dist/chunks/init--FxxkrcT.mjs +0 -63
- package/dist/chunks/init--FxxkrcT.mjs.map +0 -1
- package/dist/chunks/inspect-Buby4cQD.mjs +0 -22
- package/dist/chunks/inspect-Buby4cQD.mjs.map +0 -1
- package/dist/chunks/intake-Dd1KVXnO.mjs +0 -12
- package/dist/chunks/intake-Dd1KVXnO.mjs.map +0 -1
- package/dist/chunks/logs-Giq5sUau.mjs +0 -25
- package/dist/chunks/logs-Giq5sUau.mjs.map +0 -1
- package/dist/chunks/loop-BWsUpyus.mjs +0 -212
- package/dist/chunks/loop-BWsUpyus.mjs.map +0 -1
- package/dist/chunks/migrate-DuYCAbE3.mjs +0 -33
- package/dist/chunks/migrate-DuYCAbE3.mjs.map +0 -1
- package/dist/chunks/models-Btp6X2YZ.mjs +0 -24
- package/dist/chunks/models-Btp6X2YZ.mjs.map +0 -1
- package/dist/chunks/obsidian-BHLkXx_H.mjs +0 -235
- package/dist/chunks/obsidian-BHLkXx_H.mjs.map +0 -1
- package/dist/chunks/patch-sAgVqjpx.mjs +0 -50
- package/dist/chunks/patch-sAgVqjpx.mjs.map +0 -1
- package/dist/chunks/pause-BASBfKLO.mjs +0 -16
- package/dist/chunks/pause-BASBfKLO.mjs.map +0 -1
- package/dist/chunks/policy-Du7WVBFX.mjs +0 -139
- package/dist/chunks/policy-Du7WVBFX.mjs.map +0 -1
- package/dist/chunks/providers-Dx78imKj.mjs +0 -19
- package/dist/chunks/providers-Dx78imKj.mjs.map +0 -1
- package/dist/chunks/reconcile-BHn66X3C.mjs +0 -50
- package/dist/chunks/reconcile-BHn66X3C.mjs.map +0 -1
- package/dist/chunks/refactor-CoNoqLZr.mjs +0 -153
- package/dist/chunks/refactor-CoNoqLZr.mjs.map +0 -1
- package/dist/chunks/render-DyZr5Lgi.mjs +0 -53
- package/dist/chunks/render-DyZr5Lgi.mjs.map +0 -1
- package/dist/chunks/resume-GJQRb2Eb.mjs +0 -15
- package/dist/chunks/resume-GJQRb2Eb.mjs.map +0 -1
- package/dist/chunks/retro-Dr-2RTNN.mjs +0 -78
- package/dist/chunks/retro-Dr-2RTNN.mjs.map +0 -1
- package/dist/chunks/retry-CLrUem1H.mjs +0 -15
- package/dist/chunks/retry-CLrUem1H.mjs.map +0 -1
- package/dist/chunks/review-ZsBqp3vZ.mjs +0 -35
- package/dist/chunks/review-ZsBqp3vZ.mjs.map +0 -1
- package/dist/chunks/run-NGAxdsIX.mjs +0 -105
- package/dist/chunks/run-NGAxdsIX.mjs.map +0 -1
- package/dist/chunks/run-tool-C3rAv4XF.mjs +0 -26
- package/dist/chunks/run-tool-C3rAv4XF.mjs.map +0 -1
- package/dist/chunks/scan-C5uDr7Yq.mjs +0 -167
- package/dist/chunks/scan-C5uDr7Yq.mjs.map +0 -1
- package/dist/chunks/schema-Bq9qtgsd.mjs +0 -583
- package/dist/chunks/schema-Bq9qtgsd.mjs.map +0 -1
- package/dist/chunks/send-BdnJ85Nz.mjs +0 -19
- package/dist/chunks/send-BdnJ85Nz.mjs.map +0 -1
- package/dist/chunks/ship-BizfUe62.mjs +0 -140
- package/dist/chunks/ship-BizfUe62.mjs.map +0 -1
- package/dist/chunks/shutdown-BM92Iyv2.mjs +0 -15
- package/dist/chunks/shutdown-BM92Iyv2.mjs.map +0 -1
- package/dist/chunks/skip-DZG5kpcH.mjs +0 -18
- package/dist/chunks/skip-DZG5kpcH.mjs.map +0 -1
- package/dist/chunks/spec-C2h3U64g.mjs +0 -65
- package/dist/chunks/spec-C2h3U64g.mjs.map +0 -1
- package/dist/chunks/spec-path-tptqR7W8.mjs +0 -10
- package/dist/chunks/spec-path-tptqR7W8.mjs.map +0 -1
- package/dist/chunks/src-Bfr1yzsn.mjs +0 -1689
- package/dist/chunks/src-Bfr1yzsn.mjs.map +0 -1
- package/dist/chunks/src-CPW2_Ons.mjs +0 -5487
- package/dist/chunks/src-CPW2_Ons.mjs.map +0 -1
- package/dist/chunks/src-Cu3TxNob.mjs +0 -783
- package/dist/chunks/src-Cu3TxNob.mjs.map +0 -1
- package/dist/chunks/src-DNsLSxgm.mjs +0 -928
- package/dist/chunks/src-DNsLSxgm.mjs.map +0 -1
- package/dist/chunks/src-DbS9gkJy.mjs +0 -117
- package/dist/chunks/src-DbS9gkJy.mjs.map +0 -1
- package/dist/chunks/src-yi5whv3n.mjs +0 -2118
- package/dist/chunks/src-yi5whv3n.mjs.map +0 -1
- package/dist/chunks/status-SMjiOMYy.mjs +0 -29
- package/dist/chunks/status-SMjiOMYy.mjs.map +0 -1
- package/dist/chunks/tail-BuhT-2PH.mjs +0 -25
- package/dist/chunks/tail-BuhT-2PH.mjs.map +0 -1
- package/dist/chunks/update-BXIppsbi.mjs +0 -16
- package/dist/chunks/update-BXIppsbi.mjs.map +0 -1
- package/dist/chunks/update-pipeline-Du-Gu1Pl.mjs +0 -56
- package/dist/chunks/update-pipeline-Du-Gu1Pl.mjs.map +0 -1
- package/dist/cli.mjs +0 -186
- package/dist/cli.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -13,16 +13,9 @@
|
|
|
13
13
|
|
|
14
14
|
</div>
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
For maintainers, see the [maintenance and release guide](docs/guide/maintainers.md) for the architecture, test
|
|
21
|
-
matrix, troubleshooting, PR workflow and npm/GitHub release procedure.
|
|
22
|
-
|
|
23
|
-
A **portable, stack-agnostic multi-agent pipeline** for your coding agent — Claude Code, Codex CLI,
|
|
24
|
-
Cursor, Gemini CLI or OpenCode. Install it once globally, then one command per project
|
|
25
|
-
(`/cohorte-init-pipeline`) adapts it to that project's stack.
|
|
16
|
+
A **stack-agnostic multi-agent pipeline for [Claude Code](https://code.claude.com)**. Install it once
|
|
17
|
+
on your machine, then one command per project (`/cohorte-init-pipeline`) adapts it to that project's
|
|
18
|
+
stack — and everything it generates is committed with the project.
|
|
26
19
|
|
|
27
20
|
- **The dev pipeline** — a human **lead** drives feature work through gated commands, dispatching
|
|
28
21
|
**stateless agents** that only communicate through a frozen contract:
|
|
@@ -49,8 +42,8 @@ that degradation. Each one is a failure you have already had:
|
|
|
49
42
|
| --- | --- |
|
|
50
43
|
| *"It forgot what we decided."* | The spec is **frozen to disk** and re-read by every stateless agent. Nothing is remembered, so nothing is forgotten — and `/clear` between stages is always safe. |
|
|
51
44
|
| *"The API and the UI don't fit."* | The **contract is authored before any implementer is dispatched**. Surfaces import it read-only and never talk to each other — which is what makes building them in parallel safe. |
|
|
52
|
-
| *"It edited a file I didn't want it to."* | **One owner per tree
|
|
53
|
-
| *"It ran something it shouldn't have."* |
|
|
45
|
+
| *"It edited a file I didn't want it to."* | **One owner per tree**: each surface agent is rendered with its own tree and told it owns nothing else, and the review flags any write outside it. (A convention the agents follow and the review checks — not a sandbox.) |
|
|
46
|
+
| *"It ran something it shouldn't have."* | The **gate** is a real blocking hook committed in the repo, branch-aware, parsing commands (not grepping them) to deny force-pushes, pushes to the default branch and the project's destructive commands — subagents included. It fails closed. It is a strong guard against agent mistakes, not a sandbox: keep GitHub branch protection as the hard boundary for the remote. |
|
|
54
47
|
| *"The review said it was fine."* | Review is a **separate read-only agent** that sees the spec and the diff, never the conversation that produced them. A dead reviewer's zero findings can't read as ship. |
|
|
55
48
|
| *"Four agents just told me it doesn't compile."* | A **deterministic preflight** runs typecheck/lint/tests first. Red ⇒ **zero agents spawned**. |
|
|
56
49
|
| *"We fixed this same thing last week."* | `/cohorte-retro` turns repeated findings into ratified conventions **baked into the implementers**, so the next build never produces them. |
|
|
@@ -62,13 +55,18 @@ hook: **your app code never imports anything from Cohorte.**
|
|
|
62
55
|
|
|
63
56
|
[**The long version — including the four cases where you shouldn't use it →**](https://thebidouilleagency.github.io/cohorte/guide/why-cohorte)
|
|
64
57
|
|
|
65
|
-
## How it works —
|
|
58
|
+
## How it works — one install, everything else in the repo
|
|
59
|
+
|
|
60
|
+
| What | Holds | Lives in |
|
|
61
|
+
| --- | --- | --- |
|
|
62
|
+
| **The machine install** (`cohorte install`, once) | the 16 `/cohorte-*` commands, the `cohorte-review` / `cohorte-release` / `cohorte-profile-reader` agents, the workflow scripts, the generic core (templates, schema, scripts, the gate's source) — zero project facts | `~/.claude/commands/cohorte-*.md`, `~/.claude/agents/cohorte-*.md`, `~/.claude/workflows/cohorte-*.js`, `~/.claude/cohorte/` |
|
|
63
|
+
| **The project** (generated by `/cohorte-init-pipeline`, **committed**) | the profile (stack, surfaces, commands, conventions, gates), one implementer agent per surface, the gate hook and its registration, the version pointer, the specs | `PIPELINE.md`, `.claude/agents/<surface>.md`, `.claude/gate-config.json`, `.claude/hooks/cohorte-gate.py` + `.claude/settings.json`, `.claude/pipeline.json`, `specs/` |
|
|
64
|
+
| **You** | kanban board links + shared Obsidian vault path | `~/.claude/cohorte.config.yaml` |
|
|
66
65
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
| **User config** | kanban board links + shared Obsidian vault path | `~/.claude/cohorte.config.yaml` | personal, project-independent |
|
|
66
|
+
Everything project-specific travels with `git clone` — **including the gate**: a teammate who clones
|
|
67
|
+
is protected before they even install Cohorte, and only needs `npm i -g cohorte && cohorte install`
|
|
68
|
+
to get the commands. Nothing project-specific is ever written under `~/.claude`, so two projects
|
|
69
|
+
with a `frontend` surface never overwrite each other's agent.
|
|
72
70
|
|
|
73
71
|
The core never hardcodes stack facts. Two mechanisms keep it generic:
|
|
74
72
|
|
|
@@ -78,128 +76,45 @@ The core never hardcodes stack facts. Two mechanisms keep it generic:
|
|
|
78
76
|
2. **Render-at-init** — things that must be in agent frontmatter (name, `tools:`, surface ownership)
|
|
79
77
|
are rendered per **surface** by `/cohorte-init-pipeline` from `implementer.template.md`.
|
|
80
78
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
actually reads, and branches the instructions on what it can actually do:
|
|
85
|
-
|
|
86
|
-
```sh
|
|
87
|
-
cohorte install --runtime=codex,cursor # pick explicitly
|
|
88
|
-
cohorte install --all-runtimes # every supported one
|
|
89
|
-
cohorte install # detects what you have and asks
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
| | Commands | Subagents | Gate | Workflows |
|
|
93
|
-
| --- | --- | --- | --- | --- |
|
|
94
|
-
| **Claude Code** | `.claude/commands/*.md` | ✅ `.claude/agents` | ✅ blocking hook, deny + **ask** | ✅ |
|
|
95
|
-
| **Codex CLI** | `.agents/skills/*/SKILL.md` | ✅ `.codex/agents` (TOML) | ✅ blocking hook, deny only | — |
|
|
96
|
-
| **Cursor** | `.cursor/commands/*.md` | ✅ `.cursor/agents` | ✅ blocking hook, deny + **ask** | — |
|
|
97
|
-
| **Gemini CLI** | `.gemini/commands/*.toml` | ✅ `.gemini/agents` | ✅ blocking hook, deny only | — |
|
|
98
|
-
| **OpenCode** | `.opencode/commands/*.md` | ✅ `.opencode/agents` | advisory `--check` | — |
|
|
99
|
-
|
|
100
|
-
The same `gate.py` is registered as a real blocking hook on four of the five — it speaks each
|
|
101
|
-
runtime's envelope (`PreToolUse`, `beforeShellExecution`, `BeforeTool`). Codex and Gemini have **no
|
|
102
|
-
confirmation tier**, so a pattern that would be queried elsewhere is **denied** there rather than
|
|
103
|
-
falling through; the rendered prompts say so. OpenCode extends via plugins rather than hooks, so
|
|
104
|
-
there the commands call `gate.py --check` themselves — same config and verdicts, but advisory.
|
|
105
|
-
|
|
106
|
-
**Real subagents are a requirement, not a capability to degrade around** — the pipeline's isolation
|
|
107
|
-
guarantee is that boundary, so a runtime without them is refused at install rather than rendered
|
|
108
|
-
into a pipeline whose central promise is absent. All five have them.
|
|
109
|
-
`/cohorte-doctor` reports what the runtime you are in can actually enforce.
|
|
110
|
-
|
|
111
|
-
On Codex the commands ship as **skills** (`$cohorte-build`) rather than custom prompts: prompts are
|
|
112
|
-
deprecated and user-scoped, so a teammate cloning the repo would get the profile but none of the
|
|
113
|
-
commands — `.agents/skills/` is committed with it instead.
|
|
114
|
-
|
|
115
|
-
One thing does not travel: model pins. The profile names Anthropic aliases, meaningless elsewhere,
|
|
116
|
-
so agents inherit the runtime's own model. Claude Code remains the reference implementation and its
|
|
117
|
-
install is unchanged.
|
|
79
|
+
> **Claude Code only.** 3.0.0 dropped Codex, Cursor, Gemini CLI and OpenCode. The last multi-runtime
|
|
80
|
+
> release is `cohorte@2.10.2`; its source is on the
|
|
81
|
+
> [`archive/multi-runtime`](https://github.com/TheBidouilleAgency/cohorte/tree/archive/multi-runtime) branch.
|
|
118
82
|
|
|
119
83
|
## Prerequisites
|
|
120
84
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
-
|
|
85
|
+
- **Node ≥ 20 + npm** — for the `cohorte` CLI.
|
|
86
|
+
- **Python ≥ 3.9** as `python3` — the gate hook every project commits runs on it. The hook is
|
|
87
|
+
fail-closed: without Python, Claude Code refuses every Bash call in a Cohorte project.
|
|
88
|
+
**Windows:** the committed hook is `python3 "$CLAUDE_PROJECT_DIR/.claude/hooks/cohorte-gate.py"`, so
|
|
89
|
+
each teammate needs `python3` on `PATH` and Claude Code running hooks through a POSIX shell (Git
|
|
90
|
+
Bash); this setup is not covered by CI yet.
|
|
91
|
+
- **Claude Code** — workflows (the opt-in deterministic runs) need ≥ 2.1.154; the hook's
|
|
92
|
+
fail-closed `onFailure` setting is honoured from 2.1.295 (older clients ignore it and fail open).
|
|
124
93
|
- **[`uv`](https://docs.astral.sh/uv/) + the Serena CLI** — _optional_, the default code-retrieval
|
|
125
|
-
provider
|
|
126
|
-
|
|
127
|
-
the pipeline still runs — agents just fall back to Grep/Read. Having it installed **before**
|
|
128
|
-
`/cohorte-init-pipeline` lets init wire it in one pass (otherwise `/cohorte-update-pipeline` wires it later).
|
|
129
|
-
- **On a new machine cloning a repo that's already pipeline-ised:** the Serena registration is committed
|
|
130
|
-
in the repo's `.mcp.json` (project scope, portable) — you don't re-wire. Just install the Serena CLI,
|
|
131
|
-
restart the session, and run `/cohorte-doctor` to confirm it connects.
|
|
94
|
+
provider (`uv tool install -p 3.13 serena-agent && uv tool update-shell`). Without it agents fall back
|
|
95
|
+
to Grep/Read. Installed before `/cohorte-init-pipeline`, init wires it in one pass.
|
|
132
96
|
|
|
133
97
|
## Install
|
|
134
98
|
|
|
135
|
-
The pipeline ships as an npm package (`cohorte`), so releases are semver-tagged — no clone
|
|
136
|
-
needed, works on macOS/Linux/Windows. **Install it once, globally**; every command below is
|
|
137
|
-
written as `cohorte …`, and that single form is what the rest of this README, the docs, and the
|
|
138
|
-
[Francois extension](https://github.com/TheBidouilleAgency/francois-plugin-cohorte) all assume:
|
|
139
|
-
|
|
140
99
|
```sh
|
|
141
100
|
npm i -g cohorte
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
`npx cohorte <verb>` runs any of them without installing anything, for a one-off on a machine
|
|
145
|
-
you don't own. It is the escape hatch, not the path — see
|
|
146
|
-
[why one form](https://thebidouilleagency.github.io/cohorte/reference/installers).
|
|
147
|
-
|
|
148
|
-
**Global (recommended)** — install the generic core ONCE into `~/.claude`; it serves every repo on
|
|
149
|
-
your machine. Nothing is copied per project; the gate hook is registered once and reads each repo's
|
|
150
|
-
own `gate-config.json`:
|
|
151
|
-
|
|
152
|
-
```sh
|
|
153
|
-
cohorte install --global
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
The per-project part is NOT the core — it's the **profile** `/cohorte-init-pipeline` generates and you
|
|
157
|
-
commit: `PIPELINE.md`, the rendered surface agents, `gate-config.json`, `settings.json`, `specs/`.
|
|
158
|
-
**That's what makes team work possible in global mode**: everything project-specific travels with the
|
|
159
|
-
repo; each teammate just runs the same global one-liner once, guided by the committed
|
|
160
|
-
`.claude/pipeline.json` pointer (core version + install command) that `/cohorte-init-pipeline` writes.
|
|
161
|
-
|
|
162
|
-
<details>
|
|
163
|
-
<summary><strong>Alternative: per-project (bundled)</strong> — vendor the core into the repo itself.</summary>
|
|
164
|
-
|
|
165
|
-
```sh
|
|
166
|
-
# inside your project (or pass its path as an argument)
|
|
167
101
|
cohorte install
|
|
168
102
|
```
|
|
169
103
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
104
|
+
`cohorte install` writes only into `~/.claude` (or `$CLAUDE_CONFIG_DIR`) and records every file it
|
|
105
|
+
writes in `~/.claude/cohorte/manifest.json`. It never deletes a file it did not write, backs up any
|
|
106
|
+
file of its own you edited before refreshing it, and refuses to run — changing nothing — if
|
|
107
|
+
`~/.claude/settings.json` is not valid JSON. It registers **no** machine-wide hook.
|
|
174
108
|
|
|
175
|
-
|
|
109
|
+
> **Restart Claude Code** (or start a new session) after installing or updating: commands and agents
|
|
110
|
+
> are scanned at session start.
|
|
176
111
|
|
|
177
|
-
|
|
178
|
-
|
|
112
|
+
Without a global npm install: `npx cohorte@latest install`, or
|
|
113
|
+
`curl -fsSL https://raw.githubusercontent.com/TheBidouilleAgency/cohorte/main/install.sh | sh`
|
|
114
|
+
(Windows: `irm https://raw.githubusercontent.com/TheBidouilleAgency/cohorte/main/install.ps1 | iex`).
|
|
115
|
+
Both scripts still need Node and install the **latest release**, not the tip of `main`.
|
|
179
116
|
|
|
180
|
-
|
|
181
|
-
# global (recommended) # per-project (bundled)
|
|
182
|
-
sh install.sh --global sh install.sh
|
|
183
|
-
# or piped:
|
|
184
|
-
curl -fsSL https://raw.githubusercontent.com/TheBidouilleAgency/cohorte/main/install.sh | sh -s -- --global
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
```powershell
|
|
188
|
-
# Windows (PowerShell 5.1+)
|
|
189
|
-
.\install.ps1 -Global # or without -Global for per-project
|
|
190
|
-
# or: & ([scriptblock]::Create((irm https://raw.githubusercontent.com/TheBidouilleAgency/cohorte/main/install.ps1))) -Global
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
Script installs from a git checkout stamp the version as `<semver> (<sha>)`; the npm CLI stamps the
|
|
194
|
-
published semver. Both land in `.claude/pipeline/VERSION` and the `pipeline.json` pointer.
|
|
195
|
-
|
|
196
|
-
</details>
|
|
197
|
-
|
|
198
|
-
> **After installing (or updating): restart Claude Code / start a new session.** Slash commands and
|
|
199
|
-
> agents are scanned at session start — in an already-open session the new `/cohorte-init-pipeline`,
|
|
200
|
-
> `/cohorte-build`, etc. won't appear until you reload. This is the #1 "the install didn't work" trap.
|
|
201
|
-
|
|
202
|
-
Then, in Claude Code (from any repo, once the core is installed either way):
|
|
117
|
+
Then, in Claude Code, inside each project, once:
|
|
203
118
|
|
|
204
119
|
```
|
|
205
120
|
/cohorte-init-pipeline
|
|
@@ -209,40 +124,52 @@ It **detects** your stack (package manager, workspaces, frameworks, test runners
|
|
|
209
124
|
design system), **interviews** you for the gaps, and **generates**:
|
|
210
125
|
|
|
211
126
|
- `PIPELINE.md` — the project profile (a machine-readable `pipeline-profile` YAML block + prose conventions)
|
|
212
|
-
- one implementer agent per **surface** (e.g. `backend.md`, `frontend.md`) with
|
|
213
|
-
and a per-surface `model:` tier
|
|
214
|
-
- `.claude/gate-config.json` + `.claude/settings.json` —
|
|
215
|
-
|
|
127
|
+
- one implementer agent per **surface** in `.claude/agents/` (e.g. `backend.md`, `frontend.md`) with its
|
|
128
|
+
own tree and a per-surface `model:` tier
|
|
129
|
+
- `.claude/gate-config.json` + the `.claude/settings.json` permissions — plus an `allow` list of the
|
|
130
|
+
project's read-only commands so agents don't stall on permission prompts
|
|
131
|
+
- the **gate**, via `cohorte sync`: `.claude/hooks/cohorte-gate.py` registered in `.claude/settings.json`,
|
|
132
|
+
the `.claude/pipeline.json` pointer, and the `.gitignore` entries for the local-only artifacts
|
|
216
133
|
- a **code-retrieval provider** wired as a committed project-scope MCP server —
|
|
217
|
-
[Serena](https://github.com/oraios/serena) by default (
|
|
218
|
-
symbols instead of grep-and-reading whole files; `graphify` or `none` also available via the
|
|
219
|
-
profile's `retrieval.provider`)
|
|
134
|
+
[Serena](https://github.com/oraios/serena) by default (`graphify` or `none` via `retrieval.provider`)
|
|
220
135
|
- `scripts/new-feature.sh` + `remove-feature.sh` — parallel worktree isolation (if you enable it)
|
|
221
136
|
- `specs/_template.md` (and, on first decision, `specs/_decisions.md` — the project's one-line-per-decision
|
|
222
|
-
journal, read by `/cohorte-brainstorm`, `/cohorte-spec` and `/cohorte-audit`
|
|
137
|
+
journal, read by `/cohorte-brainstorm`, `/cohorte-spec` and `/cohorte-audit`)
|
|
223
138
|
|
|
224
|
-
Sanity-check `PIPELINE.md`, commit
|
|
139
|
+
Sanity-check `PIPELINE.md`, commit what init lists, and run `/cohorte-brainstorm`.
|
|
225
140
|
|
|
226
141
|
## Update
|
|
227
142
|
|
|
228
143
|
```sh
|
|
229
|
-
npm i -g cohorte@latest
|
|
230
|
-
cohorte update --global # the shared core in ~/.claude (recommended setup)
|
|
231
|
-
cohorte update # a repo's bundled core in <project>/.claude
|
|
144
|
+
npm i -g cohorte@latest && cohorte update
|
|
232
145
|
```
|
|
233
146
|
|
|
234
|
-
|
|
147
|
+
`cohorte update` is the same idempotent operation as `install`: it refreshes the machine install and
|
|
148
|
+
removes files the previous version shipped and this one does not (only when you have not edited them).
|
|
149
|
+
Then, inside each project, run **`/cohorte-update-pipeline`**: it runs `cohorte sync` (refreshes the
|
|
150
|
+
committed gate and the pointer) and **reconciles the repo's generated files to the new core** — new
|
|
151
|
+
profile fields at their defaults, surface agents re-rendered, permissions patched additively, new
|
|
152
|
+
capabilities wired. `/cohorte-init-pipeline` is one-time per project.
|
|
153
|
+
|
|
154
|
+
### From 2.x
|
|
155
|
+
|
|
156
|
+
`cohorte update` migrates a 2.x machine: it first removes the 2.x gate registration from
|
|
157
|
+
`~/.claude/settings.json`, then moves the 2.x core (`~/.claude/pipeline/`, `templates/`, `hooks/gate.py`,
|
|
158
|
+
`agents/review.md`…) into `~/.claude/cohorte/legacy-backup/<date>/`. Your own files are never moved.
|
|
159
|
+
Then run `/cohorte-update-pipeline` in each project (or `cohorte sync <project>`): a vendored 2.x core
|
|
160
|
+
in the repo is removed (git keeps it), the pointer loses its `mode`, and surface agents a 2.x global
|
|
161
|
+
init put in `~/.claude/agents` are re-rendered into the project. If you ever tried the discontinued
|
|
162
|
+
Python line (`cohorte@dev` 3.0.0-dev.*, `cohorte-engine` on PyPI): `uv tool uninstall cohorte-engine`
|
|
163
|
+
(or `pipx uninstall cohorte-engine`) so its `cohorte` binary cannot shadow this one, and delete
|
|
164
|
+
`~/.cohorte/` and any `.cohorte/` directory it left in your repos.
|
|
235
165
|
|
|
236
|
-
|
|
237
|
-
`PIPELINE.md`, rendered agents, `gate-config.json`, `settings.json`, or your filled
|
|
238
|
-
`~/.claude/cohorte.config.yaml`.
|
|
166
|
+
## Uninstall
|
|
239
167
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
maintenance command you ever run (`/cohorte-build` auto-grows surfaces as specs need them).
|
|
168
|
+
```sh
|
|
169
|
+
cohorte uninstall # everything install wrote (your edits are kept and listed)
|
|
170
|
+
cohorte uninstall --purge # …and ~/.claude/cohorte.config.yaml
|
|
171
|
+
cohorte uninstall --project [path] # the gate wiring of one repo (PIPELINE.md, agents, specs stay)
|
|
172
|
+
```
|
|
246
173
|
|
|
247
174
|
## Reading a project without an agent
|
|
248
175
|
|
|
@@ -280,20 +207,12 @@ francois ext install TheBidouilleAgency/francois-plugin-cohorte
|
|
|
280
207
|
|
|
281
208
|
## Releasing (maintainers)
|
|
282
209
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
publishing
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
**Releasing = editing one line.** Bump `"version"` in `package.json` (by hand, or
|
|
290
|
-
`npm version patch --no-git-tag-version`), commit, push — CI does the rest (publish + tag +
|
|
291
|
-
release). No local tagging needed.
|
|
292
|
-
|
|
293
|
-
`npm i -g cohorte@latest` then serves the new version everywhere; installed cores record
|
|
294
|
-
it in `.claude/pipeline/VERSION` and bundled repos in their committed `pipeline.json` pointer.
|
|
295
|
-
`install` and `update` compare themselves against the registry and say so when they are behind,
|
|
296
|
-
so a CLI pinned at an old version cannot quietly re-lay an old core.
|
|
210
|
+
Bump `"version"` in `package.json` and add its `## X.Y.Z — YYYY-MM-DD` section to `CHANGELOG.md`, then
|
|
211
|
+
merge to `main`. [`publish.yml`](.github/workflows/publish.yml) starts only **after CI succeeded** on
|
|
212
|
+
that commit, re-runs the suites, and waits for a maintainer's approval (the `npm-publish` environment)
|
|
213
|
+
before publishing with provenance, tagging `vX.Y.Z` and creating the GitHub release. A pre-release
|
|
214
|
+
version (`3.1.0-rc.1`) is published under the `next` dist-tag, never `latest`. `npm test` runs every
|
|
215
|
+
suite locally.
|
|
297
216
|
|
|
298
217
|
## The commands
|
|
299
218
|
|
|
@@ -313,7 +232,7 @@ so a CLI pinned at an old version cannot quietly re-lay an old core.
|
|
|
313
232
|
| `/cohorte-refactor <domain>` | Apply the backlog for one surface, TDD-first. |
|
|
314
233
|
| `/cohorte-retro [last n]` | Mine the accumulated review findings for patterns; ratified ones become §Conventions rules and the surface agents are re-rendered — the next build never produces the finding. |
|
|
315
234
|
| `/cohorte-align-ds` | Align the code UI kit to the design system (no-op if none configured). |
|
|
316
|
-
| `/cohorte-update-pipeline` | Refresh the
|
|
235
|
+
| `/cohorte-update-pipeline` | Refresh the machine install, re-wire this repo (`cohorte sync`) and reconcile its generated files. |
|
|
317
236
|
| `/cohorte-doctor` | Diagnose the installation (core, agents↔surfaces, hooks, gate, retrieval, worktrees). |
|
|
318
237
|
|
|
319
238
|
### Run the loop cheaply — `/clear` between stages
|
|
@@ -369,15 +288,15 @@ Rules that make it safe:
|
|
|
369
288
|
|
|
370
289
|
Four **workflow scripts** ship for the Claude Code Workflow runtime — the same fan-out the
|
|
371
290
|
commands orchestrate, but driven by a deterministic script instead of the lead reasoning it out
|
|
372
|
-
turn by turn. Three are opt-in variants of their
|
|
373
|
-
exists **only** as a workflow:
|
|
291
|
+
turn by turn. They are installed in `~/.claude/workflows/`. Three are opt-in variants of their
|
|
292
|
+
same-named commands; the fourth, `cohorte-loop.js`, exists **only** as a workflow:
|
|
374
293
|
|
|
375
294
|
| Script | What it runs |
|
|
376
295
|
| ----------------------- | ----------------------------------------------------------------------------------------- |
|
|
377
|
-
| `
|
|
378
|
-
| `
|
|
379
|
-
| `
|
|
380
|
-
| `
|
|
296
|
+
| `cohorte-review.js` | Preflight gate (aborts while red — zero agents), one reviewer per touched surface, adversarial cross-check of CRITICAL/security findings, merged verdict only. |
|
|
297
|
+
| `cohorte-audit.js` | One auditor per domain (every surface + shared) concurrently, prioritized `specs/refactor-backlog.md`. |
|
|
298
|
+
| `cohorte-refactor.js` | Big domains only: `shared` first and alone, then parallel surface implementers, per-domain verify + one retry. |
|
|
299
|
+
| `cohorte-loop.js` | The loop workflow — build → review → [fix → review]* for one feature, unattended and resumable; exits on zero blocking findings, treading water, maxRounds, or anything that needs a human (contract change, unreviewed surface). No conversational fallback, on purpose. |
|
|
381
300
|
|
|
382
301
|
The essentials:
|
|
383
302
|
|
|
@@ -390,7 +309,7 @@ The essentials:
|
|
|
390
309
|
anything: whatever would have been a mid-run question lands in the result at the end. The
|
|
391
310
|
destructive-command gate still fires inside workflow subagents; in unattended runs its confirms
|
|
392
311
|
become denies.
|
|
393
|
-
- Phase 0 of every script is the `profile-reader` agent (haiku) — it reads `PIPELINE.md` and hands
|
|
312
|
+
- Phase 0 of every script is the `cohorte-profile-reader` agent (haiku) — it reads `PIPELINE.md` and hands
|
|
394
313
|
the script the profile as JSON, since workflow scripts have no filesystem access. Mechanical
|
|
395
314
|
phases run on haiku; judgment phases use the same pinned agents as the commands.
|
|
396
315
|
|
|
@@ -400,9 +319,10 @@ Details: `profile/SCHEMA.md` §Workflows.
|
|
|
400
319
|
|
|
401
320
|
Cohorte sends nothing, anywhere. There is no telemetry, no usage pings, no collector — the
|
|
402
321
|
opt-in stats that shipped through 2.2.0 were removed in 2.3.0, sender included. Everything the
|
|
403
|
-
pipeline records (`pipeline-metrics.jsonl`, `specs/reports/`) stays in your repo
|
|
404
|
-
|
|
405
|
-
|
|
322
|
+
pipeline records (`pipeline-metrics.jsonl`, `specs/reports/`) stays in your repo. The network calls
|
|
323
|
+
are the ones you can see — `git`, `gh`, whatever MCP providers you wired — plus one read-only lookup
|
|
324
|
+
of the latest published version on `registry.npmjs.org` by `cohorte install/update/sync/doctor`
|
|
325
|
+
(`COHORTE_NO_VERSION_CHECK=1` turns it off).
|
|
406
326
|
|
|
407
327
|
## License
|
|
408
328
|
|
|
@@ -416,22 +336,23 @@ See `profile/SCHEMA.md` for every field in `PIPELINE.md` and how the pipeline us
|
|
|
416
336
|
## Layout of this repo
|
|
417
337
|
|
|
418
338
|
```
|
|
419
|
-
package.json # npm package (cohorte) — semver source of truth
|
|
420
|
-
bin/cli.js # the
|
|
339
|
+
package.json # npm package (cohorte) — semver source of truth; `npm test` runs every suite
|
|
340
|
+
bin/cli.js # the CLI: install / update / sync / uninstall / doctor / specs / metrics / version
|
|
421
341
|
bin/report.js # the four renderings of `specs` / `doctor` (human, porcelain, json, panel)
|
|
422
|
-
lib/
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
342
|
+
lib/install.js # the machine install: manifest, ownership rules, 2.x migration, uninstall
|
|
343
|
+
lib/project.js # `cohorte sync`: wires one repo (self-contained; also copied into the core)
|
|
344
|
+
lib/render.js # renders core/commands + core/agents for Claude Code (one preamble of path tokens)
|
|
345
|
+
lib/doctor.js # the JS port of /cohorte-doctor, + versions.js / yaml.js. No dependencies.
|
|
346
|
+
install.sh, install.ps1 # thin wrappers around bin/cli.js for installs without a global npm
|
|
347
|
+
core/
|
|
348
|
+
agents/ # implementer.template.md (rendered per surface) + cohorte-review / -release / -profile-reader
|
|
349
|
+
commands/ # the 16 /cohorte-* commands
|
|
350
|
+
hooks/gate.py # the gate (copied into each project as .claude/hooks/cohorte-gate.py)
|
|
351
|
+
templates/ # handoff / brainstorm-return / design-brief / review-feedback / pr-body / spec + step files
|
|
352
|
+
workflows/ # Workflow-runtime scripts: review / audit / refactor (opt-in variants) + loop (workflow-only)
|
|
432
353
|
profile/
|
|
433
354
|
PIPELINE.template.md # the profile skeleton /cohorte-init-pipeline fills
|
|
434
355
|
SCHEMA.md # field reference
|
|
435
356
|
cohorte.config.template.yaml # seeds ~/.claude/cohorte.config.yaml (kanban)
|
|
436
|
-
scripts/ # worktree-isolation templates
|
|
357
|
+
scripts/ # shipped preflight/kanban scripts, worktree-isolation templates, metrics, the test suites
|
|
437
358
|
```
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// cohorte — CLI for the multi-agent dev pipeline for Claude Code.
|
|
3
|
+
//
|
|
4
|
+
// npm i -g cohorte # the CLI, and the `cohorte` binary on PATH
|
|
5
|
+
// cohorte install # once per machine: commands, agents, workflows, core → ~/.claude
|
|
6
|
+
// cohorte sync [project] # wire one repo: gate hook, pointer, .gitignore (init/update run it)
|
|
7
|
+
// cohorte update # refresh the machine-wide install (same as install, idempotent)
|
|
8
|
+
// cohorte uninstall # remove exactly what install wrote
|
|
9
|
+
//
|
|
10
|
+
// One mode since 3.0.0: the machine gets the commands and the generic core; everything that
|
|
11
|
+
// describes a project (PIPELINE.md, surface agents, gate config, the gate hook) lives in that
|
|
12
|
+
// project and is committed with it.
|
|
13
|
+
|
|
14
|
+
'use strict';
|
|
15
|
+
|
|
16
|
+
const fs = require('fs');
|
|
17
|
+
const os = require('os');
|
|
18
|
+
const path = require('path');
|
|
19
|
+
const { spawnSync } = require('child_process');
|
|
20
|
+
|
|
21
|
+
const pkgRoot = path.resolve(__dirname, '..');
|
|
22
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(pkgRoot, 'package.json'), 'utf8'));
|
|
23
|
+
const VERSION = pkg.version;
|
|
24
|
+
const globalDir = process.env.CLAUDE_CONFIG_DIR || path.join(os.homedir(), '.claude');
|
|
25
|
+
|
|
26
|
+
function usage(code) {
|
|
27
|
+
console.log(`cohorte v${VERSION}
|
|
28
|
+
|
|
29
|
+
Usage:
|
|
30
|
+
cohorte install Install (or refresh) cohorte on this machine
|
|
31
|
+
cohorte update Same as install — idempotent, migrates a 2.x install
|
|
32
|
+
cohorte sync [project] Wire one repo (run by /cohorte-init-pipeline and /cohorte-update-pipeline)
|
|
33
|
+
cohorte uninstall [--purge] Remove what install wrote (--purge also removes your config)
|
|
34
|
+
cohorte uninstall --project [project] Remove what sync wrote in one repo
|
|
35
|
+
cohorte doctor [project] [--porcelain | --json | --panel]
|
|
36
|
+
cohorte specs [project] [--porcelain | --json | --panel]
|
|
37
|
+
cohorte metrics [project] [--days=N] [--since=ISO] [--runs] [--json]
|
|
38
|
+
cohorte version
|
|
39
|
+
|
|
40
|
+
Where things go:
|
|
41
|
+
This machine (${displayHome(globalDir)}):
|
|
42
|
+
commands/cohorte-*.md, agents/cohorte-*.md, workflows/cohorte-*.js, cohorte/ (core + manifest),
|
|
43
|
+
cohorte.config.yaml (your kanban/vault config — seeded once, never overwritten).
|
|
44
|
+
Each project (committed):
|
|
45
|
+
PIPELINE.md, .claude/agents/<surface>.md, .claude/gate-config.json,
|
|
46
|
+
.claude/hooks/cohorte-gate.py + its registration in .claude/settings.json, .claude/pipeline.json.
|
|
47
|
+
|
|
48
|
+
install never deletes a file it did not write, backs up any file of ours you modified, and
|
|
49
|
+
refuses to run if ~/.claude/settings.json is not valid JSON.
|
|
50
|
+
|
|
51
|
+
doctor runs the same checks as /cohorte-doctor without a coding agent; exits 1 when any check
|
|
52
|
+
is bad (CI-friendly). --panel emits the payload the Francois extension panel expects.
|
|
53
|
+
CLAUDE_CONFIG_DIR moves ${displayHome(path.join(os.homedir(), '.claude'))}; COHORTE_NO_VERSION_CHECK=1 skips the npm lookup.`);
|
|
54
|
+
process.exit(code);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function displayHome(p) {
|
|
58
|
+
const home = os.homedir();
|
|
59
|
+
return p.startsWith(home + path.sep) ? '~/' + path.relative(home, p) : p;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// --- arg parsing -------------------------------------------------------------
|
|
63
|
+
const args = process.argv.slice(2);
|
|
64
|
+
let mode = null;
|
|
65
|
+
let target = null;
|
|
66
|
+
let format = 'human';
|
|
67
|
+
let purge = false;
|
|
68
|
+
let projectScope = false;
|
|
69
|
+
const metricsFlags = [];
|
|
70
|
+
const isMetricsFlag = (a) =>
|
|
71
|
+
a === '--json' || a === '--runs' || a.startsWith('--days=') || a.startsWith('--since=');
|
|
72
|
+
const VERBS = ['install', 'update', 'sync', 'uninstall', 'metrics', 'specs', 'doctor'];
|
|
73
|
+
|
|
74
|
+
for (const a of args) {
|
|
75
|
+
if (!mode && VERBS.includes(a)) mode = a;
|
|
76
|
+
else if (a === '--porcelain' || a === '--panel') format = a.slice(2);
|
|
77
|
+
else if (isMetricsFlag(a)) { if (a === '--json') format = 'json'; metricsFlags.push(a); }
|
|
78
|
+
else if (a === 'version' || a === '--version' || a === '-v') { console.log(VERSION); process.exit(0); }
|
|
79
|
+
else if (a === 'help' || a === '--help' || a === '-h') usage(0);
|
|
80
|
+
else if (a === '--purge') purge = true;
|
|
81
|
+
else if (a === '--project') projectScope = true;
|
|
82
|
+
// 2.x flags. --global is what 3.x always does; --runtime=claude is the only runtime left.
|
|
83
|
+
else if (a === '--global' || a === '-g') { /* the only mode */ }
|
|
84
|
+
else if (a === '--runtime=claude' || a === '--runtimes=claude') { /* the only runtime */ }
|
|
85
|
+
else if (a.startsWith('--runtime') || a === '--all-runtimes') {
|
|
86
|
+
console.error('error: cohorte 3.x supports Claude Code only. The multi-runtime installer (Codex, Cursor,\n'
|
|
87
|
+
+ ' Gemini, OpenCode) is archived: npx cohorte@2.10.2, or the archive/multi-runtime branch.');
|
|
88
|
+
process.exit(2);
|
|
89
|
+
}
|
|
90
|
+
else if (a.startsWith('-')) { console.error(`error: unknown flag: ${a}`); usage(2); }
|
|
91
|
+
else if (target === null) target = path.resolve(a);
|
|
92
|
+
else { console.error(`error: unexpected argument: ${a}`); usage(2); }
|
|
93
|
+
}
|
|
94
|
+
if (!mode) usage(args.length ? 2 : 0);
|
|
95
|
+
if ((mode === 'install' || mode === 'update') && target) {
|
|
96
|
+
console.error(`error: \`cohorte ${mode}\` installs on this machine and takes no project path.\n`
|
|
97
|
+
+ ` To wire a project, run \`cohorte sync ${path.relative(process.cwd(), target) || '.'}\` (or /cohorte-init-pipeline inside it).\n`
|
|
98
|
+
+ ' 2.x "bundled" installs (a core copied into the repo) no longer exist.');
|
|
99
|
+
process.exit(2);
|
|
100
|
+
}
|
|
101
|
+
const project = target || process.cwd();
|
|
102
|
+
|
|
103
|
+
// --- read-only reports -------------------------------------------------------
|
|
104
|
+
if (mode === 'specs' || mode === 'doctor') {
|
|
105
|
+
const report = require('./report.js');
|
|
106
|
+
const { state, scanSpecs } = require('../lib/doctor.js');
|
|
107
|
+
if (mode === 'specs') {
|
|
108
|
+
const records = report.specRecords(project, scanSpecs);
|
|
109
|
+
if (format === 'json') console.log(JSON.stringify({ project, specs: records }, null, 2));
|
|
110
|
+
else if (format === 'porcelain') { if (records.length) console.log(report.specsPorcelain(records)); }
|
|
111
|
+
else if (format === 'panel') console.log(report.specsPanel(records));
|
|
112
|
+
else console.log(report.specsHuman(records));
|
|
113
|
+
process.exit(0);
|
|
114
|
+
}
|
|
115
|
+
state({ projectRoot: project, globalDir, cliVersion: VERSION }).then((s) => {
|
|
116
|
+
const records = report.checkRecords(s);
|
|
117
|
+
if (format === 'json') console.log(JSON.stringify(s, null, 2));
|
|
118
|
+
else if (format === 'porcelain') { if (records.length) console.log(report.doctorPorcelain(records)); }
|
|
119
|
+
else if (format === 'panel') console.log(report.doctorPanel(records));
|
|
120
|
+
else console.log(report.doctorHuman(s, records));
|
|
121
|
+
process.exit(s.summary.bad > 0 && format !== 'panel' ? 1 : 0);
|
|
122
|
+
}).catch((e) => {
|
|
123
|
+
console.error(`error: ${e && e.message ? e.message : e}`);
|
|
124
|
+
process.exit(1);
|
|
125
|
+
});
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (mode === 'metrics') {
|
|
130
|
+
if (format === 'panel') metricsFlags.push('--panel');
|
|
131
|
+
const script = path.join(pkgRoot, 'scripts', 'metrics', 'collect.mjs');
|
|
132
|
+
const r = spawnSync(process.execPath, [script, project, ...metricsFlags], { stdio: 'inherit' });
|
|
133
|
+
process.exit(r.status == null ? 1 : r.status);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// --- writers -----------------------------------------------------------------
|
|
137
|
+
function ask(question) {
|
|
138
|
+
const rl = require('readline').createInterface({ input: process.stdin, output: process.stdout });
|
|
139
|
+
return new Promise((res) => rl.question(question, (a) => { rl.close(); res((a || '').trim()); }));
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function printList(lines, bullet = '·') { for (const l of lines) console.log(` ${bullet} ${l}`); }
|
|
143
|
+
|
|
144
|
+
// The committed project hook runs `python3 …` on every platform, so that is the name to probe.
|
|
145
|
+
function python3Present() {
|
|
146
|
+
const r = spawnSync('python3', ['-c', 'import sys; sys.exit(0 if sys.version_info >= (3, 9) else 1)'], { stdio: 'ignore' });
|
|
147
|
+
return r.status === 0;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
async function staleVersionNotice() {
|
|
151
|
+
if (process.env.CI) return;
|
|
152
|
+
try {
|
|
153
|
+
const v = require('../lib/versions.js');
|
|
154
|
+
const latest = await v.latestNpm({ timeoutMs: 2500, fallback: false });
|
|
155
|
+
if (!latest || v.cmpSemver(VERSION, latest) >= 0) return;
|
|
156
|
+
const viaNpx = /[\\/]_npx[\\/]/.test(pkgRoot);
|
|
157
|
+
console.log(`\n! You ran cohorte ${VERSION}, but ${latest} is published.\n `
|
|
158
|
+
+ (viaNpx ? 'Re-run as npx cohorte@latest <same command>.' : 'Upgrade with npm i -g cohorte@latest and re-run the same command.'));
|
|
159
|
+
} catch { /* never fatal */ }
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
(async () => {
|
|
163
|
+
try {
|
|
164
|
+
if (mode === 'install' || mode === 'update') {
|
|
165
|
+
const { install } = require('../lib/install.js');
|
|
166
|
+
const interactive = process.stdin.isTTY && process.stdout.isTTY;
|
|
167
|
+
console.log(`→ ${mode === 'update' ? 'updating' : 'installing'} cohorte ${VERSION} in ${displayHome(globalDir)}`);
|
|
168
|
+
const r = await install(globalDir, { ask: interactive ? ask : null });
|
|
169
|
+
printList(r.report);
|
|
170
|
+
if (r.warnings.length) { console.log('\n Heads-up:'); printList(r.warnings, '!'); }
|
|
171
|
+
if (!python3Present()) {
|
|
172
|
+
console.log('\n ! python3 ≥ 3.9 was not found. The gate hook each project runs needs it — without it,'
|
|
173
|
+
+ '\n every Bash call in a cohorte project is refused (the hook is fail-closed).');
|
|
174
|
+
}
|
|
175
|
+
console.log(`
|
|
176
|
+
✓ cohorte ${VERSION} is installed for Claude Code on this machine.
|
|
177
|
+
|
|
178
|
+
Next, in each project:
|
|
179
|
+
1. Open it in Claude Code and run /cohorte-init-pipeline (once) — it writes PIPELINE.md, renders the
|
|
180
|
+
surface agents into .claude/agents and runs cohorte sync to wire the gate.
|
|
181
|
+
2. Commit what it lists, then /cohorte-brainstorm to start a feature.
|
|
182
|
+
Already-wired projects: run /cohorte-update-pipeline inside each to pick up this version.`);
|
|
183
|
+
} else if (mode === 'sync') {
|
|
184
|
+
const { sync } = require('../lib/project.js');
|
|
185
|
+
const r = sync(project);
|
|
186
|
+
console.log(`cohorte sync — ${r.root} (core ${r.version})`);
|
|
187
|
+
if (r.changes.length) printList(r.changes); else console.log(' · already in sync');
|
|
188
|
+
if (!fs.existsSync(path.join(globalDir, 'cohorte', 'pipeline', 'VERSION'))) {
|
|
189
|
+
console.log(' ! cohorte is not installed on this machine — run `cohorte install` for the commands.');
|
|
190
|
+
}
|
|
191
|
+
if (r.changes.length) console.log(' Commit .claude/settings.json, .claude/hooks/cohorte-gate.py, .claude/pipeline.json and .gitignore.');
|
|
192
|
+
} else if (mode === 'uninstall') {
|
|
193
|
+
if (projectScope) {
|
|
194
|
+
const { unsync } = require('../lib/project.js');
|
|
195
|
+
const r = unsync(project);
|
|
196
|
+
if (r.changes.length) printList(r.changes); else console.log(' · nothing of cohorte\'s to remove here');
|
|
197
|
+
if (r.left.length) console.log(` Project files kept (yours to delete): ${r.left.join(', ')}`);
|
|
198
|
+
} else {
|
|
199
|
+
const { uninstall } = require('../lib/install.js');
|
|
200
|
+
const r = uninstall(globalDir, { purge });
|
|
201
|
+
printList(r.report.length ? r.report : ['nothing installed']);
|
|
202
|
+
if (r.warnings.length) { console.log('\n Heads-up:'); printList(r.warnings, '!'); }
|
|
203
|
+
console.log('\n Projects keep their own files (PIPELINE.md, .claude/…): `cohorte uninstall --project <path>` removes the gate wiring.');
|
|
204
|
+
}
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
await staleVersionNotice();
|
|
208
|
+
} catch (e) {
|
|
209
|
+
console.error(`error: ${e && e.message ? e.message : e}`);
|
|
210
|
+
process.exit(1);
|
|
211
|
+
}
|
|
212
|
+
})();
|