grepmax 0.24.0 → 0.25.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 (75) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/README.md +11 -6
  3. package/dist/commands/add.js +38 -31
  4. package/dist/commands/config.js +16 -15
  5. package/dist/commands/context.js +38 -13
  6. package/dist/commands/doctor.js +76 -83
  7. package/dist/commands/extract.js +12 -1
  8. package/dist/commands/index.js +23 -24
  9. package/dist/commands/list.js +23 -14
  10. package/dist/commands/mcp.js +278 -143
  11. package/dist/commands/peek.js +16 -5
  12. package/dist/commands/repair.js +54 -120
  13. package/dist/commands/search-output.js +30 -9
  14. package/dist/commands/search-run.js +75 -47
  15. package/dist/commands/search-skeletons.js +28 -18
  16. package/dist/commands/search.js +45 -49
  17. package/dist/commands/serve.js +415 -373
  18. package/dist/commands/setup.js +2 -2
  19. package/dist/commands/similar.js +5 -5
  20. package/dist/commands/skeleton.js +67 -41
  21. package/dist/commands/status.js +5 -2
  22. package/dist/commands/summarize.js +6 -0
  23. package/dist/commands/watch.js +102 -38
  24. package/dist/config.js +3 -0
  25. package/dist/lib/daemon/daemon.js +1101 -379
  26. package/dist/lib/daemon/ipc-handler.js +122 -13
  27. package/dist/lib/daemon/mlx-server-manager.js +268 -125
  28. package/dist/lib/daemon/process-manager.js +7 -4
  29. package/dist/lib/daemon/search-handler.js +23 -9
  30. package/dist/lib/daemon/watcher-manager.js +353 -110
  31. package/dist/lib/index/batch-processor.js +231 -67
  32. package/dist/lib/index/embedding-generation.js +109 -0
  33. package/dist/lib/index/embedding-status.js +23 -0
  34. package/dist/lib/index/file-policy.js +273 -0
  35. package/dist/lib/index/ignore-patterns.js +4 -0
  36. package/dist/lib/index/index-config.js +18 -4
  37. package/dist/lib/index/syncer.js +256 -79
  38. package/dist/lib/index/walker.js +66 -86
  39. package/dist/lib/index/watcher-batch.js +9 -0
  40. package/dist/lib/index/watcher.js +129 -3
  41. package/dist/lib/llm/server.js +6 -0
  42. package/dist/lib/search/searcher.js +30 -19
  43. package/dist/lib/store/store-lease.js +473 -0
  44. package/dist/lib/store/vector-db.js +302 -57
  45. package/dist/lib/utils/blocked-roots.js +63 -0
  46. package/dist/lib/utils/cross-project.js +7 -3
  47. package/dist/lib/utils/daemon-client.js +24 -1
  48. package/dist/lib/utils/daemon-launcher.js +38 -13
  49. package/dist/lib/utils/doctor-status.js +76 -0
  50. package/dist/lib/utils/file-utils.js +74 -4
  51. package/dist/lib/utils/keyed-mutex.js +101 -0
  52. package/dist/lib/utils/logger.js +57 -1
  53. package/dist/lib/utils/mlx-hf-cache.js +114 -0
  54. package/dist/lib/utils/operation-coordinator.js +146 -0
  55. package/dist/lib/utils/path-containment.js +106 -0
  56. package/dist/lib/utils/process.js +44 -0
  57. package/dist/lib/utils/project-registry.js +351 -3
  58. package/dist/lib/utils/scope-filter.js +3 -9
  59. package/dist/lib/utils/stale-hint.js +12 -19
  60. package/dist/lib/utils/watcher-launcher.js +5 -1
  61. package/dist/lib/utils/watcher-store.js +2 -2
  62. package/dist/lib/workers/colbert-math.js +15 -12
  63. package/dist/lib/workers/embeddings/colbert.js +3 -2
  64. package/dist/lib/workers/embeddings/granite.js +4 -3
  65. package/dist/lib/workers/embeddings/mlx-client.js +59 -16
  66. package/dist/lib/workers/orchestrator.js +39 -8
  67. package/dist/lib/workers/pool.js +146 -82
  68. package/dist/lib/workers/process-child.js +11 -2
  69. package/dist/lib/workers/serialized-handler.js +10 -0
  70. package/dist/lib/workers/worker.js +13 -4
  71. package/mlx-embed-server/server.py +21 -3
  72. package/mlx-embed-server/summarizer.py +8 -0
  73. package/package.json +4 -3
  74. package/plugins/grepmax/.claude-plugin/plugin.json +1 -1
  75. package/plugins/grepmax/hooks/start.js +3 -170
@@ -43,13 +43,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
43
43
  };
44
44
  Object.defineProperty(exports, "__esModule", { value: true });
45
45
  exports.search = void 0;
46
- const path = __importStar(require("node:path"));
47
46
  const commander_1 = require("commander");
48
47
  const setup_helpers_1 = require("../lib/setup/setup-helpers");
49
48
  const cross_project_1 = require("../lib/utils/cross-project");
50
49
  const exit_1 = require("../lib/utils/exit");
51
50
  const project_registry_1 = require("../lib/utils/project-registry");
52
51
  const project_root_1 = require("../lib/utils/project-root");
52
+ const scope_filter_1 = require("../lib/utils/scope-filter");
53
53
  const server_registry_1 = require("../lib/utils/server-registry");
54
54
  const stale_hint_1 = require("../lib/utils/stale-hint");
55
55
  const search_output_1 = require("./search-output");
@@ -99,7 +99,7 @@ Examples:
99
99
  gmax "auth middleware" --projects api,gateway --plain
100
100
  `)
101
101
  .action((pattern, exec_path, _options, cmd) => __awaiter(void 0, void 0, void 0, function* () {
102
- var _a, _b, _c, _d, _e;
102
+ var _a, _b, _c, _d, _e, _f;
103
103
  const options = cmd.optsWithGlobals();
104
104
  const root = process.cwd();
105
105
  const minScore = Number.isFinite(Number.parseFloat(options.minScore))
@@ -133,6 +133,14 @@ Examples:
133
133
  process.exitCode = 1;
134
134
  return;
135
135
  }
136
+ if (options.root ||
137
+ exec_path ||
138
+ ((_a = options.in) === null || _a === void 0 ? void 0 : _a.length) ||
139
+ ((_b = options.exclude) === null || _b === void 0 ? void 0 : _b.length)) {
140
+ console.error("--root, [path], --in, and --exclude are single-project; drop --all-projects/--projects or remove the project/path scope.");
141
+ process.exitCode = 1;
142
+ return;
143
+ }
136
144
  for (const w of crossProject.warnings)
137
145
  console.warn(`Warning: ${w}`);
138
146
  if (!crossProject.roots.length) {
@@ -146,16 +154,37 @@ Examples:
146
154
  // daemon-mediated / in-process path (both query the shared table).
147
155
  let resolvedOptionRoot;
148
156
  if (options.root && !crossProject.active) {
149
- resolvedOptionRoot = (0, project_registry_1.resolveRootOrExit)(options.root);
150
- if (resolvedOptionRoot === null)
157
+ const resolved = (0, project_registry_1.resolveRootOrExit)(options.root);
158
+ if (resolved === null)
151
159
  return;
160
+ resolvedOptionRoot = (_c = (0, project_root_1.findProjectRoot)(resolved)) !== null && _c !== void 0 ? _c : resolved;
161
+ }
162
+ const cwdProjectRoot = (_d = (0, project_root_1.findProjectRoot)(root)) !== null && _d !== void 0 ? _d : root;
163
+ const projectRootForServer = resolvedOptionRoot !== null && resolvedOptionRoot !== void 0 ? resolvedOptionRoot : cwdProjectRoot;
164
+ if (exec_path && options.in && options.in.length > 0) {
165
+ console.warn("Warning: --in overrides positional [path]; using --in.");
166
+ }
167
+ let scope;
168
+ try {
169
+ scope = (0, scope_filter_1.resolveScope)({
170
+ projectRoot: projectRootForServer,
171
+ in: options.in && options.in.length > 0
172
+ ? options.in
173
+ : exec_path
174
+ ? [exec_path]
175
+ : undefined,
176
+ exclude: options.exclude,
177
+ });
178
+ }
179
+ catch (err) {
180
+ console.error(`Search failed: ${err instanceof Error ? err.message : String(err)}`);
181
+ process.exitCode = 1;
182
+ yield (0, exit_1.gracefulExit)(1);
183
+ return;
152
184
  }
153
- const execPathForServer = resolvedOptionRoot
154
- ? resolvedOptionRoot
155
- : exec_path
156
- ? path.resolve(exec_path)
157
- : root;
158
- const projectRootForServer = (_a = (0, project_root_1.findProjectRoot)(execPathForServer)) !== null && _a !== void 0 ? _a : execPathForServer;
185
+ const containedExecPath = exec_path && !(options.in && options.in.length > 0)
186
+ ? scope.pathPrefix.replace(/\/$/, "")
187
+ : undefined;
159
188
  const server = crossProject.active
160
189
  ? null
161
190
  : (0, server_registry_1.getServerForProject)(projectRootForServer);
@@ -166,7 +195,7 @@ Examples:
166
195
  const handled = yield (0, search_output_1.executeServerSearch)({
167
196
  server,
168
197
  pattern,
169
- exec_path,
198
+ exec_path: containedExecPath,
170
199
  projectRootForServer,
171
200
  options,
172
201
  minScore,
@@ -176,8 +205,6 @@ Examples:
176
205
  }
177
206
  try {
178
207
  yield (0, setup_helpers_1.ensureSetup)();
179
- const searchRoot = exec_path ? path.resolve(exec_path) : root;
180
- const cwdProjectRoot = (_b = (0, project_root_1.findProjectRoot)(searchRoot)) !== null && _b !== void 0 ? _b : searchRoot;
181
208
  let checkRoot = cwdProjectRoot;
182
209
  if (options.root) {
183
210
  const resolved = resolvedOptionRoot !== undefined
@@ -185,7 +212,7 @@ Examples:
185
212
  : (0, project_registry_1.resolveRootOrExit)(options.root);
186
213
  if (resolved === null)
187
214
  return;
188
- checkRoot = (_c = (0, project_root_1.findProjectRoot)(resolved)) !== null && _c !== void 0 ? _c : resolved;
215
+ checkRoot = (_e = (0, project_root_1.findProjectRoot)(resolved)) !== null && _e !== void 0 ? _e : resolved;
189
216
  }
190
217
  const projectRoot = crossProject.active ? cwdProjectRoot : checkRoot;
191
218
  const paths = (0, project_root_1.ensureProjectPaths)(projectRoot);
@@ -210,34 +237,7 @@ Examples:
210
237
  // and in-process search paths need them. Reuse the resolved checkRoot
211
238
  // so --root <name> only resolves once per invocation.
212
239
  const effectiveRoot = checkRoot;
213
- // --in / --exclude / [path positional] composition. --in wins over the
214
- // positional [path] when both are given (positional was the older
215
- // shape; --in is canonical going forward).
216
- if (exec_path && options.in && options.in.length > 0) {
217
- console.warn("Warning: --in overrides positional [path]; using --in.");
218
- }
219
- const { resolveScope } = yield Promise.resolve().then(() => __importStar(require("../lib/utils/scope-filter")));
220
- const scope = resolveScope({
221
- projectRoot: effectiveRoot,
222
- in: options.in,
223
- exclude: options.exclude,
224
- });
225
- // Cross-project mode drops the single-project path prefix (and any
226
- // --in/[path] sub-scoping, which is meaningless across roots) in favor of
227
- // the project_roots filter clauses computed below.
228
- if (crossProject.active && (exec_path || ((_d = options.in) === null || _d === void 0 ? void 0 : _d.length))) {
229
- console.warn("Warning: --in / [path] are single-project; ignored under --all-projects/--projects.");
230
- }
231
- const pathFilter = crossProject.active
232
- ? undefined
233
- : options.in && options.in.length > 0
234
- ? scope.pathPrefix
235
- : exec_path
236
- ? (() => {
237
- const p = path.resolve(exec_path);
238
- return p.endsWith("/") ? p : `${p}/`;
239
- })()
240
- : scope.pathPrefix;
240
+ const pathFilter = crossProject.active ? undefined : scope.pathPrefix;
241
241
  const searchFilters = {};
242
242
  if (options.file)
243
243
  searchFilters.file = options.file;
@@ -246,11 +246,7 @@ Examples:
246
246
  if (options.role)
247
247
  searchFilters.role = options.role;
248
248
  if (crossProject.active) {
249
- if (crossProject.projectRootsCsv)
250
- searchFilters.project_roots = crossProject.projectRootsCsv;
251
- if (crossProject.excludeProjectRootsCsv)
252
- searchFilters.exclude_project_roots =
253
- crossProject.excludeProjectRootsCsv;
249
+ searchFilters.projectRoots = crossProject.projectRoots;
254
250
  }
255
251
  else {
256
252
  if (scope.inPrefixes.length > 0)
@@ -324,13 +320,13 @@ Examples:
324
320
  source: "cli",
325
321
  tool: "search",
326
322
  query: pattern,
327
- project: (_e = (0, project_root_1.findProjectRoot)(root)) !== null && _e !== void 0 ? _e : root,
323
+ project: (_f = (0, project_root_1.findProjectRoot)(root)) !== null && _f !== void 0 ? _f : root,
328
324
  results: _searchResultCount,
329
325
  ms: Date.now() - _searchStartMs,
330
326
  error: _searchError,
331
327
  });
332
328
  }
333
- catch (_f) { }
329
+ catch (_g) { }
334
330
  if (vectorDb) {
335
331
  try {
336
332
  yield vectorDb.close();