deepmodebot 0.9.1 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/plugins/marketplace.json +20 -0
- package/.claude-plugin/marketplace.json +2 -2
- package/.omp-plugin/marketplace.json +2 -2
- package/README.md +38 -5
- package/bin/deepmodebot.mjs +257 -4
- package/lib/clients.mjs +50 -3
- package/lib/tree.mjs +64 -10
- package/native/dmb-gate/Cargo.toml +13 -0
- package/native/dmb-gate/src/agents.rs +110 -0
- package/native/dmb-gate/src/ci.rs +1032 -0
- package/native/dmb-gate/src/cleanup.rs +198 -0
- package/native/dmb-gate/src/gap.rs +1376 -0
- package/native/dmb-gate/src/guard.rs +135 -0
- package/native/dmb-gate/src/main.rs +535 -0
- package/native/dmb-gate/src/map.rs +173 -0
- package/native/dmb-gate/src/perf.rs +347 -0
- package/native/dmb-gate/src/reward.rs +2867 -0
- package/native/dmb-gate/src/sim.rs +969 -0
- package/native/dmb-gate/src/skill_check.rs +171 -0
- package/native/dmb-gate/src/slop.rs +2004 -0
- package/native/dmb-gate/src/ui.rs +842 -0
- package/native/dmb-gate/src/util.rs +260 -0
- package/native/dmb-net/go.mod +3 -0
- package/native/dmb-net/main.go +624 -0
- package/native/dmb-net/main_test.go +122 -0
- package/package.json +12 -2
- package/plugins/deepmodebot/.antigravity-plugin/plugin.json +1 -1
- package/plugins/deepmodebot/.antigravity-plugin/skills/deep/SKILL.md +5 -5
- package/plugins/deepmodebot/.antigravity-plugin/skills/pr-thread/SKILL.md +1 -1
- package/plugins/deepmodebot/.antigravity-plugin/skills/review-pr/SKILL.md +2 -2
- package/plugins/deepmodebot/.antigravity-plugin/skills/suggest/SKILL.md +13 -0
- package/plugins/deepmodebot/.antigravity-plugin/skills/tournament/SKILL.md +2 -2
- package/plugins/deepmodebot/.claude-plugin/plugin.json +1 -1
- package/plugins/deepmodebot/.codex-plugin/plugin.json +46 -0
- package/plugins/deepmodebot/agents/comment-sicko.md +29 -0
- package/plugins/deepmodebot/agents/researcher.md +29 -0
- package/plugins/deepmodebot/agents/reviewer.md +29 -0
- package/plugins/deepmodebot/agents/scout.md +28 -0
- package/plugins/deepmodebot/agents/security-reviewer.md +27 -0
- package/plugins/deepmodebot/commands/deep.md +7 -6
- package/plugins/deepmodebot/commands/research.md +8 -0
- package/plugins/deepmodebot/commands/suggest.md +10 -0
- package/plugins/deepmodebot/commands/tournament.md +2 -2
- package/plugins/deepmodebot/hooks/hooks.json +12 -2
- package/plugins/deepmodebot/hooks.json +1 -1
- package/plugins/deepmodebot/scripts/antigravity-guard.mjs +862 -26
- package/plugins/deepmodebot/scripts/omp-mcp-server.mjs +179 -47
- package/plugins/deepmodebot/skills/agent-harnesses/SKILL.md +4 -6
- package/plugins/deepmodebot/skills/agent-harnesses/assets/sdks/check_antigravity.py +3 -0
- package/plugins/deepmodebot/skills/agent-harnesses/references/ai-native-tooling.md +4 -0
- package/plugins/deepmodebot/skills/agent-harnesses/references/ai-sdk-selection.md +3 -1
- package/plugins/deepmodebot/skills/agent-harnesses/references/antigravity.md +3 -3
- package/plugins/deepmodebot/skills/agent-harnesses/references/delegation-efficiency.md +12 -2
- package/plugins/deepmodebot/skills/agent-harnesses/references/protocols.md +11 -3
- package/plugins/deepmodebot/skills/app-automation-relay/SKILL.md +17 -0
- package/plugins/deepmodebot/skills/app-automation-relay/assets/relay_server.ts +364 -0
- package/plugins/deepmodebot/skills/app-automation-relay/references/adapter-cookbook.md +15 -0
- package/plugins/deepmodebot/skills/app-automation-relay/references/wire-protocol.md +23 -0
- package/plugins/deepmodebot/skills/cloud-devsecops/SKILL.md +4 -3
- package/plugins/deepmodebot/skills/cloud-devsecops/references/cloudflare-edge.md +43 -0
- package/plugins/deepmodebot/skills/cloud-devsecops/references/local-emulators.md +15 -2
- package/plugins/deepmodebot/skills/contribute/SKILL.md +3 -35
- package/plugins/deepmodebot/skills/create-formal-verification-skill/LICENSE +21 -0
- package/plugins/deepmodebot/skills/create-formal-verification-skill/NOTICE.md +16 -0
- package/plugins/deepmodebot/skills/create-formal-verification-skill/SKILL.md +71 -0
- package/plugins/deepmodebot/skills/create-verification-skill/SKILL.md +2 -2
- package/plugins/deepmodebot/skills/deep-learning/LICENSE +21 -0
- package/plugins/deepmodebot/skills/deep-learning/SKILL.md +33 -0
- package/plugins/deepmodebot/skills/deep-learning/references/neural-architectures.md +43 -0
- package/plugins/deepmodebot/skills/deep-learning/references/papers-and-repos.md +128 -0
- package/plugins/deepmodebot/skills/deep-learning/references/reinforcement-learning.md +57 -0
- package/plugins/deepmodebot/skills/deep-learning/references/training-optimization.md +40 -0
- package/plugins/deepmodebot/skills/deep-learning/references/weight-space-programming.md +76 -0
- package/plugins/deepmodebot/skills/deep-learning/scripts/hf_passes.py +166 -0
- package/plugins/deepmodebot/skills/deep-learning/scripts/wsp.py +493 -0
- package/plugins/deepmodebot/skills/deep-stack/SKILL.md +1 -1
- package/plugins/deepmodebot/skills/deep-stack/references/design-workflow.md +46 -92
- package/plugins/deepmodebot/skills/deep-stack/references/isolate.md +1 -0
- package/plugins/deepmodebot/skills/deep-stack/references/prove.md +6 -0
- package/plugins/deepmodebot/skills/deep-stack/references/stack.md +11 -1
- package/plugins/deepmodebot/skills/deepmodebot/SKILL.md +83 -146
- package/plugins/deepmodebot/skills/deepmodebot/assets/agents-md/agents_md.py +67 -24
- package/plugins/deepmodebot/skills/deepmodebot/assets/autoroute/autoroute.py +1026 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/cleanup/self_cleanup.py +305 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/contain/claude-guard.sh +4 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/contain/claude_guard.py +736 -6
- package/plugins/deepmodebot/skills/deepmodebot/assets/contain/holdout_guard_cases.json +272 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/contain/omp-contain.ts +861 -9
- package/plugins/deepmodebot/skills/deepmodebot/assets/e2e/design.py +3 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/e2e/record.py +2 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/e2e/rehearsal_gate.py +536 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/e2e/review.py +2 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/f2p-gate/f2p_gate.py +547 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/formal-verification/verify_proof.py +638 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/gap-audit/gap_audit.py +1047 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/gen-ui/gen_ui.py +1782 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/git-guardrails/git-guard-patterns.txt +7 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/git-guardrails/git-guard.sh +55 -7
- package/plugins/deepmodebot/skills/deepmodebot/assets/git-guardrails/git-guard.ts +55 -5
- package/plugins/deepmodebot/skills/deepmodebot/assets/github-app/ghapp.py +2 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/github-app/install.py +2 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/local-ci/local_ci.py +796 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/local-ci/slop_gate.py +1049 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/loop/loop.py +748 -46
- package/plugins/deepmodebot/skills/deepmodebot/assets/loop/plan.py +2 -1
- package/plugins/deepmodebot/skills/deepmodebot/assets/loop/windows_job.py +2 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/memory/project_memory.py +928 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/mutation/mutation_gate.py +798 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/perf-audit/bench_harness.py +48 -21
- package/plugins/deepmodebot/skills/deepmodebot/assets/perf-audit/perf_audit.py +339 -5
- package/plugins/deepmodebot/skills/deepmodebot/assets/pr-agent/diff_coverage.py +96 -6
- package/plugins/deepmodebot/skills/deepmodebot/assets/pr-agent/pr_agent_local.py +2 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/pr-conversation/arena.py +2 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/pr-conversation/show_thread.py +2 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/prompt-tools/prompt_tools.py +1239 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/quota-guard/quota_guard.py +424 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/repo-references.json +477 -1
- package/plugins/deepmodebot/skills/deepmodebot/assets/reward-guard/reward_guard.py +3447 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/rules/rule-paths.json +100 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/rules/rule_ledger.py +1671 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/rules/rules_watch.py +436 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/scrape/yt_enrich.py +2 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/scrape/yt_meta.py +2 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/scrape/yt_transcript_relay.js +13 -10
- package/plugins/deepmodebot/skills/deepmodebot/assets/security-audit/static_sec_audit.py +275 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/self-grill/self_grill.py +2049 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/setup/model_setup.py +329 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/setup/project_setup.py +348 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/sim/sim.py +856 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/tournament/tournament.py +304 -18
- package/plugins/deepmodebot/skills/deepmodebot/assets/worker-gate/worker_gate.py +237 -0
- package/plugins/deepmodebot/skills/deepmodebot/assets/workspace-map/workspace_map.py +121 -78
- package/plugins/deepmodebot/skills/deepmodebot/references/README.md +14 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/catalog.md +17 -11
- package/plugins/deepmodebot/skills/deepmodebot/references/contain.md +2 -1
- package/plugins/deepmodebot/skills/deepmodebot/references/delegation.md +18 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/flows.md +2 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/full-scope.md +9 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/authoring-a-skill.md +1 -1
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/babysit.md +2 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/end-to-end.md +12 -9
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/feature.md +7 -3
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/hillclimb.md +3 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/investigation.md +4 -4
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/opening-a-pr.md +1 -1
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/perf-issue.md +13 -10
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/refactoring.md +6 -6
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/reference-rebuild.md +1 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/run-a-goal.md +3 -1
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/self-authoring.md +1 -1
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/setup.md +1 -2
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/visual-parity.md +1 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/playbooks/work-a-queue.md +4 -2
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/hardcore-mode.md +7 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/no-reward-hacking.md +8 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/test-behavior-not-implementation.md +2 -1
- package/plugins/deepmodebot/skills/deepmodebot/references/principles/type-system-discipline.md +2 -2
- package/plugins/deepmodebot/skills/deepmodebot/references/rule-approval.md +71 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/architect.md +10 -24
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/architecture-review.md +5 -4
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/arena.md +3 -3
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/autoroute.md +50 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/blast-radius.md +1 -1
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/catchup-video.md +13 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/correct.md +9 -7
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/course.md +2 -1
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/devex-review.md +13 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/expand-contract.md +13 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/formal-verification.md +33 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/gen-ui.md +60 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/grill.md +2 -1
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/how.md +7 -18
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/inner-loop.md +12 -8
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/model-setup.md +14 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/modernize-pr.md +15 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/mutation-testing.md +35 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/no-comments.md +5 -5
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/panel.md +9 -5
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/pr-conversation.md +1 -1
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/pr-review.md +8 -5
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/pre-commit.md +1 -2
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/prior-art.md +33 -38
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/product-lens.md +12 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/prompt-upgrade.md +30 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/recall.md +1 -1
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/reframe.md +18 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/release-and-canary.md +10 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/research.md +62 -89
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/security-audit.md +5 -1
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/self-grill.md +54 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/sharpen.md +3 -3
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/show-me-your-work.md +7 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/sim.md +41 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/sme-review.md +3 -2
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/suggest.md +24 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/swarm.md +7 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/tdd.md +12 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/teach.md +2 -2
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/tournament.md +30 -18
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/variant-analysis.md +11 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/video-forensics.md +46 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/visual-e2e.md +10 -1
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/webhook-ui.md +11 -0
- package/plugins/deepmodebot/skills/deepmodebot/references/techniques/writing-for-agents.md +6 -0
- package/plugins/deepmodebot/skills/deepmodebot/scripts/check_skill.py +7 -0
- package/plugins/deepmodebot/skills/deepmodebot/scripts/trending.py +141 -18
- package/plugins/deepmodebot/skills/deepmodebot/worker.md +28 -0
- package/plugins/deepmodebot/skills/domain-rules/SKILL.md +13 -119
- package/plugins/deepmodebot/skills/domain-rules/references/backend-system-design.md +19 -1
- package/plugins/deepmodebot/skills/domain-rules/references/engineering-practice.md +7 -0
- package/plugins/deepmodebot/skills/domain-rules/references/language-ecosystems.md +11 -0
- package/plugins/deepmodebot/skills/domain-rules/references/sources.md +108 -0
- package/plugins/deepmodebot/skills/frontend-ui/SKILL.md +30 -131
- package/plugins/deepmodebot/skills/frontend-ui/assets/themes/canvas.css +42 -0
- package/plugins/deepmodebot/skills/frontend-ui/assets/themes/editorial.css +39 -0
- package/plugins/deepmodebot/skills/frontend-ui/assets/themes/layouts.css +95 -0
- package/plugins/deepmodebot/skills/frontend-ui/assets/themes/swiss.css +40 -0
- package/plugins/deepmodebot/skills/frontend-ui/assets/themes/tactile.css +41 -0
- package/plugins/deepmodebot/skills/frontend-ui/assets/themes/workbench.css +50 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/patterns/mobbin-animations.md +49 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/patterns/mobbin-shipped-apps.md +46 -24
- package/plugins/deepmodebot/skills/frontend-ui/references/patterns/motion-clips.md +27 -258
- package/plugins/deepmodebot/skills/frontend-ui/references/patterns/motion-graphics.md +26 -51
- package/plugins/deepmodebot/skills/frontend-ui/references/patterns/pinterest-animations.md +22 -195
- package/plugins/deepmodebot/skills/frontend-ui/references/playbook/00-art-direction.md +39 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/playbook/01-workflow.md +27 -24
- package/plugins/deepmodebot/skills/frontend-ui/references/playbook/02-review-rubric.md +23 -17
- package/plugins/deepmodebot/skills/frontend-ui/references/playbook/03-ai-tells.md +22 -45
- package/plugins/deepmodebot/skills/frontend-ui/references/playbook/04-components.md +11 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/playbook/04a-agent-ui.md +32 -152
- package/plugins/deepmodebot/skills/frontend-ui/references/playbook/05-motion.md +36 -91
- package/plugins/deepmodebot/skills/frontend-ui/references/playbook/05a-motion-graphics.md +14 -120
- package/plugins/deepmodebot/skills/frontend-ui/references/playbook/06-typography-layout.md +11 -10
- package/plugins/deepmodebot/skills/frontend-ui/references/playbook/06a-color.md +9 -9
- package/plugins/deepmodebot/skills/frontend-ui/references/playbook/06b-media-icons-charts.md +19 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/playbook/06c-product-shots-craft.md +42 -0
- package/plugins/deepmodebot/skills/frontend-ui/references/playbook/07-copy.md +5 -6
- package/plugins/deepmodebot/skills/frontend-ui/references/playbook/08-quality-floor.md +28 -56
- package/plugins/deepmodebot/skills/frontend-ui/references/playbook/09-steering-agents.md +9 -7
- package/plugins/deepmodebot/skills/frontend-ui/scripts/motion_diff.py +259 -0
- package/plugins/deepmodebot/skills/frontend-ui/scripts/ui_audit.py +496 -0
- package/plugins/deepmodebot/skills/maintain-formal-verification-skill/LICENSE +21 -0
- package/plugins/deepmodebot/skills/maintain-formal-verification-skill/NOTICE.md +16 -0
- package/plugins/deepmodebot/skills/maintain-formal-verification-skill/SKILL.md +68 -0
- package/plugins/deepmodebot/skills/maintain-verification-skill/SKILL.md +1 -1
- package/plugins/deepmodebot/skills/office-documents/SKILL.md +24 -0
- package/plugins/deepmodebot/skills/office-documents/references/documents-docx-pdf.md +15 -0
- package/plugins/deepmodebot/skills/office-documents/references/presentations-pptx.md +15 -0
- package/plugins/deepmodebot/skills/office-documents/references/spreadsheets-xlsx.md +15 -0
- package/plugins/deepmodebot/skills/office-documents/scripts/doc_audit.py +230 -0
- package/plugins/deepmodebot/skills/project-brief/SKILL.md +2 -19
- package/plugins/deepmodebot/skills/project-brief/assets/pr-overlap.py +4 -0
- package/plugins/deepmodebot/skills/project-brief/assets/sync-roadmap.py +4 -0
- package/plugins/deepmodebot/skills/project-brief/references/claim-contract.md +55 -0
- package/plugins/deepmodebot/skills/research/SKILL.md +18 -0
- package/plugins/deepmodebot/skills/secrets-and-auth/SKILL.md +1 -1
- package/plugins/deepmodebot/skills/seo-and-geo/SKILL.md +29 -0
- package/plugins/deepmodebot/skills/seo-and-geo/references/geo-and-agentic-web.md +30 -0
- package/plugins/deepmodebot/skills/seo-and-geo/references/technical-and-schema.md +25 -0
- package/plugins/deepmodebot/skills/seo-and-geo/scripts/seo_audit.py +282 -0
- package/plugins/deepmodebot/skills/software-architecture/SKILL.md +2 -2
- package/plugins/deepmodebot/skills/software-architecture/references/backend-infrastructure.md +5 -0
- package/plugins/deepmodebot/skills/software-architecture/references/monorepos.md +1 -0
- package/plugins/deepmodebot/skills/statechart/LICENSE +21 -0
- package/plugins/deepmodebot/skills/statechart/NOTICE.md +21 -0
- package/plugins/deepmodebot/skills/statechart/SKILL.md +106 -0
- package/plugins/deepmodebot/skills/statechart/references/render.md +93 -0
- package/plugins/deepmodebot/skills/statechart/references/tooling.md +78 -0
- package/plugins/deepmodebot/skills/statechart/scripts/backends/cfg.ts +33 -0
- package/plugins/deepmodebot/skills/statechart/scripts/backends/mermaid.ts +249 -0
- package/plugins/deepmodebot/skills/statechart/scripts/backends/plain-text.ts +72 -0
- package/plugins/deepmodebot/skills/statechart/scripts/backends/report.ts +177 -0
- package/plugins/deepmodebot/skills/statechart/scripts/frontends/config.ts +276 -0
- package/plugins/deepmodebot/skills/statechart/scripts/frontends/dot.ts +77 -0
- package/plugins/deepmodebot/skills/statechart/scripts/frontends/marks.ts +93 -0
- package/plugins/deepmodebot/skills/statechart/scripts/frontends/messages.ts +52 -0
- package/plugins/deepmodebot/skills/statechart/scripts/frontends/spec.ts +114 -0
- package/plugins/deepmodebot/skills/statechart/scripts/frontends/trace.ts +24 -0
- package/plugins/deepmodebot/skills/statechart/scripts/frontends/value.ts +166 -0
- package/plugins/deepmodebot/skills/statechart/scripts/frontends/verdict.ts +40 -0
- package/plugins/deepmodebot/skills/statechart/scripts/frontends/view.ts +119 -0
- package/plugins/deepmodebot/skills/statechart/scripts/ir.ts +547 -0
- package/plugins/deepmodebot/skills/statechart/scripts/janitor.ts +13 -0
- package/plugins/deepmodebot/skills/statechart/scripts/kill.ts +15 -0
- package/plugins/deepmodebot/skills/statechart/scripts/package.json +11 -0
- package/plugins/deepmodebot/skills/statechart/scripts/passes/annotate.ts +128 -0
- package/plugins/deepmodebot/skills/statechart/scripts/passes/label.ts +269 -0
- package/plugins/deepmodebot/skills/statechart/scripts/passes/lift.ts +85 -0
- package/plugins/deepmodebot/skills/statechart/scripts/passes/loop-check.ts +68 -0
- package/plugins/deepmodebot/skills/statechart/scripts/passes/paths.ts +60 -0
- package/plugins/deepmodebot/skills/statechart/scripts/passes/reach.ts +135 -0
- package/plugins/deepmodebot/skills/statechart/scripts/passes/region-check.ts +97 -0
- package/plugins/deepmodebot/skills/statechart/scripts/passes/regions.ts +295 -0
- package/plugins/deepmodebot/skills/statechart/scripts/pipeline.ts +76 -0
- package/plugins/deepmodebot/skills/statechart/scripts/run.ts +500 -0
- package/plugins/deepmodebot/skills/statechart/scripts/statechart +29 -0
- package/plugins/deepmodebot/skills/statechart/scripts/statechart.ts +165 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/ConfigOracle.java +63 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/chart.test.ts +1253 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/charts/Braces.mmd +7 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/charts/Escapes.mmd +11 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/charts/Phases.mmd +29 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/cli.test.ts +1344 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/config-fuzz.test.ts +263 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/Counter/ChartRun.out +57 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/Counter/Counter.cfg +3 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/Counter/Counter.tla +10 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/Counter/chart.mmd +9 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/Counter/graph.dot +16 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/Counter/report.md +7 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/Counter/sany.out +2 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/Counter/verdict-1.out +49 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterAction/ChartRun.out +60 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterAction/CounterAction.cfg +4 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterAction/CounterAction.tla +22 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterAction/chart.mmd +26 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterAction/graph.dot +19 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterAction/report.md +20 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterAction/sany.out +2 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterAction/verdict-1.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterAction/verdict-1.out +56 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterAction/verdict-2.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterAction/verdict-2.out +82 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterAction/verdict-3.out +57 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterDeadlock/ChartRun.out +59 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterDeadlock/CounterDeadlock.cfg +3 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterDeadlock/CounterDeadlock.tla +11 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterDeadlock/chart.mmd +22 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterDeadlock/graph.dot +16 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterDeadlock/report.md +17 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterDeadlock/sany.out +2 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterDeadlock/verdict-1.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterDeadlock/verdict-1.out +56 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterDeadlock/verdict-2.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterDeadlock/verdict-2.out +77 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterFan/ChartRun.out +69 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterFan/CounterFan.cfg +2 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterFan/CounterFan.tla +11 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterFan/chart.mmd +85 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterFan/graph.dot +70 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterFan/report.md +12 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterFan/sany.out +2 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterFan/verdict-1.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterFan/verdict-1.out +67 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterFan/verdict-2.out +57 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterGuard/ChartRun.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterGuard/ChartRun.out +85 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterGuard/CounterGuard.cfg +6 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterGuard/CounterGuard.tla +13 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterGuard/chart.mmd +5 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterGuard/graph.dot +10 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterGuard/report.md +31 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterGuard/sany.out +2 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterGuard/verdict-1.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterGuard/verdict-1.out +64 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterGuard/verdict-2.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterGuard/verdict-2.out +77 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterInitPast/ChartRun.out +55 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterInitPast/CounterInitPast.cfg +3 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterInitPast/CounterInitPast.tla +10 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterInitPast/chart.mmd +12 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterInitPast/graph.dot +6 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterInitPast/report.md +12 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterInitPast/sany.out +2 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterInitPast/verdict-1.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterInitPast/verdict-1.out +33 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterInitPast/verdict-2.out +54 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterInitPastHolds/ChartRun.out +54 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterInitPastHolds/CounterInitPastHolds.cfg +3 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterInitPastHolds/CounterInitPastHolds.tla +10 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterInitPastHolds/chart.mmd +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterInitPastHolds/graph.dot +6 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterInitPastHolds/report.md +7 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterInitPastHolds/sany.out +2 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterInitPastHolds/verdict-1.out +46 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterInstance/ChartRun.out +59 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterInstance/CounterInstance.cfg +2 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterInstance/CounterInstance.tla +10 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterInstance/CounterSteps.tla +6 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterInstance/chart.mmd +17 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterInstance/graph.dot +15 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterInstance/report.md +14 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterInstance/sany.out +3 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterInstance/verdict-1.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterInstance/verdict-1.out +78 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterJump/ChartRun.out +59 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterJump/CounterJump.cfg +3 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterJump/CounterJump.tla +19 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterJump/chart.mmd +26 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterJump/graph.dot +22 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterJump/report.md +12 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterJump/sany.out +2 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterJump/verdict-1.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterJump/verdict-1.out +58 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterJump/verdict-2.out +57 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterLoop/ChartRun.out +57 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterLoop/CounterLoop.cfg +2 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterLoop/CounterLoop.tla +11 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterLoop/chart.mmd +17 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterLoop/graph.dot +15 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterLoop/report.md +14 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterLoop/sany.out +2 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterLoop/verdict-1.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterLoop/verdict-1.out +76 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterOrder/ChartRun.out +59 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterOrder/CounterOrder.cfg +3 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterOrder/CounterOrder.tla +11 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterOrder/chart.mmd +19 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterOrder/graph.dot +10 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterOrder/report.md +15 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterOrder/sany.out +2 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterOrder/verdict-1.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterOrder/verdict-1.out +56 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterOrder/verdict-2.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterOrder/verdict-2.out +67 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterRules/ChartRun.out +62 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterRules/CounterRules.cfg +6 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterRules/CounterRules.tla +24 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterRules/Moves.tla +5 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterRules/chart.mmd +22 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterRules/graph.dot +10 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterRules/report.md +23 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterRules/sany.out +3 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterRules/verdict-1.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterRules/verdict-1.out +58 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterRules/verdict-2.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterRules/verdict-2.out +66 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterRules/verdict-3.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterRules/verdict-3.out +74 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterRules/verdict-4.out +59 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterStart/ChartRun.out +58 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterStart/CounterStart.cfg +3 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterStart/CounterStart.tla +15 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterStart/chart.mmd +18 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterStart/graph.dot +13 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterStart/report.md +11 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterStart/sany.out +2 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterStart/verdict-1.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterStart/verdict-1.out +33 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterStart/verdict-2.out +57 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterStop/ChartRun.out +57 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterStop/CounterStop.cfg +3 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterStop/CounterStop.tla +15 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterStop/chart.mmd +7 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterStop/graph.dot +13 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterStop/report.md +6 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterStop/sany.out +2 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterStop/verdict-1.out +49 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterTie/ChartRun.out +61 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterTie/CounterTie.cfg +4 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterTie/CounterTie.tla +14 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterTie/chart.mmd +30 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterTie/graph.dot +19 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterTie/report.md +27 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterTie/sany.out +2 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterTie/verdict-1.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterTie/verdict-1.out +56 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterTie/verdict-2.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterTie/verdict-2.out +64 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterTie/verdict-3.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterTie/verdict-3.out +87 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterTie/verdict-4.out +57 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterTieInGraph/ChartRun.out +60 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterTieInGraph/CounterTieInGraph.cfg +3 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterTieInGraph/CounterTieInGraph.tla +12 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterTieInGraph/chart.mmd +23 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterTieInGraph/graph.dot +19 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterTieInGraph/report.md +11 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterTieInGraph/sany.out +2 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterTieInGraph/verdict-1.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterTieInGraph/verdict-1.out +56 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterTieInGraph/verdict-2.out +57 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterView/ChartRun.out +61 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterView/CounterView.cfg +4 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterView/CounterView.tla +14 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterView/chart.mmd +23 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterView/graph.dot +19 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterView/report.md +27 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterView/sany.out +2 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterView/verdict-1.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterView/verdict-1.out +56 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterView/verdict-2.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterView/verdict-2.out +64 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterView/verdict-3.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterView/verdict-3.out +87 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterView/verdict-4.out +57 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/CounterView/view.mjs +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/DieHard/ChartRun.out +59 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/DieHard/DieHard.cfg +4 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/DieHard/DieHard.tla +38 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/DieHard/chart.mmd +92 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/DieHard/graph.dot +126 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/DieHard/report.md +17 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/DieHard/sany.out +2 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/DieHard/verdict-1.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/DieHard/verdict-1.out +91 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/DieHard/verdict-2.out +57 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/FirstRule/ChartRun.out +61 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/FirstRule/FirstRule.cfg +6 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/FirstRule/FirstRule.tla +11 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/FirstRule/chart.mmd +22 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/FirstRule/graph.dot +16 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/FirstRule/report.md +25 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/FirstRule/sany.out +2 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/FirstRule/verdict-1.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/FirstRule/verdict-1.out +56 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/FirstRule/verdict-2.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/FirstRule/verdict-2.out +64 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/FirstRule/verdict-3.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/FirstRule/verdict-3.out +64 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/FirstRule/verdict-4.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/FirstRule/verdict-4.out +77 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/HiddenClock/ChartRun.out +57 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/HiddenClock/HiddenClock.cfg +4 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/HiddenClock/HiddenClock.tla +11 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/HiddenClock/chart.mmd +13 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/HiddenClock/graph.dot +12 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/HiddenClock/report.md +11 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/HiddenClock/sany.out +2 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/HiddenClock/verdict-1.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/HiddenClock/verdict-1.out +72 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/Login/ChartRun.out +57 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/Login/Login.cfg +3 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/Login/Login.tla +62 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/Login/chart.mmd +28 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/Login/graph.dot +40 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/Login/report.md +7 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/Login/sany.out +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/Login/verdict-1.out +47 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/Login/view.mjs +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/LoginGuarded/ChartRun.out +57 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/LoginGuarded/LoginGuarded.cfg +2 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/LoginGuarded/LoginGuarded.tla +64 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/LoginGuarded/chart.mmd +28 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/LoginGuarded/graph.dot +37 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/LoginGuarded/report.md +8 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/LoginGuarded/sany.out +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/LoginGuarded/verdict-1.out +47 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/LoginGuarded/view.mjs +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/LoginParallel/ChartRun.out +60 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/LoginParallel/LoginParallel.cfg +3 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/LoginParallel/LoginParallel.tla +64 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/LoginParallel/chart.mmd +44 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/LoginParallel/graph.dot +58 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/LoginParallel/report.md +17 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/LoginParallel/sany.out +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/LoginParallel/verdict-1.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/LoginParallel/verdict-1.out +83 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/LoginParallel/verdict-2.out +57 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/LoginParallel/view.mjs +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/MediaPlayer/ChartRun.out +60 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/MediaPlayer/MediaPlayer.cfg +3 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/MediaPlayer/MediaPlayer.tla +103 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/MediaPlayer/chart.mmd +43 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/MediaPlayer/graph.dot +93 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/MediaPlayer/report.md +14 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/MediaPlayer/sany.out +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/MediaPlayer/verdict-1.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/MediaPlayer/verdict-1.out +59 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/MediaPlayer/verdict-2.out +72 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/MediaPlayer/view.mjs +3 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/MediaPlayerFixed/ChartRun.out +57 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/MediaPlayerFixed/MediaPlayerFixed.cfg +2 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/MediaPlayerFixed/MediaPlayerFixed.tla +100 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/MediaPlayerFixed/chart.mmd +31 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/MediaPlayerFixed/graph.dot +85 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/MediaPlayerFixed/report.md +9 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/MediaPlayerFixed/sany.out +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/MediaPlayerFixed/verdict-1.out +47 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/MediaPlayerFixed/view.mjs +3 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/MediaPlayerProps/ChartRun.out +59 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/MediaPlayerProps/MediaPlayer.tla +103 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/MediaPlayerProps/MediaPlayerProps.cfg +3 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/MediaPlayerProps/MediaPlayerProps.tla +6 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/MediaPlayerProps/chart.mmd +42 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/MediaPlayerProps/graph.dot +93 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/MediaPlayerProps/report.md +19 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/MediaPlayerProps/sany.out +2 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-1.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-1.out +61 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-2.out +59 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-3.out +61 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-4.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-4.out +66 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-5.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-5.out +58 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/MediaPlayerProps/verdict-6.out +49 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/MediaPlayerProps/view.mjs +3 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/PickWorker/ChartRun.out +57 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/PickWorker/PickWorker.cfg +6 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/PickWorker/PickWorker.tla +11 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/PickWorker/chart.mmd +5 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/PickWorker/graph.dot +11 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/PickWorker/report.md +7 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/PickWorker/sany.out +5 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/PickWorker/verdict-1.out +70 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/Shadow/ChartRun.out +61 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/Shadow/Shadow.cfg +4 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/Shadow/Shadow.tla +11 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/Shadow/ShadowLib.tla +6 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/Shadow/ShadowSub.tla +3 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/Shadow/chart.mmd +9 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/Shadow/graph.dot +16 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/Shadow/report.md +8 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/Shadow/sany.out +4 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/Shadow/verdict-1.out +65 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/SpacedNames/ChartRun.out +59 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/SpacedNames/SpacedNames.cfg +2 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/SpacedNames/SpacedNames.tla +9 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/SpacedNames/chart.mmd +23 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/SpacedNames/graph.dot +17 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/SpacedNames/report.md +15 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/SpacedNames/sany.out +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/SpacedNames/verdict-1.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/SpacedNames/verdict-1.out +65 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/SpacedNames/verdict-2.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/SpacedNames/verdict-2.out +75 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/TwoPhase/ChartRun.out +69 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/TwoPhase/TwoPhase.cfg +3 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/TwoPhase/TwoPhase.tla +75 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/TwoPhase/chart.mmd +60 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/TwoPhase/graph.dot +297 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/TwoPhase/report.md +20 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/TwoPhase/sany.out +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/TwoPhase/verdict-1.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/TwoPhase/verdict-1.out +95 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/TwoPhase/verdict-2.out +57 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/TwoPhase/view.mjs +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/TwoPhaseFixed/ChartRun.out +57 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/TwoPhaseFixed/TwoPhaseFixed.cfg +3 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/TwoPhaseFixed/TwoPhaseFixed.tla +75 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/TwoPhaseFixed/chart.mmd +37 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/TwoPhaseFixed/graph.dot +223 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/TwoPhaseFixed/report.md +11 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/TwoPhaseFixed/sany.out +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/TwoPhaseFixed/verdict-1.out +47 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/TwoPhaseFixed/view.mjs +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/TypeGuard/ChartRun.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/TypeGuard/ChartRun.out +75 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/TypeGuard/TypeGuard.cfg +5 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/TypeGuard/TypeGuard.tla +11 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/TypeGuard/chart.mmd +18 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/TypeGuard/graph.dot +14 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/TypeGuard/report.md +29 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/TypeGuard/sany.out +2 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/TypeGuard/verdict-1.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/TypeGuard/verdict-1.out +64 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/TypeGuard/verdict-2.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/TypeGuard/verdict-2.out +75 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/UserNoDeadlock/ChartRun.out +58 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/UserNoDeadlock/UserNoDeadlock.cfg +2 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/UserNoDeadlock/UserNoDeadlock.tla +8 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/UserNoDeadlock/chart.mmd +22 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/UserNoDeadlock/graph.dot +16 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/UserNoDeadlock/report.md +15 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/UserNoDeadlock/sany.out +2 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/UserNoDeadlock/verdict-1.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/UserNoDeadlock/verdict-1.out +56 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/UserNoDeadlock/verdict-2.exit +1 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus/UserNoDeadlock/verdict-2.out +77 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/corpus.test.ts +441 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/differential.test.ts +565 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/drawn.ts +20 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/grid/Grid.cfg +2 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/grid/Grid.tla +9 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/grid/sany.out +2 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/java.ts +63 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/labels.ts +648 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/messages.test.ts +226 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/pipeline.test.ts +270 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/plain-tlc.test.ts +255 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/render.test.ts +145 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/tlc-out.test.ts +90 -0
- package/plugins/deepmodebot/skills/statechart/scripts/test/tlc.ts +158 -0
- package/plugins/deepmodebot/skills/statechart/scripts/tsconfig.json +11 -0
- package/plugins/deepmodebot/skills/statechart/scripts/worker.ts +35 -0
- package/plugins/deepmodebot/agents/reviewer/agent.md +0 -33
- package/plugins/deepmodebot/agents/scout/agent.md +0 -34
- package/plugins/deepmodebot/agents/security-reviewer/agent.md +0 -30
- package/plugins/deepmodebot/skills/agent-harnesses/assets/sdks/bun.lock +0 -391
- package/plugins/deepmodebot/skills/deepmodebot/assets/agents-md/test_agents_md.py +0 -146
- package/plugins/deepmodebot/skills/deepmodebot/assets/contain/test_antigravity_guard.py +0 -483
- package/plugins/deepmodebot/skills/deepmodebot/assets/contain/test_audit_regressions.py +0 -139
- package/plugins/deepmodebot/skills/deepmodebot/assets/contain/test_contain.py +0 -301
- package/plugins/deepmodebot/skills/deepmodebot/assets/contain/test_omp_mcp.py +0 -602
- package/plugins/deepmodebot/skills/deepmodebot/assets/e2e/test_design.py +0 -69
- package/plugins/deepmodebot/skills/deepmodebot/assets/e2e/test_evidence.py +0 -160
- package/plugins/deepmodebot/skills/deepmodebot/assets/e2e/test_record.py +0 -180
- package/plugins/deepmodebot/skills/deepmodebot/assets/e2e/test_review.py +0 -265
- package/plugins/deepmodebot/skills/deepmodebot/assets/git-guardrails/test_git_guard.py +0 -192
- package/plugins/deepmodebot/skills/deepmodebot/assets/github-app/test_bot.py +0 -2182
- package/plugins/deepmodebot/skills/deepmodebot/assets/github-app/test_brand.py +0 -19
- package/plugins/deepmodebot/skills/deepmodebot/assets/github-app/test_local_updates.py +0 -691
- package/plugins/deepmodebot/skills/deepmodebot/assets/github-app/test_review_context.py +0 -127
- package/plugins/deepmodebot/skills/deepmodebot/assets/github-app/test_workspace_cleanup.py +0 -496
- package/plugins/deepmodebot/skills/deepmodebot/assets/loop/test_loop.py +0 -1426
- package/plugins/deepmodebot/skills/deepmodebot/assets/loop/test_plan.py +0 -320
- package/plugins/deepmodebot/skills/deepmodebot/assets/loop/test_windows_job.py +0 -326
- package/plugins/deepmodebot/skills/deepmodebot/assets/perf-audit/test_bench_harness.py +0 -55
- package/plugins/deepmodebot/skills/deepmodebot/assets/perf-audit/test_perf_audit.py +0 -53
- package/plugins/deepmodebot/skills/deepmodebot/assets/pr-agent/test_diff_coverage.py +0 -94
- package/plugins/deepmodebot/skills/deepmodebot/assets/pr-conversation/test_arena.py +0 -610
- package/plugins/deepmodebot/skills/deepmodebot/assets/scrape/test_yt_enrich.py +0 -250
- package/plugins/deepmodebot/skills/deepmodebot/assets/tournament/test_tournament.py +0 -654
- package/plugins/deepmodebot/skills/deepmodebot/assets/workspace-map/test_workspace_map.py +0 -879
|
@@ -0,0 +1,2049 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Deterministic diff-aware self-grill and Adaptive Hotspot Prosecutor engine for deepmodebot.
|
|
3
|
+
|
|
4
|
+
python self_grill.py check-diff --root <repo> [--base <ref>] [--staged] [--json]
|
|
5
|
+
python self_grill.py init --root <repo> --slug <slug> [--phase plan|checks|both] [--base <ref>] [--staged] [--force] [--refresh] [--json]
|
|
6
|
+
python self_grill.py answer --dir <dir> --id <qid> --status proven|na|failed|blocked --answer <text> [--receipt <ref>] [--json]
|
|
7
|
+
python self_grill.py verdict --dir <dir> [--strict] [--allow-stale] [--json]
|
|
8
|
+
python self_grill.py bundle --root <repo> [--slug <slug>] [--role prosecutor|verifier|judge] [--mode blind|full] [--claims-stdin | --claims-file <path>] [--confession <text>] [--spec-file <path> --base <ref> [--head <ref>] [--check-cmd <cmd>]...] [--json]
|
|
9
|
+
"""
|
|
10
|
+
import argparse
|
|
11
|
+
import functools
|
|
12
|
+
import hashlib
|
|
13
|
+
import json
|
|
14
|
+
import os
|
|
15
|
+
import re
|
|
16
|
+
import subprocess
|
|
17
|
+
import sys
|
|
18
|
+
import tempfile
|
|
19
|
+
import time
|
|
20
|
+
import unicodedata
|
|
21
|
+
from pathlib import Path
|
|
22
|
+
|
|
23
|
+
sys.dont_write_bytecode = True
|
|
24
|
+
|
|
25
|
+
SLUG_RE = re.compile(r"[a-z0-9]+(?:-[a-z0-9]+)*")
|
|
26
|
+
|
|
27
|
+
SENSITIVE_PATH_RE = re.compile(
|
|
28
|
+
r"(?:^|/)(?:\.github/workflows/|hooks\.json$|mcp_config\.json$|AGENTS\.md$|CLAUDE\.md$|migrations?/|contain/)"
|
|
29
|
+
r"|(?:^|/|.)\.env(?:\.|$)"
|
|
30
|
+
r"|(?:^|[/._-])(?:auth|oauth|jwt|password|passwords|login|sso|mfa|session|token|tokens|secret|secrets"
|
|
31
|
+
r"|credential|credentials|cred|rbac|acl|permission|permissions|policy|security|guard|sanitize|sanitizer"
|
|
32
|
+
r"|crypto|signature|billing|stripe|payment|payments)(?:$|[/._-])",
|
|
33
|
+
re.I,
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
TEST_PATH_RE = re.compile(
|
|
37
|
+
r"(^|/)(?:tests?/|spec/|__tests__/|evals/)|(?:^|/)(?:test_[^/]+|[^/]+(?:_test|\.test|\.spec)\.[^/]+)$",
|
|
38
|
+
re.I,
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
CODE_EXTS = {
|
|
42
|
+
".py", ".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs",
|
|
43
|
+
".rs", ".go", ".java", ".cs", ".rb", ".php", ".c", ".cc", ".cpp", ".h", ".hpp",
|
|
44
|
+
".lua", ".luau",
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
SHELL_OR_SCRIPT_EXTS = {".sh", ".bash", ".zsh", ".ps1", ".cmd", ".bat", ".py", ".mjs", ".cjs", ".ts", ".js"}
|
|
48
|
+
|
|
49
|
+
SCHEMA_OR_CONFIG_EXTS = {".json", ".yaml", ".yml", ".toml", ".sql", ".ini", ".cfg"}
|
|
50
|
+
|
|
51
|
+
PROOF_EXTS = {".lean", ".v", ".thy", ".tla", ".smt2", ".tex"}
|
|
52
|
+
NON_GIT_SKIP_DIRS = {
|
|
53
|
+
".git", ".scratch", ".worktrees", "__pycache__", "node_modules",
|
|
54
|
+
".venv", "venv", "target", "dist", "build", ".pytest_cache", ".lake",
|
|
55
|
+
}
|
|
56
|
+
SKILL_OR_PROMPT_RE = re.compile(
|
|
57
|
+
r"(^|/)(?:SKILL\.md$|commands/|references/|agents/|prompts?/|\.claude-plugin/|\.antigravity-plugin/|\.omp-plugin/)",
|
|
58
|
+
re.I,
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
HASH_COMMENT_EXTS = {".py", ".rb", ".sh", ".bash", ".zsh", ".ps1"}
|
|
62
|
+
import ast
|
|
63
|
+
import importlib.util
|
|
64
|
+
|
|
65
|
+
NO_WINDOW = getattr(subprocess, "CREATE_NO_WINDOW", 0)
|
|
66
|
+
BACKEND_EXTS = {".py", ".go", ".rs", ".cs", ".fs", ".ts", ".js", ".mjs", ".java", ".kt", ".sql", ".c", ".cc", ".cpp"}
|
|
67
|
+
SLASH_COMMENT_EXTS = {
|
|
68
|
+
".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs",
|
|
69
|
+
".rs", ".go", ".java", ".cs", ".php", ".c", ".cc", ".cpp", ".h", ".hpp",
|
|
70
|
+
}
|
|
71
|
+
DASH_COMMENT_EXTS = {".lua", ".luau", ".sql"}
|
|
72
|
+
COMMENT_SCAN_EXTS = CODE_EXTS | HASH_COMMENT_EXTS | DASH_COMMENT_EXTS
|
|
73
|
+
|
|
74
|
+
LUAU_DIRECTIVE_RE = re.compile(r"^!(?:strict|nonstrict|nocheck|native|optimize)\b", re.I)
|
|
75
|
+
|
|
76
|
+
COMMENT_KEEP_RE = re.compile(
|
|
77
|
+
r"(?:spdx-license-identifier|copyright\b|prettier-ignore|https?://\S+)",
|
|
78
|
+
re.I,
|
|
79
|
+
)
|
|
80
|
+
COMMENT_SCENT_RE = re.compile(
|
|
81
|
+
r"(?:eslint-disable|@ts-ignore|@ts-expect-error|\bnoqa\b|type:\s*ignore|\btodo\b|\bfixme\b"
|
|
82
|
+
r"|\bimportant\b|\bdo\s+not\s+remove\b|\btoo\s+risky\b|\bfine\s+for\s+now\b|\bworkaround\b|\bhack\b)",
|
|
83
|
+
re.I,
|
|
84
|
+
)
|
|
85
|
+
WORKAROUND_SMELL_PATTERNS = (
|
|
86
|
+
("imperative-timer", re.compile(r"\b(?:setTimeout|requestAnimationFrame|requestIdleCallback)\s*\("), False),
|
|
87
|
+
("raw-use-effect", re.compile(r"\buseEffect\s*\("), False),
|
|
88
|
+
("unsafe-type-escape", re.compile(r"\bas\s+any\b|\bas\s+unknown\s+as\b"), True),
|
|
89
|
+
)
|
|
90
|
+
TOY_SHORTCUT_PATTERNS = (
|
|
91
|
+
(
|
|
92
|
+
"not-implemented-stub",
|
|
93
|
+
re.compile(r"\b(?:NotImplementedError|unimplemented!\s*\(|todo!\s*\(|throw\s+new\s+Error\s*\(\s*['\"]not\s+implemented)", re.I),
|
|
94
|
+
True,
|
|
95
|
+
),
|
|
96
|
+
(
|
|
97
|
+
"placeholder-shortcut",
|
|
98
|
+
re.compile(
|
|
99
|
+
r"\b(?:placeholder\s+(?:impl|implementation|stub|logic|value|return|data|code|solver|mesh|fallback)"
|
|
100
|
+
r"|stub\s+for\s+now|simplified\s+fallback|fake_data|mock_data|optional\s+hardcore)\b",
|
|
101
|
+
re.I,
|
|
102
|
+
),
|
|
103
|
+
True,
|
|
104
|
+
),
|
|
105
|
+
(
|
|
106
|
+
"deferred-real-impl",
|
|
107
|
+
re.compile(r"\b(?:TODO|FIXME)\b.{0,40}\b(?:later|hardcore|real\s+impl|future|upgrade|placeholder)\b", re.I),
|
|
108
|
+
True,
|
|
109
|
+
),
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
CMD_RECEIPT_RE = re.compile(r"^cmd:\s*\S+.*(?:\bexit\s+0\b|\bok\b|\bpass(?:ed)?\b)", re.I)
|
|
113
|
+
URL_RECEIPT_RE = re.compile(r"^https?://\S+$", re.I)
|
|
114
|
+
FILE_LINE_TOKEN_RE = re.compile(r"([A-Za-z0-9_./\\-]+?\.[A-Za-z0-9]{1,10})(?::(\d+))?")
|
|
115
|
+
|
|
116
|
+
CLAIM_OVERCLAIM_RE = re.compile(
|
|
117
|
+
r"(?<![A-Za-z0-9_])(?:100%|always\s+works|never\s+fails|zero\s+(?:bugs|errors|failures|gaps)"
|
|
118
|
+
r"|completely\s+bug[- ]free|supports?\s+all|handles?\s+every|guaranteed\s+to)(?![A-Za-z0-9_])",
|
|
119
|
+
re.I,
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def reject_unsafe_root(root_arg: Path) -> Path:
|
|
124
|
+
if root_arg.is_symlink():
|
|
125
|
+
raise SystemExit(f"project root cannot be a symlink: {root_arg}")
|
|
126
|
+
resolved = root_arg.resolve()
|
|
127
|
+
if not resolved.is_dir():
|
|
128
|
+
raise SystemExit(f"project root does not exist: {resolved}")
|
|
129
|
+
if resolved.parent == resolved:
|
|
130
|
+
raise SystemExit(f"refusing filesystem root as project root: {resolved}")
|
|
131
|
+
forbidden = {Path.home().resolve(), Path(tempfile.gettempdir()).resolve()}
|
|
132
|
+
for extra in ("/tmp", "/var/tmp", "/private/tmp"):
|
|
133
|
+
p = Path(extra)
|
|
134
|
+
if p.exists():
|
|
135
|
+
forbidden.add(p.resolve())
|
|
136
|
+
if resolved in forbidden:
|
|
137
|
+
raise SystemExit(f"refusing home or system temp directory as project root: {resolved}")
|
|
138
|
+
return resolved
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def ensure_contained(target: Path, root: Path) -> Path:
|
|
142
|
+
resolved_root = reject_unsafe_root(root)
|
|
143
|
+
if target.is_symlink():
|
|
144
|
+
raise SystemExit(f"refusing symlink path: {target}")
|
|
145
|
+
resolved_target = target.resolve()
|
|
146
|
+
try:
|
|
147
|
+
rel_parts = resolved_target.relative_to(resolved_root).parts
|
|
148
|
+
except ValueError as err:
|
|
149
|
+
raise SystemExit(f"path {resolved_target} escapes project root {resolved_root}") from err
|
|
150
|
+
probe = resolved_root
|
|
151
|
+
for part in rel_parts:
|
|
152
|
+
probe = probe / part
|
|
153
|
+
if probe.is_symlink():
|
|
154
|
+
raise SystemExit(f"refusing symlink component inside root: {probe}")
|
|
155
|
+
return resolved_target
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
def atomic_write_text(target: Path, content: str, root: Path) -> None:
|
|
159
|
+
atomic_write_bytes(target, content.encode("utf-8"), root)
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
def atomic_write_bytes(target: Path, content: bytes, root: Path) -> None:
|
|
163
|
+
safe_target = ensure_contained(target, root)
|
|
164
|
+
safe_parent = ensure_contained(safe_target.parent, root)
|
|
165
|
+
safe_parent.mkdir(parents=True, exist_ok=True)
|
|
166
|
+
fd, tmp_name = tempfile.mkstemp(prefix=f".{safe_target.name}.", suffix=".tmp", dir=str(safe_parent))
|
|
167
|
+
tmp_path = Path(tmp_name)
|
|
168
|
+
try:
|
|
169
|
+
with os.fdopen(fd, "wb") as handle:
|
|
170
|
+
handle.write(content)
|
|
171
|
+
handle.flush()
|
|
172
|
+
os.fsync(handle.fileno())
|
|
173
|
+
last_err = None
|
|
174
|
+
for attempt in range(5):
|
|
175
|
+
try:
|
|
176
|
+
os.replace(str(tmp_path), str(safe_target))
|
|
177
|
+
last_err = None
|
|
178
|
+
break
|
|
179
|
+
except PermissionError as err:
|
|
180
|
+
last_err = err
|
|
181
|
+
time.sleep(0.05 * (attempt + 1))
|
|
182
|
+
if last_err is not None:
|
|
183
|
+
raise last_err
|
|
184
|
+
finally:
|
|
185
|
+
if tmp_path.exists():
|
|
186
|
+
try:
|
|
187
|
+
tmp_path.unlink()
|
|
188
|
+
except OSError:
|
|
189
|
+
pass
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def _run_git(root: Path, args: list[str]) -> subprocess.CompletedProcess:
|
|
193
|
+
env = dict(os.environ)
|
|
194
|
+
env["GIT_OPTIONAL_LOCKS"] = "0"
|
|
195
|
+
return subprocess.run(
|
|
196
|
+
["git", "-c", "core.quotePath=false", "-C", str(root), *args],
|
|
197
|
+
capture_output=True,
|
|
198
|
+
text=True,
|
|
199
|
+
encoding="utf-8",
|
|
200
|
+
errors="replace",
|
|
201
|
+
env=env,
|
|
202
|
+
check=False,
|
|
203
|
+
creationflags=NO_WINDOW,
|
|
204
|
+
)
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
def _is_git_root_or_worktree(root: Path) -> bool:
|
|
208
|
+
if (root / ".git").exists():
|
|
209
|
+
return True
|
|
210
|
+
res = _run_git(root, ["rev-parse", "--show-toplevel"])
|
|
211
|
+
if res.returncode != 0:
|
|
212
|
+
return False
|
|
213
|
+
try:
|
|
214
|
+
return Path(res.stdout.strip()).resolve() == root.resolve()
|
|
215
|
+
except OSError:
|
|
216
|
+
return False
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
def _iter_non_git_files(safe_root: Path, cap: int = 200) -> list[str]:
|
|
220
|
+
found: list[str] = []
|
|
221
|
+
for cur_root, dirnames, filenames in os.walk(safe_root):
|
|
222
|
+
dirnames[:] = [
|
|
223
|
+
d for d in sorted(dirnames)
|
|
224
|
+
if d not in NON_GIT_SKIP_DIRS and not (Path(cur_root) / d).is_symlink()
|
|
225
|
+
]
|
|
226
|
+
base = Path(cur_root)
|
|
227
|
+
for fn in sorted(filenames):
|
|
228
|
+
p = base / fn
|
|
229
|
+
if p.is_symlink():
|
|
230
|
+
continue
|
|
231
|
+
ext = p.suffix.lower()
|
|
232
|
+
if ext in (CODE_EXTS | PROOF_EXTS | SCHEMA_OR_CONFIG_EXTS | {".md"}):
|
|
233
|
+
found.append(p.relative_to(safe_root).as_posix())
|
|
234
|
+
if len(found) >= cap:
|
|
235
|
+
return found
|
|
236
|
+
return found
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
def compute_tree_digest(root: Path) -> str:
|
|
240
|
+
safe_root = reject_unsafe_root(root)
|
|
241
|
+
h = hashlib.sha256()
|
|
242
|
+
if _is_git_root_or_worktree(safe_root):
|
|
243
|
+
head = _run_git(safe_root, ["rev-parse", "HEAD"])
|
|
244
|
+
h.update(f"HEAD:{head.stdout.strip()}\n".encode("utf-8"))
|
|
245
|
+
status = _run_git(safe_root, ["status", "--porcelain=v1", "-uno"])
|
|
246
|
+
for line in sorted(status.stdout.splitlines()):
|
|
247
|
+
norm = line.replace("\\", "/")
|
|
248
|
+
if "/.scratch/" in norm or norm.endswith(" .scratch") or ".worktrees/" in norm:
|
|
249
|
+
continue
|
|
250
|
+
h.update((norm + "\n").encode("utf-8"))
|
|
251
|
+
diff = _run_git(safe_root, ["diff", "--relative", "HEAD"])
|
|
252
|
+
h.update(diff.stdout.encode("utf-8", errors="replace"))
|
|
253
|
+
untracked = _run_git(safe_root, ["ls-files", "--others", "--exclude-standard"])
|
|
254
|
+
for rel in sorted(untracked.stdout.splitlines()):
|
|
255
|
+
norm = rel.strip().replace("\\", "/")
|
|
256
|
+
if not norm or norm.startswith((".scratch/", ".worktrees/", "__pycache__/")):
|
|
257
|
+
continue
|
|
258
|
+
p = safe_root / norm
|
|
259
|
+
if p.is_file() and not p.is_symlink():
|
|
260
|
+
try:
|
|
261
|
+
h.update(f"U:{norm}:{hashlib.sha256(p.read_bytes()).hexdigest()}\n".encode("utf-8"))
|
|
262
|
+
except OSError:
|
|
263
|
+
pass
|
|
264
|
+
else:
|
|
265
|
+
for rel in _iter_non_git_files(safe_root, cap=200):
|
|
266
|
+
p = safe_root / rel
|
|
267
|
+
if p.is_file() and not p.is_symlink():
|
|
268
|
+
try:
|
|
269
|
+
h.update(f"NG:{rel}:{hashlib.sha256(p.read_bytes()).hexdigest()}\n".encode("utf-8"))
|
|
270
|
+
except OSError:
|
|
271
|
+
pass
|
|
272
|
+
return h.hexdigest()[:24]
|
|
273
|
+
|
|
274
|
+
def _parse_numstat(output: str) -> dict[str, tuple[int, int]]:
|
|
275
|
+
stats: dict[str, tuple[int, int]] = {}
|
|
276
|
+
for line in output.splitlines():
|
|
277
|
+
parts = line.split("\t")
|
|
278
|
+
if len(parts) < 3:
|
|
279
|
+
continue
|
|
280
|
+
add_raw, del_raw, raw_path = parts[0], parts[1], parts[2]
|
|
281
|
+
if " => " in raw_path:
|
|
282
|
+
raw_path = re.sub(r"\{[^{}]* => ([^{}]*)\}", r"\1", raw_path)
|
|
283
|
+
if " => " in raw_path:
|
|
284
|
+
raw_path = raw_path.split(" => ", 1)[1]
|
|
285
|
+
path_norm = raw_path.strip().strip('"').replace("\\", "/")
|
|
286
|
+
if not path_norm or path_norm.startswith((".scratch/", ".worktrees/")):
|
|
287
|
+
continue
|
|
288
|
+
added = int(add_raw) if add_raw.isdigit() else 0
|
|
289
|
+
deleted = int(del_raw) if del_raw.isdigit() else 0
|
|
290
|
+
prev_a, prev_d = stats.get(path_norm, (0, 0))
|
|
291
|
+
stats[path_norm] = (prev_a + added, prev_d + deleted)
|
|
292
|
+
return stats
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
def _count_file_lines(path: Path) -> int:
|
|
296
|
+
try:
|
|
297
|
+
data = path.read_bytes()
|
|
298
|
+
except OSError:
|
|
299
|
+
return 0
|
|
300
|
+
if b"\x00" in data[:8192] or not data:
|
|
301
|
+
return 0
|
|
302
|
+
return data.count(b"\n") + (0 if data.endswith(b"\n") else 1)
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
def _find_inline_marker(line: str, marker: str) -> int:
|
|
306
|
+
in_single = False
|
|
307
|
+
in_double = False
|
|
308
|
+
escaped = False
|
|
309
|
+
mlen = len(marker)
|
|
310
|
+
limit = len(line) - mlen + 1
|
|
311
|
+
i = 0
|
|
312
|
+
while i < limit:
|
|
313
|
+
ch = line[i]
|
|
314
|
+
if escaped:
|
|
315
|
+
escaped = False
|
|
316
|
+
i += 1
|
|
317
|
+
continue
|
|
318
|
+
if ch == "\\" and (in_single or in_double):
|
|
319
|
+
escaped = True
|
|
320
|
+
i += 1
|
|
321
|
+
continue
|
|
322
|
+
if ch == "'" and not in_double:
|
|
323
|
+
in_single = not in_single
|
|
324
|
+
elif ch == '"' and not in_single:
|
|
325
|
+
in_double = not in_double
|
|
326
|
+
elif not in_single and not in_double and line.startswith(marker, i):
|
|
327
|
+
if marker == "//" and i > 0 and line[i - 1] == ":":
|
|
328
|
+
i += 1
|
|
329
|
+
continue
|
|
330
|
+
return i
|
|
331
|
+
i += 1
|
|
332
|
+
return -1
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
def _comment_body(path: str, line: str) -> str | None:
|
|
336
|
+
ext = Path(path).suffix.lower()
|
|
337
|
+
stripped = line.lstrip()
|
|
338
|
+
if ext in HASH_COMMENT_EXTS:
|
|
339
|
+
if stripped.startswith("#!"):
|
|
340
|
+
return None
|
|
341
|
+
if stripped.startswith("#"):
|
|
342
|
+
return stripped[1:].strip()
|
|
343
|
+
idx = _find_inline_marker(line, "#")
|
|
344
|
+
if idx >= 0:
|
|
345
|
+
return line[idx + 1 :].strip()
|
|
346
|
+
elif ext in SLASH_COMMENT_EXTS:
|
|
347
|
+
if stripped.startswith("//"):
|
|
348
|
+
return stripped[2:].strip()
|
|
349
|
+
if stripped.startswith("/*") and not stripped.startswith("/**"):
|
|
350
|
+
body = stripped[2:]
|
|
351
|
+
if body.endswith("*/"):
|
|
352
|
+
body = body[: -2]
|
|
353
|
+
return body.strip(" *")
|
|
354
|
+
idx = _find_inline_marker(line, "//")
|
|
355
|
+
if idx >= 0:
|
|
356
|
+
return line[idx + 2 :].strip()
|
|
357
|
+
elif ext in DASH_COMMENT_EXTS:
|
|
358
|
+
if stripped.startswith("--"):
|
|
359
|
+
body = stripped[2:].strip()
|
|
360
|
+
if ext in (".lua", ".luau") and LUAU_DIRECTIVE_RE.match(body):
|
|
361
|
+
return None
|
|
362
|
+
return body
|
|
363
|
+
idx = _find_inline_marker(line, "--")
|
|
364
|
+
if idx >= 0:
|
|
365
|
+
body = line[idx + 2 :].strip()
|
|
366
|
+
if ext in (".lua", ".luau") and LUAU_DIRECTIVE_RE.match(body):
|
|
367
|
+
return None
|
|
368
|
+
return body
|
|
369
|
+
return None
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
def _should_keep_comment(body: str) -> bool:
|
|
373
|
+
if not body:
|
|
374
|
+
return True
|
|
375
|
+
if COMMENT_SCENT_RE.search(body):
|
|
376
|
+
return False
|
|
377
|
+
return bool(COMMENT_KEEP_RE.search(body))
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
def _collect_diff_patches(root: Path, paths: list[str], base: str | None, staged: bool, head_sha: str | None) -> list[str]:
|
|
381
|
+
if not paths:
|
|
382
|
+
return []
|
|
383
|
+
outputs: list[str] = []
|
|
384
|
+
if base:
|
|
385
|
+
res = _run_git(root, ["diff", "--relative", "-U0", base, "--", *paths])
|
|
386
|
+
if res.returncode == 0:
|
|
387
|
+
outputs.append(res.stdout)
|
|
388
|
+
elif staged:
|
|
389
|
+
res = _run_git(root, ["diff", "--relative", "--cached", "-U0", "--", *paths])
|
|
390
|
+
if res.returncode == 0:
|
|
391
|
+
outputs.append(res.stdout)
|
|
392
|
+
elif head_sha:
|
|
393
|
+
res = _run_git(root, ["diff", "--relative", "-U0", "HEAD", "--", *paths])
|
|
394
|
+
if res.returncode == 0:
|
|
395
|
+
outputs.append(res.stdout)
|
|
396
|
+
else:
|
|
397
|
+
cached = _run_git(root, ["diff", "--relative", "--cached", "-U0", "--", *paths])
|
|
398
|
+
if cached.returncode == 0 and cached.stdout:
|
|
399
|
+
outputs.append(cached.stdout)
|
|
400
|
+
unstaged = _run_git(root, ["diff", "--relative", "-U0", "--", *paths])
|
|
401
|
+
if unstaged.returncode == 0 and unstaged.stdout:
|
|
402
|
+
outputs.append(unstaged.stdout)
|
|
403
|
+
return outputs
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
def _iter_added_lines(
|
|
407
|
+
root: Path, target_paths: set[str], base: str | None, staged: bool, head_sha: str | None
|
|
408
|
+
):
|
|
409
|
+
if not target_paths:
|
|
410
|
+
return
|
|
411
|
+
seen_in_diff: set[str] = set()
|
|
412
|
+
seen_pairs: set[tuple[str, int]] = set()
|
|
413
|
+
patches = _collect_diff_patches(root, sorted(target_paths), base, staged, head_sha)
|
|
414
|
+
for patch in patches:
|
|
415
|
+
cur_file = None
|
|
416
|
+
cur_line = 0
|
|
417
|
+
for raw in patch.splitlines():
|
|
418
|
+
if raw.startswith("diff --git "):
|
|
419
|
+
cur_file = None
|
|
420
|
+
elif raw.startswith("+++ "):
|
|
421
|
+
header_path = raw[4:].strip().strip('"')
|
|
422
|
+
if header_path == "/dev/null":
|
|
423
|
+
cur_file = None
|
|
424
|
+
else:
|
|
425
|
+
if header_path.startswith("b/"):
|
|
426
|
+
header_path = header_path[2:]
|
|
427
|
+
cur_file = header_path.replace("\\", "/")
|
|
428
|
+
seen_in_diff.add(cur_file)
|
|
429
|
+
elif raw.startswith("@@ "):
|
|
430
|
+
m = re.search(r"\+(\d+)", raw)
|
|
431
|
+
cur_line = int(m.group(1)) if m else 0
|
|
432
|
+
elif cur_file and cur_file in target_paths and raw.startswith("+") and not raw.startswith("+++"):
|
|
433
|
+
key = (cur_file, cur_line)
|
|
434
|
+
if key not in seen_pairs:
|
|
435
|
+
seen_pairs.add(key)
|
|
436
|
+
yield cur_file, cur_line, raw[1:]
|
|
437
|
+
cur_line += 1
|
|
438
|
+
|
|
439
|
+
if not staged:
|
|
440
|
+
for rel in sorted(target_paths - seen_in_diff):
|
|
441
|
+
target = root / rel
|
|
442
|
+
if not target.is_file() or target.is_symlink():
|
|
443
|
+
continue
|
|
444
|
+
try:
|
|
445
|
+
lines = target.read_text(encoding="utf-8", errors="replace").splitlines()
|
|
446
|
+
except OSError:
|
|
447
|
+
continue
|
|
448
|
+
for idx, line in enumerate(lines, 1):
|
|
449
|
+
yield rel, idx, line
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
def _scan_added_comments(root: Path, files: list[str], base: str | None, staged: bool, head_sha: str | None) -> list[dict]:
|
|
453
|
+
scan_set = {p for p in files if Path(p).suffix.lower() in COMMENT_SCAN_EXTS}
|
|
454
|
+
found: list[dict] = []
|
|
455
|
+
for rel, line_no, text in _iter_added_lines(root, scan_set, base, staged, head_sha):
|
|
456
|
+
body = _comment_body(rel, text)
|
|
457
|
+
if body is not None and not _should_keep_comment(body):
|
|
458
|
+
found.append(
|
|
459
|
+
{
|
|
460
|
+
"path": rel,
|
|
461
|
+
"line": line_no,
|
|
462
|
+
"text": body[:120],
|
|
463
|
+
"high_scent": bool(COMMENT_SCENT_RE.search(body)),
|
|
464
|
+
}
|
|
465
|
+
)
|
|
466
|
+
return found
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
def _python_regex_or_template_lines(root: Path, rel: str) -> set[int]:
|
|
470
|
+
if not rel.lower().endswith(".py"):
|
|
471
|
+
return set()
|
|
472
|
+
target = root / rel
|
|
473
|
+
try:
|
|
474
|
+
src = target.read_text(encoding="utf-8", errors="replace")
|
|
475
|
+
tree = ast.parse(src, filename=rel)
|
|
476
|
+
except (OSError, SyntaxError):
|
|
477
|
+
return set()
|
|
478
|
+
skip: set[int] = set()
|
|
479
|
+
for node in ast.walk(tree):
|
|
480
|
+
if isinstance(node, ast.Call):
|
|
481
|
+
fn = node.func
|
|
482
|
+
is_re_compile = (
|
|
483
|
+
isinstance(fn, ast.Attribute)
|
|
484
|
+
and fn.attr in {"compile", "search", "match", "fullmatch", "sub", "findall", "finditer"}
|
|
485
|
+
and isinstance(fn.value, ast.Name)
|
|
486
|
+
and fn.value.id == "re"
|
|
487
|
+
)
|
|
488
|
+
if is_re_compile and hasattr(node, "lineno") and hasattr(node, "end_lineno"):
|
|
489
|
+
skip.update(range(node.lineno, (node.end_lineno or node.lineno) + 1))
|
|
490
|
+
elif isinstance(node, ast.Constant) and isinstance(node.value, str):
|
|
491
|
+
val = node.value
|
|
492
|
+
if ("/deep " in val or "Hardcore Mode" in val or "hardcore-craft-depth" in val or "(optional hardcore mode)" in val.lower()) and hasattr(node, "lineno"):
|
|
493
|
+
skip.update(range(node.lineno, (getattr(node, "end_lineno", None) or node.lineno) + 1))
|
|
494
|
+
return skip
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
def _scan_workaround_smells(root: Path, files: list[str], base: str | None, staged: bool, head_sha: str | None) -> list[dict]:
|
|
498
|
+
code_set = {p for p in files if Path(p).suffix.lower() in CODE_EXTS and not TEST_PATH_RE.search(p)}
|
|
499
|
+
skip_cache: dict[str, set[int]] = {}
|
|
500
|
+
found: list[dict] = []
|
|
501
|
+
for rel, line_no, text in _iter_added_lines(root, code_set, base, staged, head_sha):
|
|
502
|
+
stripped = text.lstrip()
|
|
503
|
+
if stripped.startswith(("#", "//", "--", "/*", "*")) or "re.compile(" in text:
|
|
504
|
+
continue
|
|
505
|
+
if rel not in skip_cache:
|
|
506
|
+
skip_cache[rel] = _python_regex_or_template_lines(root, rel)
|
|
507
|
+
if line_no in skip_cache[rel]:
|
|
508
|
+
continue
|
|
509
|
+
for kind, pat, is_critical in WORKAROUND_SMELL_PATTERNS:
|
|
510
|
+
if pat.search(text):
|
|
511
|
+
found.append(
|
|
512
|
+
{
|
|
513
|
+
"path": rel,
|
|
514
|
+
"line": line_no,
|
|
515
|
+
"kind": kind,
|
|
516
|
+
"critical": is_critical,
|
|
517
|
+
"text": text.strip()[:120],
|
|
518
|
+
}
|
|
519
|
+
)
|
|
520
|
+
return found
|
|
521
|
+
|
|
522
|
+
|
|
523
|
+
def _scan_toy_shortcuts(root: Path, files: list[str], base: str | None, staged: bool, head_sha: str | None) -> list[dict]:
|
|
524
|
+
code_set = {p for p in files if Path(p).suffix.lower() in CODE_EXTS and not TEST_PATH_RE.search(p)}
|
|
525
|
+
skip_cache: dict[str, set[int]] = {}
|
|
526
|
+
found: list[dict] = []
|
|
527
|
+
for rel, line_no, text in _iter_added_lines(root, code_set, base, staged, head_sha):
|
|
528
|
+
if "re.compile(" in text:
|
|
529
|
+
continue
|
|
530
|
+
if rel not in skip_cache:
|
|
531
|
+
skip_cache[rel] = _python_regex_or_template_lines(root, rel)
|
|
532
|
+
if line_no in skip_cache[rel]:
|
|
533
|
+
continue
|
|
534
|
+
cbody = _comment_body(rel, text)
|
|
535
|
+
if cbody is not None and re.search(r"\b(?:placeholder|stub|simplified\s+fallback|optional\s+hardcore)\b", cbody, re.I):
|
|
536
|
+
found.append(
|
|
537
|
+
{
|
|
538
|
+
"path": rel,
|
|
539
|
+
"line": line_no,
|
|
540
|
+
"kind": "comment-placeholder-shortcut",
|
|
541
|
+
"critical": True,
|
|
542
|
+
"text": text.strip()[:120],
|
|
543
|
+
}
|
|
544
|
+
)
|
|
545
|
+
continue
|
|
546
|
+
for kind, pat, is_critical in TOY_SHORTCUT_PATTERNS:
|
|
547
|
+
if pat.search(text):
|
|
548
|
+
found.append(
|
|
549
|
+
{
|
|
550
|
+
"path": rel,
|
|
551
|
+
"line": line_no,
|
|
552
|
+
"kind": kind,
|
|
553
|
+
"critical": is_critical,
|
|
554
|
+
"text": text.strip()[:120],
|
|
555
|
+
}
|
|
556
|
+
)
|
|
557
|
+
break
|
|
558
|
+
return found
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
def _scan_backend_perf_traps(root: Path, files: list[str]) -> list[dict]:
|
|
562
|
+
perf_script = Path(__file__).resolve().parent.parent / "perf-audit" / "perf_audit.py"
|
|
563
|
+
if not perf_script.is_file():
|
|
564
|
+
return []
|
|
565
|
+
cand_files = [
|
|
566
|
+
f for f in files
|
|
567
|
+
if Path(f).suffix.lower() in BACKEND_EXTS
|
|
568
|
+
and not TEST_PATH_RE.search(f)
|
|
569
|
+
and (root / f).is_file()
|
|
570
|
+
]
|
|
571
|
+
if not cand_files:
|
|
572
|
+
return []
|
|
573
|
+
try:
|
|
574
|
+
spec = importlib.util.spec_from_file_location("self_grill_perf_audit", perf_script)
|
|
575
|
+
if spec is None or spec.loader is None:
|
|
576
|
+
return []
|
|
577
|
+
mod = importlib.util.module_from_spec(spec)
|
|
578
|
+
sys.modules[spec.name] = mod
|
|
579
|
+
spec.loader.exec_module(mod)
|
|
580
|
+
res = mod.scan_paths(root, explicit_files=cand_files)
|
|
581
|
+
return list(res.get("findings") or [])
|
|
582
|
+
except Exception:
|
|
583
|
+
return []
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
|
|
587
|
+
def _scan_reward_hacks(root: Path, files: list[str], base: str | None, staged: bool) -> list[dict]:
|
|
588
|
+
rg_script = Path(__file__).resolve().parent.parent / "reward-guard" / "reward_guard.py"
|
|
589
|
+
if not rg_script.is_file() or not files:
|
|
590
|
+
return []
|
|
591
|
+
try:
|
|
592
|
+
spec = importlib.util.spec_from_file_location("self_grill_reward_guard", rg_script)
|
|
593
|
+
if spec is None or spec.loader is None:
|
|
594
|
+
return []
|
|
595
|
+
mod = importlib.util.module_from_spec(spec)
|
|
596
|
+
sys.modules[spec.name] = mod
|
|
597
|
+
spec.loader.exec_module(mod)
|
|
598
|
+
res = mod.scan_reward_hacking(root, staged=staged, explicit_files=files if not _is_git_root_or_worktree(root) else None, base=base)
|
|
599
|
+
return list(res.get("findings") or [])
|
|
600
|
+
except Exception:
|
|
601
|
+
return []
|
|
602
|
+
|
|
603
|
+
def _auto_merge_base(root: Path) -> str | None:
|
|
604
|
+
branch_res = _run_git(root, ["rev-parse", "--abbrev-ref", "HEAD"])
|
|
605
|
+
branch = branch_res.stdout.strip() if branch_res.returncode == 0 else ""
|
|
606
|
+
if not branch or branch in ("main", "master", "HEAD"):
|
|
607
|
+
return None
|
|
608
|
+
for candidate in ("origin/main", "origin/master", "main", "master"):
|
|
609
|
+
mb = _run_git(root, ["merge-base", "HEAD", candidate])
|
|
610
|
+
if mb.returncode == 0:
|
|
611
|
+
sha = mb.stdout.strip()
|
|
612
|
+
head = _run_git(root, ["rev-parse", "HEAD"]).stdout.strip()
|
|
613
|
+
if sha and sha != head:
|
|
614
|
+
return sha
|
|
615
|
+
return None
|
|
616
|
+
|
|
617
|
+
|
|
618
|
+
|
|
619
|
+
def _scan_proof_escapes(root: Path, files: list[str]) -> list[dict]:
|
|
620
|
+
vp_script = Path(__file__).resolve().parent.parent / "formal-verification" / "verify_proof.py"
|
|
621
|
+
if not vp_script.is_file():
|
|
622
|
+
return []
|
|
623
|
+
cand_files = [
|
|
624
|
+
f for f in files
|
|
625
|
+
if Path(f).suffix.lower() in PROOF_EXTS
|
|
626
|
+
and not TEST_PATH_RE.search(f)
|
|
627
|
+
and (root / f).is_file()
|
|
628
|
+
]
|
|
629
|
+
if not cand_files:
|
|
630
|
+
return []
|
|
631
|
+
try:
|
|
632
|
+
spec = importlib.util.spec_from_file_location("self_grill_verify_proof", vp_script)
|
|
633
|
+
if spec is None or spec.loader is None:
|
|
634
|
+
return []
|
|
635
|
+
mod = importlib.util.module_from_spec(spec)
|
|
636
|
+
sys.modules[spec.name] = mod
|
|
637
|
+
spec.loader.exec_module(mod)
|
|
638
|
+
out: list[dict] = []
|
|
639
|
+
for rel in cand_files:
|
|
640
|
+
for item in mod.scan_proof_file(root / rel, base_root=root):
|
|
641
|
+
out.append({
|
|
642
|
+
"rule_id": item.rule_id,
|
|
643
|
+
"severity": item.severity,
|
|
644
|
+
"file": item.file,
|
|
645
|
+
"line": item.line,
|
|
646
|
+
"message": item.message,
|
|
647
|
+
})
|
|
648
|
+
return out
|
|
649
|
+
except Exception:
|
|
650
|
+
return []
|
|
651
|
+
|
|
652
|
+
def inspect_diff(
|
|
653
|
+
root: Path,
|
|
654
|
+
base: str | None = None,
|
|
655
|
+
staged: bool = False,
|
|
656
|
+
explicit_files: list[str] | None = None,
|
|
657
|
+
) -> dict:
|
|
658
|
+
safe_root = reject_unsafe_root(root)
|
|
659
|
+
stats: dict[str, tuple[int, int]] = {}
|
|
660
|
+
head_sha = None
|
|
661
|
+
effective_base = base
|
|
662
|
+
in_git = _is_git_root_or_worktree(safe_root)
|
|
663
|
+
if explicit_files:
|
|
664
|
+
for raw in explicit_files:
|
|
665
|
+
cand = ensure_contained((safe_root / raw) if not Path(raw).is_absolute() else Path(raw), safe_root)
|
|
666
|
+
if cand.is_file():
|
|
667
|
+
rel = cand.relative_to(safe_root).as_posix()
|
|
668
|
+
stats[rel] = (_count_file_lines(cand), 0)
|
|
669
|
+
elif in_git:
|
|
670
|
+
head_res = _run_git(safe_root, ["rev-parse", "--short", "HEAD"])
|
|
671
|
+
if head_res.returncode == 0:
|
|
672
|
+
head_sha = head_res.stdout.strip() or None
|
|
673
|
+
if effective_base:
|
|
674
|
+
diff_res = _run_git(safe_root, ["diff", "--relative", "--numstat", effective_base])
|
|
675
|
+
if diff_res.returncode != 0:
|
|
676
|
+
diff_res = _run_git(safe_root, ["diff", "--relative", "--numstat", f"{effective_base}...HEAD"])
|
|
677
|
+
stats.update(_parse_numstat(diff_res.stdout))
|
|
678
|
+
elif staged:
|
|
679
|
+
diff_res = _run_git(safe_root, ["diff", "--relative", "--cached", "--numstat"])
|
|
680
|
+
stats.update(_parse_numstat(diff_res.stdout))
|
|
681
|
+
else:
|
|
682
|
+
if head_sha:
|
|
683
|
+
diff_res = _run_git(safe_root, ["diff", "--relative", "--numstat", "HEAD"])
|
|
684
|
+
stats.update(_parse_numstat(diff_res.stdout))
|
|
685
|
+
else:
|
|
686
|
+
cached_res = _run_git(safe_root, ["diff", "--relative", "--cached", "--numstat"])
|
|
687
|
+
stats.update(_parse_numstat(cached_res.stdout))
|
|
688
|
+
wt_res = _run_git(safe_root, ["diff", "--relative", "--numstat"])
|
|
689
|
+
stats.update(_parse_numstat(wt_res.stdout))
|
|
690
|
+
|
|
691
|
+
if not staged:
|
|
692
|
+
untracked = _run_git(safe_root, ["ls-files", "--others", "--exclude-standard"])
|
|
693
|
+
if untracked.returncode == 0:
|
|
694
|
+
for rel in untracked.stdout.splitlines():
|
|
695
|
+
norm = rel.strip().replace("\\", "/")
|
|
696
|
+
if not norm or norm.startswith((".scratch/", ".worktrees/")):
|
|
697
|
+
continue
|
|
698
|
+
stats.setdefault(norm, (_count_file_lines(safe_root / norm), 0))
|
|
699
|
+
|
|
700
|
+
if not stats and not effective_base and not staged and head_sha:
|
|
701
|
+
mb = _auto_merge_base(safe_root)
|
|
702
|
+
if mb:
|
|
703
|
+
effective_base = mb
|
|
704
|
+
mb_res = _run_git(safe_root, ["diff", "--relative", "--numstat", mb])
|
|
705
|
+
stats.update(_parse_numstat(mb_res.stdout))
|
|
706
|
+
|
|
707
|
+
else:
|
|
708
|
+
for rel in _iter_non_git_files(safe_root, cap=150):
|
|
709
|
+
stats[rel] = (_count_file_lines(safe_root / rel), 0)
|
|
710
|
+
files = sorted(stats.keys())
|
|
711
|
+
added = sum(v[0] for v in stats.values())
|
|
712
|
+
deleted = sum(v[1] for v in stats.values())
|
|
713
|
+
total_lines = added + deleted
|
|
714
|
+
file_count = len(files)
|
|
715
|
+
|
|
716
|
+
sensitive_paths = [p for p in files if SENSITIVE_PATH_RE.search(p)]
|
|
717
|
+
test_paths = [p for p in files if TEST_PATH_RE.search(p)]
|
|
718
|
+
code_paths = [p for p in files if Path(p).suffix.lower() in CODE_EXTS and p not in test_paths]
|
|
719
|
+
proof_paths = [p for p in files if Path(p).suffix.lower() in PROOF_EXTS and p not in test_paths]
|
|
720
|
+
shell_paths = [p for p in files if Path(p).suffix.lower() in SHELL_OR_SCRIPT_EXTS]
|
|
721
|
+
schema_paths = [p for p in files if Path(p).suffix.lower() in SCHEMA_OR_CONFIG_EXTS]
|
|
722
|
+
skill_paths = [p for p in files if SKILL_OR_PROMPT_RE.search(p)]
|
|
723
|
+
|
|
724
|
+
if file_count == 0:
|
|
725
|
+
measured_size = "none"
|
|
726
|
+
elif total_lines <= 30 and file_count <= 2 and not sensitive_paths:
|
|
727
|
+
measured_size = "S"
|
|
728
|
+
elif total_lines > 250 or file_count > 8 or len(sensitive_paths) >= 2:
|
|
729
|
+
measured_size = "L"
|
|
730
|
+
else:
|
|
731
|
+
measured_size = "M"
|
|
732
|
+
|
|
733
|
+
added_comments = _scan_added_comments(safe_root, files, effective_base, staged, head_sha) if in_git else []
|
|
734
|
+
workaround_smells = _scan_workaround_smells(safe_root, files, effective_base, staged, head_sha) if in_git else []
|
|
735
|
+
toy_shortcuts = _scan_toy_shortcuts(safe_root, files, effective_base, staged, head_sha) if in_git else []
|
|
736
|
+
backend_perf_findings = _scan_backend_perf_traps(safe_root, files)
|
|
737
|
+
proof_escapes = _scan_proof_escapes(safe_root, files)
|
|
738
|
+
reward_hacks = _scan_reward_hacks(safe_root, files, effective_base, staged)
|
|
739
|
+
questions = build_questions(
|
|
740
|
+
phase="checks",
|
|
741
|
+
files=files,
|
|
742
|
+
total_lines=total_lines,
|
|
743
|
+
file_count=file_count,
|
|
744
|
+
sensitive_paths=sensitive_paths,
|
|
745
|
+
code_paths=code_paths,
|
|
746
|
+
test_paths=test_paths,
|
|
747
|
+
shell_paths=shell_paths,
|
|
748
|
+
schema_paths=schema_paths,
|
|
749
|
+
skill_paths=skill_paths,
|
|
750
|
+
added_comments=added_comments,
|
|
751
|
+
workaround_smells=workaround_smells,
|
|
752
|
+
toy_shortcuts=toy_shortcuts,
|
|
753
|
+
backend_perf_findings=backend_perf_findings,
|
|
754
|
+
proof_paths=proof_paths,
|
|
755
|
+
proof_escapes=proof_escapes,
|
|
756
|
+
reward_hacks=reward_hacks,
|
|
757
|
+
)
|
|
758
|
+
recommend_cross_family = measured_size == "L" or bool(sensitive_paths) or bool(proof_paths)
|
|
759
|
+
tree_digest = compute_tree_digest(safe_root)
|
|
760
|
+
return {
|
|
761
|
+
"root": str(safe_root),
|
|
762
|
+
"in_git": in_git,
|
|
763
|
+
"head_sha": head_sha,
|
|
764
|
+
"tree_digest": tree_digest,
|
|
765
|
+
"base": effective_base,
|
|
766
|
+
"staged": staged,
|
|
767
|
+
"file_count": file_count,
|
|
768
|
+
"lines_added": added,
|
|
769
|
+
"lines_deleted": deleted,
|
|
770
|
+
"total_lines": total_lines,
|
|
771
|
+
"measured_size": measured_size,
|
|
772
|
+
"files": files,
|
|
773
|
+
"sensitive_paths": sensitive_paths,
|
|
774
|
+
"code_paths": code_paths,
|
|
775
|
+
"proof_paths": proof_paths,
|
|
776
|
+
"test_paths": test_paths,
|
|
777
|
+
"shell_paths": shell_paths,
|
|
778
|
+
"schema_paths": schema_paths,
|
|
779
|
+
"skill_paths": skill_paths,
|
|
780
|
+
"added_comment_count": len(added_comments),
|
|
781
|
+
"added_comments": added_comments[:25],
|
|
782
|
+
"workaround_smell_count": len(workaround_smells),
|
|
783
|
+
"workaround_smells": workaround_smells[:25],
|
|
784
|
+
"toy_shortcut_count": len(toy_shortcuts),
|
|
785
|
+
"toy_shortcuts": toy_shortcuts[:25],
|
|
786
|
+
"backend_perf_count": len(backend_perf_findings),
|
|
787
|
+
"backend_perf_findings": backend_perf_findings[:25],
|
|
788
|
+
"proof_escape_count": len(proof_escapes),
|
|
789
|
+
"proof_escapes": proof_escapes[:25],
|
|
790
|
+
"reward_hack_count": len(reward_hacks),
|
|
791
|
+
"reward_hacks": reward_hacks[:25],
|
|
792
|
+
"recommend_cross_family_skeptic": recommend_cross_family,
|
|
793
|
+
"questions": questions,
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
|
|
797
|
+
def build_questions(
|
|
798
|
+
phase: str,
|
|
799
|
+
files: list[str],
|
|
800
|
+
total_lines: int,
|
|
801
|
+
file_count: int,
|
|
802
|
+
sensitive_paths: list[str],
|
|
803
|
+
code_paths: list[str],
|
|
804
|
+
test_paths: list[str],
|
|
805
|
+
shell_paths: list[str],
|
|
806
|
+
schema_paths: list[str],
|
|
807
|
+
skill_paths: list[str],
|
|
808
|
+
added_comments: list[dict] | None = None,
|
|
809
|
+
workaround_smells: list[dict] | None = None,
|
|
810
|
+
toy_shortcuts: list[dict] | None = None,
|
|
811
|
+
added_comment_total: int | None = None,
|
|
812
|
+
workaround_smell_total: int | None = None,
|
|
813
|
+
toy_shortcut_total: int | None = None,
|
|
814
|
+
backend_perf_findings: list[dict] | None = None,
|
|
815
|
+
proof_paths: list[str] | None = None,
|
|
816
|
+
proof_escapes: list[dict] | None = None,
|
|
817
|
+
reward_hacks: list[dict] | None = None,
|
|
818
|
+
) -> list[dict]:
|
|
819
|
+
items: list[dict] = []
|
|
820
|
+
comment_count = added_comment_total if added_comment_total is not None else len(added_comments or [])
|
|
821
|
+
smell_count = workaround_smell_total if workaround_smell_total is not None else len(workaround_smells or [])
|
|
822
|
+
shortcut_count = toy_shortcut_total if toy_shortcut_total is not None else len(toy_shortcuts or [])
|
|
823
|
+
perf_list = list(backend_perf_findings or [])
|
|
824
|
+
p_paths = list(proof_paths or [])
|
|
825
|
+
p_escapes = list(proof_escapes or [])
|
|
826
|
+
rh_list = list(reward_hacks or [])
|
|
827
|
+
def add(qid: str, severity: str, category: str, prompt: str, trigger: str) -> None:
|
|
828
|
+
items.append(
|
|
829
|
+
{
|
|
830
|
+
"id": qid,
|
|
831
|
+
"severity": severity,
|
|
832
|
+
"category": category,
|
|
833
|
+
"prompt": prompt,
|
|
834
|
+
"trigger": trigger,
|
|
835
|
+
"status": "open",
|
|
836
|
+
"answer": "",
|
|
837
|
+
"receipt": "",
|
|
838
|
+
}
|
|
839
|
+
)
|
|
840
|
+
|
|
841
|
+
if phase in ("plan", "both"):
|
|
842
|
+
add(
|
|
843
|
+
"premise-check",
|
|
844
|
+
"critical",
|
|
845
|
+
"plan",
|
|
846
|
+
"What assumption in this plan could be wrong or an XY proxy, and what repo/runtime fact proves the premise holds?",
|
|
847
|
+
"always-plan",
|
|
848
|
+
)
|
|
849
|
+
add(
|
|
850
|
+
"irreversible-and-scope",
|
|
851
|
+
"critical",
|
|
852
|
+
"plan",
|
|
853
|
+
"Are all user deliverables accounted for in the scope ledger, and does any step cross a hard stop or outside-root write?",
|
|
854
|
+
"always-plan",
|
|
855
|
+
)
|
|
856
|
+
add(
|
|
857
|
+
"oracle-before-code",
|
|
858
|
+
"advisory",
|
|
859
|
+
"plan",
|
|
860
|
+
"What exact real-artifact command or failing-without-fix test will prove this change works before reporting done?",
|
|
861
|
+
"always-plan",
|
|
862
|
+
)
|
|
863
|
+
add(
|
|
864
|
+
"hardcore-ceiling",
|
|
865
|
+
"critical",
|
|
866
|
+
"hardcore",
|
|
867
|
+
"Hardcore Mode check: does this plan aim straight for the first-principles architectural ceiling (real algorithms, parallelism, solvers, native representations/LODs) instead of sandbagging into a toy MVP or hiding the best tier under '(Optional hardcore mode)'?",
|
|
868
|
+
"always-plan",
|
|
869
|
+
)
|
|
870
|
+
|
|
871
|
+
if phase in ("checks", "both"):
|
|
872
|
+
add(
|
|
873
|
+
"real-artifact-proof",
|
|
874
|
+
"critical",
|
|
875
|
+
"checks",
|
|
876
|
+
"Did you run the real command, app, or test suite AFTER your final edit with raw exit code 0 (never masked behind | head or | tail)?",
|
|
877
|
+
"always-checks",
|
|
878
|
+
)
|
|
879
|
+
add(
|
|
880
|
+
"scope-completeness",
|
|
881
|
+
"critical",
|
|
882
|
+
"checks",
|
|
883
|
+
"Does every deliverable requested by the user map to a verified change or an explicit blocker with unblock path?",
|
|
884
|
+
"always-checks",
|
|
885
|
+
)
|
|
886
|
+
if code_paths and not test_paths:
|
|
887
|
+
add(
|
|
888
|
+
"missing-regression-test",
|
|
889
|
+
"critical",
|
|
890
|
+
"checks",
|
|
891
|
+
f"Code changed ({', '.join(code_paths[:4])}) without test edits: what failing-without-fix test or live check proves the behavior cannot silently regress?",
|
|
892
|
+
"code-without-tests",
|
|
893
|
+
)
|
|
894
|
+
if test_paths:
|
|
895
|
+
prod_or_proof = [p for p in files if p not in test_paths and not p.lower().endswith(".md")]
|
|
896
|
+
comut_note = (
|
|
897
|
+
f" Co-mutation warning: both implementation/proof ({', '.join(prod_or_proof[:2])}) and test/eval ({', '.join(test_paths[:2])}) files changed in the same diff—prove assertions were not weakened to match broken output."
|
|
898
|
+
if prod_or_proof else ""
|
|
899
|
+
)
|
|
900
|
+
add(
|
|
901
|
+
"no-check-theater",
|
|
902
|
+
"critical",
|
|
903
|
+
"checks",
|
|
904
|
+
"Would the new or touched tests fail if your production fix were reverted, and do they avoid mocking out the behavior under test?" + comut_note,
|
|
905
|
+
"tests-touched",
|
|
906
|
+
)
|
|
907
|
+
if sensitive_paths:
|
|
908
|
+
add(
|
|
909
|
+
"trust-boundary-fail-closed",
|
|
910
|
+
"critical",
|
|
911
|
+
"security",
|
|
912
|
+
f"Sensitive paths touched ({', '.join(sensitive_paths[:4])}): how do missing, malformed, or hostile inputs fail closed without leaking secrets or escaping root?",
|
|
913
|
+
"sensitive-paths",
|
|
914
|
+
)
|
|
915
|
+
if shell_paths:
|
|
916
|
+
add(
|
|
917
|
+
"exit-code-and-platform",
|
|
918
|
+
"advisory",
|
|
919
|
+
"platform",
|
|
920
|
+
"Do shell/script changes handle Windows paths, CRLF line endings, spaces in paths, and non-zero exit codes safely?",
|
|
921
|
+
"scripts-touched",
|
|
922
|
+
)
|
|
923
|
+
if skill_paths:
|
|
924
|
+
add(
|
|
925
|
+
"skill-and-link-validation",
|
|
926
|
+
"critical",
|
|
927
|
+
"skills",
|
|
928
|
+
"Did check_skill.py (and repo structural checks, byte budgets, and routing tests) pass after the final skill or prompt edit?",
|
|
929
|
+
"skills-touched",
|
|
930
|
+
)
|
|
931
|
+
if schema_paths:
|
|
932
|
+
add(
|
|
933
|
+
"schema-backcompat",
|
|
934
|
+
"advisory",
|
|
935
|
+
"data",
|
|
936
|
+
"Are config, JSON, or schema edits backwards-compatible and idempotent for existing callers and stored state?",
|
|
937
|
+
"schema-touched",
|
|
938
|
+
)
|
|
939
|
+
if total_lines > 200 or file_count > 6:
|
|
940
|
+
add(
|
|
941
|
+
"blast-radius-and-split",
|
|
942
|
+
"advisory",
|
|
943
|
+
"architecture",
|
|
944
|
+
f"Diff touches {total_lines} lines across {file_count} files: what indirect callers could break, and should any independent unit split out?",
|
|
945
|
+
"large-diff",
|
|
946
|
+
)
|
|
947
|
+
if added_comments:
|
|
948
|
+
high_scent = [c for c in added_comments if c.get("high_scent")]
|
|
949
|
+
locs = ", ".join(f"{c['path']}:{c['line']}" for c in added_comments[:4])
|
|
950
|
+
sev = "critical" if (high_scent or comment_count >= 3) else "advisory"
|
|
951
|
+
add(
|
|
952
|
+
"no-lying-comments",
|
|
953
|
+
sev,
|
|
954
|
+
"comments",
|
|
955
|
+
f"Diff adds {comment_count} code comment(s) ({locs}): comments rot and lie, and AI agents read comments instead of code. Delete narration/workaround/suppression comments via no-comments or prove each matches a strict keep exception.",
|
|
956
|
+
"added-comments",
|
|
957
|
+
)
|
|
958
|
+
if workaround_smells:
|
|
959
|
+
has_crit = any(s.get("critical") for s in workaround_smells)
|
|
960
|
+
locs = ", ".join(f"{s['path']}:{s['line']}({s['kind']})" for s in workaround_smells[:4])
|
|
961
|
+
sev = "critical" if (has_crit or smell_count >= 2) else "advisory"
|
|
962
|
+
add(
|
|
963
|
+
"no-workaround-smells",
|
|
964
|
+
sev,
|
|
965
|
+
"architecture",
|
|
966
|
+
f"Diff introduces {smell_count} workaround/foot-gun smell(s) ({locs}): eliminate the root cause or use a supported framework API/type instead of imperative timers, raw useEffect, or unsafe type casts.",
|
|
967
|
+
"workaround-smells",
|
|
968
|
+
)
|
|
969
|
+
if perf_list:
|
|
970
|
+
locs = ", ".join(f"{p['file']}:{p['line']}({p['rule_id']})" for p in perf_list[:4])
|
|
971
|
+
has_high = any(p.get("severity") == "high" for p in perf_list)
|
|
972
|
+
add(
|
|
973
|
+
"backend-systems-hygiene",
|
|
974
|
+
"critical" if has_high else "advisory",
|
|
975
|
+
"performance",
|
|
976
|
+
f"Diff triggers {len(perf_list)} backend/systems hot-path trap(s) ({locs}): eliminate N+1/await-in-loop waterfalls, sync-in-async blocking, missing HTTP timeouts, per-request pools, OFFSET scans, or cache/serialization bottlenecks per high-scale-server-optimization.md.",
|
|
977
|
+
"backend-perf-traps",
|
|
978
|
+
)
|
|
979
|
+
if p_escapes or p_paths:
|
|
980
|
+
esc_note = (
|
|
981
|
+
f" Static proof escapes found: {', '.join(f'{e['file']}:{e['line']}({e['rule_id']})' for e in p_escapes[:4])}."
|
|
982
|
+
if p_escapes else ""
|
|
983
|
+
)
|
|
984
|
+
add(
|
|
985
|
+
"proof-and-math-soundness",
|
|
986
|
+
"critical",
|
|
987
|
+
"formal",
|
|
988
|
+
f"Formal & mathematical proof soundness ({', '.join(p_paths[:4] or ['proofs'])}):{esc_note} "
|
|
989
|
+
"Verify zero sorry/admit/custom axiom/native_decide escapes via verify_proof.py audit-static, "
|
|
990
|
+
"check NL-to-formal statement alignment (quantifier order forall-exists vs exists-forall, n=0/1 boundaries, strict vs weak inequalities), "
|
|
991
|
+
"prove checks are able-to-fail (--mutate), and run two independent line-by-line audits on any non-kernel-certified step.",
|
|
992
|
+
"proof-touched",
|
|
993
|
+
)
|
|
994
|
+
if toy_shortcuts:
|
|
995
|
+
locs = ", ".join(f"{s['path']}:{s['line']}({s['kind']})" for s in toy_shortcuts[:4])
|
|
996
|
+
add(
|
|
997
|
+
"hardcore-craft-depth",
|
|
998
|
+
"critical",
|
|
999
|
+
"hardcore",
|
|
1000
|
+
f"Hardcore Mode violation: diff introduces {shortcut_count} stub/toy shortcut(s) ({locs}). Replace placeholders/stubs/deferred TODOs with the real first-principles implementation and prove it on the real artifact.",
|
|
1001
|
+
"toy-shortcuts",
|
|
1002
|
+
)
|
|
1003
|
+
elif code_paths and (total_lines > 30 or file_count > 2):
|
|
1004
|
+
add(
|
|
1005
|
+
"hardcore-craft-depth",
|
|
1006
|
+
"critical",
|
|
1007
|
+
"hardcore",
|
|
1008
|
+
"Hardcore Mode audit: does this implementation ship the true first-principles architecture/algorithm rather than a watered-down approximation, single-threaded shortcut, or deferred '(optional hardcore mode)' compromise?",
|
|
1009
|
+
"hardcore-code-change",
|
|
1010
|
+
)
|
|
1011
|
+
if rh_list:
|
|
1012
|
+
locs = ", ".join(f"{r['file']}:{r['line']}({r['rule']})" for r in rh_list[:4])
|
|
1013
|
+
add(
|
|
1014
|
+
"no-reward-hacking",
|
|
1015
|
+
"critical",
|
|
1016
|
+
"integrity",
|
|
1017
|
+
f"Goodhart / Anti-Reward-Hacking violation: diff triggers {len(rh_list)} reward-hack signal(s) ({locs}). Restore strict tests/types/thresholds/snapshots, remove prod test-env or TLS/FK bypasses, run real backends/generators instead of stubs/primitives, and verify via reward_guard.py.",
|
|
1018
|
+
"reward-hacks",
|
|
1019
|
+
)
|
|
1020
|
+
elif test_paths or schema_paths or any(
|
|
1021
|
+
re.search(r"(?:gate|eval|bench|perf|score|metric|validat|e2e|playwright|cypress|train|render|mesh|spark|fidelity)", p, re.I)
|
|
1022
|
+
for p in files
|
|
1023
|
+
):
|
|
1024
|
+
add(
|
|
1025
|
+
"no-reward-hacking",
|
|
1026
|
+
"critical",
|
|
1027
|
+
"integrity",
|
|
1028
|
+
"Goodhart / Anti-Reward-Hacking check (all domains): did you keep assertions, snapshots, coverage, typecheck/CI strictness, latency/quality bounds, and TLS/FK checks intact (zero test-env branches, E2E /api/ stubs, train-on-test leakage, or primitive stand-ins), and prove the real goal holds?",
|
|
1029
|
+
"verification-or-eval-touched",
|
|
1030
|
+
)
|
|
1031
|
+
add(
|
|
1032
|
+
"gaps-and-overclaims",
|
|
1033
|
+
"critical",
|
|
1034
|
+
"honesty",
|
|
1035
|
+
"Audit your work and final report for gaps and overclaims: does every claim, count, link, and 'passes/works' statement match an observed file or fresh run on this tree, with every remaining gap or limit named explicitly?",
|
|
1036
|
+
"always-checks",
|
|
1037
|
+
)
|
|
1038
|
+
add(
|
|
1039
|
+
"deletion-test",
|
|
1040
|
+
"advisory",
|
|
1041
|
+
"simplicity",
|
|
1042
|
+
"Apply the deletion test: what newly added wrapper, flag, comment, or prose block can be deleted without losing required behavior?",
|
|
1043
|
+
"always-checks",
|
|
1044
|
+
)
|
|
1045
|
+
return items
|
|
1046
|
+
|
|
1047
|
+
|
|
1048
|
+
def is_valid_receipt(receipt_text: str, root: Path | None = None) -> bool:
|
|
1049
|
+
text = receipt_text.strip()
|
|
1050
|
+
if len(text) < 4:
|
|
1051
|
+
return False
|
|
1052
|
+
if CMD_RECEIPT_RE.search(text) or URL_RECEIPT_RE.match(text):
|
|
1053
|
+
return True
|
|
1054
|
+
for raw_path, line_str in FILE_LINE_TOKEN_RE.findall(text):
|
|
1055
|
+
if raw_path.lower() in {"e.g", "i.e", "etc.py"}:
|
|
1056
|
+
continue
|
|
1057
|
+
if root is not None:
|
|
1058
|
+
cand = (root / raw_path).resolve()
|
|
1059
|
+
try:
|
|
1060
|
+
cand.relative_to(root.resolve())
|
|
1061
|
+
except ValueError:
|
|
1062
|
+
continue
|
|
1063
|
+
if cand.is_file():
|
|
1064
|
+
if line_str:
|
|
1065
|
+
line_no = int(line_str)
|
|
1066
|
+
total = _count_file_lines(cand)
|
|
1067
|
+
if 1 <= line_no <= max(1, total):
|
|
1068
|
+
return True
|
|
1069
|
+
else:
|
|
1070
|
+
return True
|
|
1071
|
+
elif line_str and int(line_str) >= 1:
|
|
1072
|
+
return True
|
|
1073
|
+
return False
|
|
1074
|
+
|
|
1075
|
+
|
|
1076
|
+
def _ensure_scratch_gitignore(root: Path) -> None:
|
|
1077
|
+
scratch_dir = ensure_contained(root / ".scratch", root)
|
|
1078
|
+
scratch_dir.mkdir(parents=True, exist_ok=True)
|
|
1079
|
+
gi = scratch_dir / ".gitignore"
|
|
1080
|
+
if not gi.exists():
|
|
1081
|
+
atomic_write_text(gi, "*\n!.gitignore\n", root)
|
|
1082
|
+
|
|
1083
|
+
|
|
1084
|
+
def cmd_check_diff(args: argparse.Namespace) -> int:
|
|
1085
|
+
report = inspect_diff(Path(args.root), base=args.base, staged=args.staged, explicit_files=args.files)
|
|
1086
|
+
if args.json:
|
|
1087
|
+
print(json.dumps(report, indent=2))
|
|
1088
|
+
else:
|
|
1089
|
+
print(
|
|
1090
|
+
f"size={report['measured_size']} files={report['file_count']} "
|
|
1091
|
+
f"lines=+{report['lines_added']}/-{report['lines_deleted']} "
|
|
1092
|
+
f"sensitive={len(report['sensitive_paths'])} "
|
|
1093
|
+
f"cross_family={report['recommend_cross_family_skeptic']}"
|
|
1094
|
+
)
|
|
1095
|
+
for q in report["questions"]:
|
|
1096
|
+
print(f"- [{q['severity']}] {q['id']}: {q['prompt']}")
|
|
1097
|
+
return 0
|
|
1098
|
+
|
|
1099
|
+
|
|
1100
|
+
def cmd_init(args: argparse.Namespace) -> int:
|
|
1101
|
+
if not SLUG_RE.fullmatch(args.slug):
|
|
1102
|
+
raise SystemExit(f"invalid slug {args.slug!r}: use lowercase kebab-case")
|
|
1103
|
+
root = reject_unsafe_root(Path(args.root))
|
|
1104
|
+
_ensure_scratch_gitignore(root)
|
|
1105
|
+
gdir = ensure_contained(root / ".scratch" / "self-grill" / args.slug, root)
|
|
1106
|
+
state_path = gdir / "grill.json"
|
|
1107
|
+
existing_answers: dict[str, dict] = {}
|
|
1108
|
+
if state_path.exists():
|
|
1109
|
+
if args.refresh:
|
|
1110
|
+
old_data = json.loads(state_path.read_text(encoding="utf-8"))
|
|
1111
|
+
for q in old_data.get("questions", []):
|
|
1112
|
+
if q.get("category") in ("plan", "hardcore") and q.get("trigger") == "always-plan" and q.get("status") != "open":
|
|
1113
|
+
existing_answers[q["id"]] = q
|
|
1114
|
+
elif not args.force:
|
|
1115
|
+
raise SystemExit(f"self-grill session already exists at {gdir}; pass --refresh or --force")
|
|
1116
|
+
|
|
1117
|
+
diff_info = inspect_diff(root, base=args.base, staged=args.staged, explicit_files=args.files)
|
|
1118
|
+
questions = build_questions(
|
|
1119
|
+
phase=args.phase,
|
|
1120
|
+
files=diff_info["files"],
|
|
1121
|
+
total_lines=diff_info["total_lines"],
|
|
1122
|
+
file_count=diff_info["file_count"],
|
|
1123
|
+
sensitive_paths=diff_info["sensitive_paths"],
|
|
1124
|
+
code_paths=diff_info["code_paths"],
|
|
1125
|
+
test_paths=diff_info["test_paths"],
|
|
1126
|
+
shell_paths=diff_info["shell_paths"],
|
|
1127
|
+
schema_paths=diff_info["schema_paths"],
|
|
1128
|
+
skill_paths=diff_info["skill_paths"],
|
|
1129
|
+
added_comments=diff_info["added_comments"],
|
|
1130
|
+
workaround_smells=diff_info["workaround_smells"],
|
|
1131
|
+
toy_shortcuts=diff_info["toy_shortcuts"],
|
|
1132
|
+
added_comment_total=diff_info["added_comment_count"],
|
|
1133
|
+
workaround_smell_total=diff_info["workaround_smell_count"],
|
|
1134
|
+
toy_shortcut_total=diff_info["toy_shortcut_count"],
|
|
1135
|
+
backend_perf_findings=diff_info["backend_perf_findings"],
|
|
1136
|
+
proof_paths=diff_info["proof_paths"],
|
|
1137
|
+
proof_escapes=diff_info["proof_escapes"],
|
|
1138
|
+
reward_hacks=diff_info["reward_hacks"],
|
|
1139
|
+
)
|
|
1140
|
+
for q in questions:
|
|
1141
|
+
if q["id"] in existing_answers:
|
|
1142
|
+
prev = existing_answers[q["id"]]
|
|
1143
|
+
q["status"] = prev["status"]
|
|
1144
|
+
q["answer"] = prev["answer"]
|
|
1145
|
+
q["receipt"] = prev["receipt"]
|
|
1146
|
+
|
|
1147
|
+
payload = {
|
|
1148
|
+
"slug": args.slug,
|
|
1149
|
+
"phase": args.phase,
|
|
1150
|
+
"root": str(root),
|
|
1151
|
+
"head_sha": diff_info["head_sha"],
|
|
1152
|
+
"tree_digest": diff_info["tree_digest"],
|
|
1153
|
+
"base": diff_info["base"],
|
|
1154
|
+
"staged": args.staged,
|
|
1155
|
+
"measured_size": diff_info["measured_size"],
|
|
1156
|
+
"file_count": diff_info["file_count"],
|
|
1157
|
+
"total_lines": diff_info["total_lines"],
|
|
1158
|
+
"sensitive_paths": diff_info["sensitive_paths"],
|
|
1159
|
+
"toy_shortcuts": diff_info["toy_shortcuts"],
|
|
1160
|
+
"reward_hacks": diff_info["reward_hacks"],
|
|
1161
|
+
"recommend_cross_family_skeptic": diff_info["recommend_cross_family_skeptic"],
|
|
1162
|
+
"questions": questions,
|
|
1163
|
+
}
|
|
1164
|
+
atomic_write_text(state_path, json.dumps(payload, indent=2) + "\n", root)
|
|
1165
|
+
out = {"dir": str(gdir), "state": str(state_path), **payload}
|
|
1166
|
+
if args.json:
|
|
1167
|
+
print(json.dumps(out, indent=2))
|
|
1168
|
+
else:
|
|
1169
|
+
print(f"initialized {gdir} ({len(questions)} questions, size={payload['measured_size']})")
|
|
1170
|
+
return 0
|
|
1171
|
+
|
|
1172
|
+
|
|
1173
|
+
def _load_state(gdir: Path) -> tuple[Path, Path, dict]:
|
|
1174
|
+
state_path = gdir / "grill.json"
|
|
1175
|
+
if not state_path.is_file():
|
|
1176
|
+
raise SystemExit(f"missing grill.json in {gdir}")
|
|
1177
|
+
data = json.loads(state_path.read_text(encoding="utf-8"))
|
|
1178
|
+
root = reject_unsafe_root(Path(data["root"]))
|
|
1179
|
+
ensure_contained(state_path, root)
|
|
1180
|
+
return root, state_path, data
|
|
1181
|
+
|
|
1182
|
+
|
|
1183
|
+
def cmd_answer(args: argparse.Namespace) -> int:
|
|
1184
|
+
gdir = Path(args.dir)
|
|
1185
|
+
root, state_path, data = _load_state(gdir)
|
|
1186
|
+
answer_text = args.answer.strip()
|
|
1187
|
+
receipt_text = (args.receipt or "").strip()
|
|
1188
|
+
if not answer_text:
|
|
1189
|
+
raise SystemExit("--answer cannot be empty")
|
|
1190
|
+
if args.status == "proven":
|
|
1191
|
+
if not receipt_text or not is_valid_receipt(receipt_text, root):
|
|
1192
|
+
raise SystemExit(
|
|
1193
|
+
"status 'proven' requires a verified --receipt (existing repo file:line, 'cmd:<cmd> -> exit 0', or URL)"
|
|
1194
|
+
)
|
|
1195
|
+
if args.status == "na" and len(answer_text) < 8:
|
|
1196
|
+
raise SystemExit("status 'na' requires a concrete reason in --answer")
|
|
1197
|
+
|
|
1198
|
+
matched = None
|
|
1199
|
+
for q in data["questions"]:
|
|
1200
|
+
if q["id"] == args.id:
|
|
1201
|
+
q["status"] = args.status
|
|
1202
|
+
q["answer"] = answer_text
|
|
1203
|
+
q["receipt"] = receipt_text
|
|
1204
|
+
matched = q
|
|
1205
|
+
break
|
|
1206
|
+
if matched is None:
|
|
1207
|
+
raise SystemExit(f"unknown question id {args.id!r}")
|
|
1208
|
+
|
|
1209
|
+
atomic_write_text(state_path, json.dumps(data, indent=2) + "\n", root)
|
|
1210
|
+
if args.json:
|
|
1211
|
+
print(json.dumps(matched, indent=2))
|
|
1212
|
+
else:
|
|
1213
|
+
print(f"recorded {matched['id']} -> {matched['status']}")
|
|
1214
|
+
return 0
|
|
1215
|
+
|
|
1216
|
+
|
|
1217
|
+
def evaluate_verdict(data: dict, root: Path | None = None, allow_stale: bool = False) -> dict:
|
|
1218
|
+
blocked = [q["id"] for q in data["questions"] if q["status"] == "blocked"]
|
|
1219
|
+
failed = [q["id"] for q in data["questions"] if q["status"] == "failed"]
|
|
1220
|
+
open_critical = [
|
|
1221
|
+
q["id"]
|
|
1222
|
+
for q in data["questions"]
|
|
1223
|
+
if q["severity"] == "critical" and q["status"] not in ("proven", "na")
|
|
1224
|
+
]
|
|
1225
|
+
missing_receipts = [
|
|
1226
|
+
q["id"]
|
|
1227
|
+
for q in data["questions"]
|
|
1228
|
+
if q["status"] == "proven" and not is_valid_receipt(q.get("receipt", ""), root)
|
|
1229
|
+
]
|
|
1230
|
+
open_advisory = [
|
|
1231
|
+
q["id"]
|
|
1232
|
+
for q in data["questions"]
|
|
1233
|
+
if q["severity"] != "critical" and q["status"] == "open"
|
|
1234
|
+
]
|
|
1235
|
+
stale_tree = False
|
|
1236
|
+
recorded_digest = data.get("tree_digest", "")
|
|
1237
|
+
live_digest = ""
|
|
1238
|
+
if root is not None and recorded_digest and data.get("phase") in ("checks", "both") and not allow_stale:
|
|
1239
|
+
if _is_git_root_or_worktree(root):
|
|
1240
|
+
live_digest = compute_tree_digest(root)
|
|
1241
|
+
if live_digest != recorded_digest:
|
|
1242
|
+
stale_tree = True
|
|
1243
|
+
|
|
1244
|
+
if blocked:
|
|
1245
|
+
verdict = "BLOCKED"
|
|
1246
|
+
elif failed or open_critical or missing_receipts or stale_tree:
|
|
1247
|
+
verdict = "NEEDS_WORK"
|
|
1248
|
+
else:
|
|
1249
|
+
verdict = "PASS"
|
|
1250
|
+
|
|
1251
|
+
return {
|
|
1252
|
+
"verdict": verdict,
|
|
1253
|
+
"slug": data["slug"],
|
|
1254
|
+
"phase": data["phase"],
|
|
1255
|
+
"head_sha": data.get("head_sha"),
|
|
1256
|
+
"tree_digest": recorded_digest,
|
|
1257
|
+
"live_tree_digest": live_digest or recorded_digest,
|
|
1258
|
+
"stale_tree": stale_tree,
|
|
1259
|
+
"measured_size": data.get("measured_size"),
|
|
1260
|
+
"total_questions": len(data["questions"]),
|
|
1261
|
+
"open_critical": open_critical,
|
|
1262
|
+
"failed": failed,
|
|
1263
|
+
"blocked": blocked,
|
|
1264
|
+
"missing_receipts": missing_receipts,
|
|
1265
|
+
"open_advisory": open_advisory,
|
|
1266
|
+
"recommend_cross_family_skeptic": data.get("recommend_cross_family_skeptic", False),
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
|
|
1270
|
+
def cmd_verdict(args: argparse.Namespace) -> int:
|
|
1271
|
+
root, _, data = _load_state(Path(args.dir))
|
|
1272
|
+
summary = evaluate_verdict(data, root=root, allow_stale=args.allow_stale)
|
|
1273
|
+
if summary["verdict"] == "PASS":
|
|
1274
|
+
latest_path = ensure_contained(root / ".scratch" / "self-grill" / "latest-pass.json", root)
|
|
1275
|
+
atomic_write_text(
|
|
1276
|
+
latest_path,
|
|
1277
|
+
json.dumps(
|
|
1278
|
+
{
|
|
1279
|
+
"status": "PASS",
|
|
1280
|
+
"slug": summary["slug"],
|
|
1281
|
+
"head_sha": summary["head_sha"],
|
|
1282
|
+
"tree_digest": summary["live_tree_digest"],
|
|
1283
|
+
},
|
|
1284
|
+
indent=2,
|
|
1285
|
+
)
|
|
1286
|
+
+ "\n",
|
|
1287
|
+
root,
|
|
1288
|
+
)
|
|
1289
|
+
if args.json:
|
|
1290
|
+
print(json.dumps(summary, indent=2))
|
|
1291
|
+
else:
|
|
1292
|
+
print(
|
|
1293
|
+
f"self-grill: {summary['verdict']} (phase={summary['phase']}, "
|
|
1294
|
+
f"open_critical={len(summary['open_critical'])}, failed={len(summary['failed'])}, "
|
|
1295
|
+
f"blocked={len(summary['blocked'])}, stale_tree={summary['stale_tree']})"
|
|
1296
|
+
)
|
|
1297
|
+
if args.strict and summary["verdict"] != "PASS":
|
|
1298
|
+
return 2
|
|
1299
|
+
return 0
|
|
1300
|
+
|
|
1301
|
+
|
|
1302
|
+
def build_prosecutor_bundle(
|
|
1303
|
+
root: Path,
|
|
1304
|
+
slug: str = "prosecutor",
|
|
1305
|
+
claims_text: str = "",
|
|
1306
|
+
confession_text: str = "",
|
|
1307
|
+
base: str | None = None,
|
|
1308
|
+
explicit_files: list[str] | None = None,
|
|
1309
|
+
) -> dict:
|
|
1310
|
+
safe_root = reject_unsafe_root(root)
|
|
1311
|
+
if not SLUG_RE.fullmatch(slug):
|
|
1312
|
+
raise SystemExit(f"invalid slug {slug!r}: use lowercase kebab-case")
|
|
1313
|
+
_ensure_scratch_gitignore(safe_root)
|
|
1314
|
+
diff_info = inspect_diff(safe_root, base=base, explicit_files=explicit_files)
|
|
1315
|
+
out_dir = ensure_contained(safe_root / ".scratch" / "self-grill" / slug, safe_root)
|
|
1316
|
+
out_dir.mkdir(parents=True, exist_ok=True)
|
|
1317
|
+
|
|
1318
|
+
claim_warnings = [m.group(0) for m in CLAIM_OVERCLAIM_RE.finditer(claims_text)] if claims_text else []
|
|
1319
|
+
sections: list[str] = [
|
|
1320
|
+
"# Adaptive Hotspot Prosecutor Bundle",
|
|
1321
|
+
f"- Project root: `{safe_root}`",
|
|
1322
|
+
f"- Measured diff size: `{diff_info['measured_size']}` ({diff_info['file_count']} files, +{diff_info['lines_added']}/-{diff_info['lines_deleted']} lines)",
|
|
1323
|
+
f"- Tree digest: `{diff_info['tree_digest']}`",
|
|
1324
|
+
f"- Sensitive paths: `{diff_info['sensitive_paths']}`",
|
|
1325
|
+
f"- Mechanical flags: comments={diff_info['added_comment_count']}, workaround_smells={diff_info['workaround_smell_count']}, toy_shortcuts={diff_info['toy_shortcut_count']}, reward_hacks={diff_info['reward_hack_count']}",
|
|
1326
|
+
]
|
|
1327
|
+
if claims_text.strip():
|
|
1328
|
+
sections.append("\n## Draft Claims Under Audit\n" + claims_text.strip())
|
|
1329
|
+
if claim_warnings:
|
|
1330
|
+
sections.append(f"\nMechanical universal-claim triggers to verify strictly: {claim_warnings}")
|
|
1331
|
+
if confession_text.strip():
|
|
1332
|
+
sections.append("\n## Part B1 — Builder Confession (Known Shortcuts & Risks)\n" + confession_text.strip())
|
|
1333
|
+
|
|
1334
|
+
sensitive_set = set(diff_info.get("sensitive_paths") or [])
|
|
1335
|
+
flagged_set = {
|
|
1336
|
+
x["path"]
|
|
1337
|
+
for bucket in ("workaround_smells", "toy_shortcuts", "added_comments")
|
|
1338
|
+
for x in (diff_info.get(bucket) or [])
|
|
1339
|
+
if "path" in x
|
|
1340
|
+
} | {x["file"] for x in (diff_info.get("backend_perf_findings") or []) if "file" in x} | {
|
|
1341
|
+
x["file"] for x in (diff_info.get("proof_escapes") or []) if "file" in x
|
|
1342
|
+
} | {
|
|
1343
|
+
x["file"] for x in (diff_info.get("reward_hacks") or []) if "file" in x
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
def _bundle_priority(rel: str) -> tuple[int, int, int, int, str]:
|
|
1347
|
+
ext = Path(rel).suffix.lower()
|
|
1348
|
+
is_code = int((ext in CODE_EXTS or ext in PROOF_EXTS) and not TEST_PATH_RE.search(rel))
|
|
1349
|
+
is_sens = int(rel in sensitive_set)
|
|
1350
|
+
is_flag = int(rel in flagged_set)
|
|
1351
|
+
line_cnt = _count_file_lines(safe_root / rel)
|
|
1352
|
+
return (-is_sens, -is_flag, -is_code, -line_cnt, rel)
|
|
1353
|
+
|
|
1354
|
+
ranked_files = sorted(diff_info["files"], key=_bundle_priority)
|
|
1355
|
+
selected_files = ranked_files[:25]
|
|
1356
|
+
omitted_files = ranked_files[25:]
|
|
1357
|
+
if omitted_files:
|
|
1358
|
+
sections.append(
|
|
1359
|
+
f"- Additional changed files outside top-25 bundle ({len(omitted_files)} — read directly if relevant): `{omitted_files[:30]}`"
|
|
1360
|
+
)
|
|
1361
|
+
|
|
1362
|
+
for rel in selected_files:
|
|
1363
|
+
target = safe_root / rel
|
|
1364
|
+
if not target.is_file() or target.is_symlink():
|
|
1365
|
+
continue
|
|
1366
|
+
try:
|
|
1367
|
+
lines = target.read_text(encoding="utf-8", errors="replace").splitlines()
|
|
1368
|
+
except OSError:
|
|
1369
|
+
continue
|
|
1370
|
+
max_whole_lines = 900 if Path(rel).suffix.lower() in PROOF_EXTS else 450
|
|
1371
|
+
if len(lines) <= max_whole_lines:
|
|
1372
|
+
numbered = "\n".join(f"{idx}: {line}" for idx, line in enumerate(lines, 1))
|
|
1373
|
+
sections.append(f"\n==================== FILE: {rel} ({len(lines)} lines) ====================\n{numbered}")
|
|
1374
|
+
else:
|
|
1375
|
+
patch_list = _collect_diff_patches(safe_root, [rel], diff_info["base"], False, diff_info["head_sha"]) if diff_info["in_git"] else []
|
|
1376
|
+
patch_preview = "\n".join(patch_list)[:18000].strip()
|
|
1377
|
+
if patch_preview:
|
|
1378
|
+
sections.append(
|
|
1379
|
+
f"\n==================== FILE (HUNK WINDOW, {len(lines)} total lines — read full ranges if needed): {rel} ====================\n{patch_preview}"
|
|
1380
|
+
)
|
|
1381
|
+
else:
|
|
1382
|
+
head_part = "\n".join(f"{idx}: {line}" for idx, line in enumerate(lines[:220], 1))
|
|
1383
|
+
tail_start = max(221, len(lines) - 119)
|
|
1384
|
+
tail_part = "\n".join(f"{idx}: {line}" for idx, line in enumerate(lines[tail_start - 1:], tail_start))
|
|
1385
|
+
window_preview = f"{head_part}\n... [{tail_start - 221} lines elided; read {rel}:221-{tail_start - 1} on disk] ...\n{tail_part}"
|
|
1386
|
+
sections.append(
|
|
1387
|
+
f"\n==================== FILE (UNTRACKED WINDOW, {len(lines)} total lines — read elided middle if needed): {rel} ====================\n{window_preview}"
|
|
1388
|
+
)
|
|
1389
|
+
prosecutor_prompt = (
|
|
1390
|
+
f"Read ONLY `{out_dir / 'prosecutor-bundle.md'}` first (read additional ranges in `{safe_root}` only for `[HUNK WINDOW]` files).\n"
|
|
1391
|
+
"Run the 3-step Adaptive Hotspot Prosecutor + Independent Sieve in a SINGLE pass:\n"
|
|
1392
|
+
"1. Adaptive Hotspot Map (5 lines): weight ~75% of probes on the highest-complexity code/regex/state/concurrency/security modules in the bundle and ~25% on Draft Claims & Docs vs literal code.\n"
|
|
1393
|
+
"2. Exhaustive Divergent Hunt: push past surface checks to brainstorm 50+ concrete candidate bugs, Goodhart reward hacks (weakened thresholds/tests, skipped references, procedural box/cone stand-ins, unverified provenance), false positives, false negatives, edge cases, and overclaims (do NOT filter early).\n"
|
|
1394
|
+
"3. Independent Prosecutor Sieve: keep ONLY 100% code-provable P0/P1/P2 Gaps, Reward Hacks, and text-vs-code Overclaims with exact `<file>:<line>`, concrete trigger input, and root-cause fix. Drop hypothetical '$90 trillion' filler."
|
|
1395
|
+
)
|
|
1396
|
+
bundle_path = out_dir / "prosecutor-bundle.md"
|
|
1397
|
+
atomic_write_text(bundle_path, "\n".join(sections) + "\n", safe_root)
|
|
1398
|
+
return {
|
|
1399
|
+
"bundle_path": str(bundle_path),
|
|
1400
|
+
"measured_size": diff_info["measured_size"],
|
|
1401
|
+
"file_count": diff_info["file_count"],
|
|
1402
|
+
"tree_digest": diff_info["tree_digest"],
|
|
1403
|
+
"claim_warnings": claim_warnings,
|
|
1404
|
+
"prosecutor_prompt": prosecutor_prompt,
|
|
1405
|
+
}
|
|
1406
|
+
|
|
1407
|
+
|
|
1408
|
+
BLIND_ROLES = ("verifier", "judge")
|
|
1409
|
+
THINKING_WORDS = r"thinking|think|thoughts?|reasoning|scratch_?pad|reflection|chain_of_thought|cot|inner_monologue|monologue"
|
|
1410
|
+
THINKING_TAG_RE = re.compile(rf"<\s*(?P<close>/)?\s*(?:antml:)?(?:{THINKING_WORDS})\b(?P<attrs>[^<>]*)>")
|
|
1411
|
+
THINKING_FENCE_INFO_RE = re.compile(rf"\b(?:{THINKING_WORDS}|analysis|rationale)\b")
|
|
1412
|
+
FENCE_RE = re.compile(r"^[ \t>]*(?P<fence>`{3,}|~{3,})(?P<info>.*)$")
|
|
1413
|
+
HEADING_RE = re.compile(r"^[ \t>]*(?P<hashes>#{1,6})[ \t]*(?P<rest>.*)$")
|
|
1414
|
+
LABEL_WORDS = (
|
|
1415
|
+
r"(?:my\s+)?(?:reasoning|thinking|thoughts?|thought\s+process|chain[\s-]of[\s-]thought|scratch_?pad"
|
|
1416
|
+
r"|reflection|internal\s+monologue|self[\s-]assessment|confidence|confession)"
|
|
1417
|
+
)
|
|
1418
|
+
LABEL_HEADING_RE = re.compile(rf"^[\s*_]*{LABEL_WORDS}\b")
|
|
1419
|
+
LABEL_LINE_RE = re.compile(rf"^[\s>*_-]*(?:\d+[.)]\s*)?{LABEL_WORDS}\b[\s*_]*(?::[\s*_]*(?P<rest>.*))?$")
|
|
1420
|
+
RECEIPT_KEY_RE = re.compile(
|
|
1421
|
+
r"[\"']?(?:checks_ran|files_touched|contract_changes|open_risks)[\"']?\s*:"
|
|
1422
|
+
r"|[\"']?status[\"']?\s*[:=]\s*[\"']?(?:done|blocked|needs_contract_change)\b"
|
|
1423
|
+
)
|
|
1424
|
+
RECEIPT_WORDS_RE = re.compile(r"worker\s+receipt")
|
|
1425
|
+
STANDALONE_SIGNAL_RE = re.compile(r"^\W*(?:pass(?:ed)?|ok|success(?:ful)?|succeeded|done|green|all\s+green)\W*$")
|
|
1426
|
+
SHELL_INFO_RE = re.compile(r"^(?:bash|sh|shell|zsh|console|terminal|shell-session|powershell|pwsh|ps1|cmd|bat)\b")
|
|
1427
|
+
PROMPT_RE = re.compile(r"^\s*(?:\$|PS[^>\n]*>)\s+(?P<cmd>\S.*)$")
|
|
1428
|
+
|
|
1429
|
+
_SUBJECT = r"(?:tests?|test\s+suites?|suites?|checks?|specs?|builds?|lint(?:ers?|ing)?|ci|type\s*check(?:s|ing)?|assertions?|e2e)"
|
|
1430
|
+
_QUALIFIER = r"(?:(?:the|my|our|new|existing|relevant|local|unit|integration|all|these|those)\s+)*"
|
|
1431
|
+
_FILLER = r"(?:(?:are|is|were|was|have|has|had|been|now|all|still|also|both)\s+)*"
|
|
1432
|
+
_FIRST_PERSON_ADVERB = r"(?:\s+(?:have|also|just|already|manually|then|successfully|personally|really|carefully))*"
|
|
1433
|
+
PHRASE_SIGNALS: tuple[tuple[str, re.Pattern], ...] = tuple(
|
|
1434
|
+
(kind, re.compile(pattern))
|
|
1435
|
+
for kind, pattern in (
|
|
1436
|
+
("pass-claim", rf"\b{_QUALIFIER}{_SUBJECT}\s+{_FILLER}(?:pass(?:es|ed|ing)?|green|succeed(?:s|ed)?|ok|okay)\b"),
|
|
1437
|
+
(
|
|
1438
|
+
"pass-claim",
|
|
1439
|
+
r"\b(?:everything|it|this|that)\s+(?:now\s+)?(?:passes|passed|works|worked|is\s+(?:green|passing|working|fixed|done|complete(?:d)?))\b"
|
|
1440
|
+
r"|\b(?:all|they|these|those)\s+(?:now\s+)?(?:pass|passes|passed|are\s+(?:green|passing|working|fixed|done))\b",
|
|
1441
|
+
),
|
|
1442
|
+
(
|
|
1443
|
+
"pass-claim",
|
|
1444
|
+
r"\b(?:verdict|results?|status|outcome|conclusion)\s*[:=]\s*[\"'`*_ ]*(?:pass(?:ed)?|ok|success(?:ful)?|done|green|complete[d]?|fixed|good)\b",
|
|
1445
|
+
),
|
|
1446
|
+
("pass-claim", r"\b\d+\s+(?:tests?\s+|specs?\s+|checks?\s+|assertions?\s+)?(?:passed|passing|failed|failing)\b|\b0\s+(?:failures?|errors?|failed)\b|\bok\s*\(\d+\s+tests?\)|\bran\s+\d+\s+tests?\b"),
|
|
1447
|
+
(
|
|
1448
|
+
"pass-claim",
|
|
1449
|
+
r"\b(?:completed?|finished|implemented|fixed|resolved|built|verified|passed)\s+successfully\b"
|
|
1450
|
+
r"|\bsuccessfully\s+(?:completed?|finished|implemented|fixed|resolved|built|verified|passed|ran|run)\b"
|
|
1451
|
+
"|[\u2705\u2714\u2713\u2611]",
|
|
1452
|
+
),
|
|
1453
|
+
(
|
|
1454
|
+
"exit-code-claim",
|
|
1455
|
+
r"\bexited\s+(?:with\s+)?(?:(?:code|status)\s+)?\d+\b|\bexit\s+(?:code|status)\s*(?:is|was|of|=|:)?\s*\d+\b"
|
|
1456
|
+
r"|(?:->|=>|\u2192|\u2014|\u2013|--|\(|:)\s*exit\s+\d+\b|\breturned\s+(?:exit\s+(?:code|status)\s+)?0\b"
|
|
1457
|
+
r"|\brc\s*[:=]\s*\d+\b|\bexit_code[\"']?\s*[:=]\s*\d+",
|
|
1458
|
+
),
|
|
1459
|
+
(
|
|
1460
|
+
"verification-narration",
|
|
1461
|
+
rf"\b(?:i|we){_FIRST_PERSON_ADVERB}\s+(?:verified|validated|confirmed|tested|checked|ran|reproduced|proved|proven|ensured|inspected|exercised|smoke[- ]tested)\b"
|
|
1462
|
+
rf"|\b(?:i|we)(?:'ve|\s+have){_FIRST_PERSON_ADVERB}\s+(?:verified|validated|confirmed|tested|checked|run|reproduced|proved|proven|ensured|inspected|exercised)\b"
|
|
1463
|
+
r"|\b(?:was|were|been|is|are)\s+(?:successfully\s+)?(?:verified|validated|confirmed|tested)\b",
|
|
1464
|
+
),
|
|
1465
|
+
(
|
|
1466
|
+
"confidence-claim",
|
|
1467
|
+
r"\bi(?:\s+am|'m)\s+(?:\w+\s+)?(?:confident|certain|sure|convinced)\b"
|
|
1468
|
+
r"|\b(?:confident|certain|convinced)\s+(?:that\s+)?(?:it|this|the|everything|we|all|these)\b"
|
|
1469
|
+
r"|\bhigh[- ]confidence\b|\bconfidence(?:\s+level)?\s*[:=]|\b\d{1,3}\s*%\s*(?:confident|sure|certain|confidence)"
|
|
1470
|
+
r"|\b(?:definitely|certainly|obviously|clearly)\s+(?:works|correct|fixed|done|passes|right)\b"
|
|
1471
|
+
r"|\b(?:no|zero)\s+(?:issues|problems|regressions|failures|bugs)\s+(?:found|remain|remaining|detected|observed)\b"
|
|
1472
|
+
r"|\blgtm\b|\bfully\s+(?:working|verified|tested|fixed|done|complete|green)\b"
|
|
1473
|
+
r"|\b(?:works|working)\s+(?:as\s+expected|correctly|perfectly|fine|properly)\b"
|
|
1474
|
+
r"|\ball\s+(?:acceptance\s+)?(?:criteria|requirements)\s+(?:are\s+|have\s+been\s+)?(?:met|satisfied|passing|passed|done)\b",
|
|
1475
|
+
),
|
|
1476
|
+
)
|
|
1477
|
+
)
|
|
1478
|
+
_HOMOGLYPHS = str.maketrans(
|
|
1479
|
+
{
|
|
1480
|
+
"\u0430": "a", "\u0435": "e", "\u043e": "o", "\u0440": "p", "\u0441": "c", "\u0445": "x", "\u0443": "y",
|
|
1481
|
+
"\u0456": "i", "\u0455": "s", "\u0458": "j", "\u0501": "d", "\u03bf": "o", "\u03b1": "a", "\u03bd": "v",
|
|
1482
|
+
"\u03c1": "p", "\u2019": "'", "\u2018": "'", "\u201c": '"', "\u201d": '"',
|
|
1483
|
+
}
|
|
1484
|
+
)
|
|
1485
|
+
_LINE_BREAKS_RE = re.compile(r"\r\n|[\r\x0b\x0c\x85\u2028\u2029]")
|
|
1486
|
+
|
|
1487
|
+
|
|
1488
|
+
@functools.lru_cache(maxsize=8192)
|
|
1489
|
+
def _fold_char(ch: str) -> str:
|
|
1490
|
+
if ch in "\n\t":
|
|
1491
|
+
return ch
|
|
1492
|
+
kept = []
|
|
1493
|
+
for piece in unicodedata.normalize("NFKD", ch):
|
|
1494
|
+
if unicodedata.category(piece) in ("Mn", "Me", "Cf", "Cc", "Cs"):
|
|
1495
|
+
continue
|
|
1496
|
+
kept.append(piece.casefold().translate(_HOMOGLYPHS))
|
|
1497
|
+
return "".join(kept)
|
|
1498
|
+
|
|
1499
|
+
|
|
1500
|
+
def _fold(text: str) -> tuple[str, list[int]]:
|
|
1501
|
+
folded: list[str] = []
|
|
1502
|
+
origin: list[int] = []
|
|
1503
|
+
for index, ch in enumerate(text):
|
|
1504
|
+
piece = _fold_char(ch)
|
|
1505
|
+
for c in piece:
|
|
1506
|
+
folded.append(c)
|
|
1507
|
+
origin.append(index)
|
|
1508
|
+
return "".join(folded), origin
|
|
1509
|
+
|
|
1510
|
+
|
|
1511
|
+
def _collapse(text: str) -> tuple[str, list[int]]:
|
|
1512
|
+
folded, origin = _fold(text)
|
|
1513
|
+
out: list[str] = []
|
|
1514
|
+
positions: list[int] = []
|
|
1515
|
+
previous_space = False
|
|
1516
|
+
for index, ch in enumerate(folded):
|
|
1517
|
+
if ch.isspace():
|
|
1518
|
+
if previous_space:
|
|
1519
|
+
continue
|
|
1520
|
+
out.append(" ")
|
|
1521
|
+
previous_space = True
|
|
1522
|
+
else:
|
|
1523
|
+
out.append(ch)
|
|
1524
|
+
previous_space = False
|
|
1525
|
+
positions.append(origin[index])
|
|
1526
|
+
return "".join(out), positions
|
|
1527
|
+
|
|
1528
|
+
|
|
1529
|
+
def _delete_spans(text: str, origin: list[int], spans: list[tuple[int, int]]) -> str:
|
|
1530
|
+
cuts = sorted(
|
|
1531
|
+
(origin[start], len(text) if end >= len(origin) else origin[end - 1] + 1) for start, end in spans if end > start
|
|
1532
|
+
)
|
|
1533
|
+
if not cuts:
|
|
1534
|
+
return text
|
|
1535
|
+
out: list[str] = []
|
|
1536
|
+
cursor = 0
|
|
1537
|
+
for start, end in cuts:
|
|
1538
|
+
if start > cursor:
|
|
1539
|
+
out.append(text[cursor:start])
|
|
1540
|
+
cursor = max(cursor, end)
|
|
1541
|
+
out.append(text[cursor:])
|
|
1542
|
+
return "".join(out)
|
|
1543
|
+
|
|
1544
|
+
|
|
1545
|
+
def _find_fence_close(folded_lines: list[str], opener: int, fence: str) -> int:
|
|
1546
|
+
for index in range(opener + 1, len(folded_lines)):
|
|
1547
|
+
match = FENCE_RE.match(folded_lines[index])
|
|
1548
|
+
if match and match["fence"][0] == fence[0] and len(match["fence"]) >= len(fence) and not match["info"].strip():
|
|
1549
|
+
return index
|
|
1550
|
+
return len(folded_lines)
|
|
1551
|
+
|
|
1552
|
+
|
|
1553
|
+
def _drop_tagged_thinking(text: str) -> str:
|
|
1554
|
+
folded, origin = _fold(text)
|
|
1555
|
+
spans: list[tuple[int, int]] = []
|
|
1556
|
+
depth = 0
|
|
1557
|
+
start = 0
|
|
1558
|
+
for match in THINKING_TAG_RE.finditer(folded):
|
|
1559
|
+
closing = bool(match["close"])
|
|
1560
|
+
if not closing and match["attrs"].rstrip().endswith("/"):
|
|
1561
|
+
continue
|
|
1562
|
+
if not closing:
|
|
1563
|
+
if depth == 0:
|
|
1564
|
+
start = match.start()
|
|
1565
|
+
depth += 1
|
|
1566
|
+
elif depth > 0:
|
|
1567
|
+
depth -= 1
|
|
1568
|
+
if depth == 0:
|
|
1569
|
+
spans.append((start, match.end()))
|
|
1570
|
+
else:
|
|
1571
|
+
paragraph = folded.rfind("\n\n", 0, match.start())
|
|
1572
|
+
spans.append((paragraph + 2 if paragraph >= 0 else 0, match.end()))
|
|
1573
|
+
if depth > 0:
|
|
1574
|
+
spans.append((start, len(folded)))
|
|
1575
|
+
return _delete_spans(text, origin, spans)
|
|
1576
|
+
|
|
1577
|
+
|
|
1578
|
+
def _drop_thinking_fences(text: str) -> str:
|
|
1579
|
+
lines = text.split("\n")
|
|
1580
|
+
folded = [_fold(line)[0] for line in lines]
|
|
1581
|
+
keep = [True] * len(lines)
|
|
1582
|
+
index = 0
|
|
1583
|
+
while index < len(lines):
|
|
1584
|
+
match = FENCE_RE.match(folded[index])
|
|
1585
|
+
if match and THINKING_FENCE_INFO_RE.search(match["info"]):
|
|
1586
|
+
close = _find_fence_close(folded, index, match["fence"])
|
|
1587
|
+
for dropped in range(index, min(close + 1, len(lines))):
|
|
1588
|
+
keep[dropped] = False
|
|
1589
|
+
index = close + 1
|
|
1590
|
+
else:
|
|
1591
|
+
index += 1
|
|
1592
|
+
return "\n".join(line for line, kept in zip(lines, keep) if kept)
|
|
1593
|
+
|
|
1594
|
+
|
|
1595
|
+
def _match_json_object_end(text: str, start: int) -> int | None:
|
|
1596
|
+
depth = 0
|
|
1597
|
+
in_string = False
|
|
1598
|
+
escaped = False
|
|
1599
|
+
for index in range(start, len(text)):
|
|
1600
|
+
ch = text[index]
|
|
1601
|
+
if in_string:
|
|
1602
|
+
in_string = not (ch == '"' and not escaped)
|
|
1603
|
+
escaped = ch == "\\" and not escaped
|
|
1604
|
+
continue
|
|
1605
|
+
if ch == '"':
|
|
1606
|
+
in_string = True
|
|
1607
|
+
continue
|
|
1608
|
+
if ch == "}" and depth == 1:
|
|
1609
|
+
return index + 1
|
|
1610
|
+
depth += (ch == "{") - (ch == "}")
|
|
1611
|
+
return None
|
|
1612
|
+
|
|
1613
|
+
|
|
1614
|
+
def _enclosing_json_object(text: str, position: int) -> tuple[int, int] | None:
|
|
1615
|
+
window = max(0, position - 20000)
|
|
1616
|
+
openers = [window + m.start() for m in re.finditer(r"\{", text[window:position])][-400:]
|
|
1617
|
+
for opener in openers:
|
|
1618
|
+
end = _match_json_object_end(text, opener)
|
|
1619
|
+
if end is not None and end > position:
|
|
1620
|
+
return opener, end
|
|
1621
|
+
return None
|
|
1622
|
+
|
|
1623
|
+
|
|
1624
|
+
def _receipt_commands(object_text: str) -> list[str]:
|
|
1625
|
+
try:
|
|
1626
|
+
payload = json.loads(object_text)
|
|
1627
|
+
except ValueError:
|
|
1628
|
+
return []
|
|
1629
|
+
ran = payload.get("checks_ran") if isinstance(payload, dict) else None
|
|
1630
|
+
if not isinstance(ran, list):
|
|
1631
|
+
return []
|
|
1632
|
+
found = []
|
|
1633
|
+
for item in ran:
|
|
1634
|
+
cmd = item.get("cmd") if isinstance(item, dict) else item
|
|
1635
|
+
if isinstance(cmd, str):
|
|
1636
|
+
found.append(cmd)
|
|
1637
|
+
return found
|
|
1638
|
+
|
|
1639
|
+
|
|
1640
|
+
def _drop_receipt_objects(text: str, commands: list[str]) -> str:
|
|
1641
|
+
while True:
|
|
1642
|
+
folded, origin = _fold(text)
|
|
1643
|
+
match = RECEIPT_KEY_RE.search(folded)
|
|
1644
|
+
if not match:
|
|
1645
|
+
return text
|
|
1646
|
+
position = origin[match.start()]
|
|
1647
|
+
enclosing = _enclosing_json_object(text, position)
|
|
1648
|
+
if enclosing is None:
|
|
1649
|
+
line_start = text.rfind("\n", 0, position) + 1
|
|
1650
|
+
line_end = text.find("\n", position)
|
|
1651
|
+
text = text[:line_start] + (text[line_end + 1 :] if line_end >= 0 else "")
|
|
1652
|
+
else:
|
|
1653
|
+
commands.extend(_receipt_commands(text[enclosing[0] : enclosing[1]]))
|
|
1654
|
+
text = text[: enclosing[0]] + text[enclosing[1] :]
|
|
1655
|
+
|
|
1656
|
+
|
|
1657
|
+
def _section_end(folded: list[str], start: int, level: int) -> int:
|
|
1658
|
+
open_fence: re.Match | None = None
|
|
1659
|
+
for index in range(start, len(folded)):
|
|
1660
|
+
fence = FENCE_RE.match(folded[index])
|
|
1661
|
+
if open_fence is not None:
|
|
1662
|
+
if fence and fence["fence"][0] == open_fence["fence"][0] and len(fence["fence"]) >= len(open_fence["fence"]) and not fence["info"].strip():
|
|
1663
|
+
open_fence = None
|
|
1664
|
+
continue
|
|
1665
|
+
if fence:
|
|
1666
|
+
open_fence = fence
|
|
1667
|
+
continue
|
|
1668
|
+
heading = HEADING_RE.match(folded[index])
|
|
1669
|
+
if heading and len(heading["hashes"]) <= level:
|
|
1670
|
+
return index
|
|
1671
|
+
return len(folded)
|
|
1672
|
+
|
|
1673
|
+
|
|
1674
|
+
def _paragraph_end(folded: list[str], start: int) -> int:
|
|
1675
|
+
for index in range(start, len(folded)):
|
|
1676
|
+
if not folded[index].strip():
|
|
1677
|
+
return index
|
|
1678
|
+
return len(folded)
|
|
1679
|
+
|
|
1680
|
+
|
|
1681
|
+
def _drop_reasoning_sections(text: str) -> str:
|
|
1682
|
+
lines = text.split("\n")
|
|
1683
|
+
folded = [_fold(line)[0] for line in lines]
|
|
1684
|
+
keep = [True] * len(lines)
|
|
1685
|
+
index = 0
|
|
1686
|
+
while index < len(lines):
|
|
1687
|
+
heading = HEADING_RE.match(folded[index])
|
|
1688
|
+
label = LABEL_LINE_RE.match(folded[index])
|
|
1689
|
+
if heading and LABEL_HEADING_RE.match(heading["rest"]):
|
|
1690
|
+
end = _section_end(folded, index + 1, len(heading["hashes"]))
|
|
1691
|
+
elif label and (label["rest"] or "").strip(" *_"):
|
|
1692
|
+
end = _paragraph_end(folded, index + 1)
|
|
1693
|
+
elif label:
|
|
1694
|
+
end = _section_end(folded, index + 1, 6)
|
|
1695
|
+
else:
|
|
1696
|
+
index += 1
|
|
1697
|
+
continue
|
|
1698
|
+
for dropped in range(index, end):
|
|
1699
|
+
keep[dropped] = False
|
|
1700
|
+
index = end
|
|
1701
|
+
return "\n".join(line for line, kept in zip(lines, keep) if kept)
|
|
1702
|
+
|
|
1703
|
+
|
|
1704
|
+
def _line_has_signal(folded_line: str) -> bool:
|
|
1705
|
+
collapsed = " ".join(folded_line.split())
|
|
1706
|
+
return bool(
|
|
1707
|
+
RECEIPT_KEY_RE.search(collapsed)
|
|
1708
|
+
or RECEIPT_WORDS_RE.search(collapsed)
|
|
1709
|
+
or STANDALONE_SIGNAL_RE.match(collapsed)
|
|
1710
|
+
or any(pattern.search(collapsed) for _, pattern in PHRASE_SIGNALS)
|
|
1711
|
+
)
|
|
1712
|
+
|
|
1713
|
+
|
|
1714
|
+
def _drop_signal_lines(text: str) -> str:
|
|
1715
|
+
return "\n".join(line for line in text.split("\n") if not _line_has_signal(_fold(line)[0]))
|
|
1716
|
+
|
|
1717
|
+
|
|
1718
|
+
def _strip_pipeline(text: str) -> tuple[str, list[str]]:
|
|
1719
|
+
receipt_commands: list[str] = []
|
|
1720
|
+
stripped = _LINE_BREAKS_RE.sub("\n", text)
|
|
1721
|
+
stripped = _drop_tagged_thinking(stripped)
|
|
1722
|
+
stripped = _drop_thinking_fences(stripped)
|
|
1723
|
+
stripped = _drop_receipt_objects(stripped, receipt_commands)
|
|
1724
|
+
stripped = _drop_reasoning_sections(stripped)
|
|
1725
|
+
return _drop_signal_lines(stripped), receipt_commands
|
|
1726
|
+
|
|
1727
|
+
|
|
1728
|
+
def strip_author_signals(text: str) -> str:
|
|
1729
|
+
return _strip_pipeline(text)[0]
|
|
1730
|
+
|
|
1731
|
+
|
|
1732
|
+
def _shell_block_commands(body: list[str]) -> list[str]:
|
|
1733
|
+
prompted = [m["cmd"] for m in map(PROMPT_RE.match, body) if m]
|
|
1734
|
+
if prompted:
|
|
1735
|
+
return prompted
|
|
1736
|
+
return [line.strip() for line in body if line.strip() and not line.lstrip().startswith(("#", "//", "REM "))]
|
|
1737
|
+
|
|
1738
|
+
|
|
1739
|
+
def _shell_commands(stripped: str) -> list[str]:
|
|
1740
|
+
lines = stripped.split("\n")
|
|
1741
|
+
folded = [_fold(line)[0] for line in lines]
|
|
1742
|
+
found: list[str] = []
|
|
1743
|
+
index = 0
|
|
1744
|
+
while index < len(lines):
|
|
1745
|
+
fence = FENCE_RE.match(folded[index])
|
|
1746
|
+
if fence:
|
|
1747
|
+
close = _find_fence_close(folded, index, fence["fence"])
|
|
1748
|
+
if SHELL_INFO_RE.match(fence["info"].strip()):
|
|
1749
|
+
found.extend(_shell_block_commands(lines[index + 1 : close]))
|
|
1750
|
+
index = close + 1
|
|
1751
|
+
continue
|
|
1752
|
+
prompt = PROMPT_RE.match(lines[index])
|
|
1753
|
+
if prompt:
|
|
1754
|
+
found.append(prompt["cmd"])
|
|
1755
|
+
index += 1
|
|
1756
|
+
return found
|
|
1757
|
+
|
|
1758
|
+
|
|
1759
|
+
def _is_plain_command(command: str) -> bool:
|
|
1760
|
+
return bool(command) and all(ch == "\t" or ord(ch) >= 32 and ord(ch) != 127 for ch in command)
|
|
1761
|
+
|
|
1762
|
+
|
|
1763
|
+
def extract_check_commands(transcript: str) -> list[str]:
|
|
1764
|
+
stripped, receipt_commands = _strip_pipeline(transcript)
|
|
1765
|
+
seen: set[str] = set()
|
|
1766
|
+
commands: list[str] = []
|
|
1767
|
+
for raw in [*receipt_commands, *_shell_commands(stripped)]:
|
|
1768
|
+
command = raw.strip()
|
|
1769
|
+
if command in seen or not _is_plain_command(command) or _line_has_signal(_fold(command)[0]):
|
|
1770
|
+
continue
|
|
1771
|
+
seen.add(command)
|
|
1772
|
+
commands.append(command)
|
|
1773
|
+
return commands
|
|
1774
|
+
|
|
1775
|
+
|
|
1776
|
+
def find_leaks(text: str) -> list[dict]:
|
|
1777
|
+
normalized = _LINE_BREAKS_RE.sub("\n", text)
|
|
1778
|
+
collapsed, positions = _collapse(normalized)
|
|
1779
|
+
leaks: list[dict] = []
|
|
1780
|
+
|
|
1781
|
+
def add_phrase(kind: str, match: re.Match) -> None:
|
|
1782
|
+
line = normalized.count("\n", 0, positions[match.start()]) + 1
|
|
1783
|
+
excerpt = collapsed[max(0, match.start() - 12) : match.end() + 12].strip()[:100]
|
|
1784
|
+
leaks.append({"kind": kind, "line": line, "excerpt": excerpt})
|
|
1785
|
+
|
|
1786
|
+
for pattern in (RECEIPT_KEY_RE, RECEIPT_WORDS_RE):
|
|
1787
|
+
for match in pattern.finditer(collapsed):
|
|
1788
|
+
add_phrase("worker-receipt", match)
|
|
1789
|
+
for match in THINKING_TAG_RE.finditer(collapsed):
|
|
1790
|
+
add_phrase("reasoning-marker", match)
|
|
1791
|
+
for kind, pattern in PHRASE_SIGNALS:
|
|
1792
|
+
for match in pattern.finditer(collapsed):
|
|
1793
|
+
add_phrase(kind, match)
|
|
1794
|
+
for number, folded_line in enumerate(_fold(normalized)[0].split("\n"), 1):
|
|
1795
|
+
line_text = " ".join(folded_line.split())
|
|
1796
|
+
fence = FENCE_RE.match(folded_line)
|
|
1797
|
+
heading = HEADING_RE.match(folded_line)
|
|
1798
|
+
if (
|
|
1799
|
+
(fence and THINKING_FENCE_INFO_RE.search(fence["info"]))
|
|
1800
|
+
or LABEL_LINE_RE.match(folded_line)
|
|
1801
|
+
or (heading and LABEL_HEADING_RE.match(heading["rest"]))
|
|
1802
|
+
):
|
|
1803
|
+
leaks.append({"kind": "reasoning-marker", "line": number, "excerpt": line_text[:100]})
|
|
1804
|
+
if STANDALONE_SIGNAL_RE.match(line_text):
|
|
1805
|
+
leaks.append({"kind": "pass-claim", "line": number, "excerpt": line_text[:100]})
|
|
1806
|
+
return leaks
|
|
1807
|
+
|
|
1808
|
+
|
|
1809
|
+
def assert_no_leaks(parts: dict[str, str]) -> None:
|
|
1810
|
+
problems: list[str] = []
|
|
1811
|
+
for name, text in parts.items():
|
|
1812
|
+
for leak in find_leaks(text):
|
|
1813
|
+
problems.append(f" - {name} line {leak['line']} [{leak['kind']}]: {leak['excerpt']!r}")
|
|
1814
|
+
if problems:
|
|
1815
|
+
raise SystemExit(
|
|
1816
|
+
"blind bundle refused: author signals leaked into the bundle (reword the spec or commands, "
|
|
1817
|
+
"or drop the offending input):\n" + "\n".join(problems)
|
|
1818
|
+
)
|
|
1819
|
+
|
|
1820
|
+
|
|
1821
|
+
def _sha256_hex(data: bytes) -> str:
|
|
1822
|
+
return hashlib.sha256(data).hexdigest()
|
|
1823
|
+
|
|
1824
|
+
|
|
1825
|
+
def _resolve_commit(root: Path, ref: str, label: str) -> str:
|
|
1826
|
+
if not ref or ref.startswith("-"):
|
|
1827
|
+
raise SystemExit(f"invalid {label} ref {ref!r}")
|
|
1828
|
+
result = _run_git(root, ["rev-parse", "--verify", "--quiet", f"{ref}^{{commit}}"])
|
|
1829
|
+
sha = result.stdout.strip()
|
|
1830
|
+
if result.returncode != 0 or not sha:
|
|
1831
|
+
raise SystemExit(f"cannot resolve {label} ref {ref!r} to a commit")
|
|
1832
|
+
return sha
|
|
1833
|
+
|
|
1834
|
+
|
|
1835
|
+
def _git_diff_bytes(root: Path, base_sha: str, head_sha: str) -> bytes:
|
|
1836
|
+
env = dict(os.environ)
|
|
1837
|
+
env["GIT_OPTIONAL_LOCKS"] = "0"
|
|
1838
|
+
try:
|
|
1839
|
+
result = subprocess.run(
|
|
1840
|
+
["git", "-c", "core.quotePath=false", "-C", str(root), "diff", "--no-color", "--no-ext-diff", "--no-textconv", base_sha, head_sha, "--"],
|
|
1841
|
+
capture_output=True,
|
|
1842
|
+
env=env,
|
|
1843
|
+
check=False,
|
|
1844
|
+
creationflags=NO_WINDOW,
|
|
1845
|
+
timeout=300,
|
|
1846
|
+
)
|
|
1847
|
+
except subprocess.TimeoutExpired as err:
|
|
1848
|
+
raise SystemExit(f"git diff {base_sha}..{head_sha} timed out after {err.timeout}s") from err
|
|
1849
|
+
if result.returncode != 0:
|
|
1850
|
+
raise SystemExit(f"git diff {base_sha}..{head_sha} failed: {result.stderr.decode('utf-8', 'replace').strip()}")
|
|
1851
|
+
return result.stdout
|
|
1852
|
+
|
|
1853
|
+
|
|
1854
|
+
def _ensure_trailing_newline(data: bytes) -> bytes:
|
|
1855
|
+
return data if data.endswith(b"\n") else data + b"\n"
|
|
1856
|
+
|
|
1857
|
+
|
|
1858
|
+
def build_blind_bundle(
|
|
1859
|
+
root: Path,
|
|
1860
|
+
spec_bytes: bytes,
|
|
1861
|
+
check_commands: list[str] | None = None,
|
|
1862
|
+
transcript: str = "",
|
|
1863
|
+
slug: str = "blind",
|
|
1864
|
+
base: str | None = None,
|
|
1865
|
+
head: str = "HEAD",
|
|
1866
|
+
) -> dict:
|
|
1867
|
+
safe_root = reject_unsafe_root(root)
|
|
1868
|
+
if not SLUG_RE.fullmatch(slug):
|
|
1869
|
+
raise SystemExit(f"invalid slug {slug!r}: use lowercase kebab-case")
|
|
1870
|
+
if not _is_git_root_or_worktree(safe_root):
|
|
1871
|
+
raise SystemExit("blind bundle needs a git repository: the diff is BASE..HEAD")
|
|
1872
|
+
base_ref = base or _auto_merge_base(safe_root)
|
|
1873
|
+
if not base_ref:
|
|
1874
|
+
raise SystemExit("blind bundle needs --base <ref>: no merge base could be inferred")
|
|
1875
|
+
base_sha = _resolve_commit(safe_root, base_ref, "base")
|
|
1876
|
+
head_sha = _resolve_commit(safe_root, head, "head")
|
|
1877
|
+
diff_bytes = _git_diff_bytes(safe_root, base_sha, head_sha)
|
|
1878
|
+
if not diff_bytes.strip():
|
|
1879
|
+
raise SystemExit(f"blind bundle refused: BASE {base_sha[:12]} and HEAD {head_sha[:12]} have an empty diff")
|
|
1880
|
+
try:
|
|
1881
|
+
spec_text = spec_bytes.decode("utf-8")
|
|
1882
|
+
except UnicodeDecodeError as err:
|
|
1883
|
+
raise SystemExit(f"blind bundle refused: the spec is not valid UTF-8 ({err})") from err
|
|
1884
|
+
if not spec_text.strip():
|
|
1885
|
+
raise SystemExit("blind bundle refused: the frozen spec is empty")
|
|
1886
|
+
|
|
1887
|
+
commands: list[str] = []
|
|
1888
|
+
for command in [*(check_commands or []), *extract_check_commands(transcript)]:
|
|
1889
|
+
command = command.strip()
|
|
1890
|
+
if not _is_plain_command(command):
|
|
1891
|
+
raise SystemExit(f"blind bundle refused: command must be one printable line: {command!r}")
|
|
1892
|
+
if command not in commands:
|
|
1893
|
+
commands.append(command)
|
|
1894
|
+
if not commands:
|
|
1895
|
+
raise SystemExit("blind bundle refused: no repro/check commands; pass --check-cmd so the verifier can run them cold")
|
|
1896
|
+
|
|
1897
|
+
longest_run = max((len(run) for command in commands for run in re.findall(r"`+", command)), default=0)
|
|
1898
|
+
command_fence = "`" * max(3, longest_run + 1)
|
|
1899
|
+
spec_hash = _sha256_hex(spec_bytes)
|
|
1900
|
+
diff_hash = _sha256_hex(diff_bytes)
|
|
1901
|
+
preamble = (
|
|
1902
|
+
"# Blind Verification Bundle\n"
|
|
1903
|
+
"Input for a verifier or judge. It holds the frozen spec, the diff and the commands to run cold; no author material is included.\n"
|
|
1904
|
+
f"- BASE: {base_sha}\n"
|
|
1905
|
+
f"- HEAD: {head_sha}\n"
|
|
1906
|
+
f"- Spec: {len(spec_bytes)} bytes, sha256 {spec_hash}\n"
|
|
1907
|
+
f"- Diff: {len(diff_bytes)} bytes, sha256 {diff_hash}\n"
|
|
1908
|
+
"\n## Verifier protocol\n"
|
|
1909
|
+
"Run every command below yourself, from the repository root at HEAD, and report the exit code you observe for each. "
|
|
1910
|
+
"Judge the diff against the spec from your own runs only.\n"
|
|
1911
|
+
)
|
|
1912
|
+
command_block = f"\n## Commands to run cold\n{command_fence}sh\n" + "\n".join(commands) + f"\n{command_fence}\n"
|
|
1913
|
+
assert_no_leaks({"frame": preamble, "spec": spec_text, "commands": "\n".join(commands)})
|
|
1914
|
+
|
|
1915
|
+
bundle = b"".join(
|
|
1916
|
+
[
|
|
1917
|
+
preamble.encode("utf-8"),
|
|
1918
|
+
f"\n## Frozen spec\n-----BEGIN SPEC bytes={len(spec_bytes)} sha256={spec_hash}-----\n".encode("utf-8"),
|
|
1919
|
+
_ensure_trailing_newline(spec_bytes),
|
|
1920
|
+
f"-----END SPEC sha256={spec_hash}-----\n".encode("utf-8"),
|
|
1921
|
+
command_block.encode("utf-8"),
|
|
1922
|
+
f"\n## Diff BASE..HEAD\n-----BEGIN DIFF bytes={len(diff_bytes)} sha256={diff_hash}-----\n".encode("utf-8"),
|
|
1923
|
+
_ensure_trailing_newline(diff_bytes),
|
|
1924
|
+
f"-----END DIFF sha256={diff_hash}-----\n".encode("utf-8"),
|
|
1925
|
+
]
|
|
1926
|
+
)
|
|
1927
|
+
_ensure_scratch_gitignore(safe_root)
|
|
1928
|
+
out_dir = ensure_contained(safe_root / ".scratch" / "self-grill" / slug, safe_root)
|
|
1929
|
+
out_dir.mkdir(parents=True, exist_ok=True)
|
|
1930
|
+
bundle_path = out_dir / "blind-bundle.md"
|
|
1931
|
+
atomic_write_bytes(bundle_path, bundle, safe_root)
|
|
1932
|
+
verifier_prompt = (
|
|
1933
|
+
f"Read ONLY `{bundle_path}` first. Run every command it lists yourself from the repository root at HEAD {head_sha[:12]}, "
|
|
1934
|
+
"and report your own exit code for each. Prove each spec criterion from your own runs and the diff, then try once to break it. "
|
|
1935
|
+
"Reply `VERDICT: DONE` or `VERDICT: NOT DONE` with the command that shows each criterion."
|
|
1936
|
+
)
|
|
1937
|
+
return {
|
|
1938
|
+
"mode": "blind",
|
|
1939
|
+
"bundle_path": str(bundle_path),
|
|
1940
|
+
"base": base_sha,
|
|
1941
|
+
"head": head_sha,
|
|
1942
|
+
"spec_sha256": spec_hash,
|
|
1943
|
+
"diff_sha256": diff_hash,
|
|
1944
|
+
"commands": commands,
|
|
1945
|
+
"verifier_prompt": verifier_prompt,
|
|
1946
|
+
}
|
|
1947
|
+
|
|
1948
|
+
|
|
1949
|
+
def cmd_bundle(args: argparse.Namespace) -> int:
|
|
1950
|
+
claims = sys.stdin.read() if args.claims_stdin else (Path(args.claims_file).read_text(encoding="utf-8") if args.claims_file else "")
|
|
1951
|
+
mode = args.mode or ("blind" if args.role in BLIND_ROLES else "full")
|
|
1952
|
+
if mode == "blind":
|
|
1953
|
+
if not args.spec_file:
|
|
1954
|
+
raise SystemExit("blind bundle needs --spec-file <frozen spec/acceptance bar>")
|
|
1955
|
+
if args.confession or args.files:
|
|
1956
|
+
raise SystemExit("blind bundle refuses --confession and --files: it holds only the spec, the BASE..HEAD diff and the commands")
|
|
1957
|
+
res = build_blind_bundle(
|
|
1958
|
+
Path(args.root),
|
|
1959
|
+
Path(args.spec_file).read_bytes(),
|
|
1960
|
+
check_commands=args.check_cmd,
|
|
1961
|
+
transcript=claims,
|
|
1962
|
+
slug=args.slug or "blind",
|
|
1963
|
+
base=args.base,
|
|
1964
|
+
head=args.head,
|
|
1965
|
+
)
|
|
1966
|
+
else:
|
|
1967
|
+
res = build_prosecutor_bundle(
|
|
1968
|
+
Path(args.root),
|
|
1969
|
+
slug=args.slug or "prosecutor",
|
|
1970
|
+
claims_text=claims,
|
|
1971
|
+
confession_text=args.confession or "",
|
|
1972
|
+
base=args.base,
|
|
1973
|
+
explicit_files=args.files,
|
|
1974
|
+
)
|
|
1975
|
+
if args.json:
|
|
1976
|
+
print(json.dumps(res, indent=2))
|
|
1977
|
+
else:
|
|
1978
|
+
print(res["bundle_path"])
|
|
1979
|
+
print(res.get("verifier_prompt") or res["prosecutor_prompt"])
|
|
1980
|
+
return 0
|
|
1981
|
+
|
|
1982
|
+
|
|
1983
|
+
def build_parser() -> argparse.ArgumentParser:
|
|
1984
|
+
parser = argparse.ArgumentParser(description="Deterministic diff-aware self-grill and Adaptive Prosecutor helper.")
|
|
1985
|
+
sub = parser.add_subparsers(dest="cmd", required=True)
|
|
1986
|
+
|
|
1987
|
+
p_diff = sub.add_parser("check-diff", help="Inspect git diff and generate targeted self-grill questions.")
|
|
1988
|
+
p_diff.add_argument("--root", required=True)
|
|
1989
|
+
p_diff.add_argument("--base", default=None)
|
|
1990
|
+
p_diff.add_argument("--staged", action="store_true")
|
|
1991
|
+
p_diff.add_argument("--files", nargs="*", default=None)
|
|
1992
|
+
p_diff.add_argument("--json", action="store_true")
|
|
1993
|
+
p_diff.set_defaults(func=cmd_check_diff)
|
|
1994
|
+
|
|
1995
|
+
p_init = sub.add_parser("init", help="Initialize or refresh a contained self-grill ledger under .scratch/self-grill/<slug>.")
|
|
1996
|
+
p_init.add_argument("--root", required=True)
|
|
1997
|
+
p_init.add_argument("--slug", required=True)
|
|
1998
|
+
p_init.add_argument("--phase", choices=("plan", "checks", "both"), default="checks")
|
|
1999
|
+
p_init.add_argument("--base", default=None)
|
|
2000
|
+
p_init.add_argument("--staged", action="store_true")
|
|
2001
|
+
p_init.add_argument("--files", nargs="*", default=None)
|
|
2002
|
+
p_init.add_argument("--force", action="store_true")
|
|
2003
|
+
p_init.add_argument("--refresh", action="store_true")
|
|
2004
|
+
p_init.add_argument("--json", action="store_true")
|
|
2005
|
+
p_init.set_defaults(func=cmd_init)
|
|
2006
|
+
|
|
2007
|
+
p_ans = sub.add_parser("answer", help="Record an evidence-backed answer for a self-grill question.")
|
|
2008
|
+
p_ans.add_argument("--dir", required=True)
|
|
2009
|
+
p_ans.add_argument("--id", required=True)
|
|
2010
|
+
p_ans.add_argument("--status", choices=("proven", "na", "failed", "blocked"), required=True)
|
|
2011
|
+
p_ans.add_argument("--answer", required=True)
|
|
2012
|
+
p_ans.add_argument("--receipt", default="")
|
|
2013
|
+
p_ans.add_argument("--json", action="store_true")
|
|
2014
|
+
p_ans.set_defaults(func=cmd_answer)
|
|
2015
|
+
|
|
2016
|
+
p_ver = sub.add_parser("verdict", help="Compute PASS/NEEDS_WORK/BLOCKED gate verdict from recorded receipts.")
|
|
2017
|
+
p_ver.add_argument("--dir", required=True)
|
|
2018
|
+
p_ver.add_argument("--strict", action="store_true")
|
|
2019
|
+
p_ver.add_argument("--allow-stale", action="store_true")
|
|
2020
|
+
p_ver.add_argument("--json", action="store_true")
|
|
2021
|
+
p_ver.set_defaults(func=cmd_verdict)
|
|
2022
|
+
|
|
2023
|
+
p_bun = sub.add_parser("bundle", help="Pack a single-file bundle on disk: the blind verifier bundle for verifier/judge roles, the Adaptive Hotspot Prosecutor bundle otherwise.")
|
|
2024
|
+
p_bun.add_argument("--root", required=True)
|
|
2025
|
+
p_bun.add_argument("--slug", default=None)
|
|
2026
|
+
p_bun.add_argument("--role", choices=("prosecutor", *BLIND_ROLES), default="prosecutor")
|
|
2027
|
+
p_bun.add_argument("--mode", choices=("blind", "full"), default=None)
|
|
2028
|
+
p_bun.add_argument("--base", default=None)
|
|
2029
|
+
p_bun.add_argument("--head", default="HEAD")
|
|
2030
|
+
p_bun.add_argument("--files", nargs="*", default=None)
|
|
2031
|
+
p_bun.add_argument("--spec-file", default=None)
|
|
2032
|
+
p_bun.add_argument("--check-cmd", action="append", default=[])
|
|
2033
|
+
p_bun.add_argument("--claims-stdin", action="store_true")
|
|
2034
|
+
p_bun.add_argument("--claims-file", default=None)
|
|
2035
|
+
p_bun.add_argument("--confession", default="")
|
|
2036
|
+
p_bun.add_argument("--json", action="store_true")
|
|
2037
|
+
p_bun.set_defaults(func=cmd_bundle)
|
|
2038
|
+
|
|
2039
|
+
return parser
|
|
2040
|
+
|
|
2041
|
+
|
|
2042
|
+
def main(argv: list[str] | None = None) -> int:
|
|
2043
|
+
parser = build_parser()
|
|
2044
|
+
args = parser.parse_args(argv)
|
|
2045
|
+
return args.func(args)
|
|
2046
|
+
|
|
2047
|
+
|
|
2048
|
+
if __name__ == "__main__":
|
|
2049
|
+
raise SystemExit(main())
|