grepmax 0.18.0 → 0.18.1

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.
@@ -63,7 +63,7 @@ exports.search = new commander_1.Command("search")
63
63
  .option("--explain", "Show scoring breakdown per result", false)
64
64
  .option("--context-for-llm", "Return full function body + imports per result", false)
65
65
  .option("--budget <tokens>", "Max tokens for --context-for-llm output (default 8000)", "8000")
66
- .option("--min-score <score>", "Minimum relevance score (0-1) to include in results", "0")
66
+ .option("--min-score <score>", "Minimum relevance score to include. Scores are per-query-normalized (top hit = 1.0), so this is relative to the best match in THIS query, not an absolute confidence threshold.", "0")
67
67
  .option("--compact", "Compact hits view (paths + line ranges + role/preview)", false)
68
68
  .option("--plain", "Disable ANSI colors and use simpler formatting", false)
69
69
  .option("-s, --sync", "Syncs the local files to the store before searching", false)
@@ -56,16 +56,50 @@ const project_root_1 = require("../lib/utils/project-root");
56
56
  const useColors = process.stdout.isTTY && !process.env.NO_COLOR;
57
57
  const dim = (s) => (useColors ? `\x1b[2m${s}\x1b[22m` : s);
58
58
  const bold = (s) => (useColors ? `\x1b[1m${s}\x1b[22m` : s);
59
- function formatTraceAgent(graph, projectRoot) {
59
+ function formatTraceAgent(graph, projectRoot, raw = false) {
60
60
  if (!graph.center)
61
61
  return "(not found)";
62
+ const center = graph.center;
62
63
  const rel = (p) => p.startsWith(projectRoot) ? p.slice(projectRoot.length + 1) : p;
63
64
  const lines = [];
64
- lines.push(`${graph.center.symbol}\t${rel(graph.center.file)}:${graph.center.line}\t${graph.center.role}`);
65
+ lines.push(`${center.symbol}\t${rel(center.file)}:${center.line}\t${center.role}`);
66
+ // A "self edge" is the traced symbol referencing itself (recursion) or its own
67
+ // definition chunk surfacing as a caller — noise in nearly every trace. Hidden
68
+ // by default; --raw brings them back.
69
+ const isSelfEdge = (n) => n.symbol === center.symbol ||
70
+ (n.file === center.file && n.line === center.line);
65
71
  function walkCallers(tree, depth) {
72
+ if (raw) {
73
+ for (const t of tree) {
74
+ lines.push(`${" ".repeat(depth)}<- ${t.node.symbol}\t${rel(t.node.file)}:${t.node.line}`);
75
+ walkCallers(t.callers, depth + 1);
76
+ }
77
+ return;
78
+ }
79
+ // Collapse repeated callers: the common flood is ONE caller symbol matched at
80
+ // many call-sites (e.g. `mcp` ×9). Group by (symbol, file), merge their lines
81
+ // onto a single row, and recurse into the union of their sub-callers.
82
+ const groups = new Map();
83
+ const order = [];
66
84
  for (const t of tree) {
67
- lines.push(`${" ".repeat(depth)}<- ${t.node.symbol}\t${rel(t.node.file)}:${t.node.line}`);
68
- walkCallers(t.callers, depth + 1);
85
+ if (isSelfEdge(t.node))
86
+ continue;
87
+ const key = `${t.node.symbol}\t${t.node.file}`;
88
+ let g = groups.get(key);
89
+ if (!g) {
90
+ g = { symbol: t.node.symbol, file: t.node.file, lineSet: new Set(), sub: [] };
91
+ groups.set(key, g);
92
+ order.push(key);
93
+ }
94
+ g.lineSet.add(t.node.line);
95
+ g.sub.push(...t.callers);
96
+ }
97
+ for (const key of order) {
98
+ const g = groups.get(key);
99
+ const locs = [...g.lineSet].sort((a, b) => a - b).join(",");
100
+ const loc = g.file ? `${rel(g.file)}:${locs}` : "(not indexed)";
101
+ lines.push(`${" ".repeat(depth)}<- ${g.symbol}\t${loc}`);
102
+ walkCallers(g.sub, depth + 1);
69
103
  }
70
104
  }
71
105
  walkCallers(graph.callerTree, 0);
@@ -174,6 +208,7 @@ exports.trace = new commander_1.Command("trace")
174
208
  .option("--inbound", "Show only callers, with call-site snippets", false)
175
209
  .option("--no-snippets", "Suppress call-site snippets in --inbound output")
176
210
  .option("--limit <n>", "Max callers shown per node in --inbound (default 10)", "10")
211
+ .option("--raw", "In --agent mode, list every call-site without collapsing repeated callers or hiding self-edges", false)
177
212
  .action((symbol, opts) => __awaiter(void 0, void 0, void 0, function* () {
178
213
  var _a;
179
214
  const depth = Math.min(Math.max(Number.parseInt(opts.depth || "1", 10), 1), 3);
@@ -214,7 +249,7 @@ exports.trace = new commander_1.Command("trace")
214
249
  }
215
250
  }
216
251
  else if (opts.agent) {
217
- console.log(formatTraceAgent(graph, projectRoot));
252
+ console.log(formatTraceAgent(graph, projectRoot, opts.raw));
218
253
  if (!graph.center)
219
254
  process.exitCode = 1;
220
255
  }
@@ -37,7 +37,7 @@ Survey:
37
37
 
38
38
  Scope flags: --root <name|path>, --in <subpath>, --exclude <subpath>.
39
39
  Roles in results: [DEFI] [ORCH] [IMPL] [DOCS].
40
- Notation: s=/d= score/distance (higher s / lower d = better) · C:n complexity ·
40
+ Notation: s=/d= score/distance (higher s / lower d = better; s is per-query-normalized — top hit ≈1.0, relative to this query, not absolute confidence) · C:n complexity ·
41
41
  <- caller / -> callee · dep:/rev: outbound/inbound file deps (count = shared symbols) ·
42
42
  test hops: direct = calls it, N-hop = N calls away, via-import = imports but call unseen ·
43
43
  test via=X,Y: caller symbols inside the test file (often helpers, not the tests) ·
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grepmax",
3
- "version": "0.18.0",
3
+ "version": "0.18.1",
4
4
  "author": "Robert Owens <78518764+reowens@users.noreply.github.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.18.0",
3
+ "version": "0.18.1",
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",