@shrkcrft/quality-gates 0.1.0-alpha.21 → 0.1.0-alpha.22

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.
@@ -0,0 +1,23 @@
1
+ import type { IWiringRule } from '@shrkcrft/core';
2
+ import type { IGateResult } from '../schema/quality-gate.js';
3
+ export interface IWiringGateOptions {
4
+ /** The project's wiring rules (from `sharkcraft.config.ts` `wiringRules[]`). */
5
+ rules?: readonly IWiringRule[];
6
+ /** Restrict to rules touched by these (project-relative) changed files. */
7
+ changedFiles?: readonly string[];
8
+ /** When true, only run rules touched by `changedFiles`. */
9
+ changedOnly?: boolean;
10
+ /**
11
+ * Set when the project config could not be loaded/validated. The gate surfaces
12
+ * it (warn) instead of silently skipping — a malformed config must not quietly
13
+ * disable the wiring plane.
14
+ */
15
+ configError?: string;
16
+ }
17
+ /**
18
+ * The "completeness plane" gate: runs the project's data-defined wiring rules
19
+ * (declared token set ⊆ registered token set). Skipped — never red — when no
20
+ * rules are configured, so it's inert for projects that don't opt in.
21
+ */
22
+ export declare function wiringGate(projectRoot: string, options?: IWiringGateOptions): IGateResult;
23
+ //# sourceMappingURL=wiring-gate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wiring-gate.d.ts","sourceRoot":"","sources":["../../src/gates/wiring-gate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAE7D,MAAM,WAAW,kBAAkB;IACjC,gFAAgF;IAChF,KAAK,CAAC,EAAE,SAAS,WAAW,EAAE,CAAC;IAC/B,2EAA2E;IAC3E,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,2DAA2D;IAC3D,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,GAAE,kBAAuB,GAAG,WAAW,CAmD7F"}
@@ -0,0 +1,56 @@
1
+ import { runWiring } from '@shrkcrft/boundaries';
2
+ /**
3
+ * The "completeness plane" gate: runs the project's data-defined wiring rules
4
+ * (declared token set ⊆ registered token set). Skipped — never red — when no
5
+ * rules are configured, so it's inert for projects that don't opt in.
6
+ */
7
+ export function wiringGate(projectRoot, options = {}) {
8
+ const start = Date.now();
9
+ if (options.configError) {
10
+ return {
11
+ id: 'wiring',
12
+ label: 'Wiring (completeness)',
13
+ status: 'warn',
14
+ message: `Config could not be loaded — wiring rules not evaluated: ${options.configError}`,
15
+ nextCommands: ['shrk doctor'],
16
+ durationMs: Date.now() - start,
17
+ };
18
+ }
19
+ const rules = options.rules ?? [];
20
+ if (rules.length === 0) {
21
+ return {
22
+ id: 'wiring',
23
+ label: 'Wiring (completeness)',
24
+ status: 'skipped',
25
+ message: 'No wiring rules configured (sharkcraft.config.ts wiringRules[]).',
26
+ durationMs: Date.now() - start,
27
+ };
28
+ }
29
+ const report = runWiring(projectRoot, rules, {
30
+ ...(options.changedOnly ? { changedOnly: true, changedFiles: options.changedFiles ?? [] } : {}),
31
+ });
32
+ const errors = report.violations.filter((v) => v.severity === 'error').length;
33
+ const warnings = report.violations.filter((v) => v.severity === 'warning').length;
34
+ const samples = report.violations.slice(0, 8).map((v) => `${v.ruleId}: ${v.token} (${v.file}:${v.line})`);
35
+ const diagnostics = report.diagnostics;
36
+ if (report.verdict === 'pass') {
37
+ return {
38
+ id: 'wiring',
39
+ label: 'Wiring (completeness)',
40
+ status: 'pass',
41
+ message: `${report.rules.length} wiring rule(s) — every declared token is wired.`,
42
+ details: { rules: report.rules.length },
43
+ durationMs: Date.now() - start,
44
+ };
45
+ }
46
+ const misconfig = diagnostics.length > 0 ? `, ${diagnostics.length} misconfigured rule(s)` : '';
47
+ return {
48
+ id: 'wiring',
49
+ label: 'Wiring (completeness)',
50
+ status: report.verdict === 'errors' ? 'fail' : 'warn',
51
+ message: `${errors} error(s), ${warnings} warning(s)${misconfig}: declared but not wired.`,
52
+ details: { errors, warnings, samples, ...(diagnostics.length > 0 ? { diagnostics } : {}) },
53
+ nextCommands: ['shrk check wiring'],
54
+ durationMs: Date.now() - start,
55
+ };
56
+ }
package/dist/index.d.ts CHANGED
@@ -9,6 +9,7 @@ export * from './gates/graph-unresolved-gate.js';
9
9
  export * from './gates/impact-baseline-gate.js';
10
10
  export * from './gates/structural-patterns-gate.js';
11
11
  export * from './gates/intent-classifier-gate.js';
12
+ export * from './gates/wiring-gate.js';
12
13
  export * from './runner/run-gates.js';
