grepmax 0.7.22 → 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.
package/README.md CHANGED
@@ -100,12 +100,15 @@ In our public benchmarks, `grepmax` can save about 20% of your LLM tokens and de
100
100
 
101
101
  | Tool | Description |
102
102
  | --- | --- |
103
- | `semantic_search` | Code search by meaning. Returns pointers (symbol, file:line, role, calls, summary) by default. Use `root` for cross-directory search, `detail: "code"` for snippets. |
104
- | `search_all` | Search ALL indexed code across every directory. Same pointer format. |
105
- | `code_skeleton` | Collapsed file structure (~4x fewer tokens than reading the full file) |
106
- | `trace_calls` | Call graph who calls a symbol and what it calls (unscoped, crosses project boundaries) |
107
- | `list_symbols` | List indexed functions, classes, and types with definition locations |
108
- | `index_status` | Check index health: chunk counts, indexed directories, model info |
103
+ | `semantic_search` | Code search by meaning. 16 composable params: query, limit, root, path, detail (pointer/code/full), context_lines, min_score, max_per_file, file, exclude, language, role, mode (symbol), include_imports, name_pattern. |
104
+ | `search_all` | Search ALL indexed code. Same params + `projects`/`exclude_projects` to scope by project name. |
105
+ | `code_skeleton` | Collapsed file structure (~4x fewer tokens). Accepts files, directories, or comma-separated paths. `format: "json"` for structured output. |
106
+ | `trace_calls` | Call graph with importers, callers (multi-hop via `depth`), and callees with file:line locations. |
107
+ | `list_symbols` | List indexed symbols with role (ORCH/DEF/IMPL) and export status. |
108
+ | `summarize_project` | High-level project overview languages, directory structure, roles, key symbols, entry points. |
109
+ | `related_files` | Find dependencies and dependents of a file by shared symbol references. |
110
+ | `recent_changes` | Recently modified indexed files with relative timestamps. |
111
+ | `index_status` | Check index health: per-project chunk counts, model info, watcher status. |
109
112
  | `summarize_directory` | Generate LLM summaries for indexed chunks. Summaries appear in search results. |
110
113
 
111
114
  ## Commands
@@ -125,8 +128,17 @@ gmax "how is the database connection pooled?"
125
128
  | `-m <n>` | Max total results to return. | `5` |
126
129
  | `--per-file <n>` | Max matches to show per file. | `3` |
127
130
  | `-c`, `--content` | Show full chunk content instead of snippets. | `false` |
131
+ | `-C <n>`, `--context <n>` | Include N lines before/after each result. | `0` |
128
132
  | `--scores` | Show relevance scores (0-1) for each result. | `false` |
129
133
  | `--min-score <n>` | Filter out results below this score threshold. | `0` |
134
+ | `--root <dir>` | Search a different project directory. | cwd |
135
+ | `--file <name>` | Filter to files matching this name (e.g. `syncer.ts`). | — |
136
+ | `--exclude <prefix>` | Exclude files under this path prefix (e.g. `tests/`). | — |
137
+ | `--lang <ext>` | Filter by file extension (e.g. `ts`, `py`). | — |
138
+ | `--role <role>` | Filter by role: `ORCHESTRATION`, `DEFINITION`, `IMPLEMENTATION`. | — |
139
+ | `--symbol` | Append call graph (importers, callers, callees) after results. | `false` |
140
+ | `--imports` | Prepend file imports to each result. | `false` |
141
+ | `--name <regex>` | Filter results by symbol name regex. | — |
130
142
  | `--compact` | Compact hits view (paths + line ranges + role/preview). | `false` |
131
143
  | `--skeleton` | Show code skeleton for matching files instead of snippets. | `false` |
132
144
  | `--plain` | Disable ANSI colors and use simpler formatting. | `false` |
@@ -136,10 +148,11 @@ gmax "how is the database connection pooled?"
136
148
 
137
149
  ```bash
138
150
  gmax "API rate limiting logic"
139
- gmax "error handling" --per-file 5
140
- gmax "user validation" --compact
141
- gmax "authentication" --scores --min-score 0.5
142
- gmax "database connection" --skeleton
151
+ gmax "auth handler" --role ORCHESTRATION --lang ts --plain
152
+ gmax "database" --file syncer.ts --plain
153
+ gmax "VectorDB" --symbol --plain
154
+ gmax "error handling" -C 5 --imports
155
+ gmax "handler" --name "handle.*" --exclude tests/
143
156
  ```
144
157
 
145
158
  ### `gmax index`
@@ -182,18 +195,57 @@ gmax serve --background # Background mode
182
195
  gmax serve --cpu # Force CPU-only embeddings
183
196
  ```
184
197
 
198
+ ### `gmax trace`
199
+
200
+ Call graph — who imports a symbol, who calls it, and what it calls.
201
+
202
+ ```bash
203
+ gmax trace handleAuth # 1-hop trace
204
+ gmax trace handleAuth -d 2 # 2-hop: callers-of-callers
205
+ ```
206
+
185
207
  ### `gmax skeleton`
186
208
 
187
- Compressed view of a file — signatures with bodies collapsed.
209
+ Compressed view of a file — signatures with bodies collapsed. Supports files, directories, and batch.
188
210
 
189
211
  ```bash
190
- gmax skeleton src/lib/auth.ts
191
- gmax skeleton AuthService # Find symbol, skeletonize its file
192
- gmax skeleton "auth logic" # Search, skeletonize top matches
212
+ gmax skeleton src/lib/auth.ts # Single file
213
+ gmax skeleton src/lib/search/ # All files in directory
214
+ gmax skeleton src/a.ts,src/b.ts # Batch
215
+ gmax skeleton src/lib/auth.ts --json # Structured JSON output
216
+ gmax skeleton AuthService # Find symbol, skeletonize its file
193
217
  ```
194
218
 
195
219
  **Supported Languages:** TypeScript, JavaScript, Python, Go, Rust, Java, C#, C++, C, Ruby, PHP, Swift, Kotlin.
196
220
 
221
+ ### `gmax project`
222
+
223
+ High-level project overview — languages, directory structure, role distribution, key symbols, entry points.
224
+
225
+ ```bash
226
+ gmax project # Current project
227
+ gmax project --root ~/workspace # Different project
228
+ ```
229
+
230
+ ### `gmax related`
231
+
232
+ Find files related by shared symbol references — dependencies and dependents.
233
+
234
+ ```bash
235
+ gmax related src/lib/index/syncer.ts
236
+ gmax related src/commands/mcp.ts -l 5
237
+ ```
238
+
239
+ ### `gmax recent`
240
+
241
+ Show recently modified indexed files with relative timestamps.
242
+
243
+ ```bash
244
+ gmax recent # Last 20 modified files
245
+ gmax recent -l 10 # Last 10
246
+ gmax recent --root ~/workspace # Different project
247
+ ```
248
+
197
249
  ### `gmax config`
198
250
 
199
251
  View or update configuration without the full interactive setup.
@@ -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.22",
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.22",
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.