claude-ex 1.2.0 → 1.4.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 +175 -31
- package/dist/claude/claudemd.js +94 -33
- package/dist/claude/claudemd.js.map +1 -1
- package/dist/claude/mcp.js +162 -139
- package/dist/claude/mcp.js.map +1 -1
- package/dist/db/schema.js +64 -13
- package/dist/db/schema.js.map +1 -1
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/indexer/index.js +39 -24
- package/dist/indexer/index.js.map +1 -1
- package/dist/query/engine.d.ts +2 -0
- package/dist/query/engine.js +740 -137
- package/dist/query/engine.js.map +1 -1
- package/dist/watcher/daemon.js +19 -12
- package/dist/watcher/daemon.js.map +1 -1
- package/package.json +36 -18
package/dist/claude/mcp.js
CHANGED
|
@@ -32,175 +32,190 @@ async function runMcpServer() {
|
|
|
32
32
|
catch (err) {
|
|
33
33
|
process.stderr.write(`[codex-mcp] Watcher failed to start: ${err}\n`);
|
|
34
34
|
}
|
|
35
|
+
// Pre-warm statement cache + SQLite page cache
|
|
36
|
+
try {
|
|
37
|
+
(0, engine_1.getStats)(db);
|
|
38
|
+
(0, engine_1.search)(db, 'a', 1);
|
|
39
|
+
}
|
|
40
|
+
catch { /* warm-up, ignore errors */ }
|
|
35
41
|
const server = new index_js_1.Server({ name: 'claude-ex', version: '1.0.0' }, { capabilities: { tools: {} } });
|
|
36
|
-
//
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
limit: { type: 'number', description: 'Max results (default 15)' },
|
|
47
|
-
},
|
|
48
|
-
required: ['query'],
|
|
42
|
+
// Memoized tool list (allocated once, not per request)
|
|
43
|
+
const TOOL_LIST = [
|
|
44
|
+
{
|
|
45
|
+
name: 'search_code',
|
|
46
|
+
description: 'Search codebase for symbols by name, description, or content. Results ranked by structural importance (PageRank). Faster and more precise than grep for finding the right code.',
|
|
47
|
+
inputSchema: {
|
|
48
|
+
type: 'object',
|
|
49
|
+
properties: {
|
|
50
|
+
query: { type: 'string', description: 'Search query (natural language or symbol name)' },
|
|
51
|
+
limit: { type: 'number', description: 'Max results (default 15)' },
|
|
49
52
|
},
|
|
53
|
+
required: ['query'],
|
|
50
54
|
},
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
},
|
|
59
|
-
required: ['name'],
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'get_symbol',
|
|
58
|
+
description: 'Get complete context for a symbol: its code, what it depends on, what depends on it, co-located symbols. Use before modifying any symbol.',
|
|
59
|
+
inputSchema: {
|
|
60
|
+
type: 'object',
|
|
61
|
+
properties: {
|
|
62
|
+
name: { type: 'string', description: 'Symbol name or qualified name (e.g., processPayment or PaymentService.processPayment)' },
|
|
60
63
|
},
|
|
64
|
+
required: ['name'],
|
|
61
65
|
},
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
},
|
|
70
|
-
required: ['name'],
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: 'get_callers',
|
|
69
|
+
description: 'Find all callers of a function or method. Use before renaming, changing signatures, or removing functions.',
|
|
70
|
+
inputSchema: {
|
|
71
|
+
type: 'object',
|
|
72
|
+
properties: {
|
|
73
|
+
name: { type: 'string', description: 'Function or method name' },
|
|
71
74
|
},
|
|
75
|
+
required: ['name'],
|
|
72
76
|
},
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
},
|
|
82
|
-
required: ['file'],
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: 'get_dependents',
|
|
80
|
+
description: 'Find all files transitively affected if a file changes. Use before refactors that change exports or file structure.',
|
|
81
|
+
inputSchema: {
|
|
82
|
+
type: 'object',
|
|
83
|
+
properties: {
|
|
84
|
+
file: { type: 'string', description: 'File path relative to project root' },
|
|
85
|
+
maxDepth: { type: 'number', description: 'Max traversal depth (default 10)' },
|
|
83
86
|
},
|
|
87
|
+
required: ['file'],
|
|
84
88
|
},
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
},
|
|
93
|
-
required: ['name'],
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: 'get_dependencies',
|
|
92
|
+
description: 'Find what a symbol depends on (imports, inherited classes, referenced types).',
|
|
93
|
+
inputSchema: {
|
|
94
|
+
type: 'object',
|
|
95
|
+
properties: {
|
|
96
|
+
name: { type: 'string', description: 'Symbol name' },
|
|
94
97
|
},
|
|
98
|
+
required: ['name'],
|
|
95
99
|
},
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
},
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
name: 'get_architecture',
|
|
103
|
+
description: 'Get project architecture overview: top symbols by importance, module dependency map, language breakdown.',
|
|
104
|
+
inputSchema: {
|
|
105
|
+
type: 'object',
|
|
106
|
+
properties: {
|
|
107
|
+
top: { type: 'number', description: 'Number of top symbols to include (default 20)' },
|
|
104
108
|
},
|
|
105
109
|
},
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: 'get_file_map',
|
|
113
|
+
description: 'Get a map of every file in the project with its exported symbols. Use to understand where things live without searching. Returns file paths with their key exports.',
|
|
114
|
+
inputSchema: {
|
|
115
|
+
type: 'object',
|
|
116
|
+
properties: {},
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
name: 'find_files',
|
|
121
|
+
description: 'Find files by path pattern using glob syntax (e.g. "**/*.test.ts", "src/components/*", "*.json"). Faster than shell find/ls commands. Searches indexed files only.',
|
|
122
|
+
inputSchema: {
|
|
123
|
+
type: 'object',
|
|
124
|
+
properties: {
|
|
125
|
+
pattern: { type: 'string', description: 'Glob pattern to match file paths (e.g. "**/*.ts", "src/**/*.test.*", "*.json")' },
|
|
126
|
+
limit: { type: 'number', description: 'Max results (default 50)' },
|
|
112
127
|
},
|
|
128
|
+
required: ['pattern'],
|
|
113
129
|
},
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
},
|
|
123
|
-
required: ['pattern'],
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
name: 'get_file_symbols',
|
|
133
|
+
description: 'Get all symbols (functions, classes, variables, etc.) in a specific file. Shows every definition with its kind, line range, signature, and parameters.',
|
|
134
|
+
inputSchema: {
|
|
135
|
+
type: 'object',
|
|
136
|
+
properties: {
|
|
137
|
+
file: { type: 'string', description: 'File path relative to project root' },
|
|
124
138
|
},
|
|
139
|
+
required: ['file'],
|
|
125
140
|
},
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
},
|
|
134
|
-
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
name: 'find_by_kind',
|
|
144
|
+
description: 'Find all symbols of a specific kind (class, function, interface, type, enum, method, variable). Ranked by structural importance.',
|
|
145
|
+
inputSchema: {
|
|
146
|
+
type: 'object',
|
|
147
|
+
properties: {
|
|
148
|
+
kind: { type: 'string', description: 'Symbol kind: class, function, interface, type, enum, method, variable, reexport' },
|
|
149
|
+
limit: { type: 'number', description: 'Max results (default 50)' },
|
|
135
150
|
},
|
|
151
|
+
required: ['kind'],
|
|
136
152
|
},
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
},
|
|
146
|
-
required: ['kind'],
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
name: 'get_type_hierarchy',
|
|
156
|
+
description: 'Find all classes that extend or implement a given class/interface. Use before changing a base class or interface to find all affected subclasses/implementors.',
|
|
157
|
+
inputSchema: {
|
|
158
|
+
type: 'object',
|
|
159
|
+
properties: {
|
|
160
|
+
name: { type: 'string', description: 'Class or interface name to find subclasses/implementors of' },
|
|
147
161
|
},
|
|
162
|
+
required: ['name'],
|
|
148
163
|
},
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
},
|
|
157
|
-
required: ['name'],
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
name: 'find_dead_exports',
|
|
167
|
+
description: 'Find exported symbols that nothing imports or references. Useful for dead code detection and cleanup.',
|
|
168
|
+
inputSchema: {
|
|
169
|
+
type: 'object',
|
|
170
|
+
properties: {
|
|
171
|
+
limit: { type: 'number', description: 'Max results (default 50)' },
|
|
158
172
|
},
|
|
159
173
|
},
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
},
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: 'get_pkg_usages',
|
|
177
|
+
description: 'Find all files that import from a given npm/pip/cargo package. Use before swapping a library to find every usage point. Example: "react", "lodash", "express".',
|
|
178
|
+
inputSchema: {
|
|
179
|
+
type: 'object',
|
|
180
|
+
properties: {
|
|
181
|
+
package: { type: 'string', description: 'Package name (e.g., "react", "lodash", "express")' },
|
|
168
182
|
},
|
|
183
|
+
required: ['package'],
|
|
169
184
|
},
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
},
|
|
178
|
-
required: ['package'],
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
name: 'reindex_file',
|
|
188
|
+
description: 'Re-index a single file immediately.',
|
|
189
|
+
inputSchema: {
|
|
190
|
+
type: 'object',
|
|
191
|
+
properties: {
|
|
192
|
+
file: { type: 'string', description: 'File path relative to project root' },
|
|
179
193
|
},
|
|
194
|
+
required: ['file'],
|
|
180
195
|
},
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
},
|
|
189
|
-
required: ['file'],
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
name: 'review_diff',
|
|
199
|
+
description: 'Gather graph-aware review context for a git diff. Parses the diff, maps changed lines to symbols, finds callers/dependents of changed code, computes cross-file impact, and flags risks. Returns structured context for writing a codebase-aware code review.',
|
|
200
|
+
inputSchema: {
|
|
201
|
+
type: 'object',
|
|
202
|
+
properties: {
|
|
203
|
+
target: { type: 'string', description: 'What to review: "last_commit" (default), "staged", "branch" (diff vs main/master), or a commit SHA' },
|
|
190
204
|
},
|
|
191
205
|
},
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
},
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
name: 'transparent_review',
|
|
209
|
+
description: 'Zero-black-box code review. Shows EXACT before/after code for every changed symbol, plain-English explanation of what each change does (parameter changes, new branches, error handling, async changes), who calls the changed code and how they are affected, full blast radius grouped by depth, and risk assessment. Returns a readable narrative — not raw JSON. Use this when you want to truly understand a diff, not just see metadata about it.',
|
|
210
|
+
inputSchema: {
|
|
211
|
+
type: 'object',
|
|
212
|
+
properties: {
|
|
213
|
+
target: { type: 'string', description: 'What to review: "last_commit" (default), "staged", "branch" (diff vs main/master), or a commit SHA' },
|
|
200
214
|
},
|
|
201
215
|
},
|
|
202
|
-
|
|
203
|
-
|
|
216
|
+
},
|
|
217
|
+
];
|
|
218
|
+
server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => ({ tools: TOOL_LIST }));
|
|
204
219
|
// Handle tool calls
|
|
205
220
|
server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
|
|
206
221
|
const { name, arguments: args } = request.params;
|
|
@@ -263,6 +278,14 @@ async function runMcpServer() {
|
|
|
263
278
|
case 'review_diff':
|
|
264
279
|
result = (0, engine_1.reviewDiff)(db, rootDir, args?.target || 'last_commit');
|
|
265
280
|
break;
|
|
281
|
+
case 'transparent_review': {
|
|
282
|
+
const narrative = (0, engine_1.transparentReview)(db, rootDir, args?.target || 'last_commit');
|
|
283
|
+
const elapsed2 = (performance.now() - callStart).toFixed(1);
|
|
284
|
+
process.stderr.write(`[codex-mcp] transparent_review completed in ${elapsed2}ms\n`);
|
|
285
|
+
return {
|
|
286
|
+
content: [{ type: 'text', text: narrative }],
|
|
287
|
+
};
|
|
288
|
+
}
|
|
266
289
|
default:
|
|
267
290
|
return {
|
|
268
291
|
content: [{ type: 'text', text: `Unknown tool: ${name}` }],
|
|
@@ -274,7 +297,7 @@ async function runMcpServer() {
|
|
|
274
297
|
return {
|
|
275
298
|
content: [{
|
|
276
299
|
type: 'text',
|
|
277
|
-
text: JSON.stringify(result
|
|
300
|
+
text: JSON.stringify(result),
|
|
278
301
|
}],
|
|
279
302
|
};
|
|
280
303
|
}
|
package/dist/claude/mcp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/claude/mcp.ts"],"names":[],"mappings":";;AAiBA,
|
|
1
|
+
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/claude/mcp.ts"],"names":[],"mappings":";;AAiBA,oCAqUC;AAtVD,wEAAmE;AACnE,wEAAiF;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;QAClB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;QACvD,IAAI,OAAO;YAAE,OAAO,CAAC,KAAK,EAAE,CAAC;QAC7B,EAAE,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC,CAAC;IAEF,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AACpC,CAAC"}
|
package/dist/db/schema.js
CHANGED
|
@@ -116,18 +116,31 @@ const FTS_SQL = `
|
|
|
116
116
|
CREATE VIRTUAL TABLE IF NOT EXISTS symbols_fts USING fts5(
|
|
117
117
|
name, qualified_name, signature, docstring, content,
|
|
118
118
|
content='symbols', content_rowid='id',
|
|
119
|
-
tokenize='porter unicode61'
|
|
119
|
+
tokenize='porter unicode61',
|
|
120
|
+
prefix='2 4'
|
|
121
|
+
);
|
|
122
|
+
`;
|
|
123
|
+
const TRIGRAM_SQL = `
|
|
124
|
+
CREATE VIRTUAL TABLE IF NOT EXISTS symbols_trigram USING fts5(
|
|
125
|
+
name, qualified_name, signature,
|
|
126
|
+
content='symbols', content_rowid='id',
|
|
127
|
+
tokenize='trigram',
|
|
128
|
+
detail='none'
|
|
120
129
|
);
|
|
121
130
|
`;
|
|
122
131
|
const TRIGGERS_SQL = `
|
|
123
132
|
CREATE TRIGGER IF NOT EXISTS symbols_ai AFTER INSERT ON symbols BEGIN
|
|
124
133
|
INSERT INTO symbols_fts(rowid, name, qualified_name, signature, docstring, content)
|
|
125
134
|
VALUES (new.id, new.name, new.qualified_name, new.signature, new.docstring, new.content);
|
|
135
|
+
INSERT INTO symbols_trigram(rowid, name, qualified_name, signature)
|
|
136
|
+
VALUES (new.id, new.name, new.qualified_name, new.signature);
|
|
126
137
|
END;
|
|
127
138
|
|
|
128
139
|
CREATE TRIGGER IF NOT EXISTS symbols_ad AFTER DELETE ON symbols BEGIN
|
|
129
140
|
INSERT INTO symbols_fts(symbols_fts, rowid, name, qualified_name, signature, docstring, content)
|
|
130
141
|
VALUES('delete', old.id, old.name, old.qualified_name, old.signature, old.docstring, old.content);
|
|
142
|
+
INSERT INTO symbols_trigram(symbols_trigram, rowid, name, qualified_name, signature)
|
|
143
|
+
VALUES('delete', old.id, old.name, old.qualified_name, old.signature);
|
|
131
144
|
END;
|
|
132
145
|
|
|
133
146
|
CREATE TRIGGER IF NOT EXISTS symbols_au AFTER UPDATE ON symbols BEGIN
|
|
@@ -135,6 +148,10 @@ CREATE TRIGGER IF NOT EXISTS symbols_au AFTER UPDATE ON symbols BEGIN
|
|
|
135
148
|
VALUES('delete', old.id, old.name, old.qualified_name, old.signature, old.docstring, old.content);
|
|
136
149
|
INSERT INTO symbols_fts(rowid, name, qualified_name, signature, docstring, content)
|
|
137
150
|
VALUES (new.id, new.name, new.qualified_name, new.signature, new.docstring, new.content);
|
|
151
|
+
INSERT INTO symbols_trigram(symbols_trigram, rowid, name, qualified_name, signature)
|
|
152
|
+
VALUES('delete', old.id, old.name, old.qualified_name, old.signature);
|
|
153
|
+
INSERT INTO symbols_trigram(rowid, name, qualified_name, signature)
|
|
154
|
+
VALUES (new.id, new.name, new.qualified_name, new.signature);
|
|
138
155
|
END;
|
|
139
156
|
`;
|
|
140
157
|
const INDEXES_SQL = `
|
|
@@ -152,6 +169,11 @@ CREATE INDEX IF NOT EXISTS idx_pkg_deps_package ON pkg_deps(package);
|
|
|
152
169
|
CREATE INDEX IF NOT EXISTS idx_pkg_deps_file ON pkg_deps(file_id);
|
|
153
170
|
CREATE INDEX IF NOT EXISTS idx_type_relations_parent ON type_relations(parent_name);
|
|
154
171
|
CREATE INDEX IF NOT EXISTS idx_type_relations_child ON type_relations(child_id);
|
|
172
|
+
CREATE INDEX IF NOT EXISTS idx_files_path ON files(path);
|
|
173
|
+
CREATE INDEX IF NOT EXISTS idx_symbols_file_line ON symbols(file_id, line_start);
|
|
174
|
+
CREATE INDEX IF NOT EXISTS idx_file_deps_to_from ON file_deps(to_file, from_file);
|
|
175
|
+
CREATE INDEX IF NOT EXISTS idx_symbols_exported_kind ON symbols(exported, kind);
|
|
176
|
+
CREATE INDEX IF NOT EXISTS idx_rankings_pagerank ON rankings(pagerank DESC);
|
|
155
177
|
`;
|
|
156
178
|
const PRAGMAS = [
|
|
157
179
|
'PRAGMA journal_mode = WAL',
|
|
@@ -170,8 +192,19 @@ function openDatabase(projectRoot, work) {
|
|
|
170
192
|
}
|
|
171
193
|
db.exec(SCHEMA_SQL);
|
|
172
194
|
db.exec(FTS_SQL);
|
|
173
|
-
db.exec(TRIGGERS_SQL);
|
|
174
195
|
db.exec(INDEXES_SQL);
|
|
196
|
+
// Trigram table — may fail on older SQLite without trigram tokenizer
|
|
197
|
+
try {
|
|
198
|
+
db.exec(TRIGRAM_SQL);
|
|
199
|
+
}
|
|
200
|
+
catch { /* trigram tokenizer not available */ }
|
|
201
|
+
// Recreate triggers to include trigram sync (DROP + CREATE is safe)
|
|
202
|
+
db.exec(`
|
|
203
|
+
DROP TRIGGER IF EXISTS symbols_ai;
|
|
204
|
+
DROP TRIGGER IF EXISTS symbols_ad;
|
|
205
|
+
DROP TRIGGER IF EXISTS symbols_au;
|
|
206
|
+
`);
|
|
207
|
+
db.exec(TRIGGERS_SQL);
|
|
175
208
|
// Migrations for existing databases
|
|
176
209
|
migrateSchema(db);
|
|
177
210
|
return db;
|
|
@@ -215,31 +248,49 @@ function getOrCreateFile(db, filePath, hash, language, lineCount, lastModified)
|
|
|
215
248
|
const result = insert.run(filePath, hash, language, lineCount, lastModified || Date.now(), Date.now());
|
|
216
249
|
return { id: Number(result.lastInsertRowid), changed: true };
|
|
217
250
|
}
|
|
251
|
+
const clearStmts = new WeakMap();
|
|
218
252
|
function clearFileData(db, fileId) {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
253
|
+
let stmts = clearStmts.get(db);
|
|
254
|
+
if (!stmts) {
|
|
255
|
+
stmts = [
|
|
256
|
+
db.prepare('DELETE FROM rankings WHERE symbol_id IN (SELECT id FROM symbols WHERE file_id = ?)'),
|
|
257
|
+
db.prepare('DELETE FROM type_relations WHERE child_id IN (SELECT id FROM symbols WHERE file_id = ?)'),
|
|
258
|
+
db.prepare('DELETE FROM edges WHERE from_id IN (SELECT id FROM symbols WHERE file_id = ?) OR to_id IN (SELECT id FROM symbols WHERE file_id = ?)'),
|
|
259
|
+
db.prepare('DELETE FROM symbols WHERE file_id = ?'),
|
|
260
|
+
db.prepare('DELETE FROM file_deps WHERE from_file = ?'),
|
|
261
|
+
db.prepare('DELETE FROM pkg_deps WHERE file_id = ?'),
|
|
262
|
+
];
|
|
263
|
+
clearStmts.set(db, stmts);
|
|
264
|
+
}
|
|
265
|
+
stmts[0].run(fileId);
|
|
266
|
+
stmts[1].run(fileId);
|
|
267
|
+
stmts[2].run(fileId, fileId);
|
|
268
|
+
stmts[3].run(fileId);
|
|
269
|
+
stmts[4].run(fileId);
|
|
270
|
+
stmts[5].run(fileId);
|
|
225
271
|
}
|
|
272
|
+
const insertSymbolStmt = new WeakMap();
|
|
226
273
|
function insertSymbol(db, fileId, sym) {
|
|
227
|
-
const stmt = db
|
|
274
|
+
const stmt = getOrPrepare(insertSymbolStmt, db, `INSERT INTO symbols (name, qualified_name, kind, file_id, line_start, line_end, signature, docstring, content, content_hash, exported, parameters)
|
|
228
275
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`);
|
|
229
276
|
const result = stmt.run(sym.name, sym.qualifiedName || null, sym.kind, fileId, sym.lineStart, sym.lineEnd, sym.signature || null, sym.docstring || null, sym.content || null, sym.contentHash || null, sym.exported ? 1 : 0, sym.parameters || null);
|
|
230
277
|
return Number(result.lastInsertRowid);
|
|
231
278
|
}
|
|
279
|
+
const insertEdgeStmt = new WeakMap();
|
|
232
280
|
function insertEdge(db, fromId, toId, kind, line) {
|
|
233
|
-
db
|
|
281
|
+
getOrPrepare(insertEdgeStmt, db, 'INSERT OR IGNORE INTO edges (from_id, to_id, kind, line) VALUES (?, ?, ?, ?)').run(fromId, toId, kind, line || null);
|
|
234
282
|
}
|
|
283
|
+
const insertPkgDepStmt = new WeakMap();
|
|
235
284
|
function insertPkgDep(db, fileId, packageName, importedNames) {
|
|
236
|
-
db
|
|
285
|
+
getOrPrepare(insertPkgDepStmt, db, 'INSERT OR IGNORE INTO pkg_deps (file_id, package, imported_names) VALUES (?, ?, ?)').run(fileId, packageName, importedNames);
|
|
237
286
|
}
|
|
287
|
+
const insertTypeRelationStmt = new WeakMap();
|
|
238
288
|
function insertTypeRelation(db, childId, parentName, kind) {
|
|
239
|
-
db
|
|
289
|
+
getOrPrepare(insertTypeRelationStmt, db, 'INSERT OR IGNORE INTO type_relations (child_id, parent_name, kind) VALUES (?, ?, ?)').run(childId, parentName, kind);
|
|
240
290
|
}
|
|
291
|
+
const insertFileDepStmt = new WeakMap();
|
|
241
292
|
function insertFileDep(db, fromFile, toFile, kind, importName) {
|
|
242
|
-
db
|
|
293
|
+
getOrPrepare(insertFileDepStmt, db, 'INSERT OR IGNORE INTO file_deps (from_file, to_file, kind, import_name) VALUES (?, ?, ?, ?)').run(fromFile, toFile, kind, importName);
|
|
243
294
|
}
|
|
244
295
|
function removeStaleFiles(db, validPaths) {
|
|
245
296
|
const allFiles = db.prepare('SELECT id, path FROM files').all();
|
package/dist/db/schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/db/schema.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/db/schema.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiJA,oCA4BC;AAmCD,0CAgCC;AAID,s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iB,EAAE,EAAE,EAAE,6FAA6F,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;AAC/K,CAAC;AAED,SAAgB,gBAAgB,CAAC,EAAqB,EAAE,UAAuB;IAC3E,MAAM,QAAQ,GAAG,EAAE,CAAC,OAAO,CAAC,4BAA4B,CAAC,CAAC,GAAG,EAAoC,CAAC;IAClG,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC;QAC1B,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAC7B,aAAa,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;YAC3B,EAAE,CAAC,OAAO,CAAC,gCAAgC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAC1D,OAAO,EAAE,CAAC;QACd,CAAC;IACL,CAAC;IACD,OAAO,OAAO,CAAC;AACnB,CAAC;AAED,SAAgB,UAAU,CAAC,EAAqB,EAAE,QAAgB;IAC9D,MAAM,IAAI,GAAG,EAAE,CAAC,OAAO,CAAC,qCAAqC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAA+B,CAAC;IAC3G,IAAI,IAAI,EAAE,CAAC;QACP,aAAa,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;QAC3B,EAAE,CAAC,OAAO,CAAC,gCAAgC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC9D,CAAC;AACL,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -234,6 +234,16 @@ program
|
|
|
234
234
|
const result = (0, engine_1.reviewDiffFromRoot)(rootDir, target || 'last_commit');
|
|
235
235
|
console.log(JSON.stringify(result, null, 2));
|
|
236
236
|
});
|
|
237
|
+
// --- transparent-review ---
|
|
238
|
+
program
|
|
239
|
+
.command('transparent-review')
|
|
240
|
+
.argument('[target]', 'What to review: last_commit (default), staged, branch, or commit SHA')
|
|
241
|
+
.description('Zero-black-box review: shows exact before/after code, plain-English explanations, caller impact, and blast radius')
|
|
242
|
+
.action((target) => {
|
|
243
|
+
const rootDir = requireIndex();
|
|
244
|
+
const result = (0, engine_1.transparentReviewFromRoot)(rootDir, target || 'last_commit');
|
|
245
|
+
console.log(result);
|
|
246
|
+
});
|
|
237
247
|
// --- generate-docs ---
|
|
238
248
|
program
|
|
239
249
|
.command('generate-docs')
|