sigmap 7.13.0 → 7.14.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,15 @@ Format: [Semantic Versioning](https://semver.org/)
10
10
 
11
11
  ---
12
12
 
13
+ ## [7.14.0] — 2026-06-17
14
+
15
+ Minor release — `sigmap conventions --report` (grounded codegen, Layer 3 polish).
16
+
17
+ ### Added
18
+ - **`sigmap conventions --report` — consistency audit + trend vs last run (#319):** the next `conventions` flag (IMPL.md §4). Reports a per-convention consistency score (file naming, export style) and a single file-count-weighted **overall consistency score**, each with a delta vs the previous run — a trackable "how consistent is our style, and is it improving?" number. New zero-dependency, bundle-safe `src/conventions/report.js` (`scoreReport`, `snapshot`, `overallScore`); the command compares against the last snapshot in `.context/conventions-history.ndjson`, prints the audit with ▲/▼ trend arrows, and appends a fresh snapshot. `--json` for machine output. The remaining `conventions` flags (`--fix`, `--update`, `--ci`) and the §9 LLM A/B benchmark are follow-ups.
19
+
20
+ ---
21
+
13
22
  ## [7.13.0] — 2026-06-17
14
23
 
15
24
  Minor release — `sigmap create` (grounded codegen, Gap 2 — the pipeline capstone).
package/gen-context.js CHANGED
@@ -29,6 +29,85 @@ function __require(key) {
29
29
  // ── ./src/cache/freshen ──
30
30
  // ── ./src/review/review-pr ──
31
31
  // ── ./src/create/orchestrate ──
32
+ // ── ./src/conventions/report ──
33
+ __factories["./src/conventions/report"] = function(module, exports) {
34
+
35
+ /**
36
+ * Convention audit + trend (IMPL.md §4 — `conventions --report`).
37
+ *
38
+ * Turns an `extractConventions` result into an audit: a consistency score per
39
+ * convention plus a single file-count-weighted overall score, each with a delta
40
+ * vs the previous run (the trend). Pure, zero-dependency, bundle-safe.
41
+ */
42
+
43
+ const NAMES = { fileNaming: 'file naming', exportStyle: 'export style' };
44
+
45
+ /** File-count-weighted mean of the scored conventions' dominant shares (0–1). */
46
+ function overallScore(result) {
47
+ let num = 0;
48
+ let den = 0;
49
+ for (const key of ['fileNaming', 'exportStyle']) {
50
+ const c = result && result[key];
51
+ if (c && c.total > 0) { num += c.dominantPct * c.total; den += c.total; }
52
+ }
53
+ return den > 0 ? num / den : 0;
54
+ }
55
+
56
+ /**
57
+ * Build a consistency report with trend vs a prior snapshot.
58
+ * @param {object} result an `extractConventions` result
59
+ * @param {object|null} [prior] a previous snapshot (this module's `snapshot` shape)
60
+ * @returns {{ conventions: object[], testFramework: string|null,
61
+ * score: number, prevScore: number|null, scoreDelta: number|null }}
62
+ */
63
+ function scoreReport(result, prior) {
64
+ const conventions = [];
65
+ for (const key of ['fileNaming', 'exportStyle']) {
66
+ const c = (result && result[key]) || { dominant: null, dominantPct: 0, total: 0, tier: 'unknown' };
67
+ const priorPct = prior && prior[key] && typeof prior[key].dominantPct === 'number' ? prior[key].dominantPct : null;
68
+ conventions.push({
69
+ key,
70
+ name: NAMES[key] || key,
71
+ dominant: c.dominant,
72
+ dominantPct: c.dominantPct,
73
+ tier: c.tier,
74
+ total: c.total,
75
+ delta: priorPct == null ? null : c.dominantPct - priorPct,
76
+ });
77
+ }
78
+ const score = overallScore(result);
79
+ const prevScore = prior && typeof prior.score === 'number' ? prior.score : null;
80
+ return {
81
+ conventions,
82
+ testFramework: (result && result.testFramework) || null,
83
+ score,
84
+ prevScore,
85
+ scoreDelta: prevScore == null ? null : score - prevScore,
86
+ };
87
+ }
88
+
89
+ /**
90
+ * A compact, persistable snapshot of a run (one line in the history log).
91
+ * @param {object} result an `extractConventions` result
92
+ * @param {string} [ts] ISO timestamp (caller supplies — keeps this pure)
93
+ */
94
+ function snapshot(result, ts) {
95
+ const pick = (c) => (c && c.total > 0
96
+ ? { dominant: c.dominant, dominantPct: c.dominantPct, tier: c.tier, total: c.total }
97
+ : { dominant: null, dominantPct: 0, tier: 'unknown', total: 0 });
98
+ return {
99
+ ts: ts || null,
100
+ fileNaming: pick(result && result.fileNaming),
101
+ exportStyle: pick(result && result.exportStyle),
102
+ testFramework: (result && result.testFramework) || null,
103
+ score: overallScore(result),
104
+ };
105
+ }
106
+
107
+ module.exports = { scoreReport, snapshot, overallScore };
108
+
109
+ };
110
+
32
111
  __factories["./src/create/orchestrate"] = function(module, exports) {
33
112
 
34
113
  /**
@@ -7459,7 +7538,7 @@ __factories["./src/mcp/server"] = function(module, exports) {
7459
7538
 
7460
7539
  const SERVER_INFO = {
7461
7540
  name: 'sigmap',
7462
- version: '7.13.0',
7541
+ version: '7.14.0',
7463
7542
  description: 'SigMap MCP server — code signatures on demand',
7464
7543
  };
7465
7544
 
@@ -13137,7 +13216,7 @@ function __tryGit(args, opts = {}) {
13137
13216
  catch (_) { return ''; }
13138
13217
  }
13139
13218
 
13140
- const VERSION = '7.13.0';
13219
+ const VERSION = '7.14.0';
13141
13220
  const MARKER = '\n\n## Auto-generated signatures\n<!-- Updated by gen-context.js -->\n';
13142
13221
 
13143
13222
  function requireSourceOrBundled(key) {
@@ -16332,6 +16411,38 @@ function main() {
16332
16411
  process.exit(0);
16333
16412
  }
16334
16413
 
16414
+ // `--report`: consistency audit + score + trend vs the last run.
16415
+ if (args.includes('--report')) {
16416
+ const { scoreReport, snapshot } = requireSourceOrBundled('./src/conventions/report');
16417
+ const histPath = path.join(cwd, '.context', 'conventions-history.ndjson');
16418
+ let prior = null;
16419
+ try {
16420
+ const lines = fs.readFileSync(histPath, 'utf8').split('\n').filter(Boolean);
16421
+ if (lines.length) prior = JSON.parse(lines[lines.length - 1]);
16422
+ } catch (_) {}
16423
+ const report = scoreReport(result, prior);
16424
+ // Append the new snapshot to the history log.
16425
+ try {
16426
+ fs.mkdirSync(path.join(cwd, '.context'), { recursive: true });
16427
+ fs.appendFileSync(histPath, JSON.stringify(snapshot(result, new Date().toISOString())) + '\n');
16428
+ } catch (_) {}
16429
+
16430
+ if (jsonOut) {
16431
+ process.stdout.write(JSON.stringify(report) + '\n');
16432
+ process.exit(0);
16433
+ }
16434
+ const pctR = (n) => `${(n * 100).toFixed(0)}%`;
16435
+ const arrow = (d) => (d == null ? '' : d > 0.0005 ? ` ▲${(d * 100).toFixed(0)}pp` : d < -0.0005 ? ` ▼${(Math.abs(d) * 100).toFixed(0)}pp` : ' =');
16436
+ console.log('[sigmap] conventions --report (TS/JS/Python)');
16437
+ console.log(` overall consistency: ${pctR(report.score)}${arrow(report.scoreDelta)}${report.prevScore == null ? ' (first run)' : ''}`);
16438
+ for (const c of report.conventions) {
16439
+ if (c.total === 0) { console.log(` ${c.name.padEnd(14)} n/a (no samples)`); continue; }
16440
+ console.log(` ${c.name.padEnd(14)} ${c.dominant} ${pctR(c.dominantPct)} [${c.tier}]${arrow(c.delta)}`);
16441
+ }
16442
+ console.log(` ${'test framework'.padEnd(14)} ${report.testFramework || 'none detected'}`);
16443
+ process.exit(0);
16444
+ }
16445
+
16335
16446
  // `--conflicts`: surface why a convention is mixed (breakdown + rename suggestions).
16336
16447
  if (args.includes('--conflicts')) {
16337
16448
  const { analyzeConflicts } = requireSourceOrBundled('./src/conventions/conflicts');
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.13.0 | Benchmark: sigmap-v7.0-main (2026-06-14)
12
+ # Version: 7.14.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.13.0 | Benchmark: sigmap-v7.0-main (2026-06-14)
12
+ # Version: 7.14.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.13.0",
3
+ "version": "7.14.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.13.0",
3
+ "version": "7.14.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.13.0",
3
+ "version": "7.14.0",
4
4
  "description": "SigMap core library — zero-dependency code signature extraction, retrieval, and security scanning",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -0,0 +1,75 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Convention audit + trend (IMPL.md §4 — `conventions --report`).
5
+ *
6
+ * Turns an `extractConventions` result into an audit: a consistency score per
7
+ * convention plus a single file-count-weighted overall score, each with a delta
8
+ * vs the previous run (the trend). Pure, zero-dependency, bundle-safe.
9
+ */
10
+
11
+ const NAMES = { fileNaming: 'file naming', exportStyle: 'export style' };
12
+
13
+ /** File-count-weighted mean of the scored conventions' dominant shares (0–1). */
14
+ function overallScore(result) {
15
+ let num = 0;
16
+ let den = 0;
17
+ for (const key of ['fileNaming', 'exportStyle']) {
18
+ const c = result && result[key];
19
+ if (c && c.total > 0) { num += c.dominantPct * c.total; den += c.total; }
20
+ }
21
+ return den > 0 ? num / den : 0;
22
+ }
23
+
24
+ /**
25
+ * Build a consistency report with trend vs a prior snapshot.
26
+ * @param {object} result an `extractConventions` result
27
+ * @param {object|null} [prior] a previous snapshot (this module's `snapshot` shape)
28
+ * @returns {{ conventions: object[], testFramework: string|null,
29
+ * score: number, prevScore: number|null, scoreDelta: number|null }}
30
+ */
31
+ function scoreReport(result, prior) {
32
+ const conventions = [];
33
+ for (const key of ['fileNaming', 'exportStyle']) {
34
+ const c = (result && result[key]) || { dominant: null, dominantPct: 0, total: 0, tier: 'unknown' };
35
+ const priorPct = prior && prior[key] && typeof prior[key].dominantPct === 'number' ? prior[key].dominantPct : null;
36
+ conventions.push({
37
+ key,
38
+ name: NAMES[key] || key,
39
+ dominant: c.dominant,
40
+ dominantPct: c.dominantPct,
41
+ tier: c.tier,
42
+ total: c.total,
43
+ delta: priorPct == null ? null : c.dominantPct - priorPct,
44
+ });
45
+ }
46
+ const score = overallScore(result);
47
+ const prevScore = prior && typeof prior.score === 'number' ? prior.score : null;
48
+ return {
49
+ conventions,
50
+ testFramework: (result && result.testFramework) || null,
51
+ score,
52
+ prevScore,
53
+ scoreDelta: prevScore == null ? null : score - prevScore,
54
+ };
55
+ }
56
+
57
+ /**
58
+ * A compact, persistable snapshot of a run (one line in the history log).
59
+ * @param {object} result an `extractConventions` result
60
+ * @param {string} [ts] ISO timestamp (caller supplies — keeps this pure)
61
+ */
62
+ function snapshot(result, ts) {
63
+ const pick = (c) => (c && c.total > 0
64
+ ? { dominant: c.dominant, dominantPct: c.dominantPct, tier: c.tier, total: c.total }
65
+ : { dominant: null, dominantPct: 0, tier: 'unknown', total: 0 });
66
+ return {
67
+ ts: ts || null,
68
+ fileNaming: pick(result && result.fileNaming),
69
+ exportStyle: pick(result && result.exportStyle),
70
+ testFramework: (result && result.testFramework) || null,
71
+ score: overallScore(result),
72
+ };
73
+ }
74
+
75
+ module.exports = { scoreReport, snapshot, overallScore };
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.13.0',
21
+ version: '7.14.0',
22
22
  description: 'SigMap MCP server — code signatures on demand',
23
23
  };
24
24