13
14
  export * from './runner/report-store.js';
14
15
  export * from './runner/render-markdown.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC;AACpD,cAAc,mCAAmC,CAAC;AAClD,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC;AACpD,cAAc,mCAAmC,CAAC;AAClD,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC"}
package/dist/index.js CHANGED
@@ -9,6 +9,7 @@ export * from "./gates/graph-unresolved-gate.js";
9
9
  export * from "./gates/impact-baseline-gate.js";
10
10
  export * from "./gates/structural-patterns-gate.js";
11
11
  export * from "./gates/intent-classifier-gate.js";
12
+ export * from "./gates/wiring-gate.js";
12
13
  export * from "./runner/run-gates.js";
13
14
  export * from "./runner/report-store.js";
14
15
  export * from "./runner/render-markdown.js";
@@ -6,6 +6,7 @@ import { type IImpactGateOptions } from '../gates/impact-gate.js';
6
6
  import { type IImpactBaselineGateOptions } from '../gates/impact-baseline-gate.js';
7
7
  import { type IIntentClassifierGateOptions } from '../gates/intent-classifier-gate.js';
8
8
  import { type IStructuralPatternsGateOptions } from '../gates/structural-patterns-gate.js';
9
+ import { type IWiringGateOptions } from '../gates/wiring-gate.js';
9
10
  import { type IQualityGateReport } from '../schema/quality-gate.js';
10
11
  export interface IRunGatesOptions {
11
12
  projectRoot: string;
@@ -28,6 +29,8 @@ export interface IRunGatesOptions {
28
29
  structuralPatterns?: IStructuralPatternsGateOptions;
29
30
  /** Optional intent-classifier gate config. */
30
31
  intentClassifier?: IIntentClassifierGateOptions;
32
+ /** Optional wiring gate config (the project's wiringRules + change scope). */
33
+ wiring?: IWiringGateOptions;
31
34
  /** Disable specific gates by id. */
32
35
  disable?: readonly string[];
33
36
  }
@@ -1 +1 @@
1
- {"version":3,"file":"run-gates.d.ts","sourceRoot":"","sources":["../../src/runner/run-gates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAElF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAmB,KAAK,uBAAuB,EAA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 +7,7 @@ import { impactGate } from "../gates/impact-gate.js";
7
7
  import { impactBaselineGate, } from "../gates/impact-baseline-gate.js";
8
8
  import { intentClassifierGate, } from "../gates/intent-classifier-gate.js";
9
9
  import { structuralPatternsGate, } from "../gates/structural-patterns-gate.js";
10
+ import { wiringGate } from "../gates/wiring-gate.js";
10
11
  import { QUALITY_GATE_SCHEMA, } from "../schema/quality-gate.js";
11
12
  /**
12
13
  * Run the quality-gate aggregator over a project.
@@ -60,6 +61,9 @@ export function runQualityGates(options) {
60
61
  if (!disabled.has('intent-classifier')) {
61
62
  gates.push(intentClassifierGate(options.projectRoot, options.intentClassifier ?? {}));
62
63
  }
64
+ if (!disabled.has('wiring')) {
65
+ gates.push(wiringGate(options.projectRoot, options.wiring ?? {}));
66
+ }
63
67
  if (!disabled.has('api-diff') && options.apiDiff) {
64
68
  gates.push(apiDiffGate(options.projectRoot, options.apiDiff));
65
69
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shrkcrft/quality-gates",
3
- "version": "0.1.0-alpha.21",
3
+ "version": "0.1.0-alpha.22",
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,14 +43,14 @@
43
43
  "typecheck": "tsc --noEmit -p tsconfig.json"
44
44
  },
45
45
  "dependencies": {
46
- "@shrkcrft/core": "^0.1.0-alpha.21",
47
- "@shrkcrft/graph": "^0.1.0-alpha.21",
48
- "@shrkcrft/architecture-guard": "^0.1.0-alpha.21",
49
- "@shrkcrft/impact-engine": "^0.1.0-alpha.21",
50
- "@shrkcrft/api-surface-diff": "^0.1.0-alpha.21",
51
- "@shrkcrft/boundaries": "^0.1.0-alpha.21",
52
- "@shrkcrft/structural-search": "^0.1.0-alpha.21",
53
- "@shrkcrft/context-planner": "^0.1.0-alpha.21"
46
+ "@shrkcrft/core": "^0.1.0-alpha.22",
47
+ "@shrkcrft/graph": "^0.1.0-alpha.22",
48
+ "@shrkcrft/architecture-guard": "^0.1.0-alpha.22",
49
+ "@shrkcrft/impact-engine": "^0.1.0-alpha.22",
50
+ "@shrkcrft/api-surface-diff": "^0.1.0-alpha.22",
51
+ "@shrkcrft/boundaries": "^0.1.0-alpha.22",
52
+ "@shrkcrft/structural-search": "^0.1.0-alpha.22",
53
+ "@shrkcrft/context-planner": "^0.1.0-alpha.22"
54
54
  },
55
55
  "publishConfig": {
56
56
  "access": "public"