popeye-cli 1.9.5 → 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 (318) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/CONTRIBUTING.md +15 -1
  3. package/README.md +57 -0
  4. package/cheatsheet.md +65 -0
  5. package/dist/cli/commands/debug-context.d.ts +64 -0
  6. package/dist/cli/commands/debug-context.d.ts.map +1 -0
  7. package/dist/cli/commands/debug-context.js +221 -0
  8. package/dist/cli/commands/debug-context.js.map +1 -0
  9. package/dist/cli/commands/debug-prompts.d.ts +25 -0
  10. package/dist/cli/commands/debug-prompts.d.ts.map +1 -0
  11. package/dist/cli/commands/debug-prompts.js +80 -0
  12. package/dist/cli/commands/debug-prompts.js.map +1 -0
  13. package/dist/cli/commands/debug.d.ts +68 -0
  14. package/dist/cli/commands/debug.d.ts.map +1 -0
  15. package/dist/cli/commands/debug.js +543 -0
  16. package/dist/cli/commands/debug.js.map +1 -0
  17. package/dist/cli/commands/index.d.ts +1 -0
  18. package/dist/cli/commands/index.d.ts.map +1 -1
  19. package/dist/cli/commands/index.js +1 -0
  20. package/dist/cli/commands/index.js.map +1 -1
  21. package/dist/cli/index.d.ts.map +1 -1
  22. package/dist/cli/index.js +2 -1
  23. package/dist/cli/index.js.map +1 -1
  24. package/dist/cli/interactive.d.ts.map +1 -1
  25. package/dist/cli/interactive.js +25 -0
  26. package/dist/cli/interactive.js.map +1 -1
  27. package/dist/generators/all.d.ts.map +1 -1
  28. package/dist/generators/all.js +2 -0
  29. package/dist/generators/all.js.map +1 -1
  30. package/dist/generators/templates/database-docker.d.ts.map +1 -1
  31. package/dist/generators/templates/database-docker.js +10 -0
  32. package/dist/generators/templates/database-docker.js.map +1 -1
  33. package/dist/generators/templates/fullstack.d.ts +4 -1
  34. package/dist/generators/templates/fullstack.d.ts.map +1 -1
  35. package/dist/generators/templates/fullstack.js +6 -2
  36. package/dist/generators/templates/fullstack.js.map +1 -1
  37. package/dist/pipeline/artifact-manager.d.ts +47 -0
  38. package/dist/pipeline/artifact-manager.d.ts.map +1 -0
  39. package/dist/pipeline/artifact-manager.js +251 -0
  40. package/dist/pipeline/artifact-manager.js.map +1 -0
  41. package/dist/pipeline/artifact-validators.d.ts +29 -0
  42. package/dist/pipeline/artifact-validators.d.ts.map +1 -0
  43. package/dist/pipeline/artifact-validators.js +173 -0
  44. package/dist/pipeline/artifact-validators.js.map +1 -0
  45. package/dist/pipeline/change-request.d.ts +47 -0
  46. package/dist/pipeline/change-request.d.ts.map +1 -0
  47. package/dist/pipeline/change-request.js +91 -0
  48. package/dist/pipeline/change-request.js.map +1 -0
  49. package/dist/pipeline/check-runner.d.ts +47 -0
  50. package/dist/pipeline/check-runner.d.ts.map +1 -0
  51. package/dist/pipeline/check-runner.js +417 -0
  52. package/dist/pipeline/check-runner.js.map +1 -0
  53. package/dist/pipeline/command-resolver.d.ts +9 -0
  54. package/dist/pipeline/command-resolver.d.ts.map +1 -0
  55. package/dist/pipeline/command-resolver.js +140 -0
  56. package/dist/pipeline/command-resolver.js.map +1 -0
  57. package/dist/pipeline/consensus/consensus-runner.d.ts +44 -0
  58. package/dist/pipeline/consensus/consensus-runner.d.ts.map +1 -0
  59. package/dist/pipeline/consensus/consensus-runner.js +212 -0
  60. package/dist/pipeline/consensus/consensus-runner.js.map +1 -0
  61. package/dist/pipeline/constitution.d.ts +45 -0
  62. package/dist/pipeline/constitution.d.ts.map +1 -0
  63. package/dist/pipeline/constitution.js +82 -0
  64. package/dist/pipeline/constitution.js.map +1 -0
  65. package/dist/pipeline/gate-engine.d.ts +55 -0
  66. package/dist/pipeline/gate-engine.d.ts.map +1 -0
  67. package/dist/pipeline/gate-engine.js +270 -0
  68. package/dist/pipeline/gate-engine.js.map +1 -0
  69. package/dist/pipeline/index.d.ts +26 -0
  70. package/dist/pipeline/index.d.ts.map +1 -0
  71. package/dist/pipeline/index.js +35 -0
  72. package/dist/pipeline/index.js.map +1 -0
  73. package/dist/pipeline/migration.d.ts +15 -0
  74. package/dist/pipeline/migration.d.ts.map +1 -0
  75. package/dist/pipeline/migration.js +76 -0
  76. package/dist/pipeline/migration.js.map +1 -0
  77. package/dist/pipeline/orchestrator.d.ts +28 -0
  78. package/dist/pipeline/orchestrator.d.ts.map +1 -0
  79. package/dist/pipeline/orchestrator.js +238 -0
  80. package/dist/pipeline/orchestrator.js.map +1 -0
  81. package/dist/pipeline/packets/audit-report-builder.d.ts +11 -0
  82. package/dist/pipeline/packets/audit-report-builder.d.ts.map +1 -0
  83. package/dist/pipeline/packets/audit-report-builder.js +32 -0
  84. package/dist/pipeline/packets/audit-report-builder.js.map +1 -0
  85. package/dist/pipeline/packets/consensus-packet-builder.d.ts +35 -0
  86. package/dist/pipeline/packets/consensus-packet-builder.d.ts.map +1 -0
  87. package/dist/pipeline/packets/consensus-packet-builder.js +80 -0
  88. package/dist/pipeline/packets/consensus-packet-builder.js.map +1 -0
  89. package/dist/pipeline/packets/index.d.ts +12 -0
  90. package/dist/pipeline/packets/index.d.ts.map +1 -0
  91. package/dist/pipeline/packets/index.js +8 -0
  92. package/dist/pipeline/packets/index.js.map +1 -0
  93. package/dist/pipeline/packets/plan-packet-builder.d.ts +21 -0
  94. package/dist/pipeline/packets/plan-packet-builder.d.ts.map +1 -0
  95. package/dist/pipeline/packets/plan-packet-builder.js +27 -0
  96. package/dist/pipeline/packets/plan-packet-builder.js.map +1 -0
  97. package/dist/pipeline/packets/rca-packet-builder.d.ts +19 -0
  98. package/dist/pipeline/packets/rca-packet-builder.d.ts.map +1 -0
  99. package/dist/pipeline/packets/rca-packet-builder.js +22 -0
  100. package/dist/pipeline/packets/rca-packet-builder.js.map +1 -0
  101. package/dist/pipeline/phases/architecture.d.ts +7 -0
  102. package/dist/pipeline/phases/architecture.d.ts.map +1 -0
  103. package/dist/pipeline/phases/architecture.js +60 -0
  104. package/dist/pipeline/phases/architecture.js.map +1 -0
  105. package/dist/pipeline/phases/audit.d.ts +8 -0
  106. package/dist/pipeline/phases/audit.d.ts.map +1 -0
  107. package/dist/pipeline/phases/audit.js +144 -0
  108. package/dist/pipeline/phases/audit.js.map +1 -0
  109. package/dist/pipeline/phases/consensus-architecture.d.ts +7 -0
  110. package/dist/pipeline/phases/consensus-architecture.d.ts.map +1 -0
  111. package/dist/pipeline/phases/consensus-architecture.js +84 -0
  112. package/dist/pipeline/phases/consensus-architecture.js.map +1 -0
  113. package/dist/pipeline/phases/consensus-master-plan.d.ts +7 -0
  114. package/dist/pipeline/phases/consensus-master-plan.d.ts.map +1 -0
  115. package/dist/pipeline/phases/consensus-master-plan.js +81 -0
  116. package/dist/pipeline/phases/consensus-master-plan.js.map +1 -0
  117. package/dist/pipeline/phases/consensus-role-plans.d.ts +7 -0
  118. package/dist/pipeline/phases/consensus-role-plans.d.ts.map +1 -0
  119. package/dist/pipeline/phases/consensus-role-plans.js +85 -0
  120. package/dist/pipeline/phases/consensus-role-plans.js.map +1 -0
  121. package/dist/pipeline/phases/done.d.ts +7 -0
  122. package/dist/pipeline/phases/done.d.ts.map +1 -0
  123. package/dist/pipeline/phases/done.js +45 -0
  124. package/dist/pipeline/phases/done.js.map +1 -0
  125. package/dist/pipeline/phases/implementation.d.ts +8 -0
  126. package/dist/pipeline/phases/implementation.d.ts.map +1 -0
  127. package/dist/pipeline/phases/implementation.js +42 -0
  128. package/dist/pipeline/phases/implementation.js.map +1 -0
  129. package/dist/pipeline/phases/index.d.ts +20 -0
  130. package/dist/pipeline/phases/index.d.ts.map +1 -0
  131. package/dist/pipeline/phases/index.js +19 -0
  132. package/dist/pipeline/phases/index.js.map +1 -0
  133. package/dist/pipeline/phases/intake.d.ts +8 -0
  134. package/dist/pipeline/phases/intake.d.ts.map +1 -0
  135. package/dist/pipeline/phases/intake.js +40 -0
  136. package/dist/pipeline/phases/intake.js.map +1 -0
  137. package/dist/pipeline/phases/phase-context.d.ts +30 -0
  138. package/dist/pipeline/phases/phase-context.d.ts.map +1 -0
  139. package/dist/pipeline/phases/phase-context.js +33 -0
  140. package/dist/pipeline/phases/phase-context.js.map +1 -0
  141. package/dist/pipeline/phases/production-gate.d.ts +8 -0
  142. package/dist/pipeline/phases/production-gate.d.ts.map +1 -0
  143. package/dist/pipeline/phases/production-gate.js +84 -0
  144. package/dist/pipeline/phases/production-gate.js.map +1 -0
  145. package/dist/pipeline/phases/qa-validation.d.ts +7 -0
  146. package/dist/pipeline/phases/qa-validation.d.ts.map +1 -0
  147. package/dist/pipeline/phases/qa-validation.js +50 -0
  148. package/dist/pipeline/phases/qa-validation.js.map +1 -0
  149. package/dist/pipeline/phases/recovery-loop.d.ts +7 -0
  150. package/dist/pipeline/phases/recovery-loop.d.ts.map +1 -0
  151. package/dist/pipeline/phases/recovery-loop.js +91 -0
  152. package/dist/pipeline/phases/recovery-loop.js.map +1 -0
  153. package/dist/pipeline/phases/review.d.ts +8 -0
  154. package/dist/pipeline/phases/review.d.ts.map +1 -0
  155. package/dist/pipeline/phases/review.js +127 -0
  156. package/dist/pipeline/phases/review.js.map +1 -0
  157. package/dist/pipeline/phases/role-planning.d.ts +7 -0
  158. package/dist/pipeline/phases/role-planning.d.ts.map +1 -0
  159. package/dist/pipeline/phases/role-planning.js +75 -0
  160. package/dist/pipeline/phases/role-planning.js.map +1 -0
  161. package/dist/pipeline/phases/stuck.d.ts +7 -0
  162. package/dist/pipeline/phases/stuck.d.ts.map +1 -0
  163. package/dist/pipeline/phases/stuck.js +51 -0
  164. package/dist/pipeline/phases/stuck.js.map +1 -0
  165. package/dist/pipeline/repo-snapshot.d.ts +24 -0
  166. package/dist/pipeline/repo-snapshot.d.ts.map +1 -0
  167. package/dist/pipeline/repo-snapshot.js +343 -0
  168. package/dist/pipeline/repo-snapshot.js.map +1 -0
  169. package/dist/pipeline/role-execution-adapter.d.ts +59 -0
  170. package/dist/pipeline/role-execution-adapter.d.ts.map +1 -0
  171. package/dist/pipeline/role-execution-adapter.js +159 -0
  172. package/dist/pipeline/role-execution-adapter.js.map +1 -0
  173. package/dist/pipeline/skill-loader.d.ts +34 -0
  174. package/dist/pipeline/skill-loader.d.ts.map +1 -0
  175. package/dist/pipeline/skill-loader.js +156 -0
  176. package/dist/pipeline/skill-loader.js.map +1 -0
  177. package/dist/pipeline/skills/defaults.d.ts +16 -0
  178. package/dist/pipeline/skills/defaults.d.ts.map +1 -0
  179. package/dist/pipeline/skills/defaults.js +189 -0
  180. package/dist/pipeline/skills/defaults.js.map +1 -0
  181. package/dist/pipeline/type-defs/artifacts.d.ts +202 -0
  182. package/dist/pipeline/type-defs/artifacts.d.ts.map +1 -0
  183. package/dist/pipeline/type-defs/artifacts.js +66 -0
  184. package/dist/pipeline/type-defs/artifacts.js.map +1 -0
  185. package/dist/pipeline/type-defs/audit.d.ts +256 -0
  186. package/dist/pipeline/type-defs/audit.d.ts.map +1 -0
  187. package/dist/pipeline/type-defs/audit.js +54 -0
  188. package/dist/pipeline/type-defs/audit.js.map +1 -0
  189. package/dist/pipeline/type-defs/checks.d.ts +81 -0
  190. package/dist/pipeline/type-defs/checks.d.ts.map +1 -0
  191. package/dist/pipeline/type-defs/checks.js +38 -0
  192. package/dist/pipeline/type-defs/checks.js.map +1 -0
  193. package/dist/pipeline/type-defs/enums.d.ts +43 -0
  194. package/dist/pipeline/type-defs/enums.d.ts.map +1 -0
  195. package/dist/pipeline/type-defs/enums.js +55 -0
  196. package/dist/pipeline/type-defs/enums.js.map +1 -0
  197. package/dist/pipeline/type-defs/index.d.ts +12 -0
  198. package/dist/pipeline/type-defs/index.d.ts.map +1 -0
  199. package/dist/pipeline/type-defs/index.js +12 -0
  200. package/dist/pipeline/type-defs/index.js.map +1 -0
  201. package/dist/pipeline/type-defs/packets.d.ts +806 -0
  202. package/dist/pipeline/type-defs/packets.d.ts.map +1 -0
  203. package/dist/pipeline/type-defs/packets.js +109 -0
  204. package/dist/pipeline/type-defs/packets.js.map +1 -0
  205. package/dist/pipeline/type-defs/snapshot.d.ts +52 -0
  206. package/dist/pipeline/type-defs/snapshot.d.ts.map +1 -0
  207. package/dist/pipeline/type-defs/snapshot.js +35 -0
  208. package/dist/pipeline/type-defs/snapshot.js.map +1 -0
  209. package/dist/pipeline/type-defs/state.d.ts +449 -0
  210. package/dist/pipeline/type-defs/state.d.ts.map +1 -0
  211. package/dist/pipeline/type-defs/state.js +88 -0
  212. package/dist/pipeline/type-defs/state.js.map +1 -0
  213. package/dist/pipeline/types.d.ts +16 -0
  214. package/dist/pipeline/types.d.ts.map +1 -0
  215. package/dist/pipeline/types.js +16 -0
  216. package/dist/pipeline/types.js.map +1 -0
  217. package/dist/types/audit.d.ts +6 -6
  218. package/dist/workflow/index.d.ts.map +1 -1
  219. package/dist/workflow/index.js +48 -0
  220. package/dist/workflow/index.js.map +1 -1
  221. package/package.json +1 -1
  222. package/skills/ARBITRATOR.md +137 -0
  223. package/skills/ARCHITECT.md +167 -0
  224. package/skills/AUDITOR.md +128 -0
  225. package/skills/AUDIT_REPORT_SCHEMA.md +20 -0
  226. package/skills/BACKEND_PROGRAMMER.md +95 -0
  227. package/skills/CONSENSUS_PACKET_SCHEMA.md +166 -0
  228. package/skills/DB_EXPERT.md +106 -0
  229. package/skills/DEBUGGER.md +286 -0
  230. package/skills/DISPATCHER.md +157 -0
  231. package/skills/FRONTEND_PROGRAMMER.md +84 -0
  232. package/skills/JOURNALIST.md +247 -0
  233. package/skills/MARKETING_EXPERT.md +23 -0
  234. package/skills/PHASE_GATE_ENGINE_SPEC.md +171 -0
  235. package/skills/PLAN_PACKET_SCHEMA.md +222 -0
  236. package/skills/POPEYE_CONSTITUTION.md +177 -0
  237. package/skills/POPEYE_FULL_AUTONOMY_PIPELINE.md +537 -0
  238. package/skills/PRODUCTION_READINESS_SCHEMA.md +19 -0
  239. package/skills/QA_TESTER.md +40 -0
  240. package/skills/RCA_PACKET_SCHEMA.md +22 -0
  241. package/skills/RELEASE_MANAGER.md +60 -0
  242. package/skills/REVIEWER.md +133 -0
  243. package/skills/SOCIAL_EXPERT.md +22 -0
  244. package/skills/UI_UX_SPECIALIST.md +22 -0
  245. package/skills/WEBSITE_PROGRAMMER.md +37 -0
  246. package/src/cli/commands/debug-context.ts +265 -0
  247. package/src/cli/commands/debug-prompts.ts +91 -0
  248. package/src/cli/commands/debug.ts +662 -0
  249. package/src/cli/commands/index.ts +1 -0
  250. package/src/cli/index.ts +2 -0
  251. package/src/cli/interactive.ts +27 -0
  252. package/src/generators/all.ts +2 -0
  253. package/src/generators/templates/database-docker.ts +10 -0
  254. package/src/generators/templates/fullstack.ts +6 -2
  255. package/src/pipeline/artifact-manager.ts +339 -0
  256. package/src/pipeline/artifact-validators.ts +224 -0
  257. package/src/pipeline/change-request.ts +119 -0
  258. package/src/pipeline/check-runner.ts +504 -0
  259. package/src/pipeline/command-resolver.ts +168 -0
  260. package/src/pipeline/consensus/consensus-runner.ts +317 -0
  261. package/src/pipeline/constitution.ts +109 -0
  262. package/src/pipeline/gate-engine.ts +347 -0
  263. package/src/pipeline/index.ts +82 -0
  264. package/src/pipeline/migration.ts +91 -0
  265. package/src/pipeline/orchestrator.ts +314 -0
  266. package/src/pipeline/packets/audit-report-builder.ts +47 -0
  267. package/src/pipeline/packets/consensus-packet-builder.ts +112 -0
  268. package/src/pipeline/packets/index.ts +15 -0
  269. package/src/pipeline/packets/plan-packet-builder.ts +52 -0
  270. package/src/pipeline/packets/rca-packet-builder.ts +38 -0
  271. package/src/pipeline/phases/architecture.ts +73 -0
  272. package/src/pipeline/phases/audit.ts +193 -0
  273. package/src/pipeline/phases/consensus-architecture.ts +104 -0
  274. package/src/pipeline/phases/consensus-master-plan.ts +100 -0
  275. package/src/pipeline/phases/consensus-role-plans.ts +105 -0
  276. package/src/pipeline/phases/done.ts +68 -0
  277. package/src/pipeline/phases/implementation.ts +48 -0
  278. package/src/pipeline/phases/index.ts +21 -0
  279. package/src/pipeline/phases/intake.ts +54 -0
  280. package/src/pipeline/phases/phase-context.ts +86 -0
  281. package/src/pipeline/phases/production-gate.ts +113 -0
  282. package/src/pipeline/phases/qa-validation.ts +63 -0
  283. package/src/pipeline/phases/recovery-loop.ts +118 -0
  284. package/src/pipeline/phases/review.ts +149 -0
  285. package/src/pipeline/phases/role-planning.ts +92 -0
  286. package/src/pipeline/phases/stuck.ts +62 -0
  287. package/src/pipeline/repo-snapshot.ts +395 -0
  288. package/src/pipeline/role-execution-adapter.ts +238 -0
  289. package/src/pipeline/skill-loader.ts +192 -0
  290. package/src/pipeline/skills/defaults.ts +215 -0
  291. package/src/pipeline/type-defs/artifacts.ts +81 -0
  292. package/src/pipeline/type-defs/audit.ts +67 -0
  293. package/src/pipeline/type-defs/checks.ts +47 -0
  294. package/src/pipeline/type-defs/enums.ts +62 -0
  295. package/src/pipeline/type-defs/index.ts +12 -0
  296. package/src/pipeline/type-defs/packets.ts +131 -0
  297. package/src/pipeline/type-defs/snapshot.ts +55 -0
  298. package/src/pipeline/type-defs/state.ts +165 -0
  299. package/src/pipeline/types.ts +16 -0
  300. package/src/workflow/index.ts +48 -0
  301. package/tests/cli/commands/debug.test.ts +376 -0
  302. package/tests/pipeline/artifact-manager.test.ts +183 -0
  303. package/tests/pipeline/artifact-validators.test.ts +207 -0
  304. package/tests/pipeline/change-request.test.ts +180 -0
  305. package/tests/pipeline/check-runner.test.ts +157 -0
  306. package/tests/pipeline/command-resolver.test.ts +159 -0
  307. package/tests/pipeline/consensus-runner.test.ts +206 -0
  308. package/tests/pipeline/consensus-scoring.test.ts +163 -0
  309. package/tests/pipeline/constitution.test.ts +122 -0
  310. package/tests/pipeline/gate-engine.test.ts +195 -0
  311. package/tests/pipeline/migration.test.ts +133 -0
  312. package/tests/pipeline/orchestrator.test.ts +614 -0
  313. package/tests/pipeline/packets/builders.test.ts +347 -0
  314. package/tests/pipeline/repo-snapshot.test.ts +189 -0
  315. package/tests/pipeline/role-execution-adapter.test.ts +299 -0
  316. package/tests/pipeline/skill-loader.test.ts +186 -0
  317. package/tests/pipeline/start-env-checks.test.ts +123 -0
  318. package/tests/pipeline/types.test.ts +156 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,65 @@
