@dommaker/harness 2.0.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/README.md +7 -7
- package/dist/agents/index.d.ts +1 -2
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/lifecycle.d.ts +2 -34
- package/dist/agents/lifecycle.d.ts.map +1 -1
- package/dist/agents/lifecycle.js +1 -100
- package/dist/agents/lifecycle.js.map +1 -1
- package/dist/agents/types.d.ts +1 -19
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/{hooks → bootstrap}/bootstrap.d.ts +9 -3
- package/dist/bootstrap/bootstrap.d.ts.map +1 -0
- package/dist/{hooks → bootstrap}/bootstrap.js +26 -30
- package/dist/bootstrap/bootstrap.js.map +1 -0
- package/dist/{hooks → bootstrap}/index.d.ts +3 -2
- package/dist/bootstrap/index.d.ts.map +1 -0
- package/dist/{hooks → bootstrap}/index.js +3 -2
- package/dist/bootstrap/index.js.map +1 -0
- package/dist/cli/commands/acceptance.d.ts.map +1 -1
- package/dist/cli/commands/acceptance.js +1 -1
- package/dist/cli/commands/acceptance.js.map +1 -1
- package/dist/cli/commands/check.d.ts +1 -1
- package/dist/cli/commands/check.d.ts.map +1 -1
- package/dist/cli/commands/check.js +12 -5
- package/dist/cli/commands/check.js.map +1 -1
- package/dist/cli/commands/command.d.ts.map +1 -1
- package/dist/cli/commands/command.js +9 -5
- package/dist/cli/commands/command.js.map +1 -1
- package/dist/cli/commands/constraints-pack-proposal.d.ts.map +1 -1
- package/dist/cli/commands/constraints-pack-proposal.js +11 -8
- package/dist/cli/commands/constraints-pack-proposal.js.map +1 -1
- package/dist/cli/commands/constraints-reactivate.d.ts +10 -2
- package/dist/cli/commands/constraints-reactivate.d.ts.map +1 -1
- package/dist/cli/commands/constraints-reactivate.js +2 -6
- package/dist/cli/commands/constraints-reactivate.js.map +1 -1
- package/dist/cli/commands/constraints-retire.d.ts +23 -5
- package/dist/cli/commands/constraints-retire.d.ts.map +1 -1
- package/dist/cli/commands/constraints-retire.js +17 -8
- package/dist/cli/commands/constraints-retire.js.map +1 -1
- package/dist/cli/commands/contract.d.ts.map +1 -1
- package/dist/cli/commands/contract.js +4 -6
- package/dist/cli/commands/contract.js.map +1 -1
- package/dist/cli/commands/definitions.d.ts +2 -73
- package/dist/cli/commands/definitions.d.ts.map +1 -1
- package/dist/cli/commands/definitions.js +2 -7
- package/dist/cli/commands/definitions.js.map +1 -1
- package/dist/cli/commands/failure.d.ts.map +1 -1
- package/dist/cli/commands/failure.js +5 -6
- package/dist/cli/commands/failure.js.map +1 -1
- package/dist/cli/commands/knowledge/health.d.ts +4 -2
- package/dist/cli/commands/knowledge/health.d.ts.map +1 -1
- package/dist/cli/commands/knowledge/health.js +25 -19
- package/dist/cli/commands/knowledge/health.js.map +1 -1
- package/dist/cli/commands/knowledge/import.d.ts +1 -1
- package/dist/cli/commands/knowledge/import.js +2 -2
- package/dist/cli/commands/knowledge/import.js.map +1 -1
- package/dist/cli/commands/knowledge/search.d.ts.map +1 -1
- package/dist/cli/commands/knowledge/search.js +1 -2
- package/dist/cli/commands/knowledge/search.js.map +1 -1
- package/dist/cli/commands/knowledge/store-access.d.ts +25 -0
- package/dist/cli/commands/knowledge/store-access.d.ts.map +1 -0
- package/dist/cli/commands/knowledge/store-access.js +69 -0
- package/dist/cli/commands/knowledge/store-access.js.map +1 -0
- package/dist/cli/commands/knowledge-view.d.ts +6 -18
- package/dist/cli/commands/knowledge-view.d.ts.map +1 -1
- package/dist/cli/commands/knowledge-view.js +10 -61
- package/dist/cli/commands/knowledge-view.js.map +1 -1
- package/dist/cli/commands/passes-gate.d.ts.map +1 -1
- package/dist/cli/commands/passes-gate.js +7 -6
- package/dist/cli/commands/passes-gate.js.map +1 -1
- package/dist/cli/commands/release.d.ts +1 -1
- package/dist/cli/commands/release.d.ts.map +1 -1
- package/dist/cli/commands/release.js +12 -18
- package/dist/cli/commands/release.js.map +1 -1
- package/dist/cli/commands/review.d.ts.map +1 -1
- package/dist/cli/commands/review.js +15 -4
- package/dist/cli/commands/review.js.map +1 -1
- package/dist/cli/commands/security.d.ts.map +1 -1
- package/dist/cli/commands/security.js +6 -0
- package/dist/cli/commands/security.js.map +1 -1
- package/dist/{core → cli/commands}/spec/validator.d.ts +9 -18
- package/dist/cli/commands/spec/validator.d.ts.map +1 -0
- package/dist/{core → cli/commands}/spec/validator.js +11 -42
- package/dist/cli/commands/spec/validator.js.map +1 -0
- package/dist/cli/commands/spec-baseline-check.d.ts +8 -41
- package/dist/cli/commands/spec-baseline-check.d.ts.map +1 -1
- package/dist/cli/commands/spec-baseline-check.js +31 -238
- package/dist/cli/commands/spec-baseline-check.js.map +1 -1
- package/dist/cli/commands/spec.d.ts +1 -1
- package/dist/cli/commands/spec.d.ts.map +1 -1
- package/dist/cli/commands/spec.js +14 -11
- package/dist/cli/commands/spec.js.map +1 -1
- package/dist/cli/commands/status.d.ts +0 -2
- package/dist/cli/commands/status.d.ts.map +1 -1
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/sync-docs/capabilities-syncer.d.ts +1 -1
- package/dist/cli/commands/sync-docs/capabilities-syncer.d.ts.map +1 -1
- package/dist/cli/commands/sync-docs/capabilities-syncer.js +3 -9
- package/dist/cli/commands/sync-docs/capabilities-syncer.js.map +1 -1
- package/dist/cli/commands/sync-docs/compact.d.ts.map +1 -1
- package/dist/cli/commands/sync-docs/compact.js +15 -15
- package/dist/cli/commands/sync-docs/compact.js.map +1 -1
- package/dist/cli/commands/sync-docs/main-flow.d.ts +7 -23
- package/dist/cli/commands/sync-docs/main-flow.d.ts.map +1 -1
- package/dist/cli/commands/sync-docs/main-flow.js +27 -419
- package/dist/cli/commands/sync-docs/main-flow.js.map +1 -1
- package/dist/cli/commands/sync-docs/project-reader.d.ts.map +1 -1
- package/dist/cli/commands/sync-docs/project-reader.js +2 -1
- package/dist/cli/commands/sync-docs/project-reader.js.map +1 -1
- package/dist/cli/commands/sync-docs/sync-output.d.ts +15 -0
- package/dist/cli/commands/sync-docs/sync-output.d.ts.map +1 -0
- package/dist/cli/commands/sync-docs/sync-output.js +217 -0
- package/dist/cli/commands/sync-docs/sync-output.js.map +1 -0
- package/dist/cli/commands/sync-docs/sync-state.d.ts +71 -0
- package/dist/cli/commands/sync-docs/sync-state.d.ts.map +1 -0
- package/dist/cli/commands/sync-docs/sync-state.js +274 -0
- package/dist/cli/commands/sync-docs/sync-state.js.map +1 -0
- package/dist/cli/commands/sync-docs/sync-writes.d.ts +12 -0
- package/dist/cli/commands/sync-docs/sync-writes.d.ts.map +1 -0
- package/dist/cli/commands/sync-docs/sync-writes.js +72 -0
- package/dist/cli/commands/sync-docs/sync-writes.js.map +1 -0
- package/dist/cli/commands/validate.d.ts +0 -2
- package/dist/cli/commands/validate.d.ts.map +1 -1
- package/dist/cli/commands/validate.js +13 -6
- package/dist/cli/commands/validate.js.map +1 -1
- package/dist/context/index.d.ts +1 -1
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js.map +1 -1
- package/dist/context/session-manager.d.ts +0 -4
- package/dist/context/session-manager.d.ts.map +1 -1
- package/dist/context/session-manager.js +0 -36
- package/dist/context/session-manager.js.map +1 -1
- package/dist/context/types.d.ts +2 -24
- package/dist/context/types.d.ts.map +1 -1
- package/dist/context/types.js +2 -1
- package/dist/context/types.js.map +1 -1
- package/dist/core/app-constraints-loader.d.ts +1 -1
- package/dist/core/app-constraints-loader.d.ts.map +1 -1
- package/dist/core/app-constraints-loader.js +6 -23
- package/dist/core/app-constraints-loader.js.map +1 -1
- package/dist/core/constraint-lifecycle.d.ts +3 -8
- package/dist/core/constraint-lifecycle.d.ts.map +1 -1
- package/dist/core/constraint-lifecycle.js +26 -30
- package/dist/core/constraint-lifecycle.js.map +1 -1
- package/dist/core/constraints/check-cache.d.ts +4 -43
- package/dist/core/constraints/check-cache.d.ts.map +1 -1
- package/dist/core/constraints/check-cache.js +6 -51
- package/dist/core/constraints/check-cache.js.map +1 -1
- package/dist/core/constraints/checker.d.ts +0 -16
- package/dist/core/constraints/checker.d.ts.map +1 -1
- package/dist/core/constraints/checker.js +23 -64
- package/dist/core/constraints/checker.js.map +1 -1
- package/dist/core/constraints/checkers/capability-sync.js +3 -3
- package/dist/core/constraints/checkers/capability-sync.js.map +1 -1
- package/dist/core/constraints/checkers/context-doc-sync.js +2 -2
- package/dist/core/constraints/checkers/context-doc-sync.js.map +1 -1
- package/dist/core/constraints/checkers/docs-freshness.js +5 -5
- package/dist/core/constraints/checkers/docs-freshness.js.map +1 -1
- package/dist/core/constraints/checkers/index.d.ts +17 -3
- package/dist/core/constraints/checkers/index.d.ts.map +1 -1
- package/dist/core/constraints/checkers/index.js +22 -10
- package/dist/core/constraints/checkers/index.js.map +1 -1
- package/dist/core/constraints/checkers/no-hardcoded-credentials.d.ts.map +1 -1
- package/dist/core/constraints/checkers/no-hardcoded-credentials.js +5 -34
- package/dist/core/constraints/checkers/no-hardcoded-credentials.js.map +1 -1
- package/dist/core/constraints/checkers/no-test-simplification.d.ts.map +1 -1
- package/dist/core/constraints/checkers/no-test-simplification.js +11 -33
- package/dist/core/constraints/checkers/no-test-simplification.js.map +1 -1
- package/dist/core/constraints/checkers/templated/exec.d.ts.map +1 -1
- package/dist/core/constraints/checkers/templated/exec.js +3 -8
- package/dist/core/constraints/checkers/templated/exec.js.map +1 -1
- package/dist/core/constraints/checkers/templated/regex-scan.d.ts.map +1 -1
- package/dist/core/constraints/checkers/templated/regex-scan.js +8 -26
- package/dist/core/constraints/checkers/templated/regex-scan.js.map +1 -1
- package/dist/core/constraints/checkers/types.d.ts +10 -33
- package/dist/core/constraints/checkers/types.d.ts.map +1 -1
- package/dist/core/constraints/checkers/types.js +6 -46
- package/dist/core/constraints/checkers/types.js.map +1 -1
- package/dist/core/constraints/context-builder.d.ts +8 -26
- package/dist/core/constraints/context-builder.d.ts.map +1 -1
- package/dist/core/constraints/context-builder.js +9 -81
- package/dist/core/constraints/context-builder.js.map +1 -1
- package/dist/core/constraints/definitions/{iron-laws.d.ts → errors.d.ts} +1 -2
- package/dist/core/constraints/definitions/errors.d.ts.map +1 -0
- package/dist/core/constraints/definitions/{iron-laws.js → errors.js} +1 -5
- package/dist/core/constraints/definitions/errors.js.map +1 -0
- package/dist/core/constraints/definitions/{guidelines.d.ts → warnings.d.ts} +1 -2
- package/dist/core/constraints/definitions/warnings.d.ts.map +1 -0
- package/dist/core/constraints/definitions/{guidelines.js → warnings.js} +1 -6
- package/dist/core/constraints/definitions/warnings.js.map +1 -0
- package/dist/core/constraints/definitions.d.ts +2 -1
- package/dist/core/constraints/definitions.d.ts.map +1 -1
- package/dist/core/constraints/definitions.js +6 -5
- package/dist/core/constraints/definitions.js.map +1 -1
- package/dist/core/constraints/doc-freshness/runner.d.ts +0 -9
- package/dist/core/constraints/doc-freshness/runner.d.ts.map +1 -1
- package/dist/core/constraints/doc-freshness/runner.js +0 -1
- package/dist/core/constraints/doc-freshness/runner.js.map +1 -1
- package/dist/core/constraints/find-constraint.d.ts +14 -0
- package/dist/core/constraints/find-constraint.d.ts.map +1 -0
- package/dist/core/constraints/find-constraint.js +25 -0
- package/dist/core/constraints/find-constraint.js.map +1 -0
- package/dist/core/constraints/governance-accessors.d.ts +54 -0
- package/dist/core/constraints/governance-accessors.d.ts.map +1 -0
- package/dist/core/constraints/governance-accessors.js +62 -0
- package/dist/core/constraints/governance-accessors.js.map +1 -0
- package/dist/core/constraints/index.d.ts +4 -4
- package/dist/core/constraints/index.d.ts.map +1 -1
- package/dist/core/constraints/index.js +1 -4
- package/dist/core/constraints/index.js.map +1 -1
- package/dist/core/constraints/pack-proposal.d.ts.map +1 -1
- package/dist/core/constraints/pack-proposal.js +3 -14
- package/dist/core/constraints/pack-proposal.js.map +1 -1
- package/dist/core/constraints/run-env.d.ts +1 -13
- package/dist/core/constraints/run-env.d.ts.map +1 -1
- package/dist/core/constraints/run-env.js +2 -23
- package/dist/core/constraints/run-env.js.map +1 -1
- package/dist/core/constraints/triggers.d.ts +10 -6
- package/dist/core/constraints/triggers.d.ts.map +1 -1
- package/dist/core/constraints/triggers.js +11 -5
- package/dist/core/constraints/triggers.js.map +1 -1
- package/dist/core/constraints/usage-report.d.ts +0 -6
- package/dist/core/constraints/usage-report.d.ts.map +1 -1
- package/dist/core/constraints/usage-report.js +0 -9
- package/dist/core/constraints/usage-report.js.map +1 -1
- package/dist/core/index.d.ts +5 -4
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +7 -8
- package/dist/core/index.js.map +1 -1
- package/dist/core/project-config-loader.d.ts +5 -43
- package/dist/core/project-config-loader.d.ts.map +1 -1
- package/dist/core/project-config-loader.js +4 -49
- package/dist/core/project-config-loader.js.map +1 -1
- package/dist/core/spec/baseline-check.d.ts +54 -0
- package/dist/core/spec/baseline-check.d.ts.map +1 -0
- package/dist/core/spec/baseline-check.js +261 -0
- package/dist/core/spec/baseline-check.js.map +1 -0
- package/dist/core/validators/check-handlers/file.d.ts.map +1 -1
- package/dist/core/validators/check-handlers/file.js +49 -5
- package/dist/core/validators/check-handlers/file.js.map +1 -1
- package/dist/core/validators/checkpoint.d.ts +5 -13
- package/dist/core/validators/checkpoint.d.ts.map +1 -1
- package/dist/core/validators/checkpoint.js +53 -80
- package/dist/core/validators/checkpoint.js.map +1 -1
- package/dist/core/validators/cso.d.ts +1 -4
- package/dist/core/validators/cso.d.ts.map +1 -1
- package/dist/core/validators/cso.js +1 -9
- package/dist/core/validators/cso.js.map +1 -1
- package/dist/core/validators/passes-gate.d.ts +0 -4
- package/dist/core/validators/passes-gate.d.ts.map +1 -1
- package/dist/core/validators/passes-gate.js +0 -9
- package/dist/core/validators/passes-gate.js.map +1 -1
- package/dist/failure/classifier.d.ts +2 -21
- package/dist/failure/classifier.d.ts.map +1 -1
- package/dist/failure/classifier.js +7 -42
- package/dist/failure/classifier.js.map +1 -1
- package/dist/failure/error-types.d.ts +48 -0
- package/dist/failure/error-types.d.ts.map +1 -0
- package/dist/failure/error-types.js +122 -0
- package/dist/failure/error-types.js.map +1 -0
- package/dist/failure/index.d.ts +4 -3
- package/dist/failure/index.d.ts.map +1 -1
- package/dist/failure/index.js +8 -10
- package/dist/failure/index.js.map +1 -1
- package/dist/failure/recorder.d.ts +7 -27
- package/dist/failure/recorder.d.ts.map +1 -1
- package/dist/failure/recorder.js +11 -64
- package/dist/failure/recorder.js.map +1 -1
- package/dist/gates/acceptance.d.ts +7 -2
- package/dist/gates/acceptance.d.ts.map +1 -1
- package/dist/gates/acceptance.js +30 -36
- package/dist/gates/acceptance.js.map +1 -1
- package/dist/gates/command.d.ts +0 -16
- package/dist/gates/command.d.ts.map +1 -1
- package/dist/gates/command.js +0 -29
- package/dist/gates/command.js.map +1 -1
- package/dist/gates/contract.d.ts +0 -8
- package/dist/gates/contract.d.ts.map +1 -1
- package/dist/gates/contract.js +3 -17
- package/dist/gates/contract.js.map +1 -1
- package/dist/gates/definitions.d.ts +1 -1
- package/dist/gates/performance.d.ts +1 -15
- package/dist/gates/performance.d.ts.map +1 -1
- package/dist/gates/performance.js +0 -19
- package/dist/gates/performance.js.map +1 -1
- package/dist/gates/registry.d.ts.map +1 -1
- package/dist/gates/registry.js +2 -5
- package/dist/gates/registry.js.map +1 -1
- package/dist/gates/review.d.ts +1 -9
- package/dist/gates/review.d.ts.map +1 -1
- package/dist/gates/review.js +22 -19
- package/dist/gates/review.js.map +1 -1
- package/dist/gates/security.d.ts +2 -9
- package/dist/gates/security.d.ts.map +1 -1
- package/dist/gates/security.js +7 -35
- package/dist/gates/security.js.map +1 -1
- package/dist/index.d.ts +12 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -16
- package/dist/index.js.map +1 -1
- package/dist/knowledge/audit-rules.d.ts +2 -0
- package/dist/knowledge/audit-rules.d.ts.map +1 -1
- package/dist/knowledge/audit-rules.js +10 -7
- package/dist/knowledge/audit-rules.js.map +1 -1
- package/dist/knowledge/audit.d.ts.map +1 -1
- package/dist/knowledge/audit.js +3 -1
- package/dist/knowledge/audit.js.map +1 -1
- package/dist/knowledge/{import.d.ts → cold-start.d.ts} +2 -3
- package/dist/knowledge/cold-start.d.ts.map +1 -0
- package/dist/knowledge/{import.js → cold-start.js} +135 -182
- package/dist/knowledge/cold-start.js.map +1 -0
- package/dist/knowledge/index.d.ts +3 -5
- package/dist/knowledge/index.d.ts.map +1 -1
- package/dist/knowledge/index.js +3 -9
- package/dist/knowledge/index.js.map +1 -1
- package/dist/knowledge/ingest.d.ts +29 -1
- package/dist/knowledge/ingest.d.ts.map +1 -1
- package/dist/knowledge/ingest.js +97 -7
- package/dist/knowledge/ingest.js.map +1 -1
- package/dist/knowledge/lifecycle.d.ts +0 -5
- package/dist/knowledge/lifecycle.d.ts.map +1 -1
- package/dist/knowledge/lifecycle.js +12 -19
- package/dist/knowledge/lifecycle.js.map +1 -1
- package/dist/knowledge/query.js +1 -1
- package/dist/knowledge/query.js.map +1 -1
- package/dist/knowledge/store.d.ts +4 -7
- package/dist/knowledge/store.d.ts.map +1 -1
- package/dist/knowledge/store.js +9 -27
- package/dist/knowledge/store.js.map +1 -1
- package/dist/knowledge/types.d.ts +2 -36
- package/dist/knowledge/types.d.ts.map +1 -1
- package/dist/knowledge/types.js +2 -3
- package/dist/knowledge/types.js.map +1 -1
- package/dist/monitoring/analyzer-base.d.ts +1 -10
- package/dist/monitoring/analyzer-base.d.ts.map +1 -1
- package/dist/monitoring/analyzer-base.js +1 -58
- package/dist/monitoring/analyzer-base.js.map +1 -1
- package/dist/monitoring/trace-analyzer.d.ts +1 -52
- package/dist/monitoring/trace-analyzer.d.ts.map +1 -1
- package/dist/monitoring/trace-analyzer.js +2 -131
- package/dist/monitoring/trace-analyzer.js.map +1 -1
- package/dist/monitoring/traces.d.ts +1 -14
- package/dist/monitoring/traces.d.ts.map +1 -1
- package/dist/monitoring/traces.js +3 -25
- package/dist/monitoring/traces.js.map +1 -1
- package/dist/types/command-definition.d.ts +81 -0
- package/dist/types/command-definition.d.ts.map +1 -0
- package/dist/types/command-definition.js +10 -0
- package/dist/types/command-definition.js.map +1 -0
- package/dist/types/constraint.d.ts +3 -24
- package/dist/types/constraint.d.ts.map +1 -1
- package/dist/types/constraint.js.map +1 -1
- package/dist/types/failure.d.ts +6 -39
- package/dist/types/failure.d.ts.map +1 -1
- package/dist/types/failure.js +6 -112
- package/dist/types/failure.js.map +1 -1
- package/dist/types/spec.d.ts +0 -4
- package/dist/types/spec.d.ts.map +1 -1
- package/dist/types/trace.d.ts +0 -4
- package/dist/types/trace.d.ts.map +1 -1
- package/dist/utils/clip.d.ts +8 -0
- package/dist/utils/clip.d.ts.map +1 -0
- package/dist/utils/clip.js +15 -0
- package/dist/utils/clip.js.map +1 -0
- package/dist/utils/diff-parse.d.ts +31 -0
- package/dist/utils/diff-parse.d.ts.map +1 -0
- package/dist/utils/diff-parse.js +72 -0
- package/dist/utils/diff-parse.js.map +1 -0
- package/dist/utils/guards.d.ts +6 -0
- package/dist/utils/guards.d.ts.map +1 -0
- package/dist/utils/guards.js +11 -0
- package/dist/utils/guards.js.map +1 -0
- package/dist/utils/jsonl.d.ts +0 -12
- package/dist/utils/jsonl.d.ts.map +1 -1
- package/dist/utils/jsonl.js +0 -12
- package/dist/utils/jsonl.js.map +1 -1
- package/dist/utils/log-rotate.d.ts +14 -0
- package/dist/utils/log-rotate.d.ts.map +1 -0
- package/dist/utils/log-rotate.js +74 -0
- package/dist/utils/log-rotate.js.map +1 -0
- package/dist/utils/numeric-flag.d.ts +10 -2
- package/dist/utils/numeric-flag.d.ts.map +1 -1
- package/dist/utils/numeric-flag.js +17 -2
- package/dist/utils/numeric-flag.js.map +1 -1
- package/dist/utils/package-json.d.ts +1 -1
- package/dist/utils/package-json.js +1 -1
- package/package.json +1 -1
- package/src/CONTEXT.md +9 -9
- package/src/__tests__/app-constraints-loader.test.ts +5 -7
- package/src/__tests__/checker-extra.test.ts +12 -80
- package/src/__tests__/checker-primitives-sdk.test.ts +3 -18
- package/src/__tests__/checker.test.ts +5 -7
- package/src/__tests__/checkpoint.test.ts +45 -59
- package/src/__tests__/context-files-resolution.test.ts +3 -2
- package/src/__tests__/contract-gate.test.ts +0 -32
- package/src/__tests__/cso-validator.test.ts +1 -9
- package/src/__tests__/effective-constraints.test.ts +1 -3
- package/src/__tests__/error-classifier.test.ts +1 -42
- package/src/__tests__/failure-recorder.test.ts +45 -114
- package/src/__tests__/iron-laws.test.ts +9 -16
- package/src/__tests__/layering.test.ts +3 -3
- package/src/__tests__/project-config-loader.test.ts +2 -1
- package/src/__tests__/public-exports.test.ts +4 -15
- package/src/__tests__/public-type-surface.test.ts +1 -22
- package/src/__tests__/public-value-surface.test.ts +0 -3
- package/src/__tests__/review-gate.test.ts +0 -17
- package/src/__tests__/security-gate.test.ts +0 -18
- package/src/__tests__/skip-semantics.test.ts +4 -7
- package/src/__tests__/trace-analyzer-extra.test.ts +13 -129
- package/src/__tests__/trace-analyzer.test.ts +7 -7
- package/src/__tests__/trace-collector.test.ts +0 -43
- package/src/__tests__/traces.test.ts +7 -39
- package/src/agents/CONTEXT.md +2 -4
- package/src/agents/__tests__/lifecycle.test.ts +4 -155
- package/src/agents/index.ts +0 -3
- package/src/agents/lifecycle.ts +1 -114
- package/src/agents/types.ts +1 -21
- package/src/{hooks → bootstrap}/CONTEXT.md +5 -5
- package/src/{hooks → bootstrap}/bootstrap.ts +32 -39
- package/src/{hooks → bootstrap}/index.ts +3 -2
- package/src/cli/commands/CONTEXT.md +11 -11
- package/src/cli/commands/__tests__/check-read-count.test.ts +4 -7
- package/src/cli/commands/__tests__/check-skip-output.test.ts +0 -1
- package/src/cli/commands/__tests__/command-gate-dead-options.test.ts +7 -5
- package/src/cli/commands/__tests__/constraints-pack-proposal.test.ts +0 -1
- package/src/cli/commands/__tests__/constraints-report.test.ts +2 -2
- package/src/cli/commands/__tests__/contract.test.ts +11 -4
- package/src/cli/commands/__tests__/failure.test.ts +9 -9
- package/src/cli/commands/__tests__/knowledge-view.test.ts +28 -158
- package/src/cli/commands/__tests__/knowledge.test.ts +24 -4
- package/src/cli/commands/__tests__/numeric-flag-assembly.test.ts +2 -1
- package/src/cli/commands/__tests__/passes-gate.test.ts +5 -5
- package/src/cli/commands/__tests__/project-path-convention.test.ts +4 -21
- package/src/cli/commands/__tests__/registry.test.ts +2 -0
- package/src/cli/commands/__tests__/release.test.ts +1 -1
- package/src/cli/commands/__tests__/review.test.ts +20 -6
- package/src/cli/commands/__tests__/security.test.ts +14 -0
- package/src/cli/commands/__tests__/spec-baseline-read-count.test.ts +2 -2
- package/src/cli/commands/__tests__/spec.test.ts +33 -23
- package/src/cli/commands/__tests__/validate.test.ts +32 -15
- package/src/cli/commands/acceptance.ts +1 -1
- package/src/cli/commands/check.ts +12 -6
- package/src/cli/commands/command.ts +7 -6
- package/src/cli/commands/constraints-pack-proposal.ts +10 -8
- package/src/cli/commands/constraints-reactivate.ts +13 -9
- package/src/cli/commands/constraints-retire.ts +30 -10
- package/src/cli/commands/contract.ts +4 -6
- package/src/cli/commands/definitions.ts +12 -84
- package/src/cli/commands/failure.ts +7 -8
- package/src/cli/commands/knowledge/health.ts +25 -21
- package/src/cli/commands/knowledge/import.ts +1 -1
- package/src/cli/commands/knowledge/search.ts +2 -3
- package/src/cli/commands/knowledge/store-access.ts +40 -0
- package/src/cli/commands/knowledge-view.ts +8 -32
- package/src/cli/commands/passes-gate.ts +9 -8
- package/src/cli/commands/release.ts +12 -13
- package/src/cli/commands/review.ts +15 -4
- package/src/cli/commands/security.ts +7 -0
- package/src/{core → cli/commands}/spec/__tests__/validator.test.ts +15 -53
- package/src/{core → cli/commands}/spec/validator.ts +15 -54
- package/src/cli/commands/spec-baseline-check.ts +36 -313
- package/src/cli/commands/spec.ts +15 -11
- package/src/cli/commands/status.ts +0 -2
- package/src/cli/commands/sync-docs/capabilities-syncer.ts +4 -10
- package/src/cli/commands/sync-docs/compact.ts +12 -11
- package/src/cli/commands/sync-docs/main-flow.ts +32 -472
- package/src/cli/commands/sync-docs/project-reader.ts +2 -1
- package/src/cli/commands/sync-docs/sync-output.ts +218 -0
- package/src/cli/commands/sync-docs/sync-state.ts +327 -0
- package/src/cli/commands/sync-docs/sync-writes.ts +49 -0
- package/src/cli/commands/validate.ts +13 -8
- package/src/context/CONTEXT.md +2 -2
- package/src/context/__tests__/session-manager.test.ts +1 -59
- package/src/context/index.ts +0 -5
- package/src/context/session-manager.ts +0 -44
- package/src/context/types.ts +2 -37
- package/src/core/CONTEXT.md +9 -9
- package/src/core/app-constraints-loader.ts +5 -23
- package/src/core/constraint-lifecycle.ts +30 -39
- package/src/core/constraints/__tests__/check-cache.test.ts +2 -124
- package/src/core/constraints/__tests__/collect-constraints.test.ts +0 -6
- package/src/core/constraints/__tests__/run-env.test.ts +26 -114
- package/src/core/constraints/__tests__/triggers.test.ts +3 -2
- package/src/core/constraints/__tests__/usage-report.test.ts +3 -6
- package/src/core/constraints/check-cache.ts +4 -70
- package/src/core/constraints/checker.ts +25 -75
- package/src/core/constraints/checkers/__tests__/capability-sync.test.ts +1 -0
- package/src/core/constraints/checkers/__tests__/check-outcome.test.ts +0 -1
- package/src/core/constraints/checkers/__tests__/docs-freshness-degraded.test.ts +2 -0
- package/src/core/constraints/checkers/__tests__/docs-freshness.test.ts +1 -0
- package/src/core/constraints/checkers/__tests__/governance-presence.test.ts +1 -0
- package/src/core/constraints/checkers/__tests__/input-contract.test.ts +1 -25
- package/src/core/constraints/checkers/__tests__/no-completion-without-verification.test.ts +3 -2
- package/src/core/constraints/checkers/__tests__/no-hardcoded-credentials.test.ts +3 -0
- package/src/core/constraints/checkers/__tests__/no-test-simplification.test.ts +1 -0
- package/src/core/constraints/checkers/__tests__/templated-checkers.test.ts +1 -0
- package/src/core/constraints/checkers/__tests__/templates-registry.test.ts +0 -2
- package/src/core/constraints/checkers/__tests__/three-state-consistency.test.ts +1 -0
- package/src/core/constraints/checkers/capability-sync.ts +2 -2
- package/src/core/constraints/checkers/context-doc-sync.ts +1 -1
- package/src/core/constraints/checkers/docs-freshness.ts +1 -1
- package/src/core/constraints/checkers/index.ts +21 -8
- package/src/core/constraints/checkers/no-hardcoded-credentials.ts +5 -32
- package/src/core/constraints/checkers/no-test-simplification.ts +10 -32
- package/src/core/constraints/checkers/templated/exec.ts +1 -7
- package/src/core/constraints/checkers/templated/regex-scan.ts +6 -25
- package/src/core/constraints/checkers/types.ts +12 -65
- package/src/core/constraints/context-builder.ts +11 -85
- package/src/core/constraints/definitions/{iron-laws.ts → errors.ts} +0 -4
- package/src/core/constraints/definitions/{guidelines.ts → warnings.ts} +0 -5
- package/src/core/constraints/definitions.ts +4 -3
- package/src/core/constraints/doc-freshness/runner.ts +63 -70
- package/src/core/constraints/find-constraint.ts +24 -0
- package/src/core/constraints/governance-accessors.ts +74 -0
- package/src/core/constraints/index.ts +0 -5
- package/src/core/constraints/pack-proposal.ts +4 -15
- package/src/core/constraints/run-env.ts +1 -26
- package/src/core/constraints/triggers.ts +11 -6
- package/src/core/constraints/usage-report.ts +0 -9
- package/src/core/index.ts +5 -10
- package/src/core/project-config-loader.ts +5 -68
- package/src/core/spec/baseline-check.ts +300 -0
- package/src/core/validators/__tests__/http-retry-sleep.test.ts +1 -1
- package/src/core/validators/check-handlers/file.ts +48 -5
- package/src/core/validators/checkpoint.ts +52 -85
- package/src/core/validators/cso.ts +1 -12
- package/src/core/validators/passes-gate.ts +0 -10
- package/src/failure/CONTEXT.md +1 -1
- package/src/failure/__tests__/recorder.test.ts +2 -1
- package/src/failure/classifier.ts +2 -42
- package/src/failure/error-types.ts +122 -0
- package/src/failure/index.ts +9 -9
- package/src/failure/recorder.ts +12 -77
- package/src/gates/CONTEXT.md +2 -4
- package/src/gates/__tests__/command-single-predicate.test.ts +15 -60
- package/src/gates/__tests__/command.test.ts +0 -13
- package/src/gates/__tests__/gate-interface.test.ts +3 -5
- package/src/gates/__tests__/performance.test.ts +5 -51
- package/src/gates/__tests__/review.test.ts +27 -50
- package/src/gates/__tests__/security-default-scan.test.ts +6 -3
- package/src/gates/__tests__/security.test.ts +25 -44
- package/src/gates/acceptance.ts +31 -33
- package/src/gates/command.ts +0 -33
- package/src/gates/contract.ts +1 -18
- package/src/gates/definitions.ts +1 -1
- package/src/gates/performance.ts +0 -23
- package/src/gates/registry.ts +2 -4
- package/src/gates/review.ts +30 -21
- package/src/gates/security.ts +4 -44
- package/src/index.ts +3 -28
- package/src/knowledge/CONTEXT.md +14 -20
- package/src/knowledge/__tests__/audit.test.ts +1 -1
- package/src/knowledge/__tests__/import.test.ts +1 -1
- package/src/knowledge/__tests__/ingest-validate-entry.test.ts +235 -0
- package/src/knowledge/__tests__/ingest.test.ts +2 -3
- package/src/knowledge/__tests__/store.test.ts +2 -4
- package/src/knowledge/__tests__/tree-walker.test.ts +5 -13
- package/src/knowledge/audit-rules.ts +10 -6
- package/src/knowledge/audit.ts +3 -1
- package/src/knowledge/{import.ts → cold-start.ts} +148 -191
- package/src/knowledge/index.ts +2 -9
- package/src/knowledge/ingest.ts +110 -7
- package/src/knowledge/lifecycle.ts +11 -19
- package/src/knowledge/query.ts +1 -1
- package/src/knowledge/store.ts +12 -34
- package/src/knowledge/types.ts +2 -48
- package/src/monitoring/CONTEXT.md +3 -3
- package/src/monitoring/__tests__/skipped-lines-report.test.ts +3 -16
- package/src/monitoring/__tests__/traces.test.ts +1 -27
- package/src/monitoring/analyzer-base.ts +1 -28
- package/src/monitoring/trace-analyzer.ts +2 -161
- package/src/monitoring/traces.ts +3 -29
- package/src/types/command-definition.ts +85 -0
- package/src/types/constraint.ts +3 -32
- package/src/types/failure.ts +7 -113
- package/src/types/spec.ts +0 -4
- package/src/types/trace.ts +0 -6
- package/src/utils/__tests__/jsonl-skip-disposition.test.ts +4 -7
- package/src/utils/clip.ts +12 -0
- package/src/utils/diff-parse.ts +80 -0
- package/src/utils/guards.ts +8 -0
- package/src/utils/jsonl.ts +0 -30
- package/src/utils/log-rotate.ts +43 -0
- package/src/utils/numeric-flag.ts +24 -2
- package/src/utils/package-json.ts +1 -1
- package/dist/cli/commands/knowledge/migrate.d.ts +0 -21
- package/dist/cli/commands/knowledge/migrate.d.ts.map +0 -1
- package/dist/cli/commands/knowledge/migrate.js +0 -48
- package/dist/cli/commands/knowledge/migrate.js.map +0 -1
- package/dist/cli/commands/knowledge/sync-rag.d.ts +0 -19
- package/dist/cli/commands/knowledge/sync-rag.d.ts.map +0 -1
- package/dist/cli/commands/knowledge/sync-rag.js +0 -77
- package/dist/cli/commands/knowledge/sync-rag.js.map +0 -1
- package/dist/core/constraints/checkers/templates-registry.d.ts +0 -18
- package/dist/core/constraints/checkers/templates-registry.d.ts.map +0 -1
- package/dist/core/constraints/checkers/templates-registry.js +0 -25
- package/dist/core/constraints/checkers/templates-registry.js.map +0 -1
- package/dist/core/constraints/definitions/guidelines.d.ts.map +0 -1
- package/dist/core/constraints/definitions/guidelines.js.map +0 -1
- package/dist/core/constraints/definitions/iron-laws.d.ts.map +0 -1
- package/dist/core/constraints/definitions/iron-laws.js.map +0 -1
- package/dist/core/spec/validator.d.ts.map +0 -1
- package/dist/core/spec/validator.js.map +0 -1
- package/dist/gates/checker-gate.d.ts +0 -27
- package/dist/gates/checker-gate.d.ts.map +0 -1
- package/dist/gates/checker-gate.js +0 -52
- package/dist/gates/checker-gate.js.map +0 -1
- package/dist/hooks/bootstrap.d.ts.map +0 -1
- package/dist/hooks/bootstrap.js.map +0 -1
- package/dist/hooks/index.d.ts.map +0 -1
- package/dist/hooks/index.js.map +0 -1
- package/dist/knowledge/doctor.d.ts +0 -37
- package/dist/knowledge/doctor.d.ts.map +0 -1
- package/dist/knowledge/doctor.js +0 -81
- package/dist/knowledge/doctor.js.map +0 -1
- package/dist/knowledge/import.d.ts.map +0 -1
- package/dist/knowledge/import.js.map +0 -1
- package/dist/knowledge/lint.d.ts +0 -90
- package/dist/knowledge/lint.d.ts.map +0 -1
- package/dist/knowledge/lint.js +0 -412
- package/dist/knowledge/lint.js.map +0 -1
- package/dist/knowledge/migration.d.ts +0 -28
- package/dist/knowledge/migration.d.ts.map +0 -1
- package/dist/knowledge/migration.js +0 -105
- package/dist/knowledge/migration.js.map +0 -1
- package/dist/knowledge/reference-tracker.d.ts +0 -31
- package/dist/knowledge/reference-tracker.d.ts.map +0 -1
- package/dist/knowledge/reference-tracker.js +0 -122
- package/dist/knowledge/reference-tracker.js.map +0 -1
- package/src/__tests__/spec-validator.test.ts +0 -58
- package/src/cli/commands/knowledge/migrate.ts +0 -61
- package/src/cli/commands/knowledge/sync-rag.ts +0 -48
- package/src/core/constraints/checkers/templates-registry.ts +0 -24
- package/src/gates/__tests__/checker-gate.test.ts +0 -86
- package/src/gates/checker-gate.ts +0 -52
- package/src/knowledge/__tests__/doctor.test.ts +0 -300
- package/src/knowledge/__tests__/lint.test.ts +0 -536
- package/src/knowledge/__tests__/migration.test.ts +0 -185
- package/src/knowledge/__tests__/reference-tracker.test.ts +0 -169
- package/src/knowledge/doctor.ts +0 -103
- package/src/knowledge/lint.ts +0 -460
- package/src/knowledge/migration.ts +0 -82
- package/src/knowledge/reference-tracker.ts +0 -99
- /package/src/{hooks → bootstrap}/__tests__/bootstrap.test.ts +0 -0
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* 检查器原语 SDK 公共面(harness#181 第二半)
|
|
3
3
|
*
|
|
4
4
|
* 导出纪律 = 只导出存量:CheckOutcome / buildCheckEnv / normalizeCheckOutcome +
|
|
5
|
-
* 现有 checker 真实在用的辅助件(formatEvidence
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* 现有 checker 真实在用的辅助件(formatEvidence 与接缝类型)。本套件从包根
|
|
6
|
+
* import 原语组装一个「事实 ↔ 期望」式业务 checker,验证导出真实可用;
|
|
7
|
+
* 三处 barrel 清单与三道冻结钉见 public-exports /
|
|
8
8
|
* public-value-surface / public-type-surface。
|
|
9
9
|
*/
|
|
10
10
|
|
|
@@ -13,8 +13,6 @@ import * as fs from 'fs';
|
|
|
13
13
|
import * as path from 'path';
|
|
14
14
|
import {
|
|
15
15
|
buildCheckEnv,
|
|
16
|
-
contextEvidenceFlag,
|
|
17
|
-
contextFlag,
|
|
18
16
|
formatEvidence,
|
|
19
17
|
normalizeCheckOutcome,
|
|
20
18
|
type CheckOutcome,
|
|
@@ -22,7 +20,6 @@ import {
|
|
|
22
20
|
} from '../index';
|
|
23
21
|
import {
|
|
24
22
|
buildCheckEnv as buildCheckEnvFromCore,
|
|
25
|
-
contextFlag as contextFlagFromCore,
|
|
26
23
|
normalizeCheckOutcome as normalizeFromCore,
|
|
27
24
|
} from '../core';
|
|
28
25
|
import { createProjectFixture } from '../test-setup/project-fixture';
|
|
@@ -30,7 +27,6 @@ import { createProjectFixture } from '../test-setup/project-fixture';
|
|
|
30
27
|
describe('检查器原语 SDK(harness#181)', () => {
|
|
31
28
|
it('包根与 ./core 子路径同源导出', () => {
|
|
32
29
|
expect(buildCheckEnvFromCore).toBe(buildCheckEnv);
|
|
33
|
-
expect(contextFlagFromCore).toBe(contextFlag);
|
|
34
30
|
expect(normalizeFromCore).toBe(normalizeCheckOutcome);
|
|
35
31
|
});
|
|
36
32
|
|
|
@@ -56,15 +52,4 @@ describe('检查器原语 SDK(harness#181)', () => {
|
|
|
56
52
|
expect(outcome.evidence.join('\n')).toContain('docs/b.md');
|
|
57
53
|
expect(outcome.evidence.join('\n')).not.toContain('docs/a.md');
|
|
58
54
|
});
|
|
59
|
-
|
|
60
|
-
it('谓词件 contextFlag / contextEvidenceFlag 经公共面照常工作', async () => {
|
|
61
|
-
const env = buildCheckEnv({ operation: 'commit', projectPath: '/nonexistent' }, 'none');
|
|
62
|
-
const flagCheck = contextFlag('app_flag', (ctx) => ctx.operation === 'commit');
|
|
63
|
-
expect(normalizeCheckOutcome(await flagCheck.evaluate(env)).satisfied).toBe(true);
|
|
64
|
-
|
|
65
|
-
const evidenceCheck = contextEvidenceFlag('app_evidence', 'hasFailingTest');
|
|
66
|
-
const skipped = normalizeCheckOutcome(await evidenceCheck.evaluate(env));
|
|
67
|
-
expect(skipped.skipped).toBe(true);
|
|
68
|
-
expect(skipped.skipReason).toContain('hasFailingTest');
|
|
69
|
-
});
|
|
70
55
|
});
|
|
@@ -50,12 +50,12 @@ describe('ConstraintChecker', () => {
|
|
|
50
50
|
};
|
|
51
51
|
|
|
52
52
|
const resultWithEvidence = await checker.check(
|
|
53
|
-
{ id: 'no_completion_without_verification',
|
|
53
|
+
{ id: 'no_completion_without_verification', severity: 'error', rule: 'NO COMPLETION', message: 'test', trigger: 'code_implementation', enforcement: 'test' },
|
|
54
54
|
contextWithEvidence
|
|
55
55
|
);
|
|
56
56
|
|
|
57
57
|
const resultWithoutEvidence = await checker.check(
|
|
58
|
-
{ id: 'no_completion_without_verification',
|
|
58
|
+
{ id: 'no_completion_without_verification', severity: 'error', rule: 'NO COMPLETION', message: 'test', trigger: 'code_implementation', enforcement: 'test' },
|
|
59
59
|
contextWithoutEvidence
|
|
60
60
|
);
|
|
61
61
|
|
|
@@ -80,7 +80,7 @@ describe('ConstraintChecker', () => {
|
|
|
80
80
|
fs.writeFileSync(capabilitiesPath, '# Capabilities\n');
|
|
81
81
|
|
|
82
82
|
const result = await checker.check(
|
|
83
|
-
{ id: 'capability_sync',
|
|
83
|
+
{ id: 'capability_sync', severity: 'warning', rule: 'CAPABILITY SYNC', message: 'test', trigger: 'commit', enforcement: 'test' },
|
|
84
84
|
context
|
|
85
85
|
);
|
|
86
86
|
|
|
@@ -107,14 +107,12 @@ describe('ConstraintChecker', () => {
|
|
|
107
107
|
expect(result.satisfied).toBe(true);
|
|
108
108
|
});
|
|
109
109
|
|
|
110
|
-
it('should
|
|
110
|
+
it('should throw for unknown constraint(注册表闭环口径:未注册即抛,不回假结果)', async () => {
|
|
111
111
|
const context: ConstraintContext = {
|
|
112
112
|
operation: 'code_implementation',
|
|
113
113
|
};
|
|
114
114
|
|
|
115
|
-
|
|
116
|
-
expect(result.satisfied).toBe(false);
|
|
117
|
-
expect(result.message).toContain('未知的约束');
|
|
115
|
+
await expect(checkConstraint('unknown_constraint', context)).rejects.toThrow('未知的约束');
|
|
118
116
|
});
|
|
119
117
|
});
|
|
120
118
|
});
|
|
@@ -10,11 +10,9 @@ import { tmpdir } from 'os';
|
|
|
10
10
|
|
|
11
11
|
describe('CheckpointValidator', () => {
|
|
12
12
|
let tempDir: string;
|
|
13
|
-
let validator: CheckpointValidator;
|
|
14
13
|
|
|
15
14
|
beforeAll(async () => {
|
|
16
15
|
tempDir = mkdtempSync(join(tmpdir(), 'temp-test-checkpoint-'));
|
|
17
|
-
validator = CheckpointValidator.getInstance();
|
|
18
16
|
// 创建测试文件
|
|
19
17
|
writeFileSync(join(tempDir, 'test.txt'), 'hello world');
|
|
20
18
|
writeFileSync(join(tempDir, 'empty.txt'), '');
|
|
@@ -29,21 +27,9 @@ describe('CheckpointValidator', () => {
|
|
|
29
27
|
}
|
|
30
28
|
});
|
|
31
29
|
|
|
32
|
-
describe('getSupportedCheckTypes', () => {
|
|
33
|
-
it('应该返回支持的检查类型', () => {
|
|
34
|
-
const types = validator.getSupportedCheckTypes();
|
|
35
|
-
|
|
36
|
-
expect(types.length).toBe(13);
|
|
37
|
-
expect(types).toContain('file_exists');
|
|
38
|
-
expect(types).toContain('file_contains');
|
|
39
|
-
expect(types).toContain('command_success');
|
|
40
|
-
expect(types).toContain('json_path');
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
|
|
44
30
|
describe('file_exists', () => {
|
|
45
31
|
it('文件存在应该通过', async () => {
|
|
46
|
-
const result = await CheckpointValidator
|
|
32
|
+
const result = await new CheckpointValidator().validate(
|
|
47
33
|
{
|
|
48
34
|
id: 'cp-1',
|
|
49
35
|
checks: [{ id: 'c-1', type: 'file_exists', config: { path: 'test.txt' } }],
|
|
@@ -56,7 +42,7 @@ describe('CheckpointValidator', () => {
|
|
|
56
42
|
});
|
|
57
43
|
|
|
58
44
|
it('文件不存在应该失败', async () => {
|
|
59
|
-
const result = await CheckpointValidator
|
|
45
|
+
const result = await new CheckpointValidator().validate(
|
|
60
46
|
{
|
|
61
47
|
id: 'cp-2',
|
|
62
48
|
checks: [{ id: 'c-2', type: 'file_exists', config: { path: 'not-exist.txt' } }],
|
|
@@ -72,7 +58,7 @@ describe('CheckpointValidator', () => {
|
|
|
72
58
|
|
|
73
59
|
describe('file_not_empty', () => {
|
|
74
60
|
it('非空文件应该通过', async () => {
|
|
75
|
-
const result = await CheckpointValidator
|
|
61
|
+
const result = await new CheckpointValidator().validate(
|
|
76
62
|
{
|
|
77
63
|
id: 'cp-3',
|
|
78
64
|
checks: [{ id: 'c-3', type: 'file_not_empty', config: { path: 'test.txt' } }],
|
|
@@ -84,7 +70,7 @@ describe('CheckpointValidator', () => {
|
|
|
84
70
|
});
|
|
85
71
|
|
|
86
72
|
it('空文件应该失败', async () => {
|
|
87
|
-
const result = await CheckpointValidator
|
|
73
|
+
const result = await new CheckpointValidator().validate(
|
|
88
74
|
{
|
|
89
75
|
id: 'cp-4',
|
|
90
76
|
checks: [{ id: 'c-4', type: 'file_not_empty', config: { path: 'empty.txt' } }],
|
|
@@ -99,7 +85,7 @@ describe('CheckpointValidator', () => {
|
|
|
99
85
|
|
|
100
86
|
describe('file_contains', () => {
|
|
101
87
|
it('文件包含内容应该通过', async () => {
|
|
102
|
-
const result = await CheckpointValidator
|
|
88
|
+
const result = await new CheckpointValidator().validate(
|
|
103
89
|
{
|
|
104
90
|
id: 'cp-5',
|
|
105
91
|
checks: [{ id: 'c-5', type: 'file_contains', config: { path: 'test.txt', content: 'hello' } }],
|
|
@@ -111,7 +97,7 @@ describe('CheckpointValidator', () => {
|
|
|
111
97
|
});
|
|
112
98
|
|
|
113
99
|
it('文件不包含内容应该失败', async () => {
|
|
114
|
-
const result = await CheckpointValidator
|
|
100
|
+
const result = await new CheckpointValidator().validate(
|
|
115
101
|
{
|
|
116
102
|
id: 'cp-6',
|
|
117
103
|
checks: [{ id: 'c-6', type: 'file_contains', config: { path: 'test.txt', content: 'goodbye' } }],
|
|
@@ -125,7 +111,7 @@ describe('CheckpointValidator', () => {
|
|
|
125
111
|
|
|
126
112
|
describe('file_not_contains', () => {
|
|
127
113
|
it('文件不包含内容应该通过', async () => {
|
|
128
|
-
const result = await CheckpointValidator
|
|
114
|
+
const result = await new CheckpointValidator().validate(
|
|
129
115
|
{
|
|
130
116
|
id: 'cp-20',
|
|
131
117
|
checks: [{ id: 'c-20', type: 'file_not_contains', config: { path: 'test.txt', content: 'goodbye' } }],
|
|
@@ -137,7 +123,7 @@ describe('CheckpointValidator', () => {
|
|
|
137
123
|
});
|
|
138
124
|
|
|
139
125
|
it('文件包含内容应该失败', async () => {
|
|
140
|
-
const result = await CheckpointValidator
|
|
126
|
+
const result = await new CheckpointValidator().validate(
|
|
141
127
|
{
|
|
142
128
|
id: 'cp-21',
|
|
143
129
|
checks: [{ id: 'c-21', type: 'file_not_contains', config: { path: 'test.txt', content: 'hello' } }],
|
|
@@ -152,7 +138,7 @@ describe('CheckpointValidator', () => {
|
|
|
152
138
|
|
|
153
139
|
describe('json_path', () => {
|
|
154
140
|
it('JSON 路径匹配应该通过', async () => {
|
|
155
|
-
const result = await CheckpointValidator
|
|
141
|
+
const result = await new CheckpointValidator().validate(
|
|
156
142
|
{
|
|
157
143
|
id: 'cp-7',
|
|
158
144
|
checks: [{ id: 'c-7', type: 'json_path', config: { jsonPath: 'name', expected: 'test' } }],
|
|
@@ -164,7 +150,7 @@ describe('CheckpointValidator', () => {
|
|
|
164
150
|
});
|
|
165
151
|
|
|
166
152
|
it('JSON 路径不匹配应该失败', async () => {
|
|
167
|
-
const result = await CheckpointValidator
|
|
153
|
+
const result = await new CheckpointValidator().validate(
|
|
168
154
|
{
|
|
169
155
|
id: 'cp-8',
|
|
170
156
|
checks: [{ id: 'c-8', type: 'json_path', config: { jsonPath: 'value', expected: 100 } }],
|
|
@@ -178,7 +164,7 @@ describe('CheckpointValidator', () => {
|
|
|
178
164
|
|
|
179
165
|
describe('output_contains', () => {
|
|
180
166
|
it('输出包含内容应该通过', async () => {
|
|
181
|
-
const result = await CheckpointValidator
|
|
167
|
+
const result = await new CheckpointValidator().validate(
|
|
182
168
|
{
|
|
183
169
|
id: 'cp-9',
|
|
184
170
|
checks: [{ id: 'c-9', type: 'output_contains', config: { content: 'success' } }],
|
|
@@ -190,7 +176,7 @@ describe('CheckpointValidator', () => {
|
|
|
190
176
|
});
|
|
191
177
|
|
|
192
178
|
it('输出不包含内容应该失败', async () => {
|
|
193
|
-
const result = await CheckpointValidator
|
|
179
|
+
const result = await new CheckpointValidator().validate(
|
|
194
180
|
{
|
|
195
181
|
id: 'cp-9b',
|
|
196
182
|
checks: [{ id: 'c-9b', type: 'output_contains', config: { content: 'error' } }],
|
|
@@ -205,7 +191,7 @@ describe('CheckpointValidator', () => {
|
|
|
205
191
|
|
|
206
192
|
describe('output_not_contains', () => {
|
|
207
193
|
it('输出不包含内容应该通过', async () => {
|
|
208
|
-
const result = await CheckpointValidator
|
|
194
|
+
const result = await new CheckpointValidator().validate(
|
|
209
195
|
{
|
|
210
196
|
id: 'cp-14',
|
|
211
197
|
checks: [{ id: 'c-14', type: 'output_not_contains', config: { content: 'error' } }],
|
|
@@ -217,7 +203,7 @@ describe('CheckpointValidator', () => {
|
|
|
217
203
|
});
|
|
218
204
|
|
|
219
205
|
it('输出包含内容应该失败', async () => {
|
|
220
|
-
const result = await CheckpointValidator
|
|
206
|
+
const result = await new CheckpointValidator().validate(
|
|
221
207
|
{
|
|
222
208
|
id: 'cp-15',
|
|
223
209
|
checks: [{ id: 'c-15', type: 'output_not_contains', config: { content: 'success' } }],
|
|
@@ -232,7 +218,7 @@ describe('CheckpointValidator', () => {
|
|
|
232
218
|
|
|
233
219
|
describe('output_matches', () => {
|
|
234
220
|
it('输出匹配正则应该通过', async () => {
|
|
235
|
-
const result = await CheckpointValidator
|
|
221
|
+
const result = await new CheckpointValidator().validate(
|
|
236
222
|
{
|
|
237
223
|
id: 'cp-16',
|
|
238
224
|
checks: [{ id: 'c-16', type: 'output_matches', config: { pattern: '\\d+ tests passed' } }],
|
|
@@ -244,7 +230,7 @@ describe('CheckpointValidator', () => {
|
|
|
244
230
|
});
|
|
245
231
|
|
|
246
232
|
it('输出不匹配正则应该失败', async () => {
|
|
247
|
-
const result = await CheckpointValidator
|
|
233
|
+
const result = await new CheckpointValidator().validate(
|
|
248
234
|
{
|
|
249
235
|
id: 'cp-17',
|
|
250
236
|
checks: [{ id: 'c-17', type: 'output_matches', config: { pattern: 'Error:.*' } }],
|
|
@@ -259,7 +245,7 @@ describe('CheckpointValidator', () => {
|
|
|
259
245
|
|
|
260
246
|
describe('command_output', () => {
|
|
261
247
|
it('命令输出匹配应该通过', async () => {
|
|
262
|
-
const result = await CheckpointValidator
|
|
248
|
+
const result = await new CheckpointValidator().validate(
|
|
263
249
|
{
|
|
264
250
|
id: 'cp-18',
|
|
265
251
|
checks: [{ id: 'c-18', type: 'command_output', config: { command: 'echo hello', expected: 'hello' } }],
|
|
@@ -271,7 +257,7 @@ describe('CheckpointValidator', () => {
|
|
|
271
257
|
});
|
|
272
258
|
|
|
273
259
|
it('命令输出不匹配应该失败', async () => {
|
|
274
|
-
const result = await CheckpointValidator
|
|
260
|
+
const result = await new CheckpointValidator().validate(
|
|
275
261
|
{
|
|
276
262
|
id: 'cp-19',
|
|
277
263
|
checks: [{ id: 'c-19', type: 'command_output', config: { command: 'echo hello', expected: 'world' } }],
|
|
@@ -285,7 +271,7 @@ describe('CheckpointValidator', () => {
|
|
|
285
271
|
|
|
286
272
|
describe('command_success', () => {
|
|
287
273
|
it('命令成功应该通过', async () => {
|
|
288
|
-
const result = await CheckpointValidator
|
|
274
|
+
const result = await new CheckpointValidator().validate(
|
|
289
275
|
{
|
|
290
276
|
id: 'cp-10',
|
|
291
277
|
checks: [{ id: 'c-10', type: 'command_success', config: { command: 'echo test' } }],
|
|
@@ -297,7 +283,7 @@ describe('CheckpointValidator', () => {
|
|
|
297
283
|
});
|
|
298
284
|
|
|
299
285
|
it('命令失败应该失败', async () => {
|
|
300
|
-
const result = await CheckpointValidator
|
|
286
|
+
const result = await new CheckpointValidator().validate(
|
|
301
287
|
{
|
|
302
288
|
id: 'cp-11',
|
|
303
289
|
checks: [{ id: 'c-11', type: 'command_success', config: { command: 'exit 1' } }],
|
|
@@ -311,7 +297,7 @@ describe('CheckpointValidator', () => {
|
|
|
311
297
|
|
|
312
298
|
describe('多检查组合', () => {
|
|
313
299
|
it('所有检查通过才算整体通过', async () => {
|
|
314
|
-
const result = await CheckpointValidator
|
|
300
|
+
const result = await new CheckpointValidator().validate(
|
|
315
301
|
{
|
|
316
302
|
id: 'cp-12',
|
|
317
303
|
checks: [
|
|
@@ -329,7 +315,7 @@ describe('CheckpointValidator', () => {
|
|
|
329
315
|
});
|
|
330
316
|
|
|
331
317
|
it('一个检查失败则整体失败', async () => {
|
|
332
|
-
const result = await CheckpointValidator
|
|
318
|
+
const result = await new CheckpointValidator().validate(
|
|
333
319
|
{
|
|
334
320
|
id: 'cp-13',
|
|
335
321
|
checks: [
|
|
@@ -347,7 +333,7 @@ describe('CheckpointValidator', () => {
|
|
|
347
333
|
|
|
348
334
|
describe('空检查点', () => {
|
|
349
335
|
it('无检查应该默认通过', async () => {
|
|
350
|
-
const result = await CheckpointValidator
|
|
336
|
+
const result = await new CheckpointValidator().validate(
|
|
351
337
|
{ id: 'cp-empty', checks: [] },
|
|
352
338
|
{ workdir: tempDir, projectPath: tempDir }
|
|
353
339
|
);
|
|
@@ -362,7 +348,7 @@ describe('CheckpointValidator', () => {
|
|
|
362
348
|
|
|
363
349
|
it('HTTP 状态码匹配应该通过', async () => {
|
|
364
350
|
globalThis.fetch = (async () => new Response(null, { status: 200 })) as any;
|
|
365
|
-
const result = await CheckpointValidator
|
|
351
|
+
const result = await new CheckpointValidator().validate(
|
|
366
352
|
{
|
|
367
353
|
id: 'cp-22',
|
|
368
354
|
checks: [{ id: 'c-22', type: 'http_status', config: { url: 'https://example.com', expectedStatus: 200 } }],
|
|
@@ -374,7 +360,7 @@ describe('CheckpointValidator', () => {
|
|
|
374
360
|
|
|
375
361
|
it('HTTP 状态码不匹配应该失败', async () => {
|
|
376
362
|
globalThis.fetch = (async () => new Response(null, { status: 404 })) as any;
|
|
377
|
-
const result = await CheckpointValidator
|
|
363
|
+
const result = await new CheckpointValidator().validate(
|
|
378
364
|
{
|
|
379
365
|
id: 'cp-23',
|
|
380
366
|
checks: [{ id: 'c-23', type: 'http_status', config: { url: 'https://example.com', expectedStatus: 200 } }],
|
|
@@ -391,7 +377,7 @@ describe('CheckpointValidator', () => {
|
|
|
391
377
|
|
|
392
378
|
it('HTTP 响应体包含内容应该通过', async () => {
|
|
393
379
|
globalThis.fetch = (async () => new Response('{"args": "test"}', { status: 200 })) as any;
|
|
394
|
-
const result = await CheckpointValidator
|
|
380
|
+
const result = await new CheckpointValidator().validate(
|
|
395
381
|
{
|
|
396
382
|
id: 'cp-24',
|
|
397
383
|
checks: [{ id: 'c-24', type: 'http_body', config: { url: 'https://example.com', expected: 'args' } }],
|
|
@@ -403,7 +389,7 @@ describe('CheckpointValidator', () => {
|
|
|
403
389
|
|
|
404
390
|
it('HTTP 响应体不包含内容应该失败', async () => {
|
|
405
391
|
globalThis.fetch = (async () => new Response('{"data": "test"}', { status: 200 })) as any;
|
|
406
|
-
const result = await CheckpointValidator
|
|
392
|
+
const result = await new CheckpointValidator().validate(
|
|
407
393
|
{
|
|
408
394
|
id: 'cp-25',
|
|
409
395
|
checks: [{ id: 'c-25', type: 'http_body', config: { url: 'https://example.com', expected: 'NONEXISTENT' } }],
|
|
@@ -424,7 +410,7 @@ describe('CheckpointValidator', () => {
|
|
|
424
410
|
message: '自定义检查通过',
|
|
425
411
|
}));
|
|
426
412
|
|
|
427
|
-
const result = await CheckpointValidator
|
|
413
|
+
const result = await new CheckpointValidator().validate(
|
|
428
414
|
{
|
|
429
415
|
id: 'cp-26',
|
|
430
416
|
checks: [{ id: 'c-26', type: 'custom', config: { customFunction: 'myValidator' } }],
|
|
@@ -443,7 +429,7 @@ describe('CheckpointValidator', () => {
|
|
|
443
429
|
message: '自定义检查失败',
|
|
444
430
|
}));
|
|
445
431
|
|
|
446
|
-
const result = await CheckpointValidator
|
|
432
|
+
const result = await new CheckpointValidator().validate(
|
|
447
433
|
{
|
|
448
434
|
id: 'cp-26b',
|
|
449
435
|
checks: [{ id: 'c-26b', type: 'custom', config: { customFunction: 'failValidator' } }],
|
|
@@ -455,7 +441,7 @@ describe('CheckpointValidator', () => {
|
|
|
455
441
|
});
|
|
456
442
|
|
|
457
443
|
it('未注册的自定义检查应该失败', async () => {
|
|
458
|
-
const result = await CheckpointValidator
|
|
444
|
+
const result = await new CheckpointValidator().validate(
|
|
459
445
|
{
|
|
460
446
|
id: 'cp-27',
|
|
461
447
|
checks: [{ id: 'c-27', type: 'custom', config: { customFunction: 'unknownValidator' } }],
|
|
@@ -474,7 +460,7 @@ describe('CheckpointValidator', () => {
|
|
|
474
460
|
describe('边缘情况', () => {
|
|
475
461
|
describe('未知检查类型', () => {
|
|
476
462
|
it('未知类型应该返回错误', async () => {
|
|
477
|
-
const result = await CheckpointValidator
|
|
463
|
+
const result = await new CheckpointValidator().validate(
|
|
478
464
|
{
|
|
479
465
|
id: 'cp-unknown',
|
|
480
466
|
checks: [{ id: 'c-unknown', type: 'unknown_type' as any, config: {} }],
|
|
@@ -490,7 +476,7 @@ describe('CheckpointValidator', () => {
|
|
|
490
476
|
|
|
491
477
|
describe('file_not_empty 文件不存在', () => {
|
|
492
478
|
it('文件不存在应该失败', async () => {
|
|
493
|
-
const result = await CheckpointValidator
|
|
479
|
+
const result = await new CheckpointValidator().validate(
|
|
494
480
|
{
|
|
495
481
|
id: 'cp-fne-missing',
|
|
496
482
|
checks: [{ id: 'c-fne-missing', type: 'file_not_empty', config: { path: 'nonexistent.txt' } }],
|
|
@@ -505,7 +491,7 @@ describe('CheckpointValidator', () => {
|
|
|
505
491
|
|
|
506
492
|
describe('file_contains 文件不存在', () => {
|
|
507
493
|
it('文件不存在应该失败', async () => {
|
|
508
|
-
const result = await CheckpointValidator
|
|
494
|
+
const result = await new CheckpointValidator().validate(
|
|
509
495
|
{
|
|
510
496
|
id: 'cp-fc-missing',
|
|
511
497
|
checks: [{ id: 'c-fc-missing', type: 'file_contains', config: { path: 'nonexistent.txt', content: 'test' } }],
|
|
@@ -520,7 +506,7 @@ describe('CheckpointValidator', () => {
|
|
|
520
506
|
|
|
521
507
|
describe('file_not_contains 文件不存在', () => {
|
|
522
508
|
it('文件不存在应该失败', async () => {
|
|
523
|
-
const result = await CheckpointValidator
|
|
509
|
+
const result = await new CheckpointValidator().validate(
|
|
524
510
|
{
|
|
525
511
|
id: 'cp-fnc-missing',
|
|
526
512
|
checks: [{ id: 'c-fnc-missing', type: 'file_not_contains', config: { path: 'nonexistent.txt', content: 'test' } }],
|
|
@@ -535,7 +521,7 @@ describe('CheckpointValidator', () => {
|
|
|
535
521
|
|
|
536
522
|
describe('command_output 命令失败', () => {
|
|
537
523
|
it('命令执行失败应该返回错误', async () => {
|
|
538
|
-
const result = await CheckpointValidator
|
|
524
|
+
const result = await new CheckpointValidator().validate(
|
|
539
525
|
{
|
|
540
526
|
id: 'cp-co-fail',
|
|
541
527
|
checks: [{ id: 'c-co-fail', type: 'command_output', config: { command: 'exit 1', expected: 'anything' } }],
|
|
@@ -550,7 +536,7 @@ describe('CheckpointValidator', () => {
|
|
|
550
536
|
|
|
551
537
|
describe('json_path 无效路径', () => {
|
|
552
538
|
it('无效 JSON 路径应该失败', async () => {
|
|
553
|
-
const result = await CheckpointValidator
|
|
539
|
+
const result = await new CheckpointValidator().validate(
|
|
554
540
|
{
|
|
555
541
|
id: 'cp-jp-invalid',
|
|
556
542
|
checks: [{ id: 'c-jp-invalid', type: 'json_path', config: { jsonPath: 'invalid..path', expected: 'test' } }],
|
|
@@ -575,7 +561,7 @@ describe('CheckpointValidator', () => {
|
|
|
575
561
|
return Promise.reject(new Error('Network error'));
|
|
576
562
|
}) as any;
|
|
577
563
|
const waits: number[] = [];
|
|
578
|
-
const result = await CheckpointValidator
|
|
564
|
+
const result = await new CheckpointValidator().validate(
|
|
579
565
|
{
|
|
580
566
|
id: 'cp-hs-fail',
|
|
581
567
|
checks: [{ id: 'c-hs-fail', type: 'http_status', config: { url: 'https://example.com', expectedStatus: 200 } }],
|
|
@@ -600,7 +586,7 @@ describe('CheckpointValidator', () => {
|
|
|
600
586
|
return Promise.reject(new Error('Network error'));
|
|
601
587
|
}) as any;
|
|
602
588
|
const waits: number[] = [];
|
|
603
|
-
const result = await CheckpointValidator
|
|
589
|
+
const result = await new CheckpointValidator().validate(
|
|
604
590
|
{
|
|
605
591
|
id: 'cp-hb-fail',
|
|
606
592
|
checks: [{ id: 'c-hb-fail', type: 'http_body', config: { url: 'https://example.com', expected: 'test' } }],
|
|
@@ -617,7 +603,7 @@ describe('CheckpointValidator', () => {
|
|
|
617
603
|
|
|
618
604
|
describe('output_contains JSON 输出', () => {
|
|
619
605
|
it('JSON 对象输出应该被正确处理', async () => {
|
|
620
|
-
const result = await CheckpointValidator
|
|
606
|
+
const result = await new CheckpointValidator().validate(
|
|
621
607
|
{
|
|
622
608
|
id: 'cp-oc-json',
|
|
623
609
|
checks: [{ id: 'c-oc-json', type: 'output_contains', config: { content: 'success' } }],
|
|
@@ -632,7 +618,7 @@ describe('CheckpointValidator', () => {
|
|
|
632
618
|
describe('output_matches 复杂正则', () => {
|
|
633
619
|
it('多行匹配应该工作', async () => {
|
|
634
620
|
// 注意:正则默认不匹配换行符,需要使用 s 标志或 [\s\S]
|
|
635
|
-
const result = await CheckpointValidator
|
|
621
|
+
const result = await new CheckpointValidator().validate(
|
|
636
622
|
{
|
|
637
623
|
id: 'cp-om-multi',
|
|
638
624
|
checks: [{ id: 'c-om-multi', type: 'output_matches', config: { pattern: 'passed[\\s\\S]*failed' } }],
|
|
@@ -644,7 +630,7 @@ describe('CheckpointValidator', () => {
|
|
|
644
630
|
});
|
|
645
631
|
|
|
646
632
|
it('单行匹配应该工作', async () => {
|
|
647
|
-
const result = await CheckpointValidator
|
|
633
|
+
const result = await new CheckpointValidator().validate(
|
|
648
634
|
{
|
|
649
635
|
id: 'cp-om-single',
|
|
650
636
|
checks: [{ id: 'c-om-single', type: 'output_matches', config: { pattern: '\\d+ passed' } }],
|
|
@@ -658,7 +644,7 @@ describe('CheckpointValidator', () => {
|
|
|
658
644
|
|
|
659
645
|
describe('边界场景', () => {
|
|
660
646
|
it('未知检查类型应该失败', async () => {
|
|
661
|
-
const result = await CheckpointValidator
|
|
647
|
+
const result = await new CheckpointValidator().validate(
|
|
662
648
|
{
|
|
663
649
|
id: 'cp-unknown',
|
|
664
650
|
checks: [{ id: 'c-unknown', type: 'unknown_type' as any, config: {} }],
|
|
@@ -671,7 +657,7 @@ describe('CheckpointValidator', () => {
|
|
|
671
657
|
});
|
|
672
658
|
|
|
673
659
|
it('output 为 null 应该被正确处理', async () => {
|
|
674
|
-
const result = await CheckpointValidator
|
|
660
|
+
const result = await new CheckpointValidator().validate(
|
|
675
661
|
{
|
|
676
662
|
id: 'cp-null-output',
|
|
677
663
|
checks: [{ id: 'c-null-output', type: 'output_contains', config: { content: 'test' } }],
|
|
@@ -684,7 +670,7 @@ describe('CheckpointValidator', () => {
|
|
|
684
670
|
});
|
|
685
671
|
|
|
686
672
|
it('output 为 undefined 应该被正确处理', async () => {
|
|
687
|
-
const result = await CheckpointValidator
|
|
673
|
+
const result = await new CheckpointValidator().validate(
|
|
688
674
|
{
|
|
689
675
|
id: 'cp-undef-output',
|
|
690
676
|
checks: [{ id: 'c-undef-output', type: 'output_contains', config: { content: 'test' } }],
|
|
@@ -698,7 +684,7 @@ describe('CheckpointValidator', () => {
|
|
|
698
684
|
|
|
699
685
|
it('JSON 路径获取抛出错误应该失败', async () => {
|
|
700
686
|
// 创建一个复杂的 JSON 路径测试场景
|
|
701
|
-
const result = await CheckpointValidator
|
|
687
|
+
const result = await new CheckpointValidator().validate(
|
|
702
688
|
{
|
|
703
689
|
id: 'cp-json-err',
|
|
704
690
|
checks: [{ id: 'c-json-err', type: 'json_path', config: { jsonPath: '$.deeply.nested.array[999].field', expected: 'test' } }],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* resolveContextFiles 三态访问器测试(工单 84)
|
|
3
3
|
*
|
|
4
|
-
* 测试面 =
|
|
4
|
+
* 测试面 = constraints/governance-accessors 上的 governance.context_files 访问器:
|
|
5
5
|
* 未配置 / enabled 但无目标 / enabled 且非空 三态可分辨;访问器的 config.yml
|
|
6
6
|
* 读取由运行级观察面供给(ADR-0023 决策 2:同一枚 RunEnv 内不触发第二次解析,
|
|
7
7
|
* 进程级缓存已撤销)。临时目录由 src/test-setup/mkdtemp-cleanup.ts 统一回收。
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
import { describe, it, expect, jest } from '@jest/globals';
|
|
11
11
|
import * as fs from 'fs';
|
|
12
12
|
import * as path from 'path';
|
|
13
|
-
import {
|
|
13
|
+
import { loadRawProjectConfig } from '../core/project-config-loader';
|
|
14
|
+
import { resolveContextFiles } from '../core/constraints/governance-accessors';
|
|
14
15
|
import { createRunEnv } from '../core/constraints/run-env';
|
|
15
16
|
import { createProjectFixture, writeProjectConfig } from '../test-setup/project-fixture';
|
|
16
17
|
|
|
@@ -265,36 +265,4 @@ paths:
|
|
|
265
265
|
expect(result).toBeDefined();
|
|
266
266
|
});
|
|
267
267
|
});
|
|
268
|
-
|
|
269
|
-
describe('配置方法', () => {
|
|
270
|
-
it('setContractPath 应该更新路径', () => {
|
|
271
|
-
const gate = new ContractGate();
|
|
272
|
-
gate.setContractPath('new/path.yaml');
|
|
273
|
-
|
|
274
|
-
const config = gate.getConfig();
|
|
275
|
-
expect(config.contractPath).toBe('new/path.yaml');
|
|
276
|
-
});
|
|
277
|
-
|
|
278
|
-
it('getConfig 应该返回当前配置', () => {
|
|
279
|
-
const gate = new ContractGate({
|
|
280
|
-
strict: false,
|
|
281
|
-
allowBreakingChanges: true,
|
|
282
|
-
contractPath: 'api.yaml',
|
|
283
|
-
});
|
|
284
|
-
|
|
285
|
-
const config = gate.getConfig();
|
|
286
|
-
expect(config.strict).toBe(false);
|
|
287
|
-
expect(config.allowBreakingChanges).toBe(true);
|
|
288
|
-
expect(config.contractPath).toBe('api.yaml');
|
|
289
|
-
});
|
|
290
|
-
|
|
291
|
-
it('默认配置', () => {
|
|
292
|
-
const gate = new ContractGate();
|
|
293
|
-
const config = gate.getConfig();
|
|
294
|
-
|
|
295
|
-
expect(config.strict).toBe(true);
|
|
296
|
-
expect(config.allowBreakingChanges).toBe(false);
|
|
297
|
-
expect(config.contractPath).toBe('openapi.yaml');
|
|
298
|
-
});
|
|
299
|
-
});
|
|
300
268
|
});
|
|
@@ -7,15 +7,7 @@ import { CSOValidator } from '../core/validators/cso';
|
|
|
7
7
|
import type { WorkflowMeta, StepMeta, ToolMeta } from '../types/cso';
|
|
8
8
|
|
|
9
9
|
describe('CSOValidator', () => {
|
|
10
|
-
const validator = CSOValidator
|
|
11
|
-
|
|
12
|
-
describe('单例模式', () => {
|
|
13
|
-
it('应该返回单例实例', () => {
|
|
14
|
-
const instance1 = CSOValidator.getInstance();
|
|
15
|
-
const instance2 = CSOValidator.getInstance();
|
|
16
|
-
expect(instance1).toBe(instance2);
|
|
17
|
-
});
|
|
18
|
-
});
|
|
10
|
+
const validator = new CSOValidator();
|
|
19
11
|
|
|
20
12
|
describe('validateWorkflow', () => {
|
|
21
13
|
it('有效的描述应该通过', () => {
|
|
@@ -38,12 +38,11 @@ describe('getEffectiveConstraints / lintEffectiveConfig', () => {
|
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
describe('合并矩阵', () => {
|
|
41
|
-
it('
|
|
41
|
+
it('无配置项目:内置全集(带 severity)', () => {
|
|
42
42
|
const dir = setupProject();
|
|
43
43
|
const constraints = getEffectiveConstraints(dir);
|
|
44
44
|
|
|
45
45
|
expect(constraints.length).toBe(BUILTIN_TOTAL);
|
|
46
|
-
expect(constraints.every(c => c.kind === 'check')).toBe(true);
|
|
47
46
|
});
|
|
48
47
|
|
|
49
48
|
it('config.yml 禁用:条目从生效集移除', () => {
|
|
@@ -74,7 +73,6 @@ constraints:
|
|
|
74
73
|
])
|
|
75
74
|
);
|
|
76
75
|
expect(constraints).toHaveLength(2);
|
|
77
|
-
expect(constraints.every(c => c.kind === 'check')).toBe(true);
|
|
78
76
|
});
|
|
79
77
|
|
|
80
78
|
it('禁用未知 id(已移除约束的残留配置):不报错,lint 可诊断', () => {
|