@hailstails/hone 2.0.0-pre.3 → 2.0.0-pre.5
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 +9 -20
- package/CHANGELOG.md +104 -0
- package/MIGRATING.md +18 -9
- package/README.md +15 -17
- package/chunks/chunk-3CWFUD5B.js +38 -0
- package/chunks/chunk-4AJQHZ7I.js +191 -0
- package/chunks/chunk-5AKHEW6V.js +15 -0
- package/chunks/{chunk-L7BGRC6D.js → chunk-6LTJRJOE.js} +1 -1
- package/chunks/chunk-75XWZYNN.js +64 -0
- package/chunks/{chunk-ASUN4AVC.js → chunk-BISP2JOL.js} +73 -9
- package/chunks/chunk-COQMPHWZ.js +37 -0
- package/chunks/chunk-D6645WPB.js +6 -0
- package/chunks/chunk-DJMF6JIM.js +42 -0
- package/chunks/chunk-EBX57Z3V.js +8 -0
- package/chunks/chunk-EFUWHLZK.js +426 -0
- package/chunks/chunk-FHVNKG5Q.js +19 -0
- package/chunks/{chunk-NRIQD3PI.js → chunk-FRE5IA3C.js} +3 -5
- package/chunks/{chunk-OKLYWD2Z.js → chunk-GMLT3MHO.js} +262 -257
- package/chunks/{chunk-QP5TLOBY.js → chunk-HVZVKZPW.js} +12 -9
- package/chunks/chunk-LEFM7OPS.js +41 -0
- package/chunks/chunk-LNMDMRGQ.js +51 -0
- package/chunks/chunk-M4VSJ27S.js +139 -0
- package/chunks/{chunk-RGSHTPLA.js → chunk-MBEDAFVC.js} +3 -11
- package/chunks/chunk-ND3EOGDK.js +2350 -0
- package/chunks/chunk-ONDBACCR.js +14332 -0
- package/chunks/chunk-OO5KV7KN.js +17 -0
- package/chunks/chunk-SKDQ3QJD.js +75 -0
- package/chunks/chunk-U6W65ZOF.js +86 -0
- package/chunks/chunk-W5OIAUDW.js +18 -0
- package/chunks/{chunk-GNOMK7CR.js → chunk-WPEOCLTP.js} +495 -52
- package/chunks/chunk-X73RZUPO.js +63 -0
- package/chunks/chunk-XE2KKWYH.js +45 -0
- package/chunks/chunk-XNIXPQQ5.js +179 -0
- package/chunks/chunk-YONPKP3C.js +15 -0
- package/docs/adding-a-discipline-or-mechanism.md +1 -1
- package/docs/extending.md +7 -388
- package/methods/lenses/function-first.md +2 -2
- package/package.json +7 -6
- package/rules/README.md +7 -5
- package/rules/SPIRIT.md +1 -1
- package/rules/numbers.md +4 -4
- package/rules/principles/no-leak-across-a-boundary.md +1 -1
- package/rules/principles.md +1 -1
- package/rules/record-kinds/authorised-location.md +1 -1
- package/rules/records.md +11 -19
- package/rules/rules.md +5 -5
- package/rules/sources.md +6 -7
- package/rules/typescript/checks.md +280 -394
- package/rules/typescript/recipes/adapter-per-outside-party.md +10 -5
- package/rules/typescript/recipes/assert-to-narrow.md +114 -4
- package/rules/typescript/recipes/closure-factory.md +5 -5
- package/rules/typescript/recipes/companion-test-file.md +5 -3
- package/rules/typescript/recipes/composed-orchestrator.md +6 -4
- package/rules/typescript/recipes/composition-root.md +5 -3
- package/rules/typescript/recipes/{bounded-context-generic.md → constrained-context-generic.md} +6 -4
- package/rules/typescript/recipes/copy-never-write-in.md +6 -4
- package/rules/typescript/recipes/declared-not-bundled.md +5 -3
- package/rules/typescript/recipes/dependency-record.md +5 -3
- package/rules/typescript/recipes/domain-vocabulary-list.md +5 -3
- package/rules/typescript/recipes/entity-module.md +8 -5
- package/rules/typescript/recipes/exact-pins-and-a-lock-file.md +5 -3
- package/rules/typescript/recipes/extension-outside-the-vendored-code.md +5 -3
- package/rules/typescript/recipes/failure-asserted-as-a-value.md +44 -4
- package/rules/typescript/recipes/failure-mapping-at-the-adapter.md +8 -5
- package/rules/typescript/recipes/fix-the-declaration-not-the-value.md +5 -3
- package/rules/typescript/recipes/functional-iteration.md +8 -3
- package/rules/typescript/recipes/guard-clauses.md +5 -3
- package/rules/typescript/recipes/integration-test-owns-its-scratch.md +5 -3
- package/rules/typescript/recipes/integration-test-suffix.md +5 -3
- package/rules/typescript/recipes/it-each-over-typed-rows.md +117 -0
- package/rules/typescript/recipes/map-out-at-the-adapter.md +36 -4
- package/rules/typescript/recipes/meaning-in-names-not-comments.md +5 -5
- package/rules/typescript/recipes/named-exported-type.md +5 -3
- package/rules/typescript/recipes/narrow-ports.md +5 -3
- package/rules/typescript/recipes/one-argument-object.md +8 -3
- package/rules/typescript/recipes/{port-in-the-domain.md → port-in-a-module-of-its-own.md} +7 -5
- package/rules/typescript/recipes/ports-in-the-argument.md +5 -3
- package/rules/typescript/recipes/repo-scripts-only.md +5 -3
- package/rules/typescript/recipes/result-union.md +5 -5
- package/rules/typescript/recipes/screaming-folders.md +5 -5
- package/rules/typescript/recipes/shared-strict-base-config.md +5 -5
- package/rules/typescript/recipes/stub-with-vi-fn.md +130 -0
- package/rules/typescript/recipes/tagged-union-and-exhaustive-switch.md +5 -3
- package/rules/typescript/recipes/whole-words.md +5 -3
- package/rules/typescript/recipes/whole-written-out-expectation.md +284 -4
- package/rules/typescript/recipes/world-values-through-a-port.md +5 -3
- package/rules/typescript/recipes/zod-at-the-producers-adapter.md +8 -3
- package/rules/typescript/recipes.md +567 -21
- package/rules/typescript/symptoms/ambient-randomness/random-call.md +10 -0
- package/rules/typescript/symptoms/ambient-randomness.md +1 -1
- package/rules/typescript/symptoms/answer-set-in-a-hook/hook-answer.md +10 -0
- package/rules/typescript/symptoms/answer-set-in-a-hook.md +1 -1
- package/rules/typescript/symptoms/assertion-outside-a-test-body/assertion-site.md +10 -0
- package/rules/typescript/symptoms/assertion-outside-a-test-body.md +25 -0
- package/rules/typescript/symptoms/branch-in-a-test/test-body.md +10 -184
- package/rules/typescript/symptoms/branch-in-a-test.md +11 -1
- package/rules/typescript/symptoms/built-unit-called-in-place/call-of-a-call.md +10 -0
- package/rules/typescript/symptoms/built-unit-called-in-place.md +25 -0
- package/rules/typescript/symptoms/claimed-type/non-null-assertions.md +1 -1
- package/rules/typescript/symptoms/code-or-prose-read-as-text-in-a-test/raw-read.md +10 -0
- package/rules/typescript/symptoms/code-or-prose-read-as-text-in-a-test.md +31 -0
- package/rules/typescript/symptoms/computed-value-in-a-test/test-body.md +26 -117
- package/rules/typescript/symptoms/computed-value-in-a-test.md +1 -1
- package/rules/typescript/symptoms/date-used-directly.md +1 -1
- package/rules/typescript/symptoms/default-for-a-required-value.md +1 -1
- package/rules/typescript/symptoms/double-with-a-body/logic-in-a-passed-function.md +2 -19
- package/rules/typescript/symptoms/double-with-a-body/stub-implementation.md +2 -2
- package/rules/typescript/symptoms/double-with-a-body.md +1 -1
- package/rules/typescript/symptoms/export-from-a-test/test-file-export.md +10 -0
- package/rules/typescript/symptoms/export-from-a-test.md +33 -0
- package/rules/typescript/symptoms/failure-shaped-as-success/empty-catch.md +10 -0
- package/rules/typescript/symptoms/failure-shaped-as-success.md +1 -1
- package/rules/typescript/symptoms/floating-version/version-selector.md +10 -0
- package/rules/typescript/symptoms/inherited-environment-in-a-subprocess/git-spawn-environment.md +2 -2
- package/rules/typescript/symptoms/inner-layer-imports-outer.md +1 -1
- package/rules/typescript/symptoms/library-class-built-in-place.md +1 -1
- package/rules/typescript/symptoms/loop-keyword/loop-statement.md +1 -1
- package/rules/typescript/symptoms/many-spellings-of-one-concept/test-call-aliases.md +10 -0
- package/rules/typescript/symptoms/many-spellings-of-one-concept.md +3 -2
- package/rules/typescript/symptoms/module-or-global-patched/module-mock-call.md +4 -4
- package/rules/typescript/symptoms/no-lock-file/committed-lock-file.md +12 -0
- package/rules/typescript/symptoms/outside-import-past-a-boundary/import-or-require.md +1 -0
- package/rules/typescript/symptoms/outside-import-past-a-boundary.md +5 -4
- package/rules/typescript/symptoms/outside-type-in-a-signature.md +2 -2
- package/rules/typescript/symptoms/{port-outside-the-domain.md → port-beside-its-adapter.md} +2 -2
- package/rules/typescript/symptoms/port-named-for-a-mechanism.md +1 -1
- package/rules/typescript/symptoms/process-global-used-in-place/debugger-statement.md +10 -0
- package/rules/typescript/symptoms/process-global-used-in-place/direct-global-use.md +14 -0
- package/rules/typescript/symptoms/process-global-used-in-place.md +2 -2
- package/rules/typescript/symptoms/prose-in-code/comment-prose.md +12 -0
- package/rules/typescript/symptoms/rebinding/test-body.md +1 -18
- package/rules/typescript/symptoms/rebinding.md +11 -1
- package/rules/typescript/symptoms/schema-past-its-adapter.md +2 -2
- package/rules/typescript/symptoms/test-switched-off/skipped-tests.md +3 -6
- package/rules/typescript/symptoms/test-switched-off.md +1 -1
- package/rules/typescript/symptoms/text-past-its-reader/test-body.md +2 -17
- package/rules/typescript/symptoms/text-past-its-reader.md +1 -1
- package/rules/typescript/symptoms/throw-between-our-units/throw-statement.md +10 -0
- package/rules/typescript/symptoms/throw-or-catch-in-a-test/throw-statement.md +1 -1
- package/rules/typescript/symptoms/throw-or-catch-in-a-test/try-block.md +1 -25
- package/rules/typescript/symptoms/tool-fetched-at-run-time/fetch-command.md +10 -0
- package/rules/typescript/symptoms/type-declared-in-a-test/test-type-declaration.md +10 -0
- package/rules/typescript/symptoms/type-declared-in-a-test.md +33 -0
- package/rules/typescript/symptoms/unasserted-call.md +1 -1
- package/rules/typescript/symptoms/unit-without-a-running-test/companion-test-file.md +2 -2
- package/rules/typescript/symptoms/wide-input/unread-parameter.md +10 -0
- package/rules/typescript/symptoms/wide-input.md +3 -2
- package/rules/typescript/symptoms.md +210 -148
- package/src/application/conformance/conformance-testing-types.d.ts +13 -16
- package/src/domain/language-layer/authored-item-types.d.ts +66 -0
- package/src/domain/language-layer/catalogue-name.d.ts +5 -0
- package/src/domain/language-layer/check-address-text.d.ts +12 -0
- package/src/domain/rule-set/authored-rule-set-types.d.ts +31 -32
- package/src/domain/rule-set/clause-address-types.d.ts +4 -3
- package/src/domain/rule-set/rule-set-name-of.d.ts +10 -0
- package/src/domain/runner/check-binding.d.ts +18 -0
- package/src/domain/runner/check-observations.d.ts +39 -0
- package/src/domain/runner/conformance-types.d.ts +8 -2
- package/src/domain/runner/runner-result-types.d.ts +1 -2
- package/src/domain/settings/test-files.d.ts +7 -0
- package/src/eslint-plugin.js +45 -39
- package/src/hone.js +16 -13716
- package/src/infrastructure/disciplines-file/version-one-names.json +4 -5
- package/src/infrastructure/engines/eslint/authored-class-or-this/static-members-only/piece.json +0 -6
- package/src/infrastructure/engines/eslint/long-function/function-length/piece.json +0 -6
- package/src/infrastructure/engines/eslint/runner/pieces/eslint-piece-settings-types.d.ts +2 -0
- package/src/infrastructure/engines/eslint/runner/runner.js +1001 -1234
- package/src/infrastructure/engines/eslint/test-switched-off/focused-tests/README.md +0 -3
- package/src/infrastructure/engines/eslint/test-switched-off/focused-tests/eslint-plugin.js +33 -21
- package/src/infrastructure/engines/eslint/test-switched-off/skipped-tests/piece.json +11 -4
- package/src/infrastructure/engines/eslint/test-switched-off/skipped-tests/skipped-tests.examples.json +28 -0
- package/src/infrastructure/engines/eslint/untyped-value/implicit-any-let/piece.json +0 -2
- package/src/infrastructure/engines/eslint/wide-input/unread-parameter/eslint-plugin.js +94 -0
- package/src/infrastructure/engines/eslint/wide-input/unread-parameter/piece.json +11 -0
- package/src/infrastructure/engines/eslint/wide-input/unread-parameter/unread-parameter.examples.json +48 -0
- package/src/infrastructure/engines/walker/ambient-randomness/random-call/ambient-randomness.js +109 -0
- package/src/infrastructure/engines/walker/ambient-randomness/random-call/piece.json +9 -0
- package/src/infrastructure/engines/walker/ambient-randomness/random-call/random-call.examples.json +48 -0
- package/src/infrastructure/engines/walker/answer-set-in-a-hook/hook-answer/hook-answer.examples.json +42 -0
- package/src/infrastructure/engines/walker/answer-set-in-a-hook/hook-answer/hook-answers.js +72 -0
- package/src/infrastructure/engines/walker/answer-set-in-a-hook/hook-answer/piece.json +9 -0
- package/src/infrastructure/engines/walker/assertion-outside-a-test-body/assertion-site/assertion-site.examples.json +30 -0
- package/src/infrastructure/engines/walker/assertion-outside-a-test-body/assertion-site/assertion-site.js +123 -0
- package/src/infrastructure/engines/walker/assertion-outside-a-test-body/assertion-site/piece.json +9 -0
- package/src/infrastructure/engines/walker/authored-class-or-this/class-keyword/class-syntax.js +3 -3
- package/src/infrastructure/engines/walker/boolean-in-a-signature/boolean-annotation/boolean-signatures.js +7 -5
- package/src/infrastructure/engines/walker/branch-in-a-test/test-body/test-body-logic.js +192 -147
- package/src/infrastructure/engines/walker/built-unit-called-in-place/call-of-a-call/call-of-a-call.examples.json +24 -0
- package/src/infrastructure/engines/walker/built-unit-called-in-place/call-of-a-call/call-of-a-call.js +34 -0
- package/src/infrastructure/engines/walker/built-unit-called-in-place/call-of-a-call/piece.json +9 -0
- package/src/infrastructure/engines/walker/claimed-type/cast-to-any/any-cast.js +6 -4
- package/src/infrastructure/engines/walker/claimed-type/unlisted-cast-site/cast-expressions.js +6 -4
- package/src/infrastructure/engines/walker/code-or-prose-read-as-text-in-a-test/raw-read/piece.json +9 -0
- package/src/infrastructure/engines/walker/code-or-prose-read-as-text-in-a-test/raw-read/raw-read.examples.json +30 -0
- package/src/infrastructure/engines/walker/code-or-prose-read-as-text-in-a-test/raw-read/raw-read.js +166 -0
- package/src/infrastructure/engines/walker/computed-value-in-a-test/test-body/piece.json +0 -10
- package/src/infrastructure/engines/walker/date-used-directly/clock-sources/clock-sources.js +4 -4
- package/src/infrastructure/engines/walker/default-on-a-closed-union/default-arm/switch-defaults.js +8 -6
- package/src/infrastructure/engines/walker/double-with-a-body/logic-in-a-passed-function/piece.json +0 -10
- package/src/infrastructure/engines/walker/double-with-a-body/stub-implementation/dependency-isolation.js +9 -14
- package/src/infrastructure/engines/walker/drawer-path/drawer-names/categorical-paths.js +4 -4
- package/src/infrastructure/engines/walker/export-from-a-test/test-file-export/piece.json +9 -0
- package/src/infrastructure/engines/walker/export-from-a-test/test-file-export/test-file-export.examples.json +30 -0
- package/src/infrastructure/engines/walker/export-from-a-test/test-file-export/test-file-export.js +31 -0
- package/src/infrastructure/engines/walker/failure-shaped-as-success/empty-catch/empty-catch.examples.json +18 -0
- package/src/infrastructure/engines/walker/failure-shaped-as-success/empty-catch/empty-catch.js +32 -0
- package/src/infrastructure/engines/walker/failure-shaped-as-success/empty-catch/piece.json +9 -0
- package/src/infrastructure/engines/walker/floating-version/version-selector/piece.json +9 -0
- package/src/infrastructure/engines/walker/floating-version/version-selector/version-selector.examples.json +54 -0
- package/src/infrastructure/engines/walker/floating-version/version-selector/version-selector.js +75 -0
- package/src/infrastructure/engines/walker/inherited-environment-in-a-subprocess/git-spawn-environment/hermetic-git-spawns.js +8 -17
- package/src/infrastructure/engines/walker/loop-keyword/loop-statement/loops.js +8 -6
- package/src/infrastructure/engines/walker/many-spellings-of-one-concept/test-call-aliases/piece.json +9 -0
- package/src/infrastructure/engines/walker/many-spellings-of-one-concept/test-call-aliases/test-call-aliases.examples.json +36 -0
- package/src/infrastructure/engines/walker/many-spellings-of-one-concept/test-call-aliases/test-call-aliases.js +67 -0
- package/src/infrastructure/engines/walker/module-or-global-patched/module-mock-call/module-mock-call.examples.json +34 -0
- package/src/infrastructure/engines/walker/module-or-global-patched/module-mock-call/module-mocking.js +64 -16
- package/src/infrastructure/engines/walker/module-or-global-patched/module-mock-call/piece.json +5 -1
- package/src/infrastructure/engines/walker/no-lock-file/committed-lock-file/committed-lock-file.examples.json +24 -0
- package/src/infrastructure/engines/walker/no-lock-file/committed-lock-file/committed-lock-file.js +41 -0
- package/src/infrastructure/engines/walker/no-lock-file/committed-lock-file/piece.json +9 -0
- package/src/infrastructure/engines/walker/outside-import-past-a-boundary/import-or-require/import-boundaries.js +18 -16
- package/src/infrastructure/engines/walker/outside-import-past-a-boundary/import-or-require/piece.json +1 -1
- package/src/infrastructure/engines/walker/process-global-used-in-place/debugger-statement/debugger-statement.examples.json +18 -0
- package/src/infrastructure/engines/walker/process-global-used-in-place/debugger-statement/debugger-statement.js +17 -0
- package/src/infrastructure/engines/walker/process-global-used-in-place/debugger-statement/piece.json +9 -0
- package/src/infrastructure/engines/walker/process-global-used-in-place/direct-global-use/direct-global-use.examples.json +63 -0
- package/src/infrastructure/engines/walker/process-global-used-in-place/direct-global-use/piece.json +13 -0
- package/src/infrastructure/engines/walker/process-global-used-in-place/direct-global-use/process-global-used-in-place.js +126 -0
- package/src/infrastructure/engines/walker/prose-in-code/comment-prose/comment-prose.examples.json +42 -0
- package/src/infrastructure/engines/walker/prose-in-code/comment-prose/piece.json +16 -0
- package/src/infrastructure/engines/walker/prose-in-code/comment-prose/prose-in-code.js +90 -0
- package/src/infrastructure/engines/walker/rebinding/test-body/piece.json +0 -10
- package/src/infrastructure/engines/walker/runner/pieces/walker-piece.d.ts +7 -5
- package/src/infrastructure/engines/walker/runner/runner.js +268 -79
- package/src/infrastructure/engines/walker/runner/toolchain/typescript-parse.d.ts +3 -0
- package/src/infrastructure/engines/walker/shorthand-name/identifier-names/identifier-names.js +12 -7
- package/src/infrastructure/engines/walker/strictness-weakened/exact-optional-property-types/piece.json +0 -10
- package/src/infrastructure/engines/walker/strictness-weakened/no-fallthrough-cases-in-switch/piece.json +0 -10
- package/src/infrastructure/engines/walker/strictness-weakened/no-implicit-override/piece.json +0 -10
- package/src/infrastructure/engines/walker/strictness-weakened/no-property-access-from-index-signature/piece.json +0 -10
- package/src/infrastructure/engines/walker/strictness-weakened/no-unchecked-indexed-access/piece.json +0 -10
- package/src/infrastructure/engines/walker/strictness-weakened/strict/compiler-overrides.js +30 -52
- package/src/infrastructure/engines/walker/strictness-weakened/use-unknown-in-catch-variables/piece.json +0 -10
- package/src/infrastructure/engines/walker/text-past-its-reader/test-body/piece.json +0 -10
- package/src/infrastructure/engines/walker/throw-between-our-units/throw-statement/piece.json +9 -0
- package/src/infrastructure/engines/walker/throw-between-our-units/throw-statement/throw-statement.examples.json +36 -0
- package/src/infrastructure/engines/walker/throw-between-our-units/throw-statement/throws-in-production.js +12 -0
- package/src/infrastructure/engines/walker/throw-or-catch-in-a-test/throw-statement/throw-statement.examples.json +6 -6
- package/src/infrastructure/engines/walker/throw-or-catch-in-a-test/throw-statement/throws-in-tests.js +5 -44
- package/src/infrastructure/engines/walker/throw-or-catch-in-a-test/try-block/piece.json +0 -10
- package/src/infrastructure/engines/walker/tool-fetched-at-run-time/fetch-command/fetch-command.examples.json +42 -0
- package/src/infrastructure/engines/walker/tool-fetched-at-run-time/fetch-command/fetch-command.js +152 -0
- package/src/infrastructure/engines/walker/tool-fetched-at-run-time/fetch-command/piece.json +9 -0
- package/src/infrastructure/engines/walker/type-declared-in-a-test/test-type-declaration/piece.json +9 -0
- package/src/infrastructure/engines/walker/type-declared-in-a-test/test-type-declaration/test-type-declaration.examples.json +36 -0
- package/src/infrastructure/engines/walker/type-declared-in-a-test/test-type-declaration/test-type-declaration.js +141 -0
- package/src/infrastructure/engines/walker/type-derived-from-code/factory-return-types/factory-return-types.js +8 -6
- package/src/infrastructure/engines/walker/unit-without-a-running-test/companion-test-file/export-test-sibling.js +16 -10
- package/src/infrastructure/engines/walker/untracked-escape/directive-pointers/comments-directives.js +18 -64
- package/src/infrastructure/engines/walker/write-into-a-parameter/parameter-mutation/parameter-mutation.js +7 -5
- package/src/measure-engines.process.js +80 -0
- package/src/rule-set.d.ts +2 -1
- package/src/testing.d.ts +2 -4
- package/src/testing.js +173 -314
- package/src/{audit.d.ts → walker.d.ts} +13 -8
- package/src/walker.js +28 -0
- package/chunks/chunk-5HRMJ4O2.js +0 -608
- package/chunks/chunk-IX2VZTBO.js +0 -887
- package/chunks/chunk-K2W3D3NB.js +0 -17
- package/chunks/chunk-M6SOGWT7.js +0 -82
- package/chunks/chunk-Q62Y25WS.js +0 -843
- package/chunks/chunk-R75QELTA.js +0 -481
- package/chunks/chunk-RANAKCTW.js +0 -31
- package/chunks/chunk-TNY2PASL.js +0 -38
- package/chunks/chunk-UJONWHA4.js +0 -22
- package/docs/output-contract.md +0 -1155
- package/rules/record-kinds/boundary-record.md +0 -9
- package/rules/typescript/recipes/iteach-over-typed-rows.md +0 -18
- package/rules/typescript/recipes/stub-with-vifn.md +0 -20
- package/src/audit.js +0 -18
- package/src/domain/runner/runner-module-types.d.ts +0 -15
|
@@ -2,38 +2,11 @@ import {
|
|
|
2
2
|
isClauseId,
|
|
3
3
|
isDisciplineId,
|
|
4
4
|
isRuleSetName
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var moduleExtensionOf = (request) => new URL(request.moduleUrl).pathname.endsWith(BUILT_MODULE_EXTENSION) ? BUILT_MODULE_EXTENSION : SOURCE_MODULE_EXTENSION;
|
|
11
|
-
var MODULE_EXTENSIONS = [
|
|
12
|
-
SOURCE_MODULE_EXTENSION,
|
|
13
|
-
BUILT_MODULE_EXTENSION
|
|
14
|
-
];
|
|
15
|
-
var moduleFileForm = (request) => MODULE_EXTENSIONS.some((extension) => request.text.endsWith(extension)) ? "module-file" : "not-module-file";
|
|
16
|
-
|
|
17
|
-
// src/infrastructure/node/modules/install-layout.ts
|
|
18
|
-
var FOLDERS_BETWEEN_INSTALL_ROOT_AND_ENTRY = {
|
|
19
|
-
api: 1,
|
|
20
|
-
command: 1,
|
|
21
|
-
runner: 5
|
|
22
|
-
};
|
|
23
|
-
var installRootAboveEntry = (request) => Array.from({ length: FOLDERS_BETWEEN_INSTALL_ROOT_AND_ENTRY[request.entry] + 1 }).reduce(
|
|
24
|
-
(path) => request.directoryOf(path),
|
|
25
|
-
request.entryFile
|
|
26
|
-
);
|
|
27
|
-
var installFormOf = (request) => request.moduleExtension === BUILT_MODULE_EXTENSION ? "package" : "source";
|
|
28
|
-
var runnerModuleSegmentsOf = (request) => [
|
|
29
|
-
request.installRoot,
|
|
30
|
-
"src",
|
|
31
|
-
"infrastructure",
|
|
32
|
-
"engines",
|
|
33
|
-
request.mechanism,
|
|
34
|
-
"runner",
|
|
35
|
-
`runner${request.moduleExtension}`
|
|
36
|
-
];
|
|
5
|
+
} from "./chunk-OO5KV7KN.js";
|
|
6
|
+
import {
|
|
7
|
+
editionOrder,
|
|
8
|
+
isEdition
|
|
9
|
+
} from "./chunk-RANIXNWY.js";
|
|
37
10
|
|
|
38
11
|
// src/infrastructure/node/file-system/file-system-port.ts
|
|
39
12
|
import {
|
|
@@ -405,6 +378,127 @@ var createPathPort = (options) => portOver({
|
|
|
405
378
|
var defaultWorkingDirectory = () => process.cwd();
|
|
406
379
|
var createDefaultPathPort = (_options) => createPathPort({ flavour: "platform", workingDirectory: defaultWorkingDirectory });
|
|
407
380
|
|
|
381
|
+
// src/domain/rule-set/tool-identity.ts
|
|
382
|
+
var identified = (identity) => identity;
|
|
383
|
+
var TOOL_IDENTITY = identified({
|
|
384
|
+
name: "Hone",
|
|
385
|
+
packageName: "@hailstails/hone",
|
|
386
|
+
command: "hone",
|
|
387
|
+
ownRuleSet: "hone",
|
|
388
|
+
reservedEslintNamespace: "hone-core",
|
|
389
|
+
description: "Checks a repository against the disciplines it selects, applies its recorded exceptions and prints one verdict.",
|
|
390
|
+
repository: "https://github.com/HailsTails/hone",
|
|
391
|
+
unrelatedNpmPackage: "hone"
|
|
392
|
+
});
|
|
393
|
+
|
|
394
|
+
// src/application/ports/host/module-extension.ts
|
|
395
|
+
var BUILT_MODULE_EXTENSION = ".js";
|
|
396
|
+
var SOURCE_MODULE_EXTENSION = ".ts";
|
|
397
|
+
var moduleExtensionOf = (request) => new URL(request.moduleUrl).pathname.endsWith(BUILT_MODULE_EXTENSION) ? BUILT_MODULE_EXTENSION : SOURCE_MODULE_EXTENSION;
|
|
398
|
+
var MODULE_EXTENSIONS = [
|
|
399
|
+
SOURCE_MODULE_EXTENSION,
|
|
400
|
+
BUILT_MODULE_EXTENSION
|
|
401
|
+
];
|
|
402
|
+
var moduleFileForm = (request) => MODULE_EXTENSIONS.some((extension) => request.text.endsWith(extension)) ? "module-file" : "not-module-file";
|
|
403
|
+
|
|
404
|
+
// src/infrastructure/node/modules/install-layout.ts
|
|
405
|
+
var FOLDERS_BETWEEN_INSTALL_ROOT_AND_ENTRY = {
|
|
406
|
+
api: 1,
|
|
407
|
+
command: 1,
|
|
408
|
+
runner: 5
|
|
409
|
+
};
|
|
410
|
+
var installRootAboveEntry = (request) => Array.from({ length: FOLDERS_BETWEEN_INSTALL_ROOT_AND_ENTRY[request.entry] + 1 }).reduce(
|
|
411
|
+
(path) => request.directoryOf(path),
|
|
412
|
+
request.entryFile
|
|
413
|
+
);
|
|
414
|
+
var installFormOf = (request) => request.moduleExtension === BUILT_MODULE_EXTENSION ? "package" : "source";
|
|
415
|
+
var runnerModuleSegmentsOf = (request) => [
|
|
416
|
+
request.installRoot,
|
|
417
|
+
"src",
|
|
418
|
+
"infrastructure",
|
|
419
|
+
"engines",
|
|
420
|
+
request.mechanism,
|
|
421
|
+
"runner",
|
|
422
|
+
`runner${request.moduleExtension}`
|
|
423
|
+
];
|
|
424
|
+
var createMeasurementEntrySegments = (request) => [
|
|
425
|
+
request.installRoot,
|
|
426
|
+
"src",
|
|
427
|
+
`measure-engines.process${request.moduleExtension}`
|
|
428
|
+
];
|
|
429
|
+
|
|
430
|
+
// src/domain/repository/repo-path.ts
|
|
431
|
+
var UNWALKABLE_SEGMENTS = ["", ".", ".."];
|
|
432
|
+
var LEADING_DRIVE_LETTER = /^[A-Za-z]:/;
|
|
433
|
+
var LINE_BREAK_OR_NUL = /[\n\r\0]/;
|
|
434
|
+
var NOT_A_REPO_PATH = "not a repo-relative path";
|
|
435
|
+
var isRepoPathText = (request) => !request.text.startsWith("/") && !LEADING_DRIVE_LETTER.test(request.text) && !request.text.includes("\\") && !LINE_BREAK_OR_NUL.test(request.text) && request.text.split("/").every((segment) => !UNWALKABLE_SEGMENTS.includes(segment)) ? "repo-path" : "not-repo-path";
|
|
436
|
+
var isRepoPath = (text) => isRepoPathText({ text }) === "repo-path";
|
|
437
|
+
|
|
438
|
+
// src/infrastructure/content-files/parsed-json.ts
|
|
439
|
+
var parsedJson = (request) => {
|
|
440
|
+
try {
|
|
441
|
+
const parsed = JSON.parse(request.text);
|
|
442
|
+
return { outcome: "ok", value: parsed };
|
|
443
|
+
} catch (thrown) {
|
|
444
|
+
return {
|
|
445
|
+
outcome: "failed",
|
|
446
|
+
error: thrown instanceof Error ? thrown.message : String(thrown)
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
// src/domain/rule-set/clause-address.ts
|
|
452
|
+
var TOOL_RULE_SET = TOOL_IDENTITY.ownRuleSet;
|
|
453
|
+
var CLAUSE_ADDRESS_TEXT = /^(?:(?<ruleSet>[^/#]+)\/)?(?<discipline>[^/#]+)#(?<clause>[^/#]+)$/;
|
|
454
|
+
var clauseAddressPartsOf = (request) => {
|
|
455
|
+
const parts = CLAUSE_ADDRESS_TEXT.exec(request.text)?.groups;
|
|
456
|
+
const discipline = parts?.discipline;
|
|
457
|
+
const clause = parts?.clause;
|
|
458
|
+
if (discipline === void 0 || clause === void 0) {
|
|
459
|
+
return "not-a-clause-address";
|
|
460
|
+
}
|
|
461
|
+
return {
|
|
462
|
+
ruleSet: parts?.ruleSet === void 0 || parts.ruleSet === TOOL_RULE_SET ? TOOL_RULE_SET : { name: parts.ruleSet },
|
|
463
|
+
discipline,
|
|
464
|
+
clause
|
|
465
|
+
};
|
|
466
|
+
};
|
|
467
|
+
var ruleSetOf = (request) => {
|
|
468
|
+
if (request.ruleSet === TOOL_RULE_SET) {
|
|
469
|
+
return TOOL_RULE_SET;
|
|
470
|
+
}
|
|
471
|
+
return isRuleSetName(request.ruleSet.name) && request.ruleSet.name !== TOOL_RULE_SET ? { name: request.ruleSet.name } : void 0;
|
|
472
|
+
};
|
|
473
|
+
var clauseAddressOf = (request) => {
|
|
474
|
+
const parts = clauseAddressPartsOf(request);
|
|
475
|
+
if (parts === "not-a-clause-address") {
|
|
476
|
+
return parts;
|
|
477
|
+
}
|
|
478
|
+
const ruleSet = ruleSetOf({ ruleSet: parts.ruleSet });
|
|
479
|
+
return ruleSet !== void 0 && isDisciplineId(parts.discipline) && isClauseId(parts.clause) ? { ruleSet, discipline: parts.discipline, clause: parts.clause } : "not-a-clause-address";
|
|
480
|
+
};
|
|
481
|
+
var clauseAddressText = (request) => request.address.ruleSet === TOOL_RULE_SET ? `${request.address.discipline}#${request.address.clause}` : `${request.address.ruleSet.name}/${request.address.discipline}#${request.address.clause}`;
|
|
482
|
+
var sameClauseAddress = (request) => clauseAddressText({ address: request.left }) === clauseAddressText({ address: request.right }) ? "same" : "different";
|
|
483
|
+
|
|
484
|
+
// src/domain/language-layer/catalogue-name.ts
|
|
485
|
+
var CATALOGUE_NAME = "[a-z][a-z0-9]*(?:-[a-z0-9]+)*";
|
|
486
|
+
var WHOLE_CATALOGUE_NAME = new RegExp(`^${CATALOGUE_NAME}$`);
|
|
487
|
+
var isCatalogueName = (text) => WHOLE_CATALOGUE_NAME.test(text);
|
|
488
|
+
|
|
489
|
+
// src/domain/language-layer/check-address-text.ts
|
|
490
|
+
var CHECK_ADDRESS_SEPARATOR = "#";
|
|
491
|
+
var checkNamesOf = (request) => {
|
|
492
|
+
const [symptom, check, trailingSegment] = request.text.split(CHECK_ADDRESS_SEPARATOR);
|
|
493
|
+
return trailingSegment === void 0 && symptom !== void 0 && check !== void 0 && isCatalogueName(symptom) && isCatalogueName(check) ? { symptom, check } : void 0;
|
|
494
|
+
};
|
|
495
|
+
var isCheckAddressText = (text) => checkNamesOf({ text }) !== void 0;
|
|
496
|
+
var checkAddressOfNames = (names) => `${names.symptom}${CHECK_ADDRESS_SEPARATOR}${names.check}`;
|
|
497
|
+
var checkAddressTextOf = (request) => `${request.check.symptom.name}${CHECK_ADDRESS_SEPARATOR}${request.check.name}`;
|
|
498
|
+
|
|
499
|
+
// src/domain/rule-set/engine-id.ts
|
|
500
|
+
var versionOneEngineNameOf = (engine) => engine === "walker" ? "audit" : engine;
|
|
501
|
+
|
|
408
502
|
// src/infrastructure/engines/protocol/toolchain/toolchain-requirement.ts
|
|
409
503
|
import { z as z3 } from "zod";
|
|
410
504
|
var RELEASE_PATTERN = /^(\d+)\.(\d+)\.(\d+)$/;
|
|
@@ -511,6 +605,63 @@ var loadedPeer = (request) => Promise.resolve().then(() => request.location.loca
|
|
|
511
605
|
})
|
|
512
606
|
);
|
|
513
607
|
|
|
608
|
+
// src/infrastructure/content-files/rule-sets/rule-set-reader.ts
|
|
609
|
+
import { z as z7 } from "zod";
|
|
610
|
+
|
|
611
|
+
// src/domain/rule-set/piece-folder.ts
|
|
612
|
+
var INSTALL_ENGINES_SEGMENTS = ["src", "infrastructure", "engines"];
|
|
613
|
+
var enginesFolderSegmentsOf = (request) => request.ruleSetRoot === request.installRoot ? INSTALL_ENGINES_SEGMENTS : ["engines"];
|
|
614
|
+
var versionOneEnginesFolderSegmentsOf = (request) => request.ruleSetRoot === request.installRoot ? INSTALL_ENGINES_SEGMENTS : ["mechanisms"];
|
|
615
|
+
var versionOneEngineFolderOf = (request) => request.ruleSetRoot === request.installRoot ? request.mechanism : versionOneEngineNameOf(request.mechanism);
|
|
616
|
+
var pieceFolderSegmentsOf = (request) => [
|
|
617
|
+
request.ruleSetRoot,
|
|
618
|
+
...versionOneEnginesFolderSegmentsOf(request),
|
|
619
|
+
versionOneEngineFolderOf(request),
|
|
620
|
+
request.discipline
|
|
621
|
+
];
|
|
622
|
+
var namedPieceFolderSegmentsOf = (request) => [
|
|
623
|
+
request.ruleSetRoot,
|
|
624
|
+
...enginesFolderSegmentsOf(request),
|
|
625
|
+
request.mechanism,
|
|
626
|
+
request.symptom,
|
|
627
|
+
request.check
|
|
628
|
+
];
|
|
629
|
+
|
|
630
|
+
// src/domain/settings/clause-settings/reserved-edition-setting.ts
|
|
631
|
+
var RESERVED_EDITION_SETTING = "edition";
|
|
632
|
+
|
|
633
|
+
// src/domain/settings/json-values/json-kind.ts
|
|
634
|
+
var JSON_KIND_NAMES = {
|
|
635
|
+
string: "a string",
|
|
636
|
+
number: "a number",
|
|
637
|
+
boolean: "a boolean",
|
|
638
|
+
null: "null",
|
|
639
|
+
array: "an array",
|
|
640
|
+
object: "an object"
|
|
641
|
+
};
|
|
642
|
+
var jsonKindOf = (request) => {
|
|
643
|
+
if (request.value === null) return "null";
|
|
644
|
+
if (Array.isArray(request.value)) return "array";
|
|
645
|
+
const kind = typeof request.value;
|
|
646
|
+
if (kind === "string" || kind === "number" || kind === "boolean") return kind;
|
|
647
|
+
return "object";
|
|
648
|
+
};
|
|
649
|
+
var isJsonObject = (candidate) => jsonKindOf({ value: candidate }) === "object";
|
|
650
|
+
var sameItems = (request) => request.left.length === request.right.length && request.left.every(
|
|
651
|
+
(leftItem, position) => sameJsonValue({ left: leftItem, right: request.right[position] }) === "same"
|
|
652
|
+
) ? "same" : "different";
|
|
653
|
+
var sameObjects = (request) => Object.keys(request.left).length === Object.keys(request.right).length && Object.entries(request.left).every(
|
|
654
|
+
([key, leftEntry]) => Object.hasOwn(request.right, key) && sameJsonValue({ left: leftEntry, right: request.right[key] }) === "same"
|
|
655
|
+
) ? "same" : "different";
|
|
656
|
+
var sameJsonValue = (request) => {
|
|
657
|
+
const { left, right } = request;
|
|
658
|
+
if (right === void 0 || jsonKindOf({ value: left }) !== jsonKindOf({ value: right }))
|
|
659
|
+
return "different";
|
|
660
|
+
if (Array.isArray(left) && Array.isArray(right)) return sameItems({ left, right });
|
|
661
|
+
if (isJsonObject(left) && isJsonObject(right)) return sameObjects({ left, right });
|
|
662
|
+
return left === right ? "same" : "different";
|
|
663
|
+
};
|
|
664
|
+
|
|
514
665
|
// src/infrastructure/hone-config-file/identifiers.ts
|
|
515
666
|
import { z as z4 } from "zod";
|
|
516
667
|
var NOT_AN_IDENTIFIER = "not an identifier of its kind";
|
|
@@ -519,6 +670,10 @@ var ruleSetNameSchema = brandedTextSchema({
|
|
|
519
670
|
isBranded: isRuleSetName,
|
|
520
671
|
refusal: NOT_AN_IDENTIFIER
|
|
521
672
|
});
|
|
673
|
+
var ruleSetIdentitySchema = z4.union([
|
|
674
|
+
z4.literal(TOOL_RULE_SET),
|
|
675
|
+
z4.strictObject({ name: ruleSetNameSchema.refine((name) => name !== TOOL_RULE_SET) })
|
|
676
|
+
]);
|
|
522
677
|
var disciplineIdSchema = brandedTextSchema({
|
|
523
678
|
text: z4.string(),
|
|
524
679
|
isBranded: isDisciplineId,
|
|
@@ -535,14 +690,6 @@ var versionOneEngineIdSchema = z4.union([
|
|
|
535
690
|
z4.literal("audit").transform(() => "walker")
|
|
536
691
|
]);
|
|
537
692
|
|
|
538
|
-
// src/domain/repository/repo-path.ts
|
|
539
|
-
var UNWALKABLE_SEGMENTS = ["", ".", ".."];
|
|
540
|
-
var LEADING_DRIVE_LETTER = /^[A-Za-z]:/;
|
|
541
|
-
var LINE_BREAK_OR_NUL = /[\n\r\0]/;
|
|
542
|
-
var NOT_A_REPO_PATH = "not a repo-relative path";
|
|
543
|
-
var isRepoPathText = (request) => !request.text.startsWith("/") && !LEADING_DRIVE_LETTER.test(request.text) && !request.text.includes("\\") && !LINE_BREAK_OR_NUL.test(request.text) && request.text.split("/").every((segment) => !UNWALKABLE_SEGMENTS.includes(segment)) ? "repo-path" : "not-repo-path";
|
|
544
|
-
var isRepoPath = (text) => isRepoPathText({ text }) === "repo-path";
|
|
545
|
-
|
|
546
693
|
// src/infrastructure/hone-records-folder/repo-path.ts
|
|
547
694
|
import { z as z5 } from "zod";
|
|
548
695
|
var repoPathTextSchema = z5.string().superRefine((text, context) => {
|
|
@@ -553,23 +700,274 @@ var repoPathTextSchema = z5.string().superRefine((text, context) => {
|
|
|
553
700
|
var brandedRepoPathSchema = (request) => brandedTextSchema({ text: request.text, isBranded: isRepoPath, refusal: NOT_A_REPO_PATH });
|
|
554
701
|
var repoPathSchema = brandedRepoPathSchema({ text: repoPathTextSchema });
|
|
555
702
|
|
|
703
|
+
// src/infrastructure/content-files/edition.ts
|
|
704
|
+
import { z as z6 } from "zod";
|
|
705
|
+
var editionSchema = brandedTextSchema({
|
|
706
|
+
text: z6.string(),
|
|
707
|
+
isBranded: isEdition,
|
|
708
|
+
refusal: "not an edition: a whole number from 1, written as text"
|
|
709
|
+
});
|
|
710
|
+
var FIRST_EDITION = editionSchema.parse("1");
|
|
711
|
+
var clauseEditionsSchema = z6.tuple([editionSchema], editionSchema).default([FIRST_EDITION]).refine((editions) => editionOrder({ editions }) === "ascending", {
|
|
712
|
+
error: "editions must be listed in ascending order, each once"
|
|
713
|
+
}).transform(([first, ...later]) => ({
|
|
714
|
+
declared: [first, ...later],
|
|
715
|
+
default: first,
|
|
716
|
+
latest: later.at(-1) ?? first
|
|
717
|
+
}));
|
|
718
|
+
|
|
719
|
+
// src/infrastructure/content-files/rule-sets/rule-set-reader.ts
|
|
720
|
+
var SUPPORTED_VERSION = 1;
|
|
721
|
+
var readVersionOneJson = (request) => {
|
|
722
|
+
const text = request.fileText.read({ path: request.path });
|
|
723
|
+
if (text.outcome === "failed") {
|
|
724
|
+
return {
|
|
725
|
+
outcome: "failed",
|
|
726
|
+
error: { kind: "file-unreadable", path: request.path, detail: text.error.detail }
|
|
727
|
+
};
|
|
728
|
+
}
|
|
729
|
+
const parsed = parsedJson({ text: text.value });
|
|
730
|
+
if (parsed.outcome === "failed") {
|
|
731
|
+
return {
|
|
732
|
+
outcome: "failed",
|
|
733
|
+
error: { kind: "file-malformed", path: request.path, detail: parsed.error }
|
|
734
|
+
};
|
|
735
|
+
}
|
|
736
|
+
const document = parsed.value;
|
|
737
|
+
if (typeof document === "object" && document !== null && "version" in document && document.version !== SUPPORTED_VERSION) {
|
|
738
|
+
return {
|
|
739
|
+
outcome: "failed",
|
|
740
|
+
error: { kind: "unsupported-version", path: request.path, found: document.version }
|
|
741
|
+
};
|
|
742
|
+
}
|
|
743
|
+
return { outcome: "ok", value: document };
|
|
744
|
+
};
|
|
745
|
+
var entryCount = (entries) => entries.length > 0 ? "some" : "empty";
|
|
746
|
+
var textDistinctness = (texts) => new Set(texts).size === texts.length ? "distinct" : "repeated";
|
|
747
|
+
var sourceCaseSchema = z7.object({
|
|
748
|
+
name: z7.string(),
|
|
749
|
+
fileName: repoPathSchema,
|
|
750
|
+
source: z7.string(),
|
|
751
|
+
expectedLines: z7.array(z7.number()),
|
|
752
|
+
edition: editionSchema.optional()
|
|
753
|
+
});
|
|
754
|
+
var flagCaseSchema = sourceCaseSchema.refine(
|
|
755
|
+
(sourceCase) => entryCount(sourceCase.expectedLines) === "some",
|
|
756
|
+
{ error: "a flag case names no expected line" }
|
|
757
|
+
);
|
|
758
|
+
var allowCaseSchema = sourceCaseSchema.refine(
|
|
759
|
+
(sourceCase) => entryCount(sourceCase.expectedLines) === "empty",
|
|
760
|
+
{ error: "an allow case names expected lines" }
|
|
761
|
+
);
|
|
762
|
+
var anchorKindSchema = z7.discriminatedUnion("kind", [
|
|
763
|
+
z7.object({ kind: z7.literal("keyword"), keyword: z7.string() }),
|
|
764
|
+
z7.object({ kind: z7.literal("file") })
|
|
765
|
+
]);
|
|
766
|
+
var ruleSetMechanismSchema = z7.string().transform((text, context) => {
|
|
767
|
+
const parsed = versionOneEngineIdSchema.safeParse(text);
|
|
768
|
+
if (parsed.success) {
|
|
769
|
+
return parsed.data;
|
|
770
|
+
}
|
|
771
|
+
context.addIssue({
|
|
772
|
+
code: "custom",
|
|
773
|
+
message: `not a mechanism: expected one of ${engineIdSchema.options.join(", ")}`
|
|
774
|
+
});
|
|
775
|
+
return z7.NEVER;
|
|
776
|
+
});
|
|
777
|
+
var clauseCasesSchema = z7.object({
|
|
778
|
+
flag: z7.array(flagCaseSchema).refine((entries) => entryCount(entries) === "some", {
|
|
779
|
+
error: "a mechanical clause has no flag case"
|
|
780
|
+
}),
|
|
781
|
+
allow: z7.array(allowCaseSchema).refine((entries) => entryCount(entries) === "some", {
|
|
782
|
+
error: "a mechanical clause has no allow case"
|
|
783
|
+
})
|
|
784
|
+
});
|
|
785
|
+
var clauseDefinitionSchema = z7.discriminatedUnion("kind", [
|
|
786
|
+
z7.object({
|
|
787
|
+
kind: z7.literal("mechanical"),
|
|
788
|
+
id: clauseIdSchema,
|
|
789
|
+
summary: z7.string(),
|
|
790
|
+
mechanisms: z7.array(ruleSetMechanismSchema).refine((entries) => entryCount(entries) === "some", {
|
|
791
|
+
error: "a mechanical clause names no mechanism"
|
|
792
|
+
}),
|
|
793
|
+
anchor: anchorKindSchema,
|
|
794
|
+
exceptions: z7.enum(["allowed", "refused"]).default("allowed"),
|
|
795
|
+
cases: clauseCasesSchema
|
|
796
|
+
}).transform((clause) => ({
|
|
797
|
+
kind: clause.kind,
|
|
798
|
+
id: clause.id,
|
|
799
|
+
mechanisms: clause.mechanisms,
|
|
800
|
+
anchor: clause.anchor,
|
|
801
|
+
exceptions: clause.exceptions,
|
|
802
|
+
cases: clause.cases
|
|
803
|
+
})),
|
|
804
|
+
z7.object({
|
|
805
|
+
kind: z7.literal("judgement"),
|
|
806
|
+
id: clauseIdSchema,
|
|
807
|
+
summary: z7.string(),
|
|
808
|
+
enforcedBy: z7.literal("review")
|
|
809
|
+
}).transform((clause) => ({ kind: clause.kind, id: clause.id, enforcedBy: clause.enforcedBy }))
|
|
810
|
+
]);
|
|
811
|
+
var disciplineFileSchema = z7.object({
|
|
812
|
+
version: z7.literal(SUPPORTED_VERSION),
|
|
813
|
+
id: disciplineIdSchema,
|
|
814
|
+
clauses: z7.array(clauseDefinitionSchema).refine((clauses) => textDistinctness(clauses.map((clause) => clause.id)) === "distinct", {
|
|
815
|
+
error: "two clauses share an id"
|
|
816
|
+
})
|
|
817
|
+
});
|
|
818
|
+
var clauseSettingDeclarationSchema = z7.strictObject({
|
|
819
|
+
default: z7.json(),
|
|
820
|
+
choices: z7.array(z7.json()).min(1).optional()
|
|
821
|
+
}).superRefine((declaration, context) => {
|
|
822
|
+
if (declaration.choices === void 0) return;
|
|
823
|
+
const defaultKind = jsonKindOf({ value: declaration.default });
|
|
824
|
+
if (declaration.choices.some((choice) => jsonKindOf({ value: choice }) !== defaultKind)) {
|
|
825
|
+
context.addIssue({
|
|
826
|
+
code: "custom",
|
|
827
|
+
path: ["choices"],
|
|
828
|
+
message: `every choice must be ${JSON_KIND_NAMES[defaultKind]}, as the default is`
|
|
829
|
+
});
|
|
830
|
+
}
|
|
831
|
+
if (!declaration.choices.some(
|
|
832
|
+
(choice) => sameJsonValue({ left: choice, right: declaration.default }) === "same"
|
|
833
|
+
)) {
|
|
834
|
+
context.addIssue({
|
|
835
|
+
code: "custom",
|
|
836
|
+
path: ["default"],
|
|
837
|
+
message: "the default must be one of the choices"
|
|
838
|
+
});
|
|
839
|
+
}
|
|
840
|
+
});
|
|
841
|
+
var pieceFileSchema = z7.object({
|
|
842
|
+
version: z7.literal(SUPPORTED_VERSION),
|
|
843
|
+
discipline: disciplineIdSchema,
|
|
844
|
+
mechanism: ruleSetMechanismSchema,
|
|
845
|
+
clauses: z7.array(
|
|
846
|
+
z7.object({
|
|
847
|
+
clause: clauseIdSchema,
|
|
848
|
+
settings: z7.unknown(),
|
|
849
|
+
clauseSettings: z7.record(z7.string().min(1), clauseSettingDeclarationSchema).default({}).refine((declarations) => !Object.hasOwn(declarations, RESERVED_EDITION_SETTING), {
|
|
850
|
+
error: `${RESERVED_EDITION_SETTING} is reserved for the clause's editions; declare them under editions`
|
|
851
|
+
}),
|
|
852
|
+
editions: clauseEditionsSchema
|
|
853
|
+
})
|
|
854
|
+
).refine((entries) => textDistinctness(entries.map((entry) => entry.clause)) === "distinct", {
|
|
855
|
+
error: "two entries name the same clause"
|
|
856
|
+
})
|
|
857
|
+
});
|
|
858
|
+
var isContentRefusal = (issue) => issue.code === "custom";
|
|
859
|
+
var schemaRefusal = (request) => {
|
|
860
|
+
const detail = z7.prettifyError(request.error);
|
|
861
|
+
return request.error.issues.every(isContentRefusal) ? { kind: "rule-set-invalid", path: request.path, detail } : { kind: "file-malformed", path: request.path, detail };
|
|
862
|
+
};
|
|
863
|
+
var ruleSetInvalid = (request) => ({
|
|
864
|
+
outcome: "failed",
|
|
865
|
+
error: { kind: "rule-set-invalid", path: request.path, detail: request.detail }
|
|
866
|
+
});
|
|
867
|
+
var disciplineFilePath = (request) => request.path.join({
|
|
868
|
+
segments: [request.ruleSetRoot, "rules", request.discipline, "discipline.json"]
|
|
869
|
+
});
|
|
870
|
+
var pieceFilePath = (request) => request.path.join({ segments: [...pieceFolderSegmentsOf(request), "piece.json"] });
|
|
871
|
+
var clauseSummariesSchema = z7.object({
|
|
872
|
+
clauses: z7.array(z7.object({ id: clauseIdSchema, summary: z7.string() }))
|
|
873
|
+
});
|
|
874
|
+
var disciplineOfDocument = (request) => {
|
|
875
|
+
const { path } = request;
|
|
876
|
+
const parsed = disciplineFileSchema.safeParse(request.document);
|
|
877
|
+
if (!parsed.success) {
|
|
878
|
+
return { outcome: "failed", error: schemaRefusal({ path, error: parsed.error }) };
|
|
879
|
+
}
|
|
880
|
+
if (parsed.data.id !== request.discipline) {
|
|
881
|
+
return ruleSetInvalid({
|
|
882
|
+
path,
|
|
883
|
+
detail: `id ${parsed.data.id} differs from its folder name ${request.discipline}`
|
|
884
|
+
});
|
|
885
|
+
}
|
|
886
|
+
return { outcome: "ok", value: parsed.data };
|
|
887
|
+
};
|
|
888
|
+
var readSummarisedDisciplineFile = (request) => {
|
|
889
|
+
const document = readVersionOneJson(request);
|
|
890
|
+
if (document.outcome === "failed") {
|
|
891
|
+
return document;
|
|
892
|
+
}
|
|
893
|
+
const file = disciplineOfDocument({ ...request, document: document.value });
|
|
894
|
+
if (file.outcome === "failed") {
|
|
895
|
+
return file;
|
|
896
|
+
}
|
|
897
|
+
const summaries = clauseSummariesSchema.safeParse(document.value);
|
|
898
|
+
return summaries.success ? {
|
|
899
|
+
outcome: "ok",
|
|
900
|
+
value: {
|
|
901
|
+
file: file.value,
|
|
902
|
+
summaries: new Map(summaries.data.clauses.map(({ id, summary }) => [id, summary]))
|
|
903
|
+
}
|
|
904
|
+
} : { outcome: "failed", error: schemaRefusal({ path: request.path, error: summaries.error }) };
|
|
905
|
+
};
|
|
906
|
+
var readDisciplineFile = (request) => {
|
|
907
|
+
const document = readVersionOneJson(request);
|
|
908
|
+
return document.outcome === "failed" ? document : disciplineOfDocument({ ...request, document: document.value });
|
|
909
|
+
};
|
|
910
|
+
var undeclaredCaseEditionOf = (request) => request.piece.clauses.flatMap((entry) => {
|
|
911
|
+
const definition = request.discipline.clauses.find(
|
|
912
|
+
(clause) => clause.id === entry.clause && clause.kind === "mechanical"
|
|
913
|
+
);
|
|
914
|
+
const cases = definition === void 0 ? [] : [...definition.cases.flag, ...definition.cases.allow];
|
|
915
|
+
return cases.flatMap(
|
|
916
|
+
(sourceCase) => sourceCase.edition === void 0 || entry.editions.declared.includes(sourceCase.edition) ? [] : [
|
|
917
|
+
`case ${sourceCase.name} of clause ${entry.clause} runs under edition ${sourceCase.edition}, which this piece does not declare; it declares ${entry.editions.declared.join(", ")}`
|
|
918
|
+
]
|
|
919
|
+
);
|
|
920
|
+
}).at(0);
|
|
921
|
+
var readPieceFile = (request) => {
|
|
922
|
+
const path = pieceFilePath({
|
|
923
|
+
path: request.path,
|
|
924
|
+
ruleSetRoot: request.ruleSetRoot,
|
|
925
|
+
installRoot: request.installRoot,
|
|
926
|
+
mechanism: request.mechanism,
|
|
927
|
+
discipline: request.discipline.id
|
|
928
|
+
});
|
|
929
|
+
const document = readVersionOneJson({ fileText: request.fileText, path });
|
|
930
|
+
if (document.outcome === "failed") {
|
|
931
|
+
return document;
|
|
932
|
+
}
|
|
933
|
+
const parsed = pieceFileSchema.safeParse(document.value);
|
|
934
|
+
if (!parsed.success) {
|
|
935
|
+
return { outcome: "failed", error: schemaRefusal({ path, error: parsed.error }) };
|
|
936
|
+
}
|
|
937
|
+
const piece = parsed.data;
|
|
938
|
+
if (piece.discipline !== request.discipline.id) {
|
|
939
|
+
return ruleSetInvalid({
|
|
940
|
+
path,
|
|
941
|
+
detail: `discipline ${piece.discipline} differs from its folder name ${request.discipline.id}`
|
|
942
|
+
});
|
|
943
|
+
}
|
|
944
|
+
if (piece.mechanism !== request.mechanism) {
|
|
945
|
+
return ruleSetInvalid({
|
|
946
|
+
path,
|
|
947
|
+
detail: `mechanism ${piece.mechanism} differs from its folder name ${request.mechanism}`
|
|
948
|
+
});
|
|
949
|
+
}
|
|
950
|
+
const declared = request.discipline.clauses.map((clause) => clause.id);
|
|
951
|
+
const undeclared = piece.clauses.find((entry) => !declared.includes(entry.clause));
|
|
952
|
+
if (undeclared !== void 0) {
|
|
953
|
+
return ruleSetInvalid({
|
|
954
|
+
path,
|
|
955
|
+
detail: `clause ${undeclared.clause} is not declared by discipline ${request.discipline.id}`
|
|
956
|
+
});
|
|
957
|
+
}
|
|
958
|
+
const unsupported = undeclaredCaseEditionOf({ piece, discipline: request.discipline });
|
|
959
|
+
if (unsupported !== void 0) {
|
|
960
|
+
return ruleSetInvalid({ path, detail: unsupported });
|
|
961
|
+
}
|
|
962
|
+
return { outcome: "ok", value: piece };
|
|
963
|
+
};
|
|
964
|
+
|
|
556
965
|
export {
|
|
557
|
-
brandedTextSchema,
|
|
558
|
-
ruleSetNameSchema,
|
|
559
|
-
disciplineIdSchema,
|
|
560
|
-
clauseIdSchema,
|
|
561
|
-
engineIdSchema,
|
|
562
|
-
versionOneEngineIdSchema,
|
|
563
966
|
isRepoPathText,
|
|
564
967
|
isRepoPath,
|
|
565
968
|
repoPathTextSchema,
|
|
566
969
|
brandedRepoPathSchema,
|
|
567
970
|
repoPathSchema,
|
|
568
|
-
moduleExtensionOf,
|
|
569
|
-
moduleFileForm,
|
|
570
|
-
installRootAboveEntry,
|
|
571
|
-
installFormOf,
|
|
572
|
-
runnerModuleSegmentsOf,
|
|
573
971
|
failureDetailOf,
|
|
574
972
|
createDefaultFileTextPort,
|
|
575
973
|
createDefaultFileRemovalPort,
|
|
@@ -580,9 +978,54 @@ export {
|
|
|
580
978
|
createDefaultModuleLoaderPort,
|
|
581
979
|
isAbsolutePath,
|
|
582
980
|
absolutePathSchema,
|
|
981
|
+
createPathPort,
|
|
583
982
|
createDefaultPathPort,
|
|
983
|
+
TOOL_IDENTITY,
|
|
984
|
+
parsedJson,
|
|
985
|
+
TOOL_RULE_SET,
|
|
986
|
+
clauseAddressPartsOf,
|
|
987
|
+
clauseAddressOf,
|
|
988
|
+
clauseAddressText,
|
|
989
|
+
sameClauseAddress,
|
|
990
|
+
CATALOGUE_NAME,
|
|
991
|
+
isCatalogueName,
|
|
992
|
+
CHECK_ADDRESS_SEPARATOR,
|
|
993
|
+
checkNamesOf,
|
|
994
|
+
isCheckAddressText,
|
|
995
|
+
checkAddressOfNames,
|
|
996
|
+
checkAddressTextOf,
|
|
997
|
+
JSON_KIND_NAMES,
|
|
998
|
+
jsonKindOf,
|
|
999
|
+
sameJsonValue,
|
|
1000
|
+
RESERVED_EDITION_SETTING,
|
|
1001
|
+
moduleExtensionOf,
|
|
1002
|
+
moduleFileForm,
|
|
1003
|
+
installRootAboveEntry,
|
|
1004
|
+
installFormOf,
|
|
1005
|
+
runnerModuleSegmentsOf,
|
|
1006
|
+
createMeasurementEntrySegments,
|
|
1007
|
+
versionOneEngineNameOf,
|
|
584
1008
|
NOT_INSTALLED,
|
|
585
1009
|
gatheredPeerFailure,
|
|
586
1010
|
installedPeer,
|
|
587
|
-
loadedPeer
|
|
1011
|
+
loadedPeer,
|
|
1012
|
+
pieceFolderSegmentsOf,
|
|
1013
|
+
namedPieceFolderSegmentsOf,
|
|
1014
|
+
ruleSetNameSchema,
|
|
1015
|
+
ruleSetIdentitySchema,
|
|
1016
|
+
disciplineIdSchema,
|
|
1017
|
+
clauseIdSchema,
|
|
1018
|
+
engineIdSchema,
|
|
1019
|
+
versionOneEngineIdSchema,
|
|
1020
|
+
editionSchema,
|
|
1021
|
+
readVersionOneJson,
|
|
1022
|
+
sourceCaseSchema,
|
|
1023
|
+
anchorKindSchema,
|
|
1024
|
+
clauseCasesSchema,
|
|
1025
|
+
pieceFileSchema,
|
|
1026
|
+
disciplineFilePath,
|
|
1027
|
+
pieceFilePath,
|
|
1028
|
+
readSummarisedDisciplineFile,
|
|
1029
|
+
readDisciplineFile,
|
|
1030
|
+
readPieceFile
|
|
588
1031
|
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import {
|
|
2
|
+
stringListCheckSettings
|
|
3
|
+
} from "./chunk-W5OIAUDW.js";
|
|
4
|
+
import {
|
|
5
|
+
gatheredOutcomes
|
|
6
|
+
} from "./chunk-YONPKP3C.js";
|
|
7
|
+
|
|
8
|
+
// src/infrastructure/engines/walker/runner/pieces/tracker-patterns.ts
|
|
9
|
+
var NUMBERED_REFERENCE = /\([^()\s]*\d[^()\s]*\)/;
|
|
10
|
+
var TRACKED_REFERENCE_PATTERN = new RegExp(NUMBERED_REFERENCE.source, "g");
|
|
11
|
+
var LEADING_TRACKED_REFERENCE_PATTERN = new RegExp(`^\\s*(${NUMBERED_REFERENCE.source})`);
|
|
12
|
+
var WHOLE_NUMBERED_REFERENCE_PATTERN = new RegExp(`^${NUMBERED_REFERENCE.source}$`);
|
|
13
|
+
var numberedReferenceKind = (text) => WHOLE_NUMBERED_REFERENCE_PATTERN.test(text) ? "numbered" : "other";
|
|
14
|
+
var compiledTracker = (request) => {
|
|
15
|
+
try {
|
|
16
|
+
return { outcome: "ok", value: [new RegExp(request.source)] };
|
|
17
|
+
} catch (thrown) {
|
|
18
|
+
return {
|
|
19
|
+
outcome: "failed",
|
|
20
|
+
error: {
|
|
21
|
+
kind: "piece-invalid",
|
|
22
|
+
pieceRoot: request.binding.pieceRoot,
|
|
23
|
+
detail: `the checkSettings of ${request.binding.address} are malformed: trackerPatterns entry ${JSON.stringify(request.source)} is not a regular expression: ${thrown instanceof Error ? thrown.message : String(thrown)}`
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
var trackedCheckOf = (request) => {
|
|
29
|
+
const settings = stringListCheckSettings({
|
|
30
|
+
binding: request.binding,
|
|
31
|
+
keys: ["trackerPatterns"]
|
|
32
|
+
});
|
|
33
|
+
if (settings.outcome === "failed") return settings;
|
|
34
|
+
const trackers = gatheredOutcomes({
|
|
35
|
+
outcomes: settings.value.trackerPatterns.map(
|
|
36
|
+
(source) => compiledTracker({ binding: request.binding, source })
|
|
37
|
+
)
|
|
38
|
+
});
|
|
39
|
+
if (trackers.outcome === "failed") return trackers;
|
|
40
|
+
return {
|
|
41
|
+
outcome: "ok",
|
|
42
|
+
value: [{ binding: request.binding, trackers: trackers.value }]
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
var trackedChecksOf = (request) => gatheredOutcomes({
|
|
46
|
+
outcomes: request.bindings.map((binding) => trackedCheckOf({ binding }))
|
|
47
|
+
});
|
|
48
|
+
var trackingReference = (request) => request.tracked.trackers.some((tracker) => tracker.test(request.reference)) ? "tracked" : "untracked";
|
|
49
|
+
var trackingAnywhere = (request) => Array.from(request.text.matchAll(TRACKED_REFERENCE_PATTERN), (match) => match[0]).some(
|
|
50
|
+
(reference) => trackingReference({ ...request, reference }) === "tracked"
|
|
51
|
+
) ? "tracked" : "untracked";
|
|
52
|
+
var trackingAtStart = (request) => {
|
|
53
|
+
const reference = LEADING_TRACKED_REFERENCE_PATTERN.exec(request.text)?.[1];
|
|
54
|
+
return reference === void 0 ? "untracked" : trackingReference({ ...request, reference });
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export {
|
|
58
|
+
numberedReferenceKind,
|
|
59
|
+
trackedChecksOf,
|
|
60
|
+
trackingReference,
|
|
61
|
+
trackingAnywhere,
|
|
62
|
+
trackingAtStart
|
|
63
|
+
};
|