sigmap 5.4.0 → 5.6.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/AGENTS.md +321 -346
- package/CHANGELOG.md +35 -0
- package/README.md +10 -6
- package/gen-context.js +462 -7
- package/package.json +1 -1
- package/packages/cli/package.json +1 -1
- package/packages/core/package.json +1 -1
- package/src/analysis/coverage-score.js +27 -7
- package/src/mcp/server.js +1 -1
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* SigMap coverage scorer —
|
|
4
|
+
* SigMap coverage scorer — v5.5.0
|
|
5
|
+
*
|
|
6
|
+
* Measures what fraction of *code* files made it into the context output
|
|
7
|
+
* after token-budget application. Non-code files (json, md, config) are
|
|
8
|
+
* counted separately as `nonCodeSkipped` so the grade reflects real coverage.
|
|
5
9
|
*
|
|
6
|
-
* Measures what fraction of source files made it into the context output
|
|
7
|
-
* after token-budget application. This is complementary to the health score:
|
|
8
10
|
* - Health score = context freshness / reduction quality / budget compliance
|
|
9
11
|
* - Coverage score = how much of the codebase is represented in context
|
|
10
12
|
*
|
|
@@ -19,10 +21,23 @@
|
|
|
19
21
|
* total: number,
|
|
20
22
|
* included: number,
|
|
21
23
|
* dropped: number,
|
|
24
|
+
* nonCodeSkipped: number,
|
|
22
25
|
* confidence: 'HIGH'|'MEDIUM'|'LOW',
|
|
23
26
|
* perModule: Map<string, {total:number, included:number, pct:number}>,
|
|
24
27
|
* }}
|
|
25
28
|
*/
|
|
29
|
+
|
|
30
|
+
const CODE_EXTS = new Set([
|
|
31
|
+
'.js', '.mjs', '.cjs', '.ts', '.tsx', '.jsx',
|
|
32
|
+
'.py', '.rb', '.go', '.rs', '.java', '.kt',
|
|
33
|
+
'.cs', '.cpp', '.c', '.h', '.hpp',
|
|
34
|
+
'.swift', '.dart', '.scala', '.php',
|
|
35
|
+
'.vue', '.svelte', '.css', '.scss',
|
|
36
|
+
'.sql', '.graphql', '.proto', '.tf',
|
|
37
|
+
'.lua', '.r', '.jl', '.ex', '.exs',
|
|
38
|
+
'.sh', '.bash', '.zsh', '.ps1',
|
|
39
|
+
]);
|
|
40
|
+
|
|
26
41
|
function coverageScore(cwd, fileEntries, config) {
|
|
27
42
|
const fs = require('fs');
|
|
28
43
|
const path = require('path');
|
|
@@ -41,12 +56,17 @@ function coverageScore(cwd, fileEntries, config) {
|
|
|
41
56
|
|
|
42
57
|
const includedSet = new Set((fileEntries || []).map(f => f.filePath));
|
|
43
58
|
|
|
44
|
-
// Walk
|
|
59
|
+
// Walk srcDirs: separate code files from non-code files
|
|
60
|
+
const allFiles = [];
|
|
45
61
|
const allSource = [];
|
|
46
62
|
for (const relDir of srcDirs) {
|
|
47
63
|
const absDir = path.resolve(cwd, relDir);
|
|
48
|
-
if (fs.existsSync(absDir)) _walk(absDir, excludeSet,
|
|
64
|
+
if (fs.existsSync(absDir)) _walk(absDir, excludeSet, allFiles);
|
|
65
|
+
}
|
|
66
|
+
for (const f of allFiles) {
|
|
67
|
+
if (CODE_EXTS.has(path.extname(f).toLowerCase())) allSource.push(f);
|
|
49
68
|
}
|
|
69
|
+
const nonCodeSkipped = allFiles.length - allSource.length;
|
|
50
70
|
|
|
51
71
|
const total = allSource.length;
|
|
52
72
|
const included = allSource.filter(f => includedSet.has(f)).length;
|
|
@@ -66,7 +86,7 @@ function coverageScore(cwd, fileEntries, config) {
|
|
|
66
86
|
perModule.set(relDir, { total: modFiles.length, included: modIncl, pct: modPct });
|
|
67
87
|
}
|
|
68
88
|
|
|
69
|
-
return { score: pct, grade, total, included, dropped, confidence, perModule };
|
|
89
|
+
return { score: pct, grade, total, included, dropped, nonCodeSkipped, confidence, perModule };
|
|
70
90
|
}
|
|
71
91
|
|
|
72
92
|
function _walk(dir, excludeSet, out) {
|
|
@@ -82,4 +102,4 @@ function _walk(dir, excludeSet, out) {
|
|
|
82
102
|
}
|
|
83
103
|
}
|
|
84
104
|
|
|
85
|
-
module.exports = { coverageScore };
|
|
105
|
+
module.exports = { coverageScore, CODE_EXTS };
|
package/src/mcp/server.js
CHANGED