dsh-pstack-deck 0.0.0-stage → 0.2.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 (600) hide show
  1. package/README.md +245 -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 +59 -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/dev.mjs +69 -0
  533. package/scripts/preview.mjs +237 -0
  534. package/scripts/sync-skills.mjs +100 -0
  535. package/src/board.js +312 -0
  536. package/src/catalog.js +273 -0
  537. package/src/client.js +859 -0
  538. package/src/host.js +311 -0
  539. package/src/i18n.js +117 -0
  540. package/src/suggest.js +244 -0
  541. package/src/tools.js +341 -0
  542. package/src/update.js +58 -0
  543. package/zh/architect.md +5 -0
  544. package/zh/arena.md +42 -0
  545. package/zh/automate-me.md +105 -0
  546. package/zh/benchmark-checklist.md +33 -0
  547. package/zh/blast-radius.md +44 -0
  548. package/zh/bro.md +1 -0
  549. package/zh/correct.md +26 -0
  550. package/zh/create-formal-verification-skill.md +37 -0
  551. package/zh/create-verification-skill.md +38 -0
  552. package/zh/figure-it-out.md +46 -0
  553. package/zh/how.md +15 -0
  554. package/zh/in-your-own-words.md +1 -0
  555. package/zh/interrogate.md +25 -0
  556. package/zh/ketchup-video.md +23 -0
  557. package/zh/ketchup.md +37 -0
  558. package/zh/maintain-formal-verification-skill.md +52 -0
  559. package/zh/maintain-verification-skill.md +33 -0
  560. package/zh/make-bot-ui.md +107 -0
  561. package/zh/no-comments.md +18 -0
  562. package/zh/poteto-help.md +156 -0
  563. package/zh/poteto-mode.md +114 -0
  564. package/zh/principle-attack-the-premise.md +9 -0
  565. package/zh/principle-boundary-discipline.md +5 -0
  566. package/zh/principle-build-the-lever.md +8 -0
  567. package/zh/principle-encode-lessons-in-structure.md +5 -0
  568. package/zh/principle-exhaust-the-design-space.md +3 -0
  569. package/zh/principle-experience-first.md +13 -0
  570. package/zh/principle-explain-the-number.md +8 -0
  571. package/zh/principle-fix-root-causes.md +8 -0
  572. package/zh/principle-foundational-thinking.md +7 -0
  573. package/zh/principle-guard-the-context-window.md +6 -0
  574. package/zh/principle-laziness-protocol.md +4 -0
  575. package/zh/principle-make-operations-idempotent.md +9 -0
  576. package/zh/principle-migrate-callers-then-delete-legacy-apis.md +8 -0
  577. package/zh/principle-minimize-reader-load.md +9 -0
  578. package/zh/principle-model-the-domain.md +9 -0
  579. package/zh/principle-never-block-on-the-human.md +9 -0
  580. package/zh/principle-outcome-oriented-execution.md +15 -0
  581. package/zh/principle-prove-it-works.md +5 -0
  582. package/zh/principle-redesign-from-first-principles.md +10 -0
  583. package/zh/principle-separate-before-serializing-shared-state.md +5 -0
  584. package/zh/principle-sequence-verifiable-units.md +7 -0
  585. package/zh/principle-subtract-before-you-add.md +12 -0
  586. package/zh/principle-test-behavior-not-implementation.md +10 -0
  587. package/zh/principle-type-system-discipline.md +9 -0
  588. package/zh/recall.md +35 -0
  589. package/zh/reflect.md +11 -0
  590. package/zh/setup-pstack.md +81 -0
  591. package/zh/sharpen.md +10 -0
  592. package/zh/show-me-your-work.md +76 -0
  593. package/zh/statechart.md +76 -0
  594. package/zh/swarm.md +37 -0
  595. package/zh/tdd.md +36 -0
  596. package/zh/teach.md +15 -0
  597. package/zh/technical-writing.md +64 -0
  598. package/zh/typescript-best-practices.md +24 -0
  599. package/zh/unslop.md +34 -0
  600. package/zh/why.md +3 -0
