@cluesmith/codev 2.0.0-rc.6 → 2.0.0-rc.61

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 (377) hide show
  1. package/bin/af.js +2 -2
  2. package/bin/consult.js +1 -1
  3. package/bin/porch.js +6 -35
  4. package/dashboard/dist/assets/index-CXloFYpB.css +32 -0
  5. package/dashboard/dist/assets/index-Ca2fjOJf.js +131 -0
  6. package/dashboard/dist/assets/index-Ca2fjOJf.js.map +1 -0
  7. package/dashboard/dist/index.html +14 -0
  8. package/dist/agent-farm/cli.d.ts.map +1 -1
  9. package/dist/agent-farm/cli.js +94 -65
  10. package/dist/agent-farm/cli.js.map +1 -1
  11. package/dist/agent-farm/commands/architect.d.ts.map +1 -1
  12. package/dist/agent-farm/commands/architect.js +13 -6
  13. package/dist/agent-farm/commands/architect.js.map +1 -1
  14. package/dist/agent-farm/commands/attach.d.ts +13 -0
  15. package/dist/agent-farm/commands/attach.d.ts.map +1 -0
  16. package/dist/agent-farm/commands/attach.js +202 -0
  17. package/dist/agent-farm/commands/attach.js.map +1 -0
  18. package/dist/agent-farm/commands/cleanup.d.ts.map +1 -1
  19. package/dist/agent-farm/commands/cleanup.js +30 -3
  20. package/dist/agent-farm/commands/cleanup.js.map +1 -1
  21. package/dist/agent-farm/commands/consult.js +1 -1
  22. package/dist/agent-farm/commands/consult.js.map +1 -1
  23. package/dist/agent-farm/commands/index.d.ts +2 -2
  24. package/dist/agent-farm/commands/index.d.ts.map +1 -1
  25. package/dist/agent-farm/commands/index.js +2 -2
  26. package/dist/agent-farm/commands/index.js.map +1 -1
  27. package/dist/agent-farm/commands/open.d.ts +4 -2
  28. package/dist/agent-farm/commands/open.d.ts.map +1 -1
  29. package/dist/agent-farm/commands/open.js +34 -70
  30. package/dist/agent-farm/commands/open.js.map +1 -1
  31. package/dist/agent-farm/commands/send.d.ts.map +1 -1
  32. package/dist/agent-farm/commands/send.js +55 -17
  33. package/dist/agent-farm/commands/send.js.map +1 -1
  34. package/dist/agent-farm/commands/shell.d.ts +15 -0
  35. package/dist/agent-farm/commands/shell.d.ts.map +1 -0
  36. package/dist/agent-farm/commands/shell.js +61 -0
  37. package/dist/agent-farm/commands/shell.js.map +1 -0
  38. package/dist/agent-farm/commands/spawn.d.ts.map +1 -1
  39. package/dist/agent-farm/commands/spawn.js +503 -226
  40. package/dist/agent-farm/commands/spawn.js.map +1 -1
  41. package/dist/agent-farm/commands/start.d.ts +3 -0
  42. package/dist/agent-farm/commands/start.d.ts.map +1 -1
  43. package/dist/agent-farm/commands/start.js +58 -265
  44. package/dist/agent-farm/commands/start.js.map +1 -1
  45. package/dist/agent-farm/commands/status.d.ts +2 -0
  46. package/dist/agent-farm/commands/status.d.ts.map +1 -1
  47. package/dist/agent-farm/commands/status.js +61 -3
  48. package/dist/agent-farm/commands/status.js.map +1 -1
  49. package/dist/agent-farm/commands/stop.d.ts +6 -0
  50. package/dist/agent-farm/commands/stop.d.ts.map +1 -1
  51. package/dist/agent-farm/commands/stop.js +116 -12
  52. package/dist/agent-farm/commands/stop.js.map +1 -1
  53. package/dist/agent-farm/commands/tower.d.ts +9 -0
  54. package/dist/agent-farm/commands/tower.d.ts.map +1 -1
  55. package/dist/agent-farm/commands/tower.js +59 -19
  56. package/dist/agent-farm/commands/tower.js.map +1 -1
  57. package/dist/agent-farm/db/index.d.ts.map +1 -1
  58. package/dist/agent-farm/db/index.js +124 -0
  59. package/dist/agent-farm/db/index.js.map +1 -1
  60. package/dist/agent-farm/db/schema.d.ts +2 -2
  61. package/dist/agent-farm/db/schema.d.ts.map +1 -1
  62. package/dist/agent-farm/db/schema.js +26 -5
  63. package/dist/agent-farm/db/schema.js.map +1 -1
  64. package/dist/agent-farm/db/types.d.ts +3 -0
  65. package/dist/agent-farm/db/types.d.ts.map +1 -1
  66. package/dist/agent-farm/db/types.js +3 -0
  67. package/dist/agent-farm/db/types.js.map +1 -1
  68. package/dist/agent-farm/hq-connector.d.ts +2 -6
  69. package/dist/agent-farm/hq-connector.d.ts.map +1 -1
  70. package/dist/agent-farm/hq-connector.js +2 -17
  71. package/dist/agent-farm/hq-connector.js.map +1 -1
  72. package/dist/agent-farm/lib/tower-client.d.ts +157 -0
  73. package/dist/agent-farm/lib/tower-client.d.ts.map +1 -0
  74. package/dist/agent-farm/lib/tower-client.js +223 -0
  75. package/dist/agent-farm/lib/tower-client.js.map +1 -0
  76. package/dist/agent-farm/servers/tower-server.js +2340 -109
  77. package/dist/agent-farm/servers/tower-server.js.map +1 -1
  78. package/dist/agent-farm/state.d.ts +4 -10
  79. package/dist/agent-farm/state.d.ts.map +1 -1
  80. package/dist/agent-farm/state.js +30 -31
  81. package/dist/agent-farm/state.js.map +1 -1
  82. package/dist/agent-farm/types.d.ts +48 -1
  83. package/dist/agent-farm/types.d.ts.map +1 -1
  84. package/dist/agent-farm/utils/config.d.ts.map +1 -1
  85. package/dist/agent-farm/utils/config.js +13 -14
  86. package/dist/agent-farm/utils/config.js.map +1 -1
  87. package/dist/agent-farm/utils/deps.d.ts.map +1 -1
  88. package/dist/agent-farm/utils/deps.js +0 -16
  89. package/dist/agent-farm/utils/deps.js.map +1 -1
  90. package/dist/agent-farm/utils/notifications.d.ts +30 -0
  91. package/dist/agent-farm/utils/notifications.d.ts.map +1 -0
  92. package/dist/agent-farm/utils/notifications.js +121 -0
  93. package/dist/agent-farm/utils/notifications.js.map +1 -0
  94. package/dist/agent-farm/utils/port-registry.d.ts +0 -1
  95. package/dist/agent-farm/utils/port-registry.d.ts.map +1 -1
  96. package/dist/agent-farm/utils/port-registry.js +1 -1
  97. package/dist/agent-farm/utils/port-registry.js.map +1 -1
  98. package/dist/agent-farm/utils/server-utils.d.ts +4 -4
  99. package/dist/agent-farm/utils/server-utils.d.ts.map +1 -1
  100. package/dist/agent-farm/utils/server-utils.js +4 -15
  101. package/dist/agent-farm/utils/server-utils.js.map +1 -1
  102. package/dist/agent-farm/utils/shell.d.ts +9 -22
  103. package/dist/agent-farm/utils/shell.d.ts.map +1 -1
  104. package/dist/agent-farm/utils/shell.js +34 -34
  105. package/dist/agent-farm/utils/shell.js.map +1 -1
  106. package/dist/agent-farm/utils/terminal-ports.d.ts +1 -1
  107. package/dist/agent-farm/utils/terminal-ports.js +1 -1
  108. package/dist/cli.d.ts.map +1 -1
  109. package/dist/cli.js +9 -54
  110. package/dist/cli.js.map +1 -1
  111. package/dist/commands/adopt.d.ts.map +1 -1
  112. package/dist/commands/adopt.js +49 -4
  113. package/dist/commands/adopt.js.map +1 -1
  114. package/dist/commands/consult/index.d.ts +2 -0
  115. package/dist/commands/consult/index.d.ts.map +1 -1
  116. package/dist/commands/consult/index.js +103 -6
  117. package/dist/commands/consult/index.js.map +1 -1
  118. package/dist/commands/doctor.d.ts.map +1 -1
  119. package/dist/commands/doctor.js +0 -15
  120. package/dist/commands/doctor.js.map +1 -1
  121. package/dist/commands/init.d.ts.map +1 -1
  122. package/dist/commands/init.js +41 -2
  123. package/dist/commands/init.js.map +1 -1
  124. package/dist/commands/porch/build-counter.d.ts +5 -0
  125. package/dist/commands/porch/build-counter.d.ts.map +1 -0
  126. package/dist/commands/porch/build-counter.js +5 -0
  127. package/dist/commands/porch/build-counter.js.map +1 -0
  128. package/dist/commands/porch/checks.d.ts +17 -29
  129. package/dist/commands/porch/checks.d.ts.map +1 -1
  130. package/dist/commands/porch/checks.js +96 -144
  131. package/dist/commands/porch/checks.js.map +1 -1
  132. package/dist/commands/porch/index.d.ts +21 -43
  133. package/dist/commands/porch/index.d.ts.map +1 -1
  134. package/dist/commands/porch/index.js +418 -1123
  135. package/dist/commands/porch/index.js.map +1 -1
  136. package/dist/commands/porch/next.d.ts +22 -0
  137. package/dist/commands/porch/next.d.ts.map +1 -0
  138. package/dist/commands/porch/next.js +481 -0
  139. package/dist/commands/porch/next.js.map +1 -0
  140. package/dist/commands/porch/plan.d.ts +70 -0
  141. package/dist/commands/porch/plan.d.ts.map +1 -0
  142. package/dist/commands/porch/plan.js +190 -0
  143. package/dist/commands/porch/plan.js.map +1 -0
  144. package/dist/commands/porch/prompts.d.ts +19 -0
  145. package/dist/commands/porch/prompts.d.ts.map +1 -0
  146. package/dist/commands/porch/prompts.js +255 -0
  147. package/dist/commands/porch/prompts.js.map +1 -0
  148. package/dist/commands/porch/protocol.d.ts +59 -0
  149. package/dist/commands/porch/protocol.d.ts.map +1 -0
  150. package/dist/commands/porch/protocol.js +294 -0
  151. package/dist/commands/porch/protocol.js.map +1 -0
  152. package/dist/commands/porch/state.d.ts +23 -112
  153. package/dist/commands/porch/state.d.ts.map +1 -1
  154. package/dist/commands/porch/state.js +81 -699
  155. package/dist/commands/porch/state.js.map +1 -1
  156. package/dist/commands/porch/types.d.ts +99 -164
  157. package/dist/commands/porch/types.d.ts.map +1 -1
  158. package/dist/commands/porch/types.js +2 -1
  159. package/dist/commands/porch/types.js.map +1 -1
  160. package/dist/commands/porch/verdict.d.ts +31 -0
  161. package/dist/commands/porch/verdict.d.ts.map +1 -0
  162. package/dist/commands/porch/verdict.js +59 -0
  163. package/dist/commands/porch/verdict.js.map +1 -0
  164. package/dist/commands/update.d.ts.map +1 -1
  165. package/dist/commands/update.js +31 -0
  166. package/dist/commands/update.js.map +1 -1
  167. package/dist/lib/scaffold.d.ts +37 -0
  168. package/dist/lib/scaffold.d.ts.map +1 -1
  169. package/dist/lib/scaffold.js +114 -0
  170. package/dist/lib/scaffold.js.map +1 -1
  171. package/dist/terminal/index.d.ts +8 -0
  172. package/dist/terminal/index.d.ts.map +1 -0
  173. package/dist/terminal/index.js +5 -0
  174. package/dist/terminal/index.js.map +1 -0
  175. package/dist/terminal/pty-manager.d.ts +60 -0
  176. package/dist/terminal/pty-manager.d.ts.map +1 -0
  177. package/dist/terminal/pty-manager.js +334 -0
  178. package/dist/terminal/pty-manager.js.map +1 -0
  179. package/dist/terminal/pty-session.d.ts +79 -0
  180. package/dist/terminal/pty-session.d.ts.map +1 -0
  181. package/dist/terminal/pty-session.js +215 -0
  182. package/dist/terminal/pty-session.js.map +1 -0
  183. package/dist/terminal/ring-buffer.d.ts +27 -0
  184. package/dist/terminal/ring-buffer.d.ts.map +1 -0
  185. package/dist/terminal/ring-buffer.js +74 -0
  186. package/dist/terminal/ring-buffer.js.map +1 -0
  187. package/dist/terminal/ws-protocol.d.ts +27 -0
  188. package/dist/terminal/ws-protocol.d.ts.map +1 -0
  189. package/dist/terminal/ws-protocol.js +44 -0
  190. package/dist/terminal/ws-protocol.js.map +1 -0
  191. package/package.json +18 -5
  192. package/skeleton/.claude/skills/af/SKILL.md +74 -0
  193. package/skeleton/.claude/skills/codev/SKILL.md +41 -0
  194. package/skeleton/.claude/skills/consult/SKILL.md +81 -0
  195. package/skeleton/.claude/skills/generate-image/SKILL.md +56 -0
  196. package/skeleton/DEPENDENCIES.md +3 -29
  197. package/skeleton/builders.md +1 -1
  198. package/skeleton/consult-types/impl-review.md +9 -0
  199. package/skeleton/porch/prompts/defend.md +1 -1
  200. package/skeleton/porch/prompts/evaluate.md +2 -2
  201. package/skeleton/porch/prompts/implement.md +1 -1
  202. package/skeleton/porch/prompts/plan.md +1 -1
  203. package/skeleton/porch/prompts/review.md +4 -4
  204. package/skeleton/porch/prompts/specify.md +1 -1
  205. package/skeleton/porch/prompts/understand.md +2 -2
  206. package/skeleton/protocol-schema.json +282 -0
  207. package/skeleton/protocols/bugfix/builder-prompt.md +54 -0
  208. package/skeleton/protocols/bugfix/prompts/fix.md +77 -0
  209. package/skeleton/protocols/bugfix/prompts/investigate.md +77 -0
  210. package/skeleton/protocols/bugfix/prompts/pr.md +61 -0
  211. package/skeleton/protocols/bugfix/protocol.json +19 -2
  212. package/skeleton/protocols/experiment/builder-prompt.md +52 -0
  213. package/skeleton/protocols/experiment/protocol.json +101 -0
  214. package/skeleton/protocols/experiment/protocol.md +3 -3
  215. package/skeleton/protocols/experiment/templates/notes.md +1 -1
  216. package/skeleton/protocols/maintain/builder-prompt.md +46 -0
  217. package/skeleton/protocols/maintain/prompts/audit.md +111 -0
  218. package/skeleton/protocols/maintain/prompts/clean.md +91 -0
  219. package/skeleton/protocols/maintain/prompts/sync.md +113 -0
  220. package/skeleton/protocols/maintain/prompts/verify.md +110 -0
  221. package/skeleton/protocols/maintain/protocol.json +141 -0
  222. package/skeleton/protocols/maintain/protocol.md +14 -8
  223. package/skeleton/protocols/protocol-schema.json +54 -1
  224. package/skeleton/protocols/spir/builder-prompt.md +59 -0
  225. package/skeleton/protocols/spir/prompts/implement.md +208 -0
  226. package/skeleton/protocols/{spider → spir}/prompts/plan.md +6 -70
  227. package/skeleton/protocols/{spider → spir}/prompts/review.md +7 -25
  228. package/skeleton/protocols/{spider → spir}/prompts/specify.md +33 -61
  229. package/skeleton/protocols/spir/protocol.json +152 -0
  230. package/skeleton/protocols/{spider → spir}/protocol.md +35 -21
  231. package/skeleton/protocols/{spider → spir}/templates/plan.md +14 -0
  232. package/skeleton/protocols/{spider → spir}/templates/review.md +1 -1
  233. package/skeleton/protocols/tick/builder-prompt.md +56 -0
  234. package/skeleton/protocols/tick/protocol.json +7 -2
  235. package/skeleton/protocols/tick/protocol.md +18 -18
  236. package/skeleton/protocols/tick/templates/review.md +1 -1
  237. package/skeleton/resources/commands/agent-farm.md +25 -43
  238. package/skeleton/resources/commands/overview.md +7 -17
  239. package/skeleton/resources/workflow-reference.md +4 -4
  240. package/skeleton/roles/architect.md +152 -315
  241. package/skeleton/roles/builder.md +109 -218
  242. package/skeleton/templates/AGENTS.md +2 -2
  243. package/skeleton/templates/CLAUDE.md +2 -2
  244. package/skeleton/templates/cheatsheet.md +7 -5
  245. package/skeleton/templates/projectlist.md +1 -1
  246. package/templates/dashboard/index.html +17 -43
  247. package/templates/dashboard/js/dialogs.js +7 -7
  248. package/templates/dashboard/js/files.js +2 -2
  249. package/templates/dashboard/js/main.js +4 -4
  250. package/templates/dashboard/js/projects.js +3 -3
  251. package/templates/dashboard/js/tabs.js +1 -1
  252. package/templates/dashboard/js/utils.js +22 -87
  253. package/templates/open.html +26 -0
  254. package/templates/tower.html +542 -27
  255. package/dist/agent-farm/commands/kickoff.d.ts +0 -19
  256. package/dist/agent-farm/commands/kickoff.d.ts.map +0 -1
  257. package/dist/agent-farm/commands/kickoff.js +0 -331
  258. package/dist/agent-farm/commands/kickoff.js.map +0 -1
  259. package/dist/agent-farm/commands/rename.d.ts +0 -13
  260. package/dist/agent-farm/commands/rename.d.ts.map +0 -1
  261. package/dist/agent-farm/commands/rename.js +0 -33
  262. package/dist/agent-farm/commands/rename.js.map +0 -1
  263. package/dist/agent-farm/commands/tutorial.d.ts +0 -10
  264. package/dist/agent-farm/commands/tutorial.d.ts.map +0 -1
  265. package/dist/agent-farm/commands/tutorial.js +0 -49
  266. package/dist/agent-farm/commands/tutorial.js.map +0 -1
  267. package/dist/agent-farm/commands/util.d.ts +0 -15
  268. package/dist/agent-farm/commands/util.d.ts.map +0 -1
  269. package/dist/agent-farm/commands/util.js +0 -108
  270. package/dist/agent-farm/commands/util.js.map +0 -1
  271. package/dist/agent-farm/servers/dashboard-server.d.ts +0 -7
  272. package/dist/agent-farm/servers/dashboard-server.d.ts.map +0 -1
  273. package/dist/agent-farm/servers/dashboard-server.js +0 -1872
  274. package/dist/agent-farm/servers/dashboard-server.js.map +0 -1
  275. package/dist/agent-farm/servers/open-server.d.ts +0 -7
  276. package/dist/agent-farm/servers/open-server.d.ts.map +0 -1
  277. package/dist/agent-farm/servers/open-server.js +0 -315
  278. package/dist/agent-farm/servers/open-server.js.map +0 -1
  279. package/dist/agent-farm/tutorial/index.d.ts +0 -8
  280. package/dist/agent-farm/tutorial/index.d.ts.map +0 -1
  281. package/dist/agent-farm/tutorial/index.js +0 -8
  282. package/dist/agent-farm/tutorial/index.js.map +0 -1
  283. package/dist/agent-farm/tutorial/prompts.d.ts +0 -57
  284. package/dist/agent-farm/tutorial/prompts.d.ts.map +0 -1
  285. package/dist/agent-farm/tutorial/prompts.js +0 -147
  286. package/dist/agent-farm/tutorial/prompts.js.map +0 -1
  287. package/dist/agent-farm/tutorial/runner.d.ts +0 -52
  288. package/dist/agent-farm/tutorial/runner.d.ts.map +0 -1
  289. package/dist/agent-farm/tutorial/runner.js +0 -204
  290. package/dist/agent-farm/tutorial/runner.js.map +0 -1
  291. package/dist/agent-farm/tutorial/state.d.ts +0 -26
  292. package/dist/agent-farm/tutorial/state.d.ts.map +0 -1
  293. package/dist/agent-farm/tutorial/state.js +0 -89
  294. package/dist/agent-farm/tutorial/state.js.map +0 -1
  295. package/dist/agent-farm/tutorial/steps/first-spec.d.ts +0 -7
  296. package/dist/agent-farm/tutorial/steps/first-spec.d.ts.map +0 -1
  297. package/dist/agent-farm/tutorial/steps/first-spec.js +0 -136
  298. package/dist/agent-farm/tutorial/steps/first-spec.js.map +0 -1
  299. package/dist/agent-farm/tutorial/steps/implementation.d.ts +0 -7
  300. package/dist/agent-farm/tutorial/steps/implementation.d.ts.map +0 -1
  301. package/dist/agent-farm/tutorial/steps/implementation.js +0 -76
  302. package/dist/agent-farm/tutorial/steps/implementation.js.map +0 -1
  303. package/dist/agent-farm/tutorial/steps/index.d.ts +0 -10
  304. package/dist/agent-farm/tutorial/steps/index.d.ts.map +0 -1
  305. package/dist/agent-farm/tutorial/steps/index.js +0 -10
  306. package/dist/agent-farm/tutorial/steps/index.js.map +0 -1
  307. package/dist/agent-farm/tutorial/steps/planning.d.ts +0 -7
  308. package/dist/agent-farm/tutorial/steps/planning.d.ts.map +0 -1
  309. package/dist/agent-farm/tutorial/steps/planning.js +0 -143
  310. package/dist/agent-farm/tutorial/steps/planning.js.map +0 -1
  311. package/dist/agent-farm/tutorial/steps/review.d.ts +0 -7
  312. package/dist/agent-farm/tutorial/steps/review.d.ts.map +0 -1
  313. package/dist/agent-farm/tutorial/steps/review.js +0 -78
  314. package/dist/agent-farm/tutorial/steps/review.js.map +0 -1
  315. package/dist/agent-farm/tutorial/steps/setup.d.ts +0 -7
  316. package/dist/agent-farm/tutorial/steps/setup.d.ts.map +0 -1
  317. package/dist/agent-farm/tutorial/steps/setup.js +0 -126
  318. package/dist/agent-farm/tutorial/steps/setup.js.map +0 -1
  319. package/dist/agent-farm/tutorial/steps/welcome.d.ts +0 -7
  320. package/dist/agent-farm/tutorial/steps/welcome.d.ts.map +0 -1
  321. package/dist/agent-farm/tutorial/steps/welcome.js +0 -50
  322. package/dist/agent-farm/tutorial/steps/welcome.js.map +0 -1
  323. package/dist/commands/pcheck/cache.d.ts +0 -48
  324. package/dist/commands/pcheck/cache.d.ts.map +0 -1
  325. package/dist/commands/pcheck/cache.js +0 -170
  326. package/dist/commands/pcheck/cache.js.map +0 -1
  327. package/dist/commands/pcheck/evaluator.d.ts +0 -15
  328. package/dist/commands/pcheck/evaluator.d.ts.map +0 -1
  329. package/dist/commands/pcheck/evaluator.js +0 -246
  330. package/dist/commands/pcheck/evaluator.js.map +0 -1
  331. package/dist/commands/pcheck/index.d.ts +0 -12
  332. package/dist/commands/pcheck/index.d.ts.map +0 -1
  333. package/dist/commands/pcheck/index.js +0 -249
  334. package/dist/commands/pcheck/index.js.map +0 -1
  335. package/dist/commands/pcheck/parser.d.ts +0 -39
  336. package/dist/commands/pcheck/parser.d.ts.map +0 -1
  337. package/dist/commands/pcheck/parser.js +0 -155
  338. package/dist/commands/pcheck/parser.js.map +0 -1
  339. package/dist/commands/pcheck/types.d.ts +0 -82
  340. package/dist/commands/pcheck/types.d.ts.map +0 -1
  341. package/dist/commands/pcheck/types.js +0 -5
  342. package/dist/commands/pcheck/types.js.map +0 -1
  343. package/dist/commands/porch/consultation.d.ts +0 -56
  344. package/dist/commands/porch/consultation.d.ts.map +0 -1
  345. package/dist/commands/porch/consultation.js +0 -330
  346. package/dist/commands/porch/consultation.js.map +0 -1
  347. package/dist/commands/porch/notifications.d.ts +0 -99
  348. package/dist/commands/porch/notifications.d.ts.map +0 -1
  349. package/dist/commands/porch/notifications.js +0 -223
  350. package/dist/commands/porch/notifications.js.map +0 -1
  351. package/dist/commands/porch/plan-parser.d.ts +0 -38
  352. package/dist/commands/porch/plan-parser.d.ts.map +0 -1
  353. package/dist/commands/porch/plan-parser.js +0 -166
  354. package/dist/commands/porch/plan-parser.js.map +0 -1
  355. package/dist/commands/porch/protocol-loader.d.ts +0 -46
  356. package/dist/commands/porch/protocol-loader.d.ts.map +0 -1
  357. package/dist/commands/porch/protocol-loader.js +0 -253
  358. package/dist/commands/porch/protocol-loader.js.map +0 -1
  359. package/dist/commands/porch/signal-parser.d.ts +0 -88
  360. package/dist/commands/porch/signal-parser.d.ts.map +0 -1
  361. package/dist/commands/porch/signal-parser.js +0 -148
  362. package/dist/commands/porch/signal-parser.js.map +0 -1
  363. package/dist/commands/tower.d.ts +0 -16
  364. package/dist/commands/tower.d.ts.map +0 -1
  365. package/dist/commands/tower.js +0 -21
  366. package/dist/commands/tower.js.map +0 -1
  367. package/skeleton/config.json +0 -7
  368. package/skeleton/porch/protocols/bugfix.json +0 -85
  369. package/skeleton/porch/protocols/spider.json +0 -135
  370. package/skeleton/porch/protocols/tick.json +0 -76
  371. package/skeleton/protocols/spider/prompts/defend.md +0 -215
  372. package/skeleton/protocols/spider/prompts/evaluate.md +0 -241
  373. package/skeleton/protocols/spider/prompts/implement.md +0 -149
  374. package/skeleton/protocols/spider/protocol.json +0 -210
  375. package/templates/dashboard/css/activity.css +0 -151
  376. package/templates/dashboard/js/activity.js +0 -112
  377. /package/skeleton/protocols/{spider → spir}/templates/spec.md +0 -0
