@agent-teams/engineering-foundation 1.7.4 → 1.9.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/README.md +8 -0
- package/dist/capabilities/findings-baseline/adapters/inbound/configuration/load-capability-config.d.ts +7 -0
- package/dist/capabilities/findings-baseline/adapters/inbound/configuration/load-capability-config.d.ts.map +1 -0
- package/dist/capabilities/findings-baseline/adapters/inbound/configuration/load-capability-config.js +28 -0
- package/dist/capabilities/findings-baseline/adapters/inbound/configuration/load-capability-config.js.map +1 -0
- package/dist/capabilities/findings-baseline/adapters/outbound/filesystem/filesystem-findings-baseline-store.d.ts +19 -0
- package/dist/capabilities/findings-baseline/adapters/outbound/filesystem/filesystem-findings-baseline-store.d.ts.map +1 -0
- package/dist/capabilities/findings-baseline/adapters/outbound/filesystem/filesystem-findings-baseline-store.js +84 -0
- package/dist/capabilities/findings-baseline/adapters/outbound/filesystem/filesystem-findings-baseline-store.js.map +1 -0
- package/dist/capabilities/findings-baseline/application/baseline.d.ts +52 -0
- package/dist/capabilities/findings-baseline/application/baseline.d.ts.map +1 -0
- package/dist/capabilities/findings-baseline/application/baseline.js +157 -0
- package/dist/capabilities/findings-baseline/application/baseline.js.map +1 -0
- package/dist/capabilities/findings-baseline/application/budgets.d.ts +22 -0
- package/dist/capabilities/findings-baseline/application/budgets.d.ts.map +1 -0
- package/dist/capabilities/findings-baseline/application/budgets.js +39 -0
- package/dist/capabilities/findings-baseline/application/budgets.js.map +1 -0
- package/dist/capabilities/findings-baseline/application/configuration-input.d.ts +4 -0
- package/dist/capabilities/findings-baseline/application/configuration-input.d.ts.map +1 -0
- package/dist/capabilities/findings-baseline/application/configuration-input.js +10 -0
- package/dist/capabilities/findings-baseline/application/configuration-input.js.map +1 -0
- package/dist/capabilities/findings-baseline/application/model.d.ts +33 -0
- package/dist/capabilities/findings-baseline/application/model.d.ts.map +1 -0
- package/dist/capabilities/findings-baseline/application/model.js +3 -0
- package/dist/capabilities/findings-baseline/application/model.js.map +1 -0
- package/dist/capabilities/findings-baseline/application/rules.d.ts +16 -0
- package/dist/capabilities/findings-baseline/application/rules.d.ts.map +1 -0
- package/dist/capabilities/findings-baseline/application/rules.js +18 -0
- package/dist/capabilities/findings-baseline/application/rules.js.map +1 -0
- package/dist/capabilities/findings-baseline/application/use-cases/findings-baseline.d.ts +24 -0
- package/dist/capabilities/findings-baseline/application/use-cases/findings-baseline.d.ts.map +1 -0
- package/dist/capabilities/findings-baseline/application/use-cases/findings-baseline.js +74 -0
- package/dist/capabilities/findings-baseline/application/use-cases/findings-baseline.js.map +1 -0
- package/dist/capabilities/findings-baseline/contract/config.d.ts +3 -0
- package/dist/capabilities/findings-baseline/contract/config.d.ts.map +1 -0
- package/dist/capabilities/findings-baseline/contract/config.js +3 -0
- package/dist/capabilities/findings-baseline/contract/config.js.map +1 -0
- package/dist/capabilities/findings-baseline/module.d.ts +37 -0
- package/dist/capabilities/findings-baseline/module.d.ts.map +1 -0
- package/dist/capabilities/findings-baseline/module.js +109 -0
- package/dist/capabilities/findings-baseline/module.js.map +1 -0
- package/dist/capabilities/findings-baseline/schemas.d.ts +2 -0
- package/dist/capabilities/findings-baseline/schemas.d.ts.map +1 -0
- package/dist/capabilities/findings-baseline/schemas.js +2 -0
- package/dist/capabilities/findings-baseline/schemas.js.map +1 -0
- package/dist/capabilities/public-api-compatibility/adapters/outbound/filesystem/growth-invocation.d.ts +18 -0
- package/dist/capabilities/public-api-compatibility/adapters/outbound/filesystem/growth-invocation.d.ts.map +1 -1
- package/dist/capabilities/public-api-compatibility/adapters/outbound/filesystem/growth-invocation.js +7 -0
- package/dist/capabilities/public-api-compatibility/adapters/outbound/filesystem/growth-invocation.js.map +1 -1
- package/dist/capabilities/public-api-compatibility/authority-module.d.ts.map +1 -1
- package/dist/capabilities/public-api-compatibility/authority-module.js +2 -4
- package/dist/capabilities/public-api-compatibility/authority-module.js.map +1 -1
- package/dist/capabilities/public-api-compatibility/module.d.ts.map +1 -1
- package/dist/capabilities/public-api-compatibility/module.js +2 -3
- package/dist/capabilities/public-api-compatibility/module.js.map +1 -1
- package/dist/capabilities/quality-gate-runner/adapters/inbound/configuration/load-quality-gate-policy.d.ts +1 -1
- package/dist/capabilities/quality-gate-runner/adapters/inbound/configuration/load-quality-gate-policy.d.ts.map +1 -1
- package/dist/capabilities/quality-gate-runner/adapters/inbound/configuration/load-quality-gate-policy.js +14 -1
- package/dist/capabilities/quality-gate-runner/adapters/inbound/configuration/load-quality-gate-policy.js.map +1 -1
- package/dist/capabilities/quality-gate-runner/adapters/inbound/configuration/parse-quality-gate-policy.d.ts.map +1 -1
- package/dist/capabilities/quality-gate-runner/adapters/inbound/configuration/parse-quality-gate-policy.js +24 -3
- package/dist/capabilities/quality-gate-runner/adapters/inbound/configuration/parse-quality-gate-policy.js.map +1 -1
- package/dist/capabilities/quality-gate-runner/adapters/outbound/bun/bun-package-script-executor.d.ts +24 -0
- package/dist/capabilities/quality-gate-runner/adapters/outbound/bun/bun-package-script-executor.d.ts.map +1 -0
- package/dist/capabilities/quality-gate-runner/adapters/outbound/bun/bun-package-script-executor.js +25 -0
- package/dist/capabilities/quality-gate-runner/adapters/outbound/bun/bun-package-script-executor.js.map +1 -0
- package/dist/capabilities/quality-gate-runner/adapters/outbound/package-script-process.d.ts +9 -0
- package/dist/capabilities/quality-gate-runner/adapters/outbound/package-script-process.d.ts.map +1 -0
- package/dist/capabilities/quality-gate-runner/adapters/outbound/package-script-process.js +19 -0
- package/dist/capabilities/quality-gate-runner/adapters/outbound/package-script-process.js.map +1 -0
- package/dist/capabilities/quality-gate-runner/adapters/outbound/pnpm/pnpm-package-script-executor.d.ts +3 -1
- package/dist/capabilities/quality-gate-runner/adapters/outbound/pnpm/pnpm-package-script-executor.d.ts.map +1 -1
- package/dist/capabilities/quality-gate-runner/adapters/outbound/pnpm/pnpm-package-script-executor.js +16 -26
- package/dist/capabilities/quality-gate-runner/adapters/outbound/pnpm/pnpm-package-script-executor.js.map +1 -1
- package/dist/capabilities/quality-gate-runner/application/model/quality-gate.d.ts +2 -1
- package/dist/capabilities/quality-gate-runner/application/model/quality-gate.d.ts.map +1 -1
- package/dist/capabilities/quality-gate-runner/application/policies/evaluate-quality-gate-scripts.js +1 -1
- package/dist/capabilities/quality-gate-runner/application/policies/evaluate-quality-gate-scripts.js.map +1 -1
- package/dist/capabilities/quality-gate-runner/application/policies/quality-gate-input.d.ts +1 -0
- package/dist/capabilities/quality-gate-runner/application/policies/quality-gate-input.d.ts.map +1 -1
- package/dist/capabilities/quality-gate-runner/application/policies/quality-gate-input.js +3 -0
- package/dist/capabilities/quality-gate-runner/application/policies/quality-gate-input.js.map +1 -1
- package/dist/capabilities/quality-gate-runner/application/ports/package-script-executor.d.ts +2 -0
- package/dist/capabilities/quality-gate-runner/application/ports/package-script-executor.d.ts.map +1 -1
- package/dist/capabilities/quality-gate-runner/application/ports/package-script-executor.js.map +1 -1
- package/dist/capabilities/quality-gate-runner/application/use-cases/run-quality-gate-profile.d.ts.map +1 -1
- package/dist/capabilities/quality-gate-runner/application/use-cases/run-quality-gate-profile.js +2 -0
- package/dist/capabilities/quality-gate-runner/application/use-cases/run-quality-gate-profile.js.map +1 -1
- package/dist/capabilities/quality-gate-runner/composition/node-quality-gate-command.d.ts.map +1 -1
- package/dist/capabilities/quality-gate-runner/composition/node-quality-gate-command.js +58 -20
- package/dist/capabilities/quality-gate-runner/composition/node-quality-gate-command.js.map +1 -1
- package/dist/capabilities/quality-gate-runner/composition/select-package-script-executor.d.ts +11 -0
- package/dist/capabilities/quality-gate-runner/composition/select-package-script-executor.d.ts.map +1 -0
- package/dist/capabilities/quality-gate-runner/composition/select-package-script-executor.js +13 -0
- package/dist/capabilities/quality-gate-runner/composition/select-package-script-executor.js.map +1 -0
- package/dist/capabilities/quality-gate-runner/schemas.d.ts +1 -1
- package/dist/capabilities/quality-gate-runner/schemas.d.ts.map +1 -1
- package/dist/capabilities/quality-gate-runner/schemas.js +2 -1
- package/dist/capabilities/quality-gate-runner/schemas.js.map +1 -1
- package/dist/capabilities/repository-agent-workflow/adapters/inbound/configuration/parse-agent-workflow-policy.d.ts.map +1 -1
- package/dist/capabilities/repository-agent-workflow/adapters/inbound/configuration/parse-agent-workflow-policy.js +1 -0
- package/dist/capabilities/repository-agent-workflow/adapters/inbound/configuration/parse-agent-workflow-policy.js.map +1 -1
- package/dist/capabilities/repository-agent-workflow/adapters/outbound/bun/bun-package-script-runner.d.ts +18 -0
- package/dist/capabilities/repository-agent-workflow/adapters/outbound/bun/bun-package-script-runner.d.ts.map +1 -0
- package/dist/capabilities/repository-agent-workflow/adapters/outbound/bun/bun-package-script-runner.js +24 -0
- package/dist/capabilities/repository-agent-workflow/adapters/outbound/bun/bun-package-script-runner.js.map +1 -0
- package/dist/capabilities/repository-agent-workflow/adapters/outbound/pnpm/pnpm-package-script-runner.d.ts +2 -0
- package/dist/capabilities/repository-agent-workflow/adapters/outbound/pnpm/pnpm-package-script-runner.d.ts.map +1 -1
- package/dist/capabilities/repository-agent-workflow/adapters/outbound/pnpm/pnpm-package-script-runner.js +7 -1
- package/dist/capabilities/repository-agent-workflow/adapters/outbound/pnpm/pnpm-package-script-runner.js.map +1 -1
- package/dist/capabilities/repository-agent-workflow/application/model/repository-agent-workflow.d.ts +2 -0
- package/dist/capabilities/repository-agent-workflow/application/model/repository-agent-workflow.d.ts.map +1 -1
- package/dist/capabilities/repository-agent-workflow/application/policies/workflow-input.d.ts +1 -0
- package/dist/capabilities/repository-agent-workflow/application/policies/workflow-input.d.ts.map +1 -1
- package/dist/capabilities/repository-agent-workflow/application/policies/workflow-input.js +3 -0
- package/dist/capabilities/repository-agent-workflow/application/policies/workflow-input.js.map +1 -1
- package/dist/capabilities/repository-agent-workflow/application/ports/changed-workflow.d.ts +2 -0
- package/dist/capabilities/repository-agent-workflow/application/ports/changed-workflow.d.ts.map +1 -1
- package/dist/capabilities/repository-agent-workflow/application/use-cases/run-changed-agent-workflow.d.ts.map +1 -1
- package/dist/capabilities/repository-agent-workflow/application/use-cases/run-changed-agent-workflow.js +1 -0
- package/dist/capabilities/repository-agent-workflow/application/use-cases/run-changed-agent-workflow.js.map +1 -1
- package/dist/capabilities/repository-agent-workflow/composition/node-commands.d.ts +2 -1
- package/dist/capabilities/repository-agent-workflow/composition/node-commands.d.ts.map +1 -1
- package/dist/capabilities/repository-agent-workflow/composition/node-commands.js +42 -1
- package/dist/capabilities/repository-agent-workflow/composition/node-commands.js.map +1 -1
- package/dist/capabilities/repository-agent-workflow/composition/select-package-script-runner.d.ts +6 -0
- package/dist/capabilities/repository-agent-workflow/composition/select-package-script-runner.d.ts.map +1 -0
- package/dist/capabilities/repository-agent-workflow/composition/select-package-script-runner.js +9 -0
- package/dist/capabilities/repository-agent-workflow/composition/select-package-script-runner.js.map +1 -0
- package/dist/capabilities/source-dependencies/adapters/outbound/oxc/oxc-source-dependency-parser.d.ts.map +1 -1
- package/dist/capabilities/source-dependencies/adapters/outbound/oxc/oxc-source-dependency-parser.js +78 -1
- package/dist/capabilities/source-dependencies/adapters/outbound/oxc/oxc-source-dependency-parser.js.map +1 -1
- package/dist/capabilities/source-dependencies/application/model/source-workspace.d.ts +15 -0
- package/dist/capabilities/source-dependencies/application/model/source-workspace.d.ts.map +1 -1
- package/dist/capabilities/source-dependencies/application/policies/evaluate-source-dependency-cycles.d.ts +4 -0
- package/dist/capabilities/source-dependencies/application/policies/evaluate-source-dependency-cycles.d.ts.map +1 -1
- package/dist/capabilities/source-dependencies/application/policies/evaluate-source-dependency-cycles.js +2 -1
- package/dist/capabilities/source-dependencies/application/policies/evaluate-source-dependency-cycles.js.map +1 -1
- package/dist/capabilities/source-dependencies/application/use-cases/observe-source-graph.d.ts +84 -0
- package/dist/capabilities/source-dependencies/application/use-cases/observe-source-graph.d.ts.map +1 -0
- package/dist/capabilities/source-dependencies/application/use-cases/observe-source-graph.js +100 -0
- package/dist/capabilities/source-dependencies/application/use-cases/observe-source-graph.js.map +1 -0
- package/dist/capabilities/source-dependencies/module.d.ts +5 -0
- package/dist/capabilities/source-dependencies/module.d.ts.map +1 -1
- package/dist/capabilities/source-dependencies/module.js +7 -0
- package/dist/capabilities/source-dependencies/module.js.map +1 -1
- package/dist/capabilities/workspace-dependency-declarations/application/policies/evaluate-workspace-dependencies.d.ts.map +1 -1
- package/dist/capabilities/workspace-dependency-declarations/application/policies/evaluate-workspace-dependencies.js +10 -1
- package/dist/capabilities/workspace-dependency-declarations/application/policies/evaluate-workspace-dependencies.js.map +1 -1
- package/dist/composition/command-host.d.ts.map +1 -1
- package/dist/composition/command-host.js +3 -1
- package/dist/composition/command-host.js.map +1 -1
- package/dist/composition/rule-registry.d.ts +3 -2
- package/dist/composition/rule-registry.d.ts.map +1 -1
- package/dist/composition/rule-registry.js +3 -2
- package/dist/composition/rule-registry.js.map +1 -1
- package/dist/features/command-host/adapters/inbound/cli/cli-arguments.d.ts.map +1 -1
- package/dist/features/command-host/adapters/inbound/cli/cli-arguments.js +6 -2
- package/dist/features/command-host/adapters/inbound/cli/cli-arguments.js.map +1 -1
- package/dist/features/command-host/adapters/inbound/cli/foundation-cli.d.ts.map +1 -1
- package/dist/features/command-host/adapters/inbound/cli/foundation-cli.js +29 -0
- package/dist/features/command-host/adapters/inbound/cli/foundation-cli.js.map +1 -1
- package/dist/features/command-host/application/command-services.d.ts +18 -0
- package/dist/features/command-host/application/command-services.d.ts.map +1 -1
- package/dist/features/command-host/composition/node-command-host.d.ts +1 -0
- package/dist/features/command-host/composition/node-command-host.d.ts.map +1 -1
- package/dist/features/command-host/composition/node-command-host.js +7 -0
- package/dist/features/command-host/composition/node-command-host.js.map +1 -1
- package/dist/features/quality-coverage/adapters/oxlint-output.d.ts +8 -2
- package/dist/features/quality-coverage/adapters/oxlint-output.d.ts.map +1 -1
- package/dist/features/quality-coverage/adapters/oxlint-output.js +40 -9
- package/dist/features/quality-coverage/adapters/oxlint-output.js.map +1 -1
- package/dist/features/quality-coverage/adapters/oxlint-session.d.ts +5 -2
- package/dist/features/quality-coverage/adapters/oxlint-session.d.ts.map +1 -1
- package/dist/features/quality-coverage/adapters/oxlint-session.js +13 -1
- package/dist/features/quality-coverage/adapters/oxlint-session.js.map +1 -1
- package/dist/features/quality-coverage/adapters/profile-input.d.ts.map +1 -1
- package/dist/features/quality-coverage/adapters/profile-input.js +4 -2
- package/dist/features/quality-coverage/adapters/profile-input.js.map +1 -1
- package/dist/features/quality-coverage/api.d.ts +2 -1
- package/dist/features/quality-coverage/api.d.ts.map +1 -1
- package/dist/features/quality-coverage/api.js +1 -0
- package/dist/features/quality-coverage/api.js.map +1 -1
- package/dist/features/quality-coverage/application/model.d.ts +18 -0
- package/dist/features/quality-coverage/application/model.d.ts.map +1 -1
- package/dist/features/quality-coverage/application/model.js +9 -1
- package/dist/features/quality-coverage/application/model.js.map +1 -1
- package/dist/features/quality-coverage/node.d.ts +1 -0
- package/dist/features/quality-coverage/node.d.ts.map +1 -1
- package/dist/features/quality-coverage/node.js +1 -0
- package/dist/features/quality-coverage/node.js.map +1 -1
- package/dist/features/validation-reporting/api.d.ts +2 -2
- package/dist/features/validation-reporting/api.d.ts.map +1 -1
- package/dist/features/validation-reporting/api.js +1 -1
- package/dist/features/validation-reporting/api.js.map +1 -1
- package/dist/features/validation-reporting/application/capability-registries.d.ts +3 -1
- package/dist/features/validation-reporting/application/capability-registries.d.ts.map +1 -1
- package/dist/features/validation-reporting/application/capability-registries.js +4 -0
- package/dist/features/validation-reporting/application/capability-registries.js.map +1 -1
- package/dist/process-execution/application/errors.d.ts +1 -1
- package/dist/process-execution/application/errors.d.ts.map +1 -1
- package/dist/process-execution/application/errors.js +1 -1
- package/dist/process-execution/application/errors.js.map +1 -1
- package/dist/process-execution/application/process-failure-policy.d.ts +1 -1
- package/dist/process-execution/application/process-failure-policy.d.ts.map +1 -1
- package/dist/process-execution/application/process-failure-policy.js +1 -1
- package/dist/process-execution/application/process-failure-policy.js.map +1 -1
- package/dist/process-execution/application/runtime-selection.d.ts +26 -0
- package/dist/process-execution/application/runtime-selection.d.ts.map +1 -0
- package/dist/process-execution/application/runtime-selection.js +60 -0
- package/dist/process-execution/application/runtime-selection.js.map +1 -0
- package/dist/process-execution/module.d.ts +1 -0
- package/dist/process-execution/module.d.ts.map +1 -1
- package/dist/process-execution/module.js +1 -0
- package/dist/process-execution/module.js.map +1 -1
- package/dist/process-execution/node-process-runner.d.ts +15 -4
- package/dist/process-execution/node-process-runner.d.ts.map +1 -1
- package/dist/process-execution/node-process-runner.js +242 -231
- package/dist/process-execution/node-process-runner.js.map +1 -1
- package/dist/process-execution/node-runtime-verifier.d.ts +17 -0
- package/dist/process-execution/node-runtime-verifier.d.ts.map +1 -0
- package/dist/process-execution/node-runtime-verifier.js +116 -0
- package/dist/process-execution/node-runtime-verifier.js.map +1 -0
- package/dist/process-execution/windows-command-launch.d.ts +4 -0
- package/dist/process-execution/windows-command-launch.d.ts.map +1 -0
- package/dist/process-execution/windows-command-launch.js +46 -0
- package/dist/process-execution/windows-command-launch.js.map +1 -0
- package/dist/process-execution/windows-managed-process-diagnostics.d.ts +11 -2
- package/dist/process-execution/windows-managed-process-diagnostics.d.ts.map +1 -1
- package/dist/process-execution/windows-managed-process-diagnostics.js +54 -1
- package/dist/process-execution/windows-managed-process-diagnostics.js.map +1 -1
- package/dist/process-execution/windows-managed-process.d.ts +6 -1
- package/dist/process-execution/windows-managed-process.d.ts.map +1 -1
- package/dist/process-execution/windows-managed-process.js +32 -13
- package/dist/process-execution/windows-managed-process.js.map +1 -1
- package/dist/ratchet.d.ts +5 -0
- package/dist/ratchet.d.ts.map +1 -0
- package/dist/ratchet.js +3 -0
- package/dist/ratchet.js.map +1 -0
- package/dist/schema-catalog.d.ts +1 -1
- package/dist/schema-catalog.d.ts.map +1 -1
- package/dist/schema-ids.d.ts +1 -1
- package/dist/schema-ids.d.ts.map +1 -1
- package/dist/schema-ids.js +2 -0
- package/dist/schema-ids.js.map +1 -1
- package/dist/source-graph.d.ts +3 -0
- package/dist/source-graph.d.ts.map +1 -0
- package/dist/source-graph.js +2 -0
- package/dist/source-graph.js.map +1 -0
- package/package.json +12 -1
- package/schemas/quality-findings-baseline/v1.schema.json +41 -0
- package/schemas/quality-gate-runner/v2.schema.json +70 -0
package/README.md
CHANGED
|
@@ -94,6 +94,14 @@ contract-evolution, suppression, public API, and repository-security checks are
|
|
|
94
94
|
adopted independently with consumer-owned policy and capability-qualification evidence.
|
|
95
95
|
Installing or upgrading this package never enables them automatically.
|
|
96
96
|
|
|
97
|
+
Two further subpaths expose architecture-neutral mechanisms:
|
|
98
|
+
`@agent-teams/engineering-foundation/ratchet` (the shrink-only findings baseline
|
|
99
|
+
and growth budgets) and `@agent-teams/engineering-foundation/source-graph`
|
|
100
|
+
(files, import edges, bare specifiers and strongly connected components). The
|
|
101
|
+
findings baseline also has the commands `agent-teams-foundation baseline
|
|
102
|
+
check|init|prune --config <file>`; see
|
|
103
|
+
[findings baseline](../../docs/architecture/findings-baseline.md).
|
|
104
|
+
|
|
97
105
|
Source-dependency schema v3 is pending combined validation and package
|
|
98
106
|
qualification. Explicit `rootPackage: true` governs only declared root-owned
|
|
99
107
|
source scopes; overlapping package selectors retain direct-child selection and
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FindingsBaselinePolicy } from "../../../application/model.js";
|
|
2
|
+
export interface FindingsBaselineConfigurationDependencies {
|
|
3
|
+
readonly readYaml: (consumerRoot: string, configPath: string, phase: string, signal?: AbortSignal) => Promise<unknown>;
|
|
4
|
+
readonly assertSchema: (schemaId: "quality-findings-baseline/v1", input: unknown, phase: string) => Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
export declare function loadCapabilityConfig(dependencies: FindingsBaselineConfigurationDependencies, consumerRoot: string, configPath: string, signal?: AbortSignal): Promise<FindingsBaselinePolicy>;
|
|
7
|
+
//# sourceMappingURL=load-capability-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-capability-config.d.ts","sourceRoot":"","sources":["../../../../../../src/capabilities/findings-baseline/adapters/inbound/configuration/load-capability-config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAE5E,MAAM,WAAW,yCAAyC;IACxD,QAAQ,CAAC,QAAQ,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACvH,QAAQ,CAAC,YAAY,EAAE,CAAC,QAAQ,EAAE,8BAA8B,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACnH;AAwBD,wBAAsB,oBAAoB,CACxC,YAAY,EAAE,yCAAyC,EACvD,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,sBAAsB,CAAC,CAIjC"}
|
package/dist/capabilities/findings-baseline/adapters/inbound/configuration/load-capability-config.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { assertConfigRepositoryRelativePath, inputFailure } from "../../../application/configuration-input.js";
|
|
2
|
+
const PHASE = "findings-baseline-config";
|
|
3
|
+
function repositoryPath(path) {
|
|
4
|
+
assertConfigRepositoryRelativePath(path, PHASE);
|
|
5
|
+
return path;
|
|
6
|
+
}
|
|
7
|
+
/** The JSON Schema fixes the shape; this adds the repository-relative path rules the schema cannot express. */
|
|
8
|
+
function mapPolicy(input) {
|
|
9
|
+
const { baselinePath, oxlint } = input;
|
|
10
|
+
const measuredRules = oxlint.measuredRules ?? [];
|
|
11
|
+
if (new Set(measuredRules).size !== measuredRules.length) {
|
|
12
|
+
inputFailure("FINDINGS_BASELINE_CONFIG_INVALID", "oxlint.measuredRules must not repeat a rule.", PHASE);
|
|
13
|
+
}
|
|
14
|
+
return Object.freeze({
|
|
15
|
+
baselinePath: repositoryPath(baselinePath),
|
|
16
|
+
oxlint: Object.freeze({
|
|
17
|
+
configPath: repositoryPath(oxlint.configPath),
|
|
18
|
+
roots: Object.freeze(oxlint.roots.map(repositoryPath)),
|
|
19
|
+
measuredRules: Object.freeze([...measuredRules])
|
|
20
|
+
})
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
export async function loadCapabilityConfig(dependencies, consumerRoot, configPath, signal) {
|
|
24
|
+
const input = await dependencies.readYaml(consumerRoot, configPath, PHASE, signal);
|
|
25
|
+
await dependencies.assertSchema("quality-findings-baseline/v1", input, PHASE);
|
|
26
|
+
return mapPolicy(input);
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=load-capability-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-capability-config.js","sourceRoot":"","sources":["../../../../../../src/capabilities/findings-baseline/adapters/inbound/configuration/load-capability-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kCAAkC,EAAE,YAAY,EAAE,MAAM,6CAA6C,CAAC;AAQ/G,MAAM,KAAK,GAAG,0BAA0B,CAAC;AAEzC,SAAS,cAAc,CAAC,IAAY;IAClC,kCAAkC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAChD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,+GAA+G;AAC/G,SAAS,SAAS,CAAC,KAAc;IAC/B,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,KAA4G,CAAC;IAC9I,MAAM,aAAa,GAAG,MAAM,CAAC,aAAa,IAAI,EAAE,CAAC;IACjD,IAAI,IAAI,GAAG,CAAC,aAAa,CAAC,CAAC,IAAI,KAAK,aAAa,CAAC,MAAM,EAAE,CAAC;QAAC,YAAY,CAAC,kCAAkC,EAAE,8CAA8C,EAAE,KAAK,CAAC,CAAC;IAAC,CAAC;IACtK,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,YAAY,EAAE,cAAc,CAAC,YAAY,CAAC;QAC1C,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC;YACpB,UAAU,EAAE,cAAc,CAAC,MAAM,CAAC,UAAU,CAAC;YAC7C,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;YACtD,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC;SACjD,CAAC;KACH,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,YAAuD,EACvD,YAAoB,EACpB,UAAkB,EAClB,MAAoB;IAEpB,MAAM,KAAK,GAAG,MAAM,YAAY,CAAC,QAAQ,CAAC,YAAY,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IACnF,MAAM,YAAY,CAAC,YAAY,CAAC,8BAA8B,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAC9E,OAAO,SAAS,CAAC,KAAK,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { FindingsBaselineStore } from "../../../application/model.js";
|
|
2
|
+
export interface BaselineFileOperations {
|
|
3
|
+
readonly read: (input: {
|
|
4
|
+
readonly candidate: string;
|
|
5
|
+
readonly maxBytes: number;
|
|
6
|
+
readonly root: string;
|
|
7
|
+
}) => Promise<Uint8Array>;
|
|
8
|
+
readonly pathTraversesSymbolicLink: (root: string, candidate: string) => Promise<boolean>;
|
|
9
|
+
}
|
|
10
|
+
/** Reads and writes one contained regular file. Creation is exclusive and replacement is compare-and-swap. */
|
|
11
|
+
export declare class FilesystemFindingsBaselineStore implements FindingsBaselineStore {
|
|
12
|
+
private readonly operations;
|
|
13
|
+
constructor(operations: BaselineFileOperations);
|
|
14
|
+
private locate;
|
|
15
|
+
read(consumerRoot: string, path: string, signal?: AbortSignal): Promise<string | undefined>;
|
|
16
|
+
create(consumerRoot: string, path: string, text: string): Promise<void>;
|
|
17
|
+
replace(consumerRoot: string, path: string, text: string, expected: string): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=filesystem-findings-baseline-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filesystem-findings-baseline-store.d.ts","sourceRoot":"","sources":["../../../../../../src/capabilities/findings-baseline/adapters/outbound/filesystem/filesystem-findings-baseline-store.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAI3E,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IAChI,QAAQ,CAAC,yBAAyB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAC3F;AAMD,8GAA8G;AAC9G,qBAAa,+BAAgC,YAAW,qBAAqB;IAC/D,OAAO,CAAC,QAAQ,CAAC,UAAU;IAAvC,YAA6B,UAAU,EAAE,sBAAsB,EAAI;YAErD,MAAM;IAad,IAAI,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAShG;IAEK,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAe5E;IAEK,OAAO,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAa/F;CACF"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { mkdir, open, realpath, rename, rm } from "node:fs/promises";
|
|
2
|
+
import { dirname, isAbsolute, relative, resolve, sep } from "node:path";
|
|
3
|
+
import { inputFailure } from "../../../application/configuration-input.js";
|
|
4
|
+
const MAX_BASELINE_BYTES = 8 * 1024 * 1024;
|
|
5
|
+
function reject(code, message) {
|
|
6
|
+
return inputFailure(code, message, "findings-baseline-store");
|
|
7
|
+
}
|
|
8
|
+
/** Reads and writes one contained regular file. Creation is exclusive and replacement is compare-and-swap. */
|
|
9
|
+
export class FilesystemFindingsBaselineStore {
|
|
10
|
+
operations;
|
|
11
|
+
constructor(operations) {
|
|
12
|
+
this.operations = operations;
|
|
13
|
+
}
|
|
14
|
+
async locate(consumerRoot, path) {
|
|
15
|
+
const root = await realpath(consumerRoot);
|
|
16
|
+
const candidate = resolve(root, path);
|
|
17
|
+
const relation = relative(root, candidate);
|
|
18
|
+
if (relation === "" || isAbsolute(relation) || relation === ".." || relation.startsWith(`..${sep}`)) {
|
|
19
|
+
reject("FINDINGS_BASELINE_PATH_ESCAPE", `Findings baseline path escapes the consumer repository: ${path}.`);
|
|
20
|
+
}
|
|
21
|
+
if (await this.operations.pathTraversesSymbolicLink(root, candidate)) {
|
|
22
|
+
reject("FINDINGS_BASELINE_PATH_SYMLINK", `Findings baseline path traverses a symbolic link: ${path}.`);
|
|
23
|
+
}
|
|
24
|
+
return { root, candidate };
|
|
25
|
+
}
|
|
26
|
+
async read(consumerRoot, path, signal) {
|
|
27
|
+
signal?.throwIfAborted();
|
|
28
|
+
const { root, candidate } = await this.locate(consumerRoot, path);
|
|
29
|
+
try {
|
|
30
|
+
return new TextDecoder("utf-8", { fatal: true }).decode(await this.operations.read({ root, candidate, maxBytes: MAX_BASELINE_BYTES }));
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
if (error instanceof Error && "failure" in error && error.failure === "missing") {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
reject("FINDINGS_BASELINE_UNREADABLE", `Findings baseline cannot be read as a contained UTF-8 file: ${path}.`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
async create(consumerRoot, path, text) {
|
|
40
|
+
const { root, candidate } = await this.locate(consumerRoot, path);
|
|
41
|
+
await mkdir(dirname(candidate), { recursive: true });
|
|
42
|
+
if (await this.operations.pathTraversesSymbolicLink(root, dirname(candidate))) {
|
|
43
|
+
reject("FINDINGS_BASELINE_PATH_SYMLINK", `Findings baseline path traverses a symbolic link: ${path}.`);
|
|
44
|
+
}
|
|
45
|
+
try {
|
|
46
|
+
const handle = await open(candidate, "wx", 0o644);
|
|
47
|
+
try {
|
|
48
|
+
await handle.writeFile(text, "utf8");
|
|
49
|
+
await handle.sync();
|
|
50
|
+
}
|
|
51
|
+
finally {
|
|
52
|
+
await handle.close();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
if (error instanceof Error && "code" in error && error.code === "EEXIST") {
|
|
57
|
+
reject("FINDINGS_BASELINE_EXISTS", `A findings baseline already exists: ${path}.`);
|
|
58
|
+
}
|
|
59
|
+
throw error;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
async replace(consumerRoot, path, text, expected) {
|
|
63
|
+
const { candidate } = await this.locate(consumerRoot, path);
|
|
64
|
+
const temporary = `${candidate}.${process.pid}.tmp`;
|
|
65
|
+
try {
|
|
66
|
+
const handle = await open(temporary, "wx", 0o644);
|
|
67
|
+
try {
|
|
68
|
+
await handle.writeFile(text, "utf8");
|
|
69
|
+
await handle.sync();
|
|
70
|
+
}
|
|
71
|
+
finally {
|
|
72
|
+
await handle.close();
|
|
73
|
+
}
|
|
74
|
+
if (await this.read(consumerRoot, path) !== expected) {
|
|
75
|
+
reject("FINDINGS_BASELINE_CHANGED", `Findings baseline changed while it was being pruned: ${path}.`);
|
|
76
|
+
}
|
|
77
|
+
await rename(temporary, candidate);
|
|
78
|
+
}
|
|
79
|
+
finally {
|
|
80
|
+
await rm(temporary, { force: true });
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=filesystem-findings-baseline-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filesystem-findings-baseline-store.js","sourceRoot":"","sources":["../../../../../../src/capabilities/findings-baseline/adapters/outbound/filesystem/filesystem-findings-baseline-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAExE,OAAO,EAAE,YAAY,EAAE,MAAM,6CAA6C,CAAC;AAG3E,MAAM,kBAAkB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AAO3C,SAAS,MAAM,CAAC,IAAY,EAAE,OAAe;IAC3C,OAAO,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,yBAAyB,CAAC,CAAC;AAChE,CAAC;AAED,8GAA8G;AAC9G,MAAM,OAAO,+BAA+B;IACb,UAAU;IAAvC,YAA6B,UAAkC;0BAAlC,UAAU;IAA2B,CAAC;IAE3D,KAAK,CAAC,MAAM,CAAC,YAAoB,EAAE,IAAY;QACrD,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,YAAY,CAAC,CAAC;QAC1C,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACtC,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAC3C,IAAI,QAAQ,KAAK,EAAE,IAAI,UAAU,CAAC,QAAQ,CAAC,IAAI,QAAQ,KAAK,IAAI,IAAI,QAAQ,CAAC,UAAU,CAAC,KAAK,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AS,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;gBAAC,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;YAAC,CAAC;oBAAS,CAAC;gBAAC,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;YAAC,CAAC;YACpG,IAAI,MAAM,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,KAAK,QAAQ,EAAE,CAAC;gBACrD,MAAM,CAAC,2BAA2B,EAAE,wDAAwD,IAAI,GAAG,CAAC,CAAC;YACvG,CAAC;YACD,MAAM,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QACrC,CAAC;gBAAS,CAAC;YACT,MAAM,EAAE,CAAC,SAAS,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACvC,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/** One finding class of one file. `max` is the largest measured value for rules that carry one. */
|
|
2
|
+
export interface Finding {
|
|
3
|
+
readonly path: string;
|
|
4
|
+
readonly rule: string;
|
|
5
|
+
readonly count: number;
|
|
6
|
+
readonly max?: number;
|
|
7
|
+
}
|
|
8
|
+
export type FindingViolationKind = "new" | "worse" | "stale";
|
|
9
|
+
export interface FindingViolation {
|
|
10
|
+
readonly kind: FindingViolationKind;
|
|
11
|
+
readonly path: string;
|
|
12
|
+
readonly rule: string;
|
|
13
|
+
readonly baseline?: Pick<Finding, "count" | "max">;
|
|
14
|
+
readonly observed?: Pick<Finding, "count" | "max">;
|
|
15
|
+
}
|
|
16
|
+
export interface PrunedBaseline {
|
|
17
|
+
readonly entries: readonly Finding[];
|
|
18
|
+
readonly lowered: number;
|
|
19
|
+
readonly removed: number;
|
|
20
|
+
/** New and worse findings that pruning cannot accept; they keep failing the check. */
|
|
21
|
+
readonly remaining: readonly FindingViolation[];
|
|
22
|
+
}
|
|
23
|
+
export declare class FindingsBaselineError extends Error {
|
|
24
|
+
readonly name = "FindingsBaselineError";
|
|
25
|
+
}
|
|
26
|
+
export declare const compareText: (left: string, right: string) => number;
|
|
27
|
+
/** Canonical text: a version line, then one JSON object per path and rule in binary order. */
|
|
28
|
+
export declare function formatBaseline(entries: readonly Finding[]): string;
|
|
29
|
+
/** Rejects anything that is not exactly the canonical text, so a hand edit cannot hide a change. */
|
|
30
|
+
export declare function parseBaseline(text: string): readonly Finding[];
|
|
31
|
+
/**
|
|
32
|
+
* Compares the findings one producer observed with the baseline entries of its namespace.
|
|
33
|
+
* A finding that is not baselined or is above its entry fails as new or worse; an entry above
|
|
34
|
+
* the observed finding, or one without a finding, fails as stale. Other namespaces are not read.
|
|
35
|
+
*/
|
|
36
|
+
export declare function checkFindings(input: {
|
|
37
|
+
readonly baseline: readonly Finding[];
|
|
38
|
+
readonly observed: readonly Finding[];
|
|
39
|
+
readonly namespace: string;
|
|
40
|
+
}): readonly FindingViolation[];
|
|
41
|
+
/** Lowers entries to the observed values and removes entries without a finding. Never adds or raises. */
|
|
42
|
+
export declare function pruneBaseline(input: {
|
|
43
|
+
readonly baseline: readonly Finding[];
|
|
44
|
+
readonly observed: readonly Finding[];
|
|
45
|
+
readonly namespace: string;
|
|
46
|
+
}): PrunedBaseline;
|
|
47
|
+
/** The first baseline of a producer. Refuses when the baseline file already exists. */
|
|
48
|
+
export declare function initBaseline(input: {
|
|
49
|
+
readonly observed: readonly Finding[];
|
|
50
|
+
readonly existing?: string;
|
|
51
|
+
}): readonly Finding[];
|
|
52
|
+
//# sourceMappingURL=baseline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"baseline.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/findings-baseline/application/baseline.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,Q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AAM,CAAC;CAC5B,GAAG,SAAS,gBAAgB,EAAE,CAkB9B;AAED,yGAAyG;AACzG,wBAAgB,aAAa,CAAC,KAAK,EAAE;IACnC,QAAQ,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAC;IACtC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B,GAAG,cAAc,CAuBjB;AAED,uFAAuF;AACvF,wBAAgB,YAAY,CAAC,KAAK,EAAE;IAAE,QAAQ,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAC;IAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,OAAO,EAAE,CAG7H"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
export class FindingsBaselineError extends Error {
|
|
2
|
+
name = "FindingsBaselineError";
|
|
3
|
+
}
|
|
4
|
+
// UTF-16 code unit order, the order of compareBinaryStrings; only the consumers admitted by ADR-0047 may import that primitive.
|
|
5
|
+
export const compareText = (left, right) => (left < right ? -1 : left > right ? 1 : 0);
|
|
6
|
+
const HEADER = '{"findingsBaseline":1}';
|
|
7
|
+
const RULE_PATTERN = /^[a-z0-9][a-z0-9-]*\/[^\s]+$/u;
|
|
8
|
+
function fail(message) {
|
|
9
|
+
throw new FindingsBaselineError(message);
|
|
10
|
+
}
|
|
11
|
+
function compareFindings(left, right) {
|
|
12
|
+
return compareText(left.path, right.path) || compareText(left.rule, right.rule);
|
|
13
|
+
}
|
|
14
|
+
function identity({ path, rule }) {
|
|
15
|
+
return `${path}\u0000${rule}`;
|
|
16
|
+
}
|
|
17
|
+
function assertFinding(finding) {
|
|
18
|
+
const validPath = finding.path.length > 0 && finding.path.length <= 1024 &&
|
|
19
|
+
!finding.path.startsWith("/") && !finding.path.includes("\\") &&
|
|
20
|
+
finding.path.split("").every((character) => character >= " " && character !== "\u007f") &&
|
|
21
|
+
finding.path.split("/").every((segment) => segment !== "" && segment !== "." && segment !== "..");
|
|
22
|
+
if (!validPath) {
|
|
23
|
+
fail(`Finding path is not a repository-relative path: ${JSON.stringify(finding.path)}.`);
|
|
24
|
+
}
|
|
25
|
+
if (!RULE_PATTERN.test(finding.rule) || finding.rule.length > 200) {
|
|
26
|
+
fail(`Finding rule must be "<namespace>/<rule>": ${JSON.stringify(finding.rule)}.`);
|
|
27
|
+
}
|
|
28
|
+
if (!Number.isSafeInteger(finding.count) || finding.count < 1) {
|
|
29
|
+
fail(`Finding count must be a positive integer: ${finding.path} ${finding.rule}.`);
|
|
30
|
+
}
|
|
31
|
+
if (finding.max !== undefined && (!Number.isSafeInteger(finding.max) || finding.max < 0)) {
|
|
32
|
+
fail(`Finding max must be a non-negative integer: ${finding.path} ${finding.rule}.`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function canonical(entries) {
|
|
36
|
+
const sorted = entries.toSorted(compareFindings);
|
|
37
|
+
for (const [index, entry] of sorted.entries()) {
|
|
38
|
+
assertFinding(entry);
|
|
39
|
+
if (index > 0 && identity(sorted[index - 1]) === identity(entry)) {
|
|
40
|
+
fail(`Duplicate finding: ${entry.path} ${entry.rule}.`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return sorted;
|
|
44
|
+
}
|
|
45
|
+
/** Canonical text: a version line, then one JSON object per path and rule in binary order. */
|
|
46
|
+
export function formatBaseline(entries) {
|
|
47
|
+
const lines = canonical(entries).map(({ path, rule, count, max }) => JSON.stringify(max === undefined ? { path, rule, count } : { path, rule, count, max }));
|
|
48
|
+
return `${[HEADER, ...lines].join("\n")}\n`;
|
|
49
|
+
}
|
|
50
|
+
/** Rejects anything that is not exactly the canonical text, so a hand edit cannot hide a change. */
|
|
51
|
+
export function parseBaseline(text) {
|
|
52
|
+
const lines = text.split("\n");
|
|
53
|
+
if (lines[0] !== HEADER || lines.at(-1) !== "") {
|
|
54
|
+
fail("Findings baseline must start with its version line and end with a newline.");
|
|
55
|
+
}
|
|
56
|
+
const entries = lines.slice(1, -1).map((line, index) => {
|
|
57
|
+
let value;
|
|
58
|
+
try {
|
|
59
|
+
value = JSON.parse(line);
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
fail(`Findings baseline line ${index + 2} is not JSON.`);
|
|
63
|
+
}
|
|
64
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
65
|
+
fail(`Findings baseline line ${index + 2} is not an object.`);
|
|
66
|
+
}
|
|
67
|
+
const { path, rule, count, max, ...unknown } = value;
|
|
68
|
+
if (Object.keys(unknown).length > 0 || typeof path !== "string" || typeof rule !== "string" ||
|
|
69
|
+
typeof count !== "number" || (max !== undefined && typeof max !== "number")) {
|
|
70
|
+
fail(`Findings baseline line ${index + 2} has unexpected fields.`);
|
|
71
|
+
}
|
|
72
|
+
return max === undefined ? { path, rule, count } : { path, rule, count, max };
|
|
73
|
+
});
|
|
74
|
+
if (formatBaseline(entries) !== text) {
|
|
75
|
+
fail("Findings baseline is not canonical: entries must be unique, sorted and one per line.");
|
|
76
|
+
}
|
|
77
|
+
return entries;
|
|
78
|
+
}
|
|
79
|
+
function scoped(findings, namespace) {
|
|
80
|
+
return findings.filter(({ rule }) => rule.startsWith(`${namespace}/`));
|
|
81
|
+
}
|
|
82
|
+
function observedIn(namespace, observed) {
|
|
83
|
+
for (const finding of canonical(observed)) {
|
|
84
|
+
if (!finding.rule.startsWith(`${namespace}/`)) {
|
|
85
|
+
fail(`Finding ${finding.rule} is outside the ${namespace} namespace.`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return new Map(observed.map((finding) => [identity(finding), finding]));
|
|
89
|
+
}
|
|
90
|
+
function exceeds(left, right) {
|
|
91
|
+
return left.count > right.count || (left.max ?? -1) > (right.max ?? -1);
|
|
92
|
+
}
|
|
93
|
+
const measure = ({ count, max }) => max === undefined ? { count } : { count, max };
|
|
94
|
+
/**
|
|
95
|
+
* Compares the findings one producer observed with the baseline entries of its namespace.
|
|
96
|
+
* A finding that is not baselined or is above its entry fails as new or worse; an entry above
|
|
97
|
+
* the observed finding, or one without a finding, fails as stale. Other namespaces are not read.
|
|
98
|
+
*/
|
|
99
|
+
export function checkFindings(input) {
|
|
100
|
+
const observed = observedIn(input.namespace, input.observed);
|
|
101
|
+
const entries = new Map(scoped(canonical(input.baseline), input.namespace).map((entry) => [identity(entry), entry]));
|
|
102
|
+
const violations = [];
|
|
103
|
+
for (const [key, finding] of observed) {
|
|
104
|
+
const entry = entries.get(key);
|
|
105
|
+
if (entry === undefined) {
|
|
106
|
+
violations.push({ kind: "new", path: finding.path, rule: finding.rule, observed: measure(finding) });
|
|
107
|
+
}
|
|
108
|
+
else if (exceeds(finding, entry)) {
|
|
109
|
+
violations.push({ kind: "worse", path: finding.path, rule: finding.rule, baseline: measure(entry), observed: measure(finding) });
|
|
110
|
+
}
|
|
111
|
+
else if (exceeds(entry, finding)) {
|
|
112
|
+
violations.push({ kind: "stale", path: finding.path, rule: finding.rule, baseline: measure(entry), observed: measure(finding) });
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
for (const [key, entry] of entries) {
|
|
116
|
+
if (!observed.has(key)) {
|
|
117
|
+
violations.push({ kind: "stale", path: entry.path, rule: entry.rule, baseline: measure(entry) });
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return violations.toSorted((left, right) => compareFindings(left, right));
|
|
121
|
+
}
|
|
122
|
+
/** Lowers entries to the observed values and removes entries without a finding. Never adds or raises. */
|
|
123
|
+
export function pruneBaseline(input) {
|
|
124
|
+
const observed = observedIn(input.namespace, input.observed);
|
|
125
|
+
const kept = [];
|
|
126
|
+
let lowered = 0;
|
|
127
|
+
let removed = 0;
|
|
128
|
+
for (const entry of canonical(input.baseline)) {
|
|
129
|
+
const finding = observed.get(identity(entry));
|
|
130
|
+
if (!entry.rule.startsWith(`${input.namespace}/`)) {
|
|
131
|
+
kept.push(entry);
|
|
132
|
+
}
|
|
133
|
+
else if (finding === undefined) {
|
|
134
|
+
removed += 1;
|
|
135
|
+
}
|
|
136
|
+
else if (exceeds(entry, finding)) {
|
|
137
|
+
const count = Math.min(entry.count, finding.count);
|
|
138
|
+
const max = entry.max === undefined || finding.max === undefined ? undefined : Math.min(entry.max, finding.max);
|
|
139
|
+
kept.push(max === undefined ? { path: entry.path, rule: entry.rule, count } : { path: entry.path, rule: entry.rule, count, max });
|
|
140
|
+
lowered += 1;
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
kept.push(entry);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
const remaining = checkFindings({ baseline: kept, observed: input.observed, namespace: input.namespace })
|
|
147
|
+
.filter(({ kind }) => kind !== "stale");
|
|
148
|
+
return { entries: canonical(kept), lowered, removed, remaining };
|
|
149
|
+
}
|
|
150
|
+
/** The first baseline of a producer. Refuses when the baseline file already exists. */
|
|
151
|
+
export function initBaseline(input) {
|
|
152
|
+
if (input.existing !== undefined) {
|
|
153
|
+
fail("A findings baseline already exists; use prune to lower it.");
|
|
154
|
+
}
|
|
155
|
+
return canonical(input.observed);
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=baseline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"baseline.js","sourceRoot":"","sources":["../../../../src/capabilities/findings-baseline/application/baseline.ts"],"names":[],"mappings":"AA0BA,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAC5B,IAAI,GAAG,uBAAuB,CAAC;CAClD;AAED,gIAAgI;AAChI,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAY,EAAE,KAAa,EAAU,EAAE,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE/G,MAAM,MAAM,GAAG,wBAAwB,CAAC;AACxC,MAAM,YAA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EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;YAClI,OAAO,IAAI,CAAC,CAAC;QACf,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACnB,CAAC;IACH,CAAC;IACD,MAAM,SAAS,GAAG,aAAa,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;SACtG,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC;IAC1C,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;AACnE,CAAC;AAED,uFAAuF;AACvF,MAAM,UAAU,YAAY,CAAC,KAA4E;IACvG,IAAI,KAAK,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;QAAC,IAAI,CAAC,4DAA4D,CAAC,CAAC;IAAC,CAAC;IACzG,OAAO,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface Measurement {
|
|
2
|
+
readonly subject: string;
|
|
3
|
+
readonly metric: string;
|
|
4
|
+
readonly value: number;
|
|
5
|
+
}
|
|
6
|
+
/** A ceiling for a metric. A threshold with a `subject` replaces the general threshold of that metric for the subject. */
|
|
7
|
+
export interface Threshold {
|
|
8
|
+
readonly metric: string;
|
|
9
|
+
readonly max: number;
|
|
10
|
+
readonly subject?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface BudgetWarning extends Measurement {
|
|
13
|
+
readonly max: number;
|
|
14
|
+
}
|
|
15
|
+
/** Growth budgets only warn; they never fail a check. Duplicate thresholds and non-finite numbers are rejected. */
|
|
16
|
+
export declare function checkBudgets(input: {
|
|
17
|
+
readonly measurements: readonly Measurement[];
|
|
18
|
+
readonly thresholds: readonly Threshold[];
|
|
19
|
+
}): readonly BudgetWarning[];
|
|
20
|
+
/** GitHub Actions workflow commands, one warning annotation per budget warning. */
|
|
21
|
+
export declare function formatBudgetAnnotations(warnings: readonly BudgetWarning[]): string;
|
|
22
|
+
//# sourceMappingURL=budgets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"budgets.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/findings-baseline/application/budgets.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,0HAA0H;AAC1H,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,aAAc,SAAQ,WAAW;IAChD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAeD,mHAAmH;AACnH,wBAAgB,YAAY,CAAC,KAAK,EAAE;IAClC,QAAQ,CAAC,YAAY,EAAE,SAAS,WAAW,EAAE,CAAC;IAC9C,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;CAC3C,GAAG,SAAS,aAAa,EAAE,CAS3B;AAKD,mFAAmF;AACnF,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,SAAS,aAAa,EAAE,GAAG,MAAM,CAGlF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { compareText, FindingsBaselineError } from "./baseline.js";
|
|
2
|
+
function assertBudgetInput(measurements, thresholds) {
|
|
3
|
+
const seen = new Set();
|
|
4
|
+
for (const { metric, subject, max } of thresholds) {
|
|
5
|
+
const key = `${metric}\u0000${subject ?? ""}\u0000${subject === undefined}`;
|
|
6
|
+
if (seen.has(key)) {
|
|
7
|
+
throw new FindingsBaselineError(`Threshold for ${metric}${subject === undefined ? "" : ` of ${subject}`} is declared more than once.`);
|
|
8
|
+
}
|
|
9
|
+
seen.add(key);
|
|
10
|
+
if (!Number.isFinite(max)) {
|
|
11
|
+
throw new FindingsBaselineError(`Threshold max for ${metric} must be a finite number.`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
for (const { subject, metric, value } of measurements) {
|
|
15
|
+
if (!Number.isFinite(value)) {
|
|
16
|
+
throw new FindingsBaselineError(`Measurement ${metric} of ${subject} must be a finite number.`);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/** Growth budgets only warn; they never fail a check. Duplicate thresholds and non-finite numbers are rejected. */
|
|
21
|
+
export function checkBudgets(input) {
|
|
22
|
+
assertBudgetInput(input.measurements, input.thresholds);
|
|
23
|
+
const warnings = [];
|
|
24
|
+
for (const measurement of input.measurements) {
|
|
25
|
+
const matching = input.thresholds.filter(({ metric }) => metric === measurement.metric);
|
|
26
|
+
const threshold = matching.find(({ subject }) => subject === measurement.subject) ?? matching.find(({ subject }) => subject === undefined);
|
|
27
|
+
if (threshold !== undefined && measurement.value > threshold.max) {
|
|
28
|
+
warnings.push({ ...measurement, max: threshold.max });
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return warnings.toSorted((left, right) => compareText(left.subject, right.subject) || compareText(left.metric, right.metric));
|
|
32
|
+
}
|
|
33
|
+
const escapeData = (value) => value.replaceAll("%", "%25").replaceAll("\r", "%0D").replaceAll("\n", "%0A");
|
|
34
|
+
const escapeProperty = (value) => escapeData(value).replaceAll(":", "%3A").replaceAll(",", "%2C");
|
|
35
|
+
/** GitHub Actions workflow commands, one warning annotation per budget warning. */
|
|
36
|
+
export function formatBudgetAnnotations(warnings) {
|
|
37
|
+
return warnings.map(({ subject, metric, value, max }) => `::warning title=${escapeProperty(`${metric} budget`)}::${escapeData(`${subject}: ${metric} is ${value}, budget ${max}`)}\n`).join("");
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=budgets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"budgets.js","sourceRoot":"","sources":["../../../../src/capabilities/findings-baseline/application/budgets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAmBnE,SAAS,iBAAiB,CAAC,YAAoC,EAAE,UAAgC;IAC/F,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,KAAK,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,UAAU,EAAE,CAAC;QAClD,MAAM,GAAG,GAAG,GAAG,MAAM,SAAS,OAAO,IAAI,EAAE,SAAS,OAAO,KAAK,SAAS,EAAE,CAAC;QAC5E,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YAAC,MAAM,IAAI,qBAAqB,CAAC,iBAAiB,MAAM,GAAG,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,OAAO,EAAE,8BAA8B,CAAC,CAAC;QAAC,CAAC;QAC9J,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACd,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAAC,MAAM,IAAI,qBAAqB,CAAC,qBAAqB,MAAM,2BAA2B,CAAC,CAAC;QAAC,CAAC;IACzH,CAAC;IACD,KAAK,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,YAAY,EAAE,C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C;AAED,MAAM,UAAU,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC3H,MAAM,cAAc,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AAElH,mFAAmF;AACnF,MAAM,UAAU,uBAAuB,CAAC,QAAkC;IACxE,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,CACtD,mBAAmB,cAAc,CAAC,GAAG,MAAM,SAAS,CAAC,KAAK,UAAU,CAAC,GAAG,OAAO,KAAK,MAAM,OAAO,KAAK,YAAY,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC3I,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Input failures of the configuration and the baseline file; adapters report them through this one gate. */
|
|
2
|
+
export declare function inputFailure(code: string, message: string, phase: string): never;
|
|
3
|
+
export declare function assertConfigRepositoryRelativePath(path: string, phase: string): void;
|
|
4
|
+
//# sourceMappingURL=configuration-input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration-input.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/findings-baseline/application/configuration-input.ts"],"names":[],"mappings":"AAGA,6GAA6G;AAC7G,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,KAAK,CAEhF;AAED,wBAAgB,kCAAkC,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAEpF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CapabilityInputError } from "../../../features/validation-reporting/api.js";
|
|
2
|
+
import { assertRepositoryRelativePath } from "../../../source-inventory/api.js";
|
|
3
|
+
/** Input failures of the configuration and the baseline file; adapters report them through this one gate. */
|
|
4
|
+
export function inputFailure(code, message, phase) {
|
|
5
|
+
throw new CapabilityInputError({ code, message, phase, retryable: false });
|
|
6
|
+
}
|
|
7
|
+
export function assertConfigRepositoryRelativePath(path, phase) {
|
|
8
|
+
assertRepositoryRelativePath(path, phase);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=configuration-input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration-input.js","sourceRoot":"","sources":["../../../../src/capabilities/findings-baseline/application/configuration-input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,+CAA+C,CAAC;AACrF,OAAO,EAAE,4BAA4B,EAAE,MAAM,kCAAkC,CAAC;AAEhF,6GAA6G;AAC7G,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,OAAe,EAAE,KAAa;IACvE,MAAM,IAAI,oBAAoB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;AAC7E,CAAC;AAED,MAAM,UAAU,kCAAkC,CAAC,IAAY,EAAE,KAAa;IAC5E,4BAA4B,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Finding } from "./baseline.js";
|
|
2
|
+
/** Rule namespace owned by the Oxlint producer; the baseline entries of other namespaces are never read here. */
|
|
3
|
+
export declare const OXLINT_NAMESPACE: "oxlint";
|
|
4
|
+
export interface FindingsBaselinePolicy {
|
|
5
|
+
readonly baselinePath: string;
|
|
6
|
+
readonly oxlint: {
|
|
7
|
+
readonly configPath: string;
|
|
8
|
+
readonly roots: readonly string[];
|
|
9
|
+
/** Rules whose message carries a measured value, as `<plugin>/<rule>`. */
|
|
10
|
+
readonly measuredRules: readonly string[];
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
/** Observes the current findings of one rule namespace. */
|
|
14
|
+
export interface FindingsProducer {
|
|
15
|
+
observe(input: {
|
|
16
|
+
readonly consumerRoot: string;
|
|
17
|
+
readonly policy: FindingsBaselinePolicy;
|
|
18
|
+
readonly signal?: AbortSignal;
|
|
19
|
+
}): Promise<readonly Finding[]>;
|
|
20
|
+
}
|
|
21
|
+
export interface FindingsBaselineStore {
|
|
22
|
+
/** The baseline text, or `undefined` when the file does not exist. */
|
|
23
|
+
read(consumerRoot: string, path: string, signal?: AbortSignal): Promise<string | undefined>;
|
|
24
|
+
/** Creates the file and fails when it exists. */
|
|
25
|
+
create(consumerRoot: string, path: string, text: string): Promise<void>;
|
|
26
|
+
/** Replaces the file only while it still holds `expected`. */
|
|
27
|
+
replace(consumerRoot: string, path: string, text: string, expected: string): Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
export interface FindingsBaselineDependencies {
|
|
30
|
+
readonly producer: FindingsProducer;
|
|
31
|
+
readonly store: FindingsBaselineStore;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/findings-baseline/application/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C,iHAAiH;AACjH,eAAO,MAAM,gBAAgB,EAAG,QAAiB,CAAC;AAElD,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE;QACf,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;QAC5B,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;QAClC,0EAA0E;QAC1E,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;KAC3C,CAAC;CACH;AAED,2DAA2D;AAC3D,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,sBAAsB,CAAC;QAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,GAAG,OAAO,CAAC,SAAS,OAAO,EAAE,CAAC,CAAC;CACxJ;AAED,MAAM,WAAW,qBAAqB;IACpC,sEAAsE;IACtE,IAAI,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC5F,iDAAiD;IACjD,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxE,8DAA8D;IAC9D,OAAO,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5F;AAED,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,KAAK,EAAE,qBAAqB,CAAC;CACvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../../src/capabilities/findings-baseline/application/model.ts"],"names":[],"mappings":"AAEA,iHAAiH;AACjH,MAAM,CAAC,MAAM,gBAAgB,GAAG,QAAiB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { DiagnosticSeverity } from "../../../features/validation-reporting/api.js";
|
|
2
|
+
export interface FindingsBaselineRuleMetadata {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly severity: DiagnosticSeverity;
|
|
5
|
+
readonly rationale: string;
|
|
6
|
+
readonly remediation: string;
|
|
7
|
+
readonly documentation: string;
|
|
8
|
+
readonly requiresArchitectureReview: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const FINDINGS_BASELINE_RULES: Readonly<{
|
|
11
|
+
newFinding: FindingsBaselineRuleMetadata;
|
|
12
|
+
worseFinding: FindingsBaselineRuleMetadata;
|
|
13
|
+
staleEntry: FindingsBaselineRuleMetadata;
|
|
14
|
+
}>;
|
|
15
|
+
export declare const FINDINGS_BASELINE_RULES_BY_ID: ReadonlyMap<string, FindingsBaselineRuleMetadata>;
|
|
16
|
+
//# sourceMappingURL=rules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/findings-baseline/application/rules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AAGxF,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;IACtC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,0BAA0B,EAAE,OAAO,CAAC;CAC9C;AAaD,eAAO,MAAM,uBAAuB;;;;EAgBlC,CAAC;AAEH,eAAO,MAAM,6BAA6B,EAAE,WAAW,CAAC,MAAM,EAAE,4BAA4B,CAG3F,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createUniqueRegistry } from "../../../features/validation-reporting/api.js";
|
|
2
|
+
function rule(suffix, rationale, remediation) {
|
|
3
|
+
return Object.freeze({
|
|
4
|
+
id: `quality.findings-baseline.${suffix}`,
|
|
5
|
+
severity: "error",
|
|
6
|
+
rationale,
|
|
7
|
+
remediation,
|
|
8
|
+
documentation: "docs/architecture/findings-baseline.md",
|
|
9
|
+
requiresArchitectureReview: false
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
export const FINDINGS_BASELINE_RULES = Object.freeze({
|
|
13
|
+
newFinding: rule("new-finding", "A finding that is not in the baseline is new debt; the baseline only shrinks.", "Fix the finding. The baseline never accepts a new entry after its first creation."),
|
|
14
|
+
worseFinding: rule("worse-finding", "A finding above its baseline entry (more occurrences or a larger measured value) grows existing debt.", "Bring the file back to its baseline count and value or below; do not raise the entry."),
|
|
15
|
+
staleEntry: rule("stale-entry", "A baseline entry above the observed finding, or for a finding that vanished, hides room for new debt.", "Run `agent-teams-foundation baseline prune` to lower or remove the entry.")
|
|
16
|
+
});
|
|
17
|
+
export const FINDINGS_BASELINE_RULES_BY_ID = createUniqueRegistry("rule", Object.values(FINDINGS_BASELINE_RULES).map((metadata) => [metadata.id, metadata]));
|
|
18
|
+
//# sourceMappingURL=rules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rules.js","sourceRoot":"","sources":["../../../../src/capabilities/findings-baseline/application/rules.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,+CAA+C,CAAC;AAWrF,SAAS,IAAI,CAAC,MAAc,EAAE,SAAiB,EAAE,WAAmB;IAClE,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,EAAE,EAAE,6BAA6B,MAAM,EAAE;QACzC,QAAQ,EAAE,OAAO;QACjB,SAAS;QACT,WAAW;QACX,aAAa,EAAE,wCAAwC;QACvD,0BAA0B,EAAE,KAAK;KAClC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,MAAM,CAAC;IACnD,UAAU,EAAE,IAAI,CACd,aAAa,EACb,+EAA+E,EAC/E,mFAAmF,CACpF;IACD,YAAY,EAAE,IAAI,CAChB,eAAe,EACf,uGAAuG,EACvG,uFAAuF,CACxF;IACD,UAAU,EAAE,IAAI,CACd,aAAa,EACb,uGAAuG,EACvG,2EAA2E,CAC5E;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,6BAA6B,GAAsD,oBAAoB,CAClH,MAAM,EACN,MAAM,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC,CAClF,CAAC"}
|