sigmap 2.0.0-beta.6 → 2.0.1

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
@@ -6,99 +6,37 @@ Format: [Semantic Versioning](https://semver.org/)
6
6
 
7
7
  ---
8
8
 
9
- ## [2.0.0-beta.6] — 2026-04-04
9
+ ## [2.0.0] — 2026-04-04
10
10
 
11
- ### Changed
12
- - Prerelease version bumped from `2.0.0-beta.5` to `2.0.0-beta.6` across CLI, MCP server info, root package metadata, and VS Code extension metadata.
13
-
14
- ### Validation gate
15
- - 21/21 extractor tests passed
16
- - 17/17 integration suites passed (including v2plus 3/3)
17
-
18
- ---
19
-
20
- ## [2.0.0-beta.5]2026-04-03
21
-
22
- ### Changed
23
- - Prerelease version bumped from `2.0.0-beta.4` to `2.0.0-beta.5` across CLI, MCP server info, root package metadata, and VS Code extension metadata.
24
-
25
- ### Validation gate
26
- - 21/21 extractor tests passed
27
- - 17/17 integration suites passed (including v2plus 3/3)
28
-
29
- ---
30
-
31
- ## [2.0.0-beta.4] — 2026-04-03
32
-
33
- ### Changed
34
- - Prerelease version bumped from `2.0.0-beta.3` to `2.0.0-beta.4` across CLI, MCP server info, root package metadata, and VS Code extension metadata.
35
-
36
- ### Validation gate
37
- - 21/21 extractor tests passed
38
- - 17/17 integration suites passed (including v2plus 3/3)
39
-
40
- ---
41
-
42
- ## [2.0.0-beta.3] — 2026-04-03
11
+ ### Added
12
+ - **v2 output enrichment pipeline** — compact `deps`, `todos`, `changes` sections auto-generated in context output.
13
+ - **Structural diff mode** — `--diff <base-ref>` writes a signature-level diff section comparing current signatures against a base branch.
14
+ - **Test coverage markers** — opt-in per-function `✓`/`✗` hints by scanning test directories (`testCoverage: true`).
15
+ - **Impact radius hints** — opt-in reverse dependency annotations (`impactRadius: true`).
16
+ - **New helper extractors**:
17
+ - `src/extractors/deps.js` — Python and TS/JS dependency extraction + reverse dep map.
18
+ - `src/extractors/todos.js` — TODO/FIXME/HACK/XXX harvesting (max 20 entries).
19
+ - `src/extractors/coverage.js` — lightweight function/test correlation.
20
+ - `src/extractors/prdiff.js`signature-level base-ref diffs.
21
+ - **New config keys**: `enrichSignatures`, `depMap`, `schemaFields`, `todos`, `changes`, `changesCommits`, `testCoverage`, `testDirs`, `impactRadius`.
22
+ - `test/integration/v2plus.test.js` — 3 integration tests for todos, coverage markers, and structural diff.
23
+ - `test/integration/all.js` unified integration runner and `test:integration:all` npm script.
43
24
 
44
25
  ### Changed
45
- - Prerelease version bumped from `2.0.0-beta.2` to `2.0.0-beta.3` across CLI, MCP server info, root package metadata, and VS Code extension metadata.
46
- - Version drift in [gen-context.js](gen-context.js) was corrected so runtime reporting matches published package metadata.
47
-
48
- ### Validation gate
49
- - `node scripts/bundle.js`
50
- - `node test/run.js`
51
- - `node test/integration/all.js`
52
- - `node gen-context.js --report`
53
-
54
- ## [2.0.0-beta.2] — 2026-04-03
26
+ - **Enriched multi-language extractors** return-type hints (`→ Type`) and richer signatures across C++, C#, Dart, Go, Java, JavaScript, Kotlin, PHP, Python, Ruby, Rust, Scala, Svelte, Swift, TypeScript, and Vue.
27
+ - **Python extractor** dataclass/BaseModel field collapse, top-level docstring hints, fixed field bleed across class boundaries.
28
+ - **TypeScript extractor** — interface property types, class method return hints, compact hook return shapes for `export function useX()`, union type truncation extended to 35 chars.
29
+ - Removed stale development files: `TIMELINE.md`, `scripts/bundle.js`, `scripts/make-icon.py`, `scripts/inject-search.py`, `scripts/backfill-npm.sh`, `examples/slack-context-bot.js`, `examples/copilot-prompts.code-snippets`.
55
30
 
56
31
  ### Fixed
57
- - Python BaseModel field extraction no longer bleeds into subsequent classes when class bodies are separated by blank lines.
58
- - Updated [src/extractors/python.js](src/extractors/python.js) `tryExtractBaseModelFields` to stop scanning at the next top-level block.
59
- - TypeScript interface member type previews now preserve longer union strings.
60
- - Updated [src/extractors/typescript.js](src/extractors/typescript.js) to extend interface type truncation from 20 to 35 characters.
61
- - TypeScript function-style hooks (`export function useX`) now include compact return object shapes, matching existing arrow-hook behavior.
62
- - Updated [src/extractors/typescript.js](src/extractors/typescript.js) export-function extraction path.
63
-
64
- ### Changed
65
- - Prerelease version bumped from `2.0.0-beta.1` to `2.0.0-beta.2` across CLI, MCP server info, root package metadata, and VS Code extension metadata.
32
+ - Python `tryExtractBaseModelFields` no longer bleeds fields into subsequent classes.
33
+ - TypeScript interface member type previews preserve longer union strings (20 → 35 chars).
34
+ - TypeScript function-style hooks (`export function useX`) now include compact return object shapes.
66
35
 
67
36
  ### Validation gate
68
- - `node scripts/bundle.js`
69
- - `node test/run.js`
70
- - `node test/integration/all.js`
71
- - `node gen-context.js --report`
72
- - `node /Users/manojmallick/context-forge/gen-context.js --report` on arbi-platform
73
-
74
- ## [2.0.0-beta.1] — 2026-04-03
75
-
76
- ### Added
77
- - v2 output enrichment pipeline in [gen-context.js](gen-context.js): compact `deps`, `todos`, `changes`, optional structural `diff (vs <base>)`, optional test coverage markers, and optional impact-radius hints.
78
- - New helper extractors:
79
- - [src/extractors/deps.js](src/extractors/deps.js) for Python and TS/JS dependency extraction
80
- - [src/extractors/todos.js](src/extractors/todos.js) for TODO/FIXME/HACK/XXX harvesting
81
- - [src/extractors/coverage.js](src/extractors/coverage.js) for lightweight function/test correlation
82
- - [src/extractors/prdiff.js](src/extractors/prdiff.js) for signature-level base-ref diffs
83
- - New integration coverage in [test/integration/v2plus.test.js](test/integration/v2plus.test.js) for todos, changes, test coverage markers, and `--diff <base-ref>`.
84
- - New unified integration runner in [test/integration/all.js](test/integration/all.js) and npm script `test:integration:all` in [package.json](package.json).
85
-
86
- ### Changed
87
- - Expanded multi-language extractors to surface compact return-type hints and richer signatures across C++, C#, Dart, Go, Java, JavaScript, Kotlin, PHP, Python, Ruby, Rust, Scala, Svelte, Swift, TypeScript, and Vue.
88
- - Python extractor now supports dataclass/BaseModel field collapse and top-level docstring hints.
89
- - TypeScript extractor now exposes interface property types, class method return hints, and compact hook return shapes for `use*` exports.
90
- - Source config defaults in [src/config/defaults.js](src/config/defaults.js) now include strategy keys and v2 output toggles so source-loaded config matches bundled behavior.
91
- - Compatibility tests were updated to current `sigmap.*` command/config naming and broader MCP tool lists.
92
-
93
- ### Validation gate
94
- - `node test/run.js` → 21/21 pass
95
- - `node test/integration/all.js` → 17/17 integration suites pass
96
- - `node gen-context.js --report` on this repo → ~93.6% reduction
97
- - `node /Users/manojmallick/context-forge/gen-context.js --report` on arbi-platform → ~85.7% reduction, 3987 output tokens
98
-
99
- ### Notes
100
- - This is a prerelease build intended for final release hardening before stable `2.0.0`.
101
- - Publish with the `beta` dist-tag to avoid upgrading stable consumers automatically.
37
+ - 21/21 extractor tests passed
38
+ - 17/17 integration suites passed (262 individual tests)
39
+ - `node gen-context.js --report` → ~93.5% reduction
102
40
 
103
41
 
104
42
  ## [1.5.0] — 2026-04-04
@@ -127,7 +65,6 @@ Format: [Semantic Versioning](https://semver.org/)
127
65
 
128
66
  ### Notes
129
67
  - The VS Code extension requires the `vscode` peer dependency at runtime (provided by the editor). It has no npm runtime dependencies of its own.
130
- - `scripts/inject-search.py` is the one-time migration script used to add search to existing HTML pages; it is idempotent (skip if already patched).
131
68
 
132
69
  ### Validation gate
133
70
  - `node gen-context.js --version` → `1.5.0` ✔ *(note: version bumped separately if desired)*
package/README.md CHANGED
@@ -11,7 +11,7 @@
11
11
 
12
12
  <!-- Status -->
13
13
  [![npm version](https://img.shields.io/npm/v/sigmap?color=7c6af7&label=latest&logo=npm)](https://www.npmjs.com/package/sigmap)
14
- [![Tests](https://img.shields.io/badge/tests-274%20passing-22c55e)](https://github.com/manojmallick/sigmap/tree/main/test)
14
+ [![Tests](https://img.shields.io/badge/tests-262%20passing-22c55e)](https://github.com/manojmallick/sigmap/tree/main/test)
15
15
  [![Zero deps](https://img.shields.io/badge/dependencies-zero-22c55e)](package.json)
16
16
  [![Last commit](https://img.shields.io/github/last-commit/manojmallick/sigmap?color=7c6af7)](https://github.com/manojmallick/sigmap/commits/main)
17
17
 
@@ -82,6 +82,23 @@ AI agent session starts with full context
82
82
 
83
83
  ---
84
84
 
85
+ ## 🆕 What's new in 2.0
86
+
87
+ | Feature | Description |
88
+ |---|---|
89
+ | **Enriched signatures** | Return types, type hints, and schema field collapse (Python `@dataclass` / `BaseModel`) |
90
+ | **Dependency map** | Compact import dependency section at the top of output (~50–100 extra tokens) |
91
+ | **TODO/FIXME section** | Auto-harvested TODO/FIXME/HACK/XXX comments (max 20 entries) |
92
+ | **Recent changes section** | Git-based recent changes summary in output |
93
+ | **Test coverage markers** | Per-function `✓`/`✗` hints by scanning test directories |
94
+ | **Structural diff mode** | `--diff <base-ref>` writes a signature-level diff section |
95
+ | **Impact radius hints** | Reverse dependency annotations (used by: ...) |
96
+ | **New helper extractors** | `deps.js`, `todos.js`, `coverage.js`, `prdiff.js` |
97
+
98
+ Several v2 enhancements (deps map, TODOs, recent changes) are enabled by default. All v2 sections can be tuned or disabled via `gen-context.config.json`.
99
+
100
+ ---
101
+
85
102
  ## 🚀 Quick start
86
103
 
87
104
  **No install required — just Node.js 18+.**
@@ -147,7 +164,7 @@ The `vscode-extension/` directory contains a first-party VS Code extension that
147
164
  | **Stale notification** | Warns when `copilot-instructions.md` is > 24 h old; one-click regeneration |
148
165
  | **Regenerate command** | `SigMap: Regenerate Context` — runs `node gen-context.js` in the integrated terminal |
149
166
  | **Open context command** | `SigMap: Open Context File` — opens `.github/copilot-instructions.md` |
150
- | **Script path setting** | `contextforge.scriptPath` — override when `gen-context.js` is not at the project root |
167
+ | **Script path setting** | `sigmap.scriptPath` — override when `gen-context.js` is not at the project root |
151
168
 
152
169
  Activate on startup (`onStartupFinished`) — loads within 3 s, never blocks editor startup.
153
170
 
@@ -380,7 +397,7 @@ node gen-context.js --track
380
397
 
381
398
  # Structured JSON report for CI (exits 1 if over budget)
382
399
  node gen-context.js --report --json
383
- # { "version": "1.5.0", "finalTokens": 3200, "reductionPct": 92.4, "overBudget": false }
400
+ # { "version": "2.0.0", "finalTokens": 3200, "reductionPct": 92.4, "overBudget": false }
384
401
 
385
402
  # Composite health score
386
403
  node gen-context.js --health
@@ -478,7 +495,7 @@ sigmap/
478
495
  │ ├── fixtures/ ← one source file per language
479
496
  │ ├── expected/ ← expected extractor output
480
497
  │ ├── run.js ← zero-dep test runner
481
- │ └── integration/ ← 16 integration test files (253 tests)
498
+ │ └── integration/ ← 17 integration test files (241 tests)
482
499
 
483
500
  ├── docs/ ← documentation site (GitHub Pages)
484
501
  │ ├── index.html ← homepage
@@ -490,11 +507,12 @@ sigmap/
490
507
 
491
508
  ├── scripts/
492
509
  │ ├── ci-update.sh ← CI pipeline helper
493
- │ └── inject-search.py one-time: add search to docs HTML pages
510
+ │ └── release.sh version bump + npm publish helper
494
511
 
495
512
  ├── examples/
496
513
  │ ├── self-healing-github-action.yml
497
- └── gen-context.config.json full annotated config
514
+ ├── github-action.yml ready-to-use CI workflow
515
+ │ └── claude-code-settings.json ← MCP server config example
498
516
 
499
517
  ├── .npmignore ← excludes docs/, test/, vscode-extension/ from publish
500
518
  ├── .contextignore.example ← exclusion template
@@ -590,7 +608,7 @@ function extract(src) { // src: string → string[]
590
608
 
591
609
  ## 📄 License
592
610
 
593
- MIT © 2026 [Manoj Mallick](https://github.com/manojmallick)
611
+ MIT © 2026 [Manoj Mallick](https://github.com/manojmallick) · Made in Amsterdam 🇳🇱
594
612
 
595
613
  ---
596
614
 
@@ -1,5 +1,5 @@
1
1
  {
2
- "_comment": "ContextForge configuration — all keys are optional (defaults shown)",
2
+ "_comment": "SigMap configuration — all keys are optional (defaults shown)",
3
3
 
4
4
  "output": ".github/copilot-instructions.md",
5
5
 
@@ -38,15 +38,9 @@
38
38
  "_hotCommits_comment": "Only used by hot-cold strategy: how many recent commits count as 'hot'",
39
39
  "hotCommits": 10,
40
40
 
41
- "_enrichSignatures_comment": "Enrich signatures with return types, type hints, and schema field collapse (Python @dataclass / BaseModel)",
42
- "enrichSignatures": true,
43
-
44
41
  "_depMap_comment": "Include a compact import dependency map at the top of the output (~50-100 extra tokens)",
45
42
  "depMap": true,
46
43
 
47
- "_schemaFields_comment": "Collapse Pydantic BaseModel / @dataclass class bodies to a single field-list line",
48
- "schemaFields": true,
49
-
50
44
  "_todos_comment": "Include compact TODO/FIXME/HACK/XXX section (max 20 entries)",
51
45
  "todos": true,
52
46
 
package/gen-context.js CHANGED
@@ -1045,8 +1045,12 @@ __factories["./src/extractors/python"] = function(module, exports) {
1045
1045
  function tryExtractBaseModelFields(stripped, bodyStart) {
1046
1046
  const lines = stripped.slice(bodyStart, bodyStart + 800).split('\n');
1047
1047
  const fields = [];
1048
+ let foundFirst = false;
1048
1049
  for (const line of lines) {
1050
+ if (line.trim() === '') continue;
1051
+ if (foundFirst && !/^\s/.test(line)) break;
1049
1052
  if (!line.match(/^\s{4}\w/)) continue;
1053
+ foundFirst = true;
1050
1054
  const f = line.match(/^\s{4}(\w+)\s*(?::\s*([^=\n]+?))?(?:\s*=\s*(.*))?$/);
1051
1055
  if (!f || f[1].startsWith('_') || f[1] === 'class' || f[1] === 'def') continue;
1052
1056
  const isOptional = (f[2] || '').includes('Optional') || f[3] !== undefined;
@@ -1629,7 +1633,7 @@ __factories["./src/extractors/typescript"] = function(module, exports) {
1629
1633
  for (const m of block.matchAll(/^\s+(readonly\s+)?(\w+)(\??):\s*([^;]+);/gm)) {
1630
1634
  const readonly = m[1] ? 'readonly ' : '';
1631
1635
  const optional = m[3] ? '?' : '';
1632
- const typeStr = m[4].trim().replace(/\s+/g, ' ').slice(0, 20);
1636
+ const typeStr = m[4].trim().replace(/\s+/g, ' ').slice(0, 35);
1633
1637
  members.push(`${readonly}${m[2]}${optional}: ${typeStr}`);
1634
1638
  }
1635
1639
  for (const m of block.matchAll(/^\s+(\w+)\s*(?:<[^(]*>)?\s*\(([^)]*)\)\s*:/gm)) {
@@ -1712,7 +1716,20 @@ __factories["./src/extractors/deps"] = function(module, exports) {
1712
1716
  return [...deps].slice(0, 5);
1713
1717
  }
1714
1718
 
1715
- module.exports = { extractPythonDeps, extractTSDeps };
1719
+ function buildReverseDepMap(forwardMap) {
1720
+ const reverse = new Map();
1721
+ if (!forwardMap || typeof forwardMap.entries !== 'function') return reverse;
1722
+ for (const [file, deps] of forwardMap.entries()) {
1723
+ if (!Array.isArray(deps)) continue;
1724
+ for (const dep of deps) {
1725
+ if (!reverse.has(dep)) reverse.set(dep, []);
1726
+ reverse.get(dep).push(file);
1727
+ }
1728
+ }
1729
+ return reverse;
1730
+ }
1731
+
1732
+ module.exports = { extractPythonDeps, extractTSDeps, buildReverseDepMap };
1716
1733
 
1717
1734
  };
1718
1735
 
@@ -3566,7 +3583,7 @@ const path = require('path');
3566
3583
  const os = require('os');
3567
3584
  const { execSync } = require('child_process');
3568
3585
 
3569
- const VERSION = '2.0.0-beta.6';
3586
+ const VERSION = '2.0.0';
3570
3587
  const MARKER = '\n\n## Auto-generated signatures\n<!-- Updated by gen-context.js -->\n';
3571
3588
 
3572
3589
  function requireSourceOrBundled(key) {
@@ -3840,8 +3857,13 @@ function getDiffFiles(cwd, stagedOnly) {
3840
3857
  }
3841
3858
 
3842
3859
  function getFilesChangedSinceBase(cwd, baseRef) {
3860
+ if (!/^[A-Za-z0-9._/\-~^]+$/.test(baseRef)) {
3861
+ console.warn(`[sigmap] --diff: invalid base ref '${baseRef}'`);
3862
+ return new Set();
3863
+ }
3843
3864
  try {
3844
- const out = execSync(`git diff ${baseRef}..HEAD --name-only`, {
3865
+ const { execFileSync } = require('child_process');
3866
+ const out = execFileSync('git', ['diff', `${baseRef}..HEAD`, '--name-only'], {
3845
3867
  cwd, encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'],
3846
3868
  });
3847
3869
  return new Set(out.split('\n').map((f) => f.trim()).filter(Boolean).map((f) => path.resolve(cwd, f)));
@@ -3858,7 +3880,8 @@ function buildDiffSectionFromBase(cwd, baseRef, currentEntries, config) {
3858
3880
  const rel = path.relative(cwd, entry.filePath);
3859
3881
  let baseSrc = '';
3860
3882
  try {
3861
- baseSrc = execSync(`git show ${baseRef}:"${rel}" 2>/dev/null`, {
3883
+ const { execFileSync } = require('child_process');
3884
+ baseSrc = execFileSync('git', ['show', `${baseRef}:${rel}`], {
3862
3885
  cwd, encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'],
3863
3886
  });
3864
3887
  } catch (_) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sigmap",
3
- "version": "2.0.0-beta.6",
3
+ "version": "2.0.1",
4
4
  "description": "Zero-dependency AI context engine — 97% token reduction. No npm install. Runs on Node 18+.",
5
5
  "main": "gen-context.js",
6
6
  "bin": {
@@ -72,15 +72,9 @@ const DEFAULTS = {
72
72
  autoRegister: true,
73
73
  },
74
74
 
75
- // Enrich signatures with return types, type hints, and schema field collapse
76
- enrichSignatures: true,
77
-
78
75
  // Include a compact import dependency map at top of output
79
76
  depMap: true,
80
77
 
81
- // Collapse Pydantic BaseModel / @dataclass fields to a single line
82
- schemaFields: true,
83
-
84
78
  // Include TODO/FIXME/HACK/XXX comments as compact section
85
79
  todos: true,
86
80
 
@@ -35,11 +35,11 @@ function buildTestIndex(cwd, testDirs) {
35
35
  }
36
36
 
37
37
  for (const m of src.matchAll(/\b(?:test_|it\(|test\(|describe\()\s*['"`]?([\w_]+)/g)) {
38
- if (m[1]) names.add(m[1].toLowerCase());
38
+ if (m[1] && m[1].length >= 3) names.add(m[1].toLowerCase());
39
39
  }
40
40
 
41
41
  for (const m of src.matchAll(/\b([a-zA-Z_][a-zA-Z0-9_]*)\b/g)) {
42
- if (m[1]) names.add(m[1].toLowerCase());
42
+ if (m[1] && m[1].length >= 4) names.add(m[1].toLowerCase());
43
43
  }
44
44
  }
45
45
  }
@@ -48,12 +48,9 @@ function buildTestIndex(cwd, testDirs) {
48
48
  }
49
49
 
50
50
  function isTested(funcName, testIndex) {
51
- if (!funcName || !testIndex || testIndex.size === 0) return false;
51
+ if (!funcName || funcName.length < 3 || !testIndex || testIndex.size === 0) return false;
52
52
  const lower = funcName.toLowerCase();
53
53
  if (testIndex.has(lower) || testIndex.has(`test_${lower}`)) return true;
54
- for (const token of testIndex) {
55
- if (token.includes(lower)) return true;
56
- }
57
54
  return false;
58
55
  }
59
56
 
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: '2.0.0-beta.6',
21
+ version: '2.0.0',
22
22
  description: 'SigMap MCP server — code signatures on demand',
23
23
  };
24
24