popeye-cli 1.10.0 → 2.1.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 (326) hide show
  1. package/CHANGELOG.md +114 -0
  2. package/CONTRIBUTING.md +38 -3
  3. package/README.md +104 -18
  4. package/dist/adapters/gemini.js +3 -3
  5. package/dist/adapters/openai.js +2 -2
  6. package/dist/adapters/openai.js.map +1 -1
  7. package/dist/auth/gemini.js +1 -1
  8. package/dist/cli/commands/create.d.ts.map +1 -1
  9. package/dist/cli/commands/create.js +11 -5
  10. package/dist/cli/commands/create.js.map +1 -1
  11. package/dist/cli/commands/resume.d.ts.map +1 -1
  12. package/dist/cli/commands/resume.js +9 -1
  13. package/dist/cli/commands/resume.js.map +1 -1
  14. package/dist/cli/interactive.d.ts.map +1 -1
  15. package/dist/cli/interactive.js +29 -3
  16. package/dist/cli/interactive.js.map +1 -1
  17. package/dist/config/defaults.d.ts.map +1 -1
  18. package/dist/config/defaults.js +7 -2
  19. package/dist/config/defaults.js.map +1 -1
  20. package/dist/config/index.d.ts +1 -7
  21. package/dist/config/index.d.ts.map +1 -1
  22. package/dist/config/popeye-md.d.ts +32 -0
  23. package/dist/config/popeye-md.d.ts.map +1 -0
  24. package/dist/config/popeye-md.js +111 -0
  25. package/dist/config/popeye-md.js.map +1 -0
  26. package/dist/config/schema.d.ts +3 -21
  27. package/dist/config/schema.d.ts.map +1 -1
  28. package/dist/config/schema.js +21 -8
  29. package/dist/config/schema.js.map +1 -1
  30. package/dist/pipeline/artifact-manager.d.ts +47 -0
  31. package/dist/pipeline/artifact-manager.d.ts.map +1 -0
  32. package/dist/pipeline/artifact-manager.js +251 -0
  33. package/dist/pipeline/artifact-manager.js.map +1 -0
  34. package/dist/pipeline/artifact-validators.d.ts +29 -0
  35. package/dist/pipeline/artifact-validators.d.ts.map +1 -0
  36. package/dist/pipeline/artifact-validators.js +173 -0
  37. package/dist/pipeline/artifact-validators.js.map +1 -0
  38. package/dist/pipeline/bridges/review-bridge.d.ts +70 -0
  39. package/dist/pipeline/bridges/review-bridge.d.ts.map +1 -0
  40. package/dist/pipeline/bridges/review-bridge.js +266 -0
  41. package/dist/pipeline/bridges/review-bridge.js.map +1 -0
  42. package/dist/pipeline/change-request.d.ts +47 -0
  43. package/dist/pipeline/change-request.d.ts.map +1 -0
  44. package/dist/pipeline/change-request.js +91 -0
  45. package/dist/pipeline/change-request.js.map +1 -0
  46. package/dist/pipeline/check-runner.d.ts +47 -0
  47. package/dist/pipeline/check-runner.d.ts.map +1 -0
  48. package/dist/pipeline/check-runner.js +417 -0
  49. package/dist/pipeline/check-runner.js.map +1 -0
  50. package/dist/pipeline/command-resolver.d.ts +9 -0
  51. package/dist/pipeline/command-resolver.d.ts.map +1 -0
  52. package/dist/pipeline/command-resolver.js +140 -0
  53. package/dist/pipeline/command-resolver.js.map +1 -0
  54. package/dist/pipeline/consensus/consensus-runner.d.ts +44 -0
  55. package/dist/pipeline/consensus/consensus-runner.d.ts.map +1 -0
  56. package/dist/pipeline/consensus/consensus-runner.js +212 -0
  57. package/dist/pipeline/consensus/consensus-runner.js.map +1 -0
  58. package/dist/pipeline/constitution.d.ts +45 -0
  59. package/dist/pipeline/constitution.d.ts.map +1 -0
  60. package/dist/pipeline/constitution.js +82 -0
  61. package/dist/pipeline/constitution.js.map +1 -0
  62. package/dist/pipeline/gate-engine.d.ts +55 -0
  63. package/dist/pipeline/gate-engine.d.ts.map +1 -0
  64. package/dist/pipeline/gate-engine.js +270 -0
  65. package/dist/pipeline/gate-engine.js.map +1 -0
  66. package/dist/pipeline/index.d.ts +26 -0
  67. package/dist/pipeline/index.d.ts.map +1 -0
  68. package/dist/pipeline/index.js +35 -0
  69. package/dist/pipeline/index.js.map +1 -0
  70. package/dist/pipeline/migration.d.ts +15 -0
  71. package/dist/pipeline/migration.d.ts.map +1 -0
  72. package/dist/pipeline/migration.js +76 -0
  73. package/dist/pipeline/migration.js.map +1 -0
  74. package/dist/pipeline/orchestrator.d.ts +30 -0
  75. package/dist/pipeline/orchestrator.d.ts.map +1 -0
  76. package/dist/pipeline/orchestrator.js +242 -0
  77. package/dist/pipeline/orchestrator.js.map +1 -0
  78. package/dist/pipeline/packets/audit-report-builder.d.ts +11 -0
  79. package/dist/pipeline/packets/audit-report-builder.d.ts.map +1 -0
  80. package/dist/pipeline/packets/audit-report-builder.js +32 -0
  81. package/dist/pipeline/packets/audit-report-builder.js.map +1 -0
  82. package/dist/pipeline/packets/consensus-packet-builder.d.ts +35 -0
  83. package/dist/pipeline/packets/consensus-packet-builder.d.ts.map +1 -0
  84. package/dist/pipeline/packets/consensus-packet-builder.js +80 -0
  85. package/dist/pipeline/packets/consensus-packet-builder.js.map +1 -0
  86. package/dist/pipeline/packets/index.d.ts +12 -0
  87. package/dist/pipeline/packets/index.d.ts.map +1 -0
  88. package/dist/pipeline/packets/index.js +8 -0
  89. package/dist/pipeline/packets/index.js.map +1 -0
  90. package/dist/pipeline/packets/plan-packet-builder.d.ts +21 -0
  91. package/dist/pipeline/packets/plan-packet-builder.d.ts.map +1 -0
  92. package/dist/pipeline/packets/plan-packet-builder.js +27 -0
  93. package/dist/pipeline/packets/plan-packet-builder.js.map +1 -0
  94. package/dist/pipeline/packets/rca-packet-builder.d.ts +19 -0
  95. package/dist/pipeline/packets/rca-packet-builder.d.ts.map +1 -0
  96. package/dist/pipeline/packets/rca-packet-builder.js +22 -0
  97. package/dist/pipeline/packets/rca-packet-builder.js.map +1 -0
  98. package/dist/pipeline/phases/architecture.d.ts +7 -0
  99. package/dist/pipeline/phases/architecture.d.ts.map +1 -0
  100. package/dist/pipeline/phases/architecture.js +60 -0
  101. package/dist/pipeline/phases/architecture.js.map +1 -0
  102. package/dist/pipeline/phases/audit.d.ts +8 -0
  103. package/dist/pipeline/phases/audit.d.ts.map +1 -0
  104. package/dist/pipeline/phases/audit.js +144 -0
  105. package/dist/pipeline/phases/audit.js.map +1 -0
  106. package/dist/pipeline/phases/consensus-architecture.d.ts +7 -0
  107. package/dist/pipeline/phases/consensus-architecture.d.ts.map +1 -0
  108. package/dist/pipeline/phases/consensus-architecture.js +84 -0
  109. package/dist/pipeline/phases/consensus-architecture.js.map +1 -0
  110. package/dist/pipeline/phases/consensus-master-plan.d.ts +7 -0
  111. package/dist/pipeline/phases/consensus-master-plan.d.ts.map +1 -0
  112. package/dist/pipeline/phases/consensus-master-plan.js +81 -0
  113. package/dist/pipeline/phases/consensus-master-plan.js.map +1 -0
  114. package/dist/pipeline/phases/consensus-role-plans.d.ts +7 -0
  115. package/dist/pipeline/phases/consensus-role-plans.d.ts.map +1 -0
  116. package/dist/pipeline/phases/consensus-role-plans.js +85 -0
  117. package/dist/pipeline/phases/consensus-role-plans.js.map +1 -0
  118. package/dist/pipeline/phases/done.d.ts +7 -0
  119. package/dist/pipeline/phases/done.d.ts.map +1 -0
  120. package/dist/pipeline/phases/done.js +45 -0
  121. package/dist/pipeline/phases/done.js.map +1 -0
  122. package/dist/pipeline/phases/implementation.d.ts +8 -0
  123. package/dist/pipeline/phases/implementation.d.ts.map +1 -0
  124. package/dist/pipeline/phases/implementation.js +45 -0
  125. package/dist/pipeline/phases/implementation.js.map +1 -0
  126. package/dist/pipeline/phases/index.d.ts +20 -0
  127. package/dist/pipeline/phases/index.d.ts.map +1 -0
  128. package/dist/pipeline/phases/index.js +19 -0
  129. package/dist/pipeline/phases/index.js.map +1 -0
  130. package/dist/pipeline/phases/intake.d.ts +8 -0
  131. package/dist/pipeline/phases/intake.d.ts.map +1 -0
  132. package/dist/pipeline/phases/intake.js +49 -0
  133. package/dist/pipeline/phases/intake.js.map +1 -0
  134. package/dist/pipeline/phases/phase-context.d.ts +30 -0
  135. package/dist/pipeline/phases/phase-context.d.ts.map +1 -0
  136. package/dist/pipeline/phases/phase-context.js +33 -0
  137. package/dist/pipeline/phases/phase-context.js.map +1 -0
  138. package/dist/pipeline/phases/production-gate.d.ts +8 -0
  139. package/dist/pipeline/phases/production-gate.d.ts.map +1 -0
  140. package/dist/pipeline/phases/production-gate.js +84 -0
  141. package/dist/pipeline/phases/production-gate.js.map +1 -0
  142. package/dist/pipeline/phases/qa-validation.d.ts +7 -0
  143. package/dist/pipeline/phases/qa-validation.d.ts.map +1 -0
  144. package/dist/pipeline/phases/qa-validation.js +50 -0
  145. package/dist/pipeline/phases/qa-validation.js.map +1 -0
  146. package/dist/pipeline/phases/recovery-loop.d.ts +7 -0
  147. package/dist/pipeline/phases/recovery-loop.d.ts.map +1 -0
  148. package/dist/pipeline/phases/recovery-loop.js +93 -0
  149. package/dist/pipeline/phases/recovery-loop.js.map +1 -0
  150. package/dist/pipeline/phases/review.d.ts +8 -0
  151. package/dist/pipeline/phases/review.d.ts.map +1 -0
  152. package/dist/pipeline/phases/review.js +127 -0
  153. package/dist/pipeline/phases/review.js.map +1 -0
  154. package/dist/pipeline/phases/role-planning.d.ts +7 -0
  155. package/dist/pipeline/phases/role-planning.d.ts.map +1 -0
  156. package/dist/pipeline/phases/role-planning.js +75 -0
  157. package/dist/pipeline/phases/role-planning.js.map +1 -0
  158. package/dist/pipeline/phases/stuck.d.ts +7 -0
  159. package/dist/pipeline/phases/stuck.d.ts.map +1 -0
  160. package/dist/pipeline/phases/stuck.js +51 -0
  161. package/dist/pipeline/phases/stuck.js.map +1 -0
  162. package/dist/pipeline/repo-snapshot.d.ts +24 -0
  163. package/dist/pipeline/repo-snapshot.d.ts.map +1 -0
  164. package/dist/pipeline/repo-snapshot.js +343 -0
  165. package/dist/pipeline/repo-snapshot.js.map +1 -0
  166. package/dist/pipeline/role-execution-adapter.d.ts +59 -0
  167. package/dist/pipeline/role-execution-adapter.d.ts.map +1 -0
  168. package/dist/pipeline/role-execution-adapter.js +159 -0
  169. package/dist/pipeline/role-execution-adapter.js.map +1 -0
  170. package/dist/pipeline/skill-loader.d.ts +34 -0
  171. package/dist/pipeline/skill-loader.d.ts.map +1 -0
  172. package/dist/pipeline/skill-loader.js +156 -0
  173. package/dist/pipeline/skill-loader.js.map +1 -0
  174. package/dist/pipeline/skills/defaults.d.ts +16 -0
  175. package/dist/pipeline/skills/defaults.d.ts.map +1 -0
  176. package/dist/pipeline/skills/defaults.js +189 -0
  177. package/dist/pipeline/skills/defaults.js.map +1 -0
  178. package/dist/pipeline/type-defs/artifacts.d.ts +207 -0
  179. package/dist/pipeline/type-defs/artifacts.d.ts.map +1 -0
  180. package/dist/pipeline/type-defs/artifacts.js +67 -0
  181. package/dist/pipeline/type-defs/artifacts.js.map +1 -0
  182. package/dist/pipeline/type-defs/audit.d.ts +259 -0
  183. package/dist/pipeline/type-defs/audit.d.ts.map +1 -0
  184. package/dist/pipeline/type-defs/audit.js +54 -0
  185. package/dist/pipeline/type-defs/audit.js.map +1 -0
  186. package/dist/pipeline/type-defs/checks.d.ts +82 -0
  187. package/dist/pipeline/type-defs/checks.d.ts.map +1 -0
  188. package/dist/pipeline/type-defs/checks.js +38 -0
  189. package/dist/pipeline/type-defs/checks.js.map +1 -0
  190. package/dist/pipeline/type-defs/enums.d.ts +43 -0
  191. package/dist/pipeline/type-defs/enums.d.ts.map +1 -0
  192. package/dist/pipeline/type-defs/enums.js +55 -0
  193. package/dist/pipeline/type-defs/enums.js.map +1 -0
  194. package/dist/pipeline/type-defs/index.d.ts +12 -0
  195. package/dist/pipeline/type-defs/index.d.ts.map +1 -0
  196. package/dist/pipeline/type-defs/index.js +12 -0
  197. package/dist/pipeline/type-defs/index.js.map +1 -0
  198. package/dist/pipeline/type-defs/packets.d.ts +821 -0
  199. package/dist/pipeline/type-defs/packets.d.ts.map +1 -0
  200. package/dist/pipeline/type-defs/packets.js +109 -0
  201. package/dist/pipeline/type-defs/packets.js.map +1 -0
  202. package/dist/pipeline/type-defs/snapshot.d.ts +52 -0
  203. package/dist/pipeline/type-defs/snapshot.d.ts.map +1 -0
  204. package/dist/pipeline/type-defs/snapshot.js +35 -0
  205. package/dist/pipeline/type-defs/snapshot.js.map +1 -0
  206. package/dist/pipeline/type-defs/state.d.ts +455 -0
  207. package/dist/pipeline/type-defs/state.d.ts.map +1 -0
  208. package/dist/pipeline/type-defs/state.js +90 -0
  209. package/dist/pipeline/type-defs/state.js.map +1 -0
  210. package/dist/pipeline/types.d.ts +16 -0
  211. package/dist/pipeline/types.d.ts.map +1 -0
  212. package/dist/pipeline/types.js +16 -0
  213. package/dist/pipeline/types.js.map +1 -0
  214. package/dist/types/audit.d.ts +6 -6
  215. package/dist/types/consensus.d.ts +5 -1
  216. package/dist/types/consensus.d.ts.map +1 -1
  217. package/dist/types/consensus.js +15 -4
  218. package/dist/types/consensus.js.map +1 -1
  219. package/dist/types/index.d.ts +1 -1
  220. package/dist/types/index.d.ts.map +1 -1
  221. package/dist/types/index.js +1 -1
  222. package/dist/types/index.js.map +1 -1
  223. package/dist/types/project.d.ts +1 -1
  224. package/dist/types/project.d.ts.map +1 -1
  225. package/dist/types/project.js +39 -10
  226. package/dist/types/project.js.map +1 -1
  227. package/dist/types/workflow.d.ts +1 -7
  228. package/dist/types/workflow.d.ts.map +1 -1
  229. package/dist/types/workflow.js +1 -1
  230. package/dist/types/workflow.js.map +1 -1
  231. package/dist/upgrade/handlers.js +5 -5
  232. package/dist/upgrade/handlers.js.map +1 -1
  233. package/dist/workflow/index.d.ts.map +1 -1
  234. package/dist/workflow/index.js +52 -0
  235. package/dist/workflow/index.js.map +1 -1
  236. package/dist/workflow/website-strategy.js +1 -1
  237. package/dist/workflow/website-strategy.js.map +1 -1
  238. package/package.json +1 -1
  239. package/skills/PHASE_GATE_ENGINE_SPEC.md +113 -20
  240. package/skills/POPEYE_FULL_AUTONOMY_PIPELINE.md +66 -13
  241. package/src/adapters/gemini.ts +3 -3
  242. package/src/adapters/openai.ts +2 -2
  243. package/src/auth/gemini.ts +1 -1
  244. package/src/cli/commands/create.ts +12 -6
  245. package/src/cli/commands/resume.ts +9 -1
  246. package/src/cli/interactive.ts +32 -3
  247. package/src/config/defaults.ts +7 -2
  248. package/src/config/popeye-md.ts +139 -0
  249. package/src/config/schema.ts +21 -8
  250. package/src/pipeline/artifact-manager.ts +339 -0
  251. package/src/pipeline/artifact-validators.ts +224 -0
  252. package/src/pipeline/bridges/review-bridge.ts +371 -0
  253. package/src/pipeline/change-request.ts +119 -0
  254. package/src/pipeline/check-runner.ts +504 -0
  255. package/src/pipeline/command-resolver.ts +168 -0
  256. package/src/pipeline/consensus/consensus-runner.ts +317 -0
  257. package/src/pipeline/constitution.ts +109 -0
  258. package/src/pipeline/gate-engine.ts +347 -0
  259. package/src/pipeline/index.ts +82 -0
  260. package/src/pipeline/migration.ts +91 -0
  261. package/src/pipeline/orchestrator.ts +322 -0
  262. package/src/pipeline/packets/audit-report-builder.ts +47 -0
  263. package/src/pipeline/packets/consensus-packet-builder.ts +112 -0
  264. package/src/pipeline/packets/index.ts +15 -0
  265. package/src/pipeline/packets/plan-packet-builder.ts +52 -0
  266. package/src/pipeline/packets/rca-packet-builder.ts +38 -0
  267. package/src/pipeline/phases/architecture.ts +73 -0
  268. package/src/pipeline/phases/audit.ts +193 -0
  269. package/src/pipeline/phases/consensus-architecture.ts +104 -0
  270. package/src/pipeline/phases/consensus-master-plan.ts +100 -0
  271. package/src/pipeline/phases/consensus-role-plans.ts +105 -0
  272. package/src/pipeline/phases/done.ts +68 -0
  273. package/src/pipeline/phases/implementation.ts +52 -0
  274. package/src/pipeline/phases/index.ts +21 -0
  275. package/src/pipeline/phases/intake.ts +68 -0
  276. package/src/pipeline/phases/phase-context.ts +86 -0
  277. package/src/pipeline/phases/production-gate.ts +113 -0
  278. package/src/pipeline/phases/qa-validation.ts +63 -0
  279. package/src/pipeline/phases/recovery-loop.ts +120 -0
  280. package/src/pipeline/phases/review.ts +149 -0
  281. package/src/pipeline/phases/role-planning.ts +92 -0
  282. package/src/pipeline/phases/stuck.ts +62 -0
  283. package/src/pipeline/repo-snapshot.ts +395 -0
  284. package/src/pipeline/role-execution-adapter.ts +238 -0
  285. package/src/pipeline/skill-loader.ts +192 -0
  286. package/src/pipeline/skills/defaults.ts +215 -0
  287. package/src/pipeline/type-defs/artifacts.ts +82 -0
  288. package/src/pipeline/type-defs/audit.ts +67 -0
  289. package/src/pipeline/type-defs/checks.ts +47 -0
  290. package/src/pipeline/type-defs/enums.ts +62 -0
  291. package/src/pipeline/type-defs/index.ts +12 -0
  292. package/src/pipeline/type-defs/packets.ts +131 -0
  293. package/src/pipeline/type-defs/snapshot.ts +55 -0
  294. package/src/pipeline/type-defs/state.ts +167 -0
  295. package/src/pipeline/types.ts +16 -0
  296. package/src/types/consensus.ts +16 -4
  297. package/src/types/index.ts +1 -0
  298. package/src/types/project.ts +39 -10
  299. package/src/types/workflow.ts +1 -1
  300. package/src/upgrade/handlers.ts +5 -5
  301. package/src/workflow/index.ts +52 -0
  302. package/src/workflow/website-strategy.ts +1 -1
  303. package/tests/cli/model-command.test.ts +19 -9
  304. package/tests/config/config.test.ts +3 -3
  305. package/tests/config/popeye-md.test.ts +168 -0
  306. package/tests/pipeline/artifact-manager.test.ts +183 -0
  307. package/tests/pipeline/artifact-validators.test.ts +207 -0
  308. package/tests/pipeline/bridges/review-bridge.test.ts +243 -0
  309. package/tests/pipeline/change-request.test.ts +180 -0
  310. package/tests/pipeline/check-runner.test.ts +157 -0
  311. package/tests/pipeline/command-resolver.test.ts +159 -0
  312. package/tests/pipeline/consensus-runner.test.ts +206 -0
  313. package/tests/pipeline/consensus-scoring.test.ts +163 -0
  314. package/tests/pipeline/constitution.test.ts +122 -0
  315. package/tests/pipeline/gate-engine.test.ts +195 -0
  316. package/tests/pipeline/migration.test.ts +133 -0
  317. package/tests/pipeline/orchestrator.test.ts +614 -0
  318. package/tests/pipeline/packets/builders.test.ts +347 -0
  319. package/tests/pipeline/repo-snapshot.test.ts +189 -0
  320. package/tests/pipeline/role-execution-adapter.test.ts +299 -0
  321. package/tests/pipeline/session-guidance.test.ts +205 -0
  322. package/tests/pipeline/skill-loader.test.ts +186 -0
  323. package/tests/pipeline/start-env-checks.test.ts +123 -0
  324. package/tests/pipeline/types.test.ts +156 -0
  325. package/tests/types/consensus.test.ts +1 -1
  326. package/tests/workflow/pipeline-bootstrap.test.ts +162 -0
