sigmap 6.0.0 → 6.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/AGENTS.md CHANGED
@@ -12,20 +12,21 @@ Use this marker block for all appendable context files:
12
12
  ## Auto-generated signatures
13
13
  <!-- Updated by gen-context.js -->
14
14
  You are a coding assistant with full knowledge of this codebase.
15
- Below are the code signatures extracted by SigMap v5.7.0 on 2026-04-17T21:17:18.905Z.
15
+ Below are the code signatures extracted by SigMap v6.0.1 on 2026-04-21T10:54:32.005Z.
16
16
 
17
17
  Use these signatures to answer questions about the code accurately.
18
18
 
19
19
  ## Code Signatures
20
20
 
21
- <!-- Generated by SigMap gen-context.js v5.7.0 -->
21
+ <!-- Generated by SigMap gen-context.js v6.0.1 -->
22
22
  <!-- DO NOT EDIT below the marker line — run gen-context.js to regenerate -->
23
23
 
24
24
  # Code signatures
25
25
 
26
- ## changes (last 5 commits — 7 minutes ago)
26
+ ## changes (last 5 commits — 11 minutes ago)
27
27
  ```
28
- src/analysis/coverage-score.js ~coverageScore ~_walk
28
+ src/extractors/typescript.js ~extractInterfaceMembers ~extractClassMembers
29
+ packages/adapters/codex.js ~format
29
30
  ```
30
31
 
31
32
  ## packages
@@ -36,14 +37,6 @@ module.exports = { CLI_ENTRY, run }
36
37
  function run(argv, cwd) → void
37
38
  ```
38
39
 
39
- ### packages/adapters/codex.js
40
- ```
41
- module.exports = { name, format, outputPath, write }
42
- function format(context, opts = {}) → string
43
- function outputPath(cwd) → string
44
- function write(context, cwd, opts = {})
45
- ```
46
-
47
40
  ### packages/adapters/index.js
48
41
  ```
49
42
  module.exports = { getAdapter, listAdapters, adapt, outputsToAdapters }
