@hailstails/hone 1.5.0 → 2.0.0-pre.2
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/ADOPTING.md +104 -199
- package/CHANGELOG.md +138 -0
- package/MIGRATING.md +92 -47
- package/README.md +95 -244
- package/chunks/chunk-5HRMJ4O2.js +608 -0
- package/chunks/chunk-5U4JMWNV.js +9 -0
- package/chunks/{chunk-2O46EB4E.js → chunk-ASUN4AVC.js} +25 -12
- package/chunks/chunk-DGOLOS5A.js +9 -0
- package/chunks/{chunk-HJA4CX7C.js → chunk-FBZBSDED.js} +1 -1
- package/chunks/{chunk-Y2KPZDDV.js → chunk-GNOMK7CR.js} +201 -98
- package/chunks/chunk-IX2VZTBO.js +887 -0
- package/chunks/{chunk-QWA6OVLC.js → chunk-K2W3D3NB.js} +8 -2
- package/chunks/chunk-L7BGRC6D.js +22 -0
- package/chunks/chunk-M6SOGWT7.js +82 -0
- package/chunks/chunk-MWLBA4B3.js +849 -0
- package/chunks/chunk-NRIQD3PI.js +38 -0
- package/chunks/chunk-OKLYWD2Z.js +823 -0
- package/chunks/{chunk-3HFJHJDO.js → chunk-QP5TLOBY.js} +17 -8
- package/chunks/chunk-R75QELTA.js +481 -0
- package/chunks/chunk-RANAKCTW.js +31 -0
- package/chunks/{chunk-NA5L6PUE.js → chunk-RANIXNWY.js} +1 -2
- package/chunks/chunk-RFR3ITBS.js +9 -0
- package/chunks/{chunk-Z4UBS7WI.js → chunk-RGSHTPLA.js} +26 -7
- package/chunks/{chunk-T32FOWZA.js → chunk-TNY2PASL.js} +14 -18
- package/chunks/{chunk-Y4SMWOD2.js → chunk-UJONWHA4.js} +2 -2
- package/chunks/{chunk-WF3PPYRR.js → chunk-VYBO2Q65.js} +4 -2
- package/chunks/chunk-Z6JHBNDS.js +15 -0
- package/chunks/eslint-10-boundary-A4JIQ734.js +14 -0
- package/chunks/eslint-9-boundary-CL5DDBHX.js +34 -0
- package/docs/adding-a-discipline-or-mechanism.md +21 -19
- package/docs/extending.md +5 -5
- package/docs/output-contract.md +700 -14
- package/docs/why-chain-contract.md +6 -6
- package/methods/README.md +2 -2
- package/methods/assessment-template.md +1 -1
- package/methods/lenses/clean-architecture.md +19 -54
- package/methods/lenses/decomposition.md +7 -7
- package/methods/lenses/defended-on-intent.md +4 -4
- package/methods/lenses/di-discipline.md +8 -8
- package/methods/lenses/errors-as-data.md +6 -6
- package/methods/lenses/function-first.md +9 -9
- package/methods/lenses/naming.md +6 -6
- package/methods/lenses/test-discipline.md +8 -8
- package/methods/lenses/type-soundness.md +6 -6
- package/methods/lenses/zod-boundary.md +9 -9
- package/package.json +30 -28
- package/rules/README.md +268 -4
- package/rules/SPIRIT.md +1 -1
- package/rules/cases/a-value-is-one-of-several-kinds-or-states.md +20 -0
- package/rules/cases/an-adopter-is-not-handed-our-risk.md +17 -0
- package/rules/cases/an-operation-can-fail.md +20 -0
- package/rules/cases/builds-the-real-implementations.md +25 -0
- package/rules/cases/causes-an-effect.md +26 -0
- package/rules/cases/checks-a-value-that-may-be-one-of-several-outcomes.md +20 -0
- package/rules/cases/checks-conditions-before-its-work.md +20 -0
- package/rules/cases/coordinates-other-units.md +20 -0
- package/rules/cases/does-one-job.md +23 -0
- package/rules/cases/explains-something-in-prose.md +20 -0
- package/rules/cases/gives-a-value-its-type.md +26 -0
- package/rules/cases/gives-each-unit-its-test.md +20 -0
- package/rules/cases/keeps-state-or-settings-across-calls.md +20 -0
- package/rules/cases/makes-a-new-value-from-what-it-has.md +17 -0
- package/rules/cases/names-something.md +20 -0
- package/rules/cases/needs-the-current-time-a-random-value-a-new-id-or-an-outside-ordering.md +26 -0
- package/rules/cases/puts-code-in-a-file-or-folder.md +20 -0
- package/rules/cases/reads-data-from-outside.md +23 -0
- package/rules/cases/reuses-behaviour-from-another-unit-or-type.md +20 -0
- package/rules/cases/sends-data-out-of-the-program.md +20 -0
- package/rules/cases/sets-how-strictly-the-checker-works.md +14 -0
- package/rules/cases/ships-code-for-others.md +17 -0
- package/rules/cases/states-what-the-unit-gives-back-for-one-case-or-several.md +20 -0
- package/rules/cases/takes-an-outside-dependency.md +38 -0
- package/rules/cases/tests-across-units-or-against-a-real-system.md +20 -0
- package/rules/cases/uses-a-system-or-service-outside-the-program.md +29 -0
- package/rules/cases/uses-what-a-collaborator-gives-back.md +20 -0
- package/rules/cases/writes-basic-logic.md +17 -0
- package/rules/cases.md +36 -59
- package/rules/numbers.md +121 -121
- package/rules/principles/external-behaviour-sits-at-a-boundary.md +12 -0
- package/rules/principles/no-hidden-effects.md +17 -0
- package/rules/principles/no-leak-across-a-boundary.md +19 -0
- package/rules/principles/one-place-decides.md +12 -0
- package/rules/principles/our-code-reads-in-the-common-language.md +12 -0
- package/rules/principles/outside-risk-is-carried-on-purpose.md +13 -0
- package/rules/principles/tests-are-ours.md +12 -0
- package/rules/principles/the-type-checker-proves-it.md +12 -0
- package/rules/principles.md +50 -46
- package/rules/record-kinds/authorised-location.md +26 -0
- package/rules/record-kinds/boundary-record.md +9 -0
- package/rules/record-kinds/debt.md +23 -0
- package/rules/record-kinds/dependency-record.md +9 -0
- package/rules/record-kinds/deviation.md +9 -0
- package/rules/records.md +17 -30
- package/rules/rules/declared-not-asserted.md +16 -0
- package/rules/rules/doer-or-orchestrator.md +16 -0
- package/rules/rules/failures-are-values.md +15 -0
- package/rules/rules/fixed-versions.md +11 -0
- package/rules/rules/guard-first.md +14 -0
- package/rules/rules/handed-what-it-uses.md +16 -0
- package/rules/rules/kinds-are-named.md +16 -0
- package/rules/rules/one-reason-per-module.md +18 -0
- package/rules/rules/one-word-everywhere.md +19 -0
- package/rules/rules/outside-dependencies-justified.md +14 -0
- package/rules/rules/outside-dependencies-stay-at-boundaries.md +18 -0
- package/rules/rules/ports-declared-inside.md +22 -0
- package/rules/rules/shipped-risk-declared.md +11 -0
- package/rules/rules/straight-through-tests.md +15 -0
- package/rules/rules/tested-where-its-owned.md +20 -0
- package/rules/rules/tools-live-in-the-repo.md +11 -0
- package/rules/rules/upstream-stays-untouched.md +11 -0
- package/rules/rules/written-out-answers.md +17 -0
- package/rules/rules.md +117 -81
- package/rules/typescript/checks.md +1668 -202
- package/rules/typescript/recipes/adapter-per-outside-party.md +18 -0
- package/rules/typescript/recipes/assert-to-narrow.md +18 -0
- package/rules/typescript/recipes/bounded-context-generic.md +19 -0
- package/rules/typescript/recipes/closure-factory.md +20 -0
- package/rules/typescript/recipes/companion-test-file.md +18 -0
- package/rules/typescript/recipes/composed-orchestrator.md +18 -0
- package/rules/typescript/recipes/composition-root.md +18 -0
- package/rules/typescript/recipes/copy-never-write-in.md +18 -0
- package/rules/typescript/recipes/declared-not-bundled.md +17 -0
- package/rules/typescript/recipes/dependency-record.md +20 -0
- package/rules/typescript/recipes/domain-vocabulary-list.md +18 -0
- package/rules/typescript/recipes/entity-module.md +20 -0
- package/rules/typescript/recipes/exact-pins-and-a-lock-file.md +18 -0
- package/rules/typescript/recipes/extension-outside-the-vendored-code.md +18 -0
- package/rules/typescript/recipes/failure-asserted-as-a-value.md +18 -0
- package/rules/typescript/recipes/failure-mapping-at-the-adapter.md +20 -0
- package/rules/typescript/recipes/fix-the-declaration-not-the-value.md +18 -0
- package/rules/typescript/recipes/functional-iteration.md +18 -0
- package/rules/typescript/recipes/guard-clauses.md +18 -0
- package/rules/typescript/recipes/integration-test-owns-its-scratch.md +18 -0
- package/rules/typescript/recipes/integration-test-suffix.md +18 -0
- package/rules/typescript/recipes/iteach-over-typed-rows.md +18 -0
- package/rules/typescript/recipes/map-out-at-the-adapter.md +18 -0
- package/rules/typescript/recipes/meaning-in-names-not-comments.md +22 -0
- package/rules/typescript/recipes/named-exported-type.md +18 -0
- package/rules/typescript/recipes/narrow-ports.md +18 -0
- package/rules/typescript/recipes/one-argument-object.md +19 -0
- package/rules/typescript/recipes/port-in-the-domain.md +19 -0
- package/rules/typescript/recipes/ports-in-the-argument.md +18 -0
- package/rules/typescript/recipes/repo-scripts-only.md +18 -0
- package/rules/typescript/recipes/result-union.md +22 -0
- package/rules/typescript/recipes/screaming-folders.md +20 -0
- package/rules/typescript/recipes/shared-strict-base-config.md +20 -0
- package/rules/typescript/recipes/stub-with-vifn.md +20 -0
- package/rules/typescript/recipes/tagged-union-and-exhaustive-switch.md +18 -0
- package/rules/typescript/recipes/whole-words.md +18 -0
- package/rules/typescript/recipes/whole-written-out-expectation.md +18 -0
- package/rules/typescript/recipes/world-values-through-a-port.md +18 -0
- package/rules/typescript/recipes/zod-at-the-producers-adapter.md +19 -0
- package/rules/typescript/recipes.md +247 -218
- package/rules/typescript/symptoms/absence-standing-for-a-state.md +36 -0
- package/rules/typescript/symptoms/adapter-built-outside-the-root.md +30 -0
- package/rules/typescript/symptoms/ambient-randomness.md +36 -0
- package/rules/typescript/symptoms/answer-set-in-a-hook.md +45 -0
- package/rules/typescript/symptoms/authored-class-or-this/class-keyword.md +30 -0
- package/rules/typescript/symptoms/authored-class-or-this/static-members-only.md +18 -0
- package/rules/typescript/symptoms/authored-class-or-this.md +49 -0
- package/rules/typescript/symptoms/behaviour-tested-away-from-its-owner.md +44 -0
- package/rules/typescript/symptoms/boolean-in-a-signature/boolean-annotation.md +30 -0
- package/rules/typescript/symptoms/boolean-in-a-signature.md +43 -0
- package/rules/typescript/symptoms/branch-in-a-test/test-body.md +213 -0
- package/rules/typescript/symptoms/branch-in-a-test.md +48 -0
- package/rules/typescript/symptoms/bundled-dependency.md +28 -0
- package/rules/typescript/symptoms/catch-all-failure-kind.md +37 -0
- package/rules/typescript/symptoms/change-spread-across-modules.md +27 -0
- package/rules/typescript/symptoms/claimed-type/cast-to-any.md +29 -0
- package/rules/typescript/symptoms/claimed-type/non-null-assertions.md +34 -0
- package/rules/typescript/symptoms/claimed-type/unlisted-cast-site.md +34 -0
- package/rules/typescript/symptoms/claimed-type.md +56 -0
- package/rules/typescript/symptoms/computed-value-in-a-test/test-body.md +144 -0
- package/rules/typescript/symptoms/computed-value-in-a-test.md +36 -0
- package/rules/typescript/symptoms/coverage-gate.md +27 -0
- package/rules/typescript/symptoms/date-used-directly/clock-sources.md +31 -0
- package/rules/typescript/symptoms/date-used-directly.md +46 -0
- package/rules/typescript/symptoms/default-for-a-required-value.md +45 -0
- package/rules/typescript/symptoms/default-on-a-closed-union/default-arm.md +32 -0
- package/rules/typescript/symptoms/default-on-a-closed-union.md +32 -0
- package/rules/typescript/symptoms/dependency-without-a-record.md +33 -0
- package/rules/typescript/symptoms/doer-calling-our-own-unit.md +36 -0
- package/rules/typescript/symptoms/double-with-a-body/logic-in-a-passed-function.md +32 -0
- package/rules/typescript/symptoms/double-with-a-body/stub-implementation.md +31 -0
- package/rules/typescript/symptoms/double-with-a-body.md +55 -0
- package/rules/typescript/symptoms/drawer-path/drawer-names.md +28 -0
- package/rules/typescript/symptoms/drawer-path.md +32 -0
- package/rules/typescript/symptoms/duplicate-decision.md +36 -0
- package/rules/typescript/symptoms/edit-inside-vendored-code.md +33 -0
- package/rules/typescript/symptoms/failure-shaped-as-success.md +28 -0
- package/rules/typescript/symptoms/floating-version.md +27 -0
- package/rules/typescript/symptoms/inherited-environment-in-a-subprocess/git-spawn-environment.md +30 -0
- package/rules/typescript/symptoms/inherited-environment-in-a-subprocess.md +33 -0
- package/rules/typescript/symptoms/inner-layer-imports-outer.md +33 -0
- package/rules/typescript/symptoms/integration-heavy-suite.md +29 -0
- package/rules/typescript/symptoms/large-input-for-a-few-fields.md +37 -0
- package/rules/typescript/symptoms/library-class-built-in-place.md +42 -0
- package/rules/typescript/symptoms/long-function/function-length.md +47 -0
- package/rules/typescript/symptoms/long-function.md +75 -0
- package/rules/typescript/symptoms/loop-keyword/loop-statement.md +34 -0
- package/rules/typescript/symptoms/loop-keyword.md +49 -0
- package/rules/typescript/symptoms/machine-touched-in-a-unit-test.md +40 -0
- package/rules/typescript/symptoms/many-spellings-of-one-concept.md +29 -0
- package/rules/typescript/symptoms/module-level-state.md +30 -0
- package/rules/typescript/symptoms/module-or-global-patched/module-mock-call.md +29 -0
- package/rules/typescript/symptoms/module-or-global-patched.md +38 -0
- package/rules/typescript/symptoms/name-off-its-casing/filename-case.md +16 -0
- package/rules/typescript/symptoms/name-off-its-casing/naming-convention.md +20 -0
- package/rules/typescript/symptoms/name-off-its-casing.md +31 -0
- package/rules/typescript/symptoms/no-lock-file.md +27 -0
- package/rules/typescript/symptoms/orchestrator-that-computes.md +27 -0
- package/rules/typescript/symptoms/outside-dependency-vocabulary-for-basic-logic.md +33 -0
- package/rules/typescript/symptoms/outside-import-past-a-boundary/import-or-require.md +44 -0
- package/rules/typescript/symptoms/outside-import-past-a-boundary.md +45 -0
- package/rules/typescript/symptoms/outside-type-in-a-signature.md +37 -0
- package/rules/typescript/symptoms/own-type-guard.md +36 -0
- package/rules/typescript/symptoms/port-named-for-a-mechanism.md +34 -0
- package/rules/typescript/symptoms/port-outside-the-domain.md +28 -0
- package/rules/typescript/symptoms/positional-parameters/parameter-count.md +30 -0
- package/rules/typescript/symptoms/positional-parameters.md +43 -0
- package/rules/typescript/symptoms/process-global-used-in-place.md +53 -0
- package/rules/typescript/symptoms/prose-in-code.md +27 -0
- package/rules/typescript/symptoms/rebinding/parameter-reassignment.md +18 -0
- package/rules/typescript/symptoms/rebinding/test-body.md +32 -0
- package/rules/typescript/symptoms/rebinding.md +36 -0
- package/rules/typescript/symptoms/schema-past-its-adapter.md +41 -0
- package/rules/typescript/symptoms/shorthand-name/identifier-names.md +29 -0
- package/rules/typescript/symptoms/shorthand-name.md +32 -0
- package/rules/typescript/symptoms/strictness-weakened/exact-optional-property-types.md +51 -0
- package/rules/typescript/symptoms/strictness-weakened/no-fallthrough-cases-in-switch.md +51 -0
- package/rules/typescript/symptoms/strictness-weakened/no-implicit-override.md +51 -0
- package/rules/typescript/symptoms/strictness-weakened/no-property-access-from-index-signature.md +51 -0
- package/rules/{CD-3/CHECKS.md → typescript/symptoms/strictness-weakened/no-unchecked-indexed-access.md} +23 -40
- package/rules/typescript/symptoms/strictness-weakened/strict.md +51 -0
- package/rules/typescript/symptoms/strictness-weakened/use-unknown-in-catch-variables.md +51 -0
- package/rules/typescript/symptoms/strictness-weakened.md +32 -0
- package/rules/typescript/symptoms/tangled-function/cognitive-complexity.md +42 -0
- package/rules/typescript/symptoms/tangled-function.md +75 -0
- package/rules/typescript/symptoms/test-of-the-type-checker.md +24 -0
- package/rules/typescript/symptoms/test-switched-off/focused-tests.md +15 -0
- package/rules/typescript/symptoms/test-switched-off/skipped-tests.md +15 -0
- package/rules/typescript/symptoms/test-switched-off.md +25 -0
- package/rules/typescript/symptoms/text-past-its-reader/test-body.md +30 -0
- package/rules/typescript/symptoms/text-past-its-reader.md +71 -0
- package/rules/typescript/symptoms/throw-between-our-units.md +46 -0
- package/rules/typescript/symptoms/throw-or-catch-in-a-test/throw-statement.md +32 -0
- package/rules/typescript/symptoms/throw-or-catch-in-a-test/try-block.md +39 -0
- package/rules/typescript/symptoms/throw-or-catch-in-a-test.md +35 -0
- package/rules/typescript/symptoms/thrown-non-error/throw-only-error.md +15 -0
- package/rules/typescript/symptoms/thrown-non-error.md +27 -0
- package/rules/typescript/symptoms/tool-fetched-at-run-time.md +27 -0
- package/rules/typescript/symptoms/tuple-as-data.md +29 -0
- package/rules/typescript/symptoms/type-derived-from-code/factory-return-types.md +29 -0
- package/rules/typescript/symptoms/type-derived-from-code.md +41 -0
- package/rules/typescript/symptoms/types-only-file.md +36 -0
- package/rules/typescript/symptoms/unasserted-call.md +29 -0
- package/rules/typescript/symptoms/unit-without-a-running-test/companion-test-file.md +28 -0
- package/rules/typescript/symptoms/unit-without-a-running-test.md +28 -0
- package/rules/{CD-5/CHECKS.md → typescript/symptoms/untracked-escape/directive-pointers.md} +12 -25
- package/rules/typescript/symptoms/untracked-escape.md +32 -0
- package/rules/typescript/symptoms/untyped-value/explicit-any.md +14 -0
- package/rules/typescript/symptoms/untyped-value/implicit-any-let.md +14 -0
- package/rules/typescript/symptoms/untyped-value.md +36 -0
- package/rules/typescript/symptoms/wide-input.md +37 -0
- package/rules/typescript/symptoms/wide-port.md +32 -0
- package/rules/typescript/symptoms/work-inside-a-condition/else-after-an-exit.md +40 -0
- package/rules/typescript/symptoms/work-inside-a-condition.md +41 -0
- package/rules/typescript/symptoms/write-into-a-parameter/parameter-mutation.md +33 -0
- package/rules/typescript/symptoms/write-into-a-parameter.md +34 -0
- package/rules/typescript/symptoms.md +623 -414
- package/{core → src/application}/conformance/conformance-testing-types.d.ts +16 -6
- package/src/audit.d.ts +20 -0
- package/{api → src}/audit.js +6 -5
- package/{core/rule-set-reader → src/domain/rule-set}/authored-rule-set-types.d.ts +2 -2
- package/{core/values → src/domain/rule-set}/edition-types.d.ts +3 -3
- package/{core/values → src/domain/rule-set}/identifier-types.d.ts +2 -2
- package/{core/conformance → src/domain/runner}/conformance-types.d.ts +1 -1
- package/{core/mechanism-port → src/domain/runner}/piece-failure-types.d.ts +1 -1
- package/{core/mechanism-port → src/domain/runner}/runner-module-types.d.ts +4 -4
- package/src/domain/runner/runner-result-types.d.ts +88 -0
- package/src/eslint-plugin.d.ts +16 -0
- package/src/eslint-plugin.js +72 -0
- package/src/hone.js +13563 -0
- package/src/infrastructure/disciplines-file/version-one-names.json +634 -0
- package/src/infrastructure/engines/eslint/authored-class-or-this/class-keyword/class-keyword.examples.json +84 -0
- package/{mechanisms/eslint/CD-14/cd14/cd14.eslint-plugin.js → src/infrastructure/engines/eslint/authored-class-or-this/class-keyword/eslint-plugin.js} +9 -10
- package/src/infrastructure/engines/eslint/authored-class-or-this/class-keyword/piece.json +12 -0
- package/src/infrastructure/engines/eslint/authored-class-or-this/static-members-only/piece.json +24 -0
- package/src/infrastructure/engines/eslint/authored-class-or-this/static-members-only/static-members-only.examples.json +36 -0
- package/src/infrastructure/engines/eslint/claimed-type/non-null-assertions/eslint-plugin.js +16 -0
- package/src/infrastructure/engines/eslint/claimed-type/non-null-assertions/non-null-assertions.examples.json +48 -0
- package/src/infrastructure/engines/eslint/claimed-type/non-null-assertions/piece.json +22 -0
- package/src/infrastructure/engines/eslint/long-function/function-length/function-length.examples.json +42 -0
- package/src/infrastructure/engines/eslint/long-function/function-length/piece.json +16 -0
- package/{mechanisms/eslint/CD-7/cd7/cd7.eslint-plugin.js → src/infrastructure/engines/eslint/name-off-its-casing/filename-case/eslint-plugin.js} +5 -4
- package/src/infrastructure/engines/eslint/name-off-its-casing/filename-case/filename-case.examples.json +60 -0
- package/src/infrastructure/engines/eslint/name-off-its-casing/filename-case/piece.json +11 -0
- package/src/infrastructure/engines/eslint/name-off-its-casing/naming-convention/eslint-plugin.js +16 -0
- package/src/infrastructure/engines/eslint/name-off-its-casing/naming-convention/naming-convention.examples.json +78 -0
- package/src/infrastructure/engines/eslint/name-off-its-casing/naming-convention/piece.json +214 -0
- package/src/infrastructure/engines/eslint/positional-parameters/parameter-count/eslint-plugin.js +16 -0
- package/src/infrastructure/engines/eslint/positional-parameters/parameter-count/parameter-count.examples.json +30 -0
- package/src/infrastructure/engines/eslint/positional-parameters/parameter-count/piece.json +18 -0
- package/src/infrastructure/engines/eslint/rebinding/parameter-reassignment/eslint-plugin.js +16 -0
- package/src/infrastructure/engines/eslint/rebinding/parameter-reassignment/parameter-reassignment.examples.json +30 -0
- package/src/infrastructure/engines/eslint/rebinding/parameter-reassignment/piece.json +17 -0
- package/{mechanisms → src/infrastructure/engines}/eslint/runner/README.md +5 -5
- package/{mechanisms/eslint/runner → src/infrastructure/engines/eslint/runner/pieces}/eslint-piece-settings-types.d.ts +1 -1
- package/{mechanisms → src/infrastructure/engines}/eslint/runner/runner.js +2186 -1372
- package/{mechanisms/eslint/CD-41 → src/infrastructure/engines/eslint/tangled-function/cognitive-complexity}/README.md +1 -1
- package/src/infrastructure/engines/eslint/tangled-function/cognitive-complexity/cognitive-complexity.examples.json +48 -0
- package/{mechanisms/eslint/CD-41/cd41/cd41.eslint-plugin.js → src/infrastructure/engines/eslint/tangled-function/cognitive-complexity/eslint-plugin.js} +58 -14
- package/src/infrastructure/engines/eslint/tangled-function/cognitive-complexity/piece.json +12 -0
- package/{mechanisms/eslint/CD-27/cd27/cd27.eslint-plugin.js → src/infrastructure/engines/eslint/test-switched-off/focused-tests/eslint-plugin.js} +5 -4
- package/src/infrastructure/engines/eslint/test-switched-off/focused-tests/focused-tests.examples.json +60 -0
- package/src/infrastructure/engines/eslint/test-switched-off/focused-tests/piece.json +12 -0
- package/src/infrastructure/engines/eslint/test-switched-off/skipped-tests/piece.json +16 -0
- package/src/infrastructure/engines/eslint/test-switched-off/skipped-tests/skipped-tests.examples.json +54 -0
- package/{mechanisms/eslint/CD-10/cd10/cd10.eslint-plugin.js → src/infrastructure/engines/eslint/thrown-non-error/throw-only-error/eslint-plugin.js} +5 -4
- package/src/infrastructure/engines/eslint/thrown-non-error/throw-only-error/piece.json +12 -0
- package/src/infrastructure/engines/eslint/thrown-non-error/throw-only-error/throw-only-error.examples.json +54 -0
- package/{mechanisms/eslint/CD-1/cd1/cd1.eslint-plugin.js → src/infrastructure/engines/eslint/untyped-value/explicit-any/eslint-plugin.js} +14 -9
- package/src/infrastructure/engines/eslint/untyped-value/explicit-any/explicit-any.examples.json +36 -0
- package/src/infrastructure/engines/eslint/untyped-value/explicit-any/piece.json +12 -0
- package/src/infrastructure/engines/eslint/untyped-value/implicit-any-let/implicit-any-let.examples.json +48 -0
- package/src/infrastructure/engines/eslint/untyped-value/implicit-any-let/piece.json +16 -0
- package/src/infrastructure/engines/eslint/work-inside-a-condition/else-after-an-exit/else-after-an-exit.examples.json +36 -0
- package/{mechanisms/eslint/CD-42/cd42/cd42.eslint-plugin.js → src/infrastructure/engines/eslint/work-inside-a-condition/else-after-an-exit/eslint-plugin.js} +29 -13
- package/src/infrastructure/engines/eslint/work-inside-a-condition/else-after-an-exit/piece.json +12 -0
- package/src/infrastructure/engines/walker/authored-class-or-this/class-keyword/class-keyword.examples.json +84 -0
- package/{mechanisms/audit/CD-14 → src/infrastructure/engines/walker/authored-class-or-this/class-keyword}/class-syntax.js +6 -3
- package/src/infrastructure/engines/walker/authored-class-or-this/class-keyword/piece.json +10 -0
- package/src/infrastructure/engines/walker/boolean-in-a-signature/boolean-annotation/boolean-annotation.examples.json +42 -0
- package/{mechanisms/audit/CD-43 → src/infrastructure/engines/walker/boolean-in-a-signature/boolean-annotation}/boolean-signatures.js +14 -6
- package/src/infrastructure/engines/walker/boolean-in-a-signature/boolean-annotation/piece.json +9 -0
- package/src/infrastructure/engines/walker/branch-in-a-test/test-body/piece.json +95 -0
- package/{mechanisms/audit/CD-27 → src/infrastructure/engines/walker/branch-in-a-test/test-body}/test-body-logic.js +183 -54
- package/src/infrastructure/engines/walker/branch-in-a-test/test-body/test-body.examples.json +280 -0
- package/{mechanisms/audit/CD-1 → src/infrastructure/engines/walker/claimed-type/cast-to-any}/any-cast.js +7 -4
- package/src/infrastructure/engines/walker/claimed-type/cast-to-any/cast-to-any.examples.json +48 -0
- package/src/infrastructure/engines/walker/claimed-type/cast-to-any/piece.json +9 -0
- package/{mechanisms/audit/CD-2 → src/infrastructure/engines/walker/claimed-type/unlisted-cast-site}/cast-expressions.js +13 -6
- package/src/infrastructure/engines/walker/claimed-type/unlisted-cast-site/piece.json +14 -0
- package/src/infrastructure/engines/walker/claimed-type/unlisted-cast-site/unlisted-cast-site.examples.json +54 -0
- package/src/infrastructure/engines/walker/computed-value-in-a-test/test-body/piece.json +18 -0
- package/src/infrastructure/engines/walker/date-used-directly/clock-sources/clock-sources.examples.json +30 -0
- package/src/infrastructure/engines/walker/date-used-directly/clock-sources/clock-sources.js +36 -0
- package/src/infrastructure/engines/walker/date-used-directly/clock-sources/piece.json +9 -0
- package/src/infrastructure/engines/walker/default-on-a-closed-union/default-arm/default-arm.examples.json +36 -0
- package/src/infrastructure/engines/walker/default-on-a-closed-union/default-arm/piece.json +9 -0
- package/src/infrastructure/engines/walker/default-on-a-closed-union/default-arm/switch-defaults.js +54 -0
- package/src/infrastructure/engines/walker/double-with-a-body/logic-in-a-passed-function/piece.json +18 -0
- package/{mechanisms/audit/CD-25 → src/infrastructure/engines/walker/double-with-a-body/stub-implementation}/dependency-isolation.js +8 -4
- package/src/infrastructure/engines/walker/double-with-a-body/stub-implementation/piece.json +9 -0
- package/src/infrastructure/engines/walker/double-with-a-body/stub-implementation/stub-implementation.examples.json +36 -0
- package/{mechanisms/audit/CD-7 → src/infrastructure/engines/walker/drawer-path/drawer-names}/categorical-paths.js +23 -8
- package/src/infrastructure/engines/walker/drawer-path/drawer-names/drawer-names.examples.json +42 -0
- package/src/infrastructure/engines/walker/drawer-path/drawer-names/piece.json +9 -0
- package/src/infrastructure/engines/walker/inherited-environment-in-a-subprocess/git-spawn-environment/git-spawn-environment.examples.json +36 -0
- package/{mechanisms/audit/CD-47 → src/infrastructure/engines/walker/inherited-environment-in-a-subprocess/git-spawn-environment}/hermetic-git-spawns.js +13 -4
- package/src/infrastructure/engines/walker/inherited-environment-in-a-subprocess/git-spawn-environment/piece.json +9 -0
- package/src/infrastructure/engines/walker/loop-keyword/loop-statement/loop-statement.examples.json +48 -0
- package/{mechanisms/audit/CD-15 → src/infrastructure/engines/walker/loop-keyword/loop-statement}/loops.js +12 -4
- package/src/infrastructure/engines/walker/loop-keyword/loop-statement/piece.json +9 -0
- package/src/infrastructure/engines/walker/module-or-global-patched/module-mock-call/module-mock-call.examples.json +36 -0
- package/{mechanisms/audit/CD-26 → src/infrastructure/engines/walker/module-or-global-patched/module-mock-call}/module-mocking.js +8 -4
- package/src/infrastructure/engines/walker/module-or-global-patched/module-mock-call/piece.json +9 -0
- package/src/infrastructure/engines/walker/outside-import-past-a-boundary/import-or-require/import-boundaries.js +133 -0
- package/src/infrastructure/engines/walker/outside-import-past-a-boundary/import-or-require/import-or-require.examples.json +42 -0
- package/src/infrastructure/engines/walker/outside-import-past-a-boundary/import-or-require/piece.json +14 -0
- package/src/infrastructure/engines/walker/rebinding/test-body/piece.json +18 -0
- package/{mechanisms/audit/runner → src/infrastructure/engines/walker/runner/pieces}/walker-piece.d.ts +8 -14
- package/{mechanisms/audit → src/infrastructure/engines/walker}/runner/runner.js +191 -120
- package/{mechanisms/audit/runner → src/infrastructure/engines/walker/runner/toolchain}/typescript-parse.d.ts +1 -0
- package/src/infrastructure/engines/walker/shorthand-name/identifier-names/identifier-names.examples.json +42 -0
- package/{mechanisms/audit/CD-6 → src/infrastructure/engines/walker/shorthand-name/identifier-names}/identifier-names.js +32 -15
- package/src/infrastructure/engines/walker/shorthand-name/identifier-names/piece.json +9 -0
- package/src/infrastructure/engines/walker/strictness-weakened/exact-optional-property-types/exact-optional-property-types.examples.json +71 -0
- package/src/infrastructure/engines/walker/strictness-weakened/exact-optional-property-types/piece.json +17 -0
- package/src/infrastructure/engines/walker/strictness-weakened/no-fallthrough-cases-in-switch/no-fallthrough-cases-in-switch.examples.json +71 -0
- package/src/infrastructure/engines/walker/strictness-weakened/no-fallthrough-cases-in-switch/piece.json +17 -0
- package/src/infrastructure/engines/walker/strictness-weakened/no-implicit-override/no-implicit-override.examples.json +71 -0
- package/src/infrastructure/engines/walker/strictness-weakened/no-implicit-override/piece.json +17 -0
- package/src/infrastructure/engines/walker/strictness-weakened/no-property-access-from-index-signature/no-property-access-from-index-signature.examples.json +71 -0
- package/src/infrastructure/engines/walker/strictness-weakened/no-property-access-from-index-signature/piece.json +17 -0
- package/src/infrastructure/engines/walker/strictness-weakened/no-unchecked-indexed-access/no-unchecked-indexed-access.examples.json +71 -0
- package/src/infrastructure/engines/walker/strictness-weakened/no-unchecked-indexed-access/piece.json +17 -0
- package/{mechanisms/audit/CD-3 → src/infrastructure/engines/walker/strictness-weakened/strict}/compiler-overrides.js +102 -38
- package/src/infrastructure/engines/walker/strictness-weakened/strict/piece.json +13 -0
- package/src/infrastructure/engines/walker/strictness-weakened/strict/strict.examples.json +64 -0
- package/src/infrastructure/engines/walker/strictness-weakened/use-unknown-in-catch-variables/piece.json +17 -0
- package/src/infrastructure/engines/walker/strictness-weakened/use-unknown-in-catch-variables/use-unknown-in-catch-variables.examples.json +71 -0
- package/src/infrastructure/engines/walker/text-past-its-reader/test-body/piece.json +18 -0
- package/src/infrastructure/engines/walker/throw-or-catch-in-a-test/throw-statement/piece.json +9 -0
- package/src/infrastructure/engines/walker/throw-or-catch-in-a-test/throw-statement/throw-statement.examples.json +36 -0
- package/{mechanisms/audit/CD-10 → src/infrastructure/engines/walker/throw-or-catch-in-a-test/throw-statement}/throws-in-tests.js +6 -3
- package/src/infrastructure/engines/walker/throw-or-catch-in-a-test/try-block/piece.json +18 -0
- package/src/infrastructure/engines/walker/type-derived-from-code/factory-return-types/factory-return-types.examples.json +36 -0
- package/{mechanisms/audit/CD-7a → src/infrastructure/engines/walker/type-derived-from-code/factory-return-types}/factory-return-types.js +5 -3
- package/src/infrastructure/engines/walker/type-derived-from-code/factory-return-types/piece.json +9 -0
- package/src/infrastructure/engines/walker/unit-without-a-running-test/companion-test-file/companion-test-file.examples.json +36 -0
- package/{mechanisms/audit/CD-23 → src/infrastructure/engines/walker/unit-without-a-running-test/companion-test-file}/export-test-sibling.js +7 -4
- package/src/infrastructure/engines/walker/unit-without-a-running-test/companion-test-file/piece.json +9 -0
- package/{mechanisms/audit/CD-5 → src/infrastructure/engines/walker/untracked-escape/directive-pointers}/comments-directives.js +40 -19
- package/src/infrastructure/engines/walker/untracked-escape/directive-pointers/directive-pointers.examples.json +96 -0
- package/src/infrastructure/engines/walker/untracked-escape/directive-pointers/piece.json +16 -0
- package/src/infrastructure/engines/walker/write-into-a-parameter/parameter-mutation/parameter-mutation.examples.json +42 -0
- package/{mechanisms/audit/CD-44 → src/infrastructure/engines/walker/write-into-a-parameter/parameter-mutation}/parameter-mutation.js +22 -7
- package/src/infrastructure/engines/walker/write-into-a-parameter/parameter-mutation/piece.json +9 -0
- package/src/rule-set.d.ts +4 -0
- package/src/testing.d.ts +7 -0
- package/src/testing.js +524 -0
- package/api/audit.d.ts +0 -20
- package/api/rule-set.d.ts +0 -4
- package/api/testing.d.ts +0 -5
- package/api/testing.js +0 -238
- package/chunks/chunk-335ITLPO.js +0 -7
- package/chunks/chunk-5U4VTFD5.js +0 -1949
- package/chunks/chunk-E6VR3VRV.js +0 -268
- package/chunks/chunk-FR4FASVM.js +0 -108
- package/chunks/chunk-LDQUT742.js +0 -15
- package/chunks/chunk-MXSIQPCV.js +0 -13
- package/chunks/chunk-RWQ4UNKY.js +0 -24
- package/core/check/tool-command.js +0 -2909
- package/core/mechanism-port/runner-result-types.d.ts +0 -19
- package/mechanisms/audit/CD-1/piece.json +0 -13
- package/mechanisms/audit/CD-10/piece.json +0 -13
- package/mechanisms/audit/CD-14/piece.json +0 -13
- package/mechanisms/audit/CD-15/piece.json +0 -13
- package/mechanisms/audit/CD-17/clock-sources.js +0 -28
- package/mechanisms/audit/CD-17/piece.json +0 -13
- package/mechanisms/audit/CD-19/import-boundaries.js +0 -99
- package/mechanisms/audit/CD-19/piece.json +0 -18
- package/mechanisms/audit/CD-2/piece.json +0 -18
- package/mechanisms/audit/CD-23/piece.json +0 -13
- package/mechanisms/audit/CD-25/piece.json +0 -13
- package/mechanisms/audit/CD-26/piece.json +0 -13
- package/mechanisms/audit/CD-27/piece.json +0 -17
- package/mechanisms/audit/CD-3/piece.json +0 -77
- package/mechanisms/audit/CD-43/piece.json +0 -13
- package/mechanisms/audit/CD-44/piece.json +0 -13
- package/mechanisms/audit/CD-47/piece.json +0 -13
- package/mechanisms/audit/CD-5/piece.json +0 -20
- package/mechanisms/audit/CD-6/piece.json +0 -13
- package/mechanisms/audit/CD-7/piece.json +0 -13
- package/mechanisms/audit/CD-7a/piece.json +0 -13
- package/mechanisms/audit/CD-8/piece.json +0 -13
- package/mechanisms/audit/CD-8/switch-defaults.js +0 -42
- package/mechanisms/eslint/CD-1/piece.json +0 -23
- package/mechanisms/eslint/CD-10/piece.json +0 -15
- package/mechanisms/eslint/CD-14/piece.json +0 -31
- package/mechanisms/eslint/CD-2/cd2/cd2.eslint-plugin.js +0 -15
- package/mechanisms/eslint/CD-2/piece.json +0 -25
- package/mechanisms/eslint/CD-27/piece.json +0 -23
- package/mechanisms/eslint/CD-40/cd40/cd40.eslint-plugin.js +0 -15
- package/mechanisms/eslint/CD-40/piece.json +0 -21
- package/mechanisms/eslint/CD-41/piece.json +0 -23
- package/mechanisms/eslint/CD-42/piece.json +0 -15
- package/mechanisms/eslint/CD-44/cd44/cd44.eslint-plugin.js +0 -15
- package/mechanisms/eslint/CD-44/piece.json +0 -20
- package/mechanisms/eslint/CD-6/cd6/cd6.eslint-plugin.js +0 -15
- package/mechanisms/eslint/CD-6/piece.json +0 -217
- package/mechanisms/eslint/CD-7/piece.json +0 -15
- package/rules/CD-1/CHECKS.md +0 -41
- package/rules/CD-1/README.md +0 -15
- package/rules/CD-1/discipline.json +0 -195
- package/rules/CD-10/CHECKS.md +0 -51
- package/rules/CD-10/README.md +0 -15
- package/rules/CD-10/discipline.json +0 -133
- package/rules/CD-11/CHECKS.md +0 -15
- package/rules/CD-11/README.md +0 -15
- package/rules/CD-11/discipline.json +0 -12
- package/rules/CD-12/CHECKS.md +0 -15
- package/rules/CD-12/README.md +0 -15
- package/rules/CD-12/discipline.json +0 -12
- package/rules/CD-13/CHECKS.md +0 -15
- package/rules/CD-13/README.md +0 -15
- package/rules/CD-13/discipline.json +0 -12
- package/rules/CD-14/CHECKS.md +0 -51
- package/rules/CD-14/README.md +0 -15
- package/rules/CD-14/discipline.json +0 -173
- package/rules/CD-15/CHECKS.md +0 -44
- package/rules/CD-15/README.md +0 -15
- package/rules/CD-15/discipline.json +0 -73
- package/rules/CD-16/CHECKS.md +0 -9
- package/rules/CD-16/README.md +0 -15
- package/rules/CD-17/CHECKS.md +0 -39
- package/rules/CD-17/README.md +0 -15
- package/rules/CD-17/discipline.json +0 -51
- package/rules/CD-18/CHECKS.md +0 -15
- package/rules/CD-18/README.md +0 -15
- package/rules/CD-18/discipline.json +0 -12
- package/rules/CD-19/CHECKS.md +0 -51
- package/rules/CD-19/README.md +0 -15
- package/rules/CD-19/discipline.json +0 -63
- package/rules/CD-2/CHECKS.md +0 -60
- package/rules/CD-2/README.md +0 -15
- package/rules/CD-2/discipline.json +0 -151
- package/rules/CD-20/CHECKS.md +0 -9
- package/rules/CD-20/README.md +0 -15
- package/rules/CD-21/CHECKS.md +0 -15
- package/rules/CD-21/README.md +0 -15
- package/rules/CD-21/discipline.json +0 -12
- package/rules/CD-22/CHECKS.md +0 -15
- package/rules/CD-22/README.md +0 -15
- package/rules/CD-22/discipline.json +0 -12
- package/rules/CD-23/CHECKS.md +0 -37
- package/rules/CD-23/README.md +0 -15
- package/rules/CD-23/discipline.json +0 -57
- package/rules/CD-24/CHECKS.md +0 -9
- package/rules/CD-24/README.md +0 -15
- package/rules/CD-25/CHECKS.md +0 -40
- package/rules/CD-25/README.md +0 -15
- package/rules/CD-25/discipline.json +0 -57
- package/rules/CD-26/CHECKS.md +0 -38
- package/rules/CD-26/README.md +0 -15
- package/rules/CD-26/discipline.json +0 -57
- package/rules/CD-27/CHECKS.md +0 -460
- package/rules/CD-27/README.md +0 -15
- package/rules/CD-27/discipline.json +0 -437
- package/rules/CD-28/CHECKS.md +0 -15
- package/rules/CD-28/README.md +0 -15
- package/rules/CD-28/discipline.json +0 -12
- package/rules/CD-29/CHECKS.md +0 -15
- package/rules/CD-29/README.md +0 -15
- package/rules/CD-29/discipline.json +0 -12
- package/rules/CD-3/README.md +0 -15
- package/rules/CD-3/discipline.json +0 -641
- package/rules/CD-30/CHECKS.md +0 -15
- package/rules/CD-30/README.md +0 -15
- package/rules/CD-30/discipline.json +0 -12
- package/rules/CD-31/CHECKS.md +0 -15
- package/rules/CD-31/README.md +0 -15
- package/rules/CD-31/discipline.json +0 -12
- package/rules/CD-32/CHECKS.md +0 -15
- package/rules/CD-32/README.md +0 -26
- package/rules/CD-32/discipline.json +0 -12
- package/rules/CD-33/CHECKS.md +0 -15
- package/rules/CD-33/README.md +0 -26
- package/rules/CD-33/discipline.json +0 -12
- package/rules/CD-34/CHECKS.md +0 -15
- package/rules/CD-34/README.md +0 -25
- package/rules/CD-34/discipline.json +0 -12
- package/rules/CD-39/CHECKS.md +0 -15
- package/rules/CD-39/README.md +0 -26
- package/rules/CD-39/discipline.json +0 -12
- package/rules/CD-4/CHECKS.md +0 -15
- package/rules/CD-4/README.md +0 -15
- package/rules/CD-4/discipline.json +0 -12
- package/rules/CD-40/CHECKS.md +0 -41
- package/rules/CD-40/README.md +0 -15
- package/rules/CD-40/discipline.json +0 -58
- package/rules/CD-41/CHECKS.md +0 -66
- package/rules/CD-41/README.md +0 -15
- package/rules/CD-41/discipline.json +0 -138
- package/rules/CD-42/CHECKS.md +0 -49
- package/rules/CD-42/README.md +0 -15
- package/rules/CD-42/discipline.json +0 -61
- package/rules/CD-43/CHECKS.md +0 -39
- package/rules/CD-43/README.md +0 -15
- package/rules/CD-43/discipline.json +0 -65
- package/rules/CD-44/CHECKS.md +0 -50
- package/rules/CD-44/README.md +0 -15
- package/rules/CD-44/discipline.json +0 -111
- package/rules/CD-45/CHECKS.md +0 -15
- package/rules/CD-45/README.md +0 -15
- package/rules/CD-45/discipline.json +0 -12
- package/rules/CD-46/CHECKS.md +0 -9
- package/rules/CD-46/README.md +0 -27
- package/rules/CD-47/CHECKS.md +0 -39
- package/rules/CD-47/README.md +0 -15
- package/rules/CD-47/discipline.json +0 -57
- package/rules/CD-5/README.md +0 -15
- package/rules/CD-5/discipline.json +0 -131
- package/rules/CD-6/CHECKS.md +0 -53
- package/rules/CD-6/README.md +0 -15
- package/rules/CD-6/discipline.json +0 -165
- package/rules/CD-7/CHECKS.md +0 -48
- package/rules/CD-7/README.md +0 -15
- package/rules/CD-7/discipline.json +0 -142
- package/rules/CD-7a/CHECKS.md +0 -40
- package/rules/CD-7a/README.md +0 -15
- package/rules/CD-7a/discipline.json +0 -57
- package/rules/CD-8/CHECKS.md +0 -44
- package/rules/CD-8/README.md +0 -15
- package/rules/CD-8/discipline.json +0 -57
- package/rules/CD-9/CHECKS.md +0 -15
- package/rules/CD-9/README.md +0 -15
- package/rules/CD-9/discipline.json +0 -12
- package/rules/typescript/symptoms.json +0 -1005
- /package/{core/values → src/domain/finding}/anchor.d.ts +0 -0
- /package/{core/values → src/domain/repository}/branded.d.ts +0 -0
- /package/{core/values → src/domain/repository}/repo-path-types.d.ts +0 -0
- /package/{core/values → src/domain}/result.d.ts +0 -0
- /package/{core/values → src/domain/rule-set}/clause-address-types.d.ts +0 -0
- /package/{core/values → src/domain/settings/json-values}/json-value.d.ts +0 -0
- /package/{mechanisms/eslint/CD-14 → src/infrastructure/engines/eslint/authored-class-or-this/class-keyword}/README.md +0 -0
- /package/{mechanisms/eslint/CD-2 → src/infrastructure/engines/eslint/claimed-type/non-null-assertions}/README.md +0 -0
- /package/{mechanisms/eslint/CD-7 → src/infrastructure/engines/eslint/name-off-its-casing/filename-case}/README.md +0 -0
- /package/{mechanisms/eslint/CD-6 → src/infrastructure/engines/eslint/name-off-its-casing/naming-convention}/README.md +0 -0
- /package/{mechanisms/eslint/CD-40 → src/infrastructure/engines/eslint/positional-parameters/parameter-count}/README.md +0 -0
- /package/{mechanisms/eslint/CD-44 → src/infrastructure/engines/eslint/rebinding/parameter-reassignment}/README.md +0 -0
- /package/{mechanisms/eslint/CD-27 → src/infrastructure/engines/eslint/test-switched-off/focused-tests}/README.md +0 -0
- /package/{mechanisms/eslint/CD-10 → src/infrastructure/engines/eslint/thrown-non-error/throw-only-error}/README.md +0 -0
- /package/{mechanisms/eslint/CD-1 → src/infrastructure/engines/eslint/untyped-value/explicit-any}/README.md +0 -0
- /package/{mechanisms/eslint/CD-42 → src/infrastructure/engines/eslint/work-inside-a-condition/else-after-an-exit}/README.md +0 -0
- /package/{mechanisms/audit → src/infrastructure/engines/walker}/runner/README.md +0 -0
- /package/{api → src}/rule-set.js +0 -0
package/chunks/chunk-5U4VTFD5.js
DELETED
|
@@ -1,1949 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
hitSchema,
|
|
3
|
-
measuredSchema,
|
|
4
|
-
nativeExceptionKindSchema,
|
|
5
|
-
projectionWriteSchema,
|
|
6
|
-
runnerResultSchema
|
|
7
|
-
} from "./chunk-2O46EB4E.js";
|
|
8
|
-
import {
|
|
9
|
-
JSON_KIND_NAMES,
|
|
10
|
-
jsonKindOf,
|
|
11
|
-
parsedJson,
|
|
12
|
-
sameJsonValue
|
|
13
|
-
} from "./chunk-E6VR3VRV.js";
|
|
14
|
-
import {
|
|
15
|
-
NOT_INSTALLED,
|
|
16
|
-
installRootAboveEntry,
|
|
17
|
-
repoPathSchema,
|
|
18
|
-
runnerModuleSegmentsOf
|
|
19
|
-
} from "./chunk-Y2KPZDDV.js";
|
|
20
|
-
import {
|
|
21
|
-
TOOL_IDENTITY,
|
|
22
|
-
clauseAddressObjectSchema,
|
|
23
|
-
clauseAddressSchema,
|
|
24
|
-
clauseAddressText,
|
|
25
|
-
sameClauseAddress
|
|
26
|
-
} from "./chunk-FR4FASVM.js";
|
|
27
|
-
|
|
28
|
-
// core/exception-records/exception-records.ts
|
|
29
|
-
import { z as z2 } from "zod";
|
|
30
|
-
|
|
31
|
-
// core/values/why-chain.ts
|
|
32
|
-
import { z } from "zod";
|
|
33
|
-
|
|
34
|
-
// core/values/chain-stems.ts
|
|
35
|
-
var FUNCTION_WORDS = /* @__PURE__ */ new Set([
|
|
36
|
-
"about",
|
|
37
|
-
"above",
|
|
38
|
-
"across",
|
|
39
|
-
"after",
|
|
40
|
-
"again",
|
|
41
|
-
"against",
|
|
42
|
-
"ago",
|
|
43
|
-
"all",
|
|
44
|
-
"almost",
|
|
45
|
-
"along",
|
|
46
|
-
"already",
|
|
47
|
-
"also",
|
|
48
|
-
"although",
|
|
49
|
-
"always",
|
|
50
|
-
"amid",
|
|
51
|
-
"among",
|
|
52
|
-
"and",
|
|
53
|
-
"another",
|
|
54
|
-
"any",
|
|
55
|
-
"anybody",
|
|
56
|
-
"anyone",
|
|
57
|
-
"anything",
|
|
58
|
-
"anyway",
|
|
59
|
-
"are",
|
|
60
|
-
"around",
|
|
61
|
-
"away",
|
|
62
|
-
"because",
|
|
63
|
-
"been",
|
|
64
|
-
"before",
|
|
65
|
-
"behind",
|
|
66
|
-
"being",
|
|
67
|
-
"below",
|
|
68
|
-
"beneath",
|
|
69
|
-
"beside",
|
|
70
|
-
"besides",
|
|
71
|
-
"between",
|
|
72
|
-
"beyond",
|
|
73
|
-
"both",
|
|
74
|
-
"but",
|
|
75
|
-
"can",
|
|
76
|
-
"cannot",
|
|
77
|
-
"could",
|
|
78
|
-
"despite",
|
|
79
|
-
"did",
|
|
80
|
-
"does",
|
|
81
|
-
"doing",
|
|
82
|
-
"done",
|
|
83
|
-
"down",
|
|
84
|
-
"during",
|
|
85
|
-
"each",
|
|
86
|
-
"either",
|
|
87
|
-
"else",
|
|
88
|
-
"enough",
|
|
89
|
-
"even",
|
|
90
|
-
"ever",
|
|
91
|
-
"every",
|
|
92
|
-
"everybody",
|
|
93
|
-
"everyone",
|
|
94
|
-
"everything",
|
|
95
|
-
"except",
|
|
96
|
-
"few",
|
|
97
|
-
"for",
|
|
98
|
-
"from",
|
|
99
|
-
"had",
|
|
100
|
-
"has",
|
|
101
|
-
"have",
|
|
102
|
-
"having",
|
|
103
|
-
"hence",
|
|
104
|
-
"her",
|
|
105
|
-
"here",
|
|
106
|
-
"hers",
|
|
107
|
-
"herself",
|
|
108
|
-
"him",
|
|
109
|
-
"himself",
|
|
110
|
-
"his",
|
|
111
|
-
"how",
|
|
112
|
-
"however",
|
|
113
|
-
"including",
|
|
114
|
-
"inside",
|
|
115
|
-
"instead",
|
|
116
|
-
"into",
|
|
117
|
-
"its",
|
|
118
|
-
"itself",
|
|
119
|
-
"just",
|
|
120
|
-
"less",
|
|
121
|
-
"like",
|
|
122
|
-
"many",
|
|
123
|
-
"may",
|
|
124
|
-
"maybe",
|
|
125
|
-
"might",
|
|
126
|
-
"mine",
|
|
127
|
-
"more",
|
|
128
|
-
"most",
|
|
129
|
-
"much",
|
|
130
|
-
"must",
|
|
131
|
-
"myself",
|
|
132
|
-
"near",
|
|
133
|
-
"neither",
|
|
134
|
-
"never",
|
|
135
|
-
"next",
|
|
136
|
-
"nobody",
|
|
137
|
-
"none",
|
|
138
|
-
"nor",
|
|
139
|
-
"not",
|
|
140
|
-
"nothing",
|
|
141
|
-
"now",
|
|
142
|
-
"off",
|
|
143
|
-
"often",
|
|
144
|
-
"once",
|
|
145
|
-
"one",
|
|
146
|
-
"only",
|
|
147
|
-
"onto",
|
|
148
|
-
"other",
|
|
149
|
-
"others",
|
|
150
|
-
"otherwise",
|
|
151
|
-
"our",
|
|
152
|
-
"ours",
|
|
153
|
-
"ourselves",
|
|
154
|
-
"out",
|
|
155
|
-
"outside",
|
|
156
|
-
"over",
|
|
157
|
-
"own",
|
|
158
|
-
"per",
|
|
159
|
-
"perhaps",
|
|
160
|
-
"quite",
|
|
161
|
-
"rather",
|
|
162
|
-
"really",
|
|
163
|
-
"same",
|
|
164
|
-
"she",
|
|
165
|
-
"shall",
|
|
166
|
-
"should",
|
|
167
|
-
"since",
|
|
168
|
-
"some",
|
|
169
|
-
"somebody",
|
|
170
|
-
"someone",
|
|
171
|
-
"something",
|
|
172
|
-
"soon",
|
|
173
|
-
"still",
|
|
174
|
-
"such",
|
|
175
|
-
"than",
|
|
176
|
-
"that",
|
|
177
|
-
"the",
|
|
178
|
-
"their",
|
|
179
|
-
"theirs",
|
|
180
|
-
"them",
|
|
181
|
-
"themselves",
|
|
182
|
-
"then",
|
|
183
|
-
"there",
|
|
184
|
-
"therefore",
|
|
185
|
-
"these",
|
|
186
|
-
"they",
|
|
187
|
-
"this",
|
|
188
|
-
"those",
|
|
189
|
-
"though",
|
|
190
|
-
"through",
|
|
191
|
-
"throughout",
|
|
192
|
-
"thus",
|
|
193
|
-
"too",
|
|
194
|
-
"toward",
|
|
195
|
-
"towards",
|
|
196
|
-
"under",
|
|
197
|
-
"unless",
|
|
198
|
-
"until",
|
|
199
|
-
"upon",
|
|
200
|
-
"very",
|
|
201
|
-
"via",
|
|
202
|
-
"was",
|
|
203
|
-
"were",
|
|
204
|
-
"what",
|
|
205
|
-
"whatever",
|
|
206
|
-
"when",
|
|
207
|
-
"whenever",
|
|
208
|
-
"where",
|
|
209
|
-
"whereas",
|
|
210
|
-
"whether",
|
|
211
|
-
"which",
|
|
212
|
-
"while",
|
|
213
|
-
"who",
|
|
214
|
-
"whoever",
|
|
215
|
-
"whom",
|
|
216
|
-
"whose",
|
|
217
|
-
"why",
|
|
218
|
-
"will",
|
|
219
|
-
"with",
|
|
220
|
-
"within",
|
|
221
|
-
"without",
|
|
222
|
-
"would",
|
|
223
|
-
"yet",
|
|
224
|
-
"you",
|
|
225
|
-
"your",
|
|
226
|
-
"yours",
|
|
227
|
-
"yourself",
|
|
228
|
-
"yourselves"
|
|
229
|
-
]);
|
|
230
|
-
var MINIMUM_LETTERS = 3;
|
|
231
|
-
var MINIMUM_STEM_LETTERS = 2;
|
|
232
|
-
var NEGATIVE_CONTRACTION = /n['’]t\b/gi;
|
|
233
|
-
var CAMEL_CASE_BOUNDARY = /([a-z0-9])([A-Z])/g;
|
|
234
|
-
var WORD_SEPARATOR = /[^a-z0-9]+/;
|
|
235
|
-
var BARE_NUMBER = /^\d+$/;
|
|
236
|
-
var PLURAL_RULES = [
|
|
237
|
-
[/ie[sd]$/, "y"],
|
|
238
|
-
[/(?<=ss|x|z|ch|sh)es$/, ""],
|
|
239
|
-
[/(?<![siu])s$/, ""]
|
|
240
|
-
];
|
|
241
|
-
var INFLECTION = /(?:ing|(?<!e)ed)$/;
|
|
242
|
-
var DOUBLED_FINAL_CONSONANT = /([bcdfghjkmnpqrtvwxy])\1$/;
|
|
243
|
-
var TRAILING_E = /e$/;
|
|
244
|
-
var VOWEL = /[aeiouy]/;
|
|
245
|
-
var shortenedTo = (request) => request.shortened.length >= request.floor ? request.shortened : request.stem;
|
|
246
|
-
var voicedShortenedTo = (request) => VOWEL.test(request.shortened) ? shortenedTo({ ...request, floor: MINIMUM_STEM_LETTERS }) : request.stem;
|
|
247
|
-
var singularOf = (request) => PLURAL_RULES.reduce(
|
|
248
|
-
(stem, [suffix, replacement]) => shortenedTo({ stem, shortened: stem.replace(suffix, replacement), floor: MINIMUM_LETTERS }),
|
|
249
|
-
request.word
|
|
250
|
-
);
|
|
251
|
-
var uninflectedOf = (request) => {
|
|
252
|
-
if (!INFLECTION.test(request.stem)) {
|
|
253
|
-
return request.stem;
|
|
254
|
-
}
|
|
255
|
-
const bare = voicedShortenedTo({ stem: request.stem, shortened: request.stem.replace(INFLECTION, "") });
|
|
256
|
-
return bare === request.stem ? bare : shortenedTo({ stem: bare, shortened: bare.replace(DOUBLED_FINAL_CONSONANT, "$1"), floor: MINIMUM_LETTERS });
|
|
257
|
-
};
|
|
258
|
-
var stemOf = (request) => {
|
|
259
|
-
const stem = uninflectedOf({ stem: singularOf(request) });
|
|
260
|
-
return shortenedTo({ stem, shortened: stem.replace(TRAILING_E, ""), floor: MINIMUM_STEM_LETTERS });
|
|
261
|
-
};
|
|
262
|
-
var wordReadingOf = (request) => request.word.length >= MINIMUM_LETTERS && !FUNCTION_WORDS.has(request.word) && !BARE_NUMBER.test(request.word) ? "content" : "dropped";
|
|
263
|
-
var stemsOf = (request) => {
|
|
264
|
-
const spellings = request.text.replace(NEGATIVE_CONTRACTION, " not").replace(CAMEL_CASE_BOUNDARY, "$1 $2").toLowerCase().split(WORD_SEPARATOR).filter((word) => wordReadingOf({ word }) === "content").map((word) => [stemOf({ word }), word]);
|
|
265
|
-
return new Map(
|
|
266
|
-
spellings.filter(([stem], position) => spellings.findIndex(([earlier]) => earlier === stem) === position)
|
|
267
|
-
);
|
|
268
|
-
};
|
|
269
|
-
var stemsShared = (request) => new Map([...request.left].filter(([stem]) => request.right.has(stem)));
|
|
270
|
-
var stemsWithout = (request) => new Map([...request.stems].filter(([stem]) => request.excluded.every((excluded) => !excluded.has(stem))));
|
|
271
|
-
var wordsOf = (request) => [...request.stems.values()];
|
|
272
|
-
|
|
273
|
-
// core/values/why-chain.ts
|
|
274
|
-
var RESTATEMENT_PHRASES = [
|
|
275
|
-
String.raw`(?:the\s+)?(?:gate|check|ci|build|lint|test)s?\s+(?:was|were|is|are)\s+(?:failing|red|broken)`,
|
|
276
|
-
String.raw`(?:there\s+was\s+)?no\s+time`,
|
|
277
|
-
String.raw`we\s+(?:had\s+no|ran\s+out\s+of)\s+time`,
|
|
278
|
-
String.raw`(?:it\s+(?:is|was)\s+)?out\s+of\s+scope`,
|
|
279
|
-
String.raw`(?:it\s+(?:is|was)\s+)?(?:the\s+|an?\s+)?existing\s+(?:code|convention|pattern)`,
|
|
280
|
-
String.raw`(?:a\s+|the\s+)?time\s+constraint`,
|
|
281
|
-
String.raw`(?:a\s+|the\s+)?deadline`
|
|
282
|
-
];
|
|
283
|
-
var RESTATEMENT_OPENING = new RegExp(
|
|
284
|
-
String.raw`^(?:because\s+(?:of\s+)?)?(?:${RESTATEMENT_PHRASES.join("|")})\b`,
|
|
285
|
-
"i"
|
|
286
|
-
);
|
|
287
|
-
var MINIMUM_ANSWER_CHARACTERS = 12;
|
|
288
|
-
var MINIMUM_OWNER_CHARACTERS = 2;
|
|
289
|
-
var MINIMUM_SYMPTOM_STEMS_NAMED = 2;
|
|
290
|
-
var MINIMUM_NEW_STEM_SHARE = 0.25;
|
|
291
|
-
var ONE_REPEATED_CHARACTER = /^(.)\1+$/;
|
|
292
|
-
var PROSE_LOOKALIKES = /\b(?:e\.g\b\.?|i\.e\b\.?|a\.k\.a\.|etc\.|[ap]\.m\.)|(?<![\w./\\-])(?:and\/or|n\/a|w\/o|yes\/no)(?![\w./\\-])/gi;
|
|
293
|
-
var CHECKABLE_LOCATORS = [
|
|
294
|
-
/https?:\/\/\S/i,
|
|
295
|
-
/[\w.-][\\/][\w.-]/,
|
|
296
|
-
/(?:^|[\s(\x60'"])(?:\*|[\w-]+)(?:\.[\w-]+)*\.[a-z][a-z0-9]{0,9}\b/,
|
|
297
|
-
/(?:^|[\s(\x60'"])\.[a-z][\w-]+\b/,
|
|
298
|
-
/\d/
|
|
299
|
-
];
|
|
300
|
-
var THEREFORE = /\btherefore\b/i;
|
|
301
|
-
var rootCauseReading = (request) => RESTATEMENT_OPENING.test(request.rootCause.trim()) ? "restates-the-exception" : "names-a-cause";
|
|
302
|
-
var answerSubstance = (request) => request.answer.trim().length >= MINIMUM_ANSWER_CHARACTERS && !ONE_REPEATED_CHARACTER.test(request.answer.trim()) ? "substantive" : "placeholder";
|
|
303
|
-
var evidenceReading = (request) => CHECKABLE_LOCATORS.some((locator) => locator.test(request.evidence.replace(PROSE_LOOKALIKES, " "))) ? "checkable" : "unlocated";
|
|
304
|
-
var substantiveTextSchema = (request) => z.string({ error: request.refusal }).refine((answer) => answerSubstance({ answer }) === "substantive", {
|
|
305
|
-
error: request.refusal
|
|
306
|
-
});
|
|
307
|
-
var checkableTextSchema = (request) => substantiveTextSchema({ refusal: request.missing }).refine((evidence) => evidenceReading({ evidence }) === "checkable", {
|
|
308
|
-
error: request.unlocated
|
|
309
|
-
});
|
|
310
|
-
var WHY_QUESTION_MISSING = "is missing its `why` question";
|
|
311
|
-
var BECAUSE_MISSING = "carries no real `because` answer: a placeholder is an absent answer";
|
|
312
|
-
var EVIDENCE_MISSING = "carries no real `evidence`: cite a command, path, record id, PR, or named ruling";
|
|
313
|
-
var EVIDENCE_UNLOCATED = "carries no checkable `evidence`: cite a path, a line, a record or PR number, a measurement or a link";
|
|
314
|
-
var ROOT_CAUSE_REQUIRED = "`whyChain.rootCause` is required: the fifth why names the cause, not another symptom";
|
|
315
|
-
var ROOT_CHECK_REQUIRED = "`whyChain.rootCheck` is required beside `readback` in a causal chain: name what was run or read today that shows the root still holds, with a path, record, measurement or link";
|
|
316
|
-
var ROOT_CHECK_UNLOCATED = "`whyChain.rootCheck` cites nothing checkable: name the path, record, measurement or link you checked today";
|
|
317
|
-
var READBACK_REQUIRED = '`whyChain.readback` is required beside `rootCheck` in a causal chain: read from the root back to the symptom with "therefore"';
|
|
318
|
-
var OWNER_REQUIRED = "`whyChain.owner` is required: a record dir, a capture id, or the holder of the reserved authority";
|
|
319
|
-
var whyQuestionSchema = z.string({ error: WHY_QUESTION_MISSING }).refine((question) => question.trim().length > 0, {
|
|
320
|
-
error: WHY_QUESTION_MISSING
|
|
321
|
-
});
|
|
322
|
-
var legacyWhySchema = z.object(
|
|
323
|
-
{
|
|
324
|
-
why: whyQuestionSchema,
|
|
325
|
-
because: substantiveTextSchema({ refusal: BECAUSE_MISSING }),
|
|
326
|
-
evidence: substantiveTextSchema({ refusal: EVIDENCE_MISSING })
|
|
327
|
-
},
|
|
328
|
-
{ error: "is not a JSON object" }
|
|
329
|
-
);
|
|
330
|
-
var causalWhySchema = z.object(
|
|
331
|
-
{
|
|
332
|
-
why: whyQuestionSchema,
|
|
333
|
-
because: substantiveTextSchema({ refusal: BECAUSE_MISSING }),
|
|
334
|
-
evidence: checkableTextSchema({ missing: EVIDENCE_MISSING, unlocated: EVIDENCE_UNLOCATED })
|
|
335
|
-
},
|
|
336
|
-
{ error: "is not a JSON object" }
|
|
337
|
-
);
|
|
338
|
-
var fiveWhysSchema = (request) => z.tuple([request.why, request.why, request.why, request.why, request.why], {
|
|
339
|
-
error: "`whyChain.whys` must hold exactly 5 whys"
|
|
340
|
-
});
|
|
341
|
-
var rootCauseSchema = z.string({ error: ROOT_CAUSE_REQUIRED }).refine((answer) => answerSubstance({ answer }) === "substantive", {
|
|
342
|
-
error: ROOT_CAUSE_REQUIRED,
|
|
343
|
-
abort: true
|
|
344
|
-
}).refine((rootCause) => rootCauseReading({ rootCause }) === "names-a-cause", {
|
|
345
|
-
error: "`whyChain.rootCause` restates the exception rather than naming its cause"
|
|
346
|
-
});
|
|
347
|
-
var ownerSchema = z.string({ error: OWNER_REQUIRED }).refine((owner) => owner.trim().length >= MINIMUM_OWNER_CHARACTERS, {
|
|
348
|
-
error: OWNER_REQUIRED
|
|
349
|
-
});
|
|
350
|
-
var legacyWhyChainSchema = z.object(
|
|
351
|
-
{
|
|
352
|
-
whys: fiveWhysSchema({ why: legacyWhySchema }),
|
|
353
|
-
rootCause: rootCauseSchema,
|
|
354
|
-
owner: ownerSchema
|
|
355
|
-
},
|
|
356
|
-
{ error: "`whyChain` is not a JSON object" }
|
|
357
|
-
);
|
|
358
|
-
var causeNamed = (request) => wordsOf({ stems: request.cause }).join(", ");
|
|
359
|
-
var symptomProblems = (request) => request.symptom.size === 0 ? [{ path: ["whys", 0, "why"], message: "names no symptom: ask why the exception's own subject happens, naming it" }] : [];
|
|
360
|
-
var restatementProblems = (request) => request.introduced.flatMap(
|
|
361
|
-
(cause, position) => cause.size === 0 || cause.size < MINIMUM_NEW_STEM_SHARE * (request.answers[position]?.size ?? 0) ? [
|
|
362
|
-
{
|
|
363
|
-
path: ["whys", position, "because"],
|
|
364
|
-
message: `restates ${position === 0 ? "the symptom" : "the symptom or an earlier answer"}: give the cause behind it, with at least a quarter of its words new to the chain`
|
|
365
|
-
}
|
|
366
|
-
] : []
|
|
367
|
-
);
|
|
368
|
-
var linkProblems = (request) => request.introduced.slice(0, -1).flatMap(
|
|
369
|
-
(cause, position) => cause.size > 0 && stemsShared({ left: cause, right: stemsOf({ text: request.whys[position + 1]?.why ?? "" }) }).size === 0 ? [
|
|
370
|
-
{
|
|
371
|
-
path: ["whys", position + 1, "why"],
|
|
372
|
-
message: `does not ask about the cause why ${position + 1}'s answer gave: ask why that answer is true, naming its cause (${causeNamed({ cause })})`
|
|
373
|
-
}
|
|
374
|
-
] : []
|
|
375
|
-
);
|
|
376
|
-
var rootProblems = (request) => request.fifthCause.size > 0 && stemsShared({ left: request.fifthCause, right: stemsOf({ text: request.rootCause }) }).size === 0 ? [
|
|
377
|
-
{
|
|
378
|
-
path: ["rootCause"],
|
|
379
|
-
message: `\`whyChain.rootCause\` does not name the cause why 5's answer gave: the root is the cause behind that answer (${causeNamed({ cause: request.fifthCause })})`
|
|
380
|
-
}
|
|
381
|
-
] : [];
|
|
382
|
-
var readbackProblems = (request) => {
|
|
383
|
-
const readback = stemsOf({ text: request.readback });
|
|
384
|
-
const root = stemsOf({ text: request.rootCause });
|
|
385
|
-
const symptomNamed = stemsShared({ left: request.symptom, right: readback }).size;
|
|
386
|
-
return [
|
|
387
|
-
...THEREFORE.test(request.readback) ? [] : ['`whyChain.readback` must read from the root back to the symptom with "therefore"'],
|
|
388
|
-
...root.size > 0 && stemsShared({ left: root, right: readback }).size === 0 ? [`\`whyChain.readback\` must name the root it starts from (${causeNamed({ cause: root })})`] : [],
|
|
389
|
-
...symptomNamed < Math.min(MINIMUM_SYMPTOM_STEMS_NAMED, request.symptom.size) ? [`\`whyChain.readback\` must name the symptom why 1 asks about (${causeNamed({ cause: request.symptom })})`] : []
|
|
390
|
-
].map((message) => ({ path: ["readback"], message }));
|
|
391
|
-
};
|
|
392
|
-
var causalProblemsOf = (request) => {
|
|
393
|
-
const { whys, rootCause, readback } = request.chain;
|
|
394
|
-
const symptom = stemsOf({ text: whys[0].why });
|
|
395
|
-
const answers = whys.map((step) => stemsOf({ text: step.because }));
|
|
396
|
-
const introduced = answers.map(
|
|
397
|
-
(answer, position) => stemsWithout({ stems: answer, excluded: [symptom, ...answers.slice(0, position)] })
|
|
398
|
-
);
|
|
399
|
-
return [
|
|
400
|
-
...symptomProblems({ symptom }),
|
|
401
|
-
...restatementProblems({ answers, introduced }),
|
|
402
|
-
...linkProblems({ whys, introduced }),
|
|
403
|
-
...rootProblems({ rootCause, fifthCause: introduced[4] ?? /* @__PURE__ */ new Map() }),
|
|
404
|
-
...readbackProblems({ readback, rootCause, symptom })
|
|
405
|
-
];
|
|
406
|
-
};
|
|
407
|
-
var whyChainSchema = z.object(
|
|
408
|
-
{
|
|
409
|
-
whys: fiveWhysSchema({ why: causalWhySchema }),
|
|
410
|
-
rootCause: rootCauseSchema,
|
|
411
|
-
rootCheck: checkableTextSchema({ missing: ROOT_CHECK_REQUIRED, unlocated: ROOT_CHECK_UNLOCATED }),
|
|
412
|
-
readback: substantiveTextSchema({ refusal: READBACK_REQUIRED }),
|
|
413
|
-
owner: ownerSchema
|
|
414
|
-
},
|
|
415
|
-
{ error: "`whyChain` is not a JSON object" }
|
|
416
|
-
).superRefine((chain, context) => {
|
|
417
|
-
causalProblemsOf({ chain }).forEach((problem) => {
|
|
418
|
-
context.addIssue({ code: "custom", path: [...problem.path], message: problem.message });
|
|
419
|
-
});
|
|
420
|
-
});
|
|
421
|
-
var whyChainFormOf = (request) => typeof request.chain === "object" && request.chain !== null && !Array.isArray(request.chain) && !("rootCheck" in request.chain) && !("readback" in request.chain) ? "legacy" : "causal";
|
|
422
|
-
|
|
423
|
-
// core/exception-records/exception-records.ts
|
|
424
|
-
var exceptionsFileSchema = z2.object({
|
|
425
|
-
version: z2.literal(1),
|
|
426
|
-
exceptions: z2.array(
|
|
427
|
-
z2.discriminatedUnion("kind", [
|
|
428
|
-
z2.strictObject({
|
|
429
|
-
kind: z2.literal("authorised-location"),
|
|
430
|
-
clause: z2.string(),
|
|
431
|
-
file: z2.string(),
|
|
432
|
-
reason: z2.string(),
|
|
433
|
-
whyChain: z2.unknown().optional(),
|
|
434
|
-
provenance: z2.unknown().optional()
|
|
435
|
-
}),
|
|
436
|
-
z2.strictObject({
|
|
437
|
-
kind: z2.literal("file-carve-out"),
|
|
438
|
-
clause: z2.string(),
|
|
439
|
-
file: z2.string(),
|
|
440
|
-
reason: z2.string().optional(),
|
|
441
|
-
whyChain: z2.unknown().optional(),
|
|
442
|
-
provenance: z2.unknown().optional()
|
|
443
|
-
}),
|
|
444
|
-
z2.strictObject({
|
|
445
|
-
kind: z2.literal("clause-wide-carve-out"),
|
|
446
|
-
clause: z2.string(),
|
|
447
|
-
reason: z2.string(),
|
|
448
|
-
whyChain: z2.unknown()
|
|
449
|
-
})
|
|
450
|
-
])
|
|
451
|
-
)
|
|
452
|
-
});
|
|
453
|
-
var exceptionEntriesOfDocument = (request) => {
|
|
454
|
-
const parsed = exceptionsFileSchema.safeParse(request.document);
|
|
455
|
-
return parsed.success ? { outcome: "ok", value: parsed.data.exceptions } : { outcome: "failed", error: { detail: z2.prettifyError(parsed.error) } };
|
|
456
|
-
};
|
|
457
|
-
var RECORDS_DOCUMENT_KEYS = Object.keys(exceptionsFileSchema.shape);
|
|
458
|
-
var documentKeysSchema = z2.record(z2.string(), z2.unknown());
|
|
459
|
-
var foreignKeysOfDocument = (request) => {
|
|
460
|
-
const keys = documentKeysSchema.safeParse(request.document);
|
|
461
|
-
return keys.success ? Object.keys(keys.data).filter((key) => !RECORDS_DOCUMENT_KEYS.includes(key)) : [];
|
|
462
|
-
};
|
|
463
|
-
var UNMEASURED_EXCEPTION_BASELINE = { measured: "no", base: { state: "not-given" } };
|
|
464
|
-
var LEGACY_DIRECTORY_OF = {
|
|
465
|
-
"inherited-debt": ".constitution-carve-outs",
|
|
466
|
-
"existing-authorisation": ".constitution-authorised-locations"
|
|
467
|
-
};
|
|
468
|
-
var LEGACY_SOURCE = /^(?<directory>[^/#]+)\/(?<stem>cd-[0-9a-z]+)\.json#(?<index>\d+)$/;
|
|
469
|
-
var legacySourceGroupsSchema = z2.object({
|
|
470
|
-
directory: z2.enum([LEGACY_DIRECTORY_OF["inherited-debt"], LEGACY_DIRECTORY_OF["existing-authorisation"]]),
|
|
471
|
-
stem: z2.string(),
|
|
472
|
-
index: z2.coerce.number().int().nonnegative()
|
|
473
|
-
});
|
|
474
|
-
var legacyRecordsSchema = z2.array(z2.looseObject({ files: z2.array(z2.string()) }));
|
|
475
|
-
var recordedTextSchema = z2.string().refine((text) => text.trim().length > 0, { error: "must not be blank" });
|
|
476
|
-
var existingAuthorisationProvenanceSchema = z2.strictObject({
|
|
477
|
-
kind: z2.literal("existing-authorisation"),
|
|
478
|
-
source: recordedTextSchema,
|
|
479
|
-
decision: recordedTextSchema.optional()
|
|
480
|
-
});
|
|
481
|
-
var inheritedDebtProvenanceSchema = z2.strictObject({
|
|
482
|
-
kind: z2.literal("inherited-debt"),
|
|
483
|
-
source: recordedTextSchema,
|
|
484
|
-
decision: recordedTextSchema
|
|
485
|
-
});
|
|
486
|
-
var authorisedLocationFields = {
|
|
487
|
-
kind: z2.literal("authorised-location"),
|
|
488
|
-
clause: z2.string(),
|
|
489
|
-
file: z2.string(),
|
|
490
|
-
reason: z2.string()
|
|
491
|
-
};
|
|
492
|
-
var unjudgedWhyChainSchema = z2.custom((whyChain) => whyChain !== void 0);
|
|
493
|
-
var reasonOnlyFields = { reason: recordedTextSchema, whyChain: z2.never().optional(), provenance: z2.never().optional() };
|
|
494
|
-
var chainedAuthorisedLocationSchema = z2.strictObject({ ...authorisedLocationFields, whyChain: unjudgedWhyChainSchema, provenance: existingAuthorisationProvenanceSchema.optional() });
|
|
495
|
-
var importedAuthorisedLocationSchema = z2.strictObject({ ...authorisedLocationFields, whyChain: z2.never().optional(), provenance: existingAuthorisationProvenanceSchema });
|
|
496
|
-
var reasonedAuthorisedLocationSchema = z2.strictObject({ ...authorisedLocationFields, ...reasonOnlyFields });
|
|
497
|
-
var fileCarveOutFields = {
|
|
498
|
-
kind: z2.literal("file-carve-out"),
|
|
499
|
-
clause: z2.string(),
|
|
500
|
-
file: z2.string(),
|
|
501
|
-
reason: z2.string().optional()
|
|
502
|
-
};
|
|
503
|
-
var chainedFileCarveOutSchema = z2.strictObject({ ...fileCarveOutFields, whyChain: unjudgedWhyChainSchema, provenance: inheritedDebtProvenanceSchema.optional() });
|
|
504
|
-
var importedFileCarveOutSchema = z2.strictObject({ ...fileCarveOutFields, whyChain: z2.never().optional(), provenance: inheritedDebtProvenanceSchema });
|
|
505
|
-
var plainFileCarveOutSchema = z2.strictObject({ ...fileCarveOutFields, whyChain: z2.never().optional(), provenance: z2.never().optional() });
|
|
506
|
-
var FILE_EVIDENCE_SCHEMAS_OF = {
|
|
507
|
-
required: {
|
|
508
|
-
"authorised-location": z2.union([chainedAuthorisedLocationSchema, importedAuthorisedLocationSchema]),
|
|
509
|
-
"file-carve-out": z2.union([chainedFileCarveOutSchema, importedFileCarveOutSchema, plainFileCarveOutSchema])
|
|
510
|
-
},
|
|
511
|
-
optional: {
|
|
512
|
-
"authorised-location": z2.union([chainedAuthorisedLocationSchema, importedAuthorisedLocationSchema, reasonedAuthorisedLocationSchema]),
|
|
513
|
-
"file-carve-out": z2.union([chainedFileCarveOutSchema, importedFileCarveOutSchema, plainFileCarveOutSchema])
|
|
514
|
-
}
|
|
515
|
-
};
|
|
516
|
-
var legacySourceOf = (request) => {
|
|
517
|
-
const groups = legacySourceGroupsSchema.safeParse(LEGACY_SOURCE.exec(request.source)?.groups);
|
|
518
|
-
if (!groups.success) {
|
|
519
|
-
return "not-legacy-source";
|
|
520
|
-
}
|
|
521
|
-
const path = repoPathSchema.safeParse(`${groups.data.directory}/${groups.data.stem}.json`);
|
|
522
|
-
return path.success ? { path: path.data, directory: groups.data.directory, discipline: groups.data.stem.toUpperCase(), index: groups.data.index } : "not-legacy-source";
|
|
523
|
-
};
|
|
524
|
-
var sameEntry = (request) => JSON.stringify(request.left) === JSON.stringify(request.right) ? "same" : "different";
|
|
525
|
-
var sameIdentity = (request) => request.entry.kind === request.identity.kind && request.entry.clause === request.identity.clause && request.entry.file === request.identity.file ? "same" : "different";
|
|
526
|
-
var legacyListing = (request) => {
|
|
527
|
-
const text = request.sourceTextsAtBase.get(request.source.path);
|
|
528
|
-
const document = text === void 0 ? void 0 : parsedJson({ text });
|
|
529
|
-
if (document === void 0 || document.outcome === "failed") {
|
|
530
|
-
return "not-listed";
|
|
531
|
-
}
|
|
532
|
-
const records = legacyRecordsSchema.safeParse(document.value);
|
|
533
|
-
return records.success && records.data[request.source.index]?.files.includes(request.file) === true ? "listed" : "not-listed";
|
|
534
|
-
};
|
|
535
|
-
var IMPORT_WAY_OUT = {
|
|
536
|
-
"authorised-location": "give it a whyChain",
|
|
537
|
-
"file-carve-out": "give it a whyChain, or remove its provenance to keep it as debt"
|
|
538
|
-
};
|
|
539
|
-
var importRefused = (request) => ({
|
|
540
|
-
outcome: "failed",
|
|
541
|
-
error: { kind: "import-unverified", detail: `${request.detail}: ${IMPORT_WAY_OUT[request.kind]}` }
|
|
542
|
-
});
|
|
543
|
-
var evidenceJudgedBy = (request) => (request.evidence.whyChain === void 0 ? request.evidence.provenance === void 0 : whyChainFormOf({ chain: request.evidence.whyChain }) === "causal") ? "itself" : "the-base";
|
|
544
|
-
var judgedAtBase = (request) => {
|
|
545
|
-
if (evidenceJudgedBy(request) === "itself") {
|
|
546
|
-
return request.inFull();
|
|
547
|
-
}
|
|
548
|
-
return request.baseline.measured === "no" ? request.unjudged() : request.againstBase(request.baseline);
|
|
549
|
-
};
|
|
550
|
-
var importAgainstBase = (request) => {
|
|
551
|
-
const { baseline } = request;
|
|
552
|
-
if (baseline.entriesAtBase.some((baseEntry) => sameEntry({ left: baseEntry, right: request.entry }) === "same")) {
|
|
553
|
-
return { outcome: "ok", value: request.record };
|
|
554
|
-
}
|
|
555
|
-
if (baseline.entriesAtBase.some((baseEntry) => sameIdentity({ entry: baseEntry, identity: request.identity }) === "same")) {
|
|
556
|
-
return importRefused({ detail: "the imported record was edited since the base revision", kind: request.identity.kind });
|
|
557
|
-
}
|
|
558
|
-
const source = legacySourceOf({ source: request.provenance.source });
|
|
559
|
-
const listed2 = source !== "not-legacy-source" && source.directory === LEGACY_DIRECTORY_OF[request.provenance.kind] && source.discipline === request.discipline.toUpperCase() && legacyListing({ sourceTextsAtBase: baseline.sourceTextsAtBase, source, file: request.identity.file }) === "listed";
|
|
560
|
-
return listed2 ? { outcome: "ok", value: request.record } : importRefused({
|
|
561
|
-
kind: request.identity.kind,
|
|
562
|
-
detail: `the record is new since the base revision, and its provenance source ${request.provenance.source} is not an entry at the base revision listing ${request.identity.file} under ${LEGACY_DIRECTORY_OF[request.provenance.kind]}/${request.discipline.toLowerCase()}.json`
|
|
563
|
-
});
|
|
564
|
-
};
|
|
565
|
-
var verifiedImport = (request) => judgedAtBase({
|
|
566
|
-
evidence: { provenance: request.provenance },
|
|
567
|
-
baseline: request.baseline,
|
|
568
|
-
inFull: () => ({ outcome: "ok", value: request.record }),
|
|
569
|
-
unjudged: () => ({ outcome: "ok", value: request.record }),
|
|
570
|
-
againstBase: (base) => importAgainstBase({ ...request, baseline: base })
|
|
571
|
-
});
|
|
572
|
-
var recordedFile = (request) => {
|
|
573
|
-
const parsed = repoPathSchema.safeParse(request.file);
|
|
574
|
-
return parsed.success ? { outcome: "ok", value: parsed.data } : { outcome: "failed", error: { kind: "file-not-repo-path", file: request.file } };
|
|
575
|
-
};
|
|
576
|
-
var LEGACY_CHAIN_NEW_OR_EDITED = `a new or edited entry's whyChain follows the causal contract (docs/why-chain-contract.md in the ${TOOL_IDENTITY.packageName} package); a chain without rootCheck and readback is accepted only while --base-revision holds its entry unchanged`;
|
|
577
|
-
var chainRefused = (request) => ({
|
|
578
|
-
outcome: "failed",
|
|
579
|
-
error: { kind: "why-chain-refused", detail: request.detail }
|
|
580
|
-
});
|
|
581
|
-
var causalChainOf = (request) => {
|
|
582
|
-
const parsed = whyChainSchema.safeParse(request.whyChain);
|
|
583
|
-
return parsed.success ? { outcome: "ok", value: parsed.data } : chainRefused({ detail: [...request.preface, z2.prettifyError(parsed.error)].join("\n") });
|
|
584
|
-
};
|
|
585
|
-
var legacyChainOf = (request) => {
|
|
586
|
-
const parsed = legacyWhyChainSchema.safeParse(request.whyChain);
|
|
587
|
-
return parsed.success ? { outcome: "ok", value: parsed.data } : chainRefused({ detail: z2.prettifyError(parsed.error) });
|
|
588
|
-
};
|
|
589
|
-
var judgedWhyChain = (request) => judgedAtBase({
|
|
590
|
-
evidence: { whyChain: request.whyChain },
|
|
591
|
-
baseline: request.baseline,
|
|
592
|
-
inFull: () => causalChainOf({ whyChain: request.whyChain, preface: [] }),
|
|
593
|
-
unjudged: () => legacyChainOf(request),
|
|
594
|
-
againstBase: (base) => base.entriesAtBase.some((baseEntry) => sameEntry({ left: baseEntry, right: request.entry }) === "same") ? legacyChainOf(request) : causalChainOf({ whyChain: request.whyChain, preface: [LEGACY_CHAIN_NEW_OR_EDITED] })
|
|
595
|
-
});
|
|
596
|
-
var authorisationStandingOf = (request) => judgedAtBase({
|
|
597
|
-
evidence: request.record,
|
|
598
|
-
baseline: request.baseline,
|
|
599
|
-
inFull: () => "established",
|
|
600
|
-
unjudged: () => "provisional",
|
|
601
|
-
againstBase: () => "established"
|
|
602
|
-
});
|
|
603
|
-
var unselectedKindOf = (request) => [
|
|
604
|
-
["clause-not-adopted", request.selection.notAdopted],
|
|
605
|
-
["clause-not-run", request.selection.notRun]
|
|
606
|
-
].find(
|
|
607
|
-
([, addresses]) => addresses.some((address) => sameClauseAddress({ left: address, right: request.clause }) === "same")
|
|
608
|
-
)?.[0] ?? "clause-not-selected";
|
|
609
|
-
var selectedClauseOf = (request) => {
|
|
610
|
-
const address = clauseAddressSchema.safeParse(request.entry.clause);
|
|
611
|
-
if (!address.success) {
|
|
612
|
-
return {
|
|
613
|
-
outcome: "failed",
|
|
614
|
-
error: { kind: "clause-unparseable", detail: z2.prettifyError(address.error) }
|
|
615
|
-
};
|
|
616
|
-
}
|
|
617
|
-
const clause = address.data;
|
|
618
|
-
const selected = request.selection.selected.find(
|
|
619
|
-
(candidate) => sameClauseAddress({ left: candidate.address, right: clause }) === "same"
|
|
620
|
-
);
|
|
621
|
-
if (selected === void 0) {
|
|
622
|
-
return { outcome: "failed", error: { kind: unselectedKindOf({ selection: request.selection, clause }), clause } };
|
|
623
|
-
}
|
|
624
|
-
if (selected.exceptions === "refused") {
|
|
625
|
-
return { outcome: "failed", error: { kind: "non-exemptible-clause", clause } };
|
|
626
|
-
}
|
|
627
|
-
return { outcome: "ok", value: { clause, mechanism: selected.mechanism } };
|
|
628
|
-
};
|
|
629
|
-
var fileRecordOf = (request) => {
|
|
630
|
-
const { evidence, entry, clause, mechanism, file, baseline } = request;
|
|
631
|
-
if (evidence.whyChain !== void 0) {
|
|
632
|
-
const whyChain = judgedWhyChain({ whyChain: evidence.whyChain, entry, baseline });
|
|
633
|
-
return whyChain.outcome === "failed" ? whyChain : { outcome: "ok", value: { ...evidence, whyChain: whyChain.value, clause, mechanism, file } };
|
|
634
|
-
}
|
|
635
|
-
if (evidence.provenance === void 0) {
|
|
636
|
-
return { outcome: "ok", value: { ...evidence, clause, mechanism, file } };
|
|
637
|
-
}
|
|
638
|
-
return verifiedImport({
|
|
639
|
-
record: { ...evidence, clause, mechanism, file },
|
|
640
|
-
entry,
|
|
641
|
-
identity: { kind: evidence.kind, clause: evidence.clause, file },
|
|
642
|
-
discipline: clause.discipline,
|
|
643
|
-
provenance: evidence.provenance,
|
|
644
|
-
baseline
|
|
645
|
-
});
|
|
646
|
-
};
|
|
647
|
-
var parsedRecord = (request) => {
|
|
648
|
-
const { entry } = request;
|
|
649
|
-
const selected = selectedClauseOf(request);
|
|
650
|
-
if (selected.outcome === "failed") {
|
|
651
|
-
return selected;
|
|
652
|
-
}
|
|
653
|
-
const { clause, mechanism } = selected.value;
|
|
654
|
-
switch (entry.kind) {
|
|
655
|
-
case "authorised-location": {
|
|
656
|
-
const file = recordedFile({ file: entry.file });
|
|
657
|
-
if (file.outcome === "failed") {
|
|
658
|
-
return file;
|
|
659
|
-
}
|
|
660
|
-
const evidence = request.fileEvidence["authorised-location"].safeParse(entry);
|
|
661
|
-
return evidence.success ? fileRecordOf({ evidence: evidence.data, entry, clause, mechanism, file: file.value, baseline: request.baseline }) : { outcome: "failed", error: { kind: "evidence-refused", detail: z2.prettifyError(evidence.error) } };
|
|
662
|
-
}
|
|
663
|
-
case "file-carve-out": {
|
|
664
|
-
const file = recordedFile({ file: entry.file });
|
|
665
|
-
if (file.outcome === "failed") {
|
|
666
|
-
return file;
|
|
667
|
-
}
|
|
668
|
-
const evidence = request.fileEvidence["file-carve-out"].safeParse(entry);
|
|
669
|
-
return evidence.success ? fileRecordOf({ evidence: evidence.data, entry, clause, mechanism, file: file.value, baseline: request.baseline }) : { outcome: "failed", error: { kind: "evidence-refused", detail: z2.prettifyError(evidence.error) } };
|
|
670
|
-
}
|
|
671
|
-
case "clause-wide-carve-out": {
|
|
672
|
-
const whyChain = judgedWhyChain({ whyChain: entry.whyChain, entry, baseline: request.baseline });
|
|
673
|
-
if (whyChain.outcome === "failed") {
|
|
674
|
-
return whyChain;
|
|
675
|
-
}
|
|
676
|
-
return {
|
|
677
|
-
outcome: "ok",
|
|
678
|
-
value: { kind: entry.kind, clause, mechanism, reason: entry.reason, whyChain: whyChain.value }
|
|
679
|
-
};
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
};
|
|
683
|
-
var identityComparison = (request) => {
|
|
684
|
-
const { left, right } = request;
|
|
685
|
-
if (left.kind !== right.kind || sameClauseAddress({ left: left.clause, right: right.clause }) === "different") {
|
|
686
|
-
return "different-identity";
|
|
687
|
-
}
|
|
688
|
-
switch (left.kind) {
|
|
689
|
-
case "clause-wide-carve-out":
|
|
690
|
-
return "same-identity";
|
|
691
|
-
case "authorised-location":
|
|
692
|
-
case "file-carve-out":
|
|
693
|
-
return right.kind !== "clause-wide-carve-out" && left.file === right.file ? "same-identity" : "different-identity";
|
|
694
|
-
}
|
|
695
|
-
};
|
|
696
|
-
var originalRecordOf = (request) => request.valid.find(
|
|
697
|
-
(earlier) => earlier.index < request.candidate.index && identityComparison({ left: earlier.record, right: request.candidate.record }) === "same-identity"
|
|
698
|
-
);
|
|
699
|
-
var validRecordsOf = (request) => request.parsed.flatMap(
|
|
700
|
-
({ index, place, record }) => record.outcome === "ok" ? [{ index, place, record: record.value }] : []
|
|
701
|
-
);
|
|
702
|
-
var invalidRecordOf = (request) => {
|
|
703
|
-
const { index, place, record } = request.entry;
|
|
704
|
-
if (record.outcome === "failed") {
|
|
705
|
-
return [{ place, problem: record.error }];
|
|
706
|
-
}
|
|
707
|
-
const original = originalRecordOf({ valid: request.valid, candidate: { index, place, record: record.value } });
|
|
708
|
-
if (original === void 0) {
|
|
709
|
-
return [];
|
|
710
|
-
}
|
|
711
|
-
return [{ place, problem: { kind: "duplicate", of: original.place } }];
|
|
712
|
-
};
|
|
713
|
-
var invalidRecordsOf = (request) => request.parsed.flatMap((entry) => invalidRecordOf({ entry, valid: request.valid }));
|
|
714
|
-
var firstRecordsOf = (request) => request.valid.filter((candidate) => originalRecordOf({ valid: request.valid, candidate }) === void 0).map(({ record }) => record);
|
|
715
|
-
var parseExceptionEntries = (request) => {
|
|
716
|
-
const fileEvidence = FILE_EVIDENCE_SCHEMAS_OF[request.fileExceptionWhyChains];
|
|
717
|
-
const parsed = request.entries.map(
|
|
718
|
-
({ place, entry }, index) => ({
|
|
719
|
-
index,
|
|
720
|
-
place,
|
|
721
|
-
record: parsedRecord({ entry, selection: request.selection, baseline: request.baseline, fileEvidence })
|
|
722
|
-
})
|
|
723
|
-
);
|
|
724
|
-
const valid = validRecordsOf({ parsed });
|
|
725
|
-
return { records: firstRecordsOf({ valid }), invalid: invalidRecordsOf({ parsed, valid }) };
|
|
726
|
-
};
|
|
727
|
-
var importedEvidenceOf = (request) => {
|
|
728
|
-
switch (request.entry.kind) {
|
|
729
|
-
case "authorised-location":
|
|
730
|
-
return importedAuthorisedLocationSchema.safeParse(request.entry);
|
|
731
|
-
case "file-carve-out":
|
|
732
|
-
return importedFileCarveOutSchema.safeParse(request.entry);
|
|
733
|
-
case "clause-wide-carve-out":
|
|
734
|
-
return void 0;
|
|
735
|
-
}
|
|
736
|
-
};
|
|
737
|
-
var importEvidenceOf = (request) => {
|
|
738
|
-
const evidence = importedEvidenceOf(request);
|
|
739
|
-
if (evidence === void 0 || !evidence.success) {
|
|
740
|
-
return { imported: "no" };
|
|
741
|
-
}
|
|
742
|
-
return { imported: "yes", source: evidence.data.provenance.source };
|
|
743
|
-
};
|
|
744
|
-
var recordImportOf = (request) => {
|
|
745
|
-
const { record } = request;
|
|
746
|
-
if (record.kind === "clause-wide-carve-out" || record.whyChain !== void 0 || record.provenance === void 0) {
|
|
747
|
-
return { imported: "no" };
|
|
748
|
-
}
|
|
749
|
-
return { imported: "yes", source: record.provenance.source };
|
|
750
|
-
};
|
|
751
|
-
var importSourcePathsOf = (request) => {
|
|
752
|
-
const evidence = importEvidenceOf(request);
|
|
753
|
-
if (evidence.imported === "no") {
|
|
754
|
-
return [];
|
|
755
|
-
}
|
|
756
|
-
const source = legacySourceOf({ source: evidence.source });
|
|
757
|
-
return source === "not-legacy-source" ? [] : [source.path];
|
|
758
|
-
};
|
|
759
|
-
var importedEntriesIn = (request) => request.entries.some((entry) => importEvidenceOf({ entry }).imported === "yes") ? "present" : "absent";
|
|
760
|
-
var legacyChainsIn = (request) => request.entries.some((entry) => whyChainFormOf({ chain: entry.whyChain }) === "legacy") ? "present" : "absent";
|
|
761
|
-
var importSourcesOf = (request) => [...new Set(request.entries.flatMap((entry) => importSourcePathsOf({ entry })))];
|
|
762
|
-
var exceptionEntriesOfText = (request) => {
|
|
763
|
-
const document = parsedJson({ text: request.text });
|
|
764
|
-
if (document.outcome === "failed") {
|
|
765
|
-
return [];
|
|
766
|
-
}
|
|
767
|
-
const entries = exceptionEntriesOfDocument({ document: document.value });
|
|
768
|
-
return entries.outcome === "ok" ? entries.value : [];
|
|
769
|
-
};
|
|
770
|
-
|
|
771
|
-
// core/exception-records/debt-pair.ts
|
|
772
|
-
var pairKeyOf = (request) => `${request.clauseText} ${request.file}`;
|
|
773
|
-
var debtPairKey = (request) => pairKeyOf({ clauseText: clauseAddressText({ address: request.clause }), file: request.file });
|
|
774
|
-
var entryPairKey = (request) => {
|
|
775
|
-
if (request.entry.kind === "clause-wide-carve-out") {
|
|
776
|
-
return void 0;
|
|
777
|
-
}
|
|
778
|
-
const clause = clauseAddressSchema.safeParse(request.entry.clause);
|
|
779
|
-
return clause.success ? pairKeyOf({ clauseText: clauseAddressText({ address: clause.data }), file: request.entry.file }) : void 0;
|
|
780
|
-
};
|
|
781
|
-
var textOrder = (request) => {
|
|
782
|
-
if (request.left === request.right) {
|
|
783
|
-
return 0;
|
|
784
|
-
}
|
|
785
|
-
return request.left < request.right ? -1 : 1;
|
|
786
|
-
};
|
|
787
|
-
var pairOrder = (request) => request.left.file === request.right.file ? textOrder({ left: clauseAddressText({ address: request.left.clause }), right: clauseAddressText({ address: request.right.clause }) }) : textOrder({ left: request.left.file, right: request.right.file });
|
|
788
|
-
var distinctDebtPairs = (request) => [...new Map(request.pairs.map((pair) => [debtPairKey(pair), { clause: pair.clause, file: pair.file }])).values()].toSorted(
|
|
789
|
-
(left, right) => pairOrder({ left, right })
|
|
790
|
-
);
|
|
791
|
-
|
|
792
|
-
// core/check/load-failure-text.ts
|
|
793
|
-
var escapedLineBreaks = (request) => request.text.replaceAll("\n", "\\n").replaceAll("\r", "\\r");
|
|
794
|
-
var JUDGEMENT_CLAUSE_LISTED_REPAIR = "a judgement clause is enforced by review and is left out of clauses, adopted or not; remove it";
|
|
795
|
-
var CONFIG_ROOT_REPAIR = "an eslintConfigRoots entry is a folder git tracks files under outside every excluded path, spelled exactly as git spells it; fix or remove it in disciplines.json";
|
|
796
|
-
var SELECTION_ABSENT_REPAIR = "holds no disciplines.json; give the folder that holds it, usually the repository root";
|
|
797
|
-
var WHY_CHAINS_REQUIRED_REPAIR = `${TOOL_IDENTITY.command} record-debt writes records that give only a reason, and this file requires a whyChain on every record; set "fileExceptionWhyChains": "optional" in it to accept them`;
|
|
798
|
-
var BOTH_LAYOUTS_REPAIR = `${TOOL_IDENTITY.name} reads exception records from one layout; keep each record in one of them and remove the other`;
|
|
799
|
-
var SUPPORTED_VERSION_REPAIR = "add a supported version to the devDependencies of the repository root";
|
|
800
|
-
var EACH_SUPPORTED_VERSION_REPAIR = "add a supported version of each to the devDependencies of the repository root";
|
|
801
|
-
var unavailablePeerRepair = (request) => request.peer.peer === "required" && request.peer.found === NOT_INSTALLED ? `${request.peer.packageName} is a required peer of ${TOOL_IDENTITY.packageName}, so this install is incomplete; ${SUPPORTED_VERSION_REPAIR} and reinstall` : SUPPORTED_VERSION_REPAIR;
|
|
802
|
-
var unavailablePeersRepair = (request) => {
|
|
803
|
-
const [first, ...rest] = request.peers;
|
|
804
|
-
return rest.length === 0 ? unavailablePeerRepair({ peer: first }) : EACH_SUPPORTED_VERSION_REPAIR;
|
|
805
|
-
};
|
|
806
|
-
var unavailablePeerText = (request) => `${request.peer.packageName} found ${request.peer.found}, supported ${request.peer.supported}`;
|
|
807
|
-
var runnerFailureFields = (request) => {
|
|
808
|
-
switch (request.failure.kind) {
|
|
809
|
-
case "piece-invalid":
|
|
810
|
-
return [request.failure.kind, request.failure.pieceRoot, request.failure.detail];
|
|
811
|
-
case "file-unreadable":
|
|
812
|
-
case "file-unparseable":
|
|
813
|
-
return [request.failure.kind, request.failure.file, request.failure.detail];
|
|
814
|
-
case "toolchain-unavailable":
|
|
815
|
-
return [
|
|
816
|
-
request.failure.kind,
|
|
817
|
-
`${request.failure.peers.map((peer) => unavailablePeerText({ peer })).join("; ")}: ${unavailablePeersRepair({ peers: request.failure.peers })}`
|
|
818
|
-
];
|
|
819
|
-
case "toolchain-shadowed":
|
|
820
|
-
return [
|
|
821
|
-
request.failure.kind,
|
|
822
|
-
request.failure.packageName,
|
|
823
|
-
`resolved from ${request.failure.location} inside the core install ${request.failure.installRoot}: delete ${request.failure.installRoot}/node_modules, then reinstall the package with the repository's package manager, so the repository's own copy is used`
|
|
824
|
-
];
|
|
825
|
-
case "tool-failed":
|
|
826
|
-
case "plugin-conflict":
|
|
827
|
-
case "team-config-unloadable":
|
|
828
|
-
case "runner-invalid-output":
|
|
829
|
-
return [request.failure.kind, request.failure.detail];
|
|
830
|
-
}
|
|
831
|
-
};
|
|
832
|
-
var loadFailureFields = (request) => {
|
|
833
|
-
switch (request.failure.kind) {
|
|
834
|
-
case "arguments-invalid":
|
|
835
|
-
case "git-failed":
|
|
836
|
-
case "unexpected-error":
|
|
837
|
-
return [request.failure.detail];
|
|
838
|
-
case "selection-absent":
|
|
839
|
-
return [request.failure.repo, SELECTION_ABSENT_REPAIR];
|
|
840
|
-
case "install-root-unresolvable":
|
|
841
|
-
return [request.failure.url, request.failure.detail];
|
|
842
|
-
case "file-unreadable":
|
|
843
|
-
case "file-malformed":
|
|
844
|
-
case "file-unwritable":
|
|
845
|
-
case "records-unsplittable":
|
|
846
|
-
case "rule-set-invalid":
|
|
847
|
-
return [request.failure.path, request.failure.detail];
|
|
848
|
-
case "records-in-both-layouts":
|
|
849
|
-
return [request.failure.path, `${request.failure.folder}:`, BOTH_LAYOUTS_REPAIR];
|
|
850
|
-
case "why-chains-required":
|
|
851
|
-
return [`${request.failure.path}:`, WHY_CHAINS_REQUIRED_REPAIR];
|
|
852
|
-
case "unsupported-version":
|
|
853
|
-
return [request.failure.path, String(JSON.stringify(request.failure.found))];
|
|
854
|
-
case "reserved-rule-set-name":
|
|
855
|
-
case "unknown-rule-set":
|
|
856
|
-
return [request.failure.name];
|
|
857
|
-
case "duplicate-clause":
|
|
858
|
-
return [request.failure.address, request.failure.prefixedAddress];
|
|
859
|
-
case "rule-set-name-collision":
|
|
860
|
-
return [request.failure.name, request.failure.other];
|
|
861
|
-
case "unknown-discipline":
|
|
862
|
-
case "unknown-clause":
|
|
863
|
-
case "judgement-clause-selected":
|
|
864
|
-
return [request.failure.address];
|
|
865
|
-
case "judgement-clause-listed":
|
|
866
|
-
return [`${request.failure.address}:`, JUDGEMENT_CLAUSE_LISTED_REPAIR];
|
|
867
|
-
case "mechanism-not-allowed":
|
|
868
|
-
case "piece-missing":
|
|
869
|
-
return [request.failure.address, request.failure.mechanism];
|
|
870
|
-
case "config-root-untracked":
|
|
871
|
-
return [`${request.failure.root}:`, CONFIG_ROOT_REPAIR];
|
|
872
|
-
case "runner-missing":
|
|
873
|
-
return [request.failure.mechanism];
|
|
874
|
-
case "runner-invalid":
|
|
875
|
-
return [request.failure.mechanism, request.failure.detail];
|
|
876
|
-
case "runner-failed":
|
|
877
|
-
return [request.failure.mechanism, ...runnerFailureFields({ failure: request.failure.failure })];
|
|
878
|
-
}
|
|
879
|
-
};
|
|
880
|
-
var loadFailureDetail = (request) => [request.failure.kind, ...loadFailureFields(request)].map((text) => escapedLineBreaks({ text })).join(" ");
|
|
881
|
-
var loadFailureText = (request) => `load failure: ${loadFailureDetail(request)}
|
|
882
|
-
`;
|
|
883
|
-
|
|
884
|
-
// core/check/install-root.ts
|
|
885
|
-
var DIRECTORIES_ABOVE_ENTRY = {
|
|
886
|
-
api: "two directories",
|
|
887
|
-
command: "three directories"
|
|
888
|
-
};
|
|
889
|
-
var installRootUnresolvable = (request) => ({
|
|
890
|
-
outcome: "failed",
|
|
891
|
-
error: { kind: "install-root-unresolvable", url: request.url, detail: request.detail }
|
|
892
|
-
});
|
|
893
|
-
var installRootAbove = (request) => {
|
|
894
|
-
const entry = request.path.fromFileUrl({ url: request.moduleUrl });
|
|
895
|
-
if (entry.outcome === "failed") {
|
|
896
|
-
return installRootUnresolvable({ url: entry.error.url, detail: entry.error.detail });
|
|
897
|
-
}
|
|
898
|
-
const resolved = request.path.resolve({
|
|
899
|
-
path: installRootAboveEntry({
|
|
900
|
-
entryFile: entry.value,
|
|
901
|
-
entry: request.entry,
|
|
902
|
-
directoryOf: (path) => request.path.directoryOf({ path })
|
|
903
|
-
})
|
|
904
|
-
});
|
|
905
|
-
if (resolved.outcome === "failed") {
|
|
906
|
-
return installRootUnresolvable({
|
|
907
|
-
url: request.moduleUrl,
|
|
908
|
-
detail: `the install root ${DIRECTORIES_ABOVE_ENTRY[request.entry]} above the entry file is not an absolute path`
|
|
909
|
-
});
|
|
910
|
-
}
|
|
911
|
-
return resolved;
|
|
912
|
-
};
|
|
913
|
-
var installRootOf = (request) => installRootAbove({ ...request, entry: "command" });
|
|
914
|
-
var installRootOfApiEntry = (request) => installRootAbove({ ...request, entry: "api" });
|
|
915
|
-
|
|
916
|
-
// core/check/package-link.ts
|
|
917
|
-
var UNLINKED = { kind: "unlinked" };
|
|
918
|
-
var INSTALL_FOLDER = "node_modules";
|
|
919
|
-
var PACKAGE_MANIFEST = "package.json";
|
|
920
|
-
var manifestTextAt = (request) => {
|
|
921
|
-
const read = request.fileText.read({ path: request.path.join({ segments: [request.root, PACKAGE_MANIFEST] }) });
|
|
922
|
-
return read.outcome === "ok" ? read.value : void 0;
|
|
923
|
-
};
|
|
924
|
-
var sameFolder = (request) => {
|
|
925
|
-
const location = request.path.relative(request);
|
|
926
|
-
return location.relation === "within-root" && location.path === "" ? "same" : "different";
|
|
927
|
-
};
|
|
928
|
-
var holdsRunningPackage = (request) => {
|
|
929
|
-
const running = manifestTextAt({ ...request, root: request.installRoot });
|
|
930
|
-
return running !== void 0 && running === manifestTextAt({ ...request, root: request.linkRoot }) ? "holds" : "does-not-hold";
|
|
931
|
-
};
|
|
932
|
-
var packageLinkOf = (request) => {
|
|
933
|
-
const linkRoot = request.path.join({ segments: [request.repoRoot, INSTALL_FOLDER, TOOL_IDENTITY.packageName] });
|
|
934
|
-
const linked = { kind: "linked", installRoot: request.installRoot, linkRoot };
|
|
935
|
-
if (sameFolder({ path: request.path, from: linkRoot, to: request.installRoot }) === "same") {
|
|
936
|
-
return linked;
|
|
937
|
-
}
|
|
938
|
-
return holdsRunningPackage({ ...request, linkRoot }) === "holds" ? linked : UNLINKED;
|
|
939
|
-
};
|
|
940
|
-
|
|
941
|
-
// core/check/shown-path.ts
|
|
942
|
-
var NATIVE_SEPARATOR = "\\";
|
|
943
|
-
var SHOWN_SEPARATOR = "/";
|
|
944
|
-
var PARENT_FOLDER = "..";
|
|
945
|
-
var insidePackage = (request) => request.within === PARENT_FOLDER || request.within.startsWith(`${PARENT_FOLDER}${SHOWN_SEPARATOR}`) ? "outside" : "inside";
|
|
946
|
-
var throughLink = (request) => {
|
|
947
|
-
if (request.link.kind === "unlinked") {
|
|
948
|
-
return request.target;
|
|
949
|
-
}
|
|
950
|
-
const location = request.path.relative({ from: request.link.installRoot, to: request.target });
|
|
951
|
-
return location.relation === "within-root" && insidePackage({ within: location.path }) === "inside" ? request.path.join({ segments: [request.link.linkRoot, location.path] }) : request.target;
|
|
952
|
-
};
|
|
953
|
-
var shownPathOf = (request) => {
|
|
954
|
-
const target = throughLink(request);
|
|
955
|
-
const location = request.repoRoot === void 0 ? void 0 : request.path.relative({ from: request.repoRoot, to: target });
|
|
956
|
-
return location?.relation === "within-root" ? location.path : target.replaceAll(NATIVE_SEPARATOR, SHOWN_SEPARATOR);
|
|
957
|
-
};
|
|
958
|
-
var shownRunnerFailureOf = (request) => {
|
|
959
|
-
const { failure } = request;
|
|
960
|
-
switch (failure.kind) {
|
|
961
|
-
case "piece-invalid":
|
|
962
|
-
return { ...failure, pieceRoot: shownPathOf({ ...request, target: failure.pieceRoot }) };
|
|
963
|
-
case "toolchain-shadowed":
|
|
964
|
-
return {
|
|
965
|
-
...failure,
|
|
966
|
-
location: shownPathOf({ ...request, target: failure.location }),
|
|
967
|
-
installRoot: shownPathOf({ ...request, target: failure.installRoot })
|
|
968
|
-
};
|
|
969
|
-
default:
|
|
970
|
-
return failure;
|
|
971
|
-
}
|
|
972
|
-
};
|
|
973
|
-
var shownFailureOf = (request) => {
|
|
974
|
-
const { failure } = request;
|
|
975
|
-
switch (failure.kind) {
|
|
976
|
-
case "file-unreadable":
|
|
977
|
-
case "file-malformed":
|
|
978
|
-
case "file-unwritable":
|
|
979
|
-
case "why-chains-required":
|
|
980
|
-
case "records-unsplittable":
|
|
981
|
-
case "unsupported-version":
|
|
982
|
-
case "rule-set-invalid":
|
|
983
|
-
return { ...failure, path: shownPathOf({ ...request, target: failure.path }) };
|
|
984
|
-
case "records-in-both-layouts":
|
|
985
|
-
return {
|
|
986
|
-
...failure,
|
|
987
|
-
path: shownPathOf({ ...request, target: failure.path }),
|
|
988
|
-
folder: shownPathOf({ ...request, target: failure.folder })
|
|
989
|
-
};
|
|
990
|
-
case "runner-failed":
|
|
991
|
-
return { ...failure, failure: shownRunnerFailureOf({ ...request, failure: failure.failure }) };
|
|
992
|
-
default:
|
|
993
|
-
return failure;
|
|
994
|
-
}
|
|
995
|
-
};
|
|
996
|
-
|
|
997
|
-
// core/consumer-selection/clause-settings.ts
|
|
998
|
-
import { z as z3 } from "zod";
|
|
999
|
-
var clauseSettingsSchema = z3.record(z3.string(), z3.record(z3.string(), z3.json())).transform(
|
|
1000
|
-
(settings, context) => Object.entries(settings).flatMap(([key, values]) => {
|
|
1001
|
-
const address = clauseAddressSchema.safeParse(key);
|
|
1002
|
-
if (address.success) return [[address.data, values]];
|
|
1003
|
-
context.addIssue({ code: "custom", input: key, path: [key], message: `clauseSettings for ${key}: not a clause address` });
|
|
1004
|
-
return [];
|
|
1005
|
-
})
|
|
1006
|
-
);
|
|
1007
|
-
var refusal = (request) => ({
|
|
1008
|
-
outcome: "failed",
|
|
1009
|
-
error: `clauseSettings for ${clauseAddressText({ address: request.address })}: ${request.detail}`
|
|
1010
|
-
});
|
|
1011
|
-
var defaultClauseSettings = (request) => Object.fromEntries(Object.entries(request.declarations).map(([key, declaration]) => [key, declaration.default]));
|
|
1012
|
-
var listed = (request) => request.values.map((choice) => JSON.stringify(choice)).join(", ");
|
|
1013
|
-
var settingRefusalOf = (request) => {
|
|
1014
|
-
const { given, declaration } = request;
|
|
1015
|
-
if (declaration === void 0) {
|
|
1016
|
-
return `its piece takes no ${given.key}; it takes ${Object.keys(request.declarations).join(", ")}`;
|
|
1017
|
-
}
|
|
1018
|
-
const kind = jsonKindOf({ value: declaration.default });
|
|
1019
|
-
if (jsonKindOf({ value: given.value }) !== kind) return `${given.key} must be ${JSON_KIND_NAMES[kind]}, as its default is`;
|
|
1020
|
-
const choices = declaration.choices;
|
|
1021
|
-
if (choices !== void 0 && !choices.some((choice) => sameJsonValue({ left: choice, right: given.value }) === "same")) {
|
|
1022
|
-
return `${given.key} must be one of ${listed({ values: choices })}`;
|
|
1023
|
-
}
|
|
1024
|
-
return void 0;
|
|
1025
|
-
};
|
|
1026
|
-
var settledClauseSettings = (request) => {
|
|
1027
|
-
const defaults = defaultClauseSettings(request);
|
|
1028
|
-
if (request.given === void 0) return { outcome: "ok", value: defaults };
|
|
1029
|
-
if (Object.keys(request.declarations).length === 0) return refusal({ address: request.address, detail: "its piece takes no settings" });
|
|
1030
|
-
const detail = Object.entries(request.given).map(
|
|
1031
|
-
([key, settingValue]) => settingRefusalOf({
|
|
1032
|
-
given: { key, value: settingValue },
|
|
1033
|
-
declaration: Object.hasOwn(request.declarations, key) ? request.declarations[key] : void 0,
|
|
1034
|
-
declarations: request.declarations
|
|
1035
|
-
})
|
|
1036
|
-
).find((found) => found !== void 0);
|
|
1037
|
-
if (detail !== void 0) return refusal({ address: request.address, detail });
|
|
1038
|
-
return { outcome: "ok", value: { ...defaults, ...request.given } };
|
|
1039
|
-
};
|
|
1040
|
-
|
|
1041
|
-
// core/check/run-check.ts
|
|
1042
|
-
import { z as z8 } from "zod";
|
|
1043
|
-
|
|
1044
|
-
// core/exception-records/paid-debt.ts
|
|
1045
|
-
var PRUNE_DEBT_SUBCOMMAND = "prune-debt";
|
|
1046
|
-
var answeredByAuthorisedLocation = (request) => request.exempted.by.some(
|
|
1047
|
-
(record) => record.kind === "authorised-location" && authorisationStandingOf({ record, baseline: request.baseline }) === "established"
|
|
1048
|
-
) ? "answered" : "still-debt";
|
|
1049
|
-
var nativeFileOf = (request) => {
|
|
1050
|
-
switch (request.exception.kind) {
|
|
1051
|
-
case "command-line-option":
|
|
1052
|
-
return void 0;
|
|
1053
|
-
case "ignore":
|
|
1054
|
-
case "config-override":
|
|
1055
|
-
case "suppression-entry":
|
|
1056
|
-
case "inline-disable":
|
|
1057
|
-
case "inline-rule-config":
|
|
1058
|
-
return request.exception.file;
|
|
1059
|
-
}
|
|
1060
|
-
};
|
|
1061
|
-
var heldPairKeys = (request) => /* @__PURE__ */ new Set([
|
|
1062
|
-
...request.findings.map((finding) => debtPairKey(finding)),
|
|
1063
|
-
...request.exempted.flatMap(
|
|
1064
|
-
(exempted) => answeredByAuthorisedLocation({ exempted, baseline: request.baseline }) === "answered" ? [] : [debtPairKey(exempted.finding)]
|
|
1065
|
-
),
|
|
1066
|
-
...request.nativeExceptions.flatMap((exception) => {
|
|
1067
|
-
const file = nativeFileOf({ exception });
|
|
1068
|
-
return file === void 0 ? [] : [debtPairKey({ clause: exception.clause, file })];
|
|
1069
|
-
})
|
|
1070
|
-
]);
|
|
1071
|
-
var settledCarveOutPairs = (request) => {
|
|
1072
|
-
const measured = new Set(request.measured.map((pair) => debtPairKey(pair)));
|
|
1073
|
-
return [...request.stale, ...request.forfeited].flatMap(
|
|
1074
|
-
(record) => record.kind === "file-carve-out" && (request.absent.includes(record.file) || measured.has(debtPairKey(record))) ? [{ clause: record.clause, file: record.file }] : []
|
|
1075
|
-
);
|
|
1076
|
-
};
|
|
1077
|
-
var paidDebtOf = (request) => {
|
|
1078
|
-
const held = heldPairKeys(request);
|
|
1079
|
-
return distinctDebtPairs({ pairs: settledCarveOutPairs(request).filter((pair) => !held.has(debtPairKey(pair))) });
|
|
1080
|
-
};
|
|
1081
|
-
|
|
1082
|
-
// core/governance/governance.ts
|
|
1083
|
-
var clauseKey = (request) => clauseAddressText({ address: request.clause });
|
|
1084
|
-
var clauseFileKey = (request) => `${clauseKey({ clause: request.clause })} ${request.file}`;
|
|
1085
|
-
var coverageKeyOf = (request) => {
|
|
1086
|
-
switch (request.record.kind) {
|
|
1087
|
-
case "authorised-location":
|
|
1088
|
-
case "file-carve-out":
|
|
1089
|
-
return clauseFileKey({ clause: request.record.clause, file: request.record.file });
|
|
1090
|
-
case "clause-wide-carve-out":
|
|
1091
|
-
return clauseKey({ clause: request.record.clause });
|
|
1092
|
-
}
|
|
1093
|
-
};
|
|
1094
|
-
var nativeCoverageKeys = (request) => {
|
|
1095
|
-
switch (request.exception.kind) {
|
|
1096
|
-
case "command-line-option":
|
|
1097
|
-
return [];
|
|
1098
|
-
case "inline-disable":
|
|
1099
|
-
return [clauseFileKey({ clause: request.exception.clause, file: request.exception.file })];
|
|
1100
|
-
case "ignore":
|
|
1101
|
-
case "config-override":
|
|
1102
|
-
case "suppression-entry":
|
|
1103
|
-
case "inline-rule-config":
|
|
1104
|
-
return [
|
|
1105
|
-
clauseKey({ clause: request.exception.clause }),
|
|
1106
|
-
clauseFileKey({ clause: request.exception.clause, file: request.exception.file })
|
|
1107
|
-
];
|
|
1108
|
-
}
|
|
1109
|
-
};
|
|
1110
|
-
var forfeitedRecords = (request) => {
|
|
1111
|
-
switch (request.touched.measured) {
|
|
1112
|
-
case "no":
|
|
1113
|
-
case "elsewhere":
|
|
1114
|
-
return [];
|
|
1115
|
-
case "yes": {
|
|
1116
|
-
const touchedPaths = request.touched.paths;
|
|
1117
|
-
return request.records.filter(
|
|
1118
|
-
(record) => record.kind === "file-carve-out" && touchedPaths.has(record.file)
|
|
1119
|
-
);
|
|
1120
|
-
}
|
|
1121
|
-
}
|
|
1122
|
-
};
|
|
1123
|
-
var doublyHeldPairs = (request) => {
|
|
1124
|
-
const carvedKeys = new Set(
|
|
1125
|
-
request.inForce.flatMap(
|
|
1126
|
-
(record) => record.kind === "file-carve-out" ? [coverageKeyOf({ record })] : []
|
|
1127
|
-
)
|
|
1128
|
-
);
|
|
1129
|
-
return request.inForce.flatMap(
|
|
1130
|
-
(record) => record.kind === "authorised-location" && carvedKeys.has(coverageKeyOf({ record })) ? [{ clause: record.clause, file: record.file, mechanism: record.mechanism }] : []
|
|
1131
|
-
);
|
|
1132
|
-
};
|
|
1133
|
-
var recordKeysOf = (request) => new Set(
|
|
1134
|
-
request.records.flatMap(
|
|
1135
|
-
(record) => record.mechanism === request.mechanism ? [coverageKeyOf({ record })] : []
|
|
1136
|
-
)
|
|
1137
|
-
);
|
|
1138
|
-
var coverageKeysIn = (request) => request.run.coverableKinds.includes(request.exception.kind) ? nativeCoverageKeys({ exception: request.exception }) : [];
|
|
1139
|
-
var recordingOf = (request) => coverageKeysIn(request).some((key) => request.recordKeys.has(key)) ? "recorded" : "unrecorded";
|
|
1140
|
-
var unrecordedInRun = (request) => {
|
|
1141
|
-
const recordKeys = recordKeysOf({ records: request.records, mechanism: request.run.mechanism });
|
|
1142
|
-
return request.run.nativeExceptions.flatMap(
|
|
1143
|
-
(exception) => recordingOf({ run: request.run, recordKeys, exception }) === "recorded" ? [] : [{ ...exception, mechanism: request.run.mechanism }]
|
|
1144
|
-
);
|
|
1145
|
-
};
|
|
1146
|
-
var unrecordedExceptions = (request) => request.runs.flatMap((run) => unrecordedInRun({ run, records: request.records }));
|
|
1147
|
-
var exemptingRecords = (request) => {
|
|
1148
|
-
const heldKeys = new Set(request.doublyHeld.map((pair) => clauseFileKey(pair)));
|
|
1149
|
-
return request.inForce.filter(
|
|
1150
|
-
(record) => record.kind === "clause-wide-carve-out" || !heldKeys.has(coverageKeyOf({ record }))
|
|
1151
|
-
);
|
|
1152
|
-
};
|
|
1153
|
-
var judgedFinding = (request) => {
|
|
1154
|
-
const findingKeys = [clauseKey(request.finding), clauseFileKey(request.finding)];
|
|
1155
|
-
return {
|
|
1156
|
-
finding: request.finding,
|
|
1157
|
-
by: request.exempting.filter((record) => findingKeys.includes(coverageKeyOf({ record })))
|
|
1158
|
-
};
|
|
1159
|
-
};
|
|
1160
|
-
var recordsHoldingNative = (request) => request.runs.flatMap((run) => {
|
|
1161
|
-
const coverageKeys = new Set(run.nativeExceptions.flatMap((exception) => coverageKeysIn({ run, exception })));
|
|
1162
|
-
return request.exempting.filter(
|
|
1163
|
-
(record) => record.mechanism === run.mechanism && coverageKeys.has(coverageKeyOf({ record }))
|
|
1164
|
-
);
|
|
1165
|
-
});
|
|
1166
|
-
var governedFindings = (request) => {
|
|
1167
|
-
const credited = /* @__PURE__ */ new Set([
|
|
1168
|
-
...request.judged.flatMap((entry) => entry.by),
|
|
1169
|
-
...recordsHoldingNative({ runs: request.runs, exempting: request.exempting })
|
|
1170
|
-
]);
|
|
1171
|
-
return {
|
|
1172
|
-
findings: request.judged.flatMap((entry) => entry.by.length === 0 ? [entry.finding] : []),
|
|
1173
|
-
exempted: request.judged.filter((entry) => entry.by.length > 0),
|
|
1174
|
-
stale: request.exempting.filter((record) => !credited.has(record))
|
|
1175
|
-
};
|
|
1176
|
-
};
|
|
1177
|
-
var applyGovernance = (request) => {
|
|
1178
|
-
const forfeited = forfeitedRecords({ records: request.records, touched: request.touched });
|
|
1179
|
-
const inForce = request.records.filter((record) => !forfeited.includes(record));
|
|
1180
|
-
const doublyHeld = doublyHeldPairs({ inForce });
|
|
1181
|
-
const exempting = exemptingRecords({ inForce, doublyHeld });
|
|
1182
|
-
const judged = request.findings.map((finding) => judgedFinding({ finding, exempting }));
|
|
1183
|
-
return {
|
|
1184
|
-
...governedFindings({ judged, exempting, runs: request.runs }),
|
|
1185
|
-
forfeited,
|
|
1186
|
-
doublyHeld,
|
|
1187
|
-
unrecorded: unrecordedExceptions({ runs: request.runs, records: inForce })
|
|
1188
|
-
};
|
|
1189
|
-
};
|
|
1190
|
-
|
|
1191
|
-
// core/mechanism-port/runner-module-schema.ts
|
|
1192
|
-
import { z as z4 } from "zod";
|
|
1193
|
-
var runnerCallSchema = z4.function({
|
|
1194
|
-
input: [z4.unknown()],
|
|
1195
|
-
output: z4.promise(z4.unknown())
|
|
1196
|
-
});
|
|
1197
|
-
var standaloneRunnerModuleSchema = z4.object({
|
|
1198
|
-
exceptionPath: z4.literal("standalone"),
|
|
1199
|
-
run: runnerCallSchema,
|
|
1200
|
-
conform: runnerCallSchema
|
|
1201
|
-
});
|
|
1202
|
-
var embeddedRunnerModuleSchema = z4.object({
|
|
1203
|
-
exceptionPath: z4.literal("embedded"),
|
|
1204
|
-
projectedKinds: z4.array(nativeExceptionKindSchema),
|
|
1205
|
-
run: runnerCallSchema,
|
|
1206
|
-
conform: runnerCallSchema,
|
|
1207
|
-
project: runnerCallSchema
|
|
1208
|
-
});
|
|
1209
|
-
var runnerModuleSchema = z4.discriminatedUnion("exceptionPath", [
|
|
1210
|
-
standaloneRunnerModuleSchema,
|
|
1211
|
-
embeddedRunnerModuleSchema
|
|
1212
|
-
]);
|
|
1213
|
-
|
|
1214
|
-
// core/values/assessment-file.ts
|
|
1215
|
-
var ASSESSMENT_FILE_NAME = "disciplines.assessment.md";
|
|
1216
|
-
var assessmentSectionHeading = (request) => `## ${clauseAddressText({ address: request.clause })}`;
|
|
1217
|
-
|
|
1218
|
-
// core/check/clause-readings.ts
|
|
1219
|
-
var BYTE_ORDER_MARK = /^\uFEFF/u;
|
|
1220
|
-
var FENCE_OPENING = /^ {0,3}(`{3,}|~{3,})/;
|
|
1221
|
-
var ADOPTING_GUIDE = "ADOPTING.md";
|
|
1222
|
-
var failingClauses = (request) => [
|
|
1223
|
-
...new Map(request.findings.map((finding) => [clauseAddressText({ address: finding.clause }), finding.clause])).values()
|
|
1224
|
-
];
|
|
1225
|
-
var closesFence = (request) => request.line.trim().startsWith(request.fence) && request.line.trim().replaceAll(request.fence.charAt(0), "") === "" ? "closes" : "stays-open";
|
|
1226
|
-
var scannedLine = (scan, line) => {
|
|
1227
|
-
if (scan.fence !== void 0) {
|
|
1228
|
-
return closesFence({ fence: scan.fence, line }) === "closes" ? { ...scan, fence: void 0 } : scan;
|
|
1229
|
-
}
|
|
1230
|
-
const opening = FENCE_OPENING.exec(line)?.[1];
|
|
1231
|
-
return opening === void 0 ? { ...scan, headings: [...scan.headings, line.trimEnd()] } : { ...scan, fence: opening };
|
|
1232
|
-
};
|
|
1233
|
-
var headingLinesOf = (request) => new Set(
|
|
1234
|
-
request.text.replace(BYTE_ORDER_MARK, "").split("\n").reduce(scannedLine, { fence: void 0, headings: [] }).headings
|
|
1235
|
-
);
|
|
1236
|
-
var assessmentHeadingsOf = (request) => {
|
|
1237
|
-
const assessmentPath = request.path.join({ segments: [request.repoRoot, ASSESSMENT_FILE_NAME] });
|
|
1238
|
-
if (request.fileText.exists({ path: assessmentPath }) === "absent") {
|
|
1239
|
-
return { file: "not-written" };
|
|
1240
|
-
}
|
|
1241
|
-
const text = request.fileText.read({ path: assessmentPath });
|
|
1242
|
-
if (text.outcome === "failed") {
|
|
1243
|
-
return { file: "unreadable" };
|
|
1244
|
-
}
|
|
1245
|
-
return { file: "read", headings: headingLinesOf({ text: text.value }) };
|
|
1246
|
-
};
|
|
1247
|
-
var assessmentSectionOf = (request) => {
|
|
1248
|
-
if (request.headings.file !== "read") {
|
|
1249
|
-
return "unread";
|
|
1250
|
-
}
|
|
1251
|
-
return request.headings.headings.has(assessmentSectionHeading(request)) ? "present" : "not-assessed";
|
|
1252
|
-
};
|
|
1253
|
-
var shownPageOf = (request) => shownPathOf({ path: request.path, repoRoot: request.repoRoot, link: request.link, target: request.page });
|
|
1254
|
-
var clauseReadingOf = (request) => ({
|
|
1255
|
-
kind: "clause",
|
|
1256
|
-
clause: request.clause,
|
|
1257
|
-
assessmentSection: assessmentSectionOf(request),
|
|
1258
|
-
rulePage: { path: shownPageOf(request), presence: request.fileText.exists({ path: request.page }) }
|
|
1259
|
-
});
|
|
1260
|
-
var rulePageOf = (request) => request.path.join({ segments: [request.root.ruleSetRoot, "rules", request.root.clause.discipline, "README.md"] });
|
|
1261
|
-
var assessmentFileNotes = (request) => request.headings.file === "read" ? [] : [
|
|
1262
|
-
{
|
|
1263
|
-
kind: "assessment-file",
|
|
1264
|
-
state: request.headings.file,
|
|
1265
|
-
guide: shownPageOf({ ...request, page: request.path.join({ segments: [request.installRoot, ADOPTING_GUIDE] }) })
|
|
1266
|
-
}
|
|
1267
|
-
];
|
|
1268
|
-
var clauseReadingsOf = (request) => {
|
|
1269
|
-
const clauses = failingClauses(request);
|
|
1270
|
-
if (clauses.length === 0) {
|
|
1271
|
-
return [];
|
|
1272
|
-
}
|
|
1273
|
-
const headings = assessmentHeadingsOf(request);
|
|
1274
|
-
const link = packageLinkOf(request);
|
|
1275
|
-
return [
|
|
1276
|
-
...assessmentFileNotes({ ...request, headings, link }),
|
|
1277
|
-
...clauses.flatMap(
|
|
1278
|
-
(clause) => request.clauseRoots.filter((root) => clauseAddressText({ address: root.clause }) === clauseAddressText({ address: clause })).map((root) => clauseReadingOf({ ...request, headings, link, clause, page: rulePageOf({ root, path: request.path }) }))
|
|
1279
|
-
)
|
|
1280
|
-
];
|
|
1281
|
-
};
|
|
1282
|
-
|
|
1283
|
-
// core/touched-set/touched-set.ts
|
|
1284
|
-
var firstLineOf = (request) => request.failure.detail.split("\n").map((line) => line.trim()).find((line) => line.length > 0) ?? "";
|
|
1285
|
-
var baseRevisionAvailabilityOf = (request) => ({
|
|
1286
|
-
state: "git-failed",
|
|
1287
|
-
revision: request.revision,
|
|
1288
|
-
gitMessage: firstLineOf({ failure: request.failure })
|
|
1289
|
-
});
|
|
1290
|
-
var computeTouchedSet = (request) => {
|
|
1291
|
-
if (request.baseRevision === void 0) {
|
|
1292
|
-
return { measured: "no", base: { state: "not-given" } };
|
|
1293
|
-
}
|
|
1294
|
-
const changed = request.git.changedSince({
|
|
1295
|
-
repoRoot: request.repoRoot,
|
|
1296
|
-
baseRevision: request.baseRevision
|
|
1297
|
-
});
|
|
1298
|
-
if (changed.outcome === "failed") {
|
|
1299
|
-
return { measured: "no", base: baseRevisionAvailabilityOf({ revision: request.baseRevision, failure: changed.error }) };
|
|
1300
|
-
}
|
|
1301
|
-
return { measured: "yes", paths: new Set(changed.value) };
|
|
1302
|
-
};
|
|
1303
|
-
|
|
1304
|
-
// core/check/measurement.ts
|
|
1305
|
-
var forfeitureUnmeasured = (request) => request.touched.measured === "no" && request.records.some((record) => record.kind === "file-carve-out") ? [{ kind: "forfeiture-unmeasured", base: request.touched.base }] : [];
|
|
1306
|
-
var fileCarveOutsIn = (request) => request.records.filter((record) => record.kind === "file-carve-out").length;
|
|
1307
|
-
var changeSetNeedOf = (request) => {
|
|
1308
|
-
if (request.assessment.forfeiture === "elsewhere") {
|
|
1309
|
-
return { kind: "settled", touched: { measured: "elsewhere" } };
|
|
1310
|
-
}
|
|
1311
|
-
return fileCarveOutsIn(request) > 0 ? { kind: "measure-since-base" } : { kind: "settled", touched: { measured: "yes", paths: /* @__PURE__ */ new Set() } };
|
|
1312
|
-
};
|
|
1313
|
-
var touchedSetFor = (request) => {
|
|
1314
|
-
const need = changeSetNeedOf({ assessment: request.check.assessment, records: request.records });
|
|
1315
|
-
return need.kind === "settled" ? need.touched : computeTouchedSet(request.check);
|
|
1316
|
-
};
|
|
1317
|
-
var partialAssessmentsOf = (request) => request.assessment.forfeiture === "elsewhere" ? [{ concern: "forfeiture", assessedBy: "elsewhere", fileCarveOuts: fileCarveOutsIn(request) }] : [];
|
|
1318
|
-
var importedRecords = (request) => request.records.some((record) => recordImportOf({ record }).imported === "yes") ? "present" : "absent";
|
|
1319
|
-
var legacyChainRecords = (request) => request.records.some((record) => whyChainFormOf({ chain: record.whyChain }) === "legacy") ? "present" : "absent";
|
|
1320
|
-
var legacyChainUnmeasured = (request) => request.exceptionBaseline.measured === "no" && legacyChainRecords({ records: request.records }) === "present" ? [{ kind: "legacy-chain-unmeasured", base: request.exceptionBaseline.base }] : [];
|
|
1321
|
-
var importUnmeasured = (request) => request.exceptionBaseline.measured === "no" && importedRecords({ records: request.records }) === "present" ? [{ kind: "import-unmeasured", base: request.exceptionBaseline.base }] : [];
|
|
1322
|
-
var unmeasuredOf = (request) => [
|
|
1323
|
-
...forfeitureUnmeasured(request),
|
|
1324
|
-
...importUnmeasured(request),
|
|
1325
|
-
...legacyChainUnmeasured(request)
|
|
1326
|
-
];
|
|
1327
|
-
var textsInBase = (request) => {
|
|
1328
|
-
const readings = request.files.map((file) => ({
|
|
1329
|
-
file,
|
|
1330
|
-
reading: request.reach.git.textInBase({ repoRoot: request.reach.repoRoot, baseRevision: request.baseRevision, file })
|
|
1331
|
-
}));
|
|
1332
|
-
const failed2 = readings.find(({ reading }) => reading.outcome === "failed");
|
|
1333
|
-
if (failed2 !== void 0 && failed2.reading.outcome === "failed") {
|
|
1334
|
-
return failed2.reading;
|
|
1335
|
-
}
|
|
1336
|
-
return {
|
|
1337
|
-
outcome: "ok",
|
|
1338
|
-
value: new Map(
|
|
1339
|
-
readings.flatMap(
|
|
1340
|
-
({ file, reading }) => reading.outcome === "ok" && reading.value.presence === "present-in-base" ? [[file, reading.value.text]] : []
|
|
1341
|
-
)
|
|
1342
|
-
)
|
|
1343
|
-
};
|
|
1344
|
-
};
|
|
1345
|
-
var baselineNeedOf = (request) => {
|
|
1346
|
-
const { baseRevision } = request;
|
|
1347
|
-
if (baseRevision === void 0 || importedEntriesIn({ entries: request.entries }) === "absent" && legacyChainsIn({ entries: request.entries }) === "absent") {
|
|
1348
|
-
return { kind: "settled", baseline: UNMEASURED_EXCEPTION_BASELINE };
|
|
1349
|
-
}
|
|
1350
|
-
return { kind: "read-at-base", baseRevision, sources: importSourcesOf({ entries: request.entries }) };
|
|
1351
|
-
};
|
|
1352
|
-
var baselineAtBase = (request) => {
|
|
1353
|
-
const { baseRevision } = request;
|
|
1354
|
-
const entriesAtBase = request.reach.exceptionRepository.readAt({ revision: baseRevision });
|
|
1355
|
-
if (entriesAtBase.outcome === "failed") {
|
|
1356
|
-
return { measured: "no", base: baseRevisionAvailabilityOf({ revision: baseRevision, failure: entriesAtBase.error }) };
|
|
1357
|
-
}
|
|
1358
|
-
const texts = textsInBase({ reach: request.reach, baseRevision, files: request.sources });
|
|
1359
|
-
if (texts.outcome === "failed") {
|
|
1360
|
-
return { measured: "no", base: baseRevisionAvailabilityOf({ revision: baseRevision, failure: texts.error }) };
|
|
1361
|
-
}
|
|
1362
|
-
return { measured: "yes", entriesAtBase: entriesAtBase.value, sourceTextsAtBase: texts.value };
|
|
1363
|
-
};
|
|
1364
|
-
var exceptionBaselineOf = (request) => {
|
|
1365
|
-
const need = baselineNeedOf({ baseRevision: request.check.baseRevision, entries: request.entries });
|
|
1366
|
-
return need.kind === "settled" ? need.baseline : baselineAtBase({ reach: request.check, baseRevision: need.baseRevision, sources: need.sources });
|
|
1367
|
-
};
|
|
1368
|
-
|
|
1369
|
-
// core/check/paid-debt-notes.ts
|
|
1370
|
-
var paidMechanismsOf = (request) => new Set(
|
|
1371
|
-
[...request.governed.stale, ...request.governed.forfeited].flatMap(
|
|
1372
|
-
(record) => record.kind === "file-carve-out" && request.paidKeys.has(debtPairKey(record)) ? [record.mechanism] : []
|
|
1373
|
-
)
|
|
1374
|
-
);
|
|
1375
|
-
var paidDebtNotesOf = (request) => {
|
|
1376
|
-
if (request.paid.length === 0) {
|
|
1377
|
-
return [];
|
|
1378
|
-
}
|
|
1379
|
-
const paidMechanisms = paidMechanismsOf({ governed: request.governed, paidKeys: new Set(request.paid.map((pair) => debtPairKey(pair))) });
|
|
1380
|
-
const projections = request.runs.flatMap(
|
|
1381
|
-
(run) => run.projection !== "none" && paidMechanisms.has(run.mechanism) ? [run.mechanism] : []
|
|
1382
|
-
);
|
|
1383
|
-
return [{ kind: "paid-debt", fileCarveOuts: request.paid.length, projections }];
|
|
1384
|
-
};
|
|
1385
|
-
|
|
1386
|
-
// core/check/shown-remedies.ts
|
|
1387
|
-
var ruleFolderOf = (request) => {
|
|
1388
|
-
const clause = clauseAddressText({ address: request.finding.clause });
|
|
1389
|
-
const root = request.clauseRoots.find((candidate) => clauseAddressText({ address: candidate.clause }) === clause);
|
|
1390
|
-
return root === void 0 ? void 0 : request.path.join({ segments: [root.ruleSetRoot, "rules", root.clause.discipline] });
|
|
1391
|
-
};
|
|
1392
|
-
var shownRemedyOf = (request) => {
|
|
1393
|
-
const { remedy, ...located } = request.finding;
|
|
1394
|
-
if (remedy === void 0) {
|
|
1395
|
-
return request.finding;
|
|
1396
|
-
}
|
|
1397
|
-
const ruleFolder = ruleFolderOf(request);
|
|
1398
|
-
if (ruleFolder === void 0) {
|
|
1399
|
-
return located;
|
|
1400
|
-
}
|
|
1401
|
-
const page = shownPathOf({ ...request, target: request.path.join({ segments: [ruleFolder, remedy.page] }) });
|
|
1402
|
-
return { ...located, remedy: { ...remedy, page } };
|
|
1403
|
-
};
|
|
1404
|
-
var shownRemediesOf = (request) => request.findings.map((finding) => shownRemedyOf({ ...request, finding }));
|
|
1405
|
-
|
|
1406
|
-
// core/check/mechanism-dispatch.ts
|
|
1407
|
-
import { z as z7 } from "zod";
|
|
1408
|
-
|
|
1409
|
-
// core/mechanism-port/embedded-run-report-schema.ts
|
|
1410
|
-
import { z as z5 } from "zod";
|
|
1411
|
-
var inlineLineSchema = z5.number().int().min(1);
|
|
1412
|
-
var inlineDisableSchema = z5.object({
|
|
1413
|
-
kind: z5.literal("inline-disable"),
|
|
1414
|
-
clause: clauseAddressObjectSchema,
|
|
1415
|
-
file: repoPathSchema,
|
|
1416
|
-
line: inlineLineSchema,
|
|
1417
|
-
text: z5.string(),
|
|
1418
|
-
reach: z5.enum(["one-clause", "every-selected-clause"])
|
|
1419
|
-
}).readonly();
|
|
1420
|
-
var scriptOptionCauseSchema = z5.discriminatedUnion("kind", [
|
|
1421
|
-
z5.object({ kind: z5.literal("weakens-run") }).readonly(),
|
|
1422
|
-
z5.object({ kind: z5.literal("after-another-command"), command: z5.string(), invocation: z5.string() }).readonly(),
|
|
1423
|
-
z5.object({ kind: z5.literal("wrapped"), command: z5.string(), wrapper: z5.string() }).readonly(),
|
|
1424
|
-
z5.object({ kind: z5.literal("unreadable"), command: z5.string() }).readonly()
|
|
1425
|
-
]);
|
|
1426
|
-
var nativeExceptionSchema = z5.discriminatedUnion("kind", [
|
|
1427
|
-
z5.object({ kind: z5.literal("ignore"), clause: clauseAddressObjectSchema, file: repoPathSchema }).readonly(),
|
|
1428
|
-
z5.object({
|
|
1429
|
-
kind: z5.literal("config-override"),
|
|
1430
|
-
clause: clauseAddressObjectSchema,
|
|
1431
|
-
file: repoPathSchema
|
|
1432
|
-
}).readonly(),
|
|
1433
|
-
z5.object({
|
|
1434
|
-
kind: z5.literal("suppression-entry"),
|
|
1435
|
-
clause: clauseAddressObjectSchema,
|
|
1436
|
-
file: repoPathSchema,
|
|
1437
|
-
location: repoPathSchema
|
|
1438
|
-
}).readonly(),
|
|
1439
|
-
inlineDisableSchema,
|
|
1440
|
-
z5.object({
|
|
1441
|
-
kind: z5.literal("inline-rule-config"),
|
|
1442
|
-
clause: clauseAddressObjectSchema,
|
|
1443
|
-
file: repoPathSchema,
|
|
1444
|
-
line: inlineLineSchema,
|
|
1445
|
-
text: z5.string()
|
|
1446
|
-
}).readonly(),
|
|
1447
|
-
z5.object({
|
|
1448
|
-
kind: z5.literal("command-line-option"),
|
|
1449
|
-
clause: clauseAddressObjectSchema,
|
|
1450
|
-
location: repoPathSchema,
|
|
1451
|
-
script: z5.string(),
|
|
1452
|
-
option: z5.string(),
|
|
1453
|
-
cause: scriptOptionCauseSchema
|
|
1454
|
-
}).readonly()
|
|
1455
|
-
]);
|
|
1456
|
-
var sliceProblemSchema = z5.object({
|
|
1457
|
-
slice: repoPathSchema,
|
|
1458
|
-
state: z5.enum(["out-of-date", "missing", "not-applied", "unconfigured", "nested-configuration"])
|
|
1459
|
-
}).readonly();
|
|
1460
|
-
var unprojectedFolderSchema = z5.object({
|
|
1461
|
-
folder: repoPathSchema,
|
|
1462
|
-
selectionFolder: repoPathSchema
|
|
1463
|
-
}).readonly();
|
|
1464
|
-
var embeddedRunReportSchema = z5.object({
|
|
1465
|
-
hits: z5.array(hitSchema).readonly(),
|
|
1466
|
-
nativeExceptions: z5.array(nativeExceptionSchema).readonly(),
|
|
1467
|
-
projection: z5.enum(["current", "out-of-date", "missing", "not-included"]),
|
|
1468
|
-
slices: z5.array(sliceProblemSchema).readonly().default([]),
|
|
1469
|
-
unprojectedFolders: z5.array(unprojectedFolderSchema).readonly().default([]),
|
|
1470
|
-
measured: measuredSchema
|
|
1471
|
-
}).readonly();
|
|
1472
|
-
|
|
1473
|
-
// core/mechanism-port/runner-failure.ts
|
|
1474
|
-
var runnerInvalidOutput = (request) => ({
|
|
1475
|
-
outcome: "failed",
|
|
1476
|
-
error: { kind: "runner-invalid-output", detail: request.detail }
|
|
1477
|
-
});
|
|
1478
|
-
var thrownMessage = (request) => request.thrown instanceof Error ? request.thrown.message : String(request.thrown);
|
|
1479
|
-
var rejectedCall = (request) => runnerInvalidOutput({ detail: `the runner call threw or rejected: ${thrownMessage(request)}` });
|
|
1480
|
-
|
|
1481
|
-
// core/mechanism-port/standalone-run-report-schema.ts
|
|
1482
|
-
import { z as z6 } from "zod";
|
|
1483
|
-
var STANDALONE_RUN_SHAPE_MESSAGE = "a standalone run's value is { hits, nativeExceptions }, not a bare list of hits";
|
|
1484
|
-
var standaloneRunReportSchema = z6.object(
|
|
1485
|
-
{
|
|
1486
|
-
hits: z6.array(hitSchema).readonly(),
|
|
1487
|
-
nativeExceptions: z6.array(inlineDisableSchema).readonly(),
|
|
1488
|
-
measured: measuredSchema
|
|
1489
|
-
},
|
|
1490
|
-
{ error: STANDALONE_RUN_SHAPE_MESSAGE }
|
|
1491
|
-
).readonly();
|
|
1492
|
-
|
|
1493
|
-
// core/check/mechanism-dispatch.ts
|
|
1494
|
-
var STANDALONE_COVERABLE_KINDS = ["inline-disable"];
|
|
1495
|
-
var NOTHING_MEASURED = [];
|
|
1496
|
-
var standaloneResultSchema = runnerResultSchema({ value: standaloneRunReportSchema });
|
|
1497
|
-
var unrequestedEntry = (request) => request.entries.find(
|
|
1498
|
-
(entry) => !request.checkedFiles.includes(entry.file) || !request.run.clauses.some(
|
|
1499
|
-
(clause) => sameClauseAddress({ left: clause.address, right: entry.clause }) === "same"
|
|
1500
|
-
)
|
|
1501
|
-
);
|
|
1502
|
-
var firstUnrequestedDetail = (request) => request.groups.flatMap((group) => {
|
|
1503
|
-
const unrequested = unrequestedEntry({ entries: group.entries, run: request.run, checkedFiles: request.checkedFiles });
|
|
1504
|
-
return unrequested === void 0 ? [] : [`${group.noun} names ${clauseAddressText({ address: unrequested.clause })} in ${unrequested.file}, which the request did not hold`];
|
|
1505
|
-
})[0];
|
|
1506
|
-
var okOutcomeSchema = z7.object({ outcome: z7.literal("ok") });
|
|
1507
|
-
var okStandaloneSchema = z7.object({ outcome: z7.literal("ok"), value: standaloneRunReportSchema });
|
|
1508
|
-
var invalidStandaloneDetail = (request) => {
|
|
1509
|
-
if (!okOutcomeSchema.safeParse(request.returned).success) {
|
|
1510
|
-
return z7.prettifyError(request.error);
|
|
1511
|
-
}
|
|
1512
|
-
const report = okStandaloneSchema.safeParse(request.returned);
|
|
1513
|
-
return z7.prettifyError(report.success ? request.error : report.error);
|
|
1514
|
-
};
|
|
1515
|
-
var standaloneRun = (request) => {
|
|
1516
|
-
const parsed = standaloneResultSchema.safeParse(request.returned);
|
|
1517
|
-
if (!parsed.success) {
|
|
1518
|
-
return runnerInvalidOutput({ detail: invalidStandaloneDetail({ returned: request.returned, error: parsed.error }) });
|
|
1519
|
-
}
|
|
1520
|
-
if (parsed.data.outcome === "failed") {
|
|
1521
|
-
return parsed.data;
|
|
1522
|
-
}
|
|
1523
|
-
const report = parsed.data.value;
|
|
1524
|
-
const unrequested = firstUnrequestedDetail({
|
|
1525
|
-
groups: [
|
|
1526
|
-
{ noun: "a hit", entries: report.hits },
|
|
1527
|
-
{ noun: "a native exception", entries: report.nativeExceptions },
|
|
1528
|
-
{ noun: "a measured pair", entries: report.measured ?? NOTHING_MEASURED }
|
|
1529
|
-
],
|
|
1530
|
-
run: request.run,
|
|
1531
|
-
checkedFiles: request.run.trackedPaths
|
|
1532
|
-
});
|
|
1533
|
-
if (unrequested !== void 0) {
|
|
1534
|
-
return runnerInvalidOutput({ detail: unrequested });
|
|
1535
|
-
}
|
|
1536
|
-
return {
|
|
1537
|
-
outcome: "ok",
|
|
1538
|
-
value: {
|
|
1539
|
-
mechanism: request.mechanism,
|
|
1540
|
-
hits: report.hits,
|
|
1541
|
-
nativeExceptions: report.nativeExceptions,
|
|
1542
|
-
coverableKinds: STANDALONE_COVERABLE_KINDS,
|
|
1543
|
-
projection: "none",
|
|
1544
|
-
slices: [],
|
|
1545
|
-
unprojectedFolders: [],
|
|
1546
|
-
measured: report.measured ?? NOTHING_MEASURED
|
|
1547
|
-
}
|
|
1548
|
-
};
|
|
1549
|
-
};
|
|
1550
|
-
var reportResultSchema = runnerResultSchema({ value: embeddedRunReportSchema });
|
|
1551
|
-
var projectionWriteResultSchema = runnerResultSchema({ value: z7.array(projectionWriteSchema).readonly() });
|
|
1552
|
-
var unrequestedNativeException = (request) => request.nativeExceptions.find(
|
|
1553
|
-
(nativeException) => !request.run.clauses.some(
|
|
1554
|
-
(clause) => sameClauseAddress({ left: clause.address, right: nativeException.clause }) === "same"
|
|
1555
|
-
)
|
|
1556
|
-
);
|
|
1557
|
-
var embeddedRun = (request) => {
|
|
1558
|
-
const parsed = reportResultSchema.safeParse(request.returned);
|
|
1559
|
-
if (!parsed.success) {
|
|
1560
|
-
return runnerInvalidOutput({ detail: z7.prettifyError(parsed.error) });
|
|
1561
|
-
}
|
|
1562
|
-
if (parsed.data.outcome === "failed") {
|
|
1563
|
-
return parsed.data;
|
|
1564
|
-
}
|
|
1565
|
-
const report = parsed.data.value;
|
|
1566
|
-
const unrequested = firstUnrequestedDetail({
|
|
1567
|
-
groups: [
|
|
1568
|
-
{ noun: "a hit", entries: report.hits },
|
|
1569
|
-
{ noun: "a measured pair", entries: report.measured ?? NOTHING_MEASURED }
|
|
1570
|
-
],
|
|
1571
|
-
run: request.run,
|
|
1572
|
-
checkedFiles: request.run.files
|
|
1573
|
-
});
|
|
1574
|
-
if (unrequested !== void 0) {
|
|
1575
|
-
return runnerInvalidOutput({ detail: unrequested });
|
|
1576
|
-
}
|
|
1577
|
-
const unrequestedNative = unrequestedNativeException({
|
|
1578
|
-
nativeExceptions: report.nativeExceptions,
|
|
1579
|
-
run: request.run
|
|
1580
|
-
});
|
|
1581
|
-
if (unrequestedNative !== void 0) {
|
|
1582
|
-
return runnerInvalidOutput({
|
|
1583
|
-
detail: `a native exception names ${clauseAddressText({ address: unrequestedNative.clause })}, which the request did not hold`
|
|
1584
|
-
});
|
|
1585
|
-
}
|
|
1586
|
-
return {
|
|
1587
|
-
outcome: "ok",
|
|
1588
|
-
value: {
|
|
1589
|
-
mechanism: request.mechanism,
|
|
1590
|
-
hits: report.hits,
|
|
1591
|
-
nativeExceptions: report.nativeExceptions,
|
|
1592
|
-
coverableKinds: request.projectedKinds,
|
|
1593
|
-
projection: report.projection,
|
|
1594
|
-
slices: report.slices,
|
|
1595
|
-
unprojectedFolders: report.unprojectedFolders,
|
|
1596
|
-
measured: report.measured ?? NOTHING_MEASURED
|
|
1597
|
-
}
|
|
1598
|
-
};
|
|
1599
|
-
};
|
|
1600
|
-
var embeddedProjection = (request) => {
|
|
1601
|
-
const parsed = projectionWriteResultSchema.safeParse(request.returned);
|
|
1602
|
-
if (!parsed.success) {
|
|
1603
|
-
return runnerInvalidOutput({ detail: z7.prettifyError(parsed.error) });
|
|
1604
|
-
}
|
|
1605
|
-
if (parsed.data.outcome === "failed") {
|
|
1606
|
-
return parsed.data;
|
|
1607
|
-
}
|
|
1608
|
-
return parsed.data;
|
|
1609
|
-
};
|
|
1610
|
-
var runMechanism = (request) => {
|
|
1611
|
-
switch (request.runner.exceptionPath) {
|
|
1612
|
-
case "standalone": {
|
|
1613
|
-
const runner = request.runner;
|
|
1614
|
-
return Promise.resolve().then(() => runner.run(request.run)).then(
|
|
1615
|
-
(returned) => standaloneRun({ returned, mechanism: request.mechanism, run: request.run }),
|
|
1616
|
-
(thrown) => rejectedCall({ thrown })
|
|
1617
|
-
);
|
|
1618
|
-
}
|
|
1619
|
-
case "embedded": {
|
|
1620
|
-
const runner = request.runner;
|
|
1621
|
-
return Promise.resolve().then(
|
|
1622
|
-
() => runner.run({ ...request.run, declaredConfigRoots: request.declaredConfigRoots, records: request.records })
|
|
1623
|
-
).then(
|
|
1624
|
-
(returned) => embeddedRun({
|
|
1625
|
-
returned,
|
|
1626
|
-
mechanism: request.mechanism,
|
|
1627
|
-
projectedKinds: runner.projectedKinds,
|
|
1628
|
-
run: request.run
|
|
1629
|
-
}),
|
|
1630
|
-
(thrown) => rejectedCall({ thrown })
|
|
1631
|
-
);
|
|
1632
|
-
}
|
|
1633
|
-
}
|
|
1634
|
-
};
|
|
1635
|
-
var projectMechanism = (request) => {
|
|
1636
|
-
switch (request.runner.exceptionPath) {
|
|
1637
|
-
case "standalone": {
|
|
1638
|
-
return Promise.resolve({ outcome: "ok", value: [] });
|
|
1639
|
-
}
|
|
1640
|
-
case "embedded": {
|
|
1641
|
-
const runner = request.runner;
|
|
1642
|
-
return Promise.resolve().then(() => runner.project(request.request)).then(
|
|
1643
|
-
(returned) => embeddedProjection({ returned }),
|
|
1644
|
-
(thrown) => rejectedCall({ thrown })
|
|
1645
|
-
);
|
|
1646
|
-
}
|
|
1647
|
-
}
|
|
1648
|
-
};
|
|
1649
|
-
|
|
1650
|
-
// core/check/run-check.ts
|
|
1651
|
-
var TYPESCRIPT_FILE = /\.(?:ts|tsx|mts|cts)$/;
|
|
1652
|
-
var runnerExportSchema = z8.object({ runner: runnerModuleSchema });
|
|
1653
|
-
var failed = (error) => ({
|
|
1654
|
-
outcome: "failed",
|
|
1655
|
-
error
|
|
1656
|
-
});
|
|
1657
|
-
var allOk = (request) => {
|
|
1658
|
-
const [firstFailure] = request.results.flatMap(
|
|
1659
|
-
(loadResult) => loadResult.outcome === "failed" ? [loadResult.error] : []
|
|
1660
|
-
);
|
|
1661
|
-
if (firstFailure !== void 0) {
|
|
1662
|
-
return failed(firstFailure);
|
|
1663
|
-
}
|
|
1664
|
-
return {
|
|
1665
|
-
outcome: "ok",
|
|
1666
|
-
value: request.results.flatMap((loadResult) => loadResult.outcome === "ok" ? [loadResult.value] : [])
|
|
1667
|
-
};
|
|
1668
|
-
};
|
|
1669
|
-
var runnerFailed = (request) => request.runnerResult.outcome === "failed" ? failed({ kind: "runner-failed", mechanism: request.mechanism, failure: request.runnerResult.error }) : request.runnerResult;
|
|
1670
|
-
var loadRunner = async (request) => {
|
|
1671
|
-
const loaded = await request.modules.load({
|
|
1672
|
-
path: request.path.join({
|
|
1673
|
-
segments: runnerModuleSegmentsOf({ installRoot: request.installRoot, mechanism: request.mechanism, moduleExtension: request.moduleExtension })
|
|
1674
|
-
})
|
|
1675
|
-
});
|
|
1676
|
-
if (loaded.outcome === "failed") {
|
|
1677
|
-
return failed({ kind: "runner-invalid", mechanism: request.mechanism, detail: loaded.error.detail });
|
|
1678
|
-
}
|
|
1679
|
-
const parsed = runnerExportSchema.safeParse(loaded.value);
|
|
1680
|
-
if (!parsed.success) {
|
|
1681
|
-
return failed({ kind: "runner-invalid", mechanism: request.mechanism, detail: z8.prettifyError(parsed.error) });
|
|
1682
|
-
}
|
|
1683
|
-
return { outcome: "ok", value: parsed.data.runner };
|
|
1684
|
-
};
|
|
1685
|
-
var distinctMechanisms = (request) => [
|
|
1686
|
-
...new Set(request.bindings.map((binding) => binding.mechanism))
|
|
1687
|
-
];
|
|
1688
|
-
var clausesOf = (request) => request.bindings.filter((binding) => binding.mechanism === request.mechanism).map((binding) => binding.clause);
|
|
1689
|
-
var loadedMechanism = (request) => {
|
|
1690
|
-
if (request.runner.outcome === "failed") {
|
|
1691
|
-
return request.runner;
|
|
1692
|
-
}
|
|
1693
|
-
return {
|
|
1694
|
-
outcome: "ok",
|
|
1695
|
-
value: { mechanism: request.mechanism, runner: request.runner.value, clauses: clausesOf(request) }
|
|
1696
|
-
};
|
|
1697
|
-
};
|
|
1698
|
-
var loadMechanisms = async (request) => allOk({
|
|
1699
|
-
results: await Promise.all(
|
|
1700
|
-
distinctMechanisms(request).map(
|
|
1701
|
-
(mechanism) => loadRunner({ ...request, mechanism }).then(
|
|
1702
|
-
(runner) => loadedMechanism({ bindings: request.bindings, mechanism, runner })
|
|
1703
|
-
)
|
|
1704
|
-
)
|
|
1705
|
-
)
|
|
1706
|
-
});
|
|
1707
|
-
var loadInputs = async (request) => {
|
|
1708
|
-
const reading = request.selectionRepository.read({});
|
|
1709
|
-
if (reading.outcome === "failed") {
|
|
1710
|
-
return reading;
|
|
1711
|
-
}
|
|
1712
|
-
const entries = request.exceptionRepository.read();
|
|
1713
|
-
if (entries.outcome === "failed") {
|
|
1714
|
-
return entries;
|
|
1715
|
-
}
|
|
1716
|
-
const exceptionBaseline = request.exceptionBaselineOf({ entries: entries.value.map(({ entry }) => entry) });
|
|
1717
|
-
const parsed = parseExceptionEntries({
|
|
1718
|
-
entries: entries.value,
|
|
1719
|
-
selection: reading.value.selection,
|
|
1720
|
-
baseline: exceptionBaseline,
|
|
1721
|
-
fileExceptionWhyChains: reading.value.fileExceptionWhyChains
|
|
1722
|
-
});
|
|
1723
|
-
const mechanisms = await loadMechanisms({ ...request, bindings: reading.value.bindings });
|
|
1724
|
-
if (mechanisms.outcome === "failed") {
|
|
1725
|
-
return mechanisms;
|
|
1726
|
-
}
|
|
1727
|
-
return {
|
|
1728
|
-
outcome: "ok",
|
|
1729
|
-
value: {
|
|
1730
|
-
selection: reading.value.selection,
|
|
1731
|
-
clauseRoots: reading.value.clauseRoots,
|
|
1732
|
-
records: parsed.records,
|
|
1733
|
-
invalidRecords: parsed.invalid,
|
|
1734
|
-
mechanisms: mechanisms.value,
|
|
1735
|
-
excluded: reading.value.excluded,
|
|
1736
|
-
eslintConfigRoots: reading.value.eslintConfigRoots,
|
|
1737
|
-
exceptionBaseline
|
|
1738
|
-
}
|
|
1739
|
-
};
|
|
1740
|
-
};
|
|
1741
|
-
var recordsOf = (request) => request.records.filter((record) => record.mechanism === request.mechanism);
|
|
1742
|
-
var projectionOutcome = (request) => {
|
|
1743
|
-
switch (request.run.projection) {
|
|
1744
|
-
case "none":
|
|
1745
|
-
case "current":
|
|
1746
|
-
return { unmeasured: [], problems: [] };
|
|
1747
|
-
case "missing":
|
|
1748
|
-
return { unmeasured: [{ kind: "mechanism-not-run", mechanism: request.run.mechanism, projection: "missing" }], problems: [] };
|
|
1749
|
-
case "not-included":
|
|
1750
|
-
return {
|
|
1751
|
-
unmeasured: [
|
|
1752
|
-
{
|
|
1753
|
-
kind: "mechanism-not-run",
|
|
1754
|
-
mechanism: request.run.mechanism,
|
|
1755
|
-
projection: "not-included",
|
|
1756
|
-
nestedConfigurations: nestedConfigurationsOf(request)
|
|
1757
|
-
}
|
|
1758
|
-
],
|
|
1759
|
-
problems: []
|
|
1760
|
-
};
|
|
1761
|
-
case "out-of-date":
|
|
1762
|
-
return { unmeasured: [], problems: [{ scope: "projection", mechanism: request.run.mechanism, state: request.run.projection }] };
|
|
1763
|
-
}
|
|
1764
|
-
};
|
|
1765
|
-
var NESTED_CONFIGURATION = "nested-configuration";
|
|
1766
|
-
var sliceProblemsOf = (request) => request.run.slices.flatMap(
|
|
1767
|
-
(slice) => slice.state === NESTED_CONFIGURATION ? [] : [{ scope: "slice", mechanism: request.run.mechanism, state: slice.state, slice: slice.slice }]
|
|
1768
|
-
);
|
|
1769
|
-
var nestedConfigurationsOf = (request) => request.run.slices.flatMap((slice) => {
|
|
1770
|
-
if (slice.state !== NESTED_CONFIGURATION) {
|
|
1771
|
-
return [];
|
|
1772
|
-
}
|
|
1773
|
-
const folder = repoPathSchema.safeParse(slice.slice.split("/").slice(0, -1).join("/"));
|
|
1774
|
-
return folder.success ? [folder.data] : [];
|
|
1775
|
-
});
|
|
1776
|
-
var workingTreePaths = (request) => request.tracked.filter(
|
|
1777
|
-
(trackedPath) => request.check.fileText.exists({
|
|
1778
|
-
path: request.check.path.join({ segments: [request.check.repoRoot, trackedPath] })
|
|
1779
|
-
}) === "present"
|
|
1780
|
-
);
|
|
1781
|
-
var exclusion = (request) => request.excluded.some(
|
|
1782
|
-
(excludedPath) => request.trackedPath === excludedPath || request.trackedPath.startsWith(`${excludedPath}/`)
|
|
1783
|
-
) ? "excluded" : "checked";
|
|
1784
|
-
var presentTrackedPaths = (request) => {
|
|
1785
|
-
const tracked = request.check.git.trackedPaths({ repoRoot: request.check.repoRoot });
|
|
1786
|
-
if (tracked.outcome === "failed") {
|
|
1787
|
-
return failed({ kind: "git-failed", detail: `${tracked.error.command}: ${tracked.error.detail}` });
|
|
1788
|
-
}
|
|
1789
|
-
const checked = tracked.value.filter(
|
|
1790
|
-
(trackedPath) => exclusion({ trackedPath, excluded: request.excluded }) === "checked"
|
|
1791
|
-
);
|
|
1792
|
-
return { outcome: "ok", value: workingTreePaths({ check: request.check, tracked: checked }) };
|
|
1793
|
-
};
|
|
1794
|
-
var trackedFolder = (request) => request.tracked.some((trackedPath) => trackedPath.startsWith(`${request.folder}/`)) ? "tracked" : "untracked";
|
|
1795
|
-
var checkedTreeOf = (request) => {
|
|
1796
|
-
const tracked = presentTrackedPaths({ check: request.check, excluded: request.inputs.excluded });
|
|
1797
|
-
if (tracked.outcome === "failed") {
|
|
1798
|
-
return tracked;
|
|
1799
|
-
}
|
|
1800
|
-
const untracked = request.inputs.eslintConfigRoots.find(
|
|
1801
|
-
(folder) => trackedFolder({ folder, tracked: tracked.value }) === "untracked"
|
|
1802
|
-
);
|
|
1803
|
-
return untracked === void 0 ? { outcome: "ok", value: { tracked: tracked.value, declaredConfigRoots: request.inputs.eslintConfigRoots } } : failed({ kind: "config-root-untracked", root: untracked });
|
|
1804
|
-
};
|
|
1805
|
-
var runRequestOf = (request) => ({
|
|
1806
|
-
repoRoot: request.check.repoRoot,
|
|
1807
|
-
installRoot: request.check.installRoot,
|
|
1808
|
-
files: request.tracked.filter((trackedPath) => TYPESCRIPT_FILE.test(trackedPath)),
|
|
1809
|
-
trackedPaths: request.tracked,
|
|
1810
|
-
clauses: request.loaded.clauses
|
|
1811
|
-
});
|
|
1812
|
-
var mechanismRunOf = (request) => runMechanism({
|
|
1813
|
-
runner: request.loaded.runner,
|
|
1814
|
-
mechanism: request.loaded.mechanism,
|
|
1815
|
-
run: runRequestOf(request),
|
|
1816
|
-
declaredConfigRoots: request.declaredConfigRoots,
|
|
1817
|
-
records: recordsOf({ records: request.records, mechanism: request.loaded.mechanism })
|
|
1818
|
-
}).then((runnerResult) => runnerFailed({ mechanism: request.loaded.mechanism, runnerResult }));
|
|
1819
|
-
var mechanismRuns = async (request) => allOk({
|
|
1820
|
-
results: await Promise.all(
|
|
1821
|
-
request.inputs.mechanisms.map(
|
|
1822
|
-
(loaded) => mechanismRunOf({ check: request.check, ...request.tree, records: request.inputs.records, loaded })
|
|
1823
|
-
)
|
|
1824
|
-
)
|
|
1825
|
-
});
|
|
1826
|
-
var findingsOf = (request) => request.runs.flatMap((run) => run.hits.map((hit) => ({ ...hit, mechanism: run.mechanism })));
|
|
1827
|
-
var remediedFindingsOf = (request) => {
|
|
1828
|
-
const findings = findingsOf(request);
|
|
1829
|
-
if (!findings.some((finding) => finding.remedy !== void 0)) {
|
|
1830
|
-
return findings;
|
|
1831
|
-
}
|
|
1832
|
-
const link = packageLinkOf(request.check);
|
|
1833
|
-
return shownRemediesOf({ ...request.check, link, clauseRoots: request.inputs.clauseRoots, findings });
|
|
1834
|
-
};
|
|
1835
|
-
var absentFilesOf = (request) => {
|
|
1836
|
-
const carvedFiles = [...request.governed.stale, ...request.governed.forfeited].flatMap(
|
|
1837
|
-
(record) => record.kind === "file-carve-out" ? [record.file] : []
|
|
1838
|
-
);
|
|
1839
|
-
return [...new Set(carvedFiles)].filter(
|
|
1840
|
-
(file) => request.check.fileText.exists({ path: request.check.path.join({ segments: [request.check.repoRoot, file] }) }) === "absent"
|
|
1841
|
-
);
|
|
1842
|
-
};
|
|
1843
|
-
var checkReportOf = (request) => {
|
|
1844
|
-
const governed = applyGovernance({
|
|
1845
|
-
findings: remediedFindingsOf(request),
|
|
1846
|
-
records: request.inputs.records,
|
|
1847
|
-
touched: request.touched,
|
|
1848
|
-
runs: request.runs
|
|
1849
|
-
});
|
|
1850
|
-
const projections = request.runs.map((run) => projectionOutcome({ run }));
|
|
1851
|
-
const paidDebt = paidDebtOf({
|
|
1852
|
-
...governed,
|
|
1853
|
-
absent: absentFilesOf({ check: request.check, governed }),
|
|
1854
|
-
nativeExceptions: request.runs.flatMap((run) => run.nativeExceptions.map((exception) => ({ ...exception, mechanism: run.mechanism }))),
|
|
1855
|
-
measured: request.runs.flatMap((run) => run.measured),
|
|
1856
|
-
baseline: request.inputs.exceptionBaseline
|
|
1857
|
-
});
|
|
1858
|
-
const report = {
|
|
1859
|
-
excluded: request.inputs.excluded,
|
|
1860
|
-
notAdopted: request.inputs.selection.notAdopted,
|
|
1861
|
-
notRun: request.inputs.selection.notRun,
|
|
1862
|
-
editions: request.inputs.selection.editions,
|
|
1863
|
-
...governed,
|
|
1864
|
-
uncovered: request.inputs.selection.uncovered,
|
|
1865
|
-
invalidRecords: request.inputs.invalidRecords,
|
|
1866
|
-
unmeasured: [
|
|
1867
|
-
...unmeasuredOf({ touched: request.touched, ...request.inputs }),
|
|
1868
|
-
...projections.flatMap((projection) => projection.unmeasured)
|
|
1869
|
-
],
|
|
1870
|
-
projectionProblems: [
|
|
1871
|
-
...projections.flatMap((projection) => projection.problems),
|
|
1872
|
-
...request.runs.flatMap((run) => sliceProblemsOf({ run }))
|
|
1873
|
-
],
|
|
1874
|
-
assessment: partialAssessmentsOf({ assessment: request.assessment, records: request.inputs.records }),
|
|
1875
|
-
readFirst: [
|
|
1876
|
-
...clauseReadingsOf({ ...request.check, findings: governed.findings, clauseRoots: request.inputs.clauseRoots }),
|
|
1877
|
-
...paidDebtNotesOf({ governed, paid: paidDebt, runs: request.runs })
|
|
1878
|
-
]
|
|
1879
|
-
};
|
|
1880
|
-
return { report, paidDebt };
|
|
1881
|
-
};
|
|
1882
|
-
var unprojectedOf = (request) => request.runs.flatMap((run) => run.unprojectedFolders.map((unprojected) => ({ mechanism: run.mechanism, ...unprojected })));
|
|
1883
|
-
var runReachedCheck = async (request) => {
|
|
1884
|
-
const inputs = await loadInputs({
|
|
1885
|
-
...request,
|
|
1886
|
-
exceptionBaselineOf: ({ entries }) => exceptionBaselineOf({ check: request, entries })
|
|
1887
|
-
});
|
|
1888
|
-
if (inputs.outcome === "failed") {
|
|
1889
|
-
return inputs;
|
|
1890
|
-
}
|
|
1891
|
-
const tree = checkedTreeOf({ check: request, inputs: inputs.value });
|
|
1892
|
-
if (tree.outcome === "failed") {
|
|
1893
|
-
return tree;
|
|
1894
|
-
}
|
|
1895
|
-
const runs = await mechanismRuns({ check: request, tree: tree.value, inputs: inputs.value });
|
|
1896
|
-
if (runs.outcome === "failed") {
|
|
1897
|
-
return runs;
|
|
1898
|
-
}
|
|
1899
|
-
return {
|
|
1900
|
-
outcome: "ok",
|
|
1901
|
-
value: {
|
|
1902
|
-
...checkReportOf({
|
|
1903
|
-
check: request,
|
|
1904
|
-
assessment: request.assessment,
|
|
1905
|
-
inputs: inputs.value,
|
|
1906
|
-
runs: runs.value,
|
|
1907
|
-
touched: touchedSetFor({ check: request, records: inputs.value.records })
|
|
1908
|
-
}),
|
|
1909
|
-
unprojected: unprojectedOf({ runs: runs.value })
|
|
1910
|
-
}
|
|
1911
|
-
};
|
|
1912
|
-
};
|
|
1913
|
-
var runCheck = (request) => runReachedCheck(request).then((reached) => reached.outcome === "failed" ? reached : { outcome: "ok", value: reached.value.report });
|
|
1914
|
-
|
|
1915
|
-
export {
|
|
1916
|
-
exceptionEntriesOfDocument,
|
|
1917
|
-
foreignKeysOfDocument,
|
|
1918
|
-
UNMEASURED_EXCEPTION_BASELINE,
|
|
1919
|
-
recordImportOf,
|
|
1920
|
-
exceptionEntriesOfText,
|
|
1921
|
-
debtPairKey,
|
|
1922
|
-
entryPairKey,
|
|
1923
|
-
distinctDebtPairs,
|
|
1924
|
-
PRUNE_DEBT_SUBCOMMAND,
|
|
1925
|
-
ASSESSMENT_FILE_NAME,
|
|
1926
|
-
assessmentSectionHeading,
|
|
1927
|
-
loadFailureDetail,
|
|
1928
|
-
loadFailureText,
|
|
1929
|
-
installRootOf,
|
|
1930
|
-
installRootOfApiEntry,
|
|
1931
|
-
UNLINKED,
|
|
1932
|
-
packageLinkOf,
|
|
1933
|
-
shownPathOf,
|
|
1934
|
-
shownFailureOf,
|
|
1935
|
-
clauseSettingsSchema,
|
|
1936
|
-
defaultClauseSettings,
|
|
1937
|
-
settledClauseSettings,
|
|
1938
|
-
runnerInvalidOutput,
|
|
1939
|
-
rejectedCall,
|
|
1940
|
-
projectMechanism,
|
|
1941
|
-
allOk,
|
|
1942
|
-
runnerFailed,
|
|
1943
|
-
loadRunner,
|
|
1944
|
-
loadInputs,
|
|
1945
|
-
recordsOf,
|
|
1946
|
-
checkedTreeOf,
|
|
1947
|
-
runReachedCheck,
|
|
1948
|
-
runCheck
|
|
1949
|
-
};
|