@dommaker/harness 1.14.0 → 1.16.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 +19 -0
- package/README.md +4 -2
- package/bin/harness.js +6 -0
- package/dist/cli/command-contract.d.ts +4 -4
- package/dist/cli/command-contract.d.ts.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 +44 -0
- package/dist/cli/commands/constraints-disable.d.ts.map +1 -0
- package/dist/cli/commands/constraints-disable.js +84 -0
- package/dist/cli/commands/constraints-disable.js.map +1 -0
- package/dist/cli/commands/constraints-pack-proposal.d.ts +8 -21
- package/dist/cli/commands/constraints-pack-proposal.d.ts.map +1 -1
- package/dist/cli/commands/constraints-pack-proposal.js +22 -130
- 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 -103
- package/dist/cli/commands/constraints-reactivate.js.map +1 -1
- package/dist/cli/commands/constraints-retire.d.ts +14 -60
- package/dist/cli/commands/constraints-retire.d.ts.map +1 -1
- package/dist/cli/commands/constraints-retire.js +22 -195
- package/dist/cli/commands/constraints-retire.js.map +1 -1
- package/dist/cli/commands/constraints.d.ts +7 -10
- package/dist/cli/commands/constraints.d.ts.map +1 -1
- package/dist/cli/commands/constraints.js +8 -22
- package/dist/cli/commands/constraints.js.map +1 -1
- package/dist/cli/commands/definitions.d.ts.map +1 -1
- package/dist/cli/commands/definitions.js +16 -1
- package/dist/cli/commands/definitions.js.map +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +4 -19
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/knowledge-view.d.ts +3 -3
- package/dist/cli/commands/knowledge-view.js +4 -4
- package/dist/cli/commands/knowledge-view.js.map +1 -1
- package/dist/cli/commands/knowledge.js +1 -1
- package/dist/cli/commands/knowledge.js.map +1 -1
- package/dist/cli/commands/release.d.ts +2 -2
- package/dist/cli/commands/release.js +2 -2
- 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/sync-docs/agents-syncer.js +2 -4
- package/dist/cli/commands/sync-docs/agents-syncer.js.map +1 -1
- 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 +30 -0
- package/dist/cli/commands/sync-docs/context-syncer.js.map +1 -1
- package/dist/cli/commands/sync-docs/head-gate.d.ts +34 -0
- package/dist/cli/commands/sync-docs/head-gate.d.ts.map +1 -0
- package/dist/cli/commands/sync-docs/head-gate.js +86 -0
- package/dist/cli/commands/sync-docs/head-gate.js.map +1 -0
- package/dist/cli/commands/sync-docs/index.d.ts +8 -1
- package/dist/cli/commands/sync-docs/index.d.ts.map +1 -1
- package/dist/cli/commands/sync-docs/index.js +81 -5
- package/dist/cli/commands/sync-docs/index.js.map +1 -1
- package/dist/cli/commands/sync-docs/project-reader.d.ts +5 -0
- package/dist/cli/commands/sync-docs/project-reader.d.ts.map +1 -1
- 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.js +1 -1
- package/dist/cli/gate-command.js.map +1 -1
- package/dist/completion-checkers/contract-presence.d.ts +1 -1
- package/dist/completion-checkers/contract-presence.js +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 -3
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +2 -6
- package/dist/context/index.js.map +1 -1
- package/dist/context/knowledge-injector.d.ts.map +1 -1
- package/dist/context/knowledge-injector.js +3 -4
- package/dist/context/knowledge-injector.js.map +1 -1
- package/dist/context/session-manager.d.ts +0 -6
- package/dist/context/session-manager.d.ts.map +1 -1
- package/dist/context/session-manager.js +0 -9
- package/dist/context/session-manager.js.map +1 -1
- package/dist/context/types.d.ts +0 -24
- 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.js +1 -1
- package/dist/core/constraints/check-cache.d.ts +1 -1
- package/dist/core/constraints/check-cache.js +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/capability-sync.d.ts +1 -1
- package/dist/core/constraints/checkers/capability-sync.js +1 -1
- package/dist/core/constraints/checkers/docs-freshness.js +1 -1
- package/dist/core/constraints/checkers/docs-freshness.js.map +1 -1
- package/dist/core/constraints/checkers/governance-presence.d.ts +1 -1
- package/dist/core/constraints/checkers/governance-presence.js +1 -1
- package/dist/core/constraints/checkers/index.d.ts.map +1 -1
- package/dist/core/constraints/checkers/index.js +2 -2
- package/dist/core/constraints/checkers/index.js.map +1 -1
- package/dist/core/constraints/checkers/no-completion-without-verification.d.ts +39 -0
- package/dist/core/constraints/checkers/no-completion-without-verification.d.ts.map +1 -0
- package/dist/core/constraints/checkers/no-completion-without-verification.js +173 -0
- package/dist/core/constraints/checkers/no-completion-without-verification.js.map +1 -0
- package/dist/core/constraints/checkers/no-hardcoded-credentials.d.ts +3 -2
- package/dist/core/constraints/checkers/no-hardcoded-credentials.d.ts.map +1 -1
- package/dist/core/constraints/checkers/no-hardcoded-credentials.js +19 -7
- package/dist/core/constraints/checkers/no-hardcoded-credentials.js.map +1 -1
- package/dist/core/constraints/checkers/templated/file-exists.js +1 -1
- package/dist/core/constraints/checkers/templated/file-exists.js.map +1 -1
- package/dist/core/constraints/checkers/templated/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/checkers/types.d.ts +1 -1
- package/dist/core/constraints/checkers/types.js +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 +0 -17
- package/dist/core/constraints/context-builder.js.map +1 -1
- package/dist/core/constraints/definitions/guidelines.js +1 -1
- package/dist/core/constraints/definitions/iron-laws.js +2 -2
- package/dist/core/constraints/definitions/iron-laws.js.map +1 -1
- package/dist/core/constraints/definitions.d.ts +1 -1
- package/dist/core/constraints/definitions.js +1 -1
- package/dist/core/constraints/doc-freshness/runner.d.ts.map +1 -1
- package/dist/core/constraints/doc-freshness/runner.js +3 -1
- package/dist/core/constraints/doc-freshness/runner.js.map +1 -1
- package/dist/core/constraints/index.d.ts +1 -3
- 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/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/run-env.d.ts +3 -2
- package/dist/core/constraints/run-env.d.ts.map +1 -1
- package/dist/core/constraints/run-env.js +5 -4
- package/dist/core/constraints/run-env.js.map +1 -1
- package/dist/core/constraints/usage-report.d.ts +3 -6
- package/dist/core/constraints/usage-report.d.ts.map +1 -1
- package/dist/core/constraints/usage-report.js +6 -13
- package/dist/core/constraints/usage-report.js.map +1 -1
- package/dist/core/effective-constraints.d.ts +7 -7
- package/dist/core/effective-constraints.d.ts.map +1 -1
- package/dist/core/effective-constraints.js +7 -7
- 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/retired-constraints.d.ts +66 -0
- package/dist/core/retired-constraints.d.ts.map +1 -0
- package/dist/core/retired-constraints.js +52 -0
- package/dist/core/retired-constraints.js.map +1 -0
- package/dist/core/validators/check-handlers/command.d.ts.map +1 -1
- package/dist/core/validators/check-handlers/command.js +42 -4
- package/dist/core/validators/check-handlers/command.js.map +1 -1
- package/dist/core/validators/checkpoint.d.ts +4 -2
- package/dist/core/validators/checkpoint.d.ts.map +1 -1
- package/dist/core/validators/checkpoint.js +4 -2
- package/dist/core/validators/checkpoint.js.map +1 -1
- package/dist/core/validators/passes-gate.d.ts +2 -2
- package/dist/core/validators/passes-gate.d.ts.map +1 -1
- package/dist/core/validators/passes-gate.js +4 -3
- package/dist/core/validators/passes-gate.js.map +1 -1
- package/dist/gates/checker-gate.d.ts +4 -3
- package/dist/gates/checker-gate.d.ts.map +1 -1
- package/dist/gates/checker-gate.js +4 -3
- 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/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/index.d.ts +6 -40
- package/dist/gates/index.d.ts.map +1 -1
- package/dist/gates/index.js +5 -79
- package/dist/gates/index.js.map +1 -1
- package/dist/gates/registry.js +1 -1
- package/dist/gates/registry.js.map +1 -1
- package/dist/gates/types.d.ts +10 -3
- package/dist/gates/types.d.ts.map +1 -1
- package/dist/index.d.ts +19 -21
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +35 -67
- package/dist/index.js.map +1 -1
- package/dist/knowledge/audit-scoring.js +1 -1
- package/dist/knowledge/audit-scoring.js.map +1 -1
- package/dist/knowledge/index.d.ts +1 -3
- package/dist/knowledge/index.d.ts.map +1 -1
- package/dist/knowledge/index.js +3 -5
- package/dist/knowledge/index.js.map +1 -1
- package/dist/knowledge/query.d.ts +1 -1
- package/dist/knowledge/query.d.ts.map +1 -1
- package/dist/knowledge/query.js +12 -15
- package/dist/knowledge/query.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 +2 -11
- package/dist/monitoring/trace-analyzer.js.map +1 -1
- package/dist/monitoring/traces.d.ts +15 -11
- package/dist/monitoring/traces.d.ts.map +1 -1
- package/dist/monitoring/traces.js +44 -48
- 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 +7 -7
- package/dist/pretool-use-hook.js.map +1 -1
- package/dist/release/integrity.d.ts +4 -4
- package/dist/release/integrity.d.ts.map +1 -1
- package/dist/release/integrity.js +4 -6
- package/dist/release/integrity.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/test-setup/mkdtemp-cleanup.js +1 -1
- package/dist/types/constraint.d.ts +1 -7
- package/dist/types/constraint.d.ts.map +1 -1
- package/dist/types/constraint.js.map +1 -1
- package/dist/types/passes-gate.d.ts +7 -0
- package/dist/types/passes-gate.d.ts.map +1 -1
- package/dist/types/passes-gate.js +8 -0
- package/dist/types/passes-gate.js.map +1 -1
- package/dist/utils/detect-source-roots.d.ts +1 -1
- package/dist/utils/detect-source-roots.d.ts.map +1 -1
- package/dist/utils/detect-source-roots.js +2 -21
- package/dist/utils/detect-source-roots.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/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 -3
- package/src/CONTEXT.md +14 -7
- package/src/__tests__/acceptance-gate.test.ts +2 -4
- package/src/__tests__/checker-extra.test.ts +32 -9
- package/src/__tests__/checker-primitives-sdk.test.ts +2 -2
- package/src/__tests__/checker.test.ts +16 -14
- package/src/__tests__/detect-source-roots.test.ts +5 -4
- package/src/__tests__/effective-constraints.test.ts +16 -0
- package/src/__tests__/exec-checker-full-chain.test.ts +3 -3
- package/src/__tests__/iron-laws.test.ts +13 -20
- package/src/__tests__/layering.test.ts +2 -3
- package/src/__tests__/no-studio-references.test.ts +62 -0
- package/src/__tests__/passes-gate-check.test.ts +1 -1
- package/src/__tests__/pretool-use-hook.test.ts +5 -5
- package/src/__tests__/public-exports.test.ts +196 -41
- package/src/__tests__/public-type-surface.test.ts +27 -67
- package/src/__tests__/public-value-surface.test.ts +13 -36
- package/src/__tests__/retired-constraints.test.ts +99 -0
- package/src/__tests__/skip-semantics.test.ts +16 -33
- package/src/__tests__/trace-analyzer-extra.test.ts +1 -13
- package/src/__tests__/usage-report-public-export.test.ts +3 -3
- package/src/agents/CONTEXT.md +4 -4
- package/src/cli/__tests__/gate-command.test.ts +1 -1
- package/src/cli/command-contract.ts +4 -4
- package/src/cli/commands/CONTEXT.md +10 -9
- package/src/cli/commands/__tests__/check-read-count.test.ts +3 -0
- package/src/cli/commands/__tests__/check.test.ts +33 -6
- package/src/cli/commands/__tests__/command.test.ts +2 -2
- package/src/cli/commands/__tests__/constraints-disable.test.ts +229 -0
- package/src/cli/commands/__tests__/constraints-report-json-flag.test.ts +1 -1
- package/src/cli/commands/__tests__/constraints-report.test.ts +4 -4
- package/src/cli/commands/__tests__/knowledge-flywheel-consistency.test.ts +1 -1
- package/src/cli/commands/__tests__/knowledge-view.test.ts +1 -1
- package/src/cli/commands/__tests__/knowledge.test.ts +3 -3
- package/src/cli/commands/__tests__/project-path-anchoring.test.ts +4 -1
- package/src/cli/commands/__tests__/project-path-convention.test.ts +4 -36
- package/src/cli/commands/__tests__/spec-baseline-index-cap.test.ts +1 -1
- package/src/cli/commands/__tests__/sync-docs-agents.test.ts +1 -24
- package/src/cli/commands/__tests__/sync-docs-construction-sites.test.ts +175 -0
- package/src/cli/commands/__tests__/sync-docs-gate.test.ts +154 -0
- package/src/cli/commands/__tests__/sync-docs-table-layout.test.ts +1 -1
- package/src/cli/commands/__tests__/sync-docs.test.ts +3 -3
- package/src/cli/commands/__tests__/validate.test.ts +49 -0
- package/src/cli/commands/command.ts +2 -1
- package/src/cli/commands/constraints-disable.ts +94 -0
- package/src/cli/commands/constraints-pack-proposal.ts +27 -122
- package/src/cli/commands/constraints-reactivate.ts +22 -111
- package/src/cli/commands/constraints-retire.ts +33 -270
- package/src/cli/commands/constraints.ts +7 -31
- package/src/cli/commands/definitions.ts +16 -1
- package/src/cli/commands/init.ts +5 -19
- package/src/cli/commands/knowledge-view.ts +4 -4
- package/src/cli/commands/knowledge.ts +1 -1
- package/src/cli/commands/release.ts +2 -2
- package/src/cli/commands/scaffold-templates.ts +23 -0
- package/src/cli/commands/security.ts +1 -1
- package/src/cli/commands/sync-docs/__tests__/construction-site-count.test.ts +49 -0
- package/src/cli/commands/sync-docs/agents-syncer.ts +2 -4
- package/src/cli/commands/sync-docs/context-syncer.ts +43 -1
- package/src/cli/commands/sync-docs/head-gate.ts +87 -0
- package/src/cli/commands/sync-docs/index.ts +103 -6
- package/src/cli/commands/sync-docs/project-reader.ts +5 -0
- package/src/cli/commands/validate.ts +7 -0
- package/src/cli/gate-command.ts +1 -1
- package/src/completion-checkers/CONTEXT.md +3 -3
- package/src/completion-checkers/contract-presence.ts +1 -1
- package/src/completion-checkers/glob-match.ts +3 -35
- package/src/context/CONTEXT.md +5 -8
- package/src/context/__tests__/knowledge-injector.test.ts +21 -2
- package/src/context/__tests__/session-manager.test.ts +0 -7
- package/src/context/index.ts +1 -5
- package/src/context/knowledge-injector.ts +3 -4
- package/src/context/session-manager.ts +0 -10
- package/src/context/types.ts +0 -20
- package/src/core/CONTEXT.md +13 -7
- 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__/capabilities-reconcile.test.ts +1 -1
- package/src/core/constraints/__tests__/check-cache.test.ts +1 -8
- package/src/core/constraints/__tests__/collect-constraints.test.ts +67 -18
- 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__/run-env.test.ts +7 -7
- package/src/core/constraints/__tests__/trace-injection.test.ts +22 -17
- package/src/core/constraints/__tests__/usage-report.test.ts +9 -0
- package/src/core/constraints/capabilities-parser.ts +1 -1
- package/src/core/constraints/check-cache.ts +1 -1
- package/src/core/constraints/checker.ts +20 -1
- package/src/core/constraints/checkers/__tests__/fixtures/public-repo-sanitization.mjs +1 -1
- package/src/core/constraints/checkers/__tests__/governance-presence.test.ts +1 -1
- package/src/core/constraints/checkers/__tests__/input-contract.test.ts +3 -3
- package/src/core/constraints/checkers/__tests__/no-completion-without-verification.test.ts +227 -0
- package/src/core/constraints/checkers/__tests__/no-hardcoded-credentials.test.ts +68 -36
- package/src/core/constraints/checkers/capability-sync.ts +1 -1
- package/src/core/constraints/checkers/docs-freshness.ts +1 -1
- package/src/core/constraints/checkers/governance-presence.ts +1 -1
- package/src/core/constraints/checkers/index.ts +1 -3
- package/src/core/constraints/checkers/no-completion-without-verification.ts +141 -0
- package/src/core/constraints/checkers/no-hardcoded-credentials.ts +20 -7
- package/src/core/constraints/checkers/templated/file-exists.ts +1 -1
- package/src/core/constraints/checkers/templated/glob.ts +3 -36
- package/src/core/constraints/checkers/types.ts +1 -1
- package/src/core/constraints/construction-sites.ts +95 -0
- package/src/core/constraints/context-builder.ts +0 -18
- package/src/core/constraints/definitions/guidelines.ts +1 -1
- package/src/core/constraints/definitions/iron-laws.ts +2 -2
- package/src/core/constraints/definitions.ts +1 -1
- package/src/core/constraints/doc-freshness/__tests__/runner.test.ts +3 -3
- package/src/core/constraints/doc-freshness/runner.ts +4 -1
- package/src/core/constraints/index.ts +0 -5
- package/src/core/constraints/meta.ts +40 -0
- package/src/core/constraints/pack-proposal.ts +179 -0
- package/src/core/constraints/run-env.ts +6 -5
- package/src/core/constraints/usage-report.ts +5 -13
- package/src/core/effective-constraints.ts +7 -7
- package/src/core/index.ts +0 -16
- package/src/core/retired-constraints.ts +77 -0
- package/src/core/validators/__tests__/command-success-output.test.ts +56 -0
- package/src/core/validators/check-handlers/command.ts +44 -4
- package/src/core/validators/checkpoint.ts +4 -2
- package/src/core/validators/passes-gate.ts +4 -3
- package/src/gates/CONTEXT.md +22 -14
- package/src/gates/__tests__/acceptance-types-single-source.test.ts +7 -6
- package/src/gates/__tests__/acceptance.test.ts +3 -5
- package/src/gates/__tests__/checker-gate.test.ts +3 -3
- package/src/gates/__tests__/command.test.ts +1 -13
- package/src/gates/__tests__/decision.test.ts +35 -0
- package/src/gates/checker-gate.ts +4 -3
- package/src/gates/command.ts +4 -38
- package/src/gates/definitions.ts +2 -2
- package/src/gates/index.ts +8 -95
- package/src/gates/registry.ts +1 -1
- package/src/gates/types.ts +11 -3
- package/src/hooks/CONTEXT.md +3 -3
- package/src/index.ts +59 -98
- package/src/knowledge/CONTEXT.md +8 -6
- package/src/knowledge/__tests__/audit.test.ts +1 -1
- package/src/knowledge/__tests__/flywheel-metrics.test.ts +1 -1
- package/src/knowledge/__tests__/token-estimate.test.ts +54 -0
- package/src/knowledge/audit-scoring.ts +1 -1
- package/src/knowledge/index.ts +1 -3
- package/src/knowledge/query.ts +13 -14
- package/src/knowledge/token-estimate.ts +27 -0
- package/src/monitoring/CONTEXT.md +7 -9
- package/src/monitoring/__tests__/prune-trace-logs.test.ts +76 -0
- package/src/monitoring/__tests__/skipped-lines-report.test.ts +2 -2
- package/src/monitoring/__tests__/traces.test.ts +2 -18
- package/src/monitoring/analyzer-base.ts +0 -18
- package/src/monitoring/index.ts +2 -7
- package/src/monitoring/trace-analyzer.ts +2 -10
- package/src/monitoring/traces.ts +54 -54
- package/src/pretool-use-hook.ts +7 -7
- package/src/release/CONTEXT.md +4 -4
- package/src/release/__tests__/integrity.test.ts +3 -5
- package/src/release/integrity.ts +4 -6
- package/src/test-setup/__tests__/mkdtemp-cleanup.test.ts +1 -1
- package/src/test-setup/jsonl-fake-fs.ts +1 -1
- package/src/test-setup/mkdtemp-cleanup.ts +1 -1
- package/src/types/constraint.ts +1 -8
- package/src/types/passes-gate.ts +8 -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__/yaml-edit.test.ts +62 -0
- package/src/utils/detect-source-roots.ts +2 -20
- package/src/utils/glob-match.ts +41 -0
- package/src/utils/jsonl.ts +1 -1
- package/src/utils/yaml-edit.ts +67 -0
- package/bin/harness-knowledge-track.sh +0 -47
- package/bin/harness-sensitive-check.sh +0 -67
- 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/core/constraints/checkers/iron-flags.d.ts +0 -12
- package/dist/core/constraints/checkers/iron-flags.d.ts.map +0 -1
- package/dist/core/constraints/checkers/iron-flags.js +0 -16
- package/dist/core/constraints/checkers/iron-flags.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 -60
- 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 -55
- 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 -62
- 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 -125
- package/dist/tools/definitions/std/evolution/prioritize.yml +0 -112
- package/dist/tools/definitions/std/evolution/report-gap.yml +0 -166
- 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 -79
- package/dist/tools/definitions/std/governance/audit-task.yml +0 -178
- package/dist/tools/definitions/std/governance/cast-vote.yml +0 -129
- 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 -101
- package/dist/tools/definitions/std/governance/define-stance.sh +0 -243
- package/dist/tools/definitions/std/governance/define-stance.yml +0 -82
- package/dist/tools/definitions/std/governance/generate-review-report.yml +0 -23
- package/dist/tools/definitions/std/governance/impeach.yml +0 -179
- package/dist/tools/definitions/std/governance/multi-stance-review.yml +0 -154
- 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 -186
- package/dist/tools/definitions/std/governance/stance-review.yml +0 -149
- package/dist/tools/definitions/std/governance/track-effect.yml +0 -199
- package/dist/tools/definitions/std/governance/vote-tally.yml +0 -144
- 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 -481
- package/dist/tools/definitions/std/planning/split-tasks.yml +0 -359
- 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 +0 -51
- package/dist/tools/paths.js.map +0 -1
- package/src/__tests__/token-budget.test.ts +0 -252
- package/src/context/__tests__/token-budget.test.ts +0 -258
- package/src/context/token-budget.ts +0 -222
- package/src/core/constraints/checkers/__tests__/iron-flags.test.ts +0 -43
- package/src/core/constraints/checkers/iron-flags.ts +0 -17
- package/src/gates/__tests__/runner.test.ts +0 -81
- 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 -60
- 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 -55
- 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 -62
- 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 -125
- package/src/tools/definitions/std/evolution/prioritize.yml +0 -112
- package/src/tools/definitions/std/evolution/report-gap.yml +0 -166
- 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 -79
- package/src/tools/definitions/std/governance/audit-task.yml +0 -178
- package/src/tools/definitions/std/governance/cast-vote.yml +0 -129
- 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 -101
- package/src/tools/definitions/std/governance/define-stance.sh +0 -243
- package/src/tools/definitions/std/governance/define-stance.yml +0 -82
- package/src/tools/definitions/std/governance/generate-review-report.yml +0 -23
- package/src/tools/definitions/std/governance/impeach.yml +0 -179
- package/src/tools/definitions/std/governance/multi-stance-review.yml +0 -154
- 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 -186
- package/src/tools/definitions/std/governance/stance-review.yml +0 -149
- package/src/tools/definitions/std/governance/track-effect.yml +0 -199
- package/src/tools/definitions/std/governance/vote-tally.yml +0 -144
- 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 -481
- package/src/tools/definitions/std/planning/split-tasks.yml +0 -359
- 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
- package/templates/nextjs-app/.github/workflows/ci.yml +0 -39
- package/templates/node-api/.github/workflows/ci.yml +0 -36
- package/templates/node-api/package.json +0 -23
- package/templates/node-api/src/index.ts +0 -2
- package/templates/node-api/tsconfig.json +0 -19
- package/templates/python-api/.github/workflows/ci.yml +0 -39
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* sync-docs 的构造点计数标记判定接线测试(harness#202 / ADR-0039)
|
|
3
|
+
*
|
|
4
|
+
* 钉四件事:
|
|
5
|
+
* 1. 标记数字与实况不符时 `--check` 判 fail,reason 点名文件与类名;
|
|
6
|
+
* 2. 无标记的散文陈述不判(现有文档不受影响);
|
|
7
|
+
* 3. 写入模式对计数漂移只提示、不改写 CONTEXT.md;
|
|
8
|
+
* 4. `--json` 的 contentDrift 条目携带 constructionSites 明细。
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import * as fs from 'fs';
|
|
12
|
+
import * as path from 'path';
|
|
13
|
+
import * as os from 'os';
|
|
14
|
+
import { captureIO, type CapturingIO, type CommandResult } from '../../command-contract';
|
|
15
|
+
import { syncDocs } from '../sync-docs';
|
|
16
|
+
|
|
17
|
+
jest.mock('chalk', () => ({
|
|
18
|
+
blue: jest.fn((s: string) => s),
|
|
19
|
+
yellow: jest.fn((s: string) => s),
|
|
20
|
+
green: jest.fn((s: string) => s),
|
|
21
|
+
gray: jest.fn((s: string) => s),
|
|
22
|
+
red: jest.fn((s: string) => s),
|
|
23
|
+
cyan: jest.fn((s: string) => s),
|
|
24
|
+
bold: jest.fn((s: string) => s),
|
|
25
|
+
}));
|
|
26
|
+
|
|
27
|
+
function failReason(result: CommandResult): string {
|
|
28
|
+
if (result.kind !== 'fail' && result.kind !== 'usage-error') {
|
|
29
|
+
throw new Error(`期望 fail,实得 ${result.kind}`);
|
|
30
|
+
}
|
|
31
|
+
return result.reason;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
let tempDir: string;
|
|
35
|
+
let io: CapturingIO;
|
|
36
|
+
|
|
37
|
+
const CLEAN_DOC = [
|
|
38
|
+
'# mod/',
|
|
39
|
+
'',
|
|
40
|
+
'## 核心导出',
|
|
41
|
+
'- `Widget` — 主体',
|
|
42
|
+
'- `createWidget` — 工厂',
|
|
43
|
+
'- `WIDGET_KIND` — 常量',
|
|
44
|
+
'',
|
|
45
|
+
'## 约定',
|
|
46
|
+
'- 无',
|
|
47
|
+
'',
|
|
48
|
+
].join('\n');
|
|
49
|
+
|
|
50
|
+
const BARREL = "export { Widget, createWidget, WIDGET_KIND } from './impl';\n";
|
|
51
|
+
|
|
52
|
+
/** impl.ts 里恰有一处 `new Widget()` 直构造 */
|
|
53
|
+
const IMPL = [
|
|
54
|
+
'export class Widget {}',
|
|
55
|
+
'export function createWidget() { return new Widget(); }',
|
|
56
|
+
'export const WIDGET_KIND = "a";',
|
|
57
|
+
'',
|
|
58
|
+
].join('\n');
|
|
59
|
+
|
|
60
|
+
/** 带标记的项目:marker 追加在「约定」节 */
|
|
61
|
+
function makeMarkedProject(name: string, marker: string): string {
|
|
62
|
+
const projectPath = path.join(tempDir, name);
|
|
63
|
+
const modDir = path.join(projectPath, 'src', 'mod');
|
|
64
|
+
fs.mkdirSync(modDir, { recursive: true });
|
|
65
|
+
fs.writeFileSync(
|
|
66
|
+
path.join(projectPath, 'CAPABILITIES.md'),
|
|
67
|
+
'# Capabilities\n\n| 模块 | 文件 | 说明 |\n|------|------|------|\n| all | src/ | 全量记录 |\n'
|
|
68
|
+
);
|
|
69
|
+
fs.writeFileSync(path.join(modDir, 'CONTEXT.md'), CLEAN_DOC + marker + '\n');
|
|
70
|
+
fs.writeFileSync(path.join(modDir, 'index.ts'), BARREL);
|
|
71
|
+
fs.writeFileSync(path.join(modDir, 'impl.ts'), IMPL);
|
|
72
|
+
return projectPath;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
beforeEach(() => {
|
|
76
|
+
io = captureIO();
|
|
77
|
+
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'temp-test-sync-docs-sites-'));
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
afterEach(() => {
|
|
81
|
+
fs.rmSync(tempDir, { recursive: true, force: true });
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
describe('sync-docs — 构造点计数标记', () => {
|
|
85
|
+
it('标记数字与实况一致 → ok', async () => {
|
|
86
|
+
const projectPath = makeMarkedProject(
|
|
87
|
+
'match',
|
|
88
|
+
'<!-- sync-docs:construction-sites Widget = 1 -->'
|
|
89
|
+
);
|
|
90
|
+
await expect(syncDocs({ projectPath, check: true }, io)).resolves.toEqual({ kind: 'ok' });
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it('标记数字与实况不符 → --check fail 并点名文件与类名', async () => {
|
|
94
|
+
const projectPath = makeMarkedProject(
|
|
95
|
+
'mismatch',
|
|
96
|
+
'<!-- sync-docs:construction-sites Widget = 2 -->'
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
const result = await syncDocs({ projectPath, check: true }, io);
|
|
100
|
+
|
|
101
|
+
expect(failReason(result)).toContain('src/mod/CONTEXT.md');
|
|
102
|
+
expect(failReason(result)).toContain('Widget');
|
|
103
|
+
expect(io.outText()).toContain('Widget');
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it('无标记的构造点散文陈述不判', async () => {
|
|
107
|
+
const projectPath = makeMarkedProject('prose', '- 仓内构造点两处(无标记,纯散文)');
|
|
108
|
+
await expect(syncDocs({ projectPath, check: true }, io)).resolves.toEqual({ kind: 'ok' });
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it('写入模式对计数漂移只提示、不改写 CONTEXT.md、退出码面不变', async () => {
|
|
112
|
+
const projectPath = makeMarkedProject(
|
|
113
|
+
'write-mode',
|
|
114
|
+
'<!-- sync-docs:construction-sites Widget = 2 -->'
|
|
115
|
+
);
|
|
116
|
+
const contextPath = path.join(projectPath, 'src', 'mod', 'CONTEXT.md');
|
|
117
|
+
const before = fs.readFileSync(contextPath, 'utf-8');
|
|
118
|
+
|
|
119
|
+
const result = await syncDocs({ projectPath }, io);
|
|
120
|
+
|
|
121
|
+
expect(result.kind).toBe('ok');
|
|
122
|
+
expect(io.outText()).toContain('Widget');
|
|
123
|
+
expect(fs.readFileSync(contextPath, 'utf-8')).toBe(before);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it('--json 的 contentDrift 条目携带 constructionSites 明细', async () => {
|
|
127
|
+
const projectPath = makeMarkedProject(
|
|
128
|
+
'json',
|
|
129
|
+
'<!-- sync-docs:construction-sites Widget = 2 -->'
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
await syncDocs({ projectPath, check: true, json: true }, io);
|
|
133
|
+
|
|
134
|
+
const payload = JSON.parse(io.outText());
|
|
135
|
+
expect(payload.stale).toBe(true);
|
|
136
|
+
expect(payload.contentDrift).toEqual([
|
|
137
|
+
{
|
|
138
|
+
dir: 'src/mod',
|
|
139
|
+
file: 'src/mod/CONTEXT.md',
|
|
140
|
+
ghosts: [],
|
|
141
|
+
unlisted: [],
|
|
142
|
+
constructionSites: [{ className: 'Widget', expected: 2, actual: 1, includeTests: false }],
|
|
143
|
+
},
|
|
144
|
+
]);
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
it('默认口径不计测试目录;include: tests 计入', async () => {
|
|
148
|
+
const projectPath = makeMarkedProject(
|
|
149
|
+
'include-tests',
|
|
150
|
+
'<!-- sync-docs:construction-sites Widget = 2 include: tests -->'
|
|
151
|
+
);
|
|
152
|
+
fs.mkdirSync(path.join(projectPath, 'src', 'mod', '__tests__'));
|
|
153
|
+
fs.writeFileSync(
|
|
154
|
+
path.join(projectPath, 'src', 'mod', '__tests__', 'w.test.ts'),
|
|
155
|
+
'new Widget();\n'
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
// 带 include: tests 期望 2(impl + test)→ ok
|
|
159
|
+
await expect(syncDocs({ projectPath, check: true }, io)).resolves.toEqual({ kind: 'ok' });
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
it('同一棵树不带 include 的标记只数到生产构造点', async () => {
|
|
163
|
+
const projectPath = makeMarkedProject(
|
|
164
|
+
'exclude-tests',
|
|
165
|
+
'<!-- sync-docs:construction-sites Widget = 1 -->'
|
|
166
|
+
);
|
|
167
|
+
fs.mkdirSync(path.join(projectPath, 'src', 'mod', '__tests__'));
|
|
168
|
+
fs.writeFileSync(
|
|
169
|
+
path.join(projectPath, 'src', 'mod', '__tests__', 'w.test.ts'),
|
|
170
|
+
'new Widget();\n'
|
|
171
|
+
);
|
|
172
|
+
|
|
173
|
+
await expect(syncDocs({ projectPath, check: true }, io)).resolves.toEqual({ kind: 'ok' });
|
|
174
|
+
});
|
|
175
|
+
});
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* sync-docs --gate 测试(harness#189)
|
|
3
|
+
*
|
|
4
|
+
* 行为契约(票面锁定):
|
|
5
|
+
* 1. 照常先跑 sync-docs 自愈写入(幽灵条目剔除、file 模式自动补行不变);
|
|
6
|
+
* 2. 随后判定被管理文档相对 HEAD 是否产生 diff;
|
|
7
|
+
* 3. 有 diff 即 fail,输出点名缺登记文件(diff 新增行即名单);无 diff → ok。
|
|
8
|
+
* 自愈顺序不变:写入永远在校验之前(2026-08-08 CI 4 连红固化结论)。
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import * as fs from 'fs';
|
|
12
|
+
import * as path from 'path';
|
|
13
|
+
import * as os from 'os';
|
|
14
|
+
import { execFileSync } from 'child_process';
|
|
15
|
+
import { captureIO } from '../../command-contract';
|
|
16
|
+
import { syncDocs } from '../sync-docs';
|
|
17
|
+
|
|
18
|
+
function git(dir: string, args: string[]): string {
|
|
19
|
+
return execFileSync('git', ['-C', dir, ...args], { encoding: 'utf-8' });
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function commitAll(dir: string, msg: string): void {
|
|
23
|
+
git(dir, ['add', '-A']);
|
|
24
|
+
git(dir, [
|
|
25
|
+
'-c', 'user.name=test', '-c', 'user.email=test@example.com',
|
|
26
|
+
'commit', '-m', msg, '--no-gpg-sign',
|
|
27
|
+
]);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** 建最小 file 模式项目骨架(package.json + src/alpha.ts) */
|
|
31
|
+
function scaffoldProject(dir: string): void {
|
|
32
|
+
fs.mkdirSync(path.join(dir, 'src'), { recursive: true });
|
|
33
|
+
fs.writeFileSync(path.join(dir, 'package.json'), JSON.stringify({ name: 'gate-fixture', version: '0.0.1' }));
|
|
34
|
+
fs.writeFileSync(path.join(dir, 'src', 'alpha.ts'), '/**\n * Alpha module\n */\nexport const alpha = 1;');
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
describe('sync-docs --gate(harness#189)', () => {
|
|
38
|
+
let tempDir: string;
|
|
39
|
+
|
|
40
|
+
beforeEach(() => {
|
|
41
|
+
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'sync-docs-gate-'));
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
afterEach(() => {
|
|
45
|
+
try {
|
|
46
|
+
fs.rmSync(tempDir, { recursive: true, force: true });
|
|
47
|
+
} catch {
|
|
48
|
+
// ignore
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
/** 造一个 HEAD 文档干净的仓库:sync-docs 写入后提交 */
|
|
53
|
+
async function setupCleanRepo(): Promise<void> {
|
|
54
|
+
scaffoldProject(tempDir);
|
|
55
|
+
git(tempDir, ['init']);
|
|
56
|
+
await syncDocs({ projectPath: tempDir }, captureIO());
|
|
57
|
+
commitAll(tempDir, 'baseline');
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
it('file 模式漏登 → fail 且点名缺登记文件,自愈写入已落盘(写入在校验之前)', async () => {
|
|
61
|
+
await setupCleanRepo();
|
|
62
|
+
|
|
63
|
+
// 造漏登:新增已提交但未登记的源文件(开发者忘了跑 sync-docs)
|
|
64
|
+
fs.writeFileSync(path.join(tempDir, 'src', 'newmod.ts'), '/**\n * New module\n */\nexport const n = 1;');
|
|
65
|
+
commitAll(tempDir, 'add newmod without registering');
|
|
66
|
+
|
|
67
|
+
const io = captureIO();
|
|
68
|
+
const result = await syncDocs({ projectPath: tempDir, gate: true }, io);
|
|
69
|
+
|
|
70
|
+
expect(result.kind).toBe('fail');
|
|
71
|
+
// 输出点名缺登记文件(diff 新增行即名单)
|
|
72
|
+
expect(io.outText()).toContain('newmod');
|
|
73
|
+
if (result.kind === 'fail') {
|
|
74
|
+
expect(result.reason).toContain('newmod');
|
|
75
|
+
}
|
|
76
|
+
// 自愈顺序不变:判定失败时写入已落盘
|
|
77
|
+
expect(fs.readFileSync(path.join(tempDir, 'CAPABILITIES.md'), 'utf-8')).toContain('newmod');
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it('HEAD 文档干净(无需自愈)→ ok', async () => {
|
|
81
|
+
await setupCleanRepo();
|
|
82
|
+
|
|
83
|
+
const io = captureIO();
|
|
84
|
+
const result = await syncDocs({ projectPath: tempDir, gate: true }, io);
|
|
85
|
+
|
|
86
|
+
expect(result).toEqual({ kind: 'ok' });
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it('幽灵条目剔除也触发门:写入在校验之前', async () => {
|
|
90
|
+
await setupCleanRepo();
|
|
91
|
+
|
|
92
|
+
// 造幽灵条目:CAPABILITIES.md 登记了不存在的 src/ghost.ts 并提交
|
|
93
|
+
const capsPath = path.join(tempDir, 'CAPABILITIES.md');
|
|
94
|
+
const content = fs.readFileSync(capsPath, 'utf-8');
|
|
95
|
+
fs.writeFileSync(capsPath, content + '| ghost | src/ghost.ts | Ghost module |\n');
|
|
96
|
+
commitAll(tempDir, 'register ghost entry');
|
|
97
|
+
|
|
98
|
+
const io = captureIO();
|
|
99
|
+
const result = await syncDocs({ projectPath: tempDir, gate: true }, io);
|
|
100
|
+
|
|
101
|
+
expect(result.kind).toBe('fail');
|
|
102
|
+
expect(io.outText()).toContain('ghost');
|
|
103
|
+
// 自愈照做:幽灵行已被剔除
|
|
104
|
+
expect(fs.readFileSync(capsPath, 'utf-8')).not.toContain('ghost');
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it('sync-docs 查不出的未提交手改(描述改写)也是 vs HEAD 漂移 → fail', async () => {
|
|
108
|
+
await setupCleanRepo();
|
|
109
|
+
|
|
110
|
+
// 手改 CAPABILITIES.md 散文(不增删登记条目,sync-docs 判定面无漂移)且不提交
|
|
111
|
+
const capsPath = path.join(tempDir, 'CAPABILITIES.md');
|
|
112
|
+
const content = fs.readFileSync(capsPath, 'utf-8');
|
|
113
|
+
fs.writeFileSync(capsPath, content.replace('Alpha module', 'Alpha module v2'));
|
|
114
|
+
|
|
115
|
+
const io = captureIO();
|
|
116
|
+
const result = await syncDocs({ projectPath: tempDir, gate: true }, io);
|
|
117
|
+
|
|
118
|
+
expect(result.kind).toBe('fail');
|
|
119
|
+
expect(io.outText()).toContain('CAPABILITIES.md');
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
it('--agents 时 AGENTS.md 漂移(untracked 新建)也判 fail 并点名', async () => {
|
|
123
|
+
await setupCleanRepo();
|
|
124
|
+
|
|
125
|
+
const io = captureIO();
|
|
126
|
+
const result = await syncDocs({ projectPath: tempDir, gate: true, agents: true }, io);
|
|
127
|
+
|
|
128
|
+
expect(result.kind).toBe('fail');
|
|
129
|
+
expect(io.outText()).toContain('AGENTS.md');
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
it('非 git 仓库 → usage-error,且不做任何写入', async () => {
|
|
133
|
+
scaffoldProject(tempDir);
|
|
134
|
+
|
|
135
|
+
const io = captureIO();
|
|
136
|
+
const result = await syncDocs({ projectPath: tempDir, gate: true }, io);
|
|
137
|
+
|
|
138
|
+
expect(result.kind).toBe('usage-error');
|
|
139
|
+
expect(fs.existsSync(path.join(tempDir, 'CAPABILITIES.md'))).toBe(false);
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
it.each([
|
|
143
|
+
{ extra: { check: true }, label: '--check' },
|
|
144
|
+
{ extra: { json: true }, label: '--json' },
|
|
145
|
+
{ extra: { compact: true }, label: '--compact' },
|
|
146
|
+
])('--gate 与 $label 互斥 → usage-error', async ({ extra }) => {
|
|
147
|
+
await setupCleanRepo();
|
|
148
|
+
|
|
149
|
+
const io = captureIO();
|
|
150
|
+
const result = await syncDocs({ projectPath: tempDir, gate: true, ...extra }, io);
|
|
151
|
+
|
|
152
|
+
expect(result.kind).toBe('usage-error');
|
|
153
|
+
});
|
|
154
|
+
});
|
|
@@ -72,7 +72,7 @@ describe('sync-docs CAPABILITIES.md 表格排版(#171)', () => {
|
|
|
72
72
|
fs.rmSync(dir, { recursive: true, force: true });
|
|
73
73
|
});
|
|
74
74
|
|
|
75
|
-
it('
|
|
75
|
+
it('撤目录条目行(撤登记形状):同样整行删除', async () => {
|
|
76
76
|
const dir = makeProject(
|
|
77
77
|
'dir-entry',
|
|
78
78
|
['cli/cli.ts', 'harness/h.ts'],
|
|
@@ -171,7 +171,7 @@ describe('sync-docs command', () => {
|
|
|
171
171
|
it('描述以 / 结尾的表格行不应被误判为目录条目(check 必须收敛)', async () => {
|
|
172
172
|
// 回归:JSDoc 首行在 "gitRepo /" 处换行时,生成的描述单元格以 / 结尾,
|
|
173
173
|
// 旧目录条目正则将其误判为目录 → --check 永远报「包含已删除的模块」
|
|
174
|
-
// (2026-08-04
|
|
174
|
+
// (2026-08-04 CI Governance 不收敛事故)
|
|
175
175
|
const testDir = path.join(tempDir, 'trailing-slash-desc');
|
|
176
176
|
const srcDir = path.join(testDir, 'src');
|
|
177
177
|
fs.mkdirSync(srcDir, { recursive: true });
|
|
@@ -409,7 +409,7 @@ describe('sync-docs command', () => {
|
|
|
409
409
|
const testDir = path.join(tempDir, 'tsx-row');
|
|
410
410
|
const srcDir = path.join(testDir, 'src', 'components');
|
|
411
411
|
fs.mkdirSync(srcDir, { recursive: true });
|
|
412
|
-
//
|
|
412
|
+
// 复刻下游消费方场景:同目录混合 .ts 与 .tsx
|
|
413
413
|
fs.writeFileSync(path.join(srcDir, 'statusClasses.ts'), 'export const statuses = {};');
|
|
414
414
|
fs.writeFileSync(
|
|
415
415
|
path.join(srcDir, 'DistillProposalCard.tsx'),
|
|
@@ -504,7 +504,7 @@ describe('sync-docs command', () => {
|
|
|
504
504
|
fs.writeFileSync(path.join(srcA, 'routes.ts'), 'export const routes = 1;');
|
|
505
505
|
|
|
506
506
|
// CAPABILITIES.md 另有一条指向不存在路径的 routes.ts(basename 碰撞,
|
|
507
|
-
// 按 basename 对比时永远不可见 —— 2026-08-08
|
|
507
|
+
// 按 basename 对比时永远不可见 —— 2026-08-08 CI 4 连红事故)
|
|
508
508
|
fs.writeFileSync(
|
|
509
509
|
path.join(testDir, 'CAPABILITIES.md'),
|
|
510
510
|
[
|
|
@@ -104,6 +104,55 @@ describe('validate command', () => {
|
|
|
104
104
|
expect(result).toEqual({ kind: 'fail', reason: '1 个检查点未通过: test-1' });
|
|
105
105
|
});
|
|
106
106
|
|
|
107
|
+
it('失败原因与 message 不同时一并打出来(真因不被 message 吞)', async () => {
|
|
108
|
+
const mockCheckpoints = [
|
|
109
|
+
{ id: 'test-1', checks: [{ id: 'check-1', type: 'test' }] },
|
|
110
|
+
];
|
|
111
|
+
|
|
112
|
+
mockFs.readFile.mockResolvedValue('checkpoints content');
|
|
113
|
+
mockYaml.load.mockReturnValue({ checkpoints: mockCheckpoints });
|
|
114
|
+
|
|
115
|
+
const mockValidator = {
|
|
116
|
+
validate: jest.fn().mockResolvedValue({
|
|
117
|
+
passed: false,
|
|
118
|
+
checks: [{
|
|
119
|
+
checkId: 'check-1',
|
|
120
|
+
passed: false,
|
|
121
|
+
message: '命令执行失败: npm test(退出码 1)',
|
|
122
|
+
error: '输出末段:\nFAIL 某用例\nTests 1 failed',
|
|
123
|
+
}],
|
|
124
|
+
}),
|
|
125
|
+
};
|
|
126
|
+
(MockCheckpointValidator.getInstance as jest.Mock).mockReturnValue(mockValidator);
|
|
127
|
+
|
|
128
|
+
await validate({}, io);
|
|
129
|
+
|
|
130
|
+
expect(io.outText()).toContain('命令执行失败: npm test(退出码 1)');
|
|
131
|
+
expect(io.outText()).toContain('Tests 1 failed');
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
it('error 与 message 同文时不重复打', async () => {
|
|
135
|
+
const mockCheckpoints = [
|
|
136
|
+
{ id: 'test-1', checks: [{ id: 'check-1', type: 'test' }] },
|
|
137
|
+
];
|
|
138
|
+
|
|
139
|
+
mockFs.readFile.mockResolvedValue('checkpoints content');
|
|
140
|
+
mockYaml.load.mockReturnValue({ checkpoints: mockCheckpoints });
|
|
141
|
+
|
|
142
|
+
const mockValidator = {
|
|
143
|
+
validate: jest.fn().mockResolvedValue({
|
|
144
|
+
passed: false,
|
|
145
|
+
checks: [{ checkId: 'check-1', passed: false, message: '同一个原因', error: '同一个原因' }],
|
|
146
|
+
}),
|
|
147
|
+
};
|
|
148
|
+
(MockCheckpointValidator.getInstance as jest.Mock).mockReturnValue(mockValidator);
|
|
149
|
+
|
|
150
|
+
await validate({}, io);
|
|
151
|
+
|
|
152
|
+
const printed = io.outText().split('\n').filter(line => line.includes('同一个原因'));
|
|
153
|
+
expect(printed).toHaveLength(1);
|
|
154
|
+
});
|
|
155
|
+
|
|
107
156
|
it('应该在严格模式下退出', async () => {
|
|
108
157
|
const mockCheckpoints = [
|
|
109
158
|
{ id: 'test-1', checks: [{ id: 'check-1', type: 'test' }] },
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
* 退出码映射收敛在 bin 一处。
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import { createCommandGate, DEFAULT_COMMAND_BLACKLIST
|
|
13
|
+
import { createCommandGate, DEFAULT_COMMAND_BLACKLIST } from '../../gates/command';
|
|
14
|
+
import type { CommandBlacklistRule } from '../../gates/types';
|
|
14
15
|
import { log, logError, processIO, type CommandIO, type CommandResult } from '../command-contract';
|
|
15
16
|
import { gateCommandResult } from '../gate-command';
|
|
16
17
|
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* harness constraints disable —— 约束裸禁用(harness#190,ADR-0032 决策 6.6 的另一侧)
|
|
3
|
+
*
|
|
4
|
+
* 裸禁用 = config.yml `constraints.<id>.enabled:false`,无 retired 墓碑、无知识沉淀
|
|
5
|
+
* (墓碑与沉淀是 retire 专有语义)。与 retire 的分工:
|
|
6
|
+
*
|
|
7
|
+
* - disable:临时停用,幂等 already_disabled,不写沉淀;恢复 = 删 enabled 键
|
|
8
|
+
* - retire:永久退役,写 retired 墓碑 + `constraint-retired-<id>` 沉淀;
|
|
9
|
+
* 对裸 disabled 条目会接管补墓碑+沉淀(constraints-retire.ts 头部注释)
|
|
10
|
+
*
|
|
11
|
+
* 语义与下游消费方 applier 的 applyDisable 对齐(经下游裁定
|
|
12
|
+
* config.yml 归 harness,本命令是下游切换的落点):
|
|
13
|
+
* 只认内置 + 应用层(.harness/constraints.yml)check 约束(findRetireTarget 同路径,
|
|
14
|
+
* ADR-0033);写后验证生效集已缩小,失败回滚备份。
|
|
15
|
+
*
|
|
16
|
+
* retired 墓碑不接管不动:已退役条目返回 already_retired(要恢复请 reactivate)。
|
|
17
|
+
* 人确认闸门与 retire/reactivate 同形(ADR-0001 决策 2):直达必须显式 --yes,
|
|
18
|
+
* 不提供交互模式——禁用是低频点对点操作(同 reactivate 定位)。
|
|
19
|
+
*
|
|
20
|
+
* harness#198:纯执行逻辑(disableConstraint 与结果类型)已搬入
|
|
21
|
+
* `core/constraint-lifecycle` 并上公共 barrel(下游消费方改调库函数,
|
|
22
|
+
* 不再直写 config.yml);本模块是 CLI 薄壳——打印与人确认闸门。
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import { log, logError, processIO, type CommandIO, type CommandResult } from '../command-contract';
|
|
26
|
+
import chalk from 'chalk';
|
|
27
|
+
import { logCommitHint } from './constraints-retire';
|
|
28
|
+
import { disableConstraint, type DisableResult } from '../../core/constraint-lifecycle';
|
|
29
|
+
|
|
30
|
+
export { disableConstraint };
|
|
31
|
+
export type { DisableStatus, DisableResult } from '../../core/constraint-lifecycle';
|
|
32
|
+
|
|
33
|
+
export interface ConstraintsDisableOptions {
|
|
34
|
+
projectPath?: string;
|
|
35
|
+
/** 直达模式显式确认(--yes):与 retire/reactivate 同一道人确认闸门,无此 flag 直达拒绝执行 */
|
|
36
|
+
yes?: boolean;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* 打印单条禁用结果
|
|
41
|
+
*/
|
|
42
|
+
export function printDisableResult(result: DisableResult, io: CommandIO = processIO, projectRoot?: string): CommandResult {
|
|
43
|
+
switch (result.status) {
|
|
44
|
+
case 'unknown_id':
|
|
45
|
+
log(io, chalk.red(`❌ ${result.id}: 约束不存在(内置与应用层约束中都未找到),未做任何变更`));
|
|
46
|
+
return { kind: 'skip', reason: `${result.id}: 约束不存在,未做任何变更` };
|
|
47
|
+
case 'already_disabled':
|
|
48
|
+
log(io, chalk.yellow(`⚠️ ${result.id}: 已处于禁用状态(config.yml enabled:false 无墓碑),跳过`));
|
|
49
|
+
return { kind: 'skip', reason: `${result.id}: 已处于禁用状态,跳过` };
|
|
50
|
+
case 'already_retired':
|
|
51
|
+
log(io, chalk.yellow(`⚠️ ${result.id}: 已处于退役状态(有 retired 墓碑)——disable 不动墓碑,未做任何变更;要恢复请 harness constraints reactivate ${result.id} --yes`));
|
|
52
|
+
return { kind: 'skip', reason: `${result.id}: 已处于退役状态,未做任何变更` };
|
|
53
|
+
case 'verify_failed':
|
|
54
|
+
logError(io, chalk.red(`❌ ${result.id}: 禁用后约束仍在生效集,写后验证失败,已回滚 config.yml`));
|
|
55
|
+
return { kind: 'fail', reason: `${result.id}: disable 写后验证失败,已回滚 config.yml` };
|
|
56
|
+
case 'disabled': {
|
|
57
|
+
log(io, chalk.green(`✅ ${result.id}: 已禁用(config.yml enabled:false,无 retired 墓碑、无知识沉淀)`));
|
|
58
|
+
log(io, chalk.gray(` disable 是裸禁用不是退役——恢复:删 config.yml constraints.${result.id} 的 enabled 键;要永久退役走 harness constraints retire ${result.id}(会接管补墓碑+沉淀)`));
|
|
59
|
+
if (projectRoot) logCommitHint(projectRoot, io);
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return { kind: 'ok' };
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* CLI handler: harness constraints disable <id>
|
|
68
|
+
*
|
|
69
|
+
* 人确认闸门与 retire/reactivate 同形:直达必须显式 `--yes`,无 `--yes` 报错 +
|
|
70
|
+
* 非零退出码,不落盘任何文件。无交互模式(点对点操作,同 reactivate)。
|
|
71
|
+
*/
|
|
72
|
+
export async function constraintsDisable(
|
|
73
|
+
id?: string,
|
|
74
|
+
options: ConstraintsDisableOptions = {},
|
|
75
|
+
io: CommandIO = processIO,
|
|
76
|
+
): Promise<CommandResult> {
|
|
77
|
+
const projectRoot = options.projectPath || process.cwd();
|
|
78
|
+
|
|
79
|
+
if (!id) {
|
|
80
|
+
logError(io, chalk.red('❌ 用法:harness constraints disable <id> --yes(禁用是点对点操作,无交互模式)'));
|
|
81
|
+
return { kind: 'usage-error', reason: 'disable 缺少约束 id,未做任何变更' };
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (!options.yes) {
|
|
85
|
+
logError(io,
|
|
86
|
+
chalk.red(`❌ 直达禁用需要显式人确认(与 retire 同一闸门),未做任何变更\n`) +
|
|
87
|
+
` 带 --yes 显式确认直达:harness constraints disable ${id} --yes`
|
|
88
|
+
);
|
|
89
|
+
return { kind: 'usage-error', reason: `直达禁用 ${id} 缺少显式 --yes 人确认,未做任何变更` };
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const result = disableConstraint(projectRoot, id);
|
|
93
|
+
return printDisableResult(result, io, projectRoot);
|
|
94
|
+
}
|