@rryando/arcs 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (370) hide show
  1. package/README.md +448 -0
  2. package/dist/cli/arcs-orchestrate-caveman.d.ts +16 -0
  3. package/dist/cli/arcs-orchestrate-caveman.d.ts.map +1 -0
  4. package/dist/cli/arcs-orchestrate-caveman.js +109 -0
  5. package/dist/cli/arcs-orchestrate-caveman.js.map +1 -0
  6. package/dist/cli/arcs-orchestrate.d.ts +2 -0
  7. package/dist/cli/arcs-orchestrate.d.ts.map +1 -0
  8. package/dist/cli/arcs-orchestrate.js +431 -0
  9. package/dist/cli/arcs-orchestrate.js.map +1 -0
  10. package/dist/cli/arg-parser.d.ts +20 -0
  11. package/dist/cli/arg-parser.d.ts.map +1 -0
  12. package/dist/cli/arg-parser.js +216 -0
  13. package/dist/cli/arg-parser.js.map +1 -0
  14. package/dist/cli/brief-renderer.d.ts +32 -0
  15. package/dist/cli/brief-renderer.d.ts.map +1 -0
  16. package/dist/cli/brief-renderer.js +67 -0
  17. package/dist/cli/brief-renderer.js.map +1 -0
  18. package/dist/cli/bundle-installer.d.ts +77 -0
  19. package/dist/cli/bundle-installer.d.ts.map +1 -0
  20. package/dist/cli/bundle-installer.js +328 -0
  21. package/dist/cli/bundle-installer.js.map +1 -0
  22. package/dist/cli/command-registry.d.ts +52 -0
  23. package/dist/cli/command-registry.d.ts.map +1 -0
  24. package/dist/cli/command-registry.js +68 -0
  25. package/dist/cli/command-registry.js.map +1 -0
  26. package/dist/cli/commands/batch.d.ts +2 -0
  27. package/dist/cli/commands/batch.d.ts.map +1 -0
  28. package/dist/cli/commands/batch.js +307 -0
  29. package/dist/cli/commands/batch.js.map +1 -0
  30. package/dist/cli/commands/brief.d.ts +2 -0
  31. package/dist/cli/commands/brief.d.ts.map +1 -0
  32. package/dist/cli/commands/brief.js +146 -0
  33. package/dist/cli/commands/brief.js.map +1 -0
  34. package/dist/cli/commands/bundle.d.ts +2 -0
  35. package/dist/cli/commands/bundle.d.ts.map +1 -0
  36. package/dist/cli/commands/bundle.js +90 -0
  37. package/dist/cli/commands/bundle.js.map +1 -0
  38. package/dist/cli/commands/dependency.d.ts +2 -0
  39. package/dist/cli/commands/dependency.d.ts.map +1 -0
  40. package/dist/cli/commands/dependency.js +260 -0
  41. package/dist/cli/commands/dependency.js.map +1 -0
  42. package/dist/cli/commands/diagnostics.d.ts +2 -0
  43. package/dist/cli/commands/diagnostics.d.ts.map +1 -0
  44. package/dist/cli/commands/diagnostics.js +91 -0
  45. package/dist/cli/commands/diagnostics.js.map +1 -0
  46. package/dist/cli/commands/diagram.d.ts +2 -0
  47. package/dist/cli/commands/diagram.d.ts.map +1 -0
  48. package/dist/cli/commands/diagram.js +305 -0
  49. package/dist/cli/commands/diagram.js.map +1 -0
  50. package/dist/cli/commands/done.d.ts +2 -0
  51. package/dist/cli/commands/done.d.ts.map +1 -0
  52. package/dist/cli/commands/done.js +140 -0
  53. package/dist/cli/commands/done.js.map +1 -0
  54. package/dist/cli/commands/graph.d.ts +2 -0
  55. package/dist/cli/commands/graph.d.ts.map +1 -0
  56. package/dist/cli/commands/graph.js +105 -0
  57. package/dist/cli/commands/graph.js.map +1 -0
  58. package/dist/cli/commands/index.d.ts +21 -0
  59. package/dist/cli/commands/index.d.ts.map +1 -0
  60. package/dist/cli/commands/index.js +22 -0
  61. package/dist/cli/commands/index.js.map +1 -0
  62. package/dist/cli/commands/knowledge-search.d.ts +2 -0
  63. package/dist/cli/commands/knowledge-search.d.ts.map +1 -0
  64. package/dist/cli/commands/knowledge-search.js +43 -0
  65. package/dist/cli/commands/knowledge-search.js.map +1 -0
  66. package/dist/cli/commands/knowledge.d.ts +2 -0
  67. package/dist/cli/commands/knowledge.d.ts.map +1 -0
  68. package/dist/cli/commands/knowledge.js +416 -0
  69. package/dist/cli/commands/knowledge.js.map +1 -0
  70. package/dist/cli/commands/loop.d.ts +2 -0
  71. package/dist/cli/commands/loop.d.ts.map +1 -0
  72. package/dist/cli/commands/loop.js +192 -0
  73. package/dist/cli/commands/loop.js.map +1 -0
  74. package/dist/cli/commands/maintenance.d.ts +2 -0
  75. package/dist/cli/commands/maintenance.d.ts.map +1 -0
  76. package/dist/cli/commands/maintenance.js +231 -0
  77. package/dist/cli/commands/maintenance.js.map +1 -0
  78. package/dist/cli/commands/next.d.ts +2 -0
  79. package/dist/cli/commands/next.d.ts.map +1 -0
  80. package/dist/cli/commands/next.js +116 -0
  81. package/dist/cli/commands/next.js.map +1 -0
  82. package/dist/cli/commands/plan.d.ts +2 -0
  83. package/dist/cli/commands/plan.d.ts.map +1 -0
  84. package/dist/cli/commands/plan.js +340 -0
  85. package/dist/cli/commands/plan.js.map +1 -0
  86. package/dist/cli/commands/project-updates.d.ts +2 -0
  87. package/dist/cli/commands/project-updates.d.ts.map +1 -0
  88. package/dist/cli/commands/project-updates.js +243 -0
  89. package/dist/cli/commands/project-updates.js.map +1 -0
  90. package/dist/cli/commands/project.d.ts +2 -0
  91. package/dist/cli/commands/project.d.ts.map +1 -0
  92. package/dist/cli/commands/project.js +362 -0
  93. package/dist/cli/commands/project.js.map +1 -0
  94. package/dist/cli/commands/remember.d.ts +2 -0
  95. package/dist/cli/commands/remember.d.ts.map +1 -0
  96. package/dist/cli/commands/remember.js +70 -0
  97. package/dist/cli/commands/remember.js.map +1 -0
  98. package/dist/cli/commands/status.d.ts +2 -0
  99. package/dist/cli/commands/status.d.ts.map +1 -0
  100. package/dist/cli/commands/status.js +104 -0
  101. package/dist/cli/commands/status.js.map +1 -0
  102. package/dist/cli/commands/task.d.ts +6 -0
  103. package/dist/cli/commands/task.d.ts.map +1 -0
  104. package/dist/cli/commands/task.js +361 -0
  105. package/dist/cli/commands/task.js.map +1 -0
  106. package/dist/cli/commands/utility.d.ts +9 -0
  107. package/dist/cli/commands/utility.d.ts.map +1 -0
  108. package/dist/cli/commands/utility.js +302 -0
  109. package/dist/cli/commands/utility.js.map +1 -0
  110. package/dist/cli/config.d.ts +42 -0
  111. package/dist/cli/config.d.ts.map +1 -0
  112. package/dist/cli/config.js +134 -0
  113. package/dist/cli/config.js.map +1 -0
  114. package/dist/cli/dag-commands.d.ts +7 -0
  115. package/dist/cli/dag-commands.d.ts.map +1 -0
  116. package/dist/cli/dag-commands.js +152 -0
  117. package/dist/cli/dag-commands.js.map +1 -0
  118. package/dist/cli/diagram-renderer.d.ts +26 -0
  119. package/dist/cli/diagram-renderer.d.ts.map +1 -0
  120. package/dist/cli/diagram-renderer.js +118 -0
  121. package/dist/cli/diagram-renderer.js.map +1 -0
  122. package/dist/cli/help-generator.d.ts +21 -0
  123. package/dist/cli/help-generator.d.ts.map +1 -0
  124. package/dist/cli/help-generator.js +100 -0
  125. package/dist/cli/help-generator.js.map +1 -0
  126. package/dist/cli/index.d.ts +8 -0
  127. package/dist/cli/index.d.ts.map +1 -0
  128. package/dist/cli/index.js +95 -0
  129. package/dist/cli/index.js.map +1 -0
  130. package/dist/cli/instructions.d.ts +53 -0
  131. package/dist/cli/instructions.d.ts.map +1 -0
  132. package/dist/cli/instructions.js +219 -0
  133. package/dist/cli/instructions.js.map +1 -0
  134. package/dist/cli/lean-output.d.ts +15 -0
  135. package/dist/cli/lean-output.d.ts.map +1 -0
  136. package/dist/cli/lean-output.js +66 -0
  137. package/dist/cli/lean-output.js.map +1 -0
  138. package/dist/cli/md-renderer.d.ts +6 -0
  139. package/dist/cli/md-renderer.d.ts.map +1 -0
  140. package/dist/cli/md-renderer.js +396 -0
  141. package/dist/cli/md-renderer.js.map +1 -0
  142. package/dist/cli/output-envelope.d.ts +15 -0
  143. package/dist/cli/output-envelope.d.ts.map +1 -0
  144. package/dist/cli/output-envelope.js +61 -0
  145. package/dist/cli/output-envelope.js.map +1 -0
  146. package/dist/cli/setup.d.ts +11 -0
  147. package/dist/cli/setup.d.ts.map +1 -0
  148. package/dist/cli/setup.js +415 -0
  149. package/dist/cli/setup.js.map +1 -0
  150. package/dist/cli/status-dashboard.d.ts +5 -0
  151. package/dist/cli/status-dashboard.d.ts.map +1 -0
  152. package/dist/cli/status-dashboard.js +248 -0
  153. package/dist/cli/status-dashboard.js.map +1 -0
  154. package/dist/index.d.ts +3 -0
  155. package/dist/index.d.ts.map +1 -0
  156. package/dist/index.js +25 -0
  157. package/dist/index.js.map +1 -0
  158. package/dist/retrieval/bm25.d.ts +23 -0
  159. package/dist/retrieval/bm25.d.ts.map +1 -0
  160. package/dist/retrieval/bm25.js +92 -0
  161. package/dist/retrieval/bm25.js.map +1 -0
  162. package/dist/retrieval/cross-project-search.d.ts +30 -0
  163. package/dist/retrieval/cross-project-search.d.ts.map +1 -0
  164. package/dist/retrieval/cross-project-search.js +109 -0
  165. package/dist/retrieval/cross-project-search.js.map +1 -0
  166. package/dist/retrieval/graph-builder.d.ts +6 -0
  167. package/dist/retrieval/graph-builder.d.ts.map +1 -0
  168. package/dist/retrieval/graph-builder.js +196 -0
  169. package/dist/retrieval/graph-builder.js.map +1 -0
  170. package/dist/retrieval/graph-cache.d.ts +15 -0
  171. package/dist/retrieval/graph-cache.d.ts.map +1 -0
  172. package/dist/retrieval/graph-cache.js +66 -0
  173. package/dist/retrieval/graph-cache.js.map +1 -0
  174. package/dist/retrieval/graph-invalidate.d.ts +18 -0
  175. package/dist/retrieval/graph-invalidate.d.ts.map +1 -0
  176. package/dist/retrieval/graph-invalidate.js +23 -0
  177. package/dist/retrieval/graph-invalidate.js.map +1 -0
  178. package/dist/retrieval/graph-retrieval.d.ts +24 -0
  179. package/dist/retrieval/graph-retrieval.d.ts.map +1 -0
  180. package/dist/retrieval/graph-retrieval.js +165 -0
  181. package/dist/retrieval/graph-retrieval.js.map +1 -0
  182. package/dist/retrieval/graph-traverse.d.ts +3 -0
  183. package/dist/retrieval/graph-traverse.d.ts.map +1 -0
  184. package/dist/retrieval/graph-traverse.js +53 -0
  185. package/dist/retrieval/graph-traverse.js.map +1 -0
  186. package/dist/retrieval/graph-types.d.ts +37 -0
  187. package/dist/retrieval/graph-types.d.ts.map +1 -0
  188. package/dist/retrieval/graph-types.js +12 -0
  189. package/dist/retrieval/graph-types.js.map +1 -0
  190. package/dist/retrieval/index-builder.d.ts +21 -0
  191. package/dist/retrieval/index-builder.d.ts.map +1 -0
  192. package/dist/retrieval/index-builder.js +94 -0
  193. package/dist/retrieval/index-builder.js.map +1 -0
  194. package/dist/retrieval/knowledge-selection.d.ts +7 -0
  195. package/dist/retrieval/knowledge-selection.d.ts.map +1 -0
  196. package/dist/retrieval/knowledge-selection.js +80 -0
  197. package/dist/retrieval/knowledge-selection.js.map +1 -0
  198. package/dist/retrieval/task-scoped.d.ts +23 -0
  199. package/dist/retrieval/task-scoped.d.ts.map +1 -0
  200. package/dist/retrieval/task-scoped.js +51 -0
  201. package/dist/retrieval/task-scoped.js.map +1 -0
  202. package/dist/utils/content-assembly.d.ts +44 -0
  203. package/dist/utils/content-assembly.d.ts.map +1 -0
  204. package/dist/utils/content-assembly.js +101 -0
  205. package/dist/utils/content-assembly.js.map +1 -0
  206. package/dist/utils/dag.d.ts +28 -0
  207. package/dist/utils/dag.d.ts.map +1 -0
  208. package/dist/utils/dag.js +68 -0
  209. package/dist/utils/dag.js.map +1 -0
  210. package/dist/utils/diagram-generator.d.ts +17 -0
  211. package/dist/utils/diagram-generator.d.ts.map +1 -0
  212. package/dist/utils/diagram-generator.js +38 -0
  213. package/dist/utils/diagram-generator.js.map +1 -0
  214. package/dist/utils/errors.d.ts +40 -0
  215. package/dist/utils/errors.d.ts.map +1 -0
  216. package/dist/utils/errors.js +83 -0
  217. package/dist/utils/errors.js.map +1 -0
  218. package/dist/utils/file-lock.d.ts +13 -0
  219. package/dist/utils/file-lock.d.ts.map +1 -0
  220. package/dist/utils/file-lock.js +80 -0
  221. package/dist/utils/file-lock.js.map +1 -0
  222. package/dist/utils/git.d.ts +14 -0
  223. package/dist/utils/git.d.ts.map +1 -0
  224. package/dist/utils/git.js +56 -0
  225. package/dist/utils/git.js.map +1 -0
  226. package/dist/utils/graphify-knowledge.d.ts +6 -0
  227. package/dist/utils/graphify-knowledge.d.ts.map +1 -0
  228. package/dist/utils/graphify-knowledge.js +60 -0
  229. package/dist/utils/graphify-knowledge.js.map +1 -0
  230. package/dist/utils/graphify.d.ts +49 -0
  231. package/dist/utils/graphify.d.ts.map +1 -0
  232. package/dist/utils/graphify.js +306 -0
  233. package/dist/utils/graphify.js.map +1 -0
  234. package/dist/utils/json-schemas.d.ts +723 -0
  235. package/dist/utils/json-schemas.d.ts.map +1 -0
  236. package/dist/utils/json-schemas.js +147 -0
  237. package/dist/utils/json-schemas.js.map +1 -0
  238. package/dist/utils/json.d.ts +15 -0
  239. package/dist/utils/json.d.ts.map +1 -0
  240. package/dist/utils/json.js +39 -0
  241. package/dist/utils/json.js.map +1 -0
  242. package/dist/utils/knowledge-store.d.ts +49 -0
  243. package/dist/utils/knowledge-store.d.ts.map +1 -0
  244. package/dist/utils/knowledge-store.js +191 -0
  245. package/dist/utils/knowledge-store.js.map +1 -0
  246. package/dist/utils/loop-state.d.ts +51 -0
  247. package/dist/utils/loop-state.d.ts.map +1 -0
  248. package/dist/utils/loop-state.js +123 -0
  249. package/dist/utils/loop-state.js.map +1 -0
  250. package/dist/utils/paths.d.ts +16 -0
  251. package/dist/utils/paths.d.ts.map +1 -0
  252. package/dist/utils/paths.js +66 -0
  253. package/dist/utils/paths.js.map +1 -0
  254. package/dist/utils/plan-store.d.ts +46 -0
  255. package/dist/utils/plan-store.d.ts.map +1 -0
  256. package/dist/utils/plan-store.js +184 -0
  257. package/dist/utils/plan-store.js.map +1 -0
  258. package/dist/utils/project-documents.d.ts +20 -0
  259. package/dist/utils/project-documents.d.ts.map +1 -0
  260. package/dist/utils/project-documents.js +10 -0
  261. package/dist/utils/project-documents.js.map +1 -0
  262. package/dist/utils/project-memory.d.ts +16 -0
  263. package/dist/utils/project-memory.d.ts.map +1 -0
  264. package/dist/utils/project-memory.js +16 -0
  265. package/dist/utils/project-memory.js.map +1 -0
  266. package/dist/utils/project-resolver.d.ts +28 -0
  267. package/dist/utils/project-resolver.d.ts.map +1 -0
  268. package/dist/utils/project-resolver.js +119 -0
  269. package/dist/utils/project-resolver.js.map +1 -0
  270. package/dist/utils/quick-scan.d.ts +13 -0
  271. package/dist/utils/quick-scan.d.ts.map +1 -0
  272. package/dist/utils/quick-scan.js +156 -0
  273. package/dist/utils/quick-scan.js.map +1 -0
  274. package/dist/utils/schemas.d.ts +13 -0
  275. package/dist/utils/schemas.d.ts.map +1 -0
  276. package/dist/utils/schemas.js +6 -0
  277. package/dist/utils/schemas.js.map +1 -0
  278. package/dist/utils/slug.d.ts +10 -0
  279. package/dist/utils/slug.d.ts.map +1 -0
  280. package/dist/utils/slug.js +18 -0
  281. package/dist/utils/slug.js.map +1 -0
  282. package/dist/utils/stdin.d.ts +6 -0
  283. package/dist/utils/stdin.d.ts.map +1 -0
  284. package/dist/utils/stdin.js +25 -0
  285. package/dist/utils/stdin.js.map +1 -0
  286. package/dist/utils/storage-utils.d.ts +48 -0
  287. package/dist/utils/storage-utils.d.ts.map +1 -0
  288. package/dist/utils/storage-utils.js +175 -0
  289. package/dist/utils/storage-utils.js.map +1 -0
  290. package/dist/utils/task-store.d.ts +49 -0
  291. package/dist/utils/task-store.d.ts.map +1 -0
  292. package/dist/utils/task-store.js +178 -0
  293. package/dist/utils/task-store.js.map +1 -0
  294. package/dist/utils/template.d.ts +15 -0
  295. package/dist/utils/template.d.ts.map +1 -0
  296. package/dist/utils/template.js +27 -0
  297. package/dist/utils/template.js.map +1 -0
  298. package/dist/utils/tool-response.d.ts +37 -0
  299. package/dist/utils/tool-response.d.ts.map +1 -0
  300. package/dist/utils/tool-response.js +44 -0
  301. package/dist/utils/tool-response.js.map +1 -0
  302. package/dist/utils/workflow-policy.d.ts +50 -0
  303. package/dist/utils/workflow-policy.d.ts.map +1 -0
  304. package/dist/utils/workflow-policy.js +111 -0
  305. package/dist/utils/workflow-policy.js.map +1 -0
  306. package/dist/utils/workspace-match.d.ts +35 -0
  307. package/dist/utils/workspace-match.d.ts.map +1 -0
  308. package/dist/utils/workspace-match.js +58 -0
  309. package/dist/utils/workspace-match.js.map +1 -0
  310. package/opencode/arcs/.opencode/plugins/arcs.js +348 -0
  311. package/opencode/arcs/bundle-runtime.json +68 -0
  312. package/opencode/arcs/manifest.json +279 -0
  313. package/opencode/arcs/prompts/arcs-docs.txt +124 -0
  314. package/opencode/arcs/prompts/arcs-orchestrate-caveman.txt +529 -0
  315. package/opencode/arcs/prompts/arcs-orchestrate.txt +437 -0
  316. package/opencode/arcs/prompts/code-reviewer.txt +55 -0
  317. package/opencode/arcs/prompts/devil-advocate.txt +121 -0
  318. package/opencode/arcs/prompts/docs-researcher.txt +54 -0
  319. package/opencode/arcs/prompts/oncall-ops.txt +54 -0
  320. package/opencode/arcs/prompts/qa-analyst.txt +54 -0
  321. package/opencode/arcs/prompts/software-engineer.txt +48 -0
  322. package/opencode/arcs/prompts/system-architect.txt +60 -0
  323. package/opencode/arcs/prompts/tech-architect.txt +54 -0
  324. package/opencode/arcs/skills/brainstorming/SKILL.md +144 -0
  325. package/opencode/arcs/skills/brainstorming/scripts/frame-template.html +214 -0
  326. package/opencode/arcs/skills/brainstorming/scripts/helper.js +88 -0
  327. package/opencode/arcs/skills/brainstorming/scripts/server.js +338 -0
  328. package/opencode/arcs/skills/brainstorming/scripts/start-server.sh +137 -0
  329. package/opencode/arcs/skills/brainstorming/scripts/stop-server.sh +31 -0
  330. package/opencode/arcs/skills/brainstorming/spec-document-reviewer-prompt.md +50 -0
  331. package/opencode/arcs/skills/brainstorming/visual-companion.md +277 -0
  332. package/opencode/arcs/skills/caveman-commit/SKILL.md +51 -0
  333. package/opencode/arcs/skills/code-agent/SKILL.md +58 -0
  334. package/opencode/arcs/skills/deep-pr-review/SKILL.md +191 -0
  335. package/opencode/arcs/skills/deep-pr-review/graphify-diff.md +102 -0
  336. package/opencode/arcs/skills/deep-pr-review/review-template.md +69 -0
  337. package/opencode/arcs/skills/executing-plans/SKILL.md +91 -0
  338. package/opencode/arcs/skills/init-project/SKILL.md +150 -0
  339. package/opencode/arcs/skills/quick-dev/SKILL.md +47 -0
  340. package/opencode/arcs/skills/requesting-code-review/SKILL.md +47 -0
  341. package/opencode/arcs/skills/requesting-code-review/code-reviewer.md +179 -0
  342. package/opencode/arcs/skills/subagent-driven-development/SKILL.md +162 -0
  343. package/opencode/arcs/skills/subagent-driven-development/code-quality-reviewer-prompt.md +53 -0
  344. package/opencode/arcs/skills/subagent-driven-development/implementer-prompt.md +148 -0
  345. package/opencode/arcs/skills/subagent-driven-development/spec-reviewer-prompt.md +85 -0
  346. package/opencode/arcs/skills/systematic-debugging/SKILL.md +174 -0
  347. package/opencode/arcs/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
  348. package/opencode/arcs/skills/systematic-debugging/condition-based-waiting.md +115 -0
  349. package/opencode/arcs/skills/systematic-debugging/defense-in-depth.md +122 -0
  350. package/opencode/arcs/skills/systematic-debugging/find-polluter.sh +63 -0
  351. package/opencode/arcs/skills/systematic-debugging/phases-reference.md +168 -0
  352. package/opencode/arcs/skills/systematic-debugging/root-cause-tracing.md +169 -0
  353. package/opencode/arcs/skills/test-driven-development/SKILL.md +72 -0
  354. package/opencode/arcs/skills/test-driven-development/tdd-rationalizations-and-examples.md +157 -0
  355. package/opencode/arcs/skills/test-driven-development/testing-anti-patterns.md +299 -0
  356. package/opencode/arcs/skills/to-diagram/SKILL.md +235 -0
  357. package/opencode/arcs/skills/to-diagram/scripts/manage-diagram.mjs +963 -0
  358. package/opencode/arcs/skills/writing-plans/SKILL.md +179 -0
  359. package/opencode/arcs/skills/writing-plans/plan-document-reviewer-prompt.md +52 -0
  360. package/package.json +60 -0
  361. package/scripts/arcs-cli.mjs +45 -0
  362. package/skills/explore-dag.md +57 -0
  363. package/skills/init-project.md +105 -0
  364. package/skills/orchestrate.md +94 -0
  365. package/skills/update-docs.md +72 -0
  366. package/templates/dependency.md.tmpl +9 -0
  367. package/templates/knowledge.md.tmpl +15 -0
  368. package/templates/project-meta.json.tmpl +13 -0
  369. package/templates/project.md.tmpl +11 -0
  370. package/templates/task.md.tmpl +9 -0
