@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
|
+
* init 的 CLAUDE.md Output Style 段写入(Phase 3 自 init.ts 拆出,纯移位)
|
|
3
|
+
*
|
|
4
|
+
* Output Style 段标记与正文正本在 `scaffold-templates.ts`
|
|
5
|
+
* (ADR-0001:init 只写标记区间内,标记外只读)。
|
|
6
|
+
* marker-range 替换收口在 `core/constraints/injection-writer`(ADR-0011):
|
|
7
|
+
* 本文件是「渲染 body + 调 writer」,半标记(单边/乱序)一律拒写告警。
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import chalk from 'chalk';
|
|
11
|
+
import * as fs from 'fs/promises';
|
|
12
|
+
import { existsSync } from 'fs';
|
|
13
|
+
import * as path from 'path';
|
|
14
|
+
import { replaceStandaloneRange } from '../../../core/constraints/injection-writer';
|
|
15
|
+
import { log, type CommandIO } from '../../command-contract';
|
|
16
|
+
import {
|
|
17
|
+
OUTPUT_STYLE_START,
|
|
18
|
+
OUTPUT_STYLE_END,
|
|
19
|
+
renderOutputStyleSection,
|
|
20
|
+
} from '../scaffold-templates';
|
|
21
|
+
|
|
22
|
+
/** 旧版 harness 无标记 Output Style 段的特征串(用于区分 harness 写入 vs 用户自写) */
|
|
23
|
+
const LEGACY_OUTPUT_STYLE_FINGERPRINT = 'Terse like caveman';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* 在 CLAUDE.md 顶部写入 Output Style 段(标记化、幂等)
|
|
27
|
+
*
|
|
28
|
+
* - 已有 HARNESS_OUTPUT_STYLE 标记:替换标记间内容
|
|
29
|
+
* - 无标记但存在旧版 harness 写入的无标记段(特征串匹配):原位置换为标记版
|
|
30
|
+
* - 无标记且 `## Output Style` 段为用户自写(特征串不匹配):跳过并提示,不重复追加
|
|
31
|
+
* - 完全没有该段:在文件顶部插入标记版
|
|
32
|
+
*/
|
|
33
|
+
export async function setupClaudeMdOutputStyle(projectPath: string, io: CommandIO): Promise<void> {
|
|
34
|
+
const claudeMdPath = path.join(projectPath, 'CLAUDE.md');
|
|
35
|
+
// CLAUDE.md 不存在——无人持有该文件,跳过 Output Style 段
|
|
36
|
+
if (!existsSync(claudeMdPath)) return;
|
|
37
|
+
const content = await fs.readFile(claudeMdPath, 'utf-8');
|
|
38
|
+
|
|
39
|
+
const section = renderOutputStyleSection();
|
|
40
|
+
const write = replaceStandaloneRange(content, OUTPUT_STYLE_START, OUTPUT_STYLE_END, section);
|
|
41
|
+
|
|
42
|
+
if (write.kind === 'updated') {
|
|
43
|
+
// 尾部换行规范化在 writer 内(幂等)。
|
|
44
|
+
if (write.content !== content) {
|
|
45
|
+
await fs.writeFile(claudeMdPath, write.content, 'utf-8');
|
|
46
|
+
log(io, chalk.green('✅ 已更新 CLAUDE.md Output Style 段'));
|
|
47
|
+
}
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (write.kind === 'half') {
|
|
51
|
+
log(io, chalk.yellow('⚠️ CLAUDE.md 中 HARNESS_OUTPUT_STYLE 标记残缺(单边或乱序),跳过 Output Style 注入,请人工修复'));
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// 检测旧版无标记 `## Output Style` 段
|
|
56
|
+
const legacyMatch = /^## Output Style[ \t]*$/m.exec(content);
|
|
57
|
+
if (legacyMatch) {
|
|
58
|
+
const sectionStart = legacyMatch.index;
|
|
59
|
+
const afterHeading = sectionStart + legacyMatch[0].length;
|
|
60
|
+
const nextHeadingOffset = content.slice(afterHeading).search(/^#{1,6} /m);
|
|
61
|
+
const sectionEnd = nextHeadingOffset === -1 ? content.length : afterHeading + nextHeadingOffset;
|
|
62
|
+
const legacySection = content.slice(sectionStart, sectionEnd);
|
|
63
|
+
|
|
64
|
+
if (!legacySection.includes(LEGACY_OUTPUT_STYLE_FINGERPRINT)) {
|
|
65
|
+
// 用户自写的同名 section:不动,也不追加(避免重复)
|
|
66
|
+
log(io, chalk.yellow('⚠️ CLAUDE.md 已存在自定义 "## Output Style" 段,跳过 harness Output Style 注入'));
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// 旧版 harness 写入:原位置换为标记版
|
|
71
|
+
const before = content.slice(0, sectionStart);
|
|
72
|
+
const after = content.slice(sectionEnd);
|
|
73
|
+
const newContent = before + section + (after.length > 0 ? '\n' + after : '');
|
|
74
|
+
await fs.writeFile(claudeMdPath, newContent, 'utf-8');
|
|
75
|
+
log(io, chalk.green('✅ 已将 CLAUDE.md Output Style 段迁移为标记化管理'));
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// 完全没有该段:插入文件顶部
|
|
80
|
+
await fs.writeFile(claudeMdPath, section + '\n' + content, 'utf-8');
|
|
81
|
+
log(io, chalk.green('✅ 已在 CLAUDE.md 顶部写入 Output Style 段'));
|
|
82
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* init 的预设数据表(Phase 3 自 init.ts 拆出,纯移位)
|
|
3
|
+
*
|
|
4
|
+
* preset 三档(strict/standard/relaxed)与治理预设(minimal/standard/strict),
|
|
5
|
+
* 入口值域校验与装配共用同一份 GOVERNANCE_PRESETS 键集合(harness#156)。
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { GovernanceConfig } from '../../../types/project-config';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 默认配置
|
|
12
|
+
*
|
|
13
|
+
* 只写有运行时消费者的字段:preset(ADR-0001 生效集链路由 mergeConstraints 消费)。
|
|
14
|
+
* 历史模板里的 enabled / ironLaws.enforceErrors / ironLaws.warnWarnings /
|
|
15
|
+
* validators.{checkpoint,passesGate,cso} 均为零消费者的死字段,不再写入;
|
|
16
|
+
* strict/standard/relaxed 三档差异曾只存在于这些死字段上(实为两档),
|
|
17
|
+
* 现在三档差异完全由 preset 键经生效集链路体现。
|
|
18
|
+
*/
|
|
19
|
+
const DEFAULT_CONFIG = {
|
|
20
|
+
preset: 'standard',
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* 预设配置
|
|
25
|
+
*/
|
|
26
|
+
export const PRESETS = {
|
|
27
|
+
strict: {
|
|
28
|
+
...DEFAULT_CONFIG,
|
|
29
|
+
preset: 'strict',
|
|
30
|
+
},
|
|
31
|
+
standard: {
|
|
32
|
+
...DEFAULT_CONFIG,
|
|
33
|
+
preset: 'standard',
|
|
34
|
+
},
|
|
35
|
+
relaxed: {
|
|
36
|
+
...DEFAULT_CONFIG,
|
|
37
|
+
preset: 'relaxed',
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* 治理预设(形状 = 写入 config.yml 的 governance 段,直接用类型正本)
|
|
43
|
+
*/
|
|
44
|
+
export const GOVERNANCE_PRESETS: Record<string, GovernanceConfig> = {
|
|
45
|
+
minimal: {
|
|
46
|
+
level: 'minimal',
|
|
47
|
+
docs: {
|
|
48
|
+
sync_command: 'harness sync-docs',
|
|
49
|
+
check_on_ci: false,
|
|
50
|
+
files: ['CAPABILITIES.md'],
|
|
51
|
+
},
|
|
52
|
+
context_files: {
|
|
53
|
+
enabled: false,
|
|
54
|
+
required_dirs: [],
|
|
55
|
+
},
|
|
56
|
+
changelog: {
|
|
57
|
+
format: 'keep-a-changelog',
|
|
58
|
+
},
|
|
59
|
+
testing: {
|
|
60
|
+
test_first: true,
|
|
61
|
+
coverage_threshold: 85,
|
|
62
|
+
incremental_coverage: false,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
standard: {
|
|
66
|
+
level: 'standard',
|
|
67
|
+
docs: {
|
|
68
|
+
sync_command: 'harness sync-docs',
|
|
69
|
+
check_on_ci: true,
|
|
70
|
+
files: ['CAPABILITIES.md', 'README.md'],
|
|
71
|
+
},
|
|
72
|
+
context_files: {
|
|
73
|
+
enabled: true,
|
|
74
|
+
required_dirs: [],
|
|
75
|
+
},
|
|
76
|
+
changelog: {
|
|
77
|
+
format: 'keep-a-changelog',
|
|
78
|
+
},
|
|
79
|
+
testing: {
|
|
80
|
+
test_first: true,
|
|
81
|
+
coverage_threshold: 85,
|
|
82
|
+
incremental_coverage: false,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
strict: {
|
|
86
|
+
level: 'strict',
|
|
87
|
+
docs: {
|
|
88
|
+
sync_command: 'harness sync-docs',
|
|
89
|
+
check_on_ci: true,
|
|
90
|
+
files: ['CAPABILITIES.md', 'README.md', 'CHANGELOG.md'],
|
|
91
|
+
},
|
|
92
|
+
context_files: {
|
|
93
|
+
enabled: true,
|
|
94
|
+
required_dirs: [],
|
|
95
|
+
},
|
|
96
|
+
changelog: {
|
|
97
|
+
format: 'keep-a-changelog',
|
|
98
|
+
},
|
|
99
|
+
testing: {
|
|
100
|
+
test_first: true,
|
|
101
|
+
coverage_threshold: 85,
|
|
102
|
+
incremental_coverage: true,
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* init --print-snippets 的片段视图(Phase 3 自 init.ts 拆出,纯移位)
|
|
3
|
+
*
|
|
4
|
+
* 打印给用户的片段必须是落盘正文的一部分(#103 判据)且由正本裁剪派生
|
|
5
|
+
* (harness#153 / harness#157:GitHub 片段 = harness-check.yml 的 job 段之后,
|
|
6
|
+
* GitLab 片段 = renderGitLabCiJobs(governanceLevel),与落盘同一个正本函数)。
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import chalk from 'chalk';
|
|
10
|
+
import type { CiPlatform } from '../../../types/project-config';
|
|
11
|
+
import { log, type CommandIO } from '../../command-contract';
|
|
12
|
+
import {
|
|
13
|
+
GITHUB_ACTIONS_SNIPPET,
|
|
14
|
+
renderGitLabCiJobs,
|
|
15
|
+
PRE_COMMIT_SNIPPET,
|
|
16
|
+
PRE_PUSH_SNIPPET,
|
|
17
|
+
} from '../scaffold-templates';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* 输出代码片段(CI 片段按解析出的平台出形,harness#143)
|
|
21
|
+
*
|
|
22
|
+
* gitlab 形打 `renderGitLabCiJobs(governanceLevel)`——与落盘 / 冲突分支同一个函数
|
|
23
|
+
* 的正本(harness#157:曾打无 level 的 GITLAB_CI_SNIPPET,`-g` 档照抄的用户少拿
|
|
24
|
+
* 治理与 docs 新鲜度两个任务)。
|
|
25
|
+
*/
|
|
26
|
+
export function printSnippets(
|
|
27
|
+
io: CommandIO,
|
|
28
|
+
platform: CiPlatform | 'none',
|
|
29
|
+
governanceLevel: string | undefined,
|
|
30
|
+
): void {
|
|
31
|
+
log(io, chalk.blue('📄 Harness 配置代码片段'));
|
|
32
|
+
log(io);
|
|
33
|
+
|
|
34
|
+
log(io, chalk.yellow('Git pre-commit hook:'));
|
|
35
|
+
log(io, chalk.gray('添加到 .git/hooks/pre-commit'));
|
|
36
|
+
log(io);
|
|
37
|
+
log(io, chalk.cyan(PRE_COMMIT_SNIPPET));
|
|
38
|
+
|
|
39
|
+
log(io, chalk.yellow('Git pre-push hook:'));
|
|
40
|
+
log(io, chalk.gray('添加到 .git/hooks/pre-push(pre-commit 查暂存的、快反馈,这道查整仓的、全量兜底——重复是设计使然)'));
|
|
41
|
+
log(io);
|
|
42
|
+
log(io, chalk.cyan(PRE_PUSH_SNIPPET));
|
|
43
|
+
|
|
44
|
+
if (platform === 'gitlab') {
|
|
45
|
+
log(io, chalk.yellow('GitLab CI:'));
|
|
46
|
+
log(io, chalk.gray('添加到 .gitlab-ci.yml'));
|
|
47
|
+
log(io);
|
|
48
|
+
log(io, chalk.cyan(renderGitLabCiJobs(governanceLevel)));
|
|
49
|
+
} else {
|
|
50
|
+
log(io, chalk.yellow('GitHub Actions:'));
|
|
51
|
+
log(io, chalk.gray('添加到 .github/workflows/*.yml 的 jobs 下(以下正文取自 harness-check.yml 的 job 段)'));
|
|
52
|
+
log(io);
|
|
53
|
+
log(io, chalk.cyan(GITHUB_ACTIONS_SNIPPET));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
log(io, chalk.blue('💡 提示: 运行 npx @dommaker/harness init 自动创建配置文件'));
|
|
57
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* harness knowledge audit 子命令(知识库质量审计;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 { KnowledgeAudit } from '../../../knowledge/audit';
|
|
10
|
+
import type { AuditRuleName } from '../../../knowledge/audit-rules';
|
|
11
|
+
import type { AuditReport, DimensionMetrics } from '../../../knowledge/audit-dimensions';
|
|
12
|
+
import { KnowledgeIndexGenerator } from '../../../knowledge/index-generator';
|
|
13
|
+
import { logError, processIO, type CommandIO, type CommandResult } from '../../command-contract';
|
|
14
|
+
import { parseNumericFlag } from '../../../utils/numeric-flag';
|
|
15
|
+
import {
|
|
16
|
+
announce,
|
|
17
|
+
blankLine,
|
|
18
|
+
dimensionLabel,
|
|
19
|
+
emitKnowledgeView,
|
|
20
|
+
openKnowledgeStore,
|
|
21
|
+
resolveKnowledgeBaseDir,
|
|
22
|
+
ruleLabel,
|
|
23
|
+
toneForScore,
|
|
24
|
+
toneForSeverity,
|
|
25
|
+
type DisplayModel,
|
|
26
|
+
type DisplayRow,
|
|
27
|
+
type DisplaySection,
|
|
28
|
+
} from '../knowledge-view';
|
|
29
|
+
import type { KnowledgeDirOption, KnowledgeOptions } from './shared';
|
|
30
|
+
|
|
31
|
+
export type KnowledgeAuditOptions = KnowledgeOptions & KnowledgeDirOption & {
|
|
32
|
+
fix?: boolean;
|
|
33
|
+
dryRun?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* `--threshold <n>` 的 commander 原值。旗帜给到的恒是字符串(缺省 '50' 也是),
|
|
36
|
+
* 声明跟着运行时走(harness#152);窄化在 `knowledgeAudit` 装配点做一次。
|
|
37
|
+
*/
|
|
38
|
+
threshold?: string;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/** `knowledgeAuditView` 的入参面:threshold 已过装配窄化,引擎槽位要的是数值 */
|
|
42
|
+
export type KnowledgeAuditViewOptions = Omit<KnowledgeAuditOptions, 'threshold'> & {
|
|
43
|
+
threshold?: number;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/** 阈值装配结果:`ok: false` = 脏输入,由命令入口 fail-loud(不得往判定槽塞 NaN) */
|
|
47
|
+
type ThresholdAssembly = { ok: true; value?: number } | { ok: false; raw: string };
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* `--threshold` 的装配点窄化(harness#152):非负整数字符串 → 数值,转不出来即脏输入。
|
|
51
|
+
* `undefined` = 未传,落引擎缺省(50);`'0'` 是显式零值,不当「未传」兜掉。
|
|
52
|
+
* 判定规则正本是 `parseNumericFlag`(harness#154 统一解析器),此处保留 #152 的
|
|
53
|
+
* 函数面与报错文案(冻结测试钉死),只做委派。
|
|
54
|
+
*/
|
|
55
|
+
function assembleShortContentThreshold(raw: string | undefined): ThresholdAssembly {
|
|
56
|
+
return parseNumericFlag(raw, 'int');
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function knowledgeAuditView(options: KnowledgeAuditViewOptions, io: CommandIO) {
|
|
60
|
+
const audit = new KnowledgeAudit(openKnowledgeStore(options, io), {
|
|
61
|
+
shortContentThreshold: options.threshold,
|
|
62
|
+
});
|
|
63
|
+
const isDryRun = options.dryRun && !options.fix;
|
|
64
|
+
if (!isDryRun) announce(io, options.json, '🔍 知识库质量审计...\n');
|
|
65
|
+
const report = audit.run({ autoFix: options.fix && !isDryRun });
|
|
66
|
+
const showFixHint = !options.fix && report.issues.length > 0;
|
|
67
|
+
|
|
68
|
+
return {
|
|
69
|
+
data: report,
|
|
70
|
+
human: (): DisplayModel => ({ sections: auditSections(report, showFixHint) }),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function auditSections(report: AuditReport, showFixHint: boolean): DisplaySection[] {
|
|
75
|
+
const sections: DisplaySection[] = [{
|
|
76
|
+
rows: [
|
|
77
|
+
{ cells: [{ label: ' 总条目: ', tone: 'emph' }, { field: 'totalEntries', text: String(report.totalEntries), tone: 'emph' }] },
|
|
78
|
+
{ cells: [{ label: ' 健康分: ', tone: 'emph' }, { field: 'healthScore.before', text: `${report.healthScore.before}/100`, tone: 'emph' }] },
|
|
79
|
+
],
|
|
80
|
+
}];
|
|
81
|
+
|
|
82
|
+
if (report.autoFixed > 0) {
|
|
83
|
+
sections[0].rows.push(
|
|
84
|
+
{ cells: [{ label: ' 自动修复: ', tone: 'ok' }, { field: 'autoFixed', text: String(report.autoFixed), tone: 'ok' }] },
|
|
85
|
+
{ cells: [{ label: ' 修复后: ', tone: 'emph' }, { field: 'healthScore.after', text: `${report.healthScore.after}/100`, tone: 'emph' }] },
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
sections[0].rows.push(blankLine());
|
|
89
|
+
|
|
90
|
+
const dimensions: DisplayRow[] = [];
|
|
91
|
+
for (const [key, dim] of Object.entries(report.dimensions) as Array<[keyof AuditReport['dimensions'], DimensionMetrics]>) {
|
|
92
|
+
dimensions.push({ cells: [
|
|
93
|
+
{ field: `dimensions.${key}`, text: ` ${dimensionLabel(key)}: ` },
|
|
94
|
+
{ field: `dimensions.${key}.score`, text: `${dim.score}/100`, tone: toneForScore(dim.score) },
|
|
95
|
+
{ field: `dimensions.${key}.issues`, text: ` (${dim.issues} 问题)` },
|
|
96
|
+
] });
|
|
97
|
+
}
|
|
98
|
+
dimensions.push(blankLine());
|
|
99
|
+
sections.push({ title: ' 维度评分:', rows: dimensions });
|
|
100
|
+
|
|
101
|
+
// 规则 label 正本在 audit-rules.ts 的规则定义上(#109 编译期闭环经 ruleLabel 转发)
|
|
102
|
+
const rules: DisplayRow[] = [];
|
|
103
|
+
for (const [rule, count] of Object.entries(report.summary) as Array<[AuditRuleName, number]>) {
|
|
104
|
+
if (count === 0) continue;
|
|
105
|
+
rules.push({ cells: [{ field: `summary.${rule}`, text: ` ${ruleLabel(rule)}: ${count}`, tone: 'error' }] });
|
|
106
|
+
}
|
|
107
|
+
if (report.issues.length > 0) {
|
|
108
|
+
rules.push(blankLine()); // 「问题详情」标题前的空行(原排版是 `\n` 前缀)
|
|
109
|
+
}
|
|
110
|
+
sections.push({ rows: rules });
|
|
111
|
+
|
|
112
|
+
if (report.issues.length > 0) {
|
|
113
|
+
const issues: DisplayRow[] = [blankLine()];
|
|
114
|
+
for (const [i, issue] of report.issues.slice(0, 20).entries()) {
|
|
115
|
+
issues.push({ cells: [
|
|
116
|
+
{ field: `issues.${i}.severity`, text: ` [${issue.severity}]`, tone: toneForSeverity(issue.severity) },
|
|
117
|
+
{ field: `issues.${i}.entryId`, text: ` ${issue.entryId}: ` },
|
|
118
|
+
{ field: `issues.${i}.title`, text: issue.title },
|
|
119
|
+
] });
|
|
120
|
+
issues.push({ cells: [
|
|
121
|
+
{ field: `issues.${i}.detail`, text: ` ${issue.detail}`, tone: 'muted' },
|
|
122
|
+
{ label: ' → ' },
|
|
123
|
+
{ field: `issues.${i}.action`, text: issue.action },
|
|
124
|
+
] });
|
|
125
|
+
}
|
|
126
|
+
if (report.issues.length > 20) {
|
|
127
|
+
issues.push(blankLine(), { cells: [
|
|
128
|
+
{ label: ' ... 还有 ', tone: 'muted' },
|
|
129
|
+
{ field: 'issues.length', text: String(report.issues.length - 20), tone: 'muted' },
|
|
130
|
+
{ label: ' 条', tone: 'muted' },
|
|
131
|
+
] });
|
|
132
|
+
}
|
|
133
|
+
sections.push({ title: ' 问题详情 (前 20 条):', rows: issues });
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (showFixHint) {
|
|
137
|
+
sections.push({ rows: [blankLine(), { cells: [{ label: ' 使用 --fix 自动修复', tone: 'warn' }] }] });
|
|
138
|
+
}
|
|
139
|
+
return sections;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export async function knowledgeAudit(options: KnowledgeAuditOptions, io: CommandIO = processIO): Promise<CommandResult> {
|
|
143
|
+
const threshold = assembleShortContentThreshold(options.threshold);
|
|
144
|
+
if (!threshold.ok) {
|
|
145
|
+
logError(io, `错误:--threshold 需要非负整数阈值(字符数),收到 "${threshold.raw}";短内容判定未执行`);
|
|
146
|
+
return { kind: 'usage-error', reason: `knowledge audit --threshold 非法阈值: "${threshold.raw}"` };
|
|
147
|
+
}
|
|
148
|
+
const result = emitKnowledgeView(io, options, knowledgeAuditView({ ...options, threshold: threshold.value }, io));
|
|
149
|
+
// 审计可能改文件,人读路径收尾重建索引;--json 保持不写盘(现状冻结,#133 不动这条策略)
|
|
150
|
+
if (!options.json) {
|
|
151
|
+
new KnowledgeIndexGenerator(resolveKnowledgeBaseDir(options, io)).regenerate();
|
|
152
|
+
announce(io, options.json, ' 📇 索引已重建', 'muted');
|
|
153
|
+
}
|
|
154
|
+
return result;
|
|
155
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* harness knowledge decay 子命令(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 { KnowledgeLifecycle } from '../../../knowledge/lifecycle';
|
|
10
|
+
import type { MaturityChange } from '../../../knowledge/types';
|
|
11
|
+
import { processIO, type CommandIO, type CommandResult } from '../../command-contract';
|
|
12
|
+
import {
|
|
13
|
+
announce,
|
|
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 knowledgeDecayView(options: KnowledgeOptions, io: CommandIO) {
|
|
23
|
+
const lifecycle = new KnowledgeLifecycle(openKnowledgeStore(options, io));
|
|
24
|
+
announce(io, options.json, '🔄 运行衰减周期...');
|
|
25
|
+
const changes = lifecycle.runDecayCycle();
|
|
26
|
+
const data = { changes };
|
|
27
|
+
|
|
28
|
+
return { data, human: (): DisplayModel => ({ sections: [{ rows: decayRows(changes) }] }) };
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function decayRows(changes: MaturityChange[]): DisplayRow[] {
|
|
32
|
+
if (changes.length === 0) {
|
|
33
|
+
return [{ cells: [{ label: '✅ 没有需要衰减的知识条目', tone: 'ok' }] }];
|
|
34
|
+
}
|
|
35
|
+
const rows: DisplayRow[] = [
|
|
36
|
+
{ cells: [
|
|
37
|
+
{ label: '📉 ', tone: 'warn' },
|
|
38
|
+
{ field: 'changes.length', text: String(changes.length), tone: 'warn' },
|
|
39
|
+
{ label: ' 条知识发生衰减:', tone: 'warn' },
|
|
40
|
+
] },
|
|
41
|
+
blankLine(),
|
|
42
|
+
];
|
|
43
|
+
changes.forEach((change, i) => {
|
|
44
|
+
rows.push({ cells: [
|
|
45
|
+
{ field: `changes.${i}.entryId`, text: ` ${change.entryId}: ` },
|
|
46
|
+
{ field: `changes.${i}.from`, text: change.from, tone: 'error' },
|
|
47
|
+
{ label: ' → ' },
|
|
48
|
+
{ field: `changes.${i}.to`, text: change.to, tone: 'ok' },
|
|
49
|
+
] });
|
|
50
|
+
rows.push({ cells: [{ field: `changes.${i}.reason`, text: ` ${change.reason}`, tone: 'muted' }] });
|
|
51
|
+
});
|
|
52
|
+
return rows;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export async function knowledgeDecay(options: KnowledgeOptions, io: CommandIO = processIO): Promise<CommandResult> {
|
|
56
|
+
return emitKnowledgeView(io, options, knowledgeDecayView(options, io));
|
|
57
|
+
}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* harness knowledge health 子命令(飞轮健康检查 — 零 token 检测数据流状态;
|
|
3
|
+
* Phase 3 自 knowledge.ts 拆出,纯移位)
|
|
4
|
+
*
|
|
5
|
+
* 本文件只做「取数 + 声明两投影」:健康分与过期判定不自有算法——健康分 =
|
|
6
|
+
* `audit-scoring.calculateHealthScore`,过期条目 = `audit-rules` 的 stale-entry
|
|
7
|
+
* 规则命中(ADR-0040 Phase 4 收口,此前本文件内联第三套打分与过期口径)。
|
|
8
|
+
* 上色、json/人读分派、退出码、路径解析与 store 构造统一在
|
|
9
|
+
* knowledge-view.ts(harness#133,架构评审候选4)。
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import * as fs from 'fs';
|
|
13
|
+
import * as path from 'path';
|
|
14
|
+
import { evaluateFlywheel } from '../../../knowledge/flywheel-metrics';
|
|
15
|
+
import { AUDIT_RULE_LABELS } from '../../../knowledge/audit-rules';
|
|
16
|
+
import { calculateHealthScore, scanEntries } from '../../../knowledge/audit-scoring';
|
|
17
|
+
import { processIO, type CommandIO, type CommandResult } from '../../command-contract';
|
|
18
|
+
import {
|
|
19
|
+
blankLine,
|
|
20
|
+
emitKnowledgeView,
|
|
21
|
+
openKnowledgeStore,
|
|
22
|
+
toneForScore,
|
|
23
|
+
toneForSeverity,
|
|
24
|
+
type DisplayModel,
|
|
25
|
+
type DisplayRow,
|
|
26
|
+
type DisplaySection,
|
|
27
|
+
} from '../knowledge-view';
|
|
28
|
+
import type { KnowledgeDirOption, KnowledgeOptions } from './shared';
|
|
29
|
+
|
|
30
|
+
interface HealthIssue {
|
|
31
|
+
severity: 'error' | 'warn' | 'info';
|
|
32
|
+
entry: string;
|
|
33
|
+
detail: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** health 的 json 面正本(字段清单冻结在 __tests__/knowledge-view.test.ts) */
|
|
37
|
+
interface HealthData {
|
|
38
|
+
healthScore: number;
|
|
39
|
+
summary: {
|
|
40
|
+
total: number;
|
|
41
|
+
lowRefEntries: number;
|
|
42
|
+
staleEntries: number;
|
|
43
|
+
consumptionData: boolean;
|
|
44
|
+
refCoverage: number;
|
|
45
|
+
avgRefs: number;
|
|
46
|
+
};
|
|
47
|
+
issues: HealthIssue[];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** audit severity → 本命令三档展示severity */
|
|
51
|
+
function displaySeverity(severity: 'low' | 'medium' | 'high' | 'critical'): HealthIssue['severity'] {
|
|
52
|
+
if (severity === 'critical' || severity === 'high') return 'error';
|
|
53
|
+
if (severity === 'medium') return 'warn';
|
|
54
|
+
return 'info';
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function knowledgeHealthView(options: KnowledgeOptions & KnowledgeDirOption, io: CommandIO) {
|
|
58
|
+
const store = openKnowledgeStore(options, io);
|
|
59
|
+
const baseDir = store.getBaseDir();
|
|
60
|
+
const entries = store.list({ excludeArchived: true });
|
|
61
|
+
|
|
62
|
+
// 健康分与过期判定唯一正本 = audit 纯打分(stale-entry 口径:lastReferenced || created 超阈值)
|
|
63
|
+
const auditIssues = scanEntries(entries, {}, entries);
|
|
64
|
+
const healthScore = calculateHealthScore(entries, auditIssues);
|
|
65
|
+
const staleEntries = auditIssues.filter(i => i.rule === 'stale-entry').length;
|
|
66
|
+
|
|
67
|
+
const issues: HealthIssue[] = auditIssues.map(i => ({
|
|
68
|
+
severity: displaySeverity(i.severity),
|
|
69
|
+
entry: i.entryId,
|
|
70
|
+
detail: `${AUDIT_RULE_LABELS[i.rule]}: ${i.detail}`,
|
|
71
|
+
}));
|
|
72
|
+
|
|
73
|
+
// D1: 引用密度检查(低引用 = 可能孤立;逐条 issue 线索,非聚合分子,ADR-0013 范围外)
|
|
74
|
+
let lowRefEntries = 0;
|
|
75
|
+
for (const entry of entries) {
|
|
76
|
+
if (entry.referencedBy.length === 0 && entry.maturity === 'verified') {
|
|
77
|
+
lowRefEntries++;
|
|
78
|
+
issues.push({ severity: 'info', entry: entry.id, detail: `verified 条目零引用(可能孤立)` });
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// D3: 消费数据检查
|
|
83
|
+
const statsPath = path.join(baseDir, '.consumption-stats.json');
|
|
84
|
+
const consumptionData = fs.existsSync(statsPath);
|
|
85
|
+
if (!consumptionData) {
|
|
86
|
+
issues.push({ severity: 'info', entry: '-', detail: `消费追踪数据不存在(${statsPath})` });
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// D4: 飞轮指标(计算唯一实现在 knowledge/flywheel-metrics;人口为本命令的 excludeArchived 切片)
|
|
90
|
+
const metrics = evaluateFlywheel({ entries });
|
|
91
|
+
const refCoverage = Math.round(metrics.refCoverage * 100);
|
|
92
|
+
const avgRefs = Math.round(metrics.avgRefs * 10) / 10;
|
|
93
|
+
|
|
94
|
+
const data: HealthData = {
|
|
95
|
+
healthScore,
|
|
96
|
+
summary: { total: entries.length, lowRefEntries, staleEntries, consumptionData, refCoverage, avgRefs },
|
|
97
|
+
issues: issues.slice(0, 50),
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
return { data, human: (): DisplayModel => ({ sections: healthSections(data) }) };
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function healthSections(data: HealthData): DisplaySection[] {
|
|
104
|
+
const { healthScore, summary, issues } = data;
|
|
105
|
+
const scoreTone = toneForScore(healthScore);
|
|
106
|
+
return [
|
|
107
|
+
{
|
|
108
|
+
rows: [
|
|
109
|
+
{ cells: [{ label: '🏥 飞轮健康检查', tone: 'heading' }] },
|
|
110
|
+
blankLine(),
|
|
111
|
+
{ cells: [
|
|
112
|
+
{ label: ' 健康分: ', tone: 'emph' },
|
|
113
|
+
{ field: 'healthScore', text: String(healthScore), tone: scoreTone },
|
|
114
|
+
{ label: '/100', tone: 'emph' },
|
|
115
|
+
] },
|
|
116
|
+
{ cells: [
|
|
117
|
+
{ label: ' 活跃条目: ', tone: 'emph' },
|
|
118
|
+
{ field: 'summary.total', text: String(summary.total), tone: 'emph' },
|
|
119
|
+
] },
|
|
120
|
+
blankLine(),
|
|
121
|
+
],
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
title: ' 数据流状态:',
|
|
125
|
+
rows: [
|
|
126
|
+
densityRow(' 引用密度: ', 'summary.lowRefEntries', summary.lowRefEntries, ' 个零引用 verified'),
|
|
127
|
+
densityRow(' 新鲜度: ', 'summary.staleEntries', summary.staleEntries, ' 个过期条目'),
|
|
128
|
+
{ cells: [
|
|
129
|
+
{ label: ' 消费追踪: ' },
|
|
130
|
+
summary.consumptionData
|
|
131
|
+
? { label: '✓', tone: 'ok' }
|
|
132
|
+
: { field: 'summary.consumptionData', text: '○ 未启用', tone: 'muted' },
|
|
133
|
+
] },
|
|
134
|
+
blankLine(),
|
|
135
|
+
],
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
title: ' 飞轮指标:',
|
|
139
|
+
rows: [
|
|
140
|
+
{ cells: [{ label: ' 引用覆盖: ' }, { field: 'summary.refCoverage', text: `${summary.refCoverage}%` }] },
|
|
141
|
+
{ cells: [{ label: ' 平均引用: ' }, { field: 'summary.avgRefs', text: String(summary.avgRefs) }] },
|
|
142
|
+
blankLine(),
|
|
143
|
+
],
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
title: ' 问题 (前 20):',
|
|
147
|
+
rows: issues.length === 0
|
|
148
|
+
? [{ cells: [{ label: ' ✓ 无问题', tone: 'ok' }] }]
|
|
149
|
+
: [
|
|
150
|
+
...issues.slice(0, 20).map((issue, i) => ({
|
|
151
|
+
cells: [
|
|
152
|
+
{ field: `issues.${i}.severity`, text: ` [${issue.severity}]`, tone: toneForSeverity(issue.severity) },
|
|
153
|
+
{ field: `issues.${i}.entry`, text: ` ${issue.entry}: ` },
|
|
154
|
+
{ field: `issues.${i}.detail`, text: issue.detail },
|
|
155
|
+
],
|
|
156
|
+
})),
|
|
157
|
+
// 溢出计数取全量数组,而 json 面的 issues 已截 50 条 → 无字段可锚,登记派生量
|
|
158
|
+
...(issues.length > 20
|
|
159
|
+
? [{ cells: [{ derived: 'healthIssuesOverflow', text: ` ... 还有 ${issues.length - 20} 条`, tone: 'muted' as const }] }]
|
|
160
|
+
: []),
|
|
161
|
+
],
|
|
162
|
+
},
|
|
163
|
+
];
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function densityRow(prefix: string, field: string, count: number, suffix: string): DisplayRow {
|
|
167
|
+
if (count === 0) return { cells: [{ label: prefix }, { label: '✓', tone: 'ok' }] };
|
|
168
|
+
return {
|
|
169
|
+
cells: [
|
|
170
|
+
{ label: prefix },
|
|
171
|
+
{ label: '⚠ ', tone: 'warn' },
|
|
172
|
+
{ field, text: String(count), tone: 'warn' },
|
|
173
|
+
{ label: suffix, tone: 'warn' },
|
|
174
|
+
],
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export async function knowledgeHealth(options: KnowledgeOptions & KnowledgeDirOption, io: CommandIO = processIO): Promise<CommandResult> {
|
|
179
|
+
return emitKnowledgeView(io, options, knowledgeHealthView(options, io));
|
|
180
|
+
}
|