claude-flow-novice 2.15.5 → 2.15.7

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.
Files changed (540) hide show
  1. package/.claude/cfn-extras/.gs-api-quota.json +16 -0
  2. package/.claude/cfn-extras/.gs-progress-state.json +22 -0
  3. package/.claude/cfn-extras/GOOGLE_SHEETS_IMPLEMENTATION_SUMMARY.md +414 -0
  4. package/.claude/cfn-extras/agents/google-sheets/README.md +114 -0
  5. package/.claude/cfn-extras/agents/google-sheets/google-sheets-advanced-analytics-specialist.md +288 -0
  6. package/.claude/cfn-extras/agents/google-sheets/google-sheets-api-integrator.md +127 -0
  7. package/.claude/cfn-extras/agents/google-sheets/google-sheets-automation-scripting-specialist.md +195 -0
  8. package/.claude/cfn-extras/agents/google-sheets/google-sheets-business-validator.md +179 -0
  9. package/.claude/cfn-extras/agents/google-sheets/google-sheets-collaboration-security-specialist.md +240 -0
  10. package/.claude/cfn-extras/agents/google-sheets/google-sheets-coordinator.md +214 -0
  11. package/.claude/cfn-extras/agents/google-sheets/google-sheets-data-transformer.md +127 -0
  12. package/.claude/cfn-extras/agents/google-sheets/google-sheets-data-validation-quality-specialist.md +177 -0
  13. package/.claude/cfn-extras/agents/google-sheets/google-sheets-data-validator.md +119 -0
  14. package/.claude/cfn-extras/agents/google-sheets/google-sheets-data-visualization-specialist.md +135 -0
  15. package/.claude/cfn-extras/agents/google-sheets/google-sheets-design-layout-specialist.md +109 -0
  16. package/.claude/cfn-extras/agents/google-sheets/google-sheets-formula-engineer.md +127 -0
  17. package/.claude/cfn-extras/agents/google-sheets/google-sheets-formula-engineering-specialist.md +138 -0
  18. package/.claude/cfn-extras/agents/google-sheets/google-sheets-formula-validator.md +128 -0
  19. package/.claude/cfn-extras/agents/google-sheets/google-sheets-generalist.md +645 -0
  20. package/.claude/cfn-extras/agents/google-sheets/google-sheets-integration-api-specialist.md +258 -0
  21. package/.claude/cfn-extras/agents/google-sheets/google-sheets-performance-analyst.md +125 -0
  22. package/.claude/cfn-extras/agents/google-sheets/google-sheets-performance-optimization-specialist.md +211 -0
  23. package/.claude/cfn-extras/agents/google-sheets/google-sheets-schema-designer.md +130 -0
  24. package/.claude/cfn-extras/agents/google-sheets/google-sheets-template-architecture-specialist.md +259 -0
  25. package/.claude/cfn-extras/docs/GOOGLE_SHEETS_CFN_LOOP.md +617 -0
  26. package/.claude/cfn-extras/skills/GOOGLE_SHEETS_SKILLS_README.md +453 -0
  27. package/.claude/cfn-extras/skills/google-sheets-api-coordinator/SKILL.md +272 -0
  28. package/.claude/cfn-extras/skills/google-sheets-api-coordinator/api-call.sh +254 -0
  29. package/.claude/cfn-extras/skills/google-sheets-api-coordinator/test.sh +174 -0
  30. package/.claude/cfn-extras/skills/google-sheets-api-coordinator/validate.sh +98 -0
  31. package/.claude/cfn-extras/skills/google-sheets-decomposition/SKILL.md +269 -0
  32. package/.claude/cfn-extras/skills/google-sheets-decomposition/decompose.sh +313 -0
  33. package/.claude/cfn-extras/skills/google-sheets-formula-builder/SKILL.md +237 -0
  34. package/.claude/cfn-extras/skills/google-sheets-formula-builder/build-formula.sh +220 -0
  35. package/.claude/cfn-extras/skills/google-sheets-formula-builder/test.sh +172 -0
  36. package/.claude/cfn-extras/skills/google-sheets-formula-builder/validate.sh +98 -0
  37. package/.claude/cfn-extras/skills/google-sheets-progress/SKILL.md +287 -0
  38. package/.claude/cfn-extras/skills/google-sheets-progress/test.sh +385 -0
  39. package/.claude/cfn-extras/skills/google-sheets-progress/track-progress.sh +516 -0
  40. package/.claude/cfn-extras/skills/google-sheets-progress/validate.sh +119 -0
  41. package/.claude/cfn-extras/skills/google-sheets-sprint-order/SKILL.md +277 -0
  42. package/.claude/cfn-extras/skills/google-sheets-sprint-order/order-sprints.sh +233 -0
  43. package/.claude/cfn-extras/skills/google-sheets-validation/SKILL.md +352 -0
  44. package/.claude/cfn-extras/skills/google-sheets-validation/test.sh +355 -0
  45. package/.claude/cfn-extras/skills/google-sheets-validation/validate-state.sh +374 -0
  46. package/.claude/cfn-extras/skills/google-sheets-validation/validate.sh +128 -0
  47. package/.claude/commands/cfn-context.md +10 -0
  48. package/.claude/commands/cfn-loop-cli.md +36 -15
  49. package/.claude/commands/google-sheets/google-sheets-loop.md +289 -0
  50. package/.claude/skills/cfn-agent-selector/SKILL.md +143 -0
  51. package/.claude/skills/cfn-agent-selector/select-agents.sh +94 -0
  52. package/.claude/skills/cfn-agent-spawning/get-agent-provider-env.sh +22 -2
  53. package/.claude/skills/cfn-docker-agent-spawning/spawn-agent.sh +21 -2
  54. package/.claude/skills/cfn-docker-loop-orchestration/orchestrate.sh +11 -5
  55. package/.claude/skills/cfn-docker-redis-coordination/MIGRATION_SUMMARY.md +348 -0
  56. package/.claude/skills/cfn-docker-redis-coordination/README.md +294 -0
  57. package/.claude/skills/cfn-docker-redis-coordination/jest.config.js +37 -0
  58. package/.claude/skills/cfn-docker-redis-coordination/package-lock.json +5259 -0
  59. package/.claude/skills/cfn-docker-redis-coordination/package.json +40 -0
  60. package/.claude/skills/cfn-docker-redis-coordination/src/coordinator.ts +801 -0
  61. package/.claude/skills/cfn-docker-redis-coordination/src/index.ts +42 -0
  62. package/.claude/skills/cfn-docker-redis-coordination/src/types.ts +351 -0
  63. package/.claude/skills/cfn-docker-redis-coordination/tests/coordinator.test.ts +1464 -0
  64. package/.claude/skills/cfn-docker-redis-coordination/tsconfig.json +30 -0
  65. package/.claude/skills/cfn-loop-orchestration/.eslintrc.js +56 -0
  66. package/.claude/skills/cfn-loop-orchestration/.prettierrc.json +18 -0
  67. package/.claude/skills/cfn-loop-orchestration/README.md +149 -41
  68. package/.claude/skills/cfn-loop-orchestration/helpers/gate-check.sh +39 -577
  69. package/.claude/skills/cfn-loop-orchestration/helpers/parse-test-results.sh +49 -270
  70. package/.claude/skills/cfn-loop-orchestration/jest.config.js +67 -0
  71. package/.claude/skills/cfn-loop-orchestration/orchestrate-wrapper.sh +268 -0
  72. package/.claude/skills/cfn-loop-orchestration/orchestrate.sh +91 -8
  73. package/.claude/skills/cfn-loop-orchestration/package-lock.json +5470 -0
  74. package/.claude/skills/cfn-loop-orchestration/package.json +49 -0
  75. package/.claude/skills/cfn-loop-orchestration/src/agent-spawner/agent-spawner.ts +34 -0
  76. package/.claude/skills/cfn-loop-orchestration/src/gate-checker/gate-checker.ts +36 -0
  77. package/.claude/skills/cfn-loop-orchestration/src/helpers/consensus.ts +87 -0
  78. package/.claude/skills/cfn-loop-orchestration/src/helpers/gate-check.ts +115 -0
  79. package/.claude/skills/cfn-loop-orchestration/src/helpers/parse-test-results.ts +372 -0
  80. package/.claude/skills/cfn-loop-orchestration/src/index.ts +14 -0
  81. package/.claude/skills/cfn-loop-orchestration/src/orchestrator/orchestrator.ts +31 -0
  82. package/.claude/skills/cfn-loop-orchestration/src/redis/redis-coordinator.ts +72 -0
  83. package/.claude/skills/cfn-loop-orchestration/src/types.ts +188 -0
  84. package/.claude/skills/cfn-loop-orchestration/src/utils/logger.ts +32 -0
  85. package/.claude/skills/cfn-loop-orchestration/tests/consensus.test.ts +142 -0
  86. package/.claude/skills/cfn-loop-orchestration/tests/deliverable-verifier.test.ts +199 -0
  87. package/.claude/skills/cfn-loop-orchestration/tests/gate-check.test.ts +325 -0
  88. package/.claude/skills/cfn-loop-orchestration/tests/iteration-manager.test.ts +132 -0
  89. package/.claude/skills/cfn-loop-orchestration/tests/parse-test-results.test.ts +382 -0
  90. package/.claude/skills/cfn-loop-orchestration/tests/setup.ts +22 -0
  91. package/.claude/skills/cfn-loop-orchestration/tests/timeout-calculator.test.ts +118 -0
  92. package/.claude/skills/cfn-loop-orchestration/tests/types.test.ts +132 -0
  93. package/.claude/skills/cfn-loop-orchestration/tsconfig.json +54 -0
  94. package/.claude/skills/cfn-redis-coordination/bash-wrappers/store-context.sh +23 -0
  95. package/.claude/skills/cfn-redis-coordination/coverage/clover.xml +1447 -0
  96. package/.claude/skills/cfn-redis-coordination/coverage/coverage-final.json +13 -0
  97. package/.claude/skills/cfn-redis-coordination/coverage/lcov-report/agent-logger.ts.html +1423 -0
  98. package/.claude/skills/cfn-redis-coordination/coverage/lcov-report/agent-recovery.ts.html +1447 -0
  99. package/.claude/skills/cfn-redis-coordination/coverage/lcov-report/base.css +224 -0
  100. package/.claude/skills/cfn-redis-coordination/coverage/lcov-report/block-navigation.js +87 -0
  101. package/.claude/skills/cfn-redis-coordination/coverage/lcov-report/completion-reporter.ts.html +1273 -0
  102. package/.claude/skills/cfn-redis-coordination/coverage/lcov-report/context-manager.ts.html +1066 -0
  103. package/.claude/skills/cfn-redis-coordination/coverage/lcov-report/favicon.png +0 -0
  104. package/.claude/skills/cfn-redis-coordination/coverage/lcov-report/index.html +281 -0
  105. package/.claude/skills/cfn-redis-coordination/coverage/lcov-report/mode-detector.ts.html +550 -0
  106. package/.claude/skills/cfn-redis-coordination/coverage/lcov-report/prettify.css +1 -0
  107. package/.claude/skills/cfn-redis-coordination/coverage/lcov-report/prettify.js +2 -0
  108. package/.claude/skills/cfn-redis-coordination/coverage/lcov-report/redis-client.ts.html +2047 -0
  109. package/.claude/skills/cfn-redis-coordination/coverage/lcov-report/result-collector.ts.html +1396 -0
  110. package/.claude/skills/cfn-redis-coordination/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  111. package/.claude/skills/cfn-redis-coordination/coverage/lcov-report/sorter.js +210 -0
  112. package/.claude/skills/cfn-redis-coordination/coverage/lcov-report/swarm-manager.ts.html +1567 -0
  113. package/.claude/skills/cfn-redis-coordination/coverage/lcov-report/task-analyzer.ts.html +1297 -0
  114. package/.claude/skills/cfn-redis-coordination/coverage/lcov-report/task-executor.ts.html +1354 -0
  115. package/.claude/skills/cfn-redis-coordination/coverage/lcov-report/types.ts.html +790 -0
  116. package/.claude/skills/cfn-redis-coordination/coverage/lcov-report/waiting-coordinator.ts.html +1846 -0
  117. package/.claude/skills/cfn-redis-coordination/coverage/lcov.info +2650 -0
  118. package/.claude/skills/cfn-redis-coordination/dist/agent-logger.d.ts +92 -0
  119. package/.claude/skills/cfn-redis-coordination/dist/agent-logger.d.ts.map +1 -0
  120. package/.claude/skills/cfn-redis-coordination/dist/agent-logger.js +329 -0
  121. package/.claude/skills/cfn-redis-coordination/dist/agent-logger.js.map +1 -0
  122. package/.claude/skills/cfn-redis-coordination/dist/agent-recovery.d.ts +75 -0
  123. package/.claude/skills/cfn-redis-coordination/dist/agent-recovery.d.ts.map +1 -0
  124. package/.claude/skills/cfn-redis-coordination/dist/agent-recovery.js +302 -0
  125. package/.claude/skills/cfn-redis-coordination/dist/agent-recovery.js.map +1 -0
  126. package/.claude/skills/cfn-redis-coordination/dist/completion-reporter.d.ts +58 -0
  127. package/.claude/skills/cfn-redis-coordination/dist/completion-reporter.d.ts.map +1 -0
  128. package/.claude/skills/cfn-redis-coordination/dist/completion-reporter.js +237 -0
  129. package/.claude/skills/cfn-redis-coordination/dist/completion-reporter.js.map +1 -0
  130. package/.claude/skills/cfn-redis-coordination/dist/context-manager.d.ts +63 -0
  131. package/.claude/skills/cfn-redis-coordination/dist/context-manager.d.ts.map +1 -0
  132. package/.claude/skills/cfn-redis-coordination/dist/context-manager.js +230 -0
  133. package/.claude/skills/cfn-redis-coordination/dist/context-manager.js.map +1 -0
  134. package/.claude/skills/cfn-redis-coordination/dist/index.d.ts +45 -0
  135. package/.claude/skills/cfn-redis-coordination/dist/index.d.ts.map +1 -0
  136. package/.claude/skills/cfn-redis-coordination/dist/index.js +114 -0
  137. package/.claude/skills/cfn-redis-coordination/dist/index.js.map +1 -0
  138. package/.claude/skills/cfn-redis-coordination/dist/mode-detector.d.ts +31 -0
  139. package/.claude/skills/cfn-redis-coordination/dist/mode-detector.d.ts.map +1 -0
  140. package/.claude/skills/cfn-redis-coordination/dist/mode-detector.js +185 -0
  141. package/.claude/skills/cfn-redis-coordination/dist/mode-detector.js.map +1 -0
  142. package/.claude/skills/cfn-redis-coordination/dist/redis-client.d.ts +191 -0
  143. package/.claude/skills/cfn-redis-coordination/dist/redis-client.d.ts.map +1 -0
  144. package/.claude/skills/cfn-redis-coordination/dist/redis-client.js +509 -0
  145. package/.claude/skills/cfn-redis-coordination/dist/redis-client.js.map +1 -0
  146. package/.claude/skills/cfn-redis-coordination/dist/result-collector.d.ts +75 -0
  147. package/.claude/skills/cfn-redis-coordination/dist/result-collector.d.ts.map +1 -0
  148. package/.claude/skills/cfn-redis-coordination/dist/result-collector.js +281 -0
  149. package/.claude/skills/cfn-redis-coordination/dist/result-collector.js.map +1 -0
  150. package/.claude/skills/cfn-redis-coordination/dist/swarm-manager.d.ts +75 -0
  151. package/.claude/skills/cfn-redis-coordination/dist/swarm-manager.d.ts.map +1 -0
  152. package/.claude/skills/cfn-redis-coordination/dist/swarm-manager.js +354 -0
  153. package/.claude/skills/cfn-redis-coordination/dist/swarm-manager.js.map +1 -0
  154. package/.claude/skills/cfn-redis-coordination/dist/task-analyzer.d.ts +62 -0
  155. package/.claude/skills/cfn-redis-coordination/dist/task-analyzer.d.ts.map +1 -0
  156. package/.claude/skills/cfn-redis-coordination/dist/task-analyzer.js +305 -0
  157. package/.claude/skills/cfn-redis-coordination/dist/task-analyzer.js.map +1 -0
  158. package/.claude/skills/cfn-redis-coordination/dist/task-executor.d.ts +97 -0
  159. package/.claude/skills/cfn-redis-coordination/dist/task-executor.d.ts.map +1 -0
  160. package/.claude/skills/cfn-redis-coordination/dist/task-executor.js +283 -0
  161. package/.claude/skills/cfn-redis-coordination/dist/task-executor.js.map +1 -0
  162. package/.claude/skills/cfn-redis-coordination/dist/types.d.ts +176 -0
  163. package/.claude/skills/cfn-redis-coordination/dist/types.d.ts.map +1 -0
  164. package/.claude/skills/cfn-redis-coordination/dist/types.js +81 -0
  165. package/.claude/skills/cfn-redis-coordination/dist/types.js.map +1 -0
  166. package/.claude/skills/cfn-redis-coordination/dist/waiting-coordinator.d.ts +86 -0
  167. package/.claude/skills/cfn-redis-coordination/dist/waiting-coordinator.d.ts.map +1 -0
  168. package/.claude/skills/cfn-redis-coordination/dist/waiting-coordinator.js +419 -0
  169. package/.claude/skills/cfn-redis-coordination/dist/waiting-coordinator.js.map +1 -0
  170. package/.claude/skills/cfn-redis-coordination/docs/migration/PHASE_3_REDIS_COORDINATION_COMPLETION_REPORT.md +553 -0
  171. package/.claude/skills/cfn-redis-coordination/jest.config.js +23 -0
  172. package/.claude/skills/cfn-redis-coordination/package-lock.json +5272 -0
  173. package/.claude/skills/cfn-redis-coordination/package.json +45 -0
  174. package/.claude/skills/cfn-redis-coordination/redis-cli-wrapper.sh +21 -8
  175. package/.claude/skills/cfn-redis-coordination/src/agent-logger.ts +446 -0
  176. package/.claude/skills/cfn-redis-coordination/src/agent-recovery.ts +454 -0
  177. package/.claude/skills/cfn-redis-coordination/src/completion-reporter.ts +396 -0
  178. package/.claude/skills/cfn-redis-coordination/src/context-manager.ts +327 -0
  179. package/.claude/skills/cfn-redis-coordination/src/index.ts +82 -0
  180. package/.claude/skills/cfn-redis-coordination/src/mode-detector.ts +155 -0
  181. package/.claude/skills/cfn-redis-coordination/src/redis/redis-client.ts +305 -0
  182. package/.claude/skills/cfn-redis-coordination/src/redis/redis-functions.ts +283 -0
  183. package/.claude/skills/cfn-redis-coordination/src/redis-client.ts +654 -0
  184. package/.claude/skills/cfn-redis-coordination/src/result-collector.ts +437 -0
  185. package/.claude/skills/cfn-redis-coordination/src/swarm-manager.ts +494 -0
  186. package/.claude/skills/cfn-redis-coordination/src/task-analyzer.ts +404 -0
  187. package/.claude/skills/cfn-redis-coordination/src/task-executor.ts +423 -0
  188. package/.claude/skills/cfn-redis-coordination/src/types.ts +235 -0
  189. package/.claude/skills/cfn-redis-coordination/src/waiting-coordinator.ts +587 -0
  190. package/.claude/skills/cfn-redis-coordination/test-connection-attempts.js +70 -0
  191. package/.claude/skills/cfn-redis-coordination/test-mode-simple.js +121 -0
  192. package/.claude/skills/cfn-redis-coordination/test-redis-check.js +84 -0
  193. package/.claude/skills/cfn-redis-coordination/test-task-mode-redis.cjs +391 -0
  194. package/.claude/skills/cfn-redis-coordination/tests/coordination.test.ts +788 -0
  195. package/.claude/skills/cfn-redis-coordination/tsconfig.json +31 -0
  196. package/claude-assets/agents/cfn-dev-team/coordinators/cfn-frontend-coordinator.md +13 -72
  197. package/claude-assets/agents/cfn-dev-team/coordinators/cfn-v3-coordinator.md +172 -62
  198. package/claude-assets/agents/cfn-dev-team/coordinators/consensus-builder.md +465 -508
  199. package/claude-assets/agents/cfn-dev-team/coordinators/handoff-coordinator.md +733 -743
  200. package/claude-assets/agents/cfn-dev-team/coordinators/multi-sprint-coordinator.md +13 -79
  201. package/claude-assets/agents/cfn-dev-team/dev-ops/docker-specialist.md +13 -18
  202. package/claude-assets/agents/cfn-dev-team/dev-ops/kubernetes-specialist.md +13 -18
  203. package/claude-assets/agents/cfn-dev-team/developers/api-gateway-specialist.md +13 -18
  204. package/claude-assets/agents/cfn-dev-team/developers/backend-developer.md +15 -17
  205. package/claude-assets/agents/cfn-dev-team/developers/data/data-engineer.md +15 -17
  206. package/claude-assets/agents/cfn-dev-team/developers/database/database-architect.md +15 -14
  207. package/claude-assets/agents/cfn-dev-team/developers/frontend/mobile-dev.md +15 -17
  208. package/claude-assets/agents/cfn-dev-team/developers/frontend/react-frontend-engineer.md +15 -17
  209. package/claude-assets/agents/cfn-dev-team/developers/frontend/typescript-specialist.md +15 -17
  210. package/claude-assets/agents/cfn-dev-team/developers/frontend/ui-designer.md +23 -30
  211. package/claude-assets/agents/cfn-dev-team/developers/graphql-specialist.md +13 -18
  212. package/claude-assets/agents/cfn-dev-team/developers/rust-developer.md +13 -18
  213. package/claude-assets/agents/cfn-dev-team/reviewers/code-reviewer.md +312 -317
  214. package/claude-assets/agents/cfn-dev-team/reviewers/quality/code-quality-validator.md +23 -20
  215. package/claude-assets/agents/cfn-dev-team/reviewers/quality/perf-analyzer.md +23 -20
  216. package/claude-assets/agents/cfn-dev-team/reviewers/quality/performance-benchmarker.md +23 -20
  217. package/claude-assets/agents/cfn-dev-team/reviewers/quality/security-specialist.md +23 -20
  218. package/claude-assets/agents/cfn-dev-team/testers/api-testing-specialist.md +16 -21
  219. package/claude-assets/agents/cfn-dev-team/testers/chaos-engineering-specialist.md +15 -20
  220. package/claude-assets/agents/cfn-dev-team/testers/contract-tester.md +718 -737
  221. package/claude-assets/agents/cfn-dev-team/testers/integration-tester.md +817 -828
  222. package/claude-assets/agents/cfn-dev-team/testers/interaction-tester.md +15 -20
  223. package/claude-assets/agents/cfn-dev-team/testers/load-testing-specialist.md +8 -9
  224. package/claude-assets/agents/cfn-dev-team/testers/mutation-testing-specialist.md +668 -684
  225. package/claude-assets/agents/cfn-dev-team/testers/playwright-tester.md +15 -20
  226. package/claude-assets/agents/cfn-dev-team/testers/tester.md +248 -253
  227. package/claude-assets/agents/cfn-dev-team/utility/epic-creator.md +13 -18
  228. package/claude-assets/agents/cfn-dev-team/utility/memory-leak-specialist.md +13 -18
  229. package/claude-assets/agents/cfn-dev-team/utility/z-ai-specialist.md +13 -18
  230. package/claude-assets/agents/custom/cfn-redis-operations.md +530 -0
  231. package/claude-assets/agents/custom/cfn-system-expert.md +77 -0
  232. package/claude-assets/cfn-extras/.gs-api-quota.json +16 -0
  233. package/claude-assets/cfn-extras/.gs-progress-state.json +22 -0
  234. package/claude-assets/cfn-extras/GOOGLE_SHEETS_IMPLEMENTATION_SUMMARY.md +414 -0
  235. package/claude-assets/cfn-extras/agents/google-sheets/README.md +114 -0
  236. package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-advanced-analytics-specialist.md +288 -0
  237. package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-api-integrator.md +127 -0
  238. package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-automation-scripting-specialist.md +195 -0
  239. package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-business-validator.md +179 -0
  240. package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-collaboration-security-specialist.md +240 -0
  241. package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-coordinator.md +214 -0
  242. package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-data-transformer.md +127 -0
  243. package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-data-validation-quality-specialist.md +177 -0
  244. package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-data-validator.md +119 -0
  245. package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-data-visualization-specialist.md +135 -0
  246. package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-design-layout-specialist.md +109 -0
  247. package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-formula-engineer.md +127 -0
  248. package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-formula-engineering-specialist.md +138 -0
  249. package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-formula-validator.md +128 -0
  250. package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-generalist.md +645 -0
  251. package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-integration-api-specialist.md +258 -0
  252. package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-performance-analyst.md +125 -0
  253. package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-performance-optimization-specialist.md +211 -0
  254. package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-schema-designer.md +130 -0
  255. package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-template-architecture-specialist.md +259 -0
  256. package/claude-assets/cfn-extras/docs/GOOGLE_SHEETS_CFN_LOOP.md +617 -0
  257. package/claude-assets/cfn-extras/skills/GOOGLE_SHEETS_SKILLS_README.md +453 -0
  258. package/claude-assets/cfn-extras/skills/google-sheets-api-coordinator/SKILL.md +272 -0
  259. package/claude-assets/cfn-extras/skills/google-sheets-api-coordinator/api-call.sh +254 -0
  260. package/claude-assets/cfn-extras/skills/google-sheets-api-coordinator/test.sh +174 -0
  261. package/claude-assets/cfn-extras/skills/google-sheets-api-coordinator/validate.sh +98 -0
  262. package/claude-assets/cfn-extras/skills/google-sheets-decomposition/SKILL.md +269 -0
  263. package/claude-assets/cfn-extras/skills/google-sheets-decomposition/decompose.sh +313 -0
  264. package/claude-assets/cfn-extras/skills/google-sheets-formula-builder/SKILL.md +237 -0
  265. package/claude-assets/cfn-extras/skills/google-sheets-formula-builder/build-formula.sh +220 -0
  266. package/claude-assets/cfn-extras/skills/google-sheets-formula-builder/test.sh +172 -0
  267. package/claude-assets/cfn-extras/skills/google-sheets-formula-builder/validate.sh +98 -0
  268. package/claude-assets/cfn-extras/skills/google-sheets-progress/SKILL.md +287 -0
  269. package/claude-assets/cfn-extras/skills/google-sheets-progress/test.sh +385 -0
  270. package/claude-assets/cfn-extras/skills/google-sheets-progress/track-progress.sh +516 -0
  271. package/claude-assets/cfn-extras/skills/google-sheets-progress/validate.sh +119 -0
  272. package/claude-assets/cfn-extras/skills/google-sheets-sprint-order/SKILL.md +277 -0
  273. package/claude-assets/cfn-extras/skills/google-sheets-sprint-order/order-sprints.sh +233 -0
  274. package/claude-assets/cfn-extras/skills/google-sheets-validation/SKILL.md +352 -0
  275. package/claude-assets/cfn-extras/skills/google-sheets-validation/test.sh +355 -0
  276. package/claude-assets/cfn-extras/skills/google-sheets-validation/validate-state.sh +374 -0
  277. package/claude-assets/cfn-extras/skills/google-sheets-validation/validate.sh +128 -0
  278. package/claude-assets/commands/cfn-context.md +10 -0
  279. package/claude-assets/commands/cfn-loop-cli.md +36 -15
  280. package/claude-assets/commands/google-sheets/google-sheets-loop.md +289 -0
  281. package/claude-assets/hooks/cfn-pre-execution/SESSION_START_README.md +87 -0
  282. package/claude-assets/hooks/cfn-pre-execution/TEST_SESSION_START.md +128 -0
  283. package/claude-assets/hooks/cfn-pre-execution/session-start-context.sh +111 -0
  284. package/claude-assets/skills/cfn-agent-selection-with-fallback/INTEGRATION_EXAMPLE.md +209 -0
  285. package/claude-assets/skills/cfn-agent-selection-with-fallback/README.md +130 -0
  286. package/claude-assets/skills/cfn-agent-selection-with-fallback/SKILL.md +243 -0
  287. package/claude-assets/skills/cfn-agent-selection-with-fallback/agent-mappings.json +142 -0
  288. package/claude-assets/skills/cfn-agent-selection-with-fallback/select-agents.sh +173 -0
  289. package/claude-assets/skills/cfn-agent-selection-with-fallback/task-classifier.sh +71 -0
  290. package/claude-assets/skills/cfn-agent-selection-with-fallback/test-agent-selection.sh +282 -0
  291. package/claude-assets/skills/cfn-agent-selector/SKILL.md +143 -0
  292. package/claude-assets/skills/cfn-agent-selector/select-agents.sh +94 -0
  293. package/claude-assets/skills/cfn-agent-spawning/get-agent-provider-env.sh +22 -2
  294. package/claude-assets/skills/cfn-docker-agent-spawning/spawn-agent.sh +21 -2
  295. package/claude-assets/skills/cfn-docker-coordination/.eslintrc.json +33 -0
  296. package/claude-assets/skills/cfn-docker-coordination/README.md +349 -0
  297. package/claude-assets/skills/cfn-docker-coordination/docker-helpers.sh +433 -0
  298. package/claude-assets/skills/cfn-docker-coordination/jest.config.js +25 -0
  299. package/claude-assets/skills/cfn-docker-coordination/package-lock.json +6827 -0
  300. package/claude-assets/skills/cfn-docker-coordination/package.json +38 -0
  301. package/claude-assets/skills/cfn-docker-coordination/src/agent-container.ts +471 -0
  302. package/claude-assets/skills/cfn-docker-coordination/src/docker-client.ts +483 -0
  303. package/claude-assets/skills/cfn-docker-coordination/src/health-checker.ts +418 -0
  304. package/claude-assets/skills/cfn-docker-coordination/src/index.ts +45 -0
  305. package/claude-assets/skills/cfn-docker-coordination/src/network-manager.ts +377 -0
  306. package/claude-assets/skills/cfn-docker-coordination/src/types.ts +412 -0
  307. package/claude-assets/skills/cfn-docker-coordination/src/volume-manager.ts +389 -0
  308. package/claude-assets/skills/cfn-docker-coordination/tests/agent-container.test.ts +379 -0
  309. package/claude-assets/skills/cfn-docker-coordination/tests/docker-client.test.ts +345 -0
  310. package/claude-assets/skills/cfn-docker-coordination/tests/health-checker.test.ts +535 -0
  311. package/claude-assets/skills/cfn-docker-coordination/tests/integration.test.ts +193 -0
  312. package/claude-assets/skills/cfn-docker-coordination/tests/network-manager.test.ts +352 -0
  313. package/claude-assets/skills/cfn-docker-coordination/tests/setup.ts +36 -0
  314. package/claude-assets/skills/cfn-docker-coordination/tsconfig.json +29 -0
  315. package/claude-assets/skills/cfn-docker-logging/INTEGRATION.md +268 -0
  316. package/claude-assets/skills/cfn-docker-logging/SAMPLE_OUTPUTS.md +237 -0
  317. package/claude-assets/skills/cfn-docker-logging/SKILL.md +442 -0
  318. package/claude-assets/skills/cfn-docker-logging/capture-container-logs.sh +120 -0
  319. package/claude-assets/skills/cfn-docker-logging/enable-logging.sh +430 -0
  320. package/claude-assets/skills/cfn-docker-logging/init-hybrid-logging.sh +210 -0
  321. package/claude-assets/skills/cfn-docker-logging/queries/analytics-summary.sh +87 -0
  322. package/claude-assets/skills/cfn-docker-logging/queries/query-agent-timeline.sh +51 -0
  323. package/claude-assets/skills/cfn-docker-logging/queries/query-consensus-history.sh +56 -0
  324. package/claude-assets/skills/cfn-docker-logging/queries/query-coordination-timeline.sh +39 -0
  325. package/claude-assets/skills/cfn-docker-logging/queries/query-failed-containers.sh +40 -0
  326. package/claude-assets/skills/cfn-docker-logging/queries/query-gate-checks.sh +39 -0
  327. package/claude-assets/skills/cfn-docker-logging/schema.sql +111 -0
  328. package/claude-assets/skills/cfn-docker-logging/sqlite-helpers.sh +240 -0
  329. package/claude-assets/skills/cfn-docker-logging/test-hybrid-logging.sh +331 -0
  330. package/claude-assets/skills/cfn-docker-loop-orchestration/orchestrate.sh +11 -5
  331. package/claude-assets/skills/cfn-docker-redis-coordination/MIGRATION_SUMMARY.md +348 -0
  332. package/claude-assets/skills/cfn-docker-redis-coordination/README.md +294 -0
  333. package/claude-assets/skills/cfn-docker-redis-coordination/jest.config.js +37 -0
  334. package/claude-assets/skills/cfn-docker-redis-coordination/package-lock.json +5259 -0
  335. package/claude-assets/skills/cfn-docker-redis-coordination/package.json +40 -0
  336. package/claude-assets/skills/cfn-docker-redis-coordination/src/coordinator.ts +801 -0
  337. package/claude-assets/skills/cfn-docker-redis-coordination/src/index.ts +42 -0
  338. package/claude-assets/skills/cfn-docker-redis-coordination/src/types.ts +351 -0
  339. package/claude-assets/skills/cfn-docker-redis-coordination/tests/coordinator.test.ts +1464 -0
  340. package/claude-assets/skills/cfn-docker-redis-coordination/tsconfig.json +30 -0
  341. package/claude-assets/skills/cfn-error-logging/.eslintrc.json +57 -0
  342. package/claude-assets/skills/cfn-error-logging/.prettierrc.json +10 -0
  343. package/claude-assets/skills/cfn-error-logging/MIGRATION_SUMMARY.md +485 -0
  344. package/claude-assets/skills/cfn-error-logging/package.json +47 -0
  345. package/claude-assets/skills/cfn-error-logging/src/error-logger.ts +1042 -0
  346. package/claude-assets/skills/cfn-error-logging/src/index.ts +12 -0
  347. package/claude-assets/skills/cfn-error-logging/src/types.ts +456 -0
  348. package/claude-assets/skills/cfn-error-logging/tests/error-logger.test.ts +1302 -0
  349. package/claude-assets/skills/cfn-error-logging/tsconfig.json +38 -0
  350. package/claude-assets/skills/cfn-loop-orchestration/.eslintrc.js +56 -0
  351. package/claude-assets/skills/cfn-loop-orchestration/.prettierrc.json +18 -0
  352. package/claude-assets/skills/cfn-loop-orchestration/README.md +149 -41
  353. package/claude-assets/skills/cfn-loop-orchestration/helpers/gate-check.sh +39 -577
  354. package/claude-assets/skills/cfn-loop-orchestration/helpers/parse-test-results.sh +49 -270
  355. package/claude-assets/skills/cfn-loop-orchestration/jest.config.js +67 -0
  356. package/claude-assets/skills/cfn-loop-orchestration/orchestrate-wrapper.sh +268 -0
  357. package/claude-assets/skills/cfn-loop-orchestration/orchestrate.sh +91 -8
  358. package/claude-assets/skills/cfn-loop-orchestration/package-lock.json +5470 -0
  359. package/claude-assets/skills/cfn-loop-orchestration/package.json +49 -0
  360. package/claude-assets/skills/cfn-loop-orchestration/src/agent-spawner/agent-spawner.ts +34 -0
  361. package/claude-assets/skills/cfn-loop-orchestration/src/gate-checker/gate-checker.ts +36 -0
  362. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/gate-check.ts +115 -0
  363. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/parse-test-results.ts +372 -0
  364. package/claude-assets/skills/cfn-loop-orchestration/src/index.ts +14 -0
  365. package/claude-assets/skills/cfn-loop-orchestration/src/orchestrator/orchestrator.ts +31 -0
  366. package/claude-assets/skills/cfn-loop-orchestration/src/redis/redis-coordinator.ts +72 -0
  367. package/claude-assets/skills/cfn-loop-orchestration/src/types.ts +188 -0
  368. package/claude-assets/skills/cfn-loop-orchestration/src/utils/logger.ts +32 -0
  369. package/claude-assets/skills/cfn-loop-orchestration/tests/consensus.test.ts +142 -0
  370. package/claude-assets/skills/cfn-loop-orchestration/tests/deliverable-verifier.test.ts +199 -0
  371. package/claude-assets/skills/cfn-loop-orchestration/tests/gate-check.test.ts +325 -0
  372. package/claude-assets/skills/cfn-loop-orchestration/tests/iteration-manager.test.ts +132 -0
  373. package/claude-assets/skills/cfn-loop-orchestration/tests/parse-test-results.test.ts +382 -0
  374. package/claude-assets/skills/cfn-loop-orchestration/tests/setup.ts +22 -0
  375. package/claude-assets/skills/cfn-loop-orchestration/tests/timeout-calculator.test.ts +118 -0
  376. package/claude-assets/skills/cfn-loop-orchestration/tests/types.test.ts +132 -0
  377. package/claude-assets/skills/cfn-loop-orchestration/tsconfig.json +54 -0
  378. package/claude-assets/skills/cfn-redis-coordination/bash-wrappers/store-context.sh +23 -0
  379. package/claude-assets/skills/cfn-redis-coordination/coverage/clover.xml +1447 -0
  380. package/claude-assets/skills/cfn-redis-coordination/coverage/coverage-final.json +13 -0
  381. package/claude-assets/skills/cfn-redis-coordination/coverage/lcov-report/agent-logger.ts.html +1423 -0
  382. package/claude-assets/skills/cfn-redis-coordination/coverage/lcov-report/agent-recovery.ts.html +1447 -0
  383. package/claude-assets/skills/cfn-redis-coordination/coverage/lcov-report/base.css +224 -0
  384. package/claude-assets/skills/cfn-redis-coordination/coverage/lcov-report/block-navigation.js +87 -0
  385. package/claude-assets/skills/cfn-redis-coordination/coverage/lcov-report/completion-reporter.ts.html +1273 -0
  386. package/claude-assets/skills/cfn-redis-coordination/coverage/lcov-report/context-manager.ts.html +1066 -0
  387. package/claude-assets/skills/cfn-redis-coordination/coverage/lcov-report/favicon.png +0 -0
  388. package/claude-assets/skills/cfn-redis-coordination/coverage/lcov-report/index.html +281 -0
  389. package/claude-assets/skills/cfn-redis-coordination/coverage/lcov-report/mode-detector.ts.html +550 -0
  390. package/claude-assets/skills/cfn-redis-coordination/coverage/lcov-report/prettify.css +1 -0
  391. package/claude-assets/skills/cfn-redis-coordination/coverage/lcov-report/prettify.js +2 -0
  392. package/claude-assets/skills/cfn-redis-coordination/coverage/lcov-report/redis-client.ts.html +2047 -0
  393. package/claude-assets/skills/cfn-redis-coordination/coverage/lcov-report/result-collector.ts.html +1396 -0
  394. package/claude-assets/skills/cfn-redis-coordination/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  395. package/claude-assets/skills/cfn-redis-coordination/coverage/lcov-report/sorter.js +210 -0
  396. package/claude-assets/skills/cfn-redis-coordination/coverage/lcov-report/swarm-manager.ts.html +1567 -0
  397. package/claude-assets/skills/cfn-redis-coordination/coverage/lcov-report/task-analyzer.ts.html +1297 -0
  398. package/claude-assets/skills/cfn-redis-coordination/coverage/lcov-report/task-executor.ts.html +1354 -0
  399. package/claude-assets/skills/cfn-redis-coordination/coverage/lcov-report/types.ts.html +790 -0
  400. package/claude-assets/skills/cfn-redis-coordination/coverage/lcov-report/waiting-coordinator.ts.html +1846 -0
  401. package/claude-assets/skills/cfn-redis-coordination/coverage/lcov.info +2650 -0
  402. package/claude-assets/skills/cfn-redis-coordination/dist/agent-logger.d.ts +92 -0
  403. package/claude-assets/skills/cfn-redis-coordination/dist/agent-logger.d.ts.map +1 -0
  404. package/claude-assets/skills/cfn-redis-coordination/dist/agent-logger.js +329 -0
  405. package/claude-assets/skills/cfn-redis-coordination/dist/agent-logger.js.map +1 -0
  406. package/claude-assets/skills/cfn-redis-coordination/dist/agent-recovery.d.ts +75 -0
  407. package/claude-assets/skills/cfn-redis-coordination/dist/agent-recovery.d.ts.map +1 -0
  408. package/claude-assets/skills/cfn-redis-coordination/dist/agent-recovery.js +302 -0
  409. package/claude-assets/skills/cfn-redis-coordination/dist/agent-recovery.js.map +1 -0
  410. package/claude-assets/skills/cfn-redis-coordination/dist/completion-reporter.d.ts +58 -0
  411. package/claude-assets/skills/cfn-redis-coordination/dist/completion-reporter.d.ts.map +1 -0
  412. package/claude-assets/skills/cfn-redis-coordination/dist/completion-reporter.js +237 -0
  413. package/claude-assets/skills/cfn-redis-coordination/dist/completion-reporter.js.map +1 -0
  414. package/claude-assets/skills/cfn-redis-coordination/dist/context-manager.d.ts +63 -0
  415. package/claude-assets/skills/cfn-redis-coordination/dist/context-manager.d.ts.map +1 -0
  416. package/claude-assets/skills/cfn-redis-coordination/dist/context-manager.js +230 -0
  417. package/claude-assets/skills/cfn-redis-coordination/dist/context-manager.js.map +1 -0
  418. package/claude-assets/skills/cfn-redis-coordination/dist/index.d.ts +45 -0
  419. package/claude-assets/skills/cfn-redis-coordination/dist/index.d.ts.map +1 -0
  420. package/claude-assets/skills/cfn-redis-coordination/dist/index.js +114 -0
  421. package/claude-assets/skills/cfn-redis-coordination/dist/index.js.map +1 -0
  422. package/claude-assets/skills/cfn-redis-coordination/dist/mode-detector.d.ts +31 -0
  423. package/claude-assets/skills/cfn-redis-coordination/dist/mode-detector.d.ts.map +1 -0
  424. package/claude-assets/skills/cfn-redis-coordination/dist/mode-detector.js +185 -0
  425. package/claude-assets/skills/cfn-redis-coordination/dist/mode-detector.js.map +1 -0
  426. package/claude-assets/skills/cfn-redis-coordination/dist/redis-client.d.ts +191 -0
  427. package/claude-assets/skills/cfn-redis-coordination/dist/redis-client.d.ts.map +1 -0
  428. package/claude-assets/skills/cfn-redis-coordination/dist/redis-client.js +509 -0
  429. package/claude-assets/skills/cfn-redis-coordination/dist/redis-client.js.map +1 -0
  430. package/claude-assets/skills/cfn-redis-coordination/dist/result-collector.d.ts +75 -0
  431. package/claude-assets/skills/cfn-redis-coordination/dist/result-collector.d.ts.map +1 -0
  432. package/claude-assets/skills/cfn-redis-coordination/dist/result-collector.js +281 -0
  433. package/claude-assets/skills/cfn-redis-coordination/dist/result-collector.js.map +1 -0
  434. package/claude-assets/skills/cfn-redis-coordination/dist/swarm-manager.d.ts +75 -0
  435. package/claude-assets/skills/cfn-redis-coordination/dist/swarm-manager.d.ts.map +1 -0
  436. package/claude-assets/skills/cfn-redis-coordination/dist/swarm-manager.js +354 -0
  437. package/claude-assets/skills/cfn-redis-coordination/dist/swarm-manager.js.map +1 -0
  438. package/claude-assets/skills/cfn-redis-coordination/dist/task-analyzer.d.ts +62 -0
  439. package/claude-assets/skills/cfn-redis-coordination/dist/task-analyzer.d.ts.map +1 -0
  440. package/claude-assets/skills/cfn-redis-coordination/dist/task-analyzer.js +305 -0
  441. package/claude-assets/skills/cfn-redis-coordination/dist/task-analyzer.js.map +1 -0
  442. package/claude-assets/skills/cfn-redis-coordination/dist/task-executor.d.ts +97 -0
  443. package/claude-assets/skills/cfn-redis-coordination/dist/task-executor.d.ts.map +1 -0
  444. package/claude-assets/skills/cfn-redis-coordination/dist/task-executor.js +283 -0
  445. package/claude-assets/skills/cfn-redis-coordination/dist/task-executor.js.map +1 -0
  446. package/claude-assets/skills/cfn-redis-coordination/dist/types.d.ts +176 -0
  447. package/claude-assets/skills/cfn-redis-coordination/dist/types.d.ts.map +1 -0
  448. package/claude-assets/skills/cfn-redis-coordination/dist/types.js +81 -0
  449. package/claude-assets/skills/cfn-redis-coordination/dist/types.js.map +1 -0
  450. package/claude-assets/skills/cfn-redis-coordination/dist/waiting-coordinator.d.ts +86 -0
  451. package/claude-assets/skills/cfn-redis-coordination/dist/waiting-coordinator.d.ts.map +1 -0
  452. package/claude-assets/skills/cfn-redis-coordination/dist/waiting-coordinator.js +419 -0
  453. package/claude-assets/skills/cfn-redis-coordination/dist/waiting-coordinator.js.map +1 -0
  454. package/claude-assets/skills/cfn-redis-coordination/docs/migration/PHASE_3_REDIS_COORDINATION_COMPLETION_REPORT.md +553 -0
  455. package/claude-assets/skills/cfn-redis-coordination/jest.config.js +23 -0
  456. package/claude-assets/skills/cfn-redis-coordination/package-lock.json +5272 -0
  457. package/claude-assets/skills/cfn-redis-coordination/package.json +45 -0
  458. package/claude-assets/skills/cfn-redis-coordination/redis-cli-wrapper.sh +21 -8
  459. package/claude-assets/skills/cfn-redis-coordination/src/agent-logger.ts +446 -0
  460. package/claude-assets/skills/cfn-redis-coordination/src/agent-recovery.ts +454 -0
  461. package/claude-assets/skills/cfn-redis-coordination/src/completion-reporter.ts +396 -0
  462. package/claude-assets/skills/cfn-redis-coordination/src/context-manager.ts +327 -0
  463. package/claude-assets/skills/cfn-redis-coordination/src/index.ts +82 -0
  464. package/claude-assets/skills/cfn-redis-coordination/src/mode-detector.ts +155 -0
  465. package/claude-assets/skills/cfn-redis-coordination/src/redis/redis-client.ts +305 -0
  466. package/claude-assets/skills/cfn-redis-coordination/src/redis/redis-functions.ts +283 -0
  467. package/claude-assets/skills/cfn-redis-coordination/src/redis-client.ts +654 -0
  468. package/claude-assets/skills/cfn-redis-coordination/src/result-collector.ts +437 -0
  469. package/claude-assets/skills/cfn-redis-coordination/src/swarm-manager.ts +494 -0
  470. package/claude-assets/skills/cfn-redis-coordination/src/task-analyzer.ts +404 -0
  471. package/claude-assets/skills/cfn-redis-coordination/src/task-executor.ts +423 -0
  472. package/claude-assets/skills/cfn-redis-coordination/src/types.ts +235 -0
  473. package/claude-assets/skills/cfn-redis-coordination/src/waiting-coordinator.ts +587 -0
  474. package/claude-assets/skills/cfn-redis-coordination/test-connection-attempts.js +70 -0
  475. package/claude-assets/skills/cfn-redis-coordination/test-mode-simple.js +121 -0
  476. package/claude-assets/skills/cfn-redis-coordination/test-redis-check.js +84 -0
  477. package/claude-assets/skills/cfn-redis-coordination/test-task-mode-redis.cjs +391 -0
  478. package/claude-assets/skills/cfn-redis-coordination/tests/coordination.test.ts +788 -0
  479. package/claude-assets/skills/cfn-redis-coordination/tsconfig.json +31 -0
  480. package/claude-assets/skills/cfn-skill-propagation/README.md +233 -0
  481. package/claude-assets/skills/cfn-skill-propagation/package-lock.json +5174 -0
  482. package/claude-assets/skills/cfn-skill-propagation/package.json +52 -0
  483. package/claude-assets/skills/cfn-skill-propagation/propagate-skill-update.sh +32 -0
  484. package/claude-assets/skills/cfn-skill-propagation/src/cli.ts +75 -0
  485. package/claude-assets/skills/cfn-skill-propagation/src/database-adapter.ts +239 -0
  486. package/claude-assets/skills/cfn-skill-propagation/src/file-system-adapter.ts +113 -0
  487. package/claude-assets/skills/cfn-skill-propagation/src/index.ts +72 -0
  488. package/claude-assets/skills/cfn-skill-propagation/src/logger.ts +43 -0
  489. package/claude-assets/skills/cfn-skill-propagation/src/metadata-parser.ts +154 -0
  490. package/claude-assets/skills/cfn-skill-propagation/src/skill-propagator.ts +274 -0
  491. package/claude-assets/skills/cfn-skill-propagation/src/skill-validator.ts +179 -0
  492. package/claude-assets/skills/cfn-skill-propagation/src/types.ts +143 -0
  493. package/claude-assets/skills/cfn-skill-propagation/src/version-manager.ts +118 -0
  494. package/claude-assets/skills/cfn-skill-propagation/tests/file-system-adapter.test.ts +91 -0
  495. package/claude-assets/skills/cfn-skill-propagation/tests/metadata-parser.test.ts +176 -0
  496. package/claude-assets/skills/cfn-skill-propagation/tests/skill-propagator.test.ts +209 -0
  497. package/claude-assets/skills/cfn-skill-propagation/tests/skill-validator.test.ts +203 -0
  498. package/claude-assets/skills/cfn-skill-propagation/tests/version-manager.test.ts +115 -0
  499. package/claude-assets/skills/cfn-skill-propagation/tsconfig.json +34 -0
  500. package/claude-assets/skills/task-classifier/SKILL.md +81 -0
  501. package/claude-assets/skills/task-classifier/classify-task.sh +62 -0
  502. package/claude-assets/skills/workflow-codification/package-lock.json +5170 -0
  503. package/claude-assets/skills/workflow-codification/package.json +30 -0
  504. package/claude-assets/skills/workflow-codification/src/index.ts +24 -0
  505. package/claude-assets/skills/workflow-codification/src/pattern-analyzer.ts +537 -0
  506. package/claude-assets/skills/workflow-codification/src/types.ts +180 -0
  507. package/claude-assets/skills/workflow-codification/tests/pattern-analyzer.test.ts +960 -0
  508. package/claude-assets/skills/workflow-codification/tsconfig.json +34 -0
  509. package/claude-assets/skills/workflow-codification/workflow-codification.db +0 -0
  510. package/dist/agent-spawner/agent-spawner.js +448 -0
  511. package/dist/agent-spawner/agent-spawner.js.map +1 -0
  512. package/dist/agent-spawner/index.js +10 -0
  513. package/dist/agent-spawner/index.js.map +1 -0
  514. package/dist/agent-spawner/types.js +14 -0
  515. package/dist/agent-spawner/types.js.map +1 -0
  516. package/dist/cli/agent-executor.js +47 -1
  517. package/dist/cli/agent-executor.js.map +1 -1
  518. package/dist/cli/agent-spawn.js +4 -1
  519. package/dist/cli/agent-spawn.js.map +1 -1
  520. package/dist/cli/config-manager.js +91 -109
  521. package/dist/cli/config-manager.js.map +1 -1
  522. package/dist/cli/tool-executor.js +3 -1
  523. package/dist/cli/tool-executor.js.map +1 -1
  524. package/dist/gate-checker/gate-checker.js +292 -0
  525. package/dist/gate-checker/gate-checker.js.map +1 -0
  526. package/dist/gate-checker/types.js +94 -0
  527. package/dist/gate-checker/types.js.map +1 -0
  528. package/dist/lib/database-service/connection-pool-manager.js +2 -1
  529. package/dist/lib/database-service/connection-pool-manager.js.map +1 -1
  530. package/dist/orchestrator/index.js +10 -0
  531. package/dist/orchestrator/index.js.map +1 -0
  532. package/dist/orchestrator/orchestrate.js +496 -0
  533. package/dist/orchestrator/orchestrate.js.map +1 -0
  534. package/dist/orchestrator/types.js +58 -0
  535. package/dist/orchestrator/types.js.map +1 -0
  536. package/package.json +1 -1
  537. package/scripts/clean-agent-profiles.sh +112 -0
  538. package/scripts/switch-api.sh +142 -4
  539. package/scripts/verify-no-secrets.sh +6 -13
  540. package/tests/README.md +175 -58
