@dommaker/harness 1.15.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/bin/harness.js +6 -0
- package/dist/agents/lifecycle.d.ts.map +1 -1
- package/dist/agents/lifecycle.js +3 -6
- package/dist/agents/lifecycle.js.map +1 -1
- package/dist/cli/command-contract.d.ts +10 -13
- package/dist/cli/command-contract.d.ts.map +1 -1
- package/dist/cli/command-contract.js +6 -0
- package/dist/cli/command-contract.js.map +1 -1
- package/dist/cli/commands/acceptance.d.ts.map +1 -1
- package/dist/cli/commands/acceptance.js +8 -7
- package/dist/cli/commands/acceptance.js.map +1 -1
- package/dist/cli/commands/command.d.ts.map +1 -1
- package/dist/cli/commands/command.js +5 -5
- package/dist/cli/commands/command.js.map +1 -1
- package/dist/cli/commands/constraints-disable.d.ts +7 -11
- package/dist/cli/commands/constraints-disable.d.ts.map +1 -1
- package/dist/cli/commands/constraints-disable.js +8 -80
- package/dist/cli/commands/constraints-disable.js.map +1 -1
- package/dist/cli/commands/constraints-pack-proposal.d.ts +7 -20
- package/dist/cli/commands/constraints-pack-proposal.d.ts.map +1 -1
- package/dist/cli/commands/constraints-pack-proposal.js +21 -129
- package/dist/cli/commands/constraints-pack-proposal.js.map +1 -1
- package/dist/cli/commands/constraints-reactivate.d.ts +8 -20
- package/dist/cli/commands/constraints-reactivate.d.ts.map +1 -1
- package/dist/cli/commands/constraints-reactivate.js +11 -105
- package/dist/cli/commands/constraints-reactivate.js.map +1 -1
- package/dist/cli/commands/constraints-retire.d.ts +11 -67
- package/dist/cli/commands/constraints-retire.d.ts.map +1 -1
- package/dist/cli/commands/constraints-retire.js +20 -196
- package/dist/cli/commands/constraints-retire.js.map +1 -1
- package/dist/cli/commands/constraints.d.ts +6 -9
- package/dist/cli/commands/constraints.d.ts.map +1 -1
- package/dist/cli/commands/constraints.js +7 -21
- package/dist/cli/commands/constraints.js.map +1 -1
- package/dist/cli/commands/contract.d.ts.map +1 -1
- package/dist/cli/commands/contract.js +20 -10
- package/dist/cli/commands/contract.js.map +1 -1
- package/dist/cli/commands/definitions.d.ts.map +1 -1
- package/dist/cli/commands/definitions.js +13 -12
- package/dist/cli/commands/definitions.js.map +1 -1
- package/dist/cli/commands/init/ci-platform.d.ts +35 -0
- package/dist/cli/commands/init/ci-platform.d.ts.map +1 -0
- package/dist/cli/commands/init/ci-platform.js +59 -0
- package/dist/cli/commands/init/ci-platform.js.map +1 -0
- package/dist/cli/commands/init/ci-wiring.d.ts +20 -0
- package/dist/cli/commands/init/ci-wiring.d.ts.map +1 -0
- package/dist/cli/commands/init/ci-wiring.js +72 -0
- package/dist/cli/commands/init/ci-wiring.js.map +1 -0
- package/dist/cli/commands/init/git-hooks.d.ts +15 -0
- package/dist/cli/commands/init/git-hooks.d.ts.map +1 -0
- package/dist/{tools/paths.js → cli/commands/init/git-hooks.js} +25 -12
- package/dist/cli/commands/init/git-hooks.js.map +1 -0
- package/dist/cli/commands/init/governance.d.ts +14 -0
- package/dist/cli/commands/init/governance.d.ts.map +1 -0
- package/dist/cli/commands/init/governance.js +132 -0
- package/dist/cli/commands/init/governance.js.map +1 -0
- package/dist/cli/commands/{init.d.ts → init/index.d.ts} +13 -14
- package/dist/cli/commands/init/index.d.ts.map +1 -0
- package/dist/cli/commands/init/index.js +148 -0
- package/dist/cli/commands/init/index.js.map +1 -0
- package/dist/cli/commands/init/output-style.d.ts +19 -0
- package/dist/cli/commands/init/output-style.d.ts.map +1 -0
- package/dist/cli/commands/init/output-style.js +110 -0
- package/dist/cli/commands/init/output-style.js.map +1 -0
- package/dist/cli/commands/init/presets.d.ts +26 -0
- package/dist/cli/commands/init/presets.d.ts.map +1 -0
- package/dist/cli/commands/init/presets.js +104 -0
- package/dist/cli/commands/init/presets.js.map +1 -0
- package/dist/cli/commands/init/snippets.d.ts +18 -0
- package/dist/cli/commands/init/snippets.d.ts.map +1 -0
- package/dist/cli/commands/init/snippets.js +49 -0
- package/dist/cli/commands/init/snippets.js.map +1 -0
- package/dist/cli/commands/knowledge/audit.d.ts +30 -0
- package/dist/cli/commands/knowledge/audit.d.ts.map +1 -0
- package/dist/cli/commands/knowledge/audit.js +114 -0
- package/dist/cli/commands/knowledge/audit.js.map +1 -0
- package/dist/cli/commands/knowledge/decay.d.ts +19 -0
- package/dist/cli/commands/knowledge/decay.d.ts.map +1 -0
- package/dist/cli/commands/knowledge/decay.js +48 -0
- package/dist/cli/commands/knowledge/decay.js.map +1 -0
- package/dist/cli/commands/knowledge/health.d.ts +36 -0
- package/dist/cli/commands/knowledge/health.d.ts.map +1 -0
- package/dist/cli/commands/knowledge/health.js +172 -0
- package/dist/cli/commands/knowledge/health.js.map +1 -0
- package/dist/cli/commands/knowledge/import.d.ts +26 -0
- package/dist/cli/commands/knowledge/import.d.ts.map +1 -0
- package/dist/cli/commands/knowledge/import.js +63 -0
- package/dist/cli/commands/knowledge/import.js.map +1 -0
- package/dist/cli/commands/knowledge/index.d.ts +25 -0
- package/dist/cli/commands/knowledge/index.d.ts.map +1 -0
- package/dist/cli/commands/knowledge/index.js +84 -0
- package/dist/cli/commands/knowledge/index.js.map +1 -0
- package/dist/cli/commands/knowledge/list.d.ts +25 -0
- package/dist/cli/commands/knowledge/list.d.ts.map +1 -0
- package/dist/cli/commands/knowledge/list.js +60 -0
- package/dist/cli/commands/knowledge/list.js.map +1 -0
- package/dist/cli/commands/knowledge/migrate.d.ts +21 -0
- package/dist/cli/commands/knowledge/migrate.d.ts.map +1 -0
- package/dist/cli/commands/knowledge/migrate.js +48 -0
- package/dist/cli/commands/knowledge/migrate.js.map +1 -0
- package/dist/cli/commands/knowledge/search.d.ts +32 -0
- package/dist/cli/commands/knowledge/search.d.ts.map +1 -0
- package/dist/cli/commands/knowledge/search.js +73 -0
- package/dist/cli/commands/knowledge/search.js.map +1 -0
- package/dist/cli/commands/knowledge/shared.d.ts +14 -0
- package/dist/cli/commands/knowledge/shared.d.ts.map +1 -0
- package/dist/cli/commands/knowledge/shared.js +6 -0
- package/dist/cli/commands/knowledge/shared.js.map +1 -0
- package/dist/cli/commands/knowledge/snapshot.d.ts +18 -0
- package/dist/cli/commands/knowledge/snapshot.d.ts.map +1 -0
- package/dist/cli/commands/knowledge/snapshot.js +34 -0
- package/dist/cli/commands/knowledge/snapshot.js.map +1 -0
- package/dist/cli/commands/knowledge/stats.d.ts +26 -0
- package/dist/cli/commands/knowledge/stats.d.ts.map +1 -0
- package/dist/cli/commands/knowledge/stats.js +132 -0
- package/dist/cli/commands/knowledge/stats.js.map +1 -0
- package/dist/cli/commands/knowledge/sync-rag.d.ts +19 -0
- package/dist/cli/commands/knowledge/sync-rag.d.ts.map +1 -0
- package/dist/cli/commands/knowledge/sync-rag.js +77 -0
- package/dist/cli/commands/knowledge/sync-rag.js.map +1 -0
- package/dist/cli/commands/knowledge-view.d.ts +2 -1
- package/dist/cli/commands/knowledge-view.d.ts.map +1 -1
- package/dist/cli/commands/knowledge-view.js +2 -2
- package/dist/cli/commands/knowledge-view.js.map +1 -1
- package/dist/cli/commands/passes-gate.d.ts.map +1 -1
- package/dist/cli/commands/passes-gate.js +12 -2
- package/dist/cli/commands/passes-gate.js.map +1 -1
- package/dist/cli/commands/performance.js.map +1 -1
- package/dist/cli/commands/release.d.ts +2 -2
- package/dist/cli/commands/release.d.ts.map +1 -1
- package/dist/cli/commands/release.js +15 -43
- package/dist/cli/commands/release.js.map +1 -1
- package/dist/cli/commands/review.d.ts.map +1 -1
- package/dist/cli/commands/review.js +3 -2
- package/dist/cli/commands/review.js.map +1 -1
- package/dist/cli/commands/scaffold-templates.d.ts +7 -0
- package/dist/cli/commands/scaffold-templates.d.ts.map +1 -1
- package/dist/cli/commands/scaffold-templates.js +21 -1
- package/dist/cli/commands/scaffold-templates.js.map +1 -1
- package/dist/cli/commands/security.d.ts.map +1 -1
- package/dist/cli/commands/security.js +7 -8
- package/dist/cli/commands/security.js.map +1 -1
- package/dist/cli/commands/spec-baseline-check.d.ts.map +1 -1
- package/dist/cli/commands/spec-baseline-check.js +6 -5
- package/dist/cli/commands/spec-baseline-check.js.map +1 -1
- package/dist/cli/commands/status.js +2 -2
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/sync-docs/agents-syncer.js +31 -55
- package/dist/cli/commands/sync-docs/agents-syncer.js.map +1 -1
- package/dist/cli/commands/sync-docs/capabilities-syncer.d.ts.map +1 -1
- package/dist/cli/commands/sync-docs/capabilities-syncer.js +18 -12
- package/dist/cli/commands/sync-docs/capabilities-syncer.js.map +1 -1
- package/dist/cli/commands/sync-docs/compact.d.ts +9 -0
- package/dist/cli/commands/sync-docs/compact.d.ts.map +1 -0
- package/dist/cli/commands/sync-docs/compact.js +73 -0
- package/dist/cli/commands/sync-docs/compact.js.map +1 -0
- package/dist/cli/commands/sync-docs/context-syncer.d.ts +13 -0
- package/dist/cli/commands/sync-docs/context-syncer.d.ts.map +1 -1
- package/dist/cli/commands/sync-docs/context-syncer.js +40 -29
- package/dist/cli/commands/sync-docs/context-syncer.js.map +1 -1
- package/dist/cli/commands/sync-docs/gate.d.ts +27 -0
- package/dist/cli/commands/sync-docs/gate.d.ts.map +1 -0
- package/dist/cli/commands/sync-docs/gate.js +72 -0
- package/dist/cli/commands/sync-docs/gate.js.map +1 -0
- package/dist/cli/commands/sync-docs/index.d.ts +13 -27
- package/dist/cli/commands/sync-docs/index.d.ts.map +1 -1
- package/dist/cli/commands/sync-docs/index.js +19 -503
- package/dist/cli/commands/sync-docs/index.js.map +1 -1
- package/dist/cli/commands/sync-docs/main-flow.d.ts +37 -0
- package/dist/cli/commands/sync-docs/main-flow.d.ts.map +1 -0
- package/dist/cli/commands/sync-docs/main-flow.js +485 -0
- package/dist/cli/commands/sync-docs/main-flow.js.map +1 -0
- package/dist/cli/commands/sync-docs/project-reader.d.ts +6 -1
- package/dist/cli/commands/sync-docs/project-reader.d.ts.map +1 -1
- package/dist/cli/commands/sync-docs/project-reader.js +16 -25
- package/dist/cli/commands/sync-docs/project-reader.js.map +1 -1
- package/dist/cli/commands/validate.d.ts.map +1 -1
- package/dist/cli/commands/validate.js +7 -0
- package/dist/cli/commands/validate.js.map +1 -1
- package/dist/cli/gate-command.d.ts +1 -1
- package/dist/cli/gate-command.d.ts.map +1 -1
- package/dist/cli/gate-command.js +1 -1
- package/dist/cli/gate-command.js.map +1 -1
- package/dist/completion-checkers/glob-match.d.ts +1 -1
- package/dist/completion-checkers/glob-match.d.ts.map +1 -1
- package/dist/completion-checkers/glob-match.js +3 -38
- package/dist/completion-checkers/glob-match.js.map +1 -1
- package/dist/context/index.d.ts +2 -5
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +2 -9
- package/dist/context/index.js.map +1 -1
- package/dist/context/session-manager.d.ts +2 -8
- package/dist/context/session-manager.d.ts.map +1 -1
- package/dist/context/session-manager.js +31 -61
- package/dist/context/session-manager.js.map +1 -1
- package/dist/context/types.d.ts +2 -26
- package/dist/context/types.d.ts.map +1 -1
- package/dist/core/config-files.d.ts +21 -0
- package/dist/core/config-files.d.ts.map +1 -0
- package/dist/core/config-files.js +75 -0
- package/dist/core/config-files.js.map +1 -0
- package/dist/core/constraint-lifecycle.d.ts +127 -0
- package/dist/core/constraint-lifecycle.d.ts.map +1 -0
- package/dist/core/constraint-lifecycle.js +306 -0
- package/dist/core/constraint-lifecycle.js.map +1 -0
- package/dist/core/constraints/capabilities-parser.d.ts +2 -1
- package/dist/core/constraints/capabilities-parser.d.ts.map +1 -1
- package/dist/core/constraints/capabilities-parser.js +4 -6
- package/dist/core/constraints/capabilities-parser.js.map +1 -1
- package/dist/core/constraints/checker.d.ts +9 -1
- package/dist/core/constraints/checker.d.ts.map +1 -1
- package/dist/core/constraints/checker.js +18 -0
- package/dist/core/constraints/checker.js.map +1 -1
- package/dist/core/constraints/checkers/no-completion-without-verification.d.ts +6 -1
- package/dist/core/constraints/checkers/no-completion-without-verification.d.ts.map +1 -1
- package/dist/core/constraints/checkers/no-completion-without-verification.js +17 -1
- package/dist/core/constraints/checkers/no-completion-without-verification.js.map +1 -1
- package/dist/core/constraints/checkers/no-hardcoded-credentials.d.ts +0 -2
- package/dist/core/constraints/checkers/no-hardcoded-credentials.d.ts.map +1 -1
- package/dist/core/constraints/checkers/no-hardcoded-credentials.js +0 -5
- package/dist/core/constraints/checkers/no-hardcoded-credentials.js.map +1 -1
- package/dist/core/constraints/checkers/templated/exec.d.ts.map +1 -1
- package/dist/core/constraints/checkers/templated/exec.js +1 -0
- package/dist/core/constraints/checkers/templated/exec.js.map +1 -1
- package/dist/core/constraints/checkers/templated/file-exists.js +2 -2
- package/dist/core/constraints/checkers/templated/file-exists.js.map +1 -1
- package/dist/core/constraints/checkers/templated/glob.d.ts +2 -3
- package/dist/core/constraints/checkers/templated/glob.d.ts.map +1 -1
- package/dist/core/constraints/checkers/templated/glob.js +4 -40
- package/dist/core/constraints/checkers/templated/glob.js.map +1 -1
- package/dist/core/constraints/construction-sites.d.ts +56 -0
- package/dist/core/constraints/construction-sites.d.ts.map +1 -0
- package/dist/core/constraints/construction-sites.js +75 -0
- package/dist/core/constraints/construction-sites.js.map +1 -0
- package/dist/core/constraints/context-builder.d.ts.map +1 -1
- package/dist/core/constraints/context-builder.js +13 -34
- package/dist/core/constraints/context-builder.js.map +1 -1
- package/dist/core/constraints/definitions/guidelines.d.ts.map +1 -1
- package/dist/core/constraints/definitions/guidelines.js +18 -0
- package/dist/core/constraints/definitions/guidelines.js.map +1 -1
- package/dist/core/constraints/definitions/iron-laws.d.ts.map +1 -1
- package/dist/core/constraints/definitions/iron-laws.js +0 -16
- package/dist/core/constraints/definitions/iron-laws.js.map +1 -1
- package/dist/core/constraints/doc-freshness/runner.d.ts.map +1 -1
- package/dist/core/constraints/doc-freshness/runner.js +192 -221
- package/dist/core/constraints/doc-freshness/runner.js.map +1 -1
- package/dist/core/constraints/git-evidence.d.ts.map +1 -1
- package/dist/core/constraints/git-evidence.js +2 -0
- package/dist/core/constraints/git-evidence.js.map +1 -1
- package/dist/core/constraints/index.d.ts +0 -2
- package/dist/core/constraints/index.d.ts.map +1 -1
- package/dist/core/constraints/index.js +1 -4
- package/dist/core/constraints/index.js.map +1 -1
- package/dist/core/constraints/injection-writer.d.ts +1 -0
- package/dist/core/constraints/injection-writer.d.ts.map +1 -1
- package/dist/core/constraints/injection-writer.js +3 -6
- package/dist/core/constraints/injection-writer.js.map +1 -1
- package/dist/core/constraints/meta.d.ts +18 -0
- package/dist/core/constraints/meta.d.ts.map +1 -0
- package/dist/core/constraints/meta.js +31 -0
- package/dist/core/constraints/meta.js.map +1 -0
- package/dist/core/constraints/pack-proposal.d.ts +66 -0
- package/dist/core/constraints/pack-proposal.d.ts.map +1 -0
- package/dist/core/constraints/pack-proposal.js +181 -0
- package/dist/core/constraints/pack-proposal.js.map +1 -0
- package/dist/core/constraints/usage-report.d.ts +3 -1
- package/dist/core/constraints/usage-report.d.ts.map +1 -1
- package/dist/core/constraints/usage-report.js +3 -1
- package/dist/core/constraints/usage-report.js.map +1 -1
- package/dist/core/effective-constraints.d.ts +6 -6
- package/dist/core/effective-constraints.d.ts.map +1 -1
- package/dist/core/effective-constraints.js +6 -6
- package/dist/core/effective-constraints.js.map +1 -1
- package/dist/core/index.d.ts +3 -6
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +1 -6
- package/dist/core/index.js.map +1 -1
- package/dist/core/project-config-loader.d.ts +3 -1
- package/dist/core/project-config-loader.d.ts.map +1 -1
- package/dist/core/project-config-loader.js +6 -6
- package/dist/core/project-config-loader.js.map +1 -1
- package/dist/core/spec/validator.d.ts +1 -1
- package/dist/core/spec/validator.d.ts.map +1 -1
- package/dist/core/spec/validator.js +41 -36
- package/dist/core/spec/validator.js.map +1 -1
- package/dist/core/validators/check-handlers/command.d.ts.map +1 -1
- package/dist/core/validators/check-handlers/command.js +49 -8
- package/dist/core/validators/check-handlers/command.js.map +1 -1
- package/dist/core/validators/check-handlers/http.d.ts.map +1 -1
- package/dist/core/validators/check-handlers/http.js +6 -4
- package/dist/core/validators/check-handlers/http.js.map +1 -1
- package/dist/core/validators/check-handlers/output.d.ts +1 -1
- package/dist/core/validators/check-handlers/output.d.ts.map +1 -1
- package/dist/core/validators/check-handlers/output.js +2 -1
- package/dist/core/validators/check-handlers/output.js.map +1 -1
- package/dist/core/validators/passes-gate.d.ts +2 -1
- package/dist/core/validators/passes-gate.d.ts.map +1 -1
- package/dist/core/validators/passes-gate.js +25 -30
- package/dist/core/validators/passes-gate.js.map +1 -1
- package/dist/gates/acceptance.d.ts +37 -18
- package/dist/gates/acceptance.d.ts.map +1 -1
- package/dist/gates/acceptance.js +129 -97
- package/dist/gates/acceptance.js.map +1 -1
- package/dist/gates/checker-gate.d.ts +2 -1
- package/dist/gates/checker-gate.d.ts.map +1 -1
- package/dist/gates/checker-gate.js +2 -1
- package/dist/gates/checker-gate.js.map +1 -1
- package/dist/gates/command.d.ts +3 -20
- package/dist/gates/command.d.ts.map +1 -1
- package/dist/gates/command.js +2 -35
- package/dist/gates/command.js.map +1 -1
- package/dist/gates/contract.d.ts +11 -2
- package/dist/gates/contract.d.ts.map +1 -1
- package/dist/gates/contract.js +57 -62
- package/dist/gates/contract.js.map +1 -1
- package/dist/gates/definitions.d.ts +1 -1
- package/dist/gates/definitions.d.ts.map +1 -1
- package/dist/gates/definitions.js +1 -1
- package/dist/gates/definitions.js.map +1 -1
- package/dist/gates/performance.d.ts +1 -1
- package/dist/gates/performance.d.ts.map +1 -1
- package/dist/gates/performance.js +18 -8
- package/dist/gates/performance.js.map +1 -1
- package/dist/gates/registry.d.ts.map +1 -1
- package/dist/gates/registry.js +7 -3
- package/dist/gates/registry.js.map +1 -1
- package/dist/gates/review.d.ts.map +1 -1
- package/dist/gates/review.js +16 -2
- package/dist/gates/review.js.map +1 -1
- package/dist/gates/security.d.ts +5 -1
- package/dist/gates/security.d.ts.map +1 -1
- package/dist/gates/security.js +57 -63
- package/dist/gates/security.js.map +1 -1
- package/dist/gates/types.d.ts +12 -72
- package/dist/gates/types.d.ts.map +1 -1
- package/dist/gates/types.js +5 -1
- package/dist/gates/types.js.map +1 -1
- package/dist/index.d.ts +23 -20
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +38 -65
- package/dist/index.js.map +1 -1
- package/dist/knowledge/audit-dimensions.d.ts +45 -0
- package/dist/knowledge/audit-dimensions.d.ts.map +1 -0
- package/dist/knowledge/audit-dimensions.js +144 -0
- package/dist/knowledge/audit-dimensions.js.map +1 -0
- package/dist/knowledge/audit-rules.d.ts +41 -0
- package/dist/knowledge/audit-rules.d.ts.map +1 -0
- package/dist/knowledge/audit-rules.js +269 -0
- package/dist/knowledge/audit-rules.js.map +1 -0
- package/dist/knowledge/audit-scoring.d.ts +6 -60
- package/dist/knowledge/audit-scoring.d.ts.map +1 -1
- package/dist/knowledge/audit-scoring.js +8 -391
- package/dist/knowledge/audit-scoring.js.map +1 -1
- package/dist/knowledge/audit.d.ts +6 -3
- package/dist/knowledge/audit.d.ts.map +1 -1
- package/dist/knowledge/audit.js +9 -6
- package/dist/knowledge/audit.js.map +1 -1
- package/dist/knowledge/import.d.ts.map +1 -1
- package/dist/knowledge/import.js +5 -4
- package/dist/knowledge/import.js.map +1 -1
- package/dist/knowledge/index-generator.d.ts +2 -0
- package/dist/knowledge/index-generator.d.ts.map +1 -1
- package/dist/knowledge/index-generator.js +43 -50
- package/dist/knowledge/index-generator.js.map +1 -1
- package/dist/knowledge/index.d.ts +5 -5
- package/dist/knowledge/index.d.ts.map +1 -1
- package/dist/knowledge/index.js +4 -5
- package/dist/knowledge/index.js.map +1 -1
- package/dist/knowledge/ingest.d.ts +21 -5
- package/dist/knowledge/ingest.d.ts.map +1 -1
- package/dist/knowledge/ingest.js +12 -9
- package/dist/knowledge/ingest.js.map +1 -1
- package/dist/knowledge/lifecycle.d.ts.map +1 -1
- package/dist/knowledge/lifecycle.js +17 -22
- package/dist/knowledge/lifecycle.js.map +1 -1
- package/dist/knowledge/query.d.ts +2 -2
- package/dist/knowledge/query.d.ts.map +1 -1
- package/dist/knowledge/query.js +19 -22
- package/dist/knowledge/query.js.map +1 -1
- package/dist/knowledge/reference-tracker.d.ts.map +1 -1
- package/dist/knowledge/reference-tracker.js +14 -17
- package/dist/knowledge/reference-tracker.js.map +1 -1
- package/dist/knowledge/store.d.ts.map +1 -1
- package/dist/knowledge/store.js +17 -36
- package/dist/knowledge/store.js.map +1 -1
- package/dist/knowledge/token-estimate.d.ts +14 -0
- package/dist/knowledge/token-estimate.d.ts.map +1 -0
- package/dist/knowledge/token-estimate.js +31 -0
- package/dist/knowledge/token-estimate.js.map +1 -0
- package/dist/monitoring/analyzer-base.d.ts +0 -8
- package/dist/monitoring/analyzer-base.d.ts.map +1 -1
- package/dist/monitoring/analyzer-base.js +0 -20
- package/dist/monitoring/analyzer-base.js.map +1 -1
- package/dist/monitoring/index.d.ts +2 -7
- package/dist/monitoring/index.d.ts.map +1 -1
- package/dist/monitoring/index.js +2 -9
- package/dist/monitoring/index.js.map +1 -1
- package/dist/monitoring/trace-analyzer.d.ts +2 -6
- package/dist/monitoring/trace-analyzer.d.ts.map +1 -1
- package/dist/monitoring/trace-analyzer.js +9 -16
- package/dist/monitoring/trace-analyzer.js.map +1 -1
- package/dist/monitoring/traces.d.ts +14 -10
- package/dist/monitoring/traces.d.ts.map +1 -1
- package/dist/monitoring/traces.js +47 -49
- package/dist/monitoring/traces.js.map +1 -1
- package/dist/pretool-use-hook.d.ts +1 -1
- package/dist/pretool-use-hook.d.ts.map +1 -1
- package/dist/pretool-use-hook.js +14 -21
- package/dist/pretool-use-hook.js.map +1 -1
- package/dist/release/integrity.d.ts.map +1 -1
- package/dist/release/integrity.js +8 -10
- package/dist/release/integrity.js.map +1 -1
- package/dist/sdd/index-generator.d.ts.map +1 -1
- package/dist/sdd/index-generator.js +4 -0
- package/dist/sdd/index-generator.js.map +1 -1
- package/dist/test-setup/jsonl-fake-fs.d.ts +1 -1
- package/dist/test-setup/jsonl-fake-fs.js +1 -1
- package/dist/types/checkpoint.d.ts +8 -8
- package/dist/types/checkpoint.d.ts.map +1 -1
- package/dist/types/command-io.d.ts +19 -0
- package/dist/types/command-io.d.ts.map +1 -0
- package/dist/types/command-io.js +3 -0
- package/dist/types/command-io.js.map +1 -0
- package/dist/types/gate.d.ts +72 -0
- package/dist/types/gate.d.ts.map +1 -0
- package/dist/types/gate.js +13 -0
- package/dist/types/gate.js.map +1 -0
- package/dist/utils/attempt.d.ts +22 -0
- package/dist/utils/attempt.d.ts.map +1 -0
- package/dist/utils/attempt.js +40 -0
- package/dist/utils/attempt.js.map +1 -0
- package/dist/utils/detect-source-roots.d.ts.map +1 -1
- package/dist/utils/detect-source-roots.js +42 -51
- package/dist/utils/detect-source-roots.js.map +1 -1
- package/dist/utils/file-walk.d.ts +2 -1
- package/dist/utils/file-walk.d.ts.map +1 -1
- package/dist/utils/file-walk.js +3 -8
- package/dist/utils/file-walk.js.map +1 -1
- package/dist/utils/glob-match.d.ts +10 -0
- package/dist/utils/glob-match.d.ts.map +1 -0
- package/dist/utils/glob-match.js +47 -0
- package/dist/utils/glob-match.js.map +1 -0
- package/dist/utils/jsonl.d.ts +1 -1
- package/dist/utils/jsonl.js +1 -1
- package/dist/utils/package-json.d.ts +49 -0
- package/dist/utils/package-json.d.ts.map +1 -0
- package/dist/utils/package-json.js +78 -0
- package/dist/utils/package-json.js.map +1 -0
- package/dist/utils/package-version.d.ts +5 -2
- package/dist/utils/package-version.d.ts.map +1 -1
- package/dist/utils/package-version.js +8 -11
- package/dist/utils/package-version.js.map +1 -1
- package/dist/utils/yaml-edit.d.ts +26 -0
- package/dist/utils/yaml-edit.d.ts.map +1 -0
- package/dist/utils/yaml-edit.js +98 -0
- package/dist/utils/yaml-edit.js.map +1 -0
- package/package.json +2 -7
- package/src/CONTEXT.md +14 -6
- package/src/__tests__/acceptance-gate.test.ts +25 -55
- package/src/__tests__/contract-gate.test.ts +1 -1
- package/src/__tests__/effective-constraints.test.ts +16 -0
- package/src/__tests__/install-precommit-hook.test.ts +61 -0
- package/src/__tests__/iron-laws.test.ts +5 -5
- package/src/__tests__/layering.test.ts +3 -4
- package/src/__tests__/no-studio-references.test.ts +13 -5
- package/src/__tests__/pretool-use-hook.test.ts +3 -3
- package/src/__tests__/public-exports.test.ts +196 -42
- package/src/__tests__/public-type-surface.test.ts +22 -72
- package/src/__tests__/public-value-surface.test.ts +7 -38
- package/src/__tests__/skip-semantics.test.ts +5 -4
- package/src/__tests__/trace-analyzer-extra.test.ts +1 -13
- package/src/agents/CONTEXT.md +4 -4
- package/src/agents/lifecycle.ts +3 -5
- package/src/cli/__tests__/command-contract.test.ts +18 -0
- package/src/cli/__tests__/gate-command.test.ts +1 -1
- package/src/cli/command-contract.ts +12 -9
- package/src/cli/commands/CONTEXT.md +13 -13
- package/src/cli/commands/__tests__/check.test.ts +1 -1
- package/src/cli/commands/__tests__/command.test.ts +2 -2
- package/src/cli/commands/__tests__/constraints-retire.test.ts +5 -3
- package/src/cli/commands/__tests__/init-governance-io.test.ts +7 -2
- package/src/cli/commands/__tests__/init.test.ts +1 -1
- package/src/cli/commands/__tests__/knowledge-audit-threshold.test.ts +14 -8
- package/src/cli/commands/__tests__/knowledge-flywheel-consistency.test.ts +2 -1
- package/src/cli/commands/__tests__/knowledge-view.test.ts +29 -19
- package/src/cli/commands/__tests__/knowledge.test.ts +6 -2
- package/src/cli/commands/__tests__/numeric-flag-assembly.test.ts +1 -1
- package/src/cli/commands/__tests__/passes-gate.test.ts +100 -24
- package/src/cli/commands/__tests__/project-path-anchoring.test.ts +3 -6
- package/src/cli/commands/__tests__/project-path-convention.test.ts +3 -35
- package/src/cli/commands/__tests__/registry.test.ts +3 -2
- package/src/cli/commands/__tests__/release.test.ts +24 -2
- package/src/cli/commands/__tests__/report-false-green.test.ts +10 -6
- package/src/cli/commands/__tests__/sync-docs-construction-sites.test.ts +175 -0
- package/src/cli/commands/__tests__/validate.test.ts +49 -0
- package/src/cli/commands/acceptance.ts +10 -9
- package/src/cli/commands/command.ts +2 -1
- package/src/cli/commands/constraints-disable.ts +8 -59
- package/src/cli/commands/constraints-pack-proposal.ts +26 -121
- package/src/cli/commands/constraints-reactivate.ts +22 -113
- package/src/cli/commands/constraints-retire.ts +32 -271
- package/src/cli/commands/constraints.ts +6 -30
- package/src/cli/commands/contract.ts +29 -14
- package/src/cli/commands/definitions.ts +13 -12
- package/src/cli/commands/init/ci-platform.ts +66 -0
- package/src/cli/commands/init/ci-wiring.ts +48 -0
- package/src/cli/commands/init/git-hooks.ts +31 -0
- package/src/cli/commands/init/governance.ts +127 -0
- package/src/cli/commands/init/index.ts +156 -0
- package/src/cli/commands/init/output-style.ts +82 -0
- package/src/cli/commands/init/presets.ts +105 -0
- package/src/cli/commands/init/snippets.ts +57 -0
- package/src/cli/commands/knowledge/audit.ts +155 -0
- package/src/cli/commands/knowledge/decay.ts +57 -0
- package/src/cli/commands/knowledge/health.ts +176 -0
- package/src/cli/commands/knowledge/import.ts +82 -0
- package/src/cli/commands/knowledge/index.ts +60 -0
- package/src/cli/commands/knowledge/list.ts +73 -0
- package/src/cli/commands/knowledge/migrate.ts +61 -0
- package/src/cli/commands/knowledge/search.ts +93 -0
- package/src/cli/commands/knowledge/shared.ts +13 -0
- package/src/cli/commands/knowledge/snapshot.ts +38 -0
- package/src/cli/commands/knowledge/stats.ts +112 -0
- package/src/cli/commands/knowledge/sync-rag.ts +48 -0
- package/src/cli/commands/knowledge-view.ts +3 -2
- package/src/cli/commands/passes-gate.ts +14 -2
- package/src/cli/commands/performance.ts +2 -2
- package/src/cli/commands/release.ts +16 -11
- package/src/cli/commands/review.ts +5 -4
- package/src/cli/commands/scaffold-templates.ts +23 -0
- package/src/cli/commands/security.ts +11 -12
- package/src/cli/commands/spec-baseline-check.ts +6 -7
- package/src/cli/commands/status.ts +2 -2
- package/src/cli/commands/sync-docs/__tests__/construction-site-count.test.ts +49 -0
- package/src/cli/commands/sync-docs/agents-syncer.ts +28 -47
- package/src/cli/commands/sync-docs/capabilities-syncer.ts +18 -11
- package/src/cli/commands/sync-docs/compact.ts +35 -0
- package/src/cli/commands/sync-docs/context-syncer.ts +52 -26
- package/src/cli/commands/sync-docs/gate.ts +78 -0
- package/src/cli/commands/sync-docs/index.ts +21 -549
- package/src/cli/commands/sync-docs/main-flow.ts +549 -0
- package/src/cli/commands/sync-docs/project-reader.ts +26 -24
- package/src/cli/commands/validate.ts +7 -0
- package/src/cli/gate-command.ts +2 -2
- package/src/completion-checkers/CONTEXT.md +3 -3
- package/src/completion-checkers/glob-match.ts +3 -35
- package/src/context/CONTEXT.md +7 -10
- package/src/context/__tests__/session-manager.test.ts +18 -7
- package/src/context/index.ts +1 -9
- package/src/context/session-manager.ts +34 -60
- package/src/context/types.ts +2 -22
- package/src/core/CONTEXT.md +10 -5
- package/src/core/__tests__/config-files.test.ts +88 -0
- package/src/core/__tests__/constraint-lifecycle.test.ts +255 -0
- package/src/core/__tests__/constraints-meta.test.ts +26 -0
- package/src/core/__tests__/pack-proposal.test.ts +95 -0
- package/src/core/config-files.ts +39 -0
- package/src/core/constraint-lifecycle.ts +435 -0
- package/src/core/constraints/__tests__/check-cache.test.ts +0 -7
- package/src/core/constraints/__tests__/collect-constraints.test.ts +25 -0
- package/src/core/constraints/__tests__/construction-sites.test.ts +147 -0
- package/src/core/constraints/__tests__/context-reconcile.test.ts +16 -16
- package/src/core/constraints/__tests__/trace-injection.test.ts +14 -15
- package/src/core/constraints/__tests__/usage-report.test.ts +9 -0
- package/src/core/constraints/capabilities-parser.ts +4 -6
- package/src/core/constraints/checker.ts +20 -1
- package/src/core/constraints/checkers/__tests__/no-completion-without-verification.test.ts +22 -3
- package/src/core/constraints/checkers/__tests__/no-hardcoded-credentials.test.ts +56 -41
- package/src/core/constraints/checkers/no-completion-without-verification.ts +16 -1
- package/src/core/constraints/checkers/no-hardcoded-credentials.ts +0 -5
- package/src/core/constraints/checkers/templated/exec.ts +1 -0
- package/src/core/constraints/checkers/templated/file-exists.ts +2 -2
- package/src/core/constraints/checkers/templated/glob.ts +3 -36
- package/src/core/constraints/construction-sites.ts +95 -0
- package/src/core/constraints/context-builder.ts +11 -28
- package/src/core/constraints/definitions/guidelines.ts +19 -0
- package/src/core/constraints/definitions/iron-laws.ts +0 -17
- package/src/core/constraints/doc-freshness/runner.ts +221 -242
- package/src/core/constraints/git-evidence.ts +2 -0
- package/src/core/constraints/index.ts +0 -4
- package/src/core/constraints/injection-writer.ts +3 -6
- package/src/core/constraints/meta.ts +40 -0
- package/src/core/constraints/pack-proposal.ts +179 -0
- package/src/core/constraints/usage-report.ts +3 -1
- package/src/core/effective-constraints.ts +6 -6
- package/src/core/index.ts +0 -15
- package/src/core/project-config-loader.ts +6 -5
- package/src/core/spec/__tests__/validator.test.ts +65 -13
- package/src/core/spec/validator.ts +50 -40
- package/src/core/validators/__tests__/command-success-output.test.ts +56 -0
- package/src/core/validators/__tests__/passes-gate-counts.test.ts +52 -0
- package/src/core/validators/check-handlers/command.ts +53 -10
- package/src/core/validators/check-handlers/http.ts +8 -6
- package/src/core/validators/check-handlers/output.ts +7 -6
- package/src/core/validators/passes-gate.ts +31 -32
- package/src/gates/CONTEXT.md +22 -14
- package/src/gates/__tests__/acceptance-types-single-source.test.ts +22 -19
- package/src/gates/__tests__/acceptance.test.ts +72 -99
- package/src/gates/__tests__/command-single-predicate.test.ts +1 -1
- package/src/gates/__tests__/command.test.ts +24 -25
- package/src/gates/__tests__/decision.test.ts +35 -0
- package/src/gates/__tests__/gate-interface.test.ts +2 -5
- package/src/gates/__tests__/performance.test.ts +3 -3
- package/src/gates/__tests__/security.test.ts +7 -19
- package/src/gates/acceptance.ts +176 -131
- package/src/gates/checker-gate.ts +2 -1
- package/src/gates/command.ts +4 -38
- package/src/gates/contract.ts +86 -79
- package/src/gates/definitions.ts +2 -2
- package/src/gates/performance.ts +35 -19
- package/src/gates/registry.ts +7 -4
- package/src/gates/review.ts +38 -10
- package/src/gates/security.ts +94 -81
- package/src/gates/types.ts +23 -77
- package/src/hooks/CONTEXT.md +1 -1
- package/src/index.ts +57 -98
- package/src/knowledge/CONTEXT.md +14 -10
- package/src/knowledge/__tests__/audit-labels.test.ts +3 -3
- package/src/knowledge/__tests__/audit-scoring.test.ts +9 -7
- package/src/knowledge/__tests__/ingest.test.ts +17 -17
- package/src/knowledge/__tests__/store.test.ts +4 -6
- package/src/knowledge/__tests__/token-estimate.test.ts +54 -0
- package/src/knowledge/audit-dimensions.ts +190 -0
- package/src/knowledge/audit-rules.ts +335 -0
- package/src/knowledge/audit-scoring.ts +7 -495
- package/src/knowledge/audit.ts +9 -11
- package/src/knowledge/import.ts +7 -6
- package/src/knowledge/index-generator.ts +48 -53
- package/src/knowledge/index.ts +5 -5
- package/src/knowledge/ingest.ts +27 -12
- package/src/knowledge/lifecycle.ts +17 -19
- package/src/knowledge/query.ts +20 -20
- package/src/knowledge/reference-tracker.ts +14 -16
- package/src/knowledge/store.ts +17 -32
- package/src/knowledge/token-estimate.ts +27 -0
- package/src/monitoring/CONTEXT.md +6 -8
- package/src/monitoring/__tests__/prune-trace-logs.test.ts +76 -0
- package/src/monitoring/__tests__/traces.test.ts +1 -17
- package/src/monitoring/analyzer-base.ts +0 -18
- package/src/monitoring/index.ts +2 -7
- package/src/monitoring/trace-analyzer.ts +12 -17
- package/src/monitoring/traces.ts +59 -57
- package/src/pretool-use-hook.ts +28 -23
- package/src/release/CONTEXT.md +2 -2
- package/src/release/__tests__/integrity.test.ts +3 -7
- package/src/release/integrity.ts +8 -11
- package/src/sdd/index-generator.ts +4 -0
- package/src/test-setup/jsonl-fake-fs.ts +1 -1
- package/src/types/checkpoint.ts +8 -8
- package/src/types/command-io.ts +14 -0
- package/src/types/gate.ts +77 -0
- package/src/utils/__tests__/attempt.test.ts +94 -0
- package/src/utils/__tests__/glob-match.test.ts +52 -0
- package/src/utils/__tests__/jsonl-skip-disposition.test.ts +0 -1
- package/src/utils/__tests__/package-json.test.ts +58 -0
- package/src/utils/__tests__/package-version.test.ts +21 -2
- package/src/utils/__tests__/yaml-edit.test.ts +62 -0
- package/src/utils/attempt.ts +35 -0
- package/src/utils/detect-source-roots.ts +38 -44
- package/src/utils/file-walk.ts +3 -7
- package/src/utils/glob-match.ts +41 -0
- package/src/utils/jsonl.ts +1 -1
- package/src/utils/package-json.ts +61 -0
- package/src/utils/package-version.ts +8 -10
- package/src/utils/yaml-edit.ts +67 -0
- package/dist/cli/commands/init.d.ts.map +0 -1
- package/dist/cli/commands/init.js +0 -517
- package/dist/cli/commands/init.js.map +0 -1
- package/dist/cli/commands/knowledge.d.ts +0 -169
- package/dist/cli/commands/knowledge.d.ts.map +0 -1
- package/dist/cli/commands/knowledge.js +0 -700
- package/dist/cli/commands/knowledge.js.map +0 -1
- package/dist/context/knowledge-injector.d.ts +0 -51
- package/dist/context/knowledge-injector.d.ts.map +0 -1
- package/dist/context/knowledge-injector.js +0 -129
- package/dist/context/knowledge-injector.js.map +0 -1
- package/dist/context/token-budget.d.ts +0 -115
- package/dist/context/token-budget.d.ts.map +0 -1
- package/dist/context/token-budget.js +0 -200
- package/dist/context/token-budget.js.map +0 -1
- package/dist/gates/index.d.ts +0 -44
- package/dist/gates/index.d.ts.map +0 -1
- package/dist/gates/index.js +0 -85
- package/dist/gates/index.js.map +0 -1
- package/dist/gates/runner.d.ts +0 -30
- package/dist/gates/runner.d.ts.map +0 -1
- package/dist/gates/runner.js +0 -38
- package/dist/gates/runner.js.map +0 -1
- package/dist/knowledge/primitives/code-structure.d.ts +0 -37
- package/dist/knowledge/primitives/code-structure.d.ts.map +0 -1
- package/dist/knowledge/primitives/code-structure.js +0 -185
- package/dist/knowledge/primitives/code-structure.js.map +0 -1
- package/dist/monitoring/context-tracker.d.ts +0 -38
- package/dist/monitoring/context-tracker.d.ts.map +0 -1
- package/dist/monitoring/context-tracker.js +0 -153
- package/dist/monitoring/context-tracker.js.map +0 -1
- package/dist/tools/definitions/core/code/fingerprint.sh +0 -273
- package/dist/tools/definitions/core/code/fingerprint.yml +0 -72
- package/dist/tools/definitions/core/code/parse.yml +0 -68
- package/dist/tools/definitions/core/code/register-language.sh +0 -475
- package/dist/tools/definitions/core/code/register-language.yml +0 -74
- package/dist/tools/definitions/core/docker/build.yml +0 -73
- package/dist/tools/definitions/core/docker/run.yml +0 -81
- package/dist/tools/definitions/core/file/copy.yml +0 -88
- package/dist/tools/definitions/core/file/read.yml +0 -69
- package/dist/tools/definitions/core/file/write.yml +0 -75
- package/dist/tools/definitions/core/git/branch.yml +0 -61
- package/dist/tools/definitions/core/git/cleanup-worktree.yml +0 -50
- package/dist/tools/definitions/core/git/clone.yml +0 -69
- package/dist/tools/definitions/core/git/commit.yml +0 -65
- package/dist/tools/definitions/core/git/push.yml +0 -79
- package/dist/tools/definitions/core/git/worktree.yml +0 -96
- package/dist/tools/definitions/core/notification/notify.sh +0 -152
- package/dist/tools/definitions/core/notification/notify.yml +0 -59
- package/dist/tools/definitions/core/npm/build.yml +0 -75
- package/dist/tools/definitions/core/npm/install.yml +0 -58
- package/dist/tools/definitions/core/npm/test.yml +0 -75
- package/dist/tools/definitions/core/validation/check-reuse.yml +0 -170
- package/dist/tools/definitions/core/validation/validate-handlers.yml +0 -118
- package/dist/tools/definitions/core/validation/validate-readme-stats.yml +0 -155
- package/dist/tools/definitions/core/validation/validate-yaml-syntax.yml +0 -134
- package/dist/tools/definitions/ext/browser/browser-automate.sh +0 -255
- package/dist/tools/definitions/ext/browser/browser-automate.yml +0 -166
- package/dist/tools/definitions/ext/browser/browser-close.sh +0 -104
- package/dist/tools/definitions/ext/browser/browser-close.yml +0 -54
- package/dist/tools/definitions/ext/browser/browser-mcp-debug.sh +0 -682
- package/dist/tools/definitions/ext/browser/browser-mcp-debug.yml +0 -167
- package/dist/tools/definitions/ext/browser/browser-start.sh +0 -101
- package/dist/tools/definitions/ext/browser/browser-start.yml +0 -61
- package/dist/tools/definitions/registry.json +0 -795
- package/dist/tools/definitions/std/README.md +0 -350
- package/dist/tools/definitions/std/analysis/analyze-codebase.yml +0 -72
- package/dist/tools/definitions/std/analysis/analyze-diff.yml +0 -182
- package/dist/tools/definitions/std/analysis/analyze-git-diff.yml +0 -70
- package/dist/tools/definitions/std/analysis/analyze-impact.yml +0 -78
- package/dist/tools/definitions/std/analysis/analyze-requirements.yml +0 -105
- package/dist/tools/definitions/std/analysis/brainstorm-options.yml +0 -106
- package/dist/tools/definitions/std/analysis/build-graph.yml +0 -154
- package/dist/tools/definitions/std/analysis/clarify-requirements.yml +0 -90
- package/dist/tools/definitions/std/analysis/detect-context.yml +0 -109
- package/dist/tools/definitions/std/analysis/detect-layers.yml +0 -125
- package/dist/tools/definitions/std/analysis/generate-tour.yml +0 -102
- package/dist/tools/definitions/std/analysis/search-enhance.yml +0 -105
- package/dist/tools/definitions/std/backlog/add.yml +0 -51
- package/dist/tools/definitions/std/backlog/decide.yml +0 -39
- package/dist/tools/definitions/std/backlog/github-sync.yml +0 -161
- package/dist/tools/definitions/std/backlog/list.yml +0 -53
- package/dist/tools/definitions/std/backlog/load.yml +0 -46
- package/dist/tools/definitions/std/backlog/resolve.yml +0 -37
- package/dist/tools/definitions/std/backlog/update.yml +0 -42
- package/dist/tools/definitions/std/bugfix/diagnose.yml +0 -68
- package/dist/tools/definitions/std/bugfix/fix.yml +0 -66
- package/dist/tools/definitions/std/bugfix/verify.yml +0 -69
- package/dist/tools/definitions/std/constraint/check-decomposition.yml +0 -103
- package/dist/tools/definitions/std/constraint/check-feature-list.yml +0 -77
- package/dist/tools/definitions/std/constraint/check-progress.yml +0 -97
- package/dist/tools/definitions/std/constraint/generate-report.yml +0 -147
- package/dist/tools/definitions/std/deploy/commit-push.yml +0 -33
- package/dist/tools/definitions/std/deploy/deploy-backend.yml +0 -37
- package/dist/tools/definitions/std/deploy/deploy-frontend.yml +0 -37
- package/dist/tools/definitions/std/deploy/rollback.yml +0 -148
- package/dist/tools/definitions/std/design/analyze-architecture-impact.yml +0 -113
- package/dist/tools/definitions/std/design/design-api.yml +0 -55
- package/dist/tools/definitions/std/design/design-architecture.yml +0 -97
- package/dist/tools/definitions/std/design/design-db.yml +0 -81
- package/dist/tools/definitions/std/design/generate-spec.yml +0 -182
- package/dist/tools/definitions/std/development/develop-api.yml +0 -85
- package/dist/tools/definitions/std/development/develop-backend.yml +0 -88
- package/dist/tools/definitions/std/development/develop-frontend.yml +0 -87
- package/dist/tools/definitions/std/development/develop-shared-types.yml +0 -74
- package/dist/tools/definitions/std/development/develop-task.yml +0 -122
- package/dist/tools/definitions/std/development/develop-tests.yml +0 -76
- package/dist/tools/definitions/std/development/execute-batch.yml +0 -152
- package/dist/tools/definitions/std/development/fix-issues.yml +0 -100
- package/dist/tools/definitions/std/development/implement-task.yml +0 -124
- package/dist/tools/definitions/std/development/review-fix-cycle.yml +0 -232
- package/dist/tools/definitions/std/evolution/implement.yml +0 -124
- package/dist/tools/definitions/std/evolution/prioritize.yml +0 -111
- package/dist/tools/definitions/std/evolution/report-gap.yml +0 -165
- package/dist/tools/definitions/std/file/read.yml +0 -21
- package/dist/tools/definitions/std/governance/aggregate-opinions.sh +0 -201
- package/dist/tools/definitions/std/governance/aggregate-opinions.yml +0 -78
- package/dist/tools/definitions/std/governance/audit-task.yml +0 -177
- package/dist/tools/definitions/std/governance/cast-vote.yml +0 -128
- package/dist/tools/definitions/std/governance/collect-issues.yml +0 -16
- package/dist/tools/definitions/std/governance/create-signed-document.yml +0 -23
- package/dist/tools/definitions/std/governance/create-voting-session.yml +0 -100
- package/dist/tools/definitions/std/governance/define-stance.sh +0 -243
- package/dist/tools/definitions/std/governance/define-stance.yml +0 -81
- package/dist/tools/definitions/std/governance/generate-review-report.yml +0 -23
- package/dist/tools/definitions/std/governance/impeach.yml +0 -178
- package/dist/tools/definitions/std/governance/multi-stance-review.yml +0 -153
- package/dist/tools/definitions/std/governance/prepare-artifact.yml +0 -20
- package/dist/tools/definitions/std/governance/review-spec-approval.yml +0 -262
- package/dist/tools/definitions/std/governance/rollback.yml +0 -185
- package/dist/tools/definitions/std/governance/stance-review.yml +0 -148
- package/dist/tools/definitions/std/governance/track-effect.yml +0 -198
- package/dist/tools/definitions/std/governance/vote-tally.yml +0 -143
- package/dist/tools/definitions/std/patch/execute.yml +0 -51
- package/dist/tools/definitions/std/planning/generate-tasks.yml +0 -36
- package/dist/tools/definitions/std/planning/load-tasks.yml +0 -44
- package/dist/tools/definitions/std/planning/split-batch.yml +0 -480
- package/dist/tools/definitions/std/planning/split-tasks.yml +0 -358
- package/dist/tools/definitions/std/planning/update-tasks.yml +0 -51
- package/dist/tools/definitions/std/planning/validate-tasks.yml +0 -46
- package/dist/tools/definitions/std/project/decide-next-workflow.yml +0 -38
- package/dist/tools/definitions/std/project/load-state.yml +0 -31
- package/dist/tools/definitions/std/project/save-state.yml +0 -32
- package/dist/tools/definitions/std/quality/check-quality.yml +0 -241
- package/dist/tools/definitions/std/quality/debug-systematic.yml +0 -163
- package/dist/tools/definitions/std/quality/handle-feedback.yml +0 -108
- package/dist/tools/definitions/std/quality/review-code.yml +0 -128
- package/dist/tools/definitions/std/quality/review-spec.yml +0 -140
- package/dist/tools/definitions/std/quality/review-task.yml +0 -190
- package/dist/tools/definitions/std/quality/run-tests.yml +0 -80
- package/dist/tools/definitions/std/quick/analyze.yml +0 -56
- package/dist/tools/definitions/std/quick/implement.yml +0 -67
- package/dist/tools/definitions/std/quick/verify.yml +0 -71
- package/dist/tools/definitions/std/verification/verify_completion.yml +0 -113
- package/dist/tools/definitions/std/verification/wait-condition.yml +0 -107
- package/dist/tools/index.d.ts +0 -5
- package/dist/tools/index.d.ts.map +0 -1
- package/dist/tools/index.js +0 -10
- package/dist/tools/index.js.map +0 -1
- package/dist/tools/paths.d.ts +0 -9
- package/dist/tools/paths.d.ts.map +0 -1
- package/dist/tools/paths.js.map +0 -1
- package/src/__tests__/token-budget.test.ts +0 -252
- package/src/cli/commands/init.ts +0 -604
- package/src/cli/commands/knowledge.ts +0 -820
- package/src/context/__tests__/knowledge-injector.test.ts +0 -178
- package/src/context/__tests__/token-budget.test.ts +0 -258
- package/src/context/knowledge-injector.ts +0 -175
- package/src/context/token-budget.ts +0 -222
- package/src/gates/__tests__/runner.test.ts +0 -81
- package/src/gates/index.ts +0 -98
- package/src/gates/runner.ts +0 -57
- package/src/knowledge/primitives/__tests__/code-structure-degrade.test.ts +0 -24
- package/src/knowledge/primitives/__tests__/code-structure.test.ts +0 -120
- package/src/knowledge/primitives/code-structure.ts +0 -185
- package/src/monitoring/__tests__/context-tracker.test.ts +0 -180
- package/src/monitoring/context-tracker.ts +0 -136
- package/src/tools/CONTEXT.md +0 -24
- package/src/tools/__tests__/registry.test.ts +0 -221
- package/src/tools/definitions/core/code/fingerprint.sh +0 -273
- package/src/tools/definitions/core/code/fingerprint.yml +0 -72
- package/src/tools/definitions/core/code/parse.yml +0 -68
- package/src/tools/definitions/core/code/register-language.sh +0 -475
- package/src/tools/definitions/core/code/register-language.yml +0 -74
- package/src/tools/definitions/core/docker/build.yml +0 -73
- package/src/tools/definitions/core/docker/run.yml +0 -81
- package/src/tools/definitions/core/file/copy.yml +0 -88
- package/src/tools/definitions/core/file/read.yml +0 -69
- package/src/tools/definitions/core/file/write.yml +0 -75
- package/src/tools/definitions/core/git/branch.yml +0 -61
- package/src/tools/definitions/core/git/cleanup-worktree.yml +0 -50
- package/src/tools/definitions/core/git/clone.yml +0 -69
- package/src/tools/definitions/core/git/commit.yml +0 -65
- package/src/tools/definitions/core/git/push.yml +0 -79
- package/src/tools/definitions/core/git/worktree.yml +0 -96
- package/src/tools/definitions/core/notification/notify.sh +0 -152
- package/src/tools/definitions/core/notification/notify.yml +0 -59
- package/src/tools/definitions/core/npm/build.yml +0 -75
- package/src/tools/definitions/core/npm/install.yml +0 -58
- package/src/tools/definitions/core/npm/test.yml +0 -75
- package/src/tools/definitions/core/validation/check-reuse.yml +0 -170
- package/src/tools/definitions/core/validation/validate-handlers.yml +0 -118
- package/src/tools/definitions/core/validation/validate-readme-stats.yml +0 -155
- package/src/tools/definitions/core/validation/validate-yaml-syntax.yml +0 -134
- package/src/tools/definitions/ext/browser/browser-automate.sh +0 -255
- package/src/tools/definitions/ext/browser/browser-automate.yml +0 -166
- package/src/tools/definitions/ext/browser/browser-close.sh +0 -104
- package/src/tools/definitions/ext/browser/browser-close.yml +0 -54
- package/src/tools/definitions/ext/browser/browser-mcp-debug.sh +0 -682
- package/src/tools/definitions/ext/browser/browser-mcp-debug.yml +0 -167
- package/src/tools/definitions/ext/browser/browser-start.sh +0 -101
- package/src/tools/definitions/ext/browser/browser-start.yml +0 -61
- package/src/tools/definitions/registry.json +0 -795
- package/src/tools/definitions/std/README.md +0 -350
- package/src/tools/definitions/std/analysis/analyze-codebase.yml +0 -72
- package/src/tools/definitions/std/analysis/analyze-diff.yml +0 -182
- package/src/tools/definitions/std/analysis/analyze-git-diff.yml +0 -70
- package/src/tools/definitions/std/analysis/analyze-impact.yml +0 -78
- package/src/tools/definitions/std/analysis/analyze-requirements.yml +0 -105
- package/src/tools/definitions/std/analysis/brainstorm-options.yml +0 -106
- package/src/tools/definitions/std/analysis/build-graph.yml +0 -154
- package/src/tools/definitions/std/analysis/clarify-requirements.yml +0 -90
- package/src/tools/definitions/std/analysis/detect-context.yml +0 -109
- package/src/tools/definitions/std/analysis/detect-layers.yml +0 -125
- package/src/tools/definitions/std/analysis/generate-tour.yml +0 -102
- package/src/tools/definitions/std/analysis/search-enhance.yml +0 -105
- package/src/tools/definitions/std/backlog/add.yml +0 -51
- package/src/tools/definitions/std/backlog/decide.yml +0 -39
- package/src/tools/definitions/std/backlog/github-sync.yml +0 -161
- package/src/tools/definitions/std/backlog/list.yml +0 -53
- package/src/tools/definitions/std/backlog/load.yml +0 -46
- package/src/tools/definitions/std/backlog/resolve.yml +0 -37
- package/src/tools/definitions/std/backlog/update.yml +0 -42
- package/src/tools/definitions/std/bugfix/diagnose.yml +0 -68
- package/src/tools/definitions/std/bugfix/fix.yml +0 -66
- package/src/tools/definitions/std/bugfix/verify.yml +0 -69
- package/src/tools/definitions/std/constraint/check-decomposition.yml +0 -103
- package/src/tools/definitions/std/constraint/check-feature-list.yml +0 -77
- package/src/tools/definitions/std/constraint/check-progress.yml +0 -97
- package/src/tools/definitions/std/constraint/generate-report.yml +0 -147
- package/src/tools/definitions/std/deploy/commit-push.yml +0 -33
- package/src/tools/definitions/std/deploy/deploy-backend.yml +0 -37
- package/src/tools/definitions/std/deploy/deploy-frontend.yml +0 -37
- package/src/tools/definitions/std/deploy/rollback.yml +0 -148
- package/src/tools/definitions/std/design/analyze-architecture-impact.yml +0 -113
- package/src/tools/definitions/std/design/design-api.yml +0 -55
- package/src/tools/definitions/std/design/design-architecture.yml +0 -97
- package/src/tools/definitions/std/design/design-db.yml +0 -81
- package/src/tools/definitions/std/design/generate-spec.yml +0 -182
- package/src/tools/definitions/std/development/develop-api.yml +0 -85
- package/src/tools/definitions/std/development/develop-backend.yml +0 -88
- package/src/tools/definitions/std/development/develop-frontend.yml +0 -87
- package/src/tools/definitions/std/development/develop-shared-types.yml +0 -74
- package/src/tools/definitions/std/development/develop-task.yml +0 -122
- package/src/tools/definitions/std/development/develop-tests.yml +0 -76
- package/src/tools/definitions/std/development/execute-batch.yml +0 -152
- package/src/tools/definitions/std/development/fix-issues.yml +0 -100
- package/src/tools/definitions/std/development/implement-task.yml +0 -124
- package/src/tools/definitions/std/development/review-fix-cycle.yml +0 -232
- package/src/tools/definitions/std/evolution/implement.yml +0 -124
- package/src/tools/definitions/std/evolution/prioritize.yml +0 -111
- package/src/tools/definitions/std/evolution/report-gap.yml +0 -165
- package/src/tools/definitions/std/file/read.yml +0 -21
- package/src/tools/definitions/std/governance/aggregate-opinions.sh +0 -201
- package/src/tools/definitions/std/governance/aggregate-opinions.yml +0 -78
- package/src/tools/definitions/std/governance/audit-task.yml +0 -177
- package/src/tools/definitions/std/governance/cast-vote.yml +0 -128
- package/src/tools/definitions/std/governance/collect-issues.yml +0 -16
- package/src/tools/definitions/std/governance/create-signed-document.yml +0 -23
- package/src/tools/definitions/std/governance/create-voting-session.yml +0 -100
- package/src/tools/definitions/std/governance/define-stance.sh +0 -243
- package/src/tools/definitions/std/governance/define-stance.yml +0 -81
- package/src/tools/definitions/std/governance/generate-review-report.yml +0 -23
- package/src/tools/definitions/std/governance/impeach.yml +0 -178
- package/src/tools/definitions/std/governance/multi-stance-review.yml +0 -153
- package/src/tools/definitions/std/governance/prepare-artifact.yml +0 -20
- package/src/tools/definitions/std/governance/review-spec-approval.yml +0 -262
- package/src/tools/definitions/std/governance/rollback.yml +0 -185
- package/src/tools/definitions/std/governance/stance-review.yml +0 -148
- package/src/tools/definitions/std/governance/track-effect.yml +0 -198
- package/src/tools/definitions/std/governance/vote-tally.yml +0 -143
- package/src/tools/definitions/std/patch/execute.yml +0 -51
- package/src/tools/definitions/std/planning/generate-tasks.yml +0 -36
- package/src/tools/definitions/std/planning/load-tasks.yml +0 -44
- package/src/tools/definitions/std/planning/split-batch.yml +0 -480
- package/src/tools/definitions/std/planning/split-tasks.yml +0 -358
- package/src/tools/definitions/std/planning/update-tasks.yml +0 -51
- package/src/tools/definitions/std/planning/validate-tasks.yml +0 -46
- package/src/tools/definitions/std/project/decide-next-workflow.yml +0 -38
- package/src/tools/definitions/std/project/load-state.yml +0 -31
- package/src/tools/definitions/std/project/save-state.yml +0 -32
- package/src/tools/definitions/std/quality/check-quality.yml +0 -241
- package/src/tools/definitions/std/quality/debug-systematic.yml +0 -163
- package/src/tools/definitions/std/quality/handle-feedback.yml +0 -108
- package/src/tools/definitions/std/quality/review-code.yml +0 -128
- package/src/tools/definitions/std/quality/review-spec.yml +0 -140
- package/src/tools/definitions/std/quality/review-task.yml +0 -190
- package/src/tools/definitions/std/quality/run-tests.yml +0 -80
- package/src/tools/definitions/std/quick/analyze.yml +0 -56
- package/src/tools/definitions/std/quick/implement.yml +0 -67
- package/src/tools/definitions/std/quick/verify.yml +0 -71
- package/src/tools/definitions/std/verification/verify_completion.yml +0 -113
- package/src/tools/definitions/std/verification/wait-condition.yml +0 -107
- package/src/tools/index.ts +0 -5
- package/src/tools/paths.ts +0 -15
|
@@ -68,9 +68,11 @@ export class KnowledgeIndexGenerator {
|
|
|
68
68
|
|
|
69
69
|
/**
|
|
70
70
|
* 扫描目录,返回索引数据行(无 header)
|
|
71
|
+
*
|
|
72
|
+
* baseDir 不存在 = 空知识库(领域语义,返回空);扫到一半目录不可读 = 真故障,抛出。
|
|
71
73
|
*/
|
|
72
74
|
generateIndexLines(): string[] {
|
|
73
|
-
const files = this.scanFiles(this.baseDir);
|
|
75
|
+
const files = fs.existsSync(this.baseDir) ? this.scanFiles(this.baseDir) : [];
|
|
74
76
|
const entries: IndexEntry[] = [];
|
|
75
77
|
|
|
76
78
|
for (const filePath of files) {
|
|
@@ -97,12 +99,8 @@ export class KnowledgeIndexGenerator {
|
|
|
97
99
|
private scanFiles(dir: string, relative: string = ''): string[] {
|
|
98
100
|
const results: string[] = [];
|
|
99
101
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
items = fs.readdirSync(dir, { withFileTypes: true });
|
|
103
|
-
} catch {
|
|
104
|
-
return results;
|
|
105
|
-
}
|
|
102
|
+
// fail-fast:目录不可读直接抛,不返回半截清单
|
|
103
|
+
const items = fs.readdirSync(dir, { withFileTypes: true });
|
|
106
104
|
|
|
107
105
|
for (const item of items) {
|
|
108
106
|
const name = item.name;
|
|
@@ -122,59 +120,56 @@ export class KnowledgeIndexGenerator {
|
|
|
122
120
|
}
|
|
123
121
|
|
|
124
122
|
private parseFile(filePath: string): IndexEntry | null {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
// 检测 skill schema(name/description 而非 id/type)
|
|
145
|
-
const type = meta.type
|
|
146
|
-
? String(meta.type)
|
|
147
|
-
: meta.name
|
|
148
|
-
? 'skill'
|
|
149
|
-
: this.inferType(filename);
|
|
150
|
-
|
|
151
|
-
return {
|
|
152
|
-
filename,
|
|
153
|
-
id: String(meta.id ?? meta.name ?? path.basename(filePath, '.md')),
|
|
154
|
-
type,
|
|
155
|
-
title: String(meta.title ?? meta.description ?? ''),
|
|
156
|
-
maturity: String(meta.maturity ?? 'unknown'),
|
|
157
|
-
tags: Array.isArray(meta.tags) ? (meta.tags as unknown[]).map(String) : [],
|
|
158
|
-
headings,
|
|
159
|
-
};
|
|
160
|
-
}
|
|
123
|
+
// fail-fast:读失败(IO)直接抛;frontmatter 损坏由下方 splitFrontmatter 分支显式上报
|
|
124
|
+
const raw = fs.readFileSync(filePath, 'utf-8');
|
|
125
|
+
const filename = path.relative(this.baseDir, filePath);
|
|
126
|
+
|
|
127
|
+
// 跳过 ghost 文件(文件名为 .md)
|
|
128
|
+
if (path.basename(filename) === '.md') return null;
|
|
129
|
+
|
|
130
|
+
// 尝试解析 YAML frontmatter(语法与失败走法正本:utils/frontmatter)
|
|
131
|
+
const fm = splitFrontmatter(raw);
|
|
132
|
+
if (fm.state === 'malformed') {
|
|
133
|
+
// 统一口径(harness#89):损坏必须显式上报,恢复动作是 best-effort 索引原文
|
|
134
|
+
console.error(
|
|
135
|
+
`[harness] 知识索引 frontmatter ${fm.reason}(${fm.detail}),按无 frontmatter 处理 ${filename}`
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
if (fm.state === 'ok') {
|
|
139
|
+
const meta = fm.meta;
|
|
140
|
+
const headings = this.extractHeadings(fm.body);
|
|
161
141
|
|
|
162
|
-
//
|
|
163
|
-
const
|
|
164
|
-
|
|
142
|
+
// 检测 skill schema(name/description 而非 id/type)
|
|
143
|
+
const type = meta.type
|
|
144
|
+
? String(meta.type)
|
|
145
|
+
: meta.name
|
|
146
|
+
? 'skill'
|
|
147
|
+
: this.inferType(filename);
|
|
165
148
|
|
|
166
149
|
return {
|
|
167
150
|
filename,
|
|
168
|
-
id: path.basename(filePath, '.md'),
|
|
169
|
-
type
|
|
170
|
-
title:
|
|
171
|
-
maturity: 'unknown',
|
|
172
|
-
tags: [],
|
|
151
|
+
id: String(meta.id ?? meta.name ?? path.basename(filePath, '.md')),
|
|
152
|
+
type,
|
|
153
|
+
title: String(meta.title ?? meta.description ?? ''),
|
|
154
|
+
maturity: String(meta.maturity ?? 'unknown'),
|
|
155
|
+
tags: Array.isArray(meta.tags) ? (meta.tags as unknown[]).map(String) : [],
|
|
173
156
|
headings,
|
|
174
157
|
};
|
|
175
|
-
} catch {
|
|
176
|
-
return null;
|
|
177
158
|
}
|
|
159
|
+
|
|
160
|
+
// absent(含空 meta)或已上报的 malformed — best effort
|
|
161
|
+
const headings = this.extractHeadings(raw);
|
|
162
|
+
const h1Match = raw.match(/^#\s+(.+)$/m);
|
|
163
|
+
|
|
164
|
+
return {
|
|
165
|
+
filename,
|
|
166
|
+
id: path.basename(filePath, '.md'),
|
|
167
|
+
type: this.inferType(filename),
|
|
168
|
+
title: h1Match ? h1Match[1].trim() : '',
|
|
169
|
+
maturity: 'unknown',
|
|
170
|
+
tags: [],
|
|
171
|
+
headings,
|
|
172
|
+
};
|
|
178
173
|
}
|
|
179
174
|
|
|
180
175
|
/**
|
package/src/knowledge/index.ts
CHANGED
|
@@ -32,7 +32,8 @@ export type {
|
|
|
32
32
|
} from './types';
|
|
33
33
|
export type { KnowledgeStore } from './store';
|
|
34
34
|
export { FileKnowledgeStore } from './store';
|
|
35
|
-
export { KnowledgeQuery } from './query';
|
|
35
|
+
export { KnowledgeQuery, EXTERNAL_SOURCE_MARKER } from './query';
|
|
36
|
+
export { estimateTokens } from './token-estimate';
|
|
36
37
|
export { KnowledgeLifecycle } from './lifecycle';
|
|
37
38
|
export type { ConsumptionEvent } from './lifecycle';
|
|
38
39
|
export { KnowledgeIngest, sanitizeExternalContent } from './ingest';
|
|
@@ -41,7 +42,6 @@ export { KnowledgeLinter } from './lint';
|
|
|
41
42
|
export { ColdStartImporter } from './import';
|
|
42
43
|
export { KnowledgeHealthScorer } from './doctor';
|
|
43
44
|
export { KnowledgeAudit } from './audit';
|
|
44
|
-
export type { AuditRuleName, AuditAction, AuditIssue
|
|
45
|
-
export {
|
|
46
|
-
export {
|
|
47
|
-
export type { CodeStructure, DeclarationInfo, ImportInfo } from './primitives/code-structure';
|
|
45
|
+
export type { AuditRuleName, AuditAction, AuditIssue } from './audit-rules';
|
|
46
|
+
export type { AuditOptions } from './audit-scoring';
|
|
47
|
+
export type { AuditReport } from './audit-dimensions';
|
package/src/knowledge/ingest.ts
CHANGED
|
@@ -18,6 +18,18 @@ import { splitFrontmatter } from '../utils/frontmatter';
|
|
|
18
18
|
const MAX_SOURCE_REFS = 20;
|
|
19
19
|
const MAX_EXTERNAL_CONTENT_LENGTH = 5000;
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* `ingestEntry` / `ingestBatch` / `ingestExternal` 的返回(判别联合):
|
|
23
|
+
* - `accepted`:已落盘(新建或去重合并),`entry` 为最终形态
|
|
24
|
+
* - `rejected`:审计质量门拒收、未落盘,`reasons` 为逐条拒绝理由
|
|
25
|
+
*
|
|
26
|
+
* 原实现把 `__rejected` / `__rejectReasons` 经 `as any` 偷挂在返回条目上——
|
|
27
|
+
* 类型面看不见、全仓零消费点(Phase 4 any 清零时核实),改为显式判别联合。
|
|
28
|
+
*/
|
|
29
|
+
export type IngestResult =
|
|
30
|
+
| { status: 'accepted'; entry: KnowledgeEntry }
|
|
31
|
+
| { status: 'rejected'; entry: KnowledgeEntry; reasons: string[] };
|
|
32
|
+
|
|
21
33
|
/** Known prompt injection patterns to strip from external content */
|
|
22
34
|
const INJECTION_PATTERNS = [
|
|
23
35
|
/ignore\s+(all\s+)?previous\s+instructions/gi,
|
|
@@ -62,12 +74,12 @@ export class KnowledgeIngest {
|
|
|
62
74
|
/**
|
|
63
75
|
* Ingest a single knowledge entry.
|
|
64
76
|
* Auto-fills id, created, maturity, and other defaults.
|
|
65
|
-
* Returns
|
|
77
|
+
* Returns a discriminated result: accepted = saved (new or merged), rejected = audit gate refusal.
|
|
66
78
|
*/
|
|
67
79
|
ingestEntry(
|
|
68
80
|
partial: Partial<KnowledgeEntry>,
|
|
69
81
|
options: IngestOptions,
|
|
70
|
-
):
|
|
82
|
+
): IngestResult {
|
|
71
83
|
const entry = this.buildEntry(partial, options);
|
|
72
84
|
|
|
73
85
|
// Quality gate: audit before saving
|
|
@@ -75,10 +87,8 @@ export class KnowledgeIngest {
|
|
|
75
87
|
let issues = audit.validate(entry);
|
|
76
88
|
const critical = issues.filter(i => i.action === 'reject');
|
|
77
89
|
if (critical.length > 0) {
|
|
78
|
-
// Reject: return
|
|
79
|
-
|
|
80
|
-
(entry as any).__rejectReasons = critical.map(i => i.detail);
|
|
81
|
-
return entry;
|
|
90
|
+
// Reject: return without saving; caller branches on status / reasons
|
|
91
|
+
return { status: 'rejected', entry, reasons: critical.map(i => i.detail) };
|
|
82
92
|
}
|
|
83
93
|
|
|
84
94
|
// If caller explicitly set maturity, skip demote actions from audit.
|
|
@@ -91,7 +101,7 @@ export class KnowledgeIngest {
|
|
|
91
101
|
const existing = this.findDuplicate(entry.title, entry.content, entry.type);
|
|
92
102
|
if (existing) {
|
|
93
103
|
// Merge: update existing entry with new content and metadata
|
|
94
|
-
return this.mergeEntries(existing, entry, options);
|
|
104
|
+
return { status: 'accepted', entry: this.mergeEntries(existing, entry, options) };
|
|
95
105
|
}
|
|
96
106
|
|
|
97
107
|
this.store.save(entry);
|
|
@@ -113,17 +123,17 @@ export class KnowledgeIngest {
|
|
|
113
123
|
}
|
|
114
124
|
}
|
|
115
125
|
|
|
116
|
-
return entry;
|
|
126
|
+
return { status: 'accepted', entry };
|
|
117
127
|
}
|
|
118
128
|
|
|
119
129
|
/**
|
|
120
130
|
* Ingest multiple entries in batch.
|
|
121
|
-
* Returns
|
|
131
|
+
* Returns one result per input (accepted/rejected).
|
|
122
132
|
*/
|
|
123
133
|
ingestBatch(
|
|
124
134
|
partials: Partial<KnowledgeEntry>[],
|
|
125
135
|
options: IngestOptions,
|
|
126
|
-
):
|
|
136
|
+
): IngestResult[] {
|
|
127
137
|
return partials.map(p => this.ingestEntry(p, options));
|
|
128
138
|
}
|
|
129
139
|
|
|
@@ -136,7 +146,7 @@ export class KnowledgeIngest {
|
|
|
136
146
|
ingestExternal(
|
|
137
147
|
partial: Partial<KnowledgeEntry>,
|
|
138
148
|
options: Omit<IngestOptions, 'origin'> & { fullContentPath?: string },
|
|
139
|
-
):
|
|
149
|
+
): IngestResult {
|
|
140
150
|
const sanitizedContent = sanitizeExternalContent(partial.content || '');
|
|
141
151
|
return this.ingestEntry(
|
|
142
152
|
{ ...partial, content: sanitizedContent },
|
|
@@ -282,7 +292,12 @@ export class KnowledgeIngest {
|
|
|
282
292
|
tags: [...new Set([...existing.tags, ...incoming.tags])],
|
|
283
293
|
sourceReferences: [...existing.sourceReferences, ...incoming.sourceReferences].slice(-MAX_SOURCE_REFS),
|
|
284
294
|
};
|
|
285
|
-
|
|
295
|
+
// fail-fast:刚经 readEntriesFromDisk 读到的条目 update 不到 = 并发删除/索引漂移,不静默吞
|
|
296
|
+
const updated = this.store.update(existing.id, merged);
|
|
297
|
+
if (!updated) {
|
|
298
|
+
throw new Error(`mergeEntries: 条目 ${existing.id} 落盘更新失败(读得到写不回)`);
|
|
299
|
+
}
|
|
300
|
+
return updated;
|
|
286
301
|
}
|
|
287
302
|
|
|
288
303
|
private defaultSourceRef(source: string): SourceRef[] {
|
|
@@ -14,6 +14,7 @@ import type {
|
|
|
14
14
|
} from './types';
|
|
15
15
|
import { DEFAULT_DECAY_CONFIG } from './types';
|
|
16
16
|
import type { KnowledgeStore } from './store';
|
|
17
|
+
import { attempt } from '../utils/attempt';
|
|
17
18
|
|
|
18
19
|
const MAX_REFERENCED_BY = 20;
|
|
19
20
|
const MIN_CONTENT_FOR_PROVEN = 100;
|
|
@@ -92,9 +93,8 @@ export class KnowledgeLifecycle {
|
|
|
92
93
|
|
|
93
94
|
// Fire consumption event callbacks
|
|
94
95
|
for (const cb of this.onReferenceCallbacks) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
} catch { /* non-blocking */ }
|
|
96
|
+
// 显式 fail-open(attempt):消费回调是外挂监听,崩了不拖死引用记账主流程
|
|
97
|
+
attempt(() => cb({ entryId, contributor: contributor || 'unknown', timestamp: now, success }), () => undefined);
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
return updated;
|
|
@@ -226,14 +226,13 @@ export class KnowledgeLifecycle {
|
|
|
226
226
|
// Emit event for downstream consumers
|
|
227
227
|
const now = new Date().toISOString();
|
|
228
228
|
for (const cb of this.onReferenceCallbacks) {
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
} catch { /* non-blocking */ }
|
|
229
|
+
// 显式 fail-open(attempt):外挂监听回调失败不拖死标记主流程
|
|
230
|
+
attempt(() => cb({
|
|
231
|
+
entryId,
|
|
232
|
+
contributor: 'lifecycle',
|
|
233
|
+
timestamp: now,
|
|
234
|
+
context: 'skillCandidate:marked',
|
|
235
|
+
}), () => undefined);
|
|
237
236
|
}
|
|
238
237
|
|
|
239
238
|
return true;
|
|
@@ -277,14 +276,13 @@ export class KnowledgeLifecycle {
|
|
|
277
276
|
// Emit event for downstream consumers
|
|
278
277
|
const now = new Date().toISOString();
|
|
279
278
|
for (const cb of this.onReferenceCallbacks) {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
} catch { /* non-blocking */ }
|
|
279
|
+
// 显式 fail-open(attempt):外挂监听回调失败不拖死标记主流程
|
|
280
|
+
attempt(() => cb({
|
|
281
|
+
entryId,
|
|
282
|
+
contributor: 'lifecycle',
|
|
283
|
+
timestamp: now,
|
|
284
|
+
context: 'constraintCandidate:marked',
|
|
285
|
+
}), () => undefined);
|
|
288
286
|
}
|
|
289
287
|
|
|
290
288
|
return true;
|
package/src/knowledge/query.ts
CHANGED
|
@@ -15,6 +15,8 @@ import type {
|
|
|
15
15
|
} from './types';
|
|
16
16
|
import type { KnowledgeStore } from './store';
|
|
17
17
|
import { KnowledgeLifecycle } from './lifecycle';
|
|
18
|
+
import { estimateTokens } from './token-estimate';
|
|
19
|
+
import { attempt } from '../utils/attempt';
|
|
18
20
|
|
|
19
21
|
// ── Constants ──────────────────────────────────────────────
|
|
20
22
|
|
|
@@ -22,7 +24,7 @@ const CACHE_TTL_MS = 5 * 60 * 1000; // 5 minutes
|
|
|
22
24
|
|
|
23
25
|
/**
|
|
24
26
|
* 外部来源条目的 prompt 标记(harness#161:三层防御第二层 marking 的唯一正本)。
|
|
25
|
-
* `KnowledgeQuery.formatForPrompt()`
|
|
27
|
+
* `KnowledgeQuery.formatForPrompt()` 与下游编排消费方的注入格式化共用同一常量,
|
|
26
28
|
* 仓内不允许存在第二份字面量。
|
|
27
29
|
*/
|
|
28
30
|
export const EXTERNAL_SOURCE_MARKER = '[External Source — verify before acting]';
|
|
@@ -85,9 +87,8 @@ export class KnowledgeQuery {
|
|
|
85
87
|
|
|
86
88
|
// P2a: Record references for all returned entries (drives maturity ladder)
|
|
87
89
|
for (const entry of entries) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
} catch { /* non-blocking */ }
|
|
90
|
+
// 显式 fail-open(attempt):引用记账是查询的副作用,失败不影响查询结果返回
|
|
91
|
+
attempt(() => this.lifecycle.recordReference(entry.id), () => undefined);
|
|
91
92
|
}
|
|
92
93
|
|
|
93
94
|
return result;
|
|
@@ -123,19 +124,10 @@ export class KnowledgeQuery {
|
|
|
123
124
|
|
|
124
125
|
/**
|
|
125
126
|
* Estimate token count for a piece of text.
|
|
126
|
-
*
|
|
127
|
+
* 委托仓内唯一尺子正本 `token-estimate.ts`(本类不再自带实现);保留方法名与语义不变。
|
|
127
128
|
*/
|
|
128
129
|
estimateTokens(text: string): number {
|
|
129
|
-
|
|
130
|
-
for (const ch of text) {
|
|
131
|
-
// CJK Unified Ideographs + common CJK ranges
|
|
132
|
-
if (/[一-鿿㐀-䶿豈-]/.test(ch)) {
|
|
133
|
-
tokens += 2;
|
|
134
|
-
} else {
|
|
135
|
-
tokens += 0.25;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
return Math.ceil(tokens);
|
|
130
|
+
return estimateTokens(text);
|
|
139
131
|
}
|
|
140
132
|
|
|
141
133
|
/** Clear the query cache. */
|
|
@@ -166,16 +158,24 @@ export class KnowledgeQuery {
|
|
|
166
158
|
requirementText?: string;
|
|
167
159
|
phase?: string;
|
|
168
160
|
}): { rules: KnowledgeEntry[]; references: KnowledgeEntry[]; context: KnowledgeEntry[] } {
|
|
169
|
-
|
|
161
|
+
// 一次全量 list + 内存分组(等价于按 mode 三次 list;条目 mode 单一,分组保序。
|
|
162
|
+
// signal 条目原三次 queryByMode 均不取,分组后同样不消费)
|
|
163
|
+
const grouped: Record<ConsumptionMode, KnowledgeEntry[]> = { rule: [], reference: [], context: [], signal: [] };
|
|
164
|
+
for (const entry of this.store.list({})) {
|
|
165
|
+
grouped[entry.consumptionMode ?? 'reference'].push(entry);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
const rules = grouped.rule;
|
|
170
169
|
|
|
171
|
-
const allRefs =
|
|
170
|
+
const allRefs = grouped.reference;
|
|
172
171
|
const references = taskContext.requirementText
|
|
173
172
|
? this.filterByText(allRefs, taskContext.requirementText).slice(0, 3)
|
|
174
173
|
: allRefs.slice(0, 3);
|
|
175
174
|
|
|
176
|
-
const allContext =
|
|
177
|
-
const
|
|
178
|
-
|
|
175
|
+
const allContext = grouped.context;
|
|
176
|
+
const phase = taskContext.phase;
|
|
177
|
+
const context = phase
|
|
178
|
+
? allContext.filter(e => e.applicablePhases.includes(phase))
|
|
179
179
|
: allContext;
|
|
180
180
|
|
|
181
181
|
return { rules, references, context };
|
|
@@ -67,10 +67,12 @@ export class ReferenceTracker {
|
|
|
67
67
|
|
|
68
68
|
for (const record of records) {
|
|
69
69
|
for (const entryId of record.entryIds) {
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
let decisions = entryToDecisions.get(entryId);
|
|
71
|
+
if (!decisions) {
|
|
72
|
+
decisions = new Set();
|
|
73
|
+
entryToDecisions.set(entryId, decisions);
|
|
72
74
|
}
|
|
73
|
-
|
|
75
|
+
decisions.add(record.decisionId);
|
|
74
76
|
}
|
|
75
77
|
}
|
|
76
78
|
|
|
@@ -84,18 +86,14 @@ export class ReferenceTracker {
|
|
|
84
86
|
// ── Internal ───────────────────────────────────────────────
|
|
85
87
|
|
|
86
88
|
private readAll(): ReferenceRecord[] {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
return readJsonl<ReferenceRecord>(this.filePath, 'skip').records;
|
|
97
|
-
} catch {
|
|
98
|
-
return [];
|
|
99
|
-
}
|
|
89
|
+
// 坏行策略:skip(harness#82:原「逐行 map 会抛 + 外层 catch 吞成整文件 []」
|
|
90
|
+
// ——坏一行丢全部记录——不可接受,改为单行损坏只丢该行);
|
|
91
|
+
// 缺文件 readJsonl 返回空结果(不抛),走到抛错只剩真 IO 故障 → fail-fast 不吞
|
|
92
|
+
// 计数去向:豁免(harness#100)——三个消费点 getReferencesForEntry /
|
|
93
|
+
// getReferencesForDecision / updateReferencedBy 只按合法记录取引用关系。
|
|
94
|
+
// 代价如实记录:checkOrphans(knowledge/lint.ts)以 refs.length>0 判孤儿,
|
|
95
|
+
// 坏行会让它给出假孤儿判定,不只是少报;透传需要给 LintIssue / `knowledge health`
|
|
96
|
+
// 报告加计数位,属 knowledge 域输出形状变更,另票收口
|
|
97
|
+
return readJsonl<ReferenceRecord>(this.filePath, 'skip').records;
|
|
100
98
|
}
|
|
101
99
|
}
|
package/src/knowledge/store.ts
CHANGED
|
@@ -287,12 +287,10 @@ export class FileKnowledgeStore implements KnowledgeStore {
|
|
|
287
287
|
}
|
|
288
288
|
|
|
289
289
|
private readFile(filePath: string): KnowledgeEntry | undefined {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
return undefined;
|
|
295
|
-
}
|
|
290
|
+
// fail-fast:文件来自 listFiles 的目录扫描,读到一半失败(IO/权限)直接抛;
|
|
291
|
+
// 内容形状问题(frontmatter 损坏/缺失)由 parseFile 显式上报后返回 undefined
|
|
292
|
+
const raw = fs.readFileSync(filePath, 'utf-8');
|
|
293
|
+
return this.parseFile(raw, filePath);
|
|
296
294
|
}
|
|
297
295
|
|
|
298
296
|
private parseFile(raw: string, filePath: string): KnowledgeEntry | undefined {
|
|
@@ -432,11 +430,8 @@ export class FileKnowledgeStore implements KnowledgeStore {
|
|
|
432
430
|
getSnapshot(date: string): IndexEntry[] | undefined {
|
|
433
431
|
const snapPath = path.join(this.baseDir, SNAPSHOTS_DIR, `index-${date}.json`);
|
|
434
432
|
if (!fs.existsSync(snapPath)) return undefined;
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
} catch {
|
|
438
|
-
return undefined;
|
|
439
|
-
}
|
|
433
|
+
// fail-fast:快照在场但损坏直接抛——吞成 undefined 会把损坏伪装成「没有快照」
|
|
434
|
+
return JSON.parse(fs.readFileSync(snapPath, 'utf-8')) as IndexEntry[];
|
|
440
435
|
}
|
|
441
436
|
|
|
442
437
|
/**
|
|
@@ -470,40 +465,30 @@ export class FileKnowledgeStore implements KnowledgeStore {
|
|
|
470
465
|
*/
|
|
471
466
|
getConsumptionStats(): ConsumptionStats | undefined {
|
|
472
467
|
const statsPath = path.join(this.baseDir, CONSUMPTION_STATS_FILE);
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
return undefined;
|
|
478
|
-
}
|
|
468
|
+
if (!fs.existsSync(statsPath)) return undefined;
|
|
469
|
+
// fail-fast:统计文件在场但损坏直接抛,不装成「无统计」
|
|
470
|
+
const stats = JSON.parse(fs.readFileSync(statsPath, 'utf-8')) as { dailyEvents?: number };
|
|
471
|
+
return { dailyEvents: stats.dailyEvents ?? 0 };
|
|
479
472
|
}
|
|
480
473
|
|
|
481
474
|
// ── Index I/O ────────────────────────────────────────────
|
|
482
475
|
|
|
483
476
|
readIndex(): IndexEntry[] {
|
|
484
477
|
const indexPath = path.join(this.baseDir, INDEX_FILE);
|
|
485
|
-
|
|
486
|
-
try {
|
|
487
|
-
stat = fs.statSync(indexPath);
|
|
488
|
-
} catch {
|
|
489
|
-
stat = undefined;
|
|
490
|
-
}
|
|
491
|
-
if (!stat) {
|
|
478
|
+
if (!fs.existsSync(indexPath)) {
|
|
492
479
|
this.indexCache = undefined;
|
|
493
480
|
return [];
|
|
494
481
|
}
|
|
482
|
+
const stat = fs.statSync(indexPath);
|
|
495
483
|
const cached = this.indexCache;
|
|
496
484
|
if (cached && cached.mtimeMs === stat.mtimeMs && cached.size === stat.size) {
|
|
497
485
|
return cached.entries;
|
|
498
486
|
}
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
} catch {
|
|
505
|
-
return [];
|
|
506
|
-
}
|
|
487
|
+
// fail-fast:index 在场但损坏直接抛——吞成 [] 会让 store 误以为库是空的
|
|
488
|
+
const raw = fs.readFileSync(indexPath, 'utf-8');
|
|
489
|
+
const entries = JSON.parse(raw) as IndexEntry[];
|
|
490
|
+
this.indexCache = { mtimeMs: stat.mtimeMs, size: stat.size, entries };
|
|
491
|
+
return entries;
|
|
507
492
|
}
|
|
508
493
|
|
|
509
494
|
private writeIndex(entries: IndexEntry[]): void {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token 估算——仓内唯一一把尺子(harness#197「双尺子合一」的正本落点)
|
|
3
|
+
*
|
|
4
|
+
* 从 `KnowledgeQuery.estimateTokens` 提出为独立纯函数(本票新增):消费方要的是尺子,
|
|
5
|
+
* 不该为了量一段文本先去持有一个带 store 的知识查询对象——下游真实的调用面是 30 处
|
|
6
|
+
* 「拿函数直接用」的静态调用,改造面不该由尺子的取用形状来付。`KnowledgeQuery` 的方法名
|
|
7
|
+
* 与语义不变,改为委托本函数——实现仍只有一份,不重新长出第二把尺子。
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Estimate token count for a piece of text.
|
|
12
|
+
* Rule of thumb: 1 CJK char ≈ 2 tokens, 1 ASCII char ≈ 0.25 tokens.
|
|
13
|
+
*/
|
|
14
|
+
export function estimateTokens(text: string): number {
|
|
15
|
+
let tokens = 0;
|
|
16
|
+
for (const ch of text) {
|
|
17
|
+
// CJK Unified Ideographs + common CJK ranges(charCodeAt 区间判断,与原正则等价):
|
|
18
|
+
// U+3400–U+4DBF(Ext A)、U+4E00–U+9FFF(Unified)、U+F900–U+FAFF(兼容表意)
|
|
19
|
+
const code = ch.charCodeAt(0);
|
|
20
|
+
if ((code >= 0x3400 && code <= 0x4dbf) || (code >= 0x4e00 && code <= 0x9fff) || (code >= 0xf900 && code <= 0xfaff)) {
|
|
21
|
+
tokens += 2;
|
|
22
|
+
} else {
|
|
23
|
+
tokens += 0.25;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return Math.ceil(tokens);
|
|
27
|
+
}
|
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
# monitoring/
|
|
2
2
|
|
|
3
3
|
## 职责
|
|
4
|
-
运行时监控:Execution Trace
|
|
4
|
+
运行时监控:Execution Trace(收集/分析)。
|
|
5
5
|
|
|
6
6
|
## 核心导出
|
|
7
7
|
- `TraceCollector` — 执行追踪收集(append-only JSONL,`.harness/logs/traces.log`)。读入口三个:`readReport(filter?)` 报告入口(返回 `{ traces, skippedLines }`,harness#100)、`read()/readRecent()/readByConstraint()` 兼容包装(#82 裁决 4 冻结的签名,丢计数)、`getStats()` 文件级统计(`{ fileExists, fileSize, totalLines, oldestTrace?, newestTrace? }`,harness#114 起经 `readJsonlEnds` 只 parse 两端;坏行并进 `totalLines` 的原始行数口径,要单列坏行数用 `readReport()`)
|
|
8
|
-
-
|
|
9
|
-
- `TraceAnalyzer` — 追踪统计分析 + 异常检测(共用 analyzer-base 纯函数)。`analyzeRecentReport(hours)` 带坏行数,`analyzeRecent()/analyzeConstraint()` 仍返回 `TraceSummary[]`。**ADR-0020**:`summarize`/`detectAnomalies` 的判定本体是 trace-analyzer.ts 的模块级纯函数 `summarizeTraces(traces)` / `detectTraceAnomalies(summaries, config?)`(阈值经参数传入,不再是实例状态),类壳只转发——类壳是跨仓消费方的运行时消费面(`new TraceAnalyzer(c)` + `analyzeRecentReport`/`detectAnomalies`,签名逐字不动),已持有数据的消费端直调纯函数。两函数**不进包根导出**(ADR-0003 零扩张),仓内经相对 import
|
|
10
|
-
- `ContextTracker` — LLM 调用上下文使用快照记录
|
|
8
|
+
- `pruneTraceLogs(target, { maxAgeDays? })` — traces 轮转备份清理的独立库入口(harness#198,`TraceCollector.cleanupOldFiles` 的薄包装,默认 30 天,返回删除数):消费方不需要理解 traces 目录布局、不再手删 `.harness/logs/` 文件;不构造 collector——目录不存在 no-op 返回 0、不创建目录,零副作用
|
|
9
|
+
- `TraceAnalyzer` — 追踪统计分析 + 异常检测(共用 analyzer-base 纯函数)。`analyzeRecentReport(hours)` 带坏行数,`analyzeRecent()/analyzeConstraint()` 仍返回 `TraceSummary[]`。**ADR-0020**:`summarize`/`detectAnomalies` 的判定本体是 trace-analyzer.ts 的模块级纯函数 `summarizeTraces(traces)` / `detectTraceAnomalies(summaries, config?)`(阈值经参数传入,不再是实例状态),类壳只转发——类壳是跨仓消费方的运行时消费面(`new TraceAnalyzer(c)` + `analyzeRecentReport`/`detectAnomalies`,签名逐字不动),已持有数据的消费端直调纯函数。两函数**不进包根导出**(ADR-0003 零扩张),仓内经相对 import。原 `createAnalyzer` 工厂已随 #199 删除(双仓零编程消费者,等价写法 `new TraceAnalyzer(new TraceCollector(), config)`)
|
|
11
10
|
|
|
12
11
|
## 依赖关系
|
|
13
|
-
- 依赖 `src/types/trace` ExecutionTrace
|
|
14
|
-
- 消费者:`src/cli/commands/{check,report}` 与 `src/hooks/bootstrap`——组合根**锚根构造**收集器 `new TraceCollector({ projectPath })` 并注入 `ConstraintChecker` 构造参数(harness#88 接线,#139
|
|
15
|
-
- `ContextTracker` 的仓内持有者是 `src/context/session-manager`:构造时收 `basePath` 并经 `getTracker()` 交出。仓内**无** `record()` 调用点,`getRecent()/getAverages()/detectIssues()` 也无 CLI 接线(`getTracker()` 零仓内调用方),快照的写入方与读方都是库消费者(经包根 `ContextTracker` 出口,ADR-0003)——harness#142 核对补上这条消费边,此前只列了 trace 侧消费者
|
|
12
|
+
- 依赖 `src/types/trace` ExecutionTrace 类型、`src/utils/`(jsonl 等);对 `src/context/` 零依赖
|
|
13
|
+
- 消费者:`src/cli/commands/{check,report}` 与 `src/hooks/bootstrap`——组合根**锚根构造**收集器 `new TraceCollector({ projectPath })` 并注入 `ConstraintChecker` 构造参数(harness#88 接线,#139 收根);`status` 按 projectPath 直读读链正本后**直调模块级纯函数**,不构造 collector/类壳(ADR-0020:collector 构造函数的 mkdir 副作用就此退出该路径)
|
|
16
14
|
- core 不再依赖本模块(方向由 eslint no-restricted-imports 锁死,`src/__tests__/layering.test.ts` 守卫)
|
|
17
15
|
|
|
18
16
|
## 约定
|
|
19
17
|
- Trace 文件存储在 .harness/ 目录(不提交)
|
|
20
|
-
- **落点锚在 projectPath 上,不锚 cwd(harness#139,#95 约定的 trace 侧)**:`DEFAULT_TRACE_FILE` 是**项目相对片段**、不是可直接打开的路径,`TraceCollector` 构造收可选 `projectPath`——给了则缺省/相对的 `traceFile` 一律 `path.resolve(projectPath, …)`,没给则保持 cwd
|
|
18
|
+
- **落点锚在 projectPath 上,不锚 cwd(harness#139,#95 约定的 trace 侧)**:`DEFAULT_TRACE_FILE` 是**项目相对片段**、不是可直接打开的路径,`TraceCollector` 构造收可选 `projectPath`——给了则缺省/相对的 `traceFile` 一律 `path.resolve(projectPath, …)`,没给则保持 cwd 解析。写侧锚根与读侧(`status`/`constraints report` 按 projectPath 直读 jsonl 正本)必须同锚,否则从别处带 `--project-path` 跑一次 check 就是「评估真跑了 B、trace 写进 A」的假绿。可检面:`__tests__/trace-file-anchoring.test.ts`(两态落点 + 读侧同锚)、`src/cli/commands/__tests__/project-path-anchoring.test.ts` 站点 3(命令面写-读闭环)、`src/cli/commands/__tests__/project-path-convention.test.ts` 闸 3(`xxxPath|File|Log` 相对默认值冻结,含常量引用臂)。原 cwd 锚定的 `getTraceCollector()`/`configureTraceCollector()` 单例出口(连同守护闸 4)已随 #199 删除——双仓零编程消费者,要落指定项目一律 `new TraceCollector({ projectPath })`
|
|
21
19
|
- 追加写入,单行 JSON,自动滚动
|
|
22
20
|
- 零 Token 成本:不调用 LLM
|
|
23
21
|
- **凡以 `skip` 策略读 JSONL,坏行计数必须到达该消费面的用户可见输出,或在该调用点显式记名豁免并写明理由(harness#100)**——静默吞掉「数据不全」不是一种可选项。承载方式纯增量:新报告入口带计数,旧入口退化为丢计数的薄包装(#82 裁决 4 的兼容约束继续成立),不另立第二份计数概念、不把 `JsonlReadResult` 提升进包根(ADR-0003)
|