@dommaker/harness 0.13.0 → 0.13.2
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 +169 -0
- package/bin/harness-knowledge-capture.js +99 -0
- package/bin/harness-knowledge-check.js +149 -0
- package/bin/harness-knowledge-track.js +92 -0
- package/bin/harness-knowledge-track.sh +47 -0
- package/bin/harness-sensitive-check.sh +67 -0
- package/dist/cli/commands/init.js +34 -2
- package/dist/cli/commands/init.js.map +1 -1
- package/package.json +6 -3
- package/src/CONTEXT.md +34 -0
- package/src/__tests__/acceptance-gate.test.ts +364 -0
- package/src/__tests__/annotation-checker.test.ts +183 -0
- package/src/__tests__/architecture-engine.test.ts +619 -0
- package/src/__tests__/checker-extra.test.ts +1627 -0
- package/src/__tests__/checker.test.ts +1268 -0
- package/src/__tests__/checkpoint.test.ts +697 -0
- package/src/__tests__/clean-state-extra.test.ts +301 -0
- package/src/__tests__/clean-state.test.ts +169 -0
- package/src/__tests__/constraint-doctor.test.ts +410 -0
- package/src/__tests__/constraint-evolver.test.ts +404 -0
- package/src/__tests__/constraint-handler.test.ts +136 -0
- package/src/__tests__/context/progressive-loader.test.ts +131 -0
- package/src/__tests__/contract-gate.test.ts +321 -0
- package/src/__tests__/cross-project-checker.test.ts +318 -0
- package/src/__tests__/cso-validator.test.ts +205 -0
- package/src/__tests__/detect-source-roots.test.ts +98 -0
- package/src/__tests__/doctor-evolver.test.ts +381 -0
- package/src/__tests__/error-classifier.test.ts +304 -0
- package/src/__tests__/exec.test.ts +83 -0
- package/src/__tests__/extend-exceptions.test.ts +149 -0
- package/src/__tests__/failure-recorder.test.ts +335 -0
- package/src/__tests__/hooks-pipeline.test.ts +214 -0
- package/src/__tests__/interceptor.test.ts +89 -0
- package/src/__tests__/iron-laws.test.ts +246 -0
- package/src/__tests__/long-running.test.ts +17 -0
- package/src/__tests__/passes-gate-check.test.ts +138 -0
- package/src/__tests__/passes-gate-extension.test.ts +151 -0
- package/src/__tests__/passes-gate-extra.test.ts +238 -0
- package/src/__tests__/passes-gate.test.ts +231 -0
- package/src/__tests__/performance-analyzer.test.ts +501 -0
- package/src/__tests__/performance-collector.test.ts +276 -0
- package/src/__tests__/performance-gate.test.ts +74 -0
- package/src/__tests__/presets.test.ts +104 -0
- package/src/__tests__/project-config-loader-extra.test.ts +269 -0
- package/src/__tests__/project-config-loader.test.ts +127 -0
- package/src/__tests__/review-gate.test.ts +92 -0
- package/src/__tests__/security-gate.test.ts +100 -0
- package/src/__tests__/session-startup.test.ts +334 -0
- package/src/__tests__/spec-validator.test.ts +57 -0
- package/src/__tests__/token-budget.test.ts +252 -0
- package/src/__tests__/trace-analyzer-extra.test.ts +307 -0
- package/src/__tests__/trace-analyzer.test.ts +131 -0
- package/src/__tests__/trace-collector.test.ts +258 -0
- package/src/__tests__/traces.test.ts +347 -0
- package/src/agents/CONTEXT.md +21 -0
- package/src/agents/__tests__/lifecycle.test.ts +248 -0
- package/src/agents/index.ts +2 -0
- package/src/agents/lifecycle.ts +201 -0
- package/src/agents/types.ts +46 -0
- package/src/architecture/CONTEXT.md +22 -0
- package/src/architecture/constraint-engine.ts +356 -0
- package/src/architecture/cross-project-checker.ts +563 -0
- package/src/cli/commands/CONTEXT.md +24 -0
- package/src/cli/commands/__tests__/acceptance.test.ts +180 -0
- package/src/cli/commands/__tests__/check.test.ts +598 -0
- package/src/cli/commands/__tests__/command.test.ts +149 -0
- package/src/cli/commands/__tests__/contract.test.ts +151 -0
- package/src/cli/commands/__tests__/failure.test.ts +199 -0
- package/src/cli/commands/__tests__/flow.test.ts +343 -0
- package/src/cli/commands/__tests__/init.test.ts +306 -0
- package/src/cli/commands/__tests__/passes-gate.test.ts +256 -0
- package/src/cli/commands/__tests__/performance.test.ts +116 -0
- package/src/cli/commands/__tests__/posteval-plan.test.ts +201 -0
- package/src/cli/commands/__tests__/report-extra.test.ts +98 -0
- package/src/cli/commands/__tests__/report.test.ts +109 -0
- package/src/cli/commands/__tests__/review.test.ts +153 -0
- package/src/cli/commands/__tests__/security.test.ts +147 -0
- package/src/cli/commands/__tests__/spec.test.ts +193 -0
- package/src/cli/commands/__tests__/status-extra.test.ts +223 -0
- package/src/cli/commands/__tests__/status.test.ts +306 -0
- package/src/cli/commands/__tests__/sync-docs.test.ts +335 -0
- package/src/cli/commands/__tests__/validate.test.ts +139 -0
- package/src/cli/commands/acceptance.ts +111 -0
- package/src/cli/commands/analyze-sessions.ts +488 -0
- package/src/cli/commands/check.ts +441 -0
- package/src/cli/commands/command.ts +90 -0
- package/src/cli/commands/constraints.ts +86 -0
- package/src/cli/commands/contract.ts +168 -0
- package/src/cli/commands/failure.ts +117 -0
- package/src/cli/commands/flow.ts +275 -0
- package/src/cli/commands/index.ts +26 -0
- package/src/cli/commands/init.ts +832 -0
- package/src/cli/commands/knowledge.ts +391 -0
- package/src/cli/commands/passes-gate.ts +158 -0
- package/src/cli/commands/performance.ts +108 -0
- package/src/cli/commands/posteval-plan.ts +85 -0
- package/src/cli/commands/release.ts +159 -0
- package/src/cli/commands/report.ts +198 -0
- package/src/cli/commands/review.ts +118 -0
- package/src/cli/commands/security.ts +122 -0
- package/src/cli/commands/spec.ts +158 -0
- package/src/cli/commands/status.ts +169 -0
- package/src/cli/commands/sync-docs.ts +743 -0
- package/src/cli/commands/update-user-model.ts +527 -0
- package/src/cli/commands/validate.ts +222 -0
- package/src/constraints/__tests__/lifecycle-runner.test.ts +246 -0
- package/src/constraints/__tests__/registry.test.ts +196 -0
- package/src/constraints/index.ts +3 -0
- package/src/constraints/lifecycle-runner.ts +184 -0
- package/src/constraints/registry.ts +134 -0
- package/src/constraints/types.ts +59 -0
- package/src/context/CONTEXT.md +28 -0
- package/src/context/__tests__/compaction.test.ts +169 -0
- package/src/context/__tests__/file-budget.test.ts +142 -0
- package/src/context/__tests__/knowledge-injector.test.ts +148 -0
- package/src/context/__tests__/progressive-loader.test.ts +264 -0
- package/src/context/__tests__/session-manager.test.ts +300 -0
- package/src/context/__tests__/token-budget.test.ts +338 -0
- package/src/context/__tests__/token-pipeline.test.ts +178 -0
- package/src/context/__tests__/tool-output-budget.test.ts +95 -0
- package/src/context/compaction.ts +202 -0
- package/src/context/file-budget.ts +142 -0
- package/src/context/index.ts +15 -0
- package/src/context/knowledge-injector.ts +168 -0
- package/src/context/progressive-loader.ts +260 -0
- package/src/context/session-manager.ts +343 -0
- package/src/context/token-budget.ts +295 -0
- package/src/context/token-pipeline.ts +265 -0
- package/src/context/tool-output-budget.ts +178 -0
- package/src/context/types.ts +160 -0
- package/src/core/CONTEXT.md +26 -0
- package/src/core/constraints/__tests__/default-executors.test.ts +57 -0
- package/src/core/constraints/__tests__/interceptor.test.ts +251 -0
- package/src/core/constraints/__tests__/prompt-injection.test.ts +89 -0
- package/src/core/constraints/check-cache.ts +96 -0
- package/src/core/constraints/checker.ts +1169 -0
- package/src/core/constraints/default-executors.ts +92 -0
- package/src/core/constraints/definitions.ts +1119 -0
- package/src/core/constraints/doc-freshness/__tests__/runner.test.ts +551 -0
- package/src/core/constraints/doc-freshness/auto-fix.ts +69 -0
- package/src/core/constraints/doc-freshness/runner.ts +486 -0
- package/src/core/constraints/index.ts +78 -0
- package/src/core/constraints/interceptor.ts +220 -0
- package/src/core/constraints/prompt-injection.ts +73 -0
- package/src/core/index.ts +23 -0
- package/src/core/project-config-loader.ts +252 -0
- package/src/core/session/__tests__/startup.test.ts +281 -0
- package/src/core/session/clean-state.ts +178 -0
- package/src/core/session/index.ts +15 -0
- package/src/core/session/startup.ts +253 -0
- package/src/core/spec/__tests__/validator.test.ts +379 -0
- package/src/core/spec/index.ts +7 -0
- package/src/core/spec/validator.ts +383 -0
- package/src/core/validators/__tests__/passes-gate.test.ts +131 -0
- package/src/core/validators/checkpoint.ts +547 -0
- package/src/core/validators/cso.ts +124 -0
- package/src/core/validators/index.ts +25 -0
- package/src/core/validators/passes-gate.ts +613 -0
- package/src/dashboard/CONTEXT.md +21 -0
- package/src/dashboard/__tests__/data.test.ts +115 -0
- package/src/dashboard/__tests__/stats.test.ts +156 -0
- package/src/dashboard/data.ts +113 -0
- package/src/dashboard/index.ts +3 -0
- package/src/dashboard/stats.ts +127 -0
- package/src/dashboard/types.ts +113 -0
- package/src/evolution/CONTEXT.md +22 -0
- package/src/evolution/__tests__/auto-evolve.test.ts +320 -0
- package/src/evolution/auto-evolve.ts +98 -0
- package/src/evolution/index.ts +1 -0
- package/src/failure/CONTEXT.md +24 -0
- package/src/failure/classifier.ts +156 -0
- package/src/failure/constraint-handler.ts +173 -0
- package/src/failure/index.ts +35 -0
- package/src/failure/recorder.ts +201 -0
- package/src/failure/types.ts +165 -0
- package/src/gates/CONTEXT.md +27 -0
- package/src/gates/__tests__/acceptance.test.ts +608 -0
- package/src/gates/__tests__/command.test.ts +206 -0
- package/src/gates/__tests__/performance.test.ts +381 -0
- package/src/gates/__tests__/review.test.ts +302 -0
- package/src/gates/__tests__/security.test.ts +332 -0
- package/src/gates/acceptance.ts +493 -0
- package/src/gates/command.ts +444 -0
- package/src/gates/contract.ts +260 -0
- package/src/gates/index.ts +67 -0
- package/src/gates/performance.ts +359 -0
- package/src/gates/review.ts +169 -0
- package/src/gates/security.ts +244 -0
- package/src/gates/types.ts +159 -0
- package/src/governance/CONTEXT.md +22 -0
- package/src/governance/__tests__/executor.test.ts +249 -0
- package/src/governance/executor.ts +229 -0
- package/src/governance/index.ts +13 -0
- package/src/governance/types.ts +53 -0
- package/src/hooks/CONTEXT.md +23 -0
- package/src/hooks/__tests__/bootstrap.test.ts +184 -0
- package/src/hooks/bootstrap.ts +144 -0
- package/src/hooks/index.ts +15 -0
- package/src/hooks/pipeline.ts +157 -0
- package/src/hooks/registry.ts +88 -0
- package/src/hooks/types.ts +80 -0
- package/src/index.ts +198 -0
- package/src/knowledge/CONTEXT.md +29 -0
- package/src/knowledge/__tests__/doctor.test.ts +272 -0
- package/src/knowledge/__tests__/import.test.ts +376 -0
- package/src/knowledge/__tests__/ingest.test.ts +125 -0
- package/src/knowledge/__tests__/lifecycle-hooks.test.ts +137 -0
- package/src/knowledge/__tests__/lifecycle.test.ts +248 -0
- package/src/knowledge/__tests__/lint.test.ts +401 -0
- package/src/knowledge/__tests__/query.test.ts +185 -0
- package/src/knowledge/__tests__/reference-tracker.test.ts +129 -0
- package/src/knowledge/__tests__/store.test.ts +238 -0
- package/src/knowledge/doctor.ts +104 -0
- package/src/knowledge/import.ts +505 -0
- package/src/knowledge/index.ts +16 -0
- package/src/knowledge/ingest.ts +126 -0
- package/src/knowledge/lifecycle-hooks.ts +199 -0
- package/src/knowledge/lifecycle.ts +175 -0
- package/src/knowledge/lint.ts +360 -0
- package/src/knowledge/query.ts +150 -0
- package/src/knowledge/reference-tracker.ts +99 -0
- package/src/knowledge/store.ts +264 -0
- package/src/knowledge/types.ts +139 -0
- package/src/llm/CONTEXT.md +21 -0
- package/src/llm/__tests__/adapter.test.ts +172 -0
- package/src/llm/adapter.ts +149 -0
- package/src/llm/index.ts +2 -0
- package/src/llm/types.ts +81 -0
- package/src/monitoring/CONTEXT.md +29 -0
- package/src/monitoring/__tests__/context-tracker.test.ts +172 -0
- package/src/monitoring/__tests__/knowledge-doctor.test.ts +276 -0
- package/src/monitoring/__tests__/knowledge-evolver.test.ts +365 -0
- package/src/monitoring/__tests__/performance-analyzer.test.ts +137 -0
- package/src/monitoring/__tests__/performance-collector.test.ts +332 -0
- package/src/monitoring/__tests__/traces.test.ts +190 -0
- package/src/monitoring/constraint-doctor.ts +499 -0
- package/src/monitoring/constraint-evolver.ts +573 -0
- package/src/monitoring/context-tracker.ts +148 -0
- package/src/monitoring/index.ts +23 -0
- package/src/monitoring/knowledge-doctor.ts +323 -0
- package/src/monitoring/knowledge-evolver.ts +289 -0
- package/src/monitoring/performance-analyzer.ts +450 -0
- package/src/monitoring/performance-collector.ts +348 -0
- package/src/monitoring/trace-analyzer.ts +470 -0
- package/src/monitoring/traces.ts +339 -0
- package/src/presets/__tests__/standard.test.ts +104 -0
- package/src/presets/index.ts +16 -0
- package/src/presets/standard.ts +163 -0
- package/src/safety/CONTEXT.md +23 -0
- package/src/safety/__tests__/input-guardrail.test.ts +105 -0
- package/src/safety/__tests__/output-guardrail.test.ts +108 -0
- package/src/safety/__tests__/sandbox.test.ts +158 -0
- package/src/safety/__tests__/tool-guardrail.test.ts +127 -0
- package/src/safety/index.ts +5 -0
- package/src/safety/input-guardrail.ts +133 -0
- package/src/safety/output-guardrail.ts +174 -0
- package/src/safety/sandbox.ts +148 -0
- package/src/safety/tool-guardrail.ts +176 -0
- package/src/safety/types.ts +124 -0
- package/src/spec/CONTEXT.md +19 -0
- package/src/spec/__tests__/annotation-checker.test.ts +289 -0
- package/src/spec/annotation-checker.ts +342 -0
- package/src/tools/CONTEXT.md +25 -0
- package/src/tools/__tests__/loader.test.ts +252 -0
- package/src/tools/__tests__/registry.test.ts +157 -0
- package/src/tools/core/__tests__/core.test.ts +122 -0
- package/src/tools/core/index.ts +201 -0
- package/src/tools/core/package.json +7 -0
- package/src/tools/core/pnpm-lock.yaml +232 -0
- package/src/tools/definitions/core/code/fingerprint.sh +273 -0
- package/src/tools/definitions/core/code/fingerprint.yml +72 -0
- package/src/tools/definitions/core/code/parse.yml +68 -0
- package/src/tools/definitions/core/code/register-language.sh +475 -0
- package/src/tools/definitions/core/code/register-language.yml +74 -0
- package/src/tools/definitions/core/docker/build.yml +73 -0
- package/src/tools/definitions/core/docker/run.yml +81 -0
- package/src/tools/definitions/core/file/copy.yml +88 -0
- package/src/tools/definitions/core/file/read.yml +69 -0
- package/src/tools/definitions/core/file/write.yml +75 -0
- package/src/tools/definitions/core/git/branch.yml +61 -0
- package/src/tools/definitions/core/git/cleanup-worktree.yml +50 -0
- package/src/tools/definitions/core/git/clone.yml +69 -0
- package/src/tools/definitions/core/git/commit.yml +65 -0
- package/src/tools/definitions/core/git/push.yml +79 -0
- package/src/tools/definitions/core/git/worktree.yml +96 -0
- package/src/tools/definitions/core/notification/notify.sh +152 -0
- package/src/tools/definitions/core/notification/notify.yml +60 -0
- package/src/tools/definitions/core/npm/build.yml +75 -0
- package/src/tools/definitions/core/npm/install.yml +58 -0
- package/src/tools/definitions/core/npm/test.yml +75 -0
- package/src/tools/definitions/core/validation/check-reuse.yml +170 -0
- package/src/tools/definitions/core/validation/validate-handlers.yml +118 -0
- package/src/tools/definitions/core/validation/validate-readme-stats.yml +155 -0
- package/src/tools/definitions/core/validation/validate-yaml-syntax.yml +134 -0
- package/src/tools/definitions/ext/browser/browser-automate.sh +255 -0
- package/src/tools/definitions/ext/browser/browser-automate.yml +166 -0
- package/src/tools/definitions/ext/browser/browser-close.sh +104 -0
- package/src/tools/definitions/ext/browser/browser-close.yml +55 -0
- package/src/tools/definitions/ext/browser/browser-mcp-debug.sh +682 -0
- package/src/tools/definitions/ext/browser/browser-mcp-debug.yml +167 -0
- package/src/tools/definitions/ext/browser/browser-start.sh +101 -0
- package/src/tools/definitions/ext/browser/browser-start.yml +62 -0
- package/src/tools/definitions/registry.json +795 -0
- package/src/tools/definitions/std/README.md +350 -0
- package/src/tools/definitions/std/analysis/analyze-codebase.yml +72 -0
- package/src/tools/definitions/std/analysis/analyze-diff.yml +182 -0
- package/src/tools/definitions/std/analysis/analyze-git-diff.yml +70 -0
- package/src/tools/definitions/std/analysis/analyze-impact.yml +78 -0
- package/src/tools/definitions/std/analysis/analyze-requirements.yml +105 -0
- package/src/tools/definitions/std/analysis/brainstorm-options.yml +106 -0
- package/src/tools/definitions/std/analysis/build-graph.yml +154 -0
- package/src/tools/definitions/std/analysis/clarify-requirements.yml +90 -0
- package/src/tools/definitions/std/analysis/detect-context.yml +109 -0
- package/src/tools/definitions/std/analysis/detect-layers.yml +125 -0
- package/src/tools/definitions/std/analysis/generate-tour.yml +102 -0
- package/src/tools/definitions/std/analysis/search-enhance.yml +105 -0
- package/src/tools/definitions/std/backlog/add.yml +51 -0
- package/src/tools/definitions/std/backlog/decide.yml +39 -0
- package/src/tools/definitions/std/backlog/github-sync.yml +161 -0
- package/src/tools/definitions/std/backlog/list.yml +53 -0
- package/src/tools/definitions/std/backlog/load.yml +46 -0
- package/src/tools/definitions/std/backlog/resolve.yml +37 -0
- package/src/tools/definitions/std/backlog/update.yml +42 -0
- package/src/tools/definitions/std/bugfix/diagnose.yml +68 -0
- package/src/tools/definitions/std/bugfix/fix.yml +66 -0
- package/src/tools/definitions/std/bugfix/verify.yml +69 -0
- package/src/tools/definitions/std/constraint/check-decomposition.yml +103 -0
- package/src/tools/definitions/std/constraint/check-feature-list.yml +77 -0
- package/src/tools/definitions/std/constraint/check-progress.yml +97 -0
- package/src/tools/definitions/std/constraint/generate-report.yml +147 -0
- package/src/tools/definitions/std/deploy/commit-push.yml +33 -0
- package/src/tools/definitions/std/deploy/deploy-backend.yml +37 -0
- package/src/tools/definitions/std/deploy/deploy-frontend.yml +37 -0
- package/src/tools/definitions/std/deploy/rollback.yml +148 -0
- package/src/tools/definitions/std/design/analyze-architecture-impact.yml +113 -0
- package/src/tools/definitions/std/design/design-api.yml +55 -0
- package/src/tools/definitions/std/design/design-architecture.yml +97 -0
- package/src/tools/definitions/std/design/design-db.yml +81 -0
- package/src/tools/definitions/std/design/generate-spec.yml +182 -0
- package/src/tools/definitions/std/development/develop-api.yml +85 -0
- package/src/tools/definitions/std/development/develop-backend.yml +88 -0
- package/src/tools/definitions/std/development/develop-frontend.yml +87 -0
- package/src/tools/definitions/std/development/develop-shared-types.yml +74 -0
- package/src/tools/definitions/std/development/develop-task.yml +122 -0
- package/src/tools/definitions/std/development/develop-tests.yml +76 -0
- package/src/tools/definitions/std/development/execute-batch.yml +152 -0
- package/src/tools/definitions/std/development/fix-issues.yml +100 -0
- package/src/tools/definitions/std/development/implement-task.yml +124 -0
- package/src/tools/definitions/std/development/review-fix-cycle.yml +232 -0
- package/src/tools/definitions/std/evolution/implement.yml +125 -0
- package/src/tools/definitions/std/evolution/prioritize.yml +112 -0
- package/src/tools/definitions/std/evolution/report-gap.yml +166 -0
- package/src/tools/definitions/std/file/read.yml +21 -0
- package/src/tools/definitions/std/governance/aggregate-opinions.sh +201 -0
- package/src/tools/definitions/std/governance/aggregate-opinions.yml +79 -0
- package/src/tools/definitions/std/governance/audit-task.yml +178 -0
- package/src/tools/definitions/std/governance/cast-vote.yml +129 -0
- package/src/tools/definitions/std/governance/collect-issues.yml +16 -0
- package/src/tools/definitions/std/governance/create-signed-document.yml +23 -0
- package/src/tools/definitions/std/governance/create-voting-session.yml +101 -0
- package/src/tools/definitions/std/governance/define-stance.sh +243 -0
- package/src/tools/definitions/std/governance/define-stance.yml +82 -0
- package/src/tools/definitions/std/governance/generate-review-report.yml +23 -0
- package/src/tools/definitions/std/governance/impeach.yml +179 -0
- package/src/tools/definitions/std/governance/multi-stance-review.yml +154 -0
- package/src/tools/definitions/std/governance/prepare-artifact.yml +20 -0
- package/src/tools/definitions/std/governance/review-spec-approval.yml +262 -0
- package/src/tools/definitions/std/governance/rollback.yml +186 -0
- package/src/tools/definitions/std/governance/stance-review.yml +149 -0
- package/src/tools/definitions/std/governance/track-effect.yml +199 -0
- package/src/tools/definitions/std/governance/vote-tally.yml +144 -0
- package/src/tools/definitions/std/patch/execute.yml +51 -0
- package/src/tools/definitions/std/planning/generate-tasks.yml +36 -0
- package/src/tools/definitions/std/planning/load-tasks.yml +44 -0
- package/src/tools/definitions/std/planning/split-batch.yml +481 -0
- package/src/tools/definitions/std/planning/split-tasks.yml +359 -0
- package/src/tools/definitions/std/planning/update-tasks.yml +51 -0
- package/src/tools/definitions/std/planning/validate-tasks.yml +46 -0
- package/src/tools/definitions/std/project/decide-next-workflow.yml +38 -0
- package/src/tools/definitions/std/project/load-state.yml +31 -0
- package/src/tools/definitions/std/project/save-state.yml +32 -0
- package/src/tools/definitions/std/quality/check-quality.yml +241 -0
- package/src/tools/definitions/std/quality/debug-systematic.yml +163 -0
- package/src/tools/definitions/std/quality/handle-feedback.yml +108 -0
- package/src/tools/definitions/std/quality/review-code.yml +128 -0
- package/src/tools/definitions/std/quality/review-spec.yml +140 -0
- package/src/tools/definitions/std/quality/review-task.yml +190 -0
- package/src/tools/definitions/std/quality/run-tests.yml +80 -0
- package/src/tools/definitions/std/quick/analyze.yml +56 -0
- package/src/tools/definitions/std/quick/implement.yml +67 -0
- package/src/tools/definitions/std/quick/verify.yml +71 -0
- package/src/tools/definitions/std/verification/verify_completion.yml +113 -0
- package/src/tools/definitions/std/verification/wait-condition.yml +107 -0
- package/src/tools/index.ts +5 -0
- package/src/tools/loader.ts +216 -0
- package/src/tools/paths.ts +15 -0
- package/src/tools/registry.ts +128 -0
- package/src/tools/types.ts +46 -0
- package/src/types/__tests__/types.test.ts +86 -0
- package/src/types/checkpoint.ts +174 -0
- package/src/types/constraint.ts +335 -0
- package/src/types/cso.ts +37 -0
- package/src/types/enforcement.ts +48 -0
- package/src/types/index.ts +59 -0
- package/src/types/iron-law.ts +50 -0
- package/src/types/passes-gate.ts +185 -0
- package/src/types/performance.ts +295 -0
- package/src/types/project-config.ts +251 -0
- package/src/types/session.ts +132 -0
- package/src/types/spec.ts +91 -0
- package/src/types/trace.ts +228 -0
- package/src/utils/detect-source-roots.ts +114 -0
- package/src/utils/exec.ts +61 -0
- package/src/verification/CONTEXT.md +23 -0
- package/src/verification/__tests__/loop.test.ts +303 -0
- package/src/verification/__tests__/rules-based.test.ts +240 -0
- package/src/verification/index.ts +3 -0
- package/src/verification/loop.ts +137 -0
- package/src/verification/rules-based.ts +153 -0
- package/src/verification/types.ts +81 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 检查点类型定义
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 检查类型
|
|
7
|
+
*/
|
|
8
|
+
export type CheckType =
|
|
9
|
+
| 'file_exists'
|
|
10
|
+
| 'file_not_empty'
|
|
11
|
+
| 'file_contains'
|
|
12
|
+
| 'file_not_contains'
|
|
13
|
+
| 'command_success'
|
|
14
|
+
| 'command_output'
|
|
15
|
+
| 'output_contains'
|
|
16
|
+
| 'output_not_contains'
|
|
17
|
+
| 'output_matches'
|
|
18
|
+
| 'json_path'
|
|
19
|
+
| 'http_status'
|
|
20
|
+
| 'http_body'
|
|
21
|
+
| 'custom';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* 检查配置
|
|
25
|
+
*/
|
|
26
|
+
export interface CheckConfig {
|
|
27
|
+
/** 文件路径(用于文件检查) */
|
|
28
|
+
path?: string;
|
|
29
|
+
|
|
30
|
+
/** 预期值(用于 contains 检查) */
|
|
31
|
+
expected?: string | number | boolean | object;
|
|
32
|
+
|
|
33
|
+
/** 内容(用于 file_contains 检查) */
|
|
34
|
+
content?: string;
|
|
35
|
+
|
|
36
|
+
/** 正则表达式(用于 matches 检查) */
|
|
37
|
+
pattern?: string;
|
|
38
|
+
|
|
39
|
+
/** JSON 路径(用于 json_path 检查) */
|
|
40
|
+
jsonPath?: string;
|
|
41
|
+
|
|
42
|
+
/** HTTP URL(用于 http 检查) */
|
|
43
|
+
url?: string;
|
|
44
|
+
|
|
45
|
+
/** HTTP 方法 */
|
|
46
|
+
method?: 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
47
|
+
|
|
48
|
+
/** HTTP 请求体 */
|
|
49
|
+
body?: any;
|
|
50
|
+
|
|
51
|
+
/** HTTP 请求头 */
|
|
52
|
+
headers?: Record<string, string>;
|
|
53
|
+
|
|
54
|
+
/** 预期 HTTP 状态码 */
|
|
55
|
+
expectedStatus?: number;
|
|
56
|
+
|
|
57
|
+
/** 命令(用于 command 检查) */
|
|
58
|
+
command?: string;
|
|
59
|
+
|
|
60
|
+
/** 工作目录 */
|
|
61
|
+
workdir?: string;
|
|
62
|
+
|
|
63
|
+
/** 环境变量 */
|
|
64
|
+
env?: Record<string, string>;
|
|
65
|
+
|
|
66
|
+
/** 超时时间(毫秒) */
|
|
67
|
+
timeout?: number;
|
|
68
|
+
|
|
69
|
+
/** 自定义检查函数名 */
|
|
70
|
+
customFunction?: string;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* 检查项定义
|
|
75
|
+
*/
|
|
76
|
+
export interface CheckpointCheck {
|
|
77
|
+
/** 检查 ID */
|
|
78
|
+
id: string;
|
|
79
|
+
|
|
80
|
+
/** 检查类型 */
|
|
81
|
+
type: CheckType;
|
|
82
|
+
|
|
83
|
+
/** 检查配置 */
|
|
84
|
+
config: CheckConfig;
|
|
85
|
+
|
|
86
|
+
/** 错误消息 */
|
|
87
|
+
message?: string;
|
|
88
|
+
|
|
89
|
+
/** 是否必须通过 */
|
|
90
|
+
required?: boolean;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* 检查点定义
|
|
95
|
+
*/
|
|
96
|
+
export interface Checkpoint {
|
|
97
|
+
/** 检查点 ID */
|
|
98
|
+
id: string;
|
|
99
|
+
|
|
100
|
+
/** 检查点名称 */
|
|
101
|
+
name?: string;
|
|
102
|
+
|
|
103
|
+
/** 描述 */
|
|
104
|
+
description?: string;
|
|
105
|
+
|
|
106
|
+
/** 检查列表 */
|
|
107
|
+
checks: CheckpointCheck[];
|
|
108
|
+
|
|
109
|
+
/** 是否必须全部通过 */
|
|
110
|
+
requireAll?: boolean;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* 单项检查结果
|
|
115
|
+
*/
|
|
116
|
+
export interface CheckResult {
|
|
117
|
+
/** 检查 ID */
|
|
118
|
+
checkId: string;
|
|
119
|
+
|
|
120
|
+
/** 是否通过 */
|
|
121
|
+
passed: boolean;
|
|
122
|
+
|
|
123
|
+
/** 消息 */
|
|
124
|
+
message?: string;
|
|
125
|
+
|
|
126
|
+
/** 错误详情 */
|
|
127
|
+
error?: string;
|
|
128
|
+
|
|
129
|
+
/** 实际值 */
|
|
130
|
+
actual?: any;
|
|
131
|
+
|
|
132
|
+
/** 预期值 */
|
|
133
|
+
expected?: any;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* 检查点验证结果
|
|
138
|
+
*/
|
|
139
|
+
export interface CheckpointResult {
|
|
140
|
+
/** 检查点 ID */
|
|
141
|
+
checkpointId: string;
|
|
142
|
+
|
|
143
|
+
/** 是否全部通过 */
|
|
144
|
+
passed: boolean;
|
|
145
|
+
|
|
146
|
+
/** 各项检查结果 */
|
|
147
|
+
checks: CheckResult[];
|
|
148
|
+
|
|
149
|
+
/** 消息 */
|
|
150
|
+
message?: string;
|
|
151
|
+
|
|
152
|
+
/** 验证时间 */
|
|
153
|
+
validatedAt: Date;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* 检查点验证上下文
|
|
158
|
+
*/
|
|
159
|
+
export interface CheckpointContext {
|
|
160
|
+
/** 项目路径 */
|
|
161
|
+
projectPath: string;
|
|
162
|
+
|
|
163
|
+
/** 工作目录 */
|
|
164
|
+
workdir: string;
|
|
165
|
+
|
|
166
|
+
/** 环境变量 */
|
|
167
|
+
env?: Record<string, string>;
|
|
168
|
+
|
|
169
|
+
/** 步骤输出(用于 output_* 检查) */
|
|
170
|
+
output?: any;
|
|
171
|
+
|
|
172
|
+
/** 自定义检查处理器 */
|
|
173
|
+
customHandlers?: Map<string, (config: CheckConfig) => Promise<CheckResult>>;
|
|
174
|
+
}
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 约束类型定义
|
|
3
|
+
*
|
|
4
|
+
* 三层约束体系:
|
|
5
|
+
* - Iron Laws:绝对禁止,无例外,违背即阻止执行
|
|
6
|
+
* - Guidelines:优先建议,有例外,违背发警告但不阻止
|
|
7
|
+
* - Tips:信息性提示,可忽略
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 约束 ID
|
|
12
|
+
*/
|
|
13
|
+
export type ConstraintId = string;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 约束层级
|
|
17
|
+
*/
|
|
18
|
+
export type ConstraintLevel = 'iron_law' | 'guideline' | 'tip';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 约束触发条件
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* 约束触发器(开放扩展)
|
|
25
|
+
*
|
|
26
|
+
* 从硬编码 union type 改为 string,consumer 可传入任意 trigger。
|
|
27
|
+
* 无需修改 harness 即可添加领域特定 trigger。
|
|
28
|
+
*
|
|
29
|
+
* 以下为推荐的抽象 trigger 常量。领域概念(如 deploy、
|
|
30
|
+
* config_update 等)由 consumer 自行管理。
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
export const CODE_IMPLEMENTATION = 'code_implementation' as const;
|
|
34
|
+
export const FILE_MODIFICATION = 'file_modification' as const;
|
|
35
|
+
export const FILE_CREATION = 'file_creation' as const;
|
|
36
|
+
export const FILE_DELETION = 'file_deletion' as const;
|
|
37
|
+
export const MODULE_CREATION = 'module_creation' as const;
|
|
38
|
+
export const MODULE_MODIFICATION = 'module_modification' as const;
|
|
39
|
+
export const MODULE_DELETION = 'module_deletion' as const;
|
|
40
|
+
export const MODULE_EXTENSION = 'module_extension' as const;
|
|
41
|
+
export const API_CHANGE = 'api_change' as const;
|
|
42
|
+
export const EXPORT_CHANGE = 'export_change' as const;
|
|
43
|
+
export const TEST_CREATION = 'test_creation' as const;
|
|
44
|
+
export const COMMIT = 'commit' as const;
|
|
45
|
+
export const PUSH = 'push' as const;
|
|
46
|
+
export const MERGE = 'merge' as const;
|
|
47
|
+
export const DESIGN_REQUEST = 'design_request' as const;
|
|
48
|
+
export const ARCHITECTURE_CHANGE = 'architecture_change' as const;
|
|
49
|
+
|
|
50
|
+
export type ConstraintTrigger = string;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* 约束定义
|
|
54
|
+
*/
|
|
55
|
+
export interface Constraint {
|
|
56
|
+
/** 约束 ID */
|
|
57
|
+
id: ConstraintId;
|
|
58
|
+
|
|
59
|
+
/** 约束规则(英文) */
|
|
60
|
+
rule: string;
|
|
61
|
+
|
|
62
|
+
/** 约束消息(中文) */
|
|
63
|
+
message: string;
|
|
64
|
+
|
|
65
|
+
/** 约束层级 */
|
|
66
|
+
level: ConstraintLevel;
|
|
67
|
+
|
|
68
|
+
/** 触发条件(支持多个 trigger) */
|
|
69
|
+
trigger: ConstraintTrigger | ConstraintTrigger[];
|
|
70
|
+
|
|
71
|
+
/** 强制执行的技能/步骤 */
|
|
72
|
+
enforcement: string;
|
|
73
|
+
|
|
74
|
+
/** 约束描述 */
|
|
75
|
+
description?: string;
|
|
76
|
+
|
|
77
|
+
/** 软约束 prompt 注入(引导 Agent 行为的提示文本) */
|
|
78
|
+
promptInjection?: string;
|
|
79
|
+
|
|
80
|
+
/** 是否注入 Agent prompt(默认 iron_law=true, guideline=false) */
|
|
81
|
+
injectPrompt?: boolean;
|
|
82
|
+
|
|
83
|
+
/** 是否启用 */
|
|
84
|
+
enabled?: boolean;
|
|
85
|
+
|
|
86
|
+
/** 例外条件(仅 Guidelines 有效) */
|
|
87
|
+
exceptions?: string[];
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// ========================================
|
|
91
|
+
// 向后兼容的类型别名
|
|
92
|
+
// ========================================
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* @deprecated 使用 ConstraintId 代替
|
|
96
|
+
*/
|
|
97
|
+
export type IronLawId = ConstraintId;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* @deprecated 使用 ConstraintLevel 代替
|
|
101
|
+
*/
|
|
102
|
+
export type IronLawSeverity = 'error' | 'warning' | 'info';
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* @deprecated 使用 ConstraintTrigger 代替
|
|
106
|
+
*/
|
|
107
|
+
export type IronLawTrigger = ConstraintTrigger;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* @deprecated 使用 Constraint 代替
|
|
111
|
+
*/
|
|
112
|
+
export interface IronLaw extends Constraint {
|
|
113
|
+
/** @deprecated 使用 level 代替 */
|
|
114
|
+
severity?: IronLawSeverity;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* 约束检查结果
|
|
119
|
+
*/
|
|
120
|
+
export interface ConstraintResult {
|
|
121
|
+
/** 约束 ID */
|
|
122
|
+
id: ConstraintId;
|
|
123
|
+
|
|
124
|
+
/** 约束层级 */
|
|
125
|
+
level: ConstraintLevel;
|
|
126
|
+
|
|
127
|
+
/** 是否满足 */
|
|
128
|
+
satisfied: boolean;
|
|
129
|
+
|
|
130
|
+
/** 约束定义 */
|
|
131
|
+
constraint?: Constraint;
|
|
132
|
+
|
|
133
|
+
/** 消息 */
|
|
134
|
+
message?: string;
|
|
135
|
+
|
|
136
|
+
/** 建议操作 */
|
|
137
|
+
requiredAction?: string;
|
|
138
|
+
|
|
139
|
+
/** 检查时间 */
|
|
140
|
+
checkedAt: Date;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* @deprecated 使用 ConstraintResult 代替
|
|
145
|
+
*/
|
|
146
|
+
export interface IronLawResult extends ConstraintResult {
|
|
147
|
+
/** @deprecated */
|
|
148
|
+
law?: Constraint;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* 约束检查上下文
|
|
153
|
+
*/
|
|
154
|
+
export interface ConstraintContext {
|
|
155
|
+
/** 当前操作类型 */
|
|
156
|
+
operation: ConstraintTrigger;
|
|
157
|
+
|
|
158
|
+
/** 工作流 ID */
|
|
159
|
+
workflowId?: string;
|
|
160
|
+
|
|
161
|
+
/** 步骤 ID */
|
|
162
|
+
stepId?: string;
|
|
163
|
+
|
|
164
|
+
/** 任务描述 */
|
|
165
|
+
taskDescription?: string;
|
|
166
|
+
|
|
167
|
+
/** 项目路径 */
|
|
168
|
+
projectPath?: string;
|
|
169
|
+
|
|
170
|
+
/** 会话 ID(用于追踪同一会话的多次检查) */
|
|
171
|
+
sessionId?: string;
|
|
172
|
+
|
|
173
|
+
/** 变更的文件列表 */
|
|
174
|
+
changedFiles?: string[];
|
|
175
|
+
|
|
176
|
+
/** 提交信息 */
|
|
177
|
+
commitMessage?: string;
|
|
178
|
+
|
|
179
|
+
/** 分支名称 */
|
|
180
|
+
branch?: string;
|
|
181
|
+
|
|
182
|
+
// ========================================
|
|
183
|
+
// 前置条件检查
|
|
184
|
+
// ========================================
|
|
185
|
+
|
|
186
|
+
/** 是否有根本原因调查 */
|
|
187
|
+
hasRootCauseInvestigation?: boolean;
|
|
188
|
+
|
|
189
|
+
/** 是否已通过诊断→修复闸门(设计方案已确认) */
|
|
190
|
+
hasPlanApproval?: boolean;
|
|
191
|
+
|
|
192
|
+
/** 是否有验证证据 */
|
|
193
|
+
hasVerificationEvidence?: boolean;
|
|
194
|
+
|
|
195
|
+
/** 是否有测试 */
|
|
196
|
+
hasTest?: boolean;
|
|
197
|
+
|
|
198
|
+
/** 是否有失败的测试 */
|
|
199
|
+
hasFailingTest?: boolean;
|
|
200
|
+
|
|
201
|
+
/** 是否已进行复用检查 */
|
|
202
|
+
hasReuseCheck?: boolean;
|
|
203
|
+
|
|
204
|
+
/** 复用检查结果 */
|
|
205
|
+
reuseCheckResult?: {
|
|
206
|
+
existingCapabilities: string[];
|
|
207
|
+
canReuse: boolean;
|
|
208
|
+
reuseRecommendation: string;
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
/** 是否只处理单个任务(用于 incremental_progress) */
|
|
212
|
+
hasSingleTask?: boolean;
|
|
213
|
+
|
|
214
|
+
/** 是否已验证外部能力(用于 verify_external_capability) */
|
|
215
|
+
hasExternalCapabilityVerification?: boolean;
|
|
216
|
+
|
|
217
|
+
/** 是否已对比需求验证(用于 no_implementation_without_requirement_review) */
|
|
218
|
+
hasRequirementReview?: boolean;
|
|
219
|
+
|
|
220
|
+
/** 是否有需求文档(用于 no_implementation_without_requirement) */
|
|
221
|
+
hasRequirement?: boolean;
|
|
222
|
+
|
|
223
|
+
/** 是否在 worktree 中执行(用于 must_use_worktree) */
|
|
224
|
+
hasWorktree?: boolean;
|
|
225
|
+
|
|
226
|
+
/** worktree 路径(用于 worktree 相关检查) */
|
|
227
|
+
worktreePath?: string;
|
|
228
|
+
|
|
229
|
+
/** 完成声明文本(用于 fuzzy/excuse 检查) */
|
|
230
|
+
completionClaimText?: string;
|
|
231
|
+
|
|
232
|
+
/** 是否完成两阶段审查(用于 two_stage_review_required) */
|
|
233
|
+
hasTwoStageReview?: boolean;
|
|
234
|
+
|
|
235
|
+
// ========================================
|
|
236
|
+
// 例外条件(用于 Guidelines)
|
|
237
|
+
// ========================================
|
|
238
|
+
|
|
239
|
+
// simplest_solution_first 例外
|
|
240
|
+
scalabilityRequired?: boolean;
|
|
241
|
+
securityRequired?: boolean;
|
|
242
|
+
performanceRequired?: boolean;
|
|
243
|
+
reliabilityRequired?: boolean;
|
|
244
|
+
|
|
245
|
+
// no_fix_without_root_cause 例外
|
|
246
|
+
isSimpleTypo?: boolean;
|
|
247
|
+
isConfigValueError?: boolean;
|
|
248
|
+
isMissingConfig?: boolean;
|
|
249
|
+
|
|
250
|
+
// no_code_without_test 例外
|
|
251
|
+
isConfigFile?: boolean;
|
|
252
|
+
isTypeDefinition?: boolean;
|
|
253
|
+
isSimpleAccessor?: boolean;
|
|
254
|
+
isPureDisplayComponent?: boolean;
|
|
255
|
+
|
|
256
|
+
// no_any_type 例外
|
|
257
|
+
isJsonParseResult?: boolean;
|
|
258
|
+
isThirdPartyNoTypes?: boolean;
|
|
259
|
+
isLegacyMigration?: boolean;
|
|
260
|
+
|
|
261
|
+
// capability_sync 例外
|
|
262
|
+
isInternalRefactor?: boolean;
|
|
263
|
+
isBugFixOnly?: boolean;
|
|
264
|
+
isPerformanceOptimization?: boolean;
|
|
265
|
+
|
|
266
|
+
// no_simplification_without_approval 例外
|
|
267
|
+
isRedundantCodeCleanup?: boolean;
|
|
268
|
+
isSameEffectRefactor?: boolean;
|
|
269
|
+
isUnusedCodeRemoval?: boolean;
|
|
270
|
+
|
|
271
|
+
// 设计决策例外
|
|
272
|
+
isExplicitInstruction?: boolean;
|
|
273
|
+
isEmergencyFix?: boolean;
|
|
274
|
+
isExistingDesign?: boolean;
|
|
275
|
+
|
|
276
|
+
// 外部依赖相关
|
|
277
|
+
isExternalDependency?: boolean;
|
|
278
|
+
|
|
279
|
+
/** 例外理由说明 */
|
|
280
|
+
exceptionReason?: string;
|
|
281
|
+
|
|
282
|
+
/** 执行上下文 */
|
|
283
|
+
executionContext?: any;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* @deprecated 使用 ConstraintContext 代替
|
|
288
|
+
*/
|
|
289
|
+
export type IronLawContext = ConstraintContext;
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* 约束违规错误
|
|
293
|
+
*/
|
|
294
|
+
export class ConstraintViolationError extends Error {
|
|
295
|
+
public readonly result: ConstraintResult;
|
|
296
|
+
|
|
297
|
+
constructor(result: ConstraintResult) {
|
|
298
|
+
super(result.message || 'Constraint violation');
|
|
299
|
+
this.name = 'ConstraintViolationError';
|
|
300
|
+
this.result = result;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* @deprecated 使用 ConstraintViolationError 代替
|
|
306
|
+
*/
|
|
307
|
+
export class IronLawViolationError extends ConstraintViolationError {
|
|
308
|
+
constructor(result: ConstraintResult) {
|
|
309
|
+
super(result);
|
|
310
|
+
this.name = 'IronLawViolationError';
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* 三层约束检查结果
|
|
316
|
+
*/
|
|
317
|
+
export interface ConstraintCheckResult {
|
|
318
|
+
/** 铁律检查结果(必须全部通过) */
|
|
319
|
+
ironLaws: ConstraintResult[];
|
|
320
|
+
|
|
321
|
+
/** 指导原则检查结果(警告,不阻止) */
|
|
322
|
+
guidelines: ConstraintResult[];
|
|
323
|
+
|
|
324
|
+
/** 提示检查结果(仅提示) */
|
|
325
|
+
tips: ConstraintResult[];
|
|
326
|
+
|
|
327
|
+
/** 是否通过(铁律全部通过) */
|
|
328
|
+
passed: boolean;
|
|
329
|
+
|
|
330
|
+
/** 警告数量 */
|
|
331
|
+
warningCount: number;
|
|
332
|
+
|
|
333
|
+
/** 提示数量 */
|
|
334
|
+
tipCount: number;
|
|
335
|
+
}
|
package/src/types/cso.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSO (Concise Skill Optimization) 类型定义
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Workflow 元数据
|
|
7
|
+
*/
|
|
8
|
+
export interface WorkflowMeta {
|
|
9
|
+
/** 工作流名称 */
|
|
10
|
+
name: string;
|
|
11
|
+
/** 工作流描述 */
|
|
12
|
+
description: string;
|
|
13
|
+
/** 工作流步骤 */
|
|
14
|
+
steps?: StepMeta[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Step 元数据
|
|
19
|
+
*/
|
|
20
|
+
export interface StepMeta {
|
|
21
|
+
/** 步骤名称 */
|
|
22
|
+
name: string;
|
|
23
|
+
/** 步骤描述 */
|
|
24
|
+
description: string;
|
|
25
|
+
/** 步骤工具 */
|
|
26
|
+
tools?: ToolMeta[];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Tool 元数据
|
|
31
|
+
*/
|
|
32
|
+
export interface ToolMeta {
|
|
33
|
+
/** 工具名称 */
|
|
34
|
+
name: string;
|
|
35
|
+
/** 工具描述 */
|
|
36
|
+
description: string;
|
|
37
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enforcement 执行器类型定义
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { Constraint, ConstraintContext } from './constraint';
|
|
6
|
+
|
|
7
|
+
export type EnforcementId = string;
|
|
8
|
+
|
|
9
|
+
export interface EnforcementContext extends ConstraintContext {
|
|
10
|
+
enforcementId: EnforcementId;
|
|
11
|
+
constraint: Constraint;
|
|
12
|
+
params?: Record<string, any>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface EnforcementResult {
|
|
16
|
+
passed: boolean;
|
|
17
|
+
evidence?: string;
|
|
18
|
+
message?: string;
|
|
19
|
+
error?: string;
|
|
20
|
+
duration?: number;
|
|
21
|
+
validatedAt?: Date;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface EnforcementExecutor {
|
|
25
|
+
execute(context: EnforcementContext): Promise<EnforcementResult>;
|
|
26
|
+
description?: string;
|
|
27
|
+
supportedParams?: string[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface EnforcementRegistration {
|
|
31
|
+
id: EnforcementId;
|
|
32
|
+
executor: EnforcementExecutor;
|
|
33
|
+
registeredAt: Date;
|
|
34
|
+
source?: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface InterceptionResult {
|
|
38
|
+
passed: boolean;
|
|
39
|
+
constraints: {
|
|
40
|
+
constraint: Constraint;
|
|
41
|
+
enforcementResult?: EnforcementResult;
|
|
42
|
+
skipped?: boolean;
|
|
43
|
+
skipReason?: string;
|
|
44
|
+
}[];
|
|
45
|
+
violations: Constraint[];
|
|
46
|
+
message?: string;
|
|
47
|
+
interceptedAt: Date;
|
|
48
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 类型导出
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
// 约束类型(三层体系)
|
|
6
|
+
export * from './constraint';
|
|
7
|
+
|
|
8
|
+
export * from './checkpoint';
|
|
9
|
+
export * from './passes-gate';
|
|
10
|
+
export * from './cso';
|
|
11
|
+
|
|
12
|
+
// Trace 类型(Execution Trace 系统)
|
|
13
|
+
export * from './trace';
|
|
14
|
+
|
|
15
|
+
// Performance 类型(Performance Trace 系统)
|
|
16
|
+
export * from './performance';
|
|
17
|
+
|
|
18
|
+
// 诊断和提案类型(从 monitoring 导入)
|
|
19
|
+
export type { Diagnosis } from '../monitoring/constraint-doctor';
|
|
20
|
+
export type {
|
|
21
|
+
ConstraintProposal,
|
|
22
|
+
ProposalReviewResult,
|
|
23
|
+
} from '../monitoring/constraint-evolver';
|
|
24
|
+
|
|
25
|
+
// Session 类型(排除与 passes-gate 冲突的类型)
|
|
26
|
+
export {
|
|
27
|
+
StartupCheckpoints,
|
|
28
|
+
StartupCheckpointType,
|
|
29
|
+
StartupCheckpointResult,
|
|
30
|
+
CleanStateConfig,
|
|
31
|
+
CleanStateResult,
|
|
32
|
+
DetectedBug,
|
|
33
|
+
TaskListJson,
|
|
34
|
+
TaskStepStatus,
|
|
35
|
+
SessionInfo,
|
|
36
|
+
} from './session';
|
|
37
|
+
|
|
38
|
+
// 从 session 导入 DynamicTask,扩展 passes-gate 的定义
|
|
39
|
+
export { DynamicTask as ExtendedDynamicTask, TaskTestResult as ExtendedTaskTestResult } from './session';
|
|
40
|
+
|
|
41
|
+
// 项目配置类型
|
|
42
|
+
export * from './project-config';
|
|
43
|
+
|
|
44
|
+
// Enforcement 类型
|
|
45
|
+
export * from './enforcement';
|
|
46
|
+
|
|
47
|
+
// Spec 验证类型
|
|
48
|
+
export * from './spec';
|
|
49
|
+
|
|
50
|
+
// Failure 类型(从 failure 模块导入)
|
|
51
|
+
export {
|
|
52
|
+
ErrorType,
|
|
53
|
+
FailureLevel,
|
|
54
|
+
ErrorClassificationRule,
|
|
55
|
+
FailureRecord,
|
|
56
|
+
ClassificationResult,
|
|
57
|
+
DEFAULT_CLASSIFICATION_RULES,
|
|
58
|
+
DEFAULT_LEVEL_MAPPING,
|
|
59
|
+
} from '../failure/types';
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 铁律类型定义
|
|
3
|
+
*
|
|
4
|
+
* @deprecated 请使用 './constraint' 代替
|
|
5
|
+
*
|
|
6
|
+
* 此模块保留用于向后兼容。
|
|
7
|
+
* 新代码应使用三层约束类型:
|
|
8
|
+
* - Constraint
|
|
9
|
+
* - ConstraintLevel ('iron_law' | 'guideline' | 'tip')
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import type {
|
|
13
|
+
ConstraintId,
|
|
14
|
+
ConstraintLevel,
|
|
15
|
+
ConstraintTrigger,
|
|
16
|
+
Constraint,
|
|
17
|
+
ConstraintResult,
|
|
18
|
+
ConstraintContext,
|
|
19
|
+
} from './constraint';
|
|
20
|
+
|
|
21
|
+
import { ConstraintViolationError } from './constraint';
|
|
22
|
+
|
|
23
|
+
// 重新导出新的约束类型
|
|
24
|
+
export type {
|
|
25
|
+
ConstraintId as IronLawId,
|
|
26
|
+
ConstraintLevel,
|
|
27
|
+
ConstraintTrigger as IronLawTrigger,
|
|
28
|
+
Constraint as IronLaw,
|
|
29
|
+
ConstraintResult as IronLawResult,
|
|
30
|
+
ConstraintContext as IronLawContext,
|
|
31
|
+
} from './constraint';
|
|
32
|
+
|
|
33
|
+
export {
|
|
34
|
+
ConstraintViolationError as IronLawViolationError,
|
|
35
|
+
} from './constraint';
|
|
36
|
+
|
|
37
|
+
// 向后兼容的 severity 类型
|
|
38
|
+
export type IronLawSeverity = 'error' | 'warning' | 'info';
|
|
39
|
+
|
|
40
|
+
// 向后兼容的配置类型
|
|
41
|
+
export interface IronLawConfig {
|
|
42
|
+
/** @deprecated */
|
|
43
|
+
ironLaws: Constraint[];
|
|
44
|
+
/** @deprecated */
|
|
45
|
+
preset?: 'strict' | 'standard' | 'relaxed';
|
|
46
|
+
/** @deprecated */
|
|
47
|
+
enabled?: boolean;
|
|
48
|
+
/** @deprecated */
|
|
49
|
+
configPath?: string;
|
|
50
|
+
}
|