dsh-pstack 0.1.0 → 0.2.0-beta.1

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 (312) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +92 -117
  3. package/assets/agents/comment-sicko.md +1 -1
  4. package/assets/agents/poteto-agent.md +2 -2
  5. package/assets/docs/guide/01-setup.md +9 -9
  6. package/assets/docs/guide/02-poteto-mode.md +4 -4
  7. package/assets/docs/guide/05-build-and-clean.md +3 -3
  8. package/assets/docs/guide/06-verify-and-ship.md +2 -2
  9. package/assets/docs/guide/07-overnight.md +10 -12
  10. package/assets/docs/guide/09-make-it-yours.md +2 -6
  11. package/assets/docs/guide/10-recipes-and-pitfalls.md +3 -3
  12. package/assets/docs/guide/README.md +1 -1
  13. package/assets/docs/guide/images/design.jpg +0 -0
  14. package/assets/docs/guide/images/overnight.jpg +0 -0
  15. package/assets/docs/guide/images/recipes.jpg +0 -0
  16. package/assets/docs/guide/images/router.jpg +0 -0
  17. package/assets/docs/guide/images/understanding.jpg +0 -0
  18. package/assets/docs/guide/images/verification.jpg +0 -0
  19. package/assets/docs/harness/dsh.md +60 -65
  20. package/assets/docs/pstack-models.example.md +40 -9
  21. package/assets/skills/architect/SKILL.md +12 -12
  22. package/assets/skills/arena/SKILL.md +11 -11
  23. package/assets/skills/automate-me/SKILL.md +15 -14
  24. package/assets/skills/benchmark-checklist/SKILL.md +0 -2
  25. package/assets/skills/blast-radius/SKILL.md +5 -5
  26. package/assets/skills/bro/SKILL.md +0 -2
  27. package/assets/skills/correct/SKILL.md +0 -2
  28. package/assets/skills/create-formal-verification-skill/SKILL.md +2 -2
  29. package/assets/skills/create-verification-skill/SKILL.md +2 -2
  30. package/assets/skills/figure-it-out/SKILL.md +13 -13
  31. package/assets/skills/how/SKILL.md +6 -6
  32. package/assets/skills/how/references/explainer-prompt.md +1 -1
  33. package/assets/skills/in-your-own-words/SKILL.md +0 -2
  34. package/assets/skills/interrogate/SKILL.md +9 -7
  35. package/assets/skills/interrogate/references/rubric.md +1 -1
  36. package/assets/skills/ketchup/SKILL.md +4 -4
  37. package/assets/skills/maintain-formal-verification-skill/SKILL.md +2 -2
  38. package/assets/skills/maintain-verification-skill/SKILL.md +3 -3
  39. package/assets/skills/no-comments/SKILL.md +7 -7
  40. package/assets/skills/poteto-help/SKILL.md +32 -31
  41. package/assets/skills/poteto-help/references/prompting.md +1 -1
  42. package/assets/skills/poteto-help/references/recipes.md +1 -1
  43. package/assets/skills/poteto-mode/SKILL.md +17 -19
  44. package/assets/skills/poteto-mode/playbooks/authoring-a-skill.md +3 -3
  45. package/assets/skills/poteto-mode/playbooks/autonomous-run.md +6 -4
  46. package/assets/skills/poteto-mode/playbooks/autopilot-full.md +6 -6
  47. package/assets/skills/poteto-mode/playbooks/autopilot-stack.md +2 -2
  48. package/assets/skills/poteto-mode/playbooks/babysit.md +3 -3
  49. package/assets/skills/poteto-mode/playbooks/bug-fix.md +7 -7
  50. package/assets/skills/poteto-mode/playbooks/eval.md +3 -3
  51. package/assets/skills/poteto-mode/playbooks/feature.md +8 -8
  52. package/assets/skills/poteto-mode/playbooks/hillclimb.md +3 -3
  53. package/assets/skills/poteto-mode/playbooks/investigation.md +2 -2
  54. package/assets/skills/poteto-mode/playbooks/multi-phase-plan.md +21 -21
  55. package/assets/skills/poteto-mode/playbooks/opening-a-pr.md +6 -6
  56. package/assets/skills/poteto-mode/playbooks/orchestrate.md +13 -13
  57. package/assets/skills/poteto-mode/playbooks/pause-safely.md +2 -2
  58. package/assets/skills/poteto-mode/playbooks/perf-issue.md +6 -6
  59. package/assets/skills/poteto-mode/playbooks/prototype.md +4 -4
  60. package/assets/skills/poteto-mode/playbooks/refactoring.md +9 -9
  61. package/assets/skills/poteto-mode/playbooks/runtime-forensics.md +3 -3
  62. package/assets/skills/poteto-mode/playbooks/session-pickup.md +2 -2
  63. package/assets/skills/poteto-mode/playbooks/shipping.md +2 -2
  64. package/assets/skills/poteto-mode/playbooks/trace-forensics.md +2 -2
  65. package/assets/skills/poteto-mode/playbooks/visual-parity.md +5 -5
  66. package/assets/skills/poteto-mode/playbooks/worktree-cleanup.md +14 -6
  67. package/assets/skills/poteto-mode/scripts/check-plan.mjs +85 -70
  68. package/assets/skills/poteto-mode/scripts/check-plan.test.mjs +343 -0
  69. package/assets/skills/poteto-mode/scripts/orch/orch.mjs +4282 -0
  70. package/assets/skills/poteto-mode/scripts/orch/orch.test.mjs +2042 -0
  71. package/assets/skills/poteto-mode/scripts/watch-pr/cli.test.mjs +5101 -0
  72. package/assets/skills/poteto-mode/scripts/watch-pr/github.test.mjs +1177 -0
  73. package/assets/skills/poteto-mode/scripts/watch-pr/policy.test.mjs +1441 -0
  74. package/assets/skills/poteto-mode/scripts/watch-pr/watch-pr.mjs +4601 -0
  75. package/assets/skills/poteto-mode/scripts/worktree-audit.mjs +675 -0
  76. package/assets/skills/principle-attack-the-premise/SKILL.md +0 -2
  77. package/assets/skills/principle-boundary-discipline/SKILL.md +0 -2
  78. package/assets/skills/principle-build-the-lever/SKILL.md +0 -3
  79. package/assets/skills/principle-encode-lessons-in-structure/SKILL.md +0 -2
  80. package/assets/skills/principle-exhaust-the-design-space/SKILL.md +0 -2
  81. package/assets/skills/principle-experience-first/SKILL.md +0 -2
  82. package/assets/skills/principle-explain-the-number/SKILL.md +0 -2
  83. package/assets/skills/principle-fix-root-causes/SKILL.md +0 -2
  84. package/assets/skills/principle-foundational-thinking/SKILL.md +0 -2
  85. package/assets/skills/principle-guard-the-context-window/SKILL.md +0 -2
  86. package/assets/skills/principle-laziness-protocol/SKILL.md +0 -2
  87. package/assets/skills/principle-make-operations-idempotent/SKILL.md +0 -2
  88. package/assets/skills/principle-migrate-callers-then-delete-legacy-apis/SKILL.md +0 -2
  89. package/assets/skills/principle-minimize-reader-load/SKILL.md +0 -2
  90. package/assets/skills/principle-model-the-domain/SKILL.md +0 -2
  91. package/assets/skills/principle-never-block-on-the-human/SKILL.md +0 -2
  92. package/assets/skills/principle-outcome-oriented-execution/SKILL.md +0 -2
  93. package/assets/skills/principle-prove-it-works/SKILL.md +2 -2
  94. package/assets/skills/principle-redesign-from-first-principles/SKILL.md +0 -2
  95. package/assets/skills/principle-separate-before-serializing-shared-state/SKILL.md +0 -2
  96. package/assets/skills/principle-sequence-verifiable-units/SKILL.md +0 -2
  97. package/assets/skills/principle-subtract-before-you-add/SKILL.md +0 -2
  98. package/assets/skills/principle-test-behavior-not-implementation/SKILL.md +0 -2
  99. package/assets/skills/principle-type-system-discipline/SKILL.md +0 -2
  100. package/assets/skills/recall/SKILL.md +9 -9
  101. package/assets/skills/reflect/SKILL.md +20 -21
  102. package/assets/skills/reflect/references/divergent-reviewer.md +4 -4
  103. package/assets/skills/reflect/references/judgment-reviewer.md +2 -2
  104. package/assets/skills/reflect/references/synthesizer.md +6 -6
  105. package/assets/skills/reflect/references/tooling-reviewer.md +2 -2
  106. package/assets/skills/setup-pstack/SKILL.md +28 -37
  107. package/assets/skills/sharpen/SKILL.md +0 -2
  108. package/assets/skills/show-me-your-work/SKILL.md +9 -9
  109. package/assets/skills/show-me-your-work/scripts/log.mjs +108 -0
  110. package/assets/skills/swarm/SKILL.md +8 -6
  111. package/assets/skills/tdd/SKILL.md +0 -2
  112. package/assets/skills/teach/SKILL.md +2 -2
  113. package/assets/skills/technical-writing/SKILL.md +2 -2
  114. package/assets/skills/typescript-best-practices/SKILL.md +6 -4
  115. package/assets/skills/unslop/SKILL.md +0 -2
  116. package/assets/skills/why/SKILL.md +9 -9
  117. package/cordis.patch.yml +33 -14
  118. package/dist/frontmatter-BQX3ekwP.mjs +229 -0
  119. package/dist/frontmatter-BQX3ekwP.mjs.map +1 -0
  120. package/dist/history.d.mts +429 -0
  121. package/dist/history.mjs +1129 -0
  122. package/dist/history.mjs.map +1 -0
  123. package/dist/host-contract-o47JH_r8.d.mts +527 -0
  124. package/dist/index.d.mts +273 -11
  125. package/dist/index.mjs +248 -148
  126. package/dist/index.mjs.map +1 -1
  127. package/dist/paths-D_JlVmBk.mjs +42 -0
  128. package/dist/paths-D_JlVmBk.mjs.map +1 -0
  129. package/dist/script.d.mts +193 -0
  130. package/dist/script.mjs +782 -0
  131. package/dist/script.mjs.map +1 -0
  132. package/dist/subagent.d.mts +306 -100
  133. package/dist/subagent.mjs +1309 -343
  134. package/dist/subagent.mjs.map +1 -1
  135. package/locale/en.json +6 -0
  136. package/locale/zh.json +6 -0
  137. package/package.json +55 -41
  138. package/static/icon.png +0 -0
  139. package/assets/skills/poteto-mode/scripts/bootstrap.ts +0 -62
  140. package/assets/skills/poteto-mode/scripts/bun.lock +0 -67
  141. package/assets/skills/poteto-mode/scripts/check-plan.test.ts +0 -96
  142. package/assets/skills/poteto-mode/scripts/orch/orch.test.ts +0 -761
  143. package/assets/skills/poteto-mode/scripts/orch/orch.ts +0 -590
  144. package/assets/skills/poteto-mode/scripts/orch/store.ts +0 -1677
  145. package/assets/skills/poteto-mode/scripts/package.json +0 -16
  146. package/assets/skills/poteto-mode/scripts/watch-pr/cli.test.ts +0 -224
  147. package/assets/skills/poteto-mode/scripts/watch-pr/cli.ts +0 -223
  148. package/assets/skills/poteto-mode/scripts/watch-pr/fakes.test-helper.ts +0 -129
  149. package/assets/skills/poteto-mode/scripts/watch-pr/github.test.ts +0 -436
  150. package/assets/skills/poteto-mode/scripts/watch-pr/github.ts +0 -718
  151. package/assets/skills/poteto-mode/scripts/watch-pr/policy.test.ts +0 -420
  152. package/assets/skills/poteto-mode/scripts/watch-pr/policy.ts +0 -836
  153. package/assets/skills/poteto-mode/scripts/watch-pr/render.ts +0 -169
  154. package/assets/skills/poteto-mode/scripts/watch-pr/tsconfig.json +0 -13
  155. package/assets/skills/poteto-mode/scripts/watch-pr/types.compile.ts +0 -93
  156. package/assets/skills/poteto-mode/scripts/watch-pr/types.ts +0 -413
  157. package/assets/skills/poteto-mode/scripts/watch-pr/watch-pr +0 -6
  158. package/assets/skills/poteto-mode/scripts/worktree-audit.sh +0 -127
  159. package/assets/skills/show-me-your-work/scripts/log.sh +0 -42
  160. package/dist/LICENSE +0 -22
  161. package/dist/README.md +0 -159
  162. package/dist/assets/agents/comment-sicko.md +0 -32
  163. package/dist/assets/agents/poteto-agent.md +0 -8
  164. package/dist/assets/docs/guide/01-setup.md +0 -64
  165. package/dist/assets/docs/guide/02-poteto-mode.md +0 -139
  166. package/dist/assets/docs/guide/03-understand.md +0 -79
  167. package/dist/assets/docs/guide/04-design.md +0 -133
  168. package/dist/assets/docs/guide/05-build-and-clean.md +0 -83
  169. package/dist/assets/docs/guide/06-verify-and-ship.md +0 -152
  170. package/dist/assets/docs/guide/07-overnight.md +0 -122
  171. package/dist/assets/docs/guide/08-principles.md +0 -72
  172. package/dist/assets/docs/guide/09-make-it-yours.md +0 -100
  173. package/dist/assets/docs/guide/10-recipes-and-pitfalls.md +0 -180
  174. package/dist/assets/docs/guide/README.md +0 -38
  175. package/dist/assets/docs/harness/dsh.md +0 -65
  176. package/dist/assets/docs/pstack-models.example.md +0 -23
  177. package/dist/assets/skills/architect/SKILL.md +0 -81
  178. package/dist/assets/skills/architect/references/design-red-flags.md +0 -57
  179. package/dist/assets/skills/architect/references/rationale-template.md +0 -35
  180. package/dist/assets/skills/architect/references/runner-prompt.md +0 -20
  181. package/dist/assets/skills/arena/SKILL.md +0 -50
  182. package/dist/assets/skills/automate-me/SKILL.md +0 -105
  183. package/dist/assets/skills/benchmark-checklist/SKILL.md +0 -41
  184. package/dist/assets/skills/blast-radius/SKILL.md +0 -52
  185. package/dist/assets/skills/bro/SKILL.md +0 -9
  186. package/dist/assets/skills/correct/SKILL.md +0 -34
  187. package/dist/assets/skills/create-formal-verification-skill/SKILL.md +0 -43
  188. package/dist/assets/skills/create-verification-skill/SKILL.md +0 -46
  189. package/dist/assets/skills/create-verification-skill/references/feature-map-example/README.md +0 -47
  190. package/dist/assets/skills/create-verification-skill/references/feature-map-example/create-note.md +0 -39
  191. package/dist/assets/skills/create-verification-skill/references/feature-map-example/search.md +0 -45
  192. package/dist/assets/skills/figure-it-out/SKILL.md +0 -54
  193. package/dist/assets/skills/how/SKILL.md +0 -38
  194. package/dist/assets/skills/how/references/explainer-prompt.md +0 -55
  195. package/dist/assets/skills/how/references/explorer-prompt.md +0 -35
  196. package/dist/assets/skills/in-your-own-words/SKILL.md +0 -9
  197. package/dist/assets/skills/interrogate/SKILL.md +0 -69
  198. package/dist/assets/skills/interrogate/references/code-quality-review.md +0 -47
  199. package/dist/assets/skills/interrogate/references/lead-judgment.md +0 -39
  200. package/dist/assets/skills/interrogate/references/reviewer-prompt.md +0 -62
  201. package/dist/assets/skills/interrogate/references/rubric.md +0 -77
  202. package/dist/assets/skills/ketchup/SKILL.md +0 -45
  203. package/dist/assets/skills/maintain-formal-verification-skill/SKILL.md +0 -60
  204. package/dist/assets/skills/maintain-verification-skill/SKILL.md +0 -41
  205. package/dist/assets/skills/no-comments/SKILL.md +0 -26
  206. package/dist/assets/skills/poteto-help/SKILL.md +0 -161
  207. package/dist/assets/skills/poteto-help/references/prompting.md +0 -51
  208. package/dist/assets/skills/poteto-help/references/recipes.md +0 -51
  209. package/dist/assets/skills/poteto-mode/SKILL.md +0 -153
  210. package/dist/assets/skills/poteto-mode/playbooks/authoring-a-skill.md +0 -12
  211. package/dist/assets/skills/poteto-mode/playbooks/autonomous-run.md +0 -13
  212. package/dist/assets/skills/poteto-mode/playbooks/autopilot-full.md +0 -25
  213. package/dist/assets/skills/poteto-mode/playbooks/autopilot-stack.md +0 -12
  214. package/dist/assets/skills/poteto-mode/playbooks/babysit.md +0 -23
  215. package/dist/assets/skills/poteto-mode/playbooks/bug-fix.md +0 -15
  216. package/dist/assets/skills/poteto-mode/playbooks/eval.md +0 -25
  217. package/dist/assets/skills/poteto-mode/playbooks/feature.md +0 -21
  218. package/dist/assets/skills/poteto-mode/playbooks/hillclimb.md +0 -21
  219. package/dist/assets/skills/poteto-mode/playbooks/investigation.md +0 -14
  220. package/dist/assets/skills/poteto-mode/playbooks/multi-phase-plan.md +0 -155
  221. package/dist/assets/skills/poteto-mode/playbooks/opening-a-pr.md +0 -34
  222. package/dist/assets/skills/poteto-mode/playbooks/orchestrate.md +0 -112
  223. package/dist/assets/skills/poteto-mode/playbooks/pause-safely.md +0 -10
  224. package/dist/assets/skills/poteto-mode/playbooks/perf-issue.md +0 -25
  225. package/dist/assets/skills/poteto-mode/playbooks/prototype.md +0 -14
  226. package/dist/assets/skills/poteto-mode/playbooks/refactoring.md +0 -16
  227. package/dist/assets/skills/poteto-mode/playbooks/runtime-forensics.md +0 -11
  228. package/dist/assets/skills/poteto-mode/playbooks/session-pickup.md +0 -11
  229. package/dist/assets/skills/poteto-mode/playbooks/shipping.md +0 -12
  230. package/dist/assets/skills/poteto-mode/playbooks/trace-forensics.md +0 -14
  231. package/dist/assets/skills/poteto-mode/playbooks/visual-parity.md +0 -11
  232. package/dist/assets/skills/poteto-mode/playbooks/worktree-cleanup.md +0 -12
  233. package/dist/assets/skills/poteto-mode/references/bugbot-triage.md +0 -142
  234. package/dist/assets/skills/poteto-mode/scripts/bootstrap.ts +0 -62
  235. package/dist/assets/skills/poteto-mode/scripts/bun.lock +0 -67
  236. package/dist/assets/skills/poteto-mode/scripts/check-plan.mjs +0 -205
  237. package/dist/assets/skills/poteto-mode/scripts/check-plan.test.ts +0 -96
  238. package/dist/assets/skills/poteto-mode/scripts/orch/orch.test.ts +0 -761
  239. package/dist/assets/skills/poteto-mode/scripts/orch/orch.ts +0 -590
  240. package/dist/assets/skills/poteto-mode/scripts/orch/store.ts +0 -1677
  241. package/dist/assets/skills/poteto-mode/scripts/package.json +0 -16
  242. package/dist/assets/skills/poteto-mode/scripts/watch-pr/cli.test.ts +0 -224
  243. package/dist/assets/skills/poteto-mode/scripts/watch-pr/cli.ts +0 -223
  244. package/dist/assets/skills/poteto-mode/scripts/watch-pr/fakes.test-helper.ts +0 -129
  245. package/dist/assets/skills/poteto-mode/scripts/watch-pr/github.test.ts +0 -436
  246. package/dist/assets/skills/poteto-mode/scripts/watch-pr/github.ts +0 -718
  247. package/dist/assets/skills/poteto-mode/scripts/watch-pr/policy.test.ts +0 -420
  248. package/dist/assets/skills/poteto-mode/scripts/watch-pr/policy.ts +0 -836
  249. package/dist/assets/skills/poteto-mode/scripts/watch-pr/render.ts +0 -169
  250. package/dist/assets/skills/poteto-mode/scripts/watch-pr/tsconfig.json +0 -13
  251. package/dist/assets/skills/poteto-mode/scripts/watch-pr/types.compile.ts +0 -93
  252. package/dist/assets/skills/poteto-mode/scripts/watch-pr/types.ts +0 -413
  253. package/dist/assets/skills/poteto-mode/scripts/watch-pr/watch-pr +0 -6
  254. package/dist/assets/skills/poteto-mode/scripts/worktree-audit.sh +0 -127
  255. package/dist/assets/skills/principle-attack-the-premise/SKILL.md +0 -23
  256. package/dist/assets/skills/principle-boundary-discipline/SKILL.md +0 -36
  257. package/dist/assets/skills/principle-build-the-lever/SKILL.md +0 -26
  258. package/dist/assets/skills/principle-encode-lessons-in-structure/SKILL.md +0 -13
  259. package/dist/assets/skills/principle-exhaust-the-design-space/SKILL.md +0 -11
  260. package/dist/assets/skills/principle-experience-first/SKILL.md +0 -21
  261. package/dist/assets/skills/principle-explain-the-number/SKILL.md +0 -19
  262. package/dist/assets/skills/principle-fix-root-causes/SKILL.md +0 -23
  263. package/dist/assets/skills/principle-foundational-thinking/SKILL.md +0 -23
  264. package/dist/assets/skills/principle-guard-the-context-window/SKILL.md +0 -14
  265. package/dist/assets/skills/principle-laziness-protocol/SKILL.md +0 -12
  266. package/dist/assets/skills/principle-make-operations-idempotent/SKILL.md +0 -24
  267. package/dist/assets/skills/principle-migrate-callers-then-delete-legacy-apis/SKILL.md +0 -16
  268. package/dist/assets/skills/principle-minimize-reader-load/SKILL.md +0 -20
  269. package/dist/assets/skills/principle-model-the-domain/SKILL.md +0 -26
  270. package/dist/assets/skills/principle-never-block-on-the-human/SKILL.md +0 -17
  271. package/dist/assets/skills/principle-outcome-oriented-execution/SKILL.md +0 -23
  272. package/dist/assets/skills/principle-prove-it-works/SKILL.md +0 -24
  273. package/dist/assets/skills/principle-redesign-from-first-principles/SKILL.md +0 -18
  274. package/dist/assets/skills/principle-separate-before-serializing-shared-state/SKILL.md +0 -18
  275. package/dist/assets/skills/principle-sequence-verifiable-units/SKILL.md +0 -19
  276. package/dist/assets/skills/principle-subtract-before-you-add/SKILL.md +0 -20
  277. package/dist/assets/skills/principle-test-behavior-not-implementation/SKILL.md +0 -22
  278. package/dist/assets/skills/principle-type-system-discipline/SKILL.md +0 -15
  279. package/dist/assets/skills/recall/SKILL.md +0 -37
  280. package/dist/assets/skills/reflect/SKILL.md +0 -70
  281. package/dist/assets/skills/reflect/references/divergent-reviewer.md +0 -38
  282. package/dist/assets/skills/reflect/references/judgment-reviewer.md +0 -37
  283. package/dist/assets/skills/reflect/references/synthesizer.md +0 -56
  284. package/dist/assets/skills/reflect/references/tooling-reviewer.md +0 -48
  285. package/dist/assets/skills/setup-pstack/SKILL.md +0 -76
  286. package/dist/assets/skills/sharpen/SKILL.md +0 -18
  287. package/dist/assets/skills/show-me-your-work/SKILL.md +0 -84
  288. package/dist/assets/skills/show-me-your-work/references/decision-log-template.tsv +0 -1
  289. package/dist/assets/skills/show-me-your-work/scripts/log.sh +0 -42
  290. package/dist/assets/skills/swarm/SKILL.md +0 -41
  291. package/dist/assets/skills/tdd/SKILL.md +0 -44
  292. package/dist/assets/skills/teach/SKILL.md +0 -23
  293. package/dist/assets/skills/technical-writing/SKILL.md +0 -108
  294. package/dist/assets/skills/typescript-best-practices/SKILL.md +0 -32
  295. package/dist/assets/skills/typescript-best-practices/references/patterns.md +0 -328
  296. package/dist/assets/skills/unslop/SKILL.md +0 -64
  297. package/dist/assets/skills/why/SKILL.md +0 -100
  298. package/dist/assets/skills/why/references/epistemics.md +0 -71
  299. package/dist/assets/skills/why/references/investigator-prompt.md +0 -84
  300. package/dist/assets/skills/why/references/source-playbook.md +0 -17
  301. package/dist/assets/skills/why/references/sources/code-archaeology.md +0 -51
  302. package/dist/assets/skills/why/references/sources/databricks.md +0 -70
  303. package/dist/assets/skills/why/references/sources/datadog.md +0 -97
  304. package/dist/assets/skills/why/references/sources/incident-postmortem.md +0 -5
  305. package/dist/assets/skills/why/references/sources/linear.md +0 -48
  306. package/dist/assets/skills/why/references/sources/notion.md +0 -55
  307. package/dist/assets/skills/why/references/sources/sentry.md +0 -66
  308. package/dist/assets/skills/why/references/sources/slack.md +0 -17
  309. package/dist/assets/skills/why/references/synthesizer-prompt.md +0 -129
  310. package/dist/cordis.patch.yml +0 -20
  311. package/dist/paths-Bbai4CaT.mjs +0 -16
  312. package/dist/paths-Bbai4CaT.mjs.map +0 -1
