@easbot/codebase 0.3.2 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +30 -0
  2. package/dist/chunks/chunk-7XCIIOM6.cjs +1 -0
  3. package/dist/chunks/chunk-ABKFCPSL.cjs +234 -0
  4. package/dist/chunks/chunk-B35QBUQP.cjs +34 -0
  5. package/dist/chunks/chunk-BL4XMOO2.cjs +43 -0
  6. package/dist/chunks/chunk-EVDJNYI2.cjs +1 -0
  7. package/dist/chunks/chunk-G3IYU6TZ.mjs +1 -0
  8. package/dist/chunks/chunk-LBEWQNER.mjs +234 -0
  9. package/dist/chunks/chunk-O3Z5ORQ3.mjs +43 -0
  10. package/dist/chunks/chunk-PSPE6FME.mjs +34 -0
  11. package/dist/chunks/chunk-RLZHDTHY.cjs +154 -0
  12. package/dist/chunks/chunk-SV4WN2DV.mjs +2 -0
  13. package/dist/chunks/chunk-TS4OAYIJ.cjs +1 -0
  14. package/dist/chunks/chunk-UEILXBZB.mjs +1 -0
  15. package/dist/chunks/chunk-UTKA3WG3.mjs +1 -0
  16. package/dist/chunks/chunk-YOFBT3V6.cjs +2 -0
  17. package/dist/chunks/chunk-Z4Y3VCYS.mjs +154 -0
  18. package/dist/chunks/code-base-ONPUU5A3.cjs +1 -0
  19. package/dist/chunks/code-base-XJXVJ35Z.mjs +1 -0
  20. package/dist/chunks/database-manager-DRLNOQ6C.cjs +1 -0
  21. package/dist/chunks/database-manager-WOYUSWKD.mjs +1 -0
  22. package/dist/chunks/file-watcher-5WEDJY6M.mjs +1 -0
  23. package/dist/chunks/file-watcher-LZZUEGMY.cjs +1 -0
  24. package/dist/chunks/stdio-server-3DPRM3WQ.cjs +47 -0
  25. package/dist/chunks/stdio-server-3HFZJ5G2.mjs +47 -0
  26. package/dist/chunks/sync-D5GNVNM2.mjs +1 -0
  27. package/dist/chunks/sync-IYOM3Y62.cjs +1 -0
  28. package/dist/cli.cjs +3 -0
  29. package/dist/cli.d.cts +1 -0
  30. package/dist/cli.d.ts +1 -0
  31. package/dist/cli.mjs +3 -0
  32. package/dist/index.cjs +1 -108
  33. package/dist/index.d.cts +494 -21
  34. package/dist/index.d.ts +494 -21
  35. package/dist/index.mjs +1 -108
  36. package/package.json +13 -6
