grepmax 0.18.1 → 0.20.0

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.
Files changed (78) hide show
  1. package/.claude-plugin/marketplace.json +23 -0
  2. package/README.md +28 -3
  3. package/dist/commands/add.js +4 -2
  4. package/dist/commands/claude-code.js +1 -1
  5. package/dist/commands/codex.js +3 -1
  6. package/dist/commands/context.js +1 -1
  7. package/dist/commands/dead.js +2 -6
  8. package/dist/commands/doctor.js +26 -7
  9. package/dist/commands/extract.js +3 -5
  10. package/dist/commands/impact.js +6 -4
  11. package/dist/commands/index.js +7 -2
  12. package/dist/commands/log.js +4 -2
  13. package/dist/commands/mcp.js +594 -722
  14. package/dist/commands/peek.js +15 -9
  15. package/dist/commands/plugin.js +36 -22
  16. package/dist/commands/project.js +16 -6
  17. package/dist/commands/related.js +8 -9
  18. package/dist/commands/remove.js +9 -2
  19. package/dist/commands/review.js +1 -1
  20. package/dist/commands/setup.js +4 -2
  21. package/dist/commands/similar.js +4 -4
  22. package/dist/commands/status.js +6 -4
  23. package/dist/commands/summarize.js +6 -4
  24. package/dist/commands/symbols.js +1 -1
  25. package/dist/commands/test-find.js +2 -2
  26. package/dist/commands/trace.js +12 -5
  27. package/dist/commands/watch.js +33 -9
  28. package/dist/eval-graph-nav.js +4 -1
  29. package/dist/eval-graph-recovery-probe.js +56 -14
  30. package/dist/eval-graph-spotcheck.js +10 -2
  31. package/dist/eval-graph-totals.js +5 -2
  32. package/dist/eval-oss.js +212 -37
  33. package/dist/eval-seed.js +13 -4
  34. package/dist/index.js +9 -9
  35. package/dist/lib/daemon/daemon.js +32 -13
  36. package/dist/lib/daemon/ipc-handler.js +24 -5
  37. package/dist/lib/daemon/mlx-server-manager.js +11 -3
  38. package/dist/lib/daemon/process-manager.js +1 -2
  39. package/dist/lib/daemon/watcher-manager.js +22 -6
  40. package/dist/lib/graph/callsites.js +151 -25
  41. package/dist/lib/graph/graph-builder.js +2 -2
  42. package/dist/lib/graph/impact.js +6 -6
  43. package/dist/lib/index/batch-processor.js +16 -6
  44. package/dist/lib/index/chunker.js +2 -0
  45. package/dist/lib/index/syncer.js +22 -10
  46. package/dist/lib/index/watcher-batch.js +10 -1
  47. package/dist/lib/llm/config.js +2 -1
  48. package/dist/lib/llm/diff.js +56 -11
  49. package/dist/lib/llm/investigate.js +52 -11
  50. package/dist/lib/llm/review.js +21 -8
  51. package/dist/lib/llm/server.js +25 -9
  52. package/dist/lib/llm/tools.js +1 -1
  53. package/dist/lib/output/agent-search-formatter.js +25 -3
  54. package/dist/lib/output/index-state-footer.js +1 -1
  55. package/dist/lib/review/risk.js +2 -4
  56. package/dist/lib/search/pagerank.js +1 -1
  57. package/dist/lib/search/searcher.js +43 -17
  58. package/dist/lib/search/seed-weight.js +4 -1
  59. package/dist/lib/skeleton/symbol-extractor.js +2 -1
  60. package/dist/lib/store/vector-db.js +21 -10
  61. package/dist/lib/utils/cross-project.js +5 -1
  62. package/dist/lib/utils/daemon-client.js +39 -1
  63. package/dist/lib/utils/filter-builder.js +22 -0
  64. package/dist/lib/utils/git.js +10 -2
  65. package/dist/lib/utils/project-registry.js +3 -2
  66. package/dist/lib/utils/scope-filter.js +6 -6
  67. package/dist/lib/utils/watcher-launcher.js +4 -1
  68. package/dist/lib/utils/watcher-store.js +2 -1
  69. package/dist/lib/workers/embeddings/granite.js +4 -1
  70. package/dist/lib/workers/embeddings/mlx-client.js +7 -2
  71. package/dist/lib/workers/pool.js +30 -7
  72. package/dist/lib/workers/process-child.js +1 -1
  73. package/package.json +23 -19
  74. package/plugins/grepmax/.claude-plugin/plugin.json +1 -1
  75. package/plugins/grepmax/hooks/cwd-changed.js +4 -1
  76. package/plugins/grepmax/hooks/pre-grep.js +2 -1
  77. package/plugins/grepmax/hooks/start.js +45 -10
  78. package/plugins/grepmax/hooks/subagent-start.js +1 -4
@@ -127,21 +127,35 @@ function startPythonServer(serverDir, scriptName, logName, processName) {
127
127
  VIRTUAL_ENV: "",
128
128
  CONDA_DEFAULT_ENV: "",
129
129
  GMAX_PROCESS_NAME: processName || logName,
130
- HF_TOKEN_PATH: process.env.HF_TOKEN_PATH || _path.join(require("node:os").homedir(), ".cache", "huggingface", "token"),
130
+ HF_TOKEN_PATH:
131
+ process.env.HF_TOKEN_PATH ||
132
+ _path.join(
133
+ require("node:os").homedir(),
134
+ ".cache",
135
+ "huggingface",
136
+ "token",
137
+ ),
131
138
  },
