scip-query 0.10.12 → 0.12.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 +164 -49
- package/dist/augment-vue-worker.js +1 -1
- package/dist/{chunk-RUV5IY25.js → chunk-2LQWMYG4.js} +2 -2
- package/dist/{chunk-KZ4MG5NY.js → chunk-2QGE5AEP.js} +2 -2
- package/dist/chunk-4D54JIU3.js +2 -0
- package/dist/{chunk-2GLNBCHB.js → chunk-52Q4JFDW.js} +2 -2
- package/dist/chunk-5AAAEZ2Z.js +2 -0
- package/dist/chunk-64PRNLKP.js +2 -0
- package/dist/chunk-6XA4LDHY.js +2 -0
- package/dist/chunk-72MFTCU5.js +38 -0
- package/dist/chunk-75X52JTA.js +2 -0
- package/dist/{chunk-LEHVP4DY.js → chunk-7ITCOJGD.js} +2 -2
- package/dist/chunk-7JZRFDCU.js +2 -0
- package/dist/{chunk-XRUGSM76.js → chunk-AZLKLZ5S.js} +2 -2
- package/dist/chunk-B4VYXRCQ.js +26 -0
- package/dist/chunk-BCNT6ODA.js +5 -0
- package/dist/chunk-BP2NAIAZ.js +2 -0
- package/dist/chunk-BVNO67DB.js +2 -0
- package/dist/{chunk-XHMVZFA6.js → chunk-CW3KZ7UF.js} +2 -2
- package/dist/{chunk-6BN3EHQE.js → chunk-D64L53WX.js} +2 -2
- package/dist/{chunk-T3AEVJBG.js → chunk-D7J6GZAG.js} +2 -2
- package/dist/chunk-ECVXWZ4Q.js +3 -0
- package/dist/chunk-EDB7Y442.js +2 -0
- package/dist/{chunk-4ISHQ7UW.js → chunk-ETU2I5JM.js} +4 -4
- package/dist/chunk-EXKLAEB4.js +18 -0
- package/dist/chunk-EZ5WDZ2Q.js +3 -0
- package/dist/{chunk-S2MRVIJ5.js → chunk-F5BJSNU5.js} +6 -6
- package/dist/chunk-FBCOFKEC.js +2 -0
- package/dist/chunk-FERAXG6Y.js +72 -0
- package/dist/chunk-FXG3PHVW.js +9 -0
- package/dist/{chunk-XUCZ3RQ5.js → chunk-G2UBOONK.js} +4 -4
- package/dist/chunk-GNG622H3.js +3 -0
- package/dist/{chunk-JS6B76AQ.js → chunk-H2NMIZFD.js} +2 -2
- package/dist/chunk-H7NSJ7L2.js +5 -0
- package/dist/chunk-HSU3M25J.js +21 -0
- package/dist/chunk-HXXMPYEF.js +2 -0
- package/dist/chunk-IRJDYTNZ.js +3 -0
- package/dist/chunk-ISLWJ4PY.js +10 -0
- package/dist/chunk-J5WVNZ6O.js +2 -0
- package/dist/{chunk-UVPY3RUZ.js → chunk-K6UI6EBZ.js} +2 -2
- package/dist/{chunk-MNCQPMCH.js → chunk-KJCDEDQW.js} +2 -2
- package/dist/{chunk-ELC77ZDE.js → chunk-KMVGRIO2.js} +2 -2
- package/dist/chunk-KSUZS77X.js +16 -0
- package/dist/{chunk-A4UTLKHU.js → chunk-L2CX5GHZ.js} +2 -2
- package/dist/chunk-LFM3O5KX.js +2 -0
- package/dist/{chunk-ZUUNREKS.js → chunk-M72ZFN6E.js} +5 -5
- package/dist/chunk-MBKJ7GHT.js +102 -0
- package/dist/chunk-MJKJMWIM.js +2 -0
- package/dist/chunk-MKM7NBZK.js +43 -0
- package/dist/chunk-MTDBHTSF.js +2 -0
- package/dist/chunk-NAH5EAZS.js +6 -0
- package/dist/chunk-NJJ7AS4F.js +2 -0
- package/dist/{chunk-EOLGSSDR.js → chunk-NKT5EMEX.js} +2 -2
- package/dist/{chunk-ANUEY5WV.js → chunk-NLMRJ7SI.js} +2 -2
- package/dist/chunk-NQ75OVUU.js +40 -0
- package/dist/{chunk-TBCHRDAC.js → chunk-O3WDE26W.js} +2 -2
- package/dist/{chunk-VB2EZZPA.js → chunk-OPE5YXFE.js} +2 -2
- package/dist/chunk-ORBRX2QJ.js +2 -0
- package/dist/{chunk-OFXN2BCT.js → chunk-OSWF3HSF.js} +2 -2
- package/dist/{chunk-JJ5SAWBT.js → chunk-OVMUVXKQ.js} +2 -2
- package/dist/{chunk-NTSR6SRP.js → chunk-PH7ZFK6L.js} +2 -2
- package/dist/chunk-PXHPCWX5.js +2 -0
- package/dist/chunk-Q3B3FNCU.js +3 -0
- package/dist/{chunk-SQNHOOJ5.js → chunk-Q7S2DADC.js} +2 -2
- package/dist/{chunk-3XSNW5XB.js → chunk-QARYU7R3.js} +2 -2
- package/dist/chunk-QZ4JVECJ.js +2 -0
- package/dist/{chunk-FX6ULETZ.js → chunk-R5336VHZ.js} +2 -2
- package/dist/chunk-RA5MTIOO.js +2 -0
- package/dist/{chunk-RXINFVBN.js → chunk-RIQED5OU.js} +2 -2
- package/dist/chunk-T2FQ4GHD.js +9 -0
- package/dist/chunk-T6NGEV5I.js +2 -0
- package/dist/chunk-T7VQG55Q.js +2 -0
- package/dist/chunk-TFWDJDGO.js +2 -0
- package/dist/chunk-TG7QSYCJ.js +2 -0
- package/dist/{chunk-DQ6433ZG.js → chunk-TTMKELT7.js} +17 -8
- package/dist/{chunk-DDQONX6B.js → chunk-U7I373V4.js} +2 -2
- package/dist/chunk-UAHZ57BR.js +2 -0
- package/dist/chunk-URSSPS5H.js +2 -0
- package/dist/chunk-V3Z3IOWO.js +2 -0
- package/dist/{chunk-7C6JBBE4.js → chunk-V7CVBPWX.js} +2 -2
- package/dist/{chunk-PWAK75BU.js → chunk-VYF5HA76.js} +2 -2
- package/dist/chunk-WIBFXSYB.js +6 -0
- package/dist/chunk-WS3Z6W3M.js +65 -0
- package/dist/chunk-WXVGNFAO.js +2 -0
- package/dist/chunk-XEMQUN3Z.js +20 -0
- package/dist/chunk-YCPASUCX.js +2 -0
- package/dist/chunk-YDDGCJJG.js +3 -0
- package/dist/{chunk-2UVCH7CQ.js → chunk-YPKBZ77R.js} +2 -2
- package/dist/chunk-YZXV3CU3.js +60 -0
- package/dist/chunk-Z3IPJKJP.js +4 -0
- package/dist/chunk-ZMGBWSFZ.js +2 -0
- package/dist/{chunk-GKB4JJDU.js → chunk-ZOIPAYRP.js} +2 -2
- package/dist/chunk-ZRIOGL7F.js +8 -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 +23 -4
- 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 +57 -14
- 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 +39 -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 +150 -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-63CI3IXR.js +0 -102
- 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,72 @@
|
|
|
1
|
+
import Ke from"better-sqlite3";import{existsSync as en}from"fs";import{dirname as nn,join as rn,resolve as Xe}from"path";import ce from"better-sqlite3";import{execFileSync as ue}from"child_process";import{existsSync as le,readdirSync as ge,readFileSync as de}from"fs";import{extname as h,join as w}from"path";import z from"ignore";import{readFileSync as J,existsSync as v,readdirSync as q}from"fs";import{dirname as b,isAbsolute as C,join as m,relative as Y,resolve as Q}from"path";function V(e){let t=z();return Z(e,t)||t.add(ne),{isIgnored:n=>S(t,e,n),filter:n=>n.filter(i=>!S(t,e,i))}}function Z(e,t){let r=new Set,n=(s,a)=>{if(!(r.has(s)||!v(s)))try{let c=J(s,"utf-8");t.add(a?ee(c,a):c),r.add(s)}catch{}},i=b(e),o=0;for(;i!==b(i)&&o<5&&(n(m(i,".gitignore"),""),!v(m(i,".git")));)i=b(i),o++;return k(e,"",t,n),r.size>0}function k(e,t,r,n){let i=t?m(e,t):e;n(m(i,".gitignore"),t);let o;try{o=q(i,{withFileTypes:!0})}catch{return}for(let s of o){if(!s.isDirectory()||s.name===".git")continue;let a=t?`${t}/${s.name}`:s.name;S(r,e,`${a}/`)||k(e,a,r,n)}}function ee(e,t){let r=t.replaceAll("\\","/").replace(/\/+$/,"");return e.split(/\r?\n/).map(n=>te(n,r)).join(`
|
|
2
|
+
`)}function te(e,t){let r=e.trimStart();if(!r||r.startsWith("#"))return e;let n=e.slice(0,e.length-r.length),i=r.startsWith("!"),o=i?r.slice(1):r;if(!o||o.startsWith("#"))return e;let s=o.startsWith("/"),a=s?o.slice(1):o,l=(a.endsWith("/")?a.slice(0,-1):a).includes("/")||s?`${t}/${a}`:`${t}/**/${a}`;return`${n}${i?"!":""}${l}`}var ne=`
|
|
3
|
+
# Dependencies
|
|
4
|
+
node_modules/
|
|
5
|
+
vendor/
|
|
6
|
+
.bundle/
|
|
7
|
+
|
|
8
|
+
# Build output
|
|
9
|
+
dist/
|
|
10
|
+
build/
|
|
11
|
+
out/
|
|
12
|
+
target/
|
|
13
|
+
bin/
|
|
14
|
+
obj/
|
|
15
|
+
|
|
16
|
+
# Python
|
|
17
|
+
__pycache__/
|
|
18
|
+
*.pyc
|
|
19
|
+
*.pyo
|
|
20
|
+
.venv/
|
|
21
|
+
venv/
|
|
22
|
+
.env/
|
|
23
|
+
env/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
|
|
26
|
+
# Rust
|
|
27
|
+
target/
|
|
28
|
+
|
|
29
|
+
# Java / Kotlin / Scala
|
|
30
|
+
*.class
|
|
31
|
+
.gradle/
|
|
32
|
+
.mvn/
|
|
33
|
+
|
|
34
|
+
# C# / .NET
|
|
35
|
+
bin/
|
|
36
|
+
obj/
|
|
37
|
+
packages/
|
|
38
|
+
|
|
39
|
+
# Go
|
|
40
|
+
vendor/
|
|
41
|
+
|
|
42
|
+
# Dart
|
|
43
|
+
.dart_tool/
|
|
44
|
+
build/
|
|
45
|
+
|
|
46
|
+
# PHP
|
|
47
|
+
vendor/
|
|
48
|
+
|
|
49
|
+
# IDE / OS
|
|
50
|
+
.idea/
|
|
51
|
+
.vscode/
|
|
52
|
+
*.swp
|
|
53
|
+
*.swo
|
|
54
|
+
.DS_Store
|
|
55
|
+
Thumbs.db
|
|
56
|
+
|
|
57
|
+
# Type definitions (often noise in queries)
|
|
58
|
+
*.d.ts
|
|
59
|
+
`;function S(e,t,r){let n=re(t,r);if(!n)return!1;try{return e.ignores(n)}catch{return!1}}function re(e,t){if(!t||t===".")return null;if(!C(t)&&!t.startsWith(".."))return t.replaceAll("\\","/");let r=C(t)?t:Q(e,t),n=Y(e,r).replaceAll("\\","/");return!n||n==="."||n.startsWith("..")?null:n}import{readdirSync as ut}from"fs";import{execFileSync as gt}from"child_process";import{extname as pt,join as ft}from"path";var oe=[];function T(e){e.groups.length>0&&oe.push(e)}function ie(){let e=new WeakMap;return{cache:e,ensure(t){let r=e.get(t);return r||(r=new Map,e.set(t,r)),r}}}function I(e,t){let{cache:r,ensure:n}=ie(),i={get(o,s,a){let c=n(o);if(c.has(s))return c.get(s);let u=a();return c.set(s,u),u},invalidate(o,s){r.get(o)?.delete(s)},invalidateAll(o){r.delete(o)},size(o){return r.get(o)?.size??0}};return T({name:e,groups:t.clearGroups,clearAll:o=>i.invalidateAll(o),clearFile:(o,s)=>i.invalidate(o,s)}),i}var se=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue",".rs",".py",".pyi",".java",".kt",".kts",".scala",".sc",".clj",".cljs",".cljc",".rb",".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx",".cs",".vb",".php",".dart"],F=[".vue"],E=[".tsx",".jsx"],L=[".vue"],ht=[...E,...L],bt=new Set(E),St=new Set(L),ae=new Set(se.map(e=>e.toLowerCase())),yt=[...ae].sort().join(","),D=new Set(["node_modules",".git","target","dist","build",".next",".nuxt",".cache",".turbo",".nbb",".cpcache",".shadow-cljs","out","coverage",".scipquery-cache","__pycache__",".venv","venv",".idea",".vscode"]);var Rt=I("source-files",{clearGroups:[]});function Ft(e={}){return{id:"auxiliary-documents",facts:["auxiliary-document"],run:t=>pe({projectRoot:t.projectRoot,dbPath:t.dbPath,extensions:e.extensions,onStatus:t.onStatus})}}function pe(e){let t=new Set((e.extensions??F).map(o=>o.toLowerCase()));if(t.size===0)return{scanned:0,inserted:0,existing:0};if(!le(e.dbPath))throw new Error(`SCIP SQLite database not found at ${e.dbPath}`);let r=V(e.projectRoot),n=fe(e.projectRoot,t).filter(o=>!r.isIgnored(o)),i=new ce(e.dbPath);try{let o=he(i,n),s=i.prepare(`INSERT OR IGNORE INTO documents (language, relative_path, position_encoding, text)
|
|
60
|
+
VALUES (?, ?, NULL, ?)`),c=i.transaction(l=>{let f=0;for(let g of l){if(o.has(g))continue;let d=de(w(e.projectRoot,g),"utf-8"),B=s.run(be(g),g,d);f+=Number(B.changes)}return f})(n),u={scanned:n.length,inserted:c,existing:n.length-c};return e.onStatus?.(`Augmented SQLite documents with ${c} auxiliary source file${c===1?"":"s"} (${u.existing} already present).`),u}finally{i.close()}}function fe(e,t){let r=me(e,t);if(r)return r;let n=[],i=o=>{let s=o?w(e,o):e,a;try{a=ge(s,{withFileTypes:!0})}catch{return}for(let c of a){if(D.has(c.name))continue;let u=o?`${o}/${c.name}`:c.name;if(c.isDirectory()){i(u);continue}t.has(h(c.name).toLowerCase())&&n.push(u)}};return i(""),n.sort()}function me(e,t){try{return ue("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:26214400,stdio:["ignore","pipe","ignore"]}).split(`
|
|
61
|
+
`).filter(n=>n&&t.has(h(n).toLowerCase())).sort()}catch{return null}}function he(e,t){let r=new Set,n=500;for(let i=0;i<t.length;i+=n){let o=t.slice(i,i+n),s=e.prepare(`SELECT relative_path FROM documents WHERE relative_path IN (${o.map(()=>"?").join(",")})`).all(...o);for(let a of s)r.add(a.relative_path)}return r}function be(e){return h(e).toLowerCase()===".vue"?"vue":h(e).replace(/^\./,"").toLowerCase()||"source"}import{readFileSync as Dt,writeFileSync as wt}from"fs";function Ot(e,t){let r=Date.now(),n=e.run(t);return{stageId:e.id,facts:e.facts,durationMs:Date.now()-r,result:n}}import{execFileSync as Se}from"child_process";import{createHash as ye}from"crypto";import{readdirSync as Re,readFileSync as xe}from"fs";import{join as A}from"path";function Mt(e){return[...new Set((e??[]).map(t=>t.trim()).filter(Boolean))].sort((t,r)=>t.localeCompare(r))}function O(e){return(Ce(e)??Ve(e)).filter(t=>t&&!P(t)).sort()}function $t(e,t={}){return(t.language?O(e).filter(n=>ve(n,t.language,t.markerFiles)):O(e)).map(n=>{let i=A(e,n);try{let o=xe(i);return{path:n,size:o.byteLength,hash:ye("sha256").update(o).digest("hex")}}catch{return{path:n,size:-1,hash:"unreadable"}}})}function ve(e,t,r){let n=e.split("/").at(-1)??e;if(r?.includes(e)||r?.includes(n)||Te.has(n))return!0;let i=e.includes(".")?`.${e.split(".").at(-1).toLowerCase()}`:"";return(Ie[t]??[]).includes(i)}function Ce(e){try{return Se("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:50*1024*1024,stdio:["ignore","pipe","ignore"]}).split(`
|
|
62
|
+
`).filter(Boolean)}catch{return null}}function Ve(e){let t=[],r=[""];for(;r.length>0;){let n=r.pop(),i=n?A(e,n):e,o;try{o=Re(i,{withFileTypes:!0})}catch{continue}for(let s of o){let a=n?`${n}/${s.name}`:s.name;if(s.isDirectory()){P(a)||r.push(a);continue}t.push(a)}}return t}function P(e){let t=e.split("/");return e==="meta.json"||t.some(r=>ke.has(r))||e.endsWith(".db")||e.endsWith(".db-wal")||e.endsWith(".db-shm")||e.endsWith(".scip")}var ke=new Set([".git","node_modules",".scipquery-cache",".stryker-tmp","dist","build","coverage",".next",".nuxt","target"]),Te=new Set(["package.json","package-lock.json","pnpm-lock.yaml","yarn.lock","bun.lockb","tsconfig.json","tsconfig.base.json","pyproject.toml","setup.py","setup.cfg","Cargo.toml","Cargo.lock","go.mod","go.sum","pom.xml","build.gradle","build.gradle.kts","build.sbt","compile_commands.json","CMakeLists.txt","Makefile","Gemfile","Gemfile.lock","composer.json","composer.lock","pubspec.yaml","pubspec.lock","deps.edn","project.clj","bb.edn","shadow-cljs.edn"]),Ie={typescript:[".ts",".tsx",".mts",".cts"],javascript:[".js",".jsx",".mjs",".cjs"],java:[".java"],scala:[".scala"],kotlin:[".kt",".kts"],rust:[".rs"],python:[".py",".pyi"],ruby:[".rb"],go:[".go"],cpp:[".cc",".cpp",".cxx",".hpp",".hh",".hxx"],c:[".c",".h"],csharp:[".cs"],vb:[".vb"],dart:[".dart"],php:[".php"],clojure:[".clj",".cljs",".cljc"]};import{createRequire as Fe}from"module";import{existsSync as Ee,readFileSync as R}from"fs";import{dirname as j,extname as Le,join as N,relative as De,resolve as Kt}from"path";import{pathToFileURL as we}from"url";function _(e,t){let{vueCore:r,ts:n,volarTs:i}=Oe(e),{parsed:o,vueOptions:s}=Ae(r,n,t),a=j(t),c=r.createVueLanguagePlugin(n,o.options,s,d=>d),u=Pe(r,n,c),l=je(a,o),{languageServiceHost:f}=i.createLanguageServiceHost(n,n.sys,u,d=>d,l),g=n.createLanguageService(f);return{ts:n,language:u,languageService:g,fileNames:o.fileNames,configDir:a}}function Oe(e){let t=Fe(we(N(e,"package.json")).href);return{vueCore:y(t,"@vue/language-core",e),ts:y(t,"typescript",e),volarTs:y(t,"@volar/typescript",e)}}function Ae(e,t,r){let n=t.readConfigFile(r,t.sys.readFile);if(n.error||!n.config)throw new Error(`Failed to read ${r}`);let o=e.createParsedCommandLine(t,t.sys,r).vueOptions;return typeof e.createGlobalTypesWriter=="function"&&(o.globalTypesPath=e.createGlobalTypesWriter(o,t.sys.writeFile)),{parsed:t.parseJsonConfigFileContent(n.config,t.sys,j(r),void 0,r,void 0,e.getAllExtensions(o).map(s=>({extension:s.slice(1),isMixedContent:!0,scriptKind:t.ScriptKind.Deferred}))),vueOptions:o}}function Pe(e,t,r){let n={},i=e.createLanguage([r],new Map,o=>{if(!Ee(o))return;let s=R(o,"utf-8");n.current?.scripts.set(o,t.ScriptSnapshot.fromString(s),r.getLanguageId(o)??$e(o))});return n.current=i,i}function je(e,t){return{getCurrentDirectory:()=>e,getCompilationSettings:()=>t.options,getScriptFileNames:()=>t.fileNames,getProjectReferences:()=>t.projectReferences,getProjectVersion:()=>"0"}}function y(e,t,r){try{return e(t)}catch(n){throw(typeof n=="object"&&n!==null&&"code"in n?n.code:null)==="MODULE_NOT_FOUND"?new Error(`Vue augmentation requires ${t} to be installed in ${r}. Install Vue/Volar dependencies for that project, then rerun augment-vue.`,{cause:n}):n}}function M(e,t,r){let n=Ne(e);return i=>{let o=p(t,i.fileName),s=r.get(i.fileName);if(!s)return null;let a=r.positionAt(s,i.textSpan.start),c=n.get(o);if(!c)return null;let u=c.containingByLine.get(a.line);return u!==void 0?u:_e(c.starts,a.line,2)}}function Ne(e){let t=e.prepare(`
|
|
63
|
+
SELECT
|
|
64
|
+
d.relative_path AS relativePath,
|
|
65
|
+
der.start_line AS startLine,
|
|
66
|
+
der.end_line AS endLine,
|
|
67
|
+
der.symbol_id AS symbolId
|
|
68
|
+
FROM defn_enclosing_ranges der
|
|
69
|
+
JOIN documents d ON d.id = der.document_id
|
|
70
|
+
ORDER BY d.relative_path, (der.end_line - der.start_line) DESC
|
|
71
|
+
`).all(),r=new Map;for(let n of t){let i=r.get(n.relativePath);i||(i={containingByLine:new Map,starts:[]},r.set(n.relativePath,i)),i.starts.push({line:n.startLine,symbolId:n.symbolId});for(let o=n.startLine;o<=n.endLine;o++)i.containingByLine.set(o,n.symbolId)}for(let n of r.values())n.starts.sort((i,o)=>i.line-o.line);return r}function _e(e,t,r){let n=0,i=e.length-1;for(;n<=i;){let s=Math.floor((n+i)/2);e[s].line<t?n=s+1:i=s-1}let o=null;for(let s of[i,n]){let a=e[s];if(!a)continue;let c=Math.abs(a.line-t);c>r||(!o||c<o.distance)&&(o={distance:c,symbolId:a.symbolId})}return o?.symbolId??null}function $(e,t){let r=We(t),n=e.prepare("SELECT id FROM global_symbols WHERE symbol = ?"),i=new Map;return{get(o){if(i.has(o))return i.get(o)??null;let s=Ue(n,r,t,o);return i.set(o,s),s}}}function G(e,t,r,n,i){if(e.fileName.endsWith(".vue")){let o=n.language.scripts.get(e.fileName),s=o?.generated?.languagePlugin.typescript?.getServiceScript(o.generated.root)?.code;if(o&&s){let a=n.language.maps.get(s,o);if(x(a,e.textSpan.start)!==null)return r.get(e.fileName)}return e.fileName.startsWith(i)?r.get(e.fileName):null}return t(e)}function*W(e){let t=/\b[A-Za-z_$][A-Za-z0-9_$]*\b/g,r=new Set(["script","setup","template","style","lang","scoped","true","false","null","undefined","const","let","var","import","from","export","return","if","else","for","while","function","class","type","interface","as","await","async"]),n;for(;n=t.exec(e);){let i=n[0];r.has(i)||(yield{text:i,start:n.index,end:n.index+i.length})}}function U(e,t){for(let[r]of e.toGeneratedLocation(t,n=>!!n.navigation))return r;return null}function x(e,t){let r=e;for(let[n]of r.toSourceLocation(t,i=>!!i.navigation))return n;return null}function Me(e,t){let r=0,n=e.lineStarts.length-1;for(;r<=n;){let o=Math.floor((r+n)/2);e.lineStarts[o]<=t?r=o+1:n=o-1}let i=Math.max(0,n);return{line:i,character:t-e.lineStarts[i]}}function H(e,t){return p(e,t).startsWith("node_modules/")}function p(e,t){return De(e,t).replaceAll("\\","/")}function $e(e){switch(Le(e)){case".vue":return"vue";case".tsx":return"typescriptreact";case".ts":case".mts":case".cts":return"typescript";case".jsx":return"javascriptreact";case".js":case".mjs":case".cjs":return"javascript";case".json":return"json";default:return"typescript"}}function K(){let e=new Map;return{get(t){if(e.has(t))return e.get(t)??null;try{let r=R(t,"utf-8"),n={text:r,lineStarts:Ge(r)};return e.set(t,n),n}catch{return e.set(t,null),null}},positionAt:Me}}function Ge(e){let t=[0];for(let r=0;r<e.length;r++)e.charCodeAt(r)===10&&t.push(r+1);return t}function We(e){try{let t=JSON.parse(R(N(e,"package.json"),"utf-8"));return{name:t.name??"workspace",version:t.version??"0.0.0"}}catch{return{name:"workspace",version:"0.0.0"}}}function Ue(e,t,r,n){let i=p(r,n),o=He(t.name,t.version,i);return e.get(o)?.id??null}function He(e,t,r){let n=r.split("/").map(i=>`\`${i.replaceAll("`","")}\``).join("/");return`scip-vue npm ${e} ${t} ${n}/default.`}function sn(e){let t=Xe(e.projectRoot,e.tsconfig),r=new Ke(e.dbPath,{readonly:!0});try{let n=Be({db:r,projectRoot:e.projectRoot,configPath:t,vueSymbolLookup:$(r,e.projectRoot)});return ze({vueFiles:e.vueFiles??[],tasks:e.tasks,...n})}finally{r.close()}}function Be(e){let t=K();return{projectRoot:e.projectRoot,context:_(e.projectRoot,e.configPath),symbolLookup:M(e.db,e.projectRoot,t),vueSymbolLookup:e.vueSymbolLookup,sourceReader:t}}function ze(e){let t=[],r=0,n=e.tasks??e.vueFiles.map(i=>({fileName:i,startOffset:0,endOffset:Number.POSITIVE_INFINITY,countFileSkip:!0}));for(let i of n){let o=Je(e,i);t.push(...o.occurrences),r+=o.skippedReferences}return{occurrences:t,skippedReferences:r}}function Je(e,t){let r=e.context.language.scripts.get(t.fileName),n=r?.generated?.languagePlugin.typescript?.getServiceScript(r.generated.root)?.code;if(!r||!n)return{occurrences:[],skippedReferences:t.countFileSkip?1:0};let i=e.sourceReader.get(t.fileName);if(!i)return{occurrences:[],skippedReferences:t.countFileSkip?1:0};let o=e.context.language.maps.get(n,r),s=p(e.projectRoot,t.fileName),a=[...W(i.text)],c={tokens:a.filter(u=>u.start>=t.startOffset&&u.start<t.endOffset),tokenByStart:new Map(a.map(u=>[u.start,u])),tokenTextCounts:Qe(a),processedStarts:new Set};return qe({...e,fileName:t.fileName,sourceInfo:i,sourceFile:s,map:o,tokenContext:c})}function qe(e){let t=[],r=0;for(let n of e.tokenContext.tokens){if(e.tokenContext.processedStarts.has(n.start))continue;let i=U(e.map,n.start);if(i===null)continue;let s=(e.context.languageService.getDefinitionAtPosition(e.fileName,i+1)??[]).find(c=>!H(e.projectRoot,c.fileName));if(!s){r++;continue}let a=G(s,e.symbolLookup,e.vueSymbolLookup,e.context,e.projectRoot);if(a===null){r++;continue}X(t,e.sourceReader,e.sourceInfo,e.sourceFile,n,a),e.tokenContext.processedStarts.add(n.start),Ye(t,e,n,i,a)}return{occurrences:t,skippedReferences:r}}function Ye(e,t,r,n,i){if(!((t.tokenContext.tokenTextCounts.get(r.text)??0)<=1))for(let o of Ze(t.context.languageService,t.fileName,n+1,t.map,r,t.tokenContext.tokenByStart)){if(t.tokenContext.processedStarts.has(o))continue;let s=t.tokenContext.tokenByStart.get(o);s&&(X(e,t.sourceReader,t.sourceInfo,t.sourceFile,s,i),t.tokenContext.processedStarts.add(o))}}function X(e,t,r,n,i,o){let s=t.positionAt(r,i.start);e.push({sourceFile:n,sourceLine:s.line,sourceStartChar:s.character,sourceEndChar:s.character+i.text.length,symbolId:o})}function Qe(e){let t=new Map;for(let r of e)t.set(r.text,(t.get(r.text)??0)+1);return t}function Ze(e,t,r,n,i,o){let s=e.getDocumentHighlights?.(t,r,[t])??[],a=[];for(let c of s)if(c.fileName===t)for(let u of c.highlightSpans){let l=et(n,u.textSpan.start,o,i.text);l!==null&&a.push(l)}return a}function et(e,t,r,n){let i=r.get(t);if(i?.text===n)return i.start;let o=x(e,t);if(o===null)return null;let s=r.get(o);return s?.text===n?s.start:null}export{Ft as a,Ot as b,Mt as c,$t as d,sn as e};
|
|
72
|
+
//# sourceMappingURL=chunk-FERAXG6Y.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{m as v,o as D}from"./chunk-WS3Z6W3M.js";import{d as F}from"./chunk-7S5E7KWT.js";import{execFileSync as B}from"child_process";var S=2e3,x=50,I=64,$=8,U=3,K=2160*60*60,J=/\b(?:fix(?:es|ed)?|bug|regression|hotfix)\b/i,V=3,W=/#\d+|\b[A-Z][A-Z0-9]+-\d+\b/g,X=/^([a-z][a-z0-9-]+)(?:\([^)]+\))?!?:/i;function R(e){let t=F(e,{clearGroups:["whole-project"]});return(n,i)=>{let r=P(n.config.projectRoot);if(!r)return null;let o=t.has(n)?t.get(n,()=>({head:"",value:null})):null;return o&&o.head===r?o.value:(t.invalidate(n),t.get(n,()=>({head:r,value:i(n.config.projectRoot,r)})).value)}}function M(e){let t=F(e,{clearGroups:["whole-project"]});return(n,i,r)=>{let o=P(n.config.projectRoot);if(!o)return null;let a=t.has(n)?t.get(n,()=>({head:"",values:new Map})):null;(!a||a.head!==o)&&t.invalidate(n);let l=t.get(n,()=>({head:o,values:new Map}));if(l.values.has(i))return l.values.get(i)??null;let u=r(n.config.projectRoot,o);return l.values.set(i,u),u}}var Y=R("git-commit-history");function Z(e){return{capability:t=>q(e,t),commitHistory:()=>A(e),fileChurn:()=>te(e),changeAmplification:()=>ne(e),trackedFiles:()=>re(e),fileAddRecords:()=>se(e),coChangePairs:(t={})=>de(e,t),coChangePairsForFiles:(t,n={})=>j(e,t,n),directionalCoChangePairsForFiles:(t,n={})=>fe(e,t,n)}}function A(e){return Y(e,Q)}function q(e,t){let n=P(e.config.projectRoot);return n?{slot:t,available:!0,head:n}:{slot:t,available:!1,head:null,reason:"git history is unavailable for this project"}}function P(e){try{return C(e,["rev-parse","HEAD"]).trim()||null}catch{return null}}function C(e,t){return B("git",["-C",e,...t],{encoding:"utf-8",maxBuffer:64*1024*1024,stdio:["ignore","pipe","ignore"]})}function Q(e,t){let n;try{n=C(e,["log","--no-merges","--name-only","-n",String(S),"--pretty=format:%x01%H%x00%ct%x00%s"])}catch{return null}return{head:t,...E(n,x)}}function ee(e){return J.test(e.subject)}function te(e){let t=A(e);if(!t)return null;let n=new Map;for(let i of t.commits){let r=ee(i);for(let o of i.files){let a=n.get(o)??{changes:0,fixChanges:0,lastChangedAt:0};a.changes+=1,r&&(a.fixChanges+=1),i.timestamp>a.lastChangedAt&&(a.lastChangedAt=i.timestamp),n.set(o,a)}}return n}function ne(e){let t=A(e);if(!t||t.commits.length===0)return null;let n=t.commits.map(i=>i.files.length).filter(i=>i>0).sort((i,r)=>i-r);return n.length===0?null:{medianFilesPerCommit:k(n,.5),p90FilesPerCommit:k(n,.9),commitsAnalyzed:n.length}}function k(e,t){let n=Math.min(e.length-1,Math.floor(e.length*t));return e[n]}var ie=R("git-tracked-files");function re(e){return ie(e,t=>{try{let n=C(t,["ls-files"]);return new Set(n.split(`
|
|
2
|
+
`).map(i=>i.trim()).filter(i=>i!==""))}catch{return null}})}var oe=R("git-file-adds"),O="__git__/file-adds",_=v({kind:"git-file-adds",invalidation:D("git-file-adds"),serialize:ce,deserialize:le});function we(e){return Z(e).fileAddRecords()}function se(e){return oe(e,(t,n)=>ae(e,t,n))}function ae(e,t,n){let i=_.read(e,O,n);if(i)return i;let r=ue(t);return r&&_.write(e,O,n,r),r}function ce(e){return JSON.stringify([...e.entries()])}function le(e){if(!e)return null;try{let t=JSON.parse(e);if(!Array.isArray(t))return null;let n=new Map;for(let i of t){if(!Array.isArray(i)||i.length!==2||typeof i[0]!="string")return null;let r=i[1];if(!r||typeof r.commitsAgo!="number"||!Number.isFinite(r.commitsAgo)||typeof r.addedAt!="number"||!Number.isFinite(r.addedAt))return null;n.set(i[0],{commitsAgo:r.commitsAgo,addedAt:r.addedAt})}return n}catch{return null}}function ue(e){let t;try{t=C(e,["log","--no-merges","--find-renames","--name-status","-n",String(S),"--pretty=format:%x01%H%x00%ct%x00%s"])}catch{return null}let n=new Map,i=new Map,r=-1;for(let o of t.split("")){if(o.trim()==="")continue;r+=1;let a=o.indexOf(`
|
|
3
|
+
`),l=a>=0?o.slice(0,a):o,[,u]=l.split("\0"),f=Number(u)||0;if(!(a<0))for(let h of o.slice(a+1).split(`
|
|
4
|
+
`)){let s=me(h);if(!s)continue;if(s.status==="R"&&s.from&&s.to){let m=i.get(s.to)??new Set([s.to]);i.set(s.from,m);continue}if(s.status!=="A"||!s.to)continue;let c={commitsAgo:r,addedAt:f};n.set(s.to,c);for(let m of i.get(s.to)??[])n.set(m,c)}}return n}function me(e){let t=e.trim().split(" "),n=t[0]??"";if(!n)return null;let i=n[0]??"";if(i==="R"){let o=t[1],a=t[2];return o&&a?{status:i,from:o,to:a}:null}let r=t[1];return r?{status:i,to:r}:null}var G=M("git-co-change-pairs"),ge=M("git-directional-co-change-pairs");function de(e,t){let n=`all\0${T(t)}`,i=G(e,n,()=>{let r=A(e);return r?w(r,t):null});return i&&[...i]}function j(e,t,n){if(t.size===0)return[];let i=`files\0${z(t)}\0${T(n)}`,r=G(e,i,()=>{let o=A(e);return o?w(o,n,t):null});return r&&[...r]}function fe(e,t,n){if(t.size===0)return[];let i=n.maxFilesPerCommit??x;if(t.size>I)return j(e,t,n);let r=`directional\0${z(t)}\0${T({...n,maxFilesPerCommit:i})}`,o=ge(e,r,(a,l)=>{let u=he(a,l,t,i);return u?w(u,n,t):null});return o&&[...o]}function T(e){let t=e.minTogether??4,n=e.minConfidence??.6,i=e.maxFilesPerCommit??x;return`${t}\0${n}\0${i}`}function z(e){return[...e].sort().join("\0")}function w(e,t,n){let{minTogether:i=4,minConfidence:r=.6,maxFilesPerCommit:o=x}=t,a=new Map,l=new Map,u=e.newestAnalyzedAt??0;for(let s of e.commits){let c=[...new Set(s.files)].sort();if(c.length>o)continue;e.newestAnalyzedAt===void 0&&s.timestamp>u&&(u=s.timestamp);let m=be(c),y=n===void 0||c.some(g=>n.has(g));for(let g of c)a.set(g,(a.get(g)??0)+1);if(y)for(let g=0;g<c.length;g++)for(let p=g+1;p<c.length;p++){if(n&&!n.has(c[g])&&!n.has(c[p]))continue;let b=`${c[g]}\0${c[p]}`,d=l.get(b)??{together:0,focusedTogether:0,broadTogether:0,lastTogetherAt:0,timestamps:[],subjects:[]};d.together+=1,m?d.broadTogether+=1:d.focusedTogether+=1,s.timestamp>d.lastTogetherAt&&(d.lastTogetherAt=s.timestamp),d.timestamps.push(s.timestamp),d.subjects.push(s.subject),l.set(b,d)}}let f=[],h=u-K;for(let[s,c]of l){let m=c.together;if(m<i)continue;let[y,g]=s.split("\0"),p=a.get(y)??m,b=a.get(g)??m,d=Math.max(m/p,m/b);if(d<r)continue;let L=c.broadTogether/m,H=c.timestamps.filter(N=>N>=h).length;f.push({fileA:y,fileB:g,together:m,confidence:d,changesA:p,changesB:b,focusedTogether:c.focusedTogether,broadTogether:c.broadTogether,broadCommitRatio:L,lastTogetherAt:c.lastTogetherAt,recentTogether:H,commitScope:ye(c.broadTogether,m),recency:H>0?"recent":"stale",subjectContext:Se(c.subjects)})}return f.sort((s,c)=>c.together-s.together||c.confidence-s.confidence||s.fileA.localeCompare(c.fileA)),f}function he(e,t,n,i){let r;try{r=Ce(e)}catch{return null}if(r.length===0)return{head:t,commits:[],skippedBulkCommits:0,newestAnalyzedAt:0};let o;try{o=C(e,["log","--no-merges","--format=%H","-n",String(S),"--",...[...n].sort()])}catch{return null}let a=new Set(r.map(s=>s.hash)),l=o.split(`
|
|
5
|
+
`).map(s=>s.trim()).filter(s=>s!==""&&a.has(s)),u=pe(e,r,i);if(l.length===0)return{head:t,commits:[],skippedBulkCommits:0,newestAnalyzedAt:u};let f;try{f=C(e,["show","--no-walk=unsorted","--name-only","--pretty=format:%x01%H%x00%ct%x00%s",...l])}catch{return null}let h=E(f,i);return{head:t,...h,newestAnalyzedAt:u}}function Ce(e){return C(e,["log","--no-merges","--format=%H%x00%ct","-n",String(S)]).split(`
|
|
6
|
+
`).map(n=>n.trim()).filter(n=>n!=="").map(n=>{let[i,r]=n.split("\0");return{hash:i??"",timestamp:Number(r)||0}}).filter(n=>n.hash!=="")}function pe(e,t,n){for(let r=0;r<t.length;r+=20){let o=t.slice(r,r+20),a;try{a=C(e,["show","--no-walk=unsorted","--name-only","--pretty=format:%x01%H%x00%ct%x00%s",...o.map(u=>u.hash)])}catch{return t[0]?.timestamp??0}let l=E(a,n);if(l.commits.length>0)return l.commits[0].timestamp}return 0}function E(e,t){let n=[],i=0;for(let r of e.split("")){if(r.trim()==="")continue;let o=r.indexOf(`
|
|
7
|
+
`),a=o>=0?r.slice(0,o):r,[l,u,f]=a.split("\0");if(!l||!u)continue;let h=o>=0?r.slice(o+1).split(`
|
|
8
|
+
`).map(s=>s.trim()).filter(s=>s!==""):[];if(h.length>t){i+=1;continue}n.push({hash:l,timestamp:Number(u)||0,subject:f??"",files:h})}return{commits:n,skippedBulkCommits:i}}function be(e){return e.length>=$?!0:Ae(e).size>=U}function Ae(e){let t=new Set;for(let n of e){let i=n.indexOf("/");t.add(i>=0?n.slice(0,i):".")}return t}function ye(e,t){return e===0?"focused":e/t>=.5?"broad-sweep":"mixed"}function Se(e){let t=new Set,n=[],i=[];for(let r of e){!i.includes(r)&&i.length<V&&i.push(r);for(let o of xe(r))t.add(o);for(let o of r.match(W)??[])n.includes(o)||n.push(o)}return{subjectLabels:[...t].sort(),issueRefs:n,sampleSubjects:i,externalIssueLabelStatus:"unavailable"}}function xe(e){let t=new Set,n=X.exec(e)?.[1]?.toLowerCase();return n&&t.add(Fe(n)),/\b(?:feat|feature)\b/i.test(e)&&t.add("feature"),/\b(?:fix(?:es|ed)?|bug|regression|hotfix)\b/i.test(e)&&t.add("fix"),/\b(?:docs?|documentation|guide|readme)\b/i.test(e)&&t.add("docs"),/\brefactor(?:ing|ed)?\b/i.test(e)&&t.add("refactor"),/\btests?\b/i.test(e)&&t.add("test"),/\b(?:release|version|v\d+\.\d+)\b/i.test(e)&&t.add("release"),/\bchore\b/i.test(e)&&t.add("chore"),/\bbuild\b/i.test(e)&&t.add("build"),/\bci\b/i.test(e)&&t.add("ci"),/\bperf(?:ormance)?\b/i.test(e)&&t.add("perf"),[...t]}function Fe(e){return e==="feat"?"feature":e}export{Z as a,we as b};
|
|
9
|
+
//# sourceMappingURL=chunk-FXG3PHVW.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as r}from"./chunk-OSWF3HSF.js";function _(e,n,d){let i=r(e,n)??n,o=r(e,d)??d,t=e.get(`SELECT COUNT(DISTINCT gs.id) AS shared
|
|
2
2
|
FROM global_symbols gs
|
|
3
3
|
WHERE (
|
|
4
4
|
-- Defined in file1, referenced in file2
|
|
@@ -30,7 +30,7 @@ import{a as t}from"./chunk-OFXN2BCT.js";function l(e,n,i){let d=t(e,n)??n,o=t(e,
|
|
|
30
30
|
JOIN documents d ON c.document_id = d.id
|
|
31
31
|
WHERE m.symbol_id = gs.id AND m.role != 1 AND d.relative_path = ?
|
|
32
32
|
)
|
|
33
|
-
)`,
|
|
33
|
+
)`,i,o,o,i);return{...c(i,o,t?.shared??0)}}function a(e,n={}){let{limit:d=20,scope:i}=n,o=i?"AND def_d.relative_path LIKE ? AND ref_d.relative_path LIKE ?":"",t=i?[`%${i}%`,`%${i}%`]:[];return e.all(`SELECT
|
|
34
34
|
def_d.relative_path AS file1,
|
|
35
35
|
ref_d.relative_path AS file2,
|
|
36
36
|
COUNT(DISTINCT gs.id) AS shared
|
|
@@ -52,5 +52,5 @@ import{a as t}from"./chunk-OFXN2BCT.js";function l(e,n,i){let d=t(e,n)??n,o=t(e,
|
|
|
52
52
|
${o}
|
|
53
53
|
GROUP BY def_d.id, ref_d.id
|
|
54
54
|
ORDER BY shared DESC
|
|
55
|
-
LIMIT
|
|
56
|
-
//# sourceMappingURL=chunk-
|
|
55
|
+
LIMIT ?`,...t,d).filter(s=>!e.isIgnored(s.file1)&&!e.isIgnored(s.file2)).map(s=>c(s.file1,s.file2,s.shared))}function c(e,n,d){return{file1:e,file2:n,sharedSymbols:d,actionTier:"signal",couplingKind:"shared-symbol-coupling",evidenceReasons:[`${d} symbol(s) are defined in one file and referenced by the other`],recommendation:"Review whether the shared symbol surface is an intentional boundary or hidden coordination pressure before moving code."}}export{_ as a,a as b};
|
|
56
|
+
//# sourceMappingURL=chunk-G2UBOONK.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as d}from"./chunk-64MNV6AB.js";import{c as S}from"./chunk-7S5E7KWT.js";import{isAbsolute as x,relative as h}from"path";function g(e){return e.replace(/\\/g,"/").replace(/^\.\//,"")}function F(e){return e.replace(/\\/g,"/")}function X(e,t){return g(e)===g(t)}function P(e,t){let n=h(e,t);return n===""||!n.startsWith("..")&&!x(n)}import{readdirSync as y}from"fs";import{execFileSync as _}from"child_process";import{extname as l,join as R}from"path";var C=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue",".rs",".py",".pyi",".java",".kt",".kts",".scala",".sc",".clj",".cljs",".cljc",".rb",".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx",".cs",".vb",".php",".dart"],H=[".vue"],p=[".tsx",".jsx"],f=[".vue"],I=[...p,...f],O=new Set(p),v=new Set(f),E=new Set(C.map(e=>e.toLowerCase())),w=[...E].sort().join(","),m=new Set(["node_modules",".git","target","dist","build",".next",".nuxt",".cache",".turbo",".nbb",".cpcache",".shadow-cljs","out","coverage",".scipquery-cache","__pycache__",".venv","venv",".idea",".vscode"]);function N(e,t={}){let n=t.includeIndexed??!0,i=t.includeAuxiliary??!0,o=t.extensions?.map(c=>c.toLowerCase()),s=o?new Set(o):E,u=o?[...s].sort().join(","):w,r=`${n?"1":"0"}|${i?"1":"0"}|${u}`;return j.get(e,r,()=>{let c=new Set;if(n)for(let a of d(e,{includeIgnored:!1}))s.has(l(a).toLowerCase())&&c.add(a);if(i)for(let a of T(e.config.projectRoot,s))e.isIgnored(a)||n&&c.has(a)||c.add(a);return[...c].sort()})}function V(e,t={}){let n=!1,i=!1;for(let o of N(e,{extensions:I})){if(t.scope&&!o.includes(t.scope))continue;let s=l(o).toLowerCase();if(n||=O.has(s),i||=v.has(s),n&&i)break}return{react:n,vue:i}}var j=S("source-files",{clearGroups:[]});function T(e,t){return b(e,t)??L(e,t)}function b(e,t){try{let n=_("git",["ls-files","--cached","--others","--exclude-standard"],{cwd:e,encoding:"utf-8",timeout:1e4,stdio:["ignore","pipe","ignore"]}),i=new Set;for(let o of n.split(`
|
|
2
|
+
`)){let s=o.trim();s&&(A(s)||t.has(l(s).toLowerCase())&&i.add(s))}return i}catch{return null}}function A(e){return e.split("/").some(t=>m.has(t))}function L(e,t){let n=new Set,i=o=>{let s=o?R(e,o):e,u;try{u=y(s,{withFileTypes:!0})}catch{return}for(let r of u)if(!m.has(r.name)){if(r.isDirectory()){i(o?`${o}/${r.name}`:r.name);continue}t.has(l(r.name).toLowerCase())&&n.add(o?`${o}/${r.name}`:r.name)}};return i(""),n}export{g as a,F as b,X as c,P as d,H as e,m as f,N as g,V as h};
|
|
3
|
+
//# sourceMappingURL=chunk-GNG622H3.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as f}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as f}from"./chunk-UAHZ57BR.js";import{a as h}from"./chunk-ECVXWZ4Q.js";import{e as s,g as u}from"./chunk-HXXMPYEF.js";import{d}from"./chunk-T2FQ4GHD.js";import{x as c}from"./chunk-ISLWJ4PY.js";import{basename as p}from"path";function N(r,o){let t=h(r,o);if(!t)return[];let e=s(t.symbol),a=new f(r).definitionsForFile(t.relativePath).filter(n=>u(n.symbol)),l=a.filter(n=>n.parentTypeName===e||n.symbol.includes(e)),m=(l.length>0?l:L(p(t.relativePath))===e?a.filter(n=>n.symbol.includes("<invalid-global-code>")):[]).map(n=>({startLine:n.startLine,endLine:n.endLine,name:s(n.symbol)}));return c(t.relativePath)!=="clojure"?m:b(m,M(r,t))}function L(r){return r.replace(/\.[^.]+$/,"")}function M(r,o){let t=s(o.symbol);return t?(d(r,o.relativePath)?.clojureMembers??[]).filter(e=>e.ownerName===t).map(e=>({startLine:e.startLine,endLine:e.endLine,name:e.memberName})):[]}function b(r,o){let t=new Map;for(let e of[...r,...o])t.set(`${e.name}:${e.startLine}:${e.endLine}`,e);return[...t.values()].sort((e,i)=>e.startLine-i.startLine||e.endLine-i.endLine)}export{N as a};
|
|
2
|
+
//# sourceMappingURL=chunk-H2NMIZFD.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{a as G}from"./chunk-QZ4JVECJ.js";import{a as U}from"./chunk-WXVGNFAO.js";import{a as _}from"./chunk-FXG3PHVW.js";import{b as F,i as O,j as L,k as $,l as K,m as H,o as z,p as X}from"./chunk-WS3Z6W3M.js";import{existsSync as Y,readFileSync as P,statSync as St}from"fs";import{join as T}from"path";function M(t,n){let e=it(t,n)??rt(t,n)??ot(t,n)??st(t,n);return ct(t,e,n)}function it(t,n){let e=-1,i=null;for(let r=0;r<=n;r+=1){let o=j(t[r]??"");o&&(i===null?(i=o,e=r):o===i&&(i=null,e=-1))}if(i===null||e<0)return null;for(let r=n+1;r<t.length;r+=1)if(j(t[r]??"")===i)return{start:e,end:r+1};return{start:e,end:t.length}}function j(t){let n=t.match(/^\s*(```+|~~~+)/);return n?n[1].startsWith("`")?"`":"~":null}function rt(t,n){if(!w(t[n]??""))return null;let e=n;for(;e>0&&w(t[e-1]??"");)e-=1;let i=n+1;for(;i<t.length&&w(t[i]??"");)i+=1;return{start:e,end:i}}function w(t){let n=t.trim();return n.startsWith("|")&&n.endsWith("|")&&n.includes("|")}function ot(t,n){let e=n;for(;e>=0;){let o=t[e]??"";if(I(o)!==null)break;if(N(o)!==null)return null;e-=1}if(e<0)return null;let i=I(t[e]??"");if(i===null)return null;let r=e+1;for(;r<t.length;){let o=t[r]??"",s=I(o);if(s!==null){if(s<=i)break;r+=1;continue}if(N(o)!==null)break;r+=1}return{start:e,end:r}}function I(t){let n=t.match(/^(\s*)(?:[-*+]\s+|\d+[.)]\s+)/);return n?n[1].length:null}function st(t,n){let e=t[n]??"";if(V(e)||e.trim().length===0)return{start:n,end:n+1};let i=n;for(;i>0&&q(t[i-1]??"");)i-=1;let r=n+1;for(;r<t.length&&q(t[r]??"");)r+=1;return{start:i,end:r}}function q(t){return N(t)===null}function N(t){return t.trim().length===0?"blank":V(t)?"heading":j(t)?"fence":w(t)?"table":I(t)!==null?"list":null}function V(t){return/^#{1,6}\s+/.test(t.trim())}function ct(t,n,e){let{start:i,end:r}=n;if(r-i>40){let s=Math.floor(20);i=Math.max(i,e-s),r=Math.min(r,i+40),i=Math.max(n.start,r-40)}let o=t.slice(i,r).join(`
|
|
2
|
+
`).trim();return o.length<=2e3?o:`${o.slice(0,2e3).trimEnd()}...`}function R(t,n){return n.filter(e=>t.includes(e))}import{existsSync as at,readFileSync as W}from"fs";var lt=/<!--\s*scip-query:\s*snapshot\s*-->/i;function Z(t,n){if((t.config.docs?.snapshotPaths??[]).some(r=>G(r,n)))return!0;let i=X(t,n);return i.length>0&<.test(i)}var J={classifyCitation:ut,citationContexts:ft,citationKindLabel:mt,citationRemediation:ht,referenceTargets:pt,hasLineAnchoredCitation:dt};function dt(t){return t.some(n=>(n.lineReferences?.length??0)>0)}function ut(t){let n=t.join(`
|
|
3
|
+
`).toLowerCase(),e=[],i=R(n,[".scipquery","declaredcouplings","suppression","suppressions","config","configuration","json"]);if(i.length>0)return e.push(`configuration/example terms near citation: ${i.join(", ")}`),{citationKind:"configuration-example",actionTier:"support",reasons:e};let r=R(n,["accepted","intentional","intentionally","retained","historical"]);if(r.length>0)return e.push(`intentional-record terms near citation: ${r.join(", ")}`),{citationKind:"intentional-record",actionTier:"support",reasons:e};let o=R(n,["command","cli","usage","example","run","workflow"]);return o.length>0?(e.push(`guide/reference terms near citation: ${o.join(", ")}`),{citationKind:"guide-reference",actionTier:"signal",reasons:e}):(e.push(t.length>0?"citation appears in prose without config or guide markers":"citation context unavailable"),{citationKind:"behavioral-claim",actionTier:"direct",reasons:e})}function ft(t,n,e){let i;try{i=W(`${t.config.projectRoot}/${n}`,"utf-8").split(/\r?\n/)}catch{return[]}let r=e.flatMap(gt),o=[];for(let s=0;s<i.length;s+=1){let c=i[s]??"";r.some(a=>c.includes(a))&&o.push(M(i,s))}return o}function gt(t){let n=t.split("/");return[t,`./${t}`,n.slice(-3).join("/"),n.slice(-2).join("/")].filter((e,i,r)=>e.length>0&&r.indexOf(e)===i)}function mt(t){switch(t){case"behavioral-claim":return"a behavioral doc claim";case"configuration-example":return"a configuration example";case"guide-reference":return"a guide reference";case"intentional-record":return"an intentional record"}}function ht(t,n){switch(t){case"behavioral-claim":return`Re-read ${n} and update the behavioral claim or citation.`;case"configuration-example":return`Verify the configuration example in ${n} still points at the intended file; update only if the example target changed.`;case"guide-reference":return`Verify the guide reference in ${n} still sends readers to the right implementation or command surface.`;case"intentional-record":return`Verify the intentional citation in ${n} is still meant to name this file.`}}function pt(t,n,e){let i=U(e),r=new Set;for(let o of n)yt(t,o,i.get(o)??[])&&r.add(o);return r}function yt(t,n,e){if(!Ct.test(n))return!0;let i=`${t.config.projectRoot}/${n}`;if(!at(i))return!0;if(e.length===0)return!1;let r=W(i,"utf-8").split(/\r?\n/),o=bt(r);for(let s of e)for(let c=s.startLine;c<=s.endLine;c+=1)if((r[c]??"").trim()!==""&&!o.has(c))return!0;return!1}var Ct=/\.(?:[cm]?[jt]sx?)$/i;function bt(t){let n=new Set,e=!1;for(let i=0;i<t.length;i+=1){let r=t[i].trim();!e&&Dt(r)&&(e=!0),e&&(n.add(i),r.endsWith(";")&&(e=!1))}return n}function Dt(t){return/^import(?:\s|$)/.test(t)||/^export(?:\s+type)?\s+(?:\*|\{)/.test(t)}var Q=H({kind:"doc-path-evidence",invalidation:z("doc-path-evidence"),serialize:Nt,deserialize:Bt}),v=/\.(?:md|mdx|rst|txt)$/i;function xt(t){return/(?:^|\/)(?:docs\/plans|plans|adrs?|rfcs?|decisions|changelogs?|archive|reports?)\//i.test(t)||/(?:^|\/)CHANGELOG\.(?:md|mdx|rst|txt)$/i.test(t)}var Rt=3,Tt=/([A-Za-z0-9_@-]+(?:\/[A-Za-z0-9_.@-]+)+\.[A-Za-z0-9]{1,6})(?::([1-9][0-9]*))?\b/g;function sn(t,n={}){let{doc:e,limit:i=20,minCoupling:r=Rt,includeSnapshotExcluded:o=!1}=n,s=It(t);if(!s)return{available:!1,commitsAnalyzed:0,docsScanned:0,findings:[]};let c=[];for(let a of s.docFiles){if(e!==void 0&&!a.includes(e)||e===void 0&&!tt(t,a)||e!==void 0&&!Y(T(t.config.projectRoot,a)))continue;let f=Z(t,a);if(f&&!o)continue;let{value:y,estimated:l}=At(t,a,s.changeTimes.get(a)),m=vt(t,a),h=new Map,{resolved:d,broken:g,citations:D}=kt(t,a,s.tracked,s.trackedBySuffix,s.everSeenInHistory),S=new Map(D.map(u=>[u.file,u]));for(let u of d){if(u===a||v.test(u))continue;let C=(s.changeTimes.get(u)??[]).filter(b=>b>y).length;if(C===0)continue;let p=S.get(u);h.set(u,{file:u,evidence:"reference",coChanges:0,changesSinceDocUpdate:C,...B("reference",m,p?.contexts),citationContexts:p?.contexts,citedLines:p?.lineReferences})}for(let[u,C]of s.coupling.get(a)??[]){if(C<r||!s.tracked.has(u))continue;let p=(s.changeTimes.get(u)??[]).filter(A=>A>y).length;if(p===0)continue;let b=h.get(u);b?(b.evidence="both",b.coChanges=C,Object.assign(b,B("both",m,b.citationContexts))):h.set(u,{file:u,evidence:"co-change",coChanges:C,changesSinceDocUpdate:p,...B("co-change",m)})}if(h.size===0&&g.length===0)continue;let x=[...h.values()].sort((u,C)=>C.changesSinceDocUpdate-u.changesSinceDocUpdate);c.push({doc:a,docLastChangedAt:y,staleness:x.reduce((u,C)=>u+C.changesSinceDocUpdate,0)+g.length*10,subjects:x.slice(0,8),brokenReferences:g,...f?{snapshotExcluded:!0}:{},...l?{docLastChangedAtEstimated:!0}:{}})}return c.sort((a,f)=>f.staleness-a.staleness),{available:!0,commitsAnalyzed:s.historyCommitCount,docsScanned:s.docFiles.length,findings:c.slice(0,i)}}function At(t,n,e){if(e&&e.length>0)return{value:Math.max(...e),estimated:!1};try{return{value:Math.floor(St(T(t.config.projectRoot,n)).mtimeMs/1e3),estimated:!0}}catch{return{value:0,estimated:!1}}}function vt(t,n){let e;try{e=P(T(t.config.projectRoot,n),"utf8").slice(0,6e3)}catch{return{docIntent:"unknown",reasons:["doc text unavailable"]}}let i=`${n}
|
|
4
|
+
${e}`.toLowerCase(),r=R(i,["historical note","historical record","history note","retrospective","postmortem","post-mortem","archived","archive","previously","legacy","recorded","record of","snapshot","as of","migration note","decision record"]);if(r.length>0)return{docIntent:"historical-note",reasons:[`historical-note terms: ${r.join(", ")}`]};let o=R(i,["current","standard","standards","must","should","policy","guide","guidance","workflow","contract","invariant","source of truth"]);return o.length>0?{docIntent:"current-guidance",reasons:[`current-guidance terms: ${o.join(", ")}`]}:{docIntent:"unknown",reasons:["no current-guidance or historical-note markers found"]}}function B(t,n,e=[]){let i=t==="co-change"||e.length===0?null:J.classifyCitation(e);return{actionTier:wt(t,n.docIntent,i?.actionTier),docIntent:n.docIntent,docIntentReasons:n.reasons,...i?{citationKind:i.citationKind,citationKindReasons:i.reasons}:{}}}function wt(t,n,e){return n==="historical-note"?"support":e||(t==="co-change"?"signal":"direct")}function It(t){let n=_(t),e=n.commitHistory();if(!e)return null;let i=n.trackedFiles()??new Set,r=new Map,o=new Map,s=new Set;for(let c of e.commits){let a=[...new Set(c.files)],f=a.filter(l=>v.test(l)),y=a.filter(l=>!v.test(l));for(let l of a){s.add(l);let m=r.get(l)??[];m.push(c.timestamp),r.set(l,m)}for(let l of f){let m=o.get(l);m||(m=new Map,o.set(l,m));for(let h of y)m.set(h,(m.get(h)??0)+1)}}return{changeTimes:r,coupling:o,docFiles:[...i].filter(c=>v.test(c)),everSeenInHistory:s,historyCommitCount:e.commits.length,tracked:i,trackedBySuffix:nt(i)}}function cn(t,n){if(n.size===0)return[];let e=$(),i=0,r=0,o=0,s=0,c=0,a=0;return K("doc-reference.docs-citing-files",()=>{let f=_(t).trackedFiles()??new Set;i=f.size;let y=nt(f),l=Mt(n,y),m=[];for(let h of f){if(!tt(t,h))continue;e&&(r+=1);let d;try{d=P(T(t.config.projectRoot,h),"utf-8")}catch{e&&(o+=1);continue}if(!_t(d,l)){e&&(s+=1);continue}let g=et(t,h,d);if(!g)continue;e&&(c+=1);let D=Et(g.candidates,n,l,f,y);if(D.size===0)continue;let S=[...new Set([...D.values()].flatMap(p=>[...p]))],x=Lt(g.contextsByCandidate,S),u=[...D].map(([p,b])=>({file:p,contexts:E([...b].flatMap(A=>x.get(A)??[])).slice(0,3),lineReferences:k([...b].flatMap(A=>g.lineReferencesByCandidate.get(A)??[]))})).filter(p=>p.contexts.length>0),C=[...D.keys()];if(C.length>0){e&&(a+=1);let p=C.sort();m.push({doc:h,cited:p,citations:u,citedClaims:E(u.flatMap(b=>b.contexts)).slice(0,3)})}}return m},()=>({targets:n.size,trackedFiles:i,livingDocs:r,unreadableDocs:o,candidateMisses:s,evidenceDocs:c,citedDocs:a}))}function tt(t,n){return v.test(n)&&!xt(n)&&Y(T(t.config.projectRoot,n))}function nt(t){let n=new Map;for(let e of t){let i=e.split("/");for(let r of[2,3]){if(i.length<r)continue;let o=i.slice(-r).join("/"),s=n.get(o)??[];s.push(e),n.set(o,s)}}return n}function Mt(t,n){let e=new Set(t);for(let i of t){let r=i.split("/");for(let o of[2,3]){if(r.length<o)continue;let s=r.slice(-o).join("/"),c=n.get(s);c?.length===1&&c[0]===i&&e.add(s)}}return e}function Et(t,n,e,i,r){let o=new Map;for(let s of t){if(!e.has(s))continue;let c;if(n.has(s))c=s;else if(i.has(s))c=s;else{let f=r.get(s);f?.length===1&&(c=f[0])}if(!c||!n.has(c))continue;let a=o.get(c)??new Set;a.add(s),o.set(c,a)}return o}function kt(t,n,e,i,r){let o=new Set,s=new Set,c=et(t,n);if(!c)return{resolved:o,broken:[],citations:[]};let a=c.candidates,f=c.contextsByCandidate,y=c.lineReferencesByCandidate,l=new Map,m=new Map,h=(d,g)=>{let D=f.get(g);if(D&&D.length>0){let x=l.get(d)??[];x.push(...D),l.set(d,E(x).slice(0,3))}let S=y.get(g);S&&S.length>0&&m.set(d,k([...m.get(d)??[],...S]))};for(let d of a){if(e.has(d)){o.add(d),h(d,d);continue}let g=i.get(d);if(g&&g.length===1){o.add(g[0]),h(g[0],d);continue}g&&g.length>1||r.has(d)&&s.add(d)}return{resolved:o,broken:[...s],citations:[...l].map(([d,g])=>({file:d,contexts:g,lineReferences:m.get(d)}))}}function Lt(t,n){let e=new Map;for(let i of n){let r=t.get(i);r&&r.length>0&&e.set(i,[...r])}return e}function et(t,n,e){let i=e;if(i===void 0)try{i=P(T(t.config.projectRoot,n),"utf-8")}catch{return null}let r=F(t,n,i),o=Q.read(t,n,r);if(o)return o;let s=jt(i);return Q.write(t,n,r,s),s}function _t(t,n){for(let e of n)if(t.includes(e))return!0;return!1}function jt(t){let n=t.split(/\r?\n/),e=new Set,i=new Map,r=new Map;for(let o=0;o<n.length;o+=1){let s=n[o]??"";for(let c of s.matchAll(Tt)){let a=(c[1]??"").replace(/^\.?\//,"");if(a.length===0)continue;e.add(a);let f=c[2]?Number(c[2]):null;f!==null&&Number.isSafeInteger(f)&&r.set(a,k([...r.get(a)??[],f]));let y=M(n,o);if(y.length===0)continue;let l=i.get(a)??[];l.push(y),i.set(a,E(l).slice(0,3))}}return{candidates:[...e],contextsByCandidate:i,lineReferencesByCandidate:r}}function Nt(t){let n={candidates:t.candidates,contextsByCandidate:[...t.contextsByCandidate.entries()],lineReferencesByCandidate:[...t.lineReferencesByCandidate.entries()]};return JSON.stringify(n)}function Bt(t){try{let n=JSON.parse(t);if(!O(n))return null;let e=L(n.candidates),i=Ft(n.contextsByCandidate),r=Pt(n.lineReferencesByCandidate);return!e||!i?null:{candidates:e,contextsByCandidate:new Map(i),lineReferencesByCandidate:new Map(r??[])}}catch{return null}}function Pt(t){if(t===void 0)return[];if(!Array.isArray(t))return null;let n=[];for(let e of t){if(!Array.isArray(e)||e.length!==2||typeof e[0]!="string"||!Array.isArray(e[1]))return null;let i=[];for(let r of e[1]){if(typeof r!="number"||!Number.isSafeInteger(r))return null;i.push(r)}n.push([e[0],k(i)])}return n}function Ft(t){if(!Array.isArray(t))return null;let n=[];for(let e of t){if(!Array.isArray(e)||e.length!==2||typeof e[0]!="string")return null;let i=L(e[1]);if(!i)return null;n.push([e[0],i])}return n}function E(t){let n=[];for(let e of new Set(t))n.some(i=>Ot(i,e))||n.push(e);return n}function k(t){return[...new Set(t)].sort((n,e)=>n-e)}function Ot(t,n){if(t===n)return!0;let e=t.split(/\r?\n/).map(c=>c.trim()).filter(c=>c.length>0),i=n.split(/\r?\n/).map(c=>c.trim()).filter(c=>c.length>0),r=Math.min(e.length,i.length);if(r===0)return!1;if(r<3)return t.includes(n)||n.includes(t);let o=new Set(i),s=e.filter(c=>o.has(c)).length;return s>=3&&s/r>=.6}export{Z as a,J as b,xt as c,sn as d,cn as e};
|
|
5
|
+
//# sourceMappingURL=chunk-H7NSJ7L2.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import{a as B}from"./chunk-WXVGNFAO.js";import{a as _}from"./chunk-UAHZ57BR.js";import{e as N}from"./chunk-72MFTCU5.js";import{e as M}from"./chunk-YDDGCJJG.js";import{d as R,g as y,i as F}from"./chunk-HXXMPYEF.js";import{A as w}from"./chunk-ISLWJ4PY.js";import{execFileSync as g}from"child_process";import{existsSync as q,readFileSync as H}from"fs";import{basename as v}from"path";var J="Unable to compute git diff.";function Be(e,n={}){let i=n.plan??Z(e,n);return i.note?j(i.note,i.changedFileLines):i.changedFiles.length===0?V(i.changedFileLines):Y(i.changedFiles,[G(e,i.changedFiles,i.changedFiles,i.changedRanges)])}function Z(e,n={}){let{base:i="HEAD"}=n;try{let t=K(e.config.projectRoot,i),r=oe(e,t),o=se(e,Q(e.config.projectRoot,i));return{changedFileLines:t,changedFiles:r,changedRanges:o,renamedFiles:ne(e.config.projectRoot,i,r),note:t.length===0?"No changed files found.":void 0}}catch{return{changedFileLines:[],changedFiles:[],changedRanges:[],renamedFiles:[],note:J}}}function G(e,n,i,t=[]){let r=new _(e),o=new Set(i),s=B(t),a=[],l=new Map,d=n.flatMap(u=>r.definitionsForFile(u)).filter(Le),f=d.filter(u=>ce(u,s)),c=le(e,d,f,s),m=me([...f,...c.definitions]).sort((u,h)=>u.relativePath.localeCompare(h.relativePath)||u.startLine-h.startLine),p=m.map(u=>u.symbolId),C=ye(e,p),z=be(e,p,i),I=m.filter(u=>(C.get(u.symbolId)??0)===0),x=T(()=>M(e,I)),W=I.filter(u=>(x.get(u.symbolId)?.size??0)===0),U=T(()=>N(e,W));for(let u of m)he(e,u,o,a,l,x.get(u.symbolId)??new Set,U.get(u.symbolId)??new Set,C.get(u.symbolId)??0,z.get(u.symbolId)??new Set);return{changedSymbols:a,consumerEntries:[...l.entries()].map(([u,h])=>({file:u,symbols:[...h].sort()})),attributionNotes:c.notes}}function Y(e,n){let i=new Map,t=n.flatMap(s=>s.changedSymbols),r=n.flatMap(s=>s.attributionNotes??[]);for(let s of n)for(let a of s.consumerEntries){let l=i.get(a.file);l||(l=new Set,i.set(a.file,l));for(let d of a.symbols)l.add(d)}let o=Se(i);return{changedFiles:[...e],changedSymbols:t,affectedConsumers:o,attributionNotes:r,summary:{totalChangedFiles:e.length,totalChangedSymbols:t.length,totalAffectedFiles:o.length}}}function j(e,n=[]){return{changedFiles:n,changedSymbols:[],affectedConsumers:[],attributionNotes:[],summary:{totalChangedFiles:n.length,totalChangedSymbols:0,totalAffectedFiles:0,note:e}}}function V(e){return{changedFiles:e,changedSymbols:[],affectedConsumers:[],attributionNotes:[],summary:{totalChangedFiles:e.length,totalChangedSymbols:0,totalAffectedFiles:0,note:"Changed files are not present in the current SCIP index."}}}function K(e,n){let i=g("git",["diff","--name-only",n],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:67108864}),t=g("git",["diff","--name-only","--cached",n],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024}),r=g("git",["ls-files","--others","--exclude-standard"],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024});return[...new Set([i,t,r].flatMap(o=>o.split(`
|
|
2
|
+
`)).map(o=>o.trim()).filter(o=>o.length>0))]}function Q(e,n){let i=g("git",["diff","--unified=0",n],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:67108864}),t=g("git",["diff","--unified=0","--cached",n],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024});return O([...E(i),...E(t)])}function L(e,n,i){try{return g("git",["show",`${n}:./${i}`],{encoding:"utf-8",cwd:e,timeout:1e4,stdio:["ignore","pipe","ignore"]})}catch{return null}}function ve(e,n,i=[]){let t=X(e,n,i);return r=>(t.has(r)||t.set(r,L(e,n,r)),t.get(r)??null)}function Ae(e,n=e.changedFiles){let i=new Map(e.renamedFiles.map(t=>[t.to,t.from]));return[...new Set(n.map(t=>i.get(t)??t))]}function X(e,n,i){let t=[...new Set(i)],r=new Map;if(t.length===0)return r;try{let o=t.map(a=>`${n}:./${a}
|
|
3
|
+
`).join(""),s=g("git",["cat-file","--batch"],{cwd:e,input:o,maxBuffer:256*1024*1024,timeout:1e4,stdio:["pipe","pipe","ignore"]});return ee(s,t)}catch{for(let o of t)r.set(o,L(e,n,o));return r}}function ee(e,n){let i=new Map,t=0;for(let r of n){let o=e.indexOf(10,t);if(o<0)throw new Error("git cat-file batch output ended before object header");let s=e.subarray(t,o).toString("utf-8");if(t=o+1,s.endsWith(" missing")){i.set(r,null);continue}let a=/^[0-9a-f]+ ([^ ]+) (\d+)$/.exec(s);if(!a)throw new Error(`unexpected git cat-file batch header: ${s}`);let[,l,d]=a,f=Number(d);if(!Number.isFinite(f)||f<0)throw new Error(`unexpected git cat-file batch size: ${s}`);if(t+f>e.length)throw new Error("git cat-file batch output ended before blob payload");let c=e.subarray(t,t+f);i.set(r,l==="blob"?c.toString("utf-8"):null),t+=f,e[t]===10&&(t+=1)}return i}function ne(e,n,i){if(i.length===0)return[];let t=new Map,r=new Set;for(let s of ie(e,n))i.includes(s.to)&&(t.set(s.to,s),r.add(s.from));let o=te(e,n);if(o.length===0)return[...t.values()].sort((s,a)=>s.to.localeCompare(a.to));for(let s of i){if(t.has(s)||!q(`${e}/${s}`))continue;let a=o.filter(f=>!r.has(f)).filter(f=>v(f)===v(s));if(a.length===0)continue;let l=H(`${e}/${s}`,"utf-8"),d=a.map(f=>({from:f,to:s,similarity:re(L(e,n,f)??"",l)})).sort((f,c)=>c.similarity-f.similarity)[0];d&&d.similarity>=.45&&(t.set(s,d),r.add(d.from))}return[...t.values()].sort((s,a)=>s.to.localeCompare(a.to))}function te(e,n){let i=g("git",["diff","--name-only","--diff-filter=D",n],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:67108864}),t=g("git",["diff","--name-only","--diff-filter=D","--cached",n],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024});return[...new Set([...P(i),...P(t)])]}function ie(e,n){let i=g("git",["diff","--name-status","--find-renames",n],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:67108864}),t=g("git",["diff","--name-status","--find-renames","--cached",n],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024});return[...i.split(`
|
|
4
|
+
`),...t.split(`
|
|
5
|
+
`)].map(r=>r.trim()).filter(r=>r.startsWith("R")).map(r=>r.split(" ")).filter(r=>r.length>=3).map(([r,o,s])=>({from:o,to:s,similarity:Number(r.slice(1))/100}))}function re(e,n){let i=new Set(A(e)),t=new Set(A(n));if(i.size===0&&t.size===0)return 1;if(i.size===0||t.size===0)return 0;let r=0;for(let o of i)t.has(o)&&(r+=1);return 2*r/(i.size+t.size)}function A(e){return e.match(/[A-Za-z_$][\w$]*|[{}()[\].,]/g)??[]}function P(e){return e.split(`
|
|
6
|
+
`).map(n=>n.trim()).filter(n=>n.length>0)}function oe(e,n){let i=$(e),t=[];for(let r of n){let o=i(r);o&&!e.isIgnored(o)&&t.push(o)}return t}function se(e,n){let i=$(e),t=[];for(let r of n){let o=i(r.file);o&&!e.isIgnored(o)&&t.push({...r,file:o})}return O(t)}function $(e){let n=e.all(`SELECT relative_path FROM documents
|
|
7
|
+
ORDER BY id`).map(t=>t.relative_path),i=new Map(n.map(t=>[t,t]));return t=>{let r=t.replace(/\\/g,"/"),o=i.get(r);return o||(n.find(s=>s.endsWith(r))??null)}}function E(e){let n=[],i=null;for(let t of e.split(`
|
|
8
|
+
`)){if(t.startsWith("+++ ")){i=ae(t.slice(4).trim());continue}if(!i||!t.startsWith("@@ "))continue;let r=/@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@/.exec(t);if(!r)continue;let o=Math.max(0,Number(r[1])-1),s=r[2]===void 0?1:Number(r[2]);n.push({file:i,startLine:o,endLine:Math.max(o,o+Math.max(s,1)-1)})}return n}function ae(e){return e==="/dev/null"?null:e.startsWith("a/")||e.startsWith("b/")?e.slice(2):e}function O(e){let n=new Set,i=[];for(let t of e){let r=`${t.file}:${t.startLine}:${t.endLine}`;n.has(r)||(n.add(r),i.push(t))}return i}function ce(e,n){let i=n.get(e.relativePath);return!i||i.length===0?!0:i.some(t=>D(e.startLine,e.endLine,t.startLine,t.endLine))}function fe(e,n,i){let t=new Map,r=[],o=k(e),s=ge(i);for(let a of n){let l=o.get(a.file)??[];if(l.some(c=>D(c.startLine,c.endLine,a.startLine,a.endLine)))continue;let d=s.get(a.file)??[],f=pe(d,a);if(f){let c=l.find(m=>m.startLine>=f.startLine&&m.startLine<=f.endLine);if(c){t.set(c.symbolId,c),r.push(b(a,"ast-widened"));continue}}if(d.length===0){let c=[...l].filter(m=>m.startLine<=a.startLine).sort((m,p)=>p.startLine-m.startLine||m.endLine-p.endLine)[0];if(c){t.set(c.symbolId,c),r.push(b(a,"nearest-preceding"));continue}}r.push(b(a,"unattributed"))}return{definitions:[...t.values()],notes:r}}function le(e,n,i,t){let r=k(i),o=[],s=[],a=[...new Set(n.map(l=>l.relativePath))];for(let l of a){let d=t.get(l)??[];if(d.length===0)continue;let f=r.get(l)??[];for(let c of d)f.some(m=>D(m.startLine,m.endLine,c.startLine,c.endLine))||o.push(c);o.some(c=>c.file===l)&&s.push(...de(e,l))}return fe(n,o,s)}function de(e,n){let i=w(e,n);return i?i.rootNode.namedChildren.filter(ue).map(t=>({file:n,startLine:t.startPosition.row,endLine:t.endPosition.row})).filter(t=>t.endLine>=t.startLine):[]}function ue(e){return e.endPosition.row<e.startPosition.row?!1:!new Set(["import_statement","comment"]).has(e.type)}function me(e){let n=new Map;for(let i of e)n.set(i.symbolId,i);return[...n.values()]}function k(e){let n=new Map;for(let i of e){let t=n.get(i.relativePath)??[];t.push(i),n.set(i.relativePath,t)}return n}function ge(e){let n=new Map;for(let i of e){let t=n.get(i.file)??[];t.push(i),n.set(i.file,t)}return n}function pe(e,n){return e.filter(i=>i.startLine<=n.startLine&&i.endLine>=n.endLine).sort((i,t)=>i.endLine-i.startLine-(t.endLine-t.startLine))[0]}function b(e,n){return{file:e.file,startLine:e.startLine,endLine:e.endLine,method:n}}function D(e,n,i,t){return e<=t&&i<=n}function he(e,n,i,t,r,o,s,a,l){let d=Math.max(a,o.size,s.size);if(!De(n,d))return;let f=R(n.symbol);t.push({symbol:n.symbol,shortName:f,file:n.relativePath,startLine:n.startLine,endLine:n.endLine,fanIn:d});for(let c of l)S(e,i,r,c,f);for(let c of o)S(e,i,r,c,f);for(let c of s)S(e,i,r,c,f)}function T(e){try{return e()}catch(n){return console.error(`warning: diff-impact enrichment scan failed, continuing without it: ${n instanceof Error?n.message:n}`),new Map}}function ye(e,n){if(n.length===0)return new Map;let i=e.all(`SELECT m.symbol_id, COUNT(DISTINCT c.document_id) AS fan_in
|
|
9
|
+
FROM mentions m
|
|
10
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
11
|
+
WHERE m.symbol_id IN (${n.map(()=>"?").join(",")})
|
|
12
|
+
AND m.role != 1
|
|
13
|
+
GROUP BY m.symbol_id`,...n);return new Map(i.map(t=>[t.symbol_id,t.fan_in]))}function be(e,n,i){if(n.length===0||i.length===0)return new Map;let t=e.all(`SELECT DISTINCT m.symbol_id, ref_d.relative_path
|
|
14
|
+
FROM mentions m
|
|
15
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
16
|
+
JOIN documents ref_d ON c.document_id = ref_d.id
|
|
17
|
+
WHERE m.symbol_id IN (${n.map(()=>"?").join(",")})
|
|
18
|
+
AND m.role != 1
|
|
19
|
+
AND ref_d.relative_path NOT IN (${i.map(()=>"?").join(",")})
|
|
20
|
+
${e.pathExclusionsFor("ref_d")}`,...n,...i),r=new Map;for(let o of t){let s=r.get(o.symbol_id);s||(s=new Set,r.set(o.symbol_id,s)),s.add(o.relative_path)}return r}function S(e,n,i,t,r){if(e.isIgnored(t)||n.has(t))return;let o=i.get(t);o||(o=new Set,i.set(t,o)),o.add(r)}function Se(e){return[...e.entries()].map(([n,i])=>({file:n,consumedSymbols:i.size})).sort((n,i)=>i.consumedSymbols-n.consumedSymbols)}function Le(e){return!(F(e.symbol)||e.parentTypeName!==null&&!y(e.symbol))}function De(e,n){return y(e.symbol)||e.isTypeLike?!0:e.parentTypeName===null&&n>0}export{J as a,Be as b,Z as c,G as d,Y as e,L as f,ve as g,Ae as h,X as i,fe as j};
|
|
21
|
+
//# sourceMappingURL=chunk-HSU3M25J.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{e as g,l as S,m as x}from"./chunk-T2FQ4GHD.js";import{A as m}from"./chunk-ISLWJ4PY.js";import{p as u,q as d}from"./chunk-WS3Z6W3M.js";var y={"/":"namespace","#":"type",".":"term","[":"type-param",":":"meta","!":"macro"};function a(e){if(e.startsWith("local "))return{kind:"local",id:e.slice(6),raw:e};let s=e.split(" ");if(s.length<4)return{scheme:s[0]??"",manager:s[1]??"",packageName:s[2]??"",version:"",descriptors:[],raw:e};let t=s[0],r=s[1],n=e.slice(t.length+1+r.length+1),i;if(n.startsWith("`")){let f=n.indexOf("`",1);f===-1?(i=n.slice(1),n=""):(i=n.slice(1,f),n=n.slice(f+2))}else{let f=n.indexOf(" ");f===-1?(i=n,n=""):(i=n.slice(0,f),n=n.slice(f+1))}let o,c=n.indexOf(" ");c===-1?(o=n,n=""):(o=n.slice(0,c),n=n.slice(c+1));let l=v(n);return{scheme:t,manager:r,packageName:i,version:o,descriptors:l,raw:e}}function M(e){let s=a(e);if("kind"in s)return null;for(let t=s.descriptors.length-2;t>=0;t--){let r=s.descriptors[t];if(r?.suffix==="type")return r.name}return null}function v(e){let s=[],t=0;for(;t<e.length;){if(e[t]==="["){let i=e.indexOf("]",t+1);if(i===-1){s.push({name:e.slice(t+1),suffix:"type-param"});break}s.push({name:e.slice(t+1,i),suffix:"type-param"}),t=i+1;continue}if(e[t]==="("&&(s.length===0||t===0||h(e[t-1]))){let i=e.indexOf(")",t+1);if(i!==-1&&e[i+1]!=="."){s.push({name:e.slice(t+1,i),suffix:"parameter"}),t=i+1;continue}}let r;if(e[t]==="`"){let i=e.indexOf("`",t+1);if(i===-1){r=e.slice(t+1),s.push({name:r,suffix:"term"});break}r=e.slice(t+1,i),t=i+1}else{let i=t;for(;t<e.length&&!h(e[t]);)t++;r=e.slice(i,t)}if(t>=e.length){r&&s.push({name:r,suffix:"term"});break}let n=e[t];if(n==="("){let i=e.indexOf(")",t+1);i!==-1&&e[i+1]==="."?(s.push({name:r,suffix:"method"}),t=i+2):i!==-1?(s.push({name:r,suffix:"method"}),t=i+1):(s.push({name:r,suffix:"term"}),t++)}else{let i=y[n];i&&s.push({name:r,suffix:i}),t+=1}}return s}function h(e){return e==="/"||e==="#"||e==="."||e==="("||e==="["||e===":"||e==="!"}function R(e){let s=a(e);if("kind"in s&&s.kind==="local")return`local:${s.id}`;let t=s;if(t.descriptors.length===0)return t.raw;let r=[];for(let n of t.descriptors){let i=k(n);i&&r.push(i)}return r.join(":")}function k(e){let s=e.suffix==="namespace"?F(e.name):e.name;return s?e.suffix==="method"?`${s}()`:s:""}function F(e){return e.replace(/\.(ts|tsx|js|jsx|mjs|cjs)$/,"").replace(/\.(py|pyi)$/,"").replace(/\.(rs)$/,"").replace(/\.(java|scala|kt|kts)$/,"").replace(/\.(rb)$/,"").replace(/\.(go)$/,"").replace(/\.(cs|vb)$/,"").replace(/\.(dart)$/,"").replace(/\.(php)$/,"").replace(/\.(c|cc|cpp|cxx|h|hpp)$/,"")}function $(e){let s=a(e);if("kind"in s&&s.kind==="local")return s.id;let t=s;return t.descriptors.length===0?"":t.descriptors[t.descriptors.length-1].name}function p(e){let s=a(e);if("kind"in s&&s.kind==="local")return null;let t=s;return t.descriptors[t.descriptors.length-1]?.suffix??null}function T(e){return e.endsWith("().")||p(e)==="method"}function j(e){let s=p(e);return s==="method"?!0:s!=="term"?!1:e.endsWith("().")||!e.startsWith("scip-typescript ")?!0:!/#[A-Za-z0-9_$]+\.$/.test(e)}function I(e){return p(e)==="namespace"}var D=/^rust-analyzer\b.*[\s/]impl#\[[^\]]+\]\[[^\]]+\]/;function L(e){return D.test(e)}var E=new Set(["test","tests","_tests"]);function O(e){let s=a(e);if("kind"in s)return!1;for(let t=0;t<s.descriptors.length-1;t+=1){let r=s.descriptors[t];if(r?.suffix==="namespace"&&r.name&&E.has(r.name))return!0}return!1}function P(e,s){let t=a(e),r=a(s);if("kind"in t||"kind"in r)return!1;let n=t.descriptors,i=r.descriptors;if(i.length!==n.length+1)return!1;for(let o=0;o<n.length;o++){let c=n[o],l=i[o];if(c.name!==l.name||c.suffix!==l.suffix)return!1}return!0}function _(e,s){let t=a(e),r=a(s);if("kind"in t||"kind"in r)return!1;let n=t.descriptors,i=r.descriptors;if(i.length<=n.length)return!1;for(let o=0;o<n.length;o++){let c=n[o],l=i[o];if(c.name!==l.name||c.suffix!==l.suffix)return!1}return!0}function z(e){return{forFile(s,t){return b(e,s,t)},forFiles(s,t){let r=new Map;for(let n of s)r.set(n,b(e,n,t));return r}}}function b(e,s,t){let r={file:s},n=t.facts||t.identifiers;if(t.text&&(r.text=u(e,s)),t.lines&&(r.lines=d(e,s)),t.ast&&(r.ast=m(e,s)),t.imports&&(r.imports=x(e,s)),t.reexports&&(r.reexports=S(e,s)),n){let i=g(e,s),o=i.facts;t.facts&&(r.facts=o),i.unavailable&&(r.sourceFactsUnavailable=i.unavailable),t.identifiers&&o&&(r.identifiers=o.fileIdentifiers,r.identifierLineMap=o.identifierLineMap)}return r}export{z as a,a as b,M as c,R as d,$ as e,p as f,T as g,j as h,I as i,L as j,O as k,P as l,_ as m};
|
|
2
|
+
//# sourceMappingURL=chunk-HXXMPYEF.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as be}from"./chunk-CW3KZ7UF.js";import{a as ye}from"./chunk-ZRIOGL7F.js";import{a as ne,c as oe,d as re,e as w}from"./chunk-75X52JTA.js";import{a as pe}from"./chunk-2LQWMYG4.js";import{b as ie}from"./chunk-EDB7Y442.js";import{a as ge}from"./chunk-D7J6GZAG.js";import{a as me}from"./chunk-C2QSK7E7.js";import{a as de}from"./chunk-EZ5WDZ2Q.js";import{a as fe}from"./chunk-OVMUVXKQ.js";import{a as ce}from"./chunk-EXKLAEB4.js";import{a as le}from"./chunk-ZOIPAYRP.js";import{a as Y,b as J,c as Z,g as j,h as B}from"./chunk-HSU3M25J.js";import{a as Q,b as D,e as X}from"./chunk-H7NSJ7L2.js";import{a as ee,b as te}from"./chunk-Q3B3FNCU.js";import{b as ae}from"./chunk-FBCOFKEC.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-BCNT6ODA.js";import{a as se}from"./chunk-ORBRX2QJ.js";import{a as O}from"./chunk-UAHZ57BR.js";import{f as R,g as T}from"./chunk-NAH5EAZS.js";import{i as H}from"./chunk-MKM7NBZK.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-IRJDYTNZ.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import{a as Ce,b as ke,i as Le,j as y,m as _e,o as Fe,p as g,q as Pe}from"./chunk-WS3Z6W3M.js";import{b as v,g as U}from"./chunk-GNG622H3.js";import{a as Te}from"./chunk-64MNV6AB.js";import{c as re,d as z,e as _,f as be}from"./chunk-7S5E7KWT.js";import{existsSync as se,readFileSync as ie,readdirSync as Ft,statSync as Pt}from"fs";import{join as A,relative as wt}from"path";function we(e){let t=At(e)??Bt(e);if(!t||t.length===0)return[];let n=[],r=new Set;for(let o of t)for(let s of jt(e,o)){if(r.has(s))continue;r.add(s);let i=It(e,s);i&&n.push(i)}return n}function At(e){let t=A(e,"pnpm-workspace.yaml");if(!se(t))return null;try{return Et(ie(t,"utf8"))}catch{return null}}function Et(e){let t=[],n=!1;for(let r of e.split(/\r?\n/)){let o=Vt(r);if(!n){/^packages\s*:\s*$/.test(o.trim())&&(n=!0);continue}let s=/^\s+-\s*(.+)$/.exec(o);if(s){let i=Rt(s[1].trim());i&&t.push(i);continue}if(o.trim()!=="")break}return t}function Vt(e){let t=e.indexOf("#");return t===-1?e:e.slice(0,t)}function Rt(e){return e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'")?e.slice(1,-1):e}function Bt(e){let t=A(e,"package.json");if(!se(t))return null;try{let n=JSON.parse(ie(t,"utf8"));return n.workspaces?Array.isArray(n.workspaces)?n.workspaces:n.workspaces.packages??[]:null}catch{return null}}function jt(e,t){if(!t||t.startsWith("!")||t.includes("node_modules"))return[];if(!t.includes("*")){let i=A(e,t);return oe(i)?[i]:[]}let n=t.indexOf("*"),r=t.slice(0,n).replace(/\/$/,""),o=t.slice(n+1).replace(/^\//,""),s=A(e,r||".");return oe(s)?Ft(s).map(i=>A(s,i,o)).filter(oe):[]}function oe(e){try{return Pt(e).isDirectory()}catch{return!1}}function It(e,t){let n=A(t,"package.json");if(!se(n))return null;try{let r=JSON.parse(ie(n,"utf8"));return typeof r.name!="string"||r.name.length===0?null:{name:r.name,relativeDir:wt(e,t).replace(/\\/g,"/"),exports:r.exports}}catch{return null}}import{extname as Ae}from"path";var $t={".rs":"rust",".ts":"typescript",".mts":"typescript",".cts":"typescript",".tsx":"tsx",".js":"javascript",".jsx":"javascript",".mjs":"javascript",".cjs":"javascript",".py":"python",".pyi":"python",".java":"java",".kt":"kotlin",".kts":"kotlin",".scala":"scala",".sc":"scala",".rb":"ruby",".c":"c",".h":"c",".cc":"cpp",".cpp":"cpp",".cxx":"cpp",".hpp":"cpp",".hh":"cpp",".hxx":"cpp",".cs":"csharp",".php":"php",".vb":"vb",".clj":"clojure",".cljs":"clojure",".cljc":"clojure"};function M(e){return $t[Ae(e).toLowerCase()]??null}function Ee(e){return Ae(e).toLowerCase()===".vue"}import{createRequire as Dt}from"module";var d=Dt(import.meta.url),q=null,Ve=!1;function Ot(){if(Ve)return null;if(q)return q;try{return q=d("tree-sitter"),q}catch{return Ve=!0,null}}var Re=new Map,H=new Set;function Wt(e){if(H.has(e))return null;let t=Re.get(e);if(t)return t;let n;try{switch(e){case"rust":n=d("tree-sitter-rust");break;case"typescript":n=d("tree-sitter-typescript").typescript;break;case"tsx":n=d("tree-sitter-typescript").tsx;break;case"javascript":n=d("tree-sitter-javascript");break;case"python":n=d("tree-sitter-python");break;case"java":n=d("tree-sitter-java");break;case"kotlin":n=d("tree-sitter-kotlin");break;case"scala":n=d("tree-sitter-scala");break;case"ruby":n=d("tree-sitter-ruby");break;case"c":n=d("tree-sitter-c");break;case"cpp":n=d("tree-sitter-cpp");break;case"csharp":n=d("tree-sitter-c-sharp");break;case"php":n=d("tree-sitter-php").php;break;case"vb":{let r=d("tree-sitter-vb-dotnet");n=r.language??r;break}case"clojure":return H.add(e),null}}catch{return H.add(e),null}return Re.set(e,n),n}var Be=new Map;function zt(e){let t=Be.get(e);if(t)return t;let n=Wt(e);if(!n)return null;let r=Ot();if(!r)return null;let o=new r;try{o.setLanguage(n)}catch{return H.add(e),null}return Be.set(e,o),o}function Ut(e,t){return e.parse(r=>r>=t.length?null:t.slice(r,Math.min(t.length,r+16384)))}function I(e,t){let n=zt(e);if(!n)return null;try{return Ut(n,t)}catch{return null}}import{posix as ae}from"path";import{parse as Mt}from"@vue/compiler-sfc";var qt=_("vue-sfc-units");function E(e,t){let n=$e(t),r=g(e,n);return qt.get(e,n,r,()=>ce(e,n,r))}function $e(e){return e.replace(/\\/g,"/").replace(/^\.\//,"")}function Ht(e){let t=e?.toLowerCase();return!t||t==="js"||t==="javascript"||t==="jsx"?"javascript":t==="ts"||t==="typescript"?"typescript":t==="tsx"?"tsx":null}function F(e){return!e||e.body.length===0?0:e.body.split(`
|
|
2
|
+
`).length}function ce(e,t,n){let r={relativePath:t,template:null,scripts:[],styles:[],customBlocks:[],errors:[]};if(!n)return r;let o;try{o=Mt(n,{filename:t})}catch(i){return r.errors.push(Ie(i)),r}r.errors.push(...o.errors.map(Ie));let{descriptor:s}=o;return s.template&&(r.template=J(e,t,"template",s.template)),s.script&&r.scripts.push(je(e,t,s.script,!1)),s.scriptSetup&&r.scripts.push(je(e,t,s.scriptSetup,!0)),r.styles=s.styles.map(i=>J(e,t,"style",i)),r.customBlocks=s.customBlocks.map(i=>J(e,t,"custom",i)),r.errors.push(...[r.template,...r.scripts,...r.styles,...r.customBlocks].flatMap(i=>i?.errors??[])),r}function je(e,t,n,r){let o=J(e,t,"script",n);return{...o,kind:"script",setup:r,astLanguage:Ht(o.lang)}}function J(e,t,n,r){let o=Zt(r.attrs),s=typeof o.lang=="string"?o.lang:null,i=typeof o.src=="string"?o.src:typeof r.src=="string"?r.src:void 0;if(i){let c=Jt(t,i);if(!c)return{kind:n,ownerPath:t,sourcePath:t,external:!0,src:i,attrs:o,lang:s,body:"",startLine:0,endLine:0,errors:[`Could not resolve Vue ${n} block source: ${i}`]};let l=g(e,c),f=l?Math.max(0,l.split(`
|
|
3
|
+
`).length-1):0;return{kind:n,ownerPath:t,sourcePath:c,external:!0,src:i,attrs:o,lang:s,body:l,startLine:0,endLine:f,errors:l?[]:[`Vue ${n} block source not found: ${c}`]}}let a=Math.max(0,r.loc.start.line-1);return{kind:n,ownerPath:t,sourcePath:t,external:!1,attrs:o,lang:s,body:r.content,startLine:a,endLine:Math.max(a,r.loc.end.line-1),errors:[]}}function Jt(e,t){let n=t.split(/[?#]/,1)[0];if(!n||n.startsWith("/")||n.includes("://"))return null;let r=$e(ae.normalize(ae.join(ae.dirname(e),n)));return r===".."||r.startsWith("../")?null:r}function Zt(e){return{...e}}function Ie(e){return e instanceof Error?e.message:String(e)}function De(e,t,n){let o=ce(e,t,n).scripts.filter(i=>i.astLanguage&&i.body.length>0),s=o[0]?.astLanguage;return s?{body:o.map(i=>`${`
|
|
4
|
+
`.repeat(i.startLine)}${i.body}`).join(`
|
|
5
|
+
`),startLine:0,language:s}:null}var Oe=be("ast-trees",{clearGroups:["whole-project","source-file"]});function We(e,t){if(Ee(t))return Xt(e,t);let n=M(t);if(!n)return null;let r=g(e,t);return r?Oe.get(e,t,r,()=>I(n,r)):null}function Xt(e,t){let n=g(e,t);return n?Oe.get(e,t,n,()=>{let r=De(e,t,n);if(!r)return null;let o=`
|
|
6
|
+
`.repeat(r.startLine)+r.body;return I(r.language,o)}):null}import{extname as Yt}from"path";function Z(e,t){let n=Gt(e,t);if(!n)return null;let r=le(n);return r?{calleeLeaf:r,memberAccess:Qt(n),line:e.startPosition.row}:null}function Gt(e,t){if(t==="rust")return e.type==="call_expression"?e.childForFieldName("function")??e.namedChild(0):e.type==="macro_invocation"?e.childForFieldName("macro")??e.namedChild(0):null;if(t==="python")return e.type!=="call"?null:e.childForFieldName("function")??e.namedChild(0);if(t==="typescript"||t==="tsx"||t==="javascript"){if(e.type==="call_expression")return e.childForFieldName("function")??e.namedChild(0);if(e.type==="new_expression")return e.childForFieldName("constructor")??e.namedChild(0)}return null}function Qt(e){switch(e.type){case"field_expression":case"member_expression":case"attribute":return!0;default:return!1}}function le(e){switch(e.type){case"identifier":case"type_identifier":case"property_identifier":case"shorthand_property_identifier":return e.text;case"field_expression":case"member_expression":case"attribute":{let t=e.namedChild(e.namedChildCount-1);return t?le(t):null}case"scoped_identifier":{let t=e.childForFieldName("name")??e.namedChild(e.namedChildCount-1);return t?le(t):null}case"super":case"self":case"this":return null;default:return null}}var Kt=new Set(["children","className","data","e","err","error","ev","event","false","id","idx","index","item","key","null","props","res","result","state","style","true","undefined","val","value"]);function X(e){return e.length<=2||Kt.has(e)}var en=[".tsx",".jsx"],ze=new Set(["useActionState","useCallback","useContext","useDebugValue","useDeferredValue","useEffect","useId","useImperativeHandle","useInsertionEffect","useLayoutEffect","useMemo","useOptimistic","useReducer","useRef","useState","useSyncExternalStore","useTransition"]),tn=new Set(["useEffect","useInsertionEffect","useLayoutEffect"]),nn=new Set(["useActionState","useOptimistic","useReducer","useRef","useState"]),rn=new Set(["useLocation","useNavigate","useParams","useSearchParams","useTranslation"]),on=new Set(["axios","fetch","gql","graphql","mutate","query","request","useMutation","useQuery","useSuspenseQuery"]),sn=new Set(["add","apply","cancel","change","clear","close","create","delete","fetch","filter","handle","load","open","refresh","remove","render","reset","save","select","submit","toggle","update"]),an=new Set(["aria-hidden","className","clipRule","d","fill","fillRule","height","role","stroke","strokeLinecap","strokeLinejoin","strokeWidth","style","viewBox","width","xmlns"]),cn=_("react-component-behavior-profiles"),Ue=_e({kind:"react-component-behavior-profiles",invalidation:Fe("react-component-behavior-profiles"),serialize:fn,deserialize:mn});function Je(e,t={}){let n=U(e,{extensions:en}).filter(o=>!t.scope||o.includes(t.scope)).sort();return(typeof t.scanLimit=="number"&&t.scanLimit>0?n.slice(0,t.scanLimit):n).flatMap(o=>pe(e,o)).filter(o=>(t.minJsxTokens===void 0||o.jsxTokens.size>=t.minJsxTokens)&&(t.minBehaviorTokens===void 0||o.behaviorTokens.size>=t.minBehaviorTokens))}function pe(e,t){let n=t.replace(/\\/g,"/"),r=g(e,n);return cn.get(e,n,r,()=>ln(e,n,r)).map(pn)}function ln(e,t,n){let r=ke(e,t,n),o=Ue.read(e,t,r);if(o)return o;let s=un(e,t);return Ue.write(e,t,r,s),s}function un(e,t){let n=gn(t);if(!n)return[];let r=We(e,t);if(!r)return[];let o=Pe(e,t).length;return hn(r.rootNode,n).filter(i=>i.kind==="hook"||fe(i.bodyNode)).map(i=>{let a=Cn(i.bodyNode),c=Fn(i.bodyNode,n);return{file:t,name:i.name,kind:i.kind,startLine:i.node.startPosition.row,endLine:i.node.endPosition.row,loc:Math.max(1,i.node.endPosition.row-i.node.startPosition.row+1),fileLines:o,jsxTokens:a.tokens,behaviorTokens:c.tokens,componentNames:C(a.componentNames),nativeTags:C(a.nativeTags),propNames:C(a.propNames),eventNames:C(a.eventNames),hookNames:C(c.hookNames),requestNames:C(c.requestNames),stateNames:C(c.stateNames),effectNames:C(c.effectNames),handlerNames:C(c.handlerNames)}})}function pn(e){return{...e,jsxTokens:new Set(e.jsxTokens),behaviorTokens:new Set(e.behaviorTokens),componentNames:[...e.componentNames],nativeTags:[...e.nativeTags],propNames:[...e.propNames],eventNames:[...e.eventNames],hookNames:[...e.hookNames],requestNames:[...e.requestNames],stateNames:[...e.stateNames],effectNames:[...e.effectNames],handlerNames:[...e.handlerNames]}}function fn(e){return JSON.stringify(e.map(t=>({...t,jsxTokens:[...t.jsxTokens],behaviorTokens:[...t.behaviorTokens]})))}function mn(e){try{let t=JSON.parse(e);if(!Array.isArray(t))return null;let n=[];for(let r of t){let o=dn(r);if(!o)return null;n.push(o)}return n}catch{return null}}function dn(e){if(!Le(e))return null;let{file:t,name:n,kind:r,startLine:o,endLine:s,loc:i,fileLines:a,jsxTokens:c,behaviorTokens:l,componentNames:f,nativeTags:u,propNames:N,eventNames:B,hookNames:te,requestNames:ne,stateNames:m,effectNames:b,handlerNames:j}=e;if(typeof t!="string"||typeof n!="string"||r!=="component"&&r!=="hook"||!G(o)||!G(s)||!G(i)||!G(a))return null;let S={jsxTokens:y(c),behaviorTokens:y(l),componentNames:y(f),nativeTags:y(u),propNames:y(N),eventNames:y(B),hookNames:y(te),requestNames:y(ne),stateNames:y(m),effectNames:y(b),handlerNames:y(j)};return Object.values(S).some(_t=>_t===null)?null:{file:t,name:n,kind:r,startLine:o,endLine:s,loc:i,fileLines:a,jsxTokens:new Set(S.jsxTokens),behaviorTokens:new Set(S.behaviorTokens),componentNames:S.componentNames,nativeTags:S.nativeTags,propNames:S.propNames,eventNames:S.eventNames,hookNames:S.hookNames,requestNames:S.requestNames,stateNames:S.stateNames,effectNames:S.effectNames,handlerNames:S.handlerNames}}function G(e){return typeof e=="number"&&Number.isFinite(e)}function gn(e){let t=Yt(e).toLowerCase();return t!==".tsx"&&t!==".jsx"?null:M(e)}function hn(e,t){let n=[],r=new Set,o=s=>{let i=Sn(s);if(i&&(!Nn(s)||i.kind==="component")){let a=`${i.name}:${i.node.startIndex}:${i.node.endIndex}`;r.has(a)||(r.add(a),n.push(i))}for(let a of s.namedChildren)o(a)};return(t==="tsx"||t==="javascript")&&o(e),n}function Sn(e){if(e.type==="class_declaration"){let s=ue(e);if(!s||!/^[A-Z]/.test(s))return null;let i=yn(e);return!i||!xn(e)&&!fe(i)?null:{name:s,kind:"component",node:e,bodyNode:i}}if(e.type==="function_declaration"){let s=ue(e);return!s||!Me(s)?null:{name:s,kind:qe(s),node:e,bodyNode:e}}if(e.type!=="variable_declarator")return null;let t=e.childForFieldName("name")??e.namedChild(0),n=e.childForFieldName("value")??e.namedChild(1),r=$(t);if(!r||!n||!Me(r))return null;let o=vn(n);return o?{name:r,kind:qe(r),node:e,bodyNode:o}:null}function yn(e){for(let t of e.namedChildren)if(t.type==="class_body")for(let n of t.namedChildren){if(n.type!=="method_definition")continue;if((n.childForFieldName("name")??n.namedChild(0))?.text==="render")return n}return null}function xn(e){return/\b(?:React\.)?(?:Pure)?Component\b/.test(e.text)}function Me(e){return/^[A-Z]/.test(e)||/^use[A-Z0-9_]/.test(e)}function qe(e){return/^use[A-Z0-9_]/.test(e)?"hook":"component"}function vn(e){if(e.type==="arrow_function"||e.type==="function_expression")return e;if(e.type!=="call_expression")return null;let t=bn(e);return t!=="memo"&&t!=="forwardRef"?null:e.namedChildren.find(o=>o.type==="arguments")?.namedChildren.find(o=>o.type==="arrow_function"||o.type==="function_expression")??null}function Nn(e){let t=e.parent;for(;t;){if(t.type==="function_declaration"||t.type==="function_expression"||t.type==="arrow_function"||t.type==="method_definition")return!0;t=t.parent}return!1}function ue(e){return $(e.childForFieldName("name")??e.namedChild(0))}function bn(e){let t=e.childForFieldName("function")??e.namedChild(0);return t?t.text.split(".").pop()??t.text:null}function fe(e){return e.type.startsWith("jsx_")?!0:e.namedChildren.some(fe)}function Cn(e){let t={tokens:new Set,componentNames:new Set,nativeTags:new Set,propNames:new Set,eventNames:new Set},n=r=>{r.type==="jsx_opening_element"||r.type==="jsx_self_closing_element"?kn(r,t):r.type==="jsx_element"&&r.text.trimStart().startsWith("<>")?t.tokens.add("jsx:fragment"):r.type==="jsx_expression"?Tn(r,t):r.type==="jsx_fragment"&&t.tokens.add("jsx:fragment");for(let o of r.children)n(o)};return n(e),t}function kn(e,t){let n=Ln(e),r=!1;if(n){let o=He(n),s=o==="Fragment"||o==="React.Fragment";r=Vn(o)&&!s,s?t.tokens.add("jsx:fragment"):r?(t.componentNames.add(o),t.tokens.add(`component:${o}`)):(t.nativeTags.add(o),t.tokens.add(`native:${o}`))}for(let o of e.namedChildren)if(o.type==="jsx_attribute"){let s=_n(o);if(!s)continue;let i=He(s);if(i.startsWith("on")&&i.length>2){let a=i.slice(2).replace(/^[A-Z]/,c=>c.toLowerCase());t.eventNames.add(a),t.tokens.add(`event:${a}`)}else an.has(i)||(t.propNames.add(i),t.tokens.add(`${r?"prop":"native-prop"}:${i}`))}else o.type==="jsx_spread_attribute"&&t.tokens.add(Ze(o))}function Tn(e,t){let n=e.text;/^\{\s*\.\.\./.test(n)&&t.tokens.add(Ze(e)),Xe(e)&&t.tokens.add("jsx:conditional"),(n.includes(".map(")||n.includes(".flatMap("))&&t.tokens.add("jsx:list");for(let r of Rn(n))X(r)||t.tokens.add(`binding:${r}`)}function Ze(e){let t=/^\{\s*\.\.\.\s*([^}]+)\s*\}$/.exec(e.text)?.[1],n=e.namedChildren.find(s=>s.type!=="comment"),r=t??n?.text??"",o=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.exec(r.trim())?.[0];return o?`prop:spread:${o}`:"prop:spread"}function Xe(e){return e.type==="ternary_expression"||e.type==="conditional_expression"?!0:e.namedChildren.some(Xe)}function Ln(e){for(let t of e.namedChildren)if(t.type==="identifier"||t.type==="jsx_identifier"||t.type==="property_identifier"||t.type==="member_expression"||t.type==="jsx_member_expression")return t.text;return/^<\s*([A-Za-z][\w$.]*)/.exec(e.text)?.[1]??null}function _n(e){for(let t of e.namedChildren)if(t.type==="property_identifier"||t.type==="identifier"||t.type==="jsx_identifier")return t.text;return/^([A-Za-z_$][\w$:-]*)/.exec(e.text)?.[1]??null}function Fn(e,t){let n={tokens:new Set,hookNames:new Set,requestNames:new Set,stateNames:new Set,effectNames:new Set,handlerNames:new Set},r=o=>{if(o.type==="call_expression"){let s=Z(o,t);s&&Pn(s.calleeLeaf,n)}else if(o.type==="variable_declarator")An(o,n);else if(o.type==="function_declaration"){let s=ue(o);s&&Ge(s,n)}for(let s of o.namedChildren)r(s)};return r(e),n}function Pn(e,t){/^use[A-Z0-9_]/.test(e)&&(t.hookNames.add(e),!ze.has(e)&&!rn.has(e)&&t.tokens.add(`hook:${e}`)),ze.has(e)&&t.tokens.add(`react-hook:${e}`),tn.has(e)&&(t.effectNames.add(e),t.tokens.add(`effect:${e}`)),nn.has(e)&&t.tokens.add(`state-hook:${e}`),wn(e)&&(t.requestNames.add(e),t.tokens.add(`request:${e}`))}function wn(e){if(on.has(e))return!0;let t=/^use([A-Z0-9_].*)$/.exec(e)?.[1];return t?/(Query|Mutation|Fetch|Resource)$/.test(t):!1}function An(e,t){let n=e.childForFieldName("name")??e.namedChild(0),r=e.childForFieldName("value")??e.namedChild(1);if(n?.type==="array_pattern"&&r?.text.includes("useState")){let s=n.namedChildren.find(a=>$(a)),i=$(s);i&&(t.stateNames.add(i),t.tokens.add(`state:${i}`))}let o=$(n);o&&Ge(o,t)}function Ge(e,t){let n=En(e);!n||!sn.has(n)||(t.handlerNames.add(e),t.tokens.add(`handler:${e}`),t.tokens.add(`handler-verb:${n}`))}function En(e){let t=e.startsWith("handle")&&e.length>6?e.slice(6).replace(/^[A-Z]/,n=>n.toLowerCase()):e;return/^[a-z]+/.exec(t)?.[0]??null}function Vn(e){return/^[A-Z]/.test(e)||e.includes(".")}function He(e){return e.replace(/^this\./,"").replace(/\$/g,".")}function $(e){return e&&(e.type==="identifier"||e.type==="property_identifier"||e.type==="shorthand_property_identifier"||/^[A-Za-z_$][\w$]*$/.test(e.text))?e.text:null}function Rn(e){let t=[];for(let n of e.matchAll(/\b[A-Za-z_$][\w$]*\b/g)){let r=n[0];t.includes(r)||t.push(r)}return t}function C(e){return[...e].sort()}function D(e){return e.type==="comment"||e.type==="line_comment"||e.type==="block_comment"}var Bn=new Set(["function_declaration","method_definition","method_signature","function_signature"]);function tt(e,t){let n=In(e,t);if(n)return{name:n.name,startLine:n.definitionNode.startPosition.row,endLine:n.definitionNode.endPosition.row,paramCount:Ye(n.functionNode),params:Qe(n.functionNode),paramsEndLine:Ke(n.functionNode),isLiteralPassthrough:et(n.functionNode,t)};if(!jn(e.type,t))return null;let r=e.childForFieldName("name")??e.namedChildren.find(o=>o.type==="identifier"||o.type==="property_identifier");return r?{name:r.text,startLine:e.startPosition.row,endLine:e.endPosition.row,paramCount:Ye(e),params:Qe(e),paramsEndLine:Ke(e),isLiteralPassthrough:et(e,t)}:null}function nt(e){return e.namedChildren.find(t=>t.type==="parameters"||t.type==="formal_parameters")}function Qe(e){let t=nt(e);if(!t)return[];let n=[];for(let r of t.namedChildren){if(D(r))continue;if(r.type==="identifier"){n.push({name:r.text,simple:!0});continue}let o=r.namedChildren.some(a=>a.type.endsWith("_modifier"))||/^\s*(?:public|private|protected|readonly|override)\b/.test(r.text),s=r.childForFieldName("pattern");if(!o&&s&&s.type==="identifier"){n.push({name:s.text,simple:!0});continue}let i=r.namedChildren.find(a=>a.type==="identifier");n.push({name:s?.type==="identifier"?s.text:i?.text??"",simple:!1})}return n}function Ke(e){let t=nt(e);return t?t.endPosition.row:e.startPosition.row}function jn(e,t){return t==="rust"?e==="function_item"||e==="function_signature_item":t==="python"?e==="function_definition":t==="typescript"||t==="tsx"||t==="javascript"?Bn.has(e):!1}function In(e,t){if(t!=="typescript"&&t!=="tsx"&&t!=="javascript")return null;if(e.type==="variable_declarator"){let n=e.childForFieldName("name")??e.namedChild(0),r=e.childForFieldName("value")??e.namedChild(1);return!n||!r||r.type!=="arrow_function"&&r.type!=="function_expression"?null:{name:n.text,definitionNode:e,functionNode:r}}if(e.type==="public_field_definition"){let n=e.childForFieldName("name")??e.namedChild(0),r=e.childForFieldName("value")??e.namedChild(1);return!n||!r||r.type!=="arrow_function"&&r.type!=="function_expression"?null:{name:n.text,definitionNode:e,functionNode:r}}return null}function Ye(e){let t=e.namedChildren.find(r=>r.type==="parameters"||r.type==="formal_parameters");if(!t)return 0;let n=0;for(let r of t.namedChildren)D(r)||(n+=1);return n}function et(e,t){let n=e.namedChildren.find(u=>u.type==="block"||u.type==="statement_block");if(!n)return!1;let r=n.namedChildren.filter(u=>!D(u));if(r.length!==1)return!1;let o=r[0],s=null;if(o.type==="return_statement"||o.type==="expression_statement"?s=o.namedChild(0)??null:t==="rust"&&(o.type==="call_expression"||o.type==="macro_invocation")&&(s=o),!s)return!1;let i=t==="python"?"call":"call_expression";if(s.type!==i)return!1;let a=s.namedChildren.find(u=>u.type==="arguments"||u.type==="argument_list");if(!a)return!1;let c=a.namedChildren.filter(u=>!D(u)),l=e.namedChildren.find(u=>u.type==="parameters"||u.type==="formal_parameters");if(!l)return!1;let f=[];for(let u of l.namedChildren){if(u.type==="identifier"){f.push(u.text);continue}let N=u.namedChildren.find(B=>B.type==="identifier");N&&f.push(N.text)}if(c.length!==f.length)return!1;for(let u=0;u<f.length;u+=1){let N=c[u];if(N.type!=="identifier"||N.text!==f[u])return!1}return!0}var $n=new Set(["ref","shallowRef","reactive","computed","watch","watchEffect"]),Dn=new Set(["onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","onActivated","onDeactivated","onErrorCaptured"]),On=new Set(["axios","fetch","runRequest","useAsyncData","useFetch","useResource"]),Wn=new Set(["defineEmits","defineExpose","defineModel","defineOptions","defineProps","withDefaults"]),zn=new Set(["catch","for","function","if","return","switch","while"]);function K(e){let t={imports:[],functions:[],calls:[],composables:[],stores:[],reactivity:[],lifecycle:[],requests:[],macros:[],lineCount:0,externalLineCount:0,externalScriptPaths:[],unresolvedScripts:[]};for(let n of e.scripts){t.lineCount+=F(n),n.external&&(t.externalLineCount+=F(n),t.externalScriptPaths.push(n.sourcePath));for(let o of n.errors)t.unresolvedScripts.push({sourcePath:n.sourcePath,reason:o});if(!n.body||!n.astLanguage){n.astLanguage||t.unresolvedScripts.push({sourcePath:n.sourcePath,reason:`Unsupported Vue script language: ${n.lang??"unknown"}`});continue}t.imports.push(...Hn(n));let r=I(n.astLanguage,n.body);r?Mn(n,r.rootNode,t):qn(n,t)}return Un(t),t.externalScriptPaths=ot(t.externalScriptPaths),t}function Un(e){e.composables=V(e,"composable"),e.stores=V(e,"store"),e.reactivity=V(e,"reactivity"),e.lifecycle=V(e,"lifecycle"),e.requests=V(e,"request"),e.macros=V(e,"macro")}function V(e,t){return ot(e.calls.filter(n=>n.categories.includes(t)).map(n=>n.name))}function Mn(e,t,n){let r=new Set,o=new Set,s=i=>{let a=tt(i,e.astLanguage);if(a){let l=`${a.name}:${a.startLine}:${a.endLine}`;o.has(l)||(o.add(l),n.functions.push({name:a.name,sourcePath:e.sourcePath,startLine:e.startLine+a.startLine,endLine:e.startLine+a.endLine,setup:e.setup}))}let c=Z(i,e.astLanguage);if(c){let l=`${c.calleeLeaf}:${c.line}`;r.has(l)||(r.add(l),n.calls.push({name:c.calleeLeaf,sourcePath:e.sourcePath,line:e.startLine+c.line,categories:rt(c.calleeLeaf),setup:e.setup}))}for(let l of i.children)s(l)};s(t)}function qn(e,t){for(let n of e.body.matchAll(/\b([A-Za-z_$][\w$]*)\s*\(/g)){let r=n[1];!r||zn.has(r)||t.calls.push({name:r,sourcePath:e.sourcePath,line:e.startLine+Q(e.body,n.index??0),categories:rt(r),setup:e.setup})}for(let n of e.body.matchAll(/\bfunction\s+([A-Za-z_$][\w$]*)\b/g)){let r=n[1];if(!r)continue;let o=e.startLine+Q(e.body,n.index??0);t.functions.push({name:r,sourcePath:e.sourcePath,startLine:o,endLine:o,setup:e.setup})}for(let n of e.body.matchAll(/\b(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*(?:async\s*)?(?:function\b|\([^)]*\)\s*=>|[A-Za-z_$][\w$]*\s*=>)/g)){let r=n[1];if(!r)continue;let o=e.startLine+Q(e.body,n.index??0);t.functions.push({name:r,sourcePath:e.sourcePath,startLine:o,endLine:o,setup:e.setup})}}function Hn(e){let t=[];for(let n of e.body.matchAll(/\bimport\s+(?:type\s+)?([^'";]+?)\s+from\s+['"]([^'"]+)['"]/g)){let r=n[1]?.trim(),o=n[2];if(!r||!o)continue;let s=e.startLine+Q(e.body,n.index??0);for(let i of Jn(r))t.push({local:i,source:o,sourcePath:e.sourcePath,line:s,setup:e.setup})}return t}function Jn(e){let t=[],r=e.split(",").map(i=>i.trim()).filter(Boolean)[0];r&&!r.startsWith("{")&&!r.startsWith("*")&&t.push(r);let o=/\{([^}]*)\}/.exec(e)?.[1];if(o)for(let i of o.split(",")){let a=i.trim();if(!a)continue;let c=/\bas\s+([A-Za-z_$][\w$]*)$/.exec(a)?.[1];t.push(c??a.replace(/^type\s+/,"").trim())}let s=/\*\s+as\s+([A-Za-z_$][\w$]*)/.exec(e)?.[1];return s&&t.push(s),t.filter(i=>/^[A-Za-z_$][\w$]*$/.test(i))}function rt(e){let t=["call"];return/^use[A-Z0-9_]/.test(e)&&t.push("composable"),/^use[A-Z0-9_].*Store$/.test(e)&&t.push("store"),$n.has(e)&&t.push("reactivity"),Dn.has(e)&&t.push("lifecycle"),On.has(e)&&t.push("request"),Wn.has(e)&&t.push("macro"),t}function Q(e,t){let n=0;for(let r=0;r<t&&r<e.length;r+=1)e.charCodeAt(r)===10&&(n+=1);return n}function ot(e){return[...new Set(e)].sort()}import{ElementTypes as Zn,NodeTypes as me,parse as Xn}from"@vue/compiler-dom";import{parse as ss}from"@vue/compiler-sfc";function st(e,t){return e.split(t).filter(Boolean).map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join("")}var Gn=_("vue-template-facts"),Qn=new Set(["component","keep-alive","slot","suspense","teleport","template","transition","transition-group"]),Kn=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]),Yn=new Set(["div","span","template"]),er=new Set(["as","await","break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","false","finally","for","from","function","if","import","in","instanceof","let","new","null","of","return","super","switch","this","throw","true","try","typeof","undefined","var","void","while","with","yield"]);function Y(e,t){let n=t.replace(/\\/g,"/"),r=g(e,n);return Gn.get(e,n,r,()=>tr(n,E(e,n).template))}function tr(e,t){let n={relativePath:e,template:t?{startLine:t.startLine,endLine:t.endLine}:null,componentTags:[],nativeTags:[],builtinTags:[],props:[],events:[],directives:[],slots:[],expressionIdentifiers:[],structuralTokens:[]};if(!t)return n;let r;try{r=Xn(t.body,{comments:!1})}catch{return n}let o=new Set,s=i=>{i.trim()&&o.add(i)};return at(r.children,t.startLine,n,s),n.structuralTokens=[...o].sort(),n}function at(e,t,n,r){for(let o of e)if(o.type===me.ELEMENT)nr(o,t,n,r),at(o.children,t,n,r);else if(o.type===me.INTERPOLATION){r("interpolation");let s=de(o.content);s&&ct(s,t,o.loc.start.line,n,r)}}function nr(e,t,n,r){let o=lr(e.tag),s={tag:e.tag,normalized:o,kind:cr(e),startLine:R(t,e.loc.start.line),endLine:R(t,e.loc.end.line)};s.kind==="component"?(n.componentTags.push(s),r(`component:${o}`)):s.kind==="builtin"?(n.builtinTags.push(s),r(`builtin:${o}`)):(n.nativeTags.push(s),Yn.has(e.tag)||r(`native:${e.tag}`));for(let i of e.props)rr(i,t,n,r)}function rr(e,t,n,r){if(e.type===me.ATTRIBUTE){let a=e.value?.content??null,c=it("prop",e.name,a,t,e.loc.start.line,e.loc.end.line);n.props.push(c),r(`prop:${e.name}`);return}let o=sr(e),s=de(e.exp),i=it(or(e.name),o,s,t,e.loc.start.line,e.loc.end.line);switch(i.kind){case"prop":n.props.push(i),r(`prop:${o}`);break;case"event":n.events.push(i),r(`event:${o}`);break;case"slot":n.slots.push(i),r(`slot:${o}`);break;case"directive":n.directives.push(i),r(`directive:${o}`);break}s&&ct(s,t,e.loc.start.line,n,r)}function it(e,t,n,r,o,s){return{kind:e,name:t,value:n,startLine:R(r,o),endLine:R(r,s)}}function or(e){switch(e){case"bind":case"model":return"prop";case"on":return"event";case"slot":return"slot";default:return"directive"}}function sr(e){let t=de(e.arg);return t||e.name}function de(e){if(!e)return null;let t=("content"in e&&typeof e.content=="string"?e.content:e.loc.source).trim();return t||null}function ct(e,t,n,r,o){for(let s of ir(e)){let i={name:s,startLine:R(t,n),endLine:R(t,n)};r.expressionIdentifiers.push(i),o(`id:${s}`)}}function ir(e){let t=new Set,n=ar(e),r=/\b[A-Za-z_$][A-Za-z0-9_$]*\b/g,o;for(;o=r.exec(n);){let s=o[0];er.has(s)||X(s)||/^[A-Z_]+$/.test(s)||t.add(s)}return[...t].sort()}function ar(e){return e.replace(/\/\*[\s\S]*?\*\//g," ").replace(/\/\/.*$/gm," ").replace(/`(?:\\[\s\S]|\$\{([^}]*)\}|[^`\\])*`/g,(t,n)=>n??" ").replace(/'(?:\\[\s\S]|[^'\\])*'/g," ").replace(/"(?:\\[\s\S]|[^"\\])*"/g," ")}function cr(e){let t=e.tag;return e.tagType===Zn.COMPONENT?"component":Qn.has(t)?"builtin":Kn.has(t)?"native":/^[A-Z]/.test(t)||t.includes("-")?"component":"native"}function lr(e){return st(e,/[-_:]/)}function R(e,t){return e+Math.max(0,t-1)}import{createRequire as ur}from"module";import{existsSync as w}from"fs";import{basename as lt,dirname as h,extname as k,join as x,relative as P,resolve as p,sep as pr}from"path";var fr=z("indexed-paths",{clearGroups:[]}),mr=z("indexed-path-digest",{clearGroups:[]}),dr=re("tsconfig-alias-config",{clearGroups:["whole-project"]}),gr=re("tsconfig-alias-config-for-dir",{clearGroups:["whole-project"]}),hr=ur(import.meta.url),O;function Sr(){if(O!==void 0)return O;try{O=hr("typescript")}catch{O=null}return O}var yr=["tsconfig.json","tsconfig.app.json","tsconfig.node.json","tsconfig.base.json"],xr=z("workspace-packages",{clearGroups:["whole-project"]}),W=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue"],ut=[".py",".pyi"],pt=[".java",".scala",".kt",".kts"],ft=[".rs"],mt=[".rb"],dt=[".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx"],gt=[".cs",".vb"],ht=[".dart"],St=[".php"],ee=[".clj",".cljs",".cljc"],vr=new Set(W),ge=new Set(ut),yt=new Set(pt),he=new Set(ft),Se=new Set(mt),xt=new Set(dt),vt=new Set(gt),ye=new Set(ht),Nt=new Set(St),bt=new Set(ee),Nr=[{extensions:W,lookup:vr},{extensions:ut,lookup:ge},{extensions:pt,lookup:yt},{extensions:ft,lookup:he},{extensions:mt,lookup:Se},{extensions:dt,lookup:xt},{extensions:gt,lookup:vt},{extensions:ht,lookup:ye},{extensions:St,lookup:Nt},{extensions:ee,lookup:bt}];function T(e,t){return t.has(k(e).toLowerCase())}function br(e){return T(e,ge)}function Cr(e){return T(e,yt)}function kr(e){return T(e,he)}function Tr(e){return T(e,Se)}function Lr(e){return T(e,xt)}function _r(e){return T(e,vt)}function vs(e){return k(e).toLowerCase()===".vb"}function Fr(e){return T(e,ye)}function Pr(e){return T(e,Nt)}function wr(e){return T(e,bt)}function Ar(e){let t=k(e).toLowerCase();for(let n of Nr)if(n.lookup.has(t))return n.extensions;return W}function Er(e){return Cr(e)||_r(e)||Pr(e)}function Ct(e,t,n){return br(t)?qr(e,t,n):kr(t)?Hr(e,t,n):Tr(t)?Jr(e,t,n):Lr(t)?Zr(e,t,n):Er(t)?Xr(e,n.replace(/\\/g,"."),Ar(t)):Fr(t)?Gr(e,t,n):wr(t)?Qr(e,n):Vr(e,t,n)}function Vr(e,t,n){if(!n.startsWith(".")&&!n.startsWith("/"))return Rr(e,t,n)??jr(e,n);let r=h(x(e.config.projectRoot,t)),o=p(r,n),s=L(e);for(let i of ve(o)){let a=v(P(e.config.projectRoot,i));if(s.has(a)||w(i))return a}return v(P(e.config.projectRoot,o))}function Rr(e,t,n){let r=zr(e,t);if(!r)return null;let o=L(e);for(let s of Br(r,n)){let i=p(r.baseUrl,s);for(let a of ve(i)){let c=v(P(e.config.projectRoot,a));if(o.has(c)||w(a))return c}}return null}function Br(e,t){let n=[];for(let[r,o]of Object.entries(e.paths)){let s=r.indexOf("*");if(s===-1){if(t!==r)continue;n.push(...o);continue}let i=r.slice(0,s),a=r.slice(s+1);if(!t.startsWith(i)||!t.endsWith(a)||t.length<i.length+a.length)continue;let c=t.slice(i.length,t.length-a.length);for(let l of o)n.push(l.includes("*")?l.replace("*",c):l)}return n}function jr(e,t){let n=$r(Ir(e),t);if(!n)return null;let r=L(e);for(let o of Dr(n)){let s=p(e.config.projectRoot,n.pkg.relativeDir,o);for(let i of ve(s)){let a=v(P(e.config.projectRoot,i));if(r.has(a)||w(i))return a}}return null}function Ir(e){return xr.get(e,()=>we(e.config.projectRoot))}function $r(e,t){let n=null;for(let r of e){let o=null;t===r.name?o="":t.startsWith(`${r.name}/`)&&(o=t.slice(r.name.length+1)),o!==null&&(!n||r.name.length>n.pkg.name.length)&&(n={pkg:r,subpath:o})}return n}function Dr(e){let t=[],n=Or(e.pkg.exports,e.subpath);if(n){let r=Wr(n);r&&t.push(r)}return t.push(e.subpath?`src/${e.subpath}`:"src/index"),t}function Or(e,t){if(!e||typeof e!="object")return null;let n=t===""?".":`./${t}`;return kt(e[n])}function kt(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return null;let t=e;for(let n of["types","import","default","require","node"]){let r=kt(t[n]);if(r)return r}return null}function Wr(e){let t=e.replace(/^\.\//,"");return t.startsWith("dist/")?`src/${t.slice(5)}`:null}function zr(e,t){let n=v(h(t));return gr.get(e,n,()=>Ur(e,n))}function Ur(e,t){let n=Sr();if(!n)return null;let r=p(e.config.projectRoot),o=p(r,t);for(;o===r||o.startsWith(r+pr);){for(let i of yr){let a=x(o,i);if(!w(a))continue;let c=dr.get(e,a,()=>Mr(n,a));if(c)return c}let s=h(o);if(s===o)break;o=s}return null}function Mr(e,t){try{let n=e.readConfigFile(t,e.sys.readFile);if(n.error||!n.config)return null;let r=e.parseJsonConfigFileContent(n.config,e.sys,h(t)),o=r.options.paths;return!o||Object.keys(o).length===0?null:{baseUrl:r.options.baseUrl?p(h(t),r.options.baseUrl):h(t),paths:o}}catch{return null}}function qr(e,t,n){let r=L(e),o;if(n.startsWith(".")){let s=n.match(/^(\.+)(.*)$/);if(!s)return null;let i=s[1].length,a=s[2].replace(/^\./,""),c=h(x(e.config.projectRoot,t));for(let l=1;l<i;l++)c=h(c);o=a?p(c,a.replace(/\./g,"/")):c}else o=p(e.config.projectRoot,n.replace(/\./g,"/"));for(let s of Kr(o)){let i=v(P(e.config.projectRoot,s));if(r.has(i)||w(s))return i}return null}function Hr(e,t,n){if(!n)return null;let r=n.replace(/\s+as\s+.+$/,"").trim();if(!r.startsWith("crate::")&&!r.startsWith("self::")&&!r.startsWith("super::"))return null;let o=h(x(e.config.projectRoot,t)),s;return r.startsWith("crate::")?s=p(e.config.projectRoot,"src",r.slice(7).replace(/::/g,"/")):r.startsWith("self::")?s=p(o,r.slice(6).replace(/::/g,"/")):s=p(h(o),r.slice(7).replace(/::/g,"/")),xe(e,Yr(s))}function Jr(e,t,n){let r=h(x(e.config.projectRoot,t)),o=p(r,n);return xe(e,eo(o))}function Zr(e,t,n){let r=h(x(e.config.projectRoot,t)),o=[p(r,n),p(e.config.projectRoot,n),p(e.config.projectRoot,"include",n),p(e.config.projectRoot,"src",n)];return xe(e,o)}function Xr(e,t,n){let r=L(e),o=t.replace(/\\/g,".").replace(/::/g,".").replace(/^global::/,""),s=o.replace(/\./g,"/"),i=o.split(".").pop()??o;for(let c of n){let l=`${s}${c}`,f=[...r].find(u=>u.endsWith(l));if(f)return f}for(let c of n){let l=[...r].find(f=>lt(f)===`${i}${c}`);if(l)return l}let a=[...r].filter(c=>n.includes(k(c).toLowerCase())).filter(c=>c.includes(`/${s}/`)||c.includes(`/${i}/`)).sort((c,l)=>c.localeCompare(l));return a.length===1?a[0]:null}function Gr(e,t,n){let r=L(e);if(n.startsWith("package:")){let i=n.slice(8),a=i.indexOf("/");if(a<0)return null;let c=i.slice(a+1),l=v(c.startsWith("lib/")?c:`lib/${c}`);return r.has(l)?l:null}let o=h(x(e.config.projectRoot,t)),s=p(o,n);for(let i of to(s)){let a=v(P(e.config.projectRoot,i));if(r.has(a)||w(i))return a}return null}function Qr(e,t){let n=t.replace(/-/g,"_").replace(/\./g,"/"),r=L(e);for(let o of ee){let s=`${n}${o}`,i=[...r].find(a=>a.endsWith(s));if(i)return i}for(let o of ee){let s=[...r].find(i=>lt(i)===`${n.split("/").pop()}${o}`);if(s)return s}return null}function Kr(e){let t=k(e);return ge.has(t)?[e]:[`${e}.py`,`${e}.pyi`,x(e,"__init__.py"),x(e,"__init__.pyi")]}function xe(e,t){let n=L(e);for(let r of t){let o=v(P(e.config.projectRoot,r));if(n.has(o)||w(r))return o}return null}function Yr(e){let t=k(e);return he.has(t)?[e]:[`${e}.rs`,x(e,"mod.rs")]}function eo(e){let t=k(e);return Se.has(t)?[e]:[`${e}.rb`,x(e,"index.rb")]}function to(e){let t=k(e);return ye.has(t)?[e]:[`${e}.dart`,e]}function ve(e){let t=k(e),n=new Set;if(t){n.add(e);for(let r of W)n.add(e.slice(0,-t.length)+r)}else for(let r of W)n.add(`${e}${r}`),n.add(x(e,`index${r}`));return[...n]}function L(e){return fr.get(e,()=>new Set(Te(e,{includeIgnored:!1}).map(v)))}function Ns(e){return mr.get(e,()=>Ce([...L(e)].sort().join(`
|
|
7
|
+
`)))}var no=new Set(["in","key","of"]),ro=new Set(["computed","defineEmits","defineProps","reactive","ref","watch","watchEffect"]),oo=_("vue-component-behavior-profiles");function Tt(e,t={}){let n=U(e,{extensions:[".vue"]}).filter(o=>!t.scope||o.includes(t.scope)).sort();return(typeof t.scanLimit=="number"&&t.scanLimit>0?n.slice(0,t.scanLimit):n).map(o=>Ne(e,o)).filter(o=>(t.minTemplateTokens===void 0||o.templateTokens.size>=t.minTemplateTokens)&&(t.minBehaviorTokens===void 0||o.behaviorTokens.size>=t.minBehaviorTokens))}function Ne(e,t){let n=t.replace(/\\/g,"/"),r=g(e,n),o=oo.get(e,n,r,()=>so(e,n,r));return ao(o)}function so(e,t,n){let r=E(e,t),o=Y(e,t),s=K(r),i=uo(o),a=o.expressionIdentifiers.map(m=>m.name).filter(m=>!i.includes(m)).filter((m,b,j)=>j.indexOf(m)===b).sort(),c=o.componentTags.map(m=>m.normalized).filter((m,b,j)=>j.indexOf(m)===b).sort(),l=n?n.split(`
|
|
8
|
+
`).length:0,f=F(r.template),u=s.lineCount,N=r.styles.reduce((m,b)=>m+F(b),0),B=r.customBlocks.reduce((m,b)=>m+F(b),0),{lines:te,paths:ne}=io(e,t,s);return{file:t,sfc:r,templateFacts:o,scriptFacts:s,templateTokens:new Set(o.structuralTokens),behaviorTokens:lo(o,s,a),templateBindingNames:a,templateLocalNames:i,componentNames:c,sfcLines:l,totalLines:l+s.externalLineCount,templateLines:f,scriptLines:u,styleLines:N,externalScriptLines:s.externalLineCount,externalScriptPaths:s.externalScriptPaths,customBlockLines:B,delegatedComposableLines:te,delegatedComposablePaths:ne}}function io(e,t,n){let r=new Set;for(let i of n.composables){let a=n.imports.find(l=>l.local===i);if(!a)continue;let c=Ct(e,a.sourcePath,a.source);!c||c===t||r.add(c)}let o=[...r].sort();return{lines:o.reduce((i,a)=>{let c=g(e,a);return i+(c?c.split(`
|
|
9
|
+
`).length:0)},0),paths:o}}function ao(e){let t=co(e.scriptFacts);return{...e,scriptFacts:t,templateTokens:new Set(e.templateTokens),behaviorTokens:new Set(e.behaviorTokens),templateBindingNames:[...e.templateBindingNames],templateLocalNames:[...e.templateLocalNames],componentNames:[...e.componentNames],externalScriptPaths:t.externalScriptPaths,delegatedComposablePaths:[...e.delegatedComposablePaths]}}function co(e){return{...e,imports:e.imports.map(t=>({...t})),functions:e.functions.map(t=>({...t})),calls:e.calls.map(t=>({...t,categories:[...t.categories]})),composables:[...e.composables],stores:[...e.stores],reactivity:[...e.reactivity],lifecycle:[...e.lifecycle],requests:[...e.requests],macros:[...e.macros],externalScriptPaths:[...e.externalScriptPaths],unresolvedScripts:e.unresolvedScripts.map(t=>({...t}))}}function lo(e,t,n){let r=new Set;for(let o of t.composables)r.add(`composable:${o}`);for(let o of t.stores)r.add(`store:${o}`);for(let o of t.reactivity)r.add(`reactivity:${o}`);for(let o of t.lifecycle)r.add(`lifecycle:${o}`);for(let o of t.requests)r.add(`request:${o}`);for(let o of t.macros)r.add(`macro:${o}`);for(let o of t.functions){if(ro.has(o.name))continue;r.add(`function:${o.name}`);let s=/^[a-z]+/.exec(o.name)?.[0]??null;s&&s.length>2&&s!==o.name&&r.add(`function-verb:${s}`)}for(let o of e.events)r.add(`template-event:${o.name}`);for(let o of n)r.add(`template-binding:${o}`);return r}function uo(e){let t=new Set;for(let n of e.directives)if(n.name==="for"&&n.value)for(let r of po(n.value))t.add(r);for(let n of e.slots)if(n.value)for(let r of Lt(n.value))t.add(r);return[...t].sort()}function po(e){let t=/^(.*?)\s+(?:in|of)\s+/.exec(e.trim());return t?Lt(t[1]??""):[]}function Lt(e){let t=[];for(let n of e.matchAll(/\b[A-Za-z_$][\w$]*\b/g)){let r=n[0];no.has(r)||t.push(r)}return t}function js(e){return{capability:(t,n)=>fo(t,n),reactProfiles:(t={})=>Je(e,t),reactProfilesForFile:t=>pe(e,t),vueProfiles:(t={})=>Tt(e,t),vueProfileForFile:t=>Ne(e,t),vueTemplateFacts:t=>Y(e,t),vueScriptFacts:t=>K(E(e,t))}}function fo(e,t){let n=e.startsWith("react-")?"react":"vue";if(t===void 0)return{slot:e,available:!0,framework:n};let r=t.replace(/\\/g,"/").toLowerCase();return n==="react"&&!r.endsWith(".tsx")&&!r.endsWith(".jsx")?{slot:e,available:!1,framework:n,reason:"React behavior profiles are only available for .tsx and .jsx files"}:n==="vue"&&!r.endsWith(".vue")?{slot:e,available:!1,framework:n,reason:"Vue behavior facts are only available for .vue files"}:{slot:e,available:!0,framework:n}}export{we as a,jt as b,W as c,ut as d,pt as e,ft as f,mt as g,dt as h,gt as i,ht as j,St as k,ee as l,vs as m,Ar as n,Ct as o,qr as p,Hr as q,Jr as r,Zr as s,Xr as t,Gr as u,Qr as v,Ns as w,M as x,Ee as y,De as z,We as A,Z as B,le as C,tt as D,st as E,js as F};
|
|
10
|
+
//# sourceMappingURL=chunk-ISLWJ4PY.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as b,b as y}from"./chunk-KJCDEDQW.js";import{a as R,b as H,c as B,e as h,f as k}from"./chunk-6XA4LDHY.js";import{a as p,b as g}from"./chunk-KMVGRIO2.js";import{F as v}from"./chunk-ISLWJ4PY.js";function V(e,s={}){let{minSimilarity:m=.45,minSharedBehaviors:i=6,limit:a=20,scope:c,scanLimit:n,filePattern:d,focusFiles:f}=s,l=v(e).reactProfiles({scope:c,minBehaviorTokens:Math.max(3,i),scanLimit:n}).map(r=>({file:r.file,component:r.name,tokens:r.behaviorTokens,profile:r})),o=b(l,r=>r.tokens);return y({profiles:l,limit:a,filePattern:d,focusFiles:f,candidateIndex:o,profile:{name:"react-hook-candidates"},compare:(r,t)=>C(r,t,m,i),sort:(r,t)=>t.similarity-r.similarity||r.fileA.localeCompare(t.fileA)||r.componentA.localeCompare(t.componentA)||r.fileB.localeCompare(t.fileB)||r.componentB.localeCompare(t.componentB)})}function C(e,s,m,i){let a=p(e.tokens,s.tokens);if(a.size<i||!E(a))return null;let c=H(e.tokens,s.tokens);if(c<m)return null;let n=h(a,"hook:"),d=h(a,"react-hook:"),f=h(a,"effect:"),l=h(a,"state:"),o=h(a,"request:"),r=h(a,"handler:"),t=h(a,"handler-verb:"),u=S({sharedHooks:n,sharedReactHooks:d,sharedEffects:f,sharedState:l,sharedRequests:o,sharedHandlers:r,sharedHandlerVerbs:t});return{fileA:e.file,componentA:e.component,fileB:s.file,componentB:s.component,similarity:c,sharedTokens:k(a),sharedHooks:n,sharedReactHooks:d,sharedEffects:f,sharedState:l,sharedRequests:o,sharedHandlers:r,sharedHandlerVerbs:t,evidenceClass:u.evidenceClass,actionTier:u.actionTier,evidenceClassReasons:u.reasons,recommendation:u.recommendation,uniqueToA:k(g(e.tokens,s.tokens)).slice(0,25),uniqueToB:k(g(s.tokens,e.tokens)).slice(0,25),reason:P({sharedHooks:n,sharedReactHooks:d,sharedEffects:f,sharedState:l,sharedRequests:o,sharedHandlers:r,sharedHandlerVerbs:t}),locA:e.profile.loc,locB:s.profile.loc}}function S(e){return R({genericWords:q,stripPrefixes:w,primitiveGroups:[{values:e.sharedReactHooks,reasonPrefix:"shared React primitives",bucket:"generic"},{values:e.sharedEffects,reasonPrefix:"shared lifecycle primitive",bucket:"generic"}],nameGroups:[{names:e.sharedHooks,label:"shared hook",fallbackBucket:"shared-abstraction"},{names:e.sharedRequests,label:"shared request",fallbackBucket:"generic"},{names:e.sharedState,label:"shared state",fallbackBucket:"generic"},{names:e.sharedHandlers,label:"shared handler",fallbackBucket:"generic"},{names:e.sharedHandlerVerbs,label:"shared action verb",fallbackBucket:"generic"}],recommendation:A})}function A(e){switch(e){case"domain-behavior":return"Review for a shared hook, controller, or feature module around the named domain behavior.";case"mixed":return"Separate generic React mechanics from domain-specific behavior before extracting a shared hook.";case"shared-abstraction":return"Review the existing shared hook usage first; extract only if duplicated behavior remains outside it.";case"generic-workflow-scaffolding":return"Treat as support evidence for a repeated workflow shape, not direct hook-extraction evidence."}}function E(e){let s=0,m=0,i=0,a=0,c=0,n=0,d=0;for(let o of e)o.startsWith("hook:")?s+=1:o.startsWith("react-hook:")?m+=1:o.startsWith("effect:")?i+=1:o.startsWith("request:")?a+=1:o.startsWith("handler:")||o.startsWith("handler-verb:")?c+=1:o.startsWith("state:")?n+=1:o.startsWith("state-hook:")&&(d+=1);let f=n+d,l=s+m+i+a+c+f;return B([{name:"requests",count:a},{name:"customHooks",count:s},{name:"namedStates",count:n},{name:"handlers",count:c},{name:"effects",count:i},{name:"reactHooks",count:m},{name:"namedBehavior",count:l}],[{min:{requests:1,namedBehavior:4},reason:"shared request workflow"},{min:{customHooks:1,requests:1,namedBehavior:5},reason:"shared custom hook and request workflow"},{min:{customHooks:1,namedStates:1,namedBehavior:5},reason:"shared custom hook and state"},{min:{customHooks:1,handlers:2,namedBehavior:5},reason:"shared custom hook and handlers"},{min:{namedStates:1,handlers:2,effects:1,namedBehavior:5},reason:"shared stateful effects"},{min:{namedStates:1,handlers:2,reactHooks:2,namedBehavior:5},reason:"shared stateful React primitives"}]).pass}function P(e){let s=[];return e.sharedHooks.length&&s.push(`shared hooks: ${e.sharedHooks.join(", ")}`),e.sharedReactHooks.length&&s.push(`shared React hooks: ${e.sharedReactHooks.join(", ")}`),e.sharedEffects.length&&s.push(`shared effects: ${e.sharedEffects.join(", ")}`),e.sharedState.length&&s.push(`shared state: ${e.sharedState.join(", ")}`),e.sharedRequests.length&&s.push(`shared requests: ${e.sharedRequests.join(", ")}`),e.sharedHandlers.length&&s.push(`shared handlers: ${e.sharedHandlers.slice(0,6).join(", ")}`),e.sharedHandlerVerbs.length&&s.push(`shared action verbs: ${e.sharedHandlerVerbs.slice(0,6).join(", ")}`),s.join("; ")||"shared React behavior profile"}var q=new Set(["add","apply","async","callback","cancel","change","clear","close","create","data","delete","draft","edit","effect","error","fetch","filter","form","handle","has","is","item","items","load","loader","loading","memo","name","open","reducer","refresh","ref","remove","request","reset","resource","row","rows","save","saving","search","select","selected","state","store","submit","toggle","update","use","value"]),w=[/^use(?=[A-Z])/,/^handle(?=[A-Z])/,/^is(?=[A-Z])/,/^has(?=[A-Z])/];export{V as a};
|
|
2
|
+
//# sourceMappingURL=chunk-J5WVNZ6O.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as o}from"./chunk-B75HZHUP.js";import{
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as o}from"./chunk-B75HZHUP.js";import{l as u}from"./chunk-WS3Z6W3M.js";function P(e){let t=m(e.profile?.name),r=()=>{let d=e.candidates(),a=e.filterCandidate?d.filter(e.filterCandidate):d,C=e.orderCandidates?[...a].sort(e.orderCandidates):a,i=o(C,e.scanLimit);t={pipeline:e.profile?.name,loadedCandidates:d.length,filteredCandidates:a.length,scannedCandidates:i.length,evaluatedCandidates:0,matchedResults:0,emittedResults:0,scanLimitApplied:i.length<a.length,resultLimitApplied:!1};let f=e.prepare?.(i)??void 0,n=[];for(let c of i){t.evaluatedCandidates+=1;let s=e.evaluate(c,f);s&&n.push(s)}t.matchedResults=n.length,e.orderResults&&n.sort(e.orderResults);let l=typeof e.limit=="number"?n.slice(0,e.limit):n;return t.emittedResults=l.length,t.resultLimitApplied=l.length<n.length,e.onProfile?.({...t}),l};return e.profile?u(`candidate-pipeline:${e.profile.name}`,r,()=>({...p(e.profile?.metadata),...t})):r()}function m(e){return{pipeline:e,loadedCandidates:0,filteredCandidates:0,scannedCandidates:0,evaluatedCandidates:0,matchedResults:0,emittedResults:0,scanLimitApplied:!1,resultLimitApplied:!1}}function p(e){return typeof e=="function"?e():e??{}}export{P as a};
|
|
2
|
+
//# sourceMappingURL=chunk-K6UI6EBZ.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{l as u}from"./chunk-WS3Z6W3M.js";function x(e,i){let l=new Map;return e.forEach((t,f)=>{let o=new Set;for(let r of i(t)){if(o.has(r))continue;o.add(r);let n=l.get(r);n?n.push(f):l.set(r,[f])}}),{candidatesFor:(t,f)=>{let o=new Set;for(let r of i(t)){let n=l.get(r);if(n)for(let a of n)a!==f&&o.add(a)}return[...o].sort((r,n)=>r-n)}}}function R(e){let i=c(e.profile?.name),l=()=>{let t=[];i=c(e.profile?.name,e);let f=(r,n)=>{let a=e.profiles[r],s=e.profiles[n];i.candidatePairs+=1,i.comparedPairs+=1;let d=e.compare(a,s);d&&t.push(d)};if(e.filePattern){let r=e.profiles.findIndex(n=>n.file.includes(e.filePattern));if(r>=0){let n=e.profiles[r];for(let a of m(e,r)){let s=e.profiles[a];e.focusFiles&&!e.focusFiles.has(n.file)&&!e.focusFiles.has(s.file)||f(r,a)}}}else if(e.focusFiles?.size!==0){let r=typeof e.overrunFactor=="number"&&Number.isFinite(e.limit)?e.limit*e.overrunFactor:Number.POSITIVE_INFINITY;for(let n=0;n<e.profiles.length;n+=1){let a=e.profiles[n],s=e.focusFiles?.has(a.file)??!1;for(let d of p(e,n))e.focusFiles&&!s&&!e.focusFiles.has(e.profiles[d].file)||f(n,d);if(t.length>r){i.overrunApplied=!0;break}}}t.sort(e.sort??((r,n)=>n.similarity-r.similarity)),i.matchedResults=t.length;let o=t.slice(0,e.limit);return i.emittedResults=o.length,e.onProfile?.({...i}),o};return e.profile?u(`pairwise-profile:${e.profile.name}`,l,()=>({...b(e.profile?.metadata),...i})):l()}function m(e,i){if(e.candidateIndex)return P(e,i,-1);let l=[];for(let t=0;t<e.profiles.length;t+=1)t!==i&&l.push(t);return l}function p(e,i){if(e.candidateIndex)return P(e,i,i);let l=[];for(let t=i+1;t<e.profiles.length;t+=1)l.push(t);return l}function P(e,i,l){let t=e.profiles[i],f=new Set;for(let o of e.candidateIndex?.candidatesFor(t,i,e.profiles)??[])o<=l||o!==i&&(o<0||o>=e.profiles.length||f.add(o));return[...f].sort((o,r)=>o-r)}function c(e,i){return{pipeline:e,profileCount:i?.profiles.length??0,focusedProfileCount:i?.focusFiles?i.profiles.filter(l=>i.focusFiles.has(l.file)).length:0,candidatePairs:0,comparedPairs:0,matchedResults:0,emittedResults:0,candidateIndexApplied:i?.candidateIndex!==void 0,focusApplied:i?.focusFiles!==void 0,filePatternApplied:i?.filePattern!==void 0,overrunApplied:!1}}function b(e){return typeof e=="function"?e():e??{}}export{x as a,R as b};
|
|
2
|
+
//# sourceMappingURL=chunk-KJCDEDQW.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
function T(r,t){let e=new Set;for(let n of r)t.has(n)&&e.add(n);return e}function l(r,t){let e=new Set;for(let n of r)t.has(n)||e.add(n);return e}function S(r,t){if(r.size===0&&t.size===0)return 0;let e=0;for(let i of r)t.has(i)&&(e+=1);let n=r.size+t.size-e;return n===0?0:e/n}function p(r,t){if(r.size===0)return 0;let e=0;for(let n of r)t.has(n)&&(e+=1);return e/r.size}function M(r,t){if(t<=0)return new Map;let e=new Map;for(let[n,i]of r)i>0&&e.set(n,Math.log(t/i));return e}function g(r){let t=[...r.values()].sort((n,i)=>n-i);if(t.length===0)return 0;let e=Math.floor(t.length/2);return t.length%2===0?(t[e-1]+t[e])/2:t[e]}function b(r,t){let e=0;for(let n of r){let i=t.get(n)??0;e+=i*i}return Math.sqrt(e)}function w(r,t,e,n={}){let i=0,m=0,u=0,d=n.medianIdf??g(e),f=[],h=[];for(let s of r){let o=e.get(s)??0;m+=o*o,t.has(s)&&(i+=o*o,o>=d?f.push(s):h.push(s))}if(f.length===0&&h.length===0)return{similarity:0,significantShared:[],trivialShared:[]};for(let s of t){let o=e.get(s)??0;u+=o*o}let a=Math.sqrt(m)*Math.sqrt(u),c=a>0?i/a:0;return f.sort((s,o)=>(e.get(o)??0)-(e.get(s)??0)),{similarity:c,significantShared:f,trivialShared:h}}function x(r,t,e,n){let i=0,m=n.medianIdf??g(e),u=[],d=[];for(let a of r){if(!t.has(a))continue;let c=e.get(a)??0;i+=c*c,c>=m?u.push(a):d.push(a)}if(u.length===0&&d.length===0)return{similarity:0,significantShared:[],trivialShared:[]};let f=n.magnitudeA*n.magnitudeB,h=f>0?i/f:0;return u.sort((a,c)=>(e.get(c)??0)-(e.get(a)??0)),{similarity:h,significantShared:u,trivialShared:d}}export{T as a,l as b,S as c,p as d,M as e,g as f,b as g,w as h,x as i};
|
|
2
|
+
//# sourceMappingURL=chunk-KMVGRIO2.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import{a as f}from"./chunk-UAHZ57BR.js";import{a as u}from"./chunk-ECVXWZ4Q.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-KSUZS77X.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b}from"./chunk-OSWF3HSF.js";import{k as f}from"./chunk-MBKJ7GHT.js";import{m as d}from"./chunk-HXXMPYEF.js";function S(a,g){let p=b(a,g),i=f(a,p,{sort:!0});if(i.length===0)return[];let o=i.map(e=>({symbol:e.symbol,shortName:e.shortName,startLine:e.startLine,endLine:e.endLine,signature:e.signature,children:[]})),s=new Map;for(let e of o)s.set(e.symbol,e);let c=[];for(let e=0;e<i.length;e++){let r=i[e],n=o[e];if(r.enclosingSymbol&&s.has(r.enclosingSymbol)){s.get(r.enclosingSymbol).children.push(n);continue}let l=null,m=1/0;for(let t of o)if(t!==n&&t.startLine<=n.startLine&&t.endLine>=n.endLine){if(t.startLine===n.startLine&&t.endLine===n.endLine&&!d(t.symbol,n.symbol))continue;let u=t.endLine-t.startLine;u<m&&(m=u,l=t)}l?l.children.push(n):c.push(n)}return c}export{S as a};
|
|
2
|
+
//# sourceMappingURL=chunk-L2CX5GHZ.js.map
|