2
2
 
3
3
  All notable changes to Popeye CLI are documented in this file.
4
4
 
5
+ ## [2.0.0] - 2026-02-20
6
+
7
+ ### Breaking Changes
8
+ - **Full Autonomy Pipeline Engine** — Popeye now ships a complete 14-phase deterministic pipeline that replaces the ad-hoc plan-then-execute workflow with a gate-driven state machine. This is a fundamental architectural shift: every phase must produce typed artifacts, pass gate checks, and survive consensus review before the pipeline advances. The pipeline manages its own recovery, drift detection, and rewind logic without human intervention.
9
+ - `PipelineState` is now the authoritative runtime state for autonomous execution (distinct from the existing `ProjectState` used by the interactive CLI).
10
+ - New `src/pipeline/` module tree (33 source files) is a peer to the existing `src/workflow/` module.
11
+
12
+ ### Added — Pipeline Core (Autonomy Hardening v1.0)
13
+
14
+ - **14-Phase State Machine** — `INTAKE` -> `CONSENSUS_MASTER_PLAN` -> `ARCHITECTURE` -> `CONSENSUS_ARCHITECTURE` -> `ROLE_PLANNING` -> `CONSENSUS_ROLE_PLANS` -> `IMPLEMENTATION` -> `QA_VALIDATION` -> `REVIEW` -> `AUDIT` -> `PRODUCTION_GATE` -> `DONE` (or `RECOVERY_LOOP` / `STUCK` on failure). Each phase has a dedicated handler in `src/pipeline/phases/`.
15
+ - **Gate Engine** (`gate-engine.ts`) — Pure deterministic evaluator. Each phase has a `GateDefinition` specifying required artifacts, required checks, consensus thresholds, allowed transitions, and fail transition. No side effects; reads state only.
16
+ - **Orchestrator** (`orchestrator.ts`) — Main loop that drives the pipeline from any phase to completion. Handles phase dispatch, gate evaluation, recovery routing, resume from saved state, and terminal state handling.
17
+ - **Type-Safe Artifact System** (`artifact-manager.ts`, `type-defs/artifacts.ts`) — 18 artifact types (`master_plan`, `architecture`, `role_plan`, `consensus`, `repo_snapshot`, `rca_report`, `audit_report`, `qa_validation`, `review_decision`, `production_readiness`, `constitution`, `change_request`, `release_notes`, `journalist_update`, `dependency_graph`, `implementation_log`, `recovery_log`, `skill_definition`). Each artifact has id, type, phase, version, path, sha256, timestamp, immutability flag, content_type, and group_id.
18
+ - **Consensus System** (`consensus/consensus-runner.ts`, `packets/consensus-packet-builder.ts`) — Multi-reviewer consensus with confidence-weighted scoring. `APPROVE` = 1.0, `CONDITIONAL` = 0.5, `REJECT` = 0.0, weighted by voter confidence. Any vote with `blocking_issues` forces `weighted_score` to 0. Three consensus phases (master plan, architecture, role plans) each produce `ConsensusPacket` artifacts.
19
+ - **Skill Loader** (`skill-loader.ts`, `skills/defaults.ts`) — 16 pipeline roles (`DISPATCHER`, `FRONTEND_PROGRAMMER`, `BACKEND_PROGRAMMER`, `DATABASE_SPECIALIST`, `DEVOPS_ENGINEER`, `QA_ENGINEER`, `UX_DESIGNER`, `TECHNICAL_WRITER`, `REVIEWER`, `AUDITOR`, `JOURNALIST`, `SECURITY_ANALYST`, `PERFORMANCE_ENGINEER`, `INTEGRATION_SPECIALIST`, `ARCHITECT`, `PROJECT_MANAGER`). Each role has a system prompt, constraints, output contract, and required sections.
20
+ - **Constitution System** (`constitution.ts`) — SHA-256 hash verification of `POPEYE_CONSTITUTION.md`. Created during INTAKE, verified before every gate evaluation. Hash mismatch blocks pipeline progression.
21
+ - **Repo Snapshot & Drift Detection** (`repo-snapshot.ts`) — File/line counting, language detection, config file inventory, port scanning, test framework and build tool detection. Snapshot diffing for drift detection between approved plans and implementation.
22
+ - **Check Runner** (`check-runner.ts`) — Deterministic command execution for `build`, `test`, `lint`, `typecheck`, `start`, and `env_check` gates. Captures exit code, stdout/stderr, duration.
23
+ - **Command Resolver** (`command-resolver.ts`) — Auto-detects `build`, `test`, `lint`, `typecheck`, and `start` commands from `package.json` scripts, `Makefile`, and common patterns.
24
+ - **Artifact Validators** (`artifact-validators.ts`) — Deterministic regex/structural checks before LLM review: `master_plan` (Goals, Milestones, Success Criteria sections, 200+ chars), `architecture` (Components, Data Flow, Tech Stack, file path references), `role_plan` (Tasks, Dependencies, Acceptance Criteria), `qa_validation` (Test Results, Coverage), `audit_report` (JSON with findings array, overall_status, system_risk_score).
25
+ - **Change Request System** (`change-request.ts`) — Structured drift tracking: `scope` -> `CONSENSUS_MASTER_PLAN`, `architecture` -> `CONSENSUS_ARCHITECTURE`, `dependency` -> `CONSENSUS_ROLE_PLANS`, `config` -> `QA_VALIDATION`, `requirement` -> `CONSENSUS_MASTER_PLAN`. CRs include origin phase, requester, impact analysis (affected artifacts, phases, risk level).
26
+ - **Role Execution Adapter** (`role-execution-adapter.ts`) — Bridges pipeline roles to execution. Builds role-specific system prompts from skill + role plan, defines allowed paths and forbidden patterns, injects context into `ClaudeExecuteOptions`.
27
+ - **RCA & Recovery** (`packets/rca-packet-builder.ts`, `phases/recovery-loop.ts`) — Root Cause Analysis packets with `requires_phase_rewind_to` for targeted recovery. Recovery loop reads RCA artifacts from disk to determine rewind targets.
28
+ - **Packet Builders** — `plan-packet-builder.ts` (PlanPacket with milestones, constraints, deliverables), `consensus-packet-builder.ts` (ConsensusPacket with votes, scores, conditions), `rca-packet-builder.ts` (RCAPacket with root cause, evidence, rewind target), `audit-report-builder.ts` (AuditReport with findings, risk score, status).
29
+ - **Migration System** (`migration.ts`) — Version-aware pipeline state migration for forward compatibility.
30
+ - **Pipeline Index** (`index.ts`) — Public API: `runPipeline()`, `resumePipeline()`, `createDefaultPipelineState()`, `createGateEngine()`, plus all type exports.
31
+
32
+ ### Added — Autonomy Hardening v1.1 (Gap Fixes)
33
+
34
+ - **Deterministic CR Routing** — After REVIEW and AUDIT phases pass their gates, the orchestrator checks `pipeline.pendingChangeRequests` for proposed CRs. First proposed CR is marked `approved` and the pipeline transitions to its `target_phase` (a consensus phase). This is a real state machine transition, not advisory.
35
+ - **Constitution Verification in Orchestrator** — `verifyConstitution(pipeline, projectDir)` is called before every `evaluateGate()`. Result is passed as `{ constitutionValid, constitutionReason }` options. Gate engine adds constitution failure as a blocker.
36
+ - **Gate Result Merge** — `mergeGateResult()` preserves `score`/`consensusScore` stored by consensus phase handlers while updating `pass`/`blockers` from the gate engine. Prevents consensus scoring data loss on re-evaluation.
37
+ - **RCA Rewind from Disk** — `getLatestRCA()` reads the latest `rca_report` JSON artifact from the filesystem and parses `requires_phase_rewind_to`. Recovery loop uses this to rewind to the correct phase instead of always returning to the failed phase.
38
+ - `score?: number` on `GateResult` in `gate-engine.ts` (was present in type-defs but missing from the runtime interface).
39
+ - `pendingChangeRequests` array on `PipelineState` for CR lifecycle tracking (`proposed` -> `approved` -> routing).
40
+
41
+ ### Added — Type System
42
+
43
+ - **Split `types.ts` into `type-defs/` directory** (8 files) — `enums.ts` (PipelinePhase, PipelineRole), `artifacts.ts` (18 artifact types, ArtifactEntry, ArtifactRef, DependencyEdge), `packets.ts` (PlanPacket, ConsensusPacket, ReviewerVote, RCAPacket, ChangeRequest, Constraint), `audit.ts` (AuditFinding, AuditReport), `snapshot.ts` (RepoSnapshot, ConfigFileEntry, PortEntry, SnapshotDiff), `checks.ts` (GateCheckType, GateCheckResult, ResolvedCommands), `state.ts` (PipelineState, GateResult, GateDefinition, SkillDefinition, PhaseResult, PhaseContext), `index.ts` (barrel re-export). All existing `from '../pipeline/types.js'` imports work unchanged.
44
+
45
+ ### Added — Tests
46
+
47
+ - **59 new test files** covering the entire pipeline module with **1210 total tests** (up from 828):
48
+ - `orchestrator.test.ts` (25 tests) — Happy path, recovery loop, resume, gate integration, v1.1 gap fixes (CR routing, constitution, merge, RCA rewind)
49
+ - `gate-engine.test.ts` — Gate definitions, evaluations, transitions, consensus thresholds
50
+ - `consensus-scoring.test.ts` — Weighted scoring, CONDITIONAL=0.5, blocking issues, confidence weights
51
+ - `constitution.test.ts` — Artifact creation, hash computation, tamper detection
52
+ - `artifact-validators.test.ts` — Each type: valid pass, missing sections, empty content, edge cases
53
+ - `change-request.test.ts` — CR building, routing per change type, impact analysis
54
+ - `role-execution-adapter.test.ts` — Role context, prompt injection, forbidden patterns
55
+ - `start-env-checks.test.ts` — Start check (alive/crash/timeout), env check (complete/missing/empty)
56
+ - `check-runner.test.ts`, `command-resolver.test.ts`, `consensus-runner.test.ts`, `repo-snapshot.test.ts`, `skill-loader.test.ts`, `artifact-manager.test.ts`, `migration.test.ts`, `types.test.ts`, `packets/builders.test.ts`
57
+
58
+ ### Changed
59
+ - Orchestrator main loop now has 3 new behaviors between phase execution and transition: (1) constitution verification before gate eval, (2) gate result merging after gate eval, (3) CR routing check after REVIEW/AUDIT gate pass.
60
+ - REVIEW phase creates CRs for config drift and scope drift, registers them in `pipeline.pendingChangeRequests`.
61
+ - AUDIT phase creates CRs for blocking architectural and security findings, registers them in `pipeline.pendingChangeRequests`.
62
+ - `src/workflow/index.ts` — Added pipeline exports for integration with existing workflow system.
63
+
5
64
  ## [1.6.0] - 2026-02-17
