dsh-pstack-deck 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (598) hide show
  1. package/README.md +209 -2
  2. package/cordis.patch.yml +14 -0
  3. package/docs/harness/dsh.md +42 -0
  4. package/docs/parallel-tasks.md +74 -0
  5. package/docs/preview-board.png +0 -0
  6. package/docs/preview-detail.png +0 -0
  7. package/docs/preview-drill.png +0 -0
  8. package/docs/preview-flow.png +0 -0
  9. package/docs/preview-list.png +0 -0
  10. package/package.json +58 -4
  11. package/repo/LICENSE +21 -0
  12. package/repo/README.md +370 -0
  13. package/repo/UPSTREAM.md +18 -0
  14. package/repo/plugin.json +21 -0
  15. package/repo/skills/architect/SKILL.md +11 -0
  16. package/repo/skills/arena/SKILL.md +48 -0
  17. package/repo/skills/automate-me/SKILL.md +112 -0
  18. package/repo/skills/benchmark-checklist/SKILL.md +39 -0
  19. package/repo/skills/blast-radius/SKILL.md +50 -0
  20. package/repo/skills/bro/SKILL.md +7 -0
  21. package/repo/skills/correct/SKILL.md +32 -0
  22. package/repo/skills/create-formal-verification-skill/SKILL.md +43 -0
  23. package/repo/skills/create-verification-skill/SKILL.md +44 -0
  24. package/repo/skills/create-verification-skill/references/feature-map-example/README.md +47 -0
  25. package/repo/skills/create-verification-skill/references/feature-map-example/create-note.md +39 -0
  26. package/repo/skills/create-verification-skill/references/feature-map-example/search.md +45 -0
  27. package/repo/skills/figure-it-out/SKILL.md +52 -0
  28. package/repo/skills/how/SKILL.md +21 -0
  29. package/repo/skills/in-your-own-words/SKILL.md +7 -0
  30. package/repo/skills/interrogate/SKILL.md +31 -0
  31. package/repo/skills/ketchup/SKILL.md +43 -0
  32. package/repo/skills/ketchup-video/SKILL.md +29 -0
  33. package/repo/skills/maintain-formal-verification-skill/SKILL.md +58 -0
  34. package/repo/skills/maintain-verification-skill/SKILL.md +39 -0
  35. package/repo/skills/make-bot-ui/SKILL.md +115 -0
  36. package/repo/skills/no-comments/SKILL.md +24 -0
  37. package/repo/skills/no-comments/references/comment-sicko.md +32 -0
  38. package/repo/skills/poteto-help/SKILL.md +162 -0
  39. package/repo/skills/poteto-help/references/prompting.md +51 -0
  40. package/repo/skills/poteto-help/references/recipes.md +51 -0
  41. package/repo/skills/poteto-mode/SKILL.md +122 -0
  42. package/repo/skills/poteto-mode/playbooks/authoring-a-skill.md +12 -0
  43. package/repo/skills/poteto-mode/playbooks/autonomous-run.md +13 -0
  44. package/repo/skills/poteto-mode/playbooks/autopilot-full.md +25 -0
  45. package/repo/skills/poteto-mode/playbooks/autopilot-stack.md +8 -0
  46. package/repo/skills/poteto-mode/playbooks/babysit.md +10 -0
  47. package/repo/skills/poteto-mode/playbooks/bug-fix.md +15 -0
  48. package/repo/skills/poteto-mode/playbooks/eval.md +25 -0
  49. package/repo/skills/poteto-mode/playbooks/feature.md +21 -0
  50. package/repo/skills/poteto-mode/playbooks/hillclimb.md +21 -0
  51. package/repo/skills/poteto-mode/playbooks/investigation.md +14 -0
  52. package/repo/skills/poteto-mode/playbooks/multi-phase-plan.md +11 -0
  53. package/repo/skills/poteto-mode/playbooks/opening-a-pr.md +9 -0
  54. package/repo/skills/poteto-mode/playbooks/pause-safely.md +10 -0
  55. package/repo/skills/poteto-mode/playbooks/perf-issue.md +25 -0
  56. package/repo/skills/poteto-mode/playbooks/prototype.md +14 -0
  57. package/repo/skills/poteto-mode/playbooks/refactoring.md +16 -0
  58. package/repo/skills/poteto-mode/playbooks/runtime-forensics.md +11 -0
  59. package/repo/skills/poteto-mode/playbooks/session-pickup.md +11 -0
  60. package/repo/skills/poteto-mode/playbooks/shipping.md +12 -0
  61. package/repo/skills/poteto-mode/playbooks/trace-forensics.md +14 -0
  62. package/repo/skills/poteto-mode/playbooks/visual-parity.md +11 -0
  63. package/repo/skills/poteto-mode/playbooks/worktree-cleanup.md +12 -0
  64. package/repo/skills/poteto-mode/references/bugbot-triage.md +142 -0
  65. package/repo/skills/poteto-mode/scripts/bootstrap.ts +62 -0
  66. package/repo/skills/poteto-mode/scripts/bun.lock +67 -0
  67. package/repo/skills/poteto-mode/scripts/package.json +16 -0
  68. package/repo/skills/poteto-mode/scripts/watch-pr/cli.test.ts +263 -0
  69. package/repo/skills/poteto-mode/scripts/watch-pr/cli.ts +223 -0
  70. package/repo/skills/poteto-mode/scripts/watch-pr/fakes.test-helper.ts +129 -0
  71. package/repo/skills/poteto-mode/scripts/watch-pr/github.test.ts +506 -0
  72. package/repo/skills/poteto-mode/scripts/watch-pr/github.ts +729 -0
  73. package/repo/skills/poteto-mode/scripts/watch-pr/policy.test.ts +482 -0
  74. package/repo/skills/poteto-mode/scripts/watch-pr/policy.ts +842 -0
  75. package/repo/skills/poteto-mode/scripts/watch-pr/render.ts +180 -0
  76. package/repo/skills/poteto-mode/scripts/watch-pr/tsconfig.json +13 -0
  77. package/repo/skills/poteto-mode/scripts/watch-pr/types.compile.ts +93 -0
  78. package/repo/skills/poteto-mode/scripts/watch-pr/types.ts +414 -0
  79. package/repo/skills/poteto-mode/scripts/watch-pr/watch-pr +6 -0
  80. package/repo/skills/poteto-mode/scripts/worktree-audit.sh +144 -0
  81. package/repo/skills/poteto-mode/worker.md +11 -0
  82. package/repo/skills/principle-attack-the-premise/SKILL.md +15 -0
  83. package/repo/skills/principle-boundary-discipline/SKILL.md +11 -0
  84. package/repo/skills/principle-build-the-lever/SKILL.md +14 -0
  85. package/repo/skills/principle-encode-lessons-in-structure/SKILL.md +11 -0
  86. package/repo/skills/principle-exhaust-the-design-space/SKILL.md +9 -0
  87. package/repo/skills/principle-experience-first/SKILL.md +19 -0
  88. package/repo/skills/principle-explain-the-number/SKILL.md +14 -0
  89. package/repo/skills/principle-fix-root-causes/SKILL.md +14 -0
  90. package/repo/skills/principle-foundational-thinking/SKILL.md +13 -0
  91. package/repo/skills/principle-guard-the-context-window/SKILL.md +12 -0
  92. package/repo/skills/principle-laziness-protocol/SKILL.md +10 -0
  93. package/repo/skills/principle-make-operations-idempotent/SKILL.md +15 -0
  94. package/repo/skills/principle-migrate-callers-then-delete-legacy-apis/SKILL.md +14 -0
  95. package/repo/skills/principle-minimize-reader-load/SKILL.md +15 -0
  96. package/repo/skills/principle-model-the-domain/SKILL.md +15 -0
  97. package/repo/skills/principle-never-block-on-the-human/SKILL.md +15 -0
  98. package/repo/skills/principle-outcome-oriented-execution/SKILL.md +21 -0
  99. package/repo/skills/principle-prove-it-works/SKILL.md +11 -0
  100. package/repo/skills/principle-redesign-from-first-principles/SKILL.md +16 -0
  101. package/repo/skills/principle-separate-before-serializing-shared-state/SKILL.md +11 -0
  102. package/repo/skills/principle-sequence-verifiable-units/SKILL.md +13 -0
  103. package/repo/skills/principle-subtract-before-you-add/SKILL.md +18 -0
  104. package/repo/skills/principle-test-behavior-not-implementation/SKILL.md +16 -0
  105. package/repo/skills/principle-type-system-discipline/SKILL.md +15 -0
  106. package/repo/skills/recall/SKILL.md +41 -0
  107. package/repo/skills/reflect/SKILL.md +17 -0
  108. package/repo/skills/setup-pstack/SKILL.md +86 -0
  109. package/repo/skills/sharpen/SKILL.md +16 -0
  110. package/repo/skills/show-me-your-work/SKILL.md +82 -0
  111. package/repo/skills/show-me-your-work/references/decision-log-template.tsv +1 -0
  112. package/repo/skills/show-me-your-work/scripts/log.sh +42 -0
  113. package/repo/skills/statechart/SKILL.md +82 -0
  114. package/repo/skills/statechart/references/render.md +93 -0
  115. package/repo/skills/statechart/scripts/backends/cfg.ts +33 -0
  116. package/repo/skills/statechart/scripts/backends/mermaid.ts +249 -0
  117. package/repo/skills/statechart/scripts/backends/plain-text.ts +72 -0
  118. package/repo/skills/statechart/scripts/backends/report.ts +177 -0
  119. package/repo/skills/statechart/scripts/frontends/config.ts +276 -0
  120. package/repo/skills/statechart/scripts/frontends/dot.ts +77 -0
  121. package/repo/skills/statechart/scripts/frontends/marks.ts +93 -0
  122. package/repo/skills/statechart/scripts/frontends/messages.ts +52 -0
  123. package/repo/skills/statechart/scripts/frontends/spec.ts +114 -0
  124. package/repo/skills/statechart/scripts/frontends/trace.ts +24 -0
  125. package/repo/skills/statechart/scripts/frontends/value.ts +166 -0
  126. package/repo/skills/statechart/scripts/frontends/verdict.ts +40 -0
  127. package/repo/skills/statechart/scripts/frontends/view.ts +119 -0
  128. package/repo/skills/statechart/scripts/ir.ts +547 -0
  129. package/repo/skills/statechart/scripts/janitor.ts +13 -0
  130. package/repo/skills/statechart/scripts/kill.ts +15 -0
  131. package/repo/skills/statechart/scripts/package.json +11 -0
  132. package/repo/skills/statechart/scripts/passes/annotate.ts +128 -0
  133. package/repo/skills/statechart/scripts/passes/label.ts +269 -0
  134. package/repo/skills/statechart/scripts/passes/lift.ts +85 -0
  135. package/repo/skills/statechart/scripts/passes/loop-check.ts +68 -0
  136. package/repo/skills/statechart/scripts/passes/paths.ts +60 -0
  137. package/repo/skills/statechart/scripts/passes/reach.ts +135 -0
  138. package/repo/skills/statechart/scripts/passes/region-check.ts +97 -0
  139. package/repo/skills/statechart/scripts/passes/regions.ts +295 -0
  140. package/repo/skills/statechart/scripts/pipeline.ts +76 -0
  141. package/repo/skills/statechart/scripts/run.ts +500 -0
  142. package/repo/skills/statechart/scripts/statechart +29 -0
  143. package/repo/skills/statechart/scripts/statechart.ts +165 -0
  144. package/repo/skills/statechart/scripts/test/ConfigOracle.java +63 -0
  145. package/repo/skills/statechart/scripts/test/chart.test.ts +1253 -0
  146. package/repo/skills/statechart/scripts/test/charts/Braces.mmd +7 -0
  147. package/repo/skills/statechart/scripts/test/charts/Escapes.mmd +11 -0
  148. package/repo/skills/statechart/scripts/test/charts/Phases.mmd +29 -0
  149. package/repo/skills/statechart/scripts/test/cli.test.ts +1344 -0
  150. package/repo/skills/statechart/scripts/test/config-fuzz.test.ts +263 -0
  151. package/repo/skills/statechart/scripts/test/corpus/Counter/ChartRun.out +57 -0
  152. package/repo/skills/statechart/scripts/test/corpus/Counter/Counter.cfg +3 -0
  153. package/repo/skills/statechart/scripts/test/corpus/Counter/Counter.tla +10 -0
  154. package/repo/skills/statechart/scripts/test/corpus/Counter/chart.mmd +9 -0
  155. package/repo/skills/statechart/scripts/test/corpus/Counter/graph.dot +16 -0
  156. package/repo/skills/statechart/scripts/test/corpus/Counter/report.md +7 -0
  157. package/repo/skills/statechart/scripts/test/corpus/Counter/sany.out +2 -0
  158. package/repo/skills/statechart/scripts/test/corpus/Counter/verdict-1.out +49 -0
  159. package/repo/skills/statechart/scripts/test/corpus/CounterAction/ChartRun.out +60 -0
  160. package/repo/skills/statechart/scripts/test/corpus/CounterAction/CounterAction.cfg +4 -0
  161. package/repo/skills/statechart/scripts/test/corpus/CounterAction/CounterAction.tla +22 -0
  162. package/repo/skills/statechart/scripts/test/corpus/CounterAction/chart.mmd +26 -0
  163. package/repo/skills/statechart/scripts/test/corpus/CounterAction/graph.dot +19 -0
  164. package/repo/skills/statechart/scripts/test/corpus/CounterAction/report.md +20 -0
  165. package/repo/skills/statechart/scripts/test/corpus/CounterAction/sany.out +2 -0
  166. package/repo/skills/statechart/scripts/test/corpus/CounterAction/verdict-1.exit +1 -0
  167. package/repo/skills/statechart/scripts/test/corpus/CounterAction/verdict-1.out +56 -0
  168. package/repo/skills/statechart/scripts/test/corpus/CounterAction/verdict-2.exit +1 -0
  169. package/repo/skills/statechart/scripts/test/corpus/CounterAction/verdict-2.out +82 -0
  170. package/repo/skills/statechart/scripts/test/corpus/CounterAction/verdict-3.out +57 -0
  171. package/repo/skills/statechart/scripts/test/corpus/CounterDeadlock/ChartRun.out +59 -0
  172. package/repo/skills/statechart/scripts/test/corpus/CounterDeadlock/CounterDeadlock.cfg +3 -0
  173. package/repo/skills/statechart/scripts/test/corpus/CounterDeadlock/CounterDeadlock.tla +11 -0
  174. package/repo/skills/statechart/scripts/test/corpus/CounterDeadlock/chart.mmd +22 -0
  175. package/repo/skills/statechart/scripts/test/corpus/CounterDeadlock/graph.dot +16 -0
  176. package/repo/skills/statechart/scripts/test/corpus/CounterDeadlock/report.md +17 -0
  177. package/repo/skills/statechart/scripts/test/corpus/CounterDeadlock/sany.out +2 -0
  178. package/repo/skills/statechart/scripts/test/corpus/CounterDeadlock/verdict-1.exit +1 -0
  179. package/repo/skills/statechart/scripts/test/corpus/CounterDeadlock/verdict-1.out +56 -0
  180. package/repo/skills/statechart/scripts/test/corpus/CounterDeadlock/verdict-2.exit +1 -0
  181. package/repo/skills/statechart/scripts/test/corpus/CounterDeadlock/verdict-2.out +77 -0
  182. package/repo/skills/statechart/scripts/test/corpus/CounterFan/ChartRun.out +69 -0
  183. package/repo/skills/statechart/scripts/test/corpus/CounterFan/CounterFan.cfg +2 -0
  184. package/repo/skills/statechart/scripts/test/corpus/CounterFan/CounterFan.tla +11 -0
  185. package/repo/skills/statechart/scripts/test/corpus/CounterFan/chart.mmd +85 -0
  186. package/repo/skills/statechart/scripts/test/corpus/CounterFan/graph.dot +70 -0
  187. package/repo/skills/statechart/scripts/test/corpus/CounterFan/report.md +12 -0
  188. package/repo/skills/statechart/scripts/test/corpus/CounterFan/sany.out +2 -0
  189. package/repo/skills/statechart/scripts/test/corpus/CounterFan/verdict-1.exit +1 -0
  190. package/repo/skills/statechart/scripts/test/corpus/CounterFan/verdict-1.out +67 -0
  191. package/repo/skills/statechart/scripts/test/corpus/CounterFan/verdict-2.out +57 -0
  192. package/repo/skills/statechart/scripts/test/corpus/CounterGuard/ChartRun.exit +1 -0
  193. package/repo/skills/statechart/scripts/test/corpus/CounterGuard/ChartRun.out +85 -0
  194. package/repo/skills/statechart/scripts/test/corpus/CounterGuard/CounterGuard.cfg +6 -0
  195. package/repo/skills/statechart/scripts/test/corpus/CounterGuard/CounterGuard.tla +13 -0
  196. package/repo/skills/statechart/scripts/test/corpus/CounterGuard/chart.mmd +5 -0
  197. package/repo/skills/statechart/scripts/test/corpus/CounterGuard/graph.dot +10 -0
  198. package/repo/skills/statechart/scripts/test/corpus/CounterGuard/report.md +31 -0
  199. package/repo/skills/statechart/scripts/test/corpus/CounterGuard/sany.out +2 -0
  200. package/repo/skills/statechart/scripts/test/corpus/CounterGuard/verdict-1.exit +1 -0
  201. package/repo/skills/statechart/scripts/test/corpus/CounterGuard/verdict-1.out +64 -0
  202. package/repo/skills/statechart/scripts/test/corpus/CounterGuard/verdict-2.exit +1 -0
  203. package/repo/skills/statechart/scripts/test/corpus/CounterGuard/verdict-2.out +77 -0
  204. package/repo/skills/statechart/scripts/test/corpus/CounterInitPast/ChartRun.out +55 -0
  205. package/repo/skills/statechart/scripts/test/corpus/CounterInitPast/CounterInitPast.cfg +3 -0
  206. package/repo/skills/statechart/scripts/test/corpus/CounterInitPast/CounterInitPast.tla +10 -0
  207. package/repo/skills/statechart/scripts/test/corpus/CounterInitPast/chart.mmd +12 -0
  208. package/repo/skills/statechart/scripts/test/corpus/CounterInitPast/graph.dot +6 -0
  209. package/repo/skills/statechart/scripts/test/corpus/CounterInitPast/report.md +12 -0
  210. package/repo/skills/statechart/scripts/test/corpus/CounterInitPast/sany.out +2 -0
  211. package/repo/skills/statechart/scripts/test/corpus/CounterInitPast/verdict-1.exit +1 -0
  212. package/repo/skills/statechart/scripts/test/corpus/CounterInitPast/verdict-1.out +33 -0
  213. package/repo/skills/statechart/scripts/test/corpus/CounterInitPast/verdict-2.out +54 -0
  214. package/repo/skills/statechart/scripts/test/corpus/CounterInitPastHolds/ChartRun.out +54 -0
  215. package/repo/skills/statechart/scripts/test/corpus/CounterInitPastHolds/CounterInitPastHolds.cfg +3 -0
  216. package/repo/skills/statechart/scripts/test/corpus/CounterInitPastHolds/CounterInitPastHolds.tla +10 -0
  217. package/repo/skills/statechart/scripts/test/corpus/CounterInitPastHolds/chart.mmd +1 -0
  218. package/repo/skills/statechart/scripts/test/corpus/CounterInitPastHolds/graph.dot +6 -0
  219. package/repo/skills/statechart/scripts/test/corpus/CounterInitPastHolds/report.md +7 -0
  220. package/repo/skills/statechart/scripts/test/corpus/CounterInitPastHolds/sany.out +2 -0
  221. package/repo/skills/statechart/scripts/test/corpus/CounterInitPastHolds/verdict-1.out +46 -0
  222. package/repo/skills/statechart/scripts/test/corpus/CounterInstance/ChartRun.out +59 -0
  223. package/repo/skills/statechart/scripts/test/corpus/CounterInstance/CounterInstance.cfg +2 -0
  224. package/repo/skills/statechart/scripts/test/corpus/CounterInstance/CounterInstance.tla +10 -0
  225. package/repo/skills/statechart/scripts/test/corpus/CounterInstance/CounterSteps.tla +6 -0
  226. package/repo/skills/statechart/scripts/test/corpus/CounterInstance/chart.mmd +17 -0
  227. package/repo/skills/statechart/scripts/test/corpus/CounterInstance/graph.dot +15 -0
  228. package/repo/skills/statechart/scripts/test/corpus/CounterInstance/report.md +14 -0
  229. package/repo/skills/statechart/scripts/test/corpus/CounterInstance/sany.out +3 -0
  230. package/repo/skills/statechart/scripts/test/corpus/CounterInstance/verdict-1.exit +1 -0
  231. package/repo/skills/statechart/scripts/test/corpus/CounterInstance/verdict-1.out +78 -0
  232. package/repo/skills/statechart/scripts/test/corpus/CounterJump/ChartRun.out +59 -0
  233. package/repo/skills/statechart/scripts/test/corpus/CounterJump/CounterJump.cfg +3 -0
  234. package/repo/skills/statechart/scripts/test/corpus/CounterJump/CounterJump.tla +19 -0
  235. package/repo/skills/statechart/scripts/test/corpus/CounterJump/chart.mmd +26 -0
  236. package/repo/skills/statechart/scripts/test/corpus/CounterJump/graph.dot +22 -0
  237. package/repo/skills/statechart/scripts/test/corpus/CounterJump/report.md +12 -0
  238. package/repo/skills/statechart/scripts/test/corpus/CounterJump/sany.out +2 -0
  239. package/repo/skills/statechart/scripts/test/corpus/CounterJump/verdict-1.exit +1 -0
  240. package/repo/skills/statechart/scripts/test/corpus/CounterJump/verdict-1.out +58 -0
  241. package/repo/skills/statechart/scripts/test/corpus/CounterJump/verdict-2.out +57 -0
  242. package/repo/skills/statechart/scripts/test/corpus/CounterLoop/ChartRun.out +57 -0
  243. package/repo/skills/statechart/scripts/test/corpus/CounterLoop/CounterLoop.cfg +2 -0
  244. package/repo/skills/statechart/scripts/test/corpus/CounterLoop/CounterLoop.tla +11 -0
  245. package/repo/skills/statechart/scripts/test/corpus/CounterLoop/chart.mmd +17 -0
  246. package/repo/skills/statechart/scripts/test/corpus/CounterLoop/graph.dot +15 -0
  247. package/repo/skills/statechart/scripts/test/corpus/CounterLoop/report.md +14 -0
  248. package/repo/skills/statechart/scripts/test/corpus/CounterLoop/sany.out +2 -0
  249. package/repo/skills/statechart/scripts/test/corpus/CounterLoop/verdict-1.exit +1 -0
  250. package/repo/skills/statechart/scripts/test/corpus/CounterLoop/verdict-1.out +76 -0
  251. package/repo/skills/statechart/scripts/test/corpus/CounterOrder/ChartRun.out +59 -0
  252. package/repo/skills/statechart/scripts/test/corpus/CounterOrder/CounterOrder.cfg +3 -0
  253. package/repo/skills/statechart/scripts/test/corpus/CounterOrder/CounterOrder.tla +11 -0
  254. package/repo/skills/statechart/scripts/test/corpus/CounterOrder/chart.mmd +19 -0
  255. package/repo/skills/statechart/scripts/test/corpus/CounterOrder/graph.dot +10 -0
  256. package/repo/skills/statechart/scripts/test/corpus/CounterOrder/report.md +15 -0
  257. package/repo/skills/statechart/scripts/test/corpus/CounterOrder/sany.out +2 -0
  258. package/repo/skills/statechart/scripts/test/corpus/CounterOrder/verdict-1.exit +1 -0
  259. package/repo/skills/statechart/scripts/test/corpus/CounterOrder/verdict-1.out +56 -0
  260. package/repo/skills/statechart/scripts/test/corpus/CounterOrder/verdict-2.exit +1 -0
  261. package/repo/skills/statechart/scripts/test/corpus/CounterOrder/verdict-2.out +67 -0
  262. package/repo/skills/statechart/scripts/test/corpus/CounterRules/ChartRun.out +62 -0
  263. package/repo/skills/statechart/scripts/test/corpus/CounterRules/CounterRules.cfg +6 -0
  264. package/repo/skills/statechart/scripts/test/corpus/CounterRules/CounterRules.tla +24 -0
  265. package/repo/skills/statechart/scripts/test/corpus/CounterRules/Moves.tla +5 -0
  266. package/repo/skills/statechart/scripts/test/corpus/CounterRules/chart.mmd +22 -0
  267. package/repo/skills/statechart/scripts/test/corpus/CounterRules/graph.dot +10 -0
  268. package/repo/skills/statechart/scripts/test/corpus/CounterRules/report.md +23 -0
  269. package/repo/skills/statechart/scripts/test/corpus/CounterRules/sany.out +3 -0
  270. package/repo/skills/statechart/scripts/test/corpus/CounterRules/verdict-1.exit +1 -0
  271. package/repo/skills/statechart/scripts/test/corpus/CounterRules/verdict-1.out +58 -0
  272. package/repo/skills/statechart/scripts/test/corpus/CounterRules/verdict-2.exit +1 -0
  273. package/repo/skills/statechart/scripts/test/corpus/CounterRules/verdict-2.out +66 -0
  274. package/repo/skills/statechart/scripts/test/corpus/CounterRules/verdict-3.exit +1 -0
  275. package/repo/skills/statechart/scripts/test/corpus/CounterRules/verdict-3.out +74 -0
  276. package/repo/skills/statechart/scripts/test/corpus/CounterRules/verdict-4.out +59 -0
  277. package/repo/skills/statechart/scripts/test/corpus/CounterStart/ChartRun.out +58 -0
  278. package/repo/skills/statechart/scripts/test/corpus/CounterStart/CounterStart.cfg +3 -0
  279. package/repo/skills/statechart/scripts/test/corpus/CounterStart/CounterStart.tla +15 -0
  280. package/repo/skills/statechart/scripts/test/corpus/CounterStart/chart.mmd +18 -0
  281. package/repo/skills/statechart/scripts/test/corpus/CounterStart/graph.dot +13 -0
  282. package/repo/skills/statechart/scripts/test/corpus/CounterStart/report.md +11 -0
  283. package/repo/skills/statechart/scripts/test/corpus/CounterStart/sany.out +2 -0
  284. package/repo/skills/statechart/scripts/test/corpus/CounterStart/verdict-1.exit +1 -0
  285. package/repo/skills/statechart/scripts/test/corpus/CounterStart/verdict-1.out +33 -0
  286. package/repo/skills/statechart/scripts/test/corpus/CounterStart/verdict-2.out +57 -0
  287. package/repo/skills/statechart/scripts/test/corpus/CounterStop/ChartRun.out +57 -0
  288. package/repo/skills/statechart/scripts/test/corpus/CounterStop/CounterStop.cfg +3 -0
  289. package/repo/skills/statechart/scripts/test/corpus/CounterStop/CounterStop.tla +15 -0
  290. package/repo/skills/statechart/scripts/test/corpus/CounterStop/chart.mmd +7 -0
  291. package/repo/skills/statechart/scripts/test/corpus/CounterStop/graph.dot +13 -0
  292. package/repo/skills/statechart/scripts/test/corpus/CounterStop/report.md +6 -0
  293. package/repo/skills/statechart/scripts/test/corpus/CounterStop/sany.out +2 -0
  294. package/repo/skills/statechart/scripts/test/corpus/CounterStop/verdict-1.out +49 -0
  295. package/repo/skills/statechart/scripts/test/corpus/CounterTie/ChartRun.out +61 -0
  296. package/repo/skills/statechart/scripts/test/corpus/CounterTie/CounterTie.cfg +4 -0
  297. package/repo/skills/statechart/scripts/test/corpus/CounterTie/CounterTie.tla +14 -0
  298. package/repo/skills/statechart/scripts/test/corpus/CounterTie/chart.mmd +30 -0
  299. package/repo/skills/statechart/scripts/test/corpus/CounterTie/graph.dot +19 -0
  300. package/repo/skills/statechart/scripts/test/corpus/CounterTie/report.md +27 -0
  301. package/repo/skills/statechart/scripts/test/corpus/CounterTie/sany.out +2 -0
  302. package/repo/skills/statechart/scripts/test/corpus/CounterTie/verdict-1.exit +1 -0
  303. package/repo/skills/statechart/scripts/test/corpus/CounterTie/verdict-1.out +56 -0
  304. package/repo/skills/statechart/scripts/test/corpus/CounterTie/verdict-2.exit +1 -0
  305. package/repo/skills/statechart/scripts/test/corpus/CounterTie/verdict-2.out +64 -0
  306. package/repo/skills/statechart/scripts/test/corpus/CounterTie/verdict-3.exit +1 -0
  307. package/repo/skills/statechart/scripts/test/corpus/CounterTie/verdict-3.out +87 -0
  308. package/repo/skills/statechart/scripts/test/corpus/CounterTie/verdict-4.out +57 -0
  309. package/repo/skills/statechart/scripts/test/corpus/CounterTieInGraph/ChartRun.out +60 -0
  310. package/repo/skills/statechart/scripts/test/corpus/CounterTieInGraph/CounterTieInGraph.cfg +3 -0
  311. package/repo/skills/statechart/scripts/test/corpus/CounterTieInGraph/CounterTieInGraph.tla +12 -0
  312. package/repo/skills/statechart/scripts/test/corpus/CounterTieInGraph/chart.mmd +23 -0
  313. package/repo/skills/statechart/scripts/test/corpus/CounterTieInGraph/graph.dot +19 -0
  314. package/repo/skills/statechart/scripts/test/corpus/CounterTieInGraph/report.md +11 -0
  315. package/repo/skills/statechart/scripts/test/corpus/CounterTieInGraph/sany.out +2 -0
  316. package/repo/skills/statechart/scripts/test/corpus/CounterTieInGraph/verdict-1.exit +1 -0
  317. package/repo/skills/statechart/scripts/test/corpus/CounterTieInGraph/verdict-1.out +56 -0
  318. package/repo/skills/statechart/scripts/test/corpus/CounterTieInGraph/verdict-2.out +57 -0
  319. package/repo/skills/statechart/scripts/test/corpus/CounterView/ChartRun.out +61 -0
  320. package/repo/skills/statechart/scripts/test/corpus/CounterView/CounterView.cfg +4 -0
  321. package/repo/skills/statechart/scripts/test/corpus/CounterView/CounterView.tla +14 -0
  322. package/repo/skills/statechart/scripts/test/corpus/CounterView/chart.mmd +23 -0
  323. package/repo/skills/statechart/scripts/test/corpus/CounterView/graph.dot +19 -0
  324. package/repo/skills/statechart/scripts/test/corpus/CounterView/report.md +27 -0
  325. package/repo/skills/statechart/scripts/test/corpus/CounterView/sany.out +2 -0
  326. package/repo/skills/statechart/scripts/test/corpus/CounterView/verdict-1.exit +1 -0
  327. package/repo/skills/statechart/scripts/test/corpus/CounterView/verdict-1.out +56 -0
  328. package/repo/skills/statechart/scripts/test/corpus/CounterView/verdict-2.exit +1 -0
  329. package/repo/skills/statechart/scripts/test/corpus/CounterView/verdict-2.out +64 -0
  330. package/repo/skills/statechart/scripts/test/corpus/CounterView/verdict-3.exit +1 -0
  331. package/repo/skills/statechart/scripts/test/corpus/CounterView/verdict-3.out +87 -0
  332. package/repo/skills/statechart/scripts/test/corpus/CounterView/verdict-4.out +57 -0
  333. package/repo/skills/statechart/scripts/test/corpus/CounterView/view.mjs +1 -0
  334. package/repo/skills/statechart/scripts/test/corpus/DieHard/ChartRun.out +59 -0
  335. package/repo/skills/statechart/scripts/test/corpus/DieHard/DieHard.cfg +4 -0
  336. package/repo/skills/statechart/scripts/test/corpus/DieHard/DieHard.tla +38 -0
  337. package/repo/skills/statechart/scripts/test/corpus/DieHard/chart.mmd +92 -0
  338. package/repo/skills/statechart/scripts/test/corpus/DieHard/graph.dot +126 -0
  339. package/repo/skills/statechart/scripts/test/corpus/DieHard/report.md +17 -0
  340. package/repo/skills/statechart/scripts/test/corpus/DieHard/sany.out +2 -0
  341. package/repo/skills/statechart/scripts/test/corpus/DieHard/verdict-1.exit +1 -0
  342. package/repo/skills/statechart/scripts/test/corpus/DieHard/verdict-1.out +91 -0
  343. package/repo/skills/statechart/scripts/test/corpus/DieHard/verdict-2.out +57 -0
  344. package/repo/skills/statechart/scripts/test/corpus/FirstRule/ChartRun.out +61 -0
  345. package/repo/skills/statechart/scripts/test/corpus/FirstRule/FirstRule.cfg +6 -0
  346. package/repo/skills/statechart/scripts/test/corpus/FirstRule/FirstRule.tla +11 -0
  347. package/repo/skills/statechart/scripts/test/corpus/FirstRule/chart.mmd +22 -0
  348. package/repo/skills/statechart/scripts/test/corpus/FirstRule/graph.dot +16 -0
  349. package/repo/skills/statechart/scripts/test/corpus/FirstRule/report.md +25 -0
  350. package/repo/skills/statechart/scripts/test/corpus/FirstRule/sany.out +2 -0
  351. package/repo/skills/statechart/scripts/test/corpus/FirstRule/verdict-1.exit +1 -0
  352. package/repo/skills/statechart/scripts/test/corpus/FirstRule/verdict-1.out +56 -0
  353. package/repo/skills/statechart/scripts/test/corpus/FirstRule/verdict-2.exit +1 -0
  354. package/repo/skills/statechart/scripts/test/corpus/FirstRule/verdict-2.out +64 -0
  355. package/repo/skills/statechart/scripts/test/corpus/FirstRule/verdict-3.exit +1 -0
  356. package/repo/skills/statechart/scripts/test/corpus/FirstRule/verdict-3.out +64 -0
  357. package/repo/skills/statechart/scripts/test/corpus/FirstRule/verdict-4.exit +1 -0
  358. package/repo/skills/statechart/scripts/test/corpus/FirstRule/verdict-4.out +77 -0
  359. package/repo/skills/statechart/scripts/test/corpus/HiddenClock/ChartRun.out +57 -0
  360. package/repo/skills/statechart/scripts/test/corpus/HiddenClock/HiddenClock.cfg +4 -0
  361. package/repo/skills/statechart/scripts/test/corpus/HiddenClock/HiddenClock.tla +11 -0
  362. package/repo/skills/statechart/scripts/test/corpus/HiddenClock/chart.mmd +13 -0
  363. package/repo/skills/statechart/scripts/test/corpus/HiddenClock/graph.dot +12 -0
  364. package/repo/skills/statechart/scripts/test/corpus/HiddenClock/report.md +11 -0
  365. package/repo/skills/statechart/scripts/test/corpus/HiddenClock/sany.out +2 -0
  366. package/repo/skills/statechart/scripts/test/corpus/HiddenClock/verdict-1.exit +1 -0
  367. package/repo/skills/statechart/scripts/test/corpus/HiddenClock/verdict-1.out +72 -0
  368. package/repo/skills/statechart/scripts/test/corpus/Login/ChartRun.out +57 -0
  369. package/repo/skills/statechart/scripts/test/corpus/Login/Login.cfg +3 -0
  370. package/repo/skills/statechart/scripts/test/corpus/Login/Login.tla +62 -0
  371. package/repo/skills/statechart/scripts/test/corpus/Login/chart.mmd +28 -0
  372. package/repo/skills/statechart/scripts/test/corpus/Login/graph.dot +40 -0
  373. package/repo/skills/statechart/scripts/test/corpus/Login/report.md +7 -0
  374. package/repo/skills/statechart/scripts/test/corpus/Login/sany.out +1 -0
  375. package/repo/skills/statechart/scripts/test/corpus/Login/verdict-1.out +47 -0
  376. package/repo/skills/statechart/scripts/test/corpus/Login/view.mjs +1 -0
  377. package/repo/skills/statechart/scripts/test/corpus/LoginGuarded/ChartRun.out +57 -0
  378. package/repo/skills/statechart/scripts/test/corpus/LoginGuarded/LoginGuarded.cfg +2 -0
  379. package/repo/skills/statechart/scripts/test/corpus/LoginGuarded/LoginGuarded.tla +64 -0
  380. package/repo/skills/statechart/scripts/test/corpus/LoginGuarded/chart.mmd +28 -0
  381. package/repo/skills/statechart/scripts/test/corpus/LoginGuarded/graph.dot +37 -0
  382. package/repo/skills/statechart/scripts/test/corpus/LoginGuarded/report.md +8 -0
  383. package/repo/skills/statechart/scripts/test/corpus/LoginGuarded/sany.out +1 -0
  384. package/repo/skills/statechart/scripts/test/corpus/LoginGuarded/verdict-1.out +47 -0
  385. package/repo/skills/statechart/scripts/test/corpus/LoginGuarded/view.mjs +1 -0
  386. package/repo/skills/statechart/scripts/test/corpus/LoginParallel/ChartRun.out +60 -0
  387. package/repo/skills/statechart/scripts/test/corpus/LoginParallel/LoginParallel.cfg +3 -0
  388. package/repo/skills/statechart/scripts/test/corpus/LoginParallel/LoginParallel.tla +64 -0
  389. package/repo/skills/statechart/scripts/test/corpus/LoginParallel/chart.mmd +44 -0
  390. package/repo/skills/statechart/scripts/test/corpus/LoginParallel/graph.dot +58 -0
  391. package/repo/skills/statechart/scripts/test/corpus/LoginParallel/report.md +17 -0
  392. package/repo/skills/statechart/scripts/test/corpus/LoginParallel/sany.out +1 -0
  393. package/repo/skills/statechart/scripts/test/corpus/LoginParallel/verdict-1.exit +1 -0
  394. package/repo/skills/statechart/scripts/test/corpus/LoginParallel/verdict-1.out +83 -0
  395. package/repo/skills/statechart/scripts/test/corpus/LoginParallel/verdict-2.out +57 -0
  396. package/repo/skills/statechart/scripts/test/corpus/LoginParallel/view.mjs +1 -0
  397. package/repo/skills/statechart/scripts/test/corpus/MediaPlayer/ChartRun.out +60 -0
  398. package/repo/skills/statechart/scripts/test/corpus/MediaPlayer/MediaPlayer.cfg +3 -0
  399. package/repo/skills/statechart/scripts/test/corpus/MediaPlayer/MediaPlayer.tla +103 -0
  400. package/repo/skills/statechart/scripts/test/corpus/MediaPlayer/chart.mmd +43 -0
  401. package/repo/skills/statechart/scripts/test/corpus/MediaPlayer/graph.dot +93 -0
  402. package/repo/skills/statechart/scripts/test/corpus/MediaPlayer/report.md +14 -0
  403. package/repo/skills/statechart/scripts/test/corpus/MediaPlayer/sany.out +1 -0
  404. package/repo/skills/statechart/scripts/test/corpus/MediaPlayer/verdict-1.exit +1 -0
  405. package/repo/skills/statechart/scripts/test/corpus/MediaPlayer/verdict-1.out +59 -0
  406. package/repo/skills/statechart/scripts/test/corpus/MediaPlayer/verdict-2.out +72 -0
  407. package/repo/skills/statechart/scripts/test/corpus/MediaPlayer/view.mjs +3 -0
  408. package/repo/skills/statechart/scripts/test/corpus/MediaPlayerFixed/ChartRun.out +57 -0
  409. package/repo/skills/statechart/scripts/test/corpus/MediaPlayerFixed/MediaPlayerFixed.cfg +2 -0
  410. package/repo/skills/statechart/scripts/test/corpus/MediaPlayerFixed/MediaPlayerFixed.tla +100 -0
  411. package/repo/skills/statechart/scripts/test/corpus/MediaPlayerFixed/chart.mmd +31 -0
  412. package/repo/skills/statechart/scripts/test/corpus/MediaPlayerFixed/graph.dot +85 -0
  413. package/repo/skills/statechart/scripts/test/corpus/MediaPlayerFixed/report.md +9 -0
  414. package/repo/skills/statechart/scripts/test/corpus/MediaPlayerFixed/sany.out +1 -0
  415. package/repo/skills/statechart/scripts/test/corpus/MediaPlayerFixed/verdict-1.out +47 -0
  416. package/repo/skills/statechart/scripts/test/corpus/MediaPlayerFixed/view.mjs +3 -0
  417. package/repo/skills/statechart/scripts/test/corpus/MediaPlayerProps/ChartRun.out +59 -0
  418. package/repo/skills/statechart/scripts/test/corpus/MediaPlayerProps/MediaPlayer.tla +103 -0
  419. package/repo/skills/statechart/scripts/test/corpus/MediaPlayerProps/MediaPlayerProps.cfg +3 -0
  420. package/repo/skills/statechart/scripts/test/corpus/MediaPlayerProps/MediaPlayerProps.tla +6 -0
  421. package/repo/skills/statechart/scripts/test/corpus/MediaPlayerProps/chart.mmd +42 -0
  422. package/repo/skills/statechart/scripts/test/corpus/MediaPlayerProps/graph.dot +93 -0
  423. package/repo/skills/statechart/scripts/test/corpus/MediaPlayerProps/report.md +19 -0
  424. package/repo/skills/statechart/scripts/test/corpus/MediaPlayerProps/sany.out +2 -0
  425. package/repo/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-1.exit +1 -0
  426. package/repo/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-1.out +61 -0
  427. package/repo/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-2.out +59 -0
  428. package/repo/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-3.out +61 -0
  429. package/repo/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-4.exit +1 -0
  430. package/repo/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-4.out +66 -0
  431. package/repo/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-5.exit +1 -0
  432. package/repo/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-5.out +58 -0
  433. package/repo/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-6.out +49 -0
  434. package/repo/skills/statechart/scripts/test/corpus/MediaPlayerProps/view.mjs +3 -0
  435. package/repo/skills/statechart/scripts/test/corpus/PickWorker/ChartRun.out +57 -0
  436. package/repo/skills/statechart/scripts/test/corpus/PickWorker/PickWorker.cfg +6 -0
  437. package/repo/skills/statechart/scripts/test/corpus/PickWorker/PickWorker.tla +11 -0
  438. package/repo/skills/statechart/scripts/test/corpus/PickWorker/chart.mmd +5 -0
  439. package/repo/skills/statechart/scripts/test/corpus/PickWorker/graph.dot +11 -0
  440. package/repo/skills/statechart/scripts/test/corpus/PickWorker/report.md +7 -0
  441. package/repo/skills/statechart/scripts/test/corpus/PickWorker/sany.out +5 -0
  442. package/repo/skills/statechart/scripts/test/corpus/PickWorker/verdict-1.out +70 -0
  443. package/repo/skills/statechart/scripts/test/corpus/Shadow/ChartRun.out +61 -0
  444. package/repo/skills/statechart/scripts/test/corpus/Shadow/Shadow.cfg +4 -0
  445. package/repo/skills/statechart/scripts/test/corpus/Shadow/Shadow.tla +11 -0
  446. package/repo/skills/statechart/scripts/test/corpus/Shadow/ShadowLib.tla +6 -0
  447. package/repo/skills/statechart/scripts/test/corpus/Shadow/ShadowSub.tla +3 -0
  448. package/repo/skills/statechart/scripts/test/corpus/Shadow/chart.mmd +9 -0
  449. package/repo/skills/statechart/scripts/test/corpus/Shadow/graph.dot +16 -0
  450. package/repo/skills/statechart/scripts/test/corpus/Shadow/report.md +8 -0
  451. package/repo/skills/statechart/scripts/test/corpus/Shadow/sany.out +4 -0
  452. package/repo/skills/statechart/scripts/test/corpus/Shadow/verdict-1.out +65 -0
  453. package/repo/skills/statechart/scripts/test/corpus/SpacedNames/ChartRun.out +59 -0
  454. package/repo/skills/statechart/scripts/test/corpus/SpacedNames/SpacedNames.cfg +2 -0
  455. package/repo/skills/statechart/scripts/test/corpus/SpacedNames/SpacedNames.tla +9 -0
  456. package/repo/skills/statechart/scripts/test/corpus/SpacedNames/chart.mmd +23 -0
  457. package/repo/skills/statechart/scripts/test/corpus/SpacedNames/graph.dot +17 -0
  458. package/repo/skills/statechart/scripts/test/corpus/SpacedNames/report.md +15 -0
  459. package/repo/skills/statechart/scripts/test/corpus/SpacedNames/sany.out +1 -0
  460. package/repo/skills/statechart/scripts/test/corpus/SpacedNames/verdict-1.exit +1 -0
  461. package/repo/skills/statechart/scripts/test/corpus/SpacedNames/verdict-1.out +65 -0
  462. package/repo/skills/statechart/scripts/test/corpus/SpacedNames/verdict-2.exit +1 -0
  463. package/repo/skills/statechart/scripts/test/corpus/SpacedNames/verdict-2.out +75 -0
  464. package/repo/skills/statechart/scripts/test/corpus/TwoPhase/ChartRun.out +69 -0
  465. package/repo/skills/statechart/scripts/test/corpus/TwoPhase/TwoPhase.cfg +3 -0
  466. package/repo/skills/statechart/scripts/test/corpus/TwoPhase/TwoPhase.tla +75 -0
  467. package/repo/skills/statechart/scripts/test/corpus/TwoPhase/chart.mmd +60 -0
  468. package/repo/skills/statechart/scripts/test/corpus/TwoPhase/graph.dot +297 -0
  469. package/repo/skills/statechart/scripts/test/corpus/TwoPhase/report.md +20 -0
  470. package/repo/skills/statechart/scripts/test/corpus/TwoPhase/sany.out +1 -0
  471. package/repo/skills/statechart/scripts/test/corpus/TwoPhase/verdict-1.exit +1 -0
  472. package/repo/skills/statechart/scripts/test/corpus/TwoPhase/verdict-1.out +95 -0
  473. package/repo/skills/statechart/scripts/test/corpus/TwoPhase/verdict-2.out +57 -0
  474. package/repo/skills/statechart/scripts/test/corpus/TwoPhase/view.mjs +1 -0
  475. package/repo/skills/statechart/scripts/test/corpus/TwoPhaseFixed/ChartRun.out +57 -0
  476. package/repo/skills/statechart/scripts/test/corpus/TwoPhaseFixed/TwoPhaseFixed.cfg +3 -0
  477. package/repo/skills/statechart/scripts/test/corpus/TwoPhaseFixed/TwoPhaseFixed.tla +75 -0
  478. package/repo/skills/statechart/scripts/test/corpus/TwoPhaseFixed/chart.mmd +37 -0
  479. package/repo/skills/statechart/scripts/test/corpus/TwoPhaseFixed/graph.dot +223 -0
  480. package/repo/skills/statechart/scripts/test/corpus/TwoPhaseFixed/report.md +11 -0
  481. package/repo/skills/statechart/scripts/test/corpus/TwoPhaseFixed/sany.out +1 -0
  482. package/repo/skills/statechart/scripts/test/corpus/TwoPhaseFixed/verdict-1.out +47 -0
  483. package/repo/skills/statechart/scripts/test/corpus/TwoPhaseFixed/view.mjs +1 -0
  484. package/repo/skills/statechart/scripts/test/corpus/TypeGuard/ChartRun.exit +1 -0
  485. package/repo/skills/statechart/scripts/test/corpus/TypeGuard/ChartRun.out +75 -0
  486. package/repo/skills/statechart/scripts/test/corpus/TypeGuard/TypeGuard.cfg +5 -0
  487. package/repo/skills/statechart/scripts/test/corpus/TypeGuard/TypeGuard.tla +11 -0
  488. package/repo/skills/statechart/scripts/test/corpus/TypeGuard/chart.mmd +18 -0
  489. package/repo/skills/statechart/scripts/test/corpus/TypeGuard/graph.dot +14 -0
  490. package/repo/skills/statechart/scripts/test/corpus/TypeGuard/report.md +29 -0
  491. package/repo/skills/statechart/scripts/test/corpus/TypeGuard/sany.out +2 -0
  492. package/repo/skills/statechart/scripts/test/corpus/TypeGuard/verdict-1.exit +1 -0
  493. package/repo/skills/statechart/scripts/test/corpus/TypeGuard/verdict-1.out +64 -0
  494. package/repo/skills/statechart/scripts/test/corpus/TypeGuard/verdict-2.exit +1 -0
  495. package/repo/skills/statechart/scripts/test/corpus/TypeGuard/verdict-2.out +75 -0
  496. package/repo/skills/statechart/scripts/test/corpus/UserNoDeadlock/ChartRun.out +58 -0
  497. package/repo/skills/statechart/scripts/test/corpus/UserNoDeadlock/UserNoDeadlock.cfg +2 -0
  498. package/repo/skills/statechart/scripts/test/corpus/UserNoDeadlock/UserNoDeadlock.tla +8 -0
  499. package/repo/skills/statechart/scripts/test/corpus/UserNoDeadlock/chart.mmd +22 -0
  500. package/repo/skills/statechart/scripts/test/corpus/UserNoDeadlock/graph.dot +16 -0
  501. package/repo/skills/statechart/scripts/test/corpus/UserNoDeadlock/report.md +15 -0
  502. package/repo/skills/statechart/scripts/test/corpus/UserNoDeadlock/sany.out +2 -0
  503. package/repo/skills/statechart/scripts/test/corpus/UserNoDeadlock/verdict-1.exit +1 -0
  504. package/repo/skills/statechart/scripts/test/corpus/UserNoDeadlock/verdict-1.out +56 -0
  505. package/repo/skills/statechart/scripts/test/corpus/UserNoDeadlock/verdict-2.exit +1 -0
  506. package/repo/skills/statechart/scripts/test/corpus/UserNoDeadlock/verdict-2.out +77 -0
  507. package/repo/skills/statechart/scripts/test/corpus.test.ts +441 -0
  508. package/repo/skills/statechart/scripts/test/differential.test.ts +565 -0
  509. package/repo/skills/statechart/scripts/test/drawn.ts +20 -0
  510. package/repo/skills/statechart/scripts/test/grid/Grid.cfg +2 -0
  511. package/repo/skills/statechart/scripts/test/grid/Grid.tla +9 -0
  512. package/repo/skills/statechart/scripts/test/grid/sany.out +2 -0
  513. package/repo/skills/statechart/scripts/test/java.ts +63 -0
  514. package/repo/skills/statechart/scripts/test/labels.ts +648 -0
  515. package/repo/skills/statechart/scripts/test/messages.test.ts +226 -0
  516. package/repo/skills/statechart/scripts/test/pipeline.test.ts +270 -0
  517. package/repo/skills/statechart/scripts/test/plain-tlc.test.ts +255 -0
  518. package/repo/skills/statechart/scripts/test/render.test.ts +145 -0
  519. package/repo/skills/statechart/scripts/test/tlc-out.test.ts +90 -0
  520. package/repo/skills/statechart/scripts/test/tlc.ts +158 -0
  521. package/repo/skills/statechart/scripts/tsconfig.json +11 -0
  522. package/repo/skills/statechart/scripts/worker.ts +35 -0
  523. package/repo/skills/swarm/SKILL.md +43 -0
  524. package/repo/skills/tdd/SKILL.md +42 -0
  525. package/repo/skills/teach/SKILL.md +21 -0
  526. package/repo/skills/technical-writing/SKILL.md +70 -0
  527. package/repo/skills/typescript-best-practices/SKILL.md +31 -0
  528. package/repo/skills/typescript-best-practices/references/patterns.md +328 -0
  529. package/repo/skills/unslop/SKILL.md +40 -0
  530. package/repo/skills/why/SKILL.md +9 -0
  531. package/scripts/check-zh.mjs +35 -0
  532. package/scripts/preview.mjs +233 -0
  533. package/scripts/sync-skills.mjs +100 -0
  534. package/src/board.js +312 -0
  535. package/src/catalog.js +273 -0
  536. package/src/client.js +822 -0
  537. package/src/host.js +305 -0
  538. package/src/i18n.js +117 -0
  539. package/src/suggest.js +244 -0
  540. package/src/tools.js +341 -0
  541. package/zh/architect.md +5 -0
  542. package/zh/arena.md +42 -0
  543. package/zh/automate-me.md +105 -0
  544. package/zh/benchmark-checklist.md +33 -0
  545. package/zh/blast-radius.md +44 -0
  546. package/zh/bro.md +1 -0
  547. package/zh/correct.md +26 -0
  548. package/zh/create-formal-verification-skill.md +37 -0
  549. package/zh/create-verification-skill.md +38 -0
  550. package/zh/figure-it-out.md +46 -0
  551. package/zh/how.md +15 -0
  552. package/zh/in-your-own-words.md +1 -0
  553. package/zh/interrogate.md +25 -0
  554. package/zh/ketchup-video.md +23 -0
  555. package/zh/ketchup.md +37 -0
  556. package/zh/maintain-formal-verification-skill.md +52 -0
  557. package/zh/maintain-verification-skill.md +33 -0
  558. package/zh/make-bot-ui.md +107 -0
  559. package/zh/no-comments.md +18 -0
  560. package/zh/poteto-help.md +156 -0
  561. package/zh/poteto-mode.md +114 -0
  562. package/zh/principle-attack-the-premise.md +9 -0
  563. package/zh/principle-boundary-discipline.md +5 -0
  564. package/zh/principle-build-the-lever.md +8 -0
  565. package/zh/principle-encode-lessons-in-structure.md +5 -0
  566. package/zh/principle-exhaust-the-design-space.md +3 -0
  567. package/zh/principle-experience-first.md +13 -0
  568. package/zh/principle-explain-the-number.md +8 -0
  569. package/zh/principle-fix-root-causes.md +8 -0
  570. package/zh/principle-foundational-thinking.md +7 -0
  571. package/zh/principle-guard-the-context-window.md +6 -0
  572. package/zh/principle-laziness-protocol.md +4 -0
  573. package/zh/principle-make-operations-idempotent.md +9 -0
  574. package/zh/principle-migrate-callers-then-delete-legacy-apis.md +8 -0
  575. package/zh/principle-minimize-reader-load.md +9 -0
  576. package/zh/principle-model-the-domain.md +9 -0
  577. package/zh/principle-never-block-on-the-human.md +9 -0
  578. package/zh/principle-outcome-oriented-execution.md +15 -0
  579. package/zh/principle-prove-it-works.md +5 -0
  580. package/zh/principle-redesign-from-first-principles.md +10 -0
  581. package/zh/principle-separate-before-serializing-shared-state.md +5 -0
  582. package/zh/principle-sequence-verifiable-units.md +7 -0
  583. package/zh/principle-subtract-before-you-add.md +12 -0
  584. package/zh/principle-test-behavior-not-implementation.md +10 -0
  585. package/zh/principle-type-system-discipline.md +9 -0
  586. package/zh/recall.md +35 -0
  587. package/zh/reflect.md +11 -0
  588. package/zh/setup-pstack.md +81 -0
  589. package/zh/sharpen.md +10 -0
  590. package/zh/show-me-your-work.md +76 -0
  591. package/zh/statechart.md +76 -0
  592. package/zh/swarm.md +37 -0
  593. package/zh/tdd.md +36 -0
  594. package/zh/teach.md +15 -0
  595. package/zh/technical-writing.md +64 -0
  596. package/zh/typescript-best-practices.md +24 -0
  597. package/zh/unslop.md +34 -0
  598. package/zh/why.md +3 -0