package/dist/index.cjs CHANGED
@@ -1,108 +1 @@
1
- 'use strict';var q=require('path'),xdgBasedir=require('xdg-basedir'),types=require('@easbot/types'),se=require('fs'),utils=require('@easbot/utils'),xe=require('better-sqlite3'),url=require('url'),Pe=require('fs/promises'),crypto=require('crypto'),Oe=require('fast-glob');var _documentCurrentScript=typeof document!=='undefined'?document.currentScript:null;function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var q__default=/*#__PURE__*/_interopDefault(q);var se__default=/*#__PURE__*/_interopDefault(se);var xe__default=/*#__PURE__*/_interopDefault(xe);var Pe__default=/*#__PURE__*/_interopDefault(Pe);var Oe__default=/*#__PURE__*/_interopDefault(Oe);var fe=Object.defineProperty;var ye=(f,e,t)=>e in f?fe(f,e,{enumerable:true,configurable:true,writable:true,value:t}):f[e]=t;var u=(f,e,t)=>ye(f,typeof e!="symbol"?e+"":e,t);var Ee=()=>typeof document>"u"?new URL(`file:${__filename}`).href:document.currentScript&&document.currentScript.tagName.toUpperCase()==="SCRIPT"?document.currentScript.src:new URL("main.js",document.baseURI).href,S=Ee();var re={".ts":"ts",".tsx":"tsx",".js":"js",".jsx":"js",".mjs":"js",".cjs":"js",".py":"py",".rs":"rs",".go":"go",".c":"c",".h":"c",".cpp":"cpp",".cc":"cpp",".cxx":"cpp",".hpp":"cpp",".cs":"csharp",".java":"java",".scala":"scala",".rb":"ruby",".php":"php",".zig":"zig"};var k=class f extends Error{constructor(t,r,n){super(t);u(this,"name","ParserError");u(this,"filePath");u(this,"cause");this.filePath=r,this.cause=n,Object.setPrototypeOf(this,f.prototype);}toString(){let t=this.cause?` (caused by: ${this.cause.message})`:"";return `ParserError: ${this.message} at ${this.filePath}${t}`}toJSON(){return {name:this.name,message:this.message,filePath:this.filePath,cause:this.cause?.message}}},F=class f extends Error{constructor(t,r,n){super(t);u(this,"name","DatabaseError");u(this,"operation");u(this,"cause");this.operation=r,this.cause=n,Object.setPrototypeOf(this,f.prototype);}toString(){let t=this.cause?` (caused by: ${this.cause.message})`:"";return `DatabaseError: ${this.message} during ${this.operation}${t}`}toJSON(){return {name:this.name,message:this.message,operation:this.operation,cause:this.cause?.message}}},X=class f extends Error{constructor(t,r,n){super(t);u(this,"name","FileSystemError");u(this,"filePath");u(this,"cause");this.filePath=r,this.cause=n,Object.setPrototypeOf(this,f.prototype);}toString(){let t=this.cause?` (caused by: ${this.cause.message})`:"";return `FileSystemError: ${this.message} at ${this.filePath}${t}`}toJSON(){return {name:this.name,message:this.message,filePath:this.filePath,cause:this.cause?.message}}},Q=class f extends Error{constructor(t,r){super(t);u(this,"name","SchemaError");u(this,"missing");this.missing=r,Object.setPrototypeOf(this,f.prototype);}toString(){let t=this.missing?` (missing: ${this.missing.join(", ")})`:"";return `SchemaError: ${this.message}${t}`}toJSON(){return {name:this.name,message:this.message,missing:this.missing}}},z=class f extends Error{constructor(t,r){super(t);u(this,"name","ConfigError");u(this,"field");this.field=r,Object.setPrototypeOf(this,f.prototype);}toString(){let t=this.field?` (field: ${this.field})`:"";return `ConfigError: ${this.message}${t}`}toJSON(){return {name:this.name,message:this.message,field:this.field}}},G=class f extends Error{constructor(t,r,n){super(t);u(this,"name","IndexError");u(this,"filePath");u(this,"cause");this.filePath=r,this.cause=n,Object.setPrototypeOf(this,f.prototype);}toString(){let t=[this.message];return this.filePath&&t.push(`at ${this.filePath}`),this.cause&&t.push(`(caused by: ${this.cause.message})`),`IndexError: ${t.join(" ")}`}toJSON(){return {name:this.name,message:this.message,filePath:this.filePath,cause:this.cause?.message}}},H=class f extends Error{constructor(t,r,n){super(t);u(this,"name","QueryError");u(this,"params");u(this,"cause");this.params=r,this.cause=n,Object.setPrototypeOf(this,f.prototype);}toString(){let t=this.params?` (params: ${JSON.stringify(this.params)})`:"",r=this.cause?` (caused by: ${this.cause.message})`:"";return `QueryError: ${this.message}${t}${r}`}toJSON(){return {name:this.name,message:this.message,params:this.params,cause:this.cause?.message}}},V=class f extends Error{constructor(t,r){super(`Unsupported language: ${t}`);u(this,"name","UnsupportedLanguageError");u(this,"extension");u(this,"filePath");this.extension=t,this.filePath=r,Object.setPrototypeOf(this,f.prototype);}toString(){return `UnsupportedLanguageError: ${this.extension} at ${this.filePath}`}toJSON(){return {name:this.name,message:this.message,extension:this.extension,filePath:this.filePath}}};var w=utils.Filesystem.normalize,T=utils.Log.create({service:"codebase-database"}),$=class{constructor(e){u(this,"db");u(this,"dbPath");u(this,"closed",false);u(this,"ftsAvailable",false);this.dbPath=w(e),this.db=this.openDatabase(),this.ensureSchema(),this.ftsAvailable=this.checkFtsAvailability();}openDatabase(){let e=q__default.default.dirname(this.dbPath);se__default.default.existsSync(e)||se__default.default.mkdirSync(e,{recursive:true});let t=new xe__default.default(this.dbPath);return t.pragma("journal_mode = WAL"),t.pragma("synchronous = NORMAL"),t.pragma("busy_timeout = 5000"),t.pragma("cache_size = -64000"),t.pragma("foreign_keys = ON"),t}ensureSchema(){let e=this.db;try{e.exec(`
2
- CREATE TABLE IF NOT EXISTS nodes (
3
- id TEXT PRIMARY KEY,
4
- name TEXT NOT NULL,
5
- ast_type TEXT NOT NULL,
6
- language TEXT NOT NULL,
7
- file_path TEXT NOT NULL,
8
- start_line INTEGER,
9
- start_col INTEGER,
10
- end_line INTEGER,
11
- end_col INTEGER,
12
- text TEXT,
13
- created_at DATETIME DEFAULT CURRENT_TIMESTAMP
14
- )
15
- `),e.exec("CREATE INDEX IF NOT EXISTS idx_nodes_file_path ON nodes(file_path)"),e.exec("CREATE INDEX IF NOT EXISTS idx_nodes_ast_type ON nodes(ast_type)"),e.exec("CREATE INDEX IF NOT EXISTS idx_nodes_name ON nodes(name)"),e.exec("CREATE INDEX IF NOT EXISTS idx_nodes_language ON nodes(language)"),e.exec(`
16
- CREATE TABLE IF NOT EXISTS edges (
17
- id TEXT PRIMARY KEY,
18
- source TEXT NOT NULL,
19
- target TEXT NOT NULL,
20
- relation TEXT NOT NULL,
21
- created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
22
- FOREIGN KEY (source) REFERENCES nodes(id) ON DELETE CASCADE,
23
- FOREIGN KEY (target) REFERENCES nodes(id) ON DELETE CASCADE
24
- )
25
- `),e.exec("CREATE INDEX IF NOT EXISTS idx_edges_source ON edges(source)"),e.exec("CREATE INDEX IF NOT EXISTS idx_edges_target ON edges(target)"),e.exec("CREATE INDEX IF NOT EXISTS idx_edges_relation ON edges(relation)"),e.exec(`
26
- CREATE TABLE IF NOT EXISTS file_hashes (
27
- file_path TEXT PRIMARY KEY,
28
- content_hash TEXT NOT NULL,
29
- last_modified DATETIME DEFAULT CURRENT_TIMESTAMP
30
- )
31
- `),e.exec(`
32
- CREATE VIRTUAL TABLE IF NOT EXISTS nodes_fts USING fts5(
33
- id,
34
- name,
35
- ast_type,
36
- language,
37
- file_path,
38
- text,
39
- tokenize='unicode61'
40
- )
41
- `),e.exec(`
42
- CREATE TABLE IF NOT EXISTS meta (
43
- key TEXT PRIMARY KEY,
44
- value TEXT
45
- )
46
- `),e.exec(`
47
- CREATE TABLE IF NOT EXISTS embedding_cache (
48
- content_hash TEXT PRIMARY KEY,
49
- embedding BLOB NOT NULL
50
- )
51
- `),e.exec(`
52
- CREATE TABLE IF NOT EXISTS node_embeddings (
53
- node_id TEXT PRIMARY KEY,
54
- embedding_text TEXT NOT NULL,
55
- embedding BLOB NOT NULL,
56
- FOREIGN KEY (node_id) REFERENCES nodes(id) ON DELETE CASCADE
57
- )
58
- `);let t=[["version","1.0.0"],["createdAt",new Date().toISOString()]],r=e.prepare("INSERT OR IGNORE INTO meta (key, value) VALUES (?, ?)");for(let[n,s]of t)r.run(n,s);}catch(t){throw new Q("Failed to create database schema",t instanceof Error?[t.message]:[String(t)])}}checkFtsAvailability(){try{return this.db.exec("SELECT * FROM nodes_fts WHERE nodes_fts MATCH 'test' LIMIT 1"),!0}catch{return false}}isFtsAvailable(){return this.ftsAvailable}insertNode(e){let t={...e,file_path:w(e.file_path)};this.db.prepare(`
59
- INSERT OR REPLACE INTO nodes (id, name, ast_type, language, file_path, start_line, start_col, end_line, end_col, text, created_at)
60
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
61
- `).run(t.id,t.name,t.ast_type,t.language,t.file_path,t.start_line,t.start_col,t.end_line,t.end_col,t.text,t.created_at),this.ftsAvailable&&this.updateFtsNode(t);}insertNodes(e){if(e.length===0)return;let t=e.map(s=>({...s,file_path:w(s.file_path)})),r=this.db.prepare(`
62
- INSERT OR REPLACE INTO nodes (id, name, ast_type, language, file_path, start_line, start_col, end_line, end_col, text, created_at)
63
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
64
- `);this.db.transaction(s=>{for(let i of s)r.run(i.id,i.name,i.ast_type,i.language,i.file_path,i.start_line,i.start_col,i.end_line,i.end_col,i.text,i.created_at);this.ftsAvailable&&this.updateFtsNodesInternal(s);})(t);}updateFtsNodesInternal(e){let t=this.db.prepare("DELETE FROM nodes_fts WHERE rowid = ?"),r=this.db.prepare("SELECT rowid FROM nodes_fts WHERE id = ?"),n=this.db.prepare("INSERT INTO nodes_fts(id, name, ast_type, language, file_path, text) VALUES (?, ?, ?, ?, ?, ?)");for(let s of e)try{let i=r.get(s.id);i&&t.run(i.rowid),n.run(s.id,s.name,s.ast_type,s.language,s.file_path,s.text);}catch(i){T.warn("FTS update failed for node",{nodeId:s.id,error:String(i)});}}updateFtsNode(e){try{let t=this.db.prepare("SELECT rowid FROM nodes_fts WHERE id = ?").get(e.id);t&&this.db.prepare("DELETE FROM nodes_fts WHERE rowid = ?").run(t.rowid),this.db.prepare("INSERT INTO nodes_fts(id, name, ast_type, language, file_path, text) VALUES (?, ?, ?, ?, ?, ?)").run(e.id,e.name,e.ast_type,e.language,e.file_path,e.text);}catch(t){T.warn("FTS update failed for node",{nodeId:e.id,error:String(t)});}}updateFtsNodes(e){let t=this.db.prepare("DELETE FROM nodes_fts WHERE rowid = ?"),r=this.db.prepare("SELECT rowid FROM nodes_fts WHERE id = ?"),n=this.db.prepare("INSERT INTO nodes_fts(id, name, ast_type, language, file_path, text) VALUES (?, ?, ?, ?, ?, ?)");this.db.transaction(i=>{for(let o of i)try{let a=r.get(o.id);a&&t.run(a.rowid),n.run(o.id,o.name,o.ast_type,o.language,o.file_path,o.text);}catch(a){T.warn("FTS update failed for node",{nodeId:o.id,error:String(a)});}})(e);}insertEdge(e){this.db.prepare(`
65
- INSERT OR REPLACE INTO edges (id, source, target, relation, created_at)
66
- VALUES (?, ?, ?, ?, ?)
67
- `).run(e.id,e.source,e.target,e.relation,e.created_at);}insertEdges(e){if(e.length===0)return;let t=this.db.prepare(`
68
- INSERT OR REPLACE INTO edges (id, source, target, relation, created_at)
69
- VALUES (?, ?, ?, ?, ?)
70
- `);this.db.transaction(n=>{for(let s of n)t.run(s.id,s.source,s.target,s.relation,s.created_at);})(e);}queryNodes(e){let t=[],r=[];e.filePath&&(t.push("file_path LIKE ?"),r.push(`%${w(e.filePath)}%`)),e.astType&&(t.push("ast_type = ?"),r.push(e.astType)),e.name&&(t.push("name LIKE ?"),r.push(`%${e.name}%`)),e.language&&(t.push("language = ?"),r.push(e.language));let n="SELECT * FROM nodes";t.length>0&&(n+=` WHERE ${t.join(" AND ")}`),n+=" ORDER BY file_path, start_line",e.limit&&(n+=" LIMIT ?",r.push(e.limit)),e.offset&&(n+=" OFFSET ?",r.push(e.offset));try{return this.db.prepare(n).all(...r)}catch(s){throw new F("Failed to query nodes","queryNodes",s instanceof Error?s:new Error(String(s)))}}queryEdges(e){let t=[],r=[];e.source&&(t.push("source = ?"),r.push(e.source)),e.target&&(t.push("target = ?"),r.push(e.target)),e.relation&&(t.push("relation = ?"),r.push(e.relation));let n="SELECT * FROM edges";t.length>0&&(n+=` WHERE ${t.join(" AND ")}`),n+=" ORDER BY created_at DESC",e.limit&&(n+=" LIMIT ?",r.push(e.limit)),e.offset&&(n+=" OFFSET ?",r.push(e.offset));try{return this.db.prepare(n).all(...r)}catch(s){throw new F("Failed to query edges","queryEdges",s instanceof Error?s:new Error(String(s)))}}queryAll(e,t){try{let r=this.db.prepare(e);return t?r.all(...t):r.all()}catch(r){throw new F("Failed to execute query","queryAll",r instanceof Error?r:new Error(String(r)))}}searchNodesFts(e,t=20){if(T.debug("searchNodesFts start",{query:e,limit:t,ftsAvailable:this.ftsAvailable}),!this.ftsAvailable)return T.debug("searchNodesFts skip - FTS not available"),[];try{let r=e.split(/\s+/).map(o=>`${o}*`).join(" ");T.debug("searchNodesFts query",{ftsQuery:r});let i=this.db.prepare(`
71
- SELECT
72
- nodes_fts.id,
73
- nodes_fts.name,
74
- nodes_fts.ast_type,
75
- nodes_fts.language,
76
- nodes_fts.file_path,
77
- nodes_fts.text,
78
- nodes.start_line,
79
- nodes.start_col,
80
- nodes.end_line,
81
- nodes.end_col,
82
- bm25(nodes_fts) as score
83
- FROM nodes_fts
84
- JOIN nodes ON nodes.id = nodes_fts.id
85
- WHERE nodes_fts.text MATCH ?
86
- ORDER BY score DESC
87
- LIMIT ?
88
- `).all(r,t);return T.debug("searchNodesFts done",{resultCount:i.length}),i}catch(r){return T.warn("searchNodesFts failed",{error:String(r)}),[]}}deleteNodesByFile(e){let t=w(e);if(this.ftsAvailable)try{let n=this.db.prepare("SELECT rowid FROM nodes_fts WHERE file_path = ?").all(t);for(let s of n)this.db.prepare("DELETE FROM nodes_fts WHERE rowid = ?").run(s.rowid);}catch(n){T.warn("FTS delete failed for file",{filePath:t,error:String(n)});}return this.db.prepare("DELETE FROM nodes WHERE file_path = ?").run(t).changes}deleteEdgesByFile(e){let t=w(e);return this.db.prepare(`
89
- DELETE FROM edges
90
- WHERE source IN (SELECT id FROM nodes WHERE file_path = ?)
91
- OR target IN (SELECT id FROM nodes WHERE file_path = ?)
92
- `).run(t,t).changes}getFileHash(e){return this.db.prepare("SELECT content_hash FROM file_hashes WHERE file_path = ?").get(w(e))?.content_hash??null}setFileHash(e,t){this.db.prepare(`
93
- INSERT OR REPLACE INTO file_hashes (file_path, content_hash, last_modified)
94
- VALUES (?, ?, ?)
95
- `).run(w(e),t,new Date().toISOString());}deleteFileHash(e){this.db.prepare("DELETE FROM file_hashes WHERE file_path = ?").run(w(e));}getAllFileHashes(){return this.db.prepare("SELECT * FROM file_hashes").all()}getStatus(){let e=this.db.prepare("SELECT COUNT(*) as c FROM nodes").get(),t=this.db.prepare("SELECT COUNT(*) as c FROM edges").get(),r=this.db.prepare("SELECT COUNT(*) as c FROM file_hashes").get(),n=this.db.prepare("SELECT key, value FROM meta").all(),s={};for(let i of n)s[i.key]=i.value;return {nodeCount:e?.c??0,edgeCount:t?.c??0,indexedFiles:r?.c??0,dbPath:this.dbPath,meta:s}}setLastSync(){this.db.prepare(`
96
- INSERT OR REPLACE INTO meta (key, value)
97
- VALUES ('lastSync', ?)
98
- `).run(new Date().toISOString());}getNodeCount(){return this.db.prepare("SELECT COUNT(*) as c FROM nodes").get()?.c??0}getEdgeCount(){return this.db.prepare("SELECT COUNT(*) as c FROM edges").get()?.c??0}getFileCount(){return this.db.prepare("SELECT COUNT(*) as c FROM file_hashes").get()?.c??0}getNodeById(e){return this.db.prepare("SELECT * FROM nodes WHERE id = ?").get(e)??null}getEdgeById(e){return this.db.prepare("SELECT * FROM edges WHERE id = ?").get(e)??null}clearAll(){this.db.exec("DELETE FROM nodes"),this.db.exec("DELETE FROM edges"),this.db.exec("DELETE FROM file_hashes"),this.db.exec("DELETE FROM meta"),this.db.exec("DELETE FROM node_embeddings"),this.db.exec("DELETE FROM embedding_cache"),this.ftsAvailable&&this.db.exec("DELETE FROM nodes_fts");try{this.db.exec("DELETE FROM sqlite_sequence WHERE name IN ('nodes', 'edges', 'file_hashes', 'meta')");}catch{}}getCachedEmbedding(e){let r=this.db.prepare(`
99
- SELECT embedding FROM embedding_cache WHERE content_hash = ?
100
- `).get(e);return r?new Float32Array(r.embedding.buffer,r.embedding.byteOffset,r.embedding.length/4):null}getVectorDims(){let e=this.db.prepare("SELECT value FROM meta WHERE key = ?").get("vectorDims");return e?parseInt(e.value,10):void 0}ensureVectorDims(e){this.db.prepare("SELECT value FROM meta WHERE key = ?").get("vectorDims")||this.db.prepare("INSERT OR IGNORE INTO meta (key, value) VALUES (?, ?)").run("vectorDims",String(e));}cacheEmbedding(e,t){if(this.db.prepare("SELECT embedding FROM embedding_cache WHERE content_hash = ?").get(e))return;this.ensureVectorDims(t.length),this.db.prepare(`
101
- INSERT OR REPLACE INTO embedding_cache (content_hash, embedding)
102
- VALUES (?, ?)
103
- `).run(e,t);}getAllNodeEmbeddings(){return this.db.prepare("SELECT node_id, embedding FROM node_embeddings").all()}storeNodeEmbeddings(e){if(e.length===0)return;this.ensureVectorDims(e[0].embedding.length);let t=this.db.prepare(`
104
- INSERT OR REPLACE INTO node_embeddings (node_id, embedding_text, embedding)
105
- VALUES (?, ?, ?)
106
- `);this.db.transaction(n=>{for(let s of n)try{t.run(s.nodeId,s.embeddingText,s.embedding);}catch(i){T.warn("Failed to store embedding for node",{nodeId:s.nodeId,error:String(i)});}})(e);}initialize(){if(this.closed)throw new F("Cannot initialize closed database","initialize")}close(){if(!this.closed){this.closed=true;try{this.db.close();}catch(e){T.warn("Database close error",{error:String(e)});}}}isClosed(){return this.closed}getDbPath(){return this.dbPath}transaction(e){return this.db.transaction(e)()}getMeta(e){if(!this.db)throw new Error("Database not initialized");return this.db.prepare("SELECT value FROM meta WHERE key = ?").get(e)?.value??null}setMeta(e,t){if(!this.db)throw new Error("Database not initialized");this.db.prepare("INSERT OR REPLACE INTO meta (key, value) VALUES (?, ?)").run(e,t);}};var ne=utils.Log.create({service:"codebase-parser"}),Ce={js:{package:"tree-sitter-javascript",wasmFile:"tree-sitter-javascript.wasm"},ts:{package:"tree-sitter-typescript",wasmFile:"tree-sitter-typescript.wasm"},tsx:{package:"tree-sitter-typescript",wasmFile:"tree-sitter-tsx.wasm"},py:{package:"tree-sitter-python",wasmFile:"tree-sitter-python.wasm"},rs:{package:"tree-sitter-rust",wasmFile:"tree-sitter-rust.wasm"},go:{package:"tree-sitter-go",wasmFile:"tree-sitter-go.wasm"},c:{package:"tree-sitter-c",wasmFile:"tree-sitter-c.wasm"},cpp:{package:"tree-sitter-cpp",wasmFile:"tree-sitter-cpp.wasm"},csharp:{package:"tree-sitter-c-sharp",wasmFile:"tree-sitter-c_sharp.wasm"},java:{package:"tree-sitter-java",wasmFile:"tree-sitter-java.wasm"},ruby:{package:"tree-sitter-ruby",wasmFile:"tree-sitter-ruby.wasm"},php:{package:"tree-sitter-php",wasmFile:"tree-sitter-php.wasm"},scala:{package:"tree-sitter-scala",wasmFile:"tree-sitter-scala.wasm"}};function we(){return typeof ({ url: (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)) })<"u"&&S?q__default.default.dirname(url.fileURLToPath(S)):typeof __dirname<"u"?__dirname:process.cwd()}function ve(f,e){let t=we(),r=t;for(let n=0;n<10;n++){let s=q__default.default.join(r,"node_modules",f,e);if(utils.Filesystem.stat(s)!==void 0)return s;let i=q__default.default.dirname(r);if(i===r)break;r=i;}return q__default.default.join(t,"node_modules",f,e)}var L=class{constructor(){u(this,"parsers",new Map);u(this,"initialized",false);u(this,"initPromise",null);}async initialize(){if(!this.initialized){if(this.initPromise){await this.initPromise;return}this.initPromise=this.doInitialize(),await this.initPromise,this.initPromise=null;}}async doInitialize(){let e=await import('web-tree-sitter'),t=e.default?.default||e.default?.Parser||e.default||e.Parser,r=t?.Language||e.Language||e.default?.Language;if(typeof t?.init=="function"&&await t.init(),typeof t!="function")throw new Error(`web-tree-sitter did not export a Parser constructor. Got: ${typeof t}`);if(typeof r!="function")throw new Error(`web-tree-sitter did not export a Language class. Got: ${typeof r}`);let n=["ts","tsx","js","py","rs","go","c","cpp","csharp","java","ruby","php","scala"],s=await Promise.allSettled(n.map(async i=>{try{let o=Ce[i];if(!o)return ne.warn("No WASM config for language",{lang:i}),null;let a=ve(o.package,o.wasmFile),d=await r.load(a),g=new t;return g.setLanguage(d),{lang:i,parser:g,language:d}}catch(o){return ne.warn("Failed to load parser",{lang:i,error:String(o)}),null}}));for(let i of s)if(i.status==="fulfilled"&&i.value){let{lang:o,parser:a,language:d}=i.value;this.parsers.set(o,{parser:a,language:d});}this.initialized=true;}getParser(e){return this.parsers.get(e)?.parser??null}getLanguage(e){return this.parsers.get(e)?.language??null}detectLanguage(e){let t=q__default.default.extname(e).toLowerCase();return re[t]??null}parse(e,t){if(!this.initialized)throw new k("Parser not initialized","");let r=this.parsers.get(t);if(!r)throw new k(`No parser available for language: ${t}`,"");try{return r.parser.parse(e)}catch(n){throw new k("Failed to parse code","",n instanceof Error?n:new Error(String(n)))}}parseFile(e,t){let r=this.detectLanguage(e);if(!r)throw new V(q__default.default.extname(e),e);return this.parse(t,r)}isLanguageSupported(e){return this.parsers.has(e)}getSupportedLanguages(){return Array.from(this.parsers.keys())}isInitialized(){return this.initialized}getStatus(){let e={},t=["ts","js","py","rs","go","c","cpp","csharp","java","scala","ruby","php","zig"];for(let r of t)e[r]=this.parsers.has(r);return e}dispose(){this.parsers.clear(),this.initialized=false;}},P=null;async function ie(){return P||(P=new L,await P.initialize()),P}function ae(){P&&(P.dispose(),P=null);}var Re={class_declaration:["class_item"],function_definition:["function_item"],variable_declaration:["lexical_declaration","variable_declarator","assignment"],import_declaration:["import_statement","import_clause","use_declaration","include_directive"],enum_declaration:["enum_item"],struct_declaration:["struct_item","struct_definition"],module_declaration:["namespace_declaration"],constant_declaration:["const_item"]},Fe=new Set(["class_declaration","function_declaration","method_definition","interface_declaration","type_alias_declaration","enum_declaration","variable_declaration","lexical_declaration","import_declaration","import_statement","export_statement","function_expression","arrow_function","class_definition","function_definition","import_statement","import_from_statement","struct_item","enum_item","function_item","impl_item","trait_item","use_declaration","mod_item","const_item","type_declaration","function_declaration","method_declaration","import_declaration","function_definition","class_specifier","struct_specifier","enum_specifier","preproc_include","class_declaration","interface_declaration","enum_declaration","method_declaration","import_declaration","class_declaration","interface_declaration","struct_declaration","enum_declaration","method_declaration","using_directive","class","module","method","method_definition","class_declaration","function_definition","method_declaration","use_declaration","class_definition","trait_definition","object_definition","function_definition","function_declaration","struct_declaration","enum_declaration"]),O=class{extractNodes(e,t,r,n){let s=[],i=t.split(`
107
- `);return this.walkTree(e.rootNode,s,r,n,i),s}walkTree(e,t,r,n,s,i){if(Fe.has(e.type)){let o=this.extractNode(e,r,n,s,i);o&&(t.push(o),i=o.name?this.generateNodeId(o):i);}for(let o=0;o<e.childCount;o++){let a=e.children[o];a&&this.walkTree(a,t,r,n,s,i);}}extractNode(e,t,r,n,s){let i=this.getNodeName(e);if(!i)return null;let o=e.startPosition,a=e.endPosition,d=this.getNodeText(e,n);return {name:i,ast_type:this.normalizeAstType(e.type),language:t,file_path:r,start_line:o.row,start_col:o.column,end_line:a.row,end_col:a.column,text:d,parent_id:s}}getNodeName(e){switch(e.type){case "class_declaration":case "class_definition":case "interface_declaration":case "trait_item":case "struct_item":case "enum_item":case "enum_declaration":case "type_alias_declaration":return this.findNameInChildren(e,["name","identifier","type_identifier","type_name"]);case "function_declaration":case "function_definition":case "function_item":case "method_definition":case "method_declaration":return this.findNameInChildren(e,["name","identifier","property_identifier","function_name"]);case "variable_declaration":case "lexical_declaration":case "variable_declarator":return this.findNameInChildren(e,["name","identifier","variable_name"])??this.findNameInGrandchildren(e,["variable_declarator"],["name","identifier"]);case "import_declaration":case "import_statement":case "use_declaration":return this.extractImportName(e);case "const_item":case "constant_declaration":return this.findNameInChildren(e,["name","identifier"]);default:return this.findNameInChildren(e,["name","identifier"])}}findNameInChildren(e,t){for(let r of t){let n=e.childForFieldName?.(r);if(n?.text)return n.text}for(let r of e.children)if(r.type==="identifier"||r.type==="type_identifier"||r.type==="property_identifier"||r.type==="field_identifier"||r.type==="name")return r.text;return null}findNameInGrandchildren(e,t,r){for(let n of e.children)if(t.includes(n.type)){let s=this.findNameInChildren(n,r);if(s)return s}return null}extractImportName(e){for(let t of e.children)if(t.type==="string"||t.type==="string_literal"||t.type==="module_name"||t.type==="identifier"){let r=t.text;return (r.startsWith('"')||r.startsWith("'"))&&(r=r.slice(1,-1)),r}return e.text.slice(0,100)}normalizeAstType(e){for(let[t,r]of Object.entries(Re))if(r.includes(e))return t;return e}getNodeText(e,t){let r=e.startPosition.row,n=e.endPosition.row;return r===n?t[r]?.trim()??"":t.slice(r,n+1).join(`
108
- `)}generateNodeId(e){return `${e.language}:${e.file_path}:${e.ast_type}:${e.name}`}};function oe(){return new O}var M=class{extractEdges(e,t,r,n){let s=[],i=new Map;for(let o of t){let a=this.generateNodeId(o);i.set(a,o);}return this.extractContainsEdges(t,s),this.extractCallEdges(e.rootNode,t,s,r,n,i),this.extractInheritanceEdges(e.rootNode,t,s,r,n,i),this.extractImportEdges(e.rootNode,t,s,r,n),this.extractTypeReferences(e.rootNode,t,s,r,n,i),this.extractParameterEdges(e.rootNode,t,s,r,n,i),this.extractDefinesEdges(t,s,r,n,i),this.extractAnnotationEdges(e.rootNode,t,s,r,n),s}extractContainsEdges(e,t){for(let r of e)r.parent_id&&t.push({source:r.parent_id,target:this.generateNodeId(r),relation:"CONTAINS"});}extractCallEdges(e,t,r,n,s,i){let o=["call_expression","call","method_call_expression","function_call"];this.walkTree(e,a=>{if(o.includes(a.type)){let d=this.findEnclosingFunction(a,t),g=this.extractCalleeName(a);if(d&&g){let l=`${n}:${s}:function_declaration:${g}`;r.push({source:d.id,target:l,relation:"CALLS"});}}});}extractInheritanceEdges(e,t,r,n,s,i){let o=["class_declaration","class_definition","class_specifier"];this.walkTree(e,a=>{if(o.includes(a.type)){let d=this.findNameInChildren(a);if(!d)return;let g=`${n}:${s}:class_declaration:${d}`,l=this.findDescendantByType(a,["class_heritage","extends_clause","superclass"]);if(l){let p=this.findChildByType(l,["extends_clause","superclass"])??l,x=this.extractIdentifier(p);if(x&&x!==d){let R=`${n}:${s}:class_declaration:${x}`;r.push({source:g,target:R,relation:"INHERITS_FROM"});}}let c=this.findDescendantByType(a,["implements_clause","interface_list","implements"]);if(c){let m=this.extractIdentifiers(c);for(let p of m){let x=`${n}:${s}:interface_declaration:${p}`;r.push({source:g,target:x,relation:"IMPLEMENTS"});}}}});}extractImportEdges(e,t,r,n,s){let i=["import_declaration","import_statement","use_declaration","include_directive"];this.walkTree(e,o=>{if(i.includes(o.type)){let a=this.extractImportPath(o);if(a){let d=`${n}:${s}:module:file`;r.push({source:d,target:a,relation:"IMPORTS"});}}});}walkTree(e,t){t(e);for(let r of e.children)this.walkTree(r,t);}findEnclosingFunction(e,t){let r=e;for(;r;){if(["function_declaration","function_definition","method_definition","method_declaration","function_item"].includes(r.type)){let s=this.findNameInChildren(r);if(s){let i=t.find(l=>l.name===s);if(i)return {id:this.generateNodeId(i),name:s};r.startPosition;let a=t[0],d=a?.language??"ts",g=a?.file_path??"";return {id:`${d}:${g}:function_declaration:${s}`,name:s}}}r=r.parent;}return null}extractCalleeName(e){let t=e.firstChild;if(!t)return null;if(t.type==="member_expression"||t.type==="field_access"){let r=t.childForFieldName?.("property");if(r)return r.text;let n=t.children[t.children.length-1];if(n)return n.text}return t.type==="identifier"||t.type==="property_identifier"?t.text:null}findNameInChildren(e){for(let t of e.children)if(t.type==="identifier"||t.type==="type_identifier"||t.type==="property_identifier")return t.text;return null}findChildByType(e,t){for(let r of e.children)if(t.includes(r.type))return r;return null}findDescendantByType(e,t){for(let r of e.children){if(t.includes(r.type))return r;if(!["class_declaration","class_definition"].includes(r.type)){let s=this.findDescendantByType(r,t);if(s)return s}}return null}extractIdentifier(e){for(let t of e.children)if(t.type==="identifier"||t.type==="type_identifier")return t.text;return null}extractIdentifiers(e){let t=[];for(let r of e.children)(r.type==="identifier"||r.type==="type_identifier")&&t.push(r.text);return t}extractImportPath(e){for(let t of e.children)if(t.type==="string"||t.type==="string_literal"){let r=t.text;return (r.startsWith('"')||r.startsWith("'"))&&(r=r.slice(1,-1)),r}return null}generateNodeId(e){return `${e.language}:${e.file_path}:${e.ast_type}:${e.name}`}extractTypeReferences(e,t,r,n,s,i){let a=["function_declaration","function_definition","method_declaration","method_definition","variable_declaration","lexical_declaration","parameter","typed_param","identifier"];this.walkTree(e,d=>{if(a.includes(d.type)){let l=this.findNameInChildren(d);if(!l)return;let c=this.findChildByType(d,["return_type","type_annotation","type"]);if(c){let p=this.extractTypeName(c);if(p&&p!=="void"&&p!=="any"&&p!=="null"){let x=this.resolveTypeNodeId(p,n,s);x&&r.push({source:this.generateNodeIdFromName(l,d.type,n,s),target:x,relation:"TYPE_REFERENCES"});}}let m=this.findDescendantByType(d,["type_parameter","generic_type"]);if(m){let p=this.extractTypeName(m);if(p){let x=this.resolveTypeNodeId(p,n,s);x&&r.push({source:this.generateNodeIdFromName(l,d.type,n,s),target:x,relation:"TYPE_REFERENCES"});}}}if(["formal_parameters","parameter","typed_param","argument"].includes(d.type)){for(let l of d.children)if(l.type==="type_annotation"||l.type==="annotation"){let c=this.extractTypeName(l);if(c&&c!=="string"&&c!=="number"&&c!=="boolean"){let m=this.resolveTypeNodeId(c,n,s);if(m){let p=this.findEnclosingFunction(d,t);p&&r.push({source:p.id,target:m,relation:"TYPE_REFERENCES"});}}}}if(d.type==="variable_declaration"||d.type==="lexical_declaration"){for(let l of d.children)if(l.type==="type_annotation"){let c=this.extractTypeName(l);if(c&&c!=="string"&&c!=="number"&&c!=="boolean"&&c!=="any"){let m=this.resolveTypeNodeId(c,n,s);if(m){let p=this.findNameInChildren(d);p&&r.push({source:this.generateNodeIdFromName(p,"variable_declaration",n,s),target:m,relation:"TYPE_REFERENCES"});}}}}});}extractParameterEdges(e,t,r,n,s,i){let o=["function_declaration","function_definition","method_declaration","method_definition"];this.walkTree(e,a=>{if(o.includes(a.type)){let d=this.findNameInChildren(a);if(!d)return;let g=this.generateNodeIdFromName(d,a.type,n,s),l=this.findChildrenByType(a,["formal_parameters","parameters","parameter_list","parameter"]);for(let c of l)for(let m of c.children)if(m.type==="identifier"||m.type==="parameter"||m.type==="typed_param"){let p=this.findNameInChildren(m);if(p&&p!=="self"&&p!=="this"){let x=`${n}:${s}:parameter:${d}:${p}`;r.push({source:g,target:x,relation:"HAS_PARAMETER"});}}}});}extractDefinesEdges(e,t,r,n,s){let i=["class_declaration","class_definition","interface_declaration","module_declaration","namespace_declaration","struct_declaration"],o=["function_declaration","function_definition","method_declaration","method_definition","variable_declaration","property_declaration"];for(let a of e)if(i.includes(a.ast_type)){let d=this.generateNodeId(a);for(let g of e)if(g.file_path===a.file_path&&o.includes(g.ast_type)&&g.start_line>=a.start_line&&g.end_line<=a.end_line){let l=this.generateNodeId(g);d!==l&&t.push({source:d,target:l,relation:"DEFINES"});}}}extractAnnotationEdges(e,t,r,n,s){let i=["decorator","attribute","annotation","decorated_expression","attribute_decorator"],o=["function_declaration","function_definition","method_declaration","method_definition","class_declaration","class_definition"];this.walkTree(e,a=>{if(i.includes(a.type)){let d=this.extractTypeName(a)||this.findNameInChildren(a);if(!d)return;let g=a.parent;for(;g;){if(o.includes(g.type)){let l=this.findNameInChildren(g);if(l){let c=this.generateNodeIdFromName(l,g.type,n,s),m=`${n}:${s}:annotation:${d}`;r.push({source:m,target:c,relation:"ANNOTATES"});}break}g=g.parent;}}});}extractTypeName(e){for(let t of e.children)if(t.type==="type_identifier"||t.type==="identifier")return t.text;for(let t of e.children)if(t.type==="predefined_type")return t.text;return null}resolveTypeNodeId(e,t,r){let n=["interface_declaration","type_alias_declaration","class_declaration","enum_declaration","struct_declaration"];for(let s of n)return `${t}:${r}:${s}:${e}`;return null}generateNodeIdFromName(e,t,r,n){return `${r}:${n}:${t}:${e}`}findChildrenByType(e,t){let r=[];for(let n of e.children)t.includes(n.type)&&r.push(n);return r}};function de(){return new M}var A=class{constructor(e,t,r){u(this,"db");u(this,"parserManager");u(this,"nodeExtractor");u(this,"edgeExtractor");u(this,"config");this.db=e,this.parserManager=t,this.nodeExtractor=new O,this.edgeExtractor=new M,this.config=r;}generateNodeEmbeddingText(e){return [e.name,e.ast_type,e.language,e.text].join(" | ")}async embedText(e){if(!this.config.embedding)return null;try{let t=this.computeHash(e),r=this.db.getCachedEmbedding?.(t);if(r)return new Float32Array(r.buffer,r.byteOffset,r.length/4);let s=(await this.config.embedding.doEmbed({values:[e]})).embeddings[0];if(s){let i=new Float32Array(s);return this.db.cacheEmbedding?.(t,i),i}return null}catch{return null}}async indexFile(e,t){let r=Date.now(),n=[],s=0,i=0;try{let o=this.parserManager.detectLanguage(e);if(!o)throw new G("Unsupported file type",e);t?.({currentFile:e,processed:0,total:1,stage:"parsing"});let a=await this.readFile(e),d=this.computeHash(a);if(this.config.incremental&&this.db.getFileHash(e)===d)return {success:!0,filesProcessed:1,nodesCreated:0,edgesCreated:0,errors:[],duration:Date.now()-r};this.db.deleteEdgesByFile(e),this.db.deleteNodesByFile(e),t?.({currentFile:e,processed:0,total:1,stage:"extracting"});let g=this.parserManager.parse(a,o),l=this.nodeExtractor.extractNodes(g,a,o,e);s=l.length;let c=this.edgeExtractor.extractEdges(g,l,o,e);t?.({currentFile:e,processed:0,total:1,stage:"storing"}),this.storeNodes(l);let m=this.getValidEdgeCount(c,l);this.storeEdges(c,l),i=m,this.config.embedding&&l.length>0&&(t?.({currentFile:e,processed:0,total:1,stage:"embedding"}),await this.embedNodes(l)),this.db.setFileHash(e,d),g.delete();}catch(o){let a=o instanceof Error?o.message:String(o);n.push({filePath:e,error:a});}return {success:n.length===0,filesProcessed:1,nodesCreated:s,edgesCreated:i,errors:n,duration:Date.now()-r}}async indexDirectory(e,t){let r=Date.now(),n=e??this.config.workspaceDir,s=[],i=0,o=0,a=0;try{let d=await this.scanFiles(n),g=d.length;for(let l=0;l<d.length;l+=this.config.batchSize){let c=d.slice(l,l+this.config.batchSize);for(let m of c){let p=await this.indexFile(m.filePath,t);i++,o+=p.nodesCreated,a+=p.edgesCreated,!p.success&&p.errors.length>0&&s.push(...p.errors);}}}catch(d){let g=d instanceof Error?d.message:String(d);s.push({filePath:n,error:g});}return this.db.setLastSync(),{success:s.length===0,filesProcessed:i,nodesCreated:o,edgesCreated:a,errors:s,duration:Date.now()-r}}async sync(e){let t=Date.now(),r=[],n=0,s=0,i=0,o=0,a=0,d=0;try{let m=await this.scanFiles(this.config.workspaceDir),p=new Set(m.map(h=>h.filePath)),x=this.db.getAllFileHashes(),R=new Set(x.map(h=>h.file_path));for(let h of x)p.has(h.file_path)||(this.db.deleteNodesByFile(h.file_path),this.db.deleteEdgesByFile(h.file_path),this.db.deleteFileHash(h.file_path),i++);for(let h of m){let y=this.db.getFileHash(h.filePath);if(y)if(y!==h.contentHash){let _=await this.indexFile(h.filePath,e);_.success?(s++,a+=_.nodesCreated,d+=_.edgesCreated):r.push(..._.errors);}else o++;else {let _=await this.indexFile(h.filePath,e);_.success?(n++,a+=_.nodesCreated,d+=_.edgesCreated):r.push(..._.errors);}}}catch(m){let p=m instanceof Error?m.message:String(m);r.push({filePath:this.config.workspaceDir,error:p});}this.db.setLastSync();let g=new Date().toISOString(),l=Date.now()-t,c={timestamp:g,success:r.length===0,filesAdded:n,filesUpdated:s,filesDeleted:i,filesSkipped:o,nodesCreated:a,edgesCreated:d,errorCount:r.length,errors:r,duration:l};return this.db.setMeta("lastSyncResult",JSON.stringify(c)),{success:r.length===0,filesAdded:n,filesUpdated:s,filesDeleted:i,filesSkipped:o,nodesCreated:a,edgesCreated:d,errors:r,duration:l}}async scanFiles(e){let t=[],n=[".ts",".tsx",".js",".jsx",".mjs",".cjs",".py",".rs",".go",".c",".h",".cpp",".cc",".cxx",".hpp",".cs",".java",".scala",".rb",".php",".zig"].map(g=>`**/*${g}`),s=["**/node_modules/**","**/dist/**","**/build/**","**/.git/**","**/__pycache__/**","**/*.min.js","**/*.min.ts"],i=this.config.ignorePatterns.map(g=>g.includes("/")||g.includes("*")?g:`**/${g}/**`),o=[...s,...i],a=e.replace(/\\/g,"/"),d=await Oe__default.default(n,{cwd:a,absolute:true,ignore:o,onlyFiles:true});for(let g of d){let l=utils.Filesystem.normalize(g),c=this.parserManager.detectLanguage(l);if(c)try{let m=await this.readFile(l),p=this.computeHash(m);t.push({filePath:l,language:c,contentHash:p,content:m});}catch{}}return t}async readFile(e){try{return await Pe__default.default.readFile(e,"utf-8")}catch(t){throw new X("Failed to read file",e,t instanceof Error?t:new Error(String(t)))}}computeHash(e){return crypto.createHash("sha256").update(e).digest("hex")}storeNodes(e){let t=e.map(r=>({id:this.nodeExtractor.generateNodeId(r),name:r.name,ast_type:r.ast_type,language:r.language,file_path:r.file_path,start_line:r.start_line,start_col:r.start_col,end_line:r.end_line,end_col:r.end_col,text:r.text,created_at:new Date().toISOString()}));this.db.insertNodes(t);}storeEdges(e,t){let r=new Set(t.map(s=>this.nodeExtractor.generateNodeId(s))),n=e.filter(s=>r.has(s.source)&&r.has(s.target)).map((s,i)=>({id:`${s.source}:${s.relation}:${s.target}:${i}`,source:s.source,target:s.target,relation:s.relation,created_at:new Date().toISOString()}));n.length>0&&this.db.insertEdges(n);}getValidEdgeCount(e,t){let r=new Set(t.map(n=>this.nodeExtractor.generateNodeId(n)));return e.filter(n=>r.has(n.source)&&r.has(n.target)).length}async embedNodes(e){if(!this.config.embedding)return;let t=this.config.embedding.maxEmbeddingsPerCall||10,r=this.chunkArray(e,t),n=[];for(let s of r){let i=s.map(o=>this.generateNodeEmbeddingText(o));try{let o=await this.config.embedding.doEmbed({values:i});for(let a=0;a<s.length;a++){let d=s[a];if(!d)continue;let g=o.embeddings[a];if(g){let l=new Float32Array(g),c=this.computeHash(this.generateNodeEmbeddingText(d));this.db.cacheEmbedding?.(c,l),n.push({nodeId:this.nodeExtractor.generateNodeId(d),embeddingText:i[a]||"",embedding:l});}}}catch{for(let a of s){if(!a)continue;let d=this.generateNodeEmbeddingText(a),g=await this.embedText(d);g&&n.push({nodeId:this.nodeExtractor.generateNodeId(a),embeddingText:d,embedding:g});}}}n.length>0&&this.db.storeNodeEmbeddings?.(n);}chunkArray(e,t){let r=[];for(let n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r}};function ce(f,e,t){return new A(f,e,t)}var le=utils.Filesystem.normalize,N=utils.Log.create({service:"codebase.query"}),D=class{constructor(e,t,r={maxResults:20,minScore:.1,hybrid:{enabled:true,vectorWeight:.7,textWeight:.3}}){u(this,"db");u(this,"embedding");u(this,"config");this.db=e,this.embedding=t,this.config=r;}async search(e,t={}){let{maxResults:r=this.config.maxResults,minScore:n=this.config.minScore,language:s,filePath:i,astType:o,enableFts:a=true,includeEdges:d=true,edgesLimit:g=100,vectorWeight:l=this.config.hybrid.vectorWeight,textWeight:c=this.config.hybrid.textWeight,enableEmbedding:m=true}=t;N.debug("search() called",{query:e,astType:o,language:s,enableEmbedding:m,enableFts:a,minScore:n});let p=[];if(m&&this.embedding){let h=await this.vectorSearchNodes(e,r*2,n);N.debug("vectorSearchNodes results",{count:h.length,astTypeFilter:o});for(let y of h){let _=o?y.astType===o:true;N.debug("vector result",{astType:y.astType,name:y.name,match:_}),!(s&&y.language!==s)&&(o&&y.astType!==o||p.push({...y,source:"vector",vectorScore:y.score,hybridScore:y.score*l}));}N.debug("after vector filter",{resultsCount:p.length});}if(a&&this.db.isFtsAvailable()){let h=this.db.searchNodesFts(e,r*2);N.debug("FTS results before filter",{count:h.length});for(let y of h){let _=o?y.ast_type===o:true;if(N.debug("FTS result",{astType:y.ast_type,name:y.name,filterAstType:o,match:_}),s&&y.language!==s||i&&!y.file_path.includes(le(i))||o&&y.ast_type!==o)continue;let E=this.normalizeScore(y.score),I=p.find(b=>b.id===y.id);I?(I.ftsScore=E,I.hybridScore=I.vectorScore*l+E*c):p.push({id:y.id,name:y.name,astType:y.ast_type,language:y.language,filePath:y.file_path,text:y.text,snippet:y.text.slice(0,200),startLine:y.start_line,startCol:y.start_col,endLine:y.end_line,endCol:y.end_col,score:E,source:"fts",ftsScore:E,hybridScore:E*c});}N.debug("after FTS filter",{resultsCount:p.length});}if(!a||!this.db.isFtsAvailable()||p.length===0)try{let h=this.db.queryNodes({limit:r*2,astType:o,language:s,filePath:i}),y=new Set(p.map(b=>b.id)),_=e.toLowerCase(),E=_.split(/\s+/).filter(b=>b.length>0),I=[];for(let b of h){if(y.has(b.id)||i&&!b.file_path.includes(le(i)))continue;let B=b.name.toLowerCase(),U=b.text.toLowerCase(),ee=0;if(E.some(C=>B.includes(C))){let C=0;for(let W of E){let Z=new RegExp(W.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gi"),j=B.match(Z);C+=j?j.length:0;}ee=.8*Math.min(C/E.length,1);}let K=0;if(E.some(C=>U.includes(C))){let C=0;for(let j of E){let me=new RegExp(j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gi"),te=U.match(me);C+=te?te.length:0;}K=.5*Math.min(C/E.length,1);let W=U.indexOf(_),Z=W===-1?0:Math.max(0,1-W/U.length)*.2;K+=Z;}let J=Math.max(ee,K);J>0&&I.push({id:b.id,name:b.name,astType:b.ast_type,language:b.language,filePath:b.file_path,text:b.text,snippet:b.text.slice(0,200),startLine:b.start_line,startCol:b.start_col,endLine:b.end_line,endCol:b.end_col,score:J,source:"basic",hybridScore:J});}I.sort((b,B)=>B.score-b.score),p.push(...I.slice(0,r));}catch{}let R=p.filter(h=>h.hybridScore>=n).sort((h,y)=>y.hybridScore-h.hybridScore).slice(0,r).map(h=>({id:h.id,name:h.name,ast_type:h.astType,language:h.language,file_path:h.filePath,start_line:h.startLine,start_col:h.startCol,end_line:h.endLine,end_col:h.endCol,text:h.text,created_at:new Date().toISOString()}));if(d&&R.length>0){let h=R.map(E=>E.id),y=this.db.queryEdges({sourceOrTarget:h}),_=new Map;for(let E of y)E.source!==E.target&&(_.has(E.source)||_.set(E.source,[]),_.get(E.source).push(E));return R.map(E=>{let I=_.get(E.id)||[];return {...E,edges:I.slice(0,g)}})}return R.map(h=>({...h,edges:[]}))}async vectorSearchNodes(e,t,r,n){if(N.debug("vectorSearchNodes start",{query:e,limit:t,minScore:r,hasEmbedding:!!this.embedding,candidateCount:n?.length}),!this.embedding)return N.debug("vectorSearchNodes skip - no embedding model"),[];let s=await this.embedText(e);if(!s)return N.debug("vectorSearchNodes skip - no embedding result"),[];let i=new Float32Array(s),o;if(n&&n.length>0){let c=n.map(()=>"?").join(",");o=this.db.queryAll(`SELECT node_id, embedding FROM node_embeddings WHERE node_id IN (${c})`,n);}else o=this.db.queryAll("SELECT node_id, embedding FROM node_embeddings LIMIT ?",[Math.max(t*100,1e3)]);N.debug("vectorSearchNodes vectors loaded",{count:o.length});let a=[];for(let c of o){let m=new Float32Array(c.embedding.buffer,c.embedding.byteOffset,c.embedding.length/4),p=this.cosineSimilarity(i,m);a.push({nodeId:c.node_id,score:p});}a.sort((c,m)=>m.score-c.score);let d=a.slice(0,t).map(c=>c.nodeId);N.debug("vectorSearchNodes query nodes",{nodeIdsCount:d.length});let g=this.db.queryNodes({ids:d}),l=new Map(a.slice(0,t).map(c=>[c.nodeId,c.score]));return N.debug("vectorSearchNodes done",{nodesFound:g.length}),g.map(c=>({id:c.id,name:c.name,astType:c.ast_type,language:c.language,filePath:c.file_path,text:c.text??"",snippet:(c.text??"").slice(0,200),startLine:c.start_line??0,startCol:c.start_col??0,endLine:c.end_line??0,endCol:c.end_col??0,score:l.get(c.id)||0,source:"vector"}))}async getEdgesForNode(e,t=100){let r=this.db.queryEdges({source:e.id,target:e.id,limit:t});return {...e,edges:r}}async embedText(e){if(!this.embedding)return null;try{let r=(await this.embedding.doEmbed({values:[e]})).embeddings[0];return r?new Float32Array(r):null}catch{return null}}cosineSimilarity(e,t){let r=0,n=0,s=0;for(let i=0;i<e.length;i++){let o=e[i],a=t[i];r+=o*a,n+=o*o,s+=a*a;}return n===0||s===0?0:r/(Math.sqrt(n)*Math.sqrt(s))}structuralSearch(e,t){let r=[],n=this.db.queryNodes({name:e,language:t.language,filePath:t.filePath,astType:t.astType,limit:t.maxResults??20});for(let s of n){let i=this.calculateNameSimilarity(e,s.name);r.push({id:s.id,name:s.name,astType:s.ast_type,language:s.language,filePath:s.file_path,text:s.text??"",snippet:(s.text??"").slice(0,200),startLine:s.start_line??0,startCol:s.start_col??0,endLine:s.end_line??0,endCol:s.end_col??0,score:i,source:"structural"});}return r}calculateNameSimilarity(e,t){let r=e.toLowerCase(),n=t.toLowerCase();if(r===n)return 1;if(n.startsWith(r))return .9;if(n.includes(r))return .7;let s=new Set(r.split("")),i=new Set(n.split("")),o=0;for(let a of s)i.has(a)&&o++;return o/s.size*.5}normalizeScore(e){return 1/(1+Math.exp(-e/10))}queryNodes(e){try{return this.db.queryNodes(e)}catch(t){throw new H("Failed to query nodes",{filter:e},t instanceof Error?t:new Error(String(t)))}}queryEdges(e){try{return this.db.queryEdges(e)}catch(t){throw new H("Failed to query edges",{filter:e},t instanceof Error?t:new Error(String(t)))}}queryEdgesWithNodes(e){let t=this.db.queryEdges(e),r=[];for(let n of t){let s=this.db.getNodeById(n.source),i=this.db.getNodeById(n.target);s&&i&&r.push({edge:n,sourceNode:s,targetNode:i});}return r}queryNeighbors(e,t={}){let{relationTypes:r,direction:n="both",limit:s=100}=t,i=[],o=[],a=new Set;if(n==="outgoing"||n==="both"){let d=this.db.queryEdges({source:e,relation:r?.[0],limit:s});for(let g of d){if(r&&!r.includes(g.relation))continue;i.push(g);let l=this.db.getNodeById(g.target);l&&!a.has(l.id)&&(o.push(l),a.add(l.id));}}if(n==="incoming"||n==="both"){let d=this.db.queryEdges({target:e,relation:r?.[0],limit:s});for(let g of d){if(r&&!r.includes(g.relation))continue;i.push(g);let l=this.db.getNodeById(g.source);l&&!a.has(l.id)&&(o.push(l),a.add(l.id));}}return {nodes:o.slice(0,s),edges:i.slice(0,s)}}queryCallGraph(e,t=2){let r=new Map,n=new Set,s=(i,o)=>{if(o>t||n.has(i))return;n.add(i);let a=[],d=[],g=this.db.queryEdges({target:i,relation:"CALLS"});for(let c of g)a.push(c.source),s(c.source,o+1);let l=this.db.queryEdges({source:i,relation:"CALLS"});for(let c of l)d.push(c.target),s(c.target,o+1);r.set(i,{callers:a,callees:d});};return s(e,0),r}queryInheritance(e){let t=[],r=[],n=new Set,s=new Set,i=a=>{if(n.has(a))return;n.add(a);let d=this.db.queryEdges({source:a,relation:"INHERITS_FROM"}),g=this.db.queryEdges({source:a,relation:"IMPLEMENTS"});for(let l of [...d,...g]){let c=this.db.getNodeById(l.target);c&&(t.push(c),i(l.target));}},o=a=>{if(s.has(a))return;s.add(a);let d=this.db.queryEdges({target:a,relation:"INHERITS_FROM"}),g=this.db.queryEdges({target:a,relation:"IMPLEMENTS"});for(let l of [...d,...g]){let c=this.db.getNodeById(l.source);c&&(r.push(c),o(l.source));}};return i(e),o(e),{ancestors:t,descendants:r}}getNode(e){return this.db.getNodeById(e)}getEdge(e){return this.db.getEdgeById(e)}};function ge(f){return new D(f)}var v=utils.Log.create({service:"codebase"}),Ue={database:{path:types.getDefaultDatabasePath(xdgBasedir.xdgData,"codebase.db"),walMode:true},parser:{languages:["ts","js","py","rs","go","c","cpp","csharp","java","scala","ruby","php","zig"],lazyLoad:true},indexer:{batchSize:50,ignorePatterns:["node_modules/**","dist/**","build/**",".git/**","__pycache__/**","*.min.js","*.min.ts"],incremental:true},sync:types.DEFAULT_SYNC_CONFIG},Y=class{constructor(e={}){u(this,"config");u(this,"db");u(this,"parserManager");u(this,"indexer");u(this,"queryInterface");u(this,"initialized",false);u(this,"dirty",false);u(this,"syncTimer");u(this,"syncingInProgress",false);this.config={...Ue,...e};let t=e.workspaceDir??process.cwd(),r=e.database?.path||types.getDefaultDatabasePath(xdgBasedir.xdgData,"codebase.db");this.config={workspaceDir:t,database:{path:r,walMode:e.database?.walMode??true},embedding:{...types.DEFAULT_EMBEDDING_CONFIG,...e.embedding},search:{...types.DEFAULT_SEARCH_CONFIG,...e.search},parser:{...types.DEFAULT_PARSER_CONFIG,...e.parser},indexer:{...types.DEFAULT_INDEXER_CONFIG,...e.indexer},logDir:e.logDir,embeddingLlm:e.embeddingLlm},this.validateConfig();let n=this.resolveDbPath();this.db=new $(n),this.parserManager=new L;let s={workspaceDir:this.config.workspaceDir,batchSize:this.config.indexer?.batchSize??50,ignorePatterns:this.config.indexer?.ignorePatterns??[],incremental:this.config.indexer?.incremental??true,embedding:this.config.embeddingLlm};this.indexer=new A(this.db,this.parserManager,s),this.queryInterface=new D(this.db,this.config.embeddingLlm,this.config.search);}async initialize(){this.initialized||(this.db.initialize(),await this.parserManager.initialize(),this.config.sync?.intervalMs&&this.startSyncTimer(this.config.sync.intervalMs),this.config.sync?.onBoot&&this.sync().catch(e=>v.warn("codebase sync on boot failed",{error:String(e)})),this.initialized=true,v.debug("Codebase initialized",{workspaceDir:this.config.workspaceDir,dbPath:this.config.database.path,embeddingEnabled:!!this.config.embeddingLlm,syncOnBoot:!!this.config.sync?.onBoot,syncIntervalMs:this.config.sync?.intervalMs??0,batchSize:this.config.indexer?.batchSize,incremental:this.config.indexer?.incremental,languages:this.config.parser?.languages?.length??0}));}startSyncTimer(e){this.syncTimer&&clearInterval(this.syncTimer),e>0&&(this.syncTimer=setInterval(()=>{if(this.syncingInProgress){v.debug("Sync already in progress, skipping timer sync...");return}this.dirty&&(this.dirty=false,this.sync().catch(t=>{v.error("Interval sync failed",{error:String(t)});}));},e));}stopSyncTimer(){this.syncTimer&&(clearInterval(this.syncTimer),this.syncTimer=void 0);}ensureSynced(){this.dirty&&!this.syncingInProgress&&this.config.sync?.onSearch&&(this.dirty=false,this.sync().catch(e=>{v.error("Background sync failed",{error:String(e)});}));}markDirty(){this.dirty=true;}validateConfig(){if(!this.config.workspaceDir)throw new z("workspaceDir is required","workspaceDir");if(!this.config.database?.path)throw new z("database.path is required","database.path")}resolveDbPath(){let e=this.config.database.path;return q__default.default.isAbsolute(e)?e:q__default.default.join(this.config.workspaceDir,e)}async indexFile(e,t){return await this.ensureInitialized(),this.indexer.indexFile(e,t)}async indexDirectory(e,t){return await this.ensureInitialized(),this.indexer.indexDirectory(e,t)}async sync(e){if(await this.ensureInitialized(),this.syncingInProgress)return v.debug("Sync already in progress, skipping..."),{success:true,filesAdded:0,filesUpdated:0,filesDeleted:0,filesSkipped:0,nodesCreated:0,edgesCreated:0,errors:[],duration:0};this.syncingInProgress=true;try{let t=await this.indexer.sync(e);return v.debug("Codebase sync completed",{success:t.success,filesAdded:t.filesAdded,filesUpdated:t.filesUpdated,filesDeleted:t.filesDeleted,filesSkipped:t.filesSkipped,nodesCreated:t.nodesCreated,edgesCreated:t.edgesCreated,errors:t.errors.length,duration:t.duration}),t}finally{this.syncingInProgress=false;}}async search(e,t){return await this.ensureInitialized(),this.ensureSynced(),this.queryInterface.search(e,t)}async queryNodes(e){return await this.ensureInitialized(),this.queryInterface.queryNodes(e)}async queryEdges(e){return await this.ensureInitialized(),this.queryInterface.queryEdges(e)}async queryNeighbors(e,t){return await this.ensureInitialized(),this.queryInterface.queryNeighbors(e,t)}async queryCallGraph(e,t){return await this.ensureInitialized(),this.queryInterface.queryCallGraph(e,t)}async queryInheritance(e){return await this.ensureInitialized(),this.queryInterface.queryInheritance(e)}async getNode(e){return await this.ensureInitialized(),this.queryInterface.getNode(e)}async getEdge(e){return await this.ensureInitialized(),this.queryInterface.getEdge(e)}async getStatus(){let e=this.db.getStatus();return {dbPath:e.dbPath,nodeCount:e.nodeCount,edgeCount:e.edgeCount,indexedFiles:e.indexedFiles,workspaceDir:this.config.workspaceDir,meta:e.meta,healthy:this.initialized}}async healthCheck(){let e=[];this.db.isClosed()&&e.push("Database is closed"),this.parserManager.isInitialized()||e.push("Parser not initialized"),this.db.isFtsAvailable()||e.push("FTS not available");let t=this.db.getNodeCount();return t===0&&e.push("No nodes indexed"),{healthy:e.length===0,issues:e,nodeCount:t,edgeCount:this.db.getEdgeCount(),fileCount:this.db.getFileCount(),ftsAvailable:this.db.isFtsAvailable(),parserStatus:this.parserManager.getStatus()}}async clear(){this.db.clearAll();}async close(){this.initialized&&(this.stopSyncTimer(),this.db.close(),this.parserManager.dispose(),this.initialized=false,v.info("Codebase closed"));}async ensureInitialized(){this.initialized||await this.initialize();}getDatabase(){return this.db}getParser(){return this.parserManager}getQuery(){return this.queryInterface}};async function We(f){let e=new Y(f);return await e.initialize(),e}exports.CodeBase=Y;exports.ConfigError=z;exports.DatabaseError=F;exports.DatabaseManager=$;exports.EdgeExtractor=M;exports.FILE_EXTENSION_MAP=re;exports.FileSystemError=X;exports.IndexError=G;exports.Indexer=A;exports.NodeExtractor=O;exports.ParserError=k;exports.ParserManager=L;exports.QueryError=H;exports.QueryInterface=D;exports.SchemaError=Q;exports.UnsupportedLanguageError=V;exports.createCodebase=We;exports.createEdgeExtractor=de;exports.createIndexer=ce;exports.createNodeExtractor=oe;exports.createQueryInterface=ge;exports.getParserManager=ie;exports.resetParserManager=ae;
1
+ 'use strict';var chunkBL4XMOO2_cjs=require('./chunks/chunk-BL4XMOO2.cjs');require('./chunks/chunk-EVDJNYI2.cjs');var chunkYOFBT3V6_cjs=require('./chunks/chunk-YOFBT3V6.cjs'),chunkB35QBUQP_cjs=require('./chunks/chunk-B35QBUQP.cjs'),chunkABKFCPSL_cjs=require('./chunks/chunk-ABKFCPSL.cjs'),chunkRLZHDTHY_cjs=require('./chunks/chunk-RLZHDTHY.cjs');require('./chunks/chunk-7XCIIOM6.cjs'),require('./chunks/chunk-TS4OAYIJ.cjs');Object.defineProperty(exports,"handleCodebaseCli",{enumerable:true,get:function(){return chunkBL4XMOO2_cjs.c}});Object.defineProperty(exports,"renderBanner",{enumerable:true,get:function(){return chunkBL4XMOO2_cjs.a}});Object.defineProperty(exports,"renderHelp",{enumerable:true,get:function(){return chunkBL4XMOO2_cjs.b}});Object.defineProperty(exports,"getGlobal",{enumerable:true,get:function(){return chunkYOFBT3V6_cjs.c}});Object.defineProperty(exports,"getHomeDir",{enumerable:true,get:function(){return chunkYOFBT3V6_cjs.g}});Object.defineProperty(exports,"getInstance",{enumerable:true,get:function(){return chunkYOFBT3V6_cjs.f}});Object.defineProperty(exports,"getProjectDirectory",{enumerable:true,get:function(){return chunkYOFBT3V6_cjs.l}});Object.defineProperty(exports,"getXdgCache",{enumerable:true,get:function(){return chunkYOFBT3V6_cjs.k}});Object.defineProperty(exports,"getXdgConfig",{enumerable:true,get:function(){return chunkYOFBT3V6_cjs.i}});Object.defineProperty(exports,"getXdgData",{enumerable:true,get:function(){return chunkYOFBT3V6_cjs.h}});Object.defineProperty(exports,"getXdgState",{enumerable:true,get:function(){return chunkYOFBT3V6_cjs.j}});Object.defineProperty(exports,"resetGlobalAdapter",{enumerable:true,get:function(){return chunkYOFBT3V6_cjs.b}});Object.defineProperty(exports,"resetInstanceAdapter",{enumerable:true,get:function(){return chunkYOFBT3V6_cjs.e}});Object.defineProperty(exports,"setGlobalAdapter",{enumerable:true,get:function(){return chunkYOFBT3V6_cjs.a}});Object.defineProperty(exports,"setInstanceAdapter",{enumerable:true,get:function(){return chunkYOFBT3V6_cjs.d}});Object.defineProperty(exports,"AmbiguousError",{enumerable:true,get:function(){return chunkB35QBUQP_cjs.c}});Object.defineProperty(exports,"NotFoundError",{enumerable:true,get:function(){return chunkB35QBUQP_cjs.b}});Object.defineProperty(exports,"SECTION_END",{enumerable:true,get:function(){return chunkB35QBUQP_cjs.r}});Object.defineProperty(exports,"SECTION_MARKER",{enumerable:true,get:function(){return chunkB35QBUQP_cjs.q}});Object.defineProperty(exports,"ServiceError",{enumerable:true,get:function(){return chunkB35QBUQP_cjs.a}});Object.defineProperty(exports,"callees",{enumerable:true,get:function(){return chunkB35QBUQP_cjs.i}});Object.defineProperty(exports,"callers",{enumerable:true,get:function(){return chunkB35QBUQP_cjs.h}});Object.defineProperty(exports,"context",{enumerable:true,get:function(){return chunkB35QBUQP_cjs.f}});Object.defineProperty(exports,"defaultRiskLabel",{enumerable:true,get:function(){return chunkB35QBUQP_cjs.w}});Object.defineProperty(exports,"doctor",{enumerable:true,get:function(){return chunkB35QBUQP_cjs.l}});Object.defineProperty(exports,"emptyFormattedNode",{enumerable:true,get:function(){return chunkB35QBUQP_cjs.p}});Object.defineProperty(exports,"explore",{enumerable:true,get:function(){return chunkB35QBUQP_cjs.j}});Object.defineProperty(exports,"formatCodebaseEdge",{enumerable:true,get:function(){return chunkB35QBUQP_cjs.n}});Object.defineProperty(exports,"formatCodebaseNode",{enumerable:true,get:function(){return chunkB35QBUQP_cjs.m}});Object.defineProperty(exports,"formatCodebaseSearchHits",{enumerable:true,get:function(){return chunkB35QBUQP_cjs.o}});Object.defineProperty(exports,"impact",{enumerable:true,get:function(){return chunkB35QBUQP_cjs.g}});Object.defineProperty(exports,"node",{enumerable:true,get:function(){return chunkB35QBUQP_cjs.e}});Object.defineProperty(exports,"renderContext",{enumerable:true,get:function(){return chunkB35QBUQP_cjs.x}});Object.defineProperty(exports,"renderContextFromQuery",{enumerable:true,get:function(){return chunkB35QBUQP_cjs.B}});Object.defineProperty(exports,"renderExploreFromResult",{enumerable:true,get:function(){return chunkB35QBUQP_cjs.D}});Object.defineProperty(exports,"renderImpact",{enumerable:true,get:function(){return chunkB35QBUQP_cjs.v}});Object.defineProperty(exports,"renderImpactFromTuples",{enumerable:true,get:function(){return chunkB35QBUQP_cjs.A}});Object.defineProperty(exports,"renderNode",{enumerable:true,get:function(){return chunkB35QBUQP_cjs.y}});Object.defineProperty(exports,"renderNodeDetail",{enumerable:true,get:function(){return chunkB35QBUQP_cjs.C}});Object.defineProperty(exports,"renderSearch",{enumerable:true,get:function(){return chunkB35QBUQP_cjs.z}});Object.defineProperty(exports,"renderSearchResult",{enumerable:true,get:function(){return chunkB35QBUQP_cjs.u}});Object.defineProperty(exports,"search",{enumerable:true,get:function(){return chunkB35QBUQP_cjs.d}});Object.defineProperty(exports,"status",{enumerable:true,get:function(){return chunkB35QBUQP_cjs.k}});Object.defineProperty(exports,"truncateAtSectionBoundary",{enumerable:true,get:function(){return chunkB35QBUQP_cjs.s}});Object.defineProperty(exports,"truncateAtSectionBoundarySync",{enumerable:true,get:function(){return chunkB35QBUQP_cjs.t}});Object.defineProperty(exports,"CodeBase",{enumerable:true,get:function(){return chunkABKFCPSL_cjs.n}});Object.defineProperty(exports,"EdgeExtractor",{enumerable:true,get:function(){return chunkABKFCPSL_cjs.g}});Object.defineProperty(exports,"FILE_EXTENSION_MAP",{enumerable:true,get:function(){return chunkABKFCPSL_cjs.a}});Object.defineProperty(exports,"Indexer",{enumerable:true,get:function(){return chunkABKFCPSL_cjs.i}});Object.defineProperty(exports,"NodeExtractor",{enumerable:true,get:function(){return chunkABKFCPSL_cjs.e}});Object.defineProperty(exports,"ParserManager",{enumerable:true,get:function(){return chunkABKFCPSL_cjs.b}});Object.defineProperty(exports,"QueryInterface",{enumerable:true,get:function(){return chunkABKFCPSL_cjs.l}});Object.defineProperty(exports,"createCodebase",{enumerable:true,get:function(){return chunkABKFCPSL_cjs.o}});Object.defineProperty(exports,"createEdgeExtractor",{enumerable:true,get:function(){return chunkABKFCPSL_cjs.h}});Object.defineProperty(exports,"createIndexer",{enumerable:true,get:function(){return chunkABKFCPSL_cjs.j}});Object.defineProperty(exports,"createNodeExtractor",{enumerable:true,get:function(){return chunkABKFCPSL_cjs.f}});Object.defineProperty(exports,"createQueryInterface",{enumerable:true,get:function(){return chunkABKFCPSL_cjs.m}});Object.defineProperty(exports,"getParserManager",{enumerable:true,get:function(){return chunkABKFCPSL_cjs.c}});Object.defineProperty(exports,"resetParserManager",{enumerable:true,get:function(){return chunkABKFCPSL_cjs.d}});Object.defineProperty(exports,"ConfigError",{enumerable:true,get:function(){return chunkRLZHDTHY_cjs.e}});Object.defineProperty(exports,"DatabaseError",{enumerable:true,get:function(){return chunkRLZHDTHY_cjs.b}});Object.defineProperty(exports,"DatabaseManager",{enumerable:true,get:function(){return chunkRLZHDTHY_cjs.n}});Object.defineProperty(exports,"FileSystemError",{enumerable:true,get:function(){return chunkRLZHDTHY_cjs.c}});Object.defineProperty(exports,"IndexError",{enumerable:true,get:function(){return chunkRLZHDTHY_cjs.f}});Object.defineProperty(exports,"ParserError",{enumerable:true,get:function(){return chunkRLZHDTHY_cjs.a}});Object.defineProperty(exports,"QueryError",{enumerable:true,get:function(){return chunkRLZHDTHY_cjs.g}});Object.defineProperty(exports,"SchemaError",{enumerable:true,get:function(){return chunkRLZHDTHY_cjs.d}});Object.defineProperty(exports,"UnsupportedLanguageError",{enumerable:true,get:function(){return chunkRLZHDTHY_cjs.h}});