@vyuhlabs/dxkit 1.6.0 → 2.0.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/CHANGELOG.md +126 -0
- package/README.md +3 -3
- package/dist/agents/extract.d.ts +25 -0
- package/dist/agents/extract.d.ts.map +1 -0
- package/dist/agents/extract.js +186 -0
- package/dist/agents/extract.js.map +1 -0
- package/dist/agents/schemas.d.ts +106 -0
- package/dist/agents/schemas.d.ts.map +1 -0
- package/dist/agents/schemas.js +86 -0
- package/dist/agents/schemas.js.map +1 -0
- package/dist/agents/session.d.ts +28 -0
- package/dist/agents/session.d.ts.map +1 -0
- package/dist/agents/session.js +223 -0
- package/dist/agents/session.js.map +1 -0
- package/dist/analyzers/developer/detailed.js +1 -1
- package/dist/analyzers/developer/detailed.js.map +1 -1
- package/dist/analyzers/dispatcher.d.ts +36 -0
- package/dist/analyzers/dispatcher.d.ts.map +1 -0
- package/dist/analyzers/dispatcher.js +62 -0
- package/dist/analyzers/dispatcher.js.map +1 -0
- package/dist/analyzers/docs/shallow.d.ts +3 -2
- package/dist/analyzers/docs/shallow.d.ts.map +1 -1
- package/dist/analyzers/docs/shallow.js +2 -2
- package/dist/analyzers/docs/shallow.js.map +1 -1
- package/dist/analyzers/dx/shallow.d.ts +3 -2
- package/dist/analyzers/dx/shallow.d.ts.map +1 -1
- package/dist/analyzers/dx/shallow.js +2 -2
- package/dist/analyzers/dx/shallow.js.map +1 -1
- package/dist/analyzers/health/actions.d.ts +3 -3
- package/dist/analyzers/health/actions.d.ts.map +1 -1
- package/dist/analyzers/health/actions.js +99 -52
- package/dist/analyzers/health/actions.js.map +1 -1
- package/dist/analyzers/health/detailed.d.ts.map +1 -1
- package/dist/analyzers/health/detailed.js +6 -2
- package/dist/analyzers/health/detailed.js.map +1 -1
- package/dist/analyzers/health.d.ts +0 -2
- package/dist/analyzers/health.d.ts.map +1 -1
- package/dist/analyzers/health.js +123 -72
- package/dist/analyzers/health.js.map +1 -1
- package/dist/analyzers/maintainability/shallow.d.ts +3 -2
- package/dist/analyzers/maintainability/shallow.d.ts.map +1 -1
- package/dist/analyzers/maintainability/shallow.js +2 -2
- package/dist/analyzers/maintainability/shallow.js.map +1 -1
- package/dist/analyzers/quality/detailed.js +1 -1
- package/dist/analyzers/quality/detailed.js.map +1 -1
- package/dist/analyzers/quality/gather.d.ts +33 -4
- package/dist/analyzers/quality/gather.d.ts.map +1 -1
- package/dist/analyzers/quality/gather.js +81 -93
- package/dist/analyzers/quality/gather.js.map +1 -1
- package/dist/analyzers/quality/index.js +4 -4
- package/dist/analyzers/quality/index.js.map +1 -1
- package/dist/analyzers/quality/shallow.d.ts +3 -2
- package/dist/analyzers/quality/shallow.d.ts.map +1 -1
- package/dist/analyzers/quality/shallow.js +2 -2
- package/dist/analyzers/quality/shallow.js.map +1 -1
- package/dist/analyzers/scoring.d.ts +26 -9
- package/dist/analyzers/scoring.d.ts.map +1 -1
- package/dist/analyzers/scoring.js +83 -71
- package/dist/analyzers/scoring.js.map +1 -1
- package/dist/analyzers/security/detailed.js +1 -1
- package/dist/analyzers/security/detailed.js.map +1 -1
- package/dist/analyzers/security/gather.d.ts +28 -5
- package/dist/analyzers/security/gather.d.ts.map +1 -1
- package/dist/analyzers/security/gather.js +87 -135
- package/dist/analyzers/security/gather.js.map +1 -1
- package/dist/analyzers/security/index.d.ts +1 -1
- package/dist/analyzers/security/index.d.ts.map +1 -1
- package/dist/analyzers/security/index.js +27 -17
- package/dist/analyzers/security/index.js.map +1 -1
- package/dist/analyzers/security/report.d.ts +6 -0
- package/dist/analyzers/security/report.d.ts.map +1 -0
- package/dist/analyzers/security/report.js +118 -0
- package/dist/analyzers/security/report.js.map +1 -0
- package/dist/analyzers/security/shallow.d.ts +3 -2
- package/dist/analyzers/security/shallow.d.ts.map +1 -1
- package/dist/analyzers/security/shallow.js +2 -2
- package/dist/analyzers/security/shallow.js.map +1 -1
- package/dist/analyzers/tests/detailed.js +1 -1
- package/dist/analyzers/tests/detailed.js.map +1 -1
- package/dist/analyzers/tests/import-graph.d.ts +8 -22
- package/dist/analyzers/tests/import-graph.d.ts.map +1 -1
- package/dist/analyzers/tests/import-graph.js +22 -189
- package/dist/analyzers/tests/import-graph.js.map +1 -1
- package/dist/analyzers/tests/index.d.ts +1 -1
- package/dist/analyzers/tests/index.d.ts.map +1 -1
- package/dist/analyzers/tests/index.js +3 -3
- package/dist/analyzers/tests/index.js.map +1 -1
- package/dist/analyzers/tests/shallow.d.ts +3 -2
- package/dist/analyzers/tests/shallow.d.ts.map +1 -1
- package/dist/analyzers/tests/shallow.js +2 -2
- package/dist/analyzers/tests/shallow.js.map +1 -1
- package/dist/analyzers/tools/coverage.d.ts +21 -11
- package/dist/analyzers/tools/coverage.d.ts.map +1 -1
- package/dist/analyzers/tools/coverage.js +32 -44
- package/dist/analyzers/tools/coverage.js.map +1 -1
- package/dist/analyzers/tools/dotnet.d.ts +8 -0
- package/dist/analyzers/tools/dotnet.d.ts.map +1 -0
- package/dist/analyzers/tools/dotnet.js +81 -0
- package/dist/analyzers/tools/dotnet.js.map +1 -0
- package/dist/analyzers/tools/gather-cache.d.ts +16 -0
- package/dist/analyzers/tools/gather-cache.d.ts.map +1 -0
- package/dist/analyzers/tools/gather-cache.js +126 -0
- package/dist/analyzers/tools/gather-cache.js.map +1 -0
- package/dist/analyzers/tools/generic.d.ts.map +1 -1
- package/dist/analyzers/tools/generic.js +6 -28
- package/dist/analyzers/tools/generic.js.map +1 -1
- package/dist/analyzers/tools/gitleaks.d.ts +28 -5
- package/dist/analyzers/tools/gitleaks.d.ts.map +1 -1
- package/dist/analyzers/tools/gitleaks.js +91 -37
- package/dist/analyzers/tools/gitleaks.js.map +1 -1
- package/dist/analyzers/tools/go.d.ts +8 -0
- package/dist/analyzers/tools/go.d.ts.map +1 -0
- package/dist/analyzers/tools/go.js +84 -0
- package/dist/analyzers/tools/go.js.map +1 -0
- package/dist/analyzers/tools/graphify.d.ts +31 -3
- package/dist/analyzers/tools/graphify.d.ts.map +1 -1
- package/dist/analyzers/tools/graphify.js +78 -36
- package/dist/analyzers/tools/graphify.js.map +1 -1
- package/dist/analyzers/tools/grep-secrets.d.ts +6 -0
- package/dist/analyzers/tools/grep-secrets.d.ts.map +1 -0
- package/dist/analyzers/tools/grep-secrets.js +124 -0
- package/dist/analyzers/tools/grep-secrets.js.map +1 -0
- package/dist/analyzers/tools/jscpd.d.ts +40 -0
- package/dist/analyzers/tools/jscpd.d.ts.map +1 -0
- package/dist/analyzers/tools/jscpd.js +96 -0
- package/dist/analyzers/tools/jscpd.js.map +1 -0
- package/dist/analyzers/tools/node.d.ts +8 -0
- package/dist/analyzers/tools/node.d.ts.map +1 -0
- package/dist/analyzers/tools/node.js +160 -0
- package/dist/analyzers/tools/node.js.map +1 -0
- package/dist/analyzers/tools/package-json.d.ts +6 -0
- package/dist/analyzers/tools/package-json.d.ts.map +1 -0
- package/dist/analyzers/tools/package-json.js +67 -0
- package/dist/analyzers/tools/package-json.js.map +1 -0
- package/dist/analyzers/tools/parallel.d.ts +22 -5
- package/dist/analyzers/tools/parallel.d.ts.map +1 -1
- package/dist/analyzers/tools/parallel.js +26 -185
- package/dist/analyzers/tools/parallel.js.map +1 -1
- package/dist/analyzers/tools/paths.d.ts +21 -0
- package/dist/analyzers/tools/paths.d.ts.map +1 -0
- package/dist/analyzers/tools/paths.js +62 -0
- package/dist/analyzers/tools/paths.js.map +1 -0
- package/dist/analyzers/tools/python.d.ts +8 -0
- package/dist/analyzers/tools/python.d.ts.map +1 -0
- package/dist/analyzers/tools/python.js +81 -0
- package/dist/analyzers/tools/python.js.map +1 -0
- package/dist/analyzers/tools/rust.d.ts +8 -0
- package/dist/analyzers/tools/rust.d.ts.map +1 -0
- package/dist/analyzers/tools/rust.js +86 -0
- package/dist/analyzers/tools/rust.js.map +1 -0
- package/dist/analyzers/tools/semgrep.d.ts +39 -0
- package/dist/analyzers/tools/semgrep.d.ts.map +1 -0
- package/dist/analyzers/tools/semgrep.js +129 -0
- package/dist/analyzers/tools/semgrep.js.map +1 -0
- package/dist/analyzers/tools/tool-registry.d.ts +0 -41
- package/dist/analyzers/tools/tool-registry.d.ts.map +1 -1
- package/dist/analyzers/tools/tool-registry.js +0 -87
- package/dist/analyzers/tools/tool-registry.js.map +1 -1
- package/dist/analyzers/types.d.ts +42 -30
- package/dist/analyzers/types.d.ts.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +16 -8
- package/dist/cli.js.map +1 -1
- package/dist/constants.d.ts +1 -3
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +55 -14
- package/dist/constants.js.map +1 -1
- package/dist/languages/capabilities/descriptors.d.ts +74 -0
- package/dist/languages/capabilities/descriptors.d.ts.map +1 -0
- package/dist/languages/capabilities/descriptors.js +250 -0
- package/dist/languages/capabilities/descriptors.js.map +1 -0
- package/dist/languages/capabilities/global.d.ts +43 -0
- package/dist/languages/capabilities/global.d.ts.map +1 -0
- package/dist/languages/capabilities/global.js +48 -0
- package/dist/languages/capabilities/global.js.map +1 -0
- package/dist/languages/capabilities/index.d.ts +31 -0
- package/dist/languages/capabilities/index.d.ts.map +1 -0
- package/dist/languages/capabilities/index.js +56 -0
- package/dist/languages/capabilities/index.js.map +1 -0
- package/dist/languages/capabilities/provider.d.ts +16 -0
- package/dist/languages/capabilities/provider.d.ts.map +1 -0
- package/dist/languages/capabilities/provider.js +12 -0
- package/dist/languages/capabilities/provider.js.map +1 -0
- package/dist/languages/capabilities/types.d.ts +226 -0
- package/dist/languages/capabilities/types.d.ts.map +1 -0
- package/dist/languages/capabilities/types.js +23 -0
- package/dist/languages/capabilities/types.js.map +1 -0
- package/dist/languages/csharp.d.ts +8 -0
- package/dist/languages/csharp.d.ts.map +1 -1
- package/dist/languages/csharp.js +203 -103
- package/dist/languages/csharp.js.map +1 -1
- package/dist/languages/go.d.ts +13 -7
- package/dist/languages/go.d.ts.map +1 -1
- package/dist/languages/go.js +277 -183
- package/dist/languages/go.js.map +1 -1
- package/dist/languages/python.d.ts +14 -0
- package/dist/languages/python.d.ts.map +1 -1
- package/dist/languages/python.js +276 -169
- package/dist/languages/python.js.map +1 -1
- package/dist/languages/rust.d.ts +8 -0
- package/dist/languages/rust.d.ts.map +1 -1
- package/dist/languages/rust.js +218 -131
- package/dist/languages/rust.js.map +1 -1
- package/dist/languages/types.d.ts +16 -15
- package/dist/languages/types.d.ts.map +1 -1
- package/dist/languages/typescript.d.ts +12 -11
- package/dist/languages/typescript.d.ts.map +1 -1
- package/dist/languages/typescript.js +256 -161
- package/dist/languages/typescript.js.map +1 -1
- package/package.json +1 -1
- package/templates/.ai/templates/session-checkpoint-template.md +97 -0
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Capability descriptors.
|
|
4
|
+
*
|
|
5
|
+
* Each capability the dispatcher knows about has one descriptor. The
|
|
6
|
+
* descriptor bundles the capability's stable id with its aggregate
|
|
7
|
+
* function — how to combine multiple providers' results into one
|
|
8
|
+
* envelope. Aggregation is bespoke per capability rather than a generic
|
|
9
|
+
* 'sum' / 'append' / 'last' strategy because the merge semantics
|
|
10
|
+
* legitimately differ (depVulns sums counts AND concats findings AND
|
|
11
|
+
* joins tool names AND prefers any provider that did osv enrichment),
|
|
12
|
+
* and a 5-strategy enum would lie about that.
|
|
13
|
+
*
|
|
14
|
+
* The dispatcher never calls aggregate() with an empty array — that
|
|
15
|
+
* case is handled upstream by returning null.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.CAPABILITY_REGISTRY = exports.GLOBAL_REGISTRY = exports.PER_PACK_REGISTRY = exports.IMPORTS = exports.STRUCTURAL = exports.DUPLICATION = exports.CODE_PATTERNS = exports.SECRETS = exports.TEST_FRAMEWORK = exports.COVERAGE = exports.LINT = exports.DEP_VULNS = void 0;
|
|
19
|
+
function uniqueJoin(values, sep = ', ') {
|
|
20
|
+
const seen = new Set();
|
|
21
|
+
for (const v of values)
|
|
22
|
+
seen.add(v);
|
|
23
|
+
return [...seen].join(sep);
|
|
24
|
+
}
|
|
25
|
+
exports.DEP_VULNS = {
|
|
26
|
+
id: 'depVulns',
|
|
27
|
+
aggregate(results) {
|
|
28
|
+
let critical = 0;
|
|
29
|
+
let high = 0;
|
|
30
|
+
let medium = 0;
|
|
31
|
+
let low = 0;
|
|
32
|
+
const findings = [];
|
|
33
|
+
let enrichment = null;
|
|
34
|
+
for (const r of results) {
|
|
35
|
+
critical += r.counts.critical;
|
|
36
|
+
high += r.counts.high;
|
|
37
|
+
medium += r.counts.medium;
|
|
38
|
+
low += r.counts.low;
|
|
39
|
+
if (r.findings)
|
|
40
|
+
findings.push(...r.findings);
|
|
41
|
+
if (r.enrichment)
|
|
42
|
+
enrichment = r.enrichment;
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
schemaVersion: 1,
|
|
46
|
+
tool: uniqueJoin(results.map((r) => r.tool)),
|
|
47
|
+
enrichment,
|
|
48
|
+
counts: { critical, high, medium, low },
|
|
49
|
+
findings: findings.length > 0 ? findings : undefined,
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
exports.LINT = {
|
|
54
|
+
id: 'lint',
|
|
55
|
+
aggregate(results) {
|
|
56
|
+
let critical = 0;
|
|
57
|
+
let high = 0;
|
|
58
|
+
let medium = 0;
|
|
59
|
+
let low = 0;
|
|
60
|
+
for (const r of results) {
|
|
61
|
+
critical += r.counts.critical;
|
|
62
|
+
high += r.counts.high;
|
|
63
|
+
medium += r.counts.medium;
|
|
64
|
+
low += r.counts.low;
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
schemaVersion: 1,
|
|
68
|
+
tool: uniqueJoin(results.map((r) => r.tool)),
|
|
69
|
+
counts: { critical, high, medium, low },
|
|
70
|
+
};
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
exports.COVERAGE = {
|
|
74
|
+
id: 'coverage',
|
|
75
|
+
aggregate(results) {
|
|
76
|
+
// Multiple coverage providers in one repo are uncommon (mono-repos with
|
|
77
|
+
// mixed stacks would hit this). Last-wins is the deterministic-but-lossy
|
|
78
|
+
// choice; a smarter merge needs per-language file weighting — future
|
|
79
|
+
// work when a real multi-pack case surfaces.
|
|
80
|
+
return results[results.length - 1];
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
exports.TEST_FRAMEWORK = {
|
|
84
|
+
id: 'testFramework',
|
|
85
|
+
aggregate(results) {
|
|
86
|
+
// Last-wins. Mixed-stack repos resolve to a single framework name
|
|
87
|
+
// deterministically by provider-registration order; per-language
|
|
88
|
+
// reporting is future work (see Phase 10f roadmap).
|
|
89
|
+
return results[results.length - 1];
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
exports.SECRETS = {
|
|
93
|
+
id: 'secrets',
|
|
94
|
+
aggregate(results) {
|
|
95
|
+
// Multiple providers only appear if a future global scanner joins
|
|
96
|
+
// gitleaks (e.g. trufflehog). Concat findings, sum suppression
|
|
97
|
+
// counts, unique-join tool names — identical strategy to DEP_VULNS.
|
|
98
|
+
const findings = [];
|
|
99
|
+
let suppressedCount = 0;
|
|
100
|
+
for (const r of results) {
|
|
101
|
+
findings.push(...r.findings);
|
|
102
|
+
suppressedCount += r.suppressedCount;
|
|
103
|
+
}
|
|
104
|
+
return {
|
|
105
|
+
schemaVersion: 1,
|
|
106
|
+
tool: uniqueJoin(results.map((r) => r.tool)),
|
|
107
|
+
findings,
|
|
108
|
+
suppressedCount,
|
|
109
|
+
};
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
exports.CODE_PATTERNS = {
|
|
113
|
+
id: 'codePatterns',
|
|
114
|
+
aggregate(results) {
|
|
115
|
+
// Same union strategy as SECRETS — multiple providers only enter the
|
|
116
|
+
// picture if a future SAST scanner (codeql, opengrep) joins semgrep.
|
|
117
|
+
const findings = [];
|
|
118
|
+
let suppressedCount = 0;
|
|
119
|
+
for (const r of results) {
|
|
120
|
+
findings.push(...r.findings);
|
|
121
|
+
suppressedCount += r.suppressedCount;
|
|
122
|
+
}
|
|
123
|
+
return {
|
|
124
|
+
schemaVersion: 1,
|
|
125
|
+
tool: uniqueJoin(results.map((r) => r.tool)),
|
|
126
|
+
findings,
|
|
127
|
+
suppressedCount,
|
|
128
|
+
};
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
exports.DUPLICATION = {
|
|
132
|
+
id: 'duplication',
|
|
133
|
+
aggregate(results) {
|
|
134
|
+
// Multiple providers would appear if a future detector (pmd-cpd,
|
|
135
|
+
// sonar-cpd) joins jscpd. Sum the numerics; concat + re-sort
|
|
136
|
+
// topClones by line-count. Percentage is recomputed from summed
|
|
137
|
+
// totals rather than averaged (line counts may overlap across
|
|
138
|
+
// detectors, but a re-weighted mean would lie; summing totals is
|
|
139
|
+
// conservative).
|
|
140
|
+
let totalLines = 0;
|
|
141
|
+
let duplicatedLines = 0;
|
|
142
|
+
let cloneCount = 0;
|
|
143
|
+
const allClones = [];
|
|
144
|
+
for (const r of results) {
|
|
145
|
+
totalLines += r.totalLines;
|
|
146
|
+
duplicatedLines += r.duplicatedLines;
|
|
147
|
+
cloneCount += r.cloneCount;
|
|
148
|
+
allClones.push(...r.topClones);
|
|
149
|
+
}
|
|
150
|
+
const percentage = totalLines > 0 ? Math.round((duplicatedLines / totalLines) * 10000) / 100 : 0;
|
|
151
|
+
// De-dupe identical clone pairs by stable key, keep largest-first.
|
|
152
|
+
const seen = new Set();
|
|
153
|
+
const merged = [];
|
|
154
|
+
for (const c of allClones.sort((a, b) => b.lines - a.lines)) {
|
|
155
|
+
const key = `${c.a.file}:${c.a.startLine}-${c.a.endLine}|${c.b.file}:${c.b.startLine}-${c.b.endLine}`;
|
|
156
|
+
if (seen.has(key))
|
|
157
|
+
continue;
|
|
158
|
+
seen.add(key);
|
|
159
|
+
merged.push(c);
|
|
160
|
+
}
|
|
161
|
+
return {
|
|
162
|
+
schemaVersion: 1,
|
|
163
|
+
tool: uniqueJoin(results.map((r) => r.tool)),
|
|
164
|
+
totalLines,
|
|
165
|
+
duplicatedLines,
|
|
166
|
+
percentage,
|
|
167
|
+
cloneCount,
|
|
168
|
+
topClones: merged.slice(0, 15),
|
|
169
|
+
};
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
exports.STRUCTURAL = {
|
|
173
|
+
id: 'structural',
|
|
174
|
+
aggregate(results) {
|
|
175
|
+
// Last-wins — same strategy as COVERAGE and TEST_FRAMEWORK. Every
|
|
176
|
+
// field is a repo-level scalar produced by one graph pass; summing
|
|
177
|
+
// across providers would double-count the same functions/modules,
|
|
178
|
+
// and averaging would lie about the source of truth. If a second
|
|
179
|
+
// structural tool ever joins graphify, a proper merge would need
|
|
180
|
+
// per-tool weighting — out of scope until that exists.
|
|
181
|
+
return results[results.length - 1];
|
|
182
|
+
},
|
|
183
|
+
};
|
|
184
|
+
exports.IMPORTS = {
|
|
185
|
+
id: 'imports',
|
|
186
|
+
aggregate(results) {
|
|
187
|
+
// Keys are disjoint between packs (each pack owns its source extensions),
|
|
188
|
+
// so plain-union merge is sound. We still defensively skip later-writer
|
|
189
|
+
// collisions so an accidental overlap would be visible in logs rather
|
|
190
|
+
// than silently dropping edges.
|
|
191
|
+
const extensions = new Set();
|
|
192
|
+
const extracted = new Map();
|
|
193
|
+
const edges = new Map();
|
|
194
|
+
for (const r of results) {
|
|
195
|
+
for (const ext of r.sourceExtensions)
|
|
196
|
+
extensions.add(ext);
|
|
197
|
+
for (const [file, specs] of r.extracted) {
|
|
198
|
+
if (!extracted.has(file))
|
|
199
|
+
extracted.set(file, specs);
|
|
200
|
+
}
|
|
201
|
+
for (const [file, targets] of r.edges) {
|
|
202
|
+
if (!edges.has(file))
|
|
203
|
+
edges.set(file, targets);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return {
|
|
207
|
+
schemaVersion: 1,
|
|
208
|
+
tool: uniqueJoin(results.map((r) => r.tool)),
|
|
209
|
+
sourceExtensions: [...extensions],
|
|
210
|
+
extracted,
|
|
211
|
+
edges,
|
|
212
|
+
};
|
|
213
|
+
},
|
|
214
|
+
};
|
|
215
|
+
/**
|
|
216
|
+
* Per-language capabilities — one provider registered per language pack.
|
|
217
|
+
* Keys must match `keyof LanguagePackCapabilities`; the contract test
|
|
218
|
+
* enforces that symmetry.
|
|
219
|
+
*/
|
|
220
|
+
exports.PER_PACK_REGISTRY = {
|
|
221
|
+
depVulns: exports.DEP_VULNS,
|
|
222
|
+
lint: exports.LINT,
|
|
223
|
+
coverage: exports.COVERAGE,
|
|
224
|
+
testFramework: exports.TEST_FRAMEWORK,
|
|
225
|
+
imports: exports.IMPORTS,
|
|
226
|
+
};
|
|
227
|
+
/**
|
|
228
|
+
* Global capabilities — tools that run once per repo (gitleaks, semgrep,
|
|
229
|
+
* jscpd, graphify), not per pack. Keys must match `keyof GlobalCapabilities`.
|
|
230
|
+
* Pack-dependent inputs (e.g. semgrep's rulesets from each active pack's
|
|
231
|
+
* `semgrepRulesets` declaration) are read by the provider itself via
|
|
232
|
+
* `detectActiveLanguages(cwd)` — the provider interface is uniform.
|
|
233
|
+
*/
|
|
234
|
+
exports.GLOBAL_REGISTRY = {
|
|
235
|
+
secrets: exports.SECRETS,
|
|
236
|
+
codePatterns: exports.CODE_PATTERNS,
|
|
237
|
+
duplication: exports.DUPLICATION,
|
|
238
|
+
structural: exports.STRUCTURAL,
|
|
239
|
+
};
|
|
240
|
+
/**
|
|
241
|
+
* Union of both registries — kept as the canonical "every descriptor"
|
|
242
|
+
* surface for tests and for callers that don't care about per-pack vs
|
|
243
|
+
* global distinction. `providersFor()` (src/languages/capabilities/index.ts)
|
|
244
|
+
* is the routing layer that picks the right source.
|
|
245
|
+
*/
|
|
246
|
+
exports.CAPABILITY_REGISTRY = {
|
|
247
|
+
...exports.PER_PACK_REGISTRY,
|
|
248
|
+
...exports.GLOBAL_REGISTRY,
|
|
249
|
+
};
|
|
250
|
+
//# sourceMappingURL=descri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
+
/**
|
|
2
|
+
* Global capabilities — registered providers for tools that run once per
|
|
3
|
+
* repo rather than per language pack (gitleaks, grep-secrets fallback,
|
|
4
|
+
* semgrep, jscpd, graphify).
|
|
5
|
+
*
|
|
6
|
+
* The provider interface is identical to per-pack (`CapabilityProvider<T>`).
|
|
7
|
+
* What makes these "global" is only the registration site: providers are
|
|
8
|
+
* looked up by capability id rather than by iterating `LANGUAGES`. When a
|
|
9
|
+
* global provider needs per-pack input (semgrep's rulesets come from each
|
|
10
|
+
* active pack's `semgrepRulesets` declaration), it calls
|
|
11
|
+
* `detectActiveLanguages(cwd)` inside its own `gather()` — no interface
|
|
12
|
+
* extension needed.
|
|
13
|
+
*
|
|
14
|
+
* Each slot is an **array of providers** (Phase 10e.C.7.5). Multi-provider
|
|
15
|
+
* merge is handled by the descriptor's `aggregate` function: SECRETS +
|
|
16
|
+
* CODE_PATTERNS union findings and unique-join tool names; DUPLICATION
|
|
17
|
+
* sums totals + re-weights percentage; STRUCTURAL is last-wins. That lets
|
|
18
|
+
* us register a fallback provider alongside the primary (e.g. grep-secrets
|
|
19
|
+
* behind gitleaks) or layer an opt-in commercial scanner (Snyk for
|
|
20
|
+
* DEP_VULNS, Phase 10h.4) without structural change at the dispatch
|
|
21
|
+
* layer.
|
|
22
|
+
*/
|
|
23
|
+
import type { CapabilityProvider } from './provider';
|
|
24
|
+
import type { CodePatternsResult, DuplicationResult, SecretsResult, StructuralResult } from './types';
|
|
25
|
+
export interface GlobalCapabilities {
|
|
26
|
+
secrets?: ReadonlyArray<CapabilityProvider<SecretsResult>>;
|
|
27
|
+
codePatterns?: ReadonlyArray<CapabilityProvider<CodePatternsResult>>;
|
|
28
|
+
duplication?: ReadonlyArray<CapabilityProvider<DuplicationResult>>;
|
|
29
|
+
structural?: ReadonlyArray<CapabilityProvider<StructuralResult>>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Registered providers per capability. Providers live in their tool file
|
|
33
|
+
* under `src/analyzers/tools/*.ts` and are imported here. Each is a
|
|
34
|
+
* free-standing module — they don't extend any class or know about each
|
|
35
|
+
* other, so adding one is a pure registration edit.
|
|
36
|
+
*
|
|
37
|
+
* `secrets` stacks gitleaks with a grep-based fallback (`grep-secrets`)
|
|
38
|
+
* that returns null whenever gitleaks is installed. The fallback only
|
|
39
|
+
* contributes on environments without gitleaks, preserving pre-C.7
|
|
40
|
+
* "gitleaks dominates" semantics while still covering degraded setups.
|
|
41
|
+
*/
|
|
42
|
+
export declare const GLOBAL_CAPABILITIES: GlobalCapabilities;
|
|
43
|
+
//# sourceMappingURL=global.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../../../src/languages/capabilities/global.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAOH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,EACV,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,kBAAkB;IACjC,OAAO,CAAC,EAAE,aAAa,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC,CAAC;IAC3D,YAAY,CAAC,EAAE,aAAa,CAAC,kBAAkB,CAAC,kBAAkB,CAAC,CAAC,CAAC;IACrE,WAAW,CAAC,EAAE,aAAa,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,CAAC,CAAC;IACnE,UAAU,CAAC,EAAE,aAAa,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAC,CAAC;CAClE;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,EAAE,kBAKjC,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Global capabilities — registered providers for tools that run once per
|
|
4
|
+
* repo rather than per language pack (gitleaks, grep-secrets fallback,
|
|
5
|
+
* semgrep, jscpd, graphify).
|
|
6
|
+
*
|
|
7
|
+
* The provider interface is identical to per-pack (`CapabilityProvider<T>`).
|
|
8
|
+
* What makes these "global" is only the registration site: providers are
|
|
9
|
+
* looked up by capability id rather than by iterating `LANGUAGES`. When a
|
|
10
|
+
* global provider needs per-pack input (semgrep's rulesets come from each
|
|
11
|
+
* active pack's `semgrepRulesets` declaration), it calls
|
|
12
|
+
* `detectActiveLanguages(cwd)` inside its own `gather()` — no interface
|
|
13
|
+
* extension needed.
|
|
14
|
+
*
|
|
15
|
+
* Each slot is an **array of providers** (Phase 10e.C.7.5). Multi-provider
|
|
16
|
+
* merge is handled by the descriptor's `aggregate` function: SECRETS +
|
|
17
|
+
* CODE_PATTERNS union findings and unique-join tool names; DUPLICATION
|
|
18
|
+
* sums totals + re-weights percentage; STRUCTURAL is last-wins. That lets
|
|
19
|
+
* us register a fallback provider alongside the primary (e.g. grep-secrets
|
|
20
|
+
* behind gitleaks) or layer an opt-in commercial scanner (Snyk for
|
|
21
|
+
* DEP_VULNS, Phase 10h.4) without structural change at the dispatch
|
|
22
|
+
* layer.
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.GLOBAL_CAPABILITIES = void 0;
|
|
26
|
+
const gitleaks_1 = require("../../analyzers/tools/gitleaks");
|
|
27
|
+
const graphify_1 = require("../../analyzers/tools/graphify");
|
|
28
|
+
const grep_secrets_1 = require("../../analyzers/tools/grep-secrets");
|
|
29
|
+
const jscpd_1 = require("../../analyzers/tools/jscpd");
|
|
30
|
+
const semgrep_1 = require("../../analyzers/tools/semgrep");
|
|
31
|
+
/**
|
|
32
|
+
* Registered providers per capability. Providers live in their tool file
|
|
33
|
+
* under `src/analyzers/tools/*.ts` and are imported here. Each is a
|
|
34
|
+
* free-standing module — they don't extend any class or know about each
|
|
35
|
+
* other, so adding one is a pure registration edit.
|
|
36
|
+
*
|
|
37
|
+
* `secrets` stacks gitleaks with a grep-based fallback (`grep-secrets`)
|
|
38
|
+
* that returns null whenever gitleaks is installed. The fallback only
|
|
39
|
+
* contributes on environments without gitleaks, preserving pre-C.7
|
|
40
|
+
* "gitleaks dominates" semantics while still covering degraded setups.
|
|
41
|
+
*/
|
|
42
|
+
exports.GLOBAL_CAPABILITIES = {
|
|
43
|
+
secrets: [gitleaks_1.gitleaksProvider, grep_secrets_1.grepSecretsProvider],
|
|
44
|
+
codePatterns: [semgrep_1.semgrepProvider],
|
|
45
|
+
duplication: [jscpd_1.jscpdProvider],
|
|
46
|
+
structural: [graphify_1.graphifyProvider],
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=global.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global.js","sourceRoot":"","sources":["../../../src/languages/capabilities/global.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;;AAEH,6DAAkE;AAClE,6DAAkE;AAClE,qEAAyE;AACzE,uDAA4D;AAC5D,2DAAgE;AAgBhE;;;;;;;;;;GAUG;AACU,QAAA,mBAAmB,GAAuB;IACrD,OAAO,EAAE,CAAC,2BAAgB,EAAE,kCAAmB,CAAC;IAChD,YAAY,EAAE,CAAC,yBAAe,CAAC;IAC/B,WAAW,EAAE,CAAC,qBAAa,CAAC;IAC5B,UAAU,EAAE,CAAC,2BAAgB,CAAC;CAC/B,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capability barrel + provider resolver.
|
|
3
|
+
*
|
|
4
|
+
* Analyzers call `providersFor(SECRETS)` rather than hand-iterating
|
|
5
|
+
* `LANGUAGES` or reading `GLOBAL_CAPABILITIES` directly. One lookup
|
|
6
|
+
* function hides the per-pack vs global split so analyzer code reads
|
|
7
|
+
* identically regardless of which registry hosts the capability.
|
|
8
|
+
*/
|
|
9
|
+
import { type CapabilityDescriptor } from './descriptors';
|
|
10
|
+
import type { CapabilityProvider } from './provider';
|
|
11
|
+
import type { CapabilityEnvelope } from './types';
|
|
12
|
+
/**
|
|
13
|
+
* Resolve the concrete provider list for a capability descriptor.
|
|
14
|
+
*
|
|
15
|
+
* For per-pack capabilities (depVulns, lint, coverage, testFramework,
|
|
16
|
+
* imports): collected from every LanguageSupport that declared a provider
|
|
17
|
+
* in `capabilities.<id>`. Inactive packs (detect() returns false for this
|
|
18
|
+
* repo) still contribute — each provider is responsible for returning
|
|
19
|
+
* null when it has nothing to do. The dispatcher filters nulls before
|
|
20
|
+
* aggregating.
|
|
21
|
+
*
|
|
22
|
+
* For global capabilities (secrets, codePatterns, duplication, structural):
|
|
23
|
+
* the registered provider array (Phase 10e.C.7.5). A slot may carry
|
|
24
|
+
* multiple providers — SECRETS stacks gitleaks + grep-secrets fallback,
|
|
25
|
+
* DEP_VULNS is set up for a future Snyk opt-in (Phase 10h.4). The
|
|
26
|
+
* descriptor's `aggregate` function merges envelopes across providers.
|
|
27
|
+
* Returns `[]` when the capability id isn't in either registry.
|
|
28
|
+
*/
|
|
29
|
+
export declare function providersFor<T extends CapabilityEnvelope>(cap: CapabilityDescriptor<T>): ReadonlyArray<CapabilityProvider<T>>;
|
|
30
|
+
export { GLOBAL_CAPABILITIES, type GlobalCapabilities } from './global';
|
|
31
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/languages/capabilities/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,KAAK,oBAAoB,EAAsC,MAAM,eAAe,CAAC;AAE9F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAGlD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,kBAAkB,EACvD,GAAG,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAC3B,aAAa,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAmBtC;AAED,OAAO,EAAE,mBAAmB,EAAE,KAAK,kBAAkB,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Capability barrel + provider resolver.
|
|
4
|
+
*
|
|
5
|
+
* Analyzers call `providersFor(SECRETS)` rather than hand-iterating
|
|
6
|
+
* `LANGUAGES` or reading `GLOBAL_CAPABILITIES` directly. One lookup
|
|
7
|
+
* function hides the per-pack vs global split so analyzer code reads
|
|
8
|
+
* identically regardless of which registry hosts the capability.
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.GLOBAL_CAPABILITIES = void 0;
|
|
12
|
+
exports.providersFor = providersFor;
|
|
13
|
+
const index_1 = require("../index");
|
|
14
|
+
const descriptors_1 = require("./descriptors");
|
|
15
|
+
const global_1 = require("./global");
|
|
16
|
+
/**
|
|
17
|
+
* Resolve the concrete provider list for a capability descriptor.
|
|
18
|
+
*
|
|
19
|
+
* For per-pack capabilities (depVulns, lint, coverage, testFramework,
|
|
20
|
+
* imports): collected from every LanguageSupport that declared a provider
|
|
21
|
+
* in `capabilities.<id>`. Inactive packs (detect() returns false for this
|
|
22
|
+
* repo) still contribute — each provider is responsible for returning
|
|
23
|
+
* null when it has nothing to do. The dispatcher filters nulls before
|
|
24
|
+
* aggregating.
|
|
25
|
+
*
|
|
26
|
+
* For global capabilities (secrets, codePatterns, duplication, structural):
|
|
27
|
+
* the registered provider array (Phase 10e.C.7.5). A slot may carry
|
|
28
|
+
* multiple providers — SECRETS stacks gitleaks + grep-secrets fallback,
|
|
29
|
+
* DEP_VULNS is set up for a future Snyk opt-in (Phase 10h.4). The
|
|
30
|
+
* descriptor's `aggregate` function merges envelopes across providers.
|
|
31
|
+
* Returns `[]` when the capability id isn't in either registry.
|
|
32
|
+
*/
|
|
33
|
+
function providersFor(cap) {
|
|
34
|
+
// The casts through `unknown` are safe at runtime because PER_PACK_REGISTRY
|
|
35
|
+
// and GLOBAL_REGISTRY are typed such that `cap.id` being in a registry
|
|
36
|
+
// implies the providers under that key produce exactly T. TypeScript can't
|
|
37
|
+
// prove that across the two branches without heavier type-level machinery.
|
|
38
|
+
if (cap.id in descriptors_1.GLOBAL_REGISTRY) {
|
|
39
|
+
const slot = global_1.GLOBAL_CAPABILITIES[cap.id];
|
|
40
|
+
return (slot ?? []);
|
|
41
|
+
}
|
|
42
|
+
if (cap.id in descriptors_1.PER_PACK_REGISTRY) {
|
|
43
|
+
const key = cap.id;
|
|
44
|
+
const providers = [];
|
|
45
|
+
for (const lang of index_1.LANGUAGES) {
|
|
46
|
+
const p = lang.capabilities?.[key];
|
|
47
|
+
if (p)
|
|
48
|
+
providers.push(p);
|
|
49
|
+
}
|
|
50
|
+
return providers;
|
|
51
|
+
}
|
|
52
|
+
return [];
|
|
53
|
+
}
|
|
54
|
+
var global_2 = require("./global");
|
|
55
|
+
Object.defineProperty(exports, "GLOBAL_CAPABILITIES", { enumerable: true, get: function () { return global_2.GLOBAL_CAPABILITIES; } });
|
|
56
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/languages/capabilities/index.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AA0BH,oCAqBC;AA7CD,oCAAqC;AACrC,+CAA8F;AAC9F,qCAAwE;AAKxE;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,YAAY,CAC1B,GAA4B;IAE5B,4EAA4E;IAC5E,uEAAuE;IACvE,2EAA2E;IAC3E,2EAA2E;IAC3E,IAAI,GAAG,CAAC,EAAE,IAAI,6BAAe,EAAE,CAAC;QAC9B,MAAM,IAAI,GAAG,4BAAmB,CAAC,GAAG,CAAC,EAA8B,CAAC,CAAC;QACrE,OAAO,CAAC,IAAI,IAAI,EAAE,CAAoD,CAAC;IACzE,CAAC;IACD,IAAI,GAAG,CAAC,EAAE,IAAI,+BAAiB,EAAE,CAAC;QAChC,MAAM,GAAG,GAAG,GAAG,CAAC,EAAoC,CAAC;QACrD,MAAM,SAAS,GAA4B,EAAE,CAAC;QAC9C,KAAK,MAAM,IAAI,IAAI,iBAAS,EAAE,CAAC;YAC7B,MAAM,CAAC,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC,GAAG,CAAC,CAAC;YACnC,IAAI,CAAC;gBAAE,SAAS,CAAC,IAAI,CAAC,CAAqC,CAAC,CAAC;QAC/D,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,mCAAwE;AAA/D,6GAAA,mBAAmB,OAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capability provider contract.
|
|
3
|
+
*
|
|
4
|
+
* Anything that can produce a capability result implements this — language
|
|
5
|
+
* packs (`LanguageSupport.capabilities.depVulns`, …) and global gatherers
|
|
6
|
+
* (`gitleaks`, `semgrep`, …) alike. Returning `null` means "this provider
|
|
7
|
+
* has nothing to contribute for this cwd" (e.g. the Python pack on a
|
|
8
|
+
* Go-only repo); the dispatcher filters nulls before aggregating.
|
|
9
|
+
*/
|
|
10
|
+
import type { CapabilityEnvelope } from './types';
|
|
11
|
+
export interface CapabilityProvider<T extends CapabilityEnvelope> {
|
|
12
|
+
/** Source name for attribution in logs and errors (usually the language id). */
|
|
13
|
+
readonly source: string;
|
|
14
|
+
gather(cwd: string): Promise<T | null>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/languages/capabilities/provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD,MAAM,WAAW,kBAAkB,CAAC,CAAC,SAAS,kBAAkB;IAC9D,gFAAgF;IAChF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;CACxC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Capability provider contract.
|
|
4
|
+
*
|
|
5
|
+
* Anything that can produce a capability result implements this — language
|
|
6
|
+
* packs (`LanguageSupport.capabilities.depVulns`, …) and global gatherers
|
|
7
|
+
* (`gitleaks`, `semgrep`, …) alike. Returning `null` means "this provider
|
|
8
|
+
* has nothing to contribute for this cwd" (e.g. the Python pack on a
|
|
9
|
+
* Go-only repo); the dispatcher filters nulls before aggregating.
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
//# sourceMappingURL=provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../src/languages/capabilities/provider.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG"}
|