dsh-pstack 0.2.0-beta.1 → 0.2.0-beta.3

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 (261) hide show
  1. package/LICENSE +2 -3
  2. package/README.md +135 -84
  3. package/README.zh.md +185 -0
  4. package/cordis.patch.yml +97 -27
  5. package/dist/host-contract-CUPSpeNk.d.mts +22 -0
  6. package/dist/index.d.mts +49 -238
  7. package/dist/index.mjs +250 -123
  8. package/dist/models.d.mts +44 -0
  9. package/dist/models.mjs +201 -0
  10. package/dist/paths-BT77khwm.mjs +48 -0
  11. package/dist/pstack/LICENSE +21 -0
  12. package/dist/pstack/README.md +291 -0
  13. package/dist/pstack/agents/poteto-agent.md +9 -0
  14. package/{assets → dist/pstack}/docs/guide/01-setup.md +13 -11
  15. package/{assets → dist/pstack}/docs/guide/02-poteto-mode.md +4 -4
  16. package/{assets → dist/pstack}/docs/guide/04-design.md +4 -4
  17. package/{assets → dist/pstack}/docs/guide/05-build-and-clean.md +2 -2
  18. package/{assets → dist/pstack}/docs/guide/06-verify-and-ship.md +13 -3
  19. package/{assets → dist/pstack}/docs/guide/07-overnight.md +15 -13
  20. package/{assets → dist/pstack}/docs/guide/09-make-it-yours.md +6 -2
  21. package/{assets → dist/pstack}/docs/guide/10-recipes-and-pitfalls.md +7 -5
  22. package/{assets → dist/pstack}/docs/guide/README.md +1 -1
  23. package/dist/pstack/docs/harness/dsh.md +98 -0
  24. package/{assets → dist/pstack}/skills/architect/SKILL.md +12 -12
  25. package/dist/pstack/skills/arena/SKILL.md +50 -0
  26. package/{assets → dist/pstack}/skills/automate-me/SKILL.md +14 -14
  27. package/{assets → dist/pstack}/skills/benchmark-checklist/SKILL.md +1 -1
  28. package/{assets → dist/pstack}/skills/blast-radius/SKILL.md +4 -6
  29. package/{assets → dist/pstack}/skills/correct/SKILL.md +1 -1
  30. package/{assets → dist/pstack}/skills/create-formal-verification-skill/SKILL.md +4 -2
  31. package/{assets → dist/pstack}/skills/create-verification-skill/SKILL.md +5 -5
  32. package/dist/pstack/skills/figure-it-out/SKILL.md +54 -0
  33. package/dist/pstack/skills/how/SKILL.md +38 -0
  34. package/{assets → dist/pstack}/skills/in-your-own-words/SKILL.md +1 -1
  35. package/dist/pstack/skills/interrogate/SKILL.md +33 -0
  36. package/{assets → dist/pstack}/skills/ketchup/SKILL.md +3 -5
  37. package/dist/pstack/skills/ketchup-video/SKILL.md +29 -0
  38. package/{assets → dist/pstack}/skills/maintain-formal-verification-skill/SKILL.md +1 -1
  39. package/{assets → dist/pstack}/skills/maintain-verification-skill/SKILL.md +3 -3
  40. package/dist/pstack/skills/make-bot-ui/SKILL.md +117 -0
  41. package/dist/pstack/skills/no-comments/SKILL.md +26 -0
  42. package/{assets → dist/pstack}/skills/poteto-help/SKILL.md +34 -31
  43. package/{assets → dist/pstack}/skills/poteto-help/references/prompting.md +1 -1
  44. package/{assets → dist/pstack}/skills/poteto-help/references/recipes.md +3 -3
  45. package/{assets → dist/pstack}/skills/poteto-mode/SKILL.md +20 -19
  46. package/dist/pstack/skills/poteto-mode/playbooks/authoring-a-skill.md +12 -0
  47. package/dist/pstack/skills/poteto-mode/playbooks/autonomous-run.md +13 -0
  48. package/dist/pstack/skills/poteto-mode/playbooks/autopilot-full.md +25 -0
  49. package/dist/pstack/skills/poteto-mode/playbooks/autopilot-stack.md +8 -0
  50. package/{assets → dist/pstack}/skills/poteto-mode/playbooks/babysit.md +4 -4
  51. package/dist/pstack/skills/poteto-mode/playbooks/bug-fix.md +15 -0
  52. package/{assets → dist/pstack}/skills/poteto-mode/playbooks/eval.md +3 -3
  53. package/dist/pstack/skills/poteto-mode/playbooks/feature.md +21 -0
  54. package/{assets → dist/pstack}/skills/poteto-mode/playbooks/hillclimb.md +3 -3
  55. package/{assets → dist/pstack}/skills/poteto-mode/playbooks/investigation.md +2 -2
  56. package/{assets → dist/pstack}/skills/poteto-mode/playbooks/multi-phase-plan.md +23 -23
  57. package/{assets → dist/pstack}/skills/poteto-mode/playbooks/opening-a-pr.md +6 -6
  58. package/dist/pstack/skills/poteto-mode/playbooks/orchestrate.md +25 -0
  59. package/{assets → dist/pstack}/skills/poteto-mode/playbooks/pause-safely.md +2 -2
  60. package/dist/pstack/skills/poteto-mode/playbooks/perf-issue.md +25 -0
  61. package/{assets → dist/pstack}/skills/poteto-mode/playbooks/prototype.md +4 -4
  62. package/dist/pstack/skills/poteto-mode/playbooks/refactoring.md +16 -0
  63. package/dist/pstack/skills/poteto-mode/playbooks/runtime-forensics.md +11 -0
  64. package/dist/pstack/skills/poteto-mode/playbooks/session-pickup.md +11 -0
  65. package/{assets → dist/pstack}/skills/poteto-mode/playbooks/shipping.md +2 -2
  66. package/{assets → dist/pstack}/skills/poteto-mode/playbooks/trace-forensics.md +2 -2
  67. package/dist/pstack/skills/poteto-mode/playbooks/visual-parity.md +11 -0
  68. package/dist/pstack/skills/poteto-mode/playbooks/worktree-cleanup.md +12 -0
  69. package/{assets → dist/pstack}/skills/poteto-mode/scripts/check-plan.mjs +6 -8
  70. package/dist/pstack/skills/poteto-mode/scripts/check-plan.test.mjs +128 -0
  71. package/{assets/skills/poteto-mode/scripts/check-plan.test.mjs → dist/pstack/skills/poteto-mode/scripts/expect.mjs} +12 -101
  72. package/dist/pstack/skills/poteto-mode/scripts/support.mjs +93 -0
  73. package/dist/pstack/skills/poteto-mode/scripts/watch-pr/cli.mjs +123 -0
  74. package/dist/pstack/skills/poteto-mode/scripts/watch-pr/cli.test.mjs +217 -0
  75. package/dist/pstack/skills/poteto-mode/scripts/watch-pr/fakes.test-helper.mjs +119 -0
  76. package/dist/pstack/skills/poteto-mode/scripts/watch-pr/github.mjs +626 -0
  77. package/dist/pstack/skills/poteto-mode/scripts/watch-pr/github.test.mjs +521 -0
  78. package/dist/pstack/skills/poteto-mode/scripts/watch-pr/policy.mjs +657 -0
  79. package/dist/pstack/skills/poteto-mode/scripts/watch-pr/policy.test.mjs +523 -0
  80. package/dist/pstack/skills/poteto-mode/scripts/watch-pr/render.mjs +106 -0
  81. package/dist/pstack/skills/poteto-mode/scripts/watch-pr/types.mjs +9 -0
  82. package/dist/pstack/skills/poteto-mode/scripts/watch-pr/watch-pr.mjs +5 -0
  83. package/{assets → dist/pstack}/skills/poteto-mode/scripts/worktree-audit.mjs +15 -22
  84. package/dist/pstack/skills/poteto-mode/scripts/worktree-audit.test.mjs +134 -0
  85. package/{assets → dist/pstack}/skills/principle-attack-the-premise/SKILL.md +1 -1
  86. package/{assets → dist/pstack}/skills/principle-boundary-discipline/SKILL.md +1 -1
  87. package/{assets → dist/pstack}/skills/principle-encode-lessons-in-structure/SKILL.md +1 -1
  88. package/{assets → dist/pstack}/skills/principle-exhaust-the-design-space/SKILL.md +1 -1
  89. package/{assets → dist/pstack}/skills/principle-experience-first/SKILL.md +1 -1
  90. package/{assets → dist/pstack}/skills/principle-explain-the-number/SKILL.md +3 -2
  91. package/{assets → dist/pstack}/skills/principle-fix-root-causes/SKILL.md +1 -1
  92. package/{assets → dist/pstack}/skills/principle-laziness-protocol/SKILL.md +1 -1
  93. package/{assets → dist/pstack}/skills/principle-make-operations-idempotent/SKILL.md +1 -1
  94. package/{assets → dist/pstack}/skills/principle-migrate-callers-then-delete-legacy-apis/SKILL.md +1 -1
  95. package/{assets → dist/pstack}/skills/principle-minimize-reader-load/SKILL.md +1 -1
  96. package/{assets → dist/pstack}/skills/principle-model-the-domain/SKILL.md +1 -1
  97. package/{assets → dist/pstack}/skills/principle-never-block-on-the-human/SKILL.md +1 -1
  98. package/{assets → dist/pstack}/skills/principle-outcome-oriented-execution/SKILL.md +1 -1
  99. package/{assets → dist/pstack}/skills/principle-prove-it-works/SKILL.md +2 -2
  100. package/{assets → dist/pstack}/skills/principle-redesign-from-first-principles/SKILL.md +1 -1
  101. package/{assets → dist/pstack}/skills/principle-separate-before-serializing-shared-state/SKILL.md +1 -1
  102. package/{assets → dist/pstack}/skills/principle-sequence-verifiable-units/SKILL.md +1 -1
  103. package/{assets → dist/pstack}/skills/principle-subtract-before-you-add/SKILL.md +1 -1
  104. package/{assets → dist/pstack}/skills/principle-test-behavior-not-implementation/SKILL.md +1 -1
  105. package/{assets → dist/pstack}/skills/principle-type-system-discipline/SKILL.md +1 -1
  106. package/dist/pstack/skills/recall/SKILL.md +37 -0
  107. package/dist/pstack/skills/reflect/SKILL.md +71 -0
  108. package/{assets → dist/pstack}/skills/reflect/references/divergent-reviewer.md +4 -4
  109. package/{assets → dist/pstack}/skills/reflect/references/judgment-reviewer.md +2 -2
  110. package/{assets → dist/pstack}/skills/reflect/references/synthesizer.md +5 -5
  111. package/{assets → dist/pstack}/skills/reflect/references/tooling-reviewer.md +2 -2
  112. package/dist/pstack/skills/setup-pstack/SKILL.md +80 -0
  113. package/{assets → dist/pstack}/skills/sharpen/SKILL.md +1 -1
  114. package/{assets → dist/pstack}/skills/show-me-your-work/SKILL.md +8 -8
  115. package/{assets → dist/pstack}/skills/show-me-your-work/scripts/log.mjs +1 -3
  116. package/dist/pstack/skills/show-me-your-work/scripts/log.test.mjs +56 -0
  117. package/dist/pstack/skills/statechart/SKILL.md +82 -0
  118. package/dist/pstack/skills/statechart/references/render.md +93 -0
  119. package/dist/pstack/skills/statechart/scripts/backends/cfg.mjs +31 -0
  120. package/dist/pstack/skills/statechart/scripts/backends/mermaid.mjs +186 -0
  121. package/dist/pstack/skills/statechart/scripts/backends/plain-text.mjs +62 -0
  122. package/dist/pstack/skills/statechart/scripts/backends/report.mjs +84 -0
  123. package/dist/pstack/skills/statechart/scripts/frontends/config.mjs +268 -0
  124. package/dist/pstack/skills/statechart/scripts/frontends/dot.mjs +67 -0
  125. package/dist/pstack/skills/statechart/scripts/frontends/marks.mjs +94 -0
  126. package/dist/pstack/skills/statechart/scripts/frontends/messages.mjs +48 -0
  127. package/dist/pstack/skills/statechart/scripts/frontends/spec.mjs +101 -0
  128. package/dist/pstack/skills/statechart/scripts/frontends/trace.mjs +39 -0
  129. package/dist/pstack/skills/statechart/scripts/frontends/value.mjs +180 -0
  130. package/dist/pstack/skills/statechart/scripts/frontends/verdict.mjs +40 -0
  131. package/dist/pstack/skills/statechart/scripts/frontends/view.mjs +99 -0
  132. package/dist/pstack/skills/statechart/scripts/ir.mjs +277 -0
  133. package/dist/pstack/skills/statechart/scripts/passes/annotate.mjs +92 -0
  134. package/dist/pstack/skills/statechart/scripts/passes/label.mjs +210 -0
  135. package/dist/pstack/skills/statechart/scripts/passes/lift.mjs +84 -0
  136. package/dist/pstack/skills/statechart/scripts/passes/loop-check.mjs +47 -0
  137. package/dist/pstack/skills/statechart/scripts/passes/paths.mjs +72 -0
  138. package/dist/pstack/skills/statechart/scripts/passes/reach.mjs +135 -0
  139. package/dist/pstack/skills/statechart/scripts/passes/region-check.mjs +82 -0
  140. package/dist/pstack/skills/statechart/scripts/passes/regions.mjs +268 -0
  141. package/dist/pstack/skills/statechart/scripts/pipeline.mjs +72 -0
  142. package/dist/pstack/skills/statechart/scripts/run.mjs +440 -0
  143. package/dist/pstack/skills/statechart/scripts/statechart.mjs +155 -0
  144. package/dist/pstack/skills/statechart/scripts/statechart.test.mjs +198 -0
  145. package/dist/pstack/skills/statechart/scripts/worker.mjs +31 -0
  146. package/dist/pstack/skills/swarm/SKILL.md +43 -0
  147. package/{assets → dist/pstack}/skills/tdd/SKILL.md +1 -1
  148. package/{assets → dist/pstack}/skills/teach/SKILL.md +2 -2
  149. package/{assets → dist/pstack}/skills/technical-writing/SKILL.md +1 -1
  150. package/{assets → dist/pstack}/skills/typescript-best-practices/SKILL.md +3 -6
  151. package/{assets → dist/pstack}/skills/why/SKILL.md +8 -8
  152. package/dist/script.d.mts +9 -111
  153. package/dist/script.mjs +32 -329
  154. package/dist/skill.d.mts +38 -0
  155. package/dist/skill.mjs +183 -0
  156. package/dist/skills/authored/decision-audit/SKILL.md +99 -0
  157. package/dist/skills/authored/decision-audit/SKILL.zh.md +99 -0
  158. package/dist/skills/authored/decision-audit/references/recover-commit.md +17 -0
  159. package/dist/skills/authored/decision-audit/references/recover-commit.zh.md +17 -0
  160. package/dist/skills/authored/decision-write/SKILL.md +131 -0
  161. package/dist/skills/authored/decision-write/SKILL.zh.md +131 -0
  162. package/dist/skills/authored/decision-write/references/land.md +48 -0
  163. package/dist/skills/authored/decision-write/references/land.zh.md +48 -0
  164. package/dist/skills/authored/setup-project-docs/SKILL.md +58 -0
  165. package/dist/skills/authored/setup-project-docs/SKILL.zh.md +58 -0
  166. package/dist/skills/authored/setup-project-docs/references/decision-conventions.md +11 -0
  167. package/dist/skills/authored/setup-project-docs/references/decision-conventions.zh.md +11 -0
  168. package/dist/skills/vendored/retro/SKILL.md +44 -0
  169. package/dist/skills/vendored/retro/agents/openai.yaml +5 -0
  170. package/dist/skills/vendored/writing-for-agents/SKILL-MECHANICS.md +22 -0
  171. package/dist/skills/vendored/writing-for-agents/SKILL.md +81 -0
  172. package/dist/skills/vendored/writing-for-agents/agents/openai.yaml +3 -0
  173. package/dist/subagent.d.mts +56 -193
  174. package/dist/subagent.mjs +443 -741
  175. package/locale/en.json +3 -2
  176. package/locale/zh.json +3 -2
  177. package/package.json +63 -66
  178. package/assets/agents/poteto-agent.md +0 -8
  179. package/assets/docs/harness/dsh.md +0 -60
  180. package/assets/docs/pstack-models.example.md +0 -54
  181. package/assets/skills/arena/SKILL.md +0 -50
  182. package/assets/skills/figure-it-out/SKILL.md +0 -54
  183. package/assets/skills/how/SKILL.md +0 -38
  184. package/assets/skills/interrogate/SKILL.md +0 -71
  185. package/assets/skills/interrogate/references/code-quality-review.md +0 -47
  186. package/assets/skills/interrogate/references/lead-judgment.md +0 -39
  187. package/assets/skills/interrogate/references/reviewer-prompt.md +0 -62
  188. package/assets/skills/interrogate/references/rubric.md +0 -77
  189. package/assets/skills/no-comments/SKILL.md +0 -26
  190. package/assets/skills/poteto-mode/playbooks/authoring-a-skill.md +0 -12
  191. package/assets/skills/poteto-mode/playbooks/autonomous-run.md +0 -15
  192. package/assets/skills/poteto-mode/playbooks/autopilot-full.md +0 -25
  193. package/assets/skills/poteto-mode/playbooks/autopilot-stack.md +0 -12
  194. package/assets/skills/poteto-mode/playbooks/bug-fix.md +0 -15
  195. package/assets/skills/poteto-mode/playbooks/feature.md +0 -21
  196. package/assets/skills/poteto-mode/playbooks/orchestrate.md +0 -112
  197. package/assets/skills/poteto-mode/playbooks/perf-issue.md +0 -25
  198. package/assets/skills/poteto-mode/playbooks/refactoring.md +0 -16
  199. package/assets/skills/poteto-mode/playbooks/runtime-forensics.md +0 -11
  200. package/assets/skills/poteto-mode/playbooks/session-pickup.md +0 -11
  201. package/assets/skills/poteto-mode/playbooks/visual-parity.md +0 -11
  202. package/assets/skills/poteto-mode/playbooks/worktree-cleanup.md +0 -20
  203. package/assets/skills/poteto-mode/scripts/orch/orch.mjs +0 -4282
  204. package/assets/skills/poteto-mode/scripts/orch/orch.test.mjs +0 -2042
  205. package/assets/skills/poteto-mode/scripts/watch-pr/cli.test.mjs +0 -5101
  206. package/assets/skills/poteto-mode/scripts/watch-pr/github.test.mjs +0 -1177
  207. package/assets/skills/poteto-mode/scripts/watch-pr/policy.test.mjs +0 -1441
  208. package/assets/skills/poteto-mode/scripts/watch-pr/watch-pr.mjs +0 -4601
  209. package/assets/skills/recall/SKILL.md +0 -37
  210. package/assets/skills/reflect/SKILL.md +0 -69
  211. package/assets/skills/setup-pstack/SKILL.md +0 -67
  212. package/assets/skills/swarm/SKILL.md +0 -43
  213. package/dist/frontmatter-BQX3ekwP.mjs +0 -229
  214. package/dist/frontmatter-BQX3ekwP.mjs.map +0 -1
  215. package/dist/history.d.mts +0 -429
  216. package/dist/history.mjs +0 -1129
  217. package/dist/history.mjs.map +0 -1
  218. package/dist/host-contract-o47JH_r8.d.mts +0 -527
  219. package/dist/index.mjs.map +0 -1
  220. package/dist/paths-D_JlVmBk.mjs +0 -42
  221. package/dist/paths-D_JlVmBk.mjs.map +0 -1
  222. package/dist/script.mjs.map +0 -1
  223. package/dist/subagent.mjs.map +0 -1
  224. /package/{static/icon.png → assets/logo.png} +0 -0
  225. /package/{assets → dist/pstack}/agents/comment-sicko.md +0 -0
  226. /package/{assets → dist/pstack}/docs/guide/03-understand.md +0 -0
  227. /package/{assets → dist/pstack}/docs/guide/08-principles.md +0 -0
  228. /package/{assets → dist/pstack}/docs/guide/images/design.jpg +0 -0
  229. /package/{assets → dist/pstack}/docs/guide/images/overnight.jpg +0 -0
  230. /package/{assets → dist/pstack}/docs/guide/images/recipes.jpg +0 -0
  231. /package/{assets → dist/pstack}/docs/guide/images/router.jpg +0 -0
  232. /package/{assets → dist/pstack}/docs/guide/images/understanding.jpg +0 -0
  233. /package/{assets → dist/pstack}/docs/guide/images/verification.jpg +0 -0
  234. /package/{assets → dist/pstack}/skills/architect/references/design-red-flags.md +0 -0
  235. /package/{assets → dist/pstack}/skills/architect/references/rationale-template.md +0 -0
  236. /package/{assets → dist/pstack}/skills/architect/references/runner-prompt.md +0 -0
  237. /package/{assets → dist/pstack}/skills/bro/SKILL.md +0 -0
  238. /package/{assets → dist/pstack}/skills/create-verification-skill/references/feature-map-example/README.md +0 -0
  239. /package/{assets → dist/pstack}/skills/create-verification-skill/references/feature-map-example/create-note.md +0 -0
  240. /package/{assets → dist/pstack}/skills/create-verification-skill/references/feature-map-example/search.md +0 -0
  241. /package/{assets → dist/pstack}/skills/how/references/explainer-prompt.md +0 -0
  242. /package/{assets → dist/pstack}/skills/how/references/explorer-prompt.md +0 -0
  243. /package/{assets → dist/pstack}/skills/poteto-mode/references/bugbot-triage.md +0 -0
  244. /package/{assets → dist/pstack}/skills/principle-build-the-lever/SKILL.md +0 -0
  245. /package/{assets → dist/pstack}/skills/principle-foundational-thinking/SKILL.md +0 -0
  246. /package/{assets → dist/pstack}/skills/principle-guard-the-context-window/SKILL.md +0 -0
  247. /package/{assets → dist/pstack}/skills/show-me-your-work/references/decision-log-template.tsv +0 -0
  248. /package/{assets → dist/pstack}/skills/typescript-best-practices/references/patterns.md +0 -0
  249. /package/{assets → dist/pstack}/skills/unslop/SKILL.md +0 -0
  250. /package/{assets → dist/pstack}/skills/why/references/epistemics.md +0 -0
  251. /package/{assets → dist/pstack}/skills/why/references/investigator-prompt.md +0 -0
  252. /package/{assets → dist/pstack}/skills/why/references/source-playbook.md +0 -0
  253. /package/{assets → dist/pstack}/skills/why/references/sources/code-archaeology.md +0 -0
  254. /package/{assets → dist/pstack}/skills/why/references/sources/databricks.md +0 -0
  255. /package/{assets → dist/pstack}/skills/why/references/sources/datadog.md +0 -0
  256. /package/{assets → dist/pstack}/skills/why/references/sources/incident-postmortem.md +0 -0
  257. /package/{assets → dist/pstack}/skills/why/references/sources/linear.md +0 -0
  258. /package/{assets → dist/pstack}/skills/why/references/sources/notion.md +0 -0
  259. /package/{assets → dist/pstack}/skills/why/references/sources/sentry.md +0 -0
  260. /package/{assets → dist/pstack}/skills/why/references/sources/slack.md +0 -0
  261. /package/{assets → dist/pstack}/skills/why/references/synthesizer-prompt.md +0 -0
