sigmap 6.0.1 → 6.0.2

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
@@ -11,19 +11,9 @@ Use this marker block for all appendable context files:
11
11
  ```
12
12
  ## Auto-generated signatures
13
13
  <!-- Updated by gen-context.js -->
14
- You are a coding assistant with full knowledge of this codebase.
15
- Below are the code signatures extracted by SigMap v6.0.1 on 2026-04-21T10:54:32.005Z.
16
-
17
- Use these signatures to answer questions about the code accurately.
18
-
19
- ## Code Signatures
20
-
21
- <!-- Generated by SigMap gen-context.js v6.0.1 -->
22
- <!-- DO NOT EDIT below the marker line — run gen-context.js to regenerate -->
23
-
24
14
  # Code signatures
25
15
 
26
- ## changes (last 5 commits — 11 minutes ago)
16
+ ## changes (last 5 commits — 3 minutes ago)
27
17
  ```
28
18
  src/extractors/typescript.js ~extractInterfaceMembers ~extractClassMembers
29
19
  packages/adapters/codex.js ~format
@@ -610,14 +600,6 @@ function coverageScore(cwd, fileEntries, config)
610
600
  function _walk(dir, excludeSet, out)
611
601
  ```
612
602
 
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
603
  ### src/cache/sig-cache.js
622
604
  ```
623
605
  module.exports = { loadCache, saveCache, getChangedFiles, updateCacheEntries }
@@ -628,16 +610,6 @@ function getChangedFiles(files, cache) → { changed: string[], unch
628
610
  function updateCacheEntries(cache, extracted)
629
611
  ```
630
612
 
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
613
  ### src/mcp/handlers.js
642
614
  ```
643
615
  module.exports = { readContext, searchSignatures, getMap, createCheckpoint, getRouting, explainFile, listModules, queryContext, getImpact }
@@ -664,6 +636,24 @@ function formatRankJSON(results, query) → object
664
636
  function detectIntent(query)
665
637
  ```
666
638
 
639
+ ### src/tracking/logger.js
640
+ ```
641
+ module.exports = { logRun, readLog, summarize }
642
+ function logRun(entry, cwd)
643
+ function readLog(cwd) → object[]
644
+ function summarize(entries) → object
645
+ ```
646
+
647
+ ### src/extractors/typescript.js
648
+ ```
649
+ module.exports = { extract }
650
+ function extract(src) → string[]
651
+ function extractBlock(src, startIndex)
652
+ function extractInterfaceMembers(block)
653
+ function extractClassMembers(block)
654
+ function normalizeParams(params)
655
+ ```
656
+
667
657
  ### src/mcp/server.js
668
658
  ```
669
659
  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.2] — 2026-04-21
