@easbot/codebase 0.3.37 → 0.3.39

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.
@@ -1,4 +1,4 @@
1
- 'use strict';var chunkVXLUR7M5_cjs=require('./chunk-VXLUR7M5.cjs'),chunkY7JDLK56_cjs=require('./chunk-Y7JDLK56.cjs'),chunkD5NDNAKA_cjs=require('./chunk-D5NDNAKA.cjs'),chunk3DAM6EZN_cjs=require('./chunk-3DAM6EZN.cjs'),chunkAARBEAIB_cjs=require('./chunk-AARBEAIB.cjs'),chunkW5SMGCKO_cjs=require('./chunk-W5SMGCKO.cjs'),chunkEH2QTB6S_cjs=require('./chunk-EH2QTB6S.cjs'),chunkR32346OA_cjs=require('./chunk-R32346OA.cjs'),fs=require('fs'),utils=require('@easbot/utils'),llm=require('@easbot/llm'),module$1=require('module'),types=require('@easbot/types'),terminal=require('@easbot/terminal'),path=require('path'),database=require('@easbot/database'),url=require('url'),mcp=require('@easbot/mcp');var ee=utils.Log.create({service:"codebase.init"});function Re(o){let e={},n=[];for(let t of o)t==="--force"||t==="-f"?e.force=true:t==="--help"||t==="-h"?e.help=true:t==="--json"?e.json=true:t.startsWith("-")||n.push(t);return e}async function v(o={}){let e=await chunkY7JDLK56_cjs.b.getRootDir();try{let m=await chunk3DAM6EZN_cjs.e();m.source==="monorepo"?ee.debug("better-sqlite3 resolved (monorepo)",{path:m.absolutePath}):ee.debug("better-sqlite3 auto-installed to cache",{source:m.source,path:m.absolutePath});}catch(m){ee.warn("better-sqlite3 resolve / install failed; index/sync/mcp may still fail later",{error:utils.errorMeta(m),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=chunk3DAM6EZN_cjs.a(e),t=await chunkY7JDLK56_cjs.b.getConfigPath(),i=chunk3DAM6EZN_cjs.c(e);if(await chunkY7JDLK56_cjs.b.exists()&&!o.force)return {configPath:t,dbPath:i,created:false,skipped:true,backend:"better-sqlite3",schemaVersion:chunkAARBEAIB_cjs.a,migrationsApplied:0,tablesCreated:0,durationMs:0};if(fs.existsSync(n)||fs.mkdirSync(n,{recursive:true}),await chunkY7JDLK56_cjs.b.writeCodebaseJson({version:1,schema_version:chunkAARBEAIB_cjs.a,extraction_version:chunkAARBEAIB_cjs.e,backend:"better-sqlite3",created_at:new Date().toISOString()}),o.force)for(let m of [i,`${i}-wal`,`${i}-shm`])try{fs.rmSync(m,{force:!0});}catch{}chunk3DAM6EZN_cjs.d(e);let r=false,l=0,s=0,a=Date.now(),d=new chunkAARBEAIB_cjs.f(i);try{let m=d.getMeta("index_state"),h=d.getMeta("createdAt"),p=d.getMeta("version"),w=d.getMeta("indexed_with_version");r=m!==null&&h!==null&&p!==null&&w!==null;try{l=d.countSqliteObjects();}catch{}let u=d.getMeta("schema_version");s=u?Number.parseInt(u,10)||chunkAARBEAIB_cjs.a:chunkAARBEAIB_cjs.a;}finally{d.close();}let c=Date.now()-a;return {configPath:t,dbPath:i,created:true,skipped:false,metaInitialized:r,backend:"better-sqlite3",schemaVersion:chunkAARBEAIB_cjs.a,migrationsApplied:s,tablesCreated:l,durationMs:c}}async function K(o){let e=await chunkY7JDLK56_cjs.b.getRootDir(),t=await chunkY7JDLK56_cjs.b.getConfigPath(),i=chunk3DAM6EZN_cjs.c(e),r=await chunkY7JDLK56_cjs.b.exists(),l=fs.existsSync(i),s;if(l)try{s=fs.statSync(i).size;}catch{}let a={initialized:false,capabilities:{embedding:false,evaluation:false}},d={},c,m,h,p=0,w=0,u,E,x,f=false,N,g=false,y;if(r)try{let D=await chunkY7JDLK56_cjs.b.getCodebaseJson();D&&(c=D.index_state,E=D.schema_version,m=D.extraction_version,u=D.backend);}catch{}if(l&&i)try{let{DatabaseManager:D}=await import('./database-manager-T43UZZ45.cjs'),P=new D(i);try{let $=P.getStatus();c=$.indexState??c,m=$.extractionVersion??m,h=$.isStale,p=$.nodeCount,w=$.edgeCount;for(let[X,ro]of Object.entries($.meta))d[X]=ro;N=$.meta.lastSyncAt,E=parseInt($.meta.schema_version??"",10)||E,u=$.meta.backend??u,f=$.meta.vector_enabled==="true"||$.meta.vector_enabled==="1",x=parseInt($.meta.embeddingDims??"",10)||void 0;try{let{stats:X}=P.checkIntegrity();y={...X};}catch{}g=P.isFtsAvailable();}finally{P.close();}}catch{}let S=chunkEH2QTB6S_cjs.a.isInitialized();if(S){a.initialized=true;let D=chunkEH2QTB6S_cjs.a.capabilities();a.capabilities={embedding:D.embedding===true,evaluation:D.evaluation===true},a.embeddingModel=a.capabilities.embedding?"configured":void 0,a.evaluationModel=a.capabilities.evaluation?"configured":void 0;}if(S&&a.capabilities.embedding&&i)try{let D=await chunkEH2QTB6S_cjs.a.probeEmbeddingDims({timeoutMs:5e3});if(typeof D=="number"){x=D;try{let{DatabaseManager:P}=await import('./database-manager-T43UZZ45.cjs'),$=new P(i);try{llm.syncMeta($,[["embeddingDims",String(D)]]);}finally{$.close();}}catch{}}}catch{}let O=l&&r&&!h&&c!=="failed"&&c!=="stale",C;return r?l?c==="failed"?C="Last sync failed \u2014 run `easbot codebase index` to retry.":h?C="Index is stale (extraction version mismatch) \u2014 run `easbot codebase recreate` to rebuild.":c==="uninitialized"?C="Config exists but index never built \u2014 run `easbot codebase index` to populate.":c==="partial"&&(C="Last sync partially succeeded \u2014 re-run `easbot codebase index` to fill missing files."):C="Run `easbot codebase index` to build the index.":C="Run `easbot codebase init` to initialize the configuration.",{package:"codebase",rootDir:e,dbPath:i,dbSize:s,configPath:t,configExists:r,schemaVersion:E,extractionVersion:m,lastSyncAt:N,indexState:c,vectorEnabled:f,embeddingDims:x,llm:a,backend:u,meta:d,recommendation:C,healthy:O,dbStats:y,dbExists:l,nodeCount:p,edgeCount:w,ftsAvailable:g}}var F=()=>Date.now();async function ke(o){let e=F(),n=await K(),t=[],i,r=F(),l;if(n.dbExists?n.configExists?l=I("database","ok",`db readable at ${n.dbPath}`,Date.now()-r):l=I("database","warn","config not found \u2014 run `easbot codebase init` first",Date.now()-r):l=I("database","info","db not initialized \u2014 run `easbot codebase index` to build",Date.now()-r),t.push(l),n.dbExists){let u=F();t.push(I("fts","ok","fts sync checked in integrity pass",Date.now()-u));}if(n.dbExists){let u=F();t.push(I("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()-u));}if(n.dbExists){let u=F();t.push(I("schema",n.isStale===true?"warn":"ok",n.isStale===true?`extraction_version mismatch (current=${n.extractionVersion??0})`:`schema_version=${n.schemaVersion??"unknown"}`,Date.now()-u));}t.push(I("lock","ok","no lock contention observed",0)),t.push(I("disk_space","ok","no disk space check (v0.5.1 placeholder)",0));let s=F(),a={"better-sqlite3":false,"node:sqlite":false,"@tursodatabase/database":false},d=module$1.createRequire(chunkR32346OA_cjs.d);try{d.resolve("better-sqlite3"),a["better-sqlite3"]=!0;}catch{}a["node:sqlite"]=typeof process.versions.sqlite=="string";try{d.resolve("@tursodatabase/database"),a["@tursodatabase/database"]=!0;}catch{}let c="ok",m=`backend available: ${n.backend??"unknown"}`;!a["better-sqlite3"]&&!a["node:sqlite"]?(c="error",m="no SQLite backend available (install better-sqlite3 or use Node 22.5+)"):n.configExists&&n.backend&&!a[n.backend]&&(c="error",m=`configured backend "${n.backend}" not available in this environment`),t.push(I("backend",c,m,Date.now()-s));let h=F(),p;if(!n.llm.initialized||!n.llm.capabilities.embedding)p=I(types.EMBEDDING_DIMS_CONSISTENCY_CHECK,"info","llm not initialized; probe skipped",Date.now()-h);else if(!n.dbExists)p=I(types.EMBEDDING_DIMS_CONSISTENCY_CHECK,"info","db not initialized; probe skipped",Date.now()-h);else try{let u=await chunkEH2QTB6S_cjs.a.probeEmbeddingDims({timeoutMs:5e3});typeof u!="number"?p=I(types.EMBEDDING_DIMS_CONSISTENCY_CHECK,"info","probe failed (network / model error)",Date.now()-h):n.embeddingDims===void 0?p=I(types.EMBEDDING_DIMS_CONSISTENCY_CHECK,"info",`probe=${u}, meta missing \u2014 next status will sync`,Date.now()-h):u!==n.embeddingDims?p=I(types.EMBEDDING_DIMS_CONSISTENCY_CHECK,"warn",`probe=${u} but meta.embeddingDims=${n.embeddingDims} (drift detected)`,Date.now()-h,{probed:u,recorded:n.embeddingDims}):p=I(types.EMBEDDING_DIMS_CONSISTENCY_CHECK,"ok",`probe=${u} matches meta`,Date.now()-h,{probed:u});}catch(u){p=I(types.EMBEDDING_DIMS_CONSISTENCY_CHECK,"info",`probe threw: ${utils.errorMeta(u).message}`,Date.now()-h);}if(t.push(p),n.dbExists){let u=F();try{let{DatabaseManager:E}=await import('./database-manager-T43UZZ45.cjs'),x=new E(n.dbPath);try{let{issues:f,stats:N}=x.checkIntegrity();i=N;for(let g of f)t.push(I("integrity_stats",g.severity,g.message,0,{source:"database.checkIntegrity"}));i.parse_errors===0&&t.push(I("parse_errors_zero","info","parse_errors: 0 (no parse errors recorded)",0)),i.unresolved_refs===0&&t.push(I("unresolved_refs_zero","info","unresolved_refs: 0 (resolution pipeline not active)",0)),i.name_segment_vocab===0&&t.push(I("name_segment_vocab_zero","info","name_segment_vocab: 0 (identifier-segments not active)",0)),i.project_metadata===0&&t.push(I("project_metadata_zero","info","project_metadata: 0 (CodeBase.initialize not run)",0));}finally{x.close();}}catch(E){t.push(I("integrity_stats","warn",`db integrity check failed: ${utils.errorMeta(E).message}`,Date.now()-u));}}let w=F();if(!n.llm.initialized)t.push(I("llm","info","Llm namespace not initialized (calls `easbot codebase init` first)",Date.now()-w));else {let u=[];n.llm.capabilities.embedding||u.push("embedding"),n.llm.capabilities.evaluation||u.push("evaluation"),t.push(I("llm",u.length===0?"ok":"info",u.length===0?"embedding + evaluation configured":`missing capabilities: ${u.join(", ")}`,Date.now()-w,{capabilities:n.llm.capabilities}));}return {healthy:!t.some(u=>u.severity==="error"),checks:t,issues:t.map(u=>({severity:u.severity,message:u.message,name:u.name,code:u.code})),durationMs:Date.now()-e,status:n,backendAvailable:a,dbStats:i??void 0}}function I(o,e,n,t,i){return {code:o.toUpperCase().replace(/[^A-Z0-9]+/g,"_"),severity:e,name:o,message:n,details:i,durationMs:t}}var wo=utils.Log.create({service:"codebase.cmd.index"});function De(o){let e={};for(let n of o)if(n==="--no-embed")e.noEmbed=true;else if(n==="--embed")e.noEmbed=false;else if(n==="--json")e.json=true;else if(n==="--verbose"||n==="-v")e.verbose=true;else if(n==="--quiet"||n==="-q")e.quiet=true;else if(n==="--help"||n==="-h")e.help=true;else if(n.startsWith("--batch=")){let t=n.slice(8),i=Number.parseInt(t,10);Number.isFinite(i)&&i>0&&(e.batch=i);}return e}async function V(o){var E=[];try{let e=await chunkY7JDLK56_cjs.b.getRootDir();let n=chunk3DAM6EZN_cjs.a(e);let t=chunk3DAM6EZN_cjs.b(e);await v();let{CodeBase:i}=await import('./code-base-WZ3L5IE5.cjs');let{DEFAULT_EMBEDDING_CONFIG:r,DEFAULT_INDEXER_CONFIG:l,DEFAULT_PARSER_CONFIG:s}=await import('@easbot/types');let a=o.batch??l.batchSize??50;let d=new i({workspaceDir:e,database:{path:chunk3DAM6EZN_cjs.c(e),walMode:!0},embedding:o.noEmbed===!1?r:void 0,indexer:{...l,batchSize:a},parser:s,sync:{onBoot:!1,onSearch:!1,onSessionStart:!1,intervalMs:0}});let c=Date.now();let m=chunkR32346OA_cjs.b(E,wo.time("codebaseIndex",{level:"DEBUG"}));let h=-1;let p=0;let w=!o.quiet;let u;try{await d.initialize(),terminal.registerActiveProgressLine(process.stderr);let g=await d.indexDirectory(e,w?y=>{let S=Math.max(y.total,1),O=Math.min(100,Math.floor(y.processed/S*100)),C=Date.now();if(O!==h||C-p>3e4){let P=String(O).padStart(3," ");terminal.clearActiveProgressLine(),process.stderr.write(` \u{1F4A1} [${P}%] ${y.stage}: ${y.processed}/${y.total} files`),h=O,p=C;}}:void 0);u={rootDir:e,success:g.success,filesProcessed:g.filesProcessed,nodesCreated:g.nodesCreated,edgesCreated:g.edgesCreated,errorCount:g.errors.length,errors:g.errors,durationMs:g.duration,embedded:!o.noEmbed,batchSize:a};}finally{terminal.clearActiveProgressLine(),terminal.unregisterActiveProgressLine(process.stderr),await d.close();}return u}catch(x){var f=x,N=true;}finally{chunkR32346OA_cjs.c(E,f,N);}}function ve(o){let e=[];if(e.push("Codebase index"),e.push(` rootDir: ${o.rootDir}`),e.push(` success: ${o.success?"\u2713":"\u2717"}`),e.push(` files processed: ${o.filesProcessed}`),e.push(` nodes created: ${o.nodesCreated}`),e.push(` edges created: ${o.edgesCreated}`),e.push(` embedded: ${o.embedded?"yes":"no (--no-embed)"}`),e.push(` batch size: ${o.batchSize}`),e.push(` duration: ${o.durationMs}ms`),o.errorCount>0){e.push(` errors (${o.errorCount}):`);for(let n of o.errors.slice(0,10))e.push(` - ${n.filePath}: ${n.error}`);o.errors.length>10&&e.push(` ... and ${o.errors.length-10} more`);}return e.join(`
1
+ 'use strict';var chunkXGZDPIEP_cjs=require('./chunk-XGZDPIEP.cjs'),chunkY7JDLK56_cjs=require('./chunk-Y7JDLK56.cjs'),chunkD5NDNAKA_cjs=require('./chunk-D5NDNAKA.cjs'),chunk3DAM6EZN_cjs=require('./chunk-3DAM6EZN.cjs'),chunkAARBEAIB_cjs=require('./chunk-AARBEAIB.cjs'),chunkW5SMGCKO_cjs=require('./chunk-W5SMGCKO.cjs'),chunkEH2QTB6S_cjs=require('./chunk-EH2QTB6S.cjs'),chunkR32346OA_cjs=require('./chunk-R32346OA.cjs'),fs=require('fs'),utils=require('@easbot/utils'),llm=require('@easbot/llm'),module$1=require('module'),types=require('@easbot/types'),terminal=require('@easbot/terminal'),path=require('path'),database=require('@easbot/database'),url=require('url'),mcp=require('@easbot/mcp');var ee=utils.Log.create({service:"codebase.init"});function Re(o){let e={},n=[];for(let t of o)t==="--force"||t==="-f"?e.force=true:t==="--help"||t==="-h"?e.help=true:t==="--json"?e.json=true:t.startsWith("-")||n.push(t);return e}async function v(o={}){let e=await chunkY7JDLK56_cjs.b.getRootDir();try{let m=await chunk3DAM6EZN_cjs.e();m.source==="monorepo"?ee.debug("better-sqlite3 resolved (monorepo)",{path:m.absolutePath}):ee.debug("better-sqlite3 auto-installed to cache",{source:m.source,path:m.absolutePath});}catch(m){ee.warn("better-sqlite3 resolve / install failed; index/sync/mcp may still fail later",{error:utils.errorMeta(m),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=chunk3DAM6EZN_cjs.a(e),t=await chunkY7JDLK56_cjs.b.getConfigPath(),i=chunk3DAM6EZN_cjs.c(e);if(await chunkY7JDLK56_cjs.b.exists()&&!o.force)return {configPath:t,dbPath:i,created:false,skipped:true,backend:"better-sqlite3",schemaVersion:chunkAARBEAIB_cjs.a,migrationsApplied:0,tablesCreated:0,durationMs:0};if(fs.existsSync(n)||fs.mkdirSync(n,{recursive:true}),await chunkY7JDLK56_cjs.b.writeCodebaseJson({version:1,schema_version:chunkAARBEAIB_cjs.a,extraction_version:chunkAARBEAIB_cjs.e,backend:"better-sqlite3",created_at:new Date().toISOString()}),o.force)for(let m of [i,`${i}-wal`,`${i}-shm`])try{fs.rmSync(m,{force:!0});}catch{}chunk3DAM6EZN_cjs.d(e);let r=false,l=0,s=0,a=Date.now(),d=new chunkAARBEAIB_cjs.f(i);try{let m=d.getMeta("index_state"),h=d.getMeta("createdAt"),p=d.getMeta("version"),w=d.getMeta("indexed_with_version");r=m!==null&&h!==null&&p!==null&&w!==null;try{l=d.countSqliteObjects();}catch{}let u=d.getMeta("schema_version");s=u?Number.parseInt(u,10)||chunkAARBEAIB_cjs.a:chunkAARBEAIB_cjs.a;}finally{d.close();}let c=Date.now()-a;return {configPath:t,dbPath:i,created:true,skipped:false,metaInitialized:r,backend:"better-sqlite3",schemaVersion:chunkAARBEAIB_cjs.a,migrationsApplied:s,tablesCreated:l,durationMs:c}}async function K(o){let e=await chunkY7JDLK56_cjs.b.getRootDir(),t=await chunkY7JDLK56_cjs.b.getConfigPath(),i=chunk3DAM6EZN_cjs.c(e),r=await chunkY7JDLK56_cjs.b.exists(),l=fs.existsSync(i),s;if(l)try{s=fs.statSync(i).size;}catch{}let a={initialized:false,capabilities:{embedding:false,evaluation:false}},d={},c,m,h,p=0,w=0,u,E,x,f=false,N,g=false,y;if(r)try{let D=await chunkY7JDLK56_cjs.b.getCodebaseJson();D&&(c=D.index_state,E=D.schema_version,m=D.extraction_version,u=D.backend);}catch{}if(l&&i)try{let{DatabaseManager:D}=await import('./database-manager-T43UZZ45.cjs'),P=new D(i);try{let $=P.getStatus();c=$.indexState??c,m=$.extractionVersion??m,h=$.isStale,p=$.nodeCount,w=$.edgeCount;for(let[X,ro]of Object.entries($.meta))d[X]=ro;N=$.meta.lastSyncAt,E=parseInt($.meta.schema_version??"",10)||E,u=$.meta.backend??u,f=$.meta.vector_enabled==="true"||$.meta.vector_enabled==="1",x=parseInt($.meta.embeddingDims??"",10)||void 0;try{let{stats:X}=P.checkIntegrity();y={...X};}catch{}g=P.isFtsAvailable();}finally{P.close();}}catch{}let S=chunkEH2QTB6S_cjs.a.isInitialized();if(S){a.initialized=true;let D=chunkEH2QTB6S_cjs.a.capabilities();a.capabilities={embedding:D.embedding===true,evaluation:D.evaluation===true},a.embeddingModel=a.capabilities.embedding?"configured":void 0,a.evaluationModel=a.capabilities.evaluation?"configured":void 0;}if(S&&a.capabilities.embedding&&i)try{let D=await chunkEH2QTB6S_cjs.a.probeEmbeddingDims({timeoutMs:5e3});if(typeof D=="number"){x=D;try{let{DatabaseManager:P}=await import('./database-manager-T43UZZ45.cjs'),$=new P(i);try{llm.syncMeta($,[["embeddingDims",String(D)]]);}finally{$.close();}}catch{}}}catch{}let O=l&&r&&!h&&c!=="failed"&&c!=="stale",C;return r?l?c==="failed"?C="Last sync failed \u2014 run `easbot codebase index` to retry.":h?C="Index is stale (extraction version mismatch) \u2014 run `easbot codebase recreate` to rebuild.":c==="uninitialized"?C="Config exists but index never built \u2014 run `easbot codebase index` to populate.":c==="partial"&&(C="Last sync partially succeeded \u2014 re-run `easbot codebase index` to fill missing files."):C="Run `easbot codebase index` to build the index.":C="Run `easbot codebase init` to initialize the configuration.",{package:"codebase",rootDir:e,dbPath:i,dbSize:s,configPath:t,configExists:r,schemaVersion:E,extractionVersion:m,lastSyncAt:N,indexState:c,vectorEnabled:f,embeddingDims:x,llm:a,backend:u,meta:d,recommendation:C,healthy:O,dbStats:y,dbExists:l,nodeCount:p,edgeCount:w,ftsAvailable:g}}var F=()=>Date.now();async function ke(o){let e=F(),n=await K(),t=[],i,r=F(),l;if(n.dbExists?n.configExists?l=I("database","ok",`db readable at ${n.dbPath}`,Date.now()-r):l=I("database","warn","config not found \u2014 run `easbot codebase init` first",Date.now()-r):l=I("database","info","db not initialized \u2014 run `easbot codebase index` to build",Date.now()-r),t.push(l),n.dbExists){let u=F();t.push(I("fts","ok","fts sync checked in integrity pass",Date.now()-u));}if(n.dbExists){let u=F();t.push(I("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()-u));}if(n.dbExists){let u=F();t.push(I("schema",n.isStale===true?"warn":"ok",n.isStale===true?`extraction_version mismatch (current=${n.extractionVersion??0})`:`schema_version=${n.schemaVersion??"unknown"}`,Date.now()-u));}t.push(I("lock","ok","no lock contention observed",0)),t.push(I("disk_space","ok","no disk space check (v0.5.1 placeholder)",0));let s=F(),a={"better-sqlite3":false,"node:sqlite":false,"@tursodatabase/database":false},d=module$1.createRequire(chunkR32346OA_cjs.d);try{d.resolve("better-sqlite3"),a["better-sqlite3"]=!0;}catch{}a["node:sqlite"]=typeof process.versions.sqlite=="string";try{d.resolve("@tursodatabase/database"),a["@tursodatabase/database"]=!0;}catch{}let c="ok",m=`backend available: ${n.backend??"unknown"}`;!a["better-sqlite3"]&&!a["node:sqlite"]?(c="error",m="no SQLite backend available (install better-sqlite3 or use Node 22.5+)"):n.configExists&&n.backend&&!a[n.backend]&&(c="error",m=`configured backend "${n.backend}" not available in this environment`),t.push(I("backend",c,m,Date.now()-s));let h=F(),p;if(!n.llm.initialized||!n.llm.capabilities.embedding)p=I(types.EMBEDDING_DIMS_CONSISTENCY_CHECK,"info","llm not initialized; probe skipped",Date.now()-h);else if(!n.dbExists)p=I(types.EMBEDDING_DIMS_CONSISTENCY_CHECK,"info","db not initialized; probe skipped",Date.now()-h);else try{let u=await chunkEH2QTB6S_cjs.a.probeEmbeddingDims({timeoutMs:5e3});typeof u!="number"?p=I(types.EMBEDDING_DIMS_CONSISTENCY_CHECK,"info","probe failed (network / model error)",Date.now()-h):n.embeddingDims===void 0?p=I(types.EMBEDDING_DIMS_CONSISTENCY_CHECK,"info",`probe=${u}, meta missing \u2014 next status will sync`,Date.now()-h):u!==n.embeddingDims?p=I(types.EMBEDDING_DIMS_CONSISTENCY_CHECK,"warn",`probe=${u} but meta.embeddingDims=${n.embeddingDims} (drift detected)`,Date.now()-h,{probed:u,recorded:n.embeddingDims}):p=I(types.EMBEDDING_DIMS_CONSISTENCY_CHECK,"ok",`probe=${u} matches meta`,Date.now()-h,{probed:u});}catch(u){p=I(types.EMBEDDING_DIMS_CONSISTENCY_CHECK,"info",`probe threw: ${utils.errorMeta(u).message}`,Date.now()-h);}if(t.push(p),n.dbExists){let u=F();try{let{DatabaseManager:E}=await import('./database-manager-T43UZZ45.cjs'),x=new E(n.dbPath);try{let{issues:f,stats:N}=x.checkIntegrity();i=N;for(let g of f)t.push(I("integrity_stats",g.severity,g.message,0,{source:"database.checkIntegrity"}));i.parse_errors===0&&t.push(I("parse_errors_zero","info","parse_errors: 0 (no parse errors recorded)",0)),i.unresolved_refs===0&&t.push(I("unresolved_refs_zero","info","unresolved_refs: 0 (resolution pipeline not active)",0)),i.name_segment_vocab===0&&t.push(I("name_segment_vocab_zero","info","name_segment_vocab: 0 (identifier-segments not active)",0)),i.project_metadata===0&&t.push(I("project_metadata_zero","info","project_metadata: 0 (CodeBase.initialize not run)",0));}finally{x.close();}}catch(E){t.push(I("integrity_stats","warn",`db integrity check failed: ${utils.errorMeta(E).message}`,Date.now()-u));}}let w=F();if(!n.llm.initialized)t.push(I("llm","info","Llm namespace not initialized (calls `easbot codebase init` first)",Date.now()-w));else {let u=[];n.llm.capabilities.embedding||u.push("embedding"),n.llm.capabilities.evaluation||u.push("evaluation"),t.push(I("llm",u.length===0?"ok":"info",u.length===0?"embedding + evaluation configured":`missing capabilities: ${u.join(", ")}`,Date.now()-w,{capabilities:n.llm.capabilities}));}return {healthy:!t.some(u=>u.severity==="error"),checks:t,issues:t.map(u=>({severity:u.severity,message:u.message,name:u.name,code:u.code})),durationMs:Date.now()-e,status:n,backendAvailable:a,dbStats:i??void 0}}function I(o,e,n,t,i){return {code:o.toUpperCase().replace(/[^A-Z0-9]+/g,"_"),severity:e,name:o,message:n,details:i,durationMs:t}}var wo=utils.Log.create({service:"codebase.cmd.index"});function De(o){let e={};for(let n of o)if(n==="--no-embed")e.noEmbed=true;else if(n==="--embed")e.noEmbed=false;else if(n==="--json")e.json=true;else if(n==="--verbose"||n==="-v")e.verbose=true;else if(n==="--quiet"||n==="-q")e.quiet=true;else if(n==="--help"||n==="-h")e.help=true;else if(n.startsWith("--batch=")){let t=n.slice(8),i=Number.parseInt(t,10);Number.isFinite(i)&&i>0&&(e.batch=i);}return e}async function V(o){var E=[];try{let e=await chunkY7JDLK56_cjs.b.getRootDir();let n=chunk3DAM6EZN_cjs.a(e);let t=chunk3DAM6EZN_cjs.b(e);await v();let{CodeBase:i}=await import('./code-base-WZ3L5IE5.cjs');let{DEFAULT_EMBEDDING_CONFIG:r,DEFAULT_INDEXER_CONFIG:l,DEFAULT_PARSER_CONFIG:s}=await import('@easbot/types');let a=o.batch??l.batchSize??50;let d=new i({workspaceDir:e,database:{path:chunk3DAM6EZN_cjs.c(e),walMode:!0},embedding:o.noEmbed===!1?r:void 0,indexer:{...l,batchSize:a},parser:s,sync:{onBoot:!1,onSearch:!1,onSessionStart:!1,intervalMs:0}});let c=Date.now();let m=chunkR32346OA_cjs.b(E,wo.time("codebaseIndex",{level:"DEBUG"}));let h=-1;let p=0;let w=!o.quiet;let u;try{await d.initialize(),terminal.registerActiveProgressLine(process.stderr);let g=await d.indexDirectory(e,w?y=>{let S=Math.max(y.total,1),O=Math.min(100,Math.floor(y.processed/S*100)),C=Date.now();if(O!==h||C-p>3e4){let P=String(O).padStart(3," ");terminal.clearActiveProgressLine(),process.stderr.write(` \u{1F4A1} [${P}%] ${y.stage}: ${y.processed}/${y.total} files`),h=O,p=C;}}:void 0);u={rootDir:e,success:g.success,filesProcessed:g.filesProcessed,nodesCreated:g.nodesCreated,edgesCreated:g.edgesCreated,errorCount:g.errors.length,errors:g.errors,durationMs:g.duration,embedded:!o.noEmbed,batchSize:a};}finally{terminal.clearActiveProgressLine(),terminal.unregisterActiveProgressLine(process.stderr),await d.close();}return u}catch(x){var f=x,N=true;}finally{chunkR32346OA_cjs.c(E,f,N);}}function ve(o){let e=[];if(e.push("Codebase index"),e.push(` rootDir: ${o.rootDir}`),e.push(` success: ${o.success?"\u2713":"\u2717"}`),e.push(` files processed: ${o.filesProcessed}`),e.push(` nodes created: ${o.nodesCreated}`),e.push(` edges created: ${o.edgesCreated}`),e.push(` embedded: ${o.embedded?"yes":"no (--no-embed)"}`),e.push(` batch size: ${o.batchSize}`),e.push(` duration: ${o.durationMs}ms`),o.errorCount>0){e.push(` errors (${o.errorCount}):`);for(let n of o.errors.slice(0,10))e.push(` - ${n.filePath}: ${n.error}`);o.errors.length>10&&e.push(` ... and ${o.errors.length-10} more`);}return e.join(`
2
2
  `)}function Oe(o){let e={};for(let n of o)n==="--json"?e.json=true:n==="--quiet"||n==="-q"?e.quiet=true:n==="--help"||n==="-h"?e.help=true:n==="--no-embed"?e.noEmbed=true:n==="--embed"&&(e.noEmbed=false);return e}async function je(o){let e=await chunkY7JDLK56_cjs.b.getRootDir(),n=chunk3DAM6EZN_cjs.c(e),{CodeBase:t}=await import('./code-base-WZ3L5IE5.cjs'),{DEFAULT_EMBEDDING_CONFIG:i,DEFAULT_INDEXER_CONFIG:r,DEFAULT_PARSER_CONFIG:l}=await import('@easbot/types'),s=new t({workspaceDir:e,database:{path:n,walMode:true},embedding:o.noEmbed===false?i:void 0,indexer:r,parser:l,sync:{onBoot:false,onSearch:false,onSessionStart:false,intervalMs:0}}),a,d={_lastPct:-1,_lastProgressAt:0};try{await s.initialize(),terminal.registerActiveProgressLine(process.stderr);let c=await s.sync(o.quiet?void 0:h=>{let p=Math.max(h.total,1),w=Math.min(100,Math.floor(h.processed/p*100)),u=Date.now(),E=w!==d._lastPct,x=u-d._lastProgressAt>3e4;if(E||x){let f=String(w).padStart(3," ");terminal.clearActiveProgressLine(),process.stderr.write(` \u{1F4A1} [${f}%] ${h.stage}: ${h.processed}/${h.total} files`),d._lastPct=w,d._lastProgressAt=u;}}),m=s.getDatabase().getIndexState();a={rootDir:e,success:c.success,filesAdded:c.filesAdded,filesUpdated:c.filesUpdated,filesDeleted:c.filesDeleted,filesSkipped:c.filesSkipped,nodesCreated:c.nodesCreated,edgesCreated:c.edgesCreated,errorCount:c.errors.length,errors:c.errors,durationMs:c.duration,indexState:m};}finally{terminal.clearActiveProgressLine(),terminal.unregisterActiveProgressLine(process.stderr),await s.close();}return a}function Te(o){let e=[];if(e.push("Codebase sync"),e.push(` rootDir: ${o.rootDir}`),e.push(` success: ${o.success?"\u2713":"\u2717"}`),e.push(` indexState: ${o.indexState}`),e.push(""),e.push(" Files"),e.push(` \u2139 added: ${o.filesAdded}`),e.push(` \u2139 updated: ${o.filesUpdated}`),e.push(` \u2139 deleted: ${o.filesDeleted}`),e.push(` \u2139 skipped: ${o.filesSkipped} (no-change: hash matches; parser-rejected: 0 nodes)`),e.push(""),e.push(" Graph"),e.push(` \u2139 nodes created: ${o.nodesCreated}`),e.push(` \u2139 edges created: ${o.edgesCreated}`),e.push(` duration: ${o.durationMs}ms`),o.errorCount>0){e.push(` errors (${o.errorCount}):`);for(let n of o.errors.slice(0,10))e.push(` - ${n.filePath}: ${n.error}`);o.errors.length>10&&e.push(` ... and ${o.errors.length-10} more`);}return e.join(`
3
3
  `)}function Fe(o){let e={};for(let n of o)n==="--keep-config"?e.keepConfig=true:n==="--no-reindex"?e.noReindex=true:n==="--no-embed"?e.noEmbed=true:n==="--force"||n==="-f"?e.force=true:n==="--json"?e.json=true:(n==="--help"||n==="-h")&&(e.help=true);return e}async function Le(o){let e=await chunkY7JDLK56_cjs.b.getRootDir();chunk3DAM6EZN_cjs.a(e);let t=chunk3DAM6EZN_cjs.c(e),i=chunk3DAM6EZN_cjs.b(e),r=false,l=false;for(let d of [t,`${t}-wal`,`${t}-shm`])if(fs.existsSync(d))try{fs.rmSync(d,{force:!0}),d===t&&(r=!0);}catch{}if(!o.keepConfig&&fs.existsSync(i))try{fs.rmSync(i,{force:!0}),l=!0;}catch{}await v({force:true});let s=false,a;if(!o.noReindex){let d=await V({noEmbed:o.noEmbed,quiet:true});s=true,a={filesProcessed:d.filesProcessed,nodesCreated:d.nodesCreated,edgesCreated:d.edgesCreated,durationMs:d.durationMs,embedded:d.embedded};}return {rootDir:e,removedDb:r,removedConfig:l,recreated:true,reindexed:s,configPath:i,indexSummary:a}}function Me(o){let e=[];return e.push("Codebase recreate"),e.push(` rootDir: ${o.rootDir}`),e.push(` removed db: ${o.removedDb?"\u2713":"\u2717 (not found)"}`),e.push(` removed config:${o.removedConfig?"\u2713":"(preserved via --keep-config or absent)"}`),e.push(` \u2713 reinitialized at ${o.configPath}`),o.reindexed&&o.indexSummary?e.push(` \u2713 reindexed in ${o.indexSummary.durationMs}ms (files: ${o.indexSummary.filesProcessed}, nodes: ${o.indexSummary.nodesCreated}, edges: ${o.indexSummary.edgesCreated}, embed: ${o.indexSummary.embedded?"on":"off"})`):e.push(" \u2139 reindex skipped (--no-reindex). Next: run `easbot codebase index` to rebuild the index."),e.join(`
4
4
  `)}function Ae(o){let e={};for(let n of o)n==="--keep-embeddings"?e.keepEmbeddings=true:n==="--force"||n==="-f"?e.force=true:n==="--json"?e.json=true:(n==="--help"||n==="-h")&&(e.help=true);return e}async function qe(o){let e=await chunkY7JDLK56_cjs.b.getRootDir();chunk3DAM6EZN_cjs.a(e);let t=chunk3DAM6EZN_cjs.c(e),i=chunk3DAM6EZN_cjs.b(e);if(!fs.existsSync(t))return await v(),{rootDir:e,cleared:false,nodesRemoved:0,edgesRemoved:0,filesRemoved:0,embeddingsPreserved:false,configPreserved:fs.existsSync(i),nextIndexState:"uninitialized"};let{CodeBase:r}=await import('./code-base-WZ3L5IE5.cjs'),{DEFAULT_EMBEDDING_CONFIG:l,DEFAULT_INDEXER_CONFIG:s,DEFAULT_PARSER_CONFIG:a}=await import('@easbot/types'),d=new r({workspaceDir:e,database:{path:t,walMode:true},embedding:o.keepEmbeddings?l:void 0,indexer:s,parser:a,sync:{onBoot:false,onSearch:false,onSessionStart:false,intervalMs:0}}),c;try{await d.initialize();let m={nodes:d.getDatabase().getNodeCount(),edges:d.getDatabase().getEdgeCount(),files:d.getDatabase().getFileCount()};await d.clear({keepEmbeddings:!!o.keepEmbeddings}),d.getDatabase().setIndexState("uninitialized"),c={rootDir:e,cleared:!0,nodesRemoved:m.nodes,edgesRemoved:m.edges,filesRemoved:m.files,embeddingsPreserved:!!o.keepEmbeddings,configPreserved:fs.existsSync(i),nextIndexState:"uninitialized"};}finally{await d.close();}return c}function Ue(o){let e=[];return e.push("Codebase clear"),e.push(` rootDir: ${o.rootDir}`),o.cleared?(e.push(" \u2713 cleared data"),e.push(` nodes removed: ${o.nodesRemoved}`),e.push(` edges removed: ${o.edgesRemoved}`),e.push(` file hashes removed: ${o.filesRemoved}`),e.push(` embeddings preserved: ${o.embeddingsPreserved?"yes (--keep-embeddings)":"no"}`),e.push(` config preserved: ${o.configPreserved?"\u2713":"\u2717"}`)):(e.push(" \u2717 db not found at .easbot/db/codebase.db \u2014 nothing to clear"),e.push(` config preserved: ${o.configPreserved?"\u2713":"\u2717"}`)),e.push(""),e.push("\u{1F4A1} Next: run `easbot codebase index` to rebuild."),e.join(`
@@ -10,16 +10,16 @@
10
10
  `);}),await t.start();try{await chunkD5NDNAKA_cjs.d(n,process.pid);}catch(r){nt.warn("failed to write watcher pid",{error:utils.errorMeta(r)});}return {watcher:t,events:i,startTime:Date.now()}}function at(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(`
11
11
  `)}function rt(o){let e={};for(let n of o)n==="--force"||n==="-f"?e.force=true:n==="--json"?e.json=true:(n==="--help"||n==="-h")&&(e.help=true);return e}async function ct(o){let e=await chunkY7JDLK56_cjs.b.getRootDir(),n=chunk3DAM6EZN_cjs.a(e);fs.existsSync(n)||await v();let t=path.join(n,".watcher.pid"),i=chunkD5NDNAKA_cjs.c(n);if(i===null)return {rootDir:e,pidFile:t,pid:null,stopped:false,error:"No watcher running (no .easbot/.watcher.pid found)"};try{return process.kill(i,"SIGTERM"),await chunkD5NDNAKA_cjs.e(n),{rootDir:e,pidFile:t,pid:i,stopped:!0}}catch(r){await chunkD5NDNAKA_cjs.e(n);let l=utils.errorMeta(r).message;return {rootDir:e,pidFile:t,pid:i,stopped:false,error:l}}}function lt(o){let e=[];return e.push("Codebase stop"),e.push(` pid file: ${o.pidFile}`),e.push(` pid: ${o.pid??"(none)"}`),e.push(` stopped: ${o.stopped?"\u2713":"\u2717"}`),o.error?(e.push(` error: ${o.error}`),e.push(""),e.push(" \u{1F4A1} If a stale watcher was running, its process may have already exited.")):(e.push(""),e.push(" \u{1F4A1} Use `easbot codebase watch` to start a new watcher session.")),e.join(`
12
12
  `)}var Uo=utils.Log.create({service:"codebase.cmd.query"}),Bo=200;function pt(o){let e={includeEdges:true,enableEmbedding:true},n=[];for(let t of o)if(t==="--help"||t==="-h")e.help=true;else if(t==="--json")e.json=true;else if(t==="--no-edges")e.includeEdges=false;else if(t==="--no-vector"||t==="--no-embed")e.enableEmbedding=false;else if(t.startsWith("-l=")||t.startsWith("--language="))e.language=t.includes("=")?t.split("=")[1]:void 0;else if(!(t==="-l"||t==="--language"))if(t.startsWith("--ast="))e.astType=t.slice(6);else if(t.startsWith("-n=")||t.startsWith("--max=")){let i=parseInt(t.split("=")[1]??"",10);Number.isFinite(i)&&i>0&&(e.maxResults=i);}else t.startsWith("-")||n.push(t);return n.length>0&&(e.query=n.join(" ")),e}async function ut(o){var h=[];try{let e=await chunkY7JDLK56_cjs.b.getRootDir();let n=chunk3DAM6EZN_cjs.a(e);let t=chunk3DAM6EZN_cjs.c(e);fs.existsSync(n)||await v();if(!fs.existsSync(t))throw new utils.NameErrors.OperationFailedError({message:`db not found at ${t} \u2014 run \`easbot codebase index\` first`,operation:"db-not-found",target:t});let{CodeBase:i}=await import('./code-base-WZ3L5IE5.cjs');let{DEFAULT_EMBEDDING_CONFIG:r,DEFAULT_INDEXER_CONFIG:l,DEFAULT_PARSER_CONFIG:s,DEFAULT_SEARCH_CONFIG:a}=await import('@easbot/types');let d=new i({workspaceDir:e,database:{path:t,walMode:!0},embedding:o.enableEmbedding?r:void 0,indexer:l,parser:s,search:a,sync:{onBoot:!1,onSearch:!1,onSessionStart:!1,intervalMs:0}});let c=Date.now();let m=chunkR32346OA_cjs.b(h,Uo.time("codebaseQuery",{level:"DEBUG",query:o.query}));try{await d.initialize();let x=await d.getQuery().search(o.query??"",{maxResults:o.maxResults??10,language:o.language,astType:o.astType,includeEdges:o.includeEdges,enableEmbedding:o.enableEmbedding});return {rootDir:e,query:o.query??"",totalResults:x.length,results:x.map(f=>({id:f.id,name:f.name,astType:f.ast_type,language:f.language,filePath:f.file_path,startLine:f.start_line??0,endLine:f.end_line??0,snippet:(f.text??"").slice(0,database.resolveSqlTextLimit(Bo)),edgeCount:(f.edges??[]).length})),durationMs:Date.now()-c}}finally{await d.close();}}catch(p){var w=p,u=true;}finally{chunkR32346OA_cjs.c(h,w,u);}}function mt(o){let e=[];e.push(`Codebase query: ${JSON.stringify(o.query)}`),e.push(` results: ${o.totalResults} (in ${o.durationMs}ms)`);for(let n of o.results)e.push(` ${n.name} (${n.astType}) \u2014 ${n.language} ${n.filePath}:${n.startLine}-${n.endLine} [${n.edgeCount} edges]`),e.push(` ${n.snippet.replace(/\s+/g," ").slice(0,100)}`);return e.join(`
13
- `)}function bt(o){let e={includeEdges:false},n=[];for(let t of o)if(t==="--help"||t==="-h")e.help=true;else if(t==="--json")e.json=true;else if(t==="--edges")e.includeEdges=true;else if(t.startsWith("--file="))e.file=t.slice(7);else if(t.startsWith("--kind="))e.kind=t.slice(7);else if(t.startsWith("--max=")){let i=parseInt(t.slice(6),10);Number.isFinite(i)&&i>0&&(e.edgesLimit=i);}else t.startsWith("-")||n.push(t);return n.length>0&&(e.name=n[0],e.nodeId=n[0]),e}async function ht(o){if(!o.name&&!o.nodeId)throw new utils.NameErrors.MissingFieldError({field:"name-or-nodeId",message:"node command requires a <name> or <node-id> argument"});let e=await chunkY7JDLK56_cjs.b.getRootDir(),n=chunk3DAM6EZN_cjs.a(e),t=chunk3DAM6EZN_cjs.c(e);if(fs.existsSync(n)||await v(),!fs.existsSync(t))throw new utils.NameErrors.OperationFailedError({message:`db not found at ${t} \u2014 run \`easbot codebase index\` first`,operation:"db-not-found",target:t});let i={workspaceDir:e,rootDir:e},r;try{r=await chunkVXLUR7M5_cjs.b(i,{name:o.name,nodeId:o.nodeId,file:o.file,kind:o.kind,includeEdges:o.includeEdges??!1,includeContent:!0,maxEdgesPerNode:o.edgesLimit??10});}catch(c){if(c instanceof utils.ServiceError&&c.data?.code==="NOT_FOUND")return {rootDir:e,found:false,incomingEdges:[],outgoingEdges:[]};throw c}if(!r.node)return {rootDir:e,found:false,incomingEdges:[],outgoingEdges:[]};let l=[],s=[],a=r.node.name.split("@")[0]??r.node.name,d=a.includes(".")?a.split(".").pop()??a:a;for(let c of r.edges){let m;if(c.target===r.node.id)m="in";else if(c.source===r.node.id)m="out";else if(c.target.includes(":*:")){let p=(c.target.split(":").pop()??"").split("@")[0]??"";m=a.includes(".")&&p===a||p===d?"in":"out";}else m="out";let h={id:c.id,relation:c.relation,source:c.source,target:c.target,direction:m};(m==="in"?l:s).push(h);}return {rootDir:e,found:true,node:{id:r.node.id,name:r.node.name,astType:r.node.ast_type,language:r.node.language,filePath:r.node.file_path,startLine:r.node.start_line??0,endLine:r.node.end_line??0,text:r.node.text??""},incomingEdges:l,outgoingEdges:s}}function yt(o){if(!o.found||!o.node)return `\u2717 node not found (rootDir: ${o.rootDir})`;let e=[];if(e.push(`Codebase node: ${o.node.id}`),e.push(` name: ${o.node.name}`),e.push(` type: ${o.node.astType}`),e.push(` language: ${o.node.language}`),e.push(` location: ${o.node.filePath}:${o.node.startLine}-${o.node.endLine}`),e.push(` edges: ${o.incomingEdges.length} incoming / ${o.outgoingEdges.length} outgoing`),o.incomingEdges.length>0&&typeof o.incomingEdges[0]=="object"&&"relation"in o.incomingEdges[0]){e.push(""),e.push(" incoming edges:");for(let n of o.incomingEdges.slice(0,20))e.push(` [${n.relation}] ${n.source} \u2192 ${n.target}`);e.push(" outgoing edges:");for(let n of o.outgoingEdges.slice(0,20))e.push(` [${n.relation}] ${n.source} \u2192 ${n.target}`);}return e.join(`
13
+ `)}function bt(o){let e={includeEdges:false},n=[];for(let t of o)if(t==="--help"||t==="-h")e.help=true;else if(t==="--json")e.json=true;else if(t==="--edges")e.includeEdges=true;else if(t.startsWith("--file="))e.file=t.slice(7);else if(t.startsWith("--kind="))e.kind=t.slice(7);else if(t.startsWith("--max=")){let i=parseInt(t.slice(6),10);Number.isFinite(i)&&i>0&&(e.edgesLimit=i);}else t.startsWith("-")||n.push(t);return n.length>0&&(e.name=n[0],e.nodeId=n[0]),e}async function ht(o){if(!o.name&&!o.nodeId)throw new utils.NameErrors.MissingFieldError({field:"name-or-nodeId",message:"node command requires a <name> or <node-id> argument"});let e=await chunkY7JDLK56_cjs.b.getRootDir(),n=chunk3DAM6EZN_cjs.a(e),t=chunk3DAM6EZN_cjs.c(e);if(fs.existsSync(n)||await v(),!fs.existsSync(t))throw new utils.NameErrors.OperationFailedError({message:`db not found at ${t} \u2014 run \`easbot codebase index\` first`,operation:"db-not-found",target:t});let i={workspaceDir:e,rootDir:e},r;try{r=await chunkXGZDPIEP_cjs.b(i,{name:o.name,nodeId:o.nodeId,file:o.file,kind:o.kind,includeEdges:o.includeEdges??!1,includeContent:!0,maxEdgesPerNode:o.edgesLimit??10});}catch(c){if(c instanceof utils.ServiceError&&c.data?.code==="NOT_FOUND")return {rootDir:e,found:false,incomingEdges:[],outgoingEdges:[]};throw c}if(!r.node)return {rootDir:e,found:false,incomingEdges:[],outgoingEdges:[]};let l=[],s=[],a=r.node.name.split("@")[0]??r.node.name,d=a.includes(".")?a.split(".").pop()??a:a;for(let c of r.edges){let m;if(c.target===r.node.id)m="in";else if(c.source===r.node.id)m="out";else if(c.target.includes(":*:")){let p=(c.target.split(":").pop()??"").split("@")[0]??"";m=a.includes(".")&&p===a||p===d?"in":"out";}else m="out";let h={id:c.id,relation:c.relation,source:c.source,target:c.target,direction:m};(m==="in"?l:s).push(h);}return {rootDir:e,found:true,node:{id:r.node.id,name:r.node.name,astType:r.node.ast_type,language:r.node.language,filePath:r.node.file_path,startLine:r.node.start_line??0,endLine:r.node.end_line??0,text:r.node.text??""},incomingEdges:l,outgoingEdges:s}}function yt(o){if(!o.found||!o.node)return `\u2717 node not found (rootDir: ${o.rootDir})`;let e=[];if(e.push(`Codebase node: ${o.node.id}`),e.push(` name: ${o.node.name}`),e.push(` type: ${o.node.astType}`),e.push(` language: ${o.node.language}`),e.push(` location: ${o.node.filePath}:${o.node.startLine}-${o.node.endLine}`),e.push(` edges: ${o.incomingEdges.length} incoming / ${o.outgoingEdges.length} outgoing`),o.incomingEdges.length>0&&typeof o.incomingEdges[0]=="object"&&"relation"in o.incomingEdges[0]){e.push(""),e.push(" incoming edges:");for(let n of o.incomingEdges.slice(0,20))e.push(` [${n.relation}] ${n.source} \u2192 ${n.target}`);e.push(" outgoing edges:");for(let n of o.outgoingEdges.slice(0,20))e.push(` [${n.relation}] ${n.source} \u2192 ${n.target}`);}return e.join(`
14
14
  `)}async function H(o={}){let{CodeBase:e}=await import('./code-base-WZ3L5IE5.cjs'),{DEFAULT_EMBEDDING_CONFIG:n,DEFAULT_INDEXER_CONFIG:t,DEFAULT_PARSER_CONFIG:i,DEFAULT_SEARCH_CONFIG:r,DEFAULT_SYNC_CONFIG:l}=await import('@easbot/types'),s=await chunkY7JDLK56_cjs.b.getRootDir(),a=chunk3DAM6EZN_cjs.c(s),d=chunk3DAM6EZN_cjs.a(s);if(!fs.existsSync(d))if(o.autoInit)await v();else throw new utils.NameErrors.OperationFailedError({message:`codebase not initialized at ${s} \u2014 run \`easbot codebase init <dir>\` first`,operation:"codebase-not-initialized",target:s});if(!fs.existsSync(a))throw new utils.NameErrors.OperationFailedError({message:`db not found at ${a} \u2014 run \`easbot codebase index\` first`,operation:"db-not-found",target:a});let c=new e({workspaceDir:s,database:{path:a,walMode:true},embedding:n,indexer:t,parser:i,search:r,sync:{...l,onBoot:false,onSearch:false,onSessionStart:false,intervalMs:0},...o.configOverrides});await c.initialize();let m=false;return {codebase:c,rootDir:s,close:async()=>{if(!m){m=true;try{await c.close();}catch{}}}}}function wt(o){let e={direction:"both"},n=[];for(let t of o)if(t==="--help"||t==="-h")e.help=true;else if(t==="--json")e.json=true;else if(t.startsWith("--depth=")){let i=parseInt(t.slice(8),10);Number.isFinite(i)&&i>0&&(e.depth=i);}else if(t.startsWith("--max=")){let i=parseInt(t.slice(6),10);Number.isFinite(i)&&i>0&&(e.maxNodes=i);}else if(t.startsWith("--direction=")){let i=t.slice(12);(i==="incoming"||i==="outgoing"||i==="both")&&(e.direction=i);}else if(t.startsWith("--relation=")){let i=t.slice(11).split(",").map(r=>r.trim()).filter(Boolean);e.relationTypes=i;}else t.startsWith("-")||n.push(t);return n.length>0&&(e.nodeId=n[0]),e}async function Ct(o){if(!o.nodeId)throw new utils.NameErrors.MissingFieldError({field:"nodeId",message:"context command requires a <node-id> argument"});let e=o.depth??2,n=o.maxNodes??100,t=o.direction??"both",{codebase:i,rootDir:r,close:l}=await H();try{let s=i.getDatabase(),a=i.getQuery();if(!s.getNodeById(o.nodeId))return {rootDir:r,rootNodeId:o.nodeId,depth:e,totalNodes:0,totalEdges:0,nodes:[],edges:[],truncated:!1};let c=new Map,m=[{nodeId:o.nodeId,depth:0}];c.set(o.nodeId,0);let h=[],p=!1;for(;m.length>0;){let f=m.shift();if(f.depth>=e)continue;if(c.size>=n){p=!0;break}let N=a.queryNeighbors(f.nodeId,{direction:t,relationTypes:o.relationTypes,limit:n-c.size+1});for(let g of N.edges){h.push({source:g.source,target:g.target,relation:g.relation});let y=g.source===f.nodeId?g.target:g.source;if(!c.has(y)&&(c.set(y,f.depth+1),m.push({nodeId:y,depth:f.depth+1}),c.size>=n)){p=!0;break}}if(p)break}let w=Array.from(c.keys()),u=w.length>0?s.queryNodes({ids:w}):[],E=new Map(u.map(f=>[f.id,f])),x=[];for(let[f,N]of c.entries()){let g=E.get(f);g&&x.push({id:g.id,name:g.name,astType:g.ast_type,language:g.language,filePath:g.file_path,depth:N});}return {rootDir:r,rootNodeId:o.nodeId,depth:e,totalNodes:x.length,totalEdges:h.length,nodes:x,edges:h,truncated:p}}finally{await l();}}function Et(o){let e=[];e.push(`Codebase context: ${o.rootNodeId} (depth=${o.depth})`),e.push(` nodes: ${o.totalNodes}${o.truncated?" [TRUNCATED]":""}`),e.push(` edges: ${o.totalEdges}`);for(let n of o.nodes.slice(0,50))e.push(` [d=${n.depth}] ${n.name} (${n.astType}) \u2014 ${n.language} ${n.filePath}`);return o.nodes.length>50&&e.push(` ... and ${o.nodes.length-50} more`),e.join(`
15
- `)}function Rt(o){let e={},n=[];for(let t of o)if(t==="--help"||t==="-h")e.help=true;else if(t==="--json")e.json=true;else if(t.startsWith("-d=")||t.startsWith("--depth=")){let i=parseInt(t.split("=")[1]??"",10);Number.isFinite(i)&&i>0&&(e.depth=i);}else if(t.startsWith("--relation=")){let i=t.slice(11).split(",").map(r=>r.trim()).filter(Boolean);e.relationTypes=i;}else t.startsWith("--file=")?e.file=t.slice(7):t.startsWith("--kind=")?e.kind=t.slice(7):t.startsWith("-")||n.push(t);return n.length>0&&(e.nodeId=n[0]),e}async function _t(o){if(!o.nodeId)throw new utils.NameErrors.MissingFieldError({field:"nodeId",message:"impact command requires a <node-id> argument"});let e=o.depth??3,n=o.relationTypes??["CALLS","REFERENCES","USES"],{rootDir:t,close:i}=await H(),r={workspaceDir:t,rootDir:t};try{let l=await chunkVXLUR7M5_cjs.d(r,{name:o.nodeId,nodeId:o.nodeId,file:o.file,kind:o.kind,depth:e,relationTypes:n,maxResults:200});return {rootDir:t,rootNodeId:l.root?.id??o.nodeId,totalImpacted:l.totalImpacted,depth:e,buckets:l.buckets.map(s=>({depth:s.depth,count:s.count,sample:s.sample.map(a=>({id:a.id,name:a.name,filePath:a.filePath}))}))}}finally{await i();}}function kt(o){let e=[];e.push(`Codebase impact: ${o.rootNodeId} (depth=${o.depth})`),e.push(` total impacted: ${o.totalImpacted}`);for(let n of o.buckets){e.push(` d=${n.depth}: ${n.count} nodes`);for(let t of n.sample.slice(0,5))e.push(` - ${t.name} (${t.filePath})`);}return e.join(`
15
+ `)}function Rt(o){let e={},n=[];for(let t of o)if(t==="--help"||t==="-h")e.help=true;else if(t==="--json")e.json=true;else if(t.startsWith("-d=")||t.startsWith("--depth=")){let i=parseInt(t.split("=")[1]??"",10);Number.isFinite(i)&&i>0&&(e.depth=i);}else if(t.startsWith("--relation=")){let i=t.slice(11).split(",").map(r=>r.trim()).filter(Boolean);e.relationTypes=i;}else t.startsWith("--file=")?e.file=t.slice(7):t.startsWith("--kind=")?e.kind=t.slice(7):t.startsWith("-")||n.push(t);return n.length>0&&(e.nodeId=n[0]),e}async function _t(o){if(!o.nodeId)throw new utils.NameErrors.MissingFieldError({field:"nodeId",message:"impact command requires a <node-id> argument"});let e=o.depth??3,n=o.relationTypes??["CALLS","REFERENCES","USES"],{rootDir:t,close:i}=await H(),r={workspaceDir:t,rootDir:t};try{let l=await chunkXGZDPIEP_cjs.d(r,{name:o.nodeId,nodeId:o.nodeId,file:o.file,kind:o.kind,depth:e,relationTypes:n,maxResults:200});return {rootDir:t,rootNodeId:l.root?.id??o.nodeId,totalImpacted:l.totalImpacted,depth:e,buckets:l.buckets.map(s=>({depth:s.depth,count:s.count,sample:s.sample.map(a=>({id:a.id,name:a.name,filePath:a.filePath}))}))}}finally{await i();}}function kt(o){let e=[];e.push(`Codebase impact: ${o.rootNodeId} (depth=${o.depth})`),e.push(` total impacted: ${o.totalImpacted}`);for(let n of o.buckets){e.push(` d=${n.depth}: ${n.count} nodes`);for(let t of n.sample.slice(0,5))e.push(` - ${t.name} (${t.filePath})`);}return e.join(`
16
16
  `)}var Ko="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",Vo=[new RegExp(`(?:^|/)(?:main|index|app|server)\\.(?:${Ko})$`)];function Dt(o){let e={excludeEntry:true};for(let n of o)if(n==="--help"||n==="-h")e.help=true;else if(n==="--json")e.json=true;else if(n==="--no-exclude-entry")e.excludeEntry=false;else if(n.startsWith("--type="))e.astTypes=n.slice(7).split(",").map(t=>t.trim()).filter(Boolean);else if(n.startsWith("--limit=")){let t=parseInt(n.slice(8),10);Number.isFinite(t)&&t>0&&(e.limit=t);}return e}async function vt(o){let e=await chunkY7JDLK56_cjs.b.getRootDir(),n=chunk3DAM6EZN_cjs.a(e),t=chunk3DAM6EZN_cjs.c(e);if(fs.existsSync(n)||await v(),!fs.existsSync(t))throw new utils.NameErrors.OperationFailedError({message:`db not found at ${t} \u2014 run \`easbot codebase index\` first`,operation:"db-not-found",target:t});let i=o.astTypes??["function","method","class"],r=o.limit??100,l=o.excludeEntry!==false,{CodeBase:s}=await import('./code-base-WZ3L5IE5.cjs'),{DEFAULT_EMBEDDING_CONFIG:a,DEFAULT_INDEXER_CONFIG:d,DEFAULT_PARSER_CONFIG:c,DEFAULT_SEARCH_CONFIG:m}=await import('@easbot/types'),h=new s({workspaceDir:e,database:{path:t,walMode:true},embedding:a,indexer:d,parser:c,search:m,sync:{onBoot:false,onSearch:false,onSessionStart:false,intervalMs:0}});try{await h.initialize();let p=h.getDatabase(),w=h.getQuery(),u=[],E=0,x=["CALLS","IMPORTS","TYPE_REFERENCES"],f=p.queryAll("SELECT DISTINCT target FROM edges WHERE relation IN ('CALLS','IMPORTS','TYPE_REFERENCES')"),N=new Set(f.map(g=>g.target));for(let g of i){let y=p.queryNodes({astType:g,limit:1e5});for(let S of y){if(l&&Vo.some(O=>O.test(S.file_path))){E++;continue}if(!N.has(S.id)&&(u.push({id:S.id,name:S.name,astType:S.ast_type,filePath:S.file_path,startLine:S.start_line??0}),u.length>=r))break}if(u.length>=r)break}return {rootDir:e,totalCandidates:u.length,excludedEntry:E,candidates:u.slice(0,r)}}finally{await h.close();}}function It(o){let e=[];e.push("Codebase dead-code"),e.push(` total candidates: ${o.totalCandidates}`),o.excludedEntry>0&&e.push(` excluded (entry files): ${o.excludedEntry}`);for(let n of o.candidates.slice(0,50))e.push(` - ${n.name} (${n.astType}) \u2014 ${n.filePath}:${n.startLine}`);return o.candidates.length>50&&e.push(` ... and ${o.candidates.length-50} more`),e.join(`
17
17
  `)}function jt(o){let e={relation:"IMPORTS",scope:"file"};for(let n of o)if(n==="--help"||n==="-h")e.help=true;else if(n==="--json")e.json=true;else if(n.startsWith("--relation="))e.relation=n.slice(11);else if(n.startsWith("--scope=")){let t=n.slice(8);(t==="file"||t==="module")&&(e.scope=t);}return e}function Yo(o){let e=0,n=new Map,t=new Map,i=new Set,r=[],l=[];function s(a){n.set(a,e),t.set(a,e),e++,r.push(a),i.add(a);let d=o.get(a)??[];for(let c of d)n.has(c)?i.has(c)&&t.set(a,Math.min(t.get(a),n.get(c))):(s(c),t.set(a,Math.min(t.get(a),t.get(c))));if(t.get(a)===n.get(a)){let c=[],m;do m=r.pop(),i.delete(m),c.push(m);while(m!==a);c.length>1&&l.push(c);}}for(let a of o.keys())n.has(a)||s(a);return l}async function Tt(o){let e=await chunkY7JDLK56_cjs.b.getRootDir(),n=chunk3DAM6EZN_cjs.a(e),t=chunk3DAM6EZN_cjs.c(e);if(fs.existsSync(n)||await v(),!fs.existsSync(t))throw new utils.NameErrors.OperationFailedError({message:`db not found at ${t} \u2014 run \`easbot codebase index\` first`,operation:"db-not-found",target:t});let i=o.relation??"IMPORTS",{CodeBase:r}=await import('./code-base-WZ3L5IE5.cjs'),{DEFAULT_EMBEDDING_CONFIG:l,DEFAULT_INDEXER_CONFIG:s,DEFAULT_PARSER_CONFIG:a,DEFAULT_SEARCH_CONFIG:d}=await import('@easbot/types'),c=new r({workspaceDir:e,database:{path:t,walMode:true},embedding:l,indexer:s,parser:a,search:d,sync:{onBoot:false,onSearch:false,onSessionStart:false,intervalMs:0}});try{await c.initialize();let m=c.getDatabase(),h=m.queryNodes({limit:1e5}),p=new Map;for(let y of h){let S=p.get(y.file_path)??[];S.push(y.id),p.set(y.file_path,S);}let w=h.map(y=>y.id),u=new Map;for(let y of h)u.set(y.id,y.file_path);let E;if(w.length===0)E=[];else {let y=w.map(()=>"?").join(",");E=m.queryAll(`SELECT * FROM edges WHERE relation = ? AND source IN (${y})`,[i,...w]);}let x=new Map;for(let y of E){let S=u.get(y.source),O=u.get(y.target);if(!S||!O||S===O)continue;let C=x.get(S);C||(C=new Set,x.set(S,C)),C.add(O);}let f=new Map;for(let[y,S]of x.entries())f.set(y,Array.from(S));let g=Yo(f).map(y=>{let S=[];for(let O=0;O<y.length;O++){let C=y[O],D=x.get(C);if(D)for(let P of D)y.includes(P)&&S.push({source:C,target:P});}return {cycle:y,edges:S}});return {rootDir:e,relation:i,totalCycles:g.length,cycles:g.slice(0,50)}}finally{await c.close();}}function $t(o){let e=[];e.push(`Codebase circular (relation=${o.relation})`),e.push(` total cycles: ${o.totalCycles}`);for(let n=0;n<o.cycles.length;n++){let t=o.cycles[n];e.push(` cycle #${n+1} (${t.cycle.length} files):`),e.push(` ${t.cycle.join(" \u2192 ")} \u2192 ${t.cycle[0]}`);}return e.join(`
18
18
  `)}function Lt(o){let e={},n=[];for(let t of o)if(t==="--help"||t==="-h")e.help=true;else if(t==="--json")e.json=true;else if(t.startsWith("-d=")||t.startsWith("--depth=")){let i=parseInt(t.split("=")[1]??"",10);Number.isFinite(i)&&i>0&&(e.depth=i);}else if(t.startsWith("--relation=")){let i=t.slice(11).split(",").map(r=>r.trim()).filter(Boolean);e.relationTypes=i;}else t.startsWith("-")||n.push(t);return n.length>0&&(e.fromId=n[0]),n.length>1&&(e.toId=n[1]),e}async function Mt(o){let e=await chunkY7JDLK56_cjs.b.getRootDir(),n=chunk3DAM6EZN_cjs.a(e),t=chunk3DAM6EZN_cjs.c(e);if(fs.existsSync(n)||await v(),!fs.existsSync(t))throw new utils.NameErrors.OperationFailedError({message:`db not found at ${t} \u2014 run \`easbot codebase index\` first`,operation:"db-not-found",target:t});if(!o.fromId||!o.toId)throw new utils.NameErrors.MissingFieldError({field:"from-to",message:"path command requires <from> and <to> node IDs"});let i=o.depth??6,r=o.relationTypes??["CALLS","IMPORTS"],{CodeBase:l}=await import('./code-base-WZ3L5IE5.cjs'),{DEFAULT_EMBEDDING_CONFIG:s,DEFAULT_INDEXER_CONFIG:a,DEFAULT_PARSER_CONFIG:d,DEFAULT_SEARCH_CONFIG:c}=await import('@easbot/types'),m=new l({workspaceDir:e,database:{path:t,walMode:true},embedding:s,indexer:a,parser:d,search:c,sync:{onBoot:false,onSearch:false,onSessionStart:false,intervalMs:0}});try{await m.initialize();let h=m.getQuery();if(o.fromId===o.toId)return {rootDir:e,found:!0,depth:0,steps:[],pathNodes:[o.fromId]};let p=new Set([o.fromId]),w=new Map,u=[o.fromId],E=!1;e:for(let g=0;g<=i;g++){let y=[];for(let S of u){let O=h.queryNeighbors(S,{direction:"both",relationTypes:r,limit:1e3});for(let C of O.edges){let D=C.source===S?C.target:C.source;if(!p.has(D)){if(p.add(D),w.set(D,{via:S,relation:C.relation}),D===o.toId){E=!0;break e}y.push(D);}}}u.length=0,u.push(...y);}if(!E)return {rootDir:e,found:!1,depth:0,steps:[],pathNodes:[]};let x=[o.toId],f=[],N=o.toId;for(;N!==o.fromId;){let g=w.get(N);if(!g)break;f.unshift({from:g.via,to:N,relation:g.relation}),x.unshift(g.via),N=g.via;}return {rootDir:e,found:!0,depth:f.length,steps:f,pathNodes:x}}finally{await m.close();}}function At(o){let e=[];if(!o.found)return e.push("Codebase path: NOT FOUND within depth limit"),e.join(`
19
19
  `);e.push(`Codebase path: depth=${o.depth}`);for(let n=0;n<o.steps.length;n++){let t=o.steps[n];e.push(` ${n+1}. [${t.relation}] ${t.from} \u2192 ${t.to}`);}return e.join(`
20
- `)}function Bt(o){let e={};for(let n of o)(n==="--help"||n==="-h")&&(e.help=true);return e}async function Gt(o){let e=await chunkY7JDLK56_cjs.b.getRootDir(),n=chunk3DAM6EZN_cjs.a(e),t=chunk3DAM6EZN_cjs.c(e);if(fs.existsSync(n)||await v(),!fs.existsSync(t))throw new utils.NameErrors.OperationFailedError({message:`db not found at ${t} \u2014 run \`easbot codebase index\` first`,operation:"db-not-found",target:t});let{CodeBase:i}=await import('./code-base-WZ3L5IE5.cjs'),{DEFAULT_EMBEDDING_CONFIG:r,DEFAULT_INDEXER_CONFIG:l,DEFAULT_PARSER_CONFIG:s,DEFAULT_SEARCH_CONFIG:a}=await import('@easbot/types'),{CodebaseStdioServer:d}=await import('./stdio-server-37QG6AO2.cjs'),c="0.0.0";try{let u=path.dirname(url.fileURLToPath(chunkR32346OA_cjs.d));for(let E=0;E<8;E++){try{let f=JSON.parse(fs.readFileSync(path.join(u,"package.json"),"utf-8"));if(f?.name==="@easbot/codebase"&&typeof f.version=="string"){c=f.version;break}}catch{}let x=path.dirname(u);if(x===u)break;u=x;}}catch{}let m=new i({workspaceDir:e,database:{path:t,walMode:true},embedding:r,indexer:l,parser:s,search:a,sync:{onBoot:false,onSearch:false,onSessionStart:false,intervalMs:0}});await m.initialize();let h={id:"easbot-codebase-mcp",name:"EASBot Codebase MCP",version:c,transportType:mcp.ServerTransportType.STDIO},p=await d.start(m,h);return {rootDir:e,tools:p.tools}}var sn=utils.Log.create({service:"codebase.command.callers"});function zt(o){let e={maxResults:10},n=[];for(let t of o)if(t==="--help"||t==="-h")e.help=true;else if(t==="--json")e.json=true;else if(t.startsWith("--file="))e.file=t.slice(7);else if(t.startsWith("--kind="))e.kind=t.slice(7);else if(t.startsWith("--max=")){let i=parseInt(t.slice(6),10);Number.isFinite(i)&&i>0&&(e.maxResults=i);}else t.startsWith("-")||n.push(t);return n.length>0&&(e.symbol=n[0]),e}async function Wt(o){if(!o.symbol&&!o.nodeId)throw new utils.NameErrors.MissingFieldError({field:"symbol-or-nodeId",message:"callers command requires a <symbol> or --nodeId argument"});let e=await chunkY7JDLK56_cjs.b.getRootDir(),n=Date.now(),i=await chunkVXLUR7M5_cjs.e({workspaceDir:e,rootDir:e},{name:o.symbol,nodeId:o.nodeId,file:o.file,kind:o.kind,maxResults:o.maxResults});return sn.debug("callers command done",{symbol:o.symbol,count:i.callers.length,rootDir:e}),{rootDir:e,serviceResult:i,durationMs:Date.now()-n}}function Jt(o){let{serviceResult:e,rootDir:n}=o,t=[],i=e.root?.name??"?",r=e.truncated?"+":"";if(t.push(`Callers of \`${i}\` (${e.callers.length}${r}) [${n}]`),e.callers.length===0)t.push(" (no incoming edges)");else for(let l of e.callers)t.push(` - [${l.relation}] \`${l.name}\` ${l.filePath}:${l.startLine}`);return e.callers.length>0&&(t.push(""),t.push("\u{1F4A1} Use `easbot codebase node <name>` to read full source of any caller.")),t.join(`
21
- `)}var cn=utils.Log.create({service:"codebase.command.callees"});function Kt(o){let e={maxResults:10},n=[];for(let t of o)if(t==="--help"||t==="-h")e.help=true;else if(t==="--json")e.json=true;else if(t.startsWith("--file="))e.file=t.slice(7);else if(t.startsWith("--kind="))e.kind=t.slice(7);else if(t.startsWith("--max=")){let i=parseInt(t.slice(6),10);Number.isFinite(i)&&i>0&&(e.maxResults=i);}else t.startsWith("-")||n.push(t);return n.length>0&&(e.symbol=n[0]),e}async function Vt(o){if(!o.symbol&&!o.nodeId)throw new utils.NameErrors.MissingFieldError({field:"symbol-or-nodeId",message:"callees command requires a <symbol> or --nodeId argument"});let e=await chunkY7JDLK56_cjs.b.getRootDir(),n=Date.now(),i=await chunkVXLUR7M5_cjs.f({workspaceDir:e,rootDir:e},{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:i.callees.length,rootDir:e}),{rootDir:e,serviceResult:i,durationMs:Date.now()-n}}function Ht(o){let{serviceResult:e,rootDir:n}=o,t=[],i=e.root?.name??"?",r=e.truncated?"+":"";if(t.push(`Callees of \`${i}\` (${e.callees.length}${r}) [${n}]`),e.callees.length===0)t.push(" (no outgoing edges)");else for(let l of e.callees)t.push(` - [${l.relation}] \`${l.name}\` ${l.filePath}:${l.startLine}`);return e.callees.length>0&&(t.push(""),t.push("\u{1F4A1} Use `easbot codebase node <name>` to read full source of any callee.")),t.join(`
22
- `)}var pn=utils.Log.create({service:"codebase.command.explore"});function Yt(o){let e={maxFiles:5,maxSymbols:3,depth:1,includeContent:true},n=[];for(let t of o)if(t==="--help"||t==="-h")e.help=true;else if(t==="--json")e.json=true;else if(t==="--no-content")e.includeContent=false;else if(t.startsWith("--file="))e.file=t.slice(7);else if(t.startsWith("--kind="))e.kind=t.slice(7);else if(t.startsWith("--max-files=")){let i=parseInt(t.slice(12),10);Number.isFinite(i)&&i>0&&(e.maxFiles=i);}else if(t.startsWith("--max-symbols=")){let i=parseInt(t.slice(14),10);Number.isFinite(i)&&i>0&&(e.maxSymbols=i);}else if(t.startsWith("--depth=")){let i=parseInt(t.slice(8),10);Number.isFinite(i)&&i>0&&(e.depth=i);}else t.startsWith("--intent=")?e.intent=t.slice(9):t.startsWith("-")||n.push(t);return n.length>0&&(e.query=n.join(" ")),e}async function Qt(o){if(!o.query)throw new utils.NameErrors.MissingFieldError({field:"query",message:"explore command requires a <query> argument"});let e=await chunkY7JDLK56_cjs.b.getRootDir(),n=Date.now(),i=await chunkVXLUR7M5_cjs.g({workspaceDir:e,rootDir:e},{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 pn.debug("explore command done",{query:o.query,totalHits:i.totalHits,entryPoints:i.entryPoints.length,rootDir:e}),{rootDir:e,serviceResult:i,durationMs:Date.now()-n}}async function Xt(o){let e={pendingFiles:[],toolName:"codebase_explore",writeToDisk:false};return await chunkVXLUR7M5_cjs.F(o.serviceResult,e)}var Zt={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 mn=Zt.languages,gn=mn.filter(o=>o.supported).map(o=>o.value),A={defaultLocale:"zh-CN",locales:gn},J={},Y=(o,e)=>{let n=J[o]||{translation:{}};return J[o]={translation:{...n.translation,...e.translation}},J[o]},Q=(o=A.defaultLocale)=>(J[o]||Y(o,{translation:{}}),{locale:o,resources:J[o]||{translation:{}}});var fn={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\u6570\u636E\u5E93 + \u91CD\u65B0\u521D\u59CB\u5316 + \u91CD\u5EFA\u7D22\u5F15\uFF08\u4E00\u6761\u9F99\uFF09","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 + \u91CD\u65B0\u521D\u59CB\u5316 + \u91CD\u5EFA\u7D22\u5F15\uFF08\u4E00\u6761\u9F99\uFF09","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] [--no-reindex] [--no-embed] [--force] [--json] [dir]","cli.recreate.description":"\u4E22\u5F03\u6574\u4E2A\u6570\u636E\u5E93\uFF08codebase.db + -wal + -shm\uFF09\uFF0C\u91CD\u65B0\u521D\u59CB\u5316\uFF0C\u5E76\u81EA\u52A8\u91CD\u5EFA\u7D22\u5F15\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.no_reindex":"--no-reindex \u8DF3\u8FC7\u81EA\u52A8\u91CD\u5EFA\u7D22\u5F15\u6B65\u9AA4\uFF08\u4E4B\u540E\u9700\u624B\u52A8\u8DD1 `easbot codebase index`\uFF09","cli.recreate.opt.no_embed":"--no-embed \u8F6C\u53D1\u7ED9 runIndex\uFF1A\u8DF3\u8FC7 embedding \u751F\u6210\uFF08\u66F4\u5FEB\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\u9ED8\u8BA4\u60C5\u51B5\u4E0B `recreate` \u4F1A\u5728\u540C\u4E00\u6B21\u8C03\u7528\u4E2D\u91CD\u5EFA\u7D22\u5F15\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]","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.node.usage":"\u7528\u6CD5: easbot codebase node <name|id> [--file=<path>] [--kind=<kind>] [--edges] [--max=N] [--json]","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.context.usage":"\u7528\u6CD5: easbot codebase context <id> [--depth=N] [--max=N] [--direction=<incoming|outgoing|both>] [--relation=<r1,r2,...>] [--json]","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.impact.usage":"\u7528\u6CD5: easbot codebase impact <id> [-d=N | --depth=N] [--relation=<r1,r2,...>] [--json]","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.callers.usage":"\u7528\u6CD5: easbot codebase callers <symbol> [--node-id=<id>] [--file=<path>] [--kind=<kind>] [--max=N] [--json]","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.callees.usage":"\u7528\u6CD5: easbot codebase callees <symbol> [--node-id=<id>] [--file=<path>] [--kind=<kind>] [--max=N] [--json]","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.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]","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.dead_code.usage":"\u7528\u6CD5: easbot codebase dead-code [--type=<t1,t2,...>] [--no-exclude-entry] [--limit=N] [--json]","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.circular.usage":"\u7528\u6CD5: easbot codebase circular [--relation=<r>] [--scope=<file|module>] [--json]","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.path.usage":"\u7528\u6CD5: easbot codebase path <from> <to> [-d=N | --depth=N] [--relation=<r1,r2,...>] [--json]","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.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}}"}},eo=fn;var bn={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 Drop db, re-init, rebuild index in one step","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] [--no-reindex] [--no-embed] [--force] [--json] [dir]","cli.recreate.description":"Discard the entire db (codebase.db + -wal + -shm), re-init, and rebuild the index in one step.","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.no_reindex":"--no-reindex Skip the auto rebuild-index step (manual `easbot codebase index` required after)","cli.recreate.opt.no_embed":"--no-embed Forward to runIndex: skip embedding generation (faster)","cli.recreate.opt.force":"--force, -f Skip safety prompts (for scripts)","cli.recreate.opt.json":"--json Output as JSON","cli.recreate.warn":"\u26A0\uFE0F This deletes the entire index. By default `recreate` also rebuilds the index in the same call.","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]","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.node.usage":"Usage: easbot codebase node <name|id> [--file=<path>] [--kind=<kind>] [--edges] [--max=N] [--json]","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.context.usage":"Usage: easbot codebase context <id> [--depth=N] [--max=N] [--direction=<incoming|outgoing|both>] [--relation=<r1,r2,...>] [--json]","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.impact.usage":"Usage: easbot codebase impact <id> [-d=N | --depth=N] [--relation=<r1,r2,...>] [--json]","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.callers.usage":"Usage: easbot codebase callers <symbol> [--node-id=<id>] [--file=<path>] [--kind=<kind>] [--max=N] [--json]","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.callees.usage":"Usage: easbot codebase callees <symbol> [--node-id=<id>] [--file=<path>] [--kind=<kind>] [--max=N] [--json]","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.explore.usage":"Usage: easbot codebase explore <query> [--file=<path>] [--kind=<kind>] [--max-files=N] [--max-symbols=N] [--depth=N] [--no-content] [--intent=<ctx>] [--json]","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.dead_code.usage":"Usage: easbot codebase dead-code [--type=<t1,t2,...>] [--no-exclude-entry] [--limit=N] [--json]","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.circular.usage":"Usage: easbot codebase circular [--relation=<r>] [--scope=<file|module>] [--json]","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.path.usage":"Usage: easbot codebase path <from> <to> [-d=N | --depth=N] [--relation=<r1,r2,...>] [--json]","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.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}}"}},to=bn;var hn=()=>{Q("zh-CN"),Q("en-US"),Y("zh-CN",eo),Y("en-US",to);};hn();var se=new Map;var ie=new Map;var yn=o=>{if(ie.has(o))return ie.get(o);let e=/{{\s*(\w+)\s*}}/g,n=[],t;for(;(t=e.exec(o))!==null;){let l=t[1];l&&!n.includes(l)&&n.push(l);}let i=new RegExp("{{\\s*("+n.join("|")+")\\s*}}","g"),r={keys:n,regex:i};return ie.set(o,r),r},oo=(o,e)=>{if(!o||typeof o!="string")return "";if(!e||Object.keys(e).length===0)return o;let{regex:n,keys:t}=yn(o);return t.length===0||!t.some(r=>r in e)?o:o.replace(n,(r,l)=>{let s=e[l];return s==null?"":String(s)})},xn=o=>{if(o&&A.locales.includes(o))return o;let e=process.env.EASBOT_LANG?.trim()||process.env.LANG?.trim();if(e){let n=e.replace(/_/g,"-");if(A.locales.includes(n))return n;let t=n.split("-")[0];if(t==="zh")return "zh-CN";if(t==="en")return "en-US"}return A.defaultLocale},no=o=>{if(!se.has(o)){let{resources:e}=Q(o);se.set(o,e);}return se.get(o)},Sn=(o,e={})=>{let n=xn(e.locale),i=no(n)?.translation[o];if(i&&typeof i=="string"){let r=oo(i,e.vars);return r!=null?String(r):String(o)}if(n!==A.defaultLocale){let l=no(A.defaultLocale)?.translation[o];if(l&&typeof l=="string"){let s=oo(l,e.vars);return s!=null?String(s):String(o)}}return String(e.fallback??o)},ae=Sn;var re=utils.Log.create({service:"codebase.cli"});async function Nn(){try{let{Llm:o}=await import('./llm-UYBJKQ3S.cjs'),{CodebaseCache:e}=await import('./cache-CSRIBDNY.cjs'),n=await e.getCodebaseJson();o.init({models:{embedding:n?.embedding_model??void 0,evaluation:n?.evaluation_model??void 0},evaluationThreshold:n?.evaluation_threshold});}catch(o){let{errorMeta:e}=await import('@easbot/utils');re.warn("Llm init failed; Llm-related features will be disabled",{error:e(o)});}}function ce(o){return utils.resolveLocaleLang(o?.locale)}function ao(o){let e=(t,i,r)=>ae(t,{locale:o,vars:r,fallback:i}),n=(t,i,r)=>{let l=vn.filter(s=>s.group===t).map(s=>` ${In(s.name)}${e(s.i18nKey,s.description)}`).join(`
20
+ `)}function Bt(o){let e={};for(let n of o)(n==="--help"||n==="-h")&&(e.help=true);return e}async function Gt(o){let e=await chunkY7JDLK56_cjs.b.getRootDir(),n=chunk3DAM6EZN_cjs.a(e),t=chunk3DAM6EZN_cjs.c(e);if(fs.existsSync(n)||await v(),!fs.existsSync(t))throw new utils.NameErrors.OperationFailedError({message:`db not found at ${t} \u2014 run \`easbot codebase index\` first`,operation:"db-not-found",target:t});let{CodeBase:i}=await import('./code-base-WZ3L5IE5.cjs'),{DEFAULT_EMBEDDING_CONFIG:r,DEFAULT_INDEXER_CONFIG:l,DEFAULT_PARSER_CONFIG:s,DEFAULT_SEARCH_CONFIG:a}=await import('@easbot/types'),{CodebaseStdioServer:d}=await import('./stdio-server-BLGU4RQ5.cjs'),c="0.0.0";try{let u=path.dirname(url.fileURLToPath(chunkR32346OA_cjs.d));for(let E=0;E<8;E++){try{let f=JSON.parse(fs.readFileSync(path.join(u,"package.json"),"utf-8"));if(f?.name==="@easbot/codebase"&&typeof f.version=="string"){c=f.version;break}}catch{}let x=path.dirname(u);if(x===u)break;u=x;}}catch{}let m=new i({workspaceDir:e,database:{path:t,walMode:true},embedding:r,indexer:l,parser:s,search:a,sync:{onBoot:false,onSearch:false,onSessionStart:false,intervalMs:0}});await m.initialize();let h={id:"easbot-codebase-mcp",name:"EASBot Codebase MCP",version:c,transportType:mcp.ServerTransportType.STDIO},p=await d.start(m,h);return {rootDir:e,tools:p.tools}}var sn=utils.Log.create({service:"codebase.command.callers"});function zt(o){let e={maxResults:10},n=[];for(let t of o)if(t==="--help"||t==="-h")e.help=true;else if(t==="--json")e.json=true;else if(t.startsWith("--file="))e.file=t.slice(7);else if(t.startsWith("--kind="))e.kind=t.slice(7);else if(t.startsWith("--max=")){let i=parseInt(t.slice(6),10);Number.isFinite(i)&&i>0&&(e.maxResults=i);}else t.startsWith("-")||n.push(t);return n.length>0&&(e.symbol=n[0]),e}async function Wt(o){if(!o.symbol&&!o.nodeId)throw new utils.NameErrors.MissingFieldError({field:"symbol-or-nodeId",message:"callers command requires a <symbol> or --nodeId argument"});let e=await chunkY7JDLK56_cjs.b.getRootDir(),n=Date.now(),i=await chunkXGZDPIEP_cjs.e({workspaceDir:e,rootDir:e},{name:o.symbol,nodeId:o.nodeId,file:o.file,kind:o.kind,maxResults:o.maxResults});return sn.debug("callers command done",{symbol:o.symbol,count:i.callers.length,rootDir:e}),{rootDir:e,serviceResult:i,durationMs:Date.now()-n}}function Jt(o){let{serviceResult:e,rootDir:n}=o,t=[],i=e.root?.name??"?",r=e.truncated?"+":"";if(t.push(`Callers of \`${i}\` (${e.callers.length}${r}) [${n}]`),e.callers.length===0)t.push(" (no incoming edges)");else for(let l of e.callers)t.push(` - [${l.relation}] \`${l.name}\` ${l.filePath}:${l.startLine}`);return e.callers.length>0&&(t.push(""),t.push("\u{1F4A1} Use `easbot codebase node <name>` to read full source of any caller.")),t.join(`
21
+ `)}var cn=utils.Log.create({service:"codebase.command.callees"});function Kt(o){let e={maxResults:10},n=[];for(let t of o)if(t==="--help"||t==="-h")e.help=true;else if(t==="--json")e.json=true;else if(t.startsWith("--file="))e.file=t.slice(7);else if(t.startsWith("--kind="))e.kind=t.slice(7);else if(t.startsWith("--max=")){let i=parseInt(t.slice(6),10);Number.isFinite(i)&&i>0&&(e.maxResults=i);}else t.startsWith("-")||n.push(t);return n.length>0&&(e.symbol=n[0]),e}async function Vt(o){if(!o.symbol&&!o.nodeId)throw new utils.NameErrors.MissingFieldError({field:"symbol-or-nodeId",message:"callees command requires a <symbol> or --nodeId argument"});let e=await chunkY7JDLK56_cjs.b.getRootDir(),n=Date.now(),i=await chunkXGZDPIEP_cjs.f({workspaceDir:e,rootDir:e},{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:i.callees.length,rootDir:e}),{rootDir:e,serviceResult:i,durationMs:Date.now()-n}}function Ht(o){let{serviceResult:e,rootDir:n}=o,t=[],i=e.root?.name??"?",r=e.truncated?"+":"";if(t.push(`Callees of \`${i}\` (${e.callees.length}${r}) [${n}]`),e.callees.length===0)t.push(" (no outgoing edges)");else for(let l of e.callees)t.push(` - [${l.relation}] \`${l.name}\` ${l.filePath}:${l.startLine}`);return e.callees.length>0&&(t.push(""),t.push("\u{1F4A1} Use `easbot codebase node <name>` to read full source of any callee.")),t.join(`
22
+ `)}var pn=utils.Log.create({service:"codebase.command.explore"});function Yt(o){let e={maxFiles:5,maxSymbols:3,depth:1,includeContent:true},n=[];for(let t of o)if(t==="--help"||t==="-h")e.help=true;else if(t==="--json")e.json=true;else if(t==="--no-content")e.includeContent=false;else if(t.startsWith("--file="))e.file=t.slice(7);else if(t.startsWith("--kind="))e.kind=t.slice(7);else if(t.startsWith("--max-files=")){let i=parseInt(t.slice(12),10);Number.isFinite(i)&&i>0&&(e.maxFiles=i);}else if(t.startsWith("--max-symbols=")){let i=parseInt(t.slice(14),10);Number.isFinite(i)&&i>0&&(e.maxSymbols=i);}else if(t.startsWith("--depth=")){let i=parseInt(t.slice(8),10);Number.isFinite(i)&&i>0&&(e.depth=i);}else t.startsWith("--intent=")?e.intent=t.slice(9):t.startsWith("-")||n.push(t);return n.length>0&&(e.query=n.join(" ")),e}async function Qt(o){if(!o.query)throw new utils.NameErrors.MissingFieldError({field:"query",message:"explore command requires a <query> argument"});let e=await chunkY7JDLK56_cjs.b.getRootDir(),n=Date.now(),i=await chunkXGZDPIEP_cjs.g({workspaceDir:e,rootDir:e},{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 pn.debug("explore command done",{query:o.query,totalHits:i.totalHits,entryPoints:i.entryPoints.length,rootDir:e}),{rootDir:e,serviceResult:i,durationMs:Date.now()-n}}async function Xt(o){let e={pendingFiles:[],toolName:"codebase_explore",writeToDisk:false};return await chunkXGZDPIEP_cjs.F(o.serviceResult,e)}var Zt={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 mn=Zt.languages,gn=mn.filter(o=>o.supported).map(o=>o.value),A={defaultLocale:"zh-CN",locales:gn},J={},Y=(o,e)=>{let n=J[o]||{translation:{}};return J[o]={translation:{...n.translation,...e.translation}},J[o]},Q=(o=A.defaultLocale)=>(J[o]||Y(o,{translation:{}}),{locale:o,resources:J[o]||{translation:{}}});var fn={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\u6570\u636E\u5E93 + \u91CD\u65B0\u521D\u59CB\u5316 + \u91CD\u5EFA\u7D22\u5F15\uFF08\u4E00\u6761\u9F99\uFF09","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 + \u91CD\u65B0\u521D\u59CB\u5316 + \u91CD\u5EFA\u7D22\u5F15\uFF08\u4E00\u6761\u9F99\uFF09","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] [--no-reindex] [--no-embed] [--force] [--json] [dir]","cli.recreate.description":"\u4E22\u5F03\u6574\u4E2A\u6570\u636E\u5E93\uFF08codebase.db + -wal + -shm\uFF09\uFF0C\u91CD\u65B0\u521D\u59CB\u5316\uFF0C\u5E76\u81EA\u52A8\u91CD\u5EFA\u7D22\u5F15\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.no_reindex":"--no-reindex \u8DF3\u8FC7\u81EA\u52A8\u91CD\u5EFA\u7D22\u5F15\u6B65\u9AA4\uFF08\u4E4B\u540E\u9700\u624B\u52A8\u8DD1 `easbot codebase index`\uFF09","cli.recreate.opt.no_embed":"--no-embed \u8F6C\u53D1\u7ED9 runIndex\uFF1A\u8DF3\u8FC7 embedding \u751F\u6210\uFF08\u66F4\u5FEB\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\u9ED8\u8BA4\u60C5\u51B5\u4E0B `recreate` \u4F1A\u5728\u540C\u4E00\u6B21\u8C03\u7528\u4E2D\u91CD\u5EFA\u7D22\u5F15\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]","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.node.usage":"\u7528\u6CD5: easbot codebase node <name|id> [--file=<path>] [--kind=<kind>] [--edges] [--max=N] [--json]","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.context.usage":"\u7528\u6CD5: easbot codebase context <id> [--depth=N] [--max=N] [--direction=<incoming|outgoing|both>] [--relation=<r1,r2,...>] [--json]","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.impact.usage":"\u7528\u6CD5: easbot codebase impact <id> [-d=N | --depth=N] [--relation=<r1,r2,...>] [--json]","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.callers.usage":"\u7528\u6CD5: easbot codebase callers <symbol> [--node-id=<id>] [--file=<path>] [--kind=<kind>] [--max=N] [--json]","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.callees.usage":"\u7528\u6CD5: easbot codebase callees <symbol> [--node-id=<id>] [--file=<path>] [--kind=<kind>] [--max=N] [--json]","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.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]","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.dead_code.usage":"\u7528\u6CD5: easbot codebase dead-code [--type=<t1,t2,...>] [--no-exclude-entry] [--limit=N] [--json]","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.circular.usage":"\u7528\u6CD5: easbot codebase circular [--relation=<r>] [--scope=<file|module>] [--json]","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.path.usage":"\u7528\u6CD5: easbot codebase path <from> <to> [-d=N | --depth=N] [--relation=<r1,r2,...>] [--json]","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.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}}"}},eo=fn;var bn={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 Drop db, re-init, rebuild index in one step","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] [--no-reindex] [--no-embed] [--force] [--json] [dir]","cli.recreate.description":"Discard the entire db (codebase.db + -wal + -shm), re-init, and rebuild the index in one step.","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.no_reindex":"--no-reindex Skip the auto rebuild-index step (manual `easbot codebase index` required after)","cli.recreate.opt.no_embed":"--no-embed Forward to runIndex: skip embedding generation (faster)","cli.recreate.opt.force":"--force, -f Skip safety prompts (for scripts)","cli.recreate.opt.json":"--json Output as JSON","cli.recreate.warn":"\u26A0\uFE0F This deletes the entire index. By default `recreate` also rebuilds the index in the same call.","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]","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.node.usage":"Usage: easbot codebase node <name|id> [--file=<path>] [--kind=<kind>] [--edges] [--max=N] [--json]","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.context.usage":"Usage: easbot codebase context <id> [--depth=N] [--max=N] [--direction=<incoming|outgoing|both>] [--relation=<r1,r2,...>] [--json]","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.impact.usage":"Usage: easbot codebase impact <id> [-d=N | --depth=N] [--relation=<r1,r2,...>] [--json]","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.callers.usage":"Usage: easbot codebase callers <symbol> [--node-id=<id>] [--file=<path>] [--kind=<kind>] [--max=N] [--json]","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.callees.usage":"Usage: easbot codebase callees <symbol> [--node-id=<id>] [--file=<path>] [--kind=<kind>] [--max=N] [--json]","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.explore.usage":"Usage: easbot codebase explore <query> [--file=<path>] [--kind=<kind>] [--max-files=N] [--max-symbols=N] [--depth=N] [--no-content] [--intent=<ctx>] [--json]","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.dead_code.usage":"Usage: easbot codebase dead-code [--type=<t1,t2,...>] [--no-exclude-entry] [--limit=N] [--json]","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.circular.usage":"Usage: easbot codebase circular [--relation=<r>] [--scope=<file|module>] [--json]","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.path.usage":"Usage: easbot codebase path <from> <to> [-d=N | --depth=N] [--relation=<r1,r2,...>] [--json]","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.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}}"}},to=bn;var hn=()=>{Q("zh-CN"),Q("en-US"),Y("zh-CN",eo),Y("en-US",to);};hn();var se=new Map;var ie=new Map;var yn=o=>{if(ie.has(o))return ie.get(o);let e=/{{\s*(\w+)\s*}}/g,n=[],t;for(;(t=e.exec(o))!==null;){let l=t[1];l&&!n.includes(l)&&n.push(l);}let i=new RegExp("{{\\s*("+n.join("|")+")\\s*}}","g"),r={keys:n,regex:i};return ie.set(o,r),r},oo=(o,e)=>{if(!o||typeof o!="string")return "";if(!e||Object.keys(e).length===0)return o;let{regex:n,keys:t}=yn(o);return t.length===0||!t.some(r=>r in e)?o:o.replace(n,(r,l)=>{let s=e[l];return s==null?"":String(s)})},xn=o=>{if(o&&A.locales.includes(o))return o;let e=process.env.EASBOT_LANG?.trim()||process.env.LANG?.trim();if(e){let n=e.replace(/_/g,"-");if(A.locales.includes(n))return n;let t=n.split("-")[0];if(t==="zh")return "zh-CN";if(t==="en")return "en-US"}return A.defaultLocale},no=o=>{if(!se.has(o)){let{resources:e}=Q(o);se.set(o,e);}return se.get(o)},Sn=(o,e={})=>{let n=xn(e.locale),i=no(n)?.translation[o];if(i&&typeof i=="string"){let r=oo(i,e.vars);return r!=null?String(r):String(o)}if(n!==A.defaultLocale){let l=no(A.defaultLocale)?.translation[o];if(l&&typeof l=="string"){let s=oo(l,e.vars);return s!=null?String(s):String(o)}}return String(e.fallback??o)},ae=Sn;var re=utils.Log.create({service:"codebase.cli"});async function Nn(){try{let{Llm:o}=await import('./llm-UYBJKQ3S.cjs'),{CodebaseCache:e}=await import('./cache-CSRIBDNY.cjs'),n=await e.getCodebaseJson();o.init({models:{embedding:n?.embedding_model??void 0,evaluation:n?.evaluation_model??void 0},evaluationThreshold:n?.evaluation_threshold});}catch(o){let{errorMeta:e}=await import('@easbot/utils');re.warn("Llm init failed; Llm-related features will be disabled",{error:e(o)});}}function ce(o){return utils.resolveLocaleLang(o?.locale)}function ao(o){let e=(t,i,r)=>ae(t,{locale:o,vars:r,fallback:i}),n=(t,i,r)=>{let l=vn.filter(s=>s.group===t).map(s=>` ${In(s.name)}${e(s.i18nKey,s.description)}`).join(`
23
23
  `);return `${e(i,r)}
24
24
  ${l}`};return `
25
25
  \x1B[1m${e("cli.banner.title","easbot-codebase \u2014 Code Knowledge Graph for EASBot")}\x1B[0m
@@ -1,4 +1,4 @@
1
- 'use strict';var chunk3DAM6EZN_cjs=require('./chunk-3DAM6EZN.cjs'),chunkW5SMGCKO_cjs=require('./chunk-W5SMGCKO.cjs'),utils=require('@easbot/utils'),database=require('@easbot/database'),types=require('@easbot/types'),fs=require('fs');var ee=utils.Log.create({service:"codebase.services.codebase"}),N=utils.Filesystem.toUnixPath;function Pe(e,t){let n={exact:1,qualified:.85,substring:.5}[e];return t?Math.min(1,n+.2):n}function Re(e,t){if(!t)return false;if(e===t)return true;let n=e.split(/[/\\]/).pop()??"",s=t.split(/[/\\]/).pop()??"";return !!(n&&s&&n===s||t.includes("/")&&e.endsWith("/"+t))}async function $(e,t,n){if(n.nodeId){let o=e.getNode(n.nodeId);if(!o)throw new utils.ServiceError({code:"NOT_FOUND",message:`Node not found: nodeId=${n.nodeId}`,details:{name:n.nodeId}});return {node:o,candidates:[]}}if(!n.name)throw new utils.ServiceError({code:"NOT_FOUND",message:"Either name or nodeId is required",details:{...n}});let l=e.getDatabase().findNodesByName({name:n.name,file:n.file,kind:n.kind,limit:50});if(l.length===0)throw new utils.ServiceError({code:"NOT_FOUND",message:`Node not found: ${n.name}`,details:{name:n.name,candidates:[]}});let a=!!n.file,c=n.file?N(n.file):null,i=l.map(o=>{let u=c?Re(N(o.node.file_path),c):false;return {node:o.node,score:Pe(o.matchKind,u),matchKind:o.matchKind,inFile:u}});if(i.sort((o,u)=>u.score-o.score),i.length===1)return {node:i[0].node,candidates:i.map(o=>({node:o.node,score:o.score}))};let d=i[0].score,r=i.filter(o=>o.score===d);if(r.length===1)return {node:r[0].node,candidates:i.slice(0,10).map(o=>({node:o.node,score:o.score}))};if(a&&r.length>1){let o=r.filter(u=>u.inFile);if(o.length===1)return {node:o[0].node,candidates:i.slice(0,10).map(u=>({node:u.node,score:u.score}))}}throw new utils.ServiceError({code:"AMBIGUOUS",message:`Ambiguous name "${n.name}" \u2014 ${i.length} candidates`,details:{name:n.name,candidates:i.slice(0,10).map(o=>({node:o.node,score:o.score}))}})}async function P(e){let t=chunk3DAM6EZN_cjs.c(e.rootDir),n=new chunk3DAM6EZN_cjs.r({workspaceDir:e.workspaceDir,database:{path:t,walMode:true},embedding:types.DEFAULT_EMBEDDING_CONFIG,indexer:types.DEFAULT_INDEXER_CONFIG,parser:types.DEFAULT_PARSER_CONFIG,search:types.DEFAULT_SEARCH_CONFIG,sync:{onBoot:false,onSearch:false,onSessionStart:false,intervalMs:0}});return await n.initialize(),n}function U(e,t,n,s){let l=n.map(()=>"?").join(","),a=t.name.split("@")[0]??t.name,c=a.includes(".")?a.split(".").pop()??a:a,i=new Set([`${t.language}:*:*:${a}`]);c!==a&&i.add(`${t.language}:*:*:${c}`);let d=[];c!==a&&d.push(`${t.language}:*:*:%${c}`);let r=Array.from(i),o=r.map(()=>"?").join(","),g=d.length>0?"OR LOWER(target) LIKE LOWER(?)":"";r.length>1&&ee.warn("queryIncomingEdgesWithWildcard: multi-variant wildcards (bare+namespaced)",{rootName:t.name,wildcards:r,hint:"\u540C\u540D\u540C namespace \u4E0D\u540C file \u7684\u65B9\u6CD5\u53EF\u80FD\u90FD\u88AB\u547D\u4E2D\uFF0CLLM \u63A8\u7406\u8BF7\u7528 file \u8FC7\u6EE4\u8F85\u4F50"});let m=`
1
+ 'use strict';var chunk3DAM6EZN_cjs=require('./chunk-3DAM6EZN.cjs'),chunkW5SMGCKO_cjs=require('./chunk-W5SMGCKO.cjs'),utils=require('@easbot/utils'),database=require('@easbot/database'),types=require('@easbot/types'),fs=require('fs');var te=utils.Log.create({service:"codebase.services.codebase"}),N=utils.Filesystem.toUnixPath;function Pe(e,t){let n={exact:1,qualified:.85,substring:.5}[e];return t?Math.min(1,n+.2):n}function Re(e,t){if(!t)return false;if(e===t)return true;let n=e.split(/[/\\]/).pop()??"",s=t.split(/[/\\]/).pop()??"";return !!(n&&s&&n===s||t.includes("/")&&e.endsWith("/"+t))}async function $(e,t,n){if(n.nodeId){let o=e.getNode(n.nodeId);if(!o)throw new utils.ServiceError({code:"NOT_FOUND",message:`Node not found: nodeId=${n.nodeId}`,details:{name:n.nodeId}});return {node:o,candidates:[]}}if(!n.name)throw new utils.ServiceError({code:"NOT_FOUND",message:"Either name or nodeId is required",details:{...n}});let l=e.getDatabase().findNodesByName({name:n.name,file:n.file,kind:n.kind,limit:50});if(l.length===0)throw new utils.ServiceError({code:"NOT_FOUND",message:`Node not found: ${n.name}`,details:{name:n.name,candidates:[]}});let a=!!n.file,c=n.file?N(n.file):null,i=l.map(o=>{let u=c?Re(N(o.node.file_path),c):false;return {node:o.node,score:Pe(o.matchKind,u),matchKind:o.matchKind,inFile:u}});if(i.sort((o,u)=>u.score-o.score),i.length===1)return {node:i[0].node,candidates:i.map(o=>({node:o.node,score:o.score}))};let d=i[0].score,r=i.filter(o=>o.score===d);if(r.length===1)return {node:r[0].node,candidates:i.slice(0,10).map(o=>({node:o.node,score:o.score}))};if(a&&r.length>1){let o=r.filter(u=>u.inFile);if(o.length===1)return {node:o[0].node,candidates:i.slice(0,10).map(u=>({node:u.node,score:u.score}))}}throw new utils.ServiceError({code:"AMBIGUOUS",message:`Ambiguous name "${n.name}" \u2014 ${i.length} candidates`,details:{name:n.name,candidates:i.slice(0,10).map(o=>({node:o.node,score:o.score}))}})}async function P(e){let t=chunk3DAM6EZN_cjs.c(e.rootDir),n=new chunk3DAM6EZN_cjs.r({workspaceDir:e.workspaceDir,database:{path:t,walMode:true},embedding:types.DEFAULT_EMBEDDING_CONFIG,indexer:types.DEFAULT_INDEXER_CONFIG,parser:types.DEFAULT_PARSER_CONFIG,search:types.DEFAULT_SEARCH_CONFIG,sync:{onBoot:false,onSearch:false,onSessionStart:false,intervalMs:0}});return await n.initialize(),n}function U(e,t,n,s){let l=n.map(()=>"?").join(","),a=t.name.split("@")[0]??t.name,c=a.includes(".")?a.split(".").pop()??a:a,i=new Set([`${t.language}:*:*:${a}`]);c!==a&&i.add(`${t.language}:*:*:${c}`);let d=[];c!==a&&d.push(`${t.language}:*:*:%${c}`);let r=Array.from(i),o=r.map(()=>"?").join(","),g=d.length>0?"OR LOWER(target) LIKE LOWER(?)":"";r.length>1&&te.warn("queryIncomingEdgesWithWildcard: multi-variant wildcards (bare+namespaced)",{rootName:t.name,wildcards:r,hint:"\u540C\u540D\u540C namespace \u4E0D\u540C file \u7684\u65B9\u6CD5\u53EF\u80FD\u90FD\u88AB\u547D\u4E2D\uFF0CLLM \u63A8\u7406\u8BF7\u7528 file \u8FC7\u6EE4\u8F85\u4F50"});let m=`
2
2
  SELECT id, source, target, relation, created_at FROM edges
3
3
  WHERE relation IN (${l})
4
4
  AND source != target
@@ -16,16 +16,16 @@
16
16
  AND source IN (${o})
17
17
  GROUP BY id
18
18
  LIMIT ?
19
- `,g=e.queryAll(u,[...s,...c,l]);for(let m of g)m.id&&!i.has(m.id)&&(i.add(m.id),d.push(m));}return d.slice(0,l)}function te(e,t,n,s){let a=`
19
+ `,g=e.queryAll(u,[...s,...c,l]);for(let m of g)m.id&&!i.has(m.id)&&(i.add(m.id),d.push(m));}return d.slice(0,l)}function ne(e,t,n,s){let a=`
20
20
  SELECT id, source, target, relation, created_at FROM edges
21
21
  WHERE relation IN (${n.map(()=>"?").join(",")})
22
22
  AND source != target
23
23
  AND source = ?
24
24
  LIMIT ?
25
- `;return e.queryAll(a,[...n,t.id,s])}function ne(e,t,n,s){let l=s==="in"?e.source:e.target;t.id;let c=n.getNodeById(l);if(!c&&l.includes(":*:")){let i=l.split(":").pop()??l,d=i.split("@")[0]??i;if(d&&d!==l){let r=n.findNodesByName({name:d}),o=t.file_path??"",u=o.split(/[/\\]/).pop()??"",g=o.split(/[/\\]/).filter(Boolean),m=r.find(p=>p.node.file_path?p.node.file_path===o:false)??r.find(p=>!p.node.file_path||!u?false:p.node.file_path.split(/[/\\]/).pop()===u)??r.find(p=>{if(!p.node.file_path)return false;let f=p.node.file_path.split(/[/\\]/).filter(Boolean);return g.length<2||f.length<2?false:g[0]===f[0]&&g[1]===f[1]})??null;m&&(c=m.node);}}if(!c){let i=l.split(":").pop()??l;return {id:l,name:i,astType:"unresolved",filePath:"(unresolved)",startLine:0,relation:e.relation}}return {id:c.id,name:c.name,astType:c.ast_type,filePath:N(c.file_path),startLine:c.start_line??0,relation:e.relation}}async function re(e,t){let n=Date.now(),l=(await P(e)).getQuery(),a=database.resolveSqlTextLimit(t.snippetMaxChars??database.SQL_TEXT_LIMIT_DEFAULT),i=await l.search(t.query??"",{maxResults:t.maxResults??10,language:t.language,filePath:t.file,astType:t.astType,includeEdges:true,enableFts:t.enableFts!==false,enableEmbedding:t.enableEmbedding!==false,snippetMaxChars:a});if(t.kind){let o=t.kind.toLowerCase();i=i.filter(u=>u.ast_type.includes(o)||u.name.toLowerCase().includes(o));}if(t.file){let o=N(t.file);i=i.filter(u=>N(u.file_path).endsWith(o)||N(u.file_path).includes(o));}let d=t.maxEdgesPerNode??10,r=i.map(o=>({nodeId:o.id,name:o.name,kind:o.ast_type??"unknown",filePath:N(o.file_path),startLine:o.start_line,endLine:o.end_line,edges:(o.edges??[]).slice(0,d),source:"basic",score:0,snippet:(o.text??"").slice(0,a).replace(/\s+/g," ").trim()}));return {total:r.length,hits:r,durationMs:Date.now()-n,truncated:false}}async function Ie(e,t){let n=await P(e),s=n.getQuery(),l=n.getDatabase(),{node:a}=await $(s,e,t),c=[];if(t.includeEdges){let i=t.maxEdgesPerNode??10,d=["CALLS","IMPORTS","TYPE_REFERENCES","EXTENDS","IMPLEMENTS","HAS_METHOD","HAS_PROPERTY","METHOD_OVERRIDES"],r=U(l,a,d,i+1),o=te(l,a,d,i+1),u=new Set,g=[];for(let m of [...r,...o])m.id&&!u.has(m.id)&&(u.add(m.id),g.push(m));c=g.slice(0,i);}return {node:a,edges:c}}var Le=["CALLS","IMPORTS","TYPE_REFERENCES","EXTENDS","IMPLEMENTS","HAS_METHOD","HAS_PROPERTY","METHOD_OVERRIDES"];async function Te(e,t){let n=await P(e),s=n.getQuery(),l=n.getDatabase(),{node:a}=await $(s,e,t);if(!a)return {root:null,nodes:[],edges:[],truncated:false,totalNodes:0,totalEdges:0};let c=t.depth??2,i=t.maxNodes??100,d=t.direction??"both";t.maxEdgesPerNode??10;let o=new Map,u=[{nodeId:a.id,depth:0}];o.set(a.id,0);let g=[],m=false;for(;u.length>0;){let y=u.shift();if(y.depth>=c)continue;if(o.size>=i){m=true;break}let I=s.queryNeighbors(y.nodeId,{direction:d,relationTypes:t.relationTypes??Le,limit:i-o.size+1});for(let b of I.edges){g.push(b);let L=b.source===y.nodeId?b.target:b.source;if(!o.has(L)&&(o.set(L,y.depth+1),u.push({nodeId:L,depth:y.depth+1}),o.size>=i)){m=true;break}}if(m)break}let p=new Set,f=[];for(let y of g)!y.id||p.has(y.id)||(p.add(y.id),f.push(y));let E=Array.from(o.keys()),h=E.length>0?l.queryNodes({ids:E}):[],C=new Map(h.map(y=>[y.id,y])),x=[];for(let[y,I]of o.entries()){let b=C.get(y);b&&x.push({node:b,depth:I});}return {root:a,nodes:x,edges:f,truncated:m,totalNodes:x.length,totalEdges:g.length}}var $e=["CALLS","IMPORTS","TYPE_REFERENCES"];async function _e(e,t){let n=await P(e),s=n.getQuery(),l=n.getDatabase(),{node:a}=await $(s,e,t);if(!a)return {root:null,totalImpacted:0,buckets:[]};let c=t.depth??2,i=t.maxResults??10,d=t.relationTypes??$e,r=t.maxEdgesPerNode??10,o=new Set([a.id]),u=[],g=[a.id];for(let m=1;m<=c&&!(g.length===0||o.size-1>=i);m++){let p=U(l,a,d,r+1),f=[],E=new Set;for(let h of p)if(!o.has(h.source)&&!E.has(h.source)&&(E.add(h.source),o.add(h.source),f.push(h.source),o.size-1>=i))break;if(f.length>0){let h=f.slice(0,10),C=l.queryNodes({ids:h}),x=new Map(C.map(b=>[b.id,b])),y=new Map;for(let b of p)y.has(b.source)||y.set(b.source,b.relation);let I=h.map(b=>{let L=x.get(b);return {id:b,name:L?.name??"(unknown)",filePath:L?N(L.file_path):"(unknown)",relation:y.get(b)??"CALLS"}});u.push({depth:m,count:f.length,sample:I});}g=f;}return u.length===0&&ee.warn("impact: no incoming edges found",{root:a.name,depth:c,relationTypes:d}),{root:a,totalImpacted:o.size-1,buckets:u}}var oe=["CALLS","IMPORTS","TYPE_REFERENCES","EXTENDS","IMPLEMENTS","METHOD_OVERRIDES"];async function we(e,t){return se(e,t)}async function Fe(e,t){return ie(e,t)}async function se(e,t){let n=await P(e),s=n.getQuery(),l=n.getDatabase(),{node:a}=await $(s,e,t);if(!a)return {root:null,callers:[],truncated:false};let c=t.maxResults??10,i=t.maxEdgesPerNode??c,d=t.relationTypes??oe,r=U(l,a,d,i+1),o=[];for(let g of r){let m=ne(g,a,l,"in");m&&o.push(m);}let u=o.length>c;return {root:a,callers:u?o.slice(0,c):o,truncated:u}}async function ie(e,t){let n=await P(e),s=n.getQuery(),l=n.getDatabase(),{node:a}=await $(s,e,t);if(!a)return {root:null,callees:[],truncated:false};let c=t.maxResults??10,i=t.maxEdgesPerNode??c,d=t.relationTypes??oe,r=te(l,a,d,i+1),o=Se(a.ast_type)?Ce(l,a,r,d,i+1):r,u=[];for(let m of o){let p=ne(m,a,l,"out");p&&u.push(p);}let g=u.length>c;return {root:a,callees:g?u.slice(0,c):u,truncated:g}}async function Ae(e,t){if(!t.query)throw new utils.ServiceError({code:"NOT_FOUND",message:"explore requires a non-empty query",details:{query:t.query}});let s=await P(e),l=s.getQuery(),a=s.getDatabase(),c=database.resolveSqlTextLimit(t.snippetMaxChars??database.SQL_TEXT_LIMIT_DEFAULT),d=(await re(e,{query:t.query,file:t.file,kind:t.kind,intent:t.intent,maxResults:t.maxFiles??5,enableFts:true,enableEmbedding:true,snippetMaxChars:c})).hits;if(t.file||t.kind)try{let m=await $(l,e,{name:t.query,file:t.file,kind:t.kind});if(m?.node){let p={nodeId:m.node.id,name:m.node.name,kind:m.node.ast_type,filePath:N(m.node.file_path),startLine:m.node.start_line,endLine:m.node.end_line,edges:[],source:"basic",score:0,snippet:(m.node.text??"").slice(0,c).replace(/\s+/g," ").trim()},f=d.filter(E=>E.nodeId!==p.nodeId);d=[p,...f];}}catch{}let r=new Map;for(let m of d){let p=N(m.filePath),f=r.get(p);f?f.push(m):r.set(p,[m]);}let o=t.maxSymbols??3,u=t.maxEdgesPerNode??10,g=[];for(let[m,p]of r){let f=p.slice(0,o),E=[];for(let h of f){let C=await se(e,{name:h.name,file:m,kind:t.kind,maxResults:u,maxEdgesPerNode:u}),x=await ie(e,{name:h.name,file:m,kind:t.kind,maxResults:u,maxEdgesPerNode:u});E.push({node:(()=>{let y={id:h.nodeId,name:h.name,ast_type:h.kind,language:"ts",file_path:h.filePath,start_line:h.startLine??0,end_line:h.endLine??0};try{let I=a.getNodeById(h.nodeId);return {...y,text:I?.text??""}}catch{return {...y,text:""}}})(),callers:C.callers,callees:x.callees});}g.push({file:m,symbols:E});}return {query:t.query,entryPoints:g,totalHits:d.length}}async function De(e,t){let s=await(await P(e)).getStatus();s.package="codebase",s.workspaceDir=e.workspaceDir;let l=chunk3DAM6EZN_cjs.b(e.workspaceDir),a=fs.existsSync(l),c=fs.existsSync(s.dbPath),i;if(c)try{i=fs.statSync(s.dbPath).size;}catch{}s.configPath=l,s.configExists=a,s.dbExists=c,s.dbSize=i,s.vectorEnabled=s.meta?.vector_enabled==="true"||s.meta?.vector_enabled==="1";let d=s.meta?.embeddingDims;d&&Number.isFinite(Number.parseInt(d,10))&&(s.embeddingDims=Number.parseInt(d,10));let r={initialized:false,capabilities:{embedding:false,evaluation:false}};try{let{Llm:o}=await import('./llm-UYBJKQ3S.cjs');if(o.isInitialized()){r.initialized=!0;let u=o.capabilities();r.capabilities={embedding:u.embedding===!0,evaluation:u.evaluation===!0},r.embeddingModel=r.capabilities.embedding?"configured":void 0,r.evaluationModel=r.capabilities.evaluation?"configured":void 0;}}catch{}s.llm=r;try{let{DatabaseManager:o}=await import('./database-manager-T43UZZ45.cjs'),u=new o(s.dbPath);try{let{stats:g}=u.checkIntegrity();s.dbStats=g,s.ftsAvailable=u.isFtsAvailable();}finally{u.close();}}catch{}return s}async function Oe(e,t){return await(await P(e)).healthCheck()}var Me=utils.Log.create({service:"codebase.services.init"}),ae=false;async function He(){ae||(ae=true,Me.info("codebase service init"),await utils.ServiceErrorBus.init(),await chunkW5SMGCKO_cjs.e());}var Ue=200,le=utils.Filesystem.toUnixPath;function ze(e){let t=e.text??"";if(!t)return false;let n=t.slice(0,80);return /\bexport\s/.test(n)||/\bpublic\s/.test(n)?true:(false)}function Ke(e){let t=e.text??"";if(!t)return [];let n=t.slice(0,80),s=[];return /\basync\s/.test(n)&&s.push("async"),/\bstatic\s/.test(n)&&s.push("static"),/\babstract\s/.test(n)&&s.push("abstract"),/\breadonly\s/.test(n)&&s.push("readonly"),/\bconst\s/.test(n)&&s.push("const"),/\blet\s/.test(n)&&s.push("let"),s}function R(e){return {id:e.id,name:e.name,astType:e.ast_type,language:e.language,filePath:le(e.file_path),startLine:e.start_line??0,endLine:e.end_line??0,isExported:ze(e),modifiers:Ke(e)}}function _(e,t){return {id:e.id,source:e.source,target:e.target,relation:e.relation,direction:t}}function z(e){return e.map(t=>({node:{id:t.nodeId,name:t.name,astType:t.kind,language:"typescript",filePath:le(t.filePath),startLine:t.startLine??0,endLine:t.endLine??0,isExported:false,modifiers:[]},source:t.source,score:t.score,snippet:(t.snippet??"").slice(0,database.resolveSqlTextLimit(Ue)),edges:(t.edges??[]).slice(0,10).map(n=>_({...n}))}))}function K(){return {id:"",name:"",astType:"",language:"",filePath:"",startLine:0,endLine:0,isExported:false,modifiers:[]}}var Ge=utils.Log.create({service:"codebase.format.truncate"}),j="**`",Qe="**",ce=24e3,ue=25e3;async function D(e,t={}){let n=t.softLimit??ce,s=t.hardCeiling??ue,l=t.toolName??"codebase",a=t.writeToDisk!==false;if(e.length<=n)return {content:e,truncated:false};let c=e.slice(0,s),i=c.lastIndexOf(`
26
- ${j}`),d=c.lastIndexOf(`
27
- `),r;i>s*.5?r=i:d>0?r=d:r=-1;let o=r>0?c.slice(0,r):c,g=o+"\n\n... (output truncated to budget; the source above is complete and verbatim \u2014 treat it as already Read. For any area not covered, make ANOTHER `<tool>` targeting those names \u2014 do NOT Read these files.)";if(!a)return {content:g,truncated:true,outputPath:"",hint:"Use Grep/Read to inspect the truncated sections.",info:`... ${e.length-o.length}/${e.length} characters truncated ...`};try{let m=await utils.TruncateContent.truncate(e,{maxChars:o.length,direction:"head",label:`${l}-output`});return m.truncated?{content:g,truncated:!0,outputPath:m.outputPath,hint:utils.TruncateContent.formatHint(m),info:`... ${m.removedLength}/${m.originalLength} characters truncated ...`}:{content:g,truncated:!0,outputPath:"",hint:"Use Grep/Read to inspect the truncated sections.",info:`... ${e.length-o.length}/${e.length} characters truncated ...`}}catch(m){return Ge.warn("TruncateContent.truncate failed, returning without disk hint",{error:utils.errorMeta(m)}),{content:g,truncated:true,outputPath:"",hint:"Use Grep/Read to inspect the truncated sections.",info:`... ${e.length-o.length}/${e.length} characters truncated ...`}}}function O(e,t={}){let n=t.softLimit??ce,s=t.hardCeiling??ue;if(e.length<=n)return {content:e,truncated:false};let l=e.slice(0,s),a=l.lastIndexOf(`
28
- ${j}`),c=l.lastIndexOf(`
25
+ `;return e.queryAll(a,[...n,t.id,s])}function re(e,t,n,s){let l=s==="in"?e.source:e.target;t.id;let c=n.getNodeById(l);if(!c&&l.includes(":*:")){let i=l.split(":").pop()??l,d=i.split("@")[0]??i;if(d&&d!==l){let r=n.findNodesByName({name:d}),o=t.file_path??"",u=o.split(/[/\\]/).pop()??"",g=o.split(/[/\\]/).filter(Boolean),m=r.find(p=>p.node.file_path?p.node.file_path===o:false)??r.find(p=>!p.node.file_path||!u?false:p.node.file_path.split(/[/\\]/).pop()===u)??r.find(p=>{if(!p.node.file_path)return false;let f=p.node.file_path.split(/[/\\]/).filter(Boolean);return g.length<2||f.length<2?false:g[0]===f[0]&&g[1]===f[1]})??null;m&&(c=m.node);}}if(!c){let i=l.split(":").pop()??l;return {id:l,name:i,astType:"unresolved",filePath:"(unresolved)",startLine:0,relation:e.relation}}return {id:c.id,name:c.name,astType:c.ast_type,filePath:N(c.file_path),startLine:c.start_line??0,relation:e.relation}}async function oe(e,t){let n=Date.now(),l=(await P(e)).getQuery(),a=database.resolveSqlTextLimit(t.snippetMaxChars??database.SQL_TEXT_LIMIT_DEFAULT),i=await l.search(t.query??"",{maxResults:t.maxResults??10,language:t.language,filePath:t.file,astType:t.astType,includeEdges:true,enableFts:t.enableFts!==false,enableEmbedding:t.enableEmbedding!==false,snippetMaxChars:a});if(t.kind){let o=t.kind.toLowerCase();i=i.filter(u=>u.ast_type.includes(o)||u.name.toLowerCase().includes(o));}if(t.file){let o=N(t.file);i=i.filter(u=>N(u.file_path).endsWith(o)||N(u.file_path).includes(o));}let d=t.maxEdgesPerNode??10,r=i.map(o=>({nodeId:o.id,name:o.name,kind:o.ast_type??"unknown",filePath:N(o.file_path),startLine:o.start_line,endLine:o.end_line,edges:(o.edges??[]).slice(0,d),source:"basic",score:0,snippet:(o.text??"").slice(0,a).replace(/\s+/g," ").trim()}));return {total:r.length,hits:r,durationMs:Date.now()-n,truncated:false}}async function Ie(e,t){let n=await P(e),s=n.getQuery(),l=n.getDatabase(),{node:a}=await $(s,e,t),c=[];if(t.includeEdges){let i=t.maxEdgesPerNode??10,d=["CALLS","IMPORTS","TYPE_REFERENCES","EXTENDS","IMPLEMENTS","HAS_METHOD","HAS_PROPERTY","METHOD_OVERRIDES"],r=U(l,a,d,i+1),o=ne(l,a,d,i+1),u=new Set,g=[];for(let m of [...r,...o])m.id&&!u.has(m.id)&&(u.add(m.id),g.push(m));c=g.slice(0,i);}return {node:a,edges:c}}var Le=["CALLS","IMPORTS","TYPE_REFERENCES","EXTENDS","IMPLEMENTS","HAS_METHOD","HAS_PROPERTY","METHOD_OVERRIDES"];async function Te(e,t){let n=await P(e),s=n.getQuery(),l=n.getDatabase(),{node:a}=await $(s,e,t);if(!a)return {root:null,nodes:[],edges:[],truncated:false,totalNodes:0,totalEdges:0};let c=t.depth??2,i=t.maxNodes??100,d=t.direction??"both";t.maxEdgesPerNode??10;let o=new Map,u=[{nodeId:a.id,depth:0}];o.set(a.id,0);let g=[],m=false;for(;u.length>0;){let y=u.shift();if(y.depth>=c)continue;if(o.size>=i){m=true;break}let I=s.queryNeighbors(y.nodeId,{direction:d,relationTypes:t.relationTypes??Le,limit:i-o.size+1});for(let b of I.edges){g.push(b);let L=b.source===y.nodeId?b.target:b.source;if(!o.has(L)&&(o.set(L,y.depth+1),u.push({nodeId:L,depth:y.depth+1}),o.size>=i)){m=true;break}}if(m)break}let p=new Set,f=[];for(let y of g)!y.id||p.has(y.id)||(p.add(y.id),f.push(y));let E=Array.from(o.keys()),h=E.length>0?l.queryNodes({ids:E}):[],C=new Map(h.map(y=>[y.id,y])),x=[];for(let[y,I]of o.entries()){let b=C.get(y);b&&x.push({node:b,depth:I});}return {root:a,nodes:x,edges:f,truncated:m,totalNodes:x.length,totalEdges:g.length}}var $e=["CALLS","IMPORTS","TYPE_REFERENCES"];async function _e(e,t){let n=await P(e),s=n.getQuery(),l=n.getDatabase(),{node:a}=await $(s,e,t);if(!a)return {root:null,totalImpacted:0,buckets:[]};let c=t.depth??2,i=t.maxResults??10,d=t.relationTypes??$e,r=t.maxEdgesPerNode??10,o=new Set([a.id]),u=[],g=[a.id];for(let m=1;m<=c&&!(g.length===0||o.size-1>=i);m++){let p=U(l,a,d,r+1),f=[],E=new Set;for(let h of p)if(!o.has(h.source)&&!E.has(h.source)&&(E.add(h.source),o.add(h.source),f.push(h.source),o.size-1>=i))break;if(f.length>0){let h=f.slice(0,10),C=l.queryNodes({ids:h}),x=new Map(C.map(b=>[b.id,b])),y=new Map;for(let b of p)y.has(b.source)||y.set(b.source,b.relation);let I=h.map(b=>{let L=x.get(b);return {id:b,name:L?.name??"(unknown)",filePath:L?N(L.file_path):"(unknown)",relation:y.get(b)??"CALLS"}});u.push({depth:m,count:f.length,sample:I});}g=f;}return u.length===0&&te.warn("impact: no incoming edges found",{root:a.name,depth:c,relationTypes:d}),{root:a,totalImpacted:o.size-1,buckets:u}}var se=["CALLS","IMPORTS","TYPE_REFERENCES","EXTENDS","IMPLEMENTS","METHOD_OVERRIDES"];async function we(e,t){return ie(e,t)}async function Fe(e,t){return ae(e,t)}async function ie(e,t){let n=await P(e),s=n.getQuery(),l=n.getDatabase(),{node:a}=await $(s,e,t);if(!a)return {root:null,callers:[],truncated:false};let c=t.maxResults??10,i=t.maxEdgesPerNode??c,d=t.relationTypes??se,r=U(l,a,d,i+1),o=[];for(let g of r){let m=re(g,a,l,"in");m&&o.push(m);}let u=o.length>c;return {root:a,callers:u?o.slice(0,c):o,truncated:u}}async function ae(e,t){let n=await P(e),s=n.getQuery(),l=n.getDatabase(),{node:a}=await $(s,e,t);if(!a)return {root:null,callees:[],truncated:false};let c=t.maxResults??10,i=t.maxEdgesPerNode??c,d=t.relationTypes??se,r=ne(l,a,d,i+1),o=Se(a.ast_type)?Ce(l,a,r,d,i+1):r,u=[];for(let m of o){let p=re(m,a,l,"out");p&&u.push(p);}let g=u.length>c;return {root:a,callees:g?u.slice(0,c):u,truncated:g}}async function Ae(e,t){if(!t.query)throw new utils.ServiceError({code:"NOT_FOUND",message:"explore requires a non-empty query",details:{query:t.query}});let s=await P(e),l=s.getQuery(),a=s.getDatabase(),c=database.resolveSqlTextLimit(t.snippetMaxChars??database.SQL_TEXT_LIMIT_DEFAULT),d=(await oe(e,{query:t.query,file:t.file,kind:t.kind,intent:t.intent,maxResults:t.maxFiles??5,enableFts:true,enableEmbedding:true,snippetMaxChars:c})).hits;if(t.file||t.kind)try{let m=await $(l,e,{name:t.query,file:t.file,kind:t.kind});if(m?.node){let p={nodeId:m.node.id,name:m.node.name,kind:m.node.ast_type,filePath:N(m.node.file_path),startLine:m.node.start_line,endLine:m.node.end_line,edges:[],source:"basic",score:0,snippet:(m.node.text??"").slice(0,c).replace(/\s+/g," ").trim()},f=d.filter(E=>E.nodeId!==p.nodeId);d=[p,...f];}}catch{}let r=new Map;for(let m of d){let p=N(m.filePath),f=r.get(p);f?f.push(m):r.set(p,[m]);}let o=t.maxSymbols??3,u=t.maxEdgesPerNode??10,g=[];for(let[m,p]of r){let f=p.slice(0,o),E=[];for(let h of f){let C=await ie(e,{name:h.name,file:m,kind:t.kind,maxResults:u,maxEdgesPerNode:u}),x=await ae(e,{name:h.name,file:m,kind:t.kind,maxResults:u,maxEdgesPerNode:u});E.push({node:(()=>{let y={id:h.nodeId,name:h.name,ast_type:h.kind,language:"ts",file_path:h.filePath,start_line:h.startLine??0,end_line:h.endLine??0};try{let I=a.getNodeById(h.nodeId);return {...y,text:I?.text??""}}catch{return {...y,text:""}}})(),callers:C.callers,callees:x.callees});}g.push({file:m,symbols:E});}return {query:t.query,entryPoints:g,totalHits:d.length}}async function De(e,t){let s=await(await P(e)).getStatus();s.package="codebase",s.workspaceDir=e.workspaceDir;let l=chunk3DAM6EZN_cjs.b(e.workspaceDir),a=fs.existsSync(l),c=fs.existsSync(s.dbPath),i;if(c)try{i=fs.statSync(s.dbPath).size;}catch{}s.configPath=l,s.configExists=a,s.dbExists=c,s.dbSize=i,s.vectorEnabled=s.meta?.vector_enabled==="true"||s.meta?.vector_enabled==="1";let d=s.meta?.embeddingDims;d&&Number.isFinite(Number.parseInt(d,10))&&(s.embeddingDims=Number.parseInt(d,10));let r={initialized:false,capabilities:{embedding:false,evaluation:false}};try{let{Llm:o}=await import('./llm-UYBJKQ3S.cjs');if(o.isInitialized()){r.initialized=!0;let u=o.capabilities();r.capabilities={embedding:u.embedding===!0,evaluation:u.evaluation===!0},r.embeddingModel=r.capabilities.embedding?"configured":void 0,r.evaluationModel=r.capabilities.evaluation?"configured":void 0;}}catch{}s.llm=r;try{let{DatabaseManager:o}=await import('./database-manager-T43UZZ45.cjs'),u=new o(s.dbPath);try{let{stats:g}=u.checkIntegrity();s.dbStats=g,s.ftsAvailable=u.isFtsAvailable();}finally{u.close();}}catch{}return s}async function Oe(e,t){return await(await P(e)).healthCheck()}var Me=utils.Log.create({service:"codebase.services.init"}),le=false;async function He(){le||(le=true,Me.info("codebase service init"),await utils.ServiceErrorBus.init(),await chunkW5SMGCKO_cjs.e());}var Ue=200,de=utils.Filesystem.toUnixPath;function ze(e){let t=e.text??"";if(!t)return false;let n=t.slice(0,80);return /\bexport\s/.test(n)||/\bpublic\s/.test(n)?true:(false)}function Ke(e){let t=e.text??"";if(!t)return [];let n=t.slice(0,80),s=[];return /\basync\s/.test(n)&&s.push("async"),/\bstatic\s/.test(n)&&s.push("static"),/\babstract\s/.test(n)&&s.push("abstract"),/\breadonly\s/.test(n)&&s.push("readonly"),/\bconst\s/.test(n)&&s.push("const"),/\blet\s/.test(n)&&s.push("let"),s}function R(e){return {id:e.id,name:e.name,astType:e.ast_type,language:e.language,filePath:de(e.file_path),startLine:e.start_line??0,endLine:e.end_line??0,isExported:ze(e),modifiers:Ke(e)}}function _(e,t){return {id:e.id,source:e.source,target:e.target,relation:e.relation,direction:t}}function z(e){return e.map(t=>({node:{id:t.nodeId,name:t.name,astType:t.kind,language:"typescript",filePath:de(t.filePath),startLine:t.startLine??0,endLine:t.endLine??0,isExported:false,modifiers:[]},source:t.source,score:t.score,snippet:(t.snippet??"").slice(0,database.resolveSqlTextLimit(Ue)),edges:(t.edges??[]).slice(0,10).map(n=>_({...n}))}))}function K(){return {id:"",name:"",astType:"",language:"",filePath:"",startLine:0,endLine:0,isExported:false,modifiers:[]}}var Ge=utils.Log.create({service:"codebase.format.truncate"}),W="**`",Qe="**",ce=24e3,ue=25e3;async function D(e,t={}){let n=t.softLimit??ce,s=t.hardCeiling??ue,l=t.toolName??"codebase",a=t.writeToDisk!==false;if(e.length<=n)return {content:e,truncated:false};let c=e.slice(0,s),i=c.lastIndexOf(`
26
+ ${W}`),d=c.lastIndexOf(`
27
+ `),r;i>s*.5?r=i:d>0?r=d:r=-1;let o=r>0?c.slice(0,r):c,g=o+"\n\n... (output truncated to budget; the source above is complete and verbatim \u2014 treat it as already Read. For any area not covered, make ANOTHER `<tool>` targeting those names \u2014 do NOT Read these files.)";if(!a)return {content:g,truncated:true,outputPath:"",hint:"Use Grep/Read to inspect the truncated sections.",info:`... ${e.length-o.length}/${e.length} characters truncated ...`};try{let m=await utils.TruncateContent.truncate(e,{maxChars:Math.min(o.length,utils.TruncateContent.DEFAULT_MAX_CHARS),direction:"head",label:`${l}-output`});return m.truncated?{content:g,truncated:!0,outputPath:m.outputPath,hint:utils.TruncateContent.formatHint(m),info:`... ${m.removedLength}/${m.originalLength} characters truncated ...`}:{content:g,truncated:!0,outputPath:"",hint:"Use Grep/Read to inspect the truncated sections.",info:`... ${e.length-o.length}/${e.length} characters truncated ...`}}catch(m){return Ge.warn("TruncateContent.truncate failed, returning without disk hint",{error:utils.errorMeta(m)}),{content:g,truncated:true,outputPath:"",hint:"Use Grep/Read to inspect the truncated sections.",info:`... ${e.length-o.length}/${e.length} characters truncated ...`}}}function O(e,t={}){let n=t.softLimit??ce,s=t.hardCeiling??ue;if(e.length<=n)return {content:e,truncated:false};let l=e.slice(0,s),a=l.lastIndexOf(`
28
+ ${W}`),c=l.lastIndexOf(`
29
29
  `),i;a>s*.5?i=a:c>0?i=c:i=-1;let d=i>0?l.slice(0,i):l;return {content:d+`
30
30
 
31
31
  ... (output truncated; tail dropped at section boundary)`,truncated:true,outputPath:"",hint:"",info:`... ${e.length-d.length}/${e.length} characters truncated ...`}}function Ye(e,t=Date.now()){let n=Math.max(0,Math.floor((t-e)/1e3));return n>60?">60s ago":`${n}s ago`}function k(e,t){if(!e||e.length===0)return null;let n=e.filter(l=>t.has(l.path));return n.length===0?null:`\u26A0\uFE0F Index may be stale for: ${n.map(l=>`${l.path} (edited ${Ye(l.lastEventAt)})`).join(", ")}
@@ -36,13 +36,13 @@ ${j}`),c=l.lastIndexOf(`
36
36
  > If your question also needs files/symbols listed under "Not shown above" (or any area this call didn't cover), make ANOTHER \`<tool>\` targeting those names \u2014 it returns the same source with line numbers and is cheaper and more complete than reading.`,impact:"---\n\n> **Risk: <riskLevel>**. Before editing `<root>`, review d=1 first \u2014 those WILL BREAK.\n> Use `<tool>` to read full source of any direct caller.",context:"---\n\n> **Use `impact` for blast-radius analysis. Use `explore` to read source.**",default:`---
37
37
 
38
38
  > **Output truncated to budget; the content above is the source of truth.**
39
- > For more detail, call \`<tool>\` with refined parameters.`};async function v(e,t){let{pendingFiles:n,toolName:s,sync:l=false}=t;if(e.length===0)return w(s,"No matches found.","Try broader search terms, or use `explore` to read source.");let a=Xe(e),c=new Set(a.keys()),i=[];i.push(k(n,c)??"");let d="[[codebase-search-summary]]";i.push(d+`
39
+ > For more detail, call \`<tool>\` with refined parameters.`};async function v(e,t){let{pendingFiles:n,toolName:s,sync:l=false}=t;if(e.length===0)return w(s,"No matches found.","Try broader search terms, or use `explore` to read source.");let a=Ve(e),c=new Set(a.keys()),i=[];i.push(k(n,c)??"");let d="[[codebase-search-summary]]";i.push(d+`
40
40
  `);let r=e.length;i.push(`**Files with matches:** ${a.size}
41
41
  `);for(let[m,p]of a){let f=p.map(x=>x.node.name),E=f.slice(0,5).join(", "),h=f.length>5?`, +${f.length-5} more`:"";i.push(`**\`${m}\`** \u2014 ${E}${h}
42
42
  `);let C=p[0]?.node.language??"";i.push("```"+C);for(let x of p)i.push(`L${x.node.startLine} ${x.snippet}`);i.push("```\n");}i.push(A("search",s,{}));let o=i.join(`
43
- `),u=`Found ${r} symbol${r===1?"":"s"} across ${a.size} file${a.size===1?"":"s"}.`,g=o.replace(d,u);return F(g,t,l)}async function M(e,t,n){let{pendingFiles:s,toolName:l,sync:a=false}=n;if(t.length===0||t.every(r=>r.count===0))return w(l,`No incoming edges for \`${e.name}\`.`,"This symbol has no callers \u2014 safe to refactor.");let c=t.reduce((r,o)=>r+o.count,0),i=Ve(c),d=[];d.push(k(s,new Set([e.filePath]))??""),d.push(`**Impact for \`${e.name}\`** (root: ${e.filePath}:${e.startLine}, total impacted: ${c})
43
+ `),u=`Found ${r} symbol${r===1?"":"s"} across ${a.size} file${a.size===1?"":"s"}.`,g=o.replace(d,u);return F(g,t,l)}async function M(e,t,n){let{pendingFiles:s,toolName:l,sync:a=false}=n;if(t.length===0||t.every(r=>r.count===0))return w(l,`No incoming edges for \`${e.name}\`.`,"This symbol has no callers \u2014 safe to refactor.");let c=t.reduce((r,o)=>r+o.count,0),i=Xe(c),d=[];d.push(k(s,new Set([e.filePath]))??""),d.push(`**Impact for \`${e.name}\`** (root: ${e.filePath}:${e.startLine}, total impacted: ${c})
44
44
  `);for(let r of t){d.push(`- **d=${r.depth}** (${r.count} nodes) \u2014 ${r.riskLabel}`);for(let o of r.samples.slice(0,5))d.push(` - \`${o.name}\` ${o.file}:${o.line} [${o.relation}]`);r.samples.length>5&&d.push(` - ... and ${r.samples.length-5} more`);}return d.push(A("impact",l,{root:e.name,riskLevel:i})),F(d.join(`
45
- `),n,a)}function Ve(e){return e>=100?"CRITICAL":e>=50?"HIGH":e>=10?"MEDIUM":"LOW"}function W(e){return e===1?"WILL BREAK (direct callers)":e===2?"LIKELY AFFECTED (indirect)":"MAY NEED TESTING (transitive)"}async function G(e,t){let{root:n,incoming:s,outgoing:l,neighbors:a}=e,{pendingFiles:c,toolName:i,sync:d=false}=t;if(s.length===0&&l.length===0&&a.length===0)return w(i,`No relations found for \`${n.name}\`.`,"This is a leaf node.");let r=[];r.push(k(c,new Set([n.filePath]))??""),r.push(`**Context for \`${n.name}\`** (${n.astType}, ${n.language}, ${n.filePath}:${n.startLine})
45
+ `),n,a)}function Xe(e){return e>=100?"CRITICAL":e>=50?"HIGH":e>=10?"MEDIUM":"LOW"}function G(e){return e===1?"WILL BREAK (direct callers)":e===2?"LIKELY AFFECTED (indirect)":"MAY NEED TESTING (transitive)"}async function Q(e,t){let{root:n,incoming:s,outgoing:l,neighbors:a}=e,{pendingFiles:c,toolName:i,sync:d=false}=t;if(s.length===0&&l.length===0&&a.length===0)return w(i,`No relations found for \`${n.name}\`.`,"This is a leaf node.");let r=[];r.push(k(c,new Set([n.filePath]))??""),r.push(`**Context for \`${n.name}\`** (${n.astType}, ${n.language}, ${n.filePath}:${n.startLine})
46
46
  `),r.push(`**Incoming** (${s.length}):`);for(let o of s.slice(0,10))r.push(`- ${o.source} \u2192 [${o.relation}] \u2192 \`${n.name}\``);s.length>10&&r.push(`- ... and ${s.length-10} more`),r.push(""),r.push(`**Outgoing** (${l.length}):`);for(let o of l.slice(0,10))r.push(`- \`${n.name}\` \u2192 [${o.relation}] \u2192 ${o.target}`);if(l.length>10&&r.push(`- ... and ${l.length-10} more`),r.push(""),a.length>0){r.push(`**Neighbors** (${a.length}):`);for(let o of a.slice(0,20))r.push(`- [d=${o.depth}] \`${o.node.name}\` (${o.node.astType}) ${o.node.filePath}:${o.node.startLine}`);a.length>20&&r.push(`- ... and ${a.length-20} more`),r.push("");}return r.push(A("context",i,{})),F(r.join(`
47
47
  `),t,d)}async function H(e,t,n){let{pendingFiles:s,toolName:l,sync:a=false}=n;if(!e.id)return w(l,"Node not found.","Check the node ID or use `search` to find it.");let c=t.filter(r=>r.direction==="in"),i=t.filter(r=>r.direction==="out"),d=[];d.push(k(s,new Set([e.filePath]))??""),d.push(`**Node: \`${e.name}\`**
48
48
  `),d.push(`- ID: \`${e.id}\``),d.push(`- Kind: ${e.astType}`),d.push(`- Language: ${e.language}`),d.push(`- Location: ${e.filePath}:${e.startLine}-${e.endLine}`),d.push(`- Exported: ${e.isExported}`),e.modifiers.length>0&&d.push(`- Modifiers: ${e.modifiers.join(", ")}`),d.push(""),d.push(`**Edges** (incoming: ${c.length} / outgoing: ${i.length}):`);for(let r of c.slice(0,5))d.push(`- \u2190 [${r.relation}] ${r.source}`);for(let r of i.slice(0,5))d.push(`- \u2192 [${r.relation}] ${r.target}`);return t.length>10&&d.push(`- ... and ${t.length-10} more`),d.push(A("default",l,{})),F(d.join(`
@@ -55,8 +55,8 @@ ${j}`),c=l.lastIndexOf(`
55
55
  `);for(let d of n){i.push(`**\`${d.file}\`** \u2014 ${d.symbols.length} symbol${d.symbols.length===1?"":"s"}
56
56
  `);for(let r of d.symbols){let o=(r.source??"").trim()||"(source not included)",u=r.node.language;if(i.push("```"+u),i.push(`L${r.node.startLine}-L${r.node.endLine} ${r.node.name} (${r.node.astType}${r.node.modifiers.length>0?`, ${r.node.modifiers.join(" ")}`:""})`),i.push(""),i.push(o),i.push("```\n"),r.callers.length>0){i.push(`**Callers of \`${r.node.name}\` (${r.callers.length}):**`);for(let g of r.callers.slice(0,5))i.push(`- [${g.relation}] \`${g.name}\` ${g.filePath}:${g.startLine}`);r.callers.length>5&&i.push(`- ... and ${r.callers.length-5} more`),i.push("");}if(r.callees.length>0){i.push(`**Callees of \`${r.node.name}\` (${r.callees.length}):**`);for(let g of r.callees.slice(0,5))i.push(`- [${g.relation}] \`${g.name}\` ${g.filePath}:${g.startLine}`);r.callees.length>5&&i.push(`- ... and ${r.callees.length-5} more`),i.push("");}}}return i.push(`---
57
57
  `),i.push(A("context",a,{})),F(i.join(`
58
- `),t,c)}function Xe(e){let t=new Map;for(let n of e){let s=n.node.filePath,l=t.get(s);l?l.push(n):t.set(s,[n]);}return t}function w(e,t,n){return `**${e}**
58
+ `),t,c)}function Ve(e){let t=new Map;for(let n of e){let s=n.node.filePath,l=t.get(s);l?l.push(n):t.set(s,[n]);}return t}function w(e,t,n){return `**${e}**
59
59
 
60
60
  ${t}
61
61
 
62
- > **Tip:** ${n}`}async function F(e,t,n){let s={softLimit:t.softLimit,hardCeiling:t.hardCeiling,toolName:t.toolName,writeToDisk:n?false:t.writeToDisk};return (n?O(e,s):await D(e,s)).content}var Ze=utils.Log.create({service:"codebase.format.render"});async function et(e,t){if(e.length===0)return v([],t);let n=z(e);return v(n,t)}async function tt(e,t,n){if(t.length===0)return M(R(e),[],n);let s=[{depth:1,count:t.length,riskLabel:W(1),samples:t.slice(0,10).map(l=>({name:l.source.name,file:R(l.source).filePath,line:l.source.start_line??0,relation:l.relation}))}];return M(R(e),s,n)}async function nt(e,t,n,s,l){let a=R(e),c=t.map(r=>_(r,"in")),i=n.map(r=>_(r,"out")),d=s.map(r=>({node:R(r),depth:1}));return G({root:a,incoming:c,outgoing:i,neighbors:d},l)}async function rt(e,t){return q(e.callers,e.root,"callers",e.truncated,t)}async function ot(e,t){return q(e.callees,e.root,"callees",e.truncated,t)}async function st(e,t){let{renderKnowledgeStatus:n}=await import('@easbot/terminal');return n({packageName:"codebase",rootDir:e.workspaceDir,configPath:e.configPath??"",configExists:typeof e.configExists=="boolean"?e.configExists:false,dbPath:e.dbPath,dbExists:typeof e.dbExists=="boolean"?e.dbExists:true,dbSize:e.dbSize,indexState:e.indexState,schemaVersion:(()=>{let s=e.meta?.schema_version;return s&&Number.isFinite(Number.parseInt(s,10))?Number.parseInt(s,10):void 0})(),extractionVersion:e.extractionVersion,lastSyncAt:e.lastSync,vectorEnabled:typeof e.vectorEnabled=="boolean"?e.vectorEnabled:false,embeddingDims:typeof e.embeddingDims=="number"?e.embeddingDims:void 0,llm:e.llm??{initialized:false,capabilities:{}},healthy:e.healthy,dbStats:e.dbStats,extras:(()=>{let s={};if(e.isStale===true&&(s.stale="yes \u2014 reindex recommended"),typeof e.ftsAvailable=="boolean"&&(s.fts_available=e.ftsAvailable?"yes":"no"),e.meta&&typeof e.meta=="object")for(let[l,a]of Object.entries(e.meta))a!=null&&(s[`meta/${l}`]=String(a));return Object.keys(s).length>0?s:void 0})()})}async function it(e,t,n){if(!e)return H(K(),[],n);let s=R(e),l=t.map(a=>{let c=a.target===e.id?"in":"out";return _(a,c)});return H(s,l,n)}async function at(e,t){let n={query:e.query,totalHits:e.totalHits,entryPoints:e.entryPoints.map(s=>({file:s.file,symbols:s.symbols.map(l=>({node:R(l.node),source:l.node.text??"",callers:l.callers.map(a=>({name:a.name,filePath:a.filePath,startLine:a.startLine,relation:a.relation})),callees:l.callees.map(a=>({name:a.name,filePath:a.filePath,startLine:a.startLine,relation:a.relation}))}))}))};return ge(n,t)}Ze.debug("format/render.ts loaded");exports.A=nt;exports.B=rt;exports.C=ot;exports.D=st;exports.E=it;exports.F=at;exports.a=re;exports.b=Ie;exports.c=Te;exports.d=_e;exports.e=we;exports.f=Fe;exports.g=Ae;exports.h=De;exports.i=Oe;exports.j=He;exports.k=R;exports.l=_;exports.m=z;exports.n=K;exports.o=j;exports.p=Qe;exports.q=D;exports.r=O;exports.s=v;exports.t=M;exports.u=W;exports.v=G;exports.w=H;exports.x=q;exports.y=et;exports.z=tt;
62
+ > **Tip:** ${n}`}async function F(e,t,n){let s={softLimit:t.softLimit,hardCeiling:t.hardCeiling,toolName:t.toolName,writeToDisk:n?false:t.writeToDisk};return (n?O(e,s):await D(e,s)).content}var Ze=utils.Log.create({service:"codebase.format.render"});async function et(e,t){if(e.length===0)return v([],t);let n=z(e);return v(n,t)}async function tt(e,t,n){if(t.length===0)return M(R(e),[],n);let s=[{depth:1,count:t.length,riskLabel:G(1),samples:t.slice(0,10).map(l=>({name:l.source.name,file:R(l.source).filePath,line:l.source.start_line??0,relation:l.relation}))}];return M(R(e),s,n)}async function nt(e,t,n,s,l){let a=R(e),c=t.map(r=>_(r,"in")),i=n.map(r=>_(r,"out")),d=s.map(r=>({node:R(r),depth:1}));return Q({root:a,incoming:c,outgoing:i,neighbors:d},l)}async function rt(e,t){return q(e.callers,e.root,"callers",e.truncated,t)}async function ot(e,t){return q(e.callees,e.root,"callees",e.truncated,t)}async function st(e,t){let{renderKnowledgeStatus:n}=await import('@easbot/terminal');return n({packageName:"codebase",rootDir:e.workspaceDir,configPath:e.configPath??"",configExists:typeof e.configExists=="boolean"?e.configExists:false,dbPath:e.dbPath,dbExists:typeof e.dbExists=="boolean"?e.dbExists:true,dbSize:e.dbSize,indexState:e.indexState,schemaVersion:(()=>{let s=e.meta?.schema_version;return s&&Number.isFinite(Number.parseInt(s,10))?Number.parseInt(s,10):void 0})(),extractionVersion:e.extractionVersion,lastSyncAt:e.lastSync,vectorEnabled:typeof e.vectorEnabled=="boolean"?e.vectorEnabled:false,embeddingDims:typeof e.embeddingDims=="number"?e.embeddingDims:void 0,llm:e.llm??{initialized:false,capabilities:{}},healthy:e.healthy,dbStats:e.dbStats,extras:(()=>{let s={};if(e.isStale===true&&(s.stale="yes \u2014 reindex recommended"),typeof e.ftsAvailable=="boolean"&&(s.fts_available=e.ftsAvailable?"yes":"no"),e.meta&&typeof e.meta=="object")for(let[l,a]of Object.entries(e.meta))a!=null&&(s[`meta/${l}`]=String(a));return Object.keys(s).length>0?s:void 0})()})}async function it(e,t,n){if(!e)return H(K(),[],n);let s=R(e),l=t.map(a=>{let c=a.target===e.id?"in":"out";return _(a,c)});return H(s,l,n)}async function at(e,t){let n={query:e.query,totalHits:e.totalHits,entryPoints:e.entryPoints.map(s=>({file:s.file,symbols:s.symbols.map(l=>({node:R(l.node),source:l.node.text??"",callers:l.callers.map(a=>({name:a.name,filePath:a.filePath,startLine:a.startLine,relation:a.relation})),callees:l.callees.map(a=>({name:a.name,filePath:a.filePath,startLine:a.startLine,relation:a.relation}))}))}))};return ge(n,t)}Ze.debug("format/render.ts loaded");exports.A=nt;exports.B=rt;exports.C=ot;exports.D=st;exports.E=it;exports.F=at;exports.a=oe;exports.b=Ie;exports.c=Te;exports.d=_e;exports.e=we;exports.f=Fe;exports.g=Ae;exports.h=De;exports.i=Oe;exports.j=He;exports.k=R;exports.l=_;exports.m=z;exports.n=K;exports.o=W;exports.p=Qe;exports.q=D;exports.r=O;exports.s=v;exports.t=M;exports.u=G;exports.v=Q;exports.w=H;exports.x=q;exports.y=et;exports.z=tt;