popeye-cli 1.10.0 → 2.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 (253) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/CONTRIBUTING.md +15 -1
  3. package/README.md +57 -0
  4. package/dist/pipeline/artifact-manager.d.ts +47 -0
  5. package/dist/pipeline/artifact-manager.d.ts.map +1 -0
  6. package/dist/pipeline/artifact-manager.js +251 -0
  7. package/dist/pipeline/artifact-manager.js.map +1 -0
  8. package/dist/pipeline/artifact-validators.d.ts +29 -0
  9. package/dist/pipeline/artifact-validators.d.ts.map +1 -0
  10. package/dist/pipeline/artifact-validators.js +173 -0
  11. package/dist/pipeline/artifact-validators.js.map +1 -0
  12. package/dist/pipeline/change-request.d.ts +47 -0
  13. package/dist/pipeline/change-request.d.ts.map +1 -0
  14. package/dist/pipeline/change-request.js +91 -0
  15. package/dist/pipeline/change-request.js.map +1 -0
  16. package/dist/pipeline/check-runner.d.ts +47 -0
  17. package/dist/pipeline/check-runner.d.ts.map +1 -0
  18. package/dist/pipeline/check-runner.js +417 -0
  19. package/dist/pipeline/check-runner.js.map +1 -0
  20. package/dist/pipeline/command-resolver.d.ts +9 -0
  21. package/dist/pipeline/command-resolver.d.ts.map +1 -0
  22. package/dist/pipeline/command-resolver.js +140 -0
  23. package/dist/pipeline/command-resolver.js.map +1 -0
  24. package/dist/pipeline/consensus/consensus-runner.d.ts +44 -0
  25. package/dist/pipeline/consensus/consensus-runner.d.ts.map +1 -0
  26. package/dist/pipeline/consensus/consensus-runner.js +212 -0
  27. package/dist/pipeline/consensus/consensus-runner.js.map +1 -0
  28. package/dist/pipeline/constitution.d.ts +45 -0
  29. package/dist/pipeline/constitution.d.ts.map +1 -0
  30. package/dist/pipeline/constitution.js +82 -0
  31. package/dist/pipeline/constitution.js.map +1 -0
  32. package/dist/pipeline/gate-engine.d.ts +55 -0
  33. package/dist/pipeline/gate-engine.d.ts.map +1 -0
  34. package/dist/pipeline/gate-engine.js +270 -0
  35. package/dist/pipeline/gate-engine.js.map +1 -0
  36. package/dist/pipeline/index.d.ts +26 -0
  37. package/dist/pipeline/index.d.ts.map +1 -0
  38. package/dist/pipeline/index.js +35 -0
  39. package/dist/pipeline/index.js.map +1 -0
  40. package/dist/pipeline/migration.d.ts +15 -0
  41. package/dist/pipeline/migration.d.ts.map +1 -0
  42. package/dist/pipeline/migration.js +76 -0
  43. package/dist/pipeline/migration.js.map +1 -0
  44. package/dist/pipeline/orchestrator.d.ts +28 -0
  45. package/dist/pipeline/orchestrator.d.ts.map +1 -0
  46. package/dist/pipeline/orchestrator.js +238 -0
  47. package/dist/pipeline/orchestrator.js.map +1 -0
  48. package/dist/pipeline/packets/audit-report-builder.d.ts +11 -0
  49. package/dist/pipeline/packets/audit-report-builder.d.ts.map +1 -0
  50. package/dist/pipeline/packets/audit-report-builder.js +32 -0
  51. package/dist/pipeline/packets/audit-report-builder.js.map +1 -0
  52. package/dist/pipeline/packets/consensus-packet-builder.d.ts +35 -0
  53. package/dist/pipeline/packets/consensus-packet-builder.d.ts.map +1 -0
  54. package/dist/pipeline/packets/consensus-packet-builder.js +80 -0
  55. package/dist/pipeline/packets/consensus-packet-builder.js.map +1 -0
  56. package/dist/pipeline/packets/index.d.ts +12 -0
  57. package/dist/pipeline/packets/index.d.ts.map +1 -0
  58. package/dist/pipeline/packets/index.js +8 -0
  59. package/dist/pipeline/packets/index.js.map +1 -0
  60. package/dist/pipeline/packets/plan-packet-builder.d.ts +21 -0
  61. package/dist/pipeline/packets/plan-packet-builder.d.ts.map +1 -0
  62. package/dist/pipeline/packets/plan-packet-builder.js +27 -0
  63. package/dist/pipeline/packets/plan-packet-builder.js.map +1 -0
  64. package/dist/pipeline/packets/rca-packet-builder.d.ts +19 -0
  65. package/dist/pipeline/packets/rca-packet-builder.d.ts.map +1 -0
  66. package/dist/pipeline/packets/rca-packet-builder.js +22 -0
  67. package/dist/pipeline/packets/rca-packet-builder.js.map +1 -0
  68. package/dist/pipeline/phases/architecture.d.ts +7 -0
  69. package/dist/pipeline/phases/architecture.d.ts.map +1 -0
  70. package/dist/pipeline/phases/architecture.js +60 -0
  71. package/dist/pipeline/phases/architecture.js.map +1 -0
  72. package/dist/pipeline/phases/audit.d.ts +8 -0
  73. package/dist/pipeline/phases/audit.d.ts.map +1 -0
  74. package/dist/pipeline/phases/audit.js +144 -0
  75. package/dist/pipeline/phases/audit.js.map +1 -0
  76. package/dist/pipeline/phases/consensus-architecture.d.ts +7 -0
  77. package/dist/pipeline/phases/consensus-architecture.d.ts.map +1 -0
  78. package/dist/pipeline/phases/consensus-architecture.js +84 -0
  79. package/dist/pipeline/phases/consensus-architecture.js.map +1 -0
  80. package/dist/pipeline/phases/consensus-master-plan.d.ts +7 -0
  81. package/dist/pipeline/phases/consensus-master-plan.d.ts.map +1 -0
  82. package/dist/pipeline/phases/consensus-master-plan.js +81 -0
  83. package/dist/pipeline/phases/consensus-master-plan.js.map +1 -0
  84. package/dist/pipeline/phases/consensus-role-plans.d.ts +7 -0
  85. package/dist/pipeline/phases/consensus-role-plans.d.ts.map +1 -0
  86. package/dist/pipeline/phases/consensus-role-plans.js +85 -0
  87. package/dist/pipeline/phases/consensus-role-plans.js.map +1 -0
  88. package/dist/pipeline/phases/done.d.ts +7 -0
  89. package/dist/pipeline/phases/done.d.ts.map +1 -0
  90. package/dist/pipeline/phases/done.js +45 -0
  91. package/dist/pipeline/phases/done.js.map +1 -0
  92. package/dist/pipeline/phases/implementation.d.ts +8 -0
  93. package/dist/pipeline/phases/implementation.d.ts.map +1 -0
  94. package/dist/pipeline/phases/implementation.js +42 -0
  95. package/dist/pipeline/phases/implementation.js.map +1 -0
  96. package/dist/pipeline/phases/index.d.ts +20 -0
  97. package/dist/pipeline/phases/index.d.ts.map +1 -0
  98. package/dist/pipeline/phases/index.js +19 -0
  99. package/dist/pipeline/phases/index.js.map +1 -0
  100. package/dist/pipeline/phases/intake.d.ts +8 -0
  101. package/dist/pipeline/phases/intake.d.ts.map +1 -0
  102. package/dist/pipeline/phases/intake.js +40 -0
  103. package/dist/pipeline/phases/intake.js.map +1 -0
  104. package/dist/pipeline/phases/phase-context.d.ts +30 -0
  105. package/dist/pipeline/phases/phase-context.d.ts.map +1 -0
  106. package/dist/pipeline/phases/phase-context.js +33 -0
  107. package/dist/pipeline/phases/phase-context.js.map +1 -0
  108. package/dist/pipeline/phases/production-gate.d.ts +8 -0
  109. package/dist/pipeline/phases/production-gate.d.ts.map +1 -0
  110. package/dist/pipeline/phases/production-gate.js +84 -0
  111. package/dist/pipeline/phases/production-gate.js.map +1 -0
  112. package/dist/pipeline/phases/qa-validation.d.ts +7 -0
  113. package/dist/pipeline/phases/qa-validation.d.ts.map +1 -0
  114. package/dist/pipeline/phases/qa-validation.js +50 -0
  115. package/dist/pipeline/phases/qa-validation.js.map +1 -0
  116. package/dist/pipeline/phases/recovery-loop.d.ts +7 -0
  117. package/dist/pipeline/phases/recovery-loop.d.ts.map +1 -0
  118. package/dist/pipeline/phases/recovery-loop.js +91 -0
  119. package/dist/pipeline/phases/recovery-loop.js.map +1 -0
  120. package/dist/pipeline/phases/review.d.ts +8 -0
  121. package/dist/pipeline/phases/review.d.ts.map +1 -0
  122. package/dist/pipeline/phases/review.js +127 -0
  123. package/dist/pipeline/phases/review.js.map +1 -0
  124. package/dist/pipeline/phases/role-planning.d.ts +7 -0
  125. package/dist/pipeline/phases/role-planning.d.ts.map +1 -0
  126. package/dist/pipeline/phases/role-planning.js +75 -0
  127. package/dist/pipeline/phases/role-planning.js.map +1 -0
  128. package/dist/pipeline/phases/stuck.d.ts +7 -0
  129. package/dist/pipeline/phases/stuck.d.ts.map +1 -0
  130. package/dist/pipeline/phases/stuck.js +51 -0
  131. package/dist/pipeline/phases/stuck.js.map +1 -0
  132. package/dist/pipeline/repo-snapshot.d.ts +24 -0
  133. package/dist/pipeline/repo-snapshot.d.ts.map +1 -0
  134. package/dist/pipeline/repo-snapshot.js +343 -0
  135. package/dist/pipeline/repo-snapshot.js.map +1 -0
  136. package/dist/pipeline/role-execution-adapter.d.ts +59 -0
  137. package/dist/pipeline/role-execution-adapter.d.ts.map +1 -0
  138. package/dist/pipeline/role-execution-adapter.js +159 -0
  139. package/dist/pipeline/role-execution-adapter.js.map +1 -0
  140. package/dist/pipeline/skill-loader.d.ts +34 -0
  141. package/dist/pipeline/skill-loader.d.ts.map +1 -0
  142. package/dist/pipeline/skill-loader.js +156 -0
  143. package/dist/pipeline/skill-loader.js.map +1 -0
  144. package/dist/pipeline/skills/defaults.d.ts +16 -0
  145. package/dist/pipeline/skills/defaults.d.ts.map +1 -0
  146. package/dist/pipeline/skills/defaults.js +189 -0
  147. package/dist/pipeline/skills/defaults.js.map +1 -0
  148. package/dist/pipeline/type-defs/artifacts.d.ts +202 -0
  149. package/dist/pipeline/type-defs/artifacts.d.ts.map +1 -0
  150. package/dist/pipeline/type-defs/artifacts.js +66 -0
  151. package/dist/pipeline/type-defs/artifacts.js.map +1 -0
  152. package/dist/pipeline/type-defs/audit.d.ts +256 -0
  153. package/dist/pipeline/type-defs/audit.d.ts.map +1 -0
  154. package/dist/pipeline/type-defs/audit.js +54 -0
  155. package/dist/pipeline/type-defs/audit.js.map +1 -0
  156. package/dist/pipeline/type-defs/checks.d.ts +81 -0
  157. package/dist/pipeline/type-defs/checks.d.ts.map +1 -0
  158. package/dist/pipeline/type-defs/checks.js +38 -0
  159. package/dist/pipeline/type-defs/checks.js.map +1 -0
  160. package/dist/pipeline/type-defs/enums.d.ts +43 -0
  161. package/dist/pipeline/type-defs/enums.d.ts.map +1 -0
  162. package/dist/pipeline/type-defs/enums.js +55 -0
  163. package/dist/pipeline/type-defs/enums.js.map +1 -0
  164. package/dist/pipeline/type-defs/index.d.ts +12 -0
  165. package/dist/pipeline/type-defs/index.d.ts.map +1 -0
  166. package/dist/pipeline/type-defs/index.js +12 -0
  167. package/dist/pipeline/type-defs/index.js.map +1 -0
  168. package/dist/pipeline/type-defs/packets.d.ts +806 -0
  169. package/dist/pipeline/type-defs/packets.d.ts.map +1 -0
  170. package/dist/pipeline/type-defs/packets.js +109 -0
  171. package/dist/pipeline/type-defs/packets.js.map +1 -0
  172. package/dist/pipeline/type-defs/snapshot.d.ts +52 -0
  173. package/dist/pipeline/type-defs/snapshot.d.ts.map +1 -0
  174. package/dist/pipeline/type-defs/snapshot.js +35 -0
  175. package/dist/pipeline/type-defs/snapshot.js.map +1 -0
  176. package/dist/pipeline/type-defs/state.d.ts +449 -0
  177. package/dist/pipeline/type-defs/state.d.ts.map +1 -0
  178. package/dist/pipeline/type-defs/state.js +88 -0
  179. package/dist/pipeline/type-defs/state.js.map +1 -0
  180. package/dist/pipeline/types.d.ts +16 -0
  181. package/dist/pipeline/types.d.ts.map +1 -0
  182. package/dist/pipeline/types.js +16 -0
  183. package/dist/pipeline/types.js.map +1 -0
  184. package/dist/types/audit.d.ts +6 -6
  185. package/dist/workflow/index.d.ts.map +1 -1
  186. package/dist/workflow/index.js +48 -0
  187. package/dist/workflow/index.js.map +1 -1
  188. package/package.json +1 -1
  189. package/skills/PHASE_GATE_ENGINE_SPEC.md +113 -20
  190. package/skills/POPEYE_FULL_AUTONOMY_PIPELINE.md +66 -13
  191. package/src/pipeline/artifact-manager.ts +339 -0
  192. package/src/pipeline/artifact-validators.ts +224 -0
  193. package/src/pipeline/change-request.ts +119 -0
  194. package/src/pipeline/check-runner.ts +504 -0
  195. package/src/pipeline/command-resolver.ts +168 -0
  196. package/src/pipeline/consensus/consensus-runner.ts +317 -0
  197. package/src/pipeline/constitution.ts +109 -0
  198. package/src/pipeline/gate-engine.ts +347 -0
  199. package/src/pipeline/index.ts +82 -0
  200. package/src/pipeline/migration.ts +91 -0
  201. package/src/pipeline/orchestrator.ts +314 -0
  202. package/src/pipeline/packets/audit-report-builder.ts +47 -0
  203. package/src/pipeline/packets/consensus-packet-builder.ts +112 -0
  204. package/src/pipeline/packets/index.ts +15 -0
  205. package/src/pipeline/packets/plan-packet-builder.ts +52 -0
  206. package/src/pipeline/packets/rca-packet-builder.ts +38 -0
  207. package/src/pipeline/phases/architecture.ts +73 -0
  208. package/src/pipeline/phases/audit.ts +193 -0
  209. package/src/pipeline/phases/consensus-architecture.ts +104 -0
  210. package/src/pipeline/phases/consensus-master-plan.ts +100 -0
  211. package/src/pipeline/phases/consensus-role-plans.ts +105 -0
  212. package/src/pipeline/phases/done.ts +68 -0
  213. package/src/pipeline/phases/implementation.ts +48 -0
  214. package/src/pipeline/phases/index.ts +21 -0
  215. package/src/pipeline/phases/intake.ts +54 -0
  216. package/src/pipeline/phases/phase-context.ts +86 -0
  217. package/src/pipeline/phases/production-gate.ts +113 -0
  218. package/src/pipeline/phases/qa-validation.ts +63 -0
  219. package/src/pipeline/phases/recovery-loop.ts +118 -0
  220. package/src/pipeline/phases/review.ts +149 -0
  221. package/src/pipeline/phases/role-planning.ts +92 -0
  222. package/src/pipeline/phases/stuck.ts +62 -0
  223. package/src/pipeline/repo-snapshot.ts +395 -0
  224. package/src/pipeline/role-execution-adapter.ts +238 -0
  225. package/src/pipeline/skill-loader.ts +192 -0
  226. package/src/pipeline/skills/defaults.ts +215 -0
  227. package/src/pipeline/type-defs/artifacts.ts +81 -0
  228. package/src/pipeline/type-defs/audit.ts +67 -0
  229. package/src/pipeline/type-defs/checks.ts +47 -0
  230. package/src/pipeline/type-defs/enums.ts +62 -0
  231. package/src/pipeline/type-defs/index.ts +12 -0
  232. package/src/pipeline/type-defs/packets.ts +131 -0
  233. package/src/pipeline/type-defs/snapshot.ts +55 -0
  234. package/src/pipeline/type-defs/state.ts +165 -0
  235. package/src/pipeline/types.ts +16 -0
  236. package/src/workflow/index.ts +48 -0
  237. package/tests/pipeline/artifact-manager.test.ts +183 -0
  238. package/tests/pipeline/artifact-validators.test.ts +207 -0
  239. package/tests/pipeline/change-request.test.ts +180 -0
  240. package/tests/pipeline/check-runner.test.ts +157 -0
  241. package/tests/pipeline/command-resolver.test.ts +159 -0
  242. package/tests/pipeline/consensus-runner.test.ts +206 -0
  243. package/tests/pipeline/consensus-scoring.test.ts +163 -0
  244. package/tests/pipeline/constitution.test.ts +122 -0
  245. package/tests/pipeline/gate-engine.test.ts +195 -0
  246. package/tests/pipeline/migration.test.ts +133 -0
  247. package/tests/pipeline/orchestrator.test.ts +614 -0
  248. package/tests/pipeline/packets/builders.test.ts +347 -0
  249. package/tests/pipeline/repo-snapshot.test.ts +189 -0
  250. package/tests/pipeline/role-execution-adapter.test.ts +299 -0
  251. package/tests/pipeline/skill-loader.test.ts +186 -0
  252. package/tests/pipeline/start-env-checks.test.ts +123 -0
  253. package/tests/pipeline/types.test.ts +156 -0
