grepmax 0.7.23 → 0.7.24

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.
@@ -357,7 +357,7 @@ Examples:
357
357
  gmax "handler" --name "handle.*" --exclude tests/
358
358
  `)
359
359
  .action((pattern, exec_path, _options, cmd) => __awaiter(void 0, void 0, void 0, function* () {
360
- var _a, _b, _c, _d;
360
+ var _a, _b, _c, _d, _e;
361
361
  const options = cmd.optsWithGlobals();
362
362
  const root = process.cwd();
363
363
  const minScore = Number.isFinite(Number.parseFloat(options.minScore))
@@ -497,10 +497,23 @@ Examples:
497
497
  throw e;
498
498
  }
499
499
  }
500
+ // Ensure a watcher is running for live reindexing
501
+ if (!process.env.VITEST && !((_c = process.env.NODE_ENV) === null || _c === void 0 ? void 0 : _c.includes("test"))) {
502
+ try {
503
+ const { execFileSync } = yield Promise.resolve().then(() => __importStar(require("node:child_process")));
504
+ execFileSync("gmax", ["watch", "-b", "--path", projectRoot], {
505
+ timeout: 5000,
506
+ stdio: "ignore",
507
+ });
508
+ }
509
+ catch (_f) {
510
+ // Watcher may already be running — ignore
511
+ }
512
+ }
500
513
  const searcher = new searcher_1.Searcher(vectorDb);
501
514
  // Use --root or fall back to project root
502
515
  const effectiveRoot = options.root
503
- ? (_c = (0, project_root_1.findProjectRoot)(path.resolve(options.root))) !== null && _c !== void 0 ? _c : path.resolve(options.root)
516
+ ? (_d = (0, project_root_1.findProjectRoot)(path.resolve(options.root))) !== null && _d !== void 0 ? _d : path.resolve(options.root)
504
517
  : projectRoot;
505
518
  const searchPathPrefix = exec_path
506
519
  ? path.resolve(exec_path)
@@ -519,7 +532,7 @@ Examples:
519
532
  if (options.role)
520
533
  searchFilters.role = options.role;
521
534
  const searchResult = yield searcher.search(pattern, parseInt(options.m, 10), { rerank: true }, Object.keys(searchFilters).length > 0 ? searchFilters : undefined, pathFilter);
522
- if ((_d = searchResult.warnings) === null || _d === void 0 ? void 0 : _d.length) {
535
+ if ((_e = searchResult.warnings) === null || _e === void 0 ? void 0 : _e.length) {
523
536
  for (const w of searchResult.warnings) {
524
537
  console.warn(`Warning: ${w}`);
525
538
  }
@@ -536,7 +549,7 @@ Examples:
536
549
  return defs.some((d) => regex.test(d));
537
550
  });
538
551
  }
539
- catch (_e) {
552
+ catch (_g) {
540
553
  // Invalid regex — skip
541
554
  }
542
555
  }
@@ -621,7 +634,7 @@ Examples:
621
634
  console.log(lines.join("\n"));
622
635
  }
623
636
  }
624
- catch (_f) {
637
+ catch (_h) {
625
638
  // Trace failed — skip silently
626
639
  }
627
640
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grepmax",
3
- "version": "0.7.23",
3
+ "version": "0.7.24",
4
4
  "author": "Robert Owens <robowens@me.com>",
5
5
  "homepage": "https://github.com/reowens/grepmax",
6
6
  "bugs": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grepmax",
3
- "version": "0.7.23",
3
+ "version": "0.7.24",
4
4
  "description": "Semantic code search for Claude Code. Automatically indexes your project and provides intelligent search capabilities.",
5
5
  "author": {
6
6
  "name": "Robert Owens",
@@ -130,11 +130,31 @@ The watcher auto-starts when the MCP server connects — it detects file changes
130
130
 
131
131
  If search results include a warning like "Full-text search unavailable", results may be less precise. This resolves automatically — the index retries FTS every 5 minutes.
132
132
 
133
+ ## CLI vs MCP — when to use which
134
+
135
+ **Prefer CLI (`Bash(gmax ...)`) for repeated searches.** The CLI is ~2x more token-efficient because MCP tool schemas add ~800 tokens of overhead per call. Every CLI flag maps to an MCP param:
136
+
137
+ ```
138
+ Bash(gmax "auth handler" --role ORCHESTRATION --lang ts --plain -m 3)
139
+ ```
140
+
141
+ is equivalent to `semantic_search` with `role: "ORCHESTRATION", language: "ts", limit: 3` — but costs half the tokens.
142
+
143
+ **CLI commands for all MCP tools:**
144
+ - `gmax "query" --plain` → `semantic_search`
145
+ - `gmax trace <symbol> -d 2` → `trace_calls` with depth
146
+ - `gmax skeleton <target> --json` → `code_skeleton`
147
+ - `gmax project` → `summarize_project`
148
+ - `gmax related <file>` → `related_files`
149
+ - `gmax recent` → `recent_changes`
150
+
151
+ **Use MCP tools when:** first exploring (tool descriptions guide usage), or when you need pointer mode output (more structured than CLI).
152
+
133
153
  ## Tips
134
154
 
135
155
  - **Be specific.** "auth" returns noise. "where does the server validate JWT tokens from the Authorization header" returns exactly what you need. Aim for 5+ words.
136
- - **ORCH results contain the logic** — prioritize over DEF/IMPL results.
156
+ - **Use `--plain` for CLI searches** — agent-friendly output without ANSI codes.
157
+ - **ORCH results contain the logic** — use `--role ORCHESTRATION` to filter noise.
137
158
  - **Summaries tell you what the code does** without reading it. Use them to decide what to `Read`.
138
- - **Use `root` for cross-project search** absolute path to another indexed directory.
139
- - **Use `max_per_file`** when results cluster in one file but you need diversity.
159
+ - **Use `--symbol` on CLI** to get search results + call graph in one shot.
140
160
  - **Don't search for exact strings** — use grep/Grep for that. gmax finds concepts, not literals.