@dommaker/harness 1.16.0 → 2.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 +16 -0
- package/dist/agents/lifecycle.d.ts.map +1 -1
- package/dist/agents/lifecycle.js +3 -6
- package/dist/agents/lifecycle.js.map +1 -1
- 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 +8 -7
- package/dist/cli/commands/acceptance.js.map +1 -1
- package/dist/cli/commands/constraints-retire.d.ts.map +1 -1
- package/dist/cli/commands/constraints-retire.js +2 -1
- 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 +20 -10
- package/dist/cli/commands/contract.js.map +1 -1
- package/dist/cli/commands/definitions.d.ts.map +1 -1
- package/dist/cli/commands/definitions.js +13 -12
- package/dist/cli/commands/definitions.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 +36 -0
- package/dist/cli/commands/knowledge/health.d.ts.map +1 -0
- package/dist/cli/commands/knowledge/health.js +172 -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/migrate.d.ts +21 -0
- package/dist/cli/commands/knowledge/migrate.d.ts.map +1 -0
- package/dist/cli/commands/knowledge/migrate.js +48 -0
- package/dist/cli/commands/knowledge/migrate.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 +73 -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/sync-rag.d.ts +19 -0
- package/dist/cli/commands/knowledge/sync-rag.d.ts.map +1 -0
- package/dist/cli/commands/knowledge/sync-rag.js +77 -0
- package/dist/cli/commands/knowledge/sync-rag.js.map +1 -0
- package/dist/cli/commands/knowledge-view.d.ts +2 -1
- package/dist/cli/commands/knowledge-view.d.ts.map +1 -1
- package/dist/cli/commands/knowledge-view.js +2 -2
- 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 +12 -2
- 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.map +1 -1
- package/dist/cli/commands/release.js +13 -41
- 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 +3 -2
- 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 +7 -8
- package/dist/cli/commands/security.js.map +1 -1
- package/dist/cli/commands/spec-baseline-check.d.ts.map +1 -1
- package/dist/cli/commands/spec-baseline-check.js +6 -5
- package/dist/cli/commands/spec-baseline-check.js.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.map +1 -1
- package/dist/cli/commands/sync-docs/capabilities-syncer.js +18 -12
- 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 +37 -0
- package/dist/cli/commands/sync-docs/main-flow.d.ts.map +1 -0
- package/dist/cli/commands/sync-docs/main-flow.js +485 -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 +16 -25
- package/dist/cli/commands/sync-docs/project-reader.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 +1 -3
- 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 -2
- package/dist/context/session-manager.d.ts.map +1 -1
- package/dist/context/session-manager.js +31 -52
- package/dist/context/session-manager.js.map +1 -1
- package/dist/context/types.d.ts +2 -2
- package/dist/context/types.d.ts.map +1 -1
- package/dist/core/constraint-lifecycle.d.ts +1 -1
- package/dist/core/constraint-lifecycle.d.ts.map +1 -1
- package/dist/core/constraint-lifecycle.js +1 -1
- 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/checkers/templated/exec.d.ts.map +1 -1
- package/dist/core/constraints/checkers/templated/exec.js +1 -0
- 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/context-builder.d.ts.map +1 -1
- package/dist/core/constraints/context-builder.js +13 -34
- package/dist/core/constraints/context-builder.js.map +1 -1
- package/dist/core/constraints/definitions/guidelines.d.ts.map +1 -1
- package/dist/core/constraints/definitions/guidelines.js +18 -0
- package/dist/core/constraints/definitions/guidelines.js.map +1 -1
- package/dist/core/constraints/definitions/iron-laws.d.ts.map +1 -1
- package/dist/core/constraints/definitions/iron-laws.js +0 -16
- package/dist/core/constraints/definitions/iron-laws.js.map +1 -1
- package/dist/core/constraints/doc-freshness/runner.d.ts.map +1 -1
- package/dist/core/constraints/doc-freshness/runner.js +192 -223
- package/dist/core/constraints/doc-freshness/runner.js.map +1 -1
- 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/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/project-config-loader.d.ts +3 -1
- package/dist/core/project-config-loader.d.ts.map +1 -1
- package/dist/core/project-config-loader.js +6 -6
- package/dist/core/project-config-loader.js.map +1 -1
- package/dist/core/spec/validator.d.ts +1 -1
- package/dist/core/spec/validator.d.ts.map +1 -1
- package/dist/core/spec/validator.js +41 -36
- package/dist/core/spec/validator.js.map +1 -1
- 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/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/passes-gate.d.ts +2 -1
- package/dist/core/validators/passes-gate.d.ts.map +1 -1
- package/dist/core/validators/passes-gate.js +25 -30
- package/dist/core/validators/passes-gate.js.map +1 -1
- package/dist/gates/acceptance.d.ts +37 -18
- package/dist/gates/acceptance.d.ts.map +1 -1
- package/dist/gates/acceptance.js +129 -97
- package/dist/gates/acceptance.js.map +1 -1
- package/dist/gates/command.d.ts +1 -1
- package/dist/gates/contract.d.ts +11 -2
- package/dist/gates/contract.d.ts.map +1 -1
- package/dist/gates/contract.js +57 -62
- package/dist/gates/contract.js.map +1 -1
- package/dist/gates/performance.d.ts +1 -1
- package/dist/gates/performance.d.ts.map +1 -1
- package/dist/gates/performance.js +18 -8
- package/dist/gates/performance.js.map +1 -1
- package/dist/gates/registry.d.ts.map +1 -1
- package/dist/gates/registry.js +6 -2
- package/dist/gates/registry.js.map +1 -1
- package/dist/gates/review.d.ts.map +1 -1
- package/dist/gates/review.js +16 -2
- package/dist/gates/review.js.map +1 -1
- package/dist/gates/security.d.ts +5 -1
- package/dist/gates/security.d.ts.map +1 -1
- package/dist/gates/security.js +57 -63
- 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 +9 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -3
- 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 +41 -0
- package/dist/knowledge/audit-rules.d.ts.map +1 -0
- package/dist/knowledge/audit-rules.js +269 -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 +9 -6
- package/dist/knowledge/audit.js.map +1 -1
- package/dist/knowledge/import.d.ts.map +1 -1
- package/dist/knowledge/import.js +5 -4
- package/dist/knowledge/import.js.map +1 -1
- 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 +4 -2
- package/dist/knowledge/index.d.ts.map +1 -1
- package/dist/knowledge/index.js +2 -1
- package/dist/knowledge/index.js.map +1 -1
- package/dist/knowledge/ingest.d.ts +21 -5
- package/dist/knowledge/ingest.d.ts.map +1 -1
- package/dist/knowledge/ingest.js +12 -9
- package/dist/knowledge/ingest.js.map +1 -1
- package/dist/knowledge/lifecycle.d.ts.map +1 -1
- package/dist/knowledge/lifecycle.js +17 -22
- 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 +7 -7
- package/dist/knowledge/query.js.map +1 -1
- package/dist/knowledge/reference-tracker.d.ts.map +1 -1
- package/dist/knowledge/reference-tracker.js +14 -17
- package/dist/knowledge/reference-tracker.js.map +1 -1
- package/dist/knowledge/store.d.ts.map +1 -1
- package/dist/knowledge/store.js +17 -36
- package/dist/knowledge/store.js.map +1 -1
- package/dist/monitoring/trace-analyzer.d.ts +2 -2
- package/dist/monitoring/trace-analyzer.d.ts.map +1 -1
- package/dist/monitoring/trace-analyzer.js +9 -7
- package/dist/monitoring/trace-analyzer.js.map +1 -1
- package/dist/monitoring/traces.d.ts.map +1 -1
- package/dist/monitoring/traces.js +6 -4
- 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-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/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/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/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/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/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 +5 -4
- package/src/__tests__/acceptance-gate.test.ts +23 -51
- package/src/__tests__/contract-gate.test.ts +1 -1
- package/src/__tests__/install-precommit-hook.test.ts +61 -0
- package/src/__tests__/iron-laws.test.ts +5 -5
- package/src/__tests__/layering.test.ts +1 -1
- package/src/__tests__/public-exports.test.ts +1 -1
- package/src/__tests__/public-type-surface.test.ts +9 -19
- package/src/__tests__/public-value-surface.test.ts +9 -17
- package/src/__tests__/skip-semantics.test.ts +5 -4
- package/src/agents/lifecycle.ts +3 -5
- package/src/cli/__tests__/command-contract.test.ts +18 -0
- package/src/cli/command-contract.ts +8 -5
- package/src/cli/commands/CONTEXT.md +10 -10
- package/src/cli/commands/__tests__/check.test.ts +1 -1
- package/src/cli/commands/__tests__/constraints-retire.test.ts +5 -3
- 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 +28 -18
- package/src/cli/commands/__tests__/knowledge.test.ts +6 -2
- package/src/cli/commands/__tests__/numeric-flag-assembly.test.ts +1 -1
- package/src/cli/commands/__tests__/passes-gate.test.ts +100 -24
- package/src/cli/commands/__tests__/project-path-anchoring.test.ts +3 -6
- package/src/cli/commands/__tests__/registry.test.ts +3 -2
- package/src/cli/commands/__tests__/release.test.ts +24 -2
- package/src/cli/commands/__tests__/report-false-green.test.ts +10 -6
- package/src/cli/commands/acceptance.ts +10 -9
- package/src/cli/commands/command.ts +1 -1
- package/src/cli/commands/constraints-retire.ts +3 -2
- package/src/cli/commands/contract.ts +29 -14
- package/src/cli/commands/definitions.ts +13 -12
- 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 +176 -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/migrate.ts +61 -0
- package/src/cli/commands/knowledge/search.ts +93 -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/sync-rag.ts +48 -0
- package/src/cli/commands/knowledge-view.ts +3 -2
- package/src/cli/commands/passes-gate.ts +14 -2
- package/src/cli/commands/performance.ts +2 -2
- package/src/cli/commands/release.ts +14 -9
- package/src/cli/commands/review.ts +5 -4
- package/src/cli/commands/security.ts +10 -11
- package/src/cli/commands/spec-baseline-check.ts +6 -7
- package/src/cli/commands/status.ts +2 -2
- package/src/cli/commands/sync-docs/agents-syncer.ts +28 -47
- package/src/cli/commands/sync-docs/capabilities-syncer.ts +18 -11
- package/src/cli/commands/sync-docs/compact.ts +35 -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 +549 -0
- package/src/cli/commands/sync-docs/project-reader.ts +21 -24
- package/src/cli/gate-command.ts +1 -1
- package/src/context/CONTEXT.md +4 -4
- package/src/context/__tests__/session-manager.test.ts +18 -0
- package/src/context/index.ts +1 -5
- package/src/context/session-manager.ts +34 -50
- package/src/context/types.ts +2 -2
- package/src/core/CONTEXT.md +2 -2
- package/src/core/constraint-lifecycle.ts +2 -2
- package/src/core/constraints/capabilities-parser.ts +4 -6
- package/src/core/constraints/checkers/templated/exec.ts +1 -0
- package/src/core/constraints/checkers/templated/file-exists.ts +1 -1
- package/src/core/constraints/context-builder.ts +11 -28
- package/src/core/constraints/definitions/guidelines.ts +19 -0
- package/src/core/constraints/definitions/iron-laws.ts +0 -17
- package/src/core/constraints/doc-freshness/runner.ts +220 -244
- package/src/core/constraints/git-evidence.ts +2 -0
- package/src/core/constraints/injection-writer.ts +3 -6
- package/src/core/project-config-loader.ts +6 -5
- package/src/core/spec/__tests__/validator.test.ts +65 -13
- package/src/core/spec/validator.ts +50 -40
- 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/http.ts +8 -6
- package/src/core/validators/check-handlers/output.ts +7 -6
- package/src/core/validators/passes-gate.ts +31 -32
- package/src/gates/CONTEXT.md +7 -6
- 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 +1 -1
- package/src/gates/__tests__/command.test.ts +23 -12
- package/src/gates/__tests__/gate-interface.test.ts +2 -5
- package/src/gates/__tests__/performance.test.ts +3 -3
- package/src/gates/__tests__/security.test.ts +7 -19
- package/src/gates/acceptance.ts +176 -131
- package/src/gates/command.ts +1 -1
- package/src/gates/contract.ts +86 -79
- package/src/gates/performance.ts +35 -19
- package/src/gates/registry.ts +6 -3
- package/src/gates/review.ts +38 -10
- package/src/gates/security.ts +94 -81
- package/src/gates/types.ts +22 -84
- package/src/index.ts +8 -4
- package/src/knowledge/CONTEXT.md +9 -7
- package/src/knowledge/__tests__/audit-labels.test.ts +3 -3
- package/src/knowledge/__tests__/audit-scoring.test.ts +9 -7
- package/src/knowledge/__tests__/ingest.test.ts +17 -17
- package/src/knowledge/__tests__/store.test.ts +4 -6
- package/src/knowledge/audit-dimensions.ts +190 -0
- package/src/knowledge/audit-rules.ts +335 -0
- package/src/knowledge/audit-scoring.ts +7 -495
- package/src/knowledge/audit.ts +9 -11
- package/src/knowledge/import.ts +7 -6
- package/src/knowledge/index-generator.ts +48 -53
- package/src/knowledge/index.ts +4 -2
- package/src/knowledge/ingest.ts +27 -12
- package/src/knowledge/lifecycle.ts +17 -19
- package/src/knowledge/query.ts +7 -6
- package/src/knowledge/reference-tracker.ts +14 -16
- package/src/knowledge/store.ts +17 -32
- package/src/monitoring/trace-analyzer.ts +12 -9
- package/src/monitoring/traces.ts +8 -6
- 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-io.ts +14 -0
- package/src/types/gate.ts +77 -0
- package/src/utils/__tests__/attempt.test.ts +94 -0
- 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/detect-source-roots.ts +38 -44
- package/src/utils/file-walk.ts +3 -7
- 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/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/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/gates/index.ts +0 -11
package/src/gates/acceptance.ts
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 验收标准门禁
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* 功能:
|
|
5
5
|
* 1. 验证任务是否满足验收标准
|
|
6
|
-
* 2. 解析 tasks.yml
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* 2. 解析 tasks.yml 中的验收条件(只认新契约 `acceptance`;旧的逐条勾选
|
|
7
|
+
* 格式已随 gates 层现代化删除,不再兼容)
|
|
8
|
+
* 3. 运行关联的 E2E 测试
|
|
9
|
+
*
|
|
10
|
+
* 验收条件判定(唯一契约):`checked: true` → 满足;未勾选且带 `e2e_test`
|
|
11
|
+
* → 跑 E2E 按测试结论判定;未勾选且无 `e2e_test` → 不满足(判负,不静默放过)。
|
|
12
|
+
*
|
|
13
|
+
* fail-fast:tasks.yml 解析失败 / 形状非法直接抛错(CLI 侧由 reportGateError
|
|
14
|
+
* 收口为命令失败),不存在「解析失败当通过/当跳过」的兜底分支。
|
|
15
|
+
*
|
|
10
16
|
* 使用示例:
|
|
11
17
|
* ```typescript
|
|
12
18
|
* const gate = new SpecAcceptanceGate();
|
|
@@ -28,17 +34,16 @@ import type {
|
|
|
28
34
|
GateDecision,
|
|
29
35
|
SpecAcceptanceGateConfig,
|
|
30
36
|
AcceptanceGateContext,
|
|
31
|
-
AcceptanceCriteria,
|
|
32
37
|
} from './types';
|
|
33
38
|
import { decisionFromResult } from './decision';
|
|
34
39
|
|
|
35
40
|
|
|
36
41
|
// ==================== 类型定义 ====================
|
|
37
|
-
// SpecAcceptanceGateConfig / AcceptanceGateContext
|
|
38
|
-
// (harness#101
|
|
42
|
+
// SpecAcceptanceGateConfig / AcceptanceGateContext 正本在 ./types
|
|
43
|
+
// (harness#101:本文件不再持有双份定义与工厂)
|
|
39
44
|
|
|
40
45
|
/**
|
|
41
|
-
*
|
|
46
|
+
* 验收条件(唯一契约,支持 E2E 测试关联)
|
|
42
47
|
*/
|
|
43
48
|
export interface AcceptanceCondition {
|
|
44
49
|
description: string;
|
|
@@ -55,9 +60,7 @@ export interface TaskDefinition {
|
|
|
55
60
|
title?: string;
|
|
56
61
|
name?: string;
|
|
57
62
|
description?: string;
|
|
58
|
-
/**
|
|
59
|
-
acceptance_criteria?: AcceptanceCriteria[];
|
|
60
|
-
/** 新格式(支持 E2E 测试) */
|
|
63
|
+
/** 验收条件(支持 E2E 测试) */
|
|
61
64
|
acceptance?: AcceptanceCondition[];
|
|
62
65
|
status?: string;
|
|
63
66
|
completed?: boolean;
|
|
@@ -71,6 +74,19 @@ export interface TasksFile {
|
|
|
71
74
|
version?: string;
|
|
72
75
|
}
|
|
73
76
|
|
|
77
|
+
/**
|
|
78
|
+
* 验收门禁结果 details 负载(type alias 而非 interface:
|
|
79
|
+
* 需要隐式索引签名以直接赋给 GateResult.details 的 Record 形状)
|
|
80
|
+
*/
|
|
81
|
+
export type AcceptanceGateDetails = {
|
|
82
|
+
taskId?: string;
|
|
83
|
+
totalCriteria: number;
|
|
84
|
+
checkedCriteria: number;
|
|
85
|
+
uncheckedCriteria: string[];
|
|
86
|
+
missingCriteria: string[];
|
|
87
|
+
e2eTestResults?: E2ETestResult[];
|
|
88
|
+
};
|
|
89
|
+
|
|
74
90
|
/**
|
|
75
91
|
* 验收门禁结果
|
|
76
92
|
*/
|
|
@@ -78,14 +94,7 @@ export interface AcceptanceGateResult {
|
|
|
78
94
|
passed: boolean;
|
|
79
95
|
message: string;
|
|
80
96
|
timestamp: string;
|
|
81
|
-
details?:
|
|
82
|
-
taskId?: string;
|
|
83
|
-
totalCriteria: number;
|
|
84
|
-
checkedCriteria: number;
|
|
85
|
-
uncheckedCriteria: string[];
|
|
86
|
-
missingCriteria: string[];
|
|
87
|
-
e2eTestResults?: E2ETestResult[];
|
|
88
|
-
};
|
|
97
|
+
details?: AcceptanceGateDetails;
|
|
89
98
|
}
|
|
90
99
|
|
|
91
100
|
/**
|
|
@@ -100,6 +109,77 @@ export interface E2ETestResult {
|
|
|
100
109
|
error?: string;
|
|
101
110
|
}
|
|
102
111
|
|
|
112
|
+
// ==================== tasks.yml 解析与校验 ====================
|
|
113
|
+
|
|
114
|
+
/** 是 plain object(非 null 非数组) */
|
|
115
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
116
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* yaml.load 结果 → TasksFile:形状非法即抛错(fail-fast,不静默兜底)。
|
|
121
|
+
* 校验只到判定实际读取的字段:tasks 数组、任务 id、acceptance 条目的
|
|
122
|
+
* description / e2e_test / test_name / checked。
|
|
123
|
+
*/
|
|
124
|
+
export function parseTasksFile(raw: unknown, tasksPath: string): TasksFile {
|
|
125
|
+
if (!isRecord(raw) || !Array.isArray(raw.tasks)) {
|
|
126
|
+
throw new Error(`tasks.yml 格式非法(缺 tasks 数组): ${tasksPath}`);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const tasks: TaskDefinition[] = raw.tasks.map((entry: unknown, index: number) => {
|
|
130
|
+
if (!isRecord(entry) || typeof entry.id !== 'string' || entry.id.length === 0) {
|
|
131
|
+
throw new Error(`tasks.yml 格式非法(tasks[${index}] 缺 id): ${tasksPath}`);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
let acceptance: AcceptanceCondition[] | undefined;
|
|
135
|
+
if (entry.acceptance !== undefined) {
|
|
136
|
+
if (!Array.isArray(entry.acceptance)) {
|
|
137
|
+
throw new Error(`tasks.yml 格式非法(任务 ${entry.id} 的 acceptance 不是数组): ${tasksPath}`);
|
|
138
|
+
}
|
|
139
|
+
acceptance = entry.acceptance.map((c: unknown, ci: number) => {
|
|
140
|
+
if (!isRecord(c) || typeof c.description !== 'string') {
|
|
141
|
+
throw new Error(
|
|
142
|
+
`tasks.yml 格式非法(任务 ${entry.id} 的 acceptance[${ci}] 缺 description): ${tasksPath}`
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
for (const key of ['e2e_test', 'test_name'] as const) {
|
|
146
|
+
if (c[key] !== undefined && typeof c[key] !== 'string') {
|
|
147
|
+
throw new Error(
|
|
148
|
+
`tasks.yml 格式非法(任务 ${entry.id} 的 acceptance[${ci}].${key} 不是字符串): ${tasksPath}`
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
if (c.checked !== undefined && typeof c.checked !== 'boolean') {
|
|
153
|
+
throw new Error(
|
|
154
|
+
`tasks.yml 格式非法(任务 ${entry.id} 的 acceptance[${ci}].checked 不是布尔): ${tasksPath}`
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
return {
|
|
158
|
+
description: c.description,
|
|
159
|
+
e2e_test: c.e2e_test as string | undefined,
|
|
160
|
+
test_name: c.test_name as string | undefined,
|
|
161
|
+
checked: c.checked as boolean | undefined,
|
|
162
|
+
};
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return {
|
|
167
|
+
id: entry.id,
|
|
168
|
+
title: typeof entry.title === 'string' ? entry.title : undefined,
|
|
169
|
+
name: typeof entry.name === 'string' ? entry.name : undefined,
|
|
170
|
+
description: typeof entry.description === 'string' ? entry.description : undefined,
|
|
171
|
+
acceptance,
|
|
172
|
+
status: typeof entry.status === 'string' ? entry.status : undefined,
|
|
173
|
+
completed: typeof entry.completed === 'boolean' ? entry.completed : undefined,
|
|
174
|
+
};
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
return {
|
|
178
|
+
tasks,
|
|
179
|
+
version: typeof raw.version === 'string' ? raw.version : undefined,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
|
|
103
183
|
// ==================== SpecAcceptanceGate 类 ====================
|
|
104
184
|
|
|
105
185
|
/**
|
|
@@ -134,70 +214,64 @@ export class SpecAcceptanceGate implements Gate {
|
|
|
134
214
|
passed: result.passed,
|
|
135
215
|
message: result.message,
|
|
136
216
|
timestamp: result.timestamp,
|
|
137
|
-
details: result.details
|
|
217
|
+
...(result.details ? { details: result.details } : {}),
|
|
138
218
|
});
|
|
139
219
|
}
|
|
140
220
|
|
|
141
221
|
/**
|
|
142
|
-
*
|
|
222
|
+
* 检查验收标准(fail-fast:解析/校验失败直接抛出,不拼错误报告)
|
|
143
223
|
*/
|
|
144
224
|
async check(context: AcceptanceGateContext): Promise<AcceptanceGateResult> {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
);
|
|
225
|
+
// 确定 tasks.yml 路径:相对值一律锚在 projectPath(此处不取 cwd)
|
|
226
|
+
const tasksPath = path.resolve(
|
|
227
|
+
context.projectPath,
|
|
228
|
+
context.tasksPath ?? this.config.tasksPath ?? 'tasks.yml',
|
|
229
|
+
);
|
|
151
230
|
|
|
152
|
-
|
|
153
|
-
|
|
231
|
+
// 加载 tasks 文件
|
|
232
|
+
const tasks = await this.loadTasks(tasksPath);
|
|
154
233
|
|
|
155
|
-
|
|
156
|
-
return {
|
|
157
|
-
passed: true,
|
|
158
|
-
message: 'No tasks.yml found or no tasks defined, skipping',
|
|
159
|
-
timestamp: new Date().toISOString(),
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
// 检查特定任务或所有任务
|
|
164
|
-
if (context.taskId) {
|
|
165
|
-
return this.checkSingleTask(tasks, context.taskId, context.projectPath);
|
|
166
|
-
} else if (this.config.checkAllTasks) {
|
|
167
|
-
return this.checkAllTasks(tasks, context.projectPath);
|
|
168
|
-
} else {
|
|
169
|
-
// 默认只检查已完成任务
|
|
170
|
-
return this.checkCompletedTasks(tasks, context.projectPath);
|
|
171
|
-
}
|
|
172
|
-
} catch (error: any) {
|
|
234
|
+
if (!tasks || tasks.tasks.length === 0) {
|
|
173
235
|
return {
|
|
174
|
-
passed:
|
|
175
|
-
message:
|
|
236
|
+
passed: true,
|
|
237
|
+
message: 'No tasks.yml found or no tasks defined, skipping',
|
|
176
238
|
timestamp: new Date().toISOString(),
|
|
177
239
|
};
|
|
178
240
|
}
|
|
241
|
+
|
|
242
|
+
// 检查特定任务或所有任务
|
|
243
|
+
if (context.taskId) {
|
|
244
|
+
return this.checkSingleTask(tasks, context.taskId, context.projectPath);
|
|
245
|
+
} else if (this.config.checkAllTasks) {
|
|
246
|
+
return this.checkAllTasks(tasks, context.projectPath);
|
|
247
|
+
} else {
|
|
248
|
+
// 默认只检查已完成任务
|
|
249
|
+
return this.checkCompletedTasks(tasks, context.projectPath);
|
|
250
|
+
}
|
|
179
251
|
}
|
|
180
252
|
|
|
181
253
|
/**
|
|
182
|
-
* 加载 tasks.yml
|
|
254
|
+
* 加载 tasks.yml:ENOENT → null(「无 tasks.yml 即跳过」是门禁语义,不是兜底);
|
|
255
|
+
* 其余读取/解析/校验失败一律抛出。
|
|
183
256
|
*/
|
|
184
257
|
private async loadTasks(tasksPath: string): Promise<TasksFile | null> {
|
|
258
|
+
let content: string;
|
|
185
259
|
try {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
if (error.code === 'ENOENT') {
|
|
260
|
+
content = await fs.readFile(tasksPath, 'utf-8');
|
|
261
|
+
} catch (error: unknown) {
|
|
262
|
+
if (isRecord(error) && error.code === 'ENOENT') {
|
|
190
263
|
return null;
|
|
191
264
|
}
|
|
192
265
|
throw error;
|
|
193
266
|
}
|
|
267
|
+
return parseTasksFile(yaml.load(content), tasksPath);
|
|
194
268
|
}
|
|
195
269
|
|
|
196
270
|
/**
|
|
197
271
|
* 检查单个任务
|
|
198
272
|
*/
|
|
199
273
|
private async checkSingleTask(
|
|
200
|
-
tasks: TasksFile,
|
|
274
|
+
tasks: TasksFile,
|
|
201
275
|
taskId: string,
|
|
202
276
|
projectPath: string
|
|
203
277
|
): Promise<AcceptanceGateResult> {
|
|
@@ -218,7 +292,7 @@ export class SpecAcceptanceGate implements Gate {
|
|
|
218
292
|
* 检查所有任务
|
|
219
293
|
*/
|
|
220
294
|
private async checkAllTasks(
|
|
221
|
-
tasks: TasksFile,
|
|
295
|
+
tasks: TasksFile,
|
|
222
296
|
projectPath: string
|
|
223
297
|
): Promise<AcceptanceGateResult> {
|
|
224
298
|
const results: AcceptanceGateResult[] = [];
|
|
@@ -260,7 +334,7 @@ export class SpecAcceptanceGate implements Gate {
|
|
|
260
334
|
* 检查已完成的任务
|
|
261
335
|
*/
|
|
262
336
|
private async checkCompletedTasks(
|
|
263
|
-
tasks: TasksFile,
|
|
337
|
+
tasks: TasksFile,
|
|
264
338
|
projectPath: string
|
|
265
339
|
): Promise<AcceptanceGateResult> {
|
|
266
340
|
const completedTasks = tasks.tasks.filter(t => t.completed || t.status === 'done');
|
|
@@ -305,58 +379,12 @@ export class SpecAcceptanceGate implements Gate {
|
|
|
305
379
|
* 验证任务
|
|
306
380
|
*/
|
|
307
381
|
private async validateTask(
|
|
308
|
-
task: TaskDefinition,
|
|
382
|
+
task: TaskDefinition,
|
|
309
383
|
projectPath: string
|
|
310
384
|
): Promise<AcceptanceGateResult> {
|
|
311
|
-
const
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
if (task.acceptance && task.acceptance.length > 0) {
|
|
315
|
-
for (const criteria of task.acceptance) {
|
|
316
|
-
// 如果有关联的 E2E 测试,运行它
|
|
317
|
-
if (criteria.e2e_test && !criteria.checked) {
|
|
318
|
-
const result = await this.runE2ETest(
|
|
319
|
-
projectPath,
|
|
320
|
-
criteria.e2e_test,
|
|
321
|
-
criteria.test_name
|
|
322
|
-
);
|
|
323
|
-
e2eResults.push(result);
|
|
324
|
-
|
|
325
|
-
if (!result.passed) {
|
|
326
|
-
return {
|
|
327
|
-
passed: false,
|
|
328
|
-
message: `E2E test failed for "${criteria.description}": ${criteria.e2e_test}`,
|
|
329
|
-
timestamp: new Date().toISOString(),
|
|
330
|
-
details: {
|
|
331
|
-
taskId: task.id,
|
|
332
|
-
totalCriteria: task.acceptance.length,
|
|
333
|
-
checkedCriteria: task.acceptance.filter(c => c.checked).length,
|
|
334
|
-
uncheckedCriteria: [criteria.description],
|
|
335
|
-
missingCriteria: [],
|
|
336
|
-
e2eTestResults: e2eResults,
|
|
337
|
-
},
|
|
338
|
-
};
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
return {
|
|
344
|
-
passed: true,
|
|
345
|
-
message: `Task ${task.id} passes all acceptance criteria`,
|
|
346
|
-
timestamp: new Date().toISOString(),
|
|
347
|
-
details: {
|
|
348
|
-
taskId: task.id,
|
|
349
|
-
totalCriteria: task.acceptance.length,
|
|
350
|
-
checkedCriteria: task.acceptance.length,
|
|
351
|
-
uncheckedCriteria: [],
|
|
352
|
-
missingCriteria: [],
|
|
353
|
-
e2eTestResults: e2eResults.length > 0 ? e2eResults : undefined,
|
|
354
|
-
},
|
|
355
|
-
};
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
// 兼容旧格式 acceptance_criteria
|
|
359
|
-
if (!task.acceptance_criteria || task.acceptance_criteria.length === 0) {
|
|
385
|
+
const conditions = task.acceptance ?? [];
|
|
386
|
+
|
|
387
|
+
if (conditions.length === 0) {
|
|
360
388
|
return {
|
|
361
389
|
passed: true,
|
|
362
390
|
message: `Task ${task.id} has no acceptance criteria`,
|
|
@@ -364,26 +392,44 @@ export class SpecAcceptanceGate implements Gate {
|
|
|
364
392
|
};
|
|
365
393
|
}
|
|
366
394
|
|
|
395
|
+
const e2eResults: E2ETestResult[] = [];
|
|
367
396
|
const unchecked: string[] = [];
|
|
368
397
|
|
|
369
|
-
for (const
|
|
370
|
-
if (
|
|
371
|
-
|
|
398
|
+
for (const condition of conditions) {
|
|
399
|
+
if (condition.checked) {
|
|
400
|
+
continue;
|
|
401
|
+
}
|
|
402
|
+
// 未勾选且关联 E2E 测试 → 跑测试按结论判定;未勾选且无测试 → 不满足
|
|
403
|
+
if (condition.e2e_test) {
|
|
404
|
+
const result = await this.runE2ETest(
|
|
405
|
+
projectPath,
|
|
406
|
+
condition.e2e_test,
|
|
407
|
+
condition.test_name
|
|
408
|
+
);
|
|
409
|
+
e2eResults.push(result);
|
|
410
|
+
if (!result.passed) {
|
|
411
|
+
unchecked.push(condition.description);
|
|
412
|
+
}
|
|
413
|
+
} else {
|
|
414
|
+
unchecked.push(condition.description);
|
|
372
415
|
}
|
|
373
416
|
}
|
|
374
417
|
|
|
418
|
+
const details: AcceptanceGateDetails = {
|
|
419
|
+
taskId: task.id,
|
|
420
|
+
totalCriteria: conditions.length,
|
|
421
|
+
checkedCriteria: conditions.length - unchecked.length,
|
|
422
|
+
uncheckedCriteria: unchecked,
|
|
423
|
+
missingCriteria: [],
|
|
424
|
+
...(e2eResults.length > 0 ? { e2eTestResults: e2eResults } : {}),
|
|
425
|
+
};
|
|
426
|
+
|
|
375
427
|
if (unchecked.length === 0) {
|
|
376
428
|
return {
|
|
377
429
|
passed: true,
|
|
378
430
|
message: `Task ${task.id} passes all acceptance criteria`,
|
|
379
431
|
timestamp: new Date().toISOString(),
|
|
380
|
-
details
|
|
381
|
-
taskId: task.id,
|
|
382
|
-
totalCriteria: task.acceptance_criteria.length,
|
|
383
|
-
checkedCriteria: task.acceptance_criteria.filter(c => c.checked).length,
|
|
384
|
-
uncheckedCriteria: [],
|
|
385
|
-
missingCriteria: [],
|
|
386
|
-
},
|
|
432
|
+
details,
|
|
387
433
|
};
|
|
388
434
|
}
|
|
389
435
|
|
|
@@ -391,18 +437,15 @@ export class SpecAcceptanceGate implements Gate {
|
|
|
391
437
|
passed: false,
|
|
392
438
|
message: `Task ${task.id} has ${unchecked.length} unchecked acceptance criteria`,
|
|
393
439
|
timestamp: new Date().toISOString(),
|
|
394
|
-
details
|
|
395
|
-
taskId: task.id,
|
|
396
|
-
totalCriteria: task.acceptance_criteria.length,
|
|
397
|
-
checkedCriteria: task.acceptance_criteria.filter(c => c.checked).length,
|
|
398
|
-
uncheckedCriteria: unchecked,
|
|
399
|
-
missingCriteria: [],
|
|
400
|
-
},
|
|
440
|
+
details,
|
|
401
441
|
};
|
|
402
442
|
}
|
|
403
443
|
|
|
404
444
|
/**
|
|
405
445
|
* 运行 E2E 测试
|
|
446
|
+
*
|
|
447
|
+
* 退出码非零 / 超时 = 测试判负(报告层 fail,不是门禁异常);
|
|
448
|
+
* 文本只能否决不能反向加分(与 passes-gate 同一判定入口,ADR-0014)。
|
|
406
449
|
*/
|
|
407
450
|
private async runE2ETest(
|
|
408
451
|
projectPath: string,
|
|
@@ -410,11 +453,11 @@ export class SpecAcceptanceGate implements Gate {
|
|
|
410
453
|
testName?: string
|
|
411
454
|
): Promise<E2ETestResult> {
|
|
412
455
|
const timeout = this.config.e2eTestTimeout ?? 120000;
|
|
413
|
-
|
|
456
|
+
|
|
414
457
|
// 构建测试命令
|
|
415
458
|
let command = this.config.e2eTestCommand ?? 'npx playwright test';
|
|
416
459
|
command += ` ${testFile}`;
|
|
417
|
-
|
|
460
|
+
|
|
418
461
|
if (testName) {
|
|
419
462
|
command += ` -g "${testName}"`;
|
|
420
463
|
}
|
|
@@ -426,7 +469,7 @@ export class SpecAcceptanceGate implements Gate {
|
|
|
426
469
|
});
|
|
427
470
|
|
|
428
471
|
const output = stdout + stderr;
|
|
429
|
-
// 退出码为 0
|
|
472
|
+
// 退出码为 0 的分支:文本只能否决,不能反向加分(ADR-0014)
|
|
430
473
|
const { passed } = judgeTestRun({ exitCode: 0, output });
|
|
431
474
|
|
|
432
475
|
return {
|
|
@@ -436,15 +479,17 @@ export class SpecAcceptanceGate implements Gate {
|
|
|
436
479
|
passed,
|
|
437
480
|
output: output.substring(0, 2000),
|
|
438
481
|
};
|
|
439
|
-
} catch (error:
|
|
482
|
+
} catch (error: unknown) {
|
|
440
483
|
// 超时或非零退出的分支:判负,文本不参与(文本救不回非零退出,ADR-0014)
|
|
484
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
485
|
+
const stdout = isRecord(error) && typeof error.stdout === 'string' ? error.stdout : undefined;
|
|
441
486
|
return {
|
|
442
487
|
criteria: testFile,
|
|
443
488
|
testFile,
|
|
444
489
|
testName,
|
|
445
490
|
passed: false,
|
|
446
|
-
error:
|
|
447
|
-
output:
|
|
491
|
+
error: message,
|
|
492
|
+
output: stdout?.substring(0, 2000) ?? message,
|
|
448
493
|
};
|
|
449
494
|
}
|
|
450
495
|
}
|
package/src/gates/command.ts
CHANGED
|
@@ -10,7 +10,7 @@ import type { GateResult, CommandGateConfig, CommandBlacklistRule, Gate, GateCon
|
|
|
10
10
|
import { decisionFromResult } from './decision';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* 黑名单级别(正本在 types.ts,与 CommandBlacklistRule.level 同一定义)
|
|
13
|
+
* 黑名单级别(正本在 src/types/gate.ts,与 CommandBlacklistRule.level 同一定义)
|
|
14
14
|
*/
|
|
15
15
|
export type { BlacklistLevel } from './types';
|
|
16
16
|
|