@@ -144,21 +137,15 @@ function score(cwd) → { * score: number, * grad
144
137
  function adapt(context, adapterName, opts = {}) → string
145
138
  ```
146
139
 
147
- ## src
148
-
149
- ### src/map/route-table.js
140
+ ### packages/adapters/codex.js
150
141
  ```
151
- module.exports = { analyze }
152
- function shouldSkipFile(rel)
153
- function analyze(files, cwd)
142
+ module.exports = { name, format, outputPath, write }
143
+ function format(context, opts = {}) → string
144
+ function outputPath(cwd) → string
145
+ function write(context, cwd, opts = {})
154
146
  ```
155
147
 
156
- ### src/routing/classifier.js
157
- ```
158
- module.exports = { classify, classifyAll }
159
- function classify(filePath, sigs) → 'fast'|'balanced'|'powerf
160
- function classifyAll(fileEntries, cwd) → { fast: string[], balance
161
- ```
148
+ ## src
162
149
 
163
150
  ### src/routing/hints.js
164
151
  ```
@@ -177,14 +164,6 @@ module.exports = { scan }
177
164
  function scan(signatures, filePath) → { safe: string[], redacte
178
165
  ```
179
166
 
180
- ### src/tracking/logger.js
181
- ```
182
- module.exports = { logRun, readLog, summarize }
183
- function logRun(entry, cwd)
184
- function readLog(cwd) → object[]
185
- function summarize(entries) → object
186
- ```
187
-
188
167
  ### src/extractors/cpp.js
189
168
  ```
190
169
  module.exports = { extract }
@@ -344,16 +323,6 @@ module.exports = { extractTodos }
344
323
  function extractTodos(src) → {line:number, tag:string,
345
324
  ```
346
325
 
347
- ### src/extractors/typescript.js
348
- ```
349
- module.exports = { extract }
350
- function extract(src) → string[]
351
- function extractBlock(src, startIndex)
352
- function extractInterfaceMembers(block)
353
- function extractClassMembers(block)
354
- function normalizeParams(params)
355
- ```
356
-
357
326
  ### src/extractors/vue.js
358
327
  ```
359
328
  module.exports = { extract }
@@ -607,32 +576,6 @@ function penalizeFiles(cwd, files, amount = 0.10)
607
576
  function resetWeights(cwd)
608
577
  ```
609
578
 
610
- ### src/mcp/handlers.js
611
- ```
612
- module.exports = { readContext, searchSignatures, getMap, createCheckpoint, getRouting, explainFile, listModules, queryContext, getImpact }
613
- function readContext(args, cwd)
614
- function searchSignatures(args, cwd)
615
- function getMap(args, cwd)
616
- function createCheckpoint(args, cwd)
617
- function getRouting(args, cwd)
618
- function explainFile(args, cwd)
619
- function listModules(args, cwd)
620
- function queryContext(args, cwd)
621
- function getImpact(args, cwd)
622
- ```
623
-
624
- ### src/retrieval/ranker.js
625
- ```
626
- module.exports = { rank, buildSigIndex, scoreFile, formatRankTable, formatRankJSON, DEFAULT_WEIGHTS, detectIntent }
627
- function scoreFile(filePath, sigs, queryTokens, weights) → number
628
- function rank(query, sigIndex, opts) → { file: string, score: nu
629
- function _parseContextFile(contextPath) → Map<string, string[]>
630
- function buildSigIndex(cwd, opts) → Map<string, string[]>
631
- function formatRankTable(results, query) → string
632
- function formatRankJSON(results, query) → object
633
- function detectIntent(query)
634
- ```
635
-
636
579
  ### src/format/benchmark-report.js
637
580
  ```
638
581
  module.exports = { loadBenchmarkReports, buildBenchmarkSummary, generateBenchmarkReportHtml, writeBenchmarkReport }
@@ -667,6 +610,60 @@ function coverageScore(cwd, fileEntries, config)
667
610
  function _walk(dir, excludeSet, out)
668
611
  ```
669
612
 
613
+ ### src/tracking/logger.js
614
+ ```
615
+ module.exports = { logRun, readLog, summarize }
616
+ function logRun(entry, cwd)
617
+ function readLog(cwd) → object[]
618
+ function summarize(entries) → object
619
+ ```
620
+
621
+ ### src/cache/sig-cache.js
622
+ ```
623
+ module.exports = { loadCache, saveCache, getChangedFiles, updateCacheEntries }
624
+ function cachePath(cwd)
625
+ function loadCache(cwd, currentVersion) → Map<string, { mtime: numb
626
+ function saveCache(cwd, currentVersion, cache)
627
+ function getChangedFiles(files, cache) → { changed: string[], unch
628
+ function updateCacheEntries(cache, extracted)
629
+ ```
630
+
631
+ ### src/extractors/typescript.js
632
+ ```
633
+ module.exports = { extract }
634
+ function extract(src) → string[]
635
+ function extractBlock(src, startIndex)
636
+ function extractInterfaceMembers(block)
637
+ function extractClassMembers(block)
638
+ function normalizeParams(params)
639
+ ```
640
+
641
+ ### src/mcp/handlers.js
642
+ ```
643
+ module.exports = { readContext, searchSignatures, getMap, createCheckpoint, getRouting, explainFile, listModules, queryContext, getImpact }
644
+ function readContext(args, cwd)
645
+ function searchSignatures(args, cwd)
646
+ function getMap(args, cwd)
647
+ function createCheckpoint(args, cwd)
648
+ function getRouting(args, cwd)
649
+ function explainFile(args, cwd)
650
+ function listModules(args, cwd)
651
+ function queryContext(args, cwd)
652
+ function getImpact(args, cwd)
653
+ ```
654
+
655
+ ### src/retrieval/ranker.js
656
+ ```
657
+ module.exports = { rank, buildSigIndex, scoreFile, formatRankTable, formatRankJSON, DEFAULT_WEIGHTS, detectIntent }
658
+ function scoreFile(filePath, sigs, queryTokens, weights) → number
659
+ function rank(query, sigIndex, opts) → { file: string, score: nu
660
+ function _parseContextFile(contextPath) → Map<string, string[]>
661
+ function buildSigIndex(cwd, opts) → Map<string, string[]>
662
+ function formatRankTable(results, query) → string
663
+ function formatRankJSON(results, query) → object
664
+ function detectIntent(query)
665
+ ```
666
+
670
667
  ### src/mcp/server.js
671
668
  ```
672
669
  module.exports = { start }
package/CHANGELOG.md CHANGED
@@ -10,6 +10,15 @@ Format: [Semantic Versioning](https://semver.org/)
10
10
 
11
11
  ---
12
12
 
13
+ ## [6.0.1] — 2026-04-21
14
+
15
+ ### Fixed
16
+
17
+ - **TypeScript extractor guard clauses (#97)** — `extractClassMembers` now skips control-flow keywords (`if`, `for`, `while`, `switch`, `do`, `try`, `catch`, `finally`, `else`) that were incorrectly emitted as method signatures when they appeared inside class bodies.
18
+ - **Codex/AGENTS.md adapter preamble (#96)** — `packages/adapters/codex.js` no longer delegates to the OpenAI adapter. Output is now clean `# Code signatures\n\n<context>` markdown with no "You are a coding assistant…" preamble, no HTML comment metadata block, and no duplicate headers.
19
+
20
+ ---
21
+
13
22
  ## [6.0.0] — 2026-04-19
14
23
 
15
24
  ### Added
package/README.md CHANGED
@@ -157,9 +157,11 @@ sigmap --adapter cursor
157
157
 
158
158
  **IDE extensions:**
159
159
 
160
- - [VS Code extension](https://marketplace.visualstudio.com/items?itemName=manojmallick.sigmap) status bar health grade, stale alerts, one-click regen
161
- - [JetBrains plugin](https://plugins.jetbrains.com/plugin/31109-sigmap--ai-context-engine/) — IntelliJ IDEA, WebStorm, PyCharm, GoLand
162
- - [Neovim plugin](https://github.com/manojmallick/sigmap.nvim) `:SigMap`, `:SigMapQuery`, statusline widget
160
+ | IDE | Install | Source | Features |
161
+ |-----|---------|--------|----------|
162
+ | **VS Code** | [Marketplace](https://marketplace.visualstudio.com/items?itemName=manojmallick.sigmap) · [Open VSX](https://open-vsx.org/extension/manojmallick/sigmap) | [github.com/manojmallick/sigmap-vscode](https://github.com/manojmallick/sigmap-vscode) | Status bar health grade, stale context alerts, one-click regen |
163
+ | **JetBrains** | [Marketplace](https://plugins.jetbrains.com/plugin/31109-sigmap--ai-context-engine/) | [github.com/manojmallick/sigmap-jetbrains](https://github.com/manojmallick/sigmap-jetbrains) | IntelliJ IDEA, WebStorm, PyCharm, GoLand — tool window + actions |
164
+ | **Neovim** | lazy.nvim / packer / vim-plug | [github.com/manojmallick/sigmap.nvim](https://github.com/manojmallick/sigmap.nvim) | `:SigMap`, `:SigMapQuery` float window, statusline widget |
163
165
 
164
166
  **MCP server** — 9 on-demand tools for Claude Code and Cursor:
165
167
 
package/gen-context.js CHANGED
@@ -4520,6 +4520,71 @@ __factories["./src/map/route-table"] = function(module, exports) {
4520
4520
 
4521
4521
  };
4522
4522
 
4523
+ // ── ./src/cache/sig-cache ──
4524
+ __factories["./src/cache/sig-cache"] = function(module, exports) {
4525
+ 'use strict';
4526
+
4527
+ const fs = require('fs');
4528
+ const path = require('path');
4529
+
4530
+ const CACHE_FILE = '.sigmap-cache.json';
4531
+
4532
+ function cachePath(cwd) {
4533
+ return path.join(cwd, CACHE_FILE);
4534
+ }
4535
+
4536
+ function loadCache(cwd, currentVersion) {
4537
+ try {
4538
+ const raw = fs.readFileSync(cachePath(cwd), 'utf8');
4539
+ const data = JSON.parse(raw);
4540
+ if (data.sigmapVersion !== currentVersion) return new Map();
4541
+ return new Map(Object.entries(data.entries || {}));
4542
+ } catch (_) {
4543
+ return new Map();
4544
+ }
4545
+ }
4546
+
4547
+ function saveCache(cwd, currentVersion, cache) {
4548
+ try {
4549
+ const data = {
4550
+ sigmapVersion: currentVersion,
4551
+ entries: Object.fromEntries(cache),
4552
+ };
4553
+ fs.writeFileSync(cachePath(cwd), JSON.stringify(data), 'utf8');
4554
+ } catch (_) {}
4555
+ }
4556
+
4557
+ function getChangedFiles(files, cache) {
4558
+ const changed = [];
4559
+ const unchanged = [];
4560
+ for (const f of files) {
4561
+ try {
4562
+ const mtime = fs.statSync(f).mtimeMs;
4563
+ const cached = cache.get(f);
4564
+ if (!cached || cached.mtime !== mtime) {
4565
+ changed.push(f);
4566
+ } else {
4567
+ unchanged.push(f);
4568
+ }
4569
+ } catch (_) {
4570
+ changed.push(f);
4571
+ }
4572
+ }
4573
+ return { changed, unchanged };
4574
+ }
4575
+
4576
+ function updateCacheEntries(cache, extracted) {
4577
+ for (const { file, sigs } of extracted) {
4578
+ try {
4579
+ const mtime = fs.statSync(file).mtimeMs;
4580
+ cache.set(file, { mtime, sigs });
4581
+ } catch (_) {}
4582
+ }
4583
+ }
4584
+
4585
+ module.exports = { loadCache, saveCache, getChangedFiles, updateCacheEntries };
4586
+ };
4587
+
4523
4588
  // ── ./src/graph/builder ──
4524
4589
  __factories["./src/graph/builder"] = function(module, exports) {
4525
4590
  'use strict';
@@ -5291,7 +5356,7 @@ __factories["./src/mcp/server"] = function(module, exports) {
5291
5356
 
5292
5357
  const SERVER_INFO = {
5293
5358
  name: 'sigmap',
5294
- version: '6.0.0',
5359
+ version: '6.0.1',
5295
5360
  description: 'SigMap MCP server — code signatures on demand',
5296
5361
  };
5297
5362
 
@@ -7009,7 +7074,7 @@ const path = require('path');
7009
7074
  const os = require('os');
7010
7075
  const { execSync } = require('child_process');
7011
7076
 
7012
- const VERSION = '6.0.0';
7077
+ const VERSION = '6.0.1';
7013
7078
  const MARKER = '\n\n## Auto-generated signatures\n<!-- Updated by gen-context.js -->\n';
7014
7079
 
7015
7080
  function requireSourceOrBundled(key) {
@@ -8844,10 +8909,30 @@ function main() {
8844
8909
  }
8845
8910
 
8846
8911
  const invokedFrom = process.cwd();
8847
- const cwd = resolveProjectRoot(invokedFrom);
8912
+
8913
+ // --cwd <dir>: restrict scanning to that directory instead of the project root
8914
+ const cwdFlagIdx = args.indexOf('--cwd');
8915
+ const cwdFlag = cwdFlagIdx !== -1 ? (args[cwdFlagIdx + 1] || '').trim() : null;
8916
+ if (cwdFlag !== null && (!cwdFlag || cwdFlag.startsWith('--'))) {
8917
+ console.error('[sigmap] --cwd requires a directory path');
8918
+ process.exit(1);
8919
+ }
8920
+ const cwd = cwdFlag
8921
+ ? path.resolve(invokedFrom, cwdFlag)
8922
+ : resolveProjectRoot(invokedFrom);
8848
8923
  const scriptPath = process.argv[1] || path.join(invokedFrom, 'gen-context.js');
8849
8924
 
8850
- if (cwd !== invokedFrom) {
8925
+ if (cwdFlag) {
8926
+ if (!fs.existsSync(cwd)) {
8927
+ console.error(`[sigmap] --cwd directory does not exist: ${cwd}`);
8928
+ process.exit(1);
8929
+ }
8930
+ if (!fs.statSync(cwd).isDirectory()) {
8931
+ console.error(`[sigmap] --cwd must be a directory, not a file: ${cwd}`);
8932
+ process.exit(1);
8933
+ }
8934
+ console.warn(`[sigmap] --cwd: restricting scan to ${cwd}`);
8935
+ } else if (cwd !== invokedFrom) {
8851
8936
  console.warn(`[sigmap] using project root: ${cwd}`);
8852
8937
  }
8853
8938
 
@@ -8870,6 +8955,11 @@ function main() {
8870
8955
 
8871
8956
  const config = loadConfig(cwd);
8872
8957
 
8958
+ // --cwd restricts scanning: override srcDirs so only the given directory is scanned
8959
+ if (cwdFlag) {
8960
+ config.srcDirs = ['.'];
8961
+ }
8962
+
8873
8963
  // ── --output <file> — parse early so every subsequent block can use it ─────
8874
8964
  // Resolves the custom output path and merges it into config.customOutput.
8875
8965
  // Also persists the resolved relative path to gen-context.config.json so
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sigmap",
3
- "version": "6.0.0",
3
+ "version": "6.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
  "exports": {
@@ -14,19 +14,19 @@
14
14
 
15
15
  const path = require('path');
16
16
  const fs = require('fs');
17
- const openai = require('./openai');
18
17
 
19
18
  const name = 'codex';
20
19
  const MARKER = '\n\n## Auto-generated signatures\n<!-- Updated by gen-context.js -->\n';
21
20
 
22
21
  /**
23
- * Format context using the OpenAI adapter format.
22
+ * Format context for AGENTS.md clean markdown, no LLM preamble.
24
23
  * @param {string} context - Raw signature context string
25
24
  * @param {object} [opts]
26
25
  * @returns {string}
27
26
  */
28
27
  function format(context, opts = {}) {
29
- return openai.format(context, opts);
28
+ if (!context || typeof context !== 'string' || !context.trim()) return '';
29
+ return `# Code signatures\n\n${context}`;
30
30
  }
31
31
 
32
32
  /**
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sigmap-cli",
3
- "version": "6.0.0",
3
+ "version": "6.0.1",
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": "6.0.0",
3
+ "version": "6.0.1",
4
4
  "description": "SigMap core library — zero-dependency code signature extraction, retrieval, and security scanning",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -146,11 +146,14 @@ function extractInterfaceMembers(block) {
146
146
  return members.slice(0, 8);
147
147
  }
148
148
 
149
+ const _CTRL_KEYWORDS = new Set(['if', 'for', 'while', 'switch', 'do', 'try', 'catch', 'finally', 'else', 'return']);
150
+
149
151
  function extractClassMembers(block) {
150
152
  const members = [];
151
- // Public methods (skip private/protected/_ prefixed)
153
+ // Public methods (skip private/protected/_ prefixed and control-flow keywords)
152
154
  const methodRe = /^\s+(?:public\s+|static\s+|async\s+|override\s+)*(\w+)\s*(?:<[^(]*>)?\s*\(([^)]*)\)(?:\s*:\s*[^{;]+)?\s*\{/gm;
153
155
  for (const m of block.matchAll(methodRe)) {
156
+ if (_CTRL_KEYWORDS.has(m[1])) continue;
154
157
  if (/^(private|protected|_)/.test(m[1])) continue;
155
158
  if (m[1] === 'constructor') { members.push(`constructor(${normalizeParams(m[2])})`); continue; }
156
159
  const isAsync = m[0].includes('async ') ? 'async ' : '';
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: '6.0.0',
21
+ version: '6.0.1',
22
22
  description: 'SigMap MCP server — code signatures on demand',
23
23
  };
24
24