scip-query 0.10.11 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +45 -0
- package/{vendor/scip/LICENSE.scip → LICENSE} +1 -0
- package/README.md +168 -55
- package/dist/augment-vue-worker.js +1 -1
- package/dist/chunk-2VSDXOG5.js +2 -0
- package/dist/chunk-343O6EVV.js +2 -0
- package/dist/chunk-3KDUITBE.js +7 -0
- package/dist/chunk-3T2FNHIU.js +2 -0
- package/dist/chunk-3V6JQQM5.js +2 -0
- package/dist/chunk-5AAAEZ2Z.js +2 -0
- package/dist/chunk-6Q6OFLFQ.js +8 -0
- package/dist/chunk-6XA4LDHY.js +2 -0
- package/dist/chunk-75X52JTA.js +2 -0
- package/dist/{chunk-54KGX7EX.js → chunk-7HB3CZFD.js} +2 -2
- package/dist/chunk-7JZRFDCU.js +2 -0
- package/dist/chunk-7XL7J7PT.js +3 -0
- package/dist/chunk-ALHNAPS2.js +2 -0
- package/dist/{chunk-JATUZIEH.js → chunk-BDRBPG7Y.js} +2 -2
- package/dist/chunk-BN5SXXQS.js +40 -0
- package/dist/chunk-C4ICAIJ4.js +3 -0
- package/dist/{chunk-LSET2TXH.js → chunk-CMHYBXJB.js} +2 -2
- package/dist/{chunk-YWYFU2V3.js → chunk-DRPAQAFM.js} +6 -6
- package/dist/chunk-FERAXG6Y.js +72 -0
- package/dist/chunk-FLJJLSGB.js +2 -0
- package/dist/chunk-FXG3PHVW.js +9 -0
- package/dist/chunk-GCN2P4EJ.js +2 -0
- package/dist/chunk-GHXRVCIY.js +21 -0
- package/dist/chunk-GNG622H3.js +3 -0
- package/dist/chunk-H4LUPLEJ.js +2 -0
- package/dist/{chunk-BASVXNY3.js → chunk-H56MGERE.js} +4 -4
- package/dist/chunk-H7NSJ7L2.js +5 -0
- package/dist/chunk-HINMXZ6J.js +2 -0
- package/dist/chunk-HXXMPYEF.js +2 -0
- package/dist/{chunk-Z3YYR4OS.js → chunk-HZKMEXA3.js} +2 -2
- package/dist/chunk-IFSX6YVU.js +4 -0
- package/dist/chunk-ISLWJ4PY.js +10 -0
- package/dist/chunk-J5WVNZ6O.js +2 -0
- package/dist/chunk-K2HYR5A7.js +3 -0
- package/dist/chunk-K6UI6EBZ.js +2 -0
- package/dist/chunk-KJCDEDQW.js +2 -0
- package/dist/{chunk-Z4HICZGY.js → chunk-KKMOB3OJ.js} +2 -2
- package/dist/{chunk-YWOOQ4FF.js → chunk-KMVGRIO2.js} +2 -2
- package/dist/chunk-LWOOTRHC.js +2 -0
- package/dist/{chunk-EY43NV4M.js → chunk-LZNLRE4X.js} +17 -8
- package/dist/chunk-M2YXL62V.js +23 -0
- package/dist/chunk-MNEJYEHW.js +3 -0
- package/dist/chunk-MTDBHTSF.js +2 -0
- package/dist/{chunk-ZQDIXAF5.js → chunk-N2Z3CU7X.js} +2 -2
- package/dist/chunk-N7PNFLGY.js +2 -0
- package/dist/chunk-NAH5EAZS.js +6 -0
- package/dist/chunk-NBXK32I6.js +2 -0
- package/dist/chunk-NJJ7AS4F.js +2 -0
- package/dist/{chunk-FDEQIPPK.js → chunk-NLMRJ7SI.js} +2 -2
- package/dist/chunk-ODVITBYU.js +26 -0
- package/dist/chunk-ORBRX2QJ.js +2 -0
- package/dist/chunk-P36UR5II.js +2 -0
- package/dist/chunk-PYZZBIEU.js +3 -0
- package/dist/chunk-PZS6J5YG.js +16 -0
- package/dist/{chunk-LM5SHAN4.js → chunk-QARYU7R3.js} +2 -2
- package/dist/chunk-QJ3FK4TB.js +38 -0
- package/dist/chunk-QXGTGE2C.js +35 -0
- package/dist/chunk-QZ4JVECJ.js +2 -0
- package/dist/chunk-R3JY4EZ4.js +102 -0
- package/dist/{chunk-VOYOYC5T.js → chunk-R5336VHZ.js} +2 -2
- package/dist/chunk-RJMXSHKM.js +2 -0
- package/dist/chunk-STBXCPKY.js +5 -0
- package/dist/chunk-T2FQ4GHD.js +9 -0
- package/dist/chunk-TFWDJDGO.js +2 -0
- package/dist/chunk-TG7QSYCJ.js +2 -0
- package/dist/{chunk-FKCGBZAC.js → chunk-TTS75UF2.js} +5 -5
- package/dist/{chunk-BVRS7RKQ.js → chunk-U7I373V4.js} +2 -2
- package/dist/chunk-UIKLA3F5.js +2 -0
- package/dist/{chunk-P753MDDE.js → chunk-UMPNL7T6.js} +2 -2
- package/dist/chunk-URSSPS5H.js +2 -0
- package/dist/chunk-VGMUFW3J.js +2 -0
- package/dist/chunk-VXTNADIW.js +18 -0
- package/dist/chunk-VYF5HA76.js +2 -0
- package/dist/chunk-WFGOH2UI.js +43 -0
- package/dist/chunk-WGA5BBTA.js +4 -0
- package/dist/chunk-WIBFXSYB.js +6 -0
- package/dist/chunk-WPSS37EW.js +2 -0
- package/dist/chunk-WQHWIVA7.js +3 -0
- package/dist/chunk-WS3Z6W3M.js +65 -0
- package/dist/chunk-WXVGNFAO.js +2 -0
- package/dist/{chunk-6LJHXREW.js → chunk-WZLPXFZU.js} +2 -2
- package/dist/chunk-X4O6K47U.js +2 -0
- package/dist/chunk-X6OGDTQH.js +2 -0
- package/dist/chunk-XEMQUN3Z.js +20 -0
- package/dist/{chunk-7B6LP46R.js → chunk-XHWLNQVZ.js} +2 -2
- package/dist/chunk-XMR747CP.js +2 -0
- package/dist/chunk-Y6L4LXPG.js +2 -0
- package/dist/chunk-YCPASUCX.js +2 -0
- package/dist/chunk-YZXV3CU3.js +60 -0
- package/dist/chunk-ZEKBR4OK.js +10 -0
- package/dist/chunk-ZMGBWSFZ.js +2 -0
- package/dist/cli.js +462 -274
- package/dist/{config-types-BDIWAYzr.d.ts → config-types-BrHl3Bge.d.ts} +61 -1
- package/dist/{db-Djj3Nqrb.d.ts → db-_Bdx0E1W.d.ts} +1 -1
- package/dist/diff-gate-types-CG2YQ_ei.d.ts +4 -0
- package/dist/{frontend-behavior-evidence-BxKpKWUu.d.ts → frontend-behavior-evidence-EfM4_9bc.d.ts} +1 -1
- package/dist/{health-D5J42g4D.d.ts → health-BEZ1Rt0S.d.ts} +54 -2
- package/dist/index.d.ts +10 -70
- package/dist/index.js +2 -2
- package/dist/postinstall.js +1 -4
- package/dist/queries/affected.d.ts +2 -2
- package/dist/queries/affected.js +1 -1
- package/dist/queries/bottlenecks.d.ts +2 -2
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/by-kind.d.ts +2 -2
- package/dist/queries/by-kind.js +1 -1
- package/dist/queries/call-graph.d.ts +2 -2
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.d.ts +2 -2
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/cleanup-plan.d.ts +2 -2
- package/dist/queries/cleanup-plan.js +1 -1
- package/dist/queries/co-change.d.ts +12 -2
- package/dist/queries/co-change.js +1 -1
- package/dist/queries/code.d.ts +2 -2
- package/dist/queries/code.js +1 -1
- package/dist/queries/complexity-hotspots.d.ts +7 -3
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.d.ts +42 -4
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/convergence.d.ts +2 -2
- package/dist/queries/convergence.js +1 -1
- package/dist/queries/coupling.d.ts +2 -2
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/cycles.d.ts +12 -3
- package/dist/queries/cycles.js +1 -1
- package/dist/queries/dataflow.d.ts +2 -2
- package/dist/queries/dataflow.js +1 -1
- package/dist/queries/dead.d.ts +3 -3
- package/dist/queries/dead.js +1 -1
- package/dist/queries/deep-chains.d.ts +2 -2
- package/dist/queries/deep-chains.js +1 -1
- package/dist/queries/deps.d.ts +2 -2
- package/dist/queries/deps.js +1 -1
- package/dist/queries/diff-gate.d.ts +65 -8
- package/dist/queries/diff-gate.js +1 -1
- package/dist/queries/diff-impact.d.ts +21 -3
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/doc-drift.d.ts +29 -2
- package/dist/queries/doc-drift.js +1 -1
- package/dist/queries/drift.d.ts +15 -3
- package/dist/queries/drift.js +1 -1
- package/dist/queries/duplicate-bodies.d.ts +55 -0
- package/dist/queries/duplicate-bodies.js +2 -0
- package/dist/queries/extract-candidates.d.ts +2 -2
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/fan.d.ts +2 -2
- package/dist/queries/fan.js +1 -1
- package/dist/queries/files.d.ts +4 -3
- package/dist/queries/files.js +1 -1
- package/dist/queries/health.d.ts +3 -3
- package/dist/queries/health.js +1 -1
- package/dist/queries/hierarchy.d.ts +2 -2
- package/dist/queries/hierarchy.js +1 -1
- package/dist/queries/hotspots.d.ts +2 -2
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.d.ts +2 -2
- package/dist/queries/imports.js +1 -1
- package/dist/queries/incomplete-migration.d.ts +3 -2
- package/dist/queries/incomplete-migration.js +1 -1
- package/dist/queries/index.d.ts +12 -7
- package/dist/queries/index.js +1 -1
- package/dist/queries/isolated.d.ts +2 -2
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/locality-candidates.d.ts +2 -2
- package/dist/queries/locality-candidates.js +1 -1
- package/dist/queries/members.d.ts +2 -2
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.d.ts +2 -2
- package/dist/queries/methods.js +1 -1
- package/dist/queries/outline.d.ts +2 -2
- package/dist/queries/outline.js +1 -1
- package/dist/queries/passthrough-candidates.d.ts +11 -3
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/plan-context.d.ts +3 -2
- package/dist/queries/plan-context.js +1 -1
- package/dist/queries/react-component-duplicates.d.ts +7 -2
- package/dist/queries/react-component-duplicates.js +1 -1
- package/dist/queries/react-hook-candidates.d.ts +3 -3
- package/dist/queries/react-hook-candidates.js +1 -1
- package/dist/queries/react-large-component-pressure.d.ts +2 -2
- package/dist/queries/react-large-component-pressure.js +1 -1
- package/dist/queries/recent-duplicates.d.ts +2 -2
- package/dist/queries/recent-duplicates.js +1 -1
- package/dist/queries/redundant-reexports.d.ts +2 -2
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/refs.d.ts +2 -2
- package/dist/queries/refs.js +1 -1
- package/dist/queries/self-audit.d.ts +9 -4
- package/dist/queries/self-audit.js +1 -1
- package/dist/queries/similar-chains.d.ts +2 -2
- package/dist/queries/similar-chains.js +1 -1
- package/dist/queries/similar-files.d.ts +2 -2
- package/dist/queries/similar-files.js +1 -1
- package/dist/queries/similar-signatures.d.ts +17 -10
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.d.ts +85 -17
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.d.ts +2 -2
- package/dist/queries/slice.js +1 -1
- package/dist/queries/stale-abstractions.d.ts +2 -2
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/stats.d.ts +2 -2
- package/dist/queries/surface.d.ts +2 -2
- package/dist/queries/surface.js +1 -1
- package/dist/queries/symbols.d.ts +2 -2
- package/dist/queries/symbols.js +1 -1
- package/dist/queries/system.d.ts +2 -2
- package/dist/queries/system.js +1 -1
- package/dist/queries/trace.d.ts +2 -2
- package/dist/queries/trace.js +1 -1
- package/dist/queries/twin-ab.d.ts +55 -0
- package/dist/queries/twin-ab.js +2 -0
- package/dist/queries/twin-drift.d.ts +97 -0
- package/dist/queries/twin-drift.js +2 -0
- package/dist/queries/unused-imports.d.ts +2 -2
- package/dist/queries/unused-imports.js +1 -1
- package/dist/queries/unused-params.d.ts +2 -2
- package/dist/queries/unused-params.js +1 -1
- package/dist/queries/vue-component-duplicates.d.ts +7 -2
- package/dist/queries/vue-component-duplicates.js +1 -1
- package/dist/queries/vue-composable-candidates.d.ts +3 -3
- package/dist/queries/vue-composable-candidates.js +1 -1
- package/dist/queries/vue-large-view-pressure.d.ts +6 -2
- package/dist/queries/vue-large-view-pressure.js +1 -1
- package/dist/queries/wrapper-candidates.d.ts +2 -2
- package/dist/queries/wrapper-candidates.js +1 -1
- package/dist/reindex-worker.js +9 -9
- package/dist/reindex.d.ts +30 -4
- package/dist/reindex.js +19 -19
- package/dist/runtime.d.ts +12 -6
- package/dist/runtime.js +2 -2
- package/dist/{scip-cli-CnK9Va4O.d.ts → scip-cli-C7cg4ZHR.d.ts} +1 -1
- package/dist/symbol-types-DaoeXKUt.d.ts +66 -0
- package/docs/AGENT_GUIDE.md +20 -18
- package/docs/AI_FAILURE_MODES.md +36 -13
- package/docs/API.md +1 -1
- package/docs/COMMAND_REFERENCE.md +57 -14
- package/docs/DETECTOR_GUIDE.md +20 -3
- package/docs/REGEX_POLICY.md +34 -0
- package/docs/analyzer-inventory.md +48 -3
- package/docs/analyzer-validation-ledger.md +41 -6
- package/package.json +23 -7
- package/scripts/build-scip-windows.mjs +10 -7
- package/scripts/evidence-product-contract.mjs +197 -0
- package/skills/_shared/SKILL.md +243 -0
- package/skills/_shared/agents/openai.yaml +4 -0
- package/skills/scip-api-impact/SKILL.md +55 -71
- package/skills/scip-claim-audit/SKILL.md +105 -0
- package/skills/scip-claim-audit/agents/openai.yaml +4 -0
- package/skills/scip-cleanup-audit/SKILL.md +122 -0
- package/skills/scip-cleanup-audit/agents/openai.yaml +4 -0
- package/skills/scip-cleanup-improve/SKILL.md +84 -0
- package/skills/scip-cleanup-improve/agents/openai.yaml +4 -0
- package/skills/scip-concrete-plan/SKILL.md +181 -0
- package/skills/scip-concrete-plan/agents/openai.yaml +4 -0
- package/skills/scip-conductor/SKILL.md +133 -0
- package/skills/scip-conductor/agents/openai.yaml +4 -0
- package/skills/scip-debug/SKILL.md +60 -58
- package/skills/scip-diagram/SKILL.md +64 -94
- package/skills/scip-directory-architecture/SKILL.md +65 -107
- package/skills/scip-doc-reconcile/SKILL.md +56 -67
- package/skills/scip-explore/SKILL.md +78 -210
- package/skills/scip-hyper-optimization/SKILL.md +124 -198
- package/skills/scip-integrity-audit/SKILL.md +103 -0
- package/skills/scip-integrity-audit/agents/openai.yaml +4 -0
- package/skills/scip-language-playbook/SKILL.md +56 -326
- package/skills/scip-maintainability/SKILL.md +80 -219
- package/skills/scip-probe-reachability/SKILL.md +92 -0
- package/skills/scip-probe-reachability/agents/openai.yaml +4 -0
- package/skills/scip-query/SKILL.md +108 -124
- package/skills/scip-react-maintainability/SKILL.md +64 -82
- package/skills/scip-setup/SKILL.md +121 -0
- package/skills/scip-setup/agents/openai.yaml +4 -0
- package/skills/scip-tla-model-system/SKILL.md +138 -0
- package/skills/scip-tla-model-system/agents/openai.yaml +4 -0
- package/skills/scip-triage-issue/SKILL.md +53 -41
- package/skills/scip-twin-drift/SKILL.md +107 -0
- package/skills/scip-twin-drift/agents/openai.yaml +4 -0
- package/skills/scip-verify/SKILL.md +70 -88
- package/skills/scip-vue-maintainability/SKILL.md +67 -94
- package/dist/chunk-2KHTSEIL.js +0 -102
- package/dist/chunk-3VD3JMK2.js +0 -2
- package/dist/chunk-4UZO3XCV.js +0 -35
- package/dist/chunk-5GOLFJEO.js +0 -8
- package/dist/chunk-5OST6GYB.js +0 -2
- package/dist/chunk-65AU3HFZ.js +0 -2
- package/dist/chunk-6GN7FXCH.js +0 -2
- package/dist/chunk-6IR2AOBM.js +0 -7
- package/dist/chunk-6JRV4MY2.js +0 -23
- package/dist/chunk-6QSOCTZT.js +0 -18
- package/dist/chunk-72KY2ZFO.js +0 -2
- package/dist/chunk-7GO4EQF5.js +0 -2
- package/dist/chunk-7IVSJJZU.js +0 -7
- package/dist/chunk-7TWLSZK5.js +0 -2
- package/dist/chunk-A536TEU4.js +0 -3
- package/dist/chunk-AVWPHM2Q.js +0 -4
- package/dist/chunk-B32FX5KB.js +0 -2
- package/dist/chunk-B6MJ5VQV.js +0 -2
- package/dist/chunk-BFXPG2VN.js +0 -2
- package/dist/chunk-BSN22NRK.js +0 -9
- package/dist/chunk-BZ53S4ZN.js +0 -2
- package/dist/chunk-C5CTSJ6X.js +0 -6
- package/dist/chunk-CO5GJRP7.js +0 -2
- package/dist/chunk-CW5YFOCP.js +0 -5
- package/dist/chunk-DS6QEB3G.js +0 -5
- package/dist/chunk-E35O7UCB.js +0 -2
- package/dist/chunk-EXDQ35NN.js +0 -2
- package/dist/chunk-FAYI6KZ5.js +0 -2
- package/dist/chunk-FFVIFETB.js +0 -2
- package/dist/chunk-FG4NT6VY.js +0 -2
- package/dist/chunk-FXNWFMKW.js +0 -25
- package/dist/chunk-G5UPYQGL.js +0 -4
- package/dist/chunk-GQBMH2TQ.js +0 -2
- package/dist/chunk-GRJY65YT.js +0 -2
- package/dist/chunk-HF25DFSC.js +0 -3
- package/dist/chunk-HHN2B5KA.js +0 -2
- package/dist/chunk-IHUETYFW.js +0 -2
- package/dist/chunk-JCLDUKT6.js +0 -38
- package/dist/chunk-JGN2ZFJR.js +0 -2
- package/dist/chunk-JM72FNGA.js +0 -2
- package/dist/chunk-JME7OWD3.js +0 -2
- package/dist/chunk-KDFONWTW.js +0 -40
- package/dist/chunk-LPL4MA6R.js +0 -2
- package/dist/chunk-LZHUWKGD.js +0 -2
- package/dist/chunk-M4COR2H6.js +0 -2
- package/dist/chunk-NOJAM5ZV.js +0 -21
- package/dist/chunk-O6ZH6C6Y.js +0 -2
- package/dist/chunk-OBGRLXWF.js +0 -3
- package/dist/chunk-OLTESY4K.js +0 -3
- package/dist/chunk-ONPCQ2PM.js +0 -6
- package/dist/chunk-P4KYUPBD.js +0 -4
- package/dist/chunk-P5RYBRIO.js +0 -4
- package/dist/chunk-P7AL7Y37.js +0 -2
- package/dist/chunk-PFOCOG57.js +0 -2
- package/dist/chunk-QLAUCRDJ.js +0 -2
- package/dist/chunk-QPU7EXAW.js +0 -2
- package/dist/chunk-QYB5P7GL.js +0 -2
- package/dist/chunk-RNM6LMCF.js +0 -2
- package/dist/chunk-RVWSAMTT.js +0 -2
- package/dist/chunk-TK7O5ER5.js +0 -3
- package/dist/chunk-TQ5W2H3S.js +0 -4
- package/dist/chunk-USPV3T5K.js +0 -2
- package/dist/chunk-UUBMFL3F.js +0 -59
- package/dist/chunk-VCQYSG2M.js +0 -10
- package/dist/chunk-VUKC6F77.js +0 -20
- package/dist/chunk-W2CBNBEL.js +0 -71
- package/dist/chunk-W6BVEKYC.js +0 -3
- package/dist/chunk-WUCEKFQC.js +0 -3
- package/dist/chunk-XUGQU7PM.js +0 -41
- package/dist/chunk-Y5NBHMQX.js +0 -2
- package/dist/chunk-YCOFCT4B.js +0 -2
- package/dist/chunk-YZA6PPZL.js +0 -3
- package/skills/concrete-plan/SKILL.md +0 -372
- package/skills/concrete-plan/agents/openai.yaml +0 -4
- package/skills/scip-adoption/SKILL.md +0 -122
- package/skills/scip-adoption/agents/openai.yaml +0 -4
- package/skills/scip-ai-cleanup/SKILL.md +0 -153
- package/skills/scip-ai-cleanup/agents/openai.yaml +0 -4
- package/skills/scip-debloat/SKILL.md +0 -439
- package/skills/scip-debloat/agents/openai.yaml +0 -4
- package/skills/scip-health-audit/SKILL.md +0 -162
- package/skills/scip-health-audit/agents/openai.yaml +0 -4
- package/skills/scip-health-improve/SKILL.md +0 -155
- package/skills/scip-health-improve/agents/openai.yaml +0 -4
- package/skills/scip-query-setup/SKILL.md +0 -170
- package/skills/scip-query-setup/agents/openai.yaml +0 -3
- package/vendor/scip/README.md +0 -6
- package/vendor/scip/win32-arm64/scip.exe +0 -0
- package/vendor/scip/win32-x64/scip.exe +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as u,c as g}from"./chunk-KMVGRIO2.js";function v(e){let r=[],i=[],s=[];for(let t of e.primitiveGroups)t.values.length!==0&&f(t.bucket,i,s).push(`${t.reasonPrefix}: ${t.values.join(", ")}`);for(let t of e.nameGroups)p(t.names,t.label,e.genericWords,e.stripPrefixes??[],r,f(t.fallbackBucket,i,s));let l=r.length>0,c=i.length>0,o=s.length>0,a=l?c||o?"mixed":"domain-behavior":o?"shared-abstraction":"generic-workflow-scaffolding";return{actionTier:a==="domain-behavior"||a==="mixed"?"signal":"support",evidenceClass:a,reasons:[...r,...s,...i].slice(0,6),recommendation:e.recommendation(a)}}function x(e,r){if(e.size===0||r.size===0)return 0;let l=u(e,r).size/Math.min(e.size,r.size)*Math.min(1,Math.min(e.size,r.size)/(.35*Math.max(e.size,r.size)));return Math.max(g(e,r),l)}function b(e,r){let i=Object.fromEntries(e.map(s=>[s.name,s.count]));for(let s of r)if(Object.entries(s.min).every(([c,o])=>(i[c]??0)>=o))return{pass:!0,reason:s.reason,counts:i};return{pass:!1,reason:"shared tokens did not meet calibrated overlap thresholds",counts:i}}function P(e,r,i){let s=r.map(n=>{let t=n.value(e),d=n.weightedValue?n.weightedValue(e,t):t;return{axis:n,value:t,weighted:d,qualifies:n.qualifies?n.qualifies(e,t):t>0}}),l=s.filter(n=>n.qualifies&&n.axis.reason).map(n=>n.axis.reason(e,n.value)),c=s.filter(n=>n.axis.dominantEligible!==!1).sort((n,t)=>t.weighted-n.weighted)[0],o=c&&c.weighted>0?c.axis.axis:i,a=[...new Set(s.filter(n=>n.qualifies).map(n=>n.axis.axis).concat(l.length>0?[]:[o]))];return{dominantPressure:o,pressureKinds:a,reasons:l}}function y(e,r){return[...e].filter(i=>i.startsWith(r)).map(i=>i.slice(r.length)).sort()}function A(e){return[...e].sort()}function p(e,r,i,s,l,c){let o=[],a=[];for(let n of e)m(n,s).filter(d=>!i.has(d)).length>0?o.push(n):a.push(n);o.length&&l.push(`${r} has domain term(s): ${o.slice(0,6).join(", ")}`),a.length&&c.push(`${r} is generic workflow: ${a.slice(0,6).join(", ")}`)}function m(e,r){let i=e.replace(/([A-Z])([A-Z][a-z])/g,"$1 $2").replace(/([a-z0-9])([A-Z])/g,"$1 $2");for(let s of r)i=i.replace(s,"");return i.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean)}function f(e,r,i){return e==="generic"?r:i}export{v as a,x as b,b as c,P as d,y as e,A as f};
|
|
2
|
+
//# sourceMappingURL=chunk-6XA4LDHY.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as m,b as d}from"./chunk-QZ4JVECJ.js";import{a as u}from"./chunk-T2FQ4GHD.js";import{A as g,x as f}from"./chunk-ISLWJ4PY.js";import{p as l}from"./chunk-WS3Z6W3M.js";import{readFileSync as E,readdirSync as h}from"fs";import{basename as k,join as c}from"path";function S(t,e,r={}){let a=new Set(t),n=new Set(e),o=[...n].filter(i=>!a.has(i)).sort(),s=r.allowExtra?[]:[...a].filter(i=>!n.has(i)).sort();return{missing:o,extra:s}}function b(t,e){let r=N(t,e.file,e.keys);if(!r.ok)return{name:e.name,file:e.file,status:"unavailable",missing:[],extra:[],unavailableReason:r.reason};let a=L(t.config.projectRoot,e.mustEqual),n=S(r.keys,a,{allowExtra:e.allowExtra??!1}),o=n.missing.length>0||n.extra.length>0?"violated":"ok";return{name:e.name,file:e.file,status:o,missing:n.missing,extra:n.extra}}function O(t,e){return e.map(r=>b(t,r))}function G(t,e){if(e.has(t.file))return!0;let r=t.mustEqual;switch(r.type){case"top-level-dirs":return[...e].some(a=>a===r.path||a.startsWith(`${r.path}/`));case"file-glob":return[...e].some(a=>m(r.pattern,a));case"registered-commands":return e.has("docs/COMMAND_REFERENCE.md");case"builtin-skills":return[...e].some(a=>a.startsWith("skills/"))}}function I(t){if(t.status==="unavailable")return`[coverage-contract] ${t.name}: DISCLOSED \u2014 could not evaluate (${t.unavailableReason})`;let e=[];return t.missing.length>0&&e.push(`missing ${t.missing.join(", ")}`),t.extra.length>0&&e.push(`extra ${t.extra.join(", ")}`),`[coverage-contract] ${t.name}: ${e.join("; ")}`}function N(t,e,r){return r.type==="markdown-list"?T(t,e,r.marker):R(t,e,r)}function R(t,e,r){if(!l(t,e))return{ok:!1,reason:`file not found: ${e}`};let n=f(e);if(!n)return{ok:!1,reason:`unsupported file type for ${r.type} extraction: ${e}`};let o=g(t,e);if(!o)return{ok:!1,reason:`tree-sitter parser unavailable for ${n} (${e}) \u2014 contract skipped, not silently passed`,disclosedUnavailable:{language:n,reason:"parser-unavailable"}};let s=r.type==="object-literal-keys"?D(o,r.identifier):w(o,r.identifier);return s===null?{ok:!1,reason:`no ${r.type==="object-literal-keys"?"object literal":"string array"} named "${r.identifier}" found in ${e}`}:{ok:!0,keys:s}}function y(t){let e=t.childForFieldName("value");return e?e.type==="as_expression"||e.type==="satisfies_expression"?e.namedChild(0):e:null}function D(t,e){for(let r of t.rootNode.descendantsOfType("variable_declarator")){if(r.childForFieldName("name")?.text!==e)continue;let n=y(r);if(n?.type==="object")return $(n)}return null}function $(t){let e=new Set;for(let r of t.namedChildren)if(r.type==="pair"){let a=r.childForFieldName("key");a&&e.add(C(a.text))}else r.type==="shorthand_property_identifier"&&e.add(r.text);return[...e].sort()}function w(t,e){for(let r of t.rootNode.descendantsOfType("variable_declarator")){if(r.childForFieldName("name")?.text!==e)continue;let n=y(r);if(n?.type!=="array")continue;let o=new Set;for(let s of n.namedChildren)s.type==="string"&&o.add(C(s.text));return[...o].sort()}return null}function C(t){return t.length>=2&&(t[0]==="'"&&t.endsWith("'")||t[0]==='"'&&t.endsWith('"'))?t.slice(1,-1):t}function T(t,e,r){let a=l(t,e);if(!a)return{ok:!1,reason:`file not found: ${e}`};let n=v(a,r);return n===null?{ok:!1,reason:`no <!-- BEGIN GENERATED ${r} --> ... <!-- END GENERATED ${r} --> block in ${e}`}:{ok:!0,keys:x(n)}}function v(t,e){let r=u(e),n=new RegExp(`<!--\\s*BEGIN GENERATED ${r}\\s*-->([\\s\\S]*?)<!--\\s*END GENERATED ${r}\\s*-->`).exec(t);return n?n[1]:null}function x(t){let e=new Set;for(let r of t.matchAll(/`([a-z][a-z0-9-]*)`/g))e.add(r[1]);for(let r of t.matchAll(/\[([a-z][a-z0-9-]*)\]\([^)]*\)/g))e.add(r[1]);return[...e].sort()}function L(t,e){switch(e.type){case"top-level-dirs":return p(c(t,e.path));case"file-glob":return[...new Set(d(t,e.pattern).map(r=>k(r)))].sort();case"registered-commands":return A(t);case"builtin-skills":return p(c(t,"skills"))}}function p(t){let e;try{e=h(t,{withFileTypes:!0})}catch{return[]}return e.filter(r=>r.isDirectory()&&!r.name.startsWith(".")).map(r=>r.name).sort()}function A(t){let e;try{e=E(c(t,"docs/COMMAND_REFERENCE.md"),"utf-8")}catch{return[]}let r=v(e,"COMMAND REFERENCE");return r?x(r):[]}var z={dead:{minLoc:3,skipBarrels:!0,deadCodeOnly:!0,semantic:!1},isolated:{minLoc:3,semantic:!1},similar:{minSimilarity:.6,limit:50,minCallees:4,semantic:!1},duplicateBodies:{maxLoc:15,limit:50},extract:{minLoc:15,minCallees:5,limit:50,semantic:!1},wrappers:{maxLoc:15,limit:50,semantic:!1},passthroughs:{maxLoc:15,limit:50,semantic:!1},stale:{minLoc:3,limit:50,semantic:!1},drift:{semantic:!1},twinDrift:{minSimilarity:.3}};export{b as a,O as b,G as c,I as d,z as e};
|
|
2
|
+
//# sourceMappingURL=chunk-75X52JTA.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as m}from"./chunk-
|
|
1
|
+
import{b as m}from"./chunk-XHWLNQVZ.js";import{k as o}from"./chunk-R3JY4EZ4.js";function h(t,l){let s=m(t,l);if(s.length===0)return{files:[],symbols:[],dependsOn:[],dependedOnBy:[]};let d=s.map(()=>"?").join(", "),i=t.all(`SELECT relative_path FROM documents
|
|
2
2
|
WHERE relative_path IN (${d})
|
|
3
3
|
ORDER BY relative_path`,...s).map(e=>e.relative_path).filter(e=>!t.isIgnored(e)),n=o(t,i,{onlyDocumented:!0,sort:!0}).map(({relativePath:e,...c})=>c),a=t.all(`SELECT DISTINCT d2.relative_path
|
|
4
4
|
FROM mentions m
|
|
@@ -32,4 +32,4 @@ import{b as m}from"./chunk-7B6LP46R.js";import{k as o}from"./chunk-2KHTSEIL.js";
|
|
|
32
32
|
WHERE d2.relative_path IN (${d})
|
|
33
33
|
AND d1.relative_path NOT IN (${d})
|
|
34
34
|
ORDER BY d1.relative_path`,...s,...s).map(e=>e.relative_path).filter(e=>!t.isIgnored(e));return{files:i,symbols:n,dependsOn:a,dependedOnBy:r}}export{h as a};
|
|
35
|
-
//# sourceMappingURL=chunk-
|
|
35
|
+
//# sourceMappingURL=chunk-7HB3CZFD.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{d}from"./chunk-6XA4LDHY.js";import{F as p}from"./chunk-ISLWJ4PY.js";function y(t,e={}){let{minTotalLines:i=800,minTemplateLines:n=300,minScriptLines:r=300,minStyleLines:u=500,limit:o=20,scope:a,scanLimit:l,filePattern:m}=e;return p(t).vueProfiles({scope:a,scanLimit:l}).filter(s=>!m||s.file.includes(m)).map(s=>L(s,{minTotalLines:i,minTemplateLines:n,minScriptLines:r,minStyleLines:u})).filter(s=>s!==null).sort((s,c)=>c.totalLines-s.totalLines||s.file.localeCompare(c.file)).slice(0,o)}function L(t,e){let i=d(t,b(e),"total"),{reasons:n}=i;if(n.length===0)return null;let r=i.dominantPressure,u=i.pressureKinds.includes("total")?[...new Set([...i.pressureKinds,r])]:i.pressureKinds,o=g(t.file),a=x(r,o),l=t.totalLines+t.delegatedComposableLines;return{file:t.file,totalLines:l,sfcLines:t.sfcLines,templateLines:t.templateLines,scriptLines:t.scriptLines,styleLines:t.styleLines,externalScriptLines:t.externalScriptLines,externalScriptPaths:t.externalScriptPaths,customBlockLines:t.customBlockLines,delegatedComposableLines:t.delegatedComposableLines,delegatedComposablePaths:t.delegatedComposablePaths,dominantPressure:r,pressureKinds:u,contextKind:o,recommendationKind:a,recommendation:f(a,o),reasons:n,loc:l}}function b(t){return[{axis:"total",value:e=>e.totalLines+e.delegatedComposableLines,qualifies:(e,i)=>i>=t.minTotalLines,reason:(e,i)=>e.delegatedComposableLines>0?`${i} total line(s) (${e.totalLines} component + ${e.delegatedComposableLines} delegated composable line(s) across ${e.delegatedComposablePaths.length} file(s))`:`${i} total component line(s)`,dominantEligible:!1},{axis:"template",value:e=>e.templateLines,qualifies:(e,i)=>i>=t.minTemplateLines,reason:(e,i)=>`${i} template line(s)`},{axis:"script",value:e=>e.scriptLines-e.externalScriptLines,qualifies:e=>e.scriptLines>=t.minScriptLines,reason:e=>`${e.scriptLines} script line(s)`},{axis:"style",value:e=>e.styleLines,qualifies:(e,i)=>i>=t.minStyleLines,reason:(e,i)=>`${i} style line(s)`},{axis:"external-script",value:e=>e.externalScriptLines,qualifies:(e,i)=>i>=t.minScriptLines},{axis:"custom-block",value:e=>e.customBlockLines,qualifies:()=>!1}]}function g(t){return t.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean).some(n=>w.has(n))||/(?:view|page|route)\.vue$/i.test(t)||/(?:^|\/)(views|pages|routes)\//i.test(t)?"route-page":"component"}function x(t,e){return t==="style"?"style-decomposition":t==="template"?"template-decomposition":t==="external-script"?"external-script-boundary":t==="custom-block"?"custom-block-review":e==="route-page"?"route-page-decomposition":t==="script"?"script-behavior-extraction":"total-size-review"}function f(t,e){switch(t){case"template-decomposition":return e==="route-page"?"Split route template sections into named panels before extracting script behavior.":"Split repeated template sections into named presentational components.";case"script-behavior-extraction":return"Extract independent script behavior into composables, controllers, or feature modules.";case"style-decomposition":return"Review UI/style decomposition; move repeated styling to component or style primitives, not composables.";case"external-script-boundary":return"Review the external script boundary and split controller/composable modules by workflow.";case"custom-block-review":return"Review custom block ownership before splitting template or script code.";case"route-page-decomposition":return"Split route/page orchestration from reusable panels and feature controllers.";case"total-size-review":return"Review the largest block first, then split by the dominant reason to change."}}var w=new Set(["landing","page","pages","route","routes","view","views"]);export{y as a};
|
|
2
|
+
//# sourceMappingURL=chunk-7JZRFDCU.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{q as d}from"./chunk-WFGOH2UI.js";import{a as h}from"./chunk-WQHWIVA7.js";import{h as g}from"./chunk-HXXMPYEF.js";import{p as m}from"./chunk-WS3Z6W3M.js";import{a as p}from"./chunk-64MNV6AB.js";function _(t,r,n={}){let e=h(t,r);if(!e)return[];let l=!g(e.symbol)&&!t.isIgnored(e.relativePath)?[{relativePath:e.relativePath,line:e.startLine}]:[],c=d(t,e,{semantic:n.semantic}).map(o=>({relativePath:o.file,line:o.line})),s=R(t,e),f=new Set,a=[];for(let o of[...l,...c,...s]){let u=`${o.relativePath}:${o.line}`;f.has(u)||(f.add(u),a.push(o))}return a}function R(t,r){if(!r.relativePath.endsWith(".rb"))return[];let n=b(r.symbol);if(n.length===0)return[];let e=[];for(let i of p(t,{extensions:[".rb"],includeIgnored:!1})){let l=m(t,i);if(!l)continue;let c=l.split(`
|
|
2
|
+
`);for(let s=0;s<c.length;s++){let f=c[s]??"";n.some(a=>new RegExp(`@${a}\\b|\\b${a}:`).test(f))&&e.push({relativePath:i,line:s})}}return e}function b(t){let n=(t.split(":").pop()??t).replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[^A-Za-z0-9_]+/g,"_").toLowerCase().replace(/^_+|_+$/g,""),e=n.split("_").filter(Boolean),i=new Set;return n&&i.add(n),e.length>=1&&i.add(e[e.length-1]),e.length>=2&&i.add(e.slice(-2).join("_")),[...i]}export{_ as a};
|
|
3
|
+
//# sourceMappingURL=chunk-7XL7J7PT.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as g}from"./chunk-K6UI6EBZ.js";import{a as m}from"./chunk-X4O6K47U.js";import{a as d}from"./chunk-BGBBVSH4.js";import{d as u}from"./chunk-HXXMPYEF.js";function k(n,c={}){let{scope:e,minLoc:t=10,minCallees:a=6,limit:r=20,scanLimit:i}=c,o=new m(n);return g({candidates:()=>o.productionCallableDefinitions({scope:e,minLoc:t,excludeTypesFiles:!0,requireFunctionLikeSymbol:!0,sortByLocDesc:!0}),scanLimit:i,profile:{name:"extract-candidates"},prepare:s=>o.calleeMap(s,{semantic:c.semantic!==!1}),evaluate:(s,l)=>h(s,l.get(s.symbolId)??[],a),orderResults:(s,l)=>l.clusters.length-s.clusters.length||l.loc-s.loc,limit:r})}function h(n,c,e){let t=new Set(c.map(l=>l.symbol));if(t.size<e)return null;let a=S(t,c),r=y(t,a);if(r.length<2)return null;let i=C(r,a);if(i.length===0)return null;let o=u(n.symbol),s=p(o,t.size,r.length,i);return{symbol:n.symbol,shortName:o,relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,loc:d(n),totalCallees:t.size,extractionKind:s.extractionKind,actionTier:"signal",evidenceReasons:s.evidenceReasons,recommendation:s.recommendation,clusters:i}}function p(n,c,e,t){let a=Math.max(...t.map(s=>s.callees.length)),r=Math.max(...t.map(s=>s.isolation)),i=[`${c} distinct callees across ${e} co-occurrence cluster(s)`,`${t.length} extractable cluster(s) passed size and isolation thresholds`,`largest extractable cluster has ${a} callees at ${Math.round(r*100)}% isolation`],o=f(n,c,e);return o!==null?{extractionKind:"workflow-orchestration",evidenceReasons:[...i,o],recommendation:"Review the isolated helper group as a possible private or feature-local helper, but keep the orchestration sequence together when it preserves the workflow."}:a>=6?{extractionKind:"broad-helper-cluster",evidenceReasons:[...i,"one isolated helper group is broad enough to deserve a named review"],recommendation:"Review whether the broad helper cluster has a stable concept name before extracting it; avoid creating a bag-of-helpers abstraction."}:{extractionKind:"cohesive-helper-cluster",evidenceReasons:i,recommendation:"Review the isolated callee group as a possible same-file or feature-local helper; extract only if the new name preserves the current behavior."}}function f(n,c,e){if(c>=10)return`callee breadth suggests orchestration: ${c} callees`;if(e>=4)return`multiple disconnected callee groups suggest orchestration: ${e} groups`;let t=b(n);return x.has(t)?`caller verb suggests orchestration: ${t}`:null}function b(n){return n.split(":").pop()?.replace(/\(\)$/,"").replace(/[^A-Za-z0-9_]/g,"").replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[_\s-]+/).filter(Boolean)[0]?.toLowerCase()??""}var x=new Set(["apply","build","check","collect","create","diff","execute","find","handle","load","prepare","process","render","resolve","run","select","sync","update","validate","verify","write"]);function S(n,c){let e=new Map;for(let a of n)e.set(a,new Set);let t=new Map;for(let a of c){let r=t.get(a.chunkId);r||(r=new Set,t.set(a.chunkId,r)),r.add(a.symbol)}for(let a of t.values()){let r=[...a];for(let i=0;i<r.length;i++)for(let o=i+1;o<r.length;o++)e.get(r[i]).add(r[o]),e.get(r[o]).add(r[i])}return e}function y(n,c){let e=new Set,t=[];for(let a of n){if(e.has(a))continue;let r=new Set,i=[a];for(;i.length>0;){let o=i.pop();if(!e.has(o)){e.add(o),r.add(o);for(let s of c.get(o)??[])e.has(s)||i.push(s)}}t.push(r)}return t}function C(n,c){return n.filter(e=>e.size>=3).map(e=>v(e,n,c)).filter(e=>e.isolation>.5).sort((e,t)=>t.isolation-e.isolation)}function v(n,c,e){let t=new Set;for(let o of c)if(o!==n)for(let s of o)t.add(s);let a=0;for(let o of n)for(let s of e.get(o)??[])t.has(s)&&a++;let r=n.size*t.size,i=r>0?1-a/r:1;return{callees:[...n].map(u),isolation:i}}export{k as a};
|
|
2
|
+
//# sourceMappingURL=chunk-ALHNAPS2.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{b as k}from"./chunk-
|
|
1
|
+
import{b as k}from"./chunk-343O6EVV.js";import{a as D}from"./chunk-X4O6K47U.js";import{f as y,g as v}from"./chunk-NAH5EAZS.js";import{p as S}from"./chunk-WFGOH2UI.js";import{f as L}from"./chunk-R3JY4EZ4.js";import{d as h}from"./chunk-HXXMPYEF.js";function z(e,n={}){let{scope:s,minLoc:c=1,maxDepth:a=5,scanLimit:f}=n,t=new D(e),i=_(e,s,c,f),o=new P;for(let r of i)o.add(r);let m=[],I=[];i.length>0&&m.push(C(e,0,i,o));let b=i.map(r=>r.definition).filter(r=>r!==null),x=new Set(i.map(r=>r.symbol));for(let r=1;r<=a&&b.length>0;r++){let u=t.calleeMap(b,{semantic:!1}),E=new Set;for(let d of b)for(let l of u.get(d.symbolId)??[])x.has(l.symbol)||E.add(l.symbol);let p=[];for(let d of E){x.add(d);let l=F(e,d);if(!l||e.isIgnored(l.relativePath)||y(e,l.relativePath)||v(e,l.symbol,l.relativePath)||t.fileKind(l.relativePath)==="test"||t.hasSuppressionComment(l))continue;let g=B(e,l,o);g.removable?p.push(w(l,"cascade")):g.blockingFiles.length>0&&I.push({shortName:h(l.symbol),file:l.relativePath,blockingFiles:g.blockingFiles.slice(0,3)})}if(p.length===0)break;for(let d of p)o.add(d);m.push(C(e,r,p,o)),b=p.map(d=>d.definition).filter(d=>d!==null)}let N=m.reduce((r,u)=>r+u.loc,0),R=m.reduce((r,u)=>r+u.entries.length,0);return{batches:m,totalSymbols:R,totalLoc:N,blocked:I}}function _(e,n,s,c){let a=k(e,{scope:n,minLoc:s,skipBarrels:!0,deadCodeOnly:!0,scanLimit:c,semantic:!1}),f=[];for(let t of a.symbols)t.kind==="dead-code"&&(y(e,t.relativePath)||v(e,t.symbol,t.relativePath)||f.push({symbol:t.symbol,shortName:t.shortName,file:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:t.loc,evidence:"graph-fact",definition:F(e,t.symbol)}));return f}function w(e,n){return{symbol:e.symbol,shortName:h(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:e.endLine-e.startLine+1,evidence:n,definition:e}}function F(e,n){let s=e.get(`SELECT d.relative_path
|
|
2
2
|
FROM global_symbols gs
|
|
3
3
|
JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
|
|
4
4
|
JOIN documents d ON d.id = der.document_id
|
|
5
5
|
WHERE gs.symbol = ?
|
|
6
6
|
LIMIT 1`,n);return s?L(e,s.relative_path).find(c=>c.symbol===n)??null:null}function B(e,n,s){let c=S(e,n);if(c.length===0)return{removable:!1,blockingFiles:[]};let a=new Set;for(let f of c)f.file===n.relativePath&&f.line>=n.startLine&&f.line<=n.endLine||s.contains(f.file,f.line)||a.add(f.file);return{removable:a.size===0,blockingFiles:[...a]}}function C(e,n,s,c){let a=[...s].sort((i,o)=>i.file.localeCompare(o.file)||i.startLine-o.startLine),f=new Set(a.map(i=>i.file)),t=[];for(let i of f){let o=L(e,i);o.length>0&&o.every(m=>c.contains(i,m.startLine))&&t.push(i)}return{depth:n,entries:a.map(({definition:i,...o})=>o),loc:a.reduce((i,o)=>i+o.loc,0),filesEmptied:t.sort()}}var P=class{ranges=new Map;add(n){let s=this.ranges.get(n.file)??[];s.push({start:n.startLine,end:n.endLine}),this.ranges.set(n.file,s)}contains(n,s){let c=this.ranges.get(n);return c?c.some(a=>s>=a.start&&s<=a.end):!1}};export{z as a,P as b};
|
|
7
|
-
//# sourceMappingURL=chunk-
|
|
7
|
+
//# sourceMappingURL=chunk-BDRBPG7Y.js.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import{b as w}from"./chunk-MNEJYEHW.js";import{b as g}from"./chunk-WQHWIVA7.js";import{c as h,d as f}from"./chunk-MTDBHTSF.js";import{c as b,d as p}from"./chunk-R3JY4EZ4.js";import{d as u,e as c,h as m}from"./chunk-HXXMPYEF.js";import{dirname as $,relative as T,resolve as k}from"path";var A=new Set(f());function O(t,n){return`tests/generated/twin-ab/${y(t)}-vs-${y(n)}.test.ts`}function y(t){return(t.split(/[/#]/).pop()||t).replace(/[^A-Za-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")||"symbol"}function I(t,n,a,e){let o=d(t,n);if(!o.ok)return o;let i=d(t,a);if(!i.ok)return i;let r=o.symbol.paramCount===null||i.symbol.paramCount===null?null:o.symbol.paramCount===i.symbol.paramCount,s=v(o.symbol,i.symbol,t.config.projectRoot,e,r);return{ok:!0,a:o.symbol,b:i.symbol,signatureCompatible:r,testSource:s}}function d(t,n){let e=g(t,n).match;if(!e)return{ok:!1,reason:`${n} does not resolve to an indexed symbol.`};let i=t.get("SELECT kind FROM global_symbols WHERE id = ?",e.symbolId)?.kind??null;if(!(i!==null?A.has(i):m(e.symbol)))return{ok:!1,reason:`${n} resolves to ${u(e.symbol)}${i!==null?` with SCIP kind ${h(i)}`:""} \u2014 twin-ab compares call outputs, so both referents must be functions or methods.`};if(!w(t,e))return{ok:!1,reason:`${n} (${u(e.symbol)} at ${e.relativePath}:${e.startLine+1}) is not exported \u2014 twin-ab needs an importable named binding for both twins.`};let s=t.get("SELECT documentation FROM global_symbols WHERE id = ?",e.symbolId),l=b(p(s?.documentation??null));return{ok:!0,symbol:{ref:n,symbol:e.symbol,shortName:c(e.symbol)||u(e.symbol),file:e.relativePath,startLine:e.startLine,signature:l,paramCount:l?x(l):null}}}function x(t){let n=t.indexOf("(");if(n===-1)return null;let a=0,e=-1;for(let s=n;s<t.length;s+=1){let l=t[s];if(l==="(")a+=1;else if(l===")"&&(a-=1,a===0)){e=s;break}}if(e===-1)return null;let o=t.slice(n+1,e).trim();if(!o)return 0;let i=1,r=0;for(let s of o)s==="("||s==="["||s==="{"?r+=1:s===")"||s==="]"||s==="}"?r=Math.max(0,r-1):s===","&&r===0&&(i+=1);return i}function S(t,n,a){let e=$(n),o=k(t,a),r=T(e,o).replace(/\\/g,"/").replace(/\.tsx?$/,".js");return r.startsWith(".")?r:`./${r}`}function v(t,n,a,e,o){let i=S(a,e,t.file),r=S(a,e,n.file),s=o===null?"Signature comparison: unknown (one or both signatures unavailable in the index) \u2014 check by hand.":o?"Signature comparison: param counts match.":"Signature comparison: param counts DIFFER \u2014 twins may not be directly comparable; check by hand.";return`/**
|
|
2
|
+
* Generated by 'scip-query twin-ab'. scip-integrity-audit drill 5
|
|
3
|
+
* ("cross-examine same-concept twins"): where one concept is computed in
|
|
4
|
+
* more than one place, feed both the same input and require the same
|
|
5
|
+
* answer. Disagreement between twins means at least one is wrong \u2014
|
|
6
|
+
* determine which before consolidating.
|
|
7
|
+
*
|
|
8
|
+
* Twin A: ${t.shortName} (${t.file}:${t.startLine+1})
|
|
9
|
+
* ${t.signature??"(signature unavailable)"}
|
|
10
|
+
* Twin B: ${n.shortName} (${n.file}:${n.startLine+1})
|
|
11
|
+
* ${n.signature??"(signature unavailable)"}
|
|
12
|
+
* ${s}
|
|
13
|
+
*
|
|
14
|
+
* Fill in the TODO input table below with inputs both twins should agree
|
|
15
|
+
* on, then run this file with vitest.
|
|
16
|
+
*/
|
|
17
|
+
import { describe, expect, it } from 'vitest';
|
|
18
|
+
import { ${t.shortName} as twinA } from '${i}';
|
|
19
|
+
import { ${n.shortName} as twinB } from '${r}';
|
|
20
|
+
|
|
21
|
+
// TODO: fill in shared inputs both twins should agree on \u2014 one arg array per call.
|
|
22
|
+
const inputs: any[][] = [
|
|
23
|
+
// [/* arg1, arg2, ... */],
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
// Cast to a variadic signature so the input table can hold any arg shape \u2014
|
|
27
|
+
// the real twins have fixed, non-rest parameter lists, and TS rejects
|
|
28
|
+
// spreading a generic args array into those (TS2556) even when the array
|
|
29
|
+
// itself is 'any'; casting the callee's signature, not the args, satisfies
|
|
30
|
+
// the checker without weakening the twins' real exported types elsewhere.
|
|
31
|
+
const callA = twinA as (...callArgs: any[]) => any;
|
|
32
|
+
const callB = twinB as (...callArgs: any[]) => any;
|
|
33
|
+
|
|
34
|
+
describe.skipIf(inputs.length === 0)('twin-ab: ${t.shortName} vs ${n.shortName}', () => {
|
|
35
|
+
it.each(inputs)('agrees on input %#', (...args) => {
|
|
36
|
+
expect(callA(...args)).toEqual(callB(...args));
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
`}export{O as a,I as b};
|
|
40
|
+
//# sourceMappingURL=chunk-BN5SXXQS.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{f as k}from"./chunk-R3JY4EZ4.js";import{e as C,f as se}from"./chunk-HXXMPYEF.js";import{a as oe}from"./chunk-T2FQ4GHD.js";import{a as ie,b as re,o as W}from"./chunk-ISLWJ4PY.js";import{c as ee,e as te,g as ne,k as v,l as S}from"./chunk-WS3Z6W3M.js";import{a as U}from"./chunk-64MNV6AB.js";import{a as Q,c as Z}from"./chunk-7S5E7KWT.js";import{performance as m}from"perf_hooks";function b(i,e,t){if(i.has(e))return i.get(e);let n=t();return i.set(e,n),n}import ae from"path";function Ae(i,e){return i.getReferences().map(t=>{let n=t.getNode();return O(n,e)})}function Ue(i){let e=i;return typeof e.findReferences=="function"?e.findReferences():[]}function ce(i,e,t,n){let r=[];for(let o of Ue(i))for(let a of Ae(o,n))a.file===e.relativePath&&a.line>=e.startLine&&a.line<=e.endLine||r.push(a);for(let o of t)r.push(o);return R(r)}function le(i,e,t,n){let r=[],o=t?.getStart();for(let a of i.getReferences()){let s=a.getNode();P(n,s.getSourceFile().getFilePath())===e&&(o!==void 0&&s.getStart()===o||r.push({location:O(s,n),node:s}))}return r}function O(i,e){let t=i.getSourceFile(),n=t.getLineAndColumnAtPos(i.getStart());return{file:P(e,t.getFilePath())??t.getBaseName(),line:n.line-1,column:n.column-1}}function fe(i,e,t){let n=i.getSourceFile(),r=_(n,i),o=i.getText(),a=new RegExp(`\\b${oe(o)}\\b`,"g"),s=n.getFullText().split(`
|
|
2
|
+
`),c=[];for(let l=0;l<s.length;l++){if(l===r)continue;let d=s[l]??"";a.lastIndex=0;let p;for(;(p=a.exec(d))!==null;)c.push({file:e,line:l,column:p.index})}return R(c.filter(l=>P(t,ae.join(t,l.file))===e))}function H(i){for(let e=i;e;e=e.getParent()){let t=e.getKindName();if(t.includes("Type")||t==="InterfaceDeclaration"||t==="TypeAliasDeclaration")return!0;if(t==="CallExpression"||t==="NewExpression"||t==="ExpressionStatement")return!1}return!1}function _(i,e){return i.getLineAndColumnAtPos(e.getStart()).line-1}function R(i){let e=new Set,t=[];for(let n of i){let r=`${n.file}:${n.line}:${n.column}`;e.has(r)||(e.add(r),t.push(n))}return t}function P(i,e){let t=ae.relative(i||process.cwd(),e).replace(/\\/g,"/");return!t||t.startsWith("..")?null:t}function pe(i,e,t,n){let r=Oe(e,n);return r.size===0?new Map:Be(i,t,r)}function Oe(i,e){let t=new Map;for(let n of k(i,e)){let r=C(n.symbol)??n.leaf;if(!r)continue;let o=t.get(r);o||(o=[],t.set(r,o)),o.push(n)}return t}function Be(i,e,t){let n=new Map,r=new Map;return e.forEachDescendant(o=>{for(let a of We(i,o)){let s=t.get(a);if(!s)continue;let c=_(e,o);for(let l of s){if(c<l.startLine-1||c>l.endLine+1)continue;let d=Math.abs(c-l.startLine),p=r.get(l.symbolId);p!==void 0&&p<=d||(r.set(l.symbolId,d),n.set(l.symbolId,o))}}}),n}function We(i,e){let t=[],n=r=>{r&&!t.includes(r)&&t.push(r)};if("getNameNode"in e&&typeof e.getNameNode=="function"){let r=e.getNameNode();n(r?.getText())}if("getName"in e&&typeof e.getName=="function"){let r=e.getName();n(r)}return i.Node.isIdentifier(e)&&n(e.getText()),t}var He=Z("ts-definition-leaf-candidates",{clearGroups:["definition-catalog"]});function ue(i,e,t,n){let r=ge(i,e),o=de(r.get(n)??[],t);if(o)return o;let a=[];for(let s of r.values())for(let c of s)((c.leaf||C(c.symbol)||"").includes(n)||c.symbol.includes(n))&&a.push(c);return de(a,t)}function me(i,e){let t=new Map;for(let[n,r]of ge(i,e)){let o=r[0];o&&t.set(n,o)}return t}function ge(i,e){return He.get(i,e,()=>{let t=new Map;for(let n of k(i,e)){let r=n.leaf||C(n.symbol);if(!r)continue;let o=t.get(r);o||(o=[],t.set(r,o)),o.push({...n,leaf:r})}for(let n of t.values())n.sort((r,o)=>r.startLine-o.startLine||r.endLine-o.endLine||r.symbolId-o.symbolId);return t})}function de(i,e){let t=null,n=Number.POSITIVE_INFINITY;for(let r of i){let o=Math.abs(r.startLine-e);(o<n||o===n&&t&&r.startLine<t.startLine)&&(t=r,n=o)}return t}import z from"path";var N=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"];function D(i){let e=i.toLowerCase();return N.some(t=>e.endsWith(t))}function ye(i,e){let t=new Map,n=null,r=null,o=()=>(r??=U(i,{extensions:N}),r),a=()=>(n??=S("typescript.source-file-index",()=>_e(i.config.projectRoot,e,o()),()=>({projects:e.length,indexedDocuments:o().length})),n),s=c=>D(c)?b(t,c,()=>{let l=T(z.resolve(i.config.projectRoot,c));for(let{project:d,sourceFiles:p}of a()){let f=p.get(l)??null;if(f||(f=d.addSourceFileAtPathIfExists(l)??null,f&&p.set(T(f.getFilePath()),f)),f)return{project:d,sourceFile:f}}return null}):null;return{sourceFile:c=>s(c)?.sourceFile??null,sourceFileMatch:s,indexedTypeScriptLikeDocuments:o}}function _e(i,e,t){let n=e.map(({project:r})=>({project:r,sourceFiles:new Map(r.getSourceFiles().map(o=>[T(o.getFilePath()),o]))}));for(let r of t){let o=T(z.resolve(i,r));for(let a of n){if(a.sourceFiles.has(o))break;let s=a.project.addSourceFileAtPathIfExists(o)??null;if(s){a.sourceFiles.set(T(s.getFilePath()),s);break}}}return n}function T(i){return z.resolve(i)}function Se(i,e){for(let t of i)if(e===t.name||e.startsWith(`${t.name}/`))return t.name;return null}function he(i){let e=`${i.relativeDir}/src`;return[`${e}/index.ts`,`${e}/index.tsx`,`${e}/index.mts`,`${e}/index.cts`]}import{existsSync as w,readFileSync as ze}from"fs";import h from"path";var $=["tsconfig.json","tsconfig.app.json","tsconfig.node.json","tsconfig.base.json"];function V(i,e){let n=e?h.dirname(h.join(i,e)):i,r=h.resolve(i);for(;n.startsWith(r);){for(let a of $){let s=h.join(n,a);if(w(s))return s}let o=h.dirname(n);if(o===n)break;n=o}for(let o of $){let a=h.join(i,o);if(w(a))return a}return null}function be(i){let e=i.config.projectRoot,t=new Set($e(e,i.config.semantic?.typescript?.tsconfigs)),n=U(i,{includeIgnored:!1,extensions:N});for(let r of n){let o=V(e,r);o&&t.add(h.resolve(o))}if(t.size===0){let r=V(e);r&&t.add(h.resolve(r))}return[...t].filter(r=>!Me(e,r)).sort((r,o)=>r.localeCompare(o))}function $e(i,e=[]){let t=new Set;for(let n of e){let r=h.isAbsolute(n)?n:h.join(i,n);w(r)&&t.add(h.resolve(r))}for(let n of Ve(i))for(let r of $){let o=h.join(n,r);w(o)&&t.add(h.resolve(o))}if(t.size===0){let n=V(i);n&&t.add(h.resolve(n))}return[...t].filter(n=>!Me(i,n)).sort((n,r)=>n.localeCompare(r))}function Ve(i){let e=h.join(i,"package.json");if(!w(e))return[];let t;try{t=JSON.parse(ze(e,"utf8"))}catch{return[]}return(Array.isArray(t.workspaces)?t.workspaces:t.workspaces?.packages??[]).flatMap(r=>re(i,r))}function Me(i,e){let t=h.relative(i,e).replace(/\\/g,"/");return t.startsWith("..")||t.includes("/node_modules/")||t.startsWith("node_modules/")||t.includes("/dist/")||t.startsWith("dist/")}import{createRequire as qe}from"module";var Ke=qe(import.meta.url),L;function Ie(){if(L!==void 0)return L;try{L=Ke("ts-morph")}catch{L=null}return L}function xe(i,e){return e.map(t=>({tsconfigPath:t,project:new i.Project({tsConfigFilePath:t,skipFileDependencyResolution:!0})}))}function B(i,e,t){return{language:"typescript",availability:()=>({available:!1,reason:i,tsconfigPath:e,tsconfigPaths:t}),importUsage:()=>[],referencesFor:()=>[],calleesFor:()=>[],signatureFor:()=>null}}var Ge=32;function Re(i,e){let t=S("typescript.provider.load",()=>Ie());if(!t)return B("ts-morph is not installed");let n=S("typescript.provider.tsconfig-discovery",()=>be(i));if(n.length===0)return B("no tsconfig found");try{let r=S("typescript.provider.project-bundles",()=>xe(t,n),()=>({tsconfigs:n.length}));return S("typescript.provider.construct",()=>new q(i,t,r),()=>({tsconfigs:n.length}))}catch(r){return B(r instanceof Error?r.message:String(r),n[0],n)}}var q=class{constructor(e,t,n){this.db=e;this.tsMorph=t;this.projects=n;this.workspacePackages=ie(e.config.projectRoot),this.sourceFiles=ye(e,n)}db;tsMorph;projects;language="typescript";importUsageCache=new Map;referencesCache=new Map;calleesCache=new Map;fileCalleesCache=new Map;signatureCache=new Map;definitionNodeCache=new Map;fileDefinitionNodeCache=new Map;indexedDefinitionLeafCache=new Map;compilerCheckerCache=new WeakMap;packageImportReferenceIndex=null;packageExportIndex=null;workspacePackages;sourceFiles;availability(){return{available:!0,tsconfigPath:this.projects[0]?.tsconfigPath,tsconfigPaths:this.projects.map(e=>e.tsconfigPath)}}importUsage(e){return b(this.importUsageCache,e,()=>{let t=this.sourceFiles.sourceFile(e);if(!t)return[];let n=Ye();return S("typescript.import-usage.file",()=>this.importUsageForSourceFile(e,t,n),()=>({file:e,...n}))})}referencesFor(e){return b(this.referencesCache,e.symbolId,()=>{let t=this.nodeForDefinition(e);return this.referencesForDefinitionNode(e,t)})}referencesForDefinitions(e){let t=new Map,n=v(),r=[];for(let c of e){let l=this.referencesCache.get(c.symbolId);l?t.set(c.symbolId,l):r.push(c)}if(r.length===0)return t;let o=r,a=r.filter(c=>!De(c));if(a.length>=Ge){let c=this.referencesForDefinitionsBySymbolScan(a);for(let l of a){let d=c.get(l.symbolId)??[];this.referencesCache.set(l.symbolId,d),t.set(l.symbolId,d)}if(o=r.filter(l=>De(l)),o.length===0)return t}let s=new Map;for(let c of o){let l=s.get(c.relativePath);l?l.push(c):s.set(c.relativePath,[c])}for(let[c,l]of s){let d=Fe();S("typescript.references-map.file",()=>{let p=this.definitionNodesForFile(c);for(let f of l){n&&(d.cacheMisses+=1);let u=p.get(f.symbolId)??null;n&&(u?d.nodeHits+=1:d.nodeMisses+=1);let g=this.referencesForDefinitionNode(f,u,n?d:void 0);this.referencesCache.set(f.symbolId,g),t.set(f.symbolId,g)}},()=>({relativePath:c,definitions:l.length,...ke(d)}))}return t}referencesForDefinitionsBySymbolScan(e){let t=v(),n=Fe(),r=new Map,o=new Set(e.map(s=>s.symbolId)),a=new Map(e.map(s=>[s.symbolId,s]));for(let s of e)r.set(s.symbolId,[]);return S("typescript.references-map.inverted-scan",()=>{let s=t?m.now():0;for(let p of e){let f=this.packageImportReferencesForDefinition(p);if(f.length>0){let u=r.get(p.symbolId)??[];u.push(...f),r.set(p.symbolId,u)}t&&(n.packageReferenceCount+=f.length)}t&&(n.packageRefsMs+=m.now()-s);let c=new Map,l=new Set(e.map(p=>p.leaf).filter(Boolean)),d=t?m.now():0;for(let p of this.sourceFiles.indexedTypeScriptLikeDocuments()){if(this.db.isIgnored(p))continue;let f=this.sourceFiles.sourceFile(p);f&&(t&&(n.scanFiles+=1),this.addReferencesFromSourceFileScan(f,p,o,a,l,c,r,t?n:void 0))}t&&(n.scanMs+=m.now()-d);for(let[p,f]of r){let u=R(f);r.set(p,u),t&&(n.referenceCount+=u.length)}},()=>({definitions:e.length,...ke(n)})),r}addReferencesFromSourceFileScan(e,t,n,r,o,a,s,c){let l=this.compilerCheckerForSourceFile(e),d=e.compilerNode,p=Ze(e),f=u=>{if(this.tsMorph.ts.isIdentifier(u)){if(c&&(c.identifiers+=1),!o.has(u.text)&&!p.has(u.text)){this.tsMorph.ts.forEachChild(u,f);return}let g=this.compilerReferenceSymbol(l,u,c);if(g){let y;if(a.has(g)?y=a.get(g)??null:(y=this.definitionFromCompilerSymbol(g),a.set(g,y)),c&&(y?c.targetHits+=1:c.targetMisses+=1),y&&n.has(y.symbolId)){c&&(c.requestedHits+=1);let F=r.get(y.symbolId);if(F&&!tt(F,t,ve(d,u))){let I=s.get(y.symbolId)??[],A=d.getLineAndCharacterOfPosition(u.getStart(d));I.push({file:t,line:A.line,column:A.character}),s.set(y.symbolId,I)}}}}this.tsMorph.ts.forEachChild(u,f)};f(d)}compilerReferenceSymbol(e,t,n){n&&(n.symbolLookups+=1);let r=e.getSymbolAtLocation(t);if(r){if((r.flags&this.tsMorph.ts.SymbolFlags.Alias)===0)return r;try{return n&&(n.aliasResolutions+=1),e.getAliasedSymbol(r)}catch{return r}}}calleesFor(e){return b(this.calleesCache,e.symbolId,()=>b(this.fileCalleesCache,e.relativePath,()=>this.calleeMapForFile(e.relativePath)).get(e.symbolId)??[])}calleesForDefinitions(e){let t=new Map,n=new Map;for(let r of e){let o=n.get(r.relativePath);o?o.push(r):n.set(r.relativePath,[r])}for(let[r,o]of n){let a=this.fileCalleesCache.get(r),s=new Set(o.map(l=>l.symbolId)),c=a??this.calleeMapForFile(r,s);for(let l of o){let d=c.get(l.symbolId)??[];this.calleesCache.set(l.symbolId,d),t.set(l.symbolId,d)}}return t}referencesForDefinitionNode(e,t,n){let r=n?m.now():0,o=this.packageImportReferencesForDefinition(e);if(n&&(n.packageRefsMs+=m.now()-r,n.packageReferenceCount+=o.length),!t)return o;let a=n?m.now():0,s=ce(t,e,o,this.db.config.projectRoot);return n&&(n.semanticRefsMs+=m.now()-a,n.referenceCount+=s.length),s}signatureFor(e){return b(this.signatureCache,e.symbolId,()=>{let t=this.nodeForDefinition(e);if(!t||!this.tsMorph.Node.isFunctionDeclaration(t)&&!this.tsMorph.Node.isMethodDeclaration(t)&&!this.tsMorph.Node.isArrowFunction(t)&&!this.tsMorph.Node.isFunctionExpression(t)&&!this.tsMorph.Node.isConstructorDeclaration(t))return null;let n=t.getType().getCallSignatures()[0];if(!n)return null;let r=n.getParameters().map(a=>{let s=a.getDeclarations()[0],c=s?a.getTypeAtLocation(s).getText(s):a.getValueDeclaration()?.getType().getText()??"unknown";return Ce(c)}),o=n.getReturnType().getText(t);return`(${r.join(",")})=>${Ce(o)}`})}importUsageForSourceFile(e,t,n){let r=[],o=new Map;for(let a of t.getImportDeclarations()){n.declarations+=1;let s=W(this.db,e,a.getModuleSpecifierValue()),c=a.getImportClause()?.isTypeOnly()??!1;for(let l of K(a)){n.entries+=1;let d=c?null:l.identifier?.getSymbol()?.compilerSymbol??null;!c&&l.identifier&&(d?n.bindingSymbols+=1:n.missingBindingSymbols+=1);let p={sourcePath:s,entry:l,typeOnlyDeclaration:c,bindingSymbol:d,references:[]};if(r.push(p),c||!l.localName||!d)continue;let f=o.get(l.localName);f?f.push(p):o.set(l.localName,[p])}}return o.size>0&&t.forEachDescendant(a=>{if(a.getKindName()!=="Identifier")return;let s=o.get(a.getText());if(!s||Xe(a))return;n.scannedIdentifiers+=1;let c=a.getSymbol()?.compilerSymbol;if(n.symbolLookups+=1,!!c){for(let l of s)if(l.bindingSymbol===c){l.references.push({location:O(a,this.db.config.projectRoot),node:a}),n.matchedReferences+=1;break}}}),r.map(a=>a.typeOnlyDeclaration?Je(e,a.sourcePath,a.entry):a.entry.identifier&&!a.bindingSymbol?(n.fallbackEntries+=1,this.valueImportUsageForEntry(e,a.sourcePath,a.entry)):this.valueImportUsageFromLocations(e,a.sourcePath,a.entry,a.references))}valueImportUsageForEntry(e,t,n){let r=n.identifier?n.identifier.findReferences():[],o=[];for(let a of r)for(let s of le(a,e,n.identifier,this.db.config.projectRoot))o.push(s);return this.valueImportUsageFromLocations(e,t,n,o)}valueImportUsageFromLocations(e,t,n,r){let o=r.some(c=>!H(c.node)),a=r.some(c=>H(c.node)),s=n.isTypeOnly;return{importer:e,sourcePath:t,importedName:n.importedName,localName:n.localName,kind:n.kind,isTypeOnly:s,isUsed:s||r.length>0,isTypeUsed:s||a,isValueUsed:o,references:r.map(c=>c.location)}}packageImportReferencesForDefinition(e){return this.packageImportReferences().get(e.symbolId)??[]}packageImportReferences(){if(this.packageImportReferenceIndex)return this.packageImportReferenceIndex;let e=new Map,t=this.packageExports();for(let n of this.sourceFiles.indexedTypeScriptLikeDocuments())this.addPackageImportReferencesForDocument(e,t,n);for(let[n,r]of e)e.set(n,R(r));return this.packageImportReferenceIndex=e,e}addPackageImportReferencesForDocument(e,t,n){if(this.db.isIgnored(n))return;let r=this.sourceFiles.sourceFileMatch(n);if(r)for(let o of r.sourceFile.getImportDeclarations())this.addPackageImportReferencesForDeclaration(e,t,n,o)}addPackageImportReferencesForDeclaration(e,t,n,r){let o=Se(this.workspacePackages,r.getModuleSpecifierValue());if(!o)return;let a=t.get(o);if(a)for(let s of K(r)){if(s.kind!=="named"||!s.identifier)continue;let c=a.get(s.importedName);if(!c||c.size===0)continue;let l=fe(s.identifier,n,this.db.config.projectRoot);l.length>0&&rt(e,c,l)}}packageExports(){if(this.packageExportIndex)return this.packageExportIndex;let e=new Map;for(let t of this.workspacePackages){let n=new Map;for(let r of he(t))this.collectPackageExports(t,r,n,new Set);n.size>0&&e.set(t.name,n)}return this.packageExportIndex=e,e}collectPackageExports(e,t,n,r){if(r.has(t))return;r.add(t);let o=this.sourceFiles.sourceFile(t);if(o)for(let a of o.getExportDeclarations()){let s=a.getModuleSpecifierValue(),c=s?W(this.db,t,s):t;if(!c||!c.startsWith(`${e.relativeDir}/src/`))continue;let l=a.getNamedExports();if(l.length===0){if(a.isNamespaceExport())continue;this.collectPackageExports(e,c,n,r);continue}for(let d of l){let p=d.getNameNode().getText(),f=d.getAliasNode()?.getText()??p,u=this.indexedDefinitionByLeaf(c,p);if(!u)continue;let g=n.get(f);g||(g=new Set,n.set(f,g)),g.add(u.symbolId)}}}indexedDefinitionByLeaf(e,t){return b(this.indexedDefinitionLeafCache,e,()=>me(this.db,e)).get(t)??null}nodeForDefinition(e){return b(this.definitionNodeCache,e.symbolId,()=>this.definitionNodesForFile(e.relativePath).get(e.symbolId)??null)}definitionNodesForFile(e){return b(this.fileDefinitionNodeCache,e,()=>{let t=this.sourceFiles.sourceFile(e);return t?pe(this.tsMorph,this.db,t,e):new Map})}definitionFromCompilerSymbol(e,t){let n=e.name,r=t?m.now():0,o=e.declarations??[];t&&(t.declarationsMs+=m.now()-r,t.declarationChecks+=o.length);for(let a of o){let s=t?m.now():0,c=a.getSourceFile(),l=P(this.db.config.projectRoot,c.fileName),d=c.getLineAndCharacterOfPosition(a.getStart(c)).line;if(t&&(t.declarationLocationMs+=m.now()-s),!l||this.db.isIgnored(l))continue;let p=t?m.now():0,f=ue(this.db,l,d,n);if(t&&(t.indexedLookupMs+=m.now()-p),f)return{symbolId:f.symbolId,symbol:f.symbol,file:f.relativePath,line:f.startLine}}return null}calleeMapForFile(e,t){let n=v(),r=0,o=0,a=0,s=0,c=0,l=0,d=0,p=0,f=n?nt():void 0;return S("typescript.callee-map.file",()=>{let u=n?m.now():0,g=this.sourceFiles.sourceFile(e);if(n&&(c=Math.round(m.now()-u)),!g)return new Map;let y=n?m.now():0,F=k(this.db,e).sort((M,x)=>M.startLine-x.startLine||x.endLine-M.endLine);if(n&&(l=Math.round(m.now()-y)),r=F.length,F.length===0)return new Map;let I=new Map,A=n?m.now():0,Le=this.compilerCheckerForSourceFile(g),Y=g.compilerNode;n&&(d=Math.round(m.now()-A));let Ee=new Map,X=M=>{if(this.tsMorph.ts.isCallExpression(M)||this.tsMorph.ts.isNewExpression(M)){n&&(o+=1);let x=this.semanticCalleeForCallNode(Le,Y,F,M,Ee,t,f);x&&(n&&(a+=1),Qe(I,x.callerId,x.target))}this.tsMorph.ts.forEachChild(M,X)},je=n?m.now():0;X(Y),n&&(p=Math.round(m.now()-je));for(let[M,x]of I)I.set(M,ot(x));return s=I.size,I},()=>({relativePath:e,definitions:r,callNodes:o,resolvedCallees:a,outputRows:s,requestedDefinitions:t?.size??r,sourceFileLookupMs:c,definitionsLoadMs:l,checkerLookupMs:d,traversalMs:p,...f?it(f):{}}))}semanticCalleeForCallNode(e,t,n,r,o,a,s){let c=s?m.now():0,l=et(n,ve(t,r));if(s&&(s.callerLookupMs+=m.now()-c),!l)return null;if(a&&!a.has(l.symbolId))return s&&(s.skippedUnrequestedCallers+=1),null;let d=r.expression,p=this.compilerSymbolForExpression(e,d,s),f=null;if(p)if(s&&(s.targetSymbolHits+=1),o.has(p))s&&(s.compilerSymbolCacheHits+=1),f=o.get(p)??null;else{s&&(s.compilerSymbolCacheMisses+=1);let u=s?m.now():0;f=this.definitionFromCompilerSymbol(p,s),s&&(s.targetLookupMs+=m.now()-u),o.set(p,f)}else s&&(s.targetMisses+=1);return f?{callerId:l.symbolId,target:{symbol:f.symbol,file:f.file,line:f.line}}:null}compilerSymbolForExpression(e,t,n){let r=n?m.now():0,o=e.getSymbolAtLocation(t);if(n&&(n.expressionSymbolMs+=m.now()-r),o)return o;n&&(n.typeFallbacks+=1);let a=n?m.now():0,s=e.getTypeAtLocation(t).getSymbol();return n&&(n.typeSymbolMs+=m.now()-a),s}compilerCheckerForSourceFile(e){let t=e.getProject(),n=this.compilerCheckerCache.get(t);return n||(n=t.getTypeChecker().compilerObject,this.compilerCheckerCache.set(t,n)),n}};function K(i){let e=[],t=i.getDefaultImport();t&&e.push({identifier:t,importedName:"default",localName:t.getText(),kind:"default",isTypeOnly:i.getImportClause()?.isTypeOnly()??!1});let n=i.getNamespaceImport();n&&e.push({identifier:n,importedName:"*",localName:n.getText(),kind:"namespace",isTypeOnly:i.getImportClause()?.isTypeOnly()??!1});for(let r of i.getNamedImports()){let o=r.getNameNode(),s=r.getAliasNode()??(o.getKindName()==="Identifier"?o:null);e.push({identifier:s,importedName:o.getText(),localName:s?.getText()??o.getText(),kind:"named",isTypeOnly:r.isTypeOnly()||(i.getImportClause()?.isTypeOnly()??!1)})}return e.length===0&&e.push({identifier:null,importedName:"*",localName:null,kind:"side-effect",isTypeOnly:!1}),e}function Je(i,e,t){return{importer:i,sourcePath:e,importedName:t.importedName,localName:t.localName,kind:t.kind,isTypeOnly:!0,isUsed:!0,isTypeUsed:!0,isValueUsed:!1,references:[]}}function Ye(){return{declarations:0,entries:0,bindingSymbols:0,missingBindingSymbols:0,scannedIdentifiers:0,symbolLookups:0,matchedReferences:0,fallbackEntries:0}}function Xe(i){for(let e=i;e;e=e.getParent())if(e.getKindName()==="ImportDeclaration")return!0;return!1}function Qe(i,e,t){let n=i.get(e);n||(n=[],i.set(e,n)),n.push(t)}function Ze(i){let e=new Set;for(let t of i.getImportDeclarations())for(let n of K(t))n.localName&&e.add(n.localName);return e}function et(i,e){let t=null;for(let n of i)e<n.startLine||e>n.endLine||(!t||n.startLine>=t.startLine)&&(t=n);return t}function ve(i,e){return i.getLineAndCharacterOfPosition(e.getStart(i)).line}function tt(i,e,t){return e===i.relativePath&&t>=i.startLine&&t<=i.endLine}function De(i){return i.symbol.includes("#")?se(i.symbol)==="type"&&i.relativePath.endsWith(".d.ts"):!1}function nt(){return{callerLookupMs:0,expressionSymbolMs:0,typeSymbolMs:0,targetLookupMs:0,declarationsMs:0,declarationLocationMs:0,indexedLookupMs:0,compilerSymbolCacheHits:0,compilerSymbolCacheMisses:0,targetSymbolHits:0,targetMisses:0,typeFallbacks:0,declarationChecks:0,skippedUnrequestedCallers:0}}function it(i){return{...i,callerLookupMs:Math.round(i.callerLookupMs),expressionSymbolMs:Math.round(i.expressionSymbolMs),typeSymbolMs:Math.round(i.typeSymbolMs),targetLookupMs:Math.round(i.targetLookupMs),declarationsMs:Math.round(i.declarationsMs),declarationLocationMs:Math.round(i.declarationLocationMs),indexedLookupMs:Math.round(i.indexedLookupMs)}}function Fe(){return{cacheHits:0,cacheMisses:0,nodeHits:0,nodeMisses:0,scanFiles:0,identifiers:0,symbolLookups:0,aliasResolutions:0,targetHits:0,targetMisses:0,requestedHits:0,scanMs:0,packageRefsMs:0,semanticRefsMs:0,packageReferenceCount:0,referenceCount:0}}function ke(i){return{...i,scanMs:Math.round(i.scanMs),packageRefsMs:Math.round(i.packageRefsMs),semanticRefsMs:Math.round(i.semanticRefsMs)}}function rt(i,e,t){for(let n of e){let r=i.get(n)??[];r.push(...t),i.set(n,r)}}function ot(i){let e=new Set,t=[];for(let n of i){let r=`${n.symbol}|${n.file}|${n.line}`;e.has(r)||(e.add(r),t.push(n))}return t}function Ce(i){return i.replace(/\s+/g," ").replace(/\bimport\("[^"]+"\)\./g,"").trim()}var G=new WeakMap;Q({name:"semantic-provider",groups:["semantic-provider"],clearAll:i=>G.delete(i)});function J(i,e){let t=`${i.config.projectRoot}:typescript-workspace`,n=G.get(i);n||(n=new Map,G.set(i,n));let r=n.get(t);if(r)return r;let o=Re(i,e);return n.set(t,o),o}function E(i){return{capability:(e,t)=>we(i,e,t),importUsage:e=>st(i,e),references:e=>at(i,e),callerMap:e=>ct(i,e),calleeMap:e=>pt(i,e),signature:e=>dt(i,e)}}function fn(i,e){return E(i).importUsage(e)}function st(i,e){let t=j(i,e);return t?t.importUsage(e):[]}function pn(i,e){return E(i).references(e)}function at(i,e){let t=j(i,e.relativePath);return t?t.referencesFor(e):[]}function dn(i,e){return E(i).callerMap(e)}function ct(i,e){let t=v(),n=new Map,r=ee(i),o=[],a=[],s=[],c=0,l=0,d=0,p=0;if(S("semantic.references.cache-scan",()=>{for(let f of e){if(!r||!D(f.relativePath)){t&&!D(f.relativePath)&&(c+=1),s.push(f);continue}let u=te(i,f.relativePath,f.symbol,r);if(u!==null){let g=ft(u);if(g){t&&(l+=1),p+=Ne(i,n,f,g);continue}t&&(d+=1)}a.push(f)}},()=>({definitions:e.length,skippedNonTs:c,cacheHits:l,parseFailures:d,misses:a.length,unkeyed:s.length,resultRows:n.size,callerFiles:p})),a.length>0||s.length>0){let f=[...s,...a],u=0,g=S("semantic.references.compute-misses",()=>{let y=lt(i,f);return u=y.size,y},()=>({definitions:f.length,misses:a.length,unkeyed:s.length,rows:u}));for(let y of f)p+=Ne(i,n,y,g.get(y.symbolId)??[]);if(r)for(let y of a)o.push({relativePath:y.relativePath,symbol:y.symbol,projectFingerprint:r,payload:JSON.stringify(g.get(y.symbolId)??[])})}return o.length>0&&(we(i,"semantic-references").available?S("semantic.references.cache-write",()=>ne(i,o),()=>({entries:o.length})):S("semantic.references.cache-write-skip",()=>{},()=>({reason:"provider-unavailable",entries:o.length}))),n}function lt(i,e){let t=v(),n=new Map,r=0,o=0,a=0,s=0;return S("semantic.references.provider-loop",()=>{let c=new Map,l=[];for(let d of e){let p=j(i,d.relativePath);if(!p){t&&(o+=1);continue}if(t&&(r+=1),p.referencesForDefinitions){let f=c.get(p);f?f.push(d):c.set(p,[d])}else l.push({provider:p,definition:d})}for(let[d,p]of c){let f=d.referencesForDefinitions(p);for(let u of p){let g=f.get(u.symbolId)??[];Pe(n,u.symbolId,g,t,y=>{a+=1,s+=y})}}for(let{provider:d,definition:p}of l){let f=d.referencesFor(p);Pe(n,p.symbolId,f,t,u=>{a+=1,s+=u})}return n},()=>({definitions:e.length,providerHits:r,providerMisses:o,definitionsWithReferences:a,referenceCount:s,rows:n.size}))}function Pe(i,e,t,n,r){i.set(e,t),n&&t.length>0&&r(t.length)}function Ne(i,e,t,n){let r=0;for(let o of n){if(o.file===t.relativePath||i.isIgnored(o.file))continue;let a=e.get(t.symbolId);a||(a=new Set,e.set(t.symbolId,a));let s=a.size;a.add(o.file),a.size!==s&&(r+=1)}return r}function ft(i){try{return JSON.parse(i)}catch{return null}}function un(i,e){return E(i).calleeMap(e)}function pt(i,e){let t=v(),n=new Map,r=0,o=0,a=0,s=0;return S("semantic.callees.provider-loop",()=>{let c=new Map,l=[];for(let d of e){let p=j(i,d.relativePath);if(!p){t&&(o+=1);continue}t&&(r+=1);let f=d;if(p.calleesForDefinitions){let u=c.get(p);u?u.push(f):c.set(p,[f])}else l.push({provider:p,definition:f})}for(let[d,p]of c){let f=d.calleesForDefinitions(p);for(let u of p){let g=f.get(u.symbolId)??[];Te(n,u.symbolId,g,t,y=>{a+=1,s+=y})}}for(let{provider:d,definition:p}of l){let f=d.calleesFor(p);Te(n,p.symbolId,f,t,u=>{a+=1,s+=u})}return n},()=>({definitions:e.length,providerHits:r,providerMisses:o,definitionsWithCallees:a,calleeCount:s,rows:n.size}))}function Te(i,e,t,n,r){t.length>0&&(i.set(e,t),n&&r(t.length))}function mn(i,e){return E(i).signature(e)}function dt(i,e){let t=j(i,e.relativePath);return t?t.signatureFor(e):null}function we(i,e,t){if(t!==void 0&&!D(t))return{slot:e,language:"typescript",available:!1,reason:"semantic evidence is only available for TypeScript files"};try{return{slot:e,language:"typescript",...J(i,t).availability()}}catch(n){return{slot:e,language:"typescript",available:!1,reason:n instanceof Error?n.message:String(n)}}}function j(i,e){if(!D(e))return null;let t=J(i,e);return t.availability().available?t:null}export{D as a,E as b,fn as c,pn as d,dn as e,un as f,mn as g};
|
|
3
|
+
//# sourceMappingURL=chunk-C4ICAIJ4.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{q as f}from"./chunk-
|
|
1
|
+
import{q as f}from"./chunk-WFGOH2UI.js";import{a as d}from"./chunk-WQHWIVA7.js";import{c as m,d as g}from"./chunk-R3JY4EZ4.js";import{d as s,h as u}from"./chunk-HXXMPYEF.js";import{p as c}from"./chunk-WS3Z6W3M.js";function E(e,r,i={}){let n=d(e,r);if(!n)return{definitions:[],referencedBy:[]};let t=e.get("SELECT display_name, documentation FROM global_symbols WHERE id = ?",n.symbolId),a=g(t?.documentation??null),o=e.isIgnored(n.relativePath)?[]:[{relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,signature:y(a,t?.display_name??null,n.symbol),source:S(e,n.relativePath,n.startLine,n.endLine)}],b=f(e,n,{semantic:i.semantic}).map(l=>({relativePath:l.file,line:l.line,enclosingSymbol:l.enclosingSymbol,enclosingShort:l.enclosingSymbol?s(l.enclosingSymbol):"(top-level)"}));return{definitions:o,referencedBy:b}}function S(e,r,i,n){let t=c(e,r);if(!t)return null;let o=t.split(`
|
|
2
2
|
`).slice(i,n+1).join(`
|
|
3
3
|
`).trimEnd();return o.length>0?o:null}function y(e,r,i){let n=m(e);if(n&&!p(n))return n;let t=(r??"").trim();return t?u(i)&&!t.endsWith("()")?`${t}()`:t:s(i)}function p(e){return e.startsWith("undefined")||e.includes("|")||e.includes("```")}export{E as a};
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
4
|
+
//# sourceMappingURL=chunk-CMHYBXJB.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{a as m}from"./chunk-
|
|
2
|
-
`),c=Math.max(0,e.startLine-a),
|
|
3
|
-
`);return{symbol:e.symbol,shortName:
|
|
4
|
-
`),o=Math.max(0,a-1-r),
|
|
5
|
-
`);return{symbol:`${n.relative_path}:${a}-${s}`,shortName:`${n.relative_path}:${a}-${s}`,relativePath:n.relative_path,startLine:o,endLine:
|
|
6
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as m}from"./chunk-XHWLNQVZ.js";import{a as h}from"./chunk-WQHWIVA7.js";import{d as g}from"./chunk-HXXMPYEF.js";import{readFileSync as f}from"fs";import{extname as y,join as d}from"path";function M(t,e,a={}){let{context:s=0}=a,r=L(e);if(r)return j(t,r.filePath,r.startLine,r.endLine,s);let i=h(t,e);return i?R(t,i,s):null}function L(t){let e=t.match(/^(.+\.\w+):(\d+)-(\d+)$/);return e?{filePath:e[1],startLine:parseInt(e[2],10),endLine:parseInt(e[3],10)}:null}function R(t,e,a){let s=t.get("SELECT language FROM documents WHERE relative_path = ?",e.relativePath),r=d(t.config.projectRoot,e.relativePath),i;try{i=f(r,"utf-8")}catch{return null}let n=i.split(`
|
|
2
|
+
`),c=Math.max(0,e.startLine-a),l=Math.min(n.length-1,e.endLine+a),u=n.slice(c,l+1).join(`
|
|
3
|
+
`);return{symbol:e.symbol,shortName:g(e.symbol),relativePath:e.relativePath,startLine:c,endLine:l,language:s?.language??v(e.relativePath),source:u}}function j(t,e,a,s,r){let i=m(t,e);if(!i)return null;let n=t.get("SELECT relative_path, language FROM documents WHERE relative_path = ?",i);if(!n)return null;let c=d(t.config.projectRoot,n.relative_path),l;try{l=f(c,"utf-8")}catch{return null}let u=l.split(`
|
|
4
|
+
`),o=Math.max(0,a-1-r),p=Math.min(u.length-1,s-1+r),b=u.slice(o,p+1).join(`
|
|
5
|
+
`);return{symbol:`${n.relative_path}:${a}-${s}`,shortName:`${n.relative_path}:${a}-${s}`,relativePath:n.relative_path,startLine:o,endLine:p,language:n.language??v(n.relative_path),source:b}}function v(t){switch(y(t).toLowerCase()){case".ts":case".tsx":case".mts":case".cts":return"typescript";case".js":case".jsx":case".mjs":case".cjs":return"javascript";case".py":case".pyi":return"python";case".rs":return"rust";case".go":return"go";case".java":return"java";case".kt":case".kts":return"kotlin";case".scala":return"scala";case".rb":return"ruby";case".php":return"php";case".cs":return"csharp";case".vb":return"vb";case".dart":return"dart";case".c":case".h":return"c";case".cc":case".cpp":case".cxx":case".hpp":case".hh":case".hxx":return"cpp";case".vue":return"vue";default:return null}}export{M as a};
|
|
6
|
+
//# sourceMappingURL=chunk-DRPAQAFM.js.map
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import Ke from"better-sqlite3";import{existsSync as en}from"fs";import{dirname as nn,join as rn,resolve as Xe}from"path";import ce from"better-sqlite3";import{execFileSync as ue}from"child_process";import{existsSync as le,readdirSync as ge,readFileSync as de}from"fs";import{extname as h,join as w}from"path";import z from"ignore";import{readFileSync as J,existsSync as v,readdirSync as q}from"fs";import{dirname as b,isAbsolute as C,join as m,relative as Y,resolve as Q}from"path";function V(e){let t=z();return Z(e,t)||t.add(ne),{isIgnored:n=>S(t,e,n),filter:n=>n.filter(i=>!S(t,e,i))}}function Z(e,t){let r=new Set,n=(s,a)=>{if(!(r.has(s)||!v(s)))try{let c=J(s,"utf-8");t.add(a?ee(c,a):c),r.add(s)}catch{}},i=b(e),o=0;for(;i!==b(i)&&o<5&&(n(m(i,".gitignore"),""),!v(m(i,".git")));)i=b(i),o++;return k(e,"",t,n),r.size>0}function k(e,t,r,n){let i=t?m(e,t):e;n(m(i,".gitignore"),t);let o;try{o=q(i,{withFileTypes:!0})}catch{return}for(let s of o){if(!s.isDirectory()||s.name===".git")continue;let a=t?`${t}/${s.name}`:s.name;S(r,e,`${a}/`)||k(e,a,r,n)}}function ee(e,t){let r=t.replaceAll("\\","/").replace(/\/+$/,"");return e.split(/\r?\n/).map(n=>te(n,r)).join(`
|
|
2
|
+
`)}function te(e,t){let r=e.trimStart();if(!r||r.startsWith("#"))return e;let n=e.slice(0,e.length-r.length),i=r.startsWith("!"),o=i?r.slice(1):r;if(!o||o.startsWith("#"))return e;let s=o.startsWith("/"),a=s?o.slice(1):o,l=(a.endsWith("/")?a.slice(0,-1):a).includes("/")||s?`${t}/${a}`:`${t}/**/${a}`;return`${n}${i?"!":""}${l}`}var ne=`
|
|
3
|
+
# Dependencies
|
|
4
|
+
node_modules/
|
|
5
|
+
vendor/
|
|
6
|
+
.bundle/
|
|
7
|
+
|
|
8
|
+
# Build output
|
|
9
|
+
dist/
|
|
10
|
+
build/
|
|
11
|
+
out/
|
|
12
|
+
target/
|
|
13
|
+
bin/
|
|
14
|
+
obj/
|
|
15
|
+
|
|
16
|
+
# Python
|
|
17
|
+
__pycache__/
|
|
18
|
+
*.pyc
|
|
19
|
+
*.pyo
|
|
20
|
+
.venv/
|
|
21
|
+
venv/
|
|
22
|
+
.env/
|
|
23
|
+
env/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
|
|
26
|
+
# Rust
|
|
27
|
+
target/
|
|
28
|
+
|
|
29
|
+
# Java / Kotlin / Scala
|
|
30
|
+
*.class
|
|
31
|
+
.gradle/
|
|
32
|
+
.mvn/
|
|
33
|
+
|
|
34
|
+
# C# / .NET
|
|
35
|
+
bin/
|
|
36
|
+
obj/
|
|
37
|
+
packages/
|
|
38
|
+
|
|
39
|
+
# Go
|
|
40
|
+
vendor/
|
|
41
|
+
|
|
42
|
+
# Dart
|
|
43
|
+
.dart_tool/
|
|
44
|
+
build/
|
|
45
|
+
|
|
46
|
+
# PHP
|
|
47
|
+
vendor/
|
|
48
|
+
|
|
49
|
+
# IDE / OS
|
|
50
|
+
.idea/
|
|
51
|
+
.vscode/
|
|
52
|
+
*.swp
|
|
53
|
+
*.swo
|
|
54
|
+
.DS_Store
|
|
55
|
+
Thumbs.db
|
|
56
|
+
|
|
57
|
+
# Type definitions (often noise in queries)
|
|
58
|
+
*.d.ts
|
|
59
|
+
`;function S(e,t,r){let n=re(t,r);if(!n)return!1;try{return e.ignores(n)}catch{return!1}}function re(e,t){if(!t||t===".")return null;if(!C(t)&&!t.startsWith(".."))return t.replaceAll("\\","/");let r=C(t)?t:Q(e,t),n=Y(e,r).replaceAll("\\","/");return!n||n==="."||n.startsWith("..")?null:n}import{readdirSync as ut}from"fs";import{execFileSync as gt}from"child_process";import{extname as pt,join as ft}from"path";var oe=[];function T(e){e.groups.length>0&&oe.push(e)}function ie(){let e=new WeakMap;return{cache:e,ensure(t){let r=e.get(t);return r||(r=new Map,e.set(t,r)),r}}}function I(e,t){let{cache:r,ensure:n}=ie(),i={get(o,s,a){let c=n(o);if(c.has(s))return c.get(s);let u=a();return c.set(s,u),u},invalidate(o,s){r.get(o)?.delete(s)},invalidateAll(o){r.delete(o)},size(o){return r.get(o)?.size??0}};return T({name:e,groups:t.clearGroups,clearAll:o=>i.invalidateAll(o),clearFile:(o,s)=>i.invalidate(o,s)}),i}var se=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue",".rs",".py",".pyi",".java",".kt",".kts",".scala",".sc",".clj",".cljs",".cljc",".rb",".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx",".cs",".vb",".php",".dart"],F=[".vue"],E=[".tsx",".jsx"],L=[".vue"],ht=[...E,...L],bt=new Set(E),St=new Set(L),ae=new Set(se.map(e=>e.toLowerCase())),yt=[...ae].sort().join(","),D=new Set(["node_modules",".git","target","dist","build",".next",".nuxt",".cache",".turbo",".nbb",".cpcache",".shadow-cljs","out","coverage",".scipquery-cache","__pycache__",".venv","venv",".idea",".vscode"]);var Rt=I("source-files",{clearGroups:[]});function Ft(e={}){return{id:"auxiliary-documents",facts:["auxiliary-document"],run:t=>pe({projectRoot:t.projectRoot,dbPath:t.dbPath,extensions:e.extensions,onStatus:t.onStatus})}}function pe(e){let t=new Set((e.extensions??F).map(o=>o.toLowerCase()));if(t.size===0)return{scanned:0,inserted:0,existing:0};if(!le(e.dbPath))throw new Error(`SCIP SQLite database not found at ${e.dbPath}`);let r=V(e.projectRoot),n=fe(e.projectRoot,t).filter(o=>!r.isIgnored(o)),i=new ce(e.dbPath);try{let o=he(i,n),s=i.prepare(`INSERT OR IGNORE INTO documents (language, relative_path, position_encoding, text)
|
|
60
|
+
VALUES (?, ?, NULL, ?)`),c=i.transaction(l=>{let f=0;for(let g of l){if(o.has(g))continue;let d=de(w(e.projectRoot,g),"utf-8"),B=s.run(be(g),g,d);f+=Number(B.changes)}return f})(n),u={scanned:n.length,inserted:c,existing:n.length-c};return e.onStatus?.(`Augmented SQLite documents with ${c} auxiliary source file${c===1?"":"s"} (${u.existing} already present).`),u}finally{i.close()}}function fe(e,t){let r=me(e,t);if(r)return r;let n=[],i=o=>{let s=o?w(e,o):e,a;try{a=ge(s,{withFileTypes:!0})}catch{return}for(let c of a){if(D.has(c.name))continue;let u=o?`${o}/${c.name}`:c.name;if(c.isDirectory()){i(u);continue}t.has(h(c.name).toLowerCase())&&n.push(u)}};return i(""),n.sort()}function me(e,t){try{return ue("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:26214400,stdio:["ignore","pipe","ignore"]}).split(`
|
|
61
|
+
`).filter(n=>n&&t.has(h(n).toLowerCase())).sort()}catch{return null}}function he(e,t){let r=new Set,n=500;for(let i=0;i<t.length;i+=n){let o=t.slice(i,i+n),s=e.prepare(`SELECT relative_path FROM documents WHERE relative_path IN (${o.map(()=>"?").join(",")})`).all(...o);for(let a of s)r.add(a.relative_path)}return r}function be(e){return h(e).toLowerCase()===".vue"?"vue":h(e).replace(/^\./,"").toLowerCase()||"source"}import{readFileSync as Dt,writeFileSync as wt}from"fs";function Ot(e,t){let r=Date.now(),n=e.run(t);return{stageId:e.id,facts:e.facts,durationMs:Date.now()-r,result:n}}import{execFileSync as Se}from"child_process";import{createHash as ye}from"crypto";import{readdirSync as Re,readFileSync as xe}from"fs";import{join as A}from"path";function Mt(e){return[...new Set((e??[]).map(t=>t.trim()).filter(Boolean))].sort((t,r)=>t.localeCompare(r))}function O(e){return(Ce(e)??Ve(e)).filter(t=>t&&!P(t)).sort()}function $t(e,t={}){return(t.language?O(e).filter(n=>ve(n,t.language,t.markerFiles)):O(e)).map(n=>{let i=A(e,n);try{let o=xe(i);return{path:n,size:o.byteLength,hash:ye("sha256").update(o).digest("hex")}}catch{return{path:n,size:-1,hash:"unreadable"}}})}function ve(e,t,r){let n=e.split("/").at(-1)??e;if(r?.includes(e)||r?.includes(n)||Te.has(n))return!0;let i=e.includes(".")?`.${e.split(".").at(-1).toLowerCase()}`:"";return(Ie[t]??[]).includes(i)}function Ce(e){try{return Se("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:50*1024*1024,stdio:["ignore","pipe","ignore"]}).split(`
|
|
62
|
+
`).filter(Boolean)}catch{return null}}function Ve(e){let t=[],r=[""];for(;r.length>0;){let n=r.pop(),i=n?A(e,n):e,o;try{o=Re(i,{withFileTypes:!0})}catch{continue}for(let s of o){let a=n?`${n}/${s.name}`:s.name;if(s.isDirectory()){P(a)||r.push(a);continue}t.push(a)}}return t}function P(e){let t=e.split("/");return e==="meta.json"||t.some(r=>ke.has(r))||e.endsWith(".db")||e.endsWith(".db-wal")||e.endsWith(".db-shm")||e.endsWith(".scip")}var ke=new Set([".git","node_modules",".scipquery-cache",".stryker-tmp","dist","build","coverage",".next",".nuxt","target"]),Te=new Set(["package.json","package-lock.json","pnpm-lock.yaml","yarn.lock","bun.lockb","tsconfig.json","tsconfig.base.json","pyproject.toml","setup.py","setup.cfg","Cargo.toml","Cargo.lock","go.mod","go.sum","pom.xml","build.gradle","build.gradle.kts","build.sbt","compile_commands.json","CMakeLists.txt","Makefile","Gemfile","Gemfile.lock","composer.json","composer.lock","pubspec.yaml","pubspec.lock","deps.edn","project.clj","bb.edn","shadow-cljs.edn"]),Ie={typescript:[".ts",".tsx",".mts",".cts"],javascript:[".js",".jsx",".mjs",".cjs"],java:[".java"],scala:[".scala"],kotlin:[".kt",".kts"],rust:[".rs"],python:[".py",".pyi"],ruby:[".rb"],go:[".go"],cpp:[".cc",".cpp",".cxx",".hpp",".hh",".hxx"],c:[".c",".h"],csharp:[".cs"],vb:[".vb"],dart:[".dart"],php:[".php"],clojure:[".clj",".cljs",".cljc"]};import{createRequire as Fe}from"module";import{existsSync as Ee,readFileSync as R}from"fs";import{dirname as j,extname as Le,join as N,relative as De,resolve as Kt}from"path";import{pathToFileURL as we}from"url";function _(e,t){let{vueCore:r,ts:n,volarTs:i}=Oe(e),{parsed:o,vueOptions:s}=Ae(r,n,t),a=j(t),c=r.createVueLanguagePlugin(n,o.options,s,d=>d),u=Pe(r,n,c),l=je(a,o),{languageServiceHost:f}=i.createLanguageServiceHost(n,n.sys,u,d=>d,l),g=n.createLanguageService(f);return{ts:n,language:u,languageService:g,fileNames:o.fileNames,configDir:a}}function Oe(e){let t=Fe(we(N(e,"package.json")).href);return{vueCore:y(t,"@vue/language-core",e),ts:y(t,"typescript",e),volarTs:y(t,"@volar/typescript",e)}}function Ae(e,t,r){let n=t.readConfigFile(r,t.sys.readFile);if(n.error||!n.config)throw new Error(`Failed to read ${r}`);let o=e.createParsedCommandLine(t,t.sys,r).vueOptions;return typeof e.createGlobalTypesWriter=="function"&&(o.globalTypesPath=e.createGlobalTypesWriter(o,t.sys.writeFile)),{parsed:t.parseJsonConfigFileContent(n.config,t.sys,j(r),void 0,r,void 0,e.getAllExtensions(o).map(s=>({extension:s.slice(1),isMixedContent:!0,scriptKind:t.ScriptKind.Deferred}))),vueOptions:o}}function Pe(e,t,r){let n={},i=e.createLanguage([r],new Map,o=>{if(!Ee(o))return;let s=R(o,"utf-8");n.current?.scripts.set(o,t.ScriptSnapshot.fromString(s),r.getLanguageId(o)??$e(o))});return n.current=i,i}function je(e,t){return{getCurrentDirectory:()=>e,getCompilationSettings:()=>t.options,getScriptFileNames:()=>t.fileNames,getProjectReferences:()=>t.projectReferences,getProjectVersion:()=>"0"}}function y(e,t,r){try{return e(t)}catch(n){throw(typeof n=="object"&&n!==null&&"code"in n?n.code:null)==="MODULE_NOT_FOUND"?new Error(`Vue augmentation requires ${t} to be installed in ${r}. Install Vue/Volar dependencies for that project, then rerun augment-vue.`,{cause:n}):n}}function M(e,t,r){let n=Ne(e);return i=>{let o=p(t,i.fileName),s=r.get(i.fileName);if(!s)return null;let a=r.positionAt(s,i.textSpan.start),c=n.get(o);if(!c)return null;let u=c.containingByLine.get(a.line);return u!==void 0?u:_e(c.starts,a.line,2)}}function Ne(e){let t=e.prepare(`
|
|
63
|
+
SELECT
|
|
64
|
+
d.relative_path AS relativePath,
|
|
65
|
+
der.start_line AS startLine,
|
|
66
|
+
der.end_line AS endLine,
|
|
67
|
+
der.symbol_id AS symbolId
|
|
68
|
+
FROM defn_enclosing_ranges der
|
|
69
|
+
JOIN documents d ON d.id = der.document_id
|
|
70
|
+
ORDER BY d.relative_path, (der.end_line - der.start_line) DESC
|
|
71
|
+
`).all(),r=new Map;for(let n of t){let i=r.get(n.relativePath);i||(i={containingByLine:new Map,starts:[]},r.set(n.relativePath,i)),i.starts.push({line:n.startLine,symbolId:n.symbolId});for(let o=n.startLine;o<=n.endLine;o++)i.containingByLine.set(o,n.symbolId)}for(let n of r.values())n.starts.sort((i,o)=>i.line-o.line);return r}function _e(e,t,r){let n=0,i=e.length-1;for(;n<=i;){let s=Math.floor((n+i)/2);e[s].line<t?n=s+1:i=s-1}let o=null;for(let s of[i,n]){let a=e[s];if(!a)continue;let c=Math.abs(a.line-t);c>r||(!o||c<o.distance)&&(o={distance:c,symbolId:a.symbolId})}return o?.symbolId??null}function $(e,t){let r=We(t),n=e.prepare("SELECT id FROM global_symbols WHERE symbol = ?"),i=new Map;return{get(o){if(i.has(o))return i.get(o)??null;let s=Ue(n,r,t,o);return i.set(o,s),s}}}function G(e,t,r,n,i){if(e.fileName.endsWith(".vue")){let o=n.language.scripts.get(e.fileName),s=o?.generated?.languagePlugin.typescript?.getServiceScript(o.generated.root)?.code;if(o&&s){let a=n.language.maps.get(s,o);if(x(a,e.textSpan.start)!==null)return r.get(e.fileName)}return e.fileName.startsWith(i)?r.get(e.fileName):null}return t(e)}function*W(e){let t=/\b[A-Za-z_$][A-Za-z0-9_$]*\b/g,r=new Set(["script","setup","template","style","lang","scoped","true","false","null","undefined","const","let","var","import","from","export","return","if","else","for","while","function","class","type","interface","as","await","async"]),n;for(;n=t.exec(e);){let i=n[0];r.has(i)||(yield{text:i,start:n.index,end:n.index+i.length})}}function U(e,t){for(let[r]of e.toGeneratedLocation(t,n=>!!n.navigation))return r;return null}function x(e,t){let r=e;for(let[n]of r.toSourceLocation(t,i=>!!i.navigation))return n;return null}function Me(e,t){let r=0,n=e.lineStarts.length-1;for(;r<=n;){let o=Math.floor((r+n)/2);e.lineStarts[o]<=t?r=o+1:n=o-1}let i=Math.max(0,n);return{line:i,character:t-e.lineStarts[i]}}function H(e,t){return p(e,t).startsWith("node_modules/")}function p(e,t){return De(e,t).replaceAll("\\","/")}function $e(e){switch(Le(e)){case".vue":return"vue";case".tsx":return"typescriptreact";case".ts":case".mts":case".cts":return"typescript";case".jsx":return"javascriptreact";case".js":case".mjs":case".cjs":return"javascript";case".json":return"json";default:return"typescript"}}function K(){let e=new Map;return{get(t){if(e.has(t))return e.get(t)??null;try{let r=R(t,"utf-8"),n={text:r,lineStarts:Ge(r)};return e.set(t,n),n}catch{return e.set(t,null),null}},positionAt:Me}}function Ge(e){let t=[0];for(let r=0;r<e.length;r++)e.charCodeAt(r)===10&&t.push(r+1);return t}function We(e){try{let t=JSON.parse(R(N(e,"package.json"),"utf-8"));return{name:t.name??"workspace",version:t.version??"0.0.0"}}catch{return{name:"workspace",version:"0.0.0"}}}function Ue(e,t,r,n){let i=p(r,n),o=He(t.name,t.version,i);return e.get(o)?.id??null}function He(e,t,r){let n=r.split("/").map(i=>`\`${i.replaceAll("`","")}\``).join("/");return`scip-vue npm ${e} ${t} ${n}/default.`}function sn(e){let t=Xe(e.projectRoot,e.tsconfig),r=new Ke(e.dbPath,{readonly:!0});try{let n=Be({db:r,projectRoot:e.projectRoot,configPath:t,vueSymbolLookup:$(r,e.projectRoot)});return ze({vueFiles:e.vueFiles??[],tasks:e.tasks,...n})}finally{r.close()}}function Be(e){let t=K();return{projectRoot:e.projectRoot,context:_(e.projectRoot,e.configPath),symbolLookup:M(e.db,e.projectRoot,t),vueSymbolLookup:e.vueSymbolLookup,sourceReader:t}}function ze(e){let t=[],r=0,n=e.tasks??e.vueFiles.map(i=>({fileName:i,startOffset:0,endOffset:Number.POSITIVE_INFINITY,countFileSkip:!0}));for(let i of n){let o=Je(e,i);t.push(...o.occurrences),r+=o.skippedReferences}return{occurrences:t,skippedReferences:r}}function Je(e,t){let r=e.context.language.scripts.get(t.fileName),n=r?.generated?.languagePlugin.typescript?.getServiceScript(r.generated.root)?.code;if(!r||!n)return{occurrences:[],skippedReferences:t.countFileSkip?1:0};let i=e.sourceReader.get(t.fileName);if(!i)return{occurrences:[],skippedReferences:t.countFileSkip?1:0};let o=e.context.language.maps.get(n,r),s=p(e.projectRoot,t.fileName),a=[...W(i.text)],c={tokens:a.filter(u=>u.start>=t.startOffset&&u.start<t.endOffset),tokenByStart:new Map(a.map(u=>[u.start,u])),tokenTextCounts:Qe(a),processedStarts:new Set};return qe({...e,fileName:t.fileName,sourceInfo:i,sourceFile:s,map:o,tokenContext:c})}function qe(e){let t=[],r=0;for(let n of e.tokenContext.tokens){if(e.tokenContext.processedStarts.has(n.start))continue;let i=U(e.map,n.start);if(i===null)continue;let s=(e.context.languageService.getDefinitionAtPosition(e.fileName,i+1)??[]).find(c=>!H(e.projectRoot,c.fileName));if(!s){r++;continue}let a=G(s,e.symbolLookup,e.vueSymbolLookup,e.context,e.projectRoot);if(a===null){r++;continue}X(t,e.sourceReader,e.sourceInfo,e.sourceFile,n,a),e.tokenContext.processedStarts.add(n.start),Ye(t,e,n,i,a)}return{occurrences:t,skippedReferences:r}}function Ye(e,t,r,n,i){if(!((t.tokenContext.tokenTextCounts.get(r.text)??0)<=1))for(let o of Ze(t.context.languageService,t.fileName,n+1,t.map,r,t.tokenContext.tokenByStart)){if(t.tokenContext.processedStarts.has(o))continue;let s=t.tokenContext.tokenByStart.get(o);s&&(X(e,t.sourceReader,t.sourceInfo,t.sourceFile,s,i),t.tokenContext.processedStarts.add(o))}}function X(e,t,r,n,i,o){let s=t.positionAt(r,i.start);e.push({sourceFile:n,sourceLine:s.line,sourceStartChar:s.character,sourceEndChar:s.character+i.text.length,symbolId:o})}function Qe(e){let t=new Map;for(let r of e)t.set(r.text,(t.get(r.text)??0)+1);return t}function Ze(e,t,r,n,i,o){let s=e.getDocumentHighlights?.(t,r,[t])??[],a=[];for(let c of s)if(c.fileName===t)for(let u of c.highlightSpans){let l=et(n,u.textSpan.start,o,i.text);l!==null&&a.push(l)}return a}function et(e,t,r,n){let i=r.get(t);if(i?.text===n)return i.start;let o=x(e,t);if(o===null)return null;let s=r.get(o);return s?.text===n?s.start:null}export{Ft as a,Ot as b,Mt as c,$t as d,sn as e};
|
|
72
|
+
//# sourceMappingURL=chunk-FERAXG6Y.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as i}from"./chunk-STBXCPKY.js";function l(n,o,s,t={}){let e=i(n,o,s,t);return e?{symbolA:e.symbolA,symbolB:e.symbolB,similarity:e.similarity,sharedCallees:e.sharedEvidence,uniqueToA:e.uniqueToA,uniqueToB:e.uniqueToB,consolidationStrategy:e.consolidationStrategy}:null}export{l as a};
|
|
2
|
+
//# sourceMappingURL=chunk-FLJJLSGB.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{m as v,o as D}from"./chunk-WS3Z6W3M.js";import{d as F}from"./chunk-7S5E7KWT.js";import{execFileSync as B}from"child_process";var S=2e3,x=50,I=64,$=8,U=3,K=2160*60*60,J=/\b(?:fix(?:es|ed)?|bug|regression|hotfix)\b/i,V=3,W=/#\d+|\b[A-Z][A-Z0-9]+-\d+\b/g,X=/^([a-z][a-z0-9-]+)(?:\([^)]+\))?!?:/i;function R(e){let t=F(e,{clearGroups:["whole-project"]});return(n,i)=>{let r=P(n.config.projectRoot);if(!r)return null;let o=t.has(n)?t.get(n,()=>({head:"",value:null})):null;return o&&o.head===r?o.value:(t.invalidate(n),t.get(n,()=>({head:r,value:i(n.config.projectRoot,r)})).value)}}function M(e){let t=F(e,{clearGroups:["whole-project"]});return(n,i,r)=>{let o=P(n.config.projectRoot);if(!o)return null;let a=t.has(n)?t.get(n,()=>({head:"",values:new Map})):null;(!a||a.head!==o)&&t.invalidate(n);let l=t.get(n,()=>({head:o,values:new Map}));if(l.values.has(i))return l.values.get(i)??null;let u=r(n.config.projectRoot,o);return l.values.set(i,u),u}}var Y=R("git-commit-history");function Z(e){return{capability:t=>q(e,t),commitHistory:()=>A(e),fileChurn:()=>te(e),changeAmplification:()=>ne(e),trackedFiles:()=>re(e),fileAddRecords:()=>se(e),coChangePairs:(t={})=>de(e,t),coChangePairsForFiles:(t,n={})=>j(e,t,n),directionalCoChangePairsForFiles:(t,n={})=>fe(e,t,n)}}function A(e){return Y(e,Q)}function q(e,t){let n=P(e.config.projectRoot);return n?{slot:t,available:!0,head:n}:{slot:t,available:!1,head:null,reason:"git history is unavailable for this project"}}function P(e){try{return C(e,["rev-parse","HEAD"]).trim()||null}catch{return null}}function C(e,t){return B("git",["-C",e,...t],{encoding:"utf-8",maxBuffer:64*1024*1024,stdio:["ignore","pipe","ignore"]})}function Q(e,t){let n;try{n=C(e,["log","--no-merges","--name-only","-n",String(S),"--pretty=format:%x01%H%x00%ct%x00%s"])}catch{return null}return{head:t,...E(n,x)}}function ee(e){return J.test(e.subject)}function te(e){let t=A(e);if(!t)return null;let n=new Map;for(let i of t.commits){let r=ee(i);for(let o of i.files){let a=n.get(o)??{changes:0,fixChanges:0,lastChangedAt:0};a.changes+=1,r&&(a.fixChanges+=1),i.timestamp>a.lastChangedAt&&(a.lastChangedAt=i.timestamp),n.set(o,a)}}return n}function ne(e){let t=A(e);if(!t||t.commits.length===0)return null;let n=t.commits.map(i=>i.files.length).filter(i=>i>0).sort((i,r)=>i-r);return n.length===0?null:{medianFilesPerCommit:k(n,.5),p90FilesPerCommit:k(n,.9),commitsAnalyzed:n.length}}function k(e,t){let n=Math.min(e.length-1,Math.floor(e.length*t));return e[n]}var ie=R("git-tracked-files");function re(e){return ie(e,t=>{try{let n=C(t,["ls-files"]);return new Set(n.split(`
|
|
2
|
+
`).map(i=>i.trim()).filter(i=>i!==""))}catch{return null}})}var oe=R("git-file-adds"),O="__git__/file-adds",_=v({kind:"git-file-adds",invalidation:D("git-file-adds"),serialize:ce,deserialize:le});function we(e){return Z(e).fileAddRecords()}function se(e){return oe(e,(t,n)=>ae(e,t,n))}function ae(e,t,n){let i=_.read(e,O,n);if(i)return i;let r=ue(t);return r&&_.write(e,O,n,r),r}function ce(e){return JSON.stringify([...e.entries()])}function le(e){if(!e)return null;try{let t=JSON.parse(e);if(!Array.isArray(t))return null;let n=new Map;for(let i of t){if(!Array.isArray(i)||i.length!==2||typeof i[0]!="string")return null;let r=i[1];if(!r||typeof r.commitsAgo!="number"||!Number.isFinite(r.commitsAgo)||typeof r.addedAt!="number"||!Number.isFinite(r.addedAt))return null;n.set(i[0],{commitsAgo:r.commitsAgo,addedAt:r.addedAt})}return n}catch{return null}}function ue(e){let t;try{t=C(e,["log","--no-merges","--find-renames","--name-status","-n",String(S),"--pretty=format:%x01%H%x00%ct%x00%s"])}catch{return null}let n=new Map,i=new Map,r=-1;for(let o of t.split("")){if(o.trim()==="")continue;r+=1;let a=o.indexOf(`
|
|
3
|
+
`),l=a>=0?o.slice(0,a):o,[,u]=l.split("\0"),f=Number(u)||0;if(!(a<0))for(let h of o.slice(a+1).split(`
|
|
4
|
+
`)){let s=me(h);if(!s)continue;if(s.status==="R"&&s.from&&s.to){let m=i.get(s.to)??new Set([s.to]);i.set(s.from,m);continue}if(s.status!=="A"||!s.to)continue;let c={commitsAgo:r,addedAt:f};n.set(s.to,c);for(let m of i.get(s.to)??[])n.set(m,c)}}return n}function me(e){let t=e.trim().split(" "),n=t[0]??"";if(!n)return null;let i=n[0]??"";if(i==="R"){let o=t[1],a=t[2];return o&&a?{status:i,from:o,to:a}:null}let r=t[1];return r?{status:i,to:r}:null}var G=M("git-co-change-pairs"),ge=M("git-directional-co-change-pairs");function de(e,t){let n=`all\0${T(t)}`,i=G(e,n,()=>{let r=A(e);return r?w(r,t):null});return i&&[...i]}function j(e,t,n){if(t.size===0)return[];let i=`files\0${z(t)}\0${T(n)}`,r=G(e,i,()=>{let o=A(e);return o?w(o,n,t):null});return r&&[...r]}function fe(e,t,n){if(t.size===0)return[];let i=n.maxFilesPerCommit??x;if(t.size>I)return j(e,t,n);let r=`directional\0${z(t)}\0${T({...n,maxFilesPerCommit:i})}`,o=ge(e,r,(a,l)=>{let u=he(a,l,t,i);return u?w(u,n,t):null});return o&&[...o]}function T(e){let t=e.minTogether??4,n=e.minConfidence??.6,i=e.maxFilesPerCommit??x;return`${t}\0${n}\0${i}`}function z(e){return[...e].sort().join("\0")}function w(e,t,n){let{minTogether:i=4,minConfidence:r=.6,maxFilesPerCommit:o=x}=t,a=new Map,l=new Map,u=e.newestAnalyzedAt??0;for(let s of e.commits){let c=[...new Set(s.files)].sort();if(c.length>o)continue;e.newestAnalyzedAt===void 0&&s.timestamp>u&&(u=s.timestamp);let m=be(c),y=n===void 0||c.some(g=>n.has(g));for(let g of c)a.set(g,(a.get(g)??0)+1);if(y)for(let g=0;g<c.length;g++)for(let p=g+1;p<c.length;p++){if(n&&!n.has(c[g])&&!n.has(c[p]))continue;let b=`${c[g]}\0${c[p]}`,d=l.get(b)??{together:0,focusedTogether:0,broadTogether:0,lastTogetherAt:0,timestamps:[],subjects:[]};d.together+=1,m?d.broadTogether+=1:d.focusedTogether+=1,s.timestamp>d.lastTogetherAt&&(d.lastTogetherAt=s.timestamp),d.timestamps.push(s.timestamp),d.subjects.push(s.subject),l.set(b,d)}}let f=[],h=u-K;for(let[s,c]of l){let m=c.together;if(m<i)continue;let[y,g]=s.split("\0"),p=a.get(y)??m,b=a.get(g)??m,d=Math.max(m/p,m/b);if(d<r)continue;let L=c.broadTogether/m,H=c.timestamps.filter(N=>N>=h).length;f.push({fileA:y,fileB:g,together:m,confidence:d,changesA:p,changesB:b,focusedTogether:c.focusedTogether,broadTogether:c.broadTogether,broadCommitRatio:L,lastTogetherAt:c.lastTogetherAt,recentTogether:H,commitScope:ye(c.broadTogether,m),recency:H>0?"recent":"stale",subjectContext:Se(c.subjects)})}return f.sort((s,c)=>c.together-s.together||c.confidence-s.confidence||s.fileA.localeCompare(c.fileA)),f}function he(e,t,n,i){let r;try{r=Ce(e)}catch{return null}if(r.length===0)return{head:t,commits:[],skippedBulkCommits:0,newestAnalyzedAt:0};let o;try{o=C(e,["log","--no-merges","--format=%H","-n",String(S),"--",...[...n].sort()])}catch{return null}let a=new Set(r.map(s=>s.hash)),l=o.split(`
|
|
5
|
+
`).map(s=>s.trim()).filter(s=>s!==""&&a.has(s)),u=pe(e,r,i);if(l.length===0)return{head:t,commits:[],skippedBulkCommits:0,newestAnalyzedAt:u};let f;try{f=C(e,["show","--no-walk=unsorted","--name-only","--pretty=format:%x01%H%x00%ct%x00%s",...l])}catch{return null}let h=E(f,i);return{head:t,...h,newestAnalyzedAt:u}}function Ce(e){return C(e,["log","--no-merges","--format=%H%x00%ct","-n",String(S)]).split(`
|
|
6
|
+
`).map(n=>n.trim()).filter(n=>n!=="").map(n=>{let[i,r]=n.split("\0");return{hash:i??"",timestamp:Number(r)||0}}).filter(n=>n.hash!=="")}function pe(e,t,n){for(let r=0;r<t.length;r+=20){let o=t.slice(r,r+20),a;try{a=C(e,["show","--no-walk=unsorted","--name-only","--pretty=format:%x01%H%x00%ct%x00%s",...o.map(u=>u.hash)])}catch{return t[0]?.timestamp??0}let l=E(a,n);if(l.commits.length>0)return l.commits[0].timestamp}return 0}function E(e,t){let n=[],i=0;for(let r of e.split("")){if(r.trim()==="")continue;let o=r.indexOf(`
|
|
7
|
+
`),a=o>=0?r.slice(0,o):r,[l,u,f]=a.split("\0");if(!l||!u)continue;let h=o>=0?r.slice(o+1).split(`
|
|
8
|
+
`).map(s=>s.trim()).filter(s=>s!==""):[];if(h.length>t){i+=1;continue}n.push({hash:l,timestamp:Number(u)||0,subject:f??"",files:h})}return{commits:n,skippedBulkCommits:i}}function be(e){return e.length>=$?!0:Ae(e).size>=U}function Ae(e){let t=new Set;for(let n of e){let i=n.indexOf("/");t.add(i>=0?n.slice(0,i):".")}return t}function ye(e,t){return e===0?"focused":e/t>=.5?"broad-sweep":"mixed"}function Se(e){let t=new Set,n=[],i=[];for(let r of e){!i.includes(r)&&i.length<V&&i.push(r);for(let o of xe(r))t.add(o);for(let o of r.match(W)??[])n.includes(o)||n.push(o)}return{subjectLabels:[...t].sort(),issueRefs:n,sampleSubjects:i,externalIssueLabelStatus:"unavailable"}}function xe(e){let t=new Set,n=X.exec(e)?.[1]?.toLowerCase();return n&&t.add(Fe(n)),/\b(?:feat|feature)\b/i.test(e)&&t.add("feature"),/\b(?:fix(?:es|ed)?|bug|regression|hotfix)\b/i.test(e)&&t.add("fix"),/\b(?:docs?|documentation|guide|readme)\b/i.test(e)&&t.add("docs"),/\brefactor(?:ing|ed)?\b/i.test(e)&&t.add("refactor"),/\btests?\b/i.test(e)&&t.add("test"),/\b(?:release|version|v\d+\.\d+)\b/i.test(e)&&t.add("release"),/\bchore\b/i.test(e)&&t.add("chore"),/\bbuild\b/i.test(e)&&t.add("build"),/\bci\b/i.test(e)&&t.add("ci"),/\bperf(?:ormance)?\b/i.test(e)&&t.add("perf"),[...t]}function Fe(e){return e==="feat"?"feature":e}export{Z as a,we as b};
|
|
9
|
+
//# sourceMappingURL=chunk-FXG3PHVW.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as f}from"./chunk-X4O6K47U.js";import{a as h}from"./chunk-WQHWIVA7.js";import{e as s,g as u}from"./chunk-HXXMPYEF.js";import{d}from"./chunk-T2FQ4GHD.js";import{x as c}from"./chunk-ISLWJ4PY.js";import{basename as p}from"path";function N(r,o){let t=h(r,o);if(!t)return[];let e=s(t.symbol),a=new f(r).definitionsForFile(t.relativePath).filter(n=>u(n.symbol)),l=a.filter(n=>n.parentTypeName===e||n.symbol.includes(e)),m=(l.length>0?l:L(p(t.relativePath))===e?a.filter(n=>n.symbol.includes("<invalid-global-code>")):[]).map(n=>({startLine:n.startLine,endLine:n.endLine,name:s(n.symbol)}));return c(t.relativePath)!=="clojure"?m:b(m,M(r,t))}function L(r){return r.replace(/\.[^.]+$/,"")}function M(r,o){let t=s(o.symbol);return t?(d(r,o.relativePath)?.clojureMembers??[]).filter(e=>e.ownerName===t).map(e=>({startLine:e.startLine,endLine:e.endLine,name:e.memberName})):[]}function b(r,o){let t=new Map;for(let e of[...r,...o])t.set(`${e.name}:${e.startLine}:${e.endLine}`,e);return[...t.values()].sort((e,i)=>e.startLine-i.startLine||e.endLine-i.endLine)}export{N as a};
|
|
2
|
+
//# sourceMappingURL=chunk-GCN2P4EJ.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import{a as B}from"./chunk-WXVGNFAO.js";import{a as _}from"./chunk-X4O6K47U.js";import{e as N}from"./chunk-QJ3FK4TB.js";import{e as M}from"./chunk-C4ICAIJ4.js";import{d as R,g as y,i as F}from"./chunk-HXXMPYEF.js";import{A as w}from"./chunk-ISLWJ4PY.js";import{execFileSync as g}from"child_process";import{existsSync as q,readFileSync as H}from"fs";import{basename as v}from"path";var J="Unable to compute git diff.";function Be(e,n={}){let i=n.plan??Z(e,n);return i.note?j(i.note,i.changedFileLines):i.changedFiles.length===0?V(i.changedFileLines):Y(i.changedFiles,[G(e,i.changedFiles,i.changedFiles,i.changedRanges)])}function Z(e,n={}){let{base:i="HEAD"}=n;try{let t=K(e.config.projectRoot,i),r=oe(e,t),o=se(e,Q(e.config.projectRoot,i));return{changedFileLines:t,changedFiles:r,changedRanges:o,renamedFiles:ne(e.config.projectRoot,i,r),note:t.length===0?"No changed files found.":void 0}}catch{return{changedFileLines:[],changedFiles:[],changedRanges:[],renamedFiles:[],note:J}}}function G(e,n,i,t=[]){let r=new _(e),o=new Set(i),s=B(t),a=[],l=new Map,d=n.flatMap(u=>r.definitionsForFile(u)).filter(Le),f=d.filter(u=>ce(u,s)),c=le(e,d,f,s),m=me([...f,...c.definitions]).sort((u,h)=>u.relativePath.localeCompare(h.relativePath)||u.startLine-h.startLine),p=m.map(u=>u.symbolId),C=ye(e,p),z=be(e,p,i),I=m.filter(u=>(C.get(u.symbolId)??0)===0),x=T(()=>M(e,I)),W=I.filter(u=>(x.get(u.symbolId)?.size??0)===0),U=T(()=>N(e,W));for(let u of m)he(e,u,o,a,l,x.get(u.symbolId)??new Set,U.get(u.symbolId)??new Set,C.get(u.symbolId)??0,z.get(u.symbolId)??new Set);return{changedSymbols:a,consumerEntries:[...l.entries()].map(([u,h])=>({file:u,symbols:[...h].sort()})),attributionNotes:c.notes}}function Y(e,n){let i=new Map,t=n.flatMap(s=>s.changedSymbols),r=n.flatMap(s=>s.attributionNotes??[]);for(let s of n)for(let a of s.consumerEntries){let l=i.get(a.file);l||(l=new Set,i.set(a.file,l));for(let d of a.symbols)l.add(d)}let o=Se(i);return{changedFiles:[...e],changedSymbols:t,affectedConsumers:o,attributionNotes:r,summary:{totalChangedFiles:e.length,totalChangedSymbols:t.length,totalAffectedFiles:o.length}}}function j(e,n=[]){return{changedFiles:n,changedSymbols:[],affectedConsumers:[],attributionNotes:[],summary:{totalChangedFiles:n.length,totalChangedSymbols:0,totalAffectedFiles:0,note:e}}}function V(e){return{changedFiles:e,changedSymbols:[],affectedConsumers:[],attributionNotes:[],summary:{totalChangedFiles:e.length,totalChangedSymbols:0,totalAffectedFiles:0,note:"Changed files are not present in the current SCIP index."}}}function K(e,n){let i=g("git",["diff","--name-only",n],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:67108864}),t=g("git",["diff","--name-only","--cached",n],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024}),r=g("git",["ls-files","--others","--exclude-standard"],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024});return[...new Set([i,t,r].flatMap(o=>o.split(`
|
|
2
|
+
`)).map(o=>o.trim()).filter(o=>o.length>0))]}function Q(e,n){let i=g("git",["diff","--unified=0",n],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:67108864}),t=g("git",["diff","--unified=0","--cached",n],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024});return O([...E(i),...E(t)])}function L(e,n,i){try{return g("git",["show",`${n}:./${i}`],{encoding:"utf-8",cwd:e,timeout:1e4,stdio:["ignore","pipe","ignore"]})}catch{return null}}function ve(e,n,i=[]){let t=X(e,n,i);return r=>(t.has(r)||t.set(r,L(e,n,r)),t.get(r)??null)}function Ae(e,n=e.changedFiles){let i=new Map(e.renamedFiles.map(t=>[t.to,t.from]));return[...new Set(n.map(t=>i.get(t)??t))]}function X(e,n,i){let t=[...new Set(i)],r=new Map;if(t.length===0)return r;try{let o=t.map(a=>`${n}:./${a}
|
|
3
|
+
`).join(""),s=g("git",["cat-file","--batch"],{cwd:e,input:o,maxBuffer:256*1024*1024,timeout:1e4,stdio:["pipe","pipe","ignore"]});return ee(s,t)}catch{for(let o of t)r.set(o,L(e,n,o));return r}}function ee(e,n){let i=new Map,t=0;for(let r of n){let o=e.indexOf(10,t);if(o<0)throw new Error("git cat-file batch output ended before object header");let s=e.subarray(t,o).toString("utf-8");if(t=o+1,s.endsWith(" missing")){i.set(r,null);continue}let a=/^[0-9a-f]+ ([^ ]+) (\d+)$/.exec(s);if(!a)throw new Error(`unexpected git cat-file batch header: ${s}`);let[,l,d]=a,f=Number(d);if(!Number.isFinite(f)||f<0)throw new Error(`unexpected git cat-file batch size: ${s}`);if(t+f>e.length)throw new Error("git cat-file batch output ended before blob payload");let c=e.subarray(t,t+f);i.set(r,l==="blob"?c.toString("utf-8"):null),t+=f,e[t]===10&&(t+=1)}return i}function ne(e,n,i){if(i.length===0)return[];let t=new Map,r=new Set;for(let s of ie(e,n))i.includes(s.to)&&(t.set(s.to,s),r.add(s.from));let o=te(e,n);if(o.length===0)return[...t.values()].sort((s,a)=>s.to.localeCompare(a.to));for(let s of i){if(t.has(s)||!q(`${e}/${s}`))continue;let a=o.filter(f=>!r.has(f)).filter(f=>v(f)===v(s));if(a.length===0)continue;let l=H(`${e}/${s}`,"utf-8"),d=a.map(f=>({from:f,to:s,similarity:re(L(e,n,f)??"",l)})).sort((f,c)=>c.similarity-f.similarity)[0];d&&d.similarity>=.45&&(t.set(s,d),r.add(d.from))}return[...t.values()].sort((s,a)=>s.to.localeCompare(a.to))}function te(e,n){let i=g("git",["diff","--name-only","--diff-filter=D",n],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:67108864}),t=g("git",["diff","--name-only","--diff-filter=D","--cached",n],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024});return[...new Set([...P(i),...P(t)])]}function ie(e,n){let i=g("git",["diff","--name-status","--find-renames",n],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:67108864}),t=g("git",["diff","--name-status","--find-renames","--cached",n],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024});return[...i.split(`
|
|
4
|
+
`),...t.split(`
|
|
5
|
+
`)].map(r=>r.trim()).filter(r=>r.startsWith("R")).map(r=>r.split(" ")).filter(r=>r.length>=3).map(([r,o,s])=>({from:o,to:s,similarity:Number(r.slice(1))/100}))}function re(e,n){let i=new Set(A(e)),t=new Set(A(n));if(i.size===0&&t.size===0)return 1;if(i.size===0||t.size===0)return 0;let r=0;for(let o of i)t.has(o)&&(r+=1);return 2*r/(i.size+t.size)}function A(e){return e.match(/[A-Za-z_$][\w$]*|[{}()[\].,]/g)??[]}function P(e){return e.split(`
|
|
6
|
+
`).map(n=>n.trim()).filter(n=>n.length>0)}function oe(e,n){let i=$(e),t=[];for(let r of n){let o=i(r);o&&!e.isIgnored(o)&&t.push(o)}return t}function se(e,n){let i=$(e),t=[];for(let r of n){let o=i(r.file);o&&!e.isIgnored(o)&&t.push({...r,file:o})}return O(t)}function $(e){let n=e.all(`SELECT relative_path FROM documents
|
|
7
|
+
ORDER BY id`).map(t=>t.relative_path),i=new Map(n.map(t=>[t,t]));return t=>{let r=t.replace(/\\/g,"/"),o=i.get(r);return o||(n.find(s=>s.endsWith(r))??null)}}function E(e){let n=[],i=null;for(let t of e.split(`
|
|
8
|
+
`)){if(t.startsWith("+++ ")){i=ae(t.slice(4).trim());continue}if(!i||!t.startsWith("@@ "))continue;let r=/@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@/.exec(t);if(!r)continue;let o=Math.max(0,Number(r[1])-1),s=r[2]===void 0?1:Number(r[2]);n.push({file:i,startLine:o,endLine:Math.max(o,o+Math.max(s,1)-1)})}return n}function ae(e){return e==="/dev/null"?null:e.startsWith("a/")||e.startsWith("b/")?e.slice(2):e}function O(e){let n=new Set,i=[];for(let t of e){let r=`${t.file}:${t.startLine}:${t.endLine}`;n.has(r)||(n.add(r),i.push(t))}return i}function ce(e,n){let i=n.get(e.relativePath);return!i||i.length===0?!0:i.some(t=>D(e.startLine,e.endLine,t.startLine,t.endLine))}function fe(e,n,i){let t=new Map,r=[],o=k(e),s=ge(i);for(let a of n){let l=o.get(a.file)??[];if(l.some(c=>D(c.startLine,c.endLine,a.startLine,a.endLine)))continue;let d=s.get(a.file)??[],f=pe(d,a);if(f){let c=l.find(m=>m.startLine>=f.startLine&&m.startLine<=f.endLine);if(c){t.set(c.symbolId,c),r.push(b(a,"ast-widened"));continue}}if(d.length===0){let c=[...l].filter(m=>m.startLine<=a.startLine).sort((m,p)=>p.startLine-m.startLine||m.endLine-p.endLine)[0];if(c){t.set(c.symbolId,c),r.push(b(a,"nearest-preceding"));continue}}r.push(b(a,"unattributed"))}return{definitions:[...t.values()],notes:r}}function le(e,n,i,t){let r=k(i),o=[],s=[],a=[...new Set(n.map(l=>l.relativePath))];for(let l of a){let d=t.get(l)??[];if(d.length===0)continue;let f=r.get(l)??[];for(let c of d)f.some(m=>D(m.startLine,m.endLine,c.startLine,c.endLine))||o.push(c);o.some(c=>c.file===l)&&s.push(...de(e,l))}return fe(n,o,s)}function de(e,n){let i=w(e,n);return i?i.rootNode.namedChildren.filter(ue).map(t=>({file:n,startLine:t.startPosition.row,endLine:t.endPosition.row})).filter(t=>t.endLine>=t.startLine):[]}function ue(e){return e.endPosition.row<e.startPosition.row?!1:!new Set(["import_statement","comment"]).has(e.type)}function me(e){let n=new Map;for(let i of e)n.set(i.symbolId,i);return[...n.values()]}function k(e){let n=new Map;for(let i of e){let t=n.get(i.relativePath)??[];t.push(i),n.set(i.relativePath,t)}return n}function ge(e){let n=new Map;for(let i of e){let t=n.get(i.file)??[];t.push(i),n.set(i.file,t)}return n}function pe(e,n){return e.filter(i=>i.startLine<=n.startLine&&i.endLine>=n.endLine).sort((i,t)=>i.endLine-i.startLine-(t.endLine-t.startLine))[0]}function b(e,n){return{file:e.file,startLine:e.startLine,endLine:e.endLine,method:n}}function D(e,n,i,t){return e<=t&&i<=n}function he(e,n,i,t,r,o,s,a,l){let d=Math.max(a,o.size,s.size);if(!De(n,d))return;let f=R(n.symbol);t.push({symbol:n.symbol,shortName:f,file:n.relativePath,startLine:n.startLine,endLine:n.endLine,fanIn:d});for(let c of l)S(e,i,r,c,f);for(let c of o)S(e,i,r,c,f);for(let c of s)S(e,i,r,c,f)}function T(e){try{return e()}catch(n){return console.error(`warning: diff-impact enrichment scan failed, continuing without it: ${n instanceof Error?n.message:n}`),new Map}}function ye(e,n){if(n.length===0)return new Map;let i=e.all(`SELECT m.symbol_id, COUNT(DISTINCT c.document_id) AS fan_in
|
|
9
|
+
FROM mentions m
|
|
10
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
11
|
+
WHERE m.symbol_id IN (${n.map(()=>"?").join(",")})
|
|
12
|
+
AND m.role != 1
|
|
13
|
+
GROUP BY m.symbol_id`,...n);return new Map(i.map(t=>[t.symbol_id,t.fan_in]))}function be(e,n,i){if(n.length===0||i.length===0)return new Map;let t=e.all(`SELECT DISTINCT m.symbol_id, ref_d.relative_path
|
|
14
|
+
FROM mentions m
|
|
15
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
16
|
+
JOIN documents ref_d ON c.document_id = ref_d.id
|
|
17
|
+
WHERE m.symbol_id IN (${n.map(()=>"?").join(",")})
|
|
18
|
+
AND m.role != 1
|
|
19
|
+
AND ref_d.relative_path NOT IN (${i.map(()=>"?").join(",")})
|
|
20
|
+
${e.pathExclusionsFor("ref_d")}`,...n,...i),r=new Map;for(let o of t){let s=r.get(o.symbol_id);s||(s=new Set,r.set(o.symbol_id,s)),s.add(o.relative_path)}return r}function S(e,n,i,t,r){if(e.isIgnored(t)||n.has(t))return;let o=i.get(t);o||(o=new Set,i.set(t,o)),o.add(r)}function Se(e){return[...e.entries()].map(([n,i])=>({file:n,consumedSymbols:i.size})).sort((n,i)=>i.consumedSymbols-n.consumedSymbols)}function Le(e){return!(F(e.symbol)||e.parentTypeName!==null&&!y(e.symbol))}function De(e,n){return y(e.symbol)||e.isTypeLike?!0:e.parentTypeName===null&&n>0}export{J as a,Be as b,Z as c,G as d,Y as e,L as f,ve as g,Ae as h,X as i,fe as j};
|
|
21
|
+
//# sourceMappingURL=chunk-GHXRVCIY.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as d}from"./chunk-64MNV6AB.js";import{c as S}from"./chunk-7S5E7KWT.js";import{isAbsolute as x,relative as h}from"path";function g(e){return e.replace(/\\/g,"/").replace(/^\.\//,"")}function F(e){return e.replace(/\\/g,"/")}function X(e,t){return g(e)===g(t)}function P(e,t){let n=h(e,t);return n===""||!n.startsWith("..")&&!x(n)}import{readdirSync as y}from"fs";import{execFileSync as _}from"child_process";import{extname as l,join as R}from"path";var C=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue",".rs",".py",".pyi",".java",".kt",".kts",".scala",".sc",".clj",".cljs",".cljc",".rb",".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx",".cs",".vb",".php",".dart"],H=[".vue"],p=[".tsx",".jsx"],f=[".vue"],I=[...p,...f],O=new Set(p),v=new Set(f),E=new Set(C.map(e=>e.toLowerCase())),w=[...E].sort().join(","),m=new Set(["node_modules",".git","target","dist","build",".next",".nuxt",".cache",".turbo",".nbb",".cpcache",".shadow-cljs","out","coverage",".scipquery-cache","__pycache__",".venv","venv",".idea",".vscode"]);function N(e,t={}){let n=t.includeIndexed??!0,i=t.includeAuxiliary??!0,o=t.extensions?.map(c=>c.toLowerCase()),s=o?new Set(o):E,u=o?[...s].sort().join(","):w,r=`${n?"1":"0"}|${i?"1":"0"}|${u}`;return j.get(e,r,()=>{let c=new Set;if(n)for(let a of d(e,{includeIgnored:!1}))s.has(l(a).toLowerCase())&&c.add(a);if(i)for(let a of T(e.config.projectRoot,s))e.isIgnored(a)||n&&c.has(a)||c.add(a);return[...c].sort()})}function V(e,t={}){let n=!1,i=!1;for(let o of N(e,{extensions:I})){if(t.scope&&!o.includes(t.scope))continue;let s=l(o).toLowerCase();if(n||=O.has(s),i||=v.has(s),n&&i)break}return{react:n,vue:i}}var j=S("source-files",{clearGroups:[]});function T(e,t){return b(e,t)??L(e,t)}function b(e,t){try{let n=_("git",["ls-files","--cached","--others","--exclude-standard"],{cwd:e,encoding:"utf-8",timeout:1e4,stdio:["ignore","pipe","ignore"]}),i=new Set;for(let o of n.split(`
|
|
2
|
+
`)){let s=o.trim();s&&(A(s)||t.has(l(s).toLowerCase())&&i.add(s))}return i}catch{return null}}function A(e){return e.split("/").some(t=>m.has(t))}function L(e,t){let n=new Set,i=o=>{let s=o?R(e,o):e,u;try{u=y(s,{withFileTypes:!0})}catch{return}for(let r of u)if(!m.has(r.name)){if(r.isDirectory()){i(o?`${o}/${r.name}`:r.name);continue}t.has(l(r.name).toLowerCase())&&n.add(o?`${o}/${r.name}`:r.name)}};return i(""),n}export{g as a,F as b,X as c,P as d,H as e,m as f,N as g,V as h};
|
|
3
|
+
//# sourceMappingURL=chunk-GNG622H3.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{c as x,f as C,g as w}from"./chunk-K2HYR5A7.js";import{b as k}from"./chunk-B75HZHUP.js";import{b as A,c as M}from"./chunk-NAH5EAZS.js";import{a as N}from"./chunk-BGBBVSH4.js";import{g as z}from"./chunk-R3JY4EZ4.js";import{d as v}from"./chunk-HXXMPYEF.js";import{b as h,i as S,m as R}from"./chunk-T2FQ4GHD.js";import{c as p}from"./chunk-GNG622H3.js";function fe(t,e={}){let{includeHomonyms:i=!1,limit:s}=e,r=F(t,e).filter(o=>o.relationship==="divergent"||i&&o.relationship==="homonym");return s?r.slice(0,s):r}function F(t,e={}){let{scope:i,minSimilarity:s=.3,scanLimit:r}=e,o=B(t,{scope:i,scanLimit:r});return $(o,{minSimilarity:s,isDelegatePair:Y(t)})}function $(t,e={}){let i=e.minSimilarity??.3,s=e.isDelegatePair,r=t.filter(n=>!ee(n.leaf)),o=[...new Set(r.map(n=>n.leaf))],a=H(o),l=[];for(let n of a){let c=r.filter(f=>n.has(f.leaf));if(c.length<2||new Set(c.map(f=>f.file)).size<2||c.every(f=>A(f.file)==="test"))continue;let m=null,b=!1,y=!1;for(let f=0;f<c.length;f+=1)for(let u=f+1;u<c.length;u+=1){let g=c[f],d=c[u];if(g.file===d.file||s?.(g,d,c)||s?.(d,g,c))continue;if(b=!0,g.normalizedBody===d.normalizedBody){y=!0;continue}let L=E(g.tokens,d.tokens);(!m||L>m.similarity)&&(m={a:g,b:d,similarity:L})}if(!b)continue;let T=[...c].sort((f,u)=>f.file.localeCompare(u.file)||f.startLine-u.startLine).map(O);if(!m){l.push({leaf:P(n),relationship:y?"identical":"homonym",maxDivergence:0,members:T});continue}let D=m.similarity>=i?"divergent":"homonym";l.push({leaf:P(n),relationship:D,maxDivergence:Math.round((1-m.similarity)*1e3)/1e3,members:T,...D==="divergent"?{firstDivergentTokens:Z(m.a.tokens,m.b.tokens)}:{}})}return l.sort((n,c)=>c.members.length-n.members.length||c.maxDivergence-n.maxDivergence||n.leaf.localeCompare(c.leaf))}function B(t,e){let i=z(t,{scope:e.scope}).filter(o=>o.isFunctionLike&&!t.isIgnored(o.relativePath)).filter(o=>!M(o.relativePath));i.sort((o,a)=>o.relativePath.localeCompare(a.relativePath)||o.startLine-a.startLine);let s=k(i,e.scanLimit),r=[];for(let o of s){let a=I(t,o);a&&r.push(a)}return r}function I(t,e){if(!e.leaf)return null;let i=C(t,e);if(!i)return null;let s=x(i);if(!s||s.length<8)return null;let r=G(i);return r.length===0?null:{leaf:e.leaf,symbol:e.symbol,shortName:v(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:N(e),normalizedBody:s,tokens:r,isThinForwarder:X(i)}}var j=/[A-Za-z_$][A-Za-z0-9_$]*|\d+(?:\.\d+)?|[^\sA-Za-z0-9_$]/g;function G(t){let e=w(t);return h(e).match(j)??[]}function O(t){return{symbol:t.symbol,shortName:t.shortName,file:t.file,startLine:t.startLine,endLine:t.endLine,loc:t.loc}}function E(t,e){let i=new Set(t),s=new Set(e);if(i.size===0&&s.size===0)return 1;if(i.size===0||s.size===0)return 0;let r=0;for(let a of i)s.has(a)&&(r+=1);let o=i.size+s.size-r;return o===0?0:r/o}function Z(t,e){let i=Math.min(t.length,e.length),s=0;for(;s<i&&t[s]===e[s];)s+=1;let r=t.slice(s,s+6).join(" "),o=e.slice(s,s+6).join(" ");return!r&&!o?"(bodies differ only in trailing length)":`A: ${r||"(end)"} | B: ${o||"(end)"}`}function H(t){let e=new Map;for(let a of t)e.set(a,a);let i=a=>{let l=a;for(;e.get(l)!==l;)l=e.get(l);let n=a;for(;e.get(n)!==l;){let c=e.get(n);e.set(n,l),n=c}return l},s=(a,l)=>{let n=i(a),c=i(l);n!==c&&e.set(n,c)},r=new Map;for(let a of t){let l=a.slice(0,1).toLowerCase(),n=r.get(l)??[];n.push(a),r.set(l,n)}for(let a of r.values())for(let l=0;l<a.length;l+=1)for(let n=l+1;n<a.length;n+=1)W(a[l],a[n])&&s(a[l],a[n]);let o=new Map;for(let a of t){let l=i(a),n=o.get(l)??new Set;n.add(a),o.set(l,n)}return[...o.values()]}function W(t,e){return t===e||t.toLowerCase()===e.toLowerCase()?!0:t.length<8||e.length<8||Math.abs(t.length-e.length)>2?!1:K(t.toLowerCase(),e.toLowerCase(),2)}function K(t,e,i){if(Math.abs(t.length-e.length)>i)return!1;let s=Array.from({length:e.length+1},(r,o)=>o);for(let r=1;r<=t.length;r+=1){let o=[r],a=o[0];for(let l=1;l<=e.length;l+=1){let n=t[r-1]===e[l-1]?0:1,c=Math.min(s[l]+1,o[l-1]+1,s[l-1]+n);o.push(c),a=Math.min(a,c)}if(a>i)return!1;s=o}return s[e.length]<=i}function X(t){let e=h(w(t)).trim();if(!e||q.test(e))return!1;let i=U(e);return i.length===0||i.length>2?!1:Q(i[i.length-1])}var q=/\b(?:if|else|for|while|switch|try|catch|do)\b/,J=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\[[^[\]]*\])*\((?:[^()]|\([^()]*\))*\)$/;function Q(t){let e=t.trim().replace(/^return\s+/,"").replace(/^await\s+/,"").replace(/;\s*$/,"").trim();return J.test(e)}function U(t){let e=[],i=0,s="";for(let r of t){if(r==="("||r==="["||r==="{"?i+=1:(r===")"||r==="]"||r==="}")&&(i=Math.max(0,i-1)),r===";"&&i===0){e.push(s),s="";continue}s+=r}return s.trim()&&e.push(s),e.map(r=>r.trim()).filter(r=>r.length>0)}var V=3;function Y(t){let e=new Map;return(i,s,r)=>{if(!i.isThinForwarder)return!1;let o=`${i.symbol}\0${s.symbol}`,a=e.get(o);if(a!==void 0)return a;let l=_(t,i,s,r,V,new Set);return e.set(o,l),l}}function _(t,e,i,s,r,o){if(r<=0||o.has(e.symbol)||(o.add(e.symbol),(S(t,e.file)??[]).filter(n=>n.line>=e.startLine&&n.line<=e.endLine&&n.calleeLeaf===i.leaf).length===0))return!1;let l=new Set(R(t,e.file).filter(n=>n.sourcePath&&(n.kind!=="namespace"||n.usedMembers.includes(i.leaf))).map(n=>n.sourcePath));if([...l].some(n=>p(n,i.file)))return!0;for(let n of s)if(!(n.symbol===e.symbol||n.symbol===i.symbol||!n.isThinForwarder)&&[...l].some(c=>p(c,n.file))&&_(t,n,i,s,r-1,o))return!0;return!1}function ee(t){return t.startsWith("<")&&t.endsWith(">")}function P(t){return[...t].sort()[0]}export{fe as a,F as b,$ as c};
|
|
2
|
+
//# sourceMappingURL=chunk-H4LUPLEJ.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as r}from"./chunk-XHWLNQVZ.js";function _(e,n,d){let i=r(e,n)??n,o=r(e,d)??d,t=e.get(`SELECT COUNT(DISTINCT gs.id) AS shared
|
|
2
2
|
FROM global_symbols gs
|
|
3
3
|
WHERE (
|
|
4
4
|
-- Defined in file1, referenced in file2
|
|
@@ -30,7 +30,7 @@ import{a as t}from"./chunk-7B6LP46R.js";function l(e,n,i){let d=t(e,n)??n,o=t(e,
|
|
|
30
30
|
JOIN documents d ON c.document_id = d.id
|
|
31
31
|
WHERE m.symbol_id = gs.id AND m.role != 1 AND d.relative_path = ?
|
|
32
32
|
)
|
|
33
|
-
)`,
|
|
33
|
+
)`,i,o,o,i);return{...c(i,o,t?.shared??0)}}function a(e,n={}){let{limit:d=20,scope:i}=n,o=i?"AND def_d.relative_path LIKE ? AND ref_d.relative_path LIKE ?":"",t=i?[`%${i}%`,`%${i}%`]:[];return e.all(`SELECT
|
|
34
34
|
def_d.relative_path AS file1,
|
|
35
35
|
ref_d.relative_path AS file2,
|
|
36
36
|
COUNT(DISTINCT gs.id) AS shared
|
|
@@ -52,5 +52,5 @@ import{a as t}from"./chunk-7B6LP46R.js";function l(e,n,i){let d=t(e,n)??n,o=t(e,
|
|
|
52
52
|
${o}
|
|
53
53
|
GROUP BY def_d.id, ref_d.id
|
|
54
54
|
ORDER BY shared DESC
|
|
55
|
-
LIMIT
|
|
56
|
-
//# sourceMappingURL=chunk-
|
|
55
|
+
LIMIT ?`,...t,d).filter(s=>!e.isIgnored(s.file1)&&!e.isIgnored(s.file2)).map(s=>c(s.file1,s.file2,s.shared))}function c(e,n,d){return{file1:e,file2:n,sharedSymbols:d,actionTier:"signal",couplingKind:"shared-symbol-coupling",evidenceReasons:[`${d} symbol(s) are defined in one file and referenced by the other`],recommendation:"Review whether the shared symbol surface is an intentional boundary or hidden coordination pressure before moving code."}}export{_ as a,a as b};
|
|
56
|
+
//# sourceMappingURL=chunk-H56MGERE.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{a as G}from"./chunk-QZ4JVECJ.js";import{a as U}from"./chunk-WXVGNFAO.js";import{a as _}from"./chunk-FXG3PHVW.js";import{b as F,i as O,j as L,k as $,l as K,m as H,o as z,p as X}from"./chunk-WS3Z6W3M.js";import{existsSync as Y,readFileSync as P,statSync as St}from"fs";import{join as T}from"path";function M(t,n){let e=it(t,n)??rt(t,n)??ot(t,n)??st(t,n);return ct(t,e,n)}function it(t,n){let e=-1,i=null;for(let r=0;r<=n;r+=1){let o=j(t[r]??"");o&&(i===null?(i=o,e=r):o===i&&(i=null,e=-1))}if(i===null||e<0)return null;for(let r=n+1;r<t.length;r+=1)if(j(t[r]??"")===i)return{start:e,end:r+1};return{start:e,end:t.length}}function j(t){let n=t.match(/^\s*(```+|~~~+)/);return n?n[1].startsWith("`")?"`":"~":null}function rt(t,n){if(!w(t[n]??""))return null;let e=n;for(;e>0&&w(t[e-1]??"");)e-=1;let i=n+1;for(;i<t.length&&w(t[i]??"");)i+=1;return{start:e,end:i}}function w(t){let n=t.trim();return n.startsWith("|")&&n.endsWith("|")&&n.includes("|")}function ot(t,n){let e=n;for(;e>=0;){let o=t[e]??"";if(I(o)!==null)break;if(N(o)!==null)return null;e-=1}if(e<0)return null;let i=I(t[e]??"");if(i===null)return null;let r=e+1;for(;r<t.length;){let o=t[r]??"",s=I(o);if(s!==null){if(s<=i)break;r+=1;continue}if(N(o)!==null)break;r+=1}return{start:e,end:r}}function I(t){let n=t.match(/^(\s*)(?:[-*+]\s+|\d+[.)]\s+)/);return n?n[1].length:null}function st(t,n){let e=t[n]??"";if(V(e)||e.trim().length===0)return{start:n,end:n+1};let i=n;for(;i>0&&q(t[i-1]??"");)i-=1;let r=n+1;for(;r<t.length&&q(t[r]??"");)r+=1;return{start:i,end:r}}function q(t){return N(t)===null}function N(t){return t.trim().length===0?"blank":V(t)?"heading":j(t)?"fence":w(t)?"table":I(t)!==null?"list":null}function V(t){return/^#{1,6}\s+/.test(t.trim())}function ct(t,n,e){let{start:i,end:r}=n;if(r-i>40){let s=Math.floor(20);i=Math.max(i,e-s),r=Math.min(r,i+40),i=Math.max(n.start,r-40)}let o=t.slice(i,r).join(`
|
|
2
|
+
`).trim();return o.length<=2e3?o:`${o.slice(0,2e3).trimEnd()}...`}function R(t,n){return n.filter(e=>t.includes(e))}import{existsSync as at,readFileSync as W}from"fs";var lt=/<!--\s*scip-query:\s*snapshot\s*-->/i;function Z(t,n){if((t.config.docs?.snapshotPaths??[]).some(r=>G(r,n)))return!0;let i=X(t,n);return i.length>0&<.test(i)}var J={classifyCitation:ut,citationContexts:ft,citationKindLabel:mt,citationRemediation:ht,referenceTargets:pt,hasLineAnchoredCitation:dt};function dt(t){return t.some(n=>(n.lineReferences?.length??0)>0)}function ut(t){let n=t.join(`
|
|
3
|
+
`).toLowerCase(),e=[],i=R(n,[".scipquery","declaredcouplings","suppression","suppressions","config","configuration","json"]);if(i.length>0)return e.push(`configuration/example terms near citation: ${i.join(", ")}`),{citationKind:"configuration-example",actionTier:"support",reasons:e};let r=R(n,["accepted","intentional","intentionally","retained","historical"]);if(r.length>0)return e.push(`intentional-record terms near citation: ${r.join(", ")}`),{citationKind:"intentional-record",actionTier:"support",reasons:e};let o=R(n,["command","cli","usage","example","run","workflow"]);return o.length>0?(e.push(`guide/reference terms near citation: ${o.join(", ")}`),{citationKind:"guide-reference",actionTier:"signal",reasons:e}):(e.push(t.length>0?"citation appears in prose without config or guide markers":"citation context unavailable"),{citationKind:"behavioral-claim",actionTier:"direct",reasons:e})}function ft(t,n,e){let i;try{i=W(`${t.config.projectRoot}/${n}`,"utf-8").split(/\r?\n/)}catch{return[]}let r=e.flatMap(gt),o=[];for(let s=0;s<i.length;s+=1){let c=i[s]??"";r.some(a=>c.includes(a))&&o.push(M(i,s))}return o}function gt(t){let n=t.split("/");return[t,`./${t}`,n.slice(-3).join("/"),n.slice(-2).join("/")].filter((e,i,r)=>e.length>0&&r.indexOf(e)===i)}function mt(t){switch(t){case"behavioral-claim":return"a behavioral doc claim";case"configuration-example":return"a configuration example";case"guide-reference":return"a guide reference";case"intentional-record":return"an intentional record"}}function ht(t,n){switch(t){case"behavioral-claim":return`Re-read ${n} and update the behavioral claim or citation.`;case"configuration-example":return`Verify the configuration example in ${n} still points at the intended file; update only if the example target changed.`;case"guide-reference":return`Verify the guide reference in ${n} still sends readers to the right implementation or command surface.`;case"intentional-record":return`Verify the intentional citation in ${n} is still meant to name this file.`}}function pt(t,n,e){let i=U(e),r=new Set;for(let o of n)yt(t,o,i.get(o)??[])&&r.add(o);return r}function yt(t,n,e){if(!Ct.test(n))return!0;let i=`${t.config.projectRoot}/${n}`;if(!at(i))return!0;if(e.length===0)return!1;let r=W(i,"utf-8").split(/\r?\n/),o=bt(r);for(let s of e)for(let c=s.startLine;c<=s.endLine;c+=1)if((r[c]??"").trim()!==""&&!o.has(c))return!0;return!1}var Ct=/\.(?:[cm]?[jt]sx?)$/i;function bt(t){let n=new Set,e=!1;for(let i=0;i<t.length;i+=1){let r=t[i].trim();!e&&Dt(r)&&(e=!0),e&&(n.add(i),r.endsWith(";")&&(e=!1))}return n}function Dt(t){return/^import(?:\s|$)/.test(t)||/^export(?:\s+type)?\s+(?:\*|\{)/.test(t)}var Q=H({kind:"doc-path-evidence",invalidation:z("doc-path-evidence"),serialize:Nt,deserialize:Bt}),v=/\.(?:md|mdx|rst|txt)$/i;function xt(t){return/(?:^|\/)(?:docs\/plans|plans|adrs?|rfcs?|decisions|changelogs?|archive|reports?)\//i.test(t)||/(?:^|\/)CHANGELOG\.(?:md|mdx|rst|txt)$/i.test(t)}var Rt=3,Tt=/([A-Za-z0-9_@-]+(?:\/[A-Za-z0-9_.@-]+)+\.[A-Za-z0-9]{1,6})(?::([1-9][0-9]*))?\b/g;function sn(t,n={}){let{doc:e,limit:i=20,minCoupling:r=Rt,includeSnapshotExcluded:o=!1}=n,s=It(t);if(!s)return{available:!1,commitsAnalyzed:0,docsScanned:0,findings:[]};let c=[];for(let a of s.docFiles){if(e!==void 0&&!a.includes(e)||e===void 0&&!tt(t,a)||e!==void 0&&!Y(T(t.config.projectRoot,a)))continue;let f=Z(t,a);if(f&&!o)continue;let{value:y,estimated:l}=At(t,a,s.changeTimes.get(a)),m=vt(t,a),h=new Map,{resolved:d,broken:g,citations:D}=kt(t,a,s.tracked,s.trackedBySuffix,s.everSeenInHistory),S=new Map(D.map(u=>[u.file,u]));for(let u of d){if(u===a||v.test(u))continue;let C=(s.changeTimes.get(u)??[]).filter(b=>b>y).length;if(C===0)continue;let p=S.get(u);h.set(u,{file:u,evidence:"reference",coChanges:0,changesSinceDocUpdate:C,...B("reference",m,p?.contexts),citationContexts:p?.contexts,citedLines:p?.lineReferences})}for(let[u,C]of s.coupling.get(a)??[]){if(C<r||!s.tracked.has(u))continue;let p=(s.changeTimes.get(u)??[]).filter(A=>A>y).length;if(p===0)continue;let b=h.get(u);b?(b.evidence="both",b.coChanges=C,Object.assign(b,B("both",m,b.citationContexts))):h.set(u,{file:u,evidence:"co-change",coChanges:C,changesSinceDocUpdate:p,...B("co-change",m)})}if(h.size===0&&g.length===0)continue;let x=[...h.values()].sort((u,C)=>C.changesSinceDocUpdate-u.changesSinceDocUpdate);c.push({doc:a,docLastChangedAt:y,staleness:x.reduce((u,C)=>u+C.changesSinceDocUpdate,0)+g.length*10,subjects:x.slice(0,8),brokenReferences:g,...f?{snapshotExcluded:!0}:{},...l?{docLastChangedAtEstimated:!0}:{}})}return c.sort((a,f)=>f.staleness-a.staleness),{available:!0,commitsAnalyzed:s.historyCommitCount,docsScanned:s.docFiles.length,findings:c.slice(0,i)}}function At(t,n,e){if(e&&e.length>0)return{value:Math.max(...e),estimated:!1};try{return{value:Math.floor(St(T(t.config.projectRoot,n)).mtimeMs/1e3),estimated:!0}}catch{return{value:0,estimated:!1}}}function vt(t,n){let e;try{e=P(T(t.config.projectRoot,n),"utf8").slice(0,6e3)}catch{return{docIntent:"unknown",reasons:["doc text unavailable"]}}let i=`${n}
|
|
4
|
+
${e}`.toLowerCase(),r=R(i,["historical note","historical record","history note","retrospective","postmortem","post-mortem","archived","archive","previously","legacy","recorded","record of","snapshot","as of","migration note","decision record"]);if(r.length>0)return{docIntent:"historical-note",reasons:[`historical-note terms: ${r.join(", ")}`]};let o=R(i,["current","standard","standards","must","should","policy","guide","guidance","workflow","contract","invariant","source of truth"]);return o.length>0?{docIntent:"current-guidance",reasons:[`current-guidance terms: ${o.join(", ")}`]}:{docIntent:"unknown",reasons:["no current-guidance or historical-note markers found"]}}function B(t,n,e=[]){let i=t==="co-change"||e.length===0?null:J.classifyCitation(e);return{actionTier:wt(t,n.docIntent,i?.actionTier),docIntent:n.docIntent,docIntentReasons:n.reasons,...i?{citationKind:i.citationKind,citationKindReasons:i.reasons}:{}}}function wt(t,n,e){return n==="historical-note"?"support":e||(t==="co-change"?"signal":"direct")}function It(t){let n=_(t),e=n.commitHistory();if(!e)return null;let i=n.trackedFiles()??new Set,r=new Map,o=new Map,s=new Set;for(let c of e.commits){let a=[...new Set(c.files)],f=a.filter(l=>v.test(l)),y=a.filter(l=>!v.test(l));for(let l of a){s.add(l);let m=r.get(l)??[];m.push(c.timestamp),r.set(l,m)}for(let l of f){let m=o.get(l);m||(m=new Map,o.set(l,m));for(let h of y)m.set(h,(m.get(h)??0)+1)}}return{changeTimes:r,coupling:o,docFiles:[...i].filter(c=>v.test(c)),everSeenInHistory:s,historyCommitCount:e.commits.length,tracked:i,trackedBySuffix:nt(i)}}function cn(t,n){if(n.size===0)return[];let e=$(),i=0,r=0,o=0,s=0,c=0,a=0;return K("doc-reference.docs-citing-files",()=>{let f=_(t).trackedFiles()??new Set;i=f.size;let y=nt(f),l=Mt(n,y),m=[];for(let h of f){if(!tt(t,h))continue;e&&(r+=1);let d;try{d=P(T(t.config.projectRoot,h),"utf-8")}catch{e&&(o+=1);continue}if(!_t(d,l)){e&&(s+=1);continue}let g=et(t,h,d);if(!g)continue;e&&(c+=1);let D=Et(g.candidates,n,l,f,y);if(D.size===0)continue;let S=[...new Set([...D.values()].flatMap(p=>[...p]))],x=Lt(g.contextsByCandidate,S),u=[...D].map(([p,b])=>({file:p,contexts:E([...b].flatMap(A=>x.get(A)??[])).slice(0,3),lineReferences:k([...b].flatMap(A=>g.lineReferencesByCandidate.get(A)??[]))})).filter(p=>p.contexts.length>0),C=[...D.keys()];if(C.length>0){e&&(a+=1);let p=C.sort();m.push({doc:h,cited:p,citations:u,citedClaims:E(u.flatMap(b=>b.contexts)).slice(0,3)})}}return m},()=>({targets:n.size,trackedFiles:i,livingDocs:r,unreadableDocs:o,candidateMisses:s,evidenceDocs:c,citedDocs:a}))}function tt(t,n){return v.test(n)&&!xt(n)&&Y(T(t.config.projectRoot,n))}function nt(t){let n=new Map;for(let e of t){let i=e.split("/");for(let r of[2,3]){if(i.length<r)continue;let o=i.slice(-r).join("/"),s=n.get(o)??[];s.push(e),n.set(o,s)}}return n}function Mt(t,n){let e=new Set(t);for(let i of t){let r=i.split("/");for(let o of[2,3]){if(r.length<o)continue;let s=r.slice(-o).join("/"),c=n.get(s);c?.length===1&&c[0]===i&&e.add(s)}}return e}function Et(t,n,e,i,r){let o=new Map;for(let s of t){if(!e.has(s))continue;let c;if(n.has(s))c=s;else if(i.has(s))c=s;else{let f=r.get(s);f?.length===1&&(c=f[0])}if(!c||!n.has(c))continue;let a=o.get(c)??new Set;a.add(s),o.set(c,a)}return o}function kt(t,n,e,i,r){let o=new Set,s=new Set,c=et(t,n);if(!c)return{resolved:o,broken:[],citations:[]};let a=c.candidates,f=c.contextsByCandidate,y=c.lineReferencesByCandidate,l=new Map,m=new Map,h=(d,g)=>{let D=f.get(g);if(D&&D.length>0){let x=l.get(d)??[];x.push(...D),l.set(d,E(x).slice(0,3))}let S=y.get(g);S&&S.length>0&&m.set(d,k([...m.get(d)??[],...S]))};for(let d of a){if(e.has(d)){o.add(d),h(d,d);continue}let g=i.get(d);if(g&&g.length===1){o.add(g[0]),h(g[0],d);continue}g&&g.length>1||r.has(d)&&s.add(d)}return{resolved:o,broken:[...s],citations:[...l].map(([d,g])=>({file:d,contexts:g,lineReferences:m.get(d)}))}}function Lt(t,n){let e=new Map;for(let i of n){let r=t.get(i);r&&r.length>0&&e.set(i,[...r])}return e}function et(t,n,e){let i=e;if(i===void 0)try{i=P(T(t.config.projectRoot,n),"utf-8")}catch{return null}let r=F(t,n,i),o=Q.read(t,n,r);if(o)return o;let s=jt(i);return Q.write(t,n,r,s),s}function _t(t,n){for(let e of n)if(t.includes(e))return!0;return!1}function jt(t){let n=t.split(/\r?\n/),e=new Set,i=new Map,r=new Map;for(let o=0;o<n.length;o+=1){let s=n[o]??"";for(let c of s.matchAll(Tt)){let a=(c[1]??"").replace(/^\.?\//,"");if(a.length===0)continue;e.add(a);let f=c[2]?Number(c[2]):null;f!==null&&Number.isSafeInteger(f)&&r.set(a,k([...r.get(a)??[],f]));let y=M(n,o);if(y.length===0)continue;let l=i.get(a)??[];l.push(y),i.set(a,E(l).slice(0,3))}}return{candidates:[...e],contextsByCandidate:i,lineReferencesByCandidate:r}}function Nt(t){let n={candidates:t.candidates,contextsByCandidate:[...t.contextsByCandidate.entries()],lineReferencesByCandidate:[...t.lineReferencesByCandidate.entries()]};return JSON.stringify(n)}function Bt(t){try{let n=JSON.parse(t);if(!O(n))return null;let e=L(n.candidates),i=Ft(n.contextsByCandidate),r=Pt(n.lineReferencesByCandidate);return!e||!i?null:{candidates:e,contextsByCandidate:new Map(i),lineReferencesByCandidate:new Map(r??[])}}catch{return null}}function Pt(t){if(t===void 0)return[];if(!Array.isArray(t))return null;let n=[];for(let e of t){if(!Array.isArray(e)||e.length!==2||typeof e[0]!="string"||!Array.isArray(e[1]))return null;let i=[];for(let r of e[1]){if(typeof r!="number"||!Number.isSafeInteger(r))return null;i.push(r)}n.push([e[0],k(i)])}return n}function Ft(t){if(!Array.isArray(t))return null;let n=[];for(let e of t){if(!Array.isArray(e)||e.length!==2||typeof e[0]!="string")return null;let i=L(e[1]);if(!i)return null;n.push([e[0],i])}return n}function E(t){let n=[];for(let e of new Set(t))n.some(i=>Ot(i,e))||n.push(e);return n}function k(t){return[...new Set(t)].sort((n,e)=>n-e)}function Ot(t,n){if(t===n)return!0;let e=t.split(/\r?\n/).map(c=>c.trim()).filter(c=>c.length>0),i=n.split(/\r?\n/).map(c=>c.trim()).filter(c=>c.length>0),r=Math.min(e.length,i.length);if(r===0)return!1;if(r<3)return t.includes(n)||n.includes(t);let o=new Set(i),s=e.filter(c=>o.has(c)).length;return s>=3&&s/r>=.6}export{Z as a,J as b,xt as c,sn as d,cn as e};
|
|
5
|
+
//# sourceMappingURL=chunk-H7NSJ7L2.js.map
|