@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,227 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* no_completion_without_verification 证据源重构(harness#183)
|
|
3
|
+
*
|
|
4
|
+
* 旧证据源是语义循环:traces.log 尾部 pass 记录的唯一生产写入方是约束检查自身
|
|
5
|
+
* ——「你验证过了吗」的回答是「你之前被检查过吗」。本套件钉死新口径:
|
|
6
|
+
*
|
|
7
|
+
* - 证据源 = `.harness/evidence/`(独立链路写入:PassesGate.runTests 真实跑测试
|
|
8
|
+
* 命令落盘,或消费方外部验证事件),与 traces.log 彻底脱钩
|
|
9
|
+
* - 新鲜度 = 最新证据 mtime 严格晚于全部可读变更文件(验证跑在最新变更之后);
|
|
10
|
+
* 同刻等值 = 时钟精度内先后不可判(harness#195)→ 显式降级 skip,不放行也不违规
|
|
11
|
+
* - 缺失/空目录 → fail;过期 → fail(点名晚于证据的变更文件);
|
|
12
|
+
* 证据位不可读 / 新鲜度不可判定 → 带原因的显式降级 skip(不静默)
|
|
13
|
+
*
|
|
14
|
+
* 端到端口径:一律经 ConstraintChecker.check 编排层进,不直调 evaluate。
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { describe, it, expect, beforeEach, afterEach } from '@jest/globals';
|
|
18
|
+
import * as fs from 'fs';
|
|
19
|
+
import * as path from 'path';
|
|
20
|
+
import * as os from 'os';
|
|
21
|
+
import { ConstraintChecker } from '../../checker';
|
|
22
|
+
import { CONSTRAINTS } from '../../definitions';
|
|
23
|
+
import { getConstraintCheck } from '..';
|
|
24
|
+
import { PassesGate } from '../../../validators/passes-gate';
|
|
25
|
+
import { DEFAULT_TRACE_FILE } from '../../../../types/trace';
|
|
26
|
+
import type { ConstraintContext } from '../../../../types/constraint';
|
|
27
|
+
|
|
28
|
+
const LAW = CONSTRAINTS['no_completion_without_verification'];
|
|
29
|
+
/** 缺省 no-op trace 记录器:本套件不验 trace 面 */
|
|
30
|
+
const checker = new ConstraintChecker();
|
|
31
|
+
|
|
32
|
+
let dir: string;
|
|
33
|
+
|
|
34
|
+
beforeEach(() => {
|
|
35
|
+
dir = fs.mkdtempSync(path.join(os.tmpdir(), 'harness-ncwv-'));
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
afterEach(() => {
|
|
39
|
+
fs.rmSync(dir, { recursive: true, force: true });
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
/** 造一个变更文件,mtime 钉到指定时刻(不等真实时钟) */
|
|
43
|
+
function writeChangedFile(rel: string, mtime: Date): string {
|
|
44
|
+
const abs = path.join(dir, rel);
|
|
45
|
+
fs.mkdirSync(path.dirname(abs), { recursive: true });
|
|
46
|
+
fs.writeFileSync(abs, 'export const x = 1;');
|
|
47
|
+
fs.utimesSync(abs, mtime, mtime);
|
|
48
|
+
return rel;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** 造一条验证证据,mtime 钉到指定时刻 */
|
|
52
|
+
function writeEvidence(name: string, mtime: Date): void {
|
|
53
|
+
const evidenceDir = path.join(dir, '.harness', 'evidence');
|
|
54
|
+
fs.mkdirSync(evidenceDir, { recursive: true });
|
|
55
|
+
const abs = path.join(evidenceDir, name);
|
|
56
|
+
fs.writeFileSync(abs, 'test output');
|
|
57
|
+
fs.utimesSync(abs, mtime, mtime);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function contextOf(changedFiles?: string[]): ConstraintContext {
|
|
61
|
+
return { operation: 'code_implementation', projectPath: dir, changedFiles };
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const T_OLD = new Date('2026-09-01T00:00:00Z');
|
|
65
|
+
const T_NEW = new Date('2026-09-02T00:00:00Z');
|
|
66
|
+
|
|
67
|
+
describe('no_completion_without_verification(harness#183 证据源重构)', () => {
|
|
68
|
+
it('真实跑过验证且证据新鲜(证据晚于最新变更)→ pass', async () => {
|
|
69
|
+
writeChangedFile('src/a.ts', T_OLD);
|
|
70
|
+
writeEvidence('test-2026-09-02.log', T_NEW);
|
|
71
|
+
|
|
72
|
+
const result = await checker.check(LAW, contextOf(['src/a.ts']));
|
|
73
|
+
|
|
74
|
+
expect(result.skipped).toBeUndefined();
|
|
75
|
+
expect(result.satisfied).toBe(true);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it('证据与最新变更同一时刻(等值不可判,harness#195)→ 显式降级 skip,不放行也不违规', async () => {
|
|
79
|
+
writeChangedFile('src/a.ts', T_OLD);
|
|
80
|
+
writeEvidence('test-same-instant.log', T_OLD);
|
|
81
|
+
|
|
82
|
+
const result = await checker.check(LAW, contextOf(['src/a.ts']));
|
|
83
|
+
|
|
84
|
+
// 时钟精度内「同刻」物理上无法区分先后:判 pass 是假绿灯,判 fail 又可能误杀
|
|
85
|
+
// 正常时序(改完立刻验证落进同一毫秒)——不可判定态走显式降级,与「变更清单
|
|
86
|
+
// 未接线」「mtime 均不可读」同一出口
|
|
87
|
+
expect(result.skipped).toBe(true);
|
|
88
|
+
expect(result.satisfied).toBe(true); // skip 不产生违规
|
|
89
|
+
expect(result.skipReason).toContain('同刻');
|
|
90
|
+
expect(result.skipReason).toContain('src/a.ts');
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it('严格晚于证据的变更与同刻变更并存 → fail 优先(证据确定过期,不因同刻降级)', async () => {
|
|
94
|
+
writeChangedFile('src/a.ts', T_OLD);
|
|
95
|
+
writeChangedFile('src/b.ts', T_NEW);
|
|
96
|
+
writeEvidence('test-same-instant.log', T_OLD);
|
|
97
|
+
|
|
98
|
+
const result = await checker.check(LAW, contextOf(['src/a.ts', 'src/b.ts']));
|
|
99
|
+
|
|
100
|
+
expect(result.skipped).toBeUndefined();
|
|
101
|
+
expect(result.satisfied).toBe(false);
|
|
102
|
+
expect(result.evidence?.join('\n')).toContain('src/b.ts');
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it('changedFiles 为 undefined(调用方未接线变更清单)→ 显式降级 skip,不放行', async () => {
|
|
106
|
+
writeEvidence('test-2026-09-02.log', T_NEW);
|
|
107
|
+
|
|
108
|
+
const result = await checker.check(LAW, contextOf(undefined));
|
|
109
|
+
|
|
110
|
+
// 新鲜度无所依 ≠ 合规:生产侧直调(跳过 context-builder)正是这形态,必须有声
|
|
111
|
+
expect(result.skipped).toBe(true);
|
|
112
|
+
expect(result.skipReason).toContain('变更清单未接线');
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it('空 changedFiles(真无变更)+ 有证据 → pass', async () => {
|
|
116
|
+
writeEvidence('test-2026-09-02.log', T_NEW);
|
|
117
|
+
|
|
118
|
+
const result = await checker.check(LAW, contextOf([]));
|
|
119
|
+
|
|
120
|
+
expect(result.skipped).toBeUndefined();
|
|
121
|
+
expect(result.satisfied).toBe(true);
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
it('未跑验证(.harness/evidence 不存在)→ fail,证据行给出修复入口', async () => {
|
|
125
|
+
writeChangedFile('src/a.ts', T_OLD);
|
|
126
|
+
|
|
127
|
+
const result = await checker.check(LAW, contextOf(['src/a.ts']));
|
|
128
|
+
|
|
129
|
+
expect(result.skipped).toBeUndefined();
|
|
130
|
+
expect(result.satisfied).toBe(false);
|
|
131
|
+
expect(result.evidence?.join('\n')).toContain('.harness/evidence');
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
it('证据目录为空 → fail(等价未跑)', async () => {
|
|
135
|
+
writeChangedFile('src/a.ts', T_OLD);
|
|
136
|
+
fs.mkdirSync(path.join(dir, '.harness', 'evidence'), { recursive: true });
|
|
137
|
+
|
|
138
|
+
const result = await checker.check(LAW, contextOf(['src/a.ts']));
|
|
139
|
+
|
|
140
|
+
expect(result.satisfied).toBe(false);
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
it('证据过期(旧于最新变更)→ fail,点名晚于证据的变更文件', async () => {
|
|
144
|
+
writeChangedFile('src/a.ts', T_OLD);
|
|
145
|
+
writeChangedFile('src/b.ts', T_NEW);
|
|
146
|
+
writeEvidence('test-2026-09-01.log', T_OLD);
|
|
147
|
+
|
|
148
|
+
const result = await checker.check(LAW, contextOf(['src/a.ts', 'src/b.ts']));
|
|
149
|
+
|
|
150
|
+
expect(result.satisfied).toBe(false);
|
|
151
|
+
const text = result.evidence?.join('\n') ?? '';
|
|
152
|
+
expect(text).toContain('过期');
|
|
153
|
+
expect(text).toContain('src/b.ts');
|
|
154
|
+
expect(text).not.toContain('src/a.ts');
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
it('循环拆除:traces.log 里有 pass 记录但无证据目录 → 仍 fail', async () => {
|
|
158
|
+
writeChangedFile('src/a.ts', T_OLD);
|
|
159
|
+
// 旧口径下这是一条「验证证据」;新口径必须不认
|
|
160
|
+
const logsDir = path.dirname(path.join(dir, DEFAULT_TRACE_FILE));
|
|
161
|
+
fs.mkdirSync(logsDir, { recursive: true });
|
|
162
|
+
fs.writeFileSync(
|
|
163
|
+
path.join(dir, DEFAULT_TRACE_FILE),
|
|
164
|
+
JSON.stringify({ constraintId: 'x', severity: 'error', timestamp: Date.now(), result: 'pass' }) + '\n'
|
|
165
|
+
);
|
|
166
|
+
|
|
167
|
+
const result = await checker.check(LAW, contextOf(['src/a.ts']));
|
|
168
|
+
|
|
169
|
+
expect(result.satisfied).toBe(false);
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
it('证据位被占用但不是目录 → 显式降级 skip(带原因),不静默', async () => {
|
|
173
|
+
writeChangedFile('src/a.ts', T_OLD);
|
|
174
|
+
fs.mkdirSync(path.join(dir, '.harness'), { recursive: true });
|
|
175
|
+
fs.writeFileSync(path.join(dir, '.harness', 'evidence'), 'not a directory');
|
|
176
|
+
|
|
177
|
+
const result = await checker.check(LAW, contextOf(['src/a.ts']));
|
|
178
|
+
|
|
179
|
+
expect(result.skipped).toBe(true);
|
|
180
|
+
expect(result.satisfied).toBe(true); // skip 不产生违规
|
|
181
|
+
expect(result.skipReason).toContain('.harness/evidence');
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
it('有证据但全部变更文件 mtime 不可读 → 显式降级 skip(无法判定新鲜度)', async () => {
|
|
185
|
+
writeEvidence('test-2026-09-02.log', T_NEW);
|
|
186
|
+
|
|
187
|
+
const result = await checker.check(LAW, contextOf(['src/gone.ts']));
|
|
188
|
+
|
|
189
|
+
expect(result.skipped).toBe(true);
|
|
190
|
+
expect(result.skipReason).toContain('新鲜度');
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
it('部分变更文件不可读不降级:按可读文件判定(删除文件是常态)', async () => {
|
|
194
|
+
writeChangedFile('src/a.ts', T_OLD);
|
|
195
|
+
writeEvidence('test-2026-09-02.log', T_NEW);
|
|
196
|
+
|
|
197
|
+
const result = await checker.check(LAW, contextOf(['src/a.ts', 'src/deleted.ts']));
|
|
198
|
+
|
|
199
|
+
expect(result.skipped).toBeUndefined();
|
|
200
|
+
expect(result.satisfied).toBe(true);
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
it('flag 退役:不再声明 contextFlags 输入契约(证据判定在 checker 体内)', () => {
|
|
204
|
+
const check = getConstraintCheck('no_completion_without_verification');
|
|
205
|
+
expect(check).toBeDefined();
|
|
206
|
+
expect(check!.needs?.contextFlags ?? []).not.toContain('hasVerificationEvidence');
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
it('端到端:PassesGate 真跑验证命令 → 证据落盘 → checker pass', async () => {
|
|
210
|
+
// 生产链路的最小真身:package.json 声明测试命令,PassesGate 真跑(退出码判定),
|
|
211
|
+
// 输出落 .harness/evidence/test-*.log,checker 读同一约定位放行
|
|
212
|
+
fs.writeFileSync(
|
|
213
|
+
path.join(dir, 'package.json'),
|
|
214
|
+
JSON.stringify({ scripts: { test: 'node -e "console.log(\'1 passed\')"' } })
|
|
215
|
+
);
|
|
216
|
+
writeChangedFile('src/a.ts', T_OLD);
|
|
217
|
+
|
|
218
|
+
const run = await new PassesGate().runTests(dir);
|
|
219
|
+
expect(run.passed).toBe(true);
|
|
220
|
+
const evidenceDir = path.join(dir, '.harness', 'evidence');
|
|
221
|
+
expect(fs.readdirSync(evidenceDir).some(f => f.startsWith('test-'))).toBe(true);
|
|
222
|
+
|
|
223
|
+
const result = await checker.check(LAW, contextOf(['src/a.ts']));
|
|
224
|
+
expect(result.skipped).toBeUndefined();
|
|
225
|
+
expect(result.satisfied).toBe(true);
|
|
226
|
+
});
|
|
227
|
+
});
|
|
@@ -12,7 +12,6 @@ import { join } from 'path';
|
|
|
12
12
|
import { describe, it, expect, afterAll } from '@jest/globals';
|
|
13
13
|
import {
|
|
14
14
|
noHardcodedCredentials,
|
|
15
|
-
containsHardcodedCredential,
|
|
16
15
|
} from '../no-hardcoded-credentials';
|
|
17
16
|
import type { CheckEnv } from '../types';
|
|
18
17
|
import { createRunEnv } from '../../run-env';
|
|
@@ -33,80 +32,113 @@ const PASSWORD_ASSIGN = 'const dbPass' + 'word = "sup3r-s3cret-value";';
|
|
|
33
32
|
const JWT =
|
|
34
33
|
'eyJ' + 'hbGciOiJIUzI1NiJ9.' + 'eyJ' + 'zdWIiOiIxMjM0NTY3ODkwIn0.' + 'dozjgNryP4J3jVmNHl0w5N_XgL0n';
|
|
35
34
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
/** 经生产入口判定一段文本是否命中凭证:写入临时文件,走「变更文件内容扫描」路径 */
|
|
36
|
+
const scanDir = mkdtempSync(join(tmpdir(), 'harness-cred-scan-'));
|
|
37
|
+
afterAll(() => rmSync(scanDir, { recursive: true, force: true }));
|
|
38
|
+
|
|
39
|
+
async function textHitsCredential(text: string): Promise<boolean> {
|
|
40
|
+
writeFileSync(join(scanDir, 'probe.ts'), text + '\n');
|
|
41
|
+
const env: CheckEnv = {
|
|
42
|
+
...createRunEnv(scanDir),
|
|
43
|
+
context: { operation: 'commit', projectPath: scanDir, changedFiles: ['probe.ts'] },
|
|
44
|
+
stagedDiff: async () => '',
|
|
45
|
+
stagedDiffNames: async () => '',
|
|
46
|
+
srcScan: () => [],
|
|
47
|
+
};
|
|
48
|
+
return (await noHardcodedCredentials.evaluate(env)) !== true;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
describe('文本命中判定(经生产入口 evaluate 的变更文件扫描路径)', () => {
|
|
52
|
+
it('命中 PEM 私钥头', async () => {
|
|
53
|
+
expect(await textHitsCredential(PEM_HEADER + '\nMIIE...')).toBe(true);
|
|
39
54
|
});
|
|
40
55
|
|
|
41
|
-
it('命中 AWS Access Key', () => {
|
|
42
|
-
expect(
|
|
56
|
+
it('命中 AWS Access Key', async () => {
|
|
57
|
+
expect(await textHitsCredential(`const key = "${AWS_KEY}";`)).toBe(true);
|
|
43
58
|
});
|
|
44
59
|
|
|
45
|
-
it('命中硬编码 password 赋值', () => {
|
|
46
|
-
expect(
|
|
60
|
+
it('命中硬编码 password 赋值', async () => {
|
|
61
|
+
expect(await textHitsCredential(PASSWORD_ASSIGN)).toBe(true);
|
|
47
62
|
});
|
|
48
63
|
|
|
49
|
-
it('命中硬编码 api_key 赋值', () => {
|
|
50
|
-
expect(
|
|
64
|
+
it('命中硬编码 api_key 赋值', async () => {
|
|
65
|
+
expect(await textHitsCredential('api' + '_key: "abcdef123456789"')).toBe(true);
|
|
51
66
|
});
|
|
52
67
|
|
|
53
|
-
it('命中 .env 裸值(无引号赋值)', () => {
|
|
54
|
-
expect(
|
|
68
|
+
it('命中 .env 裸值(无引号赋值)', async () => {
|
|
69
|
+
expect(await textHitsCredential('DB_TO' + 'KEN=abc123def456ghi')).toBe(true);
|
|
55
70
|
});
|
|
56
71
|
|
|
57
|
-
it('命中无引号 YAML 值', () => {
|
|
58
|
-
expect(
|
|
72
|
+
it('命中无引号 YAML 值', async () => {
|
|
73
|
+
expect(await textHitsCredential('pass' + 'word: secret123')).toBe(true);
|
|
59
74
|
});
|
|
60
75
|
|
|
61
|
-
it('命中 URL 内嵌凭证', () => {
|
|
62
|
-
expect(
|
|
76
|
+
it('命中 URL 内嵌凭证', async () => {
|
|
77
|
+
expect(await textHitsCredential('const url = "postgres:/' + '/user:pw12345@db.host/app";')).toBe(true);
|
|
63
78
|
});
|
|
64
79
|
|
|
65
|
-
it('命中 JSON 带引号键', () => {
|
|
66
|
-
expect(
|
|
80
|
+
it('命中 JSON 带引号键', async () => {
|
|
81
|
+
expect(await textHitsCredential('"pass' + 'word": "realvalue123"')).toBe(true);
|
|
67
82
|
});
|
|
68
83
|
|
|
69
|
-
it('命中非清单变量名 credential/privateKey/signingKey', () => {
|
|
70
|
-
expect(
|
|
71
|
-
expect(
|
|
72
|
-
expect(
|
|
84
|
+
it('命中非清单变量名 credential/privateKey/signingKey', async () => {
|
|
85
|
+
expect(await textHitsCredential('cred' + 'ential = "realvalue123";')).toBe(true);
|
|
86
|
+
expect(await textHitsCredential('private' + 'Key = "realvalue123";')).toBe(true);
|
|
87
|
+
expect(await textHitsCredential('signing' + '_key: realvalue123')).toBe(true);
|
|
73
88
|
});
|
|
74
89
|
|
|
75
|
-
it('命中 JWT', () => {
|
|
76
|
-
expect(
|
|
90
|
+
it('命中 JWT', async () => {
|
|
91
|
+
expect(await textHitsCredential(`const tok = "${JWT}";`)).toBe(true);
|
|
77
92
|
});
|
|
78
93
|
|
|
79
|
-
it('行内出现 test 不再整行豁免真实值', () => {
|
|
94
|
+
it('行内出现 test 不再整行豁免真实值', async () => {
|
|
80
95
|
expect(
|
|
81
|
-
|
|
96
|
+
await textHitsCredential('const pass' + 'word = "realvalue123"; // test fixture')
|
|
82
97
|
).toBe(true);
|
|
83
98
|
});
|
|
84
99
|
|
|
85
|
-
it('豁免环境变量引用', () => {
|
|
100
|
+
it('豁免环境变量引用', async () => {
|
|
86
101
|
expect(
|
|
87
|
-
|
|
102
|
+
await textHitsCredential('const pass' + 'word = process.env.DB_PASSWORD;')
|
|
88
103
|
).toBe(false);
|
|
89
104
|
});
|
|
90
105
|
|
|
91
|
-
it('豁免占位符值', () => {
|
|
106
|
+
it('豁免占位符值', async () => {
|
|
92
107
|
expect(
|
|
93
|
-
|
|
108
|
+
await textHitsCredential('const pass' + 'word = "your-password-here";')
|
|
94
109
|
).toBe(false);
|
|
95
110
|
});
|
|
96
111
|
|
|
97
|
-
it('豁免 TS 类型注解(值是类型名而非字面量)', () => {
|
|
98
|
-
expect(
|
|
112
|
+
it('豁免 TS 类型注解(值是类型名而非字面量)', async () => {
|
|
113
|
+
expect(await textHitsCredential('api' + 'Key: string|undefined;')).toBe(false);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it('豁免 URL 中的变量插值占位', async () => {
|
|
117
|
+
expect(
|
|
118
|
+
await textHitsCredential('postgres://user:' + '${' + 'DB_PASS}@host/db')
|
|
119
|
+
).toBe(false);
|
|
99
120
|
});
|
|
100
121
|
|
|
101
|
-
it('
|
|
122
|
+
it('普通代码不误报', async () => {
|
|
102
123
|
expect(
|
|
103
|
-
|
|
124
|
+
await textHitsCredential('export function add(a: number, b: number) { return a + b; }')
|
|
104
125
|
).toBe(false);
|
|
105
126
|
});
|
|
106
127
|
|
|
107
|
-
it('
|
|
128
|
+
it('豁免右值为代码表达式的赋值(#184 收窄正则版假灯回归)', async () => {
|
|
129
|
+
// 现场复现:交付链 2026-09-24 一次采纳 1.14.0 时,业务仓的 React useCallback
|
|
130
|
+
// 赋值被无引号分支判成「口令类赋值」——右值是代码而非字面量。
|
|
131
|
+
expect(
|
|
132
|
+
await textHitsCredential('const insertPmoTok' + 'en = useCallback((candidate: string) => {')
|
|
133
|
+
).toBe(false);
|
|
134
|
+
expect(
|
|
135
|
+
await textHitsCredential('const refreshTok' + 'en = getTokenFromStor' + 'age();')
|
|
136
|
+
).toBe(false);
|
|
137
|
+
expect(
|
|
138
|
+
await textHitsCredential('const refreshTok' + 'en = req.cookies.refre' + 'sh;')
|
|
139
|
+
).toBe(false);
|
|
108
140
|
expect(
|
|
109
|
-
|
|
141
|
+
await textHitsCredential('api' + '_key: make' + 'Key("abc123456789"),')
|
|
110
142
|
).toBe(false);
|
|
111
143
|
});
|
|
112
144
|
});
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* 2. 全量扫描(T-058)— 源码根下所有源文件是否都在 CAPABILITIES.md 中 → **只出提示**
|
|
7
7
|
*
|
|
8
8
|
* Step 2 不判违规的理由:它是仓库级完备性不变量,与正在被评估的那次变更无因果——
|
|
9
|
-
* 一处历史漏登会让此后每次 module_*
|
|
9
|
+
* 一处历史漏登会让此后每次 module_* 评估恒红(下游消费方曾实测全量 fail,且因 fail
|
|
10
10
|
* 零证据而无人能定位)。本处保留缺口输出是为了让人看得见、能自己修,而不是为了拦。
|
|
11
11
|
*
|
|
12
12
|
* 已知缺口(ADR-0016「影响」①):降级后仓库级漏登**没有自动拦截点**。`sync-docs --check`
|
|
@@ -99,7 +99,7 @@ export const docsFreshness: ConstraintCheck = {
|
|
|
99
99
|
try {
|
|
100
100
|
const deadEntries = findDeadCapabilityEntries(env);
|
|
101
101
|
if (deadEntries.length > 0) {
|
|
102
|
-
// 证据通道点名条目(harness#119):此前是 console.error 侧信道(2026-08-08
|
|
102
|
+
// 证据通道点名条目(harness#119):此前是 console.error 侧信道(2026-08-08
|
|
103
103
|
// CI 4 连红时的临时办法),CLI 结构化输出与 trace 两头都拿不到,
|
|
104
104
|
// error 级拦截时用户只看到一句通用提示,basename 碰撞下无从定位
|
|
105
105
|
return {
|
|
@@ -17,9 +17,7 @@ import type { Constraint } from '../../../types/constraint';
|
|
|
17
17
|
import type { ConstraintCheck } from './types';
|
|
18
18
|
import { getAllConstraints, isGateConstraint } from '../definitions';
|
|
19
19
|
|
|
20
|
-
import {
|
|
21
|
-
noCompletionWithoutVerification,
|
|
22
|
-
} from './iron-flags';
|
|
20
|
+
import { noCompletionWithoutVerification } from './no-completion-without-verification';
|
|
23
21
|
import { noTestSimplification } from './no-test-simplification';
|
|
24
22
|
import { capabilitySync } from './capability-sync';
|
|
25
23
|
import { contextDocSync } from './context-doc-sync';
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* no_completion_without_verification(harness#183 证据源重构)
|
|
3
|
+
*
|
|
4
|
+
* 旧证据源是语义循环:「验证证据」取自 traces.log 尾部 pass 记录,而 traces.log
|
|
5
|
+
* 的唯一生产写入方是约束检查自身——「你验证过了吗」的回答是「你之前被检查过吗」。
|
|
6
|
+
* 本 checker 把证据源换到独立链路:`.harness/evidence/` 目录
|
|
7
|
+
* (PassesGate.runTests 真实跑项目声明的验证命令后落盘;消费方外部验证事件
|
|
8
|
+
* 也写这里),判定与约束检查自身的 trace 彻底脱钩。
|
|
9
|
+
*
|
|
10
|
+
* 新鲜度口径:最新证据文件的 mtime 严格晚于全部可读变更文件的 mtime
|
|
11
|
+
* (验证跑在最新变更之后)。不用固定时间窗——与本次变更的因果关系才是口径。
|
|
12
|
+
* 同刻等值(harness#195):文件系统时间戳粒度有限,等值在物理上无法区分先后,
|
|
13
|
+
* 属不可判定态——判 pass 是假绿灯(同毫秒「先证据后变更」会被放行),判 fail 又
|
|
14
|
+
* 误杀正常时序(改完立刻验证落进同一毫秒),故等值走显式降级 skip,不放行也不违规。
|
|
15
|
+
* 已知边界(保守方向,不修复):git checkout 等刷新工作区 mtime 会误杀真证据
|
|
16
|
+
* (误判过期 → fail,要求重跑验证);证据只核存在性与时间,不读内容——防伪
|
|
17
|
+
* 非本票口径(旧机制是自我指认,更弱)。
|
|
18
|
+
*
|
|
19
|
+
* 与 exec 口子(harness#181)的关系:本判定不依赖 exec 模板;业务仓若要自定义
|
|
20
|
+
* 验证方式,用 exec checker 另行登记业务约束即可,与本铁律互不阻塞。
|
|
21
|
+
*
|
|
22
|
+
* 判定(显式三态,harness#182 语义):
|
|
23
|
+
* - 证据目录缺失/为空 → fail(从未验证)
|
|
24
|
+
* - 证据旧于最新变更 → fail(证据过期,点名晚于证据的变更文件)
|
|
25
|
+
* - 证据与变更文件同刻等值 → 带原因的 CheckSkip(harness#195:等值不可判定,
|
|
26
|
+
* 不放行也不违规;严格晚于证据的变更并存时 fail 优先,证据确定过期不降级)
|
|
27
|
+
* - 新鲜 → pass
|
|
28
|
+
* - changedFiles 为 undefined(调用方未接线变更清单,如生产侧直调)→ 带原因的
|
|
29
|
+
* CheckSkip:新鲜度无所依不能放行(空数组 = 真无变更,不在此列,有证据即过)
|
|
30
|
+
* - 证据位不可读(不是目录/全部 stat 失败)或全部变更文件 mtime 不可读
|
|
31
|
+
* → 带原因的 CheckSkip:证据源不可用 ≠ 对象合规,也不静默 skip
|
|
32
|
+
*
|
|
33
|
+
* flag 退役:此前经 ConstraintContext.hasVerificationEvidence 三态 flag 接线,
|
|
34
|
+
* 只有 CLI 路径填充(生产调用点恒 skip)。判定收进 checker 体内后,凡走到
|
|
35
|
+
* 编排层的调用方都按同一口径评估,flag 从 ConstraintContext 整体移除。
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
import * as fs from 'fs';
|
|
39
|
+
import * as path from 'path';
|
|
40
|
+
import { EVIDENCE_DIR_REL } from '../../../types/passes-gate';
|
|
41
|
+
import type { ConstraintCheck } from './types';
|
|
42
|
+
import { formatEvidence } from './types';
|
|
43
|
+
|
|
44
|
+
/** 证据目录探测结果:最新证据 mtime / 无证据 / 不可读(三态) */
|
|
45
|
+
type EvidenceProbe = { mtime: number } | { missing: true } | { unreadable: string };
|
|
46
|
+
|
|
47
|
+
/** 探测证据目录的最新证据 mtime(只计文件;目录缺失/为空 → missing;不可读 → unreadable) */
|
|
48
|
+
function probeEvidence(evidenceDir: string): EvidenceProbe {
|
|
49
|
+
let entries: fs.Dirent[];
|
|
50
|
+
try {
|
|
51
|
+
entries = fs.readdirSync(evidenceDir, { withFileTypes: true });
|
|
52
|
+
} catch (err) {
|
|
53
|
+
if ((err as NodeJS.ErrnoException).code === 'ENOENT') return { missing: true };
|
|
54
|
+
return { unreadable: err instanceof Error ? err.message : String(err) };
|
|
55
|
+
}
|
|
56
|
+
const files = entries.filter(e => e.isFile());
|
|
57
|
+
if (files.length === 0) return { missing: true };
|
|
58
|
+
let newest = -Infinity;
|
|
59
|
+
for (const entry of files) {
|
|
60
|
+
try {
|
|
61
|
+
const mtime = fs.statSync(path.join(evidenceDir, entry.name)).mtimeMs;
|
|
62
|
+
if (mtime > newest) newest = mtime;
|
|
63
|
+
} catch {
|
|
64
|
+
// 单个证据文件 stat 失败不拖死判定:跳过该条,按其余证据判定
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (newest === -Infinity) return { unreadable: '全部证据文件 stat 失败' };
|
|
68
|
+
return { mtime: newest };
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export const noCompletionWithoutVerification: ConstraintCheck = {
|
|
72
|
+
id: 'no_completion_without_verification',
|
|
73
|
+
evaluate(env) {
|
|
74
|
+
const evidence = probeEvidence(path.join(env.projectPath, EVIDENCE_DIR_REL));
|
|
75
|
+
|
|
76
|
+
if ('unreadable' in evidence) {
|
|
77
|
+
return {
|
|
78
|
+
skip: true,
|
|
79
|
+
reason: `验证证据位 ${EVIDENCE_DIR_REL} 不可读(${evidence.unreadable}),本次未评估`,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
if ('missing' in evidence) {
|
|
83
|
+
return {
|
|
84
|
+
pass: false,
|
|
85
|
+
evidence: formatEvidence('未运行验证:.harness/evidence 无测试输出记录', [
|
|
86
|
+
'先真实运行项目声明的验证命令(harness passes-gate 或等价测试运行),证据落盘后重新提交',
|
|
87
|
+
]),
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// 变更清单未接线(undefined)≠ 真无变更([]):前者无法判定新鲜度,显式降级
|
|
92
|
+
const changed = env.context.changedFiles;
|
|
93
|
+
if (changed === undefined) {
|
|
94
|
+
return {
|
|
95
|
+
skip: true,
|
|
96
|
+
reason: '变更清单未接线(context.changedFiles 缺失),无法判定证据新鲜度,本次未评估',
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// 新鲜度:变更文件 mtime 逐只取,不可读的跳过(删除文件是常态);
|
|
101
|
+
// 全部不可读才无法判定 → 显式降级
|
|
102
|
+
let readable = 0;
|
|
103
|
+
const laterThanEvidence: string[] = [];
|
|
104
|
+
const sameAsEvidence: string[] = [];
|
|
105
|
+
for (const file of changed) {
|
|
106
|
+
try {
|
|
107
|
+
const mtime = fs.statSync(path.join(env.projectPath, file)).mtimeMs;
|
|
108
|
+
readable++;
|
|
109
|
+
if (mtime > evidence.mtime) laterThanEvidence.push(file);
|
|
110
|
+
else if (mtime === evidence.mtime) sameAsEvidence.push(file);
|
|
111
|
+
} catch {
|
|
112
|
+
// 变更文件不可读(如已删除):不参与新鲜度判定
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
if (changed.length > 0 && readable === 0) {
|
|
116
|
+
return {
|
|
117
|
+
skip: true,
|
|
118
|
+
reason: '无法判定证据新鲜度(变更文件 mtime 均不可读),本次未评估',
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (laterThanEvidence.length > 0) {
|
|
123
|
+
return {
|
|
124
|
+
pass: false,
|
|
125
|
+
evidence: formatEvidence(
|
|
126
|
+
'验证证据过期:最新证据早于本次变更,需重新运行项目声明的验证命令',
|
|
127
|
+
laterThanEvidence.map(f => `晚于证据的变更: ${f}`)
|
|
128
|
+
),
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
// 同刻等值 = 时钟精度内先后不可判(harness#195):不放行也不违规,显式降级。
|
|
132
|
+
// 置于 fail 之后:严格晚于证据的变更并存时证据确定过期,不因同刻降级
|
|
133
|
+
if (sameAsEvidence.length > 0) {
|
|
134
|
+
return {
|
|
135
|
+
skip: true,
|
|
136
|
+
reason: `证据与变更文件同刻(mtime 等值,时钟精度内无法区分先后):${sameAsEvidence.join(', ')},无法判定证据新鲜度,本次未评估`,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
return true;
|
|
140
|
+
},
|
|
141
|
+
};
|
|
@@ -12,6 +12,9 @@
|
|
|
12
12
|
* 模板文件(.example/.sample/.template/.dist)与占位符值(your_xxx、process.env
|
|
13
13
|
* 引用、变量插值等)豁免;占位符判定作用于「值」而非整行,行内出现 test/example
|
|
14
14
|
* 等词不再豁免真实值。
|
|
15
|
+
*
|
|
16
|
+
* 无引号右值若是代码表达式(含括号/花括号/分号或 `=>`)一并豁免——那是调用与取值,
|
|
17
|
+
* 不是口令字面量;带引号的值不受此豁免影响(CODE_EXPRESSION 记明残余漏报与取舍)。
|
|
15
18
|
*/
|
|
16
19
|
|
|
17
20
|
import { readFileSync } from 'fs';
|
|
@@ -54,6 +57,19 @@ const URL_CREDENTIAL_PATTERN = /\b[a-z][a-z0-9+.-]{1,20}:\/\/[^/\s:@'"]+:[^/\s@'
|
|
|
54
57
|
const PLACEHOLDER_VALUE =
|
|
55
58
|
/^(?:process\.env\b|your[_-]|<|\$\{|xxx+$|placeholder|changeme|dummy|fake|redacted|string\b|number\b|boolean\b|unknown\b|any\b)/i;
|
|
56
59
|
|
|
60
|
+
/**
|
|
61
|
+
* 代码表达式特征(只作用于**无引号**右值):带 `(`/`)`/`{`/`}`/`;` 或 `=>` 的裸值是代码,
|
|
62
|
+
* 不是字面量口令。无引号分支会把 `useCallback` 调用的整段左括号到首个空格吃成「值」,
|
|
63
|
+
* 于是 React/Vue 的 hook 赋值、成员链取值、函数调用一律误判「口令类赋值」
|
|
64
|
+
* (2026-09-24 交付链采纳 1.14.0 时于业务仓现场命中,回归测试钉在旁测文件)。
|
|
65
|
+
* 带引号的值不走此豁免——引号内就是字面量,括号属于口令本身。
|
|
66
|
+
*
|
|
67
|
+
* 残余已知漏报:右值是纯标识符引用(对象字面量里指向另一个变量)时不豁免,
|
|
68
|
+
* 它与 .env/YAML 的无引号真值同形、单行内无法区分。增量面刻意宁可放过代码形状,
|
|
69
|
+
* 也不给无引号真值开洞;这类泄露由全历史 gitleaks 兜底(见文件头分工)。
|
|
70
|
+
*/
|
|
71
|
+
const CODE_EXPRESSION = /[(){};]|=>/;
|
|
72
|
+
|
|
57
73
|
/** URL 匹配串内的占位符(变量插值、尖括号、your_xxx) */
|
|
58
74
|
const URL_PLACEHOLDER = /\$\{|<|your[_-]|xxx+/i;
|
|
59
75
|
|
|
@@ -83,8 +99,10 @@ function classifyLine(line: string): HitRule | null {
|
|
|
83
99
|
}
|
|
84
100
|
const assign = line.match(ASSIGNMENT_PATTERN);
|
|
85
101
|
if (assign) {
|
|
86
|
-
const
|
|
87
|
-
|
|
102
|
+
const quoted = assign[1];
|
|
103
|
+
const value = quoted ?? assign[2];
|
|
104
|
+
const codeRhs = quoted === undefined && CODE_EXPRESSION.test(value);
|
|
105
|
+
if (!codeRhs && !PLACEHOLDER_VALUE.test(value)) return '口令类赋值';
|
|
88
106
|
}
|
|
89
107
|
const url = line.match(URL_CREDENTIAL_PATTERN);
|
|
90
108
|
if (url && !URL_PLACEHOLDER.test(url[0])) return 'URL 内嵌凭证';
|
|
@@ -102,11 +120,6 @@ function scanText(text: string, file: string): Hit[] {
|
|
|
102
120
|
return hits;
|
|
103
121
|
}
|
|
104
122
|
|
|
105
|
-
/** 判定一段文本是否包含硬编码凭证 */
|
|
106
|
-
export function containsHardcodedCredential(text: string): boolean {
|
|
107
|
-
return scanText(text, '(text)').length > 0;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
123
|
interface AddedLine {
|
|
111
124
|
file: string;
|
|
112
125
|
lineNo: number;
|
|
@@ -47,7 +47,7 @@ export const fileExists: TemplatedCheckerFactory = {
|
|
|
47
47
|
evaluate(env) {
|
|
48
48
|
const pathHit = rel !== undefined && existsSync(join(env.projectPath, rel));
|
|
49
49
|
const globHits = globPattern !== undefined
|
|
50
|
-
? glob.sync(globPattern, { cwd: env.projectPath, dot: true, onlyFiles: false })
|
|
50
|
+
? glob.sync(globPattern, { cwd: env.projectPath, dot: true, onlyFiles: false, ignore: ['node_modules/**'] })
|
|
51
51
|
: [];
|
|
52
52
|
|
|
53
53
|
if (mustExist) {
|