@shrkcrft/boundaries 0.1.0-alpha.30 → 0.1.0-alpha.31
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/baseline/compute-baseline.d.ts +8 -0
- package/dist/baseline/compute-baseline.d.ts.map +1 -1
- package/dist/baseline/compute-baseline.js +8 -7
- package/dist/baseline/diff-baseline.d.ts +28 -0
- package/dist/baseline/diff-baseline.d.ts.map +1 -1
- package/dist/baseline/diff-baseline.js +29 -0
- package/dist/evaluate/boundary-unit-finding.d.ts +10 -0
- package/dist/evaluate/boundary-unit-finding.d.ts.map +1 -0
- package/dist/evaluate/boundary-unit-finding.js +21 -0
- package/dist/evaluate/boundary-unit-kind.d.ts +7 -0
- package/dist/evaluate/boundary-unit-kind.d.ts.map +1 -0
- package/dist/evaluate/boundary-unit-kind.js +14 -0
- package/dist/evaluate/evaluate-boundaries.d.ts +230 -3
- package/dist/evaluate/evaluate-boundaries.d.ts.map +1 -1
- package/dist/evaluate/evaluate-boundaries.js +481 -53
- package/dist/evaluate/i-boundary-rule-settle-input.d.ts +27 -0
- package/dist/evaluate/i-boundary-rule-settle-input.d.ts.map +1 -0
- package/dist/evaluate/i-boundary-rule-settle-input.js +1 -0
- package/dist/evaluate/i-boundary-rule-settlement.d.ts +23 -0
- package/dist/evaluate/i-boundary-rule-settlement.d.ts.map +1 -0
- package/dist/evaluate/i-boundary-rule-settlement.js +1 -0
- package/dist/evaluate/i-boundary-unit-finding.d.ts +22 -0
- package/dist/evaluate/i-boundary-unit-finding.d.ts.map +1 -0
- package/dist/evaluate/i-boundary-unit-finding.js +1 -0
- package/dist/evaluate/settle-boundary-rule.d.ts +23 -0
- package/dist/evaluate/settle-boundary-rule.d.ts.map +1 -0
- package/dist/evaluate/settle-boundary-rule.js +73 -0
- package/dist/evaluate/with-boundary-rule-settlement.d.ts +11 -0
- package/dist/evaluate/with-boundary-rule-settlement.d.ts.map +1 -0
- package/dist/evaluate/with-boundary-rule-settlement.js +44 -0
- package/dist/extract/code-zones.d.ts +95 -3
- package/dist/extract/code-zones.d.ts.map +1 -1
- package/dist/extract/code-zones.js +313 -4
- package/dist/extract/extract-tokens.d.ts +30 -0
- package/dist/extract/extract-tokens.d.ts.map +1 -1
- package/dist/extract/extract-tokens.js +233 -27
- package/dist/extract/i-labeled-source.d.ts +12 -0
- package/dist/extract/i-labeled-source.d.ts.map +1 -0
- package/dist/extract/i-labeled-source.js +1 -0
- package/dist/extract/import-edges.d.ts +1 -0
- package/dist/extract/import-edges.d.ts.map +1 -1
- package/dist/extract/import-edges.js +20 -7
- package/dist/extract/inspect-source.d.ts +32 -3
- package/dist/extract/inspect-source.d.ts.map +1 -1
- package/dist/extract/inspect-source.js +50 -7
- package/dist/extract/parse-imports.d.ts +34 -12
- package/dist/extract/parse-imports.d.ts.map +1 -1
- package/dist/extract/parse-imports.js +119 -20
- package/dist/extract/scan-literals.d.ts +12 -1
- package/dist/extract/scan-literals.d.ts.map +1 -1
- package/dist/extract/scan-literals.js +15 -1
- package/dist/extract/source-liveness-request.d.ts +24 -0
- package/dist/extract/source-liveness-request.d.ts.map +1 -0
- package/dist/extract/source-liveness-request.js +45 -0
- package/dist/generated/check-provenance.d.ts.map +1 -1
- package/dist/generated/check-provenance.js +3 -1
- package/dist/generated/read-regen-tree.d.ts +16 -0
- package/dist/generated/read-regen-tree.d.ts.map +1 -0
- package/dist/generated/read-regen-tree.js +61 -0
- package/dist/generated/scan-generated.d.ts +8 -0
- package/dist/generated/scan-generated.d.ts.map +1 -1
- package/dist/generated/scan-generated.js +25 -10
- package/dist/index.d.ts +48 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +51 -0
- package/dist/model/boundary-intended-empty-line.d.ts +10 -0
- package/dist/model/boundary-intended-empty-line.d.ts.map +1 -0
- package/dist/model/boundary-intended-empty-line.js +11 -0
- package/dist/model/boundary-markable-list.d.ts +15 -0
- package/dist/model/boundary-markable-list.d.ts.map +1 -0
- package/dist/model/boundary-markable-list.js +15 -0
- package/dist/model/boundary-rule-input-keys.d.ts +11 -0
- package/dist/model/boundary-rule-input-keys.d.ts.map +1 -0
- package/dist/model/boundary-rule-input-keys.js +29 -0
- package/dist/model/boundary-rule-input.d.ts +23 -0
- package/dist/model/boundary-rule-input.d.ts.map +1 -0
- package/dist/model/boundary-rule-input.js +1 -0
- package/dist/model/boundary-rule-key-problems.d.ts +11 -0
- package/dist/model/boundary-rule-key-problems.d.ts.map +1 -0
- package/dist/model/boundary-rule-key-problems.js +36 -0
- package/dist/model/boundary-rule-marker-problems.d.ts +26 -0
- package/dist/model/boundary-rule-marker-problems.d.ts.map +1 -0
- package/dist/model/boundary-rule-marker-problems.js +94 -0
- package/dist/model/boundary-rule-scope.d.ts +88 -0
- package/dist/model/boundary-rule-scope.d.ts.map +1 -0
- package/dist/model/boundary-rule-scope.js +175 -0
- package/dist/model/boundary-rule.d.ts +120 -5
- package/dist/model/boundary-rule.d.ts.map +1 -1
- package/dist/model/boundary-rule.js +148 -1
- package/dist/model/boundary-unit-problem-issue.d.ts +9 -0
- package/dist/model/boundary-unit-problem-issue.d.ts.map +1 -0
- package/dist/model/boundary-unit-problem-issue.js +16 -0
- package/dist/model/normalize-boundary-rule.d.ts +21 -0
- package/dist/model/normalize-boundary-rule.d.ts.map +1 -0
- package/dist/model/normalize-boundary-rule.js +62 -0
- package/dist/policy/evaluate-policy.d.ts +80 -3
- package/dist/policy/evaluate-policy.d.ts.map +1 -1
- package/dist/policy/evaluate-policy.js +152 -19
- package/dist/policy/i-policy-rule-liveness.d.ts +15 -0
- package/dist/policy/i-policy-rule-liveness.d.ts.map +1 -0
- package/dist/policy/i-policy-rule-liveness.js +1 -0
- package/dist/policy/run-policy.d.ts +1 -1
- package/dist/policy/run-policy.d.ts.map +1 -1
- package/dist/policy/run-policy.js +171 -21
- package/dist/registry/load-boundary-rules.d.ts +29 -1
- package/dist/registry/load-boundary-rules.d.ts.map +1 -1
- package/dist/registry/load-boundary-rules.js +38 -8
- package/dist/scan/glob.d.ts +90 -0
- package/dist/scan/glob.d.ts.map +1 -1
- package/dist/scan/glob.js +205 -0
- package/dist/scan/i-glob-unit-measure.d.ts +22 -0
- package/dist/scan/i-glob-unit-measure.d.ts.map +1 -0
- package/dist/scan/i-glob-unit-measure.js +1 -0
- package/dist/scan/import-pattern.d.ts +109 -0
- package/dist/scan/import-pattern.d.ts.map +1 -0
- package/dist/scan/import-pattern.js +191 -0
- package/dist/scan/node-builtin-package-names.d.ts +13 -0
- package/dist/scan/node-builtin-package-names.d.ts.map +1 -0
- package/dist/scan/node-builtin-package-names.js +25 -0
- package/dist/scan/scan-imports.d.ts +36 -3
- package/dist/scan/scan-imports.d.ts.map +1 -1
- package/dist/scan/scan-imports.js +114 -45
- package/dist/util/blank-run-hazard-finding.d.ts +34 -0
- package/dist/util/blank-run-hazard-finding.d.ts.map +1 -0
- package/dist/util/blank-run-hazard-finding.js +1 -0
- package/dist/util/blank-run-hazard.d.ts +29 -0
- package/dist/util/blank-run-hazard.d.ts.map +1 -0
- package/dist/util/blank-run-hazard.js +450 -0
- package/dist/util/dead-glob-units.d.ts +46 -0
- package/dist/util/dead-glob-units.d.ts.map +1 -0
- package/dist/util/dead-glob-units.js +116 -0
- package/dist/util/glob-list-liveness-input.d.ts +31 -0
- package/dist/util/glob-list-liveness-input.d.ts.map +1 -0
- package/dist/util/glob-list-liveness-input.js +65 -0
- package/dist/util/i-dead-glob-unit.d.ts +24 -0
- package/dist/util/i-dead-glob-unit.d.ts.map +1 -0
- package/dist/util/i-dead-glob-unit.js +1 -0
- package/dist/util/i-glob-list-units.d.ts +25 -0
- package/dist/util/i-glob-list-units.d.ts.map +1 -0
- package/dist/util/i-glob-list-units.js +1 -0
- package/dist/util/i-glob-liveness-list.d.ts +23 -0
- package/dist/util/i-glob-liveness-list.d.ts.map +1 -0
- package/dist/util/i-glob-liveness-list.js +1 -0
- package/dist/util/i-glob-liveness-request.d.ts +11 -0
- package/dist/util/i-glob-liveness-request.d.ts.map +1 -0
- package/dist/util/i-glob-liveness-request.js +1 -0
- package/dist/util/i-glob-negation.d.ts +13 -0
- package/dist/util/i-glob-negation.d.ts.map +1 -0
- package/dist/util/i-glob-negation.js +1 -0
- package/dist/util/matched-files.d.ts +22 -0
- package/dist/util/matched-files.d.ts.map +1 -0
- package/dist/util/matched-files.js +1 -0
- package/dist/util/negation-cause.d.ts +15 -0
- package/dist/util/negation-cause.d.ts.map +1 -0
- package/dist/util/negation-cause.js +21 -0
- package/dist/util/plane-scan-exclude-dirs.d.ts +17 -0
- package/dist/util/plane-scan-exclude-dirs.d.ts.map +1 -0
- package/dist/util/plane-scan-exclude-dirs.js +22 -0
- package/dist/util/read-glob-list-liveness.d.ts +20 -0
- package/dist/util/read-glob-list-liveness.d.ts.map +1 -0
- package/dist/util/read-glob-list-liveness.js +20 -0
- package/dist/util/read-scope-coverage.d.ts +90 -0
- package/dist/util/read-scope-coverage.d.ts.map +1 -0
- package/dist/util/read-scope-coverage.js +173 -0
- package/dist/util/read-scope.d.ts +14 -0
- package/dist/util/read-scope.d.ts.map +1 -0
- package/dist/util/read-scope.js +1 -0
- package/dist/util/read-selected-files.d.ts +16 -0
- package/dist/util/read-selected-files.d.ts.map +1 -0
- package/dist/util/read-selected-files.js +25 -0
- package/dist/util/settle-glob-lists.d.ts +12 -0
- package/dist/util/settle-glob-lists.d.ts.map +1 -0
- package/dist/util/settle-glob-lists.js +13 -0
- package/dist/util/unread-file-reason.d.ts +26 -0
- package/dist/util/unread-file-reason.d.ts.map +1 -0
- package/dist/util/unread-file-reason.js +26 -0
- package/dist/util/unread-file.d.ts +10 -0
- package/dist/util/unread-file.d.ts.map +1 -0
- package/dist/util/unread-file.js +1 -0
- package/dist/util/walk-files.d.ts +74 -10
- package/dist/util/walk-files.d.ts.map +1 -1
- package/dist/util/walk-files.js +137 -31
- package/dist/wiring/evaluate-wiring.d.ts +79 -5
- package/dist/wiring/evaluate-wiring.d.ts.map +1 -1
- package/dist/wiring/evaluate-wiring.js +267 -12
- package/dist/wiring/explain-wiring.d.ts +49 -5
- package/dist/wiring/explain-wiring.d.ts.map +1 -1
- package/dist/wiring/explain-wiring.js +118 -10
- package/dist/wiring/i-idiom-role-coverage.d.ts +24 -0
- package/dist/wiring/i-idiom-role-coverage.d.ts.map +1 -0
- package/dist/wiring/i-idiom-role-coverage.js +1 -0
- package/dist/wiring/i-registration-query-verdict.d.ts +38 -0
- package/dist/wiring/i-registration-query-verdict.d.ts.map +1 -0
- package/dist/wiring/i-registration-query-verdict.js +1 -0
- package/dist/wiring/i-registration-roles.d.ts +71 -0
- package/dist/wiring/i-registration-roles.d.ts.map +1 -0
- package/dist/wiring/i-registration-roles.js +1 -0
- package/dist/wiring/measure-idiom-role-coverage.d.ts +12 -0
- package/dist/wiring/measure-idiom-role-coverage.d.ts.map +1 -0
- package/dist/wiring/measure-idiom-role-coverage.js +20 -0
- package/dist/wiring/measure-registration-roles.d.ts +25 -0
- package/dist/wiring/measure-registration-roles.d.ts.map +1 -0
- package/dist/wiring/measure-registration-roles.js +124 -0
- package/dist/wiring/plan-wiring-fix.js +2 -2
- package/dist/wiring/registration-graph.d.ts +12 -0
- package/dist/wiring/registration-graph.d.ts.map +1 -1
- package/dist/wiring/registration-graph.js +16 -5
- package/dist/wiring/registration-query-verdict.d.ts +23 -0
- package/dist/wiring/registration-query-verdict.d.ts.map +1 -0
- package/dist/wiring/registration-query-verdict.js +118 -0
- package/dist/wiring/registry-query.d.ts +8 -0
- package/dist/wiring/registry-query.d.ts.map +1 -1
- package/dist/wiring/registry-query.js +12 -5
- package/dist/wiring/scan-wiring-files.d.ts +4 -2
- package/dist/wiring/scan-wiring-files.d.ts.map +1 -1
- package/dist/wiring/scan-wiring-files.js +52 -15
- package/dist/wiring/sink-imports.d.ts +11 -0
- package/dist/wiring/sink-imports.d.ts.map +1 -1
- package/dist/wiring/sink-imports.js +11 -2
- package/dist/wiring/trace-literal.d.ts +6 -0
- package/dist/wiring/trace-literal.d.ts.map +1 -1
- package/dist/wiring/trace-literal.js +5 -2
- package/dist/wiring/wiring-labeled-sources.d.ts +12 -0
- package/dist/wiring/wiring-labeled-sources.d.ts.map +1 -0
- package/dist/wiring/wiring-labeled-sources.js +20 -0
- package/package.json +2 -2
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import type { IWiringSource } from '@shrkcrft/core';
|
|
2
|
+
import type { IUnreadFile } from '../util/unread-file.js';
|
|
2
3
|
/** The value an extractor-backed baseline computes, ready to diff or commit. */
|
|
3
4
|
export interface IExtractorCompute {
|
|
4
5
|
/** Canonical serialization: a pretty-printed JSON array of sorted, unique ids. */
|
|
5
6
|
readonly text: string;
|
|
6
7
|
readonly ids: readonly string[];
|
|
8
|
+
/** Matched files the compute READ. */
|
|
7
9
|
readonly filesScanned: number;
|
|
10
|
+
/**
|
|
11
|
+
* Matched files the reader did NOT read (over the read cap, or unreadable).
|
|
12
|
+
* The recompute is incomplete without them: an id only they hold is missing
|
|
13
|
+
* from `ids`, so the baseline's coverage names them and never reads clean.
|
|
14
|
+
*/
|
|
15
|
+
readonly unread: readonly IUnreadFile[];
|
|
8
16
|
/** Set when the source is misconfigured (never throws). */
|
|
9
17
|
readonly error?: string;
|
|
10
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compute-baseline.d.ts","sourceRoot":"","sources":["../../src/baseline/compute-baseline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"compute-baseline.d.ts","sourceRoot":"","sources":["../../src/baseline/compute-baseline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAI1D,gFAAgF;AAChF,MAAM,WAAW,iBAAiB;IAChC,kFAAkF;IAClF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,sCAAsC;IACtC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,CAAC;IACxC,2DAA2D;IAC3D,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,4BAA4B,CAC1C,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,aAAa,EACrB,WAAW,GAAE,SAAS,MAAM,EAAO,GAClC,iBAAiB,CAiBnB"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { readMatchingFiles } from "../util/walk-files.js";
|
|
1
|
+
import { readSelectedFiles } from "../util/read-selected-files.js";
|
|
3
2
|
import { loadTsconfigPaths } from "../scan/tsconfig-aliases.js";
|
|
4
3
|
import { extractTokens } from "../extract/extract-tokens.js";
|
|
5
4
|
/**
|
|
@@ -14,18 +13,20 @@ import { extractTokens } from "../extract/extract-tokens.js";
|
|
|
14
13
|
* from a pack, unlike a `command` one.
|
|
15
14
|
*/
|
|
16
15
|
export function computeBaselineFromExtractor(projectRoot, source, excludeDirs = []) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
// The files the source's list SELECTS — a `!` entry excludes, so an id only
|
|
17
|
+
// an excluded file holds is not in the recomputed ledger.
|
|
18
|
+
const selected = readSelectedFiles(projectRoot, source.files ?? [], new Set(excludeDirs));
|
|
19
|
+
const files = [...selected.files.entries()].map(([path, content]) => ({ path, content }));
|
|
20
|
+
const unread = selected.unread;
|
|
21
21
|
const res = extractTokens(source, files, { tsconfigPaths: loadTsconfigPaths(projectRoot) });
|
|
22
22
|
if (res.error) {
|
|
23
|
-
return { text: '[]', ids: [], filesScanned: files.length, error: res.error };
|
|
23
|
+
return { text: '[]', ids: [], filesScanned: files.length, unread, error: res.error };
|
|
24
24
|
}
|
|
25
25
|
const ids = [...new Set(res.sites.map((s) => s.token))].sort();
|
|
26
26
|
return {
|
|
27
27
|
text: JSON.stringify(ids, null, 2) + '\n',
|
|
28
28
|
ids,
|
|
29
29
|
filesScanned: files.length,
|
|
30
|
+
unread,
|
|
30
31
|
};
|
|
31
32
|
}
|
|
@@ -65,4 +65,32 @@ export declare function diffBaseline(rule: IBaselineRule, committed: string, cur
|
|
|
65
65
|
export declare function baselineFails(rule: IBaselineRule, diff: IBaselineDiff): boolean;
|
|
66
66
|
/** Entry count for a side, matching the comparison mode. */
|
|
67
67
|
export declare function baselineCount(rule: IBaselineRule, text: string): number;
|
|
68
|
+
/** The verdict of a `mode: 'ceiling'` baseline: one measured number vs its limit. */
|
|
69
|
+
export interface ICeilingVerdict {
|
|
70
|
+
readonly value: number;
|
|
71
|
+
readonly ceiling: number;
|
|
72
|
+
readonly direction: 'at-most' | 'at-least';
|
|
73
|
+
readonly failed: boolean;
|
|
74
|
+
/** Headroom left (`at-most`) or shortfall (`at-least`); negative when failing. */
|
|
75
|
+
readonly slack: number;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Measured value for a ceiling rule's computed text.
|
|
79
|
+
*
|
|
80
|
+
* A `command` compute whose stdout IS a number (`wc -l`, a bundle size, a
|
|
81
|
+
* warning count) reports that number; anything else is measured by entry count,
|
|
82
|
+
* the same way a ledger counts. Guessing wrong in either direction would make
|
|
83
|
+
* the ratchet silently measure something other than what the author wrote, so
|
|
84
|
+
* the rule is one line and stated here rather than inferred per call site.
|
|
85
|
+
*/
|
|
86
|
+
export declare function ceilingValue(rule: IBaselineRule, text: string): number;
|
|
87
|
+
/**
|
|
88
|
+
* Compare a measured value against the rule's declared ceiling.
|
|
89
|
+
*
|
|
90
|
+
* `at-most` is the default because the shape people hand-roll is almost always
|
|
91
|
+
* a debt ratchet — "no more than N of X, and never more". A floor (`at-least`)
|
|
92
|
+
* is the same engine with the comparison flipped, so a coverage ratchet does
|
|
93
|
+
* not need a second gate.
|
|
94
|
+
*/
|
|
95
|
+
export declare function evaluateCeiling(rule: IBaselineRule, value: number): ICeilingVerdict;
|
|
68
96
|
//# sourceMappingURL=diff-baseline.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff-baseline.d.ts","sourceRoot":"","sources":["../../src/baseline/diff-baseline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAIpD,eAAO,MAAM,eAAe,EAAG,wBAAiC,CAAC;AAEjE,uCAAuC;AACvC,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG,aAAa,GAAG,gBAAgB,CAAC;AAEjF;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC;AAEvE,MAAM,WAAW,aAAa;IAC5B,6DAA6D;IAC7D,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,sDAAsD;IACtD,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,wCAAwC;IACxC,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;IACnC,gDAAgD;IAChD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,wDAAwD;IACxD,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,gBAAgB,GAAG,WAAW,CAA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AAe,EAAE,CAAC;IAC7C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,QAAQ,GAAG,UAAU,CAAC;CAClD;AAwCD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,aAAa,EACnB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,GACd,aAAa,CA4Bf;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,aAAa,GAAG,OAAO,CAU/E;AAED,4DAA4D;AAC5D,wBAAgB,aAAa,CAAC,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAOvE;AAED,qFAAqF;AACrF,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,UAAU,CAAC;IAC3C,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,kFAAkF;IAClF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAItE;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,GAAG,eAAe,CAKnF"}
|
|
@@ -108,3 +108,32 @@ export function baselineCount(rule, text) {
|
|
|
108
108
|
const pair = canonicalizePair(text, text, form);
|
|
109
109
|
return textEntries(pair.expected.text).length;
|
|
110
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* Measured value for a ceiling rule's computed text.
|
|
113
|
+
*
|
|
114
|
+
* A `command` compute whose stdout IS a number (`wc -l`, a bundle size, a
|
|
115
|
+
* warning count) reports that number; anything else is measured by entry count,
|
|
116
|
+
* the same way a ledger counts. Guessing wrong in either direction would make
|
|
117
|
+
* the ratchet silently measure something other than what the author wrote, so
|
|
118
|
+
* the rule is one line and stated here rather than inferred per call site.
|
|
119
|
+
*/
|
|
120
|
+
export function ceilingValue(rule, text) {
|
|
121
|
+
const trimmed = text.trim();
|
|
122
|
+
if (/^-?\d+(\.\d+)?$/.test(trimmed))
|
|
123
|
+
return Number(trimmed);
|
|
124
|
+
return baselineCount(rule, text);
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Compare a measured value against the rule's declared ceiling.
|
|
128
|
+
*
|
|
129
|
+
* `at-most` is the default because the shape people hand-roll is almost always
|
|
130
|
+
* a debt ratchet — "no more than N of X, and never more". A floor (`at-least`)
|
|
131
|
+
* is the same engine with the comparison flipped, so a coverage ratchet does
|
|
132
|
+
* not need a second gate.
|
|
133
|
+
*/
|
|
134
|
+
export function evaluateCeiling(rule, value) {
|
|
135
|
+
const ceiling = rule.ceiling ?? 0;
|
|
136
|
+
const direction = rule.direction === 'at-least' ? 'at-least' : 'at-most';
|
|
137
|
+
const slack = direction === 'at-most' ? ceiling - value : value - ceiling;
|
|
138
|
+
return { value, ceiling, direction, failed: slack < 0, slack };
|
|
139
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type IUnitLiveness } from '@shrkcrft/core';
|
|
2
|
+
import type { IBoundaryUnitFinding } from './i-boundary-unit-finding.js';
|
|
3
|
+
/**
|
|
4
|
+
* A settled boundary unit as its report row. Its `reason` is THE per-unit line
|
|
5
|
+
* (`formatUnitLiveness`, `@shrkcrft/core` — `DEAD_SELECTOR_CAUSES` appended to an
|
|
6
|
+
* unmarked unit that matches nothing) without the selector the row names, so no
|
|
7
|
+
* surface words a state itself.
|
|
8
|
+
*/
|
|
9
|
+
export declare function boundaryUnitFinding(ruleId: string, unit: IUnitLiveness): IBoundaryUnitFinding;
|
|
10
|
+
//# sourceMappingURL=boundary-unit-finding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boundary-unit-finding.d.ts","sourceRoot":"","sources":["../../src/evaluate/boundary-unit-finding.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAExE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEzE;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,GAAG,oBAAoB,CAY7F"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { formatUnitLiveness } from '@shrkcrft/core';
|
|
2
|
+
import { boundaryUnitKind } from "./boundary-unit-kind.js";
|
|
3
|
+
/**
|
|
4
|
+
* A settled boundary unit as its report row. Its `reason` is THE per-unit line
|
|
5
|
+
* (`formatUnitLiveness`, `@shrkcrft/core` — `DEAD_SELECTOR_CAUSES` appended to an
|
|
6
|
+
* unmarked unit that matches nothing) without the selector the row names, so no
|
|
7
|
+
* surface words a state itself.
|
|
8
|
+
*/
|
|
9
|
+
export function boundaryUnitFinding(ruleId, unit) {
|
|
10
|
+
const line = formatUnitLiveness(unit);
|
|
11
|
+
const lead = `${unit.label} — `;
|
|
12
|
+
return {
|
|
13
|
+
ruleId,
|
|
14
|
+
unit: boundaryUnitKind(unit.list, unit.unit),
|
|
15
|
+
selector: unit.unit,
|
|
16
|
+
state: unit.state,
|
|
17
|
+
reason: line.startsWith(lead) ? line.slice(lead.length) : unit.message,
|
|
18
|
+
...(unit.mark?.reason !== undefined ? { markReason: unit.mark.reason } : {}),
|
|
19
|
+
...(unit.mark?.packageName !== undefined ? { packageName: unit.mark.packageName } : {}),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { IBoundaryDeadUnit } from './evaluate-boundaries.js';
|
|
2
|
+
/**
|
|
3
|
+
* The boundary JSON's `unit` word for a settled unit's list — unchanged since
|
|
4
|
+
* round 11: a `from` negation reports as `exemptFiles`, the exemption it is.
|
|
5
|
+
*/
|
|
6
|
+
export declare function boundaryUnitKind(list: string, unit: string): IBoundaryDeadUnit['unit'];
|
|
7
|
+
//# sourceMappingURL=boundary-unit-kind.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boundary-unit-kind.d.ts","sourceRoot":"","sources":["../../src/evaluate/boundary-unit-kind.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAElE;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAKtF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BoundaryMarkableList } from "../model/boundary-markable-list.js";
|
|
2
|
+
/**
|
|
3
|
+
* The boundary JSON's `unit` word for a settled unit's list — unchanged since
|
|
4
|
+
* round 11: a `from` negation reports as `exemptFiles`, the exemption it is.
|
|
5
|
+
*/
|
|
6
|
+
export function boundaryUnitKind(list, unit) {
|
|
7
|
+
if (list === BoundaryMarkableList.From)
|
|
8
|
+
return unit.startsWith('!') ? 'exemptFiles' : 'from';
|
|
9
|
+
if (list === BoundaryMarkableList.ForbiddenImports)
|
|
10
|
+
return 'forbidden';
|
|
11
|
+
if (list === BoundaryMarkableList.AllowedImports)
|
|
12
|
+
return 'allowed';
|
|
13
|
+
return 'exemptFiles';
|
|
14
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { UnitDeadCause, type IUnitLiveness, type IUnitStateLists, type IVerdictCoverage, type UnitLivenessState } from '@shrkcrft/core';
|
|
2
|
+
import type { BoundaryMatchKind, BoundarySeverity, IBoundaryRule, IBoundaryRuleException, IBoundaryScopeExemption } from '../model/boundary-rule.js';
|
|
2
3
|
import type { IImportScanResult } from '../scan/scan-imports.js';
|
|
3
4
|
import { type ITsconfigPathsMap } from '../scan/tsconfig-aliases.js';
|
|
4
5
|
export interface IBoundaryViolation {
|
|
@@ -12,6 +13,11 @@ export interface IBoundaryViolation {
|
|
|
12
13
|
matchedFrom: string;
|
|
13
14
|
/** Pattern from `forbiddenImports` that matched the specifier, if any. */
|
|
14
15
|
matchedForbidden?: string;
|
|
16
|
+
/**
|
|
17
|
+
* `subpath` when only the package semantics reached the specifier (a deeper
|
|
18
|
+
* import of a package the pattern names — round 11, 1.5), `exact` otherwise.
|
|
19
|
+
*/
|
|
20
|
+
matchKind?: BoundaryMatchKind;
|
|
15
21
|
/** When triggered by allowedImports = [..] (none matched). */
|
|
16
22
|
notAllowed?: boolean;
|
|
17
23
|
/** When the match came from an alias-resolved candidate path. */
|
|
@@ -28,21 +34,242 @@ export interface IEvaluateOptions {
|
|
|
28
34
|
* matched against rule patterns alongside the original specifier.
|
|
29
35
|
*/
|
|
30
36
|
tsconfigPaths?: ITsconfigPathsMap;
|
|
37
|
+
/**
|
|
38
|
+
* Package names the workspace knows (dependencies, workspace package names,
|
|
39
|
+
* node builtins). A forbidden pattern naming one is RESOLVABLE even when
|
|
40
|
+
* nothing imports it today — a deliberate "never adopt X" guard is not a
|
|
41
|
+
* dead unit. The orchestrator supplies this; the evaluator stays pure.
|
|
42
|
+
*/
|
|
43
|
+
knownPackages?: readonly string[];
|
|
44
|
+
}
|
|
45
|
+
/** A rule's outcome: `skipped` = its scope matched no governed file (it enforced nothing). */
|
|
46
|
+
export type BoundaryRuleStatus = 'passed' | 'failed' | 'skipped';
|
|
47
|
+
/**
|
|
48
|
+
* One selector unit that matches nothing (round 11, 1.3) — a scope glob gone
|
|
49
|
+
* dead after a rename, a forbidden pattern that can never match (a typo, a
|
|
50
|
+
* retired package, or a target that does not exist yet), an exemption that
|
|
51
|
+
* exempts nothing. The rule around it can keep reporting "evaluated" while the
|
|
52
|
+
* unit silently stopped enforcing; this is the per-unit signal. The same shape
|
|
53
|
+
* as the other planes' dead units.
|
|
54
|
+
*
|
|
55
|
+
* Round 13: an UNMARKED unit only — the settled `.dead` of `settleBoundaryRule`.
|
|
56
|
+
* A unit marked `{ pattern, expectEmpty: true }` whose target does not exist is
|
|
57
|
+
* intended-empty (accepted and printed), one whose target exists went live; it
|
|
58
|
+
* is never here.
|
|
59
|
+
*/
|
|
60
|
+
export interface IBoundaryDeadUnit {
|
|
61
|
+
readonly ruleId: string;
|
|
62
|
+
readonly unit: 'from' | 'forbidden' | 'allowed' | 'exemptFiles';
|
|
63
|
+
readonly selector: string;
|
|
64
|
+
/**
|
|
65
|
+
* THE per-unit sentence (`formatUnitLiveness`, `@shrkcrft/core`) without the
|
|
66
|
+
* selector: what was observed, then — for a unit that simply matches nothing —
|
|
67
|
+
* `DEAD_SELECTOR_CAUSES` (typo, retired target, or a target that does not
|
|
68
|
+
* exist yet).
|
|
69
|
+
*/
|
|
70
|
+
readonly reason: string;
|
|
71
|
+
/**
|
|
72
|
+
* Set when the unit is dead by its SHAPE alone (round 12): `defect` — an
|
|
73
|
+
* `importPatternDefect` (a `!`, an empty pattern, a trailing `/` under
|
|
74
|
+
* package semantics); `shadowed` — an `allowedImports` entry a forbidden
|
|
75
|
+
* sibling covers, so it can never admit an import. Proved without reading a
|
|
76
|
+
* file, so no unread file can refute it, and never markable. Unset for
|
|
77
|
+
* "matches nothing".
|
|
78
|
+
*/
|
|
79
|
+
readonly cause?: UnitDeadCause;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* A violation the rule MARKED rather than reported — an exempt file, or an
|
|
83
|
+
* adjudicated exception. Counted and listed, never silently dropped: a
|
|
84
|
+
* silently-dropped exemption is indistinguishable from a stale glob.
|
|
85
|
+
*/
|
|
86
|
+
export interface IBoundarySuppressedViolation {
|
|
87
|
+
readonly violation: IBoundaryViolation;
|
|
88
|
+
readonly reason: 'exempt-file' | 'exception';
|
|
89
|
+
/** The exemption glob, for `exempt-file`. */
|
|
90
|
+
readonly glob?: string;
|
|
91
|
+
/** The exception that allowed the edge, for `exception`. */
|
|
92
|
+
readonly exception?: IBoundaryRuleException;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* An exception that suppressed NO real edge in this run. It fails the run: an
|
|
96
|
+
* exception list that cannot rot loudly rots into permanent silent width.
|
|
97
|
+
*/
|
|
98
|
+
export interface IBoundaryStaleException {
|
|
99
|
+
readonly ruleId: string;
|
|
100
|
+
/** Position in the rule's `exceptions[]`. */
|
|
101
|
+
readonly index: number;
|
|
102
|
+
readonly exception: IBoundaryRuleException;
|
|
103
|
+
readonly severity: 'error';
|
|
104
|
+
readonly message: string;
|
|
105
|
+
}
|
|
106
|
+
/** Files one glob matched. */
|
|
107
|
+
export interface IBoundaryGlobCount {
|
|
108
|
+
readonly glob: string;
|
|
109
|
+
/** Governed (non-exempt) files the glob matched. */
|
|
110
|
+
readonly files: number;
|
|
111
|
+
/** The settled state of the glob as a selector unit (round 13): live, dead, intended-empty, went-live, unproven. */
|
|
112
|
+
readonly state?: UnitLivenessState;
|
|
113
|
+
}
|
|
114
|
+
/** What one forbidden pattern hit, in scope and anywhere. */
|
|
115
|
+
export interface IBoundaryPatternCount {
|
|
116
|
+
readonly pattern: string;
|
|
117
|
+
/** Violations it produced in this rule's governed files. */
|
|
118
|
+
readonly hitsInScope: number;
|
|
119
|
+
/** Distinct specifiers (literal or alias-resolved) it matches anywhere in the scan. */
|
|
120
|
+
readonly hitsAnywhere: number;
|
|
121
|
+
/** Can it ever match? (a hit anywhere, a known package, an alias, a file) */
|
|
122
|
+
readonly resolvable: boolean;
|
|
123
|
+
/** For `forbiddenMatch: 'exact'`: specifiers only the package semantics would have reached. */
|
|
124
|
+
readonly subpathHitsAnywhere?: number;
|
|
125
|
+
/**
|
|
126
|
+
* A sibling forbidden pattern of the same rule that already covers every
|
|
127
|
+
* import this one matches (`@scope/pkg/**` next to `@scope/pkg` under package
|
|
128
|
+
* semantics) — redundant, safe to delete. INFO: never a dead unit, never a
|
|
129
|
+
* verdict change (round 12, R12-5.6; from `boundaryPatternOverlaps`).
|
|
130
|
+
*/
|
|
131
|
+
readonly subsumedBy?: string;
|
|
132
|
+
/** The settled state of the pattern as a selector unit (round 13). */
|
|
133
|
+
readonly state?: UnitLivenessState;
|
|
134
|
+
}
|
|
135
|
+
/** Per-rule coverage: what each unit of the rule actually matched. */
|
|
136
|
+
export interface IBoundaryRuleCoverage {
|
|
137
|
+
readonly ruleId: string;
|
|
138
|
+
readonly severity: BoundarySeverity;
|
|
139
|
+
readonly status: BoundaryRuleStatus;
|
|
140
|
+
/** Why the rule checked nothing, when `skipped`. */
|
|
141
|
+
readonly skipReason?: string;
|
|
142
|
+
/** A skip that FAILS the run (`failOnEmpty`, on by default for `error` rules). */
|
|
143
|
+
readonly failedOnEmpty?: boolean;
|
|
144
|
+
/**
|
|
145
|
+
* The rule settled IntendedEmpty (round 13, core `settleRuleEmptiness`):
|
|
146
|
+
* every `from` inclusion is marked `expectEmpty` and it matched no file — it
|
|
147
|
+
* examined 0 files, so it is ACCEPTED (its coverage is the acceptance), never
|
|
148
|
+
* counted as evaluated (`rulesEvaluated`, `boundaryRulesEvaluated`).
|
|
149
|
+
*/
|
|
150
|
+
readonly acceptedAsIntendedEmpty?: true;
|
|
151
|
+
/** Governed files: inside `from`, not exempt. */
|
|
152
|
+
readonly filesInScope: number;
|
|
153
|
+
/** Inside `from` but exempt — scanned, violations suppressed. */
|
|
154
|
+
readonly exemptFilesInScope: number;
|
|
155
|
+
/** Import edges read from governed files. */
|
|
156
|
+
readonly edgesInScope: number;
|
|
157
|
+
/** Unsuppressed violations. */
|
|
158
|
+
readonly violations: number;
|
|
159
|
+
readonly suppressed: number;
|
|
160
|
+
readonly fromGlobs: readonly IBoundaryGlobCount[];
|
|
161
|
+
readonly forbidden: readonly IBoundaryPatternCount[];
|
|
162
|
+
/**
|
|
163
|
+
* `shadowedBy`: a forbidden pattern of the same rule covering every import
|
|
164
|
+
* this allowance matches — forbidden is checked first, so it can never admit
|
|
165
|
+
* one (its dead unit carries `cause: 'shadowed'`; round 12, R12-5.3).
|
|
166
|
+
*/
|
|
167
|
+
readonly allowed: readonly {
|
|
168
|
+
readonly pattern: string;
|
|
169
|
+
readonly hitsAnywhere: number;
|
|
170
|
+
readonly shadowedBy?: string;
|
|
171
|
+
readonly state?: UnitLivenessState;
|
|
172
|
+
}[];
|
|
173
|
+
readonly exemptions: readonly (IBoundaryScopeExemption & {
|
|
174
|
+
readonly files: number;
|
|
175
|
+
readonly state?: UnitLivenessState;
|
|
176
|
+
})[];
|
|
177
|
+
readonly exceptions: readonly (IBoundaryRuleException & {
|
|
178
|
+
readonly matched: number;
|
|
179
|
+
})[];
|
|
180
|
+
readonly deadUnits: readonly IBoundaryDeadUnit[];
|
|
181
|
+
/**
|
|
182
|
+
* Every judged selector unit, settled (round 13): the observation, its state
|
|
183
|
+
* and its one sentence. The orchestrator's unread re-settle reads it, and
|
|
184
|
+
* `--fail-on-dead-units` judges each unit through core's `selectorUnitFails`.
|
|
185
|
+
*/
|
|
186
|
+
readonly unitLiveness?: readonly IUnitLiveness[];
|
|
187
|
+
/**
|
|
188
|
+
* The verdict coverage the gate envelope settles on: scope globs that reached
|
|
189
|
+
* a governed file, of the scope globs the rule JUDGES (a marked intended-empty
|
|
190
|
+
* glob is accepted by {@link unitAcceptance}, not judged) — for a rule whose
|
|
191
|
+
* every `from` inclusion is intended-empty and that matched no file, the
|
|
192
|
+
* acceptance itself. Engine-owned, like the wiring and policy planes' — a
|
|
193
|
+
* surface reads it, never recomputes it.
|
|
194
|
+
*/
|
|
195
|
+
readonly coverage: IVerdictCoverage;
|
|
196
|
+
/**
|
|
197
|
+
* Settle record B (round 13): the rule's intended-empty units,
|
|
198
|
+
* `acceptedBy: 'expectEmpty'`. Folded beside {@link coverage} into the ONE
|
|
199
|
+
* verdict settle (`ruleVerdictRecords`), so it prints `accepted by
|
|
200
|
+
* expectEmpty: …` at exit 0 and can never cover a dead unit.
|
|
201
|
+
*/
|
|
202
|
+
readonly unitAcceptance?: IVerdictCoverage;
|
|
203
|
+
/** The rule's dead / intended-empty / went-live unit lines (`unitStateLists`), when it has any. */
|
|
204
|
+
readonly units?: IUnitStateLists;
|
|
31
205
|
}
|
|
32
206
|
export interface IEvaluateResult {
|
|
207
|
+
/** Rules selected for evaluation (after `onlyRuleId`). */
|
|
208
|
+
rulesConfigured: number;
|
|
209
|
+
/**
|
|
210
|
+
* Rules that examined at least one governed file — never a skipped rule, and
|
|
211
|
+
* never one accepted as intended-empty (it examined 0 files; round 13 —
|
|
212
|
+
* counted in {@link rulesAcceptedEmpty} instead).
|
|
213
|
+
*/
|
|
33
214
|
rulesEvaluated: number;
|
|
215
|
+
/**
|
|
216
|
+
* Rules accepted as intended-empty (round 13): every `from` inclusion marked
|
|
217
|
+
* `expectEmpty`, no file matched — `acceptedAsIntendedEmpty` on its coverage.
|
|
218
|
+
* Printed apart from the evaluated count (`N evaluated, M accepted as
|
|
219
|
+
* intended-empty`).
|
|
220
|
+
*/
|
|
221
|
+
rulesAcceptedEmpty: number;
|
|
34
222
|
edgesEvaluated: number;
|
|
223
|
+
/** Source files the scopes were counted against. */
|
|
224
|
+
filesScanned: number;
|
|
225
|
+
/**
|
|
226
|
+
* Where that file list came from: the scan's own `files` (every scanned
|
|
227
|
+
* file), or — for a hand-built scan without one — the files that appear in
|
|
228
|
+
* `edges`, which cannot see import-free files.
|
|
229
|
+
*/
|
|
230
|
+
fileUniverse: 'scan' | 'edges';
|
|
35
231
|
violations: IBoundaryViolation[];
|
|
36
|
-
/** Quick counts grouped by severity. */
|
|
232
|
+
/** Quick counts grouped by severity (unsuppressed violations only). */
|
|
37
233
|
counts: {
|
|
38
234
|
error: number;
|
|
39
235
|
warning: number;
|
|
40
236
|
info: number;
|
|
41
237
|
};
|
|
238
|
+
suppressed: IBoundarySuppressedViolation[];
|
|
239
|
+
suppressedCounts: {
|
|
240
|
+
exemptFile: number;
|
|
241
|
+
exception: number;
|
|
242
|
+
};
|
|
243
|
+
staleExceptions: IBoundaryStaleException[];
|
|
244
|
+
coverage: IBoundaryRuleCoverage[];
|
|
245
|
+
skipped: {
|
|
246
|
+
ruleId: string;
|
|
247
|
+
reason: string;
|
|
248
|
+
severity: BoundarySeverity;
|
|
249
|
+
failed: boolean;
|
|
250
|
+
}[];
|
|
251
|
+
deadUnits: IBoundaryDeadUnit[];
|
|
252
|
+
/**
|
|
253
|
+
* Rules the engine entry could not normalise (round 13) — a hand-built rule
|
|
254
|
+
* with a malformed `expectEmpty` marker, which every loader refuses first.
|
|
255
|
+
* Never evaluated and never a crash: each is a skipped rule that fails the run.
|
|
256
|
+
*/
|
|
257
|
+
invalidRules?: {
|
|
258
|
+
ruleId: string;
|
|
259
|
+
problems: readonly string[];
|
|
260
|
+
}[];
|
|
42
261
|
}
|
|
43
262
|
/**
|
|
44
263
|
* Evaluate every rule against every scanned edge. Returns the list of
|
|
45
|
-
* violations + counts
|
|
264
|
+
* violations + counts, and — round 11 — what every rule and every selector
|
|
265
|
+
* unit actually matched, so a rule that enforced nothing can never read as
|
|
266
|
+
* evaluated. Pure function — no I/O.
|
|
267
|
+
*
|
|
268
|
+
* Round 13: each rule is normalised IDEMPOTENTLY at entry
|
|
269
|
+
* (`normalizeBoundaryRule` — a loaded rule comes back unchanged), so a
|
|
270
|
+
* hand-built rule with a `{ pattern, expectEmpty: true }` entry is honoured,
|
|
271
|
+
* never a `pattern.includes is not a function` crash; and every rule's units
|
|
272
|
+
* and emptiness settle through the ONE boundary settle (`settleBoundaryRule`).
|
|
46
273
|
*/
|
|
47
274
|
export declare function evaluateBoundaries(scan: IImportScanResult, rules: readonly IBoundaryRule[], options?: IEvaluateOptions): IEvaluateResult;
|
|
48
275
|
//# sourceMappingURL=evaluate-boundaries.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluate-boundaries.d.ts","sourceRoot":"","sources":["../../src/evaluate/evaluate-boundaries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"evaluate-boundaries.d.ts","sourceRoot":"","sources":["../../src/evaluate/evaluate-boundaries.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAGb,KAAK,aAAa,EAElB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAEhB,aAAa,EACb,sBAAsB,EACtB,uBAAuB,EACxB,MAAM,2BAA2B,CAAC;AAkBnC,OAAO,KAAK,EAAe,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC9E,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,6BAA6B,CAAC;AAIrC,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,WAAW,EAAE,MAAM,CAAC;IACpB,0EAA0E;IAC1E,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,SAAS,CAAC,EAAE,iBAAiB,CAAC;IAC9B,8DAA8D;IAC9D,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iEAAiE;IACjE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,gBAAgB;IAC/B,yDAAyD;IACzD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,aAAa,CAAC,EAAE,iBAAiB,CAAC;IAClC;;;;;OAKG;IACH,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC;AAED,8FAA8F;AAC9F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