claude-flow-novice 2.15.10 → 2.16.0

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 (652) hide show
  1. package/.claude/cfn-extras/agents/cfn-v3-coordinator.md +517 -0
  2. package/.claude/commands/cfn-loop-cli.md +158 -464
  3. package/.claude/commands/cfn-loop-trigger.md +114 -0
  4. package/.claude/hooks/cfn-invoke-post-edit-ts.sh +100 -0
  5. package/.claude/hooks/cfn-invoke-post-edit-ts.sh.backup +78 -0
  6. package/.claude/hooks/cfn-invoke-post-edit.sh +22 -0
  7. package/.claude/hooks/cfn-invoke-post-edit.sh.backup +87 -0
  8. package/.claude/hooks/cfn-invoke-pre-edit-ts.sh +116 -0
  9. package/.claude/hooks/cfn-invoke-pre-edit-ts.sh.backup +94 -0
  10. package/.claude/hooks/cfn-invoke-pre-edit.sh +22 -0
  11. package/.claude/hooks/cfn-invoke-pre-edit.sh.backup +88 -0
  12. package/.claude/skills/cfn-agent-spawning/SKILL.md +48 -1
  13. package/.claude/skills/cfn-agent-spawning/SKILL.md.backup +135 -0
  14. package/.claude/skills/cfn-agent-spawning/TYPESCRIPT_MIGRATION.md +567 -0
  15. package/.claude/skills/cfn-agent-spawning/check-dependencies.sh +22 -0
  16. package/.claude/skills/{cfn-redis-coordination/check-dependencies.sh → cfn-agent-spawning/check-dependencies.sh.backup} +3 -5
  17. package/.claude/skills/cfn-agent-spawning/get-agent-provider-env.sh +22 -0
  18. package/.claude/skills/cfn-agent-spawning/get-agent-provider-env.sh.backup +127 -0
  19. package/.claude/skills/cfn-agent-spawning/parse-agent-provider.sh +22 -0
  20. package/.claude/skills/cfn-agent-spawning/parse-agent-provider.sh.backup +59 -0
  21. package/.claude/skills/cfn-agent-spawning/spawn-agent-wrapper.sh +63 -0
  22. package/.claude/skills/cfn-agent-spawning/spawn-agent-wrapper.sh.backup +41 -0
  23. package/.claude/skills/cfn-agent-spawning/spawn-agent.sh +26 -1
  24. package/.claude/skills/cfn-agent-spawning/spawn-templates.sh +22 -0
  25. package/.claude/skills/cfn-agent-spawning/spawn-templates.sh.backup +613 -0
  26. package/.claude/skills/cfn-agent-spawning/spawn-worker.sh +22 -0
  27. package/.claude/skills/cfn-agent-spawning/spawn-worker.sh.backup +176 -0
  28. package/.claude/skills/cfn-loop-orchestration/.backups/unknown/1763619700_33aff4a69b99159e4e849107ebc4d09f/metadata.json +8 -0
  29. package/.claude/skills/cfn-loop-orchestration/.backups/unknown/1763619700_33aff4a69b99159e4e849107ebc4d09f/original +271 -0
  30. package/.claude/skills/cfn-loop-orchestration/.backups/unknown/1763619700_33aff4a69b99159e4e849107ebc4d09f/revert.sh +7 -0
  31. package/.claude/skills/cfn-loop-orchestration/.backups/unknown/1763671642_06496e8c399a79db08167cc00ed4b31e/metadata.json +8 -0
  32. package/.claude/skills/cfn-loop-orchestration/.backups/unknown/1763671642_06496e8c399a79db08167cc00ed4b31e/original +325 -0
  33. package/.claude/skills/cfn-loop-orchestration/.backups/unknown/1763671642_06496e8c399a79db08167cc00ed4b31e/revert.sh +7 -0
  34. package/.claude/skills/cfn-loop-orchestration/CLI_IMPLEMENTATION_SUMMARY.md +330 -0
  35. package/.claude/skills/cfn-loop-orchestration/CONFIGURATION_IMPROVEMENTS.md +318 -0
  36. package/.claude/skills/cfn-loop-orchestration/CONTEXT_LOOKUP_MIGRATION.md +308 -0
  37. package/.claude/skills/cfn-loop-orchestration/CONTEXT_LOOKUP_QUICK_START.md +378 -0
  38. package/.claude/skills/cfn-loop-orchestration/E2E_VALIDATION_REPORT.md +262 -0
  39. package/.claude/skills/cfn-loop-orchestration/IMPLEMENTATION_SUMMARY.md +319 -519
  40. package/.claude/skills/cfn-loop-orchestration/NORTH_STAR_E2E_REPORT.md +299 -0
  41. package/.claude/skills/cfn-loop-orchestration/NORTH_STAR_EXECUTION_SUMMARY.md +403 -0
  42. package/.claude/skills/cfn-loop-orchestration/NORTH_STAR_INDEX.md +323 -0
  43. package/.claude/skills/cfn-loop-orchestration/SKILL.md +159 -48
  44. package/.claude/skills/cfn-loop-orchestration/SPAWN_AGENTS_IMPLEMENTATION.md +188 -0
  45. package/.claude/skills/cfn-loop-orchestration/TEST_COVERAGE_REPORT.md +335 -0
  46. package/.claude/skills/cfn-loop-orchestration/TEST_COVERAGE_SUMMARY.md +456 -0
  47. package/.claude/skills/cfn-loop-orchestration/TYPESCRIPT_INTEGRATION_REPORT.md +709 -0
  48. package/.claude/skills/cfn-loop-orchestration/TYPESCRIPT_INTEGRATION_SUMMARY.md +257 -0
  49. package/.claude/skills/cfn-loop-orchestration/VALIDATION_REPORT.md +572 -0
  50. package/.claude/skills/cfn-loop-orchestration/VALIDATION_SUMMARY.txt +196 -0
  51. package/.claude/skills/cfn-loop-orchestration/VALIDATOR_MODULE_GUIDE.md +526 -0
  52. package/.claude/skills/cfn-loop-orchestration/archive/legacy-bash/README.md +167 -0
  53. package/.claude/skills/cfn-loop-orchestration/archive/legacy-bash/orchestrate-enhanced.sh +548 -0
  54. package/{claude-assets/skills/cfn-loop-orchestration → .claude/skills/cfn-loop-orchestration/archive/legacy-bash}/orchestrate-wrapper.sh +11 -1
  55. package/.claude/skills/cfn-loop-orchestration/archive/legacy-bash/orchestrate.sh +182 -0
  56. package/.claude/skills/cfn-loop-orchestration/e2e-validation-fixed.js +240 -0
  57. package/.claude/skills/cfn-loop-orchestration/e2e-validation.js +213 -0
  58. package/.claude/skills/cfn-loop-orchestration/package-lock.json +3 -0
  59. package/.claude/skills/cfn-loop-orchestration/package.json +4 -0
  60. package/.claude/skills/cfn-loop-orchestration/run-north-star-e2e.ts +210 -0
  61. package/.claude/skills/cfn-loop-orchestration/src/cli/orchestrator-cli.ts +396 -0
  62. package/.claude/skills/cfn-loop-orchestration/src/helpers/CONFIDENCE_AGGREGATOR.md +564 -0
  63. package/.claude/skills/cfn-loop-orchestration/src/helpers/CONFIDENCE_AGGREGATOR_QUICK_REF.md +241 -0
  64. package/.claude/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_IMPLEMENTATION.md +375 -0
  65. package/.claude/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_QUICK_REFERENCE.md +362 -0
  66. package/.claude/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_README.md +307 -0
  67. package/.claude/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_USAGE_GUIDE.md +508 -0
  68. package/.claude/skills/cfn-loop-orchestration/src/helpers/confidence-aggregator.ts +473 -0
  69. package/.claude/skills/cfn-loop-orchestration/src/helpers/consensus.ts +1 -1
  70. package/.claude/skills/cfn-loop-orchestration/src/helpers/context-injector.ts +349 -0
  71. package/.claude/skills/cfn-loop-orchestration/src/helpers/context-lookup.ts +486 -0
  72. package/.claude/skills/cfn-loop-orchestration/src/helpers/deliverable-verifier.ts +6 -2
  73. package/.claude/skills/cfn-loop-orchestration/src/helpers/gate-check.ts +1 -1
  74. package/.claude/skills/cfn-loop-orchestration/src/helpers/product-owner-decision.ts +316 -0
  75. package/.claude/skills/cfn-loop-orchestration/src/helpers/spawn-agents.ts +357 -0
  76. package/.claude/skills/cfn-loop-orchestration/src/helpers/validator.ts +276 -0
  77. package/.claude/skills/cfn-loop-orchestration/src/index.ts +2 -0
  78. package/.claude/skills/cfn-loop-orchestration/src/orchestrate.ts +743 -2
  79. package/.claude/skills/cfn-loop-orchestration/src/types.ts +56 -0
  80. package/.claude/skills/cfn-loop-orchestration/test-cli.sh +92 -0
  81. package/.claude/skills/cfn-loop-orchestration/test-typescript-integration.sh +442 -0
  82. package/.claude/skills/cfn-loop-orchestration/tests/agent-spawner.test.ts +124 -0
  83. package/.claude/skills/cfn-loop-orchestration/tests/confidence-aggregator.test.ts +604 -0
  84. package/.claude/skills/cfn-loop-orchestration/tests/context-injector.test.ts +561 -0
  85. package/.claude/skills/cfn-loop-orchestration/tests/context-lookup.test.ts +661 -0
  86. package/.claude/skills/cfn-loop-orchestration/tests/deliverable-verifier.test.ts +2 -2
  87. package/.claude/skills/cfn-loop-orchestration/tests/gate-check-edge-cases.test.ts +422 -0
  88. package/.claude/skills/cfn-loop-orchestration/tests/gate-checker.test.ts +276 -0
  89. package/.claude/skills/cfn-loop-orchestration/tests/logger.test.ts +291 -0
  90. package/.claude/skills/cfn-loop-orchestration/tests/north-star-e2e.test.ts +334 -0
  91. package/.claude/skills/cfn-loop-orchestration/tests/redis-coordinator.test.ts +321 -0
  92. package/.claude/skills/cfn-loop-orchestration/tests/spawn-agents.test.ts +284 -0
  93. package/.claude/skills/cfn-loop-orchestration/tests/validator.test.ts +643 -0
  94. package/.claude/skills/cfn-loop-validation/IMPLEMENTATION_SUMMARY.md +672 -0
  95. package/.claude/skills/cfn-loop-validation/INDEX.md +531 -0
  96. package/.claude/skills/cfn-loop-validation/README_TYPESCRIPT.md +454 -0
  97. package/.claude/skills/cfn-loop-validation/SKILL.md +48 -1
  98. package/.claude/skills/cfn-loop-validation/SKILL.md.backup +353 -0
  99. package/.claude/skills/cfn-loop-validation/SKILL_TYPESCRIPT.md +782 -0
  100. package/.claude/skills/cfn-loop-validation/VAPOR_DETECTION_EXAMPLES.md +598 -0
  101. package/.claude/skills/cfn-loop-validation/check-dependencies.sh +22 -0
  102. package/{claude-assets/skills/cfn-redis-coordination/check-dependencies.sh → .claude/skills/cfn-loop-validation/check-dependencies.sh.backup} +4 -5
  103. package/.claude/skills/cfn-loop-validation/detect-vapor.sh +59 -0
  104. package/.claude/skills/cfn-loop-validation/detect-vapor.sh.backup +37 -0
  105. package/.claude/skills/cfn-loop-validation/dist/.tsbuildinfo +1 -0
  106. package/.claude/skills/cfn-loop-validation/dist/cli/detect-vapor.d.ts +14 -0
  107. package/.claude/skills/cfn-loop-validation/dist/cli/detect-vapor.d.ts.map +1 -0
  108. package/.claude/skills/cfn-loop-validation/dist/cli/detect-vapor.js +185 -0
  109. package/.claude/skills/cfn-loop-validation/dist/cli/detect-vapor.js.map +1 -0
  110. package/.claude/skills/cfn-loop-validation/dist/cli/validate-deliverables.d.ts +14 -0
  111. package/.claude/skills/cfn-loop-validation/dist/cli/validate-deliverables.d.ts.map +1 -0
  112. package/.claude/skills/cfn-loop-validation/dist/cli/validate-deliverables.js +176 -0
  113. package/.claude/skills/cfn-loop-validation/dist/cli/validate-deliverables.js.map +1 -0
  114. package/.claude/skills/cfn-loop-validation/dist/cli/validate-gate.d.ts +19 -0
  115. package/.claude/skills/cfn-loop-validation/dist/cli/validate-gate.d.ts.map +1 -0
  116. package/.claude/skills/cfn-loop-validation/dist/cli/validate-gate.js +123 -0
  117. package/.claude/skills/cfn-loop-validation/dist/cli/validate-gate.js.map +1 -0
  118. package/.claude/skills/cfn-loop-validation/dist/types.d.ts +156 -0
  119. package/.claude/skills/cfn-loop-validation/dist/types.d.ts.map +1 -0
  120. package/.claude/skills/cfn-loop-validation/dist/types.js +66 -0
  121. package/.claude/skills/cfn-loop-validation/dist/types.js.map +1 -0
  122. package/.claude/skills/cfn-loop-validation/dist/validator.d.ts +85 -0
  123. package/.claude/skills/cfn-loop-validation/dist/validator.d.ts.map +1 -0
  124. package/.claude/skills/cfn-loop-validation/dist/validator.js +411 -0
  125. package/.claude/skills/cfn-loop-validation/dist/validator.js.map +1 -0
  126. package/.claude/skills/cfn-loop-validation/orchestrate-cfn-loop.sh +22 -0
  127. package/.claude/skills/cfn-loop-validation/orchestrate-cfn-loop.sh.backup +252 -0
  128. package/.claude/skills/cfn-loop-validation/package.json +93 -0
  129. package/.claude/skills/cfn-loop-validation/src/cli/detect-vapor.ts +177 -0
  130. package/.claude/skills/cfn-loop-validation/src/cli/validate-deliverables.ts +161 -0
  131. package/.claude/skills/cfn-loop-validation/src/cli/validate-gate.ts +139 -0
  132. package/.claude/skills/cfn-loop-validation/src/types.ts +215 -0
  133. package/.claude/skills/cfn-loop-validation/src/validator.ts +503 -0
  134. package/.claude/skills/cfn-loop-validation/tests/validator.test.ts +537 -0
  135. package/.claude/skills/{cfn-redis-coordination → cfn-loop-validation}/tsconfig.json +34 -31
  136. package/.claude/skills/cfn-loop-validation/validate-deliverables.sh +59 -0
  137. package/.claude/skills/cfn-loop-validation/validate-deliverables.sh.backup +37 -0
  138. package/.claude/skills/cfn-loop-validation/validate-gate.sh +63 -0
  139. package/.claude/skills/cfn-loop-validation/validate-gate.sh.backup +41 -0
  140. package/.claude/skills/cfn-loop-validation/validate-iteration.sh +22 -0
  141. package/.claude/skills/cfn-loop-validation/validate-iteration.sh.backup +134 -0
  142. package/.claude/skills/cfn-product-owner-decision/SKILL.md +479 -147
  143. package/.claude/skills/cfn-product-owner-decision/TYPESCRIPT_IMPLEMENTATION.md +653 -0
  144. package/{claude-assets/skills/cfn-product-owner-decision → .claude/skills/cfn-product-owner-decision/archive/legacy-bash}/execute-decision.sh +24 -2
  145. package/.claude/skills/pre-edit-backup/SKILL.md +324 -0
  146. package/.claude/skills/pre-edit-backup/SKILL.md.backup +277 -0
  147. package/.claude/skills/pre-edit-backup/backup.sh +22 -0
  148. package/.claude/skills/pre-edit-backup/backup.sh.backup +107 -0
  149. package/claude-assets/agents/cfn-dev-team/CLAUDE.md +9 -81
  150. package/claude-assets/agents/cfn-dev-team/architecture/base-template-generator.md +4 -4
  151. package/claude-assets/agents/cfn-dev-team/architecture/planner.md +4 -4
  152. package/claude-assets/agents/cfn-dev-team/architecture/system-architect.md +5 -5
  153. package/claude-assets/agents/cfn-dev-team/coordinators/cfn-frontend-coordinator.md +1 -0
  154. package/claude-assets/agents/cfn-dev-team/coordinators/consensus-builder.md +1 -0
  155. package/claude-assets/agents/cfn-dev-team/coordinators/handoff-coordinator.md +1 -0
  156. package/claude-assets/agents/cfn-dev-team/coordinators/multi-sprint-coordinator.md +1 -0
  157. package/claude-assets/agents/cfn-dev-team/dev-ops/devops-engineer.md +14 -4
  158. package/claude-assets/agents/cfn-dev-team/dev-ops/docker-specialist.md +63 -70
  159. package/claude-assets/agents/cfn-dev-team/dev-ops/kubernetes-specialist.md +50 -70
  160. package/claude-assets/agents/cfn-dev-team/dev-ops/monitoring-specialist.md +13 -4
  161. package/claude-assets/agents/cfn-dev-team/developers/api-gateway-specialist.md +27 -58
  162. package/claude-assets/agents/cfn-dev-team/developers/backend-developer.md +40 -58
  163. package/claude-assets/agents/cfn-dev-team/developers/data/data-engineer.md +18 -20
  164. package/claude-assets/agents/cfn-dev-team/developers/database/database-architect.md +19 -28
  165. package/claude-assets/agents/cfn-dev-team/developers/frontend/mobile-dev.md +15 -19
  166. package/claude-assets/agents/cfn-dev-team/developers/frontend/react-frontend-engineer.md +15 -10
  167. package/claude-assets/agents/cfn-dev-team/developers/frontend/typescript-specialist.md +15 -10
  168. package/claude-assets/agents/cfn-dev-team/developers/frontend/ui-designer.md +15 -25
  169. package/claude-assets/agents/cfn-dev-team/developers/graphql-specialist.md +17 -21
  170. package/claude-assets/agents/cfn-dev-team/developers/rust-developer.md +17 -21
  171. package/claude-assets/agents/cfn-dev-team/product-owners/accessibility-advocate-persona.md +4 -4
  172. package/claude-assets/agents/cfn-dev-team/product-owners/cto-agent.md +4 -4
  173. package/claude-assets/agents/cfn-dev-team/product-owners/power-user-persona.md +4 -4
  174. package/claude-assets/agents/cfn-dev-team/product-owners/product-owner.md +19 -27
  175. package/claude-assets/agents/cfn-dev-team/reviewers/code-reviewer.md +20 -51
  176. package/claude-assets/agents/cfn-dev-team/reviewers/quality/code-quality-validator.md +22 -71
  177. package/claude-assets/agents/cfn-dev-team/reviewers/quality/perf-analyzer.md +21 -64
  178. package/claude-assets/agents/cfn-dev-team/reviewers/quality/performance-benchmarker.md +22 -67
  179. package/claude-assets/agents/cfn-dev-team/reviewers/quality/security-specialist.md +23 -67
  180. package/claude-assets/agents/cfn-dev-team/testers/api-testing-specialist.md +14 -70
  181. package/claude-assets/agents/cfn-dev-team/testers/chaos-engineering-specialist.md +25 -73
  182. package/claude-assets/agents/cfn-dev-team/testers/contract-tester.md +26 -65
  183. package/claude-assets/agents/cfn-dev-team/testers/e2e/playwright-tester.md +5 -5
  184. package/claude-assets/agents/cfn-dev-team/testers/integration-tester.md +27 -67
  185. package/claude-assets/agents/cfn-dev-team/testers/interaction-tester.md +16 -73
  186. package/claude-assets/agents/cfn-dev-team/testers/load-testing-specialist.md +27 -67
  187. package/claude-assets/agents/cfn-dev-team/testers/mutation-testing-specialist.md +27 -60
  188. package/claude-assets/agents/cfn-dev-team/testers/playwright-tester.md +15 -74
  189. package/claude-assets/agents/cfn-dev-team/testers/tester.md +14 -60
  190. package/claude-assets/agents/cfn-dev-team/testers/unit/tdd-london-unit-swarm.md +5 -5
  191. package/claude-assets/agents/cfn-dev-team/testers/validation/validation-production-validator.md +4 -4
  192. package/claude-assets/agents/cfn-dev-team/testing/test-validation-agent.md +4 -4
  193. package/claude-assets/agents/cfn-dev-team/utility/agent-builder.md +16 -16
  194. package/claude-assets/agents/cfn-dev-team/utility/analyst.md +16 -32
  195. package/claude-assets/agents/cfn-dev-team/utility/code-booster.md +17 -17
  196. package/claude-assets/agents/cfn-dev-team/utility/context-curator.md +10 -5
  197. package/claude-assets/agents/cfn-dev-team/utility/epic-creator.md +12 -102
  198. package/claude-assets/agents/cfn-dev-team/utility/memory-leak-specialist.md +127 -814
  199. package/claude-assets/agents/cfn-dev-team/utility/researcher.md +16 -25
  200. package/claude-assets/agents/cfn-dev-team/utility/z-ai-specialist.md +157 -667
  201. package/claude-assets/agents/custom/cfn-docker-expert.md +102 -0
  202. package/claude-assets/agents/custom/cfn-loops-cli-expert.md +129 -0
  203. package/claude-assets/cfn-extras/agents/cfn-v3-coordinator.md +517 -0
  204. package/claude-assets/commands/cfn-loop-cli.md +158 -464
  205. package/claude-assets/commands/cfn-loop-trigger.md +114 -0
  206. package/claude-assets/hooks/SKILL.md +518 -0
  207. package/claude-assets/hooks/SKILL.md.backup +471 -0
  208. package/claude-assets/hooks/cfn-invoke-post-edit-ts.sh +100 -0
  209. package/claude-assets/hooks/cfn-invoke-post-edit-ts.sh.backup +78 -0
  210. package/claude-assets/hooks/cfn-invoke-post-edit.sh +22 -0
  211. package/claude-assets/hooks/cfn-invoke-post-edit.sh.backup +87 -0
  212. package/claude-assets/hooks/cfn-invoke-pre-edit-ts.sh +116 -0
  213. package/claude-assets/hooks/cfn-invoke-pre-edit-ts.sh.backup +94 -0
  214. package/claude-assets/hooks/cfn-invoke-pre-edit.sh +22 -0
  215. package/claude-assets/hooks/cfn-invoke-pre-edit.sh.backup +88 -0
  216. package/claude-assets/skills/cfn-agent-selection-with-fallback/DELIVERABLES.md +409 -0
  217. package/claude-assets/skills/cfn-agent-selection-with-fallback/IMPLEMENTATION_SUMMARY.md +396 -0
  218. package/claude-assets/skills/cfn-agent-selection-with-fallback/INTEGRATION_GUIDE.md +308 -0
  219. package/claude-assets/skills/cfn-agent-selection-with-fallback/QUICK_REFERENCE.md +239 -0
  220. package/claude-assets/skills/cfn-agent-selection-with-fallback/SKILL.md +107 -1
  221. package/claude-assets/skills/cfn-agent-selection-with-fallback/SKILL.md.backup +302 -0
  222. package/claude-assets/skills/cfn-agent-selection-with-fallback/TYPESCRIPT_MIGRATION.md +295 -0
  223. package/claude-assets/skills/cfn-agent-selection-with-fallback/dist/agent-selector.cjs +297 -0
  224. package/claude-assets/skills/cfn-agent-selection-with-fallback/dist/agent-selector.js +297 -0
  225. package/claude-assets/skills/cfn-agent-selection-with-fallback/dist/cli.cjs +96 -0
  226. package/claude-assets/skills/cfn-agent-selection-with-fallback/dist/cli.js +96 -0
  227. package/claude-assets/skills/cfn-agent-selection-with-fallback/select-agents-ts.sh +45 -0
  228. package/claude-assets/skills/cfn-agent-selection-with-fallback/select-agents-ts.sh.backup +23 -0
  229. package/claude-assets/skills/cfn-agent-selection-with-fallback/select-agents.sh +22 -0
  230. package/claude-assets/skills/cfn-agent-selection-with-fallback/select-agents.sh.backup +173 -0
  231. package/claude-assets/skills/cfn-agent-selection-with-fallback/src/agent-selector.test.ts +357 -0
  232. package/claude-assets/skills/cfn-agent-selection-with-fallback/src/agent-selector.ts +350 -0
  233. package/claude-assets/skills/cfn-agent-selection-with-fallback/src/cli.ts +74 -0
  234. package/claude-assets/skills/cfn-agent-selection-with-fallback/task-classifier.sh +22 -0
  235. package/claude-assets/skills/cfn-agent-selection-with-fallback/task-classifier.sh.backup +71 -0
  236. package/claude-assets/skills/cfn-agent-selection-with-fallback/tsconfig.json +18 -0
  237. package/claude-assets/skills/cfn-agent-spawning/SKILL.md +48 -1
  238. package/claude-assets/skills/cfn-agent-spawning/SKILL.md.backup +135 -0
  239. package/claude-assets/skills/cfn-agent-spawning/TYPESCRIPT_MIGRATION.md +567 -0
  240. package/claude-assets/skills/cfn-agent-spawning/check-dependencies.sh +22 -0
  241. package/claude-assets/skills/cfn-agent-spawning/check-dependencies.sh.backup +30 -0
  242. package/claude-assets/skills/cfn-agent-spawning/get-agent-provider-env.sh +22 -0
  243. package/claude-assets/skills/cfn-agent-spawning/get-agent-provider-env.sh.backup +127 -0
  244. package/claude-assets/skills/cfn-agent-spawning/parse-agent-provider.sh +22 -0
  245. package/claude-assets/skills/cfn-agent-spawning/parse-agent-provider.sh.backup +59 -0
  246. package/claude-assets/skills/cfn-agent-spawning/spawn-agent-wrapper.sh +63 -0
  247. package/claude-assets/skills/cfn-agent-spawning/spawn-agent-wrapper.sh.backup +41 -0
  248. package/claude-assets/skills/cfn-agent-spawning/spawn-agent.sh +26 -1
  249. package/claude-assets/skills/cfn-agent-spawning/spawn-templates.sh +22 -0
  250. package/claude-assets/skills/cfn-agent-spawning/spawn-templates.sh.backup +613 -0
  251. package/claude-assets/skills/cfn-agent-spawning/spawn-worker.sh +22 -0
  252. package/claude-assets/skills/cfn-agent-spawning/spawn-worker.sh.backup +176 -0
  253. package/claude-assets/skills/cfn-coordination/agent-completion.sh.backup +36 -0
  254. package/claude-assets/skills/cfn-coordination/coordination-signal.sh.backup +36 -0
  255. package/claude-assets/skills/cfn-coordination/coordination-wait.sh.backup +36 -0
  256. package/claude-assets/skills/cfn-dependency-ingestion/README.md +101 -0
  257. package/claude-assets/skills/cfn-dependency-ingestion/SKILL.md +369 -0
  258. package/claude-assets/skills/cfn-dependency-ingestion/build.sh +23 -0
  259. package/claude-assets/skills/cfn-dependency-ingestion/dist/ingest-dependencies.js +478 -0
  260. package/claude-assets/skills/cfn-dependency-ingestion/ingest-dependencies.sh +295 -0
  261. package/claude-assets/skills/cfn-dependency-ingestion/src/ingest-dependencies.ts +563 -0
  262. package/claude-assets/skills/cfn-loop-orchestration/.backups/unknown/1763619700_33aff4a69b99159e4e849107ebc4d09f/metadata.json +8 -0
  263. package/claude-assets/skills/cfn-loop-orchestration/.backups/unknown/1763619700_33aff4a69b99159e4e849107ebc4d09f/original +271 -0
  264. package/claude-assets/skills/cfn-loop-orchestration/.backups/unknown/1763619700_33aff4a69b99159e4e849107ebc4d09f/revert.sh +7 -0
  265. package/claude-assets/skills/cfn-loop-orchestration/.backups/unknown/1763671642_06496e8c399a79db08167cc00ed4b31e/metadata.json +8 -0
  266. package/claude-assets/skills/cfn-loop-orchestration/.backups/unknown/1763671642_06496e8c399a79db08167cc00ed4b31e/original +325 -0
  267. package/claude-assets/skills/cfn-loop-orchestration/.backups/unknown/1763671642_06496e8c399a79db08167cc00ed4b31e/revert.sh +7 -0
  268. package/claude-assets/skills/cfn-loop-orchestration/CLI_IMPLEMENTATION_SUMMARY.md +330 -0
  269. package/claude-assets/skills/cfn-loop-orchestration/CONFIGURATION_IMPROVEMENTS.md +318 -0
  270. package/claude-assets/skills/cfn-loop-orchestration/CONTEXT_LOOKUP_MIGRATION.md +308 -0
  271. package/claude-assets/skills/cfn-loop-orchestration/CONTEXT_LOOKUP_QUICK_START.md +378 -0
  272. package/claude-assets/skills/cfn-loop-orchestration/E2E_VALIDATION_REPORT.md +262 -0
  273. package/claude-assets/skills/cfn-loop-orchestration/IMPLEMENTATION_SUMMARY.md +319 -519
  274. package/claude-assets/skills/cfn-loop-orchestration/NORTH_STAR_E2E_REPORT.md +299 -0
  275. package/claude-assets/skills/cfn-loop-orchestration/NORTH_STAR_EXECUTION_SUMMARY.md +403 -0
  276. package/claude-assets/skills/cfn-loop-orchestration/NORTH_STAR_INDEX.md +323 -0
  277. package/claude-assets/skills/cfn-loop-orchestration/SKILL.md +159 -48
  278. package/claude-assets/skills/cfn-loop-orchestration/SPAWN_AGENTS_IMPLEMENTATION.md +188 -0
  279. package/claude-assets/skills/cfn-loop-orchestration/TEST_COVERAGE_REPORT.md +335 -0
  280. package/claude-assets/skills/cfn-loop-orchestration/TEST_COVERAGE_SUMMARY.md +456 -0
  281. package/claude-assets/skills/cfn-loop-orchestration/TYPESCRIPT_INTEGRATION_REPORT.md +709 -0
  282. package/claude-assets/skills/cfn-loop-orchestration/TYPESCRIPT_INTEGRATION_SUMMARY.md +257 -0
  283. package/claude-assets/skills/cfn-loop-orchestration/VALIDATION_REPORT.md +572 -0
  284. package/claude-assets/skills/cfn-loop-orchestration/VALIDATION_SUMMARY.txt +196 -0
  285. package/claude-assets/skills/cfn-loop-orchestration/VALIDATOR_MODULE_GUIDE.md +526 -0
  286. package/claude-assets/skills/cfn-loop-orchestration/archive/legacy-bash/README.md +167 -0
  287. package/claude-assets/skills/cfn-loop-orchestration/archive/legacy-bash/orchestrate-enhanced.sh +548 -0
  288. package/{.claude/skills/cfn-loop-orchestration → claude-assets/skills/cfn-loop-orchestration/archive/legacy-bash}/orchestrate-wrapper.sh +11 -1
  289. package/claude-assets/skills/cfn-loop-orchestration/archive/legacy-bash/orchestrate.sh +182 -0
  290. package/claude-assets/skills/cfn-loop-orchestration/e2e-validation-fixed.js +240 -0
  291. package/claude-assets/skills/cfn-loop-orchestration/e2e-validation.js +213 -0
  292. package/claude-assets/skills/cfn-loop-orchestration/package-lock.json +3 -0
  293. package/claude-assets/skills/cfn-loop-orchestration/package.json +4 -0
  294. package/claude-assets/skills/cfn-loop-orchestration/run-north-star-e2e.ts +210 -0
  295. package/claude-assets/skills/cfn-loop-orchestration/src/cli/orchestrator-cli.ts +396 -0
  296. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/CONFIDENCE_AGGREGATOR.md +564 -0
  297. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/CONFIDENCE_AGGREGATOR_QUICK_REF.md +241 -0
  298. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_IMPLEMENTATION.md +375 -0
  299. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_QUICK_REFERENCE.md +362 -0
  300. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_README.md +307 -0
  301. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_USAGE_GUIDE.md +508 -0
  302. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/confidence-aggregator.ts +473 -0
  303. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/consensus.ts +1 -1
  304. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/context-injector.ts +349 -0
  305. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/context-lookup.ts +486 -0
  306. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/deliverable-verifier.ts +6 -2
  307. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/gate-check.ts +1 -1
  308. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/product-owner-decision.ts +316 -0
  309. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/spawn-agents.ts +357 -0
  310. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/validator.ts +276 -0
  311. package/claude-assets/skills/cfn-loop-orchestration/src/index.ts +2 -0
  312. package/claude-assets/skills/cfn-loop-orchestration/src/orchestrate.ts +743 -2
  313. package/claude-assets/skills/cfn-loop-orchestration/src/types.ts +56 -0
  314. package/claude-assets/skills/cfn-loop-orchestration/test-cli.sh +92 -0
  315. package/claude-assets/skills/cfn-loop-orchestration/test-typescript-integration.sh +442 -0
  316. package/claude-assets/skills/cfn-loop-orchestration/tests/agent-spawner.test.ts +124 -0
  317. package/claude-assets/skills/cfn-loop-orchestration/tests/confidence-aggregator.test.ts +604 -0
  318. package/claude-assets/skills/cfn-loop-orchestration/tests/context-injector.test.ts +561 -0
  319. package/claude-assets/skills/cfn-loop-orchestration/tests/context-lookup.test.ts +661 -0
  320. package/claude-assets/skills/cfn-loop-orchestration/tests/deliverable-verifier.test.ts +2 -2
  321. package/claude-assets/skills/cfn-loop-orchestration/tests/gate-check-edge-cases.test.ts +422 -0
  322. package/claude-assets/skills/cfn-loop-orchestration/tests/gate-checker.test.ts +276 -0
  323. package/claude-assets/skills/cfn-loop-orchestration/tests/logger.test.ts +291 -0
  324. package/claude-assets/skills/cfn-loop-orchestration/tests/north-star-e2e.test.ts +334 -0
  325. package/claude-assets/skills/cfn-loop-orchestration/tests/redis-coordinator.test.ts +321 -0
  326. package/claude-assets/skills/cfn-loop-orchestration/tests/spawn-agents.test.ts +284 -0
  327. package/claude-assets/skills/cfn-loop-orchestration/tests/validator.test.ts +643 -0
  328. package/claude-assets/skills/cfn-loop-output-processing/.eslintrc.json +33 -0
  329. package/claude-assets/skills/cfn-loop-output-processing/DELIVERY_SUMMARY.txt +462 -0
  330. package/claude-assets/skills/cfn-loop-output-processing/DEPRECATION_NOTICE.md +183 -0
  331. package/claude-assets/skills/cfn-loop-output-processing/EXAMPLES.md +609 -0
  332. package/claude-assets/skills/cfn-loop-output-processing/IMPLEMENTATION_SUMMARY.md +418 -0
  333. package/claude-assets/skills/cfn-loop-output-processing/INDEX.md +531 -0
  334. package/claude-assets/skills/cfn-loop-output-processing/MIGRATION.md +362 -0
  335. package/claude-assets/skills/cfn-loop-output-processing/README.md +114 -0
  336. package/claude-assets/skills/cfn-loop-output-processing/SKILL.md +633 -0
  337. package/{.claude/skills/cfn-docker-redis-coordination → claude-assets/skills/cfn-loop-output-processing}/jest.config.js +7 -15
  338. package/claude-assets/skills/cfn-loop-output-processing/package.json +50 -0
  339. package/claude-assets/skills/cfn-loop-output-processing/src/cli/process-loop2.ts +195 -0
  340. package/claude-assets/skills/cfn-loop-output-processing/src/cli/process-loop3.ts +157 -0
  341. package/claude-assets/skills/cfn-loop-output-processing/src/output-processor.ts +632 -0
  342. package/claude-assets/skills/cfn-loop-output-processing/tests/output-processor.test.ts +617 -0
  343. package/claude-assets/skills/{cfn-docker-redis-coordination → cfn-loop-output-processing}/tsconfig.json +16 -7
  344. package/claude-assets/skills/cfn-loop-validation/IMPLEMENTATION_SUMMARY.md +672 -0
  345. package/claude-assets/skills/cfn-loop-validation/INDEX.md +531 -0
  346. package/claude-assets/skills/cfn-loop-validation/README_TYPESCRIPT.md +454 -0
  347. package/claude-assets/skills/cfn-loop-validation/SKILL.md +48 -1
  348. package/claude-assets/skills/cfn-loop-validation/SKILL.md.backup +353 -0
  349. package/claude-assets/skills/cfn-loop-validation/SKILL_TYPESCRIPT.md +782 -0
  350. package/claude-assets/skills/cfn-loop-validation/VAPOR_DETECTION_EXAMPLES.md +598 -0
  351. package/claude-assets/skills/cfn-loop-validation/check-dependencies.sh +22 -0
  352. package/claude-assets/skills/cfn-loop-validation/check-dependencies.sh.backup +31 -0
  353. package/claude-assets/skills/cfn-loop-validation/detect-vapor.sh +59 -0
  354. package/claude-assets/skills/cfn-loop-validation/detect-vapor.sh.backup +37 -0
  355. package/claude-assets/skills/cfn-loop-validation/dist/.tsbuildinfo +1 -0
  356. package/claude-assets/skills/cfn-loop-validation/dist/cli/detect-vapor.d.ts +14 -0
  357. package/claude-assets/skills/cfn-loop-validation/dist/cli/detect-vapor.d.ts.map +1 -0
  358. package/claude-assets/skills/cfn-loop-validation/dist/cli/detect-vapor.js +185 -0
  359. package/claude-assets/skills/cfn-loop-validation/dist/cli/detect-vapor.js.map +1 -0
  360. package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-deliverables.d.ts +14 -0
  361. package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-deliverables.d.ts.map +1 -0
  362. package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-deliverables.js +176 -0
  363. package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-deliverables.js.map +1 -0
  364. package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-gate.d.ts +19 -0
  365. package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-gate.d.ts.map +1 -0
  366. package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-gate.js +123 -0
  367. package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-gate.js.map +1 -0
  368. package/claude-assets/skills/cfn-loop-validation/dist/types.d.ts +156 -0
  369. package/claude-assets/skills/cfn-loop-validation/dist/types.d.ts.map +1 -0
  370. package/claude-assets/skills/cfn-loop-validation/dist/types.js +66 -0
  371. package/claude-assets/skills/cfn-loop-validation/dist/types.js.map +1 -0
  372. package/claude-assets/skills/cfn-loop-validation/dist/validator.d.ts +85 -0
  373. package/claude-assets/skills/cfn-loop-validation/dist/validator.d.ts.map +1 -0
  374. package/claude-assets/skills/cfn-loop-validation/dist/validator.js +411 -0
  375. package/claude-assets/skills/cfn-loop-validation/dist/validator.js.map +1 -0
  376. package/claude-assets/skills/cfn-loop-validation/orchestrate-cfn-loop.sh +22 -0
  377. package/claude-assets/skills/cfn-loop-validation/orchestrate-cfn-loop.sh.backup +252 -0
  378. package/claude-assets/skills/cfn-loop-validation/package.json +93 -0
  379. package/claude-assets/skills/cfn-loop-validation/src/cli/detect-vapor.ts +177 -0
  380. package/claude-assets/skills/cfn-loop-validation/src/cli/validate-deliverables.ts +161 -0
  381. package/claude-assets/skills/cfn-loop-validation/src/cli/validate-gate.ts +139 -0
  382. package/claude-assets/skills/cfn-loop-validation/src/types.ts +215 -0
  383. package/claude-assets/skills/cfn-loop-validation/src/validator.ts +503 -0
  384. package/claude-assets/skills/cfn-loop-validation/tests/validator.test.ts +537 -0
  385. package/claude-assets/skills/{cfn-redis-coordination → cfn-loop-validation}/tsconfig.json +34 -31
  386. package/claude-assets/skills/cfn-loop-validation/validate-deliverables.sh +59 -0
  387. package/claude-assets/skills/cfn-loop-validation/validate-deliverables.sh.backup +37 -0
  388. package/claude-assets/skills/cfn-loop-validation/validate-gate.sh +63 -0
  389. package/claude-assets/skills/cfn-loop-validation/validate-gate.sh.backup +41 -0
  390. package/claude-assets/skills/cfn-loop-validation/validate-iteration.sh +22 -0
  391. package/claude-assets/skills/cfn-loop-validation/validate-iteration.sh.backup +134 -0
  392. package/claude-assets/skills/cfn-product-owner-decision/SKILL.md +479 -147
  393. package/claude-assets/skills/cfn-product-owner-decision/TYPESCRIPT_IMPLEMENTATION.md +653 -0
  394. package/{.claude/skills/cfn-product-owner-decision → claude-assets/skills/cfn-product-owner-decision/archive/legacy-bash}/execute-decision.sh +24 -2
  395. package/claude-assets/skills/cfn-provider-routing/README.md +129 -0
  396. package/claude-assets/skills/cfn-provider-routing/SKILL.md +192 -0
  397. package/claude-assets/skills/cfn-provider-routing/resolve-provider-model.ts +223 -0
  398. package/claude-assets/skills/pre-edit-backup/SKILL.md +324 -0
  399. package/claude-assets/skills/pre-edit-backup/SKILL.md.backup +277 -0
  400. package/claude-assets/skills/pre-edit-backup/backup.sh +22 -0
  401. package/claude-assets/skills/pre-edit-backup/backup.sh.backup +107 -0
  402. package/dist/agents/agent-loader.js +146 -165
  403. package/dist/agents/agent-loader.js.map +1 -1
  404. package/dist/api/auth-endpoints.js +415 -0
  405. package/dist/api/auth-endpoints.js.map +1 -0
  406. package/dist/api/task-endpoints.js +562 -0
  407. package/dist/api/task-endpoints.js.map +1 -0
  408. package/dist/backend/server.js +418 -0
  409. package/dist/backend/server.js.map +1 -0
  410. package/dist/cfn-loop/product-owner/decision-parser.js +356 -0
  411. package/dist/cfn-loop/product-owner/decision-parser.js.map +1 -0
  412. package/dist/cfn-loop/product-owner/index.js +1 -0
  413. package/dist/cfn-loop/product-owner/index.js.map +1 -1
  414. package/dist/cli/agent-command.js +1 -1
  415. package/dist/cli/agent-command.js.map +1 -1
  416. package/dist/cli/agent-completion.js +273 -0
  417. package/dist/cli/agent-completion.js.map +1 -0
  418. package/dist/cli/agent-definition-parser.js +37 -4
  419. package/dist/cli/agent-definition-parser.js.map +1 -1
  420. package/dist/cli/agent-executor.js +32 -2
  421. package/dist/cli/agent-executor.js.map +1 -1
  422. package/dist/cli/agent-prompt-builder.js +83 -48
  423. package/dist/cli/agent-prompt-builder.js.map +1 -1
  424. package/dist/cli/agent-spawner.js +499 -0
  425. package/dist/cli/agent-spawner.js.map +1 -0
  426. package/dist/cli/anthropic-client.js +10 -3
  427. package/dist/cli/anthropic-client.js.map +1 -1
  428. package/dist/cli/config-manager.js.map +1 -1
  429. package/dist/cli/index.js +11 -0
  430. package/dist/cli/index.js.map +1 -1
  431. package/dist/cli/parse-decision-cli.js +268 -0
  432. package/dist/cli/parse-decision-cli.js.map +1 -0
  433. package/dist/cli/post-edit-hook.js +83 -0
  434. package/dist/cli/post-edit-hook.js.map +1 -0
  435. package/dist/cli/pre-edit-hook.js +77 -0
  436. package/dist/cli/pre-edit-hook.js.map +1 -0
  437. package/dist/cli/spawn-agent-cli.js +209 -0
  438. package/dist/cli/spawn-agent-cli.js.map +1 -0
  439. package/dist/coordination/coordination-wrapper.js +383 -0
  440. package/dist/coordination/coordination-wrapper.js.map +1 -0
  441. package/dist/coordination/store-success-criteria.js +68 -0
  442. package/dist/coordination/store-success-criteria.js.map +1 -0
  443. package/dist/coordination/store-task-context.js +65 -0
  444. package/dist/coordination/store-task-context.js.map +1 -0
  445. package/dist/hooks/backup-manager.js +273 -0
  446. package/dist/hooks/backup-manager.js.map +1 -0
  447. package/dist/hooks/post-edit-validator.js +388 -0
  448. package/dist/hooks/post-edit-validator.js.map +1 -0
  449. package/dist/integration/index.js +19 -0
  450. package/dist/integration/index.js.map +1 -0
  451. package/dist/integration/task-mode-adapter.js +297 -0
  452. package/dist/integration/task-mode-adapter.js.map +1 -0
  453. package/dist/integration/trigger-dev-client.js +253 -0
  454. package/dist/integration/trigger-dev-client.js.map +1 -0
  455. package/dist/integration/trigger-dev-webhooks.js +362 -0
  456. package/dist/integration/trigger-dev-webhooks.js.map +1 -0
  457. package/dist/lib/path-validator.js +14 -5
  458. package/dist/lib/path-validator.js.map +1 -1
  459. package/dist/lib/redis-queue-manager.js +5 -1
  460. package/dist/lib/redis-queue-manager.js.map +1 -1
  461. package/dist/middleware/authentication.js +317 -0
  462. package/dist/middleware/authentication.js.map +1 -0
  463. package/dist/services/authentication.js +669 -0
  464. package/dist/services/authentication.js.map +1 -0
  465. package/dist/services/session-management.js +436 -0
  466. package/dist/services/session-management.js.map +1 -0
  467. package/dist/services/skill-deployment.js +8 -6
  468. package/dist/services/skill-deployment.js.map +1 -1
  469. package/dist/services/user-service.js +710 -0
  470. package/dist/services/user-service.js.map +1 -0
  471. package/dist/types/trigger-dev-events.d.js +10 -0
  472. package/dist/types/trigger-dev-events.d.js.map +1 -0
  473. package/docs/README.md +240 -0
  474. package/package.json +13 -4
  475. package/scripts/compare-workflow-performance.sh +556 -0
  476. package/scripts/migrate-to-optimized-workflows.sh +438 -0
  477. package/scripts/organize-docs.sh +338 -0
  478. package/scripts/trigger-dev-setup.sh +267 -0
  479. package/.claude/skills/cfn-docker-redis-coordination/MIGRATION_SUMMARY.md +0 -348
  480. package/.claude/skills/cfn-docker-redis-coordination/README.md +0 -294
  481. package/.claude/skills/cfn-docker-redis-coordination/SKILL.md +0 -435
  482. package/.claude/skills/cfn-docker-redis-coordination/coordinate.sh +0 -650
  483. package/.claude/skills/cfn-docker-redis-coordination/coordinate.sh.backup-1763145142 +0 -641
  484. package/.claude/skills/cfn-docker-redis-coordination/package-lock.json +0 -5259
  485. package/.claude/skills/cfn-docker-redis-coordination/package.json +0 -40
  486. package/.claude/skills/cfn-docker-redis-coordination/src/coordinator.ts +0 -801
  487. package/.claude/skills/cfn-docker-redis-coordination/src/index.ts +0 -42
  488. package/.claude/skills/cfn-docker-redis-coordination/src/types.ts +0 -351
  489. package/.claude/skills/cfn-docker-redis-coordination/tests/coordinator.test.ts +0 -1464
  490. package/.claude/skills/cfn-docker-redis-coordination/tsconfig.json +0 -30
  491. package/.claude/skills/cfn-loop-orchestration/helpers/auto-tune-timeouts.sh +0 -228
  492. package/.claude/skills/cfn-loop-orchestration/helpers/consensus-ts.sh +0 -104
  493. package/.claude/skills/cfn-loop-orchestration/helpers/consensus.sh +0 -94
  494. package/.claude/skills/cfn-loop-orchestration/helpers/context-injection.sh +0 -142
  495. package/.claude/skills/cfn-loop-orchestration/helpers/context-lookup.sh +0 -359
  496. package/.claude/skills/cfn-loop-orchestration/helpers/deliverable-verifier-ts.sh +0 -123
  497. package/.claude/skills/cfn-loop-orchestration/helpers/deliverable-verifier.sh +0 -71
  498. package/.claude/skills/cfn-loop-orchestration/helpers/gate-check.sh +0 -56
  499. package/.claude/skills/cfn-loop-orchestration/helpers/iteration-manager-ts.sh +0 -89
  500. package/.claude/skills/cfn-loop-orchestration/helpers/iteration-manager.sh +0 -87
  501. package/.claude/skills/cfn-loop-orchestration/helpers/orchestrate-ts.sh +0 -104
  502. package/.claude/skills/cfn-loop-orchestration/helpers/parse-test-results.sh +0 -56
  503. package/.claude/skills/cfn-loop-orchestration/helpers/spawn-agents.sh +0 -290
  504. package/.claude/skills/cfn-loop-orchestration/helpers/timeout-calculator-ts.sh +0 -47
  505. package/.claude/skills/cfn-loop-orchestration/helpers/timeout-calculator.sh +0 -51
  506. package/.claude/skills/cfn-loop-orchestration/orchestrate.sh +0 -1345
  507. package/.claude/skills/cfn-redis-coordination/AGENT_LOGGING.md +0 -280
  508. package/.claude/skills/cfn-redis-coordination/BZPOPMIN_FIX_SUMMARY.md +0 -209
  509. package/.claude/skills/cfn-redis-coordination/CENTRALIZED_REDIS_WRAPPER.md +0 -319
  510. package/.claude/skills/cfn-redis-coordination/agent-log.sh.bak +0 -124
  511. package/.claude/skills/cfn-redis-coordination/config.json +0 -61
  512. package/.claude/skills/cfn-redis-coordination/demos/phase4-wake-queue-test-report.md +0 -82
  513. package/.claude/skills/cfn-redis-coordination/demos/test-bzpopmin-fix.sh +0 -274
  514. package/.claude/skills/cfn-redis-coordination/demos/test-cancel-swarm.sh +0 -0
  515. package/.claude/skills/cfn-redis-coordination/docs/migration/PHASE_3_REDIS_COORDINATION_COMPLETION_REPORT.md +0 -553
  516. package/.claude/skills/cfn-redis-coordination/jest.config.js +0 -23
  517. package/.claude/skills/cfn-redis-coordination/package-lock.json +0 -5272
  518. package/.claude/skills/cfn-redis-coordination/package.json +0 -45
  519. package/.claude/skills/cfn-redis-coordination/src/agent-logger.ts +0 -446
  520. package/.claude/skills/cfn-redis-coordination/src/agent-recovery.ts +0 -454
  521. package/.claude/skills/cfn-redis-coordination/src/completion-reporter.ts +0 -396
  522. package/.claude/skills/cfn-redis-coordination/src/context-manager.ts +0 -327
  523. package/.claude/skills/cfn-redis-coordination/src/index.ts +0 -82
  524. package/.claude/skills/cfn-redis-coordination/src/mode-detector.ts +0 -155
  525. package/.claude/skills/cfn-redis-coordination/src/redis/redis-client.ts +0 -305
  526. package/.claude/skills/cfn-redis-coordination/src/redis/redis-functions.ts +0 -283
  527. package/.claude/skills/cfn-redis-coordination/src/redis-client.ts +0 -654
  528. package/.claude/skills/cfn-redis-coordination/src/result-collector.ts +0 -437
  529. package/.claude/skills/cfn-redis-coordination/src/swarm-manager.ts +0 -494
  530. package/.claude/skills/cfn-redis-coordination/src/task-analyzer.ts +0 -404
  531. package/.claude/skills/cfn-redis-coordination/src/task-executor.ts +0 -423
  532. package/.claude/skills/cfn-redis-coordination/src/types.ts +0 -235
  533. package/.claude/skills/cfn-redis-coordination/src/waiting-coordinator.ts +0 -587
  534. package/.claude/skills/cfn-redis-coordination/store-success-criteria.sh +0 -85
  535. package/.claude/skills/cfn-redis-coordination/test-connection-attempts.js +0 -70
  536. package/.claude/skills/cfn-redis-coordination/test-mode-simple.js +0 -121
  537. package/.claude/skills/cfn-redis-coordination/test-redis-check.js +0 -84
  538. package/.claude/skills/cfn-redis-coordination/test-task-mode-redis.cjs +0 -391
  539. package/.claude/skills/cfn-redis-coordination/tests/coordination.test.ts +0 -788
  540. package/.claude/skills/cfn-redis-coordination/update-all-scripts.sh +0 -67
  541. package/claude-assets/agents/cfn-dev-team/coordinators/cfn-v3-coordinator.md +0 -976
  542. package/claude-assets/agents/typescript-specialist.md +0 -280
  543. package/claude-assets/skills/cfn-docker-redis-coordination/MIGRATION_SUMMARY.md +0 -348
  544. package/claude-assets/skills/cfn-docker-redis-coordination/README.md +0 -294
  545. package/claude-assets/skills/cfn-docker-redis-coordination/SKILL.md +0 -435
  546. package/claude-assets/skills/cfn-docker-redis-coordination/coordinate.sh +0 -650
  547. package/claude-assets/skills/cfn-docker-redis-coordination/coordinate.sh.backup-1763145142 +0 -641
  548. package/claude-assets/skills/cfn-docker-redis-coordination/jest.config.js +0 -37
  549. package/claude-assets/skills/cfn-docker-redis-coordination/package-lock.json +0 -5259
  550. package/claude-assets/skills/cfn-docker-redis-coordination/package.json +0 -40
  551. package/claude-assets/skills/cfn-docker-redis-coordination/src/coordinator.ts +0 -801
  552. package/claude-assets/skills/cfn-docker-redis-coordination/src/index.ts +0 -42
  553. package/claude-assets/skills/cfn-docker-redis-coordination/src/types.ts +0 -351
  554. package/claude-assets/skills/cfn-docker-redis-coordination/tests/coordinator.test.ts +0 -1464
  555. package/claude-assets/skills/cfn-loop-orchestration/helpers/auto-tune-timeouts.sh +0 -228
  556. package/claude-assets/skills/cfn-loop-orchestration/helpers/consensus-ts.sh +0 -104
  557. package/claude-assets/skills/cfn-loop-orchestration/helpers/consensus.sh +0 -94
  558. package/claude-assets/skills/cfn-loop-orchestration/helpers/context-injection.sh +0 -142
  559. package/claude-assets/skills/cfn-loop-orchestration/helpers/context-lookup.sh +0 -359
  560. package/claude-assets/skills/cfn-loop-orchestration/helpers/deliverable-verifier-ts.sh +0 -123
  561. package/claude-assets/skills/cfn-loop-orchestration/helpers/deliverable-verifier.sh +0 -71
  562. package/claude-assets/skills/cfn-loop-orchestration/helpers/gate-check.sh +0 -56
  563. package/claude-assets/skills/cfn-loop-orchestration/helpers/iteration-manager-ts.sh +0 -89
  564. package/claude-assets/skills/cfn-loop-orchestration/helpers/iteration-manager.sh +0 -87
  565. package/claude-assets/skills/cfn-loop-orchestration/helpers/orchestrate-ts.sh +0 -104
  566. package/claude-assets/skills/cfn-loop-orchestration/helpers/parse-test-results.sh +0 -56
  567. package/claude-assets/skills/cfn-loop-orchestration/helpers/spawn-agents.sh +0 -290
  568. package/claude-assets/skills/cfn-loop-orchestration/helpers/timeout-calculator-ts.sh +0 -47
  569. package/claude-assets/skills/cfn-loop-orchestration/helpers/timeout-calculator.sh +0 -51
  570. package/claude-assets/skills/cfn-loop-orchestration/orchestrate.sh +0 -1345
  571. package/claude-assets/skills/cfn-redis-cleanup/cleanup-redis.sh +0 -130
  572. package/claude-assets/skills/cfn-redis-coordination/AGENT_LOGGING.md +0 -280
  573. package/claude-assets/skills/cfn-redis-coordination/BZPOPMIN_FIX_SUMMARY.md +0 -209
  574. package/claude-assets/skills/cfn-redis-coordination/CENTRALIZED_REDIS_WRAPPER.md +0 -319
  575. package/claude-assets/skills/cfn-redis-coordination/agent-log.sh.bak +0 -124
  576. package/claude-assets/skills/cfn-redis-coordination/config.json +0 -61
  577. package/claude-assets/skills/cfn-redis-coordination/demos/phase4-wake-queue-test-report.md +0 -82
  578. package/claude-assets/skills/cfn-redis-coordination/demos/test-bzpopmin-fix.sh +0 -274
  579. package/claude-assets/skills/cfn-redis-coordination/demos/test-cancel-swarm.sh +0 -0
  580. package/claude-assets/skills/cfn-redis-coordination/docs/migration/PHASE_3_REDIS_COORDINATION_COMPLETION_REPORT.md +0 -553
  581. package/claude-assets/skills/cfn-redis-coordination/jest.config.js +0 -23
  582. package/claude-assets/skills/cfn-redis-coordination/package-lock.json +0 -5272
  583. package/claude-assets/skills/cfn-redis-coordination/package.json +0 -45
  584. package/claude-assets/skills/cfn-redis-coordination/src/agent-logger.ts +0 -446
  585. package/claude-assets/skills/cfn-redis-coordination/src/agent-recovery.ts +0 -454
  586. package/claude-assets/skills/cfn-redis-coordination/src/completion-reporter.ts +0 -396
  587. package/claude-assets/skills/cfn-redis-coordination/src/context-manager.ts +0 -327
  588. package/claude-assets/skills/cfn-redis-coordination/src/index.ts +0 -82
  589. package/claude-assets/skills/cfn-redis-coordination/src/mode-detector.ts +0 -155
  590. package/claude-assets/skills/cfn-redis-coordination/src/redis/redis-client.ts +0 -305
  591. package/claude-assets/skills/cfn-redis-coordination/src/redis/redis-functions.ts +0 -283
  592. package/claude-assets/skills/cfn-redis-coordination/src/redis-client.ts +0 -654
  593. package/claude-assets/skills/cfn-redis-coordination/src/result-collector.ts +0 -437
  594. package/claude-assets/skills/cfn-redis-coordination/src/swarm-manager.ts +0 -494
  595. package/claude-assets/skills/cfn-redis-coordination/src/task-analyzer.ts +0 -404
  596. package/claude-assets/skills/cfn-redis-coordination/src/task-executor.ts +0 -423
  597. package/claude-assets/skills/cfn-redis-coordination/src/types.ts +0 -235
  598. package/claude-assets/skills/cfn-redis-coordination/src/waiting-coordinator.ts +0 -587
  599. package/claude-assets/skills/cfn-redis-coordination/store-success-criteria.sh +0 -85
  600. package/claude-assets/skills/cfn-redis-coordination/test-connection-attempts.js +0 -70
  601. package/claude-assets/skills/cfn-redis-coordination/test-mode-simple.js +0 -121
  602. package/claude-assets/skills/cfn-redis-coordination/test-redis-check.js +0 -84
  603. package/claude-assets/skills/cfn-redis-coordination/test-task-mode-redis.cjs +0 -391
  604. package/claude-assets/skills/cfn-redis-coordination/tests/coordination.test.ts +0 -788
  605. package/claude-assets/skills/cfn-redis-coordination/update-all-scripts.sh +0 -67
  606. package/claude-assets/skills/cfn-redis-data-extraction/SKILL.md +0 -442
  607. package/claude-assets/skills/cfn-redis-data-extraction/extract.sh +0 -306
  608. package/dist/coordination/index.js +0 -25
  609. package/dist/coordination/index.js.map +0 -1
  610. package/docs/BUG_19_MEMORY_LEAK_TASK_MODE.md +0 -405
  611. package/docs/MEMORY_CLEANUP_GUIDE.md +0 -358
  612. package/docs/MEMORY_LEAK_FIX_SUMMARY.md +0 -322
  613. package/docs/REDIS_CLEANUP_EXECUTIVE_SUMMARY.md +0 -319
  614. package/docs/REDIS_CLEANUP_VERIFICATION_REPORT.md +0 -574
  615. /package/.claude/skills/cfn-loop-orchestration/{inject-loop-context.sh → archive/legacy-bash/inject-loop-context.sh} +0 -0
  616. /package/.claude/skills/cfn-loop-orchestration/{monitor-execution.sh → archive/legacy-bash/monitor-execution.sh} +0 -0
  617. /package/.claude/skills/cfn-redis-coordination/{agent-log.sh → agent-log.sh.backup} +0 -0
  618. /package/.claude/skills/cfn-redis-coordination/{agent-recovery.sh → agent-recovery.sh.backup} +0 -0
  619. /package/.claude/skills/cfn-redis-coordination/{analyze-task-complexity.sh → analyze-task-complexity.sh.backup} +0 -0
  620. /package/.claude/skills/cfn-redis-coordination/bash-wrappers/{store-context.sh → store-context.sh.backup} +0 -0
  621. /package/.claude/skills/cfn-redis-coordination/{cancel-swarm.sh → cancel-swarm.sh.backup} +0 -0
  622. /package/.claude/skills/cfn-redis-coordination/{cfn-loop-exec.sh → cfn-loop-exec.sh.backup} +0 -0
  623. /package/.claude/skills/cfn-redis-coordination/{cfn-loop-relaunch.sh → cfn-loop-relaunch.sh.backup} +0 -0
  624. /package/.claude/skills/cfn-redis-coordination/{collect-confidence-scores.sh → collect-confidence-scores.sh.backup} +0 -0
  625. /package/.claude/skills/cfn-redis-coordination/{collect-results.sh → collect-results.sh.backup} +0 -0
  626. /package/.claude/skills/cfn-redis-coordination/{complete-swarm.sh → complete-swarm.sh.backup} +0 -0
  627. /package/.claude/skills/cfn-redis-coordination/{get-context.sh → get-context.sh.backup} +0 -0
  628. /package/.claude/skills/cfn-redis-coordination/{get-success-criteria.sh → get-success-criteria.sh.backup} +0 -0
  629. /package/.claude/skills/cfn-redis-coordination/{invoke-waiting-mode.sh → invoke-waiting-mode.sh.backup} +0 -0
  630. /package/.claude/skills/cfn-redis-coordination/{redis-cli-wrapper.sh → redis-cli-wrapper.sh.backup} +0 -0
  631. /package/.claude/skills/cfn-redis-coordination/{redis-functions.sh → redis-functions.sh.backup} +0 -0
  632. /package/.claude/skills/cfn-redis-coordination/{report-completion.sh → report-completion.sh.backup} +0 -0
  633. /package/.claude/skills/cfn-redis-coordination/{store-context.sh → store-context.sh.backup} +0 -0
  634. /package/claude-assets/skills/cfn-loop-orchestration/{inject-loop-context.sh → archive/legacy-bash/inject-loop-context.sh} +0 -0
  635. /package/claude-assets/skills/cfn-loop-orchestration/{monitor-execution.sh → archive/legacy-bash/monitor-execution.sh} +0 -0
  636. /package/claude-assets/skills/cfn-redis-coordination/{agent-log.sh → agent-log.sh.backup} +0 -0
  637. /package/claude-assets/skills/cfn-redis-coordination/{agent-recovery.sh → agent-recovery.sh.backup} +0 -0
  638. /package/claude-assets/skills/cfn-redis-coordination/{analyze-task-complexity.sh → analyze-task-complexity.sh.backup} +0 -0
  639. /package/claude-assets/skills/cfn-redis-coordination/bash-wrappers/{store-context.sh → store-context.sh.backup} +0 -0
  640. /package/claude-assets/skills/cfn-redis-coordination/{cancel-swarm.sh → cancel-swarm.sh.backup} +0 -0
  641. /package/claude-assets/skills/cfn-redis-coordination/{cfn-loop-exec.sh → cfn-loop-exec.sh.backup} +0 -0
  642. /package/claude-assets/skills/cfn-redis-coordination/{cfn-loop-relaunch.sh → cfn-loop-relaunch.sh.backup} +0 -0
  643. /package/claude-assets/skills/cfn-redis-coordination/{collect-confidence-scores.sh → collect-confidence-scores.sh.backup} +0 -0
  644. /package/claude-assets/skills/cfn-redis-coordination/{collect-results.sh → collect-results.sh.backup} +0 -0
  645. /package/claude-assets/skills/cfn-redis-coordination/{complete-swarm.sh → complete-swarm.sh.backup} +0 -0
  646. /package/claude-assets/skills/cfn-redis-coordination/{get-context.sh → get-context.sh.backup} +0 -0
  647. /package/claude-assets/skills/cfn-redis-coordination/{get-success-criteria.sh → get-success-criteria.sh.backup} +0 -0
  648. /package/claude-assets/skills/cfn-redis-coordination/{invoke-waiting-mode.sh → invoke-waiting-mode.sh.backup} +0 -0
  649. /package/claude-assets/skills/cfn-redis-coordination/{redis-cli-wrapper.sh → redis-cli-wrapper.sh.backup} +0 -0
  650. /package/claude-assets/skills/cfn-redis-coordination/{redis-functions.sh → redis-functions.sh.backup} +0 -0
  651. /package/claude-assets/skills/cfn-redis-coordination/{report-completion.sh → report-completion.sh.backup} +0 -0
  652. /package/claude-assets/skills/cfn-redis-coordination/{store-context.sh → store-context.sh.backup} +0 -0
