grepmax 0.26.26 → 0.26.28
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/.claude-plugin/marketplace.json +1 -1
- package/README.md +40 -0
- package/dist/commands/audit.js +28 -260
- package/dist/commands/context.js +42 -26
- package/dist/commands/dead.js +37 -35
- package/dist/commands/doctor.js +280 -10
- package/dist/commands/extract.js +79 -49
- package/dist/commands/impact.js +74 -20
- package/dist/commands/log.js +25 -25
- package/dist/commands/mcp.js +622 -474
- package/dist/commands/peek.js +49 -47
- package/dist/commands/project.js +29 -107
- package/dist/commands/related.js +43 -52
- package/dist/commands/search-run.js +23 -8
- package/dist/commands/search.js +7 -2
- package/dist/commands/similar.js +50 -76
- package/dist/commands/skeleton.js +137 -83
- package/dist/commands/status.js +90 -25
- package/dist/commands/surprises.js +73 -16
- package/dist/commands/symbols.js +58 -77
- package/dist/commands/test-find.js +51 -17
- package/dist/commands/trace.js +26 -11
- package/dist/lib/daemon/daemon.js +26 -0
- package/dist/lib/daemon/graph-handler.js +853 -0
- package/dist/lib/daemon/ipc-handler.js +19 -2
- package/dist/lib/daemon/read-verbs.js +105 -0
- package/dist/lib/daemon/rows-handler.js +665 -0
- package/dist/lib/daemon/vector-handler.js +199 -0
- package/dist/lib/store/vector-db.js +1 -1
- package/dist/lib/utils/daemon-client.js +11 -0
- package/dist/lib/utils/store-access.js +381 -0
- package/dist/lib/utils/tests-footer.js +19 -2
- package/dist/lib/utils/watcher-launcher.js +10 -0
- package/package.json +2 -2
- package/plugins/grepmax/.claude-plugin/plugin.json +1 -1
- package/scripts/postinstall.js +0 -69
package/dist/commands/impact.js
CHANGED
|
@@ -45,6 +45,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
45
45
|
exports.impact = void 0;
|
|
46
46
|
const path = __importStar(require("node:path"));
|
|
47
47
|
const commander_1 = require("commander");
|
|
48
|
+
const graph_handler_1 = require("../lib/daemon/graph-handler");
|
|
48
49
|
const impact_1 = require("../lib/graph/impact");
|
|
49
50
|
const impact_rollup_1 = require("../lib/graph/impact-rollup");
|
|
50
51
|
const test_hits_1 = require("../lib/graph/test-hits");
|
|
@@ -54,6 +55,7 @@ const exit_1 = require("../lib/utils/exit");
|
|
|
54
55
|
const project_registry_1 = require("../lib/utils/project-registry");
|
|
55
56
|
const project_root_1 = require("../lib/utils/project-root");
|
|
56
57
|
const stale_hint_1 = require("../lib/utils/stale-hint");
|
|
58
|
+
const store_access_1 = require("../lib/utils/store-access");
|
|
57
59
|
exports.impact = new commander_1.Command("impact")
|
|
58
60
|
.description("Analyze change impact: dependents and affected tests")
|
|
59
61
|
.argument("<target>", "Symbol name or file path")
|
|
@@ -72,7 +74,8 @@ exports.impact = new commander_1.Command("impact")
|
|
|
72
74
|
// commander maps --no-tests → opts.tests === false (defaults true).
|
|
73
75
|
const includeTests = opts.tests !== false;
|
|
74
76
|
const top = Math.min(Math.max(Number.parseInt(opts.top || "10", 10) || 10, 1), 100);
|
|
75
|
-
|
|
77
|
+
// Opened only if the daemon is unreachable; withStoreRead decides.
|
|
78
|
+
const local = { db: null };
|
|
76
79
|
try {
|
|
77
80
|
const root = (0, project_registry_1.resolveRootOrExit)(opts.root);
|
|
78
81
|
if (root === null)
|
|
@@ -80,9 +83,31 @@ exports.impact = new commander_1.Command("impact")
|
|
|
80
83
|
const projectRoot = (_a = (0, project_root_1.findProjectRoot)(root)) !== null && _a !== void 0 ? _a : root;
|
|
81
84
|
(0, stale_hint_1.maybeWarnStaleChunker)(projectRoot, { agent: opts.agent });
|
|
82
85
|
(0, stale_hint_1.maybeWarnStaleEmbedding)(projectRoot, { agent: opts.agent });
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
+
const localDb = () => {
|
|
87
|
+
var _a;
|
|
88
|
+
(_a = local.db) !== null && _a !== void 0 ? _a : (local.db = new vector_db_1.VectorDB((0, project_root_1.ensureProjectPaths)(projectRoot).lancedbDir));
|
|
89
|
+
return local.db;
|
|
90
|
+
};
|
|
91
|
+
const { resolveScope } = yield Promise.resolve().then(() => __importStar(require("../lib/utils/scope-filter")));
|
|
92
|
+
const scope = resolveScope({
|
|
93
|
+
projectRoot,
|
|
94
|
+
in: opts.in,
|
|
95
|
+
exclude: opts.exclude,
|
|
96
|
+
});
|
|
97
|
+
const { symbols, resolvedAsFile, symbolFamilies } = yield (0, graph_handler_1.callGraphVerb)("graph.resolve", {
|
|
98
|
+
projectRoot,
|
|
99
|
+
scope,
|
|
100
|
+
payload: { target },
|
|
101
|
+
render: (resp) => {
|
|
102
|
+
var _a, _b;
|
|
103
|
+
return ({
|
|
104
|
+
symbols: (_a = resp.symbols) !== null && _a !== void 0 ? _a : [],
|
|
105
|
+
resolvedAsFile: resp.resolvedAsFile === true,
|
|
106
|
+
symbolFamilies: (_b = resp.symbolFamilies) !== null && _b !== void 0 ? _b : null,
|
|
107
|
+
});
|
|
108
|
+
},
|
|
109
|
+
inProcess: () => (0, graph_handler_1.runGraphResolve)(localDb(), { target, projectRoot }),
|
|
110
|
+
});
|
|
86
111
|
if (symbols.length === 0) {
|
|
87
112
|
console.log(resolvedAsFile
|
|
88
113
|
? `No symbols found in file: ${target}`
|
|
@@ -96,13 +121,7 @@ exports.impact = new commander_1.Command("impact")
|
|
|
96
121
|
? target
|
|
97
122
|
: path.resolve(projectRoot, target)
|
|
98
123
|
: undefined;
|
|
99
|
-
const excludePaths = targetPath ?
|
|
100
|
-
const { resolveScope } = yield Promise.resolve().then(() => __importStar(require("../lib/utils/scope-filter")));
|
|
101
|
-
const scope = resolveScope({
|
|
102
|
-
projectRoot,
|
|
103
|
-
in: opts.in,
|
|
104
|
-
exclude: opts.exclude,
|
|
105
|
-
});
|
|
124
|
+
const excludePaths = targetPath ? [targetPath] : undefined;
|
|
106
125
|
// Treat --in as an exclude-everything-else when set: any prefix that
|
|
107
126
|
// isn't the --in scope becomes effectively excluded. Today findDependents
|
|
108
127
|
// always queries within projectRoot; passing scope.pathPrefix when --in
|
|
@@ -112,15 +131,46 @@ exports.impact = new commander_1.Command("impact")
|
|
|
112
131
|
: projectRoot;
|
|
113
132
|
const useRollup = !opts.flat && ((resolvedAsFile && !opts.agent) || opts.rollup === true);
|
|
114
133
|
const rollupLimit = Math.min(Math.max(top * 10, 100), 500);
|
|
134
|
+
const families = (0, graph_handler_1.decodeSymbolFamilies)(symbolFamilies);
|
|
115
135
|
// Run dependents and tests in parallel. --no-tests skips the test
|
|
116
136
|
// traversal entirely so the affected-tests section is omitted (not just
|
|
117
137
|
// empty) below.
|
|
118
138
|
const [dependents, tests] = yield Promise.all([
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
139
|
+
(0, graph_handler_1.callGraphVerb)("graph.dependents", {
|
|
140
|
+
projectRoot,
|
|
141
|
+
scope,
|
|
142
|
+
payload: {
|
|
143
|
+
symbols,
|
|
144
|
+
detailed: useRollup,
|
|
145
|
+
excludePaths,
|
|
146
|
+
limit: useRollup ? rollupLimit : undefined,
|
|
147
|
+
families: symbolFamilies,
|
|
148
|
+
},
|
|
149
|
+
render: (resp) => { var _a; return (_a = resp.dependents) !== null && _a !== void 0 ? _a : []; },
|
|
150
|
+
inProcess: () => (0, graph_handler_1.runGraphDependents)(localDb(), {
|
|
151
|
+
symbols,
|
|
152
|
+
queryRoot,
|
|
153
|
+
detailed: useRollup,
|
|
154
|
+
excludePaths,
|
|
155
|
+
limit: useRollup ? rollupLimit : undefined,
|
|
156
|
+
excludePrefixes: scope.excludePrefixes,
|
|
157
|
+
families,
|
|
158
|
+
}),
|
|
159
|
+
}),
|
|
122
160
|
includeTests
|
|
123
|
-
? (0,
|
|
161
|
+
? (0, graph_handler_1.callGraphVerb)("graph.tests", {
|
|
162
|
+
projectRoot,
|
|
163
|
+
scope,
|
|
164
|
+
payload: { symbols, depth, families: symbolFamilies },
|
|
165
|
+
render: (resp) => { var _a; return (_a = resp.hits) !== null && _a !== void 0 ? _a : []; },
|
|
166
|
+
inProcess: () => (0, graph_handler_1.runGraphTests)(localDb(), {
|
|
167
|
+
symbols,
|
|
168
|
+
queryRoot,
|
|
169
|
+
depth,
|
|
170
|
+
excludePrefixes: scope.excludePrefixes,
|
|
171
|
+
families,
|
|
172
|
+
}),
|
|
173
|
+
})
|
|
124
174
|
: Promise.resolve([]),
|
|
125
175
|
]);
|
|
126
176
|
if (useRollup) {
|
|
@@ -188,14 +238,18 @@ exports.impact = new commander_1.Command("impact")
|
|
|
188
238
|
}
|
|
189
239
|
}
|
|
190
240
|
catch (error) {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
241
|
+
// A sandbox refusal is already one actionable line; the "Impact analysis
|
|
242
|
+
// failed:" prefix would bury the settings key that fixes it.
|
|
243
|
+
if (!(0, store_access_1.reportStoreAccessRefusal)(error)) {
|
|
244
|
+
const msg = error instanceof Error ? error.message : "Unknown error";
|
|
245
|
+
console.error("Impact analysis failed:", msg);
|
|
246
|
+
process.exitCode = 1;
|
|
247
|
+
}
|
|
194
248
|
}
|
|
195
249
|
finally {
|
|
196
|
-
if (
|
|
250
|
+
if (local.db) {
|
|
197
251
|
try {
|
|
198
|
-
yield
|
|
252
|
+
yield local.db.close();
|
|
199
253
|
}
|
|
200
254
|
catch (_b) { }
|
|
201
255
|
}
|
package/dist/commands/log.js
CHANGED
|
@@ -46,12 +46,12 @@ exports.log = void 0;
|
|
|
46
46
|
const fs = __importStar(require("node:fs"));
|
|
47
47
|
const path = __importStar(require("node:path"));
|
|
48
48
|
const commander_1 = require("commander");
|
|
49
|
-
const
|
|
49
|
+
const rows_handler_1 = require("../lib/daemon/rows-handler");
|
|
50
50
|
const exit_1 = require("../lib/utils/exit");
|
|
51
|
-
const filter_builder_1 = require("../lib/utils/filter-builder");
|
|
52
51
|
const git_1 = require("../lib/utils/git");
|
|
53
52
|
const project_registry_1 = require("../lib/utils/project-registry");
|
|
54
53
|
const project_root_1 = require("../lib/utils/project-root");
|
|
54
|
+
const store_access_1 = require("../lib/utils/store-access");
|
|
55
55
|
const useColors = process.stdout.isTTY && !process.env.NO_COLOR;
|
|
56
56
|
const style = {
|
|
57
57
|
bold: (s) => (useColors ? `\x1b[1m${s}\x1b[22m` : s),
|
|
@@ -63,24 +63,30 @@ function relativize(p, projectRoot) {
|
|
|
63
63
|
const prefix = projectRoot.endsWith("/") ? projectRoot : `${projectRoot}/`;
|
|
64
64
|
return p.startsWith(prefix) ? p.slice(prefix.length) : p;
|
|
65
65
|
}
|
|
66
|
-
|
|
66
|
+
/**
|
|
67
|
+
* The one store read `log` does: symbol → defining files. Everything else —
|
|
68
|
+
* cwd-relative path resolution and `git log` itself — stays in this process,
|
|
69
|
+
* because both are tied to where the user is standing.
|
|
70
|
+
*/
|
|
71
|
+
function resolveSymbolPaths(symbol, projectRoot, lancedbDir, inOpt, excludeOpt) {
|
|
67
72
|
return __awaiter(this, void 0, void 0, function* () {
|
|
68
|
-
const { resolveScope
|
|
73
|
+
const { resolveScope } = yield Promise.resolve().then(() => __importStar(require("../lib/utils/scope-filter")));
|
|
69
74
|
const scope = resolveScope({
|
|
70
75
|
projectRoot,
|
|
71
76
|
in: inOpt,
|
|
72
77
|
exclude: excludeOpt,
|
|
73
78
|
});
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
const [rows] = yield (0, rows_handler_1.readRows)({
|
|
80
|
+
name: "log",
|
|
81
|
+
projectRoot,
|
|
82
|
+
lancedbDir,
|
|
83
|
+
scope,
|
|
84
|
+
select: ["path"],
|
|
85
|
+
matches: [{ kind: "definedSymbol", symbol }],
|
|
86
|
+
limit: 50,
|
|
87
|
+
});
|
|
82
88
|
const paths = new Set();
|
|
83
|
-
for (const row of rows) {
|
|
89
|
+
for (const row of rows !== null && rows !== void 0 ? rows : []) {
|
|
84
90
|
const p = String(row.path || "");
|
|
85
91
|
if (p)
|
|
86
92
|
paths.add(p);
|
|
@@ -141,7 +147,6 @@ exports.log = new commander_1.Command("log")
|
|
|
141
147
|
if (root === null)
|
|
142
148
|
return;
|
|
143
149
|
const projectRoot = (_a = (0, project_root_1.findProjectRoot)(root)) !== null && _a !== void 0 ? _a : root;
|
|
144
|
-
let vectorDb = null;
|
|
145
150
|
try {
|
|
146
151
|
// 1. Try arg as path (relative to projectRoot, then cwd).
|
|
147
152
|
const candidates = [
|
|
@@ -180,8 +185,7 @@ exports.log = new commander_1.Command("log")
|
|
|
180
185
|
}
|
|
181
186
|
// 2. Try arg as symbol via index lookup.
|
|
182
187
|
const paths = (0, project_root_1.ensureProjectPaths)(projectRoot);
|
|
183
|
-
|
|
184
|
-
const symbolPaths = yield resolveSymbolPaths(vectorDb, arg, projectRoot, opts.in, opts.exclude);
|
|
188
|
+
const symbolPaths = yield resolveSymbolPaths(arg, projectRoot, paths.lancedbDir, opts.in, opts.exclude);
|
|
185
189
|
if (symbolPaths.length === 0) {
|
|
186
190
|
console.error(`gmax log: no file or symbol matched '${arg}'`);
|
|
187
191
|
if (!opts.agent) {
|
|
@@ -217,17 +221,13 @@ exports.log = new commander_1.Command("log")
|
|
|
217
221
|
}
|
|
218
222
|
}
|
|
219
223
|
catch (error) {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
224
|
+
if (!(0, store_access_1.reportStoreAccessRefusal)(error)) {
|
|
225
|
+
const msg = error instanceof Error ? error.message : "Unknown error";
|
|
226
|
+
console.error("Log failed:", msg);
|
|
227
|
+
process.exitCode = 1;
|
|
228
|
+
}
|
|
223
229
|
}
|
|
224
230
|
finally {
|
|
225
|
-
if (vectorDb) {
|
|
226
|
-
try {
|
|
227
|
-
yield vectorDb.close();
|
|
228
|
-
}
|
|
229
|
-
catch (_b) { }
|
|
230
|
-
}
|
|
231
231
|
yield (0, exit_1.gracefulExit)();
|
|
232
232
|
}
|
|
233
233
|
}));
|