sigmap 6.5.0 → 6.5.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
@@ -47,6 +47,26 @@ Use this marker block for all appendable context files:
47
47
  <!-- Updated by gen-context.js -->
48
48
  # Code signatures
49
49
 
50
+ ## SigMap commands
51
+
52
+ | When | Command |
53
+ |------|---------|
54
+ | Before answering a question | `sigmap ask "<your question>"` |
55
+ | After code changes | `sigmap validate` |
56
+ | To query by topic | `sigmap --query "<topic>"` |
57
+
58
+ Always run `sigmap ask` or `sigmap --query` before searching for files relevant to a task.
59
+ ## changes (last 5 commits — 2 days ago)
60
+ ```
61
+ src/config/loader.js +_legacyDetectAutoSrcDirs ~detectAutoSrcDirs
62
+ src/discovery/source-root-resolver.js +resolveSourceRoots +_detectMonorepo +_enumerateCandidates +_applySpecialRules
63
+ src/discovery/language-detector.js +detectLanguages +_walkDepth
64
+ src/discovery/source-root-scorer.js +getRecentlyChangedDirs +scoreCandidate +_countSourceFiles
65
+ src/discovery/framework-detector.js +detectFrameworks +_readDeps +_readFile +_existsAnywhere
66
+ src/discovery/sigmapignore.js +loadIgnorePatterns +matchesIgnorePattern
67
+ src/retrieval/ranker.js +_computePenalty ~scoreFile ~rank ~buildSigIndex
68
+ ```
69
+
50
70
  ## packages
51
71
 
52
72
  ### packages/cli/index.js
@@ -104,15 +124,7 @@ function score(cwd) → { * score: number, * grad
104
124
  function adapt(context, adapterName, opts = {}) → string
105
125
  ```
106
126
 
107
- ### packages/adapters/codex.js
108
- ```
109
- module.exports = { name, format, outputPath, write }
110
- function format(context, opts = {}) → string
111
- function outputPath(cwd) → string
112
- function write(context, cwd, opts = {})
113
- ```
114
-
115
- ### packages/adapters/claude.js
127
+ ### packages/adapters/copilot.js
116
128
  ```
117
129
  module.exports = { name, format, outputPath, write }
118
130
  function format(context, opts = {}) → string
@@ -121,13 +133,12 @@ function outputPath(cwd) → string
121
133
  function write(context, cwd, opts = {})
122
134
  ```
123
135
 
124
- ### packages/adapters/copilot.js
136
+ ### packages/adapters/cursor.js
125
137
  ```
126
- module.exports = { name, format, outputPath, write }
138
+ module.exports = { name, format, outputPath }
127
139
  function format(context, opts = {}) → string
128
140
  function _confidenceMeta(opts)
129
141
  function outputPath(cwd) → string
130
- function write(context, cwd, opts = {})
131
142
  ```
132
143
 
133
144
  ### packages/adapters/gemini.js
@@ -139,14 +150,6 @@ function write(context, cwd, opts = {})
139
150
  function _confidenceMeta(opts)
140
151
  ```
141
152
 
142
- ### packages/adapters/cursor.js
143
- ```
144
- module.exports = { name, format, outputPath }
145
- function format(context, opts = {}) → string
146
- function _confidenceMeta(opts)
147
- function outputPath(cwd) → string
148
- ```
149
-
150
153
  ### packages/adapters/openai.js
151
154
  ```
152
155
  module.exports = { name, format, outputPath }
@@ -163,74 +166,24 @@ function _confidenceMeta(opts)
163
166
  function outputPath(cwd) → string
164
167
  ```
165
168
 
166
- ## src
167
-
168
- ### src/security/patterns.js
169
- ```
170
- module.exports = { PATTERNS }
171
- ```
172
-
173
- ### src/security/scanner.js
174
- ```
175
- module.exports = { scan }
176
- function scan(signatures, filePath) → { safe: string[], redacte
177
- ```
178
-
179
- ### src/extractors/cpp.js
180
- ```
181
- module.exports = { extract }
182
- function extract(src) → string[]
183
- function extractBlock(src, startIndex)
184
- function extractMembers(block)
185
- function normalizeParams(params)
186
- function normalizeType(type)
187
- ```
188
-
189
- ### src/extractors/csharp.js
190
- ```
191
- module.exports = { extract }
192
- function extract(src) → string[]
193
- function extractBlock(src, startIndex)
194
- function extractMembers(block)
195
- function normalizeParams(params)
196
- function normalizeType(type)
197
- ```
198
-
199
- ### src/extractors/dart.js
200
- ```
201
- module.exports = { extract }
202
- function extract(src) → string[]
203
- function extractBlock(src, startIndex)
204
- function extractMembers(block)
205
- function normalizeParams(params)
206
- ```
207
-
208
- ### src/extractors/deps.js
169
+ ### packages/adapters/claude.js
209
170
  ```
210
- module.exports = { extractPythonDeps, extractTSDeps, buildReverseDepMap }
211
- function extractPythonDeps(src) → string[]
212
- function extractTSDeps(src) → string[]
213
- function buildReverseDepMap(forwardMap) → Map<string, string[]>
171
+ module.exports = { name, format, outputPath, write }
172
+ function format(context, opts = {}) → string
173
+ function _confidenceMeta(opts)
174
+ function outputPath(cwd) → string
175
+ function write(context, cwd, opts = {})
214
176
  ```
215
177
 
216
- ### src/extractors/go.js
178
+ ### packages/adapters/codex.js
217
179
  ```
218
- module.exports = { extract }
219
- function extract(src) → string[]
220
- function extractBlock(src, startIndex)
221
- function extractInterfaceMethods(block)
222
- function normalizeParams(params)
180
+ module.exports = { name, format, outputPath, write }
181
+ function format(context, opts = {}) → string
182
+ function outputPath(cwd) → string
183
+ function write(context, cwd, opts = {})
223
184
  ```
224
185
 
225
- ### src/extractors/java.js
226
- ```
227
- module.exports = { extract }
228
- function extract(src) → string[]
229
- function extractBlock(src, startIndex)
230
- function extractMembers(block)
231
- function normalizeParams(params)
232
- function normalizeType(type)
233
- ```
186
+ ## src
234
187
 
235
188
  ### src/extractors/javascript.js
236
189
  ```
@@ -530,11 +483,6 @@ function formatAnalysisTable(stats, showSlow) → string
530
483
  function formatAnalysisJSON(stats) → object
531
484
  ```
532
485
 
533
- ### src/config/defaults.js
534
- ```
535
- module.exports = { DEFAULTS }
536
- ```
537
-
538
486
  ### src/format/dashboard.js
539
487
  ```
540
488
  module.exports = { generateDashboardHtml, renderHistoryCharts, computeExtractorCoverage, percentile, overBudgetStreak }
@@ -622,18 +570,6 @@ function queryContext(args, cwd)
622
570
  function getImpact(args, cwd)
623
571
  ```
624
572
 
625
- ### src/retrieval/ranker.js
626
- ```
627
- module.exports = { rank, buildSigIndex, scoreFile, formatRankTable, formatRankJSON, DEFAULT_WEIGHTS, detectIntent }
628
- function scoreFile(filePath, sigs, queryTokens, weights) → number
629
- function rank(query, sigIndex, opts) → { file: string, score: nu
630
- function _parseContextFile(contextPath) → Map<string, string[]>
631
- function buildSigIndex(cwd, opts) → Map<string, string[]>
632
- function formatRankTable(results, query) → string
633
- function formatRankJSON(results, query) → object
634
- function detectIntent(query)
635
- ```
636
-
637
573
  ### src/tracking/logger.js
638
574
  ```
639
575
  module.exports = { logRun, readLog, summarize }
@@ -652,15 +588,6 @@ function extractClassMembers(block)
652
588
  function normalizeParams(params)
653
589
  ```
654
590
 
655
- ### src/config/loader.js
656
- ```
657
- module.exports = { loadConfig, loadBaseConfig }
658
- function loadBaseConfig(extendsVal, cwd)
659
- function detectAutoSrcDirs(cwd, excludeList) → string[]
660
- function loadConfig(cwd) → object
661
- function deepClone(obj)
662
- ```
663
-
664
591
  ### src/learning/weights.js
665
592
  ```
666
593
  module.exports = { BASELINE, DECAY, MAX_MULT, MIN_MULT, weightsPath, clampMultiplier, normalizeFile, loadWeights, saveWeights, updateWeights, boostFiles, penalizeFiles, resetWeights, exportWeights, importWeights }
@@ -678,6 +605,84 @@ function exportWeights(cwd, outputPath)
678
605
  function importWeights(cwd, importPath, replace)
679
606
  ```
680
607
 
608
+ ### src/config/defaults.js
609
+ ```
610
+ module.exports = { DEFAULTS }
611
+ ```
612
+
613
+ ### src/config/loader.js
614
+ ```
615
+ module.exports = { loadConfig, loadBaseConfig }
616
+ function loadBaseConfig(extendsVal, cwd)
617
+ function detectAutoSrcDirs(cwd, excludeList) → string[]
618
+ function _legacyDetectAutoSrcDirs(cwd, excludeList) → string[]
619
+ function loadConfig(cwd) → object
620
+ function deepClone(obj)
621
+ ```
622
+
623
+ ### src/discovery/source-root-registry.js
624
+ ```
625
+ module.exports = { REGISTRY }
626
+ ```
627
+
628
+ ### src/discovery/source-root-resolver.js
629
+ ```
630
+ module.exports = { resolveSourceRoots }
631
+ function resolveSourceRoots(cwd, opts = {})
632
+ function _detectMonorepo(cwd)
633
+ function _enumerateCandidates(cwd, isMonorepo, ignorePatterns, excludeList)
634
+ function _applySpecialRules(scored, cwd, primaryFw, fwEntry, frameworks)
635
+ function _dedupeNested(scored)
636
+ function _computeConfidence(frameworks, languages, scoredCount)
637
+ ```
638
+
639
+ ### src/discovery/language-detector.js
640
+ ```
641
+ module.exports = { detectLanguages }
642
+ function detectLanguages(cwd)
643
+ function _walkDepth(dir, depth, extCount)
644
+ ```
645
+
646
+ ### src/discovery/source-root-scorer.js
647
+ ```
648
+ module.exports = { scoreCandidate, getRecentlyChangedDirs, ROOT_ENTRYPOINTS }
649
+ function getRecentlyChangedDirs(cwd)
650
+ function scoreCandidate(dirName, fullPath, context)
651
+ function _countSourceFiles(dir, depth)
652
+ ```
653
+
654
+ ### src/discovery/framework-detector.js
655
+ ```
656
+ module.exports = { detectFrameworks }
657
+ function detectFrameworks(cwd)
658
+ function _readDeps(cwd)
659
+ function _readFile(p)
660
+ function _existsAnywhere(cwd, filename, maxDepth)
661
+ function _walkFind(dir, name, depth)
662
+ ```
663
+
664
+ ### src/discovery/sigmapignore.js
665
+ ```
666
+ module.exports = { loadIgnorePatterns, matchesIgnorePattern }
667
+ function loadIgnorePatterns(cwd)
668
+ function matchesIgnorePattern(dirName, patterns)
669
+ ```
670
+
671
+ ### src/retrieval/ranker.js
672
+ ```
673
+ module.exports = { rank, buildSigIndex, scoreFile, formatRankTable, formatRankJSON, DEFAULT_WEIGHTS, GRAPH_BOOST_AMOUNTS, detectIntent }
674
+ function _computePenalty(filePath)
675
+ function _computeHubs(graph)
676
+ function _isHub(filePath)
677
+ function scoreFile(filePath, sigs, queryTokens, weights) → { score: number, signals:
678
+ function rank(query, sigIndex, opts) → { file: string, score: nu
679
+ function _parseContextFile(contextPath) → Map<string, string[]>
680
+ function buildSigIndex(cwd, opts) → Map<string, string[]>
681
+ function formatRankTable(results, query) → string
682
+ function formatRankJSON(results, query) → object
683
+ function detectIntent(query)
684
+ ```
685
+
681
686
  ### src/mcp/server.js
682
687
  ```
683
688
  module.exports = { start }
package/CHANGELOG.md CHANGED
@@ -10,6 +10,32 @@ Format: [Semantic Versioning](https://semver.org/)
10
10
 
11
11
  ---
12
12
 
13
+ ## [6.5.2] — 2026-04-27
14
+
15
+ ### Added
16
+
17
+ - **2-hop graph boost with decay** — `rank()` now traverses 2 hops in the dependency graph instead of 1. Direct imports (+0.40) and second-order imports (+0.15 with decay) receive score boosts for better context relevance in multi-layer dependency scenarios.
18
+ - **Hub suppression** — shared utility files (detected by >20% fanout threshold or static patterns like `util/`, `helper/`, `common/`) are now excluded from graph boosts to prevent over-boosting generic utilities.
19
+ - **Incremental signature cache (`sigCache`)** — new opt-in `sigCache: true` config key enables mtime-based caching of extracted signatures. Cache is automatically busted on version changes, and unchanged files skip re-extraction for faster subsequent runs.
20
+ - **Cache health statistics** — `--health` output now includes cache stats: entry count and disk size in KB. `--health --json` includes `cacheStats` field with `entries` and `sizeKb` when cache exists.
21
+
22
+ ---
23
+
24
+ ## [6.5.1] — 2026-04-25
25
+
26
+ ### Added
27
+
28
+ - **Retrieval explain** — `rank()` and `scoreFile()` now return detailed signal breakdown (exactToken, symbolMatch, prefixMatch, pathMatch, penalty) for transparency in ranking decisions
29
+ - **7-intent ranking** — expanded intent detection from 4 to 7 patterns (debug, explain, refactor, review, test, integrate, navigate). Each intent applies tuned weights to prioritize relevant signals.
30
+ - **Negative-signal penalty layer** — formalized penalties for test files (0.4x), generated code (0.3x), documentation (0.2x), and node_modules (0.0x) to deprioritize non-source content
31
+
32
+ ### Changed
33
+
34
+ - `formatRankTable` now shows penalty column and signals breakdown for top 3 results
35
+ - `formatRankJSON` now includes `intent` and `signals` fields in output for API consumers
36
+
37
+ ---
38
+
13
39
  ## [6.5.0] — 2026-04-25
14
40
 
15
41
  ### Added
package/README.md CHANGED
@@ -38,7 +38,7 @@ Works with Copilot, Claude, Cursor, Windsurf, and any LLM.
38
38
 
39
39
  ## Why SigMap?
40
40
 
41
- - **78.9% hit@5** — right file found in top 5 results (vs 13.6% baseline)
41
+ - **81.1% hit@5** — right file found in top 5 results (vs 13.6% baseline)
42
42
  - **40–98% token reduction** — 2K–4K tokens instead of 80K+
43
43
  - **52.2% task success rate** — up from 10% without context
44
44
  - **1.69 prompts per task** — down from 2.84
@@ -51,7 +51,7 @@ Works with Copilot, Claude, Cursor, Windsurf, and any LLM.
51
51
 
52
52
  | Without SigMap | With SigMap |
53
53
  |---|---|
54
- | ❌ Guessing which files are relevant | ✅ Right file in context — 79% of the time |
54
+ | ❌ Guessing which files are relevant | ✅ Right file in context — 81% of the time |
55
55
  | ❌ Sending the full repo to your AI | ✅ Minimal context — only what matters |
56
56
  | ❌ Embeddings / vector DB required | ✅ Grounded answers, no infra needed |
57
57
 
@@ -75,11 +75,11 @@ Ask → Rank → Context → Validate → Judge → Learn
75
75
  ## Benchmark
76
76
 
77
77
  ```
78
- Benchmark : sigmap-v6.4-main
79
- Date : 2026-04-23
78
+ Benchmark : sigmap-v6.5-main
79
+ Date : 2026-04-25
80
80
 
81
- Hit@5 : 78.9% (baseline 13.6% — 5.8× lift)
82
- Prompt reduction : 40.6%
81
+ Hit@5 : 81.1% (baseline 13.6% — 6.0× lift)
82
+ Prompt reduction : 41.4%
83
83
  Task success : 52.2% (baseline 10%)
84
84
  Prompts / task : 1.69 (baseline 2.84)
85
85
  Token reduction: 40–98% (avg 96.9% across 18 real repos)