@xenos1996/usa 2.26.2 → 2.27.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.
Files changed (39) hide show
  1. package/dist/engine/audit-config.d.ts +66 -0
  2. package/dist/engine/audit-config.d.ts.map +1 -0
  3. package/dist/engine/audit-config.js +148 -0
  4. package/dist/engine/audit-config.js.map +1 -0
  5. package/dist/engine/audit-types.d.ts +44 -0
  6. package/dist/engine/audit-types.d.ts.map +1 -0
  7. package/dist/engine/audit-types.js +2 -0
  8. package/dist/engine/audit-types.js.map +1 -0
  9. package/dist/engine/audit-warnings.d.ts +56 -0
  10. package/dist/engine/audit-warnings.d.ts.map +1 -0
  11. package/dist/engine/audit-warnings.js +116 -0
  12. package/dist/engine/audit-warnings.js.map +1 -0
  13. package/dist/engine/audit.d.ts +14 -38
  14. package/dist/engine/audit.d.ts.map +1 -1
  15. package/dist/engine/audit.js +9 -500
  16. package/dist/engine/audit.js.map +1 -1
  17. package/dist/engine/evaluate-packs.d.ts +37 -0
  18. package/dist/engine/evaluate-packs.d.ts.map +1 -0
  19. package/dist/engine/evaluate-packs.js +144 -0
  20. package/dist/engine/evaluate-packs.js.map +1 -0
  21. package/dist/engine/invariants.d.ts +8 -0
  22. package/dist/engine/invariants.d.ts.map +1 -1
  23. package/dist/engine/invariants.js +11 -0
  24. package/dist/engine/invariants.js.map +1 -1
  25. package/dist/engine/pack-selection.d.ts +21 -0
  26. package/dist/engine/pack-selection.d.ts.map +1 -0
  27. package/dist/engine/pack-selection.js +63 -0
  28. package/dist/engine/pack-selection.js.map +1 -0
  29. package/dist/engine/report-build.d.ts +22 -0
  30. package/dist/engine/report-build.d.ts.map +1 -0
  31. package/dist/engine/report-build.js +67 -0
  32. package/dist/engine/report-build.js.map +1 -0
  33. package/dist/foundation/interview.d.ts.map +1 -1
  34. package/dist/foundation/interview.js +16 -5
  35. package/dist/foundation/interview.js.map +1 -1
  36. package/package.json +9 -8
  37. package/rules/core/code-quality.yaml +12 -2
  38. package/rules/core/provenance-attestation.yaml +5 -0
  39. package/rules/core/testing-assurance.yaml +19 -4
