@dommaker/harness 1.15.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 +28 -0
- package/bin/harness.js +6 -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 +10 -13
- 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/command.d.ts.map +1 -1
- package/dist/cli/commands/command.js +5 -5
- package/dist/cli/commands/command.js.map +1 -1
- package/dist/cli/commands/constraints-disable.d.ts +7 -11
- package/dist/cli/commands/constraints-disable.d.ts.map +1 -1
- package/dist/cli/commands/constraints-disable.js +8 -80
- package/dist/cli/commands/constraints-disable.js.map +1 -1
- package/dist/cli/commands/constraints-pack-proposal.d.ts +7 -20
- package/dist/cli/commands/constraints-pack-proposal.d.ts.map +1 -1
- package/dist/cli/commands/constraints-pack-proposal.js +21 -129
- package/dist/cli/commands/constraints-pack-proposal.js.map +1 -1
- package/dist/cli/commands/constraints-reactivate.d.ts +8 -20
- package/dist/cli/commands/constraints-reactivate.d.ts.map +1 -1
- package/dist/cli/commands/constraints-reactivate.js +11 -105
- package/dist/cli/commands/constraints-reactivate.js.map +1 -1
- package/dist/cli/commands/constraints-retire.d.ts +11 -67
- package/dist/cli/commands/constraints-retire.d.ts.map +1 -1
- package/dist/cli/commands/constraints-retire.js +20 -196
- package/dist/cli/commands/constraints-retire.js.map +1 -1
- package/dist/cli/commands/constraints.d.ts +6 -9
- package/dist/cli/commands/constraints.d.ts.map +1 -1
- package/dist/cli/commands/constraints.js +7 -21
- package/dist/cli/commands/constraints.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/{tools/paths.js → cli/commands/init/git-hooks.js} +25 -12
- 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 +2 -2
- package/dist/cli/commands/release.d.ts.map +1 -1
- package/dist/cli/commands/release.js +15 -43
- 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/scaffold-templates.d.ts +7 -0
- package/dist/cli/commands/scaffold-templates.d.ts.map +1 -1
- package/dist/cli/commands/scaffold-templates.js +21 -1
- package/dist/cli/commands/scaffold-templates.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 +13 -0
- package/dist/cli/commands/sync-docs/context-syncer.d.ts.map +1 -1
- package/dist/cli/commands/sync-docs/context-syncer.js +40 -29
- 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 -503
- 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 +6 -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/commands/validate.d.ts.map +1 -1
- package/dist/cli/commands/validate.js +7 -0
- 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/cli/gate-command.js +1 -1
- package/dist/cli/gate-command.js.map +1 -1
- package/dist/completion-checkers/glob-match.d.ts +1 -1
- package/dist/completion-checkers/glob-match.d.ts.map +1 -1
- package/dist/completion-checkers/glob-match.js +3 -38
- package/dist/completion-checkers/glob-match.js.map +1 -1
- package/dist/context/index.d.ts +2 -5
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +2 -9
- package/dist/context/index.js.map +1 -1
- package/dist/context/session-manager.d.ts +2 -8
- package/dist/context/session-manager.d.ts.map +1 -1
- package/dist/context/session-manager.js +31 -61
- package/dist/context/session-manager.js.map +1 -1
- package/dist/context/types.d.ts +2 -26
- package/dist/context/types.d.ts.map +1 -1
- package/dist/core/config-files.d.ts +21 -0
- package/dist/core/config-files.d.ts.map +1 -0
- package/dist/core/config-files.js +75 -0
- package/dist/core/config-files.js.map +1 -0
- package/dist/core/constraint-lifecycle.d.ts +127 -0
- package/dist/core/constraint-lifecycle.d.ts.map +1 -0
- package/dist/core/constraint-lifecycle.js +306 -0
- package/dist/core/constraint-lifecycle.js.map +1 -0
- 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/checker.d.ts +9 -1
- package/dist/core/constraints/checker.d.ts.map +1 -1
- package/dist/core/constraints/checker.js +18 -0
- package/dist/core/constraints/checker.js.map +1 -1
- package/dist/core/constraints/checkers/no-completion-without-verification.d.ts +6 -1
- package/dist/core/constraints/checkers/no-completion-without-verification.d.ts.map +1 -1
- package/dist/core/constraints/checkers/no-completion-without-verification.js +17 -1
- package/dist/core/constraints/checkers/no-completion-without-verification.js.map +1 -1
- package/dist/core/constraints/checkers/no-hardcoded-credentials.d.ts +0 -2
- package/dist/core/constraints/checkers/no-hardcoded-credentials.d.ts.map +1 -1
- package/dist/core/constraints/checkers/no-hardcoded-credentials.js +0 -5
- package/dist/core/constraints/checkers/no-hardcoded-credentials.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 +2 -2
- package/dist/core/constraints/checkers/templated/file-exists.js.map +1 -1
- package/dist/core/constraints/checkers/templated/glob.d.ts +2 -3
- package/dist/core/constraints/checkers/templated/glob.d.ts.map +1 -1
- package/dist/core/constraints/checkers/templated/glob.js +4 -40
- package/dist/core/constraints/checkers/templated/glob.js.map +1 -1
- package/dist/core/constraints/construction-sites.d.ts +56 -0
- package/dist/core/constraints/construction-sites.d.ts.map +1 -0
- package/dist/core/constraints/construction-sites.js +75 -0
- package/dist/core/constraints/construction-sites.js.map +1 -0
- 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 -221
- 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/index.d.ts +0 -2
- 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/meta.d.ts +18 -0
- package/dist/core/constraints/meta.d.ts.map +1 -0
- package/dist/core/constraints/meta.js +31 -0
- package/dist/core/constraints/meta.js.map +1 -0
- package/dist/core/constraints/pack-proposal.d.ts +66 -0
- package/dist/core/constraints/pack-proposal.d.ts.map +1 -0
- package/dist/core/constraints/pack-proposal.js +181 -0
- package/dist/core/constraints/pack-proposal.js.map +1 -0
- package/dist/core/constraints/usage-report.d.ts +3 -1
- package/dist/core/constraints/usage-report.d.ts.map +1 -1
- package/dist/core/constraints/usage-report.js +3 -1
- package/dist/core/constraints/usage-report.js.map +1 -1
- package/dist/core/effective-constraints.d.ts +6 -6
- package/dist/core/effective-constraints.d.ts.map +1 -1
- package/dist/core/effective-constraints.js +6 -6
- package/dist/core/effective-constraints.js.map +1 -1
- package/dist/core/index.d.ts +3 -6
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +1 -6
- package/dist/core/index.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 +49 -8
- 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/checker-gate.d.ts +2 -1
- package/dist/gates/checker-gate.d.ts.map +1 -1
- package/dist/gates/checker-gate.js +2 -1
- package/dist/gates/checker-gate.js.map +1 -1
- package/dist/gates/command.d.ts +3 -20
- package/dist/gates/command.d.ts.map +1 -1
- package/dist/gates/command.js +2 -35
- package/dist/gates/command.js.map +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/definitions.d.ts +1 -1
- package/dist/gates/definitions.d.ts.map +1 -1
- package/dist/gates/definitions.js +1 -1
- package/dist/gates/definitions.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 +7 -3
- 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 +12 -72
- 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 +23 -20
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +38 -65
- 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 +5 -5
- package/dist/knowledge/index.d.ts.map +1 -1
- package/dist/knowledge/index.js +4 -5
- 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 +2 -2
- package/dist/knowledge/query.d.ts.map +1 -1
- package/dist/knowledge/query.js +19 -22
- 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/knowledge/token-estimate.d.ts +14 -0
- package/dist/knowledge/token-estimate.d.ts.map +1 -0
- package/dist/knowledge/token-estimate.js +31 -0
- package/dist/knowledge/token-estimate.js.map +1 -0
- package/dist/monitoring/analyzer-base.d.ts +0 -8
- package/dist/monitoring/analyzer-base.d.ts.map +1 -1
- package/dist/monitoring/analyzer-base.js +0 -20
- package/dist/monitoring/analyzer-base.js.map +1 -1
- package/dist/monitoring/index.d.ts +2 -7
- package/dist/monitoring/index.d.ts.map +1 -1
- package/dist/monitoring/index.js +2 -9
- package/dist/monitoring/index.js.map +1 -1
- package/dist/monitoring/trace-analyzer.d.ts +2 -6
- package/dist/monitoring/trace-analyzer.d.ts.map +1 -1
- package/dist/monitoring/trace-analyzer.js +9 -16
- package/dist/monitoring/trace-analyzer.js.map +1 -1
- package/dist/monitoring/traces.d.ts +14 -10
- package/dist/monitoring/traces.d.ts.map +1 -1
- package/dist/monitoring/traces.js +47 -49
- 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 +14 -21
- package/dist/pretool-use-hook.js.map +1 -1
- package/dist/release/integrity.d.ts.map +1 -1
- package/dist/release/integrity.js +8 -10
- 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/test-setup/jsonl-fake-fs.d.ts +1 -1
- package/dist/test-setup/jsonl-fake-fs.js +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/glob-match.d.ts +10 -0
- package/dist/utils/glob-match.d.ts.map +1 -0
- package/dist/utils/glob-match.js +47 -0
- package/dist/utils/glob-match.js.map +1 -0
- package/dist/utils/jsonl.d.ts +1 -1
- package/dist/utils/jsonl.js +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/dist/utils/yaml-edit.d.ts +26 -0
- package/dist/utils/yaml-edit.d.ts.map +1 -0
- package/dist/utils/yaml-edit.js +98 -0
- package/dist/utils/yaml-edit.js.map +1 -0
- package/package.json +2 -7
- package/src/CONTEXT.md +14 -6
- package/src/__tests__/acceptance-gate.test.ts +25 -55
- package/src/__tests__/contract-gate.test.ts +1 -1
- package/src/__tests__/effective-constraints.test.ts +16 -0
- 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 +3 -4
- package/src/__tests__/no-studio-references.test.ts +13 -5
- package/src/__tests__/pretool-use-hook.test.ts +3 -3
- package/src/__tests__/public-exports.test.ts +196 -42
- package/src/__tests__/public-type-surface.test.ts +22 -72
- package/src/__tests__/public-value-surface.test.ts +7 -38
- package/src/__tests__/skip-semantics.test.ts +5 -4
- package/src/__tests__/trace-analyzer-extra.test.ts +1 -13
- package/src/agents/CONTEXT.md +4 -4
- package/src/agents/lifecycle.ts +3 -5
- package/src/cli/__tests__/command-contract.test.ts +18 -0
- package/src/cli/__tests__/gate-command.test.ts +1 -1
- package/src/cli/command-contract.ts +12 -9
- package/src/cli/commands/CONTEXT.md +13 -13
- package/src/cli/commands/__tests__/check.test.ts +1 -1
- package/src/cli/commands/__tests__/command.test.ts +2 -2
- 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 +29 -19
- 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__/project-path-convention.test.ts +3 -35
- 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/__tests__/sync-docs-construction-sites.test.ts +175 -0
- package/src/cli/commands/__tests__/validate.test.ts +49 -0
- package/src/cli/commands/acceptance.ts +10 -9
- package/src/cli/commands/command.ts +2 -1
- package/src/cli/commands/constraints-disable.ts +8 -59
- package/src/cli/commands/constraints-pack-proposal.ts +26 -121
- package/src/cli/commands/constraints-reactivate.ts +22 -113
- package/src/cli/commands/constraints-retire.ts +32 -271
- package/src/cli/commands/constraints.ts +6 -30
- 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 +16 -11
- package/src/cli/commands/review.ts +5 -4
- package/src/cli/commands/scaffold-templates.ts +23 -0
- package/src/cli/commands/security.ts +11 -12
- package/src/cli/commands/spec-baseline-check.ts +6 -7
- package/src/cli/commands/status.ts +2 -2
- package/src/cli/commands/sync-docs/__tests__/construction-site-count.test.ts +49 -0
- 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 +52 -26
- package/src/cli/commands/sync-docs/gate.ts +78 -0
- package/src/cli/commands/sync-docs/index.ts +21 -549
- package/src/cli/commands/sync-docs/main-flow.ts +549 -0
- package/src/cli/commands/sync-docs/project-reader.ts +26 -24
- package/src/cli/commands/validate.ts +7 -0
- package/src/cli/gate-command.ts +2 -2
- package/src/completion-checkers/CONTEXT.md +3 -3
- package/src/completion-checkers/glob-match.ts +3 -35
- package/src/context/CONTEXT.md +7 -10
- package/src/context/__tests__/session-manager.test.ts +18 -7
- package/src/context/index.ts +1 -9
- package/src/context/session-manager.ts +34 -60
- package/src/context/types.ts +2 -22
- package/src/core/CONTEXT.md +10 -5
- package/src/core/__tests__/config-files.test.ts +88 -0
- package/src/core/__tests__/constraint-lifecycle.test.ts +255 -0
- package/src/core/__tests__/constraints-meta.test.ts +26 -0
- package/src/core/__tests__/pack-proposal.test.ts +95 -0
- package/src/core/config-files.ts +39 -0
- package/src/core/constraint-lifecycle.ts +435 -0
- package/src/core/constraints/__tests__/check-cache.test.ts +0 -7
- package/src/core/constraints/__tests__/collect-constraints.test.ts +25 -0
- package/src/core/constraints/__tests__/construction-sites.test.ts +147 -0
- package/src/core/constraints/__tests__/context-reconcile.test.ts +16 -16
- package/src/core/constraints/__tests__/trace-injection.test.ts +14 -15
- package/src/core/constraints/__tests__/usage-report.test.ts +9 -0
- package/src/core/constraints/capabilities-parser.ts +4 -6
- package/src/core/constraints/checker.ts +20 -1
- package/src/core/constraints/checkers/__tests__/no-completion-without-verification.test.ts +22 -3
- package/src/core/constraints/checkers/__tests__/no-hardcoded-credentials.test.ts +56 -41
- package/src/core/constraints/checkers/no-completion-without-verification.ts +16 -1
- package/src/core/constraints/checkers/no-hardcoded-credentials.ts +0 -5
- package/src/core/constraints/checkers/templated/exec.ts +1 -0
- package/src/core/constraints/checkers/templated/file-exists.ts +2 -2
- package/src/core/constraints/checkers/templated/glob.ts +3 -36
- package/src/core/constraints/construction-sites.ts +95 -0
- 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 +221 -242
- package/src/core/constraints/git-evidence.ts +2 -0
- package/src/core/constraints/index.ts +0 -4
- package/src/core/constraints/injection-writer.ts +3 -6
- package/src/core/constraints/meta.ts +40 -0
- package/src/core/constraints/pack-proposal.ts +179 -0
- package/src/core/constraints/usage-report.ts +3 -1
- package/src/core/effective-constraints.ts +6 -6
- package/src/core/index.ts +0 -15
- 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__/command-success-output.test.ts +56 -0
- package/src/core/validators/__tests__/passes-gate-counts.test.ts +52 -0
- package/src/core/validators/check-handlers/command.ts +53 -10
- 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 +22 -14
- package/src/gates/__tests__/acceptance-types-single-source.test.ts +22 -19
- package/src/gates/__tests__/acceptance.test.ts +72 -99
- package/src/gates/__tests__/command-single-predicate.test.ts +1 -1
- package/src/gates/__tests__/command.test.ts +24 -25
- package/src/gates/__tests__/decision.test.ts +35 -0
- 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/checker-gate.ts +2 -1
- package/src/gates/command.ts +4 -38
- package/src/gates/contract.ts +86 -79
- package/src/gates/definitions.ts +2 -2
- package/src/gates/performance.ts +35 -19
- package/src/gates/registry.ts +7 -4
- package/src/gates/review.ts +38 -10
- package/src/gates/security.ts +94 -81
- package/src/gates/types.ts +23 -77
- package/src/hooks/CONTEXT.md +1 -1
- package/src/index.ts +57 -98
- package/src/knowledge/CONTEXT.md +14 -10
- 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/__tests__/token-estimate.test.ts +54 -0
- 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 +5 -5
- package/src/knowledge/ingest.ts +27 -12
- package/src/knowledge/lifecycle.ts +17 -19
- package/src/knowledge/query.ts +20 -20
- package/src/knowledge/reference-tracker.ts +14 -16
- package/src/knowledge/store.ts +17 -32
- package/src/knowledge/token-estimate.ts +27 -0
- package/src/monitoring/CONTEXT.md +6 -8
- package/src/monitoring/__tests__/prune-trace-logs.test.ts +76 -0
- package/src/monitoring/__tests__/traces.test.ts +1 -17
- package/src/monitoring/analyzer-base.ts +0 -18
- package/src/monitoring/index.ts +2 -7
- package/src/monitoring/trace-analyzer.ts +12 -17
- package/src/monitoring/traces.ts +59 -57
- package/src/pretool-use-hook.ts +28 -23
- package/src/release/CONTEXT.md +2 -2
- package/src/release/__tests__/integrity.test.ts +3 -7
- package/src/release/integrity.ts +8 -11
- package/src/sdd/index-generator.ts +4 -0
- package/src/test-setup/jsonl-fake-fs.ts +1 -1
- 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__/glob-match.test.ts +52 -0
- package/src/utils/__tests__/jsonl-skip-disposition.test.ts +0 -1
- package/src/utils/__tests__/package-json.test.ts +58 -0
- package/src/utils/__tests__/package-version.test.ts +21 -2
- package/src/utils/__tests__/yaml-edit.test.ts +62 -0
- 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/glob-match.ts +41 -0
- package/src/utils/jsonl.ts +1 -1
- package/src/utils/package-json.ts +61 -0
- package/src/utils/package-version.ts +8 -10
- package/src/utils/yaml-edit.ts +67 -0
- package/dist/cli/commands/init.d.ts.map +0 -1
- package/dist/cli/commands/init.js +0 -517
- 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 -129
- package/dist/context/knowledge-injector.js.map +0 -1
- package/dist/context/token-budget.d.ts +0 -115
- package/dist/context/token-budget.d.ts.map +0 -1
- package/dist/context/token-budget.js +0 -200
- package/dist/context/token-budget.js.map +0 -1
- package/dist/gates/index.d.ts +0 -44
- package/dist/gates/index.d.ts.map +0 -1
- package/dist/gates/index.js +0 -85
- package/dist/gates/index.js.map +0 -1
- package/dist/gates/runner.d.ts +0 -30
- package/dist/gates/runner.d.ts.map +0 -1
- package/dist/gates/runner.js +0 -38
- package/dist/gates/runner.js.map +0 -1
- package/dist/knowledge/primitives/code-structure.d.ts +0 -37
- package/dist/knowledge/primitives/code-structure.d.ts.map +0 -1
- package/dist/knowledge/primitives/code-structure.js +0 -185
- package/dist/knowledge/primitives/code-structure.js.map +0 -1
- package/dist/monitoring/context-tracker.d.ts +0 -38
- package/dist/monitoring/context-tracker.d.ts.map +0 -1
- package/dist/monitoring/context-tracker.js +0 -153
- package/dist/monitoring/context-tracker.js.map +0 -1
- package/dist/tools/definitions/core/code/fingerprint.sh +0 -273
- package/dist/tools/definitions/core/code/fingerprint.yml +0 -72
- package/dist/tools/definitions/core/code/parse.yml +0 -68
- package/dist/tools/definitions/core/code/register-language.sh +0 -475
- package/dist/tools/definitions/core/code/register-language.yml +0 -74
- package/dist/tools/definitions/core/docker/build.yml +0 -73
- package/dist/tools/definitions/core/docker/run.yml +0 -81
- package/dist/tools/definitions/core/file/copy.yml +0 -88
- package/dist/tools/definitions/core/file/read.yml +0 -69
- package/dist/tools/definitions/core/file/write.yml +0 -75
- package/dist/tools/definitions/core/git/branch.yml +0 -61
- package/dist/tools/definitions/core/git/cleanup-worktree.yml +0 -50
- package/dist/tools/definitions/core/git/clone.yml +0 -69
- package/dist/tools/definitions/core/git/commit.yml +0 -65
- package/dist/tools/definitions/core/git/push.yml +0 -79
- package/dist/tools/definitions/core/git/worktree.yml +0 -96
- package/dist/tools/definitions/core/notification/notify.sh +0 -152
- package/dist/tools/definitions/core/notification/notify.yml +0 -59
- package/dist/tools/definitions/core/npm/build.yml +0 -75
- package/dist/tools/definitions/core/npm/install.yml +0 -58
- package/dist/tools/definitions/core/npm/test.yml +0 -75
- package/dist/tools/definitions/core/validation/check-reuse.yml +0 -170
- package/dist/tools/definitions/core/validation/validate-handlers.yml +0 -118
- package/dist/tools/definitions/core/validation/validate-readme-stats.yml +0 -155
- package/dist/tools/definitions/core/validation/validate-yaml-syntax.yml +0 -134
- package/dist/tools/definitions/ext/browser/browser-automate.sh +0 -255
- package/dist/tools/definitions/ext/browser/browser-automate.yml +0 -166
- package/dist/tools/definitions/ext/browser/browser-close.sh +0 -104
- package/dist/tools/definitions/ext/browser/browser-close.yml +0 -54
- package/dist/tools/definitions/ext/browser/browser-mcp-debug.sh +0 -682
- package/dist/tools/definitions/ext/browser/browser-mcp-debug.yml +0 -167
- package/dist/tools/definitions/ext/browser/browser-start.sh +0 -101
- package/dist/tools/definitions/ext/browser/browser-start.yml +0 -61
- package/dist/tools/definitions/registry.json +0 -795
- package/dist/tools/definitions/std/README.md +0 -350
- package/dist/tools/definitions/std/analysis/analyze-codebase.yml +0 -72
- package/dist/tools/definitions/std/analysis/analyze-diff.yml +0 -182
- package/dist/tools/definitions/std/analysis/analyze-git-diff.yml +0 -70
- package/dist/tools/definitions/std/analysis/analyze-impact.yml +0 -78
- package/dist/tools/definitions/std/analysis/analyze-requirements.yml +0 -105
- package/dist/tools/definitions/std/analysis/brainstorm-options.yml +0 -106
- package/dist/tools/definitions/std/analysis/build-graph.yml +0 -154
- package/dist/tools/definitions/std/analysis/clarify-requirements.yml +0 -90
- package/dist/tools/definitions/std/analysis/detect-context.yml +0 -109
- package/dist/tools/definitions/std/analysis/detect-layers.yml +0 -125
- package/dist/tools/definitions/std/analysis/generate-tour.yml +0 -102
- package/dist/tools/definitions/std/analysis/search-enhance.yml +0 -105
- package/dist/tools/definitions/std/backlog/add.yml +0 -51
- package/dist/tools/definitions/std/backlog/decide.yml +0 -39
- package/dist/tools/definitions/std/backlog/github-sync.yml +0 -161
- package/dist/tools/definitions/std/backlog/list.yml +0 -53
- package/dist/tools/definitions/std/backlog/load.yml +0 -46
- package/dist/tools/definitions/std/backlog/resolve.yml +0 -37
- package/dist/tools/definitions/std/backlog/update.yml +0 -42
- package/dist/tools/definitions/std/bugfix/diagnose.yml +0 -68
- package/dist/tools/definitions/std/bugfix/fix.yml +0 -66
- package/dist/tools/definitions/std/bugfix/verify.yml +0 -69
- package/dist/tools/definitions/std/constraint/check-decomposition.yml +0 -103
- package/dist/tools/definitions/std/constraint/check-feature-list.yml +0 -77
- package/dist/tools/definitions/std/constraint/check-progress.yml +0 -97
- package/dist/tools/definitions/std/constraint/generate-report.yml +0 -147
- package/dist/tools/definitions/std/deploy/commit-push.yml +0 -33
- package/dist/tools/definitions/std/deploy/deploy-backend.yml +0 -37
- package/dist/tools/definitions/std/deploy/deploy-frontend.yml +0 -37
- package/dist/tools/definitions/std/deploy/rollback.yml +0 -148
- package/dist/tools/definitions/std/design/analyze-architecture-impact.yml +0 -113
- package/dist/tools/definitions/std/design/design-api.yml +0 -55
- package/dist/tools/definitions/std/design/design-architecture.yml +0 -97
- package/dist/tools/definitions/std/design/design-db.yml +0 -81
- package/dist/tools/definitions/std/design/generate-spec.yml +0 -182
- package/dist/tools/definitions/std/development/develop-api.yml +0 -85
- package/dist/tools/definitions/std/development/develop-backend.yml +0 -88
- package/dist/tools/definitions/std/development/develop-frontend.yml +0 -87
- package/dist/tools/definitions/std/development/develop-shared-types.yml +0 -74
- package/dist/tools/definitions/std/development/develop-task.yml +0 -122
- package/dist/tools/definitions/std/development/develop-tests.yml +0 -76
- package/dist/tools/definitions/std/development/execute-batch.yml +0 -152
- package/dist/tools/definitions/std/development/fix-issues.yml +0 -100
- package/dist/tools/definitions/std/development/implement-task.yml +0 -124
- package/dist/tools/definitions/std/development/review-fix-cycle.yml +0 -232
- package/dist/tools/definitions/std/evolution/implement.yml +0 -124
- package/dist/tools/definitions/std/evolution/prioritize.yml +0 -111
- package/dist/tools/definitions/std/evolution/report-gap.yml +0 -165
- package/dist/tools/definitions/std/file/read.yml +0 -21
- package/dist/tools/definitions/std/governance/aggregate-opinions.sh +0 -201
- package/dist/tools/definitions/std/governance/aggregate-opinions.yml +0 -78
- package/dist/tools/definitions/std/governance/audit-task.yml +0 -177
- package/dist/tools/definitions/std/governance/cast-vote.yml +0 -128
- package/dist/tools/definitions/std/governance/collect-issues.yml +0 -16
- package/dist/tools/definitions/std/governance/create-signed-document.yml +0 -23
- package/dist/tools/definitions/std/governance/create-voting-session.yml +0 -100
- package/dist/tools/definitions/std/governance/define-stance.sh +0 -243
- package/dist/tools/definitions/std/governance/define-stance.yml +0 -81
- package/dist/tools/definitions/std/governance/generate-review-report.yml +0 -23
- package/dist/tools/definitions/std/governance/impeach.yml +0 -178
- package/dist/tools/definitions/std/governance/multi-stance-review.yml +0 -153
- package/dist/tools/definitions/std/governance/prepare-artifact.yml +0 -20
- package/dist/tools/definitions/std/governance/review-spec-approval.yml +0 -262
- package/dist/tools/definitions/std/governance/rollback.yml +0 -185
- package/dist/tools/definitions/std/governance/stance-review.yml +0 -148
- package/dist/tools/definitions/std/governance/track-effect.yml +0 -198
- package/dist/tools/definitions/std/governance/vote-tally.yml +0 -143
- package/dist/tools/definitions/std/patch/execute.yml +0 -51
- package/dist/tools/definitions/std/planning/generate-tasks.yml +0 -36
- package/dist/tools/definitions/std/planning/load-tasks.yml +0 -44
- package/dist/tools/definitions/std/planning/split-batch.yml +0 -480
- package/dist/tools/definitions/std/planning/split-tasks.yml +0 -358
- package/dist/tools/definitions/std/planning/update-tasks.yml +0 -51
- package/dist/tools/definitions/std/planning/validate-tasks.yml +0 -46
- package/dist/tools/definitions/std/project/decide-next-workflow.yml +0 -38
- package/dist/tools/definitions/std/project/load-state.yml +0 -31
- package/dist/tools/definitions/std/project/save-state.yml +0 -32
- package/dist/tools/definitions/std/quality/check-quality.yml +0 -241
- package/dist/tools/definitions/std/quality/debug-systematic.yml +0 -163
- package/dist/tools/definitions/std/quality/handle-feedback.yml +0 -108
- package/dist/tools/definitions/std/quality/review-code.yml +0 -128
- package/dist/tools/definitions/std/quality/review-spec.yml +0 -140
- package/dist/tools/definitions/std/quality/review-task.yml +0 -190
- package/dist/tools/definitions/std/quality/run-tests.yml +0 -80
- package/dist/tools/definitions/std/quick/analyze.yml +0 -56
- package/dist/tools/definitions/std/quick/implement.yml +0 -67
- package/dist/tools/definitions/std/quick/verify.yml +0 -71
- package/dist/tools/definitions/std/verification/verify_completion.yml +0 -113
- package/dist/tools/definitions/std/verification/wait-condition.yml +0 -107
- package/dist/tools/index.d.ts +0 -5
- package/dist/tools/index.d.ts.map +0 -1
- package/dist/tools/index.js +0 -10
- package/dist/tools/index.js.map +0 -1
- package/dist/tools/paths.d.ts +0 -9
- package/dist/tools/paths.d.ts.map +0 -1
- package/dist/tools/paths.js.map +0 -1
- package/src/__tests__/token-budget.test.ts +0 -252
- package/src/cli/commands/init.ts +0 -604
- package/src/cli/commands/knowledge.ts +0 -820
- package/src/context/__tests__/knowledge-injector.test.ts +0 -178
- package/src/context/__tests__/token-budget.test.ts +0 -258
- package/src/context/knowledge-injector.ts +0 -175
- package/src/context/token-budget.ts +0 -222
- package/src/gates/__tests__/runner.test.ts +0 -81
- package/src/gates/index.ts +0 -98
- package/src/gates/runner.ts +0 -57
- package/src/knowledge/primitives/__tests__/code-structure-degrade.test.ts +0 -24
- package/src/knowledge/primitives/__tests__/code-structure.test.ts +0 -120
- package/src/knowledge/primitives/code-structure.ts +0 -185
- package/src/monitoring/__tests__/context-tracker.test.ts +0 -180
- package/src/monitoring/context-tracker.ts +0 -136
- package/src/tools/CONTEXT.md +0 -24
- package/src/tools/__tests__/registry.test.ts +0 -221
- package/src/tools/definitions/core/code/fingerprint.sh +0 -273
- package/src/tools/definitions/core/code/fingerprint.yml +0 -72
- package/src/tools/definitions/core/code/parse.yml +0 -68
- package/src/tools/definitions/core/code/register-language.sh +0 -475
- package/src/tools/definitions/core/code/register-language.yml +0 -74
- package/src/tools/definitions/core/docker/build.yml +0 -73
- package/src/tools/definitions/core/docker/run.yml +0 -81
- package/src/tools/definitions/core/file/copy.yml +0 -88
- package/src/tools/definitions/core/file/read.yml +0 -69
- package/src/tools/definitions/core/file/write.yml +0 -75
- package/src/tools/definitions/core/git/branch.yml +0 -61
- package/src/tools/definitions/core/git/cleanup-worktree.yml +0 -50
- package/src/tools/definitions/core/git/clone.yml +0 -69
- package/src/tools/definitions/core/git/commit.yml +0 -65
- package/src/tools/definitions/core/git/push.yml +0 -79
- package/src/tools/definitions/core/git/worktree.yml +0 -96
- package/src/tools/definitions/core/notification/notify.sh +0 -152
- package/src/tools/definitions/core/notification/notify.yml +0 -59
- package/src/tools/definitions/core/npm/build.yml +0 -75
- package/src/tools/definitions/core/npm/install.yml +0 -58
- package/src/tools/definitions/core/npm/test.yml +0 -75
- package/src/tools/definitions/core/validation/check-reuse.yml +0 -170
- package/src/tools/definitions/core/validation/validate-handlers.yml +0 -118
- package/src/tools/definitions/core/validation/validate-readme-stats.yml +0 -155
- package/src/tools/definitions/core/validation/validate-yaml-syntax.yml +0 -134
- package/src/tools/definitions/ext/browser/browser-automate.sh +0 -255
- package/src/tools/definitions/ext/browser/browser-automate.yml +0 -166
- package/src/tools/definitions/ext/browser/browser-close.sh +0 -104
- package/src/tools/definitions/ext/browser/browser-close.yml +0 -54
- package/src/tools/definitions/ext/browser/browser-mcp-debug.sh +0 -682
- package/src/tools/definitions/ext/browser/browser-mcp-debug.yml +0 -167
- package/src/tools/definitions/ext/browser/browser-start.sh +0 -101
- package/src/tools/definitions/ext/browser/browser-start.yml +0 -61
- package/src/tools/definitions/registry.json +0 -795
- package/src/tools/definitions/std/README.md +0 -350
- package/src/tools/definitions/std/analysis/analyze-codebase.yml +0 -72
- package/src/tools/definitions/std/analysis/analyze-diff.yml +0 -182
- package/src/tools/definitions/std/analysis/analyze-git-diff.yml +0 -70
- package/src/tools/definitions/std/analysis/analyze-impact.yml +0 -78
- package/src/tools/definitions/std/analysis/analyze-requirements.yml +0 -105
- package/src/tools/definitions/std/analysis/brainstorm-options.yml +0 -106
- package/src/tools/definitions/std/analysis/build-graph.yml +0 -154
- package/src/tools/definitions/std/analysis/clarify-requirements.yml +0 -90
- package/src/tools/definitions/std/analysis/detect-context.yml +0 -109
- package/src/tools/definitions/std/analysis/detect-layers.yml +0 -125
- package/src/tools/definitions/std/analysis/generate-tour.yml +0 -102
- package/src/tools/definitions/std/analysis/search-enhance.yml +0 -105
- package/src/tools/definitions/std/backlog/add.yml +0 -51
- package/src/tools/definitions/std/backlog/decide.yml +0 -39
- package/src/tools/definitions/std/backlog/github-sync.yml +0 -161
- package/src/tools/definitions/std/backlog/list.yml +0 -53
- package/src/tools/definitions/std/backlog/load.yml +0 -46
- package/src/tools/definitions/std/backlog/resolve.yml +0 -37
- package/src/tools/definitions/std/backlog/update.yml +0 -42
- package/src/tools/definitions/std/bugfix/diagnose.yml +0 -68
- package/src/tools/definitions/std/bugfix/fix.yml +0 -66
- package/src/tools/definitions/std/bugfix/verify.yml +0 -69
- package/src/tools/definitions/std/constraint/check-decomposition.yml +0 -103
- package/src/tools/definitions/std/constraint/check-feature-list.yml +0 -77
- package/src/tools/definitions/std/constraint/check-progress.yml +0 -97
- package/src/tools/definitions/std/constraint/generate-report.yml +0 -147
- package/src/tools/definitions/std/deploy/commit-push.yml +0 -33
- package/src/tools/definitions/std/deploy/deploy-backend.yml +0 -37
- package/src/tools/definitions/std/deploy/deploy-frontend.yml +0 -37
- package/src/tools/definitions/std/deploy/rollback.yml +0 -148
- package/src/tools/definitions/std/design/analyze-architecture-impact.yml +0 -113
- package/src/tools/definitions/std/design/design-api.yml +0 -55
- package/src/tools/definitions/std/design/design-architecture.yml +0 -97
- package/src/tools/definitions/std/design/design-db.yml +0 -81
- package/src/tools/definitions/std/design/generate-spec.yml +0 -182
- package/src/tools/definitions/std/development/develop-api.yml +0 -85
- package/src/tools/definitions/std/development/develop-backend.yml +0 -88
- package/src/tools/definitions/std/development/develop-frontend.yml +0 -87
- package/src/tools/definitions/std/development/develop-shared-types.yml +0 -74
- package/src/tools/definitions/std/development/develop-task.yml +0 -122
- package/src/tools/definitions/std/development/develop-tests.yml +0 -76
- package/src/tools/definitions/std/development/execute-batch.yml +0 -152
- package/src/tools/definitions/std/development/fix-issues.yml +0 -100
- package/src/tools/definitions/std/development/implement-task.yml +0 -124
- package/src/tools/definitions/std/development/review-fix-cycle.yml +0 -232
- package/src/tools/definitions/std/evolution/implement.yml +0 -124
- package/src/tools/definitions/std/evolution/prioritize.yml +0 -111
- package/src/tools/definitions/std/evolution/report-gap.yml +0 -165
- package/src/tools/definitions/std/file/read.yml +0 -21
- package/src/tools/definitions/std/governance/aggregate-opinions.sh +0 -201
- package/src/tools/definitions/std/governance/aggregate-opinions.yml +0 -78
- package/src/tools/definitions/std/governance/audit-task.yml +0 -177
- package/src/tools/definitions/std/governance/cast-vote.yml +0 -128
- package/src/tools/definitions/std/governance/collect-issues.yml +0 -16
- package/src/tools/definitions/std/governance/create-signed-document.yml +0 -23
- package/src/tools/definitions/std/governance/create-voting-session.yml +0 -100
- package/src/tools/definitions/std/governance/define-stance.sh +0 -243
- package/src/tools/definitions/std/governance/define-stance.yml +0 -81
- package/src/tools/definitions/std/governance/generate-review-report.yml +0 -23
- package/src/tools/definitions/std/governance/impeach.yml +0 -178
- package/src/tools/definitions/std/governance/multi-stance-review.yml +0 -153
- package/src/tools/definitions/std/governance/prepare-artifact.yml +0 -20
- package/src/tools/definitions/std/governance/review-spec-approval.yml +0 -262
- package/src/tools/definitions/std/governance/rollback.yml +0 -185
- package/src/tools/definitions/std/governance/stance-review.yml +0 -148
- package/src/tools/definitions/std/governance/track-effect.yml +0 -198
- package/src/tools/definitions/std/governance/vote-tally.yml +0 -143
- package/src/tools/definitions/std/patch/execute.yml +0 -51
- package/src/tools/definitions/std/planning/generate-tasks.yml +0 -36
- package/src/tools/definitions/std/planning/load-tasks.yml +0 -44
- package/src/tools/definitions/std/planning/split-batch.yml +0 -480
- package/src/tools/definitions/std/planning/split-tasks.yml +0 -358
- package/src/tools/definitions/std/planning/update-tasks.yml +0 -51
- package/src/tools/definitions/std/planning/validate-tasks.yml +0 -46
- package/src/tools/definitions/std/project/decide-next-workflow.yml +0 -38
- package/src/tools/definitions/std/project/load-state.yml +0 -31
- package/src/tools/definitions/std/project/save-state.yml +0 -32
- package/src/tools/definitions/std/quality/check-quality.yml +0 -241
- package/src/tools/definitions/std/quality/debug-systematic.yml +0 -163
- package/src/tools/definitions/std/quality/handle-feedback.yml +0 -108
- package/src/tools/definitions/std/quality/review-code.yml +0 -128
- package/src/tools/definitions/std/quality/review-spec.yml +0 -140
- package/src/tools/definitions/std/quality/review-task.yml +0 -190
- package/src/tools/definitions/std/quality/run-tests.yml +0 -80
- package/src/tools/definitions/std/quick/analyze.yml +0 -56
- package/src/tools/definitions/std/quick/implement.yml +0 -67
- package/src/tools/definitions/std/quick/verify.yml +0 -71
- package/src/tools/definitions/std/verification/verify_completion.yml +0 -113
- package/src/tools/definitions/std/verification/wait-condition.yml +0 -107
- package/src/tools/index.ts +0 -5
- package/src/tools/paths.ts +0 -15
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 约束升级提案材料打包(库面,harness#198;ADR-0033 决策 4,块 3 子项 5)
|
|
3
|
+
*
|
|
4
|
+
* 升级通道链路:下游审卡发起/初审 → approve 后打包脱敏材料 → 人拿材料去 harness 仓
|
|
5
|
+
* 开 issue(github 操作留给人,本模块不触网)。
|
|
6
|
+
*
|
|
7
|
+
* `packProposal` 执行产物生成并返回结构化 `{ materialPath, content }`——消费方不再按
|
|
8
|
+
* 命名约定反猜产物路径:命名规律(`.harness/reports/proposal-<id>-<yyyymmdd>.md`)
|
|
9
|
+
* 的单一来源是本模块的 `proposalMaterialPath`。
|
|
10
|
+
*
|
|
11
|
+
* 材料内容:条文 + severity + checker 模板与参数 + traces.log 使用统计(只有计数)
|
|
12
|
+
* + 升级理由留白段。
|
|
13
|
+
*
|
|
14
|
+
* 脱敏口径(工具做路径脱敏,内容脱敏归人):
|
|
15
|
+
* - 项目根绝对路径一律替换为 `<repoRoot>`;
|
|
16
|
+
* - 统计只有计数与首末次日期,不带样本内容;
|
|
17
|
+
* - 应用层约束的 params(正则/glob)**原文带出**并标注"请人工确认无应用内部信息"——
|
|
18
|
+
* 打包工具是质量前置,不是保密闸门。
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import * as fs from 'fs';
|
|
22
|
+
import * as path from 'path';
|
|
23
|
+
import * as yaml from 'js-yaml';
|
|
24
|
+
import { getConstraint } from './definitions';
|
|
25
|
+
import { loadAppConstraints } from '../app-constraints-loader';
|
|
26
|
+
import { collectUsageByConstraint, readProjectTraces } from './usage-report';
|
|
27
|
+
import type { Constraint } from '../../types/constraint';
|
|
28
|
+
|
|
29
|
+
/** 提案材料的输入(查找结果 + 使用统计聚合) */
|
|
30
|
+
export interface ProposalMaterial {
|
|
31
|
+
constraint: Constraint;
|
|
32
|
+
stats: {
|
|
33
|
+
total: number;
|
|
34
|
+
pass: number;
|
|
35
|
+
fail: number;
|
|
36
|
+
skip: number;
|
|
37
|
+
evaluated: number;
|
|
38
|
+
firstAt?: number;
|
|
39
|
+
lastAt?: number;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** packProposal 的结构化返回:产物路径(命名规律单一来源算出)+ 材料全文 */
|
|
44
|
+
export interface PackProposalResult {
|
|
45
|
+
materialPath: string;
|
|
46
|
+
content: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* 查找约束定义(内置 + 应用层,与 findRetireTarget 同口径但带全量字段——
|
|
51
|
+
* checker/params 是提案材料的核心内容,RetireTargetInfo 不带)
|
|
52
|
+
*/
|
|
53
|
+
function findProposalTarget(id: string, projectRoot: string): Constraint | undefined {
|
|
54
|
+
const builtIn = getConstraint(id);
|
|
55
|
+
if (builtIn) return builtIn;
|
|
56
|
+
return loadAppConstraints(projectRoot).find(c => c.id === id);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function formatDate(ts: number | undefined): string {
|
|
60
|
+
return ts === undefined ? '(无记录)' : new Date(ts).toISOString().slice(0, 10);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* 渲染脱敏提案材料 markdown(纯函数)
|
|
65
|
+
*
|
|
66
|
+
* @param projectRoot 用于路径脱敏(材料中出现的项目根绝对路径替换为 `<repoRoot>`)
|
|
67
|
+
*/
|
|
68
|
+
export function renderProposalMarkdown(
|
|
69
|
+
material: ProposalMaterial,
|
|
70
|
+
projectRoot: string,
|
|
71
|
+
now: Date = new Date()
|
|
72
|
+
): string {
|
|
73
|
+
const c = material.constraint;
|
|
74
|
+
const s = material.stats;
|
|
75
|
+
const isApp = c.source === 'app';
|
|
76
|
+
|
|
77
|
+
const lines: string[] = [];
|
|
78
|
+
lines.push(`# 约束升级提案材料:${c.id}`);
|
|
79
|
+
lines.push('');
|
|
80
|
+
lines.push(`- 生成日期: ${now.toISOString().slice(0, 10)}`);
|
|
81
|
+
lines.push(`- 来源: ${isApp ? '应用层(.harness/constraints.yml)' : '内置'}`);
|
|
82
|
+
lines.push(`- severity: ${c.severity}`);
|
|
83
|
+
lines.push('');
|
|
84
|
+
|
|
85
|
+
lines.push('## 条文');
|
|
86
|
+
lines.push('');
|
|
87
|
+
lines.push(`rule: ${c.rule}`);
|
|
88
|
+
if (c.message && c.message !== c.rule) lines.push(`message: ${c.message}`);
|
|
89
|
+
if (c.description) lines.push(`description: ${c.description}`);
|
|
90
|
+
lines.push('');
|
|
91
|
+
|
|
92
|
+
lines.push('## checker');
|
|
93
|
+
lines.push('');
|
|
94
|
+
if (isApp) {
|
|
95
|
+
lines.push(`模板: \`${c.checker}\``);
|
|
96
|
+
lines.push('');
|
|
97
|
+
lines.push('参数(原文带出,**请人工确认无应用内部信息**——工具只做路径脱敏,内容脱敏归人):');
|
|
98
|
+
lines.push('');
|
|
99
|
+
lines.push('```yaml');
|
|
100
|
+
lines.push(yaml.dump(c.params ?? {}, { lineWidth: 120 }).trimEnd());
|
|
101
|
+
lines.push('```');
|
|
102
|
+
} else {
|
|
103
|
+
lines.push('内置定制 checker(按约束 id 注册,非参数化模板)。升级到通用层前需评审:');
|
|
104
|
+
lines.push('改写为模板 + 参数,或作为通用规则保留定制实现。');
|
|
105
|
+
}
|
|
106
|
+
lines.push('');
|
|
107
|
+
|
|
108
|
+
lines.push('## 使用统计(traces.log 聚合,只有计数)');
|
|
109
|
+
lines.push('');
|
|
110
|
+
lines.push(`- total: ${s.total}`);
|
|
111
|
+
lines.push(`- evaluated: ${s.evaluated}(pass ${s.pass} / fail ${s.fail} / skip ${s.skip})`);
|
|
112
|
+
lines.push(`- 首次触发: ${formatDate(s.firstAt)}`);
|
|
113
|
+
lines.push(`- 最近触发: ${formatDate(s.lastAt)}`);
|
|
114
|
+
lines.push('');
|
|
115
|
+
|
|
116
|
+
lines.push('## 升级理由');
|
|
117
|
+
lines.push('');
|
|
118
|
+
lines.push('> (请在此填写:为什么这条约束该进通用层——适用面、证据、与其他仓的相关性)');
|
|
119
|
+
lines.push('');
|
|
120
|
+
|
|
121
|
+
// 路径脱敏:项目根绝对路径一律替换
|
|
122
|
+
return lines.join('\n').split(projectRoot).join('<repoRoot>');
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* 收集提案材料(定义查找 + traces 使用统计聚合);未知 id → undefined
|
|
127
|
+
*
|
|
128
|
+
* 与 renderProposalMarkdown 组合 = 不落盘的渲染通道(CLI --stdout);
|
|
129
|
+
* 要落盘产物走 packProposal。
|
|
130
|
+
*/
|
|
131
|
+
export function collectProposalMaterial(projectRoot: string, id: string): ProposalMaterial | undefined {
|
|
132
|
+
const constraint = findProposalTarget(id, projectRoot);
|
|
133
|
+
if (!constraint) return undefined;
|
|
134
|
+
|
|
135
|
+
const usage = collectUsageByConstraint(readProjectTraces(projectRoot)).get(id);
|
|
136
|
+
return {
|
|
137
|
+
constraint,
|
|
138
|
+
stats: {
|
|
139
|
+
total: usage?.total ?? 0,
|
|
140
|
+
pass: usage?.pass ?? 0,
|
|
141
|
+
fail: usage?.fail ?? 0,
|
|
142
|
+
skip: usage?.skip ?? 0,
|
|
143
|
+
evaluated: (usage?.total ?? 0) - (usage?.skip ?? 0),
|
|
144
|
+
firstAt: usage?.firstAt,
|
|
145
|
+
lastAt: usage?.lastAt,
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* 提案产物路径(命名规律单一来源):`.harness/reports/proposal-<id>-<yyyymmdd>.md`
|
|
152
|
+
*
|
|
153
|
+
* 消费方拿产物路径一律经本函数(或 packProposal 的返回),不在库外拼字符串。
|
|
154
|
+
*/
|
|
155
|
+
export function proposalMaterialPath(projectRoot: string, id: string, now: Date = new Date()): string {
|
|
156
|
+
const date = now.toISOString().slice(0, 10).replace(/-/g, '');
|
|
157
|
+
return path.join(projectRoot, '.harness', 'reports', `proposal-${id}-${date}.md`);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* 执行提案材料打包:渲染脱敏材料、落盘产物,返回 `{ materialPath, content }`
|
|
162
|
+
*
|
|
163
|
+
* 未知 id → undefined(不落盘),由调用方提示。
|
|
164
|
+
*/
|
|
165
|
+
export function packProposal(
|
|
166
|
+
projectRoot: string,
|
|
167
|
+
id: string,
|
|
168
|
+
options: { now?: Date } = {}
|
|
169
|
+
): PackProposalResult | undefined {
|
|
170
|
+
const material = collectProposalMaterial(projectRoot, id);
|
|
171
|
+
if (!material) return undefined;
|
|
172
|
+
|
|
173
|
+
const now = options.now ?? new Date();
|
|
174
|
+
const content = renderProposalMarkdown(material, projectRoot, now);
|
|
175
|
+
const materialPath = proposalMaterialPath(projectRoot, id, now);
|
|
176
|
+
fs.mkdirSync(path.dirname(materialPath), { recursive: true });
|
|
177
|
+
fs.writeFileSync(materialPath, content, 'utf-8');
|
|
178
|
+
return { materialPath, content };
|
|
179
|
+
}
|
|
@@ -339,9 +339,11 @@ export function diagnoseRetireCandidates(
|
|
|
339
339
|
|
|
340
340
|
/**
|
|
341
341
|
* 构建 report 数据模型(只读;观察名单状态以快照入、以 nextWatchlist 出,不写盘)
|
|
342
|
+
*
|
|
343
|
+
* @param projectRoot 项目根路径(必传,无 cwd 缺省——harness#201)
|
|
342
344
|
*/
|
|
343
345
|
export function buildConstraintsUsageReport(
|
|
344
|
-
projectRoot: string
|
|
346
|
+
projectRoot: string,
|
|
345
347
|
thresholds: Partial<DiagnoseThresholds> = {},
|
|
346
348
|
watch: DiagnoseWatchOptions = {}
|
|
347
349
|
): ConstraintsUsageReport {
|
|
@@ -18,13 +18,13 @@ import type { RunTarget } from './constraints/run-env';
|
|
|
18
18
|
* 生效集链路同 getMergedConstraintsConfig:内置 → preset 裁剪 → config.yml
|
|
19
19
|
* `constraints.<id>.enabled:false` 删除。
|
|
20
20
|
*
|
|
21
|
-
* @param target 项目根路径,或本 run
|
|
21
|
+
* @param target 项目根路径,或本 run 的运行级观察面(必传,无 cwd 缺省——harness#201)
|
|
22
22
|
* 传观察面 = config.yml 读取与本 run 其余消费方共用同一份(ADR-0023 决策 2)
|
|
23
23
|
* @param options.preset 覆盖 config.yml 的 preset;仅在项目无自定义配置时生效
|
|
24
24
|
* (与 getMergedConstraintsConfig 同一优先级规则),不传则尊重 config.yml
|
|
25
25
|
*/
|
|
26
26
|
export function getEffectiveConstraints(
|
|
27
|
-
target: RunTarget
|
|
27
|
+
target: RunTarget,
|
|
28
28
|
options?: { preset?: string }
|
|
29
29
|
): Constraint[] {
|
|
30
30
|
return constraintsFromMerged(getMergedConstraintsConfig(target, options));
|
|
@@ -50,10 +50,10 @@ export function constraintsFromMerged(merged: MergedConstraintsConfig): Constrai
|
|
|
50
50
|
* preset(工单 23 语义:项目自定义配置优先于 CLI 预设);不传 preset 时
|
|
51
51
|
* 完全尊重 config.yml 的 preset 键。
|
|
52
52
|
*
|
|
53
|
-
* @param target 项目根路径,或本 run
|
|
53
|
+
* @param target 项目根路径,或本 run 的运行级观察面(必传,无 cwd 缺省——harness#201)
|
|
54
54
|
*/
|
|
55
55
|
export function getMergedConstraintsConfig(
|
|
56
|
-
target: RunTarget
|
|
56
|
+
target: RunTarget,
|
|
57
57
|
options?: { preset?: string }
|
|
58
58
|
): MergedConstraintsConfig {
|
|
59
59
|
const loader = new ProjectConfigLoader(target);
|
|
@@ -81,9 +81,9 @@ export interface EffectiveConfigLint {
|
|
|
81
81
|
*
|
|
82
82
|
* 不抛错、不修改任何文件,供 report / check 的诊断输出使用。
|
|
83
83
|
*
|
|
84
|
-
* @param projectRoot
|
|
84
|
+
* @param projectRoot 项目根路径(必传,无 cwd 缺省——harness#201)
|
|
85
85
|
*/
|
|
86
|
-
export function lintEffectiveConfig(projectRoot: string
|
|
86
|
+
export function lintEffectiveConfig(projectRoot: string): EffectiveConfigLint {
|
|
87
87
|
const loader = new ProjectConfigLoader(projectRoot);
|
|
88
88
|
loader.load();
|
|
89
89
|
const merged = loader.mergeConstraints();
|
package/src/core/index.ts
CHANGED
|
@@ -16,7 +16,6 @@ export {
|
|
|
16
16
|
checkConstraints,
|
|
17
17
|
checkBeforeExecution,
|
|
18
18
|
constraintChecker,
|
|
19
|
-
CheckCache,
|
|
20
19
|
ConstraintViolationError,
|
|
21
20
|
buildCheckEnv,
|
|
22
21
|
normalizeCheckOutcome,
|
|
@@ -26,8 +25,6 @@ export {
|
|
|
26
25
|
} from './constraints';
|
|
27
26
|
export type {
|
|
28
27
|
CheckConstraintsOptions,
|
|
29
|
-
CheckCacheConfig,
|
|
30
|
-
CheckSamplingConfig,
|
|
31
28
|
ConstraintId,
|
|
32
29
|
ConstraintKind,
|
|
33
30
|
ConstraintChannel,
|
|
@@ -70,16 +67,6 @@ export type {
|
|
|
70
67
|
TaskTestResult,
|
|
71
68
|
} from './validators';
|
|
72
69
|
|
|
73
|
-
// Spec 验证器
|
|
74
|
-
export { SpecValidator } from './spec/validator';
|
|
75
|
-
export type {
|
|
76
|
-
SpecValidatorConfig,
|
|
77
|
-
SpecValidationResult,
|
|
78
|
-
BatchSpecValidationResult,
|
|
79
|
-
SpecSchemaDefinition,
|
|
80
|
-
SpecType,
|
|
81
|
-
} from '../types/spec';
|
|
82
|
-
|
|
83
70
|
// 项目配置加载器(governance 段读取一律经访问器,禁止消费方手写钻取)
|
|
84
71
|
export {
|
|
85
72
|
ProjectConfigLoader,
|
|
@@ -95,6 +82,4 @@ export type { RunEnv, RunTarget } from './constraints/run-env';
|
|
|
95
82
|
// 生效约束集(ADR-0001:唯一生效集来源)
|
|
96
83
|
export {
|
|
97
84
|
getEffectiveConstraints,
|
|
98
|
-
lintEffectiveConfig,
|
|
99
85
|
} from './effective-constraints';
|
|
100
|
-
export type { EffectiveConfigLint } from './effective-constraints';
|
|
@@ -19,6 +19,7 @@ import { PRESETS_BY_NAME, STANDARD_PRESET } from '../presets';
|
|
|
19
19
|
import { filterEnabledEntries } from './effective-set';
|
|
20
20
|
import { loadAppConstraints } from './app-constraints-loader';
|
|
21
21
|
import { resolveRunEnv, type RunEnv, type RunTarget } from './constraints/run-env';
|
|
22
|
+
import { attempt } from '../utils/attempt';
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* 默认配置
|
|
@@ -49,18 +50,18 @@ export type CapabilitiesMode = NonNullable<CapabilitiesConfig['mode']>;
|
|
|
49
50
|
/**
|
|
50
51
|
* 读取 governance 段(全仓唯一手写钻取点,工单 84)
|
|
51
52
|
*
|
|
52
|
-
* 配置缺失 /
|
|
53
|
+
* 配置缺失 / 形状不符时返回 undefined,由调用方按未配置处理。
|
|
54
|
+
* 解析失败经 attempt 显式降级为 undefined(工单 84 triage 裁决口径:解析失败 = 约定未采用,
|
|
55
|
+
* 访问器不替调用方决定要不要炸;执法面要感知脏配置请用 loadRawProjectConfig 直读)。
|
|
53
56
|
* 入参形状见 loadRawProjectConfig:传 RunEnv 即与本 run 其余消费方共用同一份 config.yml 读取。
|
|
54
57
|
*/
|
|
55
58
|
export function getGovernanceConfig(target: RunTarget): GovernanceConfig | undefined {
|
|
56
|
-
|
|
59
|
+
return attempt(() => {
|
|
57
60
|
const raw = loadRawProjectConfig(target);
|
|
58
61
|
const governance = raw?.governance;
|
|
59
62
|
if (governance === null || typeof governance !== 'object') return undefined;
|
|
60
63
|
return governance as GovernanceConfig;
|
|
61
|
-
}
|
|
62
|
-
return undefined;
|
|
63
|
-
}
|
|
64
|
+
}, () => undefined);
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
/**
|
|
@@ -120,7 +120,11 @@ describe('SpecValidator', () => {
|
|
|
120
120
|
|
|
121
121
|
describe('validateFile() with YAML', () => {
|
|
122
122
|
it('should validate valid YAML file', async () => {
|
|
123
|
-
mockFs.access.
|
|
123
|
+
mockFs.access.mockImplementation((p: any) =>
|
|
124
|
+
String(p).includes('schemas')
|
|
125
|
+
? Promise.reject(new Error('no schema'))
|
|
126
|
+
: Promise.resolve(undefined)
|
|
127
|
+
);
|
|
124
128
|
mockFs.readFile.mockResolvedValue('name: test\nversion: 1');
|
|
125
129
|
|
|
126
130
|
const result = await validator.validateFile('specs/test.yml');
|
|
@@ -129,7 +133,11 @@ describe('SpecValidator', () => {
|
|
|
129
133
|
});
|
|
130
134
|
|
|
131
135
|
it('should detect invalid YAML', async () => {
|
|
132
|
-
mockFs.access.
|
|
136
|
+
mockFs.access.mockImplementation((p: any) =>
|
|
137
|
+
String(p).includes('schemas')
|
|
138
|
+
? Promise.reject(new Error('no schema'))
|
|
139
|
+
: Promise.resolve(undefined)
|
|
140
|
+
);
|
|
133
141
|
mockFs.readFile.mockResolvedValue('invalid: yaml: content:');
|
|
134
142
|
|
|
135
143
|
const result = await validator.validateFile('specs/bad.yml');
|
|
@@ -140,7 +148,11 @@ describe('SpecValidator', () => {
|
|
|
140
148
|
|
|
141
149
|
describe('validateFile() with ARCHITECTURE.md', () => {
|
|
142
150
|
it('should validate valid ARCHITECTURE.md', async () => {
|
|
143
|
-
mockFs.access.
|
|
151
|
+
mockFs.access.mockImplementation((p: any) =>
|
|
152
|
+
String(p).includes('schemas')
|
|
153
|
+
? Promise.reject(new Error('no schema'))
|
|
154
|
+
: Promise.resolve(undefined)
|
|
155
|
+
);
|
|
144
156
|
mockFs.readFile.mockResolvedValue('# Architecture\n\n## Module A\n\nContent...');
|
|
145
157
|
|
|
146
158
|
const result = await validator.validateFile('ARCHITECTURE.md');
|
|
@@ -149,7 +161,11 @@ describe('SpecValidator', () => {
|
|
|
149
161
|
});
|
|
150
162
|
|
|
151
163
|
it('should warn on missing headers', async () => {
|
|
152
|
-
mockFs.access.
|
|
164
|
+
mockFs.access.mockImplementation((p: any) =>
|
|
165
|
+
String(p).includes('schemas')
|
|
166
|
+
? Promise.reject(new Error('no schema'))
|
|
167
|
+
: Promise.resolve(undefined)
|
|
168
|
+
);
|
|
153
169
|
mockFs.readFile.mockResolvedValue('Just plain text without headers');
|
|
154
170
|
|
|
155
171
|
const result = await validator.validateFile('ARCHITECTURE.md');
|
|
@@ -169,7 +185,11 @@ describe('SpecValidator', () => {
|
|
|
169
185
|
|
|
170
186
|
it('should identify specs directory files', async () => {
|
|
171
187
|
// specs/ 下的文件应该被识别
|
|
172
|
-
mockFs.access.
|
|
188
|
+
mockFs.access.mockImplementation((p: any) =>
|
|
189
|
+
String(p).includes('schemas')
|
|
190
|
+
? Promise.reject(new Error('no schema'))
|
|
191
|
+
: Promise.resolve(undefined)
|
|
192
|
+
);
|
|
173
193
|
mockFs.readFile.mockResolvedValue('# Test\n\nContent');
|
|
174
194
|
const result = await validator.validateFile('specs/modules/test.md');
|
|
175
195
|
expect(result.file).toBe('specs/modules/test.md');
|
|
@@ -178,7 +198,11 @@ describe('SpecValidator', () => {
|
|
|
178
198
|
|
|
179
199
|
describe('basicValidation()', () => {
|
|
180
200
|
it('should return valid for empty content', async () => {
|
|
181
|
-
mockFs.access.
|
|
201
|
+
mockFs.access.mockImplementation((p: any) =>
|
|
202
|
+
String(p).includes('schemas')
|
|
203
|
+
? Promise.reject(new Error('no schema'))
|
|
204
|
+
: Promise.resolve(undefined)
|
|
205
|
+
);
|
|
182
206
|
mockFs.readFile.mockResolvedValue('');
|
|
183
207
|
|
|
184
208
|
const result = await validator.validateFile('specs/empty.yml');
|
|
@@ -190,7 +214,11 @@ describe('SpecValidator', () => {
|
|
|
190
214
|
|
|
191
215
|
describe('fileExists()', () => {
|
|
192
216
|
it('should return true for existing file', async () => {
|
|
193
|
-
mockFs.access.
|
|
217
|
+
mockFs.access.mockImplementation((p: any) =>
|
|
218
|
+
String(p).includes('schemas')
|
|
219
|
+
? Promise.reject(new Error('no schema'))
|
|
220
|
+
: Promise.resolve(undefined)
|
|
221
|
+
);
|
|
194
222
|
mockFs.readFile.mockResolvedValue('test');
|
|
195
223
|
|
|
196
224
|
const result = await validator.validateFile('specs/existing.yml');
|
|
@@ -291,7 +319,11 @@ describe('SpecValidator', () => {
|
|
|
291
319
|
|
|
292
320
|
describe('validate with custom schema', () => {
|
|
293
321
|
it('should use provided schema', async () => {
|
|
294
|
-
mockFs.access.
|
|
322
|
+
mockFs.access.mockImplementation((p: any) =>
|
|
323
|
+
String(p).includes('schemas')
|
|
324
|
+
? Promise.reject(new Error('no schema'))
|
|
325
|
+
: Promise.resolve(undefined)
|
|
326
|
+
);
|
|
295
327
|
mockFs.readFile.mockResolvedValue('custom content');
|
|
296
328
|
|
|
297
329
|
const customSchema = {
|
|
@@ -311,7 +343,11 @@ describe('SpecValidator', () => {
|
|
|
311
343
|
});
|
|
312
344
|
|
|
313
345
|
it('should handle schema validation errors', async () => {
|
|
314
|
-
mockFs.access.
|
|
346
|
+
mockFs.access.mockImplementation((p: any) =>
|
|
347
|
+
String(p).includes('schemas')
|
|
348
|
+
? Promise.reject(new Error('no schema'))
|
|
349
|
+
: Promise.resolve(undefined)
|
|
350
|
+
);
|
|
315
351
|
mockFs.readFile.mockResolvedValue('bad content');
|
|
316
352
|
|
|
317
353
|
const failingSchema = {
|
|
@@ -332,7 +368,11 @@ describe('SpecValidator', () => {
|
|
|
332
368
|
});
|
|
333
369
|
|
|
334
370
|
it('should handle schema throwing exception', async () => {
|
|
335
|
-
mockFs.access.
|
|
371
|
+
mockFs.access.mockImplementation((p: any) =>
|
|
372
|
+
String(p).includes('schemas')
|
|
373
|
+
? Promise.reject(new Error('no schema'))
|
|
374
|
+
: Promise.resolve(undefined)
|
|
375
|
+
);
|
|
336
376
|
mockFs.readFile.mockResolvedValue('content');
|
|
337
377
|
|
|
338
378
|
const throwingSchema = {
|
|
@@ -351,7 +391,11 @@ describe('SpecValidator', () => {
|
|
|
351
391
|
|
|
352
392
|
describe('validateFile() without schema', () => {
|
|
353
393
|
it('should use basicValidation when no schema provided', async () => {
|
|
354
|
-
mockFs.access.
|
|
394
|
+
mockFs.access.mockImplementation((p: any) =>
|
|
395
|
+
String(p).includes('schemas')
|
|
396
|
+
? Promise.reject(new Error('no schema'))
|
|
397
|
+
: Promise.resolve(undefined)
|
|
398
|
+
);
|
|
355
399
|
mockFs.readFile.mockResolvedValue('# Title\n\n## Section\n\nContent');
|
|
356
400
|
|
|
357
401
|
const result = await validator.validateFile('ARCHITECTURE.md');
|
|
@@ -361,7 +405,11 @@ describe('SpecValidator', () => {
|
|
|
361
405
|
});
|
|
362
406
|
|
|
363
407
|
it('should detect missing headers in architecture file', async () => {
|
|
364
|
-
mockFs.access.
|
|
408
|
+
mockFs.access.mockImplementation((p: any) =>
|
|
409
|
+
String(p).includes('schemas')
|
|
410
|
+
? Promise.reject(new Error('no schema'))
|
|
411
|
+
: Promise.resolve(undefined)
|
|
412
|
+
);
|
|
365
413
|
mockFs.readFile.mockResolvedValue('Plain text without any headers');
|
|
366
414
|
|
|
367
415
|
const result = await validator.validateFile('ARCHITECTURE.md');
|
|
@@ -375,7 +423,11 @@ describe('SpecValidator', () => {
|
|
|
375
423
|
|
|
376
424
|
describe('convenience functions', () => {
|
|
377
425
|
it('validateSpec should work without schemaPath', async () => {
|
|
378
|
-
mockFs.access.
|
|
426
|
+
mockFs.access.mockImplementation((p: any) =>
|
|
427
|
+
String(p).includes('schemas')
|
|
428
|
+
? Promise.reject(new Error('no schema'))
|
|
429
|
+
: Promise.resolve(undefined)
|
|
430
|
+
);
|
|
379
431
|
mockFs.readFile.mockResolvedValue('content');
|
|
380
432
|
|
|
381
433
|
const result = await validateSpec('specs/test.yml');
|
|
@@ -19,6 +19,7 @@ import type {
|
|
|
19
19
|
BatchSpecValidationResult,
|
|
20
20
|
SpecSchemaDefinition,
|
|
21
21
|
SpecType,
|
|
22
|
+
SpecValidationError,
|
|
22
23
|
} from '../../types/spec';
|
|
23
24
|
|
|
24
25
|
/**
|
|
@@ -31,6 +32,19 @@ const DEFAULT_CONFIG: SpecValidatorConfig = {
|
|
|
31
32
|
failureLevel: 'error',
|
|
32
33
|
};
|
|
33
34
|
|
|
35
|
+
/**
|
|
36
|
+
* 动态导入的 Schema 模块形状守卫:只认「带 validate 函数的对象」,
|
|
37
|
+
* name/version 是否合法字符串由调用点各自窄化(坏形状按「无 Schema」处理,不 any 穿透)
|
|
38
|
+
*/
|
|
39
|
+
function isSchemaModule(m: unknown): m is { name?: unknown; version?: unknown; validate: SpecSchemaDefinition['validate'] } {
|
|
40
|
+
return (
|
|
41
|
+
typeof m === 'object' &&
|
|
42
|
+
m !== null &&
|
|
43
|
+
'validate' in m &&
|
|
44
|
+
typeof (m as { validate?: unknown }).validate === 'function'
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
34
48
|
/**
|
|
35
49
|
* Spec 验证器
|
|
36
50
|
*/
|
|
@@ -74,38 +88,36 @@ export class SpecValidator {
|
|
|
74
88
|
|
|
75
89
|
const absolutePath = path.resolve(schemaPath);
|
|
76
90
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
if (schemaModule && schemaModule.validate) {
|
|
95
|
-
const schema: SpecSchemaDefinition = {
|
|
96
|
-
name: schemaModule.name || 'custom',
|
|
97
|
-
version: schemaModule.version,
|
|
98
|
-
validate: schemaModule.validate,
|
|
99
|
-
};
|
|
100
|
-
this.schemaCache.set(schemaPath, schema);
|
|
101
|
-
return schema;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
return null;
|
|
105
|
-
} catch (error) {
|
|
106
|
-
// Schema 加载失败是正常的(项目可能没有自定义 Schema)
|
|
91
|
+
// 无自定义 Schema 是正常情况(三个候选都不在场 → null);
|
|
92
|
+
// 候选在场但加载/解析失败 → 抛出(fail-fast:坏 Schema 不装成「没有 Schema」)
|
|
93
|
+
const indexPath = path.join(absolutePath, 'index.ts');
|
|
94
|
+
const indexPathJs = path.join(absolutePath, 'index.js');
|
|
95
|
+
|
|
96
|
+
let schemaModule: unknown;
|
|
97
|
+
|
|
98
|
+
if (await this.fileExists(indexPath)) {
|
|
99
|
+
// 动态导入 TypeScript 模块(需要 tsx 或编译后的 .js)
|
|
100
|
+
schemaModule = await this.dynamicImport(indexPath);
|
|
101
|
+
} else if (await this.fileExists(indexPathJs)) {
|
|
102
|
+
schemaModule = await this.dynamicImport(indexPathJs);
|
|
103
|
+
} else if (await this.fileExists(absolutePath)) {
|
|
104
|
+
// 尝试直接加载指定文件
|
|
105
|
+
schemaModule = await this.dynamicImport(absolutePath);
|
|
106
|
+
} else {
|
|
107
107
|
return null;
|
|
108
108
|
}
|
|
109
|
+
|
|
110
|
+
if (isSchemaModule(schemaModule)) {
|
|
111
|
+
const schema: SpecSchemaDefinition = {
|
|
112
|
+
name: typeof schemaModule.name === 'string' ? schemaModule.name : 'custom',
|
|
113
|
+
version: typeof schemaModule.version === 'string' ? schemaModule.version : undefined,
|
|
114
|
+
validate: schemaModule.validate,
|
|
115
|
+
};
|
|
116
|
+
this.schemaCache.set(schemaPath, schema);
|
|
117
|
+
return schema;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return null;
|
|
109
121
|
}
|
|
110
122
|
|
|
111
123
|
/**
|
|
@@ -188,8 +200,8 @@ export class SpecValidator {
|
|
|
188
200
|
private async basicValidation(filePath: string, specType: SpecType): Promise<SpecValidationResult> {
|
|
189
201
|
const absolutePath = path.resolve(filePath);
|
|
190
202
|
const content = await fs.readFile(absolutePath, 'utf-8');
|
|
191
|
-
const errors:
|
|
192
|
-
const warnings:
|
|
203
|
+
const errors: SpecValidationError[] = [];
|
|
204
|
+
const warnings: SpecValidationError[] = [];
|
|
193
205
|
|
|
194
206
|
// ARCHITECTURE.md 基础检查
|
|
195
207
|
if (specType === 'architecture') {
|
|
@@ -337,23 +349,21 @@ export class SpecValidator {
|
|
|
337
349
|
}
|
|
338
350
|
|
|
339
351
|
/**
|
|
340
|
-
*
|
|
352
|
+
* 动态导入模块(fail-fast:导入失败抛出;唯一回退 = .ts 导入失败试编译后的同名 .js)
|
|
341
353
|
*/
|
|
342
|
-
private async dynamicImport(modulePath: string): Promise<
|
|
354
|
+
private async dynamicImport(modulePath: string): Promise<unknown> {
|
|
343
355
|
try {
|
|
344
356
|
// 尝试直接导入
|
|
345
357
|
return await import(modulePath);
|
|
346
|
-
} catch {
|
|
358
|
+
} catch (err) {
|
|
347
359
|
// 如果是 TypeScript 文件,尝试加载编译后的 JS
|
|
348
360
|
if (modulePath.endsWith('.ts')) {
|
|
349
361
|
const jsPath = modulePath.replace(/\.ts$/, '.js');
|
|
350
|
-
|
|
351
|
-
return
|
|
352
|
-
} catch {
|
|
353
|
-
return null;
|
|
362
|
+
if (await this.fileExists(jsPath)) {
|
|
363
|
+
return import(jsPath);
|
|
354
364
|
}
|
|
355
365
|
}
|
|
356
|
-
|
|
366
|
+
throw err;
|
|
357
367
|
}
|
|
358
368
|
}
|
|
359
369
|
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* command_success 判据与输出体量解耦(回归钉)
|
|
3
|
+
*
|
|
4
|
+
* 旧实现走 exec(缺省 maxBuffer 1MiB):被测命令输出超线即被砍进程并报
|
|
5
|
+
* `stdout maxBuffer length exceeded`,于是**跑成功的命令被判失败**,且 message 只剩
|
|
6
|
+
* 「命令执行失败: <command>」看不见真因。现场:消费方仓全量测试 1.16MiB stdout 撞此坑,
|
|
7
|
+
* pre-push 钩子连烧 10 轮全量测试。判成败只看退出码,输出只回带有界末段。
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { describe, it, expect } from '@jest/globals';
|
|
11
|
+
import { checkCommandSuccess } from '../check-handlers/command';
|
|
12
|
+
import type { CheckpointCheck, CheckpointContext } from '../../../types/checkpoint';
|
|
13
|
+
|
|
14
|
+
function check(command: string): CheckpointCheck {
|
|
15
|
+
return { id: 'c-1', type: 'command_success', config: { command } } as CheckpointCheck;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const context = { workdir: process.cwd(), projectPath: process.cwd() } as CheckpointContext;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 写 n 字节到 stdout 后按 code 退出(0 = 成功命令的常态:又吵又绿)。
|
|
22
|
+
* 用 exitCode 而非 process.exit():后者对管道写入不 flush 缓冲,末段会被截掉。
|
|
23
|
+
*/
|
|
24
|
+
function loudExit(code: number, mb: number, marker = ''): string {
|
|
25
|
+
return `node -e 'process.stdout.write("a".repeat(${mb * 1024 * 1024}));process.stdout.write("${marker}");process.exitCode=${code}'`;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
describe('command_success 不被输出体量左右', () => {
|
|
29
|
+
it('输出 2MiB 且退出 0 → 通过(旧实现在此判失败)', async () => {
|
|
30
|
+
const result = await checkCommandSuccess(check(loudExit(0, 2)), context);
|
|
31
|
+
|
|
32
|
+
expect(result.passed).toBe(true);
|
|
33
|
+
expect(result.message).toBe('命令执行成功: ' + loudExit(0, 2));
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('输出 3MiB 且退出 1 → 失败,message 带退出码', async () => {
|
|
37
|
+
const command = loudExit(1, 3, 'FAIL_SUMMARY_TAIL');
|
|
38
|
+
const result = await checkCommandSuccess(check(command), context);
|
|
39
|
+
|
|
40
|
+
expect(result.passed).toBe(false);
|
|
41
|
+
expect(result.message).toContain('退出码 1');
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('失败时回带输出末段,且体积有界(不缓冲全量)', async () => {
|
|
45
|
+
const result = await checkCommandSuccess(check(loudExit(1, 3, 'LAST_LINE_SUMMARY')), context);
|
|
46
|
+
|
|
47
|
+
expect(result.error).toContain('LAST_LINE_SUMMARY');
|
|
48
|
+
expect(result.error!.length).toBeLessThan(8192);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('命令不存在 → 失败但不抛(exit 路径归一)', async () => {
|
|
52
|
+
const result = await checkCommandSuccess(check('definitely-not-a-command-xyzzy'), context);
|
|
53
|
+
|
|
54
|
+
expect(result.passed).toBe(false);
|
|
55
|
+
});
|
|
56
|
+
});
|