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
package/dist/index.mjs CHANGED
@@ -1,172 +1,272 @@
1
- import { n as SKILLS_ROOT, r as SKILLS_ROOT_URL } from "./paths-Bbai4CaT.mjs";
1
+ import { a as SKILLS_ROOT, n as HARNESS_DOC_PATH, r as PACKAGE_ROOT, t as ASSETS_ROOT } from "./paths-D_JlVmBk.mjs";
2
+ import { a as SKILL_CONSUMED_FIELDS, c as parseFrontmatter, d as skillDroppedFields, f as validateAgentFrontmatter, i as MAX_SKILL_NAME_LENGTH, l as serializeAgentFrontmatter, n as AGENT_DROPPED_FIELDS, o as SKILL_DROPPED_FIELDS, p as validateSkillFrontmatter, r as FrontmatterError, s as agentDroppedFields, t as AGENT_CONSUMED_FIELDS, u as serializeSkillFrontmatter } from "./frontmatter-BQX3ekwP.mjs";
3
+ import { join } from "node:path";
2
4
  import { readFileSync, readdirSync } from "node:fs";
3
- import { BUNDLED_SKILL_RANK } from "@deepseek-ai/dsh-skill";
4
- //#region src/frontmatter.ts
5
- const DELIMITER = "---";
6
- function unquote(value) {
7
- const trimmed = value.trim();
8
- if (trimmed.length >= 2) {
9
- const first = trimmed[0];
10
- const last = trimmed[trimmed.length - 1];
11
- if (first === "\"" && last === "\"" || first === "'" && last === "'") {
12
- const inner = trimmed.slice(1, -1);
13
- return first === "\"" ? inner.replace(/\\"/g, "\"").replace(/\\n/g, "\n").replace(/\\\\/g, "\\") : inner.replace(/''/g, "'");
14
- }
5
+ //#region src/provider.ts
6
+ /**
7
+ * The bundled pstack skill provider: one provider over the 55 generated skills
8
+ * that ship inside this package.
9
+ *
10
+ * The provider contract below mirrors `@deepseek-ai/dsh-skill` 0.2.1-rc.3, which
11
+ * was read through the host Inspect provider (`Service.listService` with
12
+ * `service: "skills"`) and the installed type declarations. It is restated here
13
+ * as a structural contract instead of imported so the plugin keeps zero runtime
14
+ * imports from the host packages: a workspace-directory bundle is linked from
15
+ * its checkout, where `@deepseek-ai/*` is not resolvable.
16
+ *
17
+ * Design constraints this module enforces, from the port design document §8.1:
18
+ *
19
+ * - The catalog is built once from the package assets and never watched. A
20
+ * package update is the refresh boundary.
21
+ * - A malformed bundled skill fails the whole index instead of disappearing
22
+ * from the catalog, so a broken asset is a startup error rather than a skill
23
+ * users silently cannot see.
24
+ * - `get()` only accepts a locator this provider produced. Directory names are
25
+ * never joined from caller input.
26
+ */
27
+ /**
28
+ * Standard precedence rank for packaged skill providers, re-exported by
29
+ * `@deepseek-ai/dsh-skill` as `BUNDLED_SKILL_RANK`. Restated to keep the package
30
+ * dependency-free; a mismatch only changes which provider wins a name collision.
31
+ */
32
+ const BUNDLED_SKILL_RANK = 600;
33
+ /** Default provider name used when the row does not override it. */
34
+ const DEFAULT_PROVIDER_NAME = "pstack";
35
+ /** Raised when a bundled asset violates the provider contract. */
36
+ var BundledSkillError = class extends Error {
37
+ constructor(message) {
38
+ super(message);
39
+ this.name = "BundledSkillError";
15
40
  }
16
- return trimmed;
17
- }
18
- function parseFrontmatter(source) {
19
- const normalized = source.replace(/\r\n/g, "\n");
20
- const lines = normalized.split("\n");
21
- if (lines[0]?.trim() !== DELIMITER) return {
22
- data: {},
23
- body: normalized
24
- };
25
- let end = -1;
26
- for (let index = 1; index < lines.length; index += 1) if (lines[index]?.trim() === DELIMITER) {
27
- end = index;
28
- break;
41
+ };
42
+ /**
43
+ * Read and validate every bundled skill below one directory.
44
+ *
45
+ * This is the startup check: it runs before the provider registers, so a missing
46
+ * `SKILL.md`, an invalid frontmatter block, or a name that disagrees with its
47
+ * directory fails plugin activation with a path-qualified message instead of
48
+ * dropping a skill from the catalog.
49
+ *
50
+ * @param skillsRoot - absolute path of the directory holding the skill directories.
51
+ * @returns validated skills keyed by absolute skill directory, sorted by name.
52
+ * @throws {BundledSkillError} when the tree or any skill in it is malformed.
53
+ */
54
+ function loadBundledSkillIndex(skillsRoot) {
55
+ let entries;
56
+ try {
57
+ entries = readdirSync(skillsRoot, { withFileTypes: true });
58
+ } catch (error) {
59
+ throw new BundledSkillError(`bundled skills: cannot read "${skillsRoot}": ${messageOf(error)}`);
29
60
  }
30
- if (end === -1) return {
31
- data: {},
32
- body: normalized
33
- };
34
- const data = {};
35
- let index = 1;
36
- while (index < end) {
37
- const line = lines[index] ?? "";
38
- const match = /^([A-Za-z0-9_-]+):\s*(.*)$/.exec(line);
39
- if (!match) {
40
- index += 1;
41
- continue;
42
- }
43
- const key = match[1];
44
- const rawValue = match[2] ?? "";
45
- index += 1;
46
- if (rawValue === ">" || rawValue === ">-" || rawValue === "|" || rawValue === "|-") {
47
- const folded = rawValue.startsWith(">");
48
- const collected = [];
49
- while (index < end) {
50
- const next = lines[index] ?? "";
51
- if (next.trim() !== "" && !/^\s/.test(next)) break;
52
- collected.push(next.replace(/^\s{1,4}/, ""));
53
- index += 1;
54
- }
55
- data[key] = folded ? collected.join(" ").replace(/\s+/g, " ").trim() : collected.join("\n").replace(/\n+$/, "");
56
- continue;
57
- }
58
- if (rawValue === "") {
59
- const collected = [];
60
- while (index < end) {
61
- const next = lines[index] ?? "";
62
- if (next.trim() !== "" && !/^\s/.test(next)) break;
63
- collected.push(next.trim());
64
- index += 1;
65
- }
66
- data[key] = collected.join(" ").trim();
67
- continue;
68
- }
69
- data[key] = unquote(rawValue);
61
+ const index = /* @__PURE__ */ new Map();
62
+ for (const entry of entries.sort((left, right) => left.name < right.name ? -1 : 1)) {
63
+ const directory = join(skillsRoot, entry.name);
64
+ if (!entry.isDirectory()) throw new BundledSkillError(`bundled skills: "${directory}" is not a skill directory; remove it or add a SKILL.md`);
65
+ const instructionFile = join(directory, "SKILL.md");
66
+ const frontmatter = readSkillFrontmatter(readSkillFile(instructionFile), instructionFile);
67
+ if (frontmatter.name !== entry.name) throw new BundledSkillError(`${instructionFile}: skill name "${frontmatter.name}" does not match its directory "${entry.name}"`);
68
+ index.set(directory, {
69
+ name: frontmatter.name,
70
+ description: frontmatter.description,
71
+ ...frontmatter.whenToUse === void 0 ? {} : { whenToUse: frontmatter.whenToUse },
72
+ invocation: {
73
+ modelInvocable: !frontmatter.disableModelInvocation,
74
+ userInvocable: frontmatter.userInvocable
75
+ },
76
+ directory,
77
+ instructionFile
78
+ });
70
79
  }
71
- return {
72
- data,
73
- body: lines.slice(end + 1).join("\n").replace(/^\n+/, "")
74
- };
80
+ if (index.size === 0) throw new BundledSkillError(`bundled skills: no skill directories under "${skillsRoot}"`);
81
+ return index;
75
82
  }
76
- //#endregion
77
- //#region src/provider.ts
78
83
  /**
79
- * Bundled pstack skill provider.
84
+ * Build the provider over an already validated index.
80
85
  *
81
- * One provider hosts every pstack skill so the catalog stays one entry per
82
- * skill and the package ships as a single installable bundle. The provider is
83
- * immutable: `assets/skills/` is generated at build time, so discovery always
84
- * completes with the same list.
86
+ * @param index - result of {@link loadBundledSkillIndex}.
87
+ * @param providerName - registry name for this provider.
88
+ * @returns a read-only provider whose catalog never changes until the package does.
85
89
  */
86
- const PROVIDER_NAME = "pstack";
87
- function text(value) {
88
- return (value ?? "").trim();
90
+ function createPstackSkillProvider(index, providerName = DEFAULT_PROVIDER_NAME) {
91
+ const ordered = [...index.values()].sort((left, right) => left.name < right.name ? -1 : left.name > right.name ? 1 : 0);
92
+ return {
93
+ name: providerName,
94
+ async list(options) {
95
+ throwIfAborted(options?.signal);
96
+ return ordered.map((skill) => ({
97
+ name: skill.name,
98
+ description: skill.description,
99
+ ...skill.whenToUse === void 0 ? {} : { whenToUse: skill.whenToUse },
100
+ invocation: skill.invocation,
101
+ source: "bundled",
102
+ provider: providerName,
103
+ rank: 600,
104
+ locator: {
105
+ kind: "bundled-skill",
106
+ directory: skill.directory,
107
+ instructionFile: skill.instructionFile
108
+ },
109
+ path: skill.instructionFile,
110
+ resourceBase: {
111
+ kind: "directory",
112
+ path: skill.directory
113
+ }
114
+ }));
115
+ },
116
+ async get(candidate, options) {
117
+ const locator = asBundledSkillLocator(candidate.locator);
118
+ if (locator === void 0) return void 0;
119
+ const skill = index.get(locator.directory);
120
+ if (skill === void 0 || skill.instructionFile !== locator.instructionFile || skill.name !== candidate.name) return;
121
+ throwIfAborted(options?.signal);
122
+ const text = readOptionalSkillFile(skill.instructionFile);
123
+ if (text === void 0) return void 0;
124
+ const { body } = parseFrontmatter(text);
125
+ return {
126
+ name: skill.name,
127
+ description: skill.description,
128
+ ...skill.whenToUse === void 0 ? {} : { whenToUse: skill.whenToUse },
129
+ invocation: skill.invocation,
130
+ source: "bundled",
131
+ provider: providerName,
132
+ path: skill.instructionFile,
133
+ resourceBase: {
134
+ kind: "directory",
135
+ path: skill.directory
136
+ },
137
+ content: body
138
+ };
139
+ }
140
+ };
89
141
  }
90
142
  /**
91
- * Parse one generated SKILL.md into the catalog entry the provider serves.
92
- * Generated files always carry `name` and `description`; a hand-edit that
93
- * removes them fails loudly instead of silently dropping the skill.
143
+ * Load the index and build the provider in one step, failing on a malformed tree.
144
+ *
145
+ * `apply()` uses this exact function, so the startup failure path and the
146
+ * provider used in tests are the same code.
147
+ *
148
+ * @param skillsRoot - absolute path of the bundled skill root.
149
+ * @param providerName - registry name for this provider.
150
+ * @returns the provider over the validated index.
94
151
  */
95
- function toEntry(directory, source) {
96
- const { data } = parseFrontmatter(source);
97
- if (!text(data.name) || !text(data.description)) throw new Error(`pstack skill "${directory}" is missing name or description frontmatter`);
98
- return {
99
- name: text(data.name),
100
- description: text(data.description),
101
- modelInvocable: data["disable-model-invocation"] !== "true",
102
- userInvocable: data["user-invocable"] !== "false",
103
- directory
104
- };
152
+ function createPstackSkillProviderFromRoot(skillsRoot, providerName = DEFAULT_PROVIDER_NAME) {
153
+ return createPstackSkillProvider(loadBundledSkillIndex(skillsRoot), providerName);
105
154
  }
106
- function resourceBase(directory) {
155
+ function asBundledSkillLocator(locator) {
156
+ if (typeof locator !== "object" || locator === null) return void 0;
157
+ const candidate = locator;
158
+ if (candidate.kind !== "bundled-skill") return void 0;
159
+ if (typeof candidate.directory !== "string") return void 0;
160
+ if (typeof candidate.instructionFile !== "string") return void 0;
107
161
  return {
108
- kind: "directory",
109
- path: `${SKILLS_ROOT}${directory}/`
162
+ kind: "bundled-skill",
163
+ directory: candidate.directory,
164
+ instructionFile: candidate.instructionFile
110
165
  };
111
166
  }
112
- function toCandidate(entry) {
113
- return {
114
- name: entry.name,
115
- description: entry.description,
116
- invocation: {
117
- modelInvocable: entry.modelInvocable,
118
- userInvocable: entry.userInvocable
119
- },
120
- provider: PROVIDER_NAME,
121
- source: "bundled",
122
- rank: BUNDLED_SKILL_RANK,
123
- resourceBase: resourceBase(entry.directory),
124
- locator: entry.directory,
125
- path: `${SKILLS_ROOT}${entry.directory}/SKILL.md`
126
- };
167
+ function readSkillFile(instructionFile) {
168
+ try {
169
+ return readFileSync(instructionFile, "utf8");
170
+ } catch (error) {
171
+ throw new BundledSkillError(`bundled skills: cannot read "${instructionFile}": ${messageOf(error)}`);
172
+ }
127
173
  }
128
- function createProvider(options) {
129
- const read = options.read ?? ((directory) => readFileSync(`${SKILLS_ROOT}${directory}/SKILL.md`, "utf8"));
130
- const entries = options.directories.map((directory) => toEntry(directory, read(directory)));
131
- const byName = new Map(entries.map((entry) => [entry.name, entry]));
132
- const load = (entry) => {
133
- const { body } = parseFrontmatter(read(entry.directory));
134
- return {
135
- name: entry.name,
136
- description: entry.description,
137
- invocation: {
138
- modelInvocable: entry.modelInvocable,
139
- userInvocable: entry.userInvocable
140
- },
141
- provider: PROVIDER_NAME,
142
- source: "bundled",
143
- resourceBase: resourceBase(entry.directory),
144
- path: `${SKILLS_ROOT}${entry.directory}/SKILL.md`,
145
- content: body
146
- };
147
- };
148
- return {
149
- name: PROVIDER_NAME,
150
- list: async () => entries.map(toCandidate),
151
- get: async (candidate) => {
152
- const entry = byName.get(candidate.name);
153
- return entry ? load(entry) : void 0;
154
- }
155
- };
174
+ /** Parse and validate one skill header, reporting failures as bundled-asset errors. */
175
+ function readSkillFrontmatter(text, instructionFile) {
176
+ try {
177
+ const { data } = parseFrontmatter(text);
178
+ return validateSkillFrontmatter(data, instructionFile);
179
+ } catch (error) {
180
+ const message = messageOf(error);
181
+ throw new BundledSkillError(message.includes(instructionFile) ? message : `${instructionFile}: ${message}`);
182
+ }
183
+ }
184
+ function readOptionalSkillFile(instructionFile) {
185
+ try {
186
+ return readFileSync(instructionFile, "utf8");
187
+ } catch (error) {
188
+ if (errorCode(error) === "ENOENT") return void 0;
189
+ throw error;
190
+ }
191
+ }
192
+ function throwIfAborted(signal) {
193
+ if (signal?.aborted !== true) return;
194
+ throw signal.reason ?? /* @__PURE__ */ new Error("skill provider work was aborted");
195
+ }
196
+ function errorCode(error) {
197
+ if (typeof error !== "object" || error === null) return void 0;
198
+ const code = error.code;
199
+ return typeof code === "string" ? code : void 0;
156
200
  }
201
+ function messageOf(error) {
202
+ return error instanceof Error ? error.message : String(error);
203
+ }
204
+ //#endregion
205
+ //#region src/index.ts
206
+ /**
207
+ * dsh-pstack Host entry.
208
+ *
209
+ * Unit 2 ships one minimal capability: a single `ctx.skills` provider over the
210
+ * generated assets in this package. Delegation, restricted history, roles, and
211
+ * the worktree integration are later units and are deliberately absent here.
212
+ *
213
+ * The provider contract types live in `./provider.ts` and are structural copies
214
+ * of the `@deepseek-ai/dsh-skill` 0.2.1-rc.3 declarations, so this module imports
215
+ * nothing from the host packages at runtime.
216
+ */
217
+ /** Plugin name used by Loader diagnostics for this row. */
157
218
  const name = "pstack";
219
+ /** The provider needs the skill registry and nothing else. */
158
220
  const inject = ["skills"];
159
- function listBundledSkillDirectories() {
160
- return readdirSync(SKILLS_ROOT, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort();
161
- }
221
+ /**
222
+ * Minimal Standard Schema validator for this plugin's row config.
223
+ *
224
+ * Cordis validates `apply()`'s second argument with `Config["~standard"]` and
225
+ * substitutes the returned `value`, so an omitted row `config` resolves to the
226
+ * documented defaults without a schemastery dependency.
227
+ */
228
+ const Config = { "~standard": {
229
+ version: 1,
230
+ vendor: "dsh-pstack",
231
+ validate(value) {
232
+ if (value === void 0 || value === null) return { value: { providerName: DEFAULT_PROVIDER_NAME } };
233
+ if (typeof value !== "object" || Array.isArray(value)) return { issues: [{ message: "config must be a mapping" }] };
234
+ const issues = [];
235
+ const record = value;
236
+ for (const key of Object.keys(record)) if (key !== "providerName") issues.push({
237
+ message: `unknown field "${key}"`,
238
+ path: [key]
239
+ });
240
+ const providerName = record["providerName"];
241
+ if (providerName === void 0) return issues.length > 0 ? { issues } : { value: { providerName: DEFAULT_PROVIDER_NAME } };
242
+ if (typeof providerName !== "string" || providerName.trim() === "") {
243
+ issues.push({
244
+ message: "providerName must be a non-empty string",
245
+ path: ["providerName"]
246
+ });
247
+ return { issues };
248
+ }
249
+ return issues.length > 0 ? { issues } : { value: { providerName } };
250
+ }
251
+ } };
252
+ /**
253
+ * Register the bundled pstack skill provider.
254
+ *
255
+ * The bundled tree is validated before the provider registers, so a malformed
256
+ * `SKILL.md` fails plugin activation with a path-qualified error instead of
257
+ * removing one skill from the catalog. Nothing is copied out of the package and
258
+ * nothing is watched: reinstalling the package is the refresh boundary.
259
+ *
260
+ * @param ctx - host context carrying the skill registry.
261
+ * @param config - validated row config.
262
+ * @throws {import("./provider.ts").BundledSkillError} when the bundled tree is malformed.
263
+ */
162
264
  function apply(ctx, config = {}) {
163
- const directories = [.../* @__PURE__ */ new Set([...listBundledSkillDirectories(), ...config.extraSkillDirectories ?? []])];
164
- ctx.skills.registerProvider(() => createProvider({ directories }));
265
+ const providerName = config.providerName ?? "pstack";
266
+ const index = loadBundledSkillIndex(SKILLS_ROOT);
267
+ ctx.skills.registerProvider((_control) => createPstackSkillProvider(index, providerName));
165
268
  }
166
- /** Absolute root of the generated skill tree, exported for doctor checks. */
167
- const skillsRoot = SKILLS_ROOT;
168
- const skillsRootUrl = SKILLS_ROOT_URL;
169
269
  //#endregion
170
- export { apply, inject, name, skillsRoot, skillsRootUrl };
270
+ export { AGENT_CONSUMED_FIELDS, AGENT_DROPPED_FIELDS, ASSETS_ROOT, BUNDLED_SKILL_RANK, BundledSkillError, Config, DEFAULT_PROVIDER_NAME, FrontmatterError, HARNESS_DOC_PATH, MAX_SKILL_NAME_LENGTH, PACKAGE_ROOT, SKILLS_ROOT, SKILL_CONSUMED_FIELDS, SKILL_DROPPED_FIELDS, agentDroppedFields, apply, createPstackSkillProvider, createPstackSkillProviderFromRoot, inject, loadBundledSkillIndex, name, parseFrontmatter, serializeAgentFrontmatter, serializeSkillFrontmatter, skillDroppedFields, validateAgentFrontmatter, validateSkillFrontmatter };
171
271
 
172
272
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/frontmatter.ts","../src/provider.ts"],"sourcesContent":["/**\n * The pstack SKILL.md frontmatter subset: plain scalars, quoted scalars, and\n * folded or literal block scalars. Kept dependency-free so the plugin can be\n * imported at boot before any optional parser is available.\n */\n\nexport interface Frontmatter {\n data: Record<string, string>;\n body: string;\n}\n\nconst DELIMITER = \"---\";\n\nfunction unquote(value: string): string {\n const trimmed = value.trim();\n if (trimmed.length >= 2) {\n const first = trimmed[0];\n const last = trimmed[trimmed.length - 1];\n if ((first === '\"' && last === '\"') || (first === \"'\" && last === \"'\")) {\n const inner = trimmed.slice(1, -1);\n return first === '\"'\n ? inner.replace(/\\\\\"/g, '\"').replace(/\\\\n/g, \"\\n\").replace(/\\\\\\\\/g, \"\\\\\")\n : inner.replace(/''/g, \"'\");\n }\n }\n return trimmed;\n}\n\nexport function parseFrontmatter(source: string): Frontmatter {\n const normalized = source.replace(/\\r\\n/g, \"\\n\");\n const lines = normalized.split(\"\\n\");\n if (lines[0]?.trim() !== DELIMITER) return { data: {}, body: normalized };\n\n let end = -1;\n for (let index = 1; index < lines.length; index += 1) {\n if (lines[index]?.trim() === DELIMITER) {\n end = index;\n break;\n }\n }\n if (end === -1) return { data: {}, body: normalized };\n\n const data: Record<string, string> = {};\n let index = 1;\n while (index < end) {\n const line = lines[index] ?? \"\";\n const match = /^([A-Za-z0-9_-]+):\\s*(.*)$/.exec(line);\n if (!match) {\n index += 1;\n continue;\n }\n const key = match[1]!;\n const rawValue = match[2] ?? \"\";\n index += 1;\n\n if (rawValue === \">\" || rawValue === \">-\" || rawValue === \"|\" || rawValue === \"|-\") {\n const folded = rawValue.startsWith(\">\");\n const collected: string[] = [];\n while (index < end) {\n const next = lines[index] ?? \"\";\n if (next.trim() !== \"\" && !/^\\s/.test(next)) break;\n collected.push(next.replace(/^\\s{1,4}/, \"\"));\n index += 1;\n }\n data[key] = folded\n ? collected.join(\" \").replace(/\\s+/g, \" \").trim()\n : collected.join(\"\\n\").replace(/\\n+$/, \"\");\n continue;\n }\n\n if (rawValue === \"\") {\n const collected: string[] = [];\n while (index < end) {\n const next = lines[index] ?? \"\";\n if (next.trim() !== \"\" && !/^\\s/.test(next)) break;\n collected.push(next.trim());\n index += 1;\n }\n data[key] = collected.join(\" \").trim();\n continue;\n }\n\n data[key] = unquote(rawValue);\n }\n\n return {\n data,\n body: lines\n .slice(end + 1)\n .join(\"\\n\")\n .replace(/^\\n+/, \"\"),\n };\n}\n","/**\n * Bundled pstack skill provider.\n *\n * One provider hosts every pstack skill so the catalog stays one entry per\n * skill and the package ships as a single installable bundle. The provider is\n * immutable: `assets/skills/` is generated at build time, so discovery always\n * completes with the same list.\n */\nimport { readdirSync, readFileSync } from \"node:fs\";\nimport type { Context } from \"@deepseek-ai/cordis\";\nimport {\n BUNDLED_SKILL_RANK,\n type SkillCandidate,\n type SkillDefinition,\n type SkillProvider,\n} from \"@deepseek-ai/dsh-skill\";\nimport { parseFrontmatter } from \"./frontmatter.ts\";\nimport { SKILLS_ROOT, SKILLS_ROOT_URL } from \"./paths.ts\";\n\nexport interface PstackSkillEntry {\n readonly name: string;\n readonly description: string;\n readonly modelInvocable: boolean;\n readonly userInvocable: boolean;\n readonly directory: string;\n}\n\nexport const PROVIDER_NAME = \"pstack\";\n\nfunction text(value: string | undefined): string {\n return (value ?? \"\").trim();\n}\n\n/**\n * Parse one generated SKILL.md into the catalog entry the provider serves.\n * Generated files always carry `name` and `description`; a hand-edit that\n * removes them fails loudly instead of silently dropping the skill.\n */\nexport function toEntry(directory: string, source: string): PstackSkillEntry {\n const { data } = parseFrontmatter(source);\n if (!text(data.name) || !text(data.description)) {\n throw new Error(`pstack skill \"${directory}\" is missing name or description frontmatter`);\n }\n return {\n name: text(data.name),\n description: text(data.description),\n modelInvocable: data[\"disable-model-invocation\"] !== \"true\",\n userInvocable: data[\"user-invocable\"] !== \"false\",\n directory,\n };\n}\n\nfunction resourceBase(directory: string) {\n return { kind: \"directory\" as const, path: `${SKILLS_ROOT}${directory}/` };\n}\n\nexport function toCandidate(entry: PstackSkillEntry): SkillCandidate {\n return {\n name: entry.name,\n description: entry.description,\n invocation: { modelInvocable: entry.modelInvocable, userInvocable: entry.userInvocable },\n provider: PROVIDER_NAME,\n source: \"bundled\",\n rank: BUNDLED_SKILL_RANK,\n resourceBase: resourceBase(entry.directory),\n locator: entry.directory,\n path: `${SKILLS_ROOT}${entry.directory}/SKILL.md`,\n };\n}\n\nexport interface PstackProviderOptions {\n /** Directory names to serve. The build passes the generated list. */\n readonly directories: readonly string[];\n /** Reads one skill body. Tests override it to avoid touching the package. */\n readonly read?: (directory: string) => string;\n}\n\nexport function createProvider(options: PstackProviderOptions): SkillProvider {\n const read =\n options.read ??\n ((directory: string) => readFileSync(`${SKILLS_ROOT}${directory}/SKILL.md`, \"utf8\"));\n const entries = options.directories.map((directory) => toEntry(directory, read(directory)));\n const byName = new Map(entries.map((entry) => [entry.name, entry]));\n\n const load = (entry: PstackSkillEntry): SkillDefinition => {\n const { body } = parseFrontmatter(read(entry.directory));\n return {\n name: entry.name,\n description: entry.description,\n invocation: { modelInvocable: entry.modelInvocable, userInvocable: entry.userInvocable },\n provider: PROVIDER_NAME,\n source: \"bundled\",\n resourceBase: resourceBase(entry.directory),\n path: `${SKILLS_ROOT}${entry.directory}/SKILL.md`,\n content: body,\n };\n };\n\n return {\n name: PROVIDER_NAME,\n list: async () => entries.map(toCandidate),\n get: async (candidate) => {\n const entry = byName.get(candidate.name);\n return entry ? load(entry) : undefined;\n },\n };\n}\n\nexport const name = \"pstack\";\n\nexport interface Config {\n /** Extra skill directories to serve in addition to the bundled set. */\n readonly extraSkillDirectories?: string[];\n}\n\nexport const inject = [\"skills\"];\n\nexport function listBundledSkillDirectories(): string[] {\n return readdirSync(SKILLS_ROOT, { withFileTypes: true })\n .filter((entry) => entry.isDirectory())\n .map((entry) => entry.name)\n .sort();\n}\n\nexport function apply(ctx: Context, config: Config = {}): void {\n const directories = [\n ...new Set([...listBundledSkillDirectories(), ...(config.extraSkillDirectories ?? [])]),\n ];\n ctx.skills.registerProvider(() => createProvider({ directories }));\n}\n\n/** Absolute root of the generated skill tree, exported for doctor checks. */\nexport const skillsRoot = SKILLS_ROOT;\nexport const skillsRootUrl = SKILLS_ROOT_URL;\n"],"mappings":";;;;AAWA,MAAM,YAAY;AAElB,SAAS,QAAQ,OAAuB;CACtC,MAAM,UAAU,MAAM,KAAK;CAC3B,IAAI,QAAQ,UAAU,GAAG;EACvB,MAAM,QAAQ,QAAQ;EACtB,MAAM,OAAO,QAAQ,QAAQ,SAAS;EACtC,IAAK,UAAU,QAAO,SAAS,QAAS,UAAU,OAAO,SAAS,KAAM;GACtE,MAAM,QAAQ,QAAQ,MAAM,GAAG,EAAE;GACjC,OAAO,UAAU,OACb,MAAM,QAAQ,QAAQ,IAAG,CAAC,CAAC,QAAQ,QAAQ,IAA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a;AAC1B,MAAa,gBAAgB"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/provider.ts","../src/index.ts"],"sourcesContent":["/**\n * The bundled pstack skill provider: one provider over the 55 generated skills\n * that ship inside this package.\n *\n * The provider contract below mirrors `@deepseek-ai/dsh-skill` 0.2.1-rc.3, which\n * was read through the host Inspect provider (`Service.listService` with\n * `service: \"skills\"`) and the installed type declarations. It is restated here\n * as a structural contract instead of imported so the plugin keeps zero runtime\n * imports from the host packages: a workspace-directory bundle is linked from\n * its checkout, where `@deepseek-ai/*` is not resolvable.\n *\n * Design constraints this module enforces, from the port design document §8.1:\n *\n * - The catalog is built once from the package assets and never watched. A\n * package update is the refresh boundary.\n * - A malformed bundled skill fails the whole index instead of disappearing\n * from the catalog, so a broken asset is a startup error rather than a skill\n * users silently cannot see.\n * - `get()` only accepts a locator this provider produced. Directory names are\n * never joined from caller input.\n */\n\nimport { readFileSync, readdirSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\nimport { parseFrontmatter, validateSkillFrontmatter } from \"./frontmatter.ts\";\n\n/**\n * Standard precedence rank for packaged skill providers, re-exported by\n * `@deepseek-ai/dsh-skill` as `BUNDLED_SKILL_RANK`. Restated to keep the package\n * dependency-free; a mismatch only changes which provider wins a name collision.\n */\nexport const BUNDLED_SKILL_RANK = 600;\n\n/** Default provider name used when the row does not override it. */\nexport const DEFAULT_PROVIDER_NAME = \"pstack\";\n\n/** Origin bucket for a skill contribution. */\nexport type SkillSource =\n | \"project-dsh\"\n | \"project-agents\"\n | \"runtime\"\n | \"user-dsh\"\n | \"user-agents\"\n | \"custom\"\n | \"bundled\"\n | (string & {});\n\n/** Optional provider-specific base used by loaded skill bodies to resolve relative resources. */\nexport type SkillResourceBase =\n | { readonly kind: \"directory\"; readonly path: string }\n | { readonly kind: \"url\"; readonly url: string }\n | { readonly kind: \"opaque\"; readonly description: string };\n\n/** Invocation controls shared by skill discovery consumers. */\nexport interface SkillInvocationPolicy {\n /** Whether model-facing catalogs and loaders include this skill. */\n readonly modelInvocable: boolean;\n /** Whether human-facing command catalogs and loaders include this skill. */\n readonly userInvocable: boolean;\n}\n\n/** Invocation-neutral skill metadata returned by `ctx.skills.list()`. */\nexport interface SkillSummary {\n /** Absolute instruction file path. */\n readonly path?: string;\n /** Kebab-case identifier used to address the skill. */\n readonly name: string;\n /** Short routing description shown by discovery consumers. */\n readonly description: string;\n /** Optional extra routing guidance. */\n readonly whenToUse?: string;\n /** Resolved model and user invocation controls. */\n readonly invocation: SkillInvocationPolicy;\n /** Discovery source that produced this skill. */\n readonly source: SkillSource;\n /** Provider that owns this skill body. */\n readonly provider: string;\n /** Provider-specific base for relative resources. */\n readonly resourceBase?: SkillResourceBase;\n}\n\n/** Provider catalog entry used by the registry to merge and later load skills. */\nexport interface SkillCandidate extends SkillSummary {\n /** Lower ranks win duplicate skill names. */\n readonly rank: number;\n /** Opaque provider-owned handle passed back to `provider.get()`. */\n readonly locator: unknown;\n /** Parsed optional metadata object from provider-specific skill frontmatter. */\n readonly metadata?: Readonly<Record<string, unknown>>;\n}\n\n/** Complete parsed skill definition, including the body loaded by `ctx.skills.get()`. */\nexport interface SkillDefinition extends SkillSummary {\n /** Markdown instruction body after frontmatter removal. */\n readonly content: string;\n /** Parsed optional metadata object from frontmatter. */\n readonly metadata?: Readonly<Record<string, unknown>>;\n}\n\n/** Caller context used for cwd-sensitive and abortable provider work. */\nexport interface SkillLookupOptions {\n /** Workspace selector for the current lookup. */\n readonly cwd?: string | undefined;\n /** Abort discovery or loading work for the current caller. */\n readonly signal?: AbortSignal | undefined;\n}\n\n/** Registration-scoped lifecycle capability handed to a provider factory. */\nexport interface SkillProviderControl {\n /** Aborts when registration fails or the exact provider registration is disposed. */\n readonly signal: AbortSignal;\n /** Invalidate completed catalogs and notify consumers. */\n readonly invalidate: () => void;\n}\n\n/** Provider interface for one source of skills. */\nexport interface SkillProvider {\n /** Unique provider name in the `ctx.skills` registry. */\n readonly name: string;\n /** List available skill candidates for the current lookup context. */\n readonly list: (options: SkillLookupOptions) => Promise<readonly SkillCandidate[]>;\n /** Load a complete skill body for a previously listed candidate. */\n readonly get: (\n candidate: SkillCandidate,\n options: SkillLookupOptions,\n ) => Promise<SkillDefinition | undefined>;\n}\n\n/** Opaque handle this provider hands back to itself; never derived from caller input. */\ninterface BundledSkillLocator {\n readonly kind: \"bundled-skill\";\n /** Absolute skill directory that also serves as the resource base. */\n readonly directory: string;\n /** Absolute `SKILL.md` path read by `get()`. */\n readonly instructionFile: string;\n}\n\n/** One validated on-disk bundled skill. */\nexport interface BundledSkill {\n readonly name: string;\n readonly description: string;\n readonly whenToUse?: string;\n readonly invocation: SkillInvocationPolicy;\n /** Absolute skill directory; the candidate resource base. */\n readonly directory: string;\n /** Absolute `SKILL.md` path. */\n readonly instructionFile: string;\n}\n\n/** Validated skills keyed by their absolute directory. */\nexport type BundledSkillIndex = ReadonlyMap<string, BundledSkill>;\n\n/** Raised when a bundled asset violates the provider contract. */\nexport class BundledSkillError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"BundledSkillError\";\n }\n}\n\n/**\n * Read and validate every bundled skill below one directory.\n *\n * This is the startup check: it runs before the provider registers, so a missing\n * `SKILL.md`, an invalid frontmatter block, or a name that disagrees with its\n * directory fails plugin activation with a path-qualified message instead of\n * dropping a skill from the catalog.\n *\n * @param skillsRoot - absolute path of the directory holding the skill directories.\n * @returns validated skills keyed by absolute skill directory, sorted by name.\n * @throws {BundledSkillError} when the tree or any skill in it is malformed.\n */\nexport function loadBundledSkillIndex(skillsRoot: string): BundledSkillIndex {\n let entries;\n try {\n entries = readdirSync(skillsRoot, { withFileTypes: true });\n } catch (error) {\n throw new BundledSkillError(\n `bundled skills: cannot read \"${skillsRoot}\": ${messageOf(error)}`,\n );\n }\n\n const index = new Map<string, BundledSkill>();\n\n for (const entry of entries.sort((left, right) => (left.name < right.name ? -1 : 1))) {\n const directory = join(skillsRoot, entry.name);\n if (!entry.isDirectory()) {\n throw new BundledSkillError(\n `bundled skills: \"${directory}\" is not a skill directory; remove it or add a SKILL.md`,\n );\n }\n\n const instructionFile = join(directory, \"SKILL.md\");\n const text = readSkillFile(instructionFile);\n const frontmatter = readSkillFrontmatter(text, instructionFile);\n\n if (frontmatter.name !== entry.name) {\n throw new BundledSkillError(\n `${instructionFile}: skill name \"${frontmatter.name}\" does not match its directory \"${entry.name}\"`,\n );\n }\n\n index.set(directory, {\n name: frontmatter.name,\n description: frontmatter.description,\n ...(frontmatter.whenToUse === undefined ? {} : { whenToUse: frontmatter.whenToUse }),\n invocation: {\n modelInvocable: !frontmatter.disableModelInvocation,\n userInvocable: frontmatter.userInvocable,\n },\n directory,\n instructionFile,\n });\n }\n\n if (index.size === 0) {\n throw new BundledSkillError(`bundled skills: no skill directories under \"${skillsRoot}\"`);\n }\n\n return index;\n}\n\n/**\n * Build the provider over an already validated index.\n *\n * @param index - result of {@link loadBundledSkillIndex}.\n * @param providerName - registry name for this provider.\n * @returns a read-only provider whose catalog never changes until the package does.\n */\nexport function createPstackSkillProvider(\n index: BundledSkillIndex,\n providerName: string = DEFAULT_PROVIDER_NAME,\n): SkillProvider {\n const ordered = [...index.values()].sort((left, right) =>\n left.name < right.name ? -1 : left.name > right.name ? 1 : 0,\n );\n\n return {\n name: providerName,\n\n async list(options) {\n throwIfAborted(options?.signal);\n return ordered.map(\n (skill): SkillCandidate => ({\n name: skill.name,\n description: skill.description,\n ...(skill.whenToUse === undefined ? {} : { whenToUse: skill.whenToUse }),\n invocation: skill.invocation,\n source: \"bundled\",\n provider: providerName,\n rank: BUNDLED_SKILL_RANK,\n locator: {\n kind: \"bundled-skill\",\n directory: skill.directory,\n instructionFile: skill.instructionFile,\n } satisfies BundledSkillLocator,\n path: skill.instructionFile,\n resourceBase: { kind: \"directory\", path: skill.directory },\n }),\n );\n },\n\n async get(candidate, options) {\n const locator = asBundledSkillLocator(candidate.locator);\n if (locator === undefined) return undefined;\n\n const skill = index.get(locator.directory);\n if (\n skill === undefined ||\n skill.instructionFile !== locator.instructionFile ||\n skill.name !== candidate.name\n ) {\n return undefined;\n }\n\n throwIfAborted(options?.signal);\n\n const text = readOptionalSkillFile(skill.instructionFile);\n if (text === undefined) return undefined;\n const { body } = parseFrontmatter(text);\n\n return {\n name: skill.name,\n description: skill.description,\n ...(skill.whenToUse === undefined ? {} : { whenToUse: skill.whenToUse }),\n invocation: skill.invocation,\n source: \"bundled\",\n provider: providerName,\n path: skill.instructionFile,\n resourceBase: { kind: \"directory\", path: skill.directory },\n content: body,\n };\n },\n };\n}\n\n/**\n * Load the index and build the provider in one step, failing on a malformed tree.\n *\n * `apply()` uses this exact function, so the startup failure path and the\n * provider used in tests are the same code.\n *\n * @param skillsRoot - absolute path of the bundled skill root.\n * @param providerName - registry name for this provider.\n * @returns the provider over the validated index.\n */\nexport function createPstackSkillProviderFromRoot(\n skillsRoot: string,\n providerName: string = DEFAULT_PROVIDER_NAME,\n): SkillProvider {\n return createPstackSkillProvider(loadBundledSkillIndex(skillsRoot), providerName);\n}\n\nfunction asBundledSkillLocator(locator: unknown): BundledSkillLocator | undefined {\n if (typeof locator !== \"object\" || locator === null) return undefined;\n const candidate = locator as Partial<BundledSkillLocator>;\n if (candidate.kind !== \"bundled-skill\") return undefined;\n if (typeof candidate.directory !== \"string\") return undefined;\n if (typeof candidate.instructionFile !== \"string\") return undefined;\n return {\n kind: \"bundled-skill\",\n directory: candidate.directory,\n instructionFile: candidate.instructionFile,\n };\n}\n\nfunction readSkillFile(instructionFile: string): string {\n try {\n return readFileSync(instructionFile, \"utf8\");\n } catch (error) {\n throw new BundledSkillError(\n `bundled skills: cannot read \"${instructionFile}\": ${messageOf(error)}`,\n );\n }\n}\n\n/** Parse and validate one skill header, reporting failures as bundled-asset errors. */\nfunction readSkillFrontmatter(\n text: string,\n instructionFile: string,\n): ReturnType<typeof validateSkillFrontmatter> {\n try {\n const { data } = parseFrontmatter(text);\n return validateSkillFrontmatter(data, instructionFile);\n } catch (error) {\n const message = messageOf(error);\n throw new BundledSkillError(\n message.includes(instructionFile) ? message : `${instructionFile}: ${message}`,\n );\n }\n}\n\nfunction readOptionalSkillFile(instructionFile: string): string | undefined {\n try {\n return readFileSync(instructionFile, \"utf8\");\n } catch (error) {\n if (errorCode(error) === \"ENOENT\") return undefined;\n throw error;\n }\n}\n\nfunction throwIfAborted(signal: AbortSignal | undefined): void {\n if (signal?.aborted !== true) return;\n throw signal.reason ?? new Error(\"skill provider work was aborted\");\n}\n\nfunction errorCode(error: unknown): string | undefined {\n if (typeof error !== \"object\" || error === null) return undefined;\n const code = (error as { code?: unknown }).code;\n return typeof code === \"string\" ? code : undefined;\n}\n\nfunction messageOf(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n","/**\n * dsh-pstack Host entry.\n *\n * Unit 2 ships one minimal capability: a single `ctx.skills` provider over the\n * generated assets in this package. Delegation, restricted history, roles, and\n * the worktree integration are later units and are deliberately absent here.\n *\n * The provider contract types live in `./provider.ts` and are structural copies\n * of the `@deepseek-ai/dsh-skill` 0.2.1-rc.3 declarations, so this module imports\n * nothing from the host packages at runtime.\n */\n\nimport { SKILLS_ROOT } from \"./paths.ts\";\nimport {\n DEFAULT_PROVIDER_NAME,\n createPstackSkillProvider,\n loadBundledSkillIndex,\n} from \"./provider.ts\";\nimport type { SkillProvider, SkillProviderControl } from \"./provider.ts\";\n\n/** Plugin name used by Loader diagnostics for this row. */\nexport const name = \"pstack\";\n\n/** The provider needs the skill registry and nothing else. */\nexport const inject = [\"skills\"];\n\n/** Row configuration. Every field is optional; an omitted `config` is valid. */\nexport interface PstackConfig {\n /** Registry name for the provider; change it when two rows must coexist. */\n readonly providerName?: string;\n}\n\ninterface StandardSchemaIssue {\n readonly message: string;\n readonly path?: readonly (string | number)[];\n}\n\ntype StandardSchemaResult =\n | { readonly value: PstackConfig; readonly issues?: undefined }\n | { readonly issues: readonly StandardSchemaIssue[] };\n\n/**\n * Minimal Standard Schema validator for this plugin's row config.\n *\n * Cordis validates `apply()`'s second argument with `Config[\"~standard\"]` and\n * substitutes the returned `value`, so an omitted row `config` resolves to the\n * documented defaults without a schemastery dependency.\n */\nexport const Config = {\n \"~standard\": {\n version: 1,\n vendor: \"dsh-pstack\",\n validate(value: unknown): StandardSchemaResult {\n if (value === undefined || value === null) {\n return { value: { providerName: DEFAULT_PROVIDER_NAME } };\n }\n if (typeof value !== \"object\" || Array.isArray(value)) {\n return { issues: [{ message: \"config must be a mapping\" }] };\n }\n\n const issues: StandardSchemaIssue[] = [];\n const record = value as Record<string, unknown>;\n for (const key of Object.keys(record)) {\n if (key !== \"providerName\") issues.push({ message: `unknown field \"${key}\"`, path: [key] });\n }\n\n const providerName = record[\"providerName\"];\n if (providerName === undefined) {\n return issues.length > 0\n ? { issues }\n : { value: { providerName: DEFAULT_PROVIDER_NAME } };\n }\n if (typeof providerName !== \"string\" || providerName.trim() === \"\") {\n issues.push({ message: \"providerName must be a non-empty string\", path: [\"providerName\"] });\n return { issues };\n }\n\n return issues.length > 0 ? { issues } : { value: { providerName } };\n },\n },\n};\n\n/** The slice of the Cordis context this plugin requires. */\nexport interface PstackSkillHost {\n readonly skills: {\n registerProvider(create: (control: SkillProviderControl) => SkillProvider): () => void;\n };\n}\n\n/**\n * Register the bundled pstack skill provider.\n *\n * The bundled tree is validated before the provider registers, so a malformed\n * `SKILL.md` fails plugin activation with a path-qualified error instead of\n * removing one skill from the catalog. Nothing is copied out of the package and\n * nothing is watched: reinstalling the package is the refresh boundary.\n *\n * @param ctx - host context carrying the skill registry.\n * @param config - validated row config.\n * @throws {import(\"./provider.ts\").BundledSkillError} when the bundled tree is malformed.\n */\nexport function apply(ctx: PstackSkillHost, config: PstackConfig = {}): void {\n const providerName = config.providerName ?? DEFAULT_PROVIDER_NAME;\n const index = loadBundledSkillIndex(SKILLS_ROOT);\n ctx.skills.registerProvider((_control) => createPstackSkillProvider(index, providerName));\n}\n\nexport { ASSETS_ROOT, HARNESS_DOC_PATH, PACKAGE_ROOT, SKILLS_ROOT } from \"./paths.ts\";\nexport {\n BUNDLED_SKILL_RANK,\n BundledSkillError,\n DEFAULT_PROVIDER_NAME,\n createPstackSkillProvider,\n createPstackSkillProviderFromRoot,\n loadBundledSkillIndex,\n} from \"./provider.ts\";\nexport type {\n BundledSkill,\n BundledSkillIndex,\n SkillCandidate,\n SkillDefinition,\n SkillInvocationPolicy,\n SkillLookupOptions,\n SkillProvider,\n SkillProviderControl,\n SkillResourceBase,\n SkillSource,\n SkillSummary,\n} from \"./provider.ts\";\nexport * from \"./frontmatter.ts\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,MAAa,qBAAqB;;AAGlC,MAAa,wBAAwB;;AAuHrC,IAAa,oBAAb,cAAuC,MAAM;CAC3C,YAAY,SAAiB;EAC3B,MAAM,OAAO;EACb,KAAK,OAAO;CACd;AACF;;;;;;;;;;;;;AAcA,SAAgB,sBAAsB,YAAuC;CAC3E,IAAI;CACJ,IAAI;EACF,UAAU,YAAY,YAAY,EAAE,eAAe,KAAK,CAAC;CAC3D,SAAS,OAAO;EACd,MAAM,IAAI,kBACR,gCAAgC,WAAW,KAAK,UAAU,KAAK,GACjE;CACF;CAEA,MAAM,wBAAQ,IAAI,IAA0B;CAE5C,KAAK,MAAM,SAAS,QAAQ,MAAM,MAAM,UAAW,KAAK,OAAO,MAAM,OAAO,KAAK,CAAE,GAAG;EACpF,MAAM,YAAY,KAAK,YAAY,MAAM,IAAI;EAC7C,IAAI,CAAC,MAAM,YAAY,GACrB,MAAM,IAAI,kBACR,oBAAoB,UAAU,wDAChC;EAGF,MAAM,kBAAkB,KAAK,WAAW,UAAU;EAElD,MAAM,cAAc,qBADP,cAAc,eACiB,GAAG,eAAe;EAE9D,IAAI,YAAY,SAAS,MAAM,MAC7B,MAAM,IAAI,kBACR,GAAG,gBAAgB,gBAAgB,YAAY,KAAK,kCAAkC,MAAM,KAAK,EACnG;EAGF,MAAM,IAAI,WAAW;GACnB,MAAM,YAAY;GAClB,aAAa,YAAY;GACzB,GAA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,IAAI,EAAE,OAAO,IAAI,EAAE,OAAO,EAAE,aAAa,EAAE;CACpE;AACF,EACF;;;;;;;;;;;;;AAqBA,SAAgB,MAAM,KAAsB,SAAuB,CAAC,GAAS;CAC3E,MAAM,eAAe,OAAO,gBAAA;CAC5B,MAAM,QAAQ,sBAAsB,WAAW;CAC/C,IAAI,OAAO,kBAAkB,aAAa,0BAA0B,OAAO,YAAY,CAAC;AAC1F"}
@@ -0,0 +1,42 @@
1
+ import { dirname, join, resolve } from "node:path";
2
+ import { fileURLToPath } from "node:url";
3
+ //#region src/paths.ts
4
+ /**
5
+ * Package-internal resource locations.
6
+ *
7
+ * The provider reads generated assets in place instead of copying them into a
8
+ * user-visible skills directory, so every path here is resolved from this
9
+ * module's own location. The modules run from `src/` in a checkout and from the
10
+ * bundled `dist/index.mjs` in an installed package; both sit one directory below
11
+ * the package root, so the same expression holds in both cases.
12
+ */
13
+ /** Absolute path of the package root: the repository in a checkout, the install directory after packing. */
14
+ const PACKAGE_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "..");
15
+ /** Absolute path of the generated, committed assets directory. */
16
+ const ASSETS_ROOT = join(PACKAGE_ROOT, "assets");
17
+ /** Absolute path of the directory holding the 55 bundled skill directories. */
18
+ const SKILLS_ROOT = join(ASSETS_ROOT, "skills");
19
+ /** Absolute path of the directory holding the generated agent preambles. */
20
+ const AGENTS_ROOT = join(ASSETS_ROOT, "agents");
21
+ /**
22
+ * Absolute path of the `poteto-mode` instructions.
23
+ *
24
+ * `pstack_subagent` injects this path into a `poteto-agent` child's prompt, so the
25
+ * child reads the playbook from where it actually is instead of searching a Cursor
26
+ * plugin install for the highest version.
27
+ */
28
+ const POTETO_MODE_SKILL_PATH = join(SKILLS_ROOT, "poteto-mode", "SKILL.md");
29
+ /** Absolute path of the generated harness mapping document. */
30
+ const HARNESS_DOC_PATH = join(ASSETS_ROOT, "docs", "harness", "dsh.md");
31
+ /**
32
+ * Absolute path of one agent preamble.
33
+ *
34
+ * Returns `undefined` for `general`, which is a plain child and gets no preamble.
35
+ */
36
+ function agentPreamblePath(agent) {
37
+ return agent === "general" ? void 0 : join(AGENTS_ROOT, `${agent}.md`);
38
+ }
39
+ //#endregion
40
+ export { SKILLS_ROOT as a, POTETO_MODE_SKILL_PATH as i, HARNESS_DOC_PATH as n, agentPreamblePath as o, PACKAGE_ROOT as r, ASSETS_ROOT as t };
41
+
42
+ //# sourceMappingURL=paths-D_JlVmBk.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths-D_JlVmBk.mjs","names":[],"sources":["../src/paths.ts"],"sourcesContent":["/**\n * Package-internal resource locations.\n *\n * The provider reads generated assets in place instead of copying them into a\n * user-visible skills directory, so every path here is resolved from this\n * module's own location. The modules run from `src/` in a checkout and from the\n * bundled `dist/index.mjs` in an installed package; both sit one directory below\n * the package root, so the same expression holds in both cases.\n */\n\nimport { dirname, join, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\n/** Absolute path of the package root: the repository in a checkout, the install directory after packing. */\nexport const PACKAGE_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), \"..\");\n\n/** Absolute path of the generated, committed assets directory. */\nexport const ASSETS_ROOT = join(PACKAGE_ROOT, \"assets\");\n\n/** Absolute path of the directory holding the 55 bundled skill directories. */\nexport const SKILLS_ROOT = join(ASSETS_ROOT, \"skills\");\n\n/** Absolute path of the directory holding the generated agent preambles. */\nexport const AGENTS_ROOT = join(ASSETS_ROOT, \"agents\");\n\n/**\n * Absolute path of the `poteto-mode` instructions.\n *\n * `pstack_subagent` injects this path into a `poteto-agent` child's prompt, so the\n * child reads the playbook from where it actually is instead of searching a Cursor\n * plugin install for the highest version.\n */\nexport const POTETO_MODE_SKILL_PATH = join(SKILLS_ROOT, \"poteto-mode\", \"SKILL.md\");\n\n/** Absolute path of the generated harness mapping document. */\nexport const HARNESS_DOC_PATH = join(ASSETS_ROOT, \"docs\", \"harness\", \"dsh.md\");\n\n/**\n * Absolute path of one agent preamble.\n *\n * Returns `undefined` for `general`, which is a plain child and gets no preamble.\n */\nexport function agentPreamblePath(agent: string): string | undefined {\n return agent === \"general\" ? undefined : join(AGENTS_ROOT, `${agent}.md`);\n}\n"],"mappings":";;;;;;;;;;;;;AAcA,MAAa,eAAe,QAAQ,QAAQ,cAAc,YAAY,GAAG,CAAC,GAAG,IAAI;;AAGjF,MAAa,cAAc,KAAK,cAAc,QAAQ;;AAGtD,MAAa,cAAc,KAAK,aAAa,QAAQ;;AAGrD,MAAa,cAAc,KAAK,aAAa,QAAQ;;;;;;;;AASrD,MAAa,yBAAyB,KAAK,aAAa,eAAe,UAAU;;AAGjF,MAAa,mBAAmB,KAAK,aAAa,QAAQ,WAAW,QAAQ;;;;;;AAO7E,SAAgB,kBAAkB,OAAmC;CACnE,OAAO,UAAU,YAAY,KAAA,IAAY,KAAK,aAAa,GAAG,MAAM,IAAI;AAC1E"}