@@ -0,0 +1,45 @@
1
+ /**
2
+ * IMPLEMENTATION phase — build the system according to approved plans.
3
+ * Reuses runExecutionMode() from existing workflow.
4
+ * v1.1: Injects role-specific execution contexts via role-execution-adapter.
5
+ */
6
+ import { successResult, failureResult } from './phase-context.js';
7
+ import { generateRepoSnapshot, createSnapshotArtifact } from '../repo-snapshot.js';
8
+ import { buildAllRoleContexts } from '../role-execution-adapter.js';
9
+ export async function runImplementation(context) {
10
+ const { pipeline, artifactManager, projectDir, skillLoader } = context;
11
+ const artifacts = [];
12
+ try {
13
+ // v1.1: Build role contexts for execution
14
+ const roleContexts = buildAllRoleContexts(pipeline, skillLoader, projectDir);
15
+ // Build combined role context for system prompt injection
16
+ let combinedRolePrompt = '';
17
+ if (roleContexts.size > 0) {
18
+ const contextEntries = Array.from(roleContexts.entries());
19
+ combinedRolePrompt = contextEntries
20
+ .map(([role, ctx]) => `## ${role}\nScope: ${ctx.taskScope.slice(0, 500)}`)
21
+ .join('\n\n');
22
+ }
23
+ // Merge session guidance with role prompt so execution sees user intent
24
+ const guidance = pipeline.sessionGuidance;
25
+ const systemPrompt = [combinedRolePrompt, guidance].filter(Boolean).join('\n\n') || undefined;
26
+ // Run existing execution mode with optional role context + guidance
27
+ const { runExecutionMode } = await import('../../workflow/execution-mode.js');
28
+ await runExecutionMode({
29
+ projectDir,
30
+ ...(systemPrompt ? { systemPrompt } : {}),
31
+ });
32
+ // Generate post-implementation repo snapshot
33
+ const snapshot = await generateRepoSnapshot(projectDir);
34
+ const snapshotEntry = createSnapshotArtifact(snapshot, artifactManager, 'IMPLEMENTATION');
35
+ artifacts.push(snapshotEntry);
36
+ pipeline.latestRepoSnapshot = artifactManager.toArtifactRef(snapshotEntry);
37
+ pipeline.artifacts.push(...artifacts);
38
+ return successResult('IMPLEMENTATION', artifacts, `Implementation complete. ${roleContexts.size} roles active.`);
39
+ }
40
+ catch (err) {
41
+ const message = err instanceof Error ? err.message : 'Unknown error';
42
+ return failureResult('IMPLEMENTATION', 'Implementation failed', message);
43
+ }
44
+ }
45
+ //# sourceMappingURL=implementation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"implementation.js","sourceRoot":"","sources":["../../../src/pipeline/phases/implementation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AACnF,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEpE,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,OAAqB;IAC3D,MAAM,EAAE,QAAQ,EAAE,eAAe,EAAE,UAAU,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IACvE,MAAM,SAAS,GAAG,EAAE,CAAC;IAErB,IAAI,CAAC;QACH,0CAA0C;QAC1C,MAAM,YAAY,GAAG,oBAAoB,CAAC,QAAQ,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;QAE7E,0DAA0D;QAC1D,IAAI,kBAAkB,GAAG,EAAE,CAAC;QAC5B,IAAI,YAAY,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;YAC1B,MAAM,cAAc,GAAG,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC,CAAC;YAC1D,kBAAkB,GAAG,cAAc;iBAChC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,MAAM,IAAI,YAAY,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;iBACzE,IAAI,CAAC,MAAM,CAAC,CAAC;QAClB,CAAC;QAED,wEAAwE;QACxE,MAAM,QAAQ,GAAG,QAAQ,CAAC,eAAe,CAAC;QAC1C,MAAM,YAAY,GAAG,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,SAAS,CAAC;QAE9F,oEAAoE;QACpE,MAAM,EAAE,gBAAgB,EAAE,GAAG,MAAM,MAAM,CAAC,kCAAkC,CAAC,CAAC;QAC9E,MAAM,gBAAgB,CAAC;YACrB,UAAU;YACV,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC1C,CAAC,CAAC;QAEH,6CAA6C;QAC7C,MAAM,QAAQ,GAAG,MAAM,oBAAoB,CAAC,UAAU,CAAC,CAAC;QACxD,MAAM,aAAa,GAAG,sBAAsB,CAAC,QAAQ,EAAE,eAAe,EAAE,gBAAgB,CAAC,CAAC;QAC1F,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC9B,QAAQ,CAAC,kBAAkB,GAAG,eAAe,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;QAE3E,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC;QACtC,OAAO,aAAa,CAAC,gBAAgB,EAAE,SAAS,EAAE,4BAA4B,YAAY,CAAC,IAAI,gBAAgB,CAAC,CAAC;IACnH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;QACrE,OAAO,aAAa,CAAC,gBAAgB,EAAE,uBAAuB,EAAE,OAAO,CAAC,CAAC;IAC3E,CAAC;AACH,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Re-exports all phase implementations.
3
+ */
4
+ export { runIntake } from './intake.js';
5
+ export { runConsensusMasterPlan } from './consensus-master-plan.js';
6
+ export { runArchitecture } from './architecture.js';
7
+ export { runConsensusArchitecture } from './consensus-architecture.js';
8
+ export { runRolePlanning } from './role-planning.js';
9
+ export { runConsensusRolePlans } from './consensus-role-plans.js';
10
+ export { runImplementation } from './implementation.js';
11
+ export { runQaValidation } from './qa-validation.js';
12
+ export { runReview } from './review.js';
13
+ export { runAudit } from './audit.js';
14
+ export { runProductionGate } from './production-gate.js';
15
+ export { runRecoveryLoop } from './recovery-loop.js';
16
+ export { runDone } from './done.js';
17
+ export { runStuck } from './stuck.js';
18
+ export type { PhaseContext, PhaseResult } from './phase-context.js';
19
+ export { triggerJournalist, successResult, failureResult } from './phase-context.js';
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pipeline/phases/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Re-exports all phase implementations.
3
+ */
4
+ export { runIntake } from './intake.js';
5
+ export { runConsensusMasterPlan } from './consensus-master-plan.js';
6
+ export { runArchitecture } from './architecture.js';
7
+ export { runConsensusArchitecture } from './consensus-architecture.js';
8
+ export { runRolePlanning } from './role-planning.js';
9
+ export { runConsensusRolePlans } from './consensus-role-plans.js';
10
+ export { runImplementation } from './implementation.js';
11
+ export { runQaValidation } from './qa-validation.js';
12
+ export { runReview } from './review.js';
13
+ export { runAudit } from './audit.js';
14
+ export { runProductionGate } from './production-gate.js';
15
+ export { runRecoveryLoop } from './recovery-loop.js';
16
+ export { runDone } from './done.js';
17
+ export { runStuck } from './stuck.js';
18
+ export { triggerJournalist, successResult, failureResult } from './phase-context.js';
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/pipeline/phases/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * INTAKE phase — normalize user prompt into structured Master Plan v1.
3
+ * Reuses expandIdea() and createPlan() from workflow.
4
+ * v1.1: Creates constitution artifact and stores hash.
5
+ */
6
+ import type { PhaseContext, PhaseResult } from './phase-context.js';
7
+ export declare function runIntake(context: PhaseContext): Promise<PhaseResult>;
8
+ //# sourceMappingURL=intake.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intake.d.ts","sourceRoot":"","sources":["../../../src/pipeline/phases/intake.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAKpE,wBAAsB,SAAS,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAwD3E"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * INTAKE phase — normalize user prompt into structured Master Plan v1.
3
+ * Reuses expandIdea() and createPlan() from workflow.
4
+ * v1.1: Creates constitution artifact and stores hash.
5
+ */
6
+ import { successResult, failureResult } from './phase-context.js';
7
+ import { generateRepoSnapshot, createSnapshotArtifact } from '../repo-snapshot.js';
8
+ import { createConstitutionArtifact, computeConstitutionHash } from '../constitution.js';
9
+ export async function runIntake(context) {
10
+ const { projectDir, pipeline, artifactManager } = context;
11
+ const artifacts = [];
12
+ try {
13
+ // 1. Generate repo snapshot
14
+ const snapshot = await generateRepoSnapshot(projectDir);
15
+ const snapshotEntry = createSnapshotArtifact(snapshot, artifactManager, 'INTAKE');
16
+ artifacts.push(snapshotEntry);
17
+ pipeline.latestRepoSnapshot = artifactManager.toArtifactRef(snapshotEntry);
18
+ // 2. Create constitution artifact and store hash
19
+ const constitutionEntry = createConstitutionArtifact(projectDir, artifactManager);
20
+ if (constitutionEntry) {
21
+ artifacts.push(constitutionEntry);
22
+ }
23
+ pipeline.constitutionHash = computeConstitutionHash(projectDir);
24
+ // 3. Store additional_context artifact if session guidance provided
25
+ const guidance = pipeline.sessionGuidance ?? '';
26
+ if (guidance) {
27
+ const ctxEntry = artifactManager.createAndStoreText('additional_context', guidance, 'INTAKE');
28
+ artifacts.push(ctxEntry);
29
+ }
30
+ // 4. Expand idea using existing workflow
31
+ const { expandIdea, createPlan } = await import('../../workflow/plan-mode.js');
32
+ const expandedIdea = await expandIdea(context.state.specification ?? context.state.idea ?? '', context.state.language);
33
+ // 5. Create master plan — prepend guidance so planner sees constraints first
34
+ const planInput = guidance
35
+ ? `${guidance}\n\n---\n\n${expandedIdea}`
36
+ : expandedIdea;
37
+ const plan = await createPlan(planInput, '', context.state.language);
38
+ // 6. Store master plan as artifact
39
+ const planEntry = artifactManager.createAndStoreText('master_plan', plan, 'INTAKE');
40
+ artifacts.push(planEntry);
41
+ pipeline.artifacts.push(...artifacts);
42
+ return successResult('INTAKE', artifacts, 'Master Plan v1 created');
43
+ }
44
+ catch (err) {
45
+ const message = err instanceof Error ? err.message : 'Unknown error during intake';
46
+ return failureResult('INTAKE', 'Failed to create master plan', message);
47
+ }
48
+ }
49
+ //# sourceMappingURL=intake.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intake.js","sourceRoot":"","sources":["../../../src/pipeline/phases/intake.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AACnF,OAAO,EAAE,0BAA0B,EAAE,uBAAuB,EAA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O,CAAC,KAAK,CAAC,QAAQ,CACvB,CAAC;QAEF,6EAA6E;QAC7E,MAAM,SAAS,GAAG,QAAQ;YACxB,CAAC,CAAC,GAAG,QAAQ,cAAc,YAAY,EAAE;YACzC,CAAC,CAAC,YAAY,CAAC;QACjB,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,SAAS,EAAE,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAErE,mCAAmC;QACnC,MAAM,SAAS,GAAG,eAAe,CAAC,kBAAkB,CAClD,aAAa,EACb,IAAI,EACJ,QAAQ,CACT,CAAC;QACF,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC1B,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC;QAEtC,OAAO,aAAa,CAAC,QAAQ,EAAE,SAAS,EAAE,wBAAwB,CAAC,CAAC;IACtE,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,6BAA6B,CAAC;QACnF,OAAO,aAAa,CAAC,QAAQ,EAAE,8BAA8B,EAAE,OAAO,CAAC,CAAC;IAC1E,CAAC;AACH,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Shared PhaseContext type and helpers for all phase implementations.
3
+ */
4
+ import type { PipelinePhase, PipelineState, ArtifactEntry } from '../types.js';
5
+ import type { ArtifactManager } from '../artifact-manager.js';
6
+ import type { GateEngine } from '../gate-engine.js';
7
+ import type { SkillLoader } from '../skill-loader.js';
8
+ import type { ConsensusRunner } from '../consensus/consensus-runner.js';
9
+ import type { ProjectState } from '../../types/workflow.js';
10
+ export interface PhaseContext {
11
+ state: ProjectState;
12
+ pipeline: PipelineState;
13
+ projectDir: string;
14
+ skillLoader: SkillLoader;
15
+ artifactManager: ArtifactManager;
16
+ gateEngine: GateEngine;
17
+ consensusRunner: ConsensusRunner;
18
+ }
19
+ export interface PhaseResult {
20
+ phase: PipelinePhase;
21
+ success: boolean;
22
+ artifacts: ArtifactEntry[];
23
+ message: string;
24
+ error?: string;
25
+ }
26
+ /** Trigger journalist after consensus/audit/production phases */
27
+ export declare function triggerJournalist(phase: PipelinePhase, artifacts: ArtifactEntry[], context: PhaseContext): Promise<ArtifactEntry | null>;
28
+ export declare function successResult(phase: PipelinePhase, artifacts: ArtifactEntry[], message: string): PhaseResult;
29
+ export declare function failureResult(phase: PipelinePhase, message: string, error?: string): PhaseResult;
30
+ //# sourceMappingURL=phase-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phase-context.d.ts","sourceRoot":"","sources":["../../../src/pipeline/phases/phase-context.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAI5D,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,YAAY,CAAC;IACpB,QAAQ,EAAE,aAAa,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,WAAW,CAAC;IACzB,eAAe,EAAE,eAAe,CAAC;IACjC,UAAU,EAAE,UAAU,CAAC;IACvB,eAAe,EAAE,eAAe,CAAC;CAClC;AAID,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,aAAa,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAID,iEAAiE;AACjE,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,aAAa,EACpB,SAAS,EAAE,aAAa,EAAE,EAC1B,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CA2B/B;AAID,wBAAgB,aAAa,CAC3B,KAAK,EAAE,aAAa,EACpB,SAAS,EAAE,aAAa,EAAE,EAC1B,OAAO,EAAE,MAAM,GACd,WAAW,CAEb;AAED,wBAAgB,aAAa,CAC3B,KAAK,EAAE,aAAa,EACpB,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,MAAM,GACb,WAAW,CAEb"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Shared PhaseContext type and helpers for all phase implementations.
3
+ */
4
+ // ─── Journalist Helper (P1-F) ────────────────────────────
5
+ /** Trigger journalist after consensus/audit/production phases */
6
+ export async function triggerJournalist(phase, artifacts, context) {
7
+ const skill = context.skillLoader.loadSkill('JOURNALIST');
8
+ const traceContent = [
9
+ `# Journalist Trace — ${phase}`,
10
+ ``,
11
+ `**Timestamp:** ${new Date().toISOString()}`,
12
+ `**Phase:** ${phase}`,
13
+ ``,
14
+ `## Artifacts Recorded`,
15
+ ``,
16
+ ...artifacts.map((a) => `- [${a.type}] v${a.version}: ${a.path}`),
17
+ ``,
18
+ `## Skill: ${skill.role}`,
19
+ `${skill.systemPrompt.slice(0, 200)}...`,
20
+ ].join('\n');
21
+ const entry = context.artifactManager.createAndStoreText('journalist_trace', traceContent, phase);
22
+ // Update INDEX.md with all current artifacts
23
+ context.artifactManager.updateIndex(context.pipeline.artifacts);
24
+ return entry;
25
+ }
26
+ // ─── Phase Result Helpers ────────────────────────────────
27
+ export function successResult(phase, artifacts, message) {
28
+ return { phase, success: true, artifacts, message };
29
+ }
30
+ export function failureResult(phase, message, error) {
31
+ return { phase, success: false, artifacts: [], message, error };
32
+ }
33
+ //# sourceMappingURL=phase-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phase-context.js","sourceRoot":"","sources":["../../../src/pipeline/phases/phase-context.ts"],"names":[],"mappings":"AAAA;;GAEG;AA+BH,4DAA4D;AAE5D,iEAAiE;AACjE,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,KAAoB,EACpB,SAA0B,EAC1B,OAAqB;IAErB,MAAM,KAAK,GAAG,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;IAE1D,MAAM,YAAY,GAAG;QACnB,wBAAwB,KAAK,EAAE;QAC/B,EAAE;QACF,kBAAkB,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE;QAC5C,cAAc,KAAK,EAAE;QACrB,EAAE;QACF,uBAAuB;QACvB,EAAE;QACF,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;QACjE,EAAE;QACF,aAAa,KAAK,CAAC,IAAI,EAAE;QACzB,GAAG,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,KAAK;KACzC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEb,MAAM,KAAK,GAAG,OAAO,CAAC,eAAe,CAAC,kBAAkB,CACtD,kBAAkB,EAClB,YAAY,EACZ,KAAK,CACN,CAAC;IAEF,6CAA6C;IAC7C,OAAO,CAAC,eAAe,CAAC,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAEhE,OAAO,KAAK,CAAC;AACf,CAAC;AAED,4DAA4D;AAE5D,MAAM,UAAU,aAAa,CAC3B,KAAoB,EACpB,SAA0B,EAC1B,OAAe;IAEf,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,aAAa,CAC3B,KAAoB,EACpB,OAAe,EACf,KAAc;IAEd,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AAClE,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * PRODUCTION_GATE phase — binary PASS/FAIL production-ready decision.
3
+ * Uses commandResolver + checkRunner. Runs placeholder scan (P2-2).
4
+ * v1.1: Adds start check and env check.
5
+ */
6
+ import type { PhaseContext, PhaseResult } from './phase-context.js';
7
+ export declare function runProductionGate(context: PhaseContext): Promise<PhaseResult>;
8
+ //# sourceMappingURL=production-gate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"production-gate.d.ts","sourceRoot":"","sources":["../../../src/pipeline/phases/production-gate.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAMpE,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CA2FnF"}
@@ -0,0 +1,84 @@
1
+ /**
2
+ * PRODUCTION_GATE phase — binary PASS/FAIL production-ready decision.
3
+ * Uses commandResolver + checkRunner. Runs placeholder scan (P2-2).
4
+ * v1.1: Adds start check and env check.
5
+ */
6
+ import { successResult, failureResult, triggerJournalist } from './phase-context.js';
7
+ import { resolveCommands } from '../command-resolver.js';
8
+ import { runAllChecks, runPlaceholderScan, runStartCheck, runEnvCheck, storeCheckResults } from '../check-runner.js';
9
+ import { generateRepoSnapshot } from '../repo-snapshot.js';
10
+ export async function runProductionGate(context) {
11
+ const { pipeline, artifactManager, projectDir } = context;
12
+ const artifacts = [];
13
+ try {
14
+ // 1. Resolve commands from snapshot
15
+ const snapshot = await generateRepoSnapshot(projectDir);
16
+ const commands = resolveCommands(snapshot);
17
+ pipeline.resolvedCommands = commands;
18
+ // 2. Run all checks
19
+ const checkResults = await runAllChecks(commands, projectDir);
20
+ // 3. Run placeholder scan (P2-2)
21
+ const placeholderResult = runPlaceholderScan(projectDir);
22
+ checkResults.push(placeholderResult);
23
+ // 4. Run env check (v1.1)
24
+ const envResult = runEnvCheck(projectDir, snapshot);
25
+ checkResults.push(envResult);
26
+ // 5. Run start check if start command exists (v1.1)
27
+ if (commands.start) {
28
+ const startResult = await runStartCheck(commands.start, projectDir, {
29
+ port: snapshot.ports_entrypoints[0]?.port,
30
+ });
31
+ checkResults.push(startResult);
32
+ }
33
+ // 6. Store check results as artifacts
34
+ const checkArtifacts = storeCheckResults(checkResults, artifactManager, 'PRODUCTION_GATE');
35
+ artifacts.push(...checkArtifacts);
36
+ // 7. Store in pipeline gate checks
37
+ pipeline.gateChecks['PRODUCTION_GATE'] = checkResults;
38
+ // 8. Determine PASS/FAIL
39
+ const failedChecks = checkResults.filter((r) => r.status === 'fail' && r.check_type !== 'placeholder_scan');
40
+ const hasPlaceholders = placeholderResult.status === 'fail';
41
+ const auditPassed = pipeline.artifacts.some((a) => a.type === 'audit_report');
42
+ const passed = failedChecks.length === 0 && auditPassed;
43
+ // 9. Create production readiness report
44
+ const report = [
45
+ '# Production Readiness Report',
46
+ '',
47
+ `**Timestamp:** ${new Date().toISOString()}`,
48
+ `**Verdict:** ${passed ? 'PASS' : 'FAIL'}`,
49
+ '',
50
+ '## Check Results',
51
+ '',
52
+ ...checkResults.map((r) => `- **${r.check_type}**: ${r.status} ${r.duration_ms > 0 ? `(${r.duration_ms}ms)` : ''}`),
53
+ '',
54
+ hasPlaceholders ? '## Warning: Placeholder content detected\n' + (placeholderResult.stderr_summary ?? '') : '',
55
+ '',
56
+ '## Gate Status',
57
+ `- Build: ${findCheckStatus(checkResults, 'build')}`,
58
+ `- Tests: ${findCheckStatus(checkResults, 'test')}`,
59
+ `- Lint: ${findCheckStatus(checkResults, 'lint')}`,
60
+ `- Typecheck: ${findCheckStatus(checkResults, 'typecheck')}`,
61
+ `- Env: ${findCheckStatus(checkResults, 'env_check')}`,
62
+ `- Start: ${findCheckStatus(checkResults, 'start')}`,
63
+ `- Audit: ${auditPassed ? 'PASS' : 'MISSING'}`,
64
+ `- Placeholders: ${hasPlaceholders ? 'WARNING' : 'CLEAN'}`,
65
+ ].join('\n');
66
+ const reportEntry = artifactManager.createAndStoreText('production_readiness', report, 'PRODUCTION_GATE');
67
+ artifacts.push(reportEntry);
68
+ pipeline.artifacts.push(...artifacts);
69
+ // 10. Journalist trigger
70
+ await triggerJournalist('PRODUCTION_GATE', artifacts, context);
71
+ return successResult('PRODUCTION_GATE', artifacts, passed ? 'Production Gate PASS' : `Production Gate FAIL: ${failedChecks.length} failed checks`);
72
+ }
73
+ catch (err) {
74
+ const message = err instanceof Error ? err.message : 'Unknown error';
75
+ return failureResult('PRODUCTION_GATE', 'Production gate failed', message);
76
+ }
77
+ }
78
+ function findCheckStatus(results, type) {
79
+ const r = results.find((c) => c.check_type === type);
80
+ if (!r)
81
+ return 'SKIP';
82
+ return r.status.toUpperCase();
83
+ }
84
+ //# sourceMappingURL=production-gate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"production-gate.js","sourceRoot":"","sources":["../../../src/pipeline/phases/production-gate.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACrF,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,aAAa,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACrH,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,OAAqB;IAC3D,MAAM,EAAE,QAAQ,EAAE,eAAe,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;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phase — execute QA plan and validate critical paths.
3
+ * Runs tests via checkRunner. Creates qa_validation artifact.
4
+ */
5
+ import type { PhaseContext, PhaseResult } from './phase-context.js';
6
+ export declare function runQaValidation(context: PhaseContext): Promise<PhaseResult>;
7
+ //# sourceMappingURL=qa-validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qa-validation.d.ts","sourceRoot":"","sources":["../../../src/pipeline/phases/qa-validation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAMpE,wBAAsB,eAAe,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAmDjF"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * QA_VALIDATION phase — execute QA plan and validate critical paths.
3
+ * Runs tests via checkRunner. Creates qa_validation artifact.
4
+ */
5
+ import { successResult, failureResult } from './phase-context.js';
6
+ import { resolveCommands } from '../command-resolver.js';
7
+ import { runCheck, storeCheckResults } from '../check-runner.js';
8
+ import { generateRepoSnapshot } from '../repo-snapshot.js';
9
+ export async function runQaValidation(context) {
10
+ const { pipeline, artifactManager, projectDir } = context;
11
+ const artifacts = [];
12
+ try {
13
+ // 1. Resolve test command
14
+ const snapshot = await generateRepoSnapshot(projectDir);
15
+ const commands = resolveCommands(snapshot);
16
+ pipeline.resolvedCommands = commands;
17
+ // 2. Run test command
18
+ if (commands.test) {
19
+ const testResult = await runCheck('test', commands.test, projectDir);
20
+ const stored = storeCheckResults([testResult], artifactManager, 'QA_VALIDATION');
21
+ artifacts.push(...stored);
22
+ // Store in pipeline gate checks
23
+ if (!pipeline.gateChecks['QA_VALIDATION']) {
24
+ pipeline.gateChecks['QA_VALIDATION'] = [];
25
+ }
26
+ pipeline.gateChecks['QA_VALIDATION'].push(testResult);
27
+ }
28
+ // 3. Create QA validation summary artifact
29
+ const qaReport = [
30
+ '# QA Validation Report',
31
+ '',
32
+ `**Timestamp:** ${new Date().toISOString()}`,
33
+ `**Test Command:** ${commands.test ?? 'none'}`,
34
+ `**Test Status:** ${pipeline.gateChecks['QA_VALIDATION']?.[0]?.status ?? 'skip'}`,
35
+ '',
36
+ '## Results',
37
+ '',
38
+ pipeline.gateChecks['QA_VALIDATION']?.map((r) => `- ${r.check_type}: ${r.status} (${r.duration_ms}ms)`).join('\n') ?? 'No checks run',
39
+ ].join('\n');
40
+ const qaEntry = artifactManager.createAndStoreText('qa_validation', qaReport, 'QA_VALIDATION');
41
+ artifacts.push(qaEntry);
42
+ pipeline.artifacts.push(...artifacts);
43
+ return successResult('QA_VALIDATION', artifacts, 'QA validation complete');
44
+ }
45
+ catch (err) {
46
+ const message = err instanceof Error ? err.message : 'Unknown error';
47
+ return failureResult('QA_VALIDATION', 'QA validation failed', message);
48
+ }
49
+ }
50
+ //# sourceMappingURL=qa-validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qa-validation.js","sourceRoot":"","sources":["../../../src/pipeline/phases/qa-validation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,OAAqB;IACzD,MAAM,EAAE,QAAQ,EAAE,eAAe,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAC1D,MAAM,SAAS,GAAG,EAAE,CAAC;IAErB,IAAI,CAAC;QACH,0BAA0B;QAC1B,MAAM,QAAQ,GAAG,MAAM,oBAAoB,CAAC,UAAU,CAAC,CAAC;QACxD,MAAM,QAAQ,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;QAC3C,QAAQ,CAAC,g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e,CAChB,CAAC;QACF,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAExB,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC;QACtC,OAAO,aAAa,CAAC,eAAe,EAAE,SAAS,EAAE,wBAAwB,CAAC,CAAC;IAC7E,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;QACrE,OAAO,aAAa,CAAC,eAAe,EAAE,sBAAsB,EAAE,OAAO,CAAC,CAAC;IACzE,CAAC;AACH,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * RECOVERY_LOOP phase — self-heal using RCA, not guesswork.
3
+ * Routes via requires_phase_rewind_to (P1-3). Max 5 iterations.
4
+ */
5
+ import type { PhaseContext, PhaseResult } from './phase-context.js';
6
+ export declare function runRecoveryLoop(context: PhaseContext): Promise<PhaseResult>;
7
+ //# sourceMappingURL=recovery-loop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recovery-loop.d.ts","sourceRoot":"","sources":["../../../src/pipeline/phases/recovery-loop.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAIpE,wBAAsB,eAAe,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAwFjF"}
@@ -0,0 +1,93 @@
1
+ /**
2
+ * RECOVERY_LOOP phase — self-heal using RCA, not guesswork.
3
+ * Routes via requires_phase_rewind_to (P1-3). Max 5 iterations.
4
+ */
5
+ import { successResult, failureResult, triggerJournalist } from './phase-context.js';
6
+ import { buildRCAPacket } from '../packets/rca-packet-builder.js';
7
+ export async function runRecoveryLoop(context) {
8
+ const { pipeline, artifactManager, skillLoader } = context;
9
+ const artifacts = [];
10
+ try {
11
+ // 1. Load debugger skill
12
+ const debuggerSkill = skillLoader.loadSkill('DEBUGGER');
13
+ // 2. Gather failure evidence
14
+ const failedPhase = pipeline.failedPhase;
15
+ const failedGateResult = failedPhase ? pipeline.gateResults[failedPhase] : undefined;
16
+ const failedChecks = failedPhase ? pipeline.gateChecks[failedPhase] ?? [] : [];
17
+ const failureEvidence = [
18
+ `Failed phase: ${failedPhase ?? 'unknown'}`,
19
+ failedGateResult
20
+ ? `Gate blockers: ${failedGateResult.blockers.join(', ')}`
21
+ : 'No gate result available',
22
+ failedChecks.length > 0
23
+ ? `Failed checks: ${failedChecks.filter((c) => c.status === 'fail').map((c) => `${c.check_type}: ${c.stderr_summary?.slice(0, 200) ?? 'no details'}`).join('; ')}`
24
+ : 'No check failures',
25
+ ].join('\n');
26
+ // 3. Generate RCA via Claude with Debugger skill
27
+ const { executePrompt } = await import('../../adapters/claude.js');
28
+ const guidance = pipeline.sessionGuidance;
29
+ const rcaPrompt = [
30
+ debuggerSkill.systemPrompt,
31
+ '',
32
+ ...(guidance ? ['## User Guidance', guidance, ''] : []),
33
+ '## Failure Evidence',
34
+ failureEvidence,
35
+ '',
36
+ '## Instructions',
37
+ 'Produce a Root Cause Analysis:',
38
+ '1. Precise root cause',
39
+ '2. Origin phase',
40
+ '3. Responsible role',
41
+ '4. Corrective actions',
42
+ '5. Whether phase rewind is needed (and to which phase)',
43
+ '6. Prevention recommendation',
44
+ ].join('\n');
45
+ const rcaResult = await executePrompt(rcaPrompt);
46
+ const rcaResponse = rcaResult.response;
47
+ // 4. Build RCA packet
48
+ const rcaPacket = buildRCAPacket({
49
+ incidentSummary: `Gate failure at ${failedPhase ?? 'unknown'} (recovery iteration ${pipeline.recoveryCount})`,
50
+ symptoms: failedGateResult?.blockers ?? ['Gate failed'],
51
+ rootCause: rcaResponse.slice(0, 500),
52
+ responsibleLayer: failedPhase ?? 'IMPLEMENTATION',
53
+ originPhase: failedPhase ?? 'IMPLEMENTATION',
54
+ governanceGap: 'Detected during gate evaluation',
55
+ correctiveActions: ['See RCA report for details'],
56
+ prevention: 'See RCA report for details',
57
+ rewindTo: determineRewindTarget(rcaResponse, failedPhase),
58
+ });
59
+ // 5. Store RCA as artifacts
60
+ const rcaJsonEntry = artifactManager.createAndStoreJson('rca_report', rcaPacket, 'RECOVERY_LOOP');
61
+ artifacts.push(rcaJsonEntry);
62
+ const rcaTextEntry = artifactManager.createAndStoreText('rca_report', `# RCA Report\n\n${rcaResponse}`, 'RECOVERY_LOOP');
63
+ artifacts.push(rcaTextEntry);
64
+ pipeline.artifacts.push(...artifacts);
65
+ // 6. Journalist trigger
66
+ await triggerJournalist('RECOVERY_LOOP', artifacts, context);
67
+ return successResult('RECOVERY_LOOP', artifacts, `RCA complete: recovery iteration ${pipeline.recoveryCount}`);
68
+ }
69
+ catch (err) {
70
+ const message = err instanceof Error ? err.message : 'Unknown error';
71
+ return failureResult('RECOVERY_LOOP', 'Recovery loop failed', message);
72
+ }
73
+ }
74
+ /** Determine rewind target from RCA response */
75
+ function determineRewindTarget(_rcaResponse, failedPhase) {
76
+ // If the failure was in production gate or audit, rewind to implementation
77
+ if (failedPhase === 'PRODUCTION_GATE' || failedPhase === 'AUDIT') {
78
+ return 'IMPLEMENTATION';
79
+ }
80
+ // If in QA, rewind to implementation
81
+ if (failedPhase === 'QA_VALIDATION') {
82
+ return 'IMPLEMENTATION';
83
+ }
84
+ // For consensus failures, rewind to the phase being validated
85
+ if (failedPhase === 'CONSENSUS_MASTER_PLAN')
86
+ return 'INTAKE';
87
+ if (failedPhase === 'CONSENSUS_ARCHITECTURE')
88
+ return 'ARCHITECTURE';
89
+ if (failedPhase === 'CONSENSUS_ROLE_PLANS')
90
+ return 'ROLE_PLANNING';
91
+ return undefined;
92
+ }
93
+ //# sourceMappingURL=recovery-loop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recovery-loop.js","sourceRoot":"","sources":["../../../src/pipeline/phases/recovery-loop.ts"],"names":[],"mappings":"AAAA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AsB;QAAE,OAAO,eAAe,CAAC;IAEnE,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * REVIEW phase — verify implementation matches approved plans.
3
+ * Detects drift via snapshot diff (P1-E).
4
+ * v1.1: Creates Change Requests when drift is detected.
5
+ */
6
+ import type { PhaseContext, PhaseResult } from './phase-context.js';
7
+ export declare function runReview(context: PhaseContext): Promise<PhaseResult>;
8
+ //# sourceMappingURL=review.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"review.d.ts","sourceRoot":"","sources":["../../../src/pipeline/phases/review.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAQpE,wBAAsB,SAAS,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAsI3E"}