@dommaker/harness 1.16.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 +35 -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 -103
- 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/command-contract.d.ts +6 -9
- package/dist/cli/command-contract.d.ts.map +1 -1
- package/dist/cli/command-contract.js +6 -0
- package/dist/cli/command-contract.js.map +1 -1
- package/dist/cli/commands/acceptance.d.ts.map +1 -1
- package/dist/cli/commands/acceptance.js +9 -8
- 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 +19 -9
- 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 +24 -16
- 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 +13 -17
- 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/init/ci-platform.d.ts +35 -0
- package/dist/cli/commands/init/ci-platform.d.ts.map +1 -0
- package/dist/cli/commands/init/ci-platform.js +59 -0
- package/dist/cli/commands/init/ci-platform.js.map +1 -0
- package/dist/cli/commands/init/ci-wiring.d.ts +20 -0
- package/dist/cli/commands/init/ci-wiring.d.ts.map +1 -0
- package/dist/cli/commands/init/ci-wiring.js +72 -0
- package/dist/cli/commands/init/ci-wiring.js.map +1 -0
- package/dist/cli/commands/init/git-hooks.d.ts +15 -0
- package/dist/cli/commands/init/git-hooks.d.ts.map +1 -0
- package/dist/cli/commands/init/git-hooks.js +64 -0
- package/dist/cli/commands/init/git-hooks.js.map +1 -0
- package/dist/cli/commands/init/governance.d.ts +14 -0
- package/dist/cli/commands/init/governance.d.ts.map +1 -0
- package/dist/cli/commands/init/governance.js +132 -0
- package/dist/cli/commands/init/governance.js.map +1 -0
- package/dist/cli/commands/{init.d.ts → init/index.d.ts} +13 -14
- package/dist/cli/commands/init/index.d.ts.map +1 -0
- package/dist/cli/commands/init/index.js +148 -0
- package/dist/cli/commands/init/index.js.map +1 -0
- package/dist/cli/commands/init/output-style.d.ts +19 -0
- package/dist/cli/commands/init/output-style.d.ts.map +1 -0
- package/dist/cli/commands/init/output-style.js +110 -0
- package/dist/cli/commands/init/output-style.js.map +1 -0
- package/dist/cli/commands/init/presets.d.ts +26 -0
- package/dist/cli/commands/init/presets.d.ts.map +1 -0
- package/dist/cli/commands/init/presets.js +104 -0
- package/dist/cli/commands/init/presets.js.map +1 -0
- package/dist/cli/commands/init/snippets.d.ts +18 -0
- package/dist/cli/commands/init/snippets.d.ts.map +1 -0
- package/dist/cli/commands/init/snippets.js +49 -0
- package/dist/cli/commands/init/snippets.js.map +1 -0
- package/dist/cli/commands/knowledge/audit.d.ts +30 -0
- package/dist/cli/commands/knowledge/audit.d.ts.map +1 -0
- package/dist/cli/commands/knowledge/audit.js +114 -0
- package/dist/cli/commands/knowledge/audit.js.map +1 -0
- package/dist/cli/commands/knowledge/decay.d.ts +19 -0
- package/dist/cli/commands/knowledge/decay.d.ts.map +1 -0
- package/dist/cli/commands/knowledge/decay.js +48 -0
- package/dist/cli/commands/knowledge/decay.js.map +1 -0
- package/dist/cli/commands/knowledge/health.d.ts +38 -0
- package/dist/cli/commands/knowledge/health.d.ts.map +1 -0
- package/dist/cli/commands/knowledge/health.js +178 -0
- package/dist/cli/commands/knowledge/health.js.map +1 -0
- package/dist/cli/commands/knowledge/import.d.ts +26 -0
- package/dist/cli/commands/knowledge/import.d.ts.map +1 -0
- package/dist/cli/commands/knowledge/import.js +63 -0
- package/dist/cli/commands/knowledge/import.js.map +1 -0
- package/dist/cli/commands/knowledge/index.d.ts +25 -0
- package/dist/cli/commands/knowledge/index.d.ts.map +1 -0
- package/dist/cli/commands/knowledge/index.js +84 -0
- package/dist/cli/commands/knowledge/index.js.map +1 -0
- package/dist/cli/commands/knowledge/list.d.ts +25 -0
- package/dist/cli/commands/knowledge/list.d.ts.map +1 -0
- package/dist/cli/commands/knowledge/list.js +60 -0
- package/dist/cli/commands/knowledge/list.js.map +1 -0
- package/dist/cli/commands/knowledge/search.d.ts +32 -0
- package/dist/cli/commands/knowledge/search.d.ts.map +1 -0
- package/dist/cli/commands/knowledge/search.js +72 -0
- package/dist/cli/commands/knowledge/search.js.map +1 -0
- package/dist/cli/commands/knowledge/shared.d.ts +14 -0
- package/dist/cli/commands/knowledge/shared.d.ts.map +1 -0
- package/dist/cli/commands/knowledge/shared.js +6 -0
- package/dist/cli/commands/knowledge/shared.js.map +1 -0
- package/dist/cli/commands/knowledge/snapshot.d.ts +18 -0
- package/dist/cli/commands/knowledge/snapshot.d.ts.map +1 -0
- package/dist/cli/commands/knowledge/snapshot.js +34 -0
- package/dist/cli/commands/knowledge/snapshot.js.map +1 -0
- package/dist/cli/commands/knowledge/stats.d.ts +26 -0
- package/dist/cli/commands/knowledge/stats.d.ts.map +1 -0
- package/dist/cli/commands/knowledge/stats.js +132 -0
- package/dist/cli/commands/knowledge/stats.js.map +1 -0
- 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 +8 -19
- package/dist/cli/commands/knowledge-view.d.ts.map +1 -1
- package/dist/cli/commands/knowledge-view.js +12 -63
- 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 +19 -8
- package/dist/cli/commands/passes-gate.js.map +1 -1
- package/dist/cli/commands/performance.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 +25 -59
- 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 +17 -5
- 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 +13 -8
- package/dist/cli/commands/security.js.map +1 -1
- package/dist/{core → cli/commands}/spec/validator.d.ts +10 -19
- package/dist/cli/commands/spec/validator.d.ts.map +1 -0
- package/dist/{core → cli/commands}/spec/validator.js +52 -78
- 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 +32 -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 +2 -2
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/sync-docs/agents-syncer.js +31 -55
- package/dist/cli/commands/sync-docs/agents-syncer.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 +13 -13
- package/dist/cli/commands/sync-docs/capabilities-syncer.js.map +1 -1
- package/dist/cli/commands/sync-docs/compact.d.ts +9 -0
- package/dist/cli/commands/sync-docs/compact.d.ts.map +1 -0
- package/dist/cli/commands/sync-docs/compact.js +73 -0
- package/dist/cli/commands/sync-docs/compact.js.map +1 -0
- package/dist/cli/commands/sync-docs/context-syncer.d.ts.map +1 -1
- package/dist/cli/commands/sync-docs/context-syncer.js +17 -36
- package/dist/cli/commands/sync-docs/context-syncer.js.map +1 -1
- package/dist/cli/commands/sync-docs/gate.d.ts +27 -0
- package/dist/cli/commands/sync-docs/gate.d.ts.map +1 -0
- package/dist/cli/commands/sync-docs/gate.js +72 -0
- package/dist/cli/commands/sync-docs/gate.js.map +1 -0
- package/dist/cli/commands/sync-docs/index.d.ts +13 -27
- package/dist/cli/commands/sync-docs/index.d.ts.map +1 -1
- package/dist/cli/commands/sync-docs/index.js +19 -529
- package/dist/cli/commands/sync-docs/index.js.map +1 -1
- package/dist/cli/commands/sync-docs/main-flow.d.ts +21 -0
- package/dist/cli/commands/sync-docs/main-flow.d.ts.map +1 -0
- package/dist/cli/commands/sync-docs/main-flow.js +93 -0
- package/dist/cli/commands/sync-docs/main-flow.js.map +1 -0
- package/dist/cli/commands/sync-docs/project-reader.d.ts +1 -1
- package/dist/cli/commands/sync-docs/project-reader.d.ts.map +1 -1
- package/dist/cli/commands/sync-docs/project-reader.js +18 -26
- 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/cli/gate-command.d.ts +1 -1
- package/dist/cli/gate-command.d.ts.map +1 -1
- package/dist/context/index.d.ts +2 -4
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +2 -5
- package/dist/context/index.js.map +1 -1
- package/dist/context/session-manager.d.ts +2 -6
- package/dist/context/session-manager.d.ts.map +1 -1
- package/dist/context/session-manager.js +27 -84
- package/dist/context/session-manager.js.map +1 -1
- package/dist/context/types.d.ts +3 -25
- 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 +27 -31
- package/dist/core/constraint-lifecycle.js.map +1 -1
- package/dist/core/constraints/capabilities-parser.d.ts +2 -1
- package/dist/core/constraints/capabilities-parser.d.ts.map +1 -1
- package/dist/core/constraints/capabilities-parser.js +4 -6
- package/dist/core/constraints/capabilities-parser.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 +4 -8
- package/dist/core/constraints/checkers/templated/exec.js.map +1 -1
- package/dist/core/constraints/checkers/templated/file-exists.js +1 -1
- package/dist/core/constraints/checkers/templated/file-exists.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 -102
- 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 -21
- 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} +18 -5
- 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 +192 -224
- 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/git-evidence.d.ts.map +1 -1
- package/dist/core/constraints/git-evidence.js +2 -0
- package/dist/core/constraints/git-evidence.js.map +1 -1
- 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/injection-writer.d.ts +1 -0
- package/dist/core/constraints/injection-writer.d.ts.map +1 -1
- package/dist/core/constraints/injection-writer.js +3 -6
- package/dist/core/constraints/injection-writer.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 -41
- 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/command.d.ts.map +1 -1
- package/dist/core/validators/check-handlers/command.js +7 -4
- package/dist/core/validators/check-handlers/command.js.map +1 -1
- 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/check-handlers/http.d.ts.map +1 -1
- package/dist/core/validators/check-handlers/http.js +6 -4
- package/dist/core/validators/check-handlers/http.js.map +1 -1
- package/dist/core/validators/check-handlers/output.d.ts +1 -1
- package/dist/core/validators/check-handlers/output.d.ts.map +1 -1
- package/dist/core/validators/check-handlers/output.js +2 -1
- package/dist/core/validators/check-handlers/output.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 +2 -5
- package/dist/core/validators/passes-gate.d.ts.map +1 -1
- package/dist/core/validators/passes-gate.js +21 -35
- 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 +43 -19
- package/dist/gates/acceptance.d.ts.map +1 -1
- package/dist/gates/acceptance.js +148 -122
- package/dist/gates/acceptance.js.map +1 -1
- package/dist/gates/command.d.ts +1 -17
- 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 +11 -10
- package/dist/gates/contract.d.ts.map +1 -1
- package/dist/gates/contract.js +55 -74
- package/dist/gates/contract.js.map +1 -1
- package/dist/gates/definitions.d.ts +1 -1
- package/dist/gates/performance.d.ts +2 -16
- package/dist/gates/performance.d.ts.map +1 -1
- package/dist/gates/performance.js +18 -27
- package/dist/gates/performance.js.map +1 -1
- package/dist/gates/registry.d.ts.map +1 -1
- package/dist/gates/registry.js +3 -2
- 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 +38 -21
- package/dist/gates/review.js.map +1 -1
- package/dist/gates/security.d.ts +6 -9
- package/dist/gates/security.d.ts.map +1 -1
- package/dist/gates/security.js +42 -76
- package/dist/gates/security.js.map +1 -1
- package/dist/gates/types.d.ts +11 -78
- package/dist/gates/types.d.ts.map +1 -1
- package/dist/gates/types.js +5 -1
- package/dist/gates/types.js.map +1 -1
- package/dist/index.d.ts +20 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -18
- package/dist/index.js.map +1 -1
- package/dist/knowledge/audit-dimensions.d.ts +45 -0
- package/dist/knowledge/audit-dimensions.d.ts.map +1 -0
- package/dist/knowledge/audit-dimensions.js +144 -0
- package/dist/knowledge/audit-dimensions.js.map +1 -0
- package/dist/knowledge/audit-rules.d.ts +43 -0
- package/dist/knowledge/audit-rules.d.ts.map +1 -0
- package/dist/knowledge/audit-rules.js +272 -0
- package/dist/knowledge/audit-rules.js.map +1 -0
- package/dist/knowledge/audit-scoring.d.ts +6 -60
- package/dist/knowledge/audit-scoring.d.ts.map +1 -1
- package/dist/knowledge/audit-scoring.js +8 -391
- package/dist/knowledge/audit-scoring.js.map +1 -1
- package/dist/knowledge/audit.d.ts +6 -3
- package/dist/knowledge/audit.d.ts.map +1 -1
- package/dist/knowledge/audit.js +12 -7
- 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} +136 -182
- package/dist/knowledge/cold-start.js.map +1 -0
- package/dist/knowledge/index-generator.d.ts +2 -0
- package/dist/knowledge/index-generator.d.ts.map +1 -1
- package/dist/knowledge/index-generator.js +43 -50
- package/dist/knowledge/index-generator.js.map +1 -1
- package/dist/knowledge/index.d.ts +7 -7
- package/dist/knowledge/index.d.ts.map +1 -1
- package/dist/knowledge/index.js +4 -9
- package/dist/knowledge/index.js.map +1 -1
- package/dist/knowledge/ingest.d.ts +50 -6
- package/dist/knowledge/ingest.d.ts.map +1 -1
- package/dist/knowledge/ingest.js +109 -16
- 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 +29 -41
- package/dist/knowledge/lifecycle.js.map +1 -1
- package/dist/knowledge/query.d.ts +1 -1
- package/dist/knowledge/query.d.ts.map +1 -1
- package/dist/knowledge/query.js +8 -8
- 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 +26 -63
- 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 +3 -54
- package/dist/monitoring/trace-analyzer.d.ts.map +1 -1
- package/dist/monitoring/trace-analyzer.js +9 -136
- 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 +9 -29
- package/dist/monitoring/traces.js.map +1 -1
- package/dist/pretool-use-hook.d.ts +1 -1
- package/dist/pretool-use-hook.d.ts.map +1 -1
- package/dist/pretool-use-hook.js +12 -19
- package/dist/pretool-use-hook.js.map +1 -1
- package/dist/release/integrity.d.ts.map +1 -1
- package/dist/release/integrity.js +8 -8
- package/dist/release/integrity.js.map +1 -1
- package/dist/sdd/index-generator.d.ts.map +1 -1
- package/dist/sdd/index-generator.js +4 -0
- package/dist/sdd/index-generator.js.map +1 -1
- package/dist/types/checkpoint.d.ts +8 -8
- package/dist/types/checkpoint.d.ts.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/command-io.d.ts +19 -0
- package/dist/types/command-io.d.ts.map +1 -0
- package/dist/types/command-io.js +3 -0
- package/dist/types/command-io.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/gate.d.ts +72 -0
- package/dist/types/gate.d.ts.map +1 -0
- package/dist/types/gate.js +13 -0
- package/dist/types/gate.js.map +1 -0
- 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/attempt.d.ts +22 -0
- package/dist/utils/attempt.d.ts.map +1 -0
- package/dist/utils/attempt.js +40 -0
- package/dist/utils/attempt.js.map +1 -0
- 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/detect-source-roots.d.ts.map +1 -1
- package/dist/utils/detect-source-roots.js +42 -51
- package/dist/utils/detect-source-roots.js.map +1 -1
- 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/file-walk.d.ts +2 -1
- package/dist/utils/file-walk.d.ts.map +1 -1
- package/dist/utils/file-walk.js +3 -8
- package/dist/utils/file-walk.js.map +1 -1
- 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 +49 -0
- package/dist/utils/package-json.d.ts.map +1 -0
- package/dist/utils/package-json.js +78 -0
- package/dist/utils/package-json.js.map +1 -0
- package/dist/utils/package-version.d.ts +5 -2
- package/dist/utils/package-version.d.ts.map +1 -1
- package/dist/utils/package-version.js +8 -11
- package/dist/utils/package-version.js.map +1 -1
- package/package.json +1 -6
- package/src/CONTEXT.md +12 -11
- package/src/__tests__/acceptance-gate.test.ts +23 -51
- 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 +1 -33
- 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__/install-precommit-hook.test.ts +61 -0
- package/src/__tests__/iron-laws.test.ts +14 -21
- package/src/__tests__/layering.test.ts +4 -4
- package/src/__tests__/project-config-loader.test.ts +2 -1
- package/src/__tests__/public-exports.test.ts +5 -16
- package/src/__tests__/public-type-surface.test.ts +10 -41
- package/src/__tests__/public-value-surface.test.ts +9 -20
- 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 +9 -11
- 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 -116
- 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/__tests__/command-contract.test.ts +18 -0
- package/src/cli/command-contract.ts +8 -5
- package/src/cli/commands/CONTEXT.md +21 -21
- 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__/check.test.ts +1 -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__/constraints-retire.test.ts +5 -3
- 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__/init-governance-io.test.ts +7 -2
- package/src/cli/commands/__tests__/init.test.ts +1 -1
- package/src/cli/commands/__tests__/knowledge-audit-threshold.test.ts +14 -8
- package/src/cli/commands/__tests__/knowledge-flywheel-consistency.test.ts +2 -1
- package/src/cli/commands/__tests__/knowledge-view.test.ts +52 -172
- package/src/cli/commands/__tests__/knowledge.test.ts +30 -6
- package/src/cli/commands/__tests__/numeric-flag-assembly.test.ts +3 -2
- package/src/cli/commands/__tests__/passes-gate.test.ts +105 -29
- package/src/cli/commands/__tests__/project-path-anchoring.test.ts +3 -6
- package/src/cli/commands/__tests__/project-path-convention.test.ts +4 -21
- package/src/cli/commands/__tests__/registry.test.ts +5 -2
- package/src/cli/commands/__tests__/release.test.ts +25 -3
- package/src/cli/commands/__tests__/report-false-green.test.ts +10 -6
- 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 +11 -10
- package/src/cli/commands/check.ts +12 -6
- package/src/cli/commands/command.ts +8 -7
- 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 +33 -12
- package/src/cli/commands/contract.ts +33 -20
- package/src/cli/commands/definitions.ts +23 -94
- package/src/cli/commands/failure.ts +7 -8
- package/src/cli/commands/init/ci-platform.ts +66 -0
- package/src/cli/commands/init/ci-wiring.ts +48 -0
- package/src/cli/commands/init/git-hooks.ts +31 -0
- package/src/cli/commands/init/governance.ts +127 -0
- package/src/cli/commands/init/index.ts +156 -0
- package/src/cli/commands/init/output-style.ts +82 -0
- package/src/cli/commands/init/presets.ts +105 -0
- package/src/cli/commands/init/snippets.ts +57 -0
- package/src/cli/commands/knowledge/audit.ts +155 -0
- package/src/cli/commands/knowledge/decay.ts +57 -0
- package/src/cli/commands/knowledge/health.ts +180 -0
- package/src/cli/commands/knowledge/import.ts +82 -0
- package/src/cli/commands/knowledge/index.ts +60 -0
- package/src/cli/commands/knowledge/list.ts +73 -0
- package/src/cli/commands/knowledge/search.ts +92 -0
- package/src/cli/commands/knowledge/shared.ts +13 -0
- package/src/cli/commands/knowledge/snapshot.ts +38 -0
- package/src/cli/commands/knowledge/stats.ts +112 -0
- package/src/cli/commands/knowledge/store-access.ts +40 -0
- package/src/cli/commands/knowledge-view.ts +11 -34
- package/src/cli/commands/passes-gate.ts +23 -10
- package/src/cli/commands/performance.ts +2 -2
- package/src/cli/commands/release.ts +26 -22
- package/src/cli/commands/review.ts +19 -7
- package/src/cli/commands/security.ts +17 -11
- package/src/{core → cli/commands}/spec/__tests__/validator.test.ts +75 -61
- package/src/{core → cli/commands}/spec/validator.ts +65 -94
- package/src/cli/commands/spec-baseline-check.ts +37 -315
- package/src/cli/commands/spec.ts +15 -11
- package/src/cli/commands/status.ts +2 -4
- package/src/cli/commands/sync-docs/agents-syncer.ts +28 -47
- package/src/cli/commands/sync-docs/capabilities-syncer.ts +14 -13
- package/src/cli/commands/sync-docs/compact.ts +36 -0
- package/src/cli/commands/sync-docs/context-syncer.ts +15 -31
- package/src/cli/commands/sync-docs/gate.ts +78 -0
- package/src/cli/commands/sync-docs/index.ts +21 -585
- package/src/cli/commands/sync-docs/main-flow.ts +109 -0
- package/src/cli/commands/sync-docs/project-reader.ts +23 -25
- 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/cli/gate-command.ts +1 -1
- package/src/context/CONTEXT.md +6 -6
- package/src/context/__tests__/session-manager.test.ts +1 -41
- package/src/context/index.ts +1 -10
- package/src/context/session-manager.ts +30 -90
- package/src/context/types.ts +3 -38
- package/src/core/CONTEXT.md +11 -11
- package/src/core/app-constraints-loader.ts +5 -23
- package/src/core/constraint-lifecycle.ts +31 -40
- 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/capabilities-parser.ts +4 -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 +2 -7
- package/src/core/constraints/checkers/templated/file-exists.ts +1 -1
- 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 -102
- package/src/core/constraints/definitions/{iron-laws.ts → errors.ts} +0 -21
- package/src/core/constraints/definitions/{guidelines.ts → warnings.ts} +18 -4
- package/src/core/constraints/definitions.ts +4 -3
- package/src/core/constraints/doc-freshness/runner.ts +201 -232
- package/src/core/constraints/find-constraint.ts +24 -0
- package/src/core/constraints/git-evidence.ts +2 -0
- package/src/core/constraints/governance-accessors.ts +74 -0
- package/src/core/constraints/index.ts +0 -5
- package/src/core/constraints/injection-writer.ts +3 -6
- 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 -67
- 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/__tests__/passes-gate-counts.test.ts +52 -0
- package/src/core/validators/check-handlers/command.ts +9 -6
- package/src/core/validators/check-handlers/file.ts +48 -5
- package/src/core/validators/check-handlers/http.ts +8 -6
- package/src/core/validators/check-handlers/output.ts +7 -6
- package/src/core/validators/checkpoint.ts +52 -85
- package/src/core/validators/cso.ts +1 -12
- package/src/core/validators/passes-gate.ts +27 -38
- 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 +9 -10
- package/src/gates/__tests__/acceptance-types-single-source.test.ts +16 -14
- package/src/gates/__tests__/acceptance.test.ts +69 -94
- package/src/gates/__tests__/command-single-predicate.test.ts +16 -61
- package/src/gates/__tests__/command.test.ts +23 -25
- package/src/gates/__tests__/gate-interface.test.ts +5 -10
- package/src/gates/__tests__/performance.test.ts +8 -54
- 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 +30 -61
- package/src/gates/acceptance.ts +199 -156
- package/src/gates/command.ts +1 -34
- package/src/gates/contract.ts +83 -93
- package/src/gates/definitions.ts +1 -1
- package/src/gates/performance.ts +36 -43
- package/src/gates/registry.ts +4 -3
- package/src/gates/review.ts +68 -31
- package/src/gates/security.ts +69 -96
- package/src/gates/types.ts +22 -84
- package/src/index.ts +11 -32
- package/src/knowledge/CONTEXT.md +21 -25
- package/src/knowledge/__tests__/audit-labels.test.ts +3 -3
- package/src/knowledge/__tests__/audit-scoring.test.ts +9 -7
- 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 +19 -20
- package/src/knowledge/__tests__/store.test.ts +6 -10
- package/src/knowledge/__tests__/tree-walker.test.ts +5 -13
- package/src/knowledge/audit-dimensions.ts +190 -0
- package/src/knowledge/audit-rules.ts +339 -0
- package/src/knowledge/audit-scoring.ts +7 -495
- package/src/knowledge/audit.ts +12 -12
- package/src/knowledge/{import.ts → cold-start.ts} +150 -192
- package/src/knowledge/index-generator.ts +48 -53
- package/src/knowledge/index.ts +6 -11
- package/src/knowledge/ingest.ts +137 -19
- package/src/knowledge/lifecycle.ts +28 -38
- package/src/knowledge/query.ts +8 -7
- package/src/knowledge/store.ts +29 -66
- 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 +12 -168
- package/src/monitoring/traces.ts +11 -35
- package/src/pretool-use-hook.ts +26 -21
- package/src/release/CONTEXT.md +1 -1
- package/src/release/__tests__/integrity.test.ts +0 -2
- package/src/release/integrity.ts +8 -9
- package/src/sdd/index-generator.ts +4 -0
- package/src/types/checkpoint.ts +8 -8
- package/src/types/command-definition.ts +85 -0
- package/src/types/command-io.ts +14 -0
- package/src/types/constraint.ts +3 -32
- package/src/types/failure.ts +7 -113
- package/src/types/gate.ts +77 -0
- package/src/types/spec.ts +0 -4
- package/src/types/trace.ts +0 -6
- package/src/utils/__tests__/attempt.test.ts +94 -0
- package/src/utils/__tests__/jsonl-skip-disposition.test.ts +4 -7
- package/src/utils/__tests__/package-json.test.ts +58 -0
- package/src/utils/__tests__/package-version.test.ts +21 -2
- package/src/utils/attempt.ts +35 -0
- package/src/utils/clip.ts +12 -0
- package/src/utils/detect-source-roots.ts +38 -44
- package/src/utils/diff-parse.ts +80 -0
- package/src/utils/file-walk.ts +3 -7
- 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 +61 -0
- package/src/utils/package-version.ts +8 -10
- package/dist/cli/commands/init.d.ts.map +0 -1
- package/dist/cli/commands/init.js +0 -502
- package/dist/cli/commands/init.js.map +0 -1
- package/dist/cli/commands/knowledge.d.ts +0 -169
- package/dist/cli/commands/knowledge.d.ts.map +0 -1
- package/dist/cli/commands/knowledge.js +0 -700
- package/dist/cli/commands/knowledge.js.map +0 -1
- package/dist/context/knowledge-injector.d.ts +0 -51
- package/dist/context/knowledge-injector.d.ts.map +0 -1
- package/dist/context/knowledge-injector.js +0 -128
- package/dist/context/knowledge-injector.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/gates/index.d.ts +0 -10
- package/dist/gates/index.d.ts.map +0 -1
- package/dist/gates/index.js +0 -11
- package/dist/gates/index.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 -125
- package/dist/knowledge/reference-tracker.js.map +0 -1
- package/src/__tests__/spec-validator.test.ts +0 -58
- package/src/cli/commands/init.ts +0 -590
- package/src/cli/commands/knowledge.ts +0 -820
- package/src/context/__tests__/knowledge-injector.test.ts +0 -197
- package/src/context/knowledge-injector.ts +0 -174
- 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/gates/index.ts +0 -11
- 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 -101
- /package/src/{hooks → bootstrap}/__tests__/bootstrap.test.ts +0 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* harness knowledge import 子命令(冷启动导入;Phase 3 自 knowledge.ts 拆出,纯移位)
|
|
3
|
+
*
|
|
4
|
+
* 本文件只做「取数 + 声明两投影」:json 面正本在 `data`,人读排版在 `human()` 的
|
|
5
|
+
* display model。上色、label 映射、json/人读分派、退出码、路径解析与 store 构造
|
|
6
|
+
* 统一在 knowledge-view.ts(harness#133,架构评审候选4)。
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { ColdStartImporter } from '../../../knowledge/cold-start';
|
|
10
|
+
import { processIO, type CommandIO, type CommandResult } from '../../command-contract';
|
|
11
|
+
import {
|
|
12
|
+
announce,
|
|
13
|
+
blankLine,
|
|
14
|
+
emitKnowledgeView,
|
|
15
|
+
openKnowledgeStore,
|
|
16
|
+
type DisplayModel,
|
|
17
|
+
type DisplayRow,
|
|
18
|
+
} from '../knowledge-view';
|
|
19
|
+
import type { KnowledgeOptions } from './shared';
|
|
20
|
+
|
|
21
|
+
export async function knowledgeImportView(
|
|
22
|
+
options: KnowledgeOptions & { sources?: string; reset?: boolean },
|
|
23
|
+
io: CommandIO,
|
|
24
|
+
) {
|
|
25
|
+
const projectPath = options.projectPath || process.cwd();
|
|
26
|
+
const store = openKnowledgeStore(options, io);
|
|
27
|
+
const sources = options.sources
|
|
28
|
+
? options.sources.split(',') as Array<'code' | 'git' | 'docs' | 'manual'>
|
|
29
|
+
: ['code', 'git', 'docs'] as Array<'code' | 'git' | 'docs'>;
|
|
30
|
+
|
|
31
|
+
const importer = new ColdStartImporter({ projectRoot: projectPath, store, sources });
|
|
32
|
+
|
|
33
|
+
if (options.reset) {
|
|
34
|
+
importer.resetState();
|
|
35
|
+
announce(io, options.json, '🔄 已重置导入状态', 'warn');
|
|
36
|
+
}
|
|
37
|
+
announce(io, options.json, `📥 开始导入知识 (源: ${sources.join(', ')})...`);
|
|
38
|
+
|
|
39
|
+
const results = await importer.importAll();
|
|
40
|
+
const data = {
|
|
41
|
+
totalImported: results.reduce((sum, r) => sum + r.entries.length, 0),
|
|
42
|
+
totalErrors: results.reduce((sum, r) => sum + r.errors.length, 0),
|
|
43
|
+
results,
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
return { data, human: (): DisplayModel => ({ sections: [{ rows: importRows(data) }] }) };
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
type ImportOutcome = Awaited<ReturnType<ColdStartImporter['importAll']>>;
|
|
50
|
+
|
|
51
|
+
function importRows(data: { totalImported: number; totalErrors: number; results: ImportOutcome }): DisplayRow[] {
|
|
52
|
+
const rows: DisplayRow[] = [];
|
|
53
|
+
data.results.forEach((result, i) => {
|
|
54
|
+
if (result.entries.length > 0) {
|
|
55
|
+
rows.push({ cells: [
|
|
56
|
+
{ field: `results.${i}.source.type`, text: ` ✅ ${result.source.type}: `, tone: 'ok' },
|
|
57
|
+
{ field: `results.${i}.entries.length`, text: `${result.entries.length} 条`, tone: 'ok' },
|
|
58
|
+
] });
|
|
59
|
+
}
|
|
60
|
+
result.errors.forEach((err, j) => {
|
|
61
|
+
rows.push({ cells: [
|
|
62
|
+
{ field: `results.${i}.source.type`, text: ` ❌ ${result.source.type}: `, tone: 'error' },
|
|
63
|
+
{ field: `results.${i}.errors.${j}.message`, text: err.message, tone: 'error' },
|
|
64
|
+
] });
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
rows.push(blankLine(), { cells: [
|
|
68
|
+
{ label: '✅ 导入完成: ', tone: 'ok' },
|
|
69
|
+
{ field: 'totalImported', text: String(data.totalImported), tone: 'ok' },
|
|
70
|
+
{ label: ' 条,', tone: 'ok' },
|
|
71
|
+
{ field: 'totalErrors', text: String(data.totalErrors), tone: 'ok' },
|
|
72
|
+
{ label: ' 个错误', tone: 'ok' },
|
|
73
|
+
] });
|
|
74
|
+
return rows;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export async function knowledgeImport(
|
|
78
|
+
options: KnowledgeOptions & { sources?: string; reset?: boolean },
|
|
79
|
+
io: CommandIO = processIO,
|
|
80
|
+
): Promise<CommandResult> {
|
|
81
|
+
return emitKnowledgeView(io, options, await knowledgeImportView(options, io));
|
|
82
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* harness knowledge index 子命令(重建 _index.md 供 Agent grep,并同步 index.json;
|
|
3
|
+
* Phase 3 自 knowledge.ts 拆出,纯移位)
|
|
4
|
+
*
|
|
5
|
+
* 注意:本文件是 `index` 子命令的实现,不是 knowledge/ 目录的 barrel——子命令
|
|
6
|
+
* 实现由 definitions.ts 按 module+export 逐个懒加载引用,无聚合出口。
|
|
7
|
+
*
|
|
8
|
+
* 本文件只做「取数 + 声明两投影」:json 面正本在 `data`,人读排版在 `human()` 的
|
|
9
|
+
* display model。上色、json/人读分派、退出码、路径解析与 store 构造统一在
|
|
10
|
+
* knowledge-view.ts(harness#133,架构评审候选4)。
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import * as fs from 'fs';
|
|
14
|
+
import * as path from 'path';
|
|
15
|
+
import { KnowledgeIndexGenerator } from '../../../knowledge/index-generator';
|
|
16
|
+
import { processIO, type CommandIO, type CommandResult } from '../../command-contract';
|
|
17
|
+
import {
|
|
18
|
+
emitKnowledgeView,
|
|
19
|
+
openKnowledgeStore,
|
|
20
|
+
resolveKnowledgeBaseDir,
|
|
21
|
+
type DisplayModel,
|
|
22
|
+
type DisplayRow,
|
|
23
|
+
} from '../knowledge-view';
|
|
24
|
+
import type { KnowledgeDirOption, KnowledgeOptions } from './shared';
|
|
25
|
+
|
|
26
|
+
export function knowledgeIndexView(options: KnowledgeOptions & KnowledgeDirOption, io: CommandIO) {
|
|
27
|
+
const baseDir = resolveKnowledgeBaseDir(options, io);
|
|
28
|
+
const indexPath = path.join(baseDir, '_index.md');
|
|
29
|
+
const beforeSize = fs.existsSync(indexPath) ? fs.statSync(indexPath).size : 0;
|
|
30
|
+
|
|
31
|
+
const output = new KnowledgeIndexGenerator(baseDir).regenerate();
|
|
32
|
+
// Sync index.json from disk files (removes ghost entries from manual mv/rm)
|
|
33
|
+
openKnowledgeStore({ dir: baseDir }, io).rebuildIndex();
|
|
34
|
+
|
|
35
|
+
const afterSize = Buffer.byteLength(output, 'utf-8');
|
|
36
|
+
const lineCount = output.split('\n').filter(l => !l.startsWith('#')).length;
|
|
37
|
+
const data = { path: indexPath, entries: lineCount, size: afterSize, previousSize: beforeSize };
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
data,
|
|
41
|
+
human: (): DisplayModel => ({ sections: [{ rows: indexRows({ indexPath, afterSize, lineCount, beforeSize }) }] }),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function indexRows(shape: { indexPath: string; afterSize: number; lineCount: number; beforeSize: number }): DisplayRow[] {
|
|
46
|
+
const rows: DisplayRow[] = [
|
|
47
|
+
{ cells: [{ label: '📇 索引已重建', tone: 'heading' }] },
|
|
48
|
+
{ cells: [{ label: ' 路径: ', tone: 'muted' }, { field: 'path', text: shape.indexPath, tone: 'muted' }] },
|
|
49
|
+
{ cells: [{ label: ' 条目: ', tone: 'ok' }, { field: 'entries', text: String(shape.lineCount), tone: 'ok' }] },
|
|
50
|
+
{ cells: [{ label: ' 大小: ', tone: 'ok' }, { field: 'size', text: `${(shape.afterSize / 1024).toFixed(1)} KB`, tone: 'ok' }] },
|
|
51
|
+
];
|
|
52
|
+
if (shape.beforeSize > 0) {
|
|
53
|
+
rows.push({ cells: [{ label: ' 旧大小: ', tone: 'muted' }, { field: 'previousSize', text: `${(shape.beforeSize / 1024).toFixed(1)} KB`, tone: 'muted' }] });
|
|
54
|
+
}
|
|
55
|
+
return rows;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function knowledgeIndex(options: KnowledgeOptions & KnowledgeDirOption, io: CommandIO = processIO): CommandResult {
|
|
59
|
+
return emitKnowledgeView(io, options, knowledgeIndexView(options, io));
|
|
60
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* harness knowledge list 子命令(Phase 3 自 knowledge.ts 拆出,纯移位)
|
|
3
|
+
*
|
|
4
|
+
* 本文件只做「取数 + 声明两投影」:json 面正本在 `data`,人读排版在 `human()` 的
|
|
5
|
+
* display model。上色、label 映射、json/人读分派、退出码、路径解析与 store 构造
|
|
6
|
+
* 统一在 knowledge-view.ts(harness#133,架构评审候选4)。
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { KnowledgeEntry, KnowledgeSubsystem, MaturityLevel, QueryFilter } from '../../../knowledge/types';
|
|
10
|
+
import { processIO, type CommandIO, type CommandResult } from '../../command-contract';
|
|
11
|
+
import {
|
|
12
|
+
blankLine,
|
|
13
|
+
emitKnowledgeView,
|
|
14
|
+
openKnowledgeStore,
|
|
15
|
+
toneForMaturity,
|
|
16
|
+
type DisplayModel,
|
|
17
|
+
type DisplayRow,
|
|
18
|
+
} from '../knowledge-view';
|
|
19
|
+
import type { KnowledgeOptions } from './shared';
|
|
20
|
+
|
|
21
|
+
function listFilter(options: KnowledgeListOptions): QueryFilter {
|
|
22
|
+
const filter: QueryFilter = { excludeArchived: false };
|
|
23
|
+
if (options.type) filter.types = options.type.split(',') as KnowledgeSubsystem[];
|
|
24
|
+
if (options.maturity) filter.maturity = options.maturity.split(',') as MaturityLevel[];
|
|
25
|
+
if (options.tag) filter.tags = options.tag.split(',');
|
|
26
|
+
return filter;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface KnowledgeListOptions extends KnowledgeOptions {
|
|
30
|
+
type?: string;
|
|
31
|
+
maturity?: string;
|
|
32
|
+
tag?: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function knowledgeListView(options: KnowledgeListOptions, io: CommandIO) {
|
|
36
|
+
const entries = openKnowledgeStore(options, io).list(listFilter(options));
|
|
37
|
+
const data = { total: entries.length, entries };
|
|
38
|
+
|
|
39
|
+
return { data, human: (): DisplayModel => ({ sections: [{ rows: listRows(entries) }] }) };
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function listRows(entries: KnowledgeEntry[]): DisplayRow[] {
|
|
43
|
+
if (entries.length === 0) {
|
|
44
|
+
return [{ cells: [{ label: '知识库为空', tone: 'warn' }] }];
|
|
45
|
+
}
|
|
46
|
+
const rows: DisplayRow[] = [
|
|
47
|
+
{ cells: [
|
|
48
|
+
{ label: '📚 知识库 (', tone: 'heading' },
|
|
49
|
+
{ field: 'total', text: String(entries.length), tone: 'heading' },
|
|
50
|
+
{ label: ' 条)', tone: 'heading' },
|
|
51
|
+
] },
|
|
52
|
+
blankLine(),
|
|
53
|
+
];
|
|
54
|
+
entries.forEach((entry, i) => {
|
|
55
|
+
rows.push({ cells: [
|
|
56
|
+
{ field: `entries.${i}.maturity`, text: ` [${entry.maturity}]`, tone: toneForMaturity(entry.maturity) },
|
|
57
|
+
{ field: `entries.${i}.title`, text: ` ${entry.title}`, tone: 'emph' },
|
|
58
|
+
] });
|
|
59
|
+
rows.push({ cells: [
|
|
60
|
+
{ field: `entries.${i}.id`, text: ` id: ${entry.id}`, tone: 'muted' },
|
|
61
|
+
{ field: `entries.${i}.type`, text: ` | type: ${entry.type}`, tone: 'muted' },
|
|
62
|
+
{ field: `entries.${i}.layer`, text: ` | layer: ${entry.layer}`, tone: 'muted' },
|
|
63
|
+
] });
|
|
64
|
+
if (entry.tags.length > 0) {
|
|
65
|
+
rows.push({ cells: [{ field: `entries.${i}.tags`, text: ` tags: ${entry.tags.join(', ')}`, tone: 'muted' }] });
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
return rows;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export async function knowledgeList(options: KnowledgeListOptions, io: CommandIO = processIO): Promise<CommandResult> {
|
|
72
|
+
return emitKnowledgeView(io, options, knowledgeListView(options, io));
|
|
73
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* harness knowledge search 子命令(Phase 3 自 knowledge.ts 拆出,纯移位)
|
|
3
|
+
*
|
|
4
|
+
* 本文件只做「取数 + 声明两投影」:json 面正本在 `data`,人读排版在 `human()` 的
|
|
5
|
+
* display model。上色、label 映射、json/人读分派、退出码、路径解析与 store 构造
|
|
6
|
+
* 统一在 knowledge-view.ts(harness#133,架构评审候选4)。
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { KnowledgeQuery } from '../../../knowledge/query';
|
|
10
|
+
import type { KnowledgeEntry } from '../../../knowledge/types';
|
|
11
|
+
import { logError, processIO, type CommandIO, type CommandResult } from '../../command-contract';
|
|
12
|
+
import { parseNumericFlagOrReport } from '../../../utils/numeric-flag';
|
|
13
|
+
import {
|
|
14
|
+
blankLine,
|
|
15
|
+
emitKnowledgeView,
|
|
16
|
+
openKnowledgeStore,
|
|
17
|
+
type DisplayModel,
|
|
18
|
+
type DisplayRow,
|
|
19
|
+
} from '../knowledge-view';
|
|
20
|
+
import type { KnowledgeOptions } from './shared';
|
|
21
|
+
|
|
22
|
+
export function knowledgeSearchView(
|
|
23
|
+
query: string,
|
|
24
|
+
options: KnowledgeOptions & { limit?: number },
|
|
25
|
+
io: CommandIO,
|
|
26
|
+
) {
|
|
27
|
+
const store = openKnowledgeStore(options, io);
|
|
28
|
+
const matched = new KnowledgeQuery(store).search(query, { limit: options.limit ?? 20 });
|
|
29
|
+
const data = { query, total: matched.length, entries: matched };
|
|
30
|
+
|
|
31
|
+
return { data, human: (): DisplayModel => ({ sections: [{ rows: searchRows(query, matched) }] }) };
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function searchRows(query: string, matched: KnowledgeEntry[]): DisplayRow[] {
|
|
35
|
+
if (matched.length === 0) {
|
|
36
|
+
return [{ cells: [{ label: `未找到匹配 "${query}" 的知识条目`, tone: 'warn' }] }];
|
|
37
|
+
}
|
|
38
|
+
const rows: DisplayRow[] = [
|
|
39
|
+
{ cells: [
|
|
40
|
+
{ label: '🔍 搜索 "', tone: 'heading' },
|
|
41
|
+
{ field: 'query', text: query, tone: 'heading' },
|
|
42
|
+
{ label: '" (', tone: 'heading' },
|
|
43
|
+
{ field: 'total', text: String(matched.length), tone: 'heading' },
|
|
44
|
+
{ label: ' 条结果)', tone: 'heading' },
|
|
45
|
+
] },
|
|
46
|
+
blankLine(),
|
|
47
|
+
];
|
|
48
|
+
matched.forEach((entry, i) => {
|
|
49
|
+
const preview = entry.content.slice(0, 100).replace(/\n/g, ' ') + (entry.content.length > 100 ? '...' : '');
|
|
50
|
+
rows.push({ cells: [
|
|
51
|
+
{ field: `entries.${i}.title`, text: ` ${entry.title}`, tone: 'emph' },
|
|
52
|
+
{ field: `entries.${i}.maturity`, text: ` [${entry.maturity}]`, tone: 'muted' },
|
|
53
|
+
] });
|
|
54
|
+
rows.push({ cells: [{ field: `entries.${i}.content`, text: ` ${preview}`, tone: 'muted' }] });
|
|
55
|
+
});
|
|
56
|
+
return rows;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export async function knowledgeSearch(
|
|
60
|
+
query: string,
|
|
61
|
+
options: KnowledgeOptions & { limit?: number },
|
|
62
|
+
io: CommandIO = processIO,
|
|
63
|
+
): Promise<CommandResult> {
|
|
64
|
+
return emitKnowledgeView(io, options, knowledgeSearchView(query, options, io));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* knowledge search 子命令入口(候选7):缺参闸门 + limit 装配窄化,
|
|
69
|
+
* 自 definitions.ts 的 args 复印块移回命令模块(interface/测试面所在)。
|
|
70
|
+
* `--limit` 给到的恒是字符串(缺省 '20' 也是),脏输入 fail-loud(harness#154,
|
|
71
|
+
* 原先 parseInt 出 NaN 被下游 `|| 20` 静默兜成缺省量)。
|
|
72
|
+
*/
|
|
73
|
+
export async function knowledgeSearchCommand(
|
|
74
|
+
positionals: (string | undefined)[],
|
|
75
|
+
options: Record<string, unknown>,
|
|
76
|
+
io: CommandIO = processIO,
|
|
77
|
+
): Promise<CommandResult> {
|
|
78
|
+
const query = positionals[0];
|
|
79
|
+
if (!query) {
|
|
80
|
+
logError(io, '请提供搜索关键词');
|
|
81
|
+
return { kind: 'usage-error', reason: 'knowledge search 缺少关键词位置参数' };
|
|
82
|
+
}
|
|
83
|
+
const limit = parseNumericFlagOrReport(io, '--limit', options.limit as string | undefined, 'int');
|
|
84
|
+
if (!limit.ok) {
|
|
85
|
+
return { kind: 'usage-error', reason: `knowledge search --limit 非法限制: "${limit.raw}"` };
|
|
86
|
+
}
|
|
87
|
+
return knowledgeSearch(String(query), {
|
|
88
|
+
projectPath: options.projectPath as string | undefined,
|
|
89
|
+
json: options.json as boolean | undefined,
|
|
90
|
+
limit: limit.value,
|
|
91
|
+
}, io);
|
|
92
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* knowledge 子命令共享的入参面(Phase 3:原 knowledge.ts 的公共类型,纯移位)
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export interface KnowledgeOptions {
|
|
6
|
+
/** 项目路径 */
|
|
7
|
+
projectPath?: string;
|
|
8
|
+
/** 输出 JSON 格式 */
|
|
9
|
+
json?: boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** 子操作共用的入参面:知识库目录覆盖(audit/snapshot/migrate/index/health 收) */
|
|
13
|
+
export type KnowledgeDirOption = { dir?: string };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* harness knowledge snapshot 子命令(KR4 存活率追踪;Phase 3 自 knowledge.ts 拆出,纯移位)
|
|
3
|
+
*
|
|
4
|
+
* 本文件只做「取数 + 声明两投影」:json 面正本在 `data`,人读排版在 `human()` 的
|
|
5
|
+
* display model。上色、json/人读分派、退出码、路径解析与 store 构造统一在
|
|
6
|
+
* knowledge-view.ts(harness#133,架构评审候选4)。
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { processIO, type CommandIO, type CommandResult } from '../../command-contract';
|
|
10
|
+
import {
|
|
11
|
+
emitKnowledgeView,
|
|
12
|
+
openKnowledgeStore,
|
|
13
|
+
type DisplayModel,
|
|
14
|
+
} from '../knowledge-view';
|
|
15
|
+
import type { KnowledgeDirOption, KnowledgeOptions } from './shared';
|
|
16
|
+
|
|
17
|
+
export function knowledgeSnapshotView(options: KnowledgeOptions & KnowledgeDirOption, io: CommandIO) {
|
|
18
|
+
const snapshotPath = openKnowledgeStore(options, io).snapshot();
|
|
19
|
+
const data = { snapshotPath };
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
data,
|
|
23
|
+
human: (): DisplayModel => ({
|
|
24
|
+
sections: [{
|
|
25
|
+
rows: [{
|
|
26
|
+
cells: [
|
|
27
|
+
{ label: '✅ 快照已保存: ', tone: 'ok' },
|
|
28
|
+
{ field: 'snapshotPath', text: snapshotPath, tone: 'ok' },
|
|
29
|
+
],
|
|
30
|
+
}],
|
|
31
|
+
}],
|
|
32
|
+
}),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function knowledgeSnapshot(options: KnowledgeOptions & KnowledgeDirOption, io: CommandIO = processIO): CommandResult {
|
|
37
|
+
return emitKnowledgeView(io, options, knowledgeSnapshotView(options, io));
|
|
38
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* harness knowledge stats 子命令(Phase 3 自 knowledge.ts 拆出,纯移位)
|
|
3
|
+
*
|
|
4
|
+
* 本文件只做「取数 + 声明两投影」:json 面正本在 `data`,人读排版在 `human()` 的
|
|
5
|
+
* display model。上色、label 映射、json/人读分派、退出码、路径解析与 store 构造
|
|
6
|
+
* 统一在 knowledge-view.ts(harness#133,架构评审候选4)。
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import * as fs from 'fs';
|
|
10
|
+
import * as path from 'path';
|
|
11
|
+
import { evaluateFlywheel } from '../../../knowledge/flywheel-metrics';
|
|
12
|
+
import type { MaturityLevel } from '../../../knowledge/types';
|
|
13
|
+
import { processIO, type CommandIO, type CommandResult } from '../../command-contract';
|
|
14
|
+
import {
|
|
15
|
+
blankLine,
|
|
16
|
+
emitKnowledgeView,
|
|
17
|
+
openKnowledgeStore,
|
|
18
|
+
toneForMaturity,
|
|
19
|
+
type DisplayModel,
|
|
20
|
+
type DisplayRow,
|
|
21
|
+
} from '../knowledge-view';
|
|
22
|
+
import type { KnowledgeOptions } from './shared';
|
|
23
|
+
|
|
24
|
+
export function knowledgeStatsView(options: KnowledgeOptions, io: CommandIO) {
|
|
25
|
+
const store = openKnowledgeStore(options, io);
|
|
26
|
+
const entries = store.list({ excludeArchived: false });
|
|
27
|
+
const active = entries.filter(e => e.maturity !== 'archived');
|
|
28
|
+
|
|
29
|
+
const byType: Record<string, number> = {};
|
|
30
|
+
const byMaturity: Record<string, number> = {};
|
|
31
|
+
const byLayer: Record<string, number> = {};
|
|
32
|
+
for (const entry of entries) {
|
|
33
|
+
byType[entry.type] = (byType[entry.type] || 0) + 1;
|
|
34
|
+
byMaturity[entry.maturity] = (byMaturity[entry.maturity] || 0) + 1;
|
|
35
|
+
byLayer[entry.layer] = (byLayer[entry.layer] || 0) + 1;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// 飞轮指标:计算唯一实现在 knowledge/flywheel-metrics,此处只做 fs 读取 + 展示层单位映射
|
|
39
|
+
// fail-fast:统计文件在场但损坏直接抛(existsSync 判缺失,不吞解析错误)
|
|
40
|
+
let dailyConsumptionEvents = 0;
|
|
41
|
+
const statsPath = path.join(store.getBaseDir(), '.consumption-stats.json');
|
|
42
|
+
if (fs.existsSync(statsPath)) {
|
|
43
|
+
const stats = JSON.parse(fs.readFileSync(statsPath, 'utf-8'));
|
|
44
|
+
dailyConsumptionEvents = stats.dailyEvents || 0;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const metrics = evaluateFlywheel({ entries: active, dailyConsumptionEvents });
|
|
48
|
+
const flywheel = {
|
|
49
|
+
refCoverage: Math.round(metrics.refCoverage * 100),
|
|
50
|
+
avgRefs: Math.round(metrics.avgRefs * 10) / 10,
|
|
51
|
+
consumptionHitRate: Math.round(metrics.consumptionHitRate * 100),
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const data = { total: entries.length, byType, byMaturity, byLayer, flywheel };
|
|
55
|
+
const activeCount = active.length;
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
data,
|
|
59
|
+
human: (): DisplayModel => ({
|
|
60
|
+
sections: [
|
|
61
|
+
{
|
|
62
|
+
rows: [
|
|
63
|
+
{ cells: [{ label: '📊 知识库统计', tone: 'heading' }] },
|
|
64
|
+
blankLine(),
|
|
65
|
+
{
|
|
66
|
+
cells: [
|
|
67
|
+
{ label: ' 总计: ', tone: 'emph' },
|
|
68
|
+
{ field: 'total', text: String(data.total), tone: 'emph' },
|
|
69
|
+
{ label: ' 条 (活跃: ', tone: 'emph' },
|
|
70
|
+
{ derived: 'activeCount', text: String(activeCount), tone: 'emph' },
|
|
71
|
+
{ label: ')', tone: 'emph' },
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
blankLine(),
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
{ title: ' 按类型:', rows: [...countRows('byType', byType), blankLine()] },
|
|
78
|
+
{
|
|
79
|
+
title: ' 按成熟度:',
|
|
80
|
+
rows: [...Object.entries(byMaturity).map(([maturity, count]) => ({
|
|
81
|
+
cells: [
|
|
82
|
+
{ field: `byMaturity.${maturity}`, text: ` ${maturity}`, tone: toneForMaturity(maturity as MaturityLevel) },
|
|
83
|
+
{ field: `byMaturity.${maturity}`, text: `: ${count}` },
|
|
84
|
+
],
|
|
85
|
+
})), blankLine()],
|
|
86
|
+
},
|
|
87
|
+
{ title: ' 按层级:', rows: [...countRows('byLayer', byLayer), blankLine()] },
|
|
88
|
+
{
|
|
89
|
+
title: ' 飞轮指标:',
|
|
90
|
+
rows: [
|
|
91
|
+
{ cells: [{ label: ' 引用覆盖: ' }, { field: 'flywheel.refCoverage', text: `${flywheel.refCoverage}%` }] },
|
|
92
|
+
{ cells: [{ label: ' 平均引用: ' }, { field: 'flywheel.avgRefs', text: String(flywheel.avgRefs) }] },
|
|
93
|
+
{ cells: [{ label: ' 消费命中率: ' }, { field: 'flywheel.consumptionHitRate', text: `${flywheel.consumptionHitRate}%` }] },
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
}),
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function countRows(field: string, counts: Record<string, number>): DisplayRow[] {
|
|
102
|
+
return Object.entries(counts).map(([key, count]) => ({
|
|
103
|
+
cells: [
|
|
104
|
+
{ label: ' ' },
|
|
105
|
+
{ field: `${field}.${key}`, text: `${key}: ${count}` },
|
|
106
|
+
],
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export async function knowledgeStats(options: KnowledgeOptions, io: CommandIO = processIO): Promise<CommandResult> {
|
|
111
|
+
return emitKnowledgeView(io, options, knowledgeStatsView(options, io));
|
|
112
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 知识库路径解析与 store 构造(ADR-0040 Phase 3 自 knowledge-view.ts 拆出)
|
|
3
|
+
*
|
|
4
|
+
* 与 view(投影出口)无关:constraints-retire/reactivate 的知识沉淀写口接线
|
|
5
|
+
* 也消费这里。`-p` / `KNOWLEDGE_BASE_DIR` / 缺省目录解析只在这一处
|
|
6
|
+
* (ADR-0034:消费方数据区正本由编排侧经 KNOWLEDGE_BASE_DIR 显式注入)。
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import * as os from 'os';
|
|
10
|
+
import * as path from 'path';
|
|
11
|
+
import { FileKnowledgeStore } from '../../../knowledge/store';
|
|
12
|
+
import type { CommandIO } from '../../command-contract';
|
|
13
|
+
|
|
14
|
+
/** 缺省知识库数据根(相对用户 home)。裸 CLI 项目缺省目录;消费方数据区正本由编排侧经 KNOWLEDGE_BASE_DIR 显式注入(ADR-0034) */
|
|
15
|
+
const KNOWLEDGE_DATA_DIR = path.join('.harness', 'knowledge');
|
|
16
|
+
|
|
17
|
+
export interface KnowledgePathOptions {
|
|
18
|
+
/** 覆盖知识库目录(audit/snapshot/migrate/index/health 收) */
|
|
19
|
+
dir?: string;
|
|
20
|
+
/** -p/--project-path */
|
|
21
|
+
projectPath?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 知识库数据根的唯一解析点。`-p` 优先,其次 KNOWLEDGE_BASE_DIR,
|
|
26
|
+
* 最后落到用户 home 缺省目录(ADR-0034 目录收编:消费方数据区正本由
|
|
27
|
+
* 编排侧经 KNOWLEDGE_BASE_DIR 显式注入,本命令不做任何旧目录兼容沿用;
|
|
28
|
+
* io 参数随兼容提示一并失去用途,签名保留免动全部调用方)。
|
|
29
|
+
*/
|
|
30
|
+
export function resolveKnowledgeBaseDir(options: KnowledgePathOptions, _io: CommandIO): string {
|
|
31
|
+
if (options.dir) return options.dir;
|
|
32
|
+
if (options.projectPath) return `${options.projectPath}/.harness/knowledge`;
|
|
33
|
+
if (process.env.KNOWLEDGE_BASE_DIR) return process.env.KNOWLEDGE_BASE_DIR;
|
|
34
|
+
return path.join(os.homedir(), KNOWLEDGE_DATA_DIR);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** 知识库句柄的唯一构造点(路径解析全权交给 resolveKnowledgeBaseDir) */
|
|
38
|
+
export function openKnowledgeStore(options: KnowledgePathOptions, io: CommandIO): FileKnowledgeStore {
|
|
39
|
+
return new FileKnowledgeStore({ baseDir: resolveKnowledgeBaseDir(options, io) });
|
|
40
|
+
}
|
|
@@ -9,16 +9,16 @@
|
|
|
9
9
|
* 要么声明是人读面独有的派生量(derived,须在测试的豁免表逐条登记理由)。
|
|
10
10
|
* - **角色→样式单表 + 键→中文 label 映射**:维度 label、成熟度颜色、规则 label 的唯一权威。
|
|
11
11
|
* - **json / 人读的唯一分派与退出码**:`--json` 打 `data` 的序列化,否则渲染 display model。
|
|
12
|
-
*
|
|
13
|
-
*
|
|
12
|
+
*
|
|
13
|
+
* 路径解析与 store 构造已拆至 `knowledge/store-access.ts`(与 view 无关,
|
|
14
|
+
* retire/reactivate 的写口接线亦消费;ADR-0034 目录收编口径随之搬迁),本模块
|
|
15
|
+
* re-export 保持子命令既有进口不变。
|
|
14
16
|
*/
|
|
15
17
|
|
|
16
18
|
import chalk from 'chalk';
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import {
|
|
20
|
-
import { AUDIT_RULE_LABELS } from '../../knowledge/audit-scoring';
|
|
21
|
-
import type { AuditIssue, AuditReport, AuditRuleName } from '../../knowledge/audit-scoring';
|
|
19
|
+
import { AUDIT_RULE_LABELS } from '../../knowledge/audit-rules';
|
|
20
|
+
import type { AuditIssue, AuditRuleName } from '../../knowledge/audit-rules';
|
|
21
|
+
import type { AuditReport } from '../../knowledge/audit-dimensions';
|
|
22
22
|
import type { MaturityLevel } from '../../knowledge/types';
|
|
23
23
|
import { log, type CommandIO, type CommandResult } from '../command-contract';
|
|
24
24
|
|
|
@@ -176,30 +176,7 @@ export function emitKnowledgeView<T>(io: CommandIO, options: { json?: boolean },
|
|
|
176
176
|
|
|
177
177
|
// ── 路径解析与 store 构造 ─────────────────────────────────
|
|
178
178
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
export
|
|
183
|
-
/** 覆盖知识库目录(audit/snapshot/migrate/index/health 收) */
|
|
184
|
-
dir?: string;
|
|
185
|
-
/** -p/--project-path */
|
|
186
|
-
projectPath?: string;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* 知识库数据根的唯一解析点。`-p` 优先,其次 KNOWLEDGE_BASE_DIR,
|
|
191
|
-
* 最后落到用户 home 缺省目录(ADR-0034 目录收编:消费方数据区正本由
|
|
192
|
-
* 编排侧经 KNOWLEDGE_BASE_DIR 显式注入,本命令不做任何旧目录兼容沿用;
|
|
193
|
-
* io 参数随兼容提示一并失去用途,签名保留免动全部调用方)。
|
|
194
|
-
*/
|
|
195
|
-
export function resolveKnowledgeBaseDir(options: KnowledgePathOptions, _io: CommandIO): string {
|
|
196
|
-
if (options.dir) return options.dir;
|
|
197
|
-
if (options.projectPath) return `${options.projectPath}/.harness/knowledge`;
|
|
198
|
-
if (process.env.KNOWLEDGE_BASE_DIR) return process.env.KNOWLEDGE_BASE_DIR;
|
|
199
|
-
return path.join(os.homedir(), KNOWLEDGE_DATA_DIR);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
/** 知识库句柄的唯一构造点(路径解析全权交给 resolveKnowledgeBaseDir) */
|
|
203
|
-
export function openKnowledgeStore(options: KnowledgePathOptions, io: CommandIO): FileKnowledgeStore {
|
|
204
|
-
return new FileKnowledgeStore({ baseDir: resolveKnowledgeBaseDir(options, io) });
|
|
205
|
-
}
|
|
179
|
+
// 正本已拆至 knowledge/store-access.ts(与 view 无关,retire/reactivate 亦消费);
|
|
180
|
+
// 此处 re-export 保持 knowledge 族子命令的既有进口不变
|
|
181
|
+
export { resolveKnowledgeBaseDir, openKnowledgeStore } from './knowledge/store-access';
|
|
182
|
+
export type { KnowledgePathOptions } from './knowledge/store-access';
|
|
@@ -10,8 +10,8 @@ import * as path from 'path';
|
|
|
10
10
|
import { execAsync } from '../../utils/exec';
|
|
11
11
|
import { PassesGate, detectTestCommand } from '../../core/validators/passes-gate';
|
|
12
12
|
import type { PassesGateConfig } from '../../types/passes-gate';
|
|
13
|
-
import { log,
|
|
14
|
-
import {
|
|
13
|
+
import { log, processIO, type CommandIO, type CommandResult } from '../command-contract';
|
|
14
|
+
import { parseNumericFlagOrReport } from '../../utils/numeric-flag';
|
|
15
15
|
|
|
16
16
|
export interface PassesGateOptions {
|
|
17
17
|
/** 测试命令 */
|
|
@@ -64,7 +64,11 @@ export async function runPassesGate(
|
|
|
64
64
|
log(io);
|
|
65
65
|
log(io, chalk.gray('测试结果:'));
|
|
66
66
|
log(io, chalk.gray(` 通过: ${result.passedTests}/${result.totalTests}`));
|
|
67
|
-
log(io, chalk.gray(
|
|
67
|
+
log(io, chalk.gray(
|
|
68
|
+
result.failedTests === null
|
|
69
|
+
? ' 失败: 未取到计数(命令判负,但输出里没有失败计数行:进程被杀 / 无汇总 / 输出溢出这类,不代表「有几个用例红」)'
|
|
70
|
+
: ` 失败: ${result.failedTests}/${result.totalTests}`
|
|
71
|
+
));
|
|
68
72
|
log(io, chalk.gray(` 耗时: ${result.duration}ms`));
|
|
69
73
|
|
|
70
74
|
if (result.passed) {
|
|
@@ -75,6 +79,9 @@ export async function runPassesGate(
|
|
|
75
79
|
log(io);
|
|
76
80
|
log(io, chalk.red('❌ 测试门控未通过'));
|
|
77
81
|
log(io, chalk.red(' task.passes = false'));
|
|
82
|
+
if (result.message && result.message !== '测试失败') {
|
|
83
|
+
log(io, chalk.gray(` 原因: ${result.message}`));
|
|
84
|
+
}
|
|
78
85
|
|
|
79
86
|
if (result.failures && result.failures.length > 0) {
|
|
80
87
|
log(io, chalk.red('\n失败的测试:'));
|
|
@@ -83,7 +90,12 @@ export async function runPassesGate(
|
|
|
83
90
|
});
|
|
84
91
|
}
|
|
85
92
|
|
|
86
|
-
return {
|
|
93
|
+
return {
|
|
94
|
+
kind: 'fail',
|
|
95
|
+
reason: result.failedTests === null
|
|
96
|
+
? `passes-gate denied: 未取到失败计数(命令判负且输出无汇总行)${result.message ? `|${result.message}` : ''}`
|
|
97
|
+
: `passes-gate denied: ${result.failedTests}/${result.totalTests} 个测试失败`,
|
|
98
|
+
};
|
|
87
99
|
}
|
|
88
100
|
return { kind: 'ok' };
|
|
89
101
|
} catch (error) {
|
|
@@ -103,9 +115,8 @@ export async function coverageCheck(
|
|
|
103
115
|
options: Record<string, unknown>,
|
|
104
116
|
io: CommandIO = processIO,
|
|
105
117
|
): Promise<CommandResult> {
|
|
106
|
-
const threshold =
|
|
118
|
+
const threshold = parseNumericFlagOrReport(io, '--coverage-threshold', options.coverageThreshold as string | undefined, 'int');
|
|
107
119
|
if (!threshold.ok) {
|
|
108
|
-
logError(io, numericFlagMessage('--coverage-threshold', threshold.raw, 'int'));
|
|
109
120
|
return { kind: 'usage-error', reason: `passes-gate --coverage-threshold 非法阈值: "${threshold.raw}"` };
|
|
110
121
|
}
|
|
111
122
|
return checkCoverage(
|
|
@@ -145,10 +156,12 @@ export async function checkCoverage(
|
|
|
145
156
|
return { kind: 'ok' };
|
|
146
157
|
}
|
|
147
158
|
log(io, chalk.red(`❌ 覆盖率不足 (${totalCoverage}% < ${threshold}%)`));
|
|
148
|
-
|
|
149
|
-
return { kind: 'skip', reason: `覆盖率不足: ${totalCoverage}% < ${threshold}%` };
|
|
159
|
+
return { kind: 'fail', reason: `覆盖率不足: ${totalCoverage}% < ${threshold}%` };
|
|
150
160
|
} catch (error) {
|
|
151
|
-
|
|
152
|
-
|
|
161
|
+
// fail-loud:覆盖率命令失败 / 报告缺失 / JSON 损坏都是「没查到」,不是「查过了」——
|
|
162
|
+
// 吞成 skip 退 0 会让门禁在故障时永远放行
|
|
163
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
164
|
+
log(io, chalk.red(`❌ 无法获取覆盖率信息: ${message}`));
|
|
165
|
+
return { kind: 'fail', reason: `无法获取覆盖率信息: ${message}` };
|
|
153
166
|
}
|
|
154
167
|
}
|