@@ -0,0 +1,500 @@
1
+ import { Buffer } from "node:buffer";
2
+ import { type ChildProcess, execFile, type ExecFileException, spawn } from "node:child_process";
3
+ import { randomBytes } from "node:crypto";
4
+ import fs from "node:fs";
5
+ import os from "node:os";
6
+ import path from "node:path";
7
+ import { inspect } from "node:util";
8
+ import { boundRun, chartRun, configText } from "./backends/cfg.ts";
9
+ import { plainText } from "./backends/plain-text.ts";
10
+ import { readConfig } from "./frontends/config.ts";
11
+ import { parseDot, splitLines } from "./frontends/dot.ts";
12
+ import { readCounterexample, readMarks } from "./frontends/marks.ts";
13
+ import { readMessages } from "./frontends/messages.ts";
14
+ import { initialOnlyProperties, readChecks, readSany, readSpec } from "./frontends/spec.ts";
15
+ import { readTrace } from "./frontends/trace.ts";
16
+ import { type Break, readVerdict } from "./frontends/verdict.ts";
17
+ import {
18
+ type Bug,
19
+ CHART_STATES,
20
+ type CheckResult,
21
+ type ConfigSection,
22
+ hasSection,
23
+ type Lasso,
24
+ LEVEL,
25
+ type Mark,
26
+ must,
27
+ type Outcome,
28
+ type Output,
29
+ PART,
30
+ type Part,
31
+ type Property,
32
+ RERUN_STATES,
33
+ type Rule,
34
+ ruleKey,
35
+ type Stop,
36
+ stateRules,
37
+ type Trace,
38
+ type Verdict,
39
+ } from "./ir.ts";
40
+ import { addPast, deadEnds, finder, lasso, mark } from "./passes/annotate.ts";
41
+ import { pathGraph } from "./passes/paths.ts";
42
+
43
+ export function* fileLines(file: string) {
44
+ const fd = fs.openSync(file, "r");
45
+ try {
46
+ let buf = Buffer.allocUnsafe(PART);
47
+ let kept = 0;
48
+ for (;;) {
49
+ if (kept === buf.length) buf = Buffer.concat([buf], buf.length * 2);
50
+ const n = fs.readSync(fd, buf, kept, buf.length - kept, null);
51
+ if (!n) break;
52
+ const end = kept + n;
53
+ const cut = buf.lastIndexOf(10, end - 1);
54
+ if (cut === -1) {
55
+ kept = end;
56
+ continue;
57
+ }
58
+ yield* splitLines(buf.toString("utf8", 0, cut));
59
+ kept = buf.copy(buf, 0, cut + 1, end);
60
+ }
61
+ yield* splitLines(buf.toString("utf8", 0, kept));
62
+ } finally {
63
+ fs.closeSync(fd);
64
+ }
65
+ }
66
+
67
+ const TLC_TOOL =
68
+ "http:tla2tools[url=https://github.com/tlaplus/tlaplus/releases/download/v1.7.4/tla2tools.jar,checksum=sha256:936a262061c914694dfd669a543be24573c45d5aa0ff20a8b96b23d01e050e88]@1.7.4";
69
+ const JAVA_TOOL = "java@temurin-25";
70
+ export const PINNED_FLAGS = ["-workers", "1", "-fp", "0", "-lncheck", "final"];
71
+ const SANY_ERRORS = /^\*\*\* ?(?:Errors|Abort messages|Parse Error)/m;
72
+
73
+ type ChildResult = {
74
+ status: number | null;
75
+ stdout: string;
76
+ stderr: string;
77
+ error: ExecFileException | undefined;
78
+ };
79
+
80
+ const runChild = (file: string, args: string[], options: { cwd: string; env: NodeJS.ProcessEnv }) =>
81
+ new Promise<ChildResult>((resolve) => {
82
+ execFile(
83
+ file,
84
+ args,
85
+ { encoding: "utf8", maxBuffer: 1 << 30, windowsHide: true, ...options },
86
+ (error, stdout, stderr) =>
87
+ resolve({
88
+ status: error ? (typeof error.code === "number" ? error.code : null) : 0,
89
+ stdout,
90
+ stderr,
91
+ error: typeof error?.code === "string" ? error : undefined,
92
+ }),
93
+ );
94
+ });
95
+
96
+ export const messageOf = (error: unknown) =>
97
+ typeof error === "object" &&
98
+ error !== null &&
99
+ "message" in error &&
100
+ typeof error.message === "string"
101
+ ? error.message
102
+ : inspect(error);
103
+
104
+ const joined = (files: string[]): Output => {
105
+ const fds: number[] = [];
106
+ const sizes: number[] = [];
107
+ for (const f of files) {
108
+ const fd = fs.openSync(f, "r");
109
+ fds.push(fd);
110
+ sizes.push(fs.fstatSync(fd).size);
111
+ }
112
+ return {
113
+ *[Symbol.iterator]() {
114
+ for (let f = 0; f < fds.length; f++)
115
+ for (let pos = 0; pos < sizes[f];) {
116
+ const buf = Buffer.allocUnsafe(Math.min(PART, sizes[f] - pos));
117
+ const n = fs.readSync(fds[f], buf, 0, buf.length, pos);
118
+ if (!n) break;
119
+ pos += n;
120
+ yield buf.subarray(0, n);
121
+ }
122
+ },
123
+ };
124
+ };
125
+
126
+ const utf8 = new TextDecoder("utf-8", { ignoreBOM: true });
127
+
128
+ function* outputLines(output: Output) {
129
+ let rest: Uint8Array = new Uint8Array(0);
130
+ for (const part of output) {
131
+ const buf = rest.length ? Buffer.concat([rest, part]) : part;
132
+ const cut = buf.lastIndexOf(10);
133
+ if (cut === -1) {
134
+ rest = buf;
135
+ continue;
136
+ }
137
+ yield* splitLines(utf8.decode(buf.subarray(0, cut)));
138
+ rest = buf.subarray(cut + 1);
139
+ }
140
+ yield* splitLines(utf8.decode(rest));
141
+ }
142
+
143
+ const messagesOf = (output: Output): Iterable<Part> => ({
144
+ [Symbol.iterator]: () => readMessages(outputLines(output)),
145
+ });
146
+
147
+ type FileResult = {
148
+ status: number | null;
149
+ stdout: string;
150
+ output: Output;
151
+ error: Error | undefined;
152
+ };
153
+
154
+ const runToFiles = (
155
+ file: string,
156
+ args: string[],
157
+ { out, ...options }: { out: string; cwd: string; env: NodeJS.ProcessEnv },
158
+ ) =>
159
+ new Promise<FileResult>((resolve) => {
160
+ const files = [`${out}.stdout`, `${out}.stderr`];
161
+ const fds: number[] = [];
162
+ for (const f of files) fds.push(fs.openSync(f, "w"));
163
+ let child: ChildProcess;
164
+ try {
165
+ child = spawn(file, args, { ...options, stdio: ["ignore", ...fds], windowsHide: true });
166
+ } finally {
167
+ for (const fd of fds) fs.closeSync(fd);
168
+ }
169
+ let error: Error | undefined;
170
+ const settle = (code: number | null) =>
171
+ resolve({
172
+ status: error ? null : code,
173
+ stdout: files[0],
174
+ output: joined(files),
175
+ error,
176
+ });
177
+ child.on("error", (e) => {
178
+ error = e;
179
+ if (child.pid === undefined) settle(null);
180
+ });
181
+ child.on("close", (code) => {
182
+ if (child.pid !== undefined) settle(code);
183
+ });
184
+ });
185
+
186
+ async function findTlc(cwd: string) {
187
+ const { TLA2TOOLS, JAVA } = process.env;
188
+ if (TLA2TOOLS) return { jar: TLA2TOOLS, java: JAVA || "java" };
189
+ const mise = (...args: string[]) =>
190
+ runChild("mise", args, { cwd, env: { ...process.env, MISE_CEILING_PATHS: cwd } });
191
+ const where = () =>
192
+ Promise.all([mise("where", TLC_TOOL), mise("which", "java", "--tool", JAVA_TOOL)]);
193
+ let found = await where();
194
+ if (found.some((r) => r.status !== 0)) {
195
+ const r = await mise("install", JAVA_TOOL, TLC_TOOL);
196
+ if (r.status !== 0)
197
+ throw new Error(
198
+ `Cannot find TLC: mise install failed: ${r.error?.message ?? r.stderr.trim()}\nOr set TLA2TOOLS to the path of tla2tools.jar, and JAVA to a java binary (Java 11 or later).`,
199
+ );
200
+ found = await where();
201
+ }
202
+ return {
203
+ jar: path.join(found[0].stdout.trim(), "tla2tools.jar"),
204
+ java: JAVA || found[1].stdout.trim(),
205
+ };
206
+ }
207
+
208
+ const exitClass = (status: number | null) =>
209
+ status === 0 ? 0 : status === 11 || status === 12 || status === 13 ? 1 : 2;
210
+
211
+ const tail = (r: FileResult) => {
212
+ if (r.error) return r.error.message;
213
+ const kept: string[] = [];
214
+ let size = 0;
215
+ for (const chunk of plainText(messagesOf(r.output))) {
216
+ kept.push(chunk);
217
+ size += chunk.length;
218
+ while (size - kept[0].length >= 1 << 28) size -= kept.shift()!.length;
219
+ }
220
+ return kept.join("").trim().split("\n").slice(-30).join("\n");
221
+ };
222
+
223
+ const firstLines = (text: string) => {
224
+ const lines = text.trim().split("\n");
225
+ if (lines.length > 40) lines.splice(40, Infinity, `... ${lines.length - 40} more lines`);
226
+ return lines.join("\n");
227
+ };
228
+
229
+ const stopOf = (r: FileResult): Stop => {
230
+ const errors: Part[] = [];
231
+ for (const m of r.error ? [] : messagesOf(r.output))
232
+ if (
233
+ typeof m !== "string" &&
234
+ (m.level === LEVEL.ERROR ||
235
+ m.level === LEVEL.TLCBUG ||
236
+ (errors.length && m.level === LEVEL.STATE))
237
+ )
238
+ errors.push(m);
239
+ if (!errors.length) return { status: r.status, message: tail(r) };
240
+ return { status: r.status, message: firstLines([...plainText(errors)].join("")) };
241
+ };
242
+
243
+ const sanyErrors = (r: FileResult) => {
244
+ if (r.error) return undefined;
245
+ const text = [...plainText(messagesOf(r.output))].join("");
246
+ const at = text.search(SANY_ERRORS);
247
+ return at === -1 ? undefined : firstLines(text.slice(at));
248
+ };
249
+
250
+ const names = (rules: Rule[], kind: Rule["kind"]) => {
251
+ const found: string[] = [];
252
+ for (const rule of rules) if (rule.kind === kind) found.push(rule.name);
253
+ return found;
254
+ };
255
+
256
+ const brokenRule = (rules: Rule[], broke: Break) => {
257
+ if (broke.kind === "temporal") return undefined;
258
+ for (const rule of rules)
259
+ if (rule.kind === broke.kind && (broke.kind === "deadlock" || rule.name === broke.name))
260
+ return rule;
261
+ if (broke.kind === "invariant")
262
+ for (const rule of rules) if (rule.kind === "property" && rule.name === broke.name) return rule;
263
+ return undefined;
264
+ };
265
+
266
+ function* only(marks: Iterable<Mark>, rules: Set<string>) {
267
+ for (const { values, broken } of marks) {
268
+ const kept: string[] = [];
269
+ for (const name of broken) if (rules.has(name)) kept.push(name);
270
+ if (kept.length) yield { values, broken: kept };
271
+ }
272
+ }
273
+
274
+ export async function check(specFile: string, configFile: string): Promise<CheckResult> {
275
+ const cfg = readConfig({ file: configFile, text: fs.readFileSync(configFile, "utf8") });
276
+ const checks = readChecks({ configFile, config: cfg });
277
+ const folder = path.dirname(path.resolve(specFile));
278
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), "statechart-"));
279
+ try {
280
+ const tlc = await findTlc(dir);
281
+ const config = (name: string, sections: ConfigSection[], extra: string[]) => {
282
+ fs.writeFileSync(path.join(dir, `${name}.cfg`), configText(sections, extra));
283
+ return [`-metadir`, path.join(dir, `meta-${name}`), "-config", path.join(dir, `${name}.cfg`)];
284
+ };
285
+ const runJava = (name: string, main: string, args: string[], jvm: string[] = []) => {
286
+ const tmp = path.join(dir, `tmp-${name}`);
287
+ fs.mkdirSync(tmp);
288
+ return runToFiles(
289
+ tlc.java,
290
+ [
291
+ `-Djava.io.tmpdir=${tmp}`,
292
+ `-DTLA-Library=${folder}`,
293
+ "-Dstdout.encoding=UTF-8",
294
+ "-Dstderr.encoding=UTF-8",
295
+ ...jvm,
296
+ "-cp",
297
+ tlc.jar,
298
+ main,
299
+ ...args,
300
+ ],
301
+ {
302
+ cwd: dir,
303
+ out: path.join(dir, name),
304
+ env: process.platform === "darwin" ? process.env : { ...process.env, LC_ALL: "C.UTF-8" },
305
+ },
306
+ );
307
+ };
308
+ const xml = await runJava(
309
+ "sany",
310
+ "tla2sany.xml.XMLExporter",
311
+ ["-o", "-I", folder, path.resolve(specFile)],
312
+ ["-XX:TieredStopAtLevel=1"],
313
+ );
314
+ if (xml.status !== 0) {
315
+ const errors = xml.error
316
+ ? undefined
317
+ : sanyErrors(
318
+ await runJava(
319
+ "sany-errors",
320
+ "tla2sany.SANY",
321
+ [path.resolve(specFile)],
322
+ ["-XX:TieredStopAtLevel=1"],
323
+ ),
324
+ );
325
+ throw new Error(
326
+ `SANY could not read ${specFile} (exit ${xml.status}):\n${errors ?? tail(xml)}`,
327
+ );
328
+ }
329
+ const sany = readSany(fs.readFileSync(xml.stdout, "utf8"));
330
+ const module = path.basename(specFile, ".tla");
331
+ const spec = { ...readSpec({ module, sany, checks }), folder };
332
+ const rules = stateRules(spec);
333
+ const all = [...rules];
334
+ for (const name of spec.properties) all.push({ kind: "property", name });
335
+ const verdicts = new Map<string, Verdict>();
336
+ const decide = (rule: Rule, outcome: Outcome, r?: FileResult) =>
337
+ verdicts.set(ruleKey(rule), { rule, outcome, messages: r && messagesOf(r.output) });
338
+ const judge = async () => {
339
+ const groups = [all];
340
+ let first: FileResult | undefined;
341
+ let stop: Stop | undefined;
342
+ const states = { distinct: 0, initial: 0, complete: false, cut: false };
343
+ for (let k = 1; groups.length;) {
344
+ const group: Rule[] = [];
345
+ for (const rule of groups[0]) if (!verdicts.has(ruleKey(rule))) group.push(rule);
346
+ if (first && !group.length) {
347
+ groups.shift();
348
+ continue;
349
+ }
350
+ const name = `verdict-${k++}`;
351
+ const extra: string[] = [];
352
+ const invariants = names(group, "invariant");
353
+ const properties = names(group, "property");
354
+ if (invariants.length) extra.push(`INVARIANT ${invariants.join(" ")}`);
355
+ if (properties.length) extra.push(`PROPERTY ${properties.join(" ")}`);
356
+ const bounded = first !== undefined && !states.complete;
357
+ if (bounded) extra.push("CONSTRAINT ChartBound");
358
+ const r = await runJava(name, "tlc2.TLC", [
359
+ "-tool",
360
+ ...PINNED_FLAGS,
361
+ ...(names(group, "deadlock").length ? [] : ["-deadlock"]),
362
+ ...config(name, spec.written, extra),
363
+ bounded ? "ChartBound" : spec.module,
364
+ ]);
365
+ first ??= r;
366
+ const { broke, distinct, initial } = readVerdict(messagesOf(r.output));
367
+ states.distinct = Math.max(states.distinct, distinct);
368
+ states.initial = Math.max(states.initial, initial);
369
+ const rule = broke && brokenRule(group, broke);
370
+ const cut = bounded && distinct >= RERUN_STATES;
371
+ if (exitClass(r.status) === 2) {
372
+ stop = stopOf(r);
373
+ break;
374
+ } else if (rule) decide(rule, "broken", r);
375
+ else if (cut && (r.status === 0 || broke?.kind === "temporal")) {
376
+ states.cut = true;
377
+ for (const rule of group) decide(rule, "not checked");
378
+ } else if (r.status === 0) {
379
+ states.complete = true;
380
+ for (const rule of group) decide(rule, "holds");
381
+ } else if (broke && properties.length) {
382
+ if (broke.kind === "temporal") {
383
+ states.complete = true;
384
+ for (const rule of group) if (rule.kind !== "property") decide(rule, "holds");
385
+ }
386
+ const pending: Rule[][] = [];
387
+ const rest: Rule[] = [];
388
+ for (const rule of group)
389
+ if (rule.kind === "property") pending.push([rule]);
390
+ else if (!verdicts.has(ruleKey(rule))) rest.push(rule);
391
+ if (pending.length === 1) decide(pending[0][0], "broken", r);
392
+ else groups.splice(0, 1, rest, ...pending);
393
+ } else
394
+ throw new Error(
395
+ `TLC exited ${r.status} on ${specFile}, but its output names no rule that broke:\n${tail(r)}`,
396
+ );
397
+ }
398
+ for (const rule of all) if (!verdicts.has(ruleKey(rule))) decide(rule, "not checked");
399
+ return { first: first!, stop, states };
400
+ };
401
+ fs.writeFileSync(path.join(dir, "ChartBound.tla"), boundRun(spec.module));
402
+ const judged = await judge();
403
+ const exit = exitClass(judged.first.status);
404
+ const failed = (r: FileResult) =>
405
+ new Error(`TLC could not check ${specFile} (exit ${r.status}):\n${stopOf(r).message}`);
406
+ const initialOnly = initialOnlyProperties(sany, spec);
407
+ const propertiesWith = (bugOf: (trace: Trace) => Lasso | undefined) => {
408
+ const properties: Property[] = [];
409
+ for (const rule of all) {
410
+ if (rule.kind !== "property") continue;
411
+ const v = must(verdicts, ruleKey(rule));
412
+ properties.push({
413
+ ...v,
414
+ bug: v.outcome === "broken" && v.messages ? bugOf(readTrace(v.messages)) : undefined,
415
+ initialOnly: initialOnly.has(rule.name),
416
+ });
417
+ }
418
+ return properties;
419
+ };
420
+ if (exit === 2) throw failed(judged.first);
421
+ const checked: Verdict[] = [];
422
+ for (const rule of rules) checked.push(must(verdicts, ruleKey(rule)));
423
+ const common = {
424
+ spec,
425
+ exit,
426
+ stop: judged.stop,
427
+ states: judged.states,
428
+ messages: messagesOf(judged.first.output),
429
+ rules: checked,
430
+ };
431
+ if (judged.states.distinct <= CHART_STATES) {
432
+ const tag = `chart-${randomBytes(16).toString("hex")}`;
433
+ fs.writeFileSync(path.join(dir, "ChartRun.tla"), chartRun(spec, tag));
434
+ const drawn = await runJava("ChartRun", "tlc2.TLC", [
435
+ "-tool",
436
+ ...PINNED_FLAGS,
437
+ "-deadlock",
438
+ ...config("ChartRun", spec.written, ["INVARIANT ChartMark", "CONSTRAINT ChartBudget"]),
439
+ "-dump",
440
+ "dot,actionlabels",
441
+ path.join(dir, "graph"),
442
+ "ChartRun",
443
+ ]);
444
+ const file = path.join(dir, "graph.dot");
445
+ if (!fs.existsSync(file)) throw failed(drawn);
446
+ if (readVerdict(messagesOf(drawn.output)).distinct <= CHART_STATES) {
447
+ const graph = parseDot(fileLines(file));
448
+ const find = finder(graph, spec.variables);
449
+ const drawing = drawn.status === 0 ? undefined : { status: drawn.status };
450
+ const broken = new Set<string>();
451
+ for (const { rule, outcome } of verdicts.values())
452
+ if (rule.kind === "invariant" && outcome === "broken") broken.add(rule.name);
453
+ const marks = only(readMarks(readMessages(fileLines(drawn.stdout)), tag), broken);
454
+ const past = mark(graph, marks, spec.variables, rules, find);
455
+ const excludes = hasSection(spec, "ACTION_CONSTRAINT");
456
+ for (const rule of rules) {
457
+ const { outcome, messages } = must(verdicts, ruleKey(rule));
458
+ if (
459
+ rule.kind === "deadlock" &&
460
+ outcome === "broken" &&
461
+ !drawing &&
462
+ !hasSection(spec, "CONSTRAINT", "ACTION_CONSTRAINT")
463
+ )
464
+ deadEnds(graph, rule);
465
+ if (outcome !== "broken" || !messages) continue;
466
+ const counterexample = readCounterexample(messages);
467
+ if (
468
+ !drawing ||
469
+ lasso(graph, { seq: counterexample, loop: undefined }, spec.variables, find)
470
+ )
471
+ addPast(graph, counterexample, spec.variables, rule, past, excludes, find);
472
+ }
473
+ const properties = propertiesWith((trace) => lasso(graph, trace, spec.variables, find));
474
+ return {
475
+ ...common,
476
+ graph,
477
+ paths: undefined,
478
+ properties,
479
+ drawing,
480
+ };
481
+ }
482
+ }
483
+ const drawn = pathGraph(spec.variables);
484
+ const paths: Bug[] = [];
485
+ for (const rule of rules) {
486
+ const { outcome, messages } = must(verdicts, ruleKey(rule));
487
+ if (outcome === "broken" && messages)
488
+ paths.push(drawn.bug(rule, readCounterexample(messages)));
489
+ }
490
+ return {
491
+ ...common,
492
+ graph: drawn.graph,
493
+ paths,
494
+ properties: propertiesWith(drawn.lasso),
495
+ drawing: undefined,
496
+ };
497
+ } finally {
498
+ fs.rmSync(dir, { recursive: true, force: true });
499
+ }
500
+ }
@@ -0,0 +1,29 @@
1
+ #!/bin/sh
2
+ self=$0
3
+ while [ -L "$self" ]; do
4
+ link=$(readlink "$self")
5
+ case $link in
6
+ /*) self=$link ;;
7
+ *) self=$(dirname "$self")/$link ;;
8
+ esac
9
+ done
10
+ entry=$(dirname "$self")/statechart.ts
11
+ version() {
12
+ command -v "$1" >/dev/null || { echo 0; return; }
13
+ "$1" --version 2>/dev/null | sed -n '1s/[^0-9]*\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1 \2 \3/p' | {
14
+ read -r major minor patch
15
+ echo $((${major:-0} * 1000000 + ${minor:-0} * 1000 + ${patch:-0}))
16
+ }
17
+ }
18
+ node=$(version node)
19
+ if [ "$node" -ge 23006000 ] || { [ "$node" -ge 22018000 ] && [ "$node" -lt 23000000 ]; }; then
20
+ exec node --disable-warning=ExperimentalWarning "$entry" "$@"
21
+ fi
22
+ if [ "$(version bun)" -ge 1001005 ]; then
23
+ exec bun "$entry" "$@"
24
+ fi
25
+ if [ "$(version deno)" -ge 2000000 ]; then
26
+ exec deno run --quiet --no-prompt --allow-read --allow-write --allow-run --allow-env "$entry" "$@"
27
+ fi
28
+ echo "statechart needs Node 22.18 to 22.x, Node 23.6 or later, Bun 1.1.5 or later, or Deno 2.0 or later." >&2
29
+ exit 127
@@ -0,0 +1,165 @@
1
+ #!/usr/bin/env node
2
+ import { type ChildProcess, spawn } from "node:child_process";
3
+ import fs from "node:fs";
4
+ import os from "node:os";
5
+ import path from "node:path";
6
+ import { parseArgs } from "node:util";
7
+ import { killGroup } from "./kill.ts";
8
+ import { messageOf } from "./run.ts";
9
+
10
+ const USAGE = `Usage: statechart SPEC.tla [--config FILE] [--view FILE] [--out DIR]
11
+
12
+ Checks SPEC.tla with TLC and draws its state graph as Mermaid. Above 500 states, the chart
13
+ draws only the paths to the rules that break, and with no rule broken there is no chart.mmd.
14
+ --config FILE TLC config. Default: SPEC.cfg beside the spec.
15
+ --view FILE A module that exports state(vars) and, if you want, step(action, from, to),
16
+ group(vars), colors, and title. state() returns a string for a flat chart, an
17
+ array for parent states, or an object for regions. Default: each state's values.
18
+ colors gives each group blue, orange, purple, yellow, teal, tan, or pink.
19
+ --out DIR Where to write report.md, chart.mmd, tlc.out, and tlc-RULE.out for each
20
+ property that breaks and each rule that breaks off the chart. The folder must
21
+ be new or empty. Default: SPEC-chart.
22
+ Exit code: TLC's own on the config as written: 0 when every rule holds, 1 when a rule breaks,
23
+ and 2 when TLC stops with an error, a signal kills the check, or the command cannot run. 130 or
24
+ 143 when SIGINT or SIGTERM stops the check. Only exits 0 and 1 write output.`;
25
+
26
+ let stop: NodeJS.Signals | undefined;
27
+ const stopped = new Promise<void>((resolve) => {
28
+ for (const name of ["SIGINT", "SIGTERM"] as const)
29
+ process.on(name, () => {
30
+ stop ??= name;
31
+ resolve();
32
+ });
33
+ });
34
+
35
+ let flags;
36
+ let specFile;
37
+ try {
38
+ const args = parseArgs({
39
+ allowPositionals: true,
40
+ options: { config: { type: "string" }, view: { type: "string" }, out: { type: "string" } },
41
+ });
42
+ flags = args.values;
43
+ [specFile] = args.positionals;
44
+ if (args.positionals.length !== 1) throw new Error("Give one SPEC.tla.");
45
+ } catch (error) {
46
+ console.error(`${messageOf(error)}\n\n${USAGE}`);
47
+ process.exit(2);
48
+ }
49
+
50
+ const codeOf = (error: unknown) =>
51
+ error instanceof Error && "code" in error ? error.code : undefined;
52
+
53
+ try {
54
+ const configFile = flags.config ?? specFile.replace(/\.tla$/, ".cfg");
55
+ if (!fs.existsSync(configFile))
56
+ throw new Error(`Cannot find the TLC config ${configFile}. Pass --config FILE.`);
57
+ const out = flags.out ?? specFile.replace(/\.tla$/, "-chart");
58
+ let entries: string[] = [];
59
+ let dest: string;
60
+ try {
61
+ entries = fs.readdirSync(out);
62
+ dest = fs.realpathSync(out);
63
+ } catch (error) {
64
+ if (codeOf(error) !== "ENOENT")
65
+ throw new Error(
66
+ `${out} cannot be the output folder. ${messageOf(error)}. Pass --out with a new folder.`,
67
+ { cause: error },
68
+ );
69
+ if (fs.lstatSync(out, { throwIfNoEntry: false }))
70
+ throw new Error(
71
+ `${out} cannot be the output folder. It is a broken link. Pass --out with a new folder.`,
72
+ { cause: error },
73
+ );
74
+ dest = path.resolve(out);
75
+ }
76
+ if (entries.length)
77
+ throw new Error(
78
+ `${out} is not empty. It has ${entries.sort()[0]}. The command writes only to a new or empty folder. Pass --out with a new folder.`,
79
+ );
80
+
81
+ let base = path.dirname(dest);
82
+ while (!fs.existsSync(base)) base = path.dirname(base);
83
+ const stage = fs.mkdtempSync(path.join(base, `.${path.basename(dest)}.statechart-`));
84
+ const done = path.join(stage, "done");
85
+ let tmp: string | undefined;
86
+ let janitor: ChildProcess | undefined;
87
+ let exitCode: number;
88
+ try {
89
+ tmp = fs.mkdtempSync(path.join(os.tmpdir(), "statechart-"));
90
+ const runtime = process.versions.deno
91
+ ? [
92
+ "run",
93
+ "--quiet",
94
+ "--no-prompt",
95
+ "--allow-read",
96
+ "--allow-write",
97
+ "--allow-run",
98
+ "--allow-env",
99
+ ]
100
+ : process.execArgv;
101
+ const worker = spawn(
102
+ process.execPath,
103
+ [
104
+ ...runtime,
105
+ path.join(import.meta.dirname, "worker.ts"),
106
+ stage,
107
+ specFile,
108
+ configFile,
109
+ ...(flags.view ? [flags.view] : []),
110
+ ],
111
+ {
112
+ detached: true,
113
+ stdio: ["ignore", "inherit", "inherit"],
114
+ env: { ...process.env, TMPDIR: tmp, TEMP: tmp, TMP: tmp },
115
+ },
116
+ );
117
+ janitor = spawn(
118
+ process.execPath,
119
+ [...runtime, path.join(import.meta.dirname, "janitor.ts"), String(worker.pid), stage, tmp],
120
+ { detached: true, stdio: ["pipe", "ignore", "ignore"] },
121
+ );
122
+ const toJanitor = janitor.stdin;
123
+ toJanitor?.on("error", () => {});
124
+ const exited = new Promise<number>((resolve) =>
125
+ worker.on("exit", (code) => {
126
+ toJanitor?.write("exited\n");
127
+ resolve(code ?? 2);
128
+ }),
129
+ );
130
+ await Promise.race([stopped, exited]);
131
+ const running = worker.exitCode === null && worker.signalCode === null;
132
+ const groupOutlivesWorker = process.platform !== "win32";
133
+ if (worker.pid !== undefined && (running || groupOutlivesWorker)) await killGroup(worker.pid);
134
+ const verdict = await exited;
135
+ if (stop) {
136
+ console.error(`${stop} stopped the check, so the command wrote nothing.`);
137
+ exitCode = 128 + os.constants.signals[stop];
138
+ } else if (worker.signalCode) {
139
+ console.error(`${worker.signalCode} killed the check, so the command wrote nothing.`);
140
+ exitCode = 2;
141
+ } else if ((verdict === 0 || verdict === 1) && fs.existsSync(done)) {
142
+ fs.mkdirSync(path.dirname(dest), { recursive: true });
143
+ try {
144
+ fs.renameSync(done, dest);
145
+ } catch (error) {
146
+ if (codeOf(error) !== "ENOTEMPTY" && codeOf(error) !== "EEXIST") throw error;
147
+ throw new Error(
148
+ `${path.join(out, fs.readdirSync(dest).sort()[0])} appeared while the check ran, so the command wrote nothing. Pass --out with a new folder.`,
149
+ { cause: error },
150
+ );
151
+ }
152
+ process.stdout.write(fs.readFileSync(path.join(dest, "report.md")));
153
+ console.log(`\nWrote ${out}`);
154
+ exitCode = verdict;
155
+ } else exitCode = 2;
156
+ } finally {
157
+ fs.rmSync(stage, { recursive: true, force: true });
158
+ if (tmp) fs.rmSync(tmp, { recursive: true, force: true });
159
+ janitor?.kill("SIGKILL");
160
+ }
161
+ process.exit(exitCode);
162
+ } catch (error) {
163
+ console.error(messageOf(error));
164
+ process.exit(2);
165
+ }