@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
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* 检查点验证引擎(编排层,工单 23)
|
|
3
|
+
*
|
|
4
|
+
* 在每个步骤执行后,自动验证检查点是否满足。
|
|
5
|
+
* 各检查族实现位于 check-handlers/{file,command,output,http}.ts。
|
|
5
6
|
*/
|
|
6
7
|
|
|
7
|
-
import * as fs from 'fs';
|
|
8
|
-
import * as path from 'path';
|
|
9
|
-
import { execAsync } from '../../utils/exec';
|
|
10
8
|
import type {
|
|
11
9
|
Checkpoint,
|
|
12
10
|
CheckpointCheck,
|
|
@@ -15,7 +13,20 @@ import type {
|
|
|
15
13
|
CheckpointContext,
|
|
16
14
|
CheckType,
|
|
17
15
|
} from '../../types/checkpoint';
|
|
18
|
-
|
|
16
|
+
import {
|
|
17
|
+
checkFileExists,
|
|
18
|
+
checkFileNotEmpty,
|
|
19
|
+
checkFileContains,
|
|
20
|
+
checkFileNotContains,
|
|
21
|
+
} from './check-handlers/file';
|
|
22
|
+
import { checkCommandSuccess, checkCommandOutput } from './check-handlers/command';
|
|
23
|
+
import {
|
|
24
|
+
checkOutputContains,
|
|
25
|
+
checkOutputNotContains,
|
|
26
|
+
checkOutputMatches,
|
|
27
|
+
checkJsonPath,
|
|
28
|
+
} from './check-handlers/output';
|
|
29
|
+
import { checkHttpStatus, checkHttpBody } from './check-handlers/http';
|
|
19
30
|
|
|
20
31
|
/**
|
|
21
32
|
* 检查点验证器
|
|
@@ -91,35 +102,35 @@ export class CheckpointValidator {
|
|
|
91
102
|
}
|
|
92
103
|
|
|
93
104
|
/**
|
|
94
|
-
*
|
|
105
|
+
* 执行单个检查项(分发至 check-handlers/ 各族)
|
|
95
106
|
*/
|
|
96
107
|
private async executeCheck(check: CheckpointCheck, context: CheckpointContext): Promise<CheckResult> {
|
|
97
108
|
try {
|
|
98
109
|
switch (check.type) {
|
|
99
110
|
case 'file_exists':
|
|
100
|
-
return await
|
|
111
|
+
return await checkFileExists(check, context);
|
|
101
112
|
case 'file_not_empty':
|
|
102
|
-
return await
|
|
113
|
+
return await checkFileNotEmpty(check, context);
|
|
103
114
|
case 'file_contains':
|
|
104
|
-
return await
|
|
115
|
+
return await checkFileContains(check, context);
|
|
105
116
|
case 'file_not_contains':
|
|
106
|
-
return await
|
|
117
|
+
return await checkFileNotContains(check, context);
|
|
107
118
|
case 'command_success':
|
|
108
|
-
return await
|
|
119
|
+
return await checkCommandSuccess(check, context);
|
|
109
120
|
case 'command_output':
|
|
110
|
-
return await
|
|
121
|
+
return await checkCommandOutput(check, context);
|
|
111
122
|
case 'output_contains':
|
|
112
|
-
return await
|
|
123
|
+
return await checkOutputContains(check, context);
|
|
113
124
|
case 'output_not_contains':
|
|
114
|
-
return await
|
|
125
|
+
return await checkOutputNotContains(check, context);
|
|
115
126
|
case 'output_matches':
|
|
116
|
-
return await
|
|
127
|
+
return await checkOutputMatches(check, context);
|
|
117
128
|
case 'json_path':
|
|
118
|
-
return await
|
|
129
|
+
return await checkJsonPath(check, context);
|
|
119
130
|
case 'http_status':
|
|
120
|
-
return await
|
|
131
|
+
return await checkHttpStatus(check, context);
|
|
121
132
|
case 'http_body':
|
|
122
|
-
return await
|
|
133
|
+
return await checkHttpBody(check, context);
|
|
123
134
|
case 'custom':
|
|
124
135
|
return await this.checkCustom(check, context);
|
|
125
136
|
default:
|
|
@@ -140,346 +151,13 @@ export class CheckpointValidator {
|
|
|
140
151
|
}
|
|
141
152
|
}
|
|
142
153
|
|
|
143
|
-
/**
|
|
144
|
-
* 检查文件是否存在
|
|
145
|
-
*/
|
|
146
|
-
private async checkFileExists(check: CheckpointCheck, context: CheckpointContext): Promise<CheckResult> {
|
|
147
|
-
const filePath = this.resolvePath(check.config.path || '', context.workdir);
|
|
148
|
-
const exists = fs.existsSync(filePath);
|
|
149
|
-
|
|
150
|
-
return {
|
|
151
|
-
checkId: check.id,
|
|
152
|
-
passed: exists,
|
|
153
|
-
message: exists ? `文件存在: ${filePath}` : `文件不存在: ${filePath}`,
|
|
154
|
-
actual: exists,
|
|
155
|
-
expected: true,
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* 检查文件非空
|
|
161
|
-
*/
|
|
162
|
-
private async checkFileNotEmpty(check: CheckpointCheck, context: CheckpointContext): Promise<CheckResult> {
|
|
163
|
-
const filePath = this.resolvePath(check.config.path || '', context.workdir);
|
|
164
|
-
|
|
165
|
-
if (!fs.existsSync(filePath)) {
|
|
166
|
-
return {
|
|
167
|
-
checkId: check.id,
|
|
168
|
-
passed: false,
|
|
169
|
-
message: `文件不存在: ${filePath}`,
|
|
170
|
-
actual: false,
|
|
171
|
-
expected: true,
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
const stats = fs.statSync(filePath);
|
|
176
|
-
const notEmpty = stats.size > 0;
|
|
177
|
-
|
|
178
|
-
return {
|
|
179
|
-
checkId: check.id,
|
|
180
|
-
passed: notEmpty,
|
|
181
|
-
message: notEmpty ? `文件非空: ${filePath}` : `文件为空: ${filePath}`,
|
|
182
|
-
actual: stats.size,
|
|
183
|
-
expected: '> 0',
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* 检查文件包含内容
|
|
189
|
-
*/
|
|
190
|
-
private async checkFileContains(check: CheckpointCheck, context: CheckpointContext): Promise<CheckResult> {
|
|
191
|
-
const filePath = this.resolvePath(check.config.path || '', context.workdir);
|
|
192
|
-
const content = check.config.content || '';
|
|
193
|
-
|
|
194
|
-
if (!fs.existsSync(filePath)) {
|
|
195
|
-
return {
|
|
196
|
-
checkId: check.id,
|
|
197
|
-
passed: false,
|
|
198
|
-
message: `文件不存在: ${filePath}`,
|
|
199
|
-
actual: null,
|
|
200
|
-
expected: content,
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
const fileContent = fs.readFileSync(filePath, 'utf-8');
|
|
205
|
-
const contains = fileContent.includes(content);
|
|
206
|
-
|
|
207
|
-
return {
|
|
208
|
-
checkId: check.id,
|
|
209
|
-
passed: contains,
|
|
210
|
-
message: contains ? `文件包含内容: ${content}` : `文件不包含内容: ${content}`,
|
|
211
|
-
actual: contains,
|
|
212
|
-
expected: true,
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* 检查文件不包含内容
|
|
218
|
-
*/
|
|
219
|
-
private async checkFileNotContains(check: CheckpointCheck, context: CheckpointContext): Promise<CheckResult> {
|
|
220
|
-
const filePath = this.resolvePath(check.config.path || '', context.workdir);
|
|
221
|
-
const content = check.config.content || '';
|
|
222
|
-
|
|
223
|
-
if (!fs.existsSync(filePath)) {
|
|
224
|
-
return {
|
|
225
|
-
checkId: check.id,
|
|
226
|
-
passed: false,
|
|
227
|
-
message: `文件不存在: ${filePath}`,
|
|
228
|
-
actual: null,
|
|
229
|
-
expected: `不包含: ${content}`,
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
const fileContent = fs.readFileSync(filePath, 'utf-8');
|
|
234
|
-
const notContains = !fileContent.includes(content);
|
|
235
|
-
|
|
236
|
-
return {
|
|
237
|
-
checkId: check.id,
|
|
238
|
-
passed: notContains,
|
|
239
|
-
message: notContains ? `文件不包含内容: ${content}` : `文件包含内容: ${content}`,
|
|
240
|
-
actual: !notContains,
|
|
241
|
-
expected: false,
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* 检查命令执行成功
|
|
247
|
-
*/
|
|
248
|
-
private async checkCommandSuccess(check: CheckpointCheck, context: CheckpointContext): Promise<CheckResult> {
|
|
249
|
-
const command = check.config.command || '';
|
|
250
|
-
|
|
251
|
-
try {
|
|
252
|
-
const { stdout, stderr } = await execAsync(command, { cwd: context.workdir });
|
|
253
|
-
return {
|
|
254
|
-
checkId: check.id,
|
|
255
|
-
passed: true,
|
|
256
|
-
message: `命令执行成功: ${command}`,
|
|
257
|
-
actual: stdout.trim(),
|
|
258
|
-
expected: 'exit code 0',
|
|
259
|
-
};
|
|
260
|
-
} catch (error: any) {
|
|
261
|
-
return {
|
|
262
|
-
checkId: check.id,
|
|
263
|
-
passed: false,
|
|
264
|
-
message: `命令执行失败: ${command}`,
|
|
265
|
-
actual: error.message,
|
|
266
|
-
expected: 'exit code 0',
|
|
267
|
-
error: error.message,
|
|
268
|
-
};
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
/**
|
|
273
|
-
* 检查命令输出
|
|
274
|
-
*/
|
|
275
|
-
private async checkCommandOutput(check: CheckpointCheck, context: CheckpointContext): Promise<CheckResult> {
|
|
276
|
-
const command = check.config.command || '';
|
|
277
|
-
const expected = String(check.config.expected || '');
|
|
278
|
-
|
|
279
|
-
try {
|
|
280
|
-
const { stdout } = await execAsync(command, { cwd: context.workdir });
|
|
281
|
-
const actual = stdout.trim();
|
|
282
|
-
const matches = actual.includes(expected);
|
|
283
|
-
|
|
284
|
-
return {
|
|
285
|
-
checkId: check.id,
|
|
286
|
-
passed: matches,
|
|
287
|
-
message: matches ? `命令输出匹配: ${expected}` : `命令输出不匹配: ${expected}`,
|
|
288
|
-
actual,
|
|
289
|
-
expected,
|
|
290
|
-
};
|
|
291
|
-
} catch (error: any) {
|
|
292
|
-
return {
|
|
293
|
-
checkId: check.id,
|
|
294
|
-
passed: false,
|
|
295
|
-
message: `命令执行失败: ${command}`,
|
|
296
|
-
actual: error.message,
|
|
297
|
-
expected,
|
|
298
|
-
error: error.message,
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
/**
|
|
304
|
-
* 检查输出包含内容
|
|
305
|
-
*/
|
|
306
|
-
private async checkOutputContains(check: CheckpointCheck, context: CheckpointContext): Promise<CheckResult> {
|
|
307
|
-
const output = this.stringifyOutput(context.output);
|
|
308
|
-
const content = check.config.content || String(check.config.expected || '');
|
|
309
|
-
const contains = output.includes(content);
|
|
310
|
-
|
|
311
|
-
return {
|
|
312
|
-
checkId: check.id,
|
|
313
|
-
passed: contains,
|
|
314
|
-
message: contains ? `输出包含内容: ${content}` : `输出不包含内容: ${content}`,
|
|
315
|
-
actual: contains,
|
|
316
|
-
expected: true,
|
|
317
|
-
};
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
/**
|
|
321
|
-
* 检查输出不包含内容
|
|
322
|
-
*/
|
|
323
|
-
private async checkOutputNotContains(check: CheckpointCheck, context: CheckpointContext): Promise<CheckResult> {
|
|
324
|
-
const output = this.stringifyOutput(context.output);
|
|
325
|
-
const content = check.config.content || String(check.config.expected || '');
|
|
326
|
-
const notContains = !output.includes(content);
|
|
327
|
-
|
|
328
|
-
return {
|
|
329
|
-
checkId: check.id,
|
|
330
|
-
passed: notContains,
|
|
331
|
-
message: notContains ? `输出不包含内容: ${content}` : `输出包含内容: ${content}`,
|
|
332
|
-
actual: !notContains,
|
|
333
|
-
expected: false,
|
|
334
|
-
};
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
/**
|
|
338
|
-
* 检查输出匹配正则
|
|
339
|
-
*/
|
|
340
|
-
private async checkOutputMatches(check: CheckpointCheck, context: CheckpointContext): Promise<CheckResult> {
|
|
341
|
-
const output = this.stringifyOutput(context.output);
|
|
342
|
-
const pattern = check.config.pattern || '';
|
|
343
|
-
const regex = new RegExp(pattern, 'gm');
|
|
344
|
-
const matches = regex.test(output);
|
|
345
|
-
|
|
346
|
-
return {
|
|
347
|
-
checkId: check.id,
|
|
348
|
-
passed: matches,
|
|
349
|
-
message: matches ? `输出匹配正则: ${pattern}` : `输出不匹配正则: ${pattern}`,
|
|
350
|
-
actual: matches,
|
|
351
|
-
expected: true,
|
|
352
|
-
};
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
/**
|
|
356
|
-
* 检查 JSON 路径
|
|
357
|
-
*/
|
|
358
|
-
private async checkJsonPath(check: CheckpointCheck, context: CheckpointContext): Promise<CheckResult> {
|
|
359
|
-
const jsonPath = check.config.jsonPath || '';
|
|
360
|
-
const expected = check.config.expected;
|
|
361
|
-
|
|
362
|
-
let actual: any;
|
|
363
|
-
try {
|
|
364
|
-
actual = this.getJsonValue(context.output, jsonPath);
|
|
365
|
-
} catch (error) {
|
|
366
|
-
return {
|
|
367
|
-
checkId: check.id,
|
|
368
|
-
passed: false,
|
|
369
|
-
message: `JSON 路径无效: ${jsonPath}`,
|
|
370
|
-
actual: null,
|
|
371
|
-
expected,
|
|
372
|
-
error: (error as Error).message,
|
|
373
|
-
};
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
const matches = JSON.stringify(actual) === JSON.stringify(expected);
|
|
377
|
-
|
|
378
|
-
return {
|
|
379
|
-
checkId: check.id,
|
|
380
|
-
passed: matches,
|
|
381
|
-
message: matches ? `JSON 路径匹配: ${jsonPath}` : `JSON 路径不匹配: ${jsonPath}`,
|
|
382
|
-
actual,
|
|
383
|
-
expected,
|
|
384
|
-
};
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
/**
|
|
388
|
-
* HTTP 调用重试(处理 httpbin rate-limit 503/429)
|
|
389
|
-
*/
|
|
390
|
-
private async fetchWithRetry(url: string, init?: RequestInit, retries = 3): Promise<Response> {
|
|
391
|
-
let lastError: unknown;
|
|
392
|
-
for (let i = 0; i <= retries; i++) {
|
|
393
|
-
try {
|
|
394
|
-
const response = await fetch(url, init);
|
|
395
|
-
// 5xx / 429 → 重试,指数退避
|
|
396
|
-
if (!response.ok && i < retries && (response.status >= 500 || response.status === 429)) {
|
|
397
|
-
await new Promise(r => setTimeout(r, 2000 * (i + 1)));
|
|
398
|
-
continue;
|
|
399
|
-
}
|
|
400
|
-
return response;
|
|
401
|
-
} catch (e) {
|
|
402
|
-
lastError = e;
|
|
403
|
-
if (i < retries) await new Promise(r => setTimeout(r, 2000 * (i + 1)));
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
throw lastError;
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
/**
|
|
410
|
-
* 检查 HTTP 状态码
|
|
411
|
-
*/
|
|
412
|
-
private async checkHttpStatus(check: CheckpointCheck, context: CheckpointContext): Promise<CheckResult> {
|
|
413
|
-
const url = check.config.url || '';
|
|
414
|
-
const expected = check.config.expectedStatus || check.config.expected || 200;
|
|
415
|
-
|
|
416
|
-
try {
|
|
417
|
-
const response = await this.fetchWithRetry(url, { signal: AbortSignal.timeout(10000) });
|
|
418
|
-
const actual = response.status;
|
|
419
|
-
const matches = actual === expected;
|
|
420
|
-
|
|
421
|
-
return {
|
|
422
|
-
checkId: check.id,
|
|
423
|
-
passed: matches,
|
|
424
|
-
message: matches ? `HTTP 状态码匹配: ${expected}` : `HTTP 状态码不匹配: ${actual} != ${expected}`,
|
|
425
|
-
actual,
|
|
426
|
-
expected,
|
|
427
|
-
};
|
|
428
|
-
} catch (error: any) {
|
|
429
|
-
return {
|
|
430
|
-
checkId: check.id,
|
|
431
|
-
passed: false,
|
|
432
|
-
message: `HTTP 请求失败: ${url}`,
|
|
433
|
-
actual: error.message,
|
|
434
|
-
expected,
|
|
435
|
-
error: error.message,
|
|
436
|
-
};
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
/**
|
|
441
|
-
* 检查 HTTP 响应体
|
|
442
|
-
*/
|
|
443
|
-
private async checkHttpBody(check: CheckpointCheck, context: CheckpointContext): Promise<CheckResult> {
|
|
444
|
-
const url = check.config.url || '';
|
|
445
|
-
const expected = String(check.config.expected || '');
|
|
446
|
-
|
|
447
|
-
try {
|
|
448
|
-
const response = await this.fetchWithRetry(url, {
|
|
449
|
-
method: check.config.method || 'GET',
|
|
450
|
-
headers: check.config.headers,
|
|
451
|
-
body: check.config.body ? JSON.stringify(check.config.body) : undefined,
|
|
452
|
-
signal: AbortSignal.timeout(10000),
|
|
453
|
-
});
|
|
454
|
-
const actual = await response.text();
|
|
455
|
-
const contains = actual.includes(expected);
|
|
456
|
-
|
|
457
|
-
return {
|
|
458
|
-
checkId: check.id,
|
|
459
|
-
passed: contains,
|
|
460
|
-
message: contains ? `HTTP 响应体包含: ${expected}` : `HTTP 响应体不包含: ${expected}`,
|
|
461
|
-
actual,
|
|
462
|
-
expected,
|
|
463
|
-
};
|
|
464
|
-
} catch (error: any) {
|
|
465
|
-
return {
|
|
466
|
-
checkId: check.id,
|
|
467
|
-
passed: false,
|
|
468
|
-
message: `HTTP 请求失败: ${url}`,
|
|
469
|
-
actual: error.message,
|
|
470
|
-
expected,
|
|
471
|
-
error: error.message,
|
|
472
|
-
};
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
|
|
476
154
|
/**
|
|
477
155
|
* 自定义检查
|
|
478
156
|
*/
|
|
479
157
|
private async checkCustom(check: CheckpointCheck, context: CheckpointContext): Promise<CheckResult> {
|
|
480
158
|
// 检查是否有自定义处理器
|
|
481
159
|
const handler = context.customHandlers?.get(check.config.customFunction || '');
|
|
482
|
-
|
|
160
|
+
|
|
483
161
|
if (handler) {
|
|
484
162
|
return await handler(check.config);
|
|
485
163
|
}
|
|
@@ -491,57 +169,4 @@ export class CheckpointValidator {
|
|
|
491
169
|
error: 'Custom check not implemented',
|
|
492
170
|
};
|
|
493
171
|
}
|
|
494
|
-
|
|
495
|
-
/**
|
|
496
|
-
* 解析路径
|
|
497
|
-
*/
|
|
498
|
-
private resolvePath(relativePath: string, workdir: string): string {
|
|
499
|
-
if (path.isAbsolute(relativePath)) {
|
|
500
|
-
return relativePath;
|
|
501
|
-
}
|
|
502
|
-
return path.join(workdir, relativePath);
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
/**
|
|
506
|
-
* 将输出转换为字符串
|
|
507
|
-
*/
|
|
508
|
-
private stringifyOutput(output: any): string {
|
|
509
|
-
if (typeof output === 'string') {
|
|
510
|
-
return output;
|
|
511
|
-
}
|
|
512
|
-
if (output === null || output === undefined) {
|
|
513
|
-
return '';
|
|
514
|
-
}
|
|
515
|
-
return JSON.stringify(output);
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
/**
|
|
519
|
-
* 获取 JSON 值
|
|
520
|
-
*/
|
|
521
|
-
private getJsonValue(obj: any, jsonPath: string): any {
|
|
522
|
-
const parts = jsonPath.split('.');
|
|
523
|
-
let current = obj;
|
|
524
|
-
|
|
525
|
-
for (const part of parts) {
|
|
526
|
-
if (current === null || current === undefined) {
|
|
527
|
-
return undefined;
|
|
528
|
-
}
|
|
529
|
-
current = current[part];
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
return current;
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
// 导出单例
|
|
537
|
-
export const checkpointValidator = CheckpointValidator.getInstance();
|
|
538
|
-
|
|
539
|
-
/**
|
|
540
|
-
* 快捷函数:验证检查点
|
|
541
|
-
*/
|
|
542
|
-
export async function validateCheckpoint(
|
|
543
|
-
checkpoint: Checkpoint,
|
|
544
|
-
context: CheckpointContext
|
|
545
|
-
): Promise<CheckpointResult> {
|
|
546
|
-
return checkpointValidator.validate(checkpoint, context);
|
|
547
172
|
}
|
|
@@ -72,7 +72,7 @@ export class CSOValidator {
|
|
|
72
72
|
/**
|
|
73
73
|
* 验证描述
|
|
74
74
|
*/
|
|
75
|
-
private validateDescription(description: string,
|
|
75
|
+
private validateDescription(description: string, _type: string): CSOValidationResult {
|
|
76
76
|
const issues: CSOIssue[] = [];
|
|
77
77
|
|
|
78
78
|
// 检查是否有工作流总结关键词
|
|
@@ -281,12 +281,12 @@ export class PassesGate {
|
|
|
281
281
|
/**
|
|
282
282
|
* 运行测试
|
|
283
283
|
*/
|
|
284
|
-
private async runTest(workDir: string,
|
|
284
|
+
private async runTest(workDir: string, _task?: DynamicTask): Promise<TaskTestResult> {
|
|
285
285
|
const testCommand = await this.detectTestCommand(workDir);
|
|
286
286
|
const timestamp = new Date();
|
|
287
287
|
|
|
288
288
|
try {
|
|
289
|
-
const { stdout
|
|
289
|
+
const { stdout } = await execAsync(testCommand, {
|
|
290
290
|
cwd: workDir,
|
|
291
291
|
maxBuffer: 10 * 1024 * 1024, // 10MB buffer
|
|
292
292
|
});
|
package/src/dashboard/stats.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* 纯函数,从原始数据计算统计指标
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import type { KnowledgeEntry, KnowledgeType
|
|
7
|
+
import type { KnowledgeEntry, KnowledgeType } from '../knowledge/types';
|
|
8
8
|
import type { KnowledgeOverview, KnowledgeFlow } from './types';
|
|
9
9
|
|
|
10
10
|
/**
|
package/src/dashboard/types.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* harness 提供数据,studio 负责渲染
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import type { KnowledgeType
|
|
7
|
+
import type { KnowledgeType } from '../knowledge/types';
|
|
8
8
|
import type { ConstraintLayer, DeprecationStatus } from '../constraints/types';
|
|
9
9
|
|
|
10
10
|
// ── 知识库全景 ───────────────────────────────────────────
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import type { ExecutionTrace, TraceAnomaly } from '../../types/trace';
|
|
6
|
-
import type { Diagnosis } from '../../monitoring
|
|
7
|
-
import type { ConstraintProposal, ProposalReviewResult } from '../../monitoring/constraint-evolver';
|
|
6
|
+
import type { Diagnosis, ConstraintProposal, ProposalReviewResult } from '../../types/monitoring-types';
|
|
8
7
|
import type { ExecutionResult } from '../../constraints/lifecycle-runner';
|
|
9
8
|
|
|
10
9
|
jest.mock('../../monitoring/constraint-doctor', () => {
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
import type { ExecutionTrace, TraceAnomaly } from '../types/trace';
|
|
9
9
|
import type { LLMAdapter } from '../llm/types';
|
|
10
10
|
import { ConstraintDoctor } from '../monitoring/constraint-doctor';
|
|
11
|
-
import type { Diagnosis } from '../monitoring/constraint-doctor';
|
|
12
11
|
import { ConstraintEvolver } from '../monitoring/constraint-evolver';
|
|
13
|
-
import
|
|
12
|
+
import { getConstraint } from '../core/constraints/definitions';
|
|
13
|
+
import type { Diagnosis, ConstraintProposal } from '../types/monitoring-types';
|
|
14
14
|
import { ConstraintLifecycleRunner } from '../constraints/lifecycle-runner';
|
|
15
15
|
import type { ExecutionResult } from '../constraints/lifecycle-runner';
|
|
16
16
|
|
|
@@ -49,7 +49,7 @@ export async function autoEvolve(
|
|
|
49
49
|
const doctor = new ConstraintDoctor({ enabled: !!llm }, llm);
|
|
50
50
|
doctor.setData(traces);
|
|
51
51
|
|
|
52
|
-
const evolver = new ConstraintEvolver();
|
|
52
|
+
const evolver = new ConstraintEvolver(undefined, getConstraint);
|
|
53
53
|
const runner = new ConstraintLifecycleRunner();
|
|
54
54
|
|
|
55
55
|
const diagnoses: Diagnosis[] = [];
|