@cluesmith/codev 2.0.0-rc.7 → 2.0.0-rc.70

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 (456) 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-C7FtNK6Y.css +32 -0
  5. package/dashboard/dist/assets/index-CDAINZKT.js +131 -0
  6. package/dashboard/dist/assets/index-CDAINZKT.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 +173 -118
  10. package/dist/agent-farm/cli.js.map +1 -1
  11. package/dist/agent-farm/commands/architect.d.ts +3 -3
  12. package/dist/agent-farm/commands/architect.d.ts.map +1 -1
  13. package/dist/agent-farm/commands/architect.js +20 -147
  14. package/dist/agent-farm/commands/architect.js.map +1 -1
  15. package/dist/agent-farm/commands/attach.d.ts +13 -0
  16. package/dist/agent-farm/commands/attach.d.ts.map +1 -0
  17. package/dist/agent-farm/commands/attach.js +144 -0
  18. package/dist/agent-farm/commands/attach.js.map +1 -0
  19. package/dist/agent-farm/commands/cleanup.d.ts.map +1 -1
  20. package/dist/agent-farm/commands/cleanup.js +35 -19
  21. package/dist/agent-farm/commands/cleanup.js.map +1 -1
  22. package/dist/agent-farm/commands/consult.d.ts +3 -4
  23. package/dist/agent-farm/commands/consult.d.ts.map +1 -1
  24. package/dist/agent-farm/commands/consult.js +27 -37
  25. package/dist/agent-farm/commands/consult.js.map +1 -1
  26. package/dist/agent-farm/commands/index.d.ts +2 -2
  27. package/dist/agent-farm/commands/index.d.ts.map +1 -1
  28. package/dist/agent-farm/commands/index.js +2 -2
  29. package/dist/agent-farm/commands/index.js.map +1 -1
  30. package/dist/agent-farm/commands/open.d.ts +4 -2
  31. package/dist/agent-farm/commands/open.d.ts.map +1 -1
  32. package/dist/agent-farm/commands/open.js +33 -83
  33. package/dist/agent-farm/commands/open.js.map +1 -1
  34. package/dist/agent-farm/commands/send.d.ts +1 -1
  35. package/dist/agent-farm/commands/send.d.ts.map +1 -1
  36. package/dist/agent-farm/commands/send.js +60 -79
  37. package/dist/agent-farm/commands/send.js.map +1 -1
  38. package/dist/agent-farm/commands/shell.d.ts +15 -0
  39. package/dist/agent-farm/commands/shell.d.ts.map +1 -0
  40. package/dist/agent-farm/commands/shell.js +50 -0
  41. package/dist/agent-farm/commands/shell.js.map +1 -0
  42. package/dist/agent-farm/commands/spawn.d.ts.map +1 -1
  43. package/dist/agent-farm/commands/spawn.js +597 -281
  44. package/dist/agent-farm/commands/spawn.js.map +1 -1
  45. package/dist/agent-farm/commands/start.d.ts +10 -20
  46. package/dist/agent-farm/commands/start.d.ts.map +1 -1
  47. package/dist/agent-farm/commands/start.js +45 -491
  48. package/dist/agent-farm/commands/start.js.map +1 -1
  49. package/dist/agent-farm/commands/status.d.ts +2 -0
  50. package/dist/agent-farm/commands/status.d.ts.map +1 -1
  51. package/dist/agent-farm/commands/status.js +75 -24
  52. package/dist/agent-farm/commands/status.js.map +1 -1
  53. package/dist/agent-farm/commands/stop.d.ts +6 -0
  54. package/dist/agent-farm/commands/stop.d.ts.map +1 -1
  55. package/dist/agent-farm/commands/stop.js +49 -109
  56. package/dist/agent-farm/commands/stop.js.map +1 -1
  57. package/dist/agent-farm/commands/tower-cloud.d.ts +48 -0
  58. package/dist/agent-farm/commands/tower-cloud.d.ts.map +1 -0
  59. package/dist/agent-farm/commands/tower-cloud.js +334 -0
  60. package/dist/agent-farm/commands/tower-cloud.js.map +1 -0
  61. package/dist/agent-farm/commands/tower.d.ts +9 -0
  62. package/dist/agent-farm/commands/tower.d.ts.map +1 -1
  63. package/dist/agent-farm/commands/tower.js +59 -19
  64. package/dist/agent-farm/commands/tower.js.map +1 -1
  65. package/dist/agent-farm/db/index.d.ts +6 -2
  66. package/dist/agent-farm/db/index.d.ts.map +1 -1
  67. package/dist/agent-farm/db/index.js +246 -18
  68. package/dist/agent-farm/db/index.js.map +1 -1
  69. package/dist/agent-farm/db/migrate.d.ts +0 -4
  70. package/dist/agent-farm/db/migrate.d.ts.map +1 -1
  71. package/dist/agent-farm/db/migrate.js +6 -55
  72. package/dist/agent-farm/db/migrate.js.map +1 -1
  73. package/dist/agent-farm/db/schema.d.ts +3 -3
  74. package/dist/agent-farm/db/schema.d.ts.map +1 -1
  75. package/dist/agent-farm/db/schema.js +25 -19
  76. package/dist/agent-farm/db/schema.js.map +1 -1
  77. package/dist/agent-farm/db/types.d.ts +3 -13
  78. package/dist/agent-farm/db/types.d.ts.map +1 -1
  79. package/dist/agent-farm/db/types.js +3 -11
  80. package/dist/agent-farm/db/types.js.map +1 -1
  81. package/dist/agent-farm/hq-connector.d.ts +2 -6
  82. package/dist/agent-farm/hq-connector.d.ts.map +1 -1
  83. package/dist/agent-farm/hq-connector.js +2 -17
  84. package/dist/agent-farm/hq-connector.js.map +1 -1
  85. package/dist/agent-farm/lib/cloud-config.d.ts +59 -0
  86. package/dist/agent-farm/lib/cloud-config.d.ts.map +1 -0
  87. package/dist/agent-farm/lib/cloud-config.js +143 -0
  88. package/dist/agent-farm/lib/cloud-config.js.map +1 -0
  89. package/dist/agent-farm/lib/tower-client.d.ts +163 -0
  90. package/dist/agent-farm/lib/tower-client.d.ts.map +1 -0
  91. package/dist/agent-farm/lib/tower-client.js +233 -0
  92. package/dist/agent-farm/lib/tower-client.js.map +1 -0
  93. package/dist/agent-farm/lib/tunnel-client.d.ts +117 -0
  94. package/dist/agent-farm/lib/tunnel-client.d.ts.map +1 -0
  95. package/dist/agent-farm/lib/tunnel-client.js +504 -0
  96. package/dist/agent-farm/lib/tunnel-client.js.map +1 -0
  97. package/dist/agent-farm/servers/tower-server.js +2650 -185
  98. package/dist/agent-farm/servers/tower-server.js.map +1 -1
  99. package/dist/agent-farm/state.d.ts +6 -12
  100. package/dist/agent-farm/state.d.ts.map +1 -1
  101. package/dist/agent-farm/state.js +34 -49
  102. package/dist/agent-farm/state.js.map +1 -1
  103. package/dist/agent-farm/types.d.ts +49 -26
  104. package/dist/agent-farm/types.d.ts.map +1 -1
  105. package/dist/agent-farm/utils/config.d.ts +0 -5
  106. package/dist/agent-farm/utils/config.d.ts.map +1 -1
  107. package/dist/agent-farm/utils/config.js +12 -44
  108. package/dist/agent-farm/utils/config.js.map +1 -1
  109. package/dist/agent-farm/utils/deps.d.ts.map +1 -1
  110. package/dist/agent-farm/utils/deps.js +0 -32
  111. package/dist/agent-farm/utils/deps.js.map +1 -1
  112. package/dist/agent-farm/utils/file-tabs.d.ts +27 -0
  113. package/dist/agent-farm/utils/file-tabs.d.ts.map +1 -0
  114. package/dist/agent-farm/utils/file-tabs.js +46 -0
  115. package/dist/agent-farm/utils/file-tabs.js.map +1 -0
  116. package/dist/agent-farm/utils/gate-status.d.ts +16 -0
  117. package/dist/agent-farm/utils/gate-status.d.ts.map +1 -0
  118. package/dist/agent-farm/utils/gate-status.js +79 -0
  119. package/dist/agent-farm/utils/gate-status.js.map +1 -0
  120. package/dist/agent-farm/utils/gate-watcher.d.ts +38 -0
  121. package/dist/agent-farm/utils/gate-watcher.d.ts.map +1 -0
  122. package/dist/agent-farm/utils/gate-watcher.js +122 -0
  123. package/dist/agent-farm/utils/gate-watcher.js.map +1 -0
  124. package/dist/agent-farm/utils/index.d.ts +0 -1
  125. package/dist/agent-farm/utils/index.d.ts.map +1 -1
  126. package/dist/agent-farm/utils/index.js +0 -1
  127. package/dist/agent-farm/utils/index.js.map +1 -1
  128. package/dist/agent-farm/utils/notifications.d.ts +30 -0
  129. package/dist/agent-farm/utils/notifications.d.ts.map +1 -0
  130. package/dist/agent-farm/utils/notifications.js +121 -0
  131. package/dist/agent-farm/utils/notifications.js.map +1 -0
  132. package/dist/agent-farm/utils/server-utils.d.ts +5 -5
  133. package/dist/agent-farm/utils/server-utils.d.ts.map +1 -1
  134. package/dist/agent-farm/utils/server-utils.js +5 -16
  135. package/dist/agent-farm/utils/server-utils.js.map +1 -1
  136. package/dist/agent-farm/utils/session.d.ts +32 -0
  137. package/dist/agent-farm/utils/session.d.ts.map +1 -0
  138. package/dist/agent-farm/utils/session.js +57 -0
  139. package/dist/agent-farm/utils/session.js.map +1 -0
  140. package/dist/agent-farm/utils/shell.d.ts +9 -22
  141. package/dist/agent-farm/utils/shell.d.ts.map +1 -1
  142. package/dist/agent-farm/utils/shell.js +34 -34
  143. package/dist/agent-farm/utils/shell.js.map +1 -1
  144. package/dist/cli.d.ts.map +1 -1
  145. package/dist/cli.js +11 -54
  146. package/dist/cli.js.map +1 -1
  147. package/dist/commands/adopt.d.ts.map +1 -1
  148. package/dist/commands/adopt.js +49 -4
  149. package/dist/commands/adopt.js.map +1 -1
  150. package/dist/commands/consult/index.d.ts +13 -2
  151. package/dist/commands/consult/index.d.ts.map +1 -1
  152. package/dist/commands/consult/index.js +245 -29
  153. package/dist/commands/consult/index.js.map +1 -1
  154. package/dist/commands/doctor.d.ts.map +1 -1
  155. package/dist/commands/doctor.js +96 -79
  156. package/dist/commands/doctor.js.map +1 -1
  157. package/dist/commands/init.d.ts.map +1 -1
  158. package/dist/commands/init.js +41 -2
  159. package/dist/commands/init.js.map +1 -1
  160. package/dist/commands/porch/build-counter.d.ts +5 -0
  161. package/dist/commands/porch/build-counter.d.ts.map +1 -0
  162. package/dist/commands/porch/build-counter.js +5 -0
  163. package/dist/commands/porch/build-counter.js.map +1 -0
  164. package/dist/commands/porch/checks.d.ts +17 -29
  165. package/dist/commands/porch/checks.d.ts.map +1 -1
  166. package/dist/commands/porch/checks.js +96 -144
  167. package/dist/commands/porch/checks.js.map +1 -1
  168. package/dist/commands/porch/index.d.ts +25 -43
  169. package/dist/commands/porch/index.d.ts.map +1 -1
  170. package/dist/commands/porch/index.js +463 -1116
  171. package/dist/commands/porch/index.js.map +1 -1
  172. package/dist/commands/porch/next.d.ts +22 -0
  173. package/dist/commands/porch/next.d.ts.map +1 -0
  174. package/dist/commands/porch/next.js +571 -0
  175. package/dist/commands/porch/next.js.map +1 -0
  176. package/dist/commands/porch/plan.d.ts +70 -0
  177. package/dist/commands/porch/plan.d.ts.map +1 -0
  178. package/dist/commands/porch/plan.js +190 -0
  179. package/dist/commands/porch/plan.js.map +1 -0
  180. package/dist/commands/porch/prompts.d.ts +19 -0
  181. package/dist/commands/porch/prompts.d.ts.map +1 -0
  182. package/dist/commands/porch/prompts.js +277 -0
  183. package/dist/commands/porch/prompts.js.map +1 -0
  184. package/dist/commands/porch/protocol.d.ts +59 -0
  185. package/dist/commands/porch/protocol.d.ts.map +1 -0
  186. package/dist/commands/porch/protocol.js +294 -0
  187. package/dist/commands/porch/protocol.js.map +1 -0
  188. package/dist/commands/porch/state.d.ts +36 -107
  189. package/dist/commands/porch/state.d.ts.map +1 -1
  190. package/dist/commands/porch/state.js +120 -699
  191. package/dist/commands/porch/state.js.map +1 -1
  192. package/dist/commands/porch/types.d.ts +99 -164
  193. package/dist/commands/porch/types.d.ts.map +1 -1
  194. package/dist/commands/porch/types.js +2 -1
  195. package/dist/commands/porch/types.js.map +1 -1
  196. package/dist/commands/porch/verdict.d.ts +31 -0
  197. package/dist/commands/porch/verdict.d.ts.map +1 -0
  198. package/dist/commands/porch/verdict.js +59 -0
  199. package/dist/commands/porch/verdict.js.map +1 -0
  200. package/dist/commands/update.d.ts.map +1 -1
  201. package/dist/commands/update.js +31 -0
  202. package/dist/commands/update.js.map +1 -1
  203. package/dist/lib/scaffold.d.ts +37 -0
  204. package/dist/lib/scaffold.d.ts.map +1 -1
  205. package/dist/lib/scaffold.js +114 -0
  206. package/dist/lib/scaffold.js.map +1 -1
  207. package/dist/terminal/index.d.ts +8 -0
  208. package/dist/terminal/index.d.ts.map +1 -0
  209. package/dist/terminal/index.js +5 -0
  210. package/dist/terminal/index.js.map +1 -0
  211. package/dist/terminal/pty-manager.d.ts +69 -0
  212. package/dist/terminal/pty-manager.d.ts.map +1 -0
  213. package/dist/terminal/pty-manager.js +377 -0
  214. package/dist/terminal/pty-manager.js.map +1 -0
  215. package/dist/terminal/pty-session.d.ts +104 -0
  216. package/dist/terminal/pty-session.d.ts.map +1 -0
  217. package/dist/terminal/pty-session.js +327 -0
  218. package/dist/terminal/pty-session.js.map +1 -0
  219. package/dist/terminal/ring-buffer.d.ts +34 -0
  220. package/dist/terminal/ring-buffer.d.ts.map +1 -0
  221. package/dist/terminal/ring-buffer.js +94 -0
  222. package/dist/terminal/ring-buffer.js.map +1 -0
  223. package/dist/terminal/session-manager.d.ts +115 -0
  224. package/dist/terminal/session-manager.d.ts.map +1 -0
  225. package/dist/terminal/session-manager.js +582 -0
  226. package/dist/terminal/session-manager.js.map +1 -0
  227. package/dist/terminal/shepherd-client.d.ts +58 -0
  228. package/dist/terminal/shepherd-client.d.ts.map +1 -0
  229. package/dist/terminal/shepherd-client.js +212 -0
  230. package/dist/terminal/shepherd-client.js.map +1 -0
  231. package/dist/terminal/shepherd-main.d.ts +19 -0
  232. package/dist/terminal/shepherd-main.d.ts.map +1 -0
  233. package/dist/terminal/shepherd-main.js +153 -0
  234. package/dist/terminal/shepherd-main.js.map +1 -0
  235. package/dist/terminal/shepherd-process.d.ts +75 -0
  236. package/dist/terminal/shepherd-process.d.ts.map +1 -0
  237. package/dist/terminal/shepherd-process.js +279 -0
  238. package/dist/terminal/shepherd-process.js.map +1 -0
  239. package/dist/terminal/shepherd-protocol.d.ts +115 -0
  240. package/dist/terminal/shepherd-protocol.d.ts.map +1 -0
  241. package/dist/terminal/shepherd-protocol.js +214 -0
  242. package/dist/terminal/shepherd-protocol.js.map +1 -0
  243. package/dist/terminal/shepherd-replay-buffer.d.ts +38 -0
  244. package/dist/terminal/shepherd-replay-buffer.d.ts.map +1 -0
  245. package/dist/terminal/shepherd-replay-buffer.js +94 -0
  246. package/dist/terminal/shepherd-replay-buffer.js.map +1 -0
  247. package/dist/terminal/ws-protocol.d.ts +27 -0
  248. package/dist/terminal/ws-protocol.d.ts.map +1 -0
  249. package/dist/terminal/ws-protocol.js +44 -0
  250. package/dist/terminal/ws-protocol.js.map +1 -0
  251. package/package.json +19 -5
  252. package/skeleton/.claude/skills/af/SKILL.md +89 -0
  253. package/skeleton/.claude/skills/codev/SKILL.md +41 -0
  254. package/skeleton/.claude/skills/consult/SKILL.md +81 -0
  255. package/skeleton/.claude/skills/generate-image/SKILL.md +56 -0
  256. package/skeleton/DEPENDENCIES.md +4 -62
  257. package/skeleton/builders.md +1 -1
  258. package/skeleton/consult-types/impl-review.md +18 -9
  259. package/skeleton/consult-types/integration-review.md +1 -1
  260. package/skeleton/consult-types/plan-review.md +1 -1
  261. package/skeleton/consult-types/pr-ready.md +1 -1
  262. package/skeleton/consult-types/spec-review.md +1 -1
  263. package/skeleton/porch/prompts/defend.md +1 -1
  264. package/skeleton/porch/prompts/evaluate.md +2 -2
  265. package/skeleton/porch/prompts/implement.md +1 -1
  266. package/skeleton/porch/prompts/plan.md +1 -1
  267. package/skeleton/porch/prompts/review.md +4 -4
  268. package/skeleton/porch/prompts/specify.md +1 -1
  269. package/skeleton/porch/prompts/understand.md +2 -2
  270. package/skeleton/protocol-schema.json +282 -0
  271. package/skeleton/protocols/bugfix/builder-prompt.md +54 -0
  272. package/skeleton/protocols/bugfix/prompts/fix.md +77 -0
  273. package/skeleton/protocols/bugfix/prompts/investigate.md +77 -0
  274. package/skeleton/protocols/bugfix/prompts/pr.md +84 -0
  275. package/skeleton/protocols/bugfix/protocol.json +20 -33
  276. package/skeleton/protocols/experiment/builder-prompt.md +52 -0
  277. package/skeleton/protocols/experiment/protocol.json +101 -0
  278. package/skeleton/protocols/experiment/protocol.md +3 -3
  279. package/skeleton/protocols/experiment/templates/notes.md +1 -1
  280. package/skeleton/protocols/maintain/builder-prompt.md +46 -0
  281. package/skeleton/protocols/maintain/prompts/audit.md +111 -0
  282. package/skeleton/protocols/maintain/prompts/clean.md +91 -0
  283. package/skeleton/protocols/maintain/prompts/sync.md +113 -0
  284. package/skeleton/protocols/maintain/prompts/verify.md +110 -0
  285. package/skeleton/protocols/maintain/protocol.json +141 -0
  286. package/skeleton/protocols/maintain/protocol.md +17 -11
  287. package/skeleton/protocols/protocol-schema.json +54 -1
  288. package/skeleton/protocols/spir/builder-prompt.md +59 -0
  289. package/skeleton/protocols/spir/prompts/implement.md +208 -0
  290. package/skeleton/protocols/{spider → spir}/prompts/plan.md +6 -70
  291. package/skeleton/protocols/{spider → spir}/prompts/review.md +20 -39
  292. package/skeleton/protocols/{spider → spir}/prompts/specify.md +33 -61
  293. package/skeleton/protocols/spir/protocol.json +156 -0
  294. package/skeleton/protocols/{spider → spir}/protocol.md +35 -21
  295. package/skeleton/protocols/{spider → spir}/templates/plan.md +14 -0
  296. package/skeleton/protocols/spir/templates/review.md +89 -0
  297. package/skeleton/protocols/tick/builder-prompt.md +56 -0
  298. package/skeleton/protocols/tick/protocol.json +7 -2
  299. package/skeleton/protocols/tick/protocol.md +18 -18
  300. package/skeleton/protocols/tick/templates/review.md +1 -1
  301. package/skeleton/resources/commands/agent-farm.md +63 -46
  302. package/skeleton/resources/commands/codev.md +0 -2
  303. package/skeleton/resources/commands/overview.md +7 -17
  304. package/skeleton/resources/workflow-reference.md +4 -4
  305. package/skeleton/roles/architect.md +152 -315
  306. package/skeleton/roles/builder.md +110 -218
  307. package/skeleton/roles/consultant.md +6 -6
  308. package/skeleton/templates/AGENTS.md +2 -2
  309. package/skeleton/templates/CLAUDE.md +2 -2
  310. package/skeleton/templates/cheatsheet.md +7 -5
  311. package/skeleton/templates/projectlist.md +1 -1
  312. package/templates/dashboard/index.html +17 -43
  313. package/templates/dashboard/js/dialogs.js +7 -7
  314. package/templates/dashboard/js/files.js +2 -2
  315. package/templates/dashboard/js/main.js +4 -4
  316. package/templates/dashboard/js/projects.js +3 -3
  317. package/templates/dashboard/js/tabs.js +1 -1
  318. package/templates/dashboard/js/utils.js +22 -87
  319. package/templates/open.html +26 -0
  320. package/templates/tower.html +642 -36
  321. package/dist/agent-farm/commands/kickoff.d.ts +0 -20
  322. package/dist/agent-farm/commands/kickoff.d.ts.map +0 -1
  323. package/dist/agent-farm/commands/kickoff.js +0 -337
  324. package/dist/agent-farm/commands/kickoff.js.map +0 -1
  325. package/dist/agent-farm/commands/rename.d.ts +0 -13
  326. package/dist/agent-farm/commands/rename.d.ts.map +0 -1
  327. package/dist/agent-farm/commands/rename.js +0 -33
  328. package/dist/agent-farm/commands/rename.js.map +0 -1
  329. package/dist/agent-farm/commands/tutorial.d.ts +0 -10
  330. package/dist/agent-farm/commands/tutorial.d.ts.map +0 -1
  331. package/dist/agent-farm/commands/tutorial.js +0 -49
  332. package/dist/agent-farm/commands/tutorial.js.map +0 -1
  333. package/dist/agent-farm/commands/util.d.ts +0 -15
  334. package/dist/agent-farm/commands/util.d.ts.map +0 -1
  335. package/dist/agent-farm/commands/util.js +0 -108
  336. package/dist/agent-farm/commands/util.js.map +0 -1
  337. package/dist/agent-farm/servers/dashboard-server.d.ts +0 -7
  338. package/dist/agent-farm/servers/dashboard-server.d.ts.map +0 -1
  339. package/dist/agent-farm/servers/dashboard-server.js +0 -1872
  340. package/dist/agent-farm/servers/dashboard-server.js.map +0 -1
  341. package/dist/agent-farm/servers/open-server.d.ts +0 -7
  342. package/dist/agent-farm/servers/open-server.d.ts.map +0 -1
  343. package/dist/agent-farm/servers/open-server.js +0 -315
  344. package/dist/agent-farm/servers/open-server.js.map +0 -1
  345. package/dist/agent-farm/tutorial/index.d.ts +0 -8
  346. package/dist/agent-farm/tutorial/index.d.ts.map +0 -1
  347. package/dist/agent-farm/tutorial/index.js +0 -8
  348. package/dist/agent-farm/tutorial/index.js.map +0 -1
  349. package/dist/agent-farm/tutorial/prompts.d.ts +0 -57
  350. package/dist/agent-farm/tutorial/prompts.d.ts.map +0 -1
  351. package/dist/agent-farm/tutorial/prompts.js +0 -147
  352. package/dist/agent-farm/tutorial/prompts.js.map +0 -1
  353. package/dist/agent-farm/tutorial/runner.d.ts +0 -52
  354. package/dist/agent-farm/tutorial/runner.d.ts.map +0 -1
  355. package/dist/agent-farm/tutorial/runner.js +0 -204
  356. package/dist/agent-farm/tutorial/runner.js.map +0 -1
  357. package/dist/agent-farm/tutorial/state.d.ts +0 -26
  358. package/dist/agent-farm/tutorial/state.d.ts.map +0 -1
  359. package/dist/agent-farm/tutorial/state.js +0 -89
  360. package/dist/agent-farm/tutorial/state.js.map +0 -1
  361. package/dist/agent-farm/tutorial/steps/first-spec.d.ts +0 -7
  362. package/dist/agent-farm/tutorial/steps/first-spec.d.ts.map +0 -1
  363. package/dist/agent-farm/tutorial/steps/first-spec.js +0 -136
  364. package/dist/agent-farm/tutorial/steps/first-spec.js.map +0 -1
  365. package/dist/agent-farm/tutorial/steps/implementation.d.ts +0 -7
  366. package/dist/agent-farm/tutorial/steps/implementation.d.ts.map +0 -1
  367. package/dist/agent-farm/tutorial/steps/implementation.js +0 -76
  368. package/dist/agent-farm/tutorial/steps/implementation.js.map +0 -1
  369. package/dist/agent-farm/tutorial/steps/index.d.ts +0 -10
  370. package/dist/agent-farm/tutorial/steps/index.d.ts.map +0 -1
  371. package/dist/agent-farm/tutorial/steps/index.js +0 -10
  372. package/dist/agent-farm/tutorial/steps/index.js.map +0 -1
  373. package/dist/agent-farm/tutorial/steps/planning.d.ts +0 -7
  374. package/dist/agent-farm/tutorial/steps/planning.d.ts.map +0 -1
  375. package/dist/agent-farm/tutorial/steps/planning.js +0 -143
  376. package/dist/agent-farm/tutorial/steps/planning.js.map +0 -1
  377. package/dist/agent-farm/tutorial/steps/review.d.ts +0 -7
  378. package/dist/agent-farm/tutorial/steps/review.d.ts.map +0 -1
  379. package/dist/agent-farm/tutorial/steps/review.js +0 -78
  380. package/dist/agent-farm/tutorial/steps/review.js.map +0 -1
  381. package/dist/agent-farm/tutorial/steps/setup.d.ts +0 -7
  382. package/dist/agent-farm/tutorial/steps/setup.d.ts.map +0 -1
  383. package/dist/agent-farm/tutorial/steps/setup.js +0 -126
  384. package/dist/agent-farm/tutorial/steps/setup.js.map +0 -1
  385. package/dist/agent-farm/tutorial/steps/welcome.d.ts +0 -7
  386. package/dist/agent-farm/tutorial/steps/welcome.d.ts.map +0 -1
  387. package/dist/agent-farm/tutorial/steps/welcome.js +0 -50
  388. package/dist/agent-farm/tutorial/steps/welcome.js.map +0 -1
  389. package/dist/agent-farm/utils/orphan-handler.d.ts +0 -27
  390. package/dist/agent-farm/utils/orphan-handler.d.ts.map +0 -1
  391. package/dist/agent-farm/utils/orphan-handler.js +0 -149
  392. package/dist/agent-farm/utils/orphan-handler.js.map +0 -1
  393. package/dist/agent-farm/utils/port-registry.d.ts +0 -58
  394. package/dist/agent-farm/utils/port-registry.d.ts.map +0 -1
  395. package/dist/agent-farm/utils/port-registry.js +0 -166
  396. package/dist/agent-farm/utils/port-registry.js.map +0 -1
  397. package/dist/agent-farm/utils/terminal-ports.d.ts +0 -18
  398. package/dist/agent-farm/utils/terminal-ports.d.ts.map +0 -1
  399. package/dist/agent-farm/utils/terminal-ports.js +0 -35
  400. package/dist/agent-farm/utils/terminal-ports.js.map +0 -1
  401. package/dist/commands/pcheck/cache.d.ts +0 -48
  402. package/dist/commands/pcheck/cache.d.ts.map +0 -1
  403. package/dist/commands/pcheck/cache.js +0 -170
  404. package/dist/commands/pcheck/cache.js.map +0 -1
  405. package/dist/commands/pcheck/evaluator.d.ts +0 -15
  406. package/dist/commands/pcheck/evaluator.d.ts.map +0 -1
  407. package/dist/commands/pcheck/evaluator.js +0 -246
  408. package/dist/commands/pcheck/evaluator.js.map +0 -1
  409. package/dist/commands/pcheck/index.d.ts +0 -12
  410. package/dist/commands/pcheck/index.d.ts.map +0 -1
  411. package/dist/commands/pcheck/index.js +0 -249
  412. package/dist/commands/pcheck/index.js.map +0 -1
  413. package/dist/commands/pcheck/parser.d.ts +0 -39
  414. package/dist/commands/pcheck/parser.d.ts.map +0 -1
  415. package/dist/commands/pcheck/parser.js +0 -155
  416. package/dist/commands/pcheck/parser.js.map +0 -1
  417. package/dist/commands/pcheck/types.d.ts +0 -82
  418. package/dist/commands/pcheck/types.d.ts.map +0 -1
  419. package/dist/commands/pcheck/types.js +0 -5
  420. package/dist/commands/pcheck/types.js.map +0 -1
  421. package/dist/commands/porch/consultation.d.ts +0 -56
  422. package/dist/commands/porch/consultation.d.ts.map +0 -1
  423. package/dist/commands/porch/consultation.js +0 -330
  424. package/dist/commands/porch/consultation.js.map +0 -1
  425. package/dist/commands/porch/notifications.d.ts +0 -99
  426. package/dist/commands/porch/notifications.d.ts.map +0 -1
  427. package/dist/commands/porch/notifications.js +0 -223
  428. package/dist/commands/porch/notifications.js.map +0 -1
  429. package/dist/commands/porch/plan-parser.d.ts +0 -38
  430. package/dist/commands/porch/plan-parser.d.ts.map +0 -1
  431. package/dist/commands/porch/plan-parser.js +0 -166
  432. package/dist/commands/porch/plan-parser.js.map +0 -1
  433. package/dist/commands/porch/protocol-loader.d.ts +0 -46
  434. package/dist/commands/porch/protocol-loader.d.ts.map +0 -1
  435. package/dist/commands/porch/protocol-loader.js +0 -253
  436. package/dist/commands/porch/protocol-loader.js.map +0 -1
  437. package/dist/commands/porch/signal-parser.d.ts +0 -88
  438. package/dist/commands/porch/signal-parser.d.ts.map +0 -1
  439. package/dist/commands/porch/signal-parser.js +0 -148
  440. package/dist/commands/porch/signal-parser.js.map +0 -1
  441. package/dist/commands/tower.d.ts +0 -16
  442. package/dist/commands/tower.d.ts.map +0 -1
  443. package/dist/commands/tower.js +0 -21
  444. package/dist/commands/tower.js.map +0 -1
  445. package/skeleton/config.json +0 -7
  446. package/skeleton/porch/protocols/bugfix.json +0 -85
  447. package/skeleton/porch/protocols/spider.json +0 -135
  448. package/skeleton/porch/protocols/tick.json +0 -76
  449. package/skeleton/protocols/spider/prompts/defend.md +0 -215
  450. package/skeleton/protocols/spider/prompts/evaluate.md +0 -241
  451. package/skeleton/protocols/spider/prompts/implement.md +0 -149
  452. package/skeleton/protocols/spider/protocol.json +0 -210
  453. package/skeleton/protocols/spider/templates/review.md +0 -207
  454. package/templates/dashboard/css/activity.css +0 -151
  455. package/templates/dashboard/js/activity.js +0 -112
  456. /package/skeleton/protocols/{spider → spir}/templates/spec.md +0 -0