@@ -1,9 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import fs from "node:fs";
3
3
  import process from "node:process";
4
-
5
- const RULE =
6
- "Tests alone are not sufficient verification. A PR is verified only when its unit, live, and perf boxes are all checked.";
4
+ //#region .runtime-sources/skills/poteto-mode/scripts/check-plan.mjs
5
+ const RULE = "Tests alone are not sufficient verification. A PR is verified only when its unit, live, and perf boxes are all checked.";
7
6
  const LANES = /Ten lanes on `[^`<>]+` at the PR head/;
8
7
  const SUB_BLOCKS = [
9
8
  "Depends on.",
@@ -14,49 +13,57 @@ const SUB_BLOCKS = [
14
13
  "Verify, live.",
15
14
  "Verify, perf.",
16
15
  "Review gate.",
17
- "Merge.",
16
+ "Merge."
17
+ ];
18
+ const PROGRAM_H3 = [
19
+ "Arm the program",
20
+ "Spawn owners",
21
+ "PR mechanics",
22
+ "Verdict and merge",
23
+ "Boot recipe"
24
+ ];
25
+ const PROGRAM_MARKERS = [
26
+ "create_goal",
27
+ "schedule_create",
28
+ "status message"
18
29
  ];
19
- const PROGRAM_H3 = ["Arm the program", "Spawn owners", "PR mechanics", "Verdict and merge", "Boot recipe"];
20
- const PROGRAM_MARKERS = ["git show origin/main:", "schedule_create 1h", "status message"];
21
30
  const HOW_TO_READ_MARKERS = [
22
31
  "One box is one unit of work",
23
32
  "names the evidence",
24
33
  "Check a box only when its evidence exists",
25
34
  "playbooks/",
26
- RULE,
35
+ RULE
36
+ ];
37
+ const PERF_ITEMS = [
38
+ "Metric.",
39
+ "Probe.",
40
+ "Baseline.",
41
+ "Rule."
27
42
  ];
28
- const PERF_ITEMS = ["Metric.", "Probe.", "Baseline.", "Rule."];
29
43
  const BOX = /^\s*- \[[ x]\] (.*)$/;
30
-
31
44
  const file = process.argv[2];
32
45
  if (!file) {
33
46
  console.error("Usage: node check-plan.mjs <plan.md>");
34
47
  process.exit(2);
35
48
  }
36
-
37
49
  const raw = fs.readFileSync(file, "utf8").split(/\r?\n/);
38
50
  const problems = [];
39
51
  const fail = (line, message) => problems.push(`${file}:${line}: ${message}`);
40
-
41
52
  let start = 0;
42
- if (raw[0] === "---") {
43
- start = raw.indexOf("---", 1) + 1;
44
- }
45
-
53
+ if (raw[0] === "---") start = raw.indexOf("---", 1) + 1;
46
54
  const lines = [];
47
55
  let fence = null;
48
56
  const openingFence = (text) => {
49
57
  const match = text.match(/^ {0,3}(`{3,}|~{3,})(.*)$/);
