cohorte 3.0.0 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +122 -0
- package/README.md +16 -10
- package/bin/cli.js +2 -1
- package/core/agents/cohorte-profile-reader.md +21 -31
- package/core/agents/cohorte-release.md +6 -3
- package/core/agents/cohorte-review.md +31 -5
- package/core/agents/implementer.template.md +13 -5
- package/core/commands/cohorte-align-ds.md +1 -1
- package/core/commands/cohorte-audit.md +11 -4
- package/core/commands/cohorte-brainstorm.md +2 -2
- package/core/commands/cohorte-build.md +19 -12
- package/core/commands/cohorte-doctor.md +11 -9
- package/core/commands/cohorte-fix.md +3 -3
- package/core/commands/cohorte-fleet.md +2 -2
- package/core/commands/cohorte-init-pipeline.md +2 -2
- package/core/commands/cohorte-intake.md +4 -4
- package/core/commands/cohorte-patch.md +2 -2
- package/core/commands/cohorte-refactor.md +73 -8
- package/core/commands/cohorte-retro.md +3 -3
- package/core/commands/cohorte-revert.md +104 -0
- package/core/commands/cohorte-review.md +32 -17
- package/core/commands/cohorte-ship.md +26 -9
- package/core/commands/cohorte-spec.md +13 -4
- package/core/commands/cohorte-update-pipeline.md +12 -8
- package/core/commands/cohorte-verify.md +106 -0
- package/core/hooks/gate.py +326 -21
- package/core/templates/patch.template.md +11 -2
- package/core/templates/spec.template.md +23 -2
- package/core/templates/steps/init-pipeline/01-detect-stack.md +14 -5
- package/core/templates/steps/init-pipeline/02-interview-gaps.md +26 -3
- package/core/templates/steps/init-pipeline/03-draft-profile.md +2 -1
- package/core/templates/steps/init-pipeline/04-write-render.md +16 -12
- package/core/templates/steps/init-pipeline/05-report.md +1 -1
- package/core/workflows/audit.js +9 -4
- package/core/workflows/loop.js +15 -10
- package/core/workflows/refactor.js +116 -9
- package/core/workflows/review.js +24 -10
- package/lib/doctor.js +37 -3
- package/lib/install.js +68 -33
- package/lib/project.js +45 -8
- package/lib/render.js +3 -3
- package/lib/yaml.js +10 -1
- package/package.json +2 -2
- package/profile/PIPELINE.template.md +39 -1
- package/profile/SCHEMA.md +27 -746
- package/profile/cohorte.config.template.yaml +1 -1
- package/profile/schema/dead-agents.md +29 -0
- package/profile/schema/decisions.md +23 -0
- package/profile/schema/deferred.md +22 -0
- package/profile/schema/feature-diff.md +20 -0
- package/profile/schema/kanban.md +95 -0
- package/profile/schema/metrics.md +23 -0
- package/profile/schema/output-discipline.md +21 -0
- package/profile/schema/preflight.md +81 -0
- package/profile/schema/profile-block.md +103 -0
- package/profile/schema/project-kinds.md +89 -0
- package/profile/schema/readiness.md +17 -0
- package/profile/schema/reconcile.md +64 -0
- package/profile/schema/release-notes.md +29 -0
- package/profile/schema/rendering.md +48 -0
- package/profile/schema/retrieval.md +58 -0
- package/profile/schema/spec-status.md +79 -0
- package/profile/schema/specialization.md +41 -0
- package/profile/schema/verify.md +115 -0
- package/profile/schema/workflows.md +78 -0
- package/scripts/kanban-move.sh +45 -3
- package/scripts/new-feature.sh.template +7 -1
- package/scripts/remove-feature.sh.template +14 -5
- package/scripts/verify-run.sh +509 -0
package/lib/install.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// commands/cohorte-*.md the 16 slash commands
|
|
6
6
|
// agents/cohorte-*.md cohorte-review, cohorte-release, cohorte-profile-reader
|
|
7
7
|
// workflows/cohorte-*.js review / audit / refactor / loop
|
|
8
|
-
// cohorte/ the generic core: pipeline/, templates/, hooks/gate.py, lib/project.js
|
|
8
|
+
// cohorte/ the generic core: pipeline/, templates/, hooks/gate.py, lib/{project,yaml}.js
|
|
9
9
|
// cohorte/manifest.json every file above, with the hash it was written with
|
|
10
10
|
// cohorte.config.yaml YOUR config (seeded once, never in the manifest)
|
|
11
11
|
//
|
|
@@ -43,6 +43,12 @@ function walk(dir) {
|
|
|
43
43
|
return out;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
// Remove `dir` itself when empty — never anything inside it. For the user's shared dirs
|
|
47
|
+
// (commands/, agents/): an empty folder of theirs under them is not ours to delete.
|
|
48
|
+
function rmdirIfEmpty(dir) {
|
|
49
|
+
try { if (!fs.readdirSync(dir).length) fs.rmdirSync(dir); } catch { /* absent or not empty */ }
|
|
50
|
+
}
|
|
51
|
+
|
|
46
52
|
function pruneEmpty(dir, stopAt) {
|
|
47
53
|
let entries;
|
|
48
54
|
try { entries = fs.readdirSync(dir, { withFileTypes: true }); } catch { return; }
|
|
@@ -81,6 +87,11 @@ function desiredFiles(globalDir) {
|
|
|
81
87
|
for (const f of ['PIPELINE.template.md', 'SCHEMA.md', 'cohorte.config.template.yaml']) {
|
|
82
88
|
put(path.join('cohorte', 'pipeline', f), fs.readFileSync(path.join(pkgRoot, 'profile', f)));
|
|
83
89
|
}
|
|
90
|
+
// The rulebook, one file per topic: SCHEMA.md is only its index, and each prompt cites the
|
|
91
|
+
// exact `<core>/pipeline/schema/<file>.md` it needs — so no command loads all of it.
|
|
92
|
+
for (const f of fs.readdirSync(path.join(pkgRoot, 'profile', 'schema')).sort()) {
|
|
93
|
+
if (f.endsWith('.md')) put(path.join('cohorte', 'pipeline', 'schema', f), fs.readFileSync(path.join(pkgRoot, 'profile', 'schema', f)));
|
|
94
|
+
}
|
|
84
95
|
// A `<x>.sh` with an `<x>.sh.template` sibling is rendered per project by
|
|
85
96
|
// /cohorte-init-pipeline, so only the template ships; every other `.sh` is executable.
|
|
86
97
|
const scripts = fs.readdirSync(path.join(pkgRoot, 'scripts'));
|
|
@@ -94,6 +105,8 @@ function desiredFiles(globalDir) {
|
|
|
94
105
|
put(path.join('cohorte', 'pipeline', 'CHANGELOG.md'), fs.readFileSync(path.join(pkgRoot, 'CHANGELOG.md')));
|
|
95
106
|
put(path.join('cohorte', 'pipeline', 'VERSION'), VERSION + '\n');
|
|
96
107
|
put(path.join('cohorte', 'lib', 'project.js'), fs.readFileSync(path.join(pkgRoot, 'lib', 'project.js')));
|
|
108
|
+
// project.js requires its sibling yaml.js (lazily) to write .claude/profile.json.
|
|
109
|
+
put(path.join('cohorte', 'lib', 'yaml.js'), fs.readFileSync(path.join(pkgRoot, 'lib', 'yaml.js')));
|
|
97
110
|
return files;
|
|
98
111
|
}
|
|
99
112
|
|
|
@@ -290,42 +303,61 @@ async function install(globalDir, opts = {}) {
|
|
|
290
303
|
const manifest = { version: VERSION, files: {} };
|
|
291
304
|
let written = 0;
|
|
292
305
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
const
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
306
|
+
// Every change below is journaled (path + previous bytes, or null when the file is new), so an
|
|
307
|
+
// error half-way — a full disk, a path that is a directory, a permission — puts the tree back as
|
|
308
|
+
// it was instead of leaving half a release next to the previous manifest.
|
|
309
|
+
const journal = [];
|
|
310
|
+
const remember = (dest, prev) => journal.push({ dest, prev });
|
|
311
|
+
let removed = 0;
|
|
312
|
+
try {
|
|
313
|
+
for (const [rel, { content, mode }] of want) {
|
|
314
|
+
const dest = path.join(globalDir, rel);
|
|
315
|
+
const buf = Buffer.isBuffer(content) ? content : Buffer.from(content);
|
|
316
|
+
const cur = readMaybe(dest);
|
|
317
|
+
const newHash = sha(buf);
|
|
318
|
+
if (cur && sha(cur) !== newHash) {
|
|
319
|
+
const known = old.files[rel];
|
|
320
|
+
// A 2.x install has no manifest, but every file it rendered carries our marker.
|
|
321
|
+
const ours2x = !known && MARKERS.some((m) => cur.toString('utf8').includes(m));
|
|
322
|
+
// Modified since we wrote it, or a file we never wrote that sits on our name.
|
|
323
|
+
if (!ours2x && (!known || known !== sha(cur))) {
|
|
324
|
+
const to = path.join(backupDir, rel);
|
|
325
|
+
fs.mkdirSync(path.dirname(to), { recursive: true });
|
|
326
|
+
fs.copyFileSync(dest, to);
|
|
327
|
+
warnings.push(`${rel} differed from what cohorte installed — your copy is saved in ${R.displayPath(to)}`);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
if (!cur || sha(cur) !== newHash) {
|
|
331
|
+
remember(dest, cur);
|
|
332
|
+
fs.mkdirSync(path.dirname(dest), { recursive: true });
|
|
333
|
+
fs.writeFileSync(dest, buf);
|
|
334
|
+
written++;
|
|
308
335
|
}
|
|
336
|
+
if (mode && process.platform !== 'win32') { try { fs.chmodSync(dest, mode); } catch { /* optional */ } }
|
|
337
|
+
manifest.files[rel] = newHash;
|
|
309
338
|
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
339
|
+
|
|
340
|
+
// Files the previous version installed and this one does not: delete them when they are
|
|
341
|
+
// exactly as we wrote them, keep (and say so) when the user changed them.
|
|
342
|
+
for (const [rel, hash] of Object.entries(old.files)) {
|
|
343
|
+
if (want.has(rel)) continue;
|
|
344
|
+
const dest = path.join(globalDir, rel);
|
|
345
|
+
const cur = readMaybe(dest);
|
|
346
|
+
if (!cur) continue;
|
|
347
|
+
if (sha(cur) === hash) { remember(dest, cur); fs.rmSync(dest); removed++; }
|
|
348
|
+
else warnings.push(`kept ${rel}: no longer shipped, but you modified it`);
|
|
314
349
|
}
|
|
315
|
-
if (mode && process.platform !== 'win32') { try { fs.chmodSync(dest, mode); } catch { /* optional */ } }
|
|
316
|
-
manifest.files[rel] = newHash;
|
|
317
|
-
}
|
|
318
350
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
351
|
+
} catch (e) {
|
|
352
|
+
for (const { dest, prev } of journal.reverse()) {
|
|
353
|
+
try {
|
|
354
|
+
if (prev === null || prev === undefined) fs.rmSync(dest, { force: true });
|
|
355
|
+
else { fs.mkdirSync(path.dirname(dest), { recursive: true }); fs.writeFileSync(dest, prev); }
|
|
356
|
+
} catch { /* best effort — keep restoring the rest */ }
|
|
357
|
+
}
|
|
358
|
+
for (const d of ['cohorte', 'workflows']) pruneEmpty(path.join(globalDir, d));
|
|
359
|
+
for (const d of ['commands', 'agents']) rmdirIfEmpty(path.join(globalDir, d));
|
|
360
|
+
throw new ProjectError(`install failed and was rolled back (${journal.length} change(s) undone): ${e.message}`);
|
|
329
361
|
}
|
|
330
362
|
for (const d of ['cohorte', 'workflows']) pruneEmpty(path.join(globalDir, d), path.join(globalDir, d));
|
|
331
363
|
|
|
@@ -357,7 +389,10 @@ function uninstall(globalDir, { purge = false } = {}) {
|
|
|
357
389
|
}
|
|
358
390
|
fs.rmSync(path.join(globalDir, MANIFEST), { force: true });
|
|
359
391
|
pruneEmpty(path.join(globalDir, 'cohorte'));
|
|
392
|
+
// Empty dirs install created (commands/, agents/, workflows/): harmless to remove, and left
|
|
393
|
+
// behind they make an uninstall look incomplete.
|
|
360
394
|
pruneEmpty(path.join(globalDir, 'workflows'));
|
|
395
|
+
for (const d of ['commands', 'agents']) rmdirIfEmpty(path.join(globalDir, d));
|
|
361
396
|
if (removed) report.push(`removed ${removed} installed file(s)`);
|
|
362
397
|
const leftovers = legacyGlobalCandidates(globalDir);
|
|
363
398
|
if (leftovers.length) warnings.push(`2.x files still present (run \`cohorte update\` first to migrate them, then uninstall): ${leftovers.slice(0, 5).join(', ')}${leftovers.length > 5 ? '…' : ''}`);
|
package/lib/project.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
// cohorte — wire ONE project, deterministically.
|
|
4
4
|
//
|
|
5
|
-
// node <core>/lib/project.js sync [root] # copy the gate, register its hook, pointer, .gitignore
|
|
5
|
+
// node <core>/lib/project.js sync [root] # copy the gate, register its hook, pointer, .gitignore,
|
|
6
|
+
// # and .claude/profile.json (the parsed profile block)
|
|
6
7
|
// node <core>/lib/project.js unsync [root] # undo exactly what sync wrote
|
|
7
8
|
//
|
|
8
9
|
// Everything that describes a project lives in that project and is committed with it:
|
|
@@ -13,20 +14,25 @@
|
|
|
13
14
|
//
|
|
14
15
|
// This file is SELF-CONTAINED on purpose: the installer copies it to
|
|
15
16
|
// `~/.claude/cohorte/lib/project.js`, and `/cohorte-init-pipeline` runs it from there, so it
|
|
16
|
-
// must work without the `cohorte` binary on PATH (npx users)
|
|
17
|
+
// must work without the `cohorte` binary on PATH (npx users). Its one sibling is `yaml.js` (the
|
|
18
|
+
// installer ships it next to this file), the same parser `cohorte doctor` uses — so sync and
|
|
19
|
+
// doctor cannot disagree about the profile. It is required lazily: a core missing it still wires
|
|
20
|
+
// the gate, and only `.claude/profile.json` is skipped, with a note saying why.
|
|
17
21
|
|
|
18
22
|
const fs = require('fs');
|
|
19
23
|
const path = require('path');
|
|
20
24
|
const { spawnSync } = require('child_process');
|
|
21
25
|
|
|
22
26
|
const GATE_FILE = path.join('.claude', 'hooks', 'cohorte-gate.py');
|
|
27
|
+
const PROFILE_FILE = path.join('.claude', 'profile.json');
|
|
23
28
|
const GATE_COMMAND = 'python3 "$CLAUDE_PROJECT_DIR/.claude/hooks/cohorte-gate.py"';
|
|
24
29
|
const GATE_MATCHER = 'Bash|Task|Agent';
|
|
25
|
-
const EDIT_MATCHER = 'Write|Edit|MultiEdit';
|
|
30
|
+
const EDIT_MATCHER = 'Write|Edit|MultiEdit|NotebookEdit';
|
|
26
31
|
const INSTALL_HINT = 'npm i -g cohorte && cohorte install';
|
|
27
32
|
const IGNORE_LINES = ['.claude/preflight.ok', '.claude/pipeline-metrics.jsonl', 'specs/reports/'];
|
|
28
33
|
const IGNORE_HEADER = '# cohorte — local-only pipeline artifacts (never commit these)';
|
|
29
34
|
const MARKERS = ['Generated by the cohorte adapter', 'Generated by the cohorte installer'];
|
|
35
|
+
const COMMIT_LIST = '.claude/settings.json, .claude/hooks/cohorte-gate.py, .claude/pipeline.json, .claude/profile.json and .gitignore';
|
|
30
36
|
|
|
31
37
|
// --- where the shipped assets are -------------------------------------------
|
|
32
38
|
// Installed: <core>/lib/project.js, <core>/hooks/gate.py, <core>/pipeline/VERSION
|
|
@@ -223,6 +229,29 @@ function ensureIgnored(root, changes) {
|
|
|
223
229
|
changes.push(`added ${missing.join(', ')} to .gitignore`);
|
|
224
230
|
}
|
|
225
231
|
|
|
232
|
+
// --- .claude/profile.json ----------------------------------------------------------
|
|
233
|
+
// The `yaml pipeline-profile` block of PIPELINE.md, parsed once here so every agent that needs only
|
|
234
|
+
// the machine block (implementers, the reviewer, the release agent, the workflows' profile-reader)
|
|
235
|
+
// reads a small JSON file instead of the whole profile. Committed, regenerated by every sync.
|
|
236
|
+
// Returns { text } to write, or { note } saying why nothing was written.
|
|
237
|
+
function profileJson(root) {
|
|
238
|
+
let md;
|
|
239
|
+
try { md = fs.readFileSync(path.join(root, 'PIPELINE.md'), 'utf8'); } catch {
|
|
240
|
+
return { note: 'PIPELINE.md not found — .claude/profile.json not written (run /cohorte-init-pipeline)' };
|
|
241
|
+
}
|
|
242
|
+
let yaml;
|
|
243
|
+
try { yaml = require('./yaml.js'); } catch {
|
|
244
|
+
return { note: `yaml.js missing next to ${__filename} — .claude/profile.json not written (reinstall cohorte)` };
|
|
245
|
+
}
|
|
246
|
+
let text = null;
|
|
247
|
+
try { text = yaml.profileJsonText(md); } catch { /* reported below */ }
|
|
248
|
+
if (!text) {
|
|
249
|
+
return { note: 'PIPELINE.md has no parseable `yaml pipeline-profile` block — .claude/profile.json not written'
|
|
250
|
+
+ (fs.existsSync(path.join(root, PROFILE_FILE)) ? ' (the existing one was left as is and may be stale)' : '') };
|
|
251
|
+
}
|
|
252
|
+
return { text };
|
|
253
|
+
}
|
|
254
|
+
|
|
226
255
|
// --- sync / unsync -----------------------------------------------------------------
|
|
227
256
|
function sync(rootArg) {
|
|
228
257
|
const root = path.resolve(rootArg || process.cwd());
|
|
@@ -230,6 +259,7 @@ function sync(rootArg) {
|
|
|
230
259
|
const A = assets();
|
|
231
260
|
if (!fs.existsSync(A.gate)) throw new ProjectError(`gate hook not found at ${A.gate} — reinstall cohorte`);
|
|
232
261
|
const changes = [];
|
|
262
|
+
const notes = [];
|
|
233
263
|
|
|
234
264
|
// Parse everything we will touch BEFORE writing anything: an invalid file aborts the
|
|
235
265
|
// whole sync rather than leaving the project half-wired.
|
|
@@ -268,7 +298,13 @@ function sync(rootArg) {
|
|
|
268
298
|
fs.copyFileSync(A.specTemplate, specTpl);
|
|
269
299
|
changes.push('created specs/_template.md');
|
|
270
300
|
}
|
|
271
|
-
|
|
301
|
+
|
|
302
|
+
// 6. The parsed profile block, for agents that need only the machine block. Written AFTER
|
|
303
|
+
// PIPELINE.md: every command that edits the block re-runs sync so this file follows it.
|
|
304
|
+
const pj = profileJson(root);
|
|
305
|
+
if (pj.text) writeIfChanged(path.join(root, PROFILE_FILE), pj.text, changes, '.claude/profile.json');
|
|
306
|
+
else notes.push(pj.note);
|
|
307
|
+
return { root, version: A.version, changes, notes };
|
|
272
308
|
}
|
|
273
309
|
|
|
274
310
|
function unsync(rootArg) {
|
|
@@ -285,7 +321,7 @@ function unsync(rootArg) {
|
|
|
285
321
|
changes.push(`removed ${removed} gate hook registration(s) from .claude/settings.json`);
|
|
286
322
|
}
|
|
287
323
|
}
|
|
288
|
-
for (const rel of [GATE_FILE, path.join('.claude', 'pipeline.json')]) {
|
|
324
|
+
for (const rel of [GATE_FILE, path.join('.claude', 'pipeline.json'), PROFILE_FILE]) {
|
|
289
325
|
if (fs.existsSync(path.join(root, rel))) { fs.rmSync(path.join(root, rel)); changes.push(`removed ${rel}`); }
|
|
290
326
|
}
|
|
291
327
|
pruneEmpty(path.join(root, '.claude', 'hooks'));
|
|
@@ -294,8 +330,8 @@ function unsync(rootArg) {
|
|
|
294
330
|
return { root, changes, left };
|
|
295
331
|
}
|
|
296
332
|
|
|
297
|
-
module.exports = { sync, unsync, readJsonObject, stripOurHooks, isOurCommand, ProjectError,
|
|
298
|
-
GATE_COMMAND, GATE_MATCHER, EDIT_MATCHER, GATE_FILE, IGNORE_LINES };
|
|
333
|
+
module.exports = { sync, unsync, readJsonObject, stripOurHooks, isOurCommand, ProjectError, profileJson,
|
|
334
|
+
GATE_COMMAND, GATE_MATCHER, EDIT_MATCHER, GATE_FILE, PROFILE_FILE, IGNORE_LINES, COMMIT_LIST };
|
|
299
335
|
|
|
300
336
|
// --- CLI -----------------------------------------------------------------------------
|
|
301
337
|
if (require.main === module) {
|
|
@@ -306,7 +342,8 @@ if (require.main === module) {
|
|
|
306
342
|
console.log(`cohorte sync — ${r.root} (core ${r.version})`);
|
|
307
343
|
for (const c of r.changes) console.log(` · ${c}`);
|
|
308
344
|
if (!r.changes.length) console.log(' · already in sync');
|
|
309
|
-
|
|
345
|
+
for (const n of r.notes) console.log(` ! ${n}`);
|
|
346
|
+
if (r.changes.length) console.log(` Commit ${COMMIT_LIST}.`);
|
|
310
347
|
} else if (verb === 'unsync') {
|
|
311
348
|
const r = unsync(root);
|
|
312
349
|
for (const c of r.changes) console.log(` · ${c}`);
|
package/lib/render.js
CHANGED
|
@@ -62,8 +62,8 @@ function preamble(L, { kind = 'command' } = {}) {
|
|
|
62
62
|
out.push(`> **Cohorte — Claude Code.** Generated by the cohorte installer — do not edit this file;`);
|
|
63
63
|
out.push(`> edit \`core/${kind === 'agent' ? 'agents' : 'commands'}/\` in the cohorte source and re-install.`);
|
|
64
64
|
out.push('>');
|
|
65
|
-
out.push(`> - \`<core>\` = \`${core}\` — the pipeline's shared, machine-wide assets (\`pipeline/scripts/\`, \`pipeline/
|
|
66
|
-
out.push('> - `<state>` = `.claude/` in **this repo** — what the pipeline generates for this project (`gate-config.json`, `preflight.ok`, `pipeline-metrics.jsonl`, `pipeline.json`).');
|
|
65
|
+
out.push(`> - \`<core>\` = \`${core}\` — the pipeline's shared, machine-wide assets (\`pipeline/scripts/\`, \`pipeline/schema/<topic>.md\` — read only the one a step cites, \`templates/\`). Every \`<core>/…\` path below resolves there, and nowhere else.`);
|
|
66
|
+
out.push('> - `<state>` = `.claude/` in **this repo** — what the pipeline generates for this project (`gate-config.json`, `preflight.ok`, `pipeline-metrics.jsonl`, `pipeline.json`, `profile.json` — the parsed `PIPELINE.md` machine block).');
|
|
67
67
|
out.push('> - `<memory>` = `CLAUDE.md` — the project-instructions file at the repo root, loaded into every session here.');
|
|
68
68
|
out.push(`> - \`<config>\` = \`${displayPath(L.config)}\` — your user-level config (kanban boards, shared vault). One per human, never committed.`);
|
|
69
69
|
out.push('> - `<agents>` = `.claude/agents` in **this repo** — the surface agents rendered from `PIPELINE.md`, committed with the code. Never write a surface agent anywhere else.');
|
|
@@ -71,7 +71,7 @@ function preamble(L, { kind = 'command' } = {}) {
|
|
|
71
71
|
out.push(`> - \`<workflows>\` = \`${displayPath(L.workflows)}\` — the shipped workflow scripts (\`cohorte-review.js\`, \`cohorte-audit.js\`, \`cohorte-refactor.js\`, \`cohorte-loop.js\`).`);
|
|
72
72
|
out.push('> - Dispatch: the `Agent` tool (formerly `Task`), `subagent_type: <name>`.');
|
|
73
73
|
out.push('> - **Gate** — `.claude/hooks/cohorte-gate.py` is committed in this repo and registered as a blocking `PreToolUse` hook in `.claude/settings.json`, reading `<state>/gate-config.json`. It fires whether or not you cooperate, and can deny outright or ask the human to confirm.');
|
|
74
|
-
out.push(`> - \`<sync>\` = \`${sync}\` — wires THIS repo deterministically: copies the gate, registers its hook, writes the \`<state>/pipeline.json\` pointer and the \`.gitignore\` entries. Run it from the repo root; never hand-write those files.`);
|
|
74
|
+
out.push(`> - \`<sync>\` = \`${sync}\` — wires THIS repo deterministically: copies the gate, registers its hook, writes the \`<state>/pipeline.json\` pointer, \`<state>/profile.json\` and the \`.gitignore\` entries. Re-run it after any edit to \`PIPELINE.md\`'s machine block. Run it from the repo root; never hand-write those files.`);
|
|
75
75
|
return out.join('\n') + '\n';
|
|
76
76
|
}
|
|
77
77
|
|
package/lib/yaml.js
CHANGED
|
@@ -171,4 +171,13 @@ function parseProfileBlock(md) {
|
|
|
171
171
|
return parse(m[1]);
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
|
|
174
|
+
// The exact bytes `cohorte sync` writes to `.claude/profile.json` for a PIPELINE.md string, or null
|
|
175
|
+
// when there is no block / it parses to nothing. One serializer, shared by sync (the writer) and
|
|
176
|
+
// doctor (the freshness check), so the two can never disagree about what "fresh" means.
|
|
177
|
+
function profileJsonText(md) {
|
|
178
|
+
const profile = typeof md === 'string' ? parseProfileBlock(md) : null;
|
|
179
|
+
if (!profile || typeof profile !== 'object' || Array.isArray(profile) || !Object.keys(profile).length) return null;
|
|
180
|
+
return JSON.stringify(profile, null, 2) + '\n';
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
module.exports = { parse, parseProfileBlock, profileJsonText };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cohorte",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"description": "Multi-agent development pipeline for Claude Code — install it once, run /cohorte-init-pipeline in a repo, and it adapts to that project's stack.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"cohorte": "bin/cli.js"
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"CHANGELOG.md"
|
|
24
24
|
],
|
|
25
25
|
"scripts": {
|
|
26
|
-
"test": "node scripts/validate-core.mjs && node scripts/test-install.mjs && node scripts/test-gate.mjs && node scripts/test-lib.mjs && node scripts/test-workflows.mjs && node scripts/test-kanban.mjs && node scripts/test-metrics.mjs"
|
|
26
|
+
"test": "node scripts/validate-core.mjs && node scripts/test-install.mjs && node scripts/test-gate.mjs && node scripts/test-lib.mjs && node scripts/test-workflows.mjs && node scripts/test-kanban.mjs && node scripts/test-metrics.mjs && node scripts/test-e2e.mjs && node scripts/test-verify.mjs"
|
|
27
27
|
},
|
|
28
28
|
"engines": {
|
|
29
29
|
"node": ">=20"
|
|
@@ -19,6 +19,12 @@ one_liner: <one sentence: what this product is>
|
|
|
19
19
|
ui_language: <English | French | …> # language of ALL user-facing copy
|
|
20
20
|
package_manager: <pnpm | npm | yarn | bun | pip | cargo | go>
|
|
21
21
|
|
|
22
|
+
# ── project kind (what the repo delivers) ───────────────────────────────────
|
|
23
|
+
# Selects the spec DoD defaults, the review's kind-specific checks and whether
|
|
24
|
+
# the design step applies — see <core>/pipeline/schema/project-kinds.md.
|
|
25
|
+
project:
|
|
26
|
+
kind: <web | api | cli | library | mobile | data | other> # absent ⇒ web
|
|
27
|
+
|
|
22
28
|
# ── vcs ─────────────────────────────────────────────────────────────────────
|
|
23
29
|
vcs:
|
|
24
30
|
host: <github | gitlab | none>
|
|
@@ -48,7 +54,7 @@ retrieval:
|
|
|
48
54
|
# This list GROWS automatically: /cohorte-build §1.5 adds a surface (and renders its
|
|
49
55
|
# agent) when a spec touches a tree no surface owns, or splits a bottleneck
|
|
50
56
|
# surface into specialized sub-surfaces. Keep one owner per tree; shared code
|
|
51
|
-
# (routing/state/DS) is its own single-owner surface. See
|
|
57
|
+
# (routing/state/DS) is its own single-owner surface. See `<core>/pipeline/schema/specialization.md`.
|
|
52
58
|
surfaces:
|
|
53
59
|
- key: backend # short id, used as agent name + scope
|
|
54
60
|
path: apps/api # the ONLY tree this surface's agent may touch
|
|
@@ -98,6 +104,14 @@ contract:
|
|
|
98
104
|
index: packages/shared-types/src/index.ts # barrel to export from, or "" if none
|
|
99
105
|
authored_by: lead # NEVER the implementer agents
|
|
100
106
|
|
|
107
|
+
# ── surface ownership (enforced by the gate hook) ──────────────────────────
|
|
108
|
+
# A surface agent may write only under its surfaces[].path (+ an optional per-surface
|
|
109
|
+
# `owns_also: [db/migrations]`, + shared_writable below); contract.path is read-only to it.
|
|
110
|
+
# Write/Edit outside ⇒ denied; Bash writes ⇒ best effort. The lead is never restricted.
|
|
111
|
+
ownership:
|
|
112
|
+
enforce: true # false ⇒ back to convention + review only
|
|
113
|
+
shared_writable: [] # e.g. [pnpm-lock.yaml] — files every surface may touch
|
|
114
|
+
|
|
101
115
|
# ── release notes (optional) ────────────────────────────────────────────────
|
|
102
116
|
# A per-feature release note the project's versioning tool consumes. When
|
|
103
117
|
# enabled, /cohorte-ship authors it BEFORE dispatching the release agent, so it
|
|
@@ -128,9 +142,33 @@ commands:
|
|
|
128
142
|
typecheck: pnpm check-types
|
|
129
143
|
test: pnpm test
|
|
130
144
|
test_quiet: pnpm test --reporter=dot # bridled variant — what the /cohorte-review preflight runs
|
|
145
|
+
security: [] # dependency audit / feature-diff secret scan commands, run after tests (schema/preflight.md)
|
|
131
146
|
# migration commands — omit / leave "" if the project has no DB migrations
|
|
132
147
|
migrate: "cd apps/api && node ace migration:run"
|
|
133
148
|
make_migration: "cd apps/api && node ace make:migration"
|
|
149
|
+
# undo the last migration on the DEV db — /cohorte-verify checks down-then-up, /cohorte-revert
|
|
150
|
+
# runs it. A command in gate.deny is never run (e.g. migration:rollback below): move it to
|
|
151
|
+
# gate.ask to let the pipeline verify rollbacks. "" ⇒ rollback is not verified.
|
|
152
|
+
migrate_down: ""
|
|
153
|
+
# runtime verification (/cohorte-verify, <core>/pipeline/schema/verify.md) — `dev` counts only
|
|
154
|
+
# with a `dev_ready` probe; all "" ⇒ verify is skipped silently
|
|
155
|
+
dev_ready: "" # URL answering 2xx/3xx once `dev` is up, or a shell probe exiting 0 — e.g. "http://localhost:3333/health"
|
|
156
|
+
smoke: "" # quick checks against the running app, e.g. "curl -sf http://localhost:3333/health"
|
|
157
|
+
e2e: "" # e.g. "pnpm exec playwright test --reporter=line"
|
|
158
|
+
|
|
159
|
+
# ── runtime verification (optional — /cohorte-verify) ───────────────────────
|
|
160
|
+
# Runs the app between /cohorte-review and /cohorte-ship, through
|
|
161
|
+
# pipeline/scripts/verify-run.sh. See `<core>/pipeline/schema/verify.md`.
|
|
162
|
+
verify:
|
|
163
|
+
enabled: true # false ⇒ /cohorte-verify is a no-op and /cohorte-ship never asks
|
|
164
|
+
db: local # local = the dev DB is yours to migrate and roll back;
|
|
165
|
+
# shared = others use it ⇒ migrations refused unless
|
|
166
|
+
# isolation.db_per_worktree and run in a feature worktree
|
|
167
|
+
ready_timeout_seconds: 90
|
|
168
|
+
check_timeout_seconds: 600
|
|
169
|
+
screenshots: auto # auto = with a local Playwright CLI (node_modules/.bin/playwright) · off
|
|
170
|
+
surfaces: {} # per-surface hints, keyed by surfaces[].key, e.g.
|
|
171
|
+
# frontend: { base_url: "http://localhost:5173", paths: [/, /settings], smoke: "" }
|
|
134
172
|
|
|
135
173
|
# ── rbac (optional) ─────────────────────────────────────────────────────────
|
|
136
174
|
rbac:
|