sigmap 7.8.0 → 7.9.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.9.0] — 2026-06-17
14
+
15
+ Minor release — `sigmap conventions --inject` (grounded codegen, Layer 3).
16
+
17
+ ### Added
18
+ - **`sigmap conventions --inject` — write the conventions block into CLAUDE.md (#304):** the next slice of Layer 3, completing the "agent sees the house style" link in the grounded-creation loop. Renders the detected conventions (file naming, export style, test framework — each with its dominant pattern and consistency tier) into a marker-delimited block and injects it into `CLAUDE.md`, creating the file if absent. New zero-dependency, bundle-safe `src/conventions/inject.js` (`renderConventionsBlock`, `injectConventions`): the injection is idempotent and marker-scoped (`<!-- sigmap-conventions:start -->` … `:end -->`), preserving all human content and coexisting with the existing `## Auto-generated signatures` block. `--report`, `--fix`, `--update`, `--ci`, and Layer 4 scaffold remain follow-ups.
19
+
20
+ ---
21
+
13
22
  ## [7.8.0] — 2026-06-17
14
23
 
15
24
  Minor release — `sigmap conventions --conflicts` (grounded codegen, Layer 3).
package/gen-context.js CHANGED
@@ -23,6 +23,108 @@ function __require(key) {
23
23
  // ── ./src/cache/freshen ──
24
24
  // ── ./src/conventions/extract ──
25
25
  // ── ./src/conventions/conflicts ──
26
+ // ── ./src/conventions/inject ──
27
+ __factories["./src/conventions/inject"] = function(module, exports) {
28
+
29
+ /**
30
+ * CLAUDE.md convention injection (IMPL.md §7 Phase 2 / §8 step 5).
31
+ *
32
+ * Renders the conventions detected by `extractConventions` into a
33
+ * marker-delimited markdown block and injects it into CLAUDE.md so an agent
34
+ * reading the file plans grounded in the repo's house style. Idempotent and
35
+ * marker-scoped — it never touches human content or the `## Auto-generated
36
+ * signatures` block. Pure string transforms; zero-dependency, bundle-safe.
37
+ */
38
+
39
+ const START = '<!-- sigmap-conventions:start -->';
40
+ const END = '<!-- sigmap-conventions:end -->';
41
+
42
+ const TIER_NOTE = {
43
+ consistent: 'consistent — match it',
44
+ mostly: 'dominant, with some drift',
45
+ inconsistent: 'no clear convention — check neighboring files',
46
+ };
47
+
48
+ const NAMES = {
49
+ fileNaming: 'File naming',
50
+ exportStyle: 'Export style',
51
+ };
52
+
53
+ const _pct = (n) => `${Math.round(n * 100)}%`;
54
+
55
+ function _conventionLine(label, conv) {
56
+ if (!conv || conv.total === 0 || !conv.dominant) return null;
57
+ const note = TIER_NOTE[conv.tier] || conv.tier;
58
+ let line = `- **${label}:** ${conv.dominant} (${_pct(conv.dominantPct)} — ${note}).`;
59
+ const others = conv.variants.slice(1).filter((v) => v.pct > 0);
60
+ if (others.length) {
61
+ line += ` Variants: ${others.map((v) => `${v.label} ${_pct(v.pct)}`).join(', ')}.`;
62
+ }
63
+ return line;
64
+ }
65
+
66
+ /**
67
+ * Render the conventions block (including its start/end markers).
68
+ * @param {object} result an `extractConventions` result
69
+ * @param {string} [version] SigMap version for the footer
70
+ * @returns {string}
71
+ */
72
+ function renderConventionsBlock(result, version) {
73
+ const lines = [];
74
+ for (const key of ['fileNaming', 'exportStyle']) {
75
+ const l = _conventionLine(NAMES[key], result && result[key]);
76
+ if (l) lines.push(l);
77
+ }
78
+ if (result && result.testFramework) {
79
+ lines.push(`- **Test framework:** ${result.testFramework}.`);
80
+ }
81
+
82
+ const body = lines.length
83
+ ? lines
84
+ : ['- No conventions detected yet (run `sigmap conventions` on a TS/JS/Python repo).'];
85
+
86
+ const ver = version ? ` v${version}` : '';
87
+ return [
88
+ START,
89
+ '## Conventions (auto-detected by SigMap)',
90
+ '',
91
+ 'Match these when writing or editing code (TS/JS/Python):',
92
+ '',
93
+ ...body,
94
+ '',
95
+ `<sub>Generated by SigMap${ver} · run \`sigmap conventions --inject\` to refresh.</sub>`,
96
+ END,
97
+ ].join('\n');
98
+ }
99
+
100
+ /**
101
+ * Inject (or replace) the conventions block in existing CLAUDE.md content.
102
+ * Replaces an existing marked block in place; appends one when absent.
103
+ * Idempotent — never touches content outside the markers.
104
+ * @param {string} existing current file content ('' if the file is new)
105
+ * @param {string} block the block returned by `renderConventionsBlock`
106
+ * @returns {string}
107
+ */
108
+ function injectConventions(existing, block) {
109
+ const src = String(existing || '');
110
+ const startIdx = src.indexOf(START);
111
+ if (startIdx !== -1) {
112
+ const endIdx = src.indexOf(END, startIdx);
113
+ if (endIdx !== -1) {
114
+ const before = src.slice(0, startIdx);
115
+ const after = src.slice(endIdx + END.length);
116
+ return before + block + after;
117
+ }
118
+ }
119
+ if (src.trim() === '') return block + '\n';
120
+ const sep = src.endsWith('\n') ? '\n' : '\n\n';
121
+ return src + sep + block + '\n';
122
+ }
123
+
124
+ module.exports = { renderConventionsBlock, injectConventions, START, END };
125
+
126
+ };
127
+
26
128
  __factories["./src/conventions/conflicts"] = function(module, exports) {
27
129
 
28
130
  /**
@@ -6901,7 +7003,7 @@ __factories["./src/mcp/server"] = function(module, exports) {
6901
7003
 
6902
7004
  const SERVER_INFO = {
6903
7005
  name: 'sigmap',
6904
- version: '7.8.0',
7006
+ version: '7.9.0',
6905
7007
  description: 'SigMap MCP server — code signatures on demand',
6906
7008
  };
6907
7009
 
@@ -12579,7 +12681,7 @@ function __tryGit(args, opts = {}) {
12579
12681
  catch (_) { return ''; }
12580
12682
  }
12581
12683
 
12582
- const VERSION = '7.8.0';
12684
+ const VERSION = '7.9.0';
12583
12685
  const MARKER = '\n\n## Auto-generated signatures\n<!-- Updated by gen-context.js -->\n';
12584
12686
 
12585
12687
  function requireSourceOrBundled(key) {
@@ -15757,6 +15859,23 @@ function main() {
15757
15859
  const files = buildFileList(cwd, config);
15758
15860
  const result = extractConventions(cwd, files);
15759
15861
 
15862
+ // `--inject`: write/update the conventions block in CLAUDE.md (idempotent).
15863
+ if (args.includes('--inject')) {
15864
+ const { renderConventionsBlock, injectConventions } = requireSourceOrBundled('./src/conventions/inject');
15865
+ const claudePath = path.join(cwd, 'CLAUDE.md');
15866
+ let existing = '';
15867
+ try { if (fs.existsSync(claudePath)) existing = fs.readFileSync(claudePath, 'utf8'); } catch (_) {}
15868
+ const block = renderConventionsBlock(result, VERSION);
15869
+ try {
15870
+ fs.writeFileSync(claudePath, injectConventions(existing, block));
15871
+ } catch (e) {
15872
+ console.error(`[sigmap] cannot write ${claudePath}: ${e.message}`);
15873
+ process.exit(1);
15874
+ }
15875
+ console.log(`[sigmap] conventions → injected block into ${path.relative(cwd, claudePath) || 'CLAUDE.md'}`);
15876
+ process.exit(0);
15877
+ }
15878
+
15760
15879
  // `--conflicts`: surface why a convention is mixed (breakdown + rename suggestions).
15761
15880
  if (args.includes('--conflicts')) {
15762
15881
  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.8.0 | Benchmark: sigmap-v7.0-main (2026-06-14)
12
+ # Version: 7.9.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.8.0 | Benchmark: sigmap-v7.0-main (2026-06-14)
12
+ # Version: 7.9.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.8.0",
3
+ "version": "7.9.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.8.0",
3
+ "version": "7.9.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.8.0",
3
+ "version": "7.9.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,98 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * CLAUDE.md convention injection (IMPL.md §7 Phase 2 / §8 step 5).
5
+ *
6
+ * Renders the conventions detected by `extractConventions` into a
7
+ * marker-delimited markdown block and injects it into CLAUDE.md so an agent
8
+ * reading the file plans grounded in the repo's house style. Idempotent and
9
+ * marker-scoped — it never touches human content or the `## Auto-generated
10
+ * signatures` block. Pure string transforms; zero-dependency, bundle-safe.
11
+ */
12
+
13
+ const START = '<!-- sigmap-conventions:start -->';
14
+ const END = '<!-- sigmap-conventions:end -->';
15
+
16
+ const TIER_NOTE = {
17
+ consistent: 'consistent — match it',
18
+ mostly: 'dominant, with some drift',
19
+ inconsistent: 'no clear convention — check neighboring files',
20
+ };
21
+
22
+ const NAMES = {
23
+ fileNaming: 'File naming',
24
+ exportStyle: 'Export style',
25
+ };
26
+
27
+ const _pct = (n) => `${Math.round(n * 100)}%`;
28
+
29
+ function _conventionLine(label, conv) {
30
+ if (!conv || conv.total === 0 || !conv.dominant) return null;
31
+ const note = TIER_NOTE[conv.tier] || conv.tier;
32
+ let line = `- **${label}:** ${conv.dominant} (${_pct(conv.dominantPct)} — ${note}).`;
33
+ const others = conv.variants.slice(1).filter((v) => v.pct > 0);
34
+ if (others.length) {
35
+ line += ` Variants: ${others.map((v) => `${v.label} ${_pct(v.pct)}`).join(', ')}.`;
36
+ }
37
+ return line;
38
+ }
39
+
40
+ /**
41
+ * Render the conventions block (including its start/end markers).
42
+ * @param {object} result an `extractConventions` result
43
+ * @param {string} [version] SigMap version for the footer
44
+ * @returns {string}
45
+ */
46
+ function renderConventionsBlock(result, version) {
47
+ const lines = [];
48
+ for (const key of ['fileNaming', 'exportStyle']) {
49
+ const l = _conventionLine(NAMES[key], result && result[key]);
50
+ if (l) lines.push(l);
51
+ }
52
+ if (result && result.testFramework) {
53
+ lines.push(`- **Test framework:** ${result.testFramework}.`);
54
+ }
55
+
56
+ const body = lines.length
57
+ ? lines
58
+ : ['- No conventions detected yet (run `sigmap conventions` on a TS/JS/Python repo).'];
59
+
60
+ const ver = version ? ` v${version}` : '';
61
+ return [
62
+ START,
63
+ '## Conventions (auto-detected by SigMap)',
64
+ '',
65
+ 'Match these when writing or editing code (TS/JS/Python):',
66
+ '',
67
+ ...body,
68
+ '',
69
+ `<sub>Generated by SigMap${ver} · run \`sigmap conventions --inject\` to refresh.</sub>`,
70
+ END,
71
+ ].join('\n');
72
+ }
73
+
74
+ /**
75
+ * Inject (or replace) the conventions block in existing CLAUDE.md content.
76
+ * Replaces an existing marked block in place; appends one when absent.
77
+ * Idempotent — never touches content outside the markers.
78
+ * @param {string} existing current file content ('' if the file is new)
79
+ * @param {string} block the block returned by `renderConventionsBlock`
80
+ * @returns {string}
81
+ */
82
+ function injectConventions(existing, block) {
83
+ const src = String(existing || '');
84
+ const startIdx = src.indexOf(START);
85
+ if (startIdx !== -1) {
86
+ const endIdx = src.indexOf(END, startIdx);
87
+ if (endIdx !== -1) {
88
+ const before = src.slice(0, startIdx);
89
+ const after = src.slice(endIdx + END.length);
90
+ return before + block + after;
91
+ }
92
+ }
93
+ if (src.trim() === '') return block + '\n';
94
+ const sep = src.endsWith('\n') ? '\n' : '\n\n';
95
+ return src + sep + block + '\n';
96
+ }
97
+
98
+ module.exports = { renderConventionsBlock, injectConventions, START, END };
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.8.0',
21
+ version: '7.9.0',
22
22
  description: 'SigMap MCP server — code signatures on demand',
23
23
  };
24
24