grepmax 0.7.6 → 0.7.7
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
|
@@ -94,7 +94,7 @@ const TOOLS = [
|
|
|
94
94
|
},
|
|
95
95
|
detail: {
|
|
96
96
|
type: "string",
|
|
97
|
-
description: "Output detail: 'pointer' (default, metadata only
|
|
97
|
+
description: "Output detail: 'pointer' (default, metadata only), 'code' (4-line snippets), or 'full' (complete chunk content with line numbers)",
|
|
98
98
|
},
|
|
99
99
|
min_score: {
|
|
100
100
|
type: "number",
|
|
@@ -112,6 +112,14 @@ const TOOLS = [
|
|
|
112
112
|
type: "string",
|
|
113
113
|
description: "Exclude files under this path prefix (e.g. 'tests/' or 'dist/').",
|
|
114
114
|
},
|
|
115
|
+
language: {
|
|
116
|
+
type: "string",
|
|
117
|
+
description: "Filter by file extension (e.g. 'ts', 'py', 'go'). Omit the dot.",
|
|
118
|
+
},
|
|
119
|
+
role: {
|
|
120
|
+
type: "string",
|
|
121
|
+
description: "Filter by chunk role: 'ORCHESTRATION' (logic/flow), 'DEFINITION' (types/classes), or 'IMPLEMENTATION'.",
|
|
122
|
+
},
|
|
115
123
|
},
|
|
116
124
|
required: ["query"],
|
|
117
125
|
},
|
|
@@ -132,7 +140,7 @@ const TOOLS = [
|
|
|
132
140
|
},
|
|
133
141
|
detail: {
|
|
134
142
|
type: "string",
|
|
135
|
-
description: "Output detail: 'pointer' (default) or '
|
|
143
|
+
description: "Output detail: 'pointer' (default), 'code' (snippets), or 'full' (complete content)",
|
|
136
144
|
},
|
|
137
145
|
min_score: {
|
|
138
146
|
type: "number",
|
|
@@ -150,6 +158,14 @@ const TOOLS = [
|
|
|
150
158
|
type: "string",
|
|
151
159
|
description: "Exclude files under this path prefix (e.g. 'tests/').",
|
|
152
160
|
},
|
|
161
|
+
language: {
|
|
162
|
+
type: "string",
|
|
163
|
+
description: "Filter by file extension (e.g. 'ts', 'py').",
|
|
164
|
+
},
|
|
165
|
+
role: {
|
|
166
|
+
type: "string",
|
|
167
|
+
description: "Filter by role: 'ORCHESTRATION', 'DEFINITION', or 'IMPLEMENTATION'.",
|
|
168
|
+
},
|
|
153
169
|
},
|
|
154
170
|
required: ["query"],
|
|
155
171
|
},
|
|
@@ -450,6 +466,12 @@ exports.mcp = new commander_1.Command("mcp")
|
|
|
450
466
|
if (typeof args.exclude === "string" && args.exclude) {
|
|
451
467
|
filters.exclude = args.exclude;
|
|
452
468
|
}
|
|
469
|
+
if (typeof args.language === "string" && args.language) {
|
|
470
|
+
filters.language = args.language;
|
|
471
|
+
}
|
|
472
|
+
if (typeof args.role === "string" && args.role) {
|
|
473
|
+
filters.role = args.role;
|
|
474
|
+
}
|
|
453
475
|
const result = yield searcher.search(query, limit, { rerank: true }, Object.keys(filters).length > 0 ? filters : undefined, pathPrefix);
|
|
454
476
|
if (!result.data || result.data.length === 0) {
|
|
455
477
|
return ok("No matches found.");
|
|
@@ -485,16 +507,17 @@ exports.mcp = new commander_1.Command("mcp")
|
|
|
485
507
|
? ` ${parentStr}${callsStr}`
|
|
486
508
|
: "";
|
|
487
509
|
let snippet = "";
|
|
488
|
-
if (detail === "code") {
|
|
510
|
+
if (detail === "code" || detail === "full") {
|
|
489
511
|
const raw = typeof r.content === "string"
|
|
490
512
|
? r.content
|
|
491
513
|
: typeof r.text === "string"
|
|
492
514
|
? r.text
|
|
493
515
|
: "";
|
|
494
|
-
const
|
|
516
|
+
const allLines = raw.split("\n");
|
|
517
|
+
const linesToShow = detail === "full" ? allLines : allLines.slice(0, 4);
|
|
495
518
|
snippet =
|
|
496
519
|
"\n" +
|
|
497
|
-
|
|
520
|
+
linesToShow
|
|
498
521
|
.map((l, i) => `${startLine + i + 1}│${l}`)
|
|
499
522
|
.join("\n");
|
|
500
523
|
}
|
|
@@ -290,6 +290,17 @@ class Searcher {
|
|
|
290
290
|
: excludeFilter;
|
|
291
291
|
whereClauseParts.push(`path NOT LIKE '${(0, filter_builder_1.escapeSqlString)(absExclude)}%'`);
|
|
292
292
|
}
|
|
293
|
+
// Handle language filter (by file extension)
|
|
294
|
+
const langFilter = _filters === null || _filters === void 0 ? void 0 : _filters.language;
|
|
295
|
+
if (typeof langFilter === "string" && langFilter) {
|
|
296
|
+
const ext = langFilter.startsWith(".") ? langFilter : `.${langFilter}`;
|
|
297
|
+
whereClauseParts.push(`path LIKE '%${(0, filter_builder_1.escapeSqlString)(ext)}'`);
|
|
298
|
+
}
|
|
299
|
+
// Handle role filter
|
|
300
|
+
const roleFilter = _filters === null || _filters === void 0 ? void 0 : _filters.role;
|
|
301
|
+
if (typeof roleFilter === "string" && roleFilter) {
|
|
302
|
+
whereClauseParts.push(`role = '${(0, filter_builder_1.escapeSqlString)(roleFilter)}'`);
|
|
303
|
+
}
|
|
293
304
|
// Handle --def (definition) filter
|
|
294
305
|
const defFilter = _filters === null || _filters === void 0 ? void 0 : _filters.def;
|
|
295
306
|
if (typeof defFilter === "string" && defFilter) {
|
package/package.json
CHANGED
|
@@ -39,11 +39,13 @@ Parameters:
|
|
|
39
39
|
- `limit` (optional): Max results (default 3, max 50)
|
|
40
40
|
- `root` (optional): Absolute path to search a different indexed directory.
|
|
41
41
|
- `path` (optional): Restrict to path prefix (e.g. "src/auth/"). Relative to the search root.
|
|
42
|
-
- `detail` (optional): `"pointer"` (default) or `"
|
|
42
|
+
- `detail` (optional): `"pointer"` (default), `"code"` (4-line snippets), or `"full"` (complete chunk with line numbers)
|
|
43
43
|
- `min_score` (optional): Filter by minimum relevance score (0-1)
|
|
44
44
|
- `max_per_file` (optional): Cap results per file for diversity
|
|
45
45
|
- `file` (optional): Filter to files matching this name (e.g. "syncer.ts"). Matches filename, not full path.
|
|
46
46
|
- `exclude` (optional): Exclude files under this path prefix (e.g. "tests/" or "dist/")
|
|
47
|
+
- `language` (optional): Filter by file extension (e.g. "ts", "py", "go"). Omit the dot.
|
|
48
|
+
- `role` (optional): Filter by chunk role: "ORCHESTRATION" (logic/flow), "DEFINITION" (types), or "IMPLEMENTATION"
|
|
47
49
|
|
|
48
50
|
**When to use which mode:**
|
|
49
51
|
- `pointer` — navigation, finding locations, understanding architecture
|