@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
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* knowledge 投影收口闸(harness#133,架构评审候选4)
|
|
3
3
|
*
|
|
4
|
-
* knowledge 的
|
|
4
|
+
* knowledge 的 9 个子操作原先各自手写「json 投影 + 人读排版」两遍,同一个数据
|
|
5
5
|
* 两处落地、字段名靠人对齐。本文件钉住收口后的四件事:
|
|
6
6
|
*
|
|
7
7
|
* 1. **源形状闸**:`knowledge/` 各子命令文件不再出现 chalk / store 构造 / JSON.stringify,
|
|
8
8
|
* `--json` 分支只余 audit 索引重建一处策略豁免(逐行冻结);上色与分派的唯一落点在
|
|
9
9
|
* `knowledge-view.ts`(store 构造与 JSON.stringify 各恰好一处)。
|
|
10
|
-
* 2. **json 形状冻结**:
|
|
10
|
+
* 2. **json 形状冻结**:9/9 子操作的字段清单逐条对撞(新增/删字段须显式改清单)。
|
|
11
11
|
* 3. **两投影一致性**:同一 fixture 下,display model 里声明的 `field` 锚点必须能在
|
|
12
12
|
* json 面解析到;json 面没有的派生量必须走 `derived` 并在此登记豁免理由(无化石条目)。
|
|
13
13
|
* 4. **人读视图逐行冻结**:改造前的整屏输出逐行留档,防止收口顺带改文案。
|
|
@@ -36,10 +36,8 @@ import { knowledgeSearch, knowledgeSearchView } from '../knowledge/search';
|
|
|
36
36
|
import { knowledgeImport, knowledgeImportView } from '../knowledge/import';
|
|
37
37
|
import { knowledgeDecay, knowledgeDecayView } from '../knowledge/decay';
|
|
38
38
|
import { knowledgeStats, knowledgeStatsView } from '../knowledge/stats';
|
|
39
|
-
import { knowledgeSyncRag, knowledgeSyncRagView } from '../knowledge/sync-rag';
|
|
40
39
|
import { knowledgeAudit, knowledgeAuditView } from '../knowledge/audit';
|
|
41
40
|
import { knowledgeSnapshot, knowledgeSnapshotView } from '../knowledge/snapshot';
|
|
42
|
-
import { knowledgeMigrate, knowledgeMigrateView } from '../knowledge/migrate';
|
|
43
41
|
import { knowledgeIndex, knowledgeIndexView } from '../knowledge/index';
|
|
44
42
|
import { knowledgeHealth, knowledgeHealthView } from '../knowledge/health';
|
|
45
43
|
import { emitKnowledgeView, toneForMaturity, type DisplayCell, type DisplayModel, type KnowledgeView } from '../knowledge-view';
|
|
@@ -50,7 +48,7 @@ const DAY = 24 * 60 * 60 * 1000;
|
|
|
50
48
|
const daysAgo = (n: number): string => new Date(Date.now() - n * DAY).toISOString();
|
|
51
49
|
|
|
52
50
|
// ========================================
|
|
53
|
-
// fixture:3 条知识 + 消费统计 +
|
|
51
|
+
// fixture:3 条知识 + 消费统计 + README(导入源)
|
|
54
52
|
// ========================================
|
|
55
53
|
|
|
56
54
|
function makeEntry(id: string, overrides: Partial<KnowledgeEntry> = {}): KnowledgeEntry {
|
|
@@ -85,10 +83,6 @@ function fixture(): string {
|
|
|
85
83
|
store.save(makeEntry('K-002', { maturity: 'verified' }));
|
|
86
84
|
store.save(makeEntry('K-003', { maturity: 'draft', lastReferenced: '', referencedBy: [], created: daysAgo(200) }));
|
|
87
85
|
fs.writeFileSync(path.join(baseDir, '.consumption-stats.json'), JSON.stringify({ date: '2026-09-02', dailyEvents: 2, searchHits: 1 }));
|
|
88
|
-
const docsDir = path.join(root, '.harness', 'knowledge-docs');
|
|
89
|
-
fs.mkdirSync(docsDir, { recursive: true });
|
|
90
|
-
fs.writeFileSync(path.join(docsDir, 'a.md'), '# a\n');
|
|
91
|
-
fs.writeFileSync(path.join(docsDir, 'b.md'), '# b\n');
|
|
92
86
|
fs.writeFileSync(path.join(root, 'README.md'), '# readme\n\n导入用的说明文档,内容足够长以生成一条知识条目记录。\n');
|
|
93
87
|
return root;
|
|
94
88
|
}
|
|
@@ -101,10 +95,10 @@ function normalize(root: string, text: string): string {
|
|
|
101
95
|
.replace(/\d{4}-\d{2}-\d{2}/g, '<DATE>');
|
|
102
96
|
}
|
|
103
97
|
|
|
104
|
-
/**
|
|
98
|
+
/** 9 个子命令的驱动面:builder(拿两投影)+ command(拿真实 stdout) */
|
|
105
99
|
type SubName =
|
|
106
|
-
| 'list' | 'search' | 'import' | 'decay' | 'stats'
|
|
107
|
-
| 'audit' | 'snapshot' | '
|
|
100
|
+
| 'list' | 'search' | 'import' | 'decay' | 'stats'
|
|
101
|
+
| 'audit' | 'snapshot' | 'index' | 'health';
|
|
108
102
|
|
|
109
103
|
interface SubDriver {
|
|
110
104
|
name: SubName;
|
|
@@ -138,11 +132,6 @@ const SUBS: SubDriver[] = [
|
|
|
138
132
|
build: (r, out) => knowledgeStatsView({ projectPath: r }, out),
|
|
139
133
|
run: (r, out, json) => knowledgeStats({ projectPath: r, json }, out),
|
|
140
134
|
},
|
|
141
|
-
{
|
|
142
|
-
name: 'sync-rag',
|
|
143
|
-
build: r => knowledgeSyncRagView({ projectPath: r }),
|
|
144
|
-
run: (r, out, json) => knowledgeSyncRag({ projectPath: r, json }, out),
|
|
145
|
-
},
|
|
146
135
|
{
|
|
147
136
|
name: 'audit',
|
|
148
137
|
build: (r, out) => knowledgeAuditView({ projectPath: r }, out),
|
|
@@ -153,11 +142,6 @@ const SUBS: SubDriver[] = [
|
|
|
153
142
|
build: (r, out) => knowledgeSnapshotView({ projectPath: r }, out),
|
|
154
143
|
run: (r, out, json) => knowledgeSnapshot({ projectPath: r, json }, out),
|
|
155
144
|
},
|
|
156
|
-
{
|
|
157
|
-
name: 'migrate',
|
|
158
|
-
build: (r, out) => knowledgeMigrateView({ projectPath: r }, out),
|
|
159
|
-
run: (r, out, json) => knowledgeMigrate({ projectPath: r, json }, out),
|
|
160
|
-
},
|
|
161
145
|
{
|
|
162
146
|
name: 'index',
|
|
163
147
|
build: (r, out) => knowledgeIndexView({ projectPath: r }, out),
|
|
@@ -246,7 +230,7 @@ const ENTRY_KEYS = [
|
|
|
246
230
|
];
|
|
247
231
|
|
|
248
232
|
/**
|
|
249
|
-
* json 字段清单冻结(验收 1):
|
|
233
|
+
* json 字段清单冻结(验收 1):9/9 子操作,逐条点名。
|
|
250
234
|
* 路径 '' = 顶层;'entries.0' = 数组首元素的键。比较按排序后的集合。
|
|
251
235
|
*/
|
|
252
236
|
const JSON_FIELD_FREEZE: Record<SubName, Array<{ path: string; keys: string[] }>> = {
|
|
@@ -270,9 +254,6 @@ const JSON_FIELD_FREEZE: Record<SubName, Array<{ path: string; keys: string[] }>
|
|
|
270
254
|
{ path: '', keys: ['total', 'byType', 'byMaturity', 'byLayer', 'flywheel'] },
|
|
271
255
|
{ path: 'flywheel', keys: ['refCoverage', 'avgRefs', 'consumptionHitRate'] },
|
|
272
256
|
],
|
|
273
|
-
'sync-rag': [
|
|
274
|
-
{ path: '', keys: ['directory', 'files'] },
|
|
275
|
-
],
|
|
276
257
|
audit: [
|
|
277
258
|
{ path: '', keys: ['timestamp', 'totalEntries', 'issues', 'summary', 'dimensions', 'autoFixed', 'healthScore'] },
|
|
278
259
|
{ path: 'issues.0', keys: ['rule', 'entryId', 'title', 'severity', 'action', 'detail'] },
|
|
@@ -287,9 +268,6 @@ const JSON_FIELD_FREEZE: Record<SubName, Array<{ path: string; keys: string[] }>
|
|
|
287
268
|
snapshot: [
|
|
288
269
|
{ path: '', keys: ['snapshotPath'] },
|
|
289
270
|
],
|
|
290
|
-
migrate: [
|
|
291
|
-
{ path: '', keys: ['total', 'migrated', 'skipped', 'errors'] },
|
|
292
|
-
],
|
|
293
271
|
index: [
|
|
294
272
|
{ path: '', keys: ['path', 'entries', 'size', 'previousSize'] },
|
|
295
273
|
],
|
|
@@ -330,7 +308,7 @@ const HUMAN_BASELINE: Record<SubName, string[]> = {
|
|
|
330
308
|
import: [
|
|
331
309
|
'📥 开始导入知识 (源: docs, bogus)...',
|
|
332
310
|
' ✅ docs: 1 条',
|
|
333
|
-
' ❌ bogus: 未知源类型: bogus',
|
|
311
|
+
' ❌ bogus: bogus 导入失败: 未知源类型: bogus',
|
|
334
312
|
'',
|
|
335
313
|
'✅ 导入完成: 1 条,1 个错误',
|
|
336
314
|
],
|
|
@@ -362,14 +340,6 @@ const HUMAN_BASELINE: Record<SubName, string[]> = {
|
|
|
362
340
|
' 平均引用: 0.7',
|
|
363
341
|
' 消费命中率: 67%',
|
|
364
342
|
],
|
|
365
|
-
'sync-rag': [
|
|
366
|
-
'📄 RAG sync candidates: 2 files in <TMP>/.harness/knowledge-docs',
|
|
367
|
-
'',
|
|
368
|
-
' a.md',
|
|
369
|
-
' b.md',
|
|
370
|
-
'',
|
|
371
|
-
'Ingest each file into your own knowledge-base backend to sync to RAG',
|
|
372
|
-
],
|
|
373
343
|
audit: [
|
|
374
344
|
'🔍 知识库质量审计...',
|
|
375
345
|
'',
|
|
@@ -408,15 +378,6 @@ const HUMAN_BASELINE: Record<SubName, string[]> = {
|
|
|
408
378
|
snapshot: [
|
|
409
379
|
'✅ 快照已保存: <TMP>/.harness/knowledge/.snapshots/index-<DATE>.json',
|
|
410
380
|
],
|
|
411
|
-
migrate: [
|
|
412
|
-
'🔄 迁移知识条目(添加 consumptionMode/origin 字段)',
|
|
413
|
-
'',
|
|
414
|
-
' 总计: 3 条',
|
|
415
|
-
' 已迁移: 0 条',
|
|
416
|
-
' 已跳过: 3 条',
|
|
417
|
-
'',
|
|
418
|
-
'✅ 所有条目已是最新,无需迁移',
|
|
419
|
-
],
|
|
420
381
|
index: [
|
|
421
382
|
'📇 索引已重建',
|
|
422
383
|
' 路径: <TMP>/.harness/knowledge/_index.md',
|
|
@@ -426,12 +387,12 @@ const HUMAN_BASELINE: Record<SubName, string[]> = {
|
|
|
426
387
|
health: [
|
|
427
388
|
'🏥 飞轮健康检查',
|
|
428
389
|
'',
|
|
429
|
-
' 健康分:
|
|
390
|
+
' 健康分: 67/100',
|
|
430
391
|
' 活跃条目: 3',
|
|
431
392
|
'',
|
|
432
393
|
' 数据流状态:',
|
|
433
394
|
' 引用密度: ✓',
|
|
434
|
-
' 新鲜度: ⚠ 1
|
|
395
|
+
' 新鲜度: ⚠ 1 个过期条目',
|
|
435
396
|
' 消费追踪: ✓',
|
|
436
397
|
'',
|
|
437
398
|
' 飞轮指标:',
|
|
@@ -439,7 +400,11 @@ const HUMAN_BASELINE: Record<SubName, string[]> = {
|
|
|
439
400
|
' 平均引用: 0.7',
|
|
440
401
|
'',
|
|
441
402
|
' 问题 (前 20):',
|
|
442
|
-
' [warn] K-
|
|
403
|
+
' [warn] K-001: 短内容: 内容 48 字符 (阈值 50)',
|
|
404
|
+
' [warn] K-002: 短内容: 内容 48 字符 (阈值 50)',
|
|
405
|
+
' [warn] K-003: 短内容: 内容 48 字符 (阈值 50)',
|
|
406
|
+
' [warn] K-003: promotion 受阻: draft 已 200 天未被引用',
|
|
407
|
+
' [warn] K-003: 过期条目: 超过 200 天未引用 (阈值 90)',
|
|
443
408
|
],
|
|
444
409
|
};
|
|
445
410
|
|
|
@@ -463,11 +428,14 @@ describe('闸 1:源形状——投影分派与上色只有一处', () => {
|
|
|
463
428
|
const code = (lines: string[]): string[] =>
|
|
464
429
|
lines.map(l => l.trim()).filter(l => !l.startsWith('*') && !l.startsWith('//') && !l.startsWith('/*'));
|
|
465
430
|
|
|
466
|
-
it('knowledge/ 各文件不含 chalk / store
|
|
431
|
+
it('knowledge/ 各文件不含 chalk / JSON.stringify;store 构造只有 store-access 一处', () => {
|
|
467
432
|
const lines = code(knowledgeSource);
|
|
468
433
|
expect(lines.filter(l => l.includes("from 'chalk'"))).toEqual([]);
|
|
469
434
|
expect(lines.filter(l => l.includes('chalk.'))).toEqual([]);
|
|
470
|
-
|
|
435
|
+
// store 构造单点 = store-access.ts(ADR-0040 Phase 3 自 knowledge-view 拆出)
|
|
436
|
+
expect(lines.filter(l => /new (File)?KnowledgeStore\(/.test(l))).toEqual([
|
|
437
|
+
'return new FileKnowledgeStore({ baseDir: resolveKnowledgeBaseDir(options, io) });',
|
|
438
|
+
]);
|
|
471
439
|
expect(lines.filter(l => l.includes('JSON.stringify'))).toEqual([]);
|
|
472
440
|
});
|
|
473
441
|
|
|
@@ -490,11 +458,14 @@ describe('闸 1:源形状——投影分派与上色只有一处', () => {
|
|
|
490
458
|
]);
|
|
491
459
|
});
|
|
492
460
|
|
|
493
|
-
it('knowledge-view.ts 是 store
|
|
461
|
+
it('knowledge-view.ts 是 json 投影与上色的唯一落点;store 构造唯一落点 = store-access.ts', () => {
|
|
494
462
|
const lines = code(viewSource);
|
|
495
|
-
expect(lines.filter(l => /new FileKnowledgeStore\(/.test(l))).toHaveLength(1);
|
|
496
463
|
expect(lines.filter(l => l.includes('JSON.stringify'))).toHaveLength(1);
|
|
497
464
|
expect(lines.filter(l => l.includes('import chalk'))).toHaveLength(1);
|
|
465
|
+
const storeAccess = code(
|
|
466
|
+
fs.readFileSync(path.join(SRC_DIR, 'knowledge', 'store-access.ts'), 'utf-8').split('\n')
|
|
467
|
+
);
|
|
468
|
+
expect(storeAccess.filter(l => /new FileKnowledgeStore\(/.test(l))).toHaveLength(1);
|
|
498
469
|
});
|
|
499
470
|
|
|
500
471
|
it('view 模块的 chalk 调用只准出现在角色→样式的单张表里', () => {
|
|
@@ -506,7 +477,7 @@ describe('闸 1:源形状——投影分派与上色只有一处', () => {
|
|
|
506
477
|
});
|
|
507
478
|
});
|
|
508
479
|
|
|
509
|
-
describe('闸 2:
|
|
480
|
+
describe('闸 2:9/9 子操作 --json 字段清单冻结', () => {
|
|
510
481
|
for (const sub of SUBS) {
|
|
511
482
|
it(`${sub.name} 的 json 字段清单 = 冻结清单`, async () => {
|
|
512
483
|
const root = fixture();
|
|
@@ -523,7 +494,7 @@ describe('闸 2:11/11 子操作 --json 字段清单冻结', () => {
|
|
|
523
494
|
});
|
|
524
495
|
}
|
|
525
496
|
|
|
526
|
-
it('冻结清单本身覆盖
|
|
497
|
+
it('冻结清单本身覆盖 9 个子命令(漏登记即红)', () => {
|
|
527
498
|
expect(Object.keys(JSON_FIELD_FREEZE).sort()).toEqual(SUBS.map(s => s.name).sort());
|
|
528
499
|
});
|
|
529
500
|
});
|
|
@@ -653,7 +624,7 @@ describe('闸 4:人读视图逐行冻结(改造前基线)', () => {
|
|
|
653
624
|
const EMPTY_HUMAN_BASELINE: Record<SubName, string[]> = {
|
|
654
625
|
list: ['知识库为空'],
|
|
655
626
|
search: ['未找到匹配 "autolink" 的知识条目'],
|
|
656
|
-
import: ['📥 开始导入知识 (源: docs, bogus)...', ' ❌ bogus: 未知源类型: bogus', '', '✅ 导入完成: 0 条,1 个错误'],
|
|
627
|
+
import: ['📥 开始导入知识 (源: docs, bogus)...', ' ❌ bogus: bogus 导入失败: 未知源类型: bogus', '', '✅ 导入完成: 0 条,1 个错误'],
|
|
657
628
|
decay: ['🔄 运行衰减周期...', '✅ 没有需要衰减的知识条目'],
|
|
658
629
|
stats: [
|
|
659
630
|
'📊 知识库统计',
|
|
@@ -671,7 +642,6 @@ const EMPTY_HUMAN_BASELINE: Record<SubName, string[]> = {
|
|
|
671
642
|
' 平均引用: 0',
|
|
672
643
|
' 消费命中率: 0%',
|
|
673
644
|
],
|
|
674
|
-
'sync-rag': ['No .harness/knowledge-docs/ directory'],
|
|
675
645
|
audit: [
|
|
676
646
|
'🔍 知识库质量审计...',
|
|
677
647
|
'',
|
|
@@ -690,15 +660,6 @@ const EMPTY_HUMAN_BASELINE: Record<SubName, string[]> = {
|
|
|
690
660
|
' 📇 索引已重建',
|
|
691
661
|
],
|
|
692
662
|
snapshot: ['✅ 快照已保存: <TMP>/.harness/knowledge/.snapshots/index-<DATE>.json'],
|
|
693
|
-
migrate: [
|
|
694
|
-
'🔄 迁移知识条目(添加 consumptionMode/origin 字段)',
|
|
695
|
-
'',
|
|
696
|
-
' 总计: 0 条',
|
|
697
|
-
' 已迁移: 0 条',
|
|
698
|
-
' 已跳过: 0 条',
|
|
699
|
-
'',
|
|
700
|
-
'✅ 所有条目已是最新,无需迁移',
|
|
701
|
-
],
|
|
702
663
|
index: [
|
|
703
664
|
'📇 索引已重建',
|
|
704
665
|
' 路径: <TMP>/.harness/knowledge/_index.md',
|
|
@@ -755,95 +716,4 @@ describe('闸 4b:空知识库态逐行冻结', () => {
|
|
|
755
716
|
fs.rmSync(root, { recursive: true, force: true });
|
|
756
717
|
}
|
|
757
718
|
});
|
|
758
|
-
|
|
759
|
-
/**
|
|
760
|
-
* 本票唯一的行为偏离(#133 收尾须知):sync-rag 的两个空态原先把人类文案
|
|
761
|
-
* 直接打到 stdout——`--json` 下吐出的不是 JSON。收口到单点分派后,空态由
|
|
762
|
-
* display model 承担,json 面恒为 `{directory, files}`。零程序化消费者(决策
|
|
763
|
-
* 记录见本目录 CONTEXT.md),故按缺陷修正处理。
|
|
764
|
-
*/
|
|
765
|
-
it('sync-rag 空态在 --json 下产出 JSON 而非人类文案(对改造前行为的有意修正)', async () => {
|
|
766
|
-
const root = emptyRoot();
|
|
767
|
-
try {
|
|
768
|
-
await knowledgeSyncRag({ projectPath: root, json: true }, io);
|
|
769
|
-
expect(lastJsonOutput(io)).toEqual({ directory: `${root}/.harness/knowledge-docs`, files: [] });
|
|
770
|
-
} finally {
|
|
771
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
772
|
-
}
|
|
773
|
-
});
|
|
774
|
-
});
|
|
775
|
-
|
|
776
|
-
/**
|
|
777
|
-
* 同一子命令的第二空态(harness#151 补 #133 闸 4b 的判据)。
|
|
778
|
-
*
|
|
779
|
-
* `emptyRoot()` 是裸的 mkdtemp 目录,天然没有 `.harness/knowledge-docs/` 子目录,于是
|
|
780
|
-
* `syncRagRows`(`knowledge/sync-rag.ts`)的两个空态分支里只有第一个 `!docsPresent` 进过基线;
|
|
781
|
-
* 第二个分支(目录在场、里面没有 `.md`)在测试里**走不到**——按 #133 自己立的判据,
|
|
782
|
-
* 「fixture 走不到的分支不进基线,有基线就是假象」。json 面两分支恒同形
|
|
783
|
-
* (`data = {directory, files}`),所以 `--json` 那条断言也钉不住人读第二行。
|
|
784
|
-
*
|
|
785
|
-
* 数据结构:既有 `EMPTY_HUMAN_BASELINE: Record<SubName, string[]>` 一个子命令只装得下
|
|
786
|
-
* 一种形状,故另立一张平行表按 case 登记,不动既有用例。每个 case 自带建形函数——
|
|
787
|
-
* 多空态不共用一个根。
|
|
788
|
-
*/
|
|
789
|
-
interface EmptyShapeCase {
|
|
790
|
-
sub: SubName;
|
|
791
|
-
/** 分支说明,进用例标题 */
|
|
792
|
-
branch: string;
|
|
793
|
-
/** 该分支的建形方式(与 emptyRoot() 的区别就是要建的那个形) */
|
|
794
|
-
makeRoot(): string;
|
|
795
|
-
baseline: string[];
|
|
796
|
-
/** 该形状下 --json 的形状(两投影一致性在此分支的第二形) */
|
|
797
|
-
json: (root: string) => unknown;
|
|
798
|
-
}
|
|
799
|
-
|
|
800
|
-
/** `knowledge-docs/` 在场但目录里没有 `.md` → syncRagRows 第二分支 */
|
|
801
|
-
function emptyDocsRoot(): string {
|
|
802
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'harness-kview-emptydocs-'));
|
|
803
|
-
fs.mkdirSync(path.join(root, '.harness', 'knowledge-docs'), { recursive: true });
|
|
804
|
-
return root;
|
|
805
|
-
}
|
|
806
|
-
|
|
807
|
-
const EXTRA_EMPTY_HUMAN_CASES: EmptyShapeCase[] = [
|
|
808
|
-
{
|
|
809
|
-
sub: 'sync-rag',
|
|
810
|
-
branch: 'knowledge-docs/ 在场但目录里没有 .md',
|
|
811
|
-
makeRoot: emptyDocsRoot,
|
|
812
|
-
baseline: ['No knowledge docs found'],
|
|
813
|
-
json: root => ({ directory: `${root}/.harness/knowledge-docs`, files: [] }),
|
|
814
|
-
},
|
|
815
|
-
];
|
|
816
|
-
|
|
817
|
-
describe('闸 4c:同一子命令的第二空态逐行冻结(#151 补 #133 判据)', () => {
|
|
818
|
-
for (const testCase of EXTRA_EMPTY_HUMAN_CASES) {
|
|
819
|
-
const driver = SUBS.find(s => s.name === testCase.sub);
|
|
820
|
-
if (!driver) throw new Error(`case 登记的子命令不在驱动面里: ${testCase.sub}`);
|
|
821
|
-
|
|
822
|
-
it(`${testCase.sub} 的「${testCase.branch}」人读输出逐行不变`, async () => {
|
|
823
|
-
const root = testCase.makeRoot();
|
|
824
|
-
const humanIo = captureIO();
|
|
825
|
-
try {
|
|
826
|
-
await driver.run(root, humanIo, false);
|
|
827
|
-
expect(humanIo.outLines().map(l => normalize(root, l))).toEqual(testCase.baseline);
|
|
828
|
-
} finally {
|
|
829
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
830
|
-
}
|
|
831
|
-
});
|
|
832
|
-
|
|
833
|
-
it(`${testCase.sub} 的「${testCase.branch}」在 --json 下仍是两分支同形的那份 data`, async () => {
|
|
834
|
-
const root = testCase.makeRoot();
|
|
835
|
-
try {
|
|
836
|
-
await driver.run(root, io, true);
|
|
837
|
-
expect(lastJsonOutput(io)).toEqual(testCase.json(root));
|
|
838
|
-
} finally {
|
|
839
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
840
|
-
}
|
|
841
|
-
});
|
|
842
|
-
}
|
|
843
|
-
|
|
844
|
-
it('第二形登记的子命令确有独立基线(不借 闸 4b 的第一形蒙过去)', () => {
|
|
845
|
-
for (const testCase of EXTRA_EMPTY_HUMAN_CASES) {
|
|
846
|
-
expect(EMPTY_HUMAN_BASELINE[testCase.sub]).not.toEqual(testCase.baseline);
|
|
847
|
-
}
|
|
848
|
-
});
|
|
849
719
|
});
|
|
@@ -261,11 +261,31 @@ describe('knowledgeHealth CLI', () => {
|
|
|
261
261
|
if (storeSpy) storeSpy.mockRestore();
|
|
262
262
|
});
|
|
263
263
|
|
|
264
|
+
// 健康判定已并回 audit 规则组(ADR-0040 Phase 4):mock 条目须带齐规则读取的字段
|
|
265
|
+
// (真实 store 的 parseFile 会补默认值,mock 绕过该层)
|
|
266
|
+
function healthEntry(overrides: Record<string, unknown>): Record<string, unknown> {
|
|
267
|
+
return {
|
|
268
|
+
id: 'GUI-000',
|
|
269
|
+
type: 'guideline',
|
|
270
|
+
title: 'GUI 条目',
|
|
271
|
+
content: '内容足够长,不触发短内容与零内容规则。',
|
|
272
|
+
maturity: 'verified',
|
|
273
|
+
created: new Date().toISOString(),
|
|
274
|
+
lastReferenced: new Date().toISOString(),
|
|
275
|
+
contributors: ['human'],
|
|
276
|
+
projects: ['harness'],
|
|
277
|
+
tags: [],
|
|
278
|
+
sourceReferences: [],
|
|
279
|
+
referencedBy: [],
|
|
280
|
+
...overrides,
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
|
|
264
284
|
it('should output health score and summary in JSON mode', async () => {
|
|
265
285
|
storeSpy = jest.spyOn(storeModule, 'FileKnowledgeStore').mockImplementation(() => ({
|
|
266
286
|
list: jest.fn().mockReturnValue([
|
|
267
|
-
{ id: 'GUI-001', maturity: 'verified',
|
|
268
|
-
{ id: 'GUI-002', maturity: 'draft'
|
|
287
|
+
healthEntry({ id: 'GUI-001', maturity: 'verified', referencedBy: ['GUI-002'] }),
|
|
288
|
+
healthEntry({ id: 'GUI-002', maturity: 'draft' }),
|
|
269
289
|
]),
|
|
270
290
|
getBaseDir: jest.fn().mockReturnValue('/tmp/knowledge'),
|
|
271
291
|
}));
|
|
@@ -280,7 +300,7 @@ describe('knowledgeHealth CLI', () => {
|
|
|
280
300
|
it('should detect low-reference verified entries', async () => {
|
|
281
301
|
storeSpy = jest.spyOn(storeModule, 'FileKnowledgeStore').mockImplementation(() => ({
|
|
282
302
|
list: jest.fn().mockReturnValue([
|
|
283
|
-
{ id: 'GUI-001', maturity: 'verified'
|
|
303
|
+
healthEntry({ id: 'GUI-001', maturity: 'verified' }),
|
|
284
304
|
]),
|
|
285
305
|
getBaseDir: jest.fn().mockReturnValue('/tmp/knowledge'),
|
|
286
306
|
}));
|
|
@@ -295,7 +315,7 @@ describe('knowledgeHealth CLI', () => {
|
|
|
295
315
|
const oldDate = new Date(Date.now() - 100 * 24 * 60 * 60 * 1000).toISOString(); // 100 days ago
|
|
296
316
|
storeSpy = jest.spyOn(storeModule, 'FileKnowledgeStore').mockImplementation(() => ({
|
|
297
317
|
list: jest.fn().mockReturnValue([
|
|
298
|
-
{ id: 'GUI-001', maturity: 'draft',
|
|
318
|
+
healthEntry({ id: 'GUI-001', maturity: 'draft', created: oldDate, lastReferenced: '' }),
|
|
299
319
|
]),
|
|
300
320
|
getBaseDir: jest.fn().mockReturnValue('/tmp/knowledge'),
|
|
301
321
|
}));
|
|
@@ -36,7 +36,8 @@ import { coverageCheck } from '../passes-gate';
|
|
|
36
36
|
import { FileKnowledgeStore } from '../../../knowledge/store';
|
|
37
37
|
import type { KnowledgeEntry } from '../../../knowledge/types';
|
|
38
38
|
import { FailureRecorder } from '../../../failure/recorder';
|
|
39
|
-
import { DEFAULT_FAILURE_LOG_FILE
|
|
39
|
+
import { DEFAULT_FAILURE_LOG_FILE } from '../../../types/failure';
|
|
40
|
+
import { ErrorType, FailureLevel } from '../../../failure/error-types';
|
|
40
41
|
import { NumericFlagError } from '../../../utils/numeric-flag';
|
|
41
42
|
|
|
42
43
|
const repoRoot = path.join(__dirname, '..', '..', '..', '..');
|
|
@@ -230,7 +230,7 @@ describe('passes-gate command', () => {
|
|
|
230
230
|
expect(io.outText()).toContain('覆盖率达标');
|
|
231
231
|
});
|
|
232
232
|
|
|
233
|
-
it('覆盖率不足:
|
|
233
|
+
it('覆盖率不足:fail(门禁判定结果非零退出)', async () => {
|
|
234
234
|
mockExecAsync.mockResolvedValue({ stdout: '', stderr: '' });
|
|
235
235
|
mockFs.readFile.mockResolvedValue(JSON.stringify({
|
|
236
236
|
total: { lines: { pct: 60 } },
|
|
@@ -238,16 +238,16 @@ describe('passes-gate command', () => {
|
|
|
238
238
|
|
|
239
239
|
const result = await checkCoverage('/project', 80, io);
|
|
240
240
|
|
|
241
|
-
expect(result).toEqual({ kind: '
|
|
241
|
+
expect(result).toEqual({ kind: 'fail', reason: '覆盖率不足: 60% < 80%' });
|
|
242
242
|
expect(io.outText()).toContain('覆盖率不足');
|
|
243
243
|
});
|
|
244
244
|
|
|
245
|
-
it('取不到覆盖率:
|
|
245
|
+
it('取不到覆盖率:fail(fail-loud——「没查到」不是「查过了」,不放行)', async () => {
|
|
246
246
|
mockExecAsync.mockRejectedValue(new Error('command failed'));
|
|
247
247
|
|
|
248
248
|
const result = await checkCoverage('/project', 80, io);
|
|
249
249
|
|
|
250
|
-
expect(result).toEqual({ kind: '
|
|
250
|
+
expect(result).toEqual({ kind: 'fail', reason: expect.stringContaining('无法获取覆盖率信息') });
|
|
251
251
|
expect(io.outText()).toContain('无法获取覆盖率信息');
|
|
252
252
|
});
|
|
253
253
|
|
|
@@ -268,7 +268,7 @@ describe('passes-gate command', () => {
|
|
|
268
268
|
|
|
269
269
|
const result = await checkCoverage('/project', 80);
|
|
270
270
|
|
|
271
|
-
expect(result).toEqual({ kind: '
|
|
271
|
+
expect(result).toEqual({ kind: 'fail', reason: '覆盖率不足: 0% < 80%' });
|
|
272
272
|
});
|
|
273
273
|
});
|
|
274
274
|
|
|
@@ -119,10 +119,9 @@ const DOWNSTREAM_CWD_EXEMPTIONS: Record<string, { lines: string[]; reason: strin
|
|
|
119
119
|
lines: [
|
|
120
120
|
'const projectPath = context.projectPath || process.cwd();',
|
|
121
121
|
'const projectPath = context.projectPath || process.cwd();',
|
|
122
|
-
'const projectPath = context.projectPath || process.cwd();',
|
|
123
122
|
],
|
|
124
123
|
reason:
|
|
125
|
-
'check
|
|
124
|
+
'check 两个 run 入口(checkPrecondition / runAllConstraints)各取一次根兜底,' +
|
|
126
125
|
'git 证据与运行级观察面都从该变量派生、不再内联取 cwd(ADR-0023 步骤 3)',
|
|
127
126
|
},
|
|
128
127
|
'src/core/constraints/checkers/types.ts': {
|
|
@@ -142,15 +141,7 @@ const DOWNSTREAM_CWD_EXEMPTIONS: Record<string, { lines: string[]; reason: strin
|
|
|
142
141
|
'resolveRunEnv 的根兜底:RunTarget 只给了路径或什么也没给时自造一枚一次性观察面' +
|
|
143
142
|
'(配置访问器族与 ProjectConfigLoader 的入参归一点,ADR-0023 决策 2)',
|
|
144
143
|
},
|
|
145
|
-
'src/
|
|
146
|
-
lines: ['const cwd = projectPath || process.cwd();'],
|
|
147
|
-
reason: 'validateAll 的可选 projectPath 兜底(其相对 schemaPath 默认值见闸 3 豁免)',
|
|
148
|
-
},
|
|
149
|
-
'src/gates/checker-gate.ts': {
|
|
150
|
-
lines: ['const projectPath = ctx.projectPath || process.cwd();'],
|
|
151
|
-
reason: 'GateContext.projectPath 缺省兜底(门禁适配器的根入口)',
|
|
152
|
-
},
|
|
153
|
-
'src/hooks/bootstrap.ts': {
|
|
144
|
+
'src/bootstrap/bootstrap.ts': {
|
|
154
145
|
lines: [
|
|
155
146
|
'const resolvedPath = projectPath || process.cwd();',
|
|
156
147
|
'const resolvedPath = projectPath || process.cwd();',
|
|
@@ -176,26 +167,18 @@ const DOWNSTREAM_CWD_EXEMPTIONS: Record<string, { lines: string[]; reason: strin
|
|
|
176
167
|
* - 臂 2 新增常量引用形 `xxxFile: SOME_CONSTANT`(值不在本行,是相对片段正本的另一半)
|
|
177
168
|
*
|
|
178
169
|
* 只扫**使用点**,不冻结常量定义本体(`export const DEFAULT_TRACE_FILE = '.harness/…'` 是正本,
|
|
179
|
-
* 锚定责任在消费点)。扩形后下游层新增命中恰好
|
|
180
|
-
*
|
|
170
|
+
* 锚定责任在消费点)。扩形后下游层新增命中恰好 1 处(本票病灶 traces.ts),连同既有的
|
|
171
|
+
* validator 豁免共 2 条,零假阳性——见下方豁免表。
|
|
181
172
|
*/
|
|
182
173
|
const RELATIVE_PATH_DEFAULT =
|
|
183
174
|
/\b\w+(?:Path|File|Log)\s*(?::\s*[^=,)]+?)?[:=]\s*['"`](?!\/)|\b\w+(?:Path|File|Log)\s*[:=]\s*[A-Z][A-Z0-9_]+\b/;
|
|
184
175
|
|
|
185
176
|
const RELATIVE_PATH_DEFAULT_EXEMPTIONS: Record<string, string> = {
|
|
186
|
-
'src/core/spec/validator.ts':
|
|
187
|
-
'schemaPath: "./specs/schemas" 确实按 cwd 解析(同型病灶)。不随 #95 修:validateFile()/loadSchema() ' +
|
|
188
|
-
'签名里没有根,补齐要把根穿透整个 spec 域(属 spec 重构,非本票两门禁)。CLI 侧 `spec -s` 已 ' +
|
|
189
|
-
'path.resolve(projectPath, schema),给了 -s 时口径正确。留待 spec 域单票收口。',
|
|
190
177
|
'src/monitoring/traces.ts':
|
|
191
178
|
'DEFAULT_CONFIG.traceFile 引用的是**项目相对片段**正本(#139 明确其语义),锚定在构造函数里做:' +
|
|
192
179
|
'给了 projectPath → path.resolve(projectPath, traceFile),没给 → 保持 cwd 解析(跨仓消费者的兼容面)。' +
|
|
193
180
|
'本行是「相对片段」的声明处,不是「按 cwd 打开」的执行处;锚定行为由 monitoring/__tests__/' +
|
|
194
181
|
'trace-file-anchoring.test.ts 与 cli/commands/__tests__/project-path-anchoring.test.ts 站点 3 钉。',
|
|
195
|
-
'src/monitoring/trace-analyzer.ts':
|
|
196
|
-
'summaryFile: ".harness/logs/traces-summary.json" 同型病灶(#139 实测的第二处命中)。不在本票修:' +
|
|
197
|
-
'harness 侧无生产写点(`status` 自 ADR-0020 起直调纯函数,不构造 analyzer),修它等于给无人消费的面' +
|
|
198
|
-
'新增根参数。与 trace 的 failure/summary 三件套同型病灶一并由下游消费方迁移票带走(#139 Out of scope)。',
|
|
199
182
|
};
|
|
200
183
|
|
|
201
184
|
describe('projectPath 传递约定(harness#95)', () => {
|
|
@@ -314,6 +314,8 @@ smoke('bin/harness.js 端到端(dist 存在时)', () => {
|
|
|
314
314
|
// Phase 3 拆分后子命令实现是 knowledge/ 目录下的一文件一子命令
|
|
315
315
|
expect.stringContaining('/dist/cli/commands/knowledge-view.js'),
|
|
316
316
|
expect.stringContaining('/dist/cli/commands/knowledge/list.js'),
|
|
317
|
+
// store 构造单点(store-access)随 knowledge-view 的 re-export 一并懒加载(ADR-0040 Phase 3 拆出)
|
|
318
|
+
expect.stringContaining('/dist/cli/commands/knowledge/store-access.js'),
|
|
317
319
|
]);
|
|
318
320
|
});
|
|
319
321
|
|
|
@@ -216,7 +216,7 @@ describe('release command', () => {
|
|
|
216
216
|
['minor', '0.19.0'],
|
|
217
217
|
['major', '1.0.0'],
|
|
218
218
|
] as const)('dry-run %s:ok 且提示目标版本 %s(不触 npm version)', async (bumpType, expected) => {
|
|
219
|
-
const result = await release({ bumpType, dryRun:
|
|
219
|
+
const result = await release({ bumpType, dryRun: true }, io);
|
|
220
220
|
|
|
221
221
|
expect(result).toEqual({ kind: 'ok' });
|
|
222
222
|
expect(io.outText()).toContain(`Dry-run complete. Would publish: @dommaker/harness@${expected}`);
|
|
@@ -127,22 +127,36 @@ describe('review command', () => {
|
|
|
127
127
|
expect(io.outText()).toContain('APPROVED');
|
|
128
128
|
});
|
|
129
129
|
|
|
130
|
-
it('should handle no PR found', async () => {
|
|
130
|
+
it('should handle no PR found(gh 说没有 PR = 合法状态,提示并 ok)', async () => {
|
|
131
131
|
mockExec
|
|
132
132
|
.mockResolvedValueOnce({ stdout: 'feature-branch\n', stderr: '' })
|
|
133
|
-
.mockRejectedValueOnce(new Error('
|
|
133
|
+
.mockRejectedValueOnce(new Error('Command failed: gh pr view\nno pull requests found for branch'));
|
|
134
134
|
|
|
135
|
-
await reviewStatus({}, io);
|
|
135
|
+
const result = await reviewStatus({}, io);
|
|
136
136
|
|
|
137
137
|
expect(io.outText()).toContain('未找到关联的 PR');
|
|
138
|
+
expect(result.kind).toBe('ok');
|
|
138
139
|
});
|
|
139
140
|
|
|
140
|
-
it('
|
|
141
|
-
mockExec
|
|
141
|
+
it('gh 调用失败(未安装/超时/认证) → fail,不报成「未找到 PR」', async () => {
|
|
142
|
+
mockExec
|
|
143
|
+
.mockResolvedValueOnce({ stdout: 'feature-branch\n', stderr: '' })
|
|
144
|
+
.mockRejectedValueOnce(new Error('Command failed: gh pr view\ngh: command not found'));
|
|
142
145
|
|
|
143
|
-
await reviewStatus({}, io);
|
|
146
|
+
const result = await reviewStatus({}, io);
|
|
144
147
|
|
|
148
|
+
expect(io.outText()).not.toContain('未找到关联的 PR');
|
|
145
149
|
expect(io.outText()).toContain('获取审查状态失败');
|
|
150
|
+
expect(result.kind).toBe('fail');
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
it('should handle git errors(非 git 仓 = 合法 skip)', async () => {
|
|
154
|
+
mockExec.mockRejectedValue(new Error('not a git repository'));
|
|
155
|
+
|
|
156
|
+
const result = await reviewStatus({}, io);
|
|
157
|
+
|
|
158
|
+
expect(io.outText()).toContain('不是 Git 仓库');
|
|
159
|
+
expect(result.kind).toBe('skip');
|
|
146
160
|
});
|
|
147
161
|
});
|
|
148
162
|
});
|
|
@@ -109,6 +109,20 @@ describe('security command', () => {
|
|
|
109
109
|
expect(io.outText()).toContain('未发现安全漏洞');
|
|
110
110
|
});
|
|
111
111
|
|
|
112
|
+
it('scan 失败(deny 无漏洞清单)→ fail 不假绿', async () => {
|
|
113
|
+
const mockScan = jest.fn().mockResolvedValue({
|
|
114
|
+
passed: false,
|
|
115
|
+
message: '安全扫描失败: npm audit 退出码 1 且无 JSON 输出',
|
|
116
|
+
details: undefined,
|
|
117
|
+
});
|
|
118
|
+
MockGate.mockImplementation(() => ({ scan: mockScan }) as any);
|
|
119
|
+
|
|
120
|
+
const result = await auditDetails({}, io);
|
|
121
|
+
|
|
122
|
+
expect(result.kind).toBe('fail');
|
|
123
|
+
expect(io.outText()).toContain('安全扫描失败');
|
|
124
|
+
});
|
|
125
|
+
|
|
112
126
|
it('should list vulnerabilities when present', async () => {
|
|
113
127
|
const mockScan = jest.fn().mockResolvedValue({
|
|
114
128
|
passed: false,
|
|
@@ -277,9 +277,9 @@ describe('一次 spec-baseline-check 的读取计数闸(#146)', () => {
|
|
|
277
277
|
|
|
278
278
|
await specBaselineCheck(path.join(dir, 'spec.md'), { json: true, projectPath: dir }, io);
|
|
279
279
|
|
|
280
|
-
//
|
|
280
|
+
// 判定照旧:缺失就是「package.json 不存在」,每条前置各报一次(损坏则直接抛,不落 evidence)
|
|
281
281
|
const results = JSON.parse(io.outText()) as Array<{ satisfied: boolean; evidence: string }>;
|
|
282
|
-
const failures = results.filter((r) => r.evidence === '
|
|
282
|
+
const failures = results.filter((r) => r.evidence === 'package.json 不存在');
|
|
283
283
|
expect(failures).toHaveLength(2);
|
|
284
284
|
expect(failures.every((r) => !r.satisfied)).toBe(true);
|
|
285
285
|
|