@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
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* 通过 DocFreshnessConfig 配置驱动,不绑定任何项目结构。
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { existsSync, readFileSync, readdirSync
|
|
9
|
-
import { join
|
|
8
|
+
import { existsSync, readFileSync, readdirSync } from 'fs';
|
|
9
|
+
import { join } from 'path';
|
|
10
10
|
import { detectSourceRoots } from '../../../utils/detect-source-roots';
|
|
11
11
|
import type {
|
|
12
12
|
DocFreshnessCheck,
|
|
@@ -454,7 +454,6 @@ export class FreshnessRunner {
|
|
|
454
454
|
const suffix = filePattern.replace(/\*/g, '');
|
|
455
455
|
|
|
456
456
|
const entries = readdirSync(searchDir, { withFileTypes: true });
|
|
457
|
-
const reg = new RegExp(pattern);
|
|
458
457
|
|
|
459
458
|
let count = 0;
|
|
460
459
|
for (const entry of entries) {
|
|
@@ -10,11 +10,6 @@ export {
|
|
|
10
10
|
getAllConstraints,
|
|
11
11
|
findConstraintsByTrigger,
|
|
12
12
|
getConstraint,
|
|
13
|
-
// 向后兼容
|
|
14
|
-
getAllLaws,
|
|
15
|
-
findLawsByTrigger,
|
|
16
|
-
getLaw,
|
|
17
|
-
filterLawsBySeverity,
|
|
18
13
|
} from './definitions';
|
|
19
14
|
|
|
20
15
|
// 约束检查器
|
|
@@ -24,11 +19,6 @@ export {
|
|
|
24
19
|
checkConstraints,
|
|
25
20
|
checkBeforeExecution,
|
|
26
21
|
constraintChecker,
|
|
27
|
-
// 向后兼容
|
|
28
|
-
IronLawChecker,
|
|
29
|
-
checkIronLaw,
|
|
30
|
-
checkAllIronLaws,
|
|
31
|
-
ironLawChecker,
|
|
32
22
|
} from './checker';
|
|
33
23
|
|
|
34
24
|
// 类型导出
|
|
@@ -40,28 +30,12 @@ export type {
|
|
|
40
30
|
ConstraintResult,
|
|
41
31
|
ConstraintContext,
|
|
42
32
|
ConstraintCheckResult,
|
|
43
|
-
// 向后兼容
|
|
44
|
-
IronLawId,
|
|
45
|
-
IronLawSeverity,
|
|
46
|
-
IronLawTrigger,
|
|
47
|
-
IronLaw,
|
|
48
|
-
IronLawResult,
|
|
49
33
|
IronLawContext,
|
|
50
34
|
} from '../../types/constraint';
|
|
51
35
|
|
|
52
|
-
export {
|
|
53
|
-
ConstraintViolationError,
|
|
54
|
-
// 向后兼容
|
|
55
|
-
IronLawViolationError,
|
|
56
|
-
} from '../../types/constraint';
|
|
36
|
+
export { ConstraintViolationError } from '../../types/constraint';
|
|
57
37
|
|
|
58
38
|
// 约束拦截器
|
|
59
|
-
// 约束 Prompt 注入
|
|
60
|
-
export {
|
|
61
|
-
formatConstraintsForPrompt,
|
|
62
|
-
type AgentRole,
|
|
63
|
-
} from './prompt-injection';
|
|
64
|
-
|
|
65
39
|
export {
|
|
66
40
|
ConstraintInterceptor,
|
|
67
41
|
constraintInterceptor,
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import type {
|
|
6
|
-
Constraint,
|
|
7
6
|
ConstraintTrigger,
|
|
8
7
|
ConstraintContext,
|
|
9
8
|
ConstraintLevel,
|
|
@@ -15,7 +14,6 @@ import type {
|
|
|
15
14
|
EnforcementId,
|
|
16
15
|
EnforcementExecutor,
|
|
17
16
|
EnforcementContext,
|
|
18
|
-
EnforcementResult,
|
|
19
17
|
InterceptionResult,
|
|
20
18
|
} from '../../types/enforcement';
|
|
21
19
|
import { constraintChecker } from './checker';
|
package/src/core/index.ts
CHANGED
|
@@ -24,6 +24,51 @@ const DEFAULT_CONFIG: ProjectConfig = {
|
|
|
24
24
|
custom_constraints_file: 'custom-constraints.yml',
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
+
/**
|
|
28
|
+
* config.yml 原始解析结果的进程级缓存(工单 16)
|
|
29
|
+
*
|
|
30
|
+
* 键为解析后的项目路径,条目带 mtimeMs+size 指纹:文件未变则直接复用,
|
|
31
|
+
* 避免单次 harness check 内多处读取者重复 yaml 解析;文件变更自动失效。
|
|
32
|
+
*/
|
|
33
|
+
const rawConfigCache = new Map<string, { mtimeMs: number; size: number; raw: Record<string, unknown> }>();
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 读取并解析 .harness/config.yml(进程级 memoize)
|
|
37
|
+
*
|
|
38
|
+
* 文件不存在时返回 undefined;解析失败向上抛出(由各调用方自行兜底)。
|
|
39
|
+
*/
|
|
40
|
+
export function loadRawProjectConfig(projectPath: string): Record<string, unknown> | undefined {
|
|
41
|
+
const key = path.resolve(projectPath);
|
|
42
|
+
const configPath = path.join(key, '.harness', 'config.yml');
|
|
43
|
+
|
|
44
|
+
let stat: fs.Stats | undefined;
|
|
45
|
+
try {
|
|
46
|
+
stat = fs.statSync(configPath);
|
|
47
|
+
} catch {
|
|
48
|
+
stat = undefined;
|
|
49
|
+
}
|
|
50
|
+
// 文件缺失,或 stat 不可用(如测试 mock)且文件不存在 → 无配置
|
|
51
|
+
if (!stat?.mtimeMs && !fs.existsSync(configPath)) {
|
|
52
|
+
rawConfigCache.delete(key);
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// stat 指纹可用时走缓存;不可用则每次直读(不缓存,避免脏数据)
|
|
57
|
+
if (stat?.mtimeMs !== undefined) {
|
|
58
|
+
const cached = rawConfigCache.get(key);
|
|
59
|
+
if (cached && cached.mtimeMs === stat.mtimeMs && cached.size === stat.size) {
|
|
60
|
+
return cached.raw;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const loaded = yaml.load(fs.readFileSync(configPath, 'utf-8')) ?? {};
|
|
65
|
+
const raw = loaded as Record<string, unknown>;
|
|
66
|
+
if (stat?.mtimeMs !== undefined) {
|
|
67
|
+
rawConfigCache.set(key, { mtimeMs: stat.mtimeMs, size: stat.size, raw });
|
|
68
|
+
}
|
|
69
|
+
return raw;
|
|
70
|
+
}
|
|
71
|
+
|
|
27
72
|
/**
|
|
28
73
|
* 项目配置加载器
|
|
29
74
|
*/
|
|
@@ -42,12 +87,10 @@ export class ProjectConfigLoader {
|
|
|
42
87
|
* 加载项目配置
|
|
43
88
|
*/
|
|
44
89
|
load(): ProjectConfig {
|
|
45
|
-
// 1.
|
|
46
|
-
const
|
|
47
|
-
if (
|
|
48
|
-
|
|
49
|
-
const loaded = yaml.load(content) as ProjectConfig;
|
|
50
|
-
this.config = { ...DEFAULT_CONFIG, ...loaded };
|
|
90
|
+
// 1. 加载主配置(经进程级 memoize,避免重复 yaml 解析)
|
|
91
|
+
const raw = loadRawProjectConfig(this.projectPath);
|
|
92
|
+
if (raw) {
|
|
93
|
+
this.config = { ...DEFAULT_CONFIG, ...(raw as Partial<ProjectConfig>) };
|
|
51
94
|
}
|
|
52
95
|
|
|
53
96
|
// 2. 加载自定义约束
|
|
@@ -243,10 +286,3 @@ export class ProjectConfigLoader {
|
|
|
243
286
|
);
|
|
244
287
|
}
|
|
245
288
|
}
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* 创建项目配置加载器
|
|
249
|
-
*/
|
|
250
|
-
export function createProjectConfigLoader(projectPath?: string): ProjectConfigLoader {
|
|
251
|
-
return new ProjectConfigLoader(projectPath);
|
|
252
|
-
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 检查点 command_* 族处理器(工单 23)
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { execAsync } from '../../../utils/exec';
|
|
6
|
+
import type { CheckpointCheck, CheckResult, CheckpointContext } from '../../../types/checkpoint';
|
|
7
|
+
|
|
8
|
+
export async function checkCommandSuccess(check: CheckpointCheck, context: CheckpointContext): Promise<CheckResult> {
|
|
9
|
+
const command = check.config.command || '';
|
|
10
|
+
|
|
11
|
+
try {
|
|
12
|
+
const { stdout } = await execAsync(command, { cwd: context.workdir });
|
|
13
|
+
return {
|
|
14
|
+
checkId: check.id,
|
|
15
|
+
passed: true,
|
|
16
|
+
message: `命令执行成功: ${command}`,
|
|
17
|
+
actual: stdout.trim(),
|
|
18
|
+
expected: 'exit code 0',
|
|
19
|
+
};
|
|
20
|
+
} catch (error: any) {
|
|
21
|
+
return {
|
|
22
|
+
checkId: check.id,
|
|
23
|
+
passed: false,
|
|
24
|
+
message: `命令执行失败: ${command}`,
|
|
25
|
+
actual: error.message,
|
|
26
|
+
expected: 'exit code 0',
|
|
27
|
+
error: error.message,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export async function checkCommandOutput(check: CheckpointCheck, context: CheckpointContext): Promise<CheckResult> {
|
|
33
|
+
const command = check.config.command || '';
|
|
34
|
+
const expected = String(check.config.expected || '');
|
|
35
|
+
|
|
36
|
+
try {
|
|
37
|
+
const { stdout } = await execAsync(command, { cwd: context.workdir });
|
|
38
|
+
const actual = stdout.trim();
|
|
39
|
+
const matches = actual.includes(expected);
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
checkId: check.id,
|
|
43
|
+
passed: matches,
|
|
44
|
+
message: matches ? `命令输出匹配: ${expected}` : `命令输出不匹配: ${expected}`,
|
|
45
|
+
actual,
|
|
46
|
+
expected,
|
|
47
|
+
};
|
|
48
|
+
} catch (error: any) {
|
|
49
|
+
return {
|
|
50
|
+
checkId: check.id,
|
|
51
|
+
passed: false,
|
|
52
|
+
message: `命令执行失败: ${command}`,
|
|
53
|
+
actual: error.message,
|
|
54
|
+
expected,
|
|
55
|
+
error: error.message,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 检查点 file_* 族处理器(工单 23)
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as fs from 'fs';
|
|
6
|
+
import * as path from 'path';
|
|
7
|
+
import type { CheckpointCheck, CheckResult, CheckpointContext } from '../../../types/checkpoint';
|
|
8
|
+
|
|
9
|
+
export function resolvePath(relativePath: string, workdir: string): string {
|
|
10
|
+
if (path.isAbsolute(relativePath)) {
|
|
11
|
+
return relativePath;
|
|
12
|
+
}
|
|
13
|
+
return path.join(workdir, relativePath);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export async function checkFileExists(check: CheckpointCheck, context: CheckpointContext): Promise<CheckResult> {
|
|
17
|
+
const filePath = resolvePath(check.config.path || '', context.workdir);
|
|
18
|
+
const exists = fs.existsSync(filePath);
|
|
19
|
+
|
|
20
|
+
return {
|
|
21
|
+
checkId: check.id,
|
|
22
|
+
passed: exists,
|
|
23
|
+
message: exists ? `文件存在: ${filePath}` : `文件不存在: ${filePath}`,
|
|
24
|
+
actual: exists,
|
|
25
|
+
expected: true,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export async function checkFileNotEmpty(check: CheckpointCheck, context: CheckpointContext): Promise<CheckResult> {
|
|
30
|
+
const filePath = resolvePath(check.config.path || '', context.workdir);
|
|
31
|
+
|
|
32
|
+
if (!fs.existsSync(filePath)) {
|
|
33
|
+
return {
|
|
34
|
+
checkId: check.id,
|
|
35
|
+
passed: false,
|
|
36
|
+
message: `文件不存在: ${filePath}`,
|
|
37
|
+
actual: false,
|
|
38
|
+
expected: true,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const stats = fs.statSync(filePath);
|
|
43
|
+
const notEmpty = stats.size > 0;
|
|
44
|
+
|
|
45
|
+
return {
|
|
46
|
+
checkId: check.id,
|
|
47
|
+
passed: notEmpty,
|
|
48
|
+
message: notEmpty ? `文件非空: ${filePath}` : `文件为空: ${filePath}`,
|
|
49
|
+
actual: stats.size,
|
|
50
|
+
expected: '> 0',
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export async function checkFileContains(check: CheckpointCheck, context: CheckpointContext): Promise<CheckResult> {
|
|
55
|
+
const filePath = resolvePath(check.config.path || '', context.workdir);
|
|
56
|
+
const content = check.config.content || '';
|
|
57
|
+
|
|
58
|
+
if (!fs.existsSync(filePath)) {
|
|
59
|
+
return {
|
|
60
|
+
checkId: check.id,
|
|
61
|
+
passed: false,
|
|
62
|
+
message: `文件不存在: ${filePath}`,
|
|
63
|
+
actual: null,
|
|
64
|
+
expected: content,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const fileContent = fs.readFileSync(filePath, 'utf-8');
|
|
69
|
+
const contains = fileContent.includes(content);
|
|
70
|
+
|
|
71
|
+
return {
|
|
72
|
+
checkId: check.id,
|
|
73
|
+
passed: contains,
|
|
74
|
+
message: contains ? `文件包含内容: ${content}` : `文件不包含内容: ${content}`,
|
|
75
|
+
actual: contains,
|
|
76
|
+
expected: true,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export async function checkFileNotContains(check: CheckpointCheck, context: CheckpointContext): Promise<CheckResult> {
|
|
81
|
+
const filePath = resolvePath(check.config.path || '', context.workdir);
|
|
82
|
+
const content = check.config.content || '';
|
|
83
|
+
|
|
84
|
+
if (!fs.existsSync(filePath)) {
|
|
85
|
+
return {
|
|
86
|
+
checkId: check.id,
|
|
87
|
+
passed: false,
|
|
88
|
+
message: `文件不存在: ${filePath}`,
|
|
89
|
+
actual: null,
|
|
90
|
+
expected: `不包含: ${content}`,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const fileContent = fs.readFileSync(filePath, 'utf-8');
|
|
95
|
+
const notContains = !fileContent.includes(content);
|
|
96
|
+
|
|
97
|
+
return {
|
|
98
|
+
checkId: check.id,
|
|
99
|
+
passed: notContains,
|
|
100
|
+
message: notContains ? `文件不包含内容: ${content}` : `文件包含内容: ${content}`,
|
|
101
|
+
actual: !notContains,
|
|
102
|
+
expected: false,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 检查点 http_* 族处理器(工单 23)
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { CheckpointCheck, CheckResult, CheckpointContext } from '../../../types/checkpoint';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* HTTP 调用重试(处理 httpbin rate-limit 503/429)
|
|
9
|
+
*/
|
|
10
|
+
async function fetchWithRetry(url: string, init?: RequestInit, retries = 3): Promise<Response> {
|
|
11
|
+
let lastError: unknown;
|
|
12
|
+
for (let i = 0; i <= retries; i++) {
|
|
13
|
+
try {
|
|
14
|
+
const response = await fetch(url, init);
|
|
15
|
+
// 5xx / 429 → 重试,指数退避
|
|
16
|
+
if (!response.ok && i < retries && (response.status >= 500 || response.status === 429)) {
|
|
17
|
+
await new Promise(r => setTimeout(r, 2000 * (i + 1)));
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
return response;
|
|
21
|
+
} catch (e) {
|
|
22
|
+
lastError = e;
|
|
23
|
+
if (i < retries) await new Promise(r => setTimeout(r, 2000 * (i + 1)));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
throw lastError;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export async function checkHttpStatus(check: CheckpointCheck, _context: CheckpointContext): Promise<CheckResult> {
|
|
30
|
+
const url = check.config.url || '';
|
|
31
|
+
const expected = check.config.expectedStatus || check.config.expected || 200;
|
|
32
|
+
|
|
33
|
+
try {
|
|
34
|
+
const response = await fetchWithRetry(url, { signal: AbortSignal.timeout(10000) });
|
|
35
|
+
const actual = response.status;
|
|
36
|
+
const matches = actual === expected;
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
checkId: check.id,
|
|
40
|
+
passed: matches,
|
|
41
|
+
message: matches ? `HTTP 状态码匹配: ${expected}` : `HTTP 状态码不匹配: ${actual} != ${expected}`,
|
|
42
|
+
actual,
|
|
43
|
+
expected,
|
|
44
|
+
};
|
|
45
|
+
} catch (error: any) {
|
|
46
|
+
return {
|
|
47
|
+
checkId: check.id,
|
|
48
|
+
passed: false,
|
|
49
|
+
message: `HTTP 请求失败: ${url}`,
|
|
50
|
+
actual: error.message,
|
|
51
|
+
expected,
|
|
52
|
+
error: error.message,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export async function checkHttpBody(check: CheckpointCheck, _context: CheckpointContext): Promise<CheckResult> {
|
|
58
|
+
const url = check.config.url || '';
|
|
59
|
+
const expected = String(check.config.expected || '');
|
|
60
|
+
|
|
61
|
+
try {
|
|
62
|
+
const response = await fetchWithRetry(url, {
|
|
63
|
+
method: check.config.method || 'GET',
|
|
64
|
+
headers: check.config.headers,
|
|
65
|
+
body: check.config.body ? JSON.stringify(check.config.body) : undefined,
|
|
66
|
+
signal: AbortSignal.timeout(10000),
|
|
67
|
+
});
|
|
68
|
+
const actual = await response.text();
|
|
69
|
+
const contains = actual.includes(expected);
|
|
70
|
+
|
|
71
|
+
return {
|
|
72
|
+
checkId: check.id,
|
|
73
|
+
passed: contains,
|
|
74
|
+
message: contains ? `HTTP 响应体包含: ${expected}` : `HTTP 响应体不包含: ${expected}`,
|
|
75
|
+
actual,
|
|
76
|
+
expected,
|
|
77
|
+
};
|
|
78
|
+
} catch (error: any) {
|
|
79
|
+
return {
|
|
80
|
+
checkId: check.id,
|
|
81
|
+
passed: false,
|
|
82
|
+
message: `HTTP 请求失败: ${url}`,
|
|
83
|
+
actual: error.message,
|
|
84
|
+
expected,
|
|
85
|
+
error: error.message,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 检查点 output_* 族处理器(工单 23)
|
|
3
|
+
*
|
|
4
|
+
* 修复(工单 23 / 工单 06 决议):output_* 族此前只读 context.output,
|
|
5
|
+
* 从不执行 config.command——dogfooding 的 no-console 检查点因此形同虚设。
|
|
6
|
+
* 现语义:context.output 已提供则用之;否则执行 config.command 取其 stdout。
|
|
7
|
+
* expected/content 为空串时按「输出应为空」判定('' 恒被 includes 匹配的老 bug 移除)。
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { execAsync } from '../../../utils/exec';
|
|
11
|
+
import type { CheckpointCheck, CheckResult, CheckpointContext } from '../../../types/checkpoint';
|
|
12
|
+
|
|
13
|
+
export function stringifyOutput(output: any): string {
|
|
14
|
+
if (typeof output === 'string') {
|
|
15
|
+
return output;
|
|
16
|
+
}
|
|
17
|
+
if (output === null || output === undefined) {
|
|
18
|
+
return '';
|
|
19
|
+
}
|
|
20
|
+
return JSON.stringify(output);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* 取得待检查的输出:context.output 优先;未提供且配置了 command 时执行之。
|
|
25
|
+
* 返回 [输出文本, 命令执行错误(若有)]
|
|
26
|
+
*/
|
|
27
|
+
async function resolveOutput(
|
|
28
|
+
check: CheckpointCheck,
|
|
29
|
+
context: CheckpointContext
|
|
30
|
+
): Promise<{ output: string; commandError?: string }> {
|
|
31
|
+
if (context.output !== undefined && context.output !== null) {
|
|
32
|
+
return { output: stringifyOutput(context.output) };
|
|
33
|
+
}
|
|
34
|
+
const command = check.config.command;
|
|
35
|
+
if (typeof command === 'string' && command.length > 0) {
|
|
36
|
+
try {
|
|
37
|
+
const { stdout } = await execAsync(command, { cwd: context.workdir });
|
|
38
|
+
return { output: stdout };
|
|
39
|
+
} catch (error: any) {
|
|
40
|
+
return { output: '', commandError: error.message };
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return { output: '' };
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export async function checkOutputContains(check: CheckpointCheck, context: CheckpointContext): Promise<CheckResult> {
|
|
47
|
+
const { output, commandError } = await resolveOutput(check, context);
|
|
48
|
+
if (commandError) {
|
|
49
|
+
return {
|
|
50
|
+
checkId: check.id,
|
|
51
|
+
passed: false,
|
|
52
|
+
message: `命令执行失败: ${check.config.command}`,
|
|
53
|
+
actual: commandError,
|
|
54
|
+
expected: 'exit code 0',
|
|
55
|
+
error: commandError,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const content = check.config.content || String(check.config.expected || '');
|
|
60
|
+
// 空内容恒真(包含空串无意义)
|
|
61
|
+
const contains = content === '' ? true : output.includes(content);
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
checkId: check.id,
|
|
65
|
+
passed: contains,
|
|
66
|
+
message: contains ? `输出包含内容: ${content}` : `输出不包含内容: ${content}`,
|
|
67
|
+
actual: contains,
|
|
68
|
+
expected: true,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export async function checkOutputNotContains(check: CheckpointCheck, context: CheckpointContext): Promise<CheckResult> {
|
|
73
|
+
const { output, commandError } = await resolveOutput(check, context);
|
|
74
|
+
if (commandError) {
|
|
75
|
+
return {
|
|
76
|
+
checkId: check.id,
|
|
77
|
+
passed: false,
|
|
78
|
+
message: `命令执行失败: ${check.config.command}`,
|
|
79
|
+
actual: commandError,
|
|
80
|
+
expected: 'exit code 0',
|
|
81
|
+
error: commandError,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const content = check.config.content || String(check.config.expected || '');
|
|
86
|
+
// 空内容 → 语义为「输出应为空」(修复 '' 恒被 includes 匹配的老 bug)
|
|
87
|
+
const notContains = content === '' ? output.trim().length === 0 : !output.includes(content);
|
|
88
|
+
|
|
89
|
+
return {
|
|
90
|
+
checkId: check.id,
|
|
91
|
+
passed: notContains,
|
|
92
|
+
message: notContains ? `输出不包含内容: ${content}` : `输出包含内容: ${content}`,
|
|
93
|
+
actual: !notContains,
|
|
94
|
+
expected: false,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export async function checkOutputMatches(check: CheckpointCheck, context: CheckpointContext): Promise<CheckResult> {
|
|
99
|
+
const { output, commandError } = await resolveOutput(check, context);
|
|
100
|
+
if (commandError) {
|
|
101
|
+
return {
|
|
102
|
+
checkId: check.id,
|
|
103
|
+
passed: false,
|
|
104
|
+
message: `命令执行失败: ${check.config.command}`,
|
|
105
|
+
actual: commandError,
|
|
106
|
+
expected: 'exit code 0',
|
|
107
|
+
error: commandError,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const pattern = check.config.pattern || '';
|
|
112
|
+
const regex = new RegExp(pattern, 'gm');
|
|
113
|
+
const matches = regex.test(output);
|
|
114
|
+
|
|
115
|
+
return {
|
|
116
|
+
checkId: check.id,
|
|
117
|
+
passed: matches,
|
|
118
|
+
message: matches ? `输出匹配正则: ${pattern}` : `输出不匹配正则: ${pattern}`,
|
|
119
|
+
actual: matches,
|
|
120
|
+
expected: true,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export async function checkJsonPath(check: CheckpointCheck, context: CheckpointContext): Promise<CheckResult> {
|
|
125
|
+
const jsonPath = check.config.jsonPath || '';
|
|
126
|
+
const expected = check.config.expected;
|
|
127
|
+
|
|
128
|
+
let actual: any;
|
|
129
|
+
try {
|
|
130
|
+
actual = getJsonValue(context.output, jsonPath);
|
|
131
|
+
} catch (error) {
|
|
132
|
+
return {
|
|
133
|
+
checkId: check.id,
|
|
134
|
+
passed: false,
|
|
135
|
+
message: `JSON 路径无效: ${jsonPath}`,
|
|
136
|
+
actual: null,
|
|
137
|
+
expected,
|
|
138
|
+
error: (error as Error).message,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const matches = JSON.stringify(actual) === JSON.stringify(expected);
|
|
143
|
+
|
|
144
|
+
return {
|
|
145
|
+
checkId: check.id,
|
|
146
|
+
passed: matches,
|
|
147
|
+
message: matches ? `JSON 路径匹配: ${jsonPath}` : `JSON 路径不匹配: ${jsonPath}`,
|
|
148
|
+
actual,
|
|
149
|
+
expected,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function getJsonValue(obj: any, jsonPath: string): any {
|
|
154
|
+
const parts = jsonPath.split('.');
|
|
155
|
+
let current = obj;
|
|
156
|
+
|
|
157
|
+
for (const part of parts) {
|
|
158
|
+
if (current === null || current === undefined) {
|
|
159
|
+
return undefined;
|
|
160
|
+
}
|
|
161
|
+
current = current[part];
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return current;
|
|
165
|
+
}
|