@namewta/skills-hub 0.1.49 → 0.1.51
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/README.md +4 -1
- package/THIRD_PARTY_NOTICES.md +19 -7
- package/cli.mjs +2 -2
- package/install.mjs +11 -4
- package/package.json +1 -1
- package/scripts/persistence/home.md +1 -1
- package/skills/dev/dev-build/SKILL.md +2 -0
- package/skills/dev/dev-build/references/implement-request.md +7 -2
- package/skills/dev/dev-formal-verify/SKILL.md +2 -1
- package/skills/dev/dev-formal-verify/references/create-check.md +3 -1
- package/skills/dev/dev-formal-verify/references/example.md +1 -1
- package/skills/dev/dev-formal-verify/references/tool-choice.md +1 -1
- package/skills/dev/dev-help/references/capabilities.md +6 -6
- package/skills/dev/dev-help/references/guide-verification.md +7 -1
- package/skills/dev/dev-help/references/help-method.md +7 -1
- package/skills/dev/dev-issue/SKILL.md +1 -0
- package/skills/dev/dev-issue/references/github-operations.md +8 -0
- package/skills/dev/dev-plan/references/plan-template.md +1 -0
- package/skills/dev/dev-plan/references/vertical-slicing.md +2 -0
- package/skills/dev/dev-pr/references/pull-request-evidence.md +2 -0
- package/skills/dev/dev-review/references/host-parity.md +12 -0
- package/skills/dev/dev-review/references/review-baseline.md +2 -0
- package/skills/dev/dev-setup/references/formal-options.md +1 -1
- package/skills/dev/dev-statechart/SKILL.md +17 -19
- package/skills/dev/dev-statechart/agents/openai.yaml +3 -3
- package/skills/dev/dev-statechart/assets/theme.css +135 -0
- package/skills/dev/dev-statechart/references/lean-proof.md +47 -0
- package/skills/dev/dev-statechart/references/render.md +15 -83
- package/skills/dev/dev-statechart/references/runtime.md +21 -1
- package/skills/dev/dev-statechart/scripts/lean/backends/lemma-chart.mjs +285 -0
- package/skills/dev/dev-statechart/scripts/lean/backends/mermaid.mjs +174 -0
- package/skills/dev/dev-statechart/scripts/lean/backends/proof-chart.mjs +540 -0
- package/skills/dev/dev-statechart/scripts/lean/backends/report.mjs +242 -0
- package/skills/dev/dev-statechart/scripts/lean/frontends/facts.mjs +234 -0
- package/skills/dev/dev-statechart/scripts/lean/frontends/view.mjs +217 -0
- package/skills/dev/dev-statechart/scripts/lean/ir.mjs +226 -0
- package/skills/dev/dev-statechart/scripts/lean/passes/attribute.mjs +148 -0
- package/skills/dev/dev-statechart/scripts/lean/passes/blocks.mjs +32 -0
- package/skills/dev/dev-statechart/scripts/lean/passes/budget.mjs +167 -0
- package/skills/dev/dev-statechart/scripts/lean/passes/check.mjs +70 -0
- package/skills/dev/dev-statechart/scripts/lean/passes/contract.mjs +160 -0
- package/skills/dev/dev-statechart/scripts/lean/passes/fold.mjs +206 -0
- package/skills/dev/dev-statechart/scripts/lean/passes/inline.mjs +84 -0
- package/skills/dev/dev-statechart/scripts/lean/passes/mark.mjs +432 -0
- package/skills/dev/dev-statechart/scripts/lean/passes/reduce.mjs +73 -0
- package/skills/dev/dev-statechart/scripts/lean/passes/trust.mjs +111 -0
- package/skills/dev/dev-statechart/scripts/lean/passes/view-lemmas.mjs +155 -0
- package/skills/dev/dev-statechart/scripts/lean/pipeline.mjs +164 -0
- package/skills/dev/dev-statechart/scripts/lean/run.mjs +168 -0
- package/skills/dev/dev-statechart/scripts/statechart.mjs +42 -23
- package/skills/dev/dev-statechart/scripts/worker.mjs +33 -7
- package/skills/dev/dev-ui-design/SKILL.md +2 -2
- package/skills/dev/dev-ui-design/references/interaction-review.md +9 -0
- package/skills/dev/dev-verify/SKILL.md +1 -1
- package/skills/dev/dev-verify/references/evidence-storage.md +12 -0
- package/skills/dev/dev-workflow/SKILL.md +6 -6
- package/skills/dev/dev-workflow/references/method-handoffs.md +7 -1
- package/skills/dev/dev-writing/SKILL.md +2 -0
- package/skills/dev/dev-writing/references/library-docs.md +37 -0
- package/skills/home/home-doctor/references/diagnosis.md +2 -2
- package/skills/home/home-doctor/scripts/doctor.mjs +68 -38
- package/skills/home/home-project-changelog/SKILL.md +6 -6
- package/skills/home/home-project-changelog/assets/project-changelog.example.json +188 -0
- package/skills/home/home-project-changelog/assets/project-changelog.schema.json +156 -0
- package/skills/home/home-project-changelog/assets/worker-brief.md +1 -1
- package/skills/home/home-project-changelog/references/git-ranges.md +2 -2
- package/skills/home/home-project-changelog/references/schema.md +60 -0
- package/skills/home/home-project-changelog/references/tools.md +27 -22
- package/skills/home/home-project-changelog/references/workflow.md +12 -9
- package/skills/home/home-project-changelog/references/writing.md +5 -3
- package/skills/home/home-project-changelog/scripts/changelog.mjs +34 -37
- package/skills/home/home-project-changelog/scripts/contract.mjs +39 -3
- package/skills/home/home-project-changelog/scripts/legacy-markdown.mjs +116 -0
- package/skills/home/home-project-changelog/scripts/migrate.mjs +122 -0
- package/skills/home/home-project-changelog/scripts/revision.mjs +2 -196
- package/skills/home/home-project-changelog/scripts/storage.mjs +120 -125
- package/skills/home/home-project-changelog/scripts/summary.mjs +0 -60
- package/skills/home/home-route/SKILL.md +2 -2
- package/skills/home/home-route/references/routing.md +3 -1
- package/skills/home/home-route/scripts/route.mjs +79 -11
- package/skills/home/home-setup/SKILL.md +2 -1
- package/skills/home/home-setup/assets/repos.schema.json +10 -0
- package/skills/home/home-setup/references/registry.md +18 -1
- package/skills/home/home-setup/scripts/registry.mjs +67 -7
- package/skills/home/home-website/SKILL.md +13 -9
- package/skills/home/home-website/assets/website/scripts/inputs.mjs +136 -128
- package/skills/home/home-website/assets/website/scripts/render.mjs +3 -3
- package/skills/home/home-website/assets/website/scripts/site.mjs +21 -10
- package/skills/home/home-website/assets/website/site/public/home-assets/app.js +69 -23
- package/skills/home/home-website/assets/website/site/public/home-assets/site.css +74 -42
- package/skills/home/home-website/assets/website/site/templates/layout.mjs +2 -6
- package/skills/home/home-website/assets/website/site/templates/ledger.mjs +33 -24
- package/skills/home/home-website/assets/website/site/templates/model.mjs +28 -5
- package/skills/home/home-website/assets/website/site/templates/pages.mjs +48 -19
- package/skills/home/home-website/assets/website/site/templates/project-logs.mjs +2 -107
- package/skills/home/home-website/assets/website/site.config.json +1 -1
- package/skills/home/home-website/references/website.md +64 -46
- package/skills/home/home-website/scripts/activate.mjs +105 -0
- package/skills/home/home-website/scripts/init.mjs +79 -11
- package/skills/home/home-workflow/SKILL.md +6 -4
- package/skills/system/system-clash-proxy-config/SKILL.md +21 -0
- package/skills/system/system-clash-proxy-config/agents/openai.yaml +4 -0
- package/skills/system/system-clash-proxy-config/assets/clash-override.js +328 -0
- package/skills/system/{system-proxy → system-clash-proxy-config}/references/browser-privacy.md +2 -2
- package/skills/system/{system-config → system-clash-proxy-config}/references/changes.md +2 -2
- package/skills/system/{system-proxy → system-clash-proxy-config}/references/clash-verge.md +1 -1
- package/skills/system/{system-proxy → system-clash-proxy-config}/references/diagnosis.md +1 -1
- package/skills/system/system-clash-proxy-config/references/dns-workflow.md +42 -0
- package/skills/system/system-clash-proxy-config/references/egress-macos.md +31 -0
- package/skills/system/system-clash-proxy-config/references/egress-windows.md +37 -0
- package/skills/system/system-clash-proxy-config/references/egress.md +12 -0
- package/skills/system/{system-proxy → system-clash-proxy-config}/references/flclash.md +1 -1
- package/skills/system/{system-proxy → system-clash-proxy-config}/references/index.md +1 -1
- package/skills/system/{system-clash-tun-egress → system-clash-proxy-config}/references/linux-cutover.md +29 -0
- package/skills/system/system-clash-proxy-config/references/locale-workflow.md +9 -0
- package/skills/system/{system-proxy → system-clash-proxy-config}/references/mihomo.md +1 -25
- package/skills/system/system-clash-proxy-config/references/session.md +34 -0
- package/skills/system/system-clash-proxy-config/references/subscription.md +29 -0
- package/skills/system/{system-proxy → system-clash-proxy-config}/references/troubleshooting.md +7 -7
- package/skills/system/{system-clash-tun-egress → system-clash-proxy-config}/references/verification.md +2 -0
- package/skills/system/system-clash-proxy-config/scripts/prepare-session.mjs +155 -0
- package/skills/system/system-clash-proxy-config/scripts/run-session.mjs +138 -0
- package/skills/system/system-inspect/SKILL.md +1 -1
- package/skills/system/system-inspect/references/health-audit.md +1 -1
- package/upstream-skills/zh-archify/SKILL.md +11 -11
- package/upstream-skills/zh-archify/assets/template.html +6 -3
- package/upstream-skills/zh-archify/bin/archify.mjs +67 -4
- package/upstream-skills/zh-archify/modules/code-analysis/ARCHITECTURE.md +7 -1
- package/upstream-skills/zh-archify/modules/code-analysis/bin/analyze-run.mjs +2 -1
- package/upstream-skills/zh-archify/modules/code-analysis/bin/check.mjs +29 -15
- package/upstream-skills/zh-archify/modules/code-analysis/bin/drift.mjs +3 -3
- package/upstream-skills/zh-archify/modules/code-analysis/bin/prepare.mjs +5 -6
- package/upstream-skills/zh-archify/modules/code-analysis/bin/serve.mjs +66 -36
- package/upstream-skills/zh-archify/modules/code-analysis/bin/verify-change.mjs +43 -13
- package/upstream-skills/zh-archify/modules/code-analysis/docs/TECH-GUIDE.md +1 -1
- package/upstream-skills/zh-archify/modules/code-analysis/docs/USAGE.md +37 -4
- package/upstream-skills/zh-archify/modules/code-analysis/extract/ts/functions.mjs +7 -5
- package/upstream-skills/zh-archify/modules/code-analysis/extract/ts/index.mjs +4 -1
- package/upstream-skills/zh-archify/modules/code-analysis/extract/ts/snapshot-host.mjs +9 -0
- package/upstream-skills/zh-archify/modules/code-analysis/lib/architecture-drift.mjs +28 -7
- package/upstream-skills/zh-archify/modules/code-analysis/lib/drift-capture.mjs +4 -3
- package/upstream-skills/zh-archify/modules/code-analysis/lib/git-sources.mjs +5 -3
- package/upstream-skills/zh-archify/modules/code-analysis/lib/output.mjs +272 -0
- package/upstream-skills/zh-archify/modules/code-analysis/lib/pull-request.mjs +34 -4
- package/upstream-skills/zh-archify/modules/code-analysis/lib/task.mjs +4 -2
- package/upstream-skills/zh-archify/modules/code-analysis/lib/verification-context.mjs +13 -1
- package/upstream-skills/zh-archify/modules/code-analysis/lib/verification-history.mjs +112 -0
- package/upstream-skills/zh-archify/modules/code-analysis/lib/verification.mjs +6 -2
- package/upstream-skills/zh-archify/modules/code-analysis/overlay/atlas.mjs +71 -5
- package/upstream-skills/zh-archify/modules/code-analysis/overlay/client/atlas.css +16 -2
- package/upstream-skills/zh-archify/modules/code-analysis/overlay/client/atlas.js +121 -5
- package/upstream-skills/zh-archify/modules/code-analysis/overlay/client/atlas3d.js +38 -1
- package/upstream-skills/zh-archify/modules/code-analysis/overlay/client/overlay.css +14 -1
- package/upstream-skills/zh-archify/modules/code-analysis/overlay/client/overlay.js +187 -27
- package/upstream-skills/zh-archify/modules/code-analysis/overlay/client/verification.js +1 -1
- package/upstream-skills/zh-archify/modules/code-analysis/overlay/i18n.mjs +9 -0
- package/upstream-skills/zh-archify/modules/code-analysis/overlay/inject.mjs +1 -1
- package/upstream-skills/zh-archify/modules/code-analysis/overlay/page.mjs +11 -6
- package/upstream-skills/zh-archify/modules/code-analysis/overlay/pull-request.mjs +1 -1
- package/upstream-skills/zh-archify/modules/code-analysis/schemas/ai-task.schema.json +1 -0
- package/upstream-skills/zh-archify/modules/code-analysis/test/atlas.test.mjs +88 -0
- package/upstream-skills/zh-archify/modules/code-analysis/test/duplicates.test.mjs +1 -1
- package/upstream-skills/zh-archify/modules/code-analysis/test/external-workflow.test.mjs +1 -1
- package/upstream-skills/zh-archify/modules/code-analysis/test/fixtures/tasks/boundary.task.json +1 -0
- package/upstream-skills/zh-archify/modules/code-analysis/test/fixtures/tasks/boundary.task.missing.json +1 -0
- package/upstream-skills/zh-archify/modules/code-analysis/test/fixtures/tasks/complexity.task.json +1 -0
- package/upstream-skills/zh-archify/modules/code-analysis/test/fixtures/tasks/complexity.task.valid.json +1 -0
- package/upstream-skills/zh-archify/modules/code-analysis/test/fixtures/tasks/import-cycle.task.changed.json +1 -0
- package/upstream-skills/zh-archify/modules/code-analysis/test/fixtures/tasks/import-cycle.task.json +1 -0
- package/upstream-skills/zh-archify/modules/code-analysis/test/fixtures/tasks/module-cycle.task.json +1 -0
- package/upstream-skills/zh-archify/modules/code-analysis/test/function-source-range.test.mjs +10 -0
- package/upstream-skills/zh-archify/modules/code-analysis/test/output-recovery.test.mjs +626 -0
- package/upstream-skills/zh-archify/modules/code-analysis/test/pull-request.test.mjs +98 -2
- package/upstream-skills/zh-archify/modules/code-analysis/test/review.test.mjs +37 -0
- package/upstream-skills/zh-archify/modules/code-analysis/test/source-panel.test.mjs +2 -1
- package/upstream-skills/zh-archify/modules/code-analysis/test/task.test.mjs +3 -2
- package/upstream-skills/zh-archify/modules/code-analysis/test/verification-history.test.mjs +216 -0
- package/upstream-skills/zh-archify/modules/code-analysis/test/verification.test.mjs +122 -0
- package/upstream-skills/zh-archify/package-lock.json +2 -2
- package/upstream-skills/zh-archify/package.json +1 -1
- package/upstream-skills/zh-archify/references/authoring-contract.md +2 -0
- package/upstream-skills/zh-archify/references/explainer-authoring.md +1 -1
- package/upstream-skills/zh-archify/renderers/architecture/render-architecture.mjs +1 -0
- package/upstream-skills/zh-archify/renderers/class/render-class.mjs +1 -0
- package/upstream-skills/zh-archify/renderers/dataflow/render-dataflow.mjs +2 -1
- package/upstream-skills/zh-archify/renderers/erd/render-erd.mjs +1 -0
- package/upstream-skills/zh-archify/renderers/lifecycle/render-lifecycle.mjs +4 -2
- package/upstream-skills/zh-archify/renderers/sequence/render-sequence.mjs +4 -2
- package/upstream-skills/zh-archify/renderers/shared/cli.mjs +7 -1
- package/upstream-skills/zh-archify/renderers/timeline/render-timeline.mjs +1 -0
- package/upstream-skills/zh-archify/renderers/tree/render-tree.mjs +1 -0
- package/upstream-skills/zh-archify/renderers/waterfall/render-waterfall.mjs +1 -0
- package/upstream-skills/zh-archify/renderers/workflow/render-workflow.mjs +3 -2
- package/upstream-skills/zh-archify/renderers/workflow/workflow-compiler.mjs +68 -7
- package/upstream-skills/zh-archify/skill-release.json +1 -1
- package/upstream-skills/zh-modern-web-guidance/SKILL.md +4 -11
- package/upstream-skills/zh-modern-web-guidance/guides/built-in-ai/language-detection.md +20 -0
- package/upstream-skills/zh-modern-web-guidance/guides/built-in-ai/language-model.md +22 -0
- package/upstream-skills/zh-modern-web-guidance/guides/built-in-ai/prompt-api.md +22 -0
- package/upstream-skills/zh-modern-web-guidance/guides/built-in-ai/summarizer.md +20 -0
- package/upstream-skills/zh-modern-web-guidance/guides/built-in-ai/translator.md +22 -0
- package/upstream-skills/zh-modern-web-guidance/guides/performance/custom-ml-model-inference.md +342 -0
- package/upstream-skills/zh-modern-web-guidance/guides/performance/data-parallel-computation.md +337 -0
- package/upstream-skills/zh-modern-web-guidance/guides/performance/improve-next-page-load-performance.md +4 -1
- package/upstream-skills/zh-modern-web-guidance/guides/performance/large-scene-rendering.md +350 -0
- package/upstream-skills/zh-modern-web-guidance/guides/ui-atoms/position-aware-tooltips.md +9 -0
- package/upstream-skills/zh-modern-web-guidance/guides/ui-atoms/viewport-aware-dropdowns.md +9 -0
- package/upstream-skills/zh-modern-web-guidance/guides/ui-behaviors/animate-to-from-top-layer.md +9 -0
- package/upstream-skills/zh-modern-web-guidance/guides/ui-behaviors/declarative-dialog-popover-control.md +9 -0
- package/upstream-skills/zh-modern-web-guidance/guides/ui-behaviors/interest-triggered-tooltips.md +9 -0
- package/upstream-skills/zh-modern-web-guidance/guides/ui-behaviors/scroll-target-on-load.md +29 -0
- package/upstream-skills/zh-modern-web-guidance/guides/ui-behaviors/sortable-table.md +1 -0
- package/upstream-skills/zh-modern-web-guidance/guides/ui-components/app-menus.md +9 -0
- package/upstream-skills/zh-modern-web-guidance/guides/ui-components/context-menu.md +9 -0
- package/upstream-skills/zh-modern-web-guidance/guides/ui-components/copy-button.md +9 -0
- package/upstream-skills/zh-modern-web-guidance/guides/ui-components/dialog.md +10 -1
- package/upstream-skills/zh-modern-web-guidance/guides/ui-components/hovercard.md +9 -0
- package/upstream-skills/zh-modern-web-guidance/guides/ui-components/menu.md +9 -0
- package/upstream-skills/zh-modern-web-guidance/guides/ui-components/navbar.md +9 -0
- package/upstream-skills/zh-modern-web-guidance/guides/ui-components/persistent-app-tours.md +9 -0
- package/upstream-skills/zh-modern-web-guidance/guides/ui-components/persistent-toast-notifications.md +9 -0
- package/upstream-skills/zh-modern-web-guidance/guides/ui-components/toolbar.md +9 -0
- package/upstream-skills/zh-modern-web-guidance/guides/user-experience/content-first-noise-reduction.md +9 -0
- package/upstream-skills/zh-modern-web-guidance/guides/user-experience/natural-interactions.md +9 -0
- package/upstream-skills/zh-modern-web-guidance/guides/webmcp/agentic-javascript-tools.md +27 -0
- package/skills/home/home-project-changelog/assets/project-changelog.md +0 -35
- package/skills/system/system-clash-tun-egress/SKILL.md +0 -22
- package/skills/system/system-clash-tun-egress/agents/openai.yaml +0 -4
- package/skills/system/system-config/SKILL.md +0 -37
- package/skills/system/system-config/agents/openai.yaml +0 -4
- package/skills/system/system-config/references/ai-cli-config.md +0 -75
- package/skills/system/system-config/references/ai-cli-optimization.md +0 -37
- package/skills/system/system-config/references/index.md +0 -12
- package/skills/system/system-config/references/locale-workflow.md +0 -33
- package/skills/system/system-config/references/locale.md +0 -50
- package/skills/system/system-proxy/SKILL.md +0 -40
- package/skills/system/system-proxy/agents/openai.yaml +0 -4
- package/skills/system/system-proxy/assets/protected-rules.yaml +0 -7
- package/skills/system/system-proxy/references/dns-workflow.md +0 -152
- /package/skills/system/{system-config → system-clash-proxy-config}/assets/configuration.md +0 -0
- /package/skills/system/{system-proxy → system-clash-proxy-config}/assets/network.md +0 -0
- /package/skills/system/{system-proxy → system-clash-proxy-config}/references/acceptance.md +0 -0
- /package/skills/system/{system-proxy → system-clash-proxy-config}/references/dns-fields.md +0 -0
- /package/skills/system/{system-proxy → system-clash-proxy-config}/references/dns-misconceptions.md +0 -0
- /package/skills/system/{system-clash-tun-egress/references/troubleshooting.md → system-clash-proxy-config/references/egress-troubleshooting.md} +0 -0
- /package/skills/system/{system-config → system-clash-proxy-config}/references/locale-linux.md +0 -0
- /package/skills/system/{system-config → system-clash-proxy-config}/references/locale-macos.md +0 -0
- /package/skills/system/{system-config → system-clash-proxy-config}/references/locale-windows.md +0 -0
- /package/skills/system/{system-proxy → system-clash-proxy-config}/references/network-performance.md +0 -0
- /package/skills/system/{system-clash-tun-egress → system-clash-proxy-config}/references/nodes-and-dns.md +0 -0
- /package/skills/system/{system-proxy → system-clash-proxy-config}/references/platform-dns.md +0 -0
- /package/skills/system/{system-proxy → system-clash-proxy-config}/references/platforms.md +0 -0
- /package/skills/system/{system-proxy → system-clash-proxy-config}/references/tun-dns.md +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
.pele {
|
|
2
|
+
color-scheme: light dark;
|
|
2
3
|
--pele-bg: #ffffff;
|
|
3
4
|
--pele-fg: #1c1c1c;
|
|
4
5
|
--pele-muted: #656565;
|
|
@@ -39,6 +40,79 @@
|
|
|
39
40
|
stroke-width: 2.5px !important;
|
|
40
41
|
stroke-dasharray: 6 3;
|
|
41
42
|
}
|
|
43
|
+
.pele .target rect, .pele .target polygon, .pele .target circle {
|
|
44
|
+
fill: #e8f2ff !important;
|
|
45
|
+
stroke: #1680f3 !important;
|
|
46
|
+
stroke-width: 2.5px !important;
|
|
47
|
+
}
|
|
48
|
+
.pele .target text { fill: #0d4ea6 !important; }
|
|
49
|
+
.pele .goalRoot rect, .pele .goalRoot polygon, .pele .goalRoot circle {
|
|
50
|
+
fill: #e8f2ff !important;
|
|
51
|
+
stroke: #1680f3 !important;
|
|
52
|
+
stroke-width: 2px !important;
|
|
53
|
+
}
|
|
54
|
+
.pele .goalRoot text { fill: #0d4ea6 !important; }
|
|
55
|
+
.pele .subRoot rect, .pele .subRoot polygon, .pele .subRoot circle {
|
|
56
|
+
fill: #eef2ff !important;
|
|
57
|
+
stroke: #6366f1 !important;
|
|
58
|
+
stroke-width: 2px !important;
|
|
59
|
+
}
|
|
60
|
+
.pele .subRoot text { fill: #3730a3 !important; }
|
|
61
|
+
.pele .termRoot rect, .pele .termRoot polygon, .pele .termRoot circle {
|
|
62
|
+
fill: #f0fdfa !important;
|
|
63
|
+
stroke: #0d9488 !important;
|
|
64
|
+
stroke-width: 2px !important;
|
|
65
|
+
}
|
|
66
|
+
.pele .termRoot text { fill: #115e59 !important; }
|
|
67
|
+
.pele .closed rect, .pele .closed polygon, .pele .closed circle {
|
|
68
|
+
fill: #e9f7ef !important;
|
|
69
|
+
stroke: #229954 !important;
|
|
70
|
+
stroke-width: 1.5px !important;
|
|
71
|
+
}
|
|
72
|
+
.pele .closed text { fill: #145a32 !important; }
|
|
73
|
+
.pele .folded rect, .pele .folded polygon, .pele .folded circle {
|
|
74
|
+
fill: #f3ecff !important;
|
|
75
|
+
stroke: #8b5cf6 !important;
|
|
76
|
+
stroke-width: 1.5px !important;
|
|
77
|
+
}
|
|
78
|
+
.pele .folded text { fill: #5b21b6 !important; }
|
|
79
|
+
.pele .stub rect, .pele .stub polygon, .pele .stub circle {
|
|
80
|
+
fill: #f4f4f5 !important;
|
|
81
|
+
stroke: #71717a !important;
|
|
82
|
+
stroke-width: 1.5px !important;
|
|
83
|
+
stroke-dasharray: 5 3;
|
|
84
|
+
}
|
|
85
|
+
.pele .stub text { fill: #52525b !important; }
|
|
86
|
+
.pele .note rect, .pele .note polygon, .pele .note circle {
|
|
87
|
+
fill: #fafafa !important;
|
|
88
|
+
stroke: #d4d4d8 !important;
|
|
89
|
+
stroke-width: 1px !important;
|
|
90
|
+
}
|
|
91
|
+
.pele .note text { fill: #52525b !important; }
|
|
92
|
+
.pele .doubtPath rect, .pele .doubtPath polygon, .pele .doubtPath circle {
|
|
93
|
+
stroke: #e72e3b !important;
|
|
94
|
+
stroke-width: 2.5px !important;
|
|
95
|
+
}
|
|
96
|
+
.pele .open rect, .pele .open polygon, .pele .open circle,
|
|
97
|
+
.pele .axiom rect, .pele .axiom polygon, .pele .axiom circle,
|
|
98
|
+
.pele .restsOn rect, .pele .restsOn polygon, .pele .restsOn circle {
|
|
99
|
+
fill: #fff3e6 !important;
|
|
100
|
+
stroke: #e8730c !important;
|
|
101
|
+
stroke-width: 2.5px !important;
|
|
102
|
+
}
|
|
103
|
+
.pele .open text, .pele .axiom text, .pele .restsOn text {
|
|
104
|
+
fill: #b85a06 !important;
|
|
105
|
+
}
|
|
106
|
+
.pele .sorry rect, .pele .sorry polygon, .pele .sorry circle,
|
|
107
|
+
.pele .error rect, .pele .error polygon, .pele .error circle,
|
|
108
|
+
.pele .native rect, .pele .native polygon, .pele .native circle {
|
|
109
|
+
fill: #ffecee !important;
|
|
110
|
+
stroke: #e72e3b !important;
|
|
111
|
+
stroke-width: 2.5px !important;
|
|
112
|
+
}
|
|
113
|
+
.pele .sorry text, .pele .error text, .pele .native text {
|
|
114
|
+
fill: #cd2834 !important;
|
|
115
|
+
}
|
|
42
116
|
@media (prefers-color-scheme: dark) {
|
|
43
117
|
.pele {
|
|
44
118
|
--pele-bg: #1f1f1f;
|
|
@@ -76,4 +150,65 @@
|
|
|
76
150
|
.pele .repeats rect {
|
|
77
151
|
stroke: #9a3fcf !important;
|
|
78
152
|
}
|
|
153
|
+
.pele .target rect, .pele .target polygon, .pele .target circle {
|
|
154
|
+
fill: #172d47 !important;
|
|
155
|
+
stroke: #4c9aff !important;
|
|
156
|
+
}
|
|
157
|
+
.pele .target text { fill: #9cc9ff !important; }
|
|
158
|
+
.pele .goalRoot rect, .pele .goalRoot polygon, .pele .goalRoot circle {
|
|
159
|
+
fill: #172d47 !important;
|
|
160
|
+
stroke: #4c9aff !important;
|
|
161
|
+
}
|
|
162
|
+
.pele .goalRoot text { fill: #9cc9ff !important; }
|
|
163
|
+
.pele .subRoot rect, .pele .subRoot polygon, .pele .subRoot circle {
|
|
164
|
+
fill: #1e1b4b !important;
|
|
165
|
+
stroke: #818cf8 !important;
|
|
166
|
+
}
|
|
167
|
+
.pele .subRoot text { fill: #c7d2fe !important; }
|
|
168
|
+
.pele .termRoot rect, .pele .termRoot polygon, .pele .termRoot circle {
|
|
169
|
+
fill: #134e4a !important;
|
|
170
|
+
stroke: #2dd4bf !important;
|
|
171
|
+
}
|
|
172
|
+
.pele .termRoot text { fill: #99f6e4 !important; }
|
|
173
|
+
.pele .closed rect, .pele .closed polygon, .pele .closed circle {
|
|
174
|
+
fill: #153323 !important;
|
|
175
|
+
stroke: #34d399 !important;
|
|
176
|
+
}
|
|
177
|
+
.pele .closed text { fill: #86efac !important; }
|
|
178
|
+
.pele .folded rect, .pele .folded polygon, .pele .folded circle {
|
|
179
|
+
fill: #2c1f4a !important;
|
|
180
|
+
stroke: #a78bfa !important;
|
|
181
|
+
}
|
|
182
|
+
.pele .folded text { fill: #ddd6fe !important; }
|
|
183
|
+
.pele .stub rect, .pele .stub polygon, .pele .stub circle {
|
|
184
|
+
fill: #27272a !important;
|
|
185
|
+
stroke: #a1a1aa !important;
|
|
186
|
+
}
|
|
187
|
+
.pele .stub text { fill: #d4d4d8 !important; }
|
|
188
|
+
.pele .note rect, .pele .note polygon, .pele .note circle {
|
|
189
|
+
fill: #262626 !important;
|
|
190
|
+
stroke: #52525b !important;
|
|
191
|
+
}
|
|
192
|
+
.pele .note text { fill: #d4d4d8 !important; }
|
|
193
|
+
.pele .doubtPath rect, .pele .doubtPath polygon, .pele .doubtPath circle {
|
|
194
|
+
stroke: #cf2b35 !important;
|
|
195
|
+
}
|
|
196
|
+
.pele .open rect, .pele .open polygon, .pele .open circle,
|
|
197
|
+
.pele .axiom rect, .pele .axiom polygon, .pele .axiom circle,
|
|
198
|
+
.pele .restsOn rect, .pele .restsOn polygon, .pele .restsOn circle {
|
|
199
|
+
fill: #2e2619 !important;
|
|
200
|
+
stroke: #d0700f !important;
|
|
201
|
+
}
|
|
202
|
+
.pele .open text, .pele .axiom text, .pele .restsOn text {
|
|
203
|
+
fill: #ffa257 !important;
|
|
204
|
+
}
|
|
205
|
+
.pele .sorry rect, .pele .sorry polygon, .pele .sorry circle,
|
|
206
|
+
.pele .error rect, .pele .error polygon, .pele .error circle,
|
|
207
|
+
.pele .native rect, .pele .native polygon, .pele .native circle {
|
|
208
|
+
fill: #2e2021 !important;
|
|
209
|
+
stroke: #cf2b35 !important;
|
|
210
|
+
}
|
|
211
|
+
.pele .sorry text, .pele .error text, .pele .native text {
|
|
212
|
+
fill: #ff6463 !important;
|
|
213
|
+
}
|
|
79
214
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# 审计已有的 Lean 定理
|
|
2
|
+
|
|
3
|
+
先取得可信源文件和目标定理名,核对[Lean 工具](runtime.md#lean-工具)。读完结论后展示 `lemmas.mmd`。有 tactic 轨迹时可进一步展示 `proof.mmd`。图解释本次 elaboration 的依赖和步骤。对项目整体构建或额外公理政策,沿用项目自己的检查。
|
|
4
|
+
|
|
5
|
+
## 选定声明并运行
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
node "$SKILL_DIR/scripts/statechart.mjs" proofs/Example.lean Example.main --out "$RUN_DIR/lean"
|
|
9
|
+
node "$SKILL_DIR/scripts/statechart.mjs" proofs/Example.lean Example.main --view proofs/view.mjs --tactics --out "$RUN_DIR/lean-labelled"
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
接受完整声明名或同一文件内唯一的点分后缀。重名时使用完整名。缺失或歧义、`unsafe`、普通定义以及 `module` 文件头会使本次检查退出 2。支持固定版本的 `lean-toolchain`,也可使用没有 pin 的独立文件。Lean 元程序、Lake 配置、导入和视图都可能执行代码,只使用可信项目。在 Lake 临时副本运行 `lake setup-file`,保留相对依赖关系。报告中的位置对应原文件。
|
|
13
|
+
|
|
14
|
+
## 解释事实和结论
|
|
15
|
+
|
|
16
|
+
一次 elaboration 产生 `facts.json`(`format: 1`),包含目标、源码范围、声明与依赖、公理、可选 tactic 轨迹和消息。可达依赖图的公理集合须与 `Lean.collectAxioms` 相等。有 tactic 轨迹时检查目标的父子关系、可达性、闭合步骤及开放状态。只把目标源码范围内的诊断归给本定理。
|
|
17
|
+
|
|
18
|
+
| 退出 | 含义 | 输出 |
|
|
19
|
+
| --- | --- | --- |
|
|
20
|
+
| 0 | 证明闭合,最多使用 `propext`、`Classical.choice`、`Quot.sound` | 事实、中文报告、引理图及适用的证明树 |
|
|
21
|
+
| 1 | `sorry`、失败步骤、开放目标、未经内核核验的原生计算(如 `native_decide`),或自定义公理 | 同样交付适用文件,指出发现位置及直接与传递依赖 |
|
|
22
|
+
| 2 | 输入或工具无效、视图试图隐藏关键事实、公理不一致或证明树不连贯 | 诊断。修正后用新目录复跑 |
|
|
23
|
+
| 130 / 143 | 父进程收到 `SIGINT` / `SIGTERM` | 本轮中断,保留既有结果 |
|
|
24
|
+
|
|
25
|
+
`report.md` 列出完整公理、未截断的目标、假设、tactic、引理陈述及诊断。末尾记录实际文件、Lean/Lake 版本、退出值和执行参数。捕获回放检验本地处理与绘图,定理复验使用真实编译器的新运行。
|
|
26
|
+
|
|
27
|
+
## 阅读两种图
|
|
28
|
+
|
|
29
|
+
- 引理图由使用方指向所用声明。实线可以穿过编译器辅助声明,虚线说明经用户定义的依赖,粗线标出到疑点的最短依赖路径。先看目标、公理与疑点,再展开干净辅助引理。
|
|
30
|
+
- 证明树按目标、分支、新增假设、所用引理和结果组织。纯项证明以引理图及报告交付。若一臂直接 `sorry`,另一臂调用带 `sorry` 的引理,分别给出本定理和辅助声明的位置。
|
|
31
|
+
- 展示预算为 60 个引理节点、40 个证明块。保留疑点路径,先折叠可压缩的干净子树。必要路径或无法进一步折叠的独立叶子可能超过预算。原始 tactic 摘要最多 8 行,新增假设预览最多 3 条,默认行宽 64 字符。图例给出省略数,报告提供完整内容。`--tactics` 控制图框文本。
|
|
32
|
+
|
|
33
|
+
## 使用中文视图
|
|
34
|
+
|
|
35
|
+
`--view FILE` 接受可信的 JavaScript 模块。`title` 为字符串或 `{ lemmas, proof }`。`lemma(info)` 可返回字符串、`{ label, group, hide }`、`null` 或 `undefined`,`group(info)` 可提供分组名称。`branch(info)` 返回字符串或 `{ label, detail }`,`caseLabel(tag, info)` 提供分支边名。分支信息提供稳定的 `root`、`root.0`、目标、假设、步骤、状态和原始 case 标签。不同目标折叠到同一分支时,`goal` 为空字符串,`newHyps` 为空数组。
|
|
36
|
+
|
|
37
|
+
```js
|
|
38
|
+
export const title = { lemmas: "本定理使用的引理", proof: "每个分支如何闭合" };
|
|
39
|
+
export function lemma(info) {
|
|
40
|
+
if (info.name === "Example.cleanHelper") return null;
|
|
41
|
+
}
|
|
42
|
+
export function branch(info) {
|
|
43
|
+
if (info.id === "root") return { label: "读者要核对的结论" };
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
只有干净辅助引理允许隐藏。工具桥接前后依赖、记录隐藏数并再次核对公理。隐藏目标、未证或失败节点、自定义公理、原生计算及依赖这些问题的引理会退出 2。信任标记由事实决定。需要图片时按[渲染说明](render.md)导出。
|
|
@@ -1,101 +1,33 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 渲染状态图与证明图
|
|
2
2
|
|
|
3
3
|
用 npm 包 `pele@1.9.0` 渲染你展示的每个 `.mmd` 文件,并把 SVG 交给用户。在本技能的 scripts 目录按[运行环境](runtime.md)准备固定版本依赖。用 `--out` 把 SVG 写到目标项目的本轮 `temp/dev/` 目录,使用便于对应的文件名。完整调用方式为 `const { svg } = render(mermaidText, options)`,本技能的[渲染脚本](../scripts/render.mjs)执行该调用。向 `render` 传入 `{ limit: 1_000_000, outputLimit: 8_000_000, maxEdges: 10_000 }` 作为选项。Pele 的默认上限可能小于 500 个状态的图所需的上限。Pele 抛出 `PeleError` 时,向用户展示 Mermaid 文本与错误。
|
|
4
4
|
|
|
5
5
|
## 颜色
|
|
6
6
|
|
|
7
|
-
Pele 忽略 Mermaid 的 `theme` 和 `themeVariables`。在 `.pele` 上设置它的 `--pele-*` CSS
|
|
7
|
+
Pele 忽略 Mermaid 的 `theme` 和 `themeVariables`。在 `.pele` 上设置它的 `--pele-*` CSS 变量。全部主题变量与形状规则见包内 CSS。命令为每个状态指定其分组的颜色类,例如 `class sN teal`。每个错误状态标为 `class sN breaks` 或 `class sN mayBreak`,通往缺陷的路径前缀上的状态标为 `class sN bugPath`,PROPERTY 反例中无限重复的每个状态标为 `class sN repeats`。状态不变量的路径按报告判断最短,时序反例不作全局最短承诺。Pele 把这些类加到状态节点上。主题据此着色。[主题文件](../assets/theme.css)
|
|
8
8
|
|
|
9
9
|
`.mmd` 文件中有 `breaks` 和 `mayBreak` 的 `classDef` 行,因此任何 Mermaid 查看器都能显示缺陷标记。文件不包含分组颜色、`bugPath` 或 `repeats` 的 `classDef`。Pele 把每个 `classDef` 颜色写成节点上的 `style` 属性,而 `style` 属性优先于普通 CSS 规则。因此,下面的标记规则使用 `!important`。如果没有它,深色主题会保留浅色标记颜色。缺陷标记设置填充色与文字色,`bugPath` 和 `repeats` 设置边框。把标记规则放在分组颜色之后,使标记覆盖分组颜色。
|
|
10
10
|
|
|
11
11
|
这些颜色是建议值。可以根据项目视觉规范调整。把它们放进每个 SVG 开头的 `<style>` 元素。这样每个 SVG 都会遵循查看器的浅色或深色设置。
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
```
|
|
13
|
+
完整浅色与深色 CSS 随[主题文件](../assets/theme.css)交付。独立 SVG 的根声明支持两种色彩方案,深色覆盖跟随查看器。Lean 引理图和证明树使用 `flowchart TD`。节点可绘制为矩形、多边形或圆形,三类形状都要匹配同一信任类别。
|
|
14
|
+
|
|
15
|
+
| 图中标记 | 读法 |
|
|
16
|
+
| --- | --- |
|
|
17
|
+
| `target`、`goalRoot`、`subRoot`、`termRoot` | 目标定理、主证明、子证明、项内证明 |
|
|
18
|
+
| `closed`、`sorry`、`error`、`open` | 已证、显式缺口、失败步骤、开放目标 |
|
|
19
|
+
| `axiom`、`native`、`restsOn`、`doubtPath` | 自定义公理、未经内核核验的计算、依赖疑点、通向疑点的路径 |
|
|
20
|
+
| `folded`、`stub`、`note` | 已折叠的分支、被省略的干净依赖、图例说明 |
|
|
21
|
+
|
|
22
|
+
分别查看亮、暗背景,检查中文状态文字、节点形状、粗线和虚线。每条路径的含义可在完整报告中复核。
|
|
94
23
|
|
|
95
24
|
## 本地命令
|
|
96
25
|
|
|
97
26
|
```sh
|
|
98
27
|
node "$SKILL_DIR/scripts/render.mjs" "$RUN_DIR/chart/chart.mmd" --out "$RUN_DIR/chart/chart.svg"
|
|
28
|
+
node "$SKILL_DIR/scripts/render.mjs" "$RUN_DIR/lean/lemmas.mmd" --out "$RUN_DIR/lean/lemmas.svg"
|
|
29
|
+
# 有 tactic 证明树时再导出 proof.mmd
|
|
30
|
+
node "$SKILL_DIR/scripts/render.mjs" "$RUN_DIR/lean/proof.mmd" --out "$RUN_DIR/lean/proof.svg"
|
|
99
31
|
```
|
|
100
32
|
|
|
101
33
|
`RUN_DIR` 是目标项目根 `temp/dev/` 下本轮目录的绝对路径。必须显式传入 `.svg` 输出路径,已有文件不会被覆盖。复跑时选择新的运行目录。命令只读取本地 Mermaid、主题和渲染模块,不发送模型内容到远程服务。可以用 `STATECHART_PELE_MODULE` 指定已经安装的 Pele 入口文件绝对路径;否则读取 scripts 目录已安装的固定依赖。
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## 必要组件
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
主命令根据第一个位置参数选择检查器。`.tla` 使用 Java 和本地 TLC,`.lean` 使用 Lean、Lake 和固定的编译器提取器。两个分支的 Node 协调代码只依赖标准库,图片导出另需 Pele。
|
|
6
6
|
|
|
7
7
|
| 组件 | 要求 | 用途 |
|
|
8
8
|
| --- | --- | --- |
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
| JavaScript 运行时 | Node.js 22.14 或更高版本 | 直接运行本技能的 `.mjs` 文件,无需编译器或其他脚本解释器 |
|
|
11
11
|
| Java | 11 或更高版本,按所选 TLC 版本要求核实 | 执行语法分析与模型检查 |
|
|
12
12
|
| TLC | 本地 `tla2tools.jar`,兼容性基线为 1.7.4 | SANY 与 TLC |
|
|
13
|
+
| Lean / Lake | Lean `v4.34.1` 和配套的 Lake | 独立文件和 Lake 工程的定理审计 |
|
|
14
|
+
| Lean 提取器 | 下方列出的固定文件和 SHA-256 | 从原生编译器取得公理、声明、源码范围及 tactic 轨迹 |
|
|
13
15
|
| Pele | 仅生成 SVG 时需要 `pele@1.9.0` | 本地 Mermaid 渲染 |
|
|
14
16
|
|
|
15
17
|
主命令不会下载、升级或替换这些工具。使用宿主已配置的包管理器或用户认可的安装渠道准备缺失依赖;工具安装需要网络时如实说明。核心文本报告不依赖 Pele。各平台仍须核实实际 Java、TLC 与进程终止权限;录制输出的回放通过不能代替真实 TLC 执行或进程中断验证。
|
|
@@ -36,6 +38,24 @@ node "$SKILL_DIR/scripts/statechart.mjs" /absolute/models/Reservation.tla \
|
|
|
36
38
|
|
|
37
39
|
在 PowerShell 中以 `$env:TLA2TOOLS`、`$env:JAVA` 设置环境变量,再运行 `node "$SKILL_DIR/scripts/statechart.mjs" ...`。参数中的目录始终加引号;不需要 Bash 或 WSL。
|
|
38
40
|
|
|
41
|
+
## Lean 工具
|
|
42
|
+
|
|
43
|
+
在本地安装 Lean `v4.34.1`,确认 `lean --version` 和 `lake --version` 报告相同的 Lean 版本。优先读取 `LEAN_SYSROOT` 指向的本地发行目录,否则在 PATH 中查找。提取器是独立的 Lean 编译器组件,一台使用 Lean 的主机准备一次。下面的命令在已有的本地工具目录运行。Windows 可用 `curl.exe` 和 `Get-FileHash`。
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
curl --fail --location --output Extract.lean https://raw.githubusercontent.com/cursor/plugins/2c2c4f1991c216e7e861971c072ce52c1fb5a8e0/harness/pstack/claude-code/skills/statechart/scripts/lean/Extract.lean
|
|
47
|
+
sha256sum Extract.lean
|
|
48
|
+
export STATECHART_LEAN_EXTRACTOR="$PWD/Extract.lean"
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
所需 SHA-256 是 `61facbc8670af16694ce8ebdf46d1952f2cc17ccb21fcbdda7bb913f638a973e`。入口每次校验字节,再从临时文件执行同一份内容。PowerShell 可设 `$env:STATECHART_LEAN_EXTRACTOR = (Resolve-Path .\Extract.lean).Path`。只做 TLC 时无需配置这两项。
|
|
52
|
+
|
|
53
|
+
```sh
|
|
54
|
+
node "$SKILL_DIR/scripts/statechart.mjs" /absolute/proofs/Example.lean Example.main --out "$RUN_DIR/lean"
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
传入 Lake 工程中的文件时,复制项目及其相对本地依赖,在副本执行 `lake setup-file`。源目录中已有的 `.lake/` 和清单不会被写入。准备可用的依赖或包缓存,使用可在副本重建的相对路径;错误输出会给出缺失项。独立文件也可以不带 `lean-toolchain`。读[定理审计方法](lean-proof.md)解释公理、证明图、视图与退出码。
|
|
58
|
+
|
|
39
59
|
## SVG 可选依赖
|
|
40
60
|
|
|
41
61
|
本技能[依赖清单](../scripts/package.json)固定使用 Pele 1.9.0。已授权准备依赖且环境允许联网时,可以在 scripts 目录安装;安装结果留在当前技能目录的 `node_modules` 中,不提交到本项目源码仓库。
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import {
|
|
2
|
+
byText,
|
|
3
|
+
clipLine,
|
|
4
|
+
edgeKey,
|
|
5
|
+
isSyntheticNativeAx,
|
|
6
|
+
LINE_WIDTH,
|
|
7
|
+
shortName,
|
|
8
|
+
summarizeDoc,
|
|
9
|
+
} from "../ir.mjs";
|
|
10
|
+
function displayNames(target, names, userNames) {
|
|
11
|
+
const targetUser = userNames.get(target) ?? target;
|
|
12
|
+
const dot = targetUser.indexOf(".");
|
|
13
|
+
const prefix = dot === -1 ? "" : targetUser.slice(0, dot + 1);
|
|
14
|
+
const counts = new Map();
|
|
15
|
+
const stripped = new Map();
|
|
16
|
+
for (const name of names) {
|
|
17
|
+
const u = userNames.get(name) ?? name;
|
|
18
|
+
const s = prefix && u.startsWith(prefix) ? u.slice(prefix.length) : u;
|
|
19
|
+
stripped.set(name, s);
|
|
20
|
+
counts.set(s, (counts.get(s) ?? 0) + 1);
|
|
21
|
+
}
|
|
22
|
+
const out = new Map();
|
|
23
|
+
for (const name of names) {
|
|
24
|
+
const s = stripped.get(name) ?? name;
|
|
25
|
+
out.set(name, (counts.get(s) ?? 0) > 1 ? (userNames.get(name) ?? name) : s);
|
|
26
|
+
}
|
|
27
|
+
return out;
|
|
28
|
+
}
|
|
29
|
+
function doubtSummary(doubts, ownerUserName) {
|
|
30
|
+
const tags = [];
|
|
31
|
+
if (doubts.some((d) => d.kind === "error")) tags.push("失败步骤");
|
|
32
|
+
const sorryDoubts = doubts.filter((d) => d.kind === "sorry");
|
|
33
|
+
if (sorryDoubts.length > 0) {
|
|
34
|
+
const otherOwners = [
|
|
35
|
+
...new Set(
|
|
36
|
+
sorryDoubts.map((d) => d.in).filter((o) => o !== ownerUserName),
|
|
37
|
+
),
|
|
38
|
+
].sort(byText);
|
|
39
|
+
if (
|
|
40
|
+
otherOwners.length > 0 &&
|
|
41
|
+
sorryDoubts.every((d) => d.in !== ownerUserName)
|
|
42
|
+
) {
|
|
43
|
+
tags.push(
|
|
44
|
+
clipLine(
|
|
45
|
+
`未证缺口(${otherOwners.join("、")} 中的 sorry)`,
|
|
46
|
+
LINE_WIDTH,
|
|
47
|
+
),
|
|
48
|
+
);
|
|
49
|
+
} else {
|
|
50
|
+
tags.push("未证缺口(sorry)");
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (doubts.some((d) => d.kind === "native"))
|
|
54
|
+
tags.push("未经内核核验的原生计算");
|
|
55
|
+
if (doubts.some((d) => d.kind === "axiom")) tags.push("自定义公理");
|
|
56
|
+
return tags.length > 0 ? tags.join(", ") : undefined;
|
|
57
|
+
}
|
|
58
|
+
function doubtPathLegendLabel(kinds) {
|
|
59
|
+
const parts = [];
|
|
60
|
+
if (kinds.has("sorry")) parts.push("未证缺口");
|
|
61
|
+
if (kinds.has("error")) parts.push("失败步骤");
|
|
62
|
+
if (kinds.has("axiom")) parts.push("自定义公理");
|
|
63
|
+
if (kinds.has("native")) parts.push("native_decide");
|
|
64
|
+
if (parts.length === 0) return "依赖未证缺口";
|
|
65
|
+
return `依赖${parts.join(" / ")}`;
|
|
66
|
+
}
|
|
67
|
+
export function buildLemmaChart(input) {
|
|
68
|
+
const {
|
|
69
|
+
budgeted,
|
|
70
|
+
trust,
|
|
71
|
+
facts,
|
|
72
|
+
hiddenByView = 0,
|
|
73
|
+
view,
|
|
74
|
+
viewLabels,
|
|
75
|
+
viewGroups,
|
|
76
|
+
} = input;
|
|
77
|
+
const { graph, kept, hidden } = budgeted;
|
|
78
|
+
const ordered = [
|
|
79
|
+
graph.target,
|
|
80
|
+
...[...kept].filter((n) => n !== graph.target).sort(byText),
|
|
81
|
+
];
|
|
82
|
+
const userNames = new Map();
|
|
83
|
+
for (const name of ordered) {
|
|
84
|
+
const lemma = graph.lemmas.get(name);
|
|
85
|
+
if (lemma) userNames.set(name, lemma.decl.userName);
|
|
86
|
+
}
|
|
87
|
+
const shortLabels = displayNames(graph.target, ordered, userNames);
|
|
88
|
+
const doubtEdges = new Set();
|
|
89
|
+
for (const entry of trust.paths) {
|
|
90
|
+
for (let i = 0; i + 1 < entry.path.length; i++) {
|
|
91
|
+
doubtEdges.add(
|
|
92
|
+
edgeKey({
|
|
93
|
+
from: entry.path[i],
|
|
94
|
+
to: entry.path[i + 1],
|
|
95
|
+
}),
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
const ids = new Map();
|
|
100
|
+
let nextId = 0;
|
|
101
|
+
for (const name of ordered) ids.set(name, `n${nextId++}`);
|
|
102
|
+
const nodes = [];
|
|
103
|
+
const edges = [];
|
|
104
|
+
const usedClasses = new Set();
|
|
105
|
+
const doubtPathKinds = new Set();
|
|
106
|
+
for (const name of ordered) {
|
|
107
|
+
const lemma = graph.lemmas.get(name);
|
|
108
|
+
if (!lemma) continue;
|
|
109
|
+
const id = ids.get(name);
|
|
110
|
+
const ownDoubts = trust.own.get(name) ?? [];
|
|
111
|
+
const belowDoubts = trust.below.get(name) ?? [];
|
|
112
|
+
const customLabel = viewLabels?.get(name);
|
|
113
|
+
const shortDisplay =
|
|
114
|
+
shortLabels.get(name) ?? shortName(lemma.decl.userName);
|
|
115
|
+
const lines = [];
|
|
116
|
+
if (customLabel !== undefined) {
|
|
117
|
+
lines.push(clipLine(customLabel, 120));
|
|
118
|
+
} else if (isSyntheticNativeAx(lemma.decl.name)) {
|
|
119
|
+
lines.push("native_decide 检查");
|
|
120
|
+
} else if (lemma.decl.doc) {
|
|
121
|
+
lines.push(summarizeDoc(lemma.decl.doc, LINE_WIDTH));
|
|
122
|
+
lines.push(clipLine(shortDisplay, LINE_WIDTH));
|
|
123
|
+
} else {
|
|
124
|
+
lines.push(clipLine(shortDisplay, LINE_WIDTH));
|
|
125
|
+
}
|
|
126
|
+
const badge = doubtSummary(ownDoubts, lemma.decl.userName);
|
|
127
|
+
if (badge) lines.push(badge);
|
|
128
|
+
const classes = [];
|
|
129
|
+
if (name === graph.target) classes.push("target");
|
|
130
|
+
if (ownDoubts.some((d) => d.kind === "error")) classes.push("error");
|
|
131
|
+
else if (ownDoubts.some((d) => d.kind === "sorry")) classes.push("sorry");
|
|
132
|
+
else if (ownDoubts.some((d) => d.kind === "native")) classes.push("native");
|
|
133
|
+
else if (ownDoubts.some((d) => d.kind === "axiom")) classes.push("axiom");
|
|
134
|
+
else if (belowDoubts.length > 0 && name !== graph.target) {
|
|
135
|
+
classes.push("doubtPath");
|
|
136
|
+
for (const d of belowDoubts) doubtPathKinds.add(d.kind);
|
|
137
|
+
}
|
|
138
|
+
for (const cls of classes) usedClasses.add(cls);
|
|
139
|
+
const shape =
|
|
140
|
+
name === graph.target
|
|
141
|
+
? "round"
|
|
142
|
+
: ownDoubts.length > 0 || lemma.decl.kind === "axiom"
|
|
143
|
+
? "hexagon"
|
|
144
|
+
: "box";
|
|
145
|
+
nodes.push({
|
|
146
|
+
id,
|
|
147
|
+
lines,
|
|
148
|
+
shape,
|
|
149
|
+
classes,
|
|
150
|
+
});
|
|
151
|
+
for (const edge of lemma.to) {
|
|
152
|
+
if (!kept.has(edge.name)) continue;
|
|
153
|
+
const toId = ids.get(edge.name);
|
|
154
|
+
const thick = doubtEdges.has(
|
|
155
|
+
edgeKey({
|
|
156
|
+
from: name,
|
|
157
|
+
to: edge.name,
|
|
158
|
+
}),
|
|
159
|
+
);
|
|
160
|
+
const dotted = edge.through === "definition";
|
|
161
|
+
edges.push({
|
|
162
|
+
from: id,
|
|
163
|
+
to: toId,
|
|
164
|
+
label: dotted ? "经过定义" : undefined,
|
|
165
|
+
dotted,
|
|
166
|
+
thick,
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
const cutCount = hidden.get(name) ?? 0;
|
|
170
|
+
if (cutCount > 0) {
|
|
171
|
+
const stubId = `n${nextId++}`;
|
|
172
|
+
usedClasses.add("stub");
|
|
173
|
+
nodes.push({
|
|
174
|
+
id: stubId,
|
|
175
|
+
lines: [`另有 ${cutCount} 个引理`],
|
|
176
|
+
shape: "stub",
|
|
177
|
+
classes: ["stub"],
|
|
178
|
+
});
|
|
179
|
+
edges.push({
|
|
180
|
+
from: id,
|
|
181
|
+
to: stubId,
|
|
182
|
+
label: undefined,
|
|
183
|
+
dotted: true,
|
|
184
|
+
thick: false,
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
const groups = [];
|
|
189
|
+
const assignedToGroup = new Set();
|
|
190
|
+
const hasCustomGroups = viewGroups !== undefined && viewGroups.size > 0;
|
|
191
|
+
if (hasCustomGroups) {
|
|
192
|
+
const byCustom = new Map();
|
|
193
|
+
for (const name of ordered) {
|
|
194
|
+
const custom = viewGroups.get(name);
|
|
195
|
+
if (custom === undefined) continue;
|
|
196
|
+
assignedToGroup.add(name);
|
|
197
|
+
if (custom === null) continue;
|
|
198
|
+
const list = byCustom.get(custom);
|
|
199
|
+
if (list) list.push(ids.get(name));
|
|
200
|
+
else byCustom.set(custom, [ids.get(name)]);
|
|
201
|
+
}
|
|
202
|
+
for (const [title, members] of byCustom) {
|
|
203
|
+
if (members.length > 0)
|
|
204
|
+
groups.push({
|
|
205
|
+
title,
|
|
206
|
+
nodes: members,
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
const mutualSeen = new Set();
|
|
211
|
+
for (const name of ordered) {
|
|
212
|
+
if (assignedToGroup.has(name)) continue;
|
|
213
|
+
const lemma = graph.lemmas.get(name);
|
|
214
|
+
if (!lemma || lemma.decl.group.length <= 1) continue;
|
|
215
|
+
const key = [...lemma.decl.group].sort(byText).join("\0");
|
|
216
|
+
if (mutualSeen.has(key)) continue;
|
|
217
|
+
mutualSeen.add(key);
|
|
218
|
+
const members = lemma.decl.group
|
|
219
|
+
.filter((m) => kept.has(m) && !assignedToGroup.has(m))
|
|
220
|
+
.map((m) => ids.get(m));
|
|
221
|
+
if (members.length > 1) {
|
|
222
|
+
for (const m of lemma.decl.group) if (kept.has(m)) assignedToGroup.add(m);
|
|
223
|
+
groups.push({
|
|
224
|
+
title: "相互递归的定义",
|
|
225
|
+
nodes: members,
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
if (!hasCustomGroups) {
|
|
230
|
+
const byModule = new Map();
|
|
231
|
+
for (const name of ordered) {
|
|
232
|
+
if (assignedToGroup.has(name)) continue;
|
|
233
|
+
const lemma = graph.lemmas.get(name);
|
|
234
|
+
if (!lemma) continue;
|
|
235
|
+
const list = byModule.get(lemma.decl.module);
|
|
236
|
+
if (list) list.push(ids.get(name));
|
|
237
|
+
else byModule.set(lemma.decl.module, [ids.get(name)]);
|
|
238
|
+
}
|
|
239
|
+
if (byModule.size > 1) {
|
|
240
|
+
for (const mod of [...byModule.keys()].sort(byText)) {
|
|
241
|
+
const members = byModule.get(mod);
|
|
242
|
+
if (members.length > 0)
|
|
243
|
+
groups.push({
|
|
244
|
+
title: mod,
|
|
245
|
+
nodes: members,
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
const legendSpecs = [
|
|
251
|
+
["定理", "target"],
|
|
252
|
+
["未证缺口(sorry)", "sorry"],
|
|
253
|
+
["失败步骤", "error"],
|
|
254
|
+
["未经内核核验的原生计算", "native"],
|
|
255
|
+
["自定义公理", "axiom"],
|
|
256
|
+
[doubtPathLegendLabel(doubtPathKinds), "doubtPath"],
|
|
257
|
+
["已折叠的细节", "stub"],
|
|
258
|
+
];
|
|
259
|
+
const legend = legendSpecs
|
|
260
|
+
.filter(([, cls]) => usedClasses.has(cls))
|
|
261
|
+
.map(([text, cls]) => ({
|
|
262
|
+
text,
|
|
263
|
+
cls,
|
|
264
|
+
}));
|
|
265
|
+
if (edges.length > 0) {
|
|
266
|
+
legend.push({
|
|
267
|
+
text: "箭头指向所用的引理",
|
|
268
|
+
cls: "note",
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
if (hiddenByView > 0) {
|
|
272
|
+
legend.push({
|
|
273
|
+
text: `视图隐藏 ${hiddenByView} 个辅助引理`,
|
|
274
|
+
cls: "note",
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
const defaultTitle = `${shortName(facts.target)} · 引理依赖图`;
|
|
278
|
+
return {
|
|
279
|
+
title: view?.title?.lemmas ?? defaultTitle,
|
|
280
|
+
nodes,
|
|
281
|
+
edges,
|
|
282
|
+
groups,
|
|
283
|
+
legend,
|
|
284
|
+
};
|
|
285
|
+
}
|