@easbot/codebase 0.3.22 → 0.3.24

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 (44) hide show
  1. package/dist/chunks/chunk-4HJ7RFP7.cjs +1 -0
  2. package/dist/chunks/chunk-5E5YY2J3.cjs +47 -0
  3. package/dist/chunks/chunk-AIUVBWJX.mjs +47 -0
  4. package/dist/chunks/{chunk-T2ZV7FU4.mjs → chunk-EWVG3S6R.mjs} +22 -22
  5. package/dist/chunks/chunk-NF6CVHEK.cjs +203 -0
  6. package/dist/chunks/{chunk-ZCH5GLXA.cjs → chunk-PLI6SXTS.cjs} +22 -22
  7. package/dist/chunks/chunk-SQJ64NFE.mjs +58 -0
  8. package/dist/chunks/chunk-STDI2Q67.mjs +203 -0
  9. package/dist/chunks/chunk-WC5CUSXD.cjs +58 -0
  10. package/dist/chunks/chunk-ZPEE2LSX.mjs +1 -0
  11. package/dist/chunks/cli-handler-SF3CJR3N.mjs +1 -0
  12. package/dist/chunks/cli-handler-WMBILZ4H.cjs +1 -0
  13. package/dist/chunks/code-base-DJZICYWH.cjs +1 -0
  14. package/dist/chunks/{code-base-SNQ2LWU6.mjs → code-base-Y6HLPDF3.mjs} +1 -1
  15. package/dist/chunks/database-manager-MOJW62MZ.cjs +1 -0
  16. package/dist/chunks/database-manager-X7H4U45I.mjs +1 -0
  17. package/dist/chunks/file-watcher-QS442D52.cjs +1 -0
  18. package/dist/chunks/file-watcher-X56TEWNY.mjs +1 -0
  19. package/dist/chunks/stdio-server-OHQSGNMK.cjs +47 -0
  20. package/dist/chunks/stdio-server-OJGV4CSS.mjs +47 -0
  21. package/dist/cli.cjs +1 -1
  22. package/dist/cli.mjs +1 -1
  23. package/dist/index.cjs +1 -1
  24. package/dist/index.d.cts +13 -1
  25. package/dist/index.d.ts +13 -1
  26. package/dist/index.mjs +1 -1
  27. package/package.json +10 -10
  28. package/dist/chunks/chunk-22NIJF4D.mjs +0 -188
  29. package/dist/chunks/chunk-2DGOSNEH.mjs +0 -34
  30. package/dist/chunks/chunk-HRFLFP6O.cjs +0 -1
  31. package/dist/chunks/chunk-MRPT44H3.cjs +0 -47
  32. package/dist/chunks/chunk-QQXDOGRV.mjs +0 -1
  33. package/dist/chunks/chunk-R26JQOPF.mjs +0 -47
  34. package/dist/chunks/chunk-VF3U3DPM.cjs +0 -34
  35. package/dist/chunks/chunk-ZK7YSBLG.cjs +0 -188
  36. package/dist/chunks/cli-handler-2PSSL33N.mjs +0 -1
  37. package/dist/chunks/cli-handler-EYQH2TDL.cjs +0 -1
  38. package/dist/chunks/code-base-2ACRJ2UT.cjs +0 -1
  39. package/dist/chunks/database-manager-MG7JMWGN.mjs +0 -1
  40. package/dist/chunks/database-manager-ZDJSRVBR.cjs +0 -1
  41. package/dist/chunks/file-watcher-HVST5PAC.cjs +0 -1
  42. package/dist/chunks/file-watcher-LCQ55MPE.mjs +0 -1
  43. package/dist/chunks/stdio-server-7CFU5X3T.cjs +0 -47
  44. package/dist/chunks/stdio-server-UNJPQYXA.mjs +0 -47
@@ -1,47 +0,0 @@
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};