cohorte 3.0.0-dev.8 → 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.
Files changed (229) hide show
  1. package/CHANGELOG.md +1532 -0
  2. package/README.md +316 -62
  3. package/bin/cli.js +212 -0
  4. package/bin/report.js +141 -0
  5. package/core/agents/cohorte-profile-reader.md +50 -0
  6. package/core/agents/cohorte-release.md +58 -0
  7. package/core/agents/cohorte-review.md +174 -0
  8. package/core/agents/implementer.template.md +146 -0
  9. package/core/commands/cohorte-align-ds.md +33 -0
  10. package/core/commands/cohorte-audit.md +67 -0
  11. package/core/commands/cohorte-brainstorm.md +73 -0
  12. package/core/commands/cohorte-build.md +241 -0
  13. package/core/commands/cohorte-doctor.md +133 -0
  14. package/core/commands/cohorte-fix.md +80 -0
  15. package/core/commands/cohorte-fleet.md +111 -0
  16. package/core/commands/cohorte-init-pipeline.md +30 -0
  17. package/core/commands/cohorte-intake.md +92 -0
  18. package/core/commands/cohorte-patch.md +118 -0
  19. package/core/commands/cohorte-refactor.md +57 -0
  20. package/core/commands/cohorte-retro.md +85 -0
  21. package/core/commands/cohorte-review.md +224 -0
  22. package/core/commands/cohorte-ship.md +155 -0
  23. package/core/commands/cohorte-spec.md +105 -0
  24. package/core/commands/cohorte-update-pipeline.md +115 -0
  25. package/core/hooks/gate.py +2931 -0
  26. package/core/templates/agent-handoff.md +34 -0
  27. package/core/templates/brainstorm-return.md +42 -0
  28. package/core/templates/decisions.template.md +42 -0
  29. package/core/templates/design-brief.md +37 -0
  30. package/core/templates/patch.template.md +86 -0
  31. package/core/templates/pr-body.md +25 -0
  32. package/core/templates/review-feedback.md +46 -0
  33. package/core/templates/spec.template.md +88 -0
  34. package/core/templates/steps/init-pipeline/01-detect-stack.md +44 -0
  35. package/core/templates/steps/init-pipeline/02-interview-gaps.md +55 -0
  36. package/core/templates/steps/init-pipeline/03-draft-profile.md +9 -0
  37. package/core/templates/steps/init-pipeline/04-write-render.md +91 -0
  38. package/core/templates/steps/init-pipeline/05-report.md +11 -0
  39. package/core/templates/steps/review-pr/01-pr-mode.md +54 -0
  40. package/core/workflows/audit.js +306 -0
  41. package/core/workflows/loop.js +687 -0
  42. package/core/workflows/refactor.js +291 -0
  43. package/core/workflows/review.js +491 -0
  44. package/install.ps1 +72 -0
  45. package/install.sh +69 -0
  46. package/lib/doctor.js +472 -0
  47. package/lib/install.js +377 -0
  48. package/lib/project.js +322 -0
  49. package/lib/render.js +121 -0
  50. package/lib/versions.js +145 -0
  51. package/lib/yaml.js +174 -0
  52. package/package.json +36 -17
  53. package/profile/PIPELINE.template.md +250 -0
  54. package/profile/SCHEMA.md +749 -0
  55. package/profile/cohorte.config.template.yaml +43 -0
  56. package/scripts/feature-diff.sh +118 -0
  57. package/scripts/kanban-move.sh +307 -0
  58. package/scripts/metrics/collect.mjs +542 -0
  59. package/scripts/metrics/prices.json +42 -0
  60. package/scripts/new-feature.sh.template +122 -0
  61. package/scripts/preflight.sh +114 -0
  62. package/scripts/remove-feature.sh.template +56 -0
  63. package/assets/manifest.json +0 -203
  64. package/assets/migrations/config/README.md +0 -12
  65. package/assets/migrations/state/0001_init.sql +0 -154
  66. package/assets/prompts/README.md +0 -11
  67. package/assets/prompts/agents/brainstormer.md +0 -3
  68. package/assets/prompts/agents/fixer.md +0 -7
  69. package/assets/prompts/agents/implementer.md +0 -12
  70. package/assets/prompts/agents/reviewer.md +0 -8
  71. package/assets/prompts/agents/security-reviewer.md +0 -7
  72. package/assets/prompts/agents/spec-author.md +0 -3
  73. package/assets/prompts/phases/build.md +0 -5
  74. package/assets/prompts/phases/review.md +0 -5
  75. package/assets/prompts/phases/test.md +0 -5
  76. package/assets/prompts/system.md +0 -11
  77. package/assets/schemas/agent-output.schema.json +0 -225
  78. package/assets/schemas/auth-status.schema.json +0 -87
  79. package/assets/schemas/command-result.schema.json +0 -192
  80. package/assets/schemas/commands.schema.json +0 -959
  81. package/assets/schemas/config.schema.json +0 -2281
  82. package/assets/schemas/doctor-report.schema.json +0 -104
  83. package/assets/schemas/events.schema.json +0 -8514
  84. package/assets/schemas/fake-script.schema.json +0 -549
  85. package/assets/schemas/inspect.schema.json +0 -3133
  86. package/assets/schemas/manifest.schema.json +0 -79
  87. package/assets/schemas/ownership.schema.json +0 -52
  88. package/assets/schemas/policy-verdict.schema.json +0 -282
  89. package/assets/schemas/project-model.schema.json +0 -783
  90. package/assets/schemas/project-status.schema.json +0 -217
  91. package/assets/schemas/reconcile-plan.schema.json +0 -154
  92. package/assets/schemas/run-diff.schema.json +0 -177
  93. package/assets/schemas/run-snapshot-manifest.schema.json +0 -2104
  94. package/assets/schemas/run-state.schema.json +0 -1755
  95. package/assets/schemas/runtime-capabilities.schema.json +0 -1545
  96. package/assets/schemas/sandbox-capabilities.schema.json +0 -116
  97. package/assets/schemas/skill.schema.json +0 -87
  98. package/assets/schemas/spec.schema.json +0 -202
  99. package/assets/schemas/tool-catalogue.schema.json +0 -655
  100. package/assets/schemas/trust-record.schema.json +0 -38
  101. package/assets/skills/README.md +0 -9
  102. package/assets/skills/inspect-surface.md +0 -4
  103. package/dist/agent-host.mjs +0 -2187
  104. package/dist/agent-host.mjs.map +0 -1
  105. package/dist/bundle-manifest.json +0 -128
  106. package/dist/chunks/__host-DgGPyco9.mjs +0 -18
  107. package/dist/chunks/__host-DgGPyco9.mjs.map +0 -1
  108. package/dist/chunks/align-ds-r_X_1aQ_.mjs +0 -93
  109. package/dist/chunks/align-ds-r_X_1aQ_.mjs.map +0 -1
  110. package/dist/chunks/approve-Cv135UqI.mjs +0 -19
  111. package/dist/chunks/approve-Cv135UqI.mjs.map +0 -1
  112. package/dist/chunks/audit-B4ZWQ_DI.mjs +0 -179
  113. package/dist/chunks/audit-B4ZWQ_DI.mjs.map +0 -1
  114. package/dist/chunks/auth-BT5oVp76.mjs +0 -132
  115. package/dist/chunks/auth-BT5oVp76.mjs.map +0 -1
  116. package/dist/chunks/auth-Dnlksuo5.mjs +0 -141
  117. package/dist/chunks/auth-Dnlksuo5.mjs.map +0 -1
  118. package/dist/chunks/brainstorm-SJwOIEif.mjs +0 -123
  119. package/dist/chunks/brainstorm-SJwOIEif.mjs.map +0 -1
  120. package/dist/chunks/build-C_-mbZfD.mjs +0 -19
  121. package/dist/chunks/build-C_-mbZfD.mjs.map +0 -1
  122. package/dist/chunks/cancel-KV_cpsqS.mjs +0 -15
  123. package/dist/chunks/cancel-KV_cpsqS.mjs.map +0 -1
  124. package/dist/chunks/canonical-C8UxeEmB.mjs +0 -57
  125. package/dist/chunks/canonical-C8UxeEmB.mjs.map +0 -1
  126. package/dist/chunks/catalogue-IaCJdfB8.mjs +0 -1549
  127. package/dist/chunks/catalogue-IaCJdfB8.mjs.map +0 -1
  128. package/dist/chunks/compose-DRKjQcn0.mjs +0 -7333
  129. package/dist/chunks/compose-DRKjQcn0.mjs.map +0 -1
  130. package/dist/chunks/config-Cqu5XQoP.mjs +0 -96
  131. package/dist/chunks/config-Cqu5XQoP.mjs.map +0 -1
  132. package/dist/chunks/contract-DjssDPpS.mjs +0 -335
  133. package/dist/chunks/contract-DjssDPpS.mjs.map +0 -1
  134. package/dist/chunks/contract-bQ9FJl4N.mjs +0 -123
  135. package/dist/chunks/contract-bQ9FJl4N.mjs.map +0 -1
  136. package/dist/chunks/deny-ClTxSvHJ.mjs +0 -15
  137. package/dist/chunks/deny-ClTxSvHJ.mjs.map +0 -1
  138. package/dist/chunks/diff-Qw0II0sj.mjs +0 -101
  139. package/dist/chunks/diff-Qw0II0sj.mjs.map +0 -1
  140. package/dist/chunks/discover-BZPolSZG.mjs +0 -21
  141. package/dist/chunks/discover-BZPolSZG.mjs.map +0 -1
  142. package/dist/chunks/doctor-DcDFPvQM.mjs +0 -222
  143. package/dist/chunks/doctor-DcDFPvQM.mjs.map +0 -1
  144. package/dist/chunks/fix-C9roGiQz.mjs +0 -82
  145. package/dist/chunks/fix-C9roGiQz.mjs.map +0 -1
  146. package/dist/chunks/fleet-yWHQY2ya.mjs +0 -297
  147. package/dist/chunks/fleet-yWHQY2ya.mjs.map +0 -1
  148. package/dist/chunks/gc-BBXlBF5w.mjs +0 -161
  149. package/dist/chunks/gc-BBXlBF5w.mjs.map +0 -1
  150. package/dist/chunks/init--FxxkrcT.mjs +0 -63
  151. package/dist/chunks/init--FxxkrcT.mjs.map +0 -1
  152. package/dist/chunks/inspect-Buby4cQD.mjs +0 -22
  153. package/dist/chunks/inspect-Buby4cQD.mjs.map +0 -1
  154. package/dist/chunks/intake-C1pesxCJ.mjs +0 -12
  155. package/dist/chunks/intake-C1pesxCJ.mjs.map +0 -1
  156. package/dist/chunks/logs-Giq5sUau.mjs +0 -25
  157. package/dist/chunks/logs-Giq5sUau.mjs.map +0 -1
  158. package/dist/chunks/loop-BWsUpyus.mjs +0 -212
  159. package/dist/chunks/loop-BWsUpyus.mjs.map +0 -1
  160. package/dist/chunks/migrate-DuYCAbE3.mjs +0 -33
  161. package/dist/chunks/migrate-DuYCAbE3.mjs.map +0 -1
  162. package/dist/chunks/models-Btp6X2YZ.mjs +0 -24
  163. package/dist/chunks/models-Btp6X2YZ.mjs.map +0 -1
  164. package/dist/chunks/obsidian-BHLkXx_H.mjs +0 -235
  165. package/dist/chunks/obsidian-BHLkXx_H.mjs.map +0 -1
  166. package/dist/chunks/patch-sAgVqjpx.mjs +0 -50
  167. package/dist/chunks/patch-sAgVqjpx.mjs.map +0 -1
  168. package/dist/chunks/pause-BASBfKLO.mjs +0 -16
  169. package/dist/chunks/pause-BASBfKLO.mjs.map +0 -1
  170. package/dist/chunks/policy-Du7WVBFX.mjs +0 -139
  171. package/dist/chunks/policy-Du7WVBFX.mjs.map +0 -1
  172. package/dist/chunks/providers-Dx78imKj.mjs +0 -19
  173. package/dist/chunks/providers-Dx78imKj.mjs.map +0 -1
  174. package/dist/chunks/reconcile-BHn66X3C.mjs +0 -50
  175. package/dist/chunks/reconcile-BHn66X3C.mjs.map +0 -1
  176. package/dist/chunks/refactor-DV3RfGjk.mjs +0 -153
  177. package/dist/chunks/refactor-DV3RfGjk.mjs.map +0 -1
  178. package/dist/chunks/render-DyZr5Lgi.mjs +0 -53
  179. package/dist/chunks/render-DyZr5Lgi.mjs.map +0 -1
  180. package/dist/chunks/resume-GJQRb2Eb.mjs +0 -15
  181. package/dist/chunks/resume-GJQRb2Eb.mjs.map +0 -1
  182. package/dist/chunks/retro-Dr-2RTNN.mjs +0 -78
  183. package/dist/chunks/retro-Dr-2RTNN.mjs.map +0 -1
  184. package/dist/chunks/retry-CLrUem1H.mjs +0 -15
  185. package/dist/chunks/retry-CLrUem1H.mjs.map +0 -1
  186. package/dist/chunks/review-ZsBqp3vZ.mjs +0 -35
  187. package/dist/chunks/review-ZsBqp3vZ.mjs.map +0 -1
  188. package/dist/chunks/run-BGabwbDL.mjs +0 -109
  189. package/dist/chunks/run-BGabwbDL.mjs.map +0 -1
  190. package/dist/chunks/run-tool-C3rAv4XF.mjs +0 -26
  191. package/dist/chunks/run-tool-C3rAv4XF.mjs.map +0 -1
  192. package/dist/chunks/scan-C5uDr7Yq.mjs +0 -167
  193. package/dist/chunks/scan-C5uDr7Yq.mjs.map +0 -1
  194. package/dist/chunks/schema-Bq9qtgsd.mjs +0 -583
  195. package/dist/chunks/schema-Bq9qtgsd.mjs.map +0 -1
  196. package/dist/chunks/send-BdnJ85Nz.mjs +0 -19
  197. package/dist/chunks/send-BdnJ85Nz.mjs.map +0 -1
  198. package/dist/chunks/ship-BizfUe62.mjs +0 -140
  199. package/dist/chunks/ship-BizfUe62.mjs.map +0 -1
  200. package/dist/chunks/shutdown-BM92Iyv2.mjs +0 -15
  201. package/dist/chunks/shutdown-BM92Iyv2.mjs.map +0 -1
  202. package/dist/chunks/skip-DZG5kpcH.mjs +0 -18
  203. package/dist/chunks/skip-DZG5kpcH.mjs.map +0 -1
  204. package/dist/chunks/spec-C2h3U64g.mjs +0 -65
  205. package/dist/chunks/spec-C2h3U64g.mjs.map +0 -1
  206. package/dist/chunks/spec-path-tptqR7W8.mjs +0 -10
  207. package/dist/chunks/spec-path-tptqR7W8.mjs.map +0 -1
  208. package/dist/chunks/src-Bfr1yzsn.mjs +0 -1689
  209. package/dist/chunks/src-Bfr1yzsn.mjs.map +0 -1
  210. package/dist/chunks/src-CPW2_Ons.mjs +0 -5487
  211. package/dist/chunks/src-CPW2_Ons.mjs.map +0 -1
  212. package/dist/chunks/src-Cu3TxNob.mjs +0 -783
  213. package/dist/chunks/src-Cu3TxNob.mjs.map +0 -1
  214. package/dist/chunks/src-DNsLSxgm.mjs +0 -928
  215. package/dist/chunks/src-DNsLSxgm.mjs.map +0 -1
  216. package/dist/chunks/src-DbS9gkJy.mjs +0 -117
  217. package/dist/chunks/src-DbS9gkJy.mjs.map +0 -1
  218. package/dist/chunks/src-yi5whv3n.mjs +0 -2118
  219. package/dist/chunks/src-yi5whv3n.mjs.map +0 -1
  220. package/dist/chunks/status-SMjiOMYy.mjs +0 -29
  221. package/dist/chunks/status-SMjiOMYy.mjs.map +0 -1
  222. package/dist/chunks/tail-BuhT-2PH.mjs +0 -25
  223. package/dist/chunks/tail-BuhT-2PH.mjs.map +0 -1
  224. package/dist/chunks/update-BXIppsbi.mjs +0 -16
  225. package/dist/chunks/update-BXIppsbi.mjs.map +0 -1
  226. package/dist/chunks/update-pipeline-Du-Gu1Pl.mjs +0 -56
  227. package/dist/chunks/update-pipeline-Du-Gu1Pl.mjs.map +0 -1
  228. package/dist/cli.mjs +0 -186
  229. package/dist/cli.mjs.map +0 -1
