sigmap 7.12.0 → 7.13.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.13.0] — 2026-06-17
14
+
15
+ Minor release — `sigmap create` (grounded codegen, Gap 2 — the pipeline capstone).
16
+
17
+ ### Added
18
+ - **`sigmap create "<task>"` — orchestrate the 4-stage grounded-creation pipeline (#316):** the capstone of the grounded-codegen work. One command sequences the four guard stages — `scaffold` → `verify-plan` → `verify-ai-output` → `review-pr` — with `1/4`…`4/4` numbering and a single pass/fail summary. Each stage runs only when its input is present (`--name` → scaffold, `--plan` → verify-plan, `--answer` → verify-ai-output, the git diff → review-pr); a stage with no input is skipped and does not fail the run. New zero-dependency, bundle-safe `src/create/orchestrate.js` (`orchestrate`) delegates to the real stage modules — no logic duplication. CLI supports `--name`, `--plan`, `--answer`, `--staged`/`--base`, and `--json`, and exits non-zero when a ran stage fails. This completes the grounded-creation loop: every root cause (1–4) is closed and all four guard stages are now sequenced by one command.
19
+
20
+ ---
21
+
13
22
  ## [7.12.0] — 2026-06-17
14
23
 
15
24
  Minor release — `sigmap review-pr` (grounded codegen, Gap 2 — last guard stage).
package/gen-context.js CHANGED
@@ -28,6 +28,96 @@ function __require(key) {
28
28
  // ── ./src/plan/verify-plan ──
29
29
  // ── ./src/cache/freshen ──
30
30
  // ── ./src/review/review-pr ──
31
+ // ── ./src/create/orchestrate ──
32
+ __factories["./src/create/orchestrate"] = function(module, exports) {
33
+
34
+ /**
35
+ * create orchestrator (IMPL.md §6.2 — the capstone of the grounded-creation loop).
36
+ *
37
+ * Sequences the four guard stages — scaffold → verify-plan → verify-ai-output →
38
+ * review-pr — in one pass with `n/4` numbering and a single pass/fail summary.
39
+ * The agent does the LLM writing between stages; `create` runs the deterministic
40
+ * guards it owns. A stage runs only when its input is present (else it is
41
+ * skipped, which does not fail the run). Zero-dependency, bundle-safe; delegates
42
+ * to the real stage modules.
43
+ */
44
+
45
+ const { proposeScaffold } = __require('./src/scaffold/propose');
46
+ const { verifyPlan } = __require('./src/plan/verify-plan');
47
+ const { verify } = __require('./src/verify/hallucination-guard');
48
+ const { reviewPr } = __require('./src/review/review-pr');
49
+
50
+ const TOTAL = 4;
51
+
52
+ /**
53
+ * Run the create pipeline over whatever inputs are available.
54
+ * @param {object} ctx
55
+ * @param {string} [ctx.task] free-text task label (echoed back)
56
+ * @param {string} [ctx.name] module name → enables the scaffold stage
57
+ * @param {object} [ctx.conventions] an `extractConventions` result (for scaffold)
58
+ * @param {object} [ctx.scaffoldOpts] options forwarded to `proposeScaffold`
59
+ * @param {string} [ctx.plan] plan markdown → enables verify-plan
60
+ * @param {string} [ctx.answer] AI answer markdown → enables verify-ai-output
61
+ * @param {Array<{path:string,status:string}>} [ctx.changedFiles] → enables review-pr
62
+ * @param {string} cwd repo root
63
+ * @returns {{ task: string|null, steps: object[], summary: object }}
64
+ */
65
+ function orchestrate(ctx = {}, cwd) {
66
+ const steps = [];
67
+
68
+ // 1/4 — scaffold (needs a name + conventions)
69
+ if (ctx.name && ctx.conventions) {
70
+ const d = proposeScaffold(ctx.name, ctx.conventions, ctx.scaffoldOpts || {});
71
+ steps.push({ n: 1, total: TOTAL, name: 'scaffold', ran: true, ok: !!d.ok, skipped: false, detail: d });
72
+ } else {
73
+ steps.push({ n: 1, total: TOTAL, name: 'scaffold', ran: false, ok: null, skipped: true, reason: 'no --name' });
74
+ }
75
+
76
+ // 2/4 — verify-plan (needs a plan)
77
+ if (ctx.plan != null && String(ctx.plan).trim() !== '') {
78
+ const r = verifyPlan(ctx.plan, cwd);
79
+ steps.push({ n: 2, total: TOTAL, name: 'verify-plan', ran: true, ok: !!r.summary.ok, skipped: false, detail: r });
80
+ } else {
81
+ steps.push({ n: 2, total: TOTAL, name: 'verify-plan', ran: false, ok: null, skipped: true, reason: 'no --plan' });
82
+ }
83
+
84
+ // 3/4 — verify-ai-output (needs an answer)
85
+ if (ctx.answer != null && String(ctx.answer).trim() !== '') {
86
+ const r = verify(ctx.answer, cwd);
87
+ steps.push({ n: 3, total: TOTAL, name: 'verify-ai-output', ran: true, ok: r.summary.total === 0, skipped: false, detail: r });
88
+ } else {
89
+ steps.push({ n: 3, total: TOTAL, name: 'verify-ai-output', ran: false, ok: null, skipped: true, reason: 'no --answer' });
90
+ }
91
+
92
+ // 4/4 — review-pr (needs changed files)
93
+ if (Array.isArray(ctx.changedFiles) && ctx.changedFiles.length) {
94
+ const r = reviewPr(ctx.changedFiles, cwd);
95
+ steps.push({ n: 4, total: TOTAL, name: 'review-pr', ran: true, ok: !!r.summary.ok, skipped: false, detail: r });
96
+ } else {
97
+ steps.push({ n: 4, total: TOTAL, name: 'review-pr', ran: false, ok: null, skipped: true, reason: 'no changes' });
98
+ }
99
+
100
+ const ran = steps.filter((s) => s.ran);
101
+ const passed = ran.filter((s) => s.ok).length;
102
+ const failed = ran.length - passed;
103
+ return {
104
+ task: ctx.task || null,
105
+ steps,
106
+ summary: {
107
+ total: TOTAL,
108
+ ran: ran.length,
109
+ skipped: steps.length - ran.length,
110
+ passed,
111
+ failed,
112
+ ok: failed === 0,
113
+ },
114
+ };
115
+ }
116
+
117
+ module.exports = { orchestrate, TOTAL };
118
+
119
+ };
120
+
31
121
  __factories["./src/review/review-pr"] = function(module, exports) {
32
122
 
33
123
  /**
@@ -7369,7 +7459,7 @@ __factories["./src/mcp/server"] = function(module, exports) {
7369
7459
 
7370
7460
  const SERVER_INFO = {
7371
7461
  name: 'sigmap',
7372
- version: '7.12.0',
7462
+ version: '7.13.0',
7373
7463
  description: 'SigMap MCP server — code signatures on demand',
7374
7464
  };
7375
7465
 
@@ -13047,7 +13137,7 @@ function __tryGit(args, opts = {}) {
13047
13137
  catch (_) { return ''; }
13048
13138
  }
13049
13139
 
13050
- const VERSION = '7.12.0';
13140
+ const VERSION = '7.13.0';
13051
13141
  const MARKER = '\n\n## Auto-generated signatures\n<!-- Updated by gen-context.js -->\n';
13052
13142
 
13053
13143
  function requireSourceOrBundled(key) {
@@ -16553,6 +16643,71 @@ function main() {
16553
16643
  process.exit(1);
16554
16644
  }
16555
16645
 
16646
+ // Gap 2 (capstone): `sigmap create "<task>"` — orchestrate the 4 guard stages
16647
+ // (scaffold → verify-plan → verify-ai-output → review-pr) with n/4 numbering.
16648
+ if (args[0] === 'create') {
16649
+ const jsonOut = args.includes('--json');
16650
+ const task = args[1] && !args[1].startsWith('--') ? args[1] : null;
16651
+ const flagVal = (flag) => { const i = args.indexOf(flag); return i !== -1 && args[i + 1] && !args[i + 1].startsWith('--') ? args[i + 1] : null; };
16652
+ const nameArg = flagVal('--name');
16653
+ const planFile = flagVal('--plan');
16654
+ const answerFile = flagVal('--answer');
16655
+ const staged = args.includes('--staged');
16656
+ const baseArg = flagVal('--base');
16657
+
16658
+ const ctx = { task };
16659
+
16660
+ if (nameArg) {
16661
+ ctx.name = nameArg;
16662
+ try {
16663
+ const { extractConventions } = requireSourceOrBundled('./src/conventions/extract');
16664
+ ctx.conventions = extractConventions(cwd, buildFileList(cwd, config));
16665
+ } catch (_) {}
16666
+ }
16667
+ for (const [flag, file, key] of [['--plan', planFile, 'plan'], ['--answer', answerFile, 'answer']]) {
16668
+ if (!file) continue;
16669
+ try { ctx[key] = fs.readFileSync(path.resolve(cwd, file), 'utf8'); }
16670
+ catch (e) { console.error(`[sigmap] cannot read ${flag} file: ${e.message}`); process.exit(1); }
16671
+ }
16672
+
16673
+ // review-pr inputs: changed files from git (same collection as review-pr).
16674
+ let nameStatus = '';
16675
+ if (staged) {
16676
+ nameStatus = __tryGit(['diff', '--cached', '--name-status'], { cwd });
16677
+ } else {
16678
+ let base = baseArg;
16679
+ if (!base) {
16680
+ for (const ref of ['main', 'develop']) {
16681
+ if (__tryGit(['rev-parse', '--verify', '--quiet', ref], { cwd })) { base = ref; break; }
16682
+ }
16683
+ }
16684
+ const mb = base ? (__tryGit(['merge-base', 'HEAD', base], { cwd }) || base) : 'HEAD~1';
16685
+ nameStatus = __tryGit(['diff', '--name-status', `${mb}..HEAD`], { cwd });
16686
+ }
16687
+ ctx.changedFiles = nameStatus.split('\n').filter(Boolean).map((line) => {
16688
+ const parts = line.split('\t');
16689
+ return { path: parts[parts.length - 1], status: parts[0][0] };
16690
+ });
16691
+
16692
+ const { orchestrate } = requireSourceOrBundled('./src/create/orchestrate');
16693
+ const result = orchestrate(ctx, cwd);
16694
+
16695
+ if (jsonOut) {
16696
+ process.stdout.write(JSON.stringify(result) + '\n');
16697
+ process.exit(result.summary.ok ? 0 : 1);
16698
+ }
16699
+
16700
+ console.log(`[sigmap] create${result.task ? ` "${result.task}"` : ''} — grounded-creation pipeline`);
16701
+ for (const st of result.steps) {
16702
+ const mark = st.skipped ? '–' : (st.ok ? '✓' : '✗');
16703
+ const status = st.skipped ? `skipped (${st.reason})` : (st.ok ? 'ok' : 'FAILED');
16704
+ console.log(` ${st.n}/${st.total} ${mark} ${st.name.padEnd(16)} ${status}`);
16705
+ }
16706
+ const su = result.summary;
16707
+ console.log(`\n ${su.ran}/${su.total} ran · ${su.passed} passed · ${su.failed} failed · ${su.skipped} skipped`);
16708
+ process.exit(su.ok ? 0 : 1);
16709
+ }
16710
+
16556
16711
  // Feature 1: `sigmap explain <file>` — why a file is included or excluded
16557
16712
  if (args[0] === 'explain' || args.includes('--explain')) {
16558
16713
  const target = args[0] === 'explain'
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.12.0 | Benchmark: sigmap-v7.0-main (2026-06-14)
12
+ # Version: 7.13.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.12.0 | Benchmark: sigmap-v7.0-main (2026-06-14)
12
+ # Version: 7.13.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.12.0",
3
+ "version": "7.13.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.12.0",
3
+ "version": "7.13.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.12.0",
3
+ "version": "7.13.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,86 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * create orchestrator (IMPL.md §6.2 — the capstone of the grounded-creation loop).
5
+ *
6
+ * Sequences the four guard stages — scaffold → verify-plan → verify-ai-output →
7
+ * review-pr — in one pass with `n/4` numbering and a single pass/fail summary.
8
+ * The agent does the LLM writing between stages; `create` runs the deterministic
9
+ * guards it owns. A stage runs only when its input is present (else it is
10
+ * skipped, which does not fail the run). Zero-dependency, bundle-safe; delegates
11
+ * to the real stage modules.
12
+ */
13
+
14
+ const { proposeScaffold } = require('../scaffold/propose');
15
+ const { verifyPlan } = require('../plan/verify-plan');
16
+ const { verify } = require('../verify/hallucination-guard');
17
+ const { reviewPr } = require('../review/review-pr');
18
+
19
+ const TOTAL = 4;
20
+
21
+ /**
22
+ * Run the create pipeline over whatever inputs are available.
23
+ * @param {object} ctx
24
+ * @param {string} [ctx.task] free-text task label (echoed back)
25
+ * @param {string} [ctx.name] module name → enables the scaffold stage
26
+ * @param {object} [ctx.conventions] an `extractConventions` result (for scaffold)
27
+ * @param {object} [ctx.scaffoldOpts] options forwarded to `proposeScaffold`
28
+ * @param {string} [ctx.plan] plan markdown → enables verify-plan
29
+ * @param {string} [ctx.answer] AI answer markdown → enables verify-ai-output
30
+ * @param {Array<{path:string,status:string}>} [ctx.changedFiles] → enables review-pr
31
+ * @param {string} cwd repo root
32
+ * @returns {{ task: string|null, steps: object[], summary: object }}
33
+ */
34
+ function orchestrate(ctx = {}, cwd) {
35
+ const steps = [];
36
+
37
+ // 1/4 — scaffold (needs a name + conventions)
38
+ if (ctx.name && ctx.conventions) {
39
+ const d = proposeScaffold(ctx.name, ctx.conventions, ctx.scaffoldOpts || {});
40
+ steps.push({ n: 1, total: TOTAL, name: 'scaffold', ran: true, ok: !!d.ok, skipped: false, detail: d });
41
+ } else {
42
+ steps.push({ n: 1, total: TOTAL, name: 'scaffold', ran: false, ok: null, skipped: true, reason: 'no --name' });
43
+ }
44
+
45
+ // 2/4 — verify-plan (needs a plan)
46
+ if (ctx.plan != null && String(ctx.plan).trim() !== '') {
47
+ const r = verifyPlan(ctx.plan, cwd);
48
+ steps.push({ n: 2, total: TOTAL, name: 'verify-plan', ran: true, ok: !!r.summary.ok, skipped: false, detail: r });
49
+ } else {
50
+ steps.push({ n: 2, total: TOTAL, name: 'verify-plan', ran: false, ok: null, skipped: true, reason: 'no --plan' });
51
+ }
52
+
53
+ // 3/4 — verify-ai-output (needs an answer)
54
+ if (ctx.answer != null && String(ctx.answer).trim() !== '') {
55
+ const r = verify(ctx.answer, cwd);
56
+ steps.push({ n: 3, total: TOTAL, name: 'verify-ai-output', ran: true, ok: r.summary.total === 0, skipped: false, detail: r });
57
+ } else {
58
+ steps.push({ n: 3, total: TOTAL, name: 'verify-ai-output', ran: false, ok: null, skipped: true, reason: 'no --answer' });
59
+ }
60
+
61
+ // 4/4 — review-pr (needs changed files)
62
+ if (Array.isArray(ctx.changedFiles) && ctx.changedFiles.length) {
63
+ const r = reviewPr(ctx.changedFiles, cwd);
64
+ steps.push({ n: 4, total: TOTAL, name: 'review-pr', ran: true, ok: !!r.summary.ok, skipped: false, detail: r });
65
+ } else {
66
+ steps.push({ n: 4, total: TOTAL, name: 'review-pr', ran: false, ok: null, skipped: true, reason: 'no changes' });
67
+ }
68
+
69
+ const ran = steps.filter((s) => s.ran);
70
+ const passed = ran.filter((s) => s.ok).length;
71
+ const failed = ran.length - passed;
72
+ return {
73
+ task: ctx.task || null,
74
+ steps,
75
+ summary: {
76
+ total: TOTAL,
77
+ ran: ran.length,
78
+ skipped: steps.length - ran.length,
79
+ passed,
80
+ failed,
81
+ ok: failed === 0,
82
+ },
83
+ };
84
+ }
85
+
86
+ module.exports = { orchestrate, TOTAL };
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.12.0',
21
+ version: '7.13.0',
22
22
  description: 'SigMap MCP server — code signatures on demand',
23
23
  };
24
24