claude-flow-novice 2.15.2 → 2.15.4
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/.claude/cfn-extras/skills/advanced-features/cfn-agent-swap/recommend-swap.sh +59 -59
- package/.claude/cfn-extras/skills/analytics/cfn-improvement-recommender/recommend-improvements.sh +91 -91
- package/.claude/cfn-extras/skills/analytics/cfn-pattern-extraction/extract-patterns.sh +79 -79
- package/.claude/cfn-extras/skills/analytics/cfn-retrospective-report/generate-report.sh +100 -100
- package/.claude/cfn-extras/skills/analytics/cfn-telemetry/start-telemetry.sh +110 -110
- package/.claude/cfn-extras/skills/deprecated/cfn-ace-system/add-bullet.sh +145 -145
- package/.claude/cfn-extras/skills/deprecated/cfn-ace-system/log-merge.sh +67 -67
- package/.claude/cfn-extras/skills/deprecated/cfn-ace-system/monitor-injection-performance.sh +137 -137
- package/.claude/cfn-extras/skills/deprecated/cfn-ace-system/optimize-injection-pipeline.sh +168 -168
- package/.claude/cfn-extras/skills/deprecated/cfn-ace-system/query-reflections.sh +35 -35
- package/.claude/cfn-extras/skills/deprecated/cfn-ace-system/store-reflection.sh +45 -45
- package/.claude/cfn-extras/skills/deprecated/cfn-ace-system/track-ab-test.sh +41 -41
- package/.claude/cfn-extras/skills/deprecated/cfn-ace-system/update-reflection.sh +41 -41
- package/.claude/cfn-extras/skills/deprecated/cfn-cli-setup/validate-cli-environment.sh +191 -191
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-ad-campaigns/operations/create-campaign.sh +231 -231
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-ad-campaigns/operations/get-campaign-performance.sh +190 -190
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-ad-campaigns/operations/pause-campaign.sh +142 -142
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-ad-campaigns/operations/set-budget.sh +181 -181
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-ad-campaigns/operations/update-bid-strategy.sh +133 -133
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-chatbot-conversations/operations/get-conversation-history.sh +121 -121
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-chatbot-conversations/operations/qualify-lead.sh +156 -156
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-chatbot-conversations/operations/schedule-demo.sh +181 -181
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-chatbot-conversations/operations/send-message.sh +137 -137
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-chatbot-conversations/operations/transfer-to-human.sh +179 -179
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-sms-campaigns/operations/create-campaign.sh +183 -183
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-sms-campaigns/operations/get-delivery-status.sh +139 -139
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-sms-campaigns/operations/opt-out.sh +150 -150
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-sms-campaigns/operations/schedule-campaign.sh +187 -187
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-sms-campaigns/operations/send-sms.sh +181 -181
- package/.claude/cfn-extras/skills/ui-portal/cfn-web-portal/test-web-portal-skill.sh +50 -50
- package/.claude/cfn-extras/skills/ui-portal/cfn-web-portal/validate-deployment.sh +84 -84
- package/.claude/cfn-extras/skills/utility/cfn-environment-sanitization/sanitize-environment.sh +243 -243
- package/.claude/commands/cfn-loop-cli.md +16 -2
- package/.claude/commands/switch-api.md +31 -10
- package/.claude/hooks/cfn-BACKUP_USAGE.md +243 -243
- package/.claude/hooks/cfn-invoke-security-validation.sh +69 -69
- package/.claude/hooks/cfn-lint-sql-injection.sh +61 -0
- package/.claude/hooks/cfn-post-edit-cfn-retrospective.sh +109 -78
- package/.claude/hooks/cfn-post-edit.config.json +44 -44
- package/.claude/hooks/cfn-pre-edit-security-warning.sh +40 -0
- package/.claude/skills/cfn-agent-spawning/spawn-agent.sh +22 -24
- package/.claude/skills/cfn-docker-agent-spawning/SKILL.md +28 -4
- package/.claude/skills/cfn-docker-agent-spawning/spawn-agent.sh +3 -1
- package/.claude/skills/cfn-docker-loop-orchestration/orchestrate.sh +224 -20
- package/.claude/skills/cfn-hybrid-routing/check-dependencies.sh +51 -51
- package/.claude/skills/cfn-loop-orchestration/helpers/gate-check.sh +550 -46
- package/.claude/skills/cfn-loop-orchestration/helpers/parse-test-results.sh +277 -0
- package/.claude/skills/cfn-loop-orchestration/orchestrate.sh +184 -23
- package/.claude/skills/cfn-loop-orchestration/security_utils.sh +24 -0
- package/.claude/skills/cfn-loop-orchestration/test-iteration-context-injection.sh +366 -0
- package/.claude/skills/cfn-loop-validation/orchestrate-cfn-loop.sh +252 -252
- package/.claude/skills/cfn-redis-coordination/CENTRALIZED_REDIS_WRAPPER.md +319 -0
- package/.claude/skills/cfn-redis-coordination/agent-log.sh +4 -0
- package/.claude/skills/cfn-redis-coordination/agent-log.sh.bak +124 -0
- package/.claude/skills/cfn-redis-coordination/agent-recovery.sh +74 -74
- package/.claude/skills/cfn-redis-coordination/collect-confidence-scores.sh +30 -0
- package/.claude/skills/cfn-redis-coordination/get-context.sh +145 -112
- package/.claude/skills/cfn-redis-coordination/get-success-criteria.sh +54 -0
- package/.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh +3 -0
- package/.claude/skills/cfn-redis-coordination/redis-cli-wrapper.sh +24 -3
- package/.claude/skills/cfn-redis-coordination/redis-functions.sh +33 -0
- package/.claude/skills/cfn-redis-coordination/report-completion.sh +24 -31
- package/.claude/skills/cfn-redis-coordination/store-context.sh +4 -0
- package/.claude/skills/cfn-redis-coordination/store-success-criteria.sh +85 -0
- package/.claude/skills/cfn-redis-coordination/update-all-scripts.sh +67 -0
- package/.claude/skills/cfn-sqlite-memory/ttl-cleanup.sh +17 -25
- package/.claude/skills/cfn-transparency-middleware/middleware-config.sh +28 -28
- package/.claude/skills/cfn-transparency-middleware/performance-benchmark.sh +78 -78
- package/.claude/skills/cfn-transparency-middleware/test-e2e.sh +15 -0
- package/.claude/skills/cfn-transparency-middleware/test-integration.sh +161 -161
- package/.claude/skills/cfn-transparency-middleware/test-transparency-skill.sh +367 -367
- package/.claude/skills/cfn-transparency-middleware/tests/input-validation.sh +107 -92
- package/.claude/skills/cfn-transparency-middleware/wrap-agent.sh +131 -131
- package/README.md +116 -475
- package/claude-assets/agents/cfn-dev-team/README.md +103 -0
- package/claude-assets/agents/cfn-dev-team/architecture/goal-planner.md +1 -1
- package/claude-assets/agents/cfn-dev-team/coordinators/cfn-frontend-coordinator.md +77 -15
- package/claude-assets/agents/cfn-dev-team/coordinators/cfn-v3-coordinator.md +355 -6
- package/claude-assets/agents/cfn-dev-team/coordinators/consensus-builder.md +82 -1
- package/claude-assets/agents/cfn-dev-team/coordinators/handoff-coordinator.md +82 -1
- package/claude-assets/agents/cfn-dev-team/coordinators/multi-sprint-coordinator.md +77 -15
- package/claude-assets/agents/cfn-dev-team/dev-ops/docker-specialist.md +99 -12
- package/claude-assets/agents/cfn-dev-team/dev-ops/github-commit-agent.md +1 -1
- package/claude-assets/agents/cfn-dev-team/dev-ops/kubernetes-specialist.md +97 -0
- package/claude-assets/agents/cfn-dev-team/dev-ops/monitoring-specialist.md +20 -1
- package/claude-assets/agents/cfn-dev-team/developers/api-gateway-specialist.md +97 -0
- package/claude-assets/agents/cfn-dev-team/developers/backend-developer.md +110 -13
- package/claude-assets/agents/cfn-dev-team/developers/data/data-engineer.md +106 -15
- package/claude-assets/agents/cfn-dev-team/developers/database/database-architect.md +115 -11
- package/claude-assets/agents/cfn-dev-team/developers/frontend/mobile-dev.md +94 -7
- package/claude-assets/agents/cfn-dev-team/developers/frontend/react-frontend-engineer.md +87 -9
- package/claude-assets/agents/cfn-dev-team/developers/frontend/typescript-specialist.md +85 -7
- package/claude-assets/agents/cfn-dev-team/developers/frontend/ui-designer.md +160 -28
- package/claude-assets/agents/cfn-dev-team/developers/graphql-specialist.md +101 -19
- package/claude-assets/agents/cfn-dev-team/developers/rust-developer.md +108 -14
- package/claude-assets/agents/cfn-dev-team/reviewers/{reviewer.md → code-reviewer.md} +95 -8
- package/claude-assets/agents/cfn-dev-team/reviewers/quality/code-quality-validator.md +107 -7
- package/claude-assets/agents/cfn-dev-team/reviewers/quality/perf-analyzer.md +98 -7
- package/claude-assets/agents/cfn-dev-team/reviewers/quality/performance-benchmarker.md +95 -7
- package/claude-assets/agents/cfn-dev-team/reviewers/quality/security-specialist.md +136 -9
- package/claude-assets/agents/cfn-dev-team/testers/api-testing-specialist.md +108 -1
- package/claude-assets/agents/cfn-dev-team/testers/chaos-engineering-specialist.md +107 -13
- package/claude-assets/agents/cfn-dev-team/testers/contract-tester.md +737 -0
- package/claude-assets/agents/cfn-dev-team/testers/e2e/playwright-tester.md +1 -1
- package/claude-assets/agents/cfn-dev-team/testers/integration-tester.md +828 -0
- package/claude-assets/agents/cfn-dev-team/testers/interaction-tester.md +106 -7
- package/claude-assets/agents/cfn-dev-team/testers/load-testing-specialist.md +77 -0
- package/claude-assets/agents/cfn-dev-team/testers/mutation-testing-specialist.md +684 -0
- package/claude-assets/agents/cfn-dev-team/testers/playwright-tester.md +110 -1
- package/claude-assets/agents/cfn-dev-team/testers/tester.md +94 -7
- package/claude-assets/agents/cfn-dev-team/utility/code-booster.md +1 -3
- package/claude-assets/agents/cfn-dev-team/utility/epic-creator.md +87 -13
- package/claude-assets/agents/cfn-dev-team/utility/memory-leak-specialist.md +103 -7
- package/claude-assets/agents/cfn-dev-team/utility/researcher.md +1 -3
- package/claude-assets/agents/cfn-dev-team/utility/z-ai-specialist.md +94 -7
- package/claude-assets/agents/docker-coordinators/cfn-docker-v3-coordinator.md +46 -0
- package/claude-assets/agents/project-only-agents/npm-package-specialist.md +1 -1
- package/claude-assets/cfn-extras/skills/advanced-features/cfn-agent-swap/recommend-swap.sh +59 -59
- package/claude-assets/cfn-extras/skills/analytics/cfn-improvement-recommender/recommend-improvements.sh +91 -91
- package/claude-assets/cfn-extras/skills/analytics/cfn-pattern-extraction/extract-patterns.sh +79 -79
- package/claude-assets/cfn-extras/skills/analytics/cfn-retrospective-report/generate-report.sh +100 -100
- package/claude-assets/cfn-extras/skills/analytics/cfn-telemetry/start-telemetry.sh +110 -110
- package/claude-assets/cfn-extras/skills/deprecated/cfn-ace-system/add-bullet.sh +145 -145
- package/claude-assets/cfn-extras/skills/deprecated/cfn-ace-system/log-merge.sh +67 -67
- package/claude-assets/cfn-extras/skills/deprecated/cfn-ace-system/monitor-injection-performance.sh +137 -137
- package/claude-assets/cfn-extras/skills/deprecated/cfn-ace-system/optimize-injection-pipeline.sh +168 -168
- package/claude-assets/cfn-extras/skills/deprecated/cfn-ace-system/query-reflections.sh +35 -35
- package/claude-assets/cfn-extras/skills/deprecated/cfn-ace-system/store-reflection.sh +45 -45
- package/claude-assets/cfn-extras/skills/deprecated/cfn-ace-system/track-ab-test.sh +41 -41
- package/claude-assets/cfn-extras/skills/deprecated/cfn-ace-system/update-reflection.sh +41 -41
- package/claude-assets/cfn-extras/skills/deprecated/cfn-cli-setup/validate-cli-environment.sh +191 -191
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-ad-campaigns/operations/create-campaign.sh +231 -231
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-ad-campaigns/operations/get-campaign-performance.sh +190 -190
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-ad-campaigns/operations/pause-campaign.sh +142 -142
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-ad-campaigns/operations/set-budget.sh +181 -181
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-ad-campaigns/operations/update-bid-strategy.sh +133 -133
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-chatbot-conversations/operations/get-conversation-history.sh +121 -121
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-chatbot-conversations/operations/qualify-lead.sh +156 -156
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-chatbot-conversations/operations/schedule-demo.sh +181 -181
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-chatbot-conversations/operations/send-message.sh +137 -137
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-chatbot-conversations/operations/transfer-to-human.sh +179 -179
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-sms-campaigns/operations/create-campaign.sh +183 -183
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-sms-campaigns/operations/get-delivery-status.sh +139 -139
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-sms-campaigns/operations/opt-out.sh +150 -150
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-sms-campaigns/operations/schedule-campaign.sh +187 -187
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-sms-campaigns/operations/send-sms.sh +181 -181
- package/claude-assets/cfn-extras/skills/ui-portal/cfn-web-portal/test-web-portal-skill.sh +50 -50
- package/claude-assets/cfn-extras/skills/ui-portal/cfn-web-portal/validate-deployment.sh +84 -84
- package/claude-assets/cfn-extras/skills/utility/cfn-environment-sanitization/sanitize-environment.sh +243 -243
- package/claude-assets/commands/cfn-loop-cli.md +16 -2
- package/claude-assets/commands/switch-api.md +31 -10
- package/claude-assets/hooks/cfn-BACKUP_USAGE.md +243 -243
- package/claude-assets/hooks/cfn-invoke-security-validation.sh +69 -69
- package/claude-assets/hooks/cfn-lint-sql-injection.sh +61 -0
- package/claude-assets/hooks/cfn-post-edit-cfn-retrospective.sh +109 -78
- package/claude-assets/hooks/cfn-post-edit.config.json +44 -44
- package/claude-assets/hooks/cfn-post-execution/memory-cleanup.sh +19 -19
- package/claude-assets/hooks/cfn-pre-edit-security-warning.sh +40 -0
- package/claude-assets/hooks/cfn-pre-execution/memory-check.sh +19 -19
- package/claude-assets/hooks/detect-hardcoded-credentials.sh +212 -0
- package/claude-assets/skills/SKILL_TEMPLATE.md +774 -0
- package/claude-assets/skills/agent-lifecycle/execute-lifecycle-hook.sh +543 -572
- package/claude-assets/skills/agent-lifecycle/simple-audit.sh +57 -30
- package/claude-assets/skills/agent-template-generator/SKILL.md +440 -0
- package/claude-assets/skills/agent-template-generator/generate-agent.sh +405 -0
- package/claude-assets/skills/agent-validation-linter/SKILL.md +589 -0
- package/claude-assets/skills/agent-validation-linter/lint-agents.sh +271 -0
- package/claude-assets/skills/bootstrap/bash-fundamentals.md +786 -0
- package/claude-assets/skills/bootstrap/database-connection.md +464 -0
- package/claude-assets/skills/bootstrap/error-handling.md +580 -0
- package/claude-assets/skills/bootstrap/file-operations.md +699 -0
- package/claude-assets/skills/bootstrap/skill-loader.md +616 -0
- package/claude-assets/skills/bootstrap/sqlite-params.sh +287 -0
- package/claude-assets/skills/cfn-agent-spawning/spawn-agent.sh +22 -24
- package/claude-assets/skills/cfn-automatic-memory-persistence/persist-agent-output.sh +48 -48
- package/claude-assets/skills/cfn-automatic-memory-persistence/query-agent-history.sh +34 -34
- package/claude-assets/skills/cfn-automatic-memory-persistence/test-memory-persistence.sh +17 -16
- package/claude-assets/skills/cfn-deliverable-validation/confidence-calculator.sh +261 -261
- package/claude-assets/skills/cfn-deployment/SKILL.md +293 -0
- package/claude-assets/skills/cfn-deployment/execute.sh +21 -0
- package/claude-assets/skills/cfn-docker-agent-spawning/SKILL.md +28 -4
- package/claude-assets/skills/cfn-docker-agent-spawning/spawn-agent.sh +3 -1
- package/claude-assets/skills/cfn-docker-loop-orchestration/orchestrate.sh +224 -20
- package/claude-assets/skills/cfn-environment-sanitization/sanitize-environment.sh +38 -0
- package/claude-assets/skills/cfn-error-batching-strategy/lib/core-functions.sh +47 -47
- package/claude-assets/skills/cfn-expert-update/update-expert.sh +345 -345
- package/claude-assets/skills/cfn-file-operations/SKILL.md +290 -0
- package/claude-assets/skills/cfn-file-operations/execute.sh +129 -0
- package/claude-assets/skills/cfn-file-operations/lib/atomic-write.sh +294 -0
- package/claude-assets/skills/cfn-file-operations/lib/lock.sh +361 -0
- package/claude-assets/skills/cfn-file-operations/test.sh +369 -0
- package/claude-assets/skills/cfn-hybrid-routing/check-dependencies.sh +51 -51
- package/claude-assets/skills/cfn-intervention-detector/detect-intervention.sh +110 -110
- package/claude-assets/skills/cfn-intervention-orchestrator/execute-intervention.sh +58 -58
- package/claude-assets/skills/cfn-log-operations/SKILL.md +308 -0
- package/claude-assets/skills/cfn-log-operations/execute.sh +420 -0
- package/claude-assets/skills/cfn-log-operations/lib/rotate.sh +406 -0
- package/claude-assets/skills/cfn-log-operations/lib/search.sh +448 -0
- package/claude-assets/skills/cfn-log-operations/test.sh +394 -0
- package/claude-assets/skills/cfn-loop-orchestration/helpers/gate-check.sh +550 -46
- package/claude-assets/skills/cfn-loop-orchestration/helpers/parse-test-results.sh +277 -0
- package/claude-assets/skills/cfn-loop-orchestration/orchestrate.sh +184 -23
- package/claude-assets/skills/cfn-loop-orchestration/security_utils.sh +24 -0
- package/claude-assets/skills/cfn-loop-orchestration/test-iteration-context-injection.sh +366 -0
- package/claude-assets/skills/cfn-loop-validation/orchestrate-cfn-loop.sh +252 -252
- package/claude-assets/skills/cfn-loop2-output-processing/process-validator-output.sh +275 -275
- package/claude-assets/skills/cfn-memory-management/check-memory.sh +159 -159
- package/claude-assets/skills/cfn-memory-management/cleanup-memory.sh +196 -196
- package/claude-assets/skills/cfn-node-heap-sizer/task-mode-heap-limiter.sh +325 -325
- package/claude-assets/skills/cfn-parameterized-queries/SKILL.md +339 -0
- package/claude-assets/skills/cfn-playbook/query-playbook.sh +19 -15
- package/claude-assets/skills/cfn-playbook/update-playbook.sh +25 -14
- package/claude-assets/skills/cfn-playbook-auto-update/auto-update-playbook.sh +85 -85
- package/claude-assets/skills/cfn-process-instrumentation/instrument-process.sh +44 -0
- package/claude-assets/skills/cfn-promotion/SKILL.md +305 -0
- package/claude-assets/skills/cfn-redis-coordination/CENTRALIZED_REDIS_WRAPPER.md +319 -0
- package/claude-assets/skills/cfn-redis-coordination/agent-log.sh +4 -0
- package/claude-assets/skills/cfn-redis-coordination/agent-log.sh.bak +124 -0
- package/claude-assets/skills/cfn-redis-coordination/agent-recovery.sh +74 -74
- package/claude-assets/skills/cfn-redis-coordination/collect-confidence-scores.sh +30 -0
- package/claude-assets/skills/cfn-redis-coordination/get-context.sh +145 -112
- package/claude-assets/skills/cfn-redis-coordination/get-success-criteria.sh +54 -0
- package/claude-assets/skills/cfn-redis-coordination/invoke-waiting-mode.sh +3 -0
- package/claude-assets/skills/cfn-redis-coordination/redis-cli-wrapper.sh +24 -3
- package/claude-assets/skills/cfn-redis-coordination/redis-functions.sh +33 -0
- package/claude-assets/skills/cfn-redis-coordination/report-completion.sh +24 -31
- package/claude-assets/skills/cfn-redis-coordination/store-context.sh +4 -0
- package/claude-assets/skills/cfn-redis-coordination/store-success-criteria.sh +85 -0
- package/claude-assets/skills/cfn-redis-coordination/update-all-scripts.sh +67 -0
- package/claude-assets/skills/cfn-scope-simplifier/simplify-scope.sh +67 -67
- package/claude-assets/skills/cfn-skill-loader/SKILL.md +466 -0
- package/claude-assets/skills/cfn-skill-loader/execute.sh +344 -0
- package/claude-assets/skills/cfn-specialist-injection/recommend-specialist.sh +56 -56
- package/claude-assets/skills/cfn-sqlite-memory/ttl-cleanup.sh +17 -25
- package/claude-assets/skills/cfn-standardized-error-handling/capture-agent-error.sh +86 -86
- package/claude-assets/skills/cfn-standardized-error-handling/test-error-handling.sh +165 -165
- package/claude-assets/skills/cfn-task-audit/get-audit-data.sh +42 -21
- package/claude-assets/skills/cfn-task-audit/store-task-audit.sh +17 -10
- package/claude-assets/skills/cfn-task-config-init/initialize-config.sh +264 -264
- package/claude-assets/skills/cfn-task-decomposition/task-decomposer.sh +278 -278
- package/claude-assets/skills/cfn-test-runner/detect-regressions.sh +17 -14
- package/claude-assets/skills/cfn-test-runner/detect-regressions.sh.backup-1763392821 +55 -0
- package/claude-assets/skills/cfn-test-runner/store-benchmarks.sh +17 -19
- package/claude-assets/skills/cfn-transparency-middleware/middleware-config.sh +28 -28
- package/claude-assets/skills/cfn-transparency-middleware/performance-benchmark.sh +78 -78
- package/claude-assets/skills/cfn-transparency-middleware/test-e2e.sh +15 -0
- package/claude-assets/skills/cfn-transparency-middleware/test-integration.sh +161 -161
- package/claude-assets/skills/cfn-transparency-middleware/test-transparency-skill.sh +367 -367
- package/claude-assets/skills/cfn-transparency-middleware/tests/input-validation.sh +107 -92
- package/claude-assets/skills/cfn-transparency-middleware/wrap-agent.sh +131 -131
- package/claude-assets/skills/cfn-utilities/SKILL.md +237 -0
- package/claude-assets/skills/cfn-utilities/execute.sh +32 -0
- package/claude-assets/skills/cfn-utilities/lib/errors.sh +56 -0
- package/claude-assets/skills/cfn-utilities/lib/file-ops.sh +164 -0
- package/claude-assets/skills/cfn-utilities/lib/logging.sh +77 -0
- package/claude-assets/skills/cfn-utilities/lib/retry.sh +127 -0
- package/claude-assets/skills/cfn-utilities/test.sh +317 -0
- package/claude-assets/skills/docker-build/SKILL.md +96 -203
- package/claude-assets/skills/docker-build/build.sh +73 -73
- package/claude-assets/skills/integration/agent-handoff.sh +492 -0
- package/claude-assets/skills/integration/file-operations.sh +414 -0
- package/claude-assets/skills/json-validation/SKILL.md +431 -0
- package/claude-assets/skills/json-validation/test-validate-success-criteria.sh +421 -0
- package/claude-assets/skills/json-validation/validate-success-criteria.sh +197 -0
- package/claude-assets/skills/redis-coordination/validate-parameters.sh +34 -0
- package/claude-assets/skills/workflow-codification/APPROVAL_WORKFLOW.md +806 -0
- package/claude-assets/skills/workflow-codification/COST_TRACKING.md +637 -0
- package/claude-assets/skills/workflow-codification/DEPLOY_QUICK_REFERENCE.md +106 -0
- package/claude-assets/skills/workflow-codification/EDGE_CASE_TRACKING.md +404 -0
- package/claude-assets/skills/workflow-codification/PROPAGATE_UPDATE_QUICK_REFERENCE.md +366 -0
- package/claude-assets/skills/workflow-codification/README_PHASE4.md +457 -0
- package/claude-assets/skills/workflow-codification/SKILL.md +110 -0
- package/claude-assets/skills/workflow-codification/analyze-patterns.sh +899 -0
- package/claude-assets/skills/workflow-codification/approval-workflow.sh +514 -0
- package/claude-assets/skills/workflow-codification/deploy-approved-skill.sh +481 -0
- package/claude-assets/skills/workflow-codification/deploy-approved-skill.sh.backup-1763392820 +512 -0
- package/claude-assets/skills/workflow-codification/generate-skill-update.sh +525 -0
- package/claude-assets/skills/workflow-codification/lib/security-utils.sh +204 -0
- package/claude-assets/skills/workflow-codification/propagate-skill-update.sh +648 -0
- package/claude-assets/skills/workflow-codification/propagate-skill-update.sh.backup-1763392820 +664 -0
- package/claude-assets/skills/workflow-codification/review-skill.sh +643 -0
- package/claude-assets/skills/workflow-codification/templates/email-notification.txt +114 -0
- package/claude-assets/skills/workflow-codification/templates/slack-notification.md +85 -0
- package/claude-assets/skills/workflow-codification/test-integration.sh +296 -0
- package/claude-assets/skills/workflow-codification/test-metadata-update.sh +350 -0
- package/claude-assets/skills/workflow-codification/track-cost-savings.sh +486 -0
- package/claude-assets/skills/workflow-codification/track-cost-savings.sh.backup-1763392821 +445 -0
- package/claude-assets/skills/workflow-codification/track-edge-case.sh +290 -0
- package/claude-assets/skills/workflow-codification/workflow-codification.db +0 -0
- package/dist/ace/ace-curator.js +10 -2
- package/dist/ace/ace-curator.js.map +1 -1
- package/dist/ace/ace-generator.js +4 -0
- package/dist/ace/ace-generator.js.map +1 -1
- package/dist/ace/ace-reflector.js +1 -1
- package/dist/ace/ace-reflector.js.map +1 -1
- package/dist/ace/context-injection.js +24 -2
- package/dist/ace/context-injection.js.map +1 -1
- package/dist/agents/agent-loader.js +146 -165
- package/dist/agents/agent-loader.js.map +1 -1
- package/dist/agents/task-agent-integration.js +1 -1
- package/dist/agents/task-agent-integration.js.map +1 -1
- package/dist/api/health-endpoints.js +390 -0
- package/dist/api/health-endpoints.js.map +1 -0
- package/dist/cli/agent-executor.js +4 -1
- package/dist/cli/agent-executor.js.map +1 -1
- package/dist/cli/agent-prompt-builder.js +89 -1
- package/dist/cli/agent-prompt-builder.js.map +1 -1
- package/dist/cli/agent-spawn.js +130 -37
- package/dist/cli/agent-spawn.js.map +1 -1
- package/dist/cli/config-manager.js +91 -109
- package/dist/cli/config-manager.js.map +1 -1
- package/dist/cli/skill-cache-validator.js +412 -0
- package/dist/cli/skill-cache-validator.js.map +1 -0
- package/dist/cli/skill-cli.js +991 -0
- package/dist/cli/skill-cli.js.map +1 -0
- package/dist/cli/skill-execution-logger.js +284 -0
- package/dist/cli/skill-execution-logger.js.map +1 -0
- package/dist/cli/skill-loader.js +457 -0
- package/dist/cli/skill-loader.js.map +1 -0
- package/dist/coordination/event-bus.js +2 -2
- package/dist/coordination/event-bus.js.map +1 -1
- package/dist/coordination/fleet-manager.js +1 -1
- package/dist/coordination/fleet-manager.js.map +1 -1
- package/dist/coordination/index.js +23 -9
- package/dist/coordination/index.js.map +1 -1
- package/dist/coordination/types/fleet-manager.types.js.map +1 -1
- package/dist/db/migration-manager.js +483 -0
- package/dist/db/migration-manager.js.map +1 -0
- package/dist/db/skills-query.js +535 -0
- package/dist/db/skills-query.js.map +1 -0
- package/dist/integration/DatabaseHandoff.js +507 -0
- package/dist/integration/DatabaseHandoff.js.map +1 -0
- package/dist/integration/StandardAdapter.js +291 -0
- package/dist/integration/StandardAdapter.js.map +1 -0
- package/dist/jobs/edge-case-analyzer.js +367 -0
- package/dist/jobs/edge-case-analyzer.js.map +1 -0
- package/dist/jobs/promotion-sla-enforcer.js +288 -0
- package/dist/jobs/promotion-sla-enforcer.js.map +1 -0
- package/dist/lib/agent-output-parser.js +518 -0
- package/dist/lib/agent-output-parser.js.map +1 -0
- package/dist/lib/agent-output-validator.js +950 -0
- package/dist/lib/agent-output-validator.js.map +1 -0
- package/dist/lib/agent-workspace.js +281 -0
- package/dist/lib/agent-workspace.js.map +1 -0
- package/dist/lib/artifact-registry.js +443 -0
- package/dist/lib/artifact-registry.js.map +1 -0
- package/dist/lib/atomic-file-writer.js +377 -0
- package/dist/lib/atomic-file-writer.js.map +1 -0
- package/dist/lib/backup-manager.js +779 -0
- package/dist/lib/backup-manager.js.map +1 -0
- package/dist/lib/checkpoint-manager.js +837 -0
- package/dist/lib/checkpoint-manager.js.map +1 -0
- package/dist/lib/circuit-breaker.js +340 -0
- package/dist/lib/circuit-breaker.js.map +1 -0
- package/dist/lib/completion-signal-handler.js +243 -0
- package/dist/lib/completion-signal-handler.js.map +1 -0
- package/dist/lib/config-manager.js +312 -0
- package/dist/lib/config-manager.js.map +1 -0
- package/dist/lib/config-migrator.js +386 -0
- package/dist/lib/config-migrator.js.map +1 -0
- package/dist/lib/config-validator.js +687 -0
- package/dist/lib/config-validator.js.map +1 -0
- package/dist/lib/correlation-cache.js +311 -0
- package/dist/lib/correlation-cache.js.map +1 -0
- package/dist/lib/correlation.js +263 -0
- package/dist/lib/correlation.js.map +1 -0
- package/dist/lib/database-service/connection-pool-manager.js +520 -0
- package/dist/lib/database-service/connection-pool-manager.js.map +1 -0
- package/dist/lib/database-service/correlation.js +329 -0
- package/dist/lib/database-service/correlation.js.map +1 -0
- package/dist/lib/database-service/errors.js +120 -0
- package/dist/lib/database-service/errors.js.map +1 -0
- package/dist/lib/database-service/index.js +168 -0
- package/dist/lib/database-service/index.js.map +1 -0
- package/dist/lib/database-service/postgres-adapter.js +526 -0
- package/dist/lib/database-service/postgres-adapter.js.map +1 -0
- package/dist/lib/database-service/redis-adapter.js +360 -0
- package/dist/lib/database-service/redis-adapter.js.map +1 -0
- package/dist/lib/database-service/sqlite-adapter.js +544 -0
- package/dist/lib/database-service/sqlite-adapter.js.map +1 -0
- package/dist/lib/database-service/transaction-manager.js +773 -0
- package/dist/lib/database-service/transaction-manager.js.map +1 -0
- package/dist/lib/database-service/types.js +23 -0
- package/dist/lib/database-service/types.js.map +1 -0
- package/dist/lib/deadlock-resolver.js +292 -0
- package/dist/lib/deadlock-resolver.js.map +1 -0
- package/dist/lib/distributed-lock.js +451 -0
- package/dist/lib/distributed-lock.js.map +1 -0
- package/dist/lib/edge-case-deduplicator.js +227 -0
- package/dist/lib/edge-case-deduplicator.js.map +1 -0
- package/dist/lib/encryption-manager.js +322 -0
- package/dist/lib/encryption-manager.js.map +1 -0
- package/dist/lib/error-aggregator.js +234 -0
- package/dist/lib/error-aggregator.js.map +1 -0
- package/dist/lib/errors.js +287 -0
- package/dist/lib/errors.js.map +1 -0
- package/dist/lib/file-lock-manager.js +578 -0
- package/dist/lib/file-lock-manager.js.map +1 -0
- package/dist/lib/file-operations.js +367 -0
- package/dist/lib/file-operations.js.map +1 -0
- package/dist/lib/idempotent-write.js +237 -0
- package/dist/lib/idempotent-write.js.map +1 -0
- package/dist/lib/integration-schema-validator.js +522 -0
- package/dist/lib/integration-schema-validator.js.map +1 -0
- package/dist/lib/lock-health-monitor.js +298 -0
- package/dist/lib/lock-health-monitor.js.map +1 -0
- package/dist/lib/log-shipper.js +422 -0
- package/dist/lib/log-shipper.js.map +1 -0
- package/dist/lib/logging.js +146 -0
- package/dist/lib/logging.js.map +1 -0
- package/dist/lib/message-deduplicator.js +439 -0
- package/dist/lib/message-deduplicator.js.map +1 -0
- package/dist/lib/multi-system-query.js +604 -0
- package/dist/lib/multi-system-query.js.map +1 -0
- package/dist/lib/orphan-detector.js +332 -0
- package/dist/lib/orphan-detector.js.map +1 -0
- package/dist/lib/password-generator.js +166 -0
- package/dist/lib/password-generator.js.map +1 -0
- package/dist/lib/path-validator.js +429 -0
- package/dist/lib/path-validator.js.map +1 -0
- package/dist/lib/query-translator.js +905 -0
- package/dist/lib/query-translator.js.map +1 -0
- package/dist/lib/queue-recovery.js +469 -0
- package/dist/lib/queue-recovery.js.map +1 -0
- package/dist/lib/redis-queue-manager.js +512 -0
- package/dist/lib/redis-queue-manager.js.map +1 -0
- package/dist/lib/reflection-archiver.js +272 -0
- package/dist/lib/reflection-archiver.js.map +1 -0
- package/dist/lib/retry-manager.js +453 -0
- package/dist/lib/retry-manager.js.map +1 -0
- package/dist/lib/retry.js +262 -0
- package/dist/lib/retry.js.map +1 -0
- package/dist/lib/schema-transform.js +695 -0
- package/dist/lib/schema-transform.js.map +1 -0
- package/dist/lib/schema-validator.js +491 -0
- package/dist/lib/schema-validator.js.map +1 -0
- package/dist/lib/skill-cache.js +297 -0
- package/dist/lib/skill-cache.js.map +1 -0
- package/dist/lib/skill-content-manager.js +337 -0
- package/dist/lib/skill-content-manager.js.map +1 -0
- package/dist/lib/skill-frontmatter-parser.js +237 -0
- package/dist/lib/skill-frontmatter-parser.js.map +1 -0
- package/dist/lib/skill-git-integration.js +275 -0
- package/dist/lib/skill-git-integration.js.map +1 -0
- package/dist/lib/skill-markdown-validator.js +396 -0
- package/dist/lib/skill-markdown-validator.js.map +1 -0
- package/dist/lib/skill-output-parser.js +312 -0
- package/dist/lib/skill-output-parser.js.map +1 -0
- package/dist/lib/unified-query-api.js +467 -0
- package/dist/lib/unified-query-api.js.map +1 -0
- package/dist/middleware/auth-middleware.js +350 -0
- package/dist/middleware/auth-middleware.js.map +1 -0
- package/dist/middleware/schema-validation.js +347 -0
- package/dist/middleware/schema-validation.js.map +1 -0
- package/dist/providers/anthropic-provider.js +1 -1
- package/dist/providers/anthropic-provider.js.map +1 -1
- package/dist/providers/provider-factory.js +2 -2
- package/dist/providers/provider-factory.js.map +1 -1
- package/dist/services/edge-case-analyzer.js +321 -0
- package/dist/services/edge-case-analyzer.js.map +1 -0
- package/dist/services/edge-case-deduplicator.js +266 -0
- package/dist/services/edge-case-deduplicator.js.map +1 -0
- package/dist/services/edge-case-detector.js +337 -0
- package/dist/services/edge-case-detector.js.map +1 -0
- package/dist/services/edge-case-tracker.js +547 -0
- package/dist/services/edge-case-tracker.js.map +1 -0
- package/dist/services/health-check-system.js +586 -0
- package/dist/services/health-check-system.js.map +1 -0
- package/dist/services/metrics-logger.js +412 -0
- package/dist/services/metrics-logger.js.map +1 -0
- package/dist/services/patch-generator.js +378 -0
- package/dist/services/patch-generator.js.map +1 -0
- package/dist/services/patch-validator.js +337 -0
- package/dist/services/patch-validator.js.map +1 -0
- package/dist/services/performance-monitor.js +811 -0
- package/dist/services/performance-monitor.js.map +1 -0
- package/dist/services/promotion-pipeline.js +918 -0
- package/dist/services/promotion-pipeline.js.map +1 -0
- package/dist/services/promotion-validator.js +394 -0
- package/dist/services/promotion-validator.js.map +1 -0
- package/dist/services/reflection-logger.js +388 -0
- package/dist/services/reflection-logger.js.map +1 -0
- package/dist/services/skill-deployment.js +472 -0
- package/dist/services/skill-deployment.js.map +1 -0
- package/dist/services/skill-loader.js +427 -0
- package/dist/services/skill-loader.js.map +1 -0
- package/dist/services/skill-promotion.js +372 -0
- package/dist/services/skill-promotion.js.map +1 -0
- package/dist/services/skill-validator.js +454 -0
- package/dist/services/skill-validator.js.map +1 -0
- package/dist/services/skill-versioning.js +244 -0
- package/dist/services/skill-versioning.js.map +1 -0
- package/dist/services/workspace-supervisor.js +597 -0
- package/dist/services/workspace-supervisor.js.map +1 -0
- package/dist/types/agent-output.js +44 -0
- package/dist/types/agent-output.js.map +1 -0
- package/dist/types/config.js +28 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/edge-case.js +45 -0
- package/dist/types/edge-case.js.map +1 -0
- package/package.json +201 -176
- package/readme/README.md +19 -4
- package/scripts/artifact-cleanup.sh +392 -0
- package/scripts/backup-cleanup.sh +627 -0
- package/scripts/cleanup-workspaces.sh +412 -0
- package/scripts/cleanup-yaml-configs.sh +141 -0
- package/scripts/deploy-approved-skills.sh +263 -0
- package/scripts/deploy-production.sh +355 -355
- package/scripts/docker-playwright-fix.sh +311 -311
- package/scripts/docker-rebuild-all-agents.sh +127 -127
- package/scripts/health-check.sh +447 -0
- package/scripts/log-aggregator.sh +554 -0
- package/scripts/log-monitor.sh +629 -0
- package/scripts/manage-agent-workspaces.sh +434 -0
- package/scripts/memory-leak-prevention.sh +305 -305
- package/scripts/migrate-artifacts.sh +563 -0
- package/scripts/migrate-schema.sh +533 -0
- package/scripts/migrate-yaml-to-json.sh +465 -0
- package/scripts/promote-staged-skills.sh +423 -0
- package/scripts/run-marketing-tests.sh +42 -42
- package/scripts/update_paths.sh +46 -46
- package/scripts/verify-no-secrets.sh +88 -35
- package/.claude/cfn-extras/agents/deprecated-coordinators/adaptive-coordinator.md.backup +0 -161
- package/.claude/cfn-extras/agents/deprecated-coordinators/blocking-coordinator-example.md.backup +0 -728
- package/.claude/cfn-extras/agents/deprecated-coordinators/mesh-coordinator.md.backup +0 -131
- package/.claude/skills/cfn-agent-spawning/spawn-agent.sh.backup +0 -273
- package/.claude/skills/cfn-loop-orchestration/orchestrate.sh.backup +0 -949
- package/README.md.backup_before_replace +0 -781
- package/claude-assets/cfn-extras/agents/deprecated-coordinators/adaptive-coordinator.md.backup +0 -161
- package/claude-assets/cfn-extras/agents/deprecated-coordinators/blocking-coordinator-example.md.backup +0 -728
- package/claude-assets/cfn-extras/agents/deprecated-coordinators/mesh-coordinator.md.backup +0 -131
- package/claude-assets/skills/cfn-agent-spawning/spawn-agent.sh.backup +0 -273
- package/claude-assets/skills/cfn-loop-orchestration/orchestrate.sh.backup +0 -949
|
@@ -0,0 +1,950 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Output Validator
|
|
3
|
+
* Zero-dependency validation library for CFN agent outputs
|
|
4
|
+
*
|
|
5
|
+
* @version 1.0.0
|
|
6
|
+
* @description Type-safe validation with detailed error reporting
|
|
7
|
+
*/ // ============================================================================
|
|
8
|
+
// Security Helper Functions
|
|
9
|
+
// ============================================================================
|
|
10
|
+
/**
|
|
11
|
+
* Sanitize values for safe logging (prevents sensitive data leakage)
|
|
12
|
+
* @param value - Value to sanitize
|
|
13
|
+
* @param path - Field path for sensitive field detection
|
|
14
|
+
* @returns Sanitized string representation
|
|
15
|
+
*/ function sanitizeValue(value, path) {
|
|
16
|
+
// List of sensitive field patterns
|
|
17
|
+
const sensitivePatterns = [
|
|
18
|
+
'password',
|
|
19
|
+
'passwd',
|
|
20
|
+
'pwd',
|
|
21
|
+
'token',
|
|
22
|
+
'key',
|
|
23
|
+
'secret',
|
|
24
|
+
'api_key',
|
|
25
|
+
'apikey',
|
|
26
|
+
'api-key',
|
|
27
|
+
'auth',
|
|
28
|
+
'credential',
|
|
29
|
+
'private'
|
|
30
|
+
];
|
|
31
|
+
// Check if path contains sensitive field name
|
|
32
|
+
const lowerPath = path.toLowerCase();
|
|
33
|
+
const isSensitive = sensitivePatterns.some((pattern)=>lowerPath.includes(pattern));
|
|
34
|
+
if (isSensitive) {
|
|
35
|
+
return '[REDACTED]';
|
|
36
|
+
}
|
|
37
|
+
// Sanitize value for safe display
|
|
38
|
+
try {
|
|
39
|
+
const str = JSON.stringify(value);
|
|
40
|
+
// Truncate large values to prevent log flooding
|
|
41
|
+
const maxLength = 100;
|
|
42
|
+
if (str.length > maxLength) {
|
|
43
|
+
return str.substring(0, maxLength) + '...[truncated]';
|
|
44
|
+
}
|
|
45
|
+
return str;
|
|
46
|
+
} catch {
|
|
47
|
+
// Handle circular references or non-serializable values
|
|
48
|
+
return '[Non-serializable value]';
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
// ============================================================================
|
|
52
|
+
// Validation Class
|
|
53
|
+
// ============================================================================
|
|
54
|
+
/**
|
|
55
|
+
* AgentOutputValidator: Main validation class
|
|
56
|
+
* Provides schema validation, error reporting, and type checking
|
|
57
|
+
*/ export class AgentOutputValidator {
|
|
58
|
+
/**
|
|
59
|
+
* Validate agent output object
|
|
60
|
+
*/ validate(output) {
|
|
61
|
+
const errors = [];
|
|
62
|
+
const warnings = [];
|
|
63
|
+
if (typeof output !== 'object' || output === null) {
|
|
64
|
+
return {
|
|
65
|
+
valid: false,
|
|
66
|
+
errors: [
|
|
67
|
+
{
|
|
68
|
+
field: 'root',
|
|
69
|
+
message: 'Agent output must be a valid JSON object',
|
|
70
|
+
path: '/',
|
|
71
|
+
code: 'INVALID_TYPE'
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
warnings
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
const obj = output;
|
|
78
|
+
// Validate output_type discriminator
|
|
79
|
+
const outputType = obj.output_type;
|
|
80
|
+
if (outputType !== 'loop3' && outputType !== 'loop2' && outputType !== 'product_owner') {
|
|
81
|
+
errors.push({
|
|
82
|
+
field: 'output_type',
|
|
83
|
+
message: "output_type must be one of: 'loop3', 'loop2', 'product_owner'",
|
|
84
|
+
path: '/output_type',
|
|
85
|
+
code: 'INVALID_OUTPUT_TYPE',
|
|
86
|
+
value: outputType
|
|
87
|
+
});
|
|
88
|
+
return {
|
|
89
|
+
valid: false,
|
|
90
|
+
errors,
|
|
91
|
+
warnings
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
// Validate base fields common to all outputs
|
|
95
|
+
this.validateBaseOutput(obj, errors);
|
|
96
|
+
// Validate type-specific fields
|
|
97
|
+
switch(outputType){
|
|
98
|
+
case 'loop3':
|
|
99
|
+
this.validateLoop3Output(obj, errors, warnings);
|
|
100
|
+
break;
|
|
101
|
+
case 'loop2':
|
|
102
|
+
this.validateLoop2Output(obj, errors, warnings);
|
|
103
|
+
break;
|
|
104
|
+
case 'product_owner':
|
|
105
|
+
this.validateProductOwnerOutput(obj, errors, warnings);
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
valid: errors.length === 0,
|
|
110
|
+
errors,
|
|
111
|
+
warnings,
|
|
112
|
+
output_type: outputType
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Validate JSON string
|
|
117
|
+
*/ validateJSON(jsonString) {
|
|
118
|
+
try {
|
|
119
|
+
const output = JSON.parse(jsonString);
|
|
120
|
+
return this.validate(output);
|
|
121
|
+
} catch (error) {
|
|
122
|
+
return {
|
|
123
|
+
valid: false,
|
|
124
|
+
errors: [
|
|
125
|
+
{
|
|
126
|
+
field: 'json',
|
|
127
|
+
message: `Failed to parse JSON: ${error instanceof Error ? error.message : String(error)}`,
|
|
128
|
+
path: 'root',
|
|
129
|
+
code: 'JSON_PARSE_ERROR'
|
|
130
|
+
}
|
|
131
|
+
],
|
|
132
|
+
warnings: []
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Validate base output fields (common to all types)
|
|
138
|
+
*/ validateBaseOutput(obj, errors) {
|
|
139
|
+
// Validate success (required boolean)
|
|
140
|
+
if (typeof obj.success !== 'boolean') {
|
|
141
|
+
errors.push({
|
|
142
|
+
field: 'success',
|
|
143
|
+
message: 'success must be a boolean',
|
|
144
|
+
path: '/success',
|
|
145
|
+
code: 'INVALID_TYPE',
|
|
146
|
+
value: obj.success
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
// Validate confidence (required number 0.0-1.0)
|
|
150
|
+
if (typeof obj.confidence !== 'number') {
|
|
151
|
+
errors.push({
|
|
152
|
+
field: 'confidence',
|
|
153
|
+
message: 'confidence must be a number',
|
|
154
|
+
path: '/confidence',
|
|
155
|
+
code: 'INVALID_TYPE',
|
|
156
|
+
value: obj.confidence
|
|
157
|
+
});
|
|
158
|
+
} else if (obj.confidence < 0.0 || obj.confidence > 1.0) {
|
|
159
|
+
errors.push({
|
|
160
|
+
field: 'confidence',
|
|
161
|
+
message: 'confidence must be between 0.0 and 1.0',
|
|
162
|
+
path: '/confidence',
|
|
163
|
+
code: 'CONSTRAINT_VIOLATION',
|
|
164
|
+
value: obj.confidence
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
// Validate iteration (required positive integer)
|
|
168
|
+
if (typeof obj.iteration !== 'number') {
|
|
169
|
+
errors.push({
|
|
170
|
+
field: 'iteration',
|
|
171
|
+
message: 'iteration must be a number',
|
|
172
|
+
path: '/iteration',
|
|
173
|
+
code: 'INVALID_TYPE',
|
|
174
|
+
value: obj.iteration
|
|
175
|
+
});
|
|
176
|
+
} else if (!Number.isInteger(obj.iteration) || obj.iteration < 1) {
|
|
177
|
+
errors.push({
|
|
178
|
+
field: 'iteration',
|
|
179
|
+
message: 'iteration must be a positive integer',
|
|
180
|
+
path: '/iteration',
|
|
181
|
+
code: 'CONSTRAINT_VIOLATION',
|
|
182
|
+
value: obj.iteration
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
// Validate errors (required array)
|
|
186
|
+
if (!Array.isArray(obj.errors)) {
|
|
187
|
+
errors.push({
|
|
188
|
+
field: 'errors',
|
|
189
|
+
message: 'errors must be an array',
|
|
190
|
+
path: '/errors',
|
|
191
|
+
code: 'INVALID_TYPE',
|
|
192
|
+
value: obj.errors
|
|
193
|
+
});
|
|
194
|
+
} else {
|
|
195
|
+
for(let i = 0; i < obj.errors.length; i++){
|
|
196
|
+
this.validateError(obj.errors[i], i, errors);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
// Validate metadata (required object)
|
|
200
|
+
if (typeof obj.metadata !== 'object' || obj.metadata === null) {
|
|
201
|
+
errors.push({
|
|
202
|
+
field: 'metadata',
|
|
203
|
+
message: 'metadata must be an object',
|
|
204
|
+
path: '/metadata',
|
|
205
|
+
code: 'INVALID_TYPE',
|
|
206
|
+
value: obj.metadata
|
|
207
|
+
});
|
|
208
|
+
} else {
|
|
209
|
+
this.validateMetadata(obj.metadata, errors);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Validate Loop 3 (Implementer) output
|
|
214
|
+
*/ validateLoop3Output(obj, errors, warnings) {
|
|
215
|
+
// Validate deliverables (required array)
|
|
216
|
+
if (!Array.isArray(obj.deliverables)) {
|
|
217
|
+
errors.push({
|
|
218
|
+
field: 'deliverables',
|
|
219
|
+
message: 'deliverables must be an array',
|
|
220
|
+
path: '/deliverables',
|
|
221
|
+
code: 'INVALID_TYPE',
|
|
222
|
+
value: obj.deliverables
|
|
223
|
+
});
|
|
224
|
+
} else {
|
|
225
|
+
for(let i = 0; i < obj.deliverables.length; i++){
|
|
226
|
+
this.validateDeliverable(obj.deliverables[i], i, errors);
|
|
227
|
+
}
|
|
228
|
+
if (obj.deliverables.length === 0) {
|
|
229
|
+
warnings.push('Loop 3 output has no deliverables (empty array)');
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
// Validate metrics (optional object)
|
|
233
|
+
if (obj.metrics !== undefined) {
|
|
234
|
+
if (typeof obj.metrics !== 'object' || obj.metrics === null) {
|
|
235
|
+
errors.push({
|
|
236
|
+
field: 'metrics',
|
|
237
|
+
message: 'metrics must be an object',
|
|
238
|
+
path: '/metrics',
|
|
239
|
+
code: 'INVALID_TYPE',
|
|
240
|
+
value: obj.metrics
|
|
241
|
+
});
|
|
242
|
+
} else {
|
|
243
|
+
this.validateMetrics(obj.metrics, errors);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
// Validate summary (optional string)
|
|
247
|
+
if (obj.summary !== undefined && typeof obj.summary !== 'string') {
|
|
248
|
+
errors.push({
|
|
249
|
+
field: 'summary',
|
|
250
|
+
message: 'summary must be a string',
|
|
251
|
+
path: '/summary',
|
|
252
|
+
code: 'INVALID_TYPE',
|
|
253
|
+
value: obj.summary
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Validate Loop 2 (Validator) output
|
|
259
|
+
*/ validateLoop2Output(obj, errors, warnings) {
|
|
260
|
+
// Validate validation_type (required enum)
|
|
261
|
+
const validationTypes = [
|
|
262
|
+
'review',
|
|
263
|
+
'test',
|
|
264
|
+
'security',
|
|
265
|
+
'architecture',
|
|
266
|
+
'performance',
|
|
267
|
+
'compliance'
|
|
268
|
+
];
|
|
269
|
+
if (!validationTypes.includes(obj.validation_type)) {
|
|
270
|
+
errors.push({
|
|
271
|
+
field: 'validation_type',
|
|
272
|
+
message: `validation_type must be one of: ${validationTypes.join(', ')}`,
|
|
273
|
+
path: '/validation_type',
|
|
274
|
+
code: 'INVALID_ENUM',
|
|
275
|
+
value: obj.validation_type
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
// Validate issues (optional array, default to empty)
|
|
279
|
+
if (obj.issues !== undefined) {
|
|
280
|
+
if (!Array.isArray(obj.issues)) {
|
|
281
|
+
errors.push({
|
|
282
|
+
field: 'issues',
|
|
283
|
+
message: 'issues must be an array',
|
|
284
|
+
path: '/issues',
|
|
285
|
+
code: 'INVALID_TYPE',
|
|
286
|
+
value: obj.issues
|
|
287
|
+
});
|
|
288
|
+
} else {
|
|
289
|
+
for(let i = 0; i < obj.issues.length; i++){
|
|
290
|
+
this.validateIssue(obj.issues[i], i, errors);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
// Validate recommendations (optional array, default to empty)
|
|
295
|
+
if (obj.recommendations !== undefined) {
|
|
296
|
+
if (!Array.isArray(obj.recommendations)) {
|
|
297
|
+
errors.push({
|
|
298
|
+
field: 'recommendations',
|
|
299
|
+
message: 'recommendations must be an array',
|
|
300
|
+
path: '/recommendations',
|
|
301
|
+
code: 'INVALID_TYPE',
|
|
302
|
+
value: obj.recommendations
|
|
303
|
+
});
|
|
304
|
+
} else {
|
|
305
|
+
for(let i = 0; i < obj.recommendations.length; i++){
|
|
306
|
+
if (typeof obj.recommendations[i] !== 'string') {
|
|
307
|
+
errors.push({
|
|
308
|
+
field: `recommendations[${i}]`,
|
|
309
|
+
message: 'recommendation must be a string',
|
|
310
|
+
path: `/recommendations/${i}`,
|
|
311
|
+
code: 'INVALID_TYPE',
|
|
312
|
+
value: obj.recommendations[i]
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
// Validate approved (required boolean)
|
|
319
|
+
if (typeof obj.approved !== 'boolean') {
|
|
320
|
+
errors.push({
|
|
321
|
+
field: 'approved',
|
|
322
|
+
message: 'approved must be a boolean',
|
|
323
|
+
path: '/approved',
|
|
324
|
+
code: 'INVALID_TYPE',
|
|
325
|
+
value: obj.approved
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
// Validate summary (optional string)
|
|
329
|
+
if (obj.summary !== undefined && typeof obj.summary !== 'string') {
|
|
330
|
+
errors.push({
|
|
331
|
+
field: 'summary',
|
|
332
|
+
message: 'summary must be a string',
|
|
333
|
+
path: '/summary',
|
|
334
|
+
code: 'INVALID_TYPE',
|
|
335
|
+
value: obj.summary
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Validate Product Owner output
|
|
341
|
+
*/ validateProductOwnerOutput(obj, errors, warnings) {
|
|
342
|
+
// Validate decision (required enum)
|
|
343
|
+
const decisions = [
|
|
344
|
+
'PROCEED',
|
|
345
|
+
'ITERATE',
|
|
346
|
+
'ABORT'
|
|
347
|
+
];
|
|
348
|
+
if (!decisions.includes(obj.decision)) {
|
|
349
|
+
errors.push({
|
|
350
|
+
field: 'decision',
|
|
351
|
+
message: `decision must be one of: ${decisions.join(', ')}`,
|
|
352
|
+
path: '/decision',
|
|
353
|
+
code: 'INVALID_ENUM',
|
|
354
|
+
value: obj.decision
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
// Validate rationale (required non-empty string)
|
|
358
|
+
if (typeof obj.rationale !== 'string') {
|
|
359
|
+
errors.push({
|
|
360
|
+
field: 'rationale',
|
|
361
|
+
message: 'rationale must be a string',
|
|
362
|
+
path: '/rationale',
|
|
363
|
+
code: 'INVALID_TYPE',
|
|
364
|
+
value: obj.rationale
|
|
365
|
+
});
|
|
366
|
+
} else if (obj.rationale.length === 0) {
|
|
367
|
+
errors.push({
|
|
368
|
+
field: 'rationale',
|
|
369
|
+
message: 'rationale must be a non-empty string',
|
|
370
|
+
path: '/rationale',
|
|
371
|
+
code: 'CONSTRAINT_VIOLATION',
|
|
372
|
+
value: obj.rationale
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
// Validate deliverables_validated (required boolean)
|
|
376
|
+
if (typeof obj.deliverables_validated !== 'boolean') {
|
|
377
|
+
errors.push({
|
|
378
|
+
field: 'deliverables_validated',
|
|
379
|
+
message: 'deliverables_validated must be a boolean',
|
|
380
|
+
path: '/deliverables_validated',
|
|
381
|
+
code: 'INVALID_TYPE',
|
|
382
|
+
value: obj.deliverables_validated
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
// Validate next_action (required string)
|
|
386
|
+
if (typeof obj.next_action !== 'string') {
|
|
387
|
+
errors.push({
|
|
388
|
+
field: 'next_action',
|
|
389
|
+
message: 'next_action must be a string',
|
|
390
|
+
path: '/next_action',
|
|
391
|
+
code: 'INVALID_TYPE',
|
|
392
|
+
value: obj.next_action
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
// Validate consensus_score (optional number 0.0-1.0)
|
|
396
|
+
if (obj.consensus_score !== undefined) {
|
|
397
|
+
if (typeof obj.consensus_score !== 'number') {
|
|
398
|
+
errors.push({
|
|
399
|
+
field: 'consensus_score',
|
|
400
|
+
message: 'consensus_score must be a number',
|
|
401
|
+
path: '/consensus_score',
|
|
402
|
+
code: 'INVALID_TYPE',
|
|
403
|
+
value: obj.consensus_score
|
|
404
|
+
});
|
|
405
|
+
} else if (obj.consensus_score < 0.0 || obj.consensus_score > 1.0) {
|
|
406
|
+
errors.push({
|
|
407
|
+
field: 'consensus_score',
|
|
408
|
+
message: 'consensus_score must be between 0.0 and 1.0',
|
|
409
|
+
path: '/consensus_score',
|
|
410
|
+
code: 'CONSTRAINT_VIOLATION',
|
|
411
|
+
value: obj.consensus_score
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
// Validate gate_score (optional number 0.0-1.0)
|
|
416
|
+
if (obj.gate_score !== undefined) {
|
|
417
|
+
if (typeof obj.gate_score !== 'number') {
|
|
418
|
+
errors.push({
|
|
419
|
+
field: 'gate_score',
|
|
420
|
+
message: 'gate_score must be a number',
|
|
421
|
+
path: '/gate_score',
|
|
422
|
+
code: 'INVALID_TYPE',
|
|
423
|
+
value: obj.gate_score
|
|
424
|
+
});
|
|
425
|
+
} else if (obj.gate_score < 0.0 || obj.gate_score > 1.0) {
|
|
426
|
+
errors.push({
|
|
427
|
+
field: 'gate_score',
|
|
428
|
+
message: 'gate_score must be between 0.0 and 1.0',
|
|
429
|
+
path: '/gate_score',
|
|
430
|
+
code: 'CONSTRAINT_VIOLATION',
|
|
431
|
+
value: obj.gate_score
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Validate deliverable object
|
|
438
|
+
*/ validateDeliverable(deliverable, index, errors) {
|
|
439
|
+
if (typeof deliverable !== 'object' || deliverable === null) {
|
|
440
|
+
errors.push({
|
|
441
|
+
field: `deliverables[${index}]`,
|
|
442
|
+
message: 'deliverable must be an object',
|
|
443
|
+
path: `/deliverables/${index}`,
|
|
444
|
+
code: 'INVALID_TYPE',
|
|
445
|
+
value: deliverable
|
|
446
|
+
});
|
|
447
|
+
return;
|
|
448
|
+
}
|
|
449
|
+
const obj = deliverable;
|
|
450
|
+
// Validate path (required non-empty string)
|
|
451
|
+
if (typeof obj.path !== 'string' || obj.path.length === 0) {
|
|
452
|
+
errors.push({
|
|
453
|
+
field: `deliverables[${index}].path`,
|
|
454
|
+
message: 'path must be a non-empty string',
|
|
455
|
+
path: `/deliverables/${index}/path`,
|
|
456
|
+
code: 'INVALID_TYPE',
|
|
457
|
+
value: obj.path
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
// Validate type (required enum)
|
|
461
|
+
const types = [
|
|
462
|
+
'implementation',
|
|
463
|
+
'test',
|
|
464
|
+
'documentation',
|
|
465
|
+
'config',
|
|
466
|
+
'schema',
|
|
467
|
+
'script',
|
|
468
|
+
'other'
|
|
469
|
+
];
|
|
470
|
+
if (!types.includes(obj.type)) {
|
|
471
|
+
errors.push({
|
|
472
|
+
field: `deliverables[${index}].type`,
|
|
473
|
+
message: `type must be one of: ${types.join(', ')}`,
|
|
474
|
+
path: `/deliverables/${index}/type`,
|
|
475
|
+
code: 'INVALID_ENUM',
|
|
476
|
+
value: obj.type
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
// Validate status (required enum)
|
|
480
|
+
const statuses = [
|
|
481
|
+
'created',
|
|
482
|
+
'modified',
|
|
483
|
+
'deleted',
|
|
484
|
+
'validated',
|
|
485
|
+
'pending'
|
|
486
|
+
];
|
|
487
|
+
if (!statuses.includes(obj.status)) {
|
|
488
|
+
errors.push({
|
|
489
|
+
field: `deliverables[${index}].status`,
|
|
490
|
+
message: `status must be one of: ${statuses.join(', ')}`,
|
|
491
|
+
path: `/deliverables/${index}/status`,
|
|
492
|
+
code: 'INVALID_ENUM',
|
|
493
|
+
value: obj.status
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
// Validate optional fields
|
|
497
|
+
if (obj.size_bytes !== undefined && (typeof obj.size_bytes !== 'number' || !Number.isInteger(obj.size_bytes) || obj.size_bytes < 0)) {
|
|
498
|
+
errors.push({
|
|
499
|
+
field: `deliverables[${index}].size_bytes`,
|
|
500
|
+
message: 'size_bytes must be a non-negative integer',
|
|
501
|
+
path: `/deliverables/${index}/size_bytes`,
|
|
502
|
+
code: 'INVALID_TYPE',
|
|
503
|
+
value: obj.size_bytes
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
if (obj.lines !== undefined && (typeof obj.lines !== 'number' || !Number.isInteger(obj.lines) || obj.lines < 0)) {
|
|
507
|
+
errors.push({
|
|
508
|
+
field: `deliverables[${index}].lines`,
|
|
509
|
+
message: 'lines must be a non-negative integer',
|
|
510
|
+
path: `/deliverables/${index}/lines`,
|
|
511
|
+
code: 'INVALID_TYPE',
|
|
512
|
+
value: obj.lines
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
if (obj.checksum !== undefined && typeof obj.checksum !== 'string') {
|
|
516
|
+
errors.push({
|
|
517
|
+
field: `deliverables[${index}].checksum`,
|
|
518
|
+
message: 'checksum must be a string',
|
|
519
|
+
path: `/deliverables/${index}/checksum`,
|
|
520
|
+
code: 'INVALID_TYPE',
|
|
521
|
+
value: obj.checksum
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* Validate issue object
|
|
527
|
+
*/ validateIssue(issue, index, errors) {
|
|
528
|
+
if (typeof issue !== 'object' || issue === null) {
|
|
529
|
+
errors.push({
|
|
530
|
+
field: `issues[${index}]`,
|
|
531
|
+
message: 'issue must be an object',
|
|
532
|
+
path: `/issues/${index}`,
|
|
533
|
+
code: 'INVALID_TYPE',
|
|
534
|
+
value: issue
|
|
535
|
+
});
|
|
536
|
+
return;
|
|
537
|
+
}
|
|
538
|
+
const obj = issue;
|
|
539
|
+
// Validate severity (required enum)
|
|
540
|
+
const severities = [
|
|
541
|
+
'critical',
|
|
542
|
+
'high',
|
|
543
|
+
'medium',
|
|
544
|
+
'low',
|
|
545
|
+
'info'
|
|
546
|
+
];
|
|
547
|
+
if (!severities.includes(obj.severity)) {
|
|
548
|
+
errors.push({
|
|
549
|
+
field: `issues[${index}].severity`,
|
|
550
|
+
message: `severity must be one of: ${severities.join(', ')}`,
|
|
551
|
+
path: `/issues/${index}/severity`,
|
|
552
|
+
code: 'INVALID_ENUM',
|
|
553
|
+
value: obj.severity
|
|
554
|
+
});
|
|
555
|
+
}
|
|
556
|
+
// Validate category (required enum)
|
|
557
|
+
const categories = [
|
|
558
|
+
'security',
|
|
559
|
+
'performance',
|
|
560
|
+
'quality',
|
|
561
|
+
'style',
|
|
562
|
+
'documentation',
|
|
563
|
+
'testing',
|
|
564
|
+
'architecture',
|
|
565
|
+
'other'
|
|
566
|
+
];
|
|
567
|
+
if (!categories.includes(obj.category)) {
|
|
568
|
+
errors.push({
|
|
569
|
+
field: `issues[${index}].category`,
|
|
570
|
+
message: `category must be one of: ${categories.join(', ')}`,
|
|
571
|
+
path: `/issues/${index}/category`,
|
|
572
|
+
code: 'INVALID_ENUM',
|
|
573
|
+
value: obj.category
|
|
574
|
+
});
|
|
575
|
+
}
|
|
576
|
+
// Validate message (required non-empty string)
|
|
577
|
+
if (typeof obj.message !== 'string' || obj.message.length === 0) {
|
|
578
|
+
errors.push({
|
|
579
|
+
field: `issues[${index}].message`,
|
|
580
|
+
message: 'message must be a non-empty string',
|
|
581
|
+
path: `/issues/${index}/message`,
|
|
582
|
+
code: 'INVALID_TYPE',
|
|
583
|
+
value: obj.message
|
|
584
|
+
});
|
|
585
|
+
}
|
|
586
|
+
// Validate optional fields
|
|
587
|
+
if (obj.location !== undefined && typeof obj.location !== 'string') {
|
|
588
|
+
errors.push({
|
|
589
|
+
field: `issues[${index}].location`,
|
|
590
|
+
message: 'location must be a string',
|
|
591
|
+
path: `/issues/${index}/location`,
|
|
592
|
+
code: 'INVALID_TYPE',
|
|
593
|
+
value: obj.location
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
if (obj.recommendation !== undefined && typeof obj.recommendation !== 'string') {
|
|
597
|
+
errors.push({
|
|
598
|
+
field: `issues[${index}].recommendation`,
|
|
599
|
+
message: 'recommendation must be a string',
|
|
600
|
+
path: `/issues/${index}/recommendation`,
|
|
601
|
+
code: 'INVALID_TYPE',
|
|
602
|
+
value: obj.recommendation
|
|
603
|
+
});
|
|
604
|
+
}
|
|
605
|
+
if (obj.code !== undefined && typeof obj.code !== 'string') {
|
|
606
|
+
errors.push({
|
|
607
|
+
field: `issues[${index}].code`,
|
|
608
|
+
message: 'code must be a string',
|
|
609
|
+
path: `/issues/${index}/code`,
|
|
610
|
+
code: 'INVALID_TYPE',
|
|
611
|
+
value: obj.code
|
|
612
|
+
});
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* Validate metrics object
|
|
617
|
+
*/ validateMetrics(metrics, errors) {
|
|
618
|
+
// All metrics fields are optional numbers
|
|
619
|
+
const knownMetrics = [
|
|
620
|
+
'files_created',
|
|
621
|
+
'files_modified',
|
|
622
|
+
'files_deleted',
|
|
623
|
+
'lines_of_code',
|
|
624
|
+
'test_coverage',
|
|
625
|
+
'tests_passed',
|
|
626
|
+
'tests_failed',
|
|
627
|
+
'execution_time_ms',
|
|
628
|
+
'memory_usage_mb'
|
|
629
|
+
];
|
|
630
|
+
for (const key of knownMetrics){
|
|
631
|
+
if (metrics[key] !== undefined && typeof metrics[key] !== 'number') {
|
|
632
|
+
errors.push({
|
|
633
|
+
field: `metrics.${key}`,
|
|
634
|
+
message: `${key} must be a number`,
|
|
635
|
+
path: `/metrics/${key}`,
|
|
636
|
+
code: 'INVALID_TYPE',
|
|
637
|
+
value: metrics[key]
|
|
638
|
+
});
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
// Validate test_coverage range
|
|
642
|
+
if (metrics.test_coverage !== undefined && typeof metrics.test_coverage === 'number' && (metrics.test_coverage < 0.0 || metrics.test_coverage > 1.0)) {
|
|
643
|
+
errors.push({
|
|
644
|
+
field: 'metrics.test_coverage',
|
|
645
|
+
message: 'test_coverage must be between 0.0 and 1.0',
|
|
646
|
+
path: '/metrics/test_coverage',
|
|
647
|
+
code: 'CONSTRAINT_VIOLATION',
|
|
648
|
+
value: metrics.test_coverage
|
|
649
|
+
});
|
|
650
|
+
}
|
|
651
|
+
// Validate custom_metrics (if present)
|
|
652
|
+
if (metrics.custom_metrics !== undefined) {
|
|
653
|
+
if (typeof metrics.custom_metrics !== 'object' || metrics.custom_metrics === null) {
|
|
654
|
+
errors.push({
|
|
655
|
+
field: 'metrics.custom_metrics',
|
|
656
|
+
message: 'custom_metrics must be an object',
|
|
657
|
+
path: '/metrics/custom_metrics',
|
|
658
|
+
code: 'INVALID_TYPE',
|
|
659
|
+
value: metrics.custom_metrics
|
|
660
|
+
});
|
|
661
|
+
} else {
|
|
662
|
+
const customMetrics = metrics.custom_metrics;
|
|
663
|
+
for (const [key, value] of Object.entries(customMetrics)){
|
|
664
|
+
if (typeof value !== 'number') {
|
|
665
|
+
errors.push({
|
|
666
|
+
field: `metrics.custom_metrics.${key}`,
|
|
667
|
+
message: `custom_metrics.${key} must be a number`,
|
|
668
|
+
path: `/metrics/custom_metrics/${key}`,
|
|
669
|
+
code: 'INVALID_TYPE',
|
|
670
|
+
value
|
|
671
|
+
});
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
// Check for unknown fields (not in known metrics or custom_metrics)
|
|
677
|
+
for (const key of Object.keys(metrics)){
|
|
678
|
+
if (key !== 'custom_metrics' && !knownMetrics.includes(key)) {
|
|
679
|
+
errors.push({
|
|
680
|
+
field: `metrics.${key}`,
|
|
681
|
+
message: `Unknown metric field '${key}'. Use 'custom_metrics' for extensibility.`,
|
|
682
|
+
path: `/metrics/${key}`,
|
|
683
|
+
code: 'UNKNOWN_FIELD',
|
|
684
|
+
value: metrics[key]
|
|
685
|
+
});
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
* Validate error object
|
|
691
|
+
*/ validateError(error, index, errors) {
|
|
692
|
+
if (typeof error !== 'object' || error === null) {
|
|
693
|
+
errors.push({
|
|
694
|
+
field: `errors[${index}]`,
|
|
695
|
+
message: 'error must be an object',
|
|
696
|
+
path: `/errors/${index}`,
|
|
697
|
+
code: 'INVALID_TYPE',
|
|
698
|
+
value: error
|
|
699
|
+
});
|
|
700
|
+
return;
|
|
701
|
+
}
|
|
702
|
+
const obj = error;
|
|
703
|
+
// Validate code (required string)
|
|
704
|
+
if (typeof obj.code !== 'string') {
|
|
705
|
+
errors.push({
|
|
706
|
+
field: `errors[${index}].code`,
|
|
707
|
+
message: 'code must be a string',
|
|
708
|
+
path: `/errors/${index}/code`,
|
|
709
|
+
code: 'INVALID_TYPE',
|
|
710
|
+
value: obj.code
|
|
711
|
+
});
|
|
712
|
+
}
|
|
713
|
+
// Validate message (required non-empty string)
|
|
714
|
+
if (typeof obj.message !== 'string' || obj.message.length === 0) {
|
|
715
|
+
errors.push({
|
|
716
|
+
field: `errors[${index}].message`,
|
|
717
|
+
message: 'message must be a non-empty string',
|
|
718
|
+
path: `/errors/${index}/message`,
|
|
719
|
+
code: 'INVALID_TYPE',
|
|
720
|
+
value: obj.message
|
|
721
|
+
});
|
|
722
|
+
}
|
|
723
|
+
// Validate optional fields
|
|
724
|
+
if (obj.stack !== undefined && typeof obj.stack !== 'string') {
|
|
725
|
+
errors.push({
|
|
726
|
+
field: `errors[${index}].stack`,
|
|
727
|
+
message: 'stack must be a string',
|
|
728
|
+
path: `/errors/${index}/stack`,
|
|
729
|
+
code: 'INVALID_TYPE',
|
|
730
|
+
value: obj.stack
|
|
731
|
+
});
|
|
732
|
+
}
|
|
733
|
+
if (obj.context !== undefined && (typeof obj.context !== 'object' || obj.context === null)) {
|
|
734
|
+
errors.push({
|
|
735
|
+
field: `errors[${index}].context`,
|
|
736
|
+
message: 'context must be an object',
|
|
737
|
+
path: `/errors/${index}/context`,
|
|
738
|
+
code: 'INVALID_TYPE',
|
|
739
|
+
value: obj.context
|
|
740
|
+
});
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
/**
|
|
744
|
+
* Validate metadata object
|
|
745
|
+
*/ validateMetadata(metadata, errors) {
|
|
746
|
+
// Validate agent_type (required string)
|
|
747
|
+
if (typeof metadata.agent_type !== 'string') {
|
|
748
|
+
errors.push({
|
|
749
|
+
field: 'metadata.agent_type',
|
|
750
|
+
message: 'agent_type must be a string',
|
|
751
|
+
path: '/metadata/agent_type',
|
|
752
|
+
code: 'INVALID_TYPE',
|
|
753
|
+
value: metadata.agent_type
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
// Validate optional fields
|
|
757
|
+
if (metadata.agent_id !== undefined && typeof metadata.agent_id !== 'string') {
|
|
758
|
+
errors.push({
|
|
759
|
+
field: 'metadata.agent_id',
|
|
760
|
+
message: 'agent_id must be a string',
|
|
761
|
+
path: '/metadata/agent_id',
|
|
762
|
+
code: 'INVALID_TYPE',
|
|
763
|
+
value: metadata.agent_id
|
|
764
|
+
});
|
|
765
|
+
}
|
|
766
|
+
if (metadata.execution_time_ms !== undefined && (typeof metadata.execution_time_ms !== 'number' || !Number.isInteger(metadata.execution_time_ms) || metadata.execution_time_ms < 0)) {
|
|
767
|
+
errors.push({
|
|
768
|
+
field: 'metadata.execution_time_ms',
|
|
769
|
+
message: 'execution_time_ms must be a non-negative integer',
|
|
770
|
+
path: '/metadata/execution_time_ms',
|
|
771
|
+
code: 'INVALID_TYPE',
|
|
772
|
+
value: metadata.execution_time_ms
|
|
773
|
+
});
|
|
774
|
+
}
|
|
775
|
+
if (metadata.timestamp !== undefined && typeof metadata.timestamp !== 'string') {
|
|
776
|
+
errors.push({
|
|
777
|
+
field: 'metadata.timestamp',
|
|
778
|
+
message: 'timestamp must be a string (ISO 8601 format)',
|
|
779
|
+
path: '/metadata/timestamp',
|
|
780
|
+
code: 'INVALID_TYPE',
|
|
781
|
+
value: metadata.timestamp
|
|
782
|
+
});
|
|
783
|
+
}
|
|
784
|
+
if (metadata.swarm_id !== undefined && typeof metadata.swarm_id !== 'string') {
|
|
785
|
+
errors.push({
|
|
786
|
+
field: 'metadata.swarm_id',
|
|
787
|
+
message: 'swarm_id must be a string',
|
|
788
|
+
path: '/metadata/swarm_id',
|
|
789
|
+
code: 'INVALID_TYPE',
|
|
790
|
+
value: metadata.swarm_id
|
|
791
|
+
});
|
|
792
|
+
}
|
|
793
|
+
if (metadata.iteration !== undefined && (typeof metadata.iteration !== 'number' || !Number.isInteger(metadata.iteration) || metadata.iteration < 1)) {
|
|
794
|
+
errors.push({
|
|
795
|
+
field: 'metadata.iteration',
|
|
796
|
+
message: 'iteration must be a positive integer',
|
|
797
|
+
path: '/metadata/iteration',
|
|
798
|
+
code: 'INVALID_TYPE',
|
|
799
|
+
value: metadata.iteration
|
|
800
|
+
});
|
|
801
|
+
}
|
|
802
|
+
if (metadata.mode !== undefined) {
|
|
803
|
+
const modes = [
|
|
804
|
+
'mvp',
|
|
805
|
+
'standard',
|
|
806
|
+
'enterprise'
|
|
807
|
+
];
|
|
808
|
+
if (!modes.includes(metadata.mode)) {
|
|
809
|
+
errors.push({
|
|
810
|
+
field: 'metadata.mode',
|
|
811
|
+
message: `mode must be one of: ${modes.join(', ')}`,
|
|
812
|
+
path: '/metadata/mode',
|
|
813
|
+
code: 'INVALID_ENUM',
|
|
814
|
+
value: metadata.mode
|
|
815
|
+
});
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
if (metadata.context !== undefined && (typeof metadata.context !== 'object' || metadata.context === null)) {
|
|
819
|
+
errors.push({
|
|
820
|
+
field: 'metadata.context',
|
|
821
|
+
message: 'context must be an object',
|
|
822
|
+
path: '/metadata/context',
|
|
823
|
+
code: 'INVALID_TYPE',
|
|
824
|
+
value: metadata.context
|
|
825
|
+
});
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
/**
|
|
829
|
+
* Format validation errors for display
|
|
830
|
+
*/ formatErrors(result) {
|
|
831
|
+
if (result.valid) {
|
|
832
|
+
return 'Agent output is valid.';
|
|
833
|
+
}
|
|
834
|
+
let output = `Validation failed with ${result.errors.length} error(s):\n\n`;
|
|
835
|
+
for (const error of result.errors){
|
|
836
|
+
output += `[${error.code}] ${error.field}\n`;
|
|
837
|
+
output += ` ${error.message}\n`;
|
|
838
|
+
if (error.value !== undefined) {
|
|
839
|
+
// Use sanitizeValue to prevent sensitive data leakage
|
|
840
|
+
output += ` Current value: ${sanitizeValue(error.value, error.field)}\n`;
|
|
841
|
+
}
|
|
842
|
+
output += '\n';
|
|
843
|
+
}
|
|
844
|
+
if (result.warnings.length > 0) {
|
|
845
|
+
output += `\nWarnings (${result.warnings.length}):\n`;
|
|
846
|
+
for (const warning of result.warnings){
|
|
847
|
+
output += ` - ${warning}\n`;
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
return output;
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
// ============================================================================
|
|
854
|
+
// Singleton Instance and Convenience Functions
|
|
855
|
+
// ============================================================================
|
|
856
|
+
let validatorInstance = null;
|
|
857
|
+
/**
|
|
858
|
+
* Get or create validator instance
|
|
859
|
+
*/ export function getValidator() {
|
|
860
|
+
if (!validatorInstance) {
|
|
861
|
+
validatorInstance = new AgentOutputValidator();
|
|
862
|
+
}
|
|
863
|
+
return validatorInstance;
|
|
864
|
+
}
|
|
865
|
+
/**
|
|
866
|
+
* Validate agent output object
|
|
867
|
+
*/ export function validateAgentOutput(output) {
|
|
868
|
+
return getValidator().validate(output);
|
|
869
|
+
}
|
|
870
|
+
/**
|
|
871
|
+
* Validate JSON string
|
|
872
|
+
*/ export function validateJSON(jsonString) {
|
|
873
|
+
return getValidator().validateJSON(jsonString);
|
|
874
|
+
}
|
|
875
|
+
/**
|
|
876
|
+
* Validate Loop 3 output
|
|
877
|
+
*/ export function validateLoop3Output(output) {
|
|
878
|
+
const result = getValidator().validate(output);
|
|
879
|
+
if (result.valid && result.output_type !== 'loop3') {
|
|
880
|
+
return {
|
|
881
|
+
valid: false,
|
|
882
|
+
errors: [
|
|
883
|
+
{
|
|
884
|
+
field: 'output_type',
|
|
885
|
+
message: "Expected output_type 'loop3'",
|
|
886
|
+
path: '/output_type',
|
|
887
|
+
code: 'INVALID_OUTPUT_TYPE',
|
|
888
|
+
value: result.output_type
|
|
889
|
+
}
|
|
890
|
+
],
|
|
891
|
+
warnings: []
|
|
892
|
+
};
|
|
893
|
+
}
|
|
894
|
+
return result;
|
|
895
|
+
}
|
|
896
|
+
/**
|
|
897
|
+
* Validate Loop 2 output
|
|
898
|
+
*/ export function validateLoop2Output(output) {
|
|
899
|
+
const result = getValidator().validate(output);
|
|
900
|
+
if (result.valid && result.output_type !== 'loop2') {
|
|
901
|
+
return {
|
|
902
|
+
valid: false,
|
|
903
|
+
errors: [
|
|
904
|
+
{
|
|
905
|
+
field: 'output_type',
|
|
906
|
+
message: "Expected output_type 'loop2'",
|
|
907
|
+
path: '/output_type',
|
|
908
|
+
code: 'INVALID_OUTPUT_TYPE',
|
|
909
|
+
value: result.output_type
|
|
910
|
+
}
|
|
911
|
+
],
|
|
912
|
+
warnings: []
|
|
913
|
+
};
|
|
914
|
+
}
|
|
915
|
+
return result;
|
|
916
|
+
}
|
|
917
|
+
/**
|
|
918
|
+
* Validate Product Owner output
|
|
919
|
+
*/ export function validateProductOwnerOutput(output) {
|
|
920
|
+
const result = getValidator().validate(output);
|
|
921
|
+
if (result.valid && result.output_type !== 'product_owner') {
|
|
922
|
+
return {
|
|
923
|
+
valid: false,
|
|
924
|
+
errors: [
|
|
925
|
+
{
|
|
926
|
+
field: 'output_type',
|
|
927
|
+
message: "Expected output_type 'product_owner'",
|
|
928
|
+
path: '/output_type',
|
|
929
|
+
code: 'INVALID_OUTPUT_TYPE',
|
|
930
|
+
value: result.output_type
|
|
931
|
+
}
|
|
932
|
+
],
|
|
933
|
+
warnings: []
|
|
934
|
+
};
|
|
935
|
+
}
|
|
936
|
+
return result;
|
|
937
|
+
}
|
|
938
|
+
/**
|
|
939
|
+
* Check if output is valid (boolean shortcut)
|
|
940
|
+
*/ export function isValidOutput(output) {
|
|
941
|
+
return getValidator().validate(output).valid;
|
|
942
|
+
}
|
|
943
|
+
/**
|
|
944
|
+
* Reset validator instance (useful for testing)
|
|
945
|
+
*/ export function resetValidator() {
|
|
946
|
+
validatorInstance = null;
|
|
947
|
+
}
|
|
948
|
+
export default AgentOutputValidator;
|
|
949
|
+
|
|
950
|
+
//# sourceMappingURL=agent-output-validator.js.map
|