grepmax 0.11.0 → 0.11.2
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
|
@@ -239,6 +239,7 @@ const TOOLS = [
|
|
|
239
239
|
ref: { type: "string", description: "Git ref to diff against (e.g. main, HEAD~5)" },
|
|
240
240
|
query: { type: "string", description: "Semantic search within changed files" },
|
|
241
241
|
limit: { type: "number", description: "Max results (default 10)" },
|
|
242
|
+
role: { type: "string", description: "Filter by role: ORCHESTRATION, DEFINITION, IMPLEMENTATION" },
|
|
242
243
|
},
|
|
243
244
|
},
|
|
244
245
|
},
|
|
@@ -274,6 +275,7 @@ const TOOLS = [
|
|
|
274
275
|
properties: {
|
|
275
276
|
target: { type: "string", description: "Symbol name or file path" },
|
|
276
277
|
limit: { type: "number", description: "Max results (default 5)" },
|
|
278
|
+
threshold: { type: "number", description: "Min similarity 0-1 (default 0)" },
|
|
277
279
|
},
|
|
278
280
|
required: ["target"],
|
|
279
281
|
},
|
|
@@ -1577,6 +1579,7 @@ exports.mcp = new commander_1.Command("mcp")
|
|
|
1577
1579
|
const ref = typeof args.ref === "string" ? args.ref : undefined;
|
|
1578
1580
|
const query = typeof args.query === "string" ? args.query : undefined;
|
|
1579
1581
|
const limit = Math.min(Math.max(Number(args.limit) || 10, 1), 50);
|
|
1582
|
+
const role = typeof args.role === "string" ? args.role.toUpperCase() : undefined;
|
|
1580
1583
|
try {
|
|
1581
1584
|
const changedFiles = getChangedFiles(ref, projectRoot);
|
|
1582
1585
|
if (changedFiles.length === 0) {
|
|
@@ -1587,7 +1590,9 @@ exports.mcp = new commander_1.Command("mcp")
|
|
|
1587
1590
|
const searcher = getSearcher();
|
|
1588
1591
|
const response = yield searcher.search(query, limit, { rerank: true }, {}, projectRoot);
|
|
1589
1592
|
const changedSet = new Set(changedFiles);
|
|
1590
|
-
|
|
1593
|
+
let filtered = response.data.filter((r) => changedSet.has(String(r.path || "")));
|
|
1594
|
+
if (role)
|
|
1595
|
+
filtered = filtered.filter((r) => String(r.role || "").toUpperCase().startsWith(role));
|
|
1591
1596
|
if (filtered.length === 0)
|
|
1592
1597
|
return ok("No indexed results found in changed files for that query.");
|
|
1593
1598
|
const lines = filtered.slice(0, limit).map((r) => {
|
|
@@ -1700,6 +1705,7 @@ exports.mcp = new commander_1.Command("mcp")
|
|
|
1700
1705
|
if (!target)
|
|
1701
1706
|
return err("Missing required parameter: target");
|
|
1702
1707
|
const limit = Math.min(Math.max(Number(args.limit) || 5, 1), 25);
|
|
1708
|
+
const threshold = Number(args.threshold) || 0;
|
|
1703
1709
|
try {
|
|
1704
1710
|
const db = getVectorDb();
|
|
1705
1711
|
const table = yield db.ensureTable();
|
|
@@ -1728,7 +1734,9 @@ exports.mcp = new commander_1.Command("mcp")
|
|
|
1728
1734
|
.select(["path", "start_line", "defined_symbols", "role", "_distance"])
|
|
1729
1735
|
.where(`path LIKE '${(0, filter_builder_1.escapeSqlString)(projectRoot)}/%'`)
|
|
1730
1736
|
.limit(limit + 5).toArray();
|
|
1731
|
-
|
|
1737
|
+
let filtered = results.filter((r) => !(r.path === source.path && r.start_line === source.start_line));
|
|
1738
|
+
if (threshold > 0)
|
|
1739
|
+
filtered = filtered.filter((r) => { var _a; return 1 / (1 + ((_a = r._distance) !== null && _a !== void 0 ? _a : 0)) >= threshold; });
|
|
1732
1740
|
if (filtered.length === 0)
|
|
1733
1741
|
return ok(`No similar code found for ${target}.`);
|
|
1734
1742
|
const rel = (p) => p.startsWith(`${projectRoot}/`) ? p.slice(projectRoot.length + 1) : p;
|
package/package.json
CHANGED
|
@@ -121,7 +121,7 @@ async function main() {
|
|
|
121
121
|
hookSpecificOutput: {
|
|
122
122
|
hookEventName: "SessionStart",
|
|
123
123
|
additionalContext:
|
|
124
|
-
'gmax ready.
|
|
124
|
+
'gmax ready. Use Bash(gmax "query" --agent) for search (one line per result, 89% fewer tokens). Bash(gmax extract <symbol>) for full function body. Bash(gmax peek <symbol>) for quick overview (sig+callers+callees). Bash(gmax trace <symbol>) for call graphs. Bash(gmax skeleton <path>) for structure. Bash(gmax diff [ref]) for git changes. Bash(gmax test <symbol>) for test coverage. Bash(gmax impact <symbol>) for blast radius. Bash(gmax similar <symbol>) for similar code. Bash(gmax context "topic" --budget 4000) for topic summary. Bash(gmax status) to check indexed projects. --agent flag works on search, trace, symbols, related, recent, status, project, extract, peek, diff, test, impact, similar. If search says "not added yet", run Bash(gmax add).',
|
|
125
125
|
},
|
|
126
126
|
};
|
|
127
127
|
process.stdout.write(JSON.stringify(response));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: grepmax
|
|
3
3
|
description: Semantic code search. Use alongside grep - grep for exact strings, gmax for concepts.
|
|
4
|
-
allowed-tools: "
|
|
4
|
+
allowed-tools: "Bash(gmax:*), Read"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
## When to use what
|
|
@@ -14,19 +14,17 @@ allowed-tools: "mcp__grepmax__semantic_search, mcp__grepmax__code_skeleton, mcp_
|
|
|
14
14
|
- **Need file structure?** → `Bash(gmax skeleton <path>)`
|
|
15
15
|
- **Need call flow?** → `Bash(gmax trace <symbol>)`
|
|
16
16
|
|
|
17
|
-
##
|
|
17
|
+
## Quick start
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
Use `--agent` for the most token-efficient output (one line per result with signature hints).
|
|
20
20
|
|
|
21
21
|
```
|
|
22
22
|
Bash(gmax "auth handler" --role ORCHESTRATION --lang ts --agent -m 3)
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
**Only use MCP tools** for `index_status` or `summarize_directory`. For everything else, use CLI.
|
|
26
|
-
|
|
27
25
|
## Project management
|
|
28
26
|
|
|
29
|
-
Projects must be added before
|
|
27
|
+
Projects must be added before search works:
|
|
30
28
|
|
|
31
29
|
```
|
|
32
30
|
gmax add # add + index current directory
|
|
@@ -207,10 +205,6 @@ gmax doctor # health check
|
|
|
207
205
|
14. **Related** — `Bash(gmax related <file>)` to see what else to look at
|
|
208
206
|
15. **Status** — `Bash(gmax status)` to check index state across all projects
|
|
209
207
|
|
|
210
|
-
## MCP tools
|
|
211
|
-
|
|
212
|
-
Use MCP only for `index_status` and `summarize_directory`. Use CLI for everything else. For cross-project search, use `scope: "all"` on semantic_search (replaces search_all).
|
|
213
|
-
|
|
214
208
|
## Tips
|
|
215
209
|
|
|
216
210
|
- **Use `--agent` for compact output** — supported on search, trace, symbols, related, recent, status, project.
|