scip-query 0.10.12 → 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 +141 -49
- 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-RUV5IY25.js → chunk-3KDUITBE.js} +2 -2
- package/dist/chunk-3T2FNHIU.js +2 -0
- package/dist/{chunk-EOLGSSDR.js → chunk-3V6JQQM5.js} +2 -2
- 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-LEHVP4DY.js → chunk-7HB3CZFD.js} +2 -2
- package/dist/chunk-7JZRFDCU.js +2 -0
- package/dist/{chunk-SQNHOOJ5.js → chunk-7XL7J7PT.js} +2 -2
- package/dist/{chunk-GKB4JJDU.js → chunk-ALHNAPS2.js} +2 -2
- package/dist/{chunk-TBCHRDAC.js → chunk-BDRBPG7Y.js} +2 -2
- package/dist/chunk-BN5SXXQS.js +40 -0
- package/dist/chunk-C4ICAIJ4.js +3 -0
- package/dist/{chunk-2GLNBCHB.js → chunk-CMHYBXJB.js} +2 -2
- package/dist/{chunk-S2MRVIJ5.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-JS6B76AQ.js → chunk-GCN2P4EJ.js} +2 -2
- package/dist/chunk-GHXRVCIY.js +21 -0
- package/dist/chunk-GNG622H3.js +3 -0
- package/dist/chunk-H4LUPLEJ.js +2 -0
- package/dist/{chunk-XUCZ3RQ5.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-A4UTLKHU.js → chunk-HZKMEXA3.js} +2 -2
- package/dist/{chunk-T3AEVJBG.js → chunk-IFSX6YVU.js} +2 -2
- package/dist/chunk-ISLWJ4PY.js +10 -0
- package/dist/chunk-J5WVNZ6O.js +2 -0
- package/dist/chunk-K2HYR5A7.js +3 -0
- package/dist/{chunk-UVPY3RUZ.js → chunk-K6UI6EBZ.js} +2 -2
- package/dist/{chunk-MNCQPMCH.js → chunk-KJCDEDQW.js} +2 -2
- package/dist/{chunk-KZ4MG5NY.js → chunk-KKMOB3OJ.js} +2 -2
- package/dist/{chunk-ELC77ZDE.js → chunk-KMVGRIO2.js} +2 -2
- package/dist/chunk-LWOOTRHC.js +2 -0
- package/dist/{chunk-DQ6433ZG.js → chunk-LZNLRE4X.js} +17 -8
- package/dist/{chunk-7C6JBBE4.js → chunk-M2YXL62V.js} +2 -2
- package/dist/chunk-MNEJYEHW.js +3 -0
- package/dist/chunk-MTDBHTSF.js +2 -0
- package/dist/{chunk-VB2EZZPA.js → chunk-N2Z3CU7X.js} +2 -2
- package/dist/{chunk-2UVCH7CQ.js → chunk-N7PNFLGY.js} +2 -2
- package/dist/chunk-NAH5EAZS.js +6 -0
- package/dist/{chunk-XHMVZFA6.js → chunk-NBXK32I6.js} +2 -2
- package/dist/chunk-NJJ7AS4F.js +2 -0
- package/dist/{chunk-ANUEY5WV.js → chunk-NLMRJ7SI.js} +2 -2
- package/dist/chunk-ODVITBYU.js +26 -0
- package/dist/chunk-ORBRX2QJ.js +2 -0
- package/dist/{chunk-NTSR6SRP.js → chunk-P36UR5II.js} +2 -2
- package/dist/chunk-PYZZBIEU.js +3 -0
- package/dist/chunk-PZS6J5YG.js +16 -0
- package/dist/{chunk-3XSNW5XB.js → chunk-QARYU7R3.js} +2 -2
- package/dist/chunk-QJ3FK4TB.js +38 -0
- package/dist/{chunk-4ISHQ7UW.js → chunk-QXGTGE2C.js} +4 -4
- package/dist/chunk-QZ4JVECJ.js +2 -0
- package/dist/{chunk-63CI3IXR.js → chunk-R3JY4EZ4.js} +10 -10
- package/dist/{chunk-FX6ULETZ.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-ZUUNREKS.js → chunk-TTS75UF2.js} +5 -5
- package/dist/{chunk-DDQONX6B.js → chunk-U7I373V4.js} +2 -2
- package/dist/chunk-UIKLA3F5.js +2 -0
- package/dist/{chunk-6BN3EHQE.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-PWAK75BU.js → chunk-VYF5HA76.js} +2 -2
- 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-RXINFVBN.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-OFXN2BCT.js → chunk-XHWLNQVZ.js} +2 -2
- package/dist/chunk-XMR747CP.js +2 -0
- package/dist/{chunk-JJ5SAWBT.js → chunk-Y6L4LXPG.js} +2 -2
- package/dist/chunk-YCPASUCX.js +2 -0
- package/dist/chunk-YZXV3CU3.js +60 -0
- package/dist/{chunk-XRUGSM76.js → chunk-ZEKBR4OK.js} +2 -2
- package/dist/chunk-ZMGBWSFZ.js +2 -0
- package/dist/cli.js +446 -280
- package/dist/{config-types-dvHOz0zU.d.ts → config-types-BrHl3Bge.d.ts} +57 -0
- package/dist/{db-rMZO5JFK.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-CtTIGh6H.d.ts → health-BEZ1Rt0S.d.ts} +54 -2
- package/dist/index.d.ts +4 -68
- package/dist/index.js +1 -1
- 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 +4 -2
- 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 +42 -3
- 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 +3 -3
- package/dist/reindex.js +19 -19
- package/dist/runtime.d.ts +11 -6
- package/dist/runtime.js +2 -2
- package/dist/{scip-cli-trnNvymv.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 +56 -13
- package/docs/DETECTOR_GUIDE.md +20 -3
- package/docs/REGEX_POLICY.md +34 -0
- package/docs/analyzer-inventory.md +40 -3
- package/docs/analyzer-validation-ledger.md +34 -6
- package/package.json +21 -7
- package/scripts/build-scip-windows.mjs +10 -7
- 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-2DOW7QCA.js +0 -71
- package/dist/chunk-2FMFF4RI.js +0 -2
- package/dist/chunk-5GXTUANY.js +0 -2
- package/dist/chunk-5JHEN5VN.js +0 -25
- package/dist/chunk-62ULXMQ7.js +0 -18
- package/dist/chunk-7EK7OSWS.js +0 -2
- package/dist/chunk-7IWIMNHI.js +0 -2
- package/dist/chunk-7XTO4YXB.js +0 -8
- package/dist/chunk-AOWFUGDL.js +0 -2
- package/dist/chunk-AREANYIA.js +0 -3
- package/dist/chunk-AZBELWZQ.js +0 -7
- package/dist/chunk-B32FX5KB.js +0 -2
- package/dist/chunk-B6MJ5VQV.js +0 -2
- package/dist/chunk-CXWCLVYL.js +0 -2
- package/dist/chunk-CYHIKTJN.js +0 -3
- package/dist/chunk-DFSEARAU.js +0 -2
- package/dist/chunk-DVFP6PZI.js +0 -2
- package/dist/chunk-E3ADDB43.js +0 -2
- package/dist/chunk-F6IXELII.js +0 -20
- package/dist/chunk-FMGVZBS2.js +0 -2
- package/dist/chunk-GG5LHT27.js +0 -2
- package/dist/chunk-H7JF2CKK.js +0 -2
- package/dist/chunk-HHOMJCP5.js +0 -4
- package/dist/chunk-HRDSU5FN.js +0 -9
- package/dist/chunk-HWVYTJOV.js +0 -2
- package/dist/chunk-JNMLBL36.js +0 -2
- package/dist/chunk-L446VQYQ.js +0 -2
- package/dist/chunk-LDJUB7XW.js +0 -2
- package/dist/chunk-MYTUWXHK.js +0 -4
- package/dist/chunk-N25HPUOK.js +0 -2
- package/dist/chunk-NABVR6B7.js +0 -2
- package/dist/chunk-NBNEVLRC.js +0 -3
- package/dist/chunk-ONPCQ2PM.js +0 -6
- package/dist/chunk-Q5P7NOVM.js +0 -2
- package/dist/chunk-RGKRYO22.js +0 -4
- package/dist/chunk-RM2WQ75T.js +0 -2
- package/dist/chunk-ROGZXWN2.js +0 -2
- package/dist/chunk-RSSXKJ6J.js +0 -38
- package/dist/chunk-RVGEZYMQ.js +0 -2
- package/dist/chunk-SA3DPTHT.js +0 -7
- package/dist/chunk-SGTKURU6.js +0 -52
- package/dist/chunk-T4N2ZRVY.js +0 -21
- package/dist/chunk-THB6AM3V.js +0 -11
- package/dist/chunk-ULHLDOD6.js +0 -4
- package/dist/chunk-UQ73QF5D.js +0 -43
- package/dist/chunk-UUBMFL3F.js +0 -59
- package/dist/chunk-V5FGK3DZ.js +0 -2
- package/dist/chunk-WTY5FERW.js +0 -2
- package/dist/chunk-WUOB4DHH.js +0 -6
- package/dist/chunk-YFQIKYOP.js +0 -2
- package/dist/chunk-Z2LDWIJV.js +0 -5
- package/dist/chunk-ZNWWVYQL.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 y}from"./chunk-FXG3PHVW.js";import{b as u}from"./chunk-NAH5EAZS.js";import{a as p}from"./chunk-XEMQUN3Z.js";import{existsSync as $}from"fs";import{join as _}from"path";function ne(e){return b.test(e)}var b=/(?:^|\/)(?:package-lock\.json|pnpm-lock\.yaml|yarn\.lock|Cargo\.lock|CHANGELOG(?:\.[a-z]+)?|.*\.map)$|(?:^|\/)(?:dist|build|out|node_modules|docs\/plans)\//i;function se(e,t,n={}){let{minTogether:s=4,minConfidence:i=.6,limit:r=30,maxFilesPerCommit:l=20}=n,g=y(e),a=g.commitHistory(),c=t!==void 0,d=g.coChangePairs({minTogether:c?Math.min(s,2):s,minConfidence:c?0:i,maxFilesPerCommit:l});if(!a||!d)return{available:!1,commitsAnalyzed:0,findings:[]};let f=typeof n.scanLimit=="number"?d.slice(0,n.scanLimit):d,R=p(e),k=E(e),L=F(e,R,k),w=n.includeLinked===!0||c,m=[];for(let o of f){if(b.test(o.fileA)||b.test(o.fileB)||!P(e,o.fileA)||!P(e,o.fileB)||c&&!o.fileA.includes(t)&&!o.fileB.includes(t)||!c&&(u(o.fileA)==="test"||u(o.fileB)==="test"||D(o.fileA,o.fileB)||N(o.fileA,o.fileB)))continue;let h=L(o.fileA,o.fileB);if(!w&&h)continue;let C=j(o.fileA,o.fileB),S=v(o,C,h);if(m.push({...o,structurallyLinked:h,partnerClass:C.partnerClass,partnerClassReasons:C.reasons,...S?{declaredCouplingSuggestion:S}:{}}),m.length>=r)break}return{available:!0,commitsAnalyzed:a.commits.length,findings:m}}function P(e,t){return $(_(e.config.projectRoot,t))}function j(e,t){let n=A(e),s=A(t),i=[],r=a=>{i.includes(a)||i.push(a)},l=(a,c)=>n.tags.has(a)&&s.tags.has(c)||n.tags.has(c)&&s.tags.has(a);if(l("doc","code"))return r("one side is documentation and the other is executable source"),{partnerClass:"doc-code",reasons:i};if(n.tags.has("test")||s.tags.has("test"))return r("one side is classified as a test file"),{partnerClass:"test-code",reasons:i};if(l("schema","script"))return r("schema or contract file changes with a script or generated-code path"),{partnerClass:"schema-script",reasons:i};if(l("model","view"))return r("model or state path changes with a view or component path"),{partnerClass:"model-view",reasons:i};if(l("config","code"))return r("configuration file changes with executable source"),{partnerClass:"config-code",reasons:i};let g=U(n.tokens,s.tokens).filter(a=>!J.has(a));return x(e,t)||g.length>=2?(r(x(e,t)?"both files live in the same directory":`files share feature tokens: ${g.slice(0,4).join(", ")}`),{partnerClass:"same-feature",reasons:i}):(r("no specific relationship pattern matched"),{partnerClass:"unknown",reasons:i})}function v(e,t,n){if(n||e.together<4||e.confidence<.75||e.commitScope==="broad-sweep"||e.recency==="stale"||!Z.has(t.partnerClass))return;let s=[e.fileA,e.fileB].sort();return{name:`co-change ${t.partnerClass}: ${V(s)}`,files:s,reason:`${t.partnerClass} pair changed together ${e.together}x with ${Math.round(e.confidence*100)}% confidence; declare it if future edits should require both sides.`}}function F(e,t=p(e),n=E(e)){return(s,i)=>B(t,n,s,i)}var I=/(?:^|\/)(?:locales|i18n)\//i;function T(e){return I.test(e)}function N(e,t){return T(e)&&T(t)?!0:O(e,t)}function O(e,t){if(!e.endsWith(".json")||!t.endsWith(".json"))return!1;let n=e.lastIndexOf("/"),s=t.lastIndexOf("/");if(n<0||s<0)return!1;let i=e.slice(0,n),r=t.slice(0,s);if(i===r)return!1;let l=e.slice(n+1),g=t.slice(s+1);if(l!==g)return!1;let a=i.lastIndexOf("/"),c=r.lastIndexOf("/"),d=a>=0?i.slice(0,a):"",f=c>=0?r.slice(0,c):"";return d===f}function D(e,t){let n=e.lastIndexOf("/"),s=t.lastIndexOf("/");if(e.slice(0,n)!==t.slice(0,s))return!1;let i=e.slice(n+1).split(".")[0],r=t.slice(s+1).split(".")[0];return i!==""&&i===r}function E(e){return(e.config.declaredCouplings??[]).filter(t=>Array.isArray(t.files)&&t.files.length>=2).map(t=>new Set(t.files))}function B(e,t,n,s){return e.get(n)?.has(s)===!0||e.get(s)?.has(n)===!0?!0:t.some(i=>i.has(n)&&i.has(s))}var z=/(?:^|\/)(?:readme|docs?|guides?|adr|architecture|design)(?:\/|$)|\.(?:md|mdx|rst|adoc|txt)$/i,G=/(?:^|\/)(?:\.[a-z0-9-]+rc|config|configs|settings|\.github)(?:\/|$)|(?:^|\/)(?:package\.json|tsconfig(?:\.[^.]+)?\.json|vite\.config\.[cm]?[jt]s|rollup\.config\.[cm]?[jt]s|eslint\.config\.[cm]?[jt]s)$|\.(?:json|ya?ml|toml|ini|env)$/i,M=/(?:^|\/)(?:schemas?|contracts?|migrations?|models?|types?)(?:\/|$)|(?:^|\/)[^/]*(?:schema|contract|migration|model|types?)[^/]*|(?:\.schema)?\.(?:graphql|gql|proto|prisma)$/i,H=/(?:^|\/)(?:scripts?|bin|tools?|tasks?|generators?|codegen|migrations?|seeds?)(?:\/|$)|(?:^|\/)[^/]*(?:generate|codegen|migrate|seed|script)[^/]*\.[cm]?[jt]s$/i,q=/(?:^|\/)(?:models?|entities|domain|state|stores?|reducers?)(?:\/|$)|(?:^|\/)[^/]*(?:model|entity|state|store|reducer|viewmodel)[^/]*\.[^.]+$/i,W=/(?:^|\/)(?:views?|pages?|components?|screens?|routes?|templates?)(?:\/|$)|(?:^|\/)[^/]*(?:view|page|component|screen|template)[^/]*\.[^.]+$|\.(?:vue|svelte|tsx|jsx)$/i,Z=new Set(["doc-code","config-code","schema-script","model-view","test-code"]),J=new Set(["src","lib","app","test","tests","spec","index","main","utils","util","types","type","config","docs","doc"]);function A(e){let t=e.replace(/\\/g,"/"),n=new Set;return z.test(t)&&n.add("doc"),G.test(t)&&n.add("config"),M.test(t)&&n.add("schema"),H.test(t)&&n.add("script"),q.test(t)&&n.add("model"),W.test(t)&&n.add("view"),u(t)==="test"&&n.add("test"),!n.has("doc")&&!n.has("config")&&n.add("code"),{tags:n,tokens:K(t)}}function x(e,t){let n=e.lastIndexOf("/"),s=t.lastIndexOf("/"),i=n>=0?e.slice(0,n):"",r=s>=0?t.slice(0,s):"";return i!==""&&i===r}function K(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9]+/).map(t=>t.toLowerCase()).filter(t=>t.length>=2)}function U(e,t){let n=new Set(t);return[...new Set(e.filter(s=>n.has(s)))].sort()}function V(e){return e.map(t=>t.split("/").pop()?.replace(/\.[^.]+$/,"")||t).join(" + ")}export{ne as a,se as b,j as c,v as d,F as e};
|
|
2
|
+
//# sourceMappingURL=chunk-NJJ7AS4F.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as c}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as c}from"./chunk-XEMQUN3Z.js";function j(e,s={}){let{minSimilarity:t=.5,limit:n=15,scope:i,minChainLength:r=3,maxChainLength:l=8}=s,a=c(e,i),o=y(a,r,l);if(o.length===0)return[];let f=d(o);return f.length<2?[]:S(x(f,t,n),n)}function d(e){let s=m(e),t=[];for(let n of e){let i=n.filter(r=>!s.has(r));i.length>=2&&t.push({original:n,filtered:i})}return t}function m(e){let{nodeFreq:s,tailFreq:t}=p(e),n=e.length*.9,i=e.length*.8,r=new Set;for(let[a,o]of s)o>n&&r.add(a);for(let[a,o]of t)o>i&&r.add(a);let l=["index.ts","index.js","cli.ts","main.ts","health.ts","health.js"];for(let a of s.keys()){let o=a.split("/").pop()??"";l.includes(o)&&r.add(a)}return r}function p(e){let s=new Map,t=new Map;for(let n of e){let i=new Set;for(let r of n)i.has(r)||(s.set(r,(s.get(r)??0)+1),i.add(r));for(let r=Math.max(0,n.length-2);r<n.length;r++)t.set(n[r],(t.get(n[r])??0)+1)}return{nodeFreq:s,tailFreq:t}}function x(e,s,t){let n=[];for(let i=0;i<e.length;i++){for(let r=i+1;r<e.length;r++){let l=b(e[i],e[r],s);l&&n.push(l)}if(n.length>t*10)break}return n.sort((i,r)=>Math.abs(r.similarity-i.similarity)>.01?r.similarity-i.similarity:i.divergencePoints.length-r.divergencePoints.length),n}function b(e,s,t){if(!C(e.filtered,s.filtered))return null;let{distance:n,ops:i}=A(e.filtered,s.filtered),r=Math.max(e.filtered.length,s.filtered.length);if(r===0)return null;let l=1-n/r;if(l<t||n===0)return null;let a=i.filter(f=>f.type==="substitute").map(f=>({index:f.indexA,nodeA:e.filtered[f.indexA],nodeB:s.filtered[f.indexB]}));return a.length===0||i.filter(f=>f.type==="match").length<2?null:{chainA:e.original,chainB:s.original,similarity:l,editDistance:n,divergencePoints:a,commonPrefix:F(e.original,s.original),commonSuffix:B(e.original,s.original)}}function C(e,s){let t=new Set(e);return s.some(n=>t.has(n))}function S(e,s){let t=[];for(let n of e)if(t.some(r=>h(n.chainA,r.chainA)&&h(n.chainB,r.chainB))||t.push(n),t.length>=s)break;return t}function y(e,s,t){let n=[];for(let r of e.keys()){if(n.length>=500)break;g(e,r,[r],new Set([r]),s,t,n,500)}return n}function g(e,s,t,n,i,r,l,a){if(l.length>=a)return;if(t.length>=r){t.length>=i&&l.push([...t]);return}let o=e.get(s);if(!o||o.size===0){t.length>=i&&l.push([...t]);return}let f=!1;for(let u of o)if(!n.has(u)&&(n.add(u),t.push(u),g(e,u,t,n,i,r,l,a),t.pop(),n.delete(u),f=!0,l.length>=a))return;!f&&t.length>=i&&l.push([...t])}function A(e,s){let t=e.length,n=s.length,i=Array.from({length:t+1},()=>Array(n+1).fill(0));for(let o=0;o<=t;o++)i[o][0]=o;for(let o=0;o<=n;o++)i[0][o]=o;for(let o=1;o<=t;o++)for(let f=1;f<=n;f++)e[o-1]===s[f-1]?i[o][f]=i[o-1][f-1]:i[o][f]=1+Math.min(i[o-1][f],i[o][f-1],i[o-1][f-1]);let r=[],l=t,a=n;for(;l>0||a>0;)l>0&&a>0&&e[l-1]===s[a-1]?(r.unshift({type:"match",indexA:l-1,indexB:a-1}),l--,a--):l>0&&a>0&&i[l][a]===i[l-1][a-1]+1?(r.unshift({type:"substitute",indexA:l-1,indexB:a-1}),l--,a--):a>0&&i[l][a]===i[l][a-1]+1?(r.unshift({type:"insert",indexA:l,indexB:a-1}),a--):(r.unshift({type:"delete",indexA:l-1,indexB:a}),l--);return{distance:i[t][n],ops:r}}function F(e,s){let t=[];for(let n=0;n<Math.min(e.length,s.length)&&e[n]===s[n];n++)t.push(e[n]);return t}function B(e,s){let t=[],n=e.length-1,i=s.length-1;for(;n>=0&&i>=0&&e[n]===s[i];)t.unshift(e[n]),n--,i--;return t}function h(e,s){if(e.length>s.length)return!1;let t=s.join("\u2192"),n=e.join("\u2192");return t.includes(n)}export{j as a};
|
|
2
|
+
//# sourceMappingURL=chunk-NLMRJ7SI.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import{c as d}from"./chunk-QJ3FK4TB.js";import{g as m}from"./chunk-R3JY4EZ4.js";import{d as r}from"./chunk-HXXMPYEF.js";function y(o,t={}){let{limit:i=30,scope:e}=t,s=e?"AND def_d.relative_path LIKE ?":"",f=e?[`%${e}%`]:[],l=o.all(`SELECT
|
|
2
|
+
gs.symbol,
|
|
3
|
+
COUNT(*) AS ref_count,
|
|
4
|
+
COUNT(DISTINCT ref_d.id) AS file_count,
|
|
5
|
+
def_d.relative_path AS defined_in
|
|
6
|
+
FROM mentions m
|
|
7
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
8
|
+
JOIN documents ref_d ON c.document_id = ref_d.id
|
|
9
|
+
JOIN global_symbols gs ON m.symbol_id = gs.id
|
|
10
|
+
JOIN (
|
|
11
|
+
SELECT m2.symbol_id, c2.document_id
|
|
12
|
+
FROM mentions m2
|
|
13
|
+
JOIN chunks c2 ON m2.chunk_id = c2.id
|
|
14
|
+
WHERE m2.role = 1
|
|
15
|
+
GROUP BY m2.symbol_id
|
|
16
|
+
) sym_def ON sym_def.symbol_id = gs.id
|
|
17
|
+
JOIN documents def_d ON sym_def.document_id = def_d.id
|
|
18
|
+
WHERE m.role != 1
|
|
19
|
+
AND def_d.id != ref_d.id
|
|
20
|
+
${o.pathExclusionsFor("def_d")}
|
|
21
|
+
${o.symbolNoiseFor("gs")}
|
|
22
|
+
${s}
|
|
23
|
+
GROUP BY gs.id
|
|
24
|
+
ORDER BY ref_count DESC
|
|
25
|
+
LIMIT ?`,...f,i).filter(n=>!o.isIgnored(n.defined_in)).map(n=>({symbol:n.symbol,shortName:r(n.symbol),refCount:n.ref_count,fileCount:n.file_count,definedIn:n.defined_in}));return l.length>0?l:c(o,e,i)}function c(o,t,i){return m(o,{scope:t}).filter(e=>!o.isIgnored(e.relativePath)).map(e=>u(o,e)).filter(e=>e.refCount>0).sort((e,s)=>s.refCount-e.refCount||s.fileCount-e.fileCount).slice(0,i)}function u(o,t){let e=d(o,t,{limit:500}).filter(s=>s.file!==t.relativePath);return{symbol:t.symbol,shortName:r(t.symbol),refCount:e.length,fileCount:new Set(e.map(s=>s.file)).size,definedIn:t.relativePath}}export{y as a};
|
|
26
|
+
//# sourceMappingURL=chunk-ODVITBYU.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as m,c as d}from"./chunk-NAH5EAZS.js";import{a as $}from"./chunk-XEMQUN3Z.js";function v(r,e={}){return P(r,e).cycles}function P(r,e={}){let{scope:s,maxDepth:i=10}=e,n=$(r,s),c=[],a=new Set,l=new Set,f=[],g=!1;function b(t,o){if(o>i){g=!0;return}if(l.has(t)){let h=f.indexOf(t);if(h!==-1){let u=f.slice(h).concat(t),y=u.indexOf(u.reduce((C,D)=>C<D?C:D)),p=[...u.slice(y,-1),...u.slice(0,y),u[y]],k=p.join(" -> ");S.has(k)||(S.add(k),c.push({path:p,kind:w(p)}))}return}if(a.has(t))return;a.add(t),l.add(t),f.push(t);let x=n.get(t);if(x)for(let h of x)b(h,o+1);f.pop(),l.delete(t)}let S=new Set;for(let t of n.keys())a.has(t)||b(t,0);return c.sort((t,o)=>t.kind!==o.kind?t.kind==="real"?-1:1:t.path.length-o.path.length),{cycles:c,truncated:g,maxDepth:i}}function w(r){for(let i of r){let n=m(i);if(n==="test"||n==="barrel"||n==="entry")return"module-hierarchy"}if(r.length!==3)return"real";let[e,s]=r;return!e||!s?"real":d(e)||d(s)||B(e,s)||B(s,e)||R(e,s)||R(s,e)||m(e)==="entry"||m(s)==="entry"?"module-hierarchy":"real"}function B(r,e){if(!/\.rs$/.test(r)||!/\.rs$/.test(e))return!1;let s=e.replace(/\.rs$/,"/");return r.startsWith(s)?!r.slice(s.length).includes("/"):!1}function R(r,e){if(!/\.rs$/.test(r)||!/\.rs$/.test(e))return!1;let s=r.replace(/\.rs$/,""),i=e.replace(/\.rs$/,"");if(s===i+"_tests"||s===i+"/tests")return!0;let n=r.split("/"),c=e.split("/");if(n.length===c.length&&n.includes("tests")&&c.includes("src")){let a=n[n.length-1],l=c[c.length-1];if(a&&a===l)return!0}return!1}export{v as a,P as b};
|
|
2
|
+
//# sourceMappingURL=chunk-ORBRX2QJ.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as T}from"./chunk-N2Z3CU7X.js";import{a as I}from"./chunk-7HB3CZFD.js";import{a as H}from"./chunk-CMHYBXJB.js";import{a as p}from"./chunk-XMR747CP.js";import{a as F}from"./chunk-R5336VHZ.js";import{a as v}from"./chunk-LWOOTRHC.js";import{a as k,b as G}from"./chunk-WZLPXFZU.js";import{b as D}from"./chunk-NJJ7AS4F.js";import{a as S}from"./chunk-FXG3PHVW.js";import{a as j}from"./chunk-PZS6J5YG.js";import{a as w}from"./chunk-ZEKBR4OK.js";import{a as P}from"./chunk-3T2FNHIU.js";import{a as A}from"./chunk-KKMOB3OJ.js";function X(t,e,n={}){let o=n.impactDepth??3,r=n.sliceDepth??3,l=n.semantic,s=!z(e),a=s?H(t,e,{semantic:l}):{definitions:[],referencedBy:[]},m=s?P(t,e,{semantic:l}):null,f=s?j(t,e,{semantic:l}):null,h=s?v(t,e,{semantic:l}):null,y=s?p(t,e,{direction:"backward",maxDepth:r,semantic:l}):null,R=s?p(t,e,{direction:"forward",maxDepth:r,semantic:l}):null,d=s?w(t,e,{maxDepth:o,scope:n.scope}):[],i=A(t,e,{semantic:l}),C=k(t,e),g=G(t,e),u=I(t,e),x=T(t,e),c={symbol:a.definitions.length>0||a.referencedBy.length>0||m!==null||f!==null||h!==null||y!==null||R!==null||d.length>0,file:i!==null||C.length>0||g.length>0,module:u.files.length>0||u.symbols.length>0||x.length>0},b=[];!c.symbol&&!c.file&&!c.module&&b.push("No symbol, file, or module matched target.");let B=i?.file??a.definitions[0]?.relativePath??null;return{target:e,matched:c,history:O(t,B),trace:a,callGraph:m,complexity:f,dataflow:h,backwardSlice:y,forwardSlice:R,affected:d,changeSurface:i,deps:C,rdeps:g,system:u,surface:x,warnings:b}}function O(t,e){let n={available:!1,file:e,churn:null,coChangePartners:[],suppressionsInFile:0};if(!e)return n;let o=S(t).fileChurn();if(!o)return n;let r=D(t,e,{limit:5});return{available:!0,file:e,churn:o.get(e)??{changes:0,fixChanges:0,lastChangedAt:0},coChangePartners:r.findings.map(l=>({file:l.fileA===e?l.fileB:l.fileA,together:l.together,confidence:l.confidence,subjectContext:l.subjectContext})),suppressionsInFile:F(t).byFile.get(e)??0}}function z(t){return t.includes("/")||t.includes("\\")||/\.[A-Za-z0-9]+(?::\d+(?:-\d+)?)?$/.test(t)}export{X as a};
|
|
2
|
+
//# sourceMappingURL=chunk-P36UR5II.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as be}from"./chunk-NBXK32I6.js";import{a as ye}from"./chunk-6Q6OFLFQ.js";import{a as ne,c as oe,d as re,e as w}from"./chunk-75X52JTA.js";import{a as pe}from"./chunk-3KDUITBE.js";import{b as ie}from"./chunk-H4LUPLEJ.js";import{a as ge}from"./chunk-IFSX6YVU.js";import{a as me}from"./chunk-C2QSK7E7.js";import{a as de}from"./chunk-MNEJYEHW.js";import{a as fe}from"./chunk-Y6L4LXPG.js";import{a as ce}from"./chunk-VXTNADIW.js";import{a as le}from"./chunk-ALHNAPS2.js";import{a as Y,b as J,c as Z,g as j,h as B}from"./chunk-GHXRVCIY.js";import{a as Q,b as D,e as X}from"./chunk-H7NSJ7L2.js";import{a as ee,b as te}from"./chunk-K2HYR5A7.js";import{b as ae}from"./chunk-343O6EVV.js";import{a as N,c as W,d as q,e as V}from"./chunk-NJJ7AS4F.js";import{a as U}from"./chunk-FXG3PHVW.js";import{a as he,e as ue}from"./chunk-STBXCPKY.js";import{a as se}from"./chunk-ORBRX2QJ.js";import{a as O}from"./chunk-X4O6K47U.js";import{f as R,g as T}from"./chunk-NAH5EAZS.js";import{i as H}from"./chunk-WFGOH2UI.js";import{e as F,f as z,g as I}from"./chunk-HXXMPYEF.js";import{a as _}from"./chunk-T2FQ4GHD.js";import{a as L}from"./chunk-ISLWJ4PY.js";import{l as P}from"./chunk-WS3Z6W3M.js";import{createHash as We}from"crypto";import{existsSync as K}from"fs";function Ce(e){let[t,i]=G(e,":"),o=t||"unknown",n=(a={})=>{let s=a.actionTier??Ie(o);return{sourceAnalyzer:o,actionTier:s,rootCauseKey:a.rootCauseKey??(i||e),label:a.label??`${o} finding`,relatedFiles:a.relatedFiles??[],why:a.why??[],remediation:a.remediation??Ne(s,o),file:a.file}};if(!i)return n({rootCauseKey:e,why:["Baseline identity did not include analyzer payload."]});if(["dead","isolated","extract","wrapper","passthrough","stale"].includes(o)){let[a,s]=G(i,":");return n({file:a,relatedFiles:a?[a]:[],rootCauseKey:s?`${a}:${s}`:i,label:`${o} finding`,why:s?[`Baseline subject: ${s}.`]:[]})}if(o==="cycle"){let a=i.split(">").filter(Boolean);return n({relatedFiles:a,rootCauseKey:i,label:"cycle finding",why:a.length>0?[`Cycle path: ${a.join(" > ")}.`]:[]})}if(o==="similar"){let a=i.split("|").filter(Boolean);return n({relatedFiles:[],rootCauseKey:i,label:"similarity finding",why:a.length>0?[`Similar symbols: ${a.join(" | ")}.`]:[]})}if(o==="drift"){let[a,s]=G(i,":"),[l,c]=G(s,":");return n({actionTier:a==="unused-import"?"direct":"signal",file:l,relatedFiles:[...new Set([l,c].filter(Boolean))],rootCauseKey:i,label:`${a||"drift"} finding`,why:[...a?[`Drift kind: ${a}.`]:[],...c?[`Related dependency: ${c}.`]:[]]})}return n({why:["Baseline analyzer prefix is not recognized by this diff-gate version."]})}function Ie(e){switch(e){case"dead":case"isolated":case"cycle":case"passthrough":return"direct";case"similar":case"extract":case"wrapper":case"stale":return"signal";default:return"signal"}}function Ne(e,t){return e==="direct"?`Fix the new ${t} baseline finding, or knowingly accept it via health --write-baseline.`:`Review the new ${t} baseline signal; fix it if it reflects real debt, or knowingly accept it via health --write-baseline.`}function G(e,t){let i=e.indexOf(t);return i<0?[e,""]:[e.slice(0,i),e.slice(i+t.length)]}import{existsSync as je,readFileSync as Be,writeFileSync as Me}from"fs";import{isAbsolute as Ke,join as Le}from"path";var Pe=25e3,_e=2500,ze=2500;function He(e){let t=me(e);return t.symbols>=Pe||t.documents>=_e?ze:void 0}var Oe=".scipquery-baseline.json";function x(e,t){return t&&Ke(t)?t:Le(e.config.projectRoot,t??Oe)}function $e(e,t={}){let{scope:i}=t,o=He(e),n=[],a=ae(e,{scope:i,...w.dead,scanLimit:o});for(let s of a.symbols)R(e,s.relativePath)||T(e,s.symbol,s.relativePath)||s.kind==="dead-code"&&n.push(`dead:${s.relativePath}:${s.shortName}`);for(let s of fe(e,{scope:i,...w.isolated,scanLimit:o}))R(e,s.relativePath)||T(e,s.symbol,s.relativePath)||n.push(`isolated:${s.relativePath}:${s.shortName}`);for(let s of se(e,{scope:i}))s.kind==="real"&&n.push(`cycle:${Ue(s.path)}`);for(let s of ue(e,{scope:i,...w.similar,scanLimit:o}))n.push(`similar:${[s.symbolA,s.symbolB].sort().join("|")}`);for(let s of ee(e,{scope:i,...w.duplicateBodies,scanLimit:o}))n.push(`duplicate-bodies:${s.hash}:${s.functions.map(l=>l.symbol).sort().join("|")}`);for(let s of le(e,{scope:i,...w.extract,scanLimit:o}))n.push(`extract:${s.relativePath}:${s.shortName}`);for(let s of pe(e,{scope:i,...w.wrappers,scanLimit:o}))n.push(`wrapper:${s.file}:${s.shortName}`);for(let s of de(e,{scope:i,...w.passthroughs,scanLimit:o}))n.push(`passthrough:${s.file}:${s.shortName}`);for(let s of ge(e,{scope:i,...w.stale,scanLimit:o}))n.push(`stale:${s.file}:${s.shortName}`);for(let s of ce(e,{scope:i,...w.drift,includePatternDeviations:!1,limit:Number.POSITIVE_INFINITY}).results)n.push(`drift:${s.kind}:${s.file}:${s.dep}`);return[...new Set(n)].sort()}function Ue(e){if(e.length===0)return"";let t=0;for(let i=1;i<e.length;i++)e[i]<e[t]&&(t=i);return[...e.slice(t),...e.slice(0,t)].join(">")}function Kt(e,t={}){let i=$e(e,{scope:t.scope}),o=x(e,t.path);return Me(o,JSON.stringify({version:1,findings:i},null,2)+`
|
|
2
|
+
`),{path:o,findingCount:i.length}}function Se(e,t={}){let i=x(e,t.path);if(!je(i))throw new Error(`No baseline found at ${i}. Create one with: scip-query health --write-baseline`);let o=JSON.parse(Be(i,"utf-8")),n=new Set(o.findings??[]),a=$e(e,{scope:t.scope}),s=new Set(a);return{baselinePath:i,baselineCount:n.size,current:a,newFindings:a.filter(l=>!n.has(l)),fixedFindings:[...n].filter(l=>!s.has(l))}}var ci=["echo","incomplete-migration","co-change-partner","twin-partner","coverage-contract","doc-reference","unused-params","new-dead","baseline"];function li(e,t={}){let i=t.base??"HEAD",{minTogether:o=6,minConfidence:n=.6,maxEchoChecks:a=Number.POSITIVE_INFINITY,maxHelpers:s=Number.POSITIVE_INFINITY,minSimilarity:l=.8,includeBaseline:c=!1,scanLimit:r}=t,d=t.semantic!==!1,u=new Set(t.skip??[]),h=Z(e,{base:i}),p=J(e,{base:i,plan:h}),m=p.changedFiles,b=new Set(m),S=new Set(h.changedFileLines),f=new Set([...b,...S]),C=j(e.config.projectRoot,i,B(h,m)),$=Ct(e.config.projectRoot,i,h,C),g={base:i,changedFiles:m,changedSymbols:p.changedSymbols.length,checksRun:[],skipped:[],suppressed:[],findings:[],attributionNotes:p.attributionNotes,rootCauseGroups:[],note:p.summary.note};if(m.length===0)return g;let v=(A,Ae)=>{if(u.has(A)){g.skipped.push({check:A,reason:"skipped via --skip"});return}let Ge=g.findings.length,xe=g.skipped.length,Ee=g.checksRun.length;P(`diff-gate.check.${A}`,Ae,()=>({check:A,changedFiles:m.length,changedSymbols:p.changedSymbols.length,findingsAdded:g.findings.length-Ge,skippedAdded:g.skipped.length-xe,checksRunAdded:g.checksRun.length-Ee}))};return v("echo",()=>Je(e,p.changedSymbols,b,$,a,l,r,d,g)),v("incomplete-migration",()=>it(e,i,h,s,r,d,C,g)),v("co-change-partner",()=>nt(e,f,o,n,g)),v("twin-partner",()=>ot(e,p.changedSymbols,b,r,g)),v("coverage-contract",()=>rt(e,f,g)),v("doc-reference",()=>ft(e,b,S,h.changedRanges,h.renamedFiles,g)),v("unused-params",()=>gt(e,m,g)),v("new-dead",()=>mt(e,p.changedSymbols,$,g)),c&&v("baseline",()=>St(e,g)),Ve(g,e.config.suppressions??[]),g.rootCauseGroups=qe(g.findings),g}function fi(e){return e.checksRun.length===0&&e.note===Y}function di(e){return e.filter(t=>!t.advisory)}function qe(e){let t=new Map;for(let i of e){let o=i.groupKey??`${i.check}:${i.id}`,n=t.get(o);n||(n={groupKey:o,check:i.check,severity:i.severity,actionTier:i.actionTier,sourceAnalyzer:i.sourceAnalyzer,rootCauseKey:i.rootCauseKey,count:0,findingIds:[],files:new Set,relatedFiles:new Set,message:i.message,remediation:i.remediation},t.set(o,n)),n.count+=1,n.findingIds.push(i.id),n.severity=Re(n.severity,i.severity),n.actionTier=Te(n.actionTier,i.actionTier),i.file&&n.files.add(i.file);for(let a of i.relatedFiles??[])n.relatedFiles.add(a)}return[...t.values()].map(i=>({...i,files:[...i.files].sort(),relatedFiles:[...i.relatedFiles].sort()})).sort((i,o)=>o.count-i.count||E(o.severity)-E(i.severity)||i.groupKey.localeCompare(o.groupKey))}function Re(e,t){return E(t)>E(e)?t:e}function E(e){return e==="error"?2:e==="warning"?1:0}function Te(e,t){return e?t&&we(t)>we(e)?t:e:t}function we(e){return e==="direct"?2:e==="signal"?1:0}function Ve(e,t){if(t.length===0||e.findings.length===0)return;let i=[];for(let o of e.findings){let n=t.find(a=>Ye(a,o));n?e.suppressed.push({finding:o,suppression:n}):i.push(o)}e.findings=i}function Ye(e,t){return!e.reason||e.reason.trim()===""||e.expiresAt&&Date.parse(e.expiresAt)<=Date.now()||e.id&&e.id!==t.id&&!t.legacySuppressionIds?.includes(e.id)||e.check&&e.check!==t.check||e.file&&e.file!==t.file?!1:!!(e.id||e.check)}function k(e,t){e.findings.push({...t,suppressionHint:`scip-query: ignore ${t.check} ${t.id} -- <reason>`})}function Je(e,t,i,o,n,a,s,l,c){c.checksRun.push("echo");for(let r of t.slice(0,n)){if(!I(r.symbol)||o(r))continue;let d=te(e,r.symbol,{maxLoc:15,scanLimit:s}).filter(f=>!i.has(f.file)).slice(0,5).map(f=>({otherFile:f.file,otherShort:f.shortName,otherSymbol:f.symbol,similarity:1,similarityBasis:"exact-body",sharedEvidence:[`exact normalized body (${f.loc} LOC)`]}));if(d.length>0){let f=y("echo",r.symbol,r.file),C=y("echo",r.symbol,r.file,...d.map(g=>`${g.otherSymbol}|${g.otherFile}`).sort()),$=d[0];k(c,{id:f,legacySuppressionIds:C===f?void 0:[C],groupKey:f,actionTier:"direct",check:"echo",severity:"warning",evidence:"heuristic",confidence:1,file:r.file,symbol:r.symbol,relatedFiles:[...new Set(d.map(g=>g.otherFile))].sort(),sourceAnalyzer:"duplicate-bodies",rootCauseKey:`${r.symbol}:${$.otherSymbol}`,message:ke(r,d),why:De(r,d),remediation:Fe("direct",r.shortName,$.otherShort)});continue}let u=he(e,r.symbol,{minSimilarity:a,limit:5,scanLimit:s,semantic:l,sourceCandidateMode:"target-pruned"}),h=[];for(let f of u){let C=f.fileA===r.file?f.fileB:f.fileA,$=f.fileA===r.file?f.shortNameB:f.shortNameA,g=f.fileA===r.file?f.symbolB:f.symbolA;i.has(C)||h.push({otherFile:C,otherShort:$,otherSymbol:g,similarity:f.similarity,similarityBasis:f.similarityBasis??"callees",sharedEvidence:f.sharedCallees})}if(h.length===0)continue;let p=h[0],m=y("echo",r.symbol,r.file,...h.map(f=>`${f.otherSymbol}|${f.otherFile}`).sort()),b=y("echo",r.symbol,r.file),S=Ze(r,h);k(c,{id:b,legacySuppressionIds:m===b?void 0:[m],groupKey:b,actionTier:S,check:"echo",severity:"warning",evidence:"heuristic",confidence:p.similarity,file:r.file,symbol:r.symbol,relatedFiles:[...new Set(h.map(f=>f.otherFile))].sort(),message:ke(r,h),why:De(r,h),remediation:Fe(S,r.shortName,p.otherShort)})}t.length>n&&c.skipped.push({check:"echo",reason:`echo check capped at ${n} of ${t.length} changed symbols`})}function Ze(e,t){return t.some(o=>Qe(e.symbol,o))?"direct":"signal"}function Qe(e,t){if(t.similarityBasis==="exact-body")return!0;if(t.similarityBasis!=="source-tokens"||t.similarity<.98||t.sharedEvidence.length>8)return!1;let i=F(e),o=F(t.otherSymbol);return!i||!o?!1:i===o?!0:tt(t.sharedEvidence)?!1:Xe(i,o)}function Xe(e,t){let i=ve(e),o=ve(t);if(i.length===0||o.length===0)return!1;let n=new Set(o),a=i.filter(s=>n.has(s)).length;return a>=2&&a/Math.min(i.length,o.length)>=.5}function ve(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9]+/).map(t=>t.toLowerCase()).filter(t=>t.length>=2)}var et=new Set(["bytes","crypto","hex","num","random","secret","to","token"]);function tt(e){return e.length>=3&&e.every(t=>et.has(t.toLowerCase()))}function ke(e,t){let i=t[0],o=Math.round(i.similarity*100);return t.length===1?`${e.shortName} (${e.file}) is ${o}% similar to established ${i.otherShort} (${i.otherFile})`:`${e.shortName} (${e.file}) resembles ${t.length} established symbol(s); strongest is ${o}% similar to ${i.otherShort} (${i.otherFile})`}function De(e,t){let i=[`${e.shortName} was changed in this diff.`];for(let o of t.slice(0,3))i.push(`${o.otherShort} is outside this diff and scored ${Math.round(o.similarity*100)}% similar by ${o.similarityBasis} evidence.`),i.push(`Shared evidence: ${o.sharedEvidence.slice(0,5).join(", ")||"(none listed)"}.`);return t.length>3&&i.push(`${t.length-3} additional similar match(es) grouped into this finding.`),i}function Fe(e,t,i){return e==="direct"?`Extract or reuse the shared behavior with ${i}, or keep the duplicate with a suppression reason.`:`Review whether ${t} is intentionally parallel to the established implementation(s); extract shared behavior only if the product semantics match.`}function it(e,t,i,o,n,a,s,l){let c=ye(e,{base:t,maxHelpers:o,diffPlan:i,scanLimit:n,semantic:a,baseContentAt:s});if(!c.available){l.skipped.push({check:"incomplete-migration",reason:"no git history"});return}l.checksRun.push("incomplete-migration"),c.note&&l.skipped.push({check:"incomplete-migration",reason:c.note});for(let r of c.findings){let d=r.leftovers.map(f=>`${f.shortName} (${f.file}, ${Math.round(f.containment*100)}% helper / ${Math.round(f.siteCoverage*100)}% site, ${f.migrationScope})`).join(", "),u=r.leftovers.map(f=>`${f.shortName}: ${f.migrationScope} (${f.migrationScopeReasons[0]})`).join("; "),h=[...r.migratedFiles,...r.leftovers.map(f=>f.file)],p=r.leftovers.length===0?void 0:Math.max(...r.leftovers.map(f=>Math.min(f.containment,f.siteCoverage))),m=r.leftovers.some(f=>f.migrationScope==="possible-subtype"),b=y("incomplete-migration",r.helperSymbol,r.helperFile,h.join("|")),S=y("incomplete-migration",r.helperSymbol,r.helperFile);k(l,{id:S,legacySuppressionIds:b===S?void 0:[b],check:"incomplete-migration",severity:"warning",evidence:"heuristic",confidence:p,file:r.helperFile,symbol:r.helperSymbol,relatedFiles:h,message:`new helper ${r.helperShortName} (${r.helperFile}) is wired into ${r.migratedFiles.length} file(s), but ${r.leftovers.length} similar un-migrated site(s) remain: ${d}`,why:[`${r.helperShortName} is new in this diff and already referenced by ${r.migratedFiles.join(", ")}.`,`Helper shape: ${r.helperShape}; ${r.specificHelperCalleeCount}/${r.helperCalleeCount} helper callees are specific enough to score.`,`Unchanged site(s) still contain the helper's callee pattern: ${d}.`,`Migration scope hints: ${u}.`],remediation:m?`Migrate same-scope sites to ${r.helperShortName}; review possible subtype/variant sites before applying the helper.`:`Migrate the remaining sites to ${r.helperShortName}, or confirm they are intentionally different.`})}}function nt(e,t,i,o,n){let a=U(e).directionalCoChangePairsForFiles(t,{minTogether:i,minConfidence:0,maxFilesPerCommit:20});if(!a){n.skipped.push({check:"co-change-partner",reason:"no git history"});return}n.checksRun.push("co-change-partner");let s=new Set,l;for(let c of a){let r=t.has(c.fileA),d=t.has(c.fileB);if(r===d)continue;let u=r?c.fileA:c.fileB,h=r?c.fileB:c.fileA,p=r?c.changesA:c.changesB,m=p>0?c.together/p:0;if(m<o||N(h)||N(u)||!K(`${e.config.projectRoot}/${h}`))continue;let b=`${u}|${h}`;if(s.has(b))continue;s.add(b);let S=y("co-change-partner",u,h,String(c.together)),f=y("co-change-partner",u,h),C=W(u,h),$=q({fileA:u,fileB:h,together:c.together,confidence:m,commitScope:c.commitScope,recency:c.recency,subjectContext:c.subjectContext},C,(l??=V(e))(u,h)),g=[u,h].sort().join("|");n.findings.push({id:f,legacySuppressionIds:S===f?void 0:[S],check:"co-change-partner",severity:"warning",evidence:"change-graph",actionTier:"signal",groupKey:`co-change-partner:${g}`,confidence:m,file:u,relatedFiles:[h],sourceAnalyzer:"co-change",rootCauseKey:g,partnerClass:C.partnerClass,partnerClassReasons:C.reasons,commitScope:c.commitScope,recency:c.recency,focusedTogether:c.focusedTogether,broadTogether:c.broadTogether,broadCommitRatio:c.broadCommitRatio,lastTogetherAt:c.lastTogetherAt,recentTogether:c.recentTogether,subjectContext:c.subjectContext,...$?{declaredCouplingSuggestion:$}:{},message:`${u} changed, but ${h} did not \u2014 they change together ${c.together}x (${Math.round(m*100)}% of the time)`,why:[`${u} is in this diff and ${h} is not.`,`Git history shows ${c.together} co-change(s), which is ${Math.round(m*100)}% of changes to the edited side.`,`History context: ${st(c)}.`,`Subject context: ${at(c.subjectContext)}.`,...ct(c),`Partner class: ${C.partnerClass} (${C.reasons.join("; ")}).`],remediation:$?`Update ${h} alongside this change, declare the coupling "${$.name}", or confirm the coupling no longer holds.`:`Update ${h} alongside this change, or confirm the coupling no longer holds.`})}}function ot(e,t,i,o,n){n.checksRun.push("twin-partner");let a=ie(e,{scanLimit:o}).filter(c=>c.relationship==="divergent"||c.relationship==="identical");if(a.length===0)return;let s=new Map;for(let c of a)for(let r of c.members)s.set(r.symbol,c);let l=new Set;for(let c of t){if(!I(c.symbol))continue;let r=s.get(c.symbol);if(!r)continue;let d=r.members.filter(m=>m.symbol!==c.symbol&&!i.has(m.file));if(d.length===0)continue;let u=[c.symbol,...d.map(m=>m.symbol)].sort().join("|");if(l.has(u))continue;l.add(u);let h=d[0],p=y("twin-partner",c.symbol,c.file,h.symbol);k(n,{id:p,groupKey:`twin-partner:${u}`,check:"twin-partner",severity:"warning",evidence:"heuristic",actionTier:"signal",advisory:!0,confidence:r.relationship==="identical"?1:Math.max(0,1-r.maxDivergence),file:c.file,symbol:c.symbol,relatedFiles:d.map(m=>m.file).sort(),sourceAnalyzer:"twin-drift",rootCauseKey:u,message:`${c.shortName} (${c.file}) changed but its same-name twin ${h.shortName} (${h.file}) did not \u2014 verify the change shouldn't apply to both, or consolidate them.`,why:[`${c.symbol} is in this diff.`,`${h.symbol} shares its (near-)name and is classified '${r.relationship}' with it, but ${h.file} is not in this diff.`,r.relationship==="divergent"?`The two bodies already diverge (~${Math.round(r.maxDivergence*100)}% token difference) \u2014 this diff may widen or narrow that drift.`:"The two bodies were byte-identical before this diff.","Advisory: twin-partner never fails the gate by itself \u2014 see the twin-partner entry in the diff-gate checks table."],remediation:`Update ${h.file} alongside this change, consolidate ${c.shortName}/${h.shortName} into one helper, or confirm the twin should diverge on purpose.`})}}function rt(e,t,i){i.checksRun.push("coverage-contract");let o=e.config.coverageContracts??[];for(let n of o){if(!oe(n,t))continue;let a=ne(e,n);if(a.status==="ok")continue;let s=y("coverage-contract",n.name,n.file);k(i,{id:s,groupKey:`coverage-contract:${n.name}`,check:"coverage-contract",severity:a.status==="unavailable"?"warning":"error",evidence:"graph-fact",actionTier:"direct",file:n.file,sourceAnalyzer:"coverage-contracts",rootCauseKey:n.name,message:re(a),why:[`Contract "${n.name}" declares that ${n.file} (${n.keys.type}) must track ${n.mustEqual.type}.`,a.status==="unavailable"?`The declared side could not be evaluated: ${a.unavailableReason}.`:`Missing: ${a.missing.join(", ")||"none"}. Extra: ${a.extra.join(", ")||"none"}.`,"Either side of this contract changed in this diff."],remediation:a.status==="unavailable"?"Investigate why the declared key set could not be parsed (see the reason above) \u2014 do not treat this as a pass.":`Update ${n.file} so its ${n.keys.type==="object-literal-keys"||n.keys.type==="string-array"?n.keys.identifier:n.keys.marker} matches ${n.mustEqual.type}, or fix the ground-truth source if the declared set is right.`})}}function st(e){return`${e.commitScope}/${e.recency}; ${e.focusedTogether} focused, ${e.broadTogether} broad-sweep (${Math.round(e.broadCommitRatio*100)}% broad), ${e.recentTogether} recent, last ${lt(e.lastTogetherAt)}`}function at(e){let t=e.subjectLabels.length>0?e.subjectLabels.slice(0,5).join(", "):"none inferred",i=e.issueRefs.length>0?e.issueRefs.slice(0,5).join(", "):"none",o=e.sampleSubjects.length>0?e.sampleSubjects.slice(0,3).map(n=>`"${n}"`).join("; "):"none";return`labels ${t}; refs ${i}; samples ${o}; external issue/PR labels ${e.externalIssueLabelStatus}`}function ct(e){let t=[];return e.commitScope==="broad-sweep"&&t.push("Broad-sweep history is weaker than focused co-edits; confirm this is a real coordination contract."),e.recency==="stale"&&t.push("The pair has no co-change in the recent history window; confirm the coupling still holds."),t}function lt(e){return e<=0?"unknown":new Date(e*1e3).toISOString().slice(0,10)}var M=3;function ft(e,t,i,o,n,a){a.checksRun.push("doc-reference");let s=D.referenceTargets(e,t,o);if(s.size===0)return;let l=new Set(n.map(r=>r.from)),c=[];for(let r of X(e,s))i.has(r.doc)||Q(e,r.doc)||c.push(dt(e,r,l));for(let r of ht(c))k(a,r)}function dt(e,t,i){let o=t.citedClaims.length>0?t.citedClaims:D.citationContexts(e,t.doc,t.cited),n=D.classifyCitation(o),a=D.hasLineAnchoredCitation(t.citations),s=t.cited.some(u=>i.has(u)||!K(`${e.config.projectRoot}/${u}`)),l=!(a||s),c=t.cited[0]??"",r=y("doc-reference",t.doc,t.cited.join("|")),d=y("doc-reference",t.doc,c);return{id:d,legacySuppressionIds:r===d?void 0:[r],check:"doc-reference",severity:"warning",evidence:"change-graph",actionTier:n.actionTier,groupKey:`doc-reference:${c}`,rootCauseKey:c,confidence:1,file:t.doc,relatedFiles:t.cited,citationKind:n.citationKind,citationKindReasons:n.reasons,citedClaims:o,...l?{advisory:!0}:{},message:`${t.doc} cites ${t.cited.join(", ")} as ${D.citationKindLabel(n.citationKind)} \u2014 changed in this diff, doc untouched`,why:[`${t.cited.join(", ")} changed in this diff.`,`${t.doc} cites the changed file(s) but was not updated in the same diff.`,...n.reasons.map(u=>`Citation kind evidence: ${u}`),l?"Advisory: bare file-mention citation (no line anchor, cited file still present under the same path) \u2014 21.2 calibration found this citation shape low-precision; verify at your leisure.":a?"Blocking: citation includes a line anchor that may now point at the wrong lines.":"Blocking: the cited file was deleted or renamed in this diff \u2014 the citation almost certainly needs an update."],remediation:D.citationRemediation(n.citationKind,t.doc)}}function ht(e){let t=new Map;for(let o of e){let n=o.rootCauseKey??"",a=t.get(n);a?a.push(o):t.set(n,[o])}let i=[];for(let[o,n]of t)n.length<=M?i.push(...n):i.push(ut(o,n));return i}function ut(e,t){let i=[...t].sort((d,u)=>(d.file??"").localeCompare(u.file??"")),o=i.slice(0,M).map(d=>({doc:d.file??"",citedClaims:d.citedClaims??[]})),n=i.length-o.length,a=i.every(d=>d.advisory===!0),s=i.reduce((d,u)=>Re(d,u.severity),"info"),l=i.reduce((d,u)=>Te(d,u.actionTier),void 0),c=i.map(d=>d.file??"").filter(d=>d.length>0),r=[...new Set(i.flatMap(d=>[d.id,...d.legacySuppressionIds??[]]))];return{id:y("doc-reference","hub-cluster",e),memberFindingIds:r,check:"doc-reference",severity:s,evidence:"change-graph",actionTier:l,groupKey:`doc-reference:${e}`,rootCauseKey:e,confidence:1,file:o[0]?.doc,relatedFiles:[e],citationCount:i.length,citationExemplars:o,suppressedCount:n,...a?{advisory:!0}:{},message:`${e} is cited by ${i.length} doc(s) changed in this diff, doc(s) untouched \u2014 showing ${o.length} example(s), ${n} more damped`,why:[`${e} changed in this diff.`,`${i.length} doc(s) cite it but were not updated in the same diff: ${c.join(", ")}.`,...o.map(d=>`Example \u2014 ${d.doc}: ${d.citedClaims[0]??"(no captured citation text)"}`),`${n} additional doc(s) also cite this file, past the per-hub-file cascade cap (${M}) \u2014 not silently dropped: counted in citationCount/suppressedCount and individually addressable via memberFindingIds.`,a?"Advisory: every citation in this cluster is a bare file-mention (no line anchor, cited file still present).":"Blocking: at least one citation in this cluster is line-anchored or cites a deleted/renamed file."],remediation:`Review the ${o.length} example doc(s) above; ${i.length} total doc(s) cite ${e} the same way \u2014 see citationExemplars and memberFindingIds in --json for the complete list.`}}function gt(e,t,i){i.checksRun.push("unused-params");for(let o of be(e,{files:t,limit:50})){let n=y("unused-params",o.symbol,o.file,o.unusedTrailing.join("|")),a=y("unused-params",o.symbol,o.file);k(i,{id:a,legacySuppressionIds:n===a?void 0:[n],check:"unused-params",severity:"warning",evidence:"heuristic",confidence:.85,file:o.file,startLine:o.startLine,endLine:o.endLine,symbol:o.symbol,message:`${o.shortName} (${o.file}) has trailing unused parameter(s): ${o.unusedTrailing.join(", ")}`,why:[`${o.shortName} is in a changed file.`,`The trailing parameter(s) ${o.unusedTrailing.join(", ")} are not referenced in the function body.`],remediation:"Drop the unused trailing parameters and their call-site arguments."})}}function mt(e,t,i,o){o.checksRun.push("new-dead");let n=new O(e),a=L(e.config.projectRoot),s=a.length>1;for(let l of t){if(i(l)||l.fanIn>0||n.fileKind(l.file)==="test"||R(e,l.file)||T(e,l.symbol,l.file)||bt(l.symbol))continue;let c=y("new-dead",l.symbol,l.file),r=s&&pt(a,l.file)&&yt(e,l.symbol);k(o,{id:c,check:"new-dead",severity:"warning",evidence:r?"heuristic":"graph-fact",confidence:r?.4:.9,file:l.file,symbol:l.symbol,message:r?`${l.shortName} (${l.file}) unconfirmed (cross-package ambiguous-name resolution gap): zero indexed consumers found, but this name is ambiguous project-wide and lives in a workspace package \u2014 verify manually before treating as dead`:`${l.shortName} (${l.file}) was changed but has zero indexed consumers`,why:r?[`${l.shortName} is a changed production symbol in a workspace package.`,"The index, semantic, and source-fallback layers all report zero consumers for this symbol.","Its leaf name is ambiguous project-wide (a same-named definition exists elsewhere), and cross-package consumers reached only through a re-exporting barrel are a known unresolvable shape for this tool \u2014 see docs/plans/2026-07-02-followups.md item 2."]:[`${l.shortName} is a changed production symbol.`,"The index reports zero consumers for this symbol.","The symbol is not in a detected entry surface or configured live root."],remediation:r?"Verify with a direct code search before deleting; this tool cannot confidently resolve this symbol.":"Wire it up, or remove it before it becomes permanent dead code."})}}function pt(e,t){return e.some(i=>t===i.relativeDir||t.startsWith(`${i.relativeDir}/`))}function yt(e,t){let i=F(t);return i?(H(e).get(i)?.length??0)>1:!1}function bt(e){if(z(e)!=="type")return!1;let t=F(e);return t.startsWith("_Assert")||t.startsWith("Assert")}function Ct(e,t,i,o){let n=new Map(i.renamedFiles.map(s=>[s.to,s.from])),a=o??j(e,t,B(i));return s=>{let l=n.get(s.file)??s.file,c=F(s.symbol);if(!c)return!1;let r=a(l);return r!==null&&$t(r,c)}}function $t(e,t){return new RegExp(`\\b${_(t)}\\b`).test(e)}function St(e,t){if(!K(x(e))){t.skipped.push({check:"baseline",reason:"no .scipquery-baseline.json \u2014 run health --write-baseline to enable"});return}t.checksRun.push("baseline");let i=Se(e);for(let o of i.newFindings){let n=Ce(o),a=y("baseline",o);k(t,{id:a,groupKey:`baseline:${n.sourceAnalyzer}:${n.rootCauseKey}`,check:"baseline",severity:"error",evidence:"baseline",actionTier:n.actionTier,confidence:1,file:n.file,relatedFiles:n.relatedFiles.length>0?n.relatedFiles:void 0,sourceAnalyzer:n.sourceAnalyzer,rootCauseKey:n.rootCauseKey,message:`new ${n.label} vs committed baseline: ${o}`,why:["A committed health baseline exists.","The current health result contains a finding not present in that baseline.",`Underlying analyzer: ${n.sourceAnalyzer}.`,`Inherited action tier: ${n.actionTier}.`,`Root cause key: ${n.rootCauseKey}.`,...n.why],remediation:n.remediation})}}function y(e,...t){return`SQ${We("sha256").update([e,...t].join("\0")).digest("hex").slice(0,12).toUpperCase()}`}export{$e as a,Kt as b,Se as c,ci as d,li as e,fi as f,di as g,Ct as h};
|
|
3
|
+
//# sourceMappingURL=chunk-PYZZBIEU.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import{a as f}from"./chunk-X4O6K47U.js";import{a as u}from"./chunk-WQHWIVA7.js";import{d as b}from"./chunk-HXXMPYEF.js";import{b as m}from"./chunk-T2FQ4GHD.js";import{A as l}from"./chunk-ISLWJ4PY.js";import{readFileSync as d}from"fs";import{join as _}from"path";function M(e,t,n={}){let s=u(e,t);if(!s)return null;let i=new f(e),a=S(e,s),r=s.endLine-s.startLine+1,c=i.calleeMap([s],{additive:!0,semantic:n.semantic}).get(s.symbolId)??[],p=new Set(c.map(y=>y.symbol));return{symbol:s.symbol,shortName:b(s.symbol),relativePath:s.relativePath,startLine:s.startLine,endLine:s.endLine,loc:r,branches:a.branches,estimateBasis:a.estimateBasis,cyclomaticEstimate:a.branches+1,calleeCount:p.size,fanIn:N(e,s.symbolId),fanOut:B(c,s.relativePath)}}function S(e,t){let n=l(e,t.relativePath);if(n){let s=g(n.rootNode,t.startLine,t.endLine);if(s)return{branches:P(s),estimateBasis:"ast"}}return{branches:L(E(e,t.relativePath,t.startLine,t.endLine),x(e,t.relativePath)),estimateBasis:"regex-fallback"}}function x(e,t){return e.get("SELECT language FROM documents WHERE relative_path = ?",t)?.language??"unknown"}function E(e,t,n,s){try{return d(_(e.config.projectRoot,t),"utf-8").split(`
|
|
2
|
+
`).slice(n,s+1).join(`
|
|
3
|
+
`)}catch{return""}}function N(e,t){return e.get(`SELECT COUNT(DISTINCT c.document_id) AS c
|
|
4
|
+
FROM mentions m
|
|
5
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
6
|
+
JOIN (
|
|
7
|
+
SELECT m2.symbol_id, c2.document_id
|
|
8
|
+
FROM mentions m2
|
|
9
|
+
JOIN chunks c2 ON m2.chunk_id = c2.id
|
|
10
|
+
WHERE m2.role = 1
|
|
11
|
+
GROUP BY m2.symbol_id
|
|
12
|
+
) sym_def ON sym_def.symbol_id = m.symbol_id
|
|
13
|
+
WHERE m.symbol_id = ?
|
|
14
|
+
AND m.role != 1
|
|
15
|
+
AND sym_def.document_id != c.document_id`,t)?.c??0}function B(e,t){return new Set(e.filter(n=>n.file!==t).map(n=>n.symbol)).size}function P(e){let t=0;return h(e,n=>{if(C.has(n.type)){t+=1;return}n.type==="binary_expression"&&n.parent?.type!=="binary_expression"&&(n.text.includes("&&")||n.text.includes("||"))&&(t+=O(n.text))}),t}function h(e,t){t(e);for(let n of e.namedChildren)h(n,t)}function g(e,t,n){if(e.startPosition.row>t||e.endPosition.row<n)return null;for(let s of e.namedChildren){let i=g(s,t,n);if(i)return i}return e}var C=new Set(["if_statement","conditional_expression","ternary_expression","for_statement","for_in_statement","for_of_statement","while_statement","do_statement","switch_case","case_statement","catch_clause","except_clause","elif_clause","match_arm"]);function O(e){return(e.match(/&&|\|\|/g)??[]).length}function L(e,t){let n=m(e),s=0,i=[/\bif\b/g,/\belse\s+if\b/g,/\belse\b/g,/\bfor\b/g,/\bwhile\b/g,/\bswitch\b/g,/\bcase\b/g,/\bcatch\b/g,/\?\s*[^?]/g,/&&/g,/\|\|/g];for(let a of i){let r=n.match(a);r&&(s+=r.length)}if(t==="python"){let a=[/\belif\b/g,/\bexcept\b/g,/\bfinally\b/g];for(let r of a){let o=n.match(r);o&&(s+=o.length)}}else if(t==="rust"){let a=[/\bmatch\b/g,/=>/g,/\bloop\b/g];for(let r of a){let o=n.match(r);o&&(s+=o.length)}}else if(t==="ruby"){let a=[/\belsif\b/g,/\bunless\b/g,/\brescue\b/g,/\bwhen\b/g];for(let r of a){let o=n.match(r);o&&(s+=o.length)}}else if(t==="go"){let a=[/\bselect\b/g,/\bdefer\b/g];for(let r of a){let o=n.match(r);o&&(s+=o.length)}}return s}export{M as a,S as b,P as c};
|
|
16
|
+
//# sourceMappingURL=chunk-PZS6J5YG.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{q as c,r as l}from"./chunk-WS3Z6W3M.js";function h(e,a,i,r,n,o){let t=new Set;d(e,a,i,r)&&t.add(n);for(let s of o)s.value&&p(t,s.label,s.value);return[...t].slice(0,6)}function p(e,a,i){let r=u(i);a.endsWith("name")&&y(r)&&e.add(`${a} has type-guard boundary shape`);for(let n of r){let o=f.get(n);o&&e.add(`${a} has ${o} term: ${n}`)}}function d(e,a,i,r){if(i<=0)return!1;let n=c(e,a);if(n.length===0)return!1;for(let o=i-1;o>=0&&o>=i-5;o-=1){let t=(n[o]??"").trim();if(t!==""){if(l(t)===r)return!0;if(!t.startsWith("//")&&!t.startsWith("*")&&!t.startsWith("/*")&&!t.startsWith("@")&&!t.startsWith("#"))return!1}}return!1}function u(e){return e.replace(/([A-Z])([A-Z][a-z])/g,"$1 $2").replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(Boolean)}function y(e){return e.some(a=>g.has(a))&&e.some(a=>m.has(a))}var f=new Map([["access","access policy"],["accessible","access policy"],["adapter","adapter"],["adapters","adapter"],["allow","access policy"],["allowed","access policy"],["animation","animation calculation"],["api","api surface"],["apply","settings/application"],["audit","side-effect boundary"],["auth","authorization"],["authorize","authorization"],["audio","audio side-effect"],["can","access policy"],["capabilities","capability boundary"],["capability","capability boundary"],["boundary","boundary"],["begin","lifecycle"],["bridge","bridge"],["bridges","bridge"],["cache","state cache"],["chase","gameplay action"],["command","command boundary"],["context","context policy"],["cooldown","temporal state"],["cooldowns","temporal state"],["controller","controller"],["controllers","controller"],["diagnostic","diagnostics"],["diagnostics","diagnostics"],["effect","side-effect boundary"],["effects","side-effect boundary"],["energy","gameplay calculation"],["expired","temporal state"],["facade","facade"],["facades","facade"],["fire","gameplay action"],["gateway","gateway"],["gateways","gateway"],["guard","guard"],["guards","guard"],["haptic","haptic side-effect"],["haptics","haptic side-effect"],["head","sequence boundary"],["history","state history"],["input","input boundary"],["jump","gameplay action"],["keyboard","input boundary"],["log","side-effect boundary"],["logger","side-effect boundary"],["lock","coordination boundary"],["middleware","middleware"],["multiplier","gameplay calculation"],["mute","audio side-effect"],["normalize","normalization"],["normalise","normalization"],["normalizer","normalization"],["oscillate","animation calculation"],["oscillation","animation calculation"],["overlap","collision predicate"],["performance","diagnostics"],["permission","access policy"],["permissions","access policy"],["policy","policy"],["pool","state pool"],["pooled","state pool"],["pools","state pool"],["predict","prediction"],["presenter","presenter"],["presenters","presenter"],["projectile","gameplay entity"],["provider","provider boundary"],["providers","provider boundary"],["public","public surface"],["quality","settings/application"],["rate","calculation"],["register","registry"],["registry","registry"],["relay","relay"],["relays","relay"],["reseed","state lifecycle"],["reset","state lifecycle"],["respond","response boundary"],["response","response boundary"],["resolve","resolution"],["resolver","resolution"],["route","route boundary"],["routes","route boundary"],["run","lifecycle"],["sample","diagnostics"],["score","gameplay calculation"],["scope","scope policy"],["scroll","position state"],["scrolled","position state"],["seed","state lifecycle"],["seeded","state lifecycle"],["segment","segment boundary"],["segments","segment boundary"],["setting","settings/application"],["settings","settings/application"],["spawn","gameplay lifecycle"],["spawning","gameplay lifecycle"],["speed","gameplay calculation"],["surface","public surface"],["tail","sequence boundary"],["tick","temporal state"],["transaction","transaction"],["transactional","transaction"],["transform","transformation"],["transformer","transformation"],["translate","translation"],["translator","translation"],["try","fallible action"],["validate","validation"],["validation","validation"],["validator","validation"],["visual","diagnostics"],["window","settings/application"],["socket","transport boundary"],["websocket","transport boundary"]]),g=new Set(["can","has","is","should"]),m=new Set(["access","api","auth","collision","expired","input","keyboard","overlap","permission","permissions","policy","projectile","response","route","routes","scope"]);export{h as a};
|
|
2
|
+
//# sourceMappingURL=chunk-QARYU7R3.js.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import{b as oe,f as ie,g as A,h as N,i as x,o as me,p as de}from"./chunk-WFGOH2UI.js";import{a as ae,b as se,d as le,e as re,f as ce}from"./chunk-C4ICAIJ4.js";import{a as q}from"./chunk-XEMQUN3Z.js";import{d as ue,e as fe}from"./chunk-MTDBHTSF.js";import{f as ee,g as v,l as ne,m as te}from"./chunk-R3JY4EZ4.js";import{e as E,g as X}from"./chunk-HXXMPYEF.js";import{i as w,k as Y,m as Z}from"./chunk-T2FQ4GHD.js";import{x as I}from"./chunk-ISLWJ4PY.js";import{a as J,b as P,d as W,f as V,k as z,l as L,p as T}from"./chunk-WS3Z6W3M.js";import{c as U}from"./chunk-GNG622H3.js";import{a as Q}from"./chunk-64MNV6AB.js";import{c as K,d as B}from"./chunk-7S5E7KWT.js";function un(e,n,t={}){let o=ye(e,[n],{additive:t.additive,semantic:t.semantic}),i=t.callableOnly?(o.get(n.symbolId)??[]).filter(a=>X(a.symbol)||a.source==="ast-callsite"):o.get(n.symbolId)??[];return typeof t.limit=="number"?i.slice(0,t.limit):i}function be(e,n,t={}){let o=Re(e)?Ie(e,n,{semantic:t.semantic!==!1}):_e(e).get(n.symbolId)??[];return typeof t.limit=="number"?o.slice(0,t.limit):o}var Ce=B("caller-rows",{clearGroups:["whole-project"]}),Me=2e4;function Re(e){return(e.get("SELECT COUNT(*) AS count FROM global_symbols")?.count??0)>Me}function _e(e){return Ce.get(e,()=>{let n=v(e),t=ye(e,n),o=new Map;for(let s of n)o.set(s.symbol,s.symbolId);let i=new Map,a=new Map;for(let s of n){let l=t.get(s.symbolId);if(!(!l||l.length===0))for(let c of l){let m=o.get(c.symbol);if(m===void 0||m===s.symbolId)continue;let d=i.get(m);d||(d=[],i.set(m,d),a.set(m,new Set));let f=`${s.symbol}|${s.relativePath}`;a.get(m).has(f)||(a.get(m).add(f),d.push({symbol:s.symbol,file:s.relativePath,source:"caller-map-inversion"}))}}return i})}function Ie(e,n,t){let o=[],i=new Set,a=l=>{if(l.symbol===n.symbol)return;let c=`${l.symbol}|${l.file}`;i.has(c)||(i.add(c),o.push(l))};for(let l of de(e,n))l.file!==n.relativePath&&a({symbol:l.enclosingSymbol??l.file,file:l.file,source:"resolved-reference"});let s=t.semantic?Le(e,n):null;if(s)for(let l of le(e,s)){if(l.file===n.relativePath||e.isIgnored(l.file))continue;let c=te(ee(e,l.file),l.line);a({symbol:c?.symbol??l.file,file:l.file,source:"semantic-reference"})}return o}function Le(e,n){let t=ue().join(", "),o=fe().join(", ");return e.get(`SELECT
|
|
2
|
+
d.id AS documentId,
|
|
3
|
+
gs.id AS symbolId,
|
|
4
|
+
gs.symbol,
|
|
5
|
+
d.relative_path AS relativePath,
|
|
6
|
+
COALESCE(der.start_line, c.start_line) AS startLine,
|
|
7
|
+
COALESCE(der.end_line, c.end_line) AS endLine,
|
|
8
|
+
COALESCE(gs.display_name, '') AS leaf,
|
|
9
|
+
NULL AS parentTypeName,
|
|
10
|
+
CASE WHEN gs.kind IN (${t}) OR gs.symbol LIKE '%().' THEN 1 ELSE 0 END AS isFunctionLike,
|
|
11
|
+
CASE WHEN gs.kind IN (${o}) THEN 1 ELSE 0 END AS isTypeLike,
|
|
12
|
+
gs.kind AS kind,
|
|
13
|
+
gs.documentation AS documentation,
|
|
14
|
+
gs.enclosing_symbol AS enclosingSymbol
|
|
15
|
+
FROM global_symbols gs
|
|
16
|
+
LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
|
|
17
|
+
LEFT JOIN chunks c ON c.document_id = der.document_id
|
|
18
|
+
JOIN documents d ON d.id = COALESCE(der.document_id, c.document_id)
|
|
19
|
+
WHERE gs.id = ?
|
|
20
|
+
LIMIT 1`,n.symbolId)??null}function ye(e,n,t={}){if(n.length===0)return new Map;let o=t.additive??!1,i=[],a=[];for(let d of n)I(d.relativePath)&&w(e,d.relativePath)!==null?i.push(d):a.push(d);let s=new Map,l=new Map,c=d=>{for(let[f,R]of d){let r=s.get(f);r||(r=[],s.set(f,r));let u=l.get(f);u||(u=new Set,l.set(f,u));for(let b of R){let g=`${b.symbol}|${b.chunkId}`;u.has(g)||(u.add(g),r.push(b))}}};i.length>0&&c(ve(e,i)),t.semantic!==!1&&c(Pe(we(e,n)));let m=o?n:a;return m.length>0&&c(Fe(e,m)),s}function we(e,n){let t=z(),o=new Map,i=[],a=[],s=0,l=0,c=0,m=0;if(L("semantic.callees.cache-scan",()=>{for(let u of n){if(!ae(u.relativePath)){t&&(s+=1);continue}let b=T(e,u.relativePath);if(!b){t&&(l+=1),a.push(u);continue}let g=P(e,u.relativePath,b),D=Ee(e,u.relativePath),M=W(e,u.relativePath,u.symbol,g,D);if(M!==null){let S=De(M);if(S){t&&(c+=1),S.length>0&&o.set(u.symbolId,S);continue}t&&(m+=1)}i.push({def:u,contentHash:g,depsDigest:D})}},()=>({definitions:n.length,skippedNonTs:s,sourceMissing:l,cacheHits:c,parseFailures:m,misses:i.length,unkeyed:a.length,resultRows:o.size})),i.length===0&&a.length===0)return o;let d=[...a,...i.map(u=>u.def)],f=0,R=L("semantic.callees.compute-misses",()=>{let u=ce(e,d);return f=u.size,u},()=>({definitions:d.length,misses:i.length,unkeyed:a.length,rows:f}));for(let[u,b]of R)o.set(u,b);if(se(e).capability("semantic-callees").available){let u=i.map(b=>({relativePath:b.def.relativePath,symbol:b.def.symbol,contentHash:b.contentHash,depsDigest:b.depsDigest,payload:JSON.stringify(R.get(b.def.symbolId)??[])}));L("semantic.callees.cache-write",()=>V(e,u),()=>({entries:u.length}))}else L("semantic.callees.cache-write-skip",()=>{},()=>({reason:"provider-unavailable",misses:i.length}));return o}function De(e){try{return JSON.parse(e)}catch{return null}}var ke=K("semantic-deps-digest",{clearGroups:["whole-project","source-file"]});function Ee(e,n){return ke.get(e,n,()=>{let o=[...q(e).get(n)??[]].sort().map(i=>`${i}:${P(e,i,T(e,i))}`);return J(o.join("|"))})}function ve(e,n){let t=new Map,o=Ae(n,t),i=x(e);for(let[a,s]of o){let l=w(e,a);if(!l)continue;let c=ne(s);for(let m of l){let d=c.get(m.line);if(!d)continue;let f=Ne(e,a,i,m);f&&f.symbol!==d.symbol&&t.get(d.symbolId).push({symbol:f.symbol,file:f.file,chunkId:m.line,source:"ast-callsite"})}}return t}function Ae(e,n){let t=new Map;for(let o of e){let i=t.get(o.relativePath);i?i.push(o):t.set(o.relativePath,[o]),n.set(o.symbolId,[])}for(let o of t.values())o.sort((i,a)=>i.endLine-i.startLine-(a.endLine-a.startLine));return t}function Ne(e,n,t,o){let i=A(n,t.get(o.calleeLeaf)??[]);if(i.length===0)return null;let a=xe(e,n,i,o.calleeQualifier);return a||N(e,n,i,o.memberAccess)}function xe(e,n,t,o){if(!o||I(n)!=="clojure")return null;let a=Z(e,n).filter(s=>s.kind==="namespace"&&s.localName===o&&s.sourcePath).map(s=>s.sourcePath);for(let s of a){let l=t.find(c=>U(s,c.file));if(l)return l}return t.find(s=>/`([^`]+)`\//.exec(s.symbol)?.[1]===o)??null}function Fe(e,n){if(n.length===0)return new Map;let o=j(n.map(r=>r.documentId)).flatMap(r=>e.all(`SELECT c.document_id, c.id AS chunk_id, c.start_line, c.end_line, m.symbol_id
|
|
21
|
+
FROM mentions m
|
|
22
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
23
|
+
WHERE m.role != 1
|
|
24
|
+
AND c.document_id IN (${r.map(()=>"?").join(",")})`,...r)),i=new Map;for(let r of o)i.has(r.document_id)||i.set(r.document_id,[]),i.get(r.document_id).push(r);let s=j(o.map(r=>r.symbol_id)).flatMap(r=>e.all(`SELECT gs.id AS symbol_id, gs.symbol,
|
|
25
|
+
COALESCE(der.document_id, def_chunk.document_id) AS document_id
|
|
26
|
+
FROM global_symbols gs
|
|
27
|
+
LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
|
|
28
|
+
LEFT JOIN (
|
|
29
|
+
SELECT m.symbol_id, MIN(c.document_id) AS document_id
|
|
30
|
+
FROM mentions m
|
|
31
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
32
|
+
WHERE m.role = 1
|
|
33
|
+
AND m.symbol_id IN (${r.map(()=>"?").join(",")})
|
|
34
|
+
GROUP BY m.symbol_id
|
|
35
|
+
) def_chunk ON def_chunk.symbol_id = gs.id
|
|
36
|
+
WHERE gs.id IN (${r.map(()=>"?").join(",")})`,...r,...r)),l=j([...n.map(r=>r.documentId),...s.flatMap(r=>r.document_id===null?[]:[r.document_id])]),c=new Map(l.flatMap(r=>e.all(`SELECT id, relative_path FROM documents
|
|
37
|
+
WHERE id IN (${r.map(()=>"?").join(",")})`,...r).map(u=>[u.id,u.relative_path]))),m=new Map;for(let r of s)m.has(r.symbol_id)||m.set(r.symbol_id,{symbol:r.symbol,file:r.document_id!==null?c.get(r.document_id)??"":""});let d=new Map,f=c,R=Oe(n);for(let[r,u]of R){let g=[...i.get(r)??[]].sort((p,h)=>p.start_line-h.start_line||p.end_line-h.end_line),D=[...u].sort((p,h)=>p.startLine-h.startLine||p.endLine-h.endLine),M=new Set,S=0;for(let p of D){for(;S<g.length&&g[S].start_line<=p.endLine;)M.add(g[S]),S+=1;for(let y of M)y.end_line<p.startLine&&M.delete(y);let h=new Set,$=[],F=null,Se=()=>{if(F)return F;let y=f.get(p.documentId)??"",C=new Set;if(y){let O=oe(e,y),k=Math.max(0,p.startLine),G=Math.min(O.length-1,p.endLine);for(let _=k;_<=G;_+=1)for(let he of O[_])C.add(he)}return F=C,C};for(let y of M){if(y.symbol_id===p.symbolId)continue;let C=m.get(y.symbol_id);if(!C)continue;if(!(y.start_line>=p.startLine&&y.end_line<=p.endLine)){if(!(y.start_line<=p.endLine&&y.end_line>=p.startLine))continue;let _=E(C.symbol);if(!_||!Se().has(_))continue}let k=`${C.symbol}|${y.chunk_id}`;h.has(k)||(h.add(k),$.push({...C,chunkId:y.chunk_id,source:"scip-chunk"}))}d.set(p.symbolId,$)}}return d}var pe=500;function j(e){let n=[...new Set(e)],t=[];for(let o=0;o<n.length;o+=pe)t.push(n.slice(o,o+pe));return t}function Oe(e){let n=new Map;for(let t of e){let o=n.get(t.documentId);o?o.push(t):n.set(t.documentId,[t])}return n}function Pe(e){let n=new Map;for(let[t,o]of e){let i=[];for(let a of o)i.push({symbol:a.symbol,file:a.file,chunkId:-1,source:"semantic-callee"});n.set(t,i)}return n}function ge(e,n,t={}){let o=new Map;if(n&&n.length===0)return o;let i=Q(e,{includeIgnored:!1}),a=x(e),s=n??v(e),l=new Set(s.map(m=>m.symbolId)),c=Be(s);return Te(e,o,i,a,l,c),je(e,o,s,l),Ke(e,o,i,a,l,c),t.semantic!==!1&&We(o,re(e,Je(s))),o}function Te(e,n,t,o,i,a){for(let s of t){if(!I(s))continue;let l=w(e,s);if(l)for(let c of l){if(a&&!a.has(c.calleeLeaf))continue;let m=A(s,o.get(c.calleeLeaf)??[]);if(!m||m.length===0)continue;let d=N(e,s,m,c.memberAccess);d&&i.has(d.symbolId)&&d.file!==s&&H(n,d.symbolId,s)}}}function je(e,n,t,o){let i=$e(t);for(let a of He(e,o))e.isIgnored(a.relative_path)||Ge(a,i.get(a.symbol_id))||H(n,a.symbol_id,a.relative_path)}function He(e,n){return ie(e,n?[...n]:void 0)}function $e(e){let n=new Map;for(let t of e)n.set(t.symbolId,{docId:t.documentId,startLine:t.startLine,endLine:t.endLine});return n}function Ge(e,n){return!!n&&n.docId===e.document_id&&e.chunk_start>=n.startLine&&e.chunk_end<=n.endLine}function Ke(e,n,t,o,i,a){for(let s of t){if(I(s)!=="rust")continue;let l=Y(e,s,{includeRustAttributeNames:!0});if(l.length!==0)for(let{name:c}of l){if(a&&!a.has(c))continue;let m=o.get(c);if(m)for(let d of m)i.has(d.symbolId)&&d.file!==s&&H(n,d.symbolId,s)}}}function H(e,n,t){let o=e.get(n);o||(o=new Set,e.set(n,o)),o.add(t)}function Be(e){let n=new Set;for(let t of e){let o="leaf"in t&&typeof t.leaf=="string"?t.leaf:"symbol"in t&&typeof t.symbol=="string"?E(t.symbol):"";o&&n.add(o)}return n.size>0?n:null}function Je(e){return e.filter(n=>"relativePath"in n&&"symbol"in n&&"leaf"in n)}function We(e,n){for(let[t,o]of n){let i=e.get(t);i||(i=new Set,e.set(t,i));for(let a of o)i.add(a)}}function Ln(e,n,t={}){return be(e,n,t)}function Ve(e,n,t={}){return ge(e,n,t)}function Qe(e,n,t={}){return me(e,n,t)}function wn(e,n,t={}){let o=Ve(e,n,{semantic:t.semantic});return t.sourceFallback===!1?o:Ue(o,Qe(e,n))}function Ue(e,n){let t=new Map;for(let[o,i]of e)t.set(o,new Set(i));for(let[o,i]of n){let a=t.get(o)??new Set;for(let s of i)a.add(s);t.set(o,a)}return t}export{un as a,ye as b,Ln as c,Ve as d,Qe as e,wn as f,Ue as g};
|
|
38
|
+
//# sourceMappingURL=chunk-QJ3FK4TB.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as _}from"./chunk-XHWLNQVZ.js";import{c as f}from"./chunk-C4ICAIJ4.js";import{a as d}from"./chunk-WQHWIVA7.js";import{d as a,e as I,i as b}from"./chunk-HXXMPYEF.js";import{m as c}from"./chunk-T2FQ4GHD.js";import{x as h}from"./chunk-ISLWJ4PY.js";import{b as u}from"./chunk-GNG622H3.js";import{a as g}from"./chunk-64MNV6AB.js";function j(e,r,t={}){return N(e,r,t)?.map(o=>({symbol:o.symbol,shortName:o.shortName,fromFile:o.fromFile}))??[]}function B(e,r){let t=d(e,r),o=E(e,r);if(o.length>0&&!R(t))return o;let s=y(e,r,t);return p(r)&&s.length>0?s:O([...o,...s])}function W(e,r,t={}){return N(e,r,t)?.filter(o=>!o.used).map(o=>({symbol:o.symbol,shortName:o.shortName,importedIn:o.importer}))??[]}function E(e,r){return e.all(`SELECT DISTINCT gs.symbol, d.relative_path AS importer
|
|
2
2
|
FROM mentions m
|
|
3
3
|
JOIN chunks c ON m.chunk_id = c.id
|
|
4
4
|
JOIN documents d ON c.document_id = d.id
|
|
5
5
|
JOIN global_symbols gs ON m.symbol_id = gs.id
|
|
6
6
|
WHERE gs.symbol LIKE ?
|
|
7
7
|
AND m.role = 2
|
|
8
|
-
ORDER BY d.relative_path`,`%${r}%`).filter(o=>!e.isIgnored(o.importer)).map(o=>({symbol:o.symbol,shortName:a(o.symbol),fromFile:o.importer}))}function y(e,r,t=
|
|
8
|
+
ORDER BY d.relative_path`,`%${r}%`).filter(o=>!e.isIgnored(o.importer)).map(o=>({symbol:o.symbol,shortName:a(o.symbol),fromFile:o.importer}))}function y(e,r,t=d(e,r)){let o=t?.relativePath??null,s=t?I(t.symbol):r.replace(/\(\)$/,""),n=t?b(t.symbol):!1,i=new Set;for(let l of g(e,{includeIgnored:!1}))for(let F of c(e,l))k(F,l,{targetFile:o,targetLeaf:s,targetIsModule:n,targetPattern:r})&&i.add(l);let m=p(r)?r.trim():null;return[...i].sort().map(l=>({symbol:m??t?.symbol??s,shortName:m??(t?a(t.symbol):s),fromFile:l}))}function R(e){return!!(e&&(e.symbol.startsWith("scip-clojure ")||h(e.relativePath)==="clojure"))}function O(e){let r=new Set,t=[];for(let o of e){let s=`${o.symbol}|${o.fromFile}`;r.has(s)||(r.add(s),t.push(o))}return t.sort((o,s)=>o.fromFile.localeCompare(s.fromFile)||o.shortName.localeCompare(s.shortName))}function k(e,r,t){return!e.sourcePath||t.targetFile&&u(e.sourcePath)!==u(t.targetFile)?!1:e.kind==="side-effect"||t.targetFile&&M(r)||e.kind==="namespace"&&D(e,t.targetPattern)||t.targetIsModule||e.kind==="named"&&e.importedName===t.targetLeaf?!0:e.kind==="namespace"&&e.usedMembers.includes(t.targetLeaf)}function D(e,r){let t=r.trim().replace(/\(\)$/,"");return p(t)?e.importedName===t||e.localName===t:!1}function p(e){let r=e.trim().replace(/\(\)$/,"");return r.includes(".")&&!r.includes("/")&&!r.includes(":")}function N(e,r,t={}){let o=_(e,r);return o?x(e,o,t)??(t.semantic===!1?null:L(e,o))??T(e,o):null}function x(e,r,t){let s=e.all(`SELECT DISTINCT
|
|
9
9
|
gs.symbol,
|
|
10
10
|
def_d.relative_path AS from_file,
|
|
11
11
|
imp_d.relative_path AS importer,
|
|
@@ -31,5 +31,5 @@ import{a as b}from"./chunk-OFXN2BCT.js";import{c as d}from"./chunk-CYHIKTJN.js";
|
|
|
31
31
|
LEFT JOIN documents def_d ON sym_def.document_id = def_d.id
|
|
32
32
|
WHERE imp_d.relative_path = ?
|
|
33
33
|
AND m.role = 2
|
|
34
|
-
ORDER BY def_d.relative_path, gs.symbol`,r).filter(n=>!e.isIgnored(n.importer));if(s.length>0){let n=t.semantic===!1?[]:
|
|
35
|
-
//# sourceMappingURL=chunk-
|
|
34
|
+
ORDER BY def_d.relative_path, gs.symbol`,r).filter(n=>!e.isIgnored(n.importer));if(s.length>0){let n=t.semantic===!1?[]:f(e,r);return s.map(i=>({symbol:i.symbol,shortName:a(i.symbol),fromFile:i.from_file??"(external)",importer:i.importer,used:i.used!==0||n.some(m=>m.isUsed&&m.sourcePath===i.from_file)}))}return null}function L(e,r){let t=f(e,r);return t.length>0?t.map(o=>{let s=S(o.importedName,o.localName,o.kind);return{symbol:s,shortName:s,fromFile:o.sourcePath??"(external)",importer:r,used:o.kind==="side-effect"?!0:o.isUsed}}):null}function T(e,r){return c(e,r).map(t=>{let o=S(t.importedName,t.localName,t.kind),s=t.kind==="side-effect"?!0:t.used;return{symbol:o,shortName:o,fromFile:t.sourcePath??"(external)",importer:r,used:s}})}function S(e,r,t){return t==="namespace"&&e==="*"&&r?`* as ${r}`:t==="default"&&r?`default as ${r}`:t==="side-effect"?"(side effect import)":r&&r!==e?`${e} as ${r}`:e}function M(e){return/\.(?:c|h|cc|cpp|cxx|hpp|hh|hxx)$/i.test(e)}export{j as a,B as b,W as c};
|
|
35
|
+
//# sourceMappingURL=chunk-QXGTGE2C.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{readdirSync as p}from"fs";import{join as h}from"path";function m(n,c){let t=o(n),r=o(c);if(t.endsWith("/**")){let e=t.slice(0,-3);return r===e||r.startsWith(`${e}/`)}if(t.endsWith("/*")){let e=t.slice(0,-2);if(!r.startsWith(`${e}/`))return!1;let i=r.slice(e.length+1);return i.length>0&&!i.includes("/")}return t==="**"?!0:t==="*"?r.length>0&&!r.includes("/"):t===r}function d(n){return o(n).replace(/\/\*\*?$/,"")}function W(n,c){let t=o(c),r=d(t),e=t.endsWith("/**"),i=[],a=(f,u)=>{let g;try{g=p(f,{withFileTypes:!0})}catch{return}for(let s of g){if(s.name.startsWith("."))continue;let l=u?`${u}/${s.name}`:s.name;m(t,l)&&i.push(l),e&&s.isDirectory()&&a(h(f,s.name),l)}};return a(h(n,r),r),i.sort()}function o(n){return n.replace(/\\/g,"/").replace(/^\.\//,"").replace(/\/+$/,"")}export{m as a,W as b};
|
|
2
|
+
//# sourceMappingURL=chunk-QZ4JVECJ.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import{a as f,b as
|
|
1
|
+
import{a as f,b as F,c as m,d as N,e as E,f as p,h as M}from"./chunk-HXXMPYEF.js";import{h as R}from"./chunk-T2FQ4GHD.js";import{b,c as D,i as _,m as L,o as h}from"./chunk-WS3Z6W3M.js";import{a as S}from"./chunk-64MNV6AB.js";import{c as g}from"./chunk-7S5E7KWT.js";function be(e,n){return e.all(`SELECT gs.id, gs.symbol, der.document_id, der.start_line, der.end_line, d.relative_path, gs.display_name, gs.documentation
|
|
2
2
|
FROM global_symbols gs
|
|
3
3
|
JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
|
|
4
4
|
JOIN documents d ON der.document_id = d.id
|
|
5
5
|
WHERE ${n.where}
|
|
6
6
|
${e.pathExclusionsFor("d")}
|
|
7
|
-
${
|
|
8
|
-
${
|
|
7
|
+
${k(n.orderBy)}
|
|
8
|
+
${w(n.limit)}`,...n.params??[])}function De(e,n){return e.all(`SELECT
|
|
9
9
|
gs.id,
|
|
10
10
|
gs.symbol,
|
|
11
11
|
c.document_id,
|
|
@@ -22,8 +22,8 @@ import{a as f,b as R,c as m,d as F,e as N,f as p,h as E}from"./chunk-NABVR6B7.js
|
|
|
22
22
|
AND ${n.where}
|
|
23
23
|
${e.pathExclusionsFor("d")}
|
|
24
24
|
GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path, gs.display_name, gs.documentation
|
|
25
|
-
${
|
|
26
|
-
${
|
|
25
|
+
${k(n.orderBy)}
|
|
26
|
+
${w(n.limit)}`,...n.params??[])}function k(e){return e?`ORDER BY ${e}`:""}function w(e){return typeof e=="number"?`LIMIT ${e}`:""}function $(e){return!e||!e.trim()?null:e.replace(/^```\w*\s*/,"").replace(/\s*```$/,"").replace(/^\(method\)\s*/,"").replace(/^\(property\)\s*/,"").replace(/^\(function\)\s*/,"").replace(/^\(class\)\s*/,"").replace(/^\(interface\)\s*/,"").replace(/^\(enum\)\s*/,"").replace(/^\(type alias\)\s*/,"").replace(/^\(const\)\s*/,"").replace(/^\(var\)\s*/,"").trim()||null}function C(e){if(!e)return null;let n=O(e);if(n)return n.replace(/\n/g," ");let t=e.indexOf("|");if(t===-1)return e.replace(/\n/g," ");let i=e.slice(t+1);return(O(i)??i).replace(/\n/g," ")}function O(e){return/^```(?:\w+)?\s*\n?([\s\S]*?)\n?```/.exec(e.trimStart())?.[1]?.trim()||null}function H(e){if(m(e.symbol)!==null)return!1;let t=(e.documentation??"").replace(/^```\w*\s*/,"").replace(/\s*```$/,"").trim();return/^(?:var|let|const|function|class|interface|type|enum)\b/.test(t)}function x(e,n,t={}){let i=new Map;for(let o of n)e.length>0&&!H(o)||i.set(o.id,o);for(let o of e)i.set(o.id,o);let r=[...i.values()];return t.sort?r.sort((o,s)=>o.start_line-s.start_line||o.end_line-s.end_line||o.symbol.localeCompare(s.symbol)):r}var W=g("file-definitions",{clearGroups:["definition-catalog"]}),Y=g("file-function-like-definitions",{clearGroups:["definition-catalog"]}),T=new WeakMap;function I(e,n){return W.get(e,n,()=>{let t=v(e,n);if(t)return t;let i=B(e,n),r=D(e),o=f(e).forFile(n,{text:!0}).text;return r&&o&&P.write(e,n,b(e,n,o),{projectFingerprint:r,definitions:i.map(s=>({...s}))}),i})}function K(e,n){return Y.get(e,n,()=>{let t=v(e,n);return t?t.filter(i=>i.isFunctionLike):B(e,n,i=>i.isFunctionLike)})}var P=L({kind:"file-definitions",invalidation:h("file-definitions"),serialize:G,deserialize:U});function v(e,n){let t=D(e);if(!t)return null;let i=f(e).forFile(n,{text:!0}).text;if(!i)return null;let r=P.read(e,n,b(e,n,i));return r?q(r,t,n):null}function G(e){return JSON.stringify(e)}function U(e){try{let n=JSON.parse(e);return!_(n)||typeof n.projectFingerprint!="string"||!Array.isArray(n.definitions)?null:{projectFingerprint:n.projectFingerprint,definitions:n.definitions}}catch{return null}}function q(e,n,t){if(e.projectFingerprint!==n)return null;let i=[];for(let r of e.definitions){let o=X(r,t);if(!o)return null;i.push(o)}return i}function X(e,n){return!_(e)||typeof e.symbolId!="number"||typeof e.symbol!="string"||typeof e.documentId!="number"||typeof e.startLine!="number"||typeof e.endLine!="number"||e.relativePath!==n||typeof e.leaf!="string"||typeof e.parentTypeName!="string"&&e.parentTypeName!==null||typeof e.isFunctionLike!="boolean"||typeof e.isTypeLike!="boolean"||typeof e.kind!="number"&&e.kind!==null||typeof e.documentation!="string"&&e.documentation!==null||typeof e.enclosingSymbol!="string"&&e.enclosingSymbol!==null?null:{symbolId:e.symbolId,symbol:e.symbol,documentId:e.documentId,startLine:e.startLine,endLine:e.endLine,relativePath:e.relativePath,leaf:e.leaf,parentTypeName:e.parentTypeName,isFunctionLike:e.isFunctionLike,isTypeLike:e.isTypeLike,kind:e.kind,documentation:e.documentation,enclosingSymbol:e.enclosingSymbol}}function B(e,n,t){let i=x(Z(e,n),V(e,n),{sort:!0}).map(J);return t&&(i=i.filter(t)),j(e,n,i)}function Z(e,n){return e.all(`SELECT
|
|
27
27
|
gs.id,
|
|
28
28
|
gs.symbol,
|
|
29
29
|
der.document_id,
|
|
@@ -39,7 +39,7 @@ import{a as f,b as R,c as m,d as F,e as N,f as p,h as E}from"./chunk-NABVR6B7.js
|
|
|
39
39
|
JOIN documents d ON der.document_id = d.id
|
|
40
40
|
WHERE d.relative_path = ?
|
|
41
41
|
${e.symbolNoiseFor("gs")}
|
|
42
|
-
ORDER BY der.start_line, der.end_line`,n)}function
|
|
42
|
+
ORDER BY der.start_line, der.end_line`,n)}function V(e,n){return e.all(`SELECT
|
|
43
43
|
gs.id,
|
|
44
44
|
gs.symbol,
|
|
45
45
|
c.document_id,
|
|
@@ -58,7 +58,7 @@ import{a as f,b as R,c as m,d as F,e as N,f as p,h as E}from"./chunk-NABVR6B7.js
|
|
|
58
58
|
AND m.role = 1
|
|
59
59
|
${e.symbolNoiseFor("gs")}
|
|
60
60
|
GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path
|
|
61
|
-
ORDER BY start_line, end_line`,n)}function J(e){return{symbolId:e.id,symbol:e.symbol,documentId:e.document_id,startLine:e.start_line,endLine:e.end_line,relativePath:e.relative_path,leaf:
|
|
61
|
+
ORDER BY start_line, end_line`,n)}function J(e){return{symbolId:e.id,symbol:e.symbol,documentId:e.document_id,startLine:e.start_line,endLine:e.end_line,relativePath:e.relative_path,leaf:E(e.symbol),parentTypeName:m(e.symbol),isFunctionLike:M(e.symbol),isTypeLike:p(e.symbol)==="type",kind:e.kind??null,documentation:e.documentation??null,enclosingSymbol:e.enclosing_symbol??null}}function we(e,n={}){return ee(e,n.scope)}function ee(e,n){return S(e,{scope:n,includeIgnored:!1}).flatMap(t=>I(e,t)).filter(t=>!e.isIgnored(t.relativePath))}function $e(e,n){return S(e,{scope:n,includeIgnored:!1}).flatMap(t=>K(e,t)).filter(t=>!e.isIgnored(t.relativePath))}function Ce(e,n){let t=A(ne(e,n.scope,n.sqlPrefilter)),i=A(te(e,n.scope,n.sqlPrefilter)),r=new Set([...t.keys(),...i.keys()]),o=[];for(let s of[...r].sort()){if(e.isIgnored(s))continue;let l=x(t.get(s)??[],i.get(s)??[],{sort:!0}).filter(a=>n.symbolMatches(a.symbol));l.length!==0&&o.push(...j(e,s,l.map(J)))}return o}function ne(e,n,t){let i=n?"AND d.relative_path LIKE ?":"",r=t?`AND ${z("gs",t)}`:"",o=n?[`%${n}%`]:[];return e.all(`SELECT
|
|
62
62
|
gs.id,
|
|
63
63
|
gs.symbol,
|
|
64
64
|
der.document_id,
|
|
@@ -77,7 +77,7 @@ import{a as f,b as R,c as m,d as F,e as N,f as p,h as E}from"./chunk-NABVR6B7.js
|
|
|
77
77
|
${i}
|
|
78
78
|
${r}
|
|
79
79
|
${e.symbolNoiseFor("gs")}
|
|
80
|
-
ORDER BY d.relative_path, der.start_line, der.end_line`,...o)}function
|
|
80
|
+
ORDER BY d.relative_path, der.start_line, der.end_line`,...o)}function te(e,n,t){let i=n?"AND d.relative_path LIKE ?":"",r=t?`AND ${z("gs",t)}`:"",o=n?[`%${n}%`]:[];return e.all(`SELECT
|
|
81
81
|
gs.id,
|
|
82
82
|
gs.symbol,
|
|
83
83
|
c.document_id,
|
|
@@ -98,5 +98,5 @@ import{a as f,b as R,c as m,d as F,e as N,f as p,h as E}from"./chunk-NABVR6B7.js
|
|
|
98
98
|
${r}
|
|
99
99
|
${e.symbolNoiseFor("gs")}
|
|
100
100
|
GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path
|
|
101
|
-
ORDER BY d.relative_path, start_line, end_line`,...o)}function
|
|
102
|
-
//# sourceMappingURL=chunk-
|
|
101
|
+
ORDER BY d.relative_path, start_line, end_line`,...o)}function ie(e){return`(${e}.symbol LIKE '%().' OR ${e}.symbol LIKE '%()')`}function z(e,n){return n==="callable"?ie(e):re(e)}function re(e){return`(${e}.symbol LIKE '%.' OR ${e}.symbol LIKE '%()')`}function A(e){let n=new Map;for(let t of e){let i=n.get(t.relative_path);i?i.push(t):n.set(t.relative_path,[t])}return n}function Te(e,n,t={}){if(n.length===0)return[];let i=n.flatMap(r=>I(e,r)).filter(r=>!e.isIgnored(r.relativePath));return t.onlyDocumented&&(i=i.filter(r=>r.documentation!==null&&r.documentation!=="")),t.sort&&(i=i.sort((r,o)=>r.relativePath.localeCompare(o.relativePath)||r.startLine-o.startLine||r.endLine-o.endLine)),i.map(r=>({startLine:r.startLine,endLine:r.endLine,symbol:r.symbol,shortName:N(r.symbol),signature:$(C(r.documentation)),relativePath:r.relativePath,enclosingSymbol:r.enclosingSymbol}))}function oe(e){let n=new Map,t=e.map((i,r)=>({definition:i,index:r,span:i.endLine-i.startLine})).sort((i,r)=>i.span-r.span||i.index-r.index);for(let{definition:i}of t)for(let r=i.startLine;r<=i.endLine;r+=1)n.has(r)||n.set(r,i);return n}function Ae(e,n){let t=T.get(e);return t||(t=oe(e),T.set(e,t)),t.get(n)??null}function Qe(e,n){let t=I(e,n.relative_path).find(i=>i.symbolId===n.id);return t?{symbolId:t.symbolId,symbol:t.symbol,documentId:t.documentId,startLine:t.startLine,endLine:t.endLine,relativePath:t.relativePath}:{symbolId:n.id,symbol:n.symbol,documentId:n.document_id,startLine:n.start_line,endLine:n.end_line,relativePath:n.relative_path}}function j(e,n,t){let i=f(e).forFile(n,{text:!0}).text,r=R(e,n);return r?me(t,r,i):i?se(t,i):t}function se(e,n){let t=n.split(/\r?\n/),i=le(e,t),r=ae(e,i),o=ce(r,t);return de(e,o)}function le(e,n){let t=e.some(r=>y(r.symbol))?pe(n):null,i=new Map;for(let r of e)i.set(r.symbolId,fe(n,t,r));return i}function ae(e,n){return e.filter(t=>y(t.symbol)).map(t=>({definition:t,startLine:n.get(t.symbolId)??t.startLine})).sort((t,i)=>t.startLine-i.startLine||t.definition.startLine-i.definition.startLine||t.definition.symbol.localeCompare(i.definition.symbol))}function ce(e,n){let t=new Map;for(let i=0;i<e.length;i+=1){let r=e[i],o=e[i+1],s=o?Math.max(r.startLine,o.startLine-1):n.length-1;t.set(r.definition.symbolId,{startLine:r.startLine,endLine:ye(n,r.definition,r.startLine,s)})}return t}function de(e,n){return e.map(t=>{let i=n.get(t.symbolId);return i?{...t,startLine:i.startLine,endLine:i.endLine}:t})}function me(e,n,t=null){let i=new Map;for(let r of n){let o=i.get(r.name);o?o.push(r):i.set(r.name,[r])}return e.map(r=>{if(!ue(r)||!r.leaf)return Q(r,t);let o=i.get(r.leaf);if(!o||o.length===0)return Q(r,t);let s=o[0],l=Math.abs(s.startLine-r.startLine);for(let a=1;a<o.length;a+=1){let c=o[a],d=Math.abs(c.startLine-r.startLine);d<l&&(s=c,l=d)}return{...r,startLine:s.startLine,endLine:s.endLine}})}function ue(e){return y(e.symbol)?!0:p(e.symbol)==="term"&&m(e.symbol)===null}function Q(e,n){if(!n||!e.leaf||p(e.symbol)!=="term"||m(e.symbol)!==null)return e;let t=e.leaf.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=new RegExp(`\\b(?:export\\s+)?(?:const|let|var)\\s+${t}\\b`),o=n.split(/\r?\n/).findIndex(s=>i.test(s));return o>=0?{...e,startLine:o,endLine:o}:e}function fe(e,n,t){if(!y(t.symbol))return t.startLine;let i=Math.max(0,Math.min(t.startLine,e.length-1));if(!n)return i;let r=n.get(t.leaf);if(!r||r.length===0)return i;let o=null;for(let s of r){let l=Math.abs(s-t.startLine);(!o||l<o.distance)&&(o={line:s,distance:l})}return o?.line??i}function pe(e){let n=/\b(?:function|def|fn)\s+([A-Za-z_$][\w$]*)/g,t=/\b([A-Za-z_$][\w$]*)\s*[:=]\s*(?:async\s*)?(?:function\b|\()/g,i=/^\s*(?:(?:export|public|private|protected|static|readonly|async|abstract|get|set)\s+)*([A-Za-z_$][\w$]*)\s*(?:<[^(]*>)?\s*\(/,r=/\b([A-Za-z_$][\w$]*)\s*\(/g,o=new Map,s=(l,a)=>{let c=o.get(l);if(!c){o.set(l,[a]);return}c[c.length-1]!==a&&c.push(a)};for(let l=0;l<e.length;l+=1){let a=e[l]??"";for(let d of a.matchAll(n))d[1]&&s(d[1],l);for(let d of a.matchAll(t))d[1]&&s(d[1],l);let c=a.match(i);c?.[1]&&s(c[1],l);for(let d of a.matchAll(r))d[1]&&s(d[1],l)}return o}function ye(e,n,t,i){let r=Math.max(t,Math.min(e.length-1,i)),o=Math.max(t,Math.min(r,n.endLine)),s=0,l=0,a=!1;for(let c=t;c<=r;c+=1){let d=ge(e[c]??"");for(let u of d)u==="{"?(s+=1,a=!0):u==="}"?s=Math.max(0,s-1):u==="("?l+=1:u===")"&&(l=Math.max(0,l-1));if(a&&s===0||!a&&l===0&&c>=o)return c}return o}function ge(e){let n="",t=null,i=!1;for(let r=0;r<e.length;r+=1){let o=e[r],s=e[r+1];if(!t&&o==="/"&&s==="/"){n+=" ".repeat(e.length-r);break}if(t){if(i){i=!1,n+=" ";continue}if(o==="\\"){i=!0,n+=" ";continue}o===t&&(t=null),n+=" ";continue}if(o==='"'||o==="'"||o==="`"){t=o,n+=" ";continue}n+=o}return n}function y(e){return e.includes("().")}function Pe(e){let n=F(e);if("kind"in n)return[];let t=[];for(let i=n.descriptors.length-2;i>=0;i-=1){let r=n.descriptors[i];r?.suffix==="type"&&r.name&&t.push(r.name)}return t}export{be as a,De as b,$ as c,C as d,x as e,I as f,we as g,ee as h,$e as i,Ce as j,Te as k,oe as l,Ae as m,Qe as n,Pe as o};
|
|
102
|
+
//# sourceMappingURL=chunk-R3JY4EZ4.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{p,r as u}from"./chunk-WS3Z6W3M.js";import{g as c}from"./chunk-GNG622H3.js";import{d as a}from"./chunk-7S5E7KWT.js";var l=a("suppression-inventory",{clearGroups:["whole-project"]});function b(e){return l.get(e,()=>f(e))}function f(e){let r={dead:0,stale:0,wrapper:0,passthrough:0,drift:0,extract:0,similar:0,uncategorized:0},t=new Map,s=0;for(let o of c(e)){let n=p(e,o);if(!(!n||!n.includes("scip-query")))for(let g of n.split(/\r?\n/)){let i=u(g);if(i===null)continue;s+=1,t.set(o,(t.get(o)??0)+1);let y=d(i);r[y]+=1}}return{total:s,byCategory:r,byFile:t}}function d(e){if(!e)return"uncategorized";let r=e.toLowerCase();return r==="dead-code"?"dead":r}export{b as a};
|
|
2
|
+
//# sourceMappingURL=chunk-R5336VHZ.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as F,b as A}from"./chunk-VGMUFW3J.js";import{a as C}from"./chunk-X4O6K47U.js";import{a as k}from"./chunk-WQHWIVA7.js";import{d as S}from"./chunk-HXXMPYEF.js";import{a as y}from"./chunk-GNG622H3.js";import{a as p}from"./chunk-64MNV6AB.js";import{posix as h}from"path";var _=20,G=1,O=new Map([["app","app"],["apps","app"],["component","component"],["components","component"],["composable","composable"],["composables","composable"],["contract","contract"],["contracts","contract"],["domain","domain"],["domains","domain"],["feature","feature"],["features","feature"],["hook","hook"],["hooks","hook"],["lib","library"],["module","module"],["modules","module"],["package","package"],["packages","package"],["page","page"],["pages","page"],["route","route"],["routes","route"],["screen","screen"],["screens","screen"],["service","service"],["services","service"],["shared","shared"],["src","source-root"],["store","state"],["stores","state"],["test","test"],["tests","test"],["util","utility"],["utils","utility"],["view","view"],["views","view"]]),q=new Set(["components","contracts","hooks","lib","services","shared","stores","utils"]),Y=new Set(["access","api","auth","config","db","effect","errors","hooks","lib","middleware","permissions","routes","schemas","servicetasks","services","startup","store","stores","test-utils","repository","repositories","tests","types","ui","utils","workflow","workflows"]);function Ce(e,n={}){let t=L(n.limit,_),i=L(n.minConsumers,G),r=new C(e),s=r.fileDependencyGraph(n.scope),o=ge(p(e,{includeIgnored:!1})),a=pe(e.config.locality?.architecturalBoundarySegments,n.architecturalBoundarySegments);return(n.target?K(e,r,n.target):J(e,n.scope,n.scanLimit)).map(c=>Q(e,r,s,c,n,o,a)).filter(c=>c.consumerFiles.length>=i||n.target).sort(me).slice(0,t)}function K(e,n,t){let i=Z(e,t);if(i)return[I(i)];let r=k(e,t);if(!r)return[];let s=n.definitionsForFile(r.relativePath).find(o=>o.symbolId===r.symbolId);return s?[ee(s)]:[{unit:{kind:"symbol",file:r.relativePath,shortName:S(r.symbol),symbol:r.symbol,startLine:r.startLine,endLine:r.endLine}}]}function J(e,n,t){let i=p(e,{scope:n,includeIgnored:!1}),r=L(t,i.length);return i.slice(0,r).map(s=>I(s))}function Q(e,n,t,i,r,s,o){let a=i.definition?V(e,n,i.definition,r.semantic):X(t,i.unit.file),d=i.definition?a.length>0?"exact":"none":a.length>0?"file-level":"none",f=i.unit.file,c=l(h.dirname(f)),u=te(a),B=ne(c),W=w([...T(c),...u?T(u):[]]),b=ie(i.unit,c,u,a),g=re(b,i.unit,c,u,a,s,o),j=le(i.unit,d,u,a,c,g.whyNoSuggestedHome),z=ue(i.unit,c,u,a,g.suggestedHome,g.whyNoSuggestedHome);return{actionTier:"signal",sourceUnit:i.unit,candidatePath:f,currentDirectory:c,directoryAncestry:B,consumerFiles:a,consumerCoverage:d,nearestCommonOwner:u,boundaryMarkers:W,recommendedTier:b,suggestedHome:g.suggestedHome,destinationConfidence:g.confidence,whyNoSuggestedHome:g.whyNoSuggestedHome,counterevidence:j,reasons:z,recommendation:de(b,g.suggestedHome,d)}}function V(e,n,t,i){let r=A(F(e,n).forDefinitions([t],{semantic:i!==!1,sourceFallback:!0}));return E(r.get(t.symbolId)??[])}function X(e,n){let t=[];for(let[i,r]of e.entries())i!==n&&r.has(n)&&t.push(i);return E(t)}function Z(e,n){let t=y(n),i=p(e,{includeIgnored:!1}),r=i.find(o=>o===t);if(r)return r;let s=i.find(o=>o.endsWith(`/${t}`));return s||(i.find(o=>o.includes(t))??null)}function ee(e){return{definition:e,unit:{kind:"symbol",file:e.relativePath,shortName:S(e.symbol),symbol:e.symbol,startLine:e.startLine,endLine:e.endLine}}}function I(e){return{unit:{kind:"file",file:e,shortName:h.basename(e)}}}function ne(e){if(e===".")return[{path:".",depth:0,markers:[]}];let n=[],t=e.split("/").filter(Boolean);for(let i=0;i<t.length;i+=1){let r=t.slice(0,i+1).join("/");n.push({path:r,depth:i,markers:D(r)})}return n}function T(e){return e==="."?[]:$(e).map(({marker:n,prefix:t})=>`${n}: ${t}`)}function D(e){return w($(e).map(({marker:n})=>n))}function $(e){let n=e.split("/").filter(Boolean),t=[];for(let i=0;i<n.length;i+=1){let r=O.get(n[i]);r&&t.push({marker:r,prefix:n.slice(0,i+1).join("/")})}return t}function te(e){if(e.length===0)return null;let n=e.map(i=>l(h.dirname(i))),t=n[0].split("/").filter(Boolean);for(let i of n.slice(1)){let r=i.split("/").filter(Boolean),s=[],o=Math.min(t.length,r.length);for(let a=0;a<o&&t[a]===r[a];a+=1)s.push(t[a]);t=s}return t.length===0?".":t.join("/")}function ie(e,n,t,i){return t?e.kind==="symbol"&&i.length===1?i[0]===e.file?"same-file":"sibling-folder":t==="."||t==="src"?"repository-level-review":U(t,"package")?"package-level-shared":U(t,"app")?"app-level-shared":N(t,["feature","domain","module"])||N(n,["feature","domain","module"])?"feature-local-shared":"sibling-folder":"no-exact-consumers"}function re(e,n,t,i,r,s,o){let a=oe(e,i);if(a)return m(a);let d=fe(n.file),f=se(e,t,d,r,o);if(f)return f;let c=i;if(l(t)===l(c))return m(`${t} is already the nearest common owner for its consumers.`);let u=ae(c,t,d,o);return u||ce(c,t,d,s,o)}function oe(e,n){return n?e==="no-exact-consumers"||e==="repository-level-review"?"The inferred owner is too broad or unsupported for an exact destination.":null:"No consumer owner could be inferred from the current index."}function se(e,n,t,i,r){if(e==="same-file"){let s=i[0]??null;return s?v(s):m("No same-file consumer path was available.")}if(e==="sibling-folder"&&i.length===1){let s=l(h.dirname(i[0])),o=H(n,t,s,r);return o?m(o):v(s)}return null}function ae(e,n,t,i){return be(e)?P(e,n,t,i,`Nearest shared owner ${e} is outside source root ${t}.`):null}function ce(e,n,t,i,r){if(e===".")return m("The nearest common owner is the repository root.");let s=`${e}/shared`,o=P(s,n,t,r,`Proposed home ${s} is outside source root ${t}.`);return o.confidence==="withheld"||i.has(s)?o:m(`${s} does not exist in the indexed project.`)}function P(e,n,t,i,r){if(!M(e,t))return m(r);let s=H(n,t,e,i);return s?m(s):v(e)}function v(e){return{suggestedHome:e,confidence:"exact",whyNoSuggestedHome:null}}function m(e){return{suggestedHome:null,confidence:"withheld",whyNoSuggestedHome:e}}function le(e,n,t,i,r,s){let o=["Report-only signal; review ownership before moving files."];return n==="none"&&o.push("No consumers were found in the current index."),n==="file-level"&&o.push("File-level import evidence can hide which exported unit is actually used."),(t==="."||t==="src")&&o.push("Nearest common owner is broad, so this is not enough evidence for automatic placement."),i.length===1&&o.push("Only one consumer was found; inlining or same-folder placement may be better than shared extraction."),e.kind==="file"&&o.push("File targets describe module locality, not symbol-level usage."),t&&r.startsWith(`${t}/`)&&o.push("Candidate already lives under the nearest common owner."),s&&o.push(`No exact suggested home: ${s}`),o}function ue(e,n,t,i,r,s){let o=[];return o.push(`${e.shortName} currently lives in ${n}.`),t?o.push(`${i.length} consumer file(s) share ${t} as their nearest common owner.`):o.push("No consumer owner could be inferred from the current index."),r?o.push(`Suggested home is ${r}.`):s&&o.push(`No exact suggested home: ${s}`),o}function de(e,n,t){return e==="no-exact-consumers"?"Review references before moving; no consumers were found.":e==="repository-level-review"?"Keep this as a broad locality signal; the inferred owner is too general for automatic relocation.":n?`Review whether ${t==="exact"?"symbol usage":"module import"} supports moving or extracting toward ${n}.`:"Review ownership manually before changing structure."}function me(e,n){return R(n)-R(e)||e.candidatePath.localeCompare(n.candidatePath)}function R(e){let n=e.consumerFiles.length*10;return e.consumerCoverage==="exact"&&(n+=5),e.suggestedHome&&(n+=3),e.recommendedTier==="repository-level-review"&&(n*=.1),e.recommendedTier==="no-exact-consumers"&&(n*=.05),n}function ge(e){let n=new Set(["."]);for(let t of e){let i=l(h.dirname(t));for(;!n.has(i)&&(n.add(i),i!==".");)i=l(h.dirname(i))}return n}function fe(e){let n=x(e),t=n.indexOf("src");return t>=0?n.slice(0,t+1).join("/"):n.length<=1?".":n[0]}function M(e,n){let t=l(e),i=l(n);return i==="."||t===i||t.startsWith(`${i}/`)}function he(e,n,t){let i=x(e),r=x(n);return(M(e,n)?i.slice(r.length):i).some(o=>t.has(o.toLowerCase()))}function H(e,n,t,i){return l(e)===l(t)||!he(e,n,i)?null:`${e} is a named architectural boundary; an exact move to ${t} needs human design.`}function pe(...e){let n=new Set(Y);for(let t of e)for(let i of t??[]){let r=ye(i);r&&n.add(r)}return n}function ye(e){let n=e.trim().toLowerCase();return n===""?null:n}function U(e,n){return D(e).includes(n)}function N(e,n){let t=D(e);return n.some(i=>t.includes(i))}function be(e){let n=e.split("/").filter(Boolean),t=n[n.length-1];return t?q.has(t):!1}function l(e){let n=y(e);return n===""?".":n}function x(e){let n=y(e);return n==="."?[]:n.split("/").filter(Boolean)}function L(e,n){return!Number.isFinite(e)||e===void 0||e<1?n:Math.floor(e)}function E(e){return w([...e]).sort((n,t)=>n.localeCompare(t))}function w(e){return[...new Set(e)]}export{Ce as a};
|
|
2
|
+
//# sourceMappingURL=chunk-RJMXSHKM.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{a as ie,b as N,e as V,f as j,g as E,h as te,i as re}from"./chunk-KMVGRIO2.js";import{b as _}from"./chunk-B75HZHUP.js";import{a as q}from"./chunk-X4O6K47U.js";import{a as ne}from"./chunk-QJ3FK4TB.js";import{a as D}from"./chunk-WQHWIVA7.js";import{d as I,e as K,h as $}from"./chunk-HXXMPYEF.js";import{a as B}from"./chunk-T2FQ4GHD.js";import{b as J,k as A,l as y,m as Q,o as ee,p as U,q as H}from"./chunk-WS3Z6W3M.js";import{a as Y}from"./chunk-64MNV6AB.js";import{d as z}from"./chunk-7S5E7KWT.js";function Ie(e,n,t={}){let{minSimilarity:i=.4,limit:r=20}=t,s=Ee(e,n,{semantic:t.semantic!==!1});if(!s)return[];if(!$(s.symbol))return[];if(s.callees.size===0)return se(e,n,{minSimilarity:i,limit:r,scanLimit:t.scanLimit,candidateMode:t.sourceCandidateMode??"full"});let a=we(e,s,i,{scanLimit:t.scanLimit,semantic:t.semantic!==!1});return a.length>0?a.slice(0,r):se(e,n,{minSimilarity:i,limit:r,scanLimit:t.scanLimit,candidateMode:t.sourceCandidateMode??"full"})}function vn(e,n,t,i={}){let r=D(e,n),s=D(e,t);if(!r||!s)return null;let a=Ie(e,r.symbol,{minSimilarity:0,limit:Number.POSITIVE_INFINITY,semantic:i.semantic,scanLimit:i.scanLimit}).find(m=>m.symbolB===s.symbol||m.symbolA===s.symbol);if(!a)return null;let l=r.endLine-r.startLine+1,c=s.endLine-s.startLine+1;return{symbolA:{symbol:r.symbol,shortName:I(r.symbol),file:r.relativePath,loc:l},symbolB:{symbol:s.symbol,shortName:I(s.symbol),file:s.relativePath,loc:c},similarity:a.similarity,similarityBasis:a.similarityBasis??"callees",sharedEvidence:a.sharedCallees,uniqueToA:a.uniqueToA,uniqueToB:a.uniqueToB,evidenceClass:a.evidenceClass,actionTier:a.actionTier,recommendation:a.recommendation,consolidationStrategy:ve(a)}}function ve(e){let n=e.similarityBasis==="source-tokens"?"source-token":"tracked callee";return e.sharedCallees.length===0?`No shared ${n} evidence survived similar's weighting. Inspect the source before attempting consolidation.`:e.uniqueToA.length===0&&e.uniqueToB.length===0?`The functions have identical ${n} evidence under similar's weighting. Verify signatures, guards, and return values before consolidating.`:e.uniqueToA.length===0?`A's ${n} evidence is a subset of B's. B may subsume part of A's structure, but verify signatures, guards, and non-call logic first.`:e.uniqueToB.length===0?`B's ${n} evidence is a subset of A's. A may subsume part of B's structure, but verify signatures, guards, and non-call logic first.`:e.uniqueToA.length<=2&&e.uniqueToB.length<=2?`Create a shared helper around the ${e.sharedCallees.length} shared ${n}(s). Pass the ${e.uniqueToA.length+e.uniqueToB.length} divergent point(s) as parameters or callbacks.`:`Extract the ${e.sharedCallees.length} shared ${n}(s) into a common helper. Keep each function's unique logic outside that helper (${e.uniqueToA.length} item(s) in A, ${e.uniqueToB.length} in B).`}function we(e,n,t,i){let r=G(e).calleeIndex({minCallees:3,scanLimit:i.scanLimit,semantic:i.semantic}),s=_e(n,r.corpus),a=Pe(s,r),l=Me(s,r),c=j(l),m=E(s.callees,l),g=[];for(let f of a){if(f.callees.size<3)continue;let o=E(f.callees,l),u=ce(s,f,l,{minSimilarity:t,requireSignificantShared:1,requireSharedCount:0,medianIdf:c,magnitudeA:m,magnitudeB:o});u&&g.push(u)}return g.sort((f,o)=>o.similarity-f.similarity),g}function Me(e,n){let t=new Map(n.docFreq);for(let i of e.callees)t.set(i,(t.get(i)??0)+1);return V(t,n.corpus.length+1)}function ce(e,n,t,i){let r=Le(e,n,t,i);if(!Re(r,i))return null;let{similarity:s,significantShared:a,trivialShared:l}=r,c=a.length>0?a:l,m=pe(c,"callees");return{symbolA:e.symbol,shortNameA:I(e.symbol),fileA:e.file,symbolB:n.symbol,shortNameB:I(n.symbol),fileB:n.file,similarity:s,similarityBasis:"callees",sharedCallees:c.map(I),uniqueToA:[...N(e.callees,n.callees)].map(I),uniqueToB:[...N(n.callees,e.callees)].map(I),...m}}function Te(e,n,t,i){let r=i.magnitudeA??E(e.callees,t),s=i.magnitudeB??E(n.callees,t),a=0,l=0,c=0,m=i.medianIdf??j(t);for(let o of e.callees){if(!n.callees.has(o))continue;let u=t.get(o)??0;a+=u*u,c+=1,u>=m&&(l+=1)}if(c===0)return!1;let g=r*s;return(g>0?a/g:0)<i.minSimilarity?!1:l>=i.requireSignificantShared||c>=i.requireSharedCount}function Le(e,n,t,i){return i.magnitudeA===void 0||i.magnitudeB===void 0?te(e.callees,n.callees,t,{medianIdf:i.medianIdf}):re(e.callees,n.callees,t,{medianIdf:i.medianIdf,magnitudeA:i.magnitudeA,magnitudeB:i.magnitudeB})}function Re(e,n){if(e.similarity<n.minSimilarity)return!1;let t=e.significantShared.length+e.trivialShared.length;return e.significantShared.length>=n.requireSignificantShared||t>=n.requireSharedCount}function wn(e,n={}){let{minSimilarity:t=.5,limit:i=20,scope:r,minCallees:s=4,crossFileOnly:a=!1,scanLimit:l}=n,c=n.semantic!==!1,m=A(),g=0,f=0,o=0,u=0,d=0,p=0,S=0;return y("similar.all",()=>{let b=G(e).calleeIndex({minCallees:s,scope:r,scanLimit:l,semantic:c}),C=b.corpus;g=C.length;let v=n.focusFiles,k=[],P=0;return y("similar.all.pair-scan",()=>{for(let x=0;x<C.length;x+=1){let F=C[x],T=v?.has(F.file)??!1,w=b.weightedMagnitudes[x],M=new Set;for(let O of F.callees){let L=b.candidateIndexesByCallee.get(O);if(L)for(let R of L)R<=x||v&&!T&&!v.has(C[R].file)||M.add(R)}m&&(o+=M.size,M.size>0&&(f+=1));for(let O of M){let L=C[O];if(a&&F.file===L.file){m&&(d+=1);continue}if(ue(F,L)){m&&(p+=1);continue}m&&(u+=1);let R=ce(F,L,b.idfWeights,{minSimilarity:t,requireSignificantShared:2,requireSharedCount:4,medianIdf:b.medianIdf,magnitudeA:w,magnitudeB:b.weightedMagnitudes[O]});R&&(Ae(k,R,i,P),m&&(S+=1),P+=1)}}},()=>({corpusSize:g,candidateSets:f,candidatePairs:o,comparedPairs:u,crossFileSkips:d,signatureSkips:p,insertedResults:S,topResults:k.length})),y("similar.all.sort-project",()=>(k.sort((x,F)=>F.result.similarity-x.result.similarity||x.order-F.order),k.map(x=>x.result)),()=>({topResults:k.length}))},()=>({minSimilarity:t,limit:i,scope:r,minCallees:s,crossFileOnly:a,scanLimit:l,semantic:c,corpusSize:g,candidateSets:f,candidatePairs:o,comparedPairs:u,crossFileSkips:d,signatureSkips:p,insertedResults:S}))}function Mn(e,n={}){let{minSimilarity:t=.5,scope:i,minCallees:r=4,crossFileOnly:s=!1,scanLimit:a}=n,l=n.semantic!==!1,c=A(),m=0,g=0,f=0,o=0,u=0,d=0,p=0;return y("similar.all-count",()=>{let h=G(e).calleeIndex({minCallees:r,scope:i,scanLimit:a,semantic:l}),b=h.corpus;m=b.length;let C=n.focusFiles;return y("similar.all-count.pair-scan",()=>{for(let v=0;v<b.length;v+=1){let k=b[v],P=C?.has(k.file)??!1,x=h.weightedMagnitudes[v],F=new Set;for(let T of k.callees){let w=h.candidateIndexesByCallee.get(T);if(w)for(let M of w)M<=v||C&&!P&&!C.has(b[M].file)||F.add(M)}c&&(f+=F.size,F.size>0&&(g+=1));for(let T of F){let w=b[T];if(s&&k.file===w.file){c&&(u+=1);continue}if(ue(k,w)){c&&(d+=1);continue}c&&(o+=1),Te(k,w,h.idfWeights,{minSimilarity:t,requireSignificantShared:2,requireSharedCount:4,medianIdf:h.medianIdf,magnitudeA:x,magnitudeB:h.weightedMagnitudes[T]})&&(p+=1)}}},()=>({corpusSize:m,candidateSets:g,candidatePairs:f,comparedPairs:o,crossFileSkips:u,signatureSkips:d,insertedResults:p})),p},()=>({minSimilarity:t,scope:i,minCallees:r,crossFileOnly:s,scanLimit:a,semantic:l,corpusSize:m,candidateSets:g,candidatePairs:f,comparedPairs:o,crossFileSkips:u,signatureSkips:d,insertedResults:p}))}function ue(e,n){if(e.paramCount<0||n.paramCount<0)return!1;let t=Math.abs(e.paramCount-n.paramCount),i=Math.max(2,Math.ceil(Math.max(e.paramCount,n.paramCount)*.5));return t>i}var me=Q({kind:"source-fingerprints",invalidation:ee("source-fingerprints"),serialize:ln,deserialize:on});function Ae(e,n,t,i){if(t<=0)return;if(e.length<t){e.push({result:n,order:i});return}let r=0;for(let a=1;a<e.length;a+=1){let l=e[a],c=e[r];(l.result.similarity<c.result.similarity||l.result.similarity===c.result.similarity&&l.order>c.order)&&(r=a)}let s=e[r];n.similarity<=s.result.similarity||(e[r]={result:n,order:i})}var Be=["ScipDatabase#all","ScipDatabase#get","ScipDatabase#prepare","ScipDatabase#pathExclusionsFor","ScipDatabase#isIgnored","ScipDatabase#symbolNoiseFor","PerDbValue#get","PerDbValue#has",":storage:db:ScipDatabase:all",":storage:db:ScipDatabase:get",":storage:db:ScipDatabase:prepare",":storage:db:ScipDatabase:pathExclusionsFor",":storage:db:ScipDatabase:isIgnored",":storage:db:ScipDatabase:symbolNoiseFor",":storage:per-db-cache:PerDbValue:get",":storage:per-db-cache:PerDbValue:has"];function Ee(e,n,t){let i=D(e,n);if(!i||!$(i.symbol))return null;let r=new q(e),s=ne(e,i,{semantic:t.semantic});return{symbol:i.symbol,file:i.relativePath,callees:ge(s.map(a=>a.symbol)),paramCount:r.callableSignature(i)?.paramCount??-1}}var ze=z("callee-fingerprint-corpus",{clearGroups:["whole-project","definition-catalog"]}),De=z("callee-fingerprint-index",{clearGroups:["whole-project","definition-catalog"]});function de(e,n){let{minCallees:t,scope:i,excludeSymbol:r,scanLimit:s}=n,a=n.semantic!==!1,l=ze.get(e,()=>new Map),c=`${t}|${i??""}|${s??""}|${a}`,m=!0,g=0,f=0;return y("similar.callee-fingerprints.resolve",()=>{let o=l.get(c);if(m=o!==void 0,o||(o=Oe(e,{minCallees:t,scope:i,scanLimit:s,semantic:a}),l.set(c,o)),g=o.length,r===void 0)return o;let u=o.filter(d=>d.symbol!==r);return f=o.length-u.length,u},()=>({minCallees:t,scope:i,scanLimit:s,semantic:a,cacheHit:m,corpusSize:g,excludeSymbol:r!==void 0,excludedSymbols:f}))}function qe(e,n){let{minCallees:t,scope:i,scanLimit:r}=n,s=n.semantic!==!1,a=De.get(e,()=>new Map),l=`${t}|${i??""}|${r??""}|${s}`,c=!0,m=0,g=0,f=0;return y("similar.callee-index.resolve",()=>{let o=a.get(l);return c=o!==void 0,o||(o=Ne(de(e,{minCallees:t,scope:i,scanLimit:r,semantic:s})),a.set(l,o)),m=o.corpus.length,g=o.docFreq.size,f=o.candidateIndexesByCallee.size,o},()=>({minCallees:t,scope:i,scanLimit:r,semantic:s,cacheHit:c,corpusSize:m,indexedCallees:g,candidateBuckets:f}))}function G(e){return{calleeCorpus:n=>de(e,n),calleeIndex:n=>qe(e,n),sourceCorpus:(n={})=>Ce(e,n),sourceIndex:(n={})=>le(e,n),sourceCandidates:(n,t)=>(t.candidateMode??"full")==="target-pruned"?Ye(e,n,{minSimilarity:t.minSimilarity,scanLimit:t.scanLimit}):Je(n,le(e,{scanLimit:t.scanLimit}))}}function Ne(e){let n=A(),t=0,i=y("similar.callee-index.doc-frequency",()=>{let o=new Map;for(let u of e)for(let d of u.callees)o.set(d,(o.get(d)??0)+1);return t=o.size,o},()=>({corpusSize:e.length,uniqueCallees:t})),r=Math.max(8,Math.ceil(Math.sqrt(e.length))),s=y("similar.callee-index.idf-weights",()=>V(i,e.length),()=>({corpusSize:e.length,uniqueCallees:i.size})),a=y("similar.callee-index.weighted-magnitudes",()=>e.map(o=>E(o.callees,s)),()=>({corpusSize:e.length})),l=0,c=0,m=0,g=y("similar.callee-index.candidate-buckets",()=>{let o=new Map;for(let u=0;u<e.length;u+=1){let d=e[u];for(let p of d.callees){if((i.get(p)??0)>r){n&&(c+=1);continue}let S=o.get(p);S||(S=[],o.set(p,S)),S.push(u),n&&(l+=1)}}return n&&(m=o.size),o},()=>({corpusSize:e.length,buckets:m,candidateRefs:l,ubiquitousSkips:c,ubiquityThreshold:r})),f=y("similar.callee-index.median-idf",()=>j(s),()=>({uniqueCallees:s.size}));return{corpus:e,candidateIndexesByCallee:g,docFreq:i,idfWeights:s,weightedMagnitudes:a,medianIdf:f,ubiquityThreshold:r}}function Pe(e,n){let t=new Map;for(let i of e.callees)for(let r of n.candidateIndexesByCallee.get(i)??[]){let s=n.corpus[r];s.symbol!==e.symbol&&t.set(s.symbol,s)}return t.size>0?[...t.values()]:n.corpus.filter(i=>i.symbol!==e.symbol)}function Oe(e,n){let{minCallees:t,scope:i,scanLimit:r,semantic:s}=n,a=A(),l=new q(e),c=0,m=y("similar.callee-fingerprints.candidates",()=>{let p=_(l.productionCallableDefinitions({scope:i,minLoc:5,sortByLocDesc:typeof r=="number"&&r>0}),r);return c=p.length,p},()=>({scope:i,scanLimit:r,candidateCount:c})),g=0,f=y("similar.callee-fingerprints.callee-map",()=>{let p=l.calleeMap(m,{semantic:s});if(a)for(let S of p.values())g+=S.length;return p},()=>({candidateCount:c,semantic:s,calleeEdges:g})),o=0,u=0,d=0;return y("similar.callee-fingerprints.shape",()=>{let p=m.map(b=>({symbol:b.symbol,file:b.relativePath,callees:ge((f.get(b.symbolId)??[]).map(C=>C.symbol)),paramCount:l.callableSignature(b)?.paramCount??-1})),S=$e(p);a&&(d=S.filter((b,C)=>b.callees.size!==p[C].callees.size).length);let h=S.filter(b=>b.callees.size>=t);return o=h.length,a&&(u=h.reduce((b,C)=>b+C.callees.size,0)),h},()=>({candidateCount:c,fingerprintCount:o,retainedCalleeCount:u,minCallees:t,siblingSaturatedFingerprints:d}))}var fe=5;function $e(e){let n=new Map;for(let t of e){let i=n.get(t.file);i||(i=new Map,n.set(t.file,i));for(let r of t.callees)i.set(r,(i.get(r)??0)+1)}return e.map(t=>{let i=n.get(t.file);if(!i)return t;let r=[...t.callees].filter(a=>(i.get(a)??0)>=fe);if(r.length===0)return t;let s=new Set(t.callees);for(let a of r)s.delete(a);return{...t,callees:s}})}function _e(e,n){let t=new Map;for(let s of n)if(!(s.file!==e.file||s.symbol===e.symbol))for(let a of s.callees)t.set(a,(t.get(a)??0)+1);let i=[...e.callees].filter(s=>(t.get(s)??0)+1>=fe);if(i.length===0)return e;let r=new Set(e.callees);for(let s of i)r.delete(s);return{...e,callees:r}}function ge(e){return new Set([...e].filter(n=>!je(n)))}function je(e){return Be.some(n=>e.includes(n))}function se(e,n,t){let i=Ke(e,n);if(!i||i.tokens.size<3)return[];let r=t.minSimilarity>=.5?t.minSimilarity:.3,s=[],a=t.candidateMode??"full",l=0,c=0,m=0,g=0;return y("similar.source-shape",()=>{let o=G(e).sourceCandidates(i,{minSimilarity:r,scanLimit:t.scanLimit,candidateMode:a});l=o.length;for(let u of o){if(u.symbol===i.symbol||u.tokens.size<3)continue;c+=1;let d=ie(i.tokens,u.tokens);if(d.size<2){m+=1;continue}let p=new Set([...i.tokens,...u.tokens]),S=p.size>0?d.size/p.size:0;if(S<r){g+=1;continue}s.push({symbolA:i.symbol,shortNameA:I(i.symbol),fileA:i.file,symbolB:u.symbol,shortNameB:I(u.symbol),fileB:u.file,similarity:S,similarityBasis:"source-tokens",sharedCallees:[...d].sort(),uniqueToA:[...N(i.tokens,u.tokens)].sort(),uniqueToB:[...N(u.tokens,i.tokens)].sort(),...pe([...d],"source-tokens")})}return s.sort((u,d)=>d.similarity-u.similarity||u.shortNameB.localeCompare(d.shortNameB)),s.slice(0,t.limit)},()=>({symbol:i.symbol,file:i.file,targetTokens:i.tokens.size,candidateMode:a,candidates:l,comparedPairs:c,sharedSkips:m,similaritySkips:g,results:s.length}))}function pe(e,n){let t=e.flatMap(W),i=e.flatMap(S=>ae(S,n)),r=Z(t,Se),s=Z(t,be),a=Z(i,X),l=[...new Set(i.filter(oe))],c=e.filter(S=>{let h=ae(S,n);return h.some(b=>X.has(b))&&h.some(oe)}).length,m=[];r.length>0&&m.push(`access/query scaffolding: ${r.slice(0,5).join(", ")}`),s.length>0&&m.push(`framework/generic scaffolding: ${s.slice(0,5).join(", ")}`),a.length>0&&m.push(`domain behavior verbs: ${a.slice(0,5).join(", ")}`),a.length>0&&l.length>0&&m.push(`domain-specific terms: ${l.slice(0,5).join(", ")}`);let g=n==="source-tokens"&&t.length>0&&t.every(S=>ye.has(S));g&&m.push("shared source tokens are generic scaffolding");let f=a.length>0&&l.length>0,o=r.length+s.length>0,u=n==="callees"&&f&&e.length>=4&&l.length>=4&&c>=2,d=u?"domain-behavior":f?o?"mixed":"domain-behavior":r.length>0?"access-query-scaffolding":s.length>0||g?"framework-scaffolding":"structural-overlap";d==="structural-overlap"&&e.length>0&&m.push(`shared ${n} overlap has no recognized domain or scaffolding category`);let p=d==="domain-behavior"&&(e.length>=3||u)?"direct":"signal";return{evidenceClass:d,actionTier:p,evidenceClassReasons:m,recommendation:Ge(d,p)}}function Ge(e,n){return n==="direct"?"Shared domain behavior looks concrete; review for an extract/reuse opportunity.":e==="mixed"?"Shared evidence mixes domain behavior with scaffolding; review semantics before extracting anything.":e==="access-query-scaffolding"?"Shared evidence is mostly access/query scaffolding; compare product semantics before reusing code.":e==="structural-overlap"?"Shared structure has no domain or scaffolding classification; inspect names and behavior before reusing code.":"Shared evidence is mostly framework or generic scaffolding; treat as a contextual signal."}function Z(e,n){return[...new Set(e.filter(t=>n.has(t)))]}function W(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(n=>n.length>1)}function ae(e,n){if(n==="source-tokens")return W(e);let t=K(e);return W(t.length>0?t:Ue(e))}function Ue(e){return e.replace(/[()`]/g," ").replace(/\.[a-z][a-z0-9]+(?=\s|$)/gi," ").split(/[:/\\\s]+/).map(i=>i.trim()).filter(i=>/[A-Za-z]/.test(i)).at(-1)?.replace(/\.$/,"")??e}function oe(e){return e.length>3&&!X.has(e)&&!Se.has(e)&&!be.has(e)&&!ye.has(e)&&!He.has(e)}var X=new Set(["archive","assign","book","cancel","create","delete","ensure","export","import","notify","persist","publish","restore","schedule","send","set","submit","sync","update","upload","validate","write"]),Se=new Set(["access","auth","authorize","cache","context","db","find","get","guard","list","permission","permissions","prisma","query","request","response","role","route","session","sql","where"]),be=new Set(["bytes","computed","crypto","describe","effect","expect","fetch","filter","hex","hook","json","map","mounted","on","promise","random","react","reduce","ref","render","state","test","token","trim","uuid","vue","watch"]),ye=new Set(["bytes","crypto","data","false","get","hex","id","key","map","name","num","random","result","secret","set","string","to","token","true","type","value"]),He=new Set(["best","backend","conflict","database","effect","effects","error","errors","frontend","found","helpers","javascript","module","modules","scip","shared","source","typescript","utils","with","workflow","workflows"]);function Ke(e,n){let t=D(e,n);if(!t||!$(t.symbol))return null;let i=Ve(e,t);return i?{symbol:t.symbol,file:t.relativePath,tokens:i}:null}function Ve(e,n){let t=K(n.symbol),i=rn(e,n.relativePath,n.startLine,n.endLine,t),r=ke(i,t);return r.size>0?r:null}var Ze=z("source-fingerprint-corpus",{clearGroups:["whole-project","definition-catalog"]}),We=z("source-fingerprint-index",{clearGroups:["whole-project","definition-catalog"]});function he(e){return`${e.scanLimit??""}`}function Ce(e,n={}){let t=Ze.get(e,()=>new Map),i=he(n),r=t.get(i);return r||(r=tn(e,n),t.set(i,r)),r}function le(e,n={}){let t=We.get(e,()=>new Map),i=he(n),r=t.get(i);return r||(r=Xe(Ce(e,n)),t.set(i,r)),r}function Xe(e){let n=new Map;for(let r of e)for(let s of r.tokens)n.set(s,(n.get(s)??0)+1);let t=Math.max(8,Math.ceil(Math.sqrt(e.length))),i=new Map;for(let r of e)for(let s of r.tokens){if((n.get(s)??0)>t)continue;let a=i.get(s);a||(a=[],i.set(s,a)),a.push(r)}return{corpus:e,candidateByToken:i,docFreq:n,ubiquityThreshold:t}}function Je(e,n){let t=new Map;for(let i of e.tokens)for(let r of n.candidateByToken.get(i)??[])r.symbol!==e.symbol&&t.set(r.symbol,r);return t.size>0?[...t.values()]:n.corpus.filter(i=>i.symbol!==e.symbol)}function Ye(e,n,t){let i=A(),r=new q(e),s=Qe(n.tokens.size,t.minSimilarity),a=0,l=0,c=0,m=y("similar.source-shape.target-files",()=>{let d=[...n.tokens],p=[];for(let S of Y(e,{includeIgnored:!1})){a+=1;let h=U(e,S);h&&(l+=1,en(h,d,s)&&p.push(S))}return c=p.length,p},()=>({symbol:n.symbol,targetTokens:n.tokens.size,requiredSharedTokens:s,scannedFiles:a,readableFiles:l,candidateFiles:c})),g=0,f=y("similar.source-shape.target-definitions",()=>{let d=_(r.productionCallableDefinitions({files:m,sortByLocDesc:typeof t.scanLimit=="number"&&t.scanLimit>0}),t.scanLimit);return g=d.length,d},()=>({symbol:n.symbol,candidateFiles:c,scanLimit:t.scanLimit,definitionCount:g})),o=0;return y("similar.source-shape.target-fingerprints",()=>{let d=Fe(e,f);return i&&(o=d.length),d},()=>({symbol:n.symbol,definitionCount:g,fingerprintCount:o})).filter(d=>d.symbol!==n.symbol)}function Qe(e,n){return Math.max(2,Math.ceil(e*n))}function en(e,n,t){if(n.length<t)return!1;let i=e.toLowerCase(),r=0;for(let s of n)if(nn(i,s)&&(r+=1,r>=t))return!0;return!1}function nn(e,n){return n==="num"?/\b\d+\b/.test(e):e.includes(n)}function tn(e,n={}){let t=new q(e),{scanLimit:i}=n,r=_(t.productionCallableDefinitions({sortByLocDesc:typeof i=="number"&&i>0}),i);return Fe(e,r)}function Fe(e,n){let t=new Map;for(let r of n){let s=t.get(r.relativePath)??[];s.push(r),t.set(r.relativePath,s)}let i=new Map;for(let[r,s]of t){let a=U(e,r);if(!a)continue;let l=J(e,r,a),c=an(e,r,l),m=!1,g=null;for(let f of s){let o=sn(f),u=c.get(o),d=u?new Set(u.tokens):null;d||(g??=H(e,r),d=ke(xe(g,f.startLine,f.endLine,f.leaf),f.leaf),c.set(o,{key:o,symbol:f.symbol,startLine:f.startLine,endLine:f.endLine,leaf:f.leaf,tokens:[...d].sort()}),m=!0),d.size>0&&i.set(f.symbol,{symbol:f.symbol,file:f.relativePath,tokens:d})}m&&cn(e,r,l,c)}return n.map(r=>i.get(r.symbol)).filter(r=>!!r)}function rn(e,n,t,i,r){let s=H(e,n);return s.length===0?"":xe(s,t,i,r)}function xe(e,n,t,i){if(t>=n&&t-n<=12)return e.slice(n,t+1).join(`
|
|
2
|
+
`);let r=[new RegExp(`\\bdef\\s+${B(i)}\\b`),new RegExp(`\\bfun\\s+${B(i)}\\b`),new RegExp(`\\bfn\\s+${B(i)}\\b`),new RegExp(`\\bfunction\\s+${B(i)}\\b`),new RegExp(`\\b${B(i)}\\s*\\(`)],s=e.findIndex(a=>r.some(l=>l.test(a)));if(s>=0){let a=s;for(let l=s+1;l<e.length&&l<=s+8;l++){let c=e[l]??"";if(l>s&&mn(c)||(a=l,c.trim()===""&&l>s+1))break}return e.slice(s,a+1).join(`
|
|
3
|
+
`)}return e.slice(n,Math.min(e.length,n+8)).join(`
|
|
4
|
+
`)}function sn(e){return`${e.symbol}\0${e.startLine}\0${e.endLine}\0${e.leaf}`}function an(e,n,t){return me.read(e,n,t)??new Map}function on(e){try{let n=JSON.parse(e);if(!Array.isArray(n.entries))return null;let t=new Map;for(let i of n.entries){if(!i||typeof i.key!="string"||typeof i.symbol!="string"||typeof i.startLine!="number"||typeof i.endLine!="number"||typeof i.leaf!="string"||!Array.isArray(i.tokens)||!i.tokens.every(r=>typeof r=="string"))return null;t.set(i.key,i)}return t}catch{return null}}function ln(e){let n={entries:[...e.values()].sort((t,i)=>t.key.localeCompare(i.key))};return JSON.stringify(n)}function cn(e,n,t,i){me.write(e,n,t,new Map(i))}function ke(e,n){if(!e)return new Set;let t=new Set(["public","private","protected","final","static","class","def","fun","fn","function","return","string","bool","boolean","void","unit","self","this","new","const","let","var","end","pub"]),i=un(n),s=e.replace(/["'`]/g," ").replace(/\b\d+\b/g," NUM ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[^A-Za-z0-9_]+/g," ").replace(/_/g," ").toLowerCase().split(/\s+/).map(a=>a.trim()).filter(a=>a.length>1).filter(a=>!t.has(a)).filter(a=>!i.has(a));return new Set(s)}function un(e){return new Set(e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9_]+|_/).map(n=>n.toLowerCase()).filter(n=>n.length>1))}function mn(e){return/^\s*(?:def|fun|fn|function|class|trait|module|object|enum|interface|public|private|protected)\b/.test(e)}export{Ie as a,vn as b,Me as c,ce as d,wn as e,Mn as f,Ae as g,de as h,qe as i,G as j,Ne as k,Pe as l,fe as m,$e as n,ge as o,pe as p};
|
|
5
|
+
//# sourceMappingURL=chunk-STBXCPKY.js.map
|