50
- if (!match || (match[1][0] === "`" && match[2].includes("`"))) return null;
51
- return { char: match[1][0], length: match[1].length };
58
+ if (!match || match[1][0] === "`" && match[2].includes("`")) return null;
59
+ return {
60
+ char: match[1][0],
61
+ length: match[1].length
62
+ };
52
63
  };
53
64
  const closingFence = (text, opening) => {
54
65
  const match = text.match(/^ {0,3}(`+|~+)[ \t]*$/);
55
- return Boolean(
56
- match &&
57
- match[1][0] === opening.char &&
58
- match[1].length >= opening.length,
59
- );
66
+ return Boolean(match && match[1][0] === opening.char && match[1].length >= opening.length);
60
67
  };
61
68
  for (let i = start; i < raw.length; i++) {
62
69
  const text = raw[i];
@@ -69,42 +76,45 @@ for (let i = start; i < raw.length; i++) {
69
76
  fence = openingFence(text);
70
77
  code = Boolean(fence);
71
78
  }
72
- lines.push({ n, text, code });
79
+ lines.push({
80
+ n,
81
+ text,
82
+ code
83
+ });
73
84
  if (code) continue;
74
- const prose = text
75
- .replace(/`[^`]*`/g, "`")
76
- .replace(/!\[[^\]]*\]\([^)]*\)/g, "")
77
- .replace(/\]\([^)]*\)/g, "]");
85
+ const prose = text.replace(/`[^`]*`/g, "`").replace(/!\[[^\]]*\]\([^)]*\)/g, "").replace(/\]\([^)]*\)/g, "]");
78
86
  if (/[\u2013\u2014]/.test(prose)) fail(n, "long dash");
