grepmax 0.23.0 → 0.25.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/.claude-plugin/marketplace.json +1 -1
- package/README.md +25 -6
- package/dist/commands/add.js +38 -31
- package/dist/commands/config.js +16 -15
- package/dist/commands/context.js +38 -13
- package/dist/commands/doctor.js +76 -83
- package/dist/commands/extract.js +12 -1
- package/dist/commands/impact.js +33 -1
- package/dist/commands/index.js +23 -24
- package/dist/commands/list.js +23 -14
- package/dist/commands/mcp.js +494 -162
- package/dist/commands/peek.js +16 -5
- package/dist/commands/repair.js +54 -120
- package/dist/commands/search-output.js +30 -9
- package/dist/commands/search-run.js +75 -47
- package/dist/commands/search-skeletons.js +28 -18
- package/dist/commands/search.js +45 -49
- package/dist/commands/serve.js +415 -373
- package/dist/commands/setup.js +2 -2
- package/dist/commands/similar.js +5 -5
- package/dist/commands/skeleton.js +67 -41
- package/dist/commands/status.js +5 -2
- package/dist/commands/summarize.js +6 -0
- package/dist/commands/surprises.js +150 -0
- package/dist/commands/watch.js +102 -38
- package/dist/config.js +3 -0
- package/dist/eval-surprising-connections.js +191 -0
- package/dist/index.js +2 -0
- package/dist/lib/analysis/surprising-connections.js +600 -0
- package/dist/lib/daemon/daemon.js +1101 -379
- package/dist/lib/daemon/ipc-handler.js +122 -13
- package/dist/lib/daemon/mlx-server-manager.js +268 -125
- package/dist/lib/daemon/process-manager.js +7 -4
- package/dist/lib/daemon/search-handler.js +23 -9
- package/dist/lib/daemon/watcher-manager.js +353 -110
- package/dist/lib/graph/impact-rollup.js +202 -0
- package/dist/lib/graph/impact.js +15 -1
- package/dist/lib/help/agent-cheatsheet.js +1 -0
- package/dist/lib/index/batch-processor.js +231 -67
- package/dist/lib/index/embedding-generation.js +109 -0
- package/dist/lib/index/embedding-status.js +23 -0
- package/dist/lib/index/file-policy.js +273 -0
- package/dist/lib/index/ignore-patterns.js +4 -0
- package/dist/lib/index/index-config.js +18 -4
- package/dist/lib/index/syncer.js +256 -79
- package/dist/lib/index/walker.js +66 -86
- package/dist/lib/index/watcher-batch.js +9 -0
- package/dist/lib/index/watcher.js +129 -3
- package/dist/lib/llm/server.js +6 -0
- package/dist/lib/search/searcher.js +30 -19
- package/dist/lib/skeleton/skeletonizer.js +118 -0
- package/dist/lib/skeleton/summary-formatter.js +8 -1
- package/dist/lib/store/store-lease.js +473 -0
- package/dist/lib/store/vector-db.js +302 -57
- package/dist/lib/utils/blocked-roots.js +63 -0
- package/dist/lib/utils/cross-project.js +7 -3
- package/dist/lib/utils/daemon-client.js +24 -1
- package/dist/lib/utils/daemon-launcher.js +38 -13
- package/dist/lib/utils/doctor-status.js +76 -0
- package/dist/lib/utils/file-utils.js +74 -4
- package/dist/lib/utils/keyed-mutex.js +101 -0
- package/dist/lib/utils/logger.js +57 -1
- package/dist/lib/utils/mlx-hf-cache.js +114 -0
- package/dist/lib/utils/operation-coordinator.js +146 -0
- package/dist/lib/utils/path-containment.js +106 -0
- package/dist/lib/utils/process.js +44 -0
- package/dist/lib/utils/project-registry.js +351 -3
- package/dist/lib/utils/scope-filter.js +3 -9
- package/dist/lib/utils/stale-hint.js +12 -19
- package/dist/lib/utils/watcher-launcher.js +5 -1
- package/dist/lib/utils/watcher-store.js +2 -2
- package/dist/lib/workers/colbert-math.js +15 -12
- package/dist/lib/workers/embeddings/colbert.js +3 -2
- package/dist/lib/workers/embeddings/granite.js +4 -3
- package/dist/lib/workers/embeddings/mlx-client.js +59 -16
- package/dist/lib/workers/orchestrator.js +39 -8
- package/dist/lib/workers/pool.js +150 -83
- package/dist/lib/workers/process-child.js +11 -2
- package/dist/lib/workers/serialized-handler.js +10 -0
- package/dist/lib/workers/worker.js +13 -4
- package/mlx-embed-server/server.py +21 -3
- package/mlx-embed-server/summarizer.py +8 -0
- package/package.json +6 -3
- package/plugins/grepmax/.claude-plugin/plugin.json +1 -1
- package/plugins/grepmax/hooks/start.js +3 -170
package/dist/commands/search.js
CHANGED
|
@@ -43,13 +43,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
43
43
|
};
|
|
44
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
45
|
exports.search = void 0;
|
|
46
|
-
const path = __importStar(require("node:path"));
|
|
47
46
|
const commander_1 = require("commander");
|
|
48
47
|
const setup_helpers_1 = require("../lib/setup/setup-helpers");
|
|
49
48
|
const cross_project_1 = require("../lib/utils/cross-project");
|
|
50
49
|
const exit_1 = require("../lib/utils/exit");
|
|
51
50
|
const project_registry_1 = require("../lib/utils/project-registry");
|
|
52
51
|
const project_root_1 = require("../lib/utils/project-root");
|
|
52
|
+
const scope_filter_1 = require("../lib/utils/scope-filter");
|
|
53
53
|
const server_registry_1 = require("../lib/utils/server-registry");
|
|
54
54
|
const stale_hint_1 = require("../lib/utils/stale-hint");
|
|
55
55
|
const search_output_1 = require("./search-output");
|
|
@@ -99,7 +99,7 @@ Examples:
|
|
|
99
99
|
gmax "auth middleware" --projects api,gateway --plain
|
|
100
100
|
`)
|
|
101
101
|
.action((pattern, exec_path, _options, cmd) => __awaiter(void 0, void 0, void 0, function* () {
|
|
102
|
-
var _a, _b, _c, _d, _e;
|
|
102
|
+
var _a, _b, _c, _d, _e, _f;
|
|
103
103
|
const options = cmd.optsWithGlobals();
|
|
104
104
|
const root = process.cwd();
|
|
105
105
|
const minScore = Number.isFinite(Number.parseFloat(options.minScore))
|
|
@@ -133,6 +133,14 @@ Examples:
|
|
|
133
133
|
process.exitCode = 1;
|
|
134
134
|
return;
|
|
135
135
|
}
|
|
136
|
+
if (options.root ||
|
|
137
|
+
exec_path ||
|
|
138
|
+
((_a = options.in) === null || _a === void 0 ? void 0 : _a.length) ||
|
|
139
|
+
((_b = options.exclude) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
140
|
+
console.error("--root, [path], --in, and --exclude are single-project; drop --all-projects/--projects or remove the project/path scope.");
|
|
141
|
+
process.exitCode = 1;
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
136
144
|
for (const w of crossProject.warnings)
|
|
137
145
|
console.warn(`Warning: ${w}`);
|
|
138
146
|
if (!crossProject.roots.length) {
|
|
@@ -146,16 +154,37 @@ Examples:
|
|
|
146
154
|
// daemon-mediated / in-process path (both query the shared table).
|
|
147
155
|
let resolvedOptionRoot;
|
|
148
156
|
if (options.root && !crossProject.active) {
|
|
149
|
-
|
|
150
|
-
if (
|
|
157
|
+
const resolved = (0, project_registry_1.resolveRootOrExit)(options.root);
|
|
158
|
+
if (resolved === null)
|
|
151
159
|
return;
|
|
160
|
+
resolvedOptionRoot = (_c = (0, project_root_1.findProjectRoot)(resolved)) !== null && _c !== void 0 ? _c : resolved;
|
|
161
|
+
}
|
|
162
|
+
const cwdProjectRoot = (_d = (0, project_root_1.findProjectRoot)(root)) !== null && _d !== void 0 ? _d : root;
|
|
163
|
+
const projectRootForServer = resolvedOptionRoot !== null && resolvedOptionRoot !== void 0 ? resolvedOptionRoot : cwdProjectRoot;
|
|
164
|
+
if (exec_path && options.in && options.in.length > 0) {
|
|
165
|
+
console.warn("Warning: --in overrides positional [path]; using --in.");
|
|
166
|
+
}
|
|
167
|
+
let scope;
|
|
168
|
+
try {
|
|
169
|
+
scope = (0, scope_filter_1.resolveScope)({
|
|
170
|
+
projectRoot: projectRootForServer,
|
|
171
|
+
in: options.in && options.in.length > 0
|
|
172
|
+
? options.in
|
|
173
|
+
: exec_path
|
|
174
|
+
? [exec_path]
|
|
175
|
+
: undefined,
|
|
176
|
+
exclude: options.exclude,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
catch (err) {
|
|
180
|
+
console.error(`Search failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
181
|
+
process.exitCode = 1;
|
|
182
|
+
yield (0, exit_1.gracefulExit)(1);
|
|
183
|
+
return;
|
|
152
184
|
}
|
|
153
|
-
const
|
|
154
|
-
?
|
|
155
|
-
:
|
|
156
|
-
? path.resolve(exec_path)
|
|
157
|
-
: root;
|
|
158
|
-
const projectRootForServer = (_a = (0, project_root_1.findProjectRoot)(execPathForServer)) !== null && _a !== void 0 ? _a : execPathForServer;
|
|
185
|
+
const containedExecPath = exec_path && !(options.in && options.in.length > 0)
|
|
186
|
+
? scope.pathPrefix.replace(/\/$/, "")
|
|
187
|
+
: undefined;
|
|
159
188
|
const server = crossProject.active
|
|
160
189
|
? null
|
|
161
190
|
: (0, server_registry_1.getServerForProject)(projectRootForServer);
|
|
@@ -166,7 +195,7 @@ Examples:
|
|
|
166
195
|
const handled = yield (0, search_output_1.executeServerSearch)({
|
|
167
196
|
server,
|
|
168
197
|
pattern,
|
|
169
|
-
exec_path,
|
|
198
|
+
exec_path: containedExecPath,
|
|
170
199
|
projectRootForServer,
|
|
171
200
|
options,
|
|
172
201
|
minScore,
|
|
@@ -176,8 +205,6 @@ Examples:
|
|
|
176
205
|
}
|
|
177
206
|
try {
|
|
178
207
|
yield (0, setup_helpers_1.ensureSetup)();
|
|
179
|
-
const searchRoot = exec_path ? path.resolve(exec_path) : root;
|
|
180
|
-
const cwdProjectRoot = (_b = (0, project_root_1.findProjectRoot)(searchRoot)) !== null && _b !== void 0 ? _b : searchRoot;
|
|
181
208
|
let checkRoot = cwdProjectRoot;
|
|
182
209
|
if (options.root) {
|
|
183
210
|
const resolved = resolvedOptionRoot !== undefined
|
|
@@ -185,7 +212,7 @@ Examples:
|
|
|
185
212
|
: (0, project_registry_1.resolveRootOrExit)(options.root);
|
|
186
213
|
if (resolved === null)
|
|
187
214
|
return;
|
|
188
|
-
checkRoot = (
|
|
215
|
+
checkRoot = (_e = (0, project_root_1.findProjectRoot)(resolved)) !== null && _e !== void 0 ? _e : resolved;
|
|
189
216
|
}
|
|
190
217
|
const projectRoot = crossProject.active ? cwdProjectRoot : checkRoot;
|
|
191
218
|
const paths = (0, project_root_1.ensureProjectPaths)(projectRoot);
|
|
@@ -210,34 +237,7 @@ Examples:
|
|
|
210
237
|
// and in-process search paths need them. Reuse the resolved checkRoot
|
|
211
238
|
// so --root <name> only resolves once per invocation.
|
|
212
239
|
const effectiveRoot = checkRoot;
|
|
213
|
-
|
|
214
|
-
// positional [path] when both are given (positional was the older
|
|
215
|
-
// shape; --in is canonical going forward).
|
|
216
|
-
if (exec_path && options.in && options.in.length > 0) {
|
|
217
|
-
console.warn("Warning: --in overrides positional [path]; using --in.");
|
|
218
|
-
}
|
|
219
|
-
const { resolveScope } = yield Promise.resolve().then(() => __importStar(require("../lib/utils/scope-filter")));
|
|
220
|
-
const scope = resolveScope({
|
|
221
|
-
projectRoot: effectiveRoot,
|
|
222
|
-
in: options.in,
|
|
223
|
-
exclude: options.exclude,
|
|
224
|
-
});
|
|
225
|
-
// Cross-project mode drops the single-project path prefix (and any
|
|
226
|
-
// --in/[path] sub-scoping, which is meaningless across roots) in favor of
|
|
227
|
-
// the project_roots filter clauses computed below.
|
|
228
|
-
if (crossProject.active && (exec_path || ((_d = options.in) === null || _d === void 0 ? void 0 : _d.length))) {
|
|
229
|
-
console.warn("Warning: --in / [path] are single-project; ignored under --all-projects/--projects.");
|
|
230
|
-
}
|
|
231
|
-
const pathFilter = crossProject.active
|
|
232
|
-
? undefined
|
|
233
|
-
: options.in && options.in.length > 0
|
|
234
|
-
? scope.pathPrefix
|
|
235
|
-
: exec_path
|
|
236
|
-
? (() => {
|
|
237
|
-
const p = path.resolve(exec_path);
|
|
238
|
-
return p.endsWith("/") ? p : `${p}/`;
|
|
239
|
-
})()
|
|
240
|
-
: scope.pathPrefix;
|
|
240
|
+
const pathFilter = crossProject.active ? undefined : scope.pathPrefix;
|
|
241
241
|
const searchFilters = {};
|
|
242
242
|
if (options.file)
|
|
243
243
|
searchFilters.file = options.file;
|
|
@@ -246,11 +246,7 @@ Examples:
|
|
|
246
246
|
if (options.role)
|
|
247
247
|
searchFilters.role = options.role;
|
|
248
248
|
if (crossProject.active) {
|
|
249
|
-
|
|
250
|
-
searchFilters.project_roots = crossProject.projectRootsCsv;
|
|
251
|
-
if (crossProject.excludeProjectRootsCsv)
|
|
252
|
-
searchFilters.exclude_project_roots =
|
|
253
|
-
crossProject.excludeProjectRootsCsv;
|
|
249
|
+
searchFilters.projectRoots = crossProject.projectRoots;
|
|
254
250
|
}
|
|
255
251
|
else {
|
|
256
252
|
if (scope.inPrefixes.length > 0)
|
|
@@ -324,13 +320,13 @@ Examples:
|
|
|
324
320
|
source: "cli",
|
|
325
321
|
tool: "search",
|
|
326
322
|
query: pattern,
|
|
327
|
-
project: (
|
|
323
|
+
project: (_f = (0, project_root_1.findProjectRoot)(root)) !== null && _f !== void 0 ? _f : root,
|
|
328
324
|
results: _searchResultCount,
|
|
329
325
|
ms: Date.now() - _searchStartMs,
|
|
330
326
|
error: _searchError,
|
|
331
327
|
});
|
|
332
328
|
}
|
|
333
|
-
catch (
|
|
329
|
+
catch (_g) { }
|
|
334
330
|
if (vectorDb) {
|
|
335
331
|
try {
|
|
336
332
|
yield vectorDb.close();
|