@@ -0,0 +1,273 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Agent Completion CLI
4
+ *
5
+ * Signal agent completion with confidence score and test metrics
6
+ *
7
+ * Usage:
8
+ * agent-completion --task-id <id> --agent-id <id> --confidence <score> [options]
9
+ *
10
+ * Required Arguments:
11
+ * --task-id <id> Task identifier
12
+ * --agent-id <id> Agent identifier
13
+ * --confidence <score> Confidence score (0.0-1.0)
14
+ *
15
+ * Optional Arguments:
16
+ * --iteration <n> Iteration number (default: 1)
17
+ * --namespace <ns> Namespace: swarm | cfn_loop (default: swarm)
18
+ * --test-pass-rate <pct> Test pass rate (0.0-1.0)
19
+ * --tests-run <n> Total tests run
20
+ * --tests-passed <n> Tests passed
21
+ * --result <json> Result JSON (test pass rate preferred)
22
+ * --redis-host <h> Redis host (default: localhost)
23
+ * --redis-port <p> Redis port (default: 6379)
24
+ * --json Output result as JSON
25
+ * --help Show this help message
26
+ *
27
+ * Examples:
28
+ * # Simple completion with confidence
29
+ * agent-completion \
30
+ * --task-id task123 \
31
+ * --agent-id agent-loop3-1 \
32
+ * --confidence 0.92
33
+ *
34
+ * # Completion with test metrics (test-driven)
35
+ * agent-completion \
36
+ * --task-id task123 \
37
+ * --agent-id agent-loop3-1 \
38
+ * --confidence 0.95 \
39
+ * --test-pass-rate 0.98 \
40
+ * --tests-run 50 \
41
+ * --tests-passed 49
42
+ *
43
+ * # Validator consensus score
44
+ * agent-completion \
45
+ * --task-id task123 \
46
+ * --agent-id validator-1 \
47
+ * --confidence 0.88 \
48
+ * --iteration 1
49
+ */ import { CoordinationWrapper } from '../coordination/coordination-wrapper.js';
50
+ import * as process from 'process';
51
+ /**
52
+ * Parse command line arguments
53
+ */ function parseArgs() {
54
+ const args = process.argv.slice(2);
55
+ const options = {
56
+ namespace: 'swarm',
57
+ iteration: 1,
58
+ redisHost: process.env.CFN_REDIS_HOST || process.env.REDIS_HOST || 'localhost',
59
+ redisPort: parseInt(process.env.CFN_REDIS_PORT || process.env.REDIS_PORT || '6379'),
60
+ json: false
61
+ };
62
+ for(let i = 0; i < args.length; i++){
63
+ const arg = args[i];
64
+ switch(arg){
65
+ case '--task-id':
66
+ options.taskId = args[++i];
67
+ break;
68
+ case '--agent-id':
69
+ options.agentId = args[++i];
70
+ break;
71
+ case '--confidence':
72
+ options.confidence = parseFloat(args[++i]);
73
+ break;
74
+ case '--iteration':
75
+ options.iteration = parseInt(args[++i]);
76
+ break;
77
+ case '--namespace':
78
+ options.namespace = args[++i];
79
+ break;
80
+ case '--test-pass-rate':
81
+ options.testPassRate = parseFloat(args[++i]);
82
+ break;
83
+ case '--tests-run':
84
+ options.testsRun = parseInt(args[++i]);
85
+ break;
86
+ case '--tests-passed':
87
+ options.testsPassed = parseInt(args[++i]);
88
+ break;
89
+ case '--result':
90
+ options.result = args[++i];
91
+ break;
92
+ case '--redis-host':
93
+ options.redisHost = args[++i];
94
+ break;
95
+ case '--redis-port':
96
+ options.redisPort = parseInt(args[++i]);
97
+ break;
98
+ case '--json':
99
+ options.json = true;
100
+ break;
101
+ case '--help':
102
+ case '-h':
103
+ options.help = true;
104
+ break;
105
+ }
106
+ }
107
+ return options;
108
+ }
109
+ /**
110
+ * Show help message
111
+ */ function showHelp() {
112
+ console.log(`
113
+ Agent Completion CLI - Signal agent completion with test metrics
114
+
115
+ Usage:
116
+ agent-completion --task-id <id> --agent-id <id> --confidence <score> [options]
117
+
118
+ Required Arguments:
119
+ --task-id <id> Task identifier
120
+ --agent-id <id> Agent identifier
121
+ --confidence <score> Confidence score (0.0-1.0)
122
+
123
+ Optional Arguments:
124
+ --iteration <n> Iteration number (default: 1)
125
+ --namespace <ns> Namespace: swarm | cfn_loop (default: swarm)
126
+ --test-pass-rate <pct> Test pass rate (0.0-1.0, preferred over confidence)
127
+ --tests-run <n> Total tests run
128
+ --tests-passed <n> Tests passed
129
+ --result <json> Result JSON (for custom data)
130
+ --redis-host <h> Redis host (default: localhost or CFN_REDIS_HOST env)
131
+ --redis-port <p> Redis port (default: 6379 or CFN_REDIS_PORT env)
132
+ --json Output result as JSON
133
+ --help, -h Show this help message
134
+
135
+ Examples:
136
+ # Simple completion with confidence
137
+ agent-completion \\
138
+ --task-id task123 \\
139
+ --agent-id agent-loop3-1 \\
140
+ --confidence 0.92
141
+
142
+ # Test-driven completion with metrics
143
+ agent-completion \\
144
+ --task-id task123 \\
145
+ --agent-id agent-loop3-1 \\
146
+ --confidence 0.95 \\
147
+ --test-pass-rate 0.98 \\
148
+ --tests-run 50 \\
149
+ --tests-passed 49
150
+
151
+ # Validator consensus
152
+ agent-completion \\
153
+ --task-id task123 \\
154
+ --agent-id validator-1 \\
155
+ --confidence 0.88 \\
156
+ --iteration 1 \\
157
+ --json
158
+
159
+ Environment Variables:
160
+ CFN_REDIS_HOST Redis host
161
+ CFN_REDIS_PORT Redis port
162
+ REDIS_HOST Fallback Redis host
163
+ REDIS_PORT Fallback Redis port
164
+ `);
165
+ }
166
+ /**
167
+ * Validate confidence score
168
+ */ function validateConfidence(score) {
169
+ return typeof score === 'number' && score >= 0 && score <= 1;
170
+ }
171
+ /**
172
+ * Validate test pass rate
173
+ */ function validateTestPassRate(rate) {
174
+ return typeof rate === 'number' && rate >= 0 && rate <= 1;
175
+ }
176
+ /**
177
+ * Main function
178
+ */ async function main() {
179
+ const options = parseArgs();
180
+ if (options.help) {
181
+ showHelp();
182
+ process.exit(0);
183
+ }
184
+ // Validate required arguments
185
+ if (!options.taskId || !options.agentId || options.confidence === undefined) {
186
+ console.error('Error: Missing required arguments');
187
+ console.error('Use --help for usage information');
188
+ process.exit(1);
189
+ }
190
+ // Validate confidence score
191
+ if (!validateConfidence(options.confidence)) {
192
+ console.error('Error: Confidence score must be between 0.0 and 1.0');
193
+ process.exit(1);
194
+ }
195
+ // Validate test pass rate if provided
196
+ if (options.testPassRate !== undefined && !validateTestPassRate(options.testPassRate)) {
197
+ console.error('Error: Test pass rate must be between 0.0 and 1.0');
198
+ process.exit(1);
199
+ }
200
+ try {
201
+ // Create coordination wrapper
202
+ const coordinator = new CoordinationWrapper({
203
+ taskId: options.taskId,
204
+ namespace: options.namespace || 'swarm',
205
+ redisHost: options.redisHost || 'localhost',
206
+ redisPort: options.redisPort || 6379
207
+ });
208
+ // Connect to Redis
209
+ await coordinator.connect();
210
+ // Build result object
211
+ let resultObj;
212
+ if (options.result) {
213
+ try {
214
+ resultObj = JSON.parse(options.result);
215
+ } catch {
216
+ // If result is not valid JSON, store as string
217
+ resultObj = {
218
+ result: options.result
219
+ };
220
+ }
221
+ }
222
+ // Signal completion
223
+ await coordinator.signalCompletion(options.agentId, options.confidence, {
224
+ testPassRate: options.testPassRate,
225
+ testsRun: options.testsRun,
226
+ testsPassed: options.testsPassed,
227
+ result: resultObj,
228
+ iteration: options.iteration
229
+ });
230
+ // Output result
231
+ const output = {
232
+ taskId: options.taskId,
233
+ agentId: options.agentId,
234
+ confidence: options.confidence,
235
+ testPassRate: options.testPassRate,
236
+ testsRun: options.testsRun,
237
+ testsPassed: options.testsPassed,
238
+ iteration: options.iteration,
239
+ timestamp: new Date().toISOString(),
240
+ status: 'success'
241
+ };
242
+ if (options.json) {
243
+ console.log(JSON.stringify(output, null, 2));
244
+ } else {
245
+ console.log(`Agent ${options.agentId} completion reported`);
246
+ console.log(`Confidence: ${(options.confidence * 100).toFixed(1)}%`);
247
+ if (options.testPassRate !== undefined) {
248
+ console.log(`Test Pass Rate: ${(options.testPassRate * 100).toFixed(1)}%`);
249
+ }
250
+ if (options.testsRun !== undefined && options.testsPassed !== undefined) {
251
+ console.log(`Tests: ${options.testsPassed}/${options.testsRun}`);
252
+ }
253
+ }
254
+ // Disconnect
255
+ await coordinator.disconnect();
256
+ process.exit(0);
257
+ } catch (error) {
258
+ console.error('Error reporting agent completion:', error);
259
+ if (options.json) {
260
+ console.log(JSON.stringify({
261
+ taskId: options.taskId,
262
+ agentId: options.agentId,
263
+ status: 'error',
264
+ error: error instanceof Error ? error.message : 'Unknown error'
265
+ }, null, 2));
266
+ }
267
+ process.exit(1);
268
+ }
269
+ }
270
+ // Run main function
271
+ main();
272
+
273
+ //# sourceMappingURL=agent-completion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/cli/agent-completion.ts"],"sourcesContent":["#!/usr/bin/env node\r\n\r\n/**\r\n * Agent Completion CLI\r\n *\r\n * Signal agent completion with confidence score and test metrics\r\n *\r\n * Usage:\r\n * agent-completion --task-id <id> --agent-id <id> --confidence <score> [options]\r\n *\r\n * Required Arguments:\r\n * --task-id <id> Task identifier\r\n * --agent-id <id> Agent identifier\r\n * --confidence <score> Confidence score (0.0-1.0)\r\n *\r\n * Optional Arguments:\r\n * --iteration <n> Iteration number (default: 1)\r\n * --namespace <ns> Namespace: swarm | cfn_loop (default: swarm)\r\n * --test-pass-rate <pct> Test pass rate (0.0-1.0)\r\n * --tests-run <n> Total tests run\r\n * --tests-passed <n> Tests passed\r\n * --result <json> Result JSON (test pass rate preferred)\r\n * --redis-host <h> Redis host (default: localhost)\r\n * --redis-port <p> Redis port (default: 6379)\r\n * --json Output result as JSON\r\n * --help Show this help message\r\n *\r\n * Examples:\r\n * # Simple completion with confidence\r\n * agent-completion \\\r\n * --task-id task123 \\\r\n * --agent-id agent-loop3-1 \\\r\n * --confidence 0.92\r\n *\r\n * # Completion with test metrics (test-driven)\r\n * agent-completion \\\r\n * --task-id task123 \\\r\n * --agent-id agent-loop3-1 \\\r\n * --confidence 0.95 \\\r\n * --test-pass-rate 0.98 \\\r\n * --tests-run 50 \\\r\n * --tests-passed 49\r\n *\r\n * # Validator consensus score\r\n * agent-completion \\\r\n * --task-id task123 \\\r\n * --agent-id validator-1 \\\r\n * --confidence 0.88 \\\r\n * --iteration 1\r\n */\r\n\r\nimport { CoordinationWrapper } from '../coordination/coordination-wrapper.js';\r\nimport * as process from 'process';\r\n\r\ninterface Options {\r\n taskId: string;\r\n agentId: string;\r\n confidence: number;\r\n iteration?: number;\r\n namespace?: 'swarm' | 'cfn_loop';\r\n testPassRate?: number;\r\n testsRun?: number;\r\n testsPassed?: number;\r\n result?: string;\r\n redisHost?: string;\r\n redisPort?: number;\r\n json?: boolean;\r\n help?: boolean;\r\n}\r\n\r\n/**\r\n * Parse command line arguments\r\n */\r\nfunction parseArgs(): Options {\r\n const args = process.argv.slice(2);\r\n const options: Partial<Options> = {\r\n namespace: 'swarm',\r\n iteration: 1,\r\n redisHost: process.env.CFN_REDIS_HOST || process.env.REDIS_HOST || 'localhost',\r\n redisPort: parseInt(process.env.CFN_REDIS_PORT || process.env.REDIS_PORT || '6379'),\r\n json: false\r\n };\r\n\r\n for (let i = 0; i < args.length; i++) {\r\n const arg = args[i];\r\n\r\n switch (arg) {\r\n case '--task-id':\r\n options.taskId = args[++i];\r\n break;\r\n case '--agent-id':\r\n options.agentId = args[++i];\r\n break;\r\n case '--confidence':\r\n options.confidence = parseFloat(args[++i]);\r\n break;\r\n case '--iteration':\r\n options.iteration = parseInt(args[++i]);\r\n break;\r\n case '--namespace':\r\n options.namespace = args[++i] as 'swarm' | 'cfn_loop';\r\n break;\r\n case '--test-pass-rate':\r\n options.testPassRate = parseFloat(args[++i]);\r\n break;\r\n case '--tests-run':\r\n options.testsRun = parseInt(args[++i]);\r\n break;\r\n case '--tests-passed':\r\n options.testsPassed = parseInt(args[++i]);\r\n break;\r\n case '--result':\r\n options.result = args[++i];\r\n break;\r\n case '--redis-host':\r\n options.redisHost = args[++i];\r\n break;\r\n case '--redis-port':\r\n options.redisPort = parseInt(args[++i]);\r\n break;\r\n case '--json':\r\n options.json = true;\r\n break;\r\n case '--help':\r\n case '-h':\r\n options.help = true;\r\n break;\r\n }\r\n }\r\n\r\n return options as Options;\r\n}\r\n\r\n/**\r\n * Show help message\r\n */\r\nfunction showHelp(): void {\r\n console.log(`\r\nAgent Completion CLI - Signal agent completion with test metrics\r\n\r\nUsage:\r\n agent-completion --task-id <id> --agent-id <id> --confidence <score> [options]\r\n\r\nRequired Arguments:\r\n --task-id <id> Task identifier\r\n --agent-id <id> Agent identifier\r\n --confidence <score> Confidence score (0.0-1.0)\r\n\r\nOptional Arguments:\r\n --iteration <n> Iteration number (default: 1)\r\n --namespace <ns> Namespace: swarm | cfn_loop (default: swarm)\r\n --test-pass-rate <pct> Test pass rate (0.0-1.0, preferred over confidence)\r\n --tests-run <n> Total tests run\r\n --tests-passed <n> Tests passed\r\n --result <json> Result JSON (for custom data)\r\n --redis-host <h> Redis host (default: localhost or CFN_REDIS_HOST env)\r\n --redis-port <p> Redis port (default: 6379 or CFN_REDIS_PORT env)\r\n --json Output result as JSON\r\n --help, -h Show this help message\r\n\r\nExamples:\r\n # Simple completion with confidence\r\n agent-completion \\\\\r\n --task-id task123 \\\\\r\n --agent-id agent-loop3-1 \\\\\r\n --confidence 0.92\r\n\r\n # Test-driven completion with metrics\r\n agent-completion \\\\\r\n --task-id task123 \\\\\r\n --agent-id agent-loop3-1 \\\\\r\n --confidence 0.95 \\\\\r\n --test-pass-rate 0.98 \\\\\r\n --tests-run 50 \\\\\r\n --tests-passed 49\r\n\r\n # Validator consensus\r\n agent-completion \\\\\r\n --task-id task123 \\\\\r\n --agent-id validator-1 \\\\\r\n --confidence 0.88 \\\\\r\n --iteration 1 \\\\\r\n --json\r\n\r\nEnvironment Variables:\r\n CFN_REDIS_HOST Redis host\r\n CFN_REDIS_PORT Redis port\r\n REDIS_HOST Fallback Redis host\r\n REDIS_PORT Fallback Redis port\r\n`);\r\n}\r\n\r\n/**\r\n * Validate confidence score\r\n */\r\nfunction validateConfidence(score: number): boolean {\r\n return typeof score === 'number' && score >= 0 && score <= 1;\r\n}\r\n\r\n/**\r\n * Validate test pass rate\r\n */\r\nfunction validateTestPassRate(rate: number): boolean {\r\n return typeof rate === 'number' && rate >= 0 && rate <= 1;\r\n}\r\n\r\n/**\r\n * Main function\r\n */\r\nasync function main(): Promise<void> {\r\n const options = parseArgs();\r\n\r\n if (options.help) {\r\n showHelp();\r\n process.exit(0);\r\n }\r\n\r\n // Validate required arguments\r\n if (!options.taskId || !options.agentId || options.confidence === undefined) {\r\n console.error('Error: Missing required arguments');\r\n console.error('Use --help for usage information');\r\n process.exit(1);\r\n }\r\n\r\n // Validate confidence score\r\n if (!validateConfidence(options.confidence)) {\r\n console.error('Error: Confidence score must be between 0.0 and 1.0');\r\n process.exit(1);\r\n }\r\n\r\n // Validate test pass rate if provided\r\n if (options.testPassRate !== undefined && !validateTestPassRate(options.testPassRate)) {\r\n console.error('Error: Test pass rate must be between 0.0 and 1.0');\r\n process.exit(1);\r\n }\r\n\r\n try {\r\n // Create coordination wrapper\r\n const coordinator = new CoordinationWrapper({\r\n taskId: options.taskId,\r\n namespace: options.namespace || 'swarm',\r\n redisHost: options.redisHost || 'localhost',\r\n redisPort: options.redisPort || 6379\r\n });\r\n\r\n // Connect to Redis\r\n await coordinator.connect();\r\n\r\n // Build result object\r\n let resultObj: Record<string, unknown> | undefined;\r\n if (options.result) {\r\n try {\r\n resultObj = JSON.parse(options.result);\r\n } catch {\r\n // If result is not valid JSON, store as string\r\n resultObj = { result: options.result };\r\n }\r\n }\r\n\r\n // Signal completion\r\n await coordinator.signalCompletion(options.agentId, options.confidence, {\r\n testPassRate: options.testPassRate,\r\n testsRun: options.testsRun,\r\n testsPassed: options.testsPassed,\r\n result: resultObj,\r\n iteration: options.iteration\r\n });\r\n\r\n // Output result\r\n const output = {\r\n taskId: options.taskId,\r\n agentId: options.agentId,\r\n confidence: options.confidence,\r\n testPassRate: options.testPassRate,\r\n testsRun: options.testsRun,\r\n testsPassed: options.testsPassed,\r\n iteration: options.iteration,\r\n timestamp: new Date().toISOString(),\r\n status: 'success'\r\n };\r\n\r\n if (options.json) {\r\n console.log(JSON.stringify(output, null, 2));\r\n } else {\r\n console.log(`Agent ${options.agentId} completion reported`);\r\n console.log(`Confidence: ${(options.confidence * 100).toFixed(1)}%`);\r\n if (options.testPassRate !== undefined) {\r\n console.log(`Test Pass Rate: ${(options.testPassRate * 100).toFixed(1)}%`);\r\n }\r\n if (options.testsRun !== undefined && options.testsPassed !== undefined) {\r\n console.log(`Tests: ${options.testsPassed}/${options.testsRun}`);\r\n }\r\n }\r\n\r\n // Disconnect\r\n await coordinator.disconnect();\r\n\r\n process.exit(0);\r\n } catch (error) {\r\n console.error('Error reporting agent completion:', error);\r\n if (options.json) {\r\n console.log(\r\n JSON.stringify({\r\n taskId: options.taskId,\r\n agentId: options.agentId,\r\n status: 'error',\r\n error: error instanceof Error ? error.message : 'Unknown error'\r\n }, null, 2)\r\n );\r\n }\r\n process.exit(1);\r\n }\r\n}\r\n\r\n// Run main function\r\nmain();\r\n"],"names":["CoordinationWrapper","process","parseArgs","args","argv","slice","options","namespace","iteration","redisHost","env","CFN_REDIS_HOST","REDIS_HOST","redisPort","parseInt","CFN_REDIS_PORT","REDIS_PORT","json","i","length","arg","taskId","agentId","confidence","parseFloat","testPassRate","testsRun","testsPassed","result","help","showHelp","console","log","validateConfidence","score","validateTestPassRate","rate","main","exit","undefined","error","coordinator","connect","resultObj","JSON","parse","signalCompletion","output","timestamp","Date","toISOString","status","stringify","toFixed","disconnect","Error","message"],"mappings":";AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+CC,GAED,SAASA,mBAAmB,QAAQ,0CAA0C;AAC9E,YAAYC,aAAa,UAAU;AAkBnC;;CAEC,GACD,SAASC;IACP,MAAMC,OAAOF,QAAQG,IAAI,CAACC,KAAK,CAAC;IAChC,MAAMC,UAA4B;QAChCC,WAAW;QACXC,WAAW;QACXC,WAAWR,QAAQS,GAAG,CAACC,cAAc,IAAIV,QAAQS,GAAG,CAACE,UAAU,IAAI;QACnEC,WAAWC,SAASb,QAAQS,GAAG,CAACK,cAAc,IAAId,QAAQS,GAAG,CAACM,UAAU,IAAI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AAErB,QAAQoB,QAAQ,EAAE;YACjE;QACF;QAEA,aAAa;QACb,MAAMe,YAAYa,UAAU;QAE5BrD,QAAQqC,IAAI,CAAC;IACf,EAAE,OAAOE,OAAO;QACdT,QAAQS,KAAK,CAAC,qCAAqCA;QACnD,IAAIlC,QAAQW,IAAI,EAAE;YAChBc,QAAQC,GAAG,CACTY,KAAKQ,SAAS,CAAC;gBACb/B,QAAQf,QAAQe,MAAM;gBACtBC,SAAShB,QAAQgB,OAAO;gBACxB6B,QAAQ;gBACRX,OAAOA,iBAAiBe,QAAQf,MAAMgB,OAAO,GAAG;YAClD,GAAG,MAAM;QAEb;QACAvD,QAAQqC,IAAI,CAAC;IACf;AACF;AAEA,oBAAoB;AACpBD"}
@@ -7,9 +7,39 @@
7
7
  import path from 'path';