79
87
  if (/[\u2018\u2019\u201c\u201d]/.test(prose)) fail(n, "curly quote");
80
88
  if (/: \S/.test(prose)) fail(n, "mid-sentence colon");
81
89
  }
82
-
83
- const h2 = (l) => (!l.code && l.text.startsWith("## ") ? l.text.slice(3).trim() : null);
90
+ const h2 = (l) => !l.code && l.text.startsWith("## ") ? l.text.slice(3).trim() : null;
84
91
  const sections = [];
85
92
  for (const l of lines) {
86
93
  const title = h2(l);
87
- if (title !== null) sections.push({ title, n: l.n, body: [] });
94
+ if (title !== null) sections.push({
95
+ title,
96
+ n: l.n,
97
+ body: []
98
+ });
88
99
  else if (sections.length) sections.at(-1).body.push(l);
89
100
  }
90
101
  const find = (title) => sections.find((s) => s.title === title);
91
102
  const bodyText = (s) => s.body.map((l) => l.text).join("\n");
92
- const boxes = (ls) => ls.filter((l) => !l.code && BOX.test(l.text)).map((l) => ({ n: l.n, text: l.text.match(BOX)[1] }));
93
-
103
+ const boxes = (ls) => ls.filter((l) => !l.code && BOX.test(l.text)).map((l) => ({
104
+ n: l.n,
105
+ text: l.text.match(BOX)[1]
106
+ }));
94
107
  const h1 = lines.findIndex((l) => !l.code && l.text.startsWith("# "));
