@runfusion/fusion 0.73.0-beta.2 → 0.73.0-beta.4
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/agent-browser.mjs +8 -0
- package/dist/bin.js +7664 -11386
- package/dist/child-process-worker.js +4292 -8374
- package/dist/client/.vite/manifest.json +266 -256
- package/dist/client/assets/{AgentDetailView-CUoHZPZr.js → AgentDetailView-BBOL6AgZ.js} +3 -3
- package/dist/client/assets/{AgentPermissionPolicyEditor-DKoHJIlF.js → AgentPermissionPolicyEditor-DV7OPUhR.js} +1 -1
- package/dist/client/assets/{AgentsView-CaBo-FHV.js → AgentsView-B6xoAHyV.js} +4 -4
- package/dist/client/assets/ChatView-DwVjnxM8.js +8 -0
- package/dist/client/assets/{CommandCenter-wgiEIVuC.js → CommandCenter-DYWaoYFD.js} +9 -9
- package/dist/client/assets/DevServerView-BY5up-NA.js +1 -0
- package/dist/client/assets/{DirectoryPicker-B7YwgF53.js → DirectoryPicker-fM8MJa2r.js} +1 -1
- package/dist/client/assets/DocumentsView-D2KxsPG_.js +1 -0
- package/dist/client/assets/{EvalsView-BjyqxMS_.js → EvalsView-U8dOvTRM.js} +1 -1
- package/dist/client/assets/{ExperimentalAgentOnboardingModal-_PMSa_gN.js → ExperimentalAgentOnboardingModal-C27y8Y-1.js} +1 -1
- package/dist/client/assets/{GoalsView-BzLA8GX9.js → GoalsView-D-2wmy-O.js} +1 -1
- package/dist/client/assets/{InsightsView-Cb_tUr1V.js → InsightsView-zLyuQL_l.js} +2 -2
- package/dist/client/assets/{MemoryView-CRxOPCQq.js → MemoryView-D-tSn48u.js} +2 -2
- package/dist/client/assets/{PiExtensionsManager-XQ5rWJT3.js → PiExtensionsManager-DvwmvGEY.js} +2 -2
- package/dist/client/assets/PluginManager-BACOwQAN.js +1 -0
- package/dist/client/assets/{PullRequestView-CX6fScVe.js → PullRequestView-DULyv21u.js} +2 -2
- package/dist/client/assets/{ReportModal-BSCk5ER1.css → ReportModal-BuhhqtXJ.css} +1 -1
- package/dist/client/assets/ReportModal-CUlKMFWa.js +21 -0
- package/dist/client/assets/{ResearchView-DgKzxRUL.js → ResearchView-DM_O3IFc.js} +2 -2
- package/dist/client/assets/{SecretsView-C83SIrjR.js → SecretsView-Bq3u_nAf.js} +1 -1
- package/dist/client/assets/SessionTerminal-D00ByR6U.js +2 -0
- package/dist/client/assets/SettingsModal-Bb3pIxiX.js +21 -0
- package/dist/client/assets/SettingsModal-CMLHZBhX.css +1 -0
- package/dist/client/assets/SettingsModal-QRaBE1ds.js +1 -0
- package/dist/client/assets/{SettingsTextareaRow-BKGsmZ7C.js → SettingsTextareaRow-CHOJ-qHz.js} +1 -1
- package/dist/client/assets/{SetupWizardModal-DIb4q-VT.js → SetupWizardModal-DriQyd81.js} +2 -2
- package/dist/client/assets/{SkillsView-D1Zxh1iX.js → SkillsView-BtDyujiZ.js} +1 -1
- package/dist/client/assets/{TodoView-CGIcE6Yr.js → TodoView-BNHUnz50.js} +2 -2
- package/dist/client/assets/{WorkflowNodeEditor-BtWrziOX.css → WorkflowNodeEditor-BNgkFJ_P.css} +1 -1
- package/dist/client/assets/WorkflowNodeEditor-BXikFpra.js +8 -0
- package/dist/client/assets/agent-import-generation-B2kYEm1O.js +1 -0
- package/dist/client/assets/app-B_HrdDXZ.js +13 -0
- package/dist/client/assets/{app-BsIXfnu-.js → app-C6yo-M_n.js} +1 -1
- package/dist/client/assets/{app-B-IdUeIu.js → app-CH8ZgPm4.js} +1 -1
- package/dist/client/assets/{app-D9ktpVhR.js → app-D4DpgDss.js} +1 -1
- package/dist/client/assets/{app-nBTNvNKK.js → app-Qv0blCyY.js} +1 -1
- package/dist/client/assets/{app-C8muVNUU.js → app-kFdtajPy.js} +1 -1
- package/dist/client/assets/{architectureDiagram-3BPJPVTR-Dv83GkUE.js → architectureDiagram-3BPJPVTR-B-Efjj4Z.js} +1 -1
- package/dist/client/assets/{blockDiagram-GPEHLZMM-B_j-RJOz.js → blockDiagram-GPEHLZMM-CaOVxrlM.js} +1 -1
- package/dist/client/assets/{c4Diagram-AAUBKEIU-Cy3f-SD1.js → c4Diagram-AAUBKEIU-D8aYt5F1.js} +1 -1
- package/dist/client/assets/channel-5bPK6pTS.js +1 -0
- package/dist/client/assets/{chunk-2J33WTMH-CPolddUJ.js → chunk-2J33WTMH-VSDT0J0r.js} +1 -1
- package/dist/client/assets/{chunk-4BX2VUAB-BAGPgwkc.js → chunk-4BX2VUAB-Chx1wQgD.js} +1 -1
- package/dist/client/assets/{chunk-55IACEB6-dzYFOH0q.js → chunk-55IACEB6-MlqjhIJg.js} +1 -1
- package/dist/client/assets/{chunk-727SXJPM-ul9hGhiR.js → chunk-727SXJPM-BheQNUi8.js} +1 -1
- package/dist/client/assets/{chunk-AQP2D5EJ-C75yqe4-.js → chunk-AQP2D5EJ-C5EoJhfJ.js} +1 -1
- package/dist/client/assets/{chunk-FMBD7UC4-BwiLAyup.js → chunk-FMBD7UC4-B8_8qP3j.js} +1 -1
- package/dist/client/assets/{chunk-ND2GUHAM-CVv1sLhy.js → chunk-ND2GUHAM-BuglCGRx.js} +1 -1
- package/dist/client/assets/{chunk-QZHKN3VN-D1c-k3xL.js → chunk-QZHKN3VN-B7_06dxp.js} +1 -1
- package/dist/client/assets/classDiagram-4FO5ZUOK-Dv9RQDqG.js +1 -0
- package/dist/client/assets/classDiagram-v2-Q7XG4LA2-Dv9RQDqG.js +1 -0
- package/dist/client/assets/{cose-bilkent-S5V4N54A-DosMsFd6.js → cose-bilkent-S5V4N54A-Cm-ZOycx.js} +1 -1
- package/dist/client/assets/{dagre-BM42HDAG-9os-QBXe.js → dagre-BM42HDAG-Dj_Gwjpv.js} +1 -1
- package/dist/client/assets/{dashboard-view-CNVTxyWE.js → dashboard-view-B4CRL5Fy.js} +1 -1
- package/dist/client/assets/{dashboard-view-Bn7iL770.js → dashboard-view-noD9p0Zs.js} +1 -1
- package/dist/client/assets/{dashboard-view-iwAS1HTp.js → dashboard-view-pXXSUxG9.js} +1 -1
- package/dist/client/assets/{diagram-2AECGRRQ-ChjuJgA6.js → diagram-2AECGRRQ-C_9BfShy.js} +1 -1
- package/dist/client/assets/{diagram-5GNKFQAL-Cq10aB4z.js → diagram-5GNKFQAL-Cmg2qpCj.js} +1 -1
- package/dist/client/assets/{diagram-KO2AKTUF-CKjyrzjg.js → diagram-KO2AKTUF-2FNo2HXb.js} +1 -1
- package/dist/client/assets/{diagram-LMA3HP47-DxCc1BsH.js → diagram-LMA3HP47-DgnVeCp-.js} +1 -1
- package/dist/client/assets/{diagram-OG6HWLK6-DJWEkDsR.js → diagram-OG6HWLK6-iAIR50HH.js} +1 -1
- package/dist/client/assets/{erDiagram-TEJ5UH35-gVkDYC92.js → erDiagram-TEJ5UH35-Da4I04eN.js} +1 -1
- package/dist/client/assets/{flowDiagram-I6XJVG4X-1lw1mQRQ.js → flowDiagram-I6XJVG4X-Bv9r2T0m.js} +1 -1
- package/dist/client/assets/{folder-open-Nmr7nRmN.js → folder-open-CwWtrDh6.js} +1 -1
- package/dist/client/assets/{ganttDiagram-6RSMTGT7-Yzq4WZRo.js → ganttDiagram-6RSMTGT7-BMeO84U_.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-PVQCEYII-cFR9Gv8n.js → gitGraphDiagram-PVQCEYII-CWDh_RIb.js} +1 -1
- package/dist/client/assets/index-CB3mYxAB.css +1 -0
- package/dist/client/assets/index-CE7C_XsS.js +2661 -0
- package/dist/client/assets/{infoDiagram-5YYISTIA-BbRiTnD3.js → infoDiagram-5YYISTIA-BAE4KtCL.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-YF4QCWOH-DD4i2Znk.js → ishikawaDiagram-YF4QCWOH-C_iXAuOy.js} +1 -1
- package/dist/client/assets/{journeyDiagram-JHISSGLW-qHPO2M-C.js → journeyDiagram-JHISSGLW-BnxSHwDo.js} +1 -1
- package/dist/client/assets/{kanban-definition-UN3LZRKU-EuFfgxUv.js → kanban-definition-UN3LZRKU-DYNRm3Nu.js} +1 -1
- package/dist/client/assets/{mermaid.core-Cru9Vzsy.js → mermaid.core-B3hvDDep.js} +4 -4
- package/dist/client/assets/{mindmap-definition-RKZ34NQL-mCvtfapj.js → mindmap-definition-RKZ34NQL-s7KBEuPD.js} +1 -1
- package/dist/client/assets/{pieDiagram-4H26LBE5-BSc_a5Dz.js → pieDiagram-4H26LBE5-Cy1_IPUD.js} +1 -1
- package/dist/client/assets/{puzzle-Cz66CEWW.js → puzzle-DWc6gFQ7.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-W4KKPZXB-Um2SLb_d.js → quadrantDiagram-W4KKPZXB-DqgVGp41.js} +1 -1
- package/dist/client/assets/{requirementDiagram-4Y6WPE33-B94evN7g.js → requirementDiagram-4Y6WPE33-CA5-TDeF.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-5OEKKPKP-BH7NLX-K.js → sankeyDiagram-5OEKKPKP-Cuvi3RgE.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-3UESZ5HK-DusrBGQp.js → sequenceDiagram-3UESZ5HK-Da3GfmGP.js} +1 -1
- package/dist/client/assets/{shield-alert-CcQuaRHN.js → shield-alert-_iY63ED4.js} +1 -1
- package/dist/client/assets/{standing-instructions-template-CVnY93Xy.js → standing-instructions-template-CCd2YY9c.js} +1 -1
- package/dist/client/assets/{stateDiagram-AJRCARHV-GRjL9YlX.js → stateDiagram-AJRCARHV-CZ_I9ENR.js} +1 -1
- package/dist/client/assets/{stateDiagram-v2-BHNVJYJU-BBsv6ppQ.js → stateDiagram-v2-BHNVJYJU-BomoRVhY.js} +1 -1
- package/dist/client/assets/{timeline-definition-PNZ67QCA-DC6UeqjY.js → timeline-definition-PNZ67QCA-C3CYvIuR.js} +1 -1
- package/dist/client/assets/{upload-CjJp7lEX.js → upload-D0RrO65v.js} +1 -1
- package/dist/client/assets/{users-DgimRYHz.js → users-CGszBY2v.js} +1 -1
- package/dist/client/assets/{vennDiagram-CIIHVFJN-C272zK9h.js → vennDiagram-CIIHVFJN-By9fi8NW.js} +1 -1
- package/dist/client/assets/{wardley-L42UT6IY-KkRF-2j9.js → wardley-L42UT6IY-DErnXPkI.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-YWT4CUSO-B4brtKRt.js → wardleyDiagram-YWT4CUSO-DFfXZVPk.js} +1 -1
- package/dist/client/assets/{xychartDiagram-2RQKCTM6--PFSKt1s.js → xychartDiagram-2RQKCTM6-9Y5oZ5mi.js} +1 -1
- package/dist/client/index.html +4 -2
- package/dist/client/version.json +1 -1
- package/dist/extension.js +4516 -8539
- package/dist/migrations/0000_initial.sql +2 -0
- package/dist/migrations/0026_bigint_counters.sql +85 -14
- package/dist/migrations/0033_fn-8505_wedge_notification.sql +5 -0
- package/dist/plugin-sdk/index.js +1 -0
- package/dist/plugins/.fusion-ce-agents/.fusion-ce-upstream-provenance.json +7 -0
- package/dist/plugins/.fusion-ce-agents/ce-adversarial-document-reviewer.md +115 -0
- package/dist/plugins/.fusion-ce-agents/ce-adversarial-reviewer.md +111 -0
- package/dist/plugins/.fusion-ce-agents/ce-agent-native-planning-strategist.md +71 -0
- package/dist/plugins/.fusion-ce-agents/ce-agent-native-reviewer.md +181 -0
- package/dist/plugins/.fusion-ce-agents/ce-ankane-readme-writer.md +50 -0
- package/dist/plugins/.fusion-ce-agents/ce-api-contract-reviewer.md +52 -0
- package/dist/plugins/.fusion-ce-agents/ce-architecture-strategist.md +53 -0
- package/dist/plugins/.fusion-ce-agents/ce-best-practices-researcher.md +122 -0
- package/dist/plugins/.fusion-ce-agents/ce-code-simplicity-reviewer.md +87 -0
- package/dist/plugins/.fusion-ce-agents/ce-coherence-reviewer.md +73 -0
- package/dist/plugins/.fusion-ce-agents/ce-correctness-reviewer.md +52 -0
- package/dist/plugins/.fusion-ce-agents/ce-data-integrity-guardian.md +75 -0
- package/dist/plugins/.fusion-ce-agents/ce-data-migration-reviewer.md +119 -0
- package/dist/plugins/.fusion-ce-agents/ce-deployment-verification-agent.md +164 -0
- package/dist/plugins/.fusion-ce-agents/ce-design-implementation-reviewer.md +94 -0
- package/dist/plugins/.fusion-ce-agents/ce-design-iterator.md +197 -0
- package/dist/plugins/.fusion-ce-agents/ce-design-lens-reviewer.md +56 -0
- package/dist/plugins/.fusion-ce-agents/ce-feasibility-reviewer.md +65 -0
- package/dist/plugins/.fusion-ce-agents/ce-figma-design-sync.md +172 -0
- package/dist/plugins/.fusion-ce-agents/ce-framework-docs-researcher.md +100 -0
- package/dist/plugins/.fusion-ce-agents/ce-git-history-analyzer.md +47 -0
- package/dist/plugins/.fusion-ce-agents/ce-issue-intelligence-analyst.md +207 -0
- package/dist/plugins/.fusion-ce-agents/ce-julik-frontend-races-reviewer.md +52 -0
- package/dist/plugins/.fusion-ce-agents/ce-learnings-researcher.md +254 -0
- package/dist/plugins/.fusion-ce-agents/ce-maintainability-reviewer.md +77 -0
- package/dist/plugins/.fusion-ce-agents/ce-pattern-recognition-specialist.md +62 -0
- package/dist/plugins/.fusion-ce-agents/ce-performance-oracle.md +115 -0
- package/dist/plugins/.fusion-ce-agents/ce-performance-reviewer.md +54 -0
- package/dist/plugins/.fusion-ce-agents/ce-pr-comment-resolver.md +63 -0
- package/dist/plugins/.fusion-ce-agents/ce-previous-comments-reviewer.md +68 -0
- package/dist/plugins/.fusion-ce-agents/ce-product-lens-reviewer.md +92 -0
- package/dist/plugins/.fusion-ce-agents/ce-project-standards-reviewer.md +84 -0
- package/dist/plugins/.fusion-ce-agents/ce-reliability-reviewer.md +52 -0
- package/dist/plugins/.fusion-ce-agents/ce-repo-research-analyst.md +263 -0
- package/dist/plugins/.fusion-ce-agents/ce-scope-guardian-reviewer.md +79 -0
- package/dist/plugins/.fusion-ce-agents/ce-security-lens-reviewer.md +48 -0
- package/dist/plugins/.fusion-ce-agents/ce-security-reviewer.md +54 -0
- package/dist/plugins/.fusion-ce-agents/ce-security-sentinel.md +98 -0
- package/dist/plugins/.fusion-ce-agents/ce-session-historian.md +89 -0
- package/dist/plugins/.fusion-ce-agents/ce-slack-researcher.md +133 -0
- package/dist/plugins/.fusion-ce-agents/ce-spec-flow-analyzer.md +87 -0
- package/dist/plugins/.fusion-ce-agents/ce-swift-ios-reviewer.md +107 -0
- package/dist/plugins/.fusion-ce-agents/ce-testing-reviewer.md +52 -0
- package/dist/plugins/.fusion-ce-agents/ce-web-researcher.md +127 -0
- package/dist/plugins/.fusion-ce-skills/.fusion-ce-upstream-provenance.json +7 -0
- package/dist/plugins/.fusion-ce-skills/ce-brainstorm/SKILL.md +318 -0
- package/dist/plugins/.fusion-ce-skills/ce-brainstorm/references/agents/slack-researcher.md +127 -0
- package/dist/plugins/.fusion-ce-skills/ce-brainstorm/references/brainstorm-sections.md +354 -0
- package/dist/plugins/.fusion-ce-skills/ce-brainstorm/references/handoff.md +172 -0
- package/dist/plugins/.fusion-ce-skills/ce-brainstorm/references/html-rendering.md +662 -0
- package/dist/plugins/.fusion-ce-skills/ce-brainstorm/references/markdown-rendering.md +236 -0
- package/dist/plugins/.fusion-ce-skills/ce-brainstorm/references/synthesis-summary.md +271 -0
- package/dist/plugins/.fusion-ce-skills/ce-brainstorm/references/universal-brainstorming.md +71 -0
- package/dist/plugins/.fusion-ce-skills/ce-brainstorm/references/visual-probes.md +128 -0
- package/dist/plugins/.fusion-ce-skills/ce-brainstorm/scripts/visual-probe-server.js +419 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/SKILL.md +821 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/action-class-rubric.md +26 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/bulk-preview.md +112 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/cross-model-review.md +63 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/diff-scope.md +41 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/findings-schema.json +137 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/persona-catalog.md +63 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/personas/adversarial-reviewer.md +102 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/personas/agent-native-reviewer.md +173 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/personas/api-contract-reviewer.md +43 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/personas/correctness-reviewer.md +43 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/personas/data-migration-reviewer.md +111 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/personas/deployment-verification-agent.md +157 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/personas/julik-frontend-races-reviewer.md +44 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/personas/learnings-researcher.md +247 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/personas/maintainability-reviewer.md +68 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/personas/performance-reviewer.md +45 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/personas/previous-comments-reviewer.md +59 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/personas/project-standards-reviewer.md +75 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/personas/reliability-reviewer.md +43 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/personas/security-reviewer.md +45 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/personas/swift-ios-reviewer.md +99 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/personas/testing-reviewer.md +43 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/review-output-template.md +170 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/subagent-template.md +199 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/tracker-defer.md +149 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/validator-template.md +89 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/references/walkthrough.md +249 -0
- package/dist/plugins/.fusion-ce-skills/ce-code-review/scripts/cross-model-adversarial-review.sh +218 -0
- package/dist/plugins/.fusion-ce-skills/ce-commit/SKILL.md +105 -0
- package/dist/plugins/.fusion-ce-skills/ce-commit-push-pr/SKILL.md +134 -0
- package/dist/plugins/.fusion-ce-skills/ce-commit-push-pr/references/branch-creation.md +55 -0
- package/dist/plugins/.fusion-ce-skills/ce-commit-push-pr/references/pr-description-writing.md +115 -0
- package/dist/plugins/.fusion-ce-skills/ce-compound/SKILL.md +712 -0
- package/dist/plugins/.fusion-ce-skills/ce-compound/assets/resolution-template.md +94 -0
- package/dist/plugins/.fusion-ce-skills/ce-compound/references/agents/best-practices-researcher.md +115 -0
- package/dist/plugins/.fusion-ce-skills/ce-compound/references/agents/data-integrity-guardian.md +68 -0
- package/dist/plugins/.fusion-ce-skills/ce-compound/references/agents/framework-docs-researcher.md +93 -0
- package/dist/plugins/.fusion-ce-skills/ce-compound/references/agents/pattern-recognition-specialist.md +55 -0
- package/dist/plugins/.fusion-ce-skills/ce-compound/references/agents/performance-oracle.md +108 -0
- package/dist/plugins/.fusion-ce-skills/ce-compound/references/agents/security-sentinel.md +91 -0
- package/dist/plugins/.fusion-ce-skills/ce-compound/references/agents/session-historian.md +83 -0
- package/dist/plugins/.fusion-ce-skills/ce-compound/references/concepts-vocabulary.md +78 -0
- package/dist/plugins/.fusion-ce-skills/ce-compound/references/schema.yaml +231 -0
- package/dist/plugins/.fusion-ce-skills/ce-compound/references/yaml-schema.md +118 -0
- package/dist/plugins/.fusion-ce-skills/ce-compound/scripts/session-history/discover-sessions.sh +130 -0
- package/dist/plugins/.fusion-ce-skills/ce-compound/scripts/session-history/extract-errors.py +254 -0
- package/dist/plugins/.fusion-ce-skills/ce-compound/scripts/session-history/extract-metadata.py +456 -0
- package/dist/plugins/.fusion-ce-skills/ce-compound/scripts/session-history/extract-skeleton.py +570 -0
- package/dist/plugins/.fusion-ce-skills/ce-compound/scripts/validate-frontmatter.py +137 -0
- package/dist/plugins/.fusion-ce-skills/ce-debug/SKILL.md +257 -0
- package/dist/plugins/.fusion-ce-skills/ce-debug/references/anti-patterns.md +91 -0
- package/dist/plugins/.fusion-ce-skills/ce-debug/references/defense-in-depth.md +35 -0
- package/dist/plugins/.fusion-ce-skills/ce-debug/references/investigation-techniques.md +374 -0
- package/dist/plugins/.fusion-ce-skills/ce-doc-review/SKILL.md +70 -0
- package/dist/plugins/.fusion-ce-skills/ce-ideate/SKILL.md +401 -0
- package/dist/plugins/.fusion-ce-skills/ce-ideate/references/agents/issue-intelligence-analyst.md +200 -0
- package/dist/plugins/.fusion-ce-skills/ce-ideate/references/agents/learnings-researcher.md +247 -0
- package/dist/plugins/.fusion-ce-skills/ce-ideate/references/agents/slack-researcher.md +127 -0
- package/dist/plugins/.fusion-ce-skills/ce-ideate/references/agents/web-researcher.md +121 -0
- package/dist/plugins/.fusion-ce-skills/ce-ideate/references/divergent-ideation.md +89 -0
- package/dist/plugins/.fusion-ce-skills/ce-ideate/references/html-rendering.md +662 -0
- package/dist/plugins/.fusion-ce-skills/ce-ideate/references/ideation-sections.md +191 -0
- package/dist/plugins/.fusion-ce-skills/ce-ideate/references/markdown-rendering.md +236 -0
- package/dist/plugins/.fusion-ce-skills/ce-ideate/references/post-ideation-workflow.md +166 -0
- package/dist/plugins/.fusion-ce-skills/ce-ideate/references/universal-ideation.md +107 -0
- package/dist/plugins/.fusion-ce-skills/ce-ideate/references/web-research-cache.md +55 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/SKILL.md +858 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/agents/agent-native-planning-strategist.md +62 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/agents/architecture-strategist.md +46 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/agents/best-practices-researcher.md +114 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/agents/data-integrity-guardian.md +68 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/agents/data-migration-reviewer.md +103 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/agents/deployment-verification-agent.md +157 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/agents/framework-docs-researcher.md +93 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/agents/git-history-analyzer.md +40 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/agents/learnings-researcher.md +247 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/agents/pattern-recognition-specialist.md +55 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/agents/performance-oracle.md +108 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/agents/repo-research-analyst.md +256 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/agents/security-sentinel.md +91 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/agents/slack-researcher.md +127 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/agents/spec-flow-analyzer.md +80 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/agents/web-researcher.md +121 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/approach-altitude.md +55 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/deepening-workflow.md +259 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/html-rendering.md +668 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/markdown-rendering.md +236 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/plan-handoff.md +126 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/plan-sections.md +405 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/synthesis-summary.md +396 -0
- package/dist/plugins/.fusion-ce-skills/ce-plan/references/universal-planning.md +168 -0
- package/dist/plugins/.fusion-ce-skills/ce-resolve-pr-feedback/SKILL.md +53 -0
- package/dist/plugins/.fusion-ce-skills/ce-resolve-pr-feedback/references/agents/pr-comment-resolver.md +56 -0
- package/dist/plugins/.fusion-ce-skills/ce-resolve-pr-feedback/references/evaluation-rubric.md +106 -0
- package/dist/plugins/.fusion-ce-skills/ce-resolve-pr-feedback/references/full-mode.md +283 -0
- package/dist/plugins/.fusion-ce-skills/ce-resolve-pr-feedback/references/targeted-mode.md +45 -0
- package/dist/plugins/.fusion-ce-skills/ce-resolve-pr-feedback/scripts/get-pr-comments +159 -0
- package/dist/plugins/.fusion-ce-skills/ce-resolve-pr-feedback/scripts/get-thread-for-comment +76 -0
- package/dist/plugins/.fusion-ce-skills/ce-resolve-pr-feedback/scripts/reply-to-pr-thread +33 -0
- package/dist/plugins/.fusion-ce-skills/ce-resolve-pr-feedback/scripts/resolve-pr-thread +23 -0
- package/dist/plugins/.fusion-ce-skills/ce-strategy/SKILL.md +97 -0
- package/dist/plugins/.fusion-ce-skills/ce-strategy/references/interview.md +143 -0
- package/dist/plugins/.fusion-ce-skills/ce-strategy/references/strategy-template.md +89 -0
- package/dist/plugins/.fusion-ce-skills/ce-work/SKILL.md +429 -0
- package/dist/plugins/.fusion-ce-skills/ce-work/references/agents/figma-design-sync.md +165 -0
- package/dist/plugins/.fusion-ce-skills/ce-work/references/execution-engines.md +85 -0
- package/dist/plugins/.fusion-ce-skills/ce-work/references/non-code-execution.md +23 -0
- package/dist/plugins/.fusion-ce-skills/ce-work/references/review-findings-followup.md +104 -0
- package/dist/plugins/.fusion-ce-skills/ce-work/references/shipping-workflow.md +133 -0
- package/dist/plugins/.fusion-ce-skills/ce-work/references/tracker-defer.md +149 -0
- package/dist/plugins/fusion-plugin-compound-engineering/.bundled.reload-3.js +11266 -0
- package/dist/plugins/fusion-plugin-compound-engineering/.bundled.reload-4.js +11266 -0
- package/dist/plugins/fusion-plugin-dependency-graph/.bundled.reload-1.js +8206 -0
- package/dist/plugins/fusion-plugin-grok-runtime/.bundled.reload-2.js +26623 -0
- package/package.json +6 -3
- package/skill/fusion/references/engine-tools.md +6 -2
- package/dist/client/assets/ChatView-Bv0J5p5U.js +0 -8
- package/dist/client/assets/DevServerView-Ue9XG_4H.js +0 -1
- package/dist/client/assets/DocumentsView-C1Ptwcv5.js +0 -1
- package/dist/client/assets/PluginManager-CXPSlWxs.js +0 -1
- package/dist/client/assets/ReportModal-JhZZXZlj.js +0 -21
- package/dist/client/assets/SessionTerminal-BrK3psiC.js +0 -2
- package/dist/client/assets/SettingsModal-Bby9vLGx.js +0 -21
- package/dist/client/assets/SettingsModal-DVLqY1-7.js +0 -1
- package/dist/client/assets/SettingsModal-DXArgTTx.css +0 -1
- package/dist/client/assets/WorkflowNodeEditor-BXUC0lim.js +0 -8
- package/dist/client/assets/app-DUszvars.js +0 -13
- package/dist/client/assets/channel-BuhC8kaT.js +0 -1
- package/dist/client/assets/classDiagram-4FO5ZUOK-vpRR5WOg.js +0 -1
- package/dist/client/assets/classDiagram-v2-Q7XG4LA2-vpRR5WOg.js +0 -1
- package/dist/client/assets/index-Cg9ahVtV.js +0 -2661
- package/dist/client/assets/index-uhXHk1ek.css +0 -1
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Validate ce-compound docs/solutions/ frontmatter for parser-safety issues.
|
|
3
|
+
|
|
4
|
+
Usage:
|
|
5
|
+
python3 validate-frontmatter.py <doc-path>
|
|
6
|
+
|
|
7
|
+
Exit codes:
|
|
8
|
+
0 — frontmatter passes all checks
|
|
9
|
+
1 — validation failure (diagnostics on stderr)
|
|
10
|
+
2 — usage error (bad arguments, missing file)
|
|
11
|
+
|
|
12
|
+
Scope: this script catches *parser-safety* issues — frontmatter that strict
|
|
13
|
+
YAML parsers will silently misread. It does NOT validate against the
|
|
14
|
+
schema's required-field or enum-value rules; that's a separate concern. The
|
|
15
|
+
intent is to prevent the silent-data-loss bug class where YAML's quoting
|
|
16
|
+
rules truncate or reframe scalar values without raising.
|
|
17
|
+
|
|
18
|
+
Checks (regex-based, no YAML parser dependency):
|
|
19
|
+
1. File starts and ends frontmatter with `---` lines (matched as full
|
|
20
|
+
lines, not substrings — `----` and `---extra` are rejected)
|
|
21
|
+
2. No top-level scalar value contains ` #` unquoted (silent comment
|
|
22
|
+
truncation — what Codex caught on PR #695)
|
|
23
|
+
3. No top-level scalar value contains `: ` unquoted (mapping confusion —
|
|
24
|
+
what surfaced in a 2026-04-16 plan doc's `title:` field)
|
|
25
|
+
|
|
26
|
+
The script does NOT flag values starting with YAML reserved indicators
|
|
27
|
+
(`` ` ``, `*`, `&`, `!`, etc.) because those produce loud parser errors
|
|
28
|
+
downstream rather than silent corruption — they're already caught by
|
|
29
|
+
whatever consumes the doc. This validator's purpose is silent-corruption
|
|
30
|
+
prevention, not lint.
|
|
31
|
+
|
|
32
|
+
Pure-stdlib (no PyYAML or other third-party deps). Runs in <50ms typical.
|
|
33
|
+
Designed to produce concrete, actionable error messages so the calling
|
|
34
|
+
agent can fix and retry without ambiguity.
|
|
35
|
+
"""
|
|
36
|
+
import os
|
|
37
|
+
import re
|
|
38
|
+
import sys
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def usage_fail(msg: str) -> "NoReturn":
|
|
42
|
+
sys.stderr.write(f"validate-frontmatter: {msg}\n")
|
|
43
|
+
sys.exit(2)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def main(argv: list[str]) -> int:
|
|
47
|
+
if len(argv) != 2:
|
|
48
|
+
usage_fail(f"usage: {os.path.basename(argv[0])} <doc-path>")
|
|
49
|
+
|
|
50
|
+
doc_path = argv[1]
|
|
51
|
+
if not os.path.isfile(doc_path):
|
|
52
|
+
usage_fail(f"file not found: {doc_path}")
|
|
53
|
+
|
|
54
|
+
with open(doc_path) as f:
|
|
55
|
+
text = f.read()
|
|
56
|
+
|
|
57
|
+
issues: list[str] = []
|
|
58
|
+
|
|
59
|
+
# Check 1: frontmatter delimiters. Match the delimiter as a complete
|
|
60
|
+
# line whose stripped content is exactly `---` — substring matching
|
|
61
|
+
# (e.g. `text.find("\n---", 4)`) would falsely accept `----` or
|
|
62
|
+
# `---extra` as a terminator and let malformed docs slip through to
|
|
63
|
+
# downstream parsers that require a strict `---` line.
|
|
64
|
+
lines = text.split("\n")
|
|
65
|
+
if not lines or lines[0].rstrip() != "---":
|
|
66
|
+
sys.stderr.write(
|
|
67
|
+
f"FAIL: {doc_path}\n"
|
|
68
|
+
f" file does not start with '---' frontmatter delimiter line\n"
|
|
69
|
+
)
|
|
70
|
+
return 1
|
|
71
|
+
|
|
72
|
+
end_idx: int | None = None
|
|
73
|
+
for i in range(1, len(lines)):
|
|
74
|
+
if lines[i].rstrip() == "---":
|
|
75
|
+
end_idx = i
|
|
76
|
+
break
|
|
77
|
+
|
|
78
|
+
if end_idx is None:
|
|
79
|
+
sys.stderr.write(
|
|
80
|
+
f"FAIL: {doc_path}\n"
|
|
81
|
+
f" frontmatter not closed (no '---' line after the opening delimiter)\n"
|
|
82
|
+
)
|
|
83
|
+
return 1
|
|
84
|
+
|
|
85
|
+
fm_text = "\n".join(lines[1:end_idx])
|
|
86
|
+
|
|
87
|
+
# Checks 2 & 3: silent-corruption quoting risks on top-level scalar
|
|
88
|
+
# fields. We scan line-by-line and only flag top-level mapping entries
|
|
89
|
+
# (no leading whitespace) whose value isn't already quoted/structured.
|
|
90
|
+
for lineno, line in enumerate(fm_text.split("\n"), start=2):
|
|
91
|
+
stripped = line.lstrip()
|
|
92
|
+
if not stripped or stripped.startswith("#"):
|
|
93
|
+
continue
|
|
94
|
+
if ":" not in line:
|
|
95
|
+
continue
|
|
96
|
+
# Top-level mapping keys only — skip nested values, array items
|
|
97
|
+
if line.startswith((" ", "\t")):
|
|
98
|
+
continue
|
|
99
|
+
# Skip pure list-marker lines like "- item" (these can't be top-level
|
|
100
|
+
# in our frontmatter convention, but be defensive)
|
|
101
|
+
if stripped.startswith("- "):
|
|
102
|
+
continue
|
|
103
|
+
|
|
104
|
+
key, _, val = line.partition(":")
|
|
105
|
+
val_stripped = val.strip()
|
|
106
|
+
if not val_stripped:
|
|
107
|
+
# Key with no value on this line — likely a parent of a nested
|
|
108
|
+
# block (`tags:` followed by `- foo`). Nothing to validate here.
|
|
109
|
+
continue
|
|
110
|
+
# Already quoted or structured (block scalar, flow collection)
|
|
111
|
+
if val_stripped[0] in '"\'[{|>':
|
|
112
|
+
continue
|
|
113
|
+
|
|
114
|
+
if re.search(r"\s#", val_stripped):
|
|
115
|
+
issues.append(
|
|
116
|
+
f"line {lineno}: '{key.strip()}' value contains ' #' — quote it. "
|
|
117
|
+
"YAML treats space-then-# as a comment delimiter and silently "
|
|
118
|
+
"drops the rest of the value."
|
|
119
|
+
)
|
|
120
|
+
if re.search(r":\s", val_stripped):
|
|
121
|
+
issues.append(
|
|
122
|
+
f"line {lineno}: '{key.strip()}' value contains ': ' — quote it. "
|
|
123
|
+
"Strict YAML parsers may treat this as a nested mapping."
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
if issues:
|
|
127
|
+
sys.stderr.write(f"FAIL: {doc_path}\n")
|
|
128
|
+
for issue in issues:
|
|
129
|
+
sys.stderr.write(f" {issue}\n")
|
|
130
|
+
return 1
|
|
131
|
+
|
|
132
|
+
print(f"OK: {doc_path}")
|
|
133
|
+
return 0
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
if __name__ == "__main__":
|
|
137
|
+
sys.exit(main(sys.argv))
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ce-debug
|
|
3
|
+
description: 'Diagnosis loop for bugs and failing behavior. Use for errors, stack traces, regressions, failed tests, issue-tracker bugs, stuck investigations after failed fixes, or asks to debug/fix a bug.'
|
|
4
|
+
argument-hint: "[issue reference, error message, test path, or description of broken behavior]"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Debug and Fix
|
|
8
|
+
|
|
9
|
+
<!--
|
|
10
|
+
FNXC:CompoundEngineering 2026-07-01-13:43:
|
|
11
|
+
When this skill runs inside the Compound Engineering dashboard, the host interactive-session protocol is authoritative. Ask clarifying or handoff questions by returning the host's JSON question object, and finish by returning the host's JSON complete object; do not emit prose-only turns or blocking question tool calls at the dashboard seam.
|
|
12
|
+
-->
|
|
13
|
+
|
|
14
|
+
Find root causes, then fix them. This skill investigates bugs systematically — tracing the full causal chain before proposing a fix — and optionally implements the fix with test-first discipline.
|
|
15
|
+
|
|
16
|
+
<bug_description> #$ARGUMENTS </bug_description>
|
|
17
|
+
|
|
18
|
+
## Core Principles
|
|
19
|
+
|
|
20
|
+
1. **Investigate before fixing.** Do not propose a fix until you can explain the full causal chain from trigger to symptom with no gaps. "Somehow X leads to Y" is a gap.
|
|
21
|
+
2. **Predictions for uncertain links.** When the causal chain has uncertain or non-obvious links, form a prediction — something in a different code path or scenario that must also be true. If the prediction is wrong but a fix "works," you found a symptom, not the cause. When the chain is obvious (missing import, clear null reference), the chain explanation itself is sufficient.
|
|
22
|
+
3. **One change at a time.** Test one hypothesis, change one thing. If you're changing multiple things to "see if it helps," stop — that is shotgun debugging.
|
|
23
|
+
4. **When stuck, diagnose why — don't just try harder.**
|
|
24
|
+
|
|
25
|
+
## Execution Flow
|
|
26
|
+
|
|
27
|
+
| Phase | Name | Purpose |
|
|
28
|
+
|-------|------|---------|
|
|
29
|
+
| 0 | Triage | Parse input, fetch issue if referenced, proceed to investigation |
|
|
30
|
+
| 1 | Investigate | Reproduce the bug, trace the code path |
|
|
31
|
+
| 2 | Root Cause | Form hypotheses with predictions for uncertain links, test them, **causal chain gate**, smart escalation |
|
|
32
|
+
| 3 | Fix | Only if user chose to fix. Test-first fix with workspace safety checks |
|
|
33
|
+
| 4 | Handoff | Structured summary, then prompt the user for the next action |
|
|
34
|
+
|
|
35
|
+
Beyond the trivial-bug fast-path in Phase 0, no further phase skipping — complex bugs simply spend more time in each phase naturally. No further complexity tiers.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
### Phase 0: Triage
|
|
40
|
+
|
|
41
|
+
Parse the input and reach a clear problem statement.
|
|
42
|
+
|
|
43
|
+
**If the input references an issue tracker**, fetch it:
|
|
44
|
+
- GitHub (`#123`, `org/repo#123`, github.com URL): Parse the issue reference from `<bug_description>` and fetch with `gh issue view <number> --json title,body,comments,labels`. For URLs, pass the URL directly to `gh`.
|
|
45
|
+
- Other trackers (Linear URL/ID, Jira URL/key, any tracker URL): Attempt to fetch using available MCP tools or by fetching the URL content. If the fetch fails — auth, missing tool, non-public page — ask the user to paste the relevant issue content. Ensure the fetch includes the full comment thread, not just the opening description.
|
|
46
|
+
|
|
47
|
+
Read the full conversation — the original description AND every comment, with particular attention to the latest ones. Comments frequently contain updated reproduction steps, narrowed scope, prior failed attempts, additional stack traces, or a pivot to a different suspected root cause; treating the opening post as the whole picture often sends the investigation in the wrong direction. Extract reported symptoms, expected behavior, reproduction steps, and environment details from the combined thread. Then proceed to Phase 1.
|
|
48
|
+
|
|
49
|
+
**Everything else** (stack traces, test paths, error messages, descriptions of broken behavior): the problem statement is the input itself.
|
|
50
|
+
|
|
51
|
+
**Trivial-bug fast-path:** Once the problem is clear, decide whether the framework is needed at all. If the cause is immediately readable from the input (single-file typo, missing import, obvious null deref or off-by-one with a one-line fix) and verification doesn't require deep tracing, present the cause and the proposed one-line fix and run Phase 2's **Fix it now / Diagnosis only** user-choice gate before editing — the fast-path saves investigation ceremony, not the user's choice over whether to apply a fix. If the user picks fix, run Phase 3's **Workspace and branch check** (uncommitted-work confirmation and default-branch branch-creation prompt), apply the fix, leave a one-line note explaining the cause, and skip to Phase 4's structured summary. If diagnosis only, write the summary and stop. When in doubt, run the full framework; getting the wrong root cause costs more than the few minutes of ceremony.
|
|
52
|
+
|
|
53
|
+
**Otherwise**, proceed to Phase 1.
|
|
54
|
+
|
|
55
|
+
**Questions:**
|
|
56
|
+
- Do not ask questions by default — investigate first (read code, run tests, trace errors)
|
|
57
|
+
- Only ask when a genuine ambiguity blocks investigation and cannot be resolved by reading code or running tests
|
|
58
|
+
- When asking, ask one specific question
|
|
59
|
+
|
|
60
|
+
**Prior-attempt awareness:** If the user indicates prior failed attempts ("I've been trying", "keeps failing", "stuck"), ask what they have already tried before investigating. This avoids repeating failed approaches and is one of the few cases where asking first is the right call.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
### Phase 1: Investigate
|
|
65
|
+
|
|
66
|
+
#### 1.1 Reproduce the bug
|
|
67
|
+
|
|
68
|
+
Confirm the bug exists and understand its behavior. Run the test, trigger the error, follow reported reproduction steps — whatever matches the input.
|
|
69
|
+
|
|
70
|
+
- **Browser bugs:** Prefer `agent-browser` if installed. Otherwise use whatever works — MCP browser tools, direct URL testing, screenshot capture, etc.
|
|
71
|
+
- **Manual setup required:** If reproduction needs specific conditions the agent cannot create alone (data states, user roles, external services, environment config), document the exact setup steps and guide the user through them. Clear step-by-step instructions save significant time even when the process is fully manual.
|
|
72
|
+
- **Does not reproduce after 2-3 attempts:** Read `references/investigation-techniques.md` for intermittent-bug techniques.
|
|
73
|
+
- **Cannot reproduce at all in this environment:** Document what was tried and what conditions appear to be missing.
|
|
74
|
+
- **Writing the reproduction test:** If the project has testing-conventions guidance — a dedicated testing skill, an `AGENTS.md`/`CLAUDE.md` testing section, or a clear style across existing tests — apply it when authoring the failing test. Otherwise write a minimal isolated test that fails on the current bug and passes once the corrected behavior lands; name it descriptively so the failure message itself explains the bug.
|
|
75
|
+
|
|
76
|
+
#### 1.2 Verify environment sanity
|
|
77
|
+
|
|
78
|
+
Before deep code tracing, confirm the environment is what you think it is:
|
|
79
|
+
|
|
80
|
+
- Correct branch checked out; no unintended uncommitted changes
|
|
81
|
+
- Dependencies installed and up to date (`bun install`, `npm install`, `bundle install`, etc.) — stale `node_modules`/`vendor` is a frequent false lead
|
|
82
|
+
- Expected interpreter or runtime version (check `.tool-versions`, `.nvmrc`, `Gemfile`, etc. against what's actually active)
|
|
83
|
+
- Required env vars present and non-empty
|
|
84
|
+
- No stale build artifacts (`dist/`, `.next/`, compiled binaries from an earlier branch)
|
|
85
|
+
- Dependent local services (database, cache, queue) running at expected versions *when the bug plausibly involves them*
|
|
86
|
+
|
|
87
|
+
#### 1.3 Trace the code path
|
|
88
|
+
|
|
89
|
+
Trace data flow backward from the symptom to where valid state first became invalid. Read code-shape to form a hypothesis, then verify with observed values — do not theorize from code alone.
|
|
90
|
+
|
|
91
|
+
Concrete recipe:
|
|
92
|
+
|
|
93
|
+
1. Read the stack trace bottom-to-top, opening each frame's source. The bottom frame is the symptom; the root cause is somewhere upstream.
|
|
94
|
+
2. Identify the first frame where the input data is already invalid — that's the upper bound on where to look.
|
|
95
|
+
3. Instrument the boundaries around that frame: targeted log/print statements, debugger breakpoints, or test assertions that capture *actual* values at function entry/exit. Assumed values lie; observed values don't.
|
|
96
|
+
4. Walk the boundaries until valid input becomes invalid output. That transition is the root cause site.
|
|
97
|
+
|
|
98
|
+
Do not stop at the first function that looks wrong — the root cause is where bad state originates, not where it is first observed.
|
|
99
|
+
|
|
100
|
+
As you trace:
|
|
101
|
+
- Check recent changes in files you are reading: `git log --oneline -10 -- [file]`
|
|
102
|
+
- If the bug looks like a regression ("it worked before"), use `git bisect` (see `references/investigation-techniques.md`)
|
|
103
|
+
- Check the project's observability tools for additional evidence:
|
|
104
|
+
- Error trackers (Sentry, AppSignal, Datadog, BetterStack, Bugsnag)
|
|
105
|
+
- Application logs
|
|
106
|
+
- Browser console output
|
|
107
|
+
- Database state
|
|
108
|
+
- Each project has different systems available; use whatever gives a more complete picture
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
### Phase 2: Root Cause
|
|
113
|
+
|
|
114
|
+
*Reminder: investigate before fixing. Do not propose a fix until you can explain the full causal chain from trigger to symptom with no gaps.*
|
|
115
|
+
|
|
116
|
+
Read `references/anti-patterns.md` before forming hypotheses. As a load-time preview of the rationalizations it covers, stop and re-examine if the internal monologue contains any of these:
|
|
117
|
+
|
|
118
|
+
- "Quick fix for now, investigate later"
|
|
119
|
+
- "This should work" (without a tested prediction)
|
|
120
|
+
- "Let me just try..." (without a hypothesis)
|
|
121
|
+
|
|
122
|
+
These phrases mark mode-drift toward symptom patches, not progress on the root cause. ("One more attempt" after a failed fix and "works on my machine" are covered at the points they fire — Phase 3's invalidation step and the Smart Escalation table below.)
|
|
123
|
+
|
|
124
|
+
**Assumption audit (before hypothesis formation):** List the concrete "this must be true" beliefs your understanding depends on — the framework behaves as expected here, this function returns what its name implies, the config loads before this runs, the caller passes a non-null value, the database is in the state the test implies. For each, mark *verified* (you read the code, checked state, or ran it) or *assumed*. Assumptions are the most common source of stuck debugging. Many "wrong hypotheses" are actually correct hypotheses tested against a wrong assumption.
|
|
125
|
+
|
|
126
|
+
**Form hypotheses** ranked by likelihood. For each, state:
|
|
127
|
+
- What is wrong and where (file:line)
|
|
128
|
+
- **At least one concrete observation that supports it** — a runtime variable value, a log line, an instrumented boundary capture, a behavior delta against a working comparison case, or a specific code reference. "X seems off" is not evidence; "X equals null at line 42 because Y was never initialized in the constructor path that runs under condition Z" is. Hypotheses without grounding observations are theorizing — go back to Phase 1 and instrument.
|
|
129
|
+
- The causal chain: how the trigger leads to the observed symptom, step by step
|
|
130
|
+
- **For uncertain links in the chain**: a prediction — something in a different code path or scenario that must also be true if this link is correct
|
|
131
|
+
|
|
132
|
+
When the causal chain is obvious and has no uncertain links (missing import, clear type error, explicit null dereference), the chain explanation itself is the gate — no prediction required. Predictions are a tool for testing uncertain links, not a ritual for every hypothesis.
|
|
133
|
+
|
|
134
|
+
Before forming a new hypothesis, review what has already been ruled out and why.
|
|
135
|
+
|
|
136
|
+
**Causal chain gate:** Do not proceed to Phase 3 until you can explain the full causal chain — from the original trigger through every step to the observed symptom — with no gaps. The user can explicitly authorize proceeding with the best-available hypothesis if investigation is stuck.
|
|
137
|
+
|
|
138
|
+
*Reminder: if a prediction was wrong but the fix appears to work, you found a symptom. The real cause is still active.*
|
|
139
|
+
|
|
140
|
+
#### Present findings
|
|
141
|
+
|
|
142
|
+
Once the root cause is confirmed, present:
|
|
143
|
+
- The root cause (causal chain summary with file:line references)
|
|
144
|
+
- The proposed fix and which files would change
|
|
145
|
+
- Which tests to add or modify to prevent recurrence (specific test file, test case description, what the assertion should verify)
|
|
146
|
+
- Whether existing tests should have caught this and why they did not
|
|
147
|
+
|
|
148
|
+
Then offer next steps.
|
|
149
|
+
|
|
150
|
+
Use the platform's blocking question tool (`AskUserQuestion` in Claude Code, `request_user_input` in Codex, `ask_question` in Antigravity CLI (`agy`), `ask_user` in Pi (requires the `pi-ask-user` extension)). In Claude Code, call `ToolSearch` with `select:AskUserQuestion` first if its schema isn't loaded — a pending schema load is not a reason to fall back. Fall back to numbered options in chat only when no blocking tool exists in the harness or the call errors (e.g., Codex edit modes). Never silently skip the question.
|
|
151
|
+
|
|
152
|
+
Options to offer:
|
|
153
|
+
|
|
154
|
+
1. **Fix it now** — proceed to Phase 3
|
|
155
|
+
2. **Diagnosis only — I'll take it from here** — skip the fix, proceed to Phase 4's summary, and end the skill
|
|
156
|
+
3. **Rethink the design** (`/ce-brainstorm`) — only when the root cause reveals a design problem (see below)
|
|
157
|
+
|
|
158
|
+
Do not assume the user wants action right now. The test recommendations are part of the diagnosis regardless of which path is chosen.
|
|
159
|
+
|
|
160
|
+
**When to suggest brainstorm:** Only when investigation reveals the bug cannot be properly fixed within the current design — the design itself needs to change. Concrete signals observable during debugging:
|
|
161
|
+
|
|
162
|
+
- **The root cause is a wrong responsibility or interface**, not wrong logic. The module should not be doing this at all, or the boundary between components is in the wrong place. (Observable: the fix requires moving responsibility between modules, not correcting code within one.)
|
|
163
|
+
- **The requirements are wrong or incomplete.** The system behaves as designed, but the design does not match what users actually need. The "bug" is really a product gap. (Observable: the code is doing exactly what it was written to do — the spec is the problem.)
|
|
164
|
+
- **Every fix is a workaround.** You can patch the symptom, but cannot articulate a clean fix because the surrounding code was built on an assumption that no longer holds. (Observable: you keep wanting to add special cases or flags rather than a direct correction.)
|
|
165
|
+
|
|
166
|
+
Do not suggest brainstorm for bugs that are large but have a clear fix — size alone does not make something a design problem.
|
|
167
|
+
|
|
168
|
+
#### Smart escalation
|
|
169
|
+
|
|
170
|
+
If 2-3 hypotheses are exhausted without confirmation, diagnose why:
|
|
171
|
+
|
|
172
|
+
| Pattern | Diagnosis | Next move |
|
|
173
|
+
|---------|-----------|-----------|
|
|
174
|
+
| Hypotheses point to different subsystems | Architecture/design problem, not a localized bug | Present findings, suggest `/ce-brainstorm` |
|
|
175
|
+
| Evidence contradicts itself | Wrong mental model of the code | Step back, re-read the code path without assumptions |
|
|
176
|
+
| Works locally, fails in CI/prod | Environment problem | Focus on env differences, config, dependencies, timing |
|
|
177
|
+
| Fix works but prediction was wrong | Symptom fix, not root cause | The real cause is still active — keep investigating |
|
|
178
|
+
|
|
179
|
+
**Parallel investigation option:** When hypotheses are evidence-bottlenecked across clearly independent subsystems, dispatch read-only sub-agents in parallel, each with an explicit hypothesis and structured evidence-return format. No code edits by sub-agents, and skip this when hypotheses depend on each other's outcomes. If the platform does not support parallel sub-agent dispatch, run the same hypothesis probes sequentially in ranked-likelihood order instead — the parallelism is a latency optimization, not a correctness requirement.
|
|
180
|
+
|
|
181
|
+
Present the diagnosis to the user before proceeding.
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
### Phase 3: Fix
|
|
186
|
+
|
|
187
|
+
*Reminder: one change at a time. If you are changing multiple things, stop.*
|
|
188
|
+
|
|
189
|
+
If the user chose "Diagnosis only" at the end of Phase 2, skip this phase and go straight to Phase 4 for the summary — the skill's job was the diagnosis. If they chose "Rethink the design", control has transferred to `/ce-brainstorm` and this skill ends.
|
|
190
|
+
|
|
191
|
+
**Workspace and branch check:** Before editing files:
|
|
192
|
+
|
|
193
|
+
- Check for uncommitted changes (`git status`). If the user has unstaged work in files that need modification, confirm before editing — do not overwrite in-progress changes.
|
|
194
|
+
- If the current branch is the default branch, ask whether to create a feature branch first using the platform's blocking question tool (see Phase 2 for the per-platform names). To detect the default branch, compare against `main`, `master`, or the value of `git rev-parse --abbrev-ref origin/HEAD` with its `origin/` prefix stripped (the raw output is `origin/<name>`, so an unstripped comparison will never match the local branch name). Default to creating one; derive a name from the bug and run `git checkout -b <name>`. On any other branch, proceed.
|
|
195
|
+
|
|
196
|
+
**Test-first:**
|
|
197
|
+
1. Write a failing test that captures the bug (or use the existing failing test)
|
|
198
|
+
2. Verify it fails for the right reason — the root cause, not unrelated setup
|
|
199
|
+
3. Implement the minimal fix — address the root cause and nothing else. Do not bundle drive-by refactors, formatting, or unrelated cleanup into a bug-fix change; those belong in separate commits.
|
|
200
|
+
4. Verify the test passes
|
|
201
|
+
5. Run the broader test suite for regressions
|
|
202
|
+
6. Self-review the diff before declaring the fix done: read every changed line and check for style violations, missed edge cases, regressions in adjacent behavior, and missing test coverage for the fix. For non-trivial fixes (multiple files, risky surface area), also run the harness's lightweight review tool (e.g., `/review` in Claude Code; the equivalent in other harnesses) — not the full `ce-code-review` multi-agent flow, which is PR-tier and over-sized for a single bug fix.
|
|
203
|
+
|
|
204
|
+
**On a failed fix:** return to Phase 2 and *explicitly invalidate the current hypothesis* before forming a new one. State out loud what evidence ruled out the prior hypothesis, then form a new one with its own grounding observation and prediction. Do not retry variants of the same theory ("maybe it was the other branch", "let me also catch this case") — that is the rationalization spiral, not iteration.
|
|
205
|
+
|
|
206
|
+
**3 failed fix attempts = smart escalation.** Diagnose using the same table from Phase 2. If fixes keep failing, the root cause identification was likely wrong. Return to Phase 2.
|
|
207
|
+
|
|
208
|
+
**Conditional defense-in-depth** (trigger: grep for the root-cause pattern found it in 3+ other files, OR the bug would have been catastrophic if it reached production): Read `references/defense-in-depth.md` for the four-layer model (entry validation, invariant check, environment guard, diagnostic breadcrumb) and choose which layers apply. Skip when the root cause is a one-off error with no realistic recurrence path.
|
|
209
|
+
|
|
210
|
+
**Conditional post-mortem** (trigger: the bug was in production, OR the pattern appears in 3+ locations):
|
|
211
|
+
Analyze how this was introduced and what allowed it to survive. Note any systemic gap or repeated pattern found — it informs Phase 4's decision on whether to offer learning capture.
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
### Phase 4: Handoff
|
|
216
|
+
|
|
217
|
+
**Structured summary** — always write this first:
|
|
218
|
+
|
|
219
|
+
```
|
|
220
|
+
## Debug Summary
|
|
221
|
+
**Problem**: [What was broken]
|
|
222
|
+
**Root Cause**: [Full causal chain, with file:line references]
|
|
223
|
+
**Recommended Tests**: [Tests to add/modify to prevent recurrence, with specific file and assertion guidance]
|
|
224
|
+
**Fix**: [What was changed — or "diagnosis only" if Phase 3 was skipped]
|
|
225
|
+
**Prevention**: [Test coverage added; defense-in-depth if applicable]
|
|
226
|
+
**Confidence**: [High/Medium/Low]
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
**If Phase 3 was skipped** (user chose "Diagnosis only" in Phase 2), stop after the summary — the user already told you they were taking it from here. Do not prompt.
|
|
230
|
+
|
|
231
|
+
**If Phase 3 ran**, the next move depends on whether the skill created the branch in Phase 3.
|
|
232
|
+
|
|
233
|
+
#### Skill-owned branch (created in Phase 3): default to commit-and-PR without prompting
|
|
234
|
+
|
|
235
|
+
1. **Check for contextual overrides first.** Look at the user's original prompt, loaded memories, and the project's active instructions already in your context for preferences that conflict with auto commit-and-PR — for example, "always review before pushing", "open PRs as drafts", or "don't open PRs from skills". A signal must be an explicit instruction or a clearly applicable rule, not a vague tonal cue. If any apply, honor them — switch to the pre-existing-branch menu below, or skip the PR step entirely, whichever matches the user's stated preference.
|
|
236
|
+
2. **Briefly preview what will happen** — what will be committed, on what branch, and that a PR will be opened — then proceed without waiting for confirmation. The preview exists so the user can interrupt; it is not a blocking question. Format and length are your call; keep it scannable.
|
|
237
|
+
3. **Run `/ce-commit-push-pr`.** When the entry came from an issue tracker, include the appropriate auto-close syntax for that tracker in the location it requires — most trackers parse PR descriptions (e.g., `Fixes #N` for GitHub, `Closes ABC-123` for Linear), but some only parse commit messages (e.g., Jira Smart Commits) — so the diagnosis and fix flow back to the issue and it closes on merge. Surface the resulting PR URL.
|
|
238
|
+
|
|
239
|
+
#### Pre-existing branch (skill did not create it): ask the user
|
|
240
|
+
|
|
241
|
+
Use the platform's blocking question tool (`AskUserQuestion` in Claude Code, `request_user_input` in Codex, `ask_question` in Antigravity CLI (`agy`), `ask_user` in Pi (requires the `pi-ask-user` extension)). In Claude Code, call `ToolSearch` with `select:AskUserQuestion` first if its schema isn't loaded — a pending schema load is not a reason to fall back. Fall back to numbered options in chat only when no blocking tool exists in the harness or the call errors. Never end the phase without collecting a response.
|
|
242
|
+
|
|
243
|
+
Options:
|
|
244
|
+
|
|
245
|
+
1. **Commit and open a PR (`/ce-commit-push-pr`)** — default for most cases
|
|
246
|
+
2. **Commit the fix (`/ce-commit`)** — local commit only
|
|
247
|
+
3. **Stop here** — user takes it from there
|
|
248
|
+
|
|
249
|
+
#### After a PR is open (either path): consider offering learning capture
|
|
250
|
+
|
|
251
|
+
Most bugs are localized mechanical fixes (typo, missed null check, missing import) where the only "lesson" is the bug itself. Compounding those clutters `docs/solutions/` without adding value. Decide which path applies:
|
|
252
|
+
|
|
253
|
+
- **Skip silently** when the fix is mechanical and there's no generalizable insight. Default to this when in doubt.
|
|
254
|
+
- **Offer neutrally** when the lesson can be stated in one sentence — e.g., "X.foo() returns T | undefined when Y, not just T", or "the diagnostic path was non-obvious and worth recording." If you cannot articulate the lesson, skip rather than offer.
|
|
255
|
+
- **Lean into the offer** when the pattern appears in 3+ locations OR the root cause reveals a wrong assumption about a shared dependency, framework, or convention that other code is likely to repeat.
|
|
256
|
+
|
|
257
|
+
When offering, use the blocking question tool described above. If the user accepts, run `/ce-compound`, then commit the resulting learning doc to the same branch and push so the open PR picks up the new commit.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Debugging Anti-Patterns
|
|
2
|
+
|
|
3
|
+
Read this before forming hypotheses. These patterns describe the most common ways debugging goes wrong. They feel productive in the moment — that is what makes them dangerous.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Prediction Quality
|
|
8
|
+
|
|
9
|
+
The prediction requirement exists to prevent symptom-fixing. A prediction tests whether your understanding of the bug is correct, not just whether a fix makes the error go away.
|
|
10
|
+
|
|
11
|
+
**Bad prediction (restates the hypothesis):**
|
|
12
|
+
> Hypothesis: The null pointer is because `user` is not initialized.
|
|
13
|
+
> Prediction: `user` will be null when I log it.
|
|
14
|
+
|
|
15
|
+
This just re-describes the symptom. It cannot be wrong if the hypothesis is right — so it cannot catch a wrong hypothesis.
|
|
16
|
+
|
|
17
|
+
**Good prediction (tests something non-obvious):**
|
|
18
|
+
> Hypothesis: The null pointer is because the auth middleware skips initialization on cached requests.
|
|
19
|
+
> Prediction: Non-cached requests to the same endpoint will NOT produce the null pointer, and the `X-Cache` header will be present on failing requests.
|
|
20
|
+
|
|
21
|
+
This tests a different code path and a different observable. If the prediction is wrong — cached and non-cached requests both fail — the hypothesis is wrong even if "initializing user earlier" happens to fix the immediate error.
|
|
22
|
+
|
|
23
|
+
**Rule of thumb:** A good prediction names something you have not looked at yet. If confirming the prediction requires only looking at the same line of code you already identified, the prediction is not adding information.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Shotgun Debugging
|
|
28
|
+
|
|
29
|
+
Changing multiple things at once to "see if it helps."
|
|
30
|
+
|
|
31
|
+
**How it feels:** Productive. You're making changes, running tests, making progress.
|
|
32
|
+
|
|
33
|
+
**What actually happens:** If the bug goes away, you do not know which change fixed it. If it persists, you do not know which changes are relevant. You have introduced variables instead of eliminating them.
|
|
34
|
+
|
|
35
|
+
**The fix:** One hypothesis, one change, one test. If the first change does not fix it, revert it before trying the next. Changes should be additive to understanding, not cumulative to the codebase.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Confirmation Bias
|
|
40
|
+
|
|
41
|
+
Interpreting ambiguous evidence as supporting your current hypothesis.
|
|
42
|
+
|
|
43
|
+
**How it looks:**
|
|
44
|
+
- A log line that *could* support your theory — you treat it as proof
|
|
45
|
+
- A test passes after your change — you declare the bug fixed without checking if the test was actually exercising the failure path
|
|
46
|
+
- The error message changes slightly — you interpret the change as "getting closer" instead of recognizing a different failure mode
|
|
47
|
+
|
|
48
|
+
**The defense:** Before declaring a hypothesis confirmed, ask: "What evidence would DISPROVE this hypothesis?" If you cannot name something that would change your mind, you are not testing — you are justifying.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## "It Works Now, Move On"
|
|
53
|
+
|
|
54
|
+
The bug stops appearing after a change. The temptation is to declare victory and move on.
|
|
55
|
+
|
|
56
|
+
**When this is a trap:** If you cannot explain WHY the change fixed the bug — the full causal chain from your change through the system to the symptom — you may have:
|
|
57
|
+
- Fixed a symptom while the root cause remains
|
|
58
|
+
- Introduced a change that masks the bug without resolving it
|
|
59
|
+
- Gotten lucky with timing (especially for intermittent bugs)
|
|
60
|
+
|
|
61
|
+
**The test:** Can you explain the fix to someone else without using the words "somehow" or "I think"? If not, the root cause is not confirmed.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Thoughts That Signal You Are About to Shortcut
|
|
66
|
+
|
|
67
|
+
These feel like reasonable next steps. They are warning signs that investigation is being skipped.
|
|
68
|
+
|
|
69
|
+
**Proposing a fix before explaining the cause.** If the words "I think we should change..." come before "the root cause is...", pause. The fix might be right, but without a confirmed causal chain there is no way to know. Explain the cause first.
|
|
70
|
+
|
|
71
|
+
**Reaching for another attempt without new information.** After 2-3 failed hypotheses, trying a 4th without learning something new from the failures is not debugging — it is guessing with increasing frustration. Stop and diagnose why previous hypotheses failed (see smart escalation).
|
|
72
|
+
|
|
73
|
+
**Certainty without evidence.** The feeling of "I know what this is" before reading the relevant code. Experienced developers have strong pattern-matching instincts, and they are right often enough to be dangerous when wrong. Read the code even when you are confident.
|
|
74
|
+
|
|
75
|
+
**Minimizing the scope.** "It is probably just..." — the word "just" signals an assumption that the problem is small. Small problems do not resist 2-3 fix attempts. If you are still debugging, it is not "just" anything.
|
|
76
|
+
|
|
77
|
+
**Treating environmental differences as irrelevant.** When something works in one environment and fails in another, the difference between environments IS the investigation. Do not dismiss it — compare them systematically.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Smart Escalation Patterns
|
|
82
|
+
|
|
83
|
+
When 2-3 hypotheses have been tested and none confirmed, the problem is not "I need hypothesis #4." The problem is usually one of these:
|
|
84
|
+
|
|
85
|
+
**Different subsystems keep appearing.** Hypothesis 1 pointed to auth, hypothesis 2 to the database, hypothesis 3 to caching. This scatter pattern means the bug is not in any one subsystem — it is in the interaction between them, or in an architectural assumption that cuts across all of them. This is a design problem, not a localized bug.
|
|
86
|
+
|
|
87
|
+
**Evidence contradicts itself.** The logs say X happened, but the code makes X impossible. The test fails with error A, but the code path that produces error A is unreachable from the test. When evidence contradicts, the mental model is wrong. Step back. Re-read the code from the entry point without any assumptions about what it does.
|
|
88
|
+
|
|
89
|
+
**Works locally, fails elsewhere.** The most common causes: environment variables, dependency versions, file system differences (case sensitivity, path separators), timing differences (faster/slower machines), and data differences (test fixtures vs production data). Systematically compare the two environments rather than debugging the code.
|
|
90
|
+
|
|
91
|
+
**Fix works but prediction was wrong.** This is the most dangerous pattern. The bug appears fixed, but the causal chain you identified was incorrect. The real cause is still present and will resurface. Keep investigating — you found a coincidental fix, not the root cause.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Defense-in-Depth
|
|
2
|
+
|
|
3
|
+
When a bug is caused by invalid state reaching a vulnerable code path, fixing just one layer leaves the door open for different code paths, refactors, or mocks to re-introduce the same bug. Defense-in-depth makes the bug structurally harder to re-create by validating at multiple layers.
|
|
4
|
+
|
|
5
|
+
Not every bug warrants this. Use when:
|
|
6
|
+
|
|
7
|
+
- The root-cause pattern exists in 3+ other files (grep the fix signature)
|
|
8
|
+
- The bug would have been catastrophic in production
|
|
9
|
+
- The vulnerable operation is dangerous regardless of caller (destructive side effects, security-sensitive, irreversible)
|
|
10
|
+
|
|
11
|
+
Skip when the root cause is a one-off logic error with no realistic recurrence path.
|
|
12
|
+
|
|
13
|
+
## The four layers
|
|
14
|
+
|
|
15
|
+
Pick the layers that apply. Not every bug needs all four.
|
|
16
|
+
|
|
17
|
+
| Layer | Purpose | Apply when | Example |
|
|
18
|
+
|-------|---------|------------|---------|
|
|
19
|
+
| 1. Entry validation | Reject obviously invalid input at the API boundary | The bug was caused by a caller passing bad data that should have been rejected | Throw if `workingDirectory` is empty or doesn't exist, before any downstream code touches it |
|
|
20
|
+
| 2. Invariant / business-logic check | Enforce that data makes sense for this operation | The operation has preconditions that entry validation cannot express | Assert `user.state === 'verified'` before issuing a password reset |
|
|
21
|
+
| 3. Environment guard | Refuse dangerous operations in contexts where they make no sense | The operation can be catastrophic if run in the wrong environment | In tests (`NODE_ENV === 'test'`), refuse `git init` outside the OS temp dir |
|
|
22
|
+
| 4. Diagnostic breadcrumb | Capture forensic context before the risky operation | Other layers might still be bypassed; future failures need evidence | Log `{ directory, cwd, env, stack }` immediately before `git init` |
|
|
23
|
+
|
|
24
|
+
## Applying the pattern
|
|
25
|
+
|
|
26
|
+
1. Trace the data flow from the bad value's origin through every function that passed it along.
|
|
27
|
+
2. Map the checkpoints: at which of those points could validation have rejected the bad value earlier?
|
|
28
|
+
3. Add guards at the appropriate layers. Each guard should be as narrow as possible — validating exactly what this layer is responsible for, not duplicating checks from other layers.
|
|
29
|
+
4. Test each guard independently: construct a case that bypasses layer 1 and verify layer 2 still catches it.
|
|
30
|
+
|
|
31
|
+
## Common mistakes
|
|
32
|
+
|
|
33
|
+
- **Duplicating the same check at every layer.** Each layer should catch a distinct class of failure. If layer 2 just repeats layer 1, the second one is noise.
|
|
34
|
+
- **Adding guards speculatively without a bug to justify them.** Defense-in-depth is a response to an observed failure mode, not a generic code-hygiene practice.
|
|
35
|
+
- **Leaving layer 4 (diagnostic breadcrumb) out.** When layers 1-3 still get bypassed — they will, eventually — the breadcrumb is what makes the next bug debuggable.
|