grepmax 0.7.7 → 0.7.8
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/dist/commands/mcp.js
CHANGED
|
@@ -166,6 +166,14 @@ const TOOLS = [
|
|
|
166
166
|
type: "string",
|
|
167
167
|
description: "Filter by role: 'ORCHESTRATION', 'DEFINITION', or 'IMPLEMENTATION'.",
|
|
168
168
|
},
|
|
169
|
+
projects: {
|
|
170
|
+
type: "string",
|
|
171
|
+
description: "Comma-separated project names to include (e.g. 'platform,osgrep'). Use index_status to see names.",
|
|
172
|
+
},
|
|
173
|
+
exclude_projects: {
|
|
174
|
+
type: "string",
|
|
175
|
+
description: "Comma-separated project names to exclude (e.g. 'capstone,power').",
|
|
176
|
+
},
|
|
169
177
|
},
|
|
170
178
|
required: ["query"],
|
|
171
179
|
},
|
|
@@ -472,6 +480,32 @@ exports.mcp = new commander_1.Command("mcp")
|
|
|
472
480
|
if (typeof args.role === "string" && args.role) {
|
|
473
481
|
filters.role = args.role;
|
|
474
482
|
}
|
|
483
|
+
if (searchAll) {
|
|
484
|
+
const allProjects = (0, project_registry_1.listProjects)();
|
|
485
|
+
if (typeof args.projects === "string" && args.projects) {
|
|
486
|
+
const names = args.projects
|
|
487
|
+
.split(",")
|
|
488
|
+
.map((s) => s.trim());
|
|
489
|
+
const roots = names
|
|
490
|
+
.map((n) => { var _a; return (_a = allProjects.find((p) => p.name === n)) === null || _a === void 0 ? void 0 : _a.root; })
|
|
491
|
+
.filter(Boolean);
|
|
492
|
+
if (roots.length > 0) {
|
|
493
|
+
filters.project_roots = roots.join(",");
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
if (typeof args.exclude_projects === "string" &&
|
|
497
|
+
args.exclude_projects) {
|
|
498
|
+
const names = args.exclude_projects
|
|
499
|
+
.split(",")
|
|
500
|
+
.map((s) => s.trim());
|
|
501
|
+
const roots = names
|
|
502
|
+
.map((n) => { var _a; return (_a = allProjects.find((p) => p.name === n)) === null || _a === void 0 ? void 0 : _a.root; })
|
|
503
|
+
.filter(Boolean);
|
|
504
|
+
if (roots.length > 0) {
|
|
505
|
+
filters.exclude_project_roots = roots.join(",");
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
}
|
|
475
509
|
const result = yield searcher.search(query, limit, { rerank: true }, Object.keys(filters).length > 0 ? filters : undefined, pathPrefix);
|
|
476
510
|
if (!result.data || result.data.length === 0) {
|
|
477
511
|
return ok("No matches found.");
|
|
@@ -301,6 +301,24 @@ class Searcher {
|
|
|
301
301
|
if (typeof roleFilter === "string" && roleFilter) {
|
|
302
302
|
whereClauseParts.push(`role = '${(0, filter_builder_1.escapeSqlString)(roleFilter)}'`);
|
|
303
303
|
}
|
|
304
|
+
// Handle project roots filter (from search_all projects param)
|
|
305
|
+
const projectRoots = _filters === null || _filters === void 0 ? void 0 : _filters.project_roots;
|
|
306
|
+
if (typeof projectRoots === "string" && projectRoots) {
|
|
307
|
+
const roots = projectRoots.split(",");
|
|
308
|
+
const clauses = roots.map((r) => {
|
|
309
|
+
const prefix = r.endsWith("/") ? r : `${r}/`;
|
|
310
|
+
return `path LIKE '${(0, filter_builder_1.escapeSqlString)(prefix)}%'`;
|
|
311
|
+
});
|
|
312
|
+
whereClauseParts.push(`(${clauses.join(" OR ")})`);
|
|
313
|
+
}
|
|
314
|
+
// Handle exclude project roots filter
|
|
315
|
+
const excludeRoots = _filters === null || _filters === void 0 ? void 0 : _filters.exclude_project_roots;
|
|
316
|
+
if (typeof excludeRoots === "string" && excludeRoots) {
|
|
317
|
+
for (const r of excludeRoots.split(",")) {
|
|
318
|
+
const prefix = r.endsWith("/") ? r : `${r}/`;
|
|
319
|
+
whereClauseParts.push(`path NOT LIKE '${(0, filter_builder_1.escapeSqlString)(prefix)}%'`);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
304
322
|
// Handle --def (definition) filter
|
|
305
323
|
const defFilter = _filters === null || _filters === void 0 ? void 0 : _filters.def;
|
|
306
324
|
if (typeof defFilter === "string" && defFilter) {
|
package/package.json
CHANGED
|
@@ -52,7 +52,11 @@ Parameters:
|
|
|
52
52
|
- `code` — comparing implementations, finding duplicates, checking syntax
|
|
53
53
|
|
|
54
54
|
### search_all
|
|
55
|
-
Search ALL indexed code across every directory. Same parameters as semantic_search (query, limit, detail, min_score, max_per_file) but without `root` or `path
|
|
55
|
+
Search ALL indexed code across every directory. Same parameters as semantic_search (query, limit, detail, min_score, max_per_file, file, exclude, language, role) but without `root` or `path`.
|
|
56
|
+
|
|
57
|
+
Additional parameters:
|
|
58
|
+
- `projects` (optional): Comma-separated project names to include (e.g. "platform,osgrep"). Use `index_status` to see names.
|
|
59
|
+
- `exclude_projects` (optional): Comma-separated project names to exclude (e.g. "capstone,power")
|
|
56
60
|
|
|
57
61
|
Use sparingly. Prefer `semantic_search` when you know which directory to search.
|
|
58
62
|
|