@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
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* SpecAcceptanceGate 测试
|
|
3
|
+
*
|
|
4
|
+
* 旧格式 `acceptance_criteria` 兼容分支已删(gates 层现代化):本文件只喂
|
|
5
|
+
* 新契约 `acceptance`。判定语义:checked:true → 满足;未勾选带 e2e_test →
|
|
6
|
+
* 跑测试按结论判定;未勾选无 e2e_test → 不满足(判负)。
|
|
3
7
|
*/
|
|
4
8
|
|
|
5
9
|
import { SpecAcceptanceGate } from '../acceptance';
|
|
@@ -68,11 +72,8 @@ tasks: []
|
|
|
68
72
|
tasks:
|
|
69
73
|
- id: TASK-001
|
|
70
74
|
description: Test task
|
|
71
|
-
|
|
72
|
-
-
|
|
73
|
-
description: Test criteria
|
|
74
|
-
type: manual
|
|
75
|
-
required: true
|
|
75
|
+
acceptance:
|
|
76
|
+
- description: Test criteria
|
|
76
77
|
checked: true
|
|
77
78
|
`);
|
|
78
79
|
|
|
@@ -101,37 +102,60 @@ tasks:
|
|
|
101
102
|
expect(result.message).toContain('Task not found');
|
|
102
103
|
});
|
|
103
104
|
|
|
104
|
-
it('
|
|
105
|
+
it('YAML 解析失败 → 抛出(fail-fast,不拼错误报告)', async () => {
|
|
105
106
|
mockFs.readFile.mockResolvedValueOnce('invalid: yaml: content: [');
|
|
106
107
|
|
|
107
|
-
|
|
108
|
+
await expect(gate.check({
|
|
108
109
|
projectPath: '/test/project',
|
|
109
|
-
});
|
|
110
|
+
})).rejects.toThrow();
|
|
111
|
+
});
|
|
110
112
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
+
it('tasks.yml 缺 tasks 数组 → 抛出指名路径的格式错误', async () => {
|
|
114
|
+
mockFs.readFile.mockResolvedValueOnce('foo: bar');
|
|
115
|
+
|
|
116
|
+
await expect(gate.check({
|
|
117
|
+
projectPath: '/test/project',
|
|
118
|
+
})).rejects.toThrow('tasks.yml 格式非法');
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
it('任务缺 id → 抛出格式错误', async () => {
|
|
122
|
+
mockFs.readFile.mockResolvedValueOnce(`
|
|
123
|
+
tasks:
|
|
124
|
+
- description: no id
|
|
125
|
+
`);
|
|
126
|
+
|
|
127
|
+
await expect(gate.check({
|
|
128
|
+
projectPath: '/test/project',
|
|
129
|
+
})).rejects.toThrow('tasks[0] 缺 id');
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
it('acceptance 条目缺 description → 抛出格式错误', async () => {
|
|
133
|
+
mockFs.readFile.mockResolvedValueOnce(`
|
|
134
|
+
tasks:
|
|
135
|
+
- id: TASK-001
|
|
136
|
+
acceptance:
|
|
137
|
+
- checked: true
|
|
138
|
+
`);
|
|
139
|
+
|
|
140
|
+
await expect(gate.check({
|
|
141
|
+
projectPath: '/test/project',
|
|
142
|
+
})).rejects.toThrow('acceptance[0] 缺 description');
|
|
113
143
|
});
|
|
114
144
|
});
|
|
115
145
|
|
|
116
146
|
describe('checkAllTasks mode', () => {
|
|
117
147
|
it('should check all tasks when checkAllTasks is true', async () => {
|
|
118
148
|
const allGate = new SpecAcceptanceGate({ checkAllTasks: true });
|
|
119
|
-
|
|
149
|
+
|
|
120
150
|
mockFs.readFile.mockResolvedValueOnce(`
|
|
121
151
|
tasks:
|
|
122
152
|
- id: TASK-001
|
|
123
|
-
|
|
124
|
-
-
|
|
125
|
-
description: Test
|
|
126
|
-
type: manual
|
|
127
|
-
required: true
|
|
153
|
+
acceptance:
|
|
154
|
+
- description: Test
|
|
128
155
|
checked: true
|
|
129
156
|
- id: TASK-002
|
|
130
|
-
|
|
131
|
-
-
|
|
132
|
-
description: Test 2
|
|
133
|
-
type: manual
|
|
134
|
-
required: true
|
|
157
|
+
acceptance:
|
|
158
|
+
- description: Test 2
|
|
135
159
|
checked: true
|
|
136
160
|
`);
|
|
137
161
|
|
|
@@ -145,22 +169,16 @@ tasks:
|
|
|
145
169
|
|
|
146
170
|
it('should report failed tasks', async () => {
|
|
147
171
|
const allGate = new SpecAcceptanceGate({ checkAllTasks: true });
|
|
148
|
-
|
|
172
|
+
|
|
149
173
|
mockFs.readFile.mockResolvedValueOnce(`
|
|
150
174
|
tasks:
|
|
151
175
|
- id: TASK-001
|
|
152
|
-
|
|
153
|
-
-
|
|
154
|
-
description: Test
|
|
155
|
-
type: manual
|
|
156
|
-
required: true
|
|
176
|
+
acceptance:
|
|
177
|
+
- description: Test
|
|
157
178
|
checked: true
|
|
158
179
|
- id: TASK-002
|
|
159
|
-
|
|
160
|
-
-
|
|
161
|
-
description: Test 2
|
|
162
|
-
type: manual
|
|
163
|
-
required: true
|
|
180
|
+
acceptance:
|
|
181
|
+
- description: Test 2
|
|
164
182
|
checked: false
|
|
165
183
|
`);
|
|
166
184
|
|
|
@@ -194,19 +212,13 @@ tasks:
|
|
|
194
212
|
tasks:
|
|
195
213
|
- id: TASK-001
|
|
196
214
|
status: done
|
|
197
|
-
|
|
198
|
-
-
|
|
199
|
-
description: Test
|
|
200
|
-
type: manual
|
|
201
|
-
required: true
|
|
215
|
+
acceptance:
|
|
216
|
+
- description: Test
|
|
202
217
|
checked: true
|
|
203
218
|
- id: TASK-002
|
|
204
219
|
status: pending
|
|
205
|
-
|
|
206
|
-
-
|
|
207
|
-
description: Test 2
|
|
208
|
-
type: manual
|
|
209
|
-
required: true
|
|
220
|
+
acceptance:
|
|
221
|
+
- description: Test 2
|
|
210
222
|
checked: false
|
|
211
223
|
`);
|
|
212
224
|
|
|
@@ -223,11 +235,8 @@ tasks:
|
|
|
223
235
|
tasks:
|
|
224
236
|
- id: TASK-001
|
|
225
237
|
completed: true
|
|
226
|
-
|
|
227
|
-
-
|
|
228
|
-
description: Test
|
|
229
|
-
type: manual
|
|
230
|
-
required: true
|
|
238
|
+
acceptance:
|
|
239
|
+
- description: Test
|
|
231
240
|
checked: true
|
|
232
241
|
`);
|
|
233
242
|
|
|
@@ -239,22 +248,16 @@ tasks:
|
|
|
239
248
|
});
|
|
240
249
|
});
|
|
241
250
|
|
|
242
|
-
describe('
|
|
243
|
-
it('should pass when all
|
|
251
|
+
describe('acceptance(未勾选判定)', () => {
|
|
252
|
+
it('should pass when all acceptance checked', async () => {
|
|
244
253
|
mockFs.readFile.mockResolvedValueOnce(`
|
|
245
254
|
tasks:
|
|
246
255
|
- id: TASK-001
|
|
247
|
-
|
|
248
|
-
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
required: true
|
|
256
|
+
acceptance:
|
|
257
|
+
- description: Test feature
|
|
258
|
+
checked: true
|
|
259
|
+
- description: Another test
|
|
252
260
|
checked: true
|
|
253
|
-
- id: AC-002
|
|
254
|
-
description: Optional criteria
|
|
255
|
-
type: manual
|
|
256
|
-
required: false
|
|
257
|
-
checked: false
|
|
258
261
|
`);
|
|
259
262
|
|
|
260
263
|
const result = await gate.check({
|
|
@@ -263,24 +266,17 @@ tasks:
|
|
|
263
266
|
});
|
|
264
267
|
|
|
265
268
|
expect(result.passed).toBe(true);
|
|
266
|
-
expect(result.details?.
|
|
269
|
+
expect(result.details?.totalCriteria).toBe(2);
|
|
267
270
|
});
|
|
268
271
|
|
|
269
|
-
it('should fail when
|
|
272
|
+
it('should fail when criteria unchecked (no e2e)', async () => {
|
|
270
273
|
mockFs.readFile.mockResolvedValueOnce(`
|
|
271
274
|
tasks:
|
|
272
275
|
- id: TASK-001
|
|
273
|
-
|
|
274
|
-
-
|
|
275
|
-
description: Required criteria
|
|
276
|
-
type: manual
|
|
277
|
-
required: true
|
|
278
|
-
checked: false
|
|
279
|
-
- id: AC-002
|
|
280
|
-
description: Another required
|
|
281
|
-
type: manual
|
|
282
|
-
required: true
|
|
276
|
+
acceptance:
|
|
277
|
+
- description: Required criteria
|
|
283
278
|
checked: false
|
|
279
|
+
- description: Another required
|
|
284
280
|
`);
|
|
285
281
|
|
|
286
282
|
const result = await gate.check({
|
|
@@ -307,28 +303,6 @@ tasks:
|
|
|
307
303
|
expect(result.passed).toBe(true);
|
|
308
304
|
expect(result.message).toContain('no acceptance criteria');
|
|
309
305
|
});
|
|
310
|
-
});
|
|
311
|
-
|
|
312
|
-
describe('acceptance (new format with E2E tests)', () => {
|
|
313
|
-
it('should pass when all acceptance checked', async () => {
|
|
314
|
-
mockFs.readFile.mockResolvedValueOnce(`
|
|
315
|
-
tasks:
|
|
316
|
-
- id: TASK-001
|
|
317
|
-
acceptance:
|
|
318
|
-
- description: Test feature
|
|
319
|
-
checked: true
|
|
320
|
-
- description: Another test
|
|
321
|
-
checked: true
|
|
322
|
-
`);
|
|
323
|
-
|
|
324
|
-
const result = await gate.check({
|
|
325
|
-
projectPath: '/test/project',
|
|
326
|
-
taskId: 'TASK-001',
|
|
327
|
-
});
|
|
328
|
-
|
|
329
|
-
expect(result.passed).toBe(true);
|
|
330
|
-
expect(result.details?.totalCriteria).toBe(2);
|
|
331
|
-
});
|
|
332
306
|
|
|
333
307
|
it('should run E2E test when specified', async () => {
|
|
334
308
|
mockFs.readFile.mockResolvedValueOnce(`
|
|
@@ -373,7 +347,8 @@ tasks:
|
|
|
373
347
|
});
|
|
374
348
|
|
|
375
349
|
expect(result.passed).toBe(false);
|
|
376
|
-
expect(result.
|
|
350
|
+
expect(result.details?.e2eTestResults?.[0]?.passed).toBe(false);
|
|
351
|
+
expect(result.details?.uncheckedCriteria).toContain('Test feature');
|
|
377
352
|
});
|
|
378
353
|
});
|
|
379
354
|
|
|
@@ -5,14 +5,11 @@
|
|
|
5
5
|
* 收成一个谓词「命令串 → 命中规则集合」,三个入口退化成它之上的投影。本文件钉两件事:
|
|
6
6
|
* ① 源形状闸——匹配语义(模式测试 / 类别忽略)在文件内只有一处落点,grep 可证;
|
|
7
7
|
* ② 一致性闸——同一条目经三个投影得到的裁决互相自洽。
|
|
8
|
-
*
|
|
9
|
-
* ② 用 `addRule()` 挂的合成规则跑,不涉出厂规则表内容(对外措辞纪律 PIT-021)。
|
|
10
8
|
*/
|
|
11
9
|
|
|
12
10
|
import * as fs from 'fs';
|
|
13
11
|
import * as path from 'path';
|
|
14
12
|
import { CommandGate } from '../command';
|
|
15
|
-
import type { CommandBlacklistRule } from '../types';
|
|
16
13
|
|
|
17
14
|
const source = fs.readFileSync(path.join(__dirname, '..', 'command.ts'), 'utf-8');
|
|
18
15
|
|
|
@@ -21,47 +18,6 @@ function count(needle: string): number {
|
|
|
21
18
|
return source.split(needle).length - 1;
|
|
22
19
|
}
|
|
23
20
|
|
|
24
|
-
/** 合成规则:三条各自只匹配自己的记号,级别覆盖 block/warn/audit 三档 */
|
|
25
|
-
const SYN_BLOCK: CommandBlacklistRule = {
|
|
26
|
-
id: 'syn-block',
|
|
27
|
-
pattern: /\bSYN_BLOCK\b/,
|
|
28
|
-
level: 'block',
|
|
29
|
-
message: '合成阻断',
|
|
30
|
-
category: 'syn-a',
|
|
31
|
-
};
|
|
32
|
-
const SYN_WARN: CommandBlacklistRule = {
|
|
33
|
-
id: 'syn-warn',
|
|
34
|
-
pattern: /\bSYN_WARN\b/,
|
|
35
|
-
level: 'warn',
|
|
36
|
-
message: '合成警告',
|
|
37
|
-
category: 'syn-b',
|
|
38
|
-
};
|
|
39
|
-
const SYN_AUDIT: CommandBlacklistRule = {
|
|
40
|
-
id: 'syn-audit',
|
|
41
|
-
pattern: /\bSYN_AUDIT\b/,
|
|
42
|
-
level: 'audit',
|
|
43
|
-
message: '合成审计',
|
|
44
|
-
category: 'syn-c',
|
|
45
|
-
};
|
|
46
|
-
const SYN_IGNORED: CommandBlacklistRule = {
|
|
47
|
-
id: 'syn-ignored',
|
|
48
|
-
pattern: /\bSYN_IGNORED\b/,
|
|
49
|
-
level: 'block',
|
|
50
|
-
message: '合成阻断(类别被忽略)',
|
|
51
|
-
category: 'syn-d',
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
/** 装配一台只认合成规则的门禁:出厂规则整体移除,投影一致性判定的输入面因此可控 */
|
|
55
|
-
function syntheticGate(): CommandGate {
|
|
56
|
-
const gate = new CommandGate();
|
|
57
|
-
for (const rule of gate.getBlacklist()) gate.removeRule(rule.id);
|
|
58
|
-
gate.addRule(SYN_WARN);
|
|
59
|
-
gate.addRule(SYN_BLOCK);
|
|
60
|
-
gate.addRule(SYN_AUDIT);
|
|
61
|
-
gate.addRule(SYN_IGNORED);
|
|
62
|
-
return gate;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
21
|
describe('CommandGate 匹配循环唯一化(#135)', () => {
|
|
66
22
|
describe('源形状闸:匹配语义只有一处落点', () => {
|
|
67
23
|
it('规则模式测试恰好一处(此前三条循环各写一遍)', () => {
|
|
@@ -80,12 +36,12 @@ describe('CommandGate 匹配循环唯一化(#135)', () => {
|
|
|
80
36
|
|
|
81
37
|
describe('三投影对同一输入互相自洽', () => {
|
|
82
38
|
it('单条命中:check 的裁决 / isAllowed 的布尔 / getRiskLevel 的等级三者一致', async () => {
|
|
83
|
-
const gate =
|
|
39
|
+
const gate = new CommandGate();
|
|
84
40
|
const cases: Array<{ command: string; passed: boolean; allowed: boolean; level: string }> = [
|
|
85
|
-
{ command: '
|
|
86
|
-
{ command: '
|
|
87
|
-
{ command: '
|
|
88
|
-
{ command: '
|
|
41
|
+
{ command: 'git push --force', passed: false, allowed: false, level: 'high' },
|
|
42
|
+
{ command: 'git reset --hard', passed: true, allowed: true, level: 'medium' },
|
|
43
|
+
{ command: 'cat ~/.ssh/id_rsa', passed: true, allowed: true, level: 'low' },
|
|
44
|
+
{ command: 'ls -la', passed: true, allowed: true, level: 'low' },
|
|
89
45
|
];
|
|
90
46
|
|
|
91
47
|
for (const { command, passed, allowed, level } of cases) {
|
|
@@ -97,14 +53,14 @@ describe('CommandGate 匹配循环唯一化(#135)', () => {
|
|
|
97
53
|
});
|
|
98
54
|
|
|
99
55
|
it('不变式:blocked 级命中 ⟺ check 不通过 ⟺ isAllowed false ⟺ 等级 high', async () => {
|
|
100
|
-
const gate =
|
|
101
|
-
const corpus = ['
|
|
56
|
+
const gate = new CommandGate();
|
|
57
|
+
const corpus = ['git push --force', 'git reset --hard', 'cat ~/.ssh/id_rsa', 'git reset --hard; cat ~/.ssh/id_rsa', 'ls'];
|
|
102
58
|
|
|
103
59
|
for (const command of corpus) {
|
|
104
60
|
const result = await gate.check(command);
|
|
105
61
|
const allowed = gate.isAllowed(command);
|
|
106
62
|
const level = gate.getRiskLevel(command);
|
|
107
|
-
const blocked = (result.details?.blocked ?? []).length > 0;
|
|
63
|
+
const blocked = ((result.details?.blocked ?? []) as unknown[]).length > 0;
|
|
108
64
|
|
|
109
65
|
expect(allowed).toBe(!blocked);
|
|
110
66
|
expect(result.passed).toBe(!blocked);
|
|
@@ -113,9 +69,10 @@ describe('CommandGate 匹配循环唯一化(#135)', () => {
|
|
|
113
69
|
});
|
|
114
70
|
|
|
115
71
|
it('等级取命中集合里的最高档,与规则表次序无关(首条命中即返回的旧语义不再存在)', async () => {
|
|
116
|
-
const gate =
|
|
117
|
-
//
|
|
118
|
-
|
|
72
|
+
const gate = new CommandGate();
|
|
73
|
+
// 'chown root'(warn)在出厂规则表里排在 'sudo rm'(block)之前:
|
|
74
|
+
// 只取首条命中会报 medium 而 check/isAllowed 判阻断
|
|
75
|
+
const command = 'chown root /tmp/x && sudo rm /tmp/y';
|
|
119
76
|
|
|
120
77
|
expect(gate.getRiskLevel(command)).toBe('high');
|
|
121
78
|
expect(gate.isAllowed(command)).toBe(false);
|
|
@@ -123,13 +80,11 @@ describe('CommandGate 匹配循环唯一化(#135)', () => {
|
|
|
123
80
|
});
|
|
124
81
|
|
|
125
82
|
it('忽略类别对三投影同样生效(同一谓词,不会一处忽略一处不忽略)', async () => {
|
|
126
|
-
const gate = new CommandGate({ ignoreCategories: ['
|
|
127
|
-
for (const rule of gate.getBlacklist()) gate.removeRule(rule.id);
|
|
128
|
-
gate.addRule(SYN_IGNORED);
|
|
83
|
+
const gate = new CommandGate({ ignoreCategories: ['git'] });
|
|
129
84
|
|
|
130
|
-
expect(gate.isAllowed('
|
|
131
|
-
expect(gate.getRiskLevel('
|
|
132
|
-
expect((await gate.check('
|
|
85
|
+
expect(gate.isAllowed('git push --force')).toBe(true);
|
|
86
|
+
expect(gate.getRiskLevel('git push --force')).toBe('low');
|
|
87
|
+
expect((await gate.check('git push --force')).passed).toBe(true);
|
|
133
88
|
});
|
|
134
89
|
});
|
|
135
90
|
});
|
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { CommandGate, DEFAULT_COMMAND_BLACKLIST } from '../command';
|
|
6
|
+
import type { CommandBlacklistRule, GateResult } from '../types';
|
|
7
|
+
|
|
8
|
+
/** details 负载窄化(报告袋是 Record<string, unknown>,测试按裁决形状读取) */
|
|
9
|
+
interface CommandDetails {
|
|
10
|
+
blocked: CommandBlacklistRule[];
|
|
11
|
+
warnings: CommandBlacklistRule[];
|
|
12
|
+
audits: CommandBlacklistRule[];
|
|
13
|
+
}
|
|
14
|
+
function detailsOf(r: GateResult): CommandDetails {
|
|
15
|
+
return r.details as unknown as CommandDetails;
|
|
16
|
+
}
|
|
6
17
|
|
|
7
18
|
describe('CommandGate', () => {
|
|
8
19
|
describe('check', () => {
|
|
@@ -10,7 +21,7 @@ describe('CommandGate', () => {
|
|
|
10
21
|
const gate = new CommandGate();
|
|
11
22
|
const result = await gate.check('rm -rf /');
|
|
12
23
|
expect(result.passed).toBe(false);
|
|
13
|
-
expect(result.
|
|
24
|
+
expect(detailsOf(result).blocked.length).toBe(1);
|
|
14
25
|
});
|
|
15
26
|
|
|
16
27
|
it('should block rm -rf *', async () => {
|
|
@@ -23,14 +34,14 @@ describe('CommandGate', () => {
|
|
|
23
34
|
const gate = new CommandGate();
|
|
24
35
|
const result = await gate.check('sudo rm -rf /home');
|
|
25
36
|
expect(result.passed).toBe(false);
|
|
26
|
-
expect(result.
|
|
37
|
+
expect(detailsOf(result).blocked.some((r) => r.category === 'privilege')).toBe(true);
|
|
27
38
|
});
|
|
28
39
|
|
|
29
40
|
it('should warn on DROP TABLE', async () => {
|
|
30
41
|
const gate = new CommandGate();
|
|
31
42
|
const result = await gate.check('DROP TABLE users;');
|
|
32
43
|
expect(result.passed).toBe(true); // warn, not block
|
|
33
|
-
expect(result.
|
|
44
|
+
expect(detailsOf(result).warnings.length).toBe(1);
|
|
34
45
|
});
|
|
35
46
|
|
|
36
47
|
it('should block DROP DATABASE', async () => {
|
|
@@ -67,7 +78,7 @@ describe('CommandGate', () => {
|
|
|
67
78
|
const gate = new CommandGate();
|
|
68
79
|
const result = await gate.check('cat ~/.ssh/id_rsa');
|
|
69
80
|
expect(result.passed).toBe(true); // audit, not block
|
|
70
|
-
expect(result.
|
|
81
|
+
expect(detailsOf(result).audits.length).toBe(1);
|
|
71
82
|
});
|
|
72
83
|
|
|
73
84
|
it('should allow safe commands', async () => {
|
|
@@ -83,23 +94,10 @@ describe('CommandGate', () => {
|
|
|
83
94
|
for (const cmd of safeCommands) {
|
|
84
95
|
const result = await gate.check(cmd);
|
|
85
96
|
expect(result.passed).toBe(true);
|
|
86
|
-
expect(result.
|
|
97
|
+
expect(detailsOf(result).blocked.length).toBe(0);
|
|
87
98
|
}
|
|
88
99
|
});
|
|
89
100
|
|
|
90
|
-
it('should support runtime rules via addRule(配置位 customBlacklist 已删,见 ADR-0024)', async () => {
|
|
91
|
-
const gate = new CommandGate();
|
|
92
|
-
gate.addRule({
|
|
93
|
-
id: 'custom-block',
|
|
94
|
-
pattern: /\bmy-custom-dangerous-command\b/i,
|
|
95
|
-
level: 'block',
|
|
96
|
-
message: 'Custom dangerous command',
|
|
97
|
-
category: 'custom',
|
|
98
|
-
});
|
|
99
|
-
const result = await gate.check('my-custom-dangerous-command --run');
|
|
100
|
-
expect(result.passed).toBe(false);
|
|
101
|
-
});
|
|
102
|
-
|
|
103
101
|
it('should respect ignoreCategories', async () => {
|
|
104
102
|
const gate = new CommandGate({ ignoreCategories: ['database'] });
|
|
105
103
|
const result = await gate.check('DROP DATABASE test;');
|
|
@@ -155,7 +153,7 @@ describe('CommandGate', () => {
|
|
|
155
153
|
it('should block rm -rf ~', async () => {
|
|
156
154
|
const r = await gate.check('rm -rf /home/user/.cache');
|
|
157
155
|
expect(r.passed).toBe(false);
|
|
158
|
-
expect(r.
|
|
156
|
+
expect(detailsOf(r).blocked.some((b) => b.id === 'rm-rf-home')).toBe(true);
|
|
159
157
|
});
|
|
160
158
|
|
|
161
159
|
it('should block rm -rf .', async () => {
|
|
@@ -171,12 +169,12 @@ describe('CommandGate', () => {
|
|
|
171
169
|
it('should block chmod -R 777', async () => {
|
|
172
170
|
const r = await gate.check('chmod -R 777 /home');
|
|
173
171
|
expect(r.passed).toBe(false);
|
|
174
|
-
expect(r.
|
|
172
|
+
expect(detailsOf(r).blocked.some((b) => b.category === 'permission')).toBe(true);
|
|
175
173
|
});
|
|
176
174
|
|
|
177
175
|
it('should warn on chown root', async () => {
|
|
178
176
|
const r = await gate.check('chown root:root /etc/config');
|
|
179
|
-
expect(r.
|
|
177
|
+
expect(detailsOf(r).warnings.some((w) => w.id === 'chown-root')).toBe(true);
|
|
180
178
|
});
|
|
181
179
|
|
|
182
180
|
it('should allow safe uninstall commands', async () => {
|
|
@@ -192,7 +190,7 @@ describe('CommandGate', () => {
|
|
|
192
190
|
it('should block git push --force', async () => {
|
|
193
191
|
const r = await gate.check('git push --force origin master');
|
|
194
192
|
expect(r.passed).toBe(false);
|
|
195
|
-
expect(r.
|
|
193
|
+
expect(detailsOf(r).blocked.some((b) => b.id === 'git-push-force')).toBe(true);
|
|
196
194
|
});
|
|
197
195
|
|
|
198
196
|
it('should block git push -f and --force-with-lease', async () => {
|
|
@@ -204,7 +202,7 @@ describe('CommandGate', () => {
|
|
|
204
202
|
for (const cmd of ['git clean -f', 'git clean -fd', 'git clean -fdx']) {
|
|
205
203
|
const r = await gate.check(cmd);
|
|
206
204
|
expect(r.passed).toBe(false);
|
|
207
|
-
expect(r.
|
|
205
|
+
expect(detailsOf(r).blocked.some((b) => b.id === 'git-clean-force')).toBe(true);
|
|
208
206
|
}
|
|
209
207
|
});
|
|
210
208
|
|
|
@@ -218,7 +216,7 @@ describe('CommandGate', () => {
|
|
|
218
216
|
];
|
|
219
217
|
for (const [cmd, id] of cases) {
|
|
220
218
|
const r = await gate.check(cmd);
|
|
221
|
-
expect(r.
|
|
219
|
+
expect(detailsOf(r).warnings.some((w) => w.id === id)).toBe(true);
|
|
222
220
|
}
|
|
223
221
|
});
|
|
224
222
|
|
|
@@ -234,7 +232,7 @@ describe('CommandGate', () => {
|
|
|
234
232
|
]) {
|
|
235
233
|
const r = await gate.check(cmd);
|
|
236
234
|
expect(r.passed).toBe(true);
|
|
237
|
-
expect(r.
|
|
235
|
+
expect(detailsOf(r).warnings).toEqual([]);
|
|
238
236
|
}
|
|
239
237
|
});
|
|
240
238
|
});
|
|
@@ -62,7 +62,7 @@ describe('SecurityGate 统一接口', () => {
|
|
|
62
62
|
|
|
63
63
|
it('npm audit 零漏洞 → abstain', async () => {
|
|
64
64
|
mockExec.mockImplementation((_cmd, _opts, callback) =>
|
|
65
|
-
callback(null, { stdout: JSON.stringify({
|
|
65
|
+
callback(null, { stdout: JSON.stringify({ vulnerabilities: {} }) })
|
|
66
66
|
);
|
|
67
67
|
const decision = await new SecurityGate().evaluate({
|
|
68
68
|
projectPath: '/test/project',
|
|
@@ -75,10 +75,8 @@ describe('SecurityGate 统一接口', () => {
|
|
|
75
75
|
mockExec.mockImplementation((_cmd, _opts, callback) =>
|
|
76
76
|
callback(null, {
|
|
77
77
|
stdout: JSON.stringify({
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
'1': { severity: 'critical', name: 'bad-lib', via: [{ title: 'RCE' }] },
|
|
81
|
-
},
|
|
78
|
+
vulnerabilities: {
|
|
79
|
+
'bad-lib': { severity: 'critical', via: [{ title: 'RCE' }] },
|
|
82
80
|
},
|
|
83
81
|
}),
|
|
84
82
|
})
|
|
@@ -134,11 +132,8 @@ describe('SpecAcceptanceGate 统一接口', () => {
|
|
|
134
132
|
'tasks:',
|
|
135
133
|
' - id: TASK-001',
|
|
136
134
|
' status: done',
|
|
137
|
-
'
|
|
138
|
-
' -
|
|
139
|
-
' description: Test',
|
|
140
|
-
' type: manual',
|
|
141
|
-
' required: true',
|
|
135
|
+
' acceptance:',
|
|
136
|
+
' - description: Test',
|
|
142
137
|
' checked: false',
|
|
143
138
|
].join('\n')
|
|
144
139
|
);
|
|
@@ -32,18 +32,17 @@ describe('PerformanceGate', () => {
|
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
describe('constructor', () => {
|
|
35
|
-
it('should use default config', () => {
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
expect(
|
|
35
|
+
it('should use default config', async () => {
|
|
36
|
+
// 缺省 thresholds={}:无阈值时检查直接通过
|
|
37
|
+
const result = await gate.check(baseContext);
|
|
38
|
+
expect(result.passed).toBe(true);
|
|
39
39
|
});
|
|
40
40
|
|
|
41
41
|
it('should accept custom config', () => {
|
|
42
42
|
const customGate = new PerformanceGate({
|
|
43
43
|
coverageTimeout: 60000,
|
|
44
44
|
});
|
|
45
|
-
|
|
46
|
-
expect(config.coverageTimeout).toBe(60000);
|
|
45
|
+
expect(customGate).toBeDefined();
|
|
47
46
|
});
|
|
48
47
|
});
|
|
49
48
|
|
|
@@ -155,7 +154,7 @@ describe('PerformanceGate', () => {
|
|
|
155
154
|
const result = await strictGate.check(baseContext);
|
|
156
155
|
|
|
157
156
|
expect(result.details?.metrics).toBeDefined();
|
|
158
|
-
expect(result.details?.metrics.bundleSize).toBeDefined();
|
|
157
|
+
expect((result.details?.metrics as { bundleSize?: number }).bundleSize).toBeDefined();
|
|
159
158
|
});
|
|
160
159
|
});
|
|
161
160
|
|
|
@@ -219,7 +218,7 @@ describe('PerformanceGate', () => {
|
|
|
219
218
|
|
|
220
219
|
const result = await strictGate.check(baseContext);
|
|
221
220
|
|
|
222
|
-
expect(result.details?.metrics.bundleSize).toBe(500); // 200KB + 300KB
|
|
221
|
+
expect((result.details?.metrics as { bundleSize?: number }).bundleSize).toBe(500); // 200KB + 300KB
|
|
223
222
|
});
|
|
224
223
|
|
|
225
224
|
it('should skip directories', async () => {
|
|
@@ -234,52 +233,7 @@ describe('PerformanceGate', () => {
|
|
|
234
233
|
|
|
235
234
|
const result = await strictGate.check(baseContext);
|
|
236
235
|
|
|
237
|
-
expect(result.details?.metrics.bundleSize).toBe(100);
|
|
238
|
-
});
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
describe('setThresholds()', () => {
|
|
242
|
-
it('should update thresholds', () => {
|
|
243
|
-
gate.setThresholds({
|
|
244
|
-
minCoverage: 90,
|
|
245
|
-
maxBundleSize: 500,
|
|
246
|
-
});
|
|
247
|
-
|
|
248
|
-
const config = gate.getConfig();
|
|
249
|
-
expect(config.thresholds.minCoverage).toBe(90);
|
|
250
|
-
expect(config.thresholds.maxBundleSize).toBe(500);
|
|
251
|
-
});
|
|
252
|
-
|
|
253
|
-
it('should merge with existing thresholds', () => {
|
|
254
|
-
const customGate = new PerformanceGate({
|
|
255
|
-
thresholds: { minCoverage: 50 },
|
|
256
|
-
});
|
|
257
|
-
|
|
258
|
-
customGate.setThresholds({ maxBundleSize: 1000 });
|
|
259
|
-
|
|
260
|
-
const config = customGate.getConfig();
|
|
261
|
-
expect(config.thresholds.minCoverage).toBe(50);
|
|
262
|
-
expect(config.thresholds.maxBundleSize).toBe(1000);
|
|
263
|
-
});
|
|
264
|
-
});
|
|
265
|
-
|
|
266
|
-
describe('setTimeouts()', () => {
|
|
267
|
-
it('should update timeouts', () => {
|
|
268
|
-
gate.setTimeouts({
|
|
269
|
-
coverage: 30000,
|
|
270
|
-
});
|
|
271
|
-
|
|
272
|
-
const config = gate.getConfig();
|
|
273
|
-
expect(config.coverageTimeout).toBe(30000);
|
|
274
|
-
});
|
|
275
|
-
});
|
|
276
|
-
|
|
277
|
-
describe('getConfig()', () => {
|
|
278
|
-
it('should return copy of config', () => {
|
|
279
|
-
const config1 = gate.getConfig();
|
|
280
|
-
const config2 = gate.getConfig();
|
|
281
|
-
expect(config1).toEqual(config2);
|
|
282
|
-
expect(config1).not.toBe(config2);
|
|
236
|
+
expect((result.details?.metrics as { bundleSize?: number }).bundleSize).toBe(100);
|
|
283
237
|
});
|
|
284
238
|
});
|
|
285
239
|
|