ai-mind-map 1.1.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/LICENSE +21 -0
- package/README.md +554 -0
- package/dist/change-tracker/change-log.d.ts +160 -0
- package/dist/change-tracker/change-log.d.ts.map +1 -0
- package/dist/change-tracker/change-log.js +507 -0
- package/dist/change-tracker/change-log.js.map +1 -0
- package/dist/change-tracker/diff-engine.d.ts +149 -0
- package/dist/change-tracker/diff-engine.d.ts.map +1 -0
- package/dist/change-tracker/diff-engine.js +530 -0
- package/dist/change-tracker/diff-engine.js.map +1 -0
- package/dist/change-tracker/watcher.d.ts +137 -0
- package/dist/change-tracker/watcher.d.ts.map +1 -0
- package/dist/change-tracker/watcher.js +300 -0
- package/dist/change-tracker/watcher.js.map +1 -0
- package/dist/cli.d.ts +20 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +937 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +38 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +222 -0
- package/dist/config.js.map +1 -0
- package/dist/context/compressor.d.ts +49 -0
- package/dist/context/compressor.d.ts.map +1 -0
- package/dist/context/compressor.js +769 -0
- package/dist/context/compressor.js.map +1 -0
- package/dist/context/progressive-disclosure.d.ts +71 -0
- package/dist/context/progressive-disclosure.d.ts.map +1 -0
- package/dist/context/progressive-disclosure.js +470 -0
- package/dist/context/progressive-disclosure.js.map +1 -0
- package/dist/context/token-budget.d.ts +121 -0
- package/dist/context/token-budget.d.ts.map +1 -0
- package/dist/context/token-budget.js +282 -0
- package/dist/context/token-budget.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +944 -0
- package/dist/index.js.map +1 -0
- package/dist/install.d.ts +66 -0
- package/dist/install.d.ts.map +1 -0
- package/dist/install.js +946 -0
- package/dist/install.js.map +1 -0
- package/dist/knowledge-graph/architecture.d.ts +213 -0
- package/dist/knowledge-graph/architecture.d.ts.map +1 -0
- package/dist/knowledge-graph/architecture.js +585 -0
- package/dist/knowledge-graph/architecture.js.map +1 -0
- package/dist/knowledge-graph/cypher.d.ts +113 -0
- package/dist/knowledge-graph/cypher.d.ts.map +1 -0
- package/dist/knowledge-graph/cypher.js +1051 -0
- package/dist/knowledge-graph/cypher.js.map +1 -0
- package/dist/knowledge-graph/dead-code.d.ts +121 -0
- package/dist/knowledge-graph/dead-code.d.ts.map +1 -0
- package/dist/knowledge-graph/dead-code.js +331 -0
- package/dist/knowledge-graph/dead-code.js.map +1 -0
- package/dist/knowledge-graph/flow-analyzer.d.ts +167 -0
- package/dist/knowledge-graph/flow-analyzer.d.ts.map +1 -0
- package/dist/knowledge-graph/flow-analyzer.js +739 -0
- package/dist/knowledge-graph/flow-analyzer.js.map +1 -0
- package/dist/knowledge-graph/graph.d.ts +291 -0
- package/dist/knowledge-graph/graph.d.ts.map +1 -0
- package/dist/knowledge-graph/graph.js +978 -0
- package/dist/knowledge-graph/graph.js.map +1 -0
- package/dist/knowledge-graph/index.d.ts +17 -0
- package/dist/knowledge-graph/index.d.ts.map +1 -0
- package/dist/knowledge-graph/index.js +14 -0
- package/dist/knowledge-graph/index.js.map +1 -0
- package/dist/knowledge-graph/indexer.d.ts +112 -0
- package/dist/knowledge-graph/indexer.d.ts.map +1 -0
- package/dist/knowledge-graph/indexer.js +506 -0
- package/dist/knowledge-graph/indexer.js.map +1 -0
- package/dist/knowledge-graph/pagerank.d.ts +141 -0
- package/dist/knowledge-graph/pagerank.d.ts.map +1 -0
- package/dist/knowledge-graph/pagerank.js +493 -0
- package/dist/knowledge-graph/pagerank.js.map +1 -0
- package/dist/knowledge-graph/parser.d.ts +55 -0
- package/dist/knowledge-graph/parser.d.ts.map +1 -0
- package/dist/knowledge-graph/parser.js +1090 -0
- package/dist/knowledge-graph/parser.js.map +1 -0
- package/dist/knowledge-graph/snapshot.d.ts +107 -0
- package/dist/knowledge-graph/snapshot.d.ts.map +1 -0
- package/dist/knowledge-graph/snapshot.js +435 -0
- package/dist/knowledge-graph/snapshot.js.map +1 -0
- package/dist/memory/decision-log.d.ts +151 -0
- package/dist/memory/decision-log.d.ts.map +1 -0
- package/dist/memory/decision-log.js +482 -0
- package/dist/memory/decision-log.js.map +1 -0
- package/dist/memory/persistent-memory.d.ts +182 -0
- package/dist/memory/persistent-memory.d.ts.map +1 -0
- package/dist/memory/persistent-memory.js +579 -0
- package/dist/memory/persistent-memory.js.map +1 -0
- package/dist/memory/session-memory.d.ts +165 -0
- package/dist/memory/session-memory.d.ts.map +1 -0
- package/dist/memory/session-memory.js +382 -0
- package/dist/memory/session-memory.js.map +1 -0
- package/dist/stress-test.d.ts +10 -0
- package/dist/stress-test.d.ts.map +1 -0
- package/dist/stress-test.js +258 -0
- package/dist/stress-test.js.map +1 -0
- package/dist/tools/advanced-tools.d.ts +32 -0
- package/dist/tools/advanced-tools.d.ts.map +1 -0
- package/dist/tools/advanced-tools.js +480 -0
- package/dist/tools/advanced-tools.js.map +1 -0
- package/dist/tools/change-tools.d.ts +76 -0
- package/dist/tools/change-tools.d.ts.map +1 -0
- package/dist/tools/change-tools.js +93 -0
- package/dist/tools/change-tools.js.map +1 -0
- package/dist/tools/context-tools.d.ts +68 -0
- package/dist/tools/context-tools.d.ts.map +1 -0
- package/dist/tools/context-tools.js +141 -0
- package/dist/tools/context-tools.js.map +1 -0
- package/dist/tools/debug-tools.d.ts +25 -0
- package/dist/tools/debug-tools.d.ts.map +1 -0
- package/dist/tools/debug-tools.js +286 -0
- package/dist/tools/debug-tools.js.map +1 -0
- package/dist/tools/evolving-tools.d.ts +23 -0
- package/dist/tools/evolving-tools.d.ts.map +1 -0
- package/dist/tools/evolving-tools.js +207 -0
- package/dist/tools/evolving-tools.js.map +1 -0
- package/dist/tools/flow-tools.d.ts +24 -0
- package/dist/tools/flow-tools.d.ts.map +1 -0
- package/dist/tools/flow-tools.js +265 -0
- package/dist/tools/flow-tools.js.map +1 -0
- package/dist/tools/graph-tools.d.ts +71 -0
- package/dist/tools/graph-tools.d.ts.map +1 -0
- package/dist/tools/graph-tools.js +165 -0
- package/dist/tools/graph-tools.js.map +1 -0
- package/dist/tools/memory-tools.d.ts +62 -0
- package/dist/tools/memory-tools.d.ts.map +1 -0
- package/dist/tools/memory-tools.js +195 -0
- package/dist/tools/memory-tools.js.map +1 -0
- package/dist/tools/smart-tools.d.ts +23 -0
- package/dist/tools/smart-tools.d.ts.map +1 -0
- package/dist/tools/smart-tools.js +482 -0
- package/dist/tools/smart-tools.js.map +1 -0
- package/dist/tools/snapshot-tools.d.ts +19 -0
- package/dist/tools/snapshot-tools.d.ts.map +1 -0
- package/dist/tools/snapshot-tools.js +149 -0
- package/dist/tools/snapshot-tools.js.map +1 -0
- package/dist/types.d.ts +181 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +45 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/logger.d.ts +59 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +142 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/token-counter.d.ts +51 -0
- package/dist/utils/token-counter.d.ts.map +1 -0
- package/dist/utils/token-counter.js +181 -0
- package/dist/utils/token-counter.js.map +1 -0
- package/install.ps1 +321 -0
- package/install.sh +345 -0
- package/package.json +94 -0
- package/setup.bat +62 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI Mind Map — Mini Cypher Query Parser & Executor
|
|
3
|
+
*
|
|
4
|
+
* A read-only openCypher subset that compiles Cypher queries into SQL
|
|
5
|
+
* targeting the knowledge graph's `nodes` and `edges` tables in SQLite.
|
|
6
|
+
*
|
|
7
|
+
* Inspired by codebase-memory-mcp's Cypher-like query interface.
|
|
8
|
+
*
|
|
9
|
+
* Supported Cypher syntax:
|
|
10
|
+
* MATCH (f:Function) RETURN f.name LIMIT 10
|
|
11
|
+
* MATCH (f:Function)-[:CALLS]->(g:Function) WHERE f.name = 'auth' RETURN f.name, g.name
|
|
12
|
+
* MATCH (f:Function) WHERE f.filePath CONTAINS 'auth' RETURN f.name, f.signature
|
|
13
|
+
* MATCH (f:Function) WHERE NOT EXISTS { (f)<-[:CALLS]-() } RETURN f.name
|
|
14
|
+
*/
|
|
15
|
+
import type { KnowledgeGraph } from './graph.js';
|
|
16
|
+
/** The result of executing a Cypher query */
|
|
17
|
+
export interface CypherResult {
|
|
18
|
+
/** Column names in the result set */
|
|
19
|
+
columns: string[];
|
|
20
|
+
/** Array of row objects keyed by column name */
|
|
21
|
+
rows: Record<string, unknown>[];
|
|
22
|
+
/** Total number of rows returned */
|
|
23
|
+
count: number;
|
|
24
|
+
/** The SQL query that was generated (for debugging) */
|
|
25
|
+
generatedSql: string;
|
|
26
|
+
/** Execution time in milliseconds */
|
|
27
|
+
executionTimeMs: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Mini Cypher query engine that compiles Cypher queries into SQL
|
|
31
|
+
* and executes them against the knowledge graph's SQLite database.
|
|
32
|
+
*
|
|
33
|
+
* This is a read-only engine — no CREATE, MERGE, SET, or DELETE.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* const engine = new CypherEngine(db);
|
|
38
|
+
* const result = engine.execute("MATCH (f:Function) RETURN f.name LIMIT 10");
|
|
39
|
+
* console.log(result.rows);
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare class CypherEngine {
|
|
43
|
+
private db;
|
|
44
|
+
/**
|
|
45
|
+
* Create a new CypherEngine.
|
|
46
|
+
*
|
|
47
|
+
* @param graph - A KnowledgeGraph instance (the DB is extracted via graph.getDb())
|
|
48
|
+
*/
|
|
49
|
+
constructor(graph: KnowledgeGraph);
|
|
50
|
+
/**
|
|
51
|
+
* Execute a Cypher query and return the results.
|
|
52
|
+
*
|
|
53
|
+
* @param query - A Cypher query string (read-only subset)
|
|
54
|
+
* @param projectFilter - Optional project path to scope results by filePath
|
|
55
|
+
* @returns The query result with columns, rows, and metadata
|
|
56
|
+
* @throws {CypherSyntaxError} If the query has a syntax error
|
|
57
|
+
* @throws {CypherExecutionError} If the query fails during execution
|
|
58
|
+
*/
|
|
59
|
+
execute(query: string, projectFilter?: string): CypherResult;
|
|
60
|
+
/**
|
|
61
|
+
* Inject a filePath filter into the AST's WHERE clause to scope results to a project path.
|
|
62
|
+
*/
|
|
63
|
+
private injectProjectFilter;
|
|
64
|
+
/**
|
|
65
|
+
* Compile a CypherAST into a SQL query string, bound parameters, and column list.
|
|
66
|
+
*/
|
|
67
|
+
private compileToSql;
|
|
68
|
+
/**
|
|
69
|
+
* Compile a WHERE expression into a SQL fragment, appending bound params.
|
|
70
|
+
*/
|
|
71
|
+
private compileWhereExpr;
|
|
72
|
+
/**
|
|
73
|
+
* Compile a comparison expression into SQL.
|
|
74
|
+
*/
|
|
75
|
+
private compileComparison;
|
|
76
|
+
/**
|
|
77
|
+
* Compile a NOT EXISTS pattern into a SQL NOT EXISTS subquery.
|
|
78
|
+
*/
|
|
79
|
+
private compileNotExists;
|
|
80
|
+
/**
|
|
81
|
+
* Resolve a property reference to a SQL column expression.
|
|
82
|
+
*/
|
|
83
|
+
private resolvePropertyRef;
|
|
84
|
+
/**
|
|
85
|
+
* Resolve a Cypher node label to the internal node type string.
|
|
86
|
+
*/
|
|
87
|
+
private resolveNodeLabel;
|
|
88
|
+
/**
|
|
89
|
+
* Resolve a Cypher edge type label to the internal edge type string.
|
|
90
|
+
*/
|
|
91
|
+
private resolveEdgeType;
|
|
92
|
+
/**
|
|
93
|
+
* Convert a Cypher literal to a SQL-safe value.
|
|
94
|
+
*/
|
|
95
|
+
private toLiteralSqlValue;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Syntax error in a Cypher query string.
|
|
99
|
+
*/
|
|
100
|
+
export declare class CypherSyntaxError extends Error {
|
|
101
|
+
/** Character position where the error occurred */
|
|
102
|
+
readonly position: number;
|
|
103
|
+
constructor(message: string, position: number);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Runtime error during Cypher query execution.
|
|
107
|
+
*/
|
|
108
|
+
export declare class CypherExecutionError extends Error {
|
|
109
|
+
/** The original Cypher query that caused the error */
|
|
110
|
+
readonly query: string;
|
|
111
|
+
constructor(message: string, query: string);
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=cypher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cypher.d.ts","sourceRoot":"","sources":["../../src/knowledge-graph/cypher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAMjD,6CAA6C;AAC7C,MAAM,WAAW,YAAY;IAC3B,qCAAqC;IACrC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IAChC,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,YAAY,EAAE,MAAM,CAAC;IACrB,qCAAqC;IACrC,eAAe,EAAE,MAAM,CAAC;CACzB;AAs1BD;;;;;;;;;;;;GAYG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,EAAE,CAAoB;IAE9B;;;;OAIG;gBACS,KAAK,EAAE,cAAc;IAIjC;;;;;;;;OAQG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,YAAY;IAwC5D;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAmB3B;;OAEG;IACH,OAAO,CAAC,YAAY;IA2IpB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAmBxB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAoCzB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAiCxB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAuB1B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAWxB;;OAEG;IACH,OAAO,CAAC,eAAe;IAWvB;;OAEG;IACH,OAAO,CAAC,iBAAiB;CAI1B;AAMD;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,kDAAkD;IAClD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;gBAEd,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;CAK9C;AAED;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,sDAAsD;IACtD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;gBAEX,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;CAK3C"}
|