@easbot/codebase 0.3.20 → 0.3.22

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.
Files changed (48) hide show
  1. package/README.en.md +46 -0
  2. package/README.md +46 -0
  3. package/dist/chunks/{chunk-AGZFRKQ4.mjs → chunk-22NIJF4D.mjs} +12 -12
  4. package/dist/chunks/chunk-2DGOSNEH.mjs +34 -0
  5. package/dist/chunks/{chunk-BEQN3CKO.cjs → chunk-HRFLFP6O.cjs} +1 -1
  6. package/dist/chunks/{chunk-YYF5OQDS.cjs → chunk-MRPT44H3.cjs} +22 -22
  7. package/dist/chunks/{chunk-WXWENWCY.mjs → chunk-QQXDOGRV.mjs} +1 -1
  8. package/dist/chunks/chunk-R26JQOPF.mjs +47 -0
  9. package/dist/chunks/{chunk-22PKTMO5.mjs → chunk-T2ZV7FU4.mjs} +19 -19
  10. package/dist/chunks/chunk-VF3U3DPM.cjs +34 -0
  11. package/dist/chunks/{chunk-JWTI3BWI.cjs → chunk-ZCH5GLXA.cjs} +19 -19
  12. package/dist/chunks/{chunk-VFTVDTEY.cjs → chunk-ZK7YSBLG.cjs} +12 -12
  13. package/dist/chunks/cli-handler-2PSSL33N.mjs +1 -0
  14. package/dist/chunks/cli-handler-EYQH2TDL.cjs +1 -0
  15. package/dist/chunks/code-base-2ACRJ2UT.cjs +1 -0
  16. package/dist/chunks/code-base-SNQ2LWU6.mjs +1 -0
  17. package/dist/chunks/database-manager-MG7JMWGN.mjs +1 -0
  18. package/dist/chunks/database-manager-ZDJSRVBR.cjs +1 -0
  19. package/dist/chunks/file-watcher-HVST5PAC.cjs +1 -0
  20. package/dist/chunks/file-watcher-LCQ55MPE.mjs +1 -0
  21. package/dist/chunks/{interfaces-5HZADUYB.mjs → interfaces-DPFLQBQ6.mjs} +1 -1
  22. package/dist/chunks/{interfaces-ORRCH4XV.cjs → interfaces-YX56SVRQ.cjs} +1 -1
  23. package/dist/chunks/{llm-MPD7FHPM.mjs → llm-ADBGTSCV.mjs} +1 -1
  24. package/dist/chunks/{llm-JQV6XWGD.cjs → llm-BDMNIGOH.cjs} +1 -1
  25. package/dist/chunks/stdio-server-7CFU5X3T.cjs +47 -0
  26. package/dist/chunks/stdio-server-UNJPQYXA.mjs +47 -0
  27. package/dist/cli.cjs +1 -1
  28. package/dist/cli.mjs +1 -1
  29. package/dist/index.cjs +1 -1
  30. package/dist/index.d.cts +35 -3
  31. package/dist/index.d.ts +35 -3
  32. package/dist/index.mjs +1 -1
  33. package/package.json +10 -10
  34. package/dist/chunks/chunk-CSMSBVAG.mjs +0 -34
  35. package/dist/chunks/chunk-R74KIJM2.cjs +0 -34
  36. package/dist/chunks/chunk-TR3DFBJH.mjs +0 -47
  37. package/dist/chunks/cli-handler-3I5JC3HY.cjs +0 -1
  38. package/dist/chunks/cli-handler-IJ2PNNTK.mjs +0 -1
  39. package/dist/chunks/code-base-6TM7JDJ6.cjs +0 -1
  40. package/dist/chunks/code-base-BSRUQYXN.mjs +0 -1
  41. package/dist/chunks/database-manager-26PY6VTD.mjs +0 -1
  42. package/dist/chunks/database-manager-U7D7QIHC.cjs +0 -1
  43. package/dist/chunks/file-watcher-GHRFHOQF.cjs +0 -1
  44. package/dist/chunks/file-watcher-OORREWFV.mjs +0 -1
  45. package/dist/chunks/stdio-server-2GBPZY6J.cjs +0 -47
  46. package/dist/chunks/stdio-server-BZYPM34X.mjs +0 -47
  47. /package/dist/chunks/{chunk-TMICZT3L.mjs → chunk-2YMB6W5S.mjs} +0 -0
  48. /package/dist/chunks/{chunk-NVGACA7W.cjs → chunk-M2YU5LAI.cjs} +0 -0
