gitnexus 1.5.2 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -0
- package/dist/_shared/graph/types.d.ts +1 -1
- package/dist/_shared/graph/types.d.ts.map +1 -1
- package/dist/_shared/index.d.ts +1 -0
- package/dist/_shared/index.d.ts.map +1 -1
- package/dist/_shared/language-detection.d.ts.map +1 -1
- package/dist/_shared/language-detection.js +2 -0
- package/dist/_shared/language-detection.js.map +1 -1
- package/dist/_shared/languages.d.ts +1 -0
- package/dist/_shared/languages.d.ts.map +1 -1
- package/dist/_shared/languages.js +1 -0
- package/dist/_shared/languages.js.map +1 -1
- package/dist/_shared/lbug/schema-constants.d.ts +1 -1
- package/dist/_shared/lbug/schema-constants.d.ts.map +1 -1
- package/dist/_shared/lbug/schema-constants.js +3 -1
- package/dist/_shared/lbug/schema-constants.js.map +1 -1
- package/dist/_shared/mro-strategy.d.ts +19 -0
- package/dist/_shared/mro-strategy.d.ts.map +1 -0
- package/dist/_shared/mro-strategy.js +2 -0
- package/dist/_shared/mro-strategy.js.map +1 -0
- package/dist/cli/ai-context.d.ts +1 -0
- package/dist/cli/ai-context.js +28 -4
- package/dist/cli/analyze.d.ts +2 -0
- package/dist/cli/analyze.js +2 -1
- package/dist/cli/group.d.ts +2 -0
- package/dist/cli/group.js +233 -0
- package/dist/cli/index.js +3 -0
- package/dist/cli/serve.js +4 -1
- package/dist/cli/setup.js +34 -3
- package/dist/cli/wiki.js +15 -44
- package/dist/config/ignore-service.js +8 -3
- package/dist/core/augmentation/engine.js +1 -1
- package/dist/core/git-staleness.d.ts +13 -0
- package/dist/core/git-staleness.js +29 -0
- package/dist/core/group/bridge-db.d.ts +82 -0
- package/dist/core/group/bridge-db.js +460 -0
- package/dist/core/group/bridge-schema.d.ts +27 -0
- package/dist/core/group/bridge-schema.js +55 -0
- package/dist/core/group/config-parser.d.ts +3 -0
- package/dist/core/group/config-parser.js +83 -0
- package/dist/core/group/contract-extractor.d.ts +7 -0
- package/dist/core/group/contract-extractor.js +1 -0
- package/dist/core/group/extractors/grpc-extractor.d.ts +16 -0
- package/dist/core/group/extractors/grpc-extractor.js +264 -0
- package/dist/core/group/extractors/http-route-extractor.d.ts +24 -0
- package/dist/core/group/extractors/http-route-extractor.js +428 -0
- package/dist/core/group/extractors/topic-extractor.d.ts +9 -0
- package/dist/core/group/extractors/topic-extractor.js +234 -0
- package/dist/core/group/matching.d.ts +13 -0
- package/dist/core/group/matching.js +198 -0
- package/dist/core/group/normalization.d.ts +3 -0
- package/dist/core/group/normalization.js +115 -0
- package/dist/core/group/service-boundary-detector.d.ts +8 -0
- package/dist/core/group/service-boundary-detector.js +155 -0
- package/dist/core/group/service.d.ts +46 -0
- package/dist/core/group/service.js +160 -0
- package/dist/core/group/storage.d.ts +9 -0
- package/dist/core/group/storage.js +91 -0
- package/dist/core/group/sync.d.ts +21 -0
- package/dist/core/group/sync.js +148 -0
- package/dist/core/group/types.d.ts +130 -0
- package/dist/core/group/types.js +1 -0
- package/dist/core/ingestion/binding-accumulator.d.ts +207 -0
- package/dist/core/ingestion/binding-accumulator.js +332 -0
- package/dist/core/ingestion/call-processor.d.ts +155 -24
- package/dist/core/ingestion/call-processor.js +1129 -247
- package/dist/core/ingestion/class-extractors/generic.d.ts +2 -0
- package/dist/core/ingestion/class-extractors/generic.js +135 -0
- package/dist/core/ingestion/class-types.d.ts +34 -0
- package/dist/core/ingestion/class-types.js +1 -0
- package/dist/core/ingestion/entry-point-scoring.d.ts +1 -0
- package/dist/core/ingestion/entry-point-scoring.js +1 -0
- package/dist/core/ingestion/field-extractors/configs/helpers.d.ts +5 -1
- package/dist/core/ingestion/field-extractors/configs/helpers.js +13 -3
- package/dist/core/ingestion/field-types.d.ts +2 -2
- package/dist/core/ingestion/filesystem-walker.js +8 -0
- package/dist/core/ingestion/framework-detection.d.ts +1 -0
- package/dist/core/ingestion/framework-detection.js +1 -0
- package/dist/core/ingestion/heritage-processor.d.ts +8 -15
- package/dist/core/ingestion/heritage-processor.js +15 -28
- package/dist/core/ingestion/import-processor.d.ts +1 -11
- package/dist/core/ingestion/import-processor.js +0 -12
- package/dist/core/ingestion/import-resolvers/utils.js +1 -0
- package/dist/core/ingestion/import-resolvers/vue.d.ts +8 -0
- package/dist/core/ingestion/import-resolvers/vue.js +9 -0
- package/dist/core/ingestion/language-provider.d.ts +6 -3
- package/dist/core/ingestion/languages/c-cpp.js +168 -1
- package/dist/core/ingestion/languages/csharp.js +20 -0
- package/dist/core/ingestion/languages/dart.js +26 -4
- package/dist/core/ingestion/languages/go.js +22 -0
- package/dist/core/ingestion/languages/index.d.ts +1 -0
- package/dist/core/ingestion/languages/index.js +2 -0
- package/dist/core/ingestion/languages/java.js +17 -0
- package/dist/core/ingestion/languages/kotlin.js +24 -1
- package/dist/core/ingestion/languages/php.js +23 -11
- package/dist/core/ingestion/languages/python.js +9 -0
- package/dist/core/ingestion/languages/ruby.js +28 -0
- package/dist/core/ingestion/languages/rust.js +38 -0
- package/dist/core/ingestion/languages/swift.js +31 -0
- package/dist/core/ingestion/languages/typescript.d.ts +1 -0
- package/dist/core/ingestion/languages/typescript.js +54 -1
- package/dist/core/ingestion/languages/vue.d.ts +13 -0
- package/dist/core/ingestion/languages/vue.js +81 -0
- package/dist/core/ingestion/method-extractors/configs/c-cpp.d.ts +3 -0
- package/dist/core/ingestion/method-extractors/configs/c-cpp.js +387 -0
- package/dist/core/ingestion/method-extractors/configs/csharp.js +5 -1
- package/dist/core/ingestion/method-extractors/configs/dart.d.ts +2 -0
- package/dist/core/ingestion/method-extractors/configs/dart.js +376 -0
- package/dist/core/ingestion/method-extractors/configs/go.d.ts +2 -0
- package/dist/core/ingestion/method-extractors/configs/go.js +176 -0
- package/dist/core/ingestion/method-extractors/configs/jvm.js +13 -4
- package/dist/core/ingestion/method-extractors/configs/php.d.ts +2 -0
- package/dist/core/ingestion/method-extractors/configs/php.js +304 -0
- package/dist/core/ingestion/method-extractors/configs/python.d.ts +2 -0
- package/dist/core/ingestion/method-extractors/configs/python.js +309 -0
- package/dist/core/ingestion/method-extractors/configs/ruby.d.ts +2 -0
- package/dist/core/ingestion/method-extractors/configs/ruby.js +285 -0
- package/dist/core/ingestion/method-extractors/configs/rust.d.ts +2 -0
- package/dist/core/ingestion/method-extractors/configs/rust.js +195 -0
- package/dist/core/ingestion/method-extractors/configs/swift.d.ts +2 -0
- package/dist/core/ingestion/method-extractors/configs/swift.js +277 -0
- package/dist/core/ingestion/method-extractors/configs/typescript-javascript.d.ts +3 -0
- package/dist/core/ingestion/method-extractors/configs/typescript-javascript.js +338 -0
- package/dist/core/ingestion/method-extractors/generic.js +38 -15
- package/dist/core/ingestion/method-types.d.ts +25 -0
- package/dist/core/ingestion/model/field-registry.d.ts +18 -0
- package/dist/core/ingestion/model/field-registry.js +22 -0
- package/dist/core/ingestion/model/heritage-map.d.ts +70 -0
- package/dist/core/ingestion/model/heritage-map.js +159 -0
- package/dist/core/ingestion/model/index.d.ts +20 -0
- package/dist/core/ingestion/model/index.js +41 -0
- package/dist/core/ingestion/model/method-registry.d.ts +62 -0
- package/dist/core/ingestion/model/method-registry.js +130 -0
- package/dist/core/ingestion/model/registration-table.d.ts +139 -0
- package/dist/core/ingestion/model/registration-table.js +224 -0
- package/dist/core/ingestion/model/resolution-context.d.ts +93 -0
- package/dist/core/ingestion/model/resolution-context.js +337 -0
- package/dist/core/ingestion/model/resolve.d.ts +56 -0
- package/dist/core/ingestion/model/resolve.js +242 -0
- package/dist/core/ingestion/model/semantic-model.d.ts +86 -0
- package/dist/core/ingestion/model/semantic-model.js +120 -0
- package/dist/core/ingestion/model/symbol-table.d.ts +222 -0
- package/dist/core/ingestion/model/symbol-table.js +206 -0
- package/dist/core/ingestion/model/type-registry.d.ts +39 -0
- package/dist/core/ingestion/model/type-registry.js +62 -0
- package/dist/core/ingestion/mro-processor.d.ts +4 -3
- package/dist/core/ingestion/mro-processor.js +310 -106
- package/dist/core/ingestion/parsing-processor.d.ts +5 -4
- package/dist/core/ingestion/parsing-processor.js +210 -85
- package/dist/core/ingestion/pipeline.d.ts +2 -0
- package/dist/core/ingestion/pipeline.js +192 -68
- package/dist/core/ingestion/tree-sitter-queries.d.ts +6 -6
- package/dist/core/ingestion/tree-sitter-queries.js +37 -0
- package/dist/core/ingestion/type-env.d.ts +15 -2
- package/dist/core/ingestion/type-env.js +163 -102
- package/dist/core/ingestion/type-extractors/csharp.js +17 -0
- package/dist/core/ingestion/type-extractors/jvm.js +11 -0
- package/dist/core/ingestion/type-extractors/php.js +0 -55
- package/dist/core/ingestion/type-extractors/ruby.js +0 -32
- package/dist/core/ingestion/type-extractors/swift.js +13 -0
- package/dist/core/ingestion/type-extractors/types.d.ts +8 -8
- package/dist/core/ingestion/type-extractors/typescript.js +66 -69
- package/dist/core/ingestion/utils/ast-helpers.d.ts +33 -43
- package/dist/core/ingestion/utils/ast-helpers.js +129 -565
- package/dist/core/ingestion/utils/method-props.d.ts +32 -0
- package/dist/core/ingestion/utils/method-props.js +147 -0
- package/dist/core/ingestion/vue-sfc-extractor.d.ts +44 -0
- package/dist/core/ingestion/vue-sfc-extractor.js +94 -0
- package/dist/core/ingestion/workers/parse-worker.d.ts +31 -19
- package/dist/core/ingestion/workers/parse-worker.js +463 -198
- package/dist/core/lbug/lbug-adapter.d.ts +6 -0
- package/dist/core/lbug/lbug-adapter.js +68 -3
- package/dist/core/lbug/pool-adapter.d.ts +76 -0
- package/dist/core/lbug/pool-adapter.js +522 -0
- package/dist/core/run-analyze.d.ts +2 -0
- package/dist/core/run-analyze.js +1 -1
- package/dist/core/search/bm25-index.js +1 -1
- package/dist/core/tree-sitter/parser-loader.js +1 -0
- package/dist/core/wiki/graph-queries.js +1 -1
- package/dist/core/wiki/html-viewer.js +6 -4
- package/dist/core/wiki/llm-client.js +4 -6
- package/dist/mcp/core/embedder.js +6 -5
- package/dist/mcp/core/lbug-adapter.d.ts +3 -63
- package/dist/mcp/core/lbug-adapter.js +3 -484
- package/dist/mcp/local/local-backend.d.ts +31 -2
- package/dist/mcp/local/local-backend.js +255 -46
- package/dist/mcp/resources.js +5 -4
- package/dist/mcp/staleness.d.ts +3 -13
- package/dist/mcp/staleness.js +2 -31
- package/dist/mcp/tools.js +80 -4
- package/dist/server/analyze-job.d.ts +2 -0
- package/dist/server/analyze-job.js +4 -0
- package/dist/server/api.d.ts +20 -1
- package/dist/server/api.js +306 -71
- package/dist/server/git-clone.d.ts +2 -1
- package/dist/server/git-clone.js +98 -5
- package/dist/storage/git.d.ts +13 -0
- package/dist/storage/git.js +25 -0
- package/dist/storage/repo-manager.js +1 -1
- package/package.json +8 -2
- package/scripts/patch-tree-sitter-swift.cjs +78 -0
- package/dist/core/ingestion/named-binding-processor.d.ts +0 -18
- package/dist/core/ingestion/named-binding-processor.js +0 -42
- package/dist/core/ingestion/resolution-context.d.ts +0 -58
- package/dist/core/ingestion/resolution-context.js +0 -135
- package/dist/core/ingestion/symbol-table.d.ts +0 -79
- package/dist/core/ingestion/symbol-table.js +0 -115
|
@@ -49,6 +49,7 @@ export declare const batchInsertNodesToLbug: (nodes: Array<{
|
|
|
49
49
|
failed: number;
|
|
50
50
|
}>;
|
|
51
51
|
export declare const executeQuery: (cypher: string) => Promise<any[]>;
|
|
52
|
+
export declare const streamQuery: (cypher: string, onRow: (row: any) => void | Promise<void>) => Promise<number>;
|
|
52
53
|
/**
|
|
53
54
|
* Execute a single parameterized query (prepare/execute pattern).
|
|
54
55
|
* Prevents Cypher injection by binding values as parameters.
|
|
@@ -88,6 +89,11 @@ export declare const getEmbeddingTableName: () => string;
|
|
|
88
89
|
* Safe to call multiple times — tracks loaded state via module-level ftsLoaded.
|
|
89
90
|
*/
|
|
90
91
|
export declare const loadFTSExtension: () => Promise<void>;
|
|
92
|
+
/**
|
|
93
|
+
* Load the VECTOR extension (required before using QUERY_VECTOR_INDEX).
|
|
94
|
+
* Safe to call multiple times -- tracks loaded state via module-level vectorExtensionLoaded.
|
|
95
|
+
*/
|
|
96
|
+
export declare const loadVectorExtension: () => Promise<void>;
|
|
91
97
|
/**
|
|
92
98
|
* Create a full-text search index on a table
|
|
93
99
|
* @param tableName - The node table name (e.g., 'File', 'CodeSymbol')
|
|
@@ -9,6 +9,7 @@ let db = null;
|
|
|
9
9
|
let conn = null;
|
|
10
10
|
let currentDbPath = null;
|
|
11
11
|
let ftsLoaded = false;
|
|
12
|
+
let vectorExtensionLoaded = false;
|
|
12
13
|
/** Expose the current Database for pool adapter reuse in tests. */
|
|
13
14
|
export const getDatabase = () => db;
|
|
14
15
|
// Global session lock for operations that touch module-level lbug globals.
|
|
@@ -91,6 +92,7 @@ export const withLbugDb = async (dbPath, operation) => {
|
|
|
91
92
|
db = null;
|
|
92
93
|
currentDbPath = null;
|
|
93
94
|
ftsLoaded = false;
|
|
95
|
+
vectorExtensionLoaded = false;
|
|
94
96
|
});
|
|
95
97
|
// Sleep outside the lock — no need to block others while waiting
|
|
96
98
|
await new Promise((resolve) => setTimeout(resolve, DB_LOCK_RETRY_DELAY_MS * attempt));
|
|
@@ -124,6 +126,7 @@ const doInitLbug = async (dbPath) => {
|
|
|
124
126
|
db = null;
|
|
125
127
|
currentDbPath = null;
|
|
126
128
|
ftsLoaded = false;
|
|
129
|
+
vectorExtensionLoaded = false;
|
|
127
130
|
}
|
|
128
131
|
// LadybugDB stores the database as a single file (not a directory).
|
|
129
132
|
// If the path already exists, it must be a valid LadybugDB database file.
|
|
@@ -167,6 +170,8 @@ const doInitLbug = async (dbPath) => {
|
|
|
167
170
|
}
|
|
168
171
|
}
|
|
169
172
|
}
|
|
173
|
+
// Load VECTOR extension for semantic search support
|
|
174
|
+
await loadVectorExtension();
|
|
170
175
|
currentDbPath = dbPath;
|
|
171
176
|
return { db, conn };
|
|
172
177
|
};
|
|
@@ -589,6 +594,30 @@ export const executeQuery = async (cypher) => {
|
|
|
589
594
|
const rows = await result.getAll();
|
|
590
595
|
return rows;
|
|
591
596
|
};
|
|
597
|
+
export const streamQuery = async (cypher, onRow) => {
|
|
598
|
+
if (!conn) {
|
|
599
|
+
throw new Error('LadybugDB not initialized. Call initLbug first.');
|
|
600
|
+
}
|
|
601
|
+
const queryResult = await conn.query(cypher);
|
|
602
|
+
const result = Array.isArray(queryResult) ? queryResult[0] : queryResult;
|
|
603
|
+
let rowCount = 0;
|
|
604
|
+
try {
|
|
605
|
+
while (await result.hasNext()) {
|
|
606
|
+
const row = await result.getNext();
|
|
607
|
+
await onRow(row);
|
|
608
|
+
rowCount++;
|
|
609
|
+
}
|
|
610
|
+
return rowCount;
|
|
611
|
+
}
|
|
612
|
+
finally {
|
|
613
|
+
try {
|
|
614
|
+
await result.close();
|
|
615
|
+
}
|
|
616
|
+
catch {
|
|
617
|
+
// Best-effort cleanup only.
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
};
|
|
592
621
|
/**
|
|
593
622
|
* Execute a single parameterized query (prepare/execute pattern).
|
|
594
623
|
* Prevents Cypher injection by binding values as parameters.
|
|
@@ -715,6 +744,7 @@ export const closeLbug = async () => {
|
|
|
715
744
|
}
|
|
716
745
|
currentDbPath = null;
|
|
717
746
|
ftsLoaded = false;
|
|
747
|
+
vectorExtensionLoaded = false;
|
|
718
748
|
};
|
|
719
749
|
export const isLbugReady = () => conn !== null && db !== null;
|
|
720
750
|
/**
|
|
@@ -803,19 +833,54 @@ export const loadFTSExtension = async () => {
|
|
|
803
833
|
throw new Error('LadybugDB not initialized. Call initLbug first.');
|
|
804
834
|
}
|
|
805
835
|
try {
|
|
806
|
-
|
|
836
|
+
// Try loading locally first (no network required)
|
|
807
837
|
await conn.query('LOAD EXTENSION fts');
|
|
808
838
|
ftsLoaded = true;
|
|
809
839
|
}
|
|
840
|
+
catch {
|
|
841
|
+
// Fall back to install + load (requires network)
|
|
842
|
+
try {
|
|
843
|
+
await conn.query('INSTALL fts');
|
|
844
|
+
await conn.query('LOAD EXTENSION fts');
|
|
845
|
+
ftsLoaded = true;
|
|
846
|
+
}
|
|
847
|
+
catch (err) {
|
|
848
|
+
const msg = err?.message || '';
|
|
849
|
+
if (msg.includes('already loaded') ||
|
|
850
|
+
msg.includes('already installed') ||
|
|
851
|
+
msg.includes('already exists')) {
|
|
852
|
+
ftsLoaded = true;
|
|
853
|
+
}
|
|
854
|
+
else {
|
|
855
|
+
console.error('GitNexus: FTS extension load failed:', msg);
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
};
|
|
860
|
+
/**
|
|
861
|
+
* Load the VECTOR extension (required before using QUERY_VECTOR_INDEX).
|
|
862
|
+
* Safe to call multiple times -- tracks loaded state via module-level vectorExtensionLoaded.
|
|
863
|
+
*/
|
|
864
|
+
export const loadVectorExtension = async () => {
|
|
865
|
+
if (vectorExtensionLoaded)
|
|
866
|
+
return;
|
|
867
|
+
if (!conn) {
|
|
868
|
+
throw new Error('LadybugDB not initialized. Call initLbug first.');
|
|
869
|
+
}
|
|
870
|
+
try {
|
|
871
|
+
await conn.query('INSTALL VECTOR');
|
|
872
|
+
await conn.query('LOAD EXTENSION VECTOR');
|
|
873
|
+
vectorExtensionLoaded = true;
|
|
874
|
+
}
|
|
810
875
|
catch (err) {
|
|
811
876
|
const msg = err?.message || '';
|
|
812
877
|
if (msg.includes('already loaded') ||
|
|
813
878
|
msg.includes('already installed') ||
|
|
814
879
|
msg.includes('already exists')) {
|
|
815
|
-
|
|
880
|
+
vectorExtensionLoaded = true;
|
|
816
881
|
}
|
|
817
882
|
else {
|
|
818
|
-
console.error('GitNexus:
|
|
883
|
+
console.error('GitNexus: VECTOR extension load failed:', msg);
|
|
819
884
|
}
|
|
820
885
|
}
|
|
821
886
|
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LadybugDB connection pool (core). Used by MCP, sync, search, wiki, etc.
|
|
3
|
+
*
|
|
4
|
+
* LadybugDB Adapter (Connection Pool)
|
|
5
|
+
*
|
|
6
|
+
* Manages a pool of LadybugDB databases keyed by repoId, each with
|
|
7
|
+
* multiple Connection objects for safe concurrent query execution.
|
|
8
|
+
*
|
|
9
|
+
* LadybugDB Connections are NOT thread-safe — a single Connection
|
|
10
|
+
* segfaults if concurrent .query() calls hit it simultaneously.
|
|
11
|
+
* This adapter provides a checkout/return connection pool so each
|
|
12
|
+
* concurrent query gets its own Connection from the same Database.
|
|
13
|
+
*
|
|
14
|
+
* @see https://docs.ladybugdb.com/concurrency — multiple Connections
|
|
15
|
+
* from the same Database is the officially supported concurrency pattern.
|
|
16
|
+
*/
|
|
17
|
+
import lbug from '@ladybugdb/core';
|
|
18
|
+
/** Saved real stdout/stderr write — used to silence native module output without race conditions */
|
|
19
|
+
export declare const realStdoutWrite: any;
|
|
20
|
+
export declare const realStderrWrite: any;
|
|
21
|
+
/**
|
|
22
|
+
* Touch a repo to reset its idle timeout.
|
|
23
|
+
* Call this during long-running operations to prevent the connection from being closed.
|
|
24
|
+
*/
|
|
25
|
+
export declare const touchRepo: (repoId: string) => void;
|
|
26
|
+
/**
|
|
27
|
+
* Silence stdout by replacing process.stdout.write with a no-op.
|
|
28
|
+
* Uses a reference counter so nested silence/restore pairs are safe.
|
|
29
|
+
* Exported so other modules (e.g. embedder) use the same mechanism instead
|
|
30
|
+
* of independently patching stdout, which causes restore-order conflicts.
|
|
31
|
+
*/
|
|
32
|
+
export declare function silenceStdout(): void;
|
|
33
|
+
export declare function restoreStdout(): void;
|
|
34
|
+
/**
|
|
35
|
+
* Initialize (or reuse) a Database + connection pool for a specific repo.
|
|
36
|
+
* Retries on lock errors (e.g., when `gitnexus analyze` is running).
|
|
37
|
+
*
|
|
38
|
+
* Concurrent calls for the same repoId are deduplicated — the second caller
|
|
39
|
+
* awaits the first's in-progress init rather than starting a redundant one.
|
|
40
|
+
*/
|
|
41
|
+
export declare const initLbug: (repoId: string, dbPath: string) => Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Initialize a pool entry from a pre-existing Database object.
|
|
44
|
+
*
|
|
45
|
+
* Used in tests to avoid the writable→close→read-only cycle that crashes
|
|
46
|
+
* on macOS due to N-API destructor segfaults. The pool adapter reuses
|
|
47
|
+
* the core adapter's writable Database instead of opening a new read-only one.
|
|
48
|
+
*
|
|
49
|
+
* The Database is registered in the shared dbCache so closeOne() decrements
|
|
50
|
+
* the refCount correctly. If the Database is already cached (e.g. another
|
|
51
|
+
* repoId already injected it), the existing entry is reused.
|
|
52
|
+
*/
|
|
53
|
+
export declare function initLbugWithDb(repoId: string, existingDb: lbug.Database, dbPath: string): Promise<void>;
|
|
54
|
+
export declare const executeQuery: (repoId: string, cypher: string) => Promise<any[]>;
|
|
55
|
+
/**
|
|
56
|
+
* Execute a parameterized query on a specific repo's connection pool.
|
|
57
|
+
* Uses prepare/execute pattern to prevent Cypher injection.
|
|
58
|
+
*/
|
|
59
|
+
export declare const executeParameterized: (repoId: string, cypher: string, params: Record<string, any>) => Promise<any[]>;
|
|
60
|
+
/**
|
|
61
|
+
* Close one or all repo pools.
|
|
62
|
+
* If repoId is provided, close only that repo's connections.
|
|
63
|
+
* If omitted, close all repos.
|
|
64
|
+
*/
|
|
65
|
+
export declare const closeLbug: (repoId?: string) => Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* Check if a specific repo's pool is active
|
|
68
|
+
*/
|
|
69
|
+
export declare const isLbugReady: (repoId: string) => boolean;
|
|
70
|
+
/** Regex to detect write operations in user-supplied Cypher queries.
|
|
71
|
+
* Note: CALL is NOT blocked — it's used for read-only FTS (CALL QUERY_FTS_INDEX)
|
|
72
|
+
* and vector search (CALL QUERY_VECTOR_INDEX). The database is opened in
|
|
73
|
+
* read-only mode as defense-in-depth against write procedures. */
|
|
74
|
+
export declare const CYPHER_WRITE_RE: RegExp;
|
|
75
|
+
/** Check if a Cypher query contains write operations */
|
|
76
|
+
export declare function isWriteQuery(query: string): boolean;
|