@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
|
@@ -1,44 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 模板侧轻量 glob 匹配(支持 `**`、`*`、`?`,纯字符串判定,不碰文件系统)
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* 参数匹配不住 completion-checkers 的 commits 分类模块。
|
|
4
|
+
* glob→正则正本在 `utils/glob-match.ts`(与 completion-checkers 同一匹配语义,
|
|
5
|
+
* utils 下游白名单内,分层守卫(harness#88)不违)。
|
|
7
6
|
*/
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
return s.replace(/[.+^${}()|[\]\\]/g, '\\$&');
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/** glob → 锚定正则。前缀 `**` + `/` 匹配零或多段路径;`*` 不跨 `/`;`?` 匹配单个非 `/` 字符 */
|
|
14
|
-
function globToRegExp(glob: string): RegExp {
|
|
15
|
-
let re = '';
|
|
16
|
-
let i = 0;
|
|
17
|
-
while (i < glob.length) {
|
|
18
|
-
const c = glob[i];
|
|
19
|
-
if (c === '*') {
|
|
20
|
-
if (glob[i + 1] === '*') {
|
|
21
|
-
if (glob[i + 2] === '/') {
|
|
22
|
-
re += '(?:[^/]+/)*';
|
|
23
|
-
i += 3;
|
|
24
|
-
} else {
|
|
25
|
-
re += '.*';
|
|
26
|
-
i += 2;
|
|
27
|
-
}
|
|
28
|
-
} else {
|
|
29
|
-
re += '[^/]*';
|
|
30
|
-
i += 1;
|
|
31
|
-
}
|
|
32
|
-
} else if (c === '?') {
|
|
33
|
-
re += '[^/]';
|
|
34
|
-
i += 1;
|
|
35
|
-
} else {
|
|
36
|
-
re += escapeRegExp(c);
|
|
37
|
-
i += 1;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return new RegExp('^' + re + '$');
|
|
41
|
-
}
|
|
8
|
+
import { globToRegExp } from '../../../../utils/glob-match';
|
|
42
9
|
|
|
43
10
|
/** 单 glob 匹配(相对路径正斜杠口径) */
|
|
44
11
|
export function matchGlob(file: string, glob: string): boolean {
|
|
@@ -66,7 +66,7 @@ export type CheckEvidenceInput = 'stagedDiff' | 'stagedDiffNames';
|
|
|
66
66
|
* - runEnv = 本 run 的运行级观察面(ADR-0023):传入即与 context-builder 及
|
|
67
67
|
* 其余 checker 共用同一份上行数据读取;不传则自造一枚,只服务本次调用
|
|
68
68
|
*
|
|
69
|
-
*
|
|
69
|
+
* 下游消费方若需 git 证据,传真实 providers 即可。
|
|
70
70
|
*/
|
|
71
71
|
export function buildCheckEnv(
|
|
72
72
|
context: ConstraintContext,
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CONTEXT.md 构造点计数标记判定(harness#202 / ADR-0039)
|
|
3
|
+
*
|
|
4
|
+
* ADR-0025 的判定面只钉「核心导出」节符号面,散文机械不可判。本模块是
|
|
5
|
+
* 判定面的**标记化扩展**:文档在散文陈述旁附机器可读标记
|
|
6
|
+
* `<!-- sync-docs:construction-sites X = N -->`(可选 `include: tests`),
|
|
7
|
+
* 声明「类 X 的仓内直构造点恰为 N 处」;无标记的散文维持现状不判。
|
|
8
|
+
*
|
|
9
|
+
* 纯判定 module:标记解析、`new X(` 计数口径、期望/实际对撞全在此,
|
|
10
|
+
* 不吃 fs——文件遍历与正文读取在调用方(cli 侧 sync-docs/context-syncer),
|
|
11
|
+
* 与 context-reconcile 同一套「判定不吃 fs、清单由调用方组装」形状。
|
|
12
|
+
*
|
|
13
|
+
* 计数口径:
|
|
14
|
+
* - 只数 `new X(` 直构造(含一层泛型实参 `new Map<string, boolean>()`);
|
|
15
|
+
* 工厂封装调用点(`openKnowledgeStore()` 等)不算构造点。
|
|
16
|
+
* - 排除范围由采集侧按 DEFAULT_SKIP_DIRS 执行(node_modules/__tests__/dist),
|
|
17
|
+
* 标记带 `include: tests` 时测试目录计入。
|
|
18
|
+
* - 已知限度:正则解析源文本,嵌套泛型实参与字符串/注释里的 `new X(`
|
|
19
|
+
* 字面出现都会计入(登记在 ADR-0039,不掩盖)。
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/** 构造点标记:`<!-- sync-docs:construction-sites X = N -->`,可带 `include: tests` */
|
|
23
|
+
const MARKER_REGEX =
|
|
24
|
+
/<!--\s*sync-docs:construction-sites\s+([A-Za-z_$][\w$]*)\s*=\s*(\d+)(\s+include\s*:\s*tests)?\s*-->/g;
|
|
25
|
+
|
|
26
|
+
/** 直构造:`new X(` / `new X<T>(`(泛型实参只认一层,不嵌套) */
|
|
27
|
+
const CONSTRUCTION_REGEX = /new\s+([A-Za-z_$][\w$]*)\s*(?:<[^<>]*>)?\s*\(/g;
|
|
28
|
+
|
|
29
|
+
export interface ConstructionSiteMarker {
|
|
30
|
+
/** 被计数的类名 */
|
|
31
|
+
className: string;
|
|
32
|
+
/** 文档声明的期望构造点数 */
|
|
33
|
+
expected: number;
|
|
34
|
+
/** 是否把测试目录计入(标记带 `include: tests`) */
|
|
35
|
+
includeTests: boolean;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface ConstructionSiteDrift {
|
|
39
|
+
className: string;
|
|
40
|
+
expected: number;
|
|
41
|
+
/** 采集到的实际构造点数 */
|
|
42
|
+
actual: number;
|
|
43
|
+
includeTests: boolean;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* 解析文档中的构造点标记;无标记的散文与普通注释不判,
|
|
48
|
+
* 畸形标记(缺数字/缺类名/未知选项)整条跳过(不判优于误判)。
|
|
49
|
+
*/
|
|
50
|
+
export function parseConstructionSiteMarkers(content: string): ConstructionSiteMarker[] {
|
|
51
|
+
const markers: ConstructionSiteMarker[] = [];
|
|
52
|
+
for (const match of content.matchAll(MARKER_REGEX)) {
|
|
53
|
+
markers.push({
|
|
54
|
+
className: match[1],
|
|
55
|
+
expected: Number(match[2]),
|
|
56
|
+
includeTests: Boolean(match[3]),
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return markers;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* 单份源文本的直构造计数(口径正本):类名 → 出现次数。
|
|
64
|
+
* 采集侧逐文件调用后累加;测试与采集共用此函数,check/fix 口径必然一致。
|
|
65
|
+
*/
|
|
66
|
+
export function tallyConstructionSites(source: string): Map<string, number> {
|
|
67
|
+
const tally = new Map<string, number>();
|
|
68
|
+
for (const match of source.matchAll(CONSTRUCTION_REGEX)) {
|
|
69
|
+
tally.set(match[1], (tally.get(match[1]) ?? 0) + 1);
|
|
70
|
+
}
|
|
71
|
+
return tally;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* 标记与采集计数的对撞判定:期望 ≠ 实际即漂移,点名类名/期望/实际。
|
|
76
|
+
* countFor 由调用方组装(fs 采集在那侧),按标记的 includeTests 口径取数。
|
|
77
|
+
*/
|
|
78
|
+
export function reconcileConstructionSites(input: {
|
|
79
|
+
markers: ConstructionSiteMarker[];
|
|
80
|
+
countFor: (className: string, includeTests: boolean) => number;
|
|
81
|
+
}): { drift: ConstructionSiteDrift[] } {
|
|
82
|
+
const drift: ConstructionSiteDrift[] = [];
|
|
83
|
+
for (const marker of input.markers) {
|
|
84
|
+
const actual = input.countFor(marker.className, marker.includeTests);
|
|
85
|
+
if (actual !== marker.expected) {
|
|
86
|
+
drift.push({
|
|
87
|
+
className: marker.className,
|
|
88
|
+
expected: marker.expected,
|
|
89
|
+
actual,
|
|
90
|
+
includeTests: marker.includeTests,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return { drift };
|
|
95
|
+
}
|
|
@@ -124,23 +124,6 @@ export function detectRootCauseInvestigation(projectPath: string): boolean {
|
|
|
124
124
|
return false;
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
/** 验证证据的尾部窗口(工单 23 原口径:只看最近 10 条) */
|
|
128
|
-
const VERIFICATION_EVIDENCE_TAIL = 10;
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* 检测是否有验证证据(取运行级观察面的最近 10 条)
|
|
132
|
-
*/
|
|
133
|
-
async function detectVerificationEvidence(env: RunEnv): Promise<boolean> {
|
|
134
|
-
try {
|
|
135
|
-
// tail 在 parse 之前截断 → 坏行会占用尾部槽位(#82 裁决范围外的既有口径,本票不改)
|
|
136
|
-
return env
|
|
137
|
-
.traceTail(VERIFICATION_EVIDENCE_TAIL)
|
|
138
|
-
.records.some(trace => trace.result === 'pass');
|
|
139
|
-
} catch {
|
|
140
|
-
return false;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
127
|
/**
|
|
145
128
|
* 检测是否有需求来源
|
|
146
129
|
* 检查 CLAUDE.md、README.md、specs/、docs/specs/ 等
|
|
@@ -221,7 +204,6 @@ export async function buildConstraintContext(options: {
|
|
|
221
204
|
hasTest: changedFiles.some(f => f.includes('.test.') || f.includes('.spec.')),
|
|
222
205
|
hasFailingTest: await detectFailingTest(runEnv),
|
|
223
206
|
hasRootCauseInvestigation: detectRootCauseInvestigation(projectPath),
|
|
224
|
-
hasVerificationEvidence: await detectVerificationEvidence(runEnv),
|
|
225
207
|
hasReuseCheck: detectReuseCheck(projectPath),
|
|
226
208
|
hasRequirement: detectRequirement(projectPath),
|
|
227
209
|
};
|
|
@@ -20,11 +20,11 @@ export const ERROR_CONSTRAINTS: Record<string, Constraint> = {
|
|
|
20
20
|
kind: 'check',
|
|
21
21
|
channel: 'gate',
|
|
22
22
|
rule: 'NO COMPLETION CLAIMS WITHOUT FRESH VERIFICATION EVIDENCE',
|
|
23
|
-
message: '
|
|
23
|
+
message: '禁止无验证声明完成,必须有晚于最新变更的验证证据(.harness/evidence)',
|
|
24
24
|
severity: 'error',
|
|
25
25
|
trigger: 'code_implementation',
|
|
26
26
|
enforcement: 'verify-completion',
|
|
27
|
-
description: '
|
|
27
|
+
description: '在声明任何任务完成之前,必须真实运行项目声明的测试等验证命令,输出落盘 .harness/evidence/(harness passes-gate 运行或外部验证事件写入)作为完成证据;证据须晚于最新变更,缺失或过期即违规。验证命令集由项目自行声明,全量验证留给 CI 流程。',
|
|
28
28
|
},
|
|
29
29
|
|
|
30
30
|
/**
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* 纯文本提示层(prompts.ts)已随文本注入层关停整体删除。
|
|
7
7
|
*
|
|
8
8
|
* 工单 20:字面量定义按 severity 分组放 ./definitions/{iron-laws,guidelines}.ts;
|
|
9
|
-
*
|
|
9
|
+
* 本文件保持原路径做薄聚合。
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import type { Constraint, ConstraintTrigger } from '../../types/constraint';
|
|
@@ -278,11 +278,11 @@ describe('FreshnessRunner', () => {
|
|
|
278
278
|
'CLAUDE.md': [
|
|
279
279
|
'## Key Architecture Paths',
|
|
280
280
|
'',
|
|
281
|
-
'| `packages/
|
|
281
|
+
'| `packages/pkg-a/src/` | Shared |',
|
|
282
282
|
].join('\n'),
|
|
283
283
|
});
|
|
284
|
-
mkdirSync(join(TEST_ROOT, 'dirdir-skip-reverse', 'packages', '
|
|
285
|
-
mkdirSync(join(TEST_ROOT, 'dirdir-skip-reverse', 'packages', '
|
|
284
|
+
mkdirSync(join(TEST_ROOT, 'dirdir-skip-reverse', 'packages', 'pkg-a', 'src'), { recursive: true });
|
|
285
|
+
mkdirSync(join(TEST_ROOT, 'dirdir-skip-reverse', 'packages', 'pkg-b', 'src'), { recursive: true });
|
|
286
286
|
|
|
287
287
|
const config: DocFreshnessConfig = {
|
|
288
288
|
checks: [{
|
|
@@ -469,6 +469,9 @@ export class FreshnessRunner {
|
|
|
469
469
|
|
|
470
470
|
const entries = readdirSync(searchDir, { withFileTypes: true });
|
|
471
471
|
|
|
472
|
+
// 正则提出循环:String.match 带 g flag 时不携带 lastIndex 状态(每次调用内部归零),复用安全
|
|
473
|
+
const matchRe = new RegExp(pattern, 'g');
|
|
474
|
+
|
|
472
475
|
let count = 0;
|
|
473
476
|
for (const entry of entries) {
|
|
474
477
|
if (!entry.isFile()) continue;
|
|
@@ -476,7 +479,7 @@ export class FreshnessRunner {
|
|
|
476
479
|
|
|
477
480
|
try {
|
|
478
481
|
const content = readFileSync(join(searchDir, entry.name), 'utf-8');
|
|
479
|
-
const matches = content.match(
|
|
482
|
+
const matches = content.match(matchRe);
|
|
480
483
|
if (matches) {
|
|
481
484
|
count += matches.length;
|
|
482
485
|
}
|
|
@@ -20,10 +20,6 @@ export {
|
|
|
20
20
|
} from './checker';
|
|
21
21
|
export type { CheckConstraintsOptions, TraceRecorder } from './checker';
|
|
22
22
|
|
|
23
|
-
// 约束检查缓存(H6/G5:TTL 缓存 + 计数采样,公开导出)
|
|
24
|
-
export { CheckCache } from './check-cache';
|
|
25
|
-
export type { CheckCacheConfig, CheckSamplingConfig } from './check-cache';
|
|
26
|
-
|
|
27
23
|
// 检查器原语 SDK(harness#181,ADR-0035 决策 3 第二半:只导出存量——现有 checker 真实在用的件)
|
|
28
24
|
export {
|
|
29
25
|
buildCheckEnv,
|
|
@@ -56,7 +52,6 @@ export type {
|
|
|
56
52
|
ConstraintResult,
|
|
57
53
|
ConstraintContext,
|
|
58
54
|
ConstraintCheckResult,
|
|
59
|
-
IronLawContext,
|
|
60
55
|
} from '../../types/constraint';
|
|
61
56
|
|
|
62
57
|
export { ConstraintViolationError } from '../../types/constraint';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 约束集合元数据(库面,harness#198)
|
|
3
|
+
*
|
|
4
|
+
* `harness constraints --json` 背后的元数据函数:version/hash/counts。
|
|
5
|
+
* 纯数据导出,不调用 LLM,不访问文件系统(除 definitions.ts)。
|
|
6
|
+
* 下游消费方经公共 barrel 直接调用,免起 `npx harness constraints --json`
|
|
7
|
+
* 子进程。CLI 命令是调用本函数的薄壳。
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { createHash } from 'crypto';
|
|
11
|
+
import { getAllConstraints } from './definitions';
|
|
12
|
+
import { getHarnessPackageVersion } from '../../utils/package-version';
|
|
13
|
+
|
|
14
|
+
export interface ConstraintsMeta {
|
|
15
|
+
version: string;
|
|
16
|
+
hash: string;
|
|
17
|
+
counts: { errors: number; warnings: number };
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function getConstraintsMeta(): ConstraintsMeta {
|
|
21
|
+
const constraints = getAllConstraints();
|
|
22
|
+
|
|
23
|
+
const errors = constraints.filter(c => c.severity === 'error');
|
|
24
|
+
const warnings = constraints.filter(c => c.severity === 'warning');
|
|
25
|
+
|
|
26
|
+
// 稳定 JSON 序列化后取 hash(内容面 = id + severity + 规则文本)
|
|
27
|
+
const hashInput = JSON.stringify(
|
|
28
|
+
constraints.map(c => ({ id: c.id, severity: c.severity, rule: c.rule, message: c.message, description: c.description }))
|
|
29
|
+
);
|
|
30
|
+
const hash = createHash('sha256').update(hashInput).digest('hex');
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
version: getHarnessPackageVersion(),
|
|
34
|
+
hash,
|
|
35
|
+
counts: {
|
|
36
|
+
errors: errors.length,
|
|
37
|
+
warnings: warnings.length,
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 约束升级提案材料打包(库面,harness#198;ADR-0033 决策 4,块 3 子项 5)
|
|
3
|
+
*
|
|
4
|
+
* 升级通道链路:下游审卡发起/初审 → approve 后打包脱敏材料 → 人拿材料去 harness 仓
|
|
5
|
+
* 开 issue(github 操作留给人,本模块不触网)。
|
|
6
|
+
*
|
|
7
|
+
* `packProposal` 执行产物生成并返回结构化 `{ materialPath, content }`——消费方不再按
|
|
8
|
+
* 命名约定反猜产物路径:命名规律(`.harness/reports/proposal-<id>-<yyyymmdd>.md`)
|
|
9
|
+
* 的单一来源是本模块的 `proposalMaterialPath`。
|
|
10
|
+
*
|
|
11
|
+
* 材料内容:条文 + severity + checker 模板与参数 + traces.log 使用统计(只有计数)
|
|
12
|
+
* + 升级理由留白段。
|
|
13
|
+
*
|
|
14
|
+
* 脱敏口径(工具做路径脱敏,内容脱敏归人):
|
|
15
|
+
* - 项目根绝对路径一律替换为 `<repoRoot>`;
|
|
16
|
+
* - 统计只有计数与首末次日期,不带样本内容;
|
|
17
|
+
* - 应用层约束的 params(正则/glob)**原文带出**并标注"请人工确认无应用内部信息"——
|
|
18
|
+
* 打包工具是质量前置,不是保密闸门。
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import * as fs from 'fs';
|
|
22
|
+
import * as path from 'path';
|
|
23
|
+
import * as yaml from 'js-yaml';
|
|
24
|
+
import { getConstraint } from './definitions';
|
|
25
|
+
import { loadAppConstraints } from '../app-constraints-loader';
|
|
26
|
+
import { collectUsageByConstraint, readProjectTraces } from './usage-report';
|
|
27
|
+
import type { Constraint } from '../../types/constraint';
|
|
28
|
+
|
|
29
|
+
/** 提案材料的输入(查找结果 + 使用统计聚合) */
|
|
30
|
+
export interface ProposalMaterial {
|
|
31
|
+
constraint: Constraint;
|
|
32
|
+
stats: {
|
|
33
|
+
total: number;
|
|
34
|
+
pass: number;
|
|
35
|
+
fail: number;
|
|
36
|
+
skip: number;
|
|
37
|
+
evaluated: number;
|
|
38
|
+
firstAt?: number;
|
|
39
|
+
lastAt?: number;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** packProposal 的结构化返回:产物路径(命名规律单一来源算出)+ 材料全文 */
|
|
44
|
+
export interface PackProposalResult {
|
|
45
|
+
materialPath: string;
|
|
46
|
+
content: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* 查找约束定义(内置 + 应用层,与 findRetireTarget 同口径但带全量字段——
|
|
51
|
+
* checker/params 是提案材料的核心内容,RetireTargetInfo 不带)
|
|
52
|
+
*/
|
|
53
|
+
function findProposalTarget(id: string, projectRoot: string): Constraint | undefined {
|
|
54
|
+
const builtIn = getConstraint(id);
|
|
55
|
+
if (builtIn) return builtIn;
|
|
56
|
+
return loadAppConstraints(projectRoot).find(c => c.id === id);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function formatDate(ts: number | undefined): string {
|
|
60
|
+
return ts === undefined ? '(无记录)' : new Date(ts).toISOString().slice(0, 10);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* 渲染脱敏提案材料 markdown(纯函数)
|
|
65
|
+
*
|
|
66
|
+
* @param projectRoot 用于路径脱敏(材料中出现的项目根绝对路径替换为 `<repoRoot>`)
|
|
67
|
+
*/
|
|
68
|
+
export function renderProposalMarkdown(
|
|
69
|
+
material: ProposalMaterial,
|
|
70
|
+
projectRoot: string,
|
|
71
|
+
now: Date = new Date()
|
|
72
|
+
): string {
|
|
73
|
+
const c = material.constraint;
|
|
74
|
+
const s = material.stats;
|
|
75
|
+
const isApp = c.source === 'app';
|
|
76
|
+
|
|
77
|
+
const lines: string[] = [];
|
|
78
|
+
lines.push(`# 约束升级提案材料:${c.id}`);
|
|
79
|
+
lines.push('');
|
|
80
|
+
lines.push(`- 生成日期: ${now.toISOString().slice(0, 10)}`);
|
|
81
|
+
lines.push(`- 来源: ${isApp ? '应用层(.harness/constraints.yml)' : '内置'}`);
|
|
82
|
+
lines.push(`- severity: ${c.severity}`);
|
|
83
|
+
lines.push('');
|
|
84
|
+
|
|
85
|
+
lines.push('## 条文');
|
|
86
|
+
lines.push('');
|
|
87
|
+
lines.push(`rule: ${c.rule}`);
|
|
88
|
+
if (c.message && c.message !== c.rule) lines.push(`message: ${c.message}`);
|
|
89
|
+
if (c.description) lines.push(`description: ${c.description}`);
|
|
90
|
+
lines.push('');
|
|
91
|
+
|
|
92
|
+
lines.push('## checker');
|
|
93
|
+
lines.push('');
|
|
94
|
+
if (isApp) {
|
|
95
|
+
lines.push(`模板: \`${c.checker}\``);
|
|
96
|
+
lines.push('');
|
|
97
|
+
lines.push('参数(原文带出,**请人工确认无应用内部信息**——工具只做路径脱敏,内容脱敏归人):');
|
|
98
|
+
lines.push('');
|
|
99
|
+
lines.push('```yaml');
|
|
100
|
+
lines.push(yaml.dump(c.params ?? {}, { lineWidth: 120 }).trimEnd());
|
|
101
|
+
lines.push('```');
|
|
102
|
+
} else {
|
|
103
|
+
lines.push('内置定制 checker(按约束 id 注册,非参数化模板)。升级到通用层前需评审:');
|
|
104
|
+
lines.push('改写为模板 + 参数,或作为通用规则保留定制实现。');
|
|
105
|
+
}
|
|
106
|
+
lines.push('');
|
|
107
|
+
|
|
108
|
+
lines.push('## 使用统计(traces.log 聚合,只有计数)');
|
|
109
|
+
lines.push('');
|
|
110
|
+
lines.push(`- total: ${s.total}`);
|
|
111
|
+
lines.push(`- evaluated: ${s.evaluated}(pass ${s.pass} / fail ${s.fail} / skip ${s.skip})`);
|
|
112
|
+
lines.push(`- 首次触发: ${formatDate(s.firstAt)}`);
|
|
113
|
+
lines.push(`- 最近触发: ${formatDate(s.lastAt)}`);
|
|
114
|
+
lines.push('');
|
|
115
|
+
|
|
116
|
+
lines.push('## 升级理由');
|
|
117
|
+
lines.push('');
|
|
118
|
+
lines.push('> (请在此填写:为什么这条约束该进通用层——适用面、证据、与其他仓的相关性)');
|
|
119
|
+
lines.push('');
|
|
120
|
+
|
|
121
|
+
// 路径脱敏:项目根绝对路径一律替换
|
|
122
|
+
return lines.join('\n').split(projectRoot).join('<repoRoot>');
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* 收集提案材料(定义查找 + traces 使用统计聚合);未知 id → undefined
|
|
127
|
+
*
|
|
128
|
+
* 与 renderProposalMarkdown 组合 = 不落盘的渲染通道(CLI --stdout);
|
|
129
|
+
* 要落盘产物走 packProposal。
|
|
130
|
+
*/
|
|
131
|
+
export function collectProposalMaterial(projectRoot: string, id: string): ProposalMaterial | undefined {
|
|
132
|
+
const constraint = findProposalTarget(id, projectRoot);
|
|
133
|
+
if (!constraint) return undefined;
|
|
134
|
+
|
|
135
|
+
const usage = collectUsageByConstraint(readProjectTraces(projectRoot)).get(id);
|
|
136
|
+
return {
|
|
137
|
+
constraint,
|
|
138
|
+
stats: {
|
|
139
|
+
total: usage?.total ?? 0,
|
|
140
|
+
pass: usage?.pass ?? 0,
|
|
141
|
+
fail: usage?.fail ?? 0,
|
|
142
|
+
skip: usage?.skip ?? 0,
|
|
143
|
+
evaluated: (usage?.total ?? 0) - (usage?.skip ?? 0),
|
|
144
|
+
firstAt: usage?.firstAt,
|
|
145
|
+
lastAt: usage?.lastAt,
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* 提案产物路径(命名规律单一来源):`.harness/reports/proposal-<id>-<yyyymmdd>.md`
|
|
152
|
+
*
|
|
153
|
+
* 消费方拿产物路径一律经本函数(或 packProposal 的返回),不在库外拼字符串。
|
|
154
|
+
*/
|
|
155
|
+
export function proposalMaterialPath(projectRoot: string, id: string, now: Date = new Date()): string {
|
|
156
|
+
const date = now.toISOString().slice(0, 10).replace(/-/g, '');
|
|
157
|
+
return path.join(projectRoot, '.harness', 'reports', `proposal-${id}-${date}.md`);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* 执行提案材料打包:渲染脱敏材料、落盘产物,返回 `{ materialPath, content }`
|
|
162
|
+
*
|
|
163
|
+
* 未知 id → undefined(不落盘),由调用方提示。
|
|
164
|
+
*/
|
|
165
|
+
export function packProposal(
|
|
166
|
+
projectRoot: string,
|
|
167
|
+
id: string,
|
|
168
|
+
options: { now?: Date } = {}
|
|
169
|
+
): PackProposalResult | undefined {
|
|
170
|
+
const material = collectProposalMaterial(projectRoot, id);
|
|
171
|
+
if (!material) return undefined;
|
|
172
|
+
|
|
173
|
+
const now = options.now ?? new Date();
|
|
174
|
+
const content = renderProposalMarkdown(material, projectRoot, now);
|
|
175
|
+
const materialPath = proposalMaterialPath(projectRoot, id, now);
|
|
176
|
+
fs.mkdirSync(path.dirname(materialPath), { recursive: true });
|
|
177
|
+
fs.writeFileSync(materialPath, content, 'utf-8');
|
|
178
|
+
return { materialPath, content };
|
|
179
|
+
}
|
|
@@ -30,7 +30,8 @@ export const CAPABILITIES_FILE_REL = 'CAPABILITIES.md';
|
|
|
30
30
|
/**
|
|
31
31
|
* 尾部窗口上限 = 本 run 内最大的尾部消费方(有无失败记录看 20 条,见 context-builder)
|
|
32
32
|
*
|
|
33
|
-
*
|
|
33
|
+
* harness#183 起验证证据不再读 trace(语义循环拆除,改读 .harness/evidence),
|
|
34
|
+
* trace 尾部只剩 hasFailingTest 一个消费方。
|
|
34
35
|
*/
|
|
35
36
|
const TRACE_TAIL_WINDOW = 20;
|
|
36
37
|
|
|
@@ -52,7 +53,7 @@ export interface RunEnv {
|
|
|
52
53
|
* `CAPABILITIES.md` 的读取 + 解析 + 与代码实况的对照判定(ADR-0023 决策 4)
|
|
53
54
|
*
|
|
54
55
|
* 此前 capability_sync 与 docs_freshness 各读一遍文档、各跑一遍 `reconcileCapabilities`
|
|
55
|
-
*
|
|
56
|
+
* (下游消费方量得单次 7.6–15.9ms,两边解析输入逐字节相同)。此处一次供给两消费方。
|
|
56
57
|
* 文档缺失 → `undefined`(消费方据此 skip / 无幽灵)。
|
|
57
58
|
*
|
|
58
59
|
* **memo 只记第一次传入的 `populationFiles`**:同一 run 内两消费方必须给同一份代码实况清单。
|
|
@@ -95,9 +96,9 @@ export function createRunEnv(projectPath: string): RunEnv {
|
|
|
95
96
|
projectPath,
|
|
96
97
|
traceTail(limit: number) {
|
|
97
98
|
if (!window) {
|
|
98
|
-
// 计数去向:豁免(harness#100)——本观察面只供给「最近有无 fail
|
|
99
|
-
//
|
|
100
|
-
//
|
|
99
|
+
// 计数去向:豁免(harness#100)——本观察面只供给「最近有无 fail」一个布尔证据
|
|
100
|
+
// 消费方,不读 skippedLines;坏行占尾部槽位只会让证据变少(方向保守),
|
|
101
|
+
// 告知需要改判定形状,属行为变更不在本票
|
|
101
102
|
window = readJsonlWindow<ExecutionTrace>(traceFile, 'skip', TRACE_TAIL_WINDOW);
|
|
102
103
|
}
|
|
103
104
|
return window.take(limit);
|
|
@@ -19,14 +19,6 @@ import { readJsonl } from '../../utils/jsonl';
|
|
|
19
19
|
import { getEffectiveConstraints, lintEffectiveConfig } from '../effective-constraints';
|
|
20
20
|
import type { EffectiveConfigLint } from '../effective-constraints';
|
|
21
21
|
|
|
22
|
-
/**
|
|
23
|
-
* flag 型 check 约束(证据来自 ConstraintContext flag,见 checkers/iron-flags.ts)。
|
|
24
|
-
* 全部 skip 时标注"证据 flag 未接线"(区别于存在性探测的"约定未采用")。
|
|
25
|
-
*/
|
|
26
|
-
export const FLAG_EVIDENCE_CONSTRAINT_IDS: ReadonlySet<string> = new Set([
|
|
27
|
-
'no_completion_without_verification',
|
|
28
|
-
]);
|
|
29
|
-
|
|
30
22
|
/**
|
|
31
23
|
* 单条 check 约束的使用统计
|
|
32
24
|
*/
|
|
@@ -271,14 +263,12 @@ function diagnose(
|
|
|
271
263
|
}
|
|
272
264
|
|
|
273
265
|
if (s.skip === s.total) {
|
|
274
|
-
|
|
275
|
-
? '证据 flag 未接线'
|
|
276
|
-
: '约定未采用(存在性探测未命中)';
|
|
266
|
+
// harness#183 起无 flag 型约束:全 skip = 约定未采用(存在性探测未命中)或证据不可用
|
|
277
267
|
candidates.push({
|
|
278
268
|
id: s.id,
|
|
279
269
|
kind: 'unevaluable',
|
|
280
270
|
stats: s,
|
|
281
|
-
reason: `不可评估:全部 ${s.total} 次均为 skip
|
|
271
|
+
reason: `不可评估:全部 ${s.total} 次均为 skip(约定未采用或证据不可用)`,
|
|
282
272
|
});
|
|
283
273
|
continue;
|
|
284
274
|
}
|
|
@@ -349,9 +339,11 @@ export function diagnoseRetireCandidates(
|
|
|
349
339
|
|
|
350
340
|
/**
|
|
351
341
|
* 构建 report 数据模型(只读;观察名单状态以快照入、以 nextWatchlist 出,不写盘)
|
|
342
|
+
*
|
|
343
|
+
* @param projectRoot 项目根路径(必传,无 cwd 缺省——harness#201)
|
|
352
344
|
*/
|
|
353
345
|
export function buildConstraintsUsageReport(
|
|
354
|
-
projectRoot: string
|
|
346
|
+
projectRoot: string,
|
|
355
347
|
thresholds: Partial<DiagnoseThresholds> = {},
|
|
356
348
|
watch: DiagnoseWatchOptions = {}
|
|
357
349
|
): ConstraintsUsageReport {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* `getEffectiveConstraints(projectRoot)` 是全仓唯一的生效集来源:
|
|
5
5
|
* 内置 → preset → config.yml 禁用。
|
|
6
|
-
* `harness check
|
|
6
|
+
* `harness check`、外部消费者全部消费它,
|
|
7
7
|
* 不再直接读 CONSTRAINTS 全集。
|
|
8
8
|
*/
|
|
9
9
|
|
|
@@ -18,13 +18,13 @@ import type { RunTarget } from './constraints/run-env';
|
|
|
18
18
|
* 生效集链路同 getMergedConstraintsConfig:内置 → preset 裁剪 → config.yml
|
|
19
19
|
* `constraints.<id>.enabled:false` 删除。
|
|
20
20
|
*
|
|
21
|
-
* @param target 项目根路径,或本 run
|
|
21
|
+
* @param target 项目根路径,或本 run 的运行级观察面(必传,无 cwd 缺省——harness#201)
|
|
22
22
|
* 传观察面 = config.yml 读取与本 run 其余消费方共用同一份(ADR-0023 决策 2)
|
|
23
23
|
* @param options.preset 覆盖 config.yml 的 preset;仅在项目无自定义配置时生效
|
|
24
24
|
* (与 getMergedConstraintsConfig 同一优先级规则),不传则尊重 config.yml
|
|
25
25
|
*/
|
|
26
26
|
export function getEffectiveConstraints(
|
|
27
|
-
target: RunTarget
|
|
27
|
+
target: RunTarget,
|
|
28
28
|
options?: { preset?: string }
|
|
29
29
|
): Constraint[] {
|
|
30
30
|
return constraintsFromMerged(getMergedConstraintsConfig(target, options));
|
|
@@ -50,10 +50,10 @@ export function constraintsFromMerged(merged: MergedConstraintsConfig): Constrai
|
|
|
50
50
|
* preset(工单 23 语义:项目自定义配置优先于 CLI 预设);不传 preset 时
|
|
51
51
|
* 完全尊重 config.yml 的 preset 键。
|
|
52
52
|
*
|
|
53
|
-
* @param target 项目根路径,或本 run
|
|
53
|
+
* @param target 项目根路径,或本 run 的运行级观察面(必传,无 cwd 缺省——harness#201)
|
|
54
54
|
*/
|
|
55
55
|
export function getMergedConstraintsConfig(
|
|
56
|
-
target: RunTarget
|
|
56
|
+
target: RunTarget,
|
|
57
57
|
options?: { preset?: string }
|
|
58
58
|
): MergedConstraintsConfig {
|
|
59
59
|
const loader = new ProjectConfigLoader(target);
|
|
@@ -81,9 +81,9 @@ export interface EffectiveConfigLint {
|
|
|
81
81
|
*
|
|
82
82
|
* 不抛错、不修改任何文件,供 report / check 的诊断输出使用。
|
|
83
83
|
*
|
|
84
|
-
* @param projectRoot
|
|
84
|
+
* @param projectRoot 项目根路径(必传,无 cwd 缺省——harness#201)
|
|
85
85
|
*/
|
|
86
|
-
export function lintEffectiveConfig(projectRoot: string
|
|
86
|
+
export function lintEffectiveConfig(projectRoot: string): EffectiveConfigLint {
|
|
87
87
|
const loader = new ProjectConfigLoader(projectRoot);
|
|
88
88
|
loader.load();
|
|
89
89
|
const merged = loader.mergeConstraints();
|
package/src/core/index.ts
CHANGED
|
@@ -16,7 +16,6 @@ export {
|
|
|
16
16
|
checkConstraints,
|
|
17
17
|
checkBeforeExecution,
|
|
18
18
|
constraintChecker,
|
|
19
|
-
CheckCache,
|
|
20
19
|
ConstraintViolationError,
|
|
21
20
|
buildCheckEnv,
|
|
22
21
|
normalizeCheckOutcome,
|
|
@@ -26,8 +25,6 @@ export {
|
|
|
26
25
|
} from './constraints';
|
|
27
26
|
export type {
|
|
28
27
|
CheckConstraintsOptions,
|
|
29
|
-
CheckCacheConfig,
|
|
30
|
-
CheckSamplingConfig,
|
|
31
28
|
ConstraintId,
|
|
32
29
|
ConstraintKind,
|
|
33
30
|
ConstraintChannel,
|
|
@@ -37,7 +34,6 @@ export type {
|
|
|
37
34
|
ConstraintResult,
|
|
38
35
|
ConstraintContext,
|
|
39
36
|
ConstraintCheckResult,
|
|
40
|
-
IronLawContext,
|
|
41
37
|
ConstraintCheck,
|
|
42
38
|
CheckEnv,
|
|
43
39
|
CheckOutcome,
|
|
@@ -71,16 +67,6 @@ export type {
|
|
|
71
67
|
TaskTestResult,
|
|
72
68
|
} from './validators';
|
|
73
69
|
|
|
74
|
-
// Spec 验证器
|
|
75
|
-
export { SpecValidator } from './spec/validator';
|
|
76
|
-
export type {
|
|
77
|
-
SpecValidatorConfig,
|
|
78
|
-
SpecValidationResult,
|
|
79
|
-
BatchSpecValidationResult,
|
|
80
|
-
SpecSchemaDefinition,
|
|
81
|
-
SpecType,
|
|
82
|
-
} from '../types/spec';
|
|
83
|
-
|
|
84
70
|
// 项目配置加载器(governance 段读取一律经访问器,禁止消费方手写钻取)
|
|
85
71
|
export {
|
|
86
72
|
ProjectConfigLoader,
|
|
@@ -96,6 +82,4 @@ export type { RunEnv, RunTarget } from './constraints/run-env';
|
|
|
96
82
|
// 生效约束集(ADR-0001:唯一生效集来源)
|
|
97
83
|
export {
|
|
98
84
|
getEffectiveConstraints,
|
|
99
|
-
lintEffectiveConfig,
|
|
100
85
|
} from './effective-constraints';
|
|
101
|
-
export type { EffectiveConfigLint } from './effective-constraints';
|