@@ -1,37 +0,0 @@
1
- ---
2
- name: recall
3
- description: Reconstruct your recent working context from your own chat history, live state, and the shared record (user reports, prior fixes, incidents), then hand back a tight current-state brief. Use for 'recall my work on X', 'catch me up', 'what have I been working on', 'where did I leave off', before starting or resuming work.
4
- disable-model-invocation: true
5
- ---
6
-
7
- # Recall
8
-
9
- > DSH port of pstack. `pstack_subagent` replaces Cursor's Task tool, and `role` replaces Cursor model slugs. Full mapping: `../../docs/harness/dsh.md`.
10
-
11
- **Before you start or resume work, you rebuild the user's recent working context and hand back a tight capsule of where things stand now and what to do next.**
12
-
13
- Keep it tight and on-topic. Read only what the in-scope threads need, then stop.
14
-
15
- Your context lives in two records. Your own chat history holds what you did and decided. The shared record holds everything that happened around the same code under other names: the symptoms users keep reporting, the fixes that shipped and got reverted, the errors still firing in prod. That second record is what `why` searches, across source control, the issue tracker, chat and issue channels, long-form docs, and error tracking; read that skill's `SKILL.md` at its absolute resource path. A feature with a long bug tail keeps most of its story there, so don't reconstruct it from your own sessions alone.
16
-
17
- Prior sessions are read through `pstack_history`, which returns raw log events for the calling session and, when named, one of its reviewable direct children, all inside the caller's workspace. The official `session_search` tool can accelerate finding a topic across this workspace's other sessions, and `session_event_read` opens the region around a hit; neither replaces the log of the session you are auditing, and neither stands in for `pstack_history` when you need complete events. Never read the session store directory, decompress a log file, or search `~/.dsh` directly: those paths and formats are private to the host.
18
-
19
- 1. Classify, then route. One specific prior chat to resume is the `session-pickup` playbook, not this. Turning habits into a durable skill is `automate-me`. A human-readable summary of your work is a different task. Recall loads working context across recent chats before you act. If the user already gave you a full state capsule (paths, branch, the change), use it and skip the mining.
20
- 2. Lock the scope before searching. Pin the window ("recent" is a real range, default the last 7 days), the topic if named, and the workspace (default the active one. Never read another project's sessions without being asked). State the scope back. Never quietly turn "all" into "recent N".
21
- 3. Fan out across your chat history. Start parallel children with `pstack_subagent`, each taking a slice of the window, and give each one a role that is actually configured in `$DSH_HOME/pstack-models.md`; when no cheaper route is configured, let the child inherit this run's route and say so instead of claiming a fast model. Tell every subagent to order candidates by real activity time (the `time` field of the events it reads, never the session id), scan the topic first and then read only the matching sessions and only their relevant regions, and skip the current session plus obvious noise (subagent, eval, and test sessions). Each returns the same schema, one block per session: topic, the user's goal, decisions, open threads, struggles and corrections, and artifacts (PRs, tickets, branches), each citing the session id. For one or two sessions, skip the fan-out and read directly. The raw events stay with the subagents. The main thread gets only their findings. Pick each subagent's role per the Subagents section of `poteto-mode`; read its `SKILL.md` at its absolute resource path. Start from the level the role line names, raise it for hard work and lower it for routine work by passing `reasoningEffort`; a child that cannot call `set_reasoning_effort` keeps the level you gave it.
22
- 4. Sweep the shared record whenever the topic names a feature, file, subsystem, area, or bug. This is the default, not a judgment call, and "my work on X" does not exempt it. Hand it to the `why` skill's source investigators, but steer their question from "why was this built this way" to "what's the current state, what's been tried and didn't hold, and what are users still reporting". Reuse its per-source playbooks, run the investigators in parallel with the chat-history mining, and inherit its posture: one investigator per source, null results are findings, skip an unavailable MCP and say so. Fold what comes back into the brief. Skip this step only for pure activity recall with no named target ("what did I do this week"), where your own history and live state are the entire answer.
23
- 5. Verify against live state. Take the PRs, branches, and tickets that the mining and the sweep surfaced and check them with `git` and `gh`. When the answer hinges on what an agent actually did (the tools it ran, files it read, errors it hit), read the full event log through `pstack_history`, paging with `fromSeq` and `nextFromSeq` when it is long, not just a summary. A summary can support a recap; it cannot support a claim about which files or tools were touched, and a `denied` or `unavailable` result means that claim stays unproven.
24
- 6. Write the brief to the contract below. Group by thread. Stay on the named topic.
25
-
26
- ## Output contract
27
-
28
- Lead with the capsule, then the thread status, then the problems, then the next move. Deeper detail goes below or gets cut.
29
-
30
- - **Capsule.** At most 5 bullets. What this work is and where it stands overall.
31
- - **Threads.** One line each, prefixed with exactly one status tag: `[merged #N]`, `[open PR #N]`, `[in flight <branch>]`, `[verified, uncommitted]`, `[reverted #N]`, or `[planned, not started]`. A thread with no tag is not done yet, so tag it.
32
- - **Problems.** At most 5, the recurring ones. Include the symptoms users keep reporting and any fix that shipped and was reverted, so the next attempt starts where the last one failed.
33
- - **Next move.** The single most useful next action, concrete.
34
-
35
- An adjacent feature or ticket stays out unless it blocks this one. When the capsule and thread lines outgrow a screen, cut detail before you cut threads. Write the brief through `unslop`; read its `SKILL.md` at its absolute resource path, and cite chat findings by session id and shared-record findings by their source (PR #, ticket ID, chat permalink, error-tracker issue), and sanitize private context before any public output.
36
-
37
- **Reply:** the brief, to the contract above.
@@ -1,69 +0,0 @@
1
- ---
2
- name: reflect
3
- description: Spawn three parallel review subagents over this run's raw event log, surface learnings, and route each to a concrete edit on an existing skill. Use when the user says reflect.
4
- disable-model-invocation: true
5
- ---
6
-
7
- # Reflect
8
-
9
- > DSH port of pstack. `pstack_subagent` replaces Cursor's Task tool, and `role` replaces Cursor model slugs. Full mapping: `../../docs/harness/dsh.md`.
10
-
11
- Mine the current conversation for durable learnings, then route them into skill edits.
12
-
13
- Invoke when the user says "reflect" or "/reflect". Skip when the conversation is trivial, off-topic, or already covered by an existing skill the parent followed correctly. One-offs are not learnings.
14
-
15
- ## 1. Read this run's raw events
16
-
17
- Before fanning out, call `pstack_history` with `scope: "current"` for this run's raw log events, and with `scope: "children"` to list the child sessions this run may review. Read one child by passing its `sessionId`. Any other session is outside this tool: never read the session store directory, decompress a log file, or search `~/.dsh` directly, because those paths and formats are private to the host and globbing them would cross workspace boundaries.
18
-
19
- Page the log instead of sampling it: pass the previous page's `nextFromSeq` back as `fromSeq`, and pin `throughSeq` to the first page's value so a later page cannot absorb events that landed after you started. Open steps and turns are expected; an unbalanced tail is not an error.
20
-
21
- The result carries raw events, not the model-visible transcript. That is deliberate: this review is about what actually happened.
22
-
23
- If the tool answers `denied` or `unavailable`, say which layer failed and report this audit as unfinished. Do not substitute a summary for the log and call the review complete, and do not read an unavailable result as evidence that the run did nothing.
24
-
25
- ## 2. Start three reviewers in parallel
26
-
27
- One message, three `pstack_subagent` calls with `agent: "general"`. Reviewers need the MCP servers the log references, so do not brief them to avoid tool use; they must not write.
28
-
29
- Each reviewer and the synthesizer name a role line in `$DSH_HOME/pstack-models.md`. Pass that line as `role`. When the file or the line is missing, omit `role` so the child inherits this run's route, and say so in the reply. There is no per-call model slug: an unknown role fails instead of silently falling back, and `inherit-parent` or `auto` means the same as omitting `role`. Pick each subagent's role per the Subagents section of `poteto-mode`; read its `SKILL.md` at its absolute resource path.
30
-
31
- | Lens | Role line | Prompt template |
32
- |---|---|---|
33
- | Judgment | `reflect judgment, divergent, synthesizer` | `references/judgment-reviewer.md` |
34
- | Tooling | `reflect tooling` | `references/tooling-reviewer.md` |
35
- | Divergent | `reflect judgment, divergent, synthesizer` | `references/divergent-reviewer.md` |
36
-
37
- Pass each template verbatim, substituting the paged event log where marked. A reviewer cannot read this run's log on its own: inline the events you paged, or a compact summary when the log is too large, and when you inline a summary instead of the events, say so and treat the full-transcript audit as unfinished. Reviewers return findings in their completion notice. Start from the level the role line names, raise it for hard work and lower it for routine work by passing `reasoningEffort`; a child that cannot call `set_reasoning_effort` keeps the level you gave it.
38
-
39
- ## 3. Synthesize
40
-
41
- One `pstack_subagent` call with `agent: "general"` and `role` from the `reflect judgment, divergent, synthesizer` line, inheriting this run's route when that line is missing. It spot-verifies citations through MCP, so brief it not to write. Pass `references/synthesizer.md` verbatim, with each reviewer's full output inlined where marked. It returns an Accepted / Rejected / Backlog list.
42
-
43
- ## 4. Structural enforcement check
44
-
45
- Move any Accepted item that a lint rule, script, metadata flag, or runtime check would enforce more reliably to Backlog. See `principle-encode-lessons-in-structure`; read its `SKILL.md` at its absolute resource path.
46
-
47
- ## 5. Apply
48
-
49
- Present the synthesizer's full Accepted / Rejected / Backlog output and wait for explicit approval before applying any Accepted edit. The user picks the subset and may redirect routings. Skill changes affect every future agent in the org. Do not auto-apply.
50
-
51
- File each Backlog item to your team's devex or backlog tracker without waiting. Only the Accepted list waits for approval.
52
-
53
- Follow each approved row's Routing exactly:
54
-
55
- - Trivial existing-skill edit (a one-line bullet, a tightened sentence, a stale fact corrected): the parent does it directly.
56
- - Substantive existing-skill edit (a new section, a new pattern table, more than ~10 lines): follow the `authoring-a-skill` playbook, which names this package's frontmatter, link, and structure checks.
57
- - `tune description: <skill path>` (the skill exists but didn't trigger when it should have): rewrite its `description` against the frontmatter rules yourself and reload the catalog to confirm it is picked up. There is no description-optimization tool here.
58
- - `new skill via the authoring playbook: <kebab-name>`: create it with the `authoring-a-skill` playbook and run the checks it names. Do not invent the shape ad hoc.
59
-
60
- Run the checks the `authoring-a-skill` playbook names on every touched skill before declaring done. This host ships no separate SKILL.md validator binary, so do not claim one ran.
61
-
62
- ## 6. Summarize for the user
63
-
64
- Short list, no preamble:
65
-
66
- - Edits applied: `<skill path>`. What changed, one line each.
67
- - New skills created: `<skill path>`. One line each (rare).
68
- - Backlog filed to the devex tracker: `<issue title>` (`<tags>`). One line each.
69
- - Dropped: one line per rejected finding + reason from the synthesizer.
@@ -1,67 +0,0 @@
1
- ---
2
- name: setup-pstack
3
- description: Configure which models pstack uses per role and at what reasoning budget. Detects the child model routes this deployment serves and writes `$DSH_HOME/pstack-models.md`, which overrides the skill defaults. Use for /setup-pstack, "configure pstack models", "pstack budget", or changing pstack's model choices.
4
- ---
5
-
6
- # Setup pstack
7
-
8
- > DSH port of pstack. `pstack_subagent` replaces Cursor's Task tool, and `role` replaces Cursor model slugs. Full mapping: `../../docs/harness/dsh.md`.
9
-
10
- Write `$DSH_HOME/pstack-models.md`, the role file `pstack_subagent` re-reads on every delegation and that sets pstack's model per role.
11
-
12
- That file is the only thing this skill writes. It never touches `package.json`, `cordis.patch.yml`, a native default model, or a credential.
13
-
14
- ## Steps
15
-
16
- ### 1. Detect available models
17
-
18
- Call `list_subagent_models()` with no arguments to list the LLM providers this deployment serves. Call `list_subagent_models({ provider })` to list that provider's models, then `list_subagent_models({ provider, model })` to list the reasoning efforts that exact model supports.
19
-
20
- That adapter metadata is the only dependable source. This deployment decides which routes exist, and only the model's own advertised effort list says whether `max`, `xhigh`, `high`, or `medium` is available. Do not infer an effort ladder from a model id.
21
-
22
- When `list_subagent_models` is not available in this session, do not invent a route. Either ask the user for a `provider/model` pair they have already confirmed, or write `inherit-parent` for every role and say plainly that the choices are unverified. Never hardcode a model id, never ask for an API key, and never claim a route works because it looks plausible. `inherit-parent` and `auto` always work because they send no route at all.
23
-
24
- ### 2. Load current state
25
-
26
- The role list and the shape of a value come from this package's `../../docs/pstack-models.example.md`. Read that file. It is generated from the role manifest, so it is the list: do not re-derive role names from memory and never add a role the manifest does not name.
27
-
28
- If `$DSH_HOME/pstack-models.md` already exists, read it and treat its `# budget` line and its role values as the current choices, and keep every role the user changed by hand. Otherwise start from the example's `inherit-parent` values. A line whose role is not in the example, such as `how critics`, is from a retired role: list it for the user as retired, then drop it.
29
-
30
- ### 3. Budget, map, and confirm
31
-
32
- **(a) Ask for a budget.** Prefer `ask_user_question` over free text. Offer these four options with these exact labels, and name the current budget when the file records one. With no file, say that no budget is recorded yet and that every role currently inherits the parent route.
33
-
34
- - `unlimited — max reasoning`
35
- - `large — xhigh reasoning`
36
- - `medium — high reasoning`
37
- - `small — medium reasoning`
38
-
39
- **(b) Apply it.** Keep the route of every role the user set by family, list, or alias (`inherit-parent`, `auto`). Only the effort of a role that already names a route follows the budget. `unlimited`, `large`, `medium`, and `small` target `max`, `xhigh`, `high`, and `medium`.
40
-
41
- Apply a target only when that model's own `list_subagent_models({ provider, model })` list contains it. When it does not, use the highest effort at or below the target that the model does advertise, and say which role moved. When nothing at or below the target is advertised, mark the role as needing a choice instead of writing an effort the adapter would reject. `inherit-parent` and `auto` never change, because they carry no effort.
42
-
43
- **(c) Show the roles and confirm.** Show every role with its route, marking any route that does not resolve on this deployment as needing a choice. Also list each line step 2 dropped as retired. Ask whether to accept as-is or change specific roles, offering the confirmed routes plus `inherit-parent` and `auto`, which both mean this role runs on the parent chat model. Prefer `ask_user_question` over free text.
44
-
45
- For the panel roles (`arena runners`, `architect runners`, `interrogate reviewers`) the value is a list, and `pstack_subagent` starts one child per entry, alias entries included, so the list length sets the count. `arena cross-judge pool` is also a list, but `pstack_subagent` starts one child from it, chosen with `roleIndex`. `swarm workers` is a list as well: its first entry is the default route for every worker, a race passes `roleIndex` to give different arms different entries, and the caller still starts each worker itself. Two entries on the same route are not a cross-model panel; say so instead of implying model diversity.
46
-
47
- ### 4. Validate
48
-
49
- Every route written must be one this deployment serves, and every effort must appear in that exact model's advertised list. `inherit-parent` and `auto` always pass. If a chosen route does not resolve, stop and ask again rather than writing it and hoping the first delegation catches it. Remember that the effort you write is the level that role *starts* at: a caller may raise or lower it per delegation with `reasoningEffort`, and a running child may change its own, so a role line that names a modest level is not a mistake to correct.
50
-
51
- ### 5. Write the file
52
-
53
- Read the old `$DSH_HOME/pstack-models.md` first, keep the user's own edits, name the retired roles you dropped, and confirm before overwriting. Then write the complete file in one pass, so a re-run of this skill produces the same bytes and converges: a `# budget` line naming the chosen label and its target effort, and one line per role, using the exact role keys from the example.
54
-
55
- Read `../../docs/pstack-models.example.md` from this package and write the same shape to `$DSH_HOME/pstack-models.md`, replacing each `inherit-parent` with the route the user confirmed. Do not retype the role keys from this skill: the example is generated from the role manifest, and a hand-written copy would drift from the parser.
56
-
57
- ### 6. Confirm
58
-
59
- Tell the user the file was written and that it applies to the next delegation, because `pstack_subagent` re-reads it every time. A child that already started keeps the route it started with. Re-running this skill updates the file.
60
-
61
- ### 7. Offer a verification skill (optional)
62
-
63
- Check whether the project has a way to drive the real app for proof (a `verify-*` skill, or an existing harness). If not, offer once: "want a project-local verification skill, so agents can drive the app the way a user does and prove changes work? I can generate one with /create-verification-skill." On yes, invoke `/create-verification-skill` (its `SKILL.md` is in this package's skill resources). On no, move on without pushing.
64
-
65
- ### 8. Offer a formal verification skill (optional)
66
-
67
- Check whether the project already has a formal verification skill (a project skill that runs a model checker, a proof, or another verifier against the code). If not, offer once: "want a formal verification skill, so agents can prove a key property of your code holds in every case in scope, not only the cases tests reach? I can generate one with /create-formal-verification-skill." On yes, invoke `/create-formal-verification-skill` (its `SKILL.md` is in this package's skill resources). On no, move on without pushing.
@@ -1,43 +0,0 @@
1
- ---
2
- name: swarm
3
- description: Fan out N parallel workers, drain them, and return one report. Use for /swarm, 'swarm this', or parallel coverage, races, gauntlets, and exploration.
4
- disable-model-invocation: true
5
- ---
6
-
7
- # Swarm
8
-
9
- > DSH port of pstack. `pstack_subagent` replaces Cursor's Task tool, and `role` replaces Cursor model slugs. Full mapping: `../../docs/harness/dsh.md`.
10
-
11
- ## Start
12
-
13
- Open a `todo_write` list with one entry per phase before launching anything.
14
-
15
- 1. Frame
16
- 2. Fan out
17
- 3. Aggregate
18
- 4. Report
19
-
20
- ## Phase A: Frame
21
-
22
- 1. State the done predicate and the artifact or report the swarm must return.
23
- 2. Choose the shape. Partition into slices, race N workers on identical briefs, or mix both. For a race or mixed shape, declare `first pass`, `rank all`, or `best-of` before spawning.
24
- 4. Pick the worker route. Use `role: "swarm workers"` for every worker: that role is a list, not a panel, so you start each worker yourself with one `pstack_subagent` call each. A role the file does not name inherits the parent route. Never invent a model id. Without `roleIndex` the tool takes the first entry, which is the default route for every worker. For a model race, keep `role: "swarm workers"` and pass a different `roleIndex` per arm, so this call's result carries that arm's actual route instead of leaving it implied. The tool reports the entry and route this call selected; it cannot compare separate calls, so when two arms land on the same entry you must say in your synthesis that they share one route and that this is not a cross-model race. Read the Subagents section of the `poteto-mode` skill at its absolute resource path first. Start from the level the role line names, raise it for hard work and lower it for routine work by passing `reasoningEffort`; a child that cannot call `set_reasoning_effort` keeps the level you gave it.
25
- 5. Give each worker its own writable output when it writes: the worker calls `create_worktree({ name })` in its own Session, or you create the checkouts one at a time and pass each absolute `path` as that worker's `cwd`. Two workers in one checkout are not isolated, and the parallel writes will collide on shared files. When workers verify or measure commits, each brief names the exact SHAs. A measurement brief also names the method (sample count, what one sample is, order). The worker records both in its result.
26
-
27
- ## Phase B: Fan out
28
-
29
- Start all N workers in one batch of `pstack_subagent` calls with `agent: "general"` and the step 4 role. A worker is a managed activation, so there is no background flag and nothing polls: each result arrives as a completion notice. Every worker runs locally as a child of this Session; there is no cloud environment, no VM, and no per-arm machine.
30
-
31
- When a worker must start from a branch other than the current one, make that branch reachable locally and start the checkout from it: the worker calls `create_worktree({ name, from })` with a local revision, or you create the checkout yourself and pass its absolute `path` as the worker's `cwd`. Creation does not fetch, so a branch that only exists on a remote has to be fetched first; a missing local revision fails instead of silently branching off the current commit.
32
-
33
- Every brief stands alone. Include the goal, scope, exact slice or race arm, how to verify, and what to report. Reports use `PASS`, `ISSUES`, or `BLOCKED` with evidence. A worker that can prove a defect reports `ISSUES` and lists every issue it can prove, not only the first.
34
-
35
- If a worker drops out, proceed with N-1 and note it.
36
-
37
- ## Phase C: Aggregate
38
-
39
- Read the terminal results. Drop a result that does not record the SHAs and method its brief names, and respawn that worker once. After a second miss, record a gap. A gap does not count as a pass. For coverage, every required slice needs a result. For a race, apply the selection rule declared up front. Use first pass, rank all, or best-of. Do not paste raw worker dumps.
40
-
41
- ## Phase D: Report
42
-
43
- Return one consolidated in-chat report with the table, issue one-liners, gaps or dropouts, and the race rule when used.
@@ -1,229 +0,0 @@
1
- //#region src/frontmatter.ts
2
- const SKILL_CONSUMED_FIELDS = [
3
- "name",
4
- "description",
5
- "disable-model-invocation",
6
- "user-invocable",
7
- "whenToUse"
8
- ];
9
- const SKILL_DROPPED_FIELDS = [
10
- "icon",
11
- "color",
12
- "paths"
13
- ];
14
- const AGENT_CONSUMED_FIELDS = ["name", "description"];
15
- const AGENT_DROPPED_FIELDS = ["is_background"];
16
- const MAX_SKILL_NAME_LENGTH = 64;
17
- const SKILL_NAME_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
18
- var FrontmatterError = class extends Error {
19
- constructor(message) {
20
- super(message);
21
- this.name = "FrontmatterError";
22
- }
23
- };
24
- function parseFrontmatter(source) {
25
- const eol = detectEol(source);
26
- const lines = (eol === "\r\n" ? source.replaceAll("\r\n", "\n") : source).split("\n");
27
- if (lines[0] !== "---") throw new FrontmatterError("frontmatter: file must start with a \"---\" line");
28
- const closing = lines.indexOf("---", 1);
29
- if (closing === -1) throw new FrontmatterError("frontmatter: missing closing \"---\" delimiter");
30
- const data = parseBlock(lines.slice(1, closing));
31
- const body = lines.slice(closing + 1).join("\n");
32
- return {
33
- data,
34
- body: eol === "\r\n" ? body.replaceAll("\n", eol) : body
35
- };
36
- }
37
- function validateSkillFrontmatter(data, source) {
38
- rejectUnknownFields(data, source, SKILL_CONSUMED_FIELDS, SKILL_DROPPED_FIELDS);
39
- const name = readName(data, source);
40
- const description = readDescription(data, source);
41
- const whenToUse = data["whenToUse"];
42
- if (whenToUse !== void 0 && whenToUse.trim() === "") throw new FrontmatterError(`${source}: "whenToUse" must not be empty`);
43
- return {
44
- name,
45
- description,
46
- disableModelInvocation: readBoolean(data, "disable-model-invocation", source, false),
47
- userInvocable: readBoolean(data, "user-invocable", source, true),
48
- ...whenToUse === void 0 ? {} : { whenToUse }
49
- };
50
- }
51
- function validateAgentFrontmatter(data, source) {
52
- rejectUnknownFields(data, source, AGENT_CONSUMED_FIELDS, AGENT_DROPPED_FIELDS);
53
- return {
54
- name: readName(data, source),
55
- description: readDescription(data, source)
56
- };
57
- }
58
- function serializeSkillFrontmatter(data) {
59
- const lines = [
60
- "---",
61
- `name: ${formatScalar(data.name)}`,
62
- `description: ${formatScalar(data.description)}`
63
- ];
64
- if (data.disableModelInvocation) lines.push("disable-model-invocation: true");
65
- if (!data.userInvocable) lines.push("user-invocable: false");
66
- if (data.whenToUse !== void 0) lines.push(`whenToUse: ${formatScalar(data.whenToUse)}`);
67
- lines.push("---");
68
- return `${lines.join("\n")}\n`;
69
- }
70
- function serializeAgentFrontmatter(data) {
71
- return [
72
- "---",
73
- `name: ${formatScalar(data.name)}`,
74
- `description: ${formatScalar(data.description)}`,
75
- "---",
76
- ""
77
- ].join("\n");
78
- }
79
- function skillDroppedFields(data, source) {
80
- return droppedFields(data, source, SKILL_DROPPED_FIELDS);
81
- }
82
- function agentDroppedFields(data, source) {
83
- return droppedFields(data, source, AGENT_DROPPED_FIELDS);
84
- }
85
- function droppedFields(data, source, fields) {
86
- return fields.flatMap((field) => {
87
- const value = data[field];
88
- return value === void 0 ? [] : [{
89
- file: source,
90
- field,
91
- value
92
- }];
93
- });
94
- }
95
- function detectEol(source) {
96
- if (!source.includes("\r\n")) return "\n";
97
- const withoutCrlf = source.replaceAll("\r\n", "");
98
- if (withoutCrlf.includes("\r") || withoutCrlf.includes("\n")) throw new FrontmatterError("frontmatter: mixed line endings are not supported");
99
- return "\r\n";
100
- }
101
- function parseBlock(lines) {
102
- const data = {};
103
- for (let index = 0; index < lines.length; index += 1) {
104
- const line = lines[index];
105
- const trimmed = line.trim();
106
- if (trimmed === "" || trimmed.startsWith("#")) continue;
107
- if (trimmed !== line) throw new FrontmatterError(`frontmatter: unexpected indented line "${trimmed}"`);
108
- const entry = /^([A-Za-z_][A-Za-z0-9_-]*):(.*)$/.exec(line);
109
- if (entry === null) throw new FrontmatterError(`frontmatter: expected "key: value", got "${line}"`);
110
- const key = entry[1];
111
- const rest = entry[2];
112
- if (rest !== "" && !rest.startsWith(" ")) throw new FrontmatterError(`frontmatter: missing space after "${key}:"`);
113
- if (Object.hasOwn(data, key)) throw new FrontmatterError(`frontmatter: duplicate key "${key}"`);
114
- const raw = rest.trim();
115
- if (raw === ">" || raw === ">-" || raw === "|" || raw === "|-") {
116
- const block = [];
117
- let cursor = index + 1;
118
- while (cursor < lines.length) {
119
- const candidate = lines[cursor];
120
- if (candidate.trim() !== "" && !candidate.startsWith(" ") && !candidate.startsWith(" ")) break;
121
- block.push(candidate);
122
- cursor += 1;
123
- }
124
- while (block.length > 0 && block.at(-1).trim() === "") block.pop();
125
- if (block.length === 0) throw new FrontmatterError(`frontmatter: "${key}" has an empty ${raw} block`);
126
- data[key] = parseBlockScalar(block, raw, key);
127
- index = cursor - 1;
128
- continue;
129
- }
130
- data[key] = parseScalar(raw, key);
131
- }
132
- return data;
133
- }
134
- function parseScalar(raw, key) {
135
- if (raw === "") return "";
136
- if (raw.startsWith("\"")) return parseDoubleQuoted(raw, key);
137
- if (raw.startsWith("'")) return parseSingleQuoted(raw, key);
138
- return raw;
139
- }
140
- function parseDoubleQuoted(raw, key) {
141
- if (raw.length < 2 || !raw.endsWith("\"")) throw new FrontmatterError(`frontmatter: unterminated double-quoted value for "${key}"`);
142
- const inner = raw.slice(1, -1);
143
- let value = "";
144
- for (let index = 0; index < inner.length; index += 1) {
145
- const character = inner[index];
146
- if (character !== "\\") {
147
- value += character;
148
- continue;
149
- }
150
- const escaped = inner[index += 1];
151
- if (escaped === "\"") value += "\"";
152
- else if (escaped === "\\") value += "\\";
153
- else if (escaped === "n") value += "\n";
154
- else throw new FrontmatterError(`frontmatter: unsupported escape "\\${escaped ?? ""}" in "${key}"`);
155
- }
156
- return value;
157
- }
158
- function parseSingleQuoted(raw, key) {
159
- if (raw.length < 2 || !raw.endsWith("'")) throw new FrontmatterError(`frontmatter: unterminated single-quoted value for "${key}"`);
160
- const inner = raw.slice(1, -1);
161
- let value = "";
162
- for (let index = 0; index < inner.length; index += 1) {
163
- const character = inner[index];
164
- if (character !== "'") {
165
- value += character;
166
- continue;
167
- }
168
- if (inner[index + 1] === "'") {
169
- value += "'";
170
- index += 1;
171
- continue;
172
- }
173
- throw new FrontmatterError(`frontmatter: unescaped single quote in "${key}"`);
174
- }
175
- return value;
176
- }
177
- function parseBlockScalar(lines, indicator, key) {
178
- const indents = lines.filter((line) => line.trim() !== "").map((line) => /^\s*/.exec(line)[0].length);
179
- const indent = Math.min(...indents);
180
- const content = lines.map((line) => line.trim() === "" ? "" : line.slice(indent));
181
- const text = indicator.startsWith("|") ? content.join("\n") : fold(content);
182
- if (text.trim() === "") throw new FrontmatterError(`frontmatter: "${key}" block is empty`);
183
- return indicator.endsWith("-") ? text : `${text}\n`;
184
- }
185
- function fold(lines) {
186
- const paragraphs = [[]];
187
- for (const line of lines) if (line === "") paragraphs.push([]);
188
- else paragraphs.at(-1).push(line);
189
- return paragraphs.map((paragraph) => paragraph.join(" ")).join("\n");
190
- }
191
- function rejectUnknownFields(data, source, consumed, dropped) {
192
- const unknown = Object.keys(data).filter((key) => !consumed.includes(key) && !dropped.includes(key));
193
- if (unknown.length > 0) throw new FrontmatterError(`${source}: unknown frontmatter field(s) ${unknown.join(", ")}`);
194
- }
195
- function readName(data, source) {
196
- const value = data["name"];
197
- if (value === void 0 || value.trim() === "") throw new FrontmatterError(`${source}: missing "name"`);
198
- if (!SKILL_NAME_PATTERN.test(value)) throw new FrontmatterError(`${source}: "name" must be kebab-case, got "${value}"`);
199
- if (value.length > 64) throw new FrontmatterError(`${source}: "name" is longer than 64 characters`);
200
- return value;
201
- }
202
- function readDescription(data, source) {
203
- const value = data["description"];
204
- if (value === void 0 || value.trim() === "") throw new FrontmatterError(`${source}: missing "description"`);
205
- return value;
206
- }
207
- function readBoolean(data, key, source, fallback) {
208
- const value = data[key];
209
- if (value === void 0) return fallback;
210
- if (value === "true") return true;
211
- if (value === "false") return false;
212
- throw new FrontmatterError(`${source}: "${key}" must be true or false, got "${value}"`);
213
- }
214
- function formatScalar(value) {
215
- return needsQuotes(value) ? `"${escapeDoubleQuoted(value)}"` : value;
216
- }
217
- function needsQuotes(value) {
218
- if (value === "" || value.trim() !== value) return true;
219
- if (/[\n\r\t]/.test(value)) return true;
220
- if (/^[-?:,[\]{}#&*!|>'"%@`]/.test(value)) return true;
221
- return /: | #|:$/.test(value);
222
- }
223
- function escapeDoubleQuoted(value) {
224
- return value.replaceAll("\\", "\\\\").replaceAll("\"", "\\\"").replaceAll("\n", "\\n").replaceAll("\r", "\\r");
225
- }
226
- //#endregion
227
- export { SKILL_CONSUMED_FIELDS as a, parseFrontmatter as c, skillDroppedFields as d, validateAgentFrontmatter as f, MAX_SKILL_NAME_LENGTH as i, serializeAgentFrontmatter as l, AGENT_DROPPED_FIELDS as n, SKILL_DROPPED_FIELDS as o, validateSkillFrontmatter as p, FrontmatterError as r, agentDroppedFields as s, AGENT_CONSUMED_FIELDS as t, serializeSkillFrontmatter as u };
228
-
229
- //# sourceMappingURL=frontmatter-BQX3ekwP.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"frontmatter-BQX3ekwP.mjs","names":[],"sources":["../src/frontmatter.ts"],"sourcesContent":["/**\n * Frontmatter parsing for pstack skills and agents.\n *\n * This is a deliberately small YAML subset, not YAML. It reads the shapes the\n * upstream files use: plain scalars, single and double quotes, folded (`>` and\n * `>-`) and literal (`|` and `|-`) blocks, comments, and blank lines. Nesting\n * and multi-document streams are rejected rather than half-supported.\n */\n\nexport interface Frontmatter {\n readonly data: Readonly<Record<string, string>>;\n readonly body: string;\n}\n\nexport interface SkillFrontmatter {\n readonly name: string;\n readonly description: string;\n readonly disableModelInvocation: boolean;\n readonly userInvocable: boolean;\n readonly whenToUse?: string;\n}\n\nexport interface AgentFrontmatter {\n readonly name: string;\n readonly description: string;\n}\n\nexport interface DroppedFrontmatterField {\n readonly file: string;\n readonly field: string;\n readonly value: string;\n}\n\nexport const SKILL_CONSUMED_FIELDS = [\n \"name\",\n \"description\",\n \"disable-model-invocation\",\n \"user-invocable\",\n \"whenToUse\",\n] as const;\n\nexport const SKILL_DROPPED_FIELDS = [\"icon\", \"color\", \"paths\"] as const;\n\nexport const AGENT_CONSUMED_FIELDS = [\"name\", \"description\"] as const;\n\nexport const AGENT_DROPPED_FIELDS = [\"is_background\"] as const;\n\nexport const MAX_SKILL_NAME_LENGTH = 64;\n\nconst SKILL_NAME_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;\n\nexport class FrontmatterError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"FrontmatterError\";\n }\n}\n\nexport function parseFrontmatter(source: string): Frontmatter {\n const eol = detectEol(source);\n const text = eol === \"\\r\\n\" ? source.replaceAll(\"\\r\\n\", \"\\n\") : source;\n const lines = text.split(\"\\n\");\n\n if (lines[0] !== \"---\") {\n throw new FrontmatterError('frontmatter: file must start with a \"---\" line');\n }\n const closing = lines.indexOf(\"---\", 1);\n if (closing === -1) {\n throw new FrontmatterError('frontmatter: missing closing \"---\" delimiter');\n }\n\n const data = parseBlock(lines.slice(1, closing));\n const body = lines.slice(closing + 1).join(\"\\n\");\n return { data, body: eol === \"\\r\\n\" ? body.replaceAll(\"\\n\", eol) : body };\n}\n\nexport function validateSkillFrontmatter(\n data: Readonly<Record<string, string>>,\n source: string,\n): SkillFrontmatter {\n rejectUnknownFields(data, source, SKILL_CONSUMED_FIELDS, SKILL_DROPPED_FIELDS);\n\n const name = readName(data, source);\n const description = readDescription(data, source);\n const whenToUse = data[\"whenToUse\"];\n if (whenToUse !== undefined && whenToUse.trim() === \"\") {\n throw new FrontmatterError(`${source}: \"whenToUse\" must not be empty`);\n }\n\n return {\n name,\n description,\n disableModelInvocation: readBoolean(data, \"disable-model-invocation\", source, false),\n userInvocable: readBoolean(data, \"user-invocable\", source, true),\n ...(whenToUse === undefined ? {} : { whenToUse }),\n };\n}\n\nexport function validateAgentFrontmatter(\n data: Readonly<Record<string, string>>,\n source: string,\n): AgentFrontmatter {\n rejectUnknownFields(data, source, AGENT_CONSUMED_FIELDS, AGENT_DROPPED_FIELDS);\n return { name: readName(data, source), description: readDescription(data, source) };\n}\n\nexport function serializeSkillFrontmatter(data: SkillFrontmatter): string {\n const lines = [\n \"---\",\n `name: ${formatScalar(data.name)}`,\n `description: ${formatScalar(data.description)}`,\n ];\n if (data.disableModelInvocation) lines.push(\"disable-model-invocation: true\");\n if (!data.userInvocable) lines.push(\"user-invocable: false\");\n if (data.whenToUse !== undefined) lines.push(`whenToUse: ${formatScalar(data.whenToUse)}`);\n lines.push(\"---\");\n return `${lines.join(\"\\n\")}\\n`;\n}\n\nexport function serializeAgentFrontmatter(data: AgentFrontmatter): string {\n return [\n \"---\",\n `name: ${formatScalar(data.name)}`,\n `description: ${formatScalar(data.description)}`,\n \"---\",\n \"\",\n ].join(\"\\n\");\n}\n\nexport function skillDroppedFields(\n data: Readonly<Record<string, string>>,\n source: string,\n): readonly DroppedFrontmatterField[] {\n return droppedFields(data, source, SKILL_DROPPED_FIELDS);\n}\n\nexport function agentDroppedFields(\n data: Readonly<Record<string, string>>,\n source: string,\n): readonly DroppedFrontmatterField[] {\n return droppedFields(data, source, AGENT_DROPPED_FIELDS);\n}\n\nfunction droppedFields(\n data: Readonly<Record<string, string>>,\n source: string,\n fields: readonly string[],\n): readonly DroppedFrontmatterField[] {\n return fields.flatMap((field) => {\n const value = data[field];\n return value === undefined ? [] : [{ file: source, field, value }];\n });\n}\n\nfunction detectEol(source: string): \"\\n\" | \"\\r\\n\" {\n if (!source.includes(\"\\r\\n\")) return \"\\n\";\n const withoutCrlf = source.replaceAll(\"\\r\\n\", \"\");\n if (withoutCrlf.includes(\"\\r\") || withoutCrlf.includes(\"\\n\")) {\n throw new FrontmatterError(\"frontmatter: mixed line endings are not supported\");\n }\n return \"\\r\\n\";\n}\n\nfunction parseBlock(lines: readonly string[]): Record<string, string> {\n const data: Record<string, string> = {};\n\n for (let index = 0; index < lines.length; index += 1) {\n const line = lines[index] as string;\n const trimmed = line.trim();\n if (trimmed === \"\" || trimmed.startsWith(\"#\")) continue;\n if (trimmed !== line) {\n throw new FrontmatterError(`frontmatter: unexpected indented line \"${trimmed}\"`);\n }\n\n const entry = /^([A-Za-z_][A-Za-z0-9_-]*):(.*)$/.exec(line);\n if (entry === null) {\n throw new FrontmatterError(`frontmatter: expected \"key: value\", got \"${line}\"`);\n }\n const key = entry[1] as string;\n const rest = entry[2] as string;\n if (rest !== \"\" && !rest.startsWith(\" \")) {\n throw new FrontmatterError(`frontmatter: missing space after \"${key}:\"`);\n }\n if (Object.hasOwn(data, key)) {\n throw new FrontmatterError(`frontmatter: duplicate key \"${key}\"`);\n }\n\n const raw = rest.trim();\n if (raw === \">\" || raw === \">-\" || raw === \"|\" || raw === \"|-\") {\n const block: string[] = [];\n let cursor = index + 1;\n while (cursor < lines.length) {\n const candidate = lines[cursor] as string;\n if (candidate.trim() !== \"\" && !candidate.startsWith(\" \") && !candidate.startsWith(\"\\t\"))\n break;\n block.push(candidate);\n cursor += 1;\n }\n while (block.length > 0 && (block.at(-1) as string).trim() === \"\") block.pop();\n if (block.length === 0) {\n throw new FrontmatterError(`frontmatter: \"${key}\" has an empty ${raw} block`);\n }\n data[key] = parseBlockScalar(block, raw, key);\n index = cursor - 1;\n continue;\n }\n\n data[key] = parseScalar(raw, key);\n }\n\n return data;\n}\n\nfunction parseScalar(raw: string, key: string): string {\n if (raw === \"\") return \"\";\n if (raw.startsWith('\"')) return parseDoubleQuoted(raw, key);\n if (raw.startsWith(\"'\")) return parseSingleQuoted(raw, key);\n return raw;\n}\n\nfunction parseDoubleQuoted(raw: string, key: string): string {\n if (raw.length < 2 || !raw.endsWith('\"')) {\n throw new FrontmatterError(`frontmatter: unterminated double-quoted value for \"${key}\"`);\n }\n const inner = raw.slice(1, -1);\n let value = \"\";\n for (let index = 0; index < inner.length; index += 1) {\n const character = inner[index] as string;\n if (character !== \"\\\\\") {\n value += character;\n continue;\n }\n const escaped = inner[(index += 1)];\n if (escaped === '\"') value += '\"';\n else if (escaped === \"\\\\\") value += \"\\\\\";\n else if (escaped === \"n\") value += \"\\n\";\n else\n throw new FrontmatterError(\n `frontmatter: unsupported escape \"\\\\${escaped ?? \"\"}\" in \"${key}\"`,\n );\n }\n return value;\n}\n\nfunction parseSingleQuoted(raw: string, key: string): string {\n if (raw.length < 2 || !raw.endsWith(\"'\")) {\n throw new FrontmatterError(`frontmatter: unterminated single-quoted value for \"${key}\"`);\n }\n const inner = raw.slice(1, -1);\n let value = \"\";\n for (let index = 0; index < inner.length; index += 1) {\n const character = inner[index] as string;\n if (character !== \"'\") {\n value += character;\n continue;\n }\n if (inner[index + 1] === \"'\") {\n value += \"'\";\n index += 1;\n continue;\n }\n throw new FrontmatterError(`frontmatter: unescaped single quote in \"${key}\"`);\n }\n return value;\n}\n\nfunction parseBlockScalar(lines: readonly string[], indicator: string, key: string): string {\n const indents = lines\n .filter((line) => line.trim() !== \"\")\n .map((line) => (/^\\s*/.exec(line) as RegExpExecArray)[0].length);\n const indent = Math.min(...indents);\n const content = lines.map((line) => (line.trim() === \"\" ? \"\" : line.slice(indent)));\n\n const text = indicator.startsWith(\"|\") ? content.join(\"\\n\") : fold(content);\n if (text.trim() === \"\") {\n throw new FrontmatterError(`frontmatter: \"${key}\" block is empty`);\n }\n return indicator.endsWith(\"-\") ? text : `${text}\\n`;\n}\n\nfunction fold(lines: readonly string[]): string {\n const paragraphs: string[][] = [[]];\n for (const line of lines) {\n if (line === \"\") paragraphs.push([]);\n else (paragraphs.at(-1) as string[]).push(line);\n }\n return paragraphs.map((paragraph) => paragraph.join(\" \")).join(\"\\n\");\n}\n\nfunction rejectUnknownFields(\n data: Readonly<Record<string, string>>,\n source: string,\n consumed: readonly string[],\n dropped: readonly string[],\n): void {\n const unknown = Object.keys(data).filter(\n (key) => !consumed.includes(key) && !dropped.includes(key),\n );\n if (unknown.length > 0) {\n throw new FrontmatterError(`${source}: unknown frontmatter field(s) ${unknown.join(\", \")}`);\n }\n}\n\nfunction readName(data: Readonly<Record<string, string>>, source: string): string {\n const value = data[\"name\"];\n if (value === undefined || value.trim() === \"\") {\n throw new FrontmatterError(`${source}: missing \"name\"`);\n }\n if (!SKILL_NAME_PATTERN.test(value)) {\n throw new FrontmatterError(`${source}: \"name\" must be kebab-case, got \"${value}\"`);\n }\n if (value.length > MAX_SKILL_NAME_LENGTH) {\n throw new FrontmatterError(\n `${source}: \"name\" is longer than ${MAX_SKILL_NAME_LENGTH} characters`,\n );\n }\n return value;\n}\n\nfunction readDescription(data: Readonly<Record<string, string>>, source: string): string {\n const value = data[\"description\"];\n if (value === undefined || value.trim() === \"\") {\n throw new FrontmatterError(`${source}: missing \"description\"`);\n }\n return value;\n}\n\nfunction readBoolean(\n data: Readonly<Record<string, string>>,\n key: string,\n source: string,\n fallback: boolean,\n): boolean {\n const value = data[key];\n if (value === undefined) return fallback;\n if (value === \"true\") return true;\n if (value === \"false\") return false;\n throw new FrontmatterError(`${source}: \"${key}\" must be true or false, got \"${value}\"`);\n}\n\nfunction formatScalar(value: string): string {\n return needsQuotes(value) ? `\"${escapeDoubleQuoted(value)}\"` : value;\n}\n\nfunction needsQuotes(value: string): boolean {\n if (value === \"\" || value.trim() !== value) return true;\n if (/[\\n\\r\\t]/.test(value)) return true;\n if (/^[-?:,[\\]{}#&*!|>'\"%@`]/.test(value)) return true;\n return /: | #|:$/.test(value);\n}\n\nfunction escapeDoubleQuoted(value: string): string {\n return value\n .replaceAll(\"\\\\\", \"\\\\\\\\\")\n .replaceAll('\"', '\\\\\"')\n .replaceAll(\"\\n\", \"\\\\n\")\n .replaceAll(\"\\r\", \"\\\\r\");\n}\n"],"mappings":";AAiCA,MAAa,wBAAwB;CACnC;CACA;CACA;CACA;CACA;AACF;AAEA,MAAa,uBAAuB;CAAC;CAAQ;CAAS;AAAO;AAE7D,MAAa,wBAAwB,CAAC,QAAQ,aAAa;AAE3D,MAAa,uBAAuB,CAAC,eAAe;AAEpD,MAAa,wBAAwB;AAErC,MAAM,qBAAqB;AAE3B,IAAa,mBAAb,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