scip-query 0.17.0 → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +19 -0
- package/dist/{chunk-A4KRWTXD.js → chunk-2DUWNJKE.js} +2 -2
- package/dist/{chunk-KTZACYL6.js → chunk-2TM23JYJ.js} +2 -2
- package/dist/{chunk-42YU6TEB.js → chunk-35DURZXI.js} +2 -2
- package/dist/{chunk-TCOWAGR2.js → chunk-3YEBIYXL.js} +2 -2
- package/dist/{chunk-H4SMB657.js → chunk-5QSMW5IO.js} +2 -2
- package/dist/{chunk-AQ34B63A.js → chunk-623AZLTE.js} +2 -2
- package/dist/{chunk-RZEVUYMG.js → chunk-6TJERPN3.js} +2 -2
- package/dist/{chunk-NJBARXRO.js → chunk-7H37Z4UO.js} +2 -2
- package/dist/{chunk-VT2KFEPG.js → chunk-BBTVIIOI.js} +2 -2
- package/dist/{chunk-CYDOV3AQ.js → chunk-BTYDBDX5.js} +2 -2
- package/dist/{chunk-3EBDPBBU.js → chunk-BW4VDICR.js} +2 -2
- package/dist/{chunk-JVTMRIKU.js → chunk-CKRVVBM6.js} +2 -2
- package/dist/{chunk-6G3GQWTK.js → chunk-CSMPXDYE.js} +2 -2
- package/dist/{chunk-KYUYAWKA.js → chunk-E5HPTSRD.js} +2 -2
- package/dist/chunk-E7BTIEAY.js +2 -0
- package/dist/{chunk-KLFCCRI7.js → chunk-EUMETOTD.js} +2 -2
- package/dist/{chunk-MVFNACWB.js → chunk-FY6RCFDH.js} +2 -2
- package/dist/{chunk-JYBF5CPE.js → chunk-FZXN37RN.js} +2 -2
- package/dist/{chunk-Y3DG4J6A.js → chunk-G4IUQW27.js} +2 -2
- package/dist/{chunk-WH65EY7U.js → chunk-HJYHSTCP.js} +2 -2
- package/dist/{chunk-PVXSHZLW.js → chunk-HYRSGWFX.js} +2 -2
- package/dist/{chunk-ZMD4O5UP.js → chunk-HZVG4KID.js} +2 -2
- package/dist/{chunk-HV4N3UBV.js → chunk-IHD2CHMX.js} +2 -2
- package/dist/{chunk-7CHIAMKS.js → chunk-IKAJI4SI.js} +2 -2
- package/dist/{chunk-TL2IXVGH.js → chunk-IZLWLO4X.js} +2 -2
- package/dist/{chunk-JJAH2VLD.js → chunk-JYBP5ZIR.js} +2 -2
- package/dist/{chunk-QNCVN5EH.js → chunk-KWMRY4RN.js} +2 -2
- package/dist/{chunk-KAOWSWEX.js → chunk-KWQKWY6M.js} +2 -2
- package/dist/{chunk-IK2NG76R.js → chunk-MBDBNQBW.js} +2 -2
- package/dist/chunk-MON5XXTG.js +7 -0
- package/dist/{chunk-BBBZB5WY.js → chunk-O27267B6.js} +2 -2
- package/dist/{chunk-34RCSYMZ.js → chunk-O56VBJKB.js} +2 -2
- package/dist/{chunk-J4HK7PQS.js → chunk-OBPR6E5Z.js} +2 -2
- package/dist/{chunk-YD7GGLGE.js → chunk-OC7XDK62.js} +2 -2
- package/dist/{chunk-ABRWGVC6.js → chunk-PPAT3XUL.js} +2 -2
- package/dist/{chunk-PYOZHG6A.js → chunk-QYBCGCY5.js} +2 -2
- package/dist/{chunk-EPDV3SQD.js → chunk-RPPV6Y4K.js} +2 -2
- package/dist/{chunk-OQRMCT2N.js → chunk-SQJ72PQW.js} +5 -5
- package/dist/{chunk-KO2TFDIP.js → chunk-SSH2NPYS.js} +2 -2
- package/dist/chunk-U267E6YN.js +120 -0
- package/dist/{chunk-JUADXGUH.js → chunk-UKUISUS6.js} +2 -2
- package/dist/{chunk-LC57FSPX.js → chunk-V7MX6YUF.js} +2 -2
- package/dist/{chunk-SREWDA7Q.js → chunk-W2I4QAW7.js} +2 -2
- package/dist/{chunk-5ODF4JGH.js → chunk-W3HSUCRG.js} +2 -2
- package/dist/{chunk-VCOAUTSI.js → chunk-WENI5ZDR.js} +2 -2
- package/dist/{chunk-VPVAQRHM.js → chunk-WGDIA2TU.js} +2 -2
- package/dist/{chunk-7MT6UM4D.js → chunk-WT34AUWL.js} +2 -2
- package/dist/{chunk-OP5RO2CF.js → chunk-Y4BBVPRK.js} +2 -2
- package/dist/cli.js +280 -280
- package/dist/index.js +1 -1
- package/dist/queries/affected.js +1 -1
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/cleanup-plan.js +1 -1
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/convergence.js +1 -1
- package/dist/queries/dataflow.js +1 -1
- package/dist/queries/dead.js +1 -1
- package/dist/queries/decorative-checkers.js +1 -1
- package/dist/queries/diff-gate.js +1 -1
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/drift.js +1 -1
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/health.js +1 -1
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.js +1 -1
- package/dist/queries/incomplete-migration.js +1 -1
- package/dist/queries/index.js +1 -1
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/locality-candidates.js +1 -1
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.js +1 -1
- package/dist/queries/not-implemented.js +1 -1
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/plan-context.js +1 -1
- package/dist/queries/recent-duplicates.js +1 -1
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/refs.js +1 -1
- package/dist/queries/self-audit.js +1 -1
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.js +1 -1
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/surface.js +1 -1
- package/dist/queries/trace.js +1 -1
- package/dist/queries/twin-ab.js +1 -1
- package/dist/queries/unused-imports.js +1 -1
- package/dist/queries/unused-params.js +1 -1
- package/dist/queries/wrapper-candidates.js +1 -1
- package/dist/reindex-worker.js +22 -22
- package/dist/reindex.js +36 -36
- package/dist/runtime.d.ts +2 -0
- package/dist/runtime.js +1 -1
- package/dist/watch-server.js +4 -4
- package/package.json +2 -1
- package/skills/scip-tla-model-system/SKILL.md +10 -8
- package/dist/chunk-L7UITWFE.js +0 -120
- package/dist/chunk-QVZSWLLZ.js +0 -2
- package/dist/chunk-RSZ4KX4B.js +0 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as S}from"./chunk-
|
|
1
|
+
import{a as S}from"./chunk-BTYDBDX5.js";import{b as D}from"./chunk-5CJ6AQN7.js";import{h as v}from"./chunk-KWMRY4RN.js";import{p as y}from"./chunk-JLZUM476.js";import{a as b}from"./chunk-64MNV6AB.js";import p from"path";var w={analysis:new Set(["domain","source","storage","symbols"]),core:new Set(["analysis","domain","resolution","source","storage","symbols"]),domain:new Set([]),instrumentation:new Set([]),"language-parsers":new Set(["core","domain","resolution","source","storage"]),queries:new Set(["analysis","core","domain","language-parsers","resolution","semantic","source","storage","symbols"]),reindex:new Set(["domain","language-parsers","resolution","runtime","semantic","source","storage","symbols"]),resolution:new Set(["domain","source","storage","symbols"]),runtime:new Set(["core","domain","language-parsers","queries","reindex","resolution","semantic","source","storage","symbols","tla"]),semantic:new Set(["core","domain","language-parsers","reindex","resolution","runtime","source","storage","symbols"]),source:new Set(["core","domain","resolution","storage"]),storage:new Set(["analysis","domain","queries","source"]),symbols:new Set(["analysis","core","domain","language-parsers","resolution","semantic","source","storage"]),tla:new Set(["core","domain","queries","source","storage","symbols"])};function f(e){let t=e.replace(/\\/g,"/").split("/").filter(Boolean);return t.length<=1?"(root)":t.length>=3&&["src","lib","app","server","client"].includes(t[0])?`${t[0]}/${t[1]}`:t[0]}function h(e,n){if(e===n)return"ok";let t=g(e),i=g(n);return t&&i?!m(t)||!m(i)?null:P(t,i)?"ok":"violation":E(e,n)}function k(e,n){let t=g(f(e)),i=g(f(n));return!!t&&!!i&&m(t)&&m(i)}function R(e,n){let t=g(e),i=g(n);return!!t&&!!i&&(!m(t)||!m(i))}function g(e){return/^src\/([^/]+)$/.exec(e)?.[1]??null}function P(e,n){return n==="instrumentation"||n==="domain"?!0:e==="domain"?!1:w[e]?.has(n)??!1}function m(e){return Object.hasOwn(w,e)}function E(e,n){if(n==="shared")return"ok";let t={app:new Set(["core","shared","ui"]),core:new Set(["shared"]),infra:new Set(["core","shared"]),ui:new Set(["core","shared"])};return t[e]?t[e].has(n)?"ok":"violation":null}function re(e,n){let{scope:t,minDeviation:i=5,limit:r=50}=n??{},a=n?.semantic!==!1,c=n?.includePatternDeviations===!0,s=new S(e).fileDependencyGraph(t),l=F([...I(e,s,{scope:t,semantic:a}),...M(s),...c?N(s,i):[]]);return r<=0||l.results.length<=r?l:{...l,results:l.results.slice(0,r),totalResults:l.results.length}}function I(e,n,t){let i=T(e,t.scope),r=[],a=new Set;for(let[o,s]of n){if(d(o))continue;let l=i.get(o)??new Set;for(let u of s)d(u)||l.has(u)||_(e,o,u,t)||(r.push({file:o,dep:u}),a.add(o))}a.size>0&&B(e,i,{paths:[...a]});let c=[];for(let{file:o,dep:s}of r)(i.get(o)??new Set).has(s)||c.push({file:o,kind:"unused-import",description:`Depends on ${s} but references none of its symbols`,dep:s,actionTier:"direct",evidenceReasons:[`dependency edge exists from ${o} to ${s}`,"no semantic, source, type-only, side-effect, or Vue-template usage survived the conservative skip gates"],recommendation:"Remove the unused import or dependency edge after running the project checks."});return c}function _(e,n,t,i){return J(e,n,t)||z(e,n,t)||V(t)||W(e,n,t)||K(t)?!0:i.semantic&&C(e,n,t)}function M(e){let n=[],t=U(e);for(let[i,r]of e){if(d(i))continue;let a=f(i);for(let c of r){if(d(c))continue;let o=f(c);if(a===o)continue;let s=h(a,o),l=s===null&&R(a,o),u=s?"explicit":l?"unknown-layer":"inferred";if((l?"violation":s??t.get(`${a}->${o}`))==="violation"){let $=u==="explicit"?"direct":"signal";n.push({file:i,kind:"layer-violation",description:`Imports from ${o}/ (${c}) \u2014 may cross architectural boundary`,dep:c,detail:`${a}/ should not depend on ${o}/`,actionTier:$,policyBasis:u,evidenceReasons:[`dependency edge exists from ${i} to ${c}`,O(u,a,o)],recommendation:u==="explicit"?"Move the dependency behind an allowed layer boundary or document a policy change.":u==="unknown-layer"?"Add a layer policy entry before treating this as a boundary violation.":"Review whether this is a real boundary break or an intentional exception before moving code."})}}}return n}function O(e,n,t){return e==="explicit"?`explicit layer policy rejects ${n}/ -> ${t}/`:e==="unknown-layer"?`source layer policy has no entry for ${n}/ -> ${t}/`:`rare cross-layer edge ${n}/ -> ${t}/ is inferred as a violation`}function N(e,n){let t=[];for(let[i,r]of A(e)){let a=r.filter(o=>!d(o));if(a.length<n)continue;let c=L(e,a);for(let o of a)for(let s of e.get(o)??[])d(s)||(c.get(s)??0)===1&&p.dirname(s)!==i&&p.dirname(s)!==p.dirname(i)&&(k(o,s)||t.push({file:o,kind:"pattern-deviation",description:`Only file in ${i}/ that depends on ${s}`,dep:s,actionTier:"signal",evidenceReasons:[`${a.length} sibling file(s) in ${i}/ were compared`,`${o} is the only non-skipped sibling depending on ${s}`],recommendation:"Review sibling ownership before changing this import; unique dependency shape can be intentional specialization."}))}return t}function F(e){return{results:e,unusedImports:e.filter(n=>n.kind==="unused-import").length,layerViolations:e.filter(n=>n.kind==="layer-violation").length,patternDeviations:e.filter(n=>n.kind==="pattern-deviation").length}}function A(e){let n=new Map;for(let t of e.keys()){let i=p.dirname(t),r=n.get(i);r||(r=[],n.set(i,r)),r.push(t)}return n}function L(e,n){let t=new Map;for(let i of n)for(let r of e.get(i)??[])d(r)||t.set(r,(t.get(r)??0)+1);return t}function T(e,n){let t=new Map;return j(e,t,n),t}function j(e,n,t){for(let i of q(e,t))x(e,n,i.from_file,i.to_file)}function q(e,n){let t=n?"AND d1.relative_path LIKE ?":"",i=n?[`%${n}%`]:[];return e.all(`SELECT DISTINCT d1.relative_path AS from_file, d2.relative_path AS to_file
|
|
2
2
|
FROM mentions m
|
|
3
3
|
JOIN chunks c ON m.chunk_id = c.id
|
|
4
4
|
JOIN documents d1 ON c.document_id = d1.id
|
|
@@ -15,4 +15,4 @@ import{a as S}from"./chunk-CYDOV3AQ.js";import{b as D}from"./chunk-5CJ6AQN7.js";
|
|
|
15
15
|
AND m.role != 1
|
|
16
16
|
${e.pathExclusionsFor("d1","d2")}
|
|
17
17
|
${t}`,...i)}function B(e,n,t={}){new S(e).scanSourceReferences({paths:t.paths??b(e,{includeIgnored:!1}),includeRustAttributeNames:!0,identifierResolution:"permissive"},r=>{r.target.relativePath!==r.sourceFile&&(e.isIgnored(r.target.relativePath)||x(e,n,r.sourceFile,r.target.relativePath))})}function x(e,n,t,i){if(e.isIgnored(t)||e.isIgnored(i))return;let r=n.get(t);r||(r=new Set,n.set(t,r)),r.add(i)}function U(e){let n=new Map;for(let[i,r]of e){if(d(i))continue;let a=f(i);for(let c of r){if(d(c))continue;let o=f(c);if(a===o||h(a,o))continue;let s=`${a}->${o}`;n.set(s,(n.get(s)??0)+1)}}let t=new Map;for(let[i,r]of n)t.set(i,r<=2?"violation":"ok");return t}function V(e){return e.includes("types")||e.endsWith(".d.ts")}function C(e,n,t){let i=v(e,n).filter(r=>r.sourcePath===t);return i.length>0&&i.some(r=>r.isUsed)}function J(e,n,t){let i=y(e,n).filter(r=>r.sourcePath===t);return i.length>0&&i.some(r=>r.used)}function z(e,n,t){let i=y(e,n).filter(r=>r.sourcePath===t);return i.length>0&&i.every(r=>r.isTypeOnly===!0)}function K(e){return e.endsWith(".vue")}function W(e,n,t){let i=y(e,n).filter(r=>r.sourcePath===t);return i.length===0?!1:i.every(r=>r.kind==="side-effect"||r.kind==="namespace"&&r.usedMembers.length===0&&!r.used)}function d(e){let n=D(e);return!!(n==="entry"||n==="barrel"||n==="test"||n==="worker"||H(p.basename(e)))}function H(e){return!!(e==="index.ts"||e==="index.js"||e==="cli.ts"||e==="main.ts"||e==="main.rs"||e.includes("worker.")||e.includes("postinstall.")||e==="health.ts"||e==="health.js")}export{re as a};
|
|
18
|
-
//# sourceMappingURL=chunk-
|
|
18
|
+
//# sourceMappingURL=chunk-HJYHSTCP.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as F,b as A}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as F,b as A}from"./chunk-V7MX6YUF.js";import{a as C}from"./chunk-BTYDBDX5.js";import{a as k}from"./chunk-2HCWAL42.js";import{d as S}from"./chunk-7XP7ZRSI.js";import{a as y}from"./chunk-TLTLJ4SW.js";import{a as p}from"./chunk-64MNV6AB.js";import{posix as h}from"path";var _=20,G=1,O=new Map([["app","app"],["apps","app"],["component","component"],["components","component"],["composable","composable"],["composables","composable"],["contract","contract"],["contracts","contract"],["domain","domain"],["domains","domain"],["feature","feature"],["features","feature"],["hook","hook"],["hooks","hook"],["lib","library"],["module","module"],["modules","module"],["package","package"],["packages","package"],["page","page"],["pages","page"],["route","route"],["routes","route"],["screen","screen"],["screens","screen"],["service","service"],["services","service"],["shared","shared"],["src","source-root"],["store","state"],["stores","state"],["test","test"],["tests","test"],["util","utility"],["utils","utility"],["view","view"],["views","view"]]),q=new Set(["components","contracts","hooks","lib","services","shared","stores","utils"]),Y=new Set(["access","api","auth","config","db","effect","errors","hooks","lib","middleware","permissions","routes","schemas","servicetasks","services","startup","store","stores","test-utils","repository","repositories","tests","types","ui","utils","workflow","workflows"]);function Ce(e,n={}){let t=L(n.limit,_),i=L(n.minConsumers,G),r=new C(e),s=r.fileDependencyGraph(n.scope),o=ge(p(e,{includeIgnored:!1})),a=pe(e.config.locality?.architecturalBoundarySegments,n.architecturalBoundarySegments);return(n.target?K(e,r,n.target):J(e,n.scope,n.scanLimit)).map(c=>Q(e,r,s,c,n,o,a)).filter(c=>c.consumerFiles.length>=i||n.target).sort(me).slice(0,t)}function K(e,n,t){let i=Z(e,t);if(i)return[I(i)];let r=k(e,t);if(!r)return[];let s=n.definitionsForFile(r.relativePath).find(o=>o.symbolId===r.symbolId);return s?[ee(s)]:[{unit:{kind:"symbol",file:r.relativePath,shortName:S(r.symbol),symbol:r.symbol,startLine:r.startLine,endLine:r.endLine}}]}function J(e,n,t){let i=p(e,{scope:n,includeIgnored:!1}),r=L(t,i.length);return i.slice(0,r).map(s=>I(s))}function Q(e,n,t,i,r,s,o){let a=i.definition?V(e,n,i.definition,r.semantic):X(t,i.unit.file),d=i.definition?a.length>0?"exact":"none":a.length>0?"file-level":"none",f=i.unit.file,c=l(h.dirname(f)),u=te(a),B=ne(c),W=w([...T(c),...u?T(u):[]]),b=ie(i.unit,c,u,a),g=re(b,i.unit,c,u,a,s,o),j=le(i.unit,d,u,a,c,g.whyNoSuggestedHome),z=ue(i.unit,c,u,a,g.suggestedHome,g.whyNoSuggestedHome);return{actionTier:"signal",sourceUnit:i.unit,candidatePath:f,currentDirectory:c,directoryAncestry:B,consumerFiles:a,consumerCoverage:d,nearestCommonOwner:u,boundaryMarkers:W,recommendedTier:b,suggestedHome:g.suggestedHome,destinationConfidence:g.confidence,whyNoSuggestedHome:g.whyNoSuggestedHome,counterevidence:j,reasons:z,recommendation:de(b,g.suggestedHome,d)}}function V(e,n,t,i){let r=A(F(e,n).forDefinitions([t],{semantic:i!==!1,sourceFallback:!0}));return E(r.get(t.symbolId)??[])}function X(e,n){let t=[];for(let[i,r]of e.entries())i!==n&&r.has(n)&&t.push(i);return E(t)}function Z(e,n){let t=y(n),i=p(e,{includeIgnored:!1}),r=i.find(o=>o===t);if(r)return r;let s=i.find(o=>o.endsWith(`/${t}`));return s||(i.find(o=>o.includes(t))??null)}function ee(e){return{definition:e,unit:{kind:"symbol",file:e.relativePath,shortName:S(e.symbol),symbol:e.symbol,startLine:e.startLine,endLine:e.endLine}}}function I(e){return{unit:{kind:"file",file:e,shortName:h.basename(e)}}}function ne(e){if(e===".")return[{path:".",depth:0,markers:[]}];let n=[],t=e.split("/").filter(Boolean);for(let i=0;i<t.length;i+=1){let r=t.slice(0,i+1).join("/");n.push({path:r,depth:i,markers:D(r)})}return n}function T(e){return e==="."?[]:$(e).map(({marker:n,prefix:t})=>`${n}: ${t}`)}function D(e){return w($(e).map(({marker:n})=>n))}function $(e){let n=e.split("/").filter(Boolean),t=[];for(let i=0;i<n.length;i+=1){let r=O.get(n[i]);r&&t.push({marker:r,prefix:n.slice(0,i+1).join("/")})}return t}function te(e){if(e.length===0)return null;let n=e.map(i=>l(h.dirname(i))),t=n[0].split("/").filter(Boolean);for(let i of n.slice(1)){let r=i.split("/").filter(Boolean),s=[],o=Math.min(t.length,r.length);for(let a=0;a<o&&t[a]===r[a];a+=1)s.push(t[a]);t=s}return t.length===0?".":t.join("/")}function ie(e,n,t,i){return t?e.kind==="symbol"&&i.length===1?i[0]===e.file?"same-file":"sibling-folder":t==="."||t==="src"?"repository-level-review":U(t,"package")?"package-level-shared":U(t,"app")?"app-level-shared":N(t,["feature","domain","module"])||N(n,["feature","domain","module"])?"feature-local-shared":"sibling-folder":"no-exact-consumers"}function re(e,n,t,i,r,s,o){let a=oe(e,i);if(a)return m(a);let d=fe(n.file),f=se(e,t,d,r,o);if(f)return f;let c=i;if(l(t)===l(c))return m(`${t} is already the nearest common owner for its consumers.`);let u=ae(c,t,d,o);return u||ce(c,t,d,s,o)}function oe(e,n){return n?e==="no-exact-consumers"||e==="repository-level-review"?"The inferred owner is too broad or unsupported for an exact destination.":null:"No consumer owner could be inferred from the current index."}function se(e,n,t,i,r){if(e==="same-file"){let s=i[0]??null;return s?v(s):m("No same-file consumer path was available.")}if(e==="sibling-folder"&&i.length===1){let s=l(h.dirname(i[0])),o=H(n,t,s,r);return o?m(o):v(s)}return null}function ae(e,n,t,i){return be(e)?P(e,n,t,i,`Nearest shared owner ${e} is outside source root ${t}.`):null}function ce(e,n,t,i,r){if(e===".")return m("The nearest common owner is the repository root.");let s=`${e}/shared`,o=P(s,n,t,r,`Proposed home ${s} is outside source root ${t}.`);return o.confidence==="withheld"||i.has(s)?o:m(`${s} does not exist in the indexed project.`)}function P(e,n,t,i,r){if(!M(e,t))return m(r);let s=H(n,t,e,i);return s?m(s):v(e)}function v(e){return{suggestedHome:e,confidence:"exact",whyNoSuggestedHome:null}}function m(e){return{suggestedHome:null,confidence:"withheld",whyNoSuggestedHome:e}}function le(e,n,t,i,r,s){let o=["Report-only signal; review ownership before moving files."];return n==="none"&&o.push("No consumers were found in the current index."),n==="file-level"&&o.push("File-level import evidence can hide which exported unit is actually used."),(t==="."||t==="src")&&o.push("Nearest common owner is broad, so this is not enough evidence for automatic placement."),i.length===1&&o.push("Only one consumer was found; inlining or same-folder placement may be better than shared extraction."),e.kind==="file"&&o.push("File targets describe module locality, not symbol-level usage."),t&&r.startsWith(`${t}/`)&&o.push("Candidate already lives under the nearest common owner."),s&&o.push(`No exact suggested home: ${s}`),o}function ue(e,n,t,i,r,s){let o=[];return o.push(`${e.shortName} currently lives in ${n}.`),t?o.push(`${i.length} consumer file(s) share ${t} as their nearest common owner.`):o.push("No consumer owner could be inferred from the current index."),r?o.push(`Suggested home is ${r}.`):s&&o.push(`No exact suggested home: ${s}`),o}function de(e,n,t){return e==="no-exact-consumers"?"Review references before moving; no consumers were found.":e==="repository-level-review"?"Keep this as a broad locality signal; the inferred owner is too general for automatic relocation.":n?`Review whether ${t==="exact"?"symbol usage":"module import"} supports moving or extracting toward ${n}.`:"Review ownership manually before changing structure."}function me(e,n){return R(n)-R(e)||e.candidatePath.localeCompare(n.candidatePath)}function R(e){let n=e.consumerFiles.length*10;return e.consumerCoverage==="exact"&&(n+=5),e.suggestedHome&&(n+=3),e.recommendedTier==="repository-level-review"&&(n*=.1),e.recommendedTier==="no-exact-consumers"&&(n*=.05),n}function ge(e){let n=new Set(["."]);for(let t of e){let i=l(h.dirname(t));for(;!n.has(i)&&(n.add(i),i!==".");)i=l(h.dirname(i))}return n}function fe(e){let n=x(e),t=n.indexOf("src");return t>=0?n.slice(0,t+1).join("/"):n.length<=1?".":n[0]}function M(e,n){let t=l(e),i=l(n);return i==="."||t===i||t.startsWith(`${i}/`)}function he(e,n,t){let i=x(e),r=x(n);return(M(e,n)?i.slice(r.length):i).some(o=>t.has(o.toLowerCase()))}function H(e,n,t,i){return l(e)===l(t)||!he(e,n,i)?null:`${e} is a named architectural boundary; an exact move to ${t} needs human design.`}function pe(...e){let n=new Set(Y);for(let t of e)for(let i of t??[]){let r=ye(i);r&&n.add(r)}return n}function ye(e){let n=e.trim().toLowerCase();return n===""?null:n}function U(e,n){return D(e).includes(n)}function N(e,n){let t=D(e);return n.some(i=>t.includes(i))}function be(e){let n=e.split("/").filter(Boolean),t=n[n.length-1];return t?q.has(t):!1}function l(e){let n=y(e);return n===""?".":n}function x(e){let n=y(e);return n==="."?[]:n.split("/").filter(Boolean)}function L(e,n){return!Number.isFinite(e)||e===void 0||e<1?n:Math.floor(e)}function E(e){return w([...e]).sort((n,t)=>n.localeCompare(t))}function w(e){return[...new Set(e)]}export{Ce as a};
|
|
2
|
+
//# sourceMappingURL=chunk-HYRSGWFX.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as R}from"./chunk-CMLHZWRS.js";import{a as D}from"./chunk-U244OVE6.js";import{a as g}from"./chunk-K3UVTL3J.js";import{a as F}from"./chunk-3CJXFMR5.js";import{a as y}from"./chunk-X566NT42.js";import{e as f}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as R}from"./chunk-CMLHZWRS.js";import{a as D}from"./chunk-U244OVE6.js";import{a as g}from"./chunk-K3UVTL3J.js";import{a as F}from"./chunk-3CJXFMR5.js";import{a as y}from"./chunk-X566NT42.js";import{e as f}from"./chunk-2DUWNJKE.js";import{j as d}from"./chunk-7XP7ZRSI.js";import{M as h}from"./chunk-TLTLJ4SW.js";var A=.7,S=.62,C=.45;function J(i,t={}){let{windowCommits:e=100,limit:n=30,scope:a,scanLimit:o}=t,s=y(i,{historyMode:t.historyMode}).fileAddRecords();if(!s)return{available:!1,windowCommits:e,findings:[]};if(n<=0)return{available:!0,windowCommits:e,findings:[]};let r=P(s,e);if(r.size===0)return{available:!0,windowCommits:e,findings:[]};let b=B(i,{limit:n,minSimilarity:t.minSimilarity,scanLimit:o,scope:a,semantic:t.semantic,focusFiles:Number.isFinite(n)?void 0:r}).map(l=>O(l,s,e)).filter(l=>l!==null);b.sort((l,c)=>(l.kind===c.kind?0:l.kind==="echo"?-1:1)||c.similarity-l.similarity||l.echoFile.localeCompare(c.echoFile)||l.echoSymbol.localeCompare(c.echoSymbol)||l.domain.localeCompare(c.domain));let p=b.slice(0,n).map(M);return{available:!0,windowCommits:e,findings:p,rootCauseGroups:N(p)}}function B(i,t){let e=K(t.limit),n=[...k(i,{scope:t.scope,minSimilarity:t.minSimilarity??A,limit:e,scanLimit:t.scanLimit,semantic:t.semantic,focusFiles:t.focusFiles})],a=h(i,{scope:t.scope});return a.react&&n.push(...E(i,{scope:t.scope,minSimilarity:t.minSimilarity??S,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles}),...L(i,{scope:t.scope,minSimilarity:t.minSimilarity??C,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles})),a.vue&&n.push(...x(i,{scope:t.scope,minSimilarity:t.minSimilarity??S,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles}),...T(i,{scope:t.scope,minSimilarity:t.minSimilarity??C,limit:e,scanLimit:t.scanLimit,focusFiles:t.focusFiles})),n}function k(i,t){return f(i,{scope:t.scope,minSimilarity:t.minSimilarity,limit:t.limit,crossFileOnly:!0,scanLimit:t.scanLimit,semantic:t.semantic,focusFiles:t.focusFiles}).filter(e=>!d(e.symbolA)&&!d(e.symbolB)).map(e=>({domain:"callable",basis:e.similarityBasis??"callees",symbolA:e.shortNameA,fileA:e.fileA,symbolB:e.shortNameB,fileB:e.fileB,similarity:e.similarity,sharedEvidence:e.sharedCallees,sharedCallees:e.sharedCallees}))}function E(i,t){return u(i,t,{query:g,domain:"react-component",basis:"jsx-structure",symbolA:e=>e.componentA,symbolB:e=>e.componentB,evidenceBuckets:e=>[["component",e.sharedComponents],["tag",e.sharedNativeTags],["prop",e.sharedProps],["event",e.sharedEvents],["binding",e.sharedBindings]]})}function u(i,t,e){return e.query(i,t).filter(n=>n.fileA!==n.fileB).filter(n=>e.acceptPair?.(n)??!0).map(n=>({domain:e.domain,basis:e.basis,symbolA:e.symbolA(n),fileA:n.fileA,symbolB:e.symbolB(n),fileB:n.fileB,similarity:n.similarity,sharedEvidence:G(...e.evidenceBuckets(n)),sharedCallees:[]}))}function L(i,t){return u(i,t,{query:F,domain:"react-hook",basis:"react-behavior",symbolA:e=>e.componentA,symbolB:e=>e.componentB,acceptPair:w,evidenceBuckets:e=>[["hook",e.sharedHooks],["react-hook",e.sharedReactHooks],["effect",e.sharedEffects],["state",e.sharedState],["request",e.sharedRequests],["handler",e.sharedHandlers],["action",e.sharedHandlerVerbs]]})}var I=new Set(["useCallback","useEffect","useLayoutEffect","useMemo","useMutation","useQueries","useQuery","useQueryClient","useReducer","useRef","useState"]);function w(i){return i.sharedHooks.some(t=>!I.has(t))||i.sharedState.length>0||i.sharedHandlers.length>0||i.sharedHandlerVerbs.length>=2}function x(i,t){return u(i,t,{query:D,domain:"vue-component",basis:"vue-template",symbolA:e=>m(e.fileA),symbolB:e=>m(e.fileB),evidenceBuckets:e=>[["component",e.sharedComponents],["prop",e.sharedProps],["event",e.sharedEvents],["directive",e.sharedDirectives],["slot",e.sharedSlots],["identifier",e.sharedIdentifiers]]})}function T(i,t){return u(i,t,{query:R,domain:"vue-composable",basis:"vue-behavior",symbolA:e=>m(e.fileA),symbolB:e=>m(e.fileB),evidenceBuckets:e=>[["composable",e.sharedComposables],["store",e.sharedStores],["reactivity",e.sharedReactivity],["lifecycle",e.sharedLifecycle],["request",e.sharedRequests],["function",e.sharedFunctions],["action",e.sharedFunctionVerbs],["binding",e.sharedBindings],["template-event",e.sharedTemplateEvents]]})}function P(i,t){let e=new Set;for(let[n,a]of i)a.commitsAgo<=t&&e.add(n);return e}function O(i,t,e){let n=t.get(i.fileA)?.commitsAgo??null,a=t.get(i.fileB)?.commitsAgo??null,o=n!==null&&n<=e,s=a!==null&&a<=e;if(!o&&!s)return null;if(o&&s){let r=(n??0)<=(a??0);return{kind:"twin",domain:i.domain,basis:i.basis,echoSymbol:r?i.symbolA:i.symbolB,echoFile:r?i.fileA:i.fileB,echoAgeCommits:(r?n:a)??0,establishedSymbol:r?i.symbolB:i.symbolA,establishedFile:r?i.fileB:i.fileA,establishedAgeCommits:r?a:n,similarity:i.similarity,sharedEvidence:i.sharedEvidence,sharedCallees:i.sharedCallees}}return{kind:"echo",domain:i.domain,basis:i.basis,echoSymbol:o?i.symbolA:i.symbolB,echoFile:o?i.fileA:i.fileB,echoAgeCommits:(o?n:a)??0,establishedSymbol:o?i.symbolB:i.symbolA,establishedFile:o?i.fileB:i.fileA,establishedAgeCommits:o?a:n,similarity:i.similarity,sharedEvidence:i.sharedEvidence,sharedCallees:i.sharedCallees}}function M(i){let t=v(i);return{...i,rootCauseKey:t,groupKey:`recent-duplicate:${t}`}}function v(i){if(i.kind==="echo")return["echo",i.domain,i.basis,i.establishedSymbol].join(":");let t=i.sharedEvidence.slice().sort().join("|"),e=[i.echoSymbol,i.establishedSymbol].sort().join("|");return["twin",i.domain,i.basis,t||e].join(":")}function N(i){let t=new Map;for(let[e,n]of i.entries()){let a=n.rootCauseKey??v(n),o=n.groupKey??`recent-duplicate:${a}`,s=t.get(o);s||(s={groupKey:o,rootCauseKey:a,kind:n.kind,domain:n.domain,basis:n.basis,count:0,maxSimilarity:n.similarity,findingIndexes:[],echoFiles:new Set,establishedFile:n.kind==="echo"?n.establishedFile:void 0,establishedSymbol:n.kind==="echo"?n.establishedSymbol:void 0,relatedFiles:new Set,sharedEvidence:new Set,recommendation:H(n)},t.set(o,s)),s.count+=1,s.maxSimilarity=Math.max(s.maxSimilarity,n.similarity),s.findingIndexes.push(e),s.echoFiles.add(n.echoFile),s.relatedFiles.add(n.echoFile),s.relatedFiles.add(n.establishedFile);for(let r of n.sharedEvidence)s.sharedEvidence.add(r)}return[...t.values()].map(e=>({...e,echoFiles:[...e.echoFiles].sort(),relatedFiles:[...e.relatedFiles].sort(),sharedEvidence:[...e.sharedEvidence].sort().slice(0,16)})).sort((e,n)=>n.count-e.count||n.maxSimilarity-e.maxSimilarity||e.groupKey.localeCompare(n.groupKey))}function H(i){return i.kind==="echo"?"Review the established side once, then migrate or delete every echo in this group.":"Pick one owner for the new twins and consolidate the group before the copies diverge."}function K(i){return Number.isFinite(i)?i*5:Number.POSITIVE_INFINITY}function G(...i){let t=[],e=new Set;for(let[n,a]of i)for(let o of a){let s=`${n}:${o}`;e.has(s)||(e.add(s),t.push(s))}return t}function m(i){return(i.split("/").pop()??i).replace(/\.[^.]+$/,"")}export{J as a};
|
|
2
|
+
//# sourceMappingURL=chunk-HZVG4KID.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as M}from"./chunk-
|
|
1
|
+
import{c as M}from"./chunk-3YEBIYXL.js";import{a as I,c as N}from"./chunk-2HCWAL42.js";import{d as b,f as p,s as g,z as S}from"./chunk-7XP7ZRSI.js";import{B as h}from"./chunk-TLTLJ4SW.js";function $(o,s,i={}){let{maxDepth:c=5,scope:a}=i,l=I(o,s);if(!l)return[];let u=[],f=new Set([l.symbolId]),m=new Set,t=[l];for(let e=1;e<=c&&t.length!==0;e++){let r=[];for(let y of t)for(let n of D(o,y,a)){let d=`${n.file}|${n.shortName}`;if(n.symbolId!==null){if(f.has(n.symbolId))continue;f.add(n.symbolId)}else if(m.has(d))continue;m.add(d),u.push({symbol:n.symbol,shortName:n.shortName,file:n.file,depth:e}),n.symbolId!==null&&n.symbolMatch&&r.push(n.symbolMatch)}t=r}return u.sort((e,r)=>e.depth-r.depth||e.file.localeCompare(r.file)),u}function D(o,s,i){let c=M(o,s,{limit:500}).filter(t=>!o.isIgnored(t.file)).filter(t=>!i||t.file.includes(i)),a=new Set(c.map(t=>t.file)),l=[];for(let t of _(o,s,i)){if(a.has(t))continue;let e=g(o,t),r=e.length>0?S(e,e[0].startLine):null;l.push({symbol:r?.symbol??t,file:t})}let u=[...c,...l],f=[],m=new Set;for(let t of u){let e=N(o,t.symbol);if(!e){let y=`${t.file}|${t.symbol}`;if(m.has(y))continue;m.add(y),f.push({symbolId:null,symbol:t.symbol,shortName:b(t.symbol),file:t.file,symbolMatch:null});continue}if(e.symbolId===s.symbolId||o.isIgnored(e.relativePath)||!w(e))continue;let r=`${e.symbolId}|${e.relativePath}`;m.has(r)||(m.add(r),f.push({symbolId:e.symbolId,symbol:e.symbol,shortName:b(e.symbol),file:e.relativePath,symbolMatch:e}))}return f}function _(o,s,i){let c=i?"AND consumer_d.relative_path LIKE ?":"",a=[s.symbolId,s.documentId];return i&&a.push(`%${i}%`),new Set(o.all(`SELECT DISTINCT consumer_d.relative_path
|
|
2
2
|
FROM mentions m
|
|
3
3
|
JOIN chunks c ON m.chunk_id = c.id
|
|
4
4
|
JOIN documents consumer_d ON consumer_d.id = c.document_id
|
|
@@ -7,4 +7,4 @@ import{c as M}from"./chunk-TCOWAGR2.js";import{a as I,c as N}from"./chunk-2HCWAL
|
|
|
7
7
|
AND c.document_id != ?
|
|
8
8
|
${o.pathExclusionsFor("consumer_d")}
|
|
9
9
|
${c}`,...a).map(l=>l.relative_path).filter(l=>!o.isIgnored(l)))}function w(o){if(o.symbol.startsWith("scip-clojure ")||h(o.relativePath)==="clojure")return!0;let s=p(o.symbol);return s==="method"||s==="type"||o.symbol.endsWith("().")}export{$ as a};
|
|
10
|
-
//# sourceMappingURL=chunk-
|
|
10
|
+
//# sourceMappingURL=chunk-IHD2CHMX.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as n}from"./chunk-B75HZHUP.js";import{a as m,c as a}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{c as n}from"./chunk-B75HZHUP.js";import{a as m,c as a}from"./chunk-3YEBIYXL.js";import{a as i}from"./chunk-2HCWAL42.js";import{d as o,h as r}from"./chunk-7XP7ZRSI.js";function R(s,c,y={}){let e=i(s,c);if(!e)return null;let t=y.semantic!==!1,b=a(s,e,{semantic:t}).filter(l=>r(l.symbol)).slice(0,50),f=n(m(s,e,{limit:50,additive:!0,callableOnly:!0,semantic:t}));return{symbol:e.symbol,shortName:o(e.symbol),callers:b.map(l=>({symbol:l.symbol,shortName:o(l.symbol),file:l.file})),callees:f.map(l=>({symbol:l.symbol,shortName:o(l.symbol),file:l.file}))}}export{R as a};
|
|
2
|
+
//# sourceMappingURL=chunk-IKAJI4SI.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as R}from"./chunk-
|
|
1
|
+
import{a as R}from"./chunk-BTYDBDX5.js";import{a as _,d as f}from"./chunk-5CJ6AQN7.js";import{d as l}from"./chunk-7XP7ZRSI.js";import{o as u,p,q as a}from"./chunk-JLZUM476.js";import{a as d}from"./chunk-64MNV6AB.js";import{y as m}from"./chunk-M2TRDR25.js";function $(e,o={}){let{scope:n,limit:r}=o,i=new R(e),t=D([...x(e,n),...O(e,i,n)]);return y(t),r?t.slice(0,r):t}function x(e,o){let n=[];for(let r of S(e,o)){if(e.isIgnored(r.barrel_path)||e.isIgnored(r.original_path)||f(e,r.barrel_path)||m(e,r.barrel_path)&&a(e,r.barrel_path).length===0)continue;let i=N(e,r),t=i?.barrel_consumers??0,s=i?.direct_consumers??0;t!==0||s!==0||n.push({barrelFile:r.barrel_path,symbol:r.symbol,shortName:l(r.symbol),originalFile:r.original_path,barrelConsumers:t,directConsumers:s,...b(e,r.barrel_path)})}return n}function S(e,o){let n=o?"AND barrel_d.relative_path LIKE ?":"",r=o?[`%${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-CYDOV3AQ.js";import{a as _,d as f}from"./chunk-5CJ6AQ
|
|
|
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 O(e,o,n){let r=[];for(let i of C(e,n))h(e,i,i)>0||r.push(...I(e,o,i));return r}function C(e,o){return d(e,{scope:o,includeIgnored:!1}).filter(n=>a(e,n).length>0||u(e,n).length>0)}function I(e,o,n){let r=a(e,n).filter(t=>t.sourcePath&&!e.isIgnored(t.sourcePath)).flatMap(t=>g(e,o,n,t.sourcePath,[A(t.specifier)])),i=u(e,n).filter(t=>t.sourcePath&&!e.isIgnored(t.sourcePath)).flatMap(t=>g(e,o,n,t.sourcePath,t.kind==="named"&&t.names.length>0?t.names:[t.kind==="star"?`* from ${t.sourcePath}`:`* namespace from ${t.sourcePath}`]));return[...r,...i]}function g(e,o,n,r,i){let t=o.definitionsForFile(r);return i.map(s=>{let c=t.find(E=>E.leaf===s);return{barrelFile:n,symbol:c?.symbol??`source-reexport:${n}:${s}`,shortName:c?l(c.symbol):s,originalFile:r,barrelConsumers:0,directConsumers:h(e,r,n),...b(e,n)}})}function A(e){return e.split("::").at(-1)?.split("/").at(-1)?.replace(/\.[^.]+$/,"")??e}function b(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 h(e,o,n){let r=new Set;for(let i of d(e,{includeIgnored:!1}))if(i!==n)for(let t of p(e,i))t.sourcePath===o&&r.add(i);return r.size}function D(e){let o=new Set,n=[];for(let r of e){let i=`${r.barrelFile}|${r.symbol}|${r.originalFile}`;o.has(i)||(o.add(i),n.push(r))}return n}function y(e){e.sort((o,n)=>n.directConsumers-o.directConsumers||o.barrelFile.localeCompare(n.barrelFile)||o.shortName.localeCompare(n.shortName))}export{$ as a};
|
|
61
|
-
//# sourceMappingURL=chunk-
|
|
61
|
+
//# sourceMappingURL=chunk-IZLWLO4X.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as g}from"./chunk-BGUYAA3Q.js";import{a as d}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as g}from"./chunk-BGUYAA3Q.js";import{a as d}from"./chunk-BTYDBDX5.js";import{a as c}from"./chunk-FY6RCFDH.js";import{d as p}from"./chunk-7XP7ZRSI.js";import{f as o}from"./chunk-JLZUM476.js";import{B as u}from"./chunk-TLTLJ4SW.js";function F(r,a={}){let{scope:l,limit:s=30,scanLimit:b}=a,f=new d(r);return g({candidates:()=>f.productionCallableDefinitions({scope:l,files:a.files,minLoc:2,excludeRootedSymbols:!0,requireFunctionLikeSymbol:!0}),filterCandidate:e=>y(e.relativePath),scanLimit:b,profile:{name:"unused-params"},evaluate:e=>{let n=o(r,e.relativePath)?.callables.find(t=>t.startLine===e.startLine&&t.endLine===e.endLine);if(!n||n.params.length===0||n.params.some(t=>!t.simple)||n.paramsEndLine>=n.endLine)return null;let L=c(r,e.relativePath),m=[];for(let t=n.params.length-1;t>=0;t--){let i=n.params[t];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 a=u(r);return a==="typescript"||a==="tsx"||a==="javascript"}function h(r,a,l){return r?r.some(s=>s>a&&s<=l):!1}export{F as a};
|
|
2
|
+
//# sourceMappingURL=chunk-JYBP5ZIR.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{D as G,F as W,G as Z,k as te,l as ie,m as re,n as $,w as B,x}from"./chunk-
|
|
1
|
+
import{D as G,F as W,G as Z,k as te,l as ie,m as re,n as $,w as B,x}from"./chunk-SQJ72PQW.js";import{a as J}from"./chunk-JLZUM476.js";import{d as X,g as U,i as z,k as ee,m as ne,q as O,s as P,v as L,w as j,x as F}from"./chunk-M2TRDR25.js";import{existsSync as Re,readFileSync as Ie}from"fs";import{resolve as De}from"path";function Je(n,e){return N(n,e,t=>{let i=t?`AND m.symbol_id IN (${t.map(()=>"?").join(",")})`:"";return n.all(`SELECT
|
|
2
2
|
m.symbol_id,
|
|
3
3
|
d.relative_path,
|
|
4
4
|
COUNT(*) AS ref_count
|
|
@@ -26,4 +26,4 @@ import{D as G,F as W,G as Z,k as te,l as ie,m as re,n as $,w as B,x}from"./chunk
|
|
|
26
26
|
${i}
|
|
27
27
|
${n.pathExclusionsFor("d")}
|
|
28
28
|
ORDER BY d.relative_path, c.start_line`,...t??[])})}function N(n,e,t){if(!e)return t();if(e.length===0)return[];let i=[];for(let r=0;r<e.length;r+=750)i.push(...t(e.slice(r,r+750)));return i}var ve=/^[A-Za-z_][A-Za-z0-9_]*$/,oe=/\bDefault::default\b/g,Me=/^\.\.\s*Default::default\b/;function se(n,e){let t=new Map,i=new Map;for(let r of e){let a=Y(n,r,i);a!==null&&t.set(r.symbolId,a)}return t}function Y(n,e,t=new Map){let i=xe(e.symbol);if(!i)return null;let r=ae(n,[e.symbolId]);if(r.length===0)return null;let a=new RegExp(`(^|[^A-Za-z0-9_])${J(i)}::default\\b`,"g"),o=new RegExp(`(^|[^A-Za-z0-9_])${J(i)}\\s*$`),f=Ce(n,e.symbolId),m=[];for(let S of r){let d=Ee(n,S.relative_path,t);if(d===null)return null;let l=d.split(/\r?\n/),u=0,p=[],b=0;for(let R=S.chunk_start;R<=S.chunk_end&&R<l.length;R+=1){let D=l[R]??"",w=new Set;a.lastIndex=0;let M;for(;M=a.exec(D);)m.push({file:S.relative_path,line:R,column:M.index+M[1].length+i.length+2}),b+=1;for(let c=0;c<D.length;c+=1){let y=Me.exec(D.slice(c));if(y){if(f&&p.includes(u)){let g=c+y[0].lastIndexOf("default");m.push({file:S.relative_path,line:R,column:g}),w.add(g),b+=1}c+=y[0].length-1;continue}let h=D[c];if(h==="{"){let g=o.test(D.slice(0,c));u+=1,g&&p.push(u);continue}if(h==="}")for(u=Math.max(0,u-1);p.length>0&&p[p.length-1]>u;)p.pop()}for(oe.lastIndex=0;M=oe.exec(D);){let c=M.index+9;if(!w.has(c))return null}}if(b===0)return null}return te(m)}function Ce(n,e){return n.get("SELECT 1 AS present FROM mentions WHERE symbol_id = ? AND role = 1 LIMIT 1",e)?.present===1}function xe(n){let e=/impl#\[([^\]]+)\]\[Default\]default\(\)\./.exec(n)?.[1]??null;return!e||!ve.test(e)?null:e}function Ee(n,e,t){if(t.has(e))return t.get(e)??null;let i=n.get("SELECT text FROM documents WHERE relative_path = ?",e),r=typeof i?.text=="string"?i.text:_e(n,e);return t.set(e,r),r}function _e(n,e){let t=De(n.config.projectRoot,e);if(!Re(t))return null;try{return Ie(t,"utf8")}catch{return null}}function ce(n){let e=new Map;for(let t of n){let i=e.get(t.relativePath)??[];i.push(t),e.set(t.relativePath,i)}return e}var Pe="typescript-import-usage-v1",we="typescript-signatures-v1",Q=X("semantic-prefetched-callees",{clearGroups:["whole-project","source-file","semantic-provider"]}),le=j({kind:"semantic-import-usage",invalidation:F("semantic-import-usage"),serialize:n=>JSON.stringify(n),deserialize:he}),ue=j({kind:"semantic-signatures",invalidation:F("semantic-signatures"),serialize:n=>JSON.stringify(n),deserialize:Le}),fe=L({kind:"typescript-import-usage",invalidation:F("typescript-import-usage"),serialize:n=>JSON.stringify(n),deserialize:he}),me=L({kind:"typescript-signatures",invalidation:F("typescript-signatures"),serialize:n=>JSON.stringify(n),deserialize:je});function k(n){let e=new Map,t=new Set;return{capability:(i,r)=>ye(n,i,r),importUsage:i=>Fe(n,i),references:i=>de(n,i),materializeReferences:(i,r)=>ge(n,i,e,t,r),callerMap:i=>Ae(n,i,e,t),calleeMap:i=>He(n,i),signature:i=>Ue(n,i)}}function Te(n,e){if(e.size===0)return;let t=Q.get(n,()=>new Map);for(let[i,r]of e)t.set(i,[...r])}function fn(n,e){if(!Q.has(n))return{hits:[],misses:[...e]};let t=Q.get(n,()=>new Map),i=[],r=[];for(let a of e)t.has(a.symbolId)?i.push({definition:a,callees:t.get(a.symbolId)??[]}):r.push(a);return{hits:i,misses:r}}function mn(n,e){return k(n).importUsage(e)}function Fe(n,e){if(x(e)==="typescript"){let a="fallback",o=0,f=0,m=0,S=0;return P("typescript.import-usage.materialize",()=>{let d=G(n,e,Pe);if(d?.key){o=1;let u=fe.read(n,e,d.key);if(u)return a="hit",f=1,u;m=1;let p=E(n,e);if(!p)return a="unavailable",[];let b=p.importUsage(e);return fe.write(n,e,d.key,b),a="computed",b}S=1;let l=E(n,e);return l?(a="direct-fallback",l.importUsage(e)):(a="unavailable",[])},()=>({state:a,eligible:o,cacheHits:f,cacheMisses:m,fallbacks:S}))}let t=Se(n,"semantic-import-usage",e);if(t){let a=le.read(n,e,t);if(a)return a}let i=E(n,e);if(!i)return[];let r=i.importUsage(e);return t&&le.write(n,e,t,r),r}function pn(n,e){return k(n).references(e)}function de(n,e){let t=Y(n,e);if(t)return t;let i=re(n,e);if(i)return i;let r=E(n,e.relativePath);return r?r.referencesFor(e):[]}function dn(n,e){return k(n).callerMap(e)}function gn(n,e){let t=new Map,i=new Map;for(let r of e){if(x(r.relativePath)==="typescript"){let a=E(n,r.relativePath);if(!a)continue;let o=i.get(a)??[];o.push(r),i.set(a,o);continue}K(n,t,r,de(n,r))}for(let[r,a]of i){let o=Z(n,a),f=o?.references??(r.referencesForDefinitions?r.referencesForDefinitions(a,{exact:!0}):new Map(a.map(m=>[m.symbolId,r.referencesFor(m)])));!o&&O()&&W(n,a,f);for(let m of a)K(n,t,m,f.get(m.symbolId)??[])}return t}function Ae(n,e,t=new Map,i=new Set){let r=new Map,a=ge(n,e,t,i),o=0;return P("semantic.callers.from-references",()=>{for(let f of e)o+=K(n,r,f,t.get(f.symbolId)??[])},()=>({definitions:e.length,materialized:a.definitions,inMemoryHits:a.inMemoryHits,incompleteInMemoryHits:a.incompleteInMemoryHits,resultRows:r.size,callerFiles:o})),r}function ge(n,e,t,i,r={}){let a=z(n),o=[],f=[],m=[],S=0,d=0,l=0,u=0,p=0,b=0,R=0,_=0,D=0,w=0,M=0,c=0,y=[],h=new Map,g=e.filter(s=>x(s.relativePath)==="typescript"&&!t.has(s.symbolId)&&!i.has(s.symbolId)),v=Z(n,g);if(v){D=g.length,w=v.cacheHits,M=v.cacheMisses,c=v.computedFiles;for(let s of g)t.set(s.symbolId,v.references.get(s.symbolId)??[])}if(P("semantic.references.cache-scan",()=>{for(let[s,I]of ce(e)){let T=[];for(let C of I)t.has(C.symbolId)?d+=1:i.has(C.symbolId)?_+=1:T.push(C);if(T.length===0){R+=1;continue}let H=ke(n,a,s);if(!H){for(let C of T)x(C.relativePath)||(S+=1),m.push(C);continue}b+=1;let be=ee(n,s,H);for(let C of T){let V=be.get(C.symbol)??null;if(V!==null){let q=Ne(V);if(q){l+=1,t.set(C.symbolId,q);continue}u+=1}f.push({definition:C,cacheFingerprint:H})}}},()=>({definitions:e.length,skippedUnsupportedLanguage:S,cacheHits:l,parseFailures:u,misses:f.length,unkeyed:m.length,inMemoryHits:d,incompleteInMemoryHits:_,fullyInMemoryFiles:R,cacheReadFiles:b})),f.length>0||m.length>0){y=[...m,...f.map(s=>s.definition)],h=P("semantic.references.compute-misses",()=>{let s=Oe(n,y,r);return p=s.size,s},()=>({definitions:y.length,misses:f.length,unkeyed:m.length,rows:p}));for(let s of y)h.has(s.symbolId)?(t.set(s.symbolId,h.get(s.symbolId)??[]),i.delete(s.symbolId)):i.add(s.symbolId);for(let{definition:s,cacheFingerprint:I}of f)h.has(s.symbolId)&&ye(n,"semantic-references",s.relativePath).available&&o.push({relativePath:s.relativePath,symbol:s.symbol,projectFingerprint:I,payload:JSON.stringify(h.get(s.symbolId)??[])})}return o.length>0&&P("semantic.references.cache-write",()=>ne(n,o),()=>({entries:o.length})),h.size>0&&W(n,y,h),{definitions:e.length,inMemoryHits:d,incompleteInMemoryHits:_,cacheHits:l,misses:f.length,unkeyed:m.length,skippedUnsupportedLanguage:S,parseFailures:u,computed:p,incomplete:i.size,cacheWrites:o.length,fragmentDefinitions:D,fragmentCacheHits:w,fragmentCacheMisses:M,fragmentComputedFiles:c}}function ke(n,e,t){if(!e)return null;let i=x(t);return i==="typescript"?e:i==="rust"?U(JSON.stringify({kind:"semantic-references",language:i,engine:$(n.config.projectRoot),projectFingerprint:e})):null}function Oe(n,e,t={}){let i=O(),r=new Map,a=0,o=0,f=0,m=0,S=0,d=0,l=0,u=0,p=0;return P("semantic.references.provider-loop",()=>{let b=se(n,e),R=ie(n,e),_=new Map,D=t.prefetchCallees?new Map:null,w=[];for(let c of e){let y,h=()=>(y??=E(n,c.relativePath),y);if(D){let I=h();if(I?.referencesAndCalleesForDefinitions){let T=D.get(I);T?T.push(c):D.set(I,[c]),p+=1}}let g=b.get(c.symbolId);if(g){f+=1,m+=g.length,A(r,c.symbolId,g,i,I=>{l+=1,u+=I});continue}let v=R.get(c.symbolId);if(v){S+=1,d+=v.length,A(r,c.symbolId,v,i,I=>{l+=1,u+=I});continue}let s=h();if(!s){i&&(o+=1);continue}if(i&&(a+=1),s.referencesForDefinitions){let I=_.get(s);I?I.push(c):_.set(s,[c])}else w.push({provider:s,definition:c})}let M=new Set;if(D)for(let[c,y]of D){if(!c.referencesAndCalleesForDefinitions)continue;let h=_.get(c)??[],g=c.referencesAndCalleesForDefinitions(h,y);M.add(c),Te(n,g.callees);for(let v of h){if(!g.references.has(v.symbolId))continue;let s=g.references.get(v.symbolId)??[];A(r,v.symbolId,s,i,I=>{l+=1,u+=I})}}for(let[c,y]of _){if(M.has(c))continue;let h=c.referencesForDefinitions(y);for(let g of y){if(!h.has(g.symbolId))continue;let v=h.get(g.symbolId)??[];A(r,g.symbolId,v,i,s=>{l+=1,u+=s})}}for(let{provider:c,definition:y}of w){let h=c.referencesFor(y);A(r,y.symbolId,h,i,g=>{l+=1,u+=g})}return r},()=>({definitions:e.length,providerHits:a,providerMisses:o,rustDefaultFastPathRows:f,rustDefaultFastPathReferences:m,rustScipOccurrenceFastPathRows:S,rustScipOccurrenceFastPathReferences:d,prefetchCalleeDefinitions:p,definitionsWithReferences:l,referenceCount:u,rows:r.size}))}function A(n,e,t,i,r){n.set(e,t),i&&t.length>0&&r(t.length)}function K(n,e,t,i){let r=0;for(let a of i){if(a.file===t.relativePath||n.isIgnored(a.file))continue;let o=e.get(t.symbolId);o||(o=new Set,e.set(t.symbolId,o));let f=o.size;o.add(a.file),o.size!==f&&(r+=1)}return r}function Ne(n){try{return JSON.parse(n)}catch{return null}}function Sn(n,e){return k(n).calleeMap(e)}function He(n,e){let t=O(),i=new Map,r=0,a=0,o=0,f=0;return P("semantic.callees.provider-loop",()=>{let m=new Map,S=[];for(let d of e){let l=E(n,d.relativePath);if(!l){t&&(a+=1);continue}t&&(r+=1);let u=d;if(l.calleesForDefinitions){let p=m.get(l);p?p.push(u):m.set(l,[u])}else S.push({provider:l,definition:u})}for(let[d,l]of m){let u=d.calleesForDefinitions(l);for(let p of l){let b=u.get(p.symbolId)??[];pe(i,p.symbolId,b,t,R=>{o+=1,f+=R})}}for(let{provider:d,definition:l}of S){let u=d.calleesFor(l);pe(i,l.symbolId,u,t,p=>{o+=1,f+=p})}return i},()=>({definitions:e.length,providerHits:r,providerMisses:a,definitionsWithCallees:o,calleeCount:f,rows:i.size}))}function pe(n,e,t,i,r){t.length>0&&(n.set(e,t),i&&r(t.length))}function hn(n,e){return k(n).signature(e)}function Ue(n,e){if(x(e.relativePath)==="typescript"){let o="fallback",f=0,m=0,S=0,d=0;return P("typescript.signature.materialize",()=>{let l=G(n,e.relativePath,we);if(l?.key){f=1;let p=me.read(n,e.relativePath,l.key)??{};if(Object.prototype.hasOwnProperty.call(p,e.symbol))return o="hit",m=1,p[e.symbol]??null;S=1;let b=E(n,e.relativePath);if(!b)return o="unavailable",null;let R=b.signatureFor(e);return me.write(n,e.relativePath,l.key,{...p,[e.symbol]:R}),o="computed",R}d=1;let u=E(n,e.relativePath);return u?(o="direct-fallback",u.signatureFor(e)):(o="unavailable",null)},()=>({state:o,eligible:f,cacheHits:m,cacheMisses:S,fallbacks:d}))}let t=Se(n,"semantic-signatures",e.relativePath),i=ze(e);if(t){let o=ue.read(n,i,t);if(o)return o.signature}let r=E(n,e.relativePath);if(!r)return null;let a=r.signatureFor(e);return t&&ue.write(n,i,t,{signature:a}),a}function Se(n,e,t){let i=z(n);if(!i)return null;let r=x(t);return r!=="rust"?null:U(JSON.stringify({kind:e,language:r,engine:$(n.config.projectRoot),projectFingerprint:i}))}function ze(n){return`${n.relativePath}\0${n.symbol}`}function he(n){try{let e=JSON.parse(n);return Array.isArray(e)?e:null}catch{return null}}function Le(n){try{let e=JSON.parse(n);if(!e||typeof e!="object")return null;let t=e.signature;return t!==null&&typeof t!="string"?null:{signature:t}}catch{return null}}function je(n){try{let e=JSON.parse(n);if(!e||typeof e!="object"||Array.isArray(e))return null;for(let t of Object.values(e))if(t!==null&&typeof t!="string")return null;return e}catch{return null}}function ye(n,e,t){let i=x(t);if(!i)return{slot:e,language:"typescript",available:!1,reason:"semantic evidence is only available for TypeScript or Rust files"};try{return{slot:e,language:i,...B(n,t).availability()}}catch(r){return{slot:e,language:i,available:!1,reason:r instanceof Error?r.message:String(r)}}}function E(n,e){if(!x(e))return null;let t=B(n,e);return t.availability().available?t:null}export{Je as a,$e as b,Be as c,ae as d,ce as e,k as f,fn as g,mn as h,pn as i,dn as j,gn as k,Sn as l,hn as m};
|
|
29
|
-
//# sourceMappingURL=chunk-
|
|
29
|
+
//# sourceMappingURL=chunk-KWMRY4RN.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as u}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as u}from"./chunk-BTYDBDX5.js";import{a as h}from"./chunk-3YEBIYXL.js";import{m as S}from"./chunk-FY6RCFDH.js";import{a as d,c as b}from"./chunk-2HCWAL42.js";import{d as m,z as y}from"./chunk-7XP7ZRSI.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-KWQKWY6M.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as f}from"./chunk-5N5ZC566.js";import{a as d}from"./chunk-
|
|
1
|
+
import{a as f}from"./chunk-5N5ZC566.js";import{a as d}from"./chunk-BTYDBDX5.js";import{j as c}from"./chunk-KWMRY4RN.js";import{d as u}from"./chunk-7XP7ZRSI.js";function L(e,n,i={}){let t=f(e,n);if(!t)return null;let r=h(e,t);if(!r||e.isIgnored(r.relative_path))return null;let s=[],m=0,l=g(e,r.relative_path),p=i.semantic===!1?new Map:c(e,l);for(let o of l){let a=S(e,r,o,p.get(o.symbolId)??new Set);m+=a,s.push({symbol:o.symbol,shortName:u(o.symbol),startLine:o.startLine,endLine:o.endLine,externalConsumers:a,riskLevel:b(a)})}return{file:r.relative_path,symbols:s,totalExternalConsumers:m}}function h(e,n){return e.get(`SELECT id, relative_path FROM documents
|
|
2
2
|
WHERE relative_path = ?
|
|
3
3
|
${e.pathExclusionsFor("documents")}
|
|
4
4
|
LIMIT 1`,n)??null}function g(e,n){return new d(e).definitionsForFile(n).sort((i,t)=>i.startLine-t.startLine||i.endLine-t.endLine)}function S(e,n,i,t){let r=e.all(`SELECT DISTINCT consumer_d.relative_path
|
|
@@ -8,4 +8,4 @@ import{a as f}from"./chunk-5N5ZC566.js";import{a as d}from"./chunk-CYDOV3AQ.js";
|
|
|
8
8
|
WHERE m.symbol_id = ?
|
|
9
9
|
AND m.role != 1
|
|
10
10
|
AND c.document_id != ?`,i.symbolId,n.id);return new Set([...r.map(s=>s.relative_path),...[...t].filter(s=>s!==n.relative_path)]).size}function b(e){return e>10?"high":e>0?"medium":"low"}export{L as a};
|
|
11
|
-
//# sourceMappingURL=chunk-
|
|
11
|
+
//# sourceMappingURL=chunk-MBDBNQBW.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{a as o}from"./chunk-E7BTIEAY.js";import{execFileSync as c}from"child_process";import{createRequire as P}from"module";import{existsSync as x}from"fs";import{platform as i,arch as g}from"os";var h="v0.8.1",u="https://github.com/sourcegraph/scip",d="SCIP_QUERY_SCIP_BIN";function E(e){if(e.isOnPath("scip"))return{source:"path",path:"scip"};let t=e.env[d];if(t&&e.fileExists(t))return{source:"env",path:t};if(e.platform==="win32"){let r=e.resolveSidecar(e.arch);if(r&&e.fileExists(r))return{source:"sidecar",path:r}}return null}function _(e){let t=P(import.meta.url);for(let r of e==="arm64"?["arm64","x64"]:[e])try{return t.resolve(`scip-query-scip-windows/scip-win32-${r}.exe`)}catch{}return null}function m(e=process.env){return E({platform:i(),arch:g(),env:e,isOnPath:o,fileExists:x,resolveSidecar:_})?.path??null}function B(){return m()!==null}function K(){let e=m();if(!e)return null;try{return c(e,["--version"],{stdio:"pipe"}).toString().trim()}catch{return null}}function j(){let e=i(),t=g(),r,n,l;switch(e){case"darwin":r="darwin",l="tar.gz";break;case"linux":r="linux",l="tar.gz";break;default:return null}switch(t){case"arm64":n="arm64";break;case"x64":n="amd64";break;default:return null}let f=`scip-${r}-${n}.${l}`;return{url:`${u}/releases/download/${h}/${f}`,filename:f}}function H(){let e=j();console.log("\nThe `scip` CLI is required but not found on PATH.\n"),i()==="darwin"?(console.log("Install via Homebrew:"),console.log(` brew install sourcegraph/scip/scip
|
|
2
|
+
`),console.log("Or download manually:")):i()==="win32"?(console.log("On Windows the scip binary ships via the npm sidecar package scip-query-scip-windows,"),console.log("installed automatically with scip-query. If it is missing:"),console.log(" npm install -g scip-query-scip-windows"),console.log(`Or set ${d} to a local scip.exe path.
|
|
3
|
+
`),console.log("Upstream release page:")):console.log("Download from:"),console.log(e?` ${e.url}
|
|
4
|
+
`:` ${u}/releases/tag/${h}
|
|
5
|
+
`),console.log("After installing, ensure `scip` is on your PATH and run `scip-query reindex`.")}function W(e){if(i()==="darwin"&&o("brew")){e("Installing scip CLI via Homebrew...");try{if(c("brew",["install","sourcegraph/scip/scip"],{stdio:"inherit",timeout:3e5,env:process.env}),o("scip"))return e("Successfully installed scip CLI via Homebrew"),!0}catch(t){let r=t instanceof Error?t.message:String(t);e(`Homebrew install failed: ${r}`)}}if(o("go")){e("Installing scip CLI via go install...");try{if(c("go",["install","github.com/sourcegraph/scip/cmd/scip@latest"],{stdio:"inherit",timeout:3e5,env:process.env}),o("scip"))return e("Successfully installed scip CLI via go install"),!0}catch(t){let r=t instanceof Error?t.message:String(t);e(`go install failed: ${r}`)}}return e("Could not auto-install scip CLI."),e(`Install manually from: ${u}/releases`),!1}import{readFileSync as R,writeFileSync as A,existsSync as y,mkdirSync as $,realpathSync as O}from"fs";import{isAbsolute as Q,join as s,relative as X,resolve as C}from"path";import{createHash as I}from"crypto";import{homedir as k}from"os";var a=".scipquery.json",v=250,S=0,w=10*6e4,M={enabled:!1,debounceMs:v,cooldownMs:S,gitPollMs:2e3,idleTimeoutMs:w,autoRefresh:!0,ignore:[]},N=["typescript","javascript","java","scala","kotlin","rust","python","ruby","go","cpp","c","csharp","vb","dart","php","clojure"];var re=new Set(N);function te(e){let t=s(e,a);if(!y(t))return{};try{let r=R(t,"utf-8");return JSON.parse(r)}catch(r){let n=r instanceof Error?r.message:String(r);throw r instanceof SyntaxError?new Error(`invalid ${a} at ${t}: ${n}`,{cause:r}):new Error(`unable to read ${a} at ${t}: ${n}`,{cause:r})}}function ne(e){return{...M,...e.watch}}function D(e,t){let r=process.env.SCIP_QUERY_CACHE_DIR;if(r)return p(r);if(t?.dbPath)return p(C(e,t.dbPath));let n=T(e);return p(n)}function b(){let e=process.env.XDG_CACHE_HOME;return s(e||s(k(),".cache"),"scip-query")}function T(e){let t=C(e);try{t=O(t)}catch{}let r=I("sha256").update(t).digest("hex").slice(0,12);return s(b(),"projects",r)}function se(e){if(!/^[a-f0-9]{24}$/.test(e))throw new Error(`invalid repository cache identity: ${e}`);return s(b(),"repositories",e)}function oe(e){return process.env.SCIP_QUERY_SHARED_CACHE!=="0"&&!process.env.SCIP_QUERY_CACHE_DIR&&!process.env.SCIP_QUERY_INDEX_DB&&!e?.dbPath}function ie(e,t){let r=D(e,t);return{cacheDir:r,dbPath:s(r,"index.db"),indexPath:s(r,"index.scip"),metaPath:s(r,"meta.json")}}function ae(e,t){let r=s(e,a);return y(r)||A(r,JSON.stringify({languages:t,watch:{enabled:!0,debounceMs:v,cooldownMs:S,gitPollMs:2e3,idleTimeoutMs:w,autoRefresh:!0}},null,2)+`
|
|
6
|
+
`),r}function p(e){return $(e,{recursive:!0}),e}export{m as a,B as b,K as c,H as d,W as e,te as f,ne as g,T as h,se as i,oe as j,ie as k,ae as l};
|
|
7
|
+
//# sourceMappingURL=chunk-MON5XXTG.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as C}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as C}from"./chunk-BTYDBDX5.js";import{m as v}from"./chunk-FY6RCFDH.js";import{f as O,i as x,l as T}from"./chunk-KWMRY4RN.js";import{d as A}from"./chunk-7XP7ZRSI.js";import{f as b}from"./chunk-JLZUM476.js";import{B as g}from"./chunk-TLTLJ4SW.js";function H(e,n={}){let{samples:o=50,scope:r,maxDisagreements:u=5}=n,l=new C(e),a=B(l.productionCallableDefinitions({scope:r,minLoc:2,requireFunctionLikeSymbol:!0}),o),c=K(e,a);if(a.length===0||!c)return{available:!1,sampleSize:a.length,oracleCoverage:0,scores:[],topDisagreements:[]};let t={references:P(),callees:P()},i=[],f=0,m=c==="semantic"?T(e,a):new Map,I=c==="source"?E(e,l,a):null;for(let s of a){let p=S(s,c==="semantic"?x(e,s).map(d=>d.file):[...I?.referencesBySymbolId.get(s.symbolId)??[]]),j=S(s,c==="semantic"?(m.get(s.symbolId)??[]).map(d=>d.file):[...I?.calleesBySymbolId.get(s.symbolId)??[]]);f+=1;let L=S(s,v(e,s).map(d=>d.file)),k=S(s,(l.calleeMap([s],{semantic:!1}).get(s.symbolId)??[]).map(d=>d.file)),w=y(c,"references"),R=y(c,"callees");Q(t.references,s,"references",L,p,w,i),Q(t.callees,s,"callees",k,j,R,i)}return i.sort((s,p)=>p.cheapOnly.length+p.oracleOnly.length-(s.cheapOnly.length+s.oracleOnly.length)),{available:!0,sampleSize:a.length,oracleCoverage:a.length>0?D(f/a.length):0,oracleKind:c,scores:["references","callees"].map(s=>F(s,t[s],c)),topDisagreements:i.slice(0,u)}}function P(){return{comparedSymbols:0,agreed:0,cheapTotal:0,oracleTotal:0,skippedOraclePartial:0}}function B(e,n){let o=[...e].sort((l,a)=>l.symbolId-a.symbolId);if(o.length<=n)return o;let r=o.length/n,u=[];for(let l=0;l<n;l++)u.push(o[Math.floor(l*r)]);return u}function K(e,n){let o=n[0];if(!o)return null;if(h(e,o))return"source";try{if(O(e).capability("semantic-references",o.relativePath).available)return"semantic"}catch{}return n.some(r=>h(e,r))?"source":null}function S(e,n){let o=new Set;for(let r of n)r!==e.relativePath&&o.add(r);return o}function Q(e,n,o,r,u,l,a){if(!l&&u.size===0){e.skippedOraclePartial+=1;return}e.comparedSymbols+=1,e.cheapTotal+=r.size,e.oracleTotal+=u.size;let c=[],t=[];for(let i of r)u.has(i)?e.agreed+=1:c.push(i);for(let i of u)r.has(i)||t.push(i);(c.length>0||t.length>0)&&a.push({symbol:A(n.symbol),question:o,cheapOnly:c,oracleOnly:t})}var z={references:!0,callees:!1};function F(e,n,o){let r=n.oracleTotal>0?n.agreed/n.oracleTotal:1,u=n.cheapTotal-n.agreed,l=y(o,e);return{question:e,comparedSymbols:n.comparedSymbols,precision:l&&n.cheapTotal>0?D(n.agreed/n.cheapTotal):null,recall:D(r),unverified:u,skippedOraclePartial:n.skippedOraclePartial}}function y(e,n){return e==="semantic"?z[n]:!1}function h(e,n){return g(n.relativePath)==="clojure"&&b(e,n.relativePath)!==null}function E(e,n,o){let r=new Map,u=new Map,l=o.filter(t=>h(e,t)),a=new Map;for(let t of l){let i=a.get(t.leaf)??[];i.push(t),a.set(t.leaf,i)}for(let t of n.sourceFiles()){if(g(t)!=="clojure")continue;let i=b(e,t);if(i)for(let f of i.fileIdentifiers)for(let m of a.get(f)??[])M(r,m.symbolId,t)}let c=new Map;for(let t of n.scopedDefinitions()){if(g(t.relativePath)!=="clojure")continue;let i=c.get(t.leaf)??[];i.push(t),c.set(t.leaf,i)}for(let t of l){let i=b(e,t.relativePath);if(i){for(let f of i.callSites)if(!(f.line<t.startLine||f.line>t.endLine))for(let m of c.get(f.calleeLeaf)??[])M(u,t.symbolId,m.relativePath)}}return{referencesBySymbolId:r,calleesBySymbolId:u}}function M(e,n,o){let r=e.get(n);if(r){r.add(o);return}e.set(n,new Set([o]))}function D(e){return Math.round(e*1e3)/1e3}export{H as a};
|
|
2
|
+
//# sourceMappingURL=chunk-O27267B6.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{a as j}from"./chunk-TAB7AWKO.js";import{a as N,b as g,c as R}from"./chunk-
|
|
1
|
+
import{a as j}from"./chunk-TAB7AWKO.js";import{a as N,b as g,c as R}from"./chunk-V7MX6YUF.js";import{a as _}from"./chunk-BGUYAA3Q.js";import{a as E}from"./chunk-B75HZHUP.js";import{a as P}from"./chunk-BTYDBDX5.js";import{a as k}from"./chunk-BGBBVSH4.js";import{g as C}from"./chunk-3YEBIYXL.js";import{a as w}from"./chunk-FY6RCFDH.js";import{d,e as y,k as v,z as L}from"./chunk-7XP7ZRSI.js";import{i as S}from"./chunk-JLZUM476.js";import{s as x}from"./chunk-M2TRDR25.js";import{basename as m,extname as b}from"path";function ae(t,n){let{scope:e,maxLoc:i=15,limit:a=30,scanLimit:o}=n??{},r=new P(t),s=z(r.fileDependencyGraph(e));return _({candidates:()=>B(t,r,e,i),orderCandidates:E,scanLimit:o,profile:{name:"wrapper-candidates"},prepare:l=>({callerFileMap:A(t,r,l,{semantic:n?.semantic!==!1}),reverseFanIn:s}),evaluate:(l,u)=>O(t,r,l,u),orderResults:(l,u)=>u.callerFanIn-l.callerFanIn||u.loc-l.loc,limit:a})}function A(t,n,e,i){let a=N(t,n),o=g(a.forDefinitions(e,{semantic:!1,sourceFallback:!1})),r=[];i.semantic&&x("wrapper.semantic-candidates",()=>{r=e.filter(c=>F(t,n,c,o).length<=1)},()=>({symbols:e.length,semanticCandidates:r.length}));let s=r.length===0?new Map:g(a.forDefinitions(r,{semantic:!0,sourceFallback:!1})),l=s.size===0?o:C(o,s),u=new Map(e.map(c=>[c.symbolId,c])),f=new Map;for(let c of e){let I=F(t,n,c,l);if(I.length>1||(f.set(c.symbolId,c),I.length!==1))continue;let D=I[0],M=T(t,c.symbolId,D);if(!M)continue;let p=W(n,t,D,c.symbol,M);p?.isFunctionLike&&u.has(p.symbolId)&&f.set(p.symbolId,u.get(p.symbolId))}let h=[...f.values()];return h.length===0?l:C(l,g(a.forDefinitions(h,{semantic:!1,sourceFallback:!0})))}function O(t,n,e,i){let a=F(t,n,e,i.callerFileMap);if(a.length!==1)return null;let o=a[0],r=T(t,e.symbolId,o);if(!r)return null;let s=W(n,t,o,e.symbol,r);if(s&&v(s.symbol))return null;let{fanIn:l,source:u}=J(i.callerFileMap,i.reverseFanIn,o,s);if(u==="function"?l<=3:l<=5)return null;let f=H(t,e,o,s);return{symbol:e.symbol,shortName:d(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:k(e),singleCaller:s?.symbol??"",singleCallerShort:s?.isFunctionLike?d(s.symbol):m(o),callerFanIn:l,actionTier:f.length>0?"signal":"direct",boundaryEvidence:f}}function B(t,n,e,i){return n.productionCallableDefinitions({scope:e,minLoc:2,maxLoc:i,requireFunctionLikeSymbol:!0,excludeRootedSymbols:!0,excludeRustTraitImplMembers:!0}).filter(a=>!S(t,a))}function F(t,n,e,i){let a=m(e.relativePath,b(e.relativePath)),o=[...i.get(e.symbolId)??[]].filter(r=>r!==e.relativePath).filter(r=>m(r,b(r))!==a).filter(r=>{let s=n.fileKind(r);return s!=="barrel"&&s!=="entry"&&s!=="test"});return R(t,e,o).realConsumers}function T(t,n,e){return t.get(`SELECT c.start_line, c.end_line
|
|
2
2
|
FROM mentions m
|
|
3
3
|
JOIN chunks c ON m.chunk_id = c.id
|
|
4
4
|
JOIN documents d ON c.document_id = d.id
|
|
5
5
|
WHERE m.symbol_id = ? AND m.role != 1 AND d.relative_path = ?
|
|
6
6
|
LIMIT 1`,n,e)}function W(t,n,e,i,a){let o=t.definitionsForFile(e),r=q(n,e,i,a.start_line,a.end_line);return L(o,r)}function J(t,n,e,i){if(i?.isFunctionLike){let a=[...t.get(i.symbolId)??[]].filter(o=>o!==i.relativePath);if(a.length>0)return{fanIn:a.length,source:"function"}}return{fanIn:G(n,e),source:"file"}}function q(t,n,e,i,a){let o=y(e);if(!o)return i;let r=w(t,n).get(o);if(!r||r.length===0)return i;for(let s of r)if(s>=i&&s<=a)return s;return i}function z(t){let n=new Map;for(let[e,i]of t){n.has(e)||n.set(e,n.get(e)??0);for(let a of i)n.set(a,(n.get(a)??0)+1)}return n}function G(t,n){let e=t.get(n)??0;if(e>0)return e;let i=m(n,b(n)),a=0;for(let[o,r]of t)o!==n&&m(o,b(o))===i&&r>a&&(a=r);return a}function H(t,n,e,i){return j(t,n.relativePath,n.startLine,"wrapper","explicit ignore-wrapper comment",[{label:"wrapper name",value:d(n.symbol)},{label:"caller name",value:i?.symbol?d(i.symbol):m(e)},{label:"wrapper path",value:n.relativePath},{label:"caller path",value:e}])}export{ae as a};
|
|
7
|
-
//# sourceMappingURL=chunk-
|
|
7
|
+
//# sourceMappingURL=chunk-O56VBJKB.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as x}from"./chunk-UWR52GNZ.js";import{b as g}from"./chunk-B75HZHUP.js";import{a as k}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as x}from"./chunk-UWR52GNZ.js";import{b as g}from"./chunk-B75HZHUP.js";import{a as k}from"./chunk-BTYDBDX5.js";import{b as L}from"./chunk-5CJ6AQN7.js";import{a as n}from"./chunk-BGBBVSH4.js";import{j as v}from"./chunk-KWMRY4RN.js";import{d as S}from"./chunk-7XP7ZRSI.js";import{s as a}from"./chunk-M2TRDR25.js";function E(c,f={}){let{scope:P,minLoc:F=3,scanLimit:d}=f,l=new k(c),b=f.semantic!==!1,y=0,m=a("isolated.candidates",()=>{let s=g(l.productionCallableDefinitions({scope:P,minLoc:F,excludeEntrySurfaces:!0,excludeRootedSymbols:!0,excludeRustTraitImplMembers:!0,includeSuppressed:!0,requireFunctionLikeSymbol:!0,sortByLocDesc:typeof d=="number"&&d>0}),d).filter(R=>!x(c,R));return y=s.length,s},()=>({definitions:y})),p=0,i=a("isolated.strict-callees",()=>{let e=l.symbolsWithNonSelfCallees(m,{additive:!1,semantic:!1});return p=e.size,e},()=>({definitions:m.length,symbols:p})),r=m.filter(e=>!i.has(e.symbolId)),C=0,N=a("isolated.scip-callers",()=>{let e=l.crossFileCallerMap(r,{semantic:!1});return C=e.size,e},()=>({definitions:r.length,symbols:C})),o=new Set(N.keys());for(let e of l.frameworkReferencedSymbolIds(r))o.add(e);let t=r.filter(e=>!o.has(e.symbolId));if(b&&t.length>0){for(let e of v(c,t).keys())o.add(e);for(let e of l.symbolsWithNonSelfCallees(t,{additive:!1,semantic:!0}))i.add(e);t=t.filter(e=>!o.has(e.symbolId)).filter(e=>!i.has(e.symbolId))}let h=0,W=a("isolated.source-fallback-callers",()=>{let e=l.sourceFallbackCallerFiles(t,{skipPath:s=>L(s)==="test"});return h=e.size,e},()=>({definitions:t.length,symbols:h}));for(let e of W.keys())o.add(e);let u=t.filter(e=>!o.has(e.symbolId)),I=0,M=a("isolated.additive-callees",()=>{let e=l.symbolsWithNonSelfCallees(u,{additive:!0,semantic:b});return I=e.size,e},()=>({definitions:u.length,symbols:I}));for(let e of M)i.add(e);return u.filter(e=>!i.has(e.symbolId)).sort((e,s)=>n(s)-n(e)||e.relativePath.localeCompare(s.relativePath)||e.startLine-s.startLine).map(e=>({symbol:e.symbol,shortName:S(e.symbol),relativePath:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:n(e)}))}export{E as a};
|
|
2
|
+
//# sourceMappingURL=chunk-OBPR6E5Z.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as g}from"./chunk-5N5ZC566.js";import{h as p}from"./chunk-
|
|
1
|
+
import{a as g}from"./chunk-5N5ZC566.js";import{h as p}from"./chunk-KWMRY4RN.js";import{a as f}from"./chunk-2HCWAL42.js";import{d as u,e as _,i as N}from"./chunk-7XP7ZRSI.js";import{p as d}from"./chunk-JLZUM476.js";import{B as l,b as c}from"./chunk-TLTLJ4SW.js";import{a as I}from"./chunk-64MNV6AB.js";import{y as b}from"./chunk-M2TRDR25.js";function Y(e,t,r={}){return T(e,t,r)?.map(s=>({symbol:s.symbol,shortName:s.shortName,fromFile:s.fromFile}))??[]}function Z(e,t){let r=f(e,t),s=O(e,t);if(s.length>0&&!x(r))return s;let o=k(e,t,r);return h(t)&&o.length>0?o:D([...s,...o])}function G(e,t,r={}){let s=g(e,t);if(!s)return[];let o=S(e,s),n=r.semantic===!1?null:E(e,s);return(n?R(n,o):o).filter(m=>!m.used).map(m=>({symbol:m.symbol,shortName:m.shortName,importedIn:m.importer}))}function R(e,t){let r=new Map;for(let o of t){let n=r.get(o.shortName);n?n.push(o):r.set(o.shortName,[o])}let s=e.map(o=>{let n=r.get(o.shortName),i=n?.shift();return n?.length===0&&r.delete(o.shortName),i?{...o,used:o.used||i.used}:o});return s.push(...[...r.values()].flat()),s}function O(e,t){return e.all(`SELECT DISTINCT gs.symbol, d.relative_path AS importer
|
|
2
2
|
FROM mentions m
|
|
3
3
|
JOIN chunks c ON m.chunk_id = c.id
|
|
4
4
|
JOIN documents d ON c.document_id = d.id
|
|
@@ -32,4 +32,4 @@ import{a as g}from"./chunk-5N5ZC566.js";import{h as p}from"./chunk-QNCVN5EH.js";
|
|
|
32
32
|
WHERE imp_d.relative_path = ?
|
|
33
33
|
AND m.role = 2
|
|
34
34
|
ORDER BY def_d.relative_path, gs.symbol`,t).filter(n=>!e.isIgnored(n.importer));if(o.length>0){let n=r.semantic===!1?[]:p(e,t);return o.map(i=>({symbol:i.symbol,shortName:u(i.symbol),fromFile:i.from_file??"(external)",importer:i.importer,used:i.used!==0||n.some(m=>m.isUsed&&m.sourcePath===i.from_file)}))}return null}function E(e,t){let r=p(e,t);return r.length>0?r.map(s=>{let o=y(s.importedName,s.localName,s.kind);return{symbol:o,shortName:o,fromFile:s.sourcePath??"(external)",importer:t,used:s.kind==="side-effect"?!0:s.isUsed}}):null}function S(e,t){let r=A(t,b(e,t));return d(e,t).map(s=>{let o=y(s.importedName,s.localName,s.kind),n=s.kind==="side-effect"||v(t,s)||r.has(s.localName??s.importedName)?!0:s.used;return{symbol:o,shortName:o,fromFile:s.sourcePath??"(external)",importer:t,used:n}})}function A(e,t){let r=new Set;if(l(e)!=="python")return r;let s=/(?:^|\n)\s*__all__\s*(?:\+?=)\s*[[(]([\s\S]*?)[\])]/g;for(let o of t.matchAll(s)){let n=o[1]??"";for(let i of n.matchAll(/(['"])([A-Za-z_]\w*)\1/g))r.add(i[2])}return r}function v(e,t){if(l(e)!=="rust"||t.used||t.kind==="side-effect")return!1;let r=t.localName??t.importedName;return r==="_"||/^[A-Z]/.test(r)}function y(e,t,r){return r==="namespace"&&e==="*"&&t?`* as ${t}`:r==="default"&&t?`default as ${t}`:r==="side-effect"?"(side effect import)":t&&t!==e?`${e} as ${t}`:e}function $(e){return/\.(?:c|h|cc|cpp|cxx|hpp|hh|hxx)$/i.test(e)}export{Y as a,Z as b,G as c};
|
|
35
|
-
//# sourceMappingURL=chunk-
|
|
35
|
+
//# sourceMappingURL=chunk-OC7XDK62.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as d}from"./chunk-
|
|
1
|
+
import{a as d}from"./chunk-BTYDBDX5.js";import{a as h}from"./chunk-2HCWAL42.js";import{d as f}from"./chunk-7XP7ZRSI.js";import{b as u}from"./chunk-JLZUM476.js";import{E as l}from"./chunk-TLTLJ4SW.js";import{readFileSync as E}from"fs";import{join as B}from"path";function j(t,e,s={}){let n=h(t,e);if(!n)return null;let a=new d(t),o=N(t,n),r=n.endLine-n.startLine+1,m=a.calleeMap([n],{additive:!0,semantic:s.semantic}).get(n.symbolId)??[],c=new Set(m.map(x=>x.symbol));return{symbol:n.symbol,shortName:f(n.symbol),relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,loc:r,branches:o.branches,estimateBasis:o.estimateBasis,cyclomaticEstimate:o.branches+1,calleeCount:c.size,fanIn:P(t,n.symbolId),fanOut:w(m,n.relativePath)}}function N(t,e){let s=l(t,e.relativePath);if(s){let n=g(s.rootNode,e.startLine,e.endLine);if(n)return{branches:v(n),estimateBasis:"ast"}}return{branches:_(p(t,e.relativePath,e.startLine,e.endLine),y(t,e.relativePath)),estimateBasis:"regex-fallback"}}function H(t,e){let s=new Map,n=new Map;for(let a of e){let o=n.get(a.relativePath)??[];o.push(a),n.set(a.relativePath,o)}for(let[a,o]of n){let r=l(t,a),i=r===null?[]:o.filter(c=>r.rootNode.startPosition.row<=c.startLine&&r.rootNode.endPosition.row>=c.endLine),m=new Set(i.map(c=>c.symbolId));if(r&&i.length>0){for(let c of i)s.set(c.symbolId,{branches:0,estimateBasis:"ast"});C(r.rootNode,i,s)}for(let c of o)m.has(c.symbolId)||s.set(c.symbolId,L(t,c))}return s}function L(t,e){return{branches:_(p(t,e.relativePath,e.startLine,e.endLine),y(t,e.relativePath)),estimateBasis:"regex-fallback"}}function y(t,e){return t.get("SELECT language FROM documents WHERE relative_path = ?",e)?.language??"unknown"}function p(t,e,s,n){try{return E(B(t.config.projectRoot,e),"utf-8").split(`
|
|
2
2
|
`).slice(s,n+1).join(`
|
|
3
3
|
`)}catch{return""}}function P(t,e){return t.get(`SELECT COUNT(DISTINCT c.document_id) AS c
|
|
4
4
|
FROM mentions m
|
|
@@ -13,4 +13,4 @@ import{a as d}from"./chunk-CYDOV3AQ.js";import{a as h}from"./chunk-2HCWAL42.js";
|
|
|
13
13
|
WHERE m.symbol_id = ?
|
|
14
14
|
AND m.role != 1
|
|
15
15
|
AND sym_def.document_id != c.document_id`,e)?.c??0}function w(t,e){return new Set(t.filter(s=>s.file!==e).map(s=>s.symbol)).size}function v(t){let e=0;return b(t,s=>{e+=S(s)}),e}function C(t,e,s){let n=[...e].sort((a,o)=>a.startLine-o.startLine||o.endLine-a.endLine);b(t,a=>{let o=S(a);if(o===0)return;let r=a.startPosition.row,i=a.endPosition.row;for(let m of n){if(m.startLine>r)break;if(m.endLine<i)continue;let c=s.get(m.symbolId);c&&(c.branches+=o)}})}function b(t,e){e(t);for(let s of t.namedChildren)b(s,e)}function g(t,e,s){if(t.startPosition.row>e||t.endPosition.row<s)return null;for(let n of t.namedChildren){let a=g(n,e,s);if(a)return a}return t}var D=new Set(["if_statement","conditional_expression","ternary_expression","for_statement","for_in_statement","for_of_statement","while_statement","do_statement","switch_case","case_statement","catch_clause","except_clause","elif_clause","match_arm"]);function S(t){return D.has(t.type)?1:t.type==="binary_expression"&&t.parent?.type!=="binary_expression"&&(t.text.includes("&&")||t.text.includes("||"))?I(t.text):0}function I(t){return(t.match(/&&|\|\|/g)??[]).length}function _(t,e){let s=u(t),n=0,a=[/\bif\b/g,/\belse\s+if\b/g,/\belse\b/g,/\bfor\b/g,/\bwhile\b/g,/\bswitch\b/g,/\bcase\b/g,/\bcatch\b/g,/\?\s*[^?]/g,/&&/g,/\|\|/g];for(let o of a){let r=s.match(o);r&&(n+=r.length)}if(e==="python"){let o=[/\belif\b/g,/\bexcept\b/g,/\bfinally\b/g];for(let r of o){let i=s.match(r);i&&(n+=i.length)}}else if(e==="rust"){let o=[/\bmatch\b/g,/=>/g,/\bloop\b/g];for(let r of o){let i=s.match(r);i&&(n+=i.length)}}else if(e==="ruby"){let o=[/\belsif\b/g,/\bunless\b/g,/\brescue\b/g,/\bwhen\b/g];for(let r of o){let i=s.match(r);i&&(n+=i.length)}}else if(e==="go"){let o=[/\bselect\b/g,/\bdefer\b/g];for(let r of o){let i=s.match(r);i&&(n+=i.length)}}return n}export{j as a,N as b,H as c,v as d};
|
|
16
|
-
//# sourceMappingURL=chunk-
|
|
16
|
+
//# sourceMappingURL=chunk-PPAT3XUL.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as g}from"./chunk-BGUYAA3Q.js";import{a as m}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as g}from"./chunk-BGUYAA3Q.js";import{a as m}from"./chunk-BTYDBDX5.js";import{a as d}from"./chunk-BGBBVSH4.js";import{d as u}from"./chunk-7XP7ZRSI.js";function k(n,c={}){let{scope:e,minLoc:t=10,minCallees:a=6,limit:r=20,scanLimit:i}=c,o=new m(n);return g({candidates:()=>o.productionCallableDefinitions({scope:e,minLoc:t,excludeTypesFiles:!0,requireFunctionLikeSymbol:!0,sortByLocDesc:!0}),scanLimit:i,profile:{name:"extract-candidates"},prepare:s=>o.calleeMap(s,{semantic:c.semantic!==!1}),evaluate:(s,l)=>h(s,l.get(s.symbolId)??[],a),orderResults:(s,l)=>l.clusters.length-s.clusters.length||l.loc-s.loc,limit:r})}function h(n,c,e){let t=new Set(c.map(l=>l.symbol));if(t.size<e)return null;let a=S(t,c),r=y(t,a);if(r.length<2)return null;let i=C(r,a);if(i.length===0)return null;let o=u(n.symbol),s=p(o,t.size,r.length,i);return{symbol:n.symbol,shortName:o,relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,loc:d(n),totalCallees:t.size,extractionKind:s.extractionKind,actionTier:"signal",evidenceReasons:s.evidenceReasons,recommendation:s.recommendation,clusters:i}}function p(n,c,e,t){let a=Math.max(...t.map(s=>s.callees.length)),r=Math.max(...t.map(s=>s.isolation)),i=[`${c} distinct callees across ${e} co-occurrence cluster(s)`,`${t.length} extractable cluster(s) passed size and isolation thresholds`,`largest extractable cluster has ${a} callees at ${Math.round(r*100)}% isolation`],o=f(n,c,e);return o!==null?{extractionKind:"workflow-orchestration",evidenceReasons:[...i,o],recommendation:"Review the isolated helper group as a possible private or feature-local helper, but keep the orchestration sequence together when it preserves the workflow."}:a>=6?{extractionKind:"broad-helper-cluster",evidenceReasons:[...i,"one isolated helper group is broad enough to deserve a named review"],recommendation:"Review whether the broad helper cluster has a stable concept name before extracting it; avoid creating a bag-of-helpers abstraction."}:{extractionKind:"cohesive-helper-cluster",evidenceReasons:i,recommendation:"Review the isolated callee group as a possible same-file or feature-local helper; extract only if the new name preserves the current behavior."}}function f(n,c,e){if(c>=10)return`callee breadth suggests orchestration: ${c} callees`;if(e>=4)return`multiple disconnected callee groups suggest orchestration: ${e} groups`;let t=b(n);return x.has(t)?`caller verb suggests orchestration: ${t}`:null}function b(n){return n.split(":").pop()?.replace(/\(\)$/,"").replace(/[^A-Za-z0-9_]/g,"").replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[_\s-]+/).filter(Boolean)[0]?.toLowerCase()??""}var x=new Set(["apply","build","check","collect","create","diff","execute","find","handle","load","prepare","process","render","resolve","run","select","sync","update","validate","verify","write"]);function S(n,c){let e=new Map;for(let a of n)e.set(a,new Set);let t=new Map;for(let a of c){let r=t.get(a.chunkId);r||(r=new Set,t.set(a.chunkId,r)),r.add(a.symbol)}for(let a of t.values()){let r=[...a];for(let i=0;i<r.length;i++)for(let o=i+1;o<r.length;o++)e.get(r[i]).add(r[o]),e.get(r[o]).add(r[i])}return e}function y(n,c){let e=new Set,t=[];for(let a of n){if(e.has(a))continue;let r=new Set,i=[a];for(;i.length>0;){let o=i.pop();if(!e.has(o)){e.add(o),r.add(o);for(let s of c.get(o)??[])e.has(s)||i.push(s)}}t.push(r)}return t}function C(n,c){return n.filter(e=>e.size>=3).map(e=>v(e,n,c)).filter(e=>e.isolation>.5).sort((e,t)=>t.isolation-e.isolation)}function v(n,c,e){let t=new Set;for(let o of c)if(o!==n)for(let s of o)t.add(s);let a=0;for(let o of n)for(let s of e.get(o)??[])t.has(s)&&a++;let r=n.size*t.size,i=r>0?1-a/r:1;return{callees:[...n].map(u),isolation:i}}export{k as a};
|
|
2
|
+
//# sourceMappingURL=chunk-QYBCGCY5.js.map
|