@@ -0,0 +1,233 @@
1
+ // 把右栏面板渲染成一张静态 HTML,用来肉眼看样式(不改产品代码,只是照 client.js 跑一遍)。
2
+ // 用法:node scripts/preview.mjs [/tmp/psp-preview.html]
3
+ // 假 React 与 test/client.test.mjs 同款:useEffect 立即执行,于是列表能真的渲染出来。
4
+ import { writeFile } from 'node:fs/promises'
5
+ import { readFile } from 'node:fs/promises'
6
+
7
+ import { mkdtemp, rm } from 'node:fs/promises'
8
+ import { tmpdir } from 'node:os'
9
+ import { join } from 'node:path'
10
+
11
+ import {
12
+ addProgress,
13
+ blockersOf,
14
+ childrenOf,
15
+ conflictsOf,
16
+ frontierOf,
17
+ graph,
18
+ loadBoard,
19
+ mapOf,
20
+ mapSections,
21
+ nextOf,
22
+ recommend,
23
+ saveCard,
24
+ } from '../src/board.js'
25
+ import { suggest } from '../src/suggest.js'
26
+ import { buildCatalog, RANK } from '../src/catalog.js'
27
+ import { zhOf, GROUP_ZH } from '../src/i18n.js'
28
+
29
+ const code = await readFile(new URL('../src/client.js', import.meta.url), 'utf8')
30
+
31
+ const React = {
32
+ createElement(type, props, ...kids) {
33
+ return { type, props: props || {}, children: kids.flat(Infinity).filter((k) => k != null && k !== false && k !== true) }
34
+ },
35
+ useState: (init) => [typeof init === 'function' ? init() : init, () => {}],
36
+ useEffect: (fn) => { fn() },
37
+ useRef: (init) => ({ current: init }),
38
+ Fragment: 'Fragment',
39
+ }
40
+
41
+ const esc = (s) => String(s).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;')
42
+ const kebab = (k) => k.replace(/[A-Z]/g, (c) => '-' + c.toLowerCase())
43
+ const UNITLESS = new Set(['zIndex', 'opacity', 'flex', 'flexGrow', 'flexShrink', 'fontWeight', 'lineHeight', 'order', 'zoom'])
44
+ const styleAttr = (style) => Object.entries(style || {})
45
+ .map(([k, v]) => `${kebab(k)}:${typeof v === 'number' && !UNITLESS.has(k) ? v + 'px' : v}`)
46
+ .join(';')
47
+
48
+ function toHTML(node) {
49
+ if (node == null || node === false) return ''
50
+ if (typeof node === 'string' || typeof node === 'number') return esc(node)
51
+ if (Array.isArray(node)) return node.map(toHTML).join('')
52
+ if (typeof node.type === 'function') return toHTML(node.type(node.props))
53
+ const tag = node.type === 'Fragment' ? null : node.type
54
+ const kids = toHTML(node.children)
55
+ if (!tag) return kids
56
+ const attrs = []
57
+ // SVG 的形状全靠属性吃饭:x/y/width/d/... 得原样透出去,不然截图里是一堆空壳
58
+ for (const [k, v] of Object.entries(node.props || {})) {
59
+ if (k === 'style' || k === 'children' || k === 'key' || k === 'onClick' || v == null) continue
60
+ attrs.push(`${k}="${esc(String(v))}"`)
61
+ }
62
+ if (node.props.style) attrs.push(`style="${esc(styleAttr(node.props.style))}"`)
63
+ return `<${tag}${attrs.length ? ' ' + attrs.join(' ') : ''}>${kids}</${tag}>`
64
+ }
65
+
66
+ // 真目录,只截前若干条,够看样式
67
+ const cat = await buildCatalog()
68
+ const groupOf = {}
69
+ for (const [g, names] of Object.entries(cat.groups)) for (const n of names) groupOf[n] = g
70
+ const groups = cat.groups
71
+ const payload = {
72
+ ok: true,
73
+ value: {
74
+ version: cat.version,
75
+ driftOk: true,
76
+ drift: [],
77
+ groups,
78
+ skills: cat.skills.map((s) => ({ ...s, group: groupOf[s.name], zh: zhOf(s), rank: RANK })),
79
+ groupZh: GROUP_ZH,
80
+ },
81
+ }
82
+
83
+ // 看板要有个项目目录才画得出来:临时造一个,塞几张真卡
84
+ const proj = await mkdtemp(join(tmpdir(), 'pstack-preview-'))
85
+ const seed = async () => {
86
+ const map = await saveCard(proj, {
87
+ kind: 'map',
88
+ title: '把导出改成流式',
89
+ body: '## 去向\n大文件导出不再 OOM,边读边写\n\n## 已经定了\n用 node 的 stream;先只做 CSV\n\n## 还没想清\n断点续传要不要一起做\n\n## 不做什么\n这版不碰 Excel\n',
90
+ })
91
+ const idea = await saveCard(proj, { kind: 'idea', title: '把导出改成流式的,别一次读进内存', body: '大文件导出会 OOM,想边读边写。', parent: map.id, scope: ['src/export'] })
92
+ const bug = await saveCard(proj, { kind: 'bug', title: '登录后偶发 401,刷新一次就好', body: '只在 Safari 上复现。' })
93
+ await addProgress(proj, bug.id, '抓到请求头里少了 cookie', 'doing')
94
+ const task = await saveCard(proj, { kind: 'task', title: '给看板加列筛选', after: [bug.id], parent: map.id, scope: ['src/export/stream.ts'] })
95
+ const after = await saveCard(proj, { kind: 'task', title: '筛选做好后再加排序', after: [task.id] })
96
+ const done = await saveCard(proj, { kind: 'task', title: '把技能正文翻成中文' })
97
+ await addProgress(proj, done.id, '58 篇全齐', 'done')
98
+ const dropped = await saveCard(proj, { kind: 'idea', title: '顺手做个移动端', after: [idea.id] })
99
+ await addProgress(proj, dropped.id, '这版不做', 'dropped')
100
+ }
101
+ await seed()
102
+ const boardView = async () => {
103
+ const b = await loadBoard(proj)
104
+ const cards = b.cards.map((c) => ({
105
+ ...c,
106
+ next: recommend(c, b.cards),
107
+ blocked: blockersOf(c, b.cards),
108
+ children: childrenOf(b.cards, c.id).length,
109
+ }))
110
+ const map = mapOf(b.cards)
111
+ return {
112
+ cwd: proj,
113
+ dir: b.dir,
114
+ cards,
115
+ next: nextOf(cards),
116
+ graph: graph(b.cards),
117
+ frontier: frontierOf(b.cards).map((c) => c.id),
118
+ conflicts: conflictsOf(b.cards),
119
+ map: map ? { id: map.id, title: map.title, sections: mapSections(map), children: childrenOf(b.cards, map.id).length } : null,
120
+ }
121
+ }
122
+
123
+ let loaded = null
124
+ const win = {
125
+ __ModuleLoader__: {
126
+ load({ id, factory }) {
127
+ loaded = { id, exports: factory((n) => (n === 'react' ? React : (() => { throw new Error('no module ' + n) })())) }
128
+ },
129
+ },
130
+ }
131
+ new Function('window', code)(win)
132
+
133
+ const slots = []
134
+ const ctx = {
135
+ get(name) {
136
+ if (name === 'slots') return { register: (def, Comp) => slots.push({ def, Comp }), inject: (_n, fn) => fn() }
137
+ if (name === 'sidebarRightTabs') return { register: () => () => {} }
138
+ if (name === 'connection') {
139
+ return {
140
+ rpc: {
141
+ call: (_channel, _endpoint, req) => {
142
+ if (req && req.method === 'skill') {
143
+ const n = req.payload.name
144
+ // 路由把 ok/value 拆开后返回,客户端 rpc() 只拿 value
145
+ // 照 hosts.js 的样子去掉 frontmatter,并带上中文正文
146
+ return Promise.all([
147
+ readFile(new URL(`../repo/skills/${n}/SKILL.md`, import.meta.url), 'utf8'),
148
+ readFile(new URL(`../zh/${n}.md`, import.meta.url), 'utf8').catch(() => ''),
149
+ ]).then(([body, bodyZh]) => ({
150
+ ok: true,
151
+ value: {
152
+ ok: true,
153
+ ...cat.skills.find((x) => x.name === n),
154
+ body: body.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n/, ''),
155
+ bodyZh,
156
+ },
157
+ }))
158
+ }
159
+ if (req && req.method === 'board') return boardView().then((value) => ({ ok: true, value }))
160
+ if (req && req.method === 'suggest') return suggest({ cwd: proj, roots: [] }).then((value) => ({ ok: true, value }))
161
+ return Promise.resolve(payload)
162
+ },
163
+ },
164
+ }
165
+ }
166
+ return undefined
167
+ },
168
+ }
169
+ loaded.exports.apply(ctx)
170
+
171
+ const Panel = slots[0].Comp
172
+ // 目录是异步取回来的:先渲染一次触发请求,等它落定后再渲染一次,才看得到列表。
173
+ const render = () => toHTML(React.createElement(Panel, { sessionId: 'preview' }))
174
+ render()
175
+ await new Promise((r) => setTimeout(r, 300))
176
+
177
+ // 可选第二参数:`board` 切到看板;其他值当成技能名点开详情
178
+ const openName = process.argv[3]
179
+ if (openName === 'board' || openName === 'flow' || openName === 'drill') {
180
+ const tree = React.createElement(Panel, { sessionId: 'preview' })
181
+ const walk = (node, label = '看板') => {
182
+ if (!node || typeof node !== 'object') return false
183
+ if (Array.isArray(node)) return node.some((n) => walk(n, label))
184
+ if (typeof node.type === 'function') return walk(node.type(node.props), label)
185
+ const kids = node.children || []
186
+ // 文本可能包在子节点里(SVG 的 <text> 就是),所以除了直接相等也认「子树里有这句话」
187
+ const flat = (n) => (Array.isArray(n) ? n.map(flat).join('') : typeof n === 'string' ? n : n && n.children ? flat(n.children) : '')
188
+ if (node.props && typeof node.props.onClick === 'function' && (kids.includes(label) || flat(kids).includes(label))) {
189
+ node.props.onClick()
190
+ return true
191
+ }
192
+ return walk(kids, label)
193
+ }
194
+ walk(tree)
195
+ await new Promise((r) => setTimeout(r, 300))
196
+ if (openName === 'flow' || openName === 'drill') {
197
+ walk(React.createElement(Panel, { sessionId: 'preview' }), '流程')
198
+ await new Promise((r) => setTimeout(r, 200))
199
+ }
200
+ if (openName === 'drill') {
201
+ // 点第一格节点,看下钻出来的命令和「标记完成」
202
+ walk(React.createElement(Panel, { sessionId: 'preview' }), '登录后偶发 …')
203
+ await new Promise((r) => setTimeout(r, 200))
204
+ }
205
+ }
206
+ if (openName && openName !== 'board' && openName !== 'flow' && openName !== 'drill') {
207
+ const seen = new Set()
208
+ const click = (node) => {
209
+ if (!node || typeof node !== 'object') return false
210
+ if (Array.isArray(node)) return node.some(click)
211
+ if (typeof node.type === 'function') return click(node.type(node.props))
212
+ const text = JSON.stringify(node.children || [])
213
+ if (node.props && typeof node.props.onClick === 'function' && text.includes('/' + openName) && !seen.has(node)) {
214
+ seen.add(node)
215
+ node.props.onClick()
216
+ return true
217
+ }
218
+ return click(node.children)
219
+ }
220
+ click(JSON.parse(JSON.stringify({ type: 'div', props: {}, children: [] })))
221
+ // 上面那份是空壳,真正的树要重新渲染才有 onClick
222
+ const tree = React.createElement(Panel, { sessionId: 'preview' })
223
+ click(tree)
224
+ await new Promise((r) => setTimeout(r, 200))
225
+ }
226
+ const body = render()
227
+ // 模拟右栏:深色底 + 400px 宽的面板
228
+ const html = `<!doctype html><html><meta charset="utf-8"><title>pstack 面板预览</title>
229
+ <style>html,body{margin:0;overflow:hidden;height:100%;background:#0d0f13}</style>
230
+ <body><div style="width:400px;min-height:1000px">${body}</div></body></html>`
231
+ const out = process.argv[2] || '/tmp/psp-preview.html'
232
+ await writeFile(out, html)
233
+ console.log(out, html.length, 'bytes')
@@ -0,0 +1,100 @@
1
+ #!/usr/bin/env node
2
+ // pstack 仓库 → ~/.dsh/skills 单向同步。
3
+ //
4
+ // 为什么需要它:DSH 的 `/` 菜单读的是 ~/.dsh/skills 里的副本,而面板和工具读的是
5
+ // repo/skills 里的源。两边不一致时,面板说「有」,实际跑起来的是旧版。
6
+ //
7
+ // 用法:
8
+ // node scripts/sync-skills.mjs 同步,并列出改了什么
9
+ // node scripts/sync-skills.mjs --dry 只看差异,不动文件
10
+ // node scripts/sync-skills.mjs --remove 顺带删掉 ~/.dsh/skills 里仓库已不存在的技能
11
+ //
12
+ // 只碰仓库里出现过的技能名。~/.dsh/skills 里别的技能(手工装的、别的插件的)不碰。
13
+
14
+ import { cp, readdir, readFile, rm, stat } from 'node:fs/promises'
15
+ import { createHash } from 'node:crypto'
16
+ import { homedir } from 'node:os'
17
+ import { join } from 'node:path'
18
+
19
+ import { buildCatalog, repoRoot } from '../src/catalog.js'
20
+
21
+ const args = new Set(process.argv.slice(2))
22
+ const dry = args.has('--dry')
23
+ const remove = args.has('--remove')
24
+
25
+ const root = repoRoot()
26
+ const dest = join(homedir(), '.dsh', 'skills')
27
+
28
+ const cat = await buildCatalog({ root })
29
+ const names = cat.skills.map((s) => s.name)
30
+
31
+ await stat(dest).catch(async () => {
32
+ throw new Error(`目标目录不存在:${dest}(DSH 至少用过一次才会建出来)`)
33
+ })
34
+
35
+ let copied = 0
36
+ let same = 0
37
+ let deleted = 0
38
+
39
+ for (const name of names) {
40
+ const from = join(root, 'skills', name)
41
+ const to = join(dest, name)
42
+ const a = await treeHash(from)
43
+ const b = await treeHash(to)
44
+ if (a && b && a === b) {
45
+ same += 1
46
+ continue
47
+ }
48
+ console.log(`${b ? '更新' : '新增'} ${name}`)
49
+ copied += 1
50
+ if (!dry) {
51
+ await rm(to, { recursive: true, force: true })
52
+ await cp(from, to, { recursive: true, preserveTimestamps: true })
53
+ }
54
+ }
55
+
56
+ if (remove) {
57
+ const here = new Set(names)
58
+ const there = await readdir(dest, { withFileTypes: true })
59
+ for (const e of there) {
60
+ if (!e.isDirectory() && !e.isSymbolicLink()) continue
61
+ if (here.has(e.name)) continue
62
+ // 只删「曾经是 pstack 技能」的目录:有 SKILL.md 且 frontmatter 里能认出 pstack 味道的
63
+ const p = join(dest, e.name, 'SKILL.md')
64
+ const text = await readFile(p, 'utf8').catch(() => '')
65
+ if (!text) continue
66
+ console.log(`删除 ${e.name}(仓库里已没有)`)
67
+ deleted += 1
68
+ if (!dry) await rm(join(dest, e.name), { recursive: true, force: true })
69
+ }
70
+ }
71
+
72
+ const tail = dry ? '(--dry,没有真的写盘)' : ''
73
+ console.log(`\n${names.length} 个技能:${same} 个一致,${copied} 个待写/已写,${deleted} 个删除${tail}`)
74
+
75
+ async function treeHash(dir) {
76
+ const files = await walk(dir)
77
+ if (files === null) return null
78
+ return createHash('sha256').update(files.join('|')).digest('hex')
79
+ }
80
+
81
+ async function walk(dir, prefix = '') {
82
+ let entries
83
+ try {
84
+ entries = await readdir(dir, { withFileTypes: true })
85
+ } catch {
86
+ return null
87
+ }
88
+ const out = []
89
+ for (const e of entries) {
90
+ const p = join(dir, e.name)
91
+ const rel = prefix ? prefix + '/' + e.name : e.name
92
+ if (e.isDirectory()) {
93
+ const sub = await walk(p, rel)
94
+ if (sub) out.push(...sub)
95
+ } else if (e.isFile()) {
96
+ out.push(rel + ':' + createHash('sha256').update(await readFile(p)).digest('hex'))
97
+ }
98
+ }
99
+ return out.sort()
100
+ }
package/src/board.js ADDED
@@ -0,0 +1,312 @@
1
+ // dsh-pstack-deck · 看板层
2
+ //
3
+ // 一个项目一个看板:`<项目>/.pstack/board/<id>-<slug>.md`,一张卡一个文件。
4
+ // 为什么是文件而不是数据库:卡本来就是给人读给人改的东西,git diff 里看得见、
5
+ // 手改不会跟插件打架、换机器拷目录就走。清单每次都现读磁盘,谁都不另存索引。
6
+
7
+ import { mkdir, readdir, readFile, rm, writeFile } from 'node:fs/promises'
8
+ import { join } from 'node:path'
9
+
10
+ import { parseFrontmatter } from './catalog.js'
11
+
12
+ /** 相对项目根的看板目录。 */
13
+ export const BOARD_REL = '.pstack/board'
14
+
15
+ export const KINDS = ['idea', 'bug', 'task', 'map']
16
+ export const STATES = ['idea', 'todo', 'doing', 'done', 'dropped']
17
+
18
+ const STATE_ZH = { idea: '想法', todo: '待办', doing: '在做', done: '完成', dropped: '已废弃' }
19
+ const KIND_ZH = { idea: '想法', bug: '缺陷', task: '任务', map: '地图' }
20
+
21
+ export const stateZh = (s) => STATE_ZH[s] ?? s
22
+ export const kindZh = (k) => KIND_ZH[k] ?? k
23
+
24
+ export function boardRoot(cwd) {
25
+ return join(cwd, BOARD_REL)
26
+ }
27
+
28
+ const slug = (title) => String(title).toLowerCase().replace(/[^a-z0-9\u4e00-\u9fa5]+/g, '-').replace(/^-|-$/g, '').slice(0, 40) || 'card'
29
+ const now = () => new Date().toISOString().replace(/\.\d+Z$/, 'Z')
30
+
31
+ /** 一张卡里的「## 进展」条目。追加,不改写历史。 */
32
+ const progressLines = (body) => (String(body).match(/^- \d{4}-[^\n]*$/gm) ?? [])
33
+
34
+ function stringify(card) {
35
+ const fm = [
36
+ '---',
37
+ `id: ${card.id}`,
38
+ `kind: ${card.kind}`,
39
+ `state: ${card.state}`,
40
+ `title: ${card.title}`,
41
+ `created: ${card.created}`,
42
+ `updated: ${card.updated}`,
43
+ ]
44
+ if (card.skills?.length) fm.push(`skills: ${card.skills.join(', ')}`)
45
+ if (card.after?.length) fm.push(`after: ${card.after.join(', ')}`)
46
+ if (card.parent) fm.push(`parent: ${card.parent}`)
47
+ if (card.owner) fm.push(`owner: ${card.owner}`)
48
+ if (card.scope?.length) fm.push(`scope: ${card.scope.join(', ')}`)
49
+ if (card.verify) fm.push(`verify: ${card.verify}`)
50
+ fm.push('---', '')
51
+ return fm.join('\n') + String(card.body ?? '').replace(/\s+$/, '') + '\n'
52
+ }
53
+
54
+ function toCard(file, text) {
55
+ const { data, body } = parseFrontmatter(text)
56
+ const id = Number(data.id)
57
+ if (!Number.isInteger(id) || id <= 0) return null
58
+ return {
59
+ id,
60
+ file,
61
+ kind: KINDS.includes(data.kind) ? data.kind : 'idea',
62
+ state: STATES.includes(data.state) ? data.state : 'idea',
63
+ title: String(data.title ?? '(无标题)'),
64
+ created: String(data.created ?? ''),
65
+ updated: String(data.updated ?? ''),
66
+ after: String(data.after ?? '')
67
+ .split(',')
68
+ .map((x) => Number(x.trim()))
69
+ .filter((n) => Number.isInteger(n) && n > 0),
70
+ skills: String(data.skills ?? '').split(',').map((s) => s.trim()).filter(Boolean),
71
+ // 并行管控三件套:挂在哪张卡下、谁认领了、这张卡能动哪些路径
72
+ parent: Number(data.parent) > 0 ? Number(data.parent) : undefined,
73
+ owner: String(data.owner ?? '').trim() || undefined,
74
+ scope: String(data.scope ?? '').split(',').map((x) => x.trim()).filter(Boolean),
75
+ verify: String(data.verify ?? '').trim() || undefined,
76
+ body,
77
+ progress: progressLines(body).length,
78
+ }
79
+ }
80
+
81
+ /** 读一整个看板。目录不存在就是空看板,不是错误。 */
82
+ export async function loadBoard(cwd) {
83
+ const dir = boardRoot(cwd)
84
+ let files = []
85
+ try {
86
+ files = (await readdir(dir)).filter((f) => f.endsWith('.md'))
87
+ } catch {
88
+ return { cwd, dir, cards: [] }
89
+ }
90
+ const cards = []
91
+ for (const f of files) {
92
+ try {
93
+ const card = toCard(f, await readFile(join(dir, f), 'utf8'))
94
+ if (card) cards.push(card)
95
+ } catch {
96
+ /* 单个文件坏了不该让整个看板读不出来 */
97
+ }
98
+ }
99
+ cards.sort((a, b) => a.id - b.id)
100
+ return { cwd, dir, cards }
101
+ }
102
+
103
+ /** 写一张卡(新建或更新同一个 id)。返回这张卡。 */
104
+ export async function saveCard(cwd, input) {
105
+ const dir = boardRoot(cwd)
106
+ await mkdir(dir, { recursive: true })
107
+ const board = await loadBoard(cwd)
108
+ const existing = input.id ? board.cards.find((c) => c.id === Number(input.id)) : null
109
+ const id = existing ? existing.id : board.cards.reduce((m, c) => Math.max(m, c.id), 0) + 1
110
+ const card = {
111
+ id,
112
+ kind: KINDS.includes(input.kind) ? input.kind : (existing?.kind ?? 'idea'),
113
+ state: STATES.includes(input.state) ? input.state : (existing?.state ?? 'idea'),
114
+ title: String(input.title ?? existing?.title ?? '').trim() || '(无标题)',
115
+ created: existing?.created || now(),
116
+ updated: now(),
117
+ skills: input.skills ?? existing?.skills ?? [],
118
+ after: input.after !== undefined ? input.after.map(Number).filter((n) => Number.isInteger(n) && n > 0 && n !== id) : (existing?.after ?? []),
119
+ parent: input.parent !== undefined ? (Number(input.parent) > 0 && Number(input.parent) !== id ? Number(input.parent) : undefined) : existing?.parent,
120
+ owner: input.owner !== undefined ? (String(input.owner).trim() || undefined) : existing?.owner,
121
+ scope: input.scope !== undefined ? input.scope.map((x) => String(x).trim()).filter(Boolean) : (existing?.scope ?? []),
122
+ verify: input.verify !== undefined ? (String(input.verify).trim() || undefined) : existing?.verify,
123
+ body: input.body ?? existing?.body ?? '',
124
+ }
125
+ // 标题变了就把文件名跟着改,看板目录在文件管理器里才好认
126
+ const name = `${card.id}-${slug(card.title)}.md`
127
+ const oldPath = existing ? join(dir, existing.file) : null
128
+ await writeFile(join(dir, name), stringify(card), 'utf8')
129
+ if (oldPath && oldPath !== join(dir, name)) await rm(oldPath, { force: true })
130
+ return toCard(name, stringify(card))
131
+ }
132
+
133
+ /** 追加一行进展(带日期),并顺手改状态。 */
134
+ export async function addProgress(cwd, id, note, state) {
135
+ const board = await loadBoard(cwd)
136
+ const card = board.cards.find((c) => c.id === Number(id))
137
+ if (!card) throw new Error(`看板里没有第 ${id} 号卡`)
138
+ const line = `- ${new Date().toISOString().slice(0, 10)} ${state ? `[${stateZh(state)}] ` : ''}${String(note ?? '').trim()}`
139
+ const body = card.body.replace(/\s+$/, '') + (card.body.trim() ? '\n' : '') + line + '\n'
140
+ return saveCard(cwd, { ...card, body, state: state ?? card.state })
141
+ }
142
+
143
+ /**
144
+ * 下一步推荐。纯规则,不调模型:卡的类型和状态决定该用哪个技能,
145
+ * 人一眼能看出为什么,改规则也只改这张表。
146
+ */
147
+ export function recommend(card, cards = []) {
148
+ if (!card) return null
149
+ if (card.state === 'done' || card.state === 'dropped') return null
150
+ if (card.kind === 'map') return null
151
+ // 前置没做完就改它,等于把顺序搞乱——不推荐,先做前置
152
+ if (blockersOf(card, cards).length) return null
153
+ if (card.kind === 'bug') {
154
+ return card.state === 'doing'
155
+ ? { skill: 'correct', why: '这个 bug 修完了:把它变成一条以后不会再犯的规则' }
156
+ : { skill: 'tdd', why: '先写一个会失败的测试,再改代码' }
157
+ }
158
+ // 中文一个字信息量约等于两个字母,按这个折算才不会被「标题只有七个字」骗过去
159
+ const weight = [...String(card.title)].reduce((n, ch) => n + (/[\u4e00-\u9fa5]/.test(ch) ? 2 : 1), 0)
160
+ const vague = weight < 12 && !String(card.body ?? '').trim()
161
+ if (vague) return { skill: 'sharpen', why: '这张卡还太粗:先把要解决的事说具体' }
162
+ if (card.kind === 'idea') {
163
+ const big = cards.filter((c) => c.state !== 'done' && c.state !== 'dropped').length >= 3
164
+ return big
165
+ ? { skill: 'figure-it-out', why: '手上开着的卡已经不少了:先设计一条能审的路线再动手' }
166
+ : { skill: 'figure-it-out', why: '想法落地前先设计一条能审的路线' }
167
+ }
168
+ return card.state === 'doing'
169
+ ? { skill: 'prove-it-works', why: '在做:先证明它能跑,再谈完成' }
170
+ : { skill: 'architect', why: '开工前先画类型和模块边界' }
171
+ }
172
+
173
+ /** 看板的下一步:第一条在做,否则第一条待办/想法。 */
174
+ export function nextOf(cards) {
175
+ const open = cards.filter((c) => c.state !== 'done' && c.state !== 'dropped')
176
+ const pick = open.find((c) => c.state === 'doing') ?? open.find((c) => c.state === 'todo') ?? open[0]
177
+ if (!pick) return null
178
+ return { card: pick, ...recommend(pick, cards) }
179
+ }
180
+
181
+ /**
182
+ * 卡片之间的关系图:谁跟着谁、走到哪了、哪条断了。
183
+ * 拓扑按「最长前置链」分深度,同一层按卡号排——不引布局库,够用就行。
184
+ */
185
+ export function graph(cards) {
186
+ // 地图是上下文不是活:拓扑图里不画它,否则每条线都从它长出来
187
+ cards = cards.filter((c) => c.kind !== 'map')
188
+ const byId = new Map(cards.map((c) => [c.id, c]))
189
+ const edges = []
190
+ for (const c of cards) {
191
+ for (const a of c.after ?? []) if (byId.has(a)) edges.push({ from: a, to: c.id })
192
+ }
193
+ const depth = new Map()
194
+ const depthOf = (id, seen = new Set()) => {
195
+ if (depth.has(id)) return depth.get(id)
196
+ if (seen.has(id)) return 0 // 有环也画得出来,不让它死循环
197
+ seen.add(id)
198
+ const parents = (byId.get(id)?.after ?? []).filter((a) => byId.has(a))
199
+ const d = parents.length ? Math.max(...parents.map((p) => depthOf(p, seen))) + 1 : 0
200
+ depth.set(id, d)
201
+ return d
202
+ }
203
+ const nodes = cards.map((c) => ({ id: c.id, title: c.title, kind: c.kind, state: c.state, depth: depthOf(c.id) }))
204
+ nodes.sort((a, b) => a.depth - b.depth || a.id - b.id)
205
+
206
+ // 每条线 = 一张没有未完成前置的卡,顺着后继走到头
207
+ const succ = new Map()
208
+ for (const e of edges) succ.set(e.from, [...(succ.get(e.from) ?? []), e.to])
209
+ const open = cards.filter((c) => c.state !== 'done' && c.state !== 'dropped')
210
+ const openIds = new Set(open.map((c) => c.id))
211
+ const heads = open.filter((c) => !(c.after ?? []).some((a) => openIds.has(a)))
212
+ const lines = heads.map((h) => {
213
+ const chain = [h.id]
214
+ let cur = h.id
215
+ for (let i = 0; i < 20; i++) {
216
+ const next = (succ.get(cur) ?? []).find((n) => openIds.has(n) && !chain.includes(n))
217
+ if (next === undefined) break
218
+ chain.push(next)
219
+ cur = next
220
+ }
221
+ return chain
222
+ })
223
+ return { nodes, edges, lines, depthMax: Math.max(0, ...nodes.map((n) => n.depth)) }
224
+ }
225
+
226
+ // ── 并行管控 ────────────────────────────────────────────────────────────────
227
+ //
228
+ // 多任务并行只有一个问题:谁在动哪块。这里的四条规矩对应四种打架方式:
229
+ // 1. after(前置没做完就别开工)—— 顺序打架
230
+ // 2. owner(一张卡只有一个认领人/会话)—— 两个人抢同一张卡
231
+ // 3. scope(这张卡允许动的路径)—— 两个人同时改同一个文件
232
+ // 4. frontier(可开工 = 没做完 + 前置齐 + 没人认领)—— 面板只推这些
233
+ //
234
+ // ponytail: scope 用路径前缀比对,不是真正的代码级依赖分析。够挡住 90% 的
235
+ // 手滑;等真出现「改了同目录不同文件也打架」再上 AST。
236
+
237
+ /** 没做完、也没被放弃。 */
238
+ export function isOpen(card) {
239
+ return card.state !== 'done' && card.state !== 'dropped'
240
+ }
241
+
242
+ /** 还在挡着这张卡的前置(做完的、不存在的都不算)。 */
243
+ export function blockersOf(card, cards) {
244
+ const byId = new Map(cards.map((c) => [c.id, c]))
245
+ return (card.after ?? []).filter((id) => byId.has(id) && isOpen(byId.get(id)))
246
+ }
247
+
248
+ /** 可现在开工的卡:没做完、前置齐、没人认领,地图本身不算活。 */
249
+ export function frontierOf(cards) {
250
+ return cards.filter((c) => isOpen(c) && c.kind !== 'map' && !c.owner && blockersOf(c, cards).length === 0)
251
+ }
252
+
253
+ const norm = (p) => String(p).replace(/^\.\//, '').replace(/\/+$/, '')
254
+ const covers = (a, b) => {
255
+ const x = norm(a)
256
+ const y = norm(b)
257
+ return x === y || x.startsWith(y + '/') || y.startsWith(x + '/')
258
+ }
259
+
260
+ /** 正在做的卡里,谁的 scope 撞了;没写 scope 的另列出来当提醒。 */
261
+ export function conflictsOf(cards) {
262
+ const doing = cards.filter((c) => isOpen(c) && c.state === 'doing')
263
+ const pairs = []
264
+ for (let i = 0; i < doing.length; i++) {
265
+ for (let j = i + 1; j < doing.length; j++) {
266
+ const a = doing[i]
267
+ const b = doing[j]
268
+ if (a.owner && b.owner && a.owner === b.owner) continue // 同一个会话自己排,不算打架
269
+ const hit = []
270
+ for (const sa of a.scope ?? []) for (const sb of b.scope ?? []) if (covers(sa, sb)) hit.push(norm(sa) === norm(sb) ? norm(sa) : `${norm(sa)} ↔ ${norm(sb)}`)
271
+ if (hit.length) pairs.push({ a: a.id, b: b.id, paths: [...new Set(hit)] })
272
+ }
273
+ }
274
+ const unscoped = doing.filter((c) => !(c.scope ?? []).length).map((c) => c.id)
275
+ return { pairs, unscoped }
276
+ }
277
+
278
+ /** 地图卡:一块板最多一张,挂着这次要去哪、已经定了什么、还有什么糊着。 */
279
+ export function mapOf(cards) {
280
+ return cards.find((c) => c.kind === 'map' && isOpen(c)) ?? cards.find((c) => c.kind === 'map') ?? null
281
+ }
282
+
283
+ export const MAP_SECTIONS = [
284
+ { key: 'destination', label: '去向' },
285
+ { key: 'decisions', label: '已经定了' },
286
+ { key: 'fog', label: '还没想清' },
287
+ { key: 'out', label: '不做什么' },
288
+ ]
289
+
290
+ /** 把地图正文按小标题切开。缺哪段就是空串,不编。 */
291
+ export function mapSections(card) {
292
+ const out = {}
293
+ // 一行行扫,比一条正则好读:碰到「## 标题」就换段,认得的标题才收
294
+ let cur = null
295
+ for (const line of String(card?.body ?? '').split('\n')) {
296
+ const h = line.match(/^##+\s*(.+?)\s*$/)
297
+ if (h) {
298
+ const hit = MAP_SECTIONS.find((s) => s.label === h[1])
299
+ cur = hit ? hit.key : null
300
+ if (cur) out[cur] = out[cur] ?? []
301
+ continue
302
+ }
303
+ if (cur) out[cur].push(line)
304
+ }
305
+ for (const { key } of MAP_SECTIONS) out[key] = (out[key] ?? []).join('\n').trim()
306
+ return out
307
+ }
308
+
309
+ /** 地图下面挂着的卡。 */
310
+ export function childrenOf(cards, id) {
311
+ return cards.filter((c) => c.parent === Number(id))
312
+ }