@justjoshn/pi-pstack 0.0.0-stage → 0.15.36-pi.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +95 -2
- package/agents/comment-sicko.md +32 -0
- package/agents/poteto-agent.md +9 -0
- package/automations/benny/FOR_AGENTS.md +82 -0
- package/automations/benny/README.md +20 -0
- package/automations/benny/skills/reproduce-and-fix-issues/SKILL.md +310 -0
- package/automations/benny/skills/reproduce-and-fix-issues/references/control-adapter.md +169 -0
- package/automations/benny/skills/reproduce-and-fix-issues/references/feature-map.example.md +205 -0
- package/automations/benny/skills/reproduce-and-fix-issues/references/verify-existing-fix.md +93 -0
- package/automations/benny/skills/setup-benny/SKILL.md +253 -0
- package/automations/benny/skills/triage-issue-reports/SKILL.md +240 -0
- package/automations/benny/skills/triage-issue-reports/references/routing.example.md +61 -0
- package/automations/benny/templates/configuration.example.yaml +113 -0
- package/automations/benny/templates/reproduce-automation-prompt.md +49 -0
- package/automations/benny/templates/triage-automation-prompt.md +53 -0
- package/docs/guide/01-setup.md +67 -0
- package/docs/guide/02-poteto-mode.md +139 -0
- package/docs/guide/03-understand.md +79 -0
- package/docs/guide/04-design.md +133 -0
- package/docs/guide/05-build-and-clean.md +83 -0
- package/docs/guide/06-verify-and-ship.md +162 -0
- package/docs/guide/07-overnight.md +122 -0
- package/docs/guide/08-principles.md +72 -0
- package/docs/guide/09-make-it-yours.md +100 -0
- package/docs/guide/10-recipes-and-pitfalls.md +182 -0
- package/docs/guide/README.md +38 -0
- package/docs/guide/images/design.jpg +0 -0
- package/docs/guide/images/overnight.jpg +0 -0
- package/docs/guide/images/recipes.jpg +0 -0
- package/docs/guide/images/router.jpg +0 -0
- package/docs/guide/images/understanding.jpg +0 -0
- package/docs/guide/images/verification.jpg +0 -0
- package/docs/native-gaps.md +67 -0
- package/licenses/cursor-team-kit.LICENSE +21 -0
- package/licenses/pstack.LICENSE +21 -0
- package/package.json +51 -4
- package/scripts/live-e2e.mjs +257 -0
- package/skills/architect/SKILL.md +79 -0
- package/skills/architect/references/design-red-flags.md +57 -0
- package/skills/architect/references/rationale-template.md +35 -0
- package/skills/architect/references/runner-prompt.md +20 -0
- package/skills/arena/SKILL.md +48 -0
- package/skills/automate-me/SKILL.md +104 -0
- package/skills/benchmark-checklist/SKILL.md +39 -0
- package/skills/blast-radius/SKILL.md +50 -0
- package/skills/bro/SKILL.md +7 -0
- package/skills/control-cli/SKILL.md +109 -0
- package/skills/control-ui/SKILL.md +109 -0
- package/skills/correct/SKILL.md +32 -0
- package/skills/create-formal-verification-skill/SKILL.md +43 -0
- package/skills/create-skill/SKILL.md +62 -0
- package/skills/create-verification-skill/SKILL.md +44 -0
- package/skills/create-verification-skill/references/feature-map-example/README.md +47 -0
- package/skills/create-verification-skill/references/feature-map-example/create-note.md +39 -0
- package/skills/create-verification-skill/references/feature-map-example/search.md +45 -0
- package/skills/deslop/SKILL.md +22 -0
- package/skills/figure-it-out/SKILL.md +52 -0
- package/skills/how/SKILL.md +36 -0
- package/skills/how/references/explainer-prompt.md +55 -0
- package/skills/how/references/explorer-prompt.md +35 -0
- package/skills/in-your-own-words/SKILL.md +7 -0
- package/skills/interrogate/SKILL.md +31 -0
- package/skills/ketchup/SKILL.md +43 -0
- package/skills/ketchup-video/SKILL.md +29 -0
- package/skills/maintain-formal-verification-skill/SKILL.md +58 -0
- package/skills/maintain-verification-skill/SKILL.md +39 -0
- package/skills/make-bot-ui/SKILL.md +104 -0
- package/skills/no-comments/SKILL.md +24 -0
- package/skills/poteto-help/SKILL.md +161 -0
- package/skills/poteto-help/references/prompting.md +51 -0
- package/skills/poteto-help/references/recipes.md +51 -0
- package/skills/poteto-mode/SKILL.md +151 -0
- package/skills/poteto-mode/playbooks/authoring-a-skill.md +12 -0
- package/skills/poteto-mode/playbooks/autonomous-run.md +13 -0
- package/skills/poteto-mode/playbooks/autopilot-full.md +25 -0
- package/skills/poteto-mode/playbooks/autopilot-stack.md +8 -0
- package/skills/poteto-mode/playbooks/babysit.md +23 -0
- package/skills/poteto-mode/playbooks/bug-fix.md +15 -0
- package/skills/poteto-mode/playbooks/eval.md +25 -0
- package/skills/poteto-mode/playbooks/feature.md +21 -0
- package/skills/poteto-mode/playbooks/hillclimb.md +21 -0
- package/skills/poteto-mode/playbooks/investigation.md +14 -0
- package/skills/poteto-mode/playbooks/multi-phase-plan.md +155 -0
- package/skills/poteto-mode/playbooks/opening-a-pr.md +34 -0
- package/skills/poteto-mode/playbooks/orchestrate.md +25 -0
- package/skills/poteto-mode/playbooks/pause-safely.md +10 -0
- package/skills/poteto-mode/playbooks/perf-issue.md +25 -0
- package/skills/poteto-mode/playbooks/prototype.md +14 -0
- package/skills/poteto-mode/playbooks/refactoring.md +16 -0
- package/skills/poteto-mode/playbooks/runtime-forensics.md +11 -0
- package/skills/poteto-mode/playbooks/session-pickup.md +11 -0
- package/skills/poteto-mode/playbooks/shipping.md +12 -0
- package/skills/poteto-mode/playbooks/trace-forensics.md +14 -0
- package/skills/poteto-mode/playbooks/visual-parity.md +11 -0
- package/skills/poteto-mode/playbooks/worktree-cleanup.md +12 -0
- package/skills/poteto-mode/references/bugbot-triage.md +142 -0
- package/skills/poteto-mode/scripts/bootstrap.ts +62 -0
- package/skills/poteto-mode/scripts/bun.lock +67 -0
- package/skills/poteto-mode/scripts/check-plan.mjs +205 -0
- package/skills/poteto-mode/scripts/check-plan.test.ts +110 -0
- package/skills/poteto-mode/scripts/package.json +16 -0
- package/skills/poteto-mode/scripts/watch-pr/cli.test.ts +224 -0
- package/skills/poteto-mode/scripts/watch-pr/cli.ts +223 -0
- package/skills/poteto-mode/scripts/watch-pr/fakes.test-helper.ts +129 -0
- package/skills/poteto-mode/scripts/watch-pr/github.test.ts +498 -0
- package/skills/poteto-mode/scripts/watch-pr/github.ts +726 -0
- package/skills/poteto-mode/scripts/watch-pr/policy.test.ts +482 -0
- package/skills/poteto-mode/scripts/watch-pr/policy.ts +842 -0
- package/skills/poteto-mode/scripts/watch-pr/render.ts +169 -0
- package/skills/poteto-mode/scripts/watch-pr/tsconfig.json +13 -0
- package/skills/poteto-mode/scripts/watch-pr/types.compile.ts +93 -0
- package/skills/poteto-mode/scripts/watch-pr/types.ts +414 -0
- package/skills/poteto-mode/scripts/watch-pr/watch-pr +6 -0
- package/skills/poteto-mode/scripts/worktree-audit.sh +156 -0
- package/skills/principle-attack-the-premise/SKILL.md +21 -0
- package/skills/principle-boundary-discipline/SKILL.md +34 -0
- package/skills/principle-build-the-lever/SKILL.md +23 -0
- package/skills/principle-encode-lessons-in-structure/SKILL.md +11 -0
- package/skills/principle-exhaust-the-design-space/SKILL.md +9 -0
- package/skills/principle-experience-first/SKILL.md +19 -0
- package/skills/principle-explain-the-number/SKILL.md +18 -0
- package/skills/principle-fix-root-causes/SKILL.md +21 -0
- package/skills/principle-foundational-thinking/SKILL.md +21 -0
- package/skills/principle-guard-the-context-window/SKILL.md +12 -0
- package/skills/principle-laziness-protocol/SKILL.md +10 -0
- package/skills/principle-make-operations-idempotent/SKILL.md +22 -0
- package/skills/principle-migrate-callers-then-delete-legacy-apis/SKILL.md +14 -0
- package/skills/principle-minimize-reader-load/SKILL.md +18 -0
- package/skills/principle-model-the-domain/SKILL.md +24 -0
- package/skills/principle-never-block-on-the-human/SKILL.md +15 -0
- package/skills/principle-outcome-oriented-execution/SKILL.md +21 -0
- package/skills/principle-prove-it-works/SKILL.md +22 -0
- package/skills/principle-redesign-from-first-principles/SKILL.md +16 -0
- package/skills/principle-separate-before-serializing-shared-state/SKILL.md +16 -0
- package/skills/principle-sequence-verifiable-units/SKILL.md +17 -0
- package/skills/principle-subtract-before-you-add/SKILL.md +18 -0
- package/skills/principle-test-behavior-not-implementation/SKILL.md +20 -0
- package/skills/principle-type-system-discipline/SKILL.md +13 -0
- package/skills/recall/SKILL.md +35 -0
- package/skills/reflect/SKILL.md +69 -0
- package/skills/reflect/references/divergent-reviewer.md +38 -0
- package/skills/reflect/references/judgment-reviewer.md +37 -0
- package/skills/reflect/references/synthesizer.md +56 -0
- package/skills/reflect/references/tooling-reviewer.md +48 -0
- package/skills/setup-pstack/SKILL.md +74 -0
- package/skills/sharpen/SKILL.md +16 -0
- package/skills/show-me-your-work/SKILL.md +82 -0
- package/skills/show-me-your-work/references/decision-log-template.tsv +1 -0
- package/skills/show-me-your-work/scripts/log.sh +42 -0
- package/skills/statechart/SKILL.md +82 -0
- package/skills/statechart/references/render.md +93 -0
- package/skills/statechart/scripts/backends/cfg.ts +33 -0
- package/skills/statechart/scripts/backends/mermaid.ts +201 -0
- package/skills/statechart/scripts/backends/plain-text.ts +72 -0
- package/skills/statechart/scripts/backends/report.ts +177 -0
- package/skills/statechart/scripts/frontends/config.ts +276 -0
- package/skills/statechart/scripts/frontends/dot.ts +74 -0
- package/skills/statechart/scripts/frontends/marks.ts +93 -0
- package/skills/statechart/scripts/frontends/messages.ts +52 -0
- package/skills/statechart/scripts/frontends/spec.ts +114 -0
- package/skills/statechart/scripts/frontends/trace.ts +24 -0
- package/skills/statechart/scripts/frontends/value.ts +166 -0
- package/skills/statechart/scripts/frontends/verdict.ts +40 -0
- package/skills/statechart/scripts/frontends/view.ts +119 -0
- package/skills/statechart/scripts/ir.ts +547 -0
- package/skills/statechart/scripts/package.json +11 -0
- package/skills/statechart/scripts/passes/annotate.ts +128 -0
- package/skills/statechart/scripts/passes/label.ts +269 -0
- package/skills/statechart/scripts/passes/lift.ts +85 -0
- package/skills/statechart/scripts/passes/loop-check.ts +68 -0
- package/skills/statechart/scripts/passes/paths.ts +60 -0
- package/skills/statechart/scripts/passes/reach.ts +135 -0
- package/skills/statechart/scripts/passes/region-check.ts +97 -0
- package/skills/statechart/scripts/passes/regions.ts +295 -0
- package/skills/statechart/scripts/pipeline.ts +76 -0
- package/skills/statechart/scripts/run.ts +481 -0
- package/skills/statechart/scripts/statechart +29 -0
- package/skills/statechart/scripts/statechart.ts +164 -0
- package/skills/statechart/scripts/test/ConfigOracle.java +63 -0
- package/skills/statechart/scripts/test/chart.test.ts +1210 -0
- package/skills/statechart/scripts/test/charts/Braces.mmd +7 -0
- package/skills/statechart/scripts/test/charts/Escapes.mmd +11 -0
- package/skills/statechart/scripts/test/charts/Phases.mmd +29 -0
- package/skills/statechart/scripts/test/cli.test.ts +1314 -0
- package/skills/statechart/scripts/test/config-fuzz.test.ts +263 -0
- package/skills/statechart/scripts/test/corpus/Counter/ChartRun.out +57 -0
- package/skills/statechart/scripts/test/corpus/Counter/Counter.cfg +3 -0
- package/skills/statechart/scripts/test/corpus/Counter/Counter.tla +10 -0
- package/skills/statechart/scripts/test/corpus/Counter/chart.mmd +9 -0
- package/skills/statechart/scripts/test/corpus/Counter/graph.dot +16 -0
- package/skills/statechart/scripts/test/corpus/Counter/report.md +7 -0
- package/skills/statechart/scripts/test/corpus/Counter/sany.out +2 -0
- package/skills/statechart/scripts/test/corpus/Counter/verdict-1.out +49 -0
- package/skills/statechart/scripts/test/corpus/CounterAction/ChartRun.out +60 -0
- package/skills/statechart/scripts/test/corpus/CounterAction/CounterAction.cfg +4 -0
- package/skills/statechart/scripts/test/corpus/CounterAction/CounterAction.tla +22 -0
- package/skills/statechart/scripts/test/corpus/CounterAction/chart.mmd +26 -0
- package/skills/statechart/scripts/test/corpus/CounterAction/graph.dot +19 -0
- package/skills/statechart/scripts/test/corpus/CounterAction/report.md +20 -0
- package/skills/statechart/scripts/test/corpus/CounterAction/sany.out +2 -0
- package/skills/statechart/scripts/test/corpus/CounterAction/verdict-1.exit +1 -0
- package/skills/statechart/scripts/test/corpus/CounterAction/verdict-1.out +56 -0
- package/skills/statechart/scripts/test/corpus/CounterAction/verdict-2.exit +1 -0
- package/skills/statechart/scripts/test/corpus/CounterAction/verdict-2.out +82 -0
- package/skills/statechart/scripts/test/corpus/CounterAction/verdict-3.out +57 -0
- package/skills/statechart/scripts/test/corpus/CounterDeadlock/ChartRun.out +59 -0
- package/skills/statechart/scripts/test/corpus/CounterDeadlock/CounterDeadlock.cfg +3 -0
- package/skills/statechart/scripts/test/corpus/CounterDeadlock/CounterDeadlock.tla +11 -0
- package/skills/statechart/scripts/test/corpus/CounterDeadlock/chart.mmd +22 -0
- package/skills/statechart/scripts/test/corpus/CounterDeadlock/graph.dot +16 -0
- package/skills/statechart/scripts/test/corpus/CounterDeadlock/report.md +17 -0
- package/skills/statechart/scripts/test/corpus/CounterDeadlock/sany.out +2 -0
- package/skills/statechart/scripts/test/corpus/CounterDeadlock/verdict-1.exit +1 -0
- package/skills/statechart/scripts/test/corpus/CounterDeadlock/verdict-1.out +56 -0
- package/skills/statechart/scripts/test/corpus/CounterDeadlock/verdict-2.exit +1 -0
- package/skills/statechart/scripts/test/corpus/CounterDeadlock/verdict-2.out +77 -0
- package/skills/statechart/scripts/test/corpus/CounterFan/ChartRun.out +69 -0
- package/skills/statechart/scripts/test/corpus/CounterFan/CounterFan.cfg +2 -0
- package/skills/statechart/scripts/test/corpus/CounterFan/CounterFan.tla +11 -0
- package/skills/statechart/scripts/test/corpus/CounterFan/chart.mmd +85 -0
- package/skills/statechart/scripts/test/corpus/CounterFan/graph.dot +70 -0
- package/skills/statechart/scripts/test/corpus/CounterFan/report.md +12 -0
- package/skills/statechart/scripts/test/corpus/CounterFan/sany.out +2 -0
- package/skills/statechart/scripts/test/corpus/CounterFan/verdict-1.exit +1 -0
- package/skills/statechart/scripts/test/corpus/CounterFan/verdict-1.out +67 -0
- package/skills/statechart/scripts/test/corpus/CounterFan/verdict-2.out +57 -0
- package/skills/statechart/scripts/test/corpus/CounterGuard/ChartRun.exit +1 -0
- package/skills/statechart/scripts/test/corpus/CounterGuard/ChartRun.out +85 -0
- package/skills/statechart/scripts/test/corpus/CounterGuard/CounterGuard.cfg +6 -0
- package/skills/statechart/scripts/test/corpus/CounterGuard/CounterGuard.tla +13 -0
- package/skills/statechart/scripts/test/corpus/CounterGuard/chart.mmd +5 -0
- package/skills/statechart/scripts/test/corpus/CounterGuard/graph.dot +10 -0
- package/skills/statechart/scripts/test/corpus/CounterGuard/report.md +31 -0
- package/skills/statechart/scripts/test/corpus/CounterGuard/sany.out +2 -0
- package/skills/statechart/scripts/test/corpus/CounterGuard/verdict-1.exit +1 -0
- package/skills/statechart/scripts/test/corpus/CounterGuard/verdict-1.out +64 -0
- package/skills/statechart/scripts/test/corpus/CounterGuard/verdict-2.exit +1 -0
- package/skills/statechart/scripts/test/corpus/CounterGuard/verdict-2.out +77 -0
- package/skills/statechart/scripts/test/corpus/CounterInitPast/ChartRun.out +55 -0
- package/skills/statechart/scripts/test/corpus/CounterInitPast/CounterInitPast.cfg +3 -0
- package/skills/statechart/scripts/test/corpus/CounterInitPast/CounterInitPast.tla +10 -0
- package/skills/statechart/scripts/test/corpus/CounterInitPast/chart.mmd +12 -0
- package/skills/statechart/scripts/test/corpus/CounterInitPast/graph.dot +6 -0
- package/skills/statechart/scripts/test/corpus/CounterInitPast/report.md +12 -0
- package/skills/statechart/scripts/test/corpus/CounterInitPast/sany.out +2 -0
- package/skills/statechart/scripts/test/corpus/CounterInitPast/verdict-1.exit +1 -0
- package/skills/statechart/scripts/test/corpus/CounterInitPast/verdict-1.out +33 -0
- package/skills/statechart/scripts/test/corpus/CounterInitPast/verdict-2.out +54 -0
- package/skills/statechart/scripts/test/corpus/CounterInitPastHolds/ChartRun.out +54 -0
- package/skills/statechart/scripts/test/corpus/CounterInitPastHolds/CounterInitPastHolds.cfg +3 -0
- package/skills/statechart/scripts/test/corpus/CounterInitPastHolds/CounterInitPastHolds.tla +10 -0
- package/skills/statechart/scripts/test/corpus/CounterInitPastHolds/chart.mmd +1 -0
- package/skills/statechart/scripts/test/corpus/CounterInitPastHolds/graph.dot +6 -0
- package/skills/statechart/scripts/test/corpus/CounterInitPastHolds/report.md +7 -0
- package/skills/statechart/scripts/test/corpus/CounterInitPastHolds/sany.out +2 -0
- package/skills/statechart/scripts/test/corpus/CounterInitPastHolds/verdict-1.out +46 -0
- package/skills/statechart/scripts/test/corpus/CounterInstance/ChartRun.out +59 -0
- package/skills/statechart/scripts/test/corpus/CounterInstance/CounterInstance.cfg +2 -0
- package/skills/statechart/scripts/test/corpus/CounterInstance/CounterInstance.tla +10 -0
- package/skills/statechart/scripts/test/corpus/CounterInstance/CounterSteps.tla +6 -0
- package/skills/statechart/scripts/test/corpus/CounterInstance/chart.mmd +17 -0
- package/skills/statechart/scripts/test/corpus/CounterInstance/graph.dot +15 -0
- package/skills/statechart/scripts/test/corpus/CounterInstance/report.md +14 -0
- package/skills/statechart/scripts/test/corpus/CounterInstance/sany.out +3 -0
- package/skills/statechart/scripts/test/corpus/CounterInstance/verdict-1.exit +1 -0
- package/skills/statechart/scripts/test/corpus/CounterInstance/verdict-1.out +78 -0
- package/skills/statechart/scripts/test/corpus/CounterJump/ChartRun.out +59 -0
- package/skills/statechart/scripts/test/corpus/CounterJump/CounterJump.cfg +3 -0
- package/skills/statechart/scripts/test/corpus/CounterJump/CounterJump.tla +19 -0
- package/skills/statechart/scripts/test/corpus/CounterJump/chart.mmd +26 -0
- package/skills/statechart/scripts/test/corpus/CounterJump/graph.dot +22 -0
- package/skills/statechart/scripts/test/corpus/CounterJump/report.md +12 -0
- package/skills/statechart/scripts/test/corpus/CounterJump/sany.out +2 -0
- package/skills/statechart/scripts/test/corpus/CounterJump/verdict-1.exit +1 -0
- package/skills/statechart/scripts/test/corpus/CounterJump/verdict-1.out +58 -0
- package/skills/statechart/scripts/test/corpus/CounterJump/verdict-2.out +57 -0
- package/skills/statechart/scripts/test/corpus/CounterLoop/ChartRun.out +57 -0
- package/skills/statechart/scripts/test/corpus/CounterLoop/CounterLoop.cfg +2 -0
- package/skills/statechart/scripts/test/corpus/CounterLoop/CounterLoop.tla +11 -0
- package/skills/statechart/scripts/test/corpus/CounterLoop/chart.mmd +17 -0
- package/skills/statechart/scripts/test/corpus/CounterLoop/graph.dot +15 -0
- package/skills/statechart/scripts/test/corpus/CounterLoop/report.md +14 -0
- package/skills/statechart/scripts/test/corpus/CounterLoop/sany.out +2 -0
- package/skills/statechart/scripts/test/corpus/CounterLoop/verdict-1.exit +1 -0
- package/skills/statechart/scripts/test/corpus/CounterLoop/verdict-1.out +76 -0
- package/skills/statechart/scripts/test/corpus/CounterOrder/ChartRun.out +59 -0
- package/skills/statechart/scripts/test/corpus/CounterOrder/CounterOrder.cfg +3 -0
- package/skills/statechart/scripts/test/corpus/CounterOrder/CounterOrder.tla +11 -0
- package/skills/statechart/scripts/test/corpus/CounterOrder/chart.mmd +19 -0
- package/skills/statechart/scripts/test/corpus/CounterOrder/graph.dot +10 -0
- package/skills/statechart/scripts/test/corpus/CounterOrder/report.md +15 -0
- package/skills/statechart/scripts/test/corpus/CounterOrder/sany.out +2 -0
- package/skills/statechart/scripts/test/corpus/CounterOrder/verdict-1.exit +1 -0
- package/skills/statechart/scripts/test/corpus/CounterOrder/verdict-1.out +56 -0
- package/skills/statechart/scripts/test/corpus/CounterOrder/verdict-2.exit +1 -0
- package/skills/statechart/scripts/test/corpus/CounterOrder/verdict-2.out +67 -0
- package/skills/statechart/scripts/test/corpus/CounterRules/ChartRun.out +62 -0
- package/skills/statechart/scripts/test/corpus/CounterRules/CounterRules.cfg +6 -0
- package/skills/statechart/scripts/test/corpus/CounterRules/CounterRules.tla +24 -0
- package/skills/statechart/scripts/test/corpus/CounterRules/Moves.tla +5 -0
- package/skills/statechart/scripts/test/corpus/CounterRules/chart.mmd +22 -0
- package/skills/statechart/scripts/test/corpus/CounterRules/graph.dot +10 -0
- package/skills/statechart/scripts/test/corpus/CounterRules/report.md +23 -0
- package/skills/statechart/scripts/test/corpus/CounterRules/sany.out +3 -0
- package/skills/statechart/scripts/test/corpus/CounterRules/verdict-1.exit +1 -0
- package/skills/statechart/scripts/test/corpus/CounterRules/verdict-1.out +58 -0
- package/skills/statechart/scripts/test/corpus/CounterRules/verdict-2.exit +1 -0
- package/skills/statechart/scripts/test/corpus/CounterRules/verdict-2.out +66 -0
- package/skills/statechart/scripts/test/corpus/CounterRules/verdict-3.exit +1 -0
- package/skills/statechart/scripts/test/corpus/CounterRules/verdict-3.out +74 -0
- package/skills/statechart/scripts/test/corpus/CounterRules/verdict-4.out +59 -0
- package/skills/statechart/scripts/test/corpus/CounterStart/ChartRun.out +58 -0
- package/skills/statechart/scripts/test/corpus/CounterStart/CounterStart.cfg +3 -0
- package/skills/statechart/scripts/test/corpus/CounterStart/CounterStart.tla +15 -0
- package/skills/statechart/scripts/test/corpus/CounterStart/chart.mmd +18 -0
- package/skills/statechart/scripts/test/corpus/CounterStart/graph.dot +13 -0
- package/skills/statechart/scripts/test/corpus/CounterStart/report.md +11 -0
- package/skills/statechart/scripts/test/corpus/CounterStart/sany.out +2 -0
- package/skills/statechart/scripts/test/corpus/CounterStart/verdict-1.exit +1 -0
- package/skills/statechart/scripts/test/corpus/CounterStart/verdict-1.out +33 -0
- package/skills/statechart/scripts/test/corpus/CounterStart/verdict-2.out +57 -0
- package/skills/statechart/scripts/test/corpus/CounterStop/ChartRun.out +57 -0
- package/skills/statechart/scripts/test/corpus/CounterStop/CounterStop.cfg +3 -0
- package/skills/statechart/scripts/test/corpus/CounterStop/CounterStop.tla +15 -0
- package/skills/statechart/scripts/test/corpus/CounterStop/chart.mmd +7 -0
- package/skills/statechart/scripts/test/corpus/CounterStop/graph.dot +13 -0
- package/skills/statechart/scripts/test/corpus/CounterStop/report.md +6 -0
- package/skills/statechart/scripts/test/corpus/CounterStop/sany.out +2 -0
- package/skills/statechart/scripts/test/corpus/CounterStop/verdict-1.out +49 -0
- package/skills/statechart/scripts/test/corpus/CounterTie/ChartRun.out +61 -0
- package/skills/statechart/scripts/test/corpus/CounterTie/CounterTie.cfg +4 -0
- package/skills/statechart/scripts/test/corpus/CounterTie/CounterTie.tla +14 -0
- package/skills/statechart/scripts/test/corpus/CounterTie/chart.mmd +30 -0
- package/skills/statechart/scripts/test/corpus/CounterTie/graph.dot +19 -0
- package/skills/statechart/scripts/test/corpus/CounterTie/report.md +27 -0
- package/skills/statechart/scripts/test/corpus/CounterTie/sany.out +2 -0
- package/skills/statechart/scripts/test/corpus/CounterTie/verdict-1.exit +1 -0
- package/skills/statechart/scripts/test/corpus/CounterTie/verdict-1.out +56 -0
- package/skills/statechart/scripts/test/corpus/CounterTie/verdict-2.exit +1 -0
- package/skills/statechart/scripts/test/corpus/CounterTie/verdict-2.out +64 -0
- package/skills/statechart/scripts/test/corpus/CounterTie/verdict-3.exit +1 -0
- package/skills/statechart/scripts/test/corpus/CounterTie/verdict-3.out +87 -0
- package/skills/statechart/scripts/test/corpus/CounterTie/verdict-4.out +57 -0
- package/skills/statechart/scripts/test/corpus/CounterTieInGraph/ChartRun.out +60 -0
- package/skills/statechart/scripts/test/corpus/CounterTieInGraph/CounterTieInGraph.cfg +3 -0
- package/skills/statechart/scripts/test/corpus/CounterTieInGraph/CounterTieInGraph.tla +12 -0
- package/skills/statechart/scripts/test/corpus/CounterTieInGraph/chart.mmd +23 -0
- package/skills/statechart/scripts/test/corpus/CounterTieInGraph/graph.dot +19 -0
- package/skills/statechart/scripts/test/corpus/CounterTieInGraph/report.md +11 -0
- package/skills/statechart/scripts/test/corpus/CounterTieInGraph/sany.out +2 -0
- package/skills/statechart/scripts/test/corpus/CounterTieInGraph/verdict-1.exit +1 -0
- package/skills/statechart/scripts/test/corpus/CounterTieInGraph/verdict-1.out +56 -0
- package/skills/statechart/scripts/test/corpus/CounterTieInGraph/verdict-2.out +57 -0
- package/skills/statechart/scripts/test/corpus/CounterView/ChartRun.out +61 -0
- package/skills/statechart/scripts/test/corpus/CounterView/CounterView.cfg +4 -0
- package/skills/statechart/scripts/test/corpus/CounterView/CounterView.tla +14 -0
- package/skills/statechart/scripts/test/corpus/CounterView/chart.mmd +23 -0
- package/skills/statechart/scripts/test/corpus/CounterView/graph.dot +19 -0
- package/skills/statechart/scripts/test/corpus/CounterView/report.md +27 -0
- package/skills/statechart/scripts/test/corpus/CounterView/sany.out +2 -0
- package/skills/statechart/scripts/test/corpus/CounterView/verdict-1.exit +1 -0
- package/skills/statechart/scripts/test/corpus/CounterView/verdict-1.out +56 -0
- package/skills/statechart/scripts/test/corpus/CounterView/verdict-2.exit +1 -0
- package/skills/statechart/scripts/test/corpus/CounterView/verdict-2.out +64 -0
- package/skills/statechart/scripts/test/corpus/CounterView/verdict-3.exit +1 -0
- package/skills/statechart/scripts/test/corpus/CounterView/verdict-3.out +87 -0
- package/skills/statechart/scripts/test/corpus/CounterView/verdict-4.out +57 -0
- package/skills/statechart/scripts/test/corpus/CounterView/view.mjs +1 -0
- package/skills/statechart/scripts/test/corpus/DieHard/ChartRun.out +59 -0
- package/skills/statechart/scripts/test/corpus/DieHard/DieHard.cfg +4 -0
- package/skills/statechart/scripts/test/corpus/DieHard/DieHard.tla +38 -0
- package/skills/statechart/scripts/test/corpus/DieHard/chart.mmd +92 -0
- package/skills/statechart/scripts/test/corpus/DieHard/graph.dot +126 -0
- package/skills/statechart/scripts/test/corpus/DieHard/report.md +17 -0
- package/skills/statechart/scripts/test/corpus/DieHard/sany.out +2 -0
- package/skills/statechart/scripts/test/corpus/DieHard/verdict-1.exit +1 -0
- package/skills/statechart/scripts/test/corpus/DieHard/verdict-1.out +91 -0
- package/skills/statechart/scripts/test/corpus/DieHard/verdict-2.out +57 -0
- package/skills/statechart/scripts/test/corpus/FirstRule/ChartRun.out +61 -0
- package/skills/statechart/scripts/test/corpus/FirstRule/FirstRule.cfg +6 -0
- package/skills/statechart/scripts/test/corpus/FirstRule/FirstRule.tla +11 -0
- package/skills/statechart/scripts/test/corpus/FirstRule/chart.mmd +22 -0
- package/skills/statechart/scripts/test/corpus/FirstRule/graph.dot +16 -0
- package/skills/statechart/scripts/test/corpus/FirstRule/report.md +25 -0
- package/skills/statechart/scripts/test/corpus/FirstRule/sany.out +2 -0
- package/skills/statechart/scripts/test/corpus/FirstRule/verdict-1.exit +1 -0
- package/skills/statechart/scripts/test/corpus/FirstRule/verdict-1.out +56 -0
- package/skills/statechart/scripts/test/corpus/FirstRule/verdict-2.exit +1 -0
- package/skills/statechart/scripts/test/corpus/FirstRule/verdict-2.out +64 -0
- package/skills/statechart/scripts/test/corpus/FirstRule/verdict-3.exit +1 -0
- package/skills/statechart/scripts/test/corpus/FirstRule/verdict-3.out +64 -0
- package/skills/statechart/scripts/test/corpus/FirstRule/verdict-4.exit +1 -0
- package/skills/statechart/scripts/test/corpus/FirstRule/verdict-4.out +77 -0
- package/skills/statechart/scripts/test/corpus/HiddenClock/ChartRun.out +57 -0
- package/skills/statechart/scripts/test/corpus/HiddenClock/HiddenClock.cfg +4 -0
- package/skills/statechart/scripts/test/corpus/HiddenClock/HiddenClock.tla +11 -0
- package/skills/statechart/scripts/test/corpus/HiddenClock/chart.mmd +13 -0
- package/skills/statechart/scripts/test/corpus/HiddenClock/graph.dot +12 -0
- package/skills/statechart/scripts/test/corpus/HiddenClock/report.md +11 -0
- package/skills/statechart/scripts/test/corpus/HiddenClock/sany.out +2 -0
- package/skills/statechart/scripts/test/corpus/HiddenClock/verdict-1.exit +1 -0
- package/skills/statechart/scripts/test/corpus/HiddenClock/verdict-1.out +72 -0
- package/skills/statechart/scripts/test/corpus/Login/ChartRun.out +57 -0
- package/skills/statechart/scripts/test/corpus/Login/Login.cfg +3 -0
- package/skills/statechart/scripts/test/corpus/Login/Login.tla +62 -0
- package/skills/statechart/scripts/test/corpus/Login/chart.mmd +27 -0
- package/skills/statechart/scripts/test/corpus/Login/graph.dot +40 -0
- package/skills/statechart/scripts/test/corpus/Login/report.md +7 -0
- package/skills/statechart/scripts/test/corpus/Login/sany.out +1 -0
- package/skills/statechart/scripts/test/corpus/Login/verdict-1.out +47 -0
- package/skills/statechart/scripts/test/corpus/Login/view.mjs +1 -0
- package/skills/statechart/scripts/test/corpus/LoginGuarded/ChartRun.out +57 -0
- package/skills/statechart/scripts/test/corpus/LoginGuarded/LoginGuarded.cfg +2 -0
- package/skills/statechart/scripts/test/corpus/LoginGuarded/LoginGuarded.tla +64 -0
- package/skills/statechart/scripts/test/corpus/LoginGuarded/chart.mmd +28 -0
- package/skills/statechart/scripts/test/corpus/LoginGuarded/graph.dot +37 -0
- package/skills/statechart/scripts/test/corpus/LoginGuarded/report.md +8 -0
- package/skills/statechart/scripts/test/corpus/LoginGuarded/sany.out +1 -0
- package/skills/statechart/scripts/test/corpus/LoginGuarded/verdict-1.out +47 -0
- package/skills/statechart/scripts/test/corpus/LoginGuarded/view.mjs +1 -0
- package/skills/statechart/scripts/test/corpus/LoginParallel/ChartRun.out +60 -0
- package/skills/statechart/scripts/test/corpus/LoginParallel/LoginParallel.cfg +3 -0
- package/skills/statechart/scripts/test/corpus/LoginParallel/LoginParallel.tla +64 -0
- package/skills/statechart/scripts/test/corpus/LoginParallel/chart.mmd +44 -0
- package/skills/statechart/scripts/test/corpus/LoginParallel/graph.dot +58 -0
- package/skills/statechart/scripts/test/corpus/LoginParallel/report.md +17 -0
- package/skills/statechart/scripts/test/corpus/LoginParallel/sany.out +1 -0
- package/skills/statechart/scripts/test/corpus/LoginParallel/verdict-1.exit +1 -0
- package/skills/statechart/scripts/test/corpus/LoginParallel/verdict-1.out +83 -0
- package/skills/statechart/scripts/test/corpus/LoginParallel/verdict-2.out +57 -0
- package/skills/statechart/scripts/test/corpus/LoginParallel/view.mjs +1 -0
- package/skills/statechart/scripts/test/corpus/MediaPlayer/ChartRun.out +60 -0
- package/skills/statechart/scripts/test/corpus/MediaPlayer/MediaPlayer.cfg +3 -0
- package/skills/statechart/scripts/test/corpus/MediaPlayer/MediaPlayer.tla +103 -0
- package/skills/statechart/scripts/test/corpus/MediaPlayer/chart.mmd +43 -0
- package/skills/statechart/scripts/test/corpus/MediaPlayer/graph.dot +93 -0
- package/skills/statechart/scripts/test/corpus/MediaPlayer/report.md +14 -0
- package/skills/statechart/scripts/test/corpus/MediaPlayer/sany.out +1 -0
- package/skills/statechart/scripts/test/corpus/MediaPlayer/verdict-1.exit +1 -0
- package/skills/statechart/scripts/test/corpus/MediaPlayer/verdict-1.out +59 -0
- package/skills/statechart/scripts/test/corpus/MediaPlayer/verdict-2.out +72 -0
- package/skills/statechart/scripts/test/corpus/MediaPlayer/view.mjs +3 -0
- package/skills/statechart/scripts/test/corpus/MediaPlayerFixed/ChartRun.out +57 -0
- package/skills/statechart/scripts/test/corpus/MediaPlayerFixed/MediaPlayerFixed.cfg +2 -0
- package/skills/statechart/scripts/test/corpus/MediaPlayerFixed/MediaPlayerFixed.tla +100 -0
- package/skills/statechart/scripts/test/corpus/MediaPlayerFixed/chart.mmd +31 -0
- package/skills/statechart/scripts/test/corpus/MediaPlayerFixed/graph.dot +85 -0
- package/skills/statechart/scripts/test/corpus/MediaPlayerFixed/report.md +9 -0
- package/skills/statechart/scripts/test/corpus/MediaPlayerFixed/sany.out +1 -0
- package/skills/statechart/scripts/test/corpus/MediaPlayerFixed/verdict-1.out +47 -0
- package/skills/statechart/scripts/test/corpus/MediaPlayerFixed/view.mjs +3 -0
- package/skills/statechart/scripts/test/corpus/MediaPlayerProps/ChartRun.out +59 -0
- package/skills/statechart/scripts/test/corpus/MediaPlayerProps/MediaPlayer.tla +103 -0
- package/skills/statechart/scripts/test/corpus/MediaPlayerProps/MediaPlayerProps.cfg +3 -0
- package/skills/statechart/scripts/test/corpus/MediaPlayerProps/MediaPlayerProps.tla +6 -0
- package/skills/statechart/scripts/test/corpus/MediaPlayerProps/chart.mmd +42 -0
- package/skills/statechart/scripts/test/corpus/MediaPlayerProps/graph.dot +93 -0
- package/skills/statechart/scripts/test/corpus/MediaPlayerProps/report.md +19 -0
- package/skills/statechart/scripts/test/corpus/MediaPlayerProps/sany.out +2 -0
- package/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-1.exit +1 -0
- package/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-1.out +61 -0
- package/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-2.out +59 -0
- package/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-3.out +61 -0
- package/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-4.exit +1 -0
- package/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-4.out +66 -0
- package/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-5.exit +1 -0
- package/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-5.out +58 -0
- package/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-6.out +49 -0
- package/skills/statechart/scripts/test/corpus/MediaPlayerProps/view.mjs +3 -0
- package/skills/statechart/scripts/test/corpus/PickWorker/ChartRun.out +57 -0
- package/skills/statechart/scripts/test/corpus/PickWorker/PickWorker.cfg +6 -0
- package/skills/statechart/scripts/test/corpus/PickWorker/PickWorker.tla +11 -0
- package/skills/statechart/scripts/test/corpus/PickWorker/chart.mmd +5 -0
- package/skills/statechart/scripts/test/corpus/PickWorker/graph.dot +11 -0
- package/skills/statechart/scripts/test/corpus/PickWorker/report.md +7 -0
- package/skills/statechart/scripts/test/corpus/PickWorker/sany.out +5 -0
- package/skills/statechart/scripts/test/corpus/PickWorker/verdict-1.out +70 -0
- package/skills/statechart/scripts/test/corpus/Shadow/ChartRun.out +61 -0
- package/skills/statechart/scripts/test/corpus/Shadow/Shadow.cfg +4 -0
- package/skills/statechart/scripts/test/corpus/Shadow/Shadow.tla +11 -0
- package/skills/statechart/scripts/test/corpus/Shadow/ShadowLib.tla +6 -0
- package/skills/statechart/scripts/test/corpus/Shadow/ShadowSub.tla +3 -0
- package/skills/statechart/scripts/test/corpus/Shadow/chart.mmd +9 -0
- package/skills/statechart/scripts/test/corpus/Shadow/graph.dot +16 -0
- package/skills/statechart/scripts/test/corpus/Shadow/report.md +8 -0
- package/skills/statechart/scripts/test/corpus/Shadow/sany.out +4 -0
- package/skills/statechart/scripts/test/corpus/Shadow/verdict-1.out +65 -0
- package/skills/statechart/scripts/test/corpus/SpacedNames/ChartRun.out +59 -0
- package/skills/statechart/scripts/test/corpus/SpacedNames/SpacedNames.cfg +2 -0
- package/skills/statechart/scripts/test/corpus/SpacedNames/SpacedNames.tla +9 -0
- package/skills/statechart/scripts/test/corpus/SpacedNames/chart.mmd +23 -0
- package/skills/statechart/scripts/test/corpus/SpacedNames/graph.dot +17 -0
- package/skills/statechart/scripts/test/corpus/SpacedNames/report.md +15 -0
- package/skills/statechart/scripts/test/corpus/SpacedNames/sany.out +1 -0
- package/skills/statechart/scripts/test/corpus/SpacedNames/verdict-1.exit +1 -0
- package/skills/statechart/scripts/test/corpus/SpacedNames/verdict-1.out +65 -0
- package/skills/statechart/scripts/test/corpus/SpacedNames/verdict-2.exit +1 -0
- package/skills/statechart/scripts/test/corpus/SpacedNames/verdict-2.out +75 -0
- package/skills/statechart/scripts/test/corpus/TwoPhase/ChartRun.out +69 -0
- package/skills/statechart/scripts/test/corpus/TwoPhase/TwoPhase.cfg +3 -0
- package/skills/statechart/scripts/test/corpus/TwoPhase/TwoPhase.tla +75 -0
- package/skills/statechart/scripts/test/corpus/TwoPhase/chart.mmd +60 -0
- package/skills/statechart/scripts/test/corpus/TwoPhase/graph.dot +297 -0
- package/skills/statechart/scripts/test/corpus/TwoPhase/report.md +20 -0
- package/skills/statechart/scripts/test/corpus/TwoPhase/sany.out +1 -0
- package/skills/statechart/scripts/test/corpus/TwoPhase/verdict-1.exit +1 -0
- package/skills/statechart/scripts/test/corpus/TwoPhase/verdict-1.out +95 -0
- package/skills/statechart/scripts/test/corpus/TwoPhase/verdict-2.out +57 -0
- package/skills/statechart/scripts/test/corpus/TwoPhase/view.mjs +1 -0
- package/skills/statechart/scripts/test/corpus/TwoPhaseFixed/ChartRun.out +57 -0
- package/skills/statechart/scripts/test/corpus/TwoPhaseFixed/TwoPhaseFixed.cfg +3 -0
- package/skills/statechart/scripts/test/corpus/TwoPhaseFixed/TwoPhaseFixed.tla +75 -0
- package/skills/statechart/scripts/test/corpus/TwoPhaseFixed/chart.mmd +37 -0
- package/skills/statechart/scripts/test/corpus/TwoPhaseFixed/graph.dot +223 -0
- package/skills/statechart/scripts/test/corpus/TwoPhaseFixed/report.md +11 -0
- package/skills/statechart/scripts/test/corpus/TwoPhaseFixed/sany.out +1 -0
- package/skills/statechart/scripts/test/corpus/TwoPhaseFixed/verdict-1.out +47 -0
- package/skills/statechart/scripts/test/corpus/TwoPhaseFixed/view.mjs +1 -0
- package/skills/statechart/scripts/test/corpus/TypeGuard/ChartRun.exit +1 -0
- package/skills/statechart/scripts/test/corpus/TypeGuard/ChartRun.out +75 -0
- package/skills/statechart/scripts/test/corpus/TypeGuard/TypeGuard.cfg +5 -0
- package/skills/statechart/scripts/test/corpus/TypeGuard/TypeGuard.tla +11 -0
- package/skills/statechart/scripts/test/corpus/TypeGuard/chart.mmd +18 -0
- package/skills/statechart/scripts/test/corpus/TypeGuard/graph.dot +14 -0
- package/skills/statechart/scripts/test/corpus/TypeGuard/report.md +29 -0
- package/skills/statechart/scripts/test/corpus/TypeGuard/sany.out +2 -0
- package/skills/statechart/scripts/test/corpus/TypeGuard/verdict-1.exit +1 -0
- package/skills/statechart/scripts/test/corpus/TypeGuard/verdict-1.out +64 -0
- package/skills/statechart/scripts/test/corpus/TypeGuard/verdict-2.exit +1 -0
- package/skills/statechart/scripts/test/corpus/TypeGuard/verdict-2.out +75 -0
- package/skills/statechart/scripts/test/corpus/UserNoDeadlock/ChartRun.out +58 -0
- package/skills/statechart/scripts/test/corpus/UserNoDeadlock/UserNoDeadlock.cfg +2 -0
- package/skills/statechart/scripts/test/corpus/UserNoDeadlock/UserNoDeadlock.tla +8 -0
- package/skills/statechart/scripts/test/corpus/UserNoDeadlock/chart.mmd +22 -0
- package/skills/statechart/scripts/test/corpus/UserNoDeadlock/graph.dot +16 -0
- package/skills/statechart/scripts/test/corpus/UserNoDeadlock/report.md +15 -0
- package/skills/statechart/scripts/test/corpus/UserNoDeadlock/sany.out +2 -0
- package/skills/statechart/scripts/test/corpus/UserNoDeadlock/verdict-1.exit +1 -0
- package/skills/statechart/scripts/test/corpus/UserNoDeadlock/verdict-1.out +56 -0
- package/skills/statechart/scripts/test/corpus/UserNoDeadlock/verdict-2.exit +1 -0
- package/skills/statechart/scripts/test/corpus/UserNoDeadlock/verdict-2.out +77 -0
- package/skills/statechart/scripts/test/corpus.test.ts +403 -0
- package/skills/statechart/scripts/test/differential.test.ts +565 -0
- package/skills/statechart/scripts/test/grid/Grid.cfg +2 -0
- package/skills/statechart/scripts/test/grid/Grid.tla +9 -0
- package/skills/statechart/scripts/test/grid/sany.out +2 -0
- package/skills/statechart/scripts/test/java.ts +63 -0
- package/skills/statechart/scripts/test/labels.ts +643 -0
- package/skills/statechart/scripts/test/messages.test.ts +212 -0
- package/skills/statechart/scripts/test/pipeline.test.ts +270 -0
- package/skills/statechart/scripts/test/plain-tlc.test.ts +255 -0
- package/skills/statechart/scripts/test/render.test.ts +81 -0
- package/skills/statechart/scripts/test/tlc-out.test.ts +90 -0
- package/skills/statechart/scripts/test/tlc.ts +158 -0
- package/skills/statechart/scripts/tsconfig.json +11 -0
- package/skills/statechart/scripts/worker.ts +35 -0
- package/skills/swarm/SKILL.md +41 -0
- package/skills/tdd/SKILL.md +42 -0
- package/skills/teach/SKILL.md +21 -0
- package/skills/technical-writing/SKILL.md +106 -0
- package/skills/typescript-best-practices/SKILL.md +32 -0
- package/skills/typescript-best-practices/references/patterns.md +328 -0
- package/skills/unslop/SKILL.md +62 -0
- package/skills/why/SKILL.md +98 -0
- package/skills/why/references/epistemics.md +71 -0
- package/skills/why/references/investigator-prompt.md +84 -0
- package/skills/why/references/source-playbook.md +17 -0
- package/skills/why/references/sources/code-archaeology.md +51 -0
- package/skills/why/references/sources/databricks.md +70 -0
- package/skills/why/references/sources/datadog.md +97 -0
- package/skills/why/references/sources/incident-postmortem.md +5 -0
- package/skills/why/references/sources/linear.md +48 -0
- package/skills/why/references/sources/notion.md +55 -0
- package/skills/why/references/sources/sentry.md +66 -0
- package/skills/why/references/sources/slack.md +17 -0
- package/skills/why/references/synthesizer-prompt.md +129 -0
- package/src/aliases.ts +64 -0
- package/src/ask.ts +131 -0
- package/src/autocomplete.ts +21 -0
- package/src/child-env.ts +44 -0
- package/src/index.ts +123 -0
- package/src/loop.ts +189 -0
- package/src/mode.ts +156 -0
- package/src/modes.ts +8 -0
- package/src/paths.ts +72 -0
- package/src/plan.ts +141 -0
- package/src/readonly-shell.ts +107 -0
- package/src/rule.ts +56 -0
- package/src/sections.ts +117 -0
- package/src/subscriptions/cron.ts +75 -0
- package/src/subscriptions/github.ts +149 -0
- package/src/subscriptions/index.ts +547 -0
- package/src/subscriptions/webhook.ts +209 -0
- package/src/task/agents.ts +55 -0
- package/src/task/card.ts +32 -0
- package/src/task/format.ts +88 -0
- package/src/task/models.ts +140 -0
- package/src/task/records.ts +232 -0
- package/src/task/registry.ts +77 -0
- package/src/task/runner.ts +370 -0
- package/src/task/status.ts +170 -0
- package/src/task/stop.ts +100 -0
- package/src/task/tool.ts +491 -0
- package/src/task/worktree.ts +67 -0
- package/src/todo.ts +122 -0
- package/src/visualize.ts +244 -0
- package/test/aliases.test.ts +57 -0
- package/test/ask.test.ts +85 -0
- package/test/autocomplete.test.ts +39 -0
- package/test/e2e/aliases.e2e.test.ts +81 -0
- package/test/e2e/ask.e2e.test.ts +135 -0
- package/test/e2e/harness.ts +179 -0
- package/test/e2e/host.e2e.test.ts +193 -0
- package/test/e2e/lifecycle.e2e.test.ts +99 -0
- package/test/e2e/mode.e2e.test.ts +160 -0
- package/test/e2e/package.e2e.test.ts +67 -0
- package/test/e2e/task.e2e.test.ts +734 -0
- package/test/e2e/todo.e2e.test.ts +59 -0
- package/test/fixtures/cursor-askquestion-calls.json +806 -0
- package/test/fixtures/fake-pi.mjs +96 -0
- package/test/fixtures/image-model.ts +16 -0
- package/test/fixtures/list-models.ts +15 -0
- package/test/fixtures/readonly-shell-exit.ts +17 -0
- package/test/fixtures/scripted-model.ts +113 -0
- package/test/loop.test.ts +209 -0
- package/test/mode.test.ts +143 -0
- package/test/plan.test.ts +126 -0
- package/test/readonly-shell-security.test.ts +84 -0
- package/test/readonly-shell.test.ts +44 -0
- package/test/records.test.ts +143 -0
- package/test/registry.test.ts +18 -0
- package/test/resources.test.ts +162 -0
- package/test/rule.test.ts +92 -0
- package/test/scripts.test.ts +182 -0
- package/test/sections.test.ts +56 -0
- package/test/subscriptions-cron.test.ts +60 -0
- package/test/subscriptions.test.ts +598 -0
- package/test/task-agents.test.ts +49 -0
- package/test/task-card.test.ts +34 -0
- package/test/task-fork.test.ts +233 -0
- package/test/task-format.test.ts +65 -0
- package/test/task-model.test.ts +141 -0
- package/test/task-runner.test.ts +259 -0
- package/test/task-schema.test.ts +50 -0
- package/test/task-status.test.ts +155 -0
- package/test/task-worktree.test.ts +106 -0
- package/test/todo.test.ts +74 -0
- package/test/visualize.test.ts +152 -0
- package/tsconfig.json +5 -0
- package/vitest.config.ts +16 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: statechart
|
|
3
|
+
description: "Check a TLA+ model of a system that moves between states, such as a product flow, a protocol, or a service, and draw it as a Mermaid statechart. The report gives the shortest path to each state that breaks a rule. Use for /statechart, or to show a bug as a path through states."
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Statechart
|
|
8
|
+
|
|
9
|
+
The chart shows how a system moves between states, in the words of the person who reads it. That person, the reader, decides whether the behavior is right.
|
|
10
|
+
|
|
11
|
+
## Run
|
|
12
|
+
|
|
13
|
+
Work in a scratch folder outside the repo. Write a TLA+ spec and its config. Then run:
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
<skill dir>/scripts/statechart SPEC.tla [--config FILE] [--view FILE] [--out DIR]
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`scripts/statechart.ts` is TypeScript, so run it with a runtime that can execute TypeScript.
|
|
20
|
+
|
|
21
|
+
The first run installs TLC and Java with mise and needs the network.
|
|
22
|
+
|
|
23
|
+
## Write the spec
|
|
24
|
+
|
|
25
|
+
- Write each rule that the reader agrees to as an INVARIANT. A rule can be about a screen, a result, a stored value, or a message. If the model has no variable for a rule, add the variable. Never weaken a rule to make it hold.
|
|
26
|
+
- Write `Next` as a disjunction of the actions, such as `YouPressPlay \/ YouPressStop`. If you do not, TLC names every step `Next`.
|
|
27
|
+
- A state with no step out breaks `NoDeadlock`, also when it is a correct end state. When an INVARIANT or a PROPERTY already has that name, the rule is `CHECK_DEADLOCK`. Add to `Next` an action that is true only in the end states and changes nothing, such as `Done == phase \in {"paid", "failed"} /\ UNCHANGED vars`, and give it a label in `step()`.
|
|
28
|
+
|
|
29
|
+
## Pick the chart
|
|
30
|
+
|
|
31
|
+
You do the work that needs judgment: the words on each state and arrow, the phases and their colors, the title, and the report to the reader. Put your work in a view module, and give it with `--view`.
|
|
32
|
+
|
|
33
|
+
To show the reader's words, the view exports `state(vars)`. The value that `state()` returns picks the form:
|
|
34
|
+
|
|
35
|
+
- A string gives a flat chart: `export const state = (v) => (v.paid ? "Paid" : "Paying");`
|
|
36
|
+
- An array gives parent states: `export const state = (v) => v.main.split(".");`
|
|
37
|
+
- An object gives one parallel region for each key: `export const state = (v) => ({ Playback: v.playback, Volume: v.volume });`
|
|
38
|
+
|
|
39
|
+
Label each state with what the reader can see or cares about, such as "Paying" or "Lease held, write pending". Keep variable names out of labels. In `vars`, a TLA+ sequence is an object with keys from 1, so `v.pc[1]` is `pc[1]`. A set is an array.
|
|
40
|
+
|
|
41
|
+
The view can also export `step(action, from, to)`. It gets the TLC action name and the values before and after the step, and it returns the label of the arrow. Write each step label as the user sees it happen, such as "you press play" or "the connect fails". Do not name the code or the TLA+ action. Two actions that end the same in the chart get the same label, so that they share one arrow.
|
|
42
|
+
|
|
43
|
+
When a step can occur only in some conditions, end its label with the condition in brackets, in the reader's words, such as `you press play [while the file loads]`. In a regions chart, the command writes the condition on the other regions on the arrow, in the words of their labels, such as `[when Offline]`. Your brackets replace it, and two arrows from one state can then look the same. So in a regions chart, do not write brackets for a condition on another region. When a value that no label shows decides where a step goes, name the result in the label, such as "the roster read fails".
|
|
44
|
+
|
|
45
|
+
The view can also export these:
|
|
46
|
+
|
|
47
|
+
- `group(vars)` returns the name of a phase. Each chart state gets the color of its group. When the model states behind one chart state are in different groups, that state gets no color.
|
|
48
|
+
- `colors` gives each group name a color class.
|
|
49
|
+
- `title` is a string that the chart shows at the top.
|
|
50
|
+
|
|
51
|
+
The command calls `state()` and `group()` at most once for each model state, and `step()` at most once for each step. The chart and the report both use those answers. So make each function depend only on its arguments.
|
|
52
|
+
|
|
53
|
+
The chart does not draw a step that stays in one label. Split a label when the reader must see such a step.
|
|
54
|
+
|
|
55
|
+
Aim for about 20 arrows or fewer, because a busier chart is hard to read. First return coarser labels from `state()`. Give one label to values that act the same, and leave out a detail that the reader does not need, such as a call in flight whose return changes nothing. Keep each state of a bug path, and keep each mark. When a merge changes a `breaks` state to `mayBreak`, it hides where a rule breaks. Do not merge two states that break different rules, because the reader then cannot see which rule breaks where. If the chart is still too busy, return `null` from `step()` for the steps that the reader does not need, such as a reset that every state has, or a step whose arrow repeats what other arrows show. Obey these rules when you hide steps:
|
|
56
|
+
|
|
57
|
+
- Keep each chart state reachable by arrows from a start state.
|
|
58
|
+
- Keep at least one arrow out of each chart state that has a step out in the model.
|
|
59
|
+
- Hide all the steps of an arrow, or none of them. When you hide only some, its condition gets narrower.
|
|
60
|
+
- In the hand-off, say which steps the chart hides.
|
|
61
|
+
|
|
62
|
+
## Read the report
|
|
63
|
+
|
|
64
|
+
- In the chart, a state that breaks a rule has the class `breaks`. When only some model states behind it break the rule, it has the class `mayBreak`. The Legend names the rules of each mark. When two rules break, it names both on one mark, so say in the hand-off which state breaks which rule. In a regions chart, a state gets a mark when each combination of region states that includes it can break a rule. When a combination can break a rule and none of its states has a mark, each state in that combination gets a mark.
|
|
65
|
+
- TLC goes past a state that breaks a rule, so the chart shows the states after a bug.
|
|
66
|
+
- Because TLC goes past bugs, a model with no limit on its states can run without end. Keep the constants small, or add a CONSTRAINT.
|
|
67
|
+
- With a VIEW or a SYMMETRY, TLC counts states that it treats as the same as one state, and the chart draws that one state. An arrow can lead to it rather than to the state that the step reaches, and the report says so.
|
|
68
|
+
- TLC checks the rules in each state past a CONSTRAINT or an ACTION_CONSTRAINT, but it does not explore that state or check it for deadlock. When TLC's shortest path for a rule ends in such a state, the chart draws that state, and the report gives that path. The chart does not draw the other states past the bound. A deadlock in such a state does not show. TLC also checks the rules after each step that an ACTION_CONSTRAINT excludes, also when it reaches the next state another way. When TLC's shortest path for a rule ends with such a step, the chart draws that step.
|
|
69
|
+
- The command checks the rules with TLC on the config as written, with one worker. When a rule breaks, the command removes that rule and runs TLC again, until no rule breaks. After the first break, each run stops at 100,000 distinct states, so that a large model does not run without end. When a run reaches that bound or stops on an error, the report lists the rules that it did not check under "Rules not checked", and the chart does not mark them. A rule that is not checked can hold or break. To check it, remove the rules that break from the config, or make the model smaller. The bound adds a module that changes TLC's order of the variables, so for a property TLC can find a different counterexample than a run without the bound.
|
|
70
|
+
- `tlc.out` is what TLC printed on the config as written. When the chart does not show the bug path of a rule that breaks, `tlc-RULE.out` is what TLC printed for the run that found it. When TLC repeats its first warning, plain TLC prints it twice, but `tlc.out` shows it once, because TLC leaves the second copy out of the output that this command reads. That happens only when Java runs with `-XX:+UseParallelGC`, since otherwise TLC's first warning is its advice to pass that flag, which it prints once.
|
|
71
|
+
|
|
72
|
+
## Show the chart
|
|
73
|
+
|
|
74
|
+
Show `chart.mmd` to the user as a `mermaid` code block. The chart has a budget of 500 states, counted by TLC on the config as written. Above that, the chart draws only the paths to the rules that break, and when no rule breaks, the command writes no `chart.mmd`. It still checks each rule, and the report gives the state count and each bug path. To see the whole graph, make the model smaller.
|
|
75
|
+
|
|
76
|
+
Render charts with Pele. When the user asks for an image, or a chart is too large to read as text, follow `references/render.md`. Do not use a different renderer unless the user asks for it.
|
|
77
|
+
|
|
78
|
+
## Hand off
|
|
79
|
+
|
|
80
|
+
Give each chart and its Mermaid text to the person who must decide. Add one line for each bug: the rule, the reader's sentence for that rule, and the path as the report numbers it. Say what the model leaves out. Give the command that makes the files again, with a new `--out` folder.
|
|
81
|
+
|
|
82
|
+
When the model describes code, replay each bug path against the real code, as a test or a live repro, one step for each action. If a bug does not occur, think that the model is wrong until you show that it is not.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Render a chart
|
|
2
|
+
|
|
3
|
+
Render each `.mmd` file that you show with the npm package `pele@1.9.0`, and give the user the SVG. Install Pele once, outside the repo. Write each SVG next to its `.mmd` file, with the same name. The API is at https://pele.run/api. Pass `{ limit: 1_000_000, outputLimit: 8_000_000, maxEdges: 10_000 }` as the options of `render`. Pele's defaults are smaller than a chart of 500 states can be. When Pele throws a `PeleError`, show the user the Mermaid text and the error.
|
|
4
|
+
|
|
5
|
+
## Colors
|
|
6
|
+
|
|
7
|
+
Pele ignores Mermaid `theme` and `themeVariables`. Set its `--pele-*` CSS variables on `.pele`. https://pele.run/theming lists them. The command gives each state the color class of its group, such as `class sN teal`. It marks each bad state with `class sN breaks` or `class sN mayBreak`, each state on the shortest path to a bug with `class sN bugPath`, and each state that a PROPERTY counterexample repeats forever with `class sN repeats`. Pele puts these classes on the state's node. Color the classes with CSS.
|
|
8
|
+
|
|
9
|
+
The `.mmd` file has a `classDef` line for `breaks` and for `mayBreak`, so that any Mermaid viewer shows the bug marks. It has no `classDef` for the group colors, `bugPath`, or `repeats`. Pele writes each `classDef` color as a `style` attribute on the node, and a `style` attribute wins over a normal CSS rule. So the rules for the marks below use `!important`. Without it, a dark theme keeps the light mark colors. A bug mark sets the fill and the text, and `bugPath` and `repeats` set the border. Put the mark rules after the group colors, so that a mark shows over the group color.
|
|
10
|
+
|
|
11
|
+
These colors are suggestions. They are the colors of the old skill. Put them in a `<style>` element at the start of each SVG. Each SVG then follows the light or dark setting of the viewer.
|
|
12
|
+
|
|
13
|
+
```css
|
|
14
|
+
.pele {
|
|
15
|
+
--pele-bg: #ffffff;
|
|
16
|
+
--pele-fg: #1c1c1c;
|
|
17
|
+
--pele-muted: #656565;
|
|
18
|
+
--pele-line: #808080;
|
|
19
|
+
--pele-surface: #fcfcfc;
|
|
20
|
+
--pele-surface-alt: #f1f1f1;
|
|
21
|
+
--pele-border: #c9c9c9;
|
|
22
|
+
}
|
|
23
|
+
.pele .blue rect { fill: #c3e0ff; }
|
|
24
|
+
.pele .orange rect { fill: #f0d3bf; }
|
|
25
|
+
.pele .purple rect { fill: #e3d5ff; }
|
|
26
|
+
.pele .yellow rect { fill: #f0dcbf; }
|
|
27
|
+
.pele .teal rect { fill: #bfe3df; }
|
|
28
|
+
.pele .tan rect { fill: #e5d9ce; }
|
|
29
|
+
.pele .pink rect { fill: #ffcbe6; }
|
|
30
|
+
.pele .breaks rect {
|
|
31
|
+
fill: #ffecee !important;
|
|
32
|
+
stroke: #e72e3b !important;
|
|
33
|
+
stroke-width: 2.5px !important;
|
|
34
|
+
}
|
|
35
|
+
.pele .breaks text {
|
|
36
|
+
fill: #cd2834 !important;
|
|
37
|
+
}
|
|
38
|
+
.pele .mayBreak rect {
|
|
39
|
+
fill: #fff3e6 !important;
|
|
40
|
+
stroke: #e8730c !important;
|
|
41
|
+
stroke-width: 2.5px !important;
|
|
42
|
+
}
|
|
43
|
+
.pele .mayBreak text {
|
|
44
|
+
fill: #b85a06 !important;
|
|
45
|
+
}
|
|
46
|
+
.pele .bugPath rect {
|
|
47
|
+
stroke: #1680f3 !important;
|
|
48
|
+
stroke-width: 2.5px !important;
|
|
49
|
+
}
|
|
50
|
+
.pele .repeats rect {
|
|
51
|
+
stroke: #9b35d6 !important;
|
|
52
|
+
stroke-width: 2.5px !important;
|
|
53
|
+
stroke-dasharray: 6 3;
|
|
54
|
+
}
|
|
55
|
+
@media (prefers-color-scheme: dark) {
|
|
56
|
+
.pele {
|
|
57
|
+
--pele-bg: #1f1f1f;
|
|
58
|
+
--pele-fg: #f5f5f5;
|
|
59
|
+
--pele-muted: #acacac;
|
|
60
|
+
--pele-line: #939393;
|
|
61
|
+
--pele-surface: #121212;
|
|
62
|
+
--pele-surface-alt: #2c2c2c;
|
|
63
|
+
--pele-border: #4e4e4e;
|
|
64
|
+
}
|
|
65
|
+
.pele .blue rect { fill: #1b3857; }
|
|
66
|
+
.pele .orange rect { fill: #573117; }
|
|
67
|
+
.pele .purple rect { fill: #3c2e57; }
|
|
68
|
+
.pele .yellow rect { fill: #573d17; }
|
|
69
|
+
.pele .teal rect { fill: #174641; }
|
|
70
|
+
.pele .tan rect { fill: #3d3127; }
|
|
71
|
+
.pele .pink rect { fill: #57233e; }
|
|
72
|
+
.pele .breaks rect {
|
|
73
|
+
fill: #2e2021 !important;
|
|
74
|
+
stroke: #cf2b35 !important;
|
|
75
|
+
}
|
|
76
|
+
.pele .breaks text {
|
|
77
|
+
fill: #ff6463 !important;
|
|
78
|
+
}
|
|
79
|
+
.pele .mayBreak rect {
|
|
80
|
+
fill: #2e2619 !important;
|
|
81
|
+
stroke: #d0700f !important;
|
|
82
|
+
}
|
|
83
|
+
.pele .mayBreak text {
|
|
84
|
+
fill: #ffa257 !important;
|
|
85
|
+
}
|
|
86
|
+
.pele .bugPath rect {
|
|
87
|
+
stroke: #116dd2 !important;
|
|
88
|
+
}
|
|
89
|
+
.pele .repeats rect {
|
|
90
|
+
stroke: #9a3fcf !important;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
```
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { CHART_STATES, type ConfigSection, RERUN_STATES, type Spec } from "../ir.ts";
|
|
2
|
+
|
|
3
|
+
export function configText(sections: ConfigSection[], extra: string[]) {
|
|
4
|
+
const lines: string[] = [];
|
|
5
|
+
for (const s of sections) lines.push(`${s.key} ${s.tokens.join(" ")}`);
|
|
6
|
+
lines.push(...extra);
|
|
7
|
+
return lines.join("\n");
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const boundRun = (module: string) =>
|
|
11
|
+
[
|
|
12
|
+
`---- MODULE ChartBound ----`,
|
|
13
|
+
`EXTENDS ${module}`,
|
|
14
|
+
`ChartTLC == INSTANCE TLC`,
|
|
15
|
+
`ChartNaturals == INSTANCE Naturals`,
|
|
16
|
+
`ChartBound == ChartNaturals!<(ChartTLC!TLCGet("distinct"), ${RERUN_STATES})`,
|
|
17
|
+
`====`,
|
|
18
|
+
].join("\n");
|
|
19
|
+
|
|
20
|
+
export function chartRun({ module, variables, invariants }: Spec, tag: string) {
|
|
21
|
+
const every: string[] = [];
|
|
22
|
+
for (const name of invariants) every.push(`(IF ~${name} THEN {"${name}"} ELSE {}) \\cup `);
|
|
23
|
+
return [
|
|
24
|
+
`---- MODULE ChartRun ----`,
|
|
25
|
+
`EXTENDS ${module}`,
|
|
26
|
+
`ChartTLC == INSTANCE TLC`,
|
|
27
|
+
`ChartNaturals == INSTANCE Naturals`,
|
|
28
|
+
`ChartBudget == ChartNaturals!<=(ChartTLC!TLCGet("distinct"), ${CHART_STATES})`,
|
|
29
|
+
`ChartBroken == ${every.join("")}{}`,
|
|
30
|
+
`ChartMark == ChartBroken = {} \\/ ChartTLC!PrintT(<<"${tag}", <<${variables.join(", ")}>>, ChartBroken>>)`,
|
|
31
|
+
`====`,
|
|
32
|
+
].join("\n");
|
|
33
|
+
}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { append, byText, type Chart, type ChartState, type Region, tupleKey } from "../ir.ts";
|
|
2
|
+
|
|
3
|
+
const BLANK = /\p{White_Space}/u;
|
|
4
|
+
const SAFE = /^[\p{L}\p{N} !'()+,\-./=?[\]"_|@{}:\\^%<>]$/u;
|
|
5
|
+
const HAZARD =
|
|
6
|
+
/:(?=:|$|\S*#)|\\(?=n)|%(?=%)|<(?=[\p{L}/!?])|_(?![\p{L}\p{N}])|(?<![\p{L}\p{N}])_/giu;
|
|
7
|
+
const DIRECTION = /(direction)\s+(?=LR|RL|TB|BT)/gi;
|
|
8
|
+
const DOUBLE_BRACKET = /\[(?=\[)/g;
|
|
9
|
+
const C4 = /C4(?=Container|Component|Dynamic|Deployment)/g;
|
|
10
|
+
const UNDRAWN = /[\0\x80-\x9f]/;
|
|
11
|
+
const REWRITTEN = ["fl°", "¶ß"];
|
|
12
|
+
const MARKER = /(?<=marker-end=)"/g;
|
|
13
|
+
const firstOf = new Map<number, number>();
|
|
14
|
+
for (const pair of REWRITTEN) {
|
|
15
|
+
const [first, second] = [...pair].map((c) => c.codePointAt(0) ?? 0);
|
|
16
|
+
firstOf.set(second, first);
|
|
17
|
+
}
|
|
18
|
+
const KEPT = 0;
|
|
19
|
+
const BLANKED = 1;
|
|
20
|
+
const DROPPED = 2;
|
|
21
|
+
const CODED = 3;
|
|
22
|
+
const JOINS = 4;
|
|
23
|
+
const kindOf = (n: number) => {
|
|
24
|
+
const c = String.fromCodePoint(n);
|
|
25
|
+
const kind =
|
|
26
|
+
c === " "
|
|
27
|
+
? KEPT
|
|
28
|
+
: BLANK.test(c)
|
|
29
|
+
? BLANKED
|
|
30
|
+
: UNDRAWN.test(c)
|
|
31
|
+
? DROPPED
|
|
32
|
+
: SAFE.test(c)
|
|
33
|
+
? KEPT
|
|
34
|
+
: CODED;
|
|
35
|
+
return firstOf.has(n) ? kind | JOINS : kind;
|
|
36
|
+
};
|
|
37
|
+
const ASCII = Uint8Array.from({ length: 128 }, (_, n) => kindOf(n));
|
|
38
|
+
const wide = new Map<number, number>();
|
|
39
|
+
const kindAt = (n: number) => {
|
|
40
|
+
if (n < 128) return ASCII[n];
|
|
41
|
+
let kind = wide.get(n);
|
|
42
|
+
if (kind === undefined) wide.set(n, (kind = kindOf(n)));
|
|
43
|
+
return kind;
|
|
44
|
+
};
|
|
45
|
+
const encode = (s: string, ref: (n: number) => string) => {
|
|
46
|
+
let out = "";
|
|
47
|
+
let run = 0;
|
|
48
|
+
let last = -1;
|
|
49
|
+
for (let i = 0; i < s.length;) {
|
|
50
|
+
let n = s.charCodeAt(i);
|
|
51
|
+
let width = 1;
|
|
52
|
+
if (n >= 0xd800 && n <= 0xdfff) {
|
|
53
|
+
const low = s.charCodeAt(i + 1);
|
|
54
|
+
if (n <= 0xdbff && low >= 0xdc00 && low <= 0xdfff) {
|
|
55
|
+
n = 0x10000 + ((n - 0xd800) << 10) + (low - 0xdc00);
|
|
56
|
+
width = 2;
|
|
57
|
+
} else n = 0xfffd;
|
|
58
|
+
}
|
|
59
|
+
let kind = kindAt(n);
|
|
60
|
+
if (kind === DROPPED) {
|
|
61
|
+
out += s.slice(run, i);
|
|
62
|
+
run = i + width;
|
|
63
|
+
} else {
|
|
64
|
+
const joined = kind >= JOINS && firstOf.get(n) === last;
|
|
65
|
+
kind &= ~JOINS;
|
|
66
|
+
if (joined || kind !== KEPT) {
|
|
67
|
+
out += s.slice(run, i);
|
|
68
|
+
if (joined) out += ref(0x2060);
|
|
69
|
+
if (kind === KEPT) run = i;
|
|
70
|
+
else {
|
|
71
|
+
out += kind === BLANKED ? " " : ref(n);
|
|
72
|
+
run = i + width;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
last = n;
|
|
76
|
+
}
|
|
77
|
+
i += width;
|
|
78
|
+
}
|
|
79
|
+
return out + s.slice(run);
|
|
80
|
+
};
|
|
81
|
+
const code = (s: string, ref: (n: number) => string) =>
|
|
82
|
+
encode(s, ref)
|
|
83
|
+
.replace(MARKER, `${ref(0x2060)}"`)
|
|
84
|
+
.replace(HAZARD, (c) => ref(c.charCodeAt(0)));
|
|
85
|
+
const esc = (s: string, quoted = false) => {
|
|
86
|
+
const plain = code(s, (n) => `#${n};`);
|
|
87
|
+
const out = quoted ? plain.replaceAll('"', "#34;") : plain;
|
|
88
|
+
if (!out.trim()) return "#32;";
|
|
89
|
+
const turned = out.replace(DIRECTION, "$1#32;");
|
|
90
|
+
const opened = turned.includes("[[") ? turned.replace(DOUBLE_BRACKET, "#91;") : turned;
|
|
91
|
+
return opened.includes("C4") ? opened.replace(C4, "C#52;") : opened;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const or = (names: Iterable<string>) => [...names].sort(byText).join(" or ");
|
|
95
|
+
|
|
96
|
+
const MARK_STYLES = {
|
|
97
|
+
breaks: "fill:#ffecee,stroke:#e72e3b,stroke-width:2.5px,color:#cd2834",
|
|
98
|
+
mayBreak: "fill:#fff3e6,stroke:#e8730c,stroke-width:2.5px,color:#b85a06",
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export function mermaidLines(chart: Chart) {
|
|
102
|
+
let next = 0;
|
|
103
|
+
const marks: string[] = [];
|
|
104
|
+
const used = new Set<string>();
|
|
105
|
+
const rules = { breaks: new Set<string>(), mayBreak: new Set<string>() };
|
|
106
|
+
const region = (r: Region) => {
|
|
107
|
+
const out: string[] = [];
|
|
108
|
+
const topIds = new Map<string, string>();
|
|
109
|
+
const nestedIds = new Map<string, string>();
|
|
110
|
+
const id = (path: string[]) => {
|
|
111
|
+
const top = path.length === 1;
|
|
112
|
+
const named = top ? topIds : nestedIds;
|
|
113
|
+
const k = top ? path[0] : tupleKey(path);
|
|
114
|
+
let s = named.get(k);
|
|
115
|
+
if (s === undefined) named.set(k, (s = `s${next++}`));
|
|
116
|
+
return s;
|
|
117
|
+
};
|
|
118
|
+
const known = new Map<string[], string>();
|
|
119
|
+
const idOf = (path: string[]) => {
|
|
120
|
+
let s = known.get(path);
|
|
121
|
+
if (s === undefined) known.set(path, (s = id(path)));
|
|
122
|
+
return s;
|
|
123
|
+
};
|
|
124
|
+
const tree = (prefix: string[], indent: string, below: ChartState[]) => {
|
|
125
|
+
const heads = new Map<string, ChartState[]>();
|
|
126
|
+
for (const s of below) append(heads, s.path[prefix.length], s);
|
|
127
|
+
for (const [head, under] of heads) {
|
|
128
|
+
const path = [...prefix, head];
|
|
129
|
+
let leaf: ChartState | undefined;
|
|
130
|
+
const inner: ChartState[] = [];
|
|
131
|
+
for (const s of under)
|
|
132
|
+
if (s.path.length > path.length) inner.push(s);
|
|
133
|
+
else leaf = s;
|
|
134
|
+
if (inner.length) {
|
|
135
|
+
out.push(`${indent}state "${esc(head, true)}" as ${id(path)} {`);
|
|
136
|
+
tree(path, indent + " ", inner);
|
|
137
|
+
out.push(`${indent}}`);
|
|
138
|
+
} else if (leaf) {
|
|
139
|
+
const sid = idOf(leaf.path);
|
|
140
|
+
out.push(`${indent}${sid}: ${esc(head)}`);
|
|
141
|
+
let mark: "breaks" | "mayBreak" | undefined =
|
|
142
|
+
leaf.breaks.length && !leaf.works ? "mayBreak" : undefined;
|
|
143
|
+
if (mark) for (const b of leaf.breaks) if (b.always) mark = "breaks";
|
|
144
|
+
if (mark) for (const b of leaf.breaks) rules[mark].add(b.rule.name);
|
|
145
|
+
const trail = [leaf.lead && "bugPath", leaf.repeats && "repeats"];
|
|
146
|
+
const color = leaf.group === undefined ? undefined : chart.colors[String(leaf.group)];
|
|
147
|
+
for (const cls of [color, mark, ...trail])
|
|
148
|
+
if (cls) {
|
|
149
|
+
used.add(cls);
|
|
150
|
+
marks.push(` class ${sid} ${cls}`);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
tree([], " ", r.states);
|
|
156
|
+
for (const s of r.states) if (s.start) out.push(` [*] --> ${idOf(s.path)}`);
|
|
157
|
+
for (const s of r.steps)
|
|
158
|
+
out.push(
|
|
159
|
+
` ${idOf(s.from)} --> ${idOf(s.to)}: ${esc(s.label + (s.when ? ` [${s.when}]` : ""))}`,
|
|
160
|
+
);
|
|
161
|
+
return out;
|
|
162
|
+
};
|
|
163
|
+
let body: string[];
|
|
164
|
+
if (chart.regions.length > 1) {
|
|
165
|
+
body = [` state "At the same time" as all {`];
|
|
166
|
+
for (const [i, r] of chart.regions.entries()) {
|
|
167
|
+
if (i) body.push(" --");
|
|
168
|
+
body.push(` state "${esc(r.name, true)}" as r${i} {`);
|
|
169
|
+
for (const line of region(r)) body.push(` ${line}`);
|
|
170
|
+
body.push(" }");
|
|
171
|
+
}
|
|
172
|
+
body.push(" }");
|
|
173
|
+
} else body = region(chart.regions[0]);
|
|
174
|
+
const legend: string[][] = [];
|
|
175
|
+
for (const entry of [
|
|
176
|
+
...Object.entries(chart.colors),
|
|
177
|
+
[`Breaks ${or(rules.breaks)}`, "breaks"],
|
|
178
|
+
[`Breaks ${or(rules.mayBreak)} in some cases`, "mayBreak"],
|
|
179
|
+
[`Path to the ${or(chart.paths)} bug`, "bugPath"],
|
|
180
|
+
[`Repeats forever, so ${or(chart.loops)} breaks`, "repeats"],
|
|
181
|
+
])
|
|
182
|
+
if (used.has(entry[1])) legend.push(entry);
|
|
183
|
+
const lines: string[] = [];
|
|
184
|
+
const title = chart.title && code(chart.title, (n) => `fl°°${n}¶ß`).replaceAll("<", "fl°°60¶ß");
|
|
185
|
+
if (title) lines.push("---", `title: ${JSON.stringify(title)}`, "---");
|
|
186
|
+
lines.push("stateDiagram-v2");
|
|
187
|
+
if (chart.regions.length > 1) lines.push(" direction LR");
|
|
188
|
+
if (legend.length) {
|
|
189
|
+
lines.push(` state "Legend" as legend {`);
|
|
190
|
+
for (const [i, [text]] of legend.entries()) lines.push(` lg${i}: ${esc(text)}`);
|
|
191
|
+
lines.push(" }");
|
|
192
|
+
for (const [i, [, cls]] of legend.entries()) lines.push(` class lg${i} ${cls}`);
|
|
193
|
+
}
|
|
194
|
+
for (const line of body) lines.push(line);
|
|
195
|
+
for (const [cls, style] of Object.entries(MARK_STYLES))
|
|
196
|
+
if (used.has(cls)) lines.push(` classDef ${cls} ${style}`);
|
|
197
|
+
for (const line of marks) lines.push(line);
|
|
198
|
+
return lines;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export const mermaid = (chart: Chart) => mermaidLines(chart).join("\n");
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { EC, LEVEL, type Message, PART, type Part } from "../ir.ts";
|
|
2
|
+
|
|
3
|
+
const PREFIX: { [level: number]: string } = {
|
|
4
|
+
[LEVEL.ERROR]: "Error: ",
|
|
5
|
+
[LEVEL.TLCBUG]: "TLC Bug: ",
|
|
6
|
+
[LEVEL.WARNING]: "Warning: ",
|
|
7
|
+
[LEVEL.STATE]: "State ",
|
|
8
|
+
};
|
|
9
|
+
const MINUTE = 60_000;
|
|
10
|
+
const HOUR = 3_600_000;
|
|
11
|
+
const DAY = 86_400_000;
|
|
12
|
+
|
|
13
|
+
const pad = (n: number) => String(n).padStart(2, "0");
|
|
14
|
+
|
|
15
|
+
export function runtime(ms: number) {
|
|
16
|
+
const t = new Date(ms > DAY ? ms - DAY : ms);
|
|
17
|
+
const [hh, mm, ss] = [t.getUTCHours(), t.getUTCMinutes(), t.getUTCSeconds()].map(pad);
|
|
18
|
+
if (ms > DAY)
|
|
19
|
+
return `${Math.floor((t.getTime() - Date.UTC(t.getUTCFullYear(), 0, 1)) / DAY) + 1}d ${hh}h`;
|
|
20
|
+
if (ms > HOUR) return `${hh}h ${mm}min`;
|
|
21
|
+
if (ms > MINUTE) return `${mm}min ${ss}s`;
|
|
22
|
+
return `${ss}s`;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const firstLine = ({ code, level }: Message, line: string) => {
|
|
26
|
+
if (code === EC.TLC_BACK_TO_STATE)
|
|
27
|
+
return line.replace(/^(\d+): Back to state: /, "Back to state $1: ");
|
|
28
|
+
if (code === EC.TLC_FINISHED)
|
|
29
|
+
return line.replace(
|
|
30
|
+
/^Finished in (\d+)ms/,
|
|
31
|
+
(_, ms: string) => `Finished in ${runtime(Number(ms))}`,
|
|
32
|
+
);
|
|
33
|
+
return (PREFIX[level] ?? "") + line;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const render = (m: Message): string =>
|
|
37
|
+
(m.beforeMarker ?? "") +
|
|
38
|
+
firstLine(m, m.body.map((part) => (typeof part === "string" ? part : render(part))).join("\n"));
|
|
39
|
+
|
|
40
|
+
function* printed(parts: Iterable<Part>): Generator<string> {
|
|
41
|
+
let warned = false;
|
|
42
|
+
let progress: Message | undefined;
|
|
43
|
+
for (const part of parts) {
|
|
44
|
+
if (progress?.body.length && (typeof part === "string" || part.code !== EC.TLC_STATS))
|
|
45
|
+
yield render(progress);
|
|
46
|
+
progress = undefined;
|
|
47
|
+
if (typeof part === "string") {
|
|
48
|
+
yield part;
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
if (part.code === EC.TLC_SANY_START || part.code === EC.TLC_SANY_END) continue;
|
|
52
|
+
if (part.code === EC.TLC_PROGRESS_STATS) progress = part;
|
|
53
|
+
else if (part.body.length) yield render(part);
|
|
54
|
+
if (part.level === LEVEL.WARNING && !warned) {
|
|
55
|
+
yield "(Use the -nowarning option to disable this warning.)";
|
|
56
|
+
warned = true;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (progress?.body.length) yield render(progress);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function* plainText(parts: Iterable<Part>): Generator<string> {
|
|
63
|
+
let chunk = "";
|
|
64
|
+
for (const line of printed(parts)) {
|
|
65
|
+
chunk += `${line}\n`;
|
|
66
|
+
if (chunk.length >= PART) {
|
|
67
|
+
yield chunk;
|
|
68
|
+
chunk = "";
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (chunk) yield chunk;
|
|
72
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type Bug,
|
|
3
|
+
CHART_STATES,
|
|
4
|
+
type Chart,
|
|
5
|
+
type Graph,
|
|
6
|
+
hasSection,
|
|
7
|
+
list,
|
|
8
|
+
must,
|
|
9
|
+
type Property,
|
|
10
|
+
RERUN_STATES,
|
|
11
|
+
ruleKey,
|
|
12
|
+
type Spec,
|
|
13
|
+
type Stop,
|
|
14
|
+
type Story,
|
|
15
|
+
type Verdict,
|
|
16
|
+
} from "../ir.ts";
|
|
17
|
+
|
|
18
|
+
const stepsOf = (story: Story) => {
|
|
19
|
+
const path: { step?: string; state: string }[] = [];
|
|
20
|
+
for (const { step, state } of story) {
|
|
21
|
+
const parts: string[] = [];
|
|
22
|
+
for (const [name, names] of Object.entries(state))
|
|
23
|
+
parts.push((name ? `${name} ` : "") + names.join(" / "));
|
|
24
|
+
path.push({ step, state: parts.join(", ") });
|
|
25
|
+
}
|
|
26
|
+
return path;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const forever = (loop: { state: string }[], stutters: boolean | undefined) => {
|
|
30
|
+
const quoted = new Set<string>();
|
|
31
|
+
for (const p of loop) quoted.add(`"${p.state}"`);
|
|
32
|
+
const runs = [...quoted];
|
|
33
|
+
if (stutters) return `The run stops in ${runs[0]} forever.`;
|
|
34
|
+
return runs.length === 1
|
|
35
|
+
? `The run stays in ${runs[0]} forever.`
|
|
36
|
+
: `The run loops through ${list(runs)} forever.`;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const fenced = (text: string) => ["```", text, "```"].join("\n");
|
|
40
|
+
|
|
41
|
+
export function report(
|
|
42
|
+
{
|
|
43
|
+
spec,
|
|
44
|
+
graph,
|
|
45
|
+
paths,
|
|
46
|
+
rules,
|
|
47
|
+
properties,
|
|
48
|
+
stop,
|
|
49
|
+
drawing,
|
|
50
|
+
states,
|
|
51
|
+
}: {
|
|
52
|
+
spec: Spec;
|
|
53
|
+
graph: Graph;
|
|
54
|
+
paths: Bug[] | undefined;
|
|
55
|
+
rules: Verdict[];
|
|
56
|
+
properties: Property[];
|
|
57
|
+
stop: Stop | undefined;
|
|
58
|
+
drawing: { status: number | null } | undefined;
|
|
59
|
+
states: { distinct: number; initial: number; complete: boolean; cut: boolean };
|
|
60
|
+
},
|
|
61
|
+
found: Bug[],
|
|
62
|
+
chart: Chart | undefined,
|
|
63
|
+
stories: Map<Bug, Story>,
|
|
64
|
+
) {
|
|
65
|
+
let size = 0;
|
|
66
|
+
let arrows = 0;
|
|
67
|
+
for (const r of chart?.regions ?? []) {
|
|
68
|
+
size += r.states.length;
|
|
69
|
+
arrows += r.steps.length;
|
|
70
|
+
}
|
|
71
|
+
let past = 0;
|
|
72
|
+
let pastSteps = 0;
|
|
73
|
+
let excluded = 0;
|
|
74
|
+
for (const s of graph.states.values()) {
|
|
75
|
+
if (s.excluded) excluded++;
|
|
76
|
+
else if (s.past) past++;
|
|
77
|
+
}
|
|
78
|
+
for (const t of graph.steps) if (must(graph.states, t.to).past) pastSteps++;
|
|
79
|
+
const includes = (n: number) =>
|
|
80
|
+
chart ? `, and the chart includes ${n === 1 ? "it" : "them"}` : "";
|
|
81
|
+
const out = [
|
|
82
|
+
`# ${spec.module}`,
|
|
83
|
+
"",
|
|
84
|
+
paths
|
|
85
|
+
? `TLC reached ${states.complete && !states.cut && states.distinct > CHART_STATES ? `${states.distinct.toLocaleString("en-US")} states, more than` : "more states than"} the chart budget of ${CHART_STATES}, so ${chart ? `the chart draws only the bug paths: ${size} states and ${arrows} arrows` : "the command wrote no chart.mmd"}.`
|
|
86
|
+
: `TLC reached ${graph.states.size - past - excluded} states and ${graph.steps.length - pastSteps} steps. The chart draws ${size} states and ${arrows} arrows.`,
|
|
87
|
+
];
|
|
88
|
+
if (drawing)
|
|
89
|
+
out.push(
|
|
90
|
+
`TLC stopped the drawing run with exit ${drawing.status}, so the chart draws only the states that it reached before it stopped.`,
|
|
91
|
+
);
|
|
92
|
+
if (!paths && !drawing && graph.states.size === past + excluded)
|
|
93
|
+
out.push(
|
|
94
|
+
states.initial
|
|
95
|
+
? "Every initial state is outside the constraints, so TLC explores none of them."
|
|
96
|
+
: "TLC found no state that satisfies Init, so no state can break a rule.",
|
|
97
|
+
);
|
|
98
|
+
if (past)
|
|
99
|
+
out.push(
|
|
100
|
+
`${past === 1 ? "1 state outside the constraints ends" : `${past} states outside the constraints each end`} a rule's path${includes(past)}. TLC checks the rules in a state outside the constraints, but it does not explore past it.`,
|
|
101
|
+
);
|
|
102
|
+
if (excluded)
|
|
103
|
+
out.push(
|
|
104
|
+
`${excluded === 1 ? "1 step that the constraints exclude ends" : `${excluded} steps that the constraints exclude each end`} a rule's path${includes(excluded)}. TLC checks the rules after such a step, but it does not take the step.`,
|
|
105
|
+
);
|
|
106
|
+
if (chart?.inside)
|
|
107
|
+
out.push(`The chart does not draw ${chart.inside} steps that stay in one chart state.`);
|
|
108
|
+
if (chart?.quiet)
|
|
109
|
+
out.push(`The view hides ${chart.quiet} steps, so the chart does not draw them.`);
|
|
110
|
+
for (const { rule, outcome } of rules)
|
|
111
|
+
if (
|
|
112
|
+
!paths &&
|
|
113
|
+
rule.kind === "deadlock" &&
|
|
114
|
+
outcome === "broken" &&
|
|
115
|
+
(drawing || hasSection(spec, "CONSTRAINT", "ACTION_CONSTRAINT"))
|
|
116
|
+
)
|
|
117
|
+
out.push(
|
|
118
|
+
drawing
|
|
119
|
+
? "The chart marks only the deadlock that TLC reports, because the drawing run stopped before it reached every state."
|
|
120
|
+
: "The chart marks only the deadlock that TLC reports. Under a CONSTRAINT or an ACTION_CONSTRAINT, a state with no step in the chart can still have steps that the constraints leave out, and TLC does not count it as a deadlock.",
|
|
121
|
+
);
|
|
122
|
+
if (chart?.lie) out.push(`${chart.lie} So the chart draws parent states in place of regions.`);
|
|
123
|
+
out.push(...(chart?.notes ?? []));
|
|
124
|
+
const merged: string[] = [];
|
|
125
|
+
for (const k of ["VIEW", "SYMMETRY"]) if (hasSection(spec, k)) merged.push(k);
|
|
126
|
+
if (chart && merged.length)
|
|
127
|
+
out.push(
|
|
128
|
+
`With ${list(merged)}, TLC keeps one representative for each group of states that it counts as the same. An arrow can lead to the representative rather than to the state that the step reaches.`,
|
|
129
|
+
);
|
|
130
|
+
for (const bug of found) {
|
|
131
|
+
const steps = `${bug.path.length} step${bug.path.length === 1 ? "" : "s"}`;
|
|
132
|
+
out.push("", `## ${bug.rule.name} breaks`);
|
|
133
|
+
out.push(
|
|
134
|
+
bug.rule.kind === "property"
|
|
135
|
+
? `TLC's counterexample is in tlc-${bug.rule.name}.out. It has ${steps}:`
|
|
136
|
+
: `The shortest path has ${steps}:`,
|
|
137
|
+
);
|
|
138
|
+
const path = stepsOf(must(stories, bug));
|
|
139
|
+
for (const [i, p] of path.entries()) out.push(`${i}. ${p.step ? `${p.step}: ` : ""}${p.state}`);
|
|
140
|
+
if (bug.loop !== undefined) out.push(forever(path.slice(bug.loop), bug.stutters));
|
|
141
|
+
}
|
|
142
|
+
const drawn = new Set<string>();
|
|
143
|
+
for (const b of found) drawn.add(ruleKey(b.rule));
|
|
144
|
+
const holds: string[] = [];
|
|
145
|
+
const unchecked: string[] = [];
|
|
146
|
+
for (const { rule, outcome, messages } of [...rules, ...properties]) {
|
|
147
|
+
if (outcome === "holds") holds.push(rule.name);
|
|
148
|
+
else if (outcome === "not checked") unchecked.push(rule.name);
|
|
149
|
+
else if (messages && !drawn.has(ruleKey(rule)))
|
|
150
|
+
out.push(
|
|
151
|
+
"",
|
|
152
|
+
`## ${rule.name} breaks`,
|
|
153
|
+
`TLC found a counterexample. It is in tlc-${rule.name}.out.`,
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
if (holds.length) out.push("", "## Rules that hold", holds.join(", "));
|
|
157
|
+
if (unchecked.length) out.push("", "## Rules not checked", unchecked.join(", "));
|
|
158
|
+
if (unchecked.length && states.cut)
|
|
159
|
+
out.push(
|
|
160
|
+
`After the first break, each TLC run stops at ${RERUN_STATES.toLocaleString("en-US")} distinct states. A run reached that bound before it checked ${unchecked.length === 1 ? "this rule" : "these rules"} in every state.`,
|
|
161
|
+
);
|
|
162
|
+
if (stop)
|
|
163
|
+
out.push(
|
|
164
|
+
...(unchecked.length
|
|
165
|
+
? [
|
|
166
|
+
`TLC stopped with exit ${stop.status} before it checked ${unchecked.length === 1 ? "this rule" : "these rules"}:`,
|
|
167
|
+
]
|
|
168
|
+
: ["", "## TLC stopped", `TLC stopped with exit ${stop.status}:`]),
|
|
169
|
+
fenced(stop.message),
|
|
170
|
+
);
|
|
171
|
+
for (const p of properties)
|
|
172
|
+
if (p.outcome === "holds" && p.initialOnly)
|
|
173
|
+
out.push(
|
|
174
|
+
`TLC checked ${p.rule.name} only in the initial states, because it has no [], <>, or ~>. List it as an INVARIANT to check every state.`,
|
|
175
|
+
);
|
|
176
|
+
return out.join("\n");
|
|
177
|
+
}
|