@dommaker/harness 0.16.6 → 0.16.8
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 +15 -0
- package/README.md +54 -14
- package/bin/harness.js +56 -96
- package/dist/architecture/constraint-engine.d.ts.map +1 -1
- package/dist/architecture/constraint-engine.js +0 -4
- package/dist/architecture/constraint-engine.js.map +1 -1
- package/dist/architecture/cross-project-checker.d.ts.map +1 -1
- package/dist/architecture/cross-project-checker.js +5 -25
- package/dist/architecture/cross-project-checker.js.map +1 -1
- package/dist/cli/commands/analyze-sessions.d.ts +2 -0
- package/dist/cli/commands/analyze-sessions.d.ts.map +1 -1
- package/dist/cli/commands/analyze-sessions.js +25 -181
- package/dist/cli/commands/analyze-sessions.js.map +1 -1
- package/dist/cli/commands/check.d.ts +1 -0
- package/dist/cli/commands/check.d.ts.map +1 -1
- package/dist/cli/commands/check.js +24 -216
- package/dist/cli/commands/check.js.map +1 -1
- package/dist/cli/commands/doc-freshness-check.d.ts.map +1 -1
- package/dist/cli/commands/doc-freshness-check.js +14 -28
- package/dist/cli/commands/doc-freshness-check.js.map +1 -1
- package/dist/cli/commands/flow.d.ts.map +1 -1
- package/dist/cli/commands/flow.js +2 -1
- package/dist/cli/commands/flow.js.map +1 -1
- package/dist/cli/commands/init.js +2 -2
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/posteval-plan.d.ts.map +1 -1
- package/dist/cli/commands/posteval-plan.js +0 -1
- package/dist/cli/commands/posteval-plan.js.map +1 -1
- package/dist/cli/commands/release.js +1 -1
- package/dist/cli/commands/release.js.map +1 -1
- package/dist/cli/commands/report.d.ts.map +1 -1
- package/dist/cli/commands/report.js +2 -0
- package/dist/cli/commands/report.js.map +1 -1
- package/dist/cli/commands/spec-baseline-check.d.ts.map +1 -1
- package/dist/cli/commands/spec-baseline-check.js +12 -23
- package/dist/cli/commands/spec-baseline-check.js.map +1 -1
- package/dist/cli/commands/sync-docs/agents-syncer.d.ts +19 -0
- package/dist/cli/commands/sync-docs/agents-syncer.d.ts.map +1 -0
- package/dist/cli/commands/sync-docs/agents-syncer.js +288 -0
- package/dist/cli/commands/sync-docs/agents-syncer.js.map +1 -0
- package/dist/cli/commands/sync-docs/capabilities-syncer.d.ts +37 -0
- package/dist/cli/commands/sync-docs/capabilities-syncer.d.ts.map +1 -0
- package/dist/cli/commands/sync-docs/capabilities-syncer.js +235 -0
- package/dist/cli/commands/sync-docs/capabilities-syncer.js.map +1 -0
- package/dist/cli/commands/sync-docs/context-syncer.d.ts +17 -0
- package/dist/cli/commands/sync-docs/context-syncer.d.ts.map +1 -0
- package/dist/cli/commands/sync-docs/context-syncer.js +143 -0
- package/dist/cli/commands/sync-docs/context-syncer.js.map +1 -0
- package/dist/cli/commands/{sync-docs.d.ts → sync-docs/index.d.ts} +9 -2
- package/dist/cli/commands/sync-docs/index.d.ts.map +1 -0
- package/dist/cli/commands/sync-docs/index.js +338 -0
- package/dist/cli/commands/sync-docs/index.js.map +1 -0
- package/dist/cli/commands/sync-docs/preserve-block.d.ts +24 -0
- package/dist/cli/commands/sync-docs/preserve-block.d.ts.map +1 -0
- package/dist/cli/commands/sync-docs/preserve-block.js +55 -0
- package/dist/cli/commands/sync-docs/preserve-block.js.map +1 -0
- package/dist/cli/commands/sync-docs/project-reader.d.ts +41 -0
- package/dist/cli/commands/sync-docs/project-reader.d.ts.map +1 -0
- package/dist/cli/commands/sync-docs/project-reader.js +183 -0
- package/dist/cli/commands/sync-docs/project-reader.js.map +1 -0
- package/dist/cli/commands/update-user-model.d.ts +2 -0
- package/dist/cli/commands/update-user-model.d.ts.map +1 -1
- package/dist/cli/commands/update-user-model.js +19 -90
- package/dist/cli/commands/update-user-model.js.map +1 -1
- package/dist/cli/commands/validate.d.ts +3 -0
- package/dist/cli/commands/validate.d.ts.map +1 -1
- package/dist/cli/commands/validate.js +6 -39
- package/dist/cli/commands/validate.js.map +1 -1
- package/dist/cli/session-mining/corrections.d.ts +17 -0
- package/dist/cli/session-mining/corrections.d.ts.map +1 -0
- package/dist/cli/session-mining/corrections.js +58 -0
- package/dist/cli/session-mining/corrections.js.map +1 -0
- package/dist/cli/session-mining/index.d.ts +13 -0
- package/dist/cli/session-mining/index.d.ts.map +1 -0
- package/dist/{core/spec → cli/session-mining}/index.js +9 -3
- package/dist/cli/session-mining/index.js.map +1 -0
- package/dist/cli/session-mining/text.d.ts +31 -0
- package/dist/cli/session-mining/text.d.ts.map +1 -0
- package/dist/cli/session-mining/text.js +126 -0
- package/dist/cli/session-mining/text.js.map +1 -0
- package/dist/cli/session-mining/transcript.d.ts +28 -0
- package/dist/cli/session-mining/transcript.d.ts.map +1 -0
- package/dist/cli/session-mining/transcript.js +123 -0
- package/dist/cli/session-mining/transcript.js.map +1 -0
- package/dist/constraints/lifecycle-runner.d.ts +1 -1
- package/dist/constraints/lifecycle-runner.d.ts.map +1 -1
- package/dist/context/compaction.d.ts.map +1 -1
- package/dist/context/compaction.js +2 -3
- package/dist/context/compaction.js.map +1 -1
- package/dist/context/knowledge-injector.d.ts.map +1 -1
- package/dist/context/tool-output-budget.d.ts +1 -1
- package/dist/context/tool-output-budget.d.ts.map +1 -1
- package/dist/context/tool-output-budget.js +1 -1
- package/dist/context/tool-output-budget.js.map +1 -1
- package/dist/core/constraints/capabilities-parser.d.ts +24 -0
- package/dist/core/constraints/capabilities-parser.d.ts.map +1 -0
- package/dist/core/constraints/capabilities-parser.js +95 -0
- package/dist/core/constraints/capabilities-parser.js.map +1 -0
- package/dist/core/constraints/checker.d.ts +37 -100
- package/dist/core/constraints/checker.d.ts.map +1 -1
- package/dist/core/constraints/checker.js +150 -737
- package/dist/core/constraints/checker.js.map +1 -1
- package/dist/core/constraints/checkers/always-pass.d.ts +17 -0
- package/dist/core/constraints/checkers/always-pass.d.ts.map +1 -0
- package/dist/core/constraints/checkers/always-pass.js +23 -0
- package/dist/core/constraints/checkers/always-pass.js.map +1 -0
- package/dist/core/constraints/checkers/capability-sync.d.ts +10 -0
- package/dist/core/constraints/checkers/capability-sync.d.ts.map +1 -0
- package/dist/core/constraints/checkers/capability-sync.js +60 -0
- package/dist/core/constraints/checkers/capability-sync.js.map +1 -0
- package/dist/core/constraints/checkers/context-doc-sync.d.ts +6 -0
- package/dist/core/constraints/checkers/context-doc-sync.d.ts.map +1 -0
- package/dist/core/constraints/checkers/context-doc-sync.js +35 -0
- package/dist/core/constraints/checkers/context-doc-sync.js.map +1 -0
- package/dist/core/constraints/checkers/docs-freshness.d.ts +10 -0
- package/dist/core/constraints/checkers/docs-freshness.d.ts.map +1 -0
- package/dist/core/constraints/checkers/docs-freshness.js +111 -0
- package/dist/core/constraints/checkers/docs-freshness.js.map +1 -0
- package/dist/core/constraints/checkers/guideline-flags.d.ts +9 -0
- package/dist/core/constraints/checkers/guideline-flags.d.ts.map +1 -0
- package/dist/core/constraints/checkers/guideline-flags.js +13 -0
- package/dist/core/constraints/checkers/guideline-flags.js.map +1 -0
- package/dist/core/constraints/checkers/index.d.ts +17 -0
- package/dist/core/constraints/checkers/index.d.ts.map +1 -0
- package/dist/core/constraints/checkers/index.js +82 -0
- package/dist/core/constraints/checkers/index.js.map +1 -0
- package/dist/core/constraints/checkers/iron-flags.d.ts +14 -0
- package/dist/core/constraints/checkers/iron-flags.d.ts.map +1 -0
- package/dist/core/constraints/checkers/iron-flags.js +24 -0
- package/dist/core/constraints/checkers/iron-flags.js.map +1 -0
- package/dist/core/constraints/checkers/no-any-type.d.ts +6 -0
- package/dist/core/constraints/checkers/no-any-type.d.ts.map +1 -0
- package/dist/core/constraints/checkers/no-any-type.js +42 -0
- package/dist/core/constraints/checkers/no-any-type.js.map +1 -0
- package/dist/core/constraints/checkers/no-bypass-checkpoint.d.ts +6 -0
- package/dist/core/constraints/checkers/no-bypass-checkpoint.d.ts.map +1 -0
- package/dist/core/constraints/checkers/no-bypass-checkpoint.js +40 -0
- package/dist/core/constraints/checkers/no-bypass-checkpoint.js.map +1 -0
- package/dist/core/constraints/checkers/no-excuse-patterns.d.ts +6 -0
- package/dist/core/constraints/checkers/no-excuse-patterns.d.ts.map +1 -0
- package/dist/core/constraints/checkers/no-excuse-patterns.js +25 -0
- package/dist/core/constraints/checkers/no-excuse-patterns.js.map +1 -0
- package/dist/core/constraints/checkers/no-fuzzy-completion-claim.d.ts +6 -0
- package/dist/core/constraints/checkers/no-fuzzy-completion-claim.d.ts.map +1 -0
- package/dist/core/constraints/checkers/no-fuzzy-completion-claim.js +34 -0
- package/dist/core/constraints/checkers/no-fuzzy-completion-claim.js.map +1 -0
- package/dist/core/constraints/checkers/no-performative-agreement.d.ts +8 -0
- package/dist/core/constraints/checkers/no-performative-agreement.d.ts.map +1 -0
- package/dist/core/constraints/checkers/no-performative-agreement.js +23 -0
- package/dist/core/constraints/checkers/no-performative-agreement.js.map +1 -0
- package/dist/core/constraints/checkers/no-simplification-without-approval.d.ts +6 -0
- package/dist/core/constraints/checkers/no-simplification-without-approval.d.ts.map +1 -0
- package/dist/core/constraints/checkers/no-simplification-without-approval.js +30 -0
- package/dist/core/constraints/checkers/no-simplification-without-approval.js.map +1 -0
- package/dist/core/constraints/checkers/no-test-simplification.d.ts +6 -0
- package/dist/core/constraints/checkers/no-test-simplification.d.ts.map +1 -0
- package/dist/core/constraints/checkers/no-test-simplification.js +29 -0
- package/dist/core/constraints/checkers/no-test-simplification.js.map +1 -0
- package/dist/core/constraints/checkers/test-coverage.d.ts +6 -0
- package/dist/core/constraints/checkers/test-coverage.d.ts.map +1 -0
- package/dist/core/constraints/checkers/test-coverage.js +33 -0
- package/dist/core/constraints/checkers/test-coverage.js.map +1 -0
- package/dist/core/constraints/checkers/types.d.ts +43 -0
- package/dist/core/constraints/checkers/types.d.ts.map +1 -0
- package/dist/core/constraints/checkers/types.js +23 -0
- package/dist/core/constraints/checkers/types.js.map +1 -0
- package/dist/core/constraints/checkers/yagni.d.ts +8 -0
- package/dist/core/constraints/checkers/yagni.d.ts.map +1 -0
- package/dist/core/constraints/checkers/yagni.js +96 -0
- package/dist/core/constraints/checkers/yagni.js.map +1 -0
- package/dist/core/constraints/context-builder.d.ts +67 -0
- package/dist/core/constraints/context-builder.d.ts.map +1 -0
- package/dist/core/constraints/context-builder.js +294 -0
- package/dist/core/constraints/context-builder.js.map +1 -0
- package/dist/core/constraints/definitions/guidelines.d.ts +7 -0
- package/dist/core/constraints/definitions/guidelines.d.ts.map +1 -0
- package/dist/core/constraints/definitions/guidelines.js +641 -0
- package/dist/core/constraints/definitions/guidelines.js.map +1 -0
- package/dist/core/constraints/definitions/iron-laws.d.ts +7 -0
- package/dist/core/constraints/definitions/iron-laws.d.ts.map +1 -0
- package/dist/core/constraints/definitions/iron-laws.js +322 -0
- package/dist/core/constraints/definitions/iron-laws.js.map +1 -0
- package/dist/core/constraints/definitions/tips.d.ts +7 -0
- package/dist/core/constraints/definitions/tips.d.ts.map +1 -0
- package/dist/core/constraints/definitions/tips.js +62 -0
- package/dist/core/constraints/definitions/tips.js.map +1 -0
- package/dist/core/constraints/definitions.d.ts +8 -21
- package/dist/core/constraints/definitions.d.ts.map +1 -1
- package/dist/core/constraints/definitions.js +15 -1048
- package/dist/core/constraints/definitions.js.map +1 -1
- package/dist/core/constraints/doc-freshness/runner.d.ts.map +1 -1
- package/dist/core/constraints/doc-freshness/runner.js +0 -1
- package/dist/core/constraints/doc-freshness/runner.js.map +1 -1
- package/dist/core/constraints/index.d.ts +4 -5
- package/dist/core/constraints/index.d.ts.map +1 -1
- package/dist/core/constraints/index.js +1 -16
- package/dist/core/constraints/index.js.map +1 -1
- package/dist/core/constraints/interceptor.d.ts.map +1 -1
- package/dist/core/constraints/interceptor.js.map +1 -1
- package/dist/core/index.js +0 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/project-config-loader.d.ts +6 -4
- package/dist/core/project-config-loader.d.ts.map +1 -1
- package/dist/core/project-config-loader.js +46 -13
- package/dist/core/project-config-loader.js.map +1 -1
- package/dist/core/validators/check-handlers/command.d.ts +7 -0
- package/dist/core/validators/check-handlers/command.d.ts.map +1 -0
- package/dist/core/validators/check-handlers/command.js +58 -0
- package/dist/core/validators/check-handlers/command.js.map +1 -0
- package/dist/core/validators/check-handlers/file.d.ts +10 -0
- package/dist/core/validators/check-handlers/file.d.ts.map +1 -0
- package/dist/core/validators/check-handlers/file.js +128 -0
- package/dist/core/validators/check-handlers/file.js.map +1 -0
- package/dist/core/validators/check-handlers/http.d.ts +7 -0
- package/dist/core/validators/check-handlers/http.d.ts.map +1 -0
- package/dist/core/validators/check-handlers/http.js +88 -0
- package/dist/core/validators/check-handlers/http.js.map +1 -0
- package/dist/core/validators/check-handlers/output.d.ts +15 -0
- package/dist/core/validators/check-handlers/output.d.ts.map +1 -0
- package/dist/core/validators/check-handlers/output.js +152 -0
- package/dist/core/validators/check-handlers/output.js.map +1 -0
- package/dist/core/validators/checkpoint.d.ts +4 -72
- package/dist/core/validators/checkpoint.d.ts.map +1 -1
- package/dist/core/validators/checkpoint.js +21 -400
- package/dist/core/validators/checkpoint.js.map +1 -1
- package/dist/core/validators/cso.js +1 -1
- package/dist/core/validators/cso.js.map +1 -1
- package/dist/core/validators/passes-gate.js +2 -2
- package/dist/core/validators/passes-gate.js.map +1 -1
- package/dist/dashboard/stats.d.ts.map +1 -1
- package/dist/dashboard/types.d.ts.map +1 -1
- package/dist/evolution/auto-evolve.d.ts +1 -2
- package/dist/evolution/auto-evolve.d.ts.map +1 -1
- package/dist/evolution/auto-evolve.js +2 -1
- package/dist/evolution/auto-evolve.js.map +1 -1
- package/dist/failure/types.d.ts +5 -85
- package/dist/failure/types.d.ts.map +1 -1
- package/dist/failure/types.js +19 -115
- package/dist/failure/types.js.map +1 -1
- package/dist/gates/contract.d.ts.map +1 -1
- package/dist/gates/contract.js.map +1 -1
- package/dist/gates/index.d.ts.map +1 -1
- package/dist/gates/index.js.map +1 -1
- package/dist/gates/performance.js +1 -1
- package/dist/gates/performance.js.map +1 -1
- package/dist/gates/security.d.ts.map +1 -1
- package/dist/gates/security.js +1 -1
- package/dist/gates/security.js.map +1 -1
- package/dist/hooks/bootstrap.d.ts.map +1 -1
- package/dist/hooks/bootstrap.js +6 -48
- package/dist/hooks/bootstrap.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/knowledge/audit.d.ts.map +1 -1
- package/dist/knowledge/doctor.d.ts.map +1 -1
- package/dist/knowledge/doctor.js.map +1 -1
- package/dist/knowledge/import.d.ts.map +1 -1
- package/dist/knowledge/import.js +1 -1
- package/dist/knowledge/import.js.map +1 -1
- package/dist/knowledge/index-generator.d.ts.map +1 -1
- package/dist/knowledge/index-generator.js +0 -1
- package/dist/knowledge/index-generator.js.map +1 -1
- package/dist/knowledge/ingest.d.ts.map +1 -1
- package/dist/knowledge/ingest.js +1 -1
- package/dist/knowledge/ingest.js.map +1 -1
- package/dist/knowledge/lint.d.ts +1 -1
- package/dist/knowledge/lint.d.ts.map +1 -1
- package/dist/knowledge/lint.js +2 -2
- package/dist/knowledge/lint.js.map +1 -1
- package/dist/knowledge/primitives/code-structure.d.ts.map +1 -1
- package/dist/knowledge/primitives/code-structure.js +29 -12
- package/dist/knowledge/primitives/code-structure.js.map +1 -1
- package/dist/knowledge/query.d.ts.map +1 -1
- package/dist/knowledge/query.js.map +1 -1
- package/dist/knowledge/store.d.ts.map +1 -1
- package/dist/llm/adapter.d.ts +3 -3
- package/dist/llm/adapter.d.ts.map +1 -1
- package/dist/llm/adapter.js +3 -3
- package/dist/llm/adapter.js.map +1 -1
- package/dist/monitoring/analyzer-base.d.ts +50 -0
- package/dist/monitoring/analyzer-base.d.ts.map +1 -0
- package/dist/monitoring/analyzer-base.js +146 -0
- package/dist/monitoring/analyzer-base.js.map +1 -0
- package/dist/monitoring/constraint-doctor.d.ts +3 -46
- package/dist/monitoring/constraint-doctor.d.ts.map +1 -1
- package/dist/monitoring/constraint-doctor.js +11 -113
- package/dist/monitoring/constraint-doctor.js.map +1 -1
- package/dist/monitoring/constraint-evolver.d.ts +9 -63
- package/dist/monitoring/constraint-evolver.d.ts.map +1 -1
- package/dist/monitoring/constraint-evolver.js +8 -10
- package/dist/monitoring/constraint-evolver.js.map +1 -1
- package/dist/monitoring/diagnosis-rules.d.ts +18 -0
- package/dist/monitoring/diagnosis-rules.d.ts.map +1 -0
- package/dist/monitoring/diagnosis-rules.js +119 -0
- package/dist/monitoring/diagnosis-rules.js.map +1 -0
- package/dist/monitoring/knowledge-doctor.d.ts.map +1 -1
- package/dist/monitoring/knowledge-doctor.js.map +1 -1
- package/dist/monitoring/performance-analyzer.d.ts +0 -12
- package/dist/monitoring/performance-analyzer.d.ts.map +1 -1
- package/dist/monitoring/performance-analyzer.js +13 -93
- package/dist/monitoring/performance-analyzer.js.map +1 -1
- package/dist/monitoring/performance-collector.d.ts +0 -8
- package/dist/monitoring/performance-collector.d.ts.map +1 -1
- package/dist/monitoring/performance-collector.js +0 -21
- package/dist/monitoring/performance-collector.js.map +1 -1
- package/dist/monitoring/trace-analyzer.d.ts +0 -8
- package/dist/monitoring/trace-analyzer.d.ts.map +1 -1
- package/dist/monitoring/trace-analyzer.js +9 -91
- package/dist/monitoring/trace-analyzer.js.map +1 -1
- package/dist/presets/index.d.ts +1 -1
- package/dist/presets/index.d.ts.map +1 -1
- package/dist/presets/index.js +1 -4
- package/dist/presets/index.js.map +1 -1
- package/dist/presets/standard.d.ts +0 -9
- package/dist/presets/standard.d.ts.map +1 -1
- package/dist/presets/standard.js +1 -16
- package/dist/presets/standard.js.map +1 -1
- package/dist/safety/output-guardrail.d.ts +0 -1
- package/dist/safety/output-guardrail.d.ts.map +1 -1
- package/dist/safety/output-guardrail.js +0 -3
- package/dist/safety/output-guardrail.js.map +1 -1
- package/dist/tools/registry.d.ts.map +1 -1
- package/dist/types/constraint.d.ts +5 -59
- package/dist/types/constraint.d.ts.map +1 -1
- package/dist/types/constraint.js +1 -39
- package/dist/types/constraint.js.map +1 -1
- package/dist/types/failure.d.ts +89 -0
- package/dist/types/failure.d.ts.map +1 -0
- package/dist/types/failure.js +121 -0
- package/dist/types/failure.js.map +1 -0
- package/dist/types/index.d.ts +2 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +7 -6
- package/dist/types/index.js.map +1 -1
- package/dist/types/monitoring-types.d.ts +114 -0
- package/dist/types/monitoring-types.d.ts.map +1 -0
- package/dist/types/monitoring-types.js +10 -0
- package/dist/types/monitoring-types.js.map +1 -0
- package/dist/utils/detect-source-roots.js.map +1 -1
- package/dist/utils/file-walk.d.ts +33 -0
- package/dist/utils/file-walk.d.ts.map +1 -0
- package/dist/utils/file-walk.js +89 -0
- package/dist/utils/file-walk.js.map +1 -0
- package/dist/verification/rules-based.d.ts.map +1 -1
- package/dist/verification/rules-based.js.map +1 -1
- package/package.json +3 -7
- package/src/__tests__/checker-extra.test.ts +0 -30
- package/src/__tests__/checker.test.ts +0 -33
- package/src/__tests__/checkpoint.test.ts +46 -46
- package/src/__tests__/constraint-evolver.test.ts +22 -21
- package/src/__tests__/doctor-evolver.test.ts +3 -3
- package/src/__tests__/iron-laws.test.ts +0 -27
- package/src/__tests__/presets.test.ts +1 -40
- package/src/architecture/constraint-engine.ts +0 -5
- package/src/architecture/cross-project-checker.ts +6 -24
- package/src/cli/commands/__tests__/check.test.ts +3 -1
- package/src/cli/commands/__tests__/sync-docs.test.ts +77 -0
- package/src/cli/commands/__tests__/validate.test.ts +5 -0
- package/src/cli/commands/analyze-sessions.ts +31 -185
- package/src/cli/commands/check.ts +26 -225
- package/src/cli/commands/doc-freshness-check.ts +14 -25
- package/src/cli/commands/flow.ts +5 -3
- package/src/cli/commands/init.ts +3 -3
- package/src/cli/commands/posteval-plan.ts +0 -1
- package/src/cli/commands/release.ts +1 -1
- package/src/cli/commands/report.ts +2 -0
- package/src/cli/commands/spec-baseline-check.ts +12 -19
- package/src/cli/commands/sync-docs/agents-syncer.ts +280 -0
- package/src/cli/commands/sync-docs/capabilities-syncer.ts +229 -0
- package/src/cli/commands/sync-docs/context-syncer.ts +108 -0
- package/src/cli/commands/sync-docs/index.ts +355 -0
- package/src/cli/commands/sync-docs/preserve-block.ts +59 -0
- package/src/cli/commands/sync-docs/project-reader.ts +163 -0
- package/src/cli/commands/update-user-model.ts +23 -87
- package/src/cli/commands/validate.ts +6 -40
- package/src/cli/session-mining/corrections.ts +56 -0
- package/src/cli/session-mining/index.ts +13 -0
- package/src/cli/session-mining/text.ts +117 -0
- package/src/cli/session-mining/transcript.ts +107 -0
- package/src/constraints/__tests__/lifecycle-runner.test.ts +1 -1
- package/src/constraints/lifecycle-runner.ts +1 -1
- package/src/context/compaction.ts +2 -3
- package/src/context/knowledge-injector.ts +1 -1
- package/src/context/tool-output-budget.ts +1 -1
- package/src/core/constraints/capabilities-parser.ts +70 -0
- package/src/core/constraints/checker.ts +170 -779
- package/src/core/constraints/checkers/always-pass.ts +22 -0
- package/src/core/constraints/checkers/capability-sync.ts +71 -0
- package/src/core/constraints/checkers/context-doc-sync.ts +36 -0
- package/src/core/constraints/checkers/docs-freshness.ts +116 -0
- package/src/core/constraints/checkers/guideline-flags.ts +30 -0
- package/src/core/constraints/checkers/index.ts +114 -0
- package/src/core/constraints/checkers/iron-flags.ts +62 -0
- package/src/core/constraints/checkers/no-any-type.ts +42 -0
- package/src/core/constraints/checkers/no-bypass-checkpoint.ts +40 -0
- package/src/core/constraints/checkers/no-excuse-patterns.ts +24 -0
- package/src/core/constraints/checkers/no-fuzzy-completion-claim.ts +33 -0
- package/src/core/constraints/checkers/no-performative-agreement.ts +22 -0
- package/src/core/constraints/checkers/no-simplification-without-approval.ts +29 -0
- package/src/core/constraints/checkers/no-test-simplification.ts +28 -0
- package/src/core/constraints/checkers/test-coverage.ts +35 -0
- package/src/core/constraints/checkers/types.ts +54 -0
- package/src/core/constraints/checkers/yagni.ts +65 -0
- package/src/core/constraints/context-builder.ts +262 -0
- package/src/core/constraints/definitions/guidelines.ts +668 -0
- package/src/core/constraints/definitions/iron-laws.ts +333 -0
- package/src/core/constraints/definitions/tips.ts +63 -0
- package/src/core/constraints/definitions.ts +9 -1086
- package/src/core/constraints/doc-freshness/runner.ts +2 -3
- package/src/core/constraints/index.ts +1 -27
- package/src/core/constraints/interceptor.ts +0 -2
- package/src/core/index.ts +1 -1
- package/src/core/project-config-loader.ts +49 -13
- package/src/core/validators/check-handlers/command.ts +58 -0
- package/src/core/validators/check-handlers/file.ts +104 -0
- package/src/core/validators/check-handlers/http.ts +88 -0
- package/src/core/validators/check-handlers/output.ts +165 -0
- package/src/core/validators/checkpoint.ts +32 -407
- package/src/core/validators/cso.ts +1 -1
- package/src/core/validators/passes-gate.ts +2 -2
- package/src/dashboard/stats.ts +1 -1
- package/src/dashboard/types.ts +1 -1
- package/src/evolution/__tests__/auto-evolve.test.ts +1 -2
- package/src/evolution/auto-evolve.ts +3 -3
- package/src/failure/types.ts +5 -161
- package/src/gates/contract.ts +0 -1
- package/src/gates/index.ts +0 -2
- package/src/gates/performance.ts +1 -1
- package/src/gates/security.ts +1 -3
- package/src/hooks/bootstrap.ts +6 -16
- package/src/index.ts +4 -1
- package/src/knowledge/__tests__/lifecycle.test.ts +4 -1
- package/src/knowledge/audit.ts +1 -1
- package/src/knowledge/doctor.ts +0 -1
- package/src/knowledge/import.ts +2 -2
- package/src/knowledge/index-generator.ts +0 -1
- package/src/knowledge/ingest.ts +1 -2
- package/src/knowledge/lint.ts +2 -2
- package/src/knowledge/primitives/__tests__/code-structure-degrade.test.ts +24 -0
- package/src/knowledge/primitives/code-structure.ts +36 -12
- package/src/knowledge/query.ts +0 -3
- package/src/knowledge/store.ts +1 -1
- package/src/llm/adapter.ts +3 -3
- package/src/monitoring/analyzer-base.ts +112 -0
- package/src/monitoring/constraint-doctor.ts +14 -175
- package/src/monitoring/constraint-evolver.ts +20 -92
- package/src/monitoring/diagnosis-rules.ts +132 -0
- package/src/monitoring/knowledge-doctor.ts +0 -1
- package/src/monitoring/performance-analyzer.ts +22 -72
- package/src/monitoring/performance-collector.ts +0 -22
- package/src/monitoring/trace-analyzer.ts +17 -73
- package/src/presets/__tests__/standard.test.ts +2 -17
- package/src/presets/index.ts +1 -3
- package/src/presets/standard.ts +1 -26
- package/src/safety/output-guardrail.ts +0 -4
- package/src/tools/registry.ts +1 -1
- package/src/types/__tests__/types.test.ts +1 -33
- package/src/types/constraint.ts +6 -75
- package/src/types/failure.ts +165 -0
- package/src/types/index.ts +7 -5
- package/src/types/monitoring-types.ts +150 -0
- package/src/utils/detect-source-roots.ts +1 -1
- package/src/utils/file-walk.ts +78 -0
- package/src/verification/rules-based.ts +0 -1
- package/bin/harness-knowledge-capture.js +0 -99
- package/bin/harness-knowledge-check.js +0 -164
- package/bin/harness-knowledge-track.js +0 -118
- package/dist/cli/commands/sync-docs.d.ts.map +0 -1
- package/dist/cli/commands/sync-docs.js +0 -1074
- package/dist/cli/commands/sync-docs.js.map +0 -1
- package/dist/constraints/index.d.ts +0 -4
- package/dist/constraints/index.d.ts.map +0 -1
- package/dist/constraints/index.js +0 -20
- package/dist/constraints/index.js.map +0 -1
- package/dist/core/constraints/doc-freshness/auto-fix.d.ts +0 -23
- package/dist/core/constraints/doc-freshness/auto-fix.d.ts.map +0 -1
- package/dist/core/constraints/doc-freshness/auto-fix.js +0 -59
- package/dist/core/constraints/doc-freshness/auto-fix.js.map +0 -1
- package/dist/core/constraints/prompt-injection.d.ts +0 -16
- package/dist/core/constraints/prompt-injection.d.ts.map +0 -1
- package/dist/core/constraints/prompt-injection.js +0 -69
- package/dist/core/constraints/prompt-injection.js.map +0 -1
- package/dist/core/spec/index.d.ts +0 -7
- package/dist/core/spec/index.d.ts.map +0 -1
- package/dist/core/spec/index.js.map +0 -1
- package/dist/governance/executor.d.ts +0 -45
- package/dist/governance/executor.d.ts.map +0 -1
- package/dist/governance/executor.js +0 -243
- package/dist/governance/executor.js.map +0 -1
- package/dist/governance/index.d.ts +0 -9
- package/dist/governance/index.d.ts.map +0 -1
- package/dist/governance/index.js +0 -13
- package/dist/governance/index.js.map +0 -1
- package/dist/governance/types.d.ts +0 -46
- package/dist/governance/types.d.ts.map +0 -1
- package/dist/governance/types.js +0 -9
- package/dist/governance/types.js.map +0 -1
- package/dist/tools/definitions/definitions/core/code/fingerprint.sh +0 -273
- package/dist/tools/definitions/definitions/core/code/fingerprint.yml +0 -72
- package/dist/tools/definitions/definitions/core/code/parse.yml +0 -68
- package/dist/tools/definitions/definitions/core/code/register-language.sh +0 -475
- package/dist/tools/definitions/definitions/core/code/register-language.yml +0 -74
- package/dist/tools/definitions/definitions/core/docker/build.yml +0 -73
- package/dist/tools/definitions/definitions/core/docker/run.yml +0 -81
- package/dist/tools/definitions/definitions/core/file/copy.yml +0 -88
- package/dist/tools/definitions/definitions/core/file/read.yml +0 -69
- package/dist/tools/definitions/definitions/core/file/write.yml +0 -75
- package/dist/tools/definitions/definitions/core/git/branch.yml +0 -61
- package/dist/tools/definitions/definitions/core/git/cleanup-worktree.yml +0 -50
- package/dist/tools/definitions/definitions/core/git/clone.yml +0 -69
- package/dist/tools/definitions/definitions/core/git/commit.yml +0 -65
- package/dist/tools/definitions/definitions/core/git/push.yml +0 -79
- package/dist/tools/definitions/definitions/core/git/worktree.yml +0 -96
- package/dist/tools/definitions/definitions/core/notification/notify.sh +0 -152
- package/dist/tools/definitions/definitions/core/notification/notify.yml +0 -60
- package/dist/tools/definitions/definitions/core/npm/build.yml +0 -75
- package/dist/tools/definitions/definitions/core/npm/install.yml +0 -58
- package/dist/tools/definitions/definitions/core/npm/test.yml +0 -75
- package/dist/tools/definitions/definitions/core/validation/check-reuse.yml +0 -170
- package/dist/tools/definitions/definitions/core/validation/validate-handlers.yml +0 -118
- package/dist/tools/definitions/definitions/core/validation/validate-readme-stats.yml +0 -155
- package/dist/tools/definitions/definitions/core/validation/validate-yaml-syntax.yml +0 -134
- package/dist/tools/definitions/definitions/ext/browser/browser-automate.sh +0 -255
- package/dist/tools/definitions/definitions/ext/browser/browser-automate.yml +0 -166
- package/dist/tools/definitions/definitions/ext/browser/browser-close.sh +0 -104
- package/dist/tools/definitions/definitions/ext/browser/browser-close.yml +0 -55
- package/dist/tools/definitions/definitions/ext/browser/browser-mcp-debug.sh +0 -682
- package/dist/tools/definitions/definitions/ext/browser/browser-mcp-debug.yml +0 -167
- package/dist/tools/definitions/definitions/ext/browser/browser-start.sh +0 -101
- package/dist/tools/definitions/definitions/ext/browser/browser-start.yml +0 -62
- package/dist/tools/definitions/definitions/registry.json +0 -795
- package/dist/tools/definitions/definitions/std/README.md +0 -350
- package/dist/tools/definitions/definitions/std/analysis/analyze-codebase.yml +0 -72
- package/dist/tools/definitions/definitions/std/analysis/analyze-diff.yml +0 -182
- package/dist/tools/definitions/definitions/std/analysis/analyze-git-diff.yml +0 -70
- package/dist/tools/definitions/definitions/std/analysis/analyze-impact.yml +0 -78
- package/dist/tools/definitions/definitions/std/analysis/analyze-requirements.yml +0 -105
- package/dist/tools/definitions/definitions/std/analysis/brainstorm-options.yml +0 -106
- package/dist/tools/definitions/definitions/std/analysis/build-graph.yml +0 -154
- package/dist/tools/definitions/definitions/std/analysis/clarify-requirements.yml +0 -90
- package/dist/tools/definitions/definitions/std/analysis/detect-context.yml +0 -109
- package/dist/tools/definitions/definitions/std/analysis/detect-layers.yml +0 -125
- package/dist/tools/definitions/definitions/std/analysis/generate-tour.yml +0 -102
- package/dist/tools/definitions/definitions/std/analysis/search-enhance.yml +0 -105
- package/dist/tools/definitions/definitions/std/backlog/add.yml +0 -51
- package/dist/tools/definitions/definitions/std/backlog/decide.yml +0 -39
- package/dist/tools/definitions/definitions/std/backlog/github-sync.yml +0 -161
- package/dist/tools/definitions/definitions/std/backlog/list.yml +0 -53
- package/dist/tools/definitions/definitions/std/backlog/load.yml +0 -46
- package/dist/tools/definitions/definitions/std/backlog/resolve.yml +0 -37
- package/dist/tools/definitions/definitions/std/backlog/update.yml +0 -42
- package/dist/tools/definitions/definitions/std/bugfix/diagnose.yml +0 -68
- package/dist/tools/definitions/definitions/std/bugfix/fix.yml +0 -66
- package/dist/tools/definitions/definitions/std/bugfix/verify.yml +0 -69
- package/dist/tools/definitions/definitions/std/constraint/check-decomposition.yml +0 -103
- package/dist/tools/definitions/definitions/std/constraint/check-feature-list.yml +0 -77
- package/dist/tools/definitions/definitions/std/constraint/check-progress.yml +0 -97
- package/dist/tools/definitions/definitions/std/constraint/generate-report.yml +0 -147
- package/dist/tools/definitions/definitions/std/deploy/commit-push.yml +0 -33
- package/dist/tools/definitions/definitions/std/deploy/deploy-backend.yml +0 -37
- package/dist/tools/definitions/definitions/std/deploy/deploy-frontend.yml +0 -37
- package/dist/tools/definitions/definitions/std/deploy/rollback.yml +0 -148
- package/dist/tools/definitions/definitions/std/design/analyze-architecture-impact.yml +0 -113
- package/dist/tools/definitions/definitions/std/design/design-api.yml +0 -55
- package/dist/tools/definitions/definitions/std/design/design-architecture.yml +0 -97
- package/dist/tools/definitions/definitions/std/design/design-db.yml +0 -81
- package/dist/tools/definitions/definitions/std/design/generate-spec.yml +0 -182
- package/dist/tools/definitions/definitions/std/development/develop-api.yml +0 -85
- package/dist/tools/definitions/definitions/std/development/develop-backend.yml +0 -88
- package/dist/tools/definitions/definitions/std/development/develop-frontend.yml +0 -87
- package/dist/tools/definitions/definitions/std/development/develop-shared-types.yml +0 -74
- package/dist/tools/definitions/definitions/std/development/develop-task.yml +0 -122
- package/dist/tools/definitions/definitions/std/development/develop-tests.yml +0 -76
- package/dist/tools/definitions/definitions/std/development/execute-batch.yml +0 -152
- package/dist/tools/definitions/definitions/std/development/fix-issues.yml +0 -100
- package/dist/tools/definitions/definitions/std/development/implement-task.yml +0 -124
- package/dist/tools/definitions/definitions/std/development/review-fix-cycle.yml +0 -232
- package/dist/tools/definitions/definitions/std/evolution/implement.yml +0 -125
- package/dist/tools/definitions/definitions/std/evolution/prioritize.yml +0 -112
- package/dist/tools/definitions/definitions/std/evolution/report-gap.yml +0 -166
- package/dist/tools/definitions/definitions/std/file/read.yml +0 -21
- package/dist/tools/definitions/definitions/std/governance/aggregate-opinions.sh +0 -201
- package/dist/tools/definitions/definitions/std/governance/aggregate-opinions.yml +0 -79
- package/dist/tools/definitions/definitions/std/governance/audit-task.yml +0 -178
- package/dist/tools/definitions/definitions/std/governance/cast-vote.yml +0 -129
- package/dist/tools/definitions/definitions/std/governance/collect-issues.yml +0 -16
- package/dist/tools/definitions/definitions/std/governance/create-signed-document.yml +0 -23
- package/dist/tools/definitions/definitions/std/governance/create-voting-session.yml +0 -101
- package/dist/tools/definitions/definitions/std/governance/define-stance.sh +0 -243
- package/dist/tools/definitions/definitions/std/governance/define-stance.yml +0 -82
- package/dist/tools/definitions/definitions/std/governance/generate-review-report.yml +0 -23
- package/dist/tools/definitions/definitions/std/governance/impeach.yml +0 -179
- package/dist/tools/definitions/definitions/std/governance/multi-stance-review.yml +0 -154
- package/dist/tools/definitions/definitions/std/governance/prepare-artifact.yml +0 -20
- package/dist/tools/definitions/definitions/std/governance/review-spec-approval.yml +0 -262
- package/dist/tools/definitions/definitions/std/governance/rollback.yml +0 -186
- package/dist/tools/definitions/definitions/std/governance/stance-review.yml +0 -149
- package/dist/tools/definitions/definitions/std/governance/track-effect.yml +0 -199
- package/dist/tools/definitions/definitions/std/governance/vote-tally.yml +0 -144
- package/dist/tools/definitions/definitions/std/patch/execute.yml +0 -51
- package/dist/tools/definitions/definitions/std/planning/generate-tasks.yml +0 -36
- package/dist/tools/definitions/definitions/std/planning/load-tasks.yml +0 -44
- package/dist/tools/definitions/definitions/std/planning/split-batch.yml +0 -481
- package/dist/tools/definitions/definitions/std/planning/split-tasks.yml +0 -359
- package/dist/tools/definitions/definitions/std/planning/update-tasks.yml +0 -51
- package/dist/tools/definitions/definitions/std/planning/validate-tasks.yml +0 -46
- package/dist/tools/definitions/definitions/std/project/decide-next-workflow.yml +0 -38
- package/dist/tools/definitions/definitions/std/project/load-state.yml +0 -31
- package/dist/tools/definitions/definitions/std/project/save-state.yml +0 -32
- package/dist/tools/definitions/definitions/std/quality/check-quality.yml +0 -241
- package/dist/tools/definitions/definitions/std/quality/debug-systematic.yml +0 -163
- package/dist/tools/definitions/definitions/std/quality/handle-feedback.yml +0 -108
- package/dist/tools/definitions/definitions/std/quality/review-code.yml +0 -128
- package/dist/tools/definitions/definitions/std/quality/review-spec.yml +0 -140
- package/dist/tools/definitions/definitions/std/quality/review-task.yml +0 -190
- package/dist/tools/definitions/definitions/std/quality/run-tests.yml +0 -80
- package/dist/tools/definitions/definitions/std/quick/analyze.yml +0 -56
- package/dist/tools/definitions/definitions/std/quick/implement.yml +0 -67
- package/dist/tools/definitions/definitions/std/quick/verify.yml +0 -71
- package/dist/tools/definitions/definitions/std/verification/verify_completion.yml +0 -113
- package/dist/tools/definitions/definitions/std/verification/wait-condition.yml +0 -107
- package/dist/types/iron-law.d.ts +0 -25
- package/dist/types/iron-law.d.ts.map +0 -1
- package/dist/types/iron-law.js +0 -16
- package/dist/types/iron-law.js.map +0 -1
- package/src/cli/commands/sync-docs.ts +0 -1175
- package/src/constraints/index.ts +0 -3
- package/src/core/constraints/__tests__/prompt-injection.test.ts +0 -89
- package/src/core/constraints/doc-freshness/auto-fix.ts +0 -69
- package/src/core/constraints/prompt-injection.ts +0 -73
- package/src/core/spec/index.ts +0 -7
- package/src/governance/CONTEXT.md +0 -22
- package/src/governance/__tests__/executor.test.ts +0 -249
- package/src/governance/executor.ts +0 -229
- package/src/governance/index.ts +0 -13
- package/src/governance/types.ts +0 -53
- package/src/tools/core/package.json +0 -7
- package/src/tools/core/pnpm-lock.yaml +0 -232
- package/src/types/iron-law.ts +0 -50
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 失败处理类型定义
|
|
3
|
+
*
|
|
4
|
+
* 提供通用的错误分类和失败记录类型
|
|
5
|
+
* 不包含业务逻辑,只定义数据结构
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 错误类型枚举
|
|
10
|
+
*/
|
|
11
|
+
export enum ErrorType {
|
|
12
|
+
TEST_FAILED = 'TEST_FAILED',
|
|
13
|
+
GATE_FAILED = 'GATE_FAILED',
|
|
14
|
+
DEPENDENCY_BLOCKED = 'DEPENDENCY_BLOCKED',
|
|
15
|
+
CONTEXT_OVERFLOW = 'CONTEXT_OVERFLOW',
|
|
16
|
+
TIMEOUT = 'TIMEOUT',
|
|
17
|
+
NETWORK_ERROR = 'NETWORK_ERROR',
|
|
18
|
+
AGENT_ERROR = 'AGENT_ERROR',
|
|
19
|
+
TOOL_ERROR = 'TOOL_ERROR',
|
|
20
|
+
VALIDATION_ERROR = 'VALIDATION_ERROR',
|
|
21
|
+
UNKNOWN = 'UNKNOWN',
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 失败等级
|
|
26
|
+
*
|
|
27
|
+
* L1: 自动处理(重试、降级)
|
|
28
|
+
* L2: 需要干预(人工审核)
|
|
29
|
+
* L3: 严重问题(开会讨论)
|
|
30
|
+
* L4: 致命错误(回滚)
|
|
31
|
+
*/
|
|
32
|
+
export enum FailureLevel {
|
|
33
|
+
L1 = 'L1',
|
|
34
|
+
L2 = 'L2',
|
|
35
|
+
L3 = 'L3',
|
|
36
|
+
L4 = 'L4',
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* 错误分类规则
|
|
41
|
+
*/
|
|
42
|
+
export interface ErrorClassificationRule {
|
|
43
|
+
/** 匹配的错误类型 */
|
|
44
|
+
type: ErrorType;
|
|
45
|
+
/** 正则匹配模式 */
|
|
46
|
+
patterns?: RegExp[];
|
|
47
|
+
/** 关键词匹配(不区分大小写) */
|
|
48
|
+
keywords?: string[];
|
|
49
|
+
/** 失败等级 */
|
|
50
|
+
level?: FailureLevel;
|
|
51
|
+
/** 规则描述 */
|
|
52
|
+
description?: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* 失败记录
|
|
57
|
+
*/
|
|
58
|
+
export interface FailureRecord {
|
|
59
|
+
/** 错误类型 */
|
|
60
|
+
type: ErrorType;
|
|
61
|
+
/** 失败等级 */
|
|
62
|
+
level: FailureLevel;
|
|
63
|
+
/** 错误消息 */
|
|
64
|
+
message: string;
|
|
65
|
+
/** 时间戳 */
|
|
66
|
+
timestamp: number;
|
|
67
|
+
/** 元数据 */
|
|
68
|
+
metadata?: Record<string, unknown>;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* 分类结果
|
|
73
|
+
*/
|
|
74
|
+
export interface ClassificationResult {
|
|
75
|
+
/** 错误类型 */
|
|
76
|
+
type: ErrorType;
|
|
77
|
+
/** 失败等级 */
|
|
78
|
+
level: FailureLevel;
|
|
79
|
+
/** 匹配的规则(如果有) */
|
|
80
|
+
matchedRule?: ErrorClassificationRule;
|
|
81
|
+
/** 原始错误 */
|
|
82
|
+
originalError: Error;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* 默认错误分类规则
|
|
87
|
+
*
|
|
88
|
+
* 注意:规则按顺序匹配,更具体的规则应该放在前面
|
|
89
|
+
*/
|
|
90
|
+
export const DEFAULT_CLASSIFICATION_RULES: ErrorClassificationRule[] = [
|
|
91
|
+
// 更具体的规则优先
|
|
92
|
+
{
|
|
93
|
+
type: ErrorType.GATE_FAILED,
|
|
94
|
+
keywords: ['gate', 'checkpoint', 'constraint'],
|
|
95
|
+
level: FailureLevel.L2,
|
|
96
|
+
description: '门禁检查失败',
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
type: ErrorType.DEPENDENCY_BLOCKED,
|
|
100
|
+
keywords: ['dependency', 'blocked', 'dependency_fail'],
|
|
101
|
+
level: FailureLevel.L3,
|
|
102
|
+
description: '依赖阻塞',
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
type: ErrorType.CONTEXT_OVERFLOW,
|
|
106
|
+
keywords: ['context overflow', 'token limit', 'context exceed'],
|
|
107
|
+
level: FailureLevel.L2,
|
|
108
|
+
description: '上下文溢出',
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
type: ErrorType.TIMEOUT,
|
|
112
|
+
keywords: ['timeout', 'timed out', 'deadline'],
|
|
113
|
+
patterns: [/timeout/i, /timed?\s*out/i],
|
|
114
|
+
level: FailureLevel.L1,
|
|
115
|
+
description: '超时',
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
type: ErrorType.NETWORK_ERROR,
|
|
119
|
+
keywords: ['network', 'connection', 'econnrefused', 'enotfound', 'socket'],
|
|
120
|
+
level: FailureLevel.L1,
|
|
121
|
+
description: '网络错误',
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
type: ErrorType.AGENT_ERROR,
|
|
125
|
+
keywords: ['agent error', 'model error', 'rate limit', 'quota exceeded'],
|
|
126
|
+
level: FailureLevel.L2,
|
|
127
|
+
description: 'Agent 错误',
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
type: ErrorType.TOOL_ERROR,
|
|
131
|
+
keywords: ['tool error', 'skill error', 'executor error'],
|
|
132
|
+
level: FailureLevel.L1,
|
|
133
|
+
description: '工具错误',
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
type: ErrorType.VALIDATION_ERROR,
|
|
137
|
+
keywords: ['validation error', 'invalid', 'schema error'],
|
|
138
|
+
level: FailureLevel.L2,
|
|
139
|
+
description: '验证错误',
|
|
140
|
+
},
|
|
141
|
+
// 通用规则放在后面
|
|
142
|
+
{
|
|
143
|
+
type: ErrorType.TEST_FAILED,
|
|
144
|
+
keywords: ['test', 'assertion', 'expect'],
|
|
145
|
+
patterns: [/test.*fail/i, /assertion/i, /expect.*fail/i],
|
|
146
|
+
level: FailureLevel.L1,
|
|
147
|
+
description: '测试失败',
|
|
148
|
+
},
|
|
149
|
+
];
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* 错误类型到失败等级的默认映射
|
|
153
|
+
*/
|
|
154
|
+
export const DEFAULT_LEVEL_MAPPING: Record<ErrorType, FailureLevel> = {
|
|
155
|
+
[ErrorType.TEST_FAILED]: FailureLevel.L1,
|
|
156
|
+
[ErrorType.GATE_FAILED]: FailureLevel.L2,
|
|
157
|
+
[ErrorType.DEPENDENCY_BLOCKED]: FailureLevel.L3,
|
|
158
|
+
[ErrorType.CONTEXT_OVERFLOW]: FailureLevel.L2,
|
|
159
|
+
[ErrorType.TIMEOUT]: FailureLevel.L1,
|
|
160
|
+
[ErrorType.NETWORK_ERROR]: FailureLevel.L1,
|
|
161
|
+
[ErrorType.AGENT_ERROR]: FailureLevel.L2,
|
|
162
|
+
[ErrorType.TOOL_ERROR]: FailureLevel.L1,
|
|
163
|
+
[ErrorType.VALIDATION_ERROR]: FailureLevel.L2,
|
|
164
|
+
[ErrorType.UNKNOWN]: FailureLevel.L2,
|
|
165
|
+
};
|
package/src/types/index.ts
CHANGED
|
@@ -15,12 +15,13 @@ export * from './trace';
|
|
|
15
15
|
// Performance 类型(Performance Trace 系统)
|
|
16
16
|
export * from './performance';
|
|
17
17
|
|
|
18
|
-
//
|
|
19
|
-
|
|
18
|
+
// 诊断和提案类型(定义已归位 types/monitoring-types.ts,monitoring 改从 types 导入)
|
|
19
|
+
// 显式再导出(不用 export *):根入口同时星导出 ./monitoring,星-星歧义会静默丢符号
|
|
20
20
|
export type {
|
|
21
|
+
Diagnosis,
|
|
21
22
|
ConstraintProposal,
|
|
22
23
|
ProposalReviewResult,
|
|
23
|
-
} from '
|
|
24
|
+
} from './monitoring-types';
|
|
24
25
|
|
|
25
26
|
// Session 类型(排除与 passes-gate 冲突的类型)
|
|
26
27
|
export {
|
|
@@ -47,7 +48,8 @@ export * from './enforcement';
|
|
|
47
48
|
// Spec 验证类型
|
|
48
49
|
export * from './spec';
|
|
49
50
|
|
|
50
|
-
// Failure
|
|
51
|
+
// Failure 类型(定义已归位 types/failure.ts,failure 模块经 failure/types.ts 再导出保持兼容)
|
|
52
|
+
// 显式再导出(不用 export *):根入口同时星导出 ./failure,星-星歧义会静默丢符号
|
|
51
53
|
export {
|
|
52
54
|
ErrorType,
|
|
53
55
|
FailureLevel,
|
|
@@ -56,4 +58,4 @@ export {
|
|
|
56
58
|
ClassificationResult,
|
|
57
59
|
DEFAULT_CLASSIFICATION_RULES,
|
|
58
60
|
DEFAULT_LEVEL_MAPPING,
|
|
59
|
-
} from '
|
|
61
|
+
} from './failure';
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 监控域类型(诊断 / 提案)
|
|
3
|
+
*
|
|
4
|
+
* 原定义位于 monitoring/constraint-doctor.ts 与 monitoring/constraint-evolver.ts,
|
|
5
|
+
* 但被 types/index.ts 反向再导出(类型层依赖业务模块,分层倒挂)。
|
|
6
|
+
* 工单 14 将类型定义归位到 types 层,monitoring 改从 types 导入。
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { ExecutionTrace } from './trace';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 诊断结果
|
|
13
|
+
*/
|
|
14
|
+
export interface Diagnosis {
|
|
15
|
+
/** 异常 ID */
|
|
16
|
+
anomalyId: string;
|
|
17
|
+
|
|
18
|
+
/** 约束 ID */
|
|
19
|
+
constraintId: string;
|
|
20
|
+
|
|
21
|
+
/** 诊断时间 */
|
|
22
|
+
diagnosedAt: number;
|
|
23
|
+
|
|
24
|
+
/** 根因分析 */
|
|
25
|
+
rootCause: {
|
|
26
|
+
/** 主要原因 */
|
|
27
|
+
primary: string;
|
|
28
|
+
|
|
29
|
+
/** 次要原因 */
|
|
30
|
+
secondary?: string[];
|
|
31
|
+
|
|
32
|
+
/** 相关 traces */
|
|
33
|
+
evidence: ExecutionTrace[];
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/** 影响评估 */
|
|
37
|
+
impact: {
|
|
38
|
+
/** 影响程度 */
|
|
39
|
+
severity: 'low' | 'medium' | 'high';
|
|
40
|
+
|
|
41
|
+
/** 影响范围 */
|
|
42
|
+
scope: 'single_project' | 'multiple_projects' | 'team';
|
|
43
|
+
|
|
44
|
+
/** 用户影响 */
|
|
45
|
+
userImpact: string;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/** 改进建议 */
|
|
49
|
+
recommendations: {
|
|
50
|
+
/** 建议类型 */
|
|
51
|
+
type: 'add_exception' | 'adjust_threshold' | 'modify_constraint' | 'user_training';
|
|
52
|
+
|
|
53
|
+
/** 建议内容 */
|
|
54
|
+
content: string;
|
|
55
|
+
|
|
56
|
+
/** 预期效果 */
|
|
57
|
+
expectedOutcome: string;
|
|
58
|
+
|
|
59
|
+
/** 实施成本 */
|
|
60
|
+
implementationCost: 'low' | 'medium' | 'high';
|
|
61
|
+
}[];
|
|
62
|
+
|
|
63
|
+
/** 是否需要变更 */
|
|
64
|
+
needsChange: boolean;
|
|
65
|
+
|
|
66
|
+
/** 紧急程度 */
|
|
67
|
+
urgency: 'low' | 'medium' | 'high';
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* 约束提案
|
|
72
|
+
*/
|
|
73
|
+
export interface ConstraintProposal {
|
|
74
|
+
/** 提案 ID */
|
|
75
|
+
id: string;
|
|
76
|
+
|
|
77
|
+
/** 提案时间 */
|
|
78
|
+
proposedAt: number;
|
|
79
|
+
|
|
80
|
+
/** 来源诊断 */
|
|
81
|
+
diagnosisId: string;
|
|
82
|
+
|
|
83
|
+
/** 约束 ID */
|
|
84
|
+
constraintId: string;
|
|
85
|
+
|
|
86
|
+
/** 提案类型 */
|
|
87
|
+
type: 'add_exception' | 'remove_exception' | 'adjust_trigger' | 'change_level' | 'modify_message' | 'new_constraint';
|
|
88
|
+
|
|
89
|
+
/** 提案内容 */
|
|
90
|
+
content: {
|
|
91
|
+
/** 当前值(如果有) */
|
|
92
|
+
current?: any;
|
|
93
|
+
|
|
94
|
+
/** 建议值 */
|
|
95
|
+
proposed: any;
|
|
96
|
+
|
|
97
|
+
/** 变更描述 */
|
|
98
|
+
description: string;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
/** 理由 */
|
|
102
|
+
reasoning: string;
|
|
103
|
+
|
|
104
|
+
/** 预期效果 */
|
|
105
|
+
expectedOutcome: string;
|
|
106
|
+
|
|
107
|
+
/** 风险评估 */
|
|
108
|
+
risk: {
|
|
109
|
+
/** 风险等级 */
|
|
110
|
+
level: 'low' | 'medium' | 'high';
|
|
111
|
+
|
|
112
|
+
/** 风险描述 */
|
|
113
|
+
description: string;
|
|
114
|
+
|
|
115
|
+
/** 回滚方案 */
|
|
116
|
+
rollbackPlan?: string;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
/** 实施信息 */
|
|
120
|
+
implementation: {
|
|
121
|
+
/** 改动文件 */
|
|
122
|
+
files: string[];
|
|
123
|
+
|
|
124
|
+
/** 改动量估计 */
|
|
125
|
+
linesChanged: number;
|
|
126
|
+
|
|
127
|
+
/** 测试要求 */
|
|
128
|
+
testsRequired: boolean;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
/** 状态 */
|
|
132
|
+
status: 'proposed' | 'reviewing' | 'accepted' | 'rejected' | 'implemented';
|
|
133
|
+
|
|
134
|
+
/** 审核意见 */
|
|
135
|
+
reviewComment?: string;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* 提案审核结果
|
|
140
|
+
*/
|
|
141
|
+
export interface ProposalReviewResult {
|
|
142
|
+
/** 是否接受 */
|
|
143
|
+
accepted: boolean;
|
|
144
|
+
|
|
145
|
+
/** 审核意见 */
|
|
146
|
+
comment: string;
|
|
147
|
+
|
|
148
|
+
/** 修改建议(如果拒绝) */
|
|
149
|
+
modifications?: Partial<ConstraintProposal>;
|
|
150
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 文件遍历工具(工单 19)
|
|
3
|
+
*
|
|
4
|
+
* 收敛此前散落在 sync-docs / cross-project-checker / checker /
|
|
5
|
+
* spec-baseline-check / doc-freshness-check 中的 5 处递归遍历实现。
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import * as fs from 'fs';
|
|
9
|
+
import * as path from 'path';
|
|
10
|
+
|
|
11
|
+
export interface FileWalkOptions {
|
|
12
|
+
/** 需要整体跳过的目录名(精确匹配) */
|
|
13
|
+
skipDirs?: string[];
|
|
14
|
+
/** 是否跳过 `.` 开头的条目,默认 false */
|
|
15
|
+
skipHidden?: boolean;
|
|
16
|
+
/** 文件过滤器(文件名, 完整路径);缺省收集所有文件 */
|
|
17
|
+
filter?: (fileName: string, fullPath: string) => boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 递归收集 root 下的文件路径(同步)
|
|
22
|
+
*
|
|
23
|
+
* 目录不可读时静默跳过(与原各处实现行为一致)。
|
|
24
|
+
*/
|
|
25
|
+
export function walkFiles(root: string, options: FileWalkOptions = {}): string[] {
|
|
26
|
+
const { skipDirs = [], skipHidden = false, filter } = options;
|
|
27
|
+
const results: string[] = [];
|
|
28
|
+
|
|
29
|
+
let entries: fs.Dirent[];
|
|
30
|
+
try {
|
|
31
|
+
entries = fs.readdirSync(root, { withFileTypes: true });
|
|
32
|
+
} catch {
|
|
33
|
+
return results;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
for (const entry of entries) {
|
|
37
|
+
if (skipHidden && entry.name.startsWith('.')) continue;
|
|
38
|
+
if (skipDirs.includes(entry.name)) continue;
|
|
39
|
+
|
|
40
|
+
const fullPath = path.join(root, entry.name);
|
|
41
|
+
if (entry.isDirectory()) {
|
|
42
|
+
results.push(...walkFiles(fullPath, options));
|
|
43
|
+
} else if (entry.isFile()) {
|
|
44
|
+
if (!filter || filter(entry.name, fullPath)) {
|
|
45
|
+
results.push(fullPath);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return results;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface TsSourceWalkOptions {
|
|
54
|
+
/** 是否跳过 barrel 文件 index.ts,默认 false */
|
|
55
|
+
skipIndex?: boolean;
|
|
56
|
+
/** 跳过的目录名,默认 node_modules/__tests__/dist */
|
|
57
|
+
skipDirs?: string[];
|
|
58
|
+
/** 是否跳过 `.` 开头的条目,默认 false */
|
|
59
|
+
skipHidden?: boolean;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* 递归收集 TypeScript 源文件(.ts,排除 .d.ts)
|
|
64
|
+
*/
|
|
65
|
+
export function findTsSourceFiles(root: string, options: TsSourceWalkOptions = {}): string[] {
|
|
66
|
+
const {
|
|
67
|
+
skipIndex = false,
|
|
68
|
+
skipDirs = ['node_modules', '__tests__', 'dist'],
|
|
69
|
+
skipHidden = false,
|
|
70
|
+
} = options;
|
|
71
|
+
|
|
72
|
+
return walkFiles(root, {
|
|
73
|
+
skipDirs,
|
|
74
|
+
skipHidden,
|
|
75
|
+
filter: (name) =>
|
|
76
|
+
name.endsWith('.ts') && !name.endsWith('.d.ts') && (!skipIndex || name !== 'index.ts'),
|
|
77
|
+
});
|
|
78
|
+
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Harness Knowledge Capture Hook
|
|
4
|
-
*
|
|
5
|
-
* Runs as an afterTurn hook in Claude Code.
|
|
6
|
-
* Detects deep analysis (≥3 source files read) without knowledge-doc output,
|
|
7
|
-
* and warns the user that knowledge may need to be captured.
|
|
8
|
-
*
|
|
9
|
-
* Usage (in settings.json):
|
|
10
|
-
* "hooks": {
|
|
11
|
-
* "afterTurn": [{
|
|
12
|
-
* "command": "node ~/projects/harness/bin/harness-knowledge-capture.js"
|
|
13
|
-
* }]
|
|
14
|
-
* }
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
const fs = require('fs');
|
|
18
|
-
const path = require('path');
|
|
19
|
-
|
|
20
|
-
// Read turn data from stdin
|
|
21
|
-
let input = '';
|
|
22
|
-
process.stdin.setEncoding('utf-8');
|
|
23
|
-
process.stdin.on('data', (chunk) => input += chunk);
|
|
24
|
-
|
|
25
|
-
process.stdin.on('end', () => {
|
|
26
|
-
try {
|
|
27
|
-
const turn = JSON.parse(input);
|
|
28
|
-
const result = checkTurn(turn);
|
|
29
|
-
if (result.shouldWarn) {
|
|
30
|
-
process.stderr.write(`\n${'='.repeat(60)}\n`);
|
|
31
|
-
process.stderr.write(' ⚠️ 可能遗漏了知识沉淀\n');
|
|
32
|
-
process.stderr.write(`${'='.repeat(60)}\n`);
|
|
33
|
-
process.stderr.write(` 本回合读取了 ${result.fileReads} 个文件\n`);
|
|
34
|
-
process.stderr.write(` 但未写入 .harness/knowledge-docs/\n`);
|
|
35
|
-
process.stderr.write(`\n`);
|
|
36
|
-
process.stderr.write(` 如果这是深度分析,请执行:\n`);
|
|
37
|
-
process.stderr.write(` npx harness knowledge upsert --scope <scope> --file <file> --source claude\n`);
|
|
38
|
-
process.stderr.write(`${'='.repeat(60)}\n\n`);
|
|
39
|
-
}
|
|
40
|
-
} catch (e) {
|
|
41
|
-
// Silently ignore parse errors — non-JSON input is fine
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
function checkTurn(turn) {
|
|
46
|
-
let fileReads = 0;
|
|
47
|
-
let knowledgeWrites = 0;
|
|
48
|
-
|
|
49
|
-
// Walk through messages looking for tool calls
|
|
50
|
-
const messages = turn.messages || [turn];
|
|
51
|
-
for (const msg of messages) {
|
|
52
|
-
// Claude Code format: tool_uses array
|
|
53
|
-
if (msg.role === 'assistant' && msg.tool_uses) {
|
|
54
|
-
for (const tool of msg.tool_uses) {
|
|
55
|
-
if (isFileRead(tool)) fileReads++;
|
|
56
|
-
if (isKnowledgeWrite(tool)) knowledgeWrites++;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
// Plain tool_calls format
|
|
60
|
-
if (msg.tool_calls) {
|
|
61
|
-
for (const tool of msg.tool_calls) {
|
|
62
|
-
if (isFileRead(tool)) fileReads++;
|
|
63
|
-
if (isKnowledgeWrite(tool)) knowledgeWrites++;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
// Messages content with tool use markers
|
|
67
|
-
if (msg.content && typeof msg.content === 'string') {
|
|
68
|
-
const readMatches = msg.content.match(/\bRead\b.*/g);
|
|
69
|
-
if (readMatches) fileReads += readMatches.length;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return {
|
|
74
|
-
fileReads,
|
|
75
|
-
knowledgeWrites,
|
|
76
|
-
shouldWarn: fileReads >= 3 && knowledgeWrites === 0,
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function isFileRead(tool) {
|
|
81
|
-
const name = (tool.name || tool.function?.name || '').toLowerCase();
|
|
82
|
-
const isReadTool = ['read', 'glob', 'grep', 'agent'].includes(name);
|
|
83
|
-
if (!isReadTool) return false;
|
|
84
|
-
|
|
85
|
-
const params = tool.parameters || tool.function?.arguments || {};
|
|
86
|
-
const filePath = params.file_path || params.path || params.pattern || '';
|
|
87
|
-
// Only count actual source file reads, not config/memory/docs
|
|
88
|
-
const isSource = /\/(src|packages|apps)\/|\.(ts|tsx|js|jsx|py|go|rs)$/.test(filePath);
|
|
89
|
-
return isSource;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function isKnowledgeWrite(tool) {
|
|
93
|
-
const name = (tool.name || tool.function?.name || '').toLowerCase();
|
|
94
|
-
if (name !== 'write') return false;
|
|
95
|
-
|
|
96
|
-
const params = tool.parameters || tool.function?.arguments || {};
|
|
97
|
-
const filePath = params.file_path || '';
|
|
98
|
-
return filePath.includes('.harness/knowledge-docs/') || filePath.includes('.harness/knowledge/');
|
|
99
|
-
}
|