@@ -0,0 +1,496 @@
1
+ /**
2
+ * CFN Loop Orchestrator - TypeScript Implementation
3
+ *
4
+ * Orchestrates the complete CFN (Complete Fail Never) Loop workflow:
5
+ * 1. Loop 3: Spawn implementation agents
6
+ * 2. Gate Check: Validate test pass rates against threshold
7
+ * 3. Loop 2: Spawn validator agents if gate passes
8
+ * 4. Consensus Check: Validate consensus among validators
9
+ * 5. Product Owner Decision: PROCEED/ITERATE/ABORT
10
+ *
11
+ * Features:
12
+ * - Type-safe state management
13
+ * - Redis coordination for agent communication
14
+ * - Iteration management with max bounds
15
+ * - Comprehensive error handling
16
+ * - Full audit trail via state tracking
17
+ *
18
+ * @module orchestrator
19
+ */ import { OrchestratorError, ModeThresholds, isValidOrchestratorConfig } from './types';
20
+ /**
21
+ * CFN Loop Orchestrator
22
+ *
23
+ * Manages the complete orchestration workflow with proper type safety,
24
+ * error handling, and state management.
25
+ */ export class CFNOrchestrator {
26
+ state;
27
+ config;
28
+ logger;
29
+ redisClient;
30
+ gateChecker;
31
+ agentSpawner;
32
+ productOwnerDecider;
33
+ deliverableVerifier;
34
+ // Security constraints
35
+ securityLimits = {
36
+ maxIterations: 100,
37
+ maxAgentsPerWave: 50,
38
+ taskIdMaxLength: 256,
39
+ timeoutMin: 1,
40
+ timeoutMax: 3600
41
+ };
42
+ // Mode-specific settings
43
+ gateThreshold;
44
+ consensusThreshold;
45
+ timeout;
46
+ minQuorumLoop3;
47
+ minQuorumLoop2;
48
+ constructor(config, logger, redisClient, gateChecker, agentSpawner, productOwnerDecider, deliverableVerifier){
49
+ // Validate configuration
50
+ if (!isValidOrchestratorConfig(config)) {
51
+ throw new OrchestratorError('Invalid orchestrator configuration', 'CONFIG_INVALID');
52
+ }
53
+ // Validate max iterations
54
+ if (config.maxIterations > this.securityLimits.maxIterations) {
55
+ throw new OrchestratorError(`Max iterations ${config.maxIterations} exceeds limit ${this.securityLimits.maxIterations}`, 'CONFIG_INVALID');
56
+ }
57
+ this.config = config;
58
+ this.logger = logger;
59
+ this.redisClient = redisClient;
60
+ this.gateChecker = gateChecker;
61
+ this.agentSpawner = agentSpawner;
62
+ this.productOwnerDecider = productOwnerDecider;
63
+ this.deliverableVerifier = deliverableVerifier;
64
+ // Get thresholds for mode
65
+ const thresholds = ModeThresholds[config.mode];
66
+ this.gateThreshold = config.gateThreshold ?? thresholds.gate;
67
+ this.consensusThreshold = config.consensusThreshold ?? thresholds.consensus;
68
+ this.timeout = config.timeout ?? 300; // 5 minutes default
69
+ this.minQuorumLoop3 = config.minQuorumLoop3 ?? 0.66;
70
+ this.minQuorumLoop2 = config.minQuorumLoop2 ?? 0.66;
71
+ // Initialize orchestration state
72
+ this.state = {
73
+ taskId: config.taskId,
74
+ config,
75
+ iterations: [],
76
+ currentIteration: 0,
77
+ deliverableVerified: false,
78
+ aborted: false
79
+ };
80
+ this.logger.info(`CFN Orchestrator initialized for task ${config.taskId}`, {
81
+ mode: config.mode,
82
+ gateThreshold: this.gateThreshold,
83
+ consensusThreshold: this.consensusThreshold,
84
+ maxIterations: config.maxIterations
85
+ });
86
+ }
87
+ /**
88
+ * Execute the complete CFN Loop orchestration
89
+ *
90
+ * @returns Orchestration result with final status and metrics
91
+ * @throws OrchestratorError on fatal errors
92
+ */ async execute() {
93
+ const startTime = Date.now();
94
+ try {
95
+ // Store context in Redis
96
+ await this.storeContext();
97
+ // Main iteration loop
98
+ for(let iteration = 1; iteration <= this.config.maxIterations; iteration++){
99
+ this.state.currentIteration = iteration;
100
+ const iterationStart = Date.now();
101
+ this.logger.info(`Starting iteration ${iteration}/${this.config.maxIterations}`);
102
+ try {
103
+ // Create iteration state
104
+ const iterationState = {
105
+ iteration,
106
+ loop3Spawned: [],
107
+ loop3Completed: [],
108
+ deliverableVerified: false,
109
+ gatePassed: false,
110
+ loop2Spawned: [],
111
+ loop2Completed: [],
112
+ consensusReached: false,
113
+ startTime: iterationStart,
114
+ errors: []
115
+ };
116
+ // Step 1: Spawn Loop 3 agents
117
+ iterationState.loop3Spawned = await this.spawnLoop3Agents(iteration);
118
+ // Step 2: Wait for Loop 3 completion and collect results
119
+ iterationState.loop3Completed = await this.waitForLoop3Completion(iteration);
120
+ // Step 3: Verify deliverables
121
+ if (this.config.expectedFiles || this.config.epicContext) {
122
+ const verified = await this.verifyDeliverables();
123
+ iterationState.deliverableVerified = verified;
124
+ if (!verified) {
125
+ this.logger.warn('Deliverable verification failed, requesting iteration');
126
+ iterationState.endTime = Date.now();
127
+ this.state.iterations.push(iterationState);
128
+ // Store feedback for next iteration
129
+ await this.storeIterationFeedback(iteration);
130
+ continue;
131
+ }
132
+ this.state.deliverableVerified = true;
133
+ }
134
+ // Step 4: Gate check (Loop 3 self-validation)
135
+ const gateResult = await this.performGateCheck(iteration);
136
+ iterationState.gateCheckResult = gateResult;
137
+ iterationState.gatePassed = gateResult.passed;
138
+ if (!gateResult.passed) {
139
+ this.logger.warn(`Gate check failed at iteration ${iteration}`, {
140
+ passRate: gateResult.pass_rate,
141
+ threshold: gateResult.threshold,
142
+ gap: gateResult.gap
143
+ });
144
+ iterationState.endTime = Date.now();
145
+ this.state.iterations.push(iterationState);
146
+ // Store feedback for next iteration
147
+ await this.storeIterationFeedback(iteration);
148
+ continue;
149
+ }
150
+ this.state.finalLoop3Confidence = gateResult.pass_rate;
151
+ // Step 5: Spawn Loop 2 agents
152
+ iterationState.loop2Spawned = await this.spawnLoop2Agents(iteration);
153
+ // Step 6: Wait for Loop 2 completion and collect results
154
+ iterationState.loop2Completed = await this.waitForLoop2Completion(iteration);
155
+ // Step 7: Consensus check (Loop 2 validation)
156
+ const consensusResult = await this.performConsensusCheck(iteration);
157
+ iterationState.consensusReached = consensusResult.passed;
158
+ iterationState.consensusScore = consensusResult.consensus;
159
+ if (!consensusResult.passed) {
160
+ this.logger.warn(`Consensus check failed at iteration ${iteration}`, {
161
+ consensus: consensusResult.consensus,
162
+ threshold: consensusResult.threshold,
163
+ gap: consensusResult.gap
164
+ });
165
+ iterationState.endTime = Date.now();
166
+ this.state.iterations.push(iterationState);
167
+ // Store feedback for next iteration
168
+ await this.storeIterationFeedback(iteration);
169
+ continue;
170
+ }
171
+ this.state.finalLoop2Consensus = consensusResult.consensus;
172
+ // Step 8: Get Product Owner decision
173
+ const decision = await this.getProductOwnerDecision(iteration);
174
+ iterationState.productOwnerDecision = decision.decision;
175
+ iterationState.finalDecision = decision.decision;
176
+ iterationState.endTime = Date.now();
177
+ this.logger.info(`Product Owner decision: ${decision.decision}`, {
178
+ rationale: decision.rationale,
179
+ confidence: decision.confidence
180
+ });
181
+ // Step 9: Execute decision
182
+ this.state.iterations.push(iterationState);
183
+ const result = await this.executeDecision(decision, iteration, startTime);
184
+ return result;
185
+ } catch (error) {
186
+ const iterationState = this.state.iterations[iteration - 1] || {
187
+ iteration,
188
+ loop3Spawned: [],
189
+ loop3Completed: [],
190
+ deliverableVerified: false,
191
+ gatePassed: false,
192
+ loop2Spawned: [],
193
+ loop2Completed: [],
194
+ consensusReached: false,
195
+ startTime: iterationStart,
196
+ errors: []
197
+ };
198
+ const errorMessage = error instanceof Error ? error.message : String(error);
199
+ // Check if this is an iteration request (not a real error)
200
+ if (errorMessage === 'ITERATE - continue to next iteration') {
201
+ continue;
202
+ }
203
+ iterationState.errors.push(errorMessage);
204
+ if (!iterationState.endTime) {
205
+ iterationState.endTime = Date.now();
206
+ }
207
+ this.state.iterations.push(iterationState);
208
+ if (error instanceof OrchestratorError && error.code === 'ITERATION_LIMIT') {
209
+ return this.createFailureResult(startTime, `Max iterations reached at iteration ${iteration}`);
210
+ }
211
+ this.logger.error(`Error during iteration ${iteration}`, error);
212
+ return this.createFailureResult(startTime, errorMessage);
213
+ }
214
+ }
215
+ // Max iterations reached without decision
216
+ return this.createFailureResult(startTime, 'Max iterations reached without PROCEED decision');
217
+ } catch (error) {
218
+ this.state.aborted = true;
219
+ this.state.abortReason = error instanceof Error ? error.message : String(error);
220
+ this.logger.error('Orchestration aborted', error);
221
+ return this.createAbortedResult(startTime);
222
+ }
223
+ }
224
+ /**
225
+ * Get orchestration state for inspection
226
+ */ getState() {
227
+ return Object.freeze({
228
+ ...this.state
229
+ });
230
+ }
231
+ /**
232
+ * Private helper methods
233
+ */ async storeContext() {
234
+ try {
235
+ if (this.config.epicContext) {
236
+ await this.redisClient.set(`swarm:${this.config.taskId}:epic-context`, JSON.stringify(this.config.epicContext), 86400);
237
+ }
238
+ if (this.config.phaseContext) {
239
+ await this.redisClient.set(`swarm:${this.config.taskId}:phase-context`, JSON.stringify(this.config.phaseContext), 86400);
240
+ }
241
+ if (this.config.successCriteria) {
242
+ await this.redisClient.set(`swarm:${this.config.taskId}:success-criteria`, JSON.stringify(this.config.successCriteria), 86400);
243
+ }
244
+ this.logger.info('Context stored in Redis');
245
+ } catch (error) {
246
+ this.logger.warn('Failed to store context in Redis', error);
247
+ }
248
+ }
249
+ async spawnLoop3Agents(iteration) {
250
+ this.logger.info(`Spawning Loop 3 agents for iteration ${iteration}`);
251
+ try {
252
+ const context = this.buildAgentContext(iteration, 'loop3');
253
+ const results = await this.agentSpawner.spawn(this.config.taskId, iteration, this.config.loop3Agents, 'loop3', context);
254
+ this.logger.info(`Spawned ${results.length} Loop 3 agents`);
255
+ return results;
256
+ } catch (error) {
257
+ throw new OrchestratorError(`Failed to spawn Loop 3 agents: ${error instanceof Error ? error.message : String(error)}`, 'SPAWN_FAILED');
258
+ }
259
+ }
260
+ async spawnLoop2Agents(iteration) {
261
+ this.logger.info(`Spawning Loop 2 agents for iteration ${iteration}`);
262
+ try {
263
+ const context = this.buildAgentContext(iteration, 'loop2');
264
+ const results = await this.agentSpawner.spawn(this.config.taskId, iteration, this.config.loop2Agents, 'loop2', context);
265
+ this.logger.info(`Spawned ${results.length} Loop 2 agents`);
266
+ return results;
267
+ } catch (error) {
268
+ throw new OrchestratorError(`Failed to spawn Loop 2 agents: ${error instanceof Error ? error.message : String(error)}`, 'SPAWN_FAILED');
269
+ }
270
+ }
271
+ async waitForLoop3Completion(iteration) {
272
+ this.logger.info(`Waiting for Loop 3 agents to complete`);
273
+ try {
274
+ // In real implementation, would wait for agents via Redis coordination
275
+ // For now, collect results from Redis
276
+ const results = [];
277
+ // TODO: Implement actual waiting logic with Redis blocking
278
+ return results;
279
+ } catch (error) {
280
+ throw new OrchestratorError(`Timeout waiting for Loop 3 agents: ${error instanceof Error ? error.message : String(error)}`, 'TIMEOUT');
281
+ }
282
+ }
283
+ async waitForLoop2Completion(iteration) {
284
+ this.logger.info(`Waiting for Loop 2 agents to complete`);
285
+ try {
286
+ // In real implementation, would wait for agents via Redis coordination
287
+ const results = [];
288
+ // TODO: Implement actual waiting logic with Redis blocking
289
+ return results;
290
+ } catch (error) {
291
+ throw new OrchestratorError(`Timeout waiting for Loop 2 agents: ${error instanceof Error ? error.message : String(error)}`, 'TIMEOUT');
292
+ }
293
+ }
294
+ async verifyDeliverables() {
295
+ if (!this.deliverableVerifier) {
296
+ this.logger.warn('Deliverable verifier not available, skipping verification');
297
+ return true;
298
+ }
299
+ try {
300
+ const result = await this.deliverableVerifier.verify({
301
+ expectedFiles: this.config.expectedFiles,
302
+ taskType: this.getTaskType(),
303
+ strict: this.config.mode === 'enterprise'
304
+ });
305
+ if (!result.verified) {
306
+ this.logger.warn('Deliverable verification failed', {
307
+ filesChecked: result.filesChecked,
308
+ filesFound: result.filesFound,
309
+ missingFiles: result.missingFiles
310
+ });
311
+ }
312
+ return result.verified;
313
+ } catch (error) {
314
+ this.logger.error('Deliverable verification error', error);
315
+ return false;
316
+ }
317
+ }
318
+ async performGateCheck(iteration) {
319
+ this.logger.info(`Performing gate check for iteration ${iteration}`);
320
+ try {
321
+ const result = await this.gateChecker.checkGate(this.config.taskId, this.config.loop3Agents, this.gateThreshold, this.minQuorumLoop3);
322
+ this.logger.info(`Gate check result: ${result.passed ? 'PASS' : 'FAIL'}`, {
323
+ passRate: result.pass_rate,
324
+ threshold: result.threshold
325
+ });
326
+ return result;
327
+ } catch (error) {
328
+ throw new OrchestratorError(`Gate check failed: ${error instanceof Error ? error.message : String(error)}`, 'GATE_FAILED');
329
+ }
330
+ }
331
+ async performConsensusCheck(iteration) {
332
+ this.logger.info(`Performing consensus check for iteration ${iteration}`);
333
+ try {
334
+ // In real implementation, would aggregate Loop 2 agent scores
335
+ const agentCount = this.config.loop2Agents.length;
336
+ // TODO: Get actual consensus score from Redis
337
+ const consensus = 0.95; // Placeholder
338
+ const passed = consensus >= this.consensusThreshold;
339
+ const result = {
340
+ consensus,
341
+ threshold: this.consensusThreshold,
342
+ passed,
343
+ agentCount,
344
+ completedAgentCount: agentCount
345
+ };
346
+ if (!passed) {
347
+ result.gap = this.consensusThreshold - consensus;
348
+ }
349
+ this.logger.info(`Consensus check result: ${passed ? 'PASS' : 'FAIL'}`, {
350
+ consensus,
351
+ threshold: this.consensusThreshold
352
+ });
353
+ return result;
354
+ } catch (error) {
355
+ throw new OrchestratorError(`Consensus check failed: ${error instanceof Error ? error.message : String(error)}`, 'CONSENSUS_FAILED');
356
+ }
357
+ }
358
+ async getProductOwnerDecision(iteration) {
359
+ this.logger.info(`Getting Product Owner decision for iteration ${iteration}`);
360
+ try {
361
+ const consensus = this.state.finalLoop2Consensus ?? 0;
362
+ const decision = await this.productOwnerDecider.makeDecision(this.config.taskId, iteration, consensus, this.consensusThreshold, this.config.maxIterations);
363
+ return decision;
364
+ } catch (error) {
365
+ throw new OrchestratorError(`Product Owner decision failed: ${error instanceof Error ? error.message : String(error)}`, 'DECISION_FAILED');
366
+ }
367
+ }
368
+ async requestIteration(iteration, iterationState) {
369
+ this.logger.info(`Requesting iteration ${iteration + 1}`);
370
+ if (iteration >= this.config.maxIterations) {
371
+ throw new OrchestratorError(`Iteration limit reached at iteration ${iteration}`, 'ITERATION_LIMIT');
372
+ }
373
+ iterationState.endTime = Date.now();
374
+ this.state.iterations.push(iterationState);
375
+ // Store iteration feedback in Redis for next iteration
376
+ await this.storeIterationFeedback(iteration);
377
+ }
378
+ async storeIterationFeedback(iteration) {
379
+ try {
380
+ const currentIteration = this.state.iterations[iteration - 1];
381
+ if (currentIteration) {
382
+ const feedback = {
383
+ iteration,
384
+ previousGateStatus: currentIteration.gatePassed ? 'passed' : 'failed',
385
+ previousPassRate: currentIteration.gateCheckResult?.pass_rate,
386
+ failedTests: currentIteration.gateCheckResult?.failed_suites,
387
+ consensusScore: currentIteration.consensusScore
388
+ };
389
+ await this.redisClient.set(`swarm:${this.config.taskId}:iteration-feedback`, JSON.stringify(feedback), 3600);
390
+ }
391
+ } catch (error) {
392
+ this.logger.warn('Failed to store iteration feedback', error);
393
+ }
394
+ }
395
+ async executeDecision(decision, iteration, startTime) {
396
+ switch(decision.decision){
397
+ case 'PROCEED':
398
+ this.logger.info('Product Owner decision: PROCEED');
399
+ this.state.finalDecision = 'PROCEED';
400
+ return this.createSuccessResult(startTime);
401
+ case 'ABORT':
402
+ this.logger.info('Product Owner decision: ABORT');
403
+ this.state.finalDecision = 'ABORT';
404
+ this.state.aborted = true;
405
+ return this.createAbortedResult(startTime);
406
+ case 'ITERATE':
407
+ this.logger.info('Product Owner decision: ITERATE');
408
+ if (iteration >= this.config.maxIterations) {
409
+ return this.createFailureResult(startTime, `Max iterations reached at iteration ${iteration}`);
410
+ }
411
+ // Signal to continue to next iteration
412
+ throw new Error('ITERATE - continue to next iteration');
413
+ default:
414
+ const _exhaustive = decision.decision;
415
+ return _exhaustive;
416
+ }
417
+ }
418
+ buildAgentContext(iteration, loopType) {
419
+ const context = [
420
+ `Task: ${this.config.taskId}`,
421
+ `Iteration: ${iteration}/${this.config.maxIterations}`,
422
+ `Loop Type: ${loopType === 'loop3' ? 'Implementation' : 'Validation'}`,
423
+ `Mode: ${this.config.mode}`
424
+ ];
425
+ if (this.config.epicContext) {
426
+ context.push(`Epic: ${JSON.stringify(this.config.epicContext)}`);
427
+ }
428
+ if (this.config.phaseContext) {
429
+ context.push(`Phase: ${JSON.stringify(this.config.phaseContext)}`);
430
+ }
431
+ if (this.config.successCriteria) {
432
+ context.push(`Success Criteria: ${JSON.stringify(this.config.successCriteria)}`);
433
+ }
434
+ return context.join(' | ');
435
+ }
436
+ getTaskType() {
437
+ if (this.config.epicContext && typeof this.config.epicContext === 'object') {
438
+ const epicContext = this.config.epicContext;
439
+ return epicContext.epicGoal ?? 'unknown';
440
+ }
441
+ return 'unknown';
442
+ }
443
+ createSuccessResult(startTime) {
444
+ const totalTime = (Date.now() - startTime) / 1000;
445
+ return {
446
+ status: 'success',
447
+ finalDecision: 'PROCEED',
448
+ iterationsCompleted: this.state.currentIteration,
449
+ maxIterations: this.config.maxIterations,
450
+ loop3Confidence: this.state.finalLoop3Confidence ?? 0,
451
+ loop2Consensus: this.state.finalLoop2Consensus ?? 0,
452
+ deliverableVerified: this.state.deliverableVerified,
453
+ executionTimeSeconds: totalTime,
454
+ errors: [],
455
+ successReason: 'Product Owner approved PROCEED decision'
456
+ };
457
+ }
458
+ createFailureResult(startTime, reason) {
459
+ const totalTime = (Date.now() - startTime) / 1000;
460
+ const errors = this.state.iterations.flatMap((iter)=>iter.errors);
461
+ return {
462
+ status: 'failed',
463
+ finalDecision: this.state.finalDecision ?? 'ABORT',
464
+ iterationsCompleted: this.state.currentIteration,
465
+ maxIterations: this.config.maxIterations,
466
+ loop3Confidence: this.state.finalLoop3Confidence ?? 0,
467
+ loop2Consensus: this.state.finalLoop2Consensus ?? 0,
468
+ deliverableVerified: this.state.deliverableVerified,
469
+ executionTimeSeconds: totalTime,
470
+ errors,
471
+ failureReason: reason
472
+ };
473
+ }
474
+ createAbortedResult(startTime) {
475
+ const totalTime = (Date.now() - startTime) / 1000;
476
+ const errors = this.state.iterations.flatMap((iter)=>iter.errors);
477
+ if (this.state.abortReason) {
478
+ errors.push(this.state.abortReason);
479
+ }
480
+ return {
481
+ status: 'aborted',
482
+ finalDecision: 'ABORT',
483
+ iterationsCompleted: this.state.currentIteration,
484
+ maxIterations: this.config.maxIterations,
485
+ loop3Confidence: this.state.finalLoop3Confidence ?? 0,
486
+ loop2Consensus: this.state.finalLoop2Consensus ?? 0,
487
+ deliverableVerified: this.state.deliverableVerified,
488
+ executionTimeSeconds: totalTime,
489
+ errors,
490
+ failureReason: this.state.abortReason
491
+ };
492
+ }
493
+ }
494
+ export default CFNOrchestrator;
495
+
496
+ //# sourceMappingURL=orchestrate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/orchestrator/orchestrate.ts"],"sourcesContent":["/**\r\n * CFN Loop Orchestrator - TypeScript Implementation\r\n *\r\n * Orchestrates the complete CFN (Complete Fail Never) Loop workflow:\r\n * 1. Loop 3: Spawn implementation agents\r\n * 2. Gate Check: Validate test pass rates against threshold\r\n * 3. Loop 2: Spawn validator agents if gate passes\r\n * 4. Consensus Check: Validate consensus among validators\r\n * 5. Product Owner Decision: PROCEED/ITERATE/ABORT\r\n *\r\n * Features:\r\n * - Type-safe state management\r\n * - Redis coordination for agent communication\r\n * - Iteration management with max bounds\r\n * - Comprehensive error handling\r\n * - Full audit trail via state tracking\r\n *\r\n * @module orchestrator\r\n */\r\n\r\nimport {\r\n OrchestratorConfig,\r\n OrchestrationState,\r\n IterationState,\r\n AgentSpawnResult,\r\n AgentExecutionResults,\r\n ConsensusResult,\r\n ProductOwnerDecision,\r\n DeliverableVerificationResult,\r\n OrchestrationResult,\r\n LoopDecision,\r\n OrchestratorError,\r\n ILogger,\r\n IRedisClient,\r\n IGateChecker,\r\n IAgentSpawner,\r\n IProductOwnerDecision,\r\n IDeliverableVerifier,\r\n ModeThresholds,\r\n isValidOrchestratorConfig,\r\n} from './types';\r\nimport { GateResult } from '@/gate-checker/types';\r\nimport type { ExecutionMode } from '@/gate-checker/types';\r\n\r\n/**\r\n * CFN Loop Orchestrator\r\n *\r\n * Manages the complete orchestration workflow with proper type safety,\r\n * error handling, and state management.\r\n */\r\nexport class CFNOrchestrator {\r\n private state: OrchestrationState;\r\n private readonly config: OrchestratorConfig;\r\n private readonly logger: ILogger;\r\n private readonly redisClient: IRedisClient;\r\n private readonly gateChecker: IGateChecker;\r\n private readonly agentSpawner: IAgentSpawner;\r\n private readonly productOwnerDecider: IProductOwnerDecision;\r\n private readonly deliverableVerifier?: IDeliverableVerifier;\r\n\r\n // Security constraints\r\n private readonly securityLimits = {\r\n maxIterations: 100,\r\n maxAgentsPerWave: 50,\r\n taskIdMaxLength: 256,\r\n timeoutMin: 1,\r\n timeoutMax: 3600,\r\n };\r\n\r\n // Mode-specific settings\r\n private readonly gateThreshold: number;\r\n private readonly consensusThreshold: number;\r\n private readonly timeout: number;\r\n private readonly minQuorumLoop3: number;\r\n private readonly minQuorumLoop2: number;\r\n\r\n constructor(\r\n config: OrchestratorConfig,\r\n logger: ILogger,\r\n redisClient: IRedisClient,\r\n gateChecker: IGateChecker,\r\n agentSpawner: IAgentSpawner,\r\n productOwnerDecider: IProductOwnerDecision,\r\n deliverableVerifier?: IDeliverableVerifier\r\n ) {\r\n // Validate configuration\r\n if (!isValidOrchestratorConfig(config)) {\r\n throw new OrchestratorError('Invalid orchestrator configuration', 'CONFIG_INVALID');\r\n }\r\n\r\n // Validate max iterations\r\n if (config.maxIterations > this.securityLimits.maxIterations) {\r\n throw new OrchestratorError(\r\n `Max iterations ${config.maxIterations} exceeds limit ${this.securityLimits.maxIterations}`,\r\n 'CONFIG_INVALID'\r\n );\r\n }\r\n\r\n this.config = config;\r\n this.logger = logger;\r\n this.redisClient = redisClient;\r\n this.gateChecker = gateChecker;\r\n this.agentSpawner = agentSpawner;\r\n this.productOwnerDecider = productOwnerDecider;\r\n this.deliverableVerifier = deliverableVerifier;\r\n\r\n // Get thresholds for mode\r\n const thresholds = ModeThresholds[config.mode as ExecutionMode];\r\n this.gateThreshold = config.gateThreshold ?? thresholds.gate;\r\n this.consensusThreshold = config.consensusThreshold ?? thresholds.consensus;\r\n this.timeout = config.timeout ?? 300; // 5 minutes default\r\n this.minQuorumLoop3 = config.minQuorumLoop3 ?? 0.66;\r\n this.minQuorumLoop2 = config.minQuorumLoop2 ?? 0.66;\r\n\r\n // Initialize orchestration state\r\n this.state = {\r\n taskId: config.taskId,\r\n config,\r\n iterations: [],\r\n currentIteration: 0,\r\n deliverableVerified: false,\r\n aborted: false,\r\n };\r\n\r\n this.logger.info(`CFN Orchestrator initialized for task ${config.taskId}`, {\r\n mode: config.mode,\r\n gateThreshold: this.gateThreshold,\r\n consensusThreshold: this.consensusThreshold,\r\n maxIterations: config.maxIterations,\r\n });\r\n }\r\n\r\n /**\r\n * Execute the complete CFN Loop orchestration\r\n *\r\n * @returns Orchestration result with final status and metrics\r\n * @throws OrchestratorError on fatal errors\r\n */\r\n async execute(): Promise<OrchestrationResult> {\r\n const startTime = Date.now();\r\n\r\n try {\r\n // Store context in Redis\r\n await this.storeContext();\r\n\r\n // Main iteration loop\r\n for (let iteration = 1; iteration <= this.config.maxIterations; iteration++) {\r\n this.state.currentIteration = iteration;\r\n const iterationStart = Date.now();\r\n\r\n this.logger.info(`Starting iteration ${iteration}/${this.config.maxIterations}`);\r\n\r\n try {\r\n // Create iteration state\r\n const iterationState: IterationState = {\r\n iteration,\r\n loop3Spawned: [],\r\n loop3Completed: [],\r\n deliverableVerified: false,\r\n gatePassed: false,\r\n loop2Spawned: [],\r\n loop2Completed: [],\r\n consensusReached: false,\r\n startTime: iterationStart,\r\n errors: [],\r\n };\r\n\r\n // Step 1: Spawn Loop 3 agents\r\n iterationState.loop3Spawned = await this.spawnLoop3Agents(iteration);\r\n\r\n // Step 2: Wait for Loop 3 completion and collect results\r\n iterationState.loop3Completed = await this.waitForLoop3Completion(iteration);\r\n\r\n // Step 3: Verify deliverables\r\n if (this.config.expectedFiles || this.config.epicContext) {\r\n const verified = await this.verifyDeliverables();\r\n iterationState.deliverableVerified = verified;\r\n\r\n if (!verified) {\r\n this.logger.warn('Deliverable verification failed, requesting iteration');\r\n iterationState.endTime = Date.now();\r\n this.state.iterations.push(iterationState);\r\n\r\n // Store feedback for next iteration\r\n await this.storeIterationFeedback(iteration);\r\n continue;\r\n }\r\n\r\n this.state.deliverableVerified = true;\r\n }\r\n\r\n // Step 4: Gate check (Loop 3 self-validation)\r\n const gateResult = await this.performGateCheck(iteration);\r\n iterationState.gateCheckResult = gateResult;\r\n iterationState.gatePassed = gateResult.passed;\r\n\r\n if (!gateResult.passed) {\r\n this.logger.warn(`Gate check failed at iteration ${iteration}`, {\r\n passRate: gateResult.pass_rate,\r\n threshold: gateResult.threshold,\r\n gap: gateResult.gap,\r\n });\r\n iterationState.endTime = Date.now();\r\n this.state.iterations.push(iterationState);\r\n\r\n // Store feedback for next iteration\r\n await this.storeIterationFeedback(iteration);\r\n continue;\r\n }\r\n\r\n this.state.finalLoop3Confidence = gateResult.pass_rate;\r\n\r\n // Step 5: Spawn Loop 2 agents\r\n iterationState.loop2Spawned = await this.spawnLoop2Agents(iteration);\r\n\r\n // Step 6: Wait for Loop 2 completion and collect results\r\n iterationState.loop2Completed = await this.waitForLoop2Completion(iteration);\r\n\r\n // Step 7: Consensus check (Loop 2 validation)\r\n const consensusResult = await this.performConsensusCheck(iteration);\r\n iterationState.consensusReached = consensusResult.passed;\r\n iterationState.consensusScore = consensusResult.consensus;\r\n\r\n if (!consensusResult.passed) {\r\n this.logger.warn(`Consensus check failed at iteration ${iteration}`, {\r\n consensus: consensusResult.consensus,\r\n threshold: consensusResult.threshold,\r\n gap: consensusResult.gap,\r\n });\r\n iterationState.endTime = Date.now();\r\n this.state.iterations.push(iterationState);\r\n\r\n // Store feedback for next iteration\r\n await this.storeIterationFeedback(iteration);\r\n continue;\r\n }\r\n\r\n this.state.finalLoop2Consensus = consensusResult.consensus;\r\n\r\n // Step 8: Get Product Owner decision\r\n const decision = await this.getProductOwnerDecision(iteration);\r\n iterationState.productOwnerDecision = decision.decision;\r\n iterationState.finalDecision = decision.decision;\r\n iterationState.endTime = Date.now();\r\n\r\n this.logger.info(`Product Owner decision: ${decision.decision}`, {\r\n rationale: decision.rationale,\r\n confidence: decision.confidence,\r\n });\r\n\r\n // Step 9: Execute decision\r\n this.state.iterations.push(iterationState);\r\n const result = await this.executeDecision(decision, iteration, startTime);\r\n return result;\r\n } catch (error) {\r\n const iterationState = this.state.iterations[iteration - 1] || {\r\n iteration,\r\n loop3Spawned: [],\r\n loop3Completed: [],\r\n deliverableVerified: false,\r\n gatePassed: false,\r\n loop2Spawned: [],\r\n loop2Completed: [],\r\n consensusReached: false,\r\n startTime: iterationStart,\r\n errors: [],\r\n };\r\n\r\n const errorMessage = error instanceof Error ? error.message : String(error);\r\n\r\n // Check if this is an iteration request (not a real error)\r\n if (errorMessage === 'ITERATE - continue to next iteration') {\r\n // This is expected - just continue to next iteration\r\n continue;\r\n }\r\n\r\n iterationState.errors.push(errorMessage);\r\n if (!iterationState.endTime) {\r\n iterationState.endTime = Date.now();\r\n }\r\n\r\n this.state.iterations.push(iterationState);\r\n\r\n if (error instanceof OrchestratorError && error.code === 'ITERATION_LIMIT') {\r\n return this.createFailureResult(startTime, `Max iterations reached at iteration ${iteration}`);\r\n }\r\n\r\n this.logger.error(`Error during iteration ${iteration}`, error);\r\n return this.createFailureResult(startTime, errorMessage);\r\n }\r\n }\r\n\r\n // Max iterations reached without decision\r\n return this.createFailureResult(startTime, 'Max iterations reached without PROCEED decision');\r\n } catch (error) {\r\n this.state.aborted = true;\r\n this.state.abortReason = error instanceof Error ? error.message : String(error);\r\n this.logger.error('Orchestration aborted', error);\r\n\r\n return this.createAbortedResult(startTime);\r\n }\r\n }\r\n\r\n /**\r\n * Get orchestration state for inspection\r\n */\r\n getState(): Readonly<OrchestrationState> {\r\n return Object.freeze({ ...this.state });\r\n }\r\n\r\n /**\r\n * Private helper methods\r\n */\r\n\r\n private async storeContext(): Promise<void> {\r\n try {\r\n if (this.config.epicContext) {\r\n await this.redisClient.set(\r\n `swarm:${this.config.taskId}:epic-context`,\r\n JSON.stringify(this.config.epicContext),\r\n 86400\r\n );\r\n }\r\n\r\n if (this.config.phaseContext) {\r\n await this.redisClient.set(\r\n `swarm:${this.config.taskId}:phase-context`,\r\n JSON.stringify(this.config.phaseContext),\r\n 86400\r\n );\r\n }\r\n\r\n if (this.config.successCriteria) {\r\n await this.redisClient.set(\r\n `swarm:${this.config.taskId}:success-criteria`,\r\n JSON.stringify(this.config.successCriteria),\r\n 86400\r\n );\r\n }\r\n\r\n this.logger.info('Context stored in Redis');\r\n } catch (error) {\r\n this.logger.warn('Failed to store context in Redis', error);\r\n }\r\n }\r\n\r\n private async spawnLoop3Agents(iteration: number): Promise<AgentSpawnResult[]> {\r\n this.logger.info(`Spawning Loop 3 agents for iteration ${iteration}`);\r\n\r\n try {\r\n const context = this.buildAgentContext(iteration, 'loop3');\r\n const results = await this.agentSpawner.spawn(\r\n this.config.taskId,\r\n iteration,\r\n this.config.loop3Agents,\r\n 'loop3',\r\n context\r\n );\r\n\r\n this.logger.info(`Spawned ${results.length} Loop 3 agents`);\r\n return results;\r\n } catch (error) {\r\n throw new OrchestratorError(\r\n `Failed to spawn Loop 3 agents: ${error instanceof Error ? error.message : String(error)}`,\r\n 'SPAWN_FAILED'\r\n );\r\n }\r\n }\r\n\r\n private async spawnLoop2Agents(iteration: number): Promise<AgentSpawnResult[]> {\r\n this.logger.info(`Spawning Loop 2 agents for iteration ${iteration}`);\r\n\r\n try {\r\n const context = this.buildAgentContext(iteration, 'loop2');\r\n const results = await this.agentSpawner.spawn(\r\n this.config.taskId,\r\n iteration,\r\n this.config.loop2Agents,\r\n 'loop2',\r\n context\r\n );\r\n\r\n this.logger.info(`Spawned ${results.length} Loop 2 agents`);\r\n return results;\r\n } catch (error) {\r\n throw new OrchestratorError(\r\n `Failed to spawn Loop 2 agents: ${error instanceof Error ? error.message : String(error)}`,\r\n 'SPAWN_FAILED'\r\n );\r\n }\r\n }\r\n\r\n private async waitForLoop3Completion(iteration: number): Promise<AgentExecutionResults[]> {\r\n this.logger.info(`Waiting for Loop 3 agents to complete`);\r\n\r\n try {\r\n // In real implementation, would wait for agents via Redis coordination\r\n // For now, collect results from Redis\r\n const results: AgentExecutionResults[] = [];\r\n // TODO: Implement actual waiting logic with Redis blocking\r\n\r\n return results;\r\n } catch (error) {\r\n throw new OrchestratorError(\r\n `Timeout waiting for Loop 3 agents: ${error instanceof Error ? error.message : String(error)}`,\r\n 'TIMEOUT'\r\n );\r\n }\r\n }\r\n\r\n private async waitForLoop2Completion(iteration: number): Promise<AgentExecutionResults[]> {\r\n this.logger.info(`Waiting for Loop 2 agents to complete`);\r\n\r\n try {\r\n // In real implementation, would wait for agents via Redis coordination\r\n const results: AgentExecutionResults[] = [];\r\n // TODO: Implement actual waiting logic with Redis blocking\r\n\r\n return results;\r\n } catch (error) {\r\n throw new OrchestratorError(\r\n `Timeout waiting for Loop 2 agents: ${error instanceof Error ? error.message : String(error)}`,\r\n 'TIMEOUT'\r\n );\r\n }\r\n }\r\n\r\n private async verifyDeliverables(): Promise<boolean> {\r\n if (!this.deliverableVerifier) {\r\n this.logger.warn('Deliverable verifier not available, skipping verification');\r\n return true;\r\n }\r\n\r\n try {\r\n const result = await this.deliverableVerifier.verify({\r\n expectedFiles: this.config.expectedFiles,\r\n taskType: this.getTaskType(),\r\n strict: this.config.mode === 'enterprise',\r\n });\r\n\r\n if (!result.verified) {\r\n this.logger.warn('Deliverable verification failed', {\r\n filesChecked: result.filesChecked,\r\n filesFound: result.filesFound,\r\n missingFiles: result.missingFiles,\r\n });\r\n }\r\n\r\n return result.verified;\r\n } catch (error) {\r\n this.logger.error('Deliverable verification error', error);\r\n return false;\r\n }\r\n }\r\n\r\n private async performGateCheck(iteration: number): Promise<GateResult> {\r\n this.logger.info(`Performing gate check for iteration ${iteration}`);\r\n\r\n try {\r\n const result = await this.gateChecker.checkGate(\r\n this.config.taskId,\r\n this.config.loop3Agents,\r\n this.gateThreshold,\r\n this.minQuorumLoop3\r\n );\r\n\r\n this.logger.info(`Gate check result: ${result.passed ? 'PASS' : 'FAIL'}`, {\r\n passRate: result.pass_rate,\r\n threshold: result.threshold,\r\n });\r\n\r\n return result;\r\n } catch (error) {\r\n throw new OrchestratorError(\r\n `Gate check failed: ${error instanceof Error ? error.message : String(error)}`,\r\n 'GATE_FAILED'\r\n );\r\n }\r\n }\r\n\r\n private async performConsensusCheck(iteration: number): Promise<ConsensusResult> {\r\n this.logger.info(`Performing consensus check for iteration ${iteration}`);\r\n\r\n try {\r\n // In real implementation, would aggregate Loop 2 agent scores\r\n const agentCount = this.config.loop2Agents.length;\r\n // TODO: Get actual consensus score from Redis\r\n\r\n const consensus = 0.95; // Placeholder\r\n const passed = consensus >= this.consensusThreshold;\r\n\r\n const result: ConsensusResult = {\r\n consensus,\r\n threshold: this.consensusThreshold,\r\n passed,\r\n agentCount,\r\n completedAgentCount: agentCount,\r\n };\r\n\r\n if (!passed) {\r\n result.gap = this.consensusThreshold - consensus;\r\n }\r\n\r\n this.logger.info(`Consensus check result: ${passed ? 'PASS' : 'FAIL'}`, {\r\n consensus,\r\n threshold: this.consensusThreshold,\r\n });\r\n\r\n return result;\r\n } catch (error) {\r\n throw new OrchestratorError(\r\n `Consensus check failed: ${error instanceof Error ? error.message : String(error)}`,\r\n 'CONSENSUS_FAILED'\r\n );\r\n }\r\n }\r\n\r\n private async getProductOwnerDecision(iteration: number): Promise<ProductOwnerDecision> {\r\n this.logger.info(`Getting Product Owner decision for iteration ${iteration}`);\r\n\r\n try {\r\n const consensus = this.state.finalLoop2Consensus ?? 0;\r\n\r\n const decision = await this.productOwnerDecider.makeDecision(\r\n this.config.taskId,\r\n iteration,\r\n consensus,\r\n this.consensusThreshold,\r\n this.config.maxIterations\r\n );\r\n\r\n return decision;\r\n } catch (error) {\r\n throw new OrchestratorError(\r\n `Product Owner decision failed: ${error instanceof Error ? error.message : String(error)}`,\r\n 'DECISION_FAILED'\r\n );\r\n }\r\n }\r\n\r\n private async requestIteration(iteration: number, iterationState: IterationState): Promise<void> {\r\n this.logger.info(`Requesting iteration ${iteration + 1}`);\r\n\r\n if (iteration >= this.config.maxIterations) {\r\n throw new OrchestratorError(\r\n `Iteration limit reached at iteration ${iteration}`,\r\n 'ITERATION_LIMIT'\r\n );\r\n }\r\n\r\n iterationState.endTime = Date.now();\r\n this.state.iterations.push(iterationState);\r\n\r\n // Store iteration feedback in Redis for next iteration\r\n await this.storeIterationFeedback(iteration);\r\n }\r\n\r\n private async storeIterationFeedback(iteration: number): Promise<void> {\r\n try {\r\n const currentIteration = this.state.iterations[iteration - 1];\r\n if (currentIteration) {\r\n const feedback = {\r\n iteration,\r\n previousGateStatus: currentIteration.gatePassed ? 'passed' : 'failed',\r\n previousPassRate: currentIteration.gateCheckResult?.pass_rate,\r\n failedTests: currentIteration.gateCheckResult?.failed_suites,\r\n consensusScore: currentIteration.consensusScore,\r\n };\r\n\r\n await this.redisClient.set(\r\n `swarm:${this.config.taskId}:iteration-feedback`,\r\n JSON.stringify(feedback),\r\n 3600\r\n );\r\n }\r\n } catch (error) {\r\n this.logger.warn('Failed to store iteration feedback', error);\r\n }\r\n }\r\n\r\n private async executeDecision(\r\n decision: ProductOwnerDecision,\r\n iteration: number,\r\n startTime: number\r\n ): Promise<OrchestrationResult> {\r\n switch (decision.decision) {\r\n case 'PROCEED':\r\n this.logger.info('Product Owner decision: PROCEED');\r\n this.state.finalDecision = 'PROCEED';\r\n return this.createSuccessResult(startTime);\r\n\r\n case 'ABORT':\r\n this.logger.info('Product Owner decision: ABORT');\r\n this.state.finalDecision = 'ABORT';\r\n this.state.aborted = true;\r\n return this.createAbortedResult(startTime);\r\n\r\n case 'ITERATE':\r\n this.logger.info('Product Owner decision: ITERATE');\r\n if (iteration >= this.config.maxIterations) {\r\n return this.createFailureResult(\r\n startTime,\r\n `Max iterations reached at iteration ${iteration}`\r\n );\r\n }\r\n // Signal to continue to next iteration\r\n throw new Error('ITERATE - continue to next iteration');\r\n\r\n default:\r\n const _exhaustive: never = decision.decision;\r\n return _exhaustive;\r\n }\r\n }\r\n\r\n private buildAgentContext(iteration: number, loopType: 'loop3' | 'loop2'): string {\r\n const context = [\r\n `Task: ${this.config.taskId}`,\r\n `Iteration: ${iteration}/${this.config.maxIterations}`,\r\n `Loop Type: ${loopType === 'loop3' ? 'Implementation' : 'Validation'}`,\r\n `Mode: ${this.config.mode}`,\r\n ];\r\n\r\n if (this.config.epicContext) {\r\n context.push(`Epic: ${JSON.stringify(this.config.epicContext)}`);\r\n }\r\n\r\n if (this.config.phaseContext) {\r\n context.push(`Phase: ${JSON.stringify(this.config.phaseContext)}`);\r\n }\r\n\r\n if (this.config.successCriteria) {\r\n context.push(`Success Criteria: ${JSON.stringify(this.config.successCriteria)}`);\r\n }\r\n\r\n return context.join(' | ');\r\n }\r\n\r\n private getTaskType(): string {\r\n if (this.config.epicContext && typeof this.config.epicContext === 'object') {\r\n const epicContext = this.config.epicContext as Record<string, unknown>;\r\n return (epicContext.epicGoal as string) ?? 'unknown';\r\n }\r\n return 'unknown';\r\n }\r\n\r\n private createSuccessResult(startTime: number): OrchestrationResult {\r\n const totalTime = (Date.now() - startTime) / 1000;\r\n\r\n return {\r\n status: 'success',\r\n finalDecision: 'PROCEED',\r\n iterationsCompleted: this.state.currentIteration,\r\n maxIterations: this.config.maxIterations,\r\n loop3Confidence: this.state.finalLoop3Confidence ?? 0,\r\n loop2Consensus: this.state.finalLoop2Consensus ?? 0,\r\n deliverableVerified: this.state.deliverableVerified,\r\n executionTimeSeconds: totalTime,\r\n errors: [],\r\n successReason: 'Product Owner approved PROCEED decision',\r\n };\r\n }\r\n\r\n private createFailureResult(startTime: number, reason: string): OrchestrationResult {\r\n const totalTime = (Date.now() - startTime) / 1000;\r\n const errors = this.state.iterations.flatMap((iter: IterationState) => iter.errors);\r\n\r\n return {\r\n status: 'failed',\r\n finalDecision: this.state.finalDecision ?? 'ABORT',\r\n iterationsCompleted: this.state.currentIteration,\r\n maxIterations: this.config.maxIterations,\r\n loop3Confidence: this.state.finalLoop3Confidence ?? 0,\r\n loop2Consensus: this.state.finalLoop2Consensus ?? 0,\r\n deliverableVerified: this.state.deliverableVerified,\r\n executionTimeSeconds: totalTime,\r\n errors,\r\n failureReason: reason,\r\n };\r\n }\r\n\r\n private createAbortedResult(startTime: number): OrchestrationResult {\r\n const totalTime = (Date.now() - startTime) / 1000;\r\n const errors = this.state.iterations.flatMap((iter: IterationState) => iter.errors);\r\n\r\n if (this.state.abortReason) {\r\n errors.push(this.state.abortReason);\r\n }\r\n\r\n return {\r\n status: 'aborted',\r\n finalDecision: 'ABORT',\r\n iterationsCompleted: this.state.currentIteration,\r\n maxIterations: this.config.maxIterations,\r\n loop3Confidence: this.state.finalLoop3Confidence ?? 0,\r\n loop2Consensus: this.state.finalLoop2Consensus ?? 0,\r\n deliverableVerified: this.state.deliverableVerified,\r\n executionTimeSeconds: totalTime,\r\n errors,\r\n failureReason: this.state.abortReason,\r\n };\r\n }\r\n}\r\n\r\nexport default CFNOrchestrator;\r\n"],"names":["OrchestratorError","ModeThresholds","isValidOrchestratorConfig","CFNOrchestrator","state","config","logger","redisClient","gateChecker","agentSpawner","productOwnerDecider","deliverableVerifier","securityLimits","maxIterations","maxAgentsPerWave","taskIdMaxLength","timeoutMin","timeoutMax","gateThreshold","consensusThreshold","timeout","minQuorumLoop3","minQuorumLoop2","thresholds","mode","gate","consensus","taskId","iterations","currentIteration","deliverableVerified","aborted","info","execute","startTime","Date","now","storeContext","iteration","iterationStart","iterationState","loop3Spawned","loop3Completed","gatePassed","loop2Spawned","loop2Completed","consensusReached","errors","spawnLoop3Agents","waitForLoop3Completion","expectedFiles","epicContext","verified","verifyDeliverables","warn","endTime","push","storeIterationFeedback","gateResult","performGateCheck","gateCheckResult","passed","passRate","pass_rate","threshold","gap","finalLoop3Confidence","spawnLoop2Agents","waitForLoop2Completion","consensusResult","performConsensusCheck","consensusScore","finalLoop2Consensus","decision","getProductOwnerDecision","productOwnerDecision","finalDecision","rationale","confidence","result","executeDecision","error","errorMessage","Error","message","String","code","createFailureResult","abortReason","createAbortedResult","getState","Object","freeze","set","JSON","stringify","phaseContext","successCriteria","context","buildAgentContext","results","spawn","loop3Agents","length","loop2Agents","verify","taskType","getTaskType","strict","filesChecked","filesFound","missingFiles","checkGate","agentCount","completedAgentCount","makeDecision","requestIteration","feedback","previousGateStatus","previousPassRate","failedTests","failed_suites","createSuccessResult","_exhaustive","loopType","join","epicGoal","totalTime","status","iterationsCompleted","loop3Confidence","loop2Consensus","executionTimeSeconds","successReason","reason","flatMap","iter","failureReason"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;CAkBC,GAED,SAWEA,iB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B;QAClE,MAAM6F,YAAY,AAAC5F,CAAAA,KAAKC,GAAG,KAAKF,SAAQ,IAAK;QAC7C,MAAMa,SAAS,IAAI,CAAC3C,KAAK,CAACwB,UAAU,CAAC2G,OAAO,CAAC,CAACC,OAAyBA,KAAKzF,MAAM;QAElF,IAAI,IAAI,CAAC3C,KAAK,CAACoF,WAAW,EAAE;YAC1BzC,OAAOS,IAAI,CAAC,IAAI,CAACpD,KAAK,CAACoF,WAAW;QACpC;QAEA,OAAO;YACLwC,QAAQ;YACRpD,eAAe;YACfqD,qBAAqB,IAAI,CAAC7H,KAAK,CAACyB,gBAAgB;YAChDhB,eAAe,IAAI,CAACR,MAAM,CAACQ,aAAa;YACxCqH,iBAAiB,IAAI,CAAC9H,KAAK,CAAC8D,oBAAoB,IAAI;YACpDiE,gBAAgB,IAAI,CAAC/H,KAAK,CAACoE,mBAAmB,IAAI;YAClD1C,qBAAqB,IAAI,CAAC1B,KAAK,CAAC0B,mBAAmB;YACnDsG,sBAAsBL;YACtBhF;YACA0F,eAAe,IAAI,CAACrI,KAAK,CAACoF,WAAW;QACvC;IACF;AACF;AAEA,eAAerF,gBAAgB"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * CFN Loop Orchestrator Type Definitions
3
+ *
4
+ * Comprehensive type definitions for the orchestrator workflow including:
5
+ * - Orchestration configuration and modes
6
+ * - Agent management and execution
7
+ * - Decision types and outcomes
8
+ * - Iteration context and state
9
+ * - Error handling and validation
10
+ *
11
+ * @module orchestrator/types
12
+ */ /**
13
+ * Orchestrator error with code
14
+ */ export class OrchestratorError extends Error {
15
+ code;
16
+ metadata;
17
+ constructor(message, code, metadata){
18
+ super(message), this.code = code, this.metadata = metadata;
19
+ this.name = 'OrchestratorError';
20
+ Object.setPrototypeOf(this, OrchestratorError.prototype);
21
+ }
22
+ }
23
+ /**
24
+ * Mode-specific thresholds
25
+ */ export const ModeThresholds = {
26
+ mvp: {
27
+ gate: 0.70,
28
+ consensus: 0.80
29
+ },
30
+ standard: {
31
+ gate: 0.95,
32
+ consensus: 0.90
33
+ },
34
+ enterprise: {
35
+ gate: 0.98,
36
+ consensus: 0.95
37
+ }
38
+ };
39
+ /**
40
+ * Type guards and validators
41
+ */ export function isValidLoopDecision(value) {
42
+ return value === 'PROCEED' || value === 'ITERATE' || value === 'ABORT';
43
+ }
44
+ export function isValidExecutionMode(value) {
45
+ return value === 'mvp' || value === 'standard' || value === 'enterprise';
46
+ }
47
+ export function isValidOrchestratorConfig(value) {
48
+ if (typeof value !== 'object' || value === null) {
49
+ return false;
50
+ }
51
+ const config = value;
52
+ return typeof config.taskId === 'string' && isValidExecutionMode(config.mode) && Array.isArray(config.loop3Agents) && Array.isArray(config.loop2Agents) && typeof config.productOwner === 'string' && typeof config.maxIterations === 'number' && config.maxIterations > 0;
53
+ }
54
+ export function getThresholdsForMode(mode) {
55
+ return ModeThresholds[mode];
56
+ }
57
+
58
+ //# sourceMappingURL=types.js.map