scip-query 0.6.3 → 0.6.5
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 +31 -29
- package/dist/augment-vue-worker.js +2 -0
- package/dist/chunk-2ZGHRI2A.js +5 -0
- package/dist/chunk-32R4VYYA.js +2 -0
- package/dist/chunk-3UB2DPLP.js +2 -0
- package/dist/chunk-4X7C236P.js +84 -0
- package/dist/chunk-5LQ6CVX3.js +2 -0
- package/dist/chunk-5YYMKE3G.js +70 -0
- package/dist/chunk-7LSCW7NF.js +6 -0
- package/dist/chunk-7X7FLQC5.js +2 -0
- package/dist/chunk-A5UNS4DR.js +4 -0
- package/dist/chunk-BNCTPTVX.js +2 -0
- package/dist/{chunk-TRBNQ273.js → chunk-C5BFS23M.js} +2 -2
- package/dist/{chunk-DM56ECPZ.js → chunk-DRLWW74T.js} +2 -2
- package/dist/chunk-EB5IVUNU.js +2 -0
- package/dist/{chunk-TPOYTT6O.js → chunk-ERRUE5G4.js} +4 -4
- package/dist/chunk-F4KR22Z2.js +2 -0
- package/dist/chunk-FG6A6ZUP.js +2 -0
- package/dist/chunk-FHSD5RKF.js +19 -0
- package/dist/chunk-FVVEIGP3.js +5 -0
- package/dist/chunk-GBDZY73J.js +2 -0
- package/dist/{chunk-4TYGGOLO.js → chunk-H4DXD2FB.js} +1 -1
- package/dist/chunk-HUASU3AD.js +71 -0
- package/dist/chunk-IJWIYZO5.js +2 -0
- package/dist/chunk-K6H3XJQW.js +7 -0
- package/dist/{chunk-KYT47WU2.js → chunk-KAM4C6ZD.js} +1 -1
- package/dist/{chunk-56LPZC3S.js → chunk-KTCODJNQ.js} +3 -3
- package/dist/chunk-LJ2YWNQF.js +2 -0
- package/dist/chunk-LT2CPEQ4.js +2 -0
- package/dist/chunk-M5QTG55L.js +2 -0
- package/dist/chunk-MKFH7QJG.js +7 -0
- package/dist/chunk-MO32JMOD.js +12 -0
- package/dist/chunk-MO65UK5V.js +6 -0
- package/dist/chunk-MTK3JAJT.js +2 -0
- package/dist/{chunk-6TRXTRCW.js → chunk-MXWC53GJ.js} +4 -4
- package/dist/{chunk-HLILTI7S.js → chunk-OQZF2DQJ.js} +3 -3
- package/dist/chunk-PBFMZKXE.js +6 -0
- package/dist/{chunk-MMKNCPHB.js → chunk-PFMGJ4BR.js} +4 -4
- package/dist/{chunk-5KWWENJZ.js → chunk-PK4U6NWP.js} +2 -2
- package/dist/{chunk-CH47OLNL.js → chunk-Q2ALKKSE.js} +4 -4
- package/dist/chunk-QFCK6WV2.js +39 -0
- package/dist/chunk-QFZE73XF.js +84 -0
- package/dist/chunk-QRYEOK3M.js +2 -0
- package/dist/{chunk-LORWXBOO.js → chunk-RKTDEIHF.js} +1 -1
- package/dist/chunk-ROWAEEOD.js +2 -0
- package/dist/chunk-RT5PV5JQ.js +7 -0
- package/dist/chunk-TLRA5TR6.js +2 -0
- package/dist/chunk-U5MVUPOO.js +2 -0
- package/dist/chunk-URUVLDM7.js +29 -0
- package/dist/chunk-WHGCGENP.js +16 -0
- package/dist/chunk-WIIZF5FP.js +2 -0
- package/dist/chunk-WNMAH3P7.js +2 -0
- package/dist/chunk-XV3XUZ3X.js +11 -0
- package/dist/chunk-YDKWDTAW.js +2 -0
- package/dist/{chunk-IUNRL2AQ.js → chunk-YDNCX5PF.js} +2 -2
- package/dist/chunk-YU25IHJX.js +90 -0
- package/dist/{chunk-VZE4SOJG.js → chunk-Z5CTXSWT.js} +3 -3
- package/dist/chunk-ZFCQQ4B5.js +2 -0
- package/dist/chunk-ZHHMG4UC.js +114 -0
- package/dist/cli.js +487 -388
- package/dist/{db-DKhNQ75l.d.ts → db-BZPa7dzJ.d.ts} +19 -9
- package/dist/index.d.ts +221 -13
- package/dist/index.js +45 -31
- package/dist/postinstall.js +1 -1
- 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/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-impact.d.ts +1 -1
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/drift-policy.d.ts +6 -0
- package/dist/queries/drift-policy.js +2 -0
- package/dist/queries/drift.d.ts +1 -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/files.js +1 -1
- package/dist/queries/health.d.ts +1 -1
- 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/index.d.ts +1 -1
- 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/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/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/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 +1 -1
- 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/stats.js +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/wrapper-candidates.d.ts +1 -1
- package/dist/queries/wrapper-candidates.js +1 -1
- package/dist/reindex-worker.js +10 -63
- package/package.json +4 -2
- package/dist/chunk-2OXZVIED.js +0 -41
- package/dist/chunk-5IM4IQ6N.js +0 -2
- package/dist/chunk-5OV6CUTY.js +0 -2
- package/dist/chunk-6QXYWGE5.js +0 -10
- package/dist/chunk-C6PQLWHR.js +0 -7
- package/dist/chunk-DX5YEUX4.js +0 -6
- package/dist/chunk-DXXROCSQ.js +0 -19
- package/dist/chunk-EARGTC7U.js +0 -12
- package/dist/chunk-EJXPKSWV.js +0 -29
- package/dist/chunk-EUHHVFTI.js +0 -2
- package/dist/chunk-F2TGKDMW.js +0 -2
- package/dist/chunk-GSVIC6KN.js +0 -2
- package/dist/chunk-H4IWC7KJ.js +0 -89
- package/dist/chunk-H7BWAMFI.js +0 -4
- package/dist/chunk-HUEIPY4M.js +0 -5
- package/dist/chunk-ID7TO4P6.js +0 -65
- package/dist/chunk-J22I2FWD.js +0 -6
- package/dist/chunk-KOGVTPGE.js +0 -7
- package/dist/chunk-LUYN4IWJ.js +0 -2
- package/dist/chunk-MDUIJELV.js +0 -39
- package/dist/chunk-MSNW2AR2.js +0 -2
- package/dist/chunk-N3Z2SJCR.js +0 -2
- package/dist/chunk-NB3GIT4Z.js +0 -7
- package/dist/chunk-OBPP5RRE.js +0 -2
- package/dist/chunk-ORBQ3HJD.js +0 -2
- package/dist/chunk-P6IUCZA3.js +0 -24
- package/dist/chunk-Q2MCCKWZ.js +0 -2
- package/dist/chunk-QRULHDMO.js +0 -84
- package/dist/chunk-RAJHIEBM.js +0 -70
- package/dist/chunk-RKZBRDFK.js +0 -2
- package/dist/chunk-RPRIZ43D.js +0 -2
- package/dist/chunk-RXGCTLHY.js +0 -2
- package/dist/chunk-S6IGA6KK.js +0 -2
- package/dist/chunk-TVJMEDHH.js +0 -2
- package/dist/chunk-UDKLKBPQ.js +0 -2
- package/dist/chunk-UGUBEKK5.js +0 -2
- package/dist/chunk-VKYLXCV6.js +0 -2
- package/dist/chunk-VQXXSUQF.js +0 -8
- package/dist/chunk-VZHI3TUX.js +0 -6
- package/dist/chunk-YSEQFGGH.js +0 -2
package/dist/chunk-ID7TO4P6.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import{a as T,b as H,c as $,e as J}from"./chunk-VQXXSUQF.js";import{c as P}from"./chunk-H4IWC7KJ.js";import{a as I,b as N,d as A,f as E,h as L,i as k,k as C,m as v,p as O,q as D,t as F}from"./chunk-QRULHDMO.js";import{c as R}from"./chunk-5IM4IQ6N.js";var x=new WeakMap;function xe(n,o){let i=E(o);return i==="rust"?ne(n,o):i==="typescript"||i==="tsx"||i==="javascript"?Q(n,o):[]}var X=new Set(["describe","it","test","fdescribe","fit","xdescribe","xit","beforeEach","afterEach","beforeAll","afterAll","before","after","suite","bench","benchmark"]);function Q(n,o){let i=L(n,o);if(!i)return[];let l=x.get(i);if(l)return l;let a=/(^|\/)(pages|app)\/.+\.(tsx?|jsx?)$/.test(o)||/(^|\/)(layout|page|loading|error|not-found|head|template|default)\.(tsx?|jsx?)$/.test(o),r=/(^|\/)src\/(pages|views|routes)\/.+\.(tsx?|jsx?|vue)$/.test(o),d=!1,t=i.rootNode;for(let s of t.namedChildren){if(s.type!=="expression_statement")continue;let f=s.namedChild(0);if(!f||f.type!=="call_expression")continue;let e=f.namedChild(0);if(!e)continue;let u=e.type==="member_expression"?e.namedChild(e.namedChildCount-1)?.text:e.text;if(u&&X.has(u)){d=!0;break}}let c=[];d&&c.push({startLine:0,endLine:t.endPosition.row,reason:"TS/JS test file (describe/it/test at top level)"}),(a||r)&&c.push({startLine:0,endLine:t.endPosition.row,reason:a?"Next.js / Remix route file":"Vite/Vue route component"});for(let s of t.namedChildren){let f=null,e=null;if(s.type==="function_declaration")f=s.namedChild(0)?.text??null,e=s;else if(s.type==="export_statement"){let u=s.namedChild(0);u?.type==="function_declaration"&&(f=u.namedChild(0)?.text??null,e=u)}else if(s.type==="lexical_declaration"){let u=s.namedChild(0);if(u?.type==="variable_declarator"){let p=u.namedChild(0)?.text,m=u.namedChild(1);p&&(m?.type==="arrow_function"||m?.type==="function_expression")&&(f=p,e=u)}}f&&/^use[A-Z]/.test(f)&&e&&c.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"React custom hook (use*)"})}return c.push(...z(i,new Set(["function_declaration","method_definition","class_declaration","interface_declaration","type_alias_declaration","enum_declaration","variable_declarator","export_statement"]),new Set(["comment"]))),x.set(i,c),c}var ee=/scip-query[\s:-]*ignore[\s:-]*(?:dead(?:-code)?|stale)?/i;function te(n){return ee.test(n)}function z(n,o,i){let l=[],a=r=>{if(o.has(r.type)&&r.parent){let t=r.parent.children,c=-1;for(let s=0;s<t.length;s+=1)if(t[s].startIndex===r.startIndex&&t[s].type===r.type){c=s;break}if(c>0)for(let s=c-1;s>=0;s-=1){let f=t[s];if(i.has(f.type)){if(te(f.text)){l.push({startLine:r.startPosition.row,endLine:r.endPosition.row,reason:"scip-query suppression comment"});break}continue}if(!(f.type==="attribute_item"||f.type==="inner_attribute_item"))break}}for(let d of r.namedChildren)a(d)};return a(n.rootNode),l}function ne(n,o){let i=L(n,o);if(!i)return[];let l=x.get(i);if(l)return l;let a=[];if(ie(i.rootNode)){let e={startLine:0,endLine:i.rootNode.endPosition.row,reason:"generated file (@generated header)"};return x.set(i,[e]),[e]}let r=e=>{let u=e.parent;if(!u)return[];let p=u.children,m=-1;for(let g=0;g<p.length;g+=1)if(p[g].startIndex===e.startIndex&&p[g].type===e.type){m=g;break}if(m<=0)return[];let b=[];for(let g=m-1;g>=0;g-=1){let _=p[g];if(_.type==="attribute_item"||_.type==="inner_attribute_item")b.push(_.text);else{if(_.type==="line_comment"||_.type==="block_comment")continue;break}}return b},d=e=>/#\[\s*tauri::command\b/.test(e)?"#[tauri::command]":/#\[\s*command\b/.test(e)?"#[command]":/#\[\s*test\b/.test(e)?"#[test]":/#\[\s*bench\b/.test(e)?"#[bench]":/#\[\s*tokio::test\b/.test(e)?"#[tokio::test]":/#\[\s*async_std::test\b/.test(e)?"#[async_std::test]":/#\[\s*wasm_bindgen\b/.test(e)?"#[wasm_bindgen]":/#\[\s*no_mangle\b/.test(e)?"#[no_mangle]":/#\[\s*napi\b/.test(e)?"#[napi]":/#\[\s*pyfunction\b/.test(e)?"#[pyfunction]":/#\[\s*pymethod\b/.test(e)?"#[pymethod]":/#\[\s*pyo3\b/.test(e)?"#[pyo3]":/#\[\s*cfg\s*\(\s*test\s*\)/.test(e)?"#[cfg(test)]":/#\[\s*doc\s*\(\s*hidden\s*\)/.test(e)?"#[doc(hidden)]":null,t=e=>/#\[\s*derive\s*\(/.test(e)?/\bSerialize\b/.test(e)||/\bDeserialize\b/.test(e)||/\bFromRow\b/.test(e)||/\bDeriveEntityModel\b/.test(e)||/\bIntoSchema\b/.test(e)||/\bToSchema\b/.test(e)||/\bDeriveValueType\b/.test(e)||/\bsqlx::FromRow\b/.test(e)||/\bError\b/.test(e)||/\bthiserror::Error\b/.test(e):!1,c=e=>/#\[\s*allow\s*\(\s*dead_code\s*\)/.test(e),s=(e,u,p,m)=>{let b=u,g=p,_=m;if(e.type==="trait_item"&&(_=!0,a.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait declaration body (dynamic dispatch)"})),e.type==="impl_item"&&e.childForFieldName("trait")&&(g=!0,a.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl block (dynamic dispatch)"})),e.type==="function_item"||e.type==="function_signature_item"){let y=r(e),h=null;p?h="trait impl method (dynamic dispatch)":u&&(h="inside #[cfg(test)] mod");for(let S of y){let w=d(S);if(w){h=w;break}if(c(S)){h="#[allow(dead_code)]";break}}h&&a.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:h})}else if(p&&(e.type==="const_item"||e.type==="type_item"||e.type==="static_item"||e.type==="associated_type"))a.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl associated item (dynamic dispatch)"});else if(e.type==="struct_item"||e.type==="enum_item"||e.type==="union_item"){let y=r(e),h=y.some(t),S=y.some(c),w=e.namedChildren.find(Z=>Z.type==="type_identifier")?.text;h&&a.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[derive(<reflective>)] \u2014 fields accessed via macro/reflection",containerName:w}),S&&a.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[allow(dead_code)]",containerName:w}),u&&a.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"inside #[cfg(test)] mod",containerName:w})}else e.type==="mod_item"&&r(e).some(h=>/#\[\s*cfg\s*\(\s*test\s*\)/.test(h))&&(b=!0);for(let y of e.namedChildren)s(y,b,g,_)};s(i.rootNode,!1,!1,!1),a.push(...z(i,new Set(["function_item","function_signature_item","struct_item","enum_item","union_item","impl_item","mod_item","static_item","const_item"]),new Set(["line_comment","block_comment"])));let f=ce(i.rootNode);if(f.size>0)for(let e of i.rootNode.descendantsOfType("mod_item")){let u=e.childForFieldName("name")?.text;u&&f.has(u)&&a.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:'serde `with = "..."` module \u2014 body invoked via reflection',containerName:u})}return x.set(i,a),a}function ie(n){for(let o=0;o<Math.min(n.namedChildCount,12);o+=1){let i=n.namedChild(o);if(!i||i.type!=="line_comment"&&i.type!=="block_comment")break;if(/@generated\b/.test(i.text)||/This file is .*generated\b/i.test(i.text)||/Code generated by/i.test(i.text)||/Generated by:\s*https?:\/\/openapi-generator/i.test(i.text)||/openapi-generator/i.test(i.text)&&/Generated by/i.test(i.text))return!0}return!1}var se=[{key:"default",re:/\bdefault\s*=\s*"([^"]+)"/g},{key:"with",re:/\bwith\s*=\s*"([^"]+)"/g},{key:"serialize_with",re:/\bserialize_with\s*=\s*"([^"]+)"/g},{key:"deserialize_with",re:/\bdeserialize_with\s*=\s*"([^"]+)"/g},{key:"skip_serializing_if",re:/\bskip_serializing_if\s*=\s*"([^"]+)"/g},{key:"getter",re:/\bgetter\s*=\s*"([^"]+)"/g},{key:"rename_all_with",re:/\brename_all_with\s*=\s*"([^"]+)"/g},{key:"schema_with",re:/\bschema_with\s*=\s*"([^"]+)"/g}],j=/^#!?\[\s*serde\s*\(/,oe=/^#!?\[\s*schemars\s*\(/,re=/^#!?\[\s*validate\s*\(/,W=/\bwith\s*=\s*"([^"]+)"/g;function G(n,o){return C(n,o,ae,()=>new Set,(i,l,a)=>{if(l==="rust"){for(let r of i.rootNode.descendantsOfType("attribute_item"))B(r.text,a);for(let r of i.rootNode.descendantsOfType("inner_attribute_item"))B(r.text,a)}})??new Set}var ae=new WeakMap;function B(n,o){let i=j.test(n),l=oe.test(n),a=re.test(n);if(!(!i&&!l&&!a))for(let{re:r}of se){r.lastIndex=0;let d;for(;(d=r.exec(n))!==null;){let t=d[1],c=t.split("::").pop()??t;c==="is_none"&&/\bOption\b/.test(t)||c==="is_empty"&&/\b(String|Vec|HashMap|BTreeMap|HashSet|BTreeSet)\b/.test(t)||c&&o.add(c)}}}function ce(n){let o=new Set;for(let i of n.descendantsOfType("attribute_item")){if(!j.test(i.text))continue;W.lastIndex=0;let l;for(;(l=W.exec(i.text))!==null;){let a=l[1],r=a.split("::").pop()??a;r&&o.add(r)}}return o}var le=new Set(["invoke","invokeTauriCommand","listen","once","emit","subscribe","dispatch","sendCommand","callRust"]);function Re(n,o){return C(n,o,de,()=>new Set,(i,l,a)=>{if(!(l!=="typescript"&&l!=="tsx"&&l!=="javascript"))for(let r of i.rootNode.descendantsOfType("call_expression")){let d=r.namedChild(0);if(!d)continue;let t=v(d);if(!t||!le.has(t))continue;let c=r.namedChildren.find(e=>e.type==="arguments");if(!c)continue;let s=c.namedChild(0);if(!s||s.type!=="string")continue;let f=s.namedChildren.find(e=>e.type==="string_fragment");f&&a.add(f.text)}})??new Set}var de=new WeakMap;function Y(n,o,i,l={}){if(!i)return[];let a=A(n,o);if(!a)return[];if(a.indexOf(i)===-1)return[];if(E(o))return(M(n,o).get(i)??[]).filter(f=>!V(f,l));let r=H(n,o,a),d=new RegExp(`\\b${$(i)}\\b`),t=[];for(let c=0;c<r.length;c++)V(c,l)||d.test(r[c]??"")&&t.push(c);return t}function V(n,o){return typeof o.excludeStartLine=="number"&&typeof o.excludeEndLine=="number"&&n>=o.excludeStartLine&&n<=o.excludeEndLine}var ue=I("file-identifiers");function ve(n,o){return ue.get(n,o,()=>new Set(M(n,o).keys()))}var fe=I("file-ident-lines");function M(n,o){return fe.get(n,o,()=>pe(n,o))}var me=I("file-idents-by-line");function U(n,o){return me.get(n,o,()=>{let i=M(n,o),l=0;for(let r of i.values()){let d=r[r.length-1];d!==void 0&&d>l&&(l=d)}let a=new Array(l+1);for(let r=0;r<=l;r+=1)a[r]=new Set;for(let[r,d]of i)for(let t of d)a[t].add(r);return a})}function pe(n,o){let i=new Map,l=(t,c)=>{let s=i.get(t);if(!s){i.set(t,[c]);return}s[s.length-1]!==c&&s.push(c)};if(E(o)){let t=L(n,o);if(t){let c=E(o),s=c==="rust"?new Set(["identifier","type_identifier","field_identifier"]):c==="python"?new Set(["identifier"]):new Set(["identifier","property_identifier","type_identifier"]),f=new Set(["rust","python"]),e=/\{([^{}]*)\}/g,u=/\b([A-Za-z_][\w]*)\b/g,p=m=>{if(s.has(m.type)&&l(m.text,m.startPosition.row),c&&f.has(c)&&m.type==="string_content"){let b=m.startPosition.row;for(let g of m.text.matchAll(e)){let _=g[1]??"";for(let y of _.matchAll(u))y[1]&&l(y[1],b)}}for(let b of m.children)p(b)};return p(t.rootNode),i}}let a=A(n,o);if(!a)return i;let r=T(a).split(/\r?\n/),d=/\b([A-Za-z_$][\w$]*)\b/g;for(let t=0;t<r.length;t+=1){let c=r[t]??"";for(let s of c.matchAll(d))s[1]&&l(s[1],t)}return i}var be=I("file-dep-graph");function Be(n,o){return be.get(n,o??"",()=>{let i=o?`AND d1.relative_path LIKE '%${o}%'`:"",l=n.all(`SELECT DISTINCT
|
|
2
|
-
d1.relative_path AS from_file,
|
|
3
|
-
d2.relative_path AS to_file
|
|
4
|
-
FROM mentions m
|
|
5
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
6
|
-
JOIN documents d1 ON c.document_id = d1.id
|
|
7
|
-
JOIN global_symbols gs ON m.symbol_id = gs.id
|
|
8
|
-
JOIN (
|
|
9
|
-
SELECT m2.symbol_id, c2.document_id
|
|
10
|
-
FROM mentions m2
|
|
11
|
-
JOIN chunks c2 ON m2.chunk_id = c2.id
|
|
12
|
-
WHERE m2.role = 1
|
|
13
|
-
GROUP BY m2.symbol_id
|
|
14
|
-
) sym_def ON sym_def.symbol_id = gs.id
|
|
15
|
-
JOIN documents d2 ON sym_def.document_id = d2.id
|
|
16
|
-
WHERE d1.id != d2.id
|
|
17
|
-
AND m.role != 1
|
|
18
|
-
${n.pathExclusionsFor("d1","d2")}
|
|
19
|
-
${i}`),a=new Map,r=new Set(n.all(`SELECT relative_path
|
|
20
|
-
FROM documents
|
|
21
|
-
WHERE 1 = 1
|
|
22
|
-
${n.pathExclusionsFor("documents")}
|
|
23
|
-
ORDER BY relative_path`).map(t=>t.relative_path).filter(t=>!n.isIgnored(t))),d=(t,c)=>{t!==c&&(n.isIgnored(t)||n.isIgnored(c)||r.has(c)&&(a.has(t)||a.set(t,new Set),a.get(t).add(c)))};for(let t of l)d(t.from_file,t.to_file);for(let t of r)if(!(o&&!t.includes(o)))for(let c of J(n,t))c.sourcePath&&d(t,c.sourcePath);return a})}function ze(n,o,i={}){let a=K(n,[o]).get(o.symbolId)??[];return typeof i.limit=="number"?a.slice(0,i.limit):a}function je(n,o,i={}){let a=ye(n).get(o.symbolId)??[];return typeof i.limit=="number"?a.slice(0,i.limit):a}var ge=N("caller-rows");function ye(n){return ge.get(n,()=>{let o=D(n),i=K(n,o),l=new Map;for(let d of o)l.set(d.symbol,d.symbolId);let a=new Map,r=new Map;for(let d of o){let t=i.get(d.symbolId);if(!(!t||t.length===0))for(let c of t){let s=l.get(c.symbol);if(s===void 0||s===d.symbolId)continue;let f=a.get(s);f||(f=[],a.set(s,f),r.set(s,new Set));let e=`${d.symbol}|${d.relativePath}`;r.get(s).has(e)||(r.get(s).add(e),f.push({symbol:d.symbol,file:d.relativePath}))}}return a})}function Ge(n,o){let i=he(n,o);return i?Se(n,_e(n,i.match,i.identifier)):[]}function _e(n,o,i){let l=n.all(`SELECT DISTINCT d.relative_path, c.start_line, c.end_line
|
|
24
|
-
FROM mentions m
|
|
25
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
26
|
-
JOIN documents d ON c.document_id = d.id
|
|
27
|
-
WHERE m.symbol_id = ?
|
|
28
|
-
AND m.role != 1
|
|
29
|
-
${n.pathExclusionsFor("d")}
|
|
30
|
-
ORDER BY d.relative_path, c.start_line`,o.symbolId),a=new Map;for(let d of l){if(n.isIgnored(d.relative_path))continue;let t=a.get(d.relative_path);t||(t=[],a.set(d.relative_path,t)),t.push({start_line:d.start_line,end_line:d.end_line})}let r=new Map;for(let[d,t]of a){let c=d===o.relativePath?{excludeStartLine:o.startLine,excludeEndLine:o.endLine}:{},s=i?Y(n,d,i,c):[],f=[];for(let e of t){let u=s.filter(m=>m>=e.start_line&&m<=e.end_line),p=u.length>0?u:[e.start_line];for(let m of p)f.push(m)}r.set(d,f)}return r}function he(n,o){let i=P(n,o);return i?{match:i,identifier:R(i.symbol)||null}:null}function Se(n,o){let i=[],l=new Set;for(let[a,r]of o){let d=O(n,a);for(let t of r){let c=F(d,t),s=`${a}|${t}|${c?.symbol??""}`;l.has(s)||(l.add(s),i.push({file:a,line:t,enclosingSymbol:c?.symbol??null}))}}return i}function K(n,o,i={}){if(o.length===0)return new Map;let l=i.additive??!1,a=[],r=[];for(let s of o)E(s.relativePath)&&k(n,s.relativePath)!==null?a.push(s):r.push(s);let d=new Map,t=s=>{for(let[f,e]of s){let u=d.get(f);u||(u=[],d.set(f,u));let p=new Set(u.map(m=>`${m.symbol}|${m.chunkId}`));for(let m of e){let b=`${m.symbol}|${m.chunkId}`;p.has(b)||(p.add(b),u.push(m))}}};a.length>0&&t(Ee(n,a));let c=l?o:r;return c.length>0&&t(Ie(n,c)),d}function Ee(n,o){let i=new Map,l=new Map;for(let r of o){let d=l.get(r.relativePath);d?d.push(r):l.set(r.relativePath,[r]),i.set(r.symbolId,[])}let a=q(n);for(let[r,d]of l){let t=k(n,r);if(!t)continue;let c=[...d].sort((s,f)=>{let e=s.endLine-s.startLine,u=f.endLine-f.startLine;return e-u});for(let s of t){let f=null;for(let b of c)if(s.line>=b.startLine&&s.line<=b.endLine){f=b;break}if(!f)continue;let e=a.get(s.calleeLeaf);if(!e||e.length===0)continue;let u=null,p=e.find(b=>b.file===r);if(p?u=p:e.length===1&&(u=e[0]),!u||u.symbol===f.symbol)continue;i.get(f.symbolId).push({symbol:u.symbol,file:u.file,chunkId:s.line})}}return i}var we=N("global-leaf-index");function q(n){return we.get(n,()=>{let o=n.all(`SELECT gs.id, gs.symbol,
|
|
31
|
-
COALESCE(der_doc.relative_path, mention_doc.relative_path) AS relative_path
|
|
32
|
-
FROM global_symbols gs
|
|
33
|
-
LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
|
|
34
|
-
LEFT JOIN documents der_doc ON der_doc.id = der.document_id
|
|
35
|
-
LEFT JOIN (
|
|
36
|
-
SELECT m.symbol_id, MIN(d.relative_path) AS relative_path
|
|
37
|
-
FROM mentions m
|
|
38
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
39
|
-
JOIN documents d ON c.document_id = d.id
|
|
40
|
-
WHERE m.role = 1
|
|
41
|
-
GROUP BY m.symbol_id
|
|
42
|
-
) mention_doc ON mention_doc.symbol_id = gs.id
|
|
43
|
-
WHERE 1 = 1
|
|
44
|
-
${n.symbolNoiseFor("gs")}`),i=new Map;for(let l of o){if(!l.relative_path||n.isIgnored(l.relative_path))continue;let a=R(l.symbol);if(!a)continue;let r=i.get(a);r||(r=[],i.set(a,r)),r.some(d=>d.symbolId===l.id)||r.push({symbol:l.symbol,symbolId:l.id,file:l.relative_path})}return i})}function Ie(n,o){if(o.length===0)return new Map;let i=n.all(`SELECT c.document_id, c.id AS chunk_id, c.start_line, c.end_line, m.symbol_id
|
|
45
|
-
FROM mentions m
|
|
46
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
47
|
-
WHERE m.role != 1`),l=new Map;for(let s of i)l.has(s.document_id)||l.set(s.document_id,[]),l.get(s.document_id).push(s);let a=new Map(n.all("SELECT id, relative_path FROM documents").map(s=>[s.id,s.relative_path])),r=new Map,d=n.all(`SELECT gs.id AS symbol_id, gs.symbol,
|
|
48
|
-
COALESCE(der.document_id, def_chunk.document_id) AS document_id
|
|
49
|
-
FROM global_symbols gs
|
|
50
|
-
LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
|
|
51
|
-
LEFT JOIN (
|
|
52
|
-
SELECT m.symbol_id, MIN(c.document_id) AS document_id
|
|
53
|
-
FROM mentions m
|
|
54
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
55
|
-
WHERE m.role = 1
|
|
56
|
-
GROUP BY m.symbol_id
|
|
57
|
-
) def_chunk ON def_chunk.symbol_id = gs.id`);for(let s of d)r.has(s.symbol_id)||r.set(s.symbol_id,{symbol:s.symbol,file:s.document_id!==null?a.get(s.document_id)??"":""});let t=new Map,c=a;for(let s of o){let f=l.get(s.documentId)??[],e=new Set,u=[],p=null,m=()=>{if(p)return p;let b=c.get(s.documentId)??"",g=new Set;if(b){let _=U(n,b),y=Math.max(0,s.startLine),h=Math.min(_.length-1,s.endLine);for(let S=y;S<=h;S+=1)for(let w of _[S])g.add(w)}return p=g,g};for(let b of f){if(b.symbol_id===s.symbolId)continue;let g=r.get(b.symbol_id);if(!g)continue;if(!(b.start_line>=s.startLine&&b.end_line<=s.endLine)){if(!(b.start_line<=s.endLine&&b.end_line>=s.startLine))continue;let S=R(g.symbol);if(!S||!m().has(S))continue}let y=`${g.symbol}|${b.chunk_id}`;e.has(y)||(e.add(y),u.push({...g,chunkId:b.chunk_id}))}t.set(s.symbolId,u)}return t}function Ve(n,o){let i=new Map,l=n.all(`SELECT relative_path FROM documents
|
|
58
|
-
WHERE 1 = 1 ${n.pathExclusionsFor("documents")}`),a=q(n);for(let t of l){if(!E(t.relative_path)||n.isIgnored(t.relative_path))continue;let c=k(n,t.relative_path);if(c)for(let s of c){let f=a.get(s.calleeLeaf);if(!f||f.length===0)continue;let u=f.find(m=>m.file===t.relative_path)??(f.length===1?f[0]:null);if(!u||u.file===t.relative_path)continue;let p=i.get(u.symbolId);p||(p=new Set,i.set(u.symbolId,p)),p.add(t.relative_path)}}let r=n.all(`SELECT DISTINCT m.symbol_id, d.relative_path, c.document_id,
|
|
59
|
-
c.start_line AS chunk_start, c.end_line AS chunk_end
|
|
60
|
-
FROM mentions m
|
|
61
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
62
|
-
JOIN documents d ON c.document_id = d.id
|
|
63
|
-
WHERE m.role != 1
|
|
64
|
-
${n.pathExclusionsFor("d")}`),d=new Map;if(o)for(let t of o)d.set(t.symbolId,{docId:t.documentId,startLine:t.startLine,endLine:t.endLine});for(let t of r){if(n.isIgnored(t.relative_path))continue;let c=d.get(t.symbol_id);if(c&&c.docId===t.document_id&&t.chunk_start>=c.startLine&&t.chunk_end<=c.endLine)continue;let s=i.get(t.symbol_id);s||(s=new Set,i.set(t.symbol_id,s)),s.add(t.relative_path)}for(let t of l){if(n.isIgnored(t.relative_path)||E(t.relative_path)!=="rust")continue;let c=G(n,t.relative_path);if(c.size!==0)for(let s of c){let f=a.get(s);if(f)for(let e of f){if(e.file===t.relative_path)continue;let u=i.get(e.symbolId);u||(u=new Set,i.set(e.symbolId,u)),u.add(t.relative_path)}}}return i}export{xe as a,G as b,Re as c,Y as d,ve as e,M as f,Be as g,ze as h,je as i,Ge as j,K as k,q as l,Ve as m};
|
|
65
|
-
//# sourceMappingURL=chunk-ID7TO4P6.js.map
|
package/dist/chunk-J22I2FWD.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{a as w,b as h,d as R,e as N}from"./chunk-LORWXBOO.js";import{a as P}from"./chunk-5KWWENJZ.js";import{h as T,k as j}from"./chunk-ID7TO4P6.js";import{a as A}from"./chunk-H4IWC7KJ.js";import{d as D,e as L,l as z,q as $,r as B}from"./chunk-QRULHDMO.js";import{b,c as q,f as F,i as x}from"./chunk-5IM4IQ6N.js";function ae(i,e,r={}){let{minSimilarity:s=.4,limit:l=20}=r,o=U(i,e);if(!o)return[];if(!F(o.symbol))return[];let n=K(i,o,s);return n.length>0?n.slice(0,l):G(i,e,{minSimilarity:s,limit:l})}function K(i,e,r){let s=E(i,{minCallees:3,excludeSymbol:e.symbol}),l=R([e,...s].map(n=>n.callees)),o=[];for(let n of s){if(n.callees.size<3)continue;let t=I(e,n,l,{minSimilarity:r,requireSignificantShared:1,requireSharedCount:0});t&&o.push(t)}return o.sort((n,t)=>t.similarity-n.similarity),o}function I(i,e,r,s){let{similarity:l,significantShared:o}=N(i.callees,e.callees,r);if(l<s.minSimilarity)return null;let n=w(i.callees,e.callees).size;if(o.length<s.requireSignificantShared&&n<s.requireSharedCount)return null;let t=o.length>0?o:[...w(i.callees,e.callees)];return{symbolA:i.symbol,shortNameA:b(i.symbol),fileA:i.file,symbolB:e.symbol,shortNameB:b(e.symbol),fileB:e.file,similarity:l,sharedCallees:t.map(b),uniqueToA:[...h(i.callees,e.callees)].map(b),uniqueToB:[...h(e.callees,i.callees)].map(b)}}function me(i,e={}){let{minSimilarity:r=.5,limit:s=20,scope:l,minCallees:o=4,crossFileOnly:n=!1}=e,t=E(i,{minCallees:o,scope:l}),c=R(t.map(a=>a.callees)),u=new Map;for(let a of t)for(let m of a.callees)u.set(m,(u.get(m)??0)+1);let f=Math.max(8,Math.ceil(Math.sqrt(t.length))),S=new Map;for(let a=0;a<t.length;a+=1)for(let m of t[a].callees){if((u.get(m)??0)>f)continue;let g=S.get(m);g||(g=[],S.set(m,g)),g.push(a)}let C=[],v=new Set;e:for(let a=0;a<t.length;a+=1){let m=t[a],g=new Set;for(let k of m.callees){let y=S.get(k);if(y)for(let p of y)p>a&&g.add(p)}for(let k of g){let y=`${a}|${k}`;if(v.has(y))continue;v.add(y);let p=t[k];if(n&&m.file===p.file)continue;if(m.paramCount>=0&&p.paramCount>=0){let _=Math.abs(m.paramCount-p.paramCount),W=Math.max(2,Math.ceil(Math.max(m.paramCount,p.paramCount)*.5));if(_>W)continue}let M=I(m,p,c,{minSimilarity:r,requireSignificantShared:2,requireSharedCount:4});if(M&&(C.push(M),C.length>s*5))break e}}return C.sort((a,m)=>m.similarity-a.similarity),C.slice(0,s)}function U(i,e){let r=A(i,e);if(!r)return null;let s=T(i,r);return{symbol:r.symbol,file:r.relativePath,callees:new Set(s.map(l=>l.symbol)),paramCount:z(i,r.relativePath,r.startLine,r.endLine)?.paramCount??-1}}function E(i,e){let{minCallees:r,scope:s,excludeSymbol:l}=e,o=B(i,s).filter(t=>!i.isIgnored(t.relativePath)).filter(t=>t.isFunctionLike).filter(t=>l===void 0||t.symbol!==l).filter(t=>t.endLine-t.startLine+1>=5).filter(t=>P(t.relativePath)!=="test").filter(t=>!x(t.symbol)).filter(t=>!L(i,t.relativePath,t.startLine)),n=j(i,o);return o.map(t=>({symbol:t.symbol,file:t.relativePath,callees:new Set((n.get(t.symbolId)??[]).map(c=>c.symbol)),paramCount:z(i,t.relativePath,t.startLine,t.endLine)?.paramCount??-1})).filter(t=>t.callees.size>=r)}function G(i,e,r){let s=H(i,e);if(!s||s.tokens.size<3)return[];let l=r.minSimilarity>=.5?r.minSimilarity:.3,o=[];for(let n of Q(i)){if(n.symbol===s.symbol||n.tokens.size<3)continue;let t=w(s.tokens,n.tokens);if(t.size<2)continue;let c=new Set([...s.tokens,...n.tokens]),u=c.size>0?t.size/c.size:0;u<l||o.push({symbolA:s.symbol,shortNameA:b(s.symbol),fileA:s.file,symbolB:n.symbol,shortNameB:b(n.symbol),fileB:n.file,similarity:u,sharedCallees:[...t].sort(),uniqueToA:[...h(s.tokens,n.tokens)].sort(),uniqueToB:[...h(n.tokens,s.tokens)].sort()})}return o.sort((n,t)=>t.similarity-n.similarity||n.shortNameB.localeCompare(t.shortNameB)),o.slice(0,r.limit)}function H(i,e){let r=A(i,e);if(!r||!F(r.symbol))return null;let s=J(i,r);return s?{symbol:r.symbol,file:r.relativePath,tokens:s}:null}function J(i,e){let r=q(e.symbol),s=O(i,e.relativePath,e.startLine,e.endLine,r),l=Z(s,r);return l.size>0?l:null}function Q(i){return $(i).filter(e=>e.isFunctionLike).filter(e=>P(e.relativePath)!=="test").filter(e=>!x(e.symbol)).map(e=>({symbol:e.symbol,file:e.relativePath,tokens:Z(O(i,e.relativePath,e.startLine,e.endLine,e.leaf),e.leaf)})).filter(e=>e.tokens.size>0)}function O(i,e,r,s,l){let o=D(i,e);if(!o)return"";let n=o.split(`
|
|
2
|
-
`);if(s>=r&&s-r<=12)return n.slice(r,s+1).join(`
|
|
3
|
-
`);let t=[new RegExp(`\\bdef\\s+${d(l)}\\b`),new RegExp(`\\bfun\\s+${d(l)}\\b`),new RegExp(`\\bfn\\s+${d(l)}\\b`),new RegExp(`\\bfunction\\s+${d(l)}\\b`),new RegExp(`\\b${d(l)}\\s*\\(`)],c=n.findIndex(u=>t.some(f=>f.test(u)));if(c>=0){let u=c;for(let f=c+1;f<n.length&&f<=c+8;f++){let S=n[f]??"";if(f>c&&X(S)||(u=f,S.trim()===""&&f>c+1))break}return n.slice(c,u+1).join(`
|
|
4
|
-
`)}return n.slice(r,Math.min(n.length,r+8)).join(`
|
|
5
|
-
`)}function Z(i,e){if(!i)return new Set;let r=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"]),s=V(e),o=i.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(n=>n.trim()).filter(n=>n.length>1).filter(n=>!r.has(n)).filter(n=>!s.has(n));return new Set(o)}function V(i){return new Set(i.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9_]+|_/).map(e=>e.toLowerCase()).filter(e=>e.length>1))}function X(i){return/^\s*(?:def|fun|fn|function|class|trait|module|object|enum|interface|public|private|protected)\b/.test(i)}function d(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}export{ae as a,me as b};
|
|
6
|
-
//# sourceMappingURL=chunk-J22I2FWD.js.map
|
package/dist/chunk-KOGVTPGE.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{c as m}from"./chunk-F2TGKDMW.js";import{j as g}from"./chunk-ID7TO4P6.js";import{a as R}from"./chunk-H4IWC7KJ.js";import{d as h}from"./chunk-QRULHDMO.js";import{f as u}from"./chunk-5IM4IQ6N.js";function $(t,a){let e=R(t,a);if(!e)return[];let i=!u(e.symbol)&&!t.isIgnored(e.relativePath)?[{relativePath:e.relativePath,line:e.startLine}]:[],r=m(t,e),l=(r.length>0?r:g(t,e)).filter(n=>!t.isIgnored(n.file)).map(n=>({relativePath:n.file,line:n.line})),c=S(t,e),o=new Set,f=[];for(let n of[...i,...l,...c]){let p=`${n.relativePath}:${n.line}`;o.has(p)||(o.add(p),f.push(n))}return f}function S(t,a){if(!a.relativePath.endsWith(".rb"))return[];let e=d(a.symbol);if(e.length===0)return[];let s=t.all(`SELECT relative_path
|
|
2
|
-
FROM documents
|
|
3
|
-
WHERE relative_path LIKE '%.rb'
|
|
4
|
-
${t.pathExclusionsFor("documents")}
|
|
5
|
-
ORDER BY relative_path`),i=[];for(let r of s){if(t.isIgnored(r.relative_path))continue;let l=h(t,r.relative_path);if(!l)continue;let c=l.split(`
|
|
6
|
-
`);for(let o=0;o<c.length;o++){let f=c[o]??"";e.some(n=>new RegExp(`@${n}\\b|\\b${n}:`).test(f))&&i.push({relativePath:r.relative_path,line:o})}}return i}function d(t){let e=(t.split(":").pop()??t).replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[^A-Za-z0-9_]+/g,"_").toLowerCase().replace(/^_+|_+$/g,""),s=e.split("_").filter(Boolean),i=new Set;return e&&i.add(e),s.length>=1&&i.add(s[s.length-1]),s.length>=2&&i.add(s.slice(-2).join("_")),[...i]}export{$ as a};
|
|
7
|
-
//# sourceMappingURL=chunk-KOGVTPGE.js.map
|
package/dist/chunk-LUYN4IWJ.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as W}from"./chunk-NB3GIT4Z.js";import{b as I}from"./chunk-J22I2FWD.js";import{a as q}from"./chunk-HUEIPY4M.js";import{a as j}from"./chunk-N3Z2SJCR.js";import{a as B}from"./chunk-MSNW2AR2.js";import{a as E}from"./chunk-ORBQ3HJD.js";import{a as z}from"./chunk-DXXROCSQ.js";import{a as V}from"./chunk-TVJMEDHH.js";import{a as A}from"./chunk-YSEQFGGH.js";import{a as k}from"./chunk-EARGTC7U.js";import{a as F}from"./chunk-Q2MCCKWZ.js";import{e as y,f as R}from"./chunk-5KWWENJZ.js";function ht(e,N={}){let{scope:n}=N,c=j(e),T=k(e,{scope:n,minLoc:3,skipBarrels:!0}),w=B(e,{scope:n,minLoc:3}),P=A(e,{scope:n}),U=I(e,{scope:n,minSimilarity:.6,limit:50,minCallees:4}),m=V(e,{scope:n,minLoc:15,minCallees:5,limit:50}),l=W(e,{scope:n,maxLoc:15,limit:50}),a=E(e,{scope:n,maxLoc:15,limit:50}),x=q(e,{scope:n,minLoc:3,limit:50}),s=z(e,{scope:n}),C=F(e,{scope:n,minLoc:10,limit:10}),S=T.symbols.filter(t=>!y(e,t.relativePath)&&!R(e,t.symbol,t.relativePath)&&t.kind==="dead-code"),u=S.length,$=S.reduce((t,o)=>t+o.loc,0),h=w.filter(t=>!y(e,t.relativePath)&&!R(e,t.symbol,t.relativePath)).length,p=x.length,v=s.unusedImports+s.layerViolations,d=U.length,r=[];u>0&&r.push({category:"Dead code",description:`${u} symbols with zero references anywhere \u2014 safe to delete`,effort:"low",impact:"high",count:u,locRecoverable:$}),h>0&&r.push({category:"Isolated symbols",description:`${h} symbols completely disconnected from the codebase graph`,effort:"low",impact:"medium",count:h,locRecoverable:w.filter(t=>!y(e,t.relativePath)&&!R(e,t.symbol,t.relativePath)).reduce((t,o)=>t+o.loc,0)});let b=P.filter(t=>t.kind==="real");if(b.length>0&&r.push({category:"Circular dependencies",description:`${b.length} cycle(s) \u2014 break with dependency inversion or module restructuring`,effort:"medium",impact:"high",count:b.length,locRecoverable:0}),d>0&&r.push({category:"Similar functions",description:`${d} pairs with real logic overlap (beyond shared imports) \u2014 consolidation candidates`,effort:"medium",impact:"medium",count:d,locRecoverable:0}),m.length>0&&r.push({category:"Extraction candidates",description:`${m.length} large functions with isolated callee clusters \u2014 extract method opportunities`,effort:"medium",impact:"medium",count:m.length,locRecoverable:0}),l.length>0&&r.push({category:"Wrapper functions",description:`${l.length} single-consumer symbols that could be inlined`,effort:"low",impact:"low",count:l.length,locRecoverable:l.reduce((t,o)=>t+o.loc,0)}),a.length>0&&r.push({category:"Passthrough functions",description:`${a.length} functions that just forward to one callee \u2014 unnecessary indirection`,effort:"low",impact:"low",count:a.length,locRecoverable:a.reduce((t,o)=>t+o.loc,0)}),p>0){let t=x.filter(M=>M.consumers===0).length,o=p-t,g=[];t>0&&g.push(`${t} unused`),o>0&&g.push(`${o} single-consumer (not in types file)`),r.push({category:"Stale abstractions",description:`${g.join(", ")} \u2014 premature abstraction`,effort:"low",impact:"medium",count:p,locRecoverable:x.reduce((M,_)=>M+_.loc,0)})}if(v>0||s.patternDeviations>0){let t=[];s.unusedImports>0&&t.push(`${s.unusedImports} unused imports`),s.layerViolations>0&&t.push(`${s.layerViolations} layer violations`),s.patternDeviations>0&&t.push(`${s.patternDeviations} unique deps`),r.push({category:"Structural drift",description:t.join(", "),effort:s.layerViolations>0?"medium":"low",impact:s.layerViolations>0?"medium":"low",count:v,locRecoverable:0})}let D={high:3,medium:2,low:1},L={low:3,medium:2,high:1};r.sort((t,o)=>{let g=D[t.impact]*L[t.effort];return D[o.impact]*L[o.effort]-g});let G=Math.max(c.documents,1),f=Math.max(c.symbols,1),i=100,J=u/f;i-=Math.min(20,Math.round(J*200));let K=h/f;i-=Math.min(10,Math.round(K*200));let H=P.filter(t=>t.kind==="real").length;i-=Math.min(15,H*5);let O=d/f*1e3;i-=Math.min(10,Math.round(O));let Q=m.length/f*1e3;i-=Math.min(5,Math.round(Q/2)),i-=Math.min(3,l.length),i-=Math.min(3,a.length);let X=p/Math.max(f*.1,1);i-=Math.min(8,Math.round(X*10));let Y=v/G;i-=Math.min(5,Math.round(Y*50));let Z=C.filter(t=>t.score>50).length;return i-=Math.min(5,Z*2),i=Math.max(0,Math.min(100,i)),{score:i,overview:{documents:c.documents,symbols:c.symbols,indexSizeBytes:c.indexSizeBytes},findings:{deadSymbols:u,deadLoc:$,isolatedSymbols:h,isolatedLoc:w.filter(t=>!y(e,t.relativePath)).reduce((t,o)=>t+o.loc,0),cycles:H,similarPairs:d,extractionCandidates:m.length,wrappers:l.length,passthroughs:a.length,staleTypes:p,driftedFiles:v,complexityHotspotCount:C.length},actions:r,topComplexity:C.slice(0,5).map(t=>({symbol:t.shortName,score:t.score}))}}export{ht as a};
|
|
2
|
-
//# sourceMappingURL=chunk-LUYN4IWJ.js.map
|
package/dist/chunk-MDUIJELV.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import{a as h}from"./chunk-DX5YEUX4.js";import{e as p}from"./chunk-VQXXSUQF.js";import{a as _}from"./chunk-H4IWC7KJ.js";import{b as d,c,g as f}from"./chunk-5IM4IQ6N.js";function v(e,i){return b(e,i)?.map(t=>({symbol:t.symbol,shortName:t.shortName,fromFile:t.fromFile}))??[]}function F(e,i){let a=e.all(`SELECT DISTINCT gs.symbol, d.relative_path AS importer
|
|
2
|
-
FROM mentions m
|
|
3
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
4
|
-
JOIN documents d ON c.document_id = d.id
|
|
5
|
-
JOIN global_symbols gs ON m.symbol_id = gs.id
|
|
6
|
-
WHERE gs.symbol LIKE ?
|
|
7
|
-
AND m.role = 2
|
|
8
|
-
ORDER BY d.relative_path`,`%${i}%`).filter(s=>!e.isIgnored(s.importer)).map(s=>({symbol:s.symbol,shortName:d(s.symbol),fromFile:s.importer}));if(a.length>0)return a;let o=_(e,i),r=o?.relativePath??null,m=o?c(o.symbol):i.replace(/\(\)$/,""),u=o?f(o.symbol):!1,y=e.all(`SELECT relative_path
|
|
9
|
-
FROM documents
|
|
10
|
-
WHERE 1 = 1
|
|
11
|
-
${e.pathExclusionsFor("documents")}
|
|
12
|
-
ORDER BY relative_path`),l=new Set;for(let s of y)if(!e.isIgnored(s.relative_path)){for(let n of p(e,s.relative_path))if(n.sourcePath&&!(r&&g(n.sourcePath)!==g(r))){if(n.kind==="side-effect"){l.add(s.relative_path);continue}if(r&&E(s.relative_path)){l.add(s.relative_path);continue}if(u){l.add(s.relative_path);continue}if(n.kind==="named"&&n.importedName===m){l.add(s.relative_path);continue}n.kind==="namespace"&&n.usedMembers.includes(m)&&l.add(s.relative_path)}}return[...l].sort().map(s=>({symbol:o?.symbol??m,shortName:o?d(o.symbol):m,fromFile:s}))}function D(e,i){return b(e,i)?.filter(t=>!t.used).map(t=>({symbol:t.symbol,shortName:t.shortName,importedIn:t.importer}))??[]}function b(e,i){let t=h(e,i);if(!t)return null;let o=e.all(`SELECT DISTINCT
|
|
13
|
-
gs.symbol,
|
|
14
|
-
def_d.relative_path AS from_file,
|
|
15
|
-
imp_d.relative_path AS importer,
|
|
16
|
-
EXISTS (
|
|
17
|
-
SELECT 1
|
|
18
|
-
FROM mentions ref_m
|
|
19
|
-
JOIN chunks ref_c ON ref_m.chunk_id = ref_c.id
|
|
20
|
-
WHERE ref_m.symbol_id = gs.id
|
|
21
|
-
AND ref_m.role != 1
|
|
22
|
-
AND ref_c.document_id = imp_d.id
|
|
23
|
-
) AS used
|
|
24
|
-
FROM mentions m
|
|
25
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
26
|
-
JOIN documents imp_d ON c.document_id = imp_d.id
|
|
27
|
-
JOIN global_symbols gs ON m.symbol_id = gs.id
|
|
28
|
-
LEFT JOIN (
|
|
29
|
-
SELECT m2.symbol_id, c2.document_id
|
|
30
|
-
FROM mentions m2
|
|
31
|
-
JOIN chunks c2 ON m2.chunk_id = c2.id
|
|
32
|
-
WHERE m2.role = 1
|
|
33
|
-
GROUP BY m2.symbol_id
|
|
34
|
-
) sym_def ON sym_def.symbol_id = gs.id
|
|
35
|
-
LEFT JOIN documents def_d ON sym_def.document_id = def_d.id
|
|
36
|
-
WHERE imp_d.relative_path = ?
|
|
37
|
-
AND m.role = 2
|
|
38
|
-
ORDER BY def_d.relative_path, gs.symbol`,t).filter(r=>!e.isIgnored(r.importer));return o.length>0?o.map(r=>({symbol:r.symbol,shortName:d(r.symbol),fromFile:r.from_file??"(external)",importer:r.importer,used:r.used!==0})):p(e,t).map(r=>{let m=I(r.importedName,r.localName,r.kind),u=r.kind==="side-effect"?!0:r.used;return{symbol:m,shortName:m,fromFile:r.sourcePath??"(external)",importer:t,used:u}})}function I(e,i,t){return t==="namespace"&&e==="*"&&i?`* as ${i}`:t==="default"&&i?`default as ${i}`:t==="side-effect"?"(side effect import)":i&&i!==e?`${e} as ${i}`:e}function g(e){return e.replace(/\\/g,"/")}function E(e){return/\.(?:c|h|cc|cpp|cxx|hpp|hh|hxx)$/i.test(e)}export{v as a,F as b,D as c};
|
|
39
|
-
//# sourceMappingURL=chunk-MDUIJELV.js.map
|
package/dist/chunk-MSNW2AR2.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{d as L}from"./chunk-F2TGKDMW.js";import{e as h}from"./chunk-5KWWENJZ.js";import{b as y,k as d,m as b}from"./chunk-ID7TO4P6.js";import{f,r as u}from"./chunk-QRULHDMO.js";import{b as i,c as m,h as c,i as p}from"./chunk-5IM4IQ6N.js";function x(s,v={}){let{scope:I,minLoc:S=3}=v,o=u(s,I).filter(e=>!s.isIgnored(e.relativePath)).filter(e=>!h(s,e.relativePath)).filter(e=>e.isFunctionLike).filter(e=>!c(e.symbol)).filter(e=>!p(e.symbol)).filter(e=>e.endLine-e.startLine+1>=S),C=b(s,o),M=L(s,o),n=new Set([...C.keys(),...M.keys()]),l=new Map;for(let e of o){let t=m(e.symbol);if(!t)continue;let a=l.get(t)??[];a.push(e.symbolId),l.set(t,a)}let g=s.all(`SELECT relative_path FROM documents WHERE 1 = 1 ${s.pathExclusionsFor("documents")}`);for(let e of g){if(s.isIgnored(e.relative_path)||f(e.relative_path)!=="rust")continue;let t=y(s,e.relative_path);for(let a of t){let r=l.get(a);if(r)for(let F of r)n.add(F)}}let R=new Map(o.map(e=>[e.symbolId,e.symbol])),k=d(s,o,{additive:!0}),E=new Set([...k.entries()].filter(([e,t])=>{let a=R.get(e);return t.some(r=>r.symbol!==a)}).map(([e])=>e));return o.filter(e=>!n.has(e.symbolId)).filter(e=>!E.has(e.symbolId)).sort((e,t)=>t.endLine-t.startLine-(e.endLine-e.startLine)||e.relativePath.localeCompare(t.relativePath)||e.startLine-t.startLine).map(e=>({symbol:e.symbol,shortName:i(e.symbol),relativePath:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:e.endLine-e.startLine+1}))}export{x as a};
|
|
2
|
-
//# sourceMappingURL=chunk-MSNW2AR2.js.map
|
package/dist/chunk-N3Z2SJCR.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
function o(t){let e=t.get("SELECT COUNT(*) as c FROM documents").c,s=t.get("SELECT COUNT(*) as c FROM global_symbols").c,c=t.get("SELECT COUNT(*) as c FROM mentions WHERE role = 1").c,n=t.get("SELECT COUNT(*) as c FROM mentions WHERE role != 1").c;return{documents:e,symbols:s,definitions:c,references:n,indexSizeBytes:t.sizeBytes(),lastBuilt:t.lastModified()}}export{o as a};
|
|
2
|
-
//# sourceMappingURL=chunk-N3Z2SJCR.js.map
|
package/dist/chunk-NB3GIT4Z.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{d as x}from"./chunk-F2TGKDMW.js";import{a as w}from"./chunk-5KWWENJZ.js";import{f as k,g as P,m as R}from"./chunk-ID7TO4P6.js";import{e as D,p as v,r as _,t as N}from"./chunk-QRULHDMO.js";import{b as S,c as C,f as M,i as h}from"./chunk-5IM4IQ6N.js";import{basename as p,extname as g}from"path";function Z(e,t){let{scope:i,maxLoc:n=15,limit:s=30}=t??{},o=H(P(e,i)),l=j(e,i,n),c=G(R(e,l),x(e,l)),y=[];for(let r of l){if(D(e,r.relativePath,r.startLine))continue;let b=p(r.relativePath,g(r.relativePath)),L=[...c.get(r.symbolId)??[]].filter(m=>m!==r.relativePath).filter(m=>p(m,g(m))!==b).filter(m=>{let u=w(m);return u!=="barrel"&&u!=="entry"&&u!=="test"});if(L.length!==1)continue;let f=L[0],F=e.get(`SELECT c.start_line, c.end_line
|
|
2
|
-
FROM mentions m
|
|
3
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
4
|
-
JOIN documents d ON c.document_id = d.id
|
|
5
|
-
WHERE m.symbol_id = ? AND m.role != 1 AND d.relative_path = ?
|
|
6
|
-
LIMIT 1`,r.symbolId,f);if(!F)continue;let O=v(e,f),T=J(e,f,r.symbol,F.start_line,F.end_line),a=N(O,T);if(a&&h(a.symbol))continue;let d,W=a?.symbol??"",A=a?.isFunctionLike?S(a.symbol):p(f);if(a?.isFunctionLike&&a.symbolId!==r.symbolId){let m=[...c.get(a.symbolId)??[]].filter(u=>u!==a.relativePath);d=m.length>0?m.length:E(o,f)}else d=E(o,f);d<=3||y.push({symbol:r.symbol,shortName:S(r.symbol),file:r.relativePath,startLine:r.startLine,endLine:r.endLine,loc:I(r),singleCaller:W,singleCallerShort:A,callerFanIn:d})}return y.sort((r,b)=>b.callerFanIn-r.callerFanIn||b.loc-r.loc),y.slice(0,s)}function I(e){return e.endLine-e.startLine+1}function j(e,t,i){return _(e,t).filter(n=>!e.isIgnored(n.relativePath)).filter(n=>M(n.symbol)).filter(n=>!h(n.symbol)).filter(n=>I(n)<=i&&I(n)>=2)}function J(e,t,i,n,s){let o=C(i);if(!o)return n;let l=k(e,t).get(o);if(!l||l.length===0)return n;for(let c of l)if(c>=n&&c<=s)return c;return n}function G(...e){let t=new Map;for(let i of e)for(let[n,s]of i){let o=t.get(n);o||(o=new Set,t.set(n,o));for(let l of s)o.add(l)}return t}function H(e){let t=new Map;for(let[i,n]of e){t.has(i)||t.set(i,t.get(i)??0);for(let s of n)t.set(s,(t.get(s)??0)+1)}return t}function E(e,t){let i=e.get(t)??0;if(i>0)return i;let n=p(t,g(t)),s=0;for(let[o,l]of e)o!==t&&p(o,g(o))===n&&l>s&&(s=l);return s}export{Z as a};
|
|
7
|
-
//# sourceMappingURL=chunk-NB3GIT4Z.js.map
|
package/dist/chunk-OBPP5RRE.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{h as n,i as a}from"./chunk-ID7TO4P6.js";import{a as i}from"./chunk-H4IWC7KJ.js";import{b as m}from"./chunk-5IM4IQ6N.js";function b(s,e){let o=i(s,e);if(!o)return null;let t=a(s,o,{limit:50}),r=y(n(s,o,{limit:50}));return{symbol:o.symbol,shortName:m(o.symbol),callers:t.map(l=>({symbol:l.symbol,shortName:m(l.symbol),file:l.file})),callees:r.map(l=>({symbol:l.symbol,shortName:m(l.symbol),file:l.file}))}}function y(s){let e=new Set,o=[];for(let t of s){let r=`${t.symbol}|${t.file}`;e.has(r)||(e.add(r),o.push(t))}return o}export{b as a};
|
|
2
|
-
//# sourceMappingURL=chunk-OBPP5RRE.js.map
|
package/dist/chunk-ORBQ3HJD.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{k as x}from"./chunk-ID7TO4P6.js";import{e as C,f as S,h as L,r as _}from"./chunk-QRULHDMO.js";import{b as y,f as d,h as g,i as b}from"./chunk-5IM4IQ6N.js";function P(i,r,a,t){let s=S(r);if(!s)return!0;let n=L(i,r);if(!n)return!0;let l=w.get(n);return l||(l=T(n,s),w.set(n,l)),l.get(`${a}:${t}`)??!0}var w=new WeakMap;function T(i,r){let a=r==="rust"?new Set(["function_item","function_signature_item"]):r==="python"?new Set(["function_definition"]):new Set(["function_declaration","method_definition","arrow_function","function_expression"]),t=new Map,s=n=>{a.has(n.type)&&t.set(`${n.startPosition.row}:${n.endPosition.row}`,N(n,r));for(let l of n.children)s(l)};return s(i.rootNode),t}function N(i,r){let a=i.namedChildren.find(e=>e.type==="block"||e.type==="statement_block");if(!a)return!1;let t=a.namedChildren.filter(e=>e.type!=="comment"&&e.type!=="line_comment"&&e.type!=="block_comment");if(t.length!==1)return!1;let s=t[0],n=null;if(s.type==="return_statement"||s.type==="expression_statement"?n=s.namedChild(0)??null:r==="rust"&&(s.type==="call_expression"||s.type==="macro_invocation")&&(n=s),!n)return!1;let l=r==="python"?"call":"call_expression";if(n.type!==l)return!1;let c=n.namedChildren.find(e=>e.type==="arguments"||e.type==="argument_list");if(!c)return!1;let o=c.namedChildren.filter(e=>e.type!=="comment"),f=i.namedChildren.find(e=>e.type==="parameters"||e.type==="formal_parameters");if(!f)return!1;let p=[];for(let e of f.namedChildren)if(e.type==="identifier")p.push(e.text);else{let m=e.namedChildren.find(u=>u.type==="identifier");m&&p.push(m.text)}if(o.length!==p.length)return!1;for(let e=0;e<p.length;e+=1){let m=o[e];if(m.type!=="identifier"||m.text!==p[e])return!1}return!0}function j(i,r){let{scope:a,maxLoc:t=15,limit:s=30}=r??{},n=D(i,a,t),l=x(i,n),c=[];for(let o of n){if(C(i,o.relativePath,o.startLine))continue;let f=l.get(o.symbolId)??[],p=f.some(u=>d(u.symbol))?f.filter(u=>d(u.symbol)):f,e=new Map;for(let u of p)e.has(u.symbol)||e.set(u.symbol,u);if(e.size!==1||!P(i,o.relativePath,o.startLine,o.endLine))continue;let[,m]=[...e.entries()][0];c.push({symbol:o.symbol,shortName:y(o.symbol),file:o.relativePath,startLine:o.startLine,endLine:o.endLine,loc:h(o),forwardsTo:m.symbol,forwardsToShort:y(m.symbol),forwardsToFile:m.file})}return c.sort((o,f)=>o.loc-f.loc||o.file.localeCompare(f.file)),c.slice(0,s)}function D(i,r,a){return _(i,r).filter(t=>!i.isIgnored(t.relativePath)).filter(t=>d(t.symbol)).filter(t=>!g(t.symbol)).filter(t=>!b(t.symbol)).filter(t=>h(t)>=3&&h(t)<=a)}function h(i){return i.endLine-i.startLine+1}export{j as a};
|
|
2
|
-
//# sourceMappingURL=chunk-ORBQ3HJD.js.map
|
package/dist/chunk-P6IUCZA3.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import{b as g}from"./chunk-5IM4IQ6N.js";import{execFileSync as r}from"child_process";function N(e,a={}){let{base:m="HEAD"}=a,o;try{o=b(e.config.projectRoot,m)}catch{return{changedFiles:[],changedSymbols:[],affectedConsumers:[],summary:{totalChangedFiles:0,totalChangedSymbols:0,totalAffectedFiles:0,note:"Unable to compute git diff."}}}if(o.length===0)return{changedFiles:[],changedSymbols:[],affectedConsumers:[],summary:{totalChangedFiles:0,totalChangedSymbols:0,totalAffectedFiles:0,note:"No changed files found."}};let i=[],n=[];for(let t of o){let s=e.get(`SELECT id, relative_path FROM documents
|
|
2
|
-
WHERE relative_path LIKE ?
|
|
3
|
-
LIMIT 1`,`%${t}`);s&&!e.isIgnored(s.relative_path)&&(i.push(s.relative_path),n.push(s.id))}if(n.length===0)return{changedFiles:o,changedSymbols:[],affectedConsumers:[],summary:{totalChangedFiles:o.length,totalChangedSymbols:0,totalAffectedFiles:0,note:"Changed files are not present in the current SCIP index."}};let u=n.map(()=>"?").join(","),p=e.all(`SELECT DISTINCT gs.id AS symbol_id, gs.symbol, d.relative_path
|
|
4
|
-
FROM mentions m
|
|
5
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
6
|
-
JOIN global_symbols gs ON m.symbol_id = gs.id
|
|
7
|
-
JOIN documents d ON c.document_id = d.id
|
|
8
|
-
WHERE m.role = 1
|
|
9
|
-
AND c.document_id IN (${u})
|
|
10
|
-
${e.symbolNoiseFor("gs")}
|
|
11
|
-
ORDER BY d.relative_path`,...n),d=[],l=new Map;for(let t of p){let _=e.get(`SELECT COUNT(DISTINCT c.document_id) AS fan_in
|
|
12
|
-
FROM mentions m
|
|
13
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
14
|
-
WHERE m.symbol_id = ?
|
|
15
|
-
AND m.role != 1`,t.symbol_id)?.fan_in??0,h=g(t.symbol);d.push({symbol:t.symbol,shortName:h,file:t.relative_path,fanIn:_});let y=e.all(`SELECT DISTINCT ref_d.relative_path
|
|
16
|
-
FROM mentions m
|
|
17
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
18
|
-
JOIN documents ref_d ON c.document_id = ref_d.id
|
|
19
|
-
WHERE m.symbol_id = ?
|
|
20
|
-
AND m.role != 1
|
|
21
|
-
AND ref_d.relative_path NOT IN (${i.map(()=>"?").join(",")})
|
|
22
|
-
${e.pathExclusionsFor("ref_d")}`,t.symbol_id,...i);for(let c of y)e.isIgnored(c.relative_path)||(l.has(c.relative_path)||l.set(c.relative_path,new Set),l.get(c.relative_path).add(h))}let f=[...l.entries()].map(([t,s])=>({file:t,consumedSymbols:s.size})).sort((t,s)=>s.consumedSymbols-t.consumedSymbols);return{changedFiles:i,changedSymbols:d,affectedConsumers:f,summary:{totalChangedFiles:i.length,totalChangedSymbols:d.length,totalAffectedFiles:f.length}}}function b(e,a){let m=r("git",["diff","--name-only",a],{encoding:"utf-8",cwd:e,timeout:1e4}),o=r("git",["diff","--name-only","--cached",a],{encoding:"utf-8",cwd:e,timeout:1e4}),i=r("git",["ls-files","--others","--exclude-standard"],{encoding:"utf-8",cwd:e,timeout:1e4});return[...new Set([m,o,i].flatMap(n=>n.split(`
|
|
23
|
-
`)).map(n=>n.trim()).filter(n=>n.length>0))]}export{N as a};
|
|
24
|
-
//# sourceMappingURL=chunk-P6IUCZA3.js.map
|
package/dist/chunk-Q2MCCKWZ.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as C}from"./chunk-5KWWENJZ.js";import{k as b,m as f}from"./chunk-ID7TO4P6.js";import{r as u}from"./chunk-QRULHDMO.js";import{b as n,e as c,i as y}from"./chunk-5IM4IQ6N.js";function R(o,r){let{scope:s,minLoc:t=10,limit:M=30}=r??{},{definitions:d,callerMap:S,calleeMap:L}=g(o,s);return d.map(e=>{let a=e.endLine-e.startLine+1,i=S.get(e.symbolId)?.size??0,p=L.get(e.symbolId)??[],h=p.filter(l=>l.file!==e.relativePath),m=new Set(h.map(l=>`${l.symbol}|${l.file}`)).size,x=new Set(p.map(l=>`${l.symbol}|${l.file}`)).size;return{symbol:e.symbol,shortName:n(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:a,fanIn:i,fanOut:m,calleeCount:x,score:Math.round(a/50*(i/5)*Math.max(m/5,1)*100)/100}}).filter(e=>e.loc>=t).sort((e,a)=>a.score-e.score||a.loc-e.loc).slice(0,M)}function g(o,r){let s=u(o,r).filter(t=>c(t.symbol)&&!o.isIgnored(t.relativePath)).filter(t=>C(t.relativePath)!=="test").filter(t=>!y(t.symbol));return{definitions:s,callerMap:f(o,s),calleeMap:b(o,s)}}export{R as a};
|
|
2
|
-
//# sourceMappingURL=chunk-Q2MCCKWZ.js.map
|
package/dist/chunk-QRULHDMO.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import{a as x,b as v,c as k,d as A,f as M}from"./chunk-5IM4IQ6N.js";function b(a){let n=new WeakMap,e=t=>{let r=n.get(t);return r||(r=new Map,n.set(t,r)),r};return{get(t,r,i){let o=e(t);if(o.has(r))return o.get(r);let l=i();return o.set(r,l),l},invalidate(t,r){n.get(t)?.delete(r)},invalidateAll(t){n.delete(t)},size(t){return n.get(t)?.size??0}}}function he(a){let n=new WeakMap;return{get(e,t){let r=n.get(e);if(r)return r.value;let i=t();return n.set(e,{value:i}),i},invalidate(e){n.delete(e)},has(e){return n.has(e)}}}function N(a){let n=new WeakMap,e=t=>{let r=n.get(t);return r||(r=new Map,n.set(t,r)),r};return{get(t,r,i,o){let l=e(t),s=l.get(r);if(s&&s.source===i)return s.value;let u=o();return l.set(r,{source:i,value:u}),u},invalidate(t,r){n.get(t)?.delete(r)},invalidateAll(t){n.delete(t)}}}import{existsSync as H,readFileSync as Y}from"fs";import{join as K}from"path";var U=b("source-text");function m(a,n){let e=n.replace(/\\/g,"/");return U.get(a,e,()=>{let t=K(a.config.projectRoot,e);return H(t)?Y(t,"utf-8"):""})}var z=/scip-query[\s:-]*ignore[\s:-]*(?:dead(?:-code)?|stale|wrapper|passthrough|drift)?/i;function Ce(a,n,e){if(e<=0)return!1;let t=m(a,n);if(!t)return!1;let r=t.split(`
|
|
2
|
-
`);for(let i=e-1;i>=0&&i>=e-5;i-=1){let o=(r[i]??"").trim();if(o!==""){if(z.test(o))return!0;if(!o.startsWith("//")&&!o.startsWith("*")&&!o.startsWith("/*")&&!o.startsWith("@")&&!o.startsWith("#"))return!1}}return!1}import{extname as R}from"path";import{createRequire as G}from"module";var p=G(import.meta.url),y=null,I=!1;function P(){if(I)return null;if(y)return y;try{return y=p("tree-sitter"),y}catch{return I=!0,null}}var q={".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"},w=new Map,S=new Set;function O(a){if(S.has(a))return null;let n=w.get(a);if(n)return n;let e;try{switch(a){case"rust":e=p("tree-sitter-rust");break;case"typescript":e=p("tree-sitter-typescript").typescript;break;case"tsx":e=p("tree-sitter-typescript").tsx;break;case"javascript":e=p("tree-sitter-javascript");break;case"python":e=p("tree-sitter-python");break;case"java":e=p("tree-sitter-java");break;case"kotlin":e=p("tree-sitter-kotlin");break;case"scala":e=p("tree-sitter-scala");break;case"ruby":e=p("tree-sitter-ruby");break;case"c":e=p("tree-sitter-c");break;case"cpp":e=p("tree-sitter-cpp");break;case"csharp":e=p("tree-sitter-c-sharp");break;case"php":e=p("tree-sitter-php").php;break;case"vb":{let t=p("tree-sitter-vb-dotnet");e=t.language??t;break}}}catch{return S.add(a),null}return w.set(a,e),e}var T=new Map;function V(a){let n=T.get(a);if(n)return n;let e=O(a);if(!e)return null;let t=P();if(!t)return null;let r=new t;try{r.setLanguage(e)}catch{return S.add(a),null}return T.set(a,r),r}function h(a){return q[R(a).toLowerCase()]??null}function J(a){return R(a).toLowerCase()===".vue"}var j=N("ast-trees");function C(a,n){if(J(n))return Z(a,n);let e=h(n);if(!e)return null;let t=m(a,n);return t?j.get(a,n,t,()=>{let r=V(e);if(!r)return null;try{return r.parse(t)}catch{return null}}):null}function Z(a,n){let e=m(a,n);return e?j.get(a,n,e,()=>{let t=X(e);if(!t)return null;let r=V(t.language);if(!r)return null;let i=`
|
|
3
|
-
`.repeat(t.startLine)+t.body;try{return r.parse(i)}catch{return null}}):null}function X(a){let n=[],e=/<script\b([^>]*)>([\s\S]*?)<\/script>/g;for(let s of a.matchAll(e))typeof s.index=="number"&&n.push({tagOpen:s[1]??"",body:s[2]??"",openIdx:s.index+(s[0].length-(s[2]?.length??0)-9)});if(n.length===0)return null;let t=n.find(s=>/\bsetup\b/.test(s.tagOpen))??n[0],i=t.tagOpen.match(/\blang\s*=\s*["']?([\w-]+)/)?.[1]?.toLowerCase(),o=i==="ts"||i==="typescript"?"typescript":i==="tsx"?"tsx":"javascript",l=ee(a,t.openIdx);return{body:t.body,startLine:l,language:o}}function ee(a,n){let e=0;for(let t=0;t<n&&t<a.length;t++)a.charCodeAt(t)===10&&e++;return e}var g=new Map;function te(a,n){let e=`${a}::${n}`;if(g.has(e))return g.get(e)??null;let t=O(a);if(!t)return g.set(e,null),null;let r=P();if(!r)return g.set(e,null),null;let i=null;try{i=new r.Query(t,n)}catch{i=null}return g.set(e,i),i}var ne={rust:`
|
|
4
|
-
(function_item name: (identifier) @name) @def
|
|
5
|
-
(function_signature_item name: (identifier) @name) @def
|
|
6
|
-
`,typescript:`
|
|
7
|
-
(function_declaration name: (identifier) @name) @def
|
|
8
|
-
(method_definition name: (property_identifier) @name) @def
|
|
9
|
-
(method_signature name: (property_identifier) @name) @def
|
|
10
|
-
(function_signature name: (identifier) @name) @def
|
|
11
|
-
(variable_declarator name: (identifier) @name value: (arrow_function)) @def
|
|
12
|
-
(variable_declarator name: (identifier) @name value: (function_expression)) @def
|
|
13
|
-
(public_field_definition name: (property_identifier) @name value: (arrow_function)) @def
|
|
14
|
-
`,tsx:`
|
|
15
|
-
(function_declaration name: (identifier) @name) @def
|
|
16
|
-
(method_definition name: (property_identifier) @name) @def
|
|
17
|
-
(method_signature name: (property_identifier) @name) @def
|
|
18
|
-
(function_signature name: (identifier) @name) @def
|
|
19
|
-
(variable_declarator name: (identifier) @name value: (arrow_function)) @def
|
|
20
|
-
(variable_declarator name: (identifier) @name value: (function_expression)) @def
|
|
21
|
-
(public_field_definition name: (property_identifier) @name value: (arrow_function)) @def
|
|
22
|
-
`,javascript:`
|
|
23
|
-
(function_declaration name: (identifier) @name) @def
|
|
24
|
-
(method_definition name: (property_identifier) @name) @def
|
|
25
|
-
(variable_declarator name: (identifier) @name value: (arrow_function)) @def
|
|
26
|
-
(variable_declarator name: (identifier) @name value: (function_expression)) @def
|
|
27
|
-
`,python:`
|
|
28
|
-
(function_definition name: (identifier) @name) @def
|
|
29
|
-
`},re=new WeakMap;function F(a,n){return Q(a,n,re,ne,e=>{let t=[];for(let r of e){let i=null,o=null;for(let l of r.captures)l.name==="name"?i=l.node.text:l.name==="def"&&(o={startLine:l.node.startPosition.row,endLine:l.node.endPosition.row});i&&o&&t.push({name:i,startLine:o.startLine,endLine:o.endLine})}return t})}var ae={rust:`
|
|
30
|
-
(call_expression function: (_) @target) @call
|
|
31
|
-
(macro_invocation macro: (_) @target) @call
|
|
32
|
-
`,typescript:`
|
|
33
|
-
(call_expression function: (_) @target) @call
|
|
34
|
-
(new_expression constructor: (_) @target) @call
|
|
35
|
-
`,tsx:`
|
|
36
|
-
(call_expression function: (_) @target) @call
|
|
37
|
-
(new_expression constructor: (_) @target) @call
|
|
38
|
-
`,javascript:`
|
|
39
|
-
(call_expression function: (_) @target) @call
|
|
40
|
-
(new_expression constructor: (_) @target) @call
|
|
41
|
-
`,python:`
|
|
42
|
-
(call function: (_) @target) @call
|
|
43
|
-
`},ie=new WeakMap;function Ne(a,n){return Q(a,n,ie,ae,e=>{let t=[];for(let r of e){let i=null,o=null;for(let s of r.captures)s.name==="target"?i=s.node:s.name==="call"&&(o=s.node);if(!i||!o)continue;let l=L(i);l&&t.push({calleeLeaf:l,line:o.startPosition.row})}return t})}function Ie(a,n){return se(a,n,oe,()=>new Map,(e,t,r)=>{let i=(s,u)=>{if(s===u)return;let c=r.get(s);c||(c=new Set,r.set(s,c)),c.add(u)},o=t==="python"?new Set(["identifier"]):new Set(["type_identifier"]),l=(s,u)=>{let c=d=>{o.has(d.type)&&d.text!==u&&i(d.text,u);for(let f of d.children)c(f)};for(let d of s.children)c(d)};if(t==="rust")for(let s of e.rootNode.descendantsOfType(["struct_item","enum_item","union_item","type_item"])){let u=s.namedChildren.find(d=>d.type==="type_identifier")?.text;if(!u)continue;let c=s.namedChildren.find(d=>d.type==="field_declaration_list"||d.type==="enum_variant_list"||d.type==="ordered_field_declaration_list");c&&l(c,u),s.type==="type_item"&&l(s,u)}else if(t==="python")for(let s of e.rootNode.descendantsOfType("class_definition")){let u=s.namedChildren.find(d=>d.type==="identifier")?.text;if(!u)continue;let c=s.namedChildren.find(d=>d.type==="block");if(c)for(let d of c.descendantsOfType("type"))for(let f of d.descendantsOfType("identifier"))f.text!==u&&i(f.text,u)}else for(let s of e.rootNode.descendantsOfType(["interface_declaration","type_alias_declaration","class_declaration"])){let u=s.namedChildren.find(c=>c.type==="type_identifier")?.text;u&&l(s,u)}})??new Map}function se(a,n,e,t,r){let i=h(n);if(!i)return null;let o=C(a,n);if(!o)return null;let l=e.get(o);if(l)return l;let s=t();return r(o,i,s),e.set(o,s),s}function Q(a,n,e,t,r){let i=h(n);if(!i)return null;let o=t[i];if(!o)return null;let l=C(a,n);if(!l)return null;let s=e.get(l);if(s)return s;let u=te(i,o);if(!u)return null;let c=r(u.matches(l.rootNode));return e.set(l,c),c}var oe=new WeakMap,E=new WeakMap;function we(a,n,e,t){let r=h(n);if(!r)return null;let i=C(a,n);if(!i)return null;let o=E.get(i);return o||(o=le(i,r),E.set(i,o)),o.get(`${e}:${t}`)??null}function le(a,n){let e=n==="rust"?new Set(["function_item","function_signature_item"]):n==="python"?new Set(["function_definition"]):new Set(["function_declaration","method_definition","arrow_function","function_expression"]),t=new Map,r=i=>{if(e.has(i.type)){let o=i.namedChildren.find(s=>s.type==="parameters"||s.type==="formal_parameters"),l=0;if(o)for(let s of o.namedChildren)s.type==="comment"||s.type==="line_comment"||s.type==="block_comment"||(l+=1);t.set(`${i.startPosition.row}:${i.endPosition.row}`,{paramCount:l})}for(let o of i.children)r(o)};return r(a.rootNode),t}function L(a){switch(a.type){case"identifier":case"type_identifier":case"property_identifier":case"shorthand_property_identifier":return a.text;case"field_expression":case"member_expression":case"attribute":{let n=a.namedChild(a.namedChildCount-1);return n?L(n):null}case"scoped_identifier":{let n=a.childForFieldName("name")??a.namedChild(a.namedChildCount-1);return n?L(n):null}case"super":case"self":case"this":return null;default:return null}}function $(a){return!a||!a.trim()?null:a.replace(/^```\w*\s*/,"").replace(/\s*```$/,"").replace(/^\(method\)\s*/,"").replace(/^\(property\)\s*/,"").replace(/^\(function\)\s*/,"").replace(/^\(class\)\s*/,"").replace(/^\(interface\)\s*/,"").replace(/^\(enum\)\s*/,"").replace(/^\(type alias\)\s*/,"").replace(/^\(const\)\s*/,"").replace(/^\(var\)\s*/,"").trim()||null}function W(a){if(!a)return null;let n=a.indexOf("|");return n===-1?a.replace(/\n/g," "):a.slice(n+1).replace(/\n/g," ")}var ce=b("file-definitions");function D(a,n){return ce.get(a,n,()=>{let e=a.all(`SELECT
|
|
44
|
-
gs.id,
|
|
45
|
-
gs.symbol,
|
|
46
|
-
der.document_id,
|
|
47
|
-
der.start_line,
|
|
48
|
-
der.end_line,
|
|
49
|
-
d.relative_path,
|
|
50
|
-
gs.display_name,
|
|
51
|
-
gs.kind,
|
|
52
|
-
gs.documentation,
|
|
53
|
-
gs.enclosing_symbol
|
|
54
|
-
FROM global_symbols gs
|
|
55
|
-
JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
|
|
56
|
-
JOIN documents d ON der.document_id = d.id
|
|
57
|
-
WHERE d.relative_path = ?
|
|
58
|
-
${a.symbolNoiseFor("gs")}
|
|
59
|
-
ORDER BY der.start_line, der.end_line`,n),t=e.length>0?[]:a.all(`SELECT
|
|
60
|
-
gs.id,
|
|
61
|
-
gs.symbol,
|
|
62
|
-
c.document_id,
|
|
63
|
-
MIN(c.start_line) AS start_line,
|
|
64
|
-
MAX(c.end_line) AS end_line,
|
|
65
|
-
d.relative_path,
|
|
66
|
-
gs.display_name,
|
|
67
|
-
gs.kind,
|
|
68
|
-
gs.documentation,
|
|
69
|
-
gs.enclosing_symbol
|
|
70
|
-
FROM global_symbols gs
|
|
71
|
-
JOIN mentions m ON m.symbol_id = gs.id
|
|
72
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
73
|
-
JOIN documents d ON c.document_id = d.id
|
|
74
|
-
WHERE d.relative_path = ?
|
|
75
|
-
AND m.role = 1
|
|
76
|
-
${a.symbolNoiseFor("gs")}
|
|
77
|
-
GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path
|
|
78
|
-
ORDER BY start_line, end_line`,n);return de(a,n,(e.length>0?e:t).map(r=>({symbolId:r.id,symbol:r.symbol,documentId:r.document_id,startLine:r.start_line,endLine:r.end_line,relativePath:r.relative_path,leaf:k(r.symbol),parentTypeName:ye(r.symbol),isFunctionLike:M(r.symbol),isTypeLike:A(r.symbol)==="type",kind:r.kind??null,documentation:r.documentation??null,enclosingSymbol:r.enclosing_symbol??null})))})}function Fe(a,n={}){return ue(a,n.scope)}function ue(a,n){let e=n?`AND relative_path LIKE '%${n}%'`:"";return a.all(`SELECT relative_path
|
|
79
|
-
FROM documents
|
|
80
|
-
WHERE 1 = 1
|
|
81
|
-
${a.pathExclusionsFor("documents")}
|
|
82
|
-
${e}
|
|
83
|
-
ORDER BY relative_path`).flatMap(t=>D(a,t.relative_path)).filter(t=>!a.isIgnored(t.relativePath))}function Qe(a,n,e={}){if(n.length===0)return[];let t=n.flatMap(r=>D(a,r)).filter(r=>!a.isIgnored(r.relativePath));return e.onlyDocumented&&(t=t.filter(r=>r.documentation!==null&&r.documentation!=="")),e.sort&&(t=t.sort((r,i)=>r.relativePath.localeCompare(i.relativePath)||r.startLine-i.startLine||r.endLine-i.endLine)),t.map(r=>({startLine:r.startLine,endLine:r.endLine,symbol:r.symbol,shortName:v(r.symbol),signature:$(W(r.documentation)),relativePath:r.relativePath,enclosingSymbol:r.enclosingSymbol}))}function $e(a,n){let e=null;for(let t of a)t.startLine>n||t.endLine<n||(!e||t.endLine-t.startLine<e.endLine-e.startLine)&&(e=t);return e}function We(a,n){let e=D(a,n.relative_path).find(t=>t.symbolId===n.id);return e?{symbolId:e.symbolId,symbol:e.symbol,documentId:e.documentId,startLine:e.startLine,endLine:e.endLine,relativePath:e.relativePath}:{symbolId:n.id,symbol:n.symbol,documentId:n.document_id,startLine:n.start_line,endLine:n.end_line,relativePath:n.relative_path}}function de(a,n,e){let t=F(a,n);if(t)return pe(e,t);let r=m(a,n);if(!r)return e;let i=r.split(/\r?\n/),o=e.some(c=>_(c.symbol))?me(i):null,l=new Map;for(let c of e)l.set(c.symbolId,fe(i,o,c));let s=new Map,u=e.filter(c=>_(c.symbol)).map(c=>({definition:c,startLine:l.get(c.symbolId)??c.startLine})).sort((c,d)=>c.startLine-d.startLine||c.definition.startLine-d.definition.startLine||c.definition.symbol.localeCompare(d.definition.symbol));for(let c=0;c<u.length;c+=1){let d=u[c],f=u[c+1],B=f?Math.max(d.startLine,f.startLine-1):i.length-1;s.set(d.definition.symbolId,{startLine:d.startLine,endLine:ge(i,d.definition,d.startLine,B)})}return e.map(c=>{let d=s.get(c.symbolId);return d?{...c,startLine:d.startLine,endLine:d.endLine}:c})}function pe(a,n){let e=new Map;for(let t of n){let r=e.get(t.name);r?r.push(t):e.set(t.name,[t])}return a.map(t=>{if(!_(t.symbol)||!t.leaf)return t;let r=e.get(t.leaf);if(!r||r.length===0)return t;let i=r[0],o=Math.abs(i.startLine-t.startLine);for(let l=1;l<r.length;l+=1){let s=r[l],u=Math.abs(s.startLine-t.startLine);u<o&&(i=s,o=u)}return{...t,startLine:i.startLine,endLine:i.endLine}})}function fe(a,n,e){if(!_(e.symbol))return e.startLine;let t=Math.max(0,Math.min(e.startLine,a.length-1));if(!n)return t;let r=n.get(e.leaf);if(!r||r.length===0)return t;let i=null;for(let o of r){let l=Math.abs(o-e.startLine);(!i||l<i.distance)&&(i={line:o,distance:l})}return i?.line??t}function me(a){let n=/\b(?:function|def|fn)\s+([A-Za-z_$][\w$]*)/g,e=/\b([A-Za-z_$][\w$]*)\s*[:=]\s*(?:async\s*)?(?:function\b|\()/g,t=/^\s*(?:(?:export|public|private|protected|static|readonly|async|abstract|get|set)\s+)*([A-Za-z_$][\w$]*)\s*(?:<[^(]*>)?\s*\(/,r=/\b([A-Za-z_$][\w$]*)\s*\(/g,i=new Map,o=(l,s)=>{let u=i.get(l);if(!u){i.set(l,[s]);return}u[u.length-1]!==s&&u.push(s)};for(let l=0;l<a.length;l+=1){let s=a[l]??"";for(let c of s.matchAll(n))c[1]&&o(c[1],l);for(let c of s.matchAll(e))c[1]&&o(c[1],l);let u=s.match(t);u?.[1]&&o(u[1],l);for(let c of s.matchAll(r))c[1]&&o(c[1],l)}return i}function ge(a,n,e,t){let r=Math.max(e,Math.min(a.length-1,t)),i=Math.max(e,Math.min(r,n.endLine)),o=0,l=0,s=!1;for(let u=e;u<=r;u+=1){let c=be(a[u]??"");for(let d of c)d==="{"?(o+=1,s=!0):d==="}"?o=Math.max(0,o-1):d==="("?l+=1:d===")"&&(l=Math.max(0,l-1));if(s&&o===0||!s&&l===0&&u>=i)return u}return i}function be(a){let n="",e=null,t=!1;for(let r=0;r<a.length;r+=1){let i=a[r],o=a[r+1];if(!e&&i==="/"&&o==="/"){n+=" ".repeat(a.length-r);break}if(e){if(t){t=!1,n+=" ";continue}if(i==="\\"){t=!0,n+=" ";continue}i===e&&(e=null),n+=" ";continue}if(i==='"'||i==="'"||i==="`"){e=i,n+=" ";continue}n+=i}return n}function _(a){return a.includes("().")}function ye(a){let n=x(a);if("kind"in n)return null;for(let e=n.descriptors.length-2;e>=0;e--){let t=n.descriptors[e];if(t?.suffix==="type")return t.name}return null}function Be(a){let n=x(a);if("kind"in n)return[];let e=[];for(let t=n.descriptors.length-2;t>=0;t-=1){let r=n.descriptors[t];r?.suffix==="type"&&r.name&&e.push(r.name)}return e}export{b as a,he as b,N as c,m as d,Ce as e,h as f,J as g,C as h,Ne as i,Ie as j,se as k,we as l,L as m,$ as n,W as o,D as p,Fe as q,ue as r,Qe as s,$e as t,We as u,Be as v};
|
|
84
|
-
//# sourceMappingURL=chunk-QRULHDMO.js.map
|
package/dist/chunk-RAJHIEBM.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import{c as E}from"./chunk-5KWWENJZ.js";import{e as h,f as _}from"./chunk-VQXXSUQF.js";import{p as b}from"./chunk-QRULHDMO.js";import{b as m,d as p}from"./chunk-5IM4IQ6N.js";function C(e,s={}){let{scope:n,limit:i}=s,l=n?`AND barrel_d.relative_path LIKE '%${n}%'`:"",o=e.all(`SELECT DISTINCT
|
|
2
|
-
barrel_d.id AS barrel_doc_id,
|
|
3
|
-
barrel_d.relative_path AS barrel_path,
|
|
4
|
-
gs.id AS symbol_id,
|
|
5
|
-
gs.symbol AS symbol,
|
|
6
|
-
orig_d.id AS original_doc_id,
|
|
7
|
-
orig_d.relative_path AS original_path
|
|
8
|
-
FROM mentions m
|
|
9
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
10
|
-
JOIN documents barrel_d ON c.document_id = barrel_d.id
|
|
11
|
-
JOIN global_symbols gs ON m.symbol_id = gs.id
|
|
12
|
-
JOIN (
|
|
13
|
-
SELECT m2.symbol_id, c2.document_id
|
|
14
|
-
FROM mentions m2
|
|
15
|
-
JOIN chunks c2 ON m2.chunk_id = c2.id
|
|
16
|
-
WHERE m2.role = 1
|
|
17
|
-
GROUP BY m2.symbol_id
|
|
18
|
-
) sym_def ON sym_def.symbol_id = gs.id
|
|
19
|
-
JOIN documents orig_d ON sym_def.document_id = orig_d.id
|
|
20
|
-
WHERE m.role != 1
|
|
21
|
-
AND (barrel_d.relative_path LIKE '%/index.ts'
|
|
22
|
-
OR barrel_d.relative_path LIKE '%/index.js'
|
|
23
|
-
OR barrel_d.relative_path = 'index.ts'
|
|
24
|
-
OR barrel_d.relative_path = 'index.js')
|
|
25
|
-
AND orig_d.id != barrel_d.id
|
|
26
|
-
${e.pathExclusionsFor("barrel_d","orig_d")}
|
|
27
|
-
${e.symbolNoiseFor("gs")}
|
|
28
|
-
-- Only function-level symbols (ending with ().), not module-level
|
|
29
|
-
AND gs.symbol LIKE '%().'
|
|
30
|
-
${l}
|
|
31
|
-
ORDER BY barrel_d.relative_path, gs.symbol`),a=[];for(let r of o){if(e.isIgnored(r.barrel_path)||e.isIgnored(r.original_path)||E(e,r.barrel_path))continue;let t=e.get(`SELECT
|
|
32
|
-
SUM(CASE WHEN uses_barrel = 1 THEN 1 ELSE 0 END) AS barrel_consumers,
|
|
33
|
-
SUM(CASE WHEN uses_barrel = 0 THEN 1 ELSE 0 END) AS direct_consumers
|
|
34
|
-
FROM (
|
|
35
|
-
SELECT
|
|
36
|
-
consumer_d.id AS consumer_doc_id,
|
|
37
|
-
MAX(CASE WHEN EXISTS (
|
|
38
|
-
SELECT 1
|
|
39
|
-
FROM mentions barrel_m
|
|
40
|
-
JOIN chunks barrel_c ON barrel_m.chunk_id = barrel_c.id
|
|
41
|
-
WHERE barrel_c.document_id = consumer_d.id
|
|
42
|
-
AND barrel_m.role != 1
|
|
43
|
-
AND barrel_m.symbol_id IN (
|
|
44
|
-
SELECT m2.symbol_id
|
|
45
|
-
FROM mentions m2
|
|
46
|
-
JOIN chunks c2 ON m2.chunk_id = c2.id
|
|
47
|
-
WHERE c2.document_id = ?
|
|
48
|
-
AND m2.role != 1
|
|
49
|
-
)
|
|
50
|
-
) THEN 1 ELSE 0 END) AS uses_barrel
|
|
51
|
-
FROM mentions ref_m
|
|
52
|
-
JOIN chunks ref_c ON ref_m.chunk_id = ref_c.id
|
|
53
|
-
JOIN documents consumer_d ON ref_c.document_id = consumer_d.id
|
|
54
|
-
WHERE ref_m.symbol_id = ?
|
|
55
|
-
AND ref_m.role != 1
|
|
56
|
-
AND consumer_d.id != ?
|
|
57
|
-
AND consumer_d.id != ?
|
|
58
|
-
${e.pathExclusionsFor("consumer_d")}
|
|
59
|
-
GROUP BY consumer_d.id
|
|
60
|
-
)`,r.barrel_doc_id,r.symbol_id,r.barrel_doc_id,r.original_doc_id),c=t?.barrel_consumers??0,u=t?.direct_consumers??0;c===0&&u===0&&a.push({barrelFile:r.barrel_path,symbol:r.symbol,shortName:m(r.symbol),originalFile:r.original_path,barrelConsumers:c,directConsumers:u})}a.sort((r,t)=>t.directConsumers-r.directConsumers||r.barrelFile.localeCompare(t.barrelFile)||r.shortName.localeCompare(t.shortName));let d=R([...a,...g(e,n)]);return d.sort((r,t)=>t.directConsumers-r.directConsumers||r.barrelFile.localeCompare(t.barrelFile)||r.shortName.localeCompare(t.shortName)),i?d.slice(0,i):d}function g(e,s){let i=e.all(`SELECT relative_path
|
|
61
|
-
FROM documents
|
|
62
|
-
WHERE 1 = 1
|
|
63
|
-
${s?"AND relative_path LIKE ?":""}
|
|
64
|
-
${e.pathExclusionsFor("documents")}
|
|
65
|
-
ORDER BY relative_path`,...s?[`%${s}%`]:[]).map(o=>o.relative_path).filter(o=>!e.isIgnored(o)).filter(o=>_(e,o).length>0),l=[];for(let o of i){let a=_(e,o).filter(r=>r.sourcePath&&!e.isIgnored(r.sourcePath));if(!(a.length===0||f(e,o,o)>0))for(let r of a){let t=r.sourcePath,c=N(e,t);c&&l.push({barrelFile:o,symbol:c.symbol,shortName:m(c.symbol),originalFile:t,barrelConsumers:0,directConsumers:f(e,t,o)})}}return l}function f(e,s,n){let i=e.all(`SELECT relative_path
|
|
66
|
-
FROM documents
|
|
67
|
-
WHERE 1 = 1
|
|
68
|
-
${e.pathExclusionsFor("documents")}
|
|
69
|
-
ORDER BY relative_path`),l=new Set;for(let o of i)if(!(e.isIgnored(o.relative_path)||o.relative_path===n))for(let a of h(e,o.relative_path))a.sourcePath===s&&l.add(o.relative_path);return l.size}function N(e,s){let n=b(e,s);return n.find(i=>p(i.symbol)==="method")??n[0]??null}function R(e){let s=new Set,n=[];for(let i of e){let l=`${i.barrelFile}|${i.symbol}|${i.originalFile}`;s.has(l)||(s.add(l),n.push(i))}return n}export{C as a};
|
|
70
|
-
//# sourceMappingURL=chunk-RAJHIEBM.js.map
|
package/dist/chunk-RKZBRDFK.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{d,q as b}from"./chunk-QRULHDMO.js";import{b as g}from"./chunk-5IM4IQ6N.js";function I(n,e={}){let{scope:i,minLoc:u=1,limit:l}=e,p=new Map;for(let t of b(n,{scope:i})){if(!t.isFunctionLike||n.isIgnored(t.relativePath))continue;let s=t.endLine-t.startLine+1;if(s<u)continue;let f=x(n,t);if(!f)continue;let a={symbol:t.symbol,shortName:g(t.symbol),file:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:s},r=p.get(f);r?r.push(a):p.set(f,[a])}let c=[];for(let[t,s]of p)s.length<2||c.push({signature:t,functions:s});return c.sort((t,s)=>{let f=s.functions.length-t.functions.length;if(f!==0)return f;let a=t.functions.reduce((o,m)=>o+m.loc,0);return s.functions.reduce((o,m)=>o+m.loc,0)-a}),l?c.slice(0,l):c}function x(n,e){let i=S(e.documentation),u=i?L(i):null;return u||D($(n,e.relativePath,e.startLine,e.endLine,e.leaf),e.leaf)}function S(n){if(!n||!n.includes("|"))return null;let e=n.slice(n.indexOf("|")+1).replace(/\n/g," ").trim();return e.length>0?e:null}function $(n,e,i,u,l){let p=d(n,e);if(!p)return null;let c=p.split(/\r?\n/),t=v(c,i,u,l);for(let s of t){let f=Math.min(c.length-1,Math.max(s,s+4)),a="";for(let r=s;r<=f;r+=1){let o=c[r]?.trim();if(o&&(a=a?`${a} ${o}`:o,y(a)))return a}if(a&&a.includes("("))return a}return null}function y(n){let e=n.replace(/\s+/g," ").trim();return!e.includes("(")||w(e)>0?!1:/[;{]$/.test(e)||/\)\s*(?::\s*[^={]+)?\s*(?:=>|=|throws\b|where\b|$)/i.test(e)||/\)\s*As\s+.+$/i.test(e)}function L(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(),i=e.indexOf("(");return i===-1||(e=e.slice(i),e=e.replace(/\s+/g,"").toLowerCase(),e.length<3)?null:e}function D(n,e){if(!n||!n.trim())return null;let i=n.replace(/\s+/g," ").trim(),u=i.indexOf("(");if(u===-1)return null;let l=i.slice(0,u),c=new RegExp(`\\b${h(e)}\\b`,"i").exec(l);c&&typeof c.index=="number"&&(l=l.slice(0,c.index)),l=l.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 t=i.slice(u).replace(/\s*\{[\s\S]*$/,"").replace(/\s*=>[\s\S]*$/,"").replace(/\)\s*=\s*[\s\S]*$/,")").replace(/\s+throws\s+[^={]+$/i,"").replace(/\s+where\s+.+$/i,"").replace(/\s+/g," ").trim();if(!t.startsWith("("))return null;let s=`${l?`${l} `:""}${t}`.replace(/\s+/g,"").toLowerCase();return s.length>=3?s:null}function v(n,e,i,u){let l=h(u),p=new RegExp(`\\b${l}\\b\\s*\\(`,"i"),c=new RegExp(`\\bdef\\s+${l}\\b`,"i"),t=[],s=new Set,f=Math.max(0,Math.min(e,n.length-1)),a=Math.max(f,Math.min(n.length-1,Math.max(i,e+4)));for(let r=f;r<=a;r+=1){let o=n[r]??"";(p.test(o)||c.test(o))&&!s.has(r)&&(s.add(r),t.push(r))}for(let r=0;r<n.length;r+=1){let o=n[r]??"";(p.test(o)||c.test(o))&&!s.has(r)&&(s.add(r),t.push(r))}return t}function w(n){let e=0;for(let i of n)i==="("&&(e+=1),i===")"&&(e-=1);return e}function h(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}export{I as a};
|
|
2
|
-
//# sourceMappingURL=chunk-RKZBRDFK.js.map
|
package/dist/chunk-RPRIZ43D.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{c as g}from"./chunk-F2TGKDMW.js";import{h as u,j as h}from"./chunk-ID7TO4P6.js";import{a as d,b as y}from"./chunk-H4IWC7KJ.js";import{p as S,t as p}from"./chunk-QRULHDMO.js";import{b as m}from"./chunk-5IM4IQ6N.js";function N(e,o,r={}){let{direction:c="backward",maxDepth:s=3}=r,t=d(e,o);return t?c==="backward"?w(e,t,s):R(e,t):null}function w(e,o,r){let c=[],s=new Set([o.symbol]),t=[o];for(let n=1;n<=r&&t.length!==0;n++){let l=[];for(let a of t){let i=u(e,a);for(let f of i){if(s.has(f.symbol))continue;s.add(f.symbol),c.push({symbol:f.symbol,shortName:m(f.symbol),file:f.file,relationship:n===1?"referenced within definition (callee)":`depth ${n} callee`});let b=y(e,f.symbol);b&&!e.isIgnored(b.relativePath)&&l.push(b)}}t=l}return{symbol:o.symbol,shortName:m(o.symbol),direction:"backward",connectedSymbols:c}}function R(e,o){let r=g(e,o),c=r.length>0?r:h(e,o),s=new Set,t=[];for(let n of c){if(t.length>=30)break;if(e.isIgnored(n.file))continue;let l=n.enclosingSymbol??p(S(e,n.file),n.line)?.symbol??null;if(!l||l===o.symbol)continue;let a=y(e,l);if(a){for(let i of u(e,a))if(i.symbol!==o.symbol&&i.symbol!==l&&i.file!==n.file&&!e.isIgnored(i.file)&&!s.has(i.symbol)&&(s.add(i.symbol),t.push({symbol:i.symbol,shortName:m(i.symbol),file:i.file,relationship:`used alongside target in ${m(l)}`}),t.length>=30))break}}return t.sort((n,l)=>n.file.localeCompare(l.file)),{symbol:o.symbol,shortName:m(o.symbol),direction:"forward",connectedSymbols:t}}export{N as a};
|
|
2
|
-
//# sourceMappingURL=chunk-RPRIZ43D.js.map
|
package/dist/chunk-RXGCTLHY.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{i as S,m as M}from"./chunk-ID7TO4P6.js";import{a as g,b as I}from"./chunk-H4IWC7KJ.js";import{p as d,t as p}from"./chunk-QRULHDMO.js";import{b as u}from"./chunk-5IM4IQ6N.js";function N(s,f,n={}){let{maxDepth:a=5,scope:b}=n,c=g(s,f);if(!c)return[];let i=[],y=new Set([c.symbolId]),r=new Set,l=[c];for(let e=1;e<=a&&l.length!==0;e++){let t=[];for(let m of l)for(let o of w(s,m,b)){let h=`${o.file}|${o.shortName}`;if(o.symbolId!==null){if(y.has(o.symbolId))continue;y.add(o.symbolId)}else if(r.has(h))continue;r.add(h),i.push({symbol:o.symbol,shortName:o.shortName,file:o.file,depth:e}),o.symbolId!==null&&o.symbolMatch&&t.push(o.symbolMatch)}l=t}return i.sort((e,t)=>e.depth-t.depth||e.file.localeCompare(t.file)),i}function w(s,f,n){let a=S(s,f,{limit:500}).filter(e=>!s.isIgnored(e.file)).filter(e=>!n||e.file.includes(n)),b=new Set(a.map(e=>e.file)),c=M(s).get(f.symbolId)??new Set,i=[];for(let e of c){if(b.has(e)||s.isIgnored(e)||n&&!e.includes(n))continue;let t=d(s,e),m=t.length>0?p(t,t[0].startLine):null;i.push({symbol:m?.symbol??e,file:e})}let y=[...a,...i],r=[],l=new Set;for(let e of y){let t=I(s,e.symbol);if(!t){let o=`${e.file}|${e.symbol}`;if(l.has(o))continue;l.add(o),r.push({symbolId:null,symbol:e.symbol,shortName:u(e.symbol),file:e.file,symbolMatch:null});continue}if(t.symbolId===f.symbolId||s.isIgnored(t.relativePath))continue;let m=`${t.symbolId}|${t.relativePath}`;l.has(m)||(l.add(m),r.push({symbolId:t.symbolId,symbol:t.symbol,shortName:u(t.symbol),file:t.relativePath,symbolMatch:t}))}return r}export{N as a};
|
|
2
|
-
//# sourceMappingURL=chunk-RXGCTLHY.js.map
|
package/dist/chunk-S6IGA6KK.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{h as f}from"./chunk-ID7TO4P6.js";import{a as m}from"./chunk-H4IWC7KJ.js";import{b as r}from"./chunk-5IM4IQ6N.js";function w(i,g,p){let s=m(i,g),n=m(i,p);if(!s||!n)return null;let c=new Set(f(i,s).map(e=>e.symbol)),h=new Set(f(i,n).map(e=>e.symbol)),a=[];for(let e of c)h.has(e)&&a.push(e);let o=[];for(let e of c)h.has(e)||o.push(e);let l=[];for(let e of h)c.has(e)||l.push(e);let u=new Set([...c,...h]),d=u.size>0?a.length/u.size:0,t;u.size===0?t="Neither function calls other tracked symbols. There is no callee-pattern evidence for consolidation; inspect the source bodies directly.":a.length===0?t="These functions do not share any callees. They are not a callee-based consolidation candidate.":o.length===0&&l.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.":l.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&&l.length<=2?t=`Create a shared function with the ${a.length} common callees. Pass the ${o.length+l.length} divergent callees as parameters or strategy callbacks.`:t=`Extract the ${a.length} shared callees into a common helper. Each function calls the helper plus its own unique logic (${o.length} callees in A, ${l.length} in B).`;let y=s.endLine-s.startLine+1,b=n.endLine-n.startLine+1;return{symbolA:{symbol:s.symbol,shortName:r(s.symbol),file:s.relativePath,loc:y},symbolB:{symbol:n.symbol,shortName:r(n.symbol),file:n.relativePath,loc:b},similarity:d,sharedCallees:a.map(r),uniqueToA:o.map(r),uniqueToB:l.map(r),consolidationStrategy:t}}export{w as a};
|
|
2
|
-
//# sourceMappingURL=chunk-S6IGA6KK.js.map
|
package/dist/chunk-TVJMEDHH.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as x}from"./chunk-5KWWENJZ.js";import{k}from"./chunk-ID7TO4P6.js";import{e as w,r as v}from"./chunk-QRULHDMO.js";import{b,f as C,i as L}from"./chunk-5IM4IQ6N.js";function A(i,F={}){let{scope:I,minLoc:P=10,minCallees:z=6,limit:D=20}=F,y=v(i,I).filter(e=>!i.isIgnored(e.relativePath)).filter(e=>h(e)>=P&&C(e.symbol)).filter(e=>!(e.relativePath.split("/").pop()??"").includes("types")).filter(e=>x(e.relativePath)!=="test").filter(e=>!L(e.symbol)).filter(e=>!w(i,e.relativePath,e.startLine)).sort((e,r)=>h(r)-h(e)),E=k(i,y),d=[];for(let e of y){let r=E.get(e.symbolId)??[],c=new Set(r.map(t=>t.symbol));if(c.size<z)continue;let l=new Map;for(let t of c)l.set(t,new Set);let a=new Map;for(let t of r)a.has(t.chunkId)||a.set(t.chunkId,new Set),a.get(t.chunkId).add(t.symbol);for(let t of a.values()){let s=[...t];for(let o=0;o<s.length;o++)for(let n=o+1;n<s.length;n++)l.get(s[o]).add(s[n]),l.get(s[n]).add(s[o])}let f=new Set,m=[];for(let t of c){if(f.has(t))continue;let s=new Set,o=[t];for(;o.length>0;){let n=o.pop();if(!f.has(n)){f.add(n),s.add(n);for(let u of l.get(n)??[])f.has(u)||o.push(u)}}m.push(s)}if(m.length<2)continue;let S=m.filter(t=>t.size>=3).map(t=>{let s=new Set;for(let p of m)if(p!==t)for(let g of p)s.add(g);let o=0;for(let p of t)for(let g of l.get(p)??[])s.has(g)&&o++;let n=t.size*s.size,u=n>0?1-o/n:1;return{callees:[...t].map(b),isolation:u}}).filter(t=>t.isolation>.5).sort((t,s)=>s.isolation-t.isolation);S.length>0&&d.push({symbol:e.symbol,shortName:b(e.symbol),relativePath:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:h(e),totalCallees:c.size,clusters:S})}return d.sort((e,r)=>r.clusters.length-e.clusters.length||r.loc-e.loc),d.slice(0,D)}function h(i){return i.endLine-i.startLine+1}export{A as a};
|
|
2
|
-
//# sourceMappingURL=chunk-TVJMEDHH.js.map
|
package/dist/chunk-UDKLKBPQ.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{b as p}from"./chunk-DX5YEUX4.js";import{s as u}from"./chunk-QRULHDMO.js";import{k as f}from"./chunk-5IM4IQ6N.js";function S(a,b){let y=p(a,b),o=u(a,y,{sort:!0});if(o.length===0)return[];let i=o.map(e=>({symbol:e.symbol,shortName:e.shortName,startLine:e.startLine,endLine:e.endLine,children:[]})),s=new Map;for(let e of i)s.set(e.symbol,e);let c=[];for(let e=0;e<o.length;e++){let r=o[e],n=i[e];if(r.enclosingSymbol&&s.has(r.enclosingSymbol)){s.get(r.enclosingSymbol).children.push(n);continue}let l=null,m=1/0;for(let t of i)if(t!==n&&t.startLine<=n.startLine&&t.endLine>=n.endLine){if(t.startLine===n.startLine&&t.endLine===n.endLine&&!f(t.symbol,n.symbol))continue;let d=t.endLine-t.startLine;d<m&&(m=d,l=t)}l?l.children.push(n):c.push(n)}return c}export{S as a};
|
|
2
|
-
//# sourceMappingURL=chunk-UDKLKBPQ.js.map
|
package/dist/chunk-UGUBEKK5.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{q as p}from"./chunk-QRULHDMO.js";import{a as d,b as f,d as u}from"./chunk-5IM4IQ6N.js";var m={0:"UnspecifiedKind",1:"AbstractMethod",2:"Accessor",3:"Array",4:"Assertion",5:"AssociatedType",6:"Attribute",7:"Axiom",8:"Boolean",9:"Class",10:"Constant",11:"Constructor",12:"Contract",13:"DataFamily",14:"DefinitionMacro",15:"Delegate",16:"Enum",17:"EnumMember",18:"Error",19:"Event",20:"Fact",21:"Field",22:"File",23:"Function",24:"Getter",25:"Grammar",26:"Instance",27:"Interface",28:"Key",29:"Lang",30:"Lemma",31:"Library",32:"Macro",33:"Method",34:"MethodAlias",35:"MethodReceiver",36:"MethodSpecification",37:"Message",38:"Modifier",39:"Module",40:"Namespace",41:"Null",42:"Number",43:"Object",44:"Operator",45:"Package",46:"PackageObject",47:"Parameter",48:"ParameterLabel",49:"Pattern",50:"Predicate",51:"Property",52:"Protocol",53:"ProtocolMethod",54:"PureVirtualMethod",55:"Quasiquoter",56:"SelfParameter",57:"Setter",58:"Signature",59:"SingletonClass",60:"SingletonMethod",61:"StaticDataMember",62:"StaticEvent",63:"StaticField",64:"StaticMethod",65:"StaticProperty",66:"StaticVariable",67:"String",68:"Struct",69:"Subscript",70:"Tactic",71:"Theorem",72:"ThisParameter",73:"Trait",74:"TraitMethod",75:"Type",76:"TypeAlias",77:"TypeClass",78:"TypeClassMethod",79:"TypeFamily",80:"TypeParameter",81:"Union",82:"Value",83:"Variable"},c=new Map;for(let[e,i]of Object.entries(m))c.set(i.toLowerCase(),Number(e));function g(e){let i=parseInt(e,10);if(!isNaN(i))return i;let s=e.toLowerCase(),n=c.get(s);if(n!==void 0)return n;for(let[r,o]of c)if(r.includes(s))return o;return null}function N(e,i,s={}){let{scope:n,limit:r=100}=s,o=g(i);return o===null?[]:b(e,n).map(t=>({row:t,resolvedKind:y(t)})).filter(t=>t.resolvedKind===o).slice(0,r).map(({row:t,resolvedKind:l})=>({symbol:t.symbol,shortName:f(t.symbol),kind:l,kindName:m[l]??"Unknown",relativePath:t.relative_path,startLine:t.start_line,endLine:t.end_line}))}function P(e,i={}){let s=new Map;for(let n of b(e,i.scope)){let r=y(n);r===null||r===0||s.set(r,(s.get(r)??0)+1)}return[...s.entries()].sort((n,r)=>r[1]-n[1]||n[0]-r[0]).map(([n,r])=>({kind:n,kindName:m[n]??"Unknown",count:r}))}function b(e,i){return p(e,{scope:i}).map(S)}function S(e){return{symbol:e.symbol,kind:e.kind,documentation:e.documentation,enclosing_symbol:e.enclosingSymbol,relative_path:e.relativePath,start_line:e.startLine,end_line:e.endLine}}function y(e){return e.kind!==null&&e.kind!==0?h(e.kind,e.symbol,e.documentation):M(e.symbol,e.documentation,e.enclosing_symbol)}function h(e,i,s){let n=(s??"").toLowerCase();if(u(i)==="type"){if(n.includes("type "))return 76;if(n.includes("interface "))return 27;if(n.includes("struct "))return 68;if(n.includes("trait "))return 73;if(n.includes("class "))return 9}return e}function M(e,i,s){let n=d(e);if("kind"in n)return null;let r=n.descriptors,o=r[r.length-2]??null,a=u(e),t=(i??"").toLowerCase();return a==="type"?t.includes("type ")?76:t.includes("interface ")?27:t.includes("struct ")?68:t.includes("trait ")?73:(t.includes("class "),9):a==="method"?o?.suffix==="type"?33:23:a==="namespace"?39:a!=="term"?null:t.includes("async def ")||t.includes("def ")?23:(s?u(s):o?.suffix??null)==="type"?21:83}export{N as a,P as b};
|
|
2
|
-
//# sourceMappingURL=chunk-UGUBEKK5.js.map
|
package/dist/chunk-VKYLXCV6.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{g as M}from"./chunk-ID7TO4P6.js";function H(o,c={}){let{minSimilarity:e=.5,limit:n=15,scope:r,minChainLength:g=3,maxChainLength:s=8}=c,l=M(o,r),t=R(l,g,s);if(t.length===0)return[];let h=new Map,u=new Map;for(let i of t){let a=new Set;for(let f of i)a.has(f)||(h.set(f,(h.get(f)??0)+1),a.add(f));for(let f=Math.max(0,i.length-2);f<i.length;f++)u.set(i[f],(u.get(i[f])??0)+1)}let P=t.length*.9,q=t.length*.8,x=new Set;for(let[i,a]of h)a>P&&x.add(i);for(let[i,a]of u)a>q&&x.add(i);let E=["index.ts","index.js","cli.ts","main.ts","health.ts","health.js"];for(let i of h.keys()){let a=i.split("/").pop()??"";E.includes(a)&&x.add(i)}let p=[];for(let i of t){let a=i.filter(f=>!x.has(f));a.length>=2&&p.push({original:i,filtered:a})}if(p.length<2)return[];let b=[];for(let i=0;i<p.length;i++){for(let a=i+1;a<p.length;a++){let f=p[i],m=p[a],F=new Set(f.filtered),S=!1;for(let d of m.filtered)if(F.has(d)){S=!0;break}if(!S)continue;let{distance:C,ops:A}=T(f.filtered,m.filtered),j=Math.max(f.filtered.length,m.filtered.length);if(j===0)continue;let B=1-C/j;if(B<e||C===0)continue;let w=A.filter(d=>d.type==="substitute").map(d=>({index:d.indexA,nodeA:f.filtered[d.indexA],nodeB:m.filtered[d.indexB]}));if(w.length===0||A.filter(d=>d.type==="match").length<2)continue;let N=v(f.original,m.original),O=z(f.original,m.original);b.push({chainA:f.original,chainB:m.original,similarity:B,editDistance:C,divergencePoints:w,commonPrefix:N,commonSuffix:O})}if(b.length>n*10)break}b.sort((i,a)=>Math.abs(a.similarity-i.similarity)>.01?a.similarity-i.similarity:i.divergencePoints.length-a.divergencePoints.length);let y=[];for(let i of b)if(y.some(f=>k(i.chainA,f.chainA)&&k(i.chainB,f.chainB))||y.push(i),y.length>=n)break;return y}function R(o,c,e){let n=[];for(let g of o.keys()){if(n.length>=500)break;D(o,g,[g],new Set([g]),c,e,n,500)}return n}function D(o,c,e,n,r,g,s,l){if(s.length>=l)return;if(e.length>=g){e.length>=r&&s.push([...e]);return}let t=o.get(c);if(!t||t.size===0){e.length>=r&&s.push([...e]);return}let h=!1;for(let u of t)if(!n.has(u)&&(n.add(u),e.push(u),D(o,u,e,n,r,g,s,l),e.pop(),n.delete(u),h=!0,s.length>=l))return;!h&&e.length>=r&&s.push([...e])}function T(o,c){let e=o.length,n=c.length,r=Array.from({length:e+1},()=>Array(n+1).fill(0));for(let t=0;t<=e;t++)r[t][0]=t;for(let t=0;t<=n;t++)r[0][t]=t;for(let t=1;t<=e;t++)for(let h=1;h<=n;h++)o[t-1]===c[h-1]?r[t][h]=r[t-1][h-1]:r[t][h]=1+Math.min(r[t-1][h],r[t][h-1],r[t-1][h-1]);let g=[],s=e,l=n;for(;s>0||l>0;)s>0&&l>0&&o[s-1]===c[l-1]?(g.unshift({type:"match",indexA:s-1,indexB:l-1}),s--,l--):s>0&&l>0&&r[s][l]===r[s-1][l-1]+1?(g.unshift({type:"substitute",indexA:s-1,indexB:l-1}),s--,l--):l>0&&r[s][l]===r[s][l-1]+1?(g.unshift({type:"insert",indexA:s,indexB:l-1}),l--):(g.unshift({type:"delete",indexA:s-1,indexB:l}),s--);return{distance:r[e][n],ops:g}}function v(o,c){let e=[];for(let n=0;n<Math.min(o.length,c.length)&&o[n]===c[n];n++)e.push(o[n]);return e}function z(o,c){let e=[],n=o.length-1,r=c.length-1;for(;n>=0&&r>=0&&o[n]===c[r];)e.unshift(o[n]),n--,r--;return e}function k(o,c){if(o.length>c.length)return!1;let e=c.join("\u2192"),n=o.join("\u2192");return e.includes(n)}export{H as a};
|
|
2
|
-
//# sourceMappingURL=chunk-VKYLXCV6.js.map
|