@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,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pruneTraceLogs(harness#198)
|
|
3
|
+
*
|
|
4
|
+
* traces 轮转备份(traces-*.log)清理的独立库入口:TraceCollector.cleanupOldFiles
|
|
5
|
+
* 的薄包装,消费方不需要理解 traces 目录布局(不再手删 `.harness/logs/` 文件)。
|
|
6
|
+
* 不构造 TraceCollector——缺目录/缺文件一律 no-op 返回 0,零副作用。
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import * as fs from 'fs';
|
|
10
|
+
import * as os from 'os';
|
|
11
|
+
import * as path from 'path';
|
|
12
|
+
import { pruneTraceLogs } from '../traces';
|
|
13
|
+
import type { RunEnv } from '../../core/constraints/run-env';
|
|
14
|
+
|
|
15
|
+
const DAY_MS = 24 * 3600 * 1000;
|
|
16
|
+
|
|
17
|
+
let root: string;
|
|
18
|
+
let logsDir: string;
|
|
19
|
+
|
|
20
|
+
beforeEach(() => {
|
|
21
|
+
root = fs.mkdtempSync(path.join(os.tmpdir(), 'harness-prune-'));
|
|
22
|
+
logsDir = path.join(root, '.harness', 'logs');
|
|
23
|
+
fs.mkdirSync(logsDir, { recursive: true });
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
afterEach(() => {
|
|
27
|
+
fs.rmSync(root, { recursive: true, force: true });
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
/** 造一个带指定 mtime(距今 daysAgo 天)的日志文件 */
|
|
31
|
+
function writeLog(name: string, daysAgo: number): string {
|
|
32
|
+
const file = path.join(logsDir, name);
|
|
33
|
+
fs.writeFileSync(file, '{}\n', 'utf-8');
|
|
34
|
+
const mtime = new Date(Date.now() - daysAgo * DAY_MS);
|
|
35
|
+
fs.utimesSync(file, mtime, mtime);
|
|
36
|
+
return file;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
describe('pruneTraceLogs', () => {
|
|
40
|
+
it('删除超龄轮转备份,保留当前 traces.log 与新备份,返回删除数(默认 30 天)', () => {
|
|
41
|
+
const current = writeLog('traces.log', 400); // 当前文件再老也不删
|
|
42
|
+
const old = writeLog('traces-2026-07-01T00-00-00-000Z.log', 40);
|
|
43
|
+
const fresh = writeLog('traces-2026-09-20T00-00-00-000Z.log', 5);
|
|
44
|
+
const notLog = writeLog('notes.txt', 400); // 非 .log 不动
|
|
45
|
+
|
|
46
|
+
const deleted = pruneTraceLogs(root);
|
|
47
|
+
|
|
48
|
+
expect(deleted).toBe(1);
|
|
49
|
+
expect(fs.existsSync(old)).toBe(false);
|
|
50
|
+
expect(fs.existsSync(current)).toBe(true);
|
|
51
|
+
expect(fs.existsSync(fresh)).toBe(true);
|
|
52
|
+
expect(fs.existsSync(notLog)).toBe(true);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('maxAgeDays 可调:阈值收紧则新备份也删', () => {
|
|
56
|
+
writeLog('traces.log', 0);
|
|
57
|
+
const fresh = writeLog('traces-2026-09-25T00-00-00-000Z.log', 5);
|
|
58
|
+
|
|
59
|
+
expect(pruneTraceLogs(root, { maxAgeDays: 3 })).toBe(1);
|
|
60
|
+
expect(fs.existsSync(fresh)).toBe(false);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('traces 目录不存在 → 0,且不创建目录(零副作用)', () => {
|
|
64
|
+
fs.rmSync(logsDir, { recursive: true, force: true });
|
|
65
|
+
|
|
66
|
+
expect(pruneTraceLogs(root)).toBe(0);
|
|
67
|
+
expect(fs.existsSync(logsDir)).toBe(false);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('接受运行级观察面(RunTarget 两形同构;分层闸禁止 monitoring 测试值导入 core,用结构桩)', () => {
|
|
71
|
+
writeLog('traces-2026-07-01T00-00-00-000Z.log', 40);
|
|
72
|
+
|
|
73
|
+
const envStub = { projectPath: root } as RunEnv;
|
|
74
|
+
expect(pruneTraceLogs(envStub)).toBe(1);
|
|
75
|
+
});
|
|
76
|
+
});
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* TraceCollector 测试(简化版)
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { TraceCollector
|
|
5
|
+
import { TraceCollector } from '../traces';
|
|
6
6
|
import type { ExecutionTrace, TraceFilter } from '../../types/trace';
|
|
7
7
|
import * as fs from 'fs';
|
|
8
8
|
|
|
@@ -218,20 +218,4 @@ describe('TraceCollector', () => {
|
|
|
218
218
|
expect(getStats).toBeDefined();
|
|
219
219
|
});
|
|
220
220
|
});
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
describe('getTraceCollector()', () => {
|
|
224
|
-
it('should return global collector', () => {
|
|
225
|
-
const c1 = getTraceCollector();
|
|
226
|
-
const c2 = getTraceCollector();
|
|
227
|
-
expect(c1).toBe(c2);
|
|
228
|
-
});
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
describe('configureTraceCollector()', () => {
|
|
232
|
-
it('should create new global collector', () => {
|
|
233
|
-
configureTraceCollector({ traceFile: '/custom/traces.log' });
|
|
234
|
-
const c = getTraceCollector();
|
|
235
|
-
expect(c).toBeDefined();
|
|
236
|
-
});
|
|
237
221
|
});
|
|
@@ -35,24 +35,6 @@ export function timeRangeOf(timestamps: number[]): { start: number; end: number
|
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
/**
|
|
39
|
-
* 平均值
|
|
40
|
-
*/
|
|
41
|
-
export function calcAverage(values: number[]): number {
|
|
42
|
-
if (values.length === 0) return 0;
|
|
43
|
-
return values.reduce((sum, v) => sum + v, 0) / values.length;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* 百分位数(nearest-rank)
|
|
48
|
-
*/
|
|
49
|
-
export function calcPercentile(values: number[], percentile: number): number {
|
|
50
|
-
if (values.length === 0) return 0;
|
|
51
|
-
const sorted = [...values].sort((a, b) => a - b);
|
|
52
|
-
const index = Math.ceil((percentile / 100) * sorted.length) - 1;
|
|
53
|
-
return sorted[Math.max(0, index)];
|
|
54
|
-
}
|
|
55
|
-
|
|
56
38
|
/**
|
|
57
39
|
* 样本量不足时的趋势兜底阈值
|
|
58
40
|
*/
|
package/src/monitoring/index.ts
CHANGED
|
@@ -4,12 +4,7 @@
|
|
|
4
4
|
* Execution Trace 系统:
|
|
5
5
|
* - TraceCollector:轻量收集,零 Token
|
|
6
6
|
* - TraceAnalyzer:统计汇总,异常检测
|
|
7
|
-
*
|
|
8
|
-
* 上下文使用追踪:
|
|
9
|
-
* - ContextTracker:LLM 调用上下文快照记录
|
|
10
7
|
*/
|
|
11
8
|
|
|
12
|
-
export { TraceCollector,
|
|
13
|
-
export { TraceAnalyzer
|
|
14
|
-
export { ContextTracker } from './context-tracker';
|
|
15
|
-
export type { ContextAverages } from './context-tracker';
|
|
9
|
+
export { TraceCollector, pruneTraceLogs } from './traces';
|
|
10
|
+
export { TraceAnalyzer } from './trace-analyzer';
|
|
@@ -33,13 +33,13 @@ import {
|
|
|
33
33
|
/**
|
|
34
34
|
* 默认配置
|
|
35
35
|
*/
|
|
36
|
-
const DEFAULT_CONFIG
|
|
36
|
+
const DEFAULT_CONFIG = {
|
|
37
37
|
summaryFile: '.harness/logs/traces-summary.json',
|
|
38
38
|
periodMs: 3600 * 1000, // 1 小时
|
|
39
39
|
thresholds: {
|
|
40
40
|
failRate: 0.5, // 失败率 > 50% 视为异常
|
|
41
41
|
},
|
|
42
|
-
};
|
|
42
|
+
} satisfies TraceAnalyzerConfig;
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
45
|
* 计算趋势(`summarizeTraces` 的模块内助手)
|
|
@@ -139,19 +139,22 @@ export function summarizeTraces(traces: ExecutionTrace[]): TraceSummary[] {
|
|
|
139
139
|
/**
|
|
140
140
|
* 检测异常
|
|
141
141
|
*
|
|
142
|
-
* 基于阈值检测异常模式。阈值来自参数而非实例状态(ADR-0020):省略 `config`
|
|
143
|
-
*
|
|
142
|
+
* 基于阈值检测异常模式。阈值来自参数而非实例状态(ADR-0020):省略 `config`
|
|
143
|
+
* (或只给 `thresholds: {}`)时回落 `DEFAULT_CONFIG.thresholds` 的缺省口径。
|
|
144
144
|
*/
|
|
145
145
|
export function detectTraceAnomalies(
|
|
146
146
|
summaries: TraceSummary[],
|
|
147
147
|
config?: Partial<TraceAnalyzerConfig>
|
|
148
148
|
): TraceAnomaly[] {
|
|
149
149
|
const anomalies: TraceAnomaly[] = [];
|
|
150
|
-
|
|
150
|
+
// 阈值缺省由 DEFAULT_CONFIG 供给(satisfies 保住字面量非可选类型,无需断言);
|
|
151
|
+
// 调用方显式传 undefined/缺槽时回落缺省,不穿透成运行期 undefined 比较
|
|
152
|
+
const failRateThreshold =
|
|
153
|
+
config?.thresholds?.failRate ?? DEFAULT_CONFIG.thresholds.failRate;
|
|
151
154
|
|
|
152
155
|
for (const summary of summaries) {
|
|
153
156
|
// 检测失败率上升
|
|
154
|
-
if (summary.failRate >
|
|
157
|
+
if (summary.failRate > failRateThreshold && summary.recentTrend === 'rising') {
|
|
155
158
|
anomalies.push({
|
|
156
159
|
type: 'rising_fail_rate',
|
|
157
160
|
constraintId: summary.constraintId,
|
|
@@ -159,7 +162,7 @@ export function detectTraceAnomalies(
|
|
|
159
162
|
message: `约束 ${summary.constraintId} 失败率 ${Math.round(summary.failRate * 100)}% 且趋势上升`,
|
|
160
163
|
data: {
|
|
161
164
|
currentRate: summary.failRate,
|
|
162
|
-
threshold:
|
|
165
|
+
threshold: failRateThreshold,
|
|
163
166
|
trend: 'rising',
|
|
164
167
|
},
|
|
165
168
|
detectedAt: Date.now(),
|
|
@@ -297,14 +300,14 @@ export class TraceAnalyzer {
|
|
|
297
300
|
* 保存汇总结果
|
|
298
301
|
*/
|
|
299
302
|
saveSummary(summaries: TraceSummary[]): void {
|
|
300
|
-
writeSummaryJson(this.config.summaryFile
|
|
303
|
+
writeSummaryJson(this.config.summaryFile ?? DEFAULT_CONFIG.summaryFile, summaries);
|
|
301
304
|
}
|
|
302
305
|
|
|
303
306
|
/**
|
|
304
307
|
* 加载上次汇总结果
|
|
305
308
|
*/
|
|
306
309
|
loadSummary(): TraceSummary[] | null {
|
|
307
|
-
return readSummaryJson<TraceSummary[]>(this.config.summaryFile
|
|
310
|
+
return readSummaryJson<TraceSummary[]>(this.config.summaryFile ?? DEFAULT_CONFIG.summaryFile);
|
|
308
311
|
}
|
|
309
312
|
|
|
310
313
|
/**
|
|
@@ -390,11 +393,3 @@ export class TraceAnalyzer {
|
|
|
390
393
|
return lines.join('\n');
|
|
391
394
|
}
|
|
392
395
|
}
|
|
393
|
-
|
|
394
|
-
/**
|
|
395
|
-
* 创建分析器(使用全局收集器)
|
|
396
|
-
*/
|
|
397
|
-
export function createAnalyzer(config?: Partial<TraceAnalyzerConfig>): TraceAnalyzer {
|
|
398
|
-
const collector = new TraceCollector();
|
|
399
|
-
return new TraceAnalyzer(collector, config);
|
|
400
|
-
}
|
package/src/monitoring/traces.ts
CHANGED
|
@@ -18,6 +18,56 @@ import {
|
|
|
18
18
|
type TraceFilter,
|
|
19
19
|
type TraceCollectorConfig,
|
|
20
20
|
} from '../types/trace';
|
|
21
|
+
import type { RunTarget } from '../core/constraints/run-env';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* 清理某 trace 文件的轮转备份(traces-*.log):删除超过 maxAgeDays 天的 `.log` 备份,
|
|
25
|
+
* 当前文件(traceFile 本体)与其他非 `.log` 文件不动。目录不存在 → 0。
|
|
26
|
+
*
|
|
27
|
+
* `TraceCollector.cleanupOldFiles` 与 `pruneTraceLogs` 共用的唯一实现(harness#198)。
|
|
28
|
+
*/
|
|
29
|
+
function pruneRotatedTraceFiles(traceFile: string, maxAgeDays: number): number {
|
|
30
|
+
const dir = path.dirname(traceFile);
|
|
31
|
+
if (!fs.existsSync(dir)) {
|
|
32
|
+
return 0;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const files = fs.readdirSync(dir);
|
|
36
|
+
const backupFiles = files.filter(f => f.endsWith('.log') && f !== path.basename(traceFile));
|
|
37
|
+
|
|
38
|
+
const cutoffTime = Date.now() - maxAgeDays * 24 * 3600 * 1000;
|
|
39
|
+
let deletedCount = 0;
|
|
40
|
+
|
|
41
|
+
for (const file of backupFiles) {
|
|
42
|
+
const filePath = path.join(dir, file);
|
|
43
|
+
const stats = fs.statSync(filePath);
|
|
44
|
+
|
|
45
|
+
if (stats.mtimeMs < cutoffTime) {
|
|
46
|
+
fs.unlinkSync(filePath);
|
|
47
|
+
deletedCount++;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return deletedCount;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* traces 轮转备份清理的独立库入口(harness#198)
|
|
56
|
+
*
|
|
57
|
+
* `TraceCollector.cleanupOldFiles` 的薄包装:消费方不需要理解 traces 目录布局
|
|
58
|
+
* (不再手删 `.harness/logs/` 文件)。不构造 TraceCollector——traces 目录不存在
|
|
59
|
+
* 时 no-op 返回 0、不创建目录,零副作用。
|
|
60
|
+
*
|
|
61
|
+
* @param target 项目根路径,或本 run 的运行级观察面(与 `listRetiredConstraints` 同形)
|
|
62
|
+
* @returns 实际删除的备份文件数
|
|
63
|
+
*/
|
|
64
|
+
export function pruneTraceLogs(target: RunTarget, options: { maxAgeDays?: number } = {}): number {
|
|
65
|
+
const projectPath = typeof target === 'string' ? target : target.projectPath;
|
|
66
|
+
return pruneRotatedTraceFiles(
|
|
67
|
+
path.resolve(projectPath, DEFAULT_TRACE_FILE),
|
|
68
|
+
options.maxAgeDays ?? 30
|
|
69
|
+
);
|
|
70
|
+
}
|
|
21
71
|
|
|
22
72
|
/**
|
|
23
73
|
* 默认配置
|
|
@@ -25,11 +75,11 @@ import {
|
|
|
25
75
|
* `traceFile` 这里是**未锚定的项目相对片段**(#95 病根形状),故本文件在
|
|
26
76
|
* `project-path-convention.test.ts` 闸 3 的豁免表里点名带理由;锚定动作在构造函数里做。
|
|
27
77
|
*/
|
|
28
|
-
const DEFAULT_CONFIG
|
|
78
|
+
const DEFAULT_CONFIG = {
|
|
29
79
|
traceFile: DEFAULT_TRACE_FILE,
|
|
30
80
|
maxFileSize: 10 * 1024 * 1024, // 10MB
|
|
31
81
|
enabled: true,
|
|
32
|
-
};
|
|
82
|
+
} satisfies TraceCollectorConfig;
|
|
33
83
|
|
|
34
84
|
/**
|
|
35
85
|
* Trace 收集器
|
|
@@ -52,10 +102,12 @@ export class TraceCollector {
|
|
|
52
102
|
constructor(config?: Partial<TraceCollectorConfig>) {
|
|
53
103
|
this.config = { ...DEFAULT_CONFIG, ...config };
|
|
54
104
|
// 收根则相对落点按项目解析(harness#139:否则 -p 半失效——评估跑在 B、trace 写进 cwd);
|
|
55
|
-
// 没收根则保持 cwd
|
|
105
|
+
// 没收根则保持 cwd 解析,这是跨仓消费者依赖的兼容面,不是遗漏;
|
|
106
|
+
// 显式 traceFile: undefined 回落缺省(satisfies 保住缺省值非可选类型)
|
|
107
|
+
const traceFile = this.config.traceFile ?? DEFAULT_CONFIG.traceFile;
|
|
56
108
|
this.traceFile = this.config.projectPath
|
|
57
|
-
? path.resolve(this.config.projectPath,
|
|
58
|
-
:
|
|
109
|
+
? path.resolve(this.config.projectPath, traceFile)
|
|
110
|
+
: traceFile;
|
|
59
111
|
this.ensureDirectory();
|
|
60
112
|
}
|
|
61
113
|
|
|
@@ -227,7 +279,7 @@ export class TraceCollector {
|
|
|
227
279
|
}
|
|
228
280
|
|
|
229
281
|
const stats = fs.statSync(this.traceFile);
|
|
230
|
-
if (stats.size >= this.config.maxFileSize
|
|
282
|
+
if (stats.size >= (this.config.maxFileSize ?? DEFAULT_CONFIG.maxFileSize)) {
|
|
231
283
|
this.rotateFile();
|
|
232
284
|
}
|
|
233
285
|
}
|
|
@@ -254,28 +306,7 @@ export class TraceCollector {
|
|
|
254
306
|
* 删除超过 maxAge 天的备份文件
|
|
255
307
|
*/
|
|
256
308
|
cleanupOldFiles(maxAgeDays: number = 30): number {
|
|
257
|
-
|
|
258
|
-
if (!fs.existsSync(dir)) {
|
|
259
|
-
return 0;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
const files = fs.readdirSync(dir);
|
|
263
|
-
const backupFiles = files.filter(f => f.endsWith('.log') && f !== path.basename(this.traceFile));
|
|
264
|
-
|
|
265
|
-
const cutoffTime = Date.now() - maxAgeDays * 24 * 3600 * 1000;
|
|
266
|
-
let deletedCount = 0;
|
|
267
|
-
|
|
268
|
-
for (const file of backupFiles) {
|
|
269
|
-
const filePath = path.join(dir, file);
|
|
270
|
-
const stats = fs.statSync(filePath);
|
|
271
|
-
|
|
272
|
-
if (stats.mtimeMs < cutoffTime) {
|
|
273
|
-
fs.unlinkSync(filePath);
|
|
274
|
-
deletedCount++;
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
return deletedCount;
|
|
309
|
+
return pruneRotatedTraceFiles(this.traceFile, maxAgeDays);
|
|
279
310
|
}
|
|
280
311
|
|
|
281
312
|
/**
|
|
@@ -308,33 +339,4 @@ export class TraceCollector {
|
|
|
308
339
|
newestTrace: last?.timestamp,
|
|
309
340
|
};
|
|
310
341
|
}
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
/**
|
|
314
|
-
* 全局单例(**cwd 锚定**的兼容面)
|
|
315
|
-
*
|
|
316
|
-
* harness#139 起本仓生产代码不再消费它:CLI check/report 与 bootstrap 四个组合根
|
|
317
|
-
* 各自 `new TraceCollector({ projectPath })` 锚根构造(守卫见 project-path-convention
|
|
318
|
-
* 闸 4)。保留是给跨仓调用方的既有形状——它依赖「调用方进程 cwd 恰好是项目」。
|
|
319
|
-
* 传 `projectPath` 是它的锚根出口;不传则落点按 cwd 解析(行为逐字不变)。
|
|
320
|
-
*/
|
|
321
|
-
let globalCollector: TraceCollector | null = null;
|
|
322
|
-
|
|
323
|
-
/**
|
|
324
|
-
* 获取全局收集器(cwd 锚定,兼容语义见上)
|
|
325
|
-
*/
|
|
326
|
-
export function getTraceCollector(): TraceCollector {
|
|
327
|
-
if (!globalCollector) {
|
|
328
|
-
globalCollector = new TraceCollector();
|
|
329
|
-
}
|
|
330
|
-
return globalCollector;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
/**
|
|
334
|
-
* 配置全局收集器(cwd 锚定,兼容语义见 `getTraceCollector()`)
|
|
335
|
-
*
|
|
336
|
-
* 需要把 trace 落进指定项目的调用方直接构造实例:`new TraceCollector({ projectPath })`。
|
|
337
|
-
*/
|
|
338
|
-
export function configureTraceCollector(config: Partial<TraceCollectorConfig>): void {
|
|
339
|
-
globalCollector = new TraceCollector(config);
|
|
340
342
|
}
|
package/src/pretool-use-hook.ts
CHANGED
|
@@ -15,18 +15,19 @@
|
|
|
15
15
|
* 也不全体 Bash 秒断,拦截层只是纵深防御的一道;
|
|
16
16
|
* - warn/audit 级命中同样放行(只拦 block 级),与生成版行为一致。
|
|
17
17
|
*
|
|
18
|
-
* P1-7(ADR-0031
|
|
18
|
+
* P1-7(ADR-0031,票08):判定后对命中写审计 trace(只记账不加新拦截
|
|
19
19
|
* 能力)——此前拦下/放行的危险命令只写 stderr 不落盘,traces.log 里只有约束检查
|
|
20
|
-
* 在写。留痕失败经
|
|
20
|
+
* 在写。留痕失败经 utils/attempt 显式降级,fail-open 口径与 shim 主路径一致。
|
|
21
21
|
*
|
|
22
|
-
* P1-5 harness 半边(ADR-0031
|
|
22
|
+
* P1-5 harness 半边(ADR-0031,票08):识别 tool_name 非 Bash 的事件
|
|
23
23
|
* (Edit/Write/apply_patch/MCP 工具,下游消费方补全 codex hooks matcher 后会到达),
|
|
24
24
|
* 只留痕不拦截——这些事件的 tool_input 没有 command 字段,旧形状会因缺字段
|
|
25
25
|
* fail-open 空转;拦截归 codex 沙箱,本 shim 对它们只记账。
|
|
26
26
|
*/
|
|
27
27
|
import { CommandGate } from './gates/command';
|
|
28
|
-
import type { CommandBlacklistRule } from './
|
|
28
|
+
import type { CommandBlacklistRule } from './types/gate';
|
|
29
29
|
import { TraceCollector } from './monitoring/traces';
|
|
30
|
+
import { attempt } from './utils/attempt';
|
|
30
31
|
|
|
31
32
|
/** hook 标识:下游消费方 hook 配置共用同一 marker 做幂等检测(值不可变,改动会破坏存量配置的幂等识别) */
|
|
32
33
|
export const HOOK_MARKER = 'harness-command-gate';
|
|
@@ -53,27 +54,28 @@ export interface PreToolUseDecision {
|
|
|
53
54
|
* 非 Bash 工具事件(Edit/Write/apply_patch/MCP)恒放行(P1-5:拦截归 codex 沙箱)。
|
|
54
55
|
*/
|
|
55
56
|
export function decidePreToolUse(rawStdin: string): PreToolUseDecision {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
// 显式 fail-open(attempt):stdin 非 JSON 时按空输入放行——provider 执法脚本
|
|
58
|
+
// 崩溃/误判不能误伤用户操作,宁可漏拦也不全体 Bash 秒断
|
|
59
|
+
const input = attempt(
|
|
60
|
+
() => JSON.parse(rawStdin || '{}') as PreToolUseInput,
|
|
61
|
+
(): PreToolUseInput => ({}),
|
|
62
|
+
);
|
|
62
63
|
const toolName = input.tool_name || 'Bash';
|
|
63
64
|
const toolInput = input.tool_input || {};
|
|
64
65
|
if (toolName !== 'Bash') {
|
|
65
66
|
return { allowed: true, command: '', hits: [], toolName, targetPath: toolInput.file_path };
|
|
66
67
|
}
|
|
67
68
|
const command = toolInput.command || '';
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
69
|
+
// 显式 fail-open(attempt):CommandGate 加载/判定异常一律放行,理由同上
|
|
70
|
+
return attempt(
|
|
71
|
+
() => {
|
|
72
|
+
const gate = new CommandGate();
|
|
73
|
+
// 与 isAllowed 同一谓词(match):allowed = 无 block 级命中
|
|
74
|
+
const hits = gate.match(command);
|
|
75
|
+
return { allowed: !hits.some((r) => r.level === 'block'), command, hits, toolName };
|
|
76
|
+
},
|
|
77
|
+
() => ({ allowed: true, command, hits: [], toolName }),
|
|
78
|
+
);
|
|
77
79
|
}
|
|
78
80
|
|
|
79
81
|
/** 黑名单级别 → trace severity 映射(词表不动 types/trace.ts) */
|
|
@@ -97,7 +99,10 @@ const SEVERITY_BY_LEVEL = {
|
|
|
97
99
|
* 项目根(provider 在项目根起会话),可接受;写错地方也不拦主路径。
|
|
98
100
|
*/
|
|
99
101
|
function recordHookTrace(decision: PreToolUseDecision): void {
|
|
100
|
-
|
|
102
|
+
// 显式 fail-open(attempt):留痕是记账副作用,失败不能影响拦截主路径
|
|
103
|
+
// (口径与 shim 主路径一致——hook 进程里任何异常都必须放行)
|
|
104
|
+
attempt(
|
|
105
|
+
() => {
|
|
101
106
|
// P1-5:非 Bash 工具事件只留痕不拦截(拦截归 codex 沙箱)——constraintId
|
|
102
107
|
// 按工具名分(tool-event:<tool>),工具集合有界、不会碎片化聚合;evidence
|
|
103
108
|
// 记工具名 + 目标路径类字段(file_path),不记内容正文。
|
|
@@ -133,9 +138,9 @@ function recordHookTrace(decision: PreToolUseDecision): void {
|
|
|
133
138
|
...(firstToken ? [`cmd:${firstToken}`] : []),
|
|
134
139
|
],
|
|
135
140
|
});
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
141
|
+
},
|
|
142
|
+
() => undefined,
|
|
143
|
+
);
|
|
139
144
|
}
|
|
140
145
|
|
|
141
146
|
/**
|
package/src/release/CONTEXT.md
CHANGED
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
## 核心导出
|
|
7
7
|
下列符号都由 `integrity.ts` 就地导出;`index.ts` barrel 只再导出标「公开 API」的那一组,其余属模块内部 seam——仓内消费方直接 `from './integrity'`,导出面由 `__tests__/barrel.test.ts` 守卫(harness#92)。
|
|
8
8
|
- `deriveCriticalArtifacts(manifest)`(`integrity.ts`)——从包声明面(package.json `main`/`exports`/`bin`)推导脚本入口清单(.js/.cjs/.mjs/.d.ts,去 `./` 前缀、剔除非脚本叶子、去重排序);纯函数
|
|
9
|
-
- `EXTRA_CRITICAL_ARTIFACTS`——声明面推导之外的运行时关键发布物(bin/harness.js 引导期 require
|
|
9
|
+
- `EXTRA_CRITICAL_ARTIFACTS`——声明面推导之外的运行时关键发布物(bin/harness.js 引导期 require 的命令/门禁定义表);与其描述的文件同仓同评审,删改须同步
|
|
10
10
|
- `resolvePackageRoot(fromDir?)`——从模块位置向上按包名解析本包根(源码仓与 node_modules 安装态均可达)
|
|
11
11
|
- `getCriticalArtifacts(pkgRoot?)` / `verifyReleaseArtifacts(pkgRoot?)`——公开 API;pkgRoot 缺省自动解析,外部消费者零参数即自检已安装的 harness
|
|
12
12
|
|
|
13
13
|
## 依赖关系
|
|
14
|
-
-
|
|
14
|
+
- 内部依赖仅 `utils/package-json`(readPackageJson 正本,重构 Phase 5 收口);其余只依赖 node fs/path
|
|
15
15
|
|
|
16
16
|
## 约定
|
|
17
17
|
- 清单维护模型:声明面推导为主(目录重构动到 package.json 时清单自动跟随)+ extras 随源码维护;**不新增第三处硬编码清单**
|
|
@@ -75,11 +75,10 @@ describe('deriveCriticalArtifacts', () => {
|
|
|
75
75
|
});
|
|
76
76
|
|
|
77
77
|
describe('EXTRA_CRITICAL_ARTIFACTS', () => {
|
|
78
|
-
it('覆盖 bin
|
|
78
|
+
it('覆盖 bin 引导定义表(随源码维护,删改须同评审)', () => {
|
|
79
79
|
expect(EXTRA_CRITICAL_ARTIFACTS).toEqual([
|
|
80
80
|
'dist/cli/commands/definitions.js',
|
|
81
81
|
'dist/gates/definitions.js',
|
|
82
|
-
'dist/tools/definitions',
|
|
83
82
|
]);
|
|
84
83
|
});
|
|
85
84
|
});
|
|
@@ -119,7 +118,6 @@ describe('getCriticalArtifacts / verifyReleaseArtifacts(fixture 包根)', ()
|
|
|
119
118
|
'dist/cli/commands/definitions.js',
|
|
120
119
|
'dist/gates/definitions.js',
|
|
121
120
|
'dist/index.js',
|
|
122
|
-
'dist/tools/definitions',
|
|
123
121
|
]);
|
|
124
122
|
});
|
|
125
123
|
|
|
@@ -131,10 +129,10 @@ describe('getCriticalArtifacts / verifyReleaseArtifacts(fixture 包根)', ()
|
|
|
131
129
|
|
|
132
130
|
it('缺文件 → ok:false 且 missing 指名', () => {
|
|
133
131
|
const root = makeFixture(FIXTURE_MANIFEST, FIXTURE_ARTIFACTS);
|
|
134
|
-
fs.rmSync(path.join(root, 'dist', '
|
|
132
|
+
fs.rmSync(path.join(root, 'dist', 'gates', 'definitions.js'));
|
|
135
133
|
const result = verifyReleaseArtifacts(root);
|
|
136
134
|
expect(result.ok).toBe(false);
|
|
137
|
-
expect(result.missing).toEqual(['dist/
|
|
135
|
+
expect(result.missing).toEqual(['dist/gates/definitions.js']);
|
|
138
136
|
});
|
|
139
137
|
});
|
|
140
138
|
|
|
@@ -152,8 +150,6 @@ describe('真实包根清单同步闸门', () => {
|
|
|
152
150
|
'dist/context/index.js',
|
|
153
151
|
'dist/core/index.d.ts',
|
|
154
152
|
'dist/core/index.js',
|
|
155
|
-
'dist/gates/index.d.ts',
|
|
156
|
-
'dist/gates/index.js',
|
|
157
153
|
'dist/index.d.ts',
|
|
158
154
|
'dist/index.js',
|
|
159
155
|
'dist/presets/index.d.ts',
|
package/src/release/integrity.ts
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
import * as fs from 'fs';
|
|
14
14
|
import * as path from 'path';
|
|
15
|
+
import { readPackageJson } from '../utils/package-json';
|
|
15
16
|
|
|
16
17
|
/** 本包名(包根向上解析的身份锚点,同 bin 名同源) */
|
|
17
18
|
export const HARNESS_PACKAGE_NAME = '@dommaker/harness';
|
|
@@ -35,8 +36,6 @@ export const EXTRA_CRITICAL_ARTIFACTS: readonly string[] = [
|
|
|
35
36
|
// bin/harness.js 引导期 require 的命令/门禁定义表
|
|
36
37
|
'dist/cli/commands/definitions.js',
|
|
37
38
|
'dist/gates/definitions.js',
|
|
38
|
-
// getToolsDir/getRegistryPath 运行时数据目录(build 脚本 cp -r,tsc 不产出)
|
|
39
|
-
'dist/tools/definitions',
|
|
40
39
|
];
|
|
41
40
|
|
|
42
41
|
const CRITICAL_SUFFIXES = ['.js', '.cjs', '.mjs', '.d.ts'];
|
|
@@ -72,12 +71,9 @@ export function deriveCriticalArtifacts(manifest: PackagePublishManifest): strin
|
|
|
72
71
|
}
|
|
73
72
|
|
|
74
73
|
function isHarnessPackageRoot(dir: string): boolean {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
} catch {
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
74
|
+
// 探测语义:该目录没有 package.json → false(向上继续找);
|
|
75
|
+
// 有但 JSON 损坏 → 抛出(fail-fast,不把损坏清单当「不是包根」跳过)
|
|
76
|
+
return readPackageJson(dir)?.name === HARNESS_PACKAGE_NAME;
|
|
81
77
|
}
|
|
82
78
|
|
|
83
79
|
/**
|
|
@@ -108,9 +104,10 @@ function resolveRoot(pkgRoot?: string): string {
|
|
|
108
104
|
*/
|
|
109
105
|
export function getCriticalArtifacts(pkgRoot?: string): string[] {
|
|
110
106
|
const root = resolveRoot(pkgRoot);
|
|
111
|
-
const manifest
|
|
112
|
-
|
|
113
|
-
|
|
107
|
+
const manifest = readPackageJson<PackagePublishManifest>(root);
|
|
108
|
+
if (!manifest) {
|
|
109
|
+
throw new Error(`[harness] 包根缺少 package.json: ${root}`);
|
|
110
|
+
}
|
|
114
111
|
return [...new Set([...deriveCriticalArtifacts(manifest), ...EXTRA_CRITICAL_ARTIFACTS])].sort();
|
|
115
112
|
}
|
|
116
113
|
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
// SDD Index Generator
|
|
2
2
|
// Scans docs/sdd/*/requirement.md, generates docs/sdd/_index.md
|
|
3
3
|
// Format: slug|pmoNumber|status|title|tags
|
|
4
|
+
//
|
|
5
|
+
// 与 knowledge/index-generator.ts 的相似是表面形状(扫树 → frontmatter → 竖线行),
|
|
6
|
+
// 不合并是刻意裁决(重构 Phase 5,理由见 src/knowledge/CONTEXT.md 约定节):
|
|
7
|
+
// 本生成器只管 docs/sdd 项目文档树(目录即条目、平铺、stale 跳过)。
|
|
4
8
|
|
|
5
9
|
import * as fs from 'fs';
|
|
6
10
|
import * as path from 'path';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* 背景:`utils/jsonl` 的 tail/head 是分块有界读(`openSync` + `fstatSync` + `readSync` +
|
|
5
5
|
* `closeSync`,ADR-0023 决策 3)。把整个 `fs` 模块 mock 掉的测试原先只提供了全文读入口
|
|
6
6
|
* `readFileSync`,于是走有界读的被测代码直接抛错,再被它自己的 `catch` 吞成「数据不存在」
|
|
7
|
-
* 一类的假象(session-manager 报 `Checkpoint
|
|
7
|
+
* 一类的假象(session-manager 报 `Checkpoint 不存在` 就是这样)。
|
|
8
8
|
*
|
|
9
9
|
* 口径一(同源):内容经 `readFile(path)` 现取,直接把 `readFileSync` 那个 mock 包一层即可——
|
|
10
10
|
* 测试改了它的返回值,两条读入口看到的就是同一个文件。
|
package/src/types/checkpoint.ts
CHANGED
|
@@ -45,8 +45,8 @@ export interface CheckConfig {
|
|
|
45
45
|
/** HTTP 方法 */
|
|
46
46
|
method?: 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
47
47
|
|
|
48
|
-
/** HTTP
|
|
49
|
-
body?:
|
|
48
|
+
/** HTTP 请求体(JSON 序列化后发送,形状由被测端点决定) */
|
|
49
|
+
body?: unknown;
|
|
50
50
|
|
|
51
51
|
/** HTTP 请求头 */
|
|
52
52
|
headers?: Record<string, string>;
|
|
@@ -126,11 +126,11 @@ export interface CheckResult {
|
|
|
126
126
|
/** 错误详情 */
|
|
127
127
|
error?: string;
|
|
128
128
|
|
|
129
|
-
/**
|
|
130
|
-
actual?:
|
|
129
|
+
/** 实际值(形状随检查类型而异,消费端自行窄化) */
|
|
130
|
+
actual?: unknown;
|
|
131
131
|
|
|
132
|
-
/**
|
|
133
|
-
expected?:
|
|
132
|
+
/** 预期值(同 actual,开放形状) */
|
|
133
|
+
expected?: unknown;
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
/**
|
|
@@ -166,8 +166,8 @@ export interface CheckpointContext {
|
|
|
166
166
|
/** 环境变量 */
|
|
167
167
|
env?: Record<string, string>;
|
|
168
168
|
|
|
169
|
-
/** 步骤输出(用于 output_*
|
|
170
|
-
output?:
|
|
169
|
+
/** 步骤输出(用于 output_* 检查;string 直用,其余 JSON 序列化) */
|
|
170
|
+
output?: unknown;
|
|
171
171
|
|
|
172
172
|
/** 自定义检查处理器 */
|
|
173
173
|
customHandlers?: Map<string, (config: CheckConfig) => Promise<CheckResult>>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 命令输出流注入面(Phase 4 类型收口)
|
|
3
|
+
*
|
|
4
|
+
* 正本原居 `cli/command-contract.ts`;core(constraint-lifecycle 的历史签名槽)
|
|
5
|
+
* 也消费它,形成 core→cli 的类型倒挂。按分层 `types → … → cli`,这个被两层
|
|
6
|
+
* 消费的公共类型下沉到 types 层;cli/command-contract.ts re-export 本定义,
|
|
7
|
+
* 既有 CLI 消费方导入路径不变。
|
|
8
|
+
*
|
|
9
|
+
* 最小可写接口:`process.stdout` / `process.stderr` 结构化满足。
|
|
10
|
+
*/
|
|
11
|
+
export interface CommandIO {
|
|
12
|
+
stdout: { write(chunk: string): boolean };
|
|
13
|
+
stderr: { write(chunk: string): boolean };
|
|
14
|
+
}
|