132
139
  });
133
140
  child.unref();
134
141
  }
135
142
 
136
143
  // --- Crash counter (Item 14) ---
137
- const CRASH_FILE = _path.join(require("node:os").homedir(), ".gmax", "mlx-embed-crashes.json");
144
+ const CRASH_FILE = _path.join(
145
+ require("node:os").homedir(),
146
+ ".gmax",
147
+ "mlx-embed-crashes.json",
148
+ );
138
149
  const MAX_CRASHES = 3;
139
150
  const CRASH_WINDOW_MS = 10 * 60 * 1000; // 10 minutes
140
151
 
141
152
  function readCrashCount() {
142
153
  try {
143
154
  const data = JSON.parse(fs.readFileSync(CRASH_FILE, "utf-8"));
144
- if (data.lastCrash && Date.now() - new Date(data.lastCrash).getTime() > CRASH_WINDOW_MS) {
155
+ if (
156
+ data.lastCrash &&
157
+ Date.now() - new Date(data.lastCrash).getTime() > CRASH_WINDOW_MS
158
+ ) {
145
159
  return { count: 0, lastCrash: null }; // Window expired, reset
146
160
  }
147
161
  return { count: data.count || 0, lastCrash: data.lastCrash };
@@ -157,7 +171,9 @@ function writeCrashCount(count, lastCrash) {
157
171
  }
158
172
 
159
173
  function resetCrashCount() {
160
- try { fs.unlinkSync(CRASH_FILE); } catch {}
174
+ try {
175
+ fs.unlinkSync(CRASH_FILE);
176
+ } catch {}
161
177
  }
162
178
 
163
179
  function isProjectRegistered() {
@@ -167,7 +183,9 @@ function isProjectRegistered() {
167
183
  ".gmax",
168
184
  "projects.json",
169
185
  );
170
- const projects = JSON.parse(require("node:fs").readFileSync(projectsPath, "utf-8"));
186
+ const projects = JSON.parse(
187
+ require("node:fs").readFileSync(projectsPath, "utf-8"),
188
+ );
171
189
  const cwd = process.cwd();
172
190
  return projects.some((p) => cwd.startsWith(p.root));
173
191
  } catch {
@@ -178,7 +196,10 @@ function isProjectRegistered() {
178
196
  function startWatcher() {
179
197
  if (!isProjectRegistered()) return;
180
198
  try {
181
- execFileSync("gmax", ["watch", "--daemon", "-b"], { timeout: 5000, stdio: "ignore" });
199
+ execFileSync("gmax", ["watch", "--daemon", "-b"], {
200
+ timeout: 5000,
201
+ stdio: "ignore",
202
+ });
182
203
  } catch {
183
204
  // Fallback to per-project mode (older gmax without --daemon)
184
205
  try {
@@ -200,14 +221,19 @@ async function main() {
200
221
  if (serverDir && !embedRunning) {
201
222
  const crashes = readCrashCount();
202
223
  if (crashes.count < MAX_CRASHES) {
203
- startPythonServer(serverDir, "server.py", "mlx-embed-server", "gmax-embed");
224
+ startPythonServer(
225
+ serverDir,
226
+ "server.py",
227
+ "mlx-embed-server",
228
+ "gmax-embed",
229
+ );
204
230
 
205
231
  // Fire-and-forget health verification (Item 13)
206
232
  (async () => {
207
233
  const maxAttempts = 5;
208
234
  const delayMs = 2000;
209
235
  for (let i = 0; i < maxAttempts; i++) {
210
- await new Promise(r => setTimeout(r, delayMs));
236
+ await new Promise((r) => setTimeout(r, delayMs));
211
237
  if (await isServerRunning(8100)) {
212
238
  resetCrashCount();
213
239
  return;
@@ -223,8 +249,17 @@ async function main() {
223
249
  }
224
250
 
225
251
  // Start LLM summarizer server (port 8101) — opt-in only
226
- if (process.env.GMAX_SUMMARIZER === "1" && serverDir && !(await isServerRunning(8101))) {
227
- startPythonServer(serverDir, "summarizer.py", "mlx-summarizer", "gmax-summarizer");
252
+ if (
253
+ process.env.GMAX_SUMMARIZER === "1" &&
254
+ serverDir &&
255
+ !(await isServerRunning(8101))
256
+ ) {
257
+ startPythonServer(
258
+ serverDir,
259
+ "summarizer.py",
260
+ "mlx-summarizer",
261
+ "gmax-summarizer",
262
+ );
228
263
  }
229
264
  }
230
265
 
@@ -33,10 +33,7 @@ function isProjectRegistered() {
33
33
  }
34
34
 
35
35
  // Agents that already know about gmax or can't use Bash
36
- const SKIP_AGENT_TYPES = [
37
- "grepmax:semantic-explore",
38
- "statusline-setup",
39
- ];
36
+ const SKIP_AGENT_TYPES = ["grepmax:semantic-explore", "statusline-setup"];
40
37
 
41
38
  async function main() {
42
39
  const input = await readStdin();