8
8
  import { fileURLToPath } from 'url';
9
9
  import { glob } from 'glob';
10
+ import { execSync } from 'child_process';
10
11
  // ES Module compatibility
11
12
  const __filename = fileURLToPath(import.meta.url);
12
13
  const __dirname = path.dirname(__filename);
14
+ /**
15
+ * Detect project root dynamically
16
+ * Uses PROJECT_ROOT env var if set, otherwise tries git, falls back to cwd
17
+ */ function getProjectRoot() {
18
+ // 1. Check environment variable
19
+ if (process.env.PROJECT_ROOT) {
20
+ return process.env.PROJECT_ROOT;
21
+ }
22
+ // 2. Try git rev-parse (most reliable)
23
+ try {
24
+ const gitRoot = execSync('git rev-parse --show-toplevel', {
25
+ encoding: 'utf-8',
26
+ cwd: process.cwd(),
27
+ stdio: [
28
+ 'pipe',
29
+ 'pipe',
30
+ 'ignore'
31
+ ]
32
+ }).trim();
33
+ if (gitRoot) {
34
+ return gitRoot;
35
+ }
36
+ } catch {
37
+ // Fall through to next method
38
+ }
39
+ // 3. Fall back to current working directory
40
+ return process.cwd();
41
+ }
42
+ const projectRoot = getProjectRoot();
13
43
  /**
14
44
  * Parse YAML frontmatter from markdown content
15
45
  * Supports both Unix (LF) and Windows (CRLF) line endings
@@ -111,13 +141,15 @@ const __dirname = path.dirname(__filename);
111
141
  /**
112
142
  * Find agent definition file by agent type/name
113
143
  * Searches multiple locations for agent definitions
114
- */ async function findAgentFile(agentType, baseDir = '.claude/agents') {
144
+ */ async function findAgentFile(agentType, baseDir) {
115
145
  // Normalize agent type (handle both kebab-case and underscores)
116
146
  const normalizedType = agentType.toLowerCase().replace(/_/g, '-');
117
147
  // Search locations (in order of priority)
148
+ // Use provided baseDir, or construct default path from project root
149
+ const defaultBaseDir = path.join(projectRoot, '.claude/agents');
118
150
  const searchLocations = [
119
- baseDir,
120
- '.claude/agents',
151
+ baseDir || defaultBaseDir,
152
+ defaultBaseDir,
121
153
  path.join(__dirname, '../../.claude/agents'),
122
154
  '/app/.claude/agents'
123
155
  ];
@@ -164,7 +196,8 @@ const __dirname = path.dirname(__filename);
164
196
  // Parse frontmatter and body
165
197
  const { frontmatter, body } = parseFrontmatter(content);
166
198
  // Extract category from path
167
- const relativePath = path.relative('.claude/agents', filePath);
199
+ const agentsPath = path.join(projectRoot, '.claude/agents');
200
+ const relativePath = path.relative(agentsPath, filePath);
168
201
  const category = relativePath.includes('/') ? relativePath.split('/')[0] : undefined;
169
202
  // Build agent definition
170
203
  const definition = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/cli/agent-definition-parser.ts"],"sourcesContent":["/**\r\n * Agent Definition Parser\r\n *\r\n * Parses agent definition files (.md) with YAML frontmatter and markdown content.\r\n * Supports agent definitions in .claude/agents/ directory structure.\r\n */\r\n\r\nimport fs from 'fs/promises';\r\nimport path from 'path';\r\nimport { fileURLToPath } from 'url';\r\nimport { glob } from 'glob';\r\n\r\n// ES Module compatibility\r\nconst __filename = fileURLToPath(import.meta.url);\r\nconst __dirname = path.dirname(__filename);\r\n\r\nexport interface AgentDefinition {\r\n // YAML frontmatter fields\r\n name: string;\r\n description: string;\r\n tools: string[];\r\n model: 'haiku' | 'sonnet' | 'opus';\r\n type?: string;\r\n color?: string;\r\n acl_level?: number;\r\n capabilities?: string[];\r\n validation_hooks?: string[];\r\n lifecycle?: {\r\n pre_task?: string;\r\n post_task?: string;\r\n };\r\n\r\n // Parsed markdown content\r\n content: string;\r\n\r\n // File metadata\r\n filePath: string;\r\n category?: string; // e.g., 'core-agents', 'specialized', 'custom'\r\n}\r\n\r\n/**\r\n * Parse YAML frontmatter from markdown content\r\n * Supports both Unix (LF) and Windows (CRLF) line endings\r\n */\r\nfunction parseFrontmatter(content: string): { frontmatter: Record<string, any>; body: string } {\r\n const frontmatterRegex = /^---\\r?\\n([\\s\\S]*?)\\r?\\n---\\r?\\n([\\s\\S]*)$/;\r\n const match = content.match(frontmatterRegex);\r\n\r\n if (!match) {\r\n return { frontmatter: {}, body: content };\r\n }\r\n\r\n const [, yamlContent, body] = match;\r\n\r\n \r\n // Simple YAML parser (handles basic key-value pairs, arrays, and objects)\r\n const frontmatter: Record<string, any> = {};\r\n const lines = yamlContent.split('\\n');\r\n let currentKey = '';\r\n let currentArray: string[] = [];\r\n let isInArray = false;\r\n let isInObject = false;\r\n let currentObject: Record<string, string> = {};\r\n let objectKey = '';\r\n\r\n for (const line of lines) {\r\n const trimmed = line.trim();\r\n if (!trimmed || trimmed.startsWith('#')) continue;\r\n\r\n // Array item\r\n if (trimmed.startsWith('- ')) {\r\n if (!isInArray) {\r\n isInArray = true;\r\n currentArray = [];\r\n }\r\n currentArray.push(trimmed.substring(2).trim());\r\n continue;\r\n }\r\n\r\n // End of array\r\n if (isInArray && !trimmed.startsWith('- ')) {\r\n frontmatter[currentKey] = currentArray;\r\n isInArray = false;\r\n currentArray = [];\r\n }\r\n\r\n // Object field (indented key-value)\r\n if (trimmed.match(/^\\s+\\w+:/) && isInObject) {\r\n const [objKey, ...objValueParts] = trimmed.split(':');\r\n const objValue = objValueParts.join(':').trim().replace(/^[\"']|[\"']$/g, '');\r\n currentObject[objKey.trim()] = objValue;\r\n continue;\r\n }\r\n\r\n // Key-value pair\r\n const colonIndex = trimmed.indexOf(':');\r\n if (colonIndex !== -1) {\r\n const key = trimmed.substring(0, colonIndex).trim();\r\n const value = trimmed.substring(colonIndex + 1).trim();\r\n\r\n // Check if this starts an object\r\n if (value === '') {\r\n isInObject = true;\r\n currentObject = {};\r\n objectKey = key;\r\n continue;\r\n }\r\n\r\n // End previous object if any\r\n if (isInObject && !trimmed.match(/^\\s+/)) {\r\n frontmatter[objectKey] = currentObject;\r\n isInObject = false;\r\n currentObject = {};\r\n }\r\n\r\n currentKey = key;\r\n\r\n // Multi-line string (starts with |)\r\n if (value === '|') {\r\n continue; // Will be handled by next lines\r\n }\r\n\r\n // Inline array (e.g., [item1, item2, item3])\r\n if (value.startsWith('[') && value.endsWith(']')) {\r\n const arrayContent = value.substring(1, value.length - 1);\r\n const items = arrayContent.split(',').map(item => item.trim());\r\n frontmatter[key] = items;\r\n continue;\r\n }\r\n\r\n // Remove quotes\r\n const cleanValue = value.replace(/^[\"']|[\"']$/g, '');\r\n frontmatter[key] = cleanValue;\r\n } else if (currentKey && trimmed && !isInArray && !isInObject) {\r\n // Continuation of multi-line string\r\n const existingValue = frontmatter[currentKey];\r\n frontmatter[currentKey] = existingValue\r\n ? `${existingValue}\\n${trimmed}`\r\n : trimmed;\r\n }\r\n }\r\n\r\n // Handle trailing array or object\r\n if (isInArray) {\r\n frontmatter[currentKey] = currentArray;\r\n }\r\n if (isInObject) {\r\n frontmatter[objectKey] = currentObject;\r\n }\r\n\r\n return { frontmatter, body: body.trim() };\r\n}\r\n\r\n/**\r\n * Find agent definition file by agent type/name\r\n * Searches multiple locations for agent definitions\r\n */\r\nasync function findAgentFile(agentType: string, baseDir: string = '.claude/agents'): Promise<string | null> {\r\n // Normalize agent type (handle both kebab-case and underscores)\r\n const normalizedType = agentType.toLowerCase().replace(/_/g, '-');\r\n\r\n // Search locations (in order of priority)\r\n const searchLocations = [\r\n baseDir, // Current working directory\r\n '.claude/agents', // Standard location\r\n path.join(__dirname, '../../.claude/agents'), // CLI installation directory\r\n '/app/.claude/agents', // Docker container location\r\n ];\r\n\r\n // Search patterns (in order of priority)\r\n const searchPatterns = [\r\n // Exact match in any subdirectory\r\n (loc: string) => `${loc}/**/${normalizedType}.md`,\r\n // Match with different casing\r\n (loc: string) => `${loc}/**/*${normalizedType}*.md`,\r\n ];\r\n\r\n for (const location of searchLocations) {\r\n for (const patternFn of searchPatterns) {\r\n const pattern = patternFn(location);\r\n try {\r\n const files = await glob(pattern, { nodir: true, absolute: true });\r\n if (files.length > 0) {\r\n // Prefer exact match over partial match\r\n const exactMatch = files.find(f => {\r\n const basename = path.basename(f, '.md').toLowerCase();\r\n return basename === normalizedType;\r\n });\r\n return exactMatch || files[0];\r\n }\r\n } catch (error) {\r\n // Skip location if it doesn't exist\r\n continue;\r\n }\r\n }\r\n }\r\n\r\n return null;\r\n}\r\n\r\n/**\r\n * Parse agent definition from file\r\n */\r\nexport async function parseAgentDefinition(agentType: string): Promise<AgentDefinition> {\r\n // Find agent file\r\n const filePath = await findAgentFile(agentType);\r\n\r\n if (!filePath) {\r\n throw new Error(`Agent definition not found: ${agentType}`);\r\n }\r\n\r\n // Read file content\r\n const content = await fs.readFile(filePath, 'utf-8');\r\n\r\n \r\n // Parse frontmatter and body\r\n const { frontmatter, body } = parseFrontmatter(content);\r\n\r\n // Extract category from path\r\n const relativePath = path.relative('.claude/agents', filePath);\r\n const category = relativePath.includes('/')\r\n ? relativePath.split('/')[0]\r\n : undefined;\r\n\r\n \r\n // Build agent definition\r\n const definition: AgentDefinition = {\r\n name: frontmatter.name || agentType,\r\n description: frontmatter.description || '',\r\n tools: Array.isArray(frontmatter.tools) ? frontmatter.tools : [],\r\n model: frontmatter.model || 'haiku',\r\n type: frontmatter.type,\r\n color: frontmatter.color,\r\n acl_level: frontmatter.acl_level ? parseInt(String(frontmatter.acl_level), 10) : undefined,\r\n capabilities: frontmatter.capabilities,\r\n validation_hooks: frontmatter.validation_hooks,\r\n lifecycle: frontmatter.lifecycle,\r\n content: body,\r\n filePath,\r\n category,\r\n };\r\n\r\n return definition;\r\n}\r\n\r\n/**\r\n * List all available agent definitions\r\n */\r\nexport async function listAgentDefinitions(baseDir: string = '.claude/agents'): Promise<string[]> {\r\n const pattern = `${baseDir}/**/*.md`;\r\n const files = await glob(pattern, { nodir: true });\r\n\r\n return files.map(f => path.basename(f, '.md'));\r\n}\r\n\r\n/**\r\n * Check if agent definition includes CFN Loop protocol\r\n */\r\nexport function hasCFNLoopProtocol(definition: AgentDefinition): boolean {\r\n const content = definition.content.toLowerCase();\r\n return (\r\n content.includes('cfn loop') &&\r\n content.includes('redis completion protocol') ||\r\n content.includes('invoke-waiting-mode.sh')\r\n );\r\n}\r\n"],"names":["fs","path","fileURLToPath","glob","__filename","url","__dirname","dirname","parseFrontmatter","content","frontmatterRegex","match","frontmatter","body","yamlContent","lines","split","currentKey","currentArray","isInArray","isInObject","currentObject","objectKey","line","trimmed","trim","startsWith","push","substring","objKey","objValueParts","objValue","join","replace","colonIndex","indexOf","key","value","endsWith","arrayContent","length","items","map","item","cleanValue","existingValue","findAgentFile","agentType","baseDir","normalizedType","toLowerCase","searchLocations","searchPatterns","loc","location","patternFn","pattern","files","nodir","absolute","exactMatch","find","f","basename","error","parseAgentDefinition","filePath","Error","readFile","relativePath","relative","category","includes","undefined","definition","name","description","tools","Array","isArray","model","type","color","acl_level","parseInt","String","capabilities","validation_hooks","lifecycle","listAgentDefinitions","hasCFNLoopProtocol"],"mappings":"AAAA;;;;;CAKC,GAED,OAAOA,QAAQ,cAAc;AAC7B,OAAOC,UAAU,OAAO;AACxB,SAASC,aAAa,QAAQ,MAAM;AACpC,SAASC,IAAI,QAAQ,OAAO;AAE5B,0BAA0B;AAC1B,MAAMC,aAAaF,cAAc,YAAYG,GAAG;AAChD,MAAMC,YAAYL,KAAKM,OAAO,CAACH;AA0B/B;;;CAGC,GACD,SAASI,iBAAiBC,OAAe;IACvC,MAAMC,mBAAmB;IACzB,MAAMC,QAAQF,QAAQE,KAAK,CAACD;IAE5B,IAAI,CAACC,OAAO;QACV,OAAO;YAAEC,aAAa,CAAC;YAA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C,OACnCH,aAAarD,KAAK,CAAC,IAAI,CAAC,EAAE,GAC1ByD;IAGJ,yBAAyB;IACzB,MAAMC,aAA8B;QAClCC,MAAM/D,YAAY+D,IAAI,IAAI5B;QAC1B6B,aAAahE,YAAYgE,WAAW,IAAI;QACxCC,OAAOC,MAAMC,OAAO,CAACnE,YAAYiE,KAAK,IAAIjE,YAAYiE,KAAK,GAAG,EAAE;QAChEG,OAAOpE,YAAYoE,KAAK,IAAI;QAC5BC,MAAMrE,YAAYqE,IAAI;QACtBC,OAAOtE,YAAYsE,KAAK;QACxBC,WAAWvE,YAAYuE,SAAS,GAAGC,SAASC,OAAOzE,YAAYuE,SAAS,GAAG,MAAMV;QACjFa,cAAc1E,YAAY0E,YAAY;QACtCC,kBAAkB3E,YAAY2E,gBAAgB;QAC9CC,WAAW5E,YAAY4E,SAAS;QAChC/E,SAASI;QACTqD;QACAK;IACF;IAEA,OAAOG;AACT;AAEA;;CAEC,GACD,OAAO,eAAee,qBAAqBzC,UAAkB,gBAAgB;IAC3E,MAAMQ,UAAU,GAAGR,QAAQ,QAAQ,CAAC;IACpC,MAAMS,QAAQ,MAAMtD,KAAKqD,SAAS;QAAEE,OAAO;IAAK;IAEhD,OAAOD,MAAMf,GAAG,CAACoB,CAAAA,IAAK7D,KAAK8D,QAAQ,CAACD,GAAG;AACzC;AAEA;;CAEC,GACD,OAAO,SAAS4B,mBAAmBhB,UAA2B;IAC5D,MAAMjE,UAAUiE,WAAWjE,OAAO,CAACyC,WAAW;IAC9C,OACEzC,QAAQ+D,QAAQ,CAAC,eACjB/D,QAAQ+D,QAAQ,CAAC,gCACjB/D,QAAQ+D,QAAQ,CAAC;AAErB"}
1
+ {"version":3,"sources":["../../src/cli/agent-definition-parser.ts"],"sourcesContent":["/**\r\n * Agent Definition Parser\r\n *\r\n * Parses agent definition files (.md) with YAML frontmatter and markdown content.\r\n * Supports agent definitions in .claude/agents/ directory structure.\r\n */\r\n\r\nimport fs from 'fs/promises';\r\nimport path from 'path';\r\nimport { fileURLToPath } from 'url';\r\nimport { glob } from 'glob';\r\nimport { execSync } from 'child_process';\r\n\r\n// ES Module compatibility\r\nconst __filename = fileURLToPath(import.meta.url);\r\nconst __dirname = path.dirname(__filename);\r\n\r\n/**\r\n * Detect project root dynamically\r\n * Uses PROJECT_ROOT env var if set, otherwise tries git, falls back to cwd\r\n */\r\nfunction getProjectRoot(): string {\r\n // 1. Check environment variable\r\n if (process.env.PROJECT_ROOT) {\r\n return process.env.PROJECT_ROOT;\r\n }\r\n\r\n // 2. Try git rev-parse (most reliable)\r\n try {\r\n const gitRoot = execSync('git rev-parse --show-toplevel', {\r\n encoding: 'utf-8',\r\n cwd: process.cwd(),\r\n stdio: ['pipe', 'pipe', 'ignore']\r\n }).trim();\r\n if (gitRoot) {\r\n return gitRoot;\r\n }\r\n } catch {\r\n // Fall through to next method\r\n }\r\n\r\n // 3. Fall back to current working directory\r\n return process.cwd();\r\n}\r\n\r\nconst projectRoot = getProjectRoot();\r\n\r\nexport interface AgentDefinition {\r\n // YAML frontmatter fields\r\n name: string;\r\n description: string;\r\n tools: string[];\r\n model: 'haiku' | 'sonnet' | 'opus';\r\n type?: string;\r\n color?: string;\r\n acl_level?: number;\r\n capabilities?: string[];\r\n validation_hooks?: string[];\r\n lifecycle?: {\r\n pre_task?: string;\r\n post_task?: string;\r\n };\r\n\r\n // Parsed markdown content\r\n content: string;\r\n\r\n // File metadata\r\n filePath: string;\r\n category?: string; // e.g., 'core-agents', 'specialized', 'custom'\r\n}\r\n\r\n/**\r\n * Parse YAML frontmatter from markdown content\r\n * Supports both Unix (LF) and Windows (CRLF) line endings\r\n */\r\nfunction parseFrontmatter(content: string): { frontmatter: Record<string, any>; body: string } {\r\n const frontmatterRegex = /^---\\r?\\n([\\s\\S]*?)\\r?\\n---\\r?\\n([\\s\\S]*)$/;\r\n const match = content.match(frontmatterRegex);\r\n\r\n if (!match) {\r\n return { frontmatter: {}, body: content };\r\n }\r\n\r\n const [, yamlContent, body] = match;\r\n\r\n \r\n // Simple YAML parser (handles basic key-value pairs, arrays, and objects)\r\n const frontmatter: Record<string, any> = {};\r\n const lines = yamlContent.split('\\n');\r\n let currentKey = '';\r\n let currentArray: string[] = [];\r\n let isInArray = false;\r\n let isInObject = false;\r\n let currentObject: Record<string, string> = {};\r\n let objectKey = '';\r\n\r\n for (const line of lines) {\r\n const trimmed = line.trim();\r\n if (!trimmed || trimmed.startsWith('#')) continue;\r\n\r\n // Array item\r\n if (trimmed.startsWith('- ')) {\r\n if (!isInArray) {\r\n isInArray = true;\r\n currentArray = [];\r\n }\r\n currentArray.push(trimmed.substring(2).trim());\r\n continue;\r\n }\r\n\r\n // End of array\r\n if (isInArray && !trimmed.startsWith('- ')) {\r\n frontmatter[currentKey] = currentArray;\r\n isInArray = false;\r\n currentArray = [];\r\n }\r\n\r\n // Object field (indented key-value)\r\n if (trimmed.match(/^\\s+\\w+:/) && isInObject) {\r\n const [objKey, ...objValueParts] = trimmed.split(':');\r\n const objValue = objValueParts.join(':').trim().replace(/^[\"']|[\"']$/g, '');\r\n currentObject[objKey.trim()] = objValue;\r\n continue;\r\n }\r\n\r\n // Key-value pair\r\n const colonIndex = trimmed.indexOf(':');\r\n if (colonIndex !== -1) {\r\n const key = trimmed.substring(0, colonIndex).trim();\r\n const value = trimmed.substring(colonIndex + 1).trim();\r\n\r\n // Check if this starts an object\r\n if (value === '') {\r\n isInObject = true;\r\n currentObject = {};\r\n objectKey = key;\r\n continue;\r\n }\r\n\r\n // End previous object if any\r\n if (isInObject && !trimmed.match(/^\\s+/)) {\r\n frontmatter[objectKey] = currentObject;\r\n isInObject = false;\r\n currentObject = {};\r\n }\r\n\r\n currentKey = key;\r\n\r\n // Multi-line string (starts with |)\r\n if (value === '|') {\r\n continue; // Will be handled by next lines\r\n }\r\n\r\n // Inline array (e.g., [item1, item2, item3])\r\n if (value.startsWith('[') && value.endsWith(']')) {\r\n const arrayContent = value.substring(1, value.length - 1);\r\n const items = arrayContent.split(',').map(item => item.trim());\r\n frontmatter[key] = items;\r\n continue;\r\n }\r\n\r\n // Remove quotes\r\n const cleanValue = value.replace(/^[\"']|[\"']$/g, '');\r\n frontmatter[key] = cleanValue;\r\n } else if (currentKey && trimmed && !isInArray && !isInObject) {\r\n // Continuation of multi-line string\r\n const existingValue = frontmatter[currentKey];\r\n frontmatter[currentKey] = existingValue\r\n ? `${existingValue}\\n${trimmed}`\r\n : trimmed;\r\n }\r\n }\r\n\r\n // Handle trailing array or object\r\n if (isInArray) {\r\n frontmatter[currentKey] = currentArray;\r\n }\r\n if (isInObject) {\r\n frontmatter[objectKey] = currentObject;\r\n }\r\n\r\n return { frontmatter, body: body.trim() };\r\n}\r\n\r\n/**\r\n * Find agent definition file by agent type/name\r\n * Searches multiple locations for agent definitions\r\n */\r\nasync function findAgentFile(agentType: string, baseDir?: string): Promise<string | null> {\r\n // Normalize agent type (handle both kebab-case and underscores)\r\n const normalizedType = agentType.toLowerCase().replace(/_/g, '-');\r\n\r\n // Search locations (in order of priority)\r\n // Use provided baseDir, or construct default path from project root\r\n const defaultBaseDir = path.join(projectRoot, '.claude/agents');\r\n const searchLocations = [\r\n baseDir || defaultBaseDir, // Provided or default working directory\r\n defaultBaseDir, // Standard location relative to project root\r\n path.join(__dirname, '../../.claude/agents'), // CLI installation directory\r\n '/app/.claude/agents', // Docker container location\r\n ];\r\n\r\n // Search patterns (in order of priority)\r\n const searchPatterns = [\r\n // Exact match in any subdirectory\r\n (loc: string) => `${loc}/**/${normalizedType}.md`,\r\n // Match with different casing\r\n (loc: string) => `${loc}/**/*${normalizedType}*.md`,\r\n ];\r\n\r\n for (const location of searchLocations) {\r\n for (const patternFn of searchPatterns) {\r\n const pattern = patternFn(location);\r\n try {\r\n const files = await glob(pattern, { nodir: true, absolute: true });\r\n if (files.length > 0) {\r\n // Prefer exact match over partial match\r\n const exactMatch = files.find(f => {\r\n const basename = path.basename(f, '.md').toLowerCase();\r\n return basename === normalizedType;\r\n });\r\n return exactMatch || files[0];\r\n }\r\n } catch (error) {\r\n // Skip location if it doesn't exist\r\n continue;\r\n }\r\n }\r\n }\r\n\r\n return null;\r\n}\r\n\r\n/**\r\n * Parse agent definition from file\r\n */\r\nexport async function parseAgentDefinition(agentType: string): Promise<AgentDefinition> {\r\n // Find agent file\r\n const filePath = await findAgentFile(agentType);\r\n\r\n if (!filePath) {\r\n throw new Error(`Agent definition not found: ${agentType}`);\r\n }\r\n\r\n // Read file content\r\n const content = await fs.readFile(filePath, 'utf-8');\r\n\r\n \r\n // Parse frontmatter and body\r\n const { frontmatter, body } = parseFrontmatter(content);\r\n\r\n // Extract category from path\r\n const agentsPath = path.join(projectRoot, '.claude/agents');\r\n const relativePath = path.relative(agentsPath, filePath);\r\n const category = relativePath.includes('/')\r\n ? relativePath.split('/')[0]\r\n : undefined;\r\n\r\n \r\n // Build agent definition\r\n const definition: AgentDefinition = {\r\n name: frontmatter.name || agentType,\r\n description: frontmatter.description || '',\r\n tools: Array.isArray(frontmatter.tools) ? frontmatter.tools : [],\r\n model: frontmatter.model || 'haiku',\r\n type: frontmatter.type,\r\n color: frontmatter.color,\r\n acl_level: frontmatter.acl_level ? parseInt(String(frontmatter.acl_level), 10) : undefined,\r\n capabilities: frontmatter.capabilities,\r\n validation_hooks: frontmatter.validation_hooks,\r\n lifecycle: frontmatter.lifecycle,\r\n content: body,\r\n filePath,\r\n category,\r\n };\r\n\r\n return definition;\r\n}\r\n\r\n/**\r\n * List all available agent definitions\r\n */\r\nexport async function listAgentDefinitions(baseDir: string = '.claude/agents'): Promise<string[]> {\r\n const pattern = `${baseDir}/**/*.md`;\r\n const files = await glob(pattern, { nodir: true });\r\n\r\n return files.map(f => path.basename(f, '.md'));\r\n}\r\n\r\n/**\r\n * Check if agent definition includes CFN Loop protocol\r\n */\r\nexport function hasCFNLoopProtocol(definition: AgentDefinition): boolean {\r\n const content = definition.content.toLowerCase();\r\n return (\r\n content.includes('cfn loop') &&\r\n content.includes('redis completion protocol') ||\r\n content.includes('invoke-waiting-mode.sh')\r\n );\r\n}\r\n"],"names":["fs","path","fileURLToPath","glob","execSync","__filename","url","__dirname","dirname","getProjectRoot","process","env","PROJECT_ROOT","gitRoot","encoding","cwd","stdio","trim","projectRoot","parseFrontmatter","content","frontmatterRegex","match","frontmatter","body","yamlContent","lines","split","currentKey","currentArray","isInArray","isInObject","currentObject","objectKey","line","trimmed","startsWith","push","substring","objKey","objValueParts","objValue","join","replace","colonIndex","indexOf","key","value","endsWith","arrayContent","length","items","map","item","cleanValue","existingValue","findAgentFile","agentType","baseDir","normalizedType","toLowerCase","defaultBaseDir","searchLocations","searchPatterns","loc","location","patternFn","pattern","files","nodir","absolute","exactMatch","find","f","basename","error","parseAgentDefinition","filePath","Error","readFile","agentsPath","relativePath","relative","category","includes","undefined","definition","name","description","tools","Array","isArray","model","type","color","acl_level","parseInt","String","capabilities","validation_hooks","lifecycle","listAgentDefinitions","hasCFNLoopProtocol"],"mappings":"AAAA;;;;;CAKC,GAED,OAAOA,QAAQ,cAAc;AAC7B,OAAOC,UAAU,OAAO;AACxB,SAASC,aAAa,QAAQ,MAAM;AACpC,SAASC,IAAI,QAAQ,OAAO;AAC5B,SAASC,QAAQ,QAAQ,gBAAgB;AAEzC,0BAA0B;AAC1B,MAAMC,aAAaH,cAAc,YAAYI,GAAG;AAChD,MAAMC,YAAYN,KAAKO,OAAO,CAACH;AAE/B;;;CAGC,GACD,SAASI;IACP,gCAAgC;IAChC,IAAIC,QAAQC,GAAG,CAACC,YAAY,EAAE;QAC5B,OAAOF,QAAQC,GAAG,CAACC,YAAY;IACjC;IAEA,uCAAuC;IACvC,IAAI;QACF,MAAMC,UAAUT,SAAS,iCAAiC;YACxDU,UAAU;YACVC,KAAKL,QAAQK,GAAG;YAChBC,OAAO;gBAAC;gBAAQ;gBAAQ;aAAS;QACnC,GAAGC,IAAI;QACP,IAAIJ,SAAS;YACX,OAAOA;QACT;IACF,EAAE,OAAM;IACN,8BAA8B;IAChC;IAEA,4CAA4C;IAC5C,OA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UkE,WAAWlE,OAAO,CAACwC,WAAW;IAC9C,OACExC,QAAQgE,QAAQ,CAAC,eACjBhE,QAAQgE,QAAQ,CAAC,gCACjBhE,QAAQgE,QAAQ,CAAC;AAErB"}
@@ -15,7 +15,37 @@ import { convertToolNames } from './tool-definitions.js';
15
15
  import fs from 'fs/promises';
16
16
  import path from 'path';
17
17
  import os from 'os';
18
+ import { execSync } from 'child_process';
18
19
  const execAsync = promisify(exec);
20
+ /**
21
+ * Detect project root dynamically
22
+ * Uses PROJECT_ROOT env var if set, otherwise tries git, falls back to cwd
23
+ */ function getProjectRoot() {
24
+ // 1. Check environment variable
25
+ if (process.env.PROJECT_ROOT) {
26
+ return process.env.PROJECT_ROOT;
27
+ }
28
+ // 2. Try git rev-parse (most reliable)
29
+ try {
30
+ const gitRoot = execSync('git rev-parse --show-toplevel', {
31
+ encoding: 'utf-8',
32
+ cwd: process.cwd(),
33
+ stdio: [
34
+ 'pipe',
35
+ 'pipe',
36
+ 'ignore'
37
+ ]
38
+ }).trim();
39
+ if (gitRoot) {
40
+ return gitRoot;
41
+ }
42
+ } catch {
43
+ // Fall through to next method
44
+ }
45
+ // 3. Fall back to current working directory
46
+ return process.cwd();
47
+ }
48
+ const projectRoot = getProjectRoot();
19
49
  // Bug #6 Fix: Read Redis connection parameters from process.env
20
50
  // ENV-001: Standardized environment variable naming (REDIS_PASSWORD for all deployments)
21
51
  const redisHost = process.env.CFN_REDIS_HOST || 'cfn-redis';
@@ -124,7 +154,7 @@ const redisPassword = process.env.CFN_REDIS_PASSWORD || process.env.REDIS_PASSWO
124
154
  }
125
155
  // Check config file (.claude/config/api-provider.json)
126
156
  try {
127
- const configPath = path.join('.claude', 'config', 'api-provider.json');
157
+ const configPath = path.join(projectRoot, '.claude', 'config', 'api-provider.json');
128
158
  const config = JSON.parse(await fs.readFile(configPath, 'utf-8'));
129
159
  return config.provider === 'zai' || config.provider === 'z.ai';
130
160
  } catch {
@@ -269,7 +299,7 @@ const redisPassword = process.env.CFN_REDIS_PASSWORD || process.env.REDIS_PASSWO
269
299
  console.log(`[agent-executor] Model: ${definition.model}`);
270
300
  console.log(`[agent-executor] Prompt file: ${promptFile}`);
271
301
  return new Promise((resolve)=>{
272
- const scriptPath = path.join('.claude', 'skills', 'agent-execution', 'execute-agent.sh');
302
+ const scriptPath = path.join(projectRoot, '.claude', 'skills', 'agent-execution', 'execute-agent.sh');
273
303
  // Build environment variables - WHITELIST ONLY APPROACH
274
304
  // SECURITY FIX: Do not use ...process.env spread which exposes ALL variables including secrets
275
305
  // Instead, explicitly whitelist safe variables to pass to spawned process