scip-query 0.10.11 → 0.10.12
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 +56 -35
- package/dist/augment-vue-worker.js +1 -1
- package/dist/chunk-2DOW7QCA.js +71 -0
- package/dist/chunk-2FMFF4RI.js +2 -0
- package/dist/{chunk-LSET2TXH.js → chunk-2GLNBCHB.js} +2 -2
- package/dist/chunk-2UVCH7CQ.js +2 -0
- package/dist/{chunk-LM5SHAN4.js → chunk-3XSNW5XB.js} +2 -2
- package/dist/chunk-4ISHQ7UW.js +35 -0
- package/dist/{chunk-BFXPG2VN.js → chunk-5GXTUANY.js} +2 -2
- package/dist/{chunk-FXNWFMKW.js → chunk-5JHEN5VN.js} +2 -2
- package/dist/chunk-62ULXMQ7.js +18 -0
- package/dist/chunk-63CI3IXR.js +102 -0
- package/dist/{chunk-P753MDDE.js → chunk-6BN3EHQE.js} +2 -2
- package/dist/chunk-7C6JBBE4.js +23 -0
- package/dist/chunk-7EK7OSWS.js +2 -0
- package/dist/chunk-7IWIMNHI.js +2 -0
- package/dist/chunk-7XTO4YXB.js +8 -0
- package/dist/{chunk-Z3YYR4OS.js → chunk-A4UTLKHU.js} +2 -2
- package/dist/{chunk-FDEQIPPK.js → chunk-ANUEY5WV.js} +2 -2
- package/dist/chunk-AOWFUGDL.js +2 -0
- package/dist/chunk-AREANYIA.js +3 -0
- package/dist/{chunk-6IR2AOBM.js → chunk-AZBELWZQ.js} +2 -2
- package/dist/{chunk-JME7OWD3.js → chunk-CXWCLVYL.js} +2 -2
- package/dist/chunk-CYHIKTJN.js +3 -0
- package/dist/{chunk-BVRS7RKQ.js → chunk-DDQONX6B.js} +2 -2
- package/dist/{chunk-IHUETYFW.js → chunk-DFSEARAU.js} +2 -2
- package/dist/{chunk-EY43NV4M.js → chunk-DQ6433ZG.js} +2 -2
- package/dist/chunk-DVFP6PZI.js +2 -0
- package/dist/chunk-E3ADDB43.js +2 -0
- package/dist/{chunk-YWOOQ4FF.js → chunk-ELC77ZDE.js} +1 -1
- package/dist/chunk-EOLGSSDR.js +2 -0
- package/dist/chunk-F6IXELII.js +20 -0
- package/dist/{chunk-QYB5P7GL.js → chunk-FMGVZBS2.js} +2 -2
- package/dist/{chunk-VOYOYC5T.js → chunk-FX6ULETZ.js} +2 -2
- package/dist/chunk-GG5LHT27.js +2 -0
- package/dist/chunk-GKB4JJDU.js +2 -0
- package/dist/chunk-H7JF2CKK.js +2 -0
- package/dist/chunk-HHOMJCP5.js +4 -0
- package/dist/chunk-HRDSU5FN.js +9 -0
- package/dist/{chunk-BZ53S4ZN.js → chunk-HWVYTJOV.js} +2 -2
- package/dist/chunk-JJ5SAWBT.js +2 -0
- package/dist/chunk-JNMLBL36.js +2 -0
- package/dist/chunk-JS6B76AQ.js +2 -0
- package/dist/{chunk-Z4HICZGY.js → chunk-KZ4MG5NY.js} +2 -2
- package/dist/{chunk-RNM6LMCF.js → chunk-L446VQYQ.js} +2 -2
- package/dist/{chunk-FFVIFETB.js → chunk-LDJUB7XW.js} +2 -2
- package/dist/{chunk-54KGX7EX.js → chunk-LEHVP4DY.js} +2 -2
- package/dist/chunk-MNCQPMCH.js +2 -0
- package/dist/chunk-MYTUWXHK.js +4 -0
- package/dist/chunk-N25HPUOK.js +2 -0
- package/dist/chunk-NABVR6B7.js +2 -0
- package/dist/{chunk-TK7O5ER5.js → chunk-NBNEVLRC.js} +2 -2
- package/dist/chunk-NTSR6SRP.js +2 -0
- package/dist/{chunk-7B6LP46R.js → chunk-OFXN2BCT.js} +2 -2
- package/dist/chunk-PWAK75BU.js +2 -0
- package/dist/chunk-Q5P7NOVM.js +2 -0
- package/dist/{chunk-G5UPYQGL.js → chunk-RGKRYO22.js} +4 -4
- package/dist/chunk-RM2WQ75T.js +2 -0
- package/dist/chunk-ROGZXWN2.js +2 -0
- package/dist/chunk-RSSXKJ6J.js +38 -0
- package/dist/chunk-RUV5IY25.js +7 -0
- package/dist/chunk-RVGEZYMQ.js +2 -0
- package/dist/{chunk-6LJHXREW.js → chunk-RXINFVBN.js} +2 -2
- package/dist/{chunk-YWYFU2V3.js → chunk-S2MRVIJ5.js} +2 -2
- package/dist/chunk-SA3DPTHT.js +7 -0
- package/dist/chunk-SGTKURU6.js +52 -0
- package/dist/chunk-SQNHOOJ5.js +3 -0
- package/dist/chunk-T3AEVJBG.js +4 -0
- package/dist/{chunk-NOJAM5ZV.js → chunk-T4N2ZRVY.js} +2 -2
- package/dist/{chunk-JATUZIEH.js → chunk-TBCHRDAC.js} +2 -2
- package/dist/chunk-THB6AM3V.js +11 -0
- package/dist/{chunk-TQ5W2H3S.js → chunk-ULHLDOD6.js} +1 -1
- package/dist/chunk-UQ73QF5D.js +43 -0
- package/dist/chunk-UVPY3RUZ.js +2 -0
- package/dist/chunk-V5FGK3DZ.js +2 -0
- package/dist/{chunk-ZQDIXAF5.js → chunk-VB2EZZPA.js} +2 -2
- package/dist/{chunk-7TWLSZK5.js → chunk-WTY5FERW.js} +2 -2
- package/dist/chunk-WUOB4DHH.js +6 -0
- package/dist/chunk-XHMVZFA6.js +2 -0
- package/dist/chunk-XRUGSM76.js +10 -0
- package/dist/{chunk-BASVXNY3.js → chunk-XUCZ3RQ5.js} +2 -2
- package/dist/chunk-YFQIKYOP.js +2 -0
- package/dist/chunk-Z2LDWIJV.js +5 -0
- package/dist/chunk-ZNWWVYQL.js +3 -0
- package/dist/{chunk-FKCGBZAC.js → chunk-ZUUNREKS.js} +2 -2
- package/dist/cli.js +238 -216
- package/dist/{config-types-BDIWAYzr.d.ts → config-types-dvHOz0zU.d.ts} +4 -1
- package/dist/{db-Djj3Nqrb.d.ts → db-rMZO5JFK.d.ts} +1 -1
- package/dist/{health-D5J42g4D.d.ts → health-CtTIGh6H.d.ts} +1 -1
- package/dist/index.d.ts +9 -5
- package/dist/index.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 +2 -2
- package/dist/queries/co-change.js +1 -1
- package/dist/queries/code.d.ts +2 -2
- package/dist/queries/code.js +1 -1
- package/dist/queries/complexity-hotspots.d.ts +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 +2 -2
- package/dist/queries/diff-gate.js +1 -1
- package/dist/queries/diff-impact.d.ts +2 -2
- 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/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 +2 -2
- package/dist/queries/incomplete-migration.js +1 -1
- package/dist/queries/index.d.ts +3 -3
- package/dist/queries/index.js +1 -1
- package/dist/queries/isolated.d.ts +2 -2
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/locality-candidates.d.ts +2 -2
- package/dist/queries/locality-candidates.js +1 -1
- package/dist/queries/members.d.ts +2 -2
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.d.ts +2 -2
- package/dist/queries/methods.js +1 -1
- package/dist/queries/outline.d.ts +2 -2
- package/dist/queries/outline.js +1 -1
- package/dist/queries/passthrough-candidates.d.ts +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 +2 -2
- package/dist/queries/react-component-duplicates.js +1 -1
- package/dist/queries/react-hook-candidates.d.ts +2 -2
- package/dist/queries/react-hook-candidates.js +1 -1
- package/dist/queries/react-large-component-pressure.d.ts +2 -2
- package/dist/queries/react-large-component-pressure.js +1 -1
- package/dist/queries/recent-duplicates.d.ts +2 -2
- package/dist/queries/recent-duplicates.js +1 -1
- package/dist/queries/redundant-reexports.d.ts +2 -2
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/refs.d.ts +2 -2
- package/dist/queries/refs.js +1 -1
- package/dist/queries/self-audit.d.ts +7 -4
- package/dist/queries/self-audit.js +1 -1
- package/dist/queries/similar-chains.d.ts +2 -2
- package/dist/queries/similar-chains.js +1 -1
- package/dist/queries/similar-files.d.ts +2 -2
- package/dist/queries/similar-files.js +1 -1
- package/dist/queries/similar-signatures.d.ts +2 -2
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.d.ts +46 -17
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.d.ts +2 -2
- package/dist/queries/slice.js +1 -1
- package/dist/queries/stale-abstractions.d.ts +2 -2
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/stats.d.ts +2 -2
- package/dist/queries/surface.d.ts +2 -2
- package/dist/queries/surface.js +1 -1
- package/dist/queries/symbols.d.ts +2 -2
- package/dist/queries/symbols.js +1 -1
- package/dist/queries/system.d.ts +2 -2
- package/dist/queries/system.js +1 -1
- package/dist/queries/trace.d.ts +2 -2
- package/dist/queries/trace.js +1 -1
- package/dist/queries/unused-imports.d.ts +2 -2
- package/dist/queries/unused-imports.js +1 -1
- package/dist/queries/unused-params.d.ts +2 -2
- package/dist/queries/unused-params.js +1 -1
- package/dist/queries/vue-component-duplicates.d.ts +2 -2
- package/dist/queries/vue-component-duplicates.js +1 -1
- package/dist/queries/vue-composable-candidates.d.ts +2 -2
- package/dist/queries/vue-composable-candidates.js +1 -1
- package/dist/queries/vue-large-view-pressure.d.ts +2 -2
- package/dist/queries/vue-large-view-pressure.js +1 -1
- package/dist/queries/wrapper-candidates.d.ts +2 -2
- package/dist/queries/wrapper-candidates.js +1 -1
- package/dist/reindex-worker.js +9 -9
- package/dist/reindex.d.ts +30 -4
- package/dist/reindex.js +19 -19
- package/dist/runtime.d.ts +4 -3
- package/dist/runtime.js +2 -2
- package/dist/{scip-cli-CnK9Va4O.d.ts → scip-cli-trnNvymv.d.ts} +1 -1
- package/docs/COMMAND_REFERENCE.md +1 -1
- package/docs/analyzer-inventory.md +8 -0
- package/docs/analyzer-validation-ledger.md +7 -0
- package/package.json +3 -1
- package/scripts/evidence-product-contract.mjs +197 -0
- package/dist/chunk-2KHTSEIL.js +0 -102
- package/dist/chunk-3VD3JMK2.js +0 -2
- package/dist/chunk-4UZO3XCV.js +0 -35
- package/dist/chunk-5GOLFJEO.js +0 -8
- package/dist/chunk-5OST6GYB.js +0 -2
- package/dist/chunk-65AU3HFZ.js +0 -2
- package/dist/chunk-6GN7FXCH.js +0 -2
- package/dist/chunk-6JRV4MY2.js +0 -23
- package/dist/chunk-6QSOCTZT.js +0 -18
- package/dist/chunk-72KY2ZFO.js +0 -2
- package/dist/chunk-7GO4EQF5.js +0 -2
- package/dist/chunk-7IVSJJZU.js +0 -7
- package/dist/chunk-A536TEU4.js +0 -3
- package/dist/chunk-AVWPHM2Q.js +0 -4
- package/dist/chunk-BSN22NRK.js +0 -9
- package/dist/chunk-C5CTSJ6X.js +0 -6
- package/dist/chunk-CO5GJRP7.js +0 -2
- package/dist/chunk-CW5YFOCP.js +0 -5
- package/dist/chunk-DS6QEB3G.js +0 -5
- package/dist/chunk-E35O7UCB.js +0 -2
- package/dist/chunk-EXDQ35NN.js +0 -2
- package/dist/chunk-FAYI6KZ5.js +0 -2
- package/dist/chunk-FG4NT6VY.js +0 -2
- package/dist/chunk-GQBMH2TQ.js +0 -2
- package/dist/chunk-GRJY65YT.js +0 -2
- package/dist/chunk-HF25DFSC.js +0 -3
- package/dist/chunk-HHN2B5KA.js +0 -2
- package/dist/chunk-JCLDUKT6.js +0 -38
- package/dist/chunk-JGN2ZFJR.js +0 -2
- package/dist/chunk-JM72FNGA.js +0 -2
- package/dist/chunk-KDFONWTW.js +0 -40
- package/dist/chunk-LPL4MA6R.js +0 -2
- package/dist/chunk-LZHUWKGD.js +0 -2
- package/dist/chunk-M4COR2H6.js +0 -2
- package/dist/chunk-O6ZH6C6Y.js +0 -2
- package/dist/chunk-OBGRLXWF.js +0 -3
- package/dist/chunk-OLTESY4K.js +0 -3
- package/dist/chunk-P4KYUPBD.js +0 -4
- package/dist/chunk-P5RYBRIO.js +0 -4
- package/dist/chunk-P7AL7Y37.js +0 -2
- package/dist/chunk-PFOCOG57.js +0 -2
- package/dist/chunk-QLAUCRDJ.js +0 -2
- package/dist/chunk-QPU7EXAW.js +0 -2
- package/dist/chunk-RVWSAMTT.js +0 -2
- package/dist/chunk-USPV3T5K.js +0 -2
- package/dist/chunk-VCQYSG2M.js +0 -10
- package/dist/chunk-VUKC6F77.js +0 -20
- package/dist/chunk-W2CBNBEL.js +0 -71
- package/dist/chunk-W6BVEKYC.js +0 -3
- package/dist/chunk-WUCEKFQC.js +0 -3
- package/dist/chunk-XUGQU7PM.js +0 -41
- package/dist/chunk-Y5NBHMQX.js +0 -2
- package/dist/chunk-YCOFCT4B.js +0 -2
- package/dist/chunk-YZA6PPZL.js +0 -3
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as k}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as k}from"./chunk-RSSXKJ6J.js";import{f as g,h as R,i as M,j as C,p as D}from"./chunk-UQ73QF5D.js";import{e as h}from"./chunk-CYHIKTJN.js";import{g as S}from"./chunk-63CI3IXR.js";import{e as y}from"./chunk-NABVR6B7.js";import{h as p,j as b}from"./chunk-THB6AM3V.js";import{e as d}from"./chunk-SA3DPTHT.js";import{a as m}from"./chunk-64MNV6AB.js";function L(e,n,t={}){let o=new Map;if(n&&n.length===0)return o;let r=m(e,{includeIgnored:!1}),a=C(e),i=n??S(e),l=new Set(i.map(c=>c.symbolId)),s=F(i);return I(e,o,r,a,l,s),v(e,o,i,l),_(e,o,r,a,l,s),t.semantic!==!1&&V(o,h(e,j(i))),o}function I(e,n,t,o,r,a){for(let i of t){if(!d(i))continue;let l=p(e,i);if(l)for(let s of l){if(a&&!a.has(s.calleeLeaf))continue;let c=R(i,o.get(s.calleeLeaf)??[]);if(!c||c.length===0)continue;let f=M(e,i,c,s.memberAccess);f&&r.has(f.symbolId)&&f.file!==i&&u(n,f.symbolId,i)}}}function v(e,n,t,o){let r=x(t);for(let a of w(e,o))e.isIgnored(a.relative_path)||A(a,r.get(a.symbol_id))||u(n,a.symbol_id,a.relative_path)}function w(e,n){return g(e,n?[...n]:void 0)}function x(e){let n=new Map;for(let t of e)n.set(t.symbolId,{docId:t.documentId,startLine:t.startLine,endLine:t.endLine});return n}function A(e,n){return!!n&&n.docId===e.document_id&&e.chunk_start>=n.startLine&&e.chunk_end<=n.endLine}function _(e,n,t,o,r,a){for(let i of t){if(d(i)!=="rust")continue;let l=b(e,i,{includeRustAttributeNames:!0});if(l.length!==0)for(let{name:s}of l){if(a&&!a.has(s))continue;let c=o.get(s);if(c)for(let f of c)r.has(f.symbolId)&&f.file!==i&&u(n,f.symbolId,i)}}}function u(e,n,t){let o=e.get(n);o||(o=new Set,e.set(n,o)),o.add(t)}function F(e){let n=new Set;for(let t of e){let o="leaf"in t&&typeof t.leaf=="string"?t.leaf:"symbol"in t&&typeof t.symbol=="string"?y(t.symbol):"";o&&n.add(o)}return n.size>0?n:null}function j(e){return e.filter(n=>"relativePath"in n&&"symbol"in n&&"leaf"in n)}function V(e,n){for(let[t,o]of n){let r=e.get(t);r||(r=new Set,e.set(t,r));for(let a of o)r.add(a)}}function W(e,n,t={}){return k(e,n,t)}function K(e,n,t={}){return L(e,n,t)}function G(e,n,t={}){return D(e,n,t)}function X(e,n,t={}){let o=K(e,n,{semantic:t.semantic});return t.sourceFallback===!1?o:P(o,G(e,n))}function P(e,n){let t=new Map;for(let[o,r]of e)t.set(o,new Set(r));for(let[o,r]of n){let a=t.get(o)??new Set;for(let i of r)a.add(i);t.set(o,a)}return t}export{W as a,K as b,G as c,X as d,P as e};
|
|
2
|
+
//# sourceMappingURL=chunk-L446VQYQ.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as y}from"./chunk-B75HZHUP.js";import{a as f}from"./chunk-BGBBVSH4.js";import{g as L}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as y}from"./chunk-B75HZHUP.js";import{a as f}from"./chunk-BGBBVSH4.js";import{g as L}from"./chunk-CYHIKTJN.js";import{c as h,d as S,g as x}from"./chunk-63CI3IXR.js";import{d as b}from"./chunk-NABVR6B7.js";import{c as d}from"./chunk-THB6AM3V.js";import{a as g}from"./chunk-SA3DPTHT.js";function F(n,e={}){let{scope:s,minLoc:t=1,limit:i,scanLimit:a}=e,o=e.semantic!==!1,l=M(n,$(n,{scope:s,minLoc:t,scanLimit:a}),{semantic:o}),r=I(l);return i?r.slice(0,i):r}function $(n,e){let s=x(n,{scope:e.scope}).filter(t=>t.isFunctionLike&&!n.isIgnored(t.relativePath)).filter(t=>f(t)>=e.minLoc);return typeof e.scanLimit=="number"&&e.scanLimit>0&&s.sort((t,i)=>f(i)-f(t)||t.relativePath.localeCompare(i.relativePath)),y(s,e.scanLimit)}function M(n,e,s){let t=new Map;for(let i of e){let a=w(n,i,s);if(!a)continue;let o=t.get(a)??[];o.push(v(i)),t.set(a,o)}return t}function v(n){return{symbol:n.symbol,shortName:b(n.symbol),file:n.relativePath,startLine:n.startLine,endLine:n.endLine,loc:f(n)}}function I(n){let e=[];for(let[s,t]of n)t.length>=2&&e.push({signature:s,functions:t});return e.sort((s,t)=>{let i=t.functions.length-s.functions.length;if(i!==0)return i;let a=s.functions.reduce((l,r)=>l+r.loc,0);return t.functions.reduce((l,r)=>l+r.loc,0)-a}),e}function w(n,e,s){if(s.semantic){let a=L(n,e);if(a)return a}let t=G(e.documentation),i=t?A(t):null;return i||R(P(n,e.relativePath,e.startLine,e.endLine,e.leaf),e.leaf)}function G(n){return h(S(n))}function P(n,e,s,t,i){let a=g(n,e);if(!a)return null;let o=a.split(/\r?\n/),l=E(o,s,t,i);for(let r of l){let p=Math.min(o.length-1,Math.max(r,r+4)),u="";for(let c=r;c<=p;c+=1){let m=o[c]?.trim();if(m&&(u=u?`${u} ${m}`:m,z(u)))return u}if(u&&u.includes("("))return u}return null}function z(n){let e=n.replace(/\s+/g," ").trim();return!e.includes("(")||d(e)>0?!1:/[;{]$/.test(e)||/\)\s*(?::\s*[^={]+)?\s*(?:=>|=|throws\b|where\b|$)/i.test(e)||/\)\s*As\s+.+$/i.test(e)}function A(n){if(!n||!n.trim())return null;let e=n.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(),s=e.indexOf("(");return s===-1||(e=e.slice(s),e=e.replace(/\s+/g,"").toLowerCase(),e.length<3)?null:e}function R(n,e){if(!n||!n.trim())return null;let s=n.replace(/\s+/g," ").trim(),t=s.indexOf("(");if(t===-1)return null;let i=s.slice(0,t),o=new RegExp(`\\b${D(e)}\\b`,"i").exec(i);o&&typeof o.index=="number"&&(i=i.slice(0,o.index)),i=i.replace(/\b(public|private|protected|internal|final|static|abstract|sealed|virtual|override|async|suspend|inline|constexpr|consteval|constinit|const|pub|fn|function|def|sub|friend|shared|readonly|new|open|partial|export)\b/gi," ").replace(/\s+/g," ").trim();let l=C(s.slice(t)).replace(/\)\s*=\s*[\s\S]*$/,")").replace(/\s+throws\s+[^={]+$/i,"").replace(/\s+where\s+.+$/i,"").replace(/\s+/g," ").trim();if(!l.startsWith("("))return null;let r=`${i?`${i} `:""}${l}`.replace(/\s+/g,"").toLowerCase();return r.length>=3?r:null}function C(n){let e=0,s=0,t=0,i=0,a=null,o=!1;for(let l=0;l<n.length;l+=1){let r=n[l];if(a){if(o){o=!1;continue}if(r==="\\"){o=!0;continue}r===a&&(a=null);continue}if(r==='"'||r==="'"||r==="`"){a=r;continue}if(r==="(")e+=1;else if(r===")")e=Math.max(0,e-1);else if(r==="[")t+=1;else if(r==="]")t=Math.max(0,t-1);else if(r==="<")i+=1;else if(r===">")i=Math.max(0,i-1);else if(r==="{"){if(e===0&&t===0&&i===0)return n.slice(0,l);s+=1}else if(r==="}")s=Math.max(0,s-1);else if(r==="="&&n[l+1]===">"&&e===0&&s===0&&t===0&&i===0)return n.slice(0,l)}return n}function E(n,e,s,t){let i=D(t),a=new RegExp(`\\b${i}\\b\\s*\\(`,"i"),o=new RegExp(`\\bdef\\s+${i}\\b`,"i"),l=[],r=new Set,p=Math.max(0,Math.min(e,n.length-1)),u=Math.max(p,Math.min(n.length-1,Math.max(s,e+4)));for(let c=p;c<=u;c+=1){let m=n[c]??"";(a.test(m)||o.test(m))&&!r.has(c)&&(r.add(c),l.push(c))}for(let c=0;c<n.length;c+=1){let m=n[c]??"";(a.test(m)||o.test(m))&&!r.has(c)&&(r.add(c),l.push(c))}return l}function D(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}export{F as a};
|
|
2
|
+
//# sourceMappingURL=chunk-LDJUB7XW.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as m}from"./chunk-
|
|
1
|
+
import{b as m}from"./chunk-OFXN2BCT.js";import{k as o}from"./chunk-63CI3IXR.js";function h(t,l){let s=m(t,l);if(s.length===0)return{files:[],symbols:[],dependsOn:[],dependedOnBy:[]};let d=s.map(()=>"?").join(", "),i=t.all(`SELECT relative_path FROM documents
|
|
2
2
|
WHERE relative_path IN (${d})
|
|
3
3
|
ORDER BY relative_path`,...s).map(e=>e.relative_path).filter(e=>!t.isIgnored(e)),n=o(t,i,{onlyDocumented:!0,sort:!0}).map(({relativePath:e,...c})=>c),a=t.all(`SELECT DISTINCT d2.relative_path
|
|
4
4
|
FROM mentions m
|
|
@@ -32,4 +32,4 @@ import{b as m}from"./chunk-7B6LP46R.js";import{k as o}from"./chunk-2KHTSEIL.js";
|
|
|
32
32
|
WHERE d2.relative_path IN (${d})
|
|
33
33
|
AND d1.relative_path NOT IN (${d})
|
|
34
34
|
ORDER BY d1.relative_path`,...s,...s).map(e=>e.relative_path).filter(e=>!t.isIgnored(e));return{files:i,symbols:n,dependsOn:a,dependedOnBy:r}}export{h as a};
|
|
35
|
-
//# sourceMappingURL=chunk-
|
|
35
|
+
//# sourceMappingURL=chunk-LEHVP4DY.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as u}from"./chunk-ULHLDOD6.js";function x(e,i){let l=new Map;return e.forEach((t,f)=>{let o=new Set;for(let r of i(t)){if(o.has(r))continue;o.add(r);let n=l.get(r);n?n.push(f):l.set(r,[f])}}),{candidatesFor:(t,f)=>{let o=new Set;for(let r of i(t)){let n=l.get(r);if(n)for(let a of n)a!==f&&o.add(a)}return[...o].sort((r,n)=>r-n)}}}function R(e){let i=c(e.profile?.name),l=()=>{let t=[];i=c(e.profile?.name,e);let f=(r,n)=>{let a=e.profiles[r],s=e.profiles[n];i.candidatePairs+=1,i.comparedPairs+=1;let d=e.compare(a,s);d&&t.push(d)};if(e.filePattern){let r=e.profiles.findIndex(n=>n.file.includes(e.filePattern));if(r>=0){let n=e.profiles[r];for(let a of m(e,r)){let s=e.profiles[a];e.focusFiles&&!e.focusFiles.has(n.file)&&!e.focusFiles.has(s.file)||f(r,a)}}}else if(e.focusFiles?.size!==0){let r=typeof e.overrunFactor=="number"&&Number.isFinite(e.limit)?e.limit*e.overrunFactor:Number.POSITIVE_INFINITY;for(let n=0;n<e.profiles.length;n+=1){let a=e.profiles[n],s=e.focusFiles?.has(a.file)??!1;for(let d of p(e,n))e.focusFiles&&!s&&!e.focusFiles.has(e.profiles[d].file)||f(n,d);if(t.length>r){i.overrunApplied=!0;break}}}t.sort(e.sort??((r,n)=>n.similarity-r.similarity)),i.matchedResults=t.length;let o=t.slice(0,e.limit);return i.emittedResults=o.length,e.onProfile?.({...i}),o};return e.profile?u(`pairwise-profile:${e.profile.name}`,l,()=>({...b(e.profile?.metadata),...i})):l()}function m(e,i){if(e.candidateIndex)return P(e,i,-1);let l=[];for(let t=0;t<e.profiles.length;t+=1)t!==i&&l.push(t);return l}function p(e,i){if(e.candidateIndex)return P(e,i,i);let l=[];for(let t=i+1;t<e.profiles.length;t+=1)l.push(t);return l}function P(e,i,l){let t=e.profiles[i],f=new Set;for(let o of e.candidateIndex?.candidatesFor(t,i,e.profiles)??[])o<=l||o!==i&&(o<0||o>=e.profiles.length||f.add(o));return[...f].sort((o,r)=>o-r)}function c(e,i){return{pipeline:e,profileCount:i?.profiles.length??0,focusedProfileCount:i?.focusFiles?i.profiles.filter(l=>i.focusFiles.has(l.file)).length:0,candidatePairs:0,comparedPairs:0,matchedResults:0,emittedResults:0,candidateIndexApplied:i?.candidateIndex!==void 0,focusApplied:i?.focusFiles!==void 0,filePatternApplied:i?.filePattern!==void 0,overrunApplied:!1}}function b(e){return typeof e=="function"?e():e??{}}export{x as a,R as b};
|
|
2
|
+
//# sourceMappingURL=chunk-MNCQPMCH.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as R}from"./chunk-HRDSU5FN.js";import{a as L,b as B}from"./chunk-ULHLDOD6.js";import{b as O,h as P,i as v,j}from"./chunk-SGTKURU6.js";import{existsSync as $,readFileSync as F}from"fs";import{join as x}from"path";function X(t,n){let e=q(t,n)??V(t,n)??K(t,n)??Q(t,n);return Y(t,e,n)}function q(t,n){let e=-1,i=null;for(let r=0;r<=n;r+=1){let o=w(t[r]??"");o&&(i===null?(i=o,e=r):o===i&&(i=null,e=-1))}if(i===null||e<0)return null;for(let r=n+1;r<t.length;r+=1)if(w(t[r]??"")===i)return{start:e,end:r+1};return{start:e,end:t.length}}function w(t){let n=t.match(/^\s*(```+|~~~+)/);return n?n[1].startsWith("`")?"`":"~":null}function V(t,n){if(!I(t[n]??""))return null;let e=n;for(;e>0&&I(t[e-1]??"");)e-=1;let i=n+1;for(;i<t.length&&I(t[i]??"");)i+=1;return{start:e,end:i}}function I(t){let n=t.trim();return n.startsWith("|")&&n.endsWith("|")&&n.includes("|")}function K(t,n){let e=n;for(;e>=0;){let o=t[e]??"";if(k(o)!==null)break;if(E(o)!==null)return null;e-=1}if(e<0)return null;let i=k(t[e]??"");if(i===null)return null;let r=e+1;for(;r<t.length;){let o=t[r]??"",c=k(o);if(c!==null){if(c<=i)break;r+=1;continue}if(E(o)!==null)break;r+=1}return{start:e,end:r}}function k(t){let n=t.match(/^(\s*)(?:[-*+]\s+|\d+[.)]\s+)/);return n?n[1].length:null}function Q(t,n){let e=t[n]??"";if(H(e)||e.trim().length===0)return{start:n,end:n+1};let i=n;for(;i>0&&z(t[i-1]??"");)i-=1;let r=n+1;for(;r<t.length&&z(t[r]??"");)r+=1;return{start:i,end:r}}function z(t){return E(t)===null}function E(t){return t.trim().length===0?"blank":H(t)?"heading":w(t)?"fence":I(t)?"table":k(t)!==null?"list":null}function H(t){return/^#{1,6}\s+/.test(t.trim())}function Y(t,n,e){let{start:i,end:r}=n;if(r-i>40){let c=Math.floor(20);i=Math.max(i,e-c),r=Math.min(r,i+40),i=Math.max(n.start,r-40)}let o=t.slice(i,r).join(`
|
|
2
|
+
`).trim();return o.length<=2e3?o:`${o.slice(0,2e3).trimEnd()}...`}function _(t,n){return n.filter(e=>t.includes(e))}var U=j({kind:"doc-path-evidence",serialize:ft,deserialize:gt}),b=/\.(?:md|mdx|rst|txt)$/i;function tt(t){return/(?:^|\/)(?:docs\/plans|plans|adrs?|rfcs?|decisions|changelogs?|archive|reports?)\//i.test(t)||/(?:^|\/)CHANGELOG\.(?:md|mdx|rst|txt)$/i.test(t)}var nt=3,et=/[A-Za-z0-9_@-]+(?:\/[A-Za-z0-9_.@-]+)+\.[A-Za-z0-9]{1,6}\b/g;function Mt(t,n={}){let{doc:e,limit:i=20,minCoupling:r=nt}=n,o=ot(t);if(!o)return{available:!1,commitsAnalyzed:0,docsScanned:0,findings:[]};let c=[];for(let s of o.docFiles){if(e!==void 0&&!s.includes(e)||e===void 0&&!G(t,s)||e!==void 0&&!$(x(t.config.projectRoot,s)))continue;let l=Math.max(0,...o.changeTimes.get(s)??[]),f=it(t,s),h=new Map,{resolved:g,broken:a,citations:u}=at(t,s,o.tracked,o.trackedBySuffix,o.everSeenInHistory),p=new Map(u.map(d=>[d.file,d.contexts]));for(let d of g){if(d===s||b.test(d))continue;let m=(o.changeTimes.get(d)??[]).filter(S=>S>l).length;m!==0&&h.set(d,{file:d,evidence:"reference",coChanges:0,changesSinceDocUpdate:m,...N("reference",f),citationContexts:p.get(d)})}for(let[d,m]of o.coupling.get(s)??[]){if(m<r||!o.tracked.has(d))continue;let S=(o.changeTimes.get(d)??[]).filter(T=>T>l).length;if(S===0)continue;let C=h.get(d);C?(C.evidence="both",C.coChanges=m,Object.assign(C,N("both",f))):h.set(d,{file:d,evidence:"co-change",coChanges:m,changesSinceDocUpdate:S,...N("co-change",f)})}if(h.size===0&&a.length===0)continue;let D=[...h.values()].sort((d,m)=>m.changesSinceDocUpdate-d.changesSinceDocUpdate);c.push({doc:s,docLastChangedAt:l,staleness:D.reduce((d,m)=>d+m.changesSinceDocUpdate,0)+a.length*10,subjects:D.slice(0,8),brokenReferences:a})}return c.sort((s,l)=>l.staleness-s.staleness),{available:!0,commitsAnalyzed:o.historyCommitCount,docsScanned:o.docFiles.length,findings:c.slice(0,i)}}function it(t,n){let e;try{e=F(x(t.config.projectRoot,n),"utf8").slice(0,6e3)}catch{return{docIntent:"unknown",reasons:["doc text unavailable"]}}let i=`${n}
|
|
3
|
+
${e}`.toLowerCase(),r=_(i,["historical note","historical record","history note","retrospective","postmortem","post-mortem","archived","archive","previously","legacy","recorded","record of","snapshot","as of","migration note","decision record"]);if(r.length>0)return{docIntent:"historical-note",reasons:[`historical-note terms: ${r.join(", ")}`]};let o=_(i,["current","standard","standards","must","should","policy","guide","guidance","workflow","contract","invariant","source of truth"]);return o.length>0?{docIntent:"current-guidance",reasons:[`current-guidance terms: ${o.join(", ")}`]}:{docIntent:"unknown",reasons:["no current-guidance or historical-note markers found"]}}function N(t,n){return{actionTier:rt(t,n.docIntent),docIntent:n.docIntent,docIntentReasons:n.reasons}}function rt(t,n){return n==="historical-note"?"support":t==="co-change"?"signal":"direct"}function ot(t){let n=R(t),e=n.commitHistory();if(!e)return null;let i=n.trackedFiles()??new Set,r=new Map,o=new Map,c=new Set;for(let s of e.commits){let l=[...new Set(s.files)],f=l.filter(g=>b.test(g)),h=l.filter(g=>!b.test(g));for(let g of l){c.add(g);let a=r.get(g)??[];a.push(s.timestamp),r.set(g,a)}for(let g of f){let a=o.get(g);a||(a=new Map,o.set(g,a));for(let u of h)a.set(u,(a.get(u)??0)+1)}}return{changeTimes:r,coupling:o,docFiles:[...i].filter(s=>b.test(s)),everSeenInHistory:c,historyCommitCount:e.commits.length,tracked:i,trackedBySuffix:W(i)}}function vt(t,n){if(n.size===0)return[];let e=L(),i=0,r=0,o=0,c=0,s=0,l=0;return B("doc-reference.docs-citing-files",()=>{let f=R(t).trackedFiles()??new Set;i=f.size;let h=W(f),g=st(n,h),a=[];for(let u of f){if(!G(t,u))continue;e&&(r+=1);let p;try{p=F(x(t.config.projectRoot,u),"utf-8")}catch{e&&(o+=1);continue}if(!lt(p,g)){e&&(c+=1);continue}let D=Z(t,u,p);if(!D)continue;e&&(s+=1);let d=ct(D.candidates,n,g,f,h);if(d.size===0)continue;let m=[...new Set([...d.values()].flatMap(y=>[...y]))],S=dt(D.contextsByCandidate,m),C=[...d].map(([y,M])=>({file:y,contexts:A([...M].flatMap(J=>S.get(J)??[])).slice(0,3)})).filter(y=>y.contexts.length>0),T=[...d.keys()];if(T.length>0){e&&(l+=1);let y=T.sort();a.push({doc:u,cited:y,citations:C,citedClaims:A(C.flatMap(M=>M.contexts)).slice(0,3)})}}return a},()=>({targets:n.size,trackedFiles:i,livingDocs:r,unreadableDocs:o,candidateMisses:c,evidenceDocs:s,citedDocs:l}))}function G(t,n){return b.test(n)&&!tt(n)&&$(x(t.config.projectRoot,n))}function W(t){let n=new Map;for(let e of t){let i=e.split("/");for(let r of[2,3]){if(i.length<r)continue;let o=i.slice(-r).join("/"),c=n.get(o)??[];c.push(e),n.set(o,c)}}return n}function st(t,n){let e=new Set(t);for(let i of t){let r=i.split("/");for(let o of[2,3]){if(r.length<o)continue;let c=r.slice(-o).join("/"),s=n.get(c);s?.length===1&&s[0]===i&&e.add(c)}}return e}function ct(t,n,e,i,r){let o=new Map;for(let c of t){if(!e.has(c))continue;let s;if(i.has(c))s=c;else{let f=r.get(c);f?.length===1&&(s=f[0])}if(!s||!n.has(s))continue;let l=o.get(s)??new Set;l.add(c),o.set(s,l)}return o}function at(t,n,e,i,r){let o=new Set,c=new Set,s=Z(t,n);if(!s)return{resolved:o,broken:[],citations:[]};let l=s.candidates,f=s.contextsByCandidate,h=new Map,g=(a,u)=>{let p=f.get(u);if(!p||p.length===0)return;let D=h.get(a)??[];D.push(...p),h.set(a,A(D).slice(0,3))};for(let a of l){if(e.has(a)){o.add(a),g(a,a);continue}let u=i.get(a);if(u&&u.length===1){o.add(u[0]),g(u[0],a);continue}u&&u.length>1||r.has(a)&&c.add(a)}return{resolved:o,broken:[...c],citations:[...h].map(([a,u])=>({file:a,contexts:u}))}}function dt(t,n){let e=new Map;for(let i of n){let r=t.get(i);r&&r.length>0&&e.set(i,[...r])}return e}function Z(t,n,e){let i=e;if(i===void 0)try{i=F(x(t.config.projectRoot,n),"utf-8")}catch{return null}let r=O(t,n,i),o=U.read(t,n,r);if(o)return o;let c=ut(i);return U.write(t,n,r,c),c}function lt(t,n){for(let e of n)if(t.includes(e))return!0;return!1}function ut(t){let n=t.split(/\r?\n/),e=new Set,i=new Map;for(let r=0;r<n.length;r+=1){let o=n[r]??"";for(let c of o.matchAll(et)){let s=c[0].replace(/^\.?\//,"");e.add(s);let l=X(n,r);if(l.length===0)continue;let f=i.get(s)??[];f.push(l),i.set(s,A(f).slice(0,3))}}return{candidates:[...e],contextsByCandidate:i}}function ft(t){let n={candidates:t.candidates,contextsByCandidate:[...t.contextsByCandidate.entries()]};return JSON.stringify(n)}function gt(t){try{let n=JSON.parse(t);if(!P(n))return null;let e=v(n.candidates),i=ht(n.contextsByCandidate);return!e||!i?null:{candidates:e,contextsByCandidate:new Map(i)}}catch{return null}}function ht(t){if(!Array.isArray(t))return null;let n=[];for(let e of t){if(!Array.isArray(e)||e.length!==2||typeof e[0]!="string")return null;let i=v(e[1]);if(!i)return null;n.push([e[0],i])}return n}function A(t){let n=[];for(let e of new Set(t))n.some(i=>mt(i,e))||n.push(e);return n}function mt(t,n){if(t===n)return!0;let e=t.split(/\r?\n/).map(s=>s.trim()).filter(s=>s.length>0),i=n.split(/\r?\n/).map(s=>s.trim()).filter(s=>s.length>0),r=Math.min(e.length,i.length);if(r===0)return!1;if(r<3)return t.includes(n)||n.includes(t);let o=new Set(i),c=e.filter(s=>o.has(s)).length;return c>=3&&c/r>=.6}export{X as a,_ as b,tt as c,Mt as d,vt as e};
|
|
4
|
+
//# sourceMappingURL=chunk-MYTUWXHK.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{m as l}from"./chunk-SA3DPTHT.js";function S(e,t={}){let{minTotalLines:n=800,minTemplateLines:i=300,minScriptLines:a=300,minStyleLines:r=500,limit:o=20,scope:m,scanLimit:p,filePattern:u}=t;return l(e).vueProfiles({scope:m,scanLimit:p}).filter(s=>!u||s.file.includes(u)).map(s=>L(s,{minTotalLines:n,minTemplateLines:i,minScriptLines:a,minStyleLines:r})).filter(s=>s!==null).sort((s,c)=>c.totalLines-s.totalLines||s.file.localeCompare(c.file)).slice(0,o)}function L(e,t){let n=[];if(e.totalLines>=t.minTotalLines&&n.push(`${e.totalLines} total component line(s)`),e.templateLines>=t.minTemplateLines&&n.push(`${e.templateLines} template line(s)`),e.scriptLines>=t.minScriptLines&&n.push(`${e.scriptLines} script line(s)`),e.styleLines>=t.minStyleLines&&n.push(`${e.styleLines} style line(s)`),n.length===0)return null;let i=g(e),a=b(e,t,i),r=x(e.file),o=V(i,r);return{file:e.file,totalLines:e.totalLines,sfcLines:e.sfcLines,templateLines:e.templateLines,scriptLines:e.scriptLines,styleLines:e.styleLines,externalScriptLines:e.externalScriptLines,externalScriptPaths:e.externalScriptPaths,customBlockLines:e.customBlockLines,dominantPressure:i,pressureKinds:a,contextKind:r,recommendationKind:o,recommendation:d(o,r),reasons:n,loc:e.totalLines}}function g(e){let t=[{axis:"template",lines:e.templateLines},{axis:"script",lines:e.scriptLines-e.externalScriptLines},{axis:"style",lines:e.styleLines},{axis:"external-script",lines:e.externalScriptLines},{axis:"custom-block",lines:e.customBlockLines}];return t.sort((n,i)=>i.lines-n.lines),t[0]?.lines?t[0].axis:"total"}function b(e,t,n){let i=[];return e.totalLines>=t.minTotalLines&&(i.push("total"),n!=="total"&&i.push(n)),e.templateLines>=t.minTemplateLines&&i.push("template"),e.scriptLines>=t.minScriptLines&&i.push("script"),e.styleLines>=t.minStyleLines&&i.push("style"),(e.externalScriptLines>=t.minScriptLines||n==="external-script")&&i.push("external-script"),e.customBlockLines>0&&n==="custom-block"&&i.push("custom-block"),[...new Set(i.length>0?i:[n])]}function x(e){return e.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean).some(i=>w.has(i))||/(?:view|page|route)\.vue$/i.test(e)||/(?:^|\/)(views|pages|routes)\//i.test(e)?"route-page":"component"}function V(e,t){return e==="style"?"style-decomposition":e==="template"?"template-decomposition":e==="external-script"?"external-script-boundary":e==="custom-block"?"custom-block-review":t==="route-page"?"route-page-decomposition":e==="script"?"script-behavior-extraction":"total-size-review"}function d(e,t){switch(e){case"template-decomposition":return t==="route-page"?"Split route template sections into named panels before extracting script behavior.":"Split repeated template sections into named presentational components.";case"script-behavior-extraction":return"Extract independent script behavior into composables, controllers, or feature modules.";case"style-decomposition":return"Review UI/style decomposition; move repeated styling to component or style primitives, not composables.";case"external-script-boundary":return"Review the external script boundary and split controller/composable modules by workflow.";case"custom-block-review":return"Review custom block ownership before splitting template or script code.";case"route-page-decomposition":return"Split route/page orchestration from reusable panels and feature controllers.";case"total-size-review":return"Review the largest block first, then split by the dominant reason to change."}}var w=new Set(["landing","page","pages","route","routes","view","views"]);export{S as a};
|
|
2
|
+
//# sourceMappingURL=chunk-N25HPUOK.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{d as g,k as S,l as x}from"./chunk-THB6AM3V.js";import{a as u,b as d,h as m}from"./chunk-SA3DPTHT.js";var b={"/":"namespace","#":"type",".":"term","[":"type-param",":":"meta","!":"macro"};function a(e){if(e.startsWith("local "))return{kind:"local",id:e.slice(6),raw:e};let s=e.split(" ");if(s.length<4)return{scheme:s[0]??"",manager:s[1]??"",packageName:s[2]??"",version:"",descriptors:[],raw:e};let t=s[0],r=s[1],n=e.slice(t.length+1+r.length+1),i;if(n.startsWith("`")){let f=n.indexOf("`",1);f===-1?(i=n.slice(1),n=""):(i=n.slice(1,f),n=n.slice(f+2))}else{let f=n.indexOf(" ");f===-1?(i=n,n=""):(i=n.slice(0,f),n=n.slice(f+1))}let o,c=n.indexOf(" ");c===-1?(o=n,n=""):(o=n.slice(0,c),n=n.slice(c+1));let l=k(n);return{scheme:t,manager:r,packageName:i,version:o,descriptors:l,raw:e}}function M(e){let s=a(e);if("kind"in s)return null;for(let t=s.descriptors.length-2;t>=0;t--){let r=s.descriptors[t];if(r?.suffix==="type")return r.name}return null}function k(e){let s=[],t=0;for(;t<e.length;){if(e[t]==="["){let i=e.indexOf("]",t+1);if(i===-1){s.push({name:e.slice(t+1),suffix:"type-param"});break}s.push({name:e.slice(t+1,i),suffix:"type-param"}),t=i+1;continue}if(e[t]==="("&&(s.length===0||t===0||h(e[t-1]))){let i=e.indexOf(")",t+1);if(i!==-1&&e[i+1]!=="."){s.push({name:e.slice(t+1,i),suffix:"parameter"}),t=i+1;continue}}let r;if(e[t]==="`"){let i=e.indexOf("`",t+1);if(i===-1){r=e.slice(t+1),s.push({name:r,suffix:"term"});break}r=e.slice(t+1,i),t=i+1}else{let i=t;for(;t<e.length&&!h(e[t]);)t++;r=e.slice(i,t)}if(t>=e.length){r&&s.push({name:r,suffix:"term"});break}let n=e[t];if(n==="("){let i=e.indexOf(")",t+1);i!==-1&&e[i+1]==="."?(s.push({name:r,suffix:"method"}),t=i+2):i!==-1?(s.push({name:r,suffix:"method"}),t=i+1):(s.push({name:r,suffix:"term"}),t++)}else{let i=b[n];i&&s.push({name:r,suffix:i}),t+=1}}return s}function h(e){return e==="/"||e==="#"||e==="."||e==="("||e==="["||e===":"||e==="!"}function R(e){let s=a(e);if("kind"in s&&s.kind==="local")return`local:${s.id}`;let t=s;if(t.descriptors.length===0)return t.raw;let r=[];for(let n of t.descriptors){let i=D(n);i&&r.push(i)}return r.join(":")}function D(e){let s=e.suffix==="namespace"?v(e.name):e.name;return s?e.suffix==="method"?`${s}()`:s:""}function v(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 T(e){let s=a(e);if("kind"in s&&s.kind==="local")return s.id;let t=s;return t.descriptors.length===0?"":t.descriptors[t.descriptors.length-1].name}function p(e){let s=a(e);if("kind"in s&&s.kind==="local")return null;let t=s;return t.descriptors[t.descriptors.length-1]?.suffix??null}function $(e){return e.endsWith("().")||p(e)==="method"}function j(e){let s=p(e);return s==="method"||s==="term"}function I(e){return p(e)==="namespace"}var E=/^rust-analyzer\b.*[\s/]impl#\[[^\]]+\]\[[^\]]+\]/;function L(e){return E.test(e)}var F=new Set(["test","tests","_tests"]);function O(e){let s=a(e);if("kind"in s)return!1;for(let t=0;t<s.descriptors.length-1;t+=1){let r=s.descriptors[t];if(r?.suffix==="namespace"&&r.name&&F.has(r.name))return!0}return!1}function P(e,s){let t=a(e),r=a(s);if("kind"in t||"kind"in r)return!1;let n=t.descriptors,i=r.descriptors;if(i.length!==n.length+1)return!1;for(let o=0;o<n.length;o++){let c=n[o],l=i[o];if(c.name!==l.name||c.suffix!==l.suffix)return!1}return!0}function _(e,s){let t=a(e),r=a(s);if("kind"in t||"kind"in r)return!1;let n=t.descriptors,i=r.descriptors;if(i.length<=n.length)return!1;for(let o=0;o<n.length;o++){let c=n[o],l=i[o];if(c.name!==l.name||c.suffix!==l.suffix)return!1}return!0}function z(e){return{forFile(s,t){return y(e,s,t)},forFiles(s,t){let r=new Map;for(let n of s)r.set(n,y(e,n,t));return r}}}function y(e,s,t){let r={file:s},n=t.facts||t.identifiers;if(t.text&&(r.text=u(e,s)),t.lines&&(r.lines=d(e,s)),t.ast&&(r.ast=m(e,s)),t.imports&&(r.imports=x(e,s)),t.reexports&&(r.reexports=S(e,s)),n){let i=g(e,s);t.facts&&(r.facts=i),t.identifiers&&i&&(r.identifiers=i.fileIdentifiers,r.identifierLineMap=i.identifierLineMap)}return r}export{z as a,a as b,M as c,R as d,T as e,p as f,$ as g,j as h,I as i,L as j,O as k,P as l,_ as m};
|
|
2
|
+
//# sourceMappingURL=chunk-NABVR6B7.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as y,b as d,e as w,n as f}from"./chunk-
|
|
1
|
+
import{a as y,b as d,e as w,n as f}from"./chunk-63CI3IXR.js";import{c as D,d as $,e as Q,g as v,h as A,i as N}from"./chunk-NABVR6B7.js";function re(e,n){let t=Z(e,n.trim());if(t)return t;let i=q(e,n);if(i)return i;let o=F(e,n);return o||j(e,n)}function F(e,n){let t=x(n),i=I(t);if(!i)return null;let o=`%${i.path}%`,r=i.leaf,c=O(e,o,r,t)[0];return c?f(e,c):null}function O(e,n,t,i){let o=w([],[...z(e,n,t),...W(e,n,t)]).filter(r=>!e.isIgnored(r.relative_path)).filter(r=>h(r,i)>1);return o.sort((r,a)=>h(a,i)-h(r,i)||r.end_line-r.start_line-(a.end_line-a.start_line)||r.start_line-a.start_line||r.symbol.localeCompare(a.symbol)),o}function z(e,n,t){return y(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[n,t,`%/${t}.%`]})}function W(e,n,t){return d(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[n,t,`%/${t}.%`]})}function j(e,n){let t=x(n),i=U(n),o=H(e,i),r=V(o,n,t);if(r&&!e.isIgnored(r.relative_path))return f(e,r);let a=null;for(let c of o){if(e.isIgnored(c.relative_path))continue;let l=J(c,n,t,i);l<=0||(!a||l>a.score)&&(a={row:c,score:l})}return a?f(e,a.row):null}function q(e,n){let t=n.match(/^(.+):(\d+)-(\d+)$/);if(!t)return null;let[,i,o,r]=t,a=Math.max(0,parseInt(o,10)-1),c=Math.max(a,parseInt(r,10)-1),l=T(e,i,a,c)??X(e,i,a,c);return l&&!e.isIgnored(l.relative_path)?f(e,l):null}function T(e,n,t,i){return y(e,{where:"d.relative_path LIKE ? AND der.start_line <= ? AND der.end_line >= ?",params:[`%${n}%`,t,i],orderBy:"(der.end_line - der.start_line) ASC",limit:1})[0]}function X(e,n,t,i){return d(e,{where:"d.relative_path LIKE ? AND c.start_line <= ? AND c.end_line >= ?",params:[`%${n}%`,t,i],orderBy:"(MAX(c.end_line) - MIN(c.start_line)) ASC",limit:1})[0]}function Z(e,n){let i=y(e,{where:"gs.symbol = ?",params:[n],orderBy:"d.relative_path, der.start_line",limit:1})[0]??d(e,{where:"gs.symbol = ?",params:[n],orderBy:"d.relative_path, start_line",limit:1})[0];return!i||e.isIgnored(i.relative_path)?null:f(e,i)}function ae(e,n){if("symbol"in n&&"relativePath"in n)return n;let t=G(e,n.symbolId)[0];return t?f(e,t):null}function G(e,n){let t=y(e,{where:"gs.id = ?",params:[n],orderBy:"der.start_line, der.end_line"}),i=d(e,{where:"gs.id = ?",params:[n],orderBy:"start_line, end_line"});return w(t,i)}function H(e,n){let t=n.map(()=>"(gs.symbol LIKE ? OR d.relative_path LIKE ? OR COALESCE(gs.display_name, '') LIKE ?)"),i=n.flatMap(c=>{let l=`%${c}%`;return[l,l,l]}),o=t.join(`
|
|
2
2
|
AND `),r=y(e,{where:o,params:i,limit:200}),a=d(e,{where:o,params:i,limit:200});return w(r,a)}function J(e,n,t,i){let o=n.trim(),r=t,a=r.replace(/\(\)$/,""),c=n.toLowerCase(),l=t.toLowerCase(),S=l.replace(/\(\)$/,""),k=e.symbol,C=$(e.symbol),b=Q(e.symbol),E=e.display_name??"",g=e.symbol.toLowerCase(),u=C.toLowerCase(),m=b.toLowerCase(),R=E.toLowerCase(),p=e.relative_path.toLowerCase(),K=/[/:.]/.test(t),M=I(t),_=M?.leaf.toLowerCase(),s=0;return(k===o||k===r)&&(s+=1150),(C===o||C===r)&&(s+=1100),E===a&&(s+=1180),b===a&&(s+=1160),(`${b}()`===o||`${b}()`===r)&&(s+=955),(g===c||g===l)&&(s+=1e3),(u===c||u===l)&&(s+=950),(p===c||p===l)&&(s+=925),(p.endsWith(`/${l}`)||p.endsWith(`/${c}`))&&(s+=875),R===S&&(s+=850),m===S&&(s+=825),(`${m}()`===c||`${m}()`===l)&&(s+=820),(u.endsWith(`:${l}`)||u.endsWith(`:${S}`)||u.endsWith(`:${S}()`))&&(s+=800),g.includes(l)&&(s+=120),u.includes(l)&&(s+=140),p.includes(l)&&(s+=140),R.includes(l)&&(s+=110),i.every(B=>{let L=B.toLowerCase();return g.includes(L)||u.includes(L)||p.includes(L)||R.includes(L)})&&(s+=100+i.length*15),M&&p.includes(M.path.toLowerCase())&&(s+=360,_&&(m===_||`${m}()`===_||`${m}()`==`${_}()`)&&(s+=700),v(e.symbol)&&(s+=180)),A(e.symbol)&&m===S&&(s+=60),!K&&N(e.symbol)&&(s-=160),s-=Math.min(50,Math.max(0,e.end_line-e.start_line)),s}function I(e){let n=e.trim().replace(/\\/g,"/"),t=n.lastIndexOf("/");if(t<=0||t===n.length-1)return null;let i=n.slice(t+1).replace(/\(\)$/,"");return!i||i.includes(".")?null:{path:n.slice(0,t),leaf:i}}function x(e){return e.trim().replace(/\(\)$/,"").replace(/\(.*$/,"")}function U(e){let n=x(e),t=n.split(/[^A-Za-z0-9_]+/).map(i=>i.trim()).filter(i=>i.length>0);return t.length>0?[...new Set(t)]:[n]}function V(e,n,t){let i=n.trim(),o=e.filter(r=>{let a=$(r.symbol),c=(r.display_name??"").trim();return r.symbol===i||a===i||a===t||c===i||c===t||`${c}()`===i||h(r,t)>1||r.relative_path===i});return o.length===0?null:(o.sort((r,a)=>h(a,t)-h(r,t)||r.end_line-r.start_line-(a.end_line-a.start_line)||r.relative_path.localeCompare(a.relative_path)||r.symbol.localeCompare(a.symbol)),o[0]??null)}function h(e,n){let t=I(n);if(!t)return 0;let i=e.relative_path.toLowerCase(),o=Q(e.symbol).toLowerCase(),r=t.path.toLowerCase(),a=t.leaf.toLowerCase();return i.includes(r)?o!==a?1:v(e.symbol)?D(e.symbol)===null?5:4:D(e.symbol)===null?3:2:0}export{re as a,Z as b,ae as c};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
//# sourceMappingURL=chunk-NBNEVLRC.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as I}from"./chunk-LEHVP4DY.js";import{a as H}from"./chunk-2GLNBCHB.js";import{a as p}from"./chunk-CXWCLVYL.js";import{a as T}from"./chunk-VB2EZZPA.js";import{a as F}from"./chunk-FX6ULETZ.js";import{a as v}from"./chunk-5GXTUANY.js";import{a as k,b as G}from"./chunk-RXINFVBN.js";import{b as D}from"./chunk-GG5LHT27.js";import{a as S}from"./chunk-HRDSU5FN.js";import{a as j}from"./chunk-AZBELWZQ.js";import{a as w}from"./chunk-XRUGSM76.js";import{a as P}from"./chunk-WTY5FERW.js";import{a as A}from"./chunk-KZ4MG5NY.js";function X(t,e,n={}){let o=n.impactDepth??3,r=n.sliceDepth??3,l=n.semantic,s=!z(e),a=s?H(t,e,{semantic:l}):{definitions:[],referencedBy:[]},m=s?P(t,e,{semantic:l}):null,f=s?j(t,e,{semantic:l}):null,h=s?v(t,e,{semantic:l}):null,y=s?p(t,e,{direction:"backward",maxDepth:r,semantic:l}):null,R=s?p(t,e,{direction:"forward",maxDepth:r,semantic:l}):null,d=s?w(t,e,{maxDepth:o,scope:n.scope}):[],i=A(t,e,{semantic:l}),C=k(t,e),g=G(t,e),u=I(t,e),x=T(t,e),c={symbol:a.definitions.length>0||a.referencedBy.length>0||m!==null||f!==null||h!==null||y!==null||R!==null||d.length>0,file:i!==null||C.length>0||g.length>0,module:u.files.length>0||u.symbols.length>0||x.length>0},b=[];!c.symbol&&!c.file&&!c.module&&b.push("No symbol, file, or module matched target.");let B=i?.file??a.definitions[0]?.relativePath??null;return{target:e,matched:c,history:O(t,B),trace:a,callGraph:m,complexity:f,dataflow:h,backwardSlice:y,forwardSlice:R,affected:d,changeSurface:i,deps:C,rdeps:g,system:u,surface:x,warnings:b}}function O(t,e){let n={available:!1,file:e,churn:null,coChangePartners:[],suppressionsInFile:0};if(!e)return n;let o=S(t).fileChurn();if(!o)return n;let r=D(t,e,{limit:5});return{available:!0,file:e,churn:o.get(e)??{changes:0,fixChanges:0,lastChangedAt:0},coChangePartners:r.findings.map(l=>({file:l.fileA===e?l.fileB:l.fileA,together:l.together,confidence:l.confidence,subjectContext:l.subjectContext})),suppressionsInFile:F(t).byFile.get(e)??0}}function z(t){return t.includes("/")||t.includes("\\")||/\.[A-Za-z0-9]+(?::\d+(?:-\d+)?)?$/.test(t)}export{X as a};
|
|
2
|
+
//# sourceMappingURL=chunk-NTSR6SRP.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as u}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as u}from"./chunk-NBNEVLRC.js";import{a as c}from"./chunk-64MNV6AB.js";import{existsSync as m}from"fs";import{basename as p,isAbsolute as g,join as d}from"path";function S(t,r){let e=f(t,r,{allowMultiple:!1})[0]?.relativePath;return e||x(t,r)}function j(t,r){return f(t,r,{allowMultiple:!0}).map(e=>e.relativePath)}function x(t,r){if(!r)return null;let e=r.replace(/\\/g,"/").replace(/^\.\//,""),s=g(e)&&e.startsWith(t.config.projectRoot)?e.slice(t.config.projectRoot.length).replace(/^\/+/,""):e,i=d(t.config.projectRoot,s);return m(i)?s:null}function f(t,r,e){let s=h(r);if(!s)return[];let i=c(t,{includeIgnored:!1}).map(o=>({relativePath:o,score:v(o,s)})).filter(o=>o.score>0).sort((o,l)=>l.score-o.score||o.relativePath.localeCompare(l.relativePath));if(i.length===0){let o=u(t,r);return!o||t.isIgnored(o.relativePath)?[]:[{relativePath:o.relativePath,score:700}]}let n=i.filter(o=>o.score>=1100);if(n.length>0)return e.allowMultiple?n:[n[0]];let a=i.filter(o=>o.score>=800);return a.length>0?e.allowMultiple?a:[a[0]]:e.allowMultiple?i:[i[0]]}function v(t,r){let e=h(t),s=p(e),i=p(r),n=0;return e===r&&(n+=1200),e.endsWith(`/${r}`)&&(n+=1100),s===i&&(n+=900),e.startsWith(`${r}/`)&&(n+=850),e.includes(r)&&(n+=250),n}function h(t){return t.trim().replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"").replace(/\/+$/,"")}export{S as a,j as b};
|
|
2
|
+
//# sourceMappingURL=chunk-OFXN2BCT.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as d,b as m}from"./chunk-MNCQPMCH.js";import{c as u}from"./chunk-ELC77ZDE.js";import{a as c}from"./chunk-F6IXELII.js";function y(t,e={}){let{minSimilarity:o=.5,limit:l=20,scope:n,filePattern:p}=e,r=e.minDeps??(p?1:3),{profiles:i,distinctiveDeps:f}=D(t,{scope:n,minDeps:r}),s=d(i,a=>a.deps);return m({profiles:i,limit:l,filePattern:p,overrunFactor:5,candidateIndex:s,profile:{name:"similar-files"},compare:(a,g)=>P(a,g,o,f)})}function D(t,e){let{scope:o,minDeps:l}=e,n=c(t,o),{universalDeps:p,distinctiveDeps:r}=S(n),i=[];for(let[f,s]of n)s.size>=l&&i.push({file:f,deps:new Set([...s].filter(a=>!p.has(a)))});return{profiles:i,distinctiveDeps:r}}function S(t){let e=new Set,o=new Set,l=t.size;if(l===0)return{universalDeps:e,distinctiveDeps:o};let n=new Map;for(let r of t.values())for(let i of r)n.set(i,(n.get(i)??0)+1);let p=Math.max(3,Math.ceil(l*.03));for(let[r,i]of n)i>=5&&i/l>.3?e.add(r):i<=p&&o.add(r);return{universalDeps:e,distinctiveDeps:o}}function P(t,e,o,l){let n=new Set;for(let s of t.deps)e.deps.has(s)&&n.add(s);if(n.size<3||t.deps.size<4||e.deps.size<4)return null;let p=0;for(let s of n)l.has(s)&&p++;if(p<2)return null;let r=u(t.deps,e.deps);if(r<o)return null;let i=[];for(let s of t.deps)e.deps.has(s)||i.push(s);let f=[];for(let s of e.deps)t.deps.has(s)||f.push(s);return{fileA:t.file,fileB:e.file,similarity:r,sharedDeps:[...n],uniqueToA:i,uniqueToB:f}}export{y as a};
|
|
2
|
+
//# sourceMappingURL=chunk-PWAK75BU.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as b}from"./chunk-RSSXKJ6J.js";import{a as f}from"./chunk-NBNEVLRC.js";import{f as v}from"./chunk-63CI3IXR.js";import{d as r}from"./chunk-NABVR6B7.js";import{f as C}from"./chunk-THB6AM3V.js";function N(s,c,m,y={}){let n=f(s,c),o=f(s,m);if(!n||!o)return null;let d=b(s,n,{semantic:y.semantic}),p=b(s,o,{semantic:y.semantic}),A=d.filter(e=>!w(s,e)),B=p.filter(e=>!w(s,e)),S=A.length!==d.length||B.length!==p.length,g=new Set(A.map(e=>e.symbol)),h=new Set(B.map(e=>e.symbol)),a=[];for(let e of g)h.has(e)&&a.push(e);let l=[];for(let e of g)h.has(e)||l.push(e);let i=[];for(let e of h)g.has(e)||i.push(e);let u=new Set([...g,...h]),T=u.size>0?a.length/u.size:0,t;u.size===0?t="Neither function calls other tracked symbols. There is no callee-pattern evidence for consolidation; inspect the source bodies directly.":a.length===0?t="These functions do not share any callees. They are not a callee-based consolidation candidate.":l.length===0&&i.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.":l.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.":i.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.":l.length<=2&&i.length<=2?t=`Create a shared function with the ${a.length} common callees. Pass the ${l.length+i.length} divergent callees as parameters or strategy callbacks.`:t=`Extract the ${a.length} shared callees into a common helper. Each function calls the helper plus its own unique logic (${l.length} callees in A, ${i.length} in B).`,S&&(t=`Ignored Clojure macro scaffolding while comparing tracked callees. ${t}`);let q=n.endLine-n.startLine+1,D=o.endLine-o.startLine+1;return{symbolA:{symbol:n.symbol,shortName:r(n.symbol),file:n.relativePath,loc:q},symbolB:{symbol:o.symbol,shortName:r(o.symbol),file:o.relativePath,loc:D},similarity:T,sharedCallees:a.map(r),uniqueToA:l.map(r),uniqueToB:i.map(r),consolidationStrategy:t}}function w(s,c){return v(s,c.file).some(m=>m.symbol===c.symbol&&C(s,m))}export{N as a};
|
|
2
|
+
//# sourceMappingURL=chunk-Q5P7NOVM.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as ce}from"./chunk-
|
|
2
|
-
`).toLowerCase(),t=[],n=A(i,[".scipquery","declaredcouplings","suppression","suppressions","config","configuration","json"]);if(n.length>0)return t.push(`configuration/example terms near citation: ${n.join(", ")}`),{citationKind:"configuration-example",actionTier:"support",reasons:t};let o=A(i,["accepted","intentional","intentionally","retained","historical"]);if(o.length>0)return t.push(`intentional-record terms near citation: ${o.join(", ")}`),{citationKind:"intentional-record",actionTier:"support",reasons:t};let s=A(i,["command","cli","usage","example","run","workflow"]);return s.length>0?(t.push(`guide/reference terms near citation: ${s.join(", ")}`),{citationKind:"guide-reference",actionTier:"signal",reasons:t}):(t.push(e.length>0?"citation appears in prose without config or guide markers":"citation context unavailable"),{citationKind:"behavioral-claim",actionTier:"direct",reasons:t})}function ke(e,i,t){let n;try{n=fe(`${e.config.projectRoot}/${i}`,"utf-8").split(/\r?\n/)}catch{return[]}let o=t.flatMap(Re),s=[];for(let r=0;r<n.length;r+=1){let l=n[r]??"";o.some(a=>l.includes(a))&&s.push(W(n,r))}return s}function Re(e){let i=e.split("/");return[e,`./${e}`,i.slice(-3).join("/"),i.slice(-2).join("/")].filter((t,n,o)=>t.length>0&&o.indexOf(t)===n)}function Te(e){switch(e){case"behavioral-claim":return"a behavioral doc claim";case"configuration-example":return"a configuration example";case"guide-reference":return"a guide reference";case"intentional-record":return"an intentional record"}}function Fe(e,i){switch(e){case"behavioral-claim":return`Re-read ${i} and update the behavioral claim or citation.`;case"configuration-example":return`Verify the configuration example in ${i} still points at the intended file; update only if the example target changed.`;case"guide-reference":return`Verify the guide reference in ${i} still sends readers to the right implementation or command surface.`;case"intentional-record":return`Verify the intentional citation in ${i} is still meant to name this file.`}}function ve(e,i,t){let n=U(t),o=new Set;for(let s of i)xe(e,s,n.get(s)??[])&&o.add(s);return o}function xe(e,i,t){if(t.length===0)return!1;if(!Ae.test(i))return!0;let n=`${e.config.projectRoot}/${i}`;if(!De(n))return!0;let o=fe(n,"utf-8").split(/\r?\n/),s=Ge(o);for(let r of t)for(let l=r.startLine;l<=r.endLine;l+=1)if((o[l]??"").trim()!==""&&!s.has(l))return!0;return!1}var Ae=/\.(?:[cm]?[jt]sx?)$/i;function Ge(e){let i=new Set,t=!1;for(let n=0;n<e.length;n+=1){let o=e[n].trim();!t&&je(o)&&(t=!0),t&&(i.add(n),o.endsWith(";")&&(t=!1))}return i}function je(e){return/^import(?:\s|$)/.test(e)||/^export(?:\s+type)?\s+(?:\*|\{)/.test(e)}import{existsSync as
|
|
3
|
-
`),{path:n,findingCount:t.length}}function ue(e,i={}){let t=j(e,i.path);if(!Be(t))throw new Error(`No baseline found at ${t}. Create one with: scip-query health --write-baseline`);let n=JSON.parse(Ee(t,"utf-8")),o=new Set(n.findings??[]),s=de(e,{scope:i.scope}),r=new Set(s);return{baselinePath:t,baselineCount:o.size,current:s,newFindings:s.filter(l=>!o.has(l)),fixedFindings:[...o].filter(l=>!r.has(l))}}var ni=["echo","incomplete-migration","co-change-partner","doc-reference","unused-params","new-dead","baseline"];function oi(e,i={}){let t=i.base??"HEAD",{minTogether:n=6,minConfidence:o=.6,maxEchoChecks:s=Number.POSITIVE_INFINITY,maxHelpers:r=Number.POSITIVE_INFINITY,minSimilarity:l=.8,includeBaseline:a=!1,scanLimit:c}=i,y=i.semantic!==!1,h=new Set(i.skip??[]),f=q(e,{base:t}),p=V(e,{base:t,plan:f}),m=p.changedFiles,d=new Set(m),u=new Set(f.changedFileLines),b=new Set([...d,...u]),C=L(e.config.projectRoot,t,K(f,m)),R=mt(e.config.projectRoot,t,f,C),g={base:t,changedFiles:m,changedSymbols:p.changedSymbols.length,checksRun:[],skipped:[],suppressed:[],findings:[],rootCauseGroups:[],note:p.summary.note};if(m.length===0)return g;let $=(x,pe)=>{if(h.has(x)){g.skipped.push({check:x,reason:"skipped via --skip"});return}let ye=g.findings.length,be=g.skipped.length,Ce=g.checksRun.length;P(`diff-gate.check.${x}`,pe,()=>({check:x,changedFiles:m.length,changedSymbols:p.changedSymbols.length,findingsAdded:g.findings.length-ye,skippedAdded:g.skipped.length-be,checksRunAdded:g.checksRun.length-Ce}))};return $("echo",()=>Je(e,p.changedSymbols,d,R,s,l,c,y,g)),$("incomplete-migration",()=>rt(e,t,f,r,c,y,C,g)),$("co-change-partner",()=>st(e,b,n,o,g)),$("doc-reference",()=>dt(e,d,u,f.changedRanges,g)),$("unused-params",()=>ut(e,m,g)),$("new-dead",()=>ht(e,p.changedSymbols,R,g)),a&&$("baseline",()=>bt(e,g)),We(g,e.config.suppressions??[]),g.rootCauseGroups=Ue(g.findings),g}function Ue(e){let i=new Map;for(let t of e){let n=t.groupKey??`${t.check}:${t.id}`,o=i.get(n);o||(o={groupKey:n,check:t.check,severity:t.severity,actionTier:t.actionTier,sourceAnalyzer:t.sourceAnalyzer,rootCauseKey:t.rootCauseKey,count:0,findingIds:[],files:new Set,relatedFiles:new Set,message:t.message,remediation:t.remediation},i.set(n,o)),o.count+=1,o.findingIds.push(t.id),o.severity=Ve(o.severity,t.severity),o.actionTier=qe(o.actionTier,t.actionTier),t.file&&o.files.add(t.file);for(let s of t.relatedFiles??[])o.relatedFiles.add(s)}return[...i.values()].map(t=>({...t,files:[...t.files].sort(),relatedFiles:[...t.relatedFiles].sort()})).sort((t,n)=>n.count-t.count||B(n.severity)-B(t.severity)||t.groupKey.localeCompare(n.groupKey))}function Ve(e,i){return B(i)>B(e)?i:e}function B(e){return e==="error"?2:e==="warning"?1:0}function qe(e,i){return e?i&&he(i)>he(e)?i:e:i}function he(e){return e==="direct"?2:e==="signal"?1:0}function We(e,i){if(i.length===0||e.findings.length===0)return;let t=[];for(let n of e.findings){let o=i.find(s=>Ye(s,n));o?e.suppressed.push({finding:n,suppression:o}):t.push(n)}e.findings=t}function Ye(e,i){return!e.reason||e.reason.trim()===""||e.expiresAt&&Date.parse(e.expiresAt)<=Date.now()||e.id&&e.id!==i.id||e.check&&e.check!==i.check||e.file&&e.file!==i.file?!1:!!(e.id||e.check)}function k(e,i){e.findings.push({...i,suppressionHint:`scip-query: ignore ${i.check} ${i.id} -- <reason>`})}function Je(e,i,t,n,o,s,r,l,a){a.checksRun.push("echo");for(let c of i.slice(0,o)){if(!M(c.symbol)||n(c))continue;let y=ie(e,c.symbol,{minSimilarity:s,limit:5,scanLimit:r,semantic:l,sourceCandidateMode:"target-pruned"}),h=[];for(let d of y){let u=d.fileA===c.file?d.fileB:d.fileA,b=d.fileA===c.file?d.shortNameB:d.shortNameA,C=d.fileA===c.file?d.symbolB:d.symbolA;t.has(u)||h.push({otherFile:u,otherShort:b,otherSymbol:C,similarity:d.similarity,similarityBasis:d.similarityBasis??"callees",sharedEvidence:d.sharedCallees})}if(h.length===0)continue;let f=h[0],p=D("echo",c.symbol,c.file,...h.map(d=>`${d.otherSymbol}|${d.otherFile}`).sort()),m=Ze(c,h);k(a,{id:p,groupKey:p,actionTier:m,check:"echo",severity:"warning",evidence:"heuristic",confidence:f.similarity,file:c.file,symbol:c.symbol,relatedFiles:[...new Set(h.map(d=>d.otherFile))].sort(),message:it(c,h),why:nt(c,h),remediation:ot(m,c.shortName,f.otherShort)})}i.length>o&&a.skipped.push({check:"echo",reason:`echo check capped at ${o} of ${i.length} changed symbols`})}function Ze(e,i){return i.some(n=>Qe(e.symbol,n))?"direct":"signal"}function Qe(e,i){if(i.similarityBasis!=="source-tokens"||i.similarity<.98||i.sharedEvidence.length>8)return!1;let t=T(e),n=T(i.otherSymbol);return!t||!n?!1:t===n?!0:tt(i.sharedEvidence)?!1:Xe(t,n)}function Xe(e,i){let t=ge(e),n=ge(i);if(t.length===0||n.length===0)return!1;let o=new Set(n),s=t.filter(r=>o.has(r)).length;return s>=2&&s/Math.min(t.length,n.length)>=.5}function ge(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9]+/).map(i=>i.toLowerCase()).filter(i=>i.length>=2)}var et=new Set(["bytes","crypto","hex","num","random","secret","to","token"]);function tt(e){return e.length>=3&&e.every(i=>et.has(i.toLowerCase()))}function it(e,i){let t=i[0],n=Math.round(t.similarity*100);return i.length===1?`${e.shortName} (${e.file}) is ${n}% similar to established ${t.otherShort} (${t.otherFile})`:`${e.shortName} (${e.file}) resembles ${i.length} established symbol(s); strongest is ${n}% similar to ${t.otherShort} (${t.otherFile})`}function nt(e,i){let t=[`${e.shortName} was changed in this diff.`];for(let n of i.slice(0,3))t.push(`${n.otherShort} is outside this diff and scored ${Math.round(n.similarity*100)}% similar by ${n.similarityBasis} evidence.`),t.push(`Shared evidence: ${n.sharedEvidence.slice(0,5).join(", ")||"(none listed)"}.`);return i.length>3&&t.push(`${i.length-3} additional similar match(es) grouped into this finding.`),t}function ot(e,i,t){return e==="direct"?`Extract or reuse the shared behavior with ${t}, or keep the duplicate with a suppression reason.`:`Review whether ${i} is intentionally parallel to the established implementation(s); extract shared behavior only if the product semantics match.`}function rt(e,i,t,n,o,s,r,l){let a=ae(e,{base:i,maxHelpers:n,diffPlan:t,scanLimit:o,semantic:s,baseContentAt:r});if(!a.available){l.skipped.push({check:"incomplete-migration",reason:"no git history"});return}l.checksRun.push("incomplete-migration"),a.note&&l.skipped.push({check:"incomplete-migration",reason:a.note});for(let c of a.findings){let y=c.leftovers.map(u=>`${u.shortName} (${u.file}, ${Math.round(u.containment*100)}% helper / ${Math.round(u.siteCoverage*100)}% site, ${u.migrationScope})`).join(", "),h=c.leftovers.map(u=>`${u.shortName}: ${u.migrationScope} (${u.migrationScopeReasons[0]})`).join("; "),f=[...c.migratedFiles,...c.leftovers.map(u=>u.file)],p=c.leftovers.length===0?void 0:Math.max(...c.leftovers.map(u=>Math.min(u.containment,u.siteCoverage))),m=c.leftovers.some(u=>u.migrationScope==="possible-subtype"),d=D("incomplete-migration",c.helperSymbol,c.helperFile,f.join("|"));k(l,{id:d,check:"incomplete-migration",severity:"warning",evidence:"heuristic",confidence:p,file:c.helperFile,symbol:c.helperSymbol,relatedFiles:f,message:`new helper ${c.helperShortName} (${c.helperFile}) is wired into ${c.migratedFiles.length} file(s), but ${c.leftovers.length} similar un-migrated site(s) remain: ${y}`,why:[`${c.helperShortName} is new in this diff and already referenced by ${c.migratedFiles.join(", ")}.`,`Helper shape: ${c.helperShape}; ${c.specificHelperCalleeCount}/${c.helperCalleeCount} helper callees are specific enough to score.`,`Unchanged site(s) still contain the helper's callee pattern: ${y}.`,`Migration scope hints: ${h}.`],remediation:m?`Migrate same-scope sites to ${c.helperShortName}; review possible subtype/variant sites before applying the helper.`:`Migrate the remaining sites to ${c.helperShortName}, or confirm they are intentionally different.`})}}function st(e,i,t,n,o){let s=H(e,i,{minTogether:t,minConfidence:0,maxFilesPerCommit:20});if(!s){o.skipped.push({check:"co-change-partner",reason:"no git history"});return}o.checksRun.push("co-change-partner");let r=new Set,l;for(let a of s){let c=i.has(a.fileA),y=i.has(a.fileB);if(c===y)continue;let h=c?a.fileA:a.fileB,f=c?a.fileB:a.fileA,p=c?a.changesA:a.changesB,m=p>0?a.together/p:0;if(m<n||E(f)||E(h)||!me(`${e.config.projectRoot}/${f}`))continue;let d=`${h}|${f}`;if(r.has(d))continue;r.add(d);let u=D("co-change-partner",h,f,String(a.together)),b=_(h,f),C=z({fileA:h,fileB:f,together:a.together,confidence:m,commitScope:a.commitScope,recency:a.recency,subjectContext:a.subjectContext},b,(l??=O(e))(h,f)),R=[h,f].sort().join("|");o.findings.push({id:u,check:"co-change-partner",severity:"warning",evidence:"change-graph",actionTier:"signal",groupKey:`co-change-partner:${R}`,confidence:m,file:h,relatedFiles:[f],sourceAnalyzer:"co-change",rootCauseKey:R,partnerClass:b.partnerClass,partnerClassReasons:b.reasons,commitScope:a.commitScope,recency:a.recency,focusedTogether:a.focusedTogether,broadTogether:a.broadTogether,broadCommitRatio:a.broadCommitRatio,lastTogetherAt:a.lastTogetherAt,recentTogether:a.recentTogether,subjectContext:a.subjectContext,...C?{declaredCouplingSuggestion:C}:{},message:`${h} changed, but ${f} did not \u2014 they change together ${a.together}x (${Math.round(m*100)}% of the time)`,why:[`${h} is in this diff and ${f} is not.`,`Git history shows ${a.together} co-change(s), which is ${Math.round(m*100)}% of changes to the edited side.`,`History context: ${at(a)}.`,`Subject context: ${ct(a.subjectContext)}.`,...lt(a),`Partner class: ${b.partnerClass} (${b.reasons.join("; ")}).`],remediation:C?`Update ${f} alongside this change, declare the coupling "${C.name}", or confirm the coupling no longer holds.`:`Update ${f} alongside this change, or confirm the coupling no longer holds.`})}}function at(e){return`${e.commitScope}/${e.recency}; ${e.focusedTogether} focused, ${e.broadTogether} broad-sweep (${Math.round(e.broadCommitRatio*100)}% broad), ${e.recentTogether} recent, last ${ft(e.lastTogetherAt)}`}function ct(e){let i=e.subjectLabels.length>0?e.subjectLabels.slice(0,5).join(", "):"none inferred",t=e.issueRefs.length>0?e.issueRefs.slice(0,5).join(", "):"none",n=e.sampleSubjects.length>0?e.sampleSubjects.slice(0,3).map(o=>`"${o}"`).join("; "):"none";return`labels ${i}; refs ${t}; samples ${n}; external issue/PR labels ${e.externalIssueLabelStatus}`}function lt(e){let i=[];return e.commitScope==="broad-sweep"&&i.push("Broad-sweep history is weaker than focused co-edits; confirm this is a real coordination contract."),e.recency==="stale"&&i.push("The pair has no co-change in the recent history window; confirm the coupling still holds."),i}function ft(e){return e<=0?"unknown":new Date(e*1e3).toISOString().slice(0,10)}function dt(e,i,t,n,o){o.checksRun.push("doc-reference");let s=w.referenceTargets(e,i,n);if(s.size!==0)for(let r of Y(e,s)){if(t.has(r.doc))continue;let l=r.citedClaims.length>0?r.citedClaims:w.citationContexts(e,r.doc,r.cited),a=w.classifyCitation(l),c=D("doc-reference",r.doc,r.cited.join("|"));k(o,{id:c,check:"doc-reference",severity:"warning",evidence:"change-graph",actionTier:a.actionTier,confidence:1,file:r.doc,relatedFiles:r.cited,citationKind:a.citationKind,citationKindReasons:a.reasons,citedClaims:l,message:`${r.doc} cites ${r.cited.join(", ")} as ${w.citationKindLabel(a.citationKind)} \u2014 changed in this diff, doc untouched`,why:[`${r.cited.join(", ")} changed in this diff.`,`${r.doc} cites the changed file(s) but was not updated in the same diff.`,...a.reasons.map(y=>`Citation kind evidence: ${y}`)],remediation:w.citationRemediation(a.citationKind,r.doc)})}}function ut(e,i,t){t.checksRun.push("unused-params");for(let n of ce(e,{files:i,limit:50})){let o=D("unused-params",n.symbol,n.file,n.unusedTrailing.join("|"));k(t,{id:o,check:"unused-params",severity:"warning",evidence:"heuristic",confidence:.85,file:n.file,startLine:n.startLine,endLine:n.endLine,symbol:n.symbol,message:`${n.shortName} (${n.file}) has trailing unused parameter(s): ${n.unusedTrailing.join(", ")}`,why:[`${n.shortName} is in a changed file.`,`The trailing parameter(s) ${n.unusedTrailing.join(", ")} are not referenced in the function body.`],remediation:"Drop the unused trailing parameters and their call-site arguments."})}}function ht(e,i,t,n){n.checksRun.push("new-dead");let o=new I(e);for(let s of i){if(t(s)||s.fanIn>0||o.fileKind(s.file)==="test"||F(e,s.file)||v(e,s.symbol,s.file)||gt(s.symbol))continue;let r=D("new-dead",s.symbol,s.file);k(n,{id:r,check:"new-dead",severity:"warning",evidence:"graph-fact",confidence:.9,file:s.file,symbol:s.symbol,message:`${s.shortName} (${s.file}) was changed but has zero indexed consumers`,why:[`${s.shortName} is a changed production symbol.`,"The index reports zero consumers for this symbol.","The symbol is not in a detected entry surface or configured live root."],remediation:"Wire it up, or remove it before it becomes permanent dead code."})}}function gt(e){if(N(e)!=="type")return!1;let i=T(e);return i.startsWith("_Assert")||i.startsWith("Assert")}function mt(e,i,t,n){let o=new Map(t.renamedFiles.map(r=>[r.to,r.from])),s=n??L(e,i,K(t));return r=>{let l=o.get(r.file)??r.file,a=T(r.symbol);if(!a)return!1;let c=s(l);return c!==null&&pt(c,a)}}function pt(e,i){return new RegExp(`\\b${yt(i)}\\b`).test(e)}function yt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function bt(e,i){if(!me(j(e))){i.skipped.push({check:"baseline",reason:"no .scipquery-baseline.json \u2014 run health --write-baseline to enable"});return}i.checksRun.push("baseline");let t=ue(e);for(let n of t.newFindings){let o=le(n),s=D("baseline",n);k(i,{id:s,groupKey:`baseline:${o.sourceAnalyzer}:${o.rootCauseKey}`,check:"baseline",severity:"error",evidence:"baseline",actionTier:o.actionTier,confidence:1,file:o.file,relatedFiles:o.relatedFiles.length>0?o.relatedFiles:void 0,sourceAnalyzer:o.sourceAnalyzer,rootCauseKey:o.rootCauseKey,message:`new ${o.label} vs committed baseline: ${n}`,why:["A committed health baseline exists.","The current health result contains a finding not present in that baseline.",`Underlying analyzer: ${o.sourceAnalyzer}.`,`Inherited action tier: ${o.actionTier}.`,`Root cause key: ${o.rootCauseKey}.`,...o.why],remediation:o.remediation})}}function D(e,...i){return`SQ${Oe("sha256").update([e,...i].join("\0")).digest("hex").slice(0,12).toUpperCase()}`}export{de as a,Pt as b,ue as c,ni as d,oi as e,mt as f};
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as ce}from"./chunk-XHMVZFA6.js";import{a as ae}from"./chunk-7XTO4YXB.js";import{a as S}from"./chunk-B32FX5KB.js";import{a as se}from"./chunk-RUV5IY25.js";import{a as oe}from"./chunk-T3AEVJBG.js";import{a as re}from"./chunk-C2QSK7E7.js";import{a as ie,c as ne}from"./chunk-Z2LDWIJV.js";import{a as ee}from"./chunk-JJ5SAWBT.js";import{a as te}from"./chunk-ZNWWVYQL.js";import{a as X}from"./chunk-GKB4JJDU.js";import{a as U,c as V,d as q,h as L,i as K}from"./chunk-T4N2ZRVY.js";import{a as W,b as A,e as Y}from"./chunk-MYTUWXHK.js";import{a as Q}from"./chunk-62ULXMQ7.js";import{b as Z}from"./chunk-ROGZXWN2.js";import{a as B,c as _,d as z,e as O}from"./chunk-GG5LHT27.js";import{a as H}from"./chunk-HRDSU5FN.js";import{a as J}from"./chunk-FMGVZBS2.js";import{a as I}from"./chunk-RM2WQ75T.js";import{f as F,g as v}from"./chunk-WUOB4DHH.js";import{b as N}from"./chunk-ULHLDOD6.js";import{e as T,f as P,g as M}from"./chunk-NABVR6B7.js";import{createHash as Oe}from"crypto";import{existsSync as me}from"fs";function le(e){let[i,t]=G(e,":"),n=i||"unknown",o=(s={})=>{let r=s.actionTier??Se(n);return{sourceAnalyzer:n,actionTier:r,rootCauseKey:s.rootCauseKey??(t||e),label:s.label??`${n} finding`,relatedFiles:s.relatedFiles??[],why:s.why??[],remediation:s.remediation??$e(r,n),file:s.file}};if(!t)return o({rootCauseKey:e,why:["Baseline identity did not include analyzer payload."]});if(["dead","isolated","extract","wrapper","passthrough","stale"].includes(n)){let[s,r]=G(t,":");return o({file:s,relatedFiles:s?[s]:[],rootCauseKey:r?`${s}:${r}`:t,label:`${n} finding`,why:r?[`Baseline subject: ${r}.`]:[]})}if(n==="cycle"){let s=t.split(">").filter(Boolean);return o({relatedFiles:s,rootCauseKey:t,label:"cycle finding",why:s.length>0?[`Cycle path: ${s.join(" > ")}.`]:[]})}if(n==="similar"){let s=t.split("|").filter(Boolean);return o({relatedFiles:[],rootCauseKey:t,label:"similarity finding",why:s.length>0?[`Similar symbols: ${s.join(" | ")}.`]:[]})}if(n==="drift"){let[s,r]=G(t,":"),[l,a]=G(r,":");return o({actionTier:s==="unused-import"?"direct":"signal",file:l,relatedFiles:[...new Set([l,a].filter(Boolean))],rootCauseKey:t,label:`${s||"drift"} finding`,why:[...s?[`Drift kind: ${s}.`]:[],...a?[`Related dependency: ${a}.`]:[]]})}return o({why:["Baseline analyzer prefix is not recognized by this diff-gate version."]})}function Se(e){switch(e){case"dead":case"isolated":case"cycle":case"passthrough":return"direct";case"similar":case"extract":case"wrapper":case"stale":return"signal";default:return"signal"}}function $e(e,i){return e==="direct"?`Fix the new ${i} baseline finding, or knowingly accept it via health --write-baseline.`:`Review the new ${i} baseline signal; fix it if it reflects real debt, or knowingly accept it via health --write-baseline.`}function G(e,i){let t=e.indexOf(i);return t<0?[e,""]:[e.slice(0,t),e.slice(t+i.length)]}import{existsSync as De,readFileSync as fe}from"fs";var w={classifyCitation:we,citationContexts:ke,citationKindLabel:Te,citationRemediation:Fe,referenceTargets:ve};function we(e){let i=e.join(`
|
|
2
|
+
`).toLowerCase(),t=[],n=A(i,[".scipquery","declaredcouplings","suppression","suppressions","config","configuration","json"]);if(n.length>0)return t.push(`configuration/example terms near citation: ${n.join(", ")}`),{citationKind:"configuration-example",actionTier:"support",reasons:t};let o=A(i,["accepted","intentional","intentionally","retained","historical"]);if(o.length>0)return t.push(`intentional-record terms near citation: ${o.join(", ")}`),{citationKind:"intentional-record",actionTier:"support",reasons:t};let s=A(i,["command","cli","usage","example","run","workflow"]);return s.length>0?(t.push(`guide/reference terms near citation: ${s.join(", ")}`),{citationKind:"guide-reference",actionTier:"signal",reasons:t}):(t.push(e.length>0?"citation appears in prose without config or guide markers":"citation context unavailable"),{citationKind:"behavioral-claim",actionTier:"direct",reasons:t})}function ke(e,i,t){let n;try{n=fe(`${e.config.projectRoot}/${i}`,"utf-8").split(/\r?\n/)}catch{return[]}let o=t.flatMap(Re),s=[];for(let r=0;r<n.length;r+=1){let l=n[r]??"";o.some(a=>l.includes(a))&&s.push(W(n,r))}return s}function Re(e){let i=e.split("/");return[e,`./${e}`,i.slice(-3).join("/"),i.slice(-2).join("/")].filter((t,n,o)=>t.length>0&&o.indexOf(t)===n)}function Te(e){switch(e){case"behavioral-claim":return"a behavioral doc claim";case"configuration-example":return"a configuration example";case"guide-reference":return"a guide reference";case"intentional-record":return"an intentional record"}}function Fe(e,i){switch(e){case"behavioral-claim":return`Re-read ${i} and update the behavioral claim or citation.`;case"configuration-example":return`Verify the configuration example in ${i} still points at the intended file; update only if the example target changed.`;case"guide-reference":return`Verify the guide reference in ${i} still sends readers to the right implementation or command surface.`;case"intentional-record":return`Verify the intentional citation in ${i} is still meant to name this file.`}}function ve(e,i,t){let n=U(t),o=new Set;for(let s of i)xe(e,s,n.get(s)??[])&&o.add(s);return o}function xe(e,i,t){if(t.length===0)return!1;if(!Ae.test(i))return!0;let n=`${e.config.projectRoot}/${i}`;if(!De(n))return!0;let o=fe(n,"utf-8").split(/\r?\n/),s=Ge(o);for(let r of t)for(let l=r.startLine;l<=r.endLine;l+=1)if((o[l]??"").trim()!==""&&!s.has(l))return!0;return!1}var Ae=/\.(?:[cm]?[jt]sx?)$/i;function Ge(e){let i=new Set,t=!1;for(let n=0;n<e.length;n+=1){let o=e[n].trim();!t&&je(o)&&(t=!0),t&&(i.add(n),o.endsWith(";")&&(t=!1))}return i}function je(e){return/^import(?:\s|$)/.test(e)||/^export(?:\s+type)?\s+(?:\*|\{)/.test(e)}import{existsSync as Ee,readFileSync as Be,writeFileSync as Le}from"fs";import{isAbsolute as Ke,join as Ne}from"path";var Pe=25e3,Me=2500,Ie=2500;function He(e){let i=re(e);return i.symbols>=Pe||i.documents>=Me?Ie:void 0}var _e=".scipquery-baseline.json";function j(e,i){return i&&Ke(i)?i:Ne(e.config.projectRoot,i??_e)}function de(e,i={}){let{scope:t}=i,n=He(e),o=[],s=Z(e,{scope:t,...S.dead,scanLimit:n});for(let r of s.symbols)F(e,r.relativePath)||v(e,r.symbol,r.relativePath)||r.kind==="dead-code"&&o.push(`dead:${r.relativePath}:${r.shortName}`);for(let r of ee(e,{scope:t,...S.isolated,scanLimit:n}))F(e,r.relativePath)||v(e,r.symbol,r.relativePath)||o.push(`isolated:${r.relativePath}:${r.shortName}`);for(let r of J(e,{scope:t}))r.kind==="real"&&o.push(`cycle:${ze(r.path)}`);for(let r of ne(e,{scope:t,...S.similar,scanLimit:n}))o.push(`similar:${[r.symbolA,r.symbolB].sort().join("|")}`);for(let r of X(e,{scope:t,...S.extract,scanLimit:n}))o.push(`extract:${r.relativePath}:${r.shortName}`);for(let r of se(e,{scope:t,...S.wrappers,scanLimit:n}))o.push(`wrapper:${r.file}:${r.shortName}`);for(let r of te(e,{scope:t,...S.passthroughs,scanLimit:n}))o.push(`passthrough:${r.file}:${r.shortName}`);for(let r of oe(e,{scope:t,...S.stale,scanLimit:n}))o.push(`stale:${r.file}:${r.shortName}`);for(let r of Q(e,{scope:t,...S.drift,includePatternDeviations:!1}).results)o.push(`drift:${r.kind}:${r.file}:${r.dep}`);return[...new Set(o)].sort()}function ze(e){if(e.length===0)return"";let i=0;for(let t=1;t<e.length;t++)e[t]<e[i]&&(i=t);return[...e.slice(i),...e.slice(0,i)].join(">")}function Mt(e,i={}){let t=de(e,{scope:i.scope}),n=j(e,i.path);return Le(n,JSON.stringify({version:1,findings:t},null,2)+`
|
|
3
|
+
`),{path:n,findingCount:t.length}}function ue(e,i={}){let t=j(e,i.path);if(!Ee(t))throw new Error(`No baseline found at ${t}. Create one with: scip-query health --write-baseline`);let n=JSON.parse(Be(t,"utf-8")),o=new Set(n.findings??[]),s=de(e,{scope:i.scope}),r=new Set(s);return{baselinePath:t,baselineCount:o.size,current:s,newFindings:s.filter(l=>!o.has(l)),fixedFindings:[...o].filter(l=>!r.has(l))}}var ni=["echo","incomplete-migration","co-change-partner","doc-reference","unused-params","new-dead","baseline"];function oi(e,i={}){let t=i.base??"HEAD",{minTogether:n=6,minConfidence:o=.6,maxEchoChecks:s=Number.POSITIVE_INFINITY,maxHelpers:r=Number.POSITIVE_INFINITY,minSimilarity:l=.8,includeBaseline:a=!1,scanLimit:c}=i,y=i.semantic!==!1,h=new Set(i.skip??[]),f=q(e,{base:t}),p=V(e,{base:t,plan:f}),m=p.changedFiles,d=new Set(m),u=new Set(f.changedFileLines),b=new Set([...d,...u]),C=L(e.config.projectRoot,t,K(f,m)),R=mt(e.config.projectRoot,t,f,C),g={base:t,changedFiles:m,changedSymbols:p.changedSymbols.length,checksRun:[],skipped:[],suppressed:[],findings:[],rootCauseGroups:[],note:p.summary.note};if(m.length===0)return g;let $=(x,pe)=>{if(h.has(x)){g.skipped.push({check:x,reason:"skipped via --skip"});return}let ye=g.findings.length,be=g.skipped.length,Ce=g.checksRun.length;N(`diff-gate.check.${x}`,pe,()=>({check:x,changedFiles:m.length,changedSymbols:p.changedSymbols.length,findingsAdded:g.findings.length-ye,skippedAdded:g.skipped.length-be,checksRunAdded:g.checksRun.length-Ce}))};return $("echo",()=>Je(e,p.changedSymbols,d,R,s,l,c,y,g)),$("incomplete-migration",()=>rt(e,t,f,r,c,y,C,g)),$("co-change-partner",()=>st(e,b,n,o,g)),$("doc-reference",()=>dt(e,d,u,f.changedRanges,g)),$("unused-params",()=>ut(e,m,g)),$("new-dead",()=>ht(e,p.changedSymbols,R,g)),a&&$("baseline",()=>bt(e,g)),We(g,e.config.suppressions??[]),g.rootCauseGroups=Ue(g.findings),g}function Ue(e){let i=new Map;for(let t of e){let n=t.groupKey??`${t.check}:${t.id}`,o=i.get(n);o||(o={groupKey:n,check:t.check,severity:t.severity,actionTier:t.actionTier,sourceAnalyzer:t.sourceAnalyzer,rootCauseKey:t.rootCauseKey,count:0,findingIds:[],files:new Set,relatedFiles:new Set,message:t.message,remediation:t.remediation},i.set(n,o)),o.count+=1,o.findingIds.push(t.id),o.severity=Ve(o.severity,t.severity),o.actionTier=qe(o.actionTier,t.actionTier),t.file&&o.files.add(t.file);for(let s of t.relatedFiles??[])o.relatedFiles.add(s)}return[...i.values()].map(t=>({...t,files:[...t.files].sort(),relatedFiles:[...t.relatedFiles].sort()})).sort((t,n)=>n.count-t.count||E(n.severity)-E(t.severity)||t.groupKey.localeCompare(n.groupKey))}function Ve(e,i){return E(i)>E(e)?i:e}function E(e){return e==="error"?2:e==="warning"?1:0}function qe(e,i){return e?i&&he(i)>he(e)?i:e:i}function he(e){return e==="direct"?2:e==="signal"?1:0}function We(e,i){if(i.length===0||e.findings.length===0)return;let t=[];for(let n of e.findings){let o=i.find(s=>Ye(s,n));o?e.suppressed.push({finding:n,suppression:o}):t.push(n)}e.findings=t}function Ye(e,i){return!e.reason||e.reason.trim()===""||e.expiresAt&&Date.parse(e.expiresAt)<=Date.now()||e.id&&e.id!==i.id||e.check&&e.check!==i.check||e.file&&e.file!==i.file?!1:!!(e.id||e.check)}function k(e,i){e.findings.push({...i,suppressionHint:`scip-query: ignore ${i.check} ${i.id} -- <reason>`})}function Je(e,i,t,n,o,s,r,l,a){a.checksRun.push("echo");for(let c of i.slice(0,o)){if(!M(c.symbol)||n(c))continue;let y=ie(e,c.symbol,{minSimilarity:s,limit:5,scanLimit:r,semantic:l,sourceCandidateMode:"target-pruned"}),h=[];for(let d of y){let u=d.fileA===c.file?d.fileB:d.fileA,b=d.fileA===c.file?d.shortNameB:d.shortNameA,C=d.fileA===c.file?d.symbolB:d.symbolA;t.has(u)||h.push({otherFile:u,otherShort:b,otherSymbol:C,similarity:d.similarity,similarityBasis:d.similarityBasis??"callees",sharedEvidence:d.sharedCallees})}if(h.length===0)continue;let f=h[0],p=D("echo",c.symbol,c.file,...h.map(d=>`${d.otherSymbol}|${d.otherFile}`).sort()),m=Ze(c,h);k(a,{id:p,groupKey:p,actionTier:m,check:"echo",severity:"warning",evidence:"heuristic",confidence:f.similarity,file:c.file,symbol:c.symbol,relatedFiles:[...new Set(h.map(d=>d.otherFile))].sort(),message:it(c,h),why:nt(c,h),remediation:ot(m,c.shortName,f.otherShort)})}i.length>o&&a.skipped.push({check:"echo",reason:`echo check capped at ${o} of ${i.length} changed symbols`})}function Ze(e,i){return i.some(n=>Qe(e.symbol,n))?"direct":"signal"}function Qe(e,i){if(i.similarityBasis!=="source-tokens"||i.similarity<.98||i.sharedEvidence.length>8)return!1;let t=T(e),n=T(i.otherSymbol);return!t||!n?!1:t===n?!0:tt(i.sharedEvidence)?!1:Xe(t,n)}function Xe(e,i){let t=ge(e),n=ge(i);if(t.length===0||n.length===0)return!1;let o=new Set(n),s=t.filter(r=>o.has(r)).length;return s>=2&&s/Math.min(t.length,n.length)>=.5}function ge(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9]+/).map(i=>i.toLowerCase()).filter(i=>i.length>=2)}var et=new Set(["bytes","crypto","hex","num","random","secret","to","token"]);function tt(e){return e.length>=3&&e.every(i=>et.has(i.toLowerCase()))}function it(e,i){let t=i[0],n=Math.round(t.similarity*100);return i.length===1?`${e.shortName} (${e.file}) is ${n}% similar to established ${t.otherShort} (${t.otherFile})`:`${e.shortName} (${e.file}) resembles ${i.length} established symbol(s); strongest is ${n}% similar to ${t.otherShort} (${t.otherFile})`}function nt(e,i){let t=[`${e.shortName} was changed in this diff.`];for(let n of i.slice(0,3))t.push(`${n.otherShort} is outside this diff and scored ${Math.round(n.similarity*100)}% similar by ${n.similarityBasis} evidence.`),t.push(`Shared evidence: ${n.sharedEvidence.slice(0,5).join(", ")||"(none listed)"}.`);return i.length>3&&t.push(`${i.length-3} additional similar match(es) grouped into this finding.`),t}function ot(e,i,t){return e==="direct"?`Extract or reuse the shared behavior with ${t}, or keep the duplicate with a suppression reason.`:`Review whether ${i} is intentionally parallel to the established implementation(s); extract shared behavior only if the product semantics match.`}function rt(e,i,t,n,o,s,r,l){let a=ae(e,{base:i,maxHelpers:n,diffPlan:t,scanLimit:o,semantic:s,baseContentAt:r});if(!a.available){l.skipped.push({check:"incomplete-migration",reason:"no git history"});return}l.checksRun.push("incomplete-migration"),a.note&&l.skipped.push({check:"incomplete-migration",reason:a.note});for(let c of a.findings){let y=c.leftovers.map(u=>`${u.shortName} (${u.file}, ${Math.round(u.containment*100)}% helper / ${Math.round(u.siteCoverage*100)}% site, ${u.migrationScope})`).join(", "),h=c.leftovers.map(u=>`${u.shortName}: ${u.migrationScope} (${u.migrationScopeReasons[0]})`).join("; "),f=[...c.migratedFiles,...c.leftovers.map(u=>u.file)],p=c.leftovers.length===0?void 0:Math.max(...c.leftovers.map(u=>Math.min(u.containment,u.siteCoverage))),m=c.leftovers.some(u=>u.migrationScope==="possible-subtype"),d=D("incomplete-migration",c.helperSymbol,c.helperFile,f.join("|"));k(l,{id:d,check:"incomplete-migration",severity:"warning",evidence:"heuristic",confidence:p,file:c.helperFile,symbol:c.helperSymbol,relatedFiles:f,message:`new helper ${c.helperShortName} (${c.helperFile}) is wired into ${c.migratedFiles.length} file(s), but ${c.leftovers.length} similar un-migrated site(s) remain: ${y}`,why:[`${c.helperShortName} is new in this diff and already referenced by ${c.migratedFiles.join(", ")}.`,`Helper shape: ${c.helperShape}; ${c.specificHelperCalleeCount}/${c.helperCalleeCount} helper callees are specific enough to score.`,`Unchanged site(s) still contain the helper's callee pattern: ${y}.`,`Migration scope hints: ${h}.`],remediation:m?`Migrate same-scope sites to ${c.helperShortName}; review possible subtype/variant sites before applying the helper.`:`Migrate the remaining sites to ${c.helperShortName}, or confirm they are intentionally different.`})}}function st(e,i,t,n,o){let s=H(e).directionalCoChangePairsForFiles(i,{minTogether:t,minConfidence:0,maxFilesPerCommit:20});if(!s){o.skipped.push({check:"co-change-partner",reason:"no git history"});return}o.checksRun.push("co-change-partner");let r=new Set,l;for(let a of s){let c=i.has(a.fileA),y=i.has(a.fileB);if(c===y)continue;let h=c?a.fileA:a.fileB,f=c?a.fileB:a.fileA,p=c?a.changesA:a.changesB,m=p>0?a.together/p:0;if(m<n||B(f)||B(h)||!me(`${e.config.projectRoot}/${f}`))continue;let d=`${h}|${f}`;if(r.has(d))continue;r.add(d);let u=D("co-change-partner",h,f,String(a.together)),b=_(h,f),C=z({fileA:h,fileB:f,together:a.together,confidence:m,commitScope:a.commitScope,recency:a.recency,subjectContext:a.subjectContext},b,(l??=O(e))(h,f)),R=[h,f].sort().join("|");o.findings.push({id:u,check:"co-change-partner",severity:"warning",evidence:"change-graph",actionTier:"signal",groupKey:`co-change-partner:${R}`,confidence:m,file:h,relatedFiles:[f],sourceAnalyzer:"co-change",rootCauseKey:R,partnerClass:b.partnerClass,partnerClassReasons:b.reasons,commitScope:a.commitScope,recency:a.recency,focusedTogether:a.focusedTogether,broadTogether:a.broadTogether,broadCommitRatio:a.broadCommitRatio,lastTogetherAt:a.lastTogetherAt,recentTogether:a.recentTogether,subjectContext:a.subjectContext,...C?{declaredCouplingSuggestion:C}:{},message:`${h} changed, but ${f} did not \u2014 they change together ${a.together}x (${Math.round(m*100)}% of the time)`,why:[`${h} is in this diff and ${f} is not.`,`Git history shows ${a.together} co-change(s), which is ${Math.round(m*100)}% of changes to the edited side.`,`History context: ${at(a)}.`,`Subject context: ${ct(a.subjectContext)}.`,...lt(a),`Partner class: ${b.partnerClass} (${b.reasons.join("; ")}).`],remediation:C?`Update ${f} alongside this change, declare the coupling "${C.name}", or confirm the coupling no longer holds.`:`Update ${f} alongside this change, or confirm the coupling no longer holds.`})}}function at(e){return`${e.commitScope}/${e.recency}; ${e.focusedTogether} focused, ${e.broadTogether} broad-sweep (${Math.round(e.broadCommitRatio*100)}% broad), ${e.recentTogether} recent, last ${ft(e.lastTogetherAt)}`}function ct(e){let i=e.subjectLabels.length>0?e.subjectLabels.slice(0,5).join(", "):"none inferred",t=e.issueRefs.length>0?e.issueRefs.slice(0,5).join(", "):"none",n=e.sampleSubjects.length>0?e.sampleSubjects.slice(0,3).map(o=>`"${o}"`).join("; "):"none";return`labels ${i}; refs ${t}; samples ${n}; external issue/PR labels ${e.externalIssueLabelStatus}`}function lt(e){let i=[];return e.commitScope==="broad-sweep"&&i.push("Broad-sweep history is weaker than focused co-edits; confirm this is a real coordination contract."),e.recency==="stale"&&i.push("The pair has no co-change in the recent history window; confirm the coupling still holds."),i}function ft(e){return e<=0?"unknown":new Date(e*1e3).toISOString().slice(0,10)}function dt(e,i,t,n,o){o.checksRun.push("doc-reference");let s=w.referenceTargets(e,i,n);if(s.size!==0)for(let r of Y(e,s)){if(t.has(r.doc))continue;let l=r.citedClaims.length>0?r.citedClaims:w.citationContexts(e,r.doc,r.cited),a=w.classifyCitation(l),c=D("doc-reference",r.doc,r.cited.join("|"));k(o,{id:c,check:"doc-reference",severity:"warning",evidence:"change-graph",actionTier:a.actionTier,confidence:1,file:r.doc,relatedFiles:r.cited,citationKind:a.citationKind,citationKindReasons:a.reasons,citedClaims:l,message:`${r.doc} cites ${r.cited.join(", ")} as ${w.citationKindLabel(a.citationKind)} \u2014 changed in this diff, doc untouched`,why:[`${r.cited.join(", ")} changed in this diff.`,`${r.doc} cites the changed file(s) but was not updated in the same diff.`,...a.reasons.map(y=>`Citation kind evidence: ${y}`)],remediation:w.citationRemediation(a.citationKind,r.doc)})}}function ut(e,i,t){t.checksRun.push("unused-params");for(let n of ce(e,{files:i,limit:50})){let o=D("unused-params",n.symbol,n.file,n.unusedTrailing.join("|"));k(t,{id:o,check:"unused-params",severity:"warning",evidence:"heuristic",confidence:.85,file:n.file,startLine:n.startLine,endLine:n.endLine,symbol:n.symbol,message:`${n.shortName} (${n.file}) has trailing unused parameter(s): ${n.unusedTrailing.join(", ")}`,why:[`${n.shortName} is in a changed file.`,`The trailing parameter(s) ${n.unusedTrailing.join(", ")} are not referenced in the function body.`],remediation:"Drop the unused trailing parameters and their call-site arguments."})}}function ht(e,i,t,n){n.checksRun.push("new-dead");let o=new I(e);for(let s of i){if(t(s)||s.fanIn>0||o.fileKind(s.file)==="test"||F(e,s.file)||v(e,s.symbol,s.file)||gt(s.symbol))continue;let r=D("new-dead",s.symbol,s.file);k(n,{id:r,check:"new-dead",severity:"warning",evidence:"graph-fact",confidence:.9,file:s.file,symbol:s.symbol,message:`${s.shortName} (${s.file}) was changed but has zero indexed consumers`,why:[`${s.shortName} is a changed production symbol.`,"The index reports zero consumers for this symbol.","The symbol is not in a detected entry surface or configured live root."],remediation:"Wire it up, or remove it before it becomes permanent dead code."})}}function gt(e){if(P(e)!=="type")return!1;let i=T(e);return i.startsWith("_Assert")||i.startsWith("Assert")}function mt(e,i,t,n){let o=new Map(t.renamedFiles.map(r=>[r.to,r.from])),s=n??L(e,i,K(t));return r=>{let l=o.get(r.file)??r.file,a=T(r.symbol);if(!a)return!1;let c=s(l);return c!==null&&pt(c,a)}}function pt(e,i){return new RegExp(`\\b${yt(i)}\\b`).test(e)}function yt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function bt(e,i){if(!me(j(e))){i.skipped.push({check:"baseline",reason:"no .scipquery-baseline.json \u2014 run health --write-baseline to enable"});return}i.checksRun.push("baseline");let t=ue(e);for(let n of t.newFindings){let o=le(n),s=D("baseline",n);k(i,{id:s,groupKey:`baseline:${o.sourceAnalyzer}:${o.rootCauseKey}`,check:"baseline",severity:"error",evidence:"baseline",actionTier:o.actionTier,confidence:1,file:o.file,relatedFiles:o.relatedFiles.length>0?o.relatedFiles:void 0,sourceAnalyzer:o.sourceAnalyzer,rootCauseKey:o.rootCauseKey,message:`new ${o.label} vs committed baseline: ${n}`,why:["A committed health baseline exists.","The current health result contains a finding not present in that baseline.",`Underlying analyzer: ${o.sourceAnalyzer}.`,`Inherited action tier: ${o.actionTier}.`,`Root cause key: ${o.rootCauseKey}.`,...o.why],remediation:o.remediation})}}function D(e,...i){return`SQ${Oe("sha256").update([e,...i].join("\0")).digest("hex").slice(0,12).toUpperCase()}`}export{de as a,Mt as b,ue as c,ni as d,oi as e,mt as f};
|
|
4
|
+
//# sourceMappingURL=chunk-RGKRYO22.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as D,f as H,g as O}from"./chunk-WUOB4DHH.js";import{a as x}from"./chunk-BGBBVSH4.js";import{b as X,c as Z,d as $}from"./chunk-L446VQYQ.js";import{c as U}from"./chunk-RSSXKJ6J.js";import{a as _,k as z,l as J,n as N,o as Q}from"./chunk-UQ73QF5D.js";import{a as B}from"./chunk-F6IXELII.js";import{b as K}from"./chunk-ULHLDOD6.js";import{f as I,h as W,i as Y,j as P}from"./chunk-63CI3IXR.js";import{a as j,g as k,h as T,j as V,k as G}from"./chunk-NABVR6B7.js";import{j as F}from"./chunk-THB6AM3V.js";import{a as w,d as h,e as R,f as A}from"./chunk-SA3DPTHT.js";import{c as E}from"./chunk-AREANYIA.js";import{a as q}from"./chunk-64MNV6AB.js";function ee(n,e,t){let r=e.identifierResolution==="strict"?N:Q,l=e.candidateNames?z(e.candidateNames):null,o=0,f=0,m=0,p=0,y="";for(let a of e.paths)if(o+=1,y=a,!(!R(a)&&!(e.includeVueSfc&&A(a)))&&!n.isIgnored(a)&&!e.skipPath?.(a))try{if(l&&!J(w(n,a),l))continue;f+=1;let S=(s,u,v,b)=>{if(e.candidateNames&&!e.candidateNames.has(s))return;m+=1;let g=e.resolveTargets?e.resolveTargets({sourceFile:a,name:s,kind:u,defaultTargets:b}):b();for(let L of g)p+=1,t({sourceFile:a,name:s,target:L,occurrences:v,kind:u})},M=_(n,a);for(let[s,u]of M)S(s,"identifier",u.length,()=>r(n,a,s));for(let s of F(n,a,{includeCrossLanguageDispatchNames:e.includeCrossLanguageDispatchNames,includeRustAttributeNames:e.includeRustAttributeNames})){let u=s.kind==="cross-language-dispatch"?()=>N(n,a,s.name):()=>r(n,a,s.name);S(s.name,s.kind,s.occurrences,u)}}finally{e.afterPath?.(a),o%10===0&&K("source-reference-scan.progress",()=>{},()=>({scannedPaths:o,currentPath:y,candidateMatchedPaths:f,visitedNames:m,visitedHits:p}))}}function ne(n,e={}){let{scope:t,files:r,minLoc:l=1,maxLoc:o=Number.POSITIVE_INFINITY,excludeSymbol:f,excludeEntrySurfaces:m=!1,excludeTypesFiles:p=!1,excludeRootedSymbols:y=!1,requireFunctionLikeSymbol:a=!1,requireCallableSymbol:C=!1,excludeRustTraitImplMembers:S=!1,includeSuppressed:M=!1,sortByLocDesc:s=!1}=e,u=[],v=re(n,{scope:t,files:r,requireFunctionLikeSymbol:a,requireCallableSymbol:C}),b=new Map,g=new Map,L=i=>{let c=b.get(i);if(c!==void 0)return c;let d=H(n,i);return b.set(i,d),d},ie=i=>{let c=g.get(i);if(c!==void 0)return c;let d=D(i);return g.set(i,d),d};for(let i of v){let c=i.relativePath;if(n.isIgnored(c)||m&&L(c)||!oe(i,{requireFunctionLikeSymbol:a,requireCallableSymbol:C})||f!==void 0&&i.symbol===f)continue;let d=x(i);d<l||d>o||p&&ae(c)||y&&O(n,i.symbol,c)||S&&V(i.symbol)||ie(c)!=="test"&&(G(i.symbol)||!M&&h(n,c,i.startLine)||u.push(i))}return s?u.sort((i,c)=>x(c)-x(i)):u}function re(n,e){return e.files!==void 0?[...new Set(e.files.map(r=>r.replace(/\\/g,"/")))].sort().filter(r=>!e.scope||r.includes(e.scope)).flatMap(r=>I(n,r)):e.requireCallableSymbol?P(n,{scope:e.scope,symbolMatches:k,sqlPrefilter:"callable"}):e.requireFunctionLikeSymbol?P(n,{scope:e.scope,symbolMatches:T,sqlPrefilter:"function-like"}):Y(n,e.scope)}function oe(n,e){return e.requireCallableSymbol?k(n.symbol):e.requireFunctionLikeSymbol?T(n.symbol):n.isFunctionLike}function ae(n){return(n.split("/").pop()??"").includes("types")}var te=class{constructor(e){this.db=e}db;scopedDefinitions(e){return W(this.db,e)}definitionsForFile(e){return I(this.db,e)}productionCallableDefinitions(e={}){return ne(this.db,e)}calleeMap(e,t={}){return U(this.db,e,t)}crossFileCallerMap(e,t={}){return X(this.db,e,t)}sourceFallbackCallerFiles(e,t={}){return Z(this.db,e,t)}callerFileMap(e,t={}){return $(this.db,e,t)}frameworkReferencedSymbolIds(e){let t=new Map;for(let l of e){if(!l.leaf)continue;let o=t.get(l.leaf)??[];o.push(l.symbolId),t.set(l.leaf,o)}let r=new Set;for(let l of q(this.db,{includeIgnored:!1}))if(R(l)==="rust")for(let{name:o}of F(this.db,l,{includeRustAttributeNames:!0}))for(let f of t.get(o)??[])r.add(f);return r}symbolsWithNonSelfCallees(e,t={}){if(e.length===0)return new Set;let r=new Map(e.map(o=>[o.symbolId,o.symbol])),l=this.calleeMap(e,t);return new Set([...l.entries()].filter(([o,f])=>{let m=r.get(o);return f.some(p=>p.symbol!==m)}).map(([o])=>o))}fileDependencyGraph(e){return B(this.db,e)}fileKind(e){return D(e)}hasSuppressionComment(e){return h(this.db,e.relativePath,e.startLine)}sourceFiles(){return E(this.db)}scanSourceReferences(e,t){ee(this.db,e,t)}callableSignature(e){let t=j(this.db).forFile(e.relativePath,{facts:!0}).facts?.callables.find(r=>r.startLine===e.startLine&&r.endLine===e.endLine);return t?{paramCount:t.paramCount}:null}};export{te as a};
|
|
2
|
+
//# sourceMappingURL=chunk-RM2WQ75T.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as se}from"./chunk-B75HZHUP.js";import{a as N}from"./chunk-RM2WQ75T.js";import{b as q,e as J,f as $,g as G}from"./chunk-WUOB4DHH.js";import{a as ie}from"./chunk-L446VQYQ.js";import{c as Q,d as Y,e as ee,f as te,g as P,m as re}from"./chunk-UQ73QF5D.js";import{e as ne}from"./chunk-CYHIKTJN.js";import{b}from"./chunk-ULHLDOD6.js";import{j as X,o as _}from"./chunk-63CI3IXR.js";import{d as W,g as U,h as H,i as V,j as K,k as Z}from"./chunk-NABVR6B7.js";import{l as z}from"./chunk-THB6AM3V.js";import{a as w,e as j,h as I}from"./chunk-SA3DPTHT.js";import{b as O,j as B}from"./chunk-SGTKURU6.js";import{a as R}from"./chunk-64MNV6AB.js";import{b as L}from"./chunk-7S5E7KWT.js";var x=new WeakMap,oe=B({kind:"definition-exclusions",serialize:e=>JSON.stringify(e),deserialize:ve});function ce(e,t){let n=j(t);if(!(n==="rust"||n==="typescript"||n==="tsx"||n==="javascript"))return[];let r=w(e,t);if(!r)return[];let s=O(e,t,r),a=oe.read(e,t,s);if(a)return a;let u=n==="rust"?Fe(e,t):Ie(e,t);return oe.write(e,t,s,u),u}function ve(e){try{let t=JSON.parse(e);return!Array.isArray(t)||!t.every(De)?null:t}catch{return null}}function De(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.startLine!="number"||!Number.isFinite(t.startLine)||typeof t.endLine!="number"||!Number.isFinite(t.endLine)||typeof t.reason!="string"?!1:t.containerName===void 0||typeof t.containerName=="string"}var le=new Set(["describe","it","test","fdescribe","fit","xdescribe","xit","beforeEach","afterEach","beforeAll","afterAll","before","after","suite","bench","benchmark"]),Le=/\b(?:describe|it|test|fdescribe|fit|xdescribe|xit|beforeEach|afterEach|beforeAll|afterAll|before|after|suite|bench|benchmark)\s*\(/,we=/\b(?:export\s+)?(?:async\s+)?function\s+use[A-Z][A-Za-z0-9_$]*\b|\b(?:const|let|var)\s+use[A-Z][A-Za-z0-9_$]*\s*(?::[^=;]+)?=\s*(?:async\s*)?(?:function\b|(?:<[^=;{]+>\s*)?(?:\([^)]*\)|[A-Za-z_$][\w$]*)\s*=>)/;function Ie(e,t){let n=w(e,t);if(!n||!Pe(n))return[];let i=I(e,t);if(!i)return[];let r=x.get(i);if(r)return r;let s=!1,a=i.rootNode;for(let l of a.namedChildren){if(l.type!=="expression_statement")continue;let d=l.namedChild(0);if(!d||d.type!=="call_expression")continue;let o=d.namedChild(0);if(!o)continue;let c=o.type==="member_expression"?o.namedChild(o.namedChildCount-1)?.text:o.text;if(c&&le.has(c)){s=!0;break}}let u=[];s&&u.push({startLine:0,endLine:a.endPosition.row,reason:"TS/JS test file (describe/it/test at top level)"});for(let l of a.namedChildren){let d=null,o=null;if(l.type==="function_declaration")d=l.namedChild(0)?.text??null,o=l;else if(l.type==="export_statement"){let c=l.namedChild(0);c?.type==="function_declaration"&&(d=c.namedChild(0)?.text??null,o=c)}else if(l.type==="lexical_declaration"){let c=l.namedChild(0);if(c?.type==="variable_declarator"){let p=c.namedChild(0)?.text,m=c.namedChild(1);p&&(m?.type==="arrow_function"||m?.type==="function_expression")&&(d=p,o=c)}}d&&/^use[A-Z]/.test(d)&&o&&u.push({startLine:o.startPosition.row,endLine:o.endPosition.row,reason:"React custom hook (use*)"})}return u.push(...ue(i,new Set(["function_declaration","method_definition","class_declaration","interface_declaration","type_alias_declaration","enum_declaration","variable_declarator","export_statement"]),new Set(["comment"]))),x.set(i,u),u}function Pe(e){if(e.includes("scip-query"))return!0;let t=!1;for(let n of le)if(e.includes(n)){t=!0;break}return t&&Le.test(e)?!0:e.includes("use")&&we.test(e)}var Ne=/scip-query[\s:-]*ignore[\s:-]*(?:dead(?:-code)?|stale)?/i;function ke(e){return Ne.test(e)}function ue(e,t,n){let i=[],r=s=>{if(t.has(s.type)&&s.parent){let u=s.parent.children,l=-1;for(let d=0;d<u.length;d+=1)if(u[d].startIndex===s.startIndex&&u[d].type===s.type){l=d;break}if(l>0)for(let d=l-1;d>=0;d-=1){let o=u[d];if(n.has(o.type)){if(ke(o.text)){i.push({startLine:s.startPosition.row,endLine:s.endPosition.row,reason:"scip-query suppression comment"});break}continue}if(!(o.type==="attribute_item"||o.type==="inner_attribute_item"))break}}for(let a of s.namedChildren)r(a)};return r(e.rootNode),i}function Fe(e,t){let n=I(e,t);if(!n)return[];let i=x.get(n);if(i)return i;let r=[],s=Te(n);return s?(x.set(n,s),s):(de(n.rootNode,r,!1,!1),r.push(...ue(n,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(...Ue(n.rootNode)),x.set(n,r),r)}function Te(e){return He(e.rootNode)?[{startLine:0,endLine:e.rootNode.endPosition.row,reason:"generated file (@generated header)"}]:null}function de(e,t,n,i){let r=n,s=i;e.type==="trait_item"&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait declaration body (dynamic dispatch)"}),e.type==="impl_item"&&e.childForFieldName("trait")&&(s=!0,t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl block (dynamic dispatch)"})),e.type==="function_item"||e.type==="function_signature_item"?Me(e,t,n,i):i&&We(e)?t.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"?Ae(e,t,n):e.type==="mod_item"&&k(e).some(a=>/#\[\s*cfg\s*\(\s*test\s*\)/.test(a))&&(r=!0);for(let a of e.namedChildren)de(a,t,r,s)}function Me(e,t,n,i){let r=k(e),s=null;i?s="trait impl method (dynamic dispatch)":n&&(s="inside #[cfg(test)] mod");for(let a of r){let u=Be(a);if(u){s=u;break}if(fe(a)){s="#[allow(dead_code)]";break}}s&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:s})}function Ae(e,t,n){let i=k(e),r=e.namedChildren.find(s=>s.type==="type_identifier")?.text;i.some(ze)&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[derive(<reflective>)] \u2014 fields accessed via macro/reflection",containerName:r}),i.some(fe)&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[allow(dead_code)]",containerName:r}),n&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"inside #[cfg(test)] mod",containerName:r})}function k(e){let t=e.parent;if(!t)return[];let n=t.children,i=-1;for(let s=0;s<n.length;s+=1)if(n[s].startIndex===e.startIndex&&n[s].type===e.type){i=s;break}if(i<=0)return[];let r=[];for(let s=i-1;s>=0;s-=1){let a=n[s];if(a.type==="attribute_item"||a.type==="inner_attribute_item")r.push(a.text);else{if(a.type==="line_comment"||a.type==="block_comment")continue;break}}return r}var Oe=[{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 Be(e){return Oe.find(({re:t})=>t.test(e))?.reason??null}var je=[/\bSerialize\b/,/\bDeserialize\b/,/\bFromRow\b/,/\bsqlx::FromRow\b/,/\bDeriveEntityModel\b/,/\bIntoSchema\b/,/\bToSchema\b/,/\bDeriveValueType\b/,/\bError\b/,/\bthiserror::Error\b/];function ze(e){return/#\[\s*derive\s*\(/.test(e)?je.some(t=>t.test(e)):!1}function fe(e){return/#\[\s*allow\s*\(\s*dead_code\s*\)/.test(e)}function We(e){return e.type==="const_item"||e.type==="type_item"||e.type==="static_item"||e.type==="associated_type"}function Ue(e){let t=Ke(e);if(t.size===0)return[];let n=[];for(let i of e.descendantsOfType("mod_item")){let r=i.childForFieldName("name")?.text;r&&t.has(r)&&n.push({startLine:i.startPosition.row,endLine:i.endPosition.row,reason:'serde `with = "..."` module \u2014 body invoked via reflection',containerName:r})}return n}function He(e){for(let t=0;t<Math.min(e.namedChildCount,12);t+=1){let n=e.namedChild(t);if(!n||n.type!=="line_comment"&&n.type!=="block_comment")break;if(/@generated\b/.test(n.text)||/This file is .*generated\b/i.test(n.text)||/Code generated by/i.test(n.text)||/Generated by:\s*https?:\/\/openapi-generator/i.test(n.text)||/openapi-generator/i.test(n.text)&&/Generated by/i.test(n.text))return!0}return!1}var Ve=/^#!?\[\s*serde\s*\(/,ae=/\bwith\s*=\s*"([^"]+)"/g;function Ke(e){let t=new Set;for(let n of e.descendantsOfType("attribute_item")){if(!Ve.test(n.text))continue;ae.lastIndex=0;let i;for(;(i=ae.exec(n.text))!==null;){let r=i[1],s=r.split("::").pop()??r;s&&t.add(s)}}return t}function me(e){let t=new Map,n=i=>{let r=t.get(i);if(r)return r;let s=ce(e,i);return r={ranges:s.map(a=>({startLine:a.startLine,endLine:a.endLine})),containers:new Set(s.map(a=>a.containerName).filter(a=>!!a))},t.set(i,r),r};return(i,r,s,a)=>{let u=n(i);for(let l of u.ranges)if(r>=l.startLine&&r<=l.endLine)return!0;if(a&&u.containers.has(a))return!0;for(let l of _(s))if(u.containers.has(l))return!0;return!1}}function yt(e,t={}){L(e,{groups:t.semanticProvider===!0?["whole-project","semantic-provider"]:["whole-project"]})}function pe(e,t,n={}){L(e,{groups:n.definitions===!0?["source-file","definition-catalog"]:["source-file"],file:t.replace(/\\/g,"/")})}function be(e,t){return t.isIgnoredPath(e.relativePath)?y("ignored-file"):V(e.symbol)?y("module-like-symbol"):E(e.symbol)?!e.isFunctionLike&&e.enclosingSymbol&&E(e.enclosingSymbol)?y("nested-non-callable-value"):!t.includeTests&&!S(e.relativePath)?y("test-file"):!t.includeTests&&t.isExcludedRegion(e.relativePath,e.startLine,e.symbol,e.parentTypeName)?y("excluded-file-region"):K(e.symbol)?y("rust-trait-impl-member"):Z(e.symbol)?y("rust-test-module"):!t.includeMembers&&!Ze(e)?y("member"):e.endLine-e.startLine+1<t.minLoc?y("below-min-loc"):{accepted:!0}:y("non-value-symbol")}function S(e){return q(e)!=="test"}function y(e){return{accepted:!1,rejectionReason:e}}function E(e){return H(e)||e.endsWith("().")||e.endsWith(".")}function Ze(e){return U(e.symbol)||_(e.symbol).length===0}function ye(){return new Map}function ge(e,t,n){let i=new Map;for(let r of Q(e,n))e.isIgnored(r.relative_path)||t.has(r.relative_path)||v(i,r.symbol_id,r.relative_path,r.ref_count,"scip-mention");return i}function he(e,t,n,i={}){let r=new Set;if(i.conservative||n.size===0){for(let s of ee(e,t))r.add(s.symbol_id);return r}for(let s of Y(e,t))e.isIgnored(s.relative_path)||n.has(s.relative_path)||r.add(s.symbol_id);return r}function F(e,t){let n=e.get(t);if(!n)return!1;for(let i of n.values())if(i.occurrences>0)return!0;return!1}function C(e,t,n){let i=e.get(t);if(!i)return!1;for(let[r,s]of i)if(r!==n&&s.occurrences>0)return!0;return!1}function xe(e){return e?.occurrences??0}function v(e,t,n,i,r="source-fallback"){if(i<=0)return;let s=Re(e,t,n);s.occurrences+=i,s.sources.add(r)}function Se(e,t,n,i,r){if(i<=0)return;let s=Re(e,t,n);s.occurrences=Math.max(i,s.occurrences),s.sources.add(r)}function Re(e,t,n){let i=e.get(t);i||(i=new Map,e.set(t,i));let r=i.get(n);return r||(r={occurrences:0,sources:new Set},i.set(n,r)),r}var qe=3e3,Je=1e3;function Wt(e,t={}){let{scope:n,minLoc:i=1,includeTests:r=!1,skipBarrels:s=!1,includeMembers:a=!1,deadCodeOnly:u=!1,scanLimit:l,semantic:d=!0}=t,o=0,c=b("dead.candidates",()=>{let f=se($e(e,{scope:n,minLoc:i,includeTests:r,includeMembers:a}),l);return o=f.length,f},()=>({definitions:o})),p=0,m=s?b("dead.inactive-barrels",()=>{let f=new Set(J(e));return p=f.size,f},()=>({paths:p})):new Set,T=0,g=u?ye():b("dead.mention-reference-counts",()=>{let f=ge(e,m,c.map(D=>D.symbolId));return T=f.size,f},()=>({definitions:c.length,symbolsWithReferences:T})),M=0,Ee=u?b("dead.mentioned-symbol-ids",()=>{let f=he(e,c.map(D=>D.symbolId),m,{conservative:m.size===0});return M=f.size,f},()=>({definitions:c.length,referencedSymbols:M})):new Set,h=u?c.filter(f=>!Ee.has(f.symbolId)):c.filter(f=>!C(g,f.symbolId,f.relativePath));u?b("dead.source-fallback.dead-code-only",()=>et(e,h,g,{includeTests:r,inactiveBarrelPaths:m}),()=>({definitions:h.length,includeTests:r})):b("dead.source-fallback.ast",()=>Ye(e,h,g,{includeTests:r,inactiveBarrelPaths:m}),()=>({definitions:h.length,includeTests:r}));let A=u?h.filter(f=>!F(g,f.symbolId)):h.filter(f=>!C(g,f.symbolId,f.relativePath));b("dead.caller-map-supplement",()=>st(e,A,g,{includeTests:r,inactiveBarrelPaths:m,includeSemantic:!u&&d}),()=>({definitions:A.length,semantic:!u&&d}));let Ce=u?h.filter(f=>!F(g,f.symbolId)):c;return Qe(e,Ge(Ce,g))}function $e(e,t){let n=me(e),i=[];for(let r of X(e,{scope:t.scope,symbolMatches:E,sqlPrefilter:"function-like"}))be(r,{minLoc:t.minLoc,includeTests:t.includeTests,includeMembers:t.includeMembers,isIgnoredPath:a=>e.isIgnored(a),isExcludedRegion:n}).accepted&&i.push(r);return i}function Ge(e,t){return e.map(n=>Xe(n,t)).filter(n=>n.cross_file_refs===0).sort((n,i)=>i.loc-n.loc||n.relative_path.localeCompare(i.relative_path)||n.start_line-i.start_line)}function Xe(e,t){let n=t.get(e.symbolId)??new Map,i=xe(n.get(e.relativePath)),r=0;for(let[s,a]of n)s!==e.relativePath&&(r+=a.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 Qe(e,t){let n=[],i=0,r=0,s=0;for(let a of t){if(e.isIgnored(a.relative_path)||$(e,a.relative_path)||G(e,a.symbol,a.relative_path))continue;let u=a.same_file_refs===0?"dead-code":"file-internal";u==="dead-code"?i++:r++,s+=a.loc,n.push({relativePath:a.relative_path,startLine:a.start_line,endLine:a.end_line,loc:a.loc,symbol:a.symbol,shortName:W(a.symbol),sameFileRefs:a.same_file_refs,kind:u})}return{symbols:n,counts:{total:n.length,deadCode:i,fileInternal:r,loc:s},totalCount:n.length,deadCodeCount:i,fileInternalCount:r,totalLoc:s}}function Ye(e,t,n,i){if(t.length===0)return;let r=new N(e),s=new Set(t.map(l=>l.symbolId)),a=new Set(t.map(l=>l.leaf).filter(Boolean)),u=new Set(r.sourceFiles());for(let l of R(e))u.add(l);r.scanSourceReferences({paths:u,includeVueSfc:!0,includeCrossLanguageDispatchNames:!0,includeRustAttributeNames:!0,identifierResolution:"permissive",candidateNames:a,skipPath:l=>i.inactiveBarrelPaths.has(l)||!i.includeTests&&!S(l)},l=>{s.has(l.target.symbolId)&&(rt(e,l)||v(n,l.target.symbolId,l.sourceFile,it(l),"source-fallback"))})}function et(e,t,n,i){if(t.length===0)return;let r=new N(e),s=tt(t),a=new Set(r.sourceFiles());for(let o of R(e))a.add(o);let u=new Set(s.keys()),l=new Map,d=o=>{let c=l.get(o);return c||(c=re(e,o),l.set(o,c)),c};r.scanSourceReferences({paths:a,includeVueSfc:!0,includeCrossLanguageDispatchNames:!0,includeRustAttributeNames:!0,identifierResolution:"permissive",candidateNames:u,skipPath:o=>i.inactiveBarrelPaths.has(o)||!i.includeTests&&!S(o),resolveTargets:({sourceFile:o,name:c,kind:p})=>{let m=s.get(c);return m?nt(o,c,m,()=>d(o),{permissive:p!=="cross-language-dispatch"}):[]},afterPath:o=>{l.delete(o),pe(e,o)}},o=>{let c=o.kind==="identifier"&&o.sourceFile===o.target.relativePath?Math.max(0,o.occurrences-1):o.occurrences;o.kind==="identifier"&&_e(e,{sourceFile:o.sourceFile,name:o.name,target:o.target,occurrences:c})||v(n,o.target.symbolId,o.sourceFile,c,"source-fallback")})}function tt(e){let t=new Map;for(let n of e){if(!n.leaf)continue;let i=t.get(n.leaf)??[];i.push(n),t.set(n.leaf,i)}return t}function nt(e,t,n,i,r){let s=n.filter(d=>d.relativePath===e);if(s.length>0)return s;if(!r.permissive&&n.length===1)return[...n];let a=i(),u=a.get(t);if(u)for(let d of u){let o=n.filter(c=>P(d,c.relativePath));if(o.length>0)return o}let l=new Set;for(let d of a.values())for(let o of d)l.add(o);for(let d of l){let o=n.filter(c=>P(d,c.relativePath));if(o.length>0&&o.length===n.length)return o}return r.permissive?[...n]:[]}function rt(e,t){return t.kind==="cross-language-dispatch"&&t.target.relativePath===t.sourceFile?!0:t.kind==="identifier"&&_e(e,t)}function it(e){return e.kind==="identifier"&&e.target.relativePath===e.sourceFile?Math.max(0,e.occurrences-1):e.occurrences}function _e(e,t){return t.occurrences>1?!1:z(e,t.sourceFile).some(n=>n.used||n.sourcePath!==t.target.relativePath?!1:n.importedName===t.name||n.localName===t.name)}function st(e,t,n,i){let r=i.includeSemantic!==!1,s=r&&t.length>=qe&&R(e).length>=Je,a=(o,c)=>{c===o.relativePath||e.isIgnored(c)||i.inactiveBarrelPaths.has(c)||!i.includeTests&&!S(c)||Se(n,o.symbolId,c,1,"caller-map")};if(s?b("dead.caller-map.mention-chunks",()=>ot(e,t,a),()=>({definitions:t.length})):b("dead.caller-map.per-symbol",()=>{for(let o of t){let c=ie(e,o,{semantic:r});if(c.length!==0)for(let p of c)a(o,p.file)}},()=>({definitions:t.length,semantic:r})),!s)return;let u=0,l=b("dead.caller-map.semantic-candidates",()=>{let o=t.filter(c=>!C(n,c.symbolId,c.relativePath));return u=o.length,o},()=>({definitions:t.length,semanticCandidates:u}));if(l.length===0)return;let d=ne(e,l);for(let o of l){let c=d.get(o.symbolId);if(c)for(let p of c)a(o,p)}}function ot(e,t,n){let i=new Map(t.map(r=>[r.symbolId,r]));for(let r of te(e,[...i.keys()])){let s=i.get(r.symbol_id);s&&n(s,r.relative_path)}}export{yt as a,Wt as b};
|
|
2
|
+
//# sourceMappingURL=chunk-ROGZXWN2.js.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import{b as Y,g as Z,h as q,i as X,j as ee,q as se}from"./chunk-UQ73QF5D.js";import{a as ne,b as te,d as oe,f as ie}from"./chunk-CYHIKTJN.js";import{a as J}from"./chunk-F6IXELII.js";import{a as G,b as w}from"./chunk-ULHLDOD6.js";import{d as le,e as ae}from"./chunk-DVFP6PZI.js";import{f as Q,g as U,l as z,m as V}from"./chunk-63CI3IXR.js";import{e as W,g as K}from"./chunk-NABVR6B7.js";import{h as N,l as B}from"./chunk-THB6AM3V.js";import{a as A,e as v}from"./chunk-SA3DPTHT.js";import{a as H,b as k,d as j,f as $}from"./chunk-SGTKURU6.js";import{c as x,d as F}from"./chunk-7S5E7KWT.js";function Ke(e,n,o={}){let t=re(e,[n],{additive:o.additive,semantic:o.semantic}),i=o.callableOnly?(t.get(n.symbolId)??[]).filter(c=>K(c.symbol)||c.source==="ast-callsite"):t.get(n.symbolId)??[];return typeof o.limit=="number"?i.slice(0,o.limit):i}function Qe(e,n,o={}){let t=pe(e)?ye(e,n,{semantic:o.semantic!==!1}):be(e).get(n.symbolId)??[];return typeof o.limit=="number"?t.slice(0,o.limit):t}var ue=F("caller-rows",{clearGroups:["whole-project"]}),fe=2e4;function pe(e){return(e.get("SELECT COUNT(*) AS count FROM global_symbols")?.count??0)>fe}function be(e){return ue.get(e,()=>{let n=U(e),o=re(e,n),t=new Map;for(let l of n)t.set(l.symbol,l.symbolId);let i=new Map,c=new Map;for(let l of n){let a=o.get(l.symbolId);if(!(!a||a.length===0))for(let u of a){let m=t.get(u.symbol);if(m===void 0||m===l.symbolId)continue;let d=i.get(m);d||(d=[],i.set(m,d),c.set(m,new Set));let f=`${l.symbol}|${l.relativePath}`;c.get(m).has(f)||(c.get(m).add(f),d.push({symbol:l.symbol,file:l.relativePath,source:"caller-map-inversion"}))}}return i})}function ye(e,n,o){let t=[],i=new Set,c=a=>{if(a.symbol===n.symbol)return;let u=`${a.symbol}|${a.file}`;i.has(u)||(i.add(u),t.push(a))};for(let a of se(e,n))a.file!==n.relativePath&&c({symbol:a.enclosingSymbol??a.file,file:a.file,source:"resolved-reference"});let l=o.semantic?ge(e,n):null;if(l)for(let a of oe(e,l)){if(a.file===n.relativePath||e.isIgnored(a.file))continue;let u=V(Q(e,a.file),a.line);c({symbol:u?.symbol??a.file,file:a.file,source:"semantic-reference"})}return t}function ge(e,n){let o=le().join(", "),t=ae().join(", ");return e.get(`SELECT
|
|
2
|
+
d.id AS documentId,
|
|
3
|
+
gs.id AS symbolId,
|
|
4
|
+
gs.symbol,
|
|
5
|
+
d.relative_path AS relativePath,
|
|
6
|
+
COALESCE(der.start_line, c.start_line) AS startLine,
|
|
7
|
+
COALESCE(der.end_line, c.end_line) AS endLine,
|
|
8
|
+
COALESCE(gs.display_name, '') AS leaf,
|
|
9
|
+
NULL AS parentTypeName,
|
|
10
|
+
CASE WHEN gs.kind IN (${o}) OR gs.symbol LIKE '%().' THEN 1 ELSE 0 END AS isFunctionLike,
|
|
11
|
+
CASE WHEN gs.kind IN (${t}) THEN 1 ELSE 0 END AS isTypeLike,
|
|
12
|
+
gs.kind AS kind,
|
|
13
|
+
gs.documentation AS documentation,
|
|
14
|
+
gs.enclosing_symbol AS enclosingSymbol
|
|
15
|
+
FROM global_symbols gs
|
|
16
|
+
LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
|
|
17
|
+
LEFT JOIN chunks c ON c.document_id = der.document_id
|
|
18
|
+
JOIN documents d ON d.id = COALESCE(der.document_id, c.document_id)
|
|
19
|
+
WHERE gs.id = ?
|
|
20
|
+
LIMIT 1`,n.symbolId)??null}function re(e,n,o={}){if(n.length===0)return new Map;let t=o.additive??!1,i=[],c=[];for(let d of n)v(d.relativePath)&&N(e,d.relativePath)!==null?i.push(d):c.push(d);let l=new Map,a=new Map,u=d=>{for(let[f,M]of d){let s=l.get(f);s||(s=[],l.set(f,s));let r=a.get(f);r||(r=new Set,a.set(f,r));for(let b of M){let g=`${b.symbol}|${b.chunkId}`;r.has(g)||(r.add(g),s.push(b))}}};i.length>0&&u(Me(e,i)),o.semantic!==!1&&u(De(he(e,n)));let m=t?n:c;return m.length>0&&u(Re(e,m)),l}function he(e,n){let o=G(),t=new Map,i=[],c=[],l=0,a=0,u=0,m=0;if(w("semantic.callees.cache-scan",()=>{for(let r of n){if(!ne(r.relativePath)){o&&(l+=1);continue}let b=A(e,r.relativePath);if(!b){o&&(a+=1),c.push(r);continue}let g=k(e,r.relativePath,b),L=_e(e,r.relativePath),_=j(e,r.relativePath,r.symbol,g,L);if(_!==null){let h=Se(_);if(h){o&&(u+=1),h.length>0&&t.set(r.symbolId,h);continue}o&&(m+=1)}i.push({def:r,contentHash:g,depsDigest:L})}},()=>({definitions:n.length,skippedNonTs:l,sourceMissing:a,cacheHits:u,parseFailures:m,misses:i.length,unkeyed:c.length,resultRows:t.size})),i.length===0&&c.length===0)return t;let d=[...c,...i.map(r=>r.def)],f=0,M=w("semantic.callees.compute-misses",()=>{let r=ie(e,d);return f=r.size,r},()=>({definitions:d.length,misses:i.length,unkeyed:c.length,rows:f}));for(let[r,b]of M)t.set(r,b);if(te(e).capability("semantic-callees").available){let r=i.map(b=>({relativePath:b.def.relativePath,symbol:b.def.symbol,contentHash:b.contentHash,depsDigest:b.depsDigest,payload:JSON.stringify(M.get(b.def.symbolId)??[])}));w("semantic.callees.cache-write",()=>$(e,r),()=>({entries:r.length}))}else w("semantic.callees.cache-write-skip",()=>{},()=>({reason:"provider-unavailable",misses:i.length}));return t}function Se(e){try{return JSON.parse(e)}catch{return null}}var Ce=x("semantic-deps-digest",{clearGroups:["whole-project","source-file"]});function _e(e,n){return Ce.get(e,n,()=>{let t=[...J(e).get(n)??[]].sort().map(i=>`${i}:${k(e,i,A(e,i))}`);return H(t.join("|"))})}function Me(e,n){let o=new Map,t=Ie(n,o),i=ee(e);for(let[c,l]of t){let a=N(e,c);if(!a)continue;let u=z(l);for(let m of a){let d=u.get(m.line);if(!d)continue;let f=we(e,c,i,m);f&&f.symbol!==d.symbol&&o.get(d.symbolId).push({symbol:f.symbol,file:f.file,chunkId:m.line,source:"ast-callsite"})}}return o}function Ie(e,n){let o=new Map;for(let t of e){let i=o.get(t.relativePath);i?i.push(t):o.set(t.relativePath,[t]),n.set(t.symbolId,[])}for(let t of o.values())t.sort((i,c)=>i.endLine-i.startLine-(c.endLine-c.startLine));return o}function we(e,n,o,t){let i=q(n,o.get(t.calleeLeaf)??[]);if(i.length===0)return null;let c=Le(e,n,i,t.calleeQualifier);return c||X(e,n,i,t.memberAccess)}function Le(e,n,o,t){if(!t||v(n)!=="clojure")return null;let c=B(e,n).filter(l=>l.kind==="namespace"&&l.localName===t&&l.sourcePath).map(l=>l.sourcePath);for(let l of c){let a=o.find(u=>Z(l,u.file));if(a)return a}return o.find(l=>/`([^`]+)`\//.exec(l.symbol)?.[1]===t)??null}function Re(e,n){if(n.length===0)return new Map;let t=O(n.map(s=>s.documentId)).flatMap(s=>e.all(`SELECT c.document_id, c.id AS chunk_id, c.start_line, c.end_line, m.symbol_id
|
|
21
|
+
FROM mentions m
|
|
22
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
23
|
+
WHERE m.role != 1
|
|
24
|
+
AND c.document_id IN (${s.map(()=>"?").join(",")})`,...s)),i=new Map;for(let s of t)i.has(s.document_id)||i.set(s.document_id,[]),i.get(s.document_id).push(s);let l=O(t.map(s=>s.symbol_id)).flatMap(s=>e.all(`SELECT gs.id AS symbol_id, gs.symbol,
|
|
25
|
+
COALESCE(der.document_id, def_chunk.document_id) AS document_id
|
|
26
|
+
FROM global_symbols gs
|
|
27
|
+
LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
|
|
28
|
+
LEFT JOIN (
|
|
29
|
+
SELECT m.symbol_id, MIN(c.document_id) AS document_id
|
|
30
|
+
FROM mentions m
|
|
31
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
32
|
+
WHERE m.role = 1
|
|
33
|
+
AND m.symbol_id IN (${s.map(()=>"?").join(",")})
|
|
34
|
+
GROUP BY m.symbol_id
|
|
35
|
+
) def_chunk ON def_chunk.symbol_id = gs.id
|
|
36
|
+
WHERE gs.id IN (${s.map(()=>"?").join(",")})`,...s,...s)),a=O([...n.map(s=>s.documentId),...l.flatMap(s=>s.document_id===null?[]:[s.document_id])]),u=new Map(a.flatMap(s=>e.all(`SELECT id, relative_path FROM documents
|
|
37
|
+
WHERE id IN (${s.map(()=>"?").join(",")})`,...s).map(r=>[r.id,r.relative_path]))),m=new Map;for(let s of l)m.has(s.symbol_id)||m.set(s.symbol_id,{symbol:s.symbol,file:s.document_id!==null?u.get(s.document_id)??"":""});let d=new Map,f=u,M=Ee(n);for(let[s,r]of M){let g=[...i.get(s)??[]].sort((p,S)=>p.start_line-S.start_line||p.end_line-S.end_line),L=[...r].sort((p,S)=>p.startLine-S.startLine||p.endLine-S.endLine),_=new Set,h=0;for(let p of L){for(;h<g.length&&g[h].start_line<=p.endLine;)_.add(g[h]),h+=1;for(let y of _)y.end_line<p.startLine&&_.delete(y);let S=new Set,T=[],E=null,me=()=>{if(E)return E;let y=f.get(p.documentId)??"",C=new Set;if(y){let D=Y(e,y),R=Math.max(0,p.startLine),P=Math.min(D.length-1,p.endLine);for(let I=R;I<=P;I+=1)for(let de of D[I])C.add(de)}return E=C,C};for(let y of _){if(y.symbol_id===p.symbolId)continue;let C=m.get(y.symbol_id);if(!C)continue;if(!(y.start_line>=p.startLine&&y.end_line<=p.endLine)){if(!(y.start_line<=p.endLine&&y.end_line>=p.startLine))continue;let I=W(C.symbol);if(!I||!me().has(I))continue}let R=`${C.symbol}|${y.chunk_id}`;S.has(R)||(S.add(R),T.push({...C,chunkId:y.chunk_id,source:"scip-chunk"}))}d.set(p.symbolId,T)}}return d}var ce=500;function O(e){let n=[...new Set(e)],o=[];for(let t=0;t<n.length;t+=ce)o.push(n.slice(t,t+ce));return o}function Ee(e){let n=new Map;for(let o of e){let t=n.get(o.documentId);t?t.push(o):n.set(o.documentId,[o])}return n}function De(e){let n=new Map;for(let[o,t]of e){let i=[];for(let c of t)i.push({symbol:c.symbol,file:c.file,chunkId:-1,source:"semantic-callee"});n.set(o,i)}return n}export{Ke as a,Qe as b,re as c};
|
|
38
|
+
//# sourceMappingURL=chunk-RSSXKJ6J.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{a as N,b as g,c as W}from"./chunk-2FMFF4RI.js";import{a as j}from"./chunk-3XSNW5XB.js";import{a as _}from"./chunk-UVPY3RUZ.js";import{a as E}from"./chunk-B75HZHUP.js";import{a as P}from"./chunk-RM2WQ75T.js";import{a as k}from"./chunk-BGBBVSH4.js";import{e as C}from"./chunk-L446VQYQ.js";import{a as w}from"./chunk-UQ73QF5D.js";import{b as x}from"./chunk-ULHLDOD6.js";import{m as L}from"./chunk-63CI3IXR.js";import{d,e as y,k as v}from"./chunk-NABVR6B7.js";import{f as S}from"./chunk-THB6AM3V.js";import{basename as m,extname as b}from"path";function ae(t,n){let{scope:e,maxLoc:i=15,limit:a=30,scanLimit:o}=n??{},r=new P(t),s=z(r.fileDependencyGraph(e));return _({candidates:()=>B(t,r,e,i),orderCandidates:E,scanLimit:o,profile:{name:"wrapper-candidates"},prepare:l=>({callerFileMap:A(t,r,l,{semantic:n?.semantic!==!1}),reverseFanIn:s}),evaluate:(l,u)=>O(t,r,l,u),orderResults:(l,u)=>u.callerFanIn-l.callerFanIn||u.loc-l.loc,limit:a})}function A(t,n,e,i){let a=N(t,n),o=g(a.forDefinitions(e,{semantic:!1,sourceFallback:!1})),r=[];i.semantic&&x("wrapper.semantic-candidates",()=>{r=e.filter(c=>F(t,n,c,o).length<=1)},()=>({symbols:e.length,semanticCandidates:r.length}));let s=r.length===0?new Map:g(a.forDefinitions(r,{semantic:!0,sourceFallback:!1})),l=s.size===0?o:C(o,s),u=new Map(e.map(c=>[c.symbolId,c])),f=new Map;for(let c of e){let I=F(t,n,c,l);if(I.length>1||(f.set(c.symbolId,c),I.length!==1))continue;let D=I[0],M=R(t,c.symbolId,D);if(!M)continue;let p=T(n,t,D,c.symbol,M);p?.isFunctionLike&&u.has(p.symbolId)&&f.set(p.symbolId,u.get(p.symbolId))}let h=[...f.values()];return h.length===0?l:C(l,g(a.forDefinitions(h,{semantic:!1,sourceFallback:!0})))}function O(t,n,e,i){let a=F(t,n,e,i.callerFileMap);if(a.length!==1)return null;let o=a[0],r=R(t,e.symbolId,o);if(!r)return null;let s=T(n,t,o,e.symbol,r);if(s&&v(s.symbol))return null;let{fanIn:l,source:u}=J(i.callerFileMap,i.reverseFanIn,o,s);if(u==="function"?l<=3:l<=5)return null;let f=H(t,e,o,s);return{symbol:e.symbol,shortName:d(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:k(e),singleCaller:s?.symbol??"",singleCallerShort:s?.isFunctionLike?d(s.symbol):m(o),callerFanIn:l,actionTier:f.length>0?"signal":"direct",boundaryEvidence:f}}function B(t,n,e,i){return n.productionCallableDefinitions({scope:e,minLoc:2,maxLoc:i,requireFunctionLikeSymbol:!0,excludeRootedSymbols:!0}).filter(a=>!S(t,a))}function F(t,n,e,i){let a=m(e.relativePath,b(e.relativePath)),o=[...i.get(e.symbolId)??[]].filter(r=>r!==e.relativePath).filter(r=>m(r,b(r))!==a).filter(r=>{let s=n.fileKind(r);return s!=="barrel"&&s!=="entry"&&s!=="test"});return W(t,e,o).realConsumers}function R(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 T(t,n,e,i,a){let o=t.definitionsForFile(e),r=q(n,e,i,a.start_line,a.end_line);return L(o,r)}function J(t,n,e,i){if(i?.isFunctionLike){let a=[...t.get(i.symbolId)??[]].filter(o=>o!==i.relativePath);if(a.length>0)return{fanIn:a.length,source:"function"}}return{fanIn:G(n,e),source:"file"}}function q(t,n,e,i,a){let o=y(e);if(!o)return i;let r=w(t,n).get(o);if(!r||r.length===0)return i;for(let s of r)if(s>=i&&s<=a)return s;return i}function z(t){let n=new Map;for(let[e,i]of t){n.has(e)||n.set(e,n.get(e)??0);for(let a of i)n.set(a,(n.get(a)??0)+1)}return n}function G(t,n){let e=t.get(n)??0;if(e>0)return e;let i=m(n,b(n)),a=0;for(let[o,r]of t)o!==n&&m(o,b(o))===i&&r>a&&(a=r);return a}function H(t,n,e,i){return j(t,n.relativePath,n.startLine,"wrapper","explicit ignore-wrapper comment",[{label:"wrapper name",value:d(n.symbol)},{label:"caller name",value:i?.symbol?d(i.symbol):m(e)},{label:"wrapper path",value:n.relativePath},{label:"caller path",value:e}])}export{ae as a};
|
|
7
|
+
//# sourceMappingURL=chunk-RUV5IY25.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as A,b as F}from"./chunk-2FMFF4RI.js";import{a as C}from"./chunk-RM2WQ75T.js";import{a as k}from"./chunk-NBNEVLRC.js";import{d as b}from"./chunk-NABVR6B7.js";import{a as p}from"./chunk-64MNV6AB.js";import{posix as h}from"path";var _=20,G=1,O=new Map([["app","app"],["apps","app"],["component","component"],["components","component"],["composable","composable"],["composables","composable"],["contract","contract"],["contracts","contract"],["domain","domain"],["domains","domain"],["feature","feature"],["features","feature"],["hook","hook"],["hooks","hook"],["lib","library"],["module","module"],["modules","module"],["package","package"],["packages","package"],["page","page"],["pages","page"],["route","route"],["routes","route"],["screen","screen"],["screens","screen"],["service","service"],["services","service"],["shared","shared"],["src","source-root"],["store","state"],["stores","state"],["test","test"],["tests","test"],["util","utility"],["utils","utility"],["view","view"],["views","view"]]),q=new Set(["components","contracts","hooks","lib","services","shared","stores","utils"]),Y=new Set(["access","api","auth","config","db","effect","errors","hooks","lib","middleware","permissions","routes","schemas","servicetasks","services","startup","store","stores","test-utils","repository","repositories","tests","types","ui","utils","workflow","workflows"]);function ke(e,n={}){let t=x(n.limit,_),i=x(n.minConsumers,G),r=new C(e),s=r.fileDependencyGraph(n.scope),o=ge(p(e,{includeIgnored:!1})),a=pe(e.config.locality?.architecturalBoundarySegments,n.architecturalBoundarySegments);return(n.target?K(e,r,n.target):J(e,n.scope,n.scanLimit)).map(c=>Q(e,r,s,c,n,o,a)).filter(c=>c.consumerFiles.length>=i||n.target).sort(me).slice(0,t)}function K(e,n,t){let i=Z(e,t);if(i)return[I(i)];let r=k(e,t);if(!r)return[];let s=n.definitionsForFile(r.relativePath).find(o=>o.symbolId===r.symbolId);return s?[ee(s)]:[{unit:{kind:"symbol",file:r.relativePath,shortName:b(r.symbol),symbol:r.symbol,startLine:r.startLine,endLine:r.endLine}}]}function J(e,n,t){let i=p(e,{scope:n,includeIgnored:!1}),r=x(t,i.length);return i.slice(0,r).map(s=>I(s))}function Q(e,n,t,i,r,s,o){let a=i.definition?V(e,n,i.definition,r.semantic):X(t,i.unit.file),d=i.definition?a.length>0?"exact":"none":a.length>0?"file-level":"none",f=i.unit.file,c=l(h.dirname(f)),u=te(a),B=ne(c),W=w([...T(c),...u?T(u):[]]),y=ie(i.unit,c,u,a),g=re(y,i.unit,c,u,a,s,o),j=le(i.unit,d,u,a,c,g.whyNoSuggestedHome),z=ue(i.unit,c,u,a,g.suggestedHome,g.whyNoSuggestedHome);return{actionTier:"signal",sourceUnit:i.unit,candidatePath:f,currentDirectory:c,directoryAncestry:B,consumerFiles:a,consumerCoverage:d,nearestCommonOwner:u,boundaryMarkers:W,recommendedTier:y,suggestedHome:g.suggestedHome,destinationConfidence:g.confidence,whyNoSuggestedHome:g.whyNoSuggestedHome,counterevidence:j,reasons:z,recommendation:de(y,g.suggestedHome,d)}}function V(e,n,t,i){let r=F(A(e,n).forDefinitions([t],{semantic:i!==!1,sourceFallback:!0}));return E(r.get(t.symbolId)??[])}function X(e,n){let t=[];for(let[i,r]of e.entries())i!==n&&r.has(n)&&t.push(i);return E(t)}function Z(e,n){let t=D(n),i=p(e,{includeIgnored:!1}),r=i.find(o=>o===t);if(r)return r;let s=i.find(o=>o.endsWith(`/${t}`));return s||(i.find(o=>o.includes(t))??null)}function ee(e){return{definition:e,unit:{kind:"symbol",file:e.relativePath,shortName:b(e.symbol),symbol:e.symbol,startLine:e.startLine,endLine:e.endLine}}}function I(e){return{unit:{kind:"file",file:e,shortName:h.basename(e)}}}function ne(e){if(e===".")return[{path:".",depth:0,markers:[]}];let n=[],t=e.split("/").filter(Boolean);for(let i=0;i<t.length;i+=1){let r=t.slice(0,i+1).join("/");n.push({path:r,depth:i,markers:L(r)})}return n}function T(e){return e==="."?[]:$(e).map(({marker:n,prefix:t})=>`${n}: ${t}`)}function L(e){return w($(e).map(({marker:n})=>n))}function $(e){let n=e.split("/").filter(Boolean),t=[];for(let i=0;i<n.length;i+=1){let r=O.get(n[i]);r&&t.push({marker:r,prefix:n.slice(0,i+1).join("/")})}return t}function te(e){if(e.length===0)return null;let n=e.map(i=>l(h.dirname(i))),t=n[0].split("/").filter(Boolean);for(let i of n.slice(1)){let r=i.split("/").filter(Boolean),s=[],o=Math.min(t.length,r.length);for(let a=0;a<o&&t[a]===r[a];a+=1)s.push(t[a]);t=s}return t.length===0?".":t.join("/")}function ie(e,n,t,i){return t?e.kind==="symbol"&&i.length===1?i[0]===e.file?"same-file":"sibling-folder":t==="."||t==="src"?"repository-level-review":U(t,"package")?"package-level-shared":U(t,"app")?"app-level-shared":N(t,["feature","domain","module"])||N(n,["feature","domain","module"])?"feature-local-shared":"sibling-folder":"no-exact-consumers"}function re(e,n,t,i,r,s,o){let a=oe(e,i);if(a)return m(a);let d=fe(n.file),f=se(e,t,d,r,o);if(f)return f;let c=i;if(l(t)===l(c))return m(`${t} is already the nearest common owner for its consumers.`);let u=ae(c,t,d,o);return u||ce(c,t,d,s,o)}function oe(e,n){return n?e==="no-exact-consumers"||e==="repository-level-review"?"The inferred owner is too broad or unsupported for an exact destination.":null:"No consumer owner could be inferred from the current index."}function se(e,n,t,i,r){if(e==="same-file"){let s=i[0]??null;return s?S(s):m("No same-file consumer path was available.")}if(e==="sibling-folder"&&i.length===1){let s=l(h.dirname(i[0])),o=H(n,t,s,r);return o?m(o):S(s)}return null}function ae(e,n,t,i){return be(e)?P(e,n,t,i,`Nearest shared owner ${e} is outside source root ${t}.`):null}function ce(e,n,t,i,r){if(e===".")return m("The nearest common owner is the repository root.");let s=`${e}/shared`,o=P(s,n,t,r,`Proposed home ${s} is outside source root ${t}.`);return o.confidence==="withheld"||i.has(s)?o:m(`${s} does not exist in the indexed project.`)}function P(e,n,t,i,r){if(!M(e,t))return m(r);let s=H(n,t,e,i);return s?m(s):S(e)}function S(e){return{suggestedHome:e,confidence:"exact",whyNoSuggestedHome:null}}function m(e){return{suggestedHome:null,confidence:"withheld",whyNoSuggestedHome:e}}function le(e,n,t,i,r,s){let o=["Report-only signal; review ownership before moving files."];return n==="none"&&o.push("No consumers were found in the current index."),n==="file-level"&&o.push("File-level import evidence can hide which exported unit is actually used."),(t==="."||t==="src")&&o.push("Nearest common owner is broad, so this is not enough evidence for automatic placement."),i.length===1&&o.push("Only one consumer was found; inlining or same-folder placement may be better than shared extraction."),e.kind==="file"&&o.push("File targets describe module locality, not symbol-level usage."),t&&r.startsWith(`${t}/`)&&o.push("Candidate already lives under the nearest common owner."),s&&o.push(`No exact suggested home: ${s}`),o}function ue(e,n,t,i,r,s){let o=[];return o.push(`${e.shortName} currently lives in ${n}.`),t?o.push(`${i.length} consumer file(s) share ${t} as their nearest common owner.`):o.push("No consumer owner could be inferred from the current index."),r?o.push(`Suggested home is ${r}.`):s&&o.push(`No exact suggested home: ${s}`),o}function de(e,n,t){return e==="no-exact-consumers"?"Review references before moving; no consumers were found.":e==="repository-level-review"?"Keep this as a broad locality signal; the inferred owner is too general for automatic relocation.":n?`Review whether ${t==="exact"?"symbol usage":"module import"} supports moving or extracting toward ${n}.`:"Review ownership manually before changing structure."}function me(e,n){return R(n)-R(e)||e.candidatePath.localeCompare(n.candidatePath)}function R(e){let n=e.consumerFiles.length*10;return e.consumerCoverage==="exact"&&(n+=5),e.suggestedHome&&(n+=3),e.recommendedTier==="repository-level-review"&&(n-=8),e.recommendedTier==="no-exact-consumers"&&(n-=12),n}function ge(e){let n=new Set(["."]);for(let t of e){let i=l(h.dirname(t));for(;!n.has(i)&&(n.add(i),i!==".");)i=l(h.dirname(i))}return n}function fe(e){let n=v(e),t=n.indexOf("src");return t>=0?n.slice(0,t+1).join("/"):n.length<=1?".":n[0]}function M(e,n){let t=l(e),i=l(n);return i==="."||t===i||t.startsWith(`${i}/`)}function he(e,n,t){let i=v(e),r=v(n);return(M(e,n)?i.slice(r.length):i).some(o=>t.has(o.toLowerCase()))}function H(e,n,t,i){return l(e)===l(t)||!he(e,n,i)?null:`${e} is a named architectural boundary; an exact move to ${t} needs human design.`}function pe(...e){let n=new Set(Y);for(let t of e)for(let i of t??[]){let r=ye(i);r&&n.add(r)}return n}function ye(e){let n=e.trim().toLowerCase();return n===""?null:n}function U(e,n){return L(e).includes(n)}function N(e,n){let t=L(e);return n.some(i=>t.includes(i))}function be(e){let n=e.split("/").filter(Boolean),t=n[n.length-1];return t?q.has(t):!1}function D(e){return e.replaceAll("\\","/").replace(/^\.\//,"")}function l(e){let n=D(e);return n===""?".":n}function v(e){let n=D(e);return n==="."?[]:n.split("/").filter(Boolean)}function x(e,n){return!Number.isFinite(e)||e===void 0||e<1?n:Math.floor(e)}function E(e){return w([...e]).sort((n,t)=>n.localeCompare(t))}function w(e){return[...new Set(e)]}export{ke as a};
|
|
2
|
+
//# sourceMappingURL=chunk-RVGEZYMQ.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as s}from"./chunk-
|
|
1
|
+
import{a as s}from"./chunk-OFXN2BCT.js";function m(e,d){let i=s(e,d);return i?e.all(`SELECT DISTINCT d2.relative_path
|
|
2
2
|
FROM mentions m
|
|
3
3
|
JOIN chunks c ON m.chunk_id = c.id
|
|
4
4
|
JOIN documents d1 ON c.document_id = d1.id
|
|
@@ -30,4 +30,4 @@ import{a as s}from"./chunk-7B6LP46R.js";function m(e,d){let i=s(e,d);return i?e.
|
|
|
30
30
|
WHERE d2.relative_path = ?
|
|
31
31
|
AND d1.relative_path != ?
|
|
32
32
|
ORDER BY d1.relative_path`,i,i).filter(t=>!e.isIgnored(t.relative_path)).map(t=>({relativePath:t.relative_path})):[]}export{m as a,o as b};
|
|
33
|
-
//# sourceMappingURL=chunk-
|
|
33
|
+
//# sourceMappingURL=chunk-RXINFVBN.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{a as m}from"./chunk-
|
|
1
|
+
import{a as m}from"./chunk-OFXN2BCT.js";import{a as h}from"./chunk-NBNEVLRC.js";import{d as p}from"./chunk-NABVR6B7.js";import{readFileSync as f}from"fs";import{extname as y,join as d}from"path";function M(t,e,a={}){let{context:s=0}=a,r=L(e);if(r)return j(t,r.filePath,r.startLine,r.endLine,s);let l=h(t,e);return l?R(t,l,s):null}function L(t){let e=t.match(/^(.+\.\w+):(\d+)-(\d+)$/);return e?{filePath:e[1],startLine:parseInt(e[2],10),endLine:parseInt(e[3],10)}:null}function R(t,e,a){let s=t.get("SELECT language FROM documents WHERE relative_path = ?",e.relativePath),r=d(t.config.projectRoot,e.relativePath),l;try{l=f(r,"utf-8")}catch{return null}let n=l.split(`
|
|
2
2
|
`),c=Math.max(0,e.startLine-a),i=Math.min(n.length-1,e.endLine+a),u=n.slice(c,i+1).join(`
|
|
3
3
|
`);return{symbol:e.symbol,shortName:p(e.symbol),relativePath:e.relativePath,startLine:c,endLine:i,language:s?.language??v(e.relativePath),source:u}}function j(t,e,a,s,r){let l=m(t,e);if(!l)return null;let n=t.get("SELECT relative_path, language FROM documents WHERE relative_path = ?",l);if(!n)return null;let c=d(t.config.projectRoot,n.relative_path),i;try{i=f(c,"utf-8")}catch{return null}let u=i.split(`
|
|
4
4
|
`),o=Math.max(0,a-1-r),g=Math.min(u.length-1,s-1+r),b=u.slice(o,g+1).join(`
|
|
5
5
|
`);return{symbol:`${n.relative_path}:${a}-${s}`,shortName:`${n.relative_path}:${a}-${s}`,relativePath:n.relative_path,startLine:o,endLine:g,language:n.language??v(n.relative_path),source:b}}function v(t){switch(y(t).toLowerCase()){case".ts":case".tsx":case".mts":case".cts":return"typescript";case".js":case".jsx":case".mjs":case".cjs":return"javascript";case".py":case".pyi":return"python";case".rs":return"rust";case".go":return"go";case".java":return"java";case".kt":case".kts":return"kotlin";case".scala":return"scala";case".rb":return"ruby";case".php":return"php";case".cs":return"csharp";case".vb":return"vb";case".dart":return"dart";case".c":case".h":return"c";case".cc":case".cpp":case".cxx":case".hpp":case".hh":case".hxx":return"cpp";case".vue":return"vue";default:return null}}export{M as a};
|
|
6
|
-
//# sourceMappingURL=chunk-
|
|
6
|
+
//# sourceMappingURL=chunk-S2MRVIJ5.js.map
|