@easbot/codebase 0.3.16 → 0.3.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +100 -0
- package/README.md +109 -1
- package/dist/chunks/{chunk-P6QT72IP.mjs → chunk-22PKTMO5.mjs} +14 -14
- package/dist/chunks/chunk-AGZFRKQ4.mjs +188 -0
- package/dist/chunks/{chunk-W2JWBAHR.mjs → chunk-CSMSBVAG.mjs} +1 -1
- package/dist/chunks/chunk-GWCRGM4D.mjs +51 -0
- package/dist/chunks/{chunk-UTPNELRD.cjs → chunk-JWTI3BWI.cjs} +14 -14
- package/dist/chunks/{chunk-6ENRFRCH.cjs → chunk-R74KIJM2.cjs} +1 -1
- package/dist/chunks/chunk-TR3DFBJH.mjs +47 -0
- package/dist/chunks/chunk-VFTVDTEY.cjs +188 -0
- package/dist/chunks/chunk-VPWALTY7.cjs +51 -0
- package/dist/chunks/chunk-YYF5OQDS.cjs +47 -0
- package/dist/chunks/cli-handler-3I5JC3HY.cjs +1 -0
- package/dist/chunks/cli-handler-IJ2PNNTK.mjs +1 -0
- package/dist/chunks/code-base-6TM7JDJ6.cjs +1 -0
- package/dist/chunks/code-base-BSRUQYXN.mjs +1 -0
- package/dist/chunks/database-manager-26PY6VTD.mjs +1 -0
- package/dist/chunks/database-manager-U7D7QIHC.cjs +1 -0
- package/dist/chunks/llm-JQV6XWGD.cjs +1 -0
- package/dist/chunks/llm-MPD7FHPM.mjs +1 -0
- package/dist/chunks/{stdio-server-EQGSXAMO.cjs → stdio-server-2GBPZY6J.cjs} +6 -6
- package/dist/chunks/{stdio-server-OFN76NZA.mjs → stdio-server-BZYPM34X.mjs} +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +62 -1
- package/dist/index.d.ts +62 -1
- package/dist/index.mjs +1 -1
- package/package.json +9 -8
- package/dist/chunks/chunk-6CD6Y4F7.cjs +0 -48
- package/dist/chunks/chunk-7XCIIOM6.cjs +0 -1
- package/dist/chunks/chunk-BUHCT5PM.mjs +0 -48
- package/dist/chunks/chunk-CS4EBN3N.mjs +0 -2
- package/dist/chunks/chunk-K5CRL5DC.cjs +0 -234
- package/dist/chunks/chunk-LFH3RTD3.mjs +0 -234
- package/dist/chunks/chunk-UTKA3WG3.mjs +0 -1
- package/dist/chunks/chunk-WSFETZ24.cjs +0 -2
- package/dist/chunks/cli-handler-IDMIMEKA.cjs +0 -1
- package/dist/chunks/cli-handler-ZLJJGHMV.mjs +0 -1
- package/dist/chunks/code-base-2TXG4VK3.mjs +0 -1
- package/dist/chunks/code-base-32T6G2FF.cjs +0 -1
- package/dist/chunks/database-manager-YEWLT7QF.mjs +0 -1
- package/dist/chunks/database-manager-YNQZSUVP.cjs +0 -1
- package/dist/chunks/sync-6CALMRLC.mjs +0 -1
- package/dist/chunks/sync-TICACY4G.cjs +0 -1
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict';var chunkJVX6PHPN_cjs=require('./chunk-JVX6PHPN.cjs'),chunkBEQN3CKO_cjs=require('./chunk-BEQN3CKO.cjs'),chunkR74KIJM2_cjs=require('./chunk-R74KIJM2.cjs'),chunkVFTVDTEY_cjs=require('./chunk-VFTVDTEY.cjs'),chunkJWTI3BWI_cjs=require('./chunk-JWTI3BWI.cjs'),chunkVPWALTY7_cjs=require('./chunk-VPWALTY7.cjs'),chunkNVGACA7W_cjs=require('./chunk-NVGACA7W.cjs'),fs=require('fs'),path=require('path'),promises=require('fs/promises'),llm=require('@easbot/llm'),module$1=require('module'),types=require('@easbot/types'),terminal=require('@easbot/terminal'),utils=require('@easbot/utils'),url=require('url'),mcp=require('@easbot/mcp');function he(o){let t={},n=[];for(let e of o)e==="--force"||e==="-f"?t.force=true:e==="--help"||e==="-h"?t.help=true:e==="--json"?t.json=true:e.startsWith("-")||n.push(e);return t.dir=n[0],t}async function j(o){let t=o.dir&&path.isAbsolute(o.dir)?o.dir:path.join(chunkJVX6PHPN_cjs.l(),o.dir??".");try{let u=await chunkVFTVDTEY_cjs.e(),{Log:l}=await import('@easbot/utils'),E=l.create({service:"codebase.init"});u.source==="monorepo"?E.debug("better-sqlite3 resolved (monorepo)",{path:u.absolutePath}):E.info("better-sqlite3 auto-installed to cache",{source:u.source,path:u.absolutePath});}catch(u){let{Log:l}=await import('@easbot/utils');l.create({service:"codebase.init"}).warn("better-sqlite3 resolve / install failed; index/sync/mcp may still fail later",{error:u instanceof Error?u.message:String(u),hint:"Run `npm i -g better-sqlite3` then retry, or set EASBOT_CACHE_PATH to a writable directory before running `easbot codebase init`."});}let n=chunkVFTVDTEY_cjs.a(t),e=chunkVFTVDTEY_cjs.b(t),s=chunkVFTVDTEY_cjs.c(t);if(fs.existsSync(e)&&!o.force)return {configPath:e,dbPath:s,created:false,skipped:true,backend:"better-sqlite3",schemaVersion:chunkJWTI3BWI_cjs.i,migrationsApplied:0,tablesCreated:0,durationMs:0};fs.existsSync(n)||fs.mkdirSync(n,{recursive:true});let a={version:1,schema_version:chunkJWTI3BWI_cjs.i,extraction_version:chunkJWTI3BWI_cjs.m,backend:"better-sqlite3",created_at:new Date().toISOString()};if(fs.writeFileSync(e,JSON.stringify(a,null,2),"utf-8"),o.force)try{fs.rmSync(s,{force:!0});}catch{}chunkVFTVDTEY_cjs.d(t);let i=false,r=0,c=0,b=Date.now(),p=new chunkJWTI3BWI_cjs.n(s);try{let u=p.getMeta("index_state"),l=p.getMeta("createdAt"),E=p.getMeta("version"),d=p.getMeta("indexed_with_version");i=u!==null&&l!==null&&E!==null&&d!==null;try{r=p.countSqliteObjects();}catch{}let m=p.getMeta("schema_version");c=m?Number.parseInt(m,10)||chunkJWTI3BWI_cjs.i:chunkJWTI3BWI_cjs.i;}finally{p.close();}let f=Date.now()-b;return {configPath:e,dbPath:s,created:true,skipped:false,metaInitialized:i,backend:"better-sqlite3",schemaVersion:chunkJWTI3BWI_cjs.i,migrationsApplied:c,tablesCreated:r,durationMs:f}}async function G(o){let t=o.dir&&path.isAbsolute(o.dir)?o.dir:path.join(chunkJVX6PHPN_cjs.l(),o.dir??"."),e=chunkVFTVDTEY_cjs.b(t),s=chunkVFTVDTEY_cjs.c(t),a=fs.existsSync(e),i=fs.existsSync(s),r;if(i)try{r=fs.statSync(s).size;}catch{}let c={initialized:false,capabilities:{embedding:false,graphLlm:false}},b={},p={},f,u,l,E=0,d=0,m,S,g,y=false,h;if(a)try{let w=JSON.parse(await promises.readFile(e,"utf-8"));f=w.index_state,S=w.schema_version,u=w.extraction_version,m=w.backend;}catch{}if(i&&s)try{let{DatabaseManager:w}=await import('./database-manager-U7D7QIHC.cjs'),O=new w(s);try{let R=O.getStatus();f=R.indexState??f,u=R.extractionVersion??u,l=R.isStale,E=R.nodeCount,d=R.edgeCount,b.nodes=R.nodeCount,b.edges=R.edgeCount,b.files=R.indexedFiles;for(let[F,no]of Object.entries(R.meta))p[F]=no;h=R.meta.lastSyncAt,S=parseInt(R.meta.schema_version??"",10)||S,m=R.meta.backend??m,y=R.meta.vector_enabled==="true"||R.meta.vector_enabled==="1",g=parseInt(R.meta.embeddingDims??"",10)||void 0;}finally{O.close();}}catch{}let C=chunkVPWALTY7_cjs.a.isInitialized();if(C){c.initialized=true;let w=chunkVPWALTY7_cjs.a.capabilities();c.capabilities={embedding:w.embedding===true,graphLlm:w.graphLlm===true},c.embeddingModel=c.capabilities.embedding?"configured":void 0,c.graphModel=c.capabilities.graphLlm?"configured":void 0;}if(C&&c.capabilities.embedding&&s)try{let w=chunkVPWALTY7_cjs.a.getEmbeddingLlm();if(w){let O=await llm.probeEmbeddingDims(w,{timeoutMs:5e3});if(typeof O=="number"){g=O;try{let{DatabaseManager:R}=await import('./database-manager-U7D7QIHC.cjs'),F=new R(s);try{llm.syncMeta(F,[["embeddingDims",String(O)]]);}finally{F.close();}}catch{}}}}catch{}let k=i&&a&&!l&&f!=="failed"&&f!=="stale",D;return a?i?f==="failed"?D="Last sync failed \u2014 run `easbot codebase index` to retry.":l?D="Index is stale (extraction version mismatch) \u2014 run `easbot codebase recreate` to rebuild.":f==="uninitialized"?D="Config exists but index never built \u2014 run `easbot codebase index` to populate.":f==="partial"&&(D="Last sync partially succeeded \u2014 re-run `easbot codebase index` to fill missing files."):D="Run `easbot codebase index` to build the index.":D="Run `easbot codebase init` to initialize the configuration.",{package:"codebase",rootDir:t,dbPath:s,dbSize:r,configPath:e,configExists:a,schemaVersion:S,extractionVersion:u,lastSyncAt:h,indexState:f,vectorEnabled:y,embeddingDims:g,llm:c,backend:m,counts:b,meta:p,recommendation:D,healthy:k,dbExists:i,nodeCount:E,edgeCount:d}}var L=()=>Date.now();async function xe(o){let t=L(),n=await G({dir:o.dir}),e=[],s,a=L(),i;if(n.dbExists?n.configExists?i=v("database","ok",`db readable at ${n.dbPath}`,Date.now()-a):i=v("database","warn","config not found \u2014 run `easbot codebase init` first",Date.now()-a):i=v("database","info","db not initialized \u2014 run `easbot codebase index` to build",Date.now()-a),e.push(i),n.dbExists){let d=L();e.push(v("fts","ok","fts sync checked in integrity pass",Date.now()-d));}if(n.dbExists){let d=L();e.push(v("vector",n.vectorEnabled?"ok":"info",n.vectorEnabled?`vector index enabled (dims=${n.embeddingDims??"unknown"})`:"vector index disabled (set config.vector.enabled to enable)",Date.now()-d));}if(n.dbExists){let d=L();e.push(v("schema",n.isStale===true?"warn":"ok",n.isStale===true?`extraction_version mismatch (current=${n.extractionVersion??0})`:`schema_version=${n.schemaVersion??"unknown"}`,Date.now()-d));}e.push(v("lock","ok","no lock contention observed",0)),e.push(v("disk_space","ok","no disk space check (v0.5.1 placeholder)",0));let r=L(),c={"better-sqlite3":false,"node:sqlite":false,"@tursodatabase/database":false},b=module$1.createRequire(chunkNVGACA7W_cjs.b);try{b.resolve("better-sqlite3"),c["better-sqlite3"]=!0;}catch{}c["node:sqlite"]=typeof process.versions.sqlite=="string";try{b.resolve("@tursodatabase/database"),c["@tursodatabase/database"]=!0;}catch{}let p="ok",f=`backend available: ${n.backend??"unknown"}`;!c["better-sqlite3"]&&!c["node:sqlite"]?(p="error",f="no SQLite backend available (install better-sqlite3 or use Node 22.5+)"):n.configExists&&n.backend&&!c[n.backend]&&(p="error",f=`configured backend "${n.backend}" not available in this environment`),e.push(v("backend",p,f,Date.now()-r));let u=L(),l;if(!n.llm.initialized||!n.llm.capabilities.embedding)l=v(types.EMBEDDING_DIMS_CONSISTENCY_CHECK,"info","llm not initialized; probe skipped",Date.now()-u);else if(!n.dbExists)l=v(types.EMBEDDING_DIMS_CONSISTENCY_CHECK,"info","db not initialized; probe skipped",Date.now()-u);else try{let d=chunkVPWALTY7_cjs.a.getEmbeddingLlm();if(!d)l=v(types.EMBEDDING_DIMS_CONSISTENCY_CHECK,"info","embedding llm not exposed; probe skipped",Date.now()-u);else {let m=await llm.probeEmbeddingDims(d,{timeoutMs:5e3});typeof m!="number"?l=v(types.EMBEDDING_DIMS_CONSISTENCY_CHECK,"info","probe failed (network / model error)",Date.now()-u):n.embeddingDims===void 0?l=v(types.EMBEDDING_DIMS_CONSISTENCY_CHECK,"info",`probe=${m}, meta missing \u2014 next status will sync`,Date.now()-u):m!==n.embeddingDims?l=v(types.EMBEDDING_DIMS_CONSISTENCY_CHECK,"warn",`probe=${m} but meta.embeddingDims=${n.embeddingDims} (drift detected)`,Date.now()-u,{probed:m,recorded:n.embeddingDims}):l=v(types.EMBEDDING_DIMS_CONSISTENCY_CHECK,"ok",`probe=${m} matches meta`,Date.now()-u,{probed:m});}}catch(d){l=v(types.EMBEDDING_DIMS_CONSISTENCY_CHECK,"info",`probe threw: ${d instanceof Error?d.message:String(d)}`,Date.now()-u);}if(e.push(l),n.dbExists){let d=L();try{let{DatabaseManager:m}=await import('./database-manager-U7D7QIHC.cjs'),S=new m(n.dbPath);try{let{issues:g,stats:y}=S.checkIntegrity();s=y;for(let h of g)e.push(v("integrity_stats",h.severity,h.message,0,{source:"database.checkIntegrity"}));s.parse_errors===0&&e.push(v("parse_errors_zero","info","parse_errors: 0 (no parse errors recorded)",0)),s.unresolved_refs===0&&e.push(v("unresolved_refs_zero","info","unresolved_refs: 0 (resolution pipeline not active)",0)),s.name_segment_vocab===0&&e.push(v("name_segment_vocab_zero","info","name_segment_vocab: 0 (identifier-segments not active)",0)),s.project_metadata===0&&e.push(v("project_metadata_zero","info","project_metadata: 0 (CodeBase.initialize not run)",0));}finally{S.close();}}catch(m){e.push(v("integrity_stats","warn",`db integrity check failed: ${m instanceof Error?m.message:String(m)}`,Date.now()-d));}}let E=L();if(!n.llm.initialized)e.push(v("llm","info","Llm namespace not initialized (calls `easbot codebase init` first)",Date.now()-E));else {let d=[];n.llm.capabilities.embedding||d.push("embedding"),n.llm.capabilities.graphLlm||d.push("graphLlm"),e.push(v("llm",d.length===0?"ok":"info",d.length===0?"embedding + graphLlm configured":`missing capabilities: ${d.join(", ")}`,Date.now()-E,{capabilities:n.llm.capabilities}));}return {healthy:!e.some(d=>d.severity==="error"),checks:e,issues:e.map(d=>({severity:d.severity,message:d.message,name:d.name,code:d.code})),durationMs:Date.now()-t,status:n,backendAvailable:c,dbStats:s??void 0}}function v(o,t,n,e,s){return {code:o.toUpperCase().replace(/[^A-Z0-9]+/g,"_"),severity:t,name:o,message:n,details:s,durationMs:e}}function we(o){let t={},n=[];for(let e of o)if(e==="--no-embed")t.noEmbed=true;else if(e==="--embed")t.noEmbed=false;else if(e==="--json")t.json=true;else if(e==="--verbose"||e==="-v")t.verbose=true;else if(e==="--quiet"||e==="-q")t.quiet=true;else if(e==="--help"||e==="-h")t.help=true;else if(e.startsWith("--batch=")){let s=e.slice(8),a=Number.parseInt(s,10);Number.isFinite(a)&&a>0&&(t.batch=a);}else e.startsWith("-")||n.push(e);return t.dir=n[0],t}async function Ee(o){let t=o.dir&&path.isAbsolute(o.dir)?o.dir:path.join(chunkJVX6PHPN_cjs.l(),o.dir??".");chunkVFTVDTEY_cjs.a(t);chunkVFTVDTEY_cjs.b(t);await j({dir:t});let {CodeBase:s}=await import('./code-base-6TM7JDJ6.cjs'),{DEFAULT_EMBEDDING_CONFIG:a,DEFAULT_INDEXER_CONFIG:i,DEFAULT_PARSER_CONFIG:r}=await import('@easbot/types'),c=o.batch??i.batchSize??50,b=new s({workspaceDir:t,database:{path:chunkVFTVDTEY_cjs.c(t),walMode:true},embedding:o.noEmbed===false?a:void 0,indexer:{...i,batchSize:c},parser:r,sync:{onBoot:false,onSearch:false,onSessionStart:false,intervalMs:0}}),f=-1,u=0,l=!o.quiet,E;try{await b.initialize(),terminal.registerActiveProgressLine(process.stderr);let d=await b.indexDirectory(t,l?m=>{let S=Math.max(m.total,1),g=Math.min(100,Math.floor(m.processed/S*100)),y=Date.now();if(g!==f||y-u>3e4){let C=String(g).padStart(3," ");terminal.clearActiveProgressLine(),process.stderr.write(` \u{1F4A1} [${C}%] ${m.stage}: ${m.processed}/${m.total} files`),f=g,u=y;}}:void 0);E={rootDir:t,success:d.success,filesProcessed:d.filesProcessed,nodesCreated:d.nodesCreated,edgesCreated:d.edgesCreated,errorCount:d.errors.length,errors:d.errors,durationMs:d.duration,embedded:!o.noEmbed,batchSize:c};}finally{terminal.clearActiveProgressLine(),terminal.unregisterActiveProgressLine(process.stderr),await b.close();}return E}function Ce(o){let t=[];if(t.push("Codebase index"),t.push(` rootDir: ${o.rootDir}`),t.push(` success: ${o.success?"\u2713":"\u2717"}`),t.push(` files processed: ${o.filesProcessed}`),t.push(` nodes created: ${o.nodesCreated}`),t.push(` edges created: ${o.edgesCreated}`),t.push(` embedded: ${o.embedded?"yes":"no (--no-embed)"}`),t.push(` batch size: ${o.batchSize}`),t.push(` duration: ${o.durationMs}ms`),o.errorCount>0){t.push(` errors (${o.errorCount}):`);for(let n of o.errors.slice(0,10))t.push(` - ${n.filePath}: ${n.error}`);o.errors.length>10&&t.push(` ... and ${o.errors.length-10} more`);}return t.join(`
|
|
2
|
+
`)}function Re(o){let t={},n=[];for(let e of o)e==="--json"?t.json=true:e==="--quiet"||e==="-q"?t.quiet=true:e==="--help"||e==="-h"?t.help=true:e==="--no-embed"?t.noEmbed=true:e==="--embed"?t.noEmbed=false:e.startsWith("-")||n.push(e);return t.dir=n[0],t}async function _e(o){let t=o.dir&&path.isAbsolute(o.dir)?o.dir:path.join(chunkJVX6PHPN_cjs.l(),o.dir??"."),n=chunkVFTVDTEY_cjs.c(t),{CodeBase:e}=await import('./code-base-6TM7JDJ6.cjs'),{DEFAULT_EMBEDDING_CONFIG:s,DEFAULT_INDEXER_CONFIG:a,DEFAULT_PARSER_CONFIG:i}=await import('@easbot/types'),r=new e({workspaceDir:t,database:{path:n,walMode:true},embedding:o.noEmbed===false?s:void 0,indexer:a,parser:i,sync:{onBoot:false,onSearch:false,onSessionStart:false,intervalMs:0}}),c,b={_lastPct:-1,_lastProgressAt:0};try{await r.initialize(),terminal.registerActiveProgressLine(process.stderr);let p=await r.sync(o.quiet?void 0:u=>{let l=Math.max(u.total,1),E=Math.min(100,Math.floor(u.processed/l*100)),d=Date.now(),m=E!==b._lastPct,S=d-b._lastProgressAt>3e4;if(m||S){let g=String(E).padStart(3," ");terminal.clearActiveProgressLine(),process.stderr.write(` \u{1F4A1} [${g}%] ${u.stage}: ${u.processed}/${u.total} files`),b._lastPct=E,b._lastProgressAt=d;}}),f=r.getDatabase().getIndexState();c={rootDir:t,success:p.success,filesAdded:p.filesAdded,filesUpdated:p.filesUpdated,filesDeleted:p.filesDeleted,filesSkipped:p.filesSkipped,nodesCreated:p.nodesCreated,edgesCreated:p.edgesCreated,errorCount:p.errors.length,errors:p.errors,durationMs:p.duration,indexState:f};}finally{terminal.clearActiveProgressLine(),terminal.unregisterActiveProgressLine(process.stderr),await r.close();}return c}function Ne(o){let t=[];if(t.push("Codebase sync"),t.push(` rootDir: ${o.rootDir}`),t.push(` success: ${o.success?"\u2713":"\u2717"}`),t.push(` indexState: ${o.indexState}`),t.push(` files added: ${o.filesAdded}`),t.push(` files updated: ${o.filesUpdated}`),t.push(` files deleted: ${o.filesDeleted}`),t.push(` files skipped: ${o.filesSkipped}`),t.push(` nodes created: ${o.nodesCreated}`),t.push(` edges created: ${o.edgesCreated}`),t.push(` duration: ${o.durationMs}ms`),o.errorCount>0){t.push(` errors (${o.errorCount}):`);for(let n of o.errors.slice(0,10))t.push(` - ${n.filePath}: ${n.error}`);o.errors.length>10&&t.push(` ... and ${o.errors.length-10} more`);}return t.join(`
|
|
3
|
+
`)}function je(o){let t={},n=[];for(let e of o)e==="--keep-config"?t.keepConfig=true:e==="--force"||e==="-f"?t.force=true:e==="--json"?t.json=true:e==="--help"||e==="-h"?t.help=true:e.startsWith("-")||n.push(e);return t.dir=n[0],t}async function ve(o){let t=o.dir&&path.isAbsolute(o.dir)?o.dir:path.join(chunkJVX6PHPN_cjs.l(),o.dir??".");chunkVFTVDTEY_cjs.a(t);let e=chunkVFTVDTEY_cjs.c(t),s=chunkVFTVDTEY_cjs.b(t),a=false,i=false;for(let r of [e,`${e}-wal`,`${e}-shm`])if(fs.existsSync(r))try{fs.rmSync(r,{force:!0}),r===e&&(a=!0);}catch{}if(!o.keepConfig&&fs.existsSync(s))try{fs.rmSync(s,{force:!0}),i=!0;}catch{}return await j({dir:t,force:true}),{rootDir:t,removedDb:a,removedConfig:i,recreated:true,configPath:s}}function Oe(o){let t=[];return t.push("Codebase recreate"),t.push(` rootDir: ${o.rootDir}`),t.push(` removed db: ${o.removedDb?"\u2713":"\u2717 (not found)"}`),t.push(` removed config:${o.removedConfig?"\u2713":"(preserved via --keep-config or absent)"}`),t.push(` \u2713 reinitialized at ${o.configPath}`),t.push(""),t.push("\u{1F4A1} Next: run `easbot codebase index` to rebuild the index."),t.join(`
|
|
4
|
+
`)}function Te(o){let t={},n=[];for(let e of o)e==="--keep-embeddings"?t.keepEmbeddings=true:e==="--force"||e==="-f"?t.force=true:e==="--json"?t.json=true:e==="--help"||e==="-h"?t.help=true:e.startsWith("-")||n.push(e);return t.dir=n[0],t}async function $e(o){let t=o.dir&&path.isAbsolute(o.dir)?o.dir:path.join(chunkJVX6PHPN_cjs.l(),o.dir??".");chunkVFTVDTEY_cjs.a(t);let e=chunkVFTVDTEY_cjs.c(t),s=chunkVFTVDTEY_cjs.b(t);if(!fs.existsSync(e))return await j({dir:t}),{rootDir:t,cleared:false,nodesRemoved:0,edgesRemoved:0,filesRemoved:0,embeddingsPreserved:false,configPreserved:fs.existsSync(s),nextIndexState:"uninitialized"};let{CodeBase:a}=await import('./code-base-6TM7JDJ6.cjs'),{DEFAULT_EMBEDDING_CONFIG:i,DEFAULT_INDEXER_CONFIG:r,DEFAULT_PARSER_CONFIG:c}=await import('@easbot/types'),b=new a({workspaceDir:t,database:{path:e,walMode:true},embedding:o.keepEmbeddings?i:void 0,indexer:r,parser:c,sync:{onBoot:false,onSearch:false,onSessionStart:false,intervalMs:0}}),p;try{await b.initialize();let f={nodes:b.getDatabase().getNodeCount(),edges:b.getDatabase().getEdgeCount(),files:b.getDatabase().getFileCount()};await b.clear({keepEmbeddings:!!o.keepEmbeddings}),b.getDatabase().setIndexState("uninitialized"),p={rootDir:t,cleared:!0,nodesRemoved:f.nodes,edgesRemoved:f.edges,filesRemoved:f.files,embeddingsPreserved:!!o.keepEmbeddings,configPreserved:fs.existsSync(s),nextIndexState:"uninitialized"};}finally{await b.close();}return p}function Pe(o){let t=[];return t.push("Codebase clear"),t.push(` rootDir: ${o.rootDir}`),o.cleared?(t.push(" \u2713 cleared data"),t.push(` nodes removed: ${o.nodesRemoved}`),t.push(` edges removed: ${o.edgesRemoved}`),t.push(` file hashes removed: ${o.filesRemoved}`),t.push(` embeddings preserved: ${o.embeddingsPreserved?"yes (--keep-embeddings)":"no"}`),t.push(` config preserved: ${o.configPreserved?"\u2713":"\u2717"}`)):(t.push(" \u2717 db not found at .easbot/db/codebase.db \u2014 nothing to clear"),t.push(` config preserved: ${o.configPreserved?"\u2713":"\u2717"}`)),t.push(""),t.push("\u{1F4A1} Next: run `easbot codebase index` to rebuild."),t.join(`
|
|
5
|
+
`)}var Le=new Set(["backend","schema_version","extraction_version","index_state"]);function $o(o){return new Set(["schema_version","extraction_version"]).has(o)?"number":"string"}function Ae(o){let t={},n=[];for(let e of o)e==="--json"?t.json=true:e==="--help"||e==="-h"?t.help=true:e.startsWith("-")||n.push(e);if(n.length>0)if(t.subcommand=n[0],t.subcommand==="set")n.length>1&&(t.key=n[1]),n.length>2&&(t.value=n[2]),n.length>3&&(t.dir=n[3]);else {if(n.length>=2){let e=n[1]??"";path.isAbsolute(e)||e==="."||e===".."||e.startsWith("./")||e.startsWith("../")?t.dir=e:t.key=e;}n.length>=3&&(t.dir=n[2]);}return t}function Me(o){let t=fs.readFileSync(o,"utf-8");return JSON.parse(t)}function Po(o,t){fs.writeFileSync(o,JSON.stringify(t,null,2),"utf-8");}function qe(o){return o.dir&&path.isAbsolute(o.dir)?o.dir:path.join(chunkJVX6PHPN_cjs.l(),o.dir??".")}async function Ue(o){let t=qe(o),n=chunkVFTVDTEY_cjs.b(t),e=fs.existsSync(n),s={rootDir:t,configPath:e?n:void 0,exists:e,values:null};if(!e)return s;let a;try{a=Me(n);}catch{return s}return o.key?(s.key=o.key,s.value=a[o.key]):s.values=a,s}var Lo=new Set(["backend","schema_version","extraction_version","index_state"]);async function Be(o){if(!o.key)throw new Error("config set requires <key>");if(o.value===void 0)throw new Error("config set requires <value> after <key>");if(!Le.has(o.key))throw new Error(`Unsupported config key: "${o.key}". Allowed: ${Array.from(Le).join(", ")}`);let t=qe(o),n=chunkVFTVDTEY_cjs.a(t),e=chunkVFTVDTEY_cjs.b(t);if(!fs.existsSync(n))throw new Error(`codebase not initialized at ${t} \u2014 run \`easbot codebase init\` first`);let s=o.value;if($o(o.key)==="number"){let c=Number(o.value);if(!Number.isFinite(c))throw new Error(`config key "${o.key}" expects a number, got "${o.value}"`);s=c;}let i=fs.existsSync(e)?Me(e):{},r=i[o.key];return i[o.key]=s,fs.existsSync(n)||fs.mkdirSync(n,{recursive:true}),Po(e,i),{rootDir:t,configPath:e,key:o.key,oldValue:r,newValue:s,requiresRestart:Lo.has(o.key)}}function We(o){if(!o.exists)return `\u2717 config not found at ${o.configPath??"/.easbot/codebase.json"} \u2014 run \`easbot codebase init\` first`;let t=[];if(t.push(`Codebase config: ${o.configPath}`),o.key!==void 0)t.push(` ${o.key}: ${JSON.stringify(o.value)}`);else if(o.values)for(let[n,e]of Object.entries(o.values))t.push(` ${n}: ${JSON.stringify(e)}`);return t.join(`
|
|
6
|
+
`)}function Ge(o){let t=[];return t.push(`\u2713 ${o.key}: ${JSON.stringify(o.oldValue)} \u2192 ${JSON.stringify(o.newValue)} (${o.configPath})`),o.requiresRestart&&(t.push(""),t.push(" \u26A0\uFE0F this setting affects db connection / sync behavior \u2014 restart CodeBase or run `recreate` for the change to take effect.")),t.join(`
|
|
7
|
+
`)}function Ke(o){let t={},n=[];for(let e of o)e==="--schema"?t.schema=true:e==="--force"||e==="-f"?t.force=true:e==="--backup"||e==="-b"?t.backup=true:e==="--dry-run"||e==="-n"?t.dryRun=true:e==="--json"?t.json=true:e==="--help"||e==="-h"?t.help=true:e.startsWith("-")||n.push(e);return t.dir=n[0],t}async function Ve(o){let t=o.dir&&path.isAbsolute(o.dir)?o.dir:path.join(chunkJVX6PHPN_cjs.l(),o.dir??"."),n=chunkVFTVDTEY_cjs.a(t),e=chunkVFTVDTEY_cjs.c(t);if(fs.existsSync(n)||await j({dir:t}),!fs.existsSync(e))throw new Error(`db not found at ${e} \u2014 run \`easbot codebase index\` first to create it`);let{DatabaseManager:s}=await import('./database-manager-U7D7QIHC.cjs'),a=new s(e);try{let i=a.db,r=a.isIndexStale(),c=a.getMeta("indexed_with_extraction_version"),b=c?parseInt(c,10):null,p=a.getIndexState(),f=a.getMeta("schema_version"),u=f?parseInt(f,10):0,l={rootDir:t,dbPath:e,wasStale:r,previousVersion:b??null,currentVersion:chunkJWTI3BWI_cjs.m,applied:!1,schemaMigrated:!1,previousSchemaVersion:u,currentSchemaVersion:u,dryRun:!!o.dryRun,schemaSteps:chunkJWTI3BWI_cjs.j.map(g=>({id:g.id,description:g.description,status:"pending"})),migrationErrors:[],indexState:p},E;if(o.backup!==!1&&!o.dryRun)try{let g=new Date().toISOString().replace(/[:.]/g,"-");E=path.join(n,`codebase.db.bak.${g}`),fs.copyFileSync(e,E);for(let y of ["-wal","-shm"]){let h=e+y;fs.existsSync(h)&&fs.copyFileSync(h,E+y);}l.backupPath=E;}catch(g){let y=g instanceof Error?g.message:String(g);l.recommendation=`Backup failed: ${y}. Continuing without backup.`;}let m=o.schema!==!1;try{let g=chunkJWTI3BWI_cjs.k(i,chunkJWTI3BWI_cjs.i,{dryRun:o.dryRun});l.currentSchemaVersion=o.dryRun?g.targetVersion:Math.max(g.currentVersion,g.targetVersion),l.migrationErrors=g.errors.map(h=>({migrationId:h.migrationId,error:h.error}));let y=new Set(g.applied);for(let h of l.schemaSteps)y.has(h.id)&&(h.status=o.dryRun?"pending":"applied");for(let h of l.migrationErrors){let C=l.schemaSteps.find(k=>k.id===h.migrationId);C&&(C.status="failed");}if(l.schemaMigrated=g.applied.length>0&&!o.dryRun,!o.dryRun){let h=chunkJWTI3BWI_cjs.l(i);l.currentSchemaVersion=h,h>0&&a.setMeta("schema_version",String(h));}}catch(g){let y=g instanceof Error?g.message:String(g);l.migrationErrors.push({migrationId:0,error:y});}let S=r||o.force;return S&&!o.dryRun&&(a.setMeta("indexed_with_extraction_version",String(chunkJWTI3BWI_cjs.m)),(p==="stale"||p==="failed")&&(a.setIndexState("complete"),l.indexState="complete"),l.applied=!0),o.dryRun?l.migrationErrors.length>0?l.recommendation="dry-run finished. Run without --dry-run to apply.":l.schemaMigrated?l.recommendation="dry-run: schema migration would apply. Run without --dry-run to apply.":l.recommendation="dry-run: nothing to apply.":!S&&!l.schemaMigrated&&l.migrationErrors.length===0?l.recommendation=`Already current (schema_version=${l.currentSchemaVersion}, extraction_version=${chunkJWTI3BWI_cjs.m}). No upgrade needed.`:l.migrationErrors.length>0?l.recommendation=`Schema migration completed with ${l.migrationErrors.length} error(s). `+(l.backupPath?`Restore from backup: ${l.backupPath}`:"Re-run `recreate` to drop & rebuild."):l.schemaMigrated&&!S?l.recommendation=`Schema migrated (v${l.previousSchemaVersion} \u2192 v${l.currentSchemaVersion}). To apply extraction changes, run \`recreate\` to rebuild data or \`index --force\`.`:l.schemaMigrated&&S?l.recommendation="Schema + extraction metadata both updated. To rebuild data with new extractor, run `recreate` or `index --force`.":l.recommendation="Extraction metadata updated. No schema changes needed.",l}finally{a.close();}}function He(o){let t=[];if(t.push(`Codebase upgrade${o.dryRun?" (dry-run)":""}`),t.push(` db: ${o.dbPath}`),o.backupPath&&t.push(` backup: ${o.backupPath}`),t.push(` previous version: ${o.previousVersion??"(none)"}`),t.push(` current version: ${o.currentVersion}`),t.push(` previous schema_version: ${o.previousSchemaVersion}`),t.push(` current schema_version: ${o.currentSchemaVersion}`),t.push(` was stale: ${o.wasStale?"yes":"no"}`),t.push(` applied: ${o.applied?"\u2713":"(noop \u2014 already current)"}`),(o.schemaSteps??[]).length>0){t.push(""),t.push(" schema steps:");for(let n of o.schemaSteps){let e=n.status==="applied"?"\u2713":n.status==="pending"?"\xB7":n.status==="failed"?"\u2717":"-";t.push(` [${e}] v${n.id}: ${n.description}`);}}if((o.migrationErrors??[]).length>0){t.push(""),t.push(` migration errors: ${o.migrationErrors.length}`);for(let n of o.migrationErrors)t.push(` - v${n.migrationId}: ${n.error}`);}return t.push(` index_state: ${o.indexState}`),o.recommendation&&(t.push(""),t.push(` \u{1F4A1} ${o.recommendation}`)),t.join(`
|
|
8
|
+
`)}function Qe(o){let t={},n=[];for(let e of o)if(e==="--all")t.all=true;else if(e==="--dry-run"||e==="-n")t.dryRun=true;else if(e==="--pending-list"||e==="-p")t.pendingList=true;else if(e.startsWith("--batch=")){let s=parseInt(e.slice(8),10);Number.isFinite(s)&&s>0&&(t.batchSize=s);}else e==="--json"?t.json=true:e==="--help"||e==="-h"?t.help=true:e.startsWith("-")||n.push(e);return t.dir=n[0],t}var qo=200;function Uo(o,t=qo){return o?o.length<=t?o:o.slice(0,t)+"\u2026":""}async function Xe(o){let t=o.dir&&path.isAbsolute(o.dir)?o.dir:path.join(chunkJVX6PHPN_cjs.l(),o.dir??"."),n=chunkVFTVDTEY_cjs.a(t),e=chunkVFTVDTEY_cjs.c(t);if(!fs.existsSync(n))throw new Error(`codebase not initialized at ${t} \u2014 run \`easbot codebase init\` first`);if(!fs.existsSync(e))throw new Error(`db not found at ${e} \u2014 run \`easbot codebase index\` first to build`);let s=Date.now(),a=process.env.EASBOT_EMBEDDING_MODEL;if(!o.dryRun&&!a)throw new Error('embed requires an embedding model. Set EASBOT_EMBEDDING_MODEL env var (e.g. "openai/text-embedding-3-small") or pass --dry-run to skip embedding generation and just inspect pending nodes. Call `embed` from within an `easbot` REPL session for actual generation.');let{CodeBase:i}=await import('./code-base-6TM7JDJ6.cjs'),{DEFAULT_EMBEDDING_CONFIG:r,DEFAULT_INDEXER_CONFIG:c,DEFAULT_PARSER_CONFIG:b}=await import('@easbot/types'),p={...r,modelId:a??"(dry-run)"},f=new i({workspaceDir:t,database:{path:e,walMode:true},embedding:p,indexer:c,parser:b,sync:{onBoot:false,onSearch:false,onSessionStart:false,intervalMs:0}});try{await f.initialize();let u=f.getDatabase(),l=u.getNodeCount(),E=u.queryAll("SELECT node_id FROM node_embeddings"),d=new Set(E.map(y=>y.node_id)),m;if(o.all)m=u.queryAll("SELECT id, name, ast_type, language, file_path, text FROM nodes");else if(d.size===0)m=u.queryAll("SELECT id, name, ast_type, language, file_path, text FROM nodes");else {let y=Array.from(d),h=y.map(()=>"?").join(",");m=u.queryAll(`SELECT id, name, ast_type, language, file_path, text FROM nodes WHERE id NOT IN (${h})`,y);}let S=m.map(y=>({id:y.id,name:y.name,ast_type:y.ast_type,file_path:y.file_path,language:y.language,text_preview:Uo(y.text)})),g={rootDir:t,dbPath:e,totalNodes:l,alreadyEmbedded:d.size,newlyEmbedded:0,failed:0,all:!!o.all,dryRun:!!o.dryRun,pendingList:o.pendingList?S:[],duration:Date.now()-s,embeddingModelConfigured:!!a};return o.dryRun?g.recommendation=S.length>0?`dry-run: ${S.length} node(s) pending embedding. Use \`easbot codebase embed\` (without --dry-run) inside an \`easbot\` REPL for actual generation, or \`--pending-list\` to emit this list as JSON.`:"dry-run: all nodes already embedded.":S.length===0?g.recommendation="All nodes already have embeddings. Use --all to force regenerate.":g.recommendation=`${S.length} node(s) pending. Run \`easbot codebase embed --pending-list --json [dir]\` to emit the list, then call \`embed\` from within an \`easbot\` REPL session for actual generation (CLI cannot invoke AI SDK adapters in standalone mode).`,g}finally{await f.close();}}function Ze(o){let t=[],n=o.dryRun?" (dry-run)":"";if(t.push(`Codebase embed${n}`),t.push(` db: ${o.dbPath}`),t.push(` mode: ${o.all?"all (force regenerate)":"incremental (only missing)"}`),t.push(` embedding model: ${o.embeddingModelConfigured?"configured":"(none)"}`),t.push(` total nodes: ${o.totalNodes}`),t.push(` already embedded: ${o.alreadyEmbedded}`),t.push(` newly embedded: ${o.newlyEmbedded}`),o.failed>0&&t.push(` failed: ${o.failed}`),t.push(` pending: ${o.pendingList.length}`),t.push(` duration: ${o.duration}ms`),o.dryRun&&o.pendingList.length>0){t.push(""),t.push(" \u{1F4A1} first 5 pending nodes:");for(let e of o.pendingList.slice(0,5))t.push(` - ${e.id} (${e.ast_type})`);}return o.recommendation&&(t.push(""),t.push(` \u{1F4A1} ${o.recommendation}`)),t.join(`
|
|
9
|
+
`)}var et=utils.Log.create({service:"codebase-watch"});function tt(o){let t={},n=[];for(let e of o)if(e.startsWith("--debounce=")){let s=parseInt(e.slice(11),10);Number.isFinite(s)&&s>0&&(t.debounce=s);}else if(e.startsWith("--interval=")){let s=parseInt(e.slice(11),10);Number.isFinite(s)&&s>0&&(t.interval=s);}else if(e.startsWith("--backend=")){let s=e.slice(10);(s==="fs-events"||s==="inotify"||s==="windows"||s==="brute-force"||s==="watchman"||s==="auto")&&(t.backend=s);}else e.startsWith("--ignore=")?(t.ignore||(t.ignore=[]),t.ignore.push(e.slice(9))):e==="--on-load-failure=throw"?t.onLoadFailure="throw":e==="--on-load-failure=warn"?t.onLoadFailure="warn":e==="--json"?t.json=true:e==="--help"||e==="-h"?t.help=true:e.startsWith("-")||n.push(e);return t.dir=n[0],t}async function ot(o){let t=o.dir&&path.isAbsolute(o.dir)?o.dir:path.join(chunkJVX6PHPN_cjs.l(),o.dir??"."),n=chunkVFTVDTEY_cjs.a(t);fs.existsSync(n)||await j({dir:t});let e=new chunkBEQN3CKO_cjs.a({workspaceDir:t,backend:o.backend??"auto",ignorePatterns:o.ignore,onLoadFailure:o.onLoadFailure??"warn"}),s=[];e.on((a,i)=>{s.push({event:a,relPath:i,at:Date.now()}),et.info("watch event",{event:a,relPath:i});}),await e.start();try{await chunkBEQN3CKO_cjs.d(n,process.pid);}catch(a){et.warn("failed to write watcher pid",{error:String(a)});}return {watcher:e,events:s,startTime:Date.now()}}function nt(o){return ["Codebase watcher started"," backend: native @parcel/watcher (real-time FS events)"," debounce: 200ms (event coalescing)",` pid: ${process.pid}`,` initial events: ${o.length}`].join(`
|
|
10
|
+
`)}function st(o){let t={},n=[];for(let e of o)e==="--force"||e==="-f"?t.force=true:e==="--json"?t.json=true:e==="--help"||e==="-h"?t.help=true:e.startsWith("-")||n.push(e);return t.dir=n[0],t}async function rt(o){let t=o.dir&&path.isAbsolute(o.dir)?o.dir:path.join(chunkJVX6PHPN_cjs.l(),o.dir??"."),n=chunkVFTVDTEY_cjs.a(t);fs.existsSync(n)||await j({dir:t});let e=path.join(n,".watcher.pid"),s=chunkBEQN3CKO_cjs.c(n);if(s===null)return {rootDir:t,pidFile:e,pid:null,stopped:false,error:"No watcher running (no .easbot/.watcher.pid found)"};try{return process.kill(s,"SIGTERM"),await chunkBEQN3CKO_cjs.e(n),{rootDir:t,pidFile:e,pid:s,stopped:!0}}catch(a){await chunkBEQN3CKO_cjs.e(n);let i=a instanceof Error?a.message:String(a);return {rootDir:t,pidFile:e,pid:s,stopped:false,error:i}}}function at(o){let t=[];return t.push("Codebase stop"),t.push(` pid file: ${o.pidFile}`),t.push(` pid: ${o.pid??"(none)"}`),t.push(` stopped: ${o.stopped?"\u2713":"\u2717"}`),o.error?(t.push(` error: ${o.error}`),t.push(""),t.push(" \u{1F4A1} If a stale watcher was running, its process may have already exited.")):(t.push(""),t.push(" \u{1F4A1} Use `easbot codebase watch [dir]` to start a new watcher session.")),t.join(`
|
|
11
|
+
`)}function lt(o){let t={includeEdges:true,enableEmbedding:true},n=[];for(let e of o)if(e==="--help"||e==="-h")t.help=true;else if(e==="--json")t.json=true;else if(e==="--no-edges")t.includeEdges=false;else if(e==="--no-vector"||e==="--no-embed")t.enableEmbedding=false;else if(e.startsWith("-l=")||e.startsWith("--language="))t.language=e.includes("=")?e.split("=")[1]:void 0;else if(!(e==="-l"||e==="--language"))if(e.startsWith("--ast="))t.astType=e.slice(6);else if(e.startsWith("-n=")||e.startsWith("--max=")){let s=parseInt(e.split("=")[1]??"",10);Number.isFinite(s)&&s>0&&(t.maxResults=s);}else e.startsWith("--dir=")?t.dir=e.slice(6):e.startsWith("-")||n.push(e);return n.length>0&&(t.query=n.join(" ")),t}async function dt(o){let t=path.isAbsolute(o.dir??"")&&o.dir?o.dir:path.join(chunkJVX6PHPN_cjs.l(),o.dir??"."),n=chunkVFTVDTEY_cjs.a(t),e=chunkVFTVDTEY_cjs.c(t);if(fs.existsSync(n)||await j({dir:t}),!fs.existsSync(e))throw new Error(`db not found at ${e} \u2014 run \`easbot codebase index\` first`);let{CodeBase:s}=await import('./code-base-6TM7JDJ6.cjs'),{DEFAULT_EMBEDDING_CONFIG:a,DEFAULT_INDEXER_CONFIG:i,DEFAULT_PARSER_CONFIG:r,DEFAULT_SEARCH_CONFIG:c}=await import('@easbot/types'),b=new s({workspaceDir:t,database:{path:e,walMode:true},embedding:o.enableEmbedding?a:void 0,indexer:i,parser:r,search:c,sync:{onBoot:false,onSearch:false,onSessionStart:false,intervalMs:0}}),p=Date.now();try{await b.initialize();let u=await b.getQuery().search(o.query??"",{maxResults:o.maxResults??20,language:o.language,astType:o.astType,includeEdges:o.includeEdges,enableEmbedding:o.enableEmbedding});return {rootDir:t,query:o.query??"",totalResults:u.length,results:u.map(l=>({id:l.id,name:l.name,astType:l.ast_type,language:l.language,filePath:l.file_path,startLine:l.start_line??0,endLine:l.end_line??0,snippet:(l.text??"").slice(0,200),edgeCount:(l.edges??[]).length})),durationMs:Date.now()-p}}finally{await b.close();}}function pt(o){let t=[];t.push(`Codebase query: ${JSON.stringify(o.query)}`),t.push(` results: ${o.totalResults} (in ${o.durationMs}ms)`);for(let n of o.results)t.push(` ${n.name} (${n.astType}) \u2014 ${n.language} ${n.filePath}:${n.startLine}-${n.endLine} [${n.edgeCount} edges]`),t.push(` ${n.snippet.replace(/\s+/g," ").slice(0,100)}`);return t.join(`
|
|
12
|
+
`)}function mt(o){let t={includeEdges:false},n=[];for(let e of o)if(e==="--help"||e==="-h")t.help=true;else if(e==="--json")t.json=true;else if(e==="--edges")t.includeEdges=true;else if(e.startsWith("--file="))t.file=e.slice(7);else if(e.startsWith("--kind="))t.kind=e.slice(7);else if(e.startsWith("--max=")){let s=parseInt(e.slice(6),10);Number.isFinite(s)&&s>0&&(t.edgesLimit=s);}else e.startsWith("--dir=")?t.dir=e.slice(6):e.startsWith("-")||n.push(e);return n.length>0&&(t.name=n[0],t.nodeId=n[0]),t}async function gt(o){if(!o.name&&!o.nodeId)throw new Error("node command requires a <name> or <node-id> argument");let t=path.isAbsolute(o.dir??"")&&o.dir?o.dir:path.join(chunkJVX6PHPN_cjs.l(),o.dir??"."),n=chunkVFTVDTEY_cjs.a(t),e=chunkVFTVDTEY_cjs.c(t);if(fs.existsSync(n)||await j({dir:t}),!fs.existsSync(e))throw new Error(`db not found at ${e} \u2014 run \`easbot codebase index\` first`);let a=await chunkR74KIJM2_cjs.e({workspaceDir:t,rootDir:t},{name:o.name,nodeId:o.nodeId,file:o.file,kind:o.kind,includeEdges:o.includeEdges??false,includeContent:true,edgesLimit:o.edgesLimit??50});if(!a.node)return {rootDir:t,found:false,incomingEdges:[],outgoingEdges:[]};let i=[],r=[];for(let c of a.edges)c.target===a.node.id?i.push({id:c.id,relation:c.relation,source:c.source,target:c.target,direction:"in"}):r.push({id:c.id,relation:c.relation,source:c.source,target:c.target,direction:"out"});return {rootDir:t,found:true,node:{id:a.node.id,name:a.node.name,astType:a.node.ast_type,language:a.node.language,filePath:a.node.file_path,startLine:a.node.start_line??0,endLine:a.node.end_line??0,text:a.node.text??""},incomingEdges:i,outgoingEdges:r}}function ft(o){if(!o.found||!o.node)return `\u2717 node not found (rootDir: ${o.rootDir})`;let t=[];if(t.push(`Codebase node: ${o.node.id}`),t.push(` name: ${o.node.name}`),t.push(` type: ${o.node.astType}`),t.push(` language: ${o.node.language}`),t.push(` location: ${o.node.filePath}:${o.node.startLine}-${o.node.endLine}`),t.push(` edges: ${o.incomingEdges.length} incoming / ${o.outgoingEdges.length} outgoing`),o.incomingEdges.length>0&&typeof o.incomingEdges[0]=="object"&&"relation"in o.incomingEdges[0]){t.push(""),t.push(" incoming edges:");for(let n of o.incomingEdges.slice(0,20))t.push(` [${n.relation}] ${n.source} \u2192 ${n.target}`);t.push(" outgoing edges:");for(let n of o.outgoingEdges.slice(0,20))t.push(` [${n.relation}] ${n.source} \u2192 ${n.target}`);}return t.join(`
|
|
13
|
+
`)}function ht(o){let t={direction:"both"},n=[];for(let e of o)if(e==="--help"||e==="-h")t.help=true;else if(e==="--json")t.json=true;else if(e.startsWith("--depth=")){let s=parseInt(e.slice(8),10);Number.isFinite(s)&&s>0&&(t.depth=s);}else if(e.startsWith("--max=")){let s=parseInt(e.slice(6),10);Number.isFinite(s)&&s>0&&(t.maxNodes=s);}else if(e.startsWith("--direction=")){let s=e.slice(12);(s==="incoming"||s==="outgoing"||s==="both")&&(t.direction=s);}else if(e.startsWith("--relation=")){let s=e.slice(11).split(",").map(a=>a.trim()).filter(Boolean);t.relationTypes=s;}else e.startsWith("--dir=")?t.dir=e.slice(6):e.startsWith("-")||n.push(e);return n.length>0&&(t.nodeId=n[0]),t}async function yt(o){let t=path.isAbsolute(o.dir??"")&&o.dir?o.dir:path.join(chunkJVX6PHPN_cjs.l(),o.dir??"."),n=chunkVFTVDTEY_cjs.a(t),e=chunkVFTVDTEY_cjs.c(t);if(fs.existsSync(n)||await j({dir:t}),!fs.existsSync(e))throw new Error(`db not found at ${e} \u2014 run \`easbot codebase index\` first`);if(!o.nodeId)throw new Error("context command requires a <node-id> argument");let s=o.depth??2,a=o.maxNodes??100,i=o.direction??"both",{CodeBase:r}=await import('./code-base-6TM7JDJ6.cjs'),{DEFAULT_EMBEDDING_CONFIG:c,DEFAULT_INDEXER_CONFIG:b,DEFAULT_PARSER_CONFIG:p,DEFAULT_SEARCH_CONFIG:f}=await import('@easbot/types'),u=new r({workspaceDir:t,database:{path:e,walMode:true},embedding:c,indexer:b,parser:p,search:f,sync:{onBoot:false,onSearch:false,onSessionStart:false,intervalMs:0}});try{await u.initialize();let l=u.getDatabase(),E=u.getQuery();if(!l.getNodeById(o.nodeId))return {rootDir:t,rootNodeId:o.nodeId,depth:s,totalNodes:0,totalEdges:0,nodes:[],edges:[],truncated:!1};let m=new Map,S=[{nodeId:o.nodeId,depth:0}];m.set(o.nodeId,0);let g=[],y=!1;for(;S.length>0;){let w=S.shift();if(w.depth>=s)continue;if(m.size>=a){y=!0;break}let O=E.queryNeighbors(w.nodeId,{direction:i,relationTypes:o.relationTypes,limit:a-m.size+1});for(let R of O.edges){g.push({source:R.source,target:R.target,relation:R.relation});let F=R.source===w.nodeId?R.target:R.source;if(!m.has(F)&&(m.set(F,w.depth+1),S.push({nodeId:F,depth:w.depth+1}),m.size>=a)){y=!0;break}}if(y)break}let h=Array.from(m.keys()),C=h.length>0?l.queryNodes({ids:h}):[],k=new Map(C.map(w=>[w.id,w])),D=[];for(let[w,O]of m.entries()){let R=k.get(w);R&&D.push({id:R.id,name:R.name,astType:R.ast_type,language:R.language,filePath:R.file_path,depth:O});}return {rootDir:t,rootNodeId:o.nodeId,depth:s,totalNodes:D.length,totalEdges:g.length,nodes:D,edges:g,truncated:y}}finally{await u.close();}}function xt(o){let t=[];t.push(`Codebase context: ${o.rootNodeId} (depth=${o.depth})`),t.push(` nodes: ${o.totalNodes}${o.truncated?" [TRUNCATED]":""}`),t.push(` edges: ${o.totalEdges}`);for(let n of o.nodes.slice(0,50))t.push(` [d=${n.depth}] ${n.name} (${n.astType}) \u2014 ${n.language} ${n.filePath}`);return o.nodes.length>50&&t.push(` ... and ${o.nodes.length-50} more`),t.join(`
|
|
14
|
+
`)}function wt(o){let t={},n=[];for(let e of o)if(e==="--help"||e==="-h")t.help=true;else if(e==="--json")t.json=true;else if(e.startsWith("-d=")||e.startsWith("--depth=")){let s=parseInt(e.split("=")[1]??"",10);Number.isFinite(s)&&s>0&&(t.depth=s);}else if(e.startsWith("--relation=")){let s=e.slice(11).split(",").map(a=>a.trim()).filter(Boolean);t.relationTypes=s;}else e.startsWith("--dir=")?t.dir=e.slice(6):e.startsWith("-")||n.push(e);return n.length>0&&(t.nodeId=n[0]),t}async function Et(o){let t=path.isAbsolute(o.dir??"")&&o.dir?o.dir:path.join(chunkJVX6PHPN_cjs.l(),o.dir??"."),n=chunkVFTVDTEY_cjs.a(t),e=chunkVFTVDTEY_cjs.c(t);if(fs.existsSync(n)||await j({dir:t}),!fs.existsSync(e))throw new Error(`db not found at ${e} \u2014 run \`easbot codebase index\` first`);if(!o.nodeId)throw new Error("impact command requires a <node-id> argument");let s=o.depth??3,a=o.relationTypes??["CALLS","REFERENCES","USES"],{CodeBase:i}=await import('./code-base-6TM7JDJ6.cjs'),{DEFAULT_EMBEDDING_CONFIG:r,DEFAULT_INDEXER_CONFIG:c,DEFAULT_PARSER_CONFIG:b,DEFAULT_SEARCH_CONFIG:p}=await import('@easbot/types'),f=new i({workspaceDir:t,database:{path:e,walMode:true},embedding:r,indexer:c,parser:b,search:p,sync:{onBoot:false,onSearch:false,onSessionStart:false,intervalMs:0}});try{await f.initialize();let u=f.getQuery(),l=f.getDatabase(),E=new Set([o.nodeId]),d=[],m=[o.nodeId];for(let S=1;S<=s&&m.length!==0;S++){let g=[],y=new Set;if(m.length>0){let h=m.map(()=>"?").join(","),C=a.map(()=>"?").join(","),k=l.queryAll(`SELECT source, target, relation FROM edges WHERE target IN (${h}) AND relation IN (${C})`,[...m,...a]);for(let D of k)!E.has(D.source)&&!y.has(D.source)&&(y.add(D.source),E.add(D.source),g.push(D.source));}if(g.length>0){let h=g.slice(0,10),C=h.length>0?l.queryNodes({ids:h}):[],k=new Map(C.map(w=>[w.id,w])),D=h.map(w=>{let O=k.get(w);return {id:w,name:O?.name??"(unknown)",filePath:O?.file_path??"(unknown)"}});d.push({depth:S,count:g.length,sample:D});}m=g;}return {rootDir:t,rootNodeId:o.nodeId,totalImpacted:E.size-1,depth:s,buckets:d}}finally{await f.close();}}function Ct(o){let t=[];t.push(`Codebase impact: ${o.rootNodeId} (depth=${o.depth})`),t.push(` total impacted: ${o.totalImpacted}`);for(let n of o.buckets){t.push(` d=${n.depth}: ${n.count} nodes`);for(let e of n.sample.slice(0,5))t.push(` - ${e.name} (${e.filePath})`);}return t.join(`
|
|
15
|
+
`)}var sn="ts|tsx|js|jsx|mjs|cjs|py|rs|go|java|kt|scala|swift|rb|php|pl|sh|c|cpp|cc|cxx|h|hpp|lua|zig|cs|dart|ex|exs|clj|cljs|vue|svelte",rn=[new RegExp(`(?:^|/)(?:main|index|app|server)\\.(?:${sn})$`)];function Rt(o){let t={excludeEntry:true};for(let n of o)if(n==="--help"||n==="-h")t.help=true;else if(n==="--json")t.json=true;else if(n==="--no-exclude-entry")t.excludeEntry=false;else if(n.startsWith("--type="))t.astTypes=n.slice(7).split(",").map(e=>e.trim()).filter(Boolean);else if(n.startsWith("--limit=")){let e=parseInt(n.slice(8),10);Number.isFinite(e)&&e>0&&(t.limit=e);}return t}async function _t(o){let t=path.isAbsolute(o.dir??"")&&o.dir?o.dir:path.join(chunkJVX6PHPN_cjs.l(),o.dir??"."),n=chunkVFTVDTEY_cjs.a(t),e=chunkVFTVDTEY_cjs.c(t);if(fs.existsSync(n)||await j({dir:t}),!fs.existsSync(e))throw new Error(`db not found at ${e} \u2014 run \`easbot codebase index\` first`);let s=o.astTypes??["function","method","class"],a=o.limit??100,i=o.excludeEntry!==false,{CodeBase:r}=await import('./code-base-6TM7JDJ6.cjs'),{DEFAULT_EMBEDDING_CONFIG:c,DEFAULT_INDEXER_CONFIG:b,DEFAULT_PARSER_CONFIG:p,DEFAULT_SEARCH_CONFIG:f}=await import('@easbot/types'),u=new r({workspaceDir:t,database:{path:e,walMode:true},embedding:c,indexer:b,parser:p,search:f,sync:{onBoot:false,onSearch:false,onSessionStart:false,intervalMs:0}});try{await u.initialize();let l=u.getDatabase(),E=u.getQuery(),d=[],m=0,S=["CALLS","IMPORTS","TYPE_REFERENCES"],g=l.queryAll("SELECT DISTINCT target FROM edges WHERE relation IN ('CALLS','IMPORTS','TYPE_REFERENCES')"),y=new Set(g.map(h=>h.target));for(let h of s){let C=l.queryNodes({astType:h,limit:1e5});for(let k of C){if(i&&rn.some(D=>D.test(k.file_path))){m++;continue}if(!y.has(k.id)&&(d.push({id:k.id,name:k.name,astType:k.ast_type,filePath:k.file_path,startLine:k.start_line??0}),d.length>=a))break}if(d.length>=a)break}return {rootDir:t,totalCandidates:d.length,excludedEntry:m,candidates:d.slice(0,a)}}finally{await u.close();}}function Nt(o){let t=[];t.push("Codebase dead-code"),t.push(` total candidates: ${o.totalCandidates}`),o.excludedEntry>0&&t.push(` excluded (entry files): ${o.excludedEntry}`);for(let n of o.candidates.slice(0,50))t.push(` - ${n.name} (${n.astType}) \u2014 ${n.filePath}:${n.startLine}`);return o.candidates.length>50&&t.push(` ... and ${o.candidates.length-50} more`),t.join(`
|
|
16
|
+
`)}function It(o){let t={relation:"IMPORTS",scope:"file"};for(let n of o)if(n==="--help"||n==="-h")t.help=true;else if(n==="--json")t.json=true;else if(n.startsWith("--relation="))t.relation=n.slice(11);else if(n.startsWith("--scope=")){let e=n.slice(8);(e==="file"||e==="module")&&(t.scope=e);}return t}function ln(o){let t=0,n=new Map,e=new Map,s=new Set,a=[],i=[];function r(c){n.set(c,t),e.set(c,t),t++,a.push(c),s.add(c);let b=o.get(c)??[];for(let p of b)n.has(p)?s.has(p)&&e.set(c,Math.min(e.get(c),n.get(p))):(r(p),e.set(c,Math.min(e.get(c),e.get(p))));if(e.get(c)===n.get(c)){let p=[],f;do f=a.pop(),s.delete(f),p.push(f);while(f!==c);p.length>1&&i.push(p);}}for(let c of o.keys())n.has(c)||r(c);return i}async function jt(o){let t=path.isAbsolute(o.dir??"")&&o.dir?o.dir:path.join(chunkJVX6PHPN_cjs.l(),o.dir??"."),n=chunkVFTVDTEY_cjs.a(t),e=chunkVFTVDTEY_cjs.c(t);if(fs.existsSync(n)||await j({dir:t}),!fs.existsSync(e))throw new Error(`db not found at ${e} \u2014 run \`easbot codebase index\` first`);let s=o.relation??"IMPORTS",{CodeBase:a}=await import('./code-base-6TM7JDJ6.cjs'),{DEFAULT_EMBEDDING_CONFIG:i,DEFAULT_INDEXER_CONFIG:r,DEFAULT_PARSER_CONFIG:c,DEFAULT_SEARCH_CONFIG:b}=await import('@easbot/types'),p=new a({workspaceDir:t,database:{path:e,walMode:true},embedding:i,indexer:r,parser:c,search:b,sync:{onBoot:false,onSearch:false,onSessionStart:false,intervalMs:0}});try{await p.initialize();let f=p.getDatabase(),u=f.queryNodes({limit:1e5}),l=new Map;for(let C of u){let k=l.get(C.file_path)??[];k.push(C.id),l.set(C.file_path,k);}let E=u.map(C=>C.id),d=new Map;for(let C of u)d.set(C.id,C.file_path);let m;if(E.length===0)m=[];else {let C=E.map(()=>"?").join(",");m=f.queryAll(`SELECT * FROM edges WHERE relation = ? AND source IN (${C})`,[s,...E]);}let S=new Map;for(let C of m){let k=d.get(C.source),D=d.get(C.target);if(!k||!D||k===D)continue;let w=S.get(k);w||(w=new Set,S.set(k,w)),w.add(D);}let g=new Map;for(let[C,k]of S.entries())g.set(C,Array.from(k));let h=ln(g).map(C=>{let k=[];for(let D=0;D<C.length;D++){let w=C[D],O=S.get(w);if(O)for(let R of O)C.includes(R)&&k.push({source:w,target:R});}return {cycle:C,edges:k}});return {rootDir:t,relation:s,totalCycles:h.length,cycles:h.slice(0,50)}}finally{await p.close();}}function vt(o){let t=[];t.push(`Codebase circular (relation=${o.relation})`),t.push(` total cycles: ${o.totalCycles}`);for(let n=0;n<o.cycles.length;n++){let e=o.cycles[n];t.push(` cycle #${n+1} (${e.cycle.length} files):`),t.push(` ${e.cycle.join(" \u2192 ")} \u2192 ${e.cycle[0]}`);}return t.join(`
|
|
17
|
+
`)}function Tt(o){let t={},n=[];for(let e of o)if(e==="--help"||e==="-h")t.help=true;else if(e==="--json")t.json=true;else if(e.startsWith("-d=")||e.startsWith("--depth=")){let s=parseInt(e.split("=")[1]??"",10);Number.isFinite(s)&&s>0&&(t.depth=s);}else if(e.startsWith("--relation=")){let s=e.slice(11).split(",").map(a=>a.trim()).filter(Boolean);t.relationTypes=s;}else e.startsWith("-")||n.push(e);return n.length>0&&(t.fromId=n[0]),n.length>1&&(t.toId=n[1]),t}async function $t(o){let t=path.isAbsolute(o.dir??"")&&o.dir?o.dir:path.join(chunkJVX6PHPN_cjs.l(),o.dir??"."),n=chunkVFTVDTEY_cjs.a(t),e=chunkVFTVDTEY_cjs.c(t);if(fs.existsSync(n)||await j({dir:t}),!fs.existsSync(e))throw new Error(`db not found at ${e} \u2014 run \`easbot codebase index\` first`);if(!o.fromId||!o.toId)throw new Error("path command requires <from> and <to> node IDs");let s=o.depth??6,a=o.relationTypes??["CALLS","IMPORTS"],{CodeBase:i}=await import('./code-base-6TM7JDJ6.cjs'),{DEFAULT_EMBEDDING_CONFIG:r,DEFAULT_INDEXER_CONFIG:c,DEFAULT_PARSER_CONFIG:b,DEFAULT_SEARCH_CONFIG:p}=await import('@easbot/types'),f=new i({workspaceDir:t,database:{path:e,walMode:true},embedding:r,indexer:c,parser:b,search:p,sync:{onBoot:false,onSearch:false,onSessionStart:false,intervalMs:0}});try{await f.initialize();let u=f.getQuery();if(o.fromId===o.toId)return {rootDir:t,found:!0,depth:0,steps:[],pathNodes:[o.fromId]};let l=new Set([o.fromId]),E=new Map,d=[o.fromId],m=!1;e:for(let h=0;h<=s;h++){let C=[];for(let k of d){let D=u.queryNeighbors(k,{direction:"both",relationTypes:a,limit:1e3});for(let w of D.edges){let O=w.source===k?w.target:w.source;if(!l.has(O)){if(l.add(O),E.set(O,{via:k,relation:w.relation}),O===o.toId){m=!0;break e}C.push(O);}}}d.length=0,d.push(...C);}if(!m)return {rootDir:t,found:!1,depth:0,steps:[],pathNodes:[]};let S=[o.toId],g=[],y=o.toId;for(;y!==o.fromId;){let h=E.get(y);if(!h)break;g.unshift({from:h.via,to:y,relation:h.relation}),S.unshift(h.via),y=h.via;}return {rootDir:t,found:!0,depth:g.length,steps:g,pathNodes:S}}finally{await f.close();}}function Pt(o){let t=[];if(!o.found)return t.push("Codebase path: NOT FOUND within depth limit"),t.join(`
|
|
18
|
+
`);t.push(`Codebase path: depth=${o.depth}`);for(let n=0;n<o.steps.length;n++){let e=o.steps[n];t.push(` ${n+1}. [${e.relation}] ${e.from} \u2192 ${e.to}`);}return t.join(`
|
|
19
|
+
`)}function Mt(o){let t={},n=[];for(let e of o)e==="--help"||e==="-h"?t.help=true:e.startsWith("-")||n.push(e);return t.dir=n[0],t}async function qt(o){let t=path.isAbsolute(o.dir??"")&&o.dir?o.dir:path.join(chunkJVX6PHPN_cjs.l(),o.dir??"."),n=chunkVFTVDTEY_cjs.a(t),e=chunkVFTVDTEY_cjs.c(t);if(fs.existsSync(n)||await j({dir:t}),!fs.existsSync(e))throw new Error(`db not found at ${e} \u2014 run \`easbot codebase index\` first`);let{CodeBase:s}=await import('./code-base-6TM7JDJ6.cjs'),{DEFAULT_EMBEDDING_CONFIG:a,DEFAULT_INDEXER_CONFIG:i,DEFAULT_PARSER_CONFIG:r,DEFAULT_SEARCH_CONFIG:c}=await import('@easbot/types'),{CodebaseStdioServer:b}=await import('./stdio-server-2GBPZY6J.cjs'),p="0.0.0";try{let d=path.dirname(url.fileURLToPath(chunkNVGACA7W_cjs.b));for(let m=0;m<8;m++){try{let g=JSON.parse(fs.readFileSync(path.join(d,"package.json"),"utf-8"));if(g?.name==="@easbot/codebase"&&typeof g.version=="string"){p=g.version;break}}catch{}let S=path.dirname(d);if(S===d)break;d=S;}}catch{}let f=new s({workspaceDir:t,database:{path:e,walMode:true},embedding:a,indexer:i,parser:r,search:c,sync:{onBoot:false,onSearch:false,onSessionStart:false,intervalMs:0}});await f.initialize();let u={id:"easbot-codebase-mcp",name:"EASBot Codebase MCP",version:p,transportType:mcp.ServerTransportType.STDIO},l=await b.start(f,u);return {rootDir:t,tools:l.tools}}var xn=utils.Log.create({service:"codebase-cmd-callers"});function Ut(o){let t={maxResults:20},n=[];for(let e of o)if(e==="--help"||e==="-h")t.help=true;else if(e==="--json")t.json=true;else if(e.startsWith("--file="))t.file=e.slice(7);else if(e.startsWith("--kind="))t.kind=e.slice(7);else if(e.startsWith("--max=")){let s=parseInt(e.slice(6),10);Number.isFinite(s)&&s>0&&(t.maxResults=s);}else e.startsWith("--dir=")?t.dir=e.slice(6):e.startsWith("-")||n.push(e);return n.length>0&&(t.symbol=n[0]),t}async function Bt(o){if(!o.symbol&&!o.nodeId)throw new Error("callers command requires a <symbol> or --nodeId argument");let t=o.dir&&path.isAbsolute(o.dir)?o.dir:path.join(chunkJVX6PHPN_cjs.l(),o.dir??"."),n=Date.now(),s=await chunkR74KIJM2_cjs.h({workspaceDir:t,rootDir:t},{name:o.symbol,nodeId:o.nodeId,file:o.file,kind:o.kind,maxResults:o.maxResults});return xn.debug("callers command done",{symbol:o.symbol,count:s.callers.length,rootDir:t}),{rootDir:t,serviceResult:s,durationMs:Date.now()-n}}function Wt(o){let{serviceResult:t,rootDir:n}=o,e=[],s=t.root?.name??"?",a=t.truncated?"+":"";if(e.push(`Callers of \`${s}\` (${t.callers.length}${a}) [${n}]`),t.callers.length===0)e.push(" (no incoming edges)");else for(let i of t.callers)e.push(` - [${i.relation}] \`${i.name}\` ${i.filePath}:${i.startLine}`);return t.callers.length>0&&(e.push(""),e.push("\u{1F4A1} Use `easbot codebase node <name>` to read full source of any caller.")),e.join(`
|
|
20
|
+
`)}var Cn=utils.Log.create({service:"codebase-cmd-callees"});function Gt(o){let t={maxResults:20},n=[];for(let e of o)if(e==="--help"||e==="-h")t.help=true;else if(e==="--json")t.json=true;else if(e.startsWith("--file="))t.file=e.slice(7);else if(e.startsWith("--kind="))t.kind=e.slice(7);else if(e.startsWith("--max=")){let s=parseInt(e.slice(6),10);Number.isFinite(s)&&s>0&&(t.maxResults=s);}else e.startsWith("--dir=")?t.dir=e.slice(6):e.startsWith("-")||n.push(e);return n.length>0&&(t.symbol=n[0]),t}async function zt(o){if(!o.symbol&&!o.nodeId)throw new Error("callees command requires a <symbol> or --nodeId argument");let t=o.dir&&path.isAbsolute(o.dir)?o.dir:path.join(chunkJVX6PHPN_cjs.l(),o.dir??"."),n=Date.now(),s=await chunkR74KIJM2_cjs.i({workspaceDir:t,rootDir:t},{name:o.symbol,nodeId:o.nodeId,file:o.file,kind:o.kind,maxResults:o.maxResults});return Cn.debug("callees command done",{symbol:o.symbol,count:s.callers.length,rootDir:t}),{rootDir:t,serviceResult:s,durationMs:Date.now()-n}}function Jt(o){let{serviceResult:t,rootDir:n}=o,e=[],s=t.root?.name??"?",a=t.truncated?"+":"";if(e.push(`Callees of \`${s}\` (${t.callers.length}${a}) [${n}]`),t.callers.length===0)e.push(" (no outgoing edges)");else for(let i of t.callers)e.push(` - [${i.relation}] \`${i.name}\` ${i.filePath}:${i.startLine}`);return t.callers.length>0&&(e.push(""),e.push("\u{1F4A1} Use `easbot codebase node <name>` to read full source of any callee.")),e.join(`
|
|
21
|
+
`)}var Nn=utils.Log.create({service:"codebase-cmd-explore"});function Kt(o){let t={maxFiles:5,maxSymbols:3,depth:1,includeContent:true},n=[];for(let e of o)if(e==="--help"||e==="-h")t.help=true;else if(e==="--json")t.json=true;else if(e==="--no-content")t.includeContent=false;else if(e.startsWith("--file="))t.file=e.slice(7);else if(e.startsWith("--kind="))t.kind=e.slice(7);else if(e.startsWith("--max-files=")){let s=parseInt(e.slice(12),10);Number.isFinite(s)&&s>0&&(t.maxFiles=s);}else if(e.startsWith("--max-symbols=")){let s=parseInt(e.slice(14),10);Number.isFinite(s)&&s>0&&(t.maxSymbols=s);}else if(e.startsWith("--depth=")){let s=parseInt(e.slice(8),10);Number.isFinite(s)&&s>0&&(t.depth=s);}else e.startsWith("--intent=")?t.intent=e.slice(9):e.startsWith("--dir=")?t.dir=e.slice(6):e.startsWith("-")||n.push(e);return n.length>0&&(t.query=n.join(" ")),t}async function Vt(o){if(!o.query)throw new Error("explore command requires a <query> argument");let t=o.dir&&path.isAbsolute(o.dir)?o.dir:path.join(chunkJVX6PHPN_cjs.l(),o.dir??"."),n=Date.now(),s=await chunkR74KIJM2_cjs.j({workspaceDir:t,rootDir:t},{query:o.query,file:o.file,kind:o.kind,maxFiles:o.maxFiles,maxSymbols:o.maxSymbols,depth:o.depth,includeContent:o.includeContent,intent:o.intent});return Nn.debug("explore command done",{query:o.query,totalHits:s.totalHits,entryPoints:s.entryPoints.length,rootDir:t}),{rootDir:t,serviceResult:s,durationMs:Date.now()-n}}async function Ht(o){let t={pendingFiles:[],toolName:"codebase_explore",writeToDisk:false};return await chunkR74KIJM2_cjs.D(o.serviceResult,t)}var Yt={languages:[{value:"zh-CN",name:"\u7B80\u4F53\u4E2D\u6587",example:"\u4F60\u597D\uFF0CEASBOT\uFF01",supported:true},{value:"en-US",name:"English (United States)",example:"Hello, EASBOT!",supported:true}]};var In=Yt.languages,jn=In.filter(o=>o.supported).map(o=>o.value),q={defaultLocale:"zh-CN",locales:jn},W={},J=(o,t)=>{let n=W[o]||{translation:{}};return W[o]={translation:{...n.translation,...t.translation}},W[o]},K=(o=q.defaultLocale)=>(W[o]||J(o,{translation:{}}),{locale:o,resources:W[o]||{translation:{}}});var vn={translation:{"cli.banner.title":"easbot-codebase \u2014 \u4EE3\u7801\u77E5\u8BC6\u56FE\u8C31","cli.banner.usage":"\u7528\u6CD5: easbot-codebase <command> [options]","cli.banner.section.lifecycle":"\u547D\u4EE4\uFF08\u751F\u547D\u5468\u671F\uFF09:","cli.banner.section.graph":"\u547D\u4EE4\uFF08\u56FE\u67E5\u8BE2\uFF09:","cli.banner.section.external":"\u5916\u90E8\u63A5\u53E3:","cli.banner.hint.run_help":"\u8FD0\u884C `easbot codebase <command> --help` \u67E5\u770B\u8BE6\u60C5\u3002","cli.banner.local.title":"\u72EC\u7ACB CLI:","cli.banner.local.body":"\u672C\u5305\u540C\u65F6\u4F5C\u4E3A\u72EC\u7ACB CLI `easbot-codebase` \u53D1\u5E03\uFF0C\u53EF\u72EC\u7ACB\u4F7F\u7528\u3002","cli.banner.local.agent":"Agent CLI \u7528\u6237: `easbot codebase <command> ...`","cli.banner.local.standalone":"\u72EC\u7ACB\u7528\u6237: `easbot-codebase <command> ...`","cli.cmd.init.summary":"init [dir] \u5728\u76EE\u6807\u76EE\u5F55\u521D\u59CB\u5316 .easbot/codebase.json","cli.cmd.index.summary":"index [dir] \u6784\u5EFA\u5B8C\u6574\u7D22\u5F15","cli.cmd.sync.summary":"sync \u8FD0\u884C\u589E\u91CF\u540C\u6B65","cli.cmd.recreate.summary":"recreate \u4E22\u5F03\u6574\u4E2A\u6570\u636E\u5E93\u5E76\u91CD\u65B0\u521D\u59CB\u5316","cli.cmd.clear.summary":"clear \u6E05\u7A7A\u6240\u6709\u8282\u70B9/\u8FB9\uFF08\u4FDD\u7559 config.json\uFF09","cli.cmd.status.summary":"status \u663E\u793A\u7D22\u5F15\u72B6\u6001 / \u6570\u636E\u5E93 / \u914D\u7F6E","cli.cmd.doctor.summary":"doctor \u8FD0\u884C\u5065\u5EB7\u68C0\u67E5\uFF08\u540E\u7AEF\u53EF\u7528\u6027\u7B49\uFF09","cli.cmd.config.summary":"config \u8BFB\u53D6/\u8BBE\u7F6E .easbot/codebase.json \u5B57\u6BB5","cli.cmd.upgrade.summary":"upgrade \u5F53 extraction_version \u8FC7\u65F6\u65F6\u66F4\u65B0\u5143\u6570\u636E","cli.cmd.embed.summary":"embed \u751F\u6210\u8282\u70B9\u5D4C\u5165\u5411\u91CF","cli.cmd.watch.summary":"watch \u76D1\u542C\u5DE5\u4F5C\u533A\u6587\u4EF6\u53D8\u66F4\uFF08\u81EA\u52A8\u540C\u6B65\uFF09","cli.cmd.stop.summary":"stop \u505C\u6B62\u6B63\u5728\u8FD0\u884C\u7684\u6587\u4EF6\u76D1\u542C\u5668","cli.cmd.query.summary":"query <q...> \u6DF7\u5408\u641C\u7D22\uFF08FTS + \u5411\u91CF + \u57FA\u7840\uFF09","cli.cmd.node.summary":"node <name|id> \u663E\u793A\u5355\u4E2A\u8282\u70B9\u7684\u8BE6\u60C5","cli.cmd.context.summary":"context <id> \u6784\u5EFA\u8282\u70B9\u5468\u56F4\u7684\u5B50\u56FE\u4E0A\u4E0B\u6587","cli.cmd.impact.summary":"impact <id> \u5F71\u54CD\u534A\u5F84\uFF08BFS \u5165\u8FB9\uFF09","cli.cmd.callers.summary":"callers <sym> \u8C01\u8C03\u7528\u4E86 <symbol>","cli.cmd.callees.summary":"callees <sym> <symbol> \u8C03\u7528\u4E86\u8C01","cli.cmd.explore.summary":"explore <q> \u4E3B\u5DE5\u5177 \u2014 \u4E00\u6B21\u8C03\u7528\u8FD4\u56DE\u6E90\u7801 + \u8C03\u7528\u94FE","cli.cmd.dead_code.summary":"dead-code \u67E5\u627E\u672A\u4F7F\u7528\u7684\u7B26\u53F7","cli.cmd.circular.summary":"circular \u68C0\u6D4B\u5FAA\u73AF\u4F9D\u8D56","cli.cmd.path.summary":"path <from> <to> \u67E5\u627E\u4E24\u4E2A\u8282\u70B9\u4E4B\u95F4\u7684\u6700\u77ED\u8DEF\u5F84","cli.cmd.mcp.summary":"mcp [dir] \u542F\u52A8 stdio MCP \u670D\u52A1\u5668\uFF08\u66B4\u9732 9 \u4E2A codebase \u5DE5\u5177\uFF09","cli.cmd.init.description":"\u5728\u76EE\u6807\u76EE\u5F55\u521D\u59CB\u5316 .easbot/codebase.json","cli.cmd.index.description":"\u6784\u5EFA\u5B8C\u6574\u7D22\u5F15\uFF08\u7F3A\u5931 db \u65F6\u81EA\u52A8\u521B\u5EFA\uFF09","cli.cmd.sync.description":"\u8FD0\u884C\u589E\u91CF\u540C\u6B65\uFF08\u4EC5\u53D8\u66F4\u8FC7\u7684\u6587\u4EF6\uFF09","cli.cmd.recreate.description":"\u4E22\u5F03\u6574\u4E2A\u6570\u636E\u5E93\u5E76\u91CD\u65B0\u521D\u59CB\u5316","cli.cmd.clear.description":"\u6E05\u7A7A\u6240\u6709\u8282\u70B9/\u8FB9\uFF08\u4FDD\u7559 config.json\uFF09","cli.cmd.status.description":"\u663E\u793A\u7D22\u5F15\u72B6\u6001 / \u6570\u636E\u5E93 / \u914D\u7F6E","cli.cmd.doctor.description":"\u8FD0\u884C\u5065\u5EB7\u68C0\u67E5\uFF08\u540E\u7AEF / FTS / parser\uFF09","cli.cmd.config.description":"\u8BFB\u53D6/\u8BBE\u7F6E .easbot/codebase.json \u5B57\u6BB5","cli.cmd.upgrade.description":"extraction_version \u8FC7\u65F6\u65F6\u66F4\u65B0\u5143\u6570\u636E","cli.cmd.embed.description":"\u751F\u6210 / \u68C0\u67E5\u8282\u70B9\u5D4C\u5165\u5411\u91CF\uFF08dry-run / pending-list\uFF09","cli.cmd.watch.description":"\u76D1\u542C\u5DE5\u4F5C\u533A\u6587\u4EF6\u53D8\u66F4\uFF08\u81EA\u52A8\u540C\u6B65\uFF09","cli.cmd.stop.description":"\u505C\u6B62\u6B63\u5728\u8FD0\u884C\u7684\u6587\u4EF6\u76D1\u542C\u5668","cli.cmd.query.description":"\u6DF7\u5408\u641C\u7D22\uFF08FTS + \u5411\u91CF + \u57FA\u7840\uFF09","cli.cmd.node.description":"\u663E\u793A\u5355\u4E2A\u8282\u70B9\u7684\u8BE6\u60C5","cli.cmd.context.description":"\u6784\u5EFA\u8282\u70B9\u5468\u56F4\u7684\u5B50\u56FE\u4E0A\u4E0B\u6587","cli.cmd.impact.description":"\u5F71\u54CD\u534A\u5F84\uFF08BFS \u5165\u8FB9\uFF09","cli.cmd.callers.description":"\u8C01\u8C03\u7528\u4E86 <symbol>\uFF08\u5165\u8FB9\uFF09","cli.cmd.callees.description":"<symbol> \u8C03\u7528\u4E86\u8C01\uFF08\u51FA\u8FB9\uFF09","cli.cmd.explore.description":"\u4E3B\u5DE5\u5177 \u2014 \u4E00\u6B21\u8C03\u7528\u8FD4\u56DE\u6E90\u7801 + \u8C03\u7528\u94FE","cli.cmd.dead_code.description":"\u67E5\u627E\u672A\u4F7F\u7528\u7684\u7B26\u53F7","cli.cmd.circular.description":"\u68C0\u6D4B\u5FAA\u73AF\u4F9D\u8D56\uFF08Tarjan SCC\uFF09","cli.cmd.path.description":"\u67E5\u627E\u4E24\u4E2A\u8282\u70B9\u4E4B\u95F4\u7684\u6700\u77ED\u8DEF\u5F84","cli.cmd.mcp.description":"\u542F\u52A8 stdio MCP \u670D\u52A1\u5668\uFF08\u66B4\u9732 9 \u4E2A codebase \u5DE5\u5177\uFF09","cli.shared.show_help":"\u663E\u793A\u6B64\u5E2E\u52A9","cli.init.usage":"\u7528\u6CD5: easbot codebase init [dir] [--force]","cli.init.description":"\u5728\u76EE\u6807\u76EE\u5F55\u521D\u59CB\u5316 .easbot/codebase.json\u3002","cli.init.creates":"\u521B\u5EFA .easbot/codebase.json\uFF0C\u9ED8\u8BA4\u540E\u7AEF\u4E3A better-sqlite3\u3002","cli.init.opt.force":"--force, -f \u8986\u76D6\u5DF2\u5B58\u5728\u7684 config.json","cli.init.exists":"codebase \u914D\u7F6E\u5DF2\u5B58\u5728\u4E8E {{path}}\uFF08\u4F7F\u7528 --force \u8986\u76D6\uFF09","cli.init.created":"\u2713 codebase \u5DF2\u5728 {{path}} \u521D\u59CB\u5316","cli.status.usage":"\u7528\u6CD5: easbot codebase status [--json] [dir]","cli.doctor.usage":"\u7528\u6CD5: easbot codebase doctor [dir]","cli.index.usage":"\u7528\u6CD5: easbot codebase index [dir] [--embed] [--no-embed] [--batch=N] [--json]","cli.index.description":"\u4E3A\u76EE\u6807\u76EE\u5F55\u6784\u5EFA\u5B8C\u6574\u7D22\u5F15\u3002","cli.index.auto_init":"\u5982\u679C .easbot/codebase.json \u4E0D\u5B58\u5728\u4F1A\u81EA\u52A8\u521D\u59CB\u5316\u3002","cli.index.opt.embed":"--embed \u751F\u6210\u8282\u70B9\u5D4C\u5165\u5411\u91CF\uFF08\u9ED8\u8BA4\u8DF3\u8FC7\uFF09","cli.index.opt.no_embed":"--no-embed \u540C\u9ED8\u8BA4\uFF08\u8DF3\u8FC7\u5D4C\u5165\uFF09","cli.index.opt.batch":"--batch=N \u7D22\u5F15\u6279\u5927\u5C0F\uFF08\u9ED8\u8BA4 50\uFF09","cli.index.opt.json":"--json \u4EE5 JSON \u8F93\u51FA\uFF08\u65E0 ANSI \u989C\u8272\uFF09","cli.sync.usage":"\u7528\u6CD5: easbot codebase sync [--embed] [--no-embed] [--quiet] [--json] [dir]","cli.sync.description":"\u8FD0\u884C\u589E\u91CF\u540C\u6B65\uFF08\u4EC5\u589E/\u6539/\u5220\u53D8\u66F4\u8FC7\u7684\u6587\u4EF6\uFF09\u3002","cli.sync.auto_version":"\u6210\u529F\u65F6\u81EA\u52A8\u66F4\u65B0 meta['indexed_with_version']\u3002","cli.sync.opt.embed":"--embed \u542F\u7528\u8282\u70B9\u5D4C\u5165\u5411\u91CF\uFF08\u9ED8\u8BA4\u5173\u95ED\uFF0C\u4EC5 FTS\uFF09","cli.sync.opt.no_embed":"--no-embed \u663E\u5F0F\u7981\u7528\u5D4C\u5165\u5411\u91CF\uFF08\u9ED8\u8BA4\uFF09","cli.sync.opt.quiet":"--quiet, -q \u4EC5\u6253\u5370\u6458\u8981","cli.sync.opt.json":"--json \u4EE5 JSON \u8F93\u51FA\uFF08\u65E0 ANSI \u989C\u8272\uFF09","cli.recreate.usage":"\u7528\u6CD5: easbot codebase recreate [--keep-config] [--force] [dir]","cli.recreate.description":"\u4E22\u5F03\u6574\u4E2A\u6570\u636E\u5E93\uFF08codebase.db + -wal + -shm\uFF09\u5E76\u91CD\u65B0\u521D\u59CB\u5316\u3002","cli.recreate.equivalent":"\u7B49\u4EF7\u4E8E codegraph `recreate()`\uFF0C\u7528\u4E8E\u5B89\u5168\u7684\u7D22\u5F15\u6062\u590D\u3002","cli.recreate.opt.keep_config":"--keep-config \u4FDD\u7559 .easbot/codebase.json\uFF08\u4EC5\u5220\u9664 db\uFF09","cli.recreate.opt.force":"--force, -f \u8DF3\u8FC7\u5B89\u5168\u786E\u8BA4\uFF08\u7528\u4E8E\u811A\u672C\uFF09","cli.recreate.opt.json":"--json \u4EE5 JSON \u683C\u5F0F\u8F93\u51FA","cli.recreate.warn":"\u26A0\uFE0F \u8FD9\u4F1A\u5220\u9664\u6574\u4E2A\u7D22\u5F15\u3002\u8BF7\u4E4B\u540E\u8FD0\u884C `index`\u3002","cli.clear.usage":"\u7528\u6CD5: easbot codebase clear [--keep-embeddings] [--force] [dir]","cli.clear.description":"\u6E05\u7A7A\u6240\u6709\u8282\u70B9/\u8FB9/file_hashes\uFF1B\u4FDD\u7559 config.json \u4E0E meta\u3002","cli.clear.reset_state":'index_state \u91CD\u7F6E\u4E3A "uninitialized"\uFF0C`status` \u4F1A\u5EFA\u8BAE\u8FD0\u884C `index`\u3002',"cli.clear.opt.keep_embeddings":"--keep-embeddings \u4FDD\u7559 node_embeddings / embedding_cache","cli.clear.opt.force":"--force, -f \u8DF3\u8FC7\u5B89\u5168\u786E\u8BA4\uFF08\u7528\u4E8E\u811A\u672C\uFF09","cli.clear.opt.json":"--json \u4EE5 JSON \u683C\u5F0F\u8F93\u51FA","cli.clear.hint":"\u{1F4A1} \u5982\u679C\u60F3\u5220\u9664\u6574\u4E2A db \u6587\u4EF6\uFF0C\u8BF7\u4F7F\u7528 `recreate`\u3002","cli.config.usage":"\u7528\u6CD5: easbot codebase config <get|set> [key] [value] [--json] [dir]","cli.config.description":"\u8BFB\u53D6\u6216\u5199\u5165 .easbot/codebase.json \u5B57\u6BB5\u3002","cli.config.subcommands":"\u5B50\u547D\u4EE4:","cli.config.get":"get [key] \u663E\u793A\u5168\u90E8\u5B57\u6BB5\uFF08\u6216\u67D0\u4E2A\u5B57\u6BB5\uFF09","cli.config.set":"set <key> <value> \u66F4\u65B0\u67D0\u4E2A\u5B57\u6BB5\uFF08\u5FC5\u987B\u5728\u767D\u540D\u5355\u4E2D\uFF09","cli.config.allowed_keys":"\u5141\u8BB8\u7684\u952E: backend, schema_version, extraction_version, index_state","cli.config.opt.json":"--json \u4EE5 JSON \u8F93\u51FA\uFF08\u65E0 ANSI \u989C\u8272\uFF09","cli.config.no_subcommand":"config \u9700\u8981\u5B50\u547D\u4EE4: get | set","cli.config.unknown_subcommand":"\u672A\u77E5\u7684 config \u5B50\u547D\u4EE4: {{subcommand}}","cli.upgrade.usage":"\u7528\u6CD5: easbot codebase upgrade [--schema] [--force] [dir]","cli.upgrade.description":"\u5F53 indexed_with_extraction_version \u8FC7\u65F6\u65F6\u66F4\u65B0\u5143\u6570\u636E\u3002","cli.upgrade.does_not_delete":"\u4E0D\u4F1A\u5220\u9664\u6570\u636E \u2014 \u4F7F\u7528 `recreate` \u5220\u9664\u6574\u4E2A db\u3002","cli.upgrade.opt.schema":"--schema \u540C\u65F6\u91CD\u8DD1 ensureSchema\uFF08\u5E42\u7B49\u7684 CREATE TABLE IF NOT EXISTS\uFF09","cli.upgrade.opt.force":"--force, -f \u5373\u4F7F\u672A\u8FC7\u671F\u4E5F\u66F4\u65B0\u7248\u672C","cli.embed.usage":"\u7528\u6CD5: easbot codebase embed [--all] [--dry-run|-n] [--pending-list|-p] [--batch=N] [--json] [dir]","cli.embed.description":"\u4E3A node_embeddings \u4E2D\u7F3A\u5931\u7684\u8282\u70B9\u751F\u6210\u5D4C\u5165\u5411\u91CF\u3002","cli.embed.statistical_only":"CLI \u4EC5\u505A\u7EDF\u8BA1 \u2014 \u771F\u6B63\u7684\u5D4C\u5165\u751F\u6210\u9700\u8981","cli.embed.repl_required":"\u5728\u6CE8\u5165 EmbeddingModel \u7684 `easbot` REPL \u4F1A\u8BDD\u4E2D\u5B8C\u6210\u3002","cli.embed.opt.all":"--all \u5F3A\u5236\u4E3A\u6240\u6709\u8282\u70B9\u91CD\u65B0\u751F\u6210","cli.embed.opt.dry_run":"--dry-run, -n \u4EC5\u6253\u5370\u7EDF\u8BA1\uFF08CLI \u9ED8\u8BA4\u884C\u4E3A\uFF09","cli.embed.opt.pending":"--pending-list, -p \u5217\u51FA\u5F85\u5D4C\u5165\u7684\u8282\u70B9 id","cli.embed.opt.batch":"--batch=N \u5D4C\u5165\u6279\u5927\u5C0F\uFF08\u9ED8\u8BA4 10\uFF09","cli.embed.opt.json":"--json \u4EE5 JSON \u8F93\u51FA","cli.embed.env.heading":"\u73AF\u5883\u53D8\u91CF:","cli.embed.env.model":"EASBOT_EMBEDDING_MODEL \u5982 openai/text-embedding-3-small","cli.query.usage":"\u7528\u6CD5: easbot codebase query <q...> [--language=<lang>] [--ast=<type>] [--max=N] [--no-edges] [--no-vector|--no-embed] [--json] [--dir=<dir>]","cli.query.description":"\u5BF9\u5DF2\u7D22\u5F15\u4EE3\u7801\u8282\u70B9\u505A\u6DF7\u5408\u641C\u7D22\uFF08FTS + \u5411\u91CF + \u57FA\u7840\uFF09\u3002","cli.query.aliases":"\u522B\u540D: search","cli.query.opt.language":"--language=<lang> \u6309\u8BED\u8A00\u8FC7\u6EE4\uFF08ts / js / py / go / ...\uFF09","cli.query.opt.ast":"--ast=<type> \u6309 AST \u7C7B\u578B\u8FC7\u6EE4\uFF08class_declaration / function_declaration / ...\uFF09","cli.query.opt.max":"--max=<N> \u6700\u5927\u7ED3\u679C\u6570\uFF08\u9ED8\u8BA4 20\uFF09","cli.query.opt.no_edges":"--no-edges \u7ED3\u679C\u4E2D\u4E0D\u5305\u542B\u8FB9\uFF08\u9ED8\u8BA4: \u5305\u542B\uFF09","cli.query.opt.no_vector":"--no-vector / --no-embed \u7981\u7528\u5411\u91CF\u641C\u7D22\uFF08\u4EC5 FTS + \u57FA\u7840\uFF0C\u9ED8\u8BA4: \u542F\u7528\u5411\u91CF\uFF09","cli.query.opt.json":"--json JSON \u8F93\u51FA","cli.query.opt.dir":"--dir=<dir> \u76EE\u6807\u5DE5\u4F5C\u533A\uFF08\u9ED8\u8BA4: cwd\uFF09","cli.node.usage":"\u7528\u6CD5: easbot codebase node <name|id> [--file=<path>] [--kind=<kind>] [--edges] [--max=N] [--json] [--dir=<dir>]","cli.node.description":"\u663E\u793A\u5355\u4E2A\u8282\u70B9\u7684\u8BE6\u60C5\u3002","cli.node.accepts_name":"\u63A5\u53D7\u7B26\u53F7\u540D <name>\uFF08\u5BF9 LLM \u53CB\u597D\uFF0C\u4E0E tool/MCP \u5BF9\u9F50\uFF09","cli.node.accepts_id":"\u6216\u6765\u81EA `query` / \u6570\u636E\u5E93\u7684\u539F\u59CB <node-id>\u3002","cli.node.opt.file":"--file=<path> \u540C\u540D\u7B26\u53F7\u5B58\u5728\u65F6\u7528\u4E8E\u6D88\u6B67","cli.node.opt.kind":"--kind=<kind> \u6309 AST \u7C7B\u578B\u8FC7\u6EE4/\u6D88\u6B67","cli.node.opt.edges":"--edges \u5305\u542B\u5165\u8FB9/\u51FA\u8FB9\u6C47\u603B","cli.node.opt.max":"--max=<N> \u8FB9\u6570\u91CF\u4E0A\u9650\uFF08\u9ED8\u8BA4 50\uFF09","cli.node.opt.json":"--json \u4EE5 JSON \u8F93\u51FA","cli.node.opt.dir":"--dir=<dir> \u76EE\u6807\u5DE5\u4F5C\u533A\uFF08\u9ED8\u8BA4: cwd\uFF09","cli.context.usage":"\u7528\u6CD5: easbot codebase context <id> [--depth=N] [--max=N] [--direction=<incoming|outgoing|both>] [--relation=<r1,r2,...>] [--json] [--dir=<dir>]","cli.context.description":"\u6784\u5EFA\u8282\u70B9\u5468\u56F4\u7684\u5B50\u56FE\u4E0A\u4E0B\u6587\uFF08BFS \u90BB\u63A5 N \u5C42\uFF09\u3002","cli.context.opt.depth":"--depth=<N> BFS \u6DF1\u5EA6\uFF08\u9ED8\u8BA4 2\uFF09","cli.context.opt.max":"--max=<N> \u6700\u5927\u8282\u70B9\u6570\uFF08\u9ED8\u8BA4 100\uFF09","cli.context.opt.direction":"--direction=<dir> incoming | outgoing | both\uFF08\u9ED8\u8BA4 both\uFF09","cli.context.opt.relation":"--relation=<r1,r2,...> \u6309\u5173\u7CFB\u7C7B\u578B\u8FC7\u6EE4\uFF08CALLS / IMPORTS / TYPE_REFERENCES / EXTENDS / IMPLEMENTS / USES / REFERENCES\uFF09","cli.context.opt.json":"--json \u4EE5 JSON \u8F93\u51FA","cli.context.opt.dir":"--dir=<dir> \u76EE\u6807\u5DE5\u4F5C\u533A\uFF08\u9ED8\u8BA4: cwd\uFF09","cli.impact.usage":"\u7528\u6CD5: easbot codebase impact <id> [-d=N | --depth=N] [--relation=<r1,r2,...>] [--json] [--dir=<dir>]","cli.impact.description":"\u5F71\u54CD\u534A\u5F84: BFS \u5165\u5411 CALLS / REFERENCES / USES / IMPORTS / TYPE_REFERENCES\uFF0C\u6309\u6DF1\u5EA6\u5206\u6876\u3002","cli.impact.opt.depth":"--depth=<N> BFS \u6DF1\u5EA6\uFF08\u9ED8\u8BA4 3\uFF09","cli.impact.opt.relation":"--relation=<r1,r2,...> \u6309\u5173\u7CFB\u7C7B\u578B\u8FC7\u6EE4","cli.impact.opt.json":"--json \u4EE5 JSON \u8F93\u51FA","cli.impact.opt.dir":"--dir=<dir> \u76EE\u6807\u5DE5\u4F5C\u533A\uFF08\u9ED8\u8BA4: cwd\uFF09","cli.callers.usage":"\u7528\u6CD5: easbot codebase callers <symbol> [--node-id=<id>] [--file=<path>] [--kind=<kind>] [--max=N] [--json] [--dir=<dir>]","cli.callers.description":"\u8C01\u8C03\u7528\u4E86 <symbol>\uFF08\u5165\u5411 CALLS / IMPORTS / TYPE_REFERENCES / EXTENDS / IMPLEMENTS\uFF09\u3002","cli.callers.accepts":"\u63A5\u53D7\u7B26\u53F7\u540D <symbol>\uFF08\u5BF9 LLM \u53CB\u597D\uFF09\u6216 --node-id \u6307\u5B9A\u539F\u59CB\u8282\u70B9 id\u3002","cli.callers.opt.node_id":"--node-id=<id> \u6765\u81EA `query` / \u6570\u636E\u5E93\u7684\u539F\u59CB\u8282\u70B9 id","cli.callers.opt.file":"--file=<path> \u6587\u4EF6\u8DEF\u5F84\u6216 basename \u7528\u4E8E\u540C\u540D\u7B26\u53F7\u6D88\u6B67","cli.callers.opt.kind":"--kind=<kind> \u6309\u8282\u70B9\u7C7B\u578B\u8FC7\u6EE4\uFF08class_declaration / function_declaration / ...\uFF09","cli.callers.opt.max":"--max=<N> \u6700\u5927\u8C03\u7528\u8005\u6570\uFF08\u9ED8\u8BA4 20\uFF09","cli.callers.opt.json":"--json \u4EE5 JSON \u8F93\u51FA","cli.callers.opt.dir":"--dir=<dir> \u76EE\u6807\u5DE5\u4F5C\u533A\uFF08\u9ED8\u8BA4: cwd\uFF09","cli.callees.usage":"\u7528\u6CD5: easbot codebase callees <symbol> [--node-id=<id>] [--file=<path>] [--kind=<kind>] [--max=N] [--json] [--dir=<dir>]","cli.callees.description":"<symbol> \u8C03\u7528\u4E86\u8C01\uFF08\u51FA\u5411\u8FB9\uFF09\u3002","cli.callees.accepts":"\u63A5\u53D7\u7B26\u53F7\u540D <symbol>\uFF08\u5BF9 LLM \u53CB\u597D\uFF09\u6216 --node-id \u6307\u5B9A\u539F\u59CB\u8282\u70B9 id\u3002","cli.callees.opt.node_id":"--node-id=<id> \u6765\u81EA `query` / \u6570\u636E\u5E93\u7684\u539F\u59CB\u8282\u70B9 id","cli.callees.opt.file":"--file=<path> \u6587\u4EF6\u8DEF\u5F84\u6216 basename \u7528\u4E8E\u6D88\u6B67","cli.callees.opt.kind":"--kind=<kind> \u6309\u8282\u70B9\u7C7B\u578B\u8FC7\u6EE4","cli.callees.opt.max":"--max=<N> \u6700\u5927\u88AB\u8C03\u7528\u6570\uFF08\u9ED8\u8BA4 20\uFF09","cli.callees.opt.json":"--json \u4EE5 JSON \u8F93\u51FA","cli.callees.opt.dir":"--dir=<dir> \u76EE\u6807\u5DE5\u4F5C\u533A\uFF08\u9ED8\u8BA4: cwd\uFF09","cli.explore.usage":"\u7528\u6CD5: easbot codebase explore <query> [--file=<path>] [--kind=<kind>] [--max-files=N] [--max-symbols=N] [--depth=N] [--no-content] [--intent=<ctx>] [--json] [--dir=<dir>]","cli.explore.description":"\u4E3B\u5DE5\u5177 \u2014 \u5355\u6B21\u8C03\u7528\u8FD4\u56DE\u6E90\u7801 + \u8C03\u7528\u94FE\u3002","cli.explore.query_help":"<query> \u53EF\u4EE5\u662F\u7B26\u53F7\u540D\u6216\u81EA\u7136\u8BED\u8A00\u3002","cli.explore.opt.file":"--file=<path> \u6587\u4EF6\u8DEF\u5F84\u6216 basename \u7528\u4E8E\u6D88\u6B67","cli.explore.opt.kind":"--kind=<kind> \u6309\u8282\u70B9\u7C7B\u578B\u8FC7\u6EE4","cli.explore.opt.max_files":"--max-files=<N> \u6700\u5927\u5165\u53E3\u6587\u4EF6\u6570\uFF08\u9ED8\u8BA4 5\uFF09","cli.explore.opt.max_symbols":"--max-symbols=<N> \u6BCF\u6587\u4EF6\u6700\u5927\u7B26\u53F7\u6570\uFF08\u9ED8\u8BA4 3\uFF09","cli.explore.opt.depth":"--depth=<N> \u8C03\u7528\u94FE\u7684\u90BB\u63A5\u6DF1\u5EA6\uFF08\u9ED8\u8BA4 1\uFF09","cli.explore.opt.no_content":"--no-content \u4E0D\u5305\u542B\u6E90\u7801\uFF08\u4EC5\u4F4D\u7F6E\uFF0C\u9ED8\u8BA4: \u5305\u542B\uFF09","cli.explore.opt.intent":"--intent=<ctx> \u7528\u4E8E\u6392\u5E8F\u7684 LLM \u4E0A\u4E0B\u6587\u4E32","cli.explore.opt.json":"--json \u4EE5 JSON \u8F93\u51FA","cli.explore.opt.dir":"--dir=<dir> \u76EE\u6807\u5DE5\u4F5C\u533A\uFF08\u9ED8\u8BA4: cwd\uFF09","cli.dead_code.usage":"\u7528\u6CD5: easbot codebase dead-code [--type=<t1,t2,...>] [--no-exclude-entry] [--limit=N] [--json] [--dir=<dir>]","cli.dead_code.description":"\u67E5\u627E\u65E0\u5165\u8FB9\u7684\u8282\u70B9\uFF08\u542F\u53D1\u5F0F\u6B7B\u4EE3\u7801\uFF09\u3002","cli.dead_code.opt.type":"--type=<t1,t2,...> \u4EC5\u8003\u8651\u8FD9\u4E9B AST \u7C7B\u578B","cli.dead_code.opt.no_exclude_entry":"--no-exclude-entry \u5305\u542B\u5165\u53E3\u6587\u4EF6\uFF08\u9ED8\u8BA4: \u6392\u9664\uFF09","cli.dead_code.opt.limit":"--limit=<N> \u6700\u5927\u7ED3\u679C\u6570\uFF08\u9ED8\u8BA4 100\uFF09","cli.dead_code.opt.json":"--json \u4EE5 JSON \u8F93\u51FA","cli.dead_code.opt.dir":"--dir=<dir> \u76EE\u6807\u5DE5\u4F5C\u533A\uFF08\u9ED8\u8BA4: cwd\uFF09","cli.circular.usage":"\u7528\u6CD5: easbot codebase circular [--relation=<r>] [--scope=<file|module>] [--json] [--dir=<dir>]","cli.circular.description":"\u901A\u8FC7 Tarjan SCC \u68C0\u6D4B\u5FAA\u73AF\u4F9D\u8D56\u3002","cli.circular.opt.relation":"--relation=<r> \u8DDF\u968F\u7684\u5173\u7CFB\u7C7B\u578B\uFF08\u9ED8\u8BA4 IMPORTS\uFF09","cli.circular.opt.scope":"--scope=<scope> file | module\uFF08\u9ED8\u8BA4 file\uFF09","cli.circular.opt.json":"--json \u4EE5 JSON \u8F93\u51FA","cli.circular.opt.dir":"--dir=<dir> \u76EE\u6807\u5DE5\u4F5C\u533A\uFF08\u9ED8\u8BA4: cwd\uFF09","cli.path.usage":"\u7528\u6CD5: easbot codebase path <from> <to> [-d=N | --depth=N] [--relation=<r1,r2,...>] [--json] [--dir=<dir>]","cli.path.description":"\u67E5\u627E\u4E24\u4E2A\u8282\u70B9\u4E4B\u95F4\u7684\u6700\u77ED\u8DEF\u5F84\uFF08\u6CBF CALLS / IMPORTS / TYPE_REFERENCES / USES / REFERENCES \u505A BFS\uFF09\u3002","cli.path.opt.depth":"--depth=<N> BFS \u6DF1\u5EA6\u4E0A\u9650\uFF08\u9ED8\u8BA4 6\uFF09","cli.path.opt.relation":"--relation=<r1,r2,...> \u6309\u5173\u7CFB\u7C7B\u578B\u8FC7\u6EE4","cli.path.opt.json":"--json \u4EE5 JSON \u8F93\u51FA","cli.path.opt.dir":"--dir=<dir> \u76EE\u6807\u5DE5\u4F5C\u533A\uFF08\u9ED8\u8BA4: cwd\uFF09","cli.mcp.usage":"\u7528\u6CD5: easbot codebase mcp [dir]","cli.mcp.description":"\u542F\u52A8 stdio MCP \u670D\u52A1\u5668\uFF0C\u66B4\u9732 9 \u4E2A codebase \u5DE5\u5177:","cli.mcp.tools.1":" query / node / context / impact","cli.mcp.tools.2":" callers / callees / explore","cli.mcp.tools.3":" status / doctor","cli.mcp.transport":"\u901A\u8FC7 stdio JSON-RPC \u4ECE MCP \u5BA2\u6237\u7AEF\u8FDE\u63A5\u3002","cli.watch.usage":"\u7528\u6CD5: easbot codebase watch [--debounce=N] [--interval=N] [dir]","cli.watch.description":"\u76D1\u542C\u5DE5\u4F5C\u533A\u76EE\u5F55\u7684\u6587\u4EF6\u53D8\u66F4\u5E76\u8BB0\u5F55\u4E8B\u4EF6\u3002","cli.watch.pid_file":"\u5728 .easbot/.watcher.pid \u5199\u5165 pid \u6587\u4EF6\uFF0C\u4F9B\u540E\u7EED `stop` \u4F7F\u7528\u3002","cli.watch.opt.debounce":"--debounce=N \u5355\u8DEF\u5F84\u9632\u6296\uFF08\u6BEB\u79D2\uFF0C\u9ED8\u8BA4 200\uFF09","cli.watch.opt.interval":"--interval=N \u8F6E\u8BE2\u95F4\u9694\uFF08\u6BEB\u79D2\uFF0C\u9ED8\u8BA4 500\uFF09","cli.watch.note":"\u6CE8\u610F: \u8BE5\u547D\u4EE4\u4F1A\u963B\u585E\u3002\u6309 Ctrl+C \u9000\u51FA\u3002","cli.stop.usage":"\u7528\u6CD5: easbot codebase stop [dir]","cli.stop.description":"\u505C\u6B62\u7531 .easbot/.watcher.pid \u6807\u8BC6\u7684\u8FD0\u884C\u4E2D\u76D1\u542C\u5668\u3002","cli.stop.opt.force":"--force, -f \u5FFD\u7565\u9519\u8BEF\u5E76\u5F3A\u5236\u6E05\u7406 pid \u6587\u4EF6","cli.shared.options_heading":"\u9009\u9879:","cli.shared.subcommands_heading":"\u5B50\u547D\u4EE4:","cli.shared.environment_heading":"\u73AF\u5883\u53D8\u91CF:","cli.unknown_command":"\u672A\u77E5\u547D\u4EE4: {{command}}","cli.help_hint":"\u8FD0\u884C `easbot codebase --help` \u67E5\u770B\u53EF\u7528\u547D\u4EE4\u3002","cli.signal_cleanup":"[codebase] \u6536\u5230 {{signal}}\uFF0C\u6B63\u5728\u6E05\u7406...","cli.command_failed":"codebase {{command}} \u6267\u884C\u5931\u8D25: {{message}}"}},Qt=vn;var On={translation:{"cli.banner.title":"easbot-codebase \u2014 code knowledge graph ecosystem","cli.banner.usage":"Usage: easbot-codebase <command> [options]","cli.banner.section.lifecycle":"Commands (lifecycle):","cli.banner.section.graph":"Commands (graph query):","cli.banner.section.external":"External:","cli.banner.hint.run_help":"Run `easbot codebase <command> --help` for details.","cli.banner.local.title":"Local CLI:","cli.banner.local.body":"This package is also published as `easbot-codebase` for standalone use.","cli.banner.local.agent":"Agent CLI users: `easbot codebase <command> ...`","cli.banner.local.standalone":"Standalone users: `easbot-codebase <command> ...`","cli.cmd.init.summary":"init [dir] Initialize .easbot/codebase.json in the target directory","cli.cmd.index.summary":"index [dir] Build the full index","cli.cmd.sync.summary":"sync Run incremental sync","cli.cmd.recreate.summary":"recreate Discard the entire db and re-init","cli.cmd.clear.summary":"clear Clear all nodes/edges (keep config.json)","cli.cmd.status.summary":"status Show index state / db / config","cli.cmd.doctor.summary":"doctor Run health checks (backend availability, etc.)","cli.cmd.config.summary":"config Get/set .easbot/codebase.json fields","cli.cmd.upgrade.summary":"upgrade Update extraction_version metadata when stale","cli.cmd.embed.summary":"embed Generate node embeddings","cli.cmd.watch.summary":"watch Watch workspace for file changes (auto-sync)","cli.cmd.stop.summary":"stop Stop a running file watcher","cli.cmd.query.summary":"query <q...> Hybrid search (FTS + vector + basic)","cli.cmd.node.summary":"node <name|id> Show details for a single node","cli.cmd.context.summary":"context <id> Build sub-graph context around a node","cli.cmd.impact.summary":"impact <id> Blast radius (BFS incoming edges)","cli.cmd.callers.summary":"callers <sym> Flat list of who calls <symbol>","cli.cmd.callees.summary":"callees <sym> Flat list of what <symbol> calls","cli.cmd.explore.summary":"explore <q> PRIMARY tool \u2014 source code + caller/callee trail in one call","cli.cmd.dead_code.summary":"dead-code Find unused symbols","cli.cmd.circular.summary":"circular Detect circular dependencies","cli.cmd.path.summary":"path <from> <to> Find shortest path between two nodes","cli.cmd.mcp.summary":"mcp [dir] Start stdio MCP server (exposes 9 codebase tools)","cli.cmd.init.description":"Initialize .easbot/codebase.json in the target directory","cli.cmd.index.description":"Build the full index (creates db if missing)","cli.cmd.sync.description":"Run incremental sync (only changed files)","cli.cmd.recreate.description":"Discard the entire db and re-init","cli.cmd.clear.description":"Clear all nodes/edges (keep config.json)","cli.cmd.status.description":"Show index state / db / config","cli.cmd.doctor.description":"Run health checks (backend, FTS, parser)","cli.cmd.config.description":"Get/set .easbot/codebase.json fields","cli.cmd.upgrade.description":"Update extraction_version metadata when stale","cli.cmd.embed.description":"Generate / inspect node embeddings (dry-run / pending-list)","cli.cmd.watch.description":"Watch workspace for file changes (auto-sync)","cli.cmd.stop.description":"Stop a running file watcher","cli.cmd.query.description":"Hybrid search (FTS + vector + basic)","cli.cmd.node.description":"Show details for a single node","cli.cmd.context.description":"Build sub-graph context around a node","cli.cmd.impact.description":"Blast radius (BFS incoming edges)","cli.cmd.callers.description":"Flat list of who calls <symbol> (incoming edges)","cli.cmd.callees.description":"Flat list of what <symbol> calls (outgoing edges)","cli.cmd.explore.description":"PRIMARY tool \u2014 source code + caller/callee trail in one call","cli.cmd.dead_code.description":"Find unused symbols","cli.cmd.circular.description":"Detect circular dependencies (Tarjan SCC)","cli.cmd.path.description":"Find shortest path between two nodes","cli.cmd.mcp.description":"Start stdio MCP server (exposes 9 codebase tools)","cli.shared.show_help":"Show this help","cli.init.usage":"Usage: easbot codebase init [dir] [--force]","cli.init.description":"Initialize .easbot/codebase.json in the target directory.","cli.init.creates":"Creates .easbot/codebase.json with default backend = better-sqlite3.","cli.init.opt.force":"--force, -f Overwrite existing config.json","cli.init.exists":"codebase config already exists at {{path}} (use --force to overwrite)","cli.init.created":"\u2713 codebase initialized at {{path}}","cli.status.usage":"Usage: easbot codebase status [--json] [dir]","cli.doctor.usage":"Usage: easbot codebase doctor [dir]","cli.index.usage":"Usage: easbot codebase index [dir] [--embed] [--no-embed] [--batch=N] [--json]","cli.index.description":"Build the full index for the target directory.","cli.index.auto_init":"Auto-initializes .easbot/codebase.json if it does not exist.","cli.index.opt.embed":"--embed Generate node embeddings (default: skip)","cli.index.opt.no_embed":"--no-embed Same as default (skip embedding)","cli.index.opt.batch":"--batch=N Batch size for indexing (default 50)","cli.index.opt.json":"--json Output as JSON (no ANSI)","cli.sync.usage":"Usage: easbot codebase sync [--embed] [--no-embed] [--quiet] [--json] [dir]","cli.sync.description":"Run incremental sync (only adds/updates/deletes changed files).","cli.sync.auto_version":"Auto-updates meta['indexed_with_version'] on success.","cli.sync.opt.embed":"--embed Enable node embeddings (default off, FTS-only)","cli.sync.opt.no_embed":"--no-embed Explicitly disable embeddings (default)","cli.sync.opt.quiet":"--quiet, -q Only print summary","cli.sync.opt.json":"--json Output as JSON (no ANSI)","cli.recreate.usage":"Usage: easbot codebase recreate [--keep-config] [--force] [dir]","cli.recreate.description":"Discard the entire db (codebase.db + -wal + -shm) and re-init.","cli.recreate.equivalent":"Equivalent to codegraph `recreate()` for safe index recovery.","cli.recreate.opt.keep_config":"--keep-config Keep .easbot/codebase.json (only drop db)","cli.recreate.opt.force":"--force, -f Skip safety prompts (for scripts)","cli.recreate.warn":"\u26A0\uFE0F This deletes the entire index. Run `index` after.","cli.clear.usage":"Usage: easbot codebase clear [--keep-embeddings] [--force] [dir]","cli.clear.description":"Clear all nodes/edges/file_hashes; keep config.json and meta.","cli.clear.reset_state":'index_state is reset to "uninitialized" so `status` recommends `index`.',"cli.clear.opt.keep_embeddings":"--keep-embeddings Preserve node_embeddings / embedding_cache","cli.clear.opt.force":"--force, -f Skip safety prompts (for scripts)","cli.clear.opt.json":"--json Output as JSON","cli.clear.hint":"\u{1F4A1} Use `recreate` if you want to drop the entire db file.","cli.config.usage":"Usage: easbot codebase config <get|set> [key] [value] [--json] [dir]","cli.config.description":"Read or write .easbot/codebase.json fields.","cli.config.subcommands":"Subcommands:","cli.config.get":"get [key] Show all fields (or a specific key)","cli.config.set":"set <key> <value> Update a field (must be in allowlist)","cli.config.allowed_keys":"Allowed keys: backend, schema_version, extraction_version, index_state","cli.config.opt.json":"--json Output as JSON (no ANSI)","cli.config.no_subcommand":"config requires a subcommand: get | set","cli.config.unknown_subcommand":"Unknown config subcommand: {{subcommand}}","cli.upgrade.usage":"Usage: easbot codebase upgrade [--schema] [--force] [dir]","cli.upgrade.description":"Update indexed_with_extraction_version metadata when stale.","cli.upgrade.does_not_delete":"Does NOT delete data \u2014 use `recreate` to drop the db entirely.","cli.upgrade.opt.schema":"--schema Also re-run ensureSchema (idempotent CREATE TABLE IF NOT EXISTS)","cli.upgrade.opt.force":"--force, -f Update version even when not stale","cli.embed.usage":"Usage: easbot codebase embed [--all] [--dry-run|-n] [--pending-list|-p] [--batch=N] [--json] [dir]","cli.embed.description":"Generate node embeddings for nodes missing from node_embeddings.","cli.embed.statistical_only":"CLI is statistical-only \u2014 actual embedding generation requires","cli.embed.repl_required":"an `easbot` REPL session with an injected EmbeddingModel.","cli.embed.opt.all":"--all Force regenerate for all nodes","cli.embed.opt.dry_run":"--dry-run, -n Print statistics only (default behavior in CLI)","cli.embed.opt.pending":"--pending-list, -p List node ids that are pending embedding","cli.embed.opt.batch":"--batch=N Embedding batch size (default 10)","cli.embed.opt.json":"--json Output as JSON","cli.embed.env.heading":"Environment:","cli.embed.env.model":"EASBOT_EMBEDDING_MODEL e.g. openai/text-embedding-3-small","cli.query.usage":"Usage: easbot codebase query <q...> [--language=<lang>] [--ast=<type>] [--max=N] [--no-edges] [--no-vector|--no-embed] [--json] [--dir=<dir>]","cli.query.description":"Hybrid search (FTS + vector + basic) over indexed code nodes.","cli.query.aliases":"Aliases: search","cli.query.opt.language":"--language=<lang> Filter by language (ts / js / py / go / ...)","cli.query.opt.ast":"--ast=<type> Filter by AST type (class_declaration / function_declaration / ...)","cli.query.opt.max":"--max=<N> Max results (default 20)","cli.query.opt.no_edges":"--no-edges Do not include edges in results (default: include)","cli.query.opt.no_vector":"--no-vector / --no-embed Disable vector search (FTS + basic only, default: vector on)","cli.query.opt.json":"--json JSON output","cli.query.opt.dir":"--dir=<dir> Target workspace (default: cwd)","cli.node.usage":"Usage: easbot codebase node <name|id> [--file=<path>] [--kind=<kind>] [--edges] [--max=N] [--json] [--dir=<dir>]","cli.node.description":"Show details for a single node.","cli.node.accepts_name":"Accepts a symbol <name> (LLM workflow friendly, tool/MCP-aligned)","cli.node.accepts_id":"or a raw <node-id> from `query` / database.","cli.node.opt.file":"--file=<path> Disambiguate when same-named symbols exist","cli.node.opt.kind":"--kind=<kind> Filter / disambiguate by AST kind","cli.node.opt.edges":"--edges Include incoming / outgoing edge summaries","cli.node.opt.max":"--max=<N> Edge limit (default 50)","cli.node.opt.json":"--json Output as JSON","cli.node.opt.dir":"--dir=<dir> Target workspace (default: cwd)","cli.context.usage":"Usage: easbot codebase context <id> [--depth=N] [--max=N] [--direction=<incoming|outgoing|both>] [--relation=<r1,r2,...>] [--json] [--dir=<dir>]","cli.context.description":"Build a sub-graph context around a node (BFS to N-level neighbors).","cli.context.opt.depth":"--depth=<N> BFS depth (default 2)","cli.context.opt.max":"--max=<N> Max nodes (default 100)","cli.context.opt.direction":"--direction=<dir> incoming | outgoing | both (default both)","cli.context.opt.relation":"--relation=<r1,r2,...> Filter by relation types (CALLS / IMPORTS / TYPE_REFERENCES / EXTENDS / IMPLEMENTS / USES / REFERENCES)","cli.context.opt.json":"--json Output as JSON","cli.context.opt.dir":"--dir=<dir> Target workspace (default: cwd)","cli.impact.usage":"Usage: easbot codebase impact <id> [-d=N | --depth=N] [--relation=<r1,r2,...>] [--json] [--dir=<dir>]","cli.impact.description":"Blast radius: BFS incoming CALLS / REFERENCES / USES / IMPORTS / TYPE_REFERENCES, bucketed by depth.","cli.impact.opt.depth":"--depth=<N> BFS depth (default 3)","cli.impact.opt.relation":"--relation=<r1,r2,...> Filter by relation types","cli.impact.opt.json":"--json Output as JSON","cli.impact.opt.dir":"--dir=<dir> Target workspace (default: cwd)","cli.callers.usage":"Usage: easbot codebase callers <symbol> [--node-id=<id>] [--file=<path>] [--kind=<kind>] [--max=N] [--json] [--dir=<dir>]","cli.callers.description":"Flat list of who calls <symbol> (incoming CALLS / IMPORTS / TYPE_REFERENCES / EXTENDS / IMPLEMENTS).","cli.callers.accepts":"Accepts <symbol> name (LLM-friendly) OR --node-id for raw node id.","cli.callers.opt.node_id":"--node-id=<id> Raw node id from `query` / database","cli.callers.opt.file":"--file=<path> File path or basename to disambiguate when same-named symbols exist","cli.callers.opt.kind":"--kind=<kind> Filter by node kind (class_declaration / function_declaration / ...)","cli.callers.opt.max":"--max=<N> Max callers (default 20)","cli.callers.opt.json":"--json Output as JSON","cli.callers.opt.dir":"--dir=<dir> Target workspace (default: cwd)","cli.callees.usage":"Usage: easbot codebase callees <symbol> [--node-id=<id>] [--file=<path>] [--kind=<kind>] [--max=N] [--json] [--dir=<dir>]","cli.callees.description":"Flat list of what <symbol> calls (outgoing edges).","cli.callees.accepts":"Accepts <symbol> name (LLM-friendly) OR --node-id for raw node id.","cli.callees.opt.node_id":"--node-id=<id> Raw node id from `query` / database","cli.callees.opt.file":"--file=<path> File path or basename to disambiguate","cli.callees.opt.kind":"--kind=<kind> Filter by node kind","cli.callees.opt.max":"--max=<N> Max callees (default 20)","cli.callees.opt.json":"--json Output as JSON","cli.callees.opt.dir":"--dir=<dir> Target workspace (default: cwd)","cli.explore.usage":"Usage: easbot codebase explore <query> [--file=<path>] [--kind=<kind>] [--max-files=N] [--max-symbols=N] [--depth=N] [--no-content] [--intent=<ctx>] [--json] [--dir=<dir>]","cli.explore.description":"PRIMARY tool \u2014 single call to get source code + caller/callee trail.","cli.explore.query_help":"<query> can be a symbol name or natural language.","cli.explore.opt.file":"--file=<path> File path or basename to disambiguate","cli.explore.opt.kind":"--kind=<kind> Filter by node kind","cli.explore.opt.max_files":"--max-files=<N> Max entry-point files (default 5)","cli.explore.opt.max_symbols":"--max-symbols=<N> Max symbols per file (default 3)","cli.explore.opt.depth":"--depth=<N> Neighbor depth for caller/callee trail (default 1)","cli.explore.opt.no_content":"--no-content Do not include source code (locations only, default: include)","cli.explore.opt.intent":"--intent=<ctx> LLM context string for ranking","cli.explore.opt.json":"--json Output as JSON","cli.explore.opt.dir":"--dir=<dir> Target workspace (default: cwd)","cli.dead_code.usage":"Usage: easbot codebase dead-code [--type=<t1,t2,...>] [--no-exclude-entry] [--limit=N] [--json] [--dir=<dir>]","cli.dead_code.description":"Find nodes with no incoming edges (heuristic dead code).","cli.dead_code.opt.type":"--type=<t1,t2,...> Only consider these AST types","cli.dead_code.opt.no_exclude_entry":"--no-exclude-entry Include entry-point files (default: exclude)","cli.dead_code.opt.limit":"--limit=<N> Max results (default 100)","cli.dead_code.opt.json":"--json Output as JSON","cli.dead_code.opt.dir":"--dir=<dir> Target workspace (default: cwd)","cli.circular.usage":"Usage: easbot codebase circular [--relation=<r>] [--scope=<file|module>] [--json] [--dir=<dir>]","cli.circular.description":"Detect circular dependencies via Tarjan SCC.","cli.circular.opt.relation":"--relation=<r> Relation type to follow (default IMPORTS)","cli.circular.opt.scope":"--scope=<scope> file | module (default file)","cli.circular.opt.json":"--json Output as JSON","cli.circular.opt.dir":"--dir=<dir> Target workspace (default: cwd)","cli.path.usage":"Usage: easbot codebase path <from> <to> [-d=N | --depth=N] [--relation=<r1,r2,...>] [--json] [--dir=<dir>]","cli.path.description":"Find shortest path between two nodes (BFS along CALLS / IMPORTS / TYPE_REFERENCES / USES / REFERENCES).","cli.path.opt.depth":"--depth=<N> BFS depth limit (default 6)","cli.path.opt.relation":"--relation=<r1,r2,...> Filter by relation types","cli.path.opt.json":"--json Output as JSON","cli.path.opt.dir":"--dir=<dir> Target workspace (default: cwd)","cli.mcp.usage":"Usage: easbot codebase mcp [dir]","cli.mcp.description":"Start a stdio MCP server exposing 9 codebase tools:","cli.mcp.tools.1":" query / node / context / impact","cli.mcp.tools.2":" callers / callees / explore","cli.mcp.tools.3":" status / doctor","cli.mcp.transport":"Connect from MCP clients via stdio JSON-RPC.","cli.watch.usage":"Usage: easbot codebase watch [--debounce=N] [--interval=N] [dir]","cli.watch.description":"Watch the workspace directory for file changes and log events.","cli.watch.pid_file":"Writes a pid file at .easbot/.watcher.pid for subsequent `stop`.","cli.watch.opt.debounce":"--debounce=N Per-path debounce in ms (default 200)","cli.watch.opt.interval":"--interval=N Polling interval in ms (default 500)","cli.watch.note":"NOTE: This command blocks. Press Ctrl+C to exit.","cli.stop.usage":"Usage: easbot codebase stop [dir]","cli.stop.description":"Stop a running watcher identified by .easbot/.watcher.pid.","cli.stop.opt.force":"--force, -f Ignore errors and clear the pid file anyway","cli.shared.options_heading":"Options:","cli.shared.subcommands_heading":"Subcommands:","cli.shared.environment_heading":"Environment:","cli.unknown_command":"Unknown command: {{command}}","cli.help_hint":"Run `easbot codebase --help` for available commands.","cli.signal_cleanup":"[codebase] received {{signal}}, cleaning up...","cli.command_failed":"codebase {{command}} failed: {{message}}"}},Xt=On;var Tn=()=>{K("zh-CN"),K("en-US"),J("zh-CN",Qt),J("en-US",Xt);};Tn();var Q=new Map;var X=new Map;var $n=o=>{if(X.has(o))return X.get(o);let t=/{{\s*(\w+)\s*}}/g,n=[],e;for(;(e=t.exec(o))!==null;){let i=e[1];i&&!n.includes(i)&&n.push(i);}let s=new RegExp("{{\\s*("+n.join("|")+")\\s*}}","g"),a={keys:n,regex:s};return X.set(o,a),a},Zt=(o,t)=>{if(!o||typeof o!="string")return "";if(!t||Object.keys(t).length===0)return o;let{regex:n,keys:e}=$n(o);return e.length===0||!e.some(a=>a in t)?o:o.replace(n,(a,i)=>{let r=t[i];return r==null?"":String(r)})},Pn=o=>{if(o&&q.locales.includes(o))return o;let t=process.env.EASBOT_LANG?.trim()||process.env.LANG?.trim();if(t){let n=t.replace(/_/g,"-");if(q.locales.includes(n))return n;let e=n.split("-")[0];if(e==="zh")return "zh-CN";if(e==="en")return "en-US"}return q.defaultLocale},eo=o=>{if(!Q.has(o)){let{resources:t}=K(o);Q.set(o,t);}return Q.get(o)},Ln=(o,t={})=>{let n=Pn(t.locale),s=eo(n)?.translation[o];if(s&&typeof s=="string"){let a=Zt(s,t.vars);return a!=null?String(a):String(o)}if(n!==q.defaultLocale){let i=eo(q.defaultLocale)?.translation[o];if(i&&typeof i=="string"){let r=Zt(i,t.vars);return r!=null?String(r):String(o)}}return String(t.fallback??o)},Z=Ln;var ee=utils.Log.create({service:"codebase-cli"});async function Bn(o){try{let{bootstrapLlm:t}=await import('@easbot/llm'),{Llm:n}=await import('./llm-JQV6XWGD.cjs');await t({target:n,cwd:o,subConfigPath:".easbot/codebase.json",embedding:!1,graph:!1});}catch(t){ee.warn("bootstrapLlm failed; Llm-related features will be disabled",{error:t instanceof Error?t.message:String(t)});}}function te(o){return utils.resolveLocaleLang(o?.locale)}function oo(o){let t=(e,s,a)=>Z(e,{locale:o,vars:a,fallback:s}),n=(e,s,a)=>{let i=Gn.filter(r=>r.group===e).map(r=>` ${zn(r.name)}${t(r.i18nKey,r.description)}`).join(`
|
|
22
|
+
`);return `${t(s,a)}
|
|
23
|
+
${i}`};return `
|
|
24
|
+
\x1B[1m${t("cli.banner.title","easbot-codebase \u2014 Code Knowledge Graph for EASBot")}\x1B[0m
|
|
25
|
+
|
|
26
|
+
${t("cli.banner.usage","Usage: easbot-codebase <command> [options]")}
|
|
27
|
+
|
|
28
|
+
${n("lifecycle","cli.banner.section.lifecycle","Commands (lifecycle):")}
|
|
29
|
+
|
|
30
|
+
${n("graph","cli.banner.section.graph","Commands (graph query):")}
|
|
31
|
+
|
|
32
|
+
${n("external","cli.banner.section.external","External:")}
|
|
33
|
+
|
|
34
|
+
Run \x1B[1measbot codebase <command> --help\x1B[0m for details.
|
|
35
|
+
|
|
36
|
+
\x1B[1m${t("cli.banner.local.title","Local CLI:")}\x1B[0m
|
|
37
|
+
${t("cli.banner.local.body","This package is also published as `easbot-codebase` for standalone use.")}
|
|
38
|
+
${t("cli.banner.local.agent","Agent CLI users: `easbot codebase <command> ...`")}
|
|
39
|
+
${t("cli.banner.local.standalone","Standalone users: `easbot-codebase <command> ...`")}
|
|
40
|
+
|
|
41
|
+
\x1B[2m$\x1B[0m easbot-codebase init ${t("cli.cmd.init.description","Initialize .easbot/codebase.json in the target directory")}
|
|
42
|
+
\x1B[2m$\x1B[0m easbot-codebase index ${t("cli.cmd.index.description","Build the full index (creates db if missing)")}
|
|
43
|
+
\x1B[2m$\x1B[0m easbot-codebase status ${t("cli.cmd.status.description","Show index state / db / config")}
|
|
44
|
+
\x1B[2m$\x1B[0m easbot-codebase query <q...> ${t("cli.cmd.query.description","Hybrid search (FTS + vector + basic)")}
|
|
45
|
+
\x1B[2m$\x1B[0m easbot-codebase --help ${t("cli.shared.show_help","Show this help")}
|
|
46
|
+
`}function Wn(o){let t=te(o);console.log(oo(t));}function Ka(o){let t=te(o);console.log(oo(t));}var Gn=[{i18nKey:"cli.cmd.init.description",name:"init [dir]",description:"Initialize .easbot/codebase.json in the target directory",group:"lifecycle"},{i18nKey:"cli.cmd.index.description",name:"index [dir]",description:"Build the full index (creates db if missing)",group:"lifecycle"},{i18nKey:"cli.cmd.sync.description",name:"sync",description:"Run incremental sync (only changed files)",group:"lifecycle"},{i18nKey:"cli.cmd.recreate.description",name:"recreate",description:"Discard the entire db and re-init",group:"lifecycle"},{i18nKey:"cli.cmd.clear.description",name:"clear",description:"Clear all nodes/edges (keep config.json)",group:"lifecycle"},{i18nKey:"cli.cmd.status.description",name:"status",description:"Show index state / db / config",group:"lifecycle"},{i18nKey:"cli.cmd.doctor.description",name:"doctor",description:"Run health checks (backend, FTS, parser)",group:"lifecycle"},{i18nKey:"cli.cmd.config.description",name:"config",description:"Get/set .easbot/codebase.json fields",group:"lifecycle"},{i18nKey:"cli.cmd.upgrade.description",name:"upgrade",description:"Update extraction_version metadata when stale",group:"lifecycle"},{i18nKey:"cli.cmd.embed.description",name:"embed-status",description:"Inspect node embeddings (statistical only \u2014 counts/pending-list). Use MCP `embed` tool to actually generate embeddings.",group:"lifecycle"},{i18nKey:"cli.cmd.watch.description",name:"watch",description:"Watch workspace for file changes (auto-sync)",group:"lifecycle"},{i18nKey:"cli.cmd.stop.description",name:"stop",description:"Stop a running file watcher",group:"lifecycle"},{i18nKey:"cli.cmd.query.description",name:"query <q...>",description:"Hybrid search (FTS + vector + basic)",group:"graph"},{i18nKey:"cli.cmd.node.description",name:"node <name|id>",description:"Show details for a single node",group:"graph"},{i18nKey:"cli.cmd.context.description",name:"context <id>",description:"Build sub-graph context around a node",group:"graph"},{i18nKey:"cli.cmd.impact.description",name:"impact <id>",description:"Blast radius (BFS incoming edges)",group:"graph"},{i18nKey:"cli.cmd.callers.description",name:"callers <symbol>",description:"Flat list of who calls <symbol> (incoming edges)",group:"graph"},{i18nKey:"cli.cmd.callees.description",name:"callees <symbol>",description:"Flat list of what <symbol> calls (outgoing edges)",group:"graph"},{i18nKey:"cli.cmd.explore.description",name:"explore <query>",description:"PRIMARY tool \u2014 source code + caller/callee trail in one call",group:"graph"},{i18nKey:"cli.cmd.dead_code.description",name:"dead-code",description:"Find unused symbols",group:"graph"},{i18nKey:"cli.cmd.circular.description",name:"circular",description:"Detect circular dependencies (Tarjan SCC)",group:"graph"},{i18nKey:"cli.cmd.path.description",name:"path <from> <to>",description:"Find shortest path between two nodes",group:"graph"},{i18nKey:"cli.cmd.mcp.description",name:"mcp [dir]",description:"Start stdio MCP server (exposes 9 codebase tools)",group:"external"}];function zn(o){return o.length>=18?o:o+" ".repeat(18-o.length)}var to=false;function Jn(){if(to)return;to=true;let o=false,t=n=>{o||(o=true,console.error(`
|
|
47
|
+
[codebase] received ${n}, cleaning up...`),setTimeout(()=>process.exit(130),200));};process.on("SIGINT",t),process.on("SIGTERM",t);}async function Va(o,t){Jn();let n=te(t),e=(i,r,c)=>Z(i,{locale:n,vars:c,fallback:r});if(await Bn(t?.cwd??process.cwd()),o.length===0)return Wn(t),{code:0,handled:false};let s=o[0],a=o.slice(1);try{switch(s){case "init":{let i=he(a);if(i.help)return console.log(e("cli.init.usage","Usage: easbot codebase init [dir] [--force] [--json]")),console.log(""),console.log(e("cli.init.description","Initialize .easbot/codebase.json in the target directory.")),console.log(e("cli.init.creates","Creates .easbot/codebase.json with default backend = better-sqlite3.")),console.log(""),console.log(e("cli.shared.options_heading","Options:")),console.log(` ${e("cli.init.opt.force","--force, -f Overwrite existing config.json")}`),console.log(` ${e("cli.init.opt.json","--json Output as JSON (no ANSI)")}`),{code:0,handled:!0,command:s};let r=await j({...i,skipAutoSync:!1});if(i.json){let{business:b,meta:p}=r.skipped?{business:{configPath:r.configPath,backend:r.backend,schemaVersion:r.schemaVersion,created:r.created,skipped:r.skipped},meta:{action:"exists"}}:{business:{configPath:r.configPath,backend:r.backend,schemaVersion:r.schemaVersion,created:r.created,skipped:r.skipped,initialSync:r.initialSync},meta:{action:"created"}};return terminal.emitJsonOk(b,p),{code:0,handled:!0,command:s}}let c={dbPath:r.dbPath};return typeof r.migrationsApplied=="number"&&(c.migrationsApplied=r.migrationsApplied),typeof r.tablesCreated=="number"&&(c.tablesCreated=r.tablesCreated),typeof r.durationMs=="number"&&(c.durationMs=`${r.durationMs}ms`),terminal.printHuman([terminal.formatKnowledgeInit({packageName:"codebase",configPath:r.configPath,backend:r.backend,schemaVersion:r.schemaVersion,skipped:r.skipped===!0,extras:c})],{title:"init codebase workspace",boxed:!0}),{code:0,handled:!0,command:s}}case "status":{let i=Kn(a),r=await G(i);return i.json?terminal.emitJsonOk(r,{dir:i.dir??null}):terminal.printHuman([terminal.formatKnowledgeStatus(Hn(r))],{title:e("cli.cmd.status.description","Show index state / db / config"),boxed:!0}),{code:0,handled:!0,command:s}}case "doctor":{let i=Vn(a);if(i.help)return console.log(e("cli.doctor.usage","Usage: easbot codebase doctor [--dir=<dir>] [--json]")),console.log(""),console.log(e("cli.doctor.description","Run health checks (backend, FTS, parser, db integrity).")),console.log(""),console.log(e("cli.shared.options_heading","Options:")),console.log(` ${e("cli.doctor.opt.dir","--dir=<dir> Target workspace (default: cwd)")}`),console.log(` ${e("cli.doctor.opt.json","--json Output as JSON (no ANSI)")}`),{code:0,handled:!0,command:s};let r=await xe(i);return i.json?terminal.emitJsonOk(r,{healthy:r.healthy,checkCount:r.checks.length,issueCount:r.issues.length,errorCount:r.checks.filter(c=>c.severity==="error").length,warnCount:r.checks.filter(c=>c.severity==="warn").length,dir:i.dir??null}):terminal.printHuman([terminal.formatKnowledgeDoctor(Yn(r))],{title:e("cli.cmd.doctor.description","Run health checks (backend, FTS, parser)"),boxed:!0}),{code:r.healthy?0:1,handled:!0,command:s}}case "index":{let i=we(a);if(i.help)return console.log(e("cli.index.usage","Usage: easbot codebase index [dir] [--embed] [--no-embed] [--batch=N] [--json]")),console.log(""),console.log(e("cli.index.description","Build the full index for the target directory.")),console.log(e("cli.index.auto_init","Auto-initializes .easbot/codebase.json if it does not exist.")),console.log(""),console.log(e("cli.shared.options_heading","Options:")),console.log(` ${e("cli.index.opt.embed","--embed Generate node embeddings (default: skip)")}`),console.log(` ${e("cli.index.opt.no_embed","--no-embed Same as default (skip embedding)")}`),console.log(` ${e("cli.index.opt.batch","--batch=N Batch size for indexing (default 50)")}`),console.log(` ${e("cli.index.opt.json","--json Output as JSON (no ANSI)")}`),{code:0,handled:!0,command:s};let r=await Ee(i);return i.json?terminal.emitJsonOk(r,{success:r.success,dir:i.dir??null,noEmbed:i.noEmbed!==!1,batch:i.batch??null,verbose:i.verbose===!0,quiet:i.quiet===!0}):terminal.printHuman([Ce(r)],{title:e("cli.cmd.index.description","Build the full index (creates db if missing)")}),{code:r.success?0:1,handled:!0,command:s}}case "sync":{let i=Re(a);if(i.help)return console.log(e("cli.sync.usage","Usage: easbot codebase sync [--embed] [--no-embed] [--quiet] [--json] [dir]")),console.log(""),console.log(e("cli.sync.description","Run incremental sync (only adds/updates/deletes changed files).")),console.log(e("cli.sync.auto_version","Auto-updates meta['indexed_with_version'] on success.")),console.log(""),console.log(e("cli.shared.options_heading","Options:")),console.log(` ${e("cli.sync.opt.embed","--embed Enable node embeddings (default off, FTS-only)")}`),console.log(` ${e("cli.sync.opt.no_embed","--no-embed Explicitly disable embeddings (default)")}`),console.log(` ${e("cli.sync.opt.quiet","--quiet, -q Only print summary")}`),console.log(` ${e("cli.sync.opt.json","--json Output as JSON (no ANSI)")}`),{code:0,handled:!0,command:s};let r=await _e(i);return i.json?terminal.emitJsonOk(r,{success:r.success,quiet:i.quiet===!0,dir:i.dir??null}):terminal.printHuman([Ne(r)],{title:e("cli.cmd.sync.description","Run incremental sync (only changed files)")}),{code:r.success?0:1,handled:!0,command:s}}case "recreate":{let i=je(a);if(i.help)return console.log(e("cli.recreate.usage","Usage: easbot codebase recreate [--keep-config] [--force] [--json] [dir]")),console.log(""),console.log(e("cli.recreate.description","Discard the entire db (codebase.db + -wal + -shm) and re-init.")),console.log(e("cli.recreate.equivalent","Equivalent to codegraph `recreate()` for safe index recovery.")),console.log(""),console.log(e("cli.shared.options_heading","Options:")),console.log(` ${e("cli.recreate.opt.keep_config","--keep-config Keep .easbot/codebase.json (only drop db)")}`),console.log(` ${e("cli.recreate.opt.force","--force, -f Skip safety prompts (for scripts)")}`),console.log(` ${e("cli.recreate.opt.json","--json Output as JSON")}`),console.log(""),console.log(e("cli.recreate.warn","\u26A0\uFE0F This deletes the entire index. Run `index` after.")),{code:0,handled:!0,command:s};let r=await ve(i);return i.json?terminal.emitJsonOk(r,{keepConfig:i.keepConfig===!0,force:i.force===!0,dir:i.dir??null}):terminal.printHuman([Oe(r)],{title:e("cli.cmd.recreate.description","Discard the entire db and re-init"),boxed:!0}),{code:0,handled:!0,command:s}}case "clear":{let i=Te(a);if(i.help)return console.log(e("cli.clear.usage","Usage: easbot codebase clear [--keep-embeddings] [--force] [--json] [dir]")),console.log(""),console.log(e("cli.clear.description","Clear all nodes/edges/file_hashes; keep config.json and meta.")),console.log(e("cli.clear.reset_state",'index_state is reset to "uninitialized" so `status` recommends `index`.')),console.log(""),console.log(e("cli.shared.options_heading","Options:")),console.log(` ${e("cli.clear.opt.keep_embeddings","--keep-embeddings Preserve node_embeddings / embedding_cache")}`),console.log(` ${e("cli.clear.opt.force","--force, -f Skip safety prompts (for scripts)")}`),console.log(` ${e("cli.clear.opt.json","--json Output as JSON")}`),console.log(""),console.log(e("cli.clear.hint","\u{1F4A1} Use `recreate` if you want to drop the entire db file.")),{code:0,handled:!0,command:s};let r=await $e(i);return i.json?terminal.emitJsonOk(r,{keepEmbeddings:i.keepEmbeddings===!0,force:i.force===!0,dir:i.dir??null}):terminal.printHuman([Pe(r)],{title:e("cli.cmd.clear.description","Clear all nodes/edges (keep config.json)"),boxed:!0}),{code:0,handled:!0,command:s}}case "config":{let i=Ae(a);if(i.help)return console.log(e("cli.config.usage","Usage: easbot codebase config <get|set> [key] [value] [--json] [dir]")),console.log(""),console.log(e("cli.config.description","Read or write .easbot/codebase.json fields.")),console.log(""),console.log(e("cli.config.subcommands","Subcommands:")),console.log(` ${e("cli.config.get","get [key] Show all fields (or a specific key)")}`),console.log(` ${e("cli.config.set","set <key> <value> Update a field (must be in allowlist)")}`),console.log(""),console.log(e("cli.config.allowed_keys","Allowed keys: backend, schema_version, extraction_version, index_state")),console.log(""),console.log(e("cli.shared.options_heading","Options:")),console.log(` ${e("cli.config.opt.json","--json Output as JSON (no ANSI)")}`),{code:0,handled:!0,command:s};if(!i.subcommand)return console.error(e("cli.config.no_subcommand","config requires a subcommand: get | set")),{code:1,handled:!0,command:s};if(i.subcommand==="get"){let r=await Ue(i);return i.json?terminal.emitJsonOk(r,{subcommand:"get",key:i.key??null,dir:i.dir??null}):terminal.printHuman([We(r)],{title:e("cli.config.get","get [key] Show all fields (or a specific key)")}),{code:0,handled:!0,command:s}}if(i.subcommand==="set"){let r=await Be(i);return i.json?terminal.emitJsonOk(r,{subcommand:"set",key:i.key??null,dir:i.dir??null}):terminal.printHuman([Ge(r)],{title:e("cli.config.set","set <key> <value> Update a field (must be in allowlist)")}),{code:0,handled:!0,command:s}}return console.error(e("cli.config.unknown_subcommand",`Unknown config subcommand: ${i.subcommand}`,{subcommand:i.subcommand})),{code:1,handled:!0,command:s}}case "upgrade":{let i=Ke(a);if(i.help)return console.log(e("cli.upgrade.usage","Usage: easbot codebase upgrade [--schema] [--force] [dir]")),console.log(""),console.log(e("cli.upgrade.description","Update indexed_with_extraction_version metadata when stale.")),console.log(e("cli.upgrade.does_not_delete","Does NOT delete data \u2014 use `recreate` to drop the db entirely.")),console.log(""),console.log(e("cli.shared.options_heading","Options:")),console.log(` ${e("cli.upgrade.opt.schema","--schema Also re-run ensureSchema (idempotent CREATE TABLE IF NOT EXISTS)")}`),console.log(` ${e("cli.upgrade.opt.force","--force, -f Update version even when not stale")}`),{code:0,handled:!0,command:s};let r=await Ve(i);return i.json?terminal.emitJsonOk(r,{schema:i.schema===!0,force:i.force===!0,dir:i.dir??null}):terminal.printHuman([He(r)],{title:e("cli.cmd.upgrade.description","Update extraction_version metadata when stale")}),{code:0,handled:!0,command:s}}case "embed":case "embed-status":{let i=Qe(a);if(i.help)return console.log(e("cli.embed.usage","Usage: easbot codebase embed-status [--all] [--dry-run|-n] [--pending-list|-p] [--json] [dir]")),console.log(""),console.log(e("cli.embed.description","Inspect node embeddings (statistical only) \u2014 does NOT generate embeddings.")),console.log(e("cli.embed.statistical_only","CLI is statistical-only \u2014 actual embedding generation requires")),console.log(e("cli.embed.repl_required","an `easbot` REPL session with an injected EmbeddingModel.")),console.log(""),console.log(e("cli.shared.options_heading","Options:")),console.log(` ${e("cli.embed.opt.all","--all Show all nodes (including those with embeddings)")}`),console.log(` ${e("cli.embed.opt.dry_run","--dry-run, -n Print statistics only (default behavior)")}`),console.log(` ${e("cli.embed.opt.pending","--pending-list, -p List node ids that are pending embedding")}`),console.log(` ${e("cli.embed.opt.json","--json Output as JSON")}`),{code:0,handled:!0,command:s};i.dryRun=!0;let r=await Xe(i);return i.json?terminal.emitJsonOk(r,{all:i.all===!0,dryRun:!0,pendingList:i.pendingList===!0,batchSize:i.batchSize??null,dir:i.dir??null}):terminal.printHuman([Ze(r)],{title:e("cli.cmd.embed.description","Inspect node embeddings (statistical only)")}),{code:0,handled:!0,command:s}}case "query":{let i=lt(a);if(i.help)return console.log(e("cli.query.usage","Usage: easbot codebase query <q...> [--language=<lang>] [--ast=<type>] [--max=N] [--no-edges] [--no-vector|--no-embed] [--json] [--dir=<dir>]")),console.log(""),console.log(e("cli.query.description","Hybrid search (FTS + vector + basic) over indexed code nodes.")),console.log(e("cli.query.aliases","Aliases: search")),console.log(""),console.log(e("cli.shared.options_heading","Options:")),console.log(` ${e("cli.query.opt.language","--language=<lang> Filter by language (ts / js / py / go / ...)")}`),console.log(` ${e("cli.query.opt.ast","--ast=<type> Filter by AST type (class_declaration / function_declaration / ...)")}`),console.log(` ${e("cli.query.opt.max","--max=<N> Max results (default 20)")}`),console.log(` ${e("cli.query.opt.no_edges","--no-edges Do not include edges in results (default: include)")}`),console.log(` ${e("cli.query.opt.no_vector","--no-vector / --no-embed Disable vector search (FTS + basic only, default: vector on)")}`),console.log(` ${e("cli.query.opt.json","--json JSON output")}`),console.log(` ${e("cli.query.opt.dir","--dir=<dir> Target workspace (default: cwd)")}`),{code:0,handled:!0,command:s};let r=await dt(i);return i.json?terminal.emitJsonOk(r,{query:i.query??"",language:i.language??null,astType:i.astType??null,maxResults:i.maxResults??null,dir:i.dir??null}):terminal.printHuman([pt(r)],{title:e("cli.cmd.query.description","Hybrid search (FTS + vector + basic)")}),{code:0,handled:!0,command:s}}case "node":{let i=mt(a);if(i.help)return console.log(e("cli.node.usage","Usage: easbot codebase node <name|id> [--file=<path>] [--kind=<kind>] [--edges] [--max=N] [--json] [--dir=<dir>]")),console.log(""),console.log(e("cli.node.description","Show details for a single node.")),console.log(e("cli.node.accepts_name","Accepts a symbol <name> (LLM workflow friendly, tool/MCP-aligned)")),console.log(e("cli.node.accepts_id","or a raw <node-id> from `query` / database.")),console.log(""),console.log(e("cli.shared.options_heading","Options:")),console.log(` ${e("cli.node.opt.file","--file=<path> Disambiguate when same-named symbols exist")}`),console.log(` ${e("cli.node.opt.kind","--kind=<kind> Filter / disambiguate by AST kind")}`),console.log(` ${e("cli.node.opt.edges","--edges Include incoming / outgoing edge summaries")}`),console.log(` ${e("cli.node.opt.max","--max=<N> Edge limit (default 50)")}`),console.log(` ${e("cli.node.opt.json","--json Output as JSON")}`),console.log(` ${e("cli.node.opt.dir","--dir=<dir> Target workspace (default: cwd)")}`),{code:0,handled:!0,command:s};let r=await gt(i);return i.json?terminal.emitJsonOk(r,{name:i.name??"",nodeId:i.nodeId??null,file:i.file??null,kind:i.kind??null,includeEdges:i.includeEdges===!0,edgesLimit:i.edgesLimit??null,found:r.found,dir:i.dir??null}):terminal.printHuman([ft(r)],{title:e("cli.cmd.node.description","Show details for a single node")}),{code:r.found?0:1,handled:!0,command:s}}case "context":{let i=ht(a);if(i.help)return console.log(e("cli.context.usage","Usage: easbot codebase context <id> [--depth=N] [--max=N] [--direction=<incoming|outgoing|both>] [--relation=<r1,r2,...>] [--json] [--dir=<dir>]")),console.log(""),console.log(e("cli.context.description","Build a sub-graph context around a node (BFS to N-level neighbors).")),console.log(""),console.log(e("cli.shared.options_heading","Options:")),console.log(` ${e("cli.context.opt.depth","--depth=<N> BFS depth (default 2)")}`),console.log(` ${e("cli.context.opt.max","--max=<N> Max nodes (default 100)")}`),console.log(` ${e("cli.context.opt.direction","--direction=<dir> incoming | outgoing | both (default both)")}`),console.log(` ${e("cli.context.opt.relation","--relation=<r1,r2,...> Filter by relation types (CALLS / IMPORTS / TYPE_REFERENCES / EXTENDS / IMPLEMENTS / USES / REFERENCES)")}`),console.log(` ${e("cli.context.opt.json","--json Output as JSON")}`),console.log(` ${e("cli.context.opt.dir","--dir=<dir> Target workspace (default: cwd)")}`),{code:0,handled:!0,command:s};let r=await yt(i);return i.json?terminal.emitJsonOk(r,{nodeId:i.nodeId??"",depth:i.depth??null,direction:i.direction??"both",dir:i.dir??null}):terminal.printHuman([xt(r)],{title:e("cli.cmd.context.description","Build sub-graph context around a node")}),{code:0,handled:!0,command:s}}case "impact":{let i=wt(a);if(i.help)return console.log(e("cli.impact.usage","Usage: easbot codebase impact <id> [-d=N | --depth=N] [--relation=<r1,r2,...>] [--json] [--dir=<dir>]")),console.log(""),console.log(e("cli.impact.description","Blast radius: BFS incoming CALLS / REFERENCES / USES / IMPORTS / TYPE_REFERENCES, bucketed by depth.")),console.log(""),console.log(e("cli.shared.options_heading","Options:")),console.log(` ${e("cli.impact.opt.depth","--depth=<N> BFS depth (default 3)")}`),console.log(` ${e("cli.impact.opt.relation","--relation=<r1,r2,...> Filter by relation types")}`),console.log(` ${e("cli.impact.opt.json","--json Output as JSON")}`),console.log(` ${e("cli.impact.opt.dir","--dir=<dir> Target workspace (default: cwd)")}`),{code:0,handled:!0,command:s};let r=await Et(i);return i.json?terminal.emitJsonOk(r,{nodeId:i.nodeId??"",depth:i.depth??null,dir:i.dir??null}):terminal.printHuman([Ct(r)],{title:e("cli.cmd.impact.description","Blast radius (BFS incoming edges)")}),{code:0,handled:!0,command:s}}case "callers":{let i=Ut(a);if(i.help)return console.log(e("cli.callers.usage","Usage: easbot codebase callers <symbol> [--node-id=<id>] [--file=<path>] [--kind=<kind>] [--max=N] [--json] [--dir=<dir>]")),console.log(""),console.log(e("cli.callers.description","Flat list of who calls <symbol> (incoming CALLS / IMPORTS / TYPE_REFERENCES / EXTENDS / IMPLEMENTS).")),console.log(e("cli.callers.accepts","Accepts <symbol> name (LLM-friendly) OR --node-id for raw node id.")),console.log(""),console.log(e("cli.shared.options_heading","Options:")),console.log(` ${e("cli.callers.opt.node_id","--node-id=<id> Raw node id from `query` / database")}`),console.log(` ${e("cli.callers.opt.file","--file=<path> File path or basename to disambiguate when same-named symbols exist")}`),console.log(` ${e("cli.callers.opt.kind","--kind=<kind> Filter by node kind (class_declaration / function_declaration / ...)")}`),console.log(` ${e("cli.callers.opt.max","--max=<N> Max callers (default 20)")}`),console.log(` ${e("cli.callers.opt.json","--json Output as JSON")}`),console.log(` ${e("cli.callers.opt.dir","--dir=<dir> Target workspace (default: cwd)")}`),{code:0,handled:!0,command:s};let r=await Bt(i);return i.json?terminal.emitJsonOk(r,{symbol:i.symbol??"",nodeId:i.nodeId??null,file:i.file??null,kind:i.kind??null,maxResults:i.maxResults??null,dir:i.dir??null}):terminal.printHuman([Wt(r)],{title:e("cli.cmd.callers.description","Flat list of who calls <symbol> (incoming edges)")}),{code:0,handled:!0,command:s}}case "callees":{let i=Gt(a);if(i.help)return console.log(e("cli.callees.usage","Usage: easbot codebase callees <symbol> [--node-id=<id>] [--file=<path>] [--kind=<kind>] [--max=N] [--json] [--dir=<dir>]")),console.log(""),console.log(e("cli.callees.description","Flat list of what <symbol> calls (outgoing edges).")),console.log(e("cli.callees.accepts","Accepts <symbol> name (LLM-friendly) OR --node-id for raw node id.")),console.log(""),console.log(e("cli.shared.options_heading","Options:")),console.log(` ${e("cli.callees.opt.node_id","--node-id=<id> Raw node id from `query` / database")}`),console.log(` ${e("cli.callees.opt.file","--file=<path> File path or basename to disambiguate")}`),console.log(` ${e("cli.callees.opt.kind","--kind=<kind> Filter by node kind")}`),console.log(` ${e("cli.callees.opt.max","--max=<N> Max callees (default 20)")}`),console.log(` ${e("cli.callees.opt.json","--json Output as JSON")}`),console.log(` ${e("cli.callees.opt.dir","--dir=<dir> Target workspace (default: cwd)")}`),{code:0,handled:!0,command:s};let r=await zt(i);return i.json?terminal.emitJsonOk(r,{symbol:i.symbol??"",nodeId:i.nodeId??null,file:i.file??null,kind:i.kind??null,maxResults:i.maxResults??null,dir:i.dir??null}):terminal.printHuman([Jt(r)],{title:e("cli.cmd.callees.description","Flat list of what <symbol> calls (outgoing edges)")}),{code:0,handled:!0,command:s}}case "explore":{let i=Kt(a);if(i.help)return console.log(e("cli.explore.usage","Usage: easbot codebase explore <query> [--file=<path>] [--kind=<kind>] [--max-files=N] [--max-symbols=N] [--depth=N] [--no-content] [--intent=<ctx>] [--json] [--dir=<dir>]")),console.log(""),console.log(e("cli.explore.description","PRIMARY tool \u2014 single call to get source code + caller/callee trail.")),console.log(e("cli.explore.query_help","<query> can be a symbol name or natural language.")),console.log(""),console.log(e("cli.shared.options_heading","Options:")),console.log(` ${e("cli.explore.opt.file","--file=<path> File path or basename to disambiguate")}`),console.log(` ${e("cli.explore.opt.kind","--kind=<kind> Filter by node kind")}`),console.log(` ${e("cli.explore.opt.max_files","--max-files=<N> Max entry-point files (default 5)")}`),console.log(` ${e("cli.explore.opt.max_symbols","--max-symbols=<N> Max symbols per file (default 3)")}`),console.log(` ${e("cli.explore.opt.depth","--depth=<N> Neighbor depth for caller/callee trail (default 1)")}`),console.log(` ${e("cli.explore.opt.no_content","--no-content Do not include source code (locations only, default: include)")}`),console.log(` ${e("cli.explore.opt.intent","--intent=<ctx> LLM context string for ranking")}`),console.log(` ${e("cli.explore.opt.json","--json Output as JSON")}`),console.log(` ${e("cli.explore.opt.dir","--dir=<dir> Target workspace (default: cwd)")}`),{code:0,handled:!0,command:s};let r=await Vt(i);return i.json?terminal.emitJsonOk(r,{query:i.query??"",file:i.file??null,kind:i.kind??null,maxFiles:i.maxFiles??null,maxSymbols:i.maxSymbols??null,depth:i.depth??null,includeContent:i.includeContent!==!1,intent:i.intent??null,dir:i.dir??null}):terminal.printHuman([await Ht(r)],{title:e("cli.cmd.explore.description","PRIMARY tool \u2014 source code + caller/callee trail in one call")}),{code:0,handled:!0,command:s}}case "dead-code":{let i=Rt(a);if(i.help)return console.log(e("cli.dead_code.usage","Usage: easbot codebase dead-code [--type=<t1,t2,...>] [--no-exclude-entry] [--limit=N] [--json] [--dir=<dir>]")),console.log(""),console.log(e("cli.dead_code.description","Find nodes with no incoming edges (heuristic dead code).")),console.log(""),console.log(e("cli.shared.options_heading","Options:")),console.log(` ${e("cli.dead_code.opt.type","--type=<t1,t2,...> Only consider these AST types")}`),console.log(` ${e("cli.dead_code.opt.no_exclude_entry","--no-exclude-entry Include entry-point files (default: exclude)")}`),console.log(` ${e("cli.dead_code.opt.limit","--limit=<N> Max results (default 100)")}`),console.log(` ${e("cli.dead_code.opt.json","--json Output as JSON")}`),console.log(` ${e("cli.dead_code.opt.dir","--dir=<dir> Target workspace (default: cwd)")}`),{code:0,handled:!0,command:s};let r=await _t(i);return i.json?terminal.emitJsonOk(r,{astTypes:i.astTypes??null,limit:i.limit??null,excludeEntry:i.excludeEntry!==!1,dir:i.dir??null}):terminal.printHuman([Nt(r)],{title:e("cli.cmd.dead_code.description","Find unused symbols")}),{code:0,handled:!0,command:s}}case "circular":{let i=It(a);if(i.help)return console.log(e("cli.circular.usage","Usage: easbot codebase circular [--relation=<r>] [--scope=<file|module>] [--json] [--dir=<dir>]")),console.log(""),console.log(e("cli.circular.description","Detect circular dependencies via Tarjan SCC.")),console.log(""),console.log(e("cli.shared.options_heading","Options:")),console.log(` ${e("cli.circular.opt.relation","--relation=<r> Relation type to follow (default IMPORTS)")}`),console.log(` ${e("cli.circular.opt.scope","--scope=<scope> file | module (default file)")}`),console.log(` ${e("cli.circular.opt.json","--json Output as JSON")}`),console.log(` ${e("cli.circular.opt.dir","--dir=<dir> Target workspace (default: cwd)")}`),{code:0,handled:!0,command:s};let r=await jt(i);return i.json?terminal.emitJsonOk(r,{relation:i.relation??null,scope:i.scope??null,dir:i.dir??null}):terminal.printHuman([vt(r)],{title:e("cli.cmd.circular.description","Detect circular dependencies (Tarjan SCC)")}),{code:0,handled:!0,command:s}}case "path":{let i=Tt(a);if(i.help)return console.log(e("cli.path.usage","Usage: easbot codebase path <from> <to> [-d=N | --depth=N] [--relation=<r1,r2,...>] [--json] [--dir=<dir>]")),console.log(""),console.log(e("cli.path.description","Find shortest path between two nodes (BFS along CALLS / IMPORTS / TYPE_REFERENCES / USES / REFERENCES).")),console.log(""),console.log(e("cli.shared.options_heading","Options:")),console.log(` ${e("cli.path.opt.depth","--depth=<N> BFS depth limit (default 6)")}`),console.log(` ${e("cli.path.opt.relation","--relation=<r1,r2,...> Filter by relation types")}`),console.log(` ${e("cli.path.opt.json","--json Output as JSON")}`),console.log(` ${e("cli.path.opt.dir","--dir=<dir> Target workspace (default: cwd)")}`),{code:0,handled:!0,command:s};let r=await $t(i);return i.json?terminal.emitJsonOk(r,{fromId:i.fromId??"",toId:i.toId??"",depth:i.depth??null,dir:i.dir??null}):terminal.printHuman([Pt(r)],{title:e("cli.cmd.path.description","Find shortest path between two nodes")}),{code:r.found?0:1,handled:!0,command:s}}case "mcp":{let i=Mt(a);return i.help?(console.log(e("cli.mcp.usage","Usage: easbot codebase mcp [dir]")),console.log(""),console.log(e("cli.mcp.description","Start a stdio MCP server exposing 9 codebase tools:")),console.log(` ${e("cli.mcp.tools.1"," query / node / context / impact")}`),console.log(` ${e("cli.mcp.tools.2"," callers / callees / explore")}`),console.log(` ${e("cli.mcp.tools.3"," status / doctor")}`),console.log(""),console.log(e("cli.mcp.transport","Connect from MCP clients via stdio JSON-RPC.")),{code:0,handled:!0,command:s}):(await qt(i),{code:0,handled:!0,command:s})}case "watch":{let i=tt(a);if(i.help)return console.log(e("cli.watch.usage","Usage: easbot codebase watch [--debounce=N] [--interval=N] [dir]")),console.log(""),console.log(e("cli.watch.description","Watch the workspace directory for file changes and log events.")),console.log(e("cli.watch.pid_file","Writes a pid file at .easbot/.watcher.pid for subsequent `stop`.")),console.log(""),console.log(e("cli.shared.options_heading","Options:")),console.log(` ${e("cli.watch.opt.debounce","--debounce=N Per-path debounce in ms (default 200)")}`),console.log(` ${e("cli.watch.opt.interval","--interval=N Polling interval in ms (default 500)")}`),console.log(""),console.log(e("cli.watch.note","NOTE: This command blocks. Press Ctrl+C to exit.")),{code:0,handled:!0,command:s};let r=await ot(i);return console.log(nt(r.events)),await new Promise(c=>{let b=()=>{ee.info("watcher received signal, stopping"),c();};process.once("SIGINT",b),process.once("SIGTERM",b);}),await r.watcher.dispose(),{code:0,handled:!0,command:s}}case "stop":{let i=st(a);if(i.help)return console.log(e("cli.stop.usage","Usage: easbot codebase stop [dir]")),console.log(""),console.log(e("cli.stop.description","Stop a running watcher identified by .easbot/.watcher.pid.")),console.log(""),console.log(e("cli.shared.options_heading","Options:")),console.log(` ${e("cli.stop.opt.force","--force, -f Ignore errors and clear the pid file anyway")}`),{code:0,handled:!0,command:s};let r=await rt(i);return i.json?terminal.emitJsonOk(r,{force:i.force===!0,dir:i.dir??null}):terminal.printHuman([at(r)],{title:e("cli.cmd.stop.description","Stop a running file watcher")}),{code:r.stopped?0:1,handled:!0,command:s}}default:return console.error(e("cli.unknown_command",`Unknown command: ${s}`,{command:s})),console.error(e("cli.help_hint","Run `easbot codebase --help` for available commands.")),{code:1,handled:!0,command:s}}}catch(i){let r=i instanceof Error?i.message:String(i);return console.error(e("cli.command_failed",`codebase ${s} failed: ${r}`,{command:s,message:r})),ee.error("codebase CLI error",{command:s,error:r,stack:i instanceof Error?i.stack:void 0}),{code:1,handled:true,command:s}}}function Kn(o){let t={},n=[];for(let e of o)e==="--json"?t.json=true:e.startsWith("--dir=")?t.dir=e.slice(6):e.startsWith("-")||n.push(e);return t.dir===void 0&&n.length>0&&(t.dir=n[0]),t}function Vn(o){let t={},n=[];for(let e of o)e==="--help"||e==="-h"?t.help=true:e.startsWith("--dir=")?t.dir=e.slice(6):e==="--json"?t.json=true:e.startsWith("-")||n.push(e);return t.dir===void 0&&n.length>0&&(t.dir=n[0]),t}function Hn(o){return {packageName:"codebase",rootDir:o.rootDir,configPath:o.configPath,configExists:o.configExists,dbPath:o.dbPath,dbExists:o.dbExists,dbSize:o.dbSize,indexState:o.indexState,schemaVersion:o.schemaVersion,extractionVersion:o.extractionVersion,lastSyncAt:o.lastSyncAt,vectorEnabled:o.vectorEnabled,embeddingDims:o.embeddingDims,llm:o.llm,backend:o.backend,counts:o.counts,healthy:o.healthy,recommendation:o.recommendation,extras:o.isStale===true?{stale:"yes \u2014 reindex recommended"}:void 0}}function Yn(o){return {packageName:"codebase",healthy:o.healthy,durationMs:o.durationMs,checks:o.checks.map(t=>({code:t.code,severity:t.severity,name:t.name,message:t.message,durationMs:t.durationMs,details:t.details})),backendAvailable:o.backendAvailable,dbStats:o.dbStats}}exports.a=Wn;exports.b=Ka;exports.c=Gn;exports.d=Va;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkYYF5OQDS_cjs=require('./chunk-YYF5OQDS.cjs');require('./chunk-JVX6PHPN.cjs'),require('./chunk-BEQN3CKO.cjs'),require('./chunk-R74KIJM2.cjs'),require('./chunk-VFTVDTEY.cjs'),require('./chunk-JWTI3BWI.cjs'),require('./chunk-VPWALTY7.cjs'),require('./chunk-NVGACA7W.cjs');Object.defineProperty(exports,"COMMANDS_HELP",{enumerable:true,get:function(){return chunkYYF5OQDS_cjs.c}});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}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{c as COMMANDS_HELP,d as handleCodebaseCli,a as renderBanner,b as renderHelp}from'./chunk-TR3DFBJH.mjs';import'./chunk-34CU2EU4.mjs';import'./chunk-WXWENWCY.mjs';import'./chunk-CSMSBVAG.mjs';import'./chunk-AGZFRKQ4.mjs';import'./chunk-22PKTMO5.mjs';import'./chunk-GWCRGM4D.mjs';import'./chunk-TMICZT3L.mjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkVFTVDTEY_cjs=require('./chunk-VFTVDTEY.cjs'),chunkJWTI3BWI_cjs=require('./chunk-JWTI3BWI.cjs');require('./chunk-VPWALTY7.cjs'),require('./chunk-NVGACA7W.cjs');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}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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'./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'./chunk-22PKTMO5.mjs';import'./chunk-GWCRGM4D.mjs';import'./chunk-TMICZT3L.mjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{n as DatabaseManager,m as EXTRACTION_VERSION,p as getDbPath,o as isClosed,q as transaction}from'./chunk-22PKTMO5.mjs';import'./chunk-TMICZT3L.mjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkJWTI3BWI_cjs=require('./chunk-JWTI3BWI.cjs');require('./chunk-NVGACA7W.cjs');Object.defineProperty(exports,"DatabaseManager",{enumerable:true,get:function(){return chunkJWTI3BWI_cjs.n}});Object.defineProperty(exports,"EXTRACTION_VERSION",{enumerable:true,get:function(){return chunkJWTI3BWI_cjs.m}});Object.defineProperty(exports,"getDbPath",{enumerable:true,get:function(){return chunkJWTI3BWI_cjs.p}});Object.defineProperty(exports,"isClosed",{enumerable:true,get:function(){return chunkJWTI3BWI_cjs.o}});Object.defineProperty(exports,"transaction",{enumerable:true,get:function(){return chunkJWTI3BWI_cjs.q}});
|
|
@@ -0,0 +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}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as Llm,b as llm}from'./chunk-GWCRGM4D.mjs';import'./chunk-TMICZT3L.mjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var chunk6ENRFRCH_cjs=require('./chunk-6ENRFRCH.cjs');require('./chunk-K5CRL5DC.cjs'),require('./chunk-UTPNELRD.cjs'),require('./chunk-7XCIIOM6.cjs'),require('./chunk-NVGACA7W.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.
|
|
1
|
+
'use strict';var chunkR74KIJM2_cjs=require('./chunk-R74KIJM2.cjs');require('./chunk-VFTVDTEY.cjs'),require('./chunk-JWTI3BWI.cjs'),require('./chunk-VPWALTY7.cjs'),require('./chunk-NVGACA7W.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
2
|
|
|
3
3
|
WHEN TO USE: Diagnostic only \u2014 check whether the index is up-to-date or stale. Skip unless debugging.
|
|
4
4
|
|
|
@@ -10,16 +10,16 @@ WHEN TO USE: Diagnostic only \u2014 check why queries return empty or fail. Skip
|
|
|
10
10
|
|
|
11
11
|
AFTER THIS: If unhealthy, fix the reported issue (usually run \`easbot codebase index\` from CLI).
|
|
12
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
|
|
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 chunkR74KIJM2_cjs.b)return `**${r}** \u2014 node not found. Try \`query\` first to discover the symbol.`;if(o instanceof chunkR74KIJM2_cjs.c){let l=o.details?.candidates??[],e=l.slice(0,5).map(t=>`- \`${t.node.name}\` in \`${t.node.file_path}\``).join(`
|
|
14
14
|
`);return `**${r}** \u2014 ambiguous name. Specify \`file\` to disambiguate:
|
|
15
15
|
|
|
16
16
|
${e}
|
|
17
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
|
|
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 chunkR74KIJM2_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 chunkR74KIJM2_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 chunkR74KIJM2_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 chunkR74KIJM2_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 chunkR74KIJM2_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 chunkR74KIJM2_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 chunkR74KIJM2_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 chunkR74KIJM2_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 chunkR74KIJM2_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
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
|
|
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 chunkR74KIJM2_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.callers.length}${n.truncated?"+":""})
|
|
21
21
|
`);for(let i of n.callers)s.push(`- [${i.relation}] \`${i.name}\` ${i.filePath}:${i.startLine}`);return n.callers.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
|
|
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 chunkR74KIJM2_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 chunkR74KIJM2_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 chunkR74KIJM2_cjs.k(e,{}),n=t.workspaceDir,s=t.meta.indexed_with_version??"unknown",i=t.meta.lastSync??"never",f=`**Codebase Status**
|
|
23
23
|
|
|
24
24
|
- DB path: \`${t.dbPath}\`
|
|
25
25
|
- Workspace: \`${n}\`
|
|
@@ -32,7 +32,7 @@ ${e}
|
|
|
32
32
|
- Last sync: ${i}
|
|
33
33
|
- Stale: ${t.isStale?"\u26A0\uFE0F yes (extraction_version mismatch)":"no"}
|
|
34
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
|
|
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 chunkR74KIJM2_cjs.l(e,{}),n=await chunkR74KIJM2_cjs.k(e,{}),s=`**Codebase Health Check**
|
|
36
36
|
|
|
37
37
|
- Healthy: ${t.healthy?"\u2713 yes":"\u2717 no"}
|
|
38
38
|
- Nodes: ${n.nodeCount}
|