@@ -0,0 +1,481 @@
1
+ /**
2
+ * porch next - Pure planner for protocol execution.
3
+ *
4
+ * Given the current state (status.yaml + filesystem), emits structured
5
+ * JSON task definitions for the builder to execute. No subprocess spawning,
6
+ * no while loop — just read state, compute tasks, output JSON.
7
+ *
8
+ * The builder loop:
9
+ * porch next → execute tasks → porch done → porch next → ...
10
+ */
11
+ import * as fs from 'node:fs';
12
+ import * as path from 'node:path';
13
+ import { globSync } from 'glob';
14
+ import { readState, writeState, findStatusPath, getProjectDir } from './state.js';
15
+ import { loadProtocol, getPhaseConfig, getNextPhase, getPhaseGate, isPhased, isBuildVerify, getBuildConfig, getVerifyConfig, getMaxIterations, getPhaseChecks, } from './protocol.js';
16
+ import { findPlanFile, extractPhasesFromFile, getCurrentPlanPhase, advancePlanPhase, } from './plan.js';
17
+ import { buildPhasePrompt } from './prompts.js';
18
+ import { parseVerdict, allApprove } from './verdict.js';
19
+ /**
20
+ * Check if an artifact file has YAML frontmatter indicating it was
21
+ * already approved and validated (3-way review).
22
+ *
23
+ * Frontmatter format:
24
+ * ---
25
+ * approved: 2026-01-29
26
+ * validated: [gemini, codex, claude]
27
+ * ---
28
+ */
29
+ function isArtifactPreApproved(projectRoot, artifactGlob) {
30
+ const matches = globSync(artifactGlob, { cwd: projectRoot });
31
+ if (matches.length === 0)
32
+ return false;
33
+ const filePath = path.join(projectRoot, matches[0]);
34
+ try {
35
+ const content = fs.readFileSync(filePath, 'utf-8');
36
+ const frontmatterMatch = content.match(/^---\n([\s\S]*?)\n---/);
37
+ if (!frontmatterMatch)
38
+ return false;
39
+ const frontmatter = frontmatterMatch[1];
40
+ const hasApproved = /^approved:\s*.+$/m.test(frontmatter);
41
+ const hasValidated = /^validated:\s*\[.+\]$/m.test(frontmatter);
42
+ return hasApproved && hasValidated;
43
+ }
44
+ catch {
45
+ return false;
46
+ }
47
+ }
48
+ /**
49
+ * Find review files for the current iteration in the project directory.
50
+ * Review files are created by the `consult` CLI and follow the pattern:
51
+ * <id>-<phase>-iter<N>-<model>.txt
52
+ */
53
+ function findReviewFiles(projectRoot, state, verifyModels) {
54
+ const projectDir = getProjectDir(projectRoot, state.id, state.title);
55
+ if (!fs.existsSync(projectDir))
56
+ return [];
57
+ const results = [];
58
+ const phase = state.current_plan_phase || state.phase;
59
+ for (const model of verifyModels) {
60
+ const fileName = `${state.id}-${phase}-iter${state.iteration}-${model}.txt`;
61
+ const filePath = path.join(projectDir, fileName);
62
+ if (fs.existsSync(filePath)) {
63
+ const content = fs.readFileSync(filePath, 'utf-8');
64
+ const verdict = parseVerdict(content);
65
+ results.push({ model, verdict, file: filePath });
66
+ }
67
+ }
68
+ return results;
69
+ }
70
+ /**
71
+ * Compute the expected review file path for a given model.
72
+ * This must match the pattern used by findReviewFiles().
73
+ */
74
+ function getReviewFilePath(projectRoot, state, model) {
75
+ const projectDir = getProjectDir(projectRoot, state.id, state.title);
76
+ const phase = state.current_plan_phase || state.phase;
77
+ const fileName = `${state.id}-${phase}-iter${state.iteration}-${model}.txt`;
78
+ return path.join(projectDir, fileName);
79
+ }
80
+ /**
81
+ * Compute the next tasks for a project.
82
+ *
83
+ * This is a pure planner — it reads state and filesystem, infers what
84
+ * happened since the last call, and emits the next batch of tasks.
85
+ *
86
+ * State is only mutated when completed work is detected (filesystem-as-truth).
87
+ * If called twice without filesystem changes, returns the same output.
88
+ */
89
+ export async function next(projectRoot, projectId) {
90
+ const statusPath = findStatusPath(projectRoot, projectId);
91
+ if (!statusPath) {
92
+ return {
93
+ status: 'error',
94
+ phase: 'unknown',
95
+ iteration: 0,
96
+ error: `Project ${projectId} not found. Run 'porch init' to create a new project.`,
97
+ };
98
+ }
99
+ const state = readState(statusPath);
100
+ const protocol = loadProtocol(projectRoot, state.protocol);
101
+ const phaseConfig = getPhaseConfig(protocol, state.phase);
102
+ // Protocol complete
103
+ if (state.phase === 'complete' || !phaseConfig) {
104
+ return {
105
+ status: 'complete',
106
+ phase: state.phase,
107
+ iteration: state.iteration,
108
+ summary: `Project ${state.id} has completed the ${state.protocol} protocol.`,
109
+ tasks: [{
110
+ subject: 'Merge the pull request',
111
+ activeForm: 'Merging pull request',
112
+ description: `The protocol is complete. Merge the PR using:\n\ngh pr merge --merge\n\nDo NOT squash merge. Use regular merge commits to preserve development history.\n\nAfter merging, notify the architect that the work is complete.`,
113
+ sequential: true,
114
+ }],
115
+ };
116
+ }
117
+ // Check for pre-approved artifacts (skip build+verify)
118
+ if (isBuildVerify(protocol, state.phase) && !state.build_complete && state.iteration === 1) {
119
+ const buildConfig = getBuildConfig(protocol, state.phase);
120
+ if (buildConfig?.artifact) {
121
+ const artifactGlob = buildConfig.artifact.replace('${PROJECT_ID}', state.id);
122
+ if (isArtifactPreApproved(projectRoot, artifactGlob)) {
123
+ // Auto-approve gate and advance
124
+ const gateName = getPhaseGate(protocol, state.phase);
125
+ if (gateName) {
126
+ state.gates[gateName] = { status: 'approved', approved_at: new Date().toISOString() };
127
+ }
128
+ // Advance to next phase
129
+ const nextPhase = getNextPhase(protocol, state.phase);
130
+ if (nextPhase) {
131
+ state.phase = nextPhase.id;
132
+ // If entering phased protocol, extract plan phases
133
+ if (isPhased(protocol, nextPhase.id)) {
134
+ const planPath = findPlanFile(projectRoot, state.id, state.title);
135
+ if (planPath) {
136
+ state.plan_phases = extractPhasesFromFile(planPath);
137
+ if (state.plan_phases.length > 0) {
138
+ state.current_plan_phase = state.plan_phases[0].id;
139
+ }
140
+ }
141
+ }
142
+ state.iteration = 1;
143
+ state.build_complete = false;
144
+ state.history = [];
145
+ writeState(statusPath, state);
146
+ // Recurse to compute tasks for the new phase
147
+ return next(projectRoot, projectId);
148
+ }
149
+ }
150
+ }
151
+ }
152
+ // Check gate status
153
+ const gateName = getPhaseGate(protocol, state.phase);
154
+ if (gateName) {
155
+ const gateStatus = state.gates[gateName];
156
+ // Gate pending and requested — tell builder to wait
157
+ if (gateStatus?.status === 'pending' && gateStatus?.requested_at) {
158
+ return {
159
+ status: 'gate_pending',
160
+ phase: state.phase,
161
+ iteration: state.iteration,
162
+ plan_phase: state.current_plan_phase || undefined,
163
+ gate: gateName,
164
+ tasks: [{
165
+ subject: `Request human approval: ${gateName}`,
166
+ activeForm: `Requesting ${gateName} approval`,
167
+ description: `Run: porch gate ${state.id}\nThis will open the artifact for human review.\nSTOP and wait for human approval before proceeding.`,
168
+ }],
169
+ };
170
+ }
171
+ // Gate approved — advance to next phase
172
+ if (gateStatus?.status === 'approved') {
173
+ const nextPhase = getNextPhase(protocol, state.phase);
174
+ if (!nextPhase) {
175
+ state.phase = 'complete';
176
+ writeState(statusPath, state);
177
+ return next(projectRoot, projectId);
178
+ }
179
+ state.phase = nextPhase.id;
180
+ state.iteration = 1;
181
+ state.build_complete = false;
182
+ state.history = [];
183
+ // If entering phased protocol, extract plan phases
184
+ if (isPhased(protocol, nextPhase.id)) {
185
+ const planPath = findPlanFile(projectRoot, state.id, state.title);
186
+ if (planPath) {
187
+ state.plan_phases = extractPhasesFromFile(planPath);
188
+ if (state.plan_phases.length > 0) {
189
+ state.current_plan_phase = state.plan_phases[0].id;
190
+ }
191
+ }
192
+ }
193
+ writeState(statusPath, state);
194
+ return next(projectRoot, projectId);
195
+ }
196
+ }
197
+ // Handle build_verify / per_plan_phase phases
198
+ if (isBuildVerify(protocol, state.phase)) {
199
+ return await handleBuildVerify(projectRoot, projectId, state, protocol, phaseConfig, statusPath);
200
+ }
201
+ // Handle 'once' phases (TICK, BUGFIX)
202
+ return handleOncePhase(projectRoot, state, protocol, phaseConfig);
203
+ }
204
+ /**
205
+ * Handle build_verify and per_plan_phase phases.
206
+ */
207
+ async function handleBuildVerify(projectRoot, projectId, state, protocol, phaseConfig, statusPath) {
208
+ const verifyConfig = getVerifyConfig(protocol, state.phase);
209
+ const maxIterations = getMaxIterations(protocol, state.phase);
210
+ // Determine plan phase context for per_plan_phase protocols
211
+ const planPhase = isPhased(protocol, state.phase)
212
+ ? getCurrentPlanPhase(state.plan_phases)
213
+ : null;
214
+ const baseResponse = {
215
+ phase: state.phase,
216
+ iteration: state.iteration,
217
+ plan_phase: planPhase?.id || state.current_plan_phase || undefined,
218
+ };
219
+ // --- NEED BUILD ---
220
+ if (!state.build_complete) {
221
+ const prompt = buildPhasePrompt(projectRoot, state, protocol);
222
+ const tasks = [];
223
+ // Main build task with full phase prompt
224
+ if (state.iteration === 1) {
225
+ tasks.push({
226
+ subject: `${phaseConfig.name}: Build artifact`,
227
+ activeForm: `Building ${phaseConfig.name.toLowerCase()} artifact`,
228
+ description: prompt,
229
+ sequential: true,
230
+ });
231
+ }
232
+ else {
233
+ tasks.push({
234
+ subject: `${phaseConfig.name}: Fix issues from iteration ${state.iteration - 1}`,
235
+ activeForm: `Fixing ${phaseConfig.name.toLowerCase()} issues (iteration ${state.iteration})`,
236
+ description: prompt,
237
+ sequential: true,
238
+ });
239
+ }
240
+ // Add check tasks
241
+ const checks = getPhaseChecks(protocol, state.phase);
242
+ for (const [name, checkDef] of Object.entries(checks)) {
243
+ const cwdNote = checkDef.cwd ? `\n\nIMPORTANT: Run this from the \`${checkDef.cwd}\` subdirectory (relative to project root).` : '';
244
+ tasks.push({
245
+ subject: `Run check: ${name}`,
246
+ activeForm: `Running ${name} check`,
247
+ description: `Run: ${checkDef.command}${cwdNote}\n\nFix any failures before proceeding.`,
248
+ sequential: true,
249
+ });
250
+ }
251
+ // Signal completion
252
+ tasks.push({
253
+ subject: `Signal build complete`,
254
+ activeForm: 'Signaling build complete',
255
+ description: `Run: porch done ${state.id}\n\nThis validates checks and marks the build as complete for verification.`,
256
+ sequential: true,
257
+ });
258
+ return { status: 'tasks', ...baseResponse, tasks };
259
+ }
260
+ // --- NEED VERIFY ---
261
+ if (state.build_complete && verifyConfig) {
262
+ const reviews = findReviewFiles(projectRoot, state, verifyConfig.models);
263
+ // No review files yet — emit consultation tasks
264
+ if (reviews.length === 0) {
265
+ const tasks = [];
266
+ // Build consultation commands with --output so review files land where porch expects them
267
+ const consultType = getConsultArtifactType(state.phase);
268
+ const planPhaseFlag = state.current_plan_phase ? ` --plan-phase ${state.current_plan_phase}` : '';
269
+ const consultCmds = verifyConfig.models.map(m => `consult --model ${m} --type ${verifyConfig.type}${planPhaseFlag} --output "${getReviewFilePath(projectRoot, state, m)}" ${consultType} ${state.id}`);
270
+ tasks.push({
271
+ subject: `Run ${verifyConfig.models.length}-way consultation`,
272
+ activeForm: `Running ${verifyConfig.models.length}-way consultation`,
273
+ description: `Run these commands in parallel in the background:\n\n${consultCmds.join('\n')}\n\nWait for all to complete, then call \`porch next ${state.id}\` to get the next step.`,
274
+ });
275
+ return { status: 'tasks', ...baseResponse, tasks };
276
+ }
277
+ // Review files exist — check if all models reviewed
278
+ if (reviews.length < verifyConfig.models.length) {
279
+ // Partial reviews — still waiting. Emit same consultation tasks (idempotent).
280
+ const consultType = getConsultArtifactType(state.phase);
281
+ const missingModels = verifyConfig.models.filter(m => !reviews.find(r => r.model === m));
282
+ const planPhaseFlagPartial = state.current_plan_phase ? ` --plan-phase ${state.current_plan_phase}` : '';
283
+ const consultCmds = missingModels.map(m => `consult --model ${m} --type ${verifyConfig.type}${planPhaseFlagPartial} --output "${getReviewFilePath(projectRoot, state, m)}" ${consultType} ${state.id}`);
284
+ return {
285
+ status: 'tasks',
286
+ ...baseResponse,
287
+ tasks: [{
288
+ subject: `Run remaining consultations (${missingModels.join(', ')})`,
289
+ activeForm: `Running remaining consultations`,
290
+ description: `Some consultations are still missing. Run:\n\n${consultCmds.join('\n')}\n\nThen call \`porch next ${state.id}\` again.`,
291
+ }],
292
+ };
293
+ }
294
+ // All reviews in — parse verdicts and decide
295
+ if (allApprove(reviews)) {
296
+ // All approve — advance
297
+ return await handleVerifyApproved(projectRoot, projectId, state, protocol, statusPath, reviews);
298
+ }
299
+ // Some request changes
300
+ if (state.iteration >= maxIterations) {
301
+ // Max iterations — proceed to gate anyway
302
+ const gateName = getPhaseGate(protocol, state.phase);
303
+ if (gateName && state.gates[gateName]?.status !== 'approved') {
304
+ state.gates[gateName] = { status: 'pending', requested_at: new Date().toISOString() };
305
+ state.build_complete = false;
306
+ state.iteration = 1;
307
+ state.history = [];
308
+ writeState(statusPath, state);
309
+ return {
310
+ status: 'gate_pending',
311
+ phase: state.phase,
312
+ iteration: state.iteration,
313
+ plan_phase: state.current_plan_phase || undefined,
314
+ gate: gateName,
315
+ tasks: [{
316
+ subject: `Request human approval: ${gateName} (max iterations reached)`,
317
+ activeForm: `Requesting ${gateName} approval`,
318
+ description: `Max iterations (${maxIterations}) reached without unanimous approval.\n\nReviewer verdicts:\n${formatVerdicts(reviews)}\n\nRun: porch gate ${state.id}\nSTOP and wait for human approval.`,
319
+ }],
320
+ };
321
+ }
322
+ }
323
+ // Increment iteration and emit fix tasks
324
+ state.iteration++;
325
+ state.build_complete = false;
326
+ // Record reviews in history (scoped by plan_phase for disambiguation)
327
+ const currentPhase = state.current_plan_phase || undefined;
328
+ const existingRecord = state.history.find(h => h.iteration === state.iteration - 1 &&
329
+ (h.plan_phase || undefined) === currentPhase);
330
+ if (existingRecord) {
331
+ existingRecord.reviews = reviews;
332
+ }
333
+ else {
334
+ state.history.push({
335
+ iteration: state.iteration - 1,
336
+ plan_phase: currentPhase,
337
+ build_output: '',
338
+ reviews,
339
+ });
340
+ }
341
+ writeState(statusPath, state);
342
+ // Emit fix tasks (prompt will include history with feedback)
343
+ const prompt = buildPhasePrompt(projectRoot, state, protocol);
344
+ return {
345
+ status: 'tasks',
346
+ phase: state.phase,
347
+ iteration: state.iteration,
348
+ plan_phase: state.current_plan_phase || undefined,
349
+ tasks: [
350
+ {
351
+ subject: `${phaseConfig.name}: Fix issues from review (iteration ${state.iteration})`,
352
+ activeForm: `Fixing review issues (iteration ${state.iteration})`,
353
+ description: prompt,
354
+ sequential: true,
355
+ },
356
+ {
357
+ subject: `Signal build complete`,
358
+ activeForm: 'Signaling build complete',
359
+ description: `Run: porch done ${state.id}\n\nThis validates checks and marks the build as complete for re-verification.`,
360
+ sequential: true,
361
+ },
362
+ ],
363
+ };
364
+ }
365
+ // build_complete but no verifyConfig — shouldn't happen for build_verify, but handle gracefully
366
+ return {
367
+ status: 'error',
368
+ phase: state.phase,
369
+ iteration: state.iteration,
370
+ error: `Phase ${state.phase} has build_complete=true but no verify config.`,
371
+ };
372
+ }
373
+ /**
374
+ * Handle the case where all reviewers approve.
375
+ * Advances plan phase or requests gate.
376
+ */
377
+ async function handleVerifyApproved(projectRoot, projectId, state, protocol, statusPath, reviews) {
378
+ const gateName = getPhaseGate(protocol, state.phase);
379
+ // For per_plan_phase: advance to next plan phase (no gate between phases)
380
+ if (isPhased(protocol, state.phase) && state.plan_phases.length > 0) {
381
+ const currentPlanPhase = getCurrentPlanPhase(state.plan_phases);
382
+ if (currentPlanPhase) {
383
+ const { phases: updatedPhases, moveToReview } = advancePlanPhase(state.plan_phases, currentPlanPhase.id);
384
+ state.plan_phases = updatedPhases;
385
+ state.build_complete = false;
386
+ state.iteration = 1;
387
+ // Preserve history across plan phases for audit trail
388
+ // (plan_phase field on each entry disambiguates iterations)
389
+ if (moveToReview) {
390
+ // All plan phases done — move to review
391
+ state.phase = 'review';
392
+ state.current_plan_phase = null;
393
+ writeState(statusPath, state);
394
+ return next(projectRoot, projectId);
395
+ }
396
+ // Next plan phase
397
+ const newCurrent = getCurrentPlanPhase(state.plan_phases);
398
+ state.current_plan_phase = newCurrent?.id || null;
399
+ writeState(statusPath, state);
400
+ return next(projectRoot, projectId);
401
+ }
402
+ }
403
+ // Request gate (for non-phased phases like specify, plan, review)
404
+ if (gateName) {
405
+ state.gates[gateName] = { status: 'pending', requested_at: new Date().toISOString() };
406
+ state.build_complete = false;
407
+ state.iteration = 1;
408
+ state.history = [];
409
+ writeState(statusPath, state);
410
+ return {
411
+ status: 'gate_pending',
412
+ phase: state.phase,
413
+ iteration: 1,
414
+ gate: gateName,
415
+ tasks: [{
416
+ subject: `Request human approval: ${gateName}`,
417
+ activeForm: `Requesting ${gateName} approval`,
418
+ description: `All reviewers approved!\n\nReviewer verdicts:\n${formatVerdicts(reviews)}\n\nRun: porch gate ${state.id}\nSTOP and wait for human approval.`,
419
+ }],
420
+ };
421
+ }
422
+ // No gate — advance to next phase directly
423
+ const nextPhase = getNextPhase(protocol, state.phase);
424
+ if (!nextPhase) {
425
+ state.phase = 'complete';
426
+ writeState(statusPath, state);
427
+ return next(projectRoot, projectId);
428
+ }
429
+ state.phase = nextPhase.id;
430
+ state.iteration = 1;
431
+ state.build_complete = false;
432
+ state.history = [];
433
+ writeState(statusPath, state);
434
+ return next(projectRoot, projectId);
435
+ }
436
+ /**
437
+ * Handle 'once' phases (TICK, BUGFIX).
438
+ * These don't have build/verify config — emit a single task.
439
+ */
440
+ function handleOncePhase(projectRoot, state, protocol, phaseConfig) {
441
+ // Try to load a prompt file for this phase
442
+ const prompt = buildPhasePrompt(projectRoot, state, protocol);
443
+ // If prompt is just a generic fallback, try to use phase steps from protocol
444
+ let description = prompt;
445
+ if (phaseConfig.checks && phaseConfig.checks.length > 0) {
446
+ description += `\n\nAfter completing the work, run these checks:\n${phaseConfig.checks.map(c => `- ${c}`).join('\n')}`;
447
+ }
448
+ description += `\n\nWhen complete, run: porch done ${state.id}`;
449
+ return {
450
+ status: 'tasks',
451
+ phase: state.phase,
452
+ iteration: state.iteration,
453
+ tasks: [{
454
+ subject: `${phaseConfig.name}: Complete phase work`,
455
+ activeForm: `Working on ${phaseConfig.name.toLowerCase()}`,
456
+ description,
457
+ sequential: true,
458
+ }],
459
+ };
460
+ }
461
+ /**
462
+ * Get the consult artifact type for a phase.
463
+ */
464
+ function getConsultArtifactType(phaseId) {
465
+ switch (phaseId) {
466
+ case 'specify': return 'spec';
467
+ case 'plan': return 'plan';
468
+ case 'implement': return 'impl';
469
+ case 'review': return 'review';
470
+ default: return 'spec';
471
+ }
472
+ }
473
+ /**
474
+ * Format review verdicts for display.
475
+ */
476
+ function formatVerdicts(reviews) {
477
+ return reviews
478
+ .map(r => ` ${r.model}: ${r.verdict}`)
479
+ .join('\n');
480
+ }
481
+ //# sourceMappingURL=next.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"next.js","sourceRoot":"","sources":["../../../src/commands/porch/next.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAClF,OAAO,EACL,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,QAAQ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1,70 @@
1
+ /**
2
+ * Porch Plan Parsing
3
+ *
4
+ * Extracts implementation phases from plan.md files.
5
+ * Looks for `### Phase N: <title>` headers or JSON phases block.
6
+ *
7
+ * Plan phases are simple: pending → in_progress → complete.
8
+ * All checks (implement, defend, evaluate) run together at the end.
9
+ */
10
+ import type { PlanPhase } from './types.js';
11
+ /**
12
+ * Find the plan file for a project
13
+ * Searches both legacy (codev/plans/NNNN-name.md) and new (codev/projects/NNNN-name/plan.md) locations
14
+ */
15
+ export declare function findPlanFile(projectRoot: string, projectId: string, projectName?: string): string | null;
16
+ /**
17
+ * Extract phases from plan markdown content
18
+ * Returns phases with status 'pending'
19
+ *
20
+ * Supports two formats:
21
+ *
22
+ * 1. JSON code block:
23
+ * ```json
24
+ * {"phases": [{"id": "phase_1", "title": "..."}, ...]}
25
+ * ```
26
+ *
27
+ * 2. Markdown headers (fallback):
28
+ * ## Phase 1: Core Types
29
+ * ## Phase 2: State Management
30
+ *
31
+ * Also matches "---" separated sections with "## Phase N:" headers.
32
+ */
33
+ export declare function extractPlanPhases(planContent: string): PlanPhase[];
34
+ /**
35
+ * Extract phases from a plan file
36
+ * Fails loudly if file doesn't exist
37
+ */
38
+ export declare function extractPhasesFromFile(planFilePath: string): PlanPhase[];
39
+ /**
40
+ * Check if a plan phase is complete
41
+ */
42
+ export declare function isPlanPhaseComplete(phase: PlanPhase): boolean;
43
+ /**
44
+ * Get the current plan phase (first non-complete phase)
45
+ */
46
+ export declare function getCurrentPlanPhase(phases: PlanPhase[]): PlanPhase | null;
47
+ /**
48
+ * Get the next plan phase after a given phase
49
+ */
50
+ export declare function getNextPlanPhase(phases: PlanPhase[], currentPhaseId: string): PlanPhase | null;
51
+ /**
52
+ * Check if all plan phases are complete
53
+ */
54
+ export declare function allPlanPhasesComplete(phases: PlanPhase[]): boolean;
55
+ /**
56
+ * Advance to the next plan phase
57
+ * Marks current phase complete and next phase in_progress
58
+ * Returns updated phases array and whether to move to review
59
+ */
60
+ export declare function advancePlanPhase(phases: PlanPhase[], currentPhaseId: string): {
61
+ phases: PlanPhase[];
62
+ moveToReview: boolean;
63
+ };
64
+ /**
65
+ * Get phase content from plan (the text under the phase header)
66
+ * Matches both ## and ### phase headers, and terminates at the next
67
+ * phase header of same or higher level, or a "---" separator.
68
+ */
69
+ export declare function getPhaseContent(planContent: string, phaseId: string): string | null;
70
+ //# sourceMappingURL=plan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../../src/commands/porch/plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAM5C;;;GAGG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAyBxG;AAMD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,EAAE,CA6ClE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,EAAE,CAOvE;AAMD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAE7D;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,SAAS,GAAG,IAAI,CAOzE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,cAAc,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAM9F;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAElE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,SAAS,EAAE,EACnB,cAAc,EAAE,MAAM,GACrB;IAAE,MAAM,EAAE,SAAS,EAAE,CAAC;IAAC,YAAY,EAAE,OAAO,CAAA;CAAE,CAoBhD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAenF"}