sigmap 7.21.0 → 7.22.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.
package/CHANGELOG.md CHANGED
@@ -10,6 +10,18 @@ Format: [Semantic Versioning](https://semver.org/)
10
10
 
11
11
  ---
12
12
 
13
+ ## [7.22.0] — 2026-06-18
14
+
15
+ Minor release — realistic §9 ablation (real-symbol corpus, exact-signature grounding, --verbose) + Gemini model fix.
16
+
17
+ ### Added
18
+ - **Realistic §9 ablation — real-symbol corpus, exact-signature grounding, `--verbose` (#344):** the LLM A/B ablation now measures something meaningful. `buildGrounding` emits **exact signatures grouped by file** (what `get_callee_signatures` returns, bounded by `maxSignatures`) instead of a flat symbol-name dump — the real product behavior. New `scripts/gen-ablation-corpus.mjs` generates ~40 tasks from the repo's actual exported symbols/files (`benchmarks/llm-ablation-tasks.json`). `src/eval/llm-ablation.js` adds `scoreAnswerDetail` (count + issues) and `runAblation`'s `collectIssues`; the runner's `--verbose` prints every flagged item per arm. A 40-task Gemini run showed grounding reduced flagged errors 62.5 → 22.5 per 100 (directionally positive vs the earlier 4-task noise) — and `--verbose` revealed most flags are `verify-ai-output` file-path false-positives (e.g. "Node.js"), the next thing to harden before publishing a number.
19
+
20
+ ### Fixed
21
+ - **Gemini default model (#343):** the ablation runner's default `gemini-2.0-flash` was retired by AI Studio (404 NOT_FOUND); the default is now the live `gemini-2.5-flash`. The `--model` flag selects any model.
22
+
23
+ ---
24
+
13
25
  ## [7.21.0] — 2026-06-18
14
26
 
15
27
  Minor release — LLM ablation runner gains a Gemini (AI Studio) provider.
package/gen-context.js CHANGED
@@ -7931,7 +7931,7 @@ __factories["./src/mcp/server"] = function(module, exports) {
7931
7931
 
7932
7932
  const SERVER_INFO = {
7933
7933
  name: 'sigmap',
7934
- version: '7.21.0',
7934
+ version: '7.22.0',
7935
7935
  description: 'SigMap MCP server — code signatures on demand',
7936
7936
  };
7937
7937
 
@@ -13609,7 +13609,7 @@ function __tryGit(args, opts = {}) {
13609
13609
  catch (_) { return ''; }
13610
13610
  }
13611
13611
 
13612
- const VERSION = '7.21.0';
13612
+ const VERSION = '7.22.0';
13613
13613
  const MARKER = '\n\n## Auto-generated signatures\n<!-- Updated by gen-context.js -->\n';
13614
13614
 
13615
13615
  function requireSourceOrBundled(key) {
package/llms-full.txt CHANGED
@@ -9,7 +9,7 @@ the files relevant to the task — cutting tokens ~97% while keeping answers
9
9
  grounded. Deterministic, offline, no embeddings or vector database. Works with
10
10
  Claude, Cursor, GitHub Copilot, Aider, Windsurf, local LLMs, and MCP.
11
11
 
12
- # Version: 7.21.0 | Benchmark: sigmap-v7.0-main (2026-06-14)
12
+ # Version: 7.22.0 | Benchmark: sigmap-v7.0-main (2026-06-14)
13
13
  # Source: auto-generated from package.json, version.json, src/mcp/tools.js, src/config/defaults.js
14
14
  # Regenerate: npm run generate:llms | Validate: npm run validate:llms
15
15
 
package/llms.txt CHANGED
@@ -9,7 +9,7 @@ the files relevant to the task — cutting tokens ~97% while keeping answers
9
9
  grounded. Deterministic, offline, no embeddings or vector database. Works with
10
10
  Claude, Cursor, GitHub Copilot, Aider, Windsurf, local LLMs, and MCP.
11
11
 
12
- # Version: 7.21.0 | Benchmark: sigmap-v7.0-main (2026-06-14)
12
+ # Version: 7.22.0 | Benchmark: sigmap-v7.0-main (2026-06-14)
13
13
  # Source: auto-generated from package.json, version.json, src/mcp/tools.js, src/config/defaults.js
14
14
  # Regenerate: npm run generate:llms | Validate: npm run validate:llms
15
15
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sigmap",
3
- "version": "7.21.0",
3
+ "version": "7.22.0",
4
4
  "description": "97% token reduction for AI coding. Extracts function & class signatures with TF-IDF ranking to feed only the right files to Claude, Cursor, Copilot, Aider, Windsurf, local LLMs & MCP. Zero dependencies, runs offline via npx.",
5
5
  "main": "packages/core/index.js",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sigmap-cli",
3
- "version": "7.21.0",
3
+ "version": "7.22.0",
4
4
  "description": "SigMap CLI wrapper — thin adapter for programmatic CLI invocation",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sigmap-core",
3
- "version": "7.21.0",
3
+ "version": "7.22.0",
4
4
  "description": "SigMap core library — zero-dependency code signature extraction, retrieval, and security scanning",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -13,59 +13,82 @@
13
13
 
14
14
  const { verify } = require('../verify/hallucination-guard');
15
15
 
16
+ const path = require('path');
17
+
18
+ /** Strip a signature's trailing line anchor (` :12-20`) for prompt cleanliness. */
19
+ function _cleanSig(sig) {
20
+ return String(sig).replace(/\s*:\d+(?:-\d+)?\s*$/, '').trim();
21
+ }
22
+
16
23
  /**
17
24
  * Build the SigMap grounding block for a repo — what we prepend to a task
18
- * prompt in arm B. Conventions (the house style) + the known-symbol list
19
- * (so the model can reference real names instead of guessing).
25
+ * prompt in arm B. Conventions (the house style) + **exact signatures** grouped
26
+ * by file (what `get_callee_signatures` returns), so the model references the
27
+ * real surface instead of guessing — the actual product behavior, not a flat
28
+ * name dump.
20
29
  * @param {string} cwd
21
30
  * @param {object} [opts]
22
- * @param {number} [opts.maxSymbols=80]
31
+ * @param {number} [opts.maxSignatures=150] cap on signature lines (bounds prompt size)
23
32
  * @returns {string}
24
33
  */
25
34
  function buildGrounding(cwd, opts = {}) {
26
- const maxSymbols = opts.maxSymbols != null ? opts.maxSymbols : 80;
35
+ const maxSignatures = opts.maxSignatures != null ? opts.maxSignatures : 150;
27
36
  const parts = [];
28
37
 
38
+ let index = null;
29
39
  try {
30
- const { extractConventions } = require('../conventions/extract');
31
- const { renderConventionsBlock } = require('../conventions/inject');
32
- const { loadConfig } = require('../config/loader');
33
- let files = [];
34
- try {
35
- const cfg = loadConfig(cwd);
36
- const { buildSigIndex } = require('../retrieval/ranker');
37
- files = [...buildSigIndex(cwd).keys()];
38
- void cfg;
39
- } catch (_) {}
40
- const conv = extractConventions(cwd, files);
41
- parts.push(renderConventionsBlock(conv));
40
+ const { buildSigIndex } = require('../retrieval/ranker');
41
+ index = buildSigIndex(cwd);
42
42
  } catch (_) {}
43
43
 
44
44
  try {
45
- const { buildSymbolSet } = require('../verify/hallucination-guard');
46
- const { set } = buildSymbolSet(cwd);
47
- const names = [...set].slice(0, maxSymbols);
48
- if (names.length) parts.push(`## Known symbols (reference these exactly)\n${names.join(', ')}`);
45
+ const { extractConventions } = require('../conventions/extract');
46
+ const { renderConventionsBlock } = require('../conventions/inject');
47
+ const files = index ? [...index.keys()] : [];
48
+ parts.push(renderConventionsBlock(extractConventions(cwd, files)));
49
49
  } catch (_) {}
50
50
 
51
+ if (index) {
52
+ const lines = ['## Exact signatures (use these — do not invent symbols or paths)'];
53
+ let count = 0;
54
+ for (const [file, sigs] of index) {
55
+ if (count >= maxSignatures) break;
56
+ const rel = path.relative(cwd, file).replace(/\\/g, '/');
57
+ const clean = (sigs || []).map(_cleanSig).filter(Boolean);
58
+ if (!clean.length) continue;
59
+ lines.push(`### ${rel}`);
60
+ for (const s of clean) {
61
+ if (count >= maxSignatures) break;
62
+ lines.push(s);
63
+ count++;
64
+ }
65
+ }
66
+ if (count > 0) parts.push(lines.join('\n'));
67
+ }
68
+
51
69
  return parts.join('\n\n');
52
70
  }
53
71
 
54
72
  /**
55
- * Count flagged codebase-fact errors in an answer (the §9 metric).
73
+ * Score an answer: flagged codebase-fact errors + the issue list (the §9 metric).
56
74
  * @param {string} answerText
57
75
  * @param {string} cwd
58
- * @returns {number}
76
+ * @returns {{ total: number, issues: object[] }}
59
77
  */
60
- function scoreAnswer(answerText, cwd) {
78
+ function scoreAnswerDetail(answerText, cwd) {
61
79
  try {
62
- const { summary } = verify(String(answerText || ''), cwd);
63
- return summary.total || 0;
80
+ const { issues, summary } = verify(String(answerText || ''), cwd);
81
+ return { total: summary.total || 0, issues: issues || [] };
64
82
  } catch (_) {
65
- return 0;
83
+ return { total: 0, issues: [] };
66
84
  }
67
85
  }
68
86
 
87
+ /** Count flagged codebase-fact errors in an answer (the §9 metric). */
88
+ function scoreAnswer(answerText, cwd) {
89
+ return scoreAnswerDetail(answerText, cwd).total;
90
+ }
91
+
69
92
  /**
70
93
  * Run the A/B ablation over a task corpus.
71
94
  * @param {Array<{id:string, prompt:string}>} tasks
@@ -73,6 +96,7 @@ function scoreAnswer(answerText, cwd) {
73
96
  * @param {(prompt:string, meta:object)=>string} complete injected model call
74
97
  * @param {object} [opts]
75
98
  * @param {string} [opts.grounding] precomputed grounding (else built from cwd)
99
+ * @param {boolean} [opts.collectIssues] attach `aIssues`/`bIssues` per task
76
100
  * @returns {{ tasks: object[], aggregate: object }}
77
101
  */
78
102
  function runAblation(tasks, cwd, complete, opts = {}) {
@@ -88,11 +112,13 @@ function runAblation(tasks, cwd, complete, opts = {}) {
88
112
  const outA = String(complete(basePrompt, { id: task.id, grounded: false }) || '');
89
113
  const outB = String(complete(groundedPrompt, { id: task.id, grounded: true }) || '');
90
114
 
91
- const aFlagged = scoreAnswer(outA, cwd);
92
- const bFlagged = scoreAnswer(outB, cwd);
93
- sumA += aFlagged;
94
- sumB += bFlagged;
95
- rows.push({ id: task.id, aFlagged, bFlagged });
115
+ const a = scoreAnswerDetail(outA, cwd);
116
+ const b = scoreAnswerDetail(outB, cwd);
117
+ sumA += a.total;
118
+ sumB += b.total;
119
+ const row = { id: task.id, aFlagged: a.total, bFlagged: b.total };
120
+ if (opts.collectIssues) { row.aIssues = a.issues; row.bIssues = b.issues; }
121
+ rows.push(row);
96
122
  }
97
123
 
98
124
  const n = rows.length;
@@ -110,4 +136,4 @@ function runAblation(tasks, cwd, complete, opts = {}) {
110
136
  };
111
137
  }
112
138
 
113
- module.exports = { buildGrounding, scoreAnswer, runAblation };
139
+ module.exports = { buildGrounding, scoreAnswer, scoreAnswerDetail, runAblation };
package/src/mcp/server.js CHANGED
@@ -18,7 +18,7 @@ const { readContext, searchSignatures, getMap, createCheckpoint, getRouting, exp
18
18
 
19
19
  const SERVER_INFO = {
20
20
  name: 'sigmap',
21
- version: '7.21.0',
21
+ version: '7.22.0',
22
22
  description: 'SigMap MCP server — code signatures on demand',
23
23
  };
24
24