@@ -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,CA0C3E"}
@@ -0,0 +1,40 @@
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. Expand idea using existing workflow
25
+ const { expandIdea, createPlan } = await import('../../workflow/plan-mode.js');
26
+ const expandedIdea = await expandIdea(context.state.specification ?? context.state.idea ?? '', context.state.language);
27
+ // 4. Create master plan using existing workflow
28
+ const plan = await createPlan(expandedIdea, '', context.state.language);
29
+ // 5. Store master plan as artifact
30
+ const planEntry = artifactManager.createAndStoreText('master_plan', plan, 'INTAKE');
31
+ artifacts.push(planEntry);
32
+ pipeline.artifacts.push(...artifacts);
33
+ return successResult('INTAKE', artifacts, 'Master Plan v1 created');
34
+ }
35
+ catch (err) {
36
+ const message = err instanceof Error ? err.message : 'Unknown error during intake';
37
+ return failureResult('INTAKE', 'Failed to create master plan', message);
38
+ }
39
+ }
40
+ //# 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,EAAE,MAAM,oBAAoB,CAAC;AAEzF,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAAqB;IACnD,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC;IAC1D,MAAM,SAAS,GAAG,EAAE,CAAC;IAErB,IAAI,CAAC;QACH,4BAA4B;QAC5B,MAAM,QAAQ,GAAG,MAAM,oBAAoB,CAAC,UAAU,CAAC,CAAC;QACxD,MAAM,aAAa,GAAG,sBAAsB,CAAC,QAAQ,EAAE,eAAe,EAAE,QAAQ,CAAC,CAAC;QAClF,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC9B,QAAQ,CAAC,kBAAkB,GAAG,eAAe,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;QAE3E,iDAAiD;QACjD,MAAM,iBAAiB,GAAG,0BAA0B,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;QAClF,IAAI,iBAAiB,EAAE,CAAC;YACtB,SAAS,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QACpC,CAAC;QACD,QAAQ,CAAC,gBAAgB,GAAG,uBAAuB,CAAC,UAAU,CAAC,CAAC;QAEhE,yCAAyC;QACzC,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,MAAM,MAAM,CAAC,6BAA6B,CAAC,CAAC;QAC/E,MAAM,YAAY,GAAG,MAAM,UAAU,CACnC,OAAO,CAAC,KAAK,CAAC,aAAa,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,EACvD,OAAO,CAAC,KAAK,CAAC,QAAQ,CACvB,CAAC;QAEF,gDAAgD;QAChD,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,YAAY,EAAE,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAExE,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
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U,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;IAC1D,MAAM,SAAS,GAAG,EAAE,CAAC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kRunner. 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,gBAAgB,GAAG,QAAQ,CAAC;QAErC,sBA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,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,CAsFjF"}
@@ -0,0 +1,91 @@
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 rcaPrompt = [
29
+ debuggerSkill.systemPrompt,
30
+ '',
31
+ '## Failure Evidence',
32
+ failureEvidence,
33
+ '',
34
+ '## Instructions',
35
+ 'Produce a Root Cause Analysis:',
36
+ '1. Precise root cause',
37
+ '2. Origin phase',
38
+ '3. Responsible role',
39
+ '4. Corrective actions',
40
+ '5. Whether phase rewind is needed (and to which phase)',
41
+ '6. Prevention recommendation',
42
+ ].join('\n');
43
+ const rcaResult = await executePrompt(rcaPrompt);
44
+ const rcaResponse = rcaResult.response;
45
+ // 4. Build RCA packet
46
+ const rcaPacket = buildRCAPacket({
47
+ incidentSummary: `Gate failure at ${failedPhase ?? 'unknown'} (recovery iteration ${pipeline.recoveryCount})`,
48
+ symptoms: failedGateResult?.blockers ?? ['Gate failed'],
49
+ rootCause: rcaResponse.slice(0, 500),
50
+ responsibleLayer: failedPhase ?? 'IMPLEMENTATION',
51
+ originPhase: failedPhase ?? 'IMPLEMENTATION',
52
+ governanceGap: 'Detected during gate evaluation',
53
+ correctiveActions: ['See RCA report for details'],
54
+ prevention: 'See RCA report for details',
55
+ rewindTo: determineRewindTarget(rcaResponse, failedPhase),
56
+ });
57
+ // 5. Store RCA as artifacts
58
+ const rcaJsonEntry = artifactManager.createAndStoreJson('rca_report', rcaPacket, 'RECOVERY_LOOP');
59
+ artifacts.push(rcaJsonEntry);
60
+ const rcaTextEntry = artifactManager.createAndStoreText('rca_report', `# RCA Report\n\n${rcaResponse}`, 'RECOVERY_LOOP');
61
+ artifacts.push(rcaTextEntry);
62
+ pipeline.artifacts.push(...artifacts);
63
+ // 6. Journalist trigger
64
+ await triggerJournalist('RECOVERY_LOOP', artifacts, context);
65
+ return successResult('RECOVERY_LOOP', artifacts, `RCA complete: recovery iteration ${pipeline.recoveryCount}`);
66
+ }
67
+ catch (err) {
68
+ const message = err instanceof Error ? err.message : 'Unknown error';
69
+ return failureResult('RECOVERY_LOOP', 'Recovery loop failed', message);
70
+ }
71
+ }
72
+ /** Determine rewind target from RCA response */
73
+ function determineRewindTarget(_rcaResponse, failedPhase) {
74
+ // If the failure was in production gate or audit, rewind to implementation
75
+ if (failedPhase === 'PRODUCTION_GATE' || failedPhase === 'AUDIT') {
76
+ return 'IMPLEMENTATION';
77
+ }
78
+ // If in QA, rewind to implementation
79
+ if (failedPhase === 'QA_VALIDATION') {
80
+ return 'IMPLEMENTATION';
81
+ }
82
+ // For consensus failures, rewind to the phase being validated
83
+ if (failedPhase === 'CONSENSUS_MASTER_PLAN')
84
+ return 'INTAKE';
85
+ if (failedPhase === 'CONSENSUS_ARCHITECTURE')
86
+ return 'ARCHITECTURE';
87
+ if (failedPhase === 'CONSENSUS_ROLE_PLANS')
88
+ return 'ROLE_PLANNING';
89
+ return undefined;
90
+ }
91
+ //# 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;;;GAGG;AAIH,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACrF,OAAO,EAA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C,IAAI,CAAC,YAAY,CAAC,CAAC;QAE7B,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC;QAEtC,wBAAwB;QACxB,MAAM,iBAAiB,CAAC,eAAe,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QAE7D,OAAO,aAAa,CAClB,eAAe,EACf,SAAS,EACT,oCAAoC,QAAQ,CAAC,aAAa,EAAE,CAC7D,CAAC;IACJ,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;AAED,gDAAgD;AAChD,SAAS,qBAAqB,CAC5B,YAAoB,EACpB,WAAsC;IAEtC,2EAA2E;IAC3E,IAAI,WAAW,KAAK,iBAAiB,IAAI,WAAW,KAAK,OAAO,EAAE,CAAC;QACjE,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IACD,qCAAqC;IACrC,IAAI,WAAW,KAAK,eAAe,EAAE,CAAC;QACpC,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IACD,8DAA8D;IAC9D,IAAI,WAAW,KAAK,uBAAuB;QAAE,OAAO,QAAQ,CAAC;IAC7D,IAAI,WAAW,KAAK,wBAAwB;QAAE,OAAO,cAAc,CAAC;IACpE,IAAI,WAAW,KAAK,sBAAsB;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"}
@@ -0,0 +1,127 @@
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 { successResult, failureResult } from './phase-context.js';
7
+ import { generateRepoSnapshot, createSnapshotArtifact, diffSnapshots } from '../repo-snapshot.js';
8
+ import { buildChangeRequest, formatChangeRequest, routeChangeRequest } from '../change-request.js';
9
+ import { existsSync, readFileSync } from 'node:fs';
10
+ import { join } from 'node:path';
11
+ export async function runReview(context) {
12
+ const { pipeline, artifactManager, projectDir } = context;
13
+ const artifacts = [];
14
+ const changeRequests = [];
15
+ try {
16
+ // 1. Generate fresh snapshot
17
+ const currentSnapshot = await generateRepoSnapshot(projectDir);
18
+ const snapshotEntry = createSnapshotArtifact(currentSnapshot, artifactManager, 'REVIEW');
19
+ artifacts.push(snapshotEntry);
20
+ pipeline.latestRepoSnapshot = artifactManager.toArtifactRef(snapshotEntry);
21
+ // 2. Find role-plan-approval snapshot for drift detection
22
+ const rolePlanSnapshots = pipeline.artifacts.filter((a) => a.type === 'repo_snapshot' && a.phase === 'CONSENSUS_ROLE_PLANS');
23
+ const baselineSnapshot = rolePlanSnapshots[rolePlanSnapshots.length - 1];
24
+ let driftReport = 'No baseline snapshot found for drift detection.';
25
+ let hasDrift = false;
26
+ if (baselineSnapshot) {
27
+ const baselinePath = join(projectDir, baselineSnapshot.path);
28
+ if (existsSync(baselinePath)) {
29
+ try {
30
+ const baselineData = JSON.parse(readFileSync(baselinePath, 'utf-8'));
31
+ const diff = diffSnapshots(baselineData, currentSnapshot);
32
+ if (diff.has_changes) {
33
+ hasDrift = true;
34
+ driftReport = [
35
+ '## Implementation Drift Detected',
36
+ '',
37
+ `Files delta: ${diff.files_delta > 0 ? '+' : ''}${diff.files_delta}`,
38
+ `Lines delta: ${diff.lines_delta > 0 ? '+' : ''}${diff.lines_delta}`,
39
+ diff.added_configs.length > 0 ? `Added configs: ${diff.added_configs.join(', ')}` : '',
40
+ diff.removed_configs.length > 0 ? `Removed configs: ${diff.removed_configs.join(', ')}` : '',
41
+ diff.changed_configs.length > 0 ? `Changed configs: ${diff.changed_configs.join(', ')}` : '',
42
+ ].filter(Boolean).join('\n');
43
+ // v1.1: Create change requests for detected drift
44
+ if (diff.changed_configs.length > 0) {
45
+ const cr = buildChangeRequest({
46
+ originPhase: 'REVIEW',
47
+ requestedBy: 'REVIEWER',
48
+ changeType: 'config',
49
+ description: `Config files changed during implementation: ${diff.changed_configs.join(', ')}`,
50
+ justification: 'Detected by snapshot diff during review phase',
51
+ affectedArtifacts: [artifactManager.toArtifactRef(snapshotEntry)],
52
+ affectedPhases: ['IMPLEMENTATION', 'QA_VALIDATION'],
53
+ riskLevel: diff.changed_configs.length > 3 ? 'high' : 'medium',
54
+ });
55
+ changeRequests.push(cr);
56
+ }
57
+ if (Math.abs(diff.lines_delta) > 1000) {
58
+ const cr = buildChangeRequest({
59
+ originPhase: 'REVIEW',
60
+ requestedBy: 'REVIEWER',
61
+ changeType: 'scope',
62
+ description: `Significant scope drift detected: ${diff.lines_delta > 0 ? '+' : ''}${diff.lines_delta} lines`,
63
+ justification: 'Large line delta suggests scope changes beyond approved plans',
64
+ affectedArtifacts: [artifactManager.toArtifactRef(snapshotEntry)],
65
+ affectedPhases: ['CONSENSUS_MASTER_PLAN', 'IMPLEMENTATION'],
66
+ riskLevel: 'high',
67
+ });
68
+ changeRequests.push(cr);
69
+ }
70
+ }
71
+ else {
72
+ driftReport = 'No drift detected between approved plans and implementation.';
73
+ }
74
+ }
75
+ catch {
76
+ driftReport = 'Failed to parse baseline snapshot for drift detection.';
77
+ }
78
+ }
79
+ }
80
+ // 3. Store change requests as artifacts and register in pipeline state
81
+ for (const cr of changeRequests) {
82
+ const crEntry = artifactManager.createAndStoreText('change_request', formatChangeRequest(cr), 'REVIEW');
83
+ artifacts.push(crEntry);
84
+ // Register CR in pipeline state for orchestrator routing
85
+ if (!pipeline.pendingChangeRequests) {
86
+ pipeline.pendingChangeRequests = [];
87
+ }
88
+ pipeline.pendingChangeRequests.push({
89
+ cr_id: cr.cr_id,
90
+ change_type: cr.change_type,
91
+ target_phase: routeChangeRequest(cr),
92
+ status: 'proposed',
93
+ });
94
+ }
95
+ // 4. Create review decision artifact
96
+ const reviewDoc = [
97
+ '# Review Decision',
98
+ '',
99
+ `**Timestamp:** ${new Date().toISOString()}`,
100
+ `**Phase:** REVIEW`,
101
+ `**Drift Detected:** ${hasDrift ? 'Yes' : 'No'}`,
102
+ `**Change Requests:** ${changeRequests.length}`,
103
+ '',
104
+ '## Drift Analysis',
105
+ driftReport,
106
+ '',
107
+ changeRequests.length > 0 ? '## Change Requests\n' + changeRequests.map((cr) => `- ${cr.cr_id}: ${cr.description}`).join('\n') : '',
108
+ '',
109
+ '## Plan Alignment',
110
+ 'Implementation reviewed against approved role plans.',
111
+ '',
112
+ '## Decision',
113
+ hasDrift && changeRequests.length > 0
114
+ ? 'Review flagged drift — change requests created for consensus review.'
115
+ : 'Review completed. See drift analysis above.',
116
+ ].join('\n');
117
+ const reviewEntry = artifactManager.createAndStoreText('review_decision', reviewDoc, 'REVIEW');
118
+ artifacts.push(reviewEntry);
119
+ pipeline.artifacts.push(...artifacts);
120
+ return successResult('REVIEW', artifacts, `Review complete. ${changeRequests.length} change requests.`);
121
+ }
122
+ catch (err) {
123
+ const message = err instanceof Error ? err.message : 'Unknown error';
124
+ return failureResult('REVIEW', 'Review failed', message);
125
+ }
126
+ }
127
+ //# sourceMappingURL=review.js.map