scip-query 0.10.8 → 0.10.11
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 +3 -1
- package/dist/chunk-2KHTSEIL.js +102 -0
- package/dist/chunk-3VD3JMK2.js +2 -0
- package/dist/{chunk-MEKSFV6H.js → chunk-4UZO3XCV.js} +2 -2
- package/dist/{chunk-BJWNO6BU.js → chunk-54KGX7EX.js} +2 -2
- package/dist/chunk-5GOLFJEO.js +8 -0
- package/dist/chunk-5OST6GYB.js +2 -0
- package/dist/{chunk-C6BYNIH4.js → chunk-65AU3HFZ.js} +2 -2
- package/dist/{chunk-E2CCBFLR.js → chunk-6GN7FXCH.js} +2 -2
- package/dist/{chunk-RHKMQNFI.js → chunk-6IR2AOBM.js} +2 -2
- package/dist/{chunk-6EO3E3IP.js → chunk-6JRV4MY2.js} +2 -2
- package/dist/{chunk-5SMUKUV5.js → chunk-6LJHXREW.js} +2 -2
- package/dist/chunk-6QSOCTZT.js +18 -0
- package/dist/{chunk-6TDOT7B3.js → chunk-72KY2ZFO.js} +2 -2
- package/dist/{chunk-LGX2Y4BA.js → chunk-7B6LP46R.js} +2 -2
- package/dist/chunk-7GO4EQF5.js +2 -0
- package/dist/chunk-7IVSJJZU.js +7 -0
- package/dist/{chunk-EBIQY3RK.js → chunk-7TWLSZK5.js} +2 -2
- package/dist/{chunk-X3Z4MLVL.js → chunk-AVWPHM2Q.js} +2 -2
- package/dist/{chunk-GZQID3FS.js → chunk-BASVXNY3.js} +2 -2
- package/dist/{chunk-BJG67TCR.js → chunk-BFXPG2VN.js} +2 -2
- package/dist/chunk-BSN22NRK.js +9 -0
- package/dist/{chunk-ZDR4VTOP.js → chunk-BVRS7RKQ.js} +2 -2
- package/dist/{chunk-ANIOISCE.js → chunk-C5CTSJ6X.js} +2 -2
- package/dist/{chunk-VXT7WVIN.js → chunk-CO5GJRP7.js} +2 -2
- package/dist/chunk-CW5YFOCP.js +5 -0
- package/dist/chunk-E35O7UCB.js +2 -0
- package/dist/{chunk-LWTML2AN.js → chunk-EXDQ35NN.js} +2 -2
- package/dist/{chunk-Q34NWRPP.js → chunk-EY43NV4M.js} +2 -2
- package/dist/chunk-FAYI6KZ5.js +2 -0
- package/dist/{chunk-ZL52RLDK.js → chunk-FDEQIPPK.js} +2 -2
- package/dist/{chunk-5G5VI7J4.js → chunk-FFVIFETB.js} +2 -2
- package/dist/{chunk-JUIAOOK7.js → chunk-FKCGBZAC.js} +2 -2
- package/dist/{chunk-JRUKS66S.js → chunk-FXNWFMKW.js} +2 -2
- package/dist/chunk-G5UPYQGL.js +4 -0
- package/dist/chunk-GQBMH2TQ.js +2 -0
- package/dist/{chunk-VFLHKRTW.js → chunk-GRJY65YT.js} +2 -2
- package/dist/chunk-HF25DFSC.js +3 -0
- package/dist/chunk-HHN2B5KA.js +2 -0
- package/dist/{chunk-7KJBH4IP.js → chunk-IHUETYFW.js} +2 -2
- package/dist/{chunk-BEUQVBE3.js → chunk-JATUZIEH.js} +2 -2
- package/dist/chunk-JCLDUKT6.js +38 -0
- package/dist/{chunk-B4EHYG6M.js → chunk-JGN2ZFJR.js} +2 -2
- package/dist/{chunk-L4QKEQ4S.js → chunk-JME7OWD3.js} +2 -2
- package/dist/chunk-KDFONWTW.js +40 -0
- package/dist/{chunk-VMPB52FG.js → chunk-LPL4MA6R.js} +2 -2
- package/dist/{chunk-FGTHPJON.js → chunk-LSET2TXH.js} +2 -2
- package/dist/chunk-LZHUWKGD.js +2 -0
- package/dist/{chunk-JYSAYZNX.js → chunk-M4COR2H6.js} +2 -2
- package/dist/{chunk-QDGKE5HN.js → chunk-NOJAM5ZV.js} +2 -2
- package/dist/chunk-O6ZH6C6Y.js +2 -0
- package/dist/{chunk-3LQFMQPY.js → chunk-OBGRLXWF.js} +2 -2
- package/dist/chunk-OLTESY4K.js +3 -0
- package/dist/chunk-P4KYUPBD.js +4 -0
- package/dist/chunk-P5RYBRIO.js +4 -0
- package/dist/{chunk-6N6QTGSD.js → chunk-P753MDDE.js} +2 -2
- package/dist/{chunk-NWFSC356.js → chunk-P7AL7Y37.js} +2 -2
- package/dist/chunk-QLAUCRDJ.js +2 -0
- package/dist/{chunk-FHWEEQVO.js → chunk-QPU7EXAW.js} +2 -2
- package/dist/{chunk-AA7L7GKI.js → chunk-QYB5P7GL.js} +2 -2
- package/dist/chunk-RNM6LMCF.js +2 -0
- package/dist/chunk-RVWSAMTT.js +2 -0
- package/dist/{chunk-T633QLYF.js → chunk-TK7O5ER5.js} +2 -2
- package/dist/chunk-TQ5W2H3S.js +4 -0
- package/dist/chunk-USPV3T5K.js +2 -0
- package/dist/{chunk-FKUCFCLU.js → chunk-VCQYSG2M.js} +2 -2
- package/dist/{chunk-2YI45TNM.js → chunk-VUKC6F77.js} +2 -2
- package/dist/{chunk-N7F5UM6J.js → chunk-W6BVEKYC.js} +2 -2
- package/dist/{chunk-63MSELOP.js → chunk-WUCEKFQC.js} +2 -2
- package/dist/chunk-XUGQU7PM.js +41 -0
- package/dist/{chunk-KZYHFI2X.js → chunk-Y5NBHMQX.js} +2 -2
- package/dist/{chunk-6BNOACLT.js → chunk-YCOFCT4B.js} +2 -2
- package/dist/{chunk-SHM5D3DQ.js → chunk-YWYFU2V3.js} +2 -2
- package/dist/{chunk-BWL2ECGQ.js → chunk-Z3YYR4OS.js} +2 -2
- package/dist/{chunk-3FYGJ2GY.js → chunk-Z4HICZGY.js} +2 -2
- package/dist/{chunk-24S6MYOC.js → chunk-ZQDIXAF5.js} +2 -2
- package/dist/cli.js +298 -244
- package/dist/{db-BAVwb4Pb.d.ts → db-Djj3Nqrb.d.ts} +2 -0
- package/dist/{health-B17sVFYf.d.ts → health-D5J42g4D.d.ts} +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -3
- package/dist/queries/affected.d.ts +1 -1
- package/dist/queries/affected.js +1 -1
- package/dist/queries/bottlenecks.d.ts +1 -1
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/by-kind.d.ts +1 -1
- package/dist/queries/by-kind.js +1 -1
- package/dist/queries/call-graph.d.ts +1 -1
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.d.ts +1 -1
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/cleanup-plan.d.ts +1 -1
- package/dist/queries/cleanup-plan.js +1 -1
- package/dist/queries/co-change.d.ts +1 -1
- package/dist/queries/co-change.js +1 -1
- package/dist/queries/code.d.ts +1 -1
- package/dist/queries/code.js +1 -1
- package/dist/queries/complexity-hotspots.d.ts +1 -1
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.d.ts +1 -1
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/convergence.d.ts +1 -1
- package/dist/queries/convergence.js +1 -1
- package/dist/queries/coupling.d.ts +1 -1
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/cycles.d.ts +1 -1
- package/dist/queries/cycles.js +1 -1
- package/dist/queries/dataflow.d.ts +1 -1
- package/dist/queries/dataflow.js +1 -1
- package/dist/queries/dead.d.ts +1 -1
- package/dist/queries/dead.js +1 -1
- package/dist/queries/deep-chains.d.ts +1 -1
- package/dist/queries/deep-chains.js +1 -1
- package/dist/queries/deps.d.ts +1 -1
- package/dist/queries/deps.js +1 -1
- package/dist/queries/diff-gate.d.ts +1 -1
- package/dist/queries/diff-gate.js +1 -1
- package/dist/queries/diff-impact.d.ts +1 -1
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/doc-drift.d.ts +1 -1
- package/dist/queries/doc-drift.js +1 -1
- package/dist/queries/drift.d.ts +2 -1
- package/dist/queries/drift.js +1 -1
- package/dist/queries/extract-candidates.d.ts +1 -1
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/fan.d.ts +1 -1
- package/dist/queries/fan.js +1 -1
- package/dist/queries/files.d.ts +1 -1
- package/dist/queries/health.d.ts +2 -2
- package/dist/queries/health.js +1 -1
- package/dist/queries/hierarchy.d.ts +1 -1
- package/dist/queries/hierarchy.js +1 -1
- package/dist/queries/hotspots.d.ts +1 -1
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.d.ts +1 -1
- package/dist/queries/imports.js +1 -1
- package/dist/queries/incomplete-migration.d.ts +1 -1
- 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 +1 -1
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/locality-candidates.d.ts +1 -1
- package/dist/queries/locality-candidates.js +1 -1
- package/dist/queries/members.d.ts +1 -1
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.d.ts +1 -1
- package/dist/queries/methods.js +1 -1
- package/dist/queries/outline.d.ts +1 -1
- package/dist/queries/outline.js +1 -1
- package/dist/queries/passthrough-candidates.d.ts +1 -1
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/plan-context.d.ts +1 -1
- package/dist/queries/plan-context.js +1 -1
- package/dist/queries/react-component-duplicates.d.ts +2 -1
- package/dist/queries/react-component-duplicates.js +1 -1
- package/dist/queries/react-hook-candidates.d.ts +2 -1
- package/dist/queries/react-hook-candidates.js +1 -1
- package/dist/queries/react-large-component-pressure.d.ts +1 -1
- package/dist/queries/react-large-component-pressure.js +1 -1
- package/dist/queries/recent-duplicates.d.ts +1 -1
- package/dist/queries/recent-duplicates.js +1 -1
- package/dist/queries/redundant-reexports.d.ts +1 -1
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/refs.d.ts +1 -1
- package/dist/queries/refs.js +1 -1
- package/dist/queries/self-audit.d.ts +1 -1
- package/dist/queries/self-audit.js +1 -1
- package/dist/queries/similar-chains.d.ts +1 -1
- package/dist/queries/similar-chains.js +1 -1
- package/dist/queries/similar-files.d.ts +1 -1
- package/dist/queries/similar-files.js +1 -1
- package/dist/queries/similar-signatures.d.ts +1 -1
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.d.ts +13 -2
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.d.ts +1 -1
- package/dist/queries/slice.js +1 -1
- package/dist/queries/stale-abstractions.d.ts +1 -1
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/stats.d.ts +1 -1
- package/dist/queries/surface.d.ts +1 -1
- package/dist/queries/surface.js +1 -1
- package/dist/queries/symbols.d.ts +1 -1
- package/dist/queries/symbols.js +1 -1
- package/dist/queries/system.d.ts +1 -1
- package/dist/queries/system.js +1 -1
- package/dist/queries/trace.d.ts +1 -1
- package/dist/queries/trace.js +1 -1
- package/dist/queries/unused-imports.d.ts +1 -1
- package/dist/queries/unused-imports.js +1 -1
- package/dist/queries/unused-params.d.ts +1 -1
- package/dist/queries/unused-params.js +1 -1
- package/dist/queries/vue-component-duplicates.d.ts +2 -1
- package/dist/queries/vue-component-duplicates.js +1 -1
- package/dist/queries/vue-composable-candidates.d.ts +2 -1
- package/dist/queries/vue-composable-candidates.js +1 -1
- package/dist/queries/vue-large-view-pressure.d.ts +1 -1
- package/dist/queries/wrapper-candidates.d.ts +1 -1
- package/dist/queries/wrapper-candidates.js +1 -1
- package/docs/COMMAND_REFERENCE.md +1 -1
- package/docs/analyzer-inventory.md +29 -0
- package/docs/analyzer-validation-ledger.md +32 -1
- package/package.json +1 -1
- package/skills/scip-hyper-optimization/SKILL.md +153 -24
- package/skills/scip-hyper-optimization/agents/openai.yaml +3 -3
- package/dist/chunk-2H57MJLI.js +0 -2
- package/dist/chunk-4TMJDHC6.js +0 -5
- package/dist/chunk-5GVOJOBL.js +0 -2
- package/dist/chunk-7XWXGANX.js +0 -4
- package/dist/chunk-AETMKBZR.js +0 -40
- package/dist/chunk-BTCASU5J.js +0 -3
- package/dist/chunk-C6ROZBJA.js +0 -32
- package/dist/chunk-COUFCH64.js +0 -2
- package/dist/chunk-EKECQP6Z.js +0 -2
- package/dist/chunk-FVA3NH4P.js +0 -2
- package/dist/chunk-I274B3B3.js +0 -7
- package/dist/chunk-J6ADQKQA.js +0 -2
- package/dist/chunk-K7VBTWNR.js +0 -2
- package/dist/chunk-KLXVEBVC.js +0 -2
- package/dist/chunk-KRGBLZT2.js +0 -7
- package/dist/chunk-P3K7LX7M.js +0 -4
- package/dist/chunk-PVZMPG5I.js +0 -2
- package/dist/chunk-RSKOYTSY.js +0 -3
- package/dist/chunk-RY7CAOJF.js +0 -4
- package/dist/chunk-S7YOLFLX.js +0 -2
- package/dist/chunk-SOGKYB5I.js +0 -8
- package/dist/chunk-VAXDTQHE.js +0 -18
- package/dist/chunk-X3BJUFSN.js +0 -62
- package/dist/chunk-XPOZO76D.js +0 -2
- package/dist/chunk-XWC67C3Q.js +0 -2
- package/dist/chunk-YNSVAJR6.js +0 -2
- package/dist/chunk-ZMU6IWDK.js +0 -38
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as A}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as A}from"./chunk-GRJY65YT.js";import{a as C}from"./chunk-5OST6GYB.js";import{a as k}from"./chunk-TK7O5ER5.js";import{c as b}from"./chunk-JM72FNGA.js";import{a as p}from"./chunk-64MNV6AB.js";import{posix as f}from"path";var j=20,z=1,_=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"]]),G=new Set(["components","contracts","hooks","lib","services","shared","stores","utils"]),O=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 De(e,n={}){let t=L(n.limit,j),i=L(n.minConsumers,z),o=new C(e),s=o.fileDependencyGraph(n.scope),r=de(p(e,{includeIgnored:!1})),c=fe(e.config.locality?.architecturalBoundarySegments,n.architecturalBoundarySegments);return(n.target?q(e,o,n.target):Y(e,n.scope,n.scanLimit)).map(a=>K(o,s,a,n,r,c)).filter(a=>a.consumerFiles.length>=i||n.target).sort(ue).slice(0,t)}function q(e,n,t){let i=V(e,t);if(i)return[N(i)];let o=k(e,t);if(!o)return[];let s=n.definitionsForFile(o.relativePath).find(r=>r.symbolId===o.symbolId);return s?[X(s)]:[{unit:{kind:"symbol",file:o.relativePath,shortName:b(o.symbol),symbol:o.symbol,startLine:o.startLine,endLine:o.endLine}}]}function Y(e,n,t){let i=p(e,{scope:n,includeIgnored:!1}),o=L(t,i.length);return i.slice(0,o).map(s=>N(s))}function K(e,n,t,i,o,s){let r=t.definition?J(e,t.definition,i.semantic):Q(n,t.unit.file),c=t.definition?r.length>0?"exact":"none":r.length>0?"file-level":"none",m=t.unit.file,l=u(f.dirname(m)),a=ee(r),h=Z(l),B=w([...F(l),...a?F(a):[]]),y=ne(t.unit,l,a,r),g=te(y,t.unit,l,a,r,o,s),E=ae(t.unit,c,a,r,l,g.whyNoSuggestedHome),W=ce(t.unit,l,a,r,g.suggestedHome,g.whyNoSuggestedHome);return{actionTier:"signal",sourceUnit:t.unit,candidatePath:m,currentDirectory:l,directoryAncestry:h,consumerFiles:r,consumerCoverage:c,nearestCommonOwner:a,boundaryMarkers:B,recommendedTier:y,suggestedHome:g.suggestedHome,destinationConfidence:g.confidence,whyNoSuggestedHome:g.whyNoSuggestedHome,counterevidence:E,reasons:W,recommendation:le(y,g.suggestedHome,c)}}function J(e,n,t){let i=A(e,[n],{semantic:t!==!1,sourceFallback:!0});return H(i.get(n.symbolId)??[])}function Q(e,n){let t=[];for(let[i,o]of e.entries())i!==n&&o.has(n)&&t.push(i);return H(t)}function V(e,n){let t=D(n),i=p(e,{includeIgnored:!1}),o=i.find(r=>r===t);if(o)return o;let s=i.find(r=>r.endsWith(`/${t}`));return s||(i.find(r=>r.includes(t))??null)}function X(e){return{definition:e,unit:{kind:"symbol",file:e.relativePath,shortName:b(e.symbol),symbol:e.symbol,startLine:e.startLine,endLine:e.endLine}}}function N(e){return{unit:{kind:"file",file:e,shortName:f.basename(e)}}}function Z(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 o=t.slice(0,i+1).join("/");n.push({path:o,depth:i,markers:v(o)})}return n}function F(e){return e==="."?[]:I(e).map(({marker:n,prefix:t})=>`${n}: ${t}`)}function v(e){return w(I(e).map(({marker:n})=>n))}function I(e){let n=e.split("/").filter(Boolean),t=[];for(let i=0;i<n.length;i+=1){let o=_.get(n[i]);o&&t.push({marker:o,prefix:n.slice(0,i+1).join("/")})}return t}function ee(e){if(e.length===0)return null;let n=e.map(i=>u(f.dirname(i))),t=n[0].split("/").filter(Boolean);for(let i of n.slice(1)){let o=i.split("/").filter(Boolean),s=[],r=Math.min(t.length,o.length);for(let c=0;c<r&&t[c]===o[c];c+=1)s.push(t[c]);t=s}return t.length===0?".":t.join("/")}function ne(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":R(t,"package")?"package-level-shared":R(t,"app")?"app-level-shared":U(t,["feature","domain","module"])||U(n,["feature","domain","module"])?"feature-local-shared":"sibling-folder":"no-exact-consumers"}function te(e,n,t,i,o,s,r){let c=ie(e,i);if(c)return d(c);let m=me(n.file),l=re(e,t,m,o,r);if(l)return l;let a=i;if(u(t)===u(a))return d(`${t} is already the nearest common owner for its consumers.`);let h=oe(a,t,m,r);return h||se(a,t,m,s,r)}function ie(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 re(e,n,t,i,o){if(e==="same-file"){let s=i[0]??null;return s?S(s):d("No same-file consumer path was available.")}if(e==="sibling-folder"&&i.length===1){let s=u(f.dirname(i[0])),r=M(n,t,s,o);return r?d(r):S(s)}return null}function oe(e,n,t,i){return pe(e)?$(e,n,t,i,`Nearest shared owner ${e} is outside source root ${t}.`):null}function se(e,n,t,i,o){if(e===".")return d("The nearest common owner is the repository root.");let s=`${e}/shared`,r=$(s,n,t,o,`Proposed home ${s} is outside source root ${t}.`);return r.confidence==="withheld"||i.has(s)?r:d(`${s} does not exist in the indexed project.`)}function $(e,n,t,i,o){if(!P(e,t))return d(o);let s=M(n,t,e,i);return s?d(s):S(e)}function S(e){return{suggestedHome:e,confidence:"exact",whyNoSuggestedHome:null}}function d(e){return{suggestedHome:null,confidence:"withheld",whyNoSuggestedHome:e}}function ae(e,n,t,i,o,s){let r=["Report-only signal; review ownership before moving files."];return n==="none"&&r.push("No consumers were found in the current index."),n==="file-level"&&r.push("File-level import evidence can hide which exported unit is actually used."),(t==="."||t==="src")&&r.push("Nearest common owner is broad, so this is not enough evidence for automatic placement."),i.length===1&&r.push("Only one consumer was found; inlining or same-folder placement may be better than shared extraction."),e.kind==="file"&&r.push("File targets describe module locality, not symbol-level usage."),t&&o.startsWith(`${t}/`)&&r.push("Candidate already lives under the nearest common owner."),s&&r.push(`No exact suggested home: ${s}`),r}function ce(e,n,t,i,o,s){let r=[];return r.push(`${e.shortName} currently lives in ${n}.`),t?r.push(`${i.length} consumer file(s) share ${t} as their nearest common owner.`):r.push("No consumer owner could be inferred from the current index."),o?r.push(`Suggested home is ${o}.`):s&&r.push(`No exact suggested home: ${s}`),r}function le(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 ue(e,n){return T(n)-T(e)||e.candidatePath.localeCompare(n.candidatePath)}function T(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 de(e){let n=new Set(["."]);for(let t of e){let i=u(f.dirname(t));for(;!n.has(i)&&(n.add(i),i!==".");)i=u(f.dirname(i))}return n}function me(e){let n=x(e),t=n.indexOf("src");return t>=0?n.slice(0,t+1).join("/"):n.length<=1?".":n[0]}function P(e,n){let t=u(e),i=u(n);return i==="."||t===i||t.startsWith(`${i}/`)}function ge(e,n,t){let i=x(e),o=x(n);return(P(e,n)?i.slice(o.length):i).some(r=>t.has(r.toLowerCase()))}function M(e,n,t,i){return u(e)===u(t)||!ge(e,n,i)?null:`${e} is a named architectural boundary; an exact move to ${t} needs human design.`}function fe(...e){let n=new Set(O);for(let t of e)for(let i of t??[]){let o=he(i);o&&n.add(o)}return n}function he(e){let n=e.trim().toLowerCase();return n===""?null:n}function R(e,n){return v(e).includes(n)}function U(e,n){let t=v(e);return n.some(i=>t.includes(i))}function pe(e){let n=e.split("/").filter(Boolean),t=n[n.length-1];return t?G.has(t):!1}function D(e){return e.replaceAll("\\","/").replace(/^\.\//,"")}function u(e){let n=D(e);return n===""?".":n}function x(e){let n=D(e);return n==="."?[]:n.split("/").filter(Boolean)}function L(e,n){return!Number.isFinite(e)||e===void 0||e<1?n:Math.floor(e)}function H(e){return w([...e]).sort((n,t)=>n.localeCompare(t))}function w(e){return[...new Set(e)]}export{De as a};
|
|
2
|
+
//# sourceMappingURL=chunk-CO5GJRP7.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{a as ne,b as A,e as H,f as $,g as z,h as ie,i as te}from"./chunk-YWOOQ4FF.js";import{b as O}from"./chunk-B75HZHUP.js";import{a as T}from"./chunk-5OST6GYB.js";import{a as ee}from"./chunk-JCLDUKT6.js";import{a as D,b as S}from"./chunk-TQ5W2H3S.js";import{a as U}from"./chunk-TK7O5ER5.js";import{c as L,d as G,g as P}from"./chunk-JM72FNGA.js";import{a as _,b as j}from"./chunk-DS6QEB3G.js";import{b as X,d as J,e as Q}from"./chunk-XUGQU7PM.js";import{a as Y}from"./chunk-64MNV6AB.js";import{d as E}from"./chunk-7S5E7KWT.js";function fn(e,n,t={}){let{minSimilarity:i=.4,limit:r=20}=t,s=Me(e,n,{semantic:t.semantic!==!1});if(!s)return[];if(!P(s.symbol))return[];if(s.callees.size===0)return re(e,n,{minSimilarity:i,limit:r,scanLimit:t.scanLimit,candidateMode:t.sourceCandidateMode??"full"});let a=ye(e,s,i,{scanLimit:t.scanLimit,semantic:t.semantic!==!1});return a.length>0?a.slice(0,r):re(e,n,{minSimilarity:i,limit:r,scanLimit:t.scanLimit,candidateMode:t.sourceCandidateMode??"full"})}function ye(e,n,t,i){let r=W(e,{minCallees:3,scanLimit:i.scanLimit,semantic:i.semantic}),s=De(n,r),a=he(n,r),l=$(a),c=z(n.callees,a),m=[];for(let f of s){if(f.callees.size<3)continue;let d=z(f.callees,a),o=oe(n,f,a,{minSimilarity:t,requireSignificantShared:1,requireSharedCount:0,medianIdf:l,magnitudeA:c,magnitudeB:d});o&&m.push(o)}return m.sort((f,d)=>d.similarity-f.similarity),m}function he(e,n){let t=new Map(n.docFreq);for(let i of e.callees)t.set(i,(t.get(i)??0)+1);return H(t,n.corpus.length+1)}function oe(e,n,t,i){let r=Ce(e,n,t,i);if(!ke(r,i))return null;let{similarity:s,significantShared:a,trivialShared:l}=r,c=a.length>0?a:l,m=ue(c,"callees");return{symbolA:e.symbol,shortNameA:L(e.symbol),fileA:e.file,symbolB:n.symbol,shortNameB:L(n.symbol),fileB:n.file,similarity:s,similarityBasis:"callees",sharedCallees:c.map(L),uniqueToA:[...A(e.callees,n.callees)].map(L),uniqueToB:[...A(n.callees,e.callees)].map(L),...m}}function Fe(e,n,t,i){let r=i.magnitudeA??z(e.callees,t),s=i.magnitudeB??z(n.callees,t),a=0,l=0,c=0,m=i.medianIdf??$(t);for(let o of e.callees){if(!n.callees.has(o))continue;let g=t.get(o)??0;a+=g*g,c+=1,g>=m&&(l+=1)}if(c===0)return!1;let f=r*s;return(f>0?a/f:0)<i.minSimilarity?!1:l>=i.requireSignificantShared||c>=i.requireSharedCount}function Ce(e,n,t,i){return i.magnitudeA===void 0||i.magnitudeB===void 0?ie(e.callees,n.callees,t,{medianIdf:i.medianIdf}):te(e.callees,n.callees,t,{medianIdf:i.medianIdf,magnitudeA:i.magnitudeA,magnitudeB:i.magnitudeB})}function ke(e,n){if(e.similarity<n.minSimilarity)return!1;let t=e.significantShared.length+e.trivialShared.length;return e.significantShared.length>=n.requireSignificantShared||t>=n.requireSharedCount}function gn(e,n={}){let{minSimilarity:t=.5,limit:i=20,scope:r,minCallees:s=4,crossFileOnly:a=!1,scanLimit:l}=n,c=n.semantic!==!1,m=D(),f=0,d=0,o=0,g=0,u=0,p=0,b=0;return S("similar.all",()=>{let y=W(e,{minCallees:s,scope:r,scanLimit:l,semantic:c}),C=y.corpus;f=C.length;let x=n.focusFiles,k=[],B=0;return S("similar.all.pair-scan",()=>{for(let F=0;F<C.length;F+=1){let h=C[F],I=x?.has(h.file)??!1,w=y.weightedMagnitudes[F],M=new Set;for(let N of h.callees){let R=y.candidateIndexesByCallee.get(N);if(R)for(let v of R)v<=F||x&&!I&&!x.has(C[v].file)||M.add(v)}m&&(o+=M.size,M.size>0&&(d+=1));for(let N of M){let R=C[N];if(a&&h.file===R.file){m&&(u+=1);continue}if(le(h,R)){m&&(p+=1);continue}m&&(g+=1);let v=oe(h,R,y.idfWeights,{minSimilarity:t,requireSignificantShared:2,requireSharedCount:4,medianIdf:y.medianIdf,magnitudeA:w,magnitudeB:y.weightedMagnitudes[N]});v&&(xe(k,v,i,B),m&&(b+=1),B+=1)}}},()=>({corpusSize:f,candidateSets:d,candidatePairs:o,comparedPairs:g,crossFileSkips:u,signatureSkips:p,insertedResults:b,topResults:k.length})),S("similar.all.sort-project",()=>(k.sort((F,h)=>h.result.similarity-F.result.similarity||F.order-h.order),k.map(F=>F.result)),()=>({topResults:k.length}))},()=>({minSimilarity:t,limit:i,scope:r,minCallees:s,crossFileOnly:a,scanLimit:l,semantic:c,corpusSize:f,candidateSets:d,candidatePairs:o,comparedPairs:g,crossFileSkips:u,signatureSkips:p,insertedResults:b}))}function pn(e,n={}){let{minSimilarity:t=.5,scope:i,minCallees:r=4,crossFileOnly:s=!1,scanLimit:a}=n,l=n.semantic!==!1,c=D(),m=0,f=0,d=0,o=0,g=0,u=0,p=0;return S("similar.all-count",()=>{let b=W(e,{minCallees:r,scope:i,scanLimit:a,semantic:l}),y=b.corpus;m=y.length;let C=n.focusFiles;return S("similar.all-count.pair-scan",()=>{for(let x=0;x<y.length;x+=1){let k=y[x],B=C?.has(k.file)??!1,F=b.weightedMagnitudes[x],h=new Set;for(let I of k.callees){let w=b.candidateIndexesByCallee.get(I);if(w)for(let M of w)M<=x||C&&!B&&!C.has(y[M].file)||h.add(M)}c&&(d+=h.size,h.size>0&&(f+=1));for(let I of h){let w=y[I];if(s&&k.file===w.file){c&&(g+=1);continue}if(le(k,w)){c&&(u+=1);continue}c&&(o+=1),Fe(k,w,b.idfWeights,{minSimilarity:t,requireSignificantShared:2,requireSharedCount:4,medianIdf:b.medianIdf,magnitudeA:F,magnitudeB:b.weightedMagnitudes[I]})&&(p+=1)}}},()=>({corpusSize:m,candidateSets:f,candidatePairs:d,comparedPairs:o,crossFileSkips:g,signatureSkips:u,insertedResults:p})),p},()=>({minSimilarity:t,scope:i,minCallees:r,crossFileOnly:s,scanLimit:a,semantic:l,corpusSize:m,candidateSets:f,candidatePairs:d,comparedPairs:o,crossFileSkips:g,signatureSkips:u,insertedResults:p}))}function le(e,n){if(e.paramCount<0||n.paramCount<0)return!1;let t=Math.abs(e.paramCount-n.paramCount),i=Math.max(2,Math.ceil(Math.max(e.paramCount,n.paramCount)*.5));return t>i}function xe(e,n,t,i){if(t<=0)return;if(e.length<t){e.push({result:n,order:i});return}let r=0;for(let a=1;a<e.length;a+=1){let l=e[a],c=e[r];(l.result.similarity<c.result.similarity||l.result.similarity===c.result.similarity&&l.order>c.order)&&(r=a)}let s=e[r];n.similarity<=s.result.similarity||(e[r]={result:n,order:i})}var we=["ScipDatabase#all","ScipDatabase#get","ScipDatabase#prepare","ScipDatabase#pathExclusionsFor","ScipDatabase#isIgnored","ScipDatabase#symbolNoiseFor","PerDbValue#get","PerDbValue#has",":storage:db:ScipDatabase:all",":storage:db:ScipDatabase:get",":storage:db:ScipDatabase:prepare",":storage:db:ScipDatabase:pathExclusionsFor",":storage:db:ScipDatabase:isIgnored",":storage:db:ScipDatabase:symbolNoiseFor",":storage:per-db-cache:PerDbValue:get",":storage:per-db-cache:PerDbValue:has"];function Me(e,n,t){let i=U(e,n);if(!i||!P(i.symbol))return null;let r=new T(e),s=ee(e,i,{semantic:t.semantic});return{symbol:i.symbol,file:i.relativePath,callees:ce(s.map(a=>a.symbol)),paramCount:r.callableSignature(i)?.paramCount??-1}}var Le=E("callee-fingerprint-corpus",{clearGroups:["whole-project","definition-catalog"]}),Ie=E("callee-fingerprint-index",{clearGroups:["whole-project","definition-catalog"]});function Re(e,n){let{minCallees:t,scope:i,excludeSymbol:r,scanLimit:s}=n,a=n.semantic!==!1,l=Le.get(e,()=>new Map),c=`${t}|${i??""}|${s??""}|${a}`,m=!0,f=0,d=0;return S("similar.callee-fingerprints.resolve",()=>{let o=l.get(c);if(m=o!==void 0,o||(o=ze(e,{minCallees:t,scope:i,scanLimit:s,semantic:a}),l.set(c,o)),f=o.length,r===void 0)return o;let g=o.filter(u=>u.symbol!==r);return d=o.length-g.length,g},()=>({minCallees:t,scope:i,scanLimit:s,semantic:a,cacheHit:m,corpusSize:f,excludeSymbol:r!==void 0,excludedSymbols:d}))}function W(e,n){let{minCallees:t,scope:i,scanLimit:r}=n,s=n.semantic!==!1,a=Ie.get(e,()=>new Map),l=`${t}|${i??""}|${r??""}|${s}`,c=!0,m=0,f=0,d=0;return S("similar.callee-index.resolve",()=>{let o=a.get(l);return c=o!==void 0,o||(o=ve(Re(e,{minCallees:t,scope:i,scanLimit:r,semantic:s})),a.set(l,o)),m=o.corpus.length,f=o.docFreq.size,d=o.candidateIndexesByCallee.size,o},()=>({minCallees:t,scope:i,scanLimit:r,semantic:s,cacheHit:c,corpusSize:m,indexedCallees:f,candidateBuckets:d}))}function ve(e){let n=D(),t=0,i=S("similar.callee-index.doc-frequency",()=>{let o=new Map;for(let g of e)for(let u of g.callees)o.set(u,(o.get(u)??0)+1);return t=o.size,o},()=>({corpusSize:e.length,uniqueCallees:t})),r=Math.max(8,Math.ceil(Math.sqrt(e.length))),s=S("similar.callee-index.idf-weights",()=>H(i,e.length),()=>({corpusSize:e.length,uniqueCallees:i.size})),a=S("similar.callee-index.weighted-magnitudes",()=>e.map(o=>z(o.callees,s)),()=>({corpusSize:e.length})),l=0,c=0,m=0,f=S("similar.callee-index.candidate-buckets",()=>{let o=new Map;for(let g=0;g<e.length;g+=1){let u=e[g];for(let p of u.callees){if((i.get(p)??0)>r){n&&(c+=1);continue}let b=o.get(p);b||(b=[],o.set(p,b)),b.push(g),n&&(l+=1)}}return n&&(m=o.size),o},()=>({corpusSize:e.length,buckets:m,candidateRefs:l,ubiquitousSkips:c,ubiquityThreshold:r})),d=S("similar.callee-index.median-idf",()=>$(s),()=>({uniqueCallees:s.size}));return{corpus:e,candidateIndexesByCallee:f,docFreq:i,idfWeights:s,weightedMagnitudes:a,medianIdf:d,ubiquityThreshold:r}}function De(e,n){let t=new Map;for(let i of e.callees)for(let r of n.candidateIndexesByCallee.get(i)??[]){let s=n.corpus[r];s.symbol!==e.symbol&&t.set(s.symbol,s)}return t.size>0?[...t.values()]:n.corpus.filter(i=>i.symbol!==e.symbol)}function ze(e,n){let{minCallees:t,scope:i,scanLimit:r,semantic:s}=n,a=D(),l=new T(e),c=0,m=S("similar.callee-fingerprints.candidates",()=>{let u=O(l.productionCallableDefinitions({scope:i,minLoc:5,sortByLocDesc:typeof r=="number"&&r>0}),r);return c=u.length,u},()=>({scope:i,scanLimit:r,candidateCount:c})),f=0,d=S("similar.callee-fingerprints.callee-map",()=>{let u=l.calleeMap(m,{semantic:s});if(a)for(let p of u.values())f+=p.length;return u},()=>({candidateCount:c,semantic:s,calleeEdges:f})),o=0,g=0;return S("similar.callee-fingerprints.shape",()=>{let u=m.map(p=>({symbol:p.symbol,file:p.relativePath,callees:ce((d.get(p.symbolId)??[]).map(b=>b.symbol)),paramCount:l.callableSignature(p)?.paramCount??-1})).filter(p=>p.callees.size>=t);return o=u.length,a&&(g=u.reduce((p,b)=>p+b.callees.size,0)),u},()=>({candidateCount:c,fingerprintCount:o,retainedCalleeCount:g,minCallees:t}))}function ce(e){return new Set([...e].filter(n=>!Ee(n)))}function Ee(e){return we.some(n=>e.includes(n))}function re(e,n,t){let i=Be(e,n);if(!i||i.tokens.size<3)return[];let r=t.minSimilarity>=.5?t.minSimilarity:.3,s=[],a=t.candidateMode??"full",l=0,c=0,m=0,f=0;return S("similar.source-shape",()=>{let d=a==="target-pruned"?Ue(e,i,{minSimilarity:r,scanLimit:t.scanLimit}):Ge(i,_e(e,{scanLimit:t.scanLimit}));l=d.length;for(let o of d){if(o.symbol===i.symbol||o.tokens.size<3)continue;c+=1;let g=ne(i.tokens,o.tokens);if(g.size<2){m+=1;continue}let u=new Set([...i.tokens,...o.tokens]),p=u.size>0?g.size/u.size:0;if(p<r){f+=1;continue}s.push({symbolA:i.symbol,shortNameA:L(i.symbol),fileA:i.file,symbolB:o.symbol,shortNameB:L(o.symbol),fileB:o.file,similarity:p,similarityBasis:"source-tokens",sharedCallees:[...g].sort(),uniqueToA:[...A(i.tokens,o.tokens)].sort(),uniqueToB:[...A(o.tokens,i.tokens)].sort(),...ue([...g],"source-tokens")})}return s.sort((o,g)=>g.similarity-o.similarity||o.shortNameB.localeCompare(g.shortNameB)),s.slice(0,t.limit)},()=>({symbol:i.symbol,file:i.file,targetTokens:i.tokens.size,candidateMode:a,candidates:l,comparedPairs:c,sharedSkips:m,similaritySkips:f,results:s.length}))}function ue(e,n){let t=e.flatMap(V),i=e.flatMap(b=>se(b,n)),r=K(t,me),s=K(t,de),a=K(i,Z),l=[...new Set(i.filter(ae))],c=e.filter(b=>{let y=se(b,n);return y.some(C=>Z.has(C))&&y.some(ae)}).length,m=[];r.length>0&&m.push(`access/query scaffolding: ${r.slice(0,5).join(", ")}`),s.length>0&&m.push(`framework/generic scaffolding: ${s.slice(0,5).join(", ")}`),a.length>0&&m.push(`domain behavior verbs: ${a.slice(0,5).join(", ")}`),a.length>0&&l.length>0&&m.push(`domain-specific terms: ${l.slice(0,5).join(", ")}`);let f=n==="source-tokens"&&t.length>0&&t.every(b=>fe.has(b));f&&m.push("shared source tokens are generic scaffolding");let d=a.length>0&&l.length>0,o=r.length+s.length>0,g=n==="callees"&&d&&e.length>=4&&l.length>=4&&c>=2,u=g?"domain-behavior":d?o?"mixed":"domain-behavior":r.length>0?"access-query-scaffolding":s.length>0||f?"framework-scaffolding":"structural-overlap";u==="structural-overlap"&&e.length>0&&m.push(`shared ${n} overlap has no recognized domain or scaffolding category`);let p=u==="domain-behavior"&&(e.length>=3||g)?"direct":"signal";return{evidenceClass:u,actionTier:p,evidenceClassReasons:m,recommendation:Te(u,p)}}function Te(e,n){return n==="direct"?"Shared domain behavior looks concrete; review for an extract/reuse opportunity.":e==="mixed"?"Shared evidence mixes domain behavior with scaffolding; review semantics before extracting anything.":e==="access-query-scaffolding"?"Shared evidence is mostly access/query scaffolding; compare product semantics before reusing code.":e==="structural-overlap"?"Shared structure has no domain or scaffolding classification; inspect names and behavior before reusing code.":"Shared evidence is mostly framework or generic scaffolding; treat as a contextual signal."}function K(e,n){return[...new Set(e.filter(t=>n.has(t)))]}function V(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(n=>n.length>1)}function se(e,n){if(n==="source-tokens")return V(e);let t=G(e);return V(t.length>0?t:Ae(e))}function Ae(e){return e.replace(/[()`]/g," ").replace(/\.[a-z][a-z0-9]+(?=\s|$)/gi," ").split(/[:/\\\s]+/).map(i=>i.trim()).filter(i=>/[A-Za-z]/.test(i)).at(-1)?.replace(/\.$/,"")??e}function ae(e){return e.length>3&&!Z.has(e)&&!me.has(e)&&!de.has(e)&&!fe.has(e)&&!qe.has(e)}var Z=new Set(["archive","assign","book","cancel","create","delete","ensure","export","import","notify","persist","publish","restore","schedule","send","set","submit","sync","update","upload","validate","write"]),me=new Set(["access","auth","authorize","cache","context","db","find","get","guard","list","permission","permissions","prisma","query","request","response","role","route","session","sql","where"]),de=new Set(["bytes","computed","crypto","describe","effect","expect","fetch","filter","hex","hook","json","map","mounted","on","promise","random","react","reduce","ref","render","state","test","token","trim","uuid","vue","watch"]),fe=new Set(["bytes","crypto","data","false","get","hex","id","key","map","name","num","random","result","secret","set","string","to","token","true","type","value"]),qe=new Set(["best","backend","conflict","database","effect","effects","error","errors","frontend","found","helpers","javascript","module","modules","scip","shared","source","typescript","utils","with","workflow","workflows"]);function Be(e,n){let t=U(e,n);if(!t||!P(t.symbol))return null;let i=Ne(e,t);return i?{symbol:t.symbol,file:t.relativePath,tokens:i}:null}function Ne(e,n){let t=G(n.symbol),i=We(e,n.relativePath,n.startLine,n.endLine,t),r=Se(i,t);return r.size>0?r:null}var Pe=E("source-fingerprint-corpus",{clearGroups:["whole-project","definition-catalog"]}),Oe=E("source-fingerprint-index",{clearGroups:["whole-project","definition-catalog"]});function ge(e){return`${e.scanLimit??""}`}function $e(e,n={}){let t=Pe.get(e,()=>new Map),i=ge(n),r=t.get(i);return r||(r=Ze(e,n),t.set(i,r)),r}function _e(e,n={}){let t=Oe.get(e,()=>new Map),i=ge(n),r=t.get(i);return r||(r=je($e(e,n)),t.set(i,r)),r}function je(e){let n=new Map;for(let r of e)for(let s of r.tokens)n.set(s,(n.get(s)??0)+1);let t=Math.max(8,Math.ceil(Math.sqrt(e.length))),i=new Map;for(let r of e)for(let s of r.tokens){if((n.get(s)??0)>t)continue;let a=i.get(s);a||(a=[],i.set(s,a)),a.push(r)}return{corpus:e,candidateByToken:i,docFreq:n,ubiquityThreshold:t}}function Ge(e,n){let t=new Map;for(let i of e.tokens)for(let r of n.candidateByToken.get(i)??[])r.symbol!==e.symbol&&t.set(r.symbol,r);return t.size>0?[...t.values()]:n.corpus.filter(i=>i.symbol!==e.symbol)}function Ue(e,n,t){let i=D(),r=new T(e),s=He(n.tokens.size,t.minSimilarity),a=0,l=0,c=0,m=S("similar.source-shape.target-files",()=>{let u=[...n.tokens],p=[];for(let b of Y(e,{includeIgnored:!1})){a+=1;let y=_(e,b);y&&(l+=1,Ke(y,u,s)&&p.push(b))}return c=p.length,p},()=>({symbol:n.symbol,targetTokens:n.tokens.size,requiredSharedTokens:s,scannedFiles:a,readableFiles:l,candidateFiles:c})),f=0,d=S("similar.source-shape.target-definitions",()=>{let u=O(r.productionCallableDefinitions({files:m,sortByLocDesc:typeof t.scanLimit=="number"&&t.scanLimit>0}),t.scanLimit);return f=u.length,u},()=>({symbol:n.symbol,candidateFiles:c,scanLimit:t.scanLimit,definitionCount:f})),o=0;return S("similar.source-shape.target-fingerprints",()=>{let u=pe(e,d);return i&&(o=u.length),u},()=>({symbol:n.symbol,definitionCount:f,fingerprintCount:o})).filter(u=>u.symbol!==n.symbol)}function He(e,n){return Math.max(2,Math.ceil(e*n))}function Ke(e,n,t){if(n.length<t)return!1;let i=e.toLowerCase(),r=0;for(let s of n)if(Ve(i,s)&&(r+=1,r>=t))return!0;return!1}function Ve(e,n){return n==="num"?/\b\d+\b/.test(e):e.includes(n)}function Ze(e,n={}){let t=new T(e),{scanLimit:i}=n,r=O(t.productionCallableDefinitions({sortByLocDesc:typeof i=="number"&&i>0}),i);return pe(e,r)}function pe(e,n){let t=new Map;for(let r of n){let s=t.get(r.relativePath)??[];s.push(r),t.set(r.relativePath,s)}let i=new Map;for(let[r,s]of t){let a=_(e,r);if(!a)continue;let l=X(e,r,a),c=Je(e,r,l),m=!1,f=null;for(let d of s){let o=Xe(d),g=c.get(o),u=g?new Set(g.tokens):null;u||(f??=j(e,r),u=Se(be(f,d.startLine,d.endLine,d.leaf),d.leaf),c.set(o,{key:o,symbol:d.symbol,startLine:d.startLine,endLine:d.endLine,leaf:d.leaf,tokens:[...u].sort()}),m=!0),u.size>0&&i.set(d.symbol,{symbol:d.symbol,file:d.relativePath,tokens:u})}m&&Qe(e,r,l,c)}return n.map(r=>i.get(r.symbol)).filter(r=>!!r)}function We(e,n,t,i,r){let s=j(e,n);return s.length===0?"":be(s,t,i,r)}function be(e,n,t,i){if(t>=n&&t-n<=12)return e.slice(n,t+1).join(`
|
|
2
|
+
`);let r=[new RegExp(`\\bdef\\s+${q(i)}\\b`),new RegExp(`\\bfun\\s+${q(i)}\\b`),new RegExp(`\\bfn\\s+${q(i)}\\b`),new RegExp(`\\bfunction\\s+${q(i)}\\b`),new RegExp(`\\b${q(i)}\\s*\\(`)],s=e.findIndex(a=>r.some(l=>l.test(a)));if(s>=0){let a=s;for(let l=s+1;l<e.length&&l<=s+8;l++){let c=e[l]??"";if(l>s&&en(c)||(a=l,c.trim()===""&&l>s+1))break}return e.slice(s,a+1).join(`
|
|
3
|
+
`)}return e.slice(n,Math.min(e.length,n+8)).join(`
|
|
4
|
+
`)}function Xe(e){return`${e.symbol}\0${e.startLine}\0${e.endLine}\0${e.leaf}`}function Je(e,n,t){let i=J(e,"source-fingerprints",n,t);if(!i)return new Map;try{let r=JSON.parse(i);if(!Array.isArray(r.entries))return new Map;let s=new Map;for(let a of r.entries){if(!a||typeof a.key!="string"||typeof a.symbol!="string"||typeof a.startLine!="number"||typeof a.endLine!="number"||typeof a.leaf!="string"||!Array.isArray(a.tokens)||!a.tokens.every(l=>typeof l=="string"))return new Map;s.set(a.key,a)}return s}catch{return new Map}}function Qe(e,n,t,i){let r={entries:[...i.values()].sort((s,a)=>s.key.localeCompare(a.key))};Q(e,"source-fingerprints",n,t,JSON.stringify(r))}function Se(e,n){if(!e)return new Set;let t=new Set(["public","private","protected","final","static","class","def","fun","fn","function","return","string","bool","boolean","void","unit","self","this","new","const","let","var","end","pub"]),i=Ye(n),s=e.replace(/["'`]/g," ").replace(/\b\d+\b/g," NUM ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[^A-Za-z0-9_]+/g," ").replace(/_/g," ").toLowerCase().split(/\s+/).map(a=>a.trim()).filter(a=>a.length>1).filter(a=>!t.has(a)).filter(a=>!i.has(a));return new Set(s)}function Ye(e){return new Set(e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9_]+|_/).map(n=>n.toLowerCase()).filter(n=>n.length>1))}function en(e){return/^\s*(?:def|fun|fn|function|class|trait|module|object|enum|interface|public|private|protected)\b/.test(e)}function q(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}export{fn as a,he as b,gn as c,pn as d,xe as e,Re as f,W as g,ve as h,De as i,ce as j,ue as k};
|
|
5
|
+
//# sourceMappingURL=chunk-CW5YFOCP.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as g}from"./chunk-PFOCOG57.js";import{a as d}from"./chunk-5OST6GYB.js";import{a as c}from"./chunk-KDFONWTW.js";import{c as p}from"./chunk-JM72FNGA.js";import{a as u}from"./chunk-72KY2ZFO.js";import{a as o}from"./chunk-HF25DFSC.js";function F(r,t={}){let{scope:l,limit:s=30,scanLimit:b}=t,f=new d(r);return g({candidates:()=>f.productionCallableDefinitions({scope:l,files:t.files,minLoc:2,excludeRootedSymbols:!0,requireFunctionLikeSymbol:!0}).filter(e=>y(e.relativePath)),scanLimit:b,evaluate:e=>{let n=u(r,e.relativePath)?.callables.find(a=>a.startLine===e.startLine&&a.endLine===e.endLine);if(!n||n.params.length===0||n.params.some(a=>!a.simple)||n.paramsEndLine>=n.endLine)return null;let L=c(r,e.relativePath),m=[];for(let a=n.params.length-1;a>=0;a--){let i=n.params[a];if(i.name===""||i.name.startsWith("_")||h(L.get(i.name),n.paramsEndLine,n.endLine))break;m.unshift(i.name)}return m.length===0?null:{symbol:e.symbol,shortName:p(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,paramCount:n.paramCount,unusedTrailing:m}},orderResults:(e,n)=>n.unusedTrailing.length-e.unusedTrailing.length||e.file.localeCompare(n.file)||e.startLine-n.startLine,limit:s})}function y(r){let t=o(r);return t==="typescript"||t==="tsx"||t==="javascript"}function h(r,t,l){return r?r.some(s=>s>t&&s<=l):!1}export{F as a};
|
|
2
|
+
//# sourceMappingURL=chunk-E35O7UCB.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as g}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as g}from"./chunk-JCLDUKT6.js";import{a as u}from"./chunk-TK7O5ER5.js";import{c as i}from"./chunk-JM72FNGA.js";function w(r,b,y,f={}){let s=u(r,b),n=u(r,y);if(!s||!n)return null;let c=new Set(g(r,s,{semantic:f.semantic}).map(e=>e.symbol)),m=new Set(g(r,n,{semantic:f.semantic}).map(e=>e.symbol)),l=[];for(let e of c)m.has(e)&&l.push(e);let o=[];for(let e of c)m.has(e)||o.push(e);let a=[];for(let e of m)c.has(e)||a.push(e);let h=new Set([...c,...m]),d=h.size>0?l.length/h.size:0,t;h.size===0?t="Neither function calls other tracked symbols. There is no callee-pattern evidence for consolidation; inspect the source bodies directly.":l.length===0?t="These functions do not share any callees. They are not a callee-based consolidation candidate.":o.length===0&&a.length===0?t="These functions have identical tracked callee sets. They are a strong structural match, but identical callees do not prove interchangeable semantics; inspect signatures, control flow, and return values before consolidating.":o.length===0?t="A's tracked callees are a subset of B's. B may subsume part of A's structure, but verify signatures, guards, and non-call logic before replacing A with B.":a.length===0?t="B's tracked callees are a subset of A's. A may subsume part of B's structure, but verify signatures, guards, and non-call logic before replacing B with A.":o.length<=2&&a.length<=2?t=`Create a shared function with the ${l.length} common callees. Pass the ${o.length+a.length} divergent callees as parameters or strategy callbacks.`:t=`Extract the ${l.length} shared callees into a common helper. Each function calls the helper plus its own unique logic (${o.length} callees in A, ${a.length} in B).`;let p=s.endLine-s.startLine+1,A=n.endLine-n.startLine+1;return{symbolA:{symbol:s.symbol,shortName:i(s.symbol),file:s.relativePath,loc:p},symbolB:{symbol:n.symbol,shortName:i(n.symbol),file:n.relativePath,loc:A},similarity:d,sharedCallees:l.map(i),uniqueToA:o.map(i),uniqueToB:a.map(i),consolidationStrategy:t}}export{w as a};
|
|
2
|
+
//# sourceMappingURL=chunk-EXDQ35NN.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as r}from"./chunk-
|
|
1
|
+
import{a as r}from"./chunk-7B6LP46R.js";import{a as l}from"./chunk-TK7O5ER5.js";import{a as c}from"./chunk-VUKC6F77.js";import{c as d}from"./chunk-JM72FNGA.js";function p(e,t){let o=l(e,t);if(!o)return[];let n=e.get(`SELECT COUNT(DISTINCT c.document_id) AS file_count
|
|
2
2
|
FROM mentions m
|
|
3
3
|
JOIN chunks c ON m.chunk_id = c.id
|
|
4
4
|
WHERE m.symbol_id = ?
|
|
@@ -59,4 +59,4 @@ import{a as r}from"./chunk-LGX2Y4BA.js";import{a as l}from"./chunk-T633QLYF.js";
|
|
|
59
59
|
GROUP BY d.id
|
|
60
60
|
ORDER BY symbol_count DESC
|
|
61
61
|
LIMIT ?`,o).filter(i=>!e.isIgnored(i.relative_path)).map(i=>({name:i.relative_path,count:i.symbol_count}))}export{p as a,b,y as c,I as d};
|
|
62
|
-
//# sourceMappingURL=chunk-
|
|
62
|
+
//# sourceMappingURL=chunk-EY43NV4M.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{c as s,d as l}from"./chunk-BZ53S4ZN.js";import{a as u}from"./chunk-3VD3JMK2.js";import{a as p,b as m,c as f}from"./chunk-YWOOQ4FF.js";import{e as c}from"./chunk-HF25DFSC.js";function y(i,t={}){let{minSimilarity:r=.62,minTokens:e=8,limit:a=20,scope:d,scanLimit:g,filePattern:h,focusFiles:k}=t,P=c(i,{scope:d,minJsxTokens:e,scanLimit:g}).filter(n=>n.kind==="component").map(n=>({file:n.file,component:n.name,tokens:n.jsxTokens,profile:n}));return u({profiles:P,limit:a,filePattern:h,focusFiles:k,compare:(n,o)=>B(n,o,r),sort:(n,o)=>o.similarity-n.similarity||n.fileA.localeCompare(o.fileA)||n.componentA.localeCompare(o.componentA)||n.fileB.localeCompare(o.fileB)||n.componentB.localeCompare(o.componentB)})}function B(i,t,r){let e=p(i.tokens,t.tokens);if(e.size<6||!C(e))return null;let a=f(i.tokens,t.tokens);return a<r?null:{fileA:i.file,componentA:i.component,fileB:t.file,componentB:t.component,similarity:a,sharedTokens:l(e),sharedComponents:s(e,"component:"),sharedNativeTags:s(e,"native:"),sharedProps:s(e,"prop:"),sharedEvents:s(e,"event:"),sharedBindings:s(e,"binding:"),uniqueToA:l(m(i.tokens,t.tokens)).slice(0,25),uniqueToB:l(m(t.tokens,i.tokens)).slice(0,25),locA:i.profile.loc,locB:t.profile.loc}}function C(i){let t=0,r=0;for(let e of i)e.startsWith("component:")&&(t+=1),(e.startsWith("prop:")||e.startsWith("event:")||e.startsWith("native:")||e.startsWith("jsx:"))&&(r+=1);return t>=1||r>=4}export{y as a};
|
|
2
|
+
//# sourceMappingURL=chunk-FAYI6KZ5.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as c}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as c}from"./chunk-VUKC6F77.js";function j(e,s={}){let{minSimilarity:t=.5,limit:n=15,scope:i,minChainLength:r=3,maxChainLength:l=8}=s,a=c(e,i),o=y(a,r,l);if(o.length===0)return[];let f=d(o);return f.length<2?[]:S(x(f,t,n),n)}function d(e){let s=m(e),t=[];for(let n of e){let i=n.filter(r=>!s.has(r));i.length>=2&&t.push({original:n,filtered:i})}return t}function m(e){let{nodeFreq:s,tailFreq:t}=p(e),n=e.length*.9,i=e.length*.8,r=new Set;for(let[a,o]of s)o>n&&r.add(a);for(let[a,o]of t)o>i&&r.add(a);let l=["index.ts","index.js","cli.ts","main.ts","health.ts","health.js"];for(let a of s.keys()){let o=a.split("/").pop()??"";l.includes(o)&&r.add(a)}return r}function p(e){let s=new Map,t=new Map;for(let n of e){let i=new Set;for(let r of n)i.has(r)||(s.set(r,(s.get(r)??0)+1),i.add(r));for(let r=Math.max(0,n.length-2);r<n.length;r++)t.set(n[r],(t.get(n[r])??0)+1)}return{nodeFreq:s,tailFreq:t}}function x(e,s,t){let n=[];for(let i=0;i<e.length;i++){for(let r=i+1;r<e.length;r++){let l=b(e[i],e[r],s);l&&n.push(l)}if(n.length>t*10)break}return n.sort((i,r)=>Math.abs(r.similarity-i.similarity)>.01?r.similarity-i.similarity:i.divergencePoints.length-r.divergencePoints.length),n}function b(e,s,t){if(!C(e.filtered,s.filtered))return null;let{distance:n,ops:i}=A(e.filtered,s.filtered),r=Math.max(e.filtered.length,s.filtered.length);if(r===0)return null;let l=1-n/r;if(l<t||n===0)return null;let a=i.filter(f=>f.type==="substitute").map(f=>({index:f.indexA,nodeA:e.filtered[f.indexA],nodeB:s.filtered[f.indexB]}));return a.length===0||i.filter(f=>f.type==="match").length<2?null:{chainA:e.original,chainB:s.original,similarity:l,editDistance:n,divergencePoints:a,commonPrefix:F(e.original,s.original),commonSuffix:B(e.original,s.original)}}function C(e,s){let t=new Set(e);return s.some(n=>t.has(n))}function S(e,s){let t=[];for(let n of e)if(t.some(r=>h(n.chainA,r.chainA)&&h(n.chainB,r.chainB))||t.push(n),t.length>=s)break;return t}function y(e,s,t){let n=[];for(let r of e.keys()){if(n.length>=500)break;g(e,r,[r],new Set([r]),s,t,n,500)}return n}function g(e,s,t,n,i,r,l,a){if(l.length>=a)return;if(t.length>=r){t.length>=i&&l.push([...t]);return}let o=e.get(s);if(!o||o.size===0){t.length>=i&&l.push([...t]);return}let f=!1;for(let u of o)if(!n.has(u)&&(n.add(u),t.push(u),g(e,u,t,n,i,r,l,a),t.pop(),n.delete(u),f=!0,l.length>=a))return;!f&&t.length>=i&&l.push([...t])}function A(e,s){let t=e.length,n=s.length,i=Array.from({length:t+1},()=>Array(n+1).fill(0));for(let o=0;o<=t;o++)i[o][0]=o;for(let o=0;o<=n;o++)i[0][o]=o;for(let o=1;o<=t;o++)for(let f=1;f<=n;f++)e[o-1]===s[f-1]?i[o][f]=i[o-1][f-1]:i[o][f]=1+Math.min(i[o-1][f],i[o][f-1],i[o-1][f-1]);let r=[],l=t,a=n;for(;l>0||a>0;)l>0&&a>0&&e[l-1]===s[a-1]?(r.unshift({type:"match",indexA:l-1,indexB:a-1}),l--,a--):l>0&&a>0&&i[l][a]===i[l-1][a-1]+1?(r.unshift({type:"substitute",indexA:l-1,indexB:a-1}),l--,a--):a>0&&i[l][a]===i[l][a-1]+1?(r.unshift({type:"insert",indexA:l,indexB:a-1}),a--):(r.unshift({type:"delete",indexA:l-1,indexB:a}),l--);return{distance:i[t][n],ops:r}}function F(e,s){let t=[];for(let n=0;n<Math.min(e.length,s.length)&&e[n]===s[n];n++)t.push(e[n]);return t}function B(e,s){let t=[],n=e.length-1,i=s.length-1;for(;n>=0&&i>=0&&e[n]===s[i];)t.unshift(e[n]),n--,i--;return t}function h(e,s){if(e.length>s.length)return!1;let t=s.join("\u2192"),n=e.join("\u2192");return t.includes(n)}export{j as a};
|
|
2
|
+
//# sourceMappingURL=chunk-FDEQIPPK.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-OLTESY4K.js";import{y as d}from"./chunk-OBGRLXWF.js";import{c as h,d as S,g as x}from"./chunk-2KHTSEIL.js";import{c as b}from"./chunk-JM72FNGA.js";import{a as g}from"./chunk-DS6QEB3G.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-FFVIFETB.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as R}from"./chunk-
|
|
1
|
+
import{a as R}from"./chunk-5OST6GYB.js";import{a as _,d as f}from"./chunk-C5CTSJ6X.js";import{a as c,b as m,c as s}from"./chunk-P5RYBRIO.js";import{c as d,e as p}from"./chunk-JM72FNGA.js";import{a as l}from"./chunk-DS6QEB3G.js";import{a}from"./chunk-64MNV6AB.js";function P(e,o={}){let{scope:r,limit:n}=o,t=new R(e),i=C([...h(e,r),...N(e,t,r)]);return D(i),n?i.slice(0,n):i}function h(e,o){let r=[];for(let n of E(e,o)){if(e.isIgnored(n.barrel_path)||e.isIgnored(n.original_path)||f(e,n.barrel_path)||l(e,n.barrel_path)&&s(e,n.barrel_path).length===0)continue;let t=S(e,n),i=t?.barrel_consumers??0,u=t?.direct_consumers??0;i!==0||u!==0||r.push({barrelFile:n.barrel_path,symbol:n.symbol,shortName:d(n.symbol),originalFile:n.original_path,barrelConsumers:i,directConsumers:u,...g(e,n.barrel_path)})}return r}function E(e,o){let r=o?`AND barrel_d.relative_path LIKE '%${o}%'`:"";return e.all(`SELECT DISTINCT
|
|
2
2
|
barrel_d.id AS barrel_doc_id,
|
|
3
3
|
barrel_d.relative_path AS barrel_path,
|
|
4
4
|
gs.id AS symbol_id,
|
|
@@ -58,4 +58,4 @@ import{a as R}from"./chunk-XPOZO76D.js";import{a as _,d as f}from"./chunk-ANIOIS
|
|
|
58
58
|
${e.pathExclusionsFor("consumer_d")}
|
|
59
59
|
GROUP BY consumer_d.id
|
|
60
60
|
)`,o.barrel_doc_id,o.symbol_id,o.barrel_doc_id,o.original_doc_id)}function N(e,o,r){let n=[];for(let t of y(e,r))x(e,t,t)>0||n.push(...I(e,o,t));return n}function y(e,o){return a(e,{scope:o,includeIgnored:!1}).filter(r=>s(e,r).length>0||c(e,r).length>0)}function I(e,o,r){let n=s(e,r).filter(i=>i.sourcePath&&!e.isIgnored(i.sourcePath)).flatMap(i=>b(e,o,r,i.sourcePath)),t=c(e,r).filter(i=>i.sourcePath&&!e.isIgnored(i.sourcePath)).flatMap(i=>b(e,o,r,i.sourcePath));return[...n,...t]}function b(e,o,r,n){let t=O(o,n);return t?[{barrelFile:r,symbol:t.symbol,shortName:d(t.symbol),originalFile:n,barrelConsumers:0,directConsumers:x(e,n,r),...g(e,r)}]:[]}function g(e,o){return _(e,o)?{actionTier:"signal",surfaceEvidence:["barrel file is declared on the package public surface"],recommendation:"Review the package API before removing this re-export; local consumers are zero, but external consumers may import through the public barrel."}:{actionTier:"direct",surfaceEvidence:[],recommendation:"Remove this unused re-export when the barrel is not part of an external API surface."}}function x(e,o,r){let n=new Set;for(let t of a(e,{includeIgnored:!1}))if(t!==r)for(let i of m(e,t))i.sourcePath===o&&n.add(t);return n.size}function O(e,o){let r=e.definitionsForFile(o);return r.find(n=>p(n.symbol)==="method")??r[0]??null}function C(e){let o=new Set,r=[];for(let n of e){let t=`${n.barrelFile}|${n.symbol}|${n.originalFile}`;o.has(t)||(o.add(t),r.push(n))}return r}function D(e){e.sort((o,r)=>r.directConsumers-o.directConsumers||o.barrelFile.localeCompare(r.barrelFile)||o.shortName.localeCompare(r.shortName))}export{P as a};
|
|
61
|
-
//# sourceMappingURL=chunk-
|
|
61
|
+
//# sourceMappingURL=chunk-FKCGBZAC.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as d}from"./chunk-
|
|
1
|
+
import{a as d}from"./chunk-RNM6LMCF.js";import{g as l}from"./chunk-2KHTSEIL.js";import{c as r}from"./chunk-JM72FNGA.js";function b(o,t={}){let{limit:n=30,scope:e}=t,i=e?`AND def_d.relative_path LIKE '%${e}%'`:"",m=o.all(`SELECT
|
|
2
2
|
gs.symbol,
|
|
3
3
|
COUNT(*) AS ref_count,
|
|
4
4
|
COUNT(DISTINCT ref_d.id) AS file_count,
|
|
@@ -22,4 +22,4 @@ import{a as d}from"./chunk-YNSVAJR6.js";import{g as l}from"./chunk-X3BJUFSN.js";
|
|
|
22
22
|
GROUP BY gs.id
|
|
23
23
|
ORDER BY ref_count DESC
|
|
24
24
|
LIMIT ?`,n).filter(s=>!o.isIgnored(s.defined_in)).map(s=>({symbol:s.symbol,shortName:r(s.symbol),refCount:s.ref_count,fileCount:s.file_count,definedIn:s.defined_in}));return m.length>0?m:f(o,e,n)}function f(o,t,n){return l(o,{scope:t}).filter(e=>!o.isIgnored(e.relativePath)).map(e=>u(o,e)).filter(e=>e.refCount>0).sort((e,i)=>i.refCount-e.refCount||i.fileCount-e.fileCount).slice(0,n)}function u(o,t){let n=d(o,t,{limit:500});return{symbol:t.symbol,shortName:r(t.symbol),refCount:n.length,fileCount:new Set(n.map(e=>e.file)).size,definedIn:t.relativePath}}export{b as a};
|
|
25
|
-
//# sourceMappingURL=chunk-
|
|
25
|
+
//# sourceMappingURL=chunk-FXNWFMKW.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as ce}from"./chunk-E35O7UCB.js";import{a as ae}from"./chunk-5GOLFJEO.js";import{a as S}from"./chunk-B32FX5KB.js";import{a as se}from"./chunk-7IVSJJZU.js";import{a as oe}from"./chunk-AVWPHM2Q.js";import{a as re}from"./chunk-C2QSK7E7.js";import{a as ie,c as ne}from"./chunk-CW5YFOCP.js";import{a as ee}from"./chunk-O6ZH6C6Y.js";import{a as te}from"./chunk-WUCEKFQC.js";import{a as X}from"./chunk-M4COR2H6.js";import{a as U,c as V,d as q,h as L,i as K}from"./chunk-NOJAM5ZV.js";import{a as W,b as A,e as Y}from"./chunk-P4KYUPBD.js";import{a as Q}from"./chunk-6QSOCTZT.js";import{b as Z}from"./chunk-USPV3T5K.js";import{a as E,c as _,d as z,e as O}from"./chunk-65AU3HFZ.js";import{g as H}from"./chunk-BSN22NRK.js";import{a as J}from"./chunk-QYB5P7GL.js";import{a as I}from"./chunk-5OST6GYB.js";import{f as F,g as v}from"./chunk-C5CTSJ6X.js";import{b as P}from"./chunk-TQ5W2H3S.js";import{d as T,e as N,f as M}from"./chunk-JM72FNGA.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 Be,readFileSync as Ee,writeFileSync as Le}from"fs";import{isAbsolute as Ke,join as Ne}from"path";var Me=75e3,Pe=5e3,Ie=2500;function He(e){let i=re(e);return i.symbols>=Me||i.documents>=Pe?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 Pt(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(!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-G5UPYQGL.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as b}from"./chunk-PFOCOG57.js";import{a as u}from"./chunk-5OST6GYB.js";import{c as p}from"./chunk-JM72FNGA.js";function C(e,r){let{scope:c,minLoc:l=10,limit:s=30,scanLimit:a}=r??{},o=new u(e);return b({candidates:()=>o.productionCallableDefinitions({scope:c,minLoc:l,requireCallableSymbol:!0,includeSuppressed:!0,sortByLocDesc:typeof a=="number"&&a>0}),scanLimit:a,prepare:t=>({callerMap:o.crossFileCallerMap(t,{semantic:r?.semantic!==!1}),calleeMap:o.calleeMap(t,{semantic:r?.semantic!==!1})}),evaluate:(t,n)=>d(t,n,l),orderResults:(t,n)=>n.score-t.score||n.loc-t.loc,limit:s})}function d(e,r,c){let l=e.endLine-e.startLine+1;if(l<c)return null;let s=r.callerMap.get(e.symbolId)?.size??0,a=r.calleeMap.get(e.symbolId)??[],o=new Set,t=new Set;for(let m of a){let i=`${m.symbol}|${m.file}`;o.add(i),m.file!==e.relativePath&&t.add(i)}let n=t.size,y=o.size;return{symbol:e.symbol,shortName:p(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:l,fanIn:s,fanOut:n,calleeCount:y,score:Math.round(l/50*(s/5)*Math.max(n/5,1)*100)/100}}export{C as a};
|
|
2
|
+
//# sourceMappingURL=chunk-GQBMH2TQ.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as F}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as F}from"./chunk-P5RYBRIO.js";import{d as x}from"./chunk-JM72FNGA.js";import{a as v,d as S}from"./chunk-HF25DFSC.js";import{a as L,b as y}from"./chunk-DS6QEB3G.js";import{b as m,d as g,e as d}from"./chunk-XUGQU7PM.js";import{c as p}from"./chunk-7S5E7KWT.js";var C=p("definition-consumer-file-usage",{clearGroups:["whole-project","source-file"]});function k(t,e,r){return t.callerFileMap(e,{semantic:r.semantic,sourceFallback:r.sourceFallback})}function z(t,e,r){let n=[],i=0,s=0,c=x(e.symbol);for(let a of r)_(t,a,e.relativePath,c)?i++:h(t,a,c)?s++:n.push(a);return{realConsumers:n,barrelConsumers:i,importOnlyConsumers:s}}function h(t,e,r){if(!r)return!1;let n=v(e);if(!n)return!1;let i=C.get(t,e,()=>b(t,e,n));return i.importedLeaves.has(r)&&!i.usedLeaves.has(r)}function b(t,e,r){let n=L(t,e);if(!n)return U();let i=m(t,e,n),s=g(t,"consumer-file-usage",e,i);if(s){let a=E(s);if(a)return a}let c=w(t,e,r);return d(t,"consumer-file-usage",e,i,D(c)),c}function w(t,e,r){let n=new Set,i=new Set,s=S(t,e);if(!s)return{importedLeaves:n,usedLeaves:i};let c=r==="rust"?new Set(["use_declaration"]):r==="python"?new Set(["import_statement","import_from_statement"]):new Set(["import_statement"]),a=(o,f)=>{let u=f||c.has(o.type);(o.type==="identifier"||o.type==="type_identifier"||o.type==="property_identifier"||o.type==="field_identifier")&&(u?n.add(o.text):i.add(o.text));for(let l of o.children)a(l,u)};return a(s.rootNode,!1),{importedLeaves:n,usedLeaves:i}}function U(){return{importedLeaves:new Set,usedLeaves:new Set}}function D(t){return JSON.stringify({importedLeaves:[...t.importedLeaves],usedLeaves:[...t.usedLeaves]})}function E(t){try{let e=JSON.parse(t);return!Array.isArray(e.importedLeaves)||!Array.isArray(e.usedLeaves)?null:{importedLeaves:new Set(e.importedLeaves.filter(r=>typeof r=="string")),usedLeaves:new Set(e.usedLeaves.filter(r=>typeof r=="string"))}}catch{return null}}function _(t,e,r,n){if(!n)return!1;let i=y(t,e);if(i.length===0)return!1;let s=F(t,e);if(s.length===0)return!1;let c=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`\\b${c}\\b`),o=0;for(let f=0;f<i.length;f++){if(!a.test(i[f]??""))continue;if(o++,!s.find(l=>l.startLine<=f&&f<=l.endLine))return!1}return o>0}export{k as a,z as b,h as c};
|
|
2
|
+
//# sourceMappingURL=chunk-GRJY65YT.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as p,b as k,e as g,g as b,i as C}from"./chunk-DS6QEB3G.js";import{b as y,d as S,e as v,j as _,k as l}from"./chunk-XUGQU7PM.js";import{c as T}from"./chunk-A536TEU4.js";import{e as N,f as x}from"./chunk-7S5E7KWT.js";import{extname as R}from"path";var G={".rs":"rust",".ts":"typescript",".mts":"typescript",".cts":"typescript",".tsx":"tsx",".js":"javascript",".jsx":"javascript",".mjs":"javascript",".cjs":"javascript",".py":"python",".pyi":"python",".java":"java",".kt":"kotlin",".kts":"kotlin",".scala":"scala",".sc":"scala",".rb":"ruby",".c":"c",".h":"c",".cc":"cpp",".cpp":"cpp",".cxx":"cpp",".hpp":"cpp",".hh":"cpp",".hxx":"cpp",".cs":"csharp",".php":"php",".vb":"vb"};function d(e){return G[R(e).toLowerCase()]??null}function j(e){return R(e).toLowerCase()===".vue"}import{extname as Y}from"path";import{parse as Q}from"@vue/compiler-sfc";function w(e){let t=Q(e),n=t.descriptor.scriptSetup??t.descriptor.script;if(!n||n.src)return null;let s=b(n.lang??null);return s?{body:n.content,startLine:Math.max(0,n.loc.start.line-1),language:s}:null}var L=x("ast-trees",{clearGroups:["whole-project","source-file"]});function A(e,t){if(j(t))return X(e,t);let n=d(t);if(!n)return null;let s=p(e,t);return s?L.get(e,t,s,()=>g(n,s)):null}function X(e,t){let n=p(e,t);return n?L.get(e,t,n,()=>{let s=w(n);if(!s)return null;let o=`
|
|
2
|
+
`.repeat(s.startLine)+s.body;return g(s.language,o)}):null}var ee=[".tsx",".jsx"],F=new Set(["useActionState","useCallback","useContext","useDebugValue","useDeferredValue","useEffect","useId","useImperativeHandle","useInsertionEffect","useLayoutEffect","useMemo","useOptimistic","useReducer","useRef","useState","useSyncExternalStore","useTransition"]),te=new Set(["useEffect","useInsertionEffect","useLayoutEffect"]),ne=new Set(["useActionState","useOptimistic","useReducer","useRef","useState"]),se=new Set(["useLocation","useNavigate","useParams","useSearchParams","useTranslation"]),oe=new Set(["axios","fetch","gql","graphql","mutate","query","request","useMutation","useQuery","useSuspenseQuery"]),re=new Set(["add","apply","cancel","change","clear","close","create","delete","fetch","filter","handle","load","open","refresh","remove","render","reset","save","select","submit","toggle","update"]),ae=new Set(["children","className","false","key","null","style","true","undefined"]),ie=new Set(["aria-hidden","className","clipRule","d","fill","fillRule","height","role","stroke","strokeLinecap","strokeLinejoin","strokeWidth","style","viewBox","width","xmlns"]),ce=N("react-component-behavior-profiles");function et(e,t={}){let n=T(e,{extensions:ee}).filter(o=>!t.scope||o.includes(t.scope)).sort();return(typeof t.scanLimit=="number"&&t.scanLimit>0?n.slice(0,t.scanLimit):n).flatMap(o=>le(e,o)).filter(o=>(t.minJsxTokens===void 0||o.jsxTokens.size>=t.minJsxTokens)&&(t.minBehaviorTokens===void 0||o.behaviorTokens.size>=t.minBehaviorTokens))}function le(e,t){let n=t.replace(/\\/g,"/"),s=p(e,n);return ce.get(e,n,s,()=>ue(e,n,s)).map(pe)}function ue(e,t,n){let s=y(e,t,n),o=S(e,"react-component-behavior-profiles",t,s);if(o){let r=de(o);if(r)return r}let a=me(e,t);return v(e,"react-component-behavior-profiles",t,s,fe(a)),a}function me(e,t){let n=ge(t);if(!n)return[];let s=A(e,t);if(!s)return[];let o=k(e,t).length;return Ne(s.rootNode,n).filter(r=>r.kind==="hook"||$(r.bodyNode)).map(r=>{let i=ke(r.bodyNode),u=Re(r.bodyNode,n);return{file:t,name:r.name,kind:r.kind,startLine:r.node.startPosition.row,endLine:r.node.endPosition.row,loc:Math.max(1,r.node.endPosition.row-r.node.startPosition.row+1),fileLines:o,jsxTokens:i.tokens,behaviorTokens:u.tokens,componentNames:m(i.componentNames),nativeTags:m(i.nativeTags),propNames:m(i.propNames),eventNames:m(i.eventNames),hookNames:m(u.hookNames),requestNames:m(u.requestNames),stateNames:m(u.stateNames),effectNames:m(u.effectNames),handlerNames:m(u.handlerNames)}})}function pe(e){return{...e,jsxTokens:new Set(e.jsxTokens),behaviorTokens:new Set(e.behaviorTokens),componentNames:[...e.componentNames],nativeTags:[...e.nativeTags],propNames:[...e.propNames],eventNames:[...e.eventNames],hookNames:[...e.hookNames],requestNames:[...e.requestNames],stateNames:[...e.stateNames],effectNames:[...e.effectNames],handlerNames:[...e.handlerNames]}}function fe(e){return JSON.stringify(e.map(t=>({...t,jsxTokens:[...t.jsxTokens],behaviorTokens:[...t.behaviorTokens]})))}function de(e){try{let t=JSON.parse(e);if(!Array.isArray(t))return null;let n=[];for(let s of t){let o=he(s);if(!o)return null;n.push(o)}return n}catch{return null}}function he(e){if(!_(e))return null;let{file:t,name:n,kind:s,startLine:o,endLine:a,loc:r,fileLines:i,jsxTokens:u,behaviorTokens:J,componentNames:z,nativeTags:D,propNames:I,eventNames:V,hookNames:H,requestNames:Z,stateNames:M,effectNames:K,handlerNames:U}=e;if(typeof t!="string"||typeof n!="string"||s!=="component"&&s!=="hook"||!h(o)||!h(a)||!h(r)||!h(i))return null;let c={jsxTokens:l(u),behaviorTokens:l(J),componentNames:l(z),nativeTags:l(D),propNames:l(I),eventNames:l(V),hookNames:l(H),requestNames:l(Z),stateNames:l(M),effectNames:l(K),handlerNames:l(U)};return Object.values(c).some(W=>W===null)?null:{file:t,name:n,kind:s,startLine:o,endLine:a,loc:r,fileLines:i,jsxTokens:new Set(c.jsxTokens),behaviorTokens:new Set(c.behaviorTokens),componentNames:c.componentNames,nativeTags:c.nativeTags,propNames:c.propNames,eventNames:c.eventNames,hookNames:c.hookNames,requestNames:c.requestNames,stateNames:c.stateNames,effectNames:c.effectNames,handlerNames:c.handlerNames}}function h(e){return typeof e=="number"&&Number.isFinite(e)}function ge(e){let t=Y(e).toLowerCase();return t!==".tsx"&&t!==".jsx"?null:d(e)}function Ne(e,t){let n=[],s=new Set,o=a=>{let r=xe(a);if(r&&!Se(a)){let i=`${r.name}:${r.node.startIndex}:${r.node.endIndex}`;s.has(i)||(s.add(i),n.push(r));return}for(let i of a.namedChildren)o(i)};return(t==="tsx"||t==="javascript")&&o(e),n}function xe(e){if(e.type==="function_declaration"){let a=O(e);return!a||!B(a)?null:{name:a,kind:P(a),node:e,bodyNode:e}}if(e.type!=="variable_declarator")return null;let t=e.childForFieldName("name")??e.namedChild(0),n=e.childForFieldName("value")??e.namedChild(1),s=f(t);if(!s||!n||!B(s))return null;let o=ye(n);return o?{name:s,kind:P(s),node:e,bodyNode:o}:null}function B(e){return/^[A-Z]/.test(e)||/^use[A-Z0-9_]/.test(e)}function P(e){return/^use[A-Z0-9_]/.test(e)?"hook":"component"}function ye(e){if(e.type==="arrow_function"||e.type==="function_expression")return e;if(e.type!=="call_expression")return null;let t=ve(e);return t!=="memo"&&t!=="forwardRef"?null:e.namedChildren.find(o=>o.type==="arguments")?.namedChildren.find(o=>o.type==="arrow_function"||o.type==="function_expression")??null}function Se(e){let t=e.parent;for(;t;){if(t.type==="function_declaration"||t.type==="function_expression"||t.type==="arrow_function"||t.type==="method_definition")return!0;t=t.parent}return!1}function O(e){return f(e.childForFieldName("name")??e.namedChild(0))}function ve(e){let t=e.childForFieldName("function")??e.namedChild(0);return t?t.text.split(".").pop()??t.text:null}function $(e){return e.type.startsWith("jsx_")?!0:e.namedChildren.some($)}function ke(e){let t={tokens:new Set,componentNames:new Set,nativeTags:new Set,propNames:new Set,eventNames:new Set},n=s=>{s.type==="jsx_opening_element"||s.type==="jsx_self_closing_element"?be(s,t):s.type==="jsx_expression"?Ce(s,t):s.type==="jsx_fragment"&&t.tokens.add("jsx:fragment");for(let o of s.namedChildren)n(o)};return n(e),t}function be(e,t){let n=Te(e),s=!1;if(n){let o=E(n);s=Fe(o),s?(t.componentNames.add(o),t.tokens.add(`component:${o}`)):(t.nativeTags.add(o),t.tokens.add(`native:${o}`))}for(let o of e.namedChildren)if(o.type==="jsx_attribute"){let a=_e(o);if(!a)continue;let r=E(a);if(r.startsWith("on")&&r.length>2){let i=r.slice(2).replace(/^[A-Z]/,u=>u.toLowerCase());t.eventNames.add(i),t.tokens.add(`event:${i}`)}else ie.has(r)||(t.propNames.add(r),t.tokens.add(`${s?"prop":"native-prop"}:${r}`))}else o.type==="jsx_spread_attribute"&&t.tokens.add("prop:spread")}function Ce(e,t){let n=e.text;(n.includes("&&")||n.includes("?"))&&t.tokens.add("jsx:conditional"),(n.includes(".map(")||n.includes(".flatMap("))&&t.tokens.add("jsx:list");for(let s of Be(n))ae.has(s)||t.tokens.add(`binding:${s}`)}function Te(e){for(let t of e.namedChildren)if(t.type==="identifier"||t.type==="jsx_identifier"||t.type==="property_identifier"||t.type==="member_expression"||t.type==="jsx_member_expression")return t.text;return/^<\s*([A-Za-z][\w$.]*)/.exec(e.text)?.[1]??null}function _e(e){for(let t of e.namedChildren)if(t.type==="property_identifier"||t.type==="identifier"||t.type==="jsx_identifier")return t.text;return/^([A-Za-z_$][\w$:-]*)/.exec(e.text)?.[1]??null}function Re(e,t){let n={tokens:new Set,hookNames:new Set,requestNames:new Set,stateNames:new Set,effectNames:new Set,handlerNames:new Set},s=o=>{if(o.type==="call_expression"){let a=C(o,t);a&&je(a.calleeLeaf,n)}else if(o.type==="variable_declarator")Le(o,n);else if(o.type==="function_declaration"){let a=O(o);a&&q(a,n)}for(let a of o.namedChildren)s(a)};return s(e),n}function je(e,t){/^use[A-Z0-9_]/.test(e)&&(t.hookNames.add(e),!F.has(e)&&!se.has(e)&&t.tokens.add(`hook:${e}`)),F.has(e)&&t.tokens.add(`react-hook:${e}`),te.has(e)&&(t.effectNames.add(e),t.tokens.add(`effect:${e}`)),ne.has(e)&&t.tokens.add(`state-hook:${e}`),we(e)&&(t.requestNames.add(e),t.tokens.add(`request:${e}`))}function we(e){if(oe.has(e))return!0;let t=/^use([A-Z0-9_].*)$/.exec(e)?.[1];return t?/(Query|Mutation|Fetch|Resource)$/.test(t):!1}function Le(e,t){let n=e.childForFieldName("name")??e.namedChild(0),s=e.childForFieldName("value")??e.namedChild(1);if(n?.type==="array_pattern"&&s?.text.includes("useState")){let a=n.namedChildren.find(i=>f(i)),r=f(a);r&&(t.stateNames.add(r),t.tokens.add(`state:${r}`))}let o=f(n);o&&q(o,t)}function q(e,t){let n=Ae(e);!n||!re.has(n)||(t.handlerNames.add(e),t.tokens.add(`handler:${e}`),t.tokens.add(`handler-verb:${n}`))}function Ae(e){let t=e.startsWith("handle")&&e.length>6?e.slice(6).replace(/^[A-Z]/,n=>n.toLowerCase()):e;return/^[a-z]+/.exec(t)?.[0]??null}function Fe(e){return/^[A-Z]/.test(e)||e.includes(".")}function E(e){return e.replace(/^this\./,"").replace(/\$/g,".")}function f(e){return e&&(e.type==="identifier"||e.type==="property_identifier"||e.type==="shorthand_property_identifier"||/^[A-Za-z_$][\w$]*$/.test(e.text))?e.text:null}function Be(e){let t=[];for(let n of e.matchAll(/\b[A-Za-z_$][\w$]*\b/g)){let s=n[0];t.includes(s)||t.push(s)}return t}function m(e){return[...e].sort()}export{d as a,j as b,w as c,A as d,et as e};
|
|
3
|
+
//# sourceMappingURL=chunk-HF25DFSC.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{c as o,d as a}from"./chunk-BZ53S4ZN.js";import{a as p}from"./chunk-3VD3JMK2.js";import{a as c,b as m,c as f}from"./chunk-YWOOQ4FF.js";import{c as u}from"./chunk-YZA6PPZL.js";function D(n,i={}){let{minSimilarity:t=.62,minTokens:e=8,limit:l=20,scope:d,scanLimit:h,filePattern:k,focusFiles:g}=i,P=C(n,{scope:d,minTokens:e,scanLimit:h});return p({profiles:P,limit:l,filePattern:k,focusFiles:g,compare:(r,s)=>T(r,s,t),sort:(r,s)=>s.similarity-r.similarity||r.fileA.localeCompare(s.fileA)||r.fileB.localeCompare(s.fileB)})}function C(n,i){return u(n,{scope:i.scope,minTemplateTokens:i.minTokens,scanLimit:i.scanLimit}).map(t=>({file:t.file,tokens:t.templateTokens,loc:v(t)}))}function v(n){return n.totalLines}function T(n,i,t){let e=c(n.tokens,i.tokens);if(e.size<6||!b(e))return null;let l=f(n.tokens,i.tokens);return l<t?null:{fileA:n.file,fileB:i.file,similarity:l,sharedTokens:a(e),sharedComponents:o(e,"component:"),sharedProps:o(e,"prop:"),sharedEvents:o(e,"event:"),sharedDirectives:o(e,"directive:"),sharedSlots:o(e,"slot:"),sharedIdentifiers:o(e,"id:"),uniqueToA:a(m(n.tokens,i.tokens)).slice(0,25),uniqueToB:a(m(i.tokens,n.tokens)).slice(0,25),locA:n.loc,locB:i.loc}}function b(n){let i=0,t=0;for(let e of n)e.startsWith("component:")&&(i+=1),(e.startsWith("prop:")||e.startsWith("event:")||e.startsWith("directive:")||e.startsWith("slot:"))&&(t+=1);return i>=1||t>=3}export{D as a};
|
|
2
|
+
//# sourceMappingURL=chunk-HHN2B5KA.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as p}from"./chunk-B75HZHUP.js";import{a as b}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as p}from"./chunk-B75HZHUP.js";import{a as b}from"./chunk-5OST6GYB.js";import{a as f}from"./chunk-RNM6LMCF.js";import{a as c}from"./chunk-JCLDUKT6.js";import{c as m}from"./chunk-JM72FNGA.js";function k(o,n={}){let{limit:s=20,scope:i,minFanIn:r=2,minFanOut:a=2,scanLimit:e}=n,u=new b(o);return p(u.productionCallableDefinitions({scope:i,requireCallableSymbol:!0,includeSuppressed:!0,sortByLocDesc:typeof e=="number"&&e>0}),e).map(t=>d(o,t,n.semantic!==!1)).filter(t=>t.fanIn>=r&&t.fanOut>=a).sort((t,l)=>l.score-t.score||l.fanIn-t.fanIn).slice(0,s)}function d(o,n,s){let i=new Set(f(o,n,{limit:500,semantic:s}).map(e=>e.file)).size,r=new Set(c(o,n,{limit:500,semantic:s}).filter(e=>e.file!==n.relativePath).map(e=>`${e.symbol}|${e.file}`)).size,a=i*r;return{symbol:n.symbol,shortName:m(n.symbol),fanIn:i,fanOut:r,score:a,definedIn:n.relativePath,actionTier:"signal",riskKind:"coordination-hotspot",evidenceReasons:[`${i} incoming file(s) reference this symbol`,`${r} distinct cross-file callee symbol(s) are reached from it`,`centrality score is ${a} (fan-in * fan-out)`],recommendation:"Review ownership, API stability, and caller groups before changing this central symbol; do not refactor solely from graph centrality."}}export{k as a};
|
|
2
|
+
//# sourceMappingURL=chunk-IHUETYFW.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{b as k}from"./chunk-
|
|
1
|
+
import{b as k}from"./chunk-USPV3T5K.js";import{a as D}from"./chunk-5OST6GYB.js";import{f as y,g as v}from"./chunk-C5CTSJ6X.js";import{p as S}from"./chunk-KDFONWTW.js";import{f as L}from"./chunk-2KHTSEIL.js";import{c as h}from"./chunk-JM72FNGA.js";function z(e,n={}){let{scope:s,minLoc:c=1,maxDepth:a=5,scanLimit:f}=n,t=new D(e),i=_(e,s,c,f),o=new P;for(let r of i)o.add(r);let m=[],I=[];i.length>0&&m.push(C(e,0,i,o));let b=i.map(r=>r.definition).filter(r=>r!==null),x=new Set(i.map(r=>r.symbol));for(let r=1;r<=a&&b.length>0;r++){let u=t.calleeMap(b,{semantic:!1}),E=new Set;for(let d of b)for(let l of u.get(d.symbolId)??[])x.has(l.symbol)||E.add(l.symbol);let p=[];for(let d of E){x.add(d);let l=F(e,d);if(!l||e.isIgnored(l.relativePath)||y(e,l.relativePath)||v(e,l.symbol,l.relativePath)||t.fileKind(l.relativePath)==="test"||t.hasSuppressionComment(l))continue;let g=B(e,l,o);g.removable?p.push(w(l,"cascade")):g.blockingFiles.length>0&&I.push({shortName:h(l.symbol),file:l.relativePath,blockingFiles:g.blockingFiles.slice(0,3)})}if(p.length===0)break;for(let d of p)o.add(d);m.push(C(e,r,p,o)),b=p.map(d=>d.definition).filter(d=>d!==null)}let N=m.reduce((r,u)=>r+u.loc,0),R=m.reduce((r,u)=>r+u.entries.length,0);return{batches:m,totalSymbols:R,totalLoc:N,blocked:I}}function _(e,n,s,c){let a=k(e,{scope:n,minLoc:s,skipBarrels:!0,deadCodeOnly:!0,scanLimit:c,semantic:!1}),f=[];for(let t of a.symbols)t.kind==="dead-code"&&(y(e,t.relativePath)||v(e,t.symbol,t.relativePath)||f.push({symbol:t.symbol,shortName:t.shortName,file:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:t.loc,evidence:"graph-fact",definition:F(e,t.symbol)}));return f}function w(e,n){return{symbol:e.symbol,shortName:h(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:e.endLine-e.startLine+1,evidence:n,definition:e}}function F(e,n){let s=e.get(`SELECT d.relative_path
|
|
2
2
|
FROM global_symbols gs
|
|
3
3
|
JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
|
|
4
4
|
JOIN documents d ON d.id = der.document_id
|
|
5
5
|
WHERE gs.symbol = ?
|
|
6
6
|
LIMIT 1`,n);return s?L(e,s.relative_path).find(c=>c.symbol===n)??null:null}function B(e,n,s){let c=S(e,n);if(c.length===0)return{removable:!1,blockingFiles:[]};let a=new Set;for(let f of c)f.file===n.relativePath&&f.line>=n.startLine&&f.line<=n.endLine||s.contains(f.file,f.line)||a.add(f.file);return{removable:a.size===0,blockingFiles:[...a]}}function C(e,n,s,c){let a=[...s].sort((i,o)=>i.file.localeCompare(o.file)||i.startLine-o.startLine),f=new Set(a.map(i=>i.file)),t=[];for(let i of f){let o=L(e,i);o.length>0&&o.every(m=>c.contains(i,m.startLine))&&t.push(i)}return{depth:n,entries:a.map(({definition:i,...o})=>o),loc:a.reduce((i,o)=>i+o.loc,0),filesEmptied:t.sort()}}var P=class{ranges=new Map;add(n){let s=this.ranges.get(n.file)??[];s.push({start:n.startLine,end:n.endLine}),this.ranges.set(n.file,s)}contains(n,s){let c=this.ranges.get(n);return c?c.some(a=>s>=a.start&&s<=a.end):!1}};export{z as a,P as b};
|
|
7
|
-
//# sourceMappingURL=chunk-
|
|
7
|
+
//# sourceMappingURL=chunk-JATUZIEH.js.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import{b as J,g as B,h as W,i as U,p as Y}from"./chunk-KDFONWTW.js";import{a as K,b as z,d as Q,f as V}from"./chunk-OLTESY4K.js";import{a as q,b as C}from"./chunk-TQ5W2H3S.js";import{a as x}from"./chunk-VUKC6F77.js";import{f as H,g as $,l as j,m as G}from"./chunk-2KHTSEIL.js";import{d as F,f as P}from"./chunk-JM72FNGA.js";import{d as E}from"./chunk-72KY2ZFO.js";import{a as T}from"./chunk-HF25DFSC.js";import{a as R}from"./chunk-DS6QEB3G.js";import{a as k,b as w,f as N,h as O}from"./chunk-XUGQU7PM.js";import{c as A,d as D}from"./chunk-7S5E7KWT.js";function De(e,n,l={}){let o=X(e,[n],{additive:l.additive,semantic:l.semantic}),i=l.callableOnly?(o.get(n.symbolId)??[]).filter(a=>P(a.symbol)):o.get(n.symbolId)??[];return typeof l.limit=="number"?i.slice(0,l.limit):i}function ke(e,n,l={}){let o=oe(e)?le(e,n,{semantic:l.semantic!==!1}):ie(e).get(n.symbolId)??[];return typeof l.limit=="number"?o.slice(0,l.limit):o}var ne=D("caller-rows",{clearGroups:["whole-project"]}),te=2e4;function oe(e){return(e.get("SELECT COUNT(*) AS count FROM global_symbols")?.count??0)>te}function ie(e){return ne.get(e,()=>{let n=$(e),l=X(e,n),o=new Map;for(let r of n)o.set(r.symbol,r.symbolId);let i=new Map,a=new Map;for(let r of n){let s=l.get(r.symbolId);if(!(!s||s.length===0))for(let u of s){let m=o.get(u.symbol);if(m===void 0||m===r.symbolId)continue;let d=i.get(m);d||(d=[],i.set(m,d),a.set(m,new Set));let f=`${r.symbol}|${r.relativePath}`;a.get(m).has(f)||(a.get(m).add(f),d.push({symbol:r.symbol,file:r.relativePath,source:"caller-map-inversion"}))}}return i})}function le(e,n,l){let o=[],i=new Set,a=s=>{if(s.symbol===n.symbol)return;let u=`${s.symbol}|${s.file}`;i.has(u)||(i.add(u),o.push(s))};for(let s of Y(e,n))s.file!==n.relativePath&&a({symbol:s.enclosingSymbol??s.file,file:s.file,source:"resolved-reference"});let r=l.semantic?se(e,n):null;if(r)for(let s of Q(e,r)){if(s.file===n.relativePath||e.isIgnored(s.file))continue;let u=G(H(e,s.file),s.line);a({symbol:u?.symbol??s.file,file:s.file,source:"semantic-reference"})}return o}function se(e,n){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 (6, 12, 13) OR gs.symbol LIKE '%().' THEN 1 ELSE 0 END AS isFunctionLike,
|
|
11
|
+
CASE WHEN gs.kind IN (5, 8, 11) 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 X(e,n,l={}){if(n.length===0)return new Map;let o=l.additive??!1,i=[],a=[];for(let d of n)T(d.relativePath)&&E(e,d.relativePath)!==null?i.push(d):a.push(d);let r=new Map,s=new Map,u=d=>{for(let[f,t]of d){let g=r.get(f);g||(g=[],r.set(f,g));let c=s.get(f);c||(c=new Set,s.set(f,c));for(let p of t){let h=`${p.symbol}|${p.chunkId}`;c.has(h)||(c.add(h),g.push(p))}}};i.length>0&&u(de(e,i)),l.semantic!==!1&&u(be(ae(e,n)));let m=o?n:a;return m.length>0&&u(pe(e,m)),r}function ae(e,n){let l=q(),o=new Map,i=[],a=[],r=0,s=0,u=0,m=0;if(C("semantic.callees.cache-scan",()=>{for(let c of n){if(!K(c.relativePath)){l&&(r+=1);continue}let p=R(e,c.relativePath);if(!p){l&&(s+=1),a.push(c);continue}let h=w(e,c.relativePath,p),_=me(e,c.relativePath),b=N(e,c.relativePath,c.symbol,h,_);if(b!==null){let y=ce(b);if(y){l&&(u+=1),y.length>0&&o.set(c.symbolId,y);continue}l&&(m+=1)}i.push({def:c,contentHash:h,depsDigest:_})}},()=>({definitions:n.length,skippedNonTs:r,sourceMissing:s,cacheHits:u,parseFailures:m,misses:i.length,unkeyed:a.length,resultRows:o.size})),i.length===0&&a.length===0)return o;let d=[...a,...i.map(c=>c.def)],f=0,t=C("semantic.callees.compute-misses",()=>{let c=V(e,d);return f=c.size,c},()=>({definitions:d.length,misses:i.length,unkeyed:a.length,rows:f}));for(let[c,p]of t)o.set(c,p);if(z(e).availability().available){let c=i.map(p=>({relativePath:p.def.relativePath,symbol:p.def.symbol,contentHash:p.contentHash,depsDigest:p.depsDigest,payload:JSON.stringify(t.get(p.def.symbolId)??[])}));C("semantic.callees.cache-write",()=>O(e,c),()=>({entries:c.length}))}else C("semantic.callees.cache-write-skip",()=>{},()=>({reason:"provider-unavailable",misses:i.length}));return o}function ce(e){try{return JSON.parse(e)}catch{return null}}var re=A("semantic-deps-digest",{clearGroups:["whole-project","source-file"]});function me(e,n){return re.get(e,n,()=>{let o=[...x(e).get(n)??[]].sort().map(i=>`${i}:${w(e,i,R(e,i))}`);return k(o.join("|"))})}function de(e,n){let l=new Map,o=ue(n,l),i=U(e);for(let[a,r]of o){let s=E(e,a);if(!s)continue;let u=j(r);for(let m of s){let d=u.get(m.line);if(!d)continue;let f=fe(e,a,i,m.calleeLeaf,m.memberAccess);f&&f.symbol!==d.symbol&&l.get(d.symbolId).push({symbol:f.symbol,file:f.file,chunkId:m.line,source:"ast-callsite"})}}return l}function ue(e,n){let l=new Map;for(let o of e){let i=l.get(o.relativePath);i?i.push(o):l.set(o.relativePath,[o]),n.set(o.symbolId,[])}for(let o of l.values())o.sort((i,a)=>i.endLine-i.startLine-(a.endLine-a.startLine));return l}function fe(e,n,l,o,i){let a=B(n,l.get(o)??[]);return a.length===0?null:W(e,n,a,i)}function pe(e,n){if(n.length===0)return new Map;let o=L(n.map(t=>t.documentId)).flatMap(t=>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 (${t.map(()=>"?").join(",")})`,...t)),i=new Map;for(let t of o)i.has(t.document_id)||i.set(t.document_id,[]),i.get(t.document_id).push(t);let r=L(o.map(t=>t.symbol_id)).flatMap(t=>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 (${t.map(()=>"?").join(",")})
|
|
34
|
+
GROUP BY m.symbol_id
|
|
35
|
+
) def_chunk ON def_chunk.symbol_id = gs.id
|
|
36
|
+
WHERE gs.id IN (${t.map(()=>"?").join(",")})`,...t,...t)),s=L([...n.map(t=>t.documentId),...r.flatMap(t=>t.document_id===null?[]:[t.document_id])]),u=new Map(s.flatMap(t=>e.all(`SELECT id, relative_path FROM documents
|
|
37
|
+
WHERE id IN (${t.map(()=>"?").join(",")})`,...t).map(g=>[g.id,g.relative_path]))),m=new Map;for(let t of r)m.has(t.symbol_id)||m.set(t.symbol_id,{symbol:t.symbol,file:t.document_id!==null?u.get(t.document_id)??"":""});let d=new Map,f=u;for(let t of n){let g=i.get(t.documentId)??[],c=new Set,p=[],h=null,_=()=>{if(h)return h;let b=f.get(t.documentId)??"",y=new Set;if(b){let M=J(e,b),I=Math.max(0,t.startLine),v=Math.min(M.length-1,t.endLine);for(let S=I;S<=v;S+=1)for(let ee of M[S])y.add(ee)}return h=y,y};for(let b of g){if(b.symbol_id===t.symbolId)continue;let y=m.get(b.symbol_id);if(!y)continue;if(!(b.start_line>=t.startLine&&b.end_line<=t.endLine)){if(!(b.start_line<=t.endLine&&b.end_line>=t.startLine))continue;let S=F(y.symbol);if(!S||!_().has(S))continue}let I=`${y.symbol}|${b.chunk_id}`;c.has(I)||(c.add(I),p.push({...y,chunkId:b.chunk_id,source:"scip-chunk"}))}d.set(t.symbolId,p)}return d}var Z=500;function L(e){let n=[...new Set(e)],l=[];for(let o=0;o<n.length;o+=Z)l.push(n.slice(o,o+Z));return l}function be(e){let n=new Map;for(let[l,o]of e){let i=[];for(let a of o)i.push({symbol:a.symbol,file:a.file,chunkId:-1,source:"semantic-callee"});n.set(l,i)}return n}export{De as a,ke as b,X as c};
|
|
38
|
+
//# sourceMappingURL=chunk-JCLDUKT6.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as I}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as I}from"./chunk-54KGX7EX.js";import{a as H}from"./chunk-LSET2TXH.js";import{a as p}from"./chunk-JME7OWD3.js";import{a as T}from"./chunk-ZQDIXAF5.js";import{a as G}from"./chunk-VOYOYC5T.js";import{a as k}from"./chunk-BFXPG2VN.js";import{a as v,b as F}from"./chunk-6LJHXREW.js";import{b as D}from"./chunk-65AU3HFZ.js";import{b as S}from"./chunk-BSN22NRK.js";import{a as j}from"./chunk-6IR2AOBM.js";import{a as w}from"./chunk-VCQYSG2M.js";import{a as P}from"./chunk-7TWLSZK5.js";import{a as A}from"./chunk-Z4HICZGY.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?k(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,C=s?w(t,e,{maxDepth:o,scope:n.scope}):[],i=A(t,e,{semantic:l}),d=v(t,e),g=F(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||C.length>0,file:i!==null||d.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:C,changeSurface:i,deps:d,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);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:G(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-JGN2ZFJR.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as u}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as u}from"./chunk-5OST6GYB.js";import{a as h}from"./chunk-JCLDUKT6.js";import{q as S}from"./chunk-KDFONWTW.js";import{a as d,b}from"./chunk-TK7O5ER5.js";import{m as y}from"./chunk-2KHTSEIL.js";import{c as m}from"./chunk-JM72FNGA.js";function v(e,o,l={}){let{direction:c="backward",maxDepth:s=3}=l,r=d(e,o);return r?c==="backward"?w(e,r,s,{semantic:l.semantic!==!1}):M(e,r,{semantic:l.semantic!==!1}):null}function w(e,o,l,c){let s=[],r=new Set([o.symbol]),t=[o];for(let n=1;n<=l&&t.length!==0;n++){let i=[];for(let p of t){let g=h(e,p,{semantic:c.semantic});for(let a of g){if(r.has(a.symbol))continue;r.add(a.symbol),s.push({symbol:a.symbol,shortName:m(a.symbol),file:a.file,relationship:n===1?"referenced within definition (callee)":`depth ${n} callee`});let f=b(e,a.symbol);f&&!e.isIgnored(f.relativePath)&&i.push(f)}}t=i}return{symbol:o.symbol,shortName:m(o.symbol),direction:"backward",connectedSymbols:s}}function M(e,o,l){let c=new Set,s=[],r=new u(e);for(let t of S(e,o,{semantic:l.semantic})){if(s.length>=30)break;let n=t.enclosingSymbol??y(r.definitionsForFile(t.file),t.line)?.symbol??null;if(!n||n===o.symbol)continue;let i=b(e,n);!i||e.isIgnored(i.relativePath)||c.has(i.symbol)||(c.add(i.symbol),s.push({symbol:i.symbol,shortName:m(i.symbol),file:i.relativePath,relationship:`references target at ${t.file}:${t.line+1}`}))}return s.sort((t,n)=>t.file.localeCompare(n.file)),{symbol:o.symbol,shortName:m(o.symbol),direction:"forward",connectedSymbols:s}}export{v as a};
|
|
2
|
+
//# sourceMappingURL=chunk-JME7OWD3.js.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import{d as F}from"./chunk-OLTESY4K.js";import{c as R}from"./chunk-TK7O5ER5.js";import{b as h}from"./chunk-P5RYBRIO.js";import{u as w}from"./chunk-OBGRLXWF.js";import{f as y,m as _}from"./chunk-2KHTSEIL.js";import{d}from"./chunk-JM72FNGA.js";import{a as S}from"./chunk-72KY2ZFO.js";import{a as k}from"./chunk-HF25DFSC.js";import{a as m}from"./chunk-DS6QEB3G.js";import{c as E}from"./chunk-A536TEU4.js";import{c as u,d as v}from"./chunk-7S5E7KWT.js";function I(e,t,n,r={}){if(!n)return[];let i=m(e,t);return i?i.indexOf(n)===-1?[]:(N(e,t).get(n)??[]).filter(s=>!J(s,r)):[]}function J(e,t){return typeof t.excludeStartLine=="number"&&typeof t.excludeEndLine=="number"&&e>=t.excludeStartLine&&e<=t.excludeEndLine}var U=u("file-identifiers",{clearGroups:["whole-project","source-file"]});function A(e,t){let n=S(e,t);return n?n.fileIdentifiers:U.get(e,t,()=>new Set(N(e,t).keys()))}var Z=u("file-ident-lines",{clearGroups:["whole-project","source-file"]});function N(e,t){let n=S(e,t);return n?n.identifierLineMap:Z.get(e,t,()=>Y(e,t))}var W=u("file-idents-by-line",{clearGroups:["whole-project","source-file"]});function me(e,t){let n=S(e,t);return n?n.identifiersByLine:W.get(e,t,()=>{let r=N(e,t),i=0;for(let s of r.values()){let o=s[s.length-1];o!==void 0&&o>i&&(i=o)}let a=new Array(i+1);for(let s=0;s<=i;s+=1)a[s]=new Set;for(let[s,o]of r)for(let c of o)a[c].add(s);return a})}function Y(e,t){let n=new Map,r=(o,c)=>{let l=n.get(o);if(!l){n.set(o,[c]);return}l[l.length-1]!==c&&l.push(c)},i=m(e,t);if(!i)return n;let a=w(i).split(/\r?\n/),s=/\b([A-Za-z_$][\w$]*)\b/g;for(let o=0;o<a.length;o+=1){let c=a[o]??"";for(let l of c.matchAll(s))l[1]&&r(l[1],o)}return n}function pe(e,t){return x(e,t,n=>{let r=n?`AND m.symbol_id IN (${n.map(()=>"?").join(",")})`:"";return e.all(`SELECT
|
|
2
|
+
m.symbol_id,
|
|
3
|
+
d.relative_path,
|
|
4
|
+
COUNT(*) AS ref_count
|
|
5
|
+
FROM mentions m
|
|
6
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
7
|
+
JOIN documents d ON c.document_id = d.id
|
|
8
|
+
WHERE m.role != 1
|
|
9
|
+
${r}
|
|
10
|
+
${e.pathExclusionsFor("d")}
|
|
11
|
+
GROUP BY m.symbol_id, d.relative_path`,...n??[])})}function ge(e,t){return x(e,t,n=>{let r=n?`AND m.symbol_id IN (${n.map(()=>"?").join(",")})`:"";return e.all(`SELECT DISTINCT m.symbol_id, d.relative_path
|
|
12
|
+
FROM mentions m
|
|
13
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
14
|
+
JOIN documents d ON c.document_id = d.id
|
|
15
|
+
WHERE m.role != 1
|
|
16
|
+
${r}
|
|
17
|
+
${e.pathExclusionsFor("d")}`,...n??[])}).filter(n=>n.symbol_id!==null)}function O(e,t){return x(e,t,n=>{let r=n?`AND m.symbol_id IN (${n.map(()=>"?").join(",")})`:"";return e.all(`SELECT DISTINCT m.symbol_id, d.relative_path, c.document_id,
|
|
18
|
+
c.start_line AS chunk_start, c.end_line AS chunk_end
|
|
19
|
+
FROM mentions m
|
|
20
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
21
|
+
JOIN documents d ON c.document_id = d.id
|
|
22
|
+
WHERE m.role != 1
|
|
23
|
+
${r}
|
|
24
|
+
${e.pathExclusionsFor("d")}
|
|
25
|
+
ORDER BY d.relative_path, c.start_line`,...n??[])})}function x(e,t,n){if(!t)return n();if(t.length===0)return[];let r=[];for(let i=0;i<t.length;i+=750)r.push(...n(t.slice(i,i+750)));return r}function L(e){return e.replace(/\\/g,"/").replace(/^\.\//,"")}function p(e,t){return L(e)===L(t)}var Q=u("source-import-paths-by-local-name",{clearGroups:["whole-project","source-file"]});function P(e,t){let n=L(t);return Q.get(e,n,()=>V(e,n))}function V(e,t){let n=new Map;for(let r of h(e,t)){if(!r.sourcePath)continue;let i=r.localName??r.importedName;if(i&&T(n,i,r.sourcePath),r.kind==="namespace")for(let a of r.usedMembers)T(n,a,r.sourcePath)}return n}function T(e,t,n){let r=e.get(t);r||(r=new Set,e.set(t,r)),r.add(n)}function Ce(e,t){let n=$(e);return n?t.filter(r=>$(r.file)===n):t}function Me(e,t,n,r){let i=n.find(a=>a.file===t);if(i)return i;if(r){let a=new Set(h(e,t).map(s=>s.sourcePath).filter(s=>!!s));for(let s of n)for(let o of a)if(p(o,s.file))return s;return null}return n.length===1?n[0]:null}function $(e){let t=k(e);return t?t==="typescript"||t==="tsx"||t==="javascript"?"javascript-family":t:null}var X=v("global-leaf-index",{clearGroups:["whole-project"]});function C(e){return X.get(e,()=>{let t=e.all(`SELECT gs.id, gs.symbol,
|
|
26
|
+
COALESCE(der_doc.relative_path, mention_doc.relative_path) AS relative_path
|
|
27
|
+
FROM global_symbols gs
|
|
28
|
+
LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
|
|
29
|
+
LEFT JOIN documents der_doc ON der_doc.id = der.document_id
|
|
30
|
+
LEFT JOIN (
|
|
31
|
+
SELECT m.symbol_id, MIN(d.relative_path) AS relative_path
|
|
32
|
+
FROM mentions m
|
|
33
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
34
|
+
JOIN documents d ON c.document_id = d.id
|
|
35
|
+
WHERE m.role = 1
|
|
36
|
+
GROUP BY m.symbol_id
|
|
37
|
+
) mention_doc ON mention_doc.symbol_id = gs.id
|
|
38
|
+
WHERE 1 = 1
|
|
39
|
+
${e.symbolNoiseFor("gs")}`),n=new Map;for(let r of t){if(!r.relative_path||e.isIgnored(r.relative_path))continue;let i=d(r.symbol);if(!i)continue;let a=n.get(i);a||(a=[],n.set(i,a)),a.some(s=>s.symbolId===r.id)||a.push({symbol:r.symbol,symbolId:r.id,file:r.relative_path})}return n})}var j=/[A-Za-z_$][A-Za-z0-9_$]*/g,q=/^[A-Za-z_$][A-Za-z0-9_$]*$/;function M(e){let t=[],n=!1;for(let r of e)r&&(n=!0,q.test(r)||t.push(r));return{candidateNames:e,hasUsableCandidate:n,nonIdentifierNames:t}}function B(e,t){let n=K(t)?t:M(t);if(n.candidateNames.size===0||!n.hasUsableCandidate)return!0;j.lastIndex=0;let r;for(;(r=j.exec(e))!==null;)if(n.candidateNames.has(r[0]))return!0;for(let i of n.nonIdentifierNames)if(e.includes(i))return!0;return!1}function K(e){return"candidateNames"in e}function D(e,t,n){let r=C(e).get(n);if(!r||r.length===0)return[];if(r.length===1)return[g(r[0])];let i=r.filter(c=>c.file===t);if(i.length>0)return i.map(g);let a=P(e,t),s=a.get(n);if(s)for(let c of s){let l=r.filter(f=>p(c,f.file));if(l.length>0)return l.map(g)}let o=new Set;for(let c of a.values())for(let l of c)o.add(l);for(let c of o){let l=r.filter(f=>p(c,f.file));if(l.length>0&&l.length===r.length)return l.map(g)}return[]}function Ge(e,t,n){let r=D(e,t,n);if(r.length>0)return r;let i=C(e).get(n);return!i||i.length===0?[]:i.map(g)}function G(e,t,n={}){let r=R(e,t);if(!r)return[];let i=d(r.symbol);if(!i)return[];if(n.semantic!==!1){let s=F(e,{...r,leaf:i,parentTypeName:null,isFunctionLike:!1,isTypeLike:!1,kind:null,documentation:null,enclosingSymbol:null});if(s.length>0){let o=new Map;for(let c of s){let l=o.get(c.file)??[];l.push(c.line),o.set(c.file,l)}return H(e,o)}}let a=new Map;for(let s of E(e)){let o=m(e,s);if(!o||o.indexOf(i)===-1||s!==r.relativePath&&!D(e,s,i).some(f=>f.symbolId===r.symbolId))continue;let c=I(e,s,i,s===r.relativePath?{excludeStartLine:r.startLine,excludeEndLine:r.endLine}:{});c.length>0&&a.set(s,c)}return H(e,a)}function ze(e,t){let n=new Map;for(let o of t){if(!o.leaf)continue;let c=n.get(o.leaf)??[];c.push(o),n.set(o.leaf,c)}if(n.size===0)return new Map;let r=new Set(t.map(o=>o.symbolId)),i=new Set(n.keys()),a=M(i),s=new Map;for(let o of E(e)){if(!B(m(e,o),a))continue;let c=A(e,o);if(c.size!==0){for(let l of c)if(n.has(l))for(let f of D(e,o,l)){if(!r.has(f.symbolId)||o===f.relativePath)continue;let b=s.get(f.symbolId);b||(b=new Set,s.set(f.symbolId,b)),b.add(o)}}}return s}function g(e){return{symbolId:e.symbolId,symbol:e.symbol,relativePath:e.file}}function H(e,t){let n=[],r=new Set;for(let[i,a]of t){let s=y(e,i);for(let o of a){let c=_(s,o),l=`${i}|${o}|${c?.symbol??""}`;r.has(l)||(r.add(l),n.push({file:i,line:o,enclosingSymbol:c?.symbol??null}))}}return n}function ee(e,t){let n=se(e,t);return n?ae(e,te(e,n.match,n.identifier)):[]}function Xe(e,t,n={}){return ne(e,t,n).map(r=>({file:r.file,line:r.line,enclosingSymbol:r.enclosingSymbol}))}function ne(e,t,n={}){let r=G(e,t,{semantic:n.semantic}),i=r.length>0?z(r,"source-attribution"):z(ee(e,t),"scip-reference-chunk");return n.includeIgnored===!0?i:i.filter(a=>!e.isIgnored(a.file))}function z(e,t){return e.map(n=>({...n,provenance:t}))}function te(e,t,n){let r=new Map;for(let[i,a]of re(e,t.symbolId))r.set(i,ie(e,i,a,t,n));return r}function re(e,t){let n=new Map;for(let r of O(e,[t])){if(e.isIgnored(r.relative_path))continue;let i=n.get(r.relative_path);i||(i=[],n.set(r.relative_path,i)),i.push({start_line:r.chunk_start,end_line:r.chunk_end})}return n}function ie(e,t,n,r,i){let a=t===r.relativePath?{excludeStartLine:r.startLine,excludeEndLine:r.endLine}:{},s=i?I(e,t,i,a):[];return n.flatMap(o=>oe(s,o))}function oe(e,t){let n=e.filter(r=>r>=t.start_line&&r<=t.end_line);return n.length>0?n:[t.start_line]}function se(e,t){let n=R(e,t);return n?{match:n,identifier:d(n.symbol)||null}:null}function ae(e,t){let n=[],r=new Set;for(let[i,a]of t){let s=y(e,i);for(let o of a){let c=_(s,o),l=`${i}|${o}|${c?.symbol??""}`;r.has(l)||(r.add(l),n.push({file:i,line:o,enclosingSymbol:c?.symbol??null}))}}return n}export{N as a,me as b,pe as c,ge as d,O as e,p as f,Ce as g,Me as h,C as i,M as j,B as k,P as l,D as m,Ge as n,ze as o,ee as p,Xe as q};
|
|
40
|
+
//# sourceMappingURL=chunk-KDFONWTW.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as d}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as d}from"./chunk-3VD3JMK2.js";import{c as a}from"./chunk-YWOOQ4FF.js";import{a as c}from"./chunk-VUKC6F77.js";function F(t,e={}){let{minSimilarity:o=.5,limit:l=20,scope:n,filePattern:f}=e,r=e.minDeps??(f?1:3),{profiles:s,distinctiveDeps:p}=m(t,{scope:n,minDeps:r});return d({profiles:s,limit:l,filePattern:f,overrunFactor:5,compare:(i,u)=>D(i,u,o,p)})}function m(t,e){let{scope:o,minDeps:l}=e,n=c(t,o),{universalDeps:f,distinctiveDeps:r}=g(n),s=[];for(let[p,i]of n)i.size>=l&&s.push({file:p,deps:new Set([...i].filter(u=>!f.has(u)))});return{profiles:s,distinctiveDeps:r}}function g(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 s of r)n.set(s,(n.get(s)??0)+1);let f=Math.max(3,Math.ceil(l*.03));for(let[r,s]of n)s>=5&&s/l>.3?e.add(r):s<=f&&o.add(r);return{universalDeps:e,distinctiveDeps:o}}function D(t,e,o,l){let n=new Set;for(let i of t.deps)e.deps.has(i)&&n.add(i);if(n.size<3||t.deps.size<4||e.deps.size<4)return null;let f=0;for(let i of n)l.has(i)&&f++;if(f<2)return null;let r=a(t.deps,e.deps);if(r<o)return null;let s=[];for(let i of t.deps)e.deps.has(i)||s.push(i);let p=[];for(let i of e.deps)t.deps.has(i)||p.push(i);return{fileA:t.file,fileB:e.file,similarity:r,sharedDeps:[...n],uniqueToA:s,uniqueToB:p}}export{F as a};
|
|
2
|
+
//# sourceMappingURL=chunk-LPL4MA6R.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{q as f}from"./chunk-
|
|
1
|
+
import{q as f}from"./chunk-KDFONWTW.js";import{a as d}from"./chunk-TK7O5ER5.js";import{c as m,d as g}from"./chunk-2KHTSEIL.js";import{c as s,g as u}from"./chunk-JM72FNGA.js";import{a as c}from"./chunk-DS6QEB3G.js";function E(e,r,i={}){let n=d(e,r);if(!n)return{definitions:[],referencedBy:[]};let t=e.get("SELECT display_name, documentation FROM global_symbols WHERE id = ?",n.symbolId),a=g(t?.documentation??null),o=e.isIgnored(n.relativePath)?[]:[{relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,signature:y(a,t?.display_name??null,n.symbol),source:S(e,n.relativePath,n.startLine,n.endLine)}],b=f(e,n,{semantic:i.semantic}).map(l=>({relativePath:l.file,line:l.line,enclosingSymbol:l.enclosingSymbol,enclosingShort:l.enclosingSymbol?s(l.enclosingSymbol):"(top-level)"}));return{definitions:o,referencedBy:b}}function S(e,r,i,n){let t=c(e,r);if(!t)return null;let o=t.split(`
|
|
2
2
|
`).slice(i,n+1).join(`
|
|
3
3
|
`).trimEnd();return o.length>0?o:null}function y(e,r,i){let n=m(e);if(n&&!p(n))return n;let t=(r??"").trim();return t?u(i)&&!t.endsWith("()")?`${t}()`:t:s(i)}function p(e){return e.startsWith("undefined")||e.includes("|")||e.includes("```")}export{E as a};
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
4
|
+
//# sourceMappingURL=chunk-LSET2TXH.js.map
|