sigmap 7.18.0 → 7.20.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,24 @@ Format: [Semantic Versioning](https://semver.org/)
10
10
 
11
11
  ---
12
12
 
13
+ ## [7.20.0] — 2026-06-18
14
+
15
+ Minor release — `init` writes a Creation workflow block into CLAUDE.md (grounded codegen, Gap 2 §6.2 — completes the plan).
16
+
17
+ ### Added
18
+ - **`sigmap --init` documents the grounded-creation workflow in CLAUDE.md (#337):** the final IMPL item. `--init` now injects a marker-delimited "Creation workflow" block describing the four-stage pipeline (`scaffold` → `verify-plan` → `verify-ai-output` → `review-pr`, orchestrated by `sigmap create`) so an agent reading CLAUDE.md knows the guard-rail workflow exists. New zero-dependency, bundle-safe `src/init/creation-workflow.js` (`renderCreationWorkflowBlock`, `injectCreationWorkflow`); idempotent and marker-scoped (`<!-- sigmap-creation-workflow:start -->` … `:end -->`), it creates CLAUDE.md if absent, preserves human content, and coexists with the conventions + auto-generated-signatures blocks. **With this, every item in the grounded-codegen implementation plan is shipped** (the §9 LLM A/B ablation is built and offline-tested; a live run needs only an API key).
19
+
20
+ ---
21
+
22
+ ## [7.19.0] — 2026-06-18
23
+
24
+ Minor release — scaffold persistence (grounded codegen, Gap 2 §6.2).
25
+
26
+ ### Added
27
+ - **Scaffold persistence — `.context/scaffold/latest.md` (#334):** `sigmap scaffold` now writes an accepted proposal to `.context/scaffold/latest.md` so the `create` pipeline and agents can read back the convention-matched proposal instead of re-deriving it. New zero-dependency, bundle-safe `src/scaffold/persist.js` (`renderScaffoldMarkdown`, `scaffoldPath`); the record captures the filename + naming style, export style, test file + framework, and any force-warning. Persisted in both human and `--json` modes (the JSON output gains a `persistedTo` field); a refused scaffold writes nothing.
28
+
29
+ ---
30
+
13
31
  ## [7.18.0] — 2026-06-18
14
32
 
15
33
  Minor release — `sigmap conventions --update` (grounded codegen, Layer 3 — completes the §4 flag set).
package/gen-context.js CHANGED
@@ -34,6 +34,118 @@ function __require(key) {
34
34
  // ── ./src/eval/llm-ablation ──
35
35
  // ── ./src/conventions/fix ──
36
36
  // ── ./src/conventions/update ──
37
+ // ── ./src/scaffold/persist ──
38
+ // ── ./src/init/creation-workflow ──
39
+ __factories["./src/init/creation-workflow"] = function(module, exports) {
40
+
41
+ /**
42
+ * Creation-workflow CLAUDE.md block (IMPL.md §6.2 — 2f).
43
+ *
44
+ * `sigmap --init` injects this block so an agent reading CLAUDE.md knows the
45
+ * grounded-creation guard-rail workflow exists: scaffold → verify-plan →
46
+ * verify-ai-output → review-pr, orchestrated by `sigmap create`. Idempotent and
47
+ * marker-scoped — it never touches human content or the conventions /
48
+ * auto-generated-signatures blocks. Pure string transforms; zero-dependency,
49
+ * bundle-safe.
50
+ */
51
+
52
+ const START = '<!-- sigmap-creation-workflow:start -->';
53
+ const END = '<!-- sigmap-creation-workflow:end -->';
54
+
55
+ /** Render the Creation workflow block (including its start/end markers). */
56
+ function renderCreationWorkflowBlock() {
57
+ return [
58
+ START,
59
+ '## Creation workflow (SigMap)',
60
+ '',
61
+ 'When creating or changing code, run the grounded-creation pipeline so each step is verified against the live index:',
62
+ '',
63
+ '1. **`sigmap scaffold "<name>"`** — propose a convention-matched file/structure (refuses if conventions are inconsistent).',
64
+ '2. **`sigmap verify-plan <plan.md>`** — check the plan against the live index (files/symbols exist, blast radius, scope).',
65
+ '3. **`sigmap verify-ai-output <answer.md>`** — flag fake files/symbols/imports in the generated output (offline).',
66
+ '4. **`sigmap review-pr`** — audit the diff for scope drift, god-node edits, missing tests, and security files.',
67
+ '',
68
+ 'Or run all four in one pass with **`sigmap create "<task>"`** (`1/4`…`4/4` numbering, single pass/fail).',
69
+ '',
70
+ '<sub>Generated by `sigmap --init` · refresh by re-running it.</sub>',
71
+ END,
72
+ ].join('\n');
73
+ }
74
+
75
+ /**
76
+ * Inject (or replace) the Creation workflow block in existing CLAUDE.md content.
77
+ * Replaces an existing marked block in place; appends one when absent.
78
+ * Idempotent — never touches content outside the markers.
79
+ * @param {string} existing current file content ('' if new)
80
+ * @param {string} block the block from `renderCreationWorkflowBlock`
81
+ * @returns {string}
82
+ */
83
+ function injectCreationWorkflow(existing, block) {
84
+ const src = String(existing || '');
85
+ const startIdx = src.indexOf(START);
86
+ if (startIdx !== -1) {
87
+ const endIdx = src.indexOf(END, startIdx);
88
+ if (endIdx !== -1) {
89
+ return src.slice(0, startIdx) + block + src.slice(endIdx + END.length);
90
+ }
91
+ }
92
+ if (src.trim() === '') return block + '\n';
93
+ const sep = src.endsWith('\n') ? '\n' : '\n\n';
94
+ return src + sep + block + '\n';
95
+ }
96
+
97
+ module.exports = { renderCreationWorkflowBlock, injectCreationWorkflow, START, END };
98
+
99
+ };
100
+
101
+ __factories["./src/scaffold/persist"] = function(module, exports) {
102
+
103
+ /**
104
+ * Scaffold persistence (IMPL.md §6.2 — 2d).
105
+ *
106
+ * Renders an accepted scaffold proposal to markdown and locates the on-disk
107
+ * record (`.context/scaffold/latest.md`) so the `create` pipeline and agents can
108
+ * read back the convention-matched proposal. Pure render; zero-dependency,
109
+ * bundle-safe.
110
+ */
111
+
112
+ const path = require('path');
113
+
114
+ /** Path to the persisted scaffold record. */
115
+ function scaffoldPath(cwd) {
116
+ return path.join(cwd, '.context', 'scaffold', 'latest.md');
117
+ }
118
+
119
+ /**
120
+ * Render an accepted scaffold decision to a markdown record.
121
+ * @param {object} decision a `proposeScaffold` result with `ok: true`
122
+ * @param {object} [opts]
123
+ * @param {string} [opts.timestamp] ISO timestamp (caller supplies — keeps this pure)
124
+ * @returns {string}
125
+ */
126
+ function renderScaffoldMarkdown(decision, opts = {}) {
127
+ const d = decision || {};
128
+ const p = d.proposal || {};
129
+ const pct = (n) => `${Math.round((n || 0) * 100)}%`;
130
+ const lines = [
131
+ `# Scaffold — ${d.name || '(unnamed)'}`,
132
+ '',
133
+ `- **Conventions:** ${d.tier || 'unknown'} (${pct(d.confidence)})`,
134
+ `- **File:** \`${p.filename || ''}\` (${p.namingStyle || ''})`,
135
+ `- **Export style:** ${p.exportStyle || ''}`,
136
+ `- **Test file:** \`${p.testFile || ''}\`${p.testFramework ? ` (${p.testFramework})` : ''}`,
137
+ ];
138
+ if (d.warning) lines.push(`- **Warning:** ${d.warning}`);
139
+ lines.push('');
140
+ lines.push(`<sub>Generated by \`sigmap scaffold\`${opts.timestamp ? ` · ${opts.timestamp}` : ''}.</sub>`);
141
+ lines.push('');
142
+ return lines.join('\n');
143
+ }
144
+
145
+ module.exports = { scaffoldPath, renderScaffoldMarkdown };
146
+
147
+ };
148
+
37
149
  __factories["./src/conventions/update"] = function(module, exports) {
38
150
 
39
151
  /**
@@ -7819,7 +7931,7 @@ __factories["./src/mcp/server"] = function(module, exports) {
7819
7931
 
7820
7932
  const SERVER_INFO = {
7821
7933
  name: 'sigmap',
7822
- version: '7.18.0',
7934
+ version: '7.20.0',
7823
7935
  description: 'SigMap MCP server — code signatures on demand',
7824
7936
  };
7825
7937
 
@@ -13497,7 +13609,7 @@ function __tryGit(args, opts = {}) {
13497
13609
  catch (_) { return ''; }
13498
13610
  }
13499
13611
 
13500
- const VERSION = '7.18.0';
13612
+ const VERSION = '7.20.0';
13501
13613
  const MARKER = '\n\n## Auto-generated signatures\n<!-- Updated by gen-context.js -->\n';
13502
13614
 
13503
13615
  function requireSourceOrBundled(key) {
@@ -16891,8 +17003,20 @@ function main() {
16891
17003
  const conventions = extractConventions(cwd, buildFileList(cwd, config));
16892
17004
  const decision = proposeScaffold(name, conventions, { threshold, ext, force });
16893
17005
 
17006
+ // §6.2 (2d): persist an accepted proposal so `create`/agents can read it back.
17007
+ let persistedTo = null;
17008
+ if (decision.ok) {
17009
+ const { scaffoldPath, renderScaffoldMarkdown } = requireSourceOrBundled('./src/scaffold/persist');
17010
+ const outPath = scaffoldPath(cwd);
17011
+ try {
17012
+ fs.mkdirSync(path.dirname(outPath), { recursive: true });
17013
+ fs.writeFileSync(outPath, renderScaffoldMarkdown(decision, { timestamp: new Date().toISOString() }));
17014
+ persistedTo = path.relative(cwd, outPath) || outPath;
17015
+ } catch (_) {}
17016
+ }
17017
+
16894
17018
  if (jsonOut) {
16895
- process.stdout.write(JSON.stringify(decision) + '\n');
17019
+ process.stdout.write(JSON.stringify({ ...decision, persistedTo }) + '\n');
16896
17020
  process.exit(decision.ok ? 0 : 1);
16897
17021
  }
16898
17022
 
@@ -16904,6 +17028,7 @@ function main() {
16904
17028
  console.log(` file: ${p.filename} (${p.namingStyle})`);
16905
17029
  console.log(` export style: ${p.exportStyle}`);
16906
17030
  console.log(` test file: ${p.testFile}${p.testFramework ? ` (${p.testFramework})` : ''}`);
17031
+ if (persistedTo) console.log(`\n → wrote ${persistedTo}`);
16907
17032
  process.exit(0);
16908
17033
  }
16909
17034
 
@@ -17264,6 +17389,15 @@ function main() {
17264
17389
 
17265
17390
  if (args.includes('--init')) {
17266
17391
  writeInitConfig(cwd);
17392
+ // §6.2 (2f): document the grounded-creation workflow in CLAUDE.md (idempotent).
17393
+ try {
17394
+ const { renderCreationWorkflowBlock, injectCreationWorkflow } = requireSourceOrBundled('./src/init/creation-workflow');
17395
+ const claudePath = path.join(cwd, 'CLAUDE.md');
17396
+ let existing = '';
17397
+ try { if (fs.existsSync(claudePath)) existing = fs.readFileSync(claudePath, 'utf8'); } catch (_) {}
17398
+ fs.writeFileSync(claudePath, injectCreationWorkflow(existing, renderCreationWorkflowBlock()));
17399
+ console.log(`[sigmap] init → Creation workflow block in ${path.relative(cwd, claudePath) || 'CLAUDE.md'}`);
17400
+ } catch (_) {}
17267
17401
  process.exit(0);
17268
17402
  }
17269
17403
 
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.18.0 | Benchmark: sigmap-v7.0-main (2026-06-14)
12
+ # Version: 7.20.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.18.0 | Benchmark: sigmap-v7.0-main (2026-06-14)
12
+ # Version: 7.20.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.18.0",
3
+ "version": "7.20.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.18.0",
3
+ "version": "7.20.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.18.0",
3
+ "version": "7.20.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,59 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Creation-workflow CLAUDE.md block (IMPL.md §6.2 — 2f).
5
+ *
6
+ * `sigmap --init` injects this block so an agent reading CLAUDE.md knows the
7
+ * grounded-creation guard-rail workflow exists: scaffold → verify-plan →
8
+ * verify-ai-output → review-pr, orchestrated by `sigmap create`. Idempotent and
9
+ * marker-scoped — it never touches human content or the conventions /
10
+ * auto-generated-signatures blocks. Pure string transforms; zero-dependency,
11
+ * bundle-safe.
12
+ */
13
+
14
+ const START = '<!-- sigmap-creation-workflow:start -->';
15
+ const END = '<!-- sigmap-creation-workflow:end -->';
16
+
17
+ /** Render the Creation workflow block (including its start/end markers). */
18
+ function renderCreationWorkflowBlock() {
19
+ return [
20
+ START,
21
+ '## Creation workflow (SigMap)',
22
+ '',
23
+ 'When creating or changing code, run the grounded-creation pipeline so each step is verified against the live index:',
24
+ '',
25
+ '1. **`sigmap scaffold "<name>"`** — propose a convention-matched file/structure (refuses if conventions are inconsistent).',
26
+ '2. **`sigmap verify-plan <plan.md>`** — check the plan against the live index (files/symbols exist, blast radius, scope).',
27
+ '3. **`sigmap verify-ai-output <answer.md>`** — flag fake files/symbols/imports in the generated output (offline).',
28
+ '4. **`sigmap review-pr`** — audit the diff for scope drift, god-node edits, missing tests, and security files.',
29
+ '',
30
+ 'Or run all four in one pass with **`sigmap create "<task>"`** (`1/4`…`4/4` numbering, single pass/fail).',
31
+ '',
32
+ '<sub>Generated by `sigmap --init` · refresh by re-running it.</sub>',
33
+ END,
34
+ ].join('\n');
35
+ }
36
+
37
+ /**
38
+ * Inject (or replace) the Creation workflow block in existing CLAUDE.md content.
39
+ * Replaces an existing marked block in place; appends one when absent.
40
+ * Idempotent — never touches content outside the markers.
41
+ * @param {string} existing current file content ('' if new)
42
+ * @param {string} block the block from `renderCreationWorkflowBlock`
43
+ * @returns {string}
44
+ */
45
+ function injectCreationWorkflow(existing, block) {
46
+ const src = String(existing || '');
47
+ const startIdx = src.indexOf(START);
48
+ if (startIdx !== -1) {
49
+ const endIdx = src.indexOf(END, startIdx);
50
+ if (endIdx !== -1) {
51
+ return src.slice(0, startIdx) + block + src.slice(endIdx + END.length);
52
+ }
53
+ }
54
+ if (src.trim() === '') return block + '\n';
55
+ const sep = src.endsWith('\n') ? '\n' : '\n\n';
56
+ return src + sep + block + '\n';
57
+ }
58
+
59
+ module.exports = { renderCreationWorkflowBlock, injectCreationWorkflow, 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.18.0',
21
+ version: '7.20.0',
22
22
  description: 'SigMap MCP server — code signatures on demand',
23
23
  };
24
24
 
@@ -0,0 +1,45 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Scaffold persistence (IMPL.md §6.2 — 2d).
5
+ *
6
+ * Renders an accepted scaffold proposal to markdown and locates the on-disk
7
+ * record (`.context/scaffold/latest.md`) so the `create` pipeline and agents can
8
+ * read back the convention-matched proposal. Pure render; zero-dependency,
9
+ * bundle-safe.
10
+ */
11
+
12
+ const path = require('path');
13
+
14
+ /** Path to the persisted scaffold record. */
15
+ function scaffoldPath(cwd) {
16
+ return path.join(cwd, '.context', 'scaffold', 'latest.md');
17
+ }
18
+
19
+ /**
20
+ * Render an accepted scaffold decision to a markdown record.
21
+ * @param {object} decision a `proposeScaffold` result with `ok: true`
22
+ * @param {object} [opts]
23
+ * @param {string} [opts.timestamp] ISO timestamp (caller supplies — keeps this pure)
24
+ * @returns {string}
25
+ */
26
+ function renderScaffoldMarkdown(decision, opts = {}) {
27
+ const d = decision || {};
28
+ const p = d.proposal || {};
29
+ const pct = (n) => `${Math.round((n || 0) * 100)}%`;
30
+ const lines = [
31
+ `# Scaffold — ${d.name || '(unnamed)'}`,
32
+ '',
33
+ `- **Conventions:** ${d.tier || 'unknown'} (${pct(d.confidence)})`,
34
+ `- **File:** \`${p.filename || ''}\` (${p.namingStyle || ''})`,
35
+ `- **Export style:** ${p.exportStyle || ''}`,
36
+ `- **Test file:** \`${p.testFile || ''}\`${p.testFramework ? ` (${p.testFramework})` : ''}`,
37
+ ];
38
+ if (d.warning) lines.push(`- **Warning:** ${d.warning}`);
39
+ lines.push('');
40
+ lines.push(`<sub>Generated by \`sigmap scaffold\`${opts.timestamp ? ` · ${opts.timestamp}` : ''}.</sub>`);
41
+ lines.push('');
42
+ return lines.join('\n');
43
+ }
44
+
45
+ module.exports = { scaffoldPath, renderScaffoldMarkdown };