package/lib/yaml.js ADDED
@@ -0,0 +1,174 @@
1
+ 'use strict';
2
+ // Minimal block-YAML parser — just enough for the `yaml pipeline-profile` block in PIPELINE.md.
3
+ // Deliberately dependency-free (keeps the published package zero-dep). Handles:
4
+ // key: value · nested maps (indent) · block sequences (- item / - key: val) ·
5
+ // flow arrays [a, b] · flow maps { a: 1 } · quoted scalars (with \" \\ \n escapes) ·
6
+ // #-comments · bool/int/float coercion · indentless sequences (`key:` then `- a` at the same
7
+ // indent) · `|` / `>` block scalars.
8
+ // A `key: value` pair needs a colon followed by a space (or the end of the line), as in YAML:
9
+ // `- db:wipe` and `- http://x` are scalars, not one-key maps.
10
+ // NOT a general YAML implementation — anchors, tags, multi-document etc. are out of scope.
11
+
12
+ function stripComment(line) {
13
+ let q = null;
14
+ for (let i = 0; i < line.length; i++) {
15
+ const c = line[i];
16
+ if (q) { if (c === q) q = null; continue; }
17
+ if (c === '"' || c === "'") { q = c; continue; }
18
+ // A '#' starts a comment only at line start or after whitespace (YAML rule).
19
+ if (c === '#' && (i === 0 || /\s/.test(line[i - 1]))) return line.slice(0, i);
20
+ }
21
+ return line;
22
+ }
23
+
24
+ function splitTopLevel(s) {
25
+ const out = [];
26
+ let depth = 0, q = null, cur = '';
27
+ for (let i = 0; i < s.length; i++) {
28
+ const c = s[i];
29
+ if (q) { cur += c; if (c === q) q = null; continue; }
30
+ if (c === '"' || c === "'") { q = c; cur += c; continue; }
31
+ if (c === '[' || c === '{') { depth++; cur += c; continue; }
32
+ if (c === ']' || c === '}') { depth--; cur += c; continue; }
33
+ if (c === ',' && depth === 0) { out.push(cur); cur = ''; continue; }
34
+ cur += c;
35
+ }
36
+ if (cur.trim() !== '') out.push(cur);
37
+ return out;
38
+ }
39
+
40
+ function scalar(raw) {
41
+ const v = raw.trim();
42
+ if (v === '') return null;
43
+ if (v[0] === '[') {
44
+ const inner = v.slice(1, v.lastIndexOf(']'));
45
+ return inner.trim() === '' ? [] : splitTopLevel(inner).map(scalar);
46
+ }
47
+ if (v[0] === '{') {
48
+ const inner = v.slice(1, v.lastIndexOf('}'));
49
+ const obj = {};
50
+ if (inner.trim() !== '') {
51
+ for (const pair of splitTopLevel(inner)) {
52
+ const idx = pair.indexOf(':');
53
+ if (idx === -1) continue;
54
+ obj[pair.slice(0, idx).trim()] = scalar(pair.slice(idx + 1));
55
+ }
56
+ }
57
+ return obj;
58
+ }
59
+ if (v.length >= 2 && v[0] === '"' && v[v.length - 1] === '"') {
60
+ return v.slice(1, -1).replace(/\\(["\\nt])/g, (_, c) => (c === 'n' ? '\n' : c === 't' ? '\t' : c));
61
+ }
62
+ if (v.length >= 2 && v[0] === "'" && v[v.length - 1] === "'") return v.slice(1, -1).replace(/''/g, "'");
63
+ if (v === 'true') return true;
64
+ if (v === 'false') return false;
65
+ if (v === 'null' || v === '~') return null;
66
+ if (/^-?\d+$/.test(v)) return parseInt(v, 10);
67
+ if (/^-?\d+\.\d+$/.test(v)) return parseFloat(v);
68
+ return v;
69
+ }
70
+
71
+ // Split "key: rest" on the first colon that is followed by a space or ends the line,
72
+ // outside quotes. A colon inside a value (a URL, `db:wipe`, a chained shell command) does
73
+ // not split. Callers never feed this a flow scalar (`[a, b]` / `{a: 1}`).
74
+ function keyValue(text) {
75
+ let q = null;
76
+ for (let i = 0; i < text.length; i++) {
77
+ const c = text[i];
78
+ if (q) { if (c === q) q = null; continue; }
79
+ if (c === '"' || c === "'") { if (i === 0) q = c; continue; }
80
+ if (c === ':' && (i + 1 === text.length || text[i + 1] === ' ')) {
81
+ const key = text.slice(0, i).trim().replace(/^(["'])(.*)\1$/, '$2');
82
+ return key ? { key, rest: text.slice(i + 1).trim() } : null;
83
+ }
84
+ }
85
+ return null;
86
+ }
87
+
88
+ const DASH = /^-(?:(\s+)(.*))?$/;
89
+
90
+ function parse(text) {
91
+ const lines = [];
92
+ for (const raw of text.split(/\r?\n/)) {
93
+ const stripped = stripComment(raw).replace(/\s+$/, '');
94
+ if (stripped.trim() === '') { lines.push({ blank: true, indent: Infinity, text: '', raw }); continue; }
95
+ lines.push({ indent: stripped.match(/^ */)[0].length, text: stripped.trim(), raw });
96
+ }
97
+ let pos = 0;
98
+ const skipBlank = () => { while (pos < lines.length && lines[pos].blank) pos++; };
99
+
100
+ // `|` keeps newlines, `>` folds them into spaces. Lines are taken RAW (comments are text).
101
+ function blockScalar(indent, style) {
102
+ const out = [];
103
+ let base = null;
104
+ while (pos < lines.length && (lines[pos].blank || lines[pos].indent > indent)) {
105
+ const raw = lines[pos].raw.replace(/\s+$/, '');
106
+ if (lines[pos].blank) out.push('');
107
+ else {
108
+ if (base === null) base = raw.match(/^ */)[0].length;
109
+ out.push(raw.slice(Math.min(base, raw.match(/^ */)[0].length)));
110
+ }
111
+ pos++;
112
+ }
113
+ while (out.length && out[out.length - 1] === '') out.pop();
114
+ return style.startsWith('|') ? out.join('\n') : out.join(' ').replace(/ {2,}/g, ' ').trim();
115
+ }
116
+
117
+ function block(indent) {
118
+ skipBlank();
119
+ const isSeq = DASH.test(lines[pos].text);
120
+ const result = isSeq ? [] : {};
121
+ while (pos < lines.length) {
122
+ skipBlank();
123
+ if (pos >= lines.length || lines[pos].indent < indent) break;
124
+ if (lines[pos].indent > indent) { pos++; continue; } // defensive: skip stray deeper line
125
+ const line = lines[pos];
126
+ const dash = line.text.match(DASH);
127
+ // A sequence ends at the first same-indent line that is not an item (an indentless
128
+ // sequence is followed by the next key of its parent map), and vice versa.
129
+ if (isSeq !== !!dash) break;
130
+
131
+ if (dash) {
132
+ const remainder = (dash[2] || '').trim();
133
+ const itemIndent = indent + 1 + (dash[1] ? dash[1].length : 1);
134
+ const kv = remainder && remainder[0] !== '[' && remainder[0] !== '{' ? keyValue(remainder) : null;
135
+ if (!remainder) {
136
+ pos++;
137
+ skipBlank();
138
+ result.push(pos < lines.length && lines[pos].indent > indent ? block(lines[pos].indent) : null);
139
+ } else if (kv && /^[\w.-]+$/.test(kv.key)) {
140
+ // A dash item that is `key: …` opens a nested map; realign so its keys share one indent.
141
+ lines[pos] = { ...line, indent: itemIndent, text: remainder };
142
+ result.push(block(itemIndent));
143
+ } else {
144
+ result.push(scalar(remainder));
145
+ pos++;
146
+ }
147
+ continue;
148
+ }
149
+
150
+ const kv = keyValue(line.text);
151
+ if (!kv) { pos++; continue; }
152
+ pos++;
153
+ if (/^[|>][-+]?$/.test(kv.rest)) { result[kv.key] = blockScalar(indent, kv.rest); continue; }
154
+ if (kv.rest !== '') { result[kv.key] = scalar(kv.rest); continue; }
155
+ skipBlank();
156
+ if (pos < lines.length && lines[pos].indent > indent) result[kv.key] = block(lines[pos].indent);
157
+ else if (pos < lines.length && lines[pos].indent === indent && DASH.test(lines[pos].text)) result[kv.key] = block(indent);
158
+ else result[kv.key] = null;
159
+ }
160
+ return result;
161
+ }
162
+
163
+ skipBlank();
164
+ return pos < lines.length ? block(lines[pos].indent) : {};
165
+ }
166
+
167
+ // Extract + parse the ```yaml pipeline-profile fenced block from a PIPELINE.md string.
168
+ function parseProfileBlock(md) {
169
+ const m = md.match(/```yaml pipeline-profile\r?\n([\s\S]*?)\r?\n```/);
170
+ if (!m) return null;
171
+ return parse(m[1]);
172
+ }
173
+
174
+ module.exports = { parse, parseProfileBlock };
package/package.json CHANGED
@@ -1,29 +1,48 @@
1
1
  {
2
2
  "name": "cohorte",
3
- "version": "3.0.0-dev.8",
4
- "license": "AGPL-3.0-only",
5
- "type": "module",
3
+ "version": "3.0.0",
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.",
6
5
  "bin": {
7
- "cohorte": "dist/cli.mjs"
6
+ "cohorte": "bin/cli.js"
8
7
  },
9
8
  "files": [
10
- "dist",
11
- "assets"
9
+ "bin",
10
+ "lib",
11
+ "core",
12
+ "profile",
13
+ "scripts",
14
+ "!scripts/new-feature.sh",
15
+ "!scripts/remove-feature.sh",
16
+ "!scripts/demo",
17
+ "!scripts/test-*.mjs",
18
+ "!scripts/validate-core.mjs",
19
+ "!core/hooks/__pycache__",
20
+ "!**/*.pyc",
21
+ "install.sh",
22
+ "install.ps1",
23
+ "CHANGELOG.md"
12
24
  ],
13
- "engines": {
14
- "node": "^24.16.0 || >=26.1.0"
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"
15
27
  },
16
- "dependencies": {
17
- "commander": "15.0.0",
18
- "yaml": "2.9.1",
19
- "picomatch": "4.0.7",
20
- "typebox": "1.3.7",
21
- "@earendil-works/pi-coding-agent": "0.85.1",
22
- "@earendil-works/pi-ai": "0.85.1",
23
- "@earendil-works/pi-agent-core": "0.85.1"
28
+ "engines": {
29
+ "node": ">=20"
24
30
  },
25
31
  "repository": {
26
32
  "type": "git",
27
33
  "url": "git+https://github.com/TheBidouilleAgency/cohorte.git"
28
- }
34
+ },
35
+ "homepage": "https://github.com/TheBidouilleAgency/cohorte#readme",
36
+ "author": "Enzo Viry",
37
+ "license": "AGPL-3.0-only",
38
+ "keywords": [
39
+ "claude",
40
+ "claude-code",
41
+ "agents",
42
+ "subagents",
43
+ "pipeline",
44
+ "multi-agent",
45
+ "tdd",
46
+ "code-review"
47
+ ]
29
48
  }
@@ -0,0 +1,250 @@
1
+ # PIPELINE.md — <PROJECT_NAME> profile
2
+
3
+ > **Generated by `/cohorte-init-pipeline`.** This is the project profile: the single place the
4
+ > portable multi-agent pipeline reads for everything stack-specific. The pipeline core
5
+ > in the pipeline core is generic and references THIS file by section — keep project facts
6
+ > here, never hardcoded into agent prompts. Kept current by `/cohorte-update-pipeline` (reconcile:
7
+ > new fields are topped up, your values never overwritten). Rendered agent files are
8
+ > regenerated from this profile on every reconcile — customize agents through §Conventions
9
+ > here, never by editing the agent files. Free-form notes belong in `CLAUDE.md`.
10
+ >
11
+ > **Machine block first, prose after.** The fenced `yaml pipeline-profile` block below is
12
+ > the deterministic contract (flags, surfaces, commands) — commands parse it and branch on
13
+ > it. The prose sections carry conventions agents read.
14
+
15
+ ```yaml pipeline-profile
16
+ # ── identity ────────────────────────────────────────────────────────────────
17
+ name: <PROJECT_NAME>
18
+ one_liner: <one sentence: what this product is>
19
+ ui_language: <English | French | …> # language of ALL user-facing copy
20
+ package_manager: <pnpm | npm | yarn | bun | pip | cargo | go>
21
+
22
+ # ── vcs ─────────────────────────────────────────────────────────────────────
23
+ vcs:
24
+ host: <github | gitlab | none>
25
+ remote: <owner/repo> # e.g. acme/webapp
26
+ default_branch: <main>
27
+ feature_branch_prefix: feature/ # branch = <prefix><feature_id>
28
+ patch_branch_prefix: fix/ # same, for /cohorte-patch specs (kind: patch)
29
+
30
+ # ── repo shape ──────────────────────────────────────────────────────────────
31
+ repo:
32
+ layout: <monorepo | single>
33
+ workspace_tool: <turborepo | nx | none>
34
+
35
+ # ── code retrieval (semantic navigation — cuts agent read time) ─────────────
36
+ # Agents prefer symbol/graph MCP queries over grep-and-read when a provider is
37
+ # wired. serena = live LSP symbol navigation (default, no index to maintain);
38
+ # graphify = persistent tree-sitter knowledge graph over code + docs (needs an
39
+ # index step + rescans); none = agents fall back to Grep/Glob/Read.
40
+ # Registered by /cohorte-init-pipeline in the project's .mcp.json.
41
+ retrieval:
42
+ provider: serena # serena | graphify | none
43
+
44
+ # ── surfaces ────────────────────────────────────────────────────────────────
45
+ # One entry per independently-implemented code area. /cohorte-build dispatches ONE
46
+ # implementer agent per surface, in parallel. Each surface is rendered by
47
+ # /cohorte-init-pipeline into its own agent file (agent field) with the tools listed.
48
+ # This list GROWS automatically: /cohorte-build §1.5 adds a surface (and renders its
49
+ # agent) when a spec touches a tree no surface owns, or splits a bottleneck
50
+ # surface into specialized sub-surfaces. Keep one owner per tree; shared code
51
+ # (routing/state/DS) is its own single-owner surface. See SCHEMA.md §Specialization.
52
+ surfaces:
53
+ - key: backend # short id, used as agent name + scope
54
+ path: apps/api # the ONLY tree this surface's agent may touch
55
+ label: backend (AdonisJS)
56
+ agent: backend # rendered to .claude/agents/backend.md (committed)
57
+ tools: [Read, Write, Edit, Bash, Grep, Glob, mcp__serena] # mcp__<provider> mirrors retrieval.provider
58
+ model: sonnet # frontmatter model tier: sonnet | haiku | inherit
59
+ # sonnet = default (applies the frozen contract — cheap
60
+ # vs the Opus lead); haiku = purely mechanical scaffolding;
61
+ # inherit = only for surfaces with real design decisions
62
+ test_cmd: pnpm --filter api test
63
+ # Bridled variants — what agents actually RUN (dot reporter / failures-only /
64
+ # --quiet), so a green run costs lines, not pages. "" ⇒ callers fall back to
65
+ # `<cmd> 2>&1 | tail -40`. /cohorte-init-pipeline asks for these; never store a bare
66
+ # `pnpm test` as the thing agents execute.
67
+ test_quiet_cmd: pnpm --filter api test --reporter=dot
68
+ lint_cmd: pnpm --filter api lint
69
+ lint_quiet_cmd: pnpm --filter api lint --quiet
70
+ format_cmd: pnpm --filter api format
71
+ typecheck_cmd: pnpm --filter api exec tsc --noEmit
72
+ build_cmd: ""
73
+ uses_design: false
74
+ - key: frontend
75
+ path: apps/web
76
+ label: frontend (React/TanStack)
77
+ agent: frontend
78
+ tools: [Read, Write, Edit, Bash, Grep, Glob, DesignSync, mcp__serena]
79
+ model: sonnet # default even for design surfaces — designs + contract are
80
+ # frozen inputs the agent applies; `inherit` (bills at the
81
+ # lead's tier, often Opus) ONLY if this surface must make
82
+ # novel design decisions
83
+ test_cmd: pnpm --filter web test
84
+ test_quiet_cmd: pnpm --filter web test --reporter=dot
85
+ lint_cmd: pnpm --filter web lint
86
+ lint_quiet_cmd: pnpm --filter web lint --quiet
87
+ format_cmd: pnpm --filter web format
88
+ typecheck_cmd: pnpm check-types
89
+ build_cmd: pnpm --filter web build
90
+ uses_design: true
91
+
92
+ # ── contract (the only cross-surface sync channel) ──────────────────────────
93
+ contract:
94
+ enabled: <true | false> # false ⇒ no shared contract; skip §2 of /cohorte-build
95
+ mechanism: <shared-types-zod | openapi | protobuf | json-schema | none>
96
+ path: packages/shared-types/src # where <feature_id>.<ext> is authored
97
+ ext: ts
98
+ index: packages/shared-types/src/index.ts # barrel to export from, or "" if none
99
+ authored_by: lead # NEVER the implementer agents
100
+
101
+ # ── release notes (optional) ────────────────────────────────────────────────
102
+ # A per-feature release note the project's versioning tool consumes. When
103
+ # enabled, /cohorte-ship authors it BEFORE dispatching the release agent, so it
104
+ # ships inside the release commit. Repos whose CI fails a PR that lacks one
105
+ # (Changesets' `changeset` job) MUST set this — otherwise every ship goes red.
106
+ release_notes:
107
+ enabled: <true | false> # false ⇒ /cohorte-ship §2b is a no-op
108
+ tool: <changesets | none> # what consumes the file
109
+ dir: .changeset # where the note is authored
110
+ filename: "<feature_id>.md" # one file per feature
111
+ anchor_package: shared-types # sole key in the front-matter; a lockstep/fixed group propagates the bump
112
+ language: <ui_language | English> # language of the note's prose
113
+ forbid_levels: [] # bumps project policy refuses, e.g. [major] while 0.x
114
+ empty_cmd: "pnpm changeset --empty" # when no version should move; "" if the tool has no such escape hatch
115
+ ci_job: changeset # CI job that fails when the note is missing (name it so /cohorte-ship §5 recognizes the red)
116
+ guidance: | # rules the lead follows when writing the note (project policy)
117
+ major = the deploy needs an operator action; minor = a user-visible capability;
118
+ patch = fix/perf/refactor with no change of use. No client names, no internal
119
+ paths, no exploitable attack vector.
120
+
121
+ # ── repo-wide commands (root unless noted) ──────────────────────────────────
122
+ commands:
123
+ install: pnpm install
124
+ dev: pnpm dev
125
+ lint: pnpm lint
126
+ lint_quiet: pnpm lint --quiet # bridled variant (see surfaces[].*_quiet_cmd)
127
+ format: pnpm format
128
+ typecheck: pnpm check-types
129
+ test: pnpm test
130
+ test_quiet: pnpm test --reporter=dot # bridled variant — what the /cohorte-review preflight runs
131
+ # migration commands — omit / leave "" if the project has no DB migrations
132
+ migrate: "cd apps/api && node ace migration:run"
133
+ make_migration: "cd apps/api && node ace make:migration"
134
+
135
+ # ── rbac (optional) ─────────────────────────────────────────────────────────
136
+ rbac:
137
+ enabled: <true | false>
138
+ hierarchy: [super-admin, admin, editor, member] # highest → lowest, or []
139
+ note: "the platform must serve EVERY role, not just admins"
140
+
141
+ # ── design system (optional) ────────────────────────────────────────────────
142
+ design:
143
+ enabled: <true | false> # false ⇒ /cohorte-align-ds + design gates are no-ops
144
+ provider: <claude-design | figma | none>
145
+ design_system_project: <uuid-or-id> # the UI-kit source of truth
146
+ design_project: none # legacy fallback for bare-filename design_files only; keep `none` — new specs use full links that carry their own project, so nothing here goes stale on a DS rebuild
147
+ snapshot_dir: apps/web/design-reference # committed DS snapshot for /cohorte-align-ds diff
148
+ direction: design-to-code # NEVER push code→design for a curated DS
149
+ ui_kit_path: apps/web/src/components/ui
150
+ tokens_path: apps/web/src/index.css
151
+
152
+ # ── isolation / parallelism (optional) ──────────────────────────────────────
153
+ isolation:
154
+ enabled: <true | false> # false ⇒ features run in the main checkout
155
+ unit: git-worktree
156
+ db_per_worktree: <true | false>
157
+ db_name_pattern: "<name>_<id>" # e.g. myapp_<id>
158
+ port_base: { api: 3333, web: 5173 } # each worktree gets base+slot
159
+ compose_file: docker-compose.yml
160
+ registry: .worktrees/slots.tsv
161
+
162
+ # ── gate (drives the pipeline gate hook + permissions) ─────────────────────
163
+ # Confirm-first or hard-deny on dangerous Bash, inspecting the FULL command
164
+ # string (so chained `cd x && …` forms are caught).
165
+ gate:
166
+ # Three tiers. `deny` = always hard-blocked. `ask` = always confirm (branch-independent risk).
167
+ # `ask_on_default_branch` = confirm ONLY when the checked-out branch is `default_branch`; on
168
+ # feature branches these run freely. gate.py resolves the branch at run time (git rev-parse);
169
+ # unknown branch (no repo / detached) ⇒ gated, to stay safe. Keep git + docker here so agents
170
+ # move fast on feature branches but main stays protected.
171
+ default_branch: main # the protected branch (mirror vcs.default_branch)
172
+ deny: # never allowed, on any branch
173
+ - "node ace migration:fresh"
174
+ - "node ace migration:reset"
175
+ - "node ace migration:rollback"
176
+ - "node ace db:wipe"
177
+ ask: # always confirm, on any branch
178
+ - "node ace migration:run"
179
+ - "node ace db:"
180
+ - "psql"
181
+ ask_on_default_branch: # free on feature branches, confirm on default_branch
182
+ - "git commit"
183
+ - "git push"
184
+ - "git merge"
185
+ - "git rebase"
186
+ - "git reset"
187
+ - "docker compose"
188
+ # Phase gate: review dispatches require a fresh `preflight.ok` stamp,
189
+ # written by pipeline/scripts/preflight.sh when typecheck+lint+tests are green —
190
+ # gate.py "ask"s the dispatch when the stamp is missing, stale, or the code changed since.
191
+ # The stamp is local: keep `preflight.ok` gitignored, never committed.
192
+ preflight:
193
+ enabled: true
194
+ agents: [cohorte-review] # subagent_types the stamp gates
195
+ max_age_minutes: 30
196
+
197
+ ```
198
+
199
+ > **Note.** The **kanban** board link is **user-scoped** — NOT configured here. Its facts live in the
200
+ > consolidated user config (`~/.claude/cohorte.config.yaml`), read at runtime (the kanban board is keyed by this
201
+ > profile's `name`). This project profile only governs the dev pipeline (`/cohorte-brainstorm…/cohorte-ship`).
202
+
203
+ ---
204
+
205
+ ## Conventions
206
+
207
+ > Read by the implementer + review agents. Keep these terse and rule-shaped; the machine
208
+ > block above holds the paths/commands they enforce against.
209
+
210
+ ### Shared
211
+
212
+ - User-facing copy (API messages, UI text) in **<ui_language>**.
213
+ - <e.g. Zod v4 syntax `z.email()`/`z.uuid()`; ESM `.js` import extensions — project-specific>
214
+
215
+ ### Surface: `backend` (`apps/api`)
216
+
217
+ - <one-action controllers · validator on every write · standardized response envelope · base model / UUID PK · `#`-alias imports · additive-only migrations · …>
218
+
219
+ ### Surface: `frontend` (`apps/web`)
220
+
221
+ - <file-based routes with loaders/guards · domain `lib/api` modules over the shared client · design-system primitives, `cn()`+CVA · **mobile-first, fully responsive** · consume contract types, never redefine · …>
222
+
223
+ ### Testing — strict TDD (red → green → refactor)
224
+
225
+ - <backend test runner + what a contract test must cover (status, validation, auth, payload) · DB isolation per test>
226
+ - <frontend test runner + what to cover (hooks, api modules, component behavior); note layout is not unit-testable>
227
+
228
+ ---
229
+
230
+ ## Design brief note (feeds `/cohorte-spec` §8 and Claude Design)
231
+
232
+ - <design system name + primitives to use · mobile-first · copy language · brand/theming constraints>
233
+ - A feature lists its design pages in the spec front-matter `design_files` as **full links** of the form
234
+ `https://claude.ai/design/p/<projectId>?file=<file>` — each carries its own project (`/p/<projectId>`)
235
+ and page (`?file=`), so an agent extracts both and reads it via `DesignSync get_file(<projectId>,
236
+ <file>)`. Paste the link at `/cohorte-build`'s design gate. No stored project id ⇒ a design-system rebuild
237
+ (new project) just means pasting the new links. (Bare file names are legacy, resolved in `design_project`.)
238
+
239
+ ---
240
+
241
+ ## Personas for `/cohorte-brainstorm` (optional — the panel)
242
+
243
+ <Panel members with a job AND a personality who challenge the idea from their angle and
244
+ disagree with each other. Include a role-coverage guard if `rbac.enabled`. Example:>
245
+
246
+ - **PM** (pragmatic, scope-cutting) — real value? what do we drop?
247
+ - **Skeptical senior engineer** (blunt) — feasibility, edge cases, tech debt.
248
+ - **UX/product designer** — mobile-first flows, accessibility, empty/error states.
249
+ - **Security & RBAC** (paranoid) — permission leaks, cross-tenant exposure, least privilege.
250
+ - <one persona per RBAC role so the feature serves every role, not just admins>