14
+
15
+ ### Fixed
16
+
17
+ - **Duplicate adapter headers (#104, #96)** — `writeOutputs()` now strips the `formatOutput()` preamble (`<!-- Generated... -->` + `# Code signatures`) before passing content to adapters, preventing double headers on every run. Introduces `stripFormatHeader()` helper applied to all adapter paths including `writeClaude()`.
18
+ - **Bundled codex factory (#96)** — the inline `__factories["./packages/adapters/codex"]` in `gen-context.js` was still delegating to `openai.format()` after the source-file fix in v6.0.1. Now uses clean `# Code signatures\n\n` + context, matching the source adapter.
19
+
20
+ ---
21
+
13
22
  ## [6.0.1] — 2026-04-21
14
23
 
15
24
  ### Fixed
package/gen-context.js CHANGED
@@ -5356,7 +5356,7 @@ __factories["./src/mcp/server"] = function(module, exports) {
5356
5356
 
5357
5357
  const SERVER_INFO = {
5358
5358
  name: 'sigmap',
5359
- version: '6.0.1',
5359
+ version: '6.0.2',
5360
5360
  description: 'SigMap MCP server — code signatures on demand',
5361
5361
  };
5362
5362
 
@@ -6866,11 +6866,11 @@ __factories["./packages/adapters/gemini"] = function(module, exports) {
6866
6866
  __factories["./packages/adapters/codex"] = function(module, exports) {
6867
6867
  const path = require('path');
6868
6868
  const fs = require('fs');
6869
- const openai = __require('./packages/adapters/openai');
6870
6869
  const name = 'codex';
6871
6870
  const CODEX_MARKER = '\n\n## Auto-generated signatures\n<!-- Updated by gen-context.js -->\n';
6872
6871
  function format(context, opts = {}) {
6873
- return openai.format(context, opts);
6872
+ if (!context || typeof context !== 'string' || !context.trim()) return '';
6873
+ return '# Code signatures\n\n' + context;
6874
6874
  }
6875
6875
  function outputPath(cwd) { return path.join(cwd, 'AGENTS.md'); }
6876
6876
  function write(context, cwd, opts = {}) {
@@ -7074,7 +7074,7 @@ const path = require('path');
7074
7074
  const os = require('os');
7075
7075
  const { execSync } = require('child_process');
7076
7076
 
7077
- const VERSION = '6.0.1';
7077
+ const VERSION = '6.0.2';
7078
7078
  const MARKER = '\n\n## Auto-generated signatures\n<!-- Updated by gen-context.js -->\n';
7079
7079
 
7080
7080
  function requireSourceOrBundled(key) {
@@ -7762,13 +7762,17 @@ function writeOutputs(content, targets, cwd, config) {
7762
7762
  if (ADAPTER_TARGETS.has(target)) {
7763
7763
  try {
7764
7764
  const adapterMod = __require('./packages/adapters/' + target);
7765
+ // Adapters add their own header via format() — strip the formatOutput() header
7766
+ // so the content body (## src, ## deps, etc.) is passed without a pre-existing
7767
+ // header, preventing duplicate "# Code signatures" blocks on every run.
7768
+ const adapterContent = stripFormatHeader(content);
7765
7769
  // copilot: honour config.output custom path (redirects away from default .github/copilot-instructions.md)
7766
7770
  if (target === 'copilot') {
7767
7771
  const outPath = resolveAdapterPath('copilot', cwd, config);
7768
7772
  const defaultPath = path.join(cwd, '.github', 'copilot-instructions.md');
7769
7773
  if (outPath !== defaultPath) {
7770
7774
  // custom path: format and write directly (no append logic)
7771
- const formatted = adapterMod.format(content, { version: VERSION });
7775
+ const formatted = adapterMod.format(adapterContent, { version: VERSION });
7772
7776
  ensureDir(outPath);
7773
7777
  fs.writeFileSync(outPath, formatted, 'utf8');
7774
7778
  console.warn(`[sigmap] wrote ${path.relative(cwd, outPath)}`);
@@ -7776,11 +7780,11 @@ function writeOutputs(content, targets, cwd, config) {
7776
7780
  }
7777
7781
  }
7778
7782
  if (typeof adapterMod.write === 'function') {
7779
- adapterMod.write(content, cwd, { version: VERSION });
7783
+ adapterMod.write(adapterContent, cwd, { version: VERSION });
7780
7784
  const outPath = adapterMod.outputPath(cwd);
7781
7785
  console.warn(`[sigmap] wrote ${path.relative(cwd, outPath)} (appended signatures)`);
7782
7786
  } else {
7783
- const formatted = adapterMod.format(content, { version: VERSION });
7787
+ const formatted = adapterMod.format(adapterContent, { version: VERSION });
7784
7788
  const outPath = adapterMod.outputPath(cwd);
7785
7789
  ensureDir(outPath);
7786
7790
  fs.writeFileSync(outPath, formatted, 'utf8');
@@ -7802,18 +7806,36 @@ function writeOutputs(content, targets, cwd, config) {
7802
7806
  }
7803
7807
  }
7804
7808
 
7809
+ // Strip the formatOutput() header block before passing content to adapters.
7810
+ // formatOutput() prepends "<!-- Generated... -->\n\n# Code signatures\n\n" which
7811
+ // is the raw-file header. Adapters add their own header via format(), so passing
7812
+ // pre-headered content produces duplicate headers on every run.
7813
+ function stripFormatHeader(content) {
7814
+ if (!content || typeof content !== 'string') return content;
7815
+ // Header ends after "# Code signatures\n\n" (with blank line)
7816
+ const marker = '\n# Code signatures\n';
7817
+ const idx = content.indexOf(marker);
7818
+ if (idx === -1) return content;
7819
+ // Skip past the marker line and one blank line
7820
+ const afterMarker = content.slice(idx + marker.length);
7821
+ return afterMarker.startsWith('\n') ? afterMarker.slice(1) : afterMarker;
7822
+ }
7823
+
7805
7824
  function writeClaude(content, cwd) {
7806
7825
  const claudePath = path.join(cwd, 'CLAUDE.md');
7807
7826
  let existing = '';
7808
7827
  if (fs.existsSync(claudePath)) {
7809
7828
  existing = fs.readFileSync(claudePath, 'utf8');
7810
7829
  }
7830
+ // Strip the formatOutput() header — CLAUDE.md gets its own header via the MARKER
7831
+ const body = stripFormatHeader(content);
7832
+ const sigHeader = '# Code signatures\n\n';
7811
7833
  const markerIdx = existing.indexOf('## Auto-generated signatures');
7812
7834
  let newContent;
7813
7835
  if (markerIdx !== -1) {
7814
- newContent = existing.slice(0, markerIdx) + MARKER.trimStart() + content;
7836
+ newContent = existing.slice(0, markerIdx) + MARKER.trimStart() + sigHeader + body;
7815
7837
  } else {
7816
- newContent = existing + MARKER + content;
7838
+ newContent = existing + MARKER + sigHeader + body;
7817
7839
  }
7818
7840
  fs.writeFileSync(claudePath, newContent, 'utf8');
7819
7841
  console.warn(`[sigmap] wrote CLAUDE.md (appended signatures)`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sigmap",
3
- "version": "6.0.1",
3
+ "version": "6.0.2",
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": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sigmap-cli",
3
- "version": "6.0.1",
3
+ "version": "6.0.2",
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.1",
3
+ "version": "6.0.2",
4
4
  "description": "SigMap core library — zero-dependency code signature extraction, retrieval, and security scanning",
5
5
  "main": "index.js",
6
6
  "keywords": [
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.1',
21
+ version: '6.0.2',
22
22
  description: 'SigMap MCP server — code signatures on demand',
23
23
  };
24
24