@@ -0,0 +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"}
@@ -0,0 +1,190 @@
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 * as fs from 'node:fs';
11
+ import * as path from 'node:path';
12
+ // ============================================================================
13
+ // Plan File Discovery
14
+ // ============================================================================
15
+ /**
16
+ * Find the plan file for a project
17
+ * Searches both legacy (codev/plans/NNNN-name.md) and new (codev/projects/NNNN-name/plan.md) locations
18
+ */
19
+ export function findPlanFile(projectRoot, projectId, projectName) {
20
+ const searchPaths = [];
21
+ // New structure: codev/projects/<id>-<name>/plan.md
22
+ if (projectName) {
23
+ searchPaths.push(path.join(projectRoot, 'codev/projects', `${projectId}-${projectName}`, 'plan.md'));
24
+ }
25
+ // Legacy structure: codev/plans/<id>-*.md
26
+ const plansDir = path.join(projectRoot, 'codev/plans');
27
+ if (fs.existsSync(plansDir)) {
28
+ const files = fs.readdirSync(plansDir);
29
+ const match = files.find(f => f.startsWith(`${projectId}-`) && f.endsWith('.md'));
30
+ if (match) {
31
+ searchPaths.push(path.join(plansDir, match));
32
+ }
33
+ }
34
+ for (const planPath of searchPaths) {
35
+ if (fs.existsSync(planPath)) {
36
+ return planPath;
37
+ }
38
+ }
39
+ return null;
40
+ }
41
+ // ============================================================================
42
+ // Phase Extraction
43
+ // ============================================================================
44
+ /**
45
+ * Extract phases from plan markdown content
46
+ * Returns phases with status 'pending'
47
+ *
48
+ * Supports two formats:
49
+ *
50
+ * 1. JSON code block:
51
+ * ```json
52
+ * {"phases": [{"id": "phase_1", "title": "..."}, ...]}
53
+ * ```
54
+ *
55
+ * 2. Markdown headers (fallback):
56
+ * ## Phase 1: Core Types
57
+ * ## Phase 2: State Management
58
+ *
59
+ * Also matches "---" separated sections with "## Phase N:" headers.
60
+ */
61
+ export function extractPlanPhases(planContent) {
62
+ // First, try JSON code block with phases
63
+ const jsonMatch = planContent.match(/```json\s*\n([\s\S]*?)\n```/);
64
+ if (jsonMatch) {
65
+ try {
66
+ const parsed = JSON.parse(jsonMatch[1]);
67
+ if (parsed.phases && Array.isArray(parsed.phases)) {
68
+ return parsed.phases.map((p, index) => ({
69
+ id: p.id,
70
+ title: p.title,
71
+ status: index === 0 ? 'in_progress' : 'pending',
72
+ }));
73
+ }
74
+ }
75
+ catch (e) {
76
+ // JSON parse failed, fall through to markdown parsing
77
+ console.warn('Failed to parse phases JSON from plan:', e);
78
+ }
79
+ }
80
+ // Second, try markdown headers: "## Phase N: Title" or "### Phase N: Title"
81
+ const phaseHeaderRegex = /^#{2,3}\s+Phase\s+(\d+):\s*(.+)$/gm;
82
+ const phases = [];
83
+ let match;
84
+ while ((match = phaseHeaderRegex.exec(planContent)) !== null) {
85
+ const phaseNum = match[1];
86
+ const title = match[2].trim();
87
+ phases.push({
88
+ id: `phase_${phaseNum}`,
89
+ title,
90
+ status: phases.length === 0 ? 'in_progress' : 'pending',
91
+ });
92
+ }
93
+ if (phases.length > 0) {
94
+ return phases;
95
+ }
96
+ // No phases found - return single default phase
97
+ return [{
98
+ id: 'phase_1',
99
+ title: 'Implementation',
100
+ status: 'in_progress',
101
+ }];
102
+ }
103
+ /**
104
+ * Extract phases from a plan file
105
+ * Fails loudly if file doesn't exist
106
+ */
107
+ export function extractPhasesFromFile(planFilePath) {
108
+ if (!fs.existsSync(planFilePath)) {
109
+ throw new Error(`Plan file not found: ${planFilePath}`);
110
+ }
111
+ const content = fs.readFileSync(planFilePath, 'utf-8');
112
+ return extractPlanPhases(content);
113
+ }
114
+ // ============================================================================
115
+ // Phase Navigation
116
+ // ============================================================================
117
+ /**
118
+ * Check if a plan phase is complete
119
+ */
120
+ export function isPlanPhaseComplete(phase) {
121
+ return phase.status === 'complete';
122
+ }
123
+ /**
124
+ * Get the current plan phase (first non-complete phase)
125
+ */
126
+ export function getCurrentPlanPhase(phases) {
127
+ for (const phase of phases) {
128
+ if (phase.status !== 'complete') {
129
+ return phase;
130
+ }
131
+ }
132
+ return null; // All phases complete
133
+ }
134
+ /**
135
+ * Get the next plan phase after a given phase
136
+ */
137
+ export function getNextPlanPhase(phases, currentPhaseId) {
138
+ const currentIndex = phases.findIndex(p => p.id === currentPhaseId);
139
+ if (currentIndex >= 0 && currentIndex < phases.length - 1) {
140
+ return phases[currentIndex + 1];
141
+ }
142
+ return null;
143
+ }
144
+ /**
145
+ * Check if all plan phases are complete
146
+ */
147
+ export function allPlanPhasesComplete(phases) {
148
+ return phases.every(isPlanPhaseComplete);
149
+ }
150
+ /**
151
+ * Advance to the next plan phase
152
+ * Marks current phase complete and next phase in_progress
153
+ * Returns updated phases array and whether to move to review
154
+ */
155
+ export function advancePlanPhase(phases, currentPhaseId) {
156
+ const phaseIndex = phases.findIndex(p => p.id === currentPhaseId);
157
+ if (phaseIndex < 0) {
158
+ return { phases, moveToReview: false };
159
+ }
160
+ const updatedPhases = phases.map((p, i) => {
161
+ if (i === phaseIndex) {
162
+ return { ...p, status: 'complete' };
163
+ }
164
+ if (i === phaseIndex + 1) {
165
+ return { ...p, status: 'in_progress' };
166
+ }
167
+ return p;
168
+ });
169
+ // Check if all phases are now complete
170
+ const moveToReview = updatedPhases.every(p => p.status === 'complete');
171
+ return { phases: updatedPhases, moveToReview };
172
+ }
173
+ /**
174
+ * Get phase content from plan (the text under the phase header)
175
+ * Matches both ## and ### phase headers, and terminates at the next
176
+ * phase header of same or higher level, or a "---" separator.
177
+ */
178
+ export function getPhaseContent(planContent, phaseId) {
179
+ // Extract phase number from id
180
+ const numMatch = phaseId.match(/phase_(\d+)/);
181
+ if (!numMatch)
182
+ return null;
183
+ const phaseNum = numMatch[1];
184
+ // Match ## or ### Phase N: Title
185
+ // Content ends at: next phase header (## or ### Phase), a --- separator, or end of file
186
+ const regex = new RegExp(`#{2,3}\\s*Phase\\s+${phaseNum}:\\s*[^\\n]+\\n([\\s\\S]*?)(?=\\n#{2,3}\\s*Phase\\s+\\d|\\n---\\s*\\n|$)`, 'i');
187
+ const match = planContent.match(regex);
188
+ return match ? match[1].trim() : null;
189
+ }
190
+ //# sourceMappingURL=plan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan.js","sourceRoot":"","sources":["../../../src/commands/porch/plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAGlC,+EAA+E;AAC/E,sBAAsB;AACtB,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,WAAmB,EAAE,SAAiB,EAAE,WAAoB;IACvF,MAAM,WAAW,GAAa,EAAE,CAAC;IAEjC,oDAAoD;IACpD,IAAI,WAAW,EAAE,CAAC;QAChB,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,gBAAgB,EAAE,GAAG,SAAS,IAAI,WAAW,EAAE,EAAE,SAAS,CAAC,CAAC,CAAC;IACvG,CAAC;IAED,0CAA0C;IAC1C,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;IACvD,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5B,MAAM,KAAK,GAAG,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QACvC,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG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ACrB,OAAO,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,UAAmB,EAAE,CAAC;QAC/C,CAAC;QACD,IAAI,CAAC,KAAK,UAAU,GAAG,CAAC,EAAE,CAAC;YACzB,OAAO,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,aAAsB,EAAE,CAAC;QAClD,CAAC;QACD,OAAO,CAAC,CAAC;IACX,CAAC,CAAC,CAAC;IAEH,uCAAuC;IACvC,MAAM,YAAY,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC;IAEvE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,CAAC;AACjD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,WAAmB,EAAE,OAAe;IAClE,+BAA+B;IAC/B,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAC9C,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC;IAE3B,MAAM,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC7B,iCAAiC;IACjC,wFAAwF;IACxF,MAAM,KAAK,GAAG,IAAI,MAAM,CACtB,sBAAsB,QAAQ,0EAA0E,EACxG,GAAG,CACJ,CAAC;IAEF,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACvC,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACxC,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Phase prompts for Porch
3
+ *
4
+ * Loads phase-specific prompts from the protocol's prompts/ directory.
5
+ * Prompts are markdown files with {{variable}} placeholders.
6
+ *
7
+ * For build-verify cycles, when iteration > 1, previous build outputs
8
+ * and review files are listed so Claude can read them for context.
9
+ */
10
+ import type { ProjectState, Protocol } from './types.js';
11
+ /**
12
+ * Build a prompt for the current phase.
13
+ * Loads from protocol's prompts/ directory if available, otherwise uses fallback.
14
+ *
15
+ * For build-verify phases with iteration > 1, lists previous build outputs
16
+ * and review files so Claude can read them for context.
17
+ */
18
+ export declare function buildPhasePrompt(projectRoot: string, state: ProjectState, protocol: Protocol): string;
19
+ //# sourceMappingURL=prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../src/commands/porch/prompts.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAA6C,MAAM,YAAY,CAAC;AA4KpG;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,QAAQ,GACjB,MAAM,CA+ER"}
@@ -0,0 +1,277 @@
1
+ /**
2
+ * Phase prompts for Porch
3
+ *
4
+ * Loads phase-specific prompts from the protocol's prompts/ directory.
5
+ * Prompts are markdown files with {{variable}} placeholders.
6
+ *
7
+ * For build-verify cycles, when iteration > 1, previous build outputs
8
+ * and review files are listed so Claude can read them for context.
9
+ */
10
+ import * as fs from 'node:fs';
11
+ import * as path from 'node:path';
12
+ import { getPhaseConfig, isPhased, isBuildVerify, getBuildConfig } from './protocol.js';
13
+ import { findPlanFile, getCurrentPlanPhase, getPhaseContent } from './plan.js';
14
+ import { getProjectDir } from './state.js';
15
+ /** Locations to search for protocol prompts */
16
+ const PROTOCOL_PATHS = [
17
+ 'codev/protocols',
18
+ 'codev-skeleton/protocols',
19
+ 'skeleton/protocols', // Used in packages/codev
20
+ ];
21
+ /**
22
+ * Get project summary from projectlist.md.
23
+ * Returns the summary field for the given project ID.
24
+ */
25
+ function getProjectSummary(projectRoot, projectId) {
26
+ const projectlistPath = path.join(projectRoot, 'codev', 'projectlist.md');
27
+ if (!fs.existsSync(projectlistPath)) {
28
+ return null;
29
+ }
30
+ try {
31
+ const content = fs.readFileSync(projectlistPath, 'utf-8');
32
+ // Look for the project entry by ID
33
+ // Format: - id: "0076" followed by summary: "..."
34
+ const idPattern = new RegExp(`- id: ["']?${projectId}["']?`, 'i');
35
+ const idMatch = content.match(idPattern);
36
+ if (!idMatch) {
37
+ return null;
38
+ }
39
+ // Find the summary after this ID (within the next ~500 chars)
40
+ const afterId = content.slice(idMatch.index, idMatch.index + 500);
41
+ const summaryMatch = afterId.match(/summary:\s*["'](.+?)["']/);
42
+ if (summaryMatch) {
43
+ return summaryMatch[1];
44
+ }
45
+ return null;
46
+ }
47
+ catch {
48
+ return null;
49
+ }
50
+ }
51
+ /**
52
+ * Find the prompts directory for a protocol.
53
+ */
54
+ function findPromptsDir(projectRoot, protocolName) {
55
+ for (const basePath of PROTOCOL_PATHS) {
56
+ const promptsDir = path.join(projectRoot, basePath, protocolName, 'prompts');
57
+ if (fs.existsSync(promptsDir)) {
58
+ return promptsDir;
59
+ }
60
+ }
61
+ return null;
62
+ }
63
+ /**
64
+ * Load a prompt file from the protocol's prompts directory.
65
+ */
66
+ function loadPromptFile(promptsDir, promptFile) {
67
+ const promptPath = path.join(promptsDir, promptFile);
68
+ if (fs.existsSync(promptPath)) {
69
+ return fs.readFileSync(promptPath, 'utf-8');
70
+ }
71
+ return null;
72
+ }
73
+ /**
74
+ * Substitute template variables in a prompt.
75
+ */
76
+ function substituteVariables(prompt, state, planPhase, summary) {
77
+ const variables = {
78
+ project_id: state.id,
79
+ title: state.title,
80
+ current_state: state.phase,
81
+ protocol: state.protocol,
82
+ };
83
+ // Add summary/goal if available
84
+ if (summary) {
85
+ variables.summary = summary;
86
+ variables.goal = summary; // Alias for convenience
87
+ }
88
+ if (planPhase) {
89
+ variables.plan_phase_id = planPhase.id;
90
+ variables.plan_phase_title = planPhase.title;
91
+ }
92
+ // Replace {{variable}} with values
93
+ return prompt.replace(/\{\{(\w+)\}\}/g, (match, varName) => {
94
+ return variables[varName] || match;
95
+ });
96
+ }
97
+ /**
98
+ * Build a header listing all previous iteration files.
99
+ * Claude can read these files to understand the history and feedback.
100
+ */
101
+ function buildHistoryHeader(history, currentIteration, state, projectRoot) {
102
+ const lines = [
103
+ '# REVISION REQUIRED',
104
+ '',
105
+ `This is iteration ${currentIteration}. Previous iterations received feedback from reviewers.`,
106
+ '',
107
+ '**Read the files below to understand the history and address the feedback.**',
108
+ '',
109
+ '## Previous Iterations',
110
+ '',
111
+ ];
112
+ for (const record of history) {
113
+ lines.push(`### Iteration ${record.iteration}`);
114
+ lines.push('');
115
+ if (record.build_output) {
116
+ lines.push(`**Build Output:** \`${record.build_output}\``);
117
+ }
118
+ if (record.reviews.length > 0) {
119
+ lines.push('');
120
+ lines.push('**Reviews:**');
121
+ for (const review of record.reviews) {
122
+ const icon = review.verdict === 'APPROVE' ? '✓' :
123
+ review.verdict === 'COMMENT' ? '💬' : '✗';
124
+ lines.push(`- ${review.model} (${icon} ${review.verdict}): \`${review.file}\``);
125
+ }
126
+ }
127
+ lines.push('');
128
+ }
129
+ lines.push('## Instructions');
130
+ lines.push('');
131
+ lines.push('1. Read the review files above to understand the feedback');
132
+ lines.push('2. Address any legitimate REQUEST_CHANGES issues');
133
+ lines.push('3. Consider suggestions from COMMENT and APPROVE reviews');
134
+ lines.push('4. **If a reviewer concern is a false positive**, write a rebuttal (see below)');
135
+ lines.push('');
136
+ // Add rebuttal instructions
137
+ const projectDir = getProjectDir(projectRoot, state.id, state.title);
138
+ const phase = state.current_plan_phase || state.phase;
139
+ const rebuttalFileName = `${state.id}-${phase}-iter${currentIteration - 1}-rebuttals.md`;
140
+ const rebuttalPath = path.join(projectDir, rebuttalFileName);
141
+ lines.push('## Rebuttals (Dispute False Positives)');
142
+ lines.push('');
143
+ lines.push('If you believe a reviewer concern is a false positive (e.g., based on outdated framework knowledge),');
144
+ lines.push(`write your rebuttal to: \`${rebuttalPath}\``);
145
+ lines.push('');
146
+ lines.push('Format each disputed concern as a section:');
147
+ lines.push('```');
148
+ lines.push('## Disputed: [Brief description of the concern]');
149
+ lines.push('');
150
+ lines.push('[Your explanation of why this is a false positive, with evidence]');
151
+ lines.push('```');
152
+ lines.push('');
153
+ lines.push('Rebuttals are passed as context to reviewers in the next iteration.');
154
+ lines.push('Only dispute genuinely incorrect feedback — still fix legitimate issues.');
155
+ lines.push('');
156
+ return lines.join('\n');
157
+ }
158
+ /**
159
+ * Build a prompt for the current phase.
160
+ * Loads from protocol's prompts/ directory if available, otherwise uses fallback.
161
+ *
162
+ * For build-verify phases with iteration > 1, lists previous build outputs
163
+ * and review files so Claude can read them for context.
164
+ */
165
+ export function buildPhasePrompt(projectRoot, state, protocol) {
166
+ const phaseConfig = getPhaseConfig(protocol, state.phase);
167
+ if (!phaseConfig) {
168
+ return buildFallbackPrompt(state, 'unknown');
169
+ }
170
+ // Get project summary from projectlist.md
171
+ const summary = getProjectSummary(projectRoot, state.id);
172
+ // Get current plan phase for phased protocols
173
+ let currentPlanPhase = null;
174
+ if (isPhased(protocol, state.phase) && state.plan_phases.length > 0) {
175
+ currentPlanPhase = getCurrentPlanPhase(state.plan_phases);
176
+ }
177
+ // Build history header if this is a retry iteration
178
+ // Filter history by current plan phase to avoid mixing context from other phases
179
+ let historyHeader = '';
180
+ if (isBuildVerify(protocol, state.phase) && state.iteration > 1 && state.history.length > 0) {
181
+ const currentPhase = state.current_plan_phase || undefined;
182
+ const phaseHistory = state.history.filter(h => (h.plan_phase || undefined) === currentPhase);
183
+ if (phaseHistory.length > 0) {
184
+ historyHeader = buildHistoryHeader(phaseHistory, state.iteration, state, projectRoot);
185
+ }
186
+ }
187
+ // Build user answers section if they asked clarifying questions
188
+ let userAnswersSection = '';
189
+ if (state.context?.user_answers) {
190
+ userAnswersSection = `# User Answers to Your Questions\n\n${state.context.user_answers}\n\n---\n\n`;
191
+ }
192
+ // Try to load prompt from protocol directory
193
+ const promptsDir = findPromptsDir(projectRoot, state.protocol);
194
+ if (promptsDir) {
195
+ // Get prompt filename from protocol's build config, fallback to phase.md
196
+ const buildConfig = getBuildConfig(protocol, state.phase);
197
+ const promptFileName = buildConfig?.prompt || `${state.phase}.md`;
198
+ const promptContent = loadPromptFile(promptsDir, promptFileName);
199
+ if (promptContent) {
200
+ let result = substituteVariables(promptContent, state, currentPlanPhase, summary);
201
+ // Add goal/summary header if available
202
+ if (summary) {
203
+ result = `## Goal\n\n${summary}\n\n---\n\n` + result;
204
+ }
205
+ // Add user answers if Claude asked clarifying questions
206
+ if (userAnswersSection) {
207
+ result = userAnswersSection + result;
208
+ }
209
+ // Add plan phase context if applicable
210
+ if (currentPlanPhase) {
211
+ result = addPlanPhaseContext(projectRoot, state, currentPlanPhase, result);
212
+ }
213
+ // Prepend history if this is a retry
214
+ if (historyHeader) {
215
+ result = historyHeader + '\n\n---\n\n' + result;
216
+ }
217
+ return result;
218
+ }
219
+ }
220
+ // Fallback to generic prompt if no protocol prompt found
221
+ let fallback = buildFallbackPrompt(state, phaseConfig.name, currentPlanPhase, summary);
222
+ // Prepend history if this is a retry
223
+ if (historyHeader) {
224
+ fallback = historyHeader + '\n\n---\n\n' + fallback;
225
+ }
226
+ return fallback;
227
+ }
228
+ /**
229
+ * Add plan phase context from the plan file.
230
+ */
231
+ function addPlanPhaseContext(projectRoot, state, planPhase, prompt) {
232
+ const planPath = findPlanFile(projectRoot, state.id, state.title);
233
+ if (!planPath) {
234
+ return prompt;
235
+ }
236
+ try {
237
+ const planContent = fs.readFileSync(planPath, 'utf-8');
238
+ const phaseContent = getPhaseContent(planContent, planPhase.id);
239
+ if (phaseContent) {
240
+ return prompt + `\n\n## Current Plan Phase Details\n\n**${planPhase.id}: ${planPhase.title}**\n\n${phaseContent}\n`;
241
+ }
242
+ }
243
+ catch {
244
+ // Ignore errors reading plan
245
+ }
246
+ return prompt;
247
+ }
248
+ /**
249
+ * Build a fallback prompt when no protocol prompt is found.
250
+ */
251
+ function buildFallbackPrompt(state, phaseName, planPhase, summary) {
252
+ let prompt = `# Phase: ${phaseName}
253
+
254
+ You are executing the ${phaseName} phase of the ${state.protocol.toUpperCase()} protocol.
255
+
256
+ ## Context
257
+
258
+ - **Project ID**: ${state.id}
259
+ - **Project Title**: ${state.title}
260
+ - **Protocol**: ${state.protocol}
261
+ `;
262
+ if (planPhase) {
263
+ prompt += `- **Plan Phase**: ${planPhase.id} - ${planPhase.title}\n`;
264
+ }
265
+ // Add goal from projectlist.md summary
266
+ if (summary) {
267
+ prompt += `\n## Goal\n\n${summary}\n`;
268
+ }
269
+ prompt += `
270
+ ## Task
271
+
272
+ Complete the work for this phase according to the protocol.
273
+
274
+ `;
275
+ return prompt;
276
+ }
277
+ //# sourceMappingURL=prompts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../src/commands/porch/prompts.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACxF,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,+CAA+C;AAC/C,MAAM,cAAc,GAAG;IACrB,iBAAiB;IACjB,0BAA0B;IAC1B,oBAAoB,EAAG,yBAAyB;CACjD,CAAC;AAEF;;;GAGG;AACH,SAAS,iBAAiB,CAAC,WAAmB,EAAE,SAAiB;IAC/D,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC;IAC1E,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;QACpC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CAAC;QACH,MAAM,OAA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;IACvC,IAAI,OAAO,EAAE,CAAC;QACZ,MAAM,IAAI,gBAAgB,OAAO,IAAI,CAAC;IACxC,CAAC;IAED,MAAM,IAAI;;;;;CAKX,CAAC;IAEA,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Porch Protocol Loading
3
+ *
4
+ * Loads protocol definitions from JSON files.
5
+ * Fails loudly if protocol not found or invalid.
6
+ */
7
+ import type { Protocol, ProtocolPhase, BuildConfig, VerifyConfig, OnCompleteConfig, CheckDef } from './types.js';
8
+ /**
9
+ * Find and load a protocol by name
10
+ * Fails loudly if not found or invalid.
11
+ */
12
+ export declare function loadProtocol(projectRoot: string, protocolName: string): Protocol;
13
+ /**
14
+ * Get phase configuration by id
15
+ */
16
+ export declare function getPhaseConfig(protocol: Protocol, phaseId: string): ProtocolPhase | null;
17
+ /**
18
+ * Get the next phase after the given phase
19
+ */
20
+ export declare function getNextPhase(protocol: Protocol, currentPhaseId: string): ProtocolPhase | null;
21
+ /**
22
+ * Get check definitions for a phase
23
+ */
24
+ export declare function getPhaseChecks(protocol: Protocol, phaseId: string): Record<string, CheckDef>;
25
+ /**
26
+ * Get gate name for a phase (if any)
27
+ */
28
+ export declare function getPhaseGate(protocol: Protocol, phaseId: string): string | null;
29
+ /**
30
+ * Check if a phase runs per plan phase
31
+ */
32
+ export declare function isPhased(protocol: Protocol, phaseId: string): boolean;
33
+ /**
34
+ * Get checks to run when a plan phase completes (after evaluate stage)
35
+ */
36
+ export declare function getPhaseCompletionChecks(protocol: Protocol): Record<string, string>;
37
+ /**
38
+ * Check if a phase uses the build-verify cycle.
39
+ * A phase uses build-verify if it has both build and verify configs,
40
+ * regardless of whether type is 'build_verify' or 'per_plan_phase'.
41
+ */
42
+ export declare function isBuildVerify(protocol: Protocol, phaseId: string): boolean;
43
+ /**
44
+ * Get build config for a phase
45
+ */
46
+ export declare function getBuildConfig(protocol: Protocol, phaseId: string): BuildConfig | null;
47
+ /**
48
+ * Get verify config for a phase
49
+ */
50
+ export declare function getVerifyConfig(protocol: Protocol, phaseId: string): VerifyConfig | null;
51
+ /**
52
+ * Get max iterations for a build_verify phase
53
+ */
54
+ export declare function getMaxIterations(protocol: Protocol, phaseId: string): number;
55
+ /**
56
+ * Get on_complete config for a phase
57
+ */
58
+ export declare function getOnCompleteConfig(protocol: Protocol, phaseId: string): OnCompleteConfig | null;
59
+ //# sourceMappingURL=protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../../src/commands/porch/protocol.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAYjH;;;GAGG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,QAAQ,CAoBhF;AAuLD;;GAEG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAExF;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAM7F;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAa5F;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAG/E;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAGrE;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,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