95
108
  if (h1 === -1) fail(1, "no H1 title");
96
109
  const howToRead = find("How to read this");
97
- if (!howToRead) fail(1, 'no "## How to read this" section');
110
+ if (!howToRead) fail(1, "no \"## How to read this\" section");
98
111
  if (h1 !== -1 && howToRead) {
99
112
  const intro = lines.slice(h1 + 1).filter((l) => l.n < howToRead.n && l.text.trim() !== "");
100
113
  if (intro.length >= 10) fail(lines[h1].n, `intro is ${intro.length} lines, under ten required`);
101
- for (const marker of HOW_TO_READ_MARKERS) {
102
- if (!bodyText(howToRead).includes(marker)) fail(howToRead.n, `How to read this lacks "${marker}"`);
103
- }
114
+ for (const marker of HOW_TO_READ_MARKERS) if (!bodyText(howToRead).includes(marker)) fail(howToRead.n, `How to read this lacks "${marker}"`);
104
115
  }
105
-
106
116
  const program = find("Program checklist");
107
- if (!program) fail(1, 'no "## Program checklist" section');
117
+ if (!program) fail(1, "no \"## Program checklist\" section");
108
118
  else {
109
119
  const h3s = program.body.filter((l) => !l.code && l.text.startsWith("### ")).map((l) => l.text.slice(4).trim());
110
120
  let cursor = 0;
@@ -113,65 +123,71 @@ else {
113
123
  if (at === -1) fail(program.n, `Program checklist lacks "### ${name}" in order`);
114
124
  else cursor = at + 1;
115
125
  }
116
- for (const marker of PROGRAM_MARKERS) {
117
- if (!bodyText(program).includes(marker)) fail(program.n, `Program checklist lacks "${marker}"`);
118
- }
126
+ for (const marker of PROGRAM_MARKERS) if (!bodyText(program).includes(marker)) fail(program.n, `Program checklist lacks "${marker}"`);
119
127
  }
120
-
121
128
  const close = find("Close the program");
122
- if (!close) fail(1, 'no "## Close the program" section');
129
+ if (!close) fail(1, "no \"## Close the program\" section");
123
130
  const programIndex = sections.indexOf(program);
124
131
  const closeIndex = sections.indexOf(close);
125
132
  const prSections = programIndex === -1 || closeIndex === -1 ? [] : sections.slice(programIndex + 1, closeIndex);
126
133
  if (prSections.length === 0) fail(1, "no PR sections between Program checklist and Close the program");
127
-
128
134
  const report = [];