@@ -0,0 +1,88 @@
1
+ (function() {
2
+ const WS_URL = 'ws://' + window.location.host;
3
+ let ws = null;
4
+ let eventQueue = [];
5
+
6
+ function connect() {
7
+ ws = new WebSocket(WS_URL);
8
+
9
+ ws.onopen = () => {
10
+ eventQueue.forEach(e => ws.send(JSON.stringify(e)));
11
+ eventQueue = [];
12
+ };
13
+
14
+ ws.onmessage = (msg) => {
15
+ const data = JSON.parse(msg.data);
16
+ if (data.type === 'reload') {
17
+ window.location.reload();
18
+ }
19
+ };
20
+
21
+ ws.onclose = () => {
22
+ setTimeout(connect, 1000);
23
+ };
24
+ }
25
+
26
+ function sendEvent(event) {
27
+ event.timestamp = Date.now();
28
+ if (ws && ws.readyState === WebSocket.OPEN) {
29
+ ws.send(JSON.stringify(event));
30
+ } else {
31
+ eventQueue.push(event);
32
+ }
33
+ }
34
+
35
+ // Capture clicks on choice elements
36
+ document.addEventListener('click', (e) => {
37
+ const target = e.target.closest('[data-choice]');
38
+ if (!target) return;
39
+
40
+ sendEvent({
41
+ type: 'click',
42
+ text: target.textContent.trim(),
43
+ choice: target.dataset.choice,
44
+ id: target.id || null
45
+ });
46
+
47
+ // Update indicator bar (defer so toggleSelect runs first)
48
+ setTimeout(() => {
49
+ const indicator = document.getElementById('indicator-text');
50
+ if (!indicator) return;
51
+ const container = target.closest('.options') || target.closest('.cards');
52
+ const selected = container ? container.querySelectorAll('.selected') : [];
53
+ if (selected.length === 0) {
54
+ indicator.textContent = 'Click an option above, then return to the terminal';
55
+ } else if (selected.length === 1) {
56
+ const label = selected[0].querySelector('h3, .content h3, .card-body h3')?.textContent?.trim() || selected[0].dataset.choice;
57
+ indicator.innerHTML = '<span class="selected-text">' + label + ' selected</span> — return to terminal to continue';
58
+ } else {
59
+ indicator.innerHTML = '<span class="selected-text">' + selected.length + ' selected</span> — return to terminal to continue';
60
+ }
61
+ }, 0);
62
+ });
63
+
64
+ // Frame UI: selection tracking
65
+ window.selectedChoice = null;
66
+
67
+ window.toggleSelect = function(el) {
68
+ const container = el.closest('.options') || el.closest('.cards');
69
+ const multi = container && container.dataset.multiselect !== undefined;
70
+ if (container && !multi) {
71
+ container.querySelectorAll('.option, .card').forEach(o => o.classList.remove('selected'));
72
+ }
73
+ if (multi) {
74
+ el.classList.toggle('selected');
75
+ } else {
76
+ el.classList.add('selected');
77
+ }
78
+ window.selectedChoice = el.dataset.choice;
79
+ };
80
+
81
+ // Expose API for explicit use
82
+ window.brainstorm = {
83
+ send: sendEvent,
84
+ choice: (value, metadata = {}) => sendEvent({ type: 'choice', value, ...metadata })
85
+ };
86
+
87
+ connect();
88
+ })();
@@ -0,0 +1,338 @@
1
+ const crypto = require('crypto');
2
+ const http = require('http');
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+
6
+ // ========== WebSocket Protocol (RFC 6455) ==========
7
+
8
+ const OPCODES = { TEXT: 0x01, CLOSE: 0x08, PING: 0x09, PONG: 0x0A };
9
+ const WS_MAGIC = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11';
10
+
11
+ function computeAcceptKey(clientKey) {
12
+ return crypto.createHash('sha1').update(clientKey + WS_MAGIC).digest('base64');
13
+ }
14
+
15
+ function encodeFrame(opcode, payload) {
16
+ const fin = 0x80;
17
+ const len = payload.length;
18
+ let header;
19
+
20
+ if (len < 126) {
21
+ header = Buffer.alloc(2);
22
+ header[0] = fin | opcode;
23
+ header[1] = len;
24
+ } else if (len < 65536) {
25
+ header = Buffer.alloc(4);
26
+ header[0] = fin | opcode;
27
+ header[1] = 126;
28
+ header.writeUInt16BE(len, 2);
29
+ } else {
30
+ header = Buffer.alloc(10);
31
+ header[0] = fin | opcode;
32
+ header[1] = 127;
33
+ header.writeBigUInt64BE(BigInt(len), 2);
34
+ }
35
+
36
+ return Buffer.concat([header, payload]);
37
+ }
38
+
39
+ function decodeFrame(buffer) {
40
+ if (buffer.length < 2) return null;
41
+
42
+ const secondByte = buffer[1];
43
+ const opcode = buffer[0] & 0x0F;
44
+ const masked = (secondByte & 0x80) !== 0;
45
+ let payloadLen = secondByte & 0x7F;
46
+ let offset = 2;
47
+
48
+ if (!masked) throw new Error('Client frames must be masked');
49
+
50
+ if (payloadLen === 126) {
51
+ if (buffer.length < 4) return null;
52
+ payloadLen = buffer.readUInt16BE(2);
53
+ offset = 4;
54
+ } else if (payloadLen === 127) {
55
+ if (buffer.length < 10) return null;
56
+ payloadLen = Number(buffer.readBigUInt64BE(2));
57
+ offset = 10;
58
+ }
59
+
60
+ const maskOffset = offset;
61
+ const dataOffset = offset + 4;
62
+ const totalLen = dataOffset + payloadLen;
63
+ if (buffer.length < totalLen) return null;
64
+
65
+ const mask = buffer.slice(maskOffset, dataOffset);
66
+ const data = Buffer.alloc(payloadLen);
67
+ for (let i = 0; i < payloadLen; i++) {
68
+ data[i] = buffer[dataOffset + i] ^ mask[i % 4];
69
+ }
70
+
71
+ return { opcode, payload: data, bytesConsumed: totalLen };
72
+ }
73
+
74
+ // ========== Configuration ==========
75
+
76
+ const PORT = process.env.BRAINSTORM_PORT || (49152 + Math.floor(Math.random() * 16383));
77
+ const HOST = process.env.BRAINSTORM_HOST || '127.0.0.1';
78
+ const URL_HOST = process.env.BRAINSTORM_URL_HOST || (HOST === '127.0.0.1' ? 'localhost' : HOST);
79
+ const SCREEN_DIR = process.env.BRAINSTORM_DIR || '/tmp/brainstorm';
80
+ const OWNER_PID = process.env.BRAINSTORM_OWNER_PID ? Number(process.env.BRAINSTORM_OWNER_PID) : null;
81
+
82
+ const MIME_TYPES = {
83
+ '.html': 'text/html', '.css': 'text/css', '.js': 'application/javascript',
84
+ '.json': 'application/json', '.png': 'image/png', '.jpg': 'image/jpeg',
85
+ '.jpeg': 'image/jpeg', '.gif': 'image/gif', '.svg': 'image/svg+xml'
86
+ };
87
+
88
+ // ========== Templates and Constants ==========
89
+
90
+ const WAITING_PAGE = `<!DOCTYPE html>
91
+ <html>
92
+ <head><meta charset="utf-8"><title>Brainstorm Companion</title>
93
+ <style>body { font-family: system-ui, sans-serif; padding: 2rem; max-width: 800px; margin: 0 auto; }
94
+ h1 { color: #333; } p { color: #666; }</style>
95
+ </head>
96
+ <body><h1>Brainstorm Companion</h1>
97
+ <p>Waiting for Claude to push a screen...</p></body></html>`;
98
+
99
+ const frameTemplate = fs.readFileSync(path.join(__dirname, 'frame-template.html'), 'utf-8');
100
+ const helperScript = fs.readFileSync(path.join(__dirname, 'helper.js'), 'utf-8');
101
+ const helperInjection = '<script>\n' + helperScript + '\n</script>';
102
+
103
+ // ========== Helper Functions ==========
104
+
105
+ function isFullDocument(html) {
106
+ const trimmed = html.trimStart().toLowerCase();
107
+ return trimmed.startsWith('<!doctype') || trimmed.startsWith('<html');
108
+ }
109
+
110
+ function wrapInFrame(content) {
111
+ return frameTemplate.replace('<!-- CONTENT -->', content);
112
+ }
113
+
114
+ function getNewestScreen() {
115
+ const files = fs.readdirSync(SCREEN_DIR)
116
+ .filter(f => f.endsWith('.html'))
117
+ .map(f => {
118
+ const fp = path.join(SCREEN_DIR, f);
119
+ return { path: fp, mtime: fs.statSync(fp).mtime.getTime() };
120
+ })
121
+ .sort((a, b) => b.mtime - a.mtime);
122
+ return files.length > 0 ? files[0].path : null;
123
+ }
124
+
125
+ // ========== HTTP Request Handler ==========
126
+
127
+ function handleRequest(req, res) {
128
+ touchActivity();
129
+ if (req.method === 'GET' && req.url === '/') {
130
+ const screenFile = getNewestScreen();
131
+ let html = screenFile
132
+ ? (raw => isFullDocument(raw) ? raw : wrapInFrame(raw))(fs.readFileSync(screenFile, 'utf-8'))
133
+ : WAITING_PAGE;
134
+
135
+ if (html.includes('</body>')) {
136
+ html = html.replace('</body>', helperInjection + '\n</body>');
137
+ } else {
138
+ html += helperInjection;
139
+ }
140
+
141
+ res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8' });
142
+ res.end(html);
143
+ } else if (req.method === 'GET' && req.url.startsWith('/files/')) {
144
+ const fileName = req.url.slice(7);
145
+ const filePath = path.join(SCREEN_DIR, path.basename(fileName));
146
+ if (!fs.existsSync(filePath)) {
147
+ res.writeHead(404);
148
+ res.end('Not found');
149
+ return;
150
+ }
151
+ const ext = path.extname(filePath).toLowerCase();
152
+ const contentType = MIME_TYPES[ext] || 'application/octet-stream';
153
+ res.writeHead(200, { 'Content-Type': contentType });
154
+ res.end(fs.readFileSync(filePath));
155
+ } else {
156
+ res.writeHead(404);
157
+ res.end('Not found');
158
+ }
159
+ }
160
+
161
+ // ========== WebSocket Connection Handling ==========
162
+
163
+ const clients = new Set();
164
+
165
+ function handleUpgrade(req, socket) {
166
+ const key = req.headers['sec-websocket-key'];
167
+ if (!key) { socket.destroy(); return; }
168
+
169
+ const accept = computeAcceptKey(key);
170
+ socket.write(
171
+ 'HTTP/1.1 101 Switching Protocols\r\n' +
172
+ 'Upgrade: websocket\r\n' +
173
+ 'Connection: Upgrade\r\n' +
174
+ 'Sec-WebSocket-Accept: ' + accept + '\r\n\r\n'
175
+ );
176
+
177
+ let buffer = Buffer.alloc(0);
178
+ clients.add(socket);
179
+
180
+ socket.on('data', (chunk) => {
181
+ buffer = Buffer.concat([buffer, chunk]);
182
+ while (buffer.length > 0) {
183
+ let result;
184
+ try {
185
+ result = decodeFrame(buffer);
186
+ } catch (e) {
187
+ socket.end(encodeFrame(OPCODES.CLOSE, Buffer.alloc(0)));
188
+ clients.delete(socket);
189
+ return;
190
+ }
191
+ if (!result) break;
192
+ buffer = buffer.slice(result.bytesConsumed);
193
+
194
+ switch (result.opcode) {
195
+ case OPCODES.TEXT:
196
+ handleMessage(result.payload.toString());
197
+ break;
198
+ case OPCODES.CLOSE:
199
+ socket.end(encodeFrame(OPCODES.CLOSE, Buffer.alloc(0)));
200
+ clients.delete(socket);
201
+ return;
202
+ case OPCODES.PING:
203
+ socket.write(encodeFrame(OPCODES.PONG, result.payload));
204
+ break;
205
+ case OPCODES.PONG:
206
+ break;
207
+ default: {
208
+ const closeBuf = Buffer.alloc(2);
209
+ closeBuf.writeUInt16BE(1003);
210
+ socket.end(encodeFrame(OPCODES.CLOSE, closeBuf));
211
+ clients.delete(socket);
212
+ return;
213
+ }
214
+ }
215
+ }
216
+ });
217
+
218
+ socket.on('close', () => clients.delete(socket));
219
+ socket.on('error', () => clients.delete(socket));
220
+ }
221
+
222
+ function handleMessage(text) {
223
+ let event;
224
+ try {
225
+ event = JSON.parse(text);
226
+ } catch (e) {
227
+ console.error('Failed to parse WebSocket message:', e.message);
228
+ return;
229
+ }
230
+ touchActivity();
231
+ console.log(JSON.stringify({ source: 'user-event', ...event }));
232
+ if (event.choice) {
233
+ const eventsFile = path.join(SCREEN_DIR, '.events');
234
+ fs.appendFileSync(eventsFile, JSON.stringify(event) + '\n');
235
+ }
236
+ }
237
+
238
+ function broadcast(msg) {
239
+ const frame = encodeFrame(OPCODES.TEXT, Buffer.from(JSON.stringify(msg)));
240
+ for (const socket of clients) {
241
+ try { socket.write(frame); } catch (e) { clients.delete(socket); }
242
+ }
243
+ }
244
+
245
+ // ========== Activity Tracking ==========
246
+
247
+ const IDLE_TIMEOUT_MS = 30 * 60 * 1000; // 30 minutes
248
+ let lastActivity = Date.now();
249
+
250
+ function touchActivity() {
251
+ lastActivity = Date.now();
252
+ }
253
+
254
+ // ========== File Watching ==========
255
+
256
+ const debounceTimers = new Map();
257
+
258
+ // ========== Server Startup ==========
259
+
260
+ function startServer() {
261
+ if (!fs.existsSync(SCREEN_DIR)) fs.mkdirSync(SCREEN_DIR, { recursive: true });
262
+
263
+ // Track known files to distinguish new screens from updates.
264
+ // macOS fs.watch reports 'rename' for both new files and overwrites,
265
+ // so we can't rely on eventType alone.
266
+ const knownFiles = new Set(
267
+ fs.readdirSync(SCREEN_DIR).filter(f => f.endsWith('.html'))
268
+ );
269
+
270
+ const server = http.createServer(handleRequest);
271
+ server.on('upgrade', handleUpgrade);
272
+
273
+ const watcher = fs.watch(SCREEN_DIR, (eventType, filename) => {
274
+ if (!filename || !filename.endsWith('.html')) return;
275
+
276
+ if (debounceTimers.has(filename)) clearTimeout(debounceTimers.get(filename));
277
+ debounceTimers.set(filename, setTimeout(() => {
278
+ debounceTimers.delete(filename);
279
+ const filePath = path.join(SCREEN_DIR, filename);
280
+
281
+ if (!fs.existsSync(filePath)) return; // file was deleted
282
+ touchActivity();
283
+
284
+ if (!knownFiles.has(filename)) {
285
+ knownFiles.add(filename);
286
+ const eventsFile = path.join(SCREEN_DIR, '.events');
287
+ if (fs.existsSync(eventsFile)) fs.unlinkSync(eventsFile);
288
+ console.log(JSON.stringify({ type: 'screen-added', file: filePath }));
289
+ } else {
290
+ console.log(JSON.stringify({ type: 'screen-updated', file: filePath }));
291
+ }
292
+
293
+ broadcast({ type: 'reload' });
294
+ }, 100));
295
+ });
296
+ watcher.on('error', (err) => console.error('fs.watch error:', err.message));
297
+
298
+ function shutdown(reason) {
299
+ console.log(JSON.stringify({ type: 'server-stopped', reason }));
300
+ const infoFile = path.join(SCREEN_DIR, '.server-info');
301
+ if (fs.existsSync(infoFile)) fs.unlinkSync(infoFile);
302
+ fs.writeFileSync(
303
+ path.join(SCREEN_DIR, '.server-stopped'),
304
+ JSON.stringify({ reason, timestamp: Date.now() }) + '\n'
305
+ );
306
+ watcher.close();
307
+ clearInterval(lifecycleCheck);
308
+ server.close(() => process.exit(0));
309
+ }
310
+
311
+ function ownerAlive() {
312
+ if (!OWNER_PID) return true;
313
+ try { process.kill(OWNER_PID, 0); return true; } catch (e) { return false; }
314
+ }
315
+
316
+ // Check every 60s: exit if owner process died or idle for 30 minutes
317
+ const lifecycleCheck = setInterval(() => {
318
+ if (!ownerAlive()) shutdown('owner process exited');
319
+ else if (Date.now() - lastActivity > IDLE_TIMEOUT_MS) shutdown('idle timeout');
320
+ }, 60 * 1000);
321
+ lifecycleCheck.unref();
322
+
323
+ server.listen(PORT, HOST, () => {
324
+ const info = JSON.stringify({
325
+ type: 'server-started', port: Number(PORT), host: HOST,
326
+ url_host: URL_HOST, url: 'http://' + URL_HOST + ':' + PORT,
327
+ screen_dir: SCREEN_DIR
328
+ });
329
+ console.log(info);
330
+ fs.writeFileSync(path.join(SCREEN_DIR, '.server-info'), info + '\n');
331
+ });
332
+ }
333
+
334
+ if (require.main === module) {
335
+ startServer();
336
+ }
337
+
338
+ module.exports = { computeAcceptKey, encodeFrame, decodeFrame, OPCODES };
@@ -0,0 +1,137 @@
1
+ #!/bin/bash
2
+ # Start the brainstorm server and output connection info
3
+ # Usage: start-server.sh [--project-dir <path>] [--host <bind-host>] [--url-host <display-host>] [--foreground] [--background]
4
+ #
5
+ # Starts server on a random high port, outputs JSON with URL.
6
+ # Each session gets its own directory to avoid conflicts.
7
+ #
8
+ # Options:
9
+ # --project-dir <path> Store session files under <path>/.superpowers/brainstorm/
10
+ # instead of /tmp. Files persist after server stops.
11
+ # --host <bind-host> Host/interface to bind (default: 127.0.0.1).
12
+ # Use 0.0.0.0 in remote/containerized environments.
13
+ # --url-host <host> Hostname shown in returned URL JSON.
14
+ # --foreground Run server in the current terminal (no backgrounding).
15
+ # --background Force background mode (overrides Codex auto-foreground).
16
+
17
+ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
18
+
19
+ # Parse arguments
20
+ PROJECT_DIR=""
21
+ FOREGROUND="false"
22
+ FORCE_BACKGROUND="false"
23
+ BIND_HOST="127.0.0.1"
24
+ URL_HOST=""
25
+ while [[ $# -gt 0 ]]; do
26
+ case "$1" in
27
+ --project-dir)
28
+ PROJECT_DIR="$2"
29
+ shift 2
30
+ ;;
31
+ --host)
32
+ BIND_HOST="$2"
33
+ shift 2
34
+ ;;
35
+ --url-host)
36
+ URL_HOST="$2"
37
+ shift 2
38
+ ;;
39
+ --foreground|--no-daemon)
40
+ FOREGROUND="true"
41
+ shift
42
+ ;;
43
+ --background|--daemon)
44
+ FORCE_BACKGROUND="true"
45
+ shift
46
+ ;;
47
+ *)
48
+ echo "{\"error\": \"Unknown argument: $1\"}"
49
+ exit 1
50
+ ;;
51
+ esac
52
+ done
53
+
54
+ if [[ -z "$URL_HOST" ]]; then
55
+ if [[ "$BIND_HOST" == "127.0.0.1" || "$BIND_HOST" == "localhost" ]]; then
56
+ URL_HOST="localhost"
57
+ else
58
+ URL_HOST="$BIND_HOST"
59
+ fi
60
+ fi
61
+
62
+ # Some environments reap detached/background processes. Auto-foreground when detected.
63
+ if [[ -n "${CODEX_CI:-}" && "$FOREGROUND" != "true" && "$FORCE_BACKGROUND" != "true" ]]; then
64
+ FOREGROUND="true"
65
+ fi
66
+
67
+ # Generate unique session directory
68
+ SESSION_ID="$$-$(date +%s)"
69
+
70
+ if [[ -n "$PROJECT_DIR" ]]; then
71
+ SCREEN_DIR="${PROJECT_DIR}/.superpowers/brainstorm/${SESSION_ID}"
72
+ else
73
+ SCREEN_DIR="/tmp/brainstorm-${SESSION_ID}"
74
+ fi
75
+
76
+ PID_FILE="${SCREEN_DIR}/.server.pid"
77
+ LOG_FILE="${SCREEN_DIR}/.server.log"
78
+
79
+ # Create fresh session directory
80
+ mkdir -p "$SCREEN_DIR"
81
+
82
+ # Kill any existing server
83
+ if [[ -f "$PID_FILE" ]]; then
84
+ old_pid=$(cat "$PID_FILE")
85
+ kill "$old_pid" 2>/dev/null
86
+ rm -f "$PID_FILE"
87
+ fi
88
+
89
+ cd "$SCRIPT_DIR"
90
+
91
+ # Resolve the harness PID (grandparent of this script).
92
+ # $PPID is the ephemeral shell the harness spawned to run us — it dies
93
+ # when this script exits. The harness itself is $PPID's parent.
94
+ OWNER_PID="$(ps -o ppid= -p "$PPID" 2>/dev/null | tr -d ' ')"
95
+ if [[ -z "$OWNER_PID" || "$OWNER_PID" == "1" ]]; then
96
+ OWNER_PID="$PPID"
97
+ fi
98
+
99
+ # Foreground mode for environments that reap detached/background processes.
100
+ if [[ "$FOREGROUND" == "true" ]]; then
101
+ echo "$$" > "$PID_FILE"
102
+ env BRAINSTORM_DIR="$SCREEN_DIR" BRAINSTORM_HOST="$BIND_HOST" BRAINSTORM_URL_HOST="$URL_HOST" BRAINSTORM_OWNER_PID="$OWNER_PID" node server.js
103
+ exit $?
104
+ fi
105
+
106
+ # Start server, capturing output to log file
107
+ # Use nohup to survive shell exit; disown to remove from job table
108
+ nohup env BRAINSTORM_DIR="$SCREEN_DIR" BRAINSTORM_HOST="$BIND_HOST" BRAINSTORM_URL_HOST="$URL_HOST" BRAINSTORM_OWNER_PID="$OWNER_PID" node server.js > "$LOG_FILE" 2>&1 &
109
+ SERVER_PID=$!
110
+ disown "$SERVER_PID" 2>/dev/null
111
+ echo "$SERVER_PID" > "$PID_FILE"
112
+
113
+ # Wait for server-started message (check log file)
114
+ for i in {1..50}; do
115
+ if grep -q "server-started" "$LOG_FILE" 2>/dev/null; then
116
+ # Verify server is still alive after a short window (catches process reapers)
117
+ alive="true"
118
+ for _ in {1..20}; do
119
+ if ! kill -0 "$SERVER_PID" 2>/dev/null; then
120
+ alive="false"
121
+ break
122
+ fi
123
+ sleep 0.1
124
+ done
125
+ if [[ "$alive" != "true" ]]; then
126
+ echo "{\"error\": \"Server started but was killed. Retry in a persistent terminal with: $SCRIPT_DIR/start-server.sh${PROJECT_DIR:+ --project-dir $PROJECT_DIR} --host $BIND_HOST --url-host $URL_HOST --foreground\"}"
127
+ exit 1
128
+ fi
129
+ grep "server-started" "$LOG_FILE" | head -1
130
+ exit 0
131
+ fi
132
+ sleep 0.1
133
+ done
134
+
135
+ # Timeout - server didn't start
136
+ echo '{"error": "Server failed to start within 5 seconds"}'
137
+ exit 1
@@ -0,0 +1,31 @@
1
+ #!/bin/bash
2
+ # Stop the brainstorm server and clean up
3
+ # Usage: stop-server.sh <screen_dir>
4
+ #
5
+ # Kills the server process. Only deletes session directory if it's
6
+ # under /tmp (ephemeral). Persistent directories (.superpowers/) are
7
+ # kept so mockups can be reviewed later.
8
+
9
+ SCREEN_DIR="$1"
10
+
11
+ if [[ -z "$SCREEN_DIR" ]]; then
12
+ echo '{"error": "Usage: stop-server.sh <screen_dir>"}'
13
+ exit 1
14
+ fi
15
+
16
+ PID_FILE="${SCREEN_DIR}/.server.pid"
17
+
18
+ if [[ -f "$PID_FILE" ]]; then
19
+ pid=$(cat "$PID_FILE")
20
+ kill "$pid" 2>/dev/null
21
+ rm -f "$PID_FILE" "${SCREEN_DIR}/.server.log"
22
+
23
+ # Only delete ephemeral /tmp directories
24
+ if [[ "$SCREEN_DIR" == /tmp/* ]]; then
25
+ rm -rf "$SCREEN_DIR"
26
+ fi
27
+
28
+ echo '{"status": "stopped"}'
29
+ else
30
+ echo '{"status": "not_running"}'
31
+ fi
@@ -0,0 +1,50 @@
1
+ # Spec Document Reviewer Prompt Template
2
+
3
+ Use this template when dispatching a spec document reviewer subagent.
4
+
5
+ **Purpose:** Verify the spec is complete, consistent, and ready for implementation planning.
6
+
7
+ **Dispatch after:** Spec document is stored as a arcs project plan
8
+
9
+ ```
10
+ Task tool (general-purpose):
11
+ description: "Review spec document"
12
+ prompt: |
13
+ You are a spec document reviewer. Verify this spec is complete and ready for planning.
14
+
15
+ **Spec to review:** [Provide the full spec content inline — retrieve it using `get_project_plan` with `includeBody: true` for project `SLUG` plan `PLAN_ID`]
16
+
17
+ ## What to Check
18
+
19
+ | Category | What to Look For |
20
+ |----------|------------------|
21
+ | Completeness | TODOs, placeholders, "TBD", incomplete sections |
22
+ | Coverage | Missing error handling, edge cases, integration points |
23
+ | Consistency | Internal contradictions, conflicting requirements |
24
+ | Clarity | Ambiguous requirements |
25
+ | YAGNI | Unrequested features, over-engineering |
26
+ | Scope | Focused enough for a single plan — not covering multiple independent subsystems |
27
+ | Architecture | Units with clear boundaries, well-defined interfaces, independently understandable and testable |
28
+
29
+ ## CRITICAL
30
+
31
+ Look especially hard for:
32
+ - Any TODO markers or placeholder text
33
+ - Sections saying "to be defined later" or "will spec when X is done"
34
+ - Sections noticeably less detailed than others
35
+ - Units that lack clear boundaries or interfaces — can you understand what each unit does without reading its internals?
36
+
37
+ ## Output Format
38
+
39
+ ## Spec Review
40
+
41
+ **Status:** ✅ Approved | ❌ Issues Found
42
+
43
+ **Issues (if any):**
44
+ - [Section X]: [specific issue] - [why it matters]
45
+
46
+ **Recommendations (advisory):**
47
+ - [suggestions that don't block approval]
48
+ ```
49
+
50
+ **Reviewer returns:** Status, Issues (if any), Recommendations