@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,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* utils/glob-match 旁测:globToRegExp 匹配语义(原 completion-checkers 与
|
|
3
|
+
* core templated 两份逐字节重复实现的收敛正本)。
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { describe, it, expect } from '@jest/globals';
|
|
7
|
+
import { globToRegExp } from '../glob-match';
|
|
8
|
+
|
|
9
|
+
describe('globToRegExp', () => {
|
|
10
|
+
it('字面量精确匹配', () => {
|
|
11
|
+
expect(globToRegExp('src/index.ts').test('src/index.ts')).toBe(true);
|
|
12
|
+
expect(globToRegExp('src/index.ts').test('src/index.tsx')).toBe(false);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('* 不跨路径分隔符', () => {
|
|
16
|
+
const re = globToRegExp('src/*.ts');
|
|
17
|
+
expect(re.test('src/a.ts')).toBe(true);
|
|
18
|
+
expect(re.test('src/sub/a.ts')).toBe(false);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('**/ 前缀匹配零或多段路径', () => {
|
|
22
|
+
const re = globToRegExp('**/*.test.ts');
|
|
23
|
+
expect(re.test('a.test.ts')).toBe(true);
|
|
24
|
+
expect(re.test('src/x/a.test.ts')).toBe(true);
|
|
25
|
+
expect(re.test('src/a.spec.ts')).toBe(false);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('** 不带 / 匹配任意字符(含 /)', () => {
|
|
29
|
+
const re = globToRegExp('docs/**');
|
|
30
|
+
expect(re.test('docs/a/b/c.md')).toBe(true);
|
|
31
|
+
expect(re.test('src/docs/a.md')).toBe(false);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('? 匹配单个非 / 字符', () => {
|
|
35
|
+
const re = globToRegExp('a?.ts');
|
|
36
|
+
expect(re.test('ab.ts')).toBe(true);
|
|
37
|
+
expect(re.test('a/.ts')).toBe(false);
|
|
38
|
+
expect(re.test('abb.ts')).toBe(false);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('正则元字符按字面量转义', () => {
|
|
42
|
+
const re = globToRegExp('a+b.(ts)');
|
|
43
|
+
expect(re.test('a+b.(ts)')).toBe(true);
|
|
44
|
+
expect(re.test('aab.ts)')).toBe(false);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('锚定:不允许前后缀多余', () => {
|
|
48
|
+
const re = globToRegExp('index.ts');
|
|
49
|
+
expect(re.test('xindex.ts')).toBe(false);
|
|
50
|
+
expect(re.test('index.ts.bak')).toBe(false);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
@@ -50,7 +50,6 @@ const EXPECTED_SKIP_READ_SITES: Record<string, number> = {
|
|
|
50
50
|
'src/core/constraints/usage-report.ts': 1,
|
|
51
51
|
'src/failure/recorder.ts': 1,
|
|
52
52
|
'src/knowledge/reference-tracker.ts': 1,
|
|
53
|
-
'src/monitoring/context-tracker.ts': 1,
|
|
54
53
|
'src/monitoring/traces.ts': 2,
|
|
55
54
|
};
|
|
56
55
|
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* yaml-edit 直接单测(setYamlEntry / removeYamlEntry 自 constraints-retire 抽出后的旁测;
|
|
3
|
+
* 命令级端到端覆盖见 commands/__tests__/constraints-retire.test.ts 的逐字节冻结用例)
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { mkdtempSync, writeFileSync, readFileSync, rmSync, existsSync, statSync } from 'fs';
|
|
7
|
+
import { tmpdir } from 'os';
|
|
8
|
+
import { join } from 'path';
|
|
9
|
+
import * as yaml from 'js-yaml';
|
|
10
|
+
import { describe, it, expect, afterAll } from '@jest/globals';
|
|
11
|
+
import { setYamlEntry, removeYamlEntry } from '../yaml-edit';
|
|
12
|
+
|
|
13
|
+
const dir = mkdtempSync(join(tmpdir(), 'harness-yaml-edit-'));
|
|
14
|
+
afterAll(() => rmSync(dir, { recursive: true, force: true }));
|
|
15
|
+
|
|
16
|
+
function target(name: string): string {
|
|
17
|
+
return join(dir, name);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
describe('setYamlEntry', () => {
|
|
21
|
+
it('文件不存在时创建(含父目录),写入 section.id 补丁', () => {
|
|
22
|
+
const file = target('nested/config.yml');
|
|
23
|
+
setYamlEntry(file, 'config.yml', 'constraints', 'no_foo', { enabled: false });
|
|
24
|
+
const raw = yaml.load(readFileSync(file, 'utf-8')) as Record<string, Record<string, unknown>>;
|
|
25
|
+
expect(raw.constraints.no_foo).toEqual({ enabled: false });
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('已有条目合并补丁,不动其他键', () => {
|
|
29
|
+
const file = target('merge.yml');
|
|
30
|
+
writeFileSync(file, yaml.dump({ constraints: { a: { enabled: false, note: 'keep' }, b: { enabled: true } } }));
|
|
31
|
+
setYamlEntry(file, 'merge.yml', 'constraints', 'a', { retired: { at: 'x' } });
|
|
32
|
+
const raw = yaml.load(readFileSync(file, 'utf-8')) as Record<string, Record<string, Record<string, unknown>>>;
|
|
33
|
+
expect(raw.constraints.a).toEqual({ enabled: false, note: 'keep', retired: { at: 'x' } });
|
|
34
|
+
expect(raw.constraints.b).toEqual({ enabled: true });
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
describe('removeYamlEntry', () => {
|
|
39
|
+
it('删除 section.id 并返回 true', () => {
|
|
40
|
+
const file = target('remove.yml');
|
|
41
|
+
writeFileSync(file, yaml.dump({ constraints: { a: { enabled: false }, b: {} } }));
|
|
42
|
+
expect(removeYamlEntry(file, 'constraints', 'a')).toBe(true);
|
|
43
|
+
const raw = yaml.load(readFileSync(file, 'utf-8')) as Record<string, Record<string, unknown>>;
|
|
44
|
+
expect('a' in raw.constraints).toBe(false);
|
|
45
|
+
expect('b' in raw.constraints).toBe(true);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('文件不存在 → false 且不创建文件', () => {
|
|
49
|
+
const file = target('nonexistent.yml');
|
|
50
|
+
expect(removeYamlEntry(file, 'constraints', 'a')).toBe(false);
|
|
51
|
+
expect(existsSync(file)).toBe(false);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('条目不存在 → false 且零写盘(mtime 不变)', async () => {
|
|
55
|
+
const file = target('noop.yml');
|
|
56
|
+
writeFileSync(file, yaml.dump({ constraints: { b: {} } }));
|
|
57
|
+
const before = statSync(file).mtimeMs;
|
|
58
|
+
await new Promise(r => setTimeout(r, 10));
|
|
59
|
+
expect(removeYamlEntry(file, 'constraints', 'missing')).toBe(false);
|
|
60
|
+
expect(statSync(file).mtimeMs).toBe(before);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* 统一所有源码目录发现逻辑:
|
|
5
5
|
* 1. monorepo: packages/下各包的 src 或 lib 子目录
|
|
6
|
-
* 2. monorepo: apps/下各应用的 src
|
|
6
|
+
* 2. monorepo: apps/下各应用的 src 子目录
|
|
7
7
|
* 3. 单 repo: src/ lib/ 目录
|
|
8
8
|
*
|
|
9
9
|
* 返回相对 projectPath 的路径数组。全都不存在时返回空数组。
|
|
@@ -49,28 +49,10 @@ export function detectSourceRoots(projectPath: string): string[] {
|
|
|
49
49
|
if (!entry.isDirectory() || entry.name.startsWith('.') || entry.name.startsWith('__')) continue;
|
|
50
50
|
const appDir = join(appsDir, entry.name);
|
|
51
51
|
|
|
52
|
-
// apps/api/src/modules/* 的子目录
|
|
53
|
-
const modulesDir = join(appDir, 'src', 'modules');
|
|
54
|
-
if (existsSync(modulesDir)) {
|
|
55
|
-
try {
|
|
56
|
-
const modEntries = readdirSync(modulesDir, { withFileTypes: true });
|
|
57
|
-
for (const mod of modEntries) {
|
|
58
|
-
if (!mod.isDirectory() || mod.name.startsWith('.') || mod.name.startsWith('__')) continue;
|
|
59
|
-
const modPath = join(modulesDir, mod.name);
|
|
60
|
-
if (hasSourceFiles(modPath)) {
|
|
61
|
-
roots.push(`apps/${entry.name}/src/modules/${mod.name}`);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
} catch { /* skip */ }
|
|
65
|
-
}
|
|
66
|
-
|
|
67
52
|
// apps/xxx/src 本身
|
|
68
53
|
const appSrcDir = join(appDir, 'src');
|
|
69
54
|
if (existsSync(appSrcDir) && hasSourceFiles(appSrcDir)) {
|
|
70
|
-
|
|
71
|
-
if (!roots.some(r => r.startsWith(`apps/${entry.name}/src/`))) {
|
|
72
|
-
roots.push(`apps/${entry.name}/src`);
|
|
73
|
-
}
|
|
55
|
+
roots.push(`apps/${entry.name}/src`);
|
|
74
56
|
}
|
|
75
57
|
}
|
|
76
58
|
} catch { /* skip */ }
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 轻量 glob → 锚定正则(支持 `**`、`*`、`?`),纯字符串判定,不碰文件系统。
|
|
3
|
+
*
|
|
4
|
+
* 唯一正本(原 completion-checkers/glob-match.ts 与 core/constraints/checkers/
|
|
5
|
+
* templated/glob.ts 逐字节重复,下沉 utils——core 与 completion-checkers 均在
|
|
6
|
+
* utils 下游白名单,分层守卫(harness#88)不违)。
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
function escapeRegExp(s: string): string {
|
|
10
|
+
return s.replace(/[.+^${}()|[\]\\]/g, '\\$&');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** glob → 锚定正则。前缀 `**` + `/` 匹配零或多段路径;`*` 不跨 `/`;`?` 匹配单个非 `/` 字符 */
|
|
14
|
+
export 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
|
+
}
|
package/src/utils/jsonl.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* append-only JSONL 日志读写正本(harness#82,架构评审 2026-09-02 候选3)
|
|
3
3
|
*
|
|
4
|
-
* 全仓 append-only JSONL(traces.log / failures.log /
|
|
4
|
+
* 全仓 append-only JSONL(traces.log / failures.log /
|
|
5
5
|
* references.jsonl / sessions/<id>/events.jsonl / 外部 transcript .jsonl)的
|
|
6
6
|
* exists → read → split → parse → filter 读链与 ensureDir + append 写链
|
|
7
7
|
* 收口于此,仓内不允许存在第二份副本。
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* YAML 配置文件条目编辑(utils 层共享模块,自 constraints-retire 抽出;
|
|
3
|
+
* harness#198 自 cli 下移——core 的约束变更面也要写 config.yml,分层闸禁止 core 值导入 cli)
|
|
4
|
+
*
|
|
5
|
+
* config.yml 类 YAML 的读-改-写单点(harness#137)。
|
|
6
|
+
* js-yaml 不保留注释:原文件含注释行时重写会丢失,console 说明(`label` 是给用户看的
|
|
7
|
+
* 文件名)。落盘字节由 `commands/__tests__/constraints-retire.test.ts`
|
|
8
|
+
* 的逐字节冻结用例钉住——对外产物不得漂移。
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import * as fs from 'fs';
|
|
12
|
+
import * as path from 'path';
|
|
13
|
+
import * as yaml from 'js-yaml';
|
|
14
|
+
import chalk from 'chalk';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* YAML 条目的读-改-写单点(harness#137)
|
|
18
|
+
*
|
|
19
|
+
* js-yaml 不保留注释:原文件含注释行时重写会丢失,console 说明(`label` 是给用户看的
|
|
20
|
+
* 文件名)。落盘字节由 `commands/__tests__/constraints-retire.test.ts`
|
|
21
|
+
* 的逐字节冻结用例钉住——合并属内部重构,对外产物不得漂移。
|
|
22
|
+
*
|
|
23
|
+
* constraints-disable 复用(裸禁用写 `{ enabled: false }` 同一读-改-写口径)。
|
|
24
|
+
*/
|
|
25
|
+
export function setYamlEntry(
|
|
26
|
+
filePath: string,
|
|
27
|
+
label: string,
|
|
28
|
+
section: string,
|
|
29
|
+
id: string,
|
|
30
|
+
patch: Record<string, unknown>
|
|
31
|
+
): void {
|
|
32
|
+
let raw: Record<string, unknown> = {};
|
|
33
|
+
let hadComments = false;
|
|
34
|
+
if (fs.existsSync(filePath)) {
|
|
35
|
+
const original = fs.readFileSync(filePath, 'utf-8');
|
|
36
|
+
hadComments = original.split('\n').some(l => l.trimStart().startsWith('#'));
|
|
37
|
+
raw = (yaml.load(original) as Record<string, unknown>) ?? {};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const entries = (raw[section] ?? {}) as Record<string, unknown>;
|
|
41
|
+
const prev = (entries[id] ?? {}) as Record<string, unknown>;
|
|
42
|
+
entries[id] = { ...prev, ...patch };
|
|
43
|
+
raw[section] = entries;
|
|
44
|
+
|
|
45
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
46
|
+
fs.writeFileSync(filePath, yaml.dump(raw, { lineWidth: 120 }), 'utf-8');
|
|
47
|
+
|
|
48
|
+
if (hadComments) {
|
|
49
|
+
console.log(chalk.yellow(` ⚠️ ${label} 已重写:js-yaml 不保留原文件注释`));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* YAML 条目的删除单点(constraints reactivate 用,与 setYamlEntry 同一读-改-写口径)
|
|
55
|
+
*
|
|
56
|
+
* 删除 config.yml `section.id` 整个 key;段/条目不存在时零写盘。返回是否实际删除。
|
|
57
|
+
*/
|
|
58
|
+
export function removeYamlEntry(filePath: string, section: string, id: string): boolean {
|
|
59
|
+
if (!fs.existsSync(filePath)) return false;
|
|
60
|
+
const raw = (yaml.load(fs.readFileSync(filePath, 'utf-8')) as Record<string, unknown>) ?? {};
|
|
61
|
+
const entries = (raw[section] ?? {}) as Record<string, unknown>;
|
|
62
|
+
if (!(id in entries)) return false;
|
|
63
|
+
delete entries[id];
|
|
64
|
+
raw[section] = entries;
|
|
65
|
+
fs.writeFileSync(filePath, yaml.dump(raw, { lineWidth: 120 }), 'utf-8');
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# PostToolUse hook — track deep analysis + session metrics
|
|
3
|
-
# Matcher: EnterPlanMode|Agent|Read|Write|Edit|Bash (broad coverage)
|
|
4
|
-
# DailyReflection: enriched session:summary events for behavioral analysis
|
|
5
|
-
|
|
6
|
-
STATE_FILE=/tmp/claude-knowledge-capture-state.json
|
|
7
|
-
INPUT=$(cat)
|
|
8
|
-
|
|
9
|
-
tool_name=$(echo "$INPUT" | jq -r '.tool_name // ""')
|
|
10
|
-
file_path=$(echo "$INPUT" | jq -r '.tool_input.file_path // ""')
|
|
11
|
-
|
|
12
|
-
# Init state file if missing (tool: claude|codex|opencode|etc)
|
|
13
|
-
_tool=$(echo "${CLAUDE_CODE_TOOL_NAME:-claude}" | tr '[:upper:]' '[:lower:]')
|
|
14
|
-
[ -f "$STATE_FILE" ] || echo "{\"planned\":false,\"explored\":false,\"readDirs\":[],\"captured\":false,\"turnCount\":0,\"startTime\":$(date +%s)000,\"tool\":\"$_tool\"}" > "$STATE_FILE"
|
|
15
|
-
|
|
16
|
-
# Always increment turn counter on substantive tools
|
|
17
|
-
case "$tool_name" in
|
|
18
|
-
EnterPlanMode)
|
|
19
|
-
jq '.planned = true | .turnCount += 1' "$STATE_FILE" > "${STATE_FILE}.tmp" && mv "${STATE_FILE}.tmp" "$STATE_FILE"
|
|
20
|
-
;;
|
|
21
|
-
Agent)
|
|
22
|
-
# Agent(Explore) spawned → deep analysis signal
|
|
23
|
-
_agent_type=$(echo "$INPUT" | jq -r '.tool_input.subagent_type // ""')
|
|
24
|
-
if [ "$_agent_type" = "Explore" ]; then
|
|
25
|
-
jq '.explored = true | .turnCount += 1' "$STATE_FILE" > "${STATE_FILE}.tmp" && mv "${STATE_FILE}.tmp" "$STATE_FILE"
|
|
26
|
-
fi
|
|
27
|
-
;;
|
|
28
|
-
Read)
|
|
29
|
-
if [ -n "$file_path" ]; then
|
|
30
|
-
dir=$(dirname "$file_path")
|
|
31
|
-
if [ "$dir" != "." ] && [ "$dir" != "/" ]; then
|
|
32
|
-
jq --arg d "$dir" '.readDirs += [$d] | .readDirs |= unique | .turnCount += 1' "$STATE_FILE" > "${STATE_FILE}.tmp" && mv "${STATE_FILE}.tmp" "$STATE_FILE"
|
|
33
|
-
fi
|
|
34
|
-
fi
|
|
35
|
-
;;
|
|
36
|
-
Write|Edit)
|
|
37
|
-
jq '.turnCount += 1' "$STATE_FILE" > "${STATE_FILE}.tmp" && mv "${STATE_FILE}.tmp" "$STATE_FILE"
|
|
38
|
-
case "$file_path" in
|
|
39
|
-
*.harness/knowledge-docs/*|*.harness/knowledge/*|*/memory/*.md|*/docs/*.md)
|
|
40
|
-
jq '.captured = true' "$STATE_FILE" > "${STATE_FILE}.tmp" && mv "${STATE_FILE}.tmp" "$STATE_FILE"
|
|
41
|
-
;;
|
|
42
|
-
esac
|
|
43
|
-
;;
|
|
44
|
-
Bash)
|
|
45
|
-
jq '.turnCount += 1' "$STATE_FILE" > "${STATE_FILE}.tmp" && mv "${STATE_FILE}.tmp" "$STATE_FILE"
|
|
46
|
-
;;
|
|
47
|
-
esac
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# PostToolUse hook — check for operations on sensitive files without prior Read
|
|
3
|
-
#
|
|
4
|
-
# Detects: Bash(mv/rm), Edit, or Write targeting files in bin/, .harness/, or
|
|
5
|
-
# package.json — and checks whether those files were Read earlier in this session.
|
|
6
|
-
#
|
|
7
|
-
# State file is maintained by harness-knowledge-track.sh which tracks all Read calls.
|
|
8
|
-
|
|
9
|
-
STATE_FILE=/tmp/claude-knowledge-capture-state.json
|
|
10
|
-
SENSITIVE_DIRS="bin/ .harness/"
|
|
11
|
-
|
|
12
|
-
INPUT=$(cat)
|
|
13
|
-
tool_name=$(echo "$INPUT" | jq -r '.tool_name // ""')
|
|
14
|
-
file_path=$(echo "$INPUT" | jq -r '.tool_input.file_path // ""')
|
|
15
|
-
content=$(echo "$INPUT" | jq -r '.tool_input.content // ""')
|
|
16
|
-
command=$(echo "$INPUT" | jq -r '.tool_input.command // ""')
|
|
17
|
-
|
|
18
|
-
# Check if this operation targets a sensitive file
|
|
19
|
-
is_sensitive=false
|
|
20
|
-
for dir in $SENSITIVE_DIRS; do
|
|
21
|
-
case "$file_path" in
|
|
22
|
-
*$dir*) is_sensitive=true; break ;;
|
|
23
|
-
esac
|
|
24
|
-
done
|
|
25
|
-
|
|
26
|
-
# For Bash, check if the command involves mv/rm on sensitive paths
|
|
27
|
-
if [ "$tool_name" = "Bash" ] && [ -n "$command" ]; then
|
|
28
|
-
for dir in $SENSITIVE_DIRS; do
|
|
29
|
-
if echo "$command" | grep -qE "(mv|rm|cp|git rm).*$dir"; then
|
|
30
|
-
is_sensitive=true
|
|
31
|
-
# Extract target from command for checking
|
|
32
|
-
file_path=$(echo "$command" | grep -oE "$dir[^ ]*" | head -1)
|
|
33
|
-
break
|
|
34
|
-
fi
|
|
35
|
-
done
|
|
36
|
-
fi
|
|
37
|
-
|
|
38
|
-
# Only check sensitive operations
|
|
39
|
-
if [ "$is_sensitive" != "true" ] || [ -z "$file_path" ]; then
|
|
40
|
-
exit 0
|
|
41
|
-
fi
|
|
42
|
-
|
|
43
|
-
# Check if this file was Read earlier in the session
|
|
44
|
-
if [ -f "$STATE_FILE" ]; then
|
|
45
|
-
read_dirs=$(jq -r '.readDirs // [] | join(" ")' "$STATE_FILE" 2>/dev/null || echo "")
|
|
46
|
-
|
|
47
|
-
# Check if any read_dir is an ancestor of file_path
|
|
48
|
-
verified=false
|
|
49
|
-
file_dir=$(dirname "$file_path")
|
|
50
|
-
for dir in $read_dirs; do
|
|
51
|
-
case "$file_dir" in
|
|
52
|
-
"$dir"|"$dir/"*) verified=true; break ;;
|
|
53
|
-
esac
|
|
54
|
-
done
|
|
55
|
-
|
|
56
|
-
if [ "$verified" != "true" ]; then
|
|
57
|
-
# Also check if the file itself was explicitly Read (file_path matches a read path)
|
|
58
|
-
# The track hook only records directories, not individual files — conservative check
|
|
59
|
-
|
|
60
|
-
# Emit warning via state file for Stop hook to pick up
|
|
61
|
-
jq --arg op "$tool_name" --arg fp "$file_path" \
|
|
62
|
-
'.sensitiveOps += [{"tool":$op,"file":$fp,"verified":false}]' \
|
|
63
|
-
"$STATE_FILE" > "${STATE_FILE}.tmp" && mv "${STATE_FILE}.tmp" "$STATE_FILE"
|
|
64
|
-
fi
|
|
65
|
-
fi
|
|
66
|
-
|
|
67
|
-
exit 0
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @spec HZ-002
|
|
3
|
-
* @implements HZ-002-C2
|
|
4
|
-
* @acceptance AC-001-2
|
|
5
|
-
*
|
|
6
|
-
* Token Budget Manager
|
|
7
|
-
*
|
|
8
|
-
* Token 预算管理和估算工具
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* Token 估算器
|
|
12
|
-
*
|
|
13
|
-
* 提供常用的 Token 估算方法
|
|
14
|
-
*/
|
|
15
|
-
export declare class TokenEstimator {
|
|
16
|
-
/**
|
|
17
|
-
* 估算文本的 Token 数(简化版)
|
|
18
|
-
*
|
|
19
|
-
* 基于字符数估算,假设 1 token ≈ 4 字符(英文)
|
|
20
|
-
* 中文按 1 token ≈ 1.5 字符计算
|
|
21
|
-
*
|
|
22
|
-
* 注意:这是快速估算,不是精确值
|
|
23
|
-
* 精确值需要使用 tokenizer(如 tiktoken)
|
|
24
|
-
*/
|
|
25
|
-
static estimateText(text: string): number;
|
|
26
|
-
/**
|
|
27
|
-
* 估算对象的 Token 数
|
|
28
|
-
*
|
|
29
|
-
* 将对象转为 JSON 字符串后估算
|
|
30
|
-
*/
|
|
31
|
-
static estimateObject(obj: any): number;
|
|
32
|
-
/**
|
|
33
|
-
* 估算数组的 Token 数
|
|
34
|
-
*/
|
|
35
|
-
static estimateArray<T>(items: T[], itemEstimator?: (item: T) => number): number;
|
|
36
|
-
/**
|
|
37
|
-
* 创建自定义估算器
|
|
38
|
-
*/
|
|
39
|
-
static createFieldEstimator<T>(fieldMap: Record<string, (value: any) => number>): (item: T) => number;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Token 预算分配器
|
|
43
|
-
*
|
|
44
|
-
* 管理 Token 预算的分配和使用
|
|
45
|
-
*/
|
|
46
|
-
export declare class TokenBudget {
|
|
47
|
-
private totalBudget;
|
|
48
|
-
private usedTokens;
|
|
49
|
-
private reservedTokens;
|
|
50
|
-
constructor(budget: number);
|
|
51
|
-
/**
|
|
52
|
-
* 获取剩余预算
|
|
53
|
-
*/
|
|
54
|
-
get remaining(): number;
|
|
55
|
-
/**
|
|
56
|
-
* 获取已使用预算
|
|
57
|
-
*/
|
|
58
|
-
get used(): number;
|
|
59
|
-
/**
|
|
60
|
-
* 获取总预算
|
|
61
|
-
*/
|
|
62
|
-
get total(): number;
|
|
63
|
-
/**
|
|
64
|
-
* 预留预算
|
|
65
|
-
*
|
|
66
|
-
* @returns 是否预留成功
|
|
67
|
-
*/
|
|
68
|
-
reserve(amount: number): boolean;
|
|
69
|
-
/**
|
|
70
|
-
* 释放预留的预算
|
|
71
|
-
*/
|
|
72
|
-
release(amount: number): void;
|
|
73
|
-
/**
|
|
74
|
-
* 使用预算
|
|
75
|
-
*
|
|
76
|
-
* @returns 是否使用成功
|
|
77
|
-
*/
|
|
78
|
-
consume(amount: number): boolean;
|
|
79
|
-
/**
|
|
80
|
-
* 强制使用(可能超预算)
|
|
81
|
-
*/
|
|
82
|
-
forceConsume(amount: number): void;
|
|
83
|
-
/**
|
|
84
|
-
* 增加预算
|
|
85
|
-
*/
|
|
86
|
-
addBudget(amount: number): void;
|
|
87
|
-
/**
|
|
88
|
-
* 检查是否有足够预算
|
|
89
|
-
*/
|
|
90
|
-
canAfford(amount: number): boolean;
|
|
91
|
-
/**
|
|
92
|
-
* 获取预算使用比例
|
|
93
|
-
*/
|
|
94
|
-
get usageRatio(): number;
|
|
95
|
-
/**
|
|
96
|
-
* 获取预算状态
|
|
97
|
-
*/
|
|
98
|
-
get status(): 'healthy' | 'warning' | 'critical';
|
|
99
|
-
/**
|
|
100
|
-
* 重置预算
|
|
101
|
-
*/
|
|
102
|
-
reset(newBudget?: number): void;
|
|
103
|
-
/**
|
|
104
|
-
* 获取预算报告
|
|
105
|
-
*/
|
|
106
|
-
getReport(): {
|
|
107
|
-
total: number;
|
|
108
|
-
used: number;
|
|
109
|
-
reserved: number;
|
|
110
|
-
remaining: number;
|
|
111
|
-
usageRatio: number;
|
|
112
|
-
status: 'healthy' | 'warning' | 'critical';
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
//# sourceMappingURL=token-budget.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"token-budget.d.ts","sourceRoot":"","sources":["../../src/context/token-budget.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;GAIG;AACH,qBAAa,cAAc;IACzB;;;;;;;;OAQG;IACH,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAezC;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM;IASvC;;OAEG;IACH,MAAM,CAAC,aAAa,CAAC,CAAC,EACpB,KAAK,EAAE,CAAC,EAAE,EACV,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GAClC,MAAM;IAOT;;OAEG;IACH,MAAM,CAAC,oBAAoB,CAAC,CAAC,EAC3B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,MAAM,CAAC,GAC/C,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM;CAUvB;AAED;;;;GAIG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,cAAc,CAAa;gBAEvB,MAAM,EAAE,MAAM;IAI1B;;OAEG;IACH,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;OAEG;IACH,IAAI,KAAK,IAAI,MAAM,CAElB;IAED;;;;OAIG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAQhC;;OAEG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAI7B;;;;OAIG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAQhC;;OAEG;IACH,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAIlC;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAI/B;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAIlC;;OAEG;IACH,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,SAAS,GAAG,SAAS,GAAG,UAAU,CAK/C;IAED;;OAEG;IACH,KAAK,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI;IAQ/B;;OAEG;IACH,SAAS,IAAI;QACX,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,MAAM,CAAC;QACnB,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC;KAC5C;CAUF"}
|