@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
|
@@ -792,36 +792,6 @@ describe('ConstraintChecker - 补充覆盖', () => {
|
|
|
792
792
|
});
|
|
793
793
|
});
|
|
794
794
|
|
|
795
|
-
describe('deprecated 函数', () => {
|
|
796
|
-
it('checkIronLaw 应该等同于 checkConstraint', async () => {
|
|
797
|
-
const { checkIronLaw } = await import('../core/constraints/checker');
|
|
798
|
-
|
|
799
|
-
const context: ConstraintContext = {
|
|
800
|
-
operation: 'code_implementation',
|
|
801
|
-
hasTest: true,
|
|
802
|
-
hasVerificationEvidence: true,
|
|
803
|
-
};
|
|
804
|
-
|
|
805
|
-
const result = await checkIronLaw('no_self_approval', context);
|
|
806
|
-
expect(result.id).toBe('no_self_approval');
|
|
807
|
-
expect(result.satisfied).toBe(true);
|
|
808
|
-
});
|
|
809
|
-
|
|
810
|
-
it('checkAllIronLaws 应该返回所有检查结果', async () => {
|
|
811
|
-
const { checkAllIronLaws } = await import('../core/constraints/checker');
|
|
812
|
-
|
|
813
|
-
const context: ConstraintContext = {
|
|
814
|
-
operation: 'commit',
|
|
815
|
-
projectPath: tempDir,
|
|
816
|
-
hasTest: true,
|
|
817
|
-
};
|
|
818
|
-
|
|
819
|
-
const results = await checkAllIronLaws(context);
|
|
820
|
-
expect(Array.isArray(results)).toBe(true);
|
|
821
|
-
expect(results.length).toBeGreaterThan(0);
|
|
822
|
-
});
|
|
823
|
-
});
|
|
824
|
-
|
|
825
795
|
describe('checkConstraint 快捷函数', () => {
|
|
826
796
|
it('未知约束应该返回不满足', async () => {
|
|
827
797
|
const { checkConstraint } = await import('../core/constraints/checker');
|
|
@@ -764,39 +764,6 @@ describe('ConstraintChecker', () => {
|
|
|
764
764
|
});
|
|
765
765
|
});
|
|
766
766
|
|
|
767
|
-
describe('Deprecated functions', () => {
|
|
768
|
-
it('getAllLaws should work', () => {
|
|
769
|
-
const { getAllLaws } = require('../core/constraints/definitions');
|
|
770
|
-
const laws = getAllLaws();
|
|
771
|
-
expect(Array.isArray(laws)).toBe(true);
|
|
772
|
-
expect(laws.length).toBeGreaterThan(0);
|
|
773
|
-
});
|
|
774
|
-
|
|
775
|
-
it('findLawsByTrigger should work', () => {
|
|
776
|
-
const { findLawsByTrigger } = require('../core/constraints/definitions');
|
|
777
|
-
const laws = findLawsByTrigger('code_implementation');
|
|
778
|
-
expect(Array.isArray(laws)).toBe(true);
|
|
779
|
-
});
|
|
780
|
-
|
|
781
|
-
it('getLaw should work', () => {
|
|
782
|
-
const { getLaw } = require('../core/constraints/definitions');
|
|
783
|
-
const law = getLaw('no_bypass_checkpoint');
|
|
784
|
-
expect(law).toBeDefined();
|
|
785
|
-
});
|
|
786
|
-
|
|
787
|
-
it('filterLawsBySeverity should work', () => {
|
|
788
|
-
const { filterLawsBySeverity } = require('../core/constraints/definitions');
|
|
789
|
-
const errors = filterLawsBySeverity('error');
|
|
790
|
-
expect(Array.isArray(errors)).toBe(true);
|
|
791
|
-
|
|
792
|
-
const warnings = filterLawsBySeverity('warning');
|
|
793
|
-
expect(Array.isArray(warnings)).toBe(true);
|
|
794
|
-
|
|
795
|
-
const infos = filterLawsBySeverity('info');
|
|
796
|
-
expect(Array.isArray(infos)).toBe(true);
|
|
797
|
-
});
|
|
798
|
-
});
|
|
799
|
-
|
|
800
767
|
describe('Helper functions', () => {
|
|
801
768
|
it('should check single constraint via checkConstraint', async () => {
|
|
802
769
|
const context: ConstraintContext = {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { describe, it, expect, beforeAll, afterAll } from '@jest/globals';
|
|
6
|
-
import { CheckpointValidator
|
|
6
|
+
import { CheckpointValidator } from '../core/validators/checkpoint';
|
|
7
7
|
import { mkdirSync, rmSync, writeFileSync } from 'fs';
|
|
8
8
|
import { join } from 'path';
|
|
9
9
|
|
|
@@ -42,7 +42,7 @@ describe('CheckpointValidator', () => {
|
|
|
42
42
|
|
|
43
43
|
describe('file_exists', () => {
|
|
44
44
|
it('文件存在应该通过', async () => {
|
|
45
|
-
const result = await
|
|
45
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
46
46
|
{
|
|
47
47
|
id: 'cp-1',
|
|
48
48
|
checks: [{ id: 'c-1', type: 'file_exists', config: { path: 'test.txt' } }],
|
|
@@ -55,7 +55,7 @@ describe('CheckpointValidator', () => {
|
|
|
55
55
|
});
|
|
56
56
|
|
|
57
57
|
it('文件不存在应该失败', async () => {
|
|
58
|
-
const result = await
|
|
58
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
59
59
|
{
|
|
60
60
|
id: 'cp-2',
|
|
61
61
|
checks: [{ id: 'c-2', type: 'file_exists', config: { path: 'not-exist.txt' } }],
|
|
@@ -71,7 +71,7 @@ describe('CheckpointValidator', () => {
|
|
|
71
71
|
|
|
72
72
|
describe('file_not_empty', () => {
|
|
73
73
|
it('非空文件应该通过', async () => {
|
|
74
|
-
const result = await
|
|
74
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
75
75
|
{
|
|
76
76
|
id: 'cp-3',
|
|
77
77
|
checks: [{ id: 'c-3', type: 'file_not_empty', config: { path: 'test.txt' } }],
|
|
@@ -83,7 +83,7 @@ describe('CheckpointValidator', () => {
|
|
|
83
83
|
});
|
|
84
84
|
|
|
85
85
|
it('空文件应该失败', async () => {
|
|
86
|
-
const result = await
|
|
86
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
87
87
|
{
|
|
88
88
|
id: 'cp-4',
|
|
89
89
|
checks: [{ id: 'c-4', type: 'file_not_empty', config: { path: 'empty.txt' } }],
|
|
@@ -98,7 +98,7 @@ describe('CheckpointValidator', () => {
|
|
|
98
98
|
|
|
99
99
|
describe('file_contains', () => {
|
|
100
100
|
it('文件包含内容应该通过', async () => {
|
|
101
|
-
const result = await
|
|
101
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
102
102
|
{
|
|
103
103
|
id: 'cp-5',
|
|
104
104
|
checks: [{ id: 'c-5', type: 'file_contains', config: { path: 'test.txt', content: 'hello' } }],
|
|
@@ -110,7 +110,7 @@ describe('CheckpointValidator', () => {
|
|
|
110
110
|
});
|
|
111
111
|
|
|
112
112
|
it('文件不包含内容应该失败', async () => {
|
|
113
|
-
const result = await
|
|
113
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
114
114
|
{
|
|
115
115
|
id: 'cp-6',
|
|
116
116
|
checks: [{ id: 'c-6', type: 'file_contains', config: { path: 'test.txt', content: 'goodbye' } }],
|
|
@@ -124,7 +124,7 @@ describe('CheckpointValidator', () => {
|
|
|
124
124
|
|
|
125
125
|
describe('file_not_contains', () => {
|
|
126
126
|
it('文件不包含内容应该通过', async () => {
|
|
127
|
-
const result = await
|
|
127
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
128
128
|
{
|
|
129
129
|
id: 'cp-20',
|
|
130
130
|
checks: [{ id: 'c-20', type: 'file_not_contains', config: { path: 'test.txt', content: 'goodbye' } }],
|
|
@@ -136,7 +136,7 @@ describe('CheckpointValidator', () => {
|
|
|
136
136
|
});
|
|
137
137
|
|
|
138
138
|
it('文件包含内容应该失败', async () => {
|
|
139
|
-
const result = await
|
|
139
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
140
140
|
{
|
|
141
141
|
id: 'cp-21',
|
|
142
142
|
checks: [{ id: 'c-21', type: 'file_not_contains', config: { path: 'test.txt', content: 'hello' } }],
|
|
@@ -151,7 +151,7 @@ describe('CheckpointValidator', () => {
|
|
|
151
151
|
|
|
152
152
|
describe('json_path', () => {
|
|
153
153
|
it('JSON 路径匹配应该通过', async () => {
|
|
154
|
-
const result = await
|
|
154
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
155
155
|
{
|
|
156
156
|
id: 'cp-7',
|
|
157
157
|
checks: [{ id: 'c-7', type: 'json_path', config: { jsonPath: 'name', expected: 'test' } }],
|
|
@@ -163,7 +163,7 @@ describe('CheckpointValidator', () => {
|
|
|
163
163
|
});
|
|
164
164
|
|
|
165
165
|
it('JSON 路径不匹配应该失败', async () => {
|
|
166
|
-
const result = await
|
|
166
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
167
167
|
{
|
|
168
168
|
id: 'cp-8',
|
|
169
169
|
checks: [{ id: 'c-8', type: 'json_path', config: { jsonPath: 'value', expected: 100 } }],
|
|
@@ -177,7 +177,7 @@ describe('CheckpointValidator', () => {
|
|
|
177
177
|
|
|
178
178
|
describe('output_contains', () => {
|
|
179
179
|
it('输出包含内容应该通过', async () => {
|
|
180
|
-
const result = await
|
|
180
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
181
181
|
{
|
|
182
182
|
id: 'cp-9',
|
|
183
183
|
checks: [{ id: 'c-9', type: 'output_contains', config: { content: 'success' } }],
|
|
@@ -189,7 +189,7 @@ describe('CheckpointValidator', () => {
|
|
|
189
189
|
});
|
|
190
190
|
|
|
191
191
|
it('输出不包含内容应该失败', async () => {
|
|
192
|
-
const result = await
|
|
192
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
193
193
|
{
|
|
194
194
|
id: 'cp-9b',
|
|
195
195
|
checks: [{ id: 'c-9b', type: 'output_contains', config: { content: 'error' } }],
|
|
@@ -204,7 +204,7 @@ describe('CheckpointValidator', () => {
|
|
|
204
204
|
|
|
205
205
|
describe('output_not_contains', () => {
|
|
206
206
|
it('输出不包含内容应该通过', async () => {
|
|
207
|
-
const result = await
|
|
207
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
208
208
|
{
|
|
209
209
|
id: 'cp-14',
|
|
210
210
|
checks: [{ id: 'c-14', type: 'output_not_contains', config: { content: 'error' } }],
|
|
@@ -216,7 +216,7 @@ describe('CheckpointValidator', () => {
|
|
|
216
216
|
});
|
|
217
217
|
|
|
218
218
|
it('输出包含内容应该失败', async () => {
|
|
219
|
-
const result = await
|
|
219
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
220
220
|
{
|
|
221
221
|
id: 'cp-15',
|
|
222
222
|
checks: [{ id: 'c-15', type: 'output_not_contains', config: { content: 'success' } }],
|
|
@@ -231,7 +231,7 @@ describe('CheckpointValidator', () => {
|
|
|
231
231
|
|
|
232
232
|
describe('output_matches', () => {
|
|
233
233
|
it('输出匹配正则应该通过', async () => {
|
|
234
|
-
const result = await
|
|
234
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
235
235
|
{
|
|
236
236
|
id: 'cp-16',
|
|
237
237
|
checks: [{ id: 'c-16', type: 'output_matches', config: { pattern: '\\d+ tests passed' } }],
|
|
@@ -243,7 +243,7 @@ describe('CheckpointValidator', () => {
|
|
|
243
243
|
});
|
|
244
244
|
|
|
245
245
|
it('输出不匹配正则应该失败', async () => {
|
|
246
|
-
const result = await
|
|
246
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
247
247
|
{
|
|
248
248
|
id: 'cp-17',
|
|
249
249
|
checks: [{ id: 'c-17', type: 'output_matches', config: { pattern: 'Error:.*' } }],
|
|
@@ -258,7 +258,7 @@ describe('CheckpointValidator', () => {
|
|
|
258
258
|
|
|
259
259
|
describe('command_output', () => {
|
|
260
260
|
it('命令输出匹配应该通过', async () => {
|
|
261
|
-
const result = await
|
|
261
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
262
262
|
{
|
|
263
263
|
id: 'cp-18',
|
|
264
264
|
checks: [{ id: 'c-18', type: 'command_output', config: { command: 'echo hello', expected: 'hello' } }],
|
|
@@ -270,7 +270,7 @@ describe('CheckpointValidator', () => {
|
|
|
270
270
|
});
|
|
271
271
|
|
|
272
272
|
it('命令输出不匹配应该失败', async () => {
|
|
273
|
-
const result = await
|
|
273
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
274
274
|
{
|
|
275
275
|
id: 'cp-19',
|
|
276
276
|
checks: [{ id: 'c-19', type: 'command_output', config: { command: 'echo hello', expected: 'world' } }],
|
|
@@ -284,7 +284,7 @@ describe('CheckpointValidator', () => {
|
|
|
284
284
|
|
|
285
285
|
describe('command_success', () => {
|
|
286
286
|
it('命令成功应该通过', async () => {
|
|
287
|
-
const result = await
|
|
287
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
288
288
|
{
|
|
289
289
|
id: 'cp-10',
|
|
290
290
|
checks: [{ id: 'c-10', type: 'command_success', config: { command: 'echo test' } }],
|
|
@@ -296,7 +296,7 @@ describe('CheckpointValidator', () => {
|
|
|
296
296
|
});
|
|
297
297
|
|
|
298
298
|
it('命令失败应该失败', async () => {
|
|
299
|
-
const result = await
|
|
299
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
300
300
|
{
|
|
301
301
|
id: 'cp-11',
|
|
302
302
|
checks: [{ id: 'c-11', type: 'command_success', config: { command: 'exit 1' } }],
|
|
@@ -310,7 +310,7 @@ describe('CheckpointValidator', () => {
|
|
|
310
310
|
|
|
311
311
|
describe('多检查组合', () => {
|
|
312
312
|
it('所有检查通过才算整体通过', async () => {
|
|
313
|
-
const result = await
|
|
313
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
314
314
|
{
|
|
315
315
|
id: 'cp-12',
|
|
316
316
|
checks: [
|
|
@@ -328,7 +328,7 @@ describe('CheckpointValidator', () => {
|
|
|
328
328
|
});
|
|
329
329
|
|
|
330
330
|
it('一个检查失败则整体失败', async () => {
|
|
331
|
-
const result = await
|
|
331
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
332
332
|
{
|
|
333
333
|
id: 'cp-13',
|
|
334
334
|
checks: [
|
|
@@ -346,7 +346,7 @@ describe('CheckpointValidator', () => {
|
|
|
346
346
|
|
|
347
347
|
describe('空检查点', () => {
|
|
348
348
|
it('无检查应该默认通过', async () => {
|
|
349
|
-
const result = await
|
|
349
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
350
350
|
{ id: 'cp-empty', checks: [] },
|
|
351
351
|
{ workdir: tempDir, projectPath: tempDir }
|
|
352
352
|
);
|
|
@@ -361,7 +361,7 @@ describe('CheckpointValidator', () => {
|
|
|
361
361
|
|
|
362
362
|
it('HTTP 状态码匹配应该通过', async () => {
|
|
363
363
|
globalThis.fetch = (async () => new Response(null, { status: 200 })) as any;
|
|
364
|
-
const result = await
|
|
364
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
365
365
|
{
|
|
366
366
|
id: 'cp-22',
|
|
367
367
|
checks: [{ id: 'c-22', type: 'http_status', config: { url: 'https://example.com', expectedStatus: 200 } }],
|
|
@@ -373,7 +373,7 @@ describe('CheckpointValidator', () => {
|
|
|
373
373
|
|
|
374
374
|
it('HTTP 状态码不匹配应该失败', async () => {
|
|
375
375
|
globalThis.fetch = (async () => new Response(null, { status: 404 })) as any;
|
|
376
|
-
const result = await
|
|
376
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
377
377
|
{
|
|
378
378
|
id: 'cp-23',
|
|
379
379
|
checks: [{ id: 'c-23', type: 'http_status', config: { url: 'https://example.com', expectedStatus: 200 } }],
|
|
@@ -390,7 +390,7 @@ describe('CheckpointValidator', () => {
|
|
|
390
390
|
|
|
391
391
|
it('HTTP 响应体包含内容应该通过', async () => {
|
|
392
392
|
globalThis.fetch = (async () => new Response('{"args": "test"}', { status: 200 })) as any;
|
|
393
|
-
const result = await
|
|
393
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
394
394
|
{
|
|
395
395
|
id: 'cp-24',
|
|
396
396
|
checks: [{ id: 'c-24', type: 'http_body', config: { url: 'https://example.com', expected: 'args' } }],
|
|
@@ -402,7 +402,7 @@ describe('CheckpointValidator', () => {
|
|
|
402
402
|
|
|
403
403
|
it('HTTP 响应体不包含内容应该失败', async () => {
|
|
404
404
|
globalThis.fetch = (async () => new Response('{"data": "test"}', { status: 200 })) as any;
|
|
405
|
-
const result = await
|
|
405
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
406
406
|
{
|
|
407
407
|
id: 'cp-25',
|
|
408
408
|
checks: [{ id: 'c-25', type: 'http_body', config: { url: 'https://example.com', expected: 'NONEXISTENT' } }],
|
|
@@ -423,7 +423,7 @@ describe('CheckpointValidator', () => {
|
|
|
423
423
|
message: '自定义检查通过',
|
|
424
424
|
}));
|
|
425
425
|
|
|
426
|
-
const result = await
|
|
426
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
427
427
|
{
|
|
428
428
|
id: 'cp-26',
|
|
429
429
|
checks: [{ id: 'c-26', type: 'custom', config: { customFunction: 'myValidator' } }],
|
|
@@ -442,7 +442,7 @@ describe('CheckpointValidator', () => {
|
|
|
442
442
|
message: '自定义检查失败',
|
|
443
443
|
}));
|
|
444
444
|
|
|
445
|
-
const result = await
|
|
445
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
446
446
|
{
|
|
447
447
|
id: 'cp-26b',
|
|
448
448
|
checks: [{ id: 'c-26b', type: 'custom', config: { customFunction: 'failValidator' } }],
|
|
@@ -454,7 +454,7 @@ describe('CheckpointValidator', () => {
|
|
|
454
454
|
});
|
|
455
455
|
|
|
456
456
|
it('未注册的自定义检查应该失败', async () => {
|
|
457
|
-
const result = await
|
|
457
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
458
458
|
{
|
|
459
459
|
id: 'cp-27',
|
|
460
460
|
checks: [{ id: 'c-27', type: 'custom', config: { customFunction: 'unknownValidator' } }],
|
|
@@ -473,7 +473,7 @@ describe('CheckpointValidator', () => {
|
|
|
473
473
|
describe('边缘情况', () => {
|
|
474
474
|
describe('未知检查类型', () => {
|
|
475
475
|
it('未知类型应该返回错误', async () => {
|
|
476
|
-
const result = await
|
|
476
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
477
477
|
{
|
|
478
478
|
id: 'cp-unknown',
|
|
479
479
|
checks: [{ id: 'c-unknown', type: 'unknown_type' as any, config: {} }],
|
|
@@ -489,7 +489,7 @@ describe('CheckpointValidator', () => {
|
|
|
489
489
|
|
|
490
490
|
describe('file_not_empty 文件不存在', () => {
|
|
491
491
|
it('文件不存在应该失败', async () => {
|
|
492
|
-
const result = await
|
|
492
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
493
493
|
{
|
|
494
494
|
id: 'cp-fne-missing',
|
|
495
495
|
checks: [{ id: 'c-fne-missing', type: 'file_not_empty', config: { path: 'nonexistent.txt' } }],
|
|
@@ -504,7 +504,7 @@ describe('CheckpointValidator', () => {
|
|
|
504
504
|
|
|
505
505
|
describe('file_contains 文件不存在', () => {
|
|
506
506
|
it('文件不存在应该失败', async () => {
|
|
507
|
-
const result = await
|
|
507
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
508
508
|
{
|
|
509
509
|
id: 'cp-fc-missing',
|
|
510
510
|
checks: [{ id: 'c-fc-missing', type: 'file_contains', config: { path: 'nonexistent.txt', content: 'test' } }],
|
|
@@ -519,7 +519,7 @@ describe('CheckpointValidator', () => {
|
|
|
519
519
|
|
|
520
520
|
describe('file_not_contains 文件不存在', () => {
|
|
521
521
|
it('文件不存在应该失败', async () => {
|
|
522
|
-
const result = await
|
|
522
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
523
523
|
{
|
|
524
524
|
id: 'cp-fnc-missing',
|
|
525
525
|
checks: [{ id: 'c-fnc-missing', type: 'file_not_contains', config: { path: 'nonexistent.txt', content: 'test' } }],
|
|
@@ -534,7 +534,7 @@ describe('CheckpointValidator', () => {
|
|
|
534
534
|
|
|
535
535
|
describe('command_output 命令失败', () => {
|
|
536
536
|
it('命令执行失败应该返回错误', async () => {
|
|
537
|
-
const result = await
|
|
537
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
538
538
|
{
|
|
539
539
|
id: 'cp-co-fail',
|
|
540
540
|
checks: [{ id: 'c-co-fail', type: 'command_output', config: { command: 'exit 1', expected: 'anything' } }],
|
|
@@ -549,7 +549,7 @@ describe('CheckpointValidator', () => {
|
|
|
549
549
|
|
|
550
550
|
describe('json_path 无效路径', () => {
|
|
551
551
|
it('无效 JSON 路径应该失败', async () => {
|
|
552
|
-
const result = await
|
|
552
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
553
553
|
{
|
|
554
554
|
id: 'cp-jp-invalid',
|
|
555
555
|
checks: [{ id: 'c-jp-invalid', type: 'json_path', config: { jsonPath: 'invalid..path', expected: 'test' } }],
|
|
@@ -569,7 +569,7 @@ describe('CheckpointValidator', () => {
|
|
|
569
569
|
|
|
570
570
|
it('fetch 网络错误应该返回失败', async () => {
|
|
571
571
|
globalThis.fetch = (() => Promise.reject(new Error('Network error'))) as any;
|
|
572
|
-
const result = await
|
|
572
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
573
573
|
{
|
|
574
574
|
id: 'cp-hs-fail',
|
|
575
575
|
checks: [{ id: 'c-hs-fail', type: 'http_status', config: { url: 'https://example.com', expectedStatus: 200 } }],
|
|
@@ -586,7 +586,7 @@ describe('CheckpointValidator', () => {
|
|
|
586
586
|
|
|
587
587
|
it('fetch 网络错误应该返回失败', async () => {
|
|
588
588
|
globalThis.fetch = (() => Promise.reject(new Error('Network error'))) as any;
|
|
589
|
-
const result = await
|
|
589
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
590
590
|
{
|
|
591
591
|
id: 'cp-hb-fail',
|
|
592
592
|
checks: [{ id: 'c-hb-fail', type: 'http_body', config: { url: 'https://example.com', expected: 'test' } }],
|
|
@@ -600,7 +600,7 @@ describe('CheckpointValidator', () => {
|
|
|
600
600
|
|
|
601
601
|
describe('output_contains JSON 输出', () => {
|
|
602
602
|
it('JSON 对象输出应该被正确处理', async () => {
|
|
603
|
-
const result = await
|
|
603
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
604
604
|
{
|
|
605
605
|
id: 'cp-oc-json',
|
|
606
606
|
checks: [{ id: 'c-oc-json', type: 'output_contains', config: { content: 'success' } }],
|
|
@@ -615,7 +615,7 @@ describe('CheckpointValidator', () => {
|
|
|
615
615
|
describe('output_matches 复杂正则', () => {
|
|
616
616
|
it('多行匹配应该工作', async () => {
|
|
617
617
|
// 注意:正则默认不匹配换行符,需要使用 s 标志或 [\s\S]
|
|
618
|
-
const result = await
|
|
618
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
619
619
|
{
|
|
620
620
|
id: 'cp-om-multi',
|
|
621
621
|
checks: [{ id: 'c-om-multi', type: 'output_matches', config: { pattern: 'passed[\\s\\S]*failed' } }],
|
|
@@ -627,7 +627,7 @@ describe('CheckpointValidator', () => {
|
|
|
627
627
|
});
|
|
628
628
|
|
|
629
629
|
it('单行匹配应该工作', async () => {
|
|
630
|
-
const result = await
|
|
630
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
631
631
|
{
|
|
632
632
|
id: 'cp-om-single',
|
|
633
633
|
checks: [{ id: 'c-om-single', type: 'output_matches', config: { pattern: '\\d+ passed' } }],
|
|
@@ -641,7 +641,7 @@ describe('CheckpointValidator', () => {
|
|
|
641
641
|
|
|
642
642
|
describe('边界场景', () => {
|
|
643
643
|
it('未知检查类型应该失败', async () => {
|
|
644
|
-
const result = await
|
|
644
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
645
645
|
{
|
|
646
646
|
id: 'cp-unknown',
|
|
647
647
|
checks: [{ id: 'c-unknown', type: 'unknown_type' as any, config: {} }],
|
|
@@ -654,7 +654,7 @@ describe('CheckpointValidator', () => {
|
|
|
654
654
|
});
|
|
655
655
|
|
|
656
656
|
it('output 为 null 应该被正确处理', async () => {
|
|
657
|
-
const result = await
|
|
657
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
658
658
|
{
|
|
659
659
|
id: 'cp-null-output',
|
|
660
660
|
checks: [{ id: 'c-null-output', type: 'output_contains', config: { content: 'test' } }],
|
|
@@ -667,7 +667,7 @@ describe('CheckpointValidator', () => {
|
|
|
667
667
|
});
|
|
668
668
|
|
|
669
669
|
it('output 为 undefined 应该被正确处理', async () => {
|
|
670
|
-
const result = await
|
|
670
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
671
671
|
{
|
|
672
672
|
id: 'cp-undef-output',
|
|
673
673
|
checks: [{ id: 'c-undef-output', type: 'output_contains', config: { content: 'test' } }],
|
|
@@ -681,7 +681,7 @@ describe('CheckpointValidator', () => {
|
|
|
681
681
|
|
|
682
682
|
it('JSON 路径获取抛出错误应该失败', async () => {
|
|
683
683
|
// 创建一个复杂的 JSON 路径测试场景
|
|
684
|
-
const result = await
|
|
684
|
+
const result = await CheckpointValidator.getInstance().validate(
|
|
685
685
|
{
|
|
686
686
|
id: 'cp-json-err',
|
|
687
687
|
checks: [{ id: 'c-json-err', type: 'json_path', config: { jsonPath: '$.deeply.nested.array[999].field', expected: 'test' } }],
|
|
@@ -4,24 +4,25 @@
|
|
|
4
4
|
|
|
5
5
|
import { describe, it, expect } from '@jest/globals';
|
|
6
6
|
import { ConstraintEvolver } from '../monitoring/constraint-evolver';
|
|
7
|
-
import
|
|
7
|
+
import { getConstraint } from '../core/constraints/definitions';
|
|
8
|
+
import type { Diagnosis } from '../types/monitoring-types';
|
|
8
9
|
|
|
9
10
|
describe('ConstraintEvolver', () => {
|
|
10
11
|
describe('constructor', () => {
|
|
11
12
|
it('应该创建实例', () => {
|
|
12
|
-
const evolver = new ConstraintEvolver();
|
|
13
|
+
const evolver = new ConstraintEvolver(undefined, getConstraint);
|
|
13
14
|
expect(evolver).toBeDefined();
|
|
14
15
|
});
|
|
15
16
|
|
|
16
17
|
it('支持自定义 proposalsDir', () => {
|
|
17
|
-
const evolver = new ConstraintEvolver('/tmp/test-proposals');
|
|
18
|
+
const evolver = new ConstraintEvolver('/tmp/test-proposals', getConstraint);
|
|
18
19
|
expect(evolver).toBeDefined();
|
|
19
20
|
});
|
|
20
21
|
});
|
|
21
22
|
|
|
22
23
|
describe('propose', () => {
|
|
23
24
|
it('应该根据诊断生成提案', async () => {
|
|
24
|
-
const evolver = new ConstraintEvolver();
|
|
25
|
+
const evolver = new ConstraintEvolver(undefined, getConstraint);
|
|
25
26
|
|
|
26
27
|
const diagnosis: Diagnosis = {
|
|
27
28
|
anomalyId: 'anomaly-001',
|
|
@@ -55,7 +56,7 @@ describe('ConstraintEvolver', () => {
|
|
|
55
56
|
});
|
|
56
57
|
|
|
57
58
|
it('needsChange=false 应该返回 null', async () => {
|
|
58
|
-
const evolver = new ConstraintEvolver();
|
|
59
|
+
const evolver = new ConstraintEvolver(undefined, getConstraint);
|
|
59
60
|
|
|
60
61
|
const diagnosis: Diagnosis = {
|
|
61
62
|
anomalyId: 'anomaly-no-change',
|
|
@@ -73,7 +74,7 @@ describe('ConstraintEvolver', () => {
|
|
|
73
74
|
});
|
|
74
75
|
|
|
75
76
|
it('recommendations 为空应该返回 null', async () => {
|
|
76
|
-
const evolver = new ConstraintEvolver();
|
|
77
|
+
const evolver = new ConstraintEvolver(undefined, getConstraint);
|
|
77
78
|
|
|
78
79
|
const diagnosis: Diagnosis = {
|
|
79
80
|
anomalyId: 'anomaly-no-rec',
|
|
@@ -91,7 +92,7 @@ describe('ConstraintEvolver', () => {
|
|
|
91
92
|
});
|
|
92
93
|
|
|
93
94
|
it('应该处理 adjust_threshold 类型', async () => {
|
|
94
|
-
const evolver = new ConstraintEvolver();
|
|
95
|
+
const evolver = new ConstraintEvolver(undefined, getConstraint);
|
|
95
96
|
|
|
96
97
|
const diagnosis: Diagnosis = {
|
|
97
98
|
anomalyId: 'anomaly-002',
|
|
@@ -112,7 +113,7 @@ describe('ConstraintEvolver', () => {
|
|
|
112
113
|
});
|
|
113
114
|
|
|
114
115
|
it('应该处理 modify_constraint 类型', async () => {
|
|
115
|
-
const evolver = new ConstraintEvolver();
|
|
116
|
+
const evolver = new ConstraintEvolver(undefined, getConstraint);
|
|
116
117
|
|
|
117
118
|
const diagnosis: Diagnosis = {
|
|
118
119
|
anomalyId: 'anomaly-003',
|
|
@@ -135,7 +136,7 @@ describe('ConstraintEvolver', () => {
|
|
|
135
136
|
|
|
136
137
|
describe('proposeBatch', () => {
|
|
137
138
|
it('应该批量生成提案', async () => {
|
|
138
|
-
const evolver = new ConstraintEvolver();
|
|
139
|
+
const evolver = new ConstraintEvolver(undefined, getConstraint);
|
|
139
140
|
|
|
140
141
|
const diagnoses: Diagnosis[] = [
|
|
141
142
|
{
|
|
@@ -177,7 +178,7 @@ describe('ConstraintEvolver', () => {
|
|
|
177
178
|
|
|
178
179
|
describe('review', () => {
|
|
179
180
|
it('Iron Law 非添加例外应该被拒绝', async () => {
|
|
180
|
-
const evolver = new ConstraintEvolver();
|
|
181
|
+
const evolver = new ConstraintEvolver(undefined, getConstraint);
|
|
181
182
|
|
|
182
183
|
const diagnosis: Diagnosis = {
|
|
183
184
|
anomalyId: 'review-001',
|
|
@@ -198,7 +199,7 @@ describe('ConstraintEvolver', () => {
|
|
|
198
199
|
});
|
|
199
200
|
|
|
200
201
|
it('高风险提案应该被拒绝', async () => {
|
|
201
|
-
const evolver = new ConstraintEvolver();
|
|
202
|
+
const evolver = new ConstraintEvolver(undefined, getConstraint);
|
|
202
203
|
|
|
203
204
|
const diagnosis: Diagnosis = {
|
|
204
205
|
anomalyId: 'review-002',
|
|
@@ -219,7 +220,7 @@ describe('ConstraintEvolver', () => {
|
|
|
219
220
|
});
|
|
220
221
|
|
|
221
222
|
it('低风险 + 有测试应该通过', async () => {
|
|
222
|
-
const evolver = new ConstraintEvolver();
|
|
223
|
+
const evolver = new ConstraintEvolver(undefined, getConstraint);
|
|
223
224
|
|
|
224
225
|
const diagnosis: Diagnosis = {
|
|
225
226
|
anomalyId: 'review-003',
|
|
@@ -239,7 +240,7 @@ describe('ConstraintEvolver', () => {
|
|
|
239
240
|
});
|
|
240
241
|
|
|
241
242
|
it('中风险需要人工审核', async () => {
|
|
242
|
-
const evolver = new ConstraintEvolver();
|
|
243
|
+
const evolver = new ConstraintEvolver(undefined, getConstraint);
|
|
243
244
|
|
|
244
245
|
const diagnosis: Diagnosis = {
|
|
245
246
|
anomalyId: 'review-004',
|
|
@@ -262,7 +263,7 @@ describe('ConstraintEvolver', () => {
|
|
|
262
263
|
|
|
263
264
|
describe('implement', () => {
|
|
264
265
|
it('add_exception 应该生成正确指令', async () => {
|
|
265
|
-
const evolver = new ConstraintEvolver();
|
|
266
|
+
const evolver = new ConstraintEvolver(undefined, getConstraint);
|
|
266
267
|
|
|
267
268
|
const diagnosis: Diagnosis = {
|
|
268
269
|
anomalyId: 'impl-001',
|
|
@@ -283,7 +284,7 @@ describe('ConstraintEvolver', () => {
|
|
|
283
284
|
});
|
|
284
285
|
|
|
285
286
|
it('remove_exception 应该生成正确指令', async () => {
|
|
286
|
-
const evolver = new ConstraintEvolver();
|
|
287
|
+
const evolver = new ConstraintEvolver(undefined, getConstraint);
|
|
287
288
|
|
|
288
289
|
const proposal = {
|
|
289
290
|
id: 'test-remove',
|
|
@@ -304,7 +305,7 @@ describe('ConstraintEvolver', () => {
|
|
|
304
305
|
});
|
|
305
306
|
|
|
306
307
|
it('adjust_trigger 应该生成正确指令', async () => {
|
|
307
|
-
const evolver = new ConstraintEvolver();
|
|
308
|
+
const evolver = new ConstraintEvolver(undefined, getConstraint);
|
|
308
309
|
|
|
309
310
|
const proposal = {
|
|
310
311
|
id: 'test-adjust',
|
|
@@ -325,7 +326,7 @@ describe('ConstraintEvolver', () => {
|
|
|
325
326
|
});
|
|
326
327
|
|
|
327
328
|
it('change_level 应该生成正确指令', async () => {
|
|
328
|
-
const evolver = new ConstraintEvolver();
|
|
329
|
+
const evolver = new ConstraintEvolver(undefined, getConstraint);
|
|
329
330
|
|
|
330
331
|
const proposal = {
|
|
331
332
|
id: 'test-level',
|
|
@@ -346,7 +347,7 @@ describe('ConstraintEvolver', () => {
|
|
|
346
347
|
});
|
|
347
348
|
|
|
348
349
|
it('modify_message 应该生成正确指令', async () => {
|
|
349
|
-
const evolver = new ConstraintEvolver();
|
|
350
|
+
const evolver = new ConstraintEvolver(undefined, getConstraint);
|
|
350
351
|
|
|
351
352
|
const proposal = {
|
|
352
353
|
id: 'test-msg',
|
|
@@ -367,7 +368,7 @@ describe('ConstraintEvolver', () => {
|
|
|
367
368
|
});
|
|
368
369
|
|
|
369
370
|
it('new_constraint 应该生成正确指令', async () => {
|
|
370
|
-
const evolver = new ConstraintEvolver();
|
|
371
|
+
const evolver = new ConstraintEvolver(undefined, getConstraint);
|
|
371
372
|
|
|
372
373
|
const proposal = {
|
|
373
374
|
id: 'test-new',
|
|
@@ -390,13 +391,13 @@ describe('ConstraintEvolver', () => {
|
|
|
390
391
|
|
|
391
392
|
describe('listProposals', () => {
|
|
392
393
|
it('应该返回所有提案', () => {
|
|
393
|
-
const evolver = new ConstraintEvolver();
|
|
394
|
+
const evolver = new ConstraintEvolver(undefined, getConstraint);
|
|
394
395
|
const proposals = evolver.listProposals();
|
|
395
396
|
expect(Array.isArray(proposals)).toBe(true);
|
|
396
397
|
});
|
|
397
398
|
|
|
398
399
|
it('应该返回待审核提案', () => {
|
|
399
|
-
const evolver = new ConstraintEvolver();
|
|
400
|
+
const evolver = new ConstraintEvolver(undefined, getConstraint);
|
|
400
401
|
const pending = evolver.listProposals('proposed');
|
|
401
402
|
expect(Array.isArray(pending)).toBe(true);
|
|
402
403
|
});
|