@dommaker/harness 0.16.6 → 0.16.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/README.md +54 -14
- package/bin/harness.js +56 -96
- package/dist/architecture/constraint-engine.d.ts.map +1 -1
- package/dist/architecture/constraint-engine.js +0 -4
- package/dist/architecture/constraint-engine.js.map +1 -1
- package/dist/architecture/cross-project-checker.d.ts.map +1 -1
- package/dist/architecture/cross-project-checker.js +5 -25
- package/dist/architecture/cross-project-checker.js.map +1 -1
- package/dist/cli/commands/analyze-sessions.d.ts +2 -0
- package/dist/cli/commands/analyze-sessions.d.ts.map +1 -1
- package/dist/cli/commands/analyze-sessions.js +25 -181
- package/dist/cli/commands/analyze-sessions.js.map +1 -1
- package/dist/cli/commands/check.d.ts +1 -0
- package/dist/cli/commands/check.d.ts.map +1 -1
- package/dist/cli/commands/check.js +24 -216
- package/dist/cli/commands/check.js.map +1 -1
- package/dist/cli/commands/doc-freshness-check.d.ts.map +1 -1
- package/dist/cli/commands/doc-freshness-check.js +14 -28
- package/dist/cli/commands/doc-freshness-check.js.map +1 -1
- package/dist/cli/commands/flow.d.ts.map +1 -1
- package/dist/cli/commands/flow.js +2 -1
- package/dist/cli/commands/flow.js.map +1 -1
- package/dist/cli/commands/init.js +2 -2
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/posteval-plan.d.ts.map +1 -1
- package/dist/cli/commands/posteval-plan.js +0 -1
- package/dist/cli/commands/posteval-plan.js.map +1 -1
- package/dist/cli/commands/release.js +1 -1
- package/dist/cli/commands/release.js.map +1 -1
- package/dist/cli/commands/report.d.ts.map +1 -1
- package/dist/cli/commands/report.js +2 -0
- package/dist/cli/commands/report.js.map +1 -1
- package/dist/cli/commands/spec-baseline-check.d.ts.map +1 -1
- package/dist/cli/commands/spec-baseline-check.js +12 -23
- package/dist/cli/commands/spec-baseline-check.js.map +1 -1
- package/dist/cli/commands/sync-docs/agents-syncer.d.ts +19 -0
- package/dist/cli/commands/sync-docs/agents-syncer.d.ts.map +1 -0
- package/dist/cli/commands/sync-docs/agents-syncer.js +288 -0
- package/dist/cli/commands/sync-docs/agents-syncer.js.map +1 -0
- package/dist/cli/commands/sync-docs/capabilities-syncer.d.ts +37 -0
- package/dist/cli/commands/sync-docs/capabilities-syncer.d.ts.map +1 -0
- package/dist/cli/commands/sync-docs/capabilities-syncer.js +235 -0
- package/dist/cli/commands/sync-docs/capabilities-syncer.js.map +1 -0
- package/dist/cli/commands/sync-docs/context-syncer.d.ts +17 -0
- package/dist/cli/commands/sync-docs/context-syncer.d.ts.map +1 -0
- package/dist/cli/commands/sync-docs/context-syncer.js +143 -0
- package/dist/cli/commands/sync-docs/context-syncer.js.map +1 -0
- package/dist/cli/commands/{sync-docs.d.ts → sync-docs/index.d.ts} +9 -2
- package/dist/cli/commands/sync-docs/index.d.ts.map +1 -0
- package/dist/cli/commands/sync-docs/index.js +338 -0
- package/dist/cli/commands/sync-docs/index.js.map +1 -0
- package/dist/cli/commands/sync-docs/preserve-block.d.ts +24 -0
- package/dist/cli/commands/sync-docs/preserve-block.d.ts.map +1 -0
- package/dist/cli/commands/sync-docs/preserve-block.js +55 -0
- package/dist/cli/commands/sync-docs/preserve-block.js.map +1 -0
- package/dist/cli/commands/sync-docs/project-reader.d.ts +41 -0
- package/dist/cli/commands/sync-docs/project-reader.d.ts.map +1 -0
- package/dist/cli/commands/sync-docs/project-reader.js +183 -0
- package/dist/cli/commands/sync-docs/project-reader.js.map +1 -0
- package/dist/cli/commands/update-user-model.d.ts +2 -0
- package/dist/cli/commands/update-user-model.d.ts.map +1 -1
- package/dist/cli/commands/update-user-model.js +19 -90
- package/dist/cli/commands/update-user-model.js.map +1 -1
- package/dist/cli/commands/validate.d.ts +3 -0
- package/dist/cli/commands/validate.d.ts.map +1 -1
- package/dist/cli/commands/validate.js +6 -39
- package/dist/cli/commands/validate.js.map +1 -1
- package/dist/cli/session-mining/corrections.d.ts +17 -0
- package/dist/cli/session-mining/corrections.d.ts.map +1 -0
- package/dist/cli/session-mining/corrections.js +58 -0
- package/dist/cli/session-mining/corrections.js.map +1 -0
- package/dist/cli/session-mining/index.d.ts +13 -0
- package/dist/cli/session-mining/index.d.ts.map +1 -0
- package/dist/{core/spec → cli/session-mining}/index.js +9 -3
- package/dist/cli/session-mining/index.js.map +1 -0
- package/dist/cli/session-mining/text.d.ts +31 -0
- package/dist/cli/session-mining/text.d.ts.map +1 -0
- package/dist/cli/session-mining/text.js +126 -0
- package/dist/cli/session-mining/text.js.map +1 -0
- package/dist/cli/session-mining/transcript.d.ts +28 -0
- package/dist/cli/session-mining/transcript.d.ts.map +1 -0
- package/dist/cli/session-mining/transcript.js +123 -0
- package/dist/cli/session-mining/transcript.js.map +1 -0
- package/dist/constraints/lifecycle-runner.d.ts +1 -1
- package/dist/constraints/lifecycle-runner.d.ts.map +1 -1
- package/dist/context/compaction.d.ts.map +1 -1
- package/dist/context/compaction.js +2 -3
- package/dist/context/compaction.js.map +1 -1
- package/dist/context/knowledge-injector.d.ts.map +1 -1
- package/dist/context/tool-output-budget.d.ts +1 -1
- package/dist/context/tool-output-budget.d.ts.map +1 -1
- package/dist/context/tool-output-budget.js +1 -1
- package/dist/context/tool-output-budget.js.map +1 -1
- package/dist/core/constraints/capabilities-parser.d.ts +24 -0
- package/dist/core/constraints/capabilities-parser.d.ts.map +1 -0
- package/dist/core/constraints/capabilities-parser.js +95 -0
- package/dist/core/constraints/capabilities-parser.js.map +1 -0
- package/dist/core/constraints/checker.d.ts +37 -100
- package/dist/core/constraints/checker.d.ts.map +1 -1
- package/dist/core/constraints/checker.js +150 -737
- package/dist/core/constraints/checker.js.map +1 -1
- package/dist/core/constraints/checkers/always-pass.d.ts +17 -0
- package/dist/core/constraints/checkers/always-pass.d.ts.map +1 -0
- package/dist/core/constraints/checkers/always-pass.js +23 -0
- package/dist/core/constraints/checkers/always-pass.js.map +1 -0
- package/dist/core/constraints/checkers/capability-sync.d.ts +10 -0
- package/dist/core/constraints/checkers/capability-sync.d.ts.map +1 -0
- package/dist/core/constraints/checkers/capability-sync.js +60 -0
- package/dist/core/constraints/checkers/capability-sync.js.map +1 -0
- package/dist/core/constraints/checkers/context-doc-sync.d.ts +6 -0
- package/dist/core/constraints/checkers/context-doc-sync.d.ts.map +1 -0
- package/dist/core/constraints/checkers/context-doc-sync.js +35 -0
- package/dist/core/constraints/checkers/context-doc-sync.js.map +1 -0
- package/dist/core/constraints/checkers/docs-freshness.d.ts +10 -0
- package/dist/core/constraints/checkers/docs-freshness.d.ts.map +1 -0
- package/dist/core/constraints/checkers/docs-freshness.js +111 -0
- package/dist/core/constraints/checkers/docs-freshness.js.map +1 -0
- package/dist/core/constraints/checkers/guideline-flags.d.ts +9 -0
- package/dist/core/constraints/checkers/guideline-flags.d.ts.map +1 -0
- package/dist/core/constraints/checkers/guideline-flags.js +13 -0
- package/dist/core/constraints/checkers/guideline-flags.js.map +1 -0
- package/dist/core/constraints/checkers/index.d.ts +17 -0
- package/dist/core/constraints/checkers/index.d.ts.map +1 -0
- package/dist/core/constraints/checkers/index.js +82 -0
- package/dist/core/constraints/checkers/index.js.map +1 -0
- package/dist/core/constraints/checkers/iron-flags.d.ts +14 -0
- package/dist/core/constraints/checkers/iron-flags.d.ts.map +1 -0
- package/dist/core/constraints/checkers/iron-flags.js +24 -0
- package/dist/core/constraints/checkers/iron-flags.js.map +1 -0
- package/dist/core/constraints/checkers/no-any-type.d.ts +6 -0
- package/dist/core/constraints/checkers/no-any-type.d.ts.map +1 -0
- package/dist/core/constraints/checkers/no-any-type.js +42 -0
- package/dist/core/constraints/checkers/no-any-type.js.map +1 -0
- package/dist/core/constraints/checkers/no-bypass-checkpoint.d.ts +6 -0
- package/dist/core/constraints/checkers/no-bypass-checkpoint.d.ts.map +1 -0
- package/dist/core/constraints/checkers/no-bypass-checkpoint.js +40 -0
- package/dist/core/constraints/checkers/no-bypass-checkpoint.js.map +1 -0
- package/dist/core/constraints/checkers/no-excuse-patterns.d.ts +6 -0
- package/dist/core/constraints/checkers/no-excuse-patterns.d.ts.map +1 -0
- package/dist/core/constraints/checkers/no-excuse-patterns.js +25 -0
- package/dist/core/constraints/checkers/no-excuse-patterns.js.map +1 -0
- package/dist/core/constraints/checkers/no-fuzzy-completion-claim.d.ts +6 -0
- package/dist/core/constraints/checkers/no-fuzzy-completion-claim.d.ts.map +1 -0
- package/dist/core/constraints/checkers/no-fuzzy-completion-claim.js +34 -0
- package/dist/core/constraints/checkers/no-fuzzy-completion-claim.js.map +1 -0
- package/dist/core/constraints/checkers/no-performative-agreement.d.ts +8 -0
- package/dist/core/constraints/checkers/no-performative-agreement.d.ts.map +1 -0
- package/dist/core/constraints/checkers/no-performative-agreement.js +23 -0
- package/dist/core/constraints/checkers/no-performative-agreement.js.map +1 -0
- package/dist/core/constraints/checkers/no-simplification-without-approval.d.ts +6 -0
- package/dist/core/constraints/checkers/no-simplification-without-approval.d.ts.map +1 -0
- package/dist/core/constraints/checkers/no-simplification-without-approval.js +30 -0
- package/dist/core/constraints/checkers/no-simplification-without-approval.js.map +1 -0
- package/dist/core/constraints/checkers/no-test-simplification.d.ts +6 -0
- package/dist/core/constraints/checkers/no-test-simplification.d.ts.map +1 -0
- package/dist/core/constraints/checkers/no-test-simplification.js +29 -0
- package/dist/core/constraints/checkers/no-test-simplification.js.map +1 -0
- package/dist/core/constraints/checkers/test-coverage.d.ts +6 -0
- package/dist/core/constraints/checkers/test-coverage.d.ts.map +1 -0
- package/dist/core/constraints/checkers/test-coverage.js +33 -0
- package/dist/core/constraints/checkers/test-coverage.js.map +1 -0
- package/dist/core/constraints/checkers/types.d.ts +43 -0
- package/dist/core/constraints/checkers/types.d.ts.map +1 -0
- package/dist/core/constraints/checkers/types.js +23 -0
- package/dist/core/constraints/checkers/types.js.map +1 -0
- package/dist/core/constraints/checkers/yagni.d.ts +8 -0
- package/dist/core/constraints/checkers/yagni.d.ts.map +1 -0
- package/dist/core/constraints/checkers/yagni.js +96 -0
- package/dist/core/constraints/checkers/yagni.js.map +1 -0
- package/dist/core/constraints/context-builder.d.ts +67 -0
- package/dist/core/constraints/context-builder.d.ts.map +1 -0
- package/dist/core/constraints/context-builder.js +294 -0
- package/dist/core/constraints/context-builder.js.map +1 -0
- package/dist/core/constraints/definitions/guidelines.d.ts +7 -0
- package/dist/core/constraints/definitions/guidelines.d.ts.map +1 -0
- package/dist/core/constraints/definitions/guidelines.js +641 -0
- package/dist/core/constraints/definitions/guidelines.js.map +1 -0
- package/dist/core/constraints/definitions/iron-laws.d.ts +7 -0
- package/dist/core/constraints/definitions/iron-laws.d.ts.map +1 -0
- package/dist/core/constraints/definitions/iron-laws.js +322 -0
- package/dist/core/constraints/definitions/iron-laws.js.map +1 -0
- package/dist/core/constraints/definitions/tips.d.ts +7 -0
- package/dist/core/constraints/definitions/tips.d.ts.map +1 -0
- package/dist/core/constraints/definitions/tips.js +62 -0
- package/dist/core/constraints/definitions/tips.js.map +1 -0
- package/dist/core/constraints/definitions.d.ts +8 -21
- package/dist/core/constraints/definitions.d.ts.map +1 -1
- package/dist/core/constraints/definitions.js +15 -1048
- package/dist/core/constraints/definitions.js.map +1 -1
- package/dist/core/constraints/doc-freshness/runner.d.ts.map +1 -1
- package/dist/core/constraints/doc-freshness/runner.js +0 -1
- package/dist/core/constraints/doc-freshness/runner.js.map +1 -1
- package/dist/core/constraints/index.d.ts +4 -5
- package/dist/core/constraints/index.d.ts.map +1 -1
- package/dist/core/constraints/index.js +1 -16
- package/dist/core/constraints/index.js.map +1 -1
- package/dist/core/constraints/interceptor.d.ts.map +1 -1
- package/dist/core/constraints/interceptor.js.map +1 -1
- package/dist/core/index.js +0 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/project-config-loader.d.ts +6 -4
- package/dist/core/project-config-loader.d.ts.map +1 -1
- package/dist/core/project-config-loader.js +46 -13
- package/dist/core/project-config-loader.js.map +1 -1
- package/dist/core/validators/check-handlers/command.d.ts +7 -0
- package/dist/core/validators/check-handlers/command.d.ts.map +1 -0
- package/dist/core/validators/check-handlers/command.js +58 -0
- package/dist/core/validators/check-handlers/command.js.map +1 -0
- package/dist/core/validators/check-handlers/file.d.ts +10 -0
- package/dist/core/validators/check-handlers/file.d.ts.map +1 -0
- package/dist/core/validators/check-handlers/file.js +128 -0
- package/dist/core/validators/check-handlers/file.js.map +1 -0
- package/dist/core/validators/check-handlers/http.d.ts +7 -0
- package/dist/core/validators/check-handlers/http.d.ts.map +1 -0
- package/dist/core/validators/check-handlers/http.js +88 -0
- package/dist/core/validators/check-handlers/http.js.map +1 -0
- package/dist/core/validators/check-handlers/output.d.ts +15 -0
- package/dist/core/validators/check-handlers/output.d.ts.map +1 -0
- package/dist/core/validators/check-handlers/output.js +152 -0
- package/dist/core/validators/check-handlers/output.js.map +1 -0
- package/dist/core/validators/checkpoint.d.ts +4 -72
- package/dist/core/validators/checkpoint.d.ts.map +1 -1
- package/dist/core/validators/checkpoint.js +21 -400
- package/dist/core/validators/checkpoint.js.map +1 -1
- package/dist/core/validators/cso.js +1 -1
- package/dist/core/validators/cso.js.map +1 -1
- package/dist/core/validators/passes-gate.js +2 -2
- package/dist/core/validators/passes-gate.js.map +1 -1
- package/dist/dashboard/stats.d.ts.map +1 -1
- package/dist/dashboard/types.d.ts.map +1 -1
- package/dist/evolution/auto-evolve.d.ts +1 -2
- package/dist/evolution/auto-evolve.d.ts.map +1 -1
- package/dist/evolution/auto-evolve.js +2 -1
- package/dist/evolution/auto-evolve.js.map +1 -1
- package/dist/failure/types.d.ts +5 -85
- package/dist/failure/types.d.ts.map +1 -1
- package/dist/failure/types.js +19 -115
- package/dist/failure/types.js.map +1 -1
- package/dist/gates/contract.d.ts.map +1 -1
- package/dist/gates/contract.js.map +1 -1
- package/dist/gates/index.d.ts.map +1 -1
- package/dist/gates/index.js.map +1 -1
- package/dist/gates/performance.js +1 -1
- package/dist/gates/performance.js.map +1 -1
- package/dist/gates/security.d.ts.map +1 -1
- package/dist/gates/security.js +1 -1
- package/dist/gates/security.js.map +1 -1
- package/dist/hooks/bootstrap.d.ts.map +1 -1
- package/dist/hooks/bootstrap.js +6 -48
- package/dist/hooks/bootstrap.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/knowledge/audit.d.ts.map +1 -1
- package/dist/knowledge/doctor.d.ts.map +1 -1
- package/dist/knowledge/doctor.js.map +1 -1
- package/dist/knowledge/import.d.ts.map +1 -1
- package/dist/knowledge/import.js +1 -1
- package/dist/knowledge/import.js.map +1 -1
- package/dist/knowledge/index-generator.d.ts.map +1 -1
- package/dist/knowledge/index-generator.js +0 -1
- package/dist/knowledge/index-generator.js.map +1 -1
- package/dist/knowledge/ingest.d.ts.map +1 -1
- package/dist/knowledge/ingest.js +1 -1
- package/dist/knowledge/ingest.js.map +1 -1
- package/dist/knowledge/lint.d.ts +1 -1
- package/dist/knowledge/lint.d.ts.map +1 -1
- package/dist/knowledge/lint.js +2 -2
- package/dist/knowledge/lint.js.map +1 -1
- package/dist/knowledge/primitives/code-structure.d.ts.map +1 -1
- package/dist/knowledge/primitives/code-structure.js +29 -12
- package/dist/knowledge/primitives/code-structure.js.map +1 -1
- package/dist/knowledge/query.d.ts.map +1 -1
- package/dist/knowledge/query.js.map +1 -1
- package/dist/knowledge/store.d.ts.map +1 -1
- package/dist/llm/adapter.d.ts +3 -3
- package/dist/llm/adapter.d.ts.map +1 -1
- package/dist/llm/adapter.js +3 -3
- package/dist/llm/adapter.js.map +1 -1
- package/dist/monitoring/analyzer-base.d.ts +50 -0
- package/dist/monitoring/analyzer-base.d.ts.map +1 -0
- package/dist/monitoring/analyzer-base.js +146 -0
- package/dist/monitoring/analyzer-base.js.map +1 -0
- package/dist/monitoring/constraint-doctor.d.ts +3 -46
- package/dist/monitoring/constraint-doctor.d.ts.map +1 -1
- package/dist/monitoring/constraint-doctor.js +11 -113
- package/dist/monitoring/constraint-doctor.js.map +1 -1
- package/dist/monitoring/constraint-evolver.d.ts +9 -63
- package/dist/monitoring/constraint-evolver.d.ts.map +1 -1
- package/dist/monitoring/constraint-evolver.js +8 -10
- package/dist/monitoring/constraint-evolver.js.map +1 -1
- package/dist/monitoring/diagnosis-rules.d.ts +18 -0
- package/dist/monitoring/diagnosis-rules.d.ts.map +1 -0
- package/dist/monitoring/diagnosis-rules.js +119 -0
- package/dist/monitoring/diagnosis-rules.js.map +1 -0
- package/dist/monitoring/knowledge-doctor.d.ts.map +1 -1
- package/dist/monitoring/knowledge-doctor.js.map +1 -1
- package/dist/monitoring/performance-analyzer.d.ts +0 -12
- package/dist/monitoring/performance-analyzer.d.ts.map +1 -1
- package/dist/monitoring/performance-analyzer.js +13 -93
- package/dist/monitoring/performance-analyzer.js.map +1 -1
- package/dist/monitoring/performance-collector.d.ts +0 -8
- package/dist/monitoring/performance-collector.d.ts.map +1 -1
- package/dist/monitoring/performance-collector.js +0 -21
- package/dist/monitoring/performance-collector.js.map +1 -1
- package/dist/monitoring/trace-analyzer.d.ts +0 -8
- package/dist/monitoring/trace-analyzer.d.ts.map +1 -1
- package/dist/monitoring/trace-analyzer.js +9 -91
- package/dist/monitoring/trace-analyzer.js.map +1 -1
- package/dist/presets/index.d.ts +1 -1
- package/dist/presets/index.d.ts.map +1 -1
- package/dist/presets/index.js +1 -4
- package/dist/presets/index.js.map +1 -1
- package/dist/presets/standard.d.ts +0 -9
- package/dist/presets/standard.d.ts.map +1 -1
- package/dist/presets/standard.js +1 -16
- package/dist/presets/standard.js.map +1 -1
- package/dist/safety/output-guardrail.d.ts +0 -1
- package/dist/safety/output-guardrail.d.ts.map +1 -1
- package/dist/safety/output-guardrail.js +0 -3
- package/dist/safety/output-guardrail.js.map +1 -1
- package/dist/tools/registry.d.ts.map +1 -1
- package/dist/types/constraint.d.ts +5 -59
- package/dist/types/constraint.d.ts.map +1 -1
- package/dist/types/constraint.js +1 -39
- package/dist/types/constraint.js.map +1 -1
- package/dist/types/failure.d.ts +89 -0
- package/dist/types/failure.d.ts.map +1 -0
- package/dist/types/failure.js +121 -0
- package/dist/types/failure.js.map +1 -0
- package/dist/types/index.d.ts +2 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +7 -6
- package/dist/types/index.js.map +1 -1
- package/dist/types/monitoring-types.d.ts +114 -0
- package/dist/types/monitoring-types.d.ts.map +1 -0
- package/dist/types/monitoring-types.js +10 -0
- package/dist/types/monitoring-types.js.map +1 -0
- package/dist/utils/detect-source-roots.js.map +1 -1
- package/dist/utils/file-walk.d.ts +33 -0
- package/dist/utils/file-walk.d.ts.map +1 -0
- package/dist/utils/file-walk.js +89 -0
- package/dist/utils/file-walk.js.map +1 -0
- package/dist/verification/rules-based.d.ts.map +1 -1
- package/dist/verification/rules-based.js.map +1 -1
- package/package.json +3 -7
- package/src/__tests__/checker-extra.test.ts +0 -30
- package/src/__tests__/checker.test.ts +0 -33
- package/src/__tests__/checkpoint.test.ts +46 -46
- package/src/__tests__/constraint-evolver.test.ts +22 -21
- package/src/__tests__/doctor-evolver.test.ts +3 -3
- package/src/__tests__/iron-laws.test.ts +0 -27
- package/src/__tests__/presets.test.ts +1 -40
- package/src/architecture/constraint-engine.ts +0 -5
- package/src/architecture/cross-project-checker.ts +6 -24
- package/src/cli/commands/__tests__/check.test.ts +3 -1
- package/src/cli/commands/__tests__/sync-docs.test.ts +77 -0
- package/src/cli/commands/__tests__/validate.test.ts +5 -0
- package/src/cli/commands/analyze-sessions.ts +31 -185
- package/src/cli/commands/check.ts +26 -225
- package/src/cli/commands/doc-freshness-check.ts +14 -25
- package/src/cli/commands/flow.ts +5 -3
- package/src/cli/commands/init.ts +3 -3
- package/src/cli/commands/posteval-plan.ts +0 -1
- package/src/cli/commands/release.ts +1 -1
- package/src/cli/commands/report.ts +2 -0
- package/src/cli/commands/spec-baseline-check.ts +12 -19
- package/src/cli/commands/sync-docs/agents-syncer.ts +280 -0
- package/src/cli/commands/sync-docs/capabilities-syncer.ts +229 -0
- package/src/cli/commands/sync-docs/context-syncer.ts +108 -0
- package/src/cli/commands/sync-docs/index.ts +355 -0
- package/src/cli/commands/sync-docs/preserve-block.ts +59 -0
- package/src/cli/commands/sync-docs/project-reader.ts +163 -0
- package/src/cli/commands/update-user-model.ts +23 -87
- package/src/cli/commands/validate.ts +6 -40
- package/src/cli/session-mining/corrections.ts +56 -0
- package/src/cli/session-mining/index.ts +13 -0
- package/src/cli/session-mining/text.ts +117 -0
- package/src/cli/session-mining/transcript.ts +107 -0
- package/src/constraints/__tests__/lifecycle-runner.test.ts +1 -1
- package/src/constraints/lifecycle-runner.ts +1 -1
- package/src/context/compaction.ts +2 -3
- package/src/context/knowledge-injector.ts +1 -1
- package/src/context/tool-output-budget.ts +1 -1
- package/src/core/constraints/capabilities-parser.ts +70 -0
- package/src/core/constraints/checker.ts +170 -779
- package/src/core/constraints/checkers/always-pass.ts +22 -0
- package/src/core/constraints/checkers/capability-sync.ts +71 -0
- package/src/core/constraints/checkers/context-doc-sync.ts +36 -0
- package/src/core/constraints/checkers/docs-freshness.ts +116 -0
- package/src/core/constraints/checkers/guideline-flags.ts +30 -0
- package/src/core/constraints/checkers/index.ts +114 -0
- package/src/core/constraints/checkers/iron-flags.ts +62 -0
- package/src/core/constraints/checkers/no-any-type.ts +42 -0
- package/src/core/constraints/checkers/no-bypass-checkpoint.ts +40 -0
- package/src/core/constraints/checkers/no-excuse-patterns.ts +24 -0
- package/src/core/constraints/checkers/no-fuzzy-completion-claim.ts +33 -0
- package/src/core/constraints/checkers/no-performative-agreement.ts +22 -0
- package/src/core/constraints/checkers/no-simplification-without-approval.ts +29 -0
- package/src/core/constraints/checkers/no-test-simplification.ts +28 -0
- package/src/core/constraints/checkers/test-coverage.ts +35 -0
- package/src/core/constraints/checkers/types.ts +54 -0
- package/src/core/constraints/checkers/yagni.ts +65 -0
- package/src/core/constraints/context-builder.ts +262 -0
- package/src/core/constraints/definitions/guidelines.ts +668 -0
- package/src/core/constraints/definitions/iron-laws.ts +333 -0
- package/src/core/constraints/definitions/tips.ts +63 -0
- package/src/core/constraints/definitions.ts +9 -1086
- package/src/core/constraints/doc-freshness/runner.ts +2 -3
- package/src/core/constraints/index.ts +1 -27
- package/src/core/constraints/interceptor.ts +0 -2
- package/src/core/index.ts +1 -1
- package/src/core/project-config-loader.ts +49 -13
- package/src/core/validators/check-handlers/command.ts +58 -0
- package/src/core/validators/check-handlers/file.ts +104 -0
- package/src/core/validators/check-handlers/http.ts +88 -0
- package/src/core/validators/check-handlers/output.ts +165 -0
- package/src/core/validators/checkpoint.ts +32 -407
- package/src/core/validators/cso.ts +1 -1
- package/src/core/validators/passes-gate.ts +2 -2
- package/src/dashboard/stats.ts +1 -1
- package/src/dashboard/types.ts +1 -1
- package/src/evolution/__tests__/auto-evolve.test.ts +1 -2
- package/src/evolution/auto-evolve.ts +3 -3
- package/src/failure/types.ts +5 -161
- package/src/gates/contract.ts +0 -1
- package/src/gates/index.ts +0 -2
- package/src/gates/performance.ts +1 -1
- package/src/gates/security.ts +1 -3
- package/src/hooks/bootstrap.ts +6 -16
- package/src/index.ts +4 -1
- package/src/knowledge/__tests__/lifecycle.test.ts +4 -1
- package/src/knowledge/audit.ts +1 -1
- package/src/knowledge/doctor.ts +0 -1
- package/src/knowledge/import.ts +2 -2
- package/src/knowledge/index-generator.ts +0 -1
- package/src/knowledge/ingest.ts +1 -2
- package/src/knowledge/lint.ts +2 -2
- package/src/knowledge/primitives/__tests__/code-structure-degrade.test.ts +24 -0
- package/src/knowledge/primitives/code-structure.ts +36 -12
- package/src/knowledge/query.ts +0 -3
- package/src/knowledge/store.ts +1 -1
- package/src/llm/adapter.ts +3 -3
- package/src/monitoring/analyzer-base.ts +112 -0
- package/src/monitoring/constraint-doctor.ts +14 -175
- package/src/monitoring/constraint-evolver.ts +20 -92
- package/src/monitoring/diagnosis-rules.ts +132 -0
- package/src/monitoring/knowledge-doctor.ts +0 -1
- package/src/monitoring/performance-analyzer.ts +22 -72
- package/src/monitoring/performance-collector.ts +0 -22
- package/src/monitoring/trace-analyzer.ts +17 -73
- package/src/presets/__tests__/standard.test.ts +2 -17
- package/src/presets/index.ts +1 -3
- package/src/presets/standard.ts +1 -26
- package/src/safety/output-guardrail.ts +0 -4
- package/src/tools/registry.ts +1 -1
- package/src/types/__tests__/types.test.ts +1 -33
- package/src/types/constraint.ts +6 -75
- package/src/types/failure.ts +165 -0
- package/src/types/index.ts +7 -5
- package/src/types/monitoring-types.ts +150 -0
- package/src/utils/detect-source-roots.ts +1 -1
- package/src/utils/file-walk.ts +78 -0
- package/src/verification/rules-based.ts +0 -1
- package/bin/harness-knowledge-capture.js +0 -99
- package/bin/harness-knowledge-check.js +0 -164
- package/bin/harness-knowledge-track.js +0 -118
- package/dist/cli/commands/sync-docs.d.ts.map +0 -1
- package/dist/cli/commands/sync-docs.js +0 -1074
- package/dist/cli/commands/sync-docs.js.map +0 -1
- package/dist/constraints/index.d.ts +0 -4
- package/dist/constraints/index.d.ts.map +0 -1
- package/dist/constraints/index.js +0 -20
- package/dist/constraints/index.js.map +0 -1
- package/dist/core/constraints/doc-freshness/auto-fix.d.ts +0 -23
- package/dist/core/constraints/doc-freshness/auto-fix.d.ts.map +0 -1
- package/dist/core/constraints/doc-freshness/auto-fix.js +0 -59
- package/dist/core/constraints/doc-freshness/auto-fix.js.map +0 -1
- package/dist/core/constraints/prompt-injection.d.ts +0 -16
- package/dist/core/constraints/prompt-injection.d.ts.map +0 -1
- package/dist/core/constraints/prompt-injection.js +0 -69
- package/dist/core/constraints/prompt-injection.js.map +0 -1
- package/dist/core/spec/index.d.ts +0 -7
- package/dist/core/spec/index.d.ts.map +0 -1
- package/dist/core/spec/index.js.map +0 -1
- package/dist/governance/executor.d.ts +0 -45
- package/dist/governance/executor.d.ts.map +0 -1
- package/dist/governance/executor.js +0 -243
- package/dist/governance/executor.js.map +0 -1
- package/dist/governance/index.d.ts +0 -9
- package/dist/governance/index.d.ts.map +0 -1
- package/dist/governance/index.js +0 -13
- package/dist/governance/index.js.map +0 -1
- package/dist/governance/types.d.ts +0 -46
- package/dist/governance/types.d.ts.map +0 -1
- package/dist/governance/types.js +0 -9
- package/dist/governance/types.js.map +0 -1
- package/dist/tools/definitions/definitions/core/code/fingerprint.sh +0 -273
- package/dist/tools/definitions/definitions/core/code/fingerprint.yml +0 -72
- package/dist/tools/definitions/definitions/core/code/parse.yml +0 -68
- package/dist/tools/definitions/definitions/core/code/register-language.sh +0 -475
- package/dist/tools/definitions/definitions/core/code/register-language.yml +0 -74
- package/dist/tools/definitions/definitions/core/docker/build.yml +0 -73
- package/dist/tools/definitions/definitions/core/docker/run.yml +0 -81
- package/dist/tools/definitions/definitions/core/file/copy.yml +0 -88
- package/dist/tools/definitions/definitions/core/file/read.yml +0 -69
- package/dist/tools/definitions/definitions/core/file/write.yml +0 -75
- package/dist/tools/definitions/definitions/core/git/branch.yml +0 -61
- package/dist/tools/definitions/definitions/core/git/cleanup-worktree.yml +0 -50
- package/dist/tools/definitions/definitions/core/git/clone.yml +0 -69
- package/dist/tools/definitions/definitions/core/git/commit.yml +0 -65
- package/dist/tools/definitions/definitions/core/git/push.yml +0 -79
- package/dist/tools/definitions/definitions/core/git/worktree.yml +0 -96
- package/dist/tools/definitions/definitions/core/notification/notify.sh +0 -152
- package/dist/tools/definitions/definitions/core/notification/notify.yml +0 -60
- package/dist/tools/definitions/definitions/core/npm/build.yml +0 -75
- package/dist/tools/definitions/definitions/core/npm/install.yml +0 -58
- package/dist/tools/definitions/definitions/core/npm/test.yml +0 -75
- package/dist/tools/definitions/definitions/core/validation/check-reuse.yml +0 -170
- package/dist/tools/definitions/definitions/core/validation/validate-handlers.yml +0 -118
- package/dist/tools/definitions/definitions/core/validation/validate-readme-stats.yml +0 -155
- package/dist/tools/definitions/definitions/core/validation/validate-yaml-syntax.yml +0 -134
- package/dist/tools/definitions/definitions/ext/browser/browser-automate.sh +0 -255
- package/dist/tools/definitions/definitions/ext/browser/browser-automate.yml +0 -166
- package/dist/tools/definitions/definitions/ext/browser/browser-close.sh +0 -104
- package/dist/tools/definitions/definitions/ext/browser/browser-close.yml +0 -55
- package/dist/tools/definitions/definitions/ext/browser/browser-mcp-debug.sh +0 -682
- package/dist/tools/definitions/definitions/ext/browser/browser-mcp-debug.yml +0 -167
- package/dist/tools/definitions/definitions/ext/browser/browser-start.sh +0 -101
- package/dist/tools/definitions/definitions/ext/browser/browser-start.yml +0 -62
- package/dist/tools/definitions/definitions/registry.json +0 -795
- package/dist/tools/definitions/definitions/std/README.md +0 -350
- package/dist/tools/definitions/definitions/std/analysis/analyze-codebase.yml +0 -72
- package/dist/tools/definitions/definitions/std/analysis/analyze-diff.yml +0 -182
- package/dist/tools/definitions/definitions/std/analysis/analyze-git-diff.yml +0 -70
- package/dist/tools/definitions/definitions/std/analysis/analyze-impact.yml +0 -78
- package/dist/tools/definitions/definitions/std/analysis/analyze-requirements.yml +0 -105
- package/dist/tools/definitions/definitions/std/analysis/brainstorm-options.yml +0 -106
- package/dist/tools/definitions/definitions/std/analysis/build-graph.yml +0 -154
- package/dist/tools/definitions/definitions/std/analysis/clarify-requirements.yml +0 -90
- package/dist/tools/definitions/definitions/std/analysis/detect-context.yml +0 -109
- package/dist/tools/definitions/definitions/std/analysis/detect-layers.yml +0 -125
- package/dist/tools/definitions/definitions/std/analysis/generate-tour.yml +0 -102
- package/dist/tools/definitions/definitions/std/analysis/search-enhance.yml +0 -105
- package/dist/tools/definitions/definitions/std/backlog/add.yml +0 -51
- package/dist/tools/definitions/definitions/std/backlog/decide.yml +0 -39
- package/dist/tools/definitions/definitions/std/backlog/github-sync.yml +0 -161
- package/dist/tools/definitions/definitions/std/backlog/list.yml +0 -53
- package/dist/tools/definitions/definitions/std/backlog/load.yml +0 -46
- package/dist/tools/definitions/definitions/std/backlog/resolve.yml +0 -37
- package/dist/tools/definitions/definitions/std/backlog/update.yml +0 -42
- package/dist/tools/definitions/definitions/std/bugfix/diagnose.yml +0 -68
- package/dist/tools/definitions/definitions/std/bugfix/fix.yml +0 -66
- package/dist/tools/definitions/definitions/std/bugfix/verify.yml +0 -69
- package/dist/tools/definitions/definitions/std/constraint/check-decomposition.yml +0 -103
- package/dist/tools/definitions/definitions/std/constraint/check-feature-list.yml +0 -77
- package/dist/tools/definitions/definitions/std/constraint/check-progress.yml +0 -97
- package/dist/tools/definitions/definitions/std/constraint/generate-report.yml +0 -147
- package/dist/tools/definitions/definitions/std/deploy/commit-push.yml +0 -33
- package/dist/tools/definitions/definitions/std/deploy/deploy-backend.yml +0 -37
- package/dist/tools/definitions/definitions/std/deploy/deploy-frontend.yml +0 -37
- package/dist/tools/definitions/definitions/std/deploy/rollback.yml +0 -148
- package/dist/tools/definitions/definitions/std/design/analyze-architecture-impact.yml +0 -113
- package/dist/tools/definitions/definitions/std/design/design-api.yml +0 -55
- package/dist/tools/definitions/definitions/std/design/design-architecture.yml +0 -97
- package/dist/tools/definitions/definitions/std/design/design-db.yml +0 -81
- package/dist/tools/definitions/definitions/std/design/generate-spec.yml +0 -182
- package/dist/tools/definitions/definitions/std/development/develop-api.yml +0 -85
- package/dist/tools/definitions/definitions/std/development/develop-backend.yml +0 -88
- package/dist/tools/definitions/definitions/std/development/develop-frontend.yml +0 -87
- package/dist/tools/definitions/definitions/std/development/develop-shared-types.yml +0 -74
- package/dist/tools/definitions/definitions/std/development/develop-task.yml +0 -122
- package/dist/tools/definitions/definitions/std/development/develop-tests.yml +0 -76
- package/dist/tools/definitions/definitions/std/development/execute-batch.yml +0 -152
- package/dist/tools/definitions/definitions/std/development/fix-issues.yml +0 -100
- package/dist/tools/definitions/definitions/std/development/implement-task.yml +0 -124
- package/dist/tools/definitions/definitions/std/development/review-fix-cycle.yml +0 -232
- package/dist/tools/definitions/definitions/std/evolution/implement.yml +0 -125
- package/dist/tools/definitions/definitions/std/evolution/prioritize.yml +0 -112
- package/dist/tools/definitions/definitions/std/evolution/report-gap.yml +0 -166
- package/dist/tools/definitions/definitions/std/file/read.yml +0 -21
- package/dist/tools/definitions/definitions/std/governance/aggregate-opinions.sh +0 -201
- package/dist/tools/definitions/definitions/std/governance/aggregate-opinions.yml +0 -79
- package/dist/tools/definitions/definitions/std/governance/audit-task.yml +0 -178
- package/dist/tools/definitions/definitions/std/governance/cast-vote.yml +0 -129
- package/dist/tools/definitions/definitions/std/governance/collect-issues.yml +0 -16
- package/dist/tools/definitions/definitions/std/governance/create-signed-document.yml +0 -23
- package/dist/tools/definitions/definitions/std/governance/create-voting-session.yml +0 -101
- package/dist/tools/definitions/definitions/std/governance/define-stance.sh +0 -243
- package/dist/tools/definitions/definitions/std/governance/define-stance.yml +0 -82
- package/dist/tools/definitions/definitions/std/governance/generate-review-report.yml +0 -23
- package/dist/tools/definitions/definitions/std/governance/impeach.yml +0 -179
- package/dist/tools/definitions/definitions/std/governance/multi-stance-review.yml +0 -154
- package/dist/tools/definitions/definitions/std/governance/prepare-artifact.yml +0 -20
- package/dist/tools/definitions/definitions/std/governance/review-spec-approval.yml +0 -262
- package/dist/tools/definitions/definitions/std/governance/rollback.yml +0 -186
- package/dist/tools/definitions/definitions/std/governance/stance-review.yml +0 -149
- package/dist/tools/definitions/definitions/std/governance/track-effect.yml +0 -199
- package/dist/tools/definitions/definitions/std/governance/vote-tally.yml +0 -144
- package/dist/tools/definitions/definitions/std/patch/execute.yml +0 -51
- package/dist/tools/definitions/definitions/std/planning/generate-tasks.yml +0 -36
- package/dist/tools/definitions/definitions/std/planning/load-tasks.yml +0 -44
- package/dist/tools/definitions/definitions/std/planning/split-batch.yml +0 -481
- package/dist/tools/definitions/definitions/std/planning/split-tasks.yml +0 -359
- package/dist/tools/definitions/definitions/std/planning/update-tasks.yml +0 -51
- package/dist/tools/definitions/definitions/std/planning/validate-tasks.yml +0 -46
- package/dist/tools/definitions/definitions/std/project/decide-next-workflow.yml +0 -38
- package/dist/tools/definitions/definitions/std/project/load-state.yml +0 -31
- package/dist/tools/definitions/definitions/std/project/save-state.yml +0 -32
- package/dist/tools/definitions/definitions/std/quality/check-quality.yml +0 -241
- package/dist/tools/definitions/definitions/std/quality/debug-systematic.yml +0 -163
- package/dist/tools/definitions/definitions/std/quality/handle-feedback.yml +0 -108
- package/dist/tools/definitions/definitions/std/quality/review-code.yml +0 -128
- package/dist/tools/definitions/definitions/std/quality/review-spec.yml +0 -140
- package/dist/tools/definitions/definitions/std/quality/review-task.yml +0 -190
- package/dist/tools/definitions/definitions/std/quality/run-tests.yml +0 -80
- package/dist/tools/definitions/definitions/std/quick/analyze.yml +0 -56
- package/dist/tools/definitions/definitions/std/quick/implement.yml +0 -67
- package/dist/tools/definitions/definitions/std/quick/verify.yml +0 -71
- package/dist/tools/definitions/definitions/std/verification/verify_completion.yml +0 -113
- package/dist/tools/definitions/definitions/std/verification/wait-condition.yml +0 -107
- package/dist/types/iron-law.d.ts +0 -25
- package/dist/types/iron-law.d.ts.map +0 -1
- package/dist/types/iron-law.js +0 -16
- package/dist/types/iron-law.js.map +0 -1
- package/src/cli/commands/sync-docs.ts +0 -1175
- package/src/constraints/index.ts +0 -3
- package/src/core/constraints/__tests__/prompt-injection.test.ts +0 -89
- package/src/core/constraints/doc-freshness/auto-fix.ts +0 -69
- package/src/core/constraints/prompt-injection.ts +0 -73
- package/src/core/spec/index.ts +0 -7
- package/src/governance/CONTEXT.md +0 -22
- package/src/governance/__tests__/executor.test.ts +0 -249
- package/src/governance/executor.ts +0 -229
- package/src/governance/index.ts +0 -13
- package/src/governance/types.ts +0 -53
- package/src/tools/core/package.json +0 -7
- package/src/tools/core/pnpm-lock.yaml +0 -232
- package/src/types/iron-law.ts +0 -50
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 恒通过检查组(工单 21)
|
|
3
|
+
*
|
|
4
|
+
* 行为类约束由 promptInjection 注入驱动 + 事后检查,检查器侧恒通过;
|
|
5
|
+
* Tips 仅作信息提示。这些约束无独立检查逻辑,故集中一处。
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { alwaysPass } from './types';
|
|
9
|
+
|
|
10
|
+
// Mnilax guidelines + first-principles(injectPrompt=true,行为层,事后检查)
|
|
11
|
+
export const surgicalChangesOnly = alwaysPass('surgical_changes_only');
|
|
12
|
+
export const noModelForDeterministic = alwaysPass('no_model_for_deterministic');
|
|
13
|
+
export const noConflictBlending = alwaysPass('no_conflict_blending');
|
|
14
|
+
export const readBeforeWrite = alwaysPass('read_before_write');
|
|
15
|
+
export const followConventions = alwaysPass('follow_conventions');
|
|
16
|
+
export const firstPrinciplesFirst = alwaysPass('first_principles_first');
|
|
17
|
+
export const fixTheProblemNotTheGate = alwaysPass('fix_the_problem_not_the_gate');
|
|
18
|
+
export const diagnosisToFixGate = alwaysPass('diagnosis_to_fix_gate');
|
|
19
|
+
|
|
20
|
+
// Tips — 总是通过(仅提示)
|
|
21
|
+
export const readmeRequired = alwaysPass('readme_required');
|
|
22
|
+
export const docRequiredForPublicApi = alwaysPass('doc_required_for_public_api');
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* capability_sync:CAPABILITIES.md 与代码同步检查(工单 21)
|
|
3
|
+
*
|
|
4
|
+
* 两步验证:
|
|
5
|
+
* 1. Git diff 增量 — 当前变更的非测试文件是否在文档中有记录
|
|
6
|
+
* 2. 全量扫描 — 源码根下所有源文件是否都在 CAPABILITIES.md 中(T-058)
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { existsSync } from 'fs';
|
|
10
|
+
import { join } from 'path';
|
|
11
|
+
import { readCapabilitiesEntries } from '../capabilities-parser';
|
|
12
|
+
import { detectSourceRoots } from '../../../utils/detect-source-roots';
|
|
13
|
+
import type { ConstraintCheck } from './types';
|
|
14
|
+
|
|
15
|
+
export const capabilitySync: ConstraintCheck = {
|
|
16
|
+
id: 'capability_sync',
|
|
17
|
+
async evaluate(env) {
|
|
18
|
+
const projectPath = env.projectPath;
|
|
19
|
+
try {
|
|
20
|
+
const capabilitiesPath = join(projectPath, 'CAPABILITIES.md');
|
|
21
|
+
if (!existsSync(capabilitiesPath)) {
|
|
22
|
+
// 检查是否有代码变更,无变更则跳过
|
|
23
|
+
const diff = await env.stagedDiffNames();
|
|
24
|
+
const changedCodeFiles = diff.split('\n').filter(
|
|
25
|
+
(f: string) => f.endsWith('.ts') || f.endsWith('.tsx') || f.endsWith('.js')
|
|
26
|
+
);
|
|
27
|
+
return changedCodeFiles.length === 0;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const listedFiles = readCapabilitiesEntries(capabilitiesPath, { secondColumnOnly: true });
|
|
31
|
+
|
|
32
|
+
// ── Step 1: Git diff 增量检查 ──
|
|
33
|
+
const diff = await env.stagedDiffNames();
|
|
34
|
+
const changedCodeFiles = diff.split('\n').filter(
|
|
35
|
+
(f: string) => f.endsWith('.ts') || f.endsWith('.tsx') || f.endsWith('.js')
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
if (changedCodeFiles.length > 0 && listedFiles.length > 0) {
|
|
39
|
+
const significantChanges = changedCodeFiles.filter(
|
|
40
|
+
(f: string) => !f.includes('__tests__') && !f.includes('.test.') && !f.includes('.spec.')
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
if (significantChanges.length > 0) {
|
|
44
|
+
const covered = significantChanges.some((changed: string) =>
|
|
45
|
+
listedFiles.some((listed: string) => changed.endsWith(listed) || changed.includes(listed))
|
|
46
|
+
);
|
|
47
|
+
if (!covered) return false;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// ── Step 2: 全量源码根扫描(T-058 修复核心)──
|
|
52
|
+
if (listedFiles.length > 0) {
|
|
53
|
+
const sourceRoots = detectSourceRoots(projectPath);
|
|
54
|
+
for (const root of sourceRoots) {
|
|
55
|
+
const srcDir = join(projectPath, root);
|
|
56
|
+
if (existsSync(srcDir)) {
|
|
57
|
+
for (const file of env.srcScan(root)) {
|
|
58
|
+
if (!listedFiles.includes(file)) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return true;
|
|
67
|
+
} catch {
|
|
68
|
+
return true; // 检查失败,默认通过
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* context_doc_sync:关键目录必须有 CONTEXT.md(工单 21)
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { existsSync } from 'fs';
|
|
6
|
+
import { join } from 'path';
|
|
7
|
+
import { loadRawProjectConfig } from '../../project-config-loader';
|
|
8
|
+
import type { ConstraintCheck } from './types';
|
|
9
|
+
|
|
10
|
+
export const contextDocSync: ConstraintCheck = {
|
|
11
|
+
id: 'context_doc_sync',
|
|
12
|
+
async evaluate(env) {
|
|
13
|
+
const projectPath = env.projectPath;
|
|
14
|
+
try {
|
|
15
|
+
const config = loadRawProjectConfig(projectPath) ?? {};
|
|
16
|
+
const governance = config.governance as Record<string, unknown> | undefined;
|
|
17
|
+
const contextFiles = governance?.context_files as Record<string, unknown> | undefined;
|
|
18
|
+
|
|
19
|
+
if (!contextFiles?.enabled || !Array.isArray(contextFiles.required_dirs)) {
|
|
20
|
+
return true; // 未配置,跳过
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const requiredDirs = contextFiles.required_dirs as string[];
|
|
24
|
+
for (const dir of requiredDirs) {
|
|
25
|
+
const contextPath = join(projectPath, dir, 'CONTEXT.md');
|
|
26
|
+
if (!existsSync(contextPath)) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return true;
|
|
32
|
+
} catch {
|
|
33
|
+
return true; // 配置不存在或解析失败,跳过
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* docs_freshness:CAPABILITIES.md 文件表 + 能力清单格式 + CLAUDE.md + CHANGELOG(工单 21)
|
|
3
|
+
*
|
|
4
|
+
* 1. 文件表格式:CAPABILITIES.md 中列出的文件必须仍存在(防过期引用)
|
|
5
|
+
* 2. 能力清单格式:FreshnessRunner 配置驱动检查
|
|
6
|
+
* 3. 无配置时注入内置默认配置(等价旧硬编码行为)
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { existsSync, readFileSync } from 'fs';
|
|
10
|
+
import { join } from 'path';
|
|
11
|
+
import { loadRawProjectConfig } from '../../project-config-loader';
|
|
12
|
+
import { FreshnessRunner, type FreshnessCheckResult } from '../doc-freshness/runner';
|
|
13
|
+
import { detectSourceRoots } from '../../../utils/detect-source-roots';
|
|
14
|
+
import type { DocFreshnessConfig, DocFreshnessCheck } from '../../../types/project-config';
|
|
15
|
+
import type { ConstraintCheck } from './types';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* 内置默认文档新鲜度检查配置
|
|
19
|
+
*
|
|
20
|
+
* 等价旧硬编码行为;仅当项目未提供 governance.doc_freshness 配置时使用。
|
|
21
|
+
*/
|
|
22
|
+
function getBuiltInDocFreshnessConfig(): DocFreshnessCheck[] {
|
|
23
|
+
return [
|
|
24
|
+
// CONTEXT.md 存在性 — key directories must have CONTEXT.md
|
|
25
|
+
{ type: 'context_docs' },
|
|
26
|
+
// CHANGELOG 版本 vs package.json 版本 — prevents version drift
|
|
27
|
+
{ type: 'changelog_version' },
|
|
28
|
+
];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* CAPABILITIES.md 文件表新鲜度:列出的文件路径必须仍存在。
|
|
33
|
+
* 多根查找:支持不同项目的源码根(harness=src/, studio=apps/api/src/ 等)。
|
|
34
|
+
* 无表格行(能力清单格式)时跳过。
|
|
35
|
+
*/
|
|
36
|
+
function checkCapabilitiesFreshness(projectPath: string): boolean {
|
|
37
|
+
try {
|
|
38
|
+
const capabilitiesPath = join(projectPath, 'CAPABILITIES.md');
|
|
39
|
+
if (!existsSync(capabilitiesPath)) return true;
|
|
40
|
+
const content = readFileSync(capabilitiesPath, 'utf-8');
|
|
41
|
+
|
|
42
|
+
const listedFiles: string[] = [];
|
|
43
|
+
const tableRowRegex = /^\|[^|]+\|\s*([^|]+?\.(?:ts|tsx|js|jsx))\s*\|/gm;
|
|
44
|
+
let match;
|
|
45
|
+
while ((match = tableRowRegex.exec(content)) !== null) {
|
|
46
|
+
listedFiles.push(match[1].trim());
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (listedFiles.length === 0) return true;
|
|
50
|
+
|
|
51
|
+
const sourceRoots = detectSourceRoots(projectPath);
|
|
52
|
+
const fileExists = (file: string): boolean => {
|
|
53
|
+
if (existsSync(join(projectPath, file))) return true;
|
|
54
|
+
for (const root of sourceRoots) {
|
|
55
|
+
if (existsSync(join(projectPath, root, file))) return true;
|
|
56
|
+
}
|
|
57
|
+
return false;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const missing = listedFiles.filter(f => !fileExists(f));
|
|
61
|
+
if (missing.length > 0) {
|
|
62
|
+
// 报出具体文件名:此前只返回 false,CLI 只能打印通用提示,
|
|
63
|
+
// 幽灵条目 basename 碰撞时 sync-docs 也不剔除,用户无从定位(2026-08-08 studio CI 4 连红)
|
|
64
|
+
console.error(`[docs_freshness] CAPABILITIES.md 列出的文件不存在: ${missing.join(', ')}`);
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return true;
|
|
69
|
+
} catch {
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export const docsFreshness: ConstraintCheck = {
|
|
75
|
+
id: 'docs_freshness',
|
|
76
|
+
async evaluate(env) {
|
|
77
|
+
const projectPath = env.projectPath;
|
|
78
|
+
|
|
79
|
+
// Step 1: 文件表格式 — 检查列出的文件是否还存在
|
|
80
|
+
if (!checkCapabilitiesFreshness(projectPath)) return false;
|
|
81
|
+
|
|
82
|
+
// Step 2: 能力清单格式 + CLAUDE.md + CHANGELOG — 通过 FreshnessRunner
|
|
83
|
+
try {
|
|
84
|
+
let freshnessConfig: DocFreshnessConfig | undefined;
|
|
85
|
+
let requiredDirs: string[] | undefined;
|
|
86
|
+
|
|
87
|
+
try {
|
|
88
|
+
const raw = loadRawProjectConfig(projectPath);
|
|
89
|
+
const governance = raw?.governance as Record<string, unknown> | undefined;
|
|
90
|
+
freshnessConfig = governance?.doc_freshness as DocFreshnessConfig | undefined;
|
|
91
|
+
|
|
92
|
+
const contextFiles = governance?.context_files as Record<string, unknown> | undefined;
|
|
93
|
+
if (contextFiles?.enabled && Array.isArray(contextFiles.required_dirs)) {
|
|
94
|
+
requiredDirs = contextFiles.required_dirs as string[];
|
|
95
|
+
}
|
|
96
|
+
} catch {
|
|
97
|
+
// 配置解析失败,使用默认
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const runner = new FreshnessRunner();
|
|
101
|
+
let results: FreshnessCheckResult[];
|
|
102
|
+
|
|
103
|
+
if (freshnessConfig?.checks && freshnessConfig.checks.length > 0) {
|
|
104
|
+
results = runner.runAll(freshnessConfig, projectPath, { requiredDirs });
|
|
105
|
+
} else {
|
|
106
|
+
results = runner.runAll({ checks: getBuiltInDocFreshnessConfig() }, projectPath, { requiredDirs });
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (!results.every(r => r.pass)) return false;
|
|
110
|
+
} catch {
|
|
111
|
+
// FreshnessRunner 失败不影响整体
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return true;
|
|
115
|
+
},
|
|
116
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 指导原则层轻量检查(工单 21):纯上下文证据标志判定,无 I/O
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { contextFlag } from './types';
|
|
6
|
+
|
|
7
|
+
export const noFixWithoutRootCause = contextFlag(
|
|
8
|
+
'no_fix_without_root_cause',
|
|
9
|
+
ctx => ctx.hasRootCauseInvestigation === true
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
export const noCodeWithoutTest = contextFlag(
|
|
13
|
+
'no_code_without_test',
|
|
14
|
+
ctx => ctx.hasFailingTest === true
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
export const simplestSolutionFirst = contextFlag(
|
|
18
|
+
'simplest_solution_first',
|
|
19
|
+
ctx => ctx.hasReuseCheck === true
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
export const noCreationWithoutReuseCheck = contextFlag(
|
|
23
|
+
'no_creation_without_reuse_check',
|
|
24
|
+
ctx => ctx.hasReuseCheck === true
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
export const noSkillWithoutTest = contextFlag(
|
|
28
|
+
'no_skill_without_test',
|
|
29
|
+
ctx => ctx.hasTest === true
|
|
30
|
+
);
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 约束检查器注册表(工单 21)
|
|
3
|
+
*
|
|
4
|
+
* checker.ts 编排层通过 getConstraintCheck(id) 查找实现,
|
|
5
|
+
* 未注册的约束默认通过(保持历史 default 分支语义)。
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { ConstraintCheck } from './types';
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
noSelfApproval,
|
|
12
|
+
noCompletionWithoutVerification,
|
|
13
|
+
incrementalProgress,
|
|
14
|
+
verifyExternalCapability,
|
|
15
|
+
noImplementationWithoutRequirementReview,
|
|
16
|
+
noImplementationWithoutRequirement,
|
|
17
|
+
preferWorktree,
|
|
18
|
+
noClaimWithoutEvidence,
|
|
19
|
+
noDeleteWithoutContext,
|
|
20
|
+
twoStageReviewRequired,
|
|
21
|
+
} from './iron-flags';
|
|
22
|
+
import {
|
|
23
|
+
noFixWithoutRootCause,
|
|
24
|
+
noCodeWithoutTest,
|
|
25
|
+
simplestSolutionFirst,
|
|
26
|
+
noCreationWithoutReuseCheck,
|
|
27
|
+
noSkillWithoutTest,
|
|
28
|
+
} from './guideline-flags';
|
|
29
|
+
import {
|
|
30
|
+
surgicalChangesOnly,
|
|
31
|
+
noModelForDeterministic,
|
|
32
|
+
noConflictBlending,
|
|
33
|
+
readBeforeWrite,
|
|
34
|
+
followConventions,
|
|
35
|
+
firstPrinciplesFirst,
|
|
36
|
+
fixTheProblemNotTheGate,
|
|
37
|
+
diagnosisToFixGate,
|
|
38
|
+
readmeRequired,
|
|
39
|
+
docRequiredForPublicApi,
|
|
40
|
+
} from './always-pass';
|
|
41
|
+
import { noBypassCheckpoint } from './no-bypass-checkpoint';
|
|
42
|
+
import { noTestSimplification } from './no-test-simplification';
|
|
43
|
+
import { noFuzzyCompletionClaim } from './no-fuzzy-completion-claim';
|
|
44
|
+
import { noPerformativeAgreement } from './no-performative-agreement';
|
|
45
|
+
import { noExcusePatterns } from './no-excuse-patterns';
|
|
46
|
+
import { noAnyType } from './no-any-type';
|
|
47
|
+
import { capabilitySync } from './capability-sync';
|
|
48
|
+
import { noSimplificationWithoutApproval } from './no-simplification-without-approval';
|
|
49
|
+
import { testCoverageRequired } from './test-coverage';
|
|
50
|
+
import { contextDocSync } from './context-doc-sync';
|
|
51
|
+
import { docsFreshness } from './docs-freshness';
|
|
52
|
+
import { yagniCheck } from './yagni';
|
|
53
|
+
|
|
54
|
+
const CHECKS: ConstraintCheck[] = [
|
|
55
|
+
// Iron Laws
|
|
56
|
+
noBypassCheckpoint,
|
|
57
|
+
noSelfApproval,
|
|
58
|
+
noCompletionWithoutVerification,
|
|
59
|
+
noTestSimplification,
|
|
60
|
+
incrementalProgress,
|
|
61
|
+
verifyExternalCapability,
|
|
62
|
+
noImplementationWithoutRequirementReview,
|
|
63
|
+
noImplementationWithoutRequirement,
|
|
64
|
+
preferWorktree,
|
|
65
|
+
noFuzzyCompletionClaim,
|
|
66
|
+
noClaimWithoutEvidence,
|
|
67
|
+
noDeleteWithoutContext,
|
|
68
|
+
noPerformativeAgreement,
|
|
69
|
+
twoStageReviewRequired,
|
|
70
|
+
// Guidelines
|
|
71
|
+
noFixWithoutRootCause,
|
|
72
|
+
noCodeWithoutTest,
|
|
73
|
+
noAnyType,
|
|
74
|
+
simplestSolutionFirst,
|
|
75
|
+
noCreationWithoutReuseCheck,
|
|
76
|
+
capabilitySync,
|
|
77
|
+
noSimplificationWithoutApproval,
|
|
78
|
+
noSkillWithoutTest,
|
|
79
|
+
testCoverageRequired,
|
|
80
|
+
contextDocSync,
|
|
81
|
+
docsFreshness,
|
|
82
|
+
noExcusePatterns,
|
|
83
|
+
yagniCheck,
|
|
84
|
+
// 行为类(promptInjection 驱动)恒通过
|
|
85
|
+
surgicalChangesOnly,
|
|
86
|
+
noModelForDeterministic,
|
|
87
|
+
noConflictBlending,
|
|
88
|
+
readBeforeWrite,
|
|
89
|
+
followConventions,
|
|
90
|
+
firstPrinciplesFirst,
|
|
91
|
+
fixTheProblemNotTheGate,
|
|
92
|
+
diagnosisToFixGate,
|
|
93
|
+
// Tips
|
|
94
|
+
readmeRequired,
|
|
95
|
+
docRequiredForPublicApi,
|
|
96
|
+
];
|
|
97
|
+
|
|
98
|
+
const registry = new Map<string, ConstraintCheck>(CHECKS.map(c => [c.id, c]));
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* 按约束 ID 查找检查实现;未注册返回 undefined(编排层默认通过)
|
|
102
|
+
*/
|
|
103
|
+
export function getConstraintCheck(id: string): ConstraintCheck | undefined {
|
|
104
|
+
return registry.get(id);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* 已注册的检查实现数量(诊断/测试用)
|
|
109
|
+
*/
|
|
110
|
+
export function registeredCheckCount(): number {
|
|
111
|
+
return registry.size;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export type { ConstraintCheck, CheckEnv } from './types';
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 铁律层轻量检查(工单 21):纯上下文证据标志判定,无 I/O
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { contextFlag } from './types';
|
|
6
|
+
|
|
7
|
+
export const noSelfApproval = contextFlag(
|
|
8
|
+
'no_self_approval',
|
|
9
|
+
ctx => ctx.hasTest === true
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
export const noCompletionWithoutVerification = contextFlag(
|
|
13
|
+
'no_completion_without_verification',
|
|
14
|
+
ctx => ctx.hasVerificationEvidence === true
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
export const incrementalProgress = contextFlag(
|
|
18
|
+
'incremental_progress',
|
|
19
|
+
// undefined = 未验证 → Iron Law 必须显式确认
|
|
20
|
+
ctx => ctx.hasSingleTask === true
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
export const verifyExternalCapability = contextFlag(
|
|
24
|
+
'verify_external_capability',
|
|
25
|
+
ctx => ctx.hasExternalCapabilityVerification === true
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
export const noImplementationWithoutRequirementReview = contextFlag(
|
|
29
|
+
'no_implementation_without_requirement_review',
|
|
30
|
+
ctx => ctx.hasRequirementReview === true
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
export const noImplementationWithoutRequirement = contextFlag(
|
|
34
|
+
'no_implementation_without_requirement',
|
|
35
|
+
ctx => ctx.hasRequirement === true
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
export const preferWorktree = contextFlag(
|
|
39
|
+
'prefer_worktree',
|
|
40
|
+
ctx => ctx.hasWorktree === true
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
export const noClaimWithoutEvidence = contextFlag(
|
|
44
|
+
'no_claim_without_evidence',
|
|
45
|
+
ctx =>
|
|
46
|
+
ctx.hasVerificationEvidence === true ||
|
|
47
|
+
(ctx.taskDescription || '').includes('test') ||
|
|
48
|
+
ctx.hasTest === true
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
export const noDeleteWithoutContext = contextFlag(
|
|
52
|
+
'no_delete_without_context',
|
|
53
|
+
ctx =>
|
|
54
|
+
ctx.hasRequirementReview === true ||
|
|
55
|
+
ctx.hasRequirement === true ||
|
|
56
|
+
ctx.isExistingDesign === true
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
export const twoStageReviewRequired = contextFlag(
|
|
60
|
+
'two_stage_review_required',
|
|
61
|
+
ctx => ctx.hasTwoStageReview === true
|
|
62
|
+
);
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* no_any_type:变更 TS 文件不得出现 `: any`(工单 21)
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { existsSync, readFileSync } from 'fs';
|
|
6
|
+
import type { ConstraintCheck } from './types';
|
|
7
|
+
|
|
8
|
+
export const noAnyType: ConstraintCheck = {
|
|
9
|
+
id: 'no_any_type',
|
|
10
|
+
async evaluate(env) {
|
|
11
|
+
try {
|
|
12
|
+
const changedFiles = env.context.changedFiles || [];
|
|
13
|
+
const filesToCheck = changedFiles.filter(
|
|
14
|
+
f => f.endsWith('.ts') || f.endsWith('.tsx')
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
if (filesToCheck.length === 0) {
|
|
18
|
+
return true; // 无 TS 文件变更
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
for (const file of filesToCheck) {
|
|
22
|
+
if (!existsSync(file)) continue;
|
|
23
|
+
try {
|
|
24
|
+
const content = readFileSync(file, 'utf-8');
|
|
25
|
+
// 检查 : any(排除注释和字符串)
|
|
26
|
+
for (const line of content.split('\n')) {
|
|
27
|
+
if (line.trim().startsWith('//') || line.trim().startsWith('*')) continue;
|
|
28
|
+
if (line.includes(': any') && !line.includes('// ') && !line.includes('/*')) {
|
|
29
|
+
return false; // 发现 any 类型
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
} catch {
|
|
33
|
+
// 文件读取失败,忽略
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return true;
|
|
38
|
+
} catch {
|
|
39
|
+
return true; // 检查失败,默认通过
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* no_bypass_checkpoint:检查变更文件内容是否有 skip/bypass 关键词(工单 21)
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { existsSync, readFileSync } from 'fs';
|
|
6
|
+
import type { ConstraintCheck } from './types';
|
|
7
|
+
|
|
8
|
+
const BYPASS_PATTERNS = [
|
|
9
|
+
/\.skip\(/, // Jest/Vitest skip
|
|
10
|
+
/\.bypass\s*=/, // bypass flag
|
|
11
|
+
/skip:\s*true/, // skip option
|
|
12
|
+
/bypass\s*checkpoint/, // explicit bypass
|
|
13
|
+
/\/\/\s*skip/, // comment skip
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
export const noBypassCheckpoint: ConstraintCheck = {
|
|
17
|
+
id: 'no_bypass_checkpoint',
|
|
18
|
+
async evaluate(env) {
|
|
19
|
+
const changedFiles = env.context.changedFiles || [];
|
|
20
|
+
if (changedFiles.length === 0) {
|
|
21
|
+
return true; // 无变更文件,默认通过
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
for (const file of changedFiles) {
|
|
25
|
+
if (!existsSync(file)) continue;
|
|
26
|
+
try {
|
|
27
|
+
const content = readFileSync(file, 'utf-8');
|
|
28
|
+
for (const pattern of BYPASS_PATTERNS) {
|
|
29
|
+
if (pattern.test(content)) {
|
|
30
|
+
return false; // 发现 bypass 关键词
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
} catch {
|
|
34
|
+
// 文件读取失败,忽略
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return true;
|
|
39
|
+
},
|
|
40
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* no_excuse_patterns:完成声明不得包含借口模式(工单 21)
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { ConstraintCheck } from './types';
|
|
6
|
+
|
|
7
|
+
const EXCUSE_PATTERNS = [
|
|
8
|
+
/稍后修复/,
|
|
9
|
+
/小问题/,
|
|
10
|
+
/不影响功能/,
|
|
11
|
+
/以后再说/,
|
|
12
|
+
/先这样/,
|
|
13
|
+
/临时方案/,
|
|
14
|
+
/暂时这样/,
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
export const noExcusePatterns: ConstraintCheck = {
|
|
18
|
+
id: 'no_excuse_patterns',
|
|
19
|
+
evaluate(env) {
|
|
20
|
+
const text = env.context.completionClaimText || env.context.taskDescription || '';
|
|
21
|
+
if (!text) return true;
|
|
22
|
+
return !EXCUSE_PATTERNS.some(p => p.test(text));
|
|
23
|
+
},
|
|
24
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* no_fuzzy_completion_claim:完成声明不得包含模糊词(工单 21)
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { ConstraintCheck } from './types';
|
|
6
|
+
|
|
7
|
+
const FUZZY_PATTERNS = [
|
|
8
|
+
/应该没问题/,
|
|
9
|
+
/应该可以/,
|
|
10
|
+
/大概/,
|
|
11
|
+
/可能/,
|
|
12
|
+
/好像/,
|
|
13
|
+
/似乎/,
|
|
14
|
+
/差不多/,
|
|
15
|
+
/基本完成/,
|
|
16
|
+
/大部分/,
|
|
17
|
+
// audit-learned (2026-05-18): unverified completion claims
|
|
18
|
+
/我记得删[过掉]了/,
|
|
19
|
+
/之前说删了/,
|
|
20
|
+
/已删除.*但/,
|
|
21
|
+
/大部分实现/,
|
|
22
|
+
/大部分完成/,
|
|
23
|
+
/已修复.*但/,
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
export const noFuzzyCompletionClaim: ConstraintCheck = {
|
|
27
|
+
id: 'no_fuzzy_completion_claim',
|
|
28
|
+
evaluate(env) {
|
|
29
|
+
const text = env.context.completionClaimText || '';
|
|
30
|
+
if (!text) return true; // 没有文本时默认通过(由其他检查覆盖)
|
|
31
|
+
return !FUZZY_PATTERNS.some(p => p.test(text));
|
|
32
|
+
},
|
|
33
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* no_performative_agreement:表演性同意辅助检查(工单 21)
|
|
3
|
+
*
|
|
4
|
+
* 主要由 promptInjection 驱动,此处做辅助检查。
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { ConstraintCheck } from './types';
|
|
8
|
+
|
|
9
|
+
const PERFORMATIVE_START = /^(好的[,,]*\s*我[来去]做|明白了[,,]*|没问题[,,]*|ok[,,]*\s*i.?ll)/i;
|
|
10
|
+
|
|
11
|
+
export const noPerformativeAgreement: ConstraintCheck = {
|
|
12
|
+
id: 'no_performative_agreement',
|
|
13
|
+
evaluate(env) {
|
|
14
|
+
const text = env.context.taskDescription || '';
|
|
15
|
+
if (!text) return true;
|
|
16
|
+
// 以表演性模式开头且总长度很短 → 视为表演性同意
|
|
17
|
+
if (PERFORMATIVE_START.test(text) && text.length < 100) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
return true;
|
|
21
|
+
},
|
|
22
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* no_simplification_without_approval:staged diff 不得含简化关键词(工单 21)
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { ConstraintCheck } from './types';
|
|
6
|
+
|
|
7
|
+
const SIMPLIFICATION_PATTERNS = [
|
|
8
|
+
/removed\s*test/i,
|
|
9
|
+
/simplified\s*logic/i,
|
|
10
|
+
/removed\s*validation/i,
|
|
11
|
+
/skip\s*check/i,
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
export const noSimplificationWithoutApproval: ConstraintCheck = {
|
|
15
|
+
id: 'no_simplification_without_approval',
|
|
16
|
+
async evaluate(env) {
|
|
17
|
+
try {
|
|
18
|
+
const diff = await env.stagedDiff();
|
|
19
|
+
for (const pattern of SIMPLIFICATION_PATTERNS) {
|
|
20
|
+
if (pattern.test(diff)) {
|
|
21
|
+
return false; // 发现简化关键词
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return true;
|
|
25
|
+
} catch {
|
|
26
|
+
return true; // 检查失败,默认通过
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* no_test_simplification:检查 staged diff 是否删除了测试(工单 21)
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { ConstraintCheck } from './types';
|
|
6
|
+
|
|
7
|
+
const DELETED_TEST_PATTERNS = [
|
|
8
|
+
/^-\s*(test|it|describe)\s*\(/, // 删除 test/it/describe
|
|
9
|
+
/^-\s*expect\s*\(/, // 删除 expect
|
|
10
|
+
/^-\s*\/\/\s*test/, // 删除注释的 test
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
export const noTestSimplification: ConstraintCheck = {
|
|
14
|
+
id: 'no_test_simplification',
|
|
15
|
+
async evaluate(env) {
|
|
16
|
+
try {
|
|
17
|
+
const diff = await env.stagedDiff();
|
|
18
|
+
for (const pattern of DELETED_TEST_PATTERNS) {
|
|
19
|
+
if (pattern.test(diff)) {
|
|
20
|
+
return false; // 发现删除测试
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return true;
|
|
24
|
+
} catch {
|
|
25
|
+
return true; // git 命令失败,默认通过
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
};
|