@@ -1 +1 @@
1
- 'use strict';var chunkVPWALTY7_cjs=require('./chunk-VPWALTY7.cjs');require('./chunk-NVGACA7W.cjs');Object.defineProperty(exports,"Llm",{enumerable:true,get:function(){return chunkVPWALTY7_cjs.a}});Object.defineProperty(exports,"llm",{enumerable:true,get:function(){return chunkVPWALTY7_cjs.b}});
1
+ 'use strict';var chunkVPWALTY7_cjs=require('./chunk-VPWALTY7.cjs');require('./chunk-M2YU5LAI.cjs');Object.defineProperty(exports,"Llm",{enumerable:true,get:function(){return chunkVPWALTY7_cjs.a}});Object.defineProperty(exports,"llm",{enumerable:true,get:function(){return chunkVPWALTY7_cjs.b}});
@@ -0,0 +1,47 @@
1
+ 'use strict';var chunkVF3U3DPM_cjs=require('./chunk-VF3U3DPM.cjs');require('./chunk-ZK7YSBLG.cjs'),require('./chunk-JVX6PHPN.cjs'),require('./chunk-ZCH5GLXA.cjs'),require('./chunk-VPWALTY7.cjs'),require('./chunk-M2YU5LAI.cjs');var mcp=require('@easbot/mcp'),utils=require('@easbot/utils');var g=utils.Log.create({service:"codebase-mcp-stdio"}),G=["query","node","context","impact","callers","callees","explore","status","doctor"];exports.CodebaseStdioServer=void 0;(t=>{let o;function r(){return o||(g.debug("initializing CodebaseStdioServer state factory (lazy)"),o=()=>({toolNames:[...G],cachedConfigId:"",cachedConfigName:"",cachedConfigVersion:""})),o}async function a(n,s){let i=r()(),f=(process.env.EASBOT_MCP_TRUSTED_LOCAL??"true").toLowerCase()!=="false",u=new mcp.ToolRegistry;le(u,n,f);let y=i.toolNames;g.info("starting codebase MCP stdio server",{id:s.id,name:s.name,toolCount:y.length});let h=await mcp.createAndStartStdioServer(s,u),x=null,q=new Promise(c=>{x=c;}),S=c=>{g.info("received signal, stopping MCP server",{signal:c}),x?.();},T=()=>S("SIGINT"),E=()=>S("SIGTERM");process.on("SIGINT",T),process.on("SIGTERM",E);try{await q;}finally{try{process.off("SIGINT",T),process.off("SIGTERM",E);}catch(c){g.warn("failed to remove signal handlers",{error:c instanceof Error?c.message:String(c)});}try{await h.stop();}catch(c){g.warn("server.stop failed during cleanup",{error:c instanceof Error?c.message:String(c)});}try{await n.close();}catch(c){g.warn("codebase.close failed during cleanup",{error:c instanceof Error?c.message:String(c)});}}return {id:s.id,name:s.name,version:s.version,tools:y}}t.start=a;function l(){return r()().toolNames}t.getToolNames=l;function e(){o=void 0;}t.__resetForTests=e;})(exports.CodebaseStdioServer||(exports.CodebaseStdioServer={}));var Q={readOnlyHint:true,destructiveHint:false,idempotentHint:true,openWorldHint:false},X={type:"object",properties:{query:{type:"string",description:'Symbol name or partial name (e.g., "auth", "UserService"). Empty string returns recent nodes.'},kind:{type:"string",description:"Filter by node kind. One of: class, function, method, interface, type, variable, route, component, const.",enum:["class","function","method","interface","type","variable","route","component","const"]},file:{type:"string",description:'Filter by file path (substring match, e.g., "src/auth").'},intent:{type:"string",description:'LLM context for ranking (e.g., "adding OAuth support").'},includeContent:{type:"boolean",description:"Include source code snippets (default false; use `explore` for full code).",default:false},maxResults:{type:"number",description:"Maximum results",default:10,minimum:1,maximum:100},language:{type:"string",description:"Filter by programming language",enum:["ts","tsx","js","py","rs","go","c","cpp","csharp","java","scala","ruby","php","zig"]},astType:{type:"string",description:"Filter by AST node type (more specific than kind)."}},required:[]},V={type:"object",properties:{name:{type:"string",description:'Symbol name (e.g., "AuthService"). Recommended \u2014 LLM workflow: query \u2192 use returned name.'},nodeId:{type:"string",description:"Node ID (direct lookup, zero ambiguity)."},file:{type:"string",description:"File path or basename to disambiguate when multiple same-named symbols exist."},kind:{type:"string",description:"Filter by node kind (class, function, method, interface, type, variable, route, component, const)."},includeContent:{type:"boolean",description:"Include source code body (default true).",default:true},includeEdges:{type:"boolean",description:"Include edge listing (incoming + outgoing).",default:true},edgesLimit:{type:"number",description:"Max edges to return (default 50).",default:50}},required:[]},z={type:"object",properties:{name:{type:"string",description:"Symbol name \u2014 LLM workflow friendly."},nodeId:{type:"string",description:"Node ID (direct lookup)."},file:{type:"string",description:"File path or basename to disambiguate."},kind:{type:"string",description:"Filter by node kind in BFS result."},depth:{type:"number",description:"BFS depth (1 = direct only, 2 = default, 3 = max).",default:2,minimum:1,maximum:3},maxNodes:{type:"number",description:"Max nodes in result.",default:100,minimum:1,maximum:500},direction:{type:"string",description:"Edge direction filter",enum:["incoming","outgoing","both"],default:"both"}},required:[]},K={type:"object",properties:{name:{type:"string",description:"Symbol name \u2014 LLM workflow friendly."},nodeId:{type:"string",description:"Node ID (direct lookup)."},file:{type:"string",description:"File path or basename to disambiguate."},kind:{type:"string",description:"Filter by node kind in BFS result."},depth:{type:"number",description:"Max BFS depth (1-3).",default:2,minimum:1,maximum:3},maxResults:{type:"number",description:"Max affected symbols.",default:50,minimum:1,maximum:200}},required:[]},P={type:"object",properties:{name:{type:"string",description:"Symbol name to find callers for."},nodeId:{type:"string",description:"Node ID (direct lookup)."},file:{type:"string",description:"File path or basename to disambiguate."},kind:{type:"string",description:"Filter by node kind."},maxResults:{type:"number",description:"Max callers to return.",default:20,minimum:1,maximum:200}},required:[]},J=P,Z={type:"object",properties:{query:{type:"string",description:'Symbol name or natural language query (e.g., "auth flow", "MemorySystem").'},file:{type:"string",description:"File path or basename to disambiguate."},kind:{type:"string",description:"Filter by node kind."},maxFiles:{type:"number",description:"Max entry-point files.",default:5,minimum:1,maximum:20},maxSymbols:{type:"number",description:"Max symbols per file.",default:3,minimum:1,maximum:10},depth:{type:"number",description:"Neighbor depth for callers/callees (default 1).",default:1,minimum:1,maximum:2},includeContent:{type:"boolean",description:"Include source code body (default true).",default:true},intent:{type:"string",description:"LLM context for ranking."}},required:["query"]},D={type:"object",properties:{}},ee={query:'Hybrid search over indexed code nodes (FTS + vector + basic + name-segment). Returns symbol locations grouped by file with line-numbered snippets.\n\nWHEN TO USE: Quick lookup of "where is X defined?" \u2014 get symbol locations and snippets in one call. Use `context` to understand a symbol\'s surroundings; use `impact` to see blast radius; use `explore` to get the actual source.\n\nAFTER THIS: Use `node <name>` to fetch full details of one match; use `context` to walk neighbors; use `explore` to get source code.\n\nNOTES: Default FTS-only (fast). Pass `includeContent: true` to include code snippets in results. Use `kind` for friendlier semantic filter (class/function/method/...) instead of `astType`.',node:"Show details for a single symbol: kind, language, location, modifiers, source code, edges.\n\nWHEN TO USE: After `query` / `context` returns a list \u2014 fetch one match's full metadata and edge summary. Pass `name` (preferred) or `nodeId`.\n\nAFTER THIS: Use `context` to walk neighbors; use `impact` for blast radius; use `explore` to get source code + caller/callee trail.\n\nNOTES: `name` is the LLM-friendly input. `file` / `kind` disambiguate when multiple same-named symbols exist. Source code is included by default (set `includeContent: false` for metadata only).",context:"Build a sub-graph around a symbol (BFS to N-level neighbors). Returns incoming/outgoing edges and neighbor nodes grouped by depth.\n\nWHEN TO USE: Understand a symbol's surroundings \u2014 who calls it, what it calls, who extends it. Use after `query` / `node` to get the symbol.\n\nAFTER THIS: Use `impact` for blast-radius (callers only, deeper depth). Use `callers` / `callees` for a flat list. Use `query` to find related symbols.\n\nNOTES: `name` is the LLM-friendly input. Does NOT include source code (use `explore` for code). Set `direction` to narrow to incoming/outgoing only.",impact:"Blast radius of changing a symbol: BFS incoming edges (CALLS / IMPORTS / TYPE_REFERENCES), bucketed by depth. d=1 (WILL BREAK) / d=2 (LIKELY AFFECTED) / d=3 (MAY NEED TESTING).\n\nWHEN TO USE: Before refactoring a symbol \u2014 see what depends on it. Use after `query` to get the symbol.\n\nAFTER THIS: Review d=1 first (those WILL BREAK). Use `node <name>` on high-risk nodes to read their source.\n\nNOTES: `name` is the LLM-friendly input. Returns counts per depth bucket, not full lists. For flat caller list, use `callers`.",callers:'Flat list of who calls <symbol> (incoming CALLS / IMPORTS / TYPE_REFERENCES / EXTENDS / IMPLEMENTS / METHOD_OVERRIDES).\n\nWHEN TO USE: Quick "who depends on this?" lookup. Use `impact` for bucketed risk analysis; use `context` for both directions.\n\nAFTER THIS: Use `node <name>` on a high-traffic caller to read its source.\n\nNOTES: `name` is the LLM-friendly input. Returns up to `maxResults` callers (default 20). Use `file` / `kind` to disambiguate.',callees:'Flat list of what <symbol> calls (outgoing CALLS / IMPORTS / TYPE_REFERENCES / EXTENDS / IMPLEMENTS).\n\nWHEN TO USE: Quick "what does this function do?" lookup. Use `context` for both directions.\n\nAFTER THIS: Use `node <name>` on a key callee to read its source.\n\nNOTES: `name` is the LLM-friendly input. Returns up to `maxResults` callees (default 20). Use `file` / `kind` to disambiguate.',explore:"**PRIMARY TOOL \u2014 call FIRST** for almost any question OR before an edit: how does X work, architecture, a bug, where/what is X, surveying an area, or symbols you are about to change.\n\nReturns verbatim source of relevant symbols grouped by file in ONE capped call (Read-equivalent \u2014 treat shown source as already Read; do NOT re-open those files), plus caller/callee trail.\n\nWHEN TO USE: Whenever you need to understand an area of the codebase or before refactoring. Query can be a symbol name or natural language.\n\nAFTER THIS: Use `node <name>` for metadata only; use `impact` for blast-radius; use `callers` / `callees` for flat lists.\n\nNOTES: Usually the ONLY call you need \u2014 more accurate context, in far fewer tokens and round-trips than search/Read/Grep loop. The single most cost-effective tool.",status:`Show index state, db path, node/edge counts, indexed files, meta config.
2
+
3
+ WHEN TO USE: Diagnostic only \u2014 check whether the index is up-to-date or stale. Skip unless debugging.
4
+
5
+ AFTER THIS: If index is stale, run \`easbot codebase sync\` from CLI; \`doctor\` for deeper health check.
6
+
7
+ NOTES: Read-only. Output is a structured markdown summary.`,doctor:`Run health checks: db connection, FTS availability, parser status, node/edge counts.
8
+
9
+ WHEN TO USE: Diagnostic only \u2014 check why queries return empty or fail. Skip unless debugging.
10
+
11
+ AFTER THIS: If unhealthy, fix the reported issue (usually run \`easbot codebase index\` from CLI).
12
+
13
+ NOTES: Read-only. Returns healthy/unhealthy + a list of issues.`};function d(o,r=false){return {content:[{type:"text",text:o}],...r&&{isError:true}}}function m(o){return {workspaceDir:o.getWorkspaceDir?.()??process.cwd(),rootDir:o.getWorkspaceDir?.()??process.cwd()}}function p(o,r,a){if(o instanceof chunkVF3U3DPM_cjs.b)return `**${r}** \u2014 node not found. Try \`query\` first to discover the symbol.`;if(o instanceof chunkVF3U3DPM_cjs.c){let l=o.details?.candidates??[],e=l.slice(0,5).map(t=>`- \`${t.node.name}\` in \`${t.node.file_path}\``).join(`
14
+ `);return `**${r}** \u2014 ambiguous name. Specify \`file\` to disambiguate:
15
+
16
+ ${e}
17
+
18
+ ... and ${l.length-5} more candidates.`}return mcp.formatFailClosed(o,a)}function te(o,r){return async(a,l)=>{let e=a;try{let t=m(o),n=await chunkVF3U3DPM_cjs.d(t,{query:e.query,kind:e.kind,file:e.file,intent:e.intent,includeContent:e.includeContent??!1,maxResults:e.maxResults??10,language:e.language,astType:e.astType}),s=await chunkVF3U3DPM_cjs.z(n.hits,{pendingFiles:[],toolName:"query",writeToDisk:!1});return d(s)}catch(t){return d(p(t,"query",r),true)}}}function ne(o,r){return async(a,l)=>{let e=a;try{let t=m(o),n=await chunkVF3U3DPM_cjs.e(t,{name:e.name,nodeId:e.nodeId,file:e.file,kind:e.kind,includeEdges:e.includeEdges??!0,includeContent:e.includeContent??!0,edgesLimit:e.edgesLimit??50}),s=await chunkVF3U3DPM_cjs.C(n.node,n.edges,{pendingFiles:[],toolName:"node",writeToDisk:!1});return d(s)}catch(t){return d(p(t,"node",r),true)}}}function oe(o,r){return async(a,l)=>{let e=a;try{let t=m(o),n=await chunkVF3U3DPM_cjs.f(t,{name:e.name,nodeId:e.nodeId,file:e.file,kind:e.kind,depth:e.depth??2,maxNodes:e.maxNodes??100,direction:e.direction??"both"});if(!n.root)return d("**context** \u2014 node not found.");let s=[],i=[];for(let u of n.edges)u.target===n.root.id?s.push(u):i.push(u);let f=await chunkVF3U3DPM_cjs.B(n.root,s,i,n.nodes.map(u=>u.node),{pendingFiles:[],toolName:"context",writeToDisk:!1});return d(f)}catch(t){return d(p(t,"context",r),true)}}}function se(o,r){return async(a,l)=>{let e=a;try{let t=m(o),n=await chunkVF3U3DPM_cjs.g(t,{name:e.name,nodeId:e.nodeId,file:e.file,kind:e.kind,depth:e.depth??2,maxResults:e.maxResults??50});if(!n.root)return d("**impact** \u2014 node not found.");let s=[],i=o.getDatabase();for(let u of n.buckets)for(let y of u.sample){let h=i.getNodeById(y.id);h&&s.push({source:h,relation:y.relation});}let f=await chunkVF3U3DPM_cjs.A(n.root,s,{pendingFiles:[],toolName:"impact",writeToDisk:!1});return d(f)}catch(t){return d(p(t,"impact",r),true)}}}function re(o,r){return async(a,l)=>{let e=a;try{let t=m(o),n=await chunkVF3U3DPM_cjs.h(t,{name:e.name,nodeId:e.nodeId,file:e.file,kind:e.kind,maxResults:e.maxResults??20}),s=[];s.push(`**Callers of \`${n.root?.name??"?"}\`** (${n.callers.length}${n.truncated?"+":""})
19
+ `);for(let i of n.callers)s.push(`- [${i.relation}] \`${i.name}\` ${i.filePath}:${i.startLine}`);return n.callers.length===0&&s.push("(no incoming edges)"),s.push("\n---\n> Use `node <name>` to read full source of any caller."),d(s.join(`
20
+ `))}catch(t){return d(p(t,"callers",r),true)}}}function ae(o,r){return async(a,l)=>{let e=a;try{let t=m(o),n=await chunkVF3U3DPM_cjs.i(t,{name:e.name,nodeId:e.nodeId,file:e.file,kind:e.kind,maxResults:e.maxResults??20}),s=[];s.push(`**Callees of \`${n.root?.name??"?"}\`** (${n.callees.length}${n.truncated?"+":""})
21
+ `);for(let i of n.callees)s.push(`- [${i.relation}] \`${i.name}\` ${i.filePath}:${i.startLine}`);return n.callees.length===0&&s.push("(no outgoing edges)"),s.push("\n---\n> Use `node <name>` to read full source of any callee."),d(s.join(`
22
+ `))}catch(t){return d(p(t,"callees",r),true)}}}function ie(o,r){return async(a,l)=>{let e=a;try{let t=m(o),n=await chunkVF3U3DPM_cjs.j(t,{query:e.query,file:e.file,kind:e.kind,maxFiles:e.maxFiles??5,maxSymbols:e.maxSymbols??3,depth:e.depth??1,includeContent:e.includeContent??!0,intent:e.intent}),s=await chunkVF3U3DPM_cjs.D(n,{pendingFiles:[],toolName:"explore",writeToDisk:!1});return d(s)}catch(t){return d(p(t,"explore",r),true)}}}function de(o,r){return async(a,l)=>{try{let e=m(o),t=await chunkVF3U3DPM_cjs.k(e,{}),n=t.workspaceDir,s=t.meta.indexed_with_version??"unknown",i=t.meta.lastSync??"never",f=`**Codebase Status**
23
+
24
+ - DB path: \`${t.dbPath}\`
25
+ - Workspace: \`${n}\`
26
+ - Nodes: ${t.nodeCount}
27
+ - Edges: ${t.edgeCount}
28
+ - Indexed files: ${t.indexedFiles}
29
+ - Index state: \`${t.indexState??"unknown"}\`
30
+ - Extraction version: ${t.extractionVersion??"unknown"}
31
+ - Indexed with version: ${s}
32
+ - Last sync: ${i}
33
+ - Stale: ${t.isStale?"\u26A0\uFE0F yes (extraction_version mismatch)":"no"}
34
+
35
+ > Use \`doctor\` for deeper health check.`;return d(f)}catch(e){return d(p(e,"status",r),true)}}}function ce(o,r){return async(a,l)=>{try{let e=m(o),t=await chunkVF3U3DPM_cjs.l(e,{}),n=await chunkVF3U3DPM_cjs.k(e,{}),s=`**Codebase Health Check**
36
+
37
+ - Healthy: ${t.healthy?"\u2713 yes":"\u2717 no"}
38
+ - Nodes: ${n.nodeCount}
39
+ - Edges: ${n.edgeCount}
40
+ - Indexed files: ${n.indexedFiles}
41
+ - DB path: \`${n.dbPath}\`
42
+ - FTS available: ${t.ftsAvailable}
43
+
44
+ ${t.issues.length>0?`**Issues:**
45
+ ${t.issues.map(i=>`- ${i}`).join(`
46
+ `)}
47
+ `:""}> ${t.healthy?"Index is healthy. Use `query` to search.":"Index has issues. Check status details above."}`;return d(s)}catch(e){return d(p(e,"doctor",r),true)}}}function le(o,r,a){let l=[{name:"query",schema:X,factory:te},{name:"node",schema:V,factory:ne},{name:"context",schema:z,factory:oe},{name:"impact",schema:K,factory:se},{name:"callers",schema:P,factory:re},{name:"callees",schema:J,factory:ae},{name:"explore",schema:Z,factory:ie},{name:"status",schema:D,factory:de},{name:"doctor",schema:D,factory:ce}];for(let e of l)o.register({name:e.name,description:ee[e.name]??"",inputSchema:e.schema,annotations:Q,handler:e.factory(r,a)});}
@@ -0,0 +1,47 @@
1
+ import {d as d$1,z as z$1,e,C,f,B,g as g$1,A,h,i,j,D as D$1,k,l,b,c}from'./chunk-2DGOSNEH.mjs';import'./chunk-22NIJF4D.mjs';import'./chunk-34CU2EU4.mjs';import'./chunk-T2ZV7FU4.mjs';import'./chunk-GWCRGM4D.mjs';import'./chunk-2YMB6W5S.mjs';import {ToolRegistry,createAndStartStdioServer,formatFailClosed}from'@easbot/mcp';import {Log}from'@easbot/utils';var g=Log.create({service:"codebase-mcp-stdio"}),G=["query","node","context","impact","callers","callees","explore","status","doctor"],$;(t=>{let o;function r(){return o||(g.debug("initializing CodebaseStdioServer state factory (lazy)"),o=()=>({toolNames:[...G],cachedConfigId:"",cachedConfigName:"",cachedConfigVersion:""})),o}async function a(n,s){let i=r()(),f=(process.env.EASBOT_MCP_TRUSTED_LOCAL??"true").toLowerCase()!=="false",u=new ToolRegistry;le(u,n,f);let y=i.toolNames;g.info("starting codebase MCP stdio server",{id:s.id,name:s.name,toolCount:y.length});let h=await createAndStartStdioServer(s,u),x=null,q=new Promise(c=>{x=c;}),S=c=>{g.info("received signal, stopping MCP server",{signal:c}),x?.();},T=()=>S("SIGINT"),E=()=>S("SIGTERM");process.on("SIGINT",T),process.on("SIGTERM",E);try{await q;}finally{try{process.off("SIGINT",T),process.off("SIGTERM",E);}catch(c){g.warn("failed to remove signal handlers",{error:c instanceof Error?c.message:String(c)});}try{await h.stop();}catch(c){g.warn("server.stop failed during cleanup",{error:c instanceof Error?c.message:String(c)});}try{await n.close();}catch(c){g.warn("codebase.close failed during cleanup",{error:c instanceof Error?c.message:String(c)});}}return {id:s.id,name:s.name,version:s.version,tools:y}}t.start=a;function l(){return r()().toolNames}t.getToolNames=l;function e(){o=void 0;}t.__resetForTests=e;})($||($={}));var Q={readOnlyHint:true,destructiveHint:false,idempotentHint:true,openWorldHint:false},X={type:"object",properties:{query:{type:"string",description:'Symbol name or partial name (e.g., "auth", "UserService"). Empty string returns recent nodes.'},kind:{type:"string",description:"Filter by node kind. One of: class, function, method, interface, type, variable, route, component, const.",enum:["class","function","method","interface","type","variable","route","component","const"]},file:{type:"string",description:'Filter by file path (substring match, e.g., "src/auth").'},intent:{type:"string",description:'LLM context for ranking (e.g., "adding OAuth support").'},includeContent:{type:"boolean",description:"Include source code snippets (default false; use `explore` for full code).",default:false},maxResults:{type:"number",description:"Maximum results",default:10,minimum:1,maximum:100},language:{type:"string",description:"Filter by programming language",enum:["ts","tsx","js","py","rs","go","c","cpp","csharp","java","scala","ruby","php","zig"]},astType:{type:"string",description:"Filter by AST node type (more specific than kind)."}},required:[]},V={type:"object",properties:{name:{type:"string",description:'Symbol name (e.g., "AuthService"). Recommended \u2014 LLM workflow: query \u2192 use returned name.'},nodeId:{type:"string",description:"Node ID (direct lookup, zero ambiguity)."},file:{type:"string",description:"File path or basename to disambiguate when multiple same-named symbols exist."},kind:{type:"string",description:"Filter by node kind (class, function, method, interface, type, variable, route, component, const)."},includeContent:{type:"boolean",description:"Include source code body (default true).",default:true},includeEdges:{type:"boolean",description:"Include edge listing (incoming + outgoing).",default:true},edgesLimit:{type:"number",description:"Max edges to return (default 50).",default:50}},required:[]},z={type:"object",properties:{name:{type:"string",description:"Symbol name \u2014 LLM workflow friendly."},nodeId:{type:"string",description:"Node ID (direct lookup)."},file:{type:"string",description:"File path or basename to disambiguate."},kind:{type:"string",description:"Filter by node kind in BFS result."},depth:{type:"number",description:"BFS depth (1 = direct only, 2 = default, 3 = max).",default:2,minimum:1,maximum:3},maxNodes:{type:"number",description:"Max nodes in result.",default:100,minimum:1,maximum:500},direction:{type:"string",description:"Edge direction filter",enum:["incoming","outgoing","both"],default:"both"}},required:[]},K={type:"object",properties:{name:{type:"string",description:"Symbol name \u2014 LLM workflow friendly."},nodeId:{type:"string",description:"Node ID (direct lookup)."},file:{type:"string",description:"File path or basename to disambiguate."},kind:{type:"string",description:"Filter by node kind in BFS result."},depth:{type:"number",description:"Max BFS depth (1-3).",default:2,minimum:1,maximum:3},maxResults:{type:"number",description:"Max affected symbols.",default:50,minimum:1,maximum:200}},required:[]},P={type:"object",properties:{name:{type:"string",description:"Symbol name to find callers for."},nodeId:{type:"string",description:"Node ID (direct lookup)."},file:{type:"string",description:"File path or basename to disambiguate."},kind:{type:"string",description:"Filter by node kind."},maxResults:{type:"number",description:"Max callers to return.",default:20,minimum:1,maximum:200}},required:[]},J=P,Z={type:"object",properties:{query:{type:"string",description:'Symbol name or natural language query (e.g., "auth flow", "MemorySystem").'},file:{type:"string",description:"File path or basename to disambiguate."},kind:{type:"string",description:"Filter by node kind."},maxFiles:{type:"number",description:"Max entry-point files.",default:5,minimum:1,maximum:20},maxSymbols:{type:"number",description:"Max symbols per file.",default:3,minimum:1,maximum:10},depth:{type:"number",description:"Neighbor depth for callers/callees (default 1).",default:1,minimum:1,maximum:2},includeContent:{type:"boolean",description:"Include source code body (default true).",default:true},intent:{type:"string",description:"LLM context for ranking."}},required:["query"]},D={type:"object",properties:{}},ee={query:'Hybrid search over indexed code nodes (FTS + vector + basic + name-segment). Returns symbol locations grouped by file with line-numbered snippets.\n\nWHEN TO USE: Quick lookup of "where is X defined?" \u2014 get symbol locations and snippets in one call. Use `context` to understand a symbol\'s surroundings; use `impact` to see blast radius; use `explore` to get the actual source.\n\nAFTER THIS: Use `node <name>` to fetch full details of one match; use `context` to walk neighbors; use `explore` to get source code.\n\nNOTES: Default FTS-only (fast). Pass `includeContent: true` to include code snippets in results. Use `kind` for friendlier semantic filter (class/function/method/...) instead of `astType`.',node:"Show details for a single symbol: kind, language, location, modifiers, source code, edges.\n\nWHEN TO USE: After `query` / `context` returns a list \u2014 fetch one match's full metadata and edge summary. Pass `name` (preferred) or `nodeId`.\n\nAFTER THIS: Use `context` to walk neighbors; use `impact` for blast radius; use `explore` to get source code + caller/callee trail.\n\nNOTES: `name` is the LLM-friendly input. `file` / `kind` disambiguate when multiple same-named symbols exist. Source code is included by default (set `includeContent: false` for metadata only).",context:"Build a sub-graph around a symbol (BFS to N-level neighbors). Returns incoming/outgoing edges and neighbor nodes grouped by depth.\n\nWHEN TO USE: Understand a symbol's surroundings \u2014 who calls it, what it calls, who extends it. Use after `query` / `node` to get the symbol.\n\nAFTER THIS: Use `impact` for blast-radius (callers only, deeper depth). Use `callers` / `callees` for a flat list. Use `query` to find related symbols.\n\nNOTES: `name` is the LLM-friendly input. Does NOT include source code (use `explore` for code). Set `direction` to narrow to incoming/outgoing only.",impact:"Blast radius of changing a symbol: BFS incoming edges (CALLS / IMPORTS / TYPE_REFERENCES), bucketed by depth. d=1 (WILL BREAK) / d=2 (LIKELY AFFECTED) / d=3 (MAY NEED TESTING).\n\nWHEN TO USE: Before refactoring a symbol \u2014 see what depends on it. Use after `query` to get the symbol.\n\nAFTER THIS: Review d=1 first (those WILL BREAK). Use `node <name>` on high-risk nodes to read their source.\n\nNOTES: `name` is the LLM-friendly input. Returns counts per depth bucket, not full lists. For flat caller list, use `callers`.",callers:'Flat list of who calls <symbol> (incoming CALLS / IMPORTS / TYPE_REFERENCES / EXTENDS / IMPLEMENTS / METHOD_OVERRIDES).\n\nWHEN TO USE: Quick "who depends on this?" lookup. Use `impact` for bucketed risk analysis; use `context` for both directions.\n\nAFTER THIS: Use `node <name>` on a high-traffic caller to read its source.\n\nNOTES: `name` is the LLM-friendly input. Returns up to `maxResults` callers (default 20). Use `file` / `kind` to disambiguate.',callees:'Flat list of what <symbol> calls (outgoing CALLS / IMPORTS / TYPE_REFERENCES / EXTENDS / IMPLEMENTS).\n\nWHEN TO USE: Quick "what does this function do?" lookup. Use `context` for both directions.\n\nAFTER THIS: Use `node <name>` on a key callee to read its source.\n\nNOTES: `name` is the LLM-friendly input. Returns up to `maxResults` callees (default 20). Use `file` / `kind` to disambiguate.',explore:"**PRIMARY TOOL \u2014 call FIRST** for almost any question OR before an edit: how does X work, architecture, a bug, where/what is X, surveying an area, or symbols you are about to change.\n\nReturns verbatim source of relevant symbols grouped by file in ONE capped call (Read-equivalent \u2014 treat shown source as already Read; do NOT re-open those files), plus caller/callee trail.\n\nWHEN TO USE: Whenever you need to understand an area of the codebase or before refactoring. Query can be a symbol name or natural language.\n\nAFTER THIS: Use `node <name>` for metadata only; use `impact` for blast-radius; use `callers` / `callees` for flat lists.\n\nNOTES: Usually the ONLY call you need \u2014 more accurate context, in far fewer tokens and round-trips than search/Read/Grep loop. The single most cost-effective tool.",status:`Show index state, db path, node/edge counts, indexed files, meta config.
2
+
3
+ WHEN TO USE: Diagnostic only \u2014 check whether the index is up-to-date or stale. Skip unless debugging.
4
+
5
+ AFTER THIS: If index is stale, run \`easbot codebase sync\` from CLI; \`doctor\` for deeper health check.
6
+
7
+ NOTES: Read-only. Output is a structured markdown summary.`,doctor:`Run health checks: db connection, FTS availability, parser status, node/edge counts.
8
+
9
+ WHEN TO USE: Diagnostic only \u2014 check why queries return empty or fail. Skip unless debugging.
10
+
11
+ AFTER THIS: If unhealthy, fix the reported issue (usually run \`easbot codebase index\` from CLI).
12
+
13
+ NOTES: Read-only. Returns healthy/unhealthy + a list of issues.`};function d(o,r=false){return {content:[{type:"text",text:o}],...r&&{isError:true}}}function m(o){return {workspaceDir:o.getWorkspaceDir?.()??process.cwd(),rootDir:o.getWorkspaceDir?.()??process.cwd()}}function p(o,r,a){if(o instanceof b)return `**${r}** \u2014 node not found. Try \`query\` first to discover the symbol.`;if(o instanceof c){let l=o.details?.candidates??[],e=l.slice(0,5).map(t=>`- \`${t.node.name}\` in \`${t.node.file_path}\``).join(`
14
+ `);return `**${r}** \u2014 ambiguous name. Specify \`file\` to disambiguate:
15
+
16
+ ${e}
17
+
18
+ ... and ${l.length-5} more candidates.`}return formatFailClosed(o,a)}function te(o,r){return async(a,l)=>{let e=a;try{let t=m(o),n=await d$1(t,{query:e.query,kind:e.kind,file:e.file,intent:e.intent,includeContent:e.includeContent??!1,maxResults:e.maxResults??10,language:e.language,astType:e.astType}),s=await z$1(n.hits,{pendingFiles:[],toolName:"query",writeToDisk:!1});return d(s)}catch(t){return d(p(t,"query",r),true)}}}function ne(o,r){return async(a,l)=>{let e$1=a;try{let t=m(o),n=await e(t,{name:e$1.name,nodeId:e$1.nodeId,file:e$1.file,kind:e$1.kind,includeEdges:e$1.includeEdges??!0,includeContent:e$1.includeContent??!0,edgesLimit:e$1.edgesLimit??50}),s=await C(n.node,n.edges,{pendingFiles:[],toolName:"node",writeToDisk:!1});return d(s)}catch(t){return d(p(t,"node",r),true)}}}function oe(o,r){return async(a,l)=>{let e=a;try{let t=m(o),n=await f(t,{name:e.name,nodeId:e.nodeId,file:e.file,kind:e.kind,depth:e.depth??2,maxNodes:e.maxNodes??100,direction:e.direction??"both"});if(!n.root)return d("**context** \u2014 node not found.");let s=[],i=[];for(let u of n.edges)u.target===n.root.id?s.push(u):i.push(u);let f$1=await B(n.root,s,i,n.nodes.map(u=>u.node),{pendingFiles:[],toolName:"context",writeToDisk:!1});return d(f$1)}catch(t){return d(p(t,"context",r),true)}}}function se(o,r){return async(a,l)=>{let e=a;try{let t=m(o),n=await g$1(t,{name:e.name,nodeId:e.nodeId,file:e.file,kind:e.kind,depth:e.depth??2,maxResults:e.maxResults??50});if(!n.root)return d("**impact** \u2014 node not found.");let s=[],i=o.getDatabase();for(let u of n.buckets)for(let y of u.sample){let h=i.getNodeById(y.id);h&&s.push({source:h,relation:y.relation});}let f=await A(n.root,s,{pendingFiles:[],toolName:"impact",writeToDisk:!1});return d(f)}catch(t){return d(p(t,"impact",r),true)}}}function re(o,r){return async(a,l)=>{let e=a;try{let t=m(o),n=await h(t,{name:e.name,nodeId:e.nodeId,file:e.file,kind:e.kind,maxResults:e.maxResults??20}),s=[];s.push(`**Callers of \`${n.root?.name??"?"}\`** (${n.callers.length}${n.truncated?"+":""})
19
+ `);for(let i of n.callers)s.push(`- [${i.relation}] \`${i.name}\` ${i.filePath}:${i.startLine}`);return n.callers.length===0&&s.push("(no incoming edges)"),s.push("\n---\n> Use `node <name>` to read full source of any caller."),d(s.join(`
20
+ `))}catch(t){return d(p(t,"callers",r),true)}}}function ae(o,r){return async(a,l)=>{let e=a;try{let t=m(o),n=await i(t,{name:e.name,nodeId:e.nodeId,file:e.file,kind:e.kind,maxResults:e.maxResults??20}),s=[];s.push(`**Callees of \`${n.root?.name??"?"}\`** (${n.callees.length}${n.truncated?"+":""})
21
+ `);for(let i of n.callees)s.push(`- [${i.relation}] \`${i.name}\` ${i.filePath}:${i.startLine}`);return n.callees.length===0&&s.push("(no outgoing edges)"),s.push("\n---\n> Use `node <name>` to read full source of any callee."),d(s.join(`
22
+ `))}catch(t){return d(p(t,"callees",r),true)}}}function ie(o,r){return async(a,l)=>{let e=a;try{let t=m(o),n=await j(t,{query:e.query,file:e.file,kind:e.kind,maxFiles:e.maxFiles??5,maxSymbols:e.maxSymbols??3,depth:e.depth??1,includeContent:e.includeContent??!0,intent:e.intent}),s=await D$1(n,{pendingFiles:[],toolName:"explore",writeToDisk:!1});return d(s)}catch(t){return d(p(t,"explore",r),true)}}}function de(o,r){return async(a,l)=>{try{let e=m(o),t=await k(e,{}),n=t.workspaceDir,s=t.meta.indexed_with_version??"unknown",i=t.meta.lastSync??"never",f=`**Codebase Status**
23
+
24
+ - DB path: \`${t.dbPath}\`
25
+ - Workspace: \`${n}\`
26
+ - Nodes: ${t.nodeCount}
27
+ - Edges: ${t.edgeCount}
28
+ - Indexed files: ${t.indexedFiles}
29
+ - Index state: \`${t.indexState??"unknown"}\`
30
+ - Extraction version: ${t.extractionVersion??"unknown"}
31
+ - Indexed with version: ${s}
32
+ - Last sync: ${i}
33
+ - Stale: ${t.isStale?"\u26A0\uFE0F yes (extraction_version mismatch)":"no"}
34
+
35
+ > Use \`doctor\` for deeper health check.`;return d(f)}catch(e){return d(p(e,"status",r),true)}}}function ce(o,r){return async(a,l$1)=>{try{let e=m(o),t=await l(e,{}),n=await k(e,{}),s=`**Codebase Health Check**
36
+
37
+ - Healthy: ${t.healthy?"\u2713 yes":"\u2717 no"}
38
+ - Nodes: ${n.nodeCount}
39
+ - Edges: ${n.edgeCount}
40
+ - Indexed files: ${n.indexedFiles}
41
+ - DB path: \`${n.dbPath}\`
42
+ - FTS available: ${t.ftsAvailable}
43
+
44
+ ${t.issues.length>0?`**Issues:**
45
+ ${t.issues.map(i=>`- ${i}`).join(`
46
+ `)}
47
+ `:""}> ${t.healthy?"Index is healthy. Use `query` to search.":"Index has issues. Check status details above."}`;return d(s)}catch(e){return d(p(e,"doctor",r),true)}}}function le(o,r,a){let l=[{name:"query",schema:X,factory:te},{name:"node",schema:V,factory:ne},{name:"context",schema:z,factory:oe},{name:"impact",schema:K,factory:se},{name:"callers",schema:P,factory:re},{name:"callees",schema:J,factory:ae},{name:"explore",schema:Z,factory:ie},{name:"status",schema:D,factory:de},{name:"doctor",schema:D,factory:ce}];for(let e of l)o.register({name:e.name,description:ee[e.name]??"",inputSchema:e.schema,annotations:Q,handler:e.factory(r,a)});}export{$ as CodebaseStdioServer};
package/dist/cli.cjs CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- 'use strict';var chunkNVGACA7W_cjs=require('./chunks/chunk-NVGACA7W.cjs'),fs=require('fs'),path=require('path'),url=require('url');var G=path.dirname(url.fileURLToPath(chunkNVGACA7W_cjs.b));function y(){try{let e=path.join(G,"..","package.json");return JSON.parse(fs.readFileSync(e,"utf-8")).version??"0.0.0"}catch{return "0.0.0"}}var d=new Set(["DEBUG","INFO","WARN","ERROR"]);function E(e){let n={logLevel:"INFO",printLogs:false,debug:false};for(let s=0;s<e.length;s++){let t=e[s];if(t)if(t==="--cwd"&&s+1<e.length){let o=e[s+1];o&&!o.startsWith("-")&&(n.cwd=o,s++);}else if(t.startsWith("--cwd="))n.cwd=t.slice(6);else if(t==="--config"&&s+1<e.length){let o=e[s+1];o&&!o.startsWith("-")&&(n.configPath=o,s++);}else if(t.startsWith("--config="))n.configPath=t.slice(9);else if(t==="--log-level"&&s+1<e.length){let o=e[s+1];if(o&&!o.startsWith("-")){let a=o.toUpperCase();d.has(a)&&(n.logLevel=a,s++);}}else if(t.startsWith("--log-level=")){let o=t.slice(12).toUpperCase();d.has(o)&&(n.logLevel=o);}else t==="--print-logs"?n.printLogs=true:t==="--debug"&&(n.debug=true);}return n}async function A(){let e=process.argv.slice(2),n=y(),{loadEnv:s}=await import('@easbot/utils');s(),process.env.EASBOT_LANG||(process.env.EASBOT_LANG="en-US");let t=E(e),{Log:o}=await import('@easbot/utils'),{getXdgData:a}=await import('./chunks/interfaces-ORRCH4XV.cjs'),h=path.join(a(),"log");if(await o.init({logDir:h,print:t.printLogs,dev:t.debug||false,level:t.logLevel}),e.length===0){let{renderBanner:l}=await import('./chunks/cli-handler-3I5JC3HY.cjs');l();return}if(e[0]==="--help"||e[0]==="-h"){let{renderHelp:l}=await import('./chunks/cli-handler-3I5JC3HY.cjs');l();return}if(e[0]==="--version"||e[0]==="-v"){console.log(n);return}let r=t.cwd??process.cwd(),{handleCodebaseCli:m}=await import('./chunks/cli-handler-3I5JC3HY.cjs'),{setInstanceAdapter:w}=await import('./chunks/interfaces-ORRCH4XV.cjs');w({directory:r,worktree:r});let{Llm:b}=await import('./chunks/llm-JQV6XWGD.cjs'),{bootstrapLlm:u,setAdapterRegistry:L}=await import('@easbot/llm'),{getGlobal:i,getInstance:c}=await import('./chunks/interfaces-ORRCH4XV.cjs');L({config:void 0,instance:{getDirectory:()=>c().directory,getWorktree:()=>c().worktree},global:{home:i().Path.home,data:i().Path.data,cache:i().Path.cache,config:i().Path.config,state:i().Path.state,log:i().Path.log,bin:i().Path.bin},installation:{getVersion:()=>n,getChannel:()=>"local",getUserAgent:()=>`easbot-codebase/${n}`}}),await u({target:b,cwd:r,subConfigPath:".easbot/codebase.json",embedding:true});let g=await m(e,{version:n,cwd:r});g.code!==0&&(process.exitCode=g.code);}A().catch(e=>{console.error(e),process.exitCode=1;}).finally(async()=>{try{let{Log:e}=await import('@easbot/utils');await e.close();}catch{}process.exit(process.exitCode??0);});
2
+ 'use strict';var chunkM2YU5LAI_cjs=require('./chunks/chunk-M2YU5LAI.cjs'),fs=require('fs'),path=require('path'),url=require('url');var G=path.dirname(url.fileURLToPath(chunkM2YU5LAI_cjs.b));function y(){try{let e=path.join(G,"..","package.json");return JSON.parse(fs.readFileSync(e,"utf-8")).version??"0.0.0"}catch{return "0.0.0"}}var d=new Set(["DEBUG","INFO","WARN","ERROR"]);function E(e){let n={logLevel:"INFO",printLogs:false,debug:false};for(let s=0;s<e.length;s++){let t=e[s];if(t)if(t==="--cwd"&&s+1<e.length){let o=e[s+1];o&&!o.startsWith("-")&&(n.cwd=o,s++);}else if(t.startsWith("--cwd="))n.cwd=t.slice(6);else if(t==="--config"&&s+1<e.length){let o=e[s+1];o&&!o.startsWith("-")&&(n.configPath=o,s++);}else if(t.startsWith("--config="))n.configPath=t.slice(9);else if(t==="--log-level"&&s+1<e.length){let o=e[s+1];if(o&&!o.startsWith("-")){let a=o.toUpperCase();d.has(a)&&(n.logLevel=a,s++);}}else if(t.startsWith("--log-level=")){let o=t.slice(12).toUpperCase();d.has(o)&&(n.logLevel=o);}else t==="--print-logs"?n.printLogs=true:t==="--debug"&&(n.debug=true);}return n}async function A(){let e=process.argv.slice(2),n=y(),{loadEnv:s}=await import('@easbot/utils');s(),process.env.EASBOT_LANG||(process.env.EASBOT_LANG="en-US");let t=E(e),{Log:o}=await import('@easbot/utils'),{getXdgData:a}=await import('./chunks/interfaces-YX56SVRQ.cjs'),h=path.join(a(),"log");if(await o.init({logDir:h,print:t.printLogs,dev:t.debug||false,level:t.logLevel}),e.length===0){let{renderBanner:l}=await import('./chunks/cli-handler-EYQH2TDL.cjs');l();return}if(e[0]==="--help"||e[0]==="-h"){let{renderHelp:l}=await import('./chunks/cli-handler-EYQH2TDL.cjs');l();return}if(e[0]==="--version"||e[0]==="-v"){console.log(n);return}let r=t.cwd??process.cwd(),{handleCodebaseCli:m}=await import('./chunks/cli-handler-EYQH2TDL.cjs'),{setInstanceAdapter:w}=await import('./chunks/interfaces-YX56SVRQ.cjs');w({directory:r,worktree:r});let{Llm:b}=await import('./chunks/llm-BDMNIGOH.cjs'),{bootstrapLlm:u,setAdapterRegistry:L}=await import('@easbot/llm'),{getGlobal:i,getInstance:c}=await import('./chunks/interfaces-YX56SVRQ.cjs');L({config:void 0,instance:{getDirectory:()=>c().directory,getWorktree:()=>c().worktree},global:{home:i().Path.home,data:i().Path.data,cache:i().Path.cache,config:i().Path.config,state:i().Path.state,log:i().Path.log,bin:i().Path.bin},installation:{getVersion:()=>n,getChannel:()=>"local",getUserAgent:()=>`easbot-codebase/${n}`}}),await u({target:b,cwd:r,subConfigPath:".easbot/codebase.json",embedding:true});let g=await m(e,{version:n,cwd:r});g.code!==0&&(process.exitCode=g.code);}A().catch(e=>{console.error(e),process.exitCode=1;}).finally(async()=>{try{let{Log:e}=await import('@easbot/utils');await e.close();}catch{}process.exit(process.exitCode??0);});
package/dist/cli.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import'./chunks/chunk-TMICZT3L.mjs';import {readFileSync}from'fs';import {dirname,join}from'path';import {fileURLToPath}from'url';var P=dirname(fileURLToPath(import.meta.url));function G(){try{let e=join(P,"..","package.json");return JSON.parse(readFileSync(e,"utf-8")).version??"0.0.0"}catch{return "0.0.0"}}var p=new Set(["DEBUG","INFO","WARN","ERROR"]);function y(e){let n={logLevel:"INFO",printLogs:false,debug:false};for(let s=0;s<e.length;s++){let t=e[s];if(t)if(t==="--cwd"&&s+1<e.length){let o=e[s+1];o&&!o.startsWith("-")&&(n.cwd=o,s++);}else if(t.startsWith("--cwd="))n.cwd=t.slice(6);else if(t==="--config"&&s+1<e.length){let o=e[s+1];o&&!o.startsWith("-")&&(n.configPath=o,s++);}else if(t.startsWith("--config="))n.configPath=t.slice(9);else if(t==="--log-level"&&s+1<e.length){let o=e[s+1];if(o&&!o.startsWith("-")){let a=o.toUpperCase();p.has(a)&&(n.logLevel=a,s++);}}else if(t.startsWith("--log-level=")){let o=t.slice(12).toUpperCase();p.has(o)&&(n.logLevel=o);}else t==="--print-logs"?n.printLogs=true:t==="--debug"&&(n.debug=true);}return n}async function E(){let e=process.argv.slice(2),n=G(),{loadEnv:s}=await import('@easbot/utils');s(),process.env.EASBOT_LANG||(process.env.EASBOT_LANG="en-US");let t=y(e),{Log:o}=await import('@easbot/utils'),{getXdgData:a}=await import('./chunks/interfaces-5HZADUYB.mjs'),f=join(a(),"log");if(await o.init({logDir:f,print:t.printLogs,dev:t.debug||false,level:t.logLevel}),e.length===0){let{renderBanner:l}=await import('./chunks/cli-handler-IJ2PNNTK.mjs');l();return}if(e[0]==="--help"||e[0]==="-h"){let{renderHelp:l}=await import('./chunks/cli-handler-IJ2PNNTK.mjs');l();return}if(e[0]==="--version"||e[0]==="-v"){console.log(n);return}let r=t.cwd??process.cwd(),{handleCodebaseCli:h}=await import('./chunks/cli-handler-IJ2PNNTK.mjs'),{setInstanceAdapter:m}=await import('./chunks/interfaces-5HZADUYB.mjs');m({directory:r,worktree:r});let{Llm:w}=await import('./chunks/llm-MPD7FHPM.mjs'),{bootstrapLlm:b,setAdapterRegistry:u}=await import('@easbot/llm'),{getGlobal:i,getInstance:c}=await import('./chunks/interfaces-5HZADUYB.mjs');u({config:void 0,instance:{getDirectory:()=>c().directory,getWorktree:()=>c().worktree},global:{home:i().Path.home,data:i().Path.data,cache:i().Path.cache,config:i().Path.config,state:i().Path.state,log:i().Path.log,bin:i().Path.bin},installation:{getVersion:()=>n,getChannel:()=>"local",getUserAgent:()=>`easbot-codebase/${n}`}}),await b({target:w,cwd:r,subConfigPath:".easbot/codebase.json",embedding:true});let g=await h(e,{version:n,cwd:r});g.code!==0&&(process.exitCode=g.code);}E().catch(e=>{console.error(e),process.exitCode=1;}).finally(async()=>{try{let{Log:e}=await import('@easbot/utils');await e.close();}catch{}process.exit(process.exitCode??0);});
2
+ import'./chunks/chunk-2YMB6W5S.mjs';import {readFileSync}from'fs';import {dirname,join}from'path';import {fileURLToPath}from'url';var P=dirname(fileURLToPath(import.meta.url));function G(){try{let e=join(P,"..","package.json");return JSON.parse(readFileSync(e,"utf-8")).version??"0.0.0"}catch{return "0.0.0"}}var p=new Set(["DEBUG","INFO","WARN","ERROR"]);function y(e){let n={logLevel:"INFO",printLogs:false,debug:false};for(let s=0;s<e.length;s++){let t=e[s];if(t)if(t==="--cwd"&&s+1<e.length){let o=e[s+1];o&&!o.startsWith("-")&&(n.cwd=o,s++);}else if(t.startsWith("--cwd="))n.cwd=t.slice(6);else if(t==="--config"&&s+1<e.length){let o=e[s+1];o&&!o.startsWith("-")&&(n.configPath=o,s++);}else if(t.startsWith("--config="))n.configPath=t.slice(9);else if(t==="--log-level"&&s+1<e.length){let o=e[s+1];if(o&&!o.startsWith("-")){let a=o.toUpperCase();p.has(a)&&(n.logLevel=a,s++);}}else if(t.startsWith("--log-level=")){let o=t.slice(12).toUpperCase();p.has(o)&&(n.logLevel=o);}else t==="--print-logs"?n.printLogs=true:t==="--debug"&&(n.debug=true);}return n}async function E(){let e=process.argv.slice(2),n=G(),{loadEnv:s}=await import('@easbot/utils');s(),process.env.EASBOT_LANG||(process.env.EASBOT_LANG="en-US");let t=y(e),{Log:o}=await import('@easbot/utils'),{getXdgData:a}=await import('./chunks/interfaces-DPFLQBQ6.mjs'),f=join(a(),"log");if(await o.init({logDir:f,print:t.printLogs,dev:t.debug||false,level:t.logLevel}),e.length===0){let{renderBanner:l}=await import('./chunks/cli-handler-2PSSL33N.mjs');l();return}if(e[0]==="--help"||e[0]==="-h"){let{renderHelp:l}=await import('./chunks/cli-handler-2PSSL33N.mjs');l();return}if(e[0]==="--version"||e[0]==="-v"){console.log(n);return}let r=t.cwd??process.cwd(),{handleCodebaseCli:h}=await import('./chunks/cli-handler-2PSSL33N.mjs'),{setInstanceAdapter:m}=await import('./chunks/interfaces-DPFLQBQ6.mjs');m({directory:r,worktree:r});let{Llm:w}=await import('./chunks/llm-ADBGTSCV.mjs'),{bootstrapLlm:b,setAdapterRegistry:u}=await import('@easbot/llm'),{getGlobal:i,getInstance:c}=await import('./chunks/interfaces-DPFLQBQ6.mjs');u({config:void 0,instance:{getDirectory:()=>c().directory,getWorktree:()=>c().worktree},global:{home:i().Path.home,data:i().Path.data,cache:i().Path.cache,config:i().Path.config,state:i().Path.state,log:i().Path.log,bin:i().Path.bin},installation:{getVersion:()=>n,getChannel:()=>"local",getUserAgent:()=>`easbot-codebase/${n}`}}),await b({target:w,cwd:r,subConfigPath:".easbot/codebase.json",embedding:true});let g=await h(e,{version:n,cwd:r});g.code!==0&&(process.exitCode=g.code);}E().catch(e=>{console.error(e),process.exitCode=1;}).finally(async()=>{try{let{Log:e}=await import('@easbot/utils');await e.close();}catch{}process.exit(process.exitCode??0);});
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var chunkYYF5OQDS_cjs=require('./chunks/chunk-YYF5OQDS.cjs'),chunkJVX6PHPN_cjs=require('./chunks/chunk-JVX6PHPN.cjs');require('./chunks/chunk-BEQN3CKO.cjs');var chunkR74KIJM2_cjs=require('./chunks/chunk-R74KIJM2.cjs'),chunkVFTVDTEY_cjs=require('./chunks/chunk-VFTVDTEY.cjs'),chunkJWTI3BWI_cjs=require('./chunks/chunk-JWTI3BWI.cjs'),chunkVPWALTY7_cjs=require('./chunks/chunk-VPWALTY7.cjs');require('./chunks/chunk-NVGACA7W.cjs');Object.defineProperty(exports,"handleCodebaseCli",{enumerable:true,get:function(){return chunkYYF5OQDS_cjs.d}});Object.defineProperty(exports,"renderBanner",{enumerable:true,get:function(){return chunkYYF5OQDS_cjs.a}});Object.defineProperty(exports,"renderHelp",{enumerable:true,get:function(){return chunkYYF5OQDS_cjs.b}});Object.defineProperty(exports,"getGlobal",{enumerable:true,get:function(){return chunkJVX6PHPN_cjs.c}});Object.defineProperty(exports,"getHomeDir",{enumerable:true,get:function(){return chunkJVX6PHPN_cjs.g}});Object.defineProperty(exports,"getInstance",{enumerable:true,get:function(){return chunkJVX6PHPN_cjs.f}});Object.defineProperty(exports,"getProjectDirectory",{enumerable:true,get:function(){return chunkJVX6PHPN_cjs.l}});Object.defineProperty(exports,"getXdgCache",{enumerable:true,get:function(){return chunkJVX6PHPN_cjs.k}});Object.defineProperty(exports,"getXdgConfig",{enumerable:true,get:function(){return chunkJVX6PHPN_cjs.i}});Object.defineProperty(exports,"getXdgData",{enumerable:true,get:function(){return chunkJVX6PHPN_cjs.h}});Object.defineProperty(exports,"getXdgState",{enumerable:true,get:function(){return chunkJVX6PHPN_cjs.j}});Object.defineProperty(exports,"resetGlobalAdapter",{enumerable:true,get:function(){return chunkJVX6PHPN_cjs.b}});Object.defineProperty(exports,"resetInstanceAdapter",{enumerable:true,get:function(){return chunkJVX6PHPN_cjs.e}});Object.defineProperty(exports,"setGlobalAdapter",{enumerable:true,get:function(){return chunkJVX6PHPN_cjs.a}});Object.defineProperty(exports,"setInstanceAdapter",{enumerable:true,get:function(){return chunkJVX6PHPN_cjs.d}});Object.defineProperty(exports,"AmbiguousError",{enumerable:true,get:function(){return chunkR74KIJM2_cjs.c}});Object.defineProperty(exports,"NotFoundError",{enumerable:true,get:function(){return chunkR74KIJM2_cjs.b}});Object.defineProperty(exports,"SECTION_END",{enumerable:true,get:function(){return chunkR74KIJM2_cjs.r}});Object.defineProperty(exports,"SECTION_MARKER",{enumerable:true,get:function(){return chunkR74KIJM2_cjs.q}});Object.defineProperty(exports,"ServiceError",{enumerable:true,get:function(){return chunkR74KIJM2_cjs.a}});Object.defineProperty(exports,"callees",{enumerable:true,get:function(){return chunkR74KIJM2_cjs.i}});Object.defineProperty(exports,"callers",{enumerable:true,get:function(){return chunkR74KIJM2_cjs.h}});Object.defineProperty(exports,"context",{enumerable:true,get:function(){return chunkR74KIJM2_cjs.f}});Object.defineProperty(exports,"defaultRiskLabel",{enumerable:true,get:function(){return chunkR74KIJM2_cjs.w}});Object.defineProperty(exports,"doctor",{enumerable:true,get:function(){return chunkR74KIJM2_cjs.l}});Object.defineProperty(exports,"emptyFormattedNode",{enumerable:true,get:function(){return chunkR74KIJM2_cjs.p}});Object.defineProperty(exports,"explore",{enumerable:true,get:function(){return chunkR74KIJM2_cjs.j}});Object.defineProperty(exports,"formatCodebaseEdge",{enumerable:true,get:function(){return chunkR74KIJM2_cjs.n}});Object.defineProperty(exports,"formatCodebaseNode",{enumerable:true,get:function(){return chunkR74KIJM2_cjs.m}});Object.defineProperty(exports,"formatCodebaseSearchHits",{enumerable:true,get:function(){return chunkR74KIJM2_cjs.o}});Object.defineProperty(exports,"impact",{enumerable:true,get:function(){return chunkR74KIJM2_cjs.g}});Object.defineProperty(exports,"node",{enumerable:true,get:function(){return chunkR74KIJM2_cjs.e}});Object.defineProperty(exports,"renderContext",{enumerable:true,get:function(){return chunkR74KIJM2_cjs.x}});Object.defineProperty(exports,"renderContextFromQuery",{enumerable:true,get:function(){return chunkR74KIJM2_cjs.B}});Object.defineProperty(exports,"renderExploreFromResult",{enumerable:true,get:function(){return chunkR74KIJM2_cjs.D}});Object.defineProperty(exports,"renderImpact",{enumerable:true,get:function(){return chunkR74KIJM2_cjs.v}});Object.defineProperty(exports,"renderImpactFromTuples",{enumerable:true,get:function(){return chunkR74KIJM2_cjs.A}});Object.defineProperty(exports,"renderNode",{enumerable:true,get:function(){return chunkR74KIJM2_cjs.y}});Object.defineProperty(exports,"renderNodeDetail",{enumerable:true,get:function(){return chunkR74KIJM2_cjs.C}});Object.defineProperty(exports,"renderSearch",{enumerable:true,get:function(){return chunkR74KIJM2_cjs.z}});Object.defineProperty(exports,"renderSearchResult",{enumerable:true,get:function(){return chunkR74KIJM2_cjs.u}});Object.defineProperty(exports,"search",{enumerable:true,get:function(){return chunkR74KIJM2_cjs.d}});Object.defineProperty(exports,"status",{enumerable:true,get:function(){return chunkR74KIJM2_cjs.k}});Object.defineProperty(exports,"truncateAtSectionBoundary",{enumerable:true,get:function(){return chunkR74KIJM2_cjs.s}});Object.defineProperty(exports,"truncateAtSectionBoundarySync",{enumerable:true,get:function(){return chunkR74KIJM2_cjs.t}});Object.defineProperty(exports,"CodeBase",{enumerable:true,get:function(){return chunkVFTVDTEY_cjs.s}});Object.defineProperty(exports,"EdgeExtractor",{enumerable:true,get:function(){return chunkVFTVDTEY_cjs.l}});Object.defineProperty(exports,"FILE_EXTENSION_MAP",{enumerable:true,get:function(){return chunkVFTVDTEY_cjs.f}});Object.defineProperty(exports,"Indexer",{enumerable:true,get:function(){return chunkVFTVDTEY_cjs.n}});Object.defineProperty(exports,"NodeExtractor",{enumerable:true,get:function(){return chunkVFTVDTEY_cjs.j}});Object.defineProperty(exports,"ParserManager",{enumerable:true,get:function(){return chunkVFTVDTEY_cjs.g}});Object.defineProperty(exports,"QueryInterface",{enumerable:true,get:function(){return chunkVFTVDTEY_cjs.q}});Object.defineProperty(exports,"createCodebase",{enumerable:true,get:function(){return chunkVFTVDTEY_cjs.t}});Object.defineProperty(exports,"createEdgeExtractor",{enumerable:true,get:function(){return chunkVFTVDTEY_cjs.m}});Object.defineProperty(exports,"createIndexer",{enumerable:true,get:function(){return chunkVFTVDTEY_cjs.o}});Object.defineProperty(exports,"createNodeExtractor",{enumerable:true,get:function(){return chunkVFTVDTEY_cjs.k}});Object.defineProperty(exports,"createQueryInterface",{enumerable:true,get:function(){return chunkVFTVDTEY_cjs.r}});Object.defineProperty(exports,"getParserManager",{enumerable:true,get:function(){return chunkVFTVDTEY_cjs.h}});Object.defineProperty(exports,"resetParserManager",{enumerable:true,get:function(){return chunkVFTVDTEY_cjs.i}});Object.defineProperty(exports,"ConfigError",{enumerable:true,get:function(){return chunkJWTI3BWI_cjs.e}});Object.defineProperty(exports,"DatabaseError",{enumerable:true,get:function(){return chunkJWTI3BWI_cjs.b}});Object.defineProperty(exports,"DatabaseManager",{enumerable:true,get:function(){return chunkJWTI3BWI_cjs.n}});Object.defineProperty(exports,"FileSystemError",{enumerable:true,get:function(){return chunkJWTI3BWI_cjs.c}});Object.defineProperty(exports,"IndexError",{enumerable:true,get:function(){return chunkJWTI3BWI_cjs.f}});Object.defineProperty(exports,"ParserError",{enumerable:true,get:function(){return chunkJWTI3BWI_cjs.a}});Object.defineProperty(exports,"QueryError",{enumerable:true,get:function(){return chunkJWTI3BWI_cjs.g}});Object.defineProperty(exports,"SchemaError",{enumerable:true,get:function(){return chunkJWTI3BWI_cjs.d}});Object.defineProperty(exports,"UnsupportedLanguageError",{enumerable:true,get:function(){return chunkJWTI3BWI_cjs.h}});Object.defineProperty(exports,"Llm",{enumerable:true,get:function(){return chunkVPWALTY7_cjs.a}});Object.defineProperty(exports,"llm",{enumerable:true,get:function(){return chunkVPWALTY7_cjs.b}});
1
+ 'use strict';var chunkMRPT44H3_cjs=require('./chunks/chunk-MRPT44H3.cjs');require('./chunks/chunk-HRFLFP6O.cjs');var chunkVF3U3DPM_cjs=require('./chunks/chunk-VF3U3DPM.cjs'),chunkZK7YSBLG_cjs=require('./chunks/chunk-ZK7YSBLG.cjs'),chunkJVX6PHPN_cjs=require('./chunks/chunk-JVX6PHPN.cjs'),chunkZCH5GLXA_cjs=require('./chunks/chunk-ZCH5GLXA.cjs'),chunkVPWALTY7_cjs=require('./chunks/chunk-VPWALTY7.cjs');require('./chunks/chunk-M2YU5LAI.cjs');Object.defineProperty(exports,"handleCodebaseCli",{enumerable:true,get:function(){return chunkMRPT44H3_cjs.d}});Object.defineProperty(exports,"renderBanner",{enumerable:true,get:function(){return chunkMRPT44H3_cjs.a}});Object.defineProperty(exports,"renderHelp",{enumerable:true,get:function(){return chunkMRPT44H3_cjs.b}});Object.defineProperty(exports,"AmbiguousError",{enumerable:true,get:function(){return chunkVF3U3DPM_cjs.c}});Object.defineProperty(exports,"NotFoundError",{enumerable:true,get:function(){return chunkVF3U3DPM_cjs.b}});Object.defineProperty(exports,"SECTION_END",{enumerable:true,get:function(){return chunkVF3U3DPM_cjs.r}});Object.defineProperty(exports,"SECTION_MARKER",{enumerable:true,get:function(){return chunkVF3U3DPM_cjs.q}});Object.defineProperty(exports,"ServiceError",{enumerable:true,get:function(){return chunkVF3U3DPM_cjs.a}});Object.defineProperty(exports,"callees",{enumerable:true,get:function(){return chunkVF3U3DPM_cjs.i}});Object.defineProperty(exports,"callers",{enumerable:true,get:function(){return chunkVF3U3DPM_cjs.h}});Object.defineProperty(exports,"context",{enumerable:true,get:function(){return chunkVF3U3DPM_cjs.f}});Object.defineProperty(exports,"defaultRiskLabel",{enumerable:true,get:function(){return chunkVF3U3DPM_cjs.w}});Object.defineProperty(exports,"doctor",{enumerable:true,get:function(){return chunkVF3U3DPM_cjs.l}});Object.defineProperty(exports,"emptyFormattedNode",{enumerable:true,get:function(){return chunkVF3U3DPM_cjs.p}});Object.defineProperty(exports,"explore",{enumerable:true,get:function(){return chunkVF3U3DPM_cjs.j}});Object.defineProperty(exports,"formatCodebaseEdge",{enumerable:true,get:function(){return chunkVF3U3DPM_cjs.n}});Object.defineProperty(exports,"formatCodebaseNode",{enumerable:true,get:function(){return chunkVF3U3DPM_cjs.m}});Object.defineProperty(exports,"formatCodebaseSearchHits",{enumerable:true,get:function(){return chunkVF3U3DPM_cjs.o}});Object.defineProperty(exports,"impact",{enumerable:true,get:function(){return chunkVF3U3DPM_cjs.g}});Object.defineProperty(exports,"node",{enumerable:true,get:function(){return chunkVF3U3DPM_cjs.e}});Object.defineProperty(exports,"renderContext",{enumerable:true,get:function(){return chunkVF3U3DPM_cjs.x}});Object.defineProperty(exports,"renderContextFromQuery",{enumerable:true,get:function(){return chunkVF3U3DPM_cjs.B}});Object.defineProperty(exports,"renderExploreFromResult",{enumerable:true,get:function(){return chunkVF3U3DPM_cjs.D}});Object.defineProperty(exports,"renderImpact",{enumerable:true,get:function(){return chunkVF3U3DPM_cjs.v}});Object.defineProperty(exports,"renderImpactFromTuples",{enumerable:true,get:function(){return chunkVF3U3DPM_cjs.A}});Object.defineProperty(exports,"renderNode",{enumerable:true,get:function(){return chunkVF3U3DPM_cjs.y}});Object.defineProperty(exports,"renderNodeDetail",{enumerable:true,get:function(){return chunkVF3U3DPM_cjs.C}});Object.defineProperty(exports,"renderSearch",{enumerable:true,get:function(){return chunkVF3U3DPM_cjs.z}});Object.defineProperty(exports,"renderSearchResult",{enumerable:true,get:function(){return chunkVF3U3DPM_cjs.u}});Object.defineProperty(exports,"search",{enumerable:true,get:function(){return chunkVF3U3DPM_cjs.d}});Object.defineProperty(exports,"status",{enumerable:true,get:function(){return chunkVF3U3DPM_cjs.k}});Object.defineProperty(exports,"truncateAtSectionBoundary",{enumerable:true,get:function(){return chunkVF3U3DPM_cjs.s}});Object.defineProperty(exports,"truncateAtSectionBoundarySync",{enumerable:true,get:function(){return chunkVF3U3DPM_cjs.t}});Object.defineProperty(exports,"CodeBase",{enumerable:true,get:function(){return chunkZK7YSBLG_cjs.s}});Object.defineProperty(exports,"EdgeExtractor",{enumerable:true,get:function(){return chunkZK7YSBLG_cjs.m}});Object.defineProperty(exports,"FILE_EXTENSION_MAP",{enumerable:true,get:function(){return chunkZK7YSBLG_cjs.g}});Object.defineProperty(exports,"Indexer",{enumerable:true,get:function(){return chunkZK7YSBLG_cjs.o}});Object.defineProperty(exports,"NodeExtractor",{enumerable:true,get:function(){return chunkZK7YSBLG_cjs.k}});Object.defineProperty(exports,"ParserManager",{enumerable:true,get:function(){return chunkZK7YSBLG_cjs.h}});Object.defineProperty(exports,"QueryInterface",{enumerable:true,get:function(){return chunkZK7YSBLG_cjs.q}});Object.defineProperty(exports,"codebaseConfigPath",{enumerable:true,get:function(){return chunkZK7YSBLG_cjs.b}});Object.defineProperty(exports,"codebaseDbPath",{enumerable:true,get:function(){return chunkZK7YSBLG_cjs.c}});Object.defineProperty(exports,"createCodebase",{enumerable:true,get:function(){return chunkZK7YSBLG_cjs.t}});Object.defineProperty(exports,"createEdgeExtractor",{enumerable:true,get:function(){return chunkZK7YSBLG_cjs.n}});Object.defineProperty(exports,"createIndexer",{enumerable:true,get:function(){return chunkZK7YSBLG_cjs.p}});Object.defineProperty(exports,"createNodeExtractor",{enumerable:true,get:function(){return chunkZK7YSBLG_cjs.l}});Object.defineProperty(exports,"createQueryInterface",{enumerable:true,get:function(){return chunkZK7YSBLG_cjs.r}});Object.defineProperty(exports,"easbotDir",{enumerable:true,get:function(){return chunkZK7YSBLG_cjs.a}});Object.defineProperty(exports,"getParserManager",{enumerable:true,get:function(){return chunkZK7YSBLG_cjs.i}});Object.defineProperty(exports,"resetParserManager",{enumerable:true,get:function(){return chunkZK7YSBLG_cjs.j}});Object.defineProperty(exports,"getGlobal",{enumerable:true,get:function(){return chunkJVX6PHPN_cjs.c}});Object.defineProperty(exports,"getHomeDir",{enumerable:true,get:function(){return chunkJVX6PHPN_cjs.g}});Object.defineProperty(exports,"getInstance",{enumerable:true,get:function(){return chunkJVX6PHPN_cjs.f}});Object.defineProperty(exports,"getProjectDirectory",{enumerable:true,get:function(){return chunkJVX6PHPN_cjs.l}});Object.defineProperty(exports,"getXdgCache",{enumerable:true,get:function(){return chunkJVX6PHPN_cjs.k}});Object.defineProperty(exports,"getXdgConfig",{enumerable:true,get:function(){return chunkJVX6PHPN_cjs.i}});Object.defineProperty(exports,"getXdgData",{enumerable:true,get:function(){return chunkJVX6PHPN_cjs.h}});Object.defineProperty(exports,"getXdgState",{enumerable:true,get:function(){return chunkJVX6PHPN_cjs.j}});Object.defineProperty(exports,"resetGlobalAdapter",{enumerable:true,get:function(){return chunkJVX6PHPN_cjs.b}});Object.defineProperty(exports,"resetInstanceAdapter",{enumerable:true,get:function(){return chunkJVX6PHPN_cjs.e}});Object.defineProperty(exports,"setGlobalAdapter",{enumerable:true,get:function(){return chunkJVX6PHPN_cjs.a}});Object.defineProperty(exports,"setInstanceAdapter",{enumerable:true,get:function(){return chunkJVX6PHPN_cjs.d}});Object.defineProperty(exports,"ConfigError",{enumerable:true,get:function(){return chunkZCH5GLXA_cjs.e}});Object.defineProperty(exports,"DatabaseError",{enumerable:true,get:function(){return chunkZCH5GLXA_cjs.b}});Object.defineProperty(exports,"DatabaseManager",{enumerable:true,get:function(){return chunkZCH5GLXA_cjs.n}});Object.defineProperty(exports,"FileSystemError",{enumerable:true,get:function(){return chunkZCH5GLXA_cjs.c}});Object.defineProperty(exports,"IndexError",{enumerable:true,get:function(){return chunkZCH5GLXA_cjs.f}});Object.defineProperty(exports,"ParserError",{enumerable:true,get:function(){return chunkZCH5GLXA_cjs.a}});Object.defineProperty(exports,"QueryError",{enumerable:true,get:function(){return chunkZCH5GLXA_cjs.g}});Object.defineProperty(exports,"SchemaError",{enumerable:true,get:function(){return chunkZCH5GLXA_cjs.d}});Object.defineProperty(exports,"UnsupportedLanguageError",{enumerable:true,get:function(){return chunkZCH5GLXA_cjs.h}});Object.defineProperty(exports,"Llm",{enumerable:true,get:function(){return chunkVPWALTY7_cjs.a}});Object.defineProperty(exports,"llm",{enumerable:true,get:function(){return chunkVPWALTY7_cjs.b}});
package/dist/index.d.cts CHANGED
@@ -36,6 +36,15 @@ declare class DatabaseManager {
36
36
  insertEdge(edge: Edge): void;
37
37
  insertEdges(edges: Edge[]): void;
38
38
  queryNodes(filter: NodeQueryFilter): Node[];
39
+ findNodesByName(params: {
40
+ name?: string;
41
+ file?: string;
42
+ kind?: string;
43
+ limit?: number;
44
+ }): Array<{
45
+ node: Node;
46
+ matchKind: 'exact' | 'qualified' | 'substring';
47
+ }>;
39
48
  queryEdges(filter: EdgeQueryFilter): Edge[];
40
49
  queryAll<T = any>(sql: string, params?: (string | number)[]): T[];
41
50
  searchNodesFts(query: string, limit?: number): FtsSearchResult[];
@@ -61,6 +70,7 @@ declare class DatabaseManager {
61
70
  unresolved_refs: number;
62
71
  name_segment_vocab: number;
63
72
  project_metadata: number;
73
+ schema_migrations: number;
64
74
  meta: number;
65
75
  };
66
76
  };
