@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
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* spec 前置条件判定(ADR-0020/0025 格局:判定纯函数住 core,采集与输出住 cli)
|
|
3
|
+
*
|
|
4
|
+
* 自 cli/commands/spec-baseline-check 下移(ADR-0040 Phase 3):section 提取、
|
|
5
|
+
* 逐条前置判定与其三个分类检查(文件存在 / 依赖 / 代码模式)是纯判定;
|
|
6
|
+
* 判定消费的取数面是注入的 `BaselineIndex`——采集实现(全仓扫描 / package.json
|
|
7
|
+
* 解析 / stat 探测)留在 cli 命令模块。
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import * as path from 'path';
|
|
11
|
+
|
|
12
|
+
/** 前置条件验证结果 */
|
|
13
|
+
export interface PrerequisiteResult {
|
|
14
|
+
/** 前置条件描述 */
|
|
15
|
+
prerequisite: string;
|
|
16
|
+
/** 是否满足 */
|
|
17
|
+
satisfied: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* true = 识别不出前置条件类型,无法自动判定(satisfied 恒 false):
|
|
20
|
+
* 单独成类露出,退出码按未满足处理——不再默认 satisfied: true 假绿
|
|
21
|
+
*/
|
|
22
|
+
undetermined?: boolean;
|
|
23
|
+
/** 证据 */
|
|
24
|
+
evidence: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** package.json 依赖面的一次解析结果(缺失态同样入库,不重试;损坏在上游 readPackageJson 已抛) */
|
|
28
|
+
export type DependencySnapshot = { ok: true; deps: Record<string, string> } | { ok: false };
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* 一次 spec-baseline-check 运行内的取数面(工单 #146,母票 #140 A 票):
|
|
32
|
+
* 全仓内容扫描、`package.json` 解析、同一落点的存在性探测各至多一遍,
|
|
33
|
+
* 逐条前置只在索引上重放判定——此前是「前置条件数 × 关键词数 × 源文件数」的逐条重扫。
|
|
34
|
+
*
|
|
35
|
+
* 懒建:没有任何前置需要某类数据时,该类读取一次都不发生(口径与改前一致)。
|
|
36
|
+
* 运行结束即弃,不跨命令、不扩 `RunEnv` 公共面(#140 triage 裁决 5)。
|
|
37
|
+
*/
|
|
38
|
+
export interface BaselineIndex {
|
|
39
|
+
/** 内容含 keyword 的源文件数(驻留索引重放或回落逐文件流式读,实现侧口径) */
|
|
40
|
+
countFilesContaining(keyword: string): number;
|
|
41
|
+
/** package.json 的 dependencies + devDependencies 合并面 */
|
|
42
|
+
dependencies(): DependencySnapshot;
|
|
43
|
+
/** 绝对路径是否在世(同一落点一次运行内只 stat 一次) */
|
|
44
|
+
exists(fullPath: string): boolean;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* 从 spec 内容中提取 Baseline/前置条件 section
|
|
49
|
+
*/
|
|
50
|
+
export function extractBaselineSection(content: string): string[] {
|
|
51
|
+
const lines = content.split('\n');
|
|
52
|
+
const prerequisites: string[] = [];
|
|
53
|
+
|
|
54
|
+
// 查找 ## Baseline 或 ## 前置条件 section
|
|
55
|
+
let inSection = false;
|
|
56
|
+
let sectionLevel = 0;
|
|
57
|
+
|
|
58
|
+
for (const line of lines) {
|
|
59
|
+
const headerMatch = line.match(/^(#{1,6})\s+(.+)/);
|
|
60
|
+
|
|
61
|
+
if (headerMatch) {
|
|
62
|
+
const level = headerMatch[1].length;
|
|
63
|
+
const title = headerMatch[2].trim();
|
|
64
|
+
|
|
65
|
+
// 检查是否是目标 section
|
|
66
|
+
if (/^(Baseline|前置条件|Prerequisites|Prereqs)$/i.test(title)) {
|
|
67
|
+
inSection = true;
|
|
68
|
+
sectionLevel = level;
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// 同级或更高级的标题结束 section
|
|
73
|
+
if (inSection && level <= sectionLevel) {
|
|
74
|
+
inSection = false;
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// 在 section 中提取列表项
|
|
80
|
+
if (inSection) {
|
|
81
|
+
const listMatch = line.match(/^\s*[-*+]\s+(.+)/);
|
|
82
|
+
if (listMatch) {
|
|
83
|
+
prerequisites.push(listMatch[1].trim());
|
|
84
|
+
}
|
|
85
|
+
// 也支持编号列表
|
|
86
|
+
const numberedMatch = line.match(/^\s*\d+\.\s+(.+)/);
|
|
87
|
+
if (numberedMatch) {
|
|
88
|
+
prerequisites.push(numberedMatch[1].trim());
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return prerequisites;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* 检查文件/目录是否存在
|
|
98
|
+
*/
|
|
99
|
+
function checkFileExists(
|
|
100
|
+
pattern: string,
|
|
101
|
+
projectPath: string,
|
|
102
|
+
index: BaselineIndex
|
|
103
|
+
): { exists: boolean; evidence: string } {
|
|
104
|
+
// 提取路径引用(反引号中的路径、引号中的路径、或直接的路径模式)
|
|
105
|
+
const pathPatterns = [
|
|
106
|
+
/`([^`]+\.[a-z]+)`/g, // `src/foo.ts`
|
|
107
|
+
/["']([^"']+\.[a-z]+)["']/g, // "src/foo.ts"
|
|
108
|
+
/`([^`]+\/)`/g, // `src/foo/`
|
|
109
|
+
/(\S+\/\S+\.[a-z]+)/g, // src/foo.ts
|
|
110
|
+
];
|
|
111
|
+
|
|
112
|
+
const paths: string[] = [];
|
|
113
|
+
for (const p of pathPatterns) {
|
|
114
|
+
p.lastIndex = 0;
|
|
115
|
+
let m;
|
|
116
|
+
while ((m = p.exec(pattern)) !== null) {
|
|
117
|
+
paths.push(m[1]);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (paths.length === 0) {
|
|
122
|
+
return { exists: false, evidence: '无法从描述中提取路径' };
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const found: string[] = [];
|
|
126
|
+
const missing: string[] = [];
|
|
127
|
+
|
|
128
|
+
for (const p of paths) {
|
|
129
|
+
const fullPath = path.resolve(projectPath, p);
|
|
130
|
+
if (index.exists(fullPath)) {
|
|
131
|
+
found.push(p);
|
|
132
|
+
} else {
|
|
133
|
+
missing.push(p);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (missing.length === 0 && found.length > 0) {
|
|
138
|
+
return { exists: true, evidence: `文件存在: ${found.join(', ')}` };
|
|
139
|
+
}
|
|
140
|
+
if (found.length > 0) {
|
|
141
|
+
return { exists: false, evidence: `部分存在: ${found.join(', ')}; 缺失: ${missing.join(', ')}` };
|
|
142
|
+
}
|
|
143
|
+
return { exists: false, evidence: `文件不存在: ${missing.join(', ')}` };
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* 检查代码中是否存在特定模式
|
|
148
|
+
*/
|
|
149
|
+
function checkCodePattern(pattern: string, index: BaselineIndex): { exists: boolean; evidence: string } {
|
|
150
|
+
// 从描述中提取关键词
|
|
151
|
+
const keywords: string[] = [];
|
|
152
|
+
|
|
153
|
+
// 提取反引号中的代码
|
|
154
|
+
const codePatterns = pattern.match(/`([^`]+)`/g);
|
|
155
|
+
if (codePatterns) {
|
|
156
|
+
for (const cp of codePatterns) {
|
|
157
|
+
const inner = cp.slice(1, -1);
|
|
158
|
+
if (inner.length >= 2) {
|
|
159
|
+
keywords.push(inner);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// 提取 "implemented" / "exists" / "已实现" 等关键词后的内容
|
|
165
|
+
const implMatch = pattern.match(/(?:implemented|exists|已实现|已完成|已存在)[\s::]+(.+)/i);
|
|
166
|
+
if (implMatch) {
|
|
167
|
+
keywords.push(implMatch[1].trim());
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (keywords.length === 0) {
|
|
171
|
+
return { exists: false, evidence: '无法从描述中提取搜索关键词' };
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
const found: string[] = [];
|
|
175
|
+
const notFound: string[] = [];
|
|
176
|
+
|
|
177
|
+
// 一次运行一份索引:全仓扫描与内容读取已在索引里发生一遍(超上限则回落流式),这里只做匹配
|
|
178
|
+
for (const kw of keywords) {
|
|
179
|
+
const count = index.countFilesContaining(kw);
|
|
180
|
+
if (count > 0) {
|
|
181
|
+
found.push(`${kw} (${count} files)`);
|
|
182
|
+
} else {
|
|
183
|
+
notFound.push(kw);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if (notFound.length === 0 && found.length > 0) {
|
|
188
|
+
return { exists: true, evidence: `代码中找到: ${found.join(', ')}` };
|
|
189
|
+
}
|
|
190
|
+
if (found.length > 0) {
|
|
191
|
+
return { exists: false, evidence: `找到: ${found.join(', ')}; 未找到: ${notFound.join(', ')}` };
|
|
192
|
+
}
|
|
193
|
+
return { exists: false, evidence: `代码中未找到: ${notFound.join(', ')}` };
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* 检查包依赖是否安装
|
|
198
|
+
*/
|
|
199
|
+
function checkDependency(
|
|
200
|
+
pattern: string,
|
|
201
|
+
projectPath: string,
|
|
202
|
+
index: BaselineIndex
|
|
203
|
+
): { exists: boolean; evidence: string } {
|
|
204
|
+
// 提取包名
|
|
205
|
+
const pkgPatterns = [
|
|
206
|
+
/`(@?[\w-]+\/[\w-]+)`/g, // `@scope/pkg` or `pkg-name`
|
|
207
|
+
/`([\w-]+)`/g, // `pkg`
|
|
208
|
+
/install(?:ed)?\s+(\S+)/gi, // installed pkg-name
|
|
209
|
+
];
|
|
210
|
+
|
|
211
|
+
const packages: string[] = [];
|
|
212
|
+
for (const p of pkgPatterns) {
|
|
213
|
+
p.lastIndex = 0;
|
|
214
|
+
let m;
|
|
215
|
+
while ((m = p.exec(pattern)) !== null) {
|
|
216
|
+
const pkg = m[1];
|
|
217
|
+
if (pkg.length >= 2 && !pkg.includes('/') && !pkg.includes('.')) {
|
|
218
|
+
packages.push(pkg);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if (packages.length === 0) {
|
|
224
|
+
return { exists: false, evidence: '无法从描述中提取包名' };
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
const found: string[] = [];
|
|
228
|
+
const missing: string[] = [];
|
|
229
|
+
|
|
230
|
+
// 一次运行只读解析一遍 package.json(缺失态同样入库;损坏在上游已抛)
|
|
231
|
+
const snapshot = index.dependencies();
|
|
232
|
+
if (!snapshot.ok) {
|
|
233
|
+
return { exists: false, evidence: 'package.json 不存在' };
|
|
234
|
+
}
|
|
235
|
+
const deps = snapshot.deps;
|
|
236
|
+
|
|
237
|
+
for (const pkg of packages) {
|
|
238
|
+
if (deps[pkg] || deps[`@types/${pkg}`]) {
|
|
239
|
+
found.push(pkg);
|
|
240
|
+
} else {
|
|
241
|
+
// 检查 node_modules
|
|
242
|
+
const nmPath = path.join(projectPath, 'node_modules', pkg);
|
|
243
|
+
if (index.exists(nmPath)) {
|
|
244
|
+
found.push(pkg);
|
|
245
|
+
} else {
|
|
246
|
+
missing.push(pkg);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (missing.length === 0 && found.length > 0) {
|
|
252
|
+
return { exists: true, evidence: `依赖已安装: ${found.join(', ')}` };
|
|
253
|
+
}
|
|
254
|
+
if (found.length > 0) {
|
|
255
|
+
return { exists: false, evidence: `已安装: ${found.join(', ')}; 缺失: ${missing.join(', ')}` };
|
|
256
|
+
}
|
|
257
|
+
return { exists: false, evidence: `依赖缺失: ${missing.join(', ')}` };
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* 综合验证一条前置条件(取数一律经注入的共享索引 `index`)
|
|
262
|
+
*/
|
|
263
|
+
export function verifyPrerequisite(
|
|
264
|
+
prereq: string,
|
|
265
|
+
projectPath: string,
|
|
266
|
+
index: BaselineIndex
|
|
267
|
+
): PrerequisiteResult {
|
|
268
|
+
const lower = prereq.toLowerCase();
|
|
269
|
+
|
|
270
|
+
// 路径/文件存在性检查
|
|
271
|
+
if (lower.includes('文件') || lower.includes('file') || lower.includes('目录') || lower.includes('directory')
|
|
272
|
+
|| /`[^`]+\.[a-z]+`/.test(prereq) || /\//.test(prereq)) {
|
|
273
|
+
const { exists, evidence } = checkFileExists(prereq, projectPath, index);
|
|
274
|
+
if (exists || evidence.includes('文件不存在')) {
|
|
275
|
+
return { prerequisite: prereq, satisfied: exists, evidence };
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// 依赖检查
|
|
280
|
+
if (lower.includes('依赖') || lower.includes('install') || lower.includes('package') || lower.includes('npm')) {
|
|
281
|
+
const { exists, evidence } = checkDependency(prereq, projectPath, index);
|
|
282
|
+
return { prerequisite: prereq, satisfied: exists, evidence };
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// 代码模式检查
|
|
286
|
+
if (lower.includes('实现') || lower.includes('implement') || lower.includes('exist')
|
|
287
|
+
|| lower.includes('已') || lower.includes('必须')
|
|
288
|
+
|| /`[^`]+`/.test(prereq)) {
|
|
289
|
+
const { exists, evidence } = checkCodePattern(prereq, index);
|
|
290
|
+
return { prerequisite: prereq, satisfied: exists, evidence };
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// 默认:识别不出前置条件类型——无法判定(单独成类,按未满足处理,不假绿放过)
|
|
294
|
+
return {
|
|
295
|
+
prerequisite: prereq,
|
|
296
|
+
satisfied: false,
|
|
297
|
+
undetermined: true,
|
|
298
|
+
evidence: '无法自动判定(需人工确认)',
|
|
299
|
+
};
|
|
300
|
+
}
|
|
@@ -215,7 +215,7 @@ describe('CheckpointValidator → http handler 的 context 接线', () => {
|
|
|
215
215
|
const { waits, sleep } = recordingSleep();
|
|
216
216
|
const calls = scriptedFetch([new Error('Network error')]);
|
|
217
217
|
|
|
218
|
-
const result = await CheckpointValidator
|
|
218
|
+
const result = await new CheckpointValidator().validate(
|
|
219
219
|
{
|
|
220
220
|
id: 'cp-wiring',
|
|
221
221
|
checks: [makeCheck('c-wiring', 'http_status', { url: URL_OK, expectedStatus: 200 })],
|
|
@@ -13,6 +13,15 @@ export function resolvePath(relativePath: string, workdir: string): string {
|
|
|
13
13
|
return path.join(workdir, relativePath);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
/** 读文本:existsSync 之后的权限/竞争失败回带诊断文本,由调用族判失败(同 command 族口径) */
|
|
17
|
+
function readFileContent(filePath: string): { content: string } | { error: string } {
|
|
18
|
+
try {
|
|
19
|
+
return { content: fs.readFileSync(filePath, 'utf-8') };
|
|
20
|
+
} catch (error) {
|
|
21
|
+
return { error: error instanceof Error ? error.message : String(error) };
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
16
25
|
export async function checkFileExists(check: CheckpointCheck, context: CheckpointContext): Promise<CheckResult> {
|
|
17
26
|
const filePath = resolvePath(check.config.path || '', context.workdir);
|
|
18
27
|
const exists = fs.existsSync(filePath);
|
|
@@ -39,7 +48,21 @@ export async function checkFileNotEmpty(check: CheckpointCheck, context: Checkpo
|
|
|
39
48
|
};
|
|
40
49
|
}
|
|
41
50
|
|
|
42
|
-
|
|
51
|
+
// existsSync 与 stat 之间文件被删/无权限:文本即诊断,判失败回带(同 command 族口径)
|
|
52
|
+
let stats: fs.Stats;
|
|
53
|
+
try {
|
|
54
|
+
stats = fs.statSync(filePath);
|
|
55
|
+
} catch (error) {
|
|
56
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
57
|
+
return {
|
|
58
|
+
checkId: check.id,
|
|
59
|
+
passed: false,
|
|
60
|
+
message: `文件读取失败: ${filePath}`,
|
|
61
|
+
actual: detail,
|
|
62
|
+
expected: '> 0',
|
|
63
|
+
error: detail,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
43
66
|
const notEmpty = stats.size > 0;
|
|
44
67
|
|
|
45
68
|
return {
|
|
@@ -65,8 +88,18 @@ export async function checkFileContains(check: CheckpointCheck, context: Checkpo
|
|
|
65
88
|
};
|
|
66
89
|
}
|
|
67
90
|
|
|
68
|
-
const
|
|
69
|
-
|
|
91
|
+
const read = readFileContent(filePath);
|
|
92
|
+
if ('error' in read) {
|
|
93
|
+
return {
|
|
94
|
+
checkId: check.id,
|
|
95
|
+
passed: false,
|
|
96
|
+
message: `文件读取失败: ${filePath}`,
|
|
97
|
+
actual: read.error,
|
|
98
|
+
expected: content,
|
|
99
|
+
error: read.error,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
const contains = read.content.includes(content);
|
|
70
103
|
|
|
71
104
|
return {
|
|
72
105
|
checkId: check.id,
|
|
@@ -91,8 +124,18 @@ export async function checkFileNotContains(check: CheckpointCheck, context: Chec
|
|
|
91
124
|
};
|
|
92
125
|
}
|
|
93
126
|
|
|
94
|
-
const
|
|
95
|
-
|
|
127
|
+
const read = readFileContent(filePath);
|
|
128
|
+
if ('error' in read) {
|
|
129
|
+
return {
|
|
130
|
+
checkId: check.id,
|
|
131
|
+
passed: false,
|
|
132
|
+
message: `文件读取失败: ${filePath}`,
|
|
133
|
+
actual: read.error,
|
|
134
|
+
expected: `不包含: ${content}`,
|
|
135
|
+
error: read.error,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
const notContains = !read.content.includes(content);
|
|
96
139
|
|
|
97
140
|
return {
|
|
98
141
|
checkId: check.id,
|
|
@@ -13,7 +13,6 @@ import type {
|
|
|
13
13
|
CheckpointResult,
|
|
14
14
|
CheckResult,
|
|
15
15
|
CheckpointContext,
|
|
16
|
-
CheckType,
|
|
17
16
|
} from '../../types/checkpoint';
|
|
18
17
|
import {
|
|
19
18
|
checkFileExists,
|
|
@@ -31,53 +30,16 @@ import {
|
|
|
31
30
|
import { checkHttpStatus, checkHttpBody } from './check-handlers/http';
|
|
32
31
|
|
|
33
32
|
/**
|
|
34
|
-
*
|
|
33
|
+
* 检查点验证器(无状态,构造器直建——单例壳已随 ADR-0040 Phase 4 删除)
|
|
35
34
|
*/
|
|
36
35
|
export class CheckpointValidator {
|
|
37
|
-
private static instance: CheckpointValidator;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* 支持的检查类型列表
|
|
41
|
-
*/
|
|
42
|
-
private static readonly SUPPORTED_CHECK_TYPES: CheckType[] = [
|
|
43
|
-
'file_exists',
|
|
44
|
-
'file_not_empty',
|
|
45
|
-
'file_contains',
|
|
46
|
-
'file_not_contains',
|
|
47
|
-
'command_success',
|
|
48
|
-
'command_output',
|
|
49
|
-
'output_contains',
|
|
50
|
-
'output_not_contains',
|
|
51
|
-
'output_matches',
|
|
52
|
-
'json_path',
|
|
53
|
-
'http_status',
|
|
54
|
-
'http_body',
|
|
55
|
-
'custom',
|
|
56
|
-
];
|
|
57
|
-
|
|
58
|
-
private constructor() {}
|
|
59
|
-
|
|
60
|
-
static getInstance(): CheckpointValidator {
|
|
61
|
-
if (!CheckpointValidator.instance) {
|
|
62
|
-
CheckpointValidator.instance = new CheckpointValidator();
|
|
63
|
-
}
|
|
64
|
-
return CheckpointValidator.instance;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* 获取支持的检查类型
|
|
69
|
-
*/
|
|
70
|
-
getSupportedCheckTypes(): CheckType[] {
|
|
71
|
-
return [...CheckpointValidator.SUPPORTED_CHECK_TYPES];
|
|
72
|
-
}
|
|
73
|
-
|
|
74
36
|
/**
|
|
75
37
|
* 验证检查点
|
|
76
38
|
*/
|
|
77
39
|
async validate(checkpoint: Checkpoint, context: CheckpointContext): Promise<CheckpointResult> {
|
|
78
|
-
if (!checkpoint
|
|
40
|
+
if (!checkpoint.checks || checkpoint.checks.length === 0) {
|
|
79
41
|
return {
|
|
80
|
-
checkpointId: checkpoint
|
|
42
|
+
checkpointId: checkpoint.id,
|
|
81
43
|
passed: true,
|
|
82
44
|
checks: [],
|
|
83
45
|
message: '无检查点要求',
|
|
@@ -105,51 +67,45 @@ export class CheckpointValidator {
|
|
|
105
67
|
|
|
106
68
|
/**
|
|
107
69
|
* 执行单个检查项(分发至 check-handlers/ 各族)
|
|
70
|
+
*
|
|
71
|
+
* 无外层 try/catch:13 个 handler 与 custom 分支各自把执行错误译成 CheckResult
|
|
72
|
+
* (错误文本即诊断),外层再兜是对不可能状态的二次防御。
|
|
108
73
|
*/
|
|
109
74
|
private async executeCheck(check: CheckpointCheck, context: CheckpointContext): Promise<CheckResult> {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
} catch (error) {
|
|
147
|
-
return {
|
|
148
|
-
checkId: check.id,
|
|
149
|
-
passed: false,
|
|
150
|
-
message: `检查执行失败: ${(error as Error).message}`,
|
|
151
|
-
error: (error as Error).message,
|
|
152
|
-
};
|
|
75
|
+
switch (check.type) {
|
|
76
|
+
case 'file_exists':
|
|
77
|
+
return await checkFileExists(check, context);
|
|
78
|
+
case 'file_not_empty':
|
|
79
|
+
return await checkFileNotEmpty(check, context);
|
|
80
|
+
case 'file_contains':
|
|
81
|
+
return await checkFileContains(check, context);
|
|
82
|
+
case 'file_not_contains':
|
|
83
|
+
return await checkFileNotContains(check, context);
|
|
84
|
+
case 'command_success':
|
|
85
|
+
return await checkCommandSuccess(check, context);
|
|
86
|
+
case 'command_output':
|
|
87
|
+
return await checkCommandOutput(check, context);
|
|
88
|
+
case 'output_contains':
|
|
89
|
+
return await checkOutputContains(check, context);
|
|
90
|
+
case 'output_not_contains':
|
|
91
|
+
return await checkOutputNotContains(check, context);
|
|
92
|
+
case 'output_matches':
|
|
93
|
+
return await checkOutputMatches(check, context);
|
|
94
|
+
case 'json_path':
|
|
95
|
+
return await checkJsonPath(check, context);
|
|
96
|
+
case 'http_status':
|
|
97
|
+
return await checkHttpStatus(check, context);
|
|
98
|
+
case 'http_body':
|
|
99
|
+
return await checkHttpBody(check, context);
|
|
100
|
+
case 'custom':
|
|
101
|
+
return await this.checkCustom(check, context);
|
|
102
|
+
default:
|
|
103
|
+
return {
|
|
104
|
+
checkId: check.id,
|
|
105
|
+
passed: false,
|
|
106
|
+
message: `未知检查类型: ${check.type}`,
|
|
107
|
+
error: `Unknown check type: ${check.type}`,
|
|
108
|
+
};
|
|
153
109
|
}
|
|
154
110
|
}
|
|
155
111
|
|
|
@@ -161,7 +117,18 @@ export class CheckpointValidator {
|
|
|
161
117
|
const handler = context.customHandlers?.get(check.config.customFunction || '');
|
|
162
118
|
|
|
163
119
|
if (handler) {
|
|
164
|
-
|
|
120
|
+
// 用户注入的 handler 是唯一不受本仓控制的分支:抛错译成 CheckResult(与其余 13 族同口径)
|
|
121
|
+
try {
|
|
122
|
+
return await handler(check.config);
|
|
123
|
+
} catch (error) {
|
|
124
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
125
|
+
return {
|
|
126
|
+
checkId: check.id,
|
|
127
|
+
passed: false,
|
|
128
|
+
message: `自定义检查执行失败: ${check.config.customFunction}`,
|
|
129
|
+
error: detail,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
165
132
|
}
|
|
166
133
|
|
|
167
134
|
return {
|
|
@@ -23,11 +23,9 @@ export interface CSOIssue {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
* CSO
|
|
26
|
+
* CSO 验证器(无状态,构造器直建——单例壳已随 ADR-0040 Phase 4 删除)
|
|
27
27
|
*/
|
|
28
28
|
export class CSOValidator {
|
|
29
|
-
private static instance: CSOValidator;
|
|
30
|
-
|
|
31
29
|
// 工作流总结关键词(不应出现在 description 中)
|
|
32
30
|
private static WORKFLOW_KEYWORDS = [
|
|
33
31
|
'step 1', 'step 2', 'phase', 'first', 'then', 'after',
|
|
@@ -39,15 +37,6 @@ export class CSOValidator {
|
|
|
39
37
|
'use when', 'use for', '用于', '当', '适用于', '触发',
|
|
40
38
|
];
|
|
41
39
|
|
|
42
|
-
private constructor() {}
|
|
43
|
-
|
|
44
|
-
static getInstance(): CSOValidator {
|
|
45
|
-
if (!CSOValidator.instance) {
|
|
46
|
-
CSOValidator.instance = new CSOValidator();
|
|
47
|
-
}
|
|
48
|
-
return CSOValidator.instance;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
40
|
/**
|
|
52
41
|
* 验证 Workflow 的 description
|
|
53
42
|
*/
|
|
@@ -282,16 +282,6 @@ export class PassesGate {
|
|
|
282
282
|
return evidenceFile;
|
|
283
283
|
}
|
|
284
284
|
|
|
285
|
-
/**
|
|
286
|
-
* 验证证据存在
|
|
287
|
-
*/
|
|
288
|
-
private async verifyEvidence(evidencePath: string, workDir: string): Promise<boolean> {
|
|
289
|
-
const fullPath = path.isAbsolute(evidencePath)
|
|
290
|
-
? evidencePath
|
|
291
|
-
: path.join(workDir, evidencePath);
|
|
292
|
-
return existsSync(fullPath);
|
|
293
|
-
}
|
|
294
|
-
|
|
295
285
|
}
|
|
296
286
|
|
|
297
287
|
/**
|
package/src/failure/CONTEXT.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
- `ErrorClassifier` — 错误分类器(可配置规则)
|
|
8
8
|
- `FailureRecorder` — 失败记录器(文件存储)
|
|
9
9
|
- `index.ts` 直连类型正本 `src/types/failure.ts`(ErrorType/FailureLevel/FailureRecord/分类规则数据)
|
|
10
|
-
-
|
|
10
|
+
- 数据常量 `DEFAULT_FAILURE_LOG_FILE`(`.harness/logs/failures.log`)、`DEFAULT_CLASSIFICATION_RULES`、`DEFAULT_LEVEL_MAPPING` 正本同在 `src/types/failure.ts`
|
|
11
11
|
|
|
12
12
|
## 依赖关系
|
|
13
13
|
- 依赖 `src/types/` 错误分类/记录类型
|
|
@@ -12,7 +12,8 @@ import * as os from 'os';
|
|
|
12
12
|
import * as path from 'path';
|
|
13
13
|
import { FailureRecorder } from '../recorder';
|
|
14
14
|
import { failureList, failureStats } from '../../cli/commands/failure';
|
|
15
|
-
import {
|
|
15
|
+
import { DEFAULT_FAILURE_LOG_FILE } from '../../types/failure';
|
|
16
|
+
import { ErrorType, FailureLevel } from '../error-types';
|
|
16
17
|
|
|
17
18
|
const CORRUPT_LINE = '{"type":"TEST_FAILED","level":"L1","mess'; // 半写入截断
|
|
18
19
|
|