129
135
  for (const pr of prSections) {
130
136
  const heads = [];
131
137
  for (const l of pr.body) {
132
138
  if (l.code) continue;
133
139
  const m = l.text.match(/^\*\*([^*]+)\*\*(.*)$/);
134
- if (m && SUB_BLOCKS.includes(m[1])) heads.push({ name: m[1], n: l.n, rest: m[2].trim(), lines: [] });
140
+ if (m && SUB_BLOCKS.includes(m[1])) heads.push({
141
+ name: m[1],
142
+ n: l.n,
143
+ rest: m[2].trim(),
144
+ lines: []
145
+ });
135
146
  else if (heads.length) heads.at(-1).lines.push(l);
136
147
  }
137
148
  const names = heads.map((h) => h.name);
138
- if (names.join("|") !== SUB_BLOCKS.join("|")) {
139
- fail(pr.n, `${pr.title}: sub-blocks are [${names.join(", ")}], expected [${SUB_BLOCKS.join(", ")}]`);
140
- }
149
+ if (names.join("|") !== SUB_BLOCKS.join("|")) fail(pr.n, `${pr.title}: sub-blocks are [${names.join(", ")}], expected [${SUB_BLOCKS.join(", ")}]`);
141
150
  const block = (name) => heads.find((h) => h.name === name);
142
151
  const counts = {};
143
152
  for (const h of heads) counts[h.name] = boxes(h.lines).length;
144
-
145
153
  const depends = block("Depends on.");
146
154
  if (depends && depends.rest === "") fail(depends.n, `${pr.title}: Depends on names nothing`);
147
- for (const name of ["Files.", "Build.", "You see.", "Verify, unit.", "Merge."]) {
155
+ for (const name of [
156
+ "Files.",
157
+ "Build.",
158
+ "You see.",
159
+ "Verify, unit.",
160
+ "Merge."
161
+ ]) {
148
162
  const b = block(name);
149
163
  if (b && boxes(b.lines).length === 0) fail(b.n, `${pr.title}: ${name} has no box`);
150
164
  }
151
- for (const name of ["Verify, unit.", "Verify, live.", "Verify, perf."]) {
165
+ for (const name of [
166
+ "Verify, unit.",
167
+ "Verify, live.",
168
+ "Verify, perf."
169
+ ]) {
152
170
  const b = block(name);
153
171
  if (b && !b.rest.startsWith(RULE)) fail(b.n, `${pr.title}: ${name} does not open with the rule`);
154
172
  }
155
-
156
173
  const live = block("Verify, live.");
157
174
  if (live) {
158
175
  if (!LANES.test(live.rest)) fail(live.n, `${pr.title}: Verify, live lacks "Ten lanes on \`<swarm workers model>\` at the PR head" with the model filled in`);
159
- const lanes = boxes(live.lines).map((b) => ({ ...b, m: b.text.match(/^Lane (\d+)\. /) }));
176
+ const lanes = boxes(live.lines).map((b) => ({
177
+ ...b,
178
+ m: b.text.match(/^Lane (\d+)\. /)
179
+ }));
160
180
  const numbers = lanes.filter((b) => b.m).map((b) => Number(b.m[1])).sort((a, b) => a - b);
161
181
  if (numbers.join(",") !== "1,2,3,4,5,6,7,8,9,10") fail(live.n, `${pr.title}: lanes are [${numbers.join(",")}], expected 1 to 10`);
162
- for (const lane of lanes) {
163
- if (!lane.m) fail(lane.n, `${pr.title}: live box is not a lane`);
164
- else if (!/Save `[^`]+`/.test(lane.text)) fail(lane.n, `${pr.title}: lane ${lane.m[1]} names no screenshot`);
165
- else if (!lane.text.includes("Pass when")) fail(lane.n, `${pr.title}: lane ${lane.m[1]} has no pass predicate`);
166
- }
182
+ for (const lane of lanes) if (!lane.m) fail(lane.n, `${pr.title}: live box is not a lane`);
183
+ else if (!/Save `[^`]+`/.test(lane.text)) fail(lane.n, `${pr.title}: lane ${lane.m[1]} names no screenshot`);
184
+ else if (!lane.text.includes("Pass when")) fail(lane.n, `${pr.title}: lane ${lane.m[1]} has no pass predicate`);
167
185
  }
168
-
169
186
  const perf = block("Verify, perf.");
170
187
  if (perf) {
171
188
  const items = boxes(perf.lines).map((b) => b.text.split(" ")[0]);
172
189
  if (items.join("|") !== PERF_ITEMS.join("|")) fail(perf.n, `${pr.title}: perf boxes are [${items.join(", ")}], expected [${PERF_ITEMS.join(", ")}]`);
173
190
  }
174
-
175
191
  const gate = block("Review gate.");
176
192
  if (gate) {
177
193
  const gateBoxes = boxes(gate.lines);
@@ -180,26 +196,25 @@ for (const pr of prSections) {
180
196
  } else {
181
197
  const text = gate.lines.map((l) => l.text).join("\n");
182
198
  if (gateBoxes.length === 0) fail(gate.n, `${pr.title}: Review gate has no box`);
183
- for (const word of ["screenshot", "video", "operator"]) {
184
- if (!text.includes(word)) fail(gate.n, `${pr.title}: Review gate lacks "${word}"`);
185
- }
199
+ for (const word of [
200
+ "screenshot",
201
+ "video",
202
+ "operator"
203
+ ]) if (!text.includes(word)) fail(gate.n, `${pr.title}: Review gate lacks "${word}"`);
186
204
  }
187
205
  }
188
-
189
206
  const total = boxes(pr.body).length;
190
207
  const cells = SUB_BLOCKS.filter((s) => s !== "Depends on.").map((s) => `${s.replace(/[ ,.]+/g, "-").replace(/-$/, "").toLowerCase()}=${counts[s] ?? 0}`);
191
208
  report.push(`${pr.title} boxes=${total} ${cells.join(" ")}`);
192
209
  }
193
-
194
210
  if (closeIndex !== -1) {
195
211
  const tail = sections.slice(closeIndex + 1);
196
- for (const s of tail) {
197
- if (!s.title.startsWith("Appendix")) fail(s.n, `"## ${s.title}" after Close the program is not an appendix`);
198
- }
199
- if (!tail.some((s) => s.title.includes("Prototype evidence"))) fail(close.n, 'no "## Appendix ... Prototype evidence" section');
212
+ for (const s of tail) if (!s.title.startsWith("Appendix")) fail(s.n, `"## ${s.title}" after Close the program is not an appendix`);
213
+ if (!tail.some((s) => s.title.includes("Prototype evidence"))) fail(close.n, "no \"## Appendix ... Prototype evidence\" section");
200
214
  }
201
-
202
215
  for (const line of report) console.log(line);
203
216
  console.log(`${prSections.length} PR sections, ${problems.length} problems`);
204
217
  for (const p of problems) console.error(p);
205
218
  process.exit(problems.length ? 1 : 0);
219
+ //#endregion
220
+ export {};
@@ -0,0 +1,343 @@
1
+ #!/usr/bin/env node
2
+ import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
3
+ import { tmpdir } from "node:os";
4
+ import { join } from "node:path";
5
+ import { spawnSync } from "node:child_process";
6
+ import { test } from "node:test";
7
+ import { inspect } from "node:util";
8
+ //#region .runtime-sources/skills/poteto-mode/scripts/expect.ts
9
+ /**
10
+ * A small `expect` for `node:test`.
11
+ *
12
+ * The five upstream test files were written against `bun:test`. Their assertions
13
+ * are ordinary value comparisons, so this module supplies exactly the matchers
14
+ * they use rather than a general test framework. It is deliberately not a drop-in
15
+ * replacement: a matcher that is not listed here fails to compile, which keeps the
16
+ * port auditable against the calls that actually exist.
17
+ *
18
+ * Covered: `toBe`, `toEqual`, `toContain`, `toMatch`, `toThrow`, `toBeNull`,
19
+ * `toBeInstanceOf`, `toHaveLength`, `toEndWith`, `toMatchObject`, `.not` on each,
20
+ * and `rejects` / `resolves` for promises.
21
+ *
22
+ * Two differences from `bun:test`, stated so a failure is not misread:
23
+ *
24
+ * - `toEqual` is structural for arrays and plain objects, `Object.is` otherwise.
25
+ * A class instance only equals itself; `toBeInstanceOf` is the matcher for type
26
+ * identity. The ported tests compare plain data, which is why this is enough.
27
+ * - A failure throws `AssertionError` with the two values rendered, not Bun's
28
+ * coloured diff.
29
+ */
30
+ /** Raised by every failing assertion. */
31
+ var AssertionError = class extends Error {
32
+ constructor(message) {
33
+ super(message);
34
+ this.name = "AssertionError";
35
+ }
36
+ };
37
+ function display(value) {
38
+ if (typeof value === "function") return `[Function ${value.name || "anonymous"}]`;
39
+ return inspect(value, {
40
+ depth: 3,
41
+ breakLength: 120,
42
+ maxArrayLength: 20
43
+ });
44
+ }
45
+ function messageOf(error) {
46
+ if (error instanceof Error) return `${error.name}: ${error.message}`;
47
+ return String(error);
48
+ }
49
+ /** Structural equality for the shapes the ported tests compare. */
50
+ function deepEqual(left, right) {
51
+ if (Object.is(left, right)) return true;
52
+ if (left instanceof Date || right instanceof Date) return left instanceof Date && right instanceof Date && left.getTime() === right.getTime();
53
+ if (Array.isArray(left) || Array.isArray(right)) {
54
+ if (!Array.isArray(left) || !Array.isArray(right) || left.length !== right.length) return false;
55
+ return left.every((item, index) => deepEqual(item, right[index]));
56
+ }
57
+ if (left === null || right === null || typeof left !== "object" || typeof right !== "object") return false;
58
+ const leftProto = Object.getPrototypeOf(left);
59
+ if (leftProto !== Object.getPrototypeOf(right)) return false;
60
+ if (leftProto !== Object.prototype && leftProto !== null) return false;
61
+ const leftKeys = Object.keys(left);
62
+ const rightKeys = Object.keys(right);
63
+ if (leftKeys.length !== rightKeys.length) return false;
64
+ return leftKeys.every((key) => deepEqual(left[key], right[key]));
65
+ }
66
+ function contains(haystack, needle) {
67
+ if (typeof haystack === "string") return haystack.includes(String(needle));
68
+ if (Array.isArray(haystack)) return haystack.some((item) => deepEqual(item, needle));
69
+ if (haystack instanceof Set) return [...haystack].some((item) => deepEqual(item, needle));
70
+ return false;
71
+ }
72
+ /**
73
+ * Whether `expected` is a partial description of `actual`.
74
+ *
75
+ * `bun:test`'s `toMatchObject` is recursive: every key in `expected` must exist and
76
+ * match, arrays match element by element with the same partial rule, and extra keys
77
+ * in `actual` are allowed. That is what lets an assertion name only the fields it
78
+ * cares about, which several ported cases rely on.
79
+ */
80
+ function matchesObject(actual, expected) {
81
+ if (Array.isArray(expected)) {
82
+ if (!Array.isArray(actual) || actual.length !== expected.length) return false;
83
+ return expected.every((item, index) => matchesObject(actual[index], item));
84
+ }
85
+ if (expected instanceof Date) return deepEqual(actual, expected);
86
+ if (expected === null || typeof expected !== "object") return deepEqual(actual, expected);
87
+ if (actual === null || typeof actual !== "object") return false;
88
+ return Object.entries(expected).every(([key, value]) => matchesObject(actual[key], value));
89
+ }
90
+ function thrownBy(call) {
91
+ try {
92
+ call();
93
+ return { thrown: false };
94
+ } catch (error) {
95
+ return {
96
+ thrown: true,
97
+ error
98
+ };
99
+ }
100
+ }
101
+ function buildMatchers(actual, negate) {
102
+ /**
103
+ * Fail when `ok` is not what the matcher asked for.
104
+ *
105
+ * `negate` inverts the requirement, so `.not.toContain(x)` passes on a haystack
106
+ * that does not contain `x` and fails when it does.
107
+ */
108
+ const check = (ok, matcher, expected) => {
109
+ if (ok === !negate) return;
110
+ const relation = negate ? `not to ${matcher}` : matcher;
111
+ throw new AssertionError(`expected ${display(actual)} ${relation} ${display(expected)}`);
112
+ };
113
+ const checkPlain = (ok, matcher) => {
114
+ if (ok === !negate) return;
115
+ throw new AssertionError(`expected ${display(actual)} ${negate ? `not to ${matcher}` : matcher}`);
116
+ };
117
+ const matchers = {
118
+ toBe(expected) {
119
+ check(Object.is(actual, expected), "toBe", expected);
120
+ },
121
+ toEqual(expected) {
122
+ check(deepEqual(actual, expected), "toEqual", expected);
123
+ },
124
+ toContain(expected) {
125
+ check(contains(actual, expected), "toContain", expected);
126
+ },
127
+ toMatch(expected) {
128
+ const text = String(actual);
129
+ check(typeof expected === "string" ? text.includes(expected) : expected.test(text), "toMatch", expected);
130
+ },
131
+ toThrow(expected) {
132
+ if (typeof actual !== "function") throw new AssertionError(`toThrow needs a function, received ${display(actual)}`);
133
+ const result = thrownBy(actual);
134
+ if (!result.thrown) {
135
+ checkPlain(false, "toThrow");
136
+ return;
137
+ }
138
+ if (expected === void 0) {
139
+ checkPlain(true, "toThrow");
140
+ return;
141
+ }
142
+ const message = messageOf(result.error);
143
+ const ok = typeof expected === "string" ? message.includes(expected) : expected instanceof RegExp ? expected.test(message) : result.error instanceof expected;
144
+ check(ok, "toThrow", expected);
145
+ },
146
+ toBeNull() {
147
+ checkPlain(actual === null, "toBeNull");
148
+ },
149
+ toBeInstanceOf(expected) {
150
+ check(actual instanceof expected, "toBeInstanceOf", expected);
151
+ },
152
+ toHaveLength(expected) {
153
+ const length = actual?.length;
154
+ check(length === expected, "toHaveLength", expected);
155
+ },
156
+ toEndWith(expected) {
157
+ check(String(actual).endsWith(expected), "toEndWith", expected);
158
+ },
159
+ toMatchObject(expected) {
160
+ check(matchesObject(actual, expected), "toMatchObject", expected);
161
+ }
162
+ };
163
+ Object.defineProperties(matchers, {
164
+ not: {
165
+ get: () => buildMatchers(actual, !negate),
166
+ enumerable: true
167
+ },
168
+ rejects: {
169
+ get: () => buildAsyncMatchers(actual, "rejects", negate),
170
+ enumerable: true
171
+ },
172
+ resolves: {
173
+ get: () => buildAsyncMatchers(actual, "resolves", negate),
174
+ enumerable: true
175
+ }
176
+ });
177
+ return matchers;
178
+ }
179
+ /**
180
+ * Compare against a settled promise.
181
+ *
182
+ * `rejects` reads the rejection reason and fails when the promise resolved;
183
+ * `resolves` is the mirror. Each matcher awaits the settlement, which is what
184
+ * makes `await expect(promise).rejects.toThrow(...)` wait before it compares.
185
+ */
186
+ function buildAsyncMatchers(actual, mode, negate) {
187
+ if (typeof actual?.then !== "function") throw new AssertionError(`expected a promise, received ${display(actual)}`);
188
+ const wantRejection = mode === "rejects" !== negate;
189
+ const settle = async () => {
190
+ let resolved;
191
+ let rejected;
192
+ await Promise.resolve(actual).then((value) => {
193
+ resolved = { value };
194
+ }, (error) => {
195
+ rejected = { error };
196
+ });
197
+ if (wantRejection) {
198
+ if (resolved !== void 0) throw new AssertionError(`expected the promise to reject, it resolved to ${display(resolved.value)}`);
199
+ return rejected?.error;
200
+ }
201
+ if (rejected !== void 0) throw new AssertionError(`expected the promise to resolve, it rejected with ${messageOf(rejected.error)}`);
202
+ return resolved?.value;
203
+ };
204
+ /**
205
+ * Run one matcher against the settled value.
206
+ *
207
+ * `toThrow` and `toBeInstanceOf` both read the rejection reason, so a thrown
208
+ * reason is turned back into a thunk for `toThrow` rather than special-cased
209
+ * twice. `negate` is already folded into the settlement mode, so the inner
210
+ * matchers run un-negated.
211
+ */
212
+ const wrap = async (name, expected) => {
213
+ const subject = await settle();
214
+ if (name === "toThrow") {
215
+ buildMatchers(() => {
216
+ throw subject;
217
+ }, false).toThrow(expected);
218
+ return;
219
+ }
220
+ if (name === "toBeNull") {
221
+ buildMatchers(subject, false).toBeNull();
222
+ return;
223
+ }
224
+ const matchers = buildMatchers(subject, false);
225
+ const matcher = matchers[name];
226
+ if (typeof matcher !== "function") throw new AssertionError(`unknown matcher ${name}`);
227
+ matcher.call(matchers, expected);
228
+ };
229
+ const matchers = {
230
+ toBe: (expected) => wrap("toBe", expected),
231
+ toEqual: (expected) => wrap("toEqual", expected),
232
+ toContain: (expected) => wrap("toContain", expected),
233
+ toMatch: (expected) => wrap("toMatch", expected),
234
+ toThrow: (expected) => wrap("toThrow", expected),
235
+ toBeNull: () => wrap("toBeNull"),
236
+ toBeInstanceOf: (expected) => wrap("toBeInstanceOf", expected),
237
+ toHaveLength: (expected) => wrap("toHaveLength", expected),
238
+ toEndWith: (expected) => wrap("toEndWith", expected),
239
+ toMatchObject: (expected) => wrap("toMatchObject", expected)
240
+ };
241
+ Object.defineProperty(matchers, "not", {
242
+ get: () => buildAsyncMatchers(actual, mode, !negate),
243
+ enumerable: true
244
+ });
245
+ return matchers;
246
+ }
247
+ const expect = Object.assign((actual) => buildMatchers(actual, false), {
248
+ not: (actual) => buildMatchers(actual, true),
249
+ rejects: (actual) => buildAsyncMatchers(actual, "rejects", false),
250
+ resolves: (actual) => buildAsyncMatchers(actual, "resolves", false)
251
+ });
252
+ //#endregion
253
+ //#region .runtime-sources/skills/poteto-mode/scripts/check-plan.test.ts
254
+ const checker = join(import.meta.dirname, "check-plan.mjs");
255
+ const rule = "Tests alone are not sufficient verification. A PR is verified only when its unit, live, and perf boxes are all checked.";
256
+ const validPlan = `# Demo
257
+
258
+ ## How to read this
259
+ One box is one unit of work and names the evidence. Check a box only when its evidence exists. See playbooks/.
260
+ ${rule}
261
+
262
+ ## Program checklist
263
+ ### Arm the program
264
+ ### Spawn owners
265
+ ### PR mechanics
266
+ ### Verdict and merge
267
+ ### Boot recipe
268
+ \`create_goal\` \`schedule_create\` status message
269
+
270
+ ## PR 1
271
+ **Depends on.** None.
272
+ **Files.**
273
+ - [ ] Do the thing.
274
+ **Build.**
275
+ - [ ] Do the thing.
276
+ **You see.**
277
+ - [ ] Do the thing.
278
+ **Verify, unit.** ${rule}
279
+ - [ ] Check the thing.
280
+ **Verify, live.** ${rule} Ten lanes on \`example-model\` at the PR head
281
+ ${Array.from({ length: 10 }, (_, i) => `- [ ] Lane ${i + 1}. Save \`lane-${i + 1}.png\`. Pass when evidence exists.`).join("\n")}
282
+ **Verify, perf.** ${rule}
283
+ - [ ] Metric. Recorded.
284
+ - [ ] Probe. Recorded.
285
+ - [ ] Baseline. Recorded.
286
+ - [ ] Rule. Recorded.
287
+ **Review gate.** None.
288
+ **Merge.**
289
+ - [ ] Merge when approved.
290
+
291
+ ## Close the program
292
+ Close.
293
+
294
+ ## Appendix Prototype evidence
295
+ Recorded.
296
+ `;
297
+ const runPlan = (example, expectedExit) => {
298
+ const directory = mkdtempSync(join(tmpdir(), "check-plan-test-"));
299
+ const file = join(directory, "plan.md");
300
+ writeFileSync(file, validPlan + example);
301
+ try {
302
+ const result = spawnSync("node", [checker, file], { encoding: "utf8" });
303
+ expect(result.status).toBe(expectedExit);
304
+ return result;
305
+ } finally {
306
+ rmSync(directory, {
307
+ recursive: true,
308
+ force: true
309
+ });
310
+ }
311
+ };
312
+ test("accepts ordinary, indented, and longer closing fences", () => {
313
+ for (const indent of [
314
+ "",
315
+ " ",
316
+ " ",
317
+ " "
318
+ ]) runPlan(`${indent}\`\`\`markdown\n## Example only\n${indent}\`\`\`\n`, 0);
319
+ runPlan("```markdown\n## Example only\n````\n", 0);
320
+ });
321
+ test("accepts nested backticks and tilde info strings", () => {
322
+ runPlan("````markdown\n```markdown\n## Example only\n```\n````\n", 0);
323
+ runPlan("~~~markdown `info`\n## Example only\n ~~~\n", 0);
324
+ });
325
+ test("keeps mismatched, shorter, and suffixed closers inside the fence", () => {
326
+ runPlan("````markdown\n~~~\n## Example only\n````\n", 0);
327
+ runPlan("````markdown\n```\n## Example only\n````\n", 0);
328
+ runPlan("````markdown\n``` info\n## Example only\n````\n", 0);
329
+ });
330
+ test("rejects headings and prose outside a proper close", () => {
331
+ for (const suffix of [" ", " "]) {
332
+ const heading = runPlan(`\`\`\`markdown\n## Example only\n\`\`\`${suffix}\n## Example only\n`, 1);
333
+ expect(heading.stderr).toContain("\"## Example only\" after Close the program is not an appendix");
334
+ }
335
+ const prose = runPlan("```markdown\nThis prose has a mid-sentence colon: inside code\n```\nThis prose has a mid-sentence colon: bad.\n", 1);
336
+ expect(prose.stderr).toContain("mid-sentence colon");
337
+ });
338
+ test("rejects backtick info strings containing a backtick", () => {
339
+ const result = runPlan("```markdown `invalid`\n## Example only\n```\n", 1);
340
+ expect(result.stderr).toContain("\"## Example only\" after Close the program is not an appendix");
341
+ });
342
+ //#endregion
343
+ export {};