@@ -286,6 +296,7 @@ declare class QueryInterface {
286
296
  queryOverrides(nodeId: string): Node[];
287
297
  getNode(nodeId: string): Node | null;
288
298
  getEdge(edgeId: string): Edge | null;
299
+ getDatabase(): DatabaseManager;
289
300
  }
290
301
  declare function createQueryInterface(db: DatabaseManager): QueryInterface;
291
302
 
@@ -1054,9 +1065,26 @@ interface CallersResult {
1054
1065
  callers: CallerEntry[];
1055
1066
  truncated: boolean;
1056
1067
  }
1057
- interface CalleesParams extends CallersParams {
1068
+ interface CalleesParams {
1069
+ name?: string;
1070
+ nodeId?: string;
1071
+ file?: string;
1072
+ kind?: string;
1073
+ relationTypes?: RelationType[];
1074
+ maxResults?: number;
1058
1075
  }
1059
- interface CalleesResult extends CallersResult {
1076
+ interface CalleeEntry {
1077
+ id: string;
1078
+ name: string;
1079
+ astType: string;
1080
+ filePath: string;
1081
+ startLine: number;
1082
+ relation: string;
1083
+ }
1084
+ interface CalleesResult {
1085
+ root: Node | null;
1086
+ callees: CalleeEntry[];
1087
+ truncated: boolean;
1060
1088
  }
1061
1089
  interface ExploreParams {
1062
1090
  query: string;
@@ -1151,4 +1179,8 @@ declare function getXdgState(): string;
1151
1179
  declare function getXdgCache(): string;
1152
1180
  declare function getProjectDirectory(): string;
1153
1181
 
1154
- export { type ASTNodeType, AmbiguousError, type CalleesParams, type CalleesResult, type CallerEntry, type CallersParams, type CallersResult, CodeBase, type CodeKnowledgeGraphConfig, type CodebaseCliDeps, type CodebaseCliResult, type CodebaseConfig, ConfigError, type ContextInput, type ContextNode, type ContextParams, type ContextResult, DatabaseError, DatabaseManager, type DoctorParams, type DoctorResult, type Edge, EdgeExtractor, type EdgeQueryFilter, type EdgeWithNodes, type ExploreEntryPoint, type ExploreParams, type ExploreResult, type ExtractedEdge, type ExtractedNode, FILE_EXTENSION_MAP, type FileHashRecord, FileSystemError, type FormattedEdge, type FormattedNode, type FormattedSearchHit, type GraphStatus, type HealthCheckResult, type HybridSearchResult, type ICodebase, type IEdgeExtractor, type INodeExtractor, type IParser, type ImpactBucket, type ImpactBucketEntry, type ImpactParams, type ImpactResult, IndexError, type IndexResult, Indexer, type IndexerConfig, type Language, Llm, type LlmInitConfig, type LlmModels, type LlmOptions, type Node, NodeExtractor, type NodeKind, type NodeParams, type NodeQueryFilter, type NodeResult, type NodeWithEdges, NotFoundError, ParserError, ParserManager, type PendingFile, type ProgressCallback, QueryError, QueryInterface, type RelationQueryOptions, type RelationType, type RenderOptions, SECTION_END, SECTION_MARKER, SchemaError, type SearchHit, type SearchOptions, type SearchParams, type SearchResult$1 as SearchResult, type ServiceContext, ServiceError, type StatusParams, type StatusResult, type SyncResult, type TruncateOptions, type TruncateResult, UnsupportedLanguageError, callees, callers, context, createCodebase, createEdgeExtractor, createIndexer, createNodeExtractor, createQueryInterface, defaultRiskLabel, doctor, emptyFormattedNode, explore, formatCodebaseEdge, formatCodebaseNode, formatCodebaseSearchHits, getGlobal, getHomeDir, getInstance, getParserManager, getProjectDirectory, getXdgCache, getXdgConfig, getXdgData, getXdgState, handleCodebaseCli, impact, llm, node, renderBanner, renderContext, renderContextFromQuery, renderExploreFromResult, renderHelp, renderImpact, renderImpactFromTuples, renderNode, renderNodeDetail, renderSearch, renderSearchResult, resetGlobalAdapter, resetInstanceAdapter, resetParserManager, search, setGlobalAdapter, setInstanceAdapter, status, truncateAtSectionBoundary, truncateAtSectionBoundarySync };
1182
+ declare function easbotDir(rootDir: string): string;
1183
+ declare function codebaseConfigPath(rootDir: string): string;
1184
+ declare function codebaseDbPath(rootDir: string): string;
1185
+
1186
+ export { type ASTNodeType, AmbiguousError, type CalleeEntry, type CalleesParams, type CalleesResult, type CallerEntry, type CallersParams, type CallersResult, CodeBase, type CodeKnowledgeGraphConfig, type CodebaseCliDeps, type CodebaseCliResult, type CodebaseConfig, ConfigError, type ContextInput, type ContextNode, type ContextParams, type ContextResult, DatabaseError, DatabaseManager, type DoctorParams, type DoctorResult, type Edge, EdgeExtractor, type EdgeQueryFilter, type EdgeWithNodes, type ExploreEntryPoint, type ExploreParams, type ExploreResult, type ExtractedEdge, type ExtractedNode, FILE_EXTENSION_MAP, type FileHashRecord, FileSystemError, type FormattedEdge, type FormattedNode, type FormattedSearchHit, type GraphStatus, type HealthCheckResult, type HybridSearchResult, type ICodebase, type IEdgeExtractor, type INodeExtractor, type IParser, type ImpactBucket, type ImpactBucketEntry, type ImpactParams, type ImpactResult, IndexError, type IndexResult, Indexer, type IndexerConfig, type Language, Llm, type LlmInitConfig, type LlmModels, type LlmOptions, type Node, NodeExtractor, type NodeKind, type NodeParams, type NodeQueryFilter, type NodeResult, type NodeWithEdges, NotFoundError, ParserError, ParserManager, type PendingFile, type ProgressCallback, QueryError, QueryInterface, type RelationQueryOptions, type RelationType, type RenderOptions, SECTION_END, SECTION_MARKER, SchemaError, type SearchHit, type SearchOptions, type SearchParams, type SearchResult$1 as SearchResult, type ServiceContext, ServiceError, type StatusParams, type StatusResult, type SyncResult, type TruncateOptions, type TruncateResult, UnsupportedLanguageError, callees, callers, codebaseConfigPath, codebaseDbPath, context, createCodebase, createEdgeExtractor, createIndexer, createNodeExtractor, createQueryInterface, defaultRiskLabel, doctor, easbotDir, emptyFormattedNode, explore, formatCodebaseEdge, formatCodebaseNode, formatCodebaseSearchHits, getGlobal, getHomeDir, getInstance, getParserManager, getProjectDirectory, getXdgCache, getXdgConfig, getXdgData, getXdgState, handleCodebaseCli, impact, llm, node, renderBanner, renderContext, renderContextFromQuery, renderExploreFromResult, renderHelp, renderImpact, renderImpactFromTuples, renderNode, renderNodeDetail, renderSearch, renderSearchResult, resetGlobalAdapter, resetInstanceAdapter, resetParserManager, search, setGlobalAdapter, setInstanceAdapter, status, truncateAtSectionBoundary, truncateAtSectionBoundarySync };
package/dist/index.d.ts CHANGED
@@ -36,6 +36,15 @@ declare class DatabaseManager {
36
36
  insertEdge(edge: Edge): void;
37
37
  insertEdges(edges: Edge[]): void;
38
38
  queryNodes(filter: NodeQueryFilter): Node[];
39
+ findNodesByName(params: {
40
+ name?: string;
41
+ file?: string;
42
+ kind?: string;
43
+ limit?: number;
44
+ }): Array<{
45
+ node: Node;
46
+ matchKind: 'exact' | 'qualified' | 'substring';
47
+ }>;
39
48
  queryEdges(filter: EdgeQueryFilter): Edge[];
40
49
  queryAll<T = any>(sql: string, params?: (string | number)[]): T[];
41
50
  searchNodesFts(query: string, limit?: number): FtsSearchResult[];
@@ -61,6 +70,7 @@ declare class DatabaseManager {
61
70
  unresolved_refs: number;
62
71
  name_segment_vocab: number;
63
72
  project_metadata: number;
73
+ schema_migrations: number;
64
74
  meta: number;
65
75
  };
66
76
  };
@@ -286,6 +296,7 @@ declare class QueryInterface {
286
296
  queryOverrides(nodeId: string): Node[];
287
297
  getNode(nodeId: string): Node | null;
288
298
  getEdge(edgeId: string): Edge | null;
299
+ getDatabase(): DatabaseManager;
289
300
  }
290
301
  declare function createQueryInterface(db: DatabaseManager): QueryInterface;
291
302
 
@@ -1054,9 +1065,26 @@ interface CallersResult {
1054
1065
  callers: CallerEntry[];
1055
1066
  truncated: boolean;
1056
1067
  }
1057
- interface CalleesParams extends CallersParams {
1068
+ interface CalleesParams {
1069
+ name?: string;
1070
+ nodeId?: string;
1071
+ file?: string;
1072
+ kind?: string;
1073
+ relationTypes?: RelationType[];
1074
+ maxResults?: number;
1058
1075
  }
1059
- interface CalleesResult extends CallersResult {
1076
+ interface CalleeEntry {
1077
+ id: string;
1078
+ name: string;
1079
+ astType: string;
1080
+ filePath: string;
1081
+ startLine: number;
1082
+ relation: string;
1083
+ }
1084
+ interface CalleesResult {
1085
+ root: Node | null;
1086
+ callees: CalleeEntry[];
1087
+ truncated: boolean;
1060
1088
  }
1061
1089
  interface ExploreParams {
1062
1090
  query: string;
@@ -1151,4 +1179,8 @@ declare function getXdgState(): string;
1151
1179
  declare function getXdgCache(): string;
1152
1180
  declare function getProjectDirectory(): string;
1153
1181
 
1154
- export { type ASTNodeType, AmbiguousError, type CalleesParams, type CalleesResult, type CallerEntry, type CallersParams, type CallersResult, CodeBase, type CodeKnowledgeGraphConfig, type CodebaseCliDeps, type CodebaseCliResult, type CodebaseConfig, ConfigError, type ContextInput, type ContextNode, type ContextParams, type ContextResult, DatabaseError, DatabaseManager, type DoctorParams, type DoctorResult, type Edge, EdgeExtractor, type EdgeQueryFilter, type EdgeWithNodes, type ExploreEntryPoint, type ExploreParams, type ExploreResult, type ExtractedEdge, type ExtractedNode, FILE_EXTENSION_MAP, type FileHashRecord, FileSystemError, type FormattedEdge, type FormattedNode, type FormattedSearchHit, type GraphStatus, type HealthCheckResult, type HybridSearchResult, type ICodebase, type IEdgeExtractor, type INodeExtractor, type IParser, type ImpactBucket, type ImpactBucketEntry, type ImpactParams, type ImpactResult, IndexError, type IndexResult, Indexer, type IndexerConfig, type Language, Llm, type LlmInitConfig, type LlmModels, type LlmOptions, type Node, NodeExtractor, type NodeKind, type NodeParams, type NodeQueryFilter, type NodeResult, type NodeWithEdges, NotFoundError, ParserError, ParserManager, type PendingFile, type ProgressCallback, QueryError, QueryInterface, type RelationQueryOptions, type RelationType, type RenderOptions, SECTION_END, SECTION_MARKER, SchemaError, type SearchHit, type SearchOptions, type SearchParams, type SearchResult$1 as SearchResult, type ServiceContext, ServiceError, type StatusParams, type StatusResult, type SyncResult, type TruncateOptions, type TruncateResult, UnsupportedLanguageError, callees, callers, context, createCodebase, createEdgeExtractor, createIndexer, createNodeExtractor, createQueryInterface, defaultRiskLabel, doctor, emptyFormattedNode, explore, formatCodebaseEdge, formatCodebaseNode, formatCodebaseSearchHits, getGlobal, getHomeDir, getInstance, getParserManager, getProjectDirectory, getXdgCache, getXdgConfig, getXdgData, getXdgState, handleCodebaseCli, impact, llm, node, renderBanner, renderContext, renderContextFromQuery, renderExploreFromResult, renderHelp, renderImpact, renderImpactFromTuples, renderNode, renderNodeDetail, renderSearch, renderSearchResult, resetGlobalAdapter, resetInstanceAdapter, resetParserManager, search, setGlobalAdapter, setInstanceAdapter, status, truncateAtSectionBoundary, truncateAtSectionBoundarySync };
1182
+ declare function easbotDir(rootDir: string): string;
1183
+ declare function codebaseConfigPath(rootDir: string): string;
1184
+ declare function codebaseDbPath(rootDir: string): string;
1185
+
1186
+ export { type ASTNodeType, AmbiguousError, type CalleeEntry, type CalleesParams, type CalleesResult, type CallerEntry, type CallersParams, type CallersResult, CodeBase, type CodeKnowledgeGraphConfig, type CodebaseCliDeps, type CodebaseCliResult, type CodebaseConfig, ConfigError, type ContextInput, type ContextNode, type ContextParams, type ContextResult, DatabaseError, DatabaseManager, type DoctorParams, type DoctorResult, type Edge, EdgeExtractor, type EdgeQueryFilter, type EdgeWithNodes, type ExploreEntryPoint, type ExploreParams, type ExploreResult, type ExtractedEdge, type ExtractedNode, FILE_EXTENSION_MAP, type FileHashRecord, FileSystemError, type FormattedEdge, type FormattedNode, type FormattedSearchHit, type GraphStatus, type HealthCheckResult, type HybridSearchResult, type ICodebase, type IEdgeExtractor, type INodeExtractor, type IParser, type ImpactBucket, type ImpactBucketEntry, type ImpactParams, type ImpactResult, IndexError, type IndexResult, Indexer, type IndexerConfig, type Language, Llm, type LlmInitConfig, type LlmModels, type LlmOptions, type Node, NodeExtractor, type NodeKind, type NodeParams, type NodeQueryFilter, type NodeResult, type NodeWithEdges, NotFoundError, ParserError, ParserManager, type PendingFile, type ProgressCallback, QueryError, QueryInterface, type RelationQueryOptions, type RelationType, type RenderOptions, SECTION_END, SECTION_MARKER, SchemaError, type SearchHit, type SearchOptions, type SearchParams, type SearchResult$1 as SearchResult, type ServiceContext, ServiceError, type StatusParams, type StatusResult, type SyncResult, type TruncateOptions, type TruncateResult, UnsupportedLanguageError, callees, callers, codebaseConfigPath, codebaseDbPath, context, createCodebase, createEdgeExtractor, createIndexer, createNodeExtractor, createQueryInterface, defaultRiskLabel, doctor, easbotDir, emptyFormattedNode, explore, formatCodebaseEdge, formatCodebaseNode, formatCodebaseSearchHits, getGlobal, getHomeDir, getInstance, getParserManager, getProjectDirectory, getXdgCache, getXdgConfig, getXdgData, getXdgState, handleCodebaseCli, impact, llm, node, renderBanner, renderContext, renderContextFromQuery, renderExploreFromResult, renderHelp, renderImpact, renderImpactFromTuples, renderNode, renderNodeDetail, renderSearch, renderSearchResult, resetGlobalAdapter, resetInstanceAdapter, resetParserManager, search, setGlobalAdapter, setInstanceAdapter, status, truncateAtSectionBoundary, truncateAtSectionBoundarySync };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- export{d as handleCodebaseCli,a as renderBanner,b as renderHelp}from'./chunks/chunk-TR3DFBJH.mjs';export{c as getGlobal,g as getHomeDir,f as getInstance,l as getProjectDirectory,k as getXdgCache,i as getXdgConfig,h as getXdgData,j as getXdgState,b as resetGlobalAdapter,e as resetInstanceAdapter,a as setGlobalAdapter,d as setInstanceAdapter}from'./chunks/chunk-34CU2EU4.mjs';import'./chunks/chunk-WXWENWCY.mjs';export{c as AmbiguousError,b as NotFoundError,r as SECTION_END,q as SECTION_MARKER,a as ServiceError,i as callees,h as callers,f as context,w as defaultRiskLabel,l as doctor,p as emptyFormattedNode,j as explore,n as formatCodebaseEdge,m as formatCodebaseNode,o as formatCodebaseSearchHits,g as impact,e as node,x as renderContext,B as renderContextFromQuery,D as renderExploreFromResult,v as renderImpact,A as renderImpactFromTuples,y as renderNode,C as renderNodeDetail,z as renderSearch,u as renderSearchResult,d as search,k as status,s as truncateAtSectionBoundary,t as truncateAtSectionBoundarySync}from'./chunks/chunk-CSMSBVAG.mjs';export{s as CodeBase,l as EdgeExtractor,f as FILE_EXTENSION_MAP,n as Indexer,j as NodeExtractor,g as ParserManager,q as QueryInterface,t as createCodebase,m as createEdgeExtractor,o as createIndexer,k as createNodeExtractor,r as createQueryInterface,h as getParserManager,i as resetParserManager}from'./chunks/chunk-AGZFRKQ4.mjs';export{e as ConfigError,b as DatabaseError,n as DatabaseManager,c as FileSystemError,f as IndexError,a as ParserError,g as QueryError,d as SchemaError,h as UnsupportedLanguageError}from'./chunks/chunk-22PKTMO5.mjs';export{a as Llm,b as llm}from'./chunks/chunk-GWCRGM4D.mjs';import'./chunks/chunk-TMICZT3L.mjs';
1
+ export{d as handleCodebaseCli,a as renderBanner,b as renderHelp}from'./chunks/chunk-R26JQOPF.mjs';import'./chunks/chunk-QQXDOGRV.mjs';export{c as AmbiguousError,b as NotFoundError,r as SECTION_END,q as SECTION_MARKER,a as ServiceError,i as callees,h as callers,f as context,w as defaultRiskLabel,l as doctor,p as emptyFormattedNode,j as explore,n as formatCodebaseEdge,m as formatCodebaseNode,o as formatCodebaseSearchHits,g as impact,e as node,x as renderContext,B as renderContextFromQuery,D as renderExploreFromResult,v as renderImpact,A as renderImpactFromTuples,y as renderNode,C as renderNodeDetail,z as renderSearch,u as renderSearchResult,d as search,k as status,s as truncateAtSectionBoundary,t as truncateAtSectionBoundarySync}from'./chunks/chunk-2DGOSNEH.mjs';export{s as CodeBase,m as EdgeExtractor,g as FILE_EXTENSION_MAP,o as Indexer,k as NodeExtractor,h as ParserManager,q as QueryInterface,b as codebaseConfigPath,c as codebaseDbPath,t as createCodebase,n as createEdgeExtractor,p as createIndexer,l as createNodeExtractor,r as createQueryInterface,a as easbotDir,i as getParserManager,j as resetParserManager}from'./chunks/chunk-22NIJF4D.mjs';export{c as getGlobal,g as getHomeDir,f as getInstance,l as getProjectDirectory,k as getXdgCache,i as getXdgConfig,h as getXdgData,j as getXdgState,b as resetGlobalAdapter,e as resetInstanceAdapter,a as setGlobalAdapter,d as setInstanceAdapter}from'./chunks/chunk-34CU2EU4.mjs';export{e as ConfigError,b as DatabaseError,n as DatabaseManager,c as FileSystemError,f as IndexError,a as ParserError,g as QueryError,d as SchemaError,h as UnsupportedLanguageError}from'./chunks/chunk-T2ZV7FU4.mjs';export{a as Llm,b as llm}from'./chunks/chunk-GWCRGM4D.mjs';import'./chunks/chunk-2YMB6W5S.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easbot/codebase",
3
- "version": "0.3.20",
3
+ "version": "0.3.22",
4
4
  "description": "Code Knowledge Graph SDK for EASBot - Property Graph model for code indexing and querying with Tree-sitter parsing, FTS hybrid search, and incremental updates",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -73,13 +73,13 @@
73
73
  "web-tree-sitter": "^0.26.8",
74
74
  "xdg-basedir": "^5.1.0",
75
75
  "zod": "^4.4.3",
76
- "@easbot/database": "0.3.20",
77
- "@easbot/llm": "0.3.20",
78
- "@easbot/mcp": "0.3.20",
79
- "@easbot/local-model-sdk": "0.3.20",
80
- "@easbot/terminal": "0.3.20",
81
- "@easbot/types": "0.3.20",
82
- "@easbot/utils": "0.3.20"
76
+ "@easbot/database": "0.3.22",
77
+ "@easbot/local-model-sdk": "0.3.22",
78
+ "@easbot/mcp": "0.3.22",
79
+ "@easbot/llm": "0.3.22",
80
+ "@easbot/terminal": "0.3.22",
81
+ "@easbot/types": "0.3.22",
82
+ "@easbot/utils": "0.3.22"
83
83
  },
84
84
  "devDependencies": {
85
85
  "@types/node": "^25.9.5",
@@ -101,14 +101,14 @@
101
101
  "test": "vitest",
102
102
  "test:run": "vitest run",
103
103
  "test:coverage": "vitest run --coverage",
104
- "test:clean": "npx tsx scripts/clean-test-fixtures.ts",
104
+ "test:clean": "tsx scripts/clean-test-fixtures.ts",
105
105
  "lint": "biome check .",
106
106
  "lint:fix": "biome check --write .",
107
107
  "lint:report": "biome check --reporter=summary .",
108
108
  "format": "biome format .",
109
109
  "format:fix": "biome format --write .",
110
110
  "type-check": "tsc --noEmit",
111
- "clean": "npx rimraf dist node_modules",
111
+ "clean": "rimraf dist node_modules",
112
112
  "publish:npm": "bash scripts/publish.sh",
113
113
  "publish:npm:win": "powershell -ExecutionPolicy Bypass -File scripts/publish.ps1"
114
114
  }
@@ -1,34 +0,0 @@
1
- import {c,s,p}from'./chunk-AGZFRKQ4.mjs';import {a}from'./chunk-TMICZT3L.mjs';import {Log,Filesystem,TruncateContent}from'@easbot/utils';import {DEFAULT_SEARCH_CONFIG,DEFAULT_PARSER_CONFIG,DEFAULT_INDEXER_CONFIG,DEFAULT_EMBEDDING_CONFIG}from'@easbot/types';var R=class extends Error{constructor(n,l,a$1){super(n);a(this,"code",l);a(this,"details",a$1);this.name="ServiceError";}},P=class extends R{constructor(t,n=[]){super(`Node not found: ${t}`,"NOT_FOUND",{name:t,candidates:n});}},F=class extends R{constructor(t,n){super(`Ambiguous name "${t}" \u2014 ${n.length} candidates`,"AMBIGUOUS",{name:t,candidates:n});}};Log.create({service:"codebase-service"});var E=Filesystem.toUnixPath;async function _(e,t,n){if(n.nodeId){let o=e.getNode(n.nodeId);if(!o)throw new P(`nodeId=${n.nodeId}`);return {node:o,candidates:[]}}if(!n.name)throw new R("Either name or nodeId is required","NOT_FOUND",n);let a=e.queryNodes({limit:5e3});if(n.file){let o=E(n.file),r=a.filter(d=>E(d.file_path).endsWith(o)||E(d.file_path).includes(o));r.length>0&&(a=r);}if(n.kind){let o=n.kind.toLowerCase(),r=a.filter(d=>d.ast_type.includes(o));r.length>0&&(a=r);}let i=a.find(o=>o.name===n.name||o.id.split(":").pop()===n.name);if(i)return {node:i,candidates:[]};let c=p(n.name,a,{limit:10,minScore:.5});if(c.length===0)throw new P(n.name);if(c.length===1){let o=e.getNode(c[0].nodeId);if(!o)throw new P(n.name);return {node:o,candidates:c.map(r=>({node:o,score:r.score}))}}let s=[];for(let o of c){let r=e.getNode(o.nodeId);r&&s.push({node:r,score:o.score});}throw s.length===0?new P(n.name):new F(n.name,s)}async function S(e){let t=c(e.rootDir),n=new s({workspaceDir:e.workspaceDir,database:{path:t,walMode:true},embedding:DEFAULT_EMBEDDING_CONFIG,indexer:DEFAULT_INDEXER_CONFIG,parser:DEFAULT_PARSER_CONFIG,search:DEFAULT_SEARCH_CONFIG,sync:{onBoot:false,onSearch:false,onSessionStart:false,intervalMs:0}});return await n.initialize(),n}function pe(e,t,n,l){let a=l==="in"?e.source:e.target,i=n.getNodeById(a);return i?{id:i.id,name:i.name,astType:i.ast_type,filePath:E(i.file_path),startLine:i.start_line??0,relation:e.relation}:null}async function J(e,t){let n=Date.now(),c=await(await S(e)).getQuery().search(t.query??"",{maxResults:t.maxResults??10,language:t.language,filePath:t.file,astType:t.astType,includeEdges:true,enableFts:t.enableFts!==false,enableEmbedding:t.enableEmbedding!==false});if(t.kind){let o=t.kind.toLowerCase();c=c.filter(r=>r.ast_type.includes(o)||r.name.toLowerCase().includes(o));}if(t.file){let o=E(t.file);c=c.filter(r=>E(r.file_path).endsWith(o)||E(r.file_path).includes(o));}let s=c.map(o=>({nodeId:o.id,name:o.name,kind:o.ast_type??"unknown",filePath:E(o.file_path),startLine:o.start_line,endLine:o.end_line,edges:o.edges??[],source:"basic",score:0,snippet:(o.text??"").slice(0,200).replace(/\s+/g," ").trim()}));return {total:s.length,hits:s,durationMs:Date.now()-n,truncated:false}}async function me(e,t){let n=await S(e),l=n.getQuery(),a=n.getDatabase(),{node:i}=await _(l,e,t),c=[];if(t.includeEdges){let s=t.edgesLimit??50;c=a.queryEdges({sourceOrTarget:[i.id],limit:s});}return {node:i,edges:c}}var ge=["CALLS","IMPORTS","TYPE_REFERENCES","EXTENDS","IMPLEMENTS","HAS_METHOD","HAS_PROPERTY","METHOD_OVERRIDES"];async function fe(e,t){let n=await S(e),l=n.getQuery(),a=n.getDatabase(),{node:i}=await _(l,e,t);if(!i)return {root:null,nodes:[],edges:[],truncated:false,totalNodes:0,totalEdges:0};let c=t.depth??2,s=t.maxNodes??100,o=t.direction??"both",r=new Map,d=[{nodeId:i.id,depth:0}];r.set(i.id,0);let p=[],u=false;for(;d.length>0;){let g=d.shift();if(g.depth>=c)continue;if(r.size>=s){u=true;break}let h=l.queryNeighbors(g.nodeId,{direction:o,relationTypes:t.relationTypes??ge,limit:s-r.size+1});for(let y of h.edges){p.push(y);let $=y.source===g.nodeId?y.target:y.source;if(!r.has($)&&(r.set($,g.depth+1),d.push({nodeId:$,depth:g.depth+1}),r.size>=s)){u=true;break}}if(u)break}let m=Array.from(r.keys()),b=m.length>0?a.queryNodes({ids:m}):[],f=new Map(b.map(g=>[g.id,g])),x=[];for(let[g,h]of r.entries()){let y=f.get(g);y&&x.push({node:y,depth:h});}return {root:i,nodes:x,edges:p,truncated:u,totalNodes:x.length,totalEdges:p.length}}var he=["CALLS","IMPORTS","TYPE_REFERENCES"];async function ye(e,t){let n=await S(e),l=n.getQuery(),a=n.getDatabase(),{node:i}=await _(l,e,t);if(!i)return {root:null,totalImpacted:0,buckets:[]};let c=t.depth??2,s=t.maxResults??50,o=t.relationTypes??he,r=new Set([i.id]),d=[],p=[i.id];for(let u=1;u<=c&&!(p.length===0||r.size-1>=s);u++){let m=p.map(()=>"?").join(","),b=o.map(()=>"?").join(","),f=a.queryAll(`SELECT source, target, relation FROM edges WHERE target IN (${m}) AND relation IN (${b})`,[...p,...o]),x=[],g=new Set;for(let h of f)if(!r.has(h.source)&&!g.has(h.source)&&(g.add(h.source),r.add(h.source),x.push(h.source),r.size-1>=s))break;if(x.length>0){let h=x.slice(0,10),y=a.queryNodes({ids:h}),$=new Map(y.map(L=>[L.id,L])),se=h.map(L=>{let U=$.get(L);return {id:L,name:U?.name??"(unknown)",filePath:U?E(U.file_path):"(unknown)",relation:"CALLS"}});d.push({depth:u,count:x.length,sample:se});}p=x;}return {root:i,totalImpacted:r.size-1,buckets:d}}var be=["CALLS","IMPORTS","TYPE_REFERENCES","EXTENDS","IMPLEMENTS","METHOD_OVERRIDES"];async function xe(e,t){return O(e,t,"incoming")}async function Ee(e,t){return O(e,t,"outgoing")}async function O(e,t,n,l){let a=await S(e),i=a.getQuery(),c=a.getDatabase(),{node:s}=await _(i,e,t);if(!s)return {root:null,callers:[],truncated:false};let o=t.maxResults??20,r=t.relationTypes??be,d=i.queryNeighbors(s.id,{direction:n,relationTypes:r,limit:o+1}),p=[];for(let m of d.edges){let b=pe(m,s.id,c,n==="incoming"?"in":"out");b&&p.push(b);}let u=p.length>o;return {root:s,callers:u?p.slice(0,o):p,truncated:u}}async function Ne(e,t){if(!t.query)throw new R("explore requires a non-empty query","NOT_FOUND",{query:t.query});let l=await S(e);l.getQuery();l.getDatabase();let s=(await J(e,{query:t.query,file:t.file,kind:t.kind,intent:t.intent,maxResults:t.maxFiles??5,enableFts:true,enableEmbedding:true})).hits,o=new Map;for(let p of s){let u=E(p.filePath),m=o.get(u);m?m.push(p):o.set(u,[p]);}let r=t.maxSymbols??3,d=[];for(let[p,u]of o){let m=u.slice(0,r),b=[];for(let f of m){let x=await O(e,{name:f.name,file:p,kind:t.kind,maxResults:5},"incoming"),g=await O(e,{name:f.name,file:p,kind:t.kind,maxResults:5},"outgoing");b.push({node:{id:f.nodeId,name:f.name,ast_type:f.kind,language:"ts",file_path:f.filePath,start_line:f.startLine??0,end_line:f.endLine??0,text:""},callers:x.callers,callees:g.callers});}d.push({file:p,symbols:b});}return {query:t.query,entryPoints:d,totalHits:s.length}}async function Re(e,t){return await(await S(e)).getStatus()}async function Pe(e,t){return await(await S(e)).healthCheck()}var Z=Filesystem.toUnixPath;function Ce(e){let t=e.text??"";if(!t)return false;let n=t.slice(0,80);return /\bexport\s/.test(n)||/\bpublic\s/.test(n)?true:(false)}function Ie(e){let t=e.text??"";if(!t)return [];let n=t.slice(0,80),l=[];return /\basync\s/.test(n)&&l.push("async"),/\bstatic\s/.test(n)&&l.push("static"),/\babstract\s/.test(n)&&l.push("abstract"),/\breadonly\s/.test(n)&&l.push("readonly"),/\bconst\s/.test(n)&&l.push("const"),/\blet\s/.test(n)&&l.push("let"),l}function N(e){return {id:e.id,name:e.name,astType:e.ast_type,language:e.language,filePath:Z(e.file_path),startLine:e.start_line??0,endLine:e.end_line??0,isExported:Ce(e),modifiers:Ie(e)}}function T(e,t){return {id:e.id,source:e.source,target:e.target,relation:e.relation,direction:t}}function K(e){return e.map(t=>({node:{id:t.nodeId,name:t.name,astType:t.kind,language:"typescript",filePath:Z(t.filePath),startLine:t.startLine??0,endLine:t.endLine??0,isExported:false,modifiers:[]},source:t.source,score:t.score,snippet:(t.snippet??"").slice(0,200),edges:(t.edges??[]).slice(0,10).map(n=>T({...n}))}))}function j(){return {id:"",name:"",astType:"",language:"",filePath:"",startLine:0,endLine:0,isExported:false,modifiers:[]}}var $e=Log.create({service:"codebase-format-truncate"}),z="**`",Le="**",te=24e3,ne=25e3;async function D(e,t={}){let n=t.softLimit??te,l=t.hardCeiling??ne,a=t.toolName??"codebase",i=t.writeToDisk!==false;if(e.length<=n)return {content:e,truncated:false};let c=e.slice(0,l),s=c.lastIndexOf(`
2
- ${z}`),o=c.lastIndexOf(`
3
- `),r;s>l*.5?r=s:o>0?r=o:r=-1;let d=r>0?c.slice(0,r):c,u=d+"\n\n... (output truncated to budget; the source above is complete and verbatim \u2014 treat it as already Read. For any area not covered, make ANOTHER `<tool>` targeting those names \u2014 do NOT Read these files.)";if(!i)return {content:u,truncated:true,outputPath:"",hint:"Use Grep/Read to inspect the truncated sections.",info:`... ${e.length-d.length}/${e.length} characters truncated ...`};try{let m=await TruncateContent.truncate(e,{maxChars:d.length,direction:"head",label:`${a}-output`});return m.truncated?{content:u,truncated:!0,outputPath:m.outputPath,hint:TruncateContent.formatHint(m),info:`... ${m.removedLength}/${m.originalLength} characters truncated ...`}:{content:u,truncated:!0,outputPath:"",hint:"Use Grep/Read to inspect the truncated sections.",info:`... ${e.length-d.length}/${e.length} characters truncated ...`}}catch(m){return $e.warn("TruncateContent.truncate failed, returning without disk hint",{error:m instanceof Error?m.message:String(m)}),{content:u,truncated:true,outputPath:"",hint:"Use Grep/Read to inspect the truncated sections.",info:`... ${e.length-d.length}/${e.length} characters truncated ...`}}}function v(e,t={}){let n=t.softLimit??te,l=t.hardCeiling??ne;if(e.length<=n)return {content:e,truncated:false};let a=e.slice(0,l),i=a.lastIndexOf(`
4
- ${z}`),c=a.lastIndexOf(`
5
- `),s;i>l*.5?s=i:c>0?s=c:s=-1;let o=s>0?a.slice(0,s):a;return {content:o+`
6
-
7
- ... (output truncated; tail dropped at section boundary)`,truncated:true,outputPath:"",hint:"",info:`... ${e.length-o.length}/${e.length} characters truncated ...`}}function Fe(e,t=Date.now()){let n=Math.max(0,Math.floor((t-e)/1e3));return n>60?">60s ago":`${n}s ago`}function H(e,t){if(!e||e.length===0)return null;let n=e.filter(a=>t.has(a.path));return n.length===0?null:`\u26A0\uFE0F Index may be stale for: ${n.map(a=>`${a.path} (edited ${Fe(a.lastEventAt)})`).join(", ")}
8
-
9
- `}function w(e,t,n={}){return (re[e]??re.default).replace(/<(\w+)>/g,(a,i)=>i==="tool"?t:n[i]??`<${i}>`)}var re={search:`---
10
-
11
- > **Complete source for N files is included above \u2014 do NOT re-read them.**
12
- > If your question also needs files/symbols listed under "Not shown above" (or any area this call didn't cover), make ANOTHER \`<tool>\` targeting those names \u2014 it returns the same source with line numbers and is cheaper and more complete than reading.`,impact:"---\n\n> **Risk: <riskLevel>**. Before editing `<root>`, review d=1 first \u2014 those WILL BREAK.\n> Use `<tool>` to read full source of any direct caller.",context:"---\n\n> **Use `impact` for blast-radius analysis. Use `explore` to read source.**",default:`---
13
-
14
- > **Output truncated to budget; the content above is the source of truth.**
15
- > For more detail, call \`<tool>\` with refined parameters.`};async function M(e,t){let{pendingFiles:n,toolName:l,sync:a=false}=t;if(e.length===0)return k(l,"No matches found.","Try broader search terms, or use `explore` to read source.");let i=ke(e),c=new Set(i.keys()),s=[];s.push(H(n,c)??"");let o="[[codebase-search-summary]]";s.push(o+`
16
- `);let r=e.length;s.push(`**Files with matches:** ${i.size}
17
- `);for(let[m,b]of i){let f=b.map(y=>y.node.name),x=f.slice(0,5).join(", "),g=f.length>5?`, +${f.length-5} more`:"";s.push(`**\`${m}\`** \u2014 ${x}${g}
18
- `);let h=b[0]?.node.language??"";s.push("```"+h);for(let y of b)s.push(`L${y.node.startLine} ${y.snippet}`);s.push("```\n");}s.push(w("search",l,{}));let d=s.join(`
19
- `),p=`Found ${r} symbol${r===1?"":"s"} across ${i.size} file${i.size===1?"":"s"}.`,u=d.replace(o,p);return A(u,t,a)}async function q(e,t,n){let{pendingFiles:l,toolName:a,sync:i=false}=n;if(t.length===0||t.every(r=>r.count===0))return k(a,`No incoming edges for \`${e.name}\`.`,"This symbol has no callers \u2014 safe to refactor.");let c=t.reduce((r,d)=>r+d.count,0),s=we(c),o=[];o.push(H(l,new Set([e.filePath]))??""),o.push(`**Impact for \`${e.name}\`** (root: ${e.filePath}:${e.startLine}, total impacted: ${c})
20
- `);for(let r of t){o.push(`- **d=${r.depth}** (${r.count} nodes) \u2014 ${r.riskLabel}`);for(let d of r.samples.slice(0,5))o.push(` - \`${d.name}\` ${d.file}:${d.line} [${d.relation}]`);r.samples.length>5&&o.push(` - ... and ${r.samples.length-5} more`);}return o.push(w("impact",a,{root:e.name,riskLevel:s})),A(o.join(`
21
- `),n,i)}function we(e){return e>=100?"CRITICAL":e>=50?"HIGH":e>=10?"MEDIUM":"LOW"}function Q(e){return e===1?"WILL BREAK (direct callers)":e===2?"LIKELY AFFECTED (indirect)":"MAY NEED TESTING (transitive)"}async function Y(e,t){let{root:n,incoming:l,outgoing:a,neighbors:i}=e,{pendingFiles:c,toolName:s,sync:o=false}=t;if(l.length===0&&a.length===0&&i.length===0)return k(s,`No relations found for \`${n.name}\`.`,"This is a leaf node.");let r=[];r.push(H(c,new Set([n.filePath]))??""),r.push(`**Context for \`${n.name}\`** (${n.astType}, ${n.language}, ${n.filePath}:${n.startLine})
22
- `),r.push(`**Incoming** (${l.length}):`);for(let d of l.slice(0,10))r.push(`- ${d.source} \u2192 [${d.relation}] \u2192 \`${n.name}\``);l.length>10&&r.push(`- ... and ${l.length-10} more`),r.push(""),r.push(`**Outgoing** (${a.length}):`);for(let d of a.slice(0,10))r.push(`- \`${n.name}\` \u2192 [${d.relation}] \u2192 ${d.target}`);if(a.length>10&&r.push(`- ... and ${a.length-10} more`),r.push(""),i.length>0){r.push(`**Neighbors** (${i.length}):`);for(let d of i.slice(0,20))r.push(`- [d=${d.depth}] \`${d.node.name}\` (${d.node.astType}) ${d.node.filePath}:${d.node.startLine}`);i.length>20&&r.push(`- ... and ${i.length-20} more`),r.push("");}return r.push(w("context",s,{})),A(r.join(`
23
- `),t,o)}async function B(e,t,n){let{pendingFiles:l,toolName:a,sync:i=false}=n;if(!e.id)return k(a,"Node not found.","Check the node ID or use `search` to find it.");let c=t.filter(r=>r.direction==="in"),s=t.filter(r=>r.direction==="out"),o=[];o.push(H(l,new Set([e.filePath]))??""),o.push(`**Node: \`${e.name}\`**
24
- `),o.push(`- ID: \`${e.id}\``),o.push(`- Kind: ${e.astType}`),o.push(`- Language: ${e.language}`),o.push(`- Location: ${e.filePath}:${e.startLine}-${e.endLine}`),o.push(`- Exported: ${e.isExported}`),e.modifiers.length>0&&o.push(`- Modifiers: ${e.modifiers.join(", ")}`),o.push(""),o.push(`**Edges** (incoming: ${c.length} / outgoing: ${s.length}):`);for(let r of c.slice(0,5))o.push(`- \u2190 [${r.relation}] ${r.source}`);for(let r of s.slice(0,5))o.push(`- \u2192 [${r.relation}] ${r.target}`);return t.length>10&&o.push(`- ... and ${t.length-10} more`),o.push(w("default",a,{})),A(o.join(`
25
- `),n,i)}async function oe(e,t){let{entryPoints:n,totalHits:l,query:a}=e,{toolName:i,sync:c=false}=t;if(n.length===0)return k(i,`No matches for \`${a}\`.`,"Try broader search terms, or use `callers` / `callees` to traverse from a known symbol.");let s=[];s.push(`## Code Context
26
- `),s.push(`**Query:** ${a} `),s.push(`**Total hits:** ${l} `),s.push(`**Entry points:** ${n.length}
27
- `);for(let o of n){s.push(`**\`${o.file}\`** \u2014 ${o.symbols.length} symbol${o.symbols.length===1?"":"s"}
28
- `);for(let r of o.symbols){let d=(r.source??"").trim()||"(source not included)",p=r.node.language;if(s.push("```"+p),s.push(`L${r.node.startLine}-L${r.node.endLine} ${r.node.name} (${r.node.astType}${r.node.modifiers.length>0?`, ${r.node.modifiers.join(" ")}`:""})`),s.push(""),s.push(d),s.push("```\n"),r.callers.length>0){s.push(`**Callers of \`${r.node.name}\` (${r.callers.length}):**`);for(let u of r.callers.slice(0,5))s.push(`- [${u.relation}] \`${u.name}\` ${u.filePath}:${u.startLine}`);r.callers.length>5&&s.push(`- ... and ${r.callers.length-5} more`),s.push("");}if(r.callees.length>0){s.push(`**Callees of \`${r.node.name}\` (${r.callees.length}):**`);for(let u of r.callees.slice(0,5))s.push(`- [${u.relation}] \`${u.name}\` ${u.filePath}:${u.startLine}`);r.callees.length>5&&s.push(`- ... and ${r.callees.length-5} more`),s.push("");}}}return s.push(`---
29
- `),s.push(w("context",i,{})),A(s.join(`
30
- `),t,c)}function ke(e){let t=new Map;for(let n of e){let l=n.node.filePath,a=t.get(l);a?a.push(n):t.set(l,[n]);}return t}function k(e,t,n){return `**${e}**
31
-
32
- ${t}
33
-
34
- > **Tip:** ${n}`}async function A(e,t,n){let l={softLimit:t.softLimit,hardCeiling:t.hardCeiling,toolName:t.toolName,writeToDisk:n?false:t.writeToDisk};return (n?v(e,l):await D(e,l)).content}var Oe=Log.create({service:"codebase-format-render"});async function _e(e,t){if(e.length===0)return M([],t);let n=K(e);return M(n,t)}async function De(e,t,n){if(t.length===0)return q(N(e),[],n);let l=[{depth:1,count:t.length,riskLabel:Q(1),samples:t.slice(0,10).map(a=>({name:a.source.name,file:N(a.source).filePath,line:a.source.start_line??0,relation:a.relation}))}];return q(N(e),l,n)}async function ve(e,t,n,l,a){let i=N(e),c=t.map(r=>T(r,"in")),s=n.map(r=>T(r,"out")),o=l.map(r=>({node:N(r),depth:1}));return Y({root:i,incoming:c,outgoing:s,neighbors:o},a)}async function He(e,t,n){if(!e)return B(j(),[],n);let l=N(e),a=t.map(i=>{let c=i.target===e.id?"in":"out";return T(i,c)});return B(l,a,n)}async function Me(e,t){let n={query:e.query,totalHits:e.totalHits,entryPoints:e.entryPoints.map(l=>({file:l.file,symbols:l.symbols.map(a=>({node:N(a.node),source:a.node.text??"",callers:a.callers.map(i=>({name:i.name,filePath:i.filePath,startLine:i.startLine,relation:i.relation})),callees:a.callees.map(i=>({name:i.name,filePath:i.filePath,startLine:i.startLine,relation:i.relation}))}))}))};return oe(n,t)}Oe.debug("format/render.ts loaded");export{De as A,ve as B,He as C,Me as D,R as a,P as b,F as c,J as d,me as e,fe as f,ye as g,xe as h,Ee as i,Ne as j,Re as k,Pe as l,N as m,T as n,K as o,j as p,z as q,Le as r,D as s,v as t,M as u,q as v,Q as w,Y as x,B as y,_e as z};