6
65
 
7
66
  ### Added
package/CONTRIBUTING.md CHANGED
@@ -185,8 +185,14 @@ src/
185
185
  ├── cli/ # CLI commands and interface
186
186
  ├── config/ # Configuration management
187
187
  ├── generators/ # Project scaffolding
188
+ ├── pipeline/ # Full autonomy pipeline engine (14-phase state machine)
189
+ │ ├── orchestrator.ts # Main loop with CR routing, constitution check, gate merge
190
+ │ ├── gate-engine.ts # Deterministic gate evaluation
191
+ │ ├── phases/ # Phase handler implementations
192
+ │ └── type-defs/ # Pipeline-specific type definitions
188
193
  ├── state/ # State management
189
194
  ├── types/ # TypeScript type definitions
195
+ ├── upgrade/ # Project type upgrade system
190
196
  └── workflow/ # Core workflow logic
191
197
  ├── plan-storage.ts # Consensus docs per-app storage
192
198
  └── workspace-manager.ts # Multi-app workspace management
@@ -257,6 +263,14 @@ Understanding the codebase:
257
263
 
258
264
 
259
265
  ┌─────────────────────────────────────────────────────────────┐
266
+ │ Pipeline Layer │
267
+ │ (pipeline/*.ts - 14-phase autonomy engine, gate machine) │
268
+ │ Orchestrator -> Gate Engine -> Phase Handlers │
269
+ │ Constitution verification, CR routing, RCA rewind │
270
+ └─────────────────────────────────────────────────────────────┘
271
+
272
+
273
+ ┌─────────────────────────────────────────────────────────────┐
260
274
  │ Workflow Layer │
261
275
  │ (workflow/*.ts - Plan mode, Execution mode, Consensus) │
262
276
  └─────────────────────────────────────────────────────────────┘
@@ -264,7 +278,7 @@ Understanding the codebase:
264
278
 
265
279
  ┌─────────────────────────────────────────────────────────────┐
266
280
  │ Adapter Layer │
267
- │ (adapters/*.ts - Claude, OpenAI, Gemini)
281
+ │ (adapters/*.ts - Claude, OpenAI, Gemini, Grok)
268
282
  └─────────────────────────────────────────────────────────────┘
269
283
 
270
284
 
package/README.md CHANGED
@@ -1606,6 +1606,18 @@ src/
1606
1606
  │ ├── handlers.ts # Upgrade handlers (4 paths with file scaffolding)
1607
1607
  │ ├── index.ts # Transactional orchestrator with backup/rollback
1608
1608
  │ └── context.ts # Builds rich context for post-upgrade planning
1609
+ ├── pipeline/ # Full autonomy pipeline engine (14 phases)
1610
+ │ ├── orchestrator.ts # Top-level loop: phase dispatch, CR routing, constitution check
1611
+ │ ├── gate-engine.ts # Deterministic state machine: gate definitions, evaluation
1612
+ │ ├── constitution.ts # Constitution hashing and integrity verification (SHA-256)
1613
+ │ ├── change-request.ts # CR builder, routing (change_type -> consensus phase)
1614
+ │ ├── artifact-manager.ts # Artifact creation, storage, versioning
1615
+ │ ├── skill-loader.ts # Role skill prompt loading from skills/ directory
1616
+ │ ├── repo-snapshot.ts # Repo snapshot generation and diffing
1617
+ │ ├── consensus/ # Consensus runner for pipeline phases
1618
+ │ ├── phases/ # Phase handlers (intake, review, audit, recovery, etc.)
1619
+ │ ├── type-defs/ # Pipeline type definitions (state, enums, artifacts, packets)
1620
+ │ └── packets/ # Packet builders (audit report, consensus, RCA)
1609
1621
  ├── workflow/ # Workflow engine
1610
1622
  │ ├── consensus.ts # Consensus loop (reviewerPersona threading)
1611
1623
  │ ├── plan-mode.ts # Planning phase (strategy generation, monorepo-aware)
@@ -1645,6 +1657,51 @@ src/
1645
1657
  └── website-strategy.ts # WebsiteStrategyDocument, BrandAssetsContract, DesignTokens
1646
1658
  ```
1647
1659
 
1660
+ ### Full Autonomy Pipeline Engine
1661
+
1662
+ The `src/pipeline/` module implements the 14-phase deterministic pipeline defined in the `POPEYE_FULL_AUTONOMY_PIPELINE.md` spec. The pipeline drives a project from a single idea prompt through to production-ready status.
1663
+
1664
+ #### Pipeline Phases
1665
+
1666
+ ```
1667
+ INTAKE -> CONSENSUS_MASTER_PLAN -> ARCHITECTURE -> CONSENSUS_ARCHITECTURE
1668
+ -> ROLE_PLANNING -> CONSENSUS_ROLE_PLANS -> IMPLEMENTATION -> QA_VALIDATION
1669
+ -> REVIEW -> AUDIT -> PRODUCTION_GATE -> DONE
1670
+ (RECOVERY_LOOP on any gate failure, STUCK after max recovery iterations)
1671
+ ```
1672
+
1673
+ Each phase has:
1674
+ - **Required artifacts** that must exist before the gate passes
1675
+ - **Required checks** (build, test, lint, typecheck for PRODUCTION_GATE)
1676
+ - **Consensus threshold** (0.95 for plan phases)
1677
+ - **Allowed transitions** (strictly enforced, no phase skipping)
1678
+
1679
+ #### Autonomy Hardening (v1.1)
1680
+
1681
+ The orchestrator main loop includes three behaviors between phase execution and transition:
1682
+
1683
+ 1. **Constitution Verification**: Before every `evaluateGate()` call, the orchestrator verifies that `skills/POPEYE_CONSTITUTION.md` has not been modified since pipeline start (SHA-256 hash comparison). If the constitution is invalid, the gate is blocked with a specific reason.
1684
+
1685
+ 2. **Gate Result Merging**: After gate evaluation, `mergeGateResult()` preserves `score`/`consensusScore` values stored by consensus phase handlers while updating `pass`/`blockers` from the gate engine. This prevents consensus scores from being overwritten.
1686
+
1687
+ 3. **CR Routing**: After REVIEW and AUDIT phases pass their gates, the orchestrator checks `pipeline.pendingChangeRequests` for any `proposed` Change Requests. If found, the pipeline deterministically routes to the appropriate consensus phase rather than continuing normal progression.
1688
+
1689
+ #### Change Request System
1690
+
1691
+ | Change Type | Routes To |
1692
+ |-------------|-----------|
1693
+ | `scope` | `CONSENSUS_MASTER_PLAN` |
1694
+ | `architecture` | `CONSENSUS_ARCHITECTURE` |
1695
+ | `dependency` | `CONSENSUS_ROLE_PLANS` |
1696
+ | `config` | `QA_VALIDATION` |
1697
+ | `requirement` | `CONSENSUS_MASTER_PLAN` |
1698
+
1699
+ CR Lifecycle: `proposed` (created by REVIEW/AUDIT) -> `approved` (routed by orchestrator) or `rejected`.
1700
+
1701
+ #### Recovery and RCA Rewind
1702
+
1703
+ When any gate fails, the pipeline enters RECOVERY_LOOP. After successful recovery, the orchestrator reads the latest RCA artifact from disk and checks for a `requires_phase_rewind_to` field. If present, the pipeline rewinds to that specific phase instead of retesting the originally failed phase. This allows root-cause-aware recovery (e.g., an implementation failure caused by an architecture gap can rewind to ARCHITECTURE).
1704
+
1648
1705
  ## Development
1649
1706
 
1650
1707
  ```bash
package/cheatsheet.md CHANGED
@@ -231,6 +231,32 @@ popeye-cli audit ./my-project --target frontend
231
231
 
232
232
  ---
233
233
 
234
+ ### `popeye-cli debug [projectDir]`
235
+
236
+ Start an interactive debugging session for a Popeye-generated project. Indexes the project, loads anchor docs (CLAUDE.md, README, config files), then opens a debug sub-REPL where you paste errors for AI-assisted diagnosis and fixes.
237
+
238
+ | Option | Description | Default |
239
+ |--------|-------------|---------|
240
+ | `-l, --language <lang>` | Project language/type | `backend` |
241
+
242
+ ```bash
243
+ popeye-cli debug ./my-project
244
+ popeye-cli debug ./my-project --language fullstack
245
+ ```
246
+
247
+ **How it works:**
248
+ 1. Scans the project directory and builds a lightweight file index (paths + metadata)
249
+ 2. Loads anchor documents: CLAUDE.md, README, package.json, docker-compose.yml, etc.
250
+ 3. Opens a `debug >` sub-REPL -- paste an error or describe a bug
251
+ 4. Extracts file paths from stack traces and detects tech context (alembic, vite, fastapi, etc.)
252
+ 5. Loads only the relevant source files on-demand (not the entire codebase)
253
+ 6. Sends targeted context to Claude for structured diagnosis
254
+ 7. Claude responds with: Diagnosis, Evidence, Proposed Fix, Commands to Verify, Ready to Apply
255
+
256
+ **Permission model:** Same as Claude Code -- asks before making any file edits (no auto-write).
257
+
258
+ ---
259
+
234
260
  ## Interactive Mode Slash Commands
235
261
 
236
262
  Enter these commands during an interactive session (started via `popeye-cli interactive`).
@@ -317,6 +343,41 @@ Available upgrade paths depend on the current project type:
317
343
  | `/doctor` | Run all readiness checks inline |
318
344
  | `/review`, `/audit` | Run a post-build audit with findings and optional recovery |
319
345
 
346
+ ### Debugging
347
+
348
+ | Command | Description |
349
+ |---------|-------------|
350
+ | `/debug`, `/dbg` | Start interactive debugging session (requires active project) |
351
+
352
+ Once inside the debug session, the following sub-commands are available:
353
+
354
+ | Debug Sub-Command | Description |
355
+ |-------------------|-------------|
356
+ | `/back`, `/done` | Return to main Popeye session |
357
+ | `/clear` | Reset conversation history |
358
+ | `/context` | Re-display project summary |
359
+ | `/fix` | Apply last proposed fix via Popeye execution pipeline |
360
+
361
+ **Debug session input:** Single Enter submits for commands and short messages. Multi-line paste is auto-detected and waits for the full paste to arrive before submitting.
362
+
363
+ ```
364
+ # Start a debug session from the Popeye REPL
365
+ /debug
366
+
367
+ # Inside debug session, paste an error:
368
+ debug > Traceback (most recent call last):
369
+ ... File "/app/src/database/connection.py", line 15
370
+ ... ConnectionRefusedError: [Errno 111] Connection refused
371
+ ...
372
+ ... (paste auto-detected, submits after 2s pause)
373
+
374
+ # Apply the proposed fix
375
+ debug > /fix
376
+
377
+ # Return to main Popeye REPL (use /back, not /exit which would exit Popeye)
378
+ debug > /back
379
+ ```
380
+
320
381
  ### Session Control
321
382
 
322
383
  | Command | Description |
@@ -435,6 +496,10 @@ popeye-cli resume ./taskmaster
435
496
  popeye-cli review ./taskmaster
436
497
  popeye-cli review ./taskmaster --depth 3 --strict
437
498
 
499
+ # Debug a project (paste errors, get AI-assisted fixes)
500
+ popeye-cli debug ./taskmaster
501
+ popeye-cli debug ./taskmaster --language fullstack
502
+
438
503
  # Reset and re-plan
439
504
  popeye-cli reset ./taskmaster --phase plan
440
505
  ```
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Debug context helpers
3
+ * Deterministic functions for error analysis and smart file selection.
4
+ * Pure functions, easily testable.
5
+ */
6
+ /**
7
+ * Entry in the lightweight file index (paths + metadata, no content).
8
+ */
9
+ export interface FileIndexEntry {
10
+ relativePath: string;
11
+ size: number;
12
+ mtime: number;
13
+ isConfig: boolean;
14
+ }
15
+ /**
16
+ * Check if a file path matches a config pattern.
17
+ *
18
+ * @param filePath - Relative path to check.
19
+ * @returns True if the file is a known config file.
20
+ */
21
+ export declare function isConfigFile(filePath: string): boolean;
22
+ /**
23
+ * Extract file paths mentioned in stack traces.
24
+ * Supports Python tracebacks, TypeScript/JS errors, and generic path patterns.
25
+ *
26
+ * @param text - Error text or stack trace.
27
+ * @returns Deduplicated array of file paths found in the text.
28
+ */
29
+ export declare function extractPathsFromError(text: string): string[];
30
+ /**
31
+ * Detect framework/tech keywords from error text.
32
+ *
33
+ * @param text - Error text or stack trace.
34
+ * @returns Object with deduplicated tags array.
35
+ */
36
+ export declare function detectTechFromError(text: string): {
37
+ tags: string[];
38
+ };
39
+ /**
40
+ * Select relevant files from the project index based on error paths and tech tags.
41
+ * Returns file paths sorted by relevance (direct matches first, then config, then nearby).
42
+ *
43
+ * @param fileIndex - Lightweight file index.
44
+ * @param errorPaths - Paths extracted from the error.
45
+ * @param tags - Tech tags detected from the error.
46
+ * @returns Array of relative paths to load.
47
+ */
48
+ export declare function selectRelevantFiles(fileIndex: FileIndexEntry[], errorPaths: string[], tags: string[]): string[];
49
+ /**
50
+ * Extract image/screenshot file paths from user input text.
51
+ * Detects both quoted and unquoted absolute/relative paths ending in image extensions.
52
+ *
53
+ * @param text - User input text.
54
+ * @returns Array of image file paths found in the text.
55
+ */
56
+ export declare function extractImagePaths(text: string): string[];
57
+ /**
58
+ * Check if a file path points to an image file.
59
+ *
60
+ * @param filePath - File path to check.
61
+ * @returns True if the file has an image extension.
62
+ */
63
+ export declare function isImageFile(filePath: string): boolean;
64
+ //# sourceMappingURL=debug-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug-context.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/debug-context.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;CACnB;AAYD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAGtD;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAsC5D;AA2BD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAapE;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,cAAc,EAAE,EAC3B,UAAU,EAAE,MAAM,EAAE,EACpB,IAAI,EAAE,MAAM,EAAE,GACb,MAAM,EAAE,CAkEV;AAKD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAgBxD;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAGrD"}
@@ -0,0 +1,221 @@
1
+ /**
2
+ * Debug context helpers
3
+ * Deterministic functions for error analysis and smart file selection.
4
+ * Pure functions, easily testable.
5
+ */
6
+ import path from 'node:path';
7
+ /** Config file patterns that are always considered relevant */
8
+ const CONFIG_PATTERNS = [
9
+ 'package.json', 'package-lock.json', 'tsconfig.json', 'vite.config',
10
+ 'pyproject.toml', 'requirements.txt', 'Pipfile',
11
+ 'docker-compose.yml', 'docker-compose.yaml', 'Dockerfile',
12
+ '.env.example', '.env.local', 'alembic.ini',
13
+ 'next.config', 'tailwind.config', 'postcss.config',
14
+ 'jest.config', 'vitest.config', 'pytest.ini', 'setup.cfg',
15
+ ];
16
+ /**
17
+ * Check if a file path matches a config pattern.
18
+ *
19
+ * @param filePath - Relative path to check.
20
+ * @returns True if the file is a known config file.
21
+ */
22
+ export function isConfigFile(filePath) {
23
+ const basename = path.basename(filePath);
24
+ return CONFIG_PATTERNS.some((p) => basename.startsWith(p));
25
+ }
26
+ /**
27
+ * Extract file paths mentioned in stack traces.
28
+ * Supports Python tracebacks, TypeScript/JS errors, and generic path patterns.
29
+ *
30
+ * @param text - Error text or stack trace.
31
+ * @returns Deduplicated array of file paths found in the text.
32
+ */
33
+ export function extractPathsFromError(text) {
34
+ const paths = new Set();
35
+ // Python traceback: File "/app/src/module/file.py", line 42
36
+ const pyPattern = /File "([^"]+\.py[cw]?)", line \d+/g;
37
+ for (const match of text.matchAll(pyPattern)) {
38
+ paths.add(normalizePath(match[1]));
39
+ }
40
+ // TS/JS errors: src/components/App.tsx(15,3) or src/components/App.tsx:15:3
41
+ const tsPattern = /([a-zA-Z0-9_./\\-]+\.(?:ts|tsx|js|jsx|mjs|cjs))[\s:(]/g;
42
+ for (const match of text.matchAll(tsPattern)) {
43
+ paths.add(normalizePath(match[1]));
44
+ }
45
+ // Docker / generic paths: /app/src/..., ./src/...
46
+ const genericPattern = /(?:\/app\/|\.\/)((?:src|app|lib|tests?|config)\/[a-zA-Z0-9_./-]+\.\w+)/g;
47
+ for (const match of text.matchAll(genericPattern)) {
48
+ paths.add(normalizePath(match[1]));
49
+ }
50
+ // Module not found patterns: Cannot find module './foo/bar'
51
+ const modulePattern = /Cannot find module ['"]([^'"]+)['"]/g;
52
+ for (const match of text.matchAll(modulePattern)) {
53
+ const mod = match[1];
54
+ if (mod.startsWith('.') || mod.startsWith('/')) {
55
+ paths.add(normalizePath(mod));
56
+ }
57
+ }
58
+ // ModuleNotFoundError: No module named 'src.foo.bar'
59
+ const pyModulePattern = /No module named ['"]([^'"]+)['"]/g;
60
+ for (const match of text.matchAll(pyModulePattern)) {
61
+ const dotPath = match[1].replace(/\./g, '/');
62
+ paths.add(dotPath);
63
+ }
64
+ return Array.from(paths);
65
+ }
66
+ /** Tech keyword map: keyword -> tags */
67
+ const TECH_KEYWORDS = {
68
+ 'alembic': ['alembic', 'database', 'migration'],
69
+ 'sqlalchemy': ['sqlalchemy', 'database', 'orm'],
70
+ 'prisma': ['prisma', 'database', 'orm'],
71
+ 'docker': ['docker', 'container'],
72
+ 'docker-compose': ['docker', 'container', 'compose'],
73
+ 'vite': ['vite', 'bundler', 'frontend'],
74
+ 'webpack': ['webpack', 'bundler', 'frontend'],
75
+ 'next': ['nextjs', 'react', 'frontend'],
76
+ 'fastapi': ['fastapi', 'backend', 'python'],
77
+ 'flask': ['flask', 'backend', 'python'],
78
+ 'express': ['express', 'backend', 'node'],
79
+ 'postgres': ['postgres', 'database'],
80
+ 'redis': ['redis', 'cache'],
81
+ 'tailwind': ['tailwind', 'css', 'frontend'],
82
+ 'pytest': ['pytest', 'testing', 'python'],
83
+ 'jest': ['jest', 'testing', 'node'],
84
+ 'vitest': ['vitest', 'testing', 'node'],
85
+ 'nginx': ['nginx', 'proxy'],
86
+ 'cors': ['cors', 'api'],
87
+ 'migration': ['migration', 'database'],
88
+ 'celery': ['celery', 'queue', 'python'],
89
+ };
90
+ /**
91
+ * Detect framework/tech keywords from error text.
92
+ *
93
+ * @param text - Error text or stack trace.
94
+ * @returns Object with deduplicated tags array.
95
+ */
96
+ export function detectTechFromError(text) {
97
+ const tags = new Set();
98
+ const lower = text.toLowerCase();
99
+ for (const [keyword, keywordTags] of Object.entries(TECH_KEYWORDS)) {
100
+ if (lower.includes(keyword)) {
101
+ for (const tag of keywordTags) {
102
+ tags.add(tag);
103
+ }
104
+ }
105
+ }
106
+ return { tags: Array.from(tags) };
107
+ }
108
+ /**
109
+ * Select relevant files from the project index based on error paths and tech tags.
110
+ * Returns file paths sorted by relevance (direct matches first, then config, then nearby).
111
+ *
112
+ * @param fileIndex - Lightweight file index.
113
+ * @param errorPaths - Paths extracted from the error.
114
+ * @param tags - Tech tags detected from the error.
115
+ * @returns Array of relative paths to load.
116
+ */
117
+ export function selectRelevantFiles(fileIndex, errorPaths, tags) {
118
+ if (fileIndex.length === 0)
119
+ return [];
120
+ const selected = new Set();
121
+ const MAX_FILES = 15;
122
+ // 1. Direct matches: files mentioned in the error
123
+ for (const errorPath of errorPaths) {
124
+ for (const entry of fileIndex) {
125
+ if (entry.relativePath.endsWith(errorPath) ||
126
+ entry.relativePath === errorPath ||
127
+ entry.relativePath.includes(errorPath)) {
128
+ selected.add(entry.relativePath);
129
+ }
130
+ }
131
+ }
132
+ // 2. Sibling files: files in the same directory as matches
133
+ const matchedDirs = new Set();
134
+ for (const sel of selected) {
135
+ matchedDirs.add(path.dirname(sel));
136
+ }
137
+ for (const dir of matchedDirs) {
138
+ for (const entry of fileIndex) {
139
+ if (path.dirname(entry.relativePath) === dir && selected.size < MAX_FILES) {
140
+ selected.add(entry.relativePath);
141
+ }
142
+ }
143
+ }
144
+ // 3. Tag-based: config files related to detected tech
145
+ if (tags.includes('database') || tags.includes('migration')) {
146
+ for (const entry of fileIndex) {
147
+ if (entry.relativePath.includes('alembic') ||
148
+ entry.relativePath.includes('migration') ||
149
+ entry.relativePath.includes('prisma') ||
150
+ entry.relativePath.includes('schema.sql')) {
151
+ if (selected.size < MAX_FILES)
152
+ selected.add(entry.relativePath);
153
+ }
154
+ }
155
+ }
156
+ if (tags.includes('docker') || tags.includes('compose')) {
157
+ for (const entry of fileIndex) {
158
+ if (entry.relativePath.includes('docker') ||
159
+ entry.relativePath.includes('Dockerfile')) {
160
+ if (selected.size < MAX_FILES)
161
+ selected.add(entry.relativePath);
162
+ }
163
+ }
164
+ }
165
+ // 4. Fallback: always include config files if we have few matches
166
+ if (selected.size < 5) {
167
+ for (const entry of fileIndex) {
168
+ if (entry.isConfig && selected.size < MAX_FILES) {
169
+ selected.add(entry.relativePath);
170
+ }
171
+ }
172
+ }
173
+ return Array.from(selected).slice(0, MAX_FILES);
174
+ }
175
+ /** Image file extensions that Claude can read via the Read tool */
176
+ const IMAGE_EXTENSIONS = new Set(['.png', '.jpg', '.jpeg', '.gif', '.webp', '.bmp', '.svg']);
177
+ /**
178
+ * Extract image/screenshot file paths from user input text.
179
+ * Detects both quoted and unquoted absolute/relative paths ending in image extensions.
180
+ *
181
+ * @param text - User input text.
182
+ * @returns Array of image file paths found in the text.
183
+ */
184
+ export function extractImagePaths(text) {
185
+ const paths = new Set();
186
+ // Quoted paths: '/path/to/image.png' or "/path/to/image.png"
187
+ const quotedPattern = /['"]([^'"]+\.(?:png|jpg|jpeg|gif|webp|bmp|svg))['"]/gi;
188
+ for (const match of text.matchAll(quotedPattern)) {
189
+ paths.add(match[1]);
190
+ }
191
+ // Unquoted absolute paths: /path/to/image.png (no spaces allowed in unquoted)
192
+ const absolutePattern = /(\/[^\s'"]+\.(?:png|jpg|jpeg|gif|webp|bmp|svg))/gi;
193
+ for (const match of text.matchAll(absolutePattern)) {
194
+ paths.add(match[1]);
195
+ }
196
+ return Array.from(paths);
197
+ }
198
+ /**
199
+ * Check if a file path points to an image file.
200
+ *
201
+ * @param filePath - File path to check.
202
+ * @returns True if the file has an image extension.
203
+ */
204
+ export function isImageFile(filePath) {
205
+ const ext = path.extname(filePath).toLowerCase();
206
+ return IMAGE_EXTENSIONS.has(ext);
207
+ }
208
+ /**
209
+ * Normalize a file path by stripping common prefixes (/app/, ./, etc.).
210
+ *
211
+ * @param p - Raw file path from error text.
212
+ * @returns Normalized relative path.
213
+ */
214
+ function normalizePath(p) {
215
+ let normalized = p.replace(/\\/g, '/');
216
+ // Strip common container prefixes
217
+ normalized = normalized.replace(/^\/app\//, '');
218
+ normalized = normalized.replace(/^\.\//, '');
219
+ return normalized;
220
+ }
221
+ //# sourceMappingURL=debug-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug-context.js","sourceRoot":"","sources":["../../../src/cli/commands/debug-context.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAY7B,+DAA+D;AAC/D,MAAM,eAAe,GAAG;IACtB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,IAAI,UAAU,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACvC,kCAAkC;IAClC,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IAChD,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAC7C,OAAO,UAAU,CAAC;AACpB,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Debug session prompts
3
+ * System prompt with strict output contract and conversation history formatting.
4
+ */
5
+ /**
6
+ * Message in the debug conversation history.
7
+ */
8
+ export interface DebugMessage {
9
+ role: 'user' | 'assistant';
10
+ content: string;
11
+ }
12
+ /**
13
+ * Build the system prompt for the debug session.
14
+ *
15
+ * @returns The system prompt instructing Claude on debug response format.
16
+ */
17
+ export declare function getDebugSystemPrompt(): string;
18
+ /**
19
+ * Format conversation history for inclusion in the prompt.
20
+ *
21
+ * @param history - Array of debug messages.
22
+ * @returns Formatted string of conversation history.
23
+ */
24
+ export declare function formatConversationHistory(history: DebugMessage[]): string;
25
+ //# sourceMappingURL=debug-prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug-prompts.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/debug-prompts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAqD7C;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,MAAM,CAWzE"}