scip-query 0.9.0 → 0.10.1
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/README.md +115 -58
- package/dist/augment-vue-worker.js +1 -1
- package/dist/chunk-23FVN4Y5.js +2 -0
- package/dist/chunk-24PFLKFK.js +2 -0
- package/dist/{chunk-VTF5EH22.js → chunk-27KPKLRJ.js} +2 -2
- package/dist/chunk-2NLK4INB.js +2 -0
- package/dist/{chunk-TA4DDU7J.js → chunk-2XKAMW6B.js} +2 -2
- package/dist/{chunk-PE4EJOLN.js → chunk-332L7SRO.js} +2 -2
- package/dist/chunk-44JOJLMO.js +38 -0
- package/dist/{chunk-U254PV4S.js → chunk-4EAANIWC.js} +2 -2
- package/dist/{chunk-ITUU3VE3.js → chunk-4N7LFYSD.js} +2 -2
- package/dist/{chunk-7I6KNKE3.js → chunk-5ALI77D7.js} +2 -2
- package/dist/{chunk-V76FCF5F.js → chunk-5BZOSICN.js} +2 -2
- package/dist/{chunk-RIXOMSOR.js → chunk-5D3BT4B4.js} +2 -2
- package/dist/{chunk-YSSTUCNS.js → chunk-5HDYAOSF.js} +2 -2
- package/dist/{chunk-NK7TQQG4.js → chunk-5IDEQEM4.js} +2 -2
- package/dist/{chunk-AGW2MVIO.js → chunk-5VB3WU7K.js} +2 -2
- package/dist/chunk-623UQCVG.js +2 -0
- package/dist/chunk-62NMBOA5.js +2 -0
- package/dist/chunk-64LH2QUP.js +62 -0
- package/dist/{chunk-PG3ZI5IH.js → chunk-65UWNXEH.js} +1 -1
- package/dist/{chunk-NGLRXEWN.js → chunk-6TWFT4Y5.js} +2 -2
- package/dist/chunk-6U4EODW3.js +2 -0
- package/dist/{chunk-SDGCKEB7.js → chunk-6YKJSETN.js} +2 -2
- package/dist/chunk-A2GVUCZR.js +8 -0
- package/dist/{chunk-WEJYUS5O.js → chunk-ADKQX2OY.js} +2 -2
- package/dist/{chunk-I7OTKWNY.js → chunk-ADTG377O.js} +2 -2
- package/dist/chunk-ATGRITZP.js +20 -0
- package/dist/chunk-B3HMRQDA.js +2 -0
- package/dist/chunk-B75HZHUP.js +2 -0
- package/dist/chunk-BGBBVSH4.js +2 -0
- package/dist/chunk-BJ7OHKB5.js +2 -0
- package/dist/{chunk-VN6B6HFB.js → chunk-CCB45WDY.js} +2 -2
- package/dist/chunk-CFLYMEUS.js +2 -0
- package/dist/chunk-CMGOXDVP.js +22 -0
- package/dist/chunk-DBIG4QAJ.js +2 -0
- package/dist/{chunk-RCRK4E7E.js → chunk-DMLPJ75B.js} +2 -2
- package/dist/chunk-DRU74YUM.js +71 -0
- package/dist/chunk-DTERBKUE.js +7 -0
- package/dist/{chunk-EKP7XJ6L.js → chunk-E55WCTLH.js} +2 -2
- package/dist/{chunk-ZJ737ZMD.js → chunk-F4PKYBQB.js} +2 -2
- package/dist/{chunk-HDA2V5DC.js → chunk-FVX4GEAC.js} +2 -2
- package/dist/{chunk-TR5AU6A5.js → chunk-GTNPPGZJ.js} +2 -2
- package/dist/{chunk-TFO4OMJZ.js → chunk-GZXXBDJA.js} +2 -2
- package/dist/chunk-HCQ7J2N5.js +3 -0
- package/dist/chunk-HQHFMPLJ.js +2 -0
- package/dist/{chunk-D43L5PQF.js → chunk-I6PTB2CM.js} +2 -2
- package/dist/{chunk-VHENVDS2.js → chunk-IJYWCB57.js} +2 -2
- package/dist/chunk-JTRY2YRJ.js +2 -0
- package/dist/chunk-L77GXANO.js +6 -0
- package/dist/{chunk-UUDYI3FF.js → chunk-LT6GJ27X.js} +2 -2
- package/dist/chunk-LUBKUISI.js +2 -0
- package/dist/{chunk-VQGQHIAT.js → chunk-LVYXX7ZW.js} +2 -2
- package/dist/{chunk-3YQO3S5D.js → chunk-LWPEZ4FP.js} +2 -2
- package/dist/chunk-LWWZBABT.js +2 -0
- package/dist/chunk-LXM7AHQG.js +4 -0
- package/dist/chunk-LY6NRJPJ.js +2 -0
- package/dist/chunk-LYS4SMAQ.js +2 -0
- package/dist/{chunk-7TYJD45F.js → chunk-MESUJJVQ.js} +2 -2
- package/dist/{chunk-6HP3BKIP.js → chunk-MHAQXOZY.js} +2 -2
- package/dist/chunk-N2T2GPYQ.js +2 -0
- package/dist/chunk-OB6PEVI3.js +2 -0
- package/dist/chunk-PNN3D4BE.js +2 -0
- package/dist/{chunk-46ILZVMX.js → chunk-PV4CEDIL.js} +2 -2
- package/dist/chunk-QH5GTVVB.js +3 -0
- package/dist/{chunk-WC43FMAB.js → chunk-QOFKVNFE.js} +2 -2
- package/dist/chunk-QUKZ77A6.js +4 -0
- package/dist/chunk-R42LZMLX.js +2 -0
- package/dist/{chunk-GD7XRHSV.js → chunk-R7S3UCDR.js} +2 -2
- package/dist/chunk-RGDUIMNE.js +3 -0
- package/dist/{chunk-TCCUWKH4.js → chunk-RNLUCQJB.js} +2 -2
- package/dist/chunk-RYBMW2EN.js +2 -0
- package/dist/{chunk-6ZFKI5EP.js → chunk-SA6B3EGD.js} +2 -2
- package/dist/chunk-T67R7V5I.js +2 -0
- package/dist/chunk-TMS4JPWY.js +3 -0
- package/dist/chunk-TTGWDUJ4.js +5 -0
- package/dist/chunk-TUAPDKBI.js +2 -0
- package/dist/chunk-UVK3SL4Z.js +2 -0
- package/dist/chunk-W3PQRAI4.js +2 -0
- package/dist/{chunk-LBAMALDV.js → chunk-WWFBDM5Y.js} +2 -2
- package/dist/{chunk-AQYBOORI.js → chunk-WZVTADY7.js} +1 -1
- package/dist/chunk-XGGTESMN.js +2 -0
- package/dist/{chunk-2DVVHNC3.js → chunk-Y33GRQK6.js} +2 -2
- package/dist/{chunk-BCFED24F.js → chunk-YIE5FZAF.js} +2 -2
- package/dist/chunk-YISMWW66.js +7 -0
- package/dist/chunk-YVQUQIBM.js +5 -0
- package/dist/{chunk-Z2AJQ7VA.js → chunk-YYCQQBMG.js} +2 -2
- package/dist/cli.js +240 -232
- package/dist/{config-types-CGIeLEpY.d.ts → config-types-Bok4jrO3.d.ts} +29 -1
- package/dist/{db-DdTPetj5.d.ts → db-BkFlkzI3.d.ts} +1 -1
- package/dist/{health-C6r2VgpA.d.ts → health-CbGMdRPg.d.ts} +42 -3
- package/dist/index.d.ts +7 -6
- package/dist/index.js +1 -1
- package/dist/postinstall.js +2 -2
- 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 +5 -4
- 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 +2 -2
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.d.ts +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +25 -3
- package/dist/queries/diff-gate.js +1 -1
- package/dist/queries/diff-impact.d.ts +20 -4
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/doc-drift.d.ts +2 -2
- package/dist/queries/doc-drift.js +1 -1
- package/dist/queries/drift.d.ts +2 -2
- package/dist/queries/drift.js +1 -1
- 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 +2 -2
- 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 +4 -2
- package/dist/queries/incomplete-migration.js +1 -1
- package/dist/queries/index.d.ts +11 -5
- 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/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 +2 -2
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/plan-context.d.ts +2 -2
- package/dist/queries/plan-context.js +1 -1
- package/dist/queries/react-component-duplicates.d.ts +31 -0
- package/dist/queries/react-component-duplicates.js +2 -0
- package/dist/queries/react-hook-candidates.d.ts +34 -0
- package/dist/queries/react-hook-candidates.js +2 -0
- package/dist/queries/react-large-component-pressure.d.ts +28 -0
- package/dist/queries/react-large-component-pressure.js +2 -0
- package/dist/queries/recent-duplicates.d.ts +10 -3
- 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 +2 -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 +2 -2
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.d.ts +8 -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/stats.js +1 -1
- 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/unused-params.d.ts +2 -2
- package/dist/queries/unused-params.js +1 -1
- package/dist/queries/vue-component-duplicates.d.ts +35 -0
- package/dist/queries/vue-component-duplicates.js +2 -0
- package/dist/queries/vue-composable-candidates.d.ts +34 -0
- package/dist/queries/vue-composable-candidates.js +2 -0
- package/dist/queries/vue-large-view-pressure.d.ts +31 -0
- package/dist/queries/vue-large-view-pressure.js +2 -0
- package/dist/queries/wrapper-candidates.d.ts +2 -2
- package/dist/queries/wrapper-candidates.js +1 -1
- package/dist/reindex-worker.js +10 -10
- package/dist/reindex.d.ts +1 -1
- package/dist/reindex.js +22 -22
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +2 -2
- package/docs/AGENT_GUIDE.md +353 -0
- package/docs/AI_FAILURE_MODES.md +278 -0
- package/docs/API.md +40 -0
- package/docs/COMMAND_REFERENCE.md +130 -0
- package/docs/DETECTOR_GUIDE.md +119 -0
- package/docs/accuracy-hardening-goal.md +54 -0
- package/docs/assets/scip-query-logo-dark.svg +21 -0
- package/docs/assets/scip-query-logo.svg +24 -0
- package/package.json +31 -3
- package/skills/scip-maintainability/SKILL.md +24 -3
- package/skills/scip-query/SKILL.md +2 -1
- package/skills/scip-react-maintainability/SKILL.md +114 -0
- package/skills/scip-vue-maintainability/SKILL.md +130 -0
- package/dist/chunk-2Y2WIJI4.js +0 -2
- package/dist/chunk-44G4P3GJ.js +0 -2
- package/dist/chunk-64UY7VTR.js +0 -63
- package/dist/chunk-6G76D2YM.js +0 -2
- package/dist/chunk-APLCSDXL.js +0 -4
- package/dist/chunk-CVRXOP6M.js +0 -3
- package/dist/chunk-EAU4RDFG.js +0 -2
- package/dist/chunk-FYT2PE7C.js +0 -2
- package/dist/chunk-I66MQD5U.js +0 -2
- package/dist/chunk-IBM6FXOQ.js +0 -3
- package/dist/chunk-JTCEWV7Q.js +0 -2
- package/dist/chunk-K3V6XUTL.js +0 -2
- package/dist/chunk-L6TOEQ2M.js +0 -2
- package/dist/chunk-LR7E2ATW.js +0 -8
- package/dist/chunk-MX6F756F.js +0 -2
- package/dist/chunk-NM3BZXHA.js +0 -2
- package/dist/chunk-NO2TPMCQ.js +0 -2
- package/dist/chunk-OMNT7E2T.js +0 -4
- package/dist/chunk-PBGTMPJ7.js +0 -2
- package/dist/chunk-PCMVXWDC.js +0 -34
- package/dist/chunk-PLFYFZX3.js +0 -2
- package/dist/chunk-R3G6ERW7.js +0 -7
- package/dist/chunk-SEZZ24IG.js +0 -2
- package/dist/chunk-SLX5XBCD.js +0 -7
- package/dist/chunk-SOGLYIJ4.js +0 -62
- package/dist/chunk-SQ6VENQY.js +0 -6
- package/dist/chunk-T4AK46CM.js +0 -16
- package/dist/chunk-TH4JVC34.js +0 -71
- package/dist/chunk-TQTVM27C.js +0 -6
- package/dist/chunk-VDZL45XI.js +0 -2
- package/dist/chunk-WQFOZIID.js +0 -4
- package/dist/chunk-Y3RUPPIU.js +0 -2
- package/dist/chunk-YO6DU7QZ.js +0 -2
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import{c as S}from"./chunk-T67R7V5I.js";import{a as h}from"./chunk-YVQUQIBM.js";import{a as x}from"./chunk-NN3O7TPH.js";import{c as y}from"./chunk-BJ7OHKB5.js";var w={"/":"namespace","#":"type",".":"term","[":"type-param",":":"meta","!":"macro"};function u(e){if(e.startsWith("local "))return{kind:"local",id:e.slice(6),raw:e};let t=e.split(" ");if(t.length<4)return{scheme:t[0]??"",manager:t[1]??"",packageName:t[2]??"",version:"",descriptors:[],raw:e};let n=t[0],i=t[1],r=e.slice(n.length+1+i.length+1),s;if(r.startsWith("`")){let l=r.indexOf("`",1);l===-1?(s=r.slice(1),r=""):(s=r.slice(1,l),r=r.slice(l+2))}else{let l=r.indexOf(" ");l===-1?(s=r,r=""):(s=r.slice(0,l),r=r.slice(l+1))}let o,a=r.indexOf(" ");a===-1?(o=r,r=""):(o=r.slice(0,a),r=r.slice(a+1));let c=C(r);return{scheme:n,manager:i,packageName:s,version:o,descriptors:c,raw:e}}function m(e){let t=u(e);if("kind"in t)return null;for(let n=t.descriptors.length-2;n>=0;n--){let i=t.descriptors[n];if(i?.suffix==="type")return i.name}return null}function C(e){let t=[],n=0;for(;n<e.length;){if(e[n]==="["){let s=e.indexOf("]",n+1);if(s===-1){t.push({name:e.slice(n+1),suffix:"type-param"});break}t.push({name:e.slice(n+1,s),suffix:"type-param"}),n=s+1;continue}if(e[n]==="("&&(t.length===0||n===0||D(e[n-1]))){let s=e.indexOf(")",n+1);if(s!==-1&&e[s+1]!=="."){t.push({name:e.slice(n+1,s),suffix:"parameter"}),n=s+1;continue}}let i;if(e[n]==="`"){let s=e.indexOf("`",n+1);if(s===-1){i=e.slice(n+1),t.push({name:i,suffix:"term"});break}i=e.slice(n+1,s),n=s+1}else{let s=n;for(;n<e.length&&!D(e[n]);)n++;i=e.slice(s,n)}if(n>=e.length){i&&t.push({name:i,suffix:"term"});break}let r=e[n];if(r==="("){let s=e.indexOf(")",n+1);s!==-1&&e[s+1]==="."?(t.push({name:i,suffix:"method"}),n=s+2):s!==-1?(t.push({name:i,suffix:"method"}),n=s+1):(t.push({name:i,suffix:"term"}),n++)}else{let s=w[r];s&&t.push({name:i,suffix:s}),n+=1}}return t}function D(e){return e==="/"||e==="#"||e==="."||e==="("||e==="["||e===":"||e==="!"}function L(e){let t=u(e);if("kind"in t&&t.kind==="local")return`local:${t.id}`;let n=t;if(n.descriptors.length===0)return n.raw;let i=[];for(let r of n.descriptors){let s=F(r);s&&i.push(s)}return i.join(":")}function F(e){let t=e.suffix==="namespace"?T(e.name):e.name;return t?e.suffix==="method"?`${t}()`:t:""}function T(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 t=u(e);if("kind"in t&&t.kind==="local")return t.id;let n=t;return n.descriptors.length===0?"":n.descriptors[n.descriptors.length-1].name}function f(e){let t=u(e);if("kind"in t&&t.kind==="local")return null;let n=t;return n.descriptors[n.descriptors.length-1]?.suffix??null}function ie(e){return e.endsWith("().")||f(e)==="method"}function I(e){let t=f(e);return t==="method"||t==="term"}function se(e){return f(e)==="namespace"}var A=/^rust-analyzer\b.*[\s/]impl#\[[^\]]+\]\[[^\]]+\]/;function oe(e){return A.test(e)}var Q=new Set(["test","tests","_tests"]);function ae(e){let t=u(e);if("kind"in t)return!1;for(let n=0;n<t.descriptors.length-1;n+=1){let i=t.descriptors[n];if(i?.suffix==="namespace"&&i.name&&Q.has(i.name))return!0}return!1}function le(e,t){let n=u(e),i=u(t);if("kind"in n||"kind"in i)return!1;let r=n.descriptors,s=i.descriptors;if(s.length!==r.length+1)return!1;for(let o=0;o<r.length;o++){let a=r[o],c=s[o];if(a.name!==c.name||a.suffix!==c.suffix)return!1}return!0}function ce(e,t){let n=u(e),i=u(t);if("kind"in n||"kind"in i)return!1;let r=n.descriptors,s=i.descriptors;if(s.length<=r.length)return!1;for(let o=0;o<r.length;o++){let a=r[o],c=s[o];if(a.name!==c.name||a.suffix!==c.suffix)return!1}return!0}function ue(e,t){return e.all(`SELECT gs.id, gs.symbol, der.document_id, der.start_line, der.end_line, d.relative_path, gs.display_name, gs.documentation
|
|
2
|
+
FROM global_symbols gs
|
|
3
|
+
JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
|
|
4
|
+
JOIN documents d ON der.document_id = d.id
|
|
5
|
+
WHERE ${t.where}
|
|
6
|
+
${e.pathExclusionsFor("d")}
|
|
7
|
+
${M(t.orderBy)}
|
|
8
|
+
${k(t.limit)}`,...t.params??[])}function me(e,t){return e.all(`SELECT
|
|
9
|
+
gs.id,
|
|
10
|
+
gs.symbol,
|
|
11
|
+
c.document_id,
|
|
12
|
+
MIN(c.start_line) AS start_line,
|
|
13
|
+
MAX(c.end_line) AS end_line,
|
|
14
|
+
d.relative_path,
|
|
15
|
+
gs.display_name,
|
|
16
|
+
gs.documentation
|
|
17
|
+
FROM global_symbols gs
|
|
18
|
+
JOIN mentions m ON m.symbol_id = gs.id
|
|
19
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
20
|
+
JOIN documents d ON c.document_id = d.id
|
|
21
|
+
WHERE m.role = 1
|
|
22
|
+
AND ${t.where}
|
|
23
|
+
${e.pathExclusionsFor("d")}
|
|
24
|
+
GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path, gs.display_name, gs.documentation
|
|
25
|
+
${M(t.orderBy)}
|
|
26
|
+
${k(t.limit)}`,...t.params??[])}function M(e){return e?`ORDER BY ${e}`:""}function k(e){return typeof e=="number"?`LIMIT ${e}`:""}function N(e){return!e||!e.trim()?null:e.replace(/^```\w*\s*/,"").replace(/\s*```$/,"").replace(/^\(method\)\s*/,"").replace(/^\(property\)\s*/,"").replace(/^\(function\)\s*/,"").replace(/^\(class\)\s*/,"").replace(/^\(interface\)\s*/,"").replace(/^\(enum\)\s*/,"").replace(/^\(type alias\)\s*/,"").replace(/^\(const\)\s*/,"").replace(/^\(var\)\s*/,"").trim()||null}function O(e){if(!e)return null;let t=R(e);if(t)return t.replace(/\n/g," ");let n=e.indexOf("|");if(n===-1)return e.replace(/\n/g," ");let i=e.slice(n+1);return(R(i)??i).replace(/\n/g," ")}function R(e){return/^```(?:\w+)?\s*\n?([\s\S]*?)\n?```/.exec(e.trimStart())?.[1]?.trim()||null}function P(e){if(m(e.symbol)!==null)return!1;let n=(e.documentation??"").replace(/^```\w*\s*/,"").replace(/\s*```$/,"").trim();return/^(?:var|let|const|function|class|interface|type|enum)\b/.test(n)}function E(e,t,n={}){let i=new Map;for(let s of t)e.length>0&&!P(s)||i.set(s.id,s);for(let s of e)i.set(s.id,s);let r=[...i.values()];return n.sort?r.sort((s,o)=>s.start_line-o.start_line||s.end_line-o.end_line||s.symbol.localeCompare(o.symbol)):r}var B=y("file-definitions",{clearGroups:["definition-catalog"]}),$=new WeakMap;function g(e,t){return B.get(e,t,()=>{let n=E(j(e,t),J(e,t),{sort:!0});return U(e,t,n.map(W))})}function j(e,t){return e.all(`SELECT
|
|
27
|
+
gs.id,
|
|
28
|
+
gs.symbol,
|
|
29
|
+
der.document_id,
|
|
30
|
+
der.start_line,
|
|
31
|
+
der.end_line,
|
|
32
|
+
d.relative_path,
|
|
33
|
+
gs.display_name,
|
|
34
|
+
gs.kind,
|
|
35
|
+
gs.documentation,
|
|
36
|
+
gs.enclosing_symbol
|
|
37
|
+
FROM global_symbols gs
|
|
38
|
+
JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
|
|
39
|
+
JOIN documents d ON der.document_id = d.id
|
|
40
|
+
WHERE d.relative_path = ?
|
|
41
|
+
${e.symbolNoiseFor("gs")}
|
|
42
|
+
ORDER BY der.start_line, der.end_line`,t)}function J(e,t){return e.all(`SELECT
|
|
43
|
+
gs.id,
|
|
44
|
+
gs.symbol,
|
|
45
|
+
c.document_id,
|
|
46
|
+
MIN(c.start_line) AS start_line,
|
|
47
|
+
MAX(c.end_line) AS end_line,
|
|
48
|
+
d.relative_path,
|
|
49
|
+
gs.display_name,
|
|
50
|
+
gs.kind,
|
|
51
|
+
gs.documentation,
|
|
52
|
+
gs.enclosing_symbol
|
|
53
|
+
FROM global_symbols gs
|
|
54
|
+
JOIN mentions m ON m.symbol_id = gs.id
|
|
55
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
56
|
+
JOIN documents d ON c.document_id = d.id
|
|
57
|
+
WHERE d.relative_path = ?
|
|
58
|
+
AND m.role = 1
|
|
59
|
+
${e.symbolNoiseFor("gs")}
|
|
60
|
+
GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path
|
|
61
|
+
ORDER BY start_line, end_line`,t)}function W(e){return{symbolId:e.id,symbol:e.symbol,documentId:e.document_id,startLine:e.start_line,endLine:e.end_line,relativePath:e.relative_path,leaf:_(e.symbol),parentTypeName:m(e.symbol),isFunctionLike:I(e.symbol),isTypeLike:f(e.symbol)==="type",kind:e.kind??null,documentation:e.documentation??null,enclosingSymbol:e.enclosing_symbol??null}}function _e(e,t={}){return H(e,t.scope)}function H(e,t){return x(e,{scope:t,includeIgnored:!1}).flatMap(n=>g(e,n)).filter(n=>!e.isIgnored(n.relativePath))}function Ie(e,t,n={}){if(t.length===0)return[];let i=t.flatMap(r=>g(e,r)).filter(r=>!e.isIgnored(r.relativePath));return n.onlyDocumented&&(i=i.filter(r=>r.documentation!==null&&r.documentation!=="")),n.sort&&(i=i.sort((r,s)=>r.relativePath.localeCompare(s.relativePath)||r.startLine-s.startLine||r.endLine-s.endLine)),i.map(r=>({startLine:r.startLine,endLine:r.endLine,symbol:r.symbol,shortName:L(r.symbol),signature:N(O(r.documentation)),relativePath:r.relativePath,enclosingSymbol:r.enclosingSymbol}))}function z(e){let t=new Map,n=e.map((i,r)=>({definition:i,index:r,span:i.endLine-i.startLine})).sort((i,r)=>i.span-r.span||i.index-r.index);for(let{definition:i}of n)for(let r=i.startLine;r<=i.endLine;r+=1)t.has(r)||t.set(r,i);return t}function Re(e,t){let n=$.get(e);return n||(n=z(e),$.set(e,n)),n.get(t)??null}function Me(e,t){let n=g(e,t.relative_path).find(i=>i.symbolId===t.id);return n?{symbolId:n.symbolId,symbol:n.symbol,documentId:n.documentId,startLine:n.startLine,endLine:n.endLine,relativePath:n.relativePath}:{symbolId:t.id,symbol:t.symbol,documentId:t.document_id,startLine:t.start_line,endLine:t.end_line,relativePath:t.relative_path}}function U(e,t,n){let i=h(e,t),r=S(e,t);return r?V(n,r,i):i?Y(n,i):n}function Y(e,t){let n=t.split(/\r?\n/),i=G(e,n),r=X(e,i),s=Z(r,n);return K(e,s)}function G(e,t){let n=e.some(r=>b(r.symbol))?ne(t):null,i=new Map;for(let r of e)i.set(r.symbolId,ee(t,n,r));return i}function X(e,t){return e.filter(n=>b(n.symbol)).map(n=>({definition:n,startLine:t.get(n.symbolId)??n.startLine})).sort((n,i)=>n.startLine-i.startLine||n.definition.startLine-i.definition.startLine||n.definition.symbol.localeCompare(i.definition.symbol))}function Z(e,t){let n=new Map;for(let i=0;i<e.length;i+=1){let r=e[i],s=e[i+1],o=s?Math.max(r.startLine,s.startLine-1):t.length-1;n.set(r.definition.symbolId,{startLine:r.startLine,endLine:te(t,r.definition,r.startLine,o)})}return n}function K(e,t){return e.map(n=>{let i=t.get(n.symbolId);return i?{...n,startLine:i.startLine,endLine:i.endLine}:n})}function V(e,t,n=null){let i=new Map;for(let r of t){let s=i.get(r.name);s?s.push(r):i.set(r.name,[r])}return e.map(r=>{if(!q(r)||!r.leaf)return v(r,n);let s=i.get(r.leaf);if(!s||s.length===0)return v(r,n);let o=s[0],a=Math.abs(o.startLine-r.startLine);for(let c=1;c<s.length;c+=1){let l=s[c],d=Math.abs(l.startLine-r.startLine);d<a&&(o=l,a=d)}return{...r,startLine:o.startLine,endLine:o.endLine}})}function q(e){return b(e.symbol)?!0:f(e.symbol)==="term"&&m(e.symbol)===null}function v(e,t){if(!t||!e.leaf||f(e.symbol)!=="term"||m(e.symbol)!==null)return e;let n=e.leaf.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=new RegExp(`\\b(?:export\\s+)?(?:const|let|var)\\s+${n}\\b`),s=t.split(/\r?\n/).findIndex(o=>i.test(o));return s>=0?{...e,startLine:s,endLine:s}:e}function ee(e,t,n){if(!b(n.symbol))return n.startLine;let i=Math.max(0,Math.min(n.startLine,e.length-1));if(!t)return i;let r=t.get(n.leaf);if(!r||r.length===0)return i;let s=null;for(let o of r){let a=Math.abs(o-n.startLine);(!s||a<s.distance)&&(s={line:o,distance:a})}return s?.line??i}function ne(e){let t=/\b(?:function|def|fn)\s+([A-Za-z_$][\w$]*)/g,n=/\b([A-Za-z_$][\w$]*)\s*[:=]\s*(?:async\s*)?(?:function\b|\()/g,i=/^\s*(?:(?:export|public|private|protected|static|readonly|async|abstract|get|set)\s+)*([A-Za-z_$][\w$]*)\s*(?:<[^(]*>)?\s*\(/,r=/\b([A-Za-z_$][\w$]*)\s*\(/g,s=new Map,o=(a,c)=>{let l=s.get(a);if(!l){s.set(a,[c]);return}l[l.length-1]!==c&&l.push(c)};for(let a=0;a<e.length;a+=1){let c=e[a]??"";for(let d of c.matchAll(t))d[1]&&o(d[1],a);for(let d of c.matchAll(n))d[1]&&o(d[1],a);let l=c.match(i);l?.[1]&&o(l[1],a);for(let d of c.matchAll(r))d[1]&&o(d[1],a)}return s}function te(e,t,n,i){let r=Math.max(n,Math.min(e.length-1,i)),s=Math.max(n,Math.min(r,t.endLine)),o=0,a=0,c=!1;for(let l=n;l<=r;l+=1){let d=re(e[l]??"");for(let p of d)p==="{"?(o+=1,c=!0):p==="}"?o=Math.max(0,o-1):p==="("?a+=1:p===")"&&(a=Math.max(0,a-1));if(c&&o===0||!c&&a===0&&l>=s)return l}return s}function re(e){let t="",n=null,i=!1;for(let r=0;r<e.length;r+=1){let s=e[r],o=e[r+1];if(!n&&s==="/"&&o==="/"){t+=" ".repeat(e.length-r);break}if(n){if(i){i=!1,t+=" ";continue}if(s==="\\"){i=!0,t+=" ";continue}s===n&&(n=null),t+=" ";continue}if(s==='"'||s==="'"||s==="`"){n=s,t+=" ";continue}t+=s}return t}function b(e){return e.includes("().")}function ke(e){let t=u(e);if("kind"in t)return[];let n=[];for(let i=t.descriptors.length-2;i>=0;i-=1){let r=t.descriptors[i];r?.suffix==="type"&&r.name&&n.push(r.name)}return n}export{u as a,m as b,L as c,_ as d,f as e,ie as f,I as g,se as h,oe as i,ae as j,le as k,ce as l,ue as m,me as n,N as o,O as p,E as q,g as r,_e as s,H as t,Ie as u,z as v,Re as w,Me as x,ke as y};
|
|
62
|
+
//# sourceMappingURL=chunk-64LH2QUP.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import{a as r}from"./chunk-NN3O7TPH.js";function a(e){return/[*?]/.test(e)?e.replace(/\*\*/g,"%").replace(/\*/g,"%").replace(/\?/g,"_"):`%${e}%`}function o(e,t){let i=a(t);return r(e,{like:i,includeIgnored:!1}).map(s=>({relativePath:s}))}export{o as a};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
2
|
+
//# sourceMappingURL=chunk-65UWNXEH.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as c}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as c}from"./chunk-5D3BT4B4.js";function j(e,s={}){let{minSimilarity:t=.5,limit:n=15,scope:i,minChainLength:r=3,maxChainLength:l=8}=s,a=c(e,i),o=y(a,r,l);if(o.length===0)return[];let f=d(o);return f.length<2?[]:S(x(f,t,n),n)}function d(e){let s=m(e),t=[];for(let n of e){let i=n.filter(r=>!s.has(r));i.length>=2&&t.push({original:n,filtered:i})}return t}function m(e){let{nodeFreq:s,tailFreq:t}=p(e),n=e.length*.9,i=e.length*.8,r=new Set;for(let[a,o]of s)o>n&&r.add(a);for(let[a,o]of t)o>i&&r.add(a);let l=["index.ts","index.js","cli.ts","main.ts","health.ts","health.js"];for(let a of s.keys()){let o=a.split("/").pop()??"";l.includes(o)&&r.add(a)}return r}function p(e){let s=new Map,t=new Map;for(let n of e){let i=new Set;for(let r of n)i.has(r)||(s.set(r,(s.get(r)??0)+1),i.add(r));for(let r=Math.max(0,n.length-2);r<n.length;r++)t.set(n[r],(t.get(n[r])??0)+1)}return{nodeFreq:s,tailFreq:t}}function x(e,s,t){let n=[];for(let i=0;i<e.length;i++){for(let r=i+1;r<e.length;r++){let l=b(e[i],e[r],s);l&&n.push(l)}if(n.length>t*10)break}return n.sort((i,r)=>Math.abs(r.similarity-i.similarity)>.01?r.similarity-i.similarity:i.divergencePoints.length-r.divergencePoints.length),n}function b(e,s,t){if(!C(e.filtered,s.filtered))return null;let{distance:n,ops:i}=A(e.filtered,s.filtered),r=Math.max(e.filtered.length,s.filtered.length);if(r===0)return null;let l=1-n/r;if(l<t||n===0)return null;let a=i.filter(f=>f.type==="substitute").map(f=>({index:f.indexA,nodeA:e.filtered[f.indexA],nodeB:s.filtered[f.indexB]}));return a.length===0||i.filter(f=>f.type==="match").length<2?null:{chainA:e.original,chainB:s.original,similarity:l,editDistance:n,divergencePoints:a,commonPrefix:F(e.original,s.original),commonSuffix:B(e.original,s.original)}}function C(e,s){let t=new Set(e);return s.some(n=>t.has(n))}function S(e,s){let t=[];for(let n of e)if(t.some(r=>h(n.chainA,r.chainA)&&h(n.chainB,r.chainB))||t.push(n),t.length>=s)break;return t}function y(e,s,t){let n=[];for(let r of e.keys()){if(n.length>=500)break;g(e,r,[r],new Set([r]),s,t,n,500)}return n}function g(e,s,t,n,i,r,l,a){if(l.length>=a)return;if(t.length>=r){t.length>=i&&l.push([...t]);return}let o=e.get(s);if(!o||o.size===0){t.length>=i&&l.push([...t]);return}let f=!1;for(let u of o)if(!n.has(u)&&(n.add(u),t.push(u),g(e,u,t,n,i,r,l,a),t.pop(),n.delete(u),f=!0,l.length>=a))return;!f&&t.length>=i&&l.push([...t])}function A(e,s){let t=e.length,n=s.length,i=Array.from({length:t+1},()=>Array(n+1).fill(0));for(let o=0;o<=t;o++)i[o][0]=o;for(let o=0;o<=n;o++)i[0][o]=o;for(let o=1;o<=t;o++)for(let f=1;f<=n;f++)e[o-1]===s[f-1]?i[o][f]=i[o-1][f-1]:i[o][f]=1+Math.min(i[o-1][f],i[o][f-1],i[o-1][f-1]);let r=[],l=t,a=n;for(;l>0||a>0;)l>0&&a>0&&e[l-1]===s[a-1]?(r.unshift({type:"match",indexA:l-1,indexB:a-1}),l--,a--):l>0&&a>0&&i[l][a]===i[l-1][a-1]+1?(r.unshift({type:"substitute",indexA:l-1,indexB:a-1}),l--,a--):a>0&&i[l][a]===i[l][a-1]+1?(r.unshift({type:"insert",indexA:l,indexB:a-1}),a--):(r.unshift({type:"delete",indexA:l-1,indexB:a}),l--);return{distance:i[t][n],ops:r}}function F(e,s){let t=[];for(let n=0;n<Math.min(e.length,s.length)&&e[n]===s[n];n++)t.push(e[n]);return t}function B(e,s){let t=[],n=e.length-1,i=s.length-1;for(;n>=0&&i>=0&&e[n]===s[i];)t.unshift(e[n]),n--,i--;return t}function h(e,s){if(e.length>s.length)return!1;let t=s.join("\u2192"),n=e.join("\u2192");return t.includes(n)}export{j as a};
|
|
2
|
+
//# sourceMappingURL=chunk-6TWFT4Y5.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as G}from"./chunk-B75HZHUP.js";import{a as E}from"./chunk-W3PQRAI4.js";import{a as F,d as N,e as k,f as T}from"./chunk-L77GXANO.js";import{a as z}from"./chunk-623UQCVG.js";import{c as H,d as U,f as v,j as q}from"./chunk-SA6B3EGD.js";import{b as I}from"./chunk-QUKZ77A6.js";import{c as M,f as A,g as j,h as O,i as B,j as W,r as V,y as x}from"./chunk-64LH2QUP.js";import{a as P,d as _}from"./chunk-HCQ7J2N5.js";import{a as h}from"./chunk-NN3O7TPH.js";import{b as S}from"./chunk-BJ7OHKB5.js";var g=new WeakMap;function J(e,n){let t=P(n);return t==="rust"?pe(e,n):t==="typescript"||t==="tsx"||t==="javascript"?de(e,n):[]}var ue=new Set(["describe","it","test","fdescribe","fit","xdescribe","xit","beforeEach","afterEach","beforeAll","afterAll","before","after","suite","bench","benchmark"]);function de(e,n){let t=_(e,n);if(!t)return[];let i=g.get(t);if(i)return i;let r=/(^|\/)(pages|app)\/.+\.(tsx?|jsx?)$/.test(n)||/(^|\/)(layout|page|loading|error|not-found|head|template|default)\.(tsx?|jsx?)$/.test(n),o=/(^|\/)src\/(pages|views|routes)\/.+\.(tsx?|jsx?|vue)$/.test(n),s=!1,c=t.rootNode;for(let u of c.namedChildren){if(u.type!=="expression_statement")continue;let a=u.namedChild(0);if(!a||a.type!=="call_expression")continue;let d=a.namedChild(0);if(!d)continue;let f=d.type==="member_expression"?d.namedChild(d.namedChildCount-1)?.text:d.text;if(f&&ue.has(f)){s=!0;break}}let l=[];s&&l.push({startLine:0,endLine:c.endPosition.row,reason:"TS/JS test file (describe/it/test at top level)"}),(r||o)&&l.push({startLine:0,endLine:c.endPosition.row,reason:r?"Next.js / Remix route file":"Vite/Vue route component"});for(let u of c.namedChildren){let a=null,d=null;if(u.type==="function_declaration")a=u.namedChild(0)?.text??null,d=u;else if(u.type==="export_statement"){let f=u.namedChild(0);f?.type==="function_declaration"&&(a=f.namedChild(0)?.text??null,d=f)}else if(u.type==="lexical_declaration"){let f=u.namedChild(0);if(f?.type==="variable_declarator"){let b=f.namedChild(0)?.text,y=f.namedChild(1);b&&(y?.type==="arrow_function"||y?.type==="function_expression")&&(a=b,d=f)}}a&&/^use[A-Z]/.test(a)&&d&&l.push({startLine:d.startPosition.row,endLine:d.endPosition.row,reason:"React custom hook (use*)"})}return l.push(...K(t,new Set(["function_declaration","method_definition","class_declaration","interface_declaration","type_alias_declaration","enum_declaration","variable_declarator","export_statement"]),new Set(["comment"]))),g.set(t,l),l}var fe=/scip-query[\s:-]*ignore[\s:-]*(?:dead(?:-code)?|stale)?/i;function me(e){return fe.test(e)}function K(e,n,t){let i=[],r=o=>{if(n.has(o.type)&&o.parent){let c=o.parent.children,l=-1;for(let u=0;u<c.length;u+=1)if(c[u].startIndex===o.startIndex&&c[u].type===o.type){l=u;break}if(l>0)for(let u=l-1;u>=0;u-=1){let a=c[u];if(t.has(a.type)){if(me(a.text)){i.push({startLine:o.startPosition.row,endLine:o.endPosition.row,reason:"scip-query suppression comment"});break}continue}if(!(a.type==="attribute_item"||a.type==="inner_attribute_item"))break}}for(let s of o.namedChildren)r(s)};return r(e.rootNode),i}function pe(e,n){let t=_(e,n);if(!t)return[];let i=g.get(t);if(i)return i;let r=[],o=be(t);return o?(g.set(t,o),o):(X(t.rootNode,r,!1,!1),r.push(...K(t,new Set(["function_item","function_signature_item","struct_item","enum_item","union_item","impl_item","mod_item","static_item","const_item"]),new Set(["line_comment","block_comment"]))),r.push(...ve(t.rootNode)),g.set(t,r),r)}function be(e){return Ee(e.rootNode)?[{startLine:0,endLine:e.rootNode.endPosition.row,reason:"generated file (@generated header)"}]:null}function X(e,n,t,i){let r=t,o=i;e.type==="trait_item"&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait declaration body (dynamic dispatch)"}),e.type==="impl_item"&&e.childForFieldName("trait")&&(o=!0,n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl block (dynamic dispatch)"})),e.type==="function_item"||e.type==="function_signature_item"?ye(e,n,t,i):i&&_e(e)?n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl associated item (dynamic dispatch)"}):e.type==="struct_item"||e.type==="enum_item"||e.type==="union_item"?ge(e,n,t):e.type==="mod_item"&&C(e).some(s=>/#\[\s*cfg\s*\(\s*test\s*\)/.test(s))&&(r=!0);for(let s of e.namedChildren)X(s,n,r,o)}function ye(e,n,t,i){let r=C(e),o=null;i?o="trait impl method (dynamic dispatch)":t&&(o="inside #[cfg(test)] mod");for(let s of r){let c=xe(s);if(c){o=c;break}if(Z(s)){o="#[allow(dead_code)]";break}}o&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:o})}function ge(e,n,t){let i=C(e),r=e.namedChildren.find(o=>o.type==="type_identifier")?.text;i.some(Se)&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[derive(<reflective>)] \u2014 fields accessed via macro/reflection",containerName:r}),i.some(Z)&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[allow(dead_code)]",containerName:r}),t&&n.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"inside #[cfg(test)] mod",containerName:r})}function C(e){let n=e.parent;if(!n)return[];let t=n.children,i=-1;for(let o=0;o<t.length;o+=1)if(t[o].startIndex===e.startIndex&&t[o].type===e.type){i=o;break}if(i<=0)return[];let r=[];for(let o=i-1;o>=0;o-=1){let s=t[o];if(s.type==="attribute_item"||s.type==="inner_attribute_item")r.push(s.text);else{if(s.type==="line_comment"||s.type==="block_comment")continue;break}}return r}var he=[{re:/#\[\s*tauri::command\b/,reason:"#[tauri::command]"},{re:/#\[\s*command\b/,reason:"#[command]"},{re:/#\[\s*test\b/,reason:"#[test]"},{re:/#\[\s*bench\b/,reason:"#[bench]"},{re:/#\[\s*tokio::test\b/,reason:"#[tokio::test]"},{re:/#\[\s*async_std::test\b/,reason:"#[async_std::test]"},{re:/#\[\s*wasm_bindgen\b/,reason:"#[wasm_bindgen]"},{re:/#\[\s*no_mangle\b/,reason:"#[no_mangle]"},{re:/#\[\s*napi\b/,reason:"#[napi]"},{re:/#\[\s*pyfunction\b/,reason:"#[pyfunction]"},{re:/#\[\s*pymethod\b/,reason:"#[pymethod]"},{re:/#\[\s*pyo3\b/,reason:"#[pyo3]"},{re:/#\[\s*cfg\s*\(\s*test\s*\)/,reason:"#[cfg(test)]"},{re:/#\[\s*doc\s*\(\s*hidden\s*\)/,reason:"#[doc(hidden)]"}];function xe(e){return he.find(({re:n})=>n.test(e))?.reason??null}var Re=[/\bSerialize\b/,/\bDeserialize\b/,/\bFromRow\b/,/\bsqlx::FromRow\b/,/\bDeriveEntityModel\b/,/\bIntoSchema\b/,/\bToSchema\b/,/\bDeriveValueType\b/,/\bError\b/,/\bthiserror::Error\b/];function Se(e){return/#\[\s*derive\s*\(/.test(e)?Re.some(n=>n.test(e)):!1}function Z(e){return/#\[\s*allow\s*\(\s*dead_code\s*\)/.test(e)}function _e(e){return e.type==="const_item"||e.type==="type_item"||e.type==="static_item"||e.type==="associated_type"}function ve(e){let n=De(e);if(n.size===0)return[];let t=[];for(let i of e.descendantsOfType("mod_item")){let r=i.childForFieldName("name")?.text;r&&n.has(r)&&t.push({startLine:i.startPosition.row,endLine:i.endPosition.row,reason:'serde `with = "..."` module \u2014 body invoked via reflection',containerName:r})}return t}function Ee(e){for(let n=0;n<Math.min(e.namedChildCount,12);n+=1){let t=e.namedChild(n);if(!t||t.type!=="line_comment"&&t.type!=="block_comment")break;if(/@generated\b/.test(t.text)||/This file is .*generated\b/i.test(t.text)||/Code generated by/i.test(t.text)||/Generated by:\s*https?:\/\/openapi-generator/i.test(t.text)||/openapi-generator/i.test(t.text)&&/Generated by/i.test(t.text))return!0}return!1}var Ce=/^#!?\[\s*serde\s*\(/,$=/\bwith\s*=\s*"([^"]+)"/g;function De(e){let n=new Set;for(let t of e.descendantsOfType("attribute_item")){if(!Ce.test(t.text))continue;$.lastIndex=0;let i;for(;(i=$.exec(t.text))!==null;){let r=i[1],o=r.split("::").pop()??r;o&&n.add(o)}}return n}function Q(e){let n=new Map,t=i=>{let r=n.get(i);if(r)return r;let o=J(e,i);return r={ranges:o.map(s=>({startLine:s.startLine,endLine:s.endLine})),containers:new Set(o.map(s=>s.containerName).filter(s=>!!s))},n.set(i,r),r};return(i,r,o,s)=>{let c=t(i);for(let l of c.ranges)if(r>=l.startLine&&r<=l.endLine)return!0;if(s&&c.containers.has(s))return!0;for(let l of x(o))if(c.containers.has(l))return!0;return!1}}function ze(e,n={}){S(e,{groups:n.semanticProvider===!0?["whole-project","semantic-provider"]:["whole-project"]})}function D(e,n,t={}){S(e,{groups:t.definitions===!0?["source-file","definition-catalog"]:["source-file"],file:n.replace(/\\/g,"/")})}function ee(e,n){return n.isIgnoredPath(e.relativePath)?m("ignored-file"):O(e.symbol)?m("module-like-symbol"):Y(e.symbol)?!e.isFunctionLike&&e.enclosingSymbol&&Y(e.enclosingSymbol)?m("nested-non-callable-value"):!n.includeTests&&!w(e.relativePath)?m("test-file"):!n.includeTests&&n.isExcludedRegion(e.relativePath,e.startLine,e.symbol,e.parentTypeName)?m("excluded-file-region"):B(e.symbol)?m("rust-trait-impl-member"):W(e.symbol)?m("rust-test-module"):!n.includeMembers&&!we(e)?m("member"):e.endLine-e.startLine+1<n.minLoc?m("below-min-loc"):{accepted:!0}:m("non-value-symbol")}function w(e){return F(e)!=="test"}function m(e){return{accepted:!1,rejectionReason:e}}function Y(e){return j(e)||e.endsWith("().")||e.endsWith(".")}function we(e){return A(e.symbol)||x(e.symbol).length===0}function te(){return new Map}function ne(e,n,t){let i=new Map;for(let r of H(e,t))e.isIgnored(r.relative_path)||n.has(r.relative_path)||R(i,r.symbol_id,r.relative_path,r.ref_count,"scip-mention");return i}function re(e,n,t){let i=new Set;for(let r of U(e,n))e.isIgnored(r.relative_path)||t.has(r.relative_path)||i.add(r.symbol_id);return i}function L(e,n){let t=e.get(n);if(!t)return!1;for(let i of t.values())if(i.occurrences>0)return!0;return!1}function ie(e){return e?.occurrences??0}function R(e,n,t,i,r="source-fallback"){if(i<=0)return;let o=se(e,n,t);o.occurrences+=i,o.sources.add(r)}function oe(e,n,t,i,r){if(i<=0)return;let o=se(e,n,t);o.occurrences=Math.max(i,o.occurrences),o.sources.add(r)}function se(e,n,t){let i=e.get(n);i||(i=new Map,e.set(n,i));let r=i.get(t);return r||(r={occurrences:0,sources:new Set},i.set(t,r)),r}function mt(e,n={}){let{scope:t,minLoc:i=1,includeTests:r=!1,skipBarrels:o=!1,includeMembers:s=!1,deadCodeOnly:c=!1,scanLimit:l,semantic:u=!0}=n,a=G(Le(e,{scope:t,minLoc:i,includeTests:r,includeMembers:s}),l),d=o?new Set(N(e)):new Set,f=c?te():ne(e,d,a.map(p=>p.symbolId)),b=c?re(e,a.map(p=>p.symbolId),d):new Set,y=c?a.filter(p=>!b.has(p.symbolId)):a;c?ke(e,y,f,d):Ne(e,y,f,d);let ce=c?y.filter(p=>!L(f,p.symbolId)):a;Oe(e,ce,f,{includeTests:r,inactiveBarrelPaths:d,includeSemantic:!c&&u});let le=c?y.filter(p=>!L(f,p.symbolId)):a;return Fe(e,Pe(le,f))}function Le(e,n){let t=Q(e),i=[];for(let r of h(e,{scope:n.scope}))try{for(let o of V(e,r))ee(o,{minLoc:n.minLoc,includeTests:n.includeTests,includeMembers:n.includeMembers,isIgnoredPath:c=>e.isIgnored(c),isExcludedRegion:t}).accepted&&i.push(o)}finally{D(e,r,{definitions:!0})}return i}function Pe(e,n){return e.map(t=>Ie(t,n)).filter(t=>t.cross_file_refs===0).sort((t,i)=>i.loc-t.loc||t.relative_path.localeCompare(i.relative_path)||t.start_line-i.start_line)}function Ie(e,n){let t=n.get(e.symbolId)??new Map,i=ie(t.get(e.relativePath)),r=0;for(let[o,s]of t)o!==e.relativePath&&(r+=s.occurrences);return{relative_path:e.relativePath,start_line:e.startLine,end_line:e.endLine,loc:e.endLine-e.startLine+1,symbol:e.symbol,same_file_refs:i,cross_file_refs:r}}function Fe(e,n){let t=[],i=0,r=0,o=0;for(let s of n){if(e.isIgnored(s.relative_path)||k(e,s.relative_path)||T(e,s.symbol,s.relative_path))continue;let c=s.same_file_refs===0?"dead-code":"file-internal";c==="dead-code"?i++:r++,o+=s.loc,t.push({relativePath:s.relative_path,startLine:s.start_line,endLine:s.end_line,loc:s.loc,symbol:s.symbol,shortName:M(s.symbol),sameFileRefs:s.same_file_refs,kind:c})}return{symbols:t,totalCount:t.length,deadCodeCount:i,fileInternalCount:r,totalLoc:o}}function Ne(e,n,t,i){if(n.length===0)return;let r=new E(e),o=new Set(n.map(l=>l.symbolId)),s=new Set(n.map(l=>l.leaf).filter(Boolean)),c=new Set(r.sourceFiles());for(let l of h(e))c.add(l);r.scanSourceReferences({paths:c,includeVueSfc:!0,includeCrossLanguageDispatchNames:!0,includeRustAttributeNames:!0,identifierResolution:"permissive",candidateNames:s,skipPath:l=>i.has(l)},l=>{o.has(l.target.symbolId)&&(Ae(e,l)||R(t,l.target.symbolId,l.sourceFile,je(l),"source-fallback"))})}function ke(e,n,t,i){if(n.length===0)return;let r=new E(e),o=Te(n),s=new Set(r.sourceFiles());for(let a of h(e))s.add(a);let c=new Set(o.keys()),l=new Map,u=a=>{let d=l.get(a);return d||(d=q(e,a),l.set(a,d)),d};r.scanSourceReferences({paths:s,includeVueSfc:!0,includeCrossLanguageDispatchNames:!0,includeRustAttributeNames:!0,identifierResolution:"permissive",candidateNames:c,skipPath:a=>i.has(a),resolveTargets:({sourceFile:a,name:d,kind:f})=>{let b=o.get(d);return b?Me(a,d,b,u(a),{permissive:f!=="cross-language-dispatch"}):[]},afterPath:a=>{l.delete(a),D(e,a)}},a=>{let d=a.kind==="identifier"&&a.sourceFile===a.target.relativePath?Math.max(0,a.occurrences-1):a.occurrences;a.kind==="identifier"&&ae(e,{sourceFile:a.sourceFile,name:a.name,target:a.target,occurrences:d})||R(t,a.target.symbolId,a.sourceFile,d,"source-fallback")})}function Te(e){let n=new Map;for(let t of e){if(!t.leaf)continue;let i=n.get(t.leaf)??[];i.push(t),n.set(t.leaf,i)}return n}function Me(e,n,t,i,r){let o=t.filter(l=>l.relativePath===e);if(o.length>0)return o;if(!r.permissive&&t.length===1)return[...t];let s=i.get(n);if(s)for(let l of s){let u=t.filter(a=>v(l,a.relativePath));if(u.length>0)return u}let c=new Set;for(let l of i.values())for(let u of l)c.add(u);for(let l of c){let u=t.filter(a=>v(l,a.relativePath));if(u.length>0&&u.length===t.length)return u}return r.permissive?[...t]:[]}function Ae(e,n){return n.kind==="cross-language-dispatch"&&n.target.relativePath===n.sourceFile?!0:n.kind==="identifier"&&ae(e,n)}function je(e){return e.kind==="identifier"&&e.target.relativePath===e.sourceFile?Math.max(0,e.occurrences-1):e.occurrences}function ae(e,n){return n.occurrences>1?!1:I(e,n.sourceFile).some(t=>t.used||t.sourcePath!==n.target.relativePath?!1:t.importedName===n.name||t.localName===n.name)}function Oe(e,n,t,i){for(let r of n){let o=z(e,r,{semantic:i.includeSemantic!==!1});if(o.length!==0)for(let s of o){let c=s.file;c===r.relativePath||e.isIgnored(c)||i.inactiveBarrelPaths.has(c)||!i.includeTests&&!w(c)||oe(t,r.symbolId,c,1,"caller-map")}}}export{ze as a,mt as b};
|
|
2
|
+
//# sourceMappingURL=chunk-6U4EODW3.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as d}from"./chunk-
|
|
1
|
+
import{a as d}from"./chunk-5ALI77D7.js";import{a as g,c as m}from"./chunk-64LH2QUP.js";function _(n,f){let a=d(n,f);if(!a)return[];let t=n.get(`SELECT symbol, enclosing_symbol FROM global_symbols
|
|
2
2
|
WHERE id = ? LIMIT 1`,a.symbolId);if(!t)return[];let o=[{symbol:t.symbol,shortName:m(t.symbol),depth:0}],e=t.enclosing_symbol,r=1,c=new Set([t.symbol]);for(;e&&!c.has(e)&&r<20;){c.add(e);let s=n.get("SELECT symbol, enclosing_symbol FROM global_symbols WHERE symbol = ?",e);if(!s)break;o.push({symbol:s.symbol,shortName:m(s.symbol),depth:r}),e=s.enclosing_symbol,r++}if(o.length>1)return o;let y=g(t.symbol);if("kind"in y)return o;let l=y.descriptors;if(l.length<=1)return o;let b=[o[0]];for(let s=l.length-2,h=1;s>=0;s--,h++){let p=l.slice(0,s+1).map(i=>i.suffix==="method"?`${i.name}()`:i.name.replace(/\.(ts|tsx|js|jsx|mjs|cjs|py|pyi|rs|java|scala|kt|kts|rb|go|cs|vb|dart|php|c|cc|cpp|cxx|h|hpp)$/,"")).join(":");b.push({symbol:p,shortName:p,depth:h})}return b}export{_ as a};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
//# sourceMappingURL=chunk-6YKJSETN.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{d as P,e as _}from"./chunk-TTGWDUJ4.js";import{d as N}from"./chunk-UIWAZ2NT.js";import{a as M,c as v,f as x}from"./chunk-ATGRITZP.js";import{a as S}from"./chunk-W3PQRAI4.js";import{c as f}from"./chunk-64LH2QUP.js";var L=5;function z(e,r={}){let{base:a="HEAD",minContainment:n=.7,minCallees:i=3,maxHelpers:l=Number.POSITIVE_INFINITY,limit:c=20}=r,p=r.semantic!==!1,s=r.diffPlan??v(e,{base:a}),o={available:s.note!==M,base:a,changedFiles:s.changedFiles,helpersChecked:0,skipped:[],findings:[]};if(!o.available||s.changedFiles.length===0)return o;let u=new S(e),b=new Set(s.changedFiles),w=new Map(s.renamedFiles.map(t=>[t.to,t.from])),d=A(e,u,b,a,w);if(d.length===0)return o;let I=d.slice(0,l);d.length>l&&(o.note=`helper scoring capped at ${l} of ${d.length} new symbols`);let E=P(e,{minCallees:Math.min(3,i),semantic:p}),R=T(E),k=u.calleeMap(I,{semantic:p}),D=I.map(t=>({def:t,callees:_((k.get(t.symbolId)??[]).map(m=>m.symbol))}));for(let{def:t,callees:m}of D){let g=f(t.symbol);if(m.size<i){o.skipped.push({helperShortName:g,helperFile:t.relativePath,reason:`fewer than ${i} meaningful callees \u2014 too small to score`});continue}let y=O(e,t.symbolId);if(y.length===0){o.skipped.push({helperShortName:g,helperFile:t.relativePath,reason:"no references yet \u2014 covered by the new-dead check"});continue}o.helpersChecked+=1;let h=q({candidateIndex:R,changed:b,helperCallees:m,helperSymbol:t.symbol,minContainment:n});h.length!==0&&(h.sort((F,C)=>C.containment-F.containment||F.file.localeCompare(C.file)),o.findings.push({helperSymbol:t.symbol,helperShortName:g,helperFile:t.relativePath,migratedFiles:y.sort(),leftovers:h.slice(0,L)}))}return o.findings.sort((t,m)=>(m.leftovers[0]?.containment??0)-(t.leftovers[0]?.containment??0)||t.helperFile.localeCompare(m.helperFile)),o.findings=o.findings.slice(0,c),o}function T(e){let r=new Map,a=new Map;for(let n of e)for(let i of n.callees){r.set(i,(r.get(i)??0)+1);let l=a.get(i);l||(l=[],a.set(i,l)),l.push(n)}return{candidatesByCallee:a,docFreq:r,ubiquityThreshold:Math.max(8,Math.ceil(Math.sqrt(e.length)))}}function q(e){let r=[],a=new Set;for(let n of e.helperCallees)for(let i of e.candidateIndex.candidatesByCallee.get(n)??[])a.add(i);for(let n of a){if(n.symbol===e.helperSymbol||e.changed.has(n.file)||n.callees.has(e.helperSymbol))continue;let i=N(e.helperCallees,n.callees);if(i<e.minContainment)continue;let l=[...e.helperCallees].filter(c=>n.callees.has(c));l.some(c=>(e.candidateIndex.docFreq.get(c)??0)<=e.candidateIndex.ubiquityThreshold)&&r.push({symbol:n.symbol,shortName:f(n.symbol),file:n.file,containment:i,sharedCallees:l.map(f).sort()})}return r}function A(e,r,a,n,i){let l=new Map;return r.productionCallableDefinitions({requireFunctionLikeSymbol:!0}).filter(c=>{if(!a.has(c.relativePath))return!1;let p=i.get(c.relativePath)??c.relativePath,s=l.get(p);return s===void 0&&(s=x(e.config.projectRoot,n,p),l.set(p,s)),s===null||!new RegExp(`\\b${$(c.leaf)}\\b`).test(s)})}function O(e,r){return e.all(`SELECT DISTINCT ref_d.relative_path
|
|
2
|
+
FROM mentions m
|
|
3
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
4
|
+
JOIN documents ref_d ON c.document_id = ref_d.id
|
|
5
|
+
WHERE m.symbol_id = ?
|
|
6
|
+
AND m.role != 1
|
|
7
|
+
${e.pathExclusionsFor("ref_d")}`,r).map(n=>n.relative_path)}function $(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}export{z as a};
|
|
8
|
+
//# sourceMappingURL=chunk-A2GVUCZR.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as P}from"./chunk-NN3O7TPH.js";import{a as j,d as O,
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as P}from"./chunk-NN3O7TPH.js";import{a as j,d as O,f as w}from"./chunk-BJ7OHKB5.js";function G(t){return t.replace(/'''[\s\S]*?'''/g,f).replace(/"""[\s\S]*?"""/g,f).replace(/#.*$/gm,f).replace(/\/\/.*$/gm,f).replace(/\/\*[\s\S]*?\*\//g,f).replace(/`(?:\\[\s\S]|[^`])*`/g,f).replace(/'(?:\\.|[^'\\\r\n])*'/g,f).replace(/"(?:\\.|[^"\\\r\n])*"/g,f)}function f(t){return t.replace(/[^\r\n]/g," ")}var Tt=w("stripped-lines",{clearGroups:["whole-project","source-file"]});j({name:"stripped-source-singleton",groups:["whole-project","source-file"],clearAll:()=>{_=null,E=""},clearFile:()=>{_=null,E=""}});var _=null,E="";function V(t){return _===t||(_=t,E=G(t)),E}function Rt(t,n,e){let r=V(t);return`${r.slice(0,n)}${" ".repeat(e-n)}${r.slice(e)}`}function Dt(t,n){return new RegExp(`\\b${v(n)}\\b`,"m").test(t)}function $t(t,n){let e=new Set,r=new RegExp(`\\b${v(n)}\\s*\\.\\s*([A-Za-z_$][\\w$]*)`,"g");for(let o of t.matchAll(r)){let s=o[1];s&&e.add(s)}return[...e]}function v(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function yt(t){let n=0;for(let e of t)e==="("&&(n+=1),e===")"&&(n-=1);return n}import{existsSync as T}from"fs";import{basename as Y,dirname as S,extname as p,join as g,relative as h,resolve as u}from"path";var K=O("indexed-paths",{clearGroups:[]}),m=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue"],X=[".py",".pyi"],b=[".java",".scala",".kt",".kts"],k=[".rs"],A=[".rb"],L=[".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx"],W=[".cs",".vb"],H=[".dart"],U=[".php"],Q=new Set(m),R=new Set(X),J=new Set(b),D=new Set(k),$=new Set(A),M=new Set(L),B=new Set(W),y=new Set(H),z=new Set(U),Z=[{extensions:m,lookup:Q},{extensions:X,lookup:R},{extensions:b,lookup:J},{extensions:k,lookup:D},{extensions:A,lookup:$},{extensions:L,lookup:M},{extensions:W,lookup:B},{extensions:H,lookup:y},{extensions:U,lookup:z}];function x(t,n){return n.has(p(t).toLowerCase())}function q(t){return x(t,R)}function tt(t){return x(t,J)}function nt(t){return x(t,D)}function et(t){return x(t,$)}function rt(t){return x(t,M)}function ot(t){return x(t,B)}function vt(t){return p(t).toLowerCase()===".vb"}function st(t){return x(t,y)}function it(t){return x(t,z)}function ct(t){let n=p(t).toLowerCase();for(let e of Z)if(e.lookup.has(n))return e.extensions;return m}function at(t){return tt(t)||ot(t)||it(t)}function Xt(t,n,e){return q(n)?ut(t,n,e):nt(n)?gt(t,n,e):et(n)?pt(t,n,e):rt(n)?ft(t,n,e):at(n)?St(t,e.replace(/\\/g,"."),ct(n)):st(n)?xt(t,n,e):lt(t,n,e)}function lt(t,n,e){if(!e.startsWith(".")&&!e.startsWith("/"))return null;let r=S(g(t.config.projectRoot,n)),o=u(r,e),s=N(t);for(let c of Nt(o)){let a=d(h(t.config.projectRoot,c));if(s.has(a)||T(c))return a}return d(h(t.config.projectRoot,o))}function ut(t,n,e){let r=N(t),o;if(e.startsWith(".")){let s=e.match(/^(\.+)(.*)$/);if(!s)return null;let c=s[1].length,a=s[2].replace(/^\./,""),i=S(g(t.config.projectRoot,n));for(let l=1;l<c;l++)i=S(i);o=a?u(i,a.replace(/\./g,"/")):i}else o=u(t.config.projectRoot,e.replace(/\./g,"/"));for(let s of dt(o)){let c=d(h(t.config.projectRoot,s));if(r.has(c)||T(s))return c}return null}function gt(t,n,e){if(!e)return null;let r=e.replace(/\s+as\s+.+$/,"").trim();if(!r.startsWith("crate::")&&!r.startsWith("self::")&&!r.startsWith("super::"))return null;let o=S(g(t.config.projectRoot,n)),s;return r.startsWith("crate::")?s=u(t.config.projectRoot,"src",r.slice(7).replace(/::/g,"/")):r.startsWith("self::")?s=u(o,r.slice(6).replace(/::/g,"/")):s=u(S(o),r.slice(7).replace(/::/g,"/")),C(t,Et(s))}function pt(t,n,e){let r=S(g(t.config.projectRoot,n)),o=u(r,e);return C(t,ht(o))}function ft(t,n,e){let r=S(g(t.config.projectRoot,n)),o=[u(r,e),u(t.config.projectRoot,e),u(t.config.projectRoot,"include",e),u(t.config.projectRoot,"src",e)];return C(t,o)}function St(t,n,e){let r=N(t),o=n.replace(/\\/g,".").replace(/::/g,".").replace(/^global::/,""),s=o.replace(/\./g,"/"),c=o.split(".").pop()??o;for(let i of e){let l=`${s}${i}`,I=[...r].find(F=>F.endsWith(l));if(I)return I}for(let i of e){let l=[...r].find(I=>Y(I)===`${c}${i}`);if(l)return l}let a=[...r].filter(i=>e.includes(p(i).toLowerCase())).filter(i=>i.includes(`/${s}/`)||i.includes(`/${c}/`)).sort((i,l)=>i.localeCompare(l));return a.length===1?a[0]:null}function xt(t,n,e){let r=N(t);if(e.startsWith("package:")){let c=e.slice(8),a=c.indexOf("/");if(a<0)return null;let i=c.slice(a+1),l=d(i.startsWith("lib/")?i:`lib/${i}`);return r.has(l)?l:null}let o=S(g(t.config.projectRoot,n)),s=u(o,e);for(let c of mt(s)){let a=d(h(t.config.projectRoot,c));if(r.has(a)||T(c))return a}return null}function dt(t){let n=p(t);return R.has(n)?[t]:[`${t}.py`,`${t}.pyi`,g(t,"__init__.py"),g(t,"__init__.pyi")]}function C(t,n){let e=N(t);for(let r of n){let o=d(h(t.config.projectRoot,r));if(e.has(o)||T(r))return o}return null}function Et(t){let n=p(t);return D.has(n)?[t]:[`${t}.rs`,g(t,"mod.rs")]}function ht(t){let n=p(t);return $.has(n)?[t]:[`${t}.rb`,g(t,"index.rb")]}function mt(t){let n=p(t);return y.has(n)?[t]:[`${t}.dart`,t]}function Nt(t){let n=p(t),e=new Set;if(n){e.add(t);for(let r of m)e.add(t.slice(0,-n.length)+r)}else for(let r of m)e.add(`${t}${r}`),e.add(g(t,`index${r}`));return[...e]}function N(t){return K.get(t,()=>new Set(P(t,{includeIgnored:!1}).map(d)))}function d(t){return t.replace(/\\/g,"/")}export{m as a,X as b,b as c,k as d,A as e,L as f,W as g,H as h,U as i,vt as j,ct as k,Xt as l,ut as m,gt as n,pt as o,ft as p,St as q,xt as r,d as s,G as t,Rt as u,Dt as v,$t as w,yt as x};
|
|
2
|
+
//# sourceMappingURL=chunk-ADKQX2OY.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as g}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as g}from"./chunk-44JOJLMO.js";import{a as u}from"./chunk-5ALI77D7.js";import{c as i}from"./chunk-64LH2QUP.js";function w(r,b,y,f={}){let s=u(r,b),n=u(r,y);if(!s||!n)return null;let c=new Set(g(r,s,{semantic:f.semantic}).map(e=>e.symbol)),m=new Set(g(r,n,{semantic:f.semantic}).map(e=>e.symbol)),l=[];for(let e of c)m.has(e)&&l.push(e);let o=[];for(let e of c)m.has(e)||o.push(e);let a=[];for(let e of m)c.has(e)||a.push(e);let h=new Set([...c,...m]),d=h.size>0?l.length/h.size:0,t;h.size===0?t="Neither function calls other tracked symbols. There is no callee-pattern evidence for consolidation; inspect the source bodies directly.":l.length===0?t="These functions do not share any callees. They are not a callee-based consolidation candidate.":o.length===0&&a.length===0?t="These functions have identical tracked callee sets. They are a strong structural match, but identical callees do not prove interchangeable semantics; inspect signatures, control flow, and return values before consolidating.":o.length===0?t="A's tracked callees are a subset of B's. B may subsume part of A's structure, but verify signatures, guards, and non-call logic before replacing A with B.":a.length===0?t="B's tracked callees are a subset of A's. A may subsume part of B's structure, but verify signatures, guards, and non-call logic before replacing B with A.":o.length<=2&&a.length<=2?t=`Create a shared function with the ${l.length} common callees. Pass the ${o.length+a.length} divergent callees as parameters or strategy callbacks.`:t=`Extract the ${l.length} shared callees into a common helper. Each function calls the helper plus its own unique logic (${o.length} callees in A, ${a.length} in B).`;let p=s.endLine-s.startLine+1,A=n.endLine-n.startLine+1;return{symbolA:{symbol:s.symbol,shortName:i(s.symbol),file:s.relativePath,loc:p},symbolB:{symbol:n.symbol,shortName:i(n.symbol),file:n.relativePath,loc:A},similarity:d,sharedCallees:l.map(i),uniqueToA:o.map(i),uniqueToB:a.map(i),consolidationStrategy:t}}export{w as a};
|
|
2
|
+
//# sourceMappingURL=chunk-ADTG377O.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import{a as S}from"./chunk-W3PQRAI4.js";import{e as b}from"./chunk-QH5GTVVB.js";import{c as p,f as h,h as y}from"./chunk-64LH2QUP.js";import{execFileSync as d}from"child_process";import{existsSync as x,readFileSync as N}from"fs";import{basename as C}from"path";var v="Unable to compute git diff.";function le(e,n={}){let t=n.plan??P(e,n);return t.note?A(t.note,t.changedFileLines):t.changedFiles.length===0?O(t.changedFileLines):T(t.changedFiles,[E(e,t.changedFiles,t.changedFiles,t.changedRanges)])}function P(e,n={}){let{base:t="HEAD"}=n;try{let i=$(e.config.projectRoot,t),r=J(e,i),s=G(e,k(e.config.projectRoot,t));return{changedFileLines:i,changedFiles:r,changedRanges:s,renamedFiles:B(e.config.projectRoot,t,r),note:i.length===0?"No changed files found.":void 0}}catch{return{changedFileLines:[],changedFiles:[],changedRanges:[],renamedFiles:[],note:v}}}function E(e,n,t,i=[]){let r=new S(e),s=new Set(t),a=q(i),c=[],m=new Map,f=n.flatMap(o=>r.definitionsForFile(o)).filter(ee).filter(o=>V(o,a)).sort((o,u)=>o.relativePath.localeCompare(u.relativePath)||o.startLine-u.startLine),l=f.map(o=>o.symbolId),g=K(e,l),w=Q(e,l,t),M=b(e,f.filter(o=>g.get(o.symbolId)===0));for(let o of f)j(e,o,s,c,m,M.get(o.symbolId)??new Set,g.get(o.symbolId)??0,w.get(o.symbolId)??new Set);return{changedSymbols:c,consumerEntries:[...m.entries()].map(([o,u])=>({file:o,symbols:[...u].sort()}))}}function T(e,n){let t=new Map,i=n.flatMap(s=>s.changedSymbols);for(let s of n)for(let a of s.consumerEntries){let c=t.get(a.file);c||(c=new Set,t.set(a.file,c));for(let m of a.symbols)c.add(m)}let r=X(t);return{changedFiles:[...e],changedSymbols:i,affectedConsumers:r,summary:{totalChangedFiles:e.length,totalChangedSymbols:i.length,totalAffectedFiles:r.length}}}function A(e,n=[]){return{changedFiles:n,changedSymbols:[],affectedConsumers:[],summary:{totalChangedFiles:n.length,totalChangedSymbols:0,totalAffectedFiles:0,note:e}}}function O(e){return{changedFiles:e,changedSymbols:[],affectedConsumers:[],summary:{totalChangedFiles:e.length,totalChangedSymbols:0,totalAffectedFiles:0,note:"Changed files are not present in the current SCIP index."}}}function $(e,n){let t=d("git",["diff","--name-only",n],{encoding:"utf-8",cwd:e,timeout:1e4}),i=d("git",["diff","--name-only","--cached",n],{encoding:"utf-8",cwd:e,timeout:1e4}),r=d("git",["ls-files","--others","--exclude-standard"],{encoding:"utf-8",cwd:e,timeout:1e4});return[...new Set([t,i,r].flatMap(s=>s.split(`
|
|
2
|
+
`)).map(s=>s.trim()).filter(s=>s.length>0))]}function k(e,n){let t=d("git",["diff","--unified=0",n],{encoding:"utf-8",cwd:e,timeout:1e4}),i=d("git",["diff","--unified=0","--cached",n],{encoding:"utf-8",cwd:e,timeout:1e4});return _([...L(t),...L(i)])}function z(e,n,t){try{return d("git",["show",`${n}:./${t}`],{encoding:"utf-8",cwd:e,timeout:1e4,stdio:["ignore","pipe","ignore"]})}catch{return null}}function B(e,n,t){let i=W(e,n);if(i.length===0||t.length===0)return[];let r=new Map,s=new Set;for(let a of U(e,n))t.includes(a.to)&&(r.set(a.to,a),s.add(a.from));for(let a of t){if(r.has(a)||!x(`${e}/${a}`))continue;let c=i.filter(l=>!s.has(l)).filter(l=>C(l)===C(a));if(c.length===0)continue;let m=N(`${e}/${a}`,"utf-8"),f=c.map(l=>({from:l,to:a,similarity:H(z(e,n,l)??"",m)})).sort((l,g)=>g.similarity-l.similarity)[0];f&&f.similarity>=.45&&(r.set(a,f),s.add(f.from))}return[...r.values()].sort((a,c)=>a.to.localeCompare(c.to))}function W(e,n){let t=d("git",["diff","--name-only","--diff-filter=D",n],{encoding:"utf-8",cwd:e,timeout:1e4}),i=d("git",["diff","--name-only","--diff-filter=D","--cached",n],{encoding:"utf-8",cwd:e,timeout:1e4});return[...new Set([...R(t),...R(i)])]}function U(e,n){let t=d("git",["diff","--name-status","--find-renames",n],{encoding:"utf-8",cwd:e,timeout:1e4}),i=d("git",["diff","--name-status","--find-renames","--cached",n],{encoding:"utf-8",cwd:e,timeout:1e4});return[...t.split(`
|
|
3
|
+
`),...i.split(`
|
|
4
|
+
`)].map(r=>r.trim()).filter(r=>r.startsWith("R")).map(r=>r.split(" ")).filter(r=>r.length>=3).map(([r,s,a])=>({from:s,to:a,similarity:Number(r.slice(1))/100}))}function H(e,n){let t=new Set(I(e)),i=new Set(I(n));if(t.size===0&&i.size===0)return 1;if(t.size===0||i.size===0)return 0;let r=0;for(let s of t)i.has(s)&&(r+=1);return 2*r/(t.size+i.size)}function I(e){return e.match(/[A-Za-z_$][\w$]*|[{}()[\].,]/g)??[]}function R(e){return e.split(`
|
|
5
|
+
`).map(n=>n.trim()).filter(n=>n.length>0)}function J(e,n){let t=F(e),i=[];for(let r of n){let s=t(r);s&&!e.isIgnored(s)&&i.push(s)}return i}function G(e,n){let t=F(e),i=[];for(let r of n){let s=t(r.file);s&&!e.isIgnored(s)&&i.push({...r,file:s})}return _(i)}function F(e){let n=e.all(`SELECT relative_path FROM documents
|
|
6
|
+
ORDER BY id`).map(i=>i.relative_path),t=new Map(n.map(i=>[i,i]));return i=>{let r=i.replace(/\\/g,"/"),s=t.get(r);return s||(n.find(a=>a.endsWith(r))??null)}}function L(e){let n=[],t=null;for(let i of e.split(`
|
|
7
|
+
`)){if(i.startsWith("+++ ")){t=Y(i.slice(4).trim());continue}if(!t||!i.startsWith("@@ "))continue;let r=/@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@/.exec(i);if(!r)continue;let s=Math.max(0,Number(r[1])-1),a=r[2]===void 0?1:Number(r[2]);n.push({file:t,startLine:s,endLine:Math.max(s,s+Math.max(a,1)-1)})}return n}function Y(e){return e==="/dev/null"?null:e.startsWith("a/")||e.startsWith("b/")?e.slice(2):e}function _(e){let n=new Set,t=[];for(let i of e){let r=`${i.file}:${i.startLine}:${i.endLine}`;n.has(r)||(n.add(r),t.push(i))}return t}function q(e){let n=new Map;for(let t of e){let i=n.get(t.file);i||(i=[],n.set(t.file,i)),i.push(t)}return n}function V(e,n){let t=n.get(e.relativePath);return!t||t.length===0?!0:t.some(i=>Z(e.startLine,e.endLine,i.startLine,i.endLine))}function Z(e,n,t,i){return e<=i&&t<=n}function j(e,n,t,i,r,s,a,c){let m=Math.max(a,s.size);if(!ne(n,m))return;let f=p(n.symbol);i.push({symbol:n.symbol,shortName:f,file:n.relativePath,startLine:n.startLine,endLine:n.endLine,fanIn:m});for(let l of c)D(e,t,r,l,f);for(let l of s)D(e,t,r,l,f)}function K(e,n){if(n.length===0)return new Map;let t=e.all(`SELECT m.symbol_id, COUNT(DISTINCT c.document_id) AS fan_in
|
|
8
|
+
FROM mentions m
|
|
9
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
10
|
+
WHERE m.symbol_id IN (${n.map(()=>"?").join(",")})
|
|
11
|
+
AND m.role != 1
|
|
12
|
+
GROUP BY m.symbol_id`,...n);return new Map(t.map(i=>[i.symbol_id,i.fan_in]))}function Q(e,n,t){if(n.length===0||t.length===0)return new Map;let i=e.all(`SELECT DISTINCT m.symbol_id, ref_d.relative_path
|
|
13
|
+
FROM mentions m
|
|
14
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
15
|
+
JOIN documents ref_d ON c.document_id = ref_d.id
|
|
16
|
+
WHERE m.symbol_id IN (${n.map(()=>"?").join(",")})
|
|
17
|
+
AND m.role != 1
|
|
18
|
+
AND ref_d.relative_path NOT IN (${t.map(()=>"?").join(",")})
|
|
19
|
+
${e.pathExclusionsFor("ref_d")}`,...n,...t),r=new Map;for(let s of i){let a=r.get(s.symbol_id);a||(a=new Set,r.set(s.symbol_id,a)),a.add(s.relative_path)}return r}function D(e,n,t,i,r){if(e.isIgnored(i)||n.has(i))return;let s=t.get(i);s||(s=new Set,t.set(i,s)),s.add(r)}function X(e){return[...e.entries()].map(([n,t])=>({file:n,consumedSymbols:t.size})).sort((n,t)=>t.consumedSymbols-n.consumedSymbols)}function ee(e){return!(y(e.symbol)||e.parentTypeName!==null&&!h(e.symbol))}function ne(e,n){return h(e.symbol)||e.isTypeLike?!0:e.parentTypeName===null&&n>0}export{v as a,le as b,P as c,E as d,T as e,z as f};
|
|
20
|
+
//# sourceMappingURL=chunk-ATGRITZP.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as p}from"./chunk-B75HZHUP.js";import{a as y}from"./chunk-W3PQRAI4.js";import{a as o}from"./chunk-BGBBVSH4.js";import{c as b}from"./chunk-64LH2QUP.js";function P(u,c={}){let{scope:f,minLoc:L=3,scanLimit:l}=c,s=new y(u),r=c.semantic!==!1,t=p(s.productionCallableDefinitions({scope:f,minLoc:L,excludeEntrySurfaces:!0,excludeRustTraitImplMembers:!0,includeSuppressed:!0,sortByLocDesc:typeof l=="number"&&l>0}),l),h=s.crossFileCallerMap(t,{semantic:r}),a=new Set(h.keys());for(let e of s.frameworkReferencedSymbolIds(t))a.add(e);let n=s.symbolsWithNonSelfCallees(t,{additive:!1,semantic:r}),m=t.filter(e=>!a.has(e.symbolId)).filter(e=>!n.has(e.symbolId)),I=s.sourceFallbackCallerFiles(m);for(let e of I.keys())a.add(e);let d=m.filter(e=>!a.has(e.symbolId)),C=s.symbolsWithNonSelfCallees(d,{additive:!0,semantic:r});for(let e of C)n.add(e);return d.filter(e=>!n.has(e.symbolId)).sort((e,i)=>o(i)-o(e)||e.relativePath.localeCompare(i.relativePath)||e.startLine-i.startLine).map(e=>({symbol:e.symbol,shortName:b(e.symbol),relativePath:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:o(e)}))}export{P as a};
|
|
2
|
+
//# sourceMappingURL=chunk-B3HMRQDA.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as o}from"./chunk-BGBBVSH4.js";function u(n,e){return o(n)-o(e)||n.relativePath.localeCompare(e.relativePath)}function d(n,e){return typeof e!="number"||e<=0||n.length<=e?n:n.slice(0,e)}function l(n){let e=new Set,i=[];for(let t of n){let r=`${t.symbol}|${t.file}`;e.has(r)||(e.add(r),i.push(t))}return i}export{u as a,d as b,l as c};
|
|
2
|
+
//# sourceMappingURL=chunk-B75HZHUP.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var b=[];function p(t){t.groups.length>0&&b.push(t)}function D(t,c){let a=new Set(c.groups);for(let n of b)n.groups.some(r=>a.has(r))&&(c.file!==void 0&&n.clearFile?n.clearFile(t,c.file):n.clearAll(t))}function g(){let t=new WeakMap;return{cache:t,ensure(c){let a=t.get(c);return a||(a=new Map,t.set(c,a)),a}}}function f(t,c){let{cache:a,ensure:n}=g(),r={get(e,i,o){let s=n(e);if(s.has(i))return s.get(i);let l=o();return s.set(i,l),l},invalidate(e,i){a.get(e)?.delete(i)},invalidateAll(e){a.delete(e)},size(e){return a.get(e)?.size??0}};return p({name:t,groups:c.clearGroups,clearAll:e=>r.invalidateAll(e),clearFile:(e,i)=>r.invalidate(e,i)}),r}function S(t,c){let a=new WeakMap,n={get(r,e){let i=a.get(r);if(i)return i.value;let o=e();return a.set(r,{value:o}),o},invalidate(r){a.delete(r)},has(r){return a.has(r)}};return p({name:t,groups:c.clearGroups,clearAll:r=>n.invalidate(r)}),n}var h={clearGroups:["whole-project","source-file"]};function P(t){return C(t,h)}function C(t,c){let{cache:a,ensure:n}=g(),r={get(e,i,o,s){let l=n(e),u=l.get(i);if(u&&u.source===o)return u.value;let d=s();return l.set(i,{source:o,value:d}),d},invalidate(e,i){a.get(e)?.delete(i)},invalidateAll(e){a.delete(e)}};return p({name:t,groups:c.clearGroups,clearAll:e=>r.invalidateAll(e),clearFile:(e,i)=>r.invalidate(e,i)}),r}export{p as a,D as b,f as c,S as d,P as e,C as f};
|
|
2
|
+
//# sourceMappingURL=chunk-BJ7OHKB5.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{o as d}from"./chunk-
|
|
1
|
+
import{o as d}from"./chunk-SA6B3EGD.js";import{a as h}from"./chunk-5ALI77D7.js";import{g}from"./chunk-64LH2QUP.js";import{a as m}from"./chunk-YVQUQIBM.js";import{a as p}from"./chunk-NN3O7TPH.js";function _(t,r,n={}){let e=h(t,r);if(!e)return[];let l=!g(e.symbol)&&!t.isIgnored(e.relativePath)?[{relativePath:e.relativePath,line:e.startLine}]:[],c=d(t,e,{semantic:n.semantic}).map(o=>({relativePath:o.file,line:o.line})),s=R(t,e),f=new Set,a=[];for(let o of[...l,...c,...s]){let u=`${o.relativePath}:${o.line}`;f.has(u)||(f.add(u),a.push(o))}return a}function R(t,r){if(!r.relativePath.endsWith(".rb"))return[];let n=b(r.symbol);if(n.length===0)return[];let e=[];for(let i of p(t,{extensions:[".rb"],includeIgnored:!1})){let l=m(t,i);if(!l)continue;let c=l.split(`
|
|
2
2
|
`);for(let s=0;s<c.length;s++){let f=c[s]??"";n.some(a=>new RegExp(`@${a}\\b|\\b${a}:`).test(f))&&e.push({relativePath:i,line:s})}}return e}function b(t){let n=(t.split(":").pop()??t).replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[^A-Za-z0-9_]+/g,"_").toLowerCase().replace(/^_+|_+$/g,""),e=n.split("_").filter(Boolean),i=new Set;return n&&i.add(n),e.length>=1&&i.add(e[e.length-1]),e.length>=2&&i.add(e.slice(-2).join("_")),[...i]}export{_ as a};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
//# sourceMappingURL=chunk-CCB45WDY.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function f(e){let t=[];if(e.filePattern){let r=e.profiles.find(i=>i.file.includes(e.filePattern));if(!r)return[];for(let i of e.profiles){if(i.file===r.file)continue;let l=e.compare(r,i);l&&t.push(l)}}else{let r=typeof e.overrunFactor=="number"&&Number.isFinite(e.limit)?e.limit*e.overrunFactor:Number.POSITIVE_INFINITY;for(let i=0;i<e.profiles.length;i+=1){for(let l=i+1;l<e.profiles.length;l+=1){let n=e.compare(e.profiles[i],e.profiles[l]);n&&t.push(n)}if(t.length>r)break}}return t.sort(e.sort??((r,i)=>i.similarity-r.similarity)),t.slice(0,e.limit)}export{f as a};
|
|
2
|
+
//# sourceMappingURL=chunk-CFLYMEUS.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import{c as p}from"./chunk-BJ7OHKB5.js";import{createHash as u}from"crypto";import{createRequire as h}from"module";import{dirname as g,join as v}from"path";import T from"better-sqlite3";var m=h(import.meta.url),f="evidence.db",s=new WeakMap,N=p("evidence-content-hash",{clearGroups:["whole-project","source-file"]});function C(){for(let t of["../package.json","../../package.json"])try{return m(t).version}catch{}return"0.0.0"}var c=C();function S(t){return u("sha256").update(t).digest("hex")}function O(t,n,e){return N.get(t,n,()=>S(e))}function E(t,n){process.env.SCIP_QUERY_DEBUG&&console.error(`evidence-cache: ${t}: ${n instanceof Error?n.message:String(n)}`)}function l(t){if(s.has(t))return s.get(t)??null;let n=null;try{let e=new T(v(g(t.config.dbPath),f));e.pragma("journal_mode = WAL"),e.pragma("busy_timeout = 5000"),e.pragma("synchronous = NORMAL"),e.exec(`
|
|
2
|
+
CREATE TABLE IF NOT EXISTS file_evidence (
|
|
3
|
+
kind TEXT NOT NULL,
|
|
4
|
+
relative_path TEXT NOT NULL,
|
|
5
|
+
content_hash TEXT NOT NULL,
|
|
6
|
+
version TEXT NOT NULL,
|
|
7
|
+
payload TEXT NOT NULL,
|
|
8
|
+
PRIMARY KEY (kind, relative_path)
|
|
9
|
+
);
|
|
10
|
+
CREATE TABLE IF NOT EXISTS semantic_callees (
|
|
11
|
+
relative_path TEXT NOT NULL,
|
|
12
|
+
symbol TEXT NOT NULL,
|
|
13
|
+
content_hash TEXT NOT NULL,
|
|
14
|
+
deps_digest TEXT NOT NULL,
|
|
15
|
+
version TEXT NOT NULL,
|
|
16
|
+
payload TEXT NOT NULL,
|
|
17
|
+
PRIMARY KEY (relative_path, symbol)
|
|
18
|
+
);
|
|
19
|
+
`),n={evidence:e,readFileEvidence:e.prepare("SELECT payload FROM file_evidence WHERE kind = ? AND relative_path = ? AND content_hash = ? AND version = ?"),writeFileEvidence:e.prepare("INSERT OR REPLACE INTO file_evidence (kind, relative_path, content_hash, version, payload) VALUES (?, ?, ?, ?, ?)"),readCallees:e.prepare(`SELECT payload FROM semantic_callees
|
|
20
|
+
WHERE relative_path = ? AND symbol = ? AND content_hash = ? AND deps_digest = ? AND version = ?`),writeCallees:e.prepare(`INSERT OR REPLACE INTO semantic_callees
|
|
21
|
+
(relative_path, symbol, content_hash, deps_digest, version, payload) VALUES (?, ?, ?, ?, ?, ?)`),dropStaleCallees:e.prepare("DELETE FROM semantic_callees WHERE relative_path = ? AND content_hash != ?")}}catch(e){E("disabled (open failed)",e)}return s.set(t,n),n}function d(t,n,e){E(`disabled (${n})`,e),s.set(t,null)}function A(t,n,e,i){let a=l(t);if(!a)return null;try{return a.readFileEvidence.get(n,e,i,c)?.payload??null}catch(r){return d(t,"file_evidence read",r),null}}function R(t,n,e,i,a){let r=l(t);if(r)try{r.writeFileEvidence.run(n,e,i,c,a)}catch(o){d(t,"file_evidence write",o)}}function w(t,n,e,i,a){let r=l(t);if(!r)return null;try{return r.readCallees.get(n,e,i,a,c)?.payload??null}catch(o){return d(t,"semantic_callees read",o),null}}function F(t,n){if(n.length===0)return;let e=l(t);if(e)try{e.evidence.transaction(()=>{let i=new Set;for(let a of n){let r=`${a.relativePath}\0${a.contentHash}`;i.has(r)||(i.add(r),e.dropStaleCallees.run(a.relativePath,a.contentHash)),e.writeCallees.run(a.relativePath,a.symbol,a.contentHash,a.depsDigest,c,a.payload)}})()}catch(i){d(t,"semantic_callees write",i)}}export{S as a,O as b,A as c,R as d,w as e,F as f};
|
|
22
|
+
//# sourceMappingURL=chunk-CMGOXDVP.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as Z}from"./chunk-62NMBOA5.js";import{a as Q}from"./chunk-JTRY2YRJ.js";import{a as K}from"./chunk-N2T2GPYQ.js";import{a as J}from"./chunk-TUAPDKBI.js";import{a as X}from"./chunk-LY6NRJPJ.js";import{a as ee}from"./chunk-24PFLKFK.js";import{a as Y}from"./chunk-HQHFMPLJ.js";import{a as l}from"./chunk-B32FX5KB.js";import{a as j}from"./chunk-DTERBKUE.js";import{a as G}from"./chunk-LXM7AHQG.js";import{a as W}from"./chunk-WZVTADY7.js";import{a as O}from"./chunk-B3HMRQDA.js";import{a as q}from"./chunk-R42LZMLX.js";import{a as N}from"./chunk-4EAANIWC.js";import{b as U}from"./chunk-TTGWDUJ4.js";import{a as z}from"./chunk-Y33GRQK6.js";import{a as A,b as B}from"./chunk-6U4EODW3.js";import{b as _}from"./chunk-RYBMW2EN.js";import{b as V,c as $}from"./chunk-YISMWW66.js";import{a as F}from"./chunk-IJYWCB57.js";import{a as I}from"./chunk-E55WCTLH.js";import{e as D,f as E}from"./chunk-L77GXANO.js";function f(e){return e.scoreCount??e.count}function M(e){let r=Me(e),{breakdown:t,pressure:i}=ke(e),o=oe(t,"risk"),n=oe(t,"hygiene");return{score:Math.min(o,n),riskScore:o,hygieneScore:n,scoreBreakdown:t,overview:{documents:e.statsResult.documents,symbols:e.statsResult.symbols,indexSizeBytes:e.statsResult.indexSizeBytes},findings:{deadSymbols:e.dead.count,deadLoc:e.dead.loc,isolatedSymbols:e.isolated.count,isolatedLoc:e.isolated.loc,cycles:e.realCycleCount,similarPairs:e.similarCount,reactComponentDuplicatePairs:e.reactComponentDuplicates.count,reactHookCandidatePairs:e.reactHookCandidates.count,reactHookCandidateScoreCount:f(e.reactHookCandidates),reactLargeComponentPressureFiles:e.reactLargeComponentPressure.count,vueComponentDuplicatePairs:e.vueComponentDuplicates.count,vueComposableCandidatePairs:e.vueComposableCandidates.count,vueComposableCandidateScoreCount:f(e.vueComposableCandidates),vueLargeViewPressureFiles:e.vueLargeViewPressure.count,extractionCandidates:e.extractCount,wrappers:e.wrappers.count,passthroughs:e.passthroughs.count,staleTypes:e.stale.count,driftedFiles:e.drift.count,complexityHotspotCount:e.complexity.extremeCount,hiddenCouplingPairs:e.gitEvidence?.hiddenCoupling.pairCount??null},axes:De(e),validation:Ae(e),suppressions:e.suppressions,actions:r,pressure:i,topComplexity:e.complexity.top,warnings:e.warnings.length>0?e.warnings:void 0}}function De(e){return{deletable:{loc:e.dead.loc+e.isolated.loc,symbols:e.dead.count+e.isolated.count},cycles:{count:e.realCycleCount},changeAmplification:e.gitEvidence?.amplification??null,hiddenCoupling:e.gitEvidence?.hiddenCoupling??null,churnWeightedComplexity:Ee(e),evidenceQuality:{graphFindings:e.dead.count+e.isolated.count+e.realCycleCount,heuristicFindings:e.similarCount+e.reactComponentDuplicates.count+e.reactHookCandidates.count+e.reactLargeComponentPressure.count+e.vueComponentDuplicates.count+e.vueComposableCandidates.count+e.vueLargeViewPressure.count+e.extractCount+e.wrappers.count+e.passthroughs.count+e.stale.count+e.drift.count,userSuppressed:e.suppressions?.total??0}}}function Ee(e){let r=e.gitEvidence?.fileStats;return r?e.complexity.top.map(t=>{let i=t.file?r[t.file]?.changes??0:0;return{...t,changes:i,weighted:u(t.score*Math.log2(1+i))}}).sort((t,i)=>i.weighted-t.weighted):null}function Ae(e){let r=e.gitEvidence?.fileStats;if(!r)return null;let t={dead:e.dead.files??[],isolated:e.isolated.files??[],wrappers:e.wrappers.files??[],passthroughs:e.passthroughs.files??[],stale:e.stale.files??[],reactComponents:e.reactComponentDuplicates.files??[],reactHooks:e.reactHookCandidates.files??[],reactLargeComponents:e.reactLargeComponentPressure.files??[],vueComponents:e.vueComponentDuplicates.files??[],vueComposables:e.vueComposableCandidates.files??[],vueLargeViews:e.vueLargeViewPressure.files??[]},i=new Set(Object.values(t).flat()),o=0,n=0,a=0;for(let[b,p]of Object.entries(r))i.has(b)?o+=p.fixChanges:(n+=p.fixChanges,a+=1);let C=i.size>0?u(o/i.size):0,d=a>0?u(n/a):0,v={};for(let[b,p]of Object.entries(t)){let m=new Set(p);if(m.size===0)continue;let S=0;for(let x of m)S+=r[x]?.fixChanges??0;let H=u(S/m.size);v[b]={flaggedFiles:m.size,fixDensity:H,lift:d>0?u(H/d):null}}return{flaggedFiles:i.size,flaggedFixDensity:C,baselineFixDensity:d,ratio:i.size>0&&d>0?u(C/d):null,byCategory:v}}function u(e){return Math.round(e*100)/100}function ne(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/0+$/,"").replace(/\.$/,"")}function te(e){let r=f(e);return Math.abs(r-e.count)<.01?"":` (${ne(r)} score-weighted after existing shared infrastructure discount)`}function re(e,r){let t=f(e),i=`${e.count} ${r}`;return Math.abs(t-e.count)<.01?i:`${i} (${ne(t)} score-weighted)`}function Me(e){let r=[];if(e.dead.count>0&&r.push({category:"Dead code",evidence:"graph-fact",description:`${e.dead.count} symbols with zero references anywhere \u2014 safe to delete`,effort:"low",impact:"high",count:e.dead.count,locRecoverable:e.dead.loc}),e.isolated.count>0&&r.push({category:"Isolated symbols",evidence:"graph-fact",description:`${e.isolated.count} symbols completely disconnected from the codebase graph`,effort:"low",impact:"medium",count:e.isolated.count,locRecoverable:e.isolated.loc}),e.realCycleCount>0&&r.push({category:"Circular dependencies",evidence:"graph-fact",description:`${e.realCycleCount} cycle(s) \u2014 break with dependency inversion or module restructuring`,effort:"medium",impact:"high",count:e.realCycleCount,locRecoverable:0}),e.similarCount>0&&r.push({category:"Similar functions",evidence:"heuristic",description:`${e.similarCount} pairs with real logic overlap (beyond shared imports) \u2014 consolidation candidates`,effort:"medium",impact:"medium",count:e.similarCount,locRecoverable:0}),e.reactComponentDuplicates.count>0&&r.push({category:"Duplicated React components",evidence:"heuristic",description:`${e.reactComponentDuplicates.count} React component pair(s) share JSX structure \u2014 extract or reuse the shared UI concept`,effort:"medium",impact:"medium",count:e.reactComponentDuplicates.count,locRecoverable:e.reactComponentDuplicates.loc}),e.reactHookCandidates.count>0&&r.push({category:"Duplicated React hook behavior",evidence:"heuristic",description:`${e.reactHookCandidates.count} React component pair(s) share state/effect/request behavior${te(e.reactHookCandidates)} \u2014 extract or reuse a hook`,effort:"medium",impact:"medium",count:e.reactHookCandidates.count,locRecoverable:e.reactHookCandidates.loc}),e.reactLargeComponentPressure.count>0&&r.push({category:"Large React components",evidence:"heuristic",description:`${e.reactLargeComponentPressure.count} React component(s) concentrate JSX/behavior pressure \u2014 split by reason to change`,effort:"medium",impact:"medium",count:e.reactLargeComponentPressure.count,locRecoverable:0}),e.vueComponentDuplicates.count>0&&r.push({category:"Duplicated Vue components",evidence:"heuristic",description:`${e.vueComponentDuplicates.count} Vue component pair(s) share template structure \u2014 extract or reuse the shared UI concept`,effort:"medium",impact:"medium",count:e.vueComponentDuplicates.count,locRecoverable:e.vueComponentDuplicates.loc}),e.vueComposableCandidates.count>0&&r.push({category:"Duplicated Vue behavior",evidence:"heuristic",description:`${e.vueComposableCandidates.count} Vue component pair(s) share state/effect/request behavior${te(e.vueComposableCandidates)} \u2014 extract or reuse a composable`,effort:"medium",impact:"medium",count:e.vueComposableCandidates.count,locRecoverable:e.vueComposableCandidates.loc}),e.vueLargeViewPressure.count>0&&r.push({category:"Large Vue views",evidence:"heuristic",description:`${e.vueLargeViewPressure.count} Vue file(s) concentrate template/script/style pressure \u2014 split by reason to change`,effort:"medium",impact:"medium",count:e.vueLargeViewPressure.count,locRecoverable:0}),e.extractCount>0&&r.push({category:"Extraction candidates",evidence:"heuristic",description:`${e.extractCount} large functions with isolated callee clusters \u2014 extract method opportunities`,effort:"medium",impact:"medium",count:e.extractCount,locRecoverable:0}),e.wrappers.count>0&&r.push({category:"Wrapper functions",evidence:"heuristic",description:`${e.wrappers.count} single-consumer symbols that could be inlined`,effort:"low",impact:"low",count:e.wrappers.count,locRecoverable:e.wrappers.loc}),e.passthroughs.count>0&&r.push({category:"Passthrough functions",evidence:"heuristic",description:`${e.passthroughs.count} functions that just forward to one callee \u2014 unnecessary indirection`,effort:"low",impact:"low",count:e.passthroughs.count,locRecoverable:e.passthroughs.loc}),e.stale.count>0){let o=[];e.stale.unused>0&&o.push(`${e.stale.unused} unused`),e.stale.singleUse>0&&o.push(`${e.stale.singleUse} single-consumer (not in types file)`),r.push({category:"Stale abstractions",evidence:"heuristic",description:`${o.join(", ")} \u2014 premature abstraction`,effort:"low",impact:"medium",count:e.stale.count,locRecoverable:e.stale.loc})}if(e.drift.count>0){let o=[];e.drift.unusedImports>0&&o.push(`${e.drift.unusedImports} unused imports`),e.drift.layerViolations>0&&o.push(`${e.drift.layerViolations} layer violations`),r.push({category:"Structural drift",evidence:"heuristic",description:o.join(", "),effort:e.drift.layerViolations>0?"medium":"low",impact:e.drift.layerViolations>0?"medium":"low",count:e.drift.count,locRecoverable:0})}if(e.gitEvidence&&e.gitEvidence.hiddenCoupling.pairCount>0){let o=e.gitEvidence.hiddenCoupling.top[0];r.push({category:"Hidden coupling",evidence:"change-graph",description:`${e.gitEvidence.hiddenCoupling.pairCount} file pair(s) co-change without a structural link`+(o?` (e.g. ${o.fileA} \u2194 ${o.fileB})`:"")+" \u2014 name the shared concept or enforce the sync",effort:"medium",impact:"high",count:e.gitEvidence.hiddenCoupling.pairCount,locRecoverable:0})}let t={high:3,medium:2,low:1},i={low:3,medium:2,high:1};return r.sort((o,n)=>{let a=t[o.impact]*i[o.effort];return t[n.impact]*i[n.effort]-a}),r}var ie={"dead-code":"risk",isolated:"risk",cycles:"risk",complexity:"risk","hidden-coupling":"risk","cycles-pressure":"risk","complexity-pressure":"risk","hidden-coupling-pressure":"risk",similar:"hygiene","react-component-duplicates":"hygiene","react-hook-candidates":"hygiene","react-large-component-pressure":"hygiene","vue-component-duplicates":"hygiene","vue-composable-candidates":"hygiene","vue-large-view-pressure":"hygiene",extract:"hygiene",wrappers:"hygiene",passthroughs:"hygiene","stale-abstractions":"hygiene",drift:"hygiene","similar-pressure":"hygiene","react-component-duplicates-pressure":"hygiene","react-hook-candidates-pressure":"hygiene","react-large-component-pressure-pressure":"hygiene","vue-component-duplicates-pressure":"hygiene","vue-composable-candidates-pressure":"hygiene","vue-large-view-pressure-pressure":"hygiene","extract-pressure":"hygiene","wrappers-pressure":"hygiene","passthroughs-pressure":"hygiene","stale-abstractions-pressure":"hygiene","drift-pressure":"hygiene"};function oe(e,r){let t=e.filter(i=>i.kind===r).reduce((i,o)=>i+o.points,0);return Math.max(0,Math.min(100,100-t))}function ke(e){let r=Math.max(e.statsResult.documents,1),t=Math.max(e.statsResult.symbols,1),i=[],o=[],n=(h,L,g)=>{L>0&&i.push({axis:h,points:L,detail:g,kind:ie[h]??"hygiene"})},a=(h,L,g,Le,ye,we,Pe)=>{let y=Math.max(Le,1);if(g<=y)return;let P=g/y,R=Math.min(ye,Math.ceil(Math.log2(P)*we));if(R<=0)return;let Re=ie[h]??"hygiene";o.push({axis:h,category:L,kind:Re,count:g,threshold:u(y),ratio:u(P),extraPenalty:R}),n(h,R,`${g} ${Pe} exceed pressure threshold ${u(y)} (${u(P)}x)`)},C=e.dead.count/t;n("dead-code",Math.min(20,Math.round(C*200)),`${e.dead.count} dead symbols (${e.dead.loc} LOC deletable)`);let d=e.isolated.count/t;n("isolated",Math.min(10,Math.round(d*200)),`${e.isolated.count} isolated symbols (${e.isolated.loc} LOC deletable)`),n("cycles",Math.min(15,e.realCycleCount*5),`${e.realCycleCount} real dependency cycle(s)`);let v=e.similarCount/t*1e3;n("similar",Math.min(10,Math.round(v)),`${e.similarCount} similar function pair(s)`);let b=e.reactComponentDuplicates.count/r*1e3;n("react-component-duplicates",Math.min(10,Math.round(b)),`${e.reactComponentDuplicates.count} duplicated React component pair(s)`);let p=f(e.reactHookCandidates),m=p/r*1e3;n("react-hook-candidates",Math.min(10,Math.round(m)),re(e.reactHookCandidates,"duplicated React behavior pair(s)"));let S=e.reactLargeComponentPressure.count/r*1e3;n("react-large-component-pressure",Math.min(5,Math.round(S/2)),`${e.reactLargeComponentPressure.count} large React component pressure file(s)`);let H=e.vueComponentDuplicates.count/r*1e3;n("vue-component-duplicates",Math.min(10,Math.round(H)),`${e.vueComponentDuplicates.count} duplicated Vue component pair(s)`);let x=f(e.vueComposableCandidates),be=x/r*1e3;n("vue-composable-candidates",Math.min(10,Math.round(be)),re(e.vueComposableCandidates,"duplicated Vue behavior pair(s)"));let ve=e.vueLargeViewPressure.count/r*1e3;n("vue-large-view-pressure",Math.min(5,Math.round(ve/2)),`${e.vueLargeViewPressure.count} large Vue view pressure file(s)`);let Se=e.extractCount/t*1e3;n("extract",Math.min(5,Math.round(Se/2)),`${e.extractCount} extraction candidate(s)`),n("wrappers",Math.min(3,e.wrappers.count),`${e.wrappers.count} wrapper candidate(s)`),n("passthroughs",Math.min(3,e.passthroughs.count),`${e.passthroughs.count} passthrough candidate(s)`);let He=e.stale.count/Math.max(t*.1,1);n("stale-abstractions",Math.min(8,Math.round(He*10)),`${e.stale.count} stale abstraction(s)`);let xe=e.drift.count/r;return n("drift",Math.min(5,Math.round(xe*50)),`${e.drift.count} drift finding(s)`),n("complexity",Math.min(5,e.complexity.extremeCount*2),`${e.complexity.extremeCount} extreme complexity hotspot(s)`),e.gitEvidence&&n("hidden-coupling",Math.min(5,e.gitEvidence.hiddenCoupling.pairCount),`${e.gitEvidence.hiddenCoupling.pairCount} co-changing pair(s) without a structural link`),a("cycles-pressure","Circular dependencies",e.realCycleCount,3,10,3,"cycle(s)"),a("complexity-pressure","Extreme complexity",e.complexity.extremeCount,3,5,2,"extreme complexity hotspot(s)"),e.gitEvidence&&a("hidden-coupling-pressure","Hidden coupling",e.gitEvidence.hiddenCoupling.pairCount,50,10,4,"co-changing pair(s)"),a("similar-pressure","Similar functions",e.similarCount,Math.max(50,t*.01),8,4,"similar function pair(s)"),a("react-component-duplicates-pressure","Duplicated React components",e.reactComponentDuplicates.count,Math.max(10,r*.01),8,4,"duplicated React component pair(s)"),a("react-hook-candidates-pressure","Duplicated React hook behavior",p,Math.max(10,r*.01),8,4,"duplicated React behavior pair(s)"),a("react-large-component-pressure-pressure","Large React components",e.reactLargeComponentPressure.count,Math.max(10,r*.01),4,2,"large React component pressure file(s)"),a("vue-component-duplicates-pressure","Duplicated Vue components",e.vueComponentDuplicates.count,Math.max(10,r*.01),8,4,"duplicated Vue component pair(s)"),a("vue-composable-candidates-pressure","Duplicated Vue behavior",x,Math.max(10,r*.01),8,4,"duplicated Vue behavior pair(s)"),a("vue-large-view-pressure-pressure","Large Vue views",e.vueLargeViewPressure.count,Math.max(10,r*.01),4,2,"large Vue view pressure file(s)"),a("extract-pressure","Extraction candidates",e.extractCount,Math.max(50,t*.01),4,2,"extraction candidate(s)"),a("wrappers-pressure","Wrapper functions",e.wrappers.count,50,4,2,"wrapper candidate(s)"),a("passthroughs-pressure","Passthrough functions",e.passthroughs.count,50,4,2,"passthrough candidate(s)"),a("stale-abstractions-pressure","Stale abstractions",e.stale.count,Math.max(50,t*.02),4,2,"stale abstraction(s)"),a("drift-pressure","Structural drift",e.drift.count,Math.max(10,r*.1),4,2,"drift finding(s)"),{breakdown:i,pressure:o}}import{getHeapStatistics as Te}from"v8";var Be=64*1024*1024;function k(){let e=globalThis.gc;if(!e)return;let r=Te();r.heap_size_limit-r.used_heap_size<Be||e()}var Ve=50,$e=75e3,_e=5e3,ae=2500,se=50,Fe=10,Ie=["overview","dead","isolated","cycles","similar","react-component-duplicates","react-hook-candidates","react-large-component-pressure","vue-component-duplicates","vue-composable-candidates","vue-large-view-pressure","extract-candidates","wrapper-candidates","passthrough-candidates","stale-abstractions","drift","complexity-hotspots","git-evidence","suppressions"],ue={overview:(e,r,t,i)=>({phase:"overview",statsResult:i,warnings:t.warnings}),dead:(e,r,t)=>({phase:"dead",dead:Ne(e,r,t)}),isolated:(e,r,t)=>({phase:"isolated",isolated:Oe(e,r,t)}),cycles:(e,r,t)=>({phase:"cycles",realCycleCount:qe(e,r,t)}),similar:(e,r,t)=>({phase:"similar",similarCount:Ue(e,r,t)}),"react-component-duplicates":(e,r,t)=>({phase:"react-component-duplicates",reactComponentDuplicates:We(e,r,t)}),"react-hook-candidates":(e,r,t)=>({phase:"react-hook-candidates",reactHookCandidates:je(e,r,t)}),"react-large-component-pressure":(e,r,t)=>({phase:"react-large-component-pressure",reactLargeComponentPressure:Ye(e,r,t)}),"vue-component-duplicates":(e,r,t)=>({phase:"vue-component-duplicates",vueComponentDuplicates:Xe(e,r,t)}),"vue-composable-candidates":(e,r,t)=>({phase:"vue-composable-candidates",vueComposableCandidates:Qe(e,r,t)}),"vue-large-view-pressure":(e,r,t)=>({phase:"vue-large-view-pressure",vueLargeViewPressure:Je(e,r,t)}),"extract-candidates":(e,r,t)=>({phase:"extract-candidates",extractCount:Ge(e,r,t)}),"wrapper-candidates":(e,r,t)=>({phase:"wrapper-candidates",wrappers:Ke(e,r,t)}),"passthrough-candidates":(e,r,t)=>({phase:"passthrough-candidates",passthroughs:Ze(e,r,t)}),"stale-abstractions":(e,r,t)=>({phase:"stale-abstractions",stale:et(e,r,t)}),drift:(e,r,t)=>({phase:"drift",drift:it(e,r,t)}),"complexity-hotspots":(e,r,t)=>({phase:"complexity-hotspots",complexity:ot(e,r,t)}),"git-evidence":(e,r,t)=>({phase:"git-evidence",gitEvidence:tt(e,t)}),suppressions:(e,r,t)=>({phase:"suppressions",suppressions:rt(e,t)})};function Ot(e,r={}){return le(e,r.full===!0,(t,i)=>{let o=ze(e,r.scope,t,i);return M(o)})}function qt(e,r,t={}){return le(e,t.full===!0,(i,o)=>ue[r](e,t.scope,o,i))}function le(e,r,t){let i=W(e),o=nt(i,r);try{return t(i,o)}finally{A(e,{semanticProvider:!0}),k()}}function Ut(e){return M(de(e))}function de(e){let r=s(e,"overview");return{statsResult:r.statsResult,warnings:r.warnings,dead:s(e,"dead").dead,isolated:s(e,"isolated").isolated,realCycleCount:s(e,"cycles").realCycleCount,similarCount:s(e,"similar").similarCount,reactComponentDuplicates:s(e,"react-component-duplicates").reactComponentDuplicates,reactHookCandidates:s(e,"react-hook-candidates").reactHookCandidates,reactLargeComponentPressure:s(e,"react-large-component-pressure").reactLargeComponentPressure,vueComponentDuplicates:s(e,"vue-component-duplicates").vueComponentDuplicates,vueComposableCandidates:s(e,"vue-composable-candidates").vueComposableCandidates,vueLargeViewPressure:s(e,"vue-large-view-pressure").vueLargeViewPressure,extractCount:s(e,"extract-candidates").extractCount,wrappers:s(e,"wrapper-candidates").wrappers,passthroughs:s(e,"passthrough-candidates").passthroughs,stale:s(e,"stale-abstractions").stale,drift:s(e,"drift").drift,complexity:s(e,"complexity-hotspots").complexity,gitEvidence:ce(e,"git-evidence")?.gitEvidence??null,suppressions:ce(e,"suppressions")?.suppressions??null}}function ce(e,r){return e.find(t=>t.phase===r)}function s(e,r){let t=e.find(i=>i.phase===r);if(!t)throw new Error(`Missing health phase result: ${r}`);return t}function ze(e,r,t,i){return de(Ie.map(o=>ue[o](e,r,i,t)))}function Ne(e,r,t){return c(e,t,"dead",()=>{let i=B(e,{scope:r,...l.dead,scanLimit:t.candidateScanLimit});return w(ct(e,i.symbols))})}function Oe(e,r,t){return c(e,t,"isolated",()=>{let i=O(e,{scope:r,...l.isolated,scanLimit:t.candidateScanLimit});return w(ut(e,i))})}function qe(e,r,t){return c(e,t,"cycles",()=>I(e,{scope:r}).filter(o=>o.kind==="real").length)}function Ue(e,r,t){return c(e,t,"similar",()=>U(e,{scope:r,...l.similar,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit}).length)}function Ge(e,r,t){return c(e,t,"extract-candidates",()=>N(e,{scope:r,...l.extract,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit}).length)}function We(e,r,t){return c(e,t,"react-component-duplicates",()=>{let i=Y(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return T(i)})}function je(e,r,t){return c(e,t,"react-hook-candidates",()=>{let i=X(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return me(i,dt)})}function Ye(e,r,t){return c(e,t,"react-large-component-pressure",()=>{let i=Q(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return lt(i)})}function Xe(e,r,t){return c(e,t,"vue-component-duplicates",()=>{let i=J(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return T(i)})}function Qe(e,r,t){return c(e,t,"vue-composable-candidates",()=>{let i=K(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return me(i,pt)})}function Je(e,r,t){return c(e,t,"vue-large-view-pressure",()=>{let i=Z(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return w(i)})}function Ke(e,r,t){return pe(e,t,"wrapper-candidates",()=>j(e,{scope:r,...l.wrappers,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit}))}function Ze(e,r,t){return pe(e,t,"passthrough-candidates",()=>q(e,{scope:r,...l.passthroughs,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit}))}function et(e,r,t){return c(e,t,"stale-abstractions",()=>{let i=G(e,{scope:r,...l.stale,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit}),o=i.filter(n=>n.consumers===0).length;return{count:i.length,loc:i.reduce((n,a)=>n+a.loc,0),files:[...new Set(i.map(n=>n.file))],unused:o,singleUse:i.length-o}})}function tt(e,r){return c(e,r,"git-evidence",()=>{let t=V(e);if(!t)return null;let i=_(e,void 0,{limit:r.candidateResultLimit}),o={};for(let[n,a]of t)o[n]={changes:a.changes,fixChanges:a.fixChanges};return{amplification:$(e),hiddenCoupling:{pairCount:i.findings.length,top:i.findings.slice(0,5).map(n=>({fileA:n.fileA,fileB:n.fileB,together:n.together,confidence:n.confidence}))},fileStats:o}})}function rt(e,r){return c(e,r,"suppressions",()=>{let t=ee(e);return{total:t.total,byCategory:{...t.byCategory}}})}function it(e,r,t){return c(e,t,"drift",()=>{let i=z(e,{scope:r,...l.drift});return{count:i.unusedImports+i.layerViolations,unusedImports:i.unusedImports,layerViolations:i.layerViolations}})}function ot(e,r,t){return c(e,t,"complexity-hotspots",()=>{let i=F(e,{scope:r,minLoc:10,limit:t.complexityResultLimit,scanLimit:t.candidateScanLimit,semantic:!1});return{top:i.slice(0,5).map(o=>({symbol:o.shortName,score:o.score,file:o.file})),extremeCount:i.filter(o=>o.score>Ve).length}})}function nt(e,r){let t=e.symbols>=$e||e.documents>=_e,i=r?Number.POSITIVE_INFINITY:se,o=r?Number.POSITIVE_INFINITY:Fe;return!t||r?{candidateScanLimit:void 0,candidateResultLimit:i,complexityResultLimit:o,releaseCachesBetweenPhases:!0,warnings:r&&t?["Large index detected; running health without candidate scan or result caps because --full was supplied."]:[]}:{candidateScanLimit:ae,candidateResultLimit:i,complexityResultLimit:o,releaseCachesBetweenPhases:!0,warnings:[`Large index detected; candidate-style health checks scanned their highest-priority ${ae} symbols and reported their top ${se} findings. Run "scip-query health --full" for unbounded candidate counts.`]}}function at(e,r){r.releaseCachesBetweenPhases&&(A(e),k())}function c(e,r,t,i){st(t);try{return i()}finally{at(e,r)}}function pe(e,r,t,i){return c(e,r,t,()=>w(i()))}function st(e){process.env.SCIP_QUERY_HEALTH_TRACE==="1"&&console.error(`[health] ${e}`)}function ct(e,r){return r.filter(t=>!D(e,t.relativePath)&&!E(e,t.symbol,t.relativePath)&&t.kind==="dead-code")}function ut(e,r){return r.filter(t=>!D(e,t.relativePath)&&!E(e,t.symbol,t.relativePath))}function w(e){let r=new Set;for(let t of e){let i=t.relativePath??t.file;i&&r.add(i)}return{count:e.length,loc:e.reduce((t,i)=>t+i.loc,0),files:[...r]}}function lt(e){let r=new Map;for(let t of e)r.set(t.file,Math.max(r.get(t.file)??0,t.loc));return{count:r.size,loc:[...r.values()].reduce((t,i)=>t+i,0),files:[...r.keys()]}}function T(e){let r=new Map;for(let t of e)r.set(t.fileA,Math.max(r.get(t.fileA)??0,t.locA)),r.set(t.fileB,Math.max(r.get(t.fileB)??0,t.locB));return{count:e.length,loc:[...r.values()].reduce((t,i)=>t+i,0),files:[...r.keys()]}}function me(e,r){return{...T(e),scoreCount:mt(e.reduce((i,o)=>i+r(o),0))}}function dt(e){let r=e.sharedHooks.length>0,t=he({namedState:e.sharedState,requests:e.sharedRequests,lifecycle:e.sharedEffects,functions:e.sharedHandlers});return r&&t<=2?0:r?.5:ge(e.sharedState,e.sharedHandlers,e.sharedHandlerVerbs)?.25:t>=2?1:.5}function pt(e){let r=e.sharedComposables.length+e.sharedStores.length>0,t=he({namedState:e.sharedBindings,requests:e.sharedRequests,lifecycle:e.sharedLifecycle,functions:e.sharedFunctions});return r&&t<=2?0:r?.5:ge(e.sharedBindings,e.sharedFunctions,e.sharedFunctionVerbs)?.25:t>=2?1:.5}function he(e){return e.requests.length*2+e.lifecycle.length+e.namedState.filter(r=>!Ce.has(fe(r))).length+Math.min(e.functions.length,3)}function ge(e,r,t){let i=[...e,...r,...t].map(fe);return i.length>0&&i.every(o=>Ce.has(o))}function fe(e){return e.replace(/^handle/,"").replace(/^is/,"").replace(/^has/,"").toLowerCase()}function mt(e){return Math.round(e*100)/100}var Ce=new Set(["add","apply","cancel","change","clear","close","create","delete","draft","edit","error","filter","form","load","loading","name","open","refresh","remove","reset","save","saving","search","select","selected","submit","toggle","update","value"]);export{Ie as a,Ot as b,qt as c,Ut as d};
|
|
2
|
+
//# sourceMappingURL=chunk-DBIG4QAJ.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as d,c as f,e as u,s as p}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as d,c as f,e as u,s as p}from"./chunk-64LH2QUP.js";var m={0:"UnspecifiedKind",1:"AbstractMethod",2:"Accessor",3:"Array",4:"Assertion",5:"AssociatedType",6:"Attribute",7:"Axiom",8:"Boolean",9:"Class",10:"Constant",11:"Constructor",12:"Contract",13:"DataFamily",14:"DefinitionMacro",15:"Delegate",16:"Enum",17:"EnumMember",18:"Error",19:"Event",20:"Fact",21:"Field",22:"File",23:"Function",24:"Getter",25:"Grammar",26:"Instance",27:"Interface",28:"Key",29:"Lang",30:"Lemma",31:"Library",32:"Macro",33:"Method",34:"MethodAlias",35:"MethodReceiver",36:"MethodSpecification",37:"Message",38:"Modifier",39:"Module",40:"Namespace",41:"Null",42:"Number",43:"Object",44:"Operator",45:"Package",46:"PackageObject",47:"Parameter",48:"ParameterLabel",49:"Pattern",50:"Predicate",51:"Property",52:"Protocol",53:"ProtocolMethod",54:"PureVirtualMethod",55:"Quasiquoter",56:"SelfParameter",57:"Setter",58:"Signature",59:"SingletonClass",60:"SingletonMethod",61:"StaticDataMember",62:"StaticEvent",63:"StaticField",64:"StaticMethod",65:"StaticProperty",66:"StaticVariable",67:"String",68:"Struct",69:"Subscript",70:"Tactic",71:"Theorem",72:"ThisParameter",73:"Trait",74:"TraitMethod",75:"Type",76:"TypeAlias",77:"TypeClass",78:"TypeClassMethod",79:"TypeFamily",80:"TypeParameter",81:"Union",82:"Value",83:"Variable"},c=new Map;for(let[e,i]of Object.entries(m))c.set(i.toLowerCase(),Number(e));function y(e){let i=parseInt(e,10);if(!isNaN(i))return i;let s=e.toLowerCase(),n=c.get(s);if(n!==void 0)return n;for(let[r,o]of c)if(r.includes(s))return o;return null}function K(e,i,s={}){let{scope:n,limit:r=100}=s,o=y(i);return o===null?[]:b(e,n).map(t=>({row:t,resolvedKind:g(t)})).filter(t=>t.resolvedKind===o).slice(0,r).map(({row:t,resolvedKind:l})=>({symbol:t.symbol,shortName:f(t.symbol),kind:l,kindName:m[l]??"Unknown",relativePath:t.relative_path,startLine:t.start_line,endLine:t.end_line}))}function P(e,i={}){let s=new Map;for(let n of b(e,i.scope)){let r=g(n);r===null||r===0||s.set(r,(s.get(r)??0)+1)}return[...s.entries()].sort((n,r)=>r[1]-n[1]||n[0]-r[0]).map(([n,r])=>({kind:n,kindName:m[n]??"Unknown",count:r}))}function b(e,i){return p(e,{scope:i}).map(S)}function S(e){return{symbol:e.symbol,kind:e.kind,documentation:e.documentation,enclosing_symbol:e.enclosingSymbol,relative_path:e.relativePath,start_line:e.startLine,end_line:e.endLine}}function g(e){return e.kind!==null&&e.kind!==0?h(e.kind,e.symbol,e.documentation):k(e.symbol,e.documentation,e.enclosing_symbol)}function h(e,i,s){let n=(s??"").toLowerCase();if(u(i)==="type"){if(n.includes("type "))return 76;if(n.includes("interface "))return 27;if(n.includes("struct "))return 68;if(n.includes("trait "))return 73;if(n.includes("class "))return 9}return e}function k(e,i,s){let n=d(e);if("kind"in n)return null;let r=n.descriptors,o=r[r.length-2]??null,a=u(e),t=(i??"").toLowerCase();return a==="type"?t.includes("type ")?76:t.includes("interface ")?27:t.includes("struct ")?68:t.includes("trait ")?73:(t.includes("class "),9):a==="method"?o?.suffix==="type"?33:23:a==="namespace"?39:a!=="term"?null:t.includes("async def ")||t.includes("def ")?23:(s?u(s):o?.suffix??null)==="type"?21:83}export{K as a,P as b};
|
|
2
|
+
//# sourceMappingURL=chunk-DMLPJ75B.js.map
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import _e from"better-sqlite3";import{existsSync as _t,readFileSync as Mt,writeFileSync as Gt}from"fs";import{dirname as Wt,join as Ht,resolve as Me}from"path";import ne from"better-sqlite3";import{execFileSync as re}from"child_process";import{existsSync as oe,readdirSync as ie,readFileSync as se}from"fs";import{extname as m,join as F}from"path";import K from"ignore";import{readFileSync as B,existsSync as b}from"fs";import{dirname as h,isAbsolute as x,join as S,relative as J,resolve as X}from"path";function C(e){let t=K(),r=!1,n=z(e);for(let i of n)try{let o=B(i,"utf-8");t.add(o),r=!0}catch{}return r||t.add(q),{isIgnored:i=>V(t,e,i),filter:i=>i.filter(o=>!V(t,e,o))}}function z(e){let t=[],r=S(e,".gitignore");b(r)&&t.push(r);let n=h(e),i=0;for(;n!==h(n)&&i<5;){let o=S(n,".gitignore");if(b(o)&&t.push(o),b(S(n,".git")))break;n=h(n),i++}return t}var q=`
|
|
2
|
+
# Dependencies
|
|
3
|
+
node_modules/
|
|
4
|
+
vendor/
|
|
5
|
+
.bundle/
|
|
6
|
+
|
|
7
|
+
# Build output
|
|
8
|
+
dist/
|
|
9
|
+
build/
|
|
10
|
+
out/
|
|
11
|
+
target/
|
|
12
|
+
bin/
|
|
13
|
+
obj/
|
|
14
|
+
|
|
15
|
+
# Python
|
|
16
|
+
__pycache__/
|
|
17
|
+
*.pyc
|
|
18
|
+
*.pyo
|
|
19
|
+
.venv/
|
|
20
|
+
venv/
|
|
21
|
+
.env/
|
|
22
|
+
env/
|
|
23
|
+
*.egg-info/
|
|
24
|
+
|
|
25
|
+
# Rust
|
|
26
|
+
target/
|
|
27
|
+
|
|
28
|
+
# Java / Kotlin / Scala
|
|
29
|
+
*.class
|
|
30
|
+
.gradle/
|
|
31
|
+
.mvn/
|
|
32
|
+
|
|
33
|
+
# C# / .NET
|
|
34
|
+
bin/
|
|
35
|
+
obj/
|
|
36
|
+
packages/
|
|
37
|
+
|
|
38
|
+
# Go
|
|
39
|
+
vendor/
|
|
40
|
+
|
|
41
|
+
# Dart
|
|
42
|
+
.dart_tool/
|
|
43
|
+
build/
|
|
44
|
+
|
|
45
|
+
# PHP
|
|
46
|
+
vendor/
|
|
47
|
+
|
|
48
|
+
# IDE / OS
|
|
49
|
+
.idea/
|
|
50
|
+
.vscode/
|
|
51
|
+
*.swp
|
|
52
|
+
*.swo
|
|
53
|
+
.DS_Store
|
|
54
|
+
Thumbs.db
|
|
55
|
+
|
|
56
|
+
# Type definitions (often noise in queries)
|
|
57
|
+
*.d.ts
|
|
58
|
+
`;function V(e,t,r){let n=Y(t,r);if(!n)return!1;try{return e.ignores(n)}catch{return!1}}function Y(e,t){if(!t||t===".")return null;if(!x(t)&&!t.startsWith(".."))return t.replaceAll("\\","/");let r=x(t)?t:X(e,t),n=J(e,r).replaceAll("\\","/");return!n||n==="."||n.startsWith("..")?null:n}import{readdirSync as nt}from"fs";import{execFileSync as ot}from"child_process";import{extname as st,join as at}from"path";var Q=[];function k(e){e.groups.length>0&&Q.push(e)}function Z(){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 L(e,t){let{cache:r,ensure:n}=Z(),i={get(o,s,a){let u=n(o);if(u.has(s))return u.get(s);let c=a();return u.set(s,c),c},invalidate(o,s){r.get(o)?.delete(s)},invalidateAll(o){r.delete(o)},size(o){return r.get(o)?.size??0}};return k({name:e,groups:t.clearGroups,clearAll:o=>i.invalidateAll(o),clearFile:(o,s)=>i.invalidate(o,s)}),i}var ee=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue",".rs",".py",".pyi",".java",".kt",".kts",".scala",".sc",".rb",".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx",".cs",".vb",".php",".dart"],T=[".vue"],te=new Set(ee.map(e=>e.toLowerCase())),ct=[...te].sort().join(","),D=new Set(["node_modules",".git","target","dist","build",".next",".nuxt",".cache",".turbo","out","coverage",".scipquery-cache","__pycache__",".venv","venv",".idea",".vscode"]);var lt=L("source-files",{clearGroups:[]});function St(e){let t=new Set((e.extensions??T).map(o=>o.toLowerCase()));if(t.size===0)return{scanned:0,inserted:0,existing:0};if(!oe(e.dbPath))throw new Error(`SCIP SQLite database not found at ${e.dbPath}`);let r=C(e.projectRoot),n=ae(e.projectRoot,t).filter(o=>!r.isIgnored(o)),i=new ne(e.dbPath);try{let o=ce(i,n),s=i.prepare(`INSERT OR IGNORE INTO documents (language, relative_path, position_encoding, text)
|
|
59
|
+
VALUES (?, ?, NULL, ?)`),u=i.transaction(l=>{let p=0;for(let g of l){if(o.has(g))continue;let d=se(F(e.projectRoot,g),"utf-8"),U=s.run(le(g),g,d);p+=Number(U.changes)}return p})(n),c={scanned:n.length,inserted:u,existing:n.length-u};return e.onStatus?.(`Augmented SQLite documents with ${u} auxiliary source file${u===1?"":"s"} (${c.existing} already present).`),c}finally{i.close()}}function ae(e,t){let r=ue(e,t);if(r)return r;let n=[],i=o=>{let s=o?F(e,o):e,a;try{a=ie(s,{withFileTypes:!0})}catch{return}for(let u of a){if(D.has(u.name))continue;let c=o?`${o}/${u.name}`:u.name;if(u.isDirectory()){i(c);continue}t.has(m(u.name).toLowerCase())&&n.push(c)}};return i(""),n.sort()}function ue(e,t){try{return re("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:26214400,stdio:["ignore","pipe","ignore"]}).split(`
|
|
60
|
+
`).filter(n=>n&&t.has(m(n).toLowerCase())).sort()}catch{return null}}function ce(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 le(e){return m(e).toLowerCase()===".vue"?"vue":m(e).replace(/^\./,"").toLowerCase()||"source"}import{execFileSync as ge}from"child_process";import{createHash as de}from"crypto";import{readdirSync as fe,readFileSync as pe}from"fs";import{join as E}from"path";function I(e){return(be(e)??he(e)).filter(t=>t&&!w(t)).sort()}function Ct(e,t={}){return(t.language?I(e).filter(n=>me(n,t.language,t.markerFiles)):I(e)).map(n=>{let i=E(e,n);try{let o=pe(i);return{path:n,size:o.byteLength,hash:de("sha256").update(o).digest("hex")}}catch{return{path:n,size:-1,hash:"unreadable"}}})}function me(e,t,r){let n=e.split("/").at(-1)??e;if(r?.includes(e)||r?.includes(n)||ye.has(n))return!0;let i=e.includes(".")?`.${e.split(".").at(-1).toLowerCase()}`:"";return(ve[t]??[]).includes(i)}function be(e){try{return ge("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:50*1024*1024,stdio:["ignore","pipe","ignore"]}).split(`
|
|
61
|
+
`).filter(Boolean)}catch{return null}}function he(e){let t=[],r=[""];for(;r.length>0;){let n=r.pop(),i=n?E(e,n):e,o;try{o=fe(i,{withFileTypes:!0})}catch{continue}for(let s of o){let a=n?`${n}/${s.name}`:s.name;if(s.isDirectory()){w(a)||r.push(a);continue}t.push(a)}}return t}function w(e){return e.split("/").some(r=>Se.has(r))||e.endsWith(".db")||e.endsWith(".db-wal")||e.endsWith(".db-shm")||e.endsWith(".scip")}var Se=new Set([".git","node_modules",".scipquery-cache",".stryker-tmp","dist","build","coverage",".next",".nuxt","target"]),ye=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"]),ve={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"]};import{createRequire as Re}from"module";import{existsSync as xe,readFileSync as v}from"fs";import{dirname as O,extname as Ve,join as A,relative as Ce,resolve as Ft}from"path";import{pathToFileURL as ke}from"url";function P(e,t){let{vueCore:r,ts:n,volarTs:i}=Le(e),{parsed:o,vueOptions:s}=Te(r,n,t),a=O(t),u=r.createVueLanguagePlugin(n,o.options,s,d=>d),c=De(r,n,u),l=Fe(a,o),{languageServiceHost:p}=i.createLanguageServiceHost(n,n.sys,c,d=>d,l),g=n.createLanguageService(p);return{ts:n,language:c,languageService:g,fileNames:o.fileNames,configDir:a}}function Le(e){let t=Re(ke(A(e,"package.json")).href);return{vueCore:y(t,"@vue/language-core",e),ts:y(t,"typescript",e),volarTs:y(t,"@volar/typescript",e)}}function Te(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,O(r),void 0,r,void 0,e.getAllExtensions(o).map(s=>({extension:s.slice(1),isMixedContent:!0,scriptKind:t.ScriptKind.Deferred}))),vueOptions:o}}function De(e,t,r){let n={},i=e.createLanguage([r],new Map,o=>{if(!xe(o))return;let s=v(o,"utf-8");n.current?.scripts.set(o,t.ScriptSnapshot.fromString(s),r.getLanguageId(o)??Oe(o))});return n.current=i,i}function Fe(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 N(e,t,r){let n=Ie(e);return i=>{let o=f(t,i.fileName),s=r.get(i.fileName);if(!s)return null;let a=r.positionAt(s,i.textSpan.start),u=n.get(o);if(!u)return null;let c=u.containingByLine.get(a.line);return c!==void 0?c:Ee(u.starts,a.line,2)}}function Ie(e){let t=e.prepare(`
|
|
62
|
+
SELECT
|
|
63
|
+
d.relative_path AS relativePath,
|
|
64
|
+
der.start_line AS startLine,
|
|
65
|
+
der.end_line AS endLine,
|
|
66
|
+
der.symbol_id AS symbolId
|
|
67
|
+
FROM defn_enclosing_ranges der
|
|
68
|
+
JOIN documents d ON d.id = der.document_id
|
|
69
|
+
ORDER BY d.relative_path, (der.end_line - der.start_line) DESC
|
|
70
|
+
`).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 Ee(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 u=Math.abs(a.line-t);u>r||(!o||u<o.distance)&&(o={distance:u,symbolId:a.symbolId})}return o?.symbolId??null}function j(e,t){let r=Pe(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=Ne(n,r,t,o);return i.set(o,s),s}}}function _(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(R(a,e.textSpan.start)!==null)return r.get(e.fileName)}return e.fileName.startsWith(i)?r.get(e.fileName):null}return t(e)}function*M(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 G(e,t){for(let[r]of e.toGeneratedLocation(t,n=>!!n.navigation))return r;return null}function R(e,t){let r=e;for(let[n]of r.toSourceLocation(t,i=>!!i.navigation))return n;return null}function we(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 $(e,t){return f(e,t).startsWith("node_modules/")}function f(e,t){return Ce(e,t).replaceAll("\\","/")}function Oe(e){switch(Ve(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 W(){let e=new Map;return{get(t){if(e.has(t))return e.get(t)??null;try{let r=v(t,"utf-8"),n={text:r,lineStarts:Ae(r)};return e.set(t,n),n}catch{return e.set(t,null),null}},positionAt:we}}function Ae(e){let t=[0];for(let r=0;r<e.length;r++)e.charCodeAt(r)===10&&t.push(r+1);return t}function Pe(e){try{let t=JSON.parse(v(A(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 Ne(e,t,r,n){let i=f(r,n),o=je(t.name,t.version,i);return e.get(o)?.id??null}function je(e,t,r){let n=r.split("/").map(i=>`\`${i.replaceAll("`","")}\``).join("/");return`scip-vue npm ${e} ${t} ${n}/default.`}function Kt(e){let t=Me(e.projectRoot,e.tsconfig),r=new _e(e.dbPath,{readonly:!0});try{let n=Ge({db:r,projectRoot:e.projectRoot,configPath:t,vueSymbolLookup:j(r,e.projectRoot)});return $e({vueFiles:e.vueFiles??[],tasks:e.tasks,...n})}finally{r.close()}}function Ge(e){let t=W();return{projectRoot:e.projectRoot,context:P(e.projectRoot,e.configPath),symbolLookup:N(e.db,e.projectRoot,t),vueSymbolLookup:e.vueSymbolLookup,sourceReader:t}}function $e(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=We(e,i);t.push(...o.occurrences),r+=o.skippedReferences}return{occurrences:t,skippedReferences:r}}function We(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=f(e.projectRoot,t.fileName),a=[...M(i.text)],u={tokens:a.filter(c=>c.start>=t.startOffset&&c.start<t.endOffset),tokenByStart:new Map(a.map(c=>[c.start,c])),tokenTextCounts:Ke(a),processedStarts:new Set};return He({...e,fileName:t.fileName,sourceInfo:i,sourceFile:s,map:o,tokenContext:u})}function He(e){let t=[],r=0;for(let n of e.tokenContext.tokens){if(e.tokenContext.processedStarts.has(n.start))continue;let i=G(e.map,n.start);if(i===null)continue;let s=(e.context.languageService.getDefinitionAtPosition(e.fileName,i+1)??[]).find(u=>!$(e.projectRoot,u.fileName));if(!s){r++;continue}let a=_(s,e.symbolLookup,e.vueSymbolLookup,e.context,e.projectRoot);if(a===null){r++;continue}H(t,e.sourceReader,e.sourceInfo,e.sourceFile,n,a),e.tokenContext.processedStarts.add(n.start),Ue(t,e,n,i,a)}return{occurrences:t,skippedReferences:r}}function Ue(e,t,r,n,i){if(!((t.tokenContext.tokenTextCounts.get(r.text)??0)<=1))for(let o of Be(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&&(H(e,t.sourceReader,t.sourceInfo,t.sourceFile,s,i),t.tokenContext.processedStarts.add(o))}}function H(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 Ke(e){let t=new Map;for(let r of e)t.set(r.text,(t.get(r.text)??0)+1);return t}function Be(e,t,r,n,i,o){let s=e.getDocumentHighlights?.(t,r,[t])??[],a=[];for(let u of s)if(u.fileName===t)for(let c of u.highlightSpans){let l=Je(n,c.textSpan.start,o,i.text);l!==null&&a.push(l)}return a}function Je(e,t,r,n){let i=r.get(t);if(i?.text===n)return i.start;let o=R(e,t);if(o===null)return null;let s=r.get(o);return s?.text===n?s.start:null}export{St as a,Ct as b,Kt as c};
|
|
71
|
+
//# sourceMappingURL=chunk-DRU74YUM.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{a as D,b as L}from"./chunk-PNN3D4BE.js";import{a as M}from"./chunk-5BZOSICN.js";import{a as F}from"./chunk-B75HZHUP.js";import{a as C}from"./chunk-W3PQRAI4.js";import{a as I}from"./chunk-BGBBVSH4.js";import{a as b}from"./chunk-SA6B3EGD.js";import{c as m,d,j as p,w as g}from"./chunk-64LH2QUP.js";import{basename as u,extname as f}from"path";function q(t,n){let{scope:e,maxLoc:r=15,limit:o=30,scanLimit:a}=n??{},i=new C(t),s=k(i.fileDependencyGraph(e));return M({candidates:()=>x(i,e,r),orderCandidates:F,scanLimit:a,prepare:l=>({callerFileMap:D(i,l,{semantic:n?.semantic!==!1}),reverseFanIn:s}),evaluate:(l,c)=>h(t,i,l,c),orderResults:(l,c)=>c.callerFanIn-l.callerFanIn||c.loc-l.loc,limit:o})}function h(t,n,e,r){let o=S(t,n,e,r.callerFileMap);if(o.length!==1)return null;let a=o[0],i=y(t,e.symbolId,a);if(!i)return null;let s=v(n,t,a,e.symbol,i);if(s&&p(s.symbol))return null;let{fanIn:l,source:c}=P(r.callerFileMap,r.reverseFanIn,a,s);return(c==="function"?l<=3:l<=5)?null:{symbol:e.symbol,shortName:m(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:I(e),singleCaller:s?.symbol??"",singleCallerShort:s?.isFunctionLike?m(s.symbol):u(a),callerFanIn:l}}function x(t,n,e){return t.productionCallableDefinitions({scope:n,minLoc:2,maxLoc:e,requireFunctionLikeSymbol:!0,excludeRootedSymbols:!0})}function S(t,n,e,r){let o=u(e.relativePath,f(e.relativePath)),a=[...r.get(e.symbolId)??[]].filter(i=>i!==e.relativePath).filter(i=>u(i,f(i))!==o).filter(i=>{let s=n.fileKind(i);return s!=="barrel"&&s!=="entry"&&s!=="test"});return L(t,e,a).realConsumers}function y(t,n,e){return t.get(`SELECT c.start_line, c.end_line
|
|
2
|
+
FROM mentions m
|
|
3
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
4
|
+
JOIN documents d ON c.document_id = d.id
|
|
5
|
+
WHERE m.symbol_id = ? AND m.role != 1 AND d.relative_path = ?
|
|
6
|
+
LIMIT 1`,n,e)}function v(t,n,e,r,o){let a=t.definitionsForFile(e),i=_(n,e,r,o.start_line,o.end_line);return g(a,i)}function P(t,n,e,r){if(r?.isFunctionLike){let o=[...t.get(r.symbolId)??[]].filter(a=>a!==r.relativePath);if(o.length>0)return{fanIn:o.length,source:"function"}}return{fanIn:N(n,e),source:"file"}}function _(t,n,e,r,o){let a=d(e);if(!a)return r;let i=b(t,n).get(a);if(!i||i.length===0)return r;for(let s of i)if(s>=r&&s<=o)return s;return r}function k(t){let n=new Map;for(let[e,r]of t){n.has(e)||n.set(e,n.get(e)??0);for(let o of r)n.set(o,(n.get(o)??0)+1)}return n}function N(t,n){let e=t.get(n)??0;if(e>0)return e;let r=u(n,f(n)),o=0;for(let[a,i]of t)a!==n&&u(a,f(a))===r&&i>o&&(o=i);return o}export{q as a};
|
|
7
|
+
//# sourceMappingURL=chunk-DTERBKUE.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as d,b as m}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as d,b as m}from"./chunk-L77GXANO.js";import{a as B}from"./chunk-5D3BT4B4.js";function F(s,e={}){let{scope:r,maxDepth:c=10}=e,n=B(s,r),i=[],a=new Set,l=new Set,f=[];function y(t,o){if(o>c)return;if(l.has(t)){let h=f.indexOf(t);if(h!==-1){let u=f.slice(h).concat(t),g=u.indexOf(u.reduce((x,$)=>x<$?x:$)),p=[...u.slice(g,-1),...u.slice(0,g),u[g]],S=p.join(" -> ");b.has(S)||(b.add(S),i.push({path:p,kind:R(p)}))}return}if(a.has(t))return;a.add(t),l.add(t),f.push(t);let k=n.get(t);if(k)for(let h of k)y(h,o+1);f.pop(),l.delete(t)}let b=new Set;for(let t of n.keys())a.has(t)||y(t,0);return i.sort((t,o)=>t.kind!==o.kind?t.kind==="real"?-1:1:t.path.length-o.path.length),i}function R(s){for(let c of s){let n=d(c);if(n==="test"||n==="barrel"||n==="entry")return"module-hierarchy"}if(s.length!==3)return"real";let[e,r]=s;return!e||!r?"real":m(e)||m(r)||C(e,r)||C(r,e)||D(e,r)||D(r,e)||d(e)==="entry"||d(r)==="entry"?"module-hierarchy":"real"}function C(s,e){if(!/\.rs$/.test(s)||!/\.rs$/.test(e))return!1;let r=e.replace(/\.rs$/,"/");return s.startsWith(r)?!s.slice(r.length).includes("/"):!1}function D(s,e){if(!/\.rs$/.test(s)||!/\.rs$/.test(e))return!1;let r=s.replace(/\.rs$/,""),c=e.replace(/\.rs$/,"");if(r===c+"_tests"||r===c+"/tests")return!0;let n=s.split("/"),i=e.split("/");if(n.length===i.length&&n.includes("tests")&&i.includes("src")){let a=n[n.length-1],l=i[i.length-1];if(a&&a===l)return!0}return!1}export{F as a};
|
|
2
|
+
//# sourceMappingURL=chunk-E55WCTLH.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b}from"./chunk-QOFKVNFE.js";import{l as d,u as f}from"./chunk-64LH2QUP.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-F4PKYBQB.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as D}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as D}from"./chunk-W3PQRAI4.js";import{n as A}from"./chunk-SA6B3EGD.js";import{b as d,d as h,f as y}from"./chunk-QH5GTVVB.js";import{c as S}from"./chunk-64LH2QUP.js";function F(e,n={}){let{samples:o=50,scope:r,maxDisagreements:l=5}=n,s=new D(e),i=C(s.productionCallableDefinitions({scope:r,minLoc:2,requireFunctionLikeSymbol:!0}),o);if(i.length===0||!R(e,i))return{available:!1,sampleSize:i.length,oracleCoverage:0,scores:[],topDisagreements:[]};let c={references:v(),callees:v()},a=[],g=0,T=y(e,i);for(let t of i){let u=f(t,h(e,t).map(m=>m.file)),b=f(t,(T.get(t.symbolId)??[]).map(m=>m.file));if(u.size===0&&b.size===0)continue;g+=1;let Q=f(t,A(e,t).map(m=>m.file)),I=f(t,(s.calleeMap([t],{semantic:!1}).get(t.symbolId)??[]).map(m=>m.file));x(c.references,t,"references",Q,u,a),x(c.callees,t,"callees",I,b,a)}return a.sort((t,u)=>u.cheapOnly.length+u.oracleOnly.length-(t.cheapOnly.length+t.oracleOnly.length)),{available:!0,sampleSize:i.length,oracleCoverage:i.length>0?p(g/i.length):0,scores:["references","callees"].map(t=>O(t,c[t])),topDisagreements:a.slice(0,l)}}function v(){return{comparedSymbols:0,agreed:0,cheapTotal:0,oracleTotal:0}}function C(e,n){let o=[...e].sort((s,i)=>s.symbolId-i.symbolId);if(o.length<=n)return o;let r=o.length/n,l=[];for(let s=0;s<n;s++)l.push(o[Math.floor(s*r)]);return l}function R(e,n){let o=n[0];if(!o)return!1;try{return d(e,o.relativePath).availability().available}catch{return!1}}function f(e,n){let o=new Set;for(let r of n)r!==e.relativePath&&o.add(r);return o}function x(e,n,o,r,l,s){if(r.size===0&&l.size===0)return;e.comparedSymbols+=1,e.cheapTotal+=r.size,e.oracleTotal+=l.size;let i=[],c=[];for(let a of r)l.has(a)?e.agreed+=1:i.push(a);for(let a of l)r.has(a)||c.push(a);(i.length>0||c.length>0)&&s.push({symbol:S(n.symbol),question:o,cheapOnly:i,oracleOnly:c})}var z={references:!0,callees:!1};function O(e,n){let o=n.oracleTotal>0?n.agreed/n.oracleTotal:1,r=n.cheapTotal-n.agreed;return{question:e,comparedSymbols:n.comparedSymbols,precision:z[e]&&n.cheapTotal>0?p(n.agreed/n.cheapTotal):null,recall:p(o),unverified:r}}function p(e){return Math.round(e*1e3)/1e3}export{F as a};
|
|
2
|
+
//# sourceMappingURL=chunk-FVX4GEAC.js.map
|