@@ -0,0 +1,66 @@
1
+ import type { Depth, Finding, Maturity, Suppression, UsaConfig } from '../types.js';
2
+ import type { SectionDef } from './sections.js';
3
+ import type { AuditOptions } from './audit-types.js';
4
+ /**
5
+ * Option, config, and policy resolution for an audit run.
6
+ *
7
+ * Everything here turns user input (CLI flags, `.usa.yaml`) into validated
8
+ * values, and every invalid value warns and falls back instead of throwing:
9
+ * a typo in a config file must not brick the audit it configures.
10
+ */
11
+ export declare const DEFAULT_RULES_DIR: string;
12
+ /** Version of this build, read from package.json so it never drifts. */
13
+ export declare const DEFAULT_VERSION: string;
14
+ export declare function normalizeAuditOptions(options: AuditOptions, config: UsaConfig): {
15
+ rulesDir: string;
16
+ depth: Depth;
17
+ profile: Maturity | "auto";
18
+ allowCommands: boolean;
19
+ usaVersion: string;
20
+ target: string;
21
+ config: UsaConfig;
22
+ };
23
+ /**
24
+ * Expired (or undated) waivers fail closed: an `until` date in the past — or
25
+ * one that cannot be parsed — excludes the suppression and raises a warning,
26
+ * so an audit never silently honours dead risk acceptances.
27
+ */
28
+ export declare function resolveSuppressions(suppressions: Suppression[] | undefined, warnings: string[]): Suppression[];
29
+ export declare function isSuppressionExpired(rule: string, until: string, warnings: string[]): boolean;
30
+ export declare const MATURITIES: Maturity[];
31
+ /**
32
+ * CLI --profile wins; otherwise a valid config `maturity` pins the bar;
33
+ * otherwise auto-detection stands. Invalid config values warn and fall back.
34
+ */
35
+ export declare function resolveMaturity(cliProfile: Maturity | 'auto', configMaturity: Maturity | undefined, detected: Maturity, warnings: string[]): Maturity;
36
+ /** Restrict scoring and reporting to the configured sections, if any. */
37
+ export declare function selectSections(all: SectionDef[], wanted: string[] | undefined, warnings: string[]): SectionDef[];
38
+ /**
39
+ * CLI flags win over config file; both are validated with warnings.
40
+ * Invalid values fall back to engine defaults (never zero, never infinite).
41
+ */
42
+ export declare function resolveLimits(options: AuditOptions, config: UsaConfig, warnings: string[]): {
43
+ maxFiles?: number;
44
+ maxBytes?: number;
45
+ };
46
+ export declare function validatedLimit(v: number | undefined, name: string, warnings: string[]): number | undefined;
47
+ export declare function resolvePackSets(options: AuditOptions, config: UsaConfig): {
48
+ include: Set<string>;
49
+ exclude: Set<string>;
50
+ };
51
+ export type RuleOverride = {
52
+ severity?: Finding['severity'];
53
+ weight?: number;
54
+ };
55
+ export declare function collectRuleSettings(config: UsaConfig, warnings: string[]): {
56
+ disabled: Set<string>;
57
+ overrides: Record<string, RuleOverride>;
58
+ };
59
+ /**
60
+ * Config overrides flow straight into scoring arithmetic — an invalid severity
61
+ * yields NaN totals and a negative weight yields scores outside 0–100.
62
+ * Reject loudly rather than corrupt the report.
63
+ */
64
+ export declare function validateOverrideSeverity(id: string, v: unknown, warnings: string[]): RuleOverride['severity'];
65
+ export declare function validateOverrideWeight(id: string, v: unknown, warnings: string[]): number | undefined;
66
+ //# sourceMappingURL=audit-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit-config.d.ts","sourceRoot":"","sources":["../../src/engine/audit-config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACpF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,QAK7B,CAAC;AAEF,wEAAwE;AACxE,eAAO,MAAM,eAAe,QAYxB,CAAC;AAEL,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS;;;;;;;;EAU7E;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,WAAW,EAAE,GAAG,SAAS,EACvC,QAAQ,EAAE,MAAM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AgB,mBAAmB,CACjC,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,MAAM,EAAE,GACjB;IACD,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;CACzC,CAYA;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,EAAE,EAAE,MAAM,EACV,CAAC,EAAE,OAAO,EACV,QAAQ,EAAE,MAAM,EAAE,GACjB,YAAY,CAAC,UAAU,CAAC,CAO1B;AAED,wBAAgB,sBAAsB,CACpC,EAAE,EAAE,MAAM,EACV,CAAC,EAAE,OAAO,EACV,QAAQ,EAAE,MAAM,EAAE,GACjB,MAAM,GAAG,SAAS,CAOpB"}
@@ -0,0 +1,148 @@
1
+ import path from 'node:path';
2
+ import fs from 'node:fs';
3
+ import { fileURLToPath } from 'node:url';
4
+ import { SEVERITY_LADDER } from './loader.js';
5
+ /**
6
+ * Option, config, and policy resolution for an audit run.
7
+ *
8
+ * Everything here turns user input (CLI flags, `.usa.yaml`) into validated
9
+ * values, and every invalid value warns and falls back instead of throwing:
10
+ * a typo in a config file must not brick the audit it configures.
11
+ */
12
+ export const DEFAULT_RULES_DIR = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..', 'rules');
13
+ /** Version of this build, read from package.json so it never drifts. */
14
+ export const DEFAULT_VERSION = (() => {
15
+ try {
16
+ const pkg = JSON.parse(fs.readFileSync(path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..', 'package.json'), 'utf8'));
17
+ return pkg.version ?? '0.0.0';
18
+ }
19
+ catch {
20
+ return '0.0.0';
21
+ }
22
+ })();
23
+ export function normalizeAuditOptions(options, config) {
24
+ return {
25
+ rulesDir: options.rulesDir ?? DEFAULT_RULES_DIR,
26
+ depth: options.depth ?? 'standard',
27
+ profile: options.profile ?? 'auto',
28
+ allowCommands: options.allowCommands ?? false,
29
+ usaVersion: options.usaVersion ?? DEFAULT_VERSION,
30
+ target: options.target,
31
+ config,
32
+ };
33
+ }
34
+ /**
35
+ * Expired (or undated) waivers fail closed: an `until` date in the past — or
36
+ * one that cannot be parsed — excludes the suppression and raises a warning,
37
+ * so an audit never silently honours dead risk acceptances.
38
+ */
39
+ export function resolveSuppressions(suppressions, warnings) {
40
+ const active = [];
41
+ for (const s of suppressions ?? []) {
42
+ if (!s.rule)
43
+ continue;
44
+ if (s.until && isSuppressionExpired(s.rule, s.until, warnings))
45
+ continue;
46
+ active.push(s);
47
+ }
48
+ return active;
49
+ }
50
+ export function isSuppressionExpired(rule, until, warnings) {
51
+ const t = Date.parse(until);
52
+ if (Number.isNaN(t)) {
53
+ warnings.push(`suppression for ${rule} has an unparseable "until" date ("${until}") — waiver ignored`);
54
+ return true;
55
+ }
56
+ if (t < Date.now()) {
57
+ warnings.push(`suppression for ${rule} expired on ${until} — treating as an active finding`);
58
+ return true;
59
+ }
60
+ return false;
61
+ }
62
+ export const MATURITIES = ['prototype', 'mvp', 'beta', 'production', 'legacy'];
63
+ /**
64
+ * CLI --profile wins; otherwise a valid config `maturity` pins the bar;
65
+ * otherwise auto-detection stands. Invalid config values warn and fall back.
66
+ */
67
+ export function resolveMaturity(cliProfile, configMaturity, detected, warnings) {
68
+ if (cliProfile !== 'auto')
69
+ return cliProfile;
70
+ if (configMaturity === undefined)
71
+ return detected;
72
+ if (MATURITIES.includes(configMaturity))
73
+ return configMaturity;
74
+ warnings.push(`.usa.yaml: invalid maturity "${String(configMaturity)}" — using auto-detected ${detected}`);
75
+ return detected;
76
+ }
77
+ /** Restrict scoring and reporting to the configured sections, if any. */
78
+ export function selectSections(all, wanted, warnings) {
79
+ if (!wanted || wanted.length === 0)
80
+ return all;
81
+ const known = new Set(all.map((s) => s.id));
82
+ for (const id of wanted) {
83
+ if (!known.has(id))
84
+ warnings.push(`.usa.yaml: unknown section "${id}" in sections — ignored`);
85
+ }
86
+ return all.filter((s) => wanted.includes(s.id));
87
+ }
88
+ /**
89
+ * CLI flags win over config file; both are validated with warnings.
90
+ * Invalid values fall back to engine defaults (never zero, never infinite).
91
+ */
92
+ export function resolveLimits(options, config, warnings) {
93
+ return {
94
+ maxFiles: validatedLimit(options.maxFiles ?? config.limits?.max_files, 'limits.max_files / --max-files', warnings),
95
+ maxBytes: validatedLimit(options.maxBytes ?? config.limits?.max_bytes, 'limits.max_bytes / --max-bytes', warnings),
96
+ };
97
+ }
98
+ export function validatedLimit(v, name, warnings) {
99
+ if (v === undefined)
100
+ return undefined;
101
+ if (typeof v === 'number' && Number.isFinite(v) && v > 0)
102
+ return Math.floor(v);
103
+ warnings.push(`invalid ${name} "${String(v)}" (must be a positive number) — using defaults`);
104
+ return undefined;
105
+ }
106
+ export function resolvePackSets(options, config) {
107
+ return {
108
+ include: new Set(options.includePacks ?? config.include ?? []),
109
+ exclude: new Set(options.excludePacks ?? config.exclude ?? []),
110
+ };
111
+ }
112
+ export function collectRuleSettings(config, warnings) {
113
+ const disabled = new Set();
114
+ const overrides = {};
115
+ for (const [id, o] of Object.entries(config.rules ?? {})) {
116
+ if (o.disabled)
117
+ disabled.add(id);
118
+ const severity = validateOverrideSeverity(id, o.severity, warnings);
119
+ const weight = validateOverrideWeight(id, o.weight, warnings);
120
+ if (severity !== undefined || weight !== undefined) {
121
+ overrides[id] = { severity, weight };
122
+ }
123
+ }
124
+ return { disabled, overrides };
125
+ }
126
+ /**
127
+ * Config overrides flow straight into scoring arithmetic — an invalid severity
128
+ * yields NaN totals and a negative weight yields scores outside 0–100.
129
+ * Reject loudly rather than corrupt the report.
130
+ */
131
+ export function validateOverrideSeverity(id, v, warnings) {
132
+ if (v === undefined)
133
+ return undefined;
134
+ if (SEVERITY_LADDER.includes(String(v))) {
135
+ return String(v);
136
+ }
137
+ warnings.push(`rules.${id}: invalid severity "${String(v)}" — override ignored`);
138
+ return undefined;
139
+ }
140
+ export function validateOverrideWeight(id, v, warnings) {
141
+ if (v === undefined)
142
+ return undefined;
143
+ if (typeof v === 'number' && Number.isFinite(v) && v >= 0)
144
+ return v;
145
+ warnings.push(`rules.${id}: invalid weight "${String(v)}" (must be a finite number ≥ 0) — override ignored`);
146
+ return undefined;
147
+ }
148
+ //# sourceMappingURL=audit-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit-config.js","sourceRoot":"","sources":["../../src/engine/audit-config.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG9C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC,OAAO,CAC3C,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAC5C,IAAI,EACJ,IAAI,EACJ,OAAO,CACR,CAAC;AAEF,wEAAwE;AACxE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE;IACnC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CACpB,EAAE,CAAC,YAAY,CACb,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC,EACtF,MAAM,CACP,CACsB,CAAC;QAC1B,OAAO,GAAG,CAAC,OAAO,IAAI,OAAO,CAAC;IAChC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,OAAO,CAAC;IACjB,CAAC;AACH,CAAC,CAAC,EAAE,CAAC;AAEL,MAAM,UAAU,qBAAqB,CAAC,OAAqB,EAAE,MAAiB;IAC5E,OAAO;QACL,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,iBAAiB;QAC/C,KAAK,EAAE,OAAO,CAAC,K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Depth, Maturity, RulePack, UsaConfig } from '../types.js';
2
+ import type { MaturityProfile } from './maturity.js';
3
+ /**
4
+ * The public shape of an audit run, in its own module so the audit
5
+ * coordinator and the option/pack/report helpers can all depend on it
6
+ * without importing each other.
7
+ */
8
+ export interface AuditOptions {
9
+ target: string;
10
+ rulesDir?: string;
11
+ depth?: Depth;
12
+ profile?: Maturity | 'auto';
13
+ config?: UsaConfig;
14
+ allowCommands?: boolean;
15
+ usaVersion?: string;
16
+ /** Force these pack ids on/off regardless of detection. */
17
+ includePacks?: string[];
18
+ excludePacks?: string[];
19
+ /** Indexing caps for bigger-than-comfortable trees (CLI wins over config). */
20
+ maxFiles?: number;
21
+ maxBytes?: number;
22
+ /**
23
+ * Extra rule packs merged into the loaded set for this run only. This is how
24
+ * the evolution layer injects a *released* capability into a re-audit without
25
+ * mutating the on-disk `rules/` registry — the resolved capability set lives
26
+ * in `capabilitySetId`, not in the filesystem. The CLI never passes this, so
27
+ * `usa audit` behaviour is unchanged.
28
+ */
29
+ extraPacks?: RulePack[];
30
+ /**
31
+ * Include the documentation universe audit (14 categories / 220 artifacts,
32
+ * rules/docs-taxonomy.yaml) in this run: DOCU-* findings join S12. Opt-in
33
+ * (CLI `--docs-universe` or `.usa.yaml` `docs.universe: true`) so existing
34
+ * baselines stay stable; the standalone `usa docs audit` runs the same
35
+ * computation and must agree (AC-8).
36
+ */
37
+ docsUniverse?: boolean;
38
+ }
39
+ export interface AuditOutcome {
40
+ report: AuditReport;
41
+ warnings: string[];
42
+ profile: MaturityProfile;
43
+ }
44
+ //# sourceMappingURL=audit-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit-types.d.ts","sourceRoot":"","sources":["../../src/engine/audit-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACrF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,OAAO,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;IAC5B,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2DAA2D;IAC3D,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,QAAQ,EAAE,CAAC;IACxB;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,WAAW,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,EAAE,eAAe,CAAC;CAC1B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=audit-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit-types.js","sourceRoot":"","sources":["../../src/engine/audit-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,56 @@
1
+ import type { Facts } from '../types.js';
2
+ import { type Project } from '../util/project.js';
3
+ import { buildSuppressionIndex } from './suppression.js';
4
+ import { type ReviewIndex } from './review.js';
5
+ /**
6
+ * Warnings that keep an audit honest about what it could not see.
7
+ *
8
+ * A warning is not a finding: it moves no score. It exists because a PASS
9
+ * computed over a truncated index, a single-commit history, or an ignored
10
+ * intent file is a weaker claim than it looks, and the report must say so.
11
+ */
12
+ /**
13
+ * A waiver that matched nothing is dead weight — usually a rule that no longer
14
+ * fires there, a renamed file, or a passing rule. Report it so suppressions
15
+ * decay instead of accumulating (ADR-0022, the ESLint model).
16
+ */
17
+ export declare function appendUnusedSuppressionWarnings(suppressions: ReturnType<typeof buildSuppressionIndex>, warnings: string[]): void;
18
+ /**
19
+ * Rank for the declared-vs-detected check (ADR-0041). Legacy is unranked:
20
+ * a retiring system plays a different game and gets no aspiration warning.
21
+ */
22
+ export declare const STAGE_RANK: Record<string, number>;
23
+ /**
24
+ * ADR-0041: declared stage above detected maturity is aspiration beyond
25
+ * evidence — one loud line, zero moved bars. Severity keeps following
26
+ * detected maturity (never the declaration), so claiming `prototype` buys
27
+ * no leniency and claiming `production` buys no strictness.
28
+ */
29
+ export declare function assertStageAspiration(target: string, detected: string, warnings: string[]): void;
30
+ /**
31
+ * Declared intent becomes detection facts. The loader throws on a broken
32
+ * file (fail closed); the audit converts that into a warning and proceeds
33
+ * without intent facts — a malformed promise must be loud, but it must not
34
+ * brick the audit it was meant to guide.
35
+ */
36
+ export declare function assertFoundationFacts(target: string, facts: Facts, warnings: string[]): void;
37
+ /**
38
+ * A review that matched nothing is dead provenance — the finding was fixed, the
39
+ * rule renamed, the file moved. A review whose `until` has passed is a decision
40
+ * nobody has revisited. Both are reported so the ledger decays instead of
41
+ * accumulating (ADR-0023, the ESLint model applied to attention).
42
+ */
43
+ export declare function appendReviewWarnings(reviews: ReviewIndex, warnings: string[]): void;
44
+ /**
45
+ * Scale honesty: a truncated index or skipped oversize files means PASS
46
+ * verdicts may rest on unseen files. Loud warning, never silent absorption.
47
+ */
48
+ export declare function appendIndexWarnings(project: Project, warnings: string[]): void;
49
+ /**
50
+ * History-thin targets blind the history-dependent rules (REPO-003 scans
51
+ * `git log`, REL-002 needs tags, maturity signals need commits). The
52
+ * negation in REPO-003 even turns git errors into PASS — true only in the
53
+ * vacuous sense. Say so loudly instead of scoring blind confidence.
54
+ */
55
+ export declare function appendHistoryWarnings(git: ReturnType<Project['gitInfo']>, warnings: string[]): void;
56
+ //# sourceMapp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
@@ -0,0 +1,116 @@
1
+ import { MAX_FILE_BYTES, MAX_FILES } from '../util/project.js';
2
+ import { describeSuppression, unusedSuppressions } from './suppression.js';
3
+ import { describeReview, reviewOverdueDays } from './review.js';
4
+ import { loadFoundationFacts, loadFoundationStage } from '../foundation/loader.js';
5
+ /**
6
+ * Warnings that keep an audit honest about what it could not see.
7
+ *
8
+ * A warning is not a finding: it moves no score. It exists because a PASS
9
+ * computed over a truncated index, a single-commit history, or an ignored
10
+ * intent file is a weaker claim than it looks, and the report must say so.
11
+ */
12
+ /**
13
+ * A waiver that matched nothing is dead weight — usually a rule that no longer
14
+ * fires there, a renamed file, or a passing rule. Report it so suppressions
15
+ * decay instead of accumulating (ADR-0022, the ESLint model).
16
+ */
17
+ export function appendUnusedSuppressionWarnings(suppressions, warnings) {
18
+ for (const s of unusedSuppressions(suppressions)) {
19
+ warnings.push(`suppression for ${describeSuppression(s)} matched no finding — remove it or fix the target`);
20
+ }
21
+ }
22
+ /**
23
+ * Rank for the declared-vs-detected check (ADR-0041). Legacy is unranked:
24
+ * a retiring system plays a different game and gets no aspiration warning.
25
+ */
26
+ export const STAGE_RANK = { prototype: 0, mvp: 1, beta: 2, production: 3 };
27
+ /**
28
+ * ADR-0041: declared stage above detected maturity is aspiration beyond
29
+ * evidence — one loud line, zero moved bars. Severity keeps following
30
+ * detected maturity (never the declaration), so claiming `prototype` buys
31
+ * no leniency and claiming `production` buys no strictness.
32
+ */
33
+ export function assertStageAspiration(target, detected, warnings) {
34
+ const declared = loadFoundationStage(target);
35
+ if (declared === undefined)
36
+ return;
37
+ const want = STAGE_RANK[declared];
38
+ const have = STAGE_RANK[detected];
39
+ if (want === undefined || have === undefined || want <= have)
40
+ return;
41
+ warnings.push(`declared stage ${declared} exceeds detected maturity ${detected} — grading follows detected; ` +
42
+ `pass --profile ${declared} to be held to the declared bar explicitly`);
43
+ }
44
+ /**
45
+ * Declared intent becomes detection facts. The loader throws on a broken
46
+ * file (fail closed); the audit converts that into a warning and proceeds
47
+ * without intent facts — a malformed promise must be loud, but it must not
48
+ * brick the audit it was meant to guide.
49
+ */
50
+ export function assertFoundationFacts(target, facts, warnings) {
51
+ try {
52
+ for (const flag of loadFoundationFacts(target))
53
+ facts.flags.add(flag);
54
+ }
55
+ catch (err) {
56
+ warnings.push(`foundation intent ignored: ${err.message}`);
57
+ }
58
+ }
59
+ /**
60
+ * A review that matched nothing is dead provenance — the finding was fixed, the
61
+ * rule renamed, the file moved. A review whose `until` has passed is a decision
62
+ * nobody has revisited. Both are reported so the ledger decays instead of
63
+ * accumulating (ADR-0023, the ESLint model applied to attention).
64
+ */
65
+ export function appendReviewWarnings(reviews, warnings) {
66
+ const nowMs = Date.now();
67
+ for (const entries of reviews.values()) {
68
+ for (const entry of entries) {
69
+ if (!entry.used) {
70
+ warnings.push(`review for ${describeReview(entry.review)} matched no finding — remove it or re-target it`);
71
+ continue;
72
+ }
73
+ const overdue = reviewOverdueDays(entry.review, nowMs);
74
+ if (overdue !== null) {
75
+ warnings.push(`review for ${describeReview(entry.review)} was due ${entry.review.until} — ` +
76
+ `overdue by ${overdue} day(s); re-review`);
77
+ }
78
+ }
79
+ }
80
+ }
81
+ /**
82
+ * Scale honesty: a truncated index or skipped oversize files means PASS
83
+ * verdicts may rest on unseen files. Loud warning, never silent absorption.
84
+ */
85
+ export function appendIndexWarnings(project, warnings) {
86
+ if (project.truncated) {
87
+ warnings.push(`index truncated at ${MAX_FILES} files — the tree is bigger than the audit can see; ` +
88
+ 'treat PASS verdicts as partial and split the target (e.g. per-package audits)');
89
+ }
90
+ if (project.skippedLarge > 0) {
91
+ warnings.push(`${project.skippedLarge} file(s) skipped for exceeding ${MAX_FILE_BYTES} bytes — ` +
92
+ 'content checks could not see them');
93
+ }
94
+ if (project.skippedSymlinks > 0) {
95
+ warnings.push(`${project.skippedSymlinks} symlink(s) skipped without traversal — ` +
96
+ 'linked source is invisible to every check; materialize it to audit it');
97
+ }
98
+ }
99
+ /**
100
+ * History-thin targets blind the history-dependent rules (REPO-003 scans
101
+ * `git log`, REL-002 needs tags, maturity signals need commits). The
102
+ * negation in REPO-003 even turns git errors into PASS — true only in the
103
+ * vacuous sense. Say so loudly instead of scoring blind confidence.
104
+ */
105
+ export function appendHistoryWarnings(git, warnings) {
106
+ if (!git.isRepo) {
107
+ warnings.push('not a git repository — history and provenance checks cannot verify anything; ' +
108
+ 'treat history-dependent findings as vacuous');
109
+ return;
110
+ }
111
+ if (git.commits <= 1) {
112
+ warnings.push('single-commit history (shallow clone?) — maturity signals, tag checks, and ' +
113
+ 'history scans are under-verified; prefer a full clone for release-grade audits');
114
+ }
115
+ }
116
+ //# sourceMappingURL=audit-warnings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit-warnings.js","sourceRoot":"","sources":["../../src/engine/audit-warnings.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAgB,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAAyB,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAClG,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAoB,MAAM,aAAa,CAAC;AAClF,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAEnF;;;;;;GAMG;AACH;;;;GAIG;AACH,MAAM,UAAU,+BAA+B,CAC7C,YAAsD,EACtD,QAAkB;IAElB,KAAK,MAAM,CAAC,IAAI,kBAAkB,CAAC,YAAY,CAAC,EAAE,CAAC;QACjD,QAAQ,CAAC,IAAI,CACX,mBAAmB,mBAAmB,CAAC,CAAC,CAAC,mDAAmD,CAC7F,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAA2B,EAAE,SAAS,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC;AAEnG;;;;;GAKG;AACH,MAAM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import type { AuditReport, Depth, Maturity, RulePack, UsaConfig } from '../types.js';
2
- import { type MaturityProfile } from './maturity.js';
3
- export interface AuditOptions {
4
- target: string;
5
- rulesDir?: string;
6
- depth?: Depth;
7
- profile?: Maturity | 'auto';
8
- config?: UsaConfig;
9
- allowCommands?: boolean;
10
- usaVersion?: string;
11
- /** Force these pack ids on/off regardless of detection. */
12
- includePacks?: string[];
13
- excludePacks?: string[];
14
- /** Indexing caps for bigger-than-comfortable trees (CLI wins over config). */
15
- maxFiles?: number;
16
- maxBytes?: number;
17
- /**
18
- * Extra rule packs merged into the loaded set for this run only. This is how
19
- * the evolution layer injects a *released* capability into a re-audit without
20
- * mutating the on-disk `rules/` registry — the resolved capability set lives
21
- * in `capabilitySetId`, not in the filesystem. The CLI never passes this, so
22
- * `usa audit` behaviour is unchanged.
23
- */
24
- extraPacks?: RulePack[];
25
- /**
26
- * Include the documentation universe audit (14 categories / 220 artifacts,
27
- * rules/docs-taxonomy.yaml) in this run: DOCU-* findings join S12. Opt-in
28
- * (CLI `--docs-universe` or `.usa.yaml` `docs.universe: true`) so existing
29
- * baselines stay stable; the standalone `usa docs audit` runs the same
30
- * computation and must agree (AC-8).
31
- */
32
- docsUniverse?: boolean;
33
- }
34
- export interface AuditOutcome {
35
- report: AuditReport;
36
- warnings: string[];
37
- profile: MaturityProfile;
38
- }
1
+ import type { AuditOptions, AuditOutcome } from './audit-types.js';
2
+ /**
3
+ * The audit coordinator.
4
+ *
5
+ * This module owns the *order* of an audit and nothing else: resolve options,
6
+ * index the tree, detect facts, choose packs, score, warn about what was not
7
+ * seen, build the report. Each step lives in a sibling module —
8
+ * `audit-config` (validation), `pack-selection` (fixed point), `evaluate-packs`
9
+ * (two-pass scoring), `audit-warnings` (honesty), `report-build` (assembly).
10
+ *
11
+ * The split is not cosmetic: at 840 lines this file was the project's only
12
+ * god file, and these are the seams the pipeline already had.
13
+ */
14
+ export type { AuditOptions, AuditOutcome } from './audit-types.js';
39
15
  export declare function runAudit(options: AuditOptions): AuditOutcome;
40
16
  //# sourceMappingURL=audit.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../../src/engine/audit.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EACX,KAAK,EAGL,QAAQ,EAER,QAAQ,EAER,SAAS,EACV,MAAM,aAAa,CAAC;AA2BrB,OAAO,EAAwB,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AA+B3E,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,OAAO,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;IAC5B,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2DAA2D;IAC3D,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,QAAQ,EAAE,CAAC;IACxB;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,WAAW,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,EAAE,eAAe,CAAC;CAC1B;AAED,wBAAgB,QAAQ,CAAC,OAAO,EAAE,YAAY,GAAG,YAAY,CAkH5D"}
1
+ {"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../../src/engine/audit.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAsBnE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