codebaseiq 0.1.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/CHANGELOG.md +481 -0
- package/LICENSE +202 -0
- package/README.md +349 -0
- package/dist/augment-vue-worker.js +2 -0
- package/dist/call-graph-evidence-gNsxjCW8.d.ts +16 -0
- package/dist/change-analysis-types-CCtoCHbC.d.ts +9 -0
- package/dist/chunk-2Q2LW5JW.js +14 -0
- package/dist/chunk-2X7V4HS4.js +88 -0
- package/dist/chunk-34WBMAYK.js +2 -0
- package/dist/chunk-35NLDRZC.js +2 -0
- package/dist/chunk-362QOSFD.js +3 -0
- package/dist/chunk-3IER7Q6H.js +12 -0
- package/dist/chunk-3JSXXYTZ.js +345 -0
- package/dist/chunk-3LCDIREB.js +4 -0
- package/dist/chunk-476NR5B7.js +2 -0
- package/dist/chunk-4FC325IF.js +30 -0
- package/dist/chunk-4WKDMDEW.js +9 -0
- package/dist/chunk-4XTAUQFD.js +2 -0
- package/dist/chunk-5PUWMSDU.js +26 -0
- package/dist/chunk-5VKBFZZU.js +3 -0
- package/dist/chunk-6BQ3DSPK.js +2 -0
- package/dist/chunk-6CS3UQTN.js +3 -0
- package/dist/chunk-6MUIJMVL.js +6 -0
- package/dist/chunk-6NW7MU72.js +40 -0
- package/dist/chunk-6OAHRI2D.js +6 -0
- package/dist/chunk-6YTSKJJ3.js +2 -0
- package/dist/chunk-7FND7D7N.js +2 -0
- package/dist/chunk-7MGU3HPH.js +2 -0
- package/dist/chunk-7NVGT435.js +2 -0
- package/dist/chunk-7XAN6GKB.js +2 -0
- package/dist/chunk-AAQQPKCU.js +2 -0
- package/dist/chunk-ADTBPVUZ.js +21 -0
- package/dist/chunk-AKB7V7TV.js +2 -0
- package/dist/chunk-ANFVSJWQ.js +11 -0
- package/dist/chunk-B2OB55RR.js +3 -0
- package/dist/chunk-B3UYV66Z.js +4 -0
- package/dist/chunk-B75HZHUP.js +2 -0
- package/dist/chunk-BFFZDZQV.js +2 -0
- package/dist/chunk-BGBBVSH4.js +2 -0
- package/dist/chunk-BH5F2Q4O.js +2 -0
- package/dist/chunk-BJ6SQAEN.js +2 -0
- package/dist/chunk-BMYOV5GP.js +77 -0
- package/dist/chunk-BVAJLC5A.js +7 -0
- package/dist/chunk-C6SBF2WH.js +4 -0
- package/dist/chunk-C74PPYLA.js +3 -0
- package/dist/chunk-C7QOQX32.js +8 -0
- package/dist/chunk-CAUCPUOF.js +7 -0
- package/dist/chunk-CO5R3UNA.js +2 -0
- package/dist/chunk-CQP3THUZ.js +7 -0
- package/dist/chunk-CVYSU6BX.js +16 -0
- package/dist/chunk-CWONGW6P.js +3 -0
- package/dist/chunk-DDZ7VHWV.js +20 -0
- package/dist/chunk-DGXRDLV5.js +2 -0
- package/dist/chunk-DO6WQD2T.js +3 -0
- package/dist/chunk-DQMDCD24.js +2 -0
- package/dist/chunk-DR2LURYU.js +3 -0
- package/dist/chunk-DRENNWRG.js +2 -0
- package/dist/chunk-ECQBG7PW.js +564 -0
- package/dist/chunk-EF2R3WNQ.js +2 -0
- package/dist/chunk-ELNRLMC5.js +29 -0
- package/dist/chunk-EMNIHCRB.js +18 -0
- package/dist/chunk-ENCCHKM6.js +5 -0
- package/dist/chunk-EZNMUY67.js +5 -0
- package/dist/chunk-FAJQ7LWY.js +3 -0
- package/dist/chunk-FDGD5AB5.js +2 -0
- package/dist/chunk-FETNQCFO.js +117 -0
- package/dist/chunk-FM5BPL4V.js +60 -0
- package/dist/chunk-FQKZWM4L.js +49 -0
- package/dist/chunk-FW53T7EB.js +2 -0
- package/dist/chunk-G6XFR4ZL.js +4 -0
- package/dist/chunk-GCHRX4YW.js +4 -0
- package/dist/chunk-GTIYTDRE.js +562 -0
- package/dist/chunk-GTXSJDCO.js +2 -0
- package/dist/chunk-GW6Z3WGY.js +2 -0
- package/dist/chunk-H3LGFZVK.js +2 -0
- package/dist/chunk-HKQUXIFO.js +2 -0
- package/dist/chunk-HOA5YGOH.js +3 -0
- package/dist/chunk-HPJRBHVT.js +3 -0
- package/dist/chunk-HRWGYWRJ.js +49 -0
- package/dist/chunk-I2T2LLK2.js +4 -0
- package/dist/chunk-ICFDQHAM.js +3 -0
- package/dist/chunk-ID63777H.js +4 -0
- package/dist/chunk-IJ4HMYBE.js +3 -0
- package/dist/chunk-ILMHV3KM.js +2 -0
- package/dist/chunk-IOP6FWIM.js +2 -0
- package/dist/chunk-IRQOAM5G.js +2 -0
- package/dist/chunk-J77SU6VA.js +38 -0
- package/dist/chunk-JE3WZ6II.js +2 -0
- package/dist/chunk-JEJLSICM.js +4 -0
- package/dist/chunk-JOIRNPPY.js +2 -0
- package/dist/chunk-JSOYNVWH.js +3 -0
- package/dist/chunk-KMITESMT.js +2 -0
- package/dist/chunk-KUW32IRO.js +2 -0
- package/dist/chunk-KWVHSKHK.js +31 -0
- package/dist/chunk-L4NRUAGJ.js +18 -0
- package/dist/chunk-L57ZKWVG.js +6 -0
- package/dist/chunk-LTA3BRZX.js +2 -0
- package/dist/chunk-LU3BMVH2.js +10 -0
- package/dist/chunk-LZYFLFEH.js +2 -0
- package/dist/chunk-MOVBWNIP.js +16 -0
- package/dist/chunk-MVB3DAEY.js +3 -0
- package/dist/chunk-N3IQCBCF.js +29 -0
- package/dist/chunk-NAUD7LCA.js +2 -0
- package/dist/chunk-NCZUNH3E.js +109 -0
- package/dist/chunk-NE6IU5ZD.js +5 -0
- package/dist/chunk-NEDP5RFQ.js +60 -0
- package/dist/chunk-NMTSZXCL.js +2 -0
- package/dist/chunk-NNJ2KZZG.js +4 -0
- package/dist/chunk-NNO6A2PO.js +2 -0
- package/dist/chunk-NNOKTMZT.js +20 -0
- package/dist/chunk-O6QTXQPJ.js +13 -0
- package/dist/chunk-OANDYLJQ.js +2 -0
- package/dist/chunk-OFBE4NGP.js +2 -0
- package/dist/chunk-OGTFJ3XD.js +2 -0
- package/dist/chunk-OL6KJP3N.js +16 -0
- package/dist/chunk-OLF4MA5W.js +8 -0
- package/dist/chunk-OTOKVOJ3.js +2 -0
- package/dist/chunk-OVTS4DKB.js +2 -0
- package/dist/chunk-OZYRSMSH.js +3 -0
- package/dist/chunk-P5XHIJHI.js +2 -0
- package/dist/chunk-PBI2LFKH.js +2 -0
- package/dist/chunk-PIOMTC27.js +2 -0
- package/dist/chunk-PTAWHLVJ.js +6 -0
- package/dist/chunk-PX4RYAAK.js +2 -0
- package/dist/chunk-PYAB5SM6.js +7 -0
- package/dist/chunk-Q5ELPRKQ.js +2 -0
- package/dist/chunk-Q65CQ4XL.js +2 -0
- package/dist/chunk-Q72QSKXC.js +308 -0
- package/dist/chunk-QCN62RTF.js +3 -0
- package/dist/chunk-QDCCHMVZ.js +2 -0
- package/dist/chunk-QHRNXP3C.js +3 -0
- package/dist/chunk-QKPLA6IC.js +2 -0
- package/dist/chunk-QOKYJ33H.js +2 -0
- package/dist/chunk-QW7EP6WI.js +21 -0
- package/dist/chunk-R2NOK63J.js +4 -0
- package/dist/chunk-RBAS5ZHI.js +2 -0
- package/dist/chunk-RDBI2RXU.js +9 -0
- package/dist/chunk-RKEJ6VTF.js +73 -0
- package/dist/chunk-RR7SX44N.js +35 -0
- package/dist/chunk-RU65DDUP.js +215 -0
- package/dist/chunk-SELM5MER.js +2 -0
- package/dist/chunk-SGX43S2L.js +2 -0
- package/dist/chunk-SMRBZ6EC.js +2 -0
- package/dist/chunk-SNNWPCN7.js +4 -0
- package/dist/chunk-ST7V3SKN.js +2 -0
- package/dist/chunk-SWHMHUKF.js +2 -0
- package/dist/chunk-SYDJMPES.js +2 -0
- package/dist/chunk-SZD2KF7Q.js +2 -0
- package/dist/chunk-T3DGWPXM.js +3 -0
- package/dist/chunk-TFZB6XTM.js +239 -0
- package/dist/chunk-TIIC3ZE7.js +2 -0
- package/dist/chunk-TRRC4ZJ7.js +2 -0
- package/dist/chunk-TXXOEMZJ.js +2 -0
- package/dist/chunk-UBGWN7I4.js +2 -0
- package/dist/chunk-UCD3H3UZ.js +5 -0
- package/dist/chunk-UDS562V4.js +5 -0
- package/dist/chunk-UNBY47BC.js +3 -0
- package/dist/chunk-UP3BUZR5.js +74 -0
- package/dist/chunk-UXM43C7T.js +3 -0
- package/dist/chunk-UZGZB3VB.js +3 -0
- package/dist/chunk-VE5AVNMP.js +2 -0
- package/dist/chunk-VEXUL62T.js +2 -0
- package/dist/chunk-VFY6Y2H6.js +61 -0
- package/dist/chunk-VUIYB2V3.js +2 -0
- package/dist/chunk-VXYS3FZD.js +23 -0
- package/dist/chunk-WE5RZHZ7.js +5 -0
- package/dist/chunk-WMPRTGH2.js +2 -0
- package/dist/chunk-WOQBZPIF.js +2 -0
- package/dist/chunk-XLQ3GLWZ.js +2 -0
- package/dist/chunk-XME3HPXZ.js +2 -0
- package/dist/chunk-XMQ23E27.js +2 -0
- package/dist/chunk-XWUOUWYI.js +2 -0
- package/dist/chunk-XZEE23VG.js +5 -0
- package/dist/chunk-Y6KHROC3.js +7 -0
- package/dist/chunk-YESXMKX3.js +3 -0
- package/dist/chunk-YMGZZEW4.js +2 -0
- package/dist/chunk-YSNONTJ2.js +2 -0
- package/dist/chunk-YUKYB54I.js +1 -0
- package/dist/chunk-YVCIMIOC.js +12 -0
- package/dist/chunk-Z54RD7VL.js +3 -0
- package/dist/chunk-ZKX2FRS6.js +15 -0
- package/dist/chunk-ZMI2JSX2.js +2 -0
- package/dist/chunk-ZV3JV5G5.js +8 -0
- package/dist/chunk-ZZ3MWF33.js +4 -0
- package/dist/chunk-ZZXSWSN6.js +2 -0
- package/dist/cli-context-3SNLDYBM.js +3 -0
- package/dist/cli-context-T3B7W6GG.js +2 -0
- package/dist/cli-program-YNOXO72B.js +7 -0
- package/dist/cli.js +3 -0
- package/dist/code-DlqpBDd0.d.ts +121 -0
- package/dist/command-descriptors-6AOUKWW7.js +346 -0
- package/dist/command-descriptors-ZFKJSRUP.js +344 -0
- package/dist/command-panels-SZONPMLJ.js +3 -0
- package/dist/config-types-BNoC96J3.d.ts +560 -0
- package/dist/db-D7sauVFH.d.ts +95 -0
- package/dist/direct-navigation-DP4LVMRX.js +3 -0
- package/dist/direct-navigation-FLUS3BT6.js +2 -0
- package/dist/exploration-topology-BG4v30HZ.d.ts +256 -0
- package/dist/file-dep-graph-Bqg3t3Px.d.ts +4 -0
- package/dist/file-kind-BKCVMNUf.d.ts +10 -0
- package/dist/frontend-behavior-evidence-EfM4_9bc.d.ts +4 -0
- package/dist/git-history-ChNHbfZQ.d.ts +13 -0
- package/dist/graph-evidence-BIFqyisO.d.ts +131 -0
- package/dist/health-DJaZXg8I.d.ts +340 -0
- package/dist/index.d.ts +183 -0
- package/dist/index.js +2 -0
- package/dist/invocation-command-descriptors-QT2JMY5J.js +3 -0
- package/dist/invocation-command-descriptors-YN4QJEAX.js +2 -0
- package/dist/next-anchor-candidates-BwMczMvX.d.ts +90 -0
- package/dist/output-continuation-command-2V2SL4TD.js +2 -0
- package/dist/output-continuation-command-65J5IP3O.js +3 -0
- package/dist/postinstall.js +3 -0
- package/dist/project-reindex-5JOKXAXT.js +2 -0
- package/dist/project-reindex-UQBIKO4M.js +3 -0
- package/dist/queries/affected.d.ts +40 -0
- package/dist/queries/affected.js +2 -0
- package/dist/queries/anchors.d.ts +123 -0
- package/dist/queries/anchors.js +2 -0
- package/dist/queries/architecture.d.ts +166 -0
- package/dist/queries/architecture.js +2 -0
- package/dist/queries/bottlenecks.d.ts +68 -0
- package/dist/queries/bottlenecks.js +2 -0
- package/dist/queries/by-kind.d.ts +27 -0
- package/dist/queries/by-kind.js +2 -0
- package/dist/queries/call-graph.d.ts +52 -0
- package/dist/queries/call-graph.js +2 -0
- package/dist/queries/change-surface.d.ts +55 -0
- package/dist/queries/change-surface.js +2 -0
- package/dist/queries/cleanup-plan.d.ts +66 -0
- package/dist/queries/cleanup-plan.js +2 -0
- package/dist/queries/co-change.d.ts +90 -0
- package/dist/queries/co-change.js +2 -0
- package/dist/queries/code.d.ts +6 -0
- package/dist/queries/code.js +2 -0
- package/dist/queries/complexity-hotspots.d.ts +61 -0
- package/dist/queries/complexity-hotspots.js +2 -0
- package/dist/queries/complexity.d.ts +74 -0
- package/dist/queries/complexity.js +2 -0
- package/dist/queries/context.d.ts +146 -0
- package/dist/queries/context.js +2 -0
- package/dist/queries/convergence.d.ts +33 -0
- package/dist/queries/convergence.js +2 -0
- package/dist/queries/coupling.d.ts +32 -0
- package/dist/queries/coupling.js +2 -0
- package/dist/queries/cycles.d.ts +66 -0
- package/dist/queries/cycles.js +2 -0
- package/dist/queries/dataflow.d.ts +77 -0
- package/dist/queries/dataflow.js +2 -0
- package/dist/queries/dead.d.ts +58 -0
- package/dist/queries/dead.js +2 -0
- package/dist/queries/decorative-checkers.d.ts +34 -0
- package/dist/queries/decorative-checkers.js +2 -0
- package/dist/queries/deep-chains.d.ts +5 -0
- package/dist/queries/deep-chains.js +2 -0
- package/dist/queries/dependence-slice.d.ts +46 -0
- package/dist/queries/dependence-slice.js +2 -0
- package/dist/queries/dependency-depth.d.ts +49 -0
- package/dist/queries/dependency-depth.js +2 -0
- package/dist/queries/deps.d.ts +15 -0
- package/dist/queries/deps.js +2 -0
- package/dist/queries/diff-impact.d.ts +165 -0
- package/dist/queries/diff-impact.js +2 -0
- package/dist/queries/doc-drift.d.ts +115 -0
- package/dist/queries/doc-drift.js +2 -0
- package/dist/queries/drift.d.ts +79 -0
- package/dist/queries/drift.js +2 -0
- package/dist/queries/duplicate-bodies.d.ts +55 -0
- package/dist/queries/duplicate-bodies.js +2 -0
- package/dist/queries/entry-map.d.ts +121 -0
- package/dist/queries/entry-map.js +2 -0
- package/dist/queries/evidence.d.ts +70 -0
- package/dist/queries/evidence.js +2 -0
- package/dist/queries/extract-candidates.d.ts +52 -0
- package/dist/queries/extract-candidates.js +2 -0
- package/dist/queries/fan.d.ts +53 -0
- package/dist/queries/fan.js +2 -0
- package/dist/queries/files.d.ts +20 -0
- package/dist/queries/files.js +2 -0
- package/dist/queries/health.d.ts +8 -0
- package/dist/queries/health.js +2 -0
- package/dist/queries/hierarchy.d.ts +21 -0
- package/dist/queries/hierarchy.js +2 -0
- package/dist/queries/hotspots.d.ts +42 -0
- package/dist/queries/hotspots.js +2 -0
- package/dist/queries/imports.d.ts +34 -0
- package/dist/queries/imports.js +2 -0
- package/dist/queries/incomplete-migration.d.ts +90 -0
- package/dist/queries/incomplete-migration.js +2 -0
- package/dist/queries/index.d.ts +180 -0
- package/dist/queries/index.js +2 -0
- package/dist/queries/isolated.d.ts +24 -0
- package/dist/queries/isolated.js +2 -0
- package/dist/queries/locality-candidates.d.ts +51 -0
- package/dist/queries/locality-candidates.js +2 -0
- package/dist/queries/members.d.ts +21 -0
- package/dist/queries/members.js +2 -0
- package/dist/queries/methods.d.ts +43 -0
- package/dist/queries/methods.js +2 -0
- package/dist/queries/not-implemented.d.ts +33 -0
- package/dist/queries/not-implemented.js +2 -0
- package/dist/queries/outline.d.ts +22 -0
- package/dist/queries/outline.js +2 -0
- package/dist/queries/passthrough-candidates.d.ts +41 -0
- package/dist/queries/passthrough-candidates.js +2 -0
- package/dist/queries/plan-context.d.ts +33 -0
- package/dist/queries/plan-context.js +2 -0
- package/dist/queries/react-component-duplicates.d.ts +39 -0
- package/dist/queries/react-component-duplicates.js +2 -0
- package/dist/queries/react-hook-candidates.d.ts +44 -0
- package/dist/queries/react-hook-candidates.js +2 -0
- package/dist/queries/react-large-component-pressure.d.ts +34 -0
- package/dist/queries/react-large-component-pressure.js +2 -0
- package/dist/queries/recent-duplicates.d.ts +79 -0
- package/dist/queries/recent-duplicates.js +2 -0
- package/dist/queries/redundant-reexports.d.ts +37 -0
- package/dist/queries/redundant-reexports.js +2 -0
- package/dist/queries/reference-neighborhood.d.ts +4 -0
- package/dist/queries/reference-neighborhood.js +2 -0
- package/dist/queries/reference-reachability.d.ts +48 -0
- package/dist/queries/reference-reachability.js +2 -0
- package/dist/queries/refs.d.ts +13 -0
- package/dist/queries/refs.js +2 -0
- package/dist/queries/self-audit.d.ts +65 -0
- package/dist/queries/self-audit.js +2 -0
- package/dist/queries/similar-chains.d.ts +48 -0
- package/dist/queries/similar-chains.js +2 -0
- package/dist/queries/similar-files.d.ts +35 -0
- package/dist/queries/similar-files.js +2 -0
- package/dist/queries/similar-signatures.d.ts +46 -0
- package/dist/queries/similar-signatures.js +2 -0
- package/dist/queries/similar.d.ts +187 -0
- package/dist/queries/similar.js +2 -0
- package/dist/queries/slice.d.ts +4 -0
- package/dist/queries/slice.js +2 -0
- package/dist/queries/source-inspection.d.ts +209 -0
- package/dist/queries/source-inspection.js +2 -0
- package/dist/queries/source-search.d.ts +85 -0
- package/dist/queries/source-search.js +2 -0
- package/dist/queries/stale-abstractions.d.ts +72 -0
- package/dist/queries/stale-abstractions.js +2 -0
- package/dist/queries/stats.d.ts +15 -0
- package/dist/queries/stats.js +2 -0
- package/dist/queries/surface.d.ts +22 -0
- package/dist/queries/surface.js +2 -0
- package/dist/queries/symbols.d.ts +14 -0
- package/dist/queries/symbols.js +2 -0
- package/dist/queries/system-map.d.ts +449 -0
- package/dist/queries/system-map.js +2 -0
- package/dist/queries/system.d.ts +21 -0
- package/dist/queries/system.js +2 -0
- package/dist/queries/test-quality.d.ts +56 -0
- package/dist/queries/test-quality.js +2 -0
- package/dist/queries/trace.d.ts +68 -0
- package/dist/queries/trace.js +2 -0
- package/dist/queries/twin-ab.d.ts +66 -0
- package/dist/queries/twin-ab.js +2 -0
- package/dist/queries/twin-drift.d.ts +119 -0
- package/dist/queries/twin-drift.js +2 -0
- package/dist/queries/unused-imports.d.ts +4 -0
- package/dist/queries/unused-imports.js +2 -0
- package/dist/queries/unused-params.d.ts +38 -0
- package/dist/queries/unused-params.js +2 -0
- package/dist/queries/value-flow.d.ts +42 -0
- package/dist/queries/value-flow.js +2 -0
- package/dist/queries/vue-component-duplicates.d.ts +43 -0
- package/dist/queries/vue-component-duplicates.js +2 -0
- package/dist/queries/vue-composable-candidates.d.ts +44 -0
- package/dist/queries/vue-composable-candidates.js +2 -0
- package/dist/queries/vue-large-view-pressure.d.ts +41 -0
- package/dist/queries/vue-large-view-pressure.js +2 -0
- package/dist/queries/wrapper-candidates.d.ts +34 -0
- package/dist/queries/wrapper-candidates.js +2 -0
- package/dist/reindex-worker.js +3 -0
- package/dist/reindex.d.ts +254 -0
- package/dist/reindex.js +298 -0
- package/dist/repository-text-C0Q8VYdN.d.ts +19 -0
- package/dist/runtime.d.ts +555 -0
- package/dist/runtime.js +4 -0
- package/dist/rust-semantic-session-server.js +2 -0
- package/dist/rust-semantic-session-worker.js +2 -0
- package/dist/rust-semantic-worker.js +2 -0
- package/dist/scip-cli-B7N3haxa.d.ts +67 -0
- package/dist/source-snippet-_wrcgmZc.d.ts +15 -0
- package/dist/symbol-types-BIQwfoAx.d.ts +74 -0
- package/dist/typescript-mailbox-worker.js +2 -0
- package/dist/watch-server.js +8 -0
- package/docs/AGENT_GUIDE.md +148 -0
- package/docs/AI_FAILURE_MODES.md +43 -0
- package/docs/API.md +40 -0
- package/docs/API_EVOLUTION.md +77 -0
- package/docs/CLI_JSON_OUTPUT.md +389 -0
- package/docs/COMMAND_REFERENCE.md +294 -0
- package/docs/CONFIGURATION_WRITE_SAFETY.md +131 -0
- package/docs/DETECTOR_GUIDE.md +46 -0
- package/docs/DURABILITY.md +159 -0
- package/docs/INDEX_GENERATIONS.md +167 -0
- package/docs/LOCK_PROTOCOL.md +133 -0
- package/docs/MAILBOX_LIFECYCLE.md +224 -0
- package/docs/REGEX_POLICY.md +36 -0
- package/docs/REINDEX_METADATA_COMPATIBILITY.md +104 -0
- package/docs/RUST_DURABLE_SESSION_PROTOCOL.md +126 -0
- package/docs/SECURITY_MODEL.md +125 -0
- package/docs/TELEMETRY_RETENTION.md +84 -0
- package/docs/TIME_SEMANTICS.md +77 -0
- package/docs/WATCH_REFRESH_REQUESTS.md +123 -0
- package/docs/WINDOWS_SIDECAR_RELEASE.md +424 -0
- package/docs/accuracy-audit-checklist.md +304 -0
- package/docs/accuracy-hardening-goal.md +500 -0
- package/docs/analyzer-inventory.md +78 -0
- package/docs/analyzer-validation-protocol.md +84 -0
- package/docs/architecture-coherence-vision.md +254 -0
- package/docs/assets/codebaseiq-logo-dark.svg +21 -0
- package/docs/assets/codebaseiq-logo.svg +24 -0
- package/docs/locality-analyzer-design.md +193 -0
- package/docs/schemas/cli-json-envelope.schema.json +237 -0
- package/docs/schemas/cli-output-page.schema.json +104 -0
- package/docs/schemas/npm-release-state.schema.json +146 -0
- package/docs/schemas/observation-receipt.schema.json +164 -0
- package/docs/schemas/project-config.schema.json +318 -0
- package/docs/schemas/suppression-record.schema.json +79 -0
- package/docs/schemas/windows-sidecar-provenance.schema.json +137 -0
- package/package.json +482 -0
- package/scripts/build-codebaseiq-windows.mjs +197 -0
- package/scripts/codebaseiq-windows-provenance.mjs +364 -0
- package/scripts/evidence-product-contract.mjs +197 -0
- package/scripts/verify-codebaseiq-windows.mjs +29 -0
- package/skills/codebaseiq/SKILL.md +75 -0
- package/skills/codebaseiq/agents/openai.yaml +4 -0
- package/skills/codebaseiq-explore/SKILL.md +34 -0
- package/skills/codebaseiq-explore/agents/openai.yaml +4 -0
- package/skills/concrete-plan/SKILL.md +79 -0
- package/skills/concrete-plan/agents/openai.yaml +4 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import{a as z}from"./chunk-VE5AVNMP.js";import{p as Ze}from"./chunk-CVYSU6BX.js";import{a as Xe}from"./chunk-TIIC3ZE7.js";import{A as oe,t as I}from"./chunk-FETNQCFO.js";import{f as ae,o as Ke,p as D}from"./chunk-O6QTXQPJ.js";import{A as He,C as B,F as Ge,K as H,z as Ue}from"./chunk-ADTBPVUZ.js";import{e as Z,u as M}from"./chunk-BMYOV5GP.js";function se(e){let t=e.replaceAll("\\","/");return Xe(t)==="test"?/(?:^|\/)__fixtures__\//iu.test(t)?"fixture":"test":/(?:^|\/)(?:fixtures?|testdata)\//iu.test(t)?"fixture":/(?:^|\/)(?:examples?|demos?|previews?)\//iu.test(t)?"example":/(?:^|\/)(?:generated|dist|build|coverage)\//iu.test(t)||/\.generated\./iu.test(t)?"generated":/^(?:scripts?|tools?)\//iu.test(t)?"script":"production"}import Dt from"better-sqlite3";var ue="codebaseiq_runtime_boundaries",j="codebaseiq_runtime_observations",ce="codebaseiq_runtime_relation_groups",de="codebaseiq_runtime_relation_participants";function Mt(e,t){let n=new Dt(e);try{n.exec(`
|
|
2
|
+
CREATE TABLE IF NOT EXISTS ${ue} (
|
|
3
|
+
singleton INTEGER PRIMARY KEY CHECK (singleton = 1),
|
|
4
|
+
schema_version INTEGER NOT NULL,
|
|
5
|
+
extractor_version TEXT NOT NULL,
|
|
6
|
+
payload TEXT NOT NULL
|
|
7
|
+
)
|
|
8
|
+
`),zt(n),n.transaction(()=>{n.prepare(`INSERT OR REPLACE INTO ${ue} (singleton, schema_version, extractor_version, payload) VALUES (1, ?, ?, ?)`).run(t.schemaVersion,t.extractorVersion,JSON.stringify(t)),n.prepare(`DELETE FROM ${j}`).run(),n.prepare(`DELETE FROM ${de}`).run(),n.prepare(`DELETE FROM ${ce}`).run();let r=n.prepare(`INSERT INTO ${j}
|
|
9
|
+
(id, protocol, action, role, strength, source_scope, resolution, file, start_line, end_line, owner_symbol, payload)
|
|
10
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`);for(let o of t.observations)r.run(o.id,o.protocol,o.action,o.role,o.strength,o.sourceScope,o.resolution,o.source.file,o.source.startLine,o.source.endLine,o.owner.symbol,JSON.stringify(o));let i=n.prepare(`INSERT INTO ${ce} (id, protocol, join_rule, normalized_key, payload) VALUES (?, ?, ?, ?, ?)`),a=n.prepare(`INSERT INTO ${de} (group_id, observation_id, participant_role) VALUES (?, ?, ?)`);for(let o of t.relationGroups){i.run(o.id,o.protocol,o.joinRule,o.normalizedKey,JSON.stringify(o));for(let s of o.producerIds)a.run(o.id,s,"producer");for(let s of o.consumerIds)a.run(o.id,s,"consumer");for(let s of o.declarationIds)a.run(o.id,s,"declaration")}})()}finally{n.close()}}function Vt(e,t={}){if(!jt(e,j))return We(e)?.observations??[];let n=[],r=[];return le(n,r,"protocol",t.protocols),le(n,r,"action",t.actions),le(n,r,"source_scope",t.sourceScopes),le(n,r,"file",t.files),e.all(`SELECT payload FROM ${j}${n.length>0?` WHERE ${n.join(" AND ")}`:""} ORDER BY file, start_line, id`,...r).flatMap(a=>qt(a.payload))}function zt(e){e.exec(`
|
|
11
|
+
CREATE TABLE IF NOT EXISTS ${j} (
|
|
12
|
+
id TEXT PRIMARY KEY,
|
|
13
|
+
protocol TEXT NOT NULL,
|
|
14
|
+
action TEXT NOT NULL,
|
|
15
|
+
role TEXT NOT NULL,
|
|
16
|
+
strength TEXT NOT NULL,
|
|
17
|
+
source_scope TEXT NOT NULL,
|
|
18
|
+
resolution TEXT NOT NULL,
|
|
19
|
+
file TEXT NOT NULL,
|
|
20
|
+
start_line INTEGER NOT NULL,
|
|
21
|
+
end_line INTEGER NOT NULL,
|
|
22
|
+
owner_symbol TEXT,
|
|
23
|
+
payload TEXT NOT NULL
|
|
24
|
+
);
|
|
25
|
+
CREATE INDEX IF NOT EXISTS idx_runtime_observations_protocol_action_scope
|
|
26
|
+
ON ${j}(protocol, action, source_scope);
|
|
27
|
+
CREATE INDEX IF NOT EXISTS idx_runtime_observations_file_line
|
|
28
|
+
ON ${j}(file, start_line);
|
|
29
|
+
|
|
30
|
+
CREATE TABLE IF NOT EXISTS ${ce} (
|
|
31
|
+
id TEXT PRIMARY KEY,
|
|
32
|
+
protocol TEXT NOT NULL,
|
|
33
|
+
join_rule TEXT NOT NULL,
|
|
34
|
+
normalized_key TEXT NOT NULL,
|
|
35
|
+
payload TEXT NOT NULL
|
|
36
|
+
);
|
|
37
|
+
CREATE INDEX IF NOT EXISTS idx_runtime_groups_protocol_key
|
|
38
|
+
ON ${ce}(protocol, join_rule, normalized_key);
|
|
39
|
+
|
|
40
|
+
CREATE TABLE IF NOT EXISTS ${de} (
|
|
41
|
+
group_id TEXT NOT NULL,
|
|
42
|
+
observation_id TEXT NOT NULL,
|
|
43
|
+
participant_role TEXT NOT NULL,
|
|
44
|
+
PRIMARY KEY (group_id, observation_id, participant_role)
|
|
45
|
+
);
|
|
46
|
+
CREATE INDEX IF NOT EXISTS idx_runtime_participants_observation
|
|
47
|
+
ON ${de}(observation_id, participant_role);
|
|
48
|
+
`)}function jt(e,t){return!!e.get("SELECT name FROM sqlite_master WHERE type = 'table' AND name = ?",t)}function le(e,t,n,r){!r||r.length===0||(e.push(`${n} IN (${r.map(()=>"?").join(", ")})`),t.push(...r))}function qt(e){try{return[JSON.parse(e)]}catch{return[]}}function We(e){if(!e.get("SELECT name FROM sqlite_master WHERE type = 'table' AND name = ?",ue))return null;let n=e.get(`SELECT schema_version, payload FROM ${ue} WHERE singleton = 1`);if(!n||n.schema_version!==2)return null;try{let r=JSON.parse(n.payload);return r.schemaVersion===2&&Array.isArray(r.observations)&&Array.isArray(r.relationGroups)&&Array.isArray(r.links)?r:null}catch{return null}}import{createHash as Tt}from"crypto";import{createHash as un}from"crypto";var pe=8;function G(e,t,n){return Pe(Ye(e,t,we(n),0,new Set))}function Fe(e,t,n){return Ce(e,t,n,0,new Set)}function Ye(e,t,n,r,i){if(r>pe)return[];let a=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(n);return a?Je(e,t,a[1],a[2],r,i):/^[A-Za-z_$][\w$]*$/u.test(n)?Qe(e,t,n,r,i):[]}function Je(e,t,n,r,i,a){let o=[];for(let s of Ce(e,t,n,i+1,new Set(a))){let l=Xt(s.initializer);for(let u of l.namedChildren){if(u.type==="pair"){let c=u.childForFieldName("key")??u.namedChild(0);if(Zt(c)!==r)continue;let d=u.childForFieldName("value")??u.namedChild(1);d&&o.push(...Ye(e,s.definition.relativePath,we(d.text),i+1,new Set(a)));continue}if(/(?:method|function)/u.test(u.type)){if((u.childForFieldName("name")??u.namedChild(0))?.text!==r)continue;let d=Gt(e,s.definition.relativePath,r,u);o.push(...d.length>0?d:[Ut(s.definition,r,u)]);continue}if(u.type==="spread_element"){let c=u.namedChild(0);if(!c)continue;for(let d of Ce(e,s.definition.relativePath,we(c.text),i+1,new Set(a)))o.push(...Je(e,d.definition.relativePath,d.definition.leaf,r,i+1,new Set(a)))}}}return Pe(o)}function Ut(e,t,n){return{documentId:e.documentId,symbolId:-1,symbol:`source-callable:${e.relativePath}:${n.startPosition.row}:${t}`,relativePath:e.relativePath,startLine:n.startPosition.row,startChar:n.startPosition.column,endLine:n.endPosition.row,endChar:n.endPosition.column,leaf:t,parentTypeName:e.leaf,isFunctionLike:!0,isTypeLike:!1,kind:null,documentation:null,enclosingSymbol:e.symbol}}function Ce(e,t,n,r,i){return r>pe||!/^[A-Za-z_$][\w$]*$/u.test(n)?[]:Qe(e,t,n,r,i).flatMap(a=>{let o=B(e,a.relativePath)?.rootNode,s=o?Kt(o,a.leaf):null;return s?[{definition:a,initializer:s}]:[]})}function Qe(e,t,n,r,i){if(r>pe)return[];let a=`${t}\0${n}`;if(i.has(a))return[];i.add(a);let o=I(e,t).filter(u=>u.leaf===n);if(o.length>0)return o;let s=Ht(e,t,n);if(s.length>0)return s;let l=D(e,t).find(u=>u.localName===n&&u.sourcePath);if(l?.sourcePath){let u=l.kind==="namespace"||l.importedName==="default"?n:l.importedName;return Ie(e,l.sourcePath,u,r+1,new Set(i))}return Ie(e,t,n,r+1,new Set(i))}function Ht(e,t,n){let r=e.get("SELECT id FROM documents WHERE relative_path = ?",t)?.id;return r===void 0?[]:(ae(e,t)?.callables??[]).filter(i=>i.name===n).map(i=>({documentId:r,symbolId:-1,symbol:`source-callable:${t}:${i.startLine}:${n}`,relativePath:t,startLine:i.startLine,startChar:0,endLine:i.endLine,endChar:0,leaf:n,parentTypeName:null,isFunctionLike:!0,isTypeLike:!1,kind:null,documentation:null,enclosingSymbol:null}))}function Ie(e,t,n,r,i){if(r>pe)return[];let a=I(e,t).filter(o=>o.leaf===n);return a.length>0?a:Pe(Ke(e,t).flatMap(o=>o.sourcePath?o.kind==="named"&&!o.names.includes(n)?[]:Ie(e,o.sourcePath,n,r+1,new Set(i)):[]))}function Gt(e,t,n,r){return I(e,t).filter(i=>i.leaf===n&&i.startLine<=r.startPosition.row&&i.endLine>=r.endPosition.row)}function Kt(e,t){let n=null;return et(e,r=>{n||r.type!=="variable_declarator"||(r.childForFieldName("name")??r.namedChild(0))?.text.trim()!==t||(n=r.childForFieldName("value")??r.namedChild(1))}),n}function Xt(e){let t=e;for(;["as_expression","satisfies_expression","type_assertion","parenthesized_expression"].includes(t.type)&&t.namedChildren.length>0;)t=t.namedChildren[0];return t}function Zt(e){return e?.text.replace(/^['"`]|['"`]$/gu,"")??null}function we(e){return e.replace(/\s+/gu,"").replace(/^\.\.\./u,"")}function Pe(e){return[...new Map(e.map(t=>[t.symbol,t])).values()]}function et(e,t){t(e);for(let n of e.namedChildren)et(n,t)}var Wt=8;function R(e,t){return t?K(e,t,0,new Set):null}function K(e,t,n,r){if(n>Wt)return _(t,"value-evaluation-depth");let i=nt(t),a=nn(i);if(a)return rn(e.file,i,a.term,a.value,a.precision);if(i.type==="binary_expression"&&/\+/u.test(i.text)){let l=i.namedChildren.map(u=>K(e,u,n+1,new Set(r)));if(l.length>=2&&l.every(u=>u!==null)){let u={kind:"concat",parts:l.map(d=>d.term)},c=l.map(d=>d.value).join("");return an(e.file,i,u,c,l.some(d=>d.precision!=="literal")?"constrained-pattern":"literal",l)}}let o=i.text.trim();if(/^[A-Za-z_$][\w$]*$/u.test(o))return en(e,o,i,n,r);let s=on(i);return s?tn(e,s.base,s.properties,i,n,r):i.type==="call_expression"||i.type==="call"?Yt(e,i,n,r):_(i,`unsupported-expression:${i.type}`)}function Yt(e,t,n,r){let a=(t.childForFieldName("function")??t.namedChild(0))?.text.replace(/\s+/gu,"").replace(/<.*>$/u,"")??"",o=Jt(e,a);if(o.length!==1)return _(t,o.length===0?"call-target-unresolved":"call-target-ambiguous");let s=o[0],l=`${s.relativePath}\0${s.symbol}`;if(r.has(l))return _(t,"call-return-cycle");let u=B(e.db,s.relativePath)?.rootNode;if(!u)return _(t,"call-target-unparsed");let c=ln(u,s.startLine,s.endLine);if(!c)return _(t,"call-target-syntax-unavailable");let d=Qt(c);if(!d)return _(t,"call-return-not-single-expression");let m=new Set(r);m.add(l);let p=K({db:e.db,file:s.relativePath,root:u},d,n+1,m);return p?me(t,"bounded-call-return",p,s.symbol):_(t,"call-return-unresolved")}function Jt(e,t){if(/^[A-Za-z_$][\w$]*$/u.test(t)){let i=I(e.db,e.file).filter(o=>o.isFunctionLike&&o.leaf===t);if(i.length>0)return i;let a=D(e.db,e.file).find(o=>o.localName===t&&o.sourcePath&&o.kind!=="namespace");return a?.sourcePath?z(e.db,a.sourcePath,a.importedName==="default"?t:a.importedName).filter(o=>o.isFunctionLike):[]}let n=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(t);if(!n)return[];let r=D(e.db,e.file).find(i=>i.kind==="namespace"&&i.localName===n[1]&&i.sourcePath);return r?.sourcePath?z(e.db,r.sourcePath,n[2]).filter(i=>i.isFunctionLike):[]}function Qt(e){let t=e.childForFieldName("body");if(e.type==="arrow_function"&&t&&t.type!=="statement_block")return t;let n=[];return tt(t??e,t??e,n),n.length!==1?null:n[0].childForFieldName("argument")??n[0].namedChild(0)}function tt(e,t,n){if(!(t!==e&&(/(?:function|method|lambda)/u.test(t.type)||t.type==="arrow_function"))){if(t.type==="return_statement"){n.push(t);return}for(let r of t.namedChildren)tt(e,r,n)}}function en(e,t,n,r,i){let a=`${e.file}\0${t}`;if(i.has(a))return _(n,"value-cycle");i.add(a);let o=Be(e.root,t);if(o){let f=K(e,o,r+1,i);return f?me(n,"local-constant",f):_(n,"non-foldable-local")}let s=D(e.db,e.file).find(f=>f.localName===t&&f.sourcePath);if(!s?.sourcePath)return E(n,t,"unresolved-identifier");if(s.kind==="namespace")return E(n,t,"namespace-import-requires-property");let l=s.importedName==="default"?t:s.importedName,u=z(e.db,s.sourcePath,l);if(u.length!==1)return E(n,t,u.length===0?"import-definition-missing":"import-definition-ambiguous");let c=u[0],d=B(e.db,c.relativePath)?.rootNode;if(!d)return E(n,c.symbol,"import-definition-unparsed");let m=Be(d,c.leaf);if(!m)return E(n,c.symbol,"import-definition-non-value");let p=K({db:e.db,file:c.relativePath,root:d},m,r+1,i);return p?me(n,"imported-constant",p,c.symbol):E(n,c.symbol,"import-value-unresolved")}function tn(e,t,n,r,i,a){let o=D(e.db,e.file).find(p=>p.localName===t&&p.sourcePath),s=e.file,l=t,u;if(o?.sourcePath){o.kind==="namespace"?(l=n[0]??"",n=n.slice(1)):l=o.importedName==="default"?t:o.importedName;let p=z(e.db,o.sourcePath,l);if(p.length!==1)return E(r,`${t}.${n.join(".")}`,p.length===0?"member-definition-missing":"member-definition-ambiguous");s=p[0].relativePath,l=p[0].leaf,u=p[0].symbol}let c=s===e.file?e.root:B(e.db,s)?.rootNode;if(!c)return E(r,u??t,"member-definition-unparsed");let d=Be(c,l);if(!d)return E(r,u??t,"member-base-non-value");for(let p of n){let f=nt(d);if(d=sn(f,p),!d)return E(r,u??`${t}.${n.join(".")}`,`member-property-missing:${p}`)}let m=K({db:e.db,file:s,root:c},d,i+1,a);return m?me(r,"member-constant",m,u):E(r,u??t,"member-value-unresolved")}function nn(e){let t=e.text.trim(),n=t[0];if(n!=="'"&&n!=='"'&&n!=="`"||t.at(-1)!==n)return null;let r=t.slice(1,-1);if(n!=="`"||!r.includes("${"))return{term:{kind:"literal",value:r},value:r,precision:"literal"};let i=[],a=0,o=/\$\{([^}]*)\}/gu;for(let s of r.matchAll(o)){let l=s.index??0;l>a&&i.push({kind:"literal",value:r.slice(a,l)}),i.push({kind:"unknown",reason:`template-hole:${s[1]?.trim()||"expression"}`}),a=l+s[0].length}return a<r.length&&i.push({kind:"literal",value:r.slice(a)}),{term:{kind:"pattern",language:"template",value:r.replace(o,"{}")},value:r.replace(o,"{}"),precision:"constrained-pattern"}}function rn(e,t,n,r,i){return{value:r,evidence:"literal",term:n,precision:i,derivation:fe("direct-literal","direct",e,t)}}function an(e,t,n,r,i,a){return{value:r,evidence:"constant",term:n,precision:i,derivation:{...fe("constant-concatenation","mechanically-derived",e,t),inputFactIds:a.flatMap(o=>o.derivation.inputFactIds),sourceSpans:a.flatMap(o=>o.derivation.sourceSpans)}}}function me(e,t,n,r){return n.evidence==="expression"?{...n,derivation:{kind:"heuristic",rule:t,ruleVersion:"1",inputFactIds:[...n.derivation.inputFactIds,...r?[r]:[]],sourceSpans:n.derivation.sourceSpans}}:{...n,evidence:"constant",derivation:{kind:"mechanically-derived",rule:t,ruleVersion:"1",inputFactIds:[...n.derivation.inputFactIds,...r?[r]:[]],sourceSpans:n.derivation.sourceSpans}}}function E(e,t,n){return{value:e.text.trim(),evidence:"expression",term:{kind:"symbol",symbol:t},precision:"symbolic",derivation:fe(n,"heuristic","",e)}}function _(e,t){return{value:e.text.trim(),evidence:"expression",term:{kind:"unknown",reason:t},precision:"unknown",derivation:fe(t,"heuristic","",e)}}function fe(e,t,n,r){return{kind:t,rule:e,ruleVersion:"1",inputFactIds:[],sourceSpans:n?[{file:n,startLine:r.startPosition.row,endLine:r.endPosition.row}]:[]}}function on(e){let t=e.text.replace(/\s+/gu,"");if(!/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)+$/u.test(t))return null;let[n,...r]=t.split(".");return n?{base:n,properties:r}:null}function Be(e,t){let n=null;return $e(e,r=>{if(n||r.type!=="variable_declarator"||(r.childForFieldName("name")??r.namedChild(0))?.text.trim()!==t)return;let a=r.parent;!a||a.type!=="lexical_declaration"||!/^\s*(?:export\s+)?const\b/u.test(a.text)||(n=r.childForFieldName("value")??r.namedChild(1))}),n}function sn(e,t){for(let n of e.namedChildren)if(!(n.type!=="pair"||(n.childForFieldName("key")??n.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"")!==t))return n.childForFieldName("value")??n.namedChild(1);return null}function nt(e){let t=e;for(;["as_expression","satisfies_expression","type_assertion","parenthesized_expression"].includes(t.type)&&t.namedChildren.length>0;)t=t.namedChildren[0];return t}function ln(e,t,n){let r=null;return $e(e,i=>{!/(?:function|method|lambda)/u.test(i.type)&&i.type!=="arrow_function"||i.startPosition.row>t||i.endPosition.row<n||(!r||i.endIndex-i.startIndex<r.endIndex-r.startIndex)&&(r=i)}),r}function $e(e,t){t(e);for(let n of e.namedChildren)$e(n,t)}var ot=new Set(["delete","get","head","options","patch","post","put"]),cn=/(?:^|\.)(?:app|router|server)$/u,dn=new Set(["findFirst","findMany","findUnique","from","get","select"]),pn=new Set(["create","delete","insert","remove","update","upsert"]),mn=new Set(["execute","query","raw"]),ke=[gn(),hn(),fn(),vn(),xn(),Sn(),Cn()],Re=new Set(["exec","execFile","execFileSync","execSync","fork","spawn","spawnSync"]);function fn(){return{id:"builtin.node-child-process",supports:e=>/(?:from\s*|require\s*\(\s*)['"](?:node:)?child_process['"]/u.test(e)&&/\b(?:exec|execFile|execFileSync|execSync|fork|spawn|spawnSync)\s*\(/u.test(e),extract:e=>{let t=yn(e.source),n=[];return k(e.root,r=>{if(r.type!=="call_expression")return;let i=J(r);if(!i)return;let a=t.direct.get(i),o=/^(.*?)\.([A-Za-z_$][\w$]*)$/u.exec(i),s=o&&t.namespaces.has(o[1])?o[2]:null,l=a??s;if(!l||!Re.has(l))return;let u=q(r),c=$(u[0],e)??{value:u[0]?.text.trim()||"<missing>",evidence:"expression"},d=["exec","execFile","execFileSync","execSync"].includes(l)?"process.exec":"process.spawn";n.push(S(e,r,"builtin.node-child-process",d,[{name:"operation",value:l,evidence:"literal"},{name:"executable",...c}],"exact","node-child-process-import"))}),n}}}function yn(e){let t=new Map,n=new Set,r=String.raw`['"](?:node:)?child_process['"]`,i=new RegExp(String.raw`\bimport\s*\{([^}]*)\}\s*from\s*${r}`,"gu");for(let l of e.matchAll(i))for(let u of(l[1]??"").split(",")){let c=/^\s*([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?\s*$/u.exec(u);c&&Re.has(c[1])&&t.set(c[2]??c[1],c[1])}let a=new RegExp(String.raw`\b(?:const|let)\s*\{([^}]*)\}\s*=\s*require\s*\(\s*${r}\s*\)`,"gu");for(let l of e.matchAll(a))for(let u of(l[1]??"").split(",")){let c=/^\s*([A-Za-z_$][\w$]*)(?:\s*:\s*([A-Za-z_$][\w$]*))?\s*$/u.exec(u);c&&Re.has(c[1])&&t.set(c[2]??c[1],c[1])}let o=new RegExp(String.raw`\bimport\s*\*\s*as\s*([A-Za-z_$][\w$]*)\s*from\s*${r}`,"gu");for(let l of e.matchAll(o))n.add(l[1]);let s=new RegExp(String.raw`\b(?:const|let)\s+([A-Za-z_$][\w$]*)\s*=\s*require\s*\(\s*${r}\s*\)`,"gu");for(let l of e.matchAll(s))n.add(l[1]);return{direct:t,namespaces:n}}function N(e,t){let n=B(e,t)?.rootNode;if(!n)return null;let r=M(e,t),i=I(e,t),a=ae(e,t)?.callables??[];return{db:e,file:t,source:r,root:n,constants:$n(n),ownerAt:o=>{let s=i.filter(u=>u.startLine<=o&&u.endLine>=o).sort((u,c)=>u.endLine-u.startLine-(c.endLine-c.startLine)||u.startLine-c.startLine)[0];if(s)return{file:t,symbol:s.symbol,name:s.leaf,startLine:s.startLine,endLine:s.endLine};let l=a.filter(u=>u.startLine<=o&&u.endLine>=o).sort((u,c)=>u.endLine-u.startLine-(c.endLine-c.startLine)||u.startLine-c.startLine)[0];return{file:t,symbol:null,name:l?.name??null,startLine:l?.startLine??o,endLine:l?.endLine??o}}}}function hn(){return{id:"builtin.effect-httpapi",supports:e=>W(e,"HttpApiEndpoint").size>0||W(e,"HttpApiBuilder").size>0,extract:e=>{let t=[],n=W(e.source,"HttpApiEndpoint"),r=W(e.source,"HttpApiGroup"),i=W(e.source,"HttpApiBuilder");return k(e.root,a=>{if(a.type!=="call_expression")return;let o=st(a);if(!o)return;let s=q(a);if(n.has(o.receiver)&&ot.has(o.member)){let y=$(s[0],e),h=$(s[1],e),C=it(a,r,"make",0,e);if(!y||!h||!C)return;let P=o.member.toUpperCase();t.push(S(e,a,"builtin.effect-httpapi","http.handle",[{name:"method",value:P,evidence:"literal"},{name:"path",...h}],T([{name:"path",...h}]),"effect-httpapi-endpoint-declaration")),t.push(S(e,a,"builtin.effect-httpapi","framework.declare",Ee(C,y),T(Ee(C,y)),"effect-httpapi-operation-declaration"));return}if(!["handle","handleRaw"].includes(o.member))return;let l=it(a,i,"group",1,e),u=$(s[0],e),c=s[1];if(!l||!u||!c)return;let d=Ee(l,u),m=G(e.db,e.file,c.text),p=S(e,a,"builtin.effect-httpapi","framework.handle",d,m.length===1?T(d):"candidate","effect-httpapi-handler-registration"),f=m[0];m.length===1&&f&&(p.owner={file:f.relativePath,symbol:f.symbol,name:f.leaf,startLine:f.startLine,endLine:f.endLine}),t.push(p)}),t}}}function Ee(e,t){return[{name:"adapter",value:"effect-httpapi",evidence:"literal"},{name:"group",...e},{name:"operation",...t}]}function W(e,t){let n=new Set,r=/\bimport\s*\{([\s\S]*?)\}\s*from\s*['"]([^'"]+)['"]/gu;for(let a of e.matchAll(r)){let o=a[2]??"";if(rt(o))for(let s of(a[1]??"").split(",")){let l=s.trim().replace(/^type\s+/u,""),u=/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/u.exec(l);u?.[1]===t&&n.add(u[2]??u[1])}}let i=/\bimport\s*\*\s*as\s*([A-Za-z_$][\w$]*)\s*from\s*['"]([^'"]+)['"]/gu;for(let a of e.matchAll(i)){let o=a[2]??"";o.endsWith(`/${t}`)&&rt(o)&&n.add(a[1])}return n}function rt(e){return e==="effect/unstable/httpapi"||e==="@effect/platform"||e.startsWith("@effect/platform/HttpApi")}function it(e,t,n,r,i){let a=e.parent;for(;a;){if(a.type==="call_expression"){let o=at(a,t,n,r,i);if(o)return o;let s=a.childForFieldName("function")??a.namedChild(0),l=null;if(s&&k(s,u=>{!l&&u.type==="call_expression"&&(l=at(u,t,n,r,i))}),l)return l}a=a.parent}return null}function at(e,t,n,r,i){let a=st(e);return!a||a.member!==n||!t.has(a.receiver)?null:$(q(e)[r],i)}function st(e){let t=e.childForFieldName("function")??e.namedChild(0);if(!t||!["member_expression","subscript_expression"].includes(t.type))return null;let n=t.childForFieldName("object")??t.namedChild(0),r=t.childForFieldName("property")??t.childForFieldName("index")??t.namedChild(1);return!n||!r?null:{receiver:n.text.replace(/\s+/gu,""),member:r.text.replace(/^['"`]|['"`]$/gu,"")}}function gn(){return{id:"builtin.http",supports:e=>/\bfetch\s*\(|\baxios\b|\b(?:app|router|server)\s*\.\s*(?:get|post|put|patch|delete|options|head)\s*\(/u.test(e)||Y(e,["axios"])||/\b(?:FastAPI|Flask|APIRouter|axum|Router::new)\b/u.test(e),extract:e=>{let t=[];return k(e.root,n=>{if(n.type==="decorator"){let m=/^@[^\s(]+\.(get|post|put|patch|delete|options|head)\s*\(\s*(['"`])([^'"`]+)\2/iu.exec(n.text.trim());if(!m||!Y(e.source,["fastapi","flask"]))return;t.push(S(e,n,"builtin.http","http.handle",[{name:"method",value:m[1].toUpperCase(),evidence:"literal"},{name:"path",value:m[3],evidence:"literal"}],"exact","framework-decorator"));return}if(n.type!=="call_expression")return;let r=J(n);if(!r)return;let i=r.split(".").at(-1)?.toLowerCase()??"",a=r.includes(".")?r.slice(0,r.lastIndexOf(".")):"",o=q(n);if(i==="route"&&Y(e.source,["axum"])){let m=$(o[0],e),p=/^\s*(get|post|put|patch|delete|options|head)\s*\(/iu.exec(o[1]?.text??"")?.[1];if(!m||!p)return;t.push(S(e,n,"builtin.http","http.handle",[{name:"method",value:p.toUpperCase(),evidence:"literal"},{name:"path",...m}],T([{name:"path",...m}]),"framework-adapter"));return}if(r==="fetch"||r.endsWith(".fetch")){let m=$(o[0],e);if(!m)return;let f=/\bmethod\s*:\s*['"`]([A-Za-z]+)['"`]/u.exec(o[1]?.text??"")?.[1]?.toUpperCase()??(o[1]?null:"GET"),y=[...f?[{name:"method",value:f,evidence:"literal"}]:[],{name:"path",...m}];t.push(S(e,n,"builtin.http","http.request",y,f?T(y):"candidate","call-expression"));return}if(!ot.has(i))return;let s=$(o[0],e);if(!s)return;let l=i.toUpperCase();if(cn.test(a)&&Y(e.source,["express","fastify","hono","koa-router","@koa/router"])){t.push(S(e,n,"builtin.http","http.handle",[{name:"method",value:l,evidence:"literal"},{name:"path",...s}],T([{name:"path",...s}]),"framework-adapter"));return}let c=Fn(e.source,["axios"]),d=a.split(".")[0]??"";c.has(d)&&t.push(S(e,n,"builtin.http","http.request",[{name:"method",value:l,evidence:"literal"},{name:"path",...s}],T([{name:"path",...s}]),"client-adapter"))}),t}}}function vn(){return{id:"builtin.capability-registry",supports:e=>/\b(?:execute|handler|invoke|run)\s*(?:[:(])/u.test(e)||/['"`][^'"`\n]{0,256}\b[A-Za-z_$][\w$-]*\s*\(/u.test(e),extract:e=>{let t=[],n=new Set;return k(e.root,r=>{if(r.type==="pair"){let a=r.childForFieldName("key")??r.namedChild(0),o=r.childForFieldName("value")??r.namedChild(1),s=a?.text.replace(/^['"`]|['"`]$/gu,"");if(s!=="name"&&s!=="id")return;let l=lt(o,e),u=Rn(r);if(!l||l.evidence!=="literal"||!u)return;let c=`handle\0${l.value}\0${u.startPosition.row}`;if(n.has(c))return;n.add(c),t.push(S(e,u,"builtin.capability-registry","registry.handle",[{name:"key",...l}],"exact","capability-descriptor"));return}if(!["string","string_literal","template_string"].includes(r.type))return;let i=r.text.replace(/^['"`]|['"`]$/gu,"");for(let a of i.matchAll(/\b([A-Za-z_$][\w$-]*)\s*\(/gu)){let o=a[1];if(!bn(i,o,a.index))continue;let s=`reference\0${o}\0${r.startPosition.row}`;n.has(s)||(n.add(s),t.push(S(e,r,"builtin.capability-registry","registry.reference",[{name:"key",value:o,evidence:"literal"}],"exact","capability-instruction-reference")))}}),t}}}function bn(e,t,n){if(t.includes("_")||t.includes("-"))return!0;let r=e.slice(Math.max(0,n-64),n);return/\b(?:use|call|invoke|run|via|with|read|stop)(?:\s+the)?(?:\s+(?:tool|capability|command))?\s*$/iu.test(r)}function xn(){return{id:"builtin.registry",supports:e=>/(?:Handlers?|Registry|Routes?)\b/iu.test(e),extract:e=>{let t=[];return k(e.root,n=>{if(n.type==="pair"){let a=En(n);if(!a)return;let o=n.childForFieldName("key")??n.namedChild(0),s=n.childForFieldName("value")??n.namedChild(1),l=lt(o,e);if(!l||!s||!ut(s))return;let u=Le(s)?"exact":"candidate";t.push(S(e,n,"builtin.registry","registry.handle",[{name:"registry",value:a,evidence:"identifier"},{name:"key",...l}],T([{name:"key",...l}],u),"object-member"));return}if(n.type!=="call_expression")return;let r=n.childForFieldName("function")??n.namedChild(0);if(!r)return;let i=/^([A-Za-z_$][\w$]*)\s*\[\s*(['"`])([^'"`]+)\2\s*\]$/u.exec(r.text.trim());i&&t.push(S(e,n,"builtin.registry","registry.dispatch",[{name:"registry",value:i[1],evidence:"identifier"},{name:"key",value:i[3],evidence:"literal"}],"exact","indexed-access-call"))}),t}}}function Sn(){return{id:"builtin.persistence",supports:e=>/\b(?:db|database|prisma|drizzle|[A-Za-z_$][\w$]*(?:Repository|Repo))\b[^;]{0,1024}?\.\s*(?:findFirst|findMany|findUnique|from|get|select|create|delete|insert|remove|update|upsert|execute|query|raw|transaction)(?:\s*<[^()]{1,512}>)?\s*\(/iu.test(e),extract:e=>{let t=[],n=Ln(e.root);return k(e.root,r=>{if(r.type!=="call_expression")return;let i=J(r);if(!i)return;let a=i.split("."),o=a.at(-1)??"",s=q(r),l=s[0]?.text??"",u=kn(o,l);if(!u)return;let c=ct(a,n);if(!c)return;let d=Nn(s[0],e)??_n(l),m=Tn(c,a,o,d);if(!m)return;let p=o==="insert"?"persistence-insert":u==="database.read"&&/\bFOR\s+UPDATE\s+SKIP\s+LOCKED\b/iu.test(l)?"persistence-skip-locked-claim":"persistence-adapter";t.push(S(e,r,"builtin.persistence",u,[{name:"resource",...m}],T([{name:"resource",...m}]),p))}),t}}}function Nn(e,t){if(!e)return null;let n=e.text.replace(/\s+/gu,"");return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/u.test(n)?{value:n.split(".").at(-1),evidence:"identifier",term:{kind:"symbol",symbol:n}}:$(e,t)}function Cn(){return{id:"builtin.queue",supports:e=>Y(e,["amqplib","bullmq","kafkajs","@aws-sdk/client-sqs","rabbitmq"])&&/\.(?:sendToQueue|consume|send|subscribe)\s*\(/u.test(e),extract:e=>{let t=[];return k(e.root,n=>{if(n.type!=="call_expression")return;let r=J(n);if(!r)return;let i=r.split(".").at(-1)??"",a=q(n),o=i==="sendToQueue"||i==="send"?"queue.send":i==="consume"||i==="subscribe"?"queue.consume":null;if(!o)return;let s=i==="send"||i==="subscribe"?Pn(a[0],"topic",e):$(a[0],e);s&&t.push(S(e,n,"builtin.queue",o,[{name:"address",...s}],T([{name:"address",...s}]),"framework-adapter"))}),t}}}function S(e,t,n,r,i,a,o){let s=e.ownerAt(t.startPosition.row),l=JSON.stringify({extractor:n,action:r,file:e.file,line:t.startPosition.row,keyParts:i});return{id:`boundary:${un("sha256").update(l).digest("hex").slice(0,16)}`,extractor:n,action:r,owner:s,source:{file:e.file,startLine:t.startPosition.row,endLine:t.endPosition.row},keyParts:i,evidence:o,strength:a,protocol:r.split(".")[0]??r,role:In(r),executionDomain:wn(e.file),derivation:{kind:a==="candidate"?"heuristic":a==="derived"?"mechanically-derived":"direct",rule:o,ruleVersion:"1",inputFactIds:i.flatMap(u=>u.derivation?.inputFactIds??[]),sourceSpans:[{file:e.file,startLine:t.startPosition.row,endLine:t.endPosition.row},...i.flatMap(u=>u.derivation?.sourceSpans??[])]},valuePrecision:i.some(u=>u.evidence==="expression")?"unknown":i.some(u=>u.evidence==="identifier")?"symbolic":"literal",modality:"may",resolution:"unresolved",sourceScope:se(e.file)}}function In(e){let t=e.split(".").at(-1)??e;return["handle","subscribe","consume","read"].includes(t)?"consumer":["request","publish","send","write","dispatch","reference","invoke","spawn","exec"].includes(t)?"producer":"observe"}function wn(e){let t=e.replaceAll("\\","/"),n=/^(apps|services|packages)\/([^/]+)/u.exec(t);return n?`${n[1]}/${n[2]}`:null}function Y(e,t){return t.some(n=>{let r=n.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(`(?:\\bfrom\\s+${r}\\b|\\buse\\s+${r}\\b|(?:\\bfrom\\s*|\\brequire\\s*\\(\\s*)['"]${r}(?:[/']|"))`,"u").test(e)})}function Fn(e,t){let n=new Set;for(let r of t){let i=r.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&"),a=new RegExp(`(?:import\\s+([A-Za-z_$][\\w$]*)[^;]*?\\sfrom\\s*|(?:const|let)\\s+([A-Za-z_$][\\w$]*)\\s*=\\s*require\\s*\\(\\s*)['"]${i}(?:[/']|")`,"gu");for(let o of e.matchAll(a)){let s=o[1]??o[2];s&&n.add(s)}}return n}function ye(e,t,n,r,i,a,o){return S(e,t,n,r,i,a,o)}function J(e){return(e.childForFieldName("function")??e.namedChild(0))?.text.replace(/\s+/gu,"")??null}function q(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function $(e,t){let n=R(t,e);return n?{value:n.value,evidence:n.evidence,term:n.term,derivation:n.derivation}:null}function Pn(e,t,n){if(!e)return null;let r=e.namedChildren.find(a=>a.type!=="pair"?!1:(a.childForFieldName("key")??a.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"")===t),i=r?.childForFieldName("value")??r?.namedChild(1);return $(i,n)}function lt(e,t){if(!e)return null;let n=$(e,t);if(n?.evidence==="literal"||n?.evidence==="constant")return n;let r=e.text.trim();return/^[A-Za-z_$][\w$]*$/u.test(r)?{value:r,evidence:"identifier",term:{kind:"symbol",symbol:r}}:n}function T(e,t="exact"){return t==="candidate"||e.some(n=>n.evidence==="expression")?"candidate":t==="derived"||e.some(n=>n.evidence==="constant")?"derived":"exact"}function Bn(e){let t=e.text.trim(),n=t[0];if(n!=="'"&&n!=='"'&&n!=="`"||t.at(-1)!==n)return null;let r=t.slice(1,-1);return n==="`"&&r.includes("${")?null:r}function $n(e){let t=new Map;return k(e,n=>{if(n.type!=="variable_declarator")return;let r=n.childForFieldName("name")??n.namedChild(0),i=n.childForFieldName("value")??n.namedChild(1);if(!r||!i||!/^[A-Za-z_$][\w$]*$/u.test(r.text))return;let a=Bn(i);a!==null&&t.set(r.text,a)}),t}function En(e){let t=e.parent,n=t?.parent??null;for(;n&&["as_expression","satisfies_expression","type_assertion","parenthesized_expression"].includes(n.type);)n=n.parent;if(!t||!n||n.type!=="variable_declarator")return null;let i=(n.childForFieldName("name")??n.namedChild(0))?.text??"";return/(?:handlers?|registry|routes?)$/iu.test(i)?i:null}function Le(e){return/(?:function|lambda|method)/u.test(e.type)||e.type==="arrow_function"}function ut(e){return Le(e)||e.type==="member_expression"?!0:e.type==="identifier"&&/(?:command|controller|dispatch|handle|handler)/iu.test(e.text)}function Rn(e){let t=e.parent;for(;t&&t.type!=="variable_declarator";){if(["object","object_literal","dictionary"].includes(t.type))for(let n of t.namedChildren){if(n.type==="pair"){let i=n.childForFieldName("key")??n.namedChild(0),a=n.childForFieldName("value")??n.namedChild(1),o=i?.text.replace(/^['"`]|['"`]$/gu,"");if(o&&["execute","handler","invoke","run"].includes(o)&&a&&ut(a))return t}let r=n.childForFieldName("name")??n.namedChild(0);if(r&&["execute","handler","invoke","run"].includes(r.text.replace(/^['"`]|['"`]$/gu,""))&&/(?:function|method)/u.test(n.type))return t}t=t.parent}return null}function ct(e,t=new Set){let n=e.slice(0,-1).map(r=>r.replace(/\([^)]*\)/gu,""));return n.some(r=>/^(?:prisma|drizzle)$/iu.test(r))?"orm":n.some(r=>/(?:Repository|Repo)$/u.test(r))?"repository":n.some(r=>/^(?:db|database)$/iu.test(r)||t.has(r))?"database":null}function kn(e,t){if(dn.has(e))return"database.read";if(pn.has(e))return"database.write";if(!mn.has(e))return null;let n=/\b(SELECT|INSERT|UPDATE|DELETE)\b/iu.exec(t)?.[1]?.toUpperCase();return n==="SELECT"?"database.read":n?"database.write":null}function Ln(e){let t=new Set;return k(e,n=>{if(n.type!=="call_expression")return;let r=J(n);if(!r)return;let i=r.split(".");if(!(i.at(-1)!=="transaction"||!ct(i)))for(let a of q(n)){if(!Le(a))continue;let s=(a.childForFieldName("parameters")??a.namedChildren.find(u=>/parameters/u.test(u.type)))?.namedChildren[0],l=s?dt(s):null;l&&t.add(l)}}),t}function dt(e){if(e.type==="identifier")return e.text;let t=e.childForFieldName("name")??e.childForFieldName("pattern");return t?dt(t):e.namedChildren.find(n=>n.type==="identifier")?.text??null}function _n(e){let t=pt(e);return t?{value:t,evidence:"identifier",term:{kind:"symbol",symbol:t}}:null}function Tn(e,t,n,r){if(e==="orm"&&t.length>=3)return{value:t.at(-2).replace(/\([^)]*\)/gu,""),evidence:"identifier"};if(e==="repository"){let a=t.at(-2)?.replace(/(?:Repository|Repo)$/u,"");return a?{value:a,evidence:"identifier"}:null}if(!r)return null;if(n==="from"||n==="insert")return r;let i=pt(r.value);return i?{value:i,evidence:r.evidence}:null}function pt(e){return/\b(?:from|into|update|table)\s+(?:\$\{\s*)?['"`]?([A-Za-z_$][\w$.-]*)/iu.exec(e)?.[1]??null}function k(e,t){t(e);for(let n of e.namedChildren)k(n,t)}var On=Z("resolved-call-syntax",{clearGroups:[]}),An=Z("resolved-call-sites",{clearGroups:[]});function Q(e,t){return An.get(e,t.symbolId,()=>Dn(e,t))}function Dn(e,t){let n=[],r=[],i=new Set,a=new Set;for(let o of Ze(e,t,{semantic:!1})){i.add(o.file);let s=On.get(e,o.file,()=>Mn(e,o.file));if(!s){r.push({callee:t,file:o.file,line:o.line,reason:"ast-unavailable",candidates:0,referenceProvenance:o.provenance});continue}let l=(s.byLeaf.get(t.leaf)??[]).filter(({callNode:d})=>d.startPosition.row<=o.line&&d.endPosition.row>=o.line);if(l.length!==1){r.push({callee:t,file:o.file,line:o.line,reason:l.length===0?"call-not-found":"ambiguous-call",candidates:l.length,referenceProvenance:o.provenance});continue}let u=l[0],c=`${o.file}\0${u.callNode.startIndex}\0${u.callNode.endIndex}`;a.has(c)||(a.add(c),n.push({callee:t,caller:oe(I(e,o.file),u.callNode.startPosition.row),file:o.file,line:o.line,startLine:u.callNode.startPosition.row,endLine:u.callNode.endPosition.row,targetText:u.targetNode.text,callNode:u.callNode,targetNode:u.targetNode,arguments:u.arguments,referenceProvenance:o.provenance}))}return{sites:n,unresolved:r,filesVisited:i.size}}function Mn(e,t){let n=B(e,t)?.rootNode;if(!n)return null;let r=new Map;return mt(n,i=>{if(i.type!=="call_expression"&&i.type!=="call")return;let a=i.childForFieldName("function")??i.namedChild(0);if(!a)return;let o=Ge(a);if(!o)return;let s=i.childForFieldName("arguments")??i.namedChildren.find(c=>c.type==="arguments"),l={callNode:i,targetNode:a,arguments:s?.namedChildren??[]},u=r.get(o);u?u.push(l):r.set(o,[l])}),{byLeaf:r}}function mt(e,t){t(e);for(let n of e.namedChildren)mt(n,t)}var Vn=Z("call-parameter-value-flow",{clearGroups:[]});function ee(e,t){let n=`${t.callee.symbolId}\0${t.file}\0${t.callNode.startIndex}\0${t.callNode.endIndex}`;return Vn.get(e,n,()=>zn(e,t))}function te(e,t){let n=new Set(t);return[...new Set(e.transfers.flatMap(r=>n.has(r.calleePosition)?[r.callerPosition]:[]))].sort((r,i)=>r-i)}function zn(e,t){let n={file:t.file,startLine:t.startLine,endLine:t.endLine};if(!t.caller)return{callee:t.callee,caller:null,call:n,transfers:[],unknown:t.arguments.map((l,u)=>({calleePosition:u,argumentText:l.text.trim(),reason:"caller-unavailable",proof:n}))};let r=B(e,t.caller.relativePath)?.rootNode,i=r?jn(r,t.caller.startLine,t.caller.endLine):null;if(!i)return{callee:t.callee,caller:t.caller,call:n,transfers:[],unknown:t.arguments.map((l,u)=>({calleePosition:u,argumentText:l.text.trim(),reason:"caller-syntax-unavailable",proof:n}))};let a=qn(i),o=[],s=[];return t.arguments.forEach((l,u)=>{let c=l.text.trim(),d=a.indexOf(c);d>=0?o.push({calleePosition:u,callerPosition:d,argumentText:c,proof:n}):s.push({calleePosition:u,argumentText:c,reason:"argument-not-direct-parameter",proof:n})}),{callee:t.callee,caller:t.caller,call:n,transfers:o,unknown:s}}function jn(e,t,n){let r=null;return yt(e,i=>{!/(?:function|method|lambda)/u.test(i.type)&&i.type!=="arrow_function"||i.startPosition.row>t||i.endPosition.row<n||(!r||i.endIndex-i.startIndex<r.endIndex-r.startIndex)&&(r=i)}),r}function qn(e){return(e.childForFieldName("parameters")??e.namedChildren.find(n=>/parameters/u.test(n.type)))?.namedChildren.map(ft)??[]}function ft(e){if(e.type==="identifier")return e.text;let t=e.childForFieldName("name")??e.childForFieldName("pattern");return t?ft(t):e.namedChildren.find(n=>n.type==="identifier")?.text??null}function yt(e,t){t(e);for(let n of e.namedChildren)yt(n,t)}var Un=8,Hn=8;function gt(e,t){let n=[],r=Gn(e,n),i=r.summaries,a=Kn(e,t,i,n),o=Xn(e,t,n);return{observations:ar([...a.observations,...o]),bodySummaries:i.size,discriminatorSummaries:a.summaries,filesInspected:r.filesInspected,errors:n}}function Gn(e,t){let n=new Map,r=[],i=H(e);for(let a of i){let o=M(e,a);if(!/\bJSON\.stringify\s*\(/u.test(o)||!/\bbody\s*:/u.test(o))continue;let s=N(e,a);if(s)for(let[l,u]of Zn(s)){let c={definition:l,parameterIndexes:u,depth:0,proofSpans:[{file:a,startLine:l.startLine,endLine:l.endLine}]};n.set(l.symbol,c),r.push(c)}}for(;r.length>0;){let a=r.shift();if(!(a.depth>=Un))try{for(let o of Q(e,a.definition).sites){if(!N(e,o.file))continue;let l=o.caller;if(!l)continue;let u=te(ee(e,o),a.parameterIndexes);if(u.length===0)continue;let c={definition:l,parameterIndexes:It(u),depth:a.depth+1,proofSpans:[...a.proofSpans,{file:o.file,startLine:o.startLine,endLine:o.endLine}]};Qn(n,c)&&r.push(n.get(l.symbol))}}catch(o){t.push(`builtin.carrier body summary failed for ${a.definition.relativePath}: ${Ae(o)}`)}}return{summaries:n,filesInspected:i.length}}function Kn(e,t,n,r){let i=new Map,a=[],o=[];for(let s of t){if(s.action!=="http.request"||s.strength==="candidate"||s.sourceScope!=="production")continue;let l=vt(s);if(!l)continue;let u=N(e,s.source.file);if(!u)continue;let c=St(u.root,s.source.startLine),d=c.find(P=>P.startPosition.row===s.source.startLine)??c[0];if(!d)continue;let m=Oe(d);if(!m)continue;let p=G(e,s.source.file,m.text);if(p.length!==1)continue;let f=n.get(p[0].symbol);if(!f)continue;let y=s.owner.symbol?I(e,s.owner.file).find(P=>P.symbol===s.owner.symbol):null;if(!y)continue;let h=er(u,y),C=ge(d);for(let P of f.parameterIndexes){let O=nr(u,C[P]);if(O)for(let v of rr(O)){let w=Nt(v),L=Ct(v);if(!w||!L)continue;let A=h.indexOf(L.text.trim());if(A>=0){let F={definition:y,carrier:l,field:w,parameterIndex:A,depth:0,proofObservationIds:[s.id],proofSpans:[s.source,{file:s.source.file,startLine:v.startPosition.row,endLine:v.endPosition.row}]},x=ht(F);i.has(x)||(i.set(x,F),a.push(F));continue}let b=R(u,L);!b||b.evidence==="expression"||o.push(Te(u,v,"carrier.publish",l,w,b.value,[s.id]))}}}for(;a.length>0;){let s=a.shift();if(!(s.depth>=Hn))try{for(let l of Q(e,s.definition).sites){let u=N(e,l.file);if(!u)continue;let c=l.callNode,d=ge(c)[s.parameterIndex];if(!d)continue;let m=R(u,d);m&&m.evidence!=="expression"&&o.push(Te(u,c,"carrier.publish",s.carrier,s.field,m.value,s.proofObservationIds));let p=l.caller;if(!p)continue;let f=ee(e,l).transfers.find(C=>C.calleePosition===s.parameterIndex)?.callerPosition;if(f===void 0)continue;let y={...s,definition:p,parameterIndex:f,depth:s.depth+1,proofSpans:[...s.proofSpans,{file:l.file,startLine:l.startLine,endLine:l.endLine}]},h=ht(y);i.has(h)||(i.set(h,y),a.push(y))}}catch(l){r.push(`builtin.carrier discriminator summary failed for ${s.definition.relativePath}: ${Ae(l)}`)}}return{observations:o,summaries:i.size}}function Xn(e,t,n){let r=[],i=t.filter(a=>a.action==="registry.handle"&&a.strength!=="candidate"&&a.sourceScope==="production");for(let a of t){if(a.action!=="http.handle"||a.strength==="candidate"||a.sourceScope!=="production")continue;let o=vt(a);if(!o)continue;let s=N(e,a.source.file);if(!s)continue;let l=St(s.root,a.source.startLine)[0];if(l)for(let u of ge(l).slice(1)){let c=G(e,a.source.file,u.text);for(let d of c)try{let m=N(e,d.relativePath);if(!m)continue;let p=he(m.root,d.startLine,d.endLine);if(!p)continue;V(p,f=>{if(f.type!=="call_expression")return;let y=Oe(f);if(!y)return;let h=/^([A-Za-z_$][\w$]*)\s*\[\s*([A-Za-z_$][\w$]*)\s*\]$/u.exec(y.text.trim());if(!h)return;let C=h[1],P=h[2],O=Yn(e,m,d,P);if(!O)return;let v=Jn(e,d.relativePath,C);for(let w of i){let L=w.keyParts.find(x=>x.name==="registry")?.value,A=w.keyParts.find(x=>x.name==="key")?.value;if(!L||!A||!v.some(x=>x.file===w.source.file&&x.binding===L))continue;let b=N(e,w.source.file),F=b?tr(b.root,w.source.startLine):null;!b||!F||r.push(Te(b,F,"carrier.consume",o,O,A,[a.id,w.id]))}})}catch(m){n.push(`builtin.carrier consumer analysis failed for ${d.relativePath}: ${Ae(m)}`)}}}return r}function Zn(e){let t=I(e.db,e.file),n=new Map;return V(e.root,r=>{if(r.type!=="pair"||Nt(r)?.toLowerCase()!=="body")return;let i=Ct(r);if(!i||!/\bJSON\.stringify\s*\(/u.test(i.text))return;let a=oe(t,r.startPosition.row),o=Wn(r);if(!a||!o)return;let s=bt(o),l=new Set;ir(i,s,l);let u=n.get(a.symbol)??new Set;s.forEach((c,d)=>{c&&l.has(c)&&u.add(d)}),u.size>0&&n.set(a.symbol,u)}),t.flatMap(r=>{let i=n.get(r.symbol);return i?[[r,[...i].sort((a,o)=>a-o)]]:[]})}function Wn(e){let t=e.parent;for(;t;){if(/(?:function|method|lambda)/u.test(t.type)||t.type==="arrow_function")return t;t=t.parent}return null}function Yn(e,t,n,r){let i=he(t.root,n.startLine,n.endLine);if(!i)return null;let a=new RegExp(`\\.body\\??\\.${_e(r)}\\b`,"u");if(a.test(i.text))return r;let o=null;if(V(i,c=>{if(o||c.type!=="variable_declarator")return;let d=c.childForFieldName("name")??c.namedChild(0),m=c.childForFieldName("value")??c.namedChild(1);!d||!m||!new RegExp(`(?:^|[,{}])\\s*${_e(r)}\\s*(?:[,}]|$)`,"u").test(d.text)||m.type==="call_expression"&&(o=Oe(m)?.text??null)}),!o)return null;let s=G(e,n.relativePath,o);if(s.length!==1)return null;let l=N(e,s[0].relativePath),u=l?he(l.root,s[0].startLine,s[0].endLine):null;return u&&a.test(u.text)&&new RegExp(`\\b${_e(r)}\\s*[,}]`,"u").test(u.text)?r:null}function Jn(e,t,n){let r=[];for(let i of Fe(e,t,n)){let a=ne(i.initializer);if(a.type==="call_expression")for(let o of ge(a)){let s=o.text.trim();if(/^[A-Za-z_$][\w$]*$/u.test(s))for(let l of Fe(e,i.definition.relativePath,s))r.push({file:l.definition.relativePath,binding:l.definition.leaf})}}return[...new Map(r.map(i=>[`${i.file}\0${i.binding}`,i])).values()]}function Te(e,t,n,r,i,a,o){let l=ye(e,t,"builtin.carrier",n,[{name:"carrier",value:r,evidence:"constant",term:{kind:"literal",value:r}},{name:"field",value:i,evidence:"literal",term:{kind:"literal",value:i}},{name:"value",value:a,evidence:"constant",term:{kind:"literal",value:a}}],"derived","http-body-registry-discriminator");return l.derivation={kind:"mechanically-derived",rule:"http-body-registry-discriminator",ruleVersion:"1",inputFactIds:[...o],sourceSpans:[l.source]},l}function vt(e){let t=e.keyParts.find(r=>r.name==="method"&&r.evidence!=="expression")?.value,n=e.keyParts.find(r=>r.name==="path"&&r.evidence!=="expression")?.value;return t&&n?`${t.toUpperCase()} ${n}`:null}function Qn(e,t){let n=e.get(t.definition.symbol);if(!n)return e.set(t.definition.symbol,t),!0;let r=It([...n.parameterIndexes,...t.parameterIndexes]);return r.length===n.parameterIndexes.length&&t.depth>=n.depth?!1:(e.set(t.definition.symbol,{...n,parameterIndexes:r,depth:Math.min(n.depth,t.depth),proofSpans:[...n.proofSpans,...t.proofSpans]}),!0)}function ht(e){return`${e.definition.symbol}\0${e.carrier}\0${e.field}\0${e.parameterIndex}`}function er(e,t){let n=he(e.root,t.startLine,t.endLine);return n?bt(n):[]}function bt(e){return(e.childForFieldName("parameters")??e.namedChildren.find(n=>/parameters/u.test(n.type)))?.namedChildren.map(xt)??[]}function xt(e){if(e.type==="identifier")return e.text;let t=e.childForFieldName("name")??e.childForFieldName("pattern");return t?xt(t):e.namedChildren.find(n=>n.type==="identifier")?.text??null}function he(e,t,n){let r=null;return V(e,i=>{!/(?:function|method|lambda)/u.test(i.type)&&i.type!=="arrow_function"||i.startPosition.row>t||i.endPosition.row<n||(!r||i.endIndex-i.startIndex<r.endIndex-r.startIndex)&&(r=i)}),r}function tr(e,t){let n=null;return V(e,r=>{r.startPosition.row>t||r.endPosition.row<t||(!n||r.endIndex-r.startIndex<n.endIndex-n.startIndex)&&(n=r)}),n}function St(e,t){let n=[];return V(e,r=>{r.type==="call_expression"&&r.startPosition.row<=t&&r.endPosition.row>=t&&n.push(r)}),n.sort((r,i)=>r.endIndex-r.startIndex-(i.endIndex-i.startIndex))}function Oe(e){return e.childForFieldName("function")??e.namedChild(0)}function ge(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function nr(e,t){if(!t)return null;let n=t.text.trim();if(!/^[A-Za-z_$][\w$]*$/u.test(n))return ne(t);let r=null;return V(e.root,i=>{r||i.type!=="variable_declarator"||(i.childForFieldName("name")??i.namedChild(0))?.text.trim()!==n||(r=i.childForFieldName("value")??i.namedChild(1))}),ne(r||t)}function rr(e){let t=ne(e);return t.type==="object"?t.namedChildren.filter(n=>n.type==="pair"||n.type==="shorthand_property_identifier"):[]}function Nt(e){return e.type==="shorthand_property_identifier"?e.text:(e.childForFieldName("key")??e.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"")??null}function Ct(e){return e.type==="shorthand_property_identifier"?e:e.childForFieldName("value")??e.namedChild(1)}function ne(e){let t=e;for(;["as_expression","satisfies_expression","type_assertion","parenthesized_expression"].includes(t.type)&&t.namedChildren.length>0;)t=t.namedChildren[0];return t}function ir(e,t,n){let r=new Set(e.text.match(/[A-Za-z_$][\w$]*/gu)??[]);for(let i of t)i&&r.has(i)&&n.add(i)}function It(e){return[...new Set(e)].sort((t,n)=>t-n)}function ar(e){return[...new Map(e.map(t=>[t.id,t])).values()]}function _e(e){return e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")}function Ae(e){return e instanceof Error?e.message:String(e)}function V(e,t){t(e);for(let n of e.namedChildren)V(n,t)}import{createHash as or}from"crypto";function wt(e,t){let n=new Map;for(let a of t){if(a.action!=="http.handle"||a.sourceScope!=="production")continue;let o=n.get(a.source.file)??[];o.push(a),n.set(a.source.file,o)}let r=[],i=sr(e);for(let a of i.mounts)for(let o of a.targetFiles)for(let s of n.get(o)??[]){let l=s.keyParts.find(m=>m.name==="path");if(!l||l.evidence==="expression")continue;let u=ur(a.prefix.value,l.value),c=s.keyParts.map(m=>m.name==="path"?{name:"path",value:u,evidence:"constant",term:{kind:"concat",parts:[a.prefix.term??{kind:"literal",value:a.prefix.value},l.term??{kind:"literal",value:l.value}]},derivation:{kind:"mechanically-derived",rule:"http.mount-prefix",ruleVersion:"1",inputFactIds:[s.id],sourceSpans:[s.source,{file:a.file,startLine:a.line,endLine:a.line},...a.prefix.derivation?.sourceSpans??[],...l.derivation?.sourceSpans??[]]}}:m),d=`${s.id}\0${a.file}\0${a.line}\0${u}`;r.push({...s,id:`boundary:${or("sha256").update(d).digest("hex").slice(0,16)}`,keyParts:c,strength:"derived",evidence:"framework-mount-composition",derivation:{kind:"mechanically-derived",rule:"http.mount-prefix",ruleVersion:"1",inputFactIds:[s.id],sourceSpans:[s.source,{file:a.file,startLine:a.line,endLine:a.line}]},resolution:"unresolved"}),s.strength="candidate",s.resolution="unresolved"}return{observations:r,filesInspected:i.filesInspected,mounts:i.mounts.length}}function sr(e){let t=[],n=H(e);for(let r of n){let i=M(e,r);if(!cr(i))continue;let a=N(e,r);a&&Ft(a.root,o=>{if(o.type!=="call_expression")return;let s=o.childForFieldName("function")??o.namedChild(0);if(!s||!/\.use$/u.test(s.text.replace(/\s+/gu,"")))return;let l=dr(o);if(l.length<2)return;let u=R(a,l[0]);if(!u||u.evidence==="expression")return;let c=lr(e,r,l[1]);c.length!==0&&t.push({file:r,line:o.startPosition.row,prefix:{value:u.value,evidence:u.evidence,term:u.term,derivation:u.derivation},targetFiles:c})})}return{mounts:t,filesInspected:n.length}}function lr(e,t,n){let r=n.text.replace(/\s+/gu,""),i=/^([A-Za-z_$][\w$]*)/u.exec(r)?.[1];if(!i)return[];let a=D(e,t).find(l=>l.localName===i&&l.sourcePath);if(!a?.sourcePath)return[t];if(a.kind==="namespace")return[a.sourcePath];let o=a.importedName==="default"?i:a.importedName,s=z(e,a.sourcePath,o);return[...new Set(s.map(l=>l.relativePath))]}function ur(e,t){let n=e==="/"?"":e.replace(/\/+$/u,""),r=t.startsWith("/")?t:`/${t}`;return`${n}${r}`||"/"}function cr(e){return/(?:\bfrom\s*|\brequire\s*\(\s*)['"](?:express|fastify|hono|koa-router|@koa\/router)(?:[/']|")/u.test(e)}function dr(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function Ft(e,t){t(e);for(let n of e.namedChildren)Ft(n,t)}import{createHash as pr}from"crypto";var De=new Set(["DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT"]),mr=8;function $t(e,t){let n=new Map,r=[],i=[],a=new Set,o=[],s=[];for(let l of t){if(l.action!=="http.request"||!l.owner.symbol||l.evidence!=="call-expression"&&l.evidence!=="client-adapter")continue;let u=I(e,l.owner.file).find(p=>p.symbol===l.owner.symbol);if(!u)continue;let c=N(e,u.relativePath);if(!c)continue;let d=Pt(c,u),m={definition:u,...d,constantMethods:l.keyParts.flatMap(p=>p.name==="method"&&p.evidence!=="expression"&&De.has(p.value.toUpperCase())?[p.value.toUpperCase()]:[]),depth:0,proofObservationIds:[l.id],proofSpans:[l.source]};Bt(n,m)&&r.push(n.get(u.symbol))}for(;r.length>0;){let l=r.shift();if(!(l.depth>=mr))try{let u=Q(e,l.definition);s.push(...u.unresolved.map(c=>fr(l,c)));for(let c of u.sites){let d=N(e,c.file);if(!d)continue;a.add(c.file);let m=c.callNode,p=hr(l,m,d);p&&i.push(p);let f=c.caller;if(!f)continue;let y=Pt(d,f),h=gr(e,l,c),C={definition:f,pathParameterIndexes:ve([...y.pathParameterIndexes,...h.pathParameterIndexes]),methodParameterIndexes:ve([...y.methodParameterIndexes,...h.methodParameterIndexes]),constantMethods:X([...l.constantMethods,...y.constantMethods]),depth:l.depth+1,proofObservationIds:X([...l.proofObservationIds,...p?[p.id]:[]]),proofSpans:[...l.proofSpans,{file:c.file,startLine:c.startLine,endLine:c.endLine}]};Bt(n,C)&&r.push(n.get(f.symbol))}}catch(u){o.push(`builtin.http-summary failed for ${l.definition.relativePath}:${l.definition.startLine+1}: ${u instanceof Error?u.message:String(u)}`)}}return{observations:i,frontiers:yr(s),summaries:n.size,filesInspected:a.size,errors:o}}function fr(e,t){let n=X([...e.pathParameterIndexes.length>0?["path"]:[],...e.methodParameterIndexes.length>0&&e.constantMethods.length!==1?["method"]:[]]),r=e.constantMethods.length===1?e.constantMethods[0]:"?",i=`${e.definition.symbol}\0${t.file}\0${t.line}\0${t.reason}`;return{observationId:`frontier:${pr("sha256").update(i).digest("hex").slice(0,16)}`,kind:"call-resolution",action:"http.request",strength:"candidate",source:{file:t.file,startLine:t.line,endLine:t.line},ownerShortName:null,address:`method=${r??"?"} path=?`,reason:`Compiler identity found a reference to ${e.definition.leaf}, but exact call recovery stopped with ${t.reason} (${t.candidates} syntax candidate(s)); HTTP value propagation did not cross this site.`,missingKeyParts:n.length>0?n:["call"],sourceScope:se(t.file)}}function yr(e){return[...new Map(e.map(t=>[t.observationId,t])).values()].sort((t,n)=>t.observationId.localeCompare(n.observationId))}function hr(e,t,n){let r=Rt(t),i=e.pathParameterIndexes.flatMap(d=>{let m=R(n,r[d]);return m&&m.evidence!=="expression"&&Sr(m.value)?[{index:d,value:m}]:[]}),a=e.methodParameterIndexes.flatMap(d=>{let m=R(n,r[d]),p=m?.value.toUpperCase();return m&&p&&m.evidence!=="expression"&&De.has(p)?[{index:d,value:{...m,value:p}}]:[]}),o=X([...e.constantMethods,...a.map(d=>d.value.value)]);if(i.length!==1||o.length!==1)return null;let s=i[0].value,l=a.find(d=>d.value.value===o[0])?.value,u=[{name:"method",value:o[0],evidence:l?"constant":"literal",term:l?.term??{kind:"literal",value:o[0]},derivation:l?.derivation},{name:"path",value:s.value,evidence:"constant",term:s.term,derivation:s.derivation}],c=ye(n,t,"builtin.http-summary","http.request",u,"derived","compiler-resolved-http-summary");return c.derivation={kind:"mechanically-derived",rule:"compiler-resolved-http-summary",ruleVersion:"1",inputFactIds:e.proofObservationIds,sourceSpans:[...e.proofSpans,c.source]},c}function Pt(e,t){let n=xr(e.root,t.startLine,t.endLine);if(!n)return{pathParameterIndexes:[],methodParameterIndexes:[],constantMethods:[]};let r=br(n),i=new Set,a=new Set,o=new Set;return Me(n,s=>{if(s.type==="call_expression"&&((s.childForFieldName("function")??s.namedChild(0))?.text.replace(/\s+/gu,"").split(".").at(-1)??"")==="fetch"){let p=Rt(s);re(p[0],r,i);let f=vr(p[1],"method");if(f){re(f,r,a);let y=R(e,f),h=y?.value.toUpperCase();h&&y?.evidence!=="expression"&&De.has(h)&&o.add(h)}else re(p[1],r,a)}if(s.type!=="pair")return;let l=s.childForFieldName("key")??s.namedChild(0),u=s.childForFieldName("value")??s.namedChild(1),c=l?.text.replace(/^['"`]|['"`]$/gu,"").toLowerCase();(c==="url"||c==="path"||c==="endpoint")&&re(u,r,i),(c==="init"||c==="requestinit"||c==="options")&&re(u,r,a)}),{pathParameterIndexes:r.flatMap((s,l)=>s&&i.has(s)?[l]:[]),methodParameterIndexes:r.flatMap((s,l)=>s&&a.has(s)?[l]:[]),constantMethods:[...o].sort()}}function gr(e,t,n){let r=ee(e,n);return{pathParameterIndexes:te(r,t.pathParameterIndexes),methodParameterIndexes:te(r,t.methodParameterIndexes)}}function Bt(e,t){let n=e.get(t.definition.symbol);if(!n)return e.set(t.definition.symbol,t),!0;let r=ve([...n.pathParameterIndexes,...t.pathParameterIndexes]),i=ve([...n.methodParameterIndexes,...t.methodParameterIndexes]),a=X([...n.constantMethods,...t.constantMethods]);return r.length!==n.pathParameterIndexes.length||i.length!==n.methodParameterIndexes.length||a.length!==n.constantMethods.length||t.depth<n.depth?(e.set(t.definition.symbol,{...n,pathParameterIndexes:r,methodParameterIndexes:i,constantMethods:a,depth:Math.min(n.depth,t.depth),proofObservationIds:X([...n.proofObservationIds,...t.proofObservationIds]),proofSpans:[...n.proofSpans,...t.proofSpans]}),!0):!1}function vr(e,t){if(!e)return null;for(let n of e.namedChildren)if(!(n.type!=="pair"||(n.childForFieldName("key")??n.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"").toLowerCase()!==t))return n.childForFieldName("value")??n.namedChild(1);return null}function re(e,t,n){if(!e)return;let r=new Set(e.text.match(/[A-Za-z_$][\w$]*/gu)??[]);for(let i of t)i&&r.has(i)&&n.add(i)}function br(e){return(e.childForFieldName("parameters")??e.namedChildren.find(n=>/parameters/u.test(n.type)))?.namedChildren.map(Et)??[]}function Et(e){if(e.type==="identifier")return e.text;let t=e.childForFieldName("name")??e.childForFieldName("pattern");return t?Et(t):e.namedChildren.find(n=>n.type==="identifier")?.text??null}function xr(e,t,n){let r=null;return Me(e,i=>{!/(?:function|method|lambda)/u.test(i.type)&&i.type!=="arrow_function"||i.startPosition.row>t||i.endPosition.row<n||(!r||i.endIndex-i.startIndex<r.endIndex-r.startIndex)&&(r=i)}),r}function Rt(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function Sr(e){return e.startsWith("/")||/^https?:\/\//iu.test(e)}function ve(e){return[...new Set(e)].sort((t,n)=>t-n)}function X(e){return[...new Set(e)].sort()}function Me(e,t){t(e);for(let n of e.namedChildren)Me(n,t)}import{createHash as Nr}from"crypto";function _t(e){let t=kt(e.filter(r=>r.action==="database.read"&&r.evidence==="persistence-skip-locked-claim")),n=kt(e.filter(r=>r.action==="database.write"&&r.evidence==="persistence-insert"));return e.flatMap(r=>r.action==="database.write"&&r.evidence==="persistence-insert"?Ve(r).flatMap(i=>{let a=t.get(i)?.[0];return a?[Lt(r,a,i,"queue.send")]:[]}):r.action==="database.read"&&r.evidence==="persistence-skip-locked-claim"?Ve(r).flatMap(i=>{let a=n.get(i)?.[0];return a?[Lt(r,a,i,"queue.consume")]:[]}):[])}function kt(e){let t=new Map;for(let n of e)for(let r of Ve(n)){let i=t.get(r);i?i.push(n):t.set(r,[n])}for(let n of t.values())n.sort((r,i)=>r.id.localeCompare(i.id));return t}function Ve(e){return e.keyParts.filter(t=>t.name==="resource").map(t=>t.value)}function Lt(e,t,n,r){let i=`database:${n}`,a=r==="queue.send"?"database-queue-insert":"database-queue-skip-locked-claim",o=[e.id,r,i,a].join("\0");return{...e,id:`boundary:${Nr("sha256").update(o).digest("hex").slice(0,16)}`,extractor:"builtin.database-queue",action:r,keyParts:[{name:"address",value:i,evidence:"identifier",term:{kind:"symbol",symbol:n},derivation:{kind:"mechanically-derived",rule:"database-work-queue.resource",ruleVersion:"1",inputFactIds:[e.id,t.id],sourceSpans:[e.source,t.source]}}],evidence:a,strength:"derived",protocol:"queue",role:r==="queue.send"?"producer":"consumer",derivation:{kind:"mechanically-derived",rule:"database-work-queue.insert-skip-locked",ruleVersion:"1",inputFactIds:[e.id,t.id],sourceSpans:[e.source,t.source]},valuePrecision:"symbolic",resolution:"unresolved"}}var ze="runtime-boundaries-v15",Se=[{id:"http.method-path",protocol:"http",producerActions:["http.request"],consumerActions:["http.handle"],keyNames:["method","path"],traversable:!0},{id:"registry.identity-key",protocol:"registry",producerActions:["registry.dispatch"],consumerActions:["registry.handle"],keyNames:["registry","key"],traversable:!0},{id:"registry.capability-key",protocol:"registry",producerActions:["registry.reference"],consumerActions:["registry.handle"],keyNames:["key"],traversable:!0,requireUniqueConsumer:!0},{id:"queue.address",protocol:"queue",producerActions:["queue.send"],consumerActions:["queue.consume"],keyNames:["address"],traversable:!0},{id:"carrier.discriminator",protocol:"carrier",producerActions:["carrier.publish"],consumerActions:["carrier.consume"],keyNames:["carrier","field","value"],traversable:!0},{id:"resource.identity",protocol:"database",producerActions:["database.write"],consumerActions:["database.read"],keyNames:["resource"],traversable:!1},{id:"framework.effect-httpapi-operation",protocol:"framework",producerActions:[],consumerActions:["framework.handle"],declarationActions:["framework.declare"],keyNames:["adapter","group","operation"],traversable:!0,linkFrom:"declaration",requireUniquePair:!0}],Cr=64;function Ir(e,t={}){let n=H(e),r=new Set(n),i=new Set((t.affectedFiles??[]).map(Br)),a=t.previousGraph?.fileCoverage,o=i.size>0&&t.previousGraph?.extractorVersion===ze&&a!==void 0&&a.length===t.previousGraph.coverage.filesScanned,s=o?a.filter(g=>r.has(g.file)&&!i.has(g.file)):[],l=new Set(s.flatMap(g=>g.observationIds)),u=o?t.previousGraph.observations.filter(g=>l.has(g.id)&&r.has(g.source.file)):[],c=o?n.filter(g=>i.has(g)):n,d=[],m=a?.reduce((g,Ne)=>g+Ne.observationIds.length,0)??0,p=performance.now(),f=wr(e,c);U(d,"direct-extraction",p,c.length,f.observations.length,{filesVisited:c.length,filesReused:s.length,factsReused:u.length,factsInvalidated:Math.max(0,m-u.length)});let y=[...s,...f.fileCoverage].sort((g,Ne)=>g.file.localeCompare(Ne.file)),h=Pr(y),C=y.flatMap(g=>g.extractionErrors),P=ie([...u,...f.observations]),O=ie([...P,..._t(P)]);p=performance.now();let v=$t(e,O);U(d,"http-summary",p,O.length,v.observations.length,{filesVisited:v.filesInspected}),h.set("builtin.wrapper",{id:"builtin.wrapper",applicableFiles:v.filesInspected,observations:v.observations.length,errors:v.errors.length}),C.push(...v.errors);let w=ie([...O,...v.observations]);p=performance.now();let L=wt(e,w);U(d,"http-mount",p,w.length,L.observations.length,{filesVisited:L.filesInspected});let A=ie([...w,...L.observations]);p=performance.now();let b=gt(e,A);U(d,"carrier",p,A.length,b.observations.length,{filesVisited:b.filesInspected}),h.set("builtin.carrier",{id:"builtin.carrier",applicableFiles:b.bodySummaries,observations:b.observations.length,errors:b.errors.length}),C.push(...b.errors);let F=ie([...A,...b.observations]);p=performance.now();let x=$r(F);U(d,"relations",p,F.length,x.length),p=performance.now();let je=Rr(F,x);U(d,"links",p,x.length,je.length),kr(F,x),p=performance.now();let qe=Tr([...Lr(F,x),...v.frontiers]);return U(d,"frontiers",p,F.length,qe.length),{schemaVersion:2,extractorVersion:ze,observations:F,relationGroups:x,links:je,frontiers:qe,coverage:{filesScanned:n.length,filesWithAst:y.filter(g=>g.hasAst).length,filesWithoutAst:y.filter(g=>!g.hasAst).length,...o?{filesReused:s.length}:{},extractors:[...h.values()],extractionErrors:C,phases:d},fileCoverage:y}}function U(e,t,n,r,i,a={}){e.push({id:t,durationMs:Math.max(0,performance.now()-n),inputFacts:r,outputFacts:i,...a})}function wr(e,t){let n=[],r=[];for(let i of t){let a=M(e,i),o=ke.filter(u=>u.supports(a)),s=o.length>0?N(e,i):null,l={file:i,hasAst:s!==null||Fr(i,a),observationIds:[],extractors:[],extractionErrors:[]};if(s)for(let u of o){let c={id:u.id,applicableFiles:1,observations:0,errors:0};try{let d=u.extract(s);c.observations=d.length,n.push(...d),l.observationIds.push(...d.map(m=>m.id))}catch(d){c.errors=1,l.extractionErrors.push(`${u.id} failed for ${i}: ${d instanceof Error?d.message:String(d)}`)}l.extractors.push(c)}r.push(l)}return{observations:n,fileCoverage:r}}function Fr(e,t){return t?He(e)?/<script\b/iu.test(t):Ue(e)!==null:!1}function Pr(e){let t=new Map(ke.map(n=>[n.id,{id:n.id,applicableFiles:0,observations:0,errors:0}]));for(let n of e)for(let r of n.extractors){let i=t.get(r.id);i&&(i.applicableFiles+=r.applicableFiles,i.observations+=r.observations,i.errors+=r.errors)}return t}function Br(e){return e.replaceAll("\\","/").replace(/^\.\//u,"")}function $r(e){let t=new Map;for(let n of Se){let r=new Set([...n.producerActions,...n.consumerActions,...n.declarationActions??[]]);for(let i of e){if(!r.has(i.action)||i.strength==="candidate")continue;let a=Or(i,n.keyNames);if(!a)continue;let o=a.map(d=>`${d.name}=${At(d.name,d.value)}`).join("\0"),s=i.sourceScope==="production"?"production":i.sourceScope,l=`${n.id}\0${s}\0${o}`,u=`boundary-group:${Tt("sha256").update(l).digest("hex").slice(0,16)}`,c=t.get(u)??{id:u,protocol:n.protocol,joinRule:n.id,normalizedKey:o,keyParts:a,producerIds:[],consumerIds:[],declarationIds:[],derivation:{kind:"mechanically-derived",rule:n.id,ruleVersion:"2",inputFactIds:[],sourceSpans:[]}};n.producerActions.includes(i.action)&&c.producerIds.push(i.id),n.consumerActions.includes(i.action)&&c.consumerIds.push(i.id),n.declarationActions?.includes(i.action)&&c.declarationIds.push(i.id),c.derivation.inputFactIds.push(i.id),c.derivation.sourceSpans.push(i.source),t.set(u,c)}}return[...t.values()].map(Er).sort(Dr)}function Er(e){return{...e,producerIds:be(e.producerIds),consumerIds:be(e.consumerIds),declarationIds:be(e.declarationIds),derivation:{...e.derivation,inputFactIds:be(e.derivation.inputFactIds),sourceSpans:[...new Map(e.derivation.sourceSpans.map(t=>[`${t.file}:${t.startLine}:${t.endLine}`,t])).values()]}}}function Rr(e,t){let n=new Map(e.map(i=>[i.id,i])),r=new Map;for(let i of t){let a=Se.find(s=>s.id===i.joinRule);if(!a?.traversable)continue;let o=a.linkFrom==="declaration"?i.declarationIds:i.producerIds;if(!(o.length===0||i.consumerIds.length===0)&&!(a.requireUniquePair&&(o.length!==1||i.consumerIds.length!==1))&&!(a.requireUniqueConsumer&&i.consumerIds.length!==1)&&!(o.length*i.consumerIds.length>Cr))for(let s of o)for(let l of i.consumerIds){let u=n.get(s),c=n.get(l);if(!u||!c||Ar(u,c))continue;let d=u.strength==="derived"||c.strength==="derived"?"derived":"exact",m=`${i.joinRule}\0${s}\0${l}`,p={id:`boundary-link:${Tt("sha256").update(m).digest("hex").slice(0,16)}`,from:s,to:l,joinRule:i.joinRule,matchedKeyParts:i.keyParts,strength:d,derivation:{kind:"mechanically-derived",rule:i.joinRule,ruleVersion:"2",inputFactIds:[s,l],sourceSpans:[u.source,c.source]}};r.set(p.id,p)}}return[...r.values()].sort(Mr)}function kr(e,t){let n=new Set(t.filter(Ot).flatMap(xe)),r=new Set(t.filter(_r).flatMap(xe));for(let i of e)i.resolution=n.has(i.id)?"locally-linked":r.has(i.id)?"ambiguous":"unresolved"}function Lr(e,t){let n=new Set(e.filter(a=>a.strength!=="candidate").map(a=>`${a.action}\0${a.source.file}\0${a.source.startLine}\0${a.source.endLine}`)),r=new Set(t.flatMap(xe)),i=new Set(t.filter(Ot).flatMap(xe));return e.filter(a=>a.sourceScope==="production").filter(a=>a.strength!=="candidate"||!n.has(`${a.action}\0${a.source.file}\0${a.source.startLine}\0${a.source.endLine}`)).filter(a=>!i.has(a.id)).map(a=>{let o=a.keyParts.filter(l=>l.evidence==="expression"||l.value.length===0).map(l=>l.name),s=o.length>0?`${a.extractor} observed ${a.action}, but ${o.join(", ")} remained symbolic or unknown.`:a.resolution==="ambiguous"?`${a.extractor} established the address for ${a.action}, but more than one indexed peer has the same runtime key.`:r.has(a.id)?`${a.extractor} established the address for ${a.action}, but the indexed production scope contains no counterpart role in that relation group.`:`${a.extractor} observed ${a.action}, but no supported factorization rule could establish its addressed relation.`;return{observationId:a.id,reason:s,missingKeyParts:o,sourceScope:a.sourceScope}}).sort((a,o)=>a.observationId.localeCompare(o.observationId))}function xe(e){return[...e.producerIds,...e.consumerIds,...e.declarationIds]}function Ot(e){let t=Se.find(r=>r.id===e.joinRule);if(!t)return!1;let n=t.linkFrom==="declaration"?e.declarationIds:e.producerIds;return n.length===0||e.consumerIds.length===0?!1:!t.requireUniquePair||n.length===1&&e.consumerIds.length===1}function _r(e){let t=Se.find(r=>r.id===e.joinRule);if(!t?.requireUniquePair)return!1;let n=t.linkFrom==="declaration"?e.declarationIds:e.producerIds;return n.length>0&&e.consumerIds.length>0&&(n.length!==1||e.consumerIds.length!==1)}function Tr(e){return[...new Map(e.map(t=>[t.observationId,t])).values()].sort((t,n)=>t.observationId.localeCompare(n.observationId))}function Or(e,t){let n=[];for(let r of t){let i=e.keyParts.find(a=>a.name===r);if(!i||i.evidence==="expression"||i.value.length===0)return null;n.push({...i,value:At(r,i.value)})}return n}function At(e,t){if(e==="method")return t.toUpperCase();if(e!=="path")return t;let n=t.startsWith("/")?t:`/${t}`;return n.length>1?n.replace(/\/+$/u,""):n}function Ar(e,t){return e.source.file===t.source.file&&e.source.startLine===t.source.startLine}function ie(e){return[...new Map(e.map(t=>[t.id,t])).values()].sort((t,n)=>t.source.file.localeCompare(n.source.file)||t.source.startLine-n.source.startLine||t.action.localeCompare(n.action))}function be(e){return[...new Set(e)].sort()}function Dr(e,t){return e.joinRule.localeCompare(t.joinRule)||e.normalizedKey.localeCompare(t.normalizedKey)}function Mr(e,t){return e.joinRule.localeCompare(t.joinRule)||e.from.localeCompare(t.from)||e.to.localeCompare(t.to)}export{se as a,R as b,Q as c,ee as d,ze as e,Ir as f,Mt as g,Vt as h,We as i};
|
|
49
|
+
//# sourceMappingURL=chunk-FQKZWM4L.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{c as f}from"./chunk-7FND7D7N.js";import{a as L}from"./chunk-UZGZB3VB.js";import{d as i,e as b,f as u,l as c}from"./chunk-FETNQCFO.js";import{f as l}from"./chunk-O6QTXQPJ.js";import{z as a}from"./chunk-ADTBPVUZ.js";function S(o,s){let t=L(o,s);if(!t)return[];let e=new f(o).definitionsForFile(t.relativePath).filter(r=>r.symbol!==t.symbol).filter(r=>c(t.symbol,r.symbol)).sort((r,m)=>r.startLine-m.startLine||r.endLine-m.endLine).map(r=>({symbol:r.symbol,shortName:i(r.symbol),startLine:r.startLine,endLine:r.endLine,kind:u(r.symbol)??"unknown"}));return a(t.relativePath)!=="clojure"?e:d(e,y(o,t))}function y(o,s){let t=b(s.symbol);if(!t)return[];let n=i(s.symbol);return(l(o,s.relativePath)?.clojureMembers??[]).filter(e=>e.ownerName===t).map(e=>({symbol:`${s.symbol}${e.memberName}().`,shortName:`${n}:${e.memberName}()`,startLine:e.startLine,endLine:e.endLine,kind:e.memberKind}))}function d(o,s){let t=new Map;for(let n of[...o,...s])t.set(`${n.shortName}:${n.startLine}:${n.endLine}`,n);return[...t.values()].sort((n,e)=>n.startLine-e.startLine||n.endLine-e.endLine)}export{S as a};
|
|
2
|
+
//# sourceMappingURL=chunk-FW53T7EB.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{C as be,Ca as Ae,H as ve,L as Se,S as xe,T as Ce,Ua as _e,W as Re,X as Oe,Y as Ie,Za as Te,_a as je,d as he,ea as we,r as ye,ra as Ee,sa as Pe,xa as ke}from"./chunk-2X7V4HS4.js";import{A as f,D as y,h as ue,j as pe,k as le,p as fe,q as F,s as me,y as J,z as ge}from"./chunk-SNNWPCN7.js";import{existsSync as W,statSync as Fn}from"fs";import{join as $n}from"path";import{existsSync as E}from"fs";import{randomUUID as tt}from"crypto";import{isAbsolute as ze,join as x,relative as Xe,resolve as Qe}from"path";var C=1,R=2,yt="./node_modules/codebaseiq/docs/schemas/project-config.schema.json";function z(e){let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch(a){return{kind:"malformed",reason:`invalid JSON: ${a instanceof Error?a.message:String(a)}`}}if(!f(t))return{kind:"malformed",reason:"project config must be a JSON object"};let n=t.schemaVersion;if(n!==void 0&&!Number.isInteger(n))return{kind:"malformed",reason:"schemaVersion must be an integer"};let r=n===void 0?C:n;if(r!==C&&r!==R)return{kind:"unsupported",schemaVersion:r,direction:r<C?"older":"future"};let i=t.$schema;if(i!==void 0&&(typeof i!="string"||i.trim()===""))return{kind:"malformed",reason:"$schema must be a non-empty string when present"};let o=$(t),s=r!==R||typeof t.$schema!="string";return r===C?{kind:"legacy",sourceVersion:C,config:o,needsMigration:s}:{kind:"supported",sourceVersion:R,config:o,needsMigration:s}}function $(e){let t=e,{$schema:n,schemaVersion:r,...i}=t;return{$schema:typeof n=="string"&&n.trim()!==""?n:yt,schemaVersion:R,...i}}function Me(e){return`${JSON.stringify($(e),null,2)}
|
|
3
|
+
`}import{createHash as bt}from"crypto";var v=1,A=2,Ve=1,ee=1,Z="sha256",vt=1;function Kn(e,t,n){if(!y(e)||!Ue(t))throw new Error("Observation identity requires a bounded projection name and positive projection version.");return{schemaVersion:Ve,canonicalizationVersion:ee,hashAlgorithm:Z,projection:{name:e,version:t},digest:bt(Z).update(St(e,t,n)).digest("hex")}}function St(e,t,n){return`{"canonicalizationVersion":${ee},"projection":${JSON.stringify(e)},"projectionVersion":${t},"value":${JSON.stringify(n)}}`}function xt(e){if(!f(e))return{kind:"malformed",reason:"observation receipt must be an object"};let t=e.schemaVersion;if(!Number.isInteger(t))return{kind:"malformed",reason:"observation receipt schemaVersion must be an integer"};if(t===v)return Pt(e)?{kind:"legacy",schemaVersion:v,receipt:e}:{kind:"malformed",reason:"observation receipt v1 fields are malformed or contradictory"};if(t===A)return kt(e)?{kind:"supported",schemaVersion:A,receipt:e}:{kind:"malformed",reason:"observation receipt v2 facts are malformed or contradictory"};let n=t;return{kind:"unsupported",schemaVersion:n,direction:n<v?"older":"future"}}function qe(e){let t=xt(e);return t.kind==="legacy"||t.kind==="supported"}function Ct(e,t){return{collaborationDomain:w(b(e,n=>n.facts.collaborationDomain),b(t,n=>n.facts.collaborationDomain)),repositoryLineage:w(b(e,n=>n.facts.repositoryLineage),b(t,n=>n.facts.repositoryLineage)),workspaceInstance:w(b(e,n=>n.facts.workspaceInstance),b(t,n=>n.facts.workspaceInstance)),wholeContent:w(b(e,n=>n.facts.wholeContent),b(t,n=>n.facts.wholeContent)),relevantInputs:Rt(e,t),indexInput:w(b(e,n=>n.facts.index?.inputs),b(t,n=>n.facts.index?.inputs)),indexGeneration:Ot(e,t),observationStability:wt(e,t)}}function Jn(e,t,n=Ct(e,t)){let r=[["collaborationDomain",n.collaborationDomain],["wholeContent",n.wholeContent],["observationStability",n.observationStability]],i=[];for(let[s,a]of r)a.state!=="established"&&i.push(`${s}:${a.state}`);for(let[s,a]of[["left",e],["right",t]]){let c=Et(a);c!=="not-applicable"&&c!=="established"&&i.push(`${s}IndexAlignment:${c}`)}let o=r.some(([,s])=>s.state==="disproven")||i.some(s=>s.endsWith(":disproven"));return{policyVersion:vt,authority:i.length===0?"completion":o?"none":"advisory",requiredRelationships:["collaborationDomain","wholeContent","observationStability"],reasons:i}}function Rt(e,t){let n=Ne(e),r=Ne(t);return[...new Set([...n.keys(),...r.keys()])].sort().map(o=>{let s=n.get(o),a=r.get(o),c=s?.subject??a?.subject??o,p=s?.identity.projection.name??a?.identity.projection.name??o;return{subject:c,projection:p,judgment:w(s?.identity,a?.identity)}})}function Ne(e){return e.schemaVersion!==A?new Map:new Map((e.facts.relevantInputs??[]).map(t=>[`${t.subject}\0${t.identity.projection.name}`,t]))}function Ot(e,t){return e.schemaVersion===v&&t.schemaVersion===v?It(e.index?.generationIdentity,t.index?.generationIdentity):e.schemaVersion===v||t.schemaVersion===v?S("unknown",["legacy-fact-not-comparable"],$e(e),$e(t)):w(e.facts.index?.generation,t.facts.index?.generation)}function It(e,t){let n=e?[{kind:"legacy-index-generation",value:e}]:[],r=t?[{kind:"legacy-index-generation",value:t}]:[];return e===void 0||t===void 0?Be(n,r):S(e===t?"established":"disproven",[e===t?"identities-equal":"identities-different"],n,r)}function w(e,t){let n=e?[{kind:"identity",identity:e}]:[],r=t?[{kind:"identity",identity:t}]:[];return!e||!t?Be(n,r):te(e,t)?S(e.digest===t.digest?"established":"disproven",[e.digest===t.digest?"identities-equal":"identities-different"],n,r):S("unknown",["identity-projections-not-comparable"],n,r)}function wt(e,t){if(e.schemaVersion===v||t.schemaVersion===v)return S("unknown",["legacy-fact-not-comparable"],[],[]);let n=De(e),r=De(t),i=Fe(e),o=Fe(t);return i==="invalidated"||o==="invalidated"?S("disproven",[...i==="invalidated"?["left-observation-invalidated"]:[],...o==="invalidated"?["right-observation-invalidated"]:[]],n,r):i!=="fixed"||o!=="fixed"?S("unknown",[...i==="no-repository-source"?["left-observation-has-no-repository-source"]:i!=="fixed"?["left-observation-not-fixed"]:[],...o==="no-repository-source"?["right-observation-has-no-repository-source"]:o!=="fixed"?["right-observation-not-fixed"]:[]],n,r):S("established",["all-observed-sources-fixed"],n,r)}function Fe(e){let t=e.observedSources.filter(r=>r.kind!=="process");if(t.length===0)return"no-repository-source";let n=new Map(e.stabilityProofs.map(r=>[r.source,r.kind]));return t.some(r=>n.get(r.kind)==="invalidated")?"invalidated":t.every(r=>{let i=n.get(r.kind);return i==="immutable"||i==="fixed-snapshot"})?"fixed":"unknown"}function Et(e){if(e.schemaVersion!==A)return e.index?"unknown":"not-applicable";if(!e.observedSources.some(r=>r.kind==="index-generation"))return"not-applicable";let t=e.facts.index?.inputs;if(!t)return"unknown";let n=(e.facts.relevantInputs??[]).find(r=>te(r.identity,t))?.identity;return n?n.digest===t.digest?"established":"disproven":"unknown"}function b(e,t){return e.schemaVersion===A?t(e):void 0}function $e(e){return e.schemaVersion===v&&e.index?[{kind:"legacy-index-generation",value:e.index.generationIdentity}]:e.schemaVersion===A&&e.facts.index?[{kind:"identity",identity:e.facts.index.generation}]:[]}function De(e){return e.stabilityProofs.map(t=>({kind:"stability",proof:t}))}function Be(e,t){let n=e.length===0&&t.length===0?"both-facts-missing":e.length===0?"left-fact-missing":"right-fact-missing";return S("unknown",[n],e,t)}function S(e,t,n,r){return{state:e,reasons:t,facts:{left:n,right:r}}}function te(e,t){return e.schemaVersion===t.schemaVersion&&e.canonicalizationVersion===t.canonicalizationVersion&&e.hashAlgorithm===t.hashAlgorithm&&e.projection.name===t.projection.name&&e.projection.version===t.projection.version}function Pt(e){if(!f(e))return!1;let t=e.index,n=e.worktree;return Ge(e.observedAt)&&y(e.projectIdentity)&&Ft(e.authorityKind)&&(t===void 0||f(t)&&y(t.generationIdentity)&&(t.source==="immutable"||t.source==="legacy")&&(t.alignment==="not-certified"||t.alignment==="leased"))&&(n===void 0||f(n)&&y(n.identity)&&typeof n.clean=="boolean"&&(n.headCommit===void 0||y(n.headCommit))&&(n.treeOid===void 0||y(n.treeOid)))&&Nt(e.authorityKind,t,n)}function kt(e){if(!f(e))return!1;let t=e.facts,n=e.observedSources,r=e.stabilityProofs;if(!Ge(e.observedAt)||!f(t)||!Array.isArray(n)||n.length===0||!n.every(_t)||!Q(n,c=>c.kind)||!Array.isArray(r)||!r.every(Tt)||!Q(r,c=>c.source)||r.some(c=>!n.some(p=>p.kind===c.source))||!r.every(c=>Mt(c,t))||["collaborationDomain","repositoryLineage","workspaceInstance","wholeContent"].some(c=>t[c]!==void 0&&!O(t[c])))return!1;let o=t.relevantInputs;if(o!==void 0&&(!Array.isArray(o)||!o.every(At)||!Q(o,c=>`${c.subject}\0${c.identity.projection.name}`)))return!1;let s=t.index;if(s!==void 0&&(!f(s)||!O(s.generation)||s.inputs!==void 0&&!O(s.inputs)||s.source!=="immutable"&&s.source!=="legacy"))return!1;let a=e.diagnostics;return(a===void 0||f(a)&&(a.clean===void 0||typeof a.clean=="boolean")&&(a.headCommit===void 0||y(a.headCommit))&&(a.treeOid===void 0||y(a.treeOid)))&&jt(t,n)}function O(e){return!f(e)||!f(e.projection)?!1:e.schemaVersion===Ve&&e.canonicalizationVersion===ee&&e.hashAlgorithm===Z&&y(e.projection.name)&&Ue(e.projection.version)&&typeof e.digest=="string"&&/^[a-f0-9]{64}$/u.test(e.digest)}function At(e){return f(e)&&y(e.subject)&&O(e.identity)}function _t(e){return f(e)&&Le(e.kind)&&(e.identity===void 0||O(e.identity))}function Tt(e){return f(e)&&Le(e.source)&&(e.kind==="immutable"||e.kind==="fixed-snapshot"||e.kind==="bracketed"||e.kind==="not-established"||e.kind==="invalidated")}function jt(e,t){let n=e.index,r=t.find(c=>c.kind==="index-generation");if(r){if(!f(n)||!O(n.generation)||r.identity&&!X(r.identity,n.generation))return!1}else if(n!==void 0)return!1;let i=e.workspaceInstance,o=t.find(c=>c.kind==="live-workspace");if(o?.identity&&(!O(i)||!X(o.identity,i)))return!1;let s=e.wholeContent,a=t.find(c=>c.kind==="repository-snapshot");return!(a?.identity&&(!O(s)||!X(a.identity,s)))}function Mt(e,t){return e.kind==="not-established"||e.kind==="invalidated"?!0:e.source==="index-generation"?e.kind==="immutable"&&f(t.index)&&t.index.source==="immutable":e.source==="repository-snapshot"?e.kind==="fixed-snapshot":e.source==="live-workspace"?e.kind==="bracketed":!1}function X(e,t){return te(e,t)&&e.digest===t.digest}function Nt(e,t,n){return e==="index-worktree"?t!==void 0&&n!==void 0:e==="index-only"?t!==void 0&&n===void 0:e==="worktree-only"?t===void 0&&n!==void 0:e==="process-local"&&t===void 0&&n===void 0}function Ft(e){return e==="index-worktree"||e==="index-only"||e==="worktree-only"||e==="process-local"}function Le(e){return e==="index-generation"||e==="repository-snapshot"||e==="live-workspace"||e==="process"}function Ge(e){return typeof e=="string"&&!Number.isNaN(Date.parse(e))}function Ue(e){return Number.isSafeInteger(e)&&e>0}function Q(e,t){return new Set(e.map(t)).size===e.length}function D(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=e;return t.kind==="automated-adjudication"&&t.policyVersion===1&&(t.decidedBy==="agent"||t.decidedBy==="human")&&ge.includes(t.reasonCode)&&Array.isArray(t.evidence)&&t.evidence.length>0&&t.evidence.every($t)&&(t.observation===void 0||qe(t.observation))&&!!t.invalidateOn&&typeof t.invalidateOn=="object"&&typeof t.invalidateOn.targetContentChange=="boolean"&&typeof t.invalidateOn.detectorMajorChange=="boolean"}function $t(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=e;return(t.kind==="source"||t.kind==="config"||t.kind==="test"||t.kind==="graph")&&typeof t.referent=="string"&&t.referent.trim()!==""&&typeof t.claim=="string"&&t.claim.trim()!==""&&(t.contentHash===void 0||/^[a-f0-9]{64}$/u.test(t.contentHash))&&(t.generation===void 0||typeof t.generation=="string"&&t.generation.length>0)}var V=class extends Error{constructor(n,r,i){super(`${n} is ${r} characters; the safety limit is ${i} characters`);this.inputKind=n;this.observedCharacters=r;this.limitCharacters=i;this.name="RegExpPatternBudgetError"}inputKind;observedCharacters;limitCharacters;code="CODEBASEIQ_REGEXP_PATTERN_BUDGET"};function ne(e,t,n,r=4096){if(!Number.isSafeInteger(r)||r<0)throw new RangeError(`maxCharacters must be a non-negative safe integer; received ${r}`);if(e.length>r)throw new V(t,e.length,r);return new RegExp(e,n)}import{createHash as He}from"crypto";import{closeSync as Dt,fstatSync as Ye,openSync as Vt,rmSync as qt}from"fs";import{dirname as Bt}from"path";var Lt=2e3,Gt=10,Ut=3,B=class extends Error{constructor(n,r,i){super(`Concurrent edit detected for ${n}; expected revision ${Ke(r)}, but found ${Ke(i)}. The latest file was left untouched.`);this.path=n;this.original=r;this.latest=i;this.name="FileRevisionConflictError"}path;original;latest},T=class extends Error{constructor(n,r){super(`Concurrent edit detected for ${n}: ${r} changed since it was read. The latest file was left untouched; reload it and retry.`);this.path=n;this.field=r;this.name="FileContentConflictError"}path;field};function j(e,t,n={}){let r=Ht(e,n.lockTimeoutMs??Lt,n.monotonicNow??ve);try{let i=Math.max(0,Math.floor(n.maxRetries??Ut));for(let o=0;;o+=1){let s=q(e),a=t(s,o);if(a.kind==="unchanged")return{changed:!1,attempts:o+1,previous:s,current:s};n.onBeforeCommit?.({attempt:o,snapshot:s,mutation:a});let c=q(e);if(!Wt(s.revision,c.revision)){if(o<i)continue;throw new B(e,s.revision,c.revision)}try{Yt(e,a,s.revision)}catch(p){if(p.code==="EEXIST"){let l=q(e);if(o<i)continue;throw new B(e,s.revision,l.revision)}throw p}return{changed:!0,attempts:o+1,previous:s,current:q(e)}}}finally{r.release()}}function q(e){for(let t=0;t<4;t+=1){let n;try{n=Vt(e,"r");let r=We(Ye(n)),i=me(n,{maxBytes:le,inputKind:"revisioned text file"}),o=We(Ye(n));if(!Je(r,o))continue;return{path:e,text:i,revision:{exists:!0,hash:He("sha256").update(i).digest("hex"),identity:o}}}catch(r){if(r.code==="ENOENT")return{path:e,text:"",revision:{exists:!1,hash:He("sha256").update("").digest("hex")}};throw r}finally{n!==void 0&&Dt(n)}}throw new Error(`Could not read a stable revision of ${e}; the file is changing continuously.`)}function Ht(e,t,n){let r=`${e}.codebaseiq-write.lock`,i=n()+Math.max(0,t);for(;;){let o=Se(r,{kind:"revisioned-file-mutation",detail:{target:e}});if(o.kind==="acquired")return o.lock;if(n()>=i)throw new Error(`Timed out after ${t}ms waiting to update ${e}; the file was left untouched.`);Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,Gt)}}function Yt(e,t,n){if(t.kind==="delete"){if(!n.exists)return;qt(e),he(Bt(e));return}let r=t.mode??n.identity?.mode;n.exists?xe(e,t.text,{durability:"durable",mode:r}):Ce(e,t.text,{durability:"durable",mode:r})}function Wt(e,t){return e.exists===t.exists&&e.hash===t.hash&&(e.identity===void 0?t.identity===void 0:t.identity!==void 0&&Je(e.identity,t.identity))}function We(e){return{dev:e.dev,ino:e.ino,size:e.size,mtimeMs:e.mtimeMs,mode:e.mode&511}}function Je(e,t){return e.dev===t.dev&&e.ino===t.ino&&e.size===t.size&&e.mtimeMs===t.mtimeMs&&e.mode===t.mode}function Ke(e){return e.exists?e.hash.slice(0,12):"<absent>"}var I=".codebaseiq.json",nt=2e3,L=5e3,re=L,ie=3*6e4,Kt=60*6e4,oe={enabled:!0,windowMs:15*6e4,maxRebuilds:2,maxEstimatedWriteBytes:1024*1024*1024},Jt={enabled:!1,debounceMs:nt,cooldownMs:re,gitPollMs:2e3,idleTimeoutMs:ie,autoRefresh:!0,ignore:[],resourceBudget:oe};var zt=new Set(["$schema","schemaVersion","collaborationDomainId","languages","indexerConcurrency","watch","indexer","dbPath","entryRoots","semantic","suppressions","declaredCouplings","locality","architecture","coverageContracts","docs"]),Xt=new Set(["enabled","debounceMs","cooldownMs","gitPollMs","idleTimeoutMs","autoRefresh","ignore","resourceBudget"]),Qt=new Set(["enabled","windowMs","maxRebuilds","maxEstimatedWriteBytes"]),Zt=new Set(["pathPrefixes","files","symbolPatterns","qualifiedVars"]),en=new Set(["typescript","rust"]),tn=new Set(["tsconfigs"]),nn=new Set(["rustAnalyzerPath"]),Ze=new Set(J),rn=new Set(["pnpmWorkspaces","projectMode","projects","configPath"]),on=new Set(["architecturalBoundarySegments"]),sn=new Set(["boundaries","allowedDependencies","requireCompletePolicy","requireCompleteCoverage","requireAcyclic","requireResolvedBoundaries","requireMinimalPolicy","maxBoundaryFanOut","maxBoundaryFiles","testPaths"]),an=new Set(["name","paths","subUnits","maxFiles"]),cn=new Set(["snapshotPaths"]),dn=new Set(["name","files","reason"]),un=new Set(["id","check","file","reason","expiresAt","createdAt","decision"]),pn=new Set(["kind","reasonCode","decidedBy","policyVersion","observation","evidence","invalidateOn"]),ln=new Set(["kind","referent","claim","contentHash","generation"]),fn=new Set(["targetContentChange","detectorMajorChange"]),mn=new Set(["name","file","keys","mustEqual","allowExtra"]),gn=new Set(["type","identifier","marker"]),hn=new Set(["type","path","pattern"]),yn=new Set(["object-literal-keys","string-array","markdown-list"]),bn=new Set(["top-level-dirs","file-glob","registered-commands","builtin-skills"]);function rt(e){let t=x(e,I);if(!E(t))return{};let n;try{n=fe(t,{maxBytes:pe,inputKind:"codebaseiq project config"})}catch(r){let i=r instanceof Error?r.message:String(r);throw new Error(`unable to read ${I} at ${t}: ${i}`,{cause:r})}return ot(z(n),t,"read").config}function Cr(e,t={}){let n=[];Rn(e,n);let r=e;r.schemaVersion!==void 0&&r.schemaVersion!==R&&n.push({level:"error",path:"schemaVersion",message:`Must be ${R}; unversioned and v${C} files are migrated while loading.`}),r.$schema!==void 0&&(typeof r.$schema!="string"||r.$schema.trim()==="")&&n.push({level:"error",path:"$schema",message:"Must be a non-empty string."}),e.collaborationDomainId!==void 0&&!/^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/iu.test(e.collaborationDomainId)&&n.push({level:"error",path:"collaborationDomainId",message:"Must be a lowercase or uppercase UUID v4 generated for this collaboration domain."});let i=new Set(J);for(let[l,d]of(e.languages??[]).entries())i.has(d)||n.push({level:"error",path:`languages[${l}]`,message:`Unsupported language: ${d}`});for(let[l,d]of(e.entryRoots?.symbolPatterns??[]).entries())try{ne(d,`entryRoots.symbolPatterns[${l}]`)}catch(u){n.push({level:"error",path:`entryRoots.symbolPatterns[${l}]`,message:u instanceof Error?u.message:String(u)})}e.indexerConcurrency!==void 0&&(!Number.isInteger(e.indexerConcurrency)||e.indexerConcurrency<=0)&&n.push({level:"error",path:"indexerConcurrency",message:"Must be a positive integer."}),e.watch?.debounceMs!==void 0&&e.watch.debounceMs<=0&&n.push({level:"error",path:"watch.debounceMs",message:"Must be greater than 0."}),e.watch?.cooldownMs!==void 0&&(!Number.isInteger(e.watch.cooldownMs)||e.watch.cooldownMs<0)?n.push({level:"error",path:"watch.cooldownMs",message:"Must be a non-negative integer."}):e.watch?.cooldownMs!==void 0&&e.watch.cooldownMs<L&&n.push({level:"warning",path:"watch.cooldownMs",message:`Values below ${L}ms are raised to the safety floor at runtime.`}),e.watch?.gitPollMs!==void 0&&e.watch.gitPollMs<=0&&n.push({level:"error",path:"watch.gitPollMs",message:"Must be greater than 0."}),e.watch?.idleTimeoutMs!==void 0&&(!Number.isInteger(e.watch.idleTimeoutMs)||e.watch.idleTimeoutMs<0)&&n.push({level:"error",path:"watch.idleTimeoutMs",message:"Must be a non-negative integer; 0 disables idle shutdown."}),e.watch?.autoRefresh!==void 0&&typeof e.watch.autoRefresh!="boolean"&&n.push({level:"error",path:"watch.autoRefresh",message:"Must be a boolean."});let o=e.watch?.resourceBudget;o?.enabled!==void 0&&typeof o.enabled!="boolean"&&n.push({level:"error",path:"watch.resourceBudget.enabled",message:"Must be a boolean."});for(let[l,d]of[["windowMs",o?.windowMs],["maxRebuilds",o?.maxRebuilds],["maxEstimatedWriteBytes",o?.maxEstimatedWriteBytes]])d!==void 0&&(!Number.isSafeInteger(d)||d<=0)&&n.push({level:"error",path:`watch.resourceBudget.${l}`,message:"Must be a positive safe integer."});let s=e.indexer?.typescript;if(s?.projectMode!==void 0&&s.projectMode!=="single"&&s.projectMode!=="workspace"&&n.push({level:"error",path:"indexer.typescript.projectMode",message:'Must be "single" or "workspace".'}),s?.projects!==void 0)if(!Array.isArray(s.projects))n.push({level:"error",path:"indexer.typescript.projects",message:"Must be an array."});else for(let[l,d]of s.projects.entries()){let u=`indexer.typescript.projects[${l}]`;if(typeof d!="string"||d.trim()==="")n.push({level:"error",path:u,message:"Project path must be a non-empty string."});else if(t.projectRoot){let m=Qe(t.projectRoot,d),h=Xe(t.projectRoot,m);h.startsWith("..")||ze(h)?n.push({level:"error",path:u,message:"Project path must stay inside the project root."}):E(m)||n.push({level:"warning",path:u,message:`TypeScript project path does not exist: ${d}`})}}s?.projectMode==="workspace"&&s.pnpmWorkspaces===!0&&n.push({level:"warning",path:"indexer.typescript.pnpmWorkspaces",message:'Ignored when projectMode is "workspace"; explicit TypeScript projects are indexed directly.'});let a=e.semantic?.rust;a?.rustAnalyzerPath!==void 0&&(typeof a.rustAnalyzerPath!="string"||a.rustAnalyzerPath.trim()==="")&&n.push({level:"error",path:"semantic.rust.rustAnalyzerPath",message:"Rust analyzer path must be a non-empty string."});let c=e.indexer?.clojure;if(c?.configPath!==void 0){let l="indexer.clojure.configPath";if(typeof c.configPath!="string"||c.configPath.trim()==="")n.push({level:"error",path:l,message:"Config path must be a non-empty string."});else if(t.projectRoot){let d=Qe(t.projectRoot,c.configPath),u=Xe(t.projectRoot,d);u.startsWith("..")||ze(u)?n.push({level:"error",path:l,message:"Config path must stay inside the project root."}):E(d)||n.push({level:"warning",path:l,message:`Clojure indexer config path does not exist: ${c.configPath}`})}}if(e.locality!==void 0)if(!f(e.locality))n.push({level:"error",path:"locality",message:"Must be an object."});else{let l=e.locality.architecturalBoundarySegments;if(l!==void 0)if(!Array.isArray(l))n.push({level:"error",path:"locality.architecturalBoundarySegments",message:"Must be an array."});else for(let[d,u]of l.entries()){let m=`locality.architecturalBoundarySegments[${d}]`;typeof u!="string"||u.trim()===""?n.push({level:"error",path:m,message:"Boundary segment must be a non-empty string."}):(u.includes("/")||u.includes("\\"))&&n.push({level:"error",path:m,message:"Boundary segment must be a single folder name, not a path."})}}if(vn(e,n),e.declaredCouplings!==void 0&&!Array.isArray(e.declaredCouplings))n.push({level:"error",path:"declaredCouplings",message:"Must be an array."});else for(let[l,d]of(e.declaredCouplings??[]).entries()){let u=`declaredCouplings[${l}]`;if((!d.name||d.name.trim()==="")&&n.push({level:"error",path:`${u}.name`,message:"Declared coupling name is required."}),!Array.isArray(d.files)||d.files.length<2)n.push({level:"error",path:`${u}.files`,message:"Declared coupling needs at least two files."});else for(let[m,h]of d.files.entries())!h||h.trim()===""?n.push({level:"error",path:`${u}.files[${m}]`,message:"Declared coupling file path is required."}):t.projectRoot&&!E(x(t.projectRoot,h))&&n.push({level:"warning",path:`${u}.files[${m}]`,message:`Declared coupling file does not exist: ${h}`});d.reason!==void 0&&d.reason.trim()===""&&n.push({level:"error",path:`${u}.reason`,message:"Declared coupling reason cannot be blank."})}let p=t.now??new Date;e.suppressions!==void 0&&!Array.isArray(e.suppressions)&&n.push({level:"error",path:"suppressions",message:"Must be an array."});for(let[l,d]of(Array.isArray(e.suppressions)?e.suppressions:[]).entries()){let u=`suppressions[${l}]`;if(!f(d)){n.push({level:"error",path:u,message:"Suppression must be an object."});continue}if((!d.reason||d.reason.trim()==="")&&n.push({level:"error",path:`${u}.reason`,message:"Suppression reason is required."}),d.id!==void 0&&d.id.trim()===""&&n.push({level:"error",path:`${u}.id`,message:"Suppression id cannot be blank."}),d.check!==void 0&&d.check.trim()===""&&n.push({level:"error",path:`${u}.check`,message:"Suppression check cannot be blank."}),!d.id&&(!d.check||!d.file)?n.push({level:"error",path:u,message:"Suppression must include id or both check and file."}):!d.id&&d.check&&d.file&&n.push({level:"warning",path:u,message:"Check+file suppressions waive every matching finding in that file; prefer a stable id when available."}),d.file!==void 0&&(d.file.trim()===""?n.push({level:"error",path:`${u}.file`,message:"Suppression file path cannot be blank."}):t.projectRoot&&!E(x(t.projectRoot,d.file))&&n.push({level:"warning",path:`${u}.file`,message:`Suppression file does not exist: ${d.file}`})),d.expiresAt){let m=Date.parse(d.expiresAt);Number.isNaN(m)?n.push({level:"error",path:`${u}.expiresAt`,message:"Must be an ISO date string."}):m<=p.getTime()&&n.push({level:"warning",path:`${u}.expiresAt`,message:"Suppression has expired."})}if(d.decision!==void 0&&!D(d.decision))n.push({level:"error",path:`${u}.decision`,message:"Must be a valid automated-adjudication decision with reason code, evidence, and invalidation rules."});else if(d.decision&&t.projectRoot)for(let[m,h]of d.decision.evidence.entries())h.kind!=="graph"&&!E(x(t.projectRoot,h.referent))&&n.push({level:"error",path:`${u}.decision.evidence[${m}].referent`,message:`Suppression counterevidence does not exist: ${h.referent}`})}return Cn(e,n,t),xn(e,n),n}function vn(e,t){if(e.architecture===void 0)return;if(!f(e.architecture)){t.push({level:"error",path:"architecture",message:"Must be an object."});return}let n=e.architecture.boundaries;if(!Array.isArray(n)||n.length===0){t.push({level:"error",path:"architecture.boundaries",message:"Must be a non-empty array."});return}let r=new Set,i=new Set;for(let[a,c]of n.entries()){let p=`architecture.boundaries[${a}]`;if(!f(c)){t.push({level:"error",path:p,message:"Architecture boundary must be an object."});continue}let l=c.name;typeof l!="string"||l.trim()===""?t.push({level:"error",path:`${p}.name`,message:"Boundary name is required."}):r.has(l)?t.push({level:"error",path:`${p}.name`,message:`Duplicate boundary name: ${l}`}):r.add(l);let d=c.subUnits;d!==void 0&&d!=="directory"&&d!=="file"&&t.push({level:"error",path:`${p}.subUnits`,message:"Must be 'directory' or 'file'."});let u=c.maxFiles;u!==void 0&&(typeof u!="number"||!Number.isInteger(u)||u<0)&&t.push({level:"error",path:`${p}.maxFiles`,message:"Must be a non-negative integer."});let m=c.paths;if(!Array.isArray(m)||m.length===0){t.push({level:"error",path:`${p}.paths`,message:"Boundary paths must be a non-empty array."});continue}for(let[h,k]of m.entries()){let K=`${p}.paths[${h}]`;if(typeof k!="string"||k.trim()===""){t.push({level:"error",path:K,message:"Boundary path must be a non-empty string."});continue}Sn(k)||t.push({level:"error",path:K,message:"Boundary path must be project-relative and may use only one trailing /* or /** glob."}),i.has(k)?t.push({level:"error",path:K,message:`Duplicate boundary path: ${k}`}):i.add(k)}}let o=e.architecture.allowedDependencies;if(o!==void 0&&!f(o))t.push({level:"error",path:"architecture.allowedDependencies",message:"Must be an object keyed by boundary name."});else if(f(o))for(let[a,c]of Object.entries(o)){let p=`architecture.allowedDependencies.${a}`;if(r.has(a)||t.push({level:"error",path:p,message:`Unknown source boundary: ${a}`}),!Array.isArray(c)){t.push({level:"error",path:p,message:"Dependency row must be an array."});continue}let l=new Set;for(let[d,u]of c.entries()){let m=`${p}[${d}]`;typeof u!="string"||u.trim()===""?t.push({level:"error",path:m,message:"Target boundary name is required."}):r.has(u)?l.has(u)?t.push({level:"error",path:m,message:`Duplicate target boundary: ${u}`}):l.add(u):t.push({level:"error",path:m,message:`Unknown target boundary: ${u}`})}}e.architecture.requireAcyclic!==void 0&&typeof e.architecture.requireAcyclic!="boolean"&&t.push({level:"error",path:"architecture.requireAcyclic",message:"Must be a boolean."});for(let a of["requireCompleteCoverage","requireResolvedBoundaries","requireMinimalPolicy"])e.architecture[a]!==void 0&&typeof e.architecture[a]!="boolean"&&t.push({level:"error",path:`architecture.${a}`,message:"Must be a boolean."});for(let a of["maxBoundaryFanOut","maxBoundaryFiles"]){let c=e.architecture[a];c!==void 0&&(typeof c!="number"||!Number.isInteger(c)||c<0)&&t.push({level:"error",path:`architecture.${a}`,message:"Must be a non-negative integer."})}let s=e.architecture.testPaths;if(s!==void 0&&(!Array.isArray(s)||s.some(a=>typeof a!="string"))&&t.push({level:"error",path:"architecture.testPaths",message:"Must be an array of strings."}),e.architecture.requireCompletePolicy!==void 0&&typeof e.architecture.requireCompletePolicy!="boolean")t.push({level:"error",path:"architecture.requireCompletePolicy",message:"Must be a boolean."});else if(e.architecture.requireCompletePolicy===!0){let a=f(o)?o:{};for(let c of[...r].sort())Object.hasOwn(a,c)||t.push({level:"error",path:`architecture.allowedDependencies.${c}`,message:"A dependency row is required by architecture.requireCompletePolicy."})}}function Sn(e){let t=e.replace(/\\/g,"/");if(t.startsWith("/")||t==="."||t===".."||t.split("/").includes(".."))return!1;let n=t.replace(/\/\*\*?$/,"");return n.length>0&&!/[*?[\]]/.test(n)}function xn(e,t){let n=e.docs?.snapshotPaths;if(n!==void 0){if(!Array.isArray(n)){t.push({level:"error",path:"docs.snapshotPaths",message:"Must be an array."});return}for(let[r,i]of n.entries())(typeof i!="string"||i.trim()==="")&&t.push({level:"error",path:`docs.snapshotPaths[${r}]`,message:"Snapshot path glob must be a non-empty string."})}}function Cn(e,t,n){if(e.coverageContracts!==void 0){if(!Array.isArray(e.coverageContracts)){t.push({level:"error",path:"coverageContracts",message:"Must be an array."});return}for(let[r,i]of e.coverageContracts.entries()){let o=`coverageContracts[${r}]`;if(!f(i)){t.push({level:"error",path:o,message:"Coverage contract must be an object."});continue}(typeof i.name!="string"||i.name.trim()==="")&&t.push({level:"error",path:`${o}.name`,message:"Coverage contract name is required."}),typeof i.file!="string"||i.file.trim()===""?t.push({level:"error",path:`${o}.file`,message:"Coverage contract file is required."}):n.projectRoot&&!E(x(n.projectRoot,i.file))&&t.push({level:"warning",path:`${o}.file`,message:`Coverage contract file does not exist: ${i.file}`}),et(t,i.keys,`${o}.keys`,yn,"Unknown coverage-contract key extractor type."),et(t,i.mustEqual,`${o}.mustEqual`,bn,"Unknown coverage-contract ground-truth source type."),i.allowExtra!==void 0&&typeof i.allowExtra!="boolean"&&t.push({level:"error",path:`${o}.allowExtra`,message:"Must be a boolean."})}}}function et(e,t,n,r,i){if(!f(t)){e.push({level:"error",path:n,message:'Must be an object with a "type" field.'});return}if(typeof t.type!="string"||!r.has(t.type)){e.push({level:"error",path:`${n}.type`,message:`${i} Got: ${String(t.type)}`});return}let o={"object-literal-keys":["identifier"],"string-array":["identifier"],"markdown-list":["marker"],"top-level-dirs":["path"],"file-glob":["pattern"],"registered-commands":[],"builtin-skills":[]};for(let s of o[t.type]??[])(typeof t[s]!="string"||t[s].length===0)&&e.push({level:"error",path:`${n}.${s}`,message:`"${t.type}" requires a non-empty string "${s}".`})}function Rr(e){return{...Jt,...e.watch,idleTimeoutMs:e.watch?.idleTimeoutMs??(e.daemon?.enabled===!0?Kt:ie),cooldownMs:Math.max(L,e.watch?.cooldownMs??re),resourceBudget:{...oe,...e.watch?.resourceBudget}}}function Or(e,t){let n=x(e,I),r=tt(),i={collaborationDomainId:r,languages:t,watch:{enabled:!0,debounceMs:nt,cooldownMs:re,gitPollMs:2e3,idleTimeoutMs:ie,autoRefresh:!0,resourceBudget:{...oe}}},o=j(n,s=>{if(!s.revision.exists)return{kind:"write",text:M(i)};let a=U(s,i);return a.config.collaborationDomainId?{kind:"unchanged"}:{kind:"write",text:M({...a.config,collaborationDomainId:r})}});return{configPath:n,changed:o.changed}}function Ir(e,t,n=tt()){let r=x(e,I),i=t,o=j(r,s=>{let a=U(s,t);if(a.config.collaborationDomainId)return i=a.config,{kind:"unchanged"};let c={...a.config,collaborationDomainId:n};return i=c,{kind:"write",text:M(c)}});return{configPath:r,config:i,changed:o.changed}}function wr(e,t,n){let r=x(e,I),i=[...n],o=t,s=j(r,a=>{let c=U(a,t);if(it(t.languages,c.config.languages,i))throw new T(r,"languages");let p={...c.config,languages:i};return o=p,a.revision.exists&&!c.needsMigration&&G(p,c.config)?{kind:"unchanged"}:{kind:"write",text:M(p)}});return{configPath:r,config:o,changed:s.changed}}function Er(e,t,n){let r=x(e,I),i=t,o=j(r,s=>{let a=U(s,t);if(it(t.watch?.enabled,a.config.watch?.enabled,n))throw new T(r,"watch.enabled");let c={...a.config,watch:{...a.config.watch,enabled:n,...n&&a.config.watch?.autoRefresh===void 0?{autoRefresh:!0}:{}}};return i=c,s.revision.exists&&!a.needsMigration&&G(c,a.config)?{kind:"unchanged"}:{kind:"write",text:M(c)}});return{configPath:r,config:i,changed:o.changed}}function U(e,t){if(!e.revision.exists)return{config:$(t),needsMigration:!0};let n=ot(z(e.text),e.path,"update");return{config:n.config,needsMigration:n.needsMigration}}function M(e){return Me(e)}function G(e,t){return JSON.stringify(e)===JSON.stringify(t)}function it(e,t,n){return!G(e,t)&&!G(t,n)}function ot(e,t,n){if(e.kind==="legacy"||e.kind==="supported")return e;if(e.kind==="malformed"){let i=n==="read"?`invalid ${I} at ${t}: ${e.reason}`:`Cannot update ${t}: the latest project config is ${e.reason}.`;throw new Error(`${i} The file was left untouched.`)}let r=n==="read"?`invalid ${I} at ${t}`:`Cannot update ${t}: the latest project config is invalid`;throw new Error(`${r} (unsupported ${e.direction} schemaVersion ${e.schemaVersion}; this codebaseiq reads legacy v${C} and current v${R}). Upgrade codebaseiq before retrying; the file was left untouched.`)}function Rn(e,t){if(!f(e))return;let n=e;if(g(t,n,"",zt),g(t,n.watch,"watch",Xt),g(t,n.watch?.resourceBudget,"watch.resourceBudget",Qt),g(t,n.entryRoots,"entryRoots",Zt),g(t,n.semantic,"semantic",en),g(t,n.semantic?.typescript,"semantic.typescript",tn),g(t,n.semantic?.rust,"semantic.rust",nn),g(t,n.locality,"locality",on),g(t,n.architecture,"architecture",sn),g(t,n.docs,"docs",cn),Array.isArray(n.architecture?.boundaries))for(let[r,i]of n.architecture.boundaries.entries())g(t,i,`architecture.boundaries[${r}]`,an);if(f(n.indexer)){g(t,n.indexer,"indexer",Ze);for(let[r,i]of Object.entries(n.indexer))Ze.has(r)&&g(t,i,`indexer.${r}`,rn)}if(Array.isArray(n.declaredCouplings))for(let[r,i]of n.declaredCouplings.entries())g(t,i,`declaredCouplings[${r}]`,dn);if(Array.isArray(n.suppressions)){for(let[r,i]of n.suppressions.entries())if(g(t,i,`suppressions[${r}]`,un),f(i.decision)){if(g(t,i.decision,`suppressions[${r}].decision`,pn),Array.isArray(i.decision.evidence))for(let[o,s]of i.decision.evidence.entries())g(t,s,`suppressions[${r}].decision.evidence[${o}]`,ln);g(t,i.decision.invalidateOn,`suppressions[${r}].decision.invalidateOn`,fn)}}if(Array.isArray(n.coverageContracts))for(let[r,i]of n.coverageContracts.entries()){let o=`coverageContracts[${r}]`;g(t,i,o,mn),f(i)&&(g(t,i.keys,`${o}.keys`,gn),g(t,i.mustEqual,`${o}.mustEqual`,hn))}}function g(e,t,n,r){if(f(t))for(let i of Object.keys(t))r.has(i)||e.push({level:"warning",path:n?`${n}.${i}`:i,message:"Unknown config key."})}import{existsSync as st}from"fs";function at(e,t,n){let r=new Date().toISOString();if(!st(n.dbPath))return{state:"missing",checkedAt:r,metaPath:n.metaPath,reason:"No SQLite index database exists.",remedy:"Run: codebaseiq reindex"};if(!st(n.metaPath))return{state:"unknown",checkedAt:r,metaPath:n.metaPath,reason:"No reindex metadata file exists next to the SQLite index.",remedy:"Run: codebaseiq reindex"};try{let i=be(F(n.metaPath,"reindex metadata"));if(i.kind==="unsupported")return{state:"unknown",checkedAt:r,metaPath:n.metaPath,reason:`Reindex metadata version ${i.version} is unsupported by this codebaseiq build.`,remedy:"Upgrade codebaseiq or run: codebaseiq reindex"};if(i.kind==="malformed")return{state:"unknown",checkedAt:r,metaPath:n.metaPath,reason:`Could not decode reindex metadata: ${i.reason}`,remedy:"Run: codebaseiq reindex"};let o=i.metadata,s=t.languages??Pe(e),a=On(e,s,t),c=[...o.indexedLanguages??[]].sort(),p=i.capabilities.publishableGeneration&&JSON.stringify(o.fingerprint)===JSON.stringify(a)&&JSON.stringify(c)===JSON.stringify(a.languages),l=ke(n.dbPath,n.metaPath),d=l.state==="invalid"||l.state==="drifted",u=p&&!d;return{state:u?"fresh":"stale",checkedAt:r,metaPath:n.metaPath,updatedAt:o.updatedAt,lastRefresh:o.lastRefresh,reason:d?`SQLite generation requires repair: ${l.reason}`:p?"Index metadata fingerprint matches current source files.":"Index metadata fingerprint differs from current source files.",remedy:u?void 0:"Run: codebaseiq reindex"}}catch(i){return{state:"unknown",checkedAt:r,metaPath:n.metaPath,reason:`Could not read reindex metadata: ${i instanceof Error?i.message:String(i)}`,remedy:"Run: codebaseiq reindex"}}}var H=!1,ct,_=null;function $r(e){H=!0,ct=e?{headCommit:e.headCommit,treeOid:e.treeOid,clean:e.clean}:void 0,_=null}function Dr(){H=!1,ct=void 0,_=null}function Vr(){_=null}function On(e,t,n){let r=H?In(e,t,n):null;if(r&&_?.key===r)return _.value;let i=0,o=we("freshness.fingerprint",()=>{let s=Ee(e,t,dt(n));return i=s.files.length,s},()=>({files:i,memoScope:H}));return r&&(_={key:r,value:o}),o}function dt(e){return{pnpmWorkspaces:e.indexer?.typescript?.pnpmWorkspaces,typescriptProjectMode:e.indexer?.typescript?.projectMode,typescriptProjects:e.indexer?.typescript?.projects,clojureConfigPath:e.indexer?.clojure?.configPath}}function In(e,t,n){return JSON.stringify([ue(e),[...t].sort(),dt(n)])}import{join as wn}from"path";var Wr=4;var En="typescript-semantic";function Kr(e){let t=wn(e,En),n=Ae(t);return{...n,requestDir:n.legacyRequestDir}}function ut(e){return Re(e)}import{existsSync as Pn,readdirSync as kn}from"fs";import{createHash as An}from"crypto";import{join as ce}from"path";function ae(e){let t=0,n=0,r=0,i=0,o=0,s=[];for(let p of e)switch(p.state){case"legacy":t+=1;break;case"current":n+=1;break;case"unsupported-older":r+=1,s.push(se(p));break;case"unsupported-future":i+=1,s.push(se(p));break;case"malformed":o+=1,s.push(se(p));break}let a=t+n,c=r+i+o;return{complete:c===0,total:e.length,accepted:a,legacy:t,current:n,unsupportedOlder:r,unsupportedFuture:i,malformed:o,omitted:c,issues:s}}function se(e){if(e.state==="legacy"||e.state==="current")throw new Error(`accepted record ${e.path} cannot become a compatibility issue`);return{path:e.path,state:e.state,reason:e.reason??e.state}}var ft=ce(".codebaseiq","suppressions"),pt="codebaseiq-suppression",lt=1,Y=2;function _n(e){return ce(e,ft)}function Tn(e){if(e.id&&e.id.trim()!=="")return`${e.id.trim()}.json`;let t=`${e.check??""}\0${e.file??""}`;return`CHECK-${An("sha256").update(t).digest("hex").slice(0,12).toUpperCase()}.json`}function jn(e){return Tn(e).slice(0,-5)}function Mn(e,t){if(typeof e!="object"||e===null||Array.isArray(e))return{state:"malformed",error:"not a suppression object"};let n=e;if(n.schemaVersion===void 0&&(n.kind!==void 0||n.suppressionIdentity!==void 0||n.writer!==void 0))return{state:"malformed",error:"suppression envelope metadata requires schemaVersion"};if(n.schemaVersion!==void 0){if(!Number.isSafeInteger(n.schemaVersion))return{state:"malformed",error:"schemaVersion must be a positive safe integer"};if(n.schemaVersion!==lt&&n.schemaVersion!==Y)return{state:n.schemaVersion>Y?"unsupported-future":"unsupported-older",error:`unsupported schemaVersion ${String(n.schemaVersion)}`};if(n.kind!==void 0&&n.kind!==pt)return{state:"malformed",error:`kind must be ${pt}`}}if(n.schemaVersion===lt&&n.decision!==void 0)return{state:"malformed",error:"schemaVersion 1 cannot carry automated adjudication metadata"};if(n.schemaVersion===Y&&!D(n.decision))return{state:"malformed",error:"schemaVersion 2 requires a valid automated adjudication decision"};if(typeof n.reason!="string"||n.reason.trim()==="")return{state:"malformed",error:"missing reason"};if(!n.id&&!n.check)return{state:"malformed",error:"needs an id or a check"};let r=Nn(n);if(n.schemaVersion===void 0)return{state:"legacy",suppression:r,record:n,schemaVersion:0};let i=jn(r);return n.suppressionIdentity!==i||t!==void 0&&n.suppressionIdentity!==t?{state:"malformed",error:"suppressionIdentity does not match the suppression target or filename"}:!n.writer||n.writer.tool!=="codebaseiq"||typeof n.writer.version!="string"||n.writer.version.trim()===""?{state:"malformed",error:"missing valid writer metadata"}:typeof n.createdAt!="string"||!Number.isFinite(Date.parse(n.createdAt))?{state:"malformed",error:"missing valid createdAt timestamp"}:n.updatedAt!==void 0&&(typeof n.updatedAt!="string"||!Number.isFinite(Date.parse(n.updatedAt)))?{state:"malformed",error:"invalid updatedAt timestamp"}:{state:n.schemaVersion===Y?"current":"legacy",suppression:r,record:n,schemaVersion:n.schemaVersion}}function mt(e){let t=_n(e);if(!Pn(t))return{suppressions:[],compatibility:ae([]),warnings:[]};let n=[],r=[];for(let o of kn(t).sort()){if(!o.endsWith(".json"))continue;let s=ce(t,o),a=`${ft}/${o}`,c;try{c=JSON.parse(F(s,"suppression record"))}catch{r.push({path:a,state:"malformed",reason:"malformed JSON"});continue}let p=Mn(c,o.slice(0,-5));if("error"in p){r.push({path:a,state:p.state,reason:p.error});continue}r.push({path:a,state:p.state}),n.push(p.suppression)}let i=ae(r);return{suppressions:n,compatibility:i,warnings:i.issues.map(o=>`${o.path}: ${o.reason} \u2014 ignored`)}}function Nn(e){return{...typeof e.id=="string"?{id:e.id}:{},...typeof e.check=="string"?{check:e.check}:{},...typeof e.file=="string"?{file:e.file}:{},reason:e.reason,...typeof e.expiresAt=="string"?{expiresAt:e.expiresAt}:{},...typeof e.createdAt=="string"?{createdAt:e.createdAt}:{},...e.decision?{decision:e.decision}:{}}}function gt(){return process.env.CODEBASEIQ_PROJECT_ROOT??process.cwd()}var N,P;function mi(e){N=e}function gi(){return P}function ht(e=gt(),t=void 0){if(t===void 0&&N?.projectRoot===e&&!(N.dbPathSource==="root-fallback"&&W(N.paths.dbPath)))return N;let n=rt(e),r=ye(e,n),i=process.env.CODEBASEIQ_INDEX_DB;if(i)return{projectRoot:e,config:n,paths:r,dbPath:i,dbPathSource:"env",gitContext:t};if(W(r.dbPath))return{projectRoot:e,config:n,paths:r,dbPath:r.dbPath,dbPathSource:"configured",gitContext:t};let o=$n(e,"index.db");return{projectRoot:e,config:n,paths:r,dbPath:o,dbPathSource:"root-fallback",rootFallbackWarning:Bn(o,r.dbPath),gitContext:t}}function hi(e){return ht(e).dbPath}function yi(e,t,n,r={}){return W(n.dbPath)&&r.gitContext?.clean===!1&&r.watcherGeneration!==void 0&&ut(n.dbPath)===r.watcherGeneration?je(e,t,n,r.gitContext):at(e,t,n).state==="fresh"?{kind:"local-fresh"}:Te(e,t,n,r.gitContext)}function bi(e){return!e.startsWith("__")&&!Dn.has(e)}var Dn=new Set(["capabilities","check-deps","config-validate","doctor","init","install-skills","reindex","setup","setup-agent","status","suppress","uninstall","watch"]);function Vn(){return qn(gt(),{warnOnRootFallback:!0})}function qn(e,t={}){let{config:n,paths:r,dbPath:i,dbPathSource:o,rootFallbackWarning:s,gitContext:a}=ht(e);if(!W(i))throw new Error("No index.db found. Run: codebaseiq reindex");t.warnOnRootFallback&&o==="root-fallback"&&s&&console.error(s);let c=mt(e).suppressions,p={dbPath:i,indexPath:process.env.CODEBASEIQ_INDEX_SCIP??r.indexPath,projectRoot:e,collaborationDomainId:n.collaborationDomainId,sharedEvidenceDbPath:_e(e,n,a),entryRoots:n.entryRoots,semantic:n.semantic,suppressions:[...n.suppressions??[],...c],declaredCouplings:n.declaredCouplings,locality:n.locality,architecture:n.architecture,coverageContracts:n.coverageContracts,docs:n.docs},l=Ie(e);return new Oe(p,l)}function Bn(e,t){let n="unknown time";try{n=Fn(e).mtime.toISOString()}catch{}return`warning: using legacy project-root index.db (${e}, modified ${n}) because the configured index was not found at ${t}. This fallback may be stale; run 'codebaseiq reindex' to refresh the configured index.`}var de;function vi(e){de=e}function Si(e){if(de){let r=de(),i=P;P=r;try{return e(r)}finally{P=i}}let t=Vn(),n=P;P=t;try{return e(t)}finally{P=n,t.close()}}function xi(e,t){return t.concat([e])}function Ln(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(0)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}function Ci(e){switch(e.state){case"idle":return"Watching (idle)";case"waiting":{let t=Math.round((e.reindexAt-Date.now())/1e3);return`${e.changedFiles} file(s) changed, reindexing in ${t}s...`}case"indexing":return`Reindexing... (${Math.round((Date.now()-e.startedAt)/1e3)}s)`;case"cooldown":return`Cooldown (${Math.round((e.until-Date.now())/1e3)}s)${e.dirty?" \u2014 changes pending":""}`;case"budget-paused":return`Automatic reindex paused by resource budget (${Math.max(0,Math.round((e.until-Date.now())/1e3))}s; ${e.reason}; ${e.rebuilt} rebuilds, ${Ln(e.estimatedWriteBytes)} estimated writes)${e.dirty?" \u2014 changes pending":""}`;case"draining":return`Stopping safely \u2014 ${e.reason}`;default:return Gn(e)}}function Gn(e){throw new Error(`Unhandled watcher status: ${JSON.stringify(e)}`)}export{A as a,Kn as b,qe as c,Jn as d,D as e,ne as f,j as g,rt as h,Cr as i,Rr as j,Or as k,Ir as l,wr as m,Er as n,at as o,$r as p,Dr as q,Vr as r,Wr as s,Kr as t,pt as u,lt as v,Y as w,_n as x,Tn as y,jn as z,Mn as A,mt as B,gt as C,mi as D,gi as E,ht as F,hi as G,yi as H,bi as I,Vn as J,qn as K,Bn as L,vi as M,Si as N,xi as O,Ln as P,Ci as Q};
|
|
4
|
+
//# sourceMappingURL=chunk-G6XFR4ZL.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as o}from"./chunk-GW6Z3WGY.js";import{b as i}from"./chunk-GTXSJDCO.js";import{y as l}from"./chunk-FETNQCFO.js";function y(e,r){let s=i(e,r);if(s.length===0)return{files:[],symbols:[],dependsOn:[],dependedOnBy:[]};let a=s.map(()=>"?").join(", "),n=e.all(`SELECT relative_path FROM documents
|
|
2
|
+
WHERE relative_path IN (${a})
|
|
3
|
+
ORDER BY relative_path`,...s).map(t=>t.relative_path).filter(t=>!e.isIgnored(t)),p=l(e,n,{onlyDocumented:!0,sort:!0}).map(({relativePath:t,...f})=>f),m=o(e,"forward",s).filter(t=>!e.isIgnored(t)),d=o(e,"reverse",s).filter(t=>!e.isIgnored(t));return{files:n,symbols:p,dependsOn:m,dependedOnBy:d}}function g(e,r){return y(e,r)}export{y as a,g as b};
|
|
4
|
+
//# sourceMappingURL=chunk-GCHRX4YW.js.map
|