@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
|
@@ -4,15 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
import { specValidate, listSpecTypes } from '../spec';
|
|
6
6
|
import { captureIO, type CapturingIO } from '../../command-contract';
|
|
7
|
-
import { SpecValidator
|
|
7
|
+
import { SpecValidator } from '../spec/validator';
|
|
8
8
|
import type { BatchSpecValidationResult, SpecValidationResult } from '../../../types/spec';
|
|
9
9
|
|
|
10
10
|
// Mock SpecValidator
|
|
11
|
-
jest.mock('
|
|
12
|
-
SpecValidator:
|
|
13
|
-
getInstance: jest.fn(),
|
|
14
|
-
},
|
|
15
|
-
validateAllSpecs: jest.fn(),
|
|
11
|
+
jest.mock('../spec/validator', () => ({
|
|
12
|
+
SpecValidator: jest.fn(),
|
|
16
13
|
}));
|
|
17
14
|
|
|
18
15
|
// Mock chalk
|
|
@@ -25,8 +22,7 @@ jest.mock('chalk', () => ({
|
|
|
25
22
|
bold: jest.fn((str: string) => str),
|
|
26
23
|
}));
|
|
27
24
|
|
|
28
|
-
const MockSpecValidator = SpecValidator as jest.
|
|
29
|
-
const mockValidateAllSpecs = validateAllSpecs as jest.MockedFunction<typeof validateAllSpecs>;
|
|
25
|
+
const MockSpecValidator = SpecValidator as unknown as jest.Mock;
|
|
30
26
|
|
|
31
27
|
let io: CapturingIO;
|
|
32
28
|
beforeEach(() => {
|
|
@@ -35,18 +31,18 @@ beforeEach(() => {
|
|
|
35
31
|
|
|
36
32
|
describe('spec command', () => {
|
|
37
33
|
let mockValidator: {
|
|
38
|
-
setConfig: jest.Mock;
|
|
39
34
|
validateFile: jest.Mock;
|
|
35
|
+
validateAll: jest.Mock;
|
|
40
36
|
};
|
|
41
37
|
|
|
42
38
|
beforeEach(() => {
|
|
43
39
|
jest.clearAllMocks();
|
|
44
40
|
|
|
45
41
|
mockValidator = {
|
|
46
|
-
setConfig: jest.fn(),
|
|
47
42
|
validateFile: jest.fn(),
|
|
43
|
+
validateAll: jest.fn(),
|
|
48
44
|
};
|
|
49
|
-
|
|
45
|
+
MockSpecValidator.mockImplementation(() => mockValidator);
|
|
50
46
|
});
|
|
51
47
|
|
|
52
48
|
describe('specValidate', () => {
|
|
@@ -75,9 +71,10 @@ describe('spec command', () => {
|
|
|
75
71
|
};
|
|
76
72
|
mockValidator.validateFile.mockResolvedValue(mockResult);
|
|
77
73
|
|
|
78
|
-
await specValidate({ file: 'test.yml' }, io);
|
|
74
|
+
const result = await specValidate({ file: 'test.yml' }, io);
|
|
79
75
|
expect(io.outText()).toContain('验证失败');
|
|
80
76
|
expect(io.outText()).toContain('错误');
|
|
77
|
+
expect(result).toEqual({ kind: 'fail', reason: 'Spec 文件验证失败: test.yml' });
|
|
81
78
|
});
|
|
82
79
|
|
|
83
80
|
it('应该显示警告', async () => {
|
|
@@ -119,7 +116,7 @@ describe('spec command', () => {
|
|
|
119
116
|
warnings: 0,
|
|
120
117
|
results: [],
|
|
121
118
|
};
|
|
122
|
-
|
|
119
|
+
mockValidator.validateAll.mockResolvedValue(mockResult);
|
|
123
120
|
|
|
124
121
|
await specValidate({}, io);
|
|
125
122
|
expect(io.outText()).toContain('所有 Spec 文件验证通过');
|
|
@@ -135,7 +132,7 @@ describe('spec command', () => {
|
|
|
135
132
|
{ file: 'fail1.yml', type: 'custom', valid: false, errors: [{ path: 'x', message: 'err', severity: 'error' }], warnings: [] },
|
|
136
133
|
],
|
|
137
134
|
};
|
|
138
|
-
|
|
135
|
+
mockValidator.validateAll.mockResolvedValue(mockResult);
|
|
139
136
|
|
|
140
137
|
await specValidate({}, io);
|
|
141
138
|
expect(io.outText()).toContain('失败: 2');
|
|
@@ -149,7 +146,7 @@ describe('spec command', () => {
|
|
|
149
146
|
warnings: 0,
|
|
150
147
|
results: [],
|
|
151
148
|
};
|
|
152
|
-
|
|
149
|
+
mockValidator.validateAll.mockResolvedValue(mockResult);
|
|
153
150
|
|
|
154
151
|
await specValidate({}, io);
|
|
155
152
|
expect(io.outText()).toContain('没有找到 Spec 文件');
|
|
@@ -163,13 +160,13 @@ describe('spec command', () => {
|
|
|
163
160
|
warnings: 0,
|
|
164
161
|
results: [],
|
|
165
162
|
};
|
|
166
|
-
|
|
163
|
+
mockValidator.validateAll.mockResolvedValue(mockResult);
|
|
167
164
|
|
|
168
165
|
const result = await specValidate({}, io);
|
|
169
166
|
expect(result).toEqual({ kind: 'fail', reason: '1 个 Spec 文件验证失败' });
|
|
170
167
|
});
|
|
171
168
|
|
|
172
|
-
it('--staged 有失败:
|
|
169
|
+
it('--staged 有失败:fail(与非 staged 同口径,staged 不再是免 fail 通道)', async () => {
|
|
173
170
|
const mockResult: BatchSpecValidationResult = {
|
|
174
171
|
total: 2,
|
|
175
172
|
passed: 1,
|
|
@@ -177,21 +174,34 @@ describe('spec command', () => {
|
|
|
177
174
|
warnings: 0,
|
|
178
175
|
results: [],
|
|
179
176
|
};
|
|
180
|
-
|
|
177
|
+
mockValidator.validateAll.mockResolvedValue(mockResult);
|
|
181
178
|
|
|
182
179
|
const result = await specValidate({ staged: true }, io);
|
|
183
|
-
expect(result).toEqual({ kind: '
|
|
180
|
+
expect(result).toEqual({ kind: 'fail', reason: '1 个 Spec 文件验证失败' });
|
|
184
181
|
});
|
|
185
182
|
});
|
|
186
183
|
|
|
187
184
|
describe('Schema 配置', () => {
|
|
188
|
-
it('
|
|
189
|
-
|
|
185
|
+
it('自定义 Schema 路径在组合根锚定到项目根(不按进程 cwd)', async () => {
|
|
186
|
+
mockValidator.validateAll.mockResolvedValue({
|
|
190
187
|
total: 0, passed: 0, failed: 0, warnings: 0, results: [],
|
|
191
188
|
});
|
|
192
189
|
|
|
193
|
-
await specValidate({ schema: 'custom-schema.ts' }, io);
|
|
194
|
-
expect(
|
|
190
|
+
await specValidate({ schema: 'custom-schema.ts', projectPath: '/proj' }, io);
|
|
191
|
+
expect(MockSpecValidator).toHaveBeenCalledWith({
|
|
192
|
+
schemaPath: '/proj/custom-schema.ts',
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
it('缺省 Schema 路径同样锚定项目根', async () => {
|
|
197
|
+
mockValidator.validateAll.mockResolvedValue({
|
|
198
|
+
total: 0, passed: 0, failed: 0, warnings: 0, results: [],
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
await specValidate({ projectPath: '/proj' }, io);
|
|
202
|
+
expect(MockSpecValidator).toHaveBeenCalledWith({
|
|
203
|
+
schemaPath: '/proj/specs/schemas',
|
|
204
|
+
});
|
|
195
205
|
});
|
|
196
206
|
});
|
|
197
207
|
});
|
|
@@ -18,9 +18,7 @@ jest.mock('fs/promises', () => ({
|
|
|
18
18
|
|
|
19
19
|
// Mock CheckpointValidator
|
|
20
20
|
jest.mock('../../../core/validators/checkpoint', () => ({
|
|
21
|
-
CheckpointValidator:
|
|
22
|
-
getInstance: jest.fn(),
|
|
23
|
-
},
|
|
21
|
+
CheckpointValidator: jest.fn(),
|
|
24
22
|
}));
|
|
25
23
|
|
|
26
24
|
// Mock yaml
|
|
@@ -52,15 +50,34 @@ describe('validate command', () => {
|
|
|
52
50
|
});
|
|
53
51
|
|
|
54
52
|
describe('validate', () => {
|
|
55
|
-
it('
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
it('应该跳过无检查点的情况(ENOENT = 合法空)', async () => {
|
|
54
|
+
const enoent = new Error('file not found') as NodeJS.ErrnoException;
|
|
55
|
+
enoent.code = 'ENOENT';
|
|
56
|
+
mockFs.readFile.mockRejectedValue(enoent);
|
|
57
|
+
|
|
58
58
|
const result = await validate({}, io);
|
|
59
59
|
|
|
60
60
|
expect(io.outText()).toContain('没有定义检查点');
|
|
61
61
|
expect(result).toEqual({ kind: 'skip', reason: expect.stringContaining('没有定义检查点') });
|
|
62
62
|
});
|
|
63
63
|
|
|
64
|
+
it('检查点文件 YAML 损坏 → 抛出(fail-fast:损坏 ≠ 缺失,不装「未找到」放行)', async () => {
|
|
65
|
+
mockFs.readFile.mockResolvedValue('checkpoints: [broken');
|
|
66
|
+
mockYaml.load.mockImplementation(() => {
|
|
67
|
+
throw new Error('YAMLException: unexpected end of stream');
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
await expect(validate({}, io)).rejects.toThrow('YAMLException');
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('检查点文件读取失败(非 ENOENT,如权限) → 抛出', async () => {
|
|
74
|
+
const eacces = new Error('permission denied') as NodeJS.ErrnoException;
|
|
75
|
+
eacces.code = 'EACCES';
|
|
76
|
+
mockFs.readFile.mockRejectedValue(eacces);
|
|
77
|
+
|
|
78
|
+
await expect(validate({}, io)).rejects.toThrow('permission denied');
|
|
79
|
+
});
|
|
80
|
+
|
|
64
81
|
it('应该通过所有检查点', async () => {
|
|
65
82
|
const mockCheckpoints = [
|
|
66
83
|
{ id: 'test-1', checks: [{ id: 'check-1', type: 'test' }] },
|
|
@@ -72,7 +89,7 @@ describe('validate command', () => {
|
|
|
72
89
|
const mockValidator = {
|
|
73
90
|
validate: jest.fn().mockResolvedValue({ passed: true, checks: [] }),
|
|
74
91
|
};
|
|
75
|
-
(MockCheckpointValidator
|
|
92
|
+
(MockCheckpointValidator as unknown as jest.Mock).mockImplementation(() => mockValidator);
|
|
76
93
|
|
|
77
94
|
const result = await validate({}, io);
|
|
78
95
|
|
|
@@ -94,7 +111,7 @@ describe('validate command', () => {
|
|
|
94
111
|
checks: [{ checkId: 'check-1', passed: false, message: 'failed' }],
|
|
95
112
|
}),
|
|
96
113
|
};
|
|
97
|
-
(MockCheckpointValidator
|
|
114
|
+
(MockCheckpointValidator as unknown as jest.Mock).mockImplementation(() => mockValidator);
|
|
98
115
|
|
|
99
116
|
// 工单 23:检查点失败一律 exit 1(门控语义)
|
|
100
117
|
|
|
@@ -123,7 +140,7 @@ describe('validate command', () => {
|
|
|
123
140
|
}],
|
|
124
141
|
}),
|
|
125
142
|
};
|
|
126
|
-
(MockCheckpointValidator
|
|
143
|
+
(MockCheckpointValidator as unknown as jest.Mock).mockImplementation(() => mockValidator);
|
|
127
144
|
|
|
128
145
|
await validate({}, io);
|
|
129
146
|
|
|
@@ -145,7 +162,7 @@ describe('validate command', () => {
|
|
|
145
162
|
checks: [{ checkId: 'check-1', passed: false, message: '同一个原因', error: '同一个原因' }],
|
|
146
163
|
}),
|
|
147
164
|
};
|
|
148
|
-
(MockCheckpointValidator
|
|
165
|
+
(MockCheckpointValidator as unknown as jest.Mock).mockImplementation(() => mockValidator);
|
|
149
166
|
|
|
150
167
|
await validate({}, io);
|
|
151
168
|
|
|
@@ -153,11 +170,11 @@ describe('validate command', () => {
|
|
|
153
170
|
expect(printed).toHaveLength(1);
|
|
154
171
|
});
|
|
155
172
|
|
|
156
|
-
it('
|
|
173
|
+
it('检查点失败一律 fail(门控语义)', async () => {
|
|
157
174
|
const mockCheckpoints = [
|
|
158
175
|
{ id: 'test-1', checks: [{ id: 'check-1', type: 'test' }] },
|
|
159
176
|
];
|
|
160
|
-
|
|
177
|
+
|
|
161
178
|
mockFs.readFile.mockResolvedValue('checkpoints content');
|
|
162
179
|
mockYaml.load.mockReturnValue({ checkpoints: mockCheckpoints });
|
|
163
180
|
|
|
@@ -167,11 +184,11 @@ describe('validate command', () => {
|
|
|
167
184
|
checks: [{ checkId: 'check-1', passed: false, message: 'failed' }],
|
|
168
185
|
}),
|
|
169
186
|
};
|
|
170
|
-
(MockCheckpointValidator
|
|
187
|
+
(MockCheckpointValidator as unknown as jest.Mock).mockImplementation(() => mockValidator);
|
|
171
188
|
|
|
172
|
-
const result = await validate({
|
|
189
|
+
const result = await validate({}, io);
|
|
173
190
|
|
|
174
|
-
// 工单 23
|
|
191
|
+
// 工单 23 语义:检查点失败即 fail;退出码映射在 bin
|
|
175
192
|
expect(result).toEqual({ kind: 'fail', reason: '1 个检查点未通过: test-1' });
|
|
176
193
|
});
|
|
177
194
|
});
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import chalk from 'chalk';
|
|
8
8
|
import * as fs from 'fs/promises';
|
|
9
9
|
import * as path from 'path';
|
|
10
|
+
import * as yaml from 'js-yaml';
|
|
10
11
|
import { SpecAcceptanceGate } from '../../gates/acceptance';
|
|
11
12
|
import { log, processIO, type CommandIO, type CommandResult } from '../command-contract';
|
|
12
13
|
import { reportGateDecision, reportGateError } from '../gate-command';
|
|
@@ -87,7 +88,6 @@ export async function listAcceptanceCriteria(
|
|
|
87
88
|
|
|
88
89
|
try {
|
|
89
90
|
const content = await fs.readFile(tasksPath, 'utf-8');
|
|
90
|
-
const yaml = await import('js-yaml');
|
|
91
91
|
const tasks: unknown = yaml.load(content);
|
|
92
92
|
|
|
93
93
|
if (typeof tasks !== 'object' || tasks === null) {
|
|
@@ -19,7 +19,7 @@ import { createRunEnv, type RunEnv } from '../../core/constraints/run-env';
|
|
|
19
19
|
import { TraceCollector } from '../../monitoring/traces';
|
|
20
20
|
import { readJsonl } from '../../utils/jsonl';
|
|
21
21
|
import { DEFAULT_TRACE_FILE, type ExecutionTrace } from '../../types/trace';
|
|
22
|
-
import type
|
|
22
|
+
import { ConstraintViolationError, type ConstraintResult, type ConstraintTrigger } from '../../types/constraint';
|
|
23
23
|
import { log, processIO, type CommandIO, type CommandResult } from '../command-contract';
|
|
24
24
|
import { fileStateIO, type StateIO } from '../state-io';
|
|
25
25
|
|
|
@@ -113,8 +113,8 @@ export async function check(
|
|
|
113
113
|
|
|
114
114
|
// 构建上下文(工单 23:触发条件与证据检测收敛至 core/constraints/context-builder)
|
|
115
115
|
// #87:一次 run 一份 git 证据——context-builder 与 checker 层共用同一实例
|
|
116
|
-
// ADR-0023:一次 run
|
|
117
|
-
const context =
|
|
116
|
+
// ADR-0023:一次 run 一份运行级观察面——配置、源根探测全部共用同一份读取
|
|
117
|
+
const context = buildConstraintContext({
|
|
118
118
|
projectPath: options.projectPath,
|
|
119
119
|
staged: options.staged,
|
|
120
120
|
trigger: options.trigger,
|
|
@@ -210,9 +210,15 @@ export async function check(
|
|
|
210
210
|
}
|
|
211
211
|
return { kind: 'ok' };
|
|
212
212
|
} catch (error) {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
213
|
+
// ConstraintViolationError = checkConstraints(block 模式) 的正常违规出口(业务错误),
|
|
214
|
+
// 译成 fail 结果;其余异常(bug / IO 故障)不是判定结果,直抛——
|
|
215
|
+
// CommandResult 判别联合是「判定」的契约,不是「程序崩溃」的收容所
|
|
216
|
+
if (error instanceof ConstraintViolationError) {
|
|
217
|
+
log(io);
|
|
218
|
+
log(io, chalk.red(`❌ 约束检查异常: ${error.message}`));
|
|
219
|
+
return { kind: 'fail', reason: `check error: ${error.message}` };
|
|
220
|
+
}
|
|
221
|
+
throw error;
|
|
216
222
|
}
|
|
217
223
|
}
|
|
218
224
|
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* 退出码映射收敛在 bin 一处。
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
+
import chalk from 'chalk';
|
|
13
14
|
import { createCommandGate, DEFAULT_COMMAND_BLACKLIST } from '../../gates/command';
|
|
14
15
|
import type { CommandBlacklistRule } from '../../types/gate';
|
|
15
16
|
import { log, logError, processIO, type CommandIO, type CommandResult } from '../command-contract';
|
|
@@ -77,12 +78,12 @@ export async function executeCommand(
|
|
|
77
78
|
if (options.json) {
|
|
78
79
|
log(io, JSON.stringify({ level, command: cmd }));
|
|
79
80
|
} else {
|
|
80
|
-
const levelColors: Record<string, string> = {
|
|
81
|
-
high:
|
|
82
|
-
medium:
|
|
83
|
-
low:
|
|
81
|
+
const levelColors: Record<string, (s: string) => string> = {
|
|
82
|
+
high: chalk.red,
|
|
83
|
+
medium: chalk.yellow,
|
|
84
|
+
low: chalk.green,
|
|
84
85
|
};
|
|
85
|
-
log(io, `${levelColors[level]
|
|
86
|
+
log(io, `${levelColors[level](level)} ${cmd}`);
|
|
86
87
|
}
|
|
87
88
|
// 严重级闸门(历史条件式):high → 非零退出
|
|
88
89
|
return level === 'high'
|
|
@@ -98,7 +99,7 @@ export async function executeCommand(
|
|
|
98
99
|
details: result.details,
|
|
99
100
|
}, null, 2));
|
|
100
101
|
} else {
|
|
101
|
-
log(io, result.passed ?
|
|
102
|
+
log(io, result.passed ? `${chalk.green('✓')} ${result.message}` : `${chalk.red('✗')} ${result.message}`);
|
|
102
103
|
}
|
|
103
104
|
|
|
104
105
|
return gateCommandResult('command', decision);
|
|
@@ -38,6 +38,14 @@ export interface PackProposalOptions {
|
|
|
38
38
|
now?: Date;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
/**
|
|
42
|
+
* 未知约束 id 的校验失败出口(--stdout 与落盘两通道同文案同 kind)
|
|
43
|
+
*/
|
|
44
|
+
function unknownConstraintId(id: string, io: CommandIO): CommandResult {
|
|
45
|
+
logError(io, `❌ 未知约束 id: ${id}(内置与应用层 constraints.yml 均未找到),未做任何变更`);
|
|
46
|
+
return { kind: 'usage-error', reason: `未知约束 id: ${id}` };
|
|
47
|
+
}
|
|
48
|
+
|
|
41
49
|
/**
|
|
42
50
|
* CLI handler: harness constraints pack-proposal <id>
|
|
43
51
|
*/
|
|
@@ -57,19 +65,13 @@ export async function constraintsPackProposal(
|
|
|
57
65
|
|
|
58
66
|
if (options.stdout) {
|
|
59
67
|
const material = collectProposalMaterial(projectRoot, id);
|
|
60
|
-
if (!material)
|
|
61
|
-
logError(io, `❌ 未知约束 id: ${id}(内置与应用层 constraints.yml 均未找到),未做任何变更`);
|
|
62
|
-
return { kind: 'usage-error', reason: `未知约束 id: ${id}` };
|
|
63
|
-
}
|
|
68
|
+
if (!material) return unknownConstraintId(id, io);
|
|
64
69
|
log(io, renderProposalMarkdown(material, projectRoot, now));
|
|
65
70
|
return { kind: 'ok' };
|
|
66
71
|
}
|
|
67
72
|
|
|
68
73
|
const result = packProposal(projectRoot, id, { now });
|
|
69
|
-
if (!result)
|
|
70
|
-
logError(io, `❌ 未知约束 id: ${id}(内置与应用层 constraints.yml 均未找到),未做任何变更`);
|
|
71
|
-
return { kind: 'usage-error', reason: `未知约束 id: ${id}` };
|
|
72
|
-
}
|
|
74
|
+
if (!result) return unknownConstraintId(id, io);
|
|
73
75
|
|
|
74
76
|
log(io, chalk.green(`✅ 提案材料已生成: ${result.materialPath}`));
|
|
75
77
|
log(io, chalk.gray(' 下一步:人工确认 params 无应用内部信息后,拿材料去 harness 仓开 issue(不自动开)'));
|
|
@@ -23,8 +23,7 @@ import {
|
|
|
23
23
|
type ReactivateExecuteOptions,
|
|
24
24
|
type ReactivateResult,
|
|
25
25
|
} from '../../core/constraint-lifecycle';
|
|
26
|
-
import {
|
|
27
|
-
import { logCommitHint } from './constraints-retire';
|
|
26
|
+
import { logCommitHint, wireKnowledgeSink } from './constraints-retire';
|
|
28
27
|
|
|
29
28
|
export type {
|
|
30
29
|
ReactivateExecuteOptions,
|
|
@@ -39,20 +38,25 @@ export interface ConstraintsReactivateOptions {
|
|
|
39
38
|
yes?: boolean;
|
|
40
39
|
}
|
|
41
40
|
|
|
41
|
+
/**
|
|
42
|
+
* CLI 侧 wired 包装的 options:core 执行 options + 知识沉淀写口的输出 IO
|
|
43
|
+
* (io 只被写口接线消费,不是 core 的签名——core ReactivateExecuteOptions 无此字段)
|
|
44
|
+
*/
|
|
45
|
+
export interface ReactivateCliOptions extends ReactivateExecuteOptions {
|
|
46
|
+
/** 知识沉淀写口的输出 IO(缺省 processIO) */
|
|
47
|
+
io?: CommandIO;
|
|
48
|
+
}
|
|
49
|
+
|
|
42
50
|
/**
|
|
43
51
|
* CLI 侧 wired 包装:core reactivateConstraint + 知识沉淀写口接线
|
|
44
|
-
*
|
|
52
|
+
* (接线共形 = constraints-retire 的 wireKnowledgeSink)。
|
|
45
53
|
*/
|
|
46
54
|
export function reactivateConstraint(
|
|
47
55
|
projectRoot: string,
|
|
48
56
|
id: string,
|
|
49
|
-
options:
|
|
57
|
+
options: ReactivateCliOptions = {}
|
|
50
58
|
): ReactivateResult {
|
|
51
|
-
return coreReactivateConstraint(projectRoot, id,
|
|
52
|
-
...options,
|
|
53
|
-
openKnowledgeStore:
|
|
54
|
-
options.openKnowledgeStore ?? (() => openKnowledgeStore({}, options.io ?? processIO)),
|
|
55
|
-
});
|
|
59
|
+
return coreReactivateConstraint(projectRoot, id, wireKnowledgeSink(options));
|
|
56
60
|
}
|
|
57
61
|
|
|
58
62
|
/**
|
|
@@ -42,10 +42,11 @@ import chalk from 'chalk';
|
|
|
42
42
|
import {
|
|
43
43
|
retireConstraint as coreRetireConstraint,
|
|
44
44
|
findRetireTarget,
|
|
45
|
+
type LifecycleKnowledgeSink,
|
|
45
46
|
type RetireExecuteOptions,
|
|
46
47
|
type RetireResult,
|
|
47
48
|
} from '../../core/constraint-lifecycle';
|
|
48
|
-
import { openKnowledgeStore } from './knowledge-
|
|
49
|
+
import { openKnowledgeStore } from './knowledge/store-access';
|
|
49
50
|
import { fileStateIO } from '../state-io';
|
|
50
51
|
import {
|
|
51
52
|
buildConstraintsUsageReport,
|
|
@@ -70,20 +71,39 @@ export interface ConstraintsRetireOptions {
|
|
|
70
71
|
}
|
|
71
72
|
|
|
72
73
|
/**
|
|
73
|
-
* CLI 侧 wired
|
|
74
|
-
* (
|
|
75
|
-
|
|
74
|
+
* CLI 侧 wired 包装的 options:core 执行 options + 知识沉淀写口的输出 IO
|
|
75
|
+
* (io 只被写口接线消费,不是 core 的签名——core RetireExecuteOptions 无此字段)
|
|
76
|
+
*/
|
|
77
|
+
export interface RetireCliOptions extends RetireExecuteOptions {
|
|
78
|
+
/** 知识沉淀写口的输出 IO(缺省 processIO) */
|
|
79
|
+
io?: CommandIO;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* CLI 侧 wired 包装共形(retire/reactivate 两枚原同形两份):剥出 io、把知识沉淀
|
|
84
|
+
* 写口接进 core 执行 options(openKnowledgeStore 同一解析点:KNOWLEDGE_BASE_DIR /
|
|
85
|
+
* 用户 home 缺省目录,harness#177)。库消费方请直接用包根导出的执行函数,按需注入
|
|
86
|
+
* openKnowledgeStore。
|
|
87
|
+
*/
|
|
88
|
+
export function wireKnowledgeSink<T extends { io?: CommandIO; openKnowledgeStore?: () => LifecycleKnowledgeSink }>(
|
|
89
|
+
options: T
|
|
90
|
+
): Omit<T, 'io' | 'openKnowledgeStore'> & { openKnowledgeStore: () => LifecycleKnowledgeSink } {
|
|
91
|
+
const { io, openKnowledgeStore: injected, ...coreOptions } = options;
|
|
92
|
+
return {
|
|
93
|
+
...coreOptions,
|
|
94
|
+
openKnowledgeStore: injected ?? (() => openKnowledgeStore({}, io ?? processIO)),
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* CLI 侧 wired 包装:core retireConstraint + 知识沉淀写口接线(接线共形见 wireKnowledgeSink)。
|
|
76
100
|
*/
|
|
77
101
|
export function retireConstraint(
|
|
78
102
|
projectRoot: string,
|
|
79
103
|
id: string,
|
|
80
|
-
options:
|
|
104
|
+
options: RetireCliOptions = {}
|
|
81
105
|
): RetireResult {
|
|
82
|
-
return coreRetireConstraint(projectRoot, id,
|
|
83
|
-
...options,
|
|
84
|
-
openKnowledgeStore:
|
|
85
|
-
options.openKnowledgeStore ?? (() => openKnowledgeStore({}, options.io ?? processIO)),
|
|
86
|
-
});
|
|
106
|
+
return coreRetireConstraint(projectRoot, id, wireKnowledgeSink(options));
|
|
87
107
|
}
|
|
88
108
|
|
|
89
109
|
/**
|
|
@@ -5,8 +5,10 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import chalk from 'chalk';
|
|
8
|
+
import { existsSync } from 'fs';
|
|
8
9
|
import * as fs from 'fs/promises';
|
|
9
10
|
import * as path from 'path';
|
|
11
|
+
import * as yaml from 'js-yaml';
|
|
10
12
|
import { ContractGate } from '../../gates/contract';
|
|
11
13
|
import { log, processIO, type CommandIO, type CommandResult } from '../command-contract';
|
|
12
14
|
import { reportGateDecision, reportGateError } from '../gate-command';
|
|
@@ -34,11 +36,9 @@ export async function contract(
|
|
|
34
36
|
const projectPath = options.projectPath || process.cwd();
|
|
35
37
|
const contractPath = options.contractPath || 'openapi.yaml';
|
|
36
38
|
|
|
37
|
-
//
|
|
39
|
+
// 先验证文件是否存在(存在性探测用 existsSync,不用 try/catch)
|
|
38
40
|
const fullPath = path.join(projectPath, contractPath);
|
|
39
|
-
|
|
40
|
-
await fs.access(fullPath);
|
|
41
|
-
} catch {
|
|
41
|
+
if (!existsSync(fullPath)) {
|
|
42
42
|
log(io);
|
|
43
43
|
log(io, chalk.red('❌ 契约文件不存在'));
|
|
44
44
|
log(io, chalk.red(` ${fullPath}`));
|
|
@@ -114,8 +114,6 @@ export async function validateSchema(
|
|
|
114
114
|
const contractPath = options.contractPath || 'openapi.yaml';
|
|
115
115
|
|
|
116
116
|
try {
|
|
117
|
-
const yaml = await import('js-yaml');
|
|
118
|
-
|
|
119
117
|
const fullPath = path.join(projectPath, contractPath);
|
|
120
118
|
const content = await fs.readFile(fullPath, 'utf-8');
|
|
121
119
|
|