grepmax 0.2.0 → 0.2.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.
@@ -330,22 +330,32 @@ exports.mcp = new commander_1.Command("mcp")
330
330
  }
331
331
  const minScore = typeof args.min_score === "number" ? args.min_score : 0;
332
332
  const maxPerFile = typeof args.max_per_file === "number" ? args.max_per_file : 0;
333
+ const MAX_SNIPPET_LINES = 8;
333
334
  let compact = result.data.map((r) => {
334
335
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
335
- return ({
336
- path: (_c = (_a = r.path) !== null && _a !== void 0 ? _a : (_b = r.metadata) === null || _b === void 0 ? void 0 : _b.path) !== null && _c !== void 0 ? _c : "",
337
- startLine: (_f = (_d = r.startLine) !== null && _d !== void 0 ? _d : (_e = r.generated_metadata) === null || _e === void 0 ? void 0 : _e.start_line) !== null && _f !== void 0 ? _f : 0,
336
+ const startLine = (_c = (_a = r.startLine) !== null && _a !== void 0 ? _a : (_b = r.generated_metadata) === null || _b === void 0 ? void 0 : _b.start_line) !== null && _c !== void 0 ? _c : 0;
337
+ const raw = typeof r.content === "string"
338
+ ? r.content
339
+ : typeof r.text === "string"
340
+ ? r.text
341
+ : "";
342
+ // Add line numbers and cap at MAX_SNIPPET_LINES
343
+ const lines = raw.split("\n");
344
+ const capped = lines.slice(0, MAX_SNIPPET_LINES);
345
+ const numbered = capped.map((line, i) => `${startLine + i + 1}│${line}`);
346
+ const snippet = lines.length > MAX_SNIPPET_LINES
347
+ ? `${numbered.join("\n")}\n… (+${lines.length - MAX_SNIPPET_LINES} more lines)`
348
+ : numbered.join("\n");
349
+ return {
350
+ path: (_f = (_d = r.path) !== null && _d !== void 0 ? _d : (_e = r.metadata) === null || _e === void 0 ? void 0 : _e.path) !== null && _f !== void 0 ? _f : "",
351
+ startLine,
338
352
  endLine: (_j = (_g = r.endLine) !== null && _g !== void 0 ? _g : (_h = r.generated_metadata) === null || _h === void 0 ? void 0 : _h.end_line) !== null && _j !== void 0 ? _j : 0,
339
353
  score: typeof r.score === "number" ? +r.score.toFixed(3) : 0,
340
354
  role: (_k = r.role) !== null && _k !== void 0 ? _k : "IMPLEMENTATION",
341
355
  confidence: (_l = r.confidence) !== null && _l !== void 0 ? _l : "Unknown",
342
356
  definedSymbols: toStringArray((_m = r.definedSymbols) !== null && _m !== void 0 ? _m : r.defined_symbols).slice(0, 5),
343
- snippet: typeof r.content === "string"
344
- ? r.content
345
- : typeof r.text === "string"
346
- ? r.text
347
- : "",
348
- });
357
+ snippet,
358
+ };
349
359
  });
350
360
  if (minScore > 0) {
351
361
  compact = compact.filter((r) => r.score >= minScore);
@@ -418,31 +428,24 @@ exports.mcp = new commander_1.Command("mcp")
418
428
  return ok(`Symbol '${symbol}' not found in the index.`);
419
429
  }
420
430
  const lines = [];
431
+ // Center
432
+ lines.push(`${graph.center.symbol} [${graph.center.role}] ${graph.center.file}:${graph.center.line + 1}`);
421
433
  // Callers
422
434
  if (graph.callers.length > 0) {
423
- lines.push("Callers (who calls this?):");
435
+ lines.push("Callers:");
424
436
  for (const caller of graph.callers) {
425
- lines.push(` <- ${caller.symbol} (${caller.file}:${caller.line})`);
437
+ lines.push(` <- ${caller.symbol} ${caller.file}:${caller.line + 1}`);
426
438
  }
427
439
  }
428
440
  else {
429
- lines.push("No known callers.");
441
+ lines.push("Callers: none");
430
442
  }
431
- lines.push("");
432
- // Center
433
- lines.push(`${graph.center.symbol}`);
434
- lines.push(` Defined in ${graph.center.file}:${graph.center.line}`);
435
- lines.push(` Role: ${graph.center.role}`);
436
- lines.push("");
437
443
  // Callees
438
444
  if (graph.callees.length > 0) {
439
- lines.push("Callees (what does this call?):");
440
- for (const callee of graph.callees) {
441
- lines.push(` -> ${callee}`);
442
- }
445
+ lines.push(`Calls: ${graph.callees.join(", ")}`);
443
446
  }
444
447
  else {
445
- lines.push("No known callees.");
448
+ lines.push("Calls: none");
446
449
  }
447
450
  return ok(lines.join("\n"));
448
451
  }
@@ -506,7 +509,8 @@ exports.mcp = new commander_1.Command("mcp")
506
509
  if (entries.length === 0) {
507
510
  return ok("No symbols found. Run 'gmax index' to build the index.");
508
511
  }
509
- return ok(JSON.stringify(entries));
512
+ const lines = entries.map((e) => `${e.symbol}\t${e.path}:${e.line}`);
513
+ return ok(lines.join("\n"));
510
514
  }
511
515
  catch (e) {
512
516
  const msg = e instanceof Error ? e.message : String(e);
@@ -516,28 +520,24 @@ exports.mcp = new commander_1.Command("mcp")
516
520
  }
517
521
  function handleIndexStatus() {
518
522
  return __awaiter(this, void 0, void 0, function* () {
519
- var _a, _b, _c, _d;
523
+ var _a, _b, _c;
520
524
  try {
521
525
  const config = (0, index_config_1.readIndexConfig)(config_1.PATHS.configPath);
522
526
  const projects = (0, project_registry_1.listProjects)();
523
527
  const db = getVectorDb();
524
528
  const stats = yield db.getStats();
525
529
  const fileCount = yield db.getDistinctFileCount();
526
- return ok(JSON.stringify({
527
- store: "centralized (~/.gmax/lancedb)",
528
- totalChunks: stats.chunks,
529
- totalFiles: fileCount,
530
- totalBytes: stats.totalBytes,
531
- embedMode: (_a = config === null || config === void 0 ? void 0 : config.embedMode) !== null && _a !== void 0 ? _a : "unknown",
532
- model: (_b = config === null || config === void 0 ? void 0 : config.embedModel) !== null && _b !== void 0 ? _b : null,
533
- vectorDim: (_c = config === null || config === void 0 ? void 0 : config.vectorDim) !== null && _c !== void 0 ? _c : null,
534
- indexedAt: (_d = config === null || config === void 0 ? void 0 : config.indexedAt) !== null && _d !== void 0 ? _d : null,
535
- indexedDirectories: projects.map((p) => ({
536
- name: p.name,
537
- root: p.root,
538
- lastIndexed: p.lastIndexed,
539
- })),
540
- }));
530
+ const lines = [
531
+ `Index: ~/.gmax/lancedb (${stats.chunks} chunks, ${fileCount} files)`,
532
+ `Model: ${(_a = config === null || config === void 0 ? void 0 : config.embedModel) !== null && _a !== void 0 ? _a : "unknown"} (${(_b = config === null || config === void 0 ? void 0 : config.vectorDim) !== null && _b !== void 0 ? _b : "?"}d, ${(_c = config === null || config === void 0 ? void 0 : config.embedMode) !== null && _c !== void 0 ? _c : "unknown"})`,
533
+ (config === null || config === void 0 ? void 0 : config.indexedAt)
534
+ ? `Last indexed: ${config.indexedAt}`
535
+ : "",
536
+ "",
537
+ "Indexed directories:",
538
+ ...projects.map((p) => { var _a; return ` ${p.name}\t${p.root}\t${(_a = p.lastIndexed) !== null && _a !== void 0 ? _a : "unknown"}`; }),
539
+ ].filter(Boolean);
540
+ return ok(lines.join("\n"));
541
541
  }
542
542
  catch (e) {
543
543
  const msg = e instanceof Error ? e.message : String(e);
package/dist/config.js CHANGED
@@ -142,7 +142,6 @@ exports.INDEXABLE_EXTENSIONS = new Set([
142
142
  ".xml",
143
143
  ".md",
144
144
  ".mdx",
145
- ".txt",
146
145
  ".gitignore",
147
146
  ".dockerfile",
148
147
  "dockerfile",
@@ -22,6 +22,22 @@ exports.DEFAULT_IGNORE_PATTERNS = [
22
22
  "**/__pycache__/**",
23
23
  "**/coverage/**",
24
24
  "**/venv/**",
25
+ "**/.venv/**",
26
+ "**/.tox/**",
27
+ "**/.mypy_cache/**",
28
+ "**/.pytest_cache/**",
29
+ "**/.next/**",
30
+ "**/.nuxt/**",
31
+ "**/.gradle/**",
32
+ "**/.m2/**",
33
+ "**/vendor/**",
34
+ "**/.osgrep/**",
35
+ "**/.gmax/**",
36
+ // Minified/generated assets
37
+ "*.min.js",
38
+ "*.min.css",
39
+ "*.map",
40
+ "*.wasm",
25
41
  // Test fixtures and benchmark data
26
42
  "**/fixtures/**",
27
43
  "**/benchmark/**",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grepmax",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
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.2.0",
3
+ "version": "0.2.2",
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",