@shrkcrft/quality-gates 0.1.0-alpha.24 → 0.1.0-alpha.25
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/dist/gates/impact-gate.d.ts.map +1 -1
- package/dist/gates/impact-gate.js +13 -4
- package/package.json +10 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"impact-gate.d.ts","sourceRoot":"","sources":["../../src/gates/impact-gate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAE7D,MAAM,WAAW,kBAAkB;IACjC,sEAAsE;IACtE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,SAAS,CAAC,MAAM,GAAG,UAAU,CAAC,EAAE,CAAC;IAC1C;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3B;AAcD;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,GAAE,kBAAuB,GAAG,WAAW,
|
|
1
|
+
{"version":3,"file":"impact-gate.d.ts","sourceRoot":"","sources":["../../src/gates/impact-gate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAE7D,MAAM,WAAW,kBAAkB;IACjC,sEAAsE;IACtE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,SAAS,CAAC,MAAM,GAAG,UAAU,CAAC,EAAE,CAAC;IAC1C;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3B;AAcD;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,GAAE,kBAAuB,GAAG,WAAW,CAiE7F"}
|
|
@@ -23,8 +23,14 @@ function rankOf(risk) {
|
|
|
23
23
|
*/
|
|
24
24
|
export function impactGate(projectRoot, options = {}) {
|
|
25
25
|
const start = Date.now();
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
// `undefined` failOn → the standalone default (`['critical']` fails). An
|
|
27
|
+
// EXPLICIT empty array → ADVISORY mode: blast-radius risk is inherently the
|
|
28
|
+
// pre-existing structure (touching a hub is risky but not a NEW failure this
|
|
29
|
+
// change introduced), so it warns rather than reds. The composite `gate`
|
|
30
|
+
// passes `[]` by default so its verdict clears for a clean inline change.
|
|
31
|
+
const failOn = options.failOn === undefined ? ['critical'] : options.failOn;
|
|
32
|
+
const advisoryOnly = failOn.length === 0;
|
|
33
|
+
const failThreshold = advisoryOnly ? Number.POSITIVE_INFINITY : Math.min(...failOn.map((f) => rankOf(f)));
|
|
28
34
|
// Scope: an explicit changed-file set (when no gitref is given) is analyzed
|
|
29
35
|
// directly; otherwise diff against the gitref (default 'main').
|
|
30
36
|
const useFiles = !options.sinceRef && options.files !== undefined;
|
|
@@ -52,11 +58,14 @@ export function impactGate(projectRoot, options = {}) {
|
|
|
52
58
|
durationMs: Date.now() - start,
|
|
53
59
|
};
|
|
54
60
|
}
|
|
55
|
-
const
|
|
61
|
+
const rank = rankOf(analysis.risk);
|
|
62
|
+
const status = rank >= failThreshold ? 'fail' : rank >= (RISK_RANK['high'] ?? 2) ? 'warn' : 'pass';
|
|
56
63
|
const message = status === 'fail'
|
|
57
64
|
? `Risk: ${analysis.risk}. ${analysis.directDependents.length} direct dependents.`
|
|
58
65
|
: status === 'warn'
|
|
59
|
-
?
|
|
66
|
+
? advisoryOnly
|
|
67
|
+
? `Risk: ${analysis.risk} (advisory — pre-existing blast radius, ${analysis.directDependents.length} direct dependents). Validate broadly; \`--fail-on ${analysis.risk === 'critical' ? 'critical' : 'high'}\` to block.`
|
|
68
|
+
: `Risk: ${analysis.risk}. Review the validation scope.`
|
|
60
69
|
: `Risk: ${analysis.risk}. Looks safe.`;
|
|
61
70
|
return {
|
|
62
71
|
id: 'impact',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shrkcrft/quality-gates",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.25",
|
|
4
4
|
"description": "SharkCraft quality gates: single aggregator that runs the code-intelligence checks (graph index, boundaries, architecture, impact summary) and emits one pass/fail report. The pre-merge gate for AI-agent-authored changes.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "SharkCraft contributors",
|
|
@@ -43,15 +43,15 @@
|
|
|
43
43
|
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@shrkcrft/core": "^0.1.0-alpha.
|
|
47
|
-
"@shrkcrft/graph": "^0.1.0-alpha.
|
|
48
|
-
"@shrkcrft/architecture-guard": "^0.1.0-alpha.
|
|
49
|
-
"@shrkcrft/impact-engine": "^0.1.0-alpha.
|
|
50
|
-
"@shrkcrft/api-surface-diff": "^0.1.0-alpha.
|
|
51
|
-
"@shrkcrft/boundaries": "^0.1.0-alpha.
|
|
52
|
-
"@shrkcrft/structural-search": "^0.1.0-alpha.
|
|
53
|
-
"@shrkcrft/context-planner": "^0.1.0-alpha.
|
|
54
|
-
"@shrkcrft/inspector": "^0.1.0-alpha.
|
|
46
|
+
"@shrkcrft/core": "^0.1.0-alpha.25",
|
|
47
|
+
"@shrkcrft/graph": "^0.1.0-alpha.25",
|
|
48
|
+
"@shrkcrft/architecture-guard": "^0.1.0-alpha.25",
|
|
49
|
+
"@shrkcrft/impact-engine": "^0.1.0-alpha.25",
|
|
50
|
+
"@shrkcrft/api-surface-diff": "^0.1.0-alpha.25",
|
|
51
|
+
"@shrkcrft/boundaries": "^0.1.0-alpha.25",
|
|
52
|
+
"@shrkcrft/structural-search": "^0.1.0-alpha.25",
|
|
53
|
+
"@shrkcrft/context-planner": "^0.1.0-alpha.25",
|
|
54
|
+
"@shrkcrft/inspector": "^0.1.0-alpha.25"
|
|
55
55
|
},
|
|
56
56
|
"publishConfig": {
|
|
57
57
|
"access": "public"
|