claude-flow-novice 2.15.11 → 2.16.1

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 (741) hide show
  1. package/.claude/cfn-extras/agents/cfn-v3-coordinator.md +517 -0
  2. package/.claude/cfn-extras/skills/GOOGLE_SHEETS_SKILLS_README.md +1 -1
  3. package/.claude/cfn-extras/skills/google-sheets-api-coordinator/SKILL.md +1 -1
  4. package/.claude/cfn-extras/skills/google-sheets-formula-builder/SKILL.md +1 -1
  5. package/.claude/cfn-extras/skills/google-sheets-progress/SKILL.md +1 -1
  6. package/.claude/commands/CFN_LOOP_FRONTEND.md +1 -1
  7. package/.claude/commands/cfn-loop-cli.md +214 -442
  8. package/.claude/commands/cfn-loop-frontend.md +1 -1
  9. package/.claude/commands/cfn-loop-task.md +2 -2
  10. package/.claude/commands/cfn-loop-trigger.md +114 -0
  11. package/.claude/commands/deprecated/cfn-loop.md +2 -2
  12. package/.claude/hooks/cfn-invoke-post-edit-ts.sh +100 -0
  13. package/.claude/hooks/cfn-invoke-post-edit-ts.sh.backup +78 -0
  14. package/.claude/hooks/cfn-invoke-post-edit.sh +53 -5
  15. package/.claude/hooks/cfn-invoke-post-edit.sh.backup +87 -0
  16. package/.claude/hooks/cfn-invoke-pre-edit-ts.sh +116 -0
  17. package/.claude/hooks/cfn-invoke-pre-edit-ts.sh.backup +94 -0
  18. package/.claude/hooks/cfn-invoke-pre-edit.sh +22 -0
  19. package/.claude/hooks/cfn-invoke-pre-edit.sh.backup +88 -0
  20. package/.claude/hooks/cfn-post-edit.config.json +9 -2
  21. package/.claude/root-claude-distribute/CFN-CLAUDE.md +1 -1
  22. package/.claude/skills/cfn-agent-spawning/SKILL.md +48 -1
  23. package/.claude/skills/cfn-agent-spawning/SKILL.md.backup +135 -0
  24. package/.claude/skills/cfn-agent-spawning/TYPESCRIPT_MIGRATION.md +567 -0
  25. package/.claude/skills/cfn-agent-spawning/check-dependencies.sh +22 -0
  26. package/.claude/skills/{cfn-redis-coordination/check-dependencies.sh → cfn-agent-spawning/check-dependencies.sh.backup} +3 -5
  27. package/.claude/skills/cfn-agent-spawning/get-agent-provider-env.sh +22 -0
  28. package/.claude/skills/cfn-agent-spawning/get-agent-provider-env.sh.backup +127 -0
  29. package/.claude/skills/cfn-agent-spawning/parse-agent-provider.sh +22 -0
  30. package/.claude/skills/cfn-agent-spawning/parse-agent-provider.sh.backup +59 -0
  31. package/.claude/skills/cfn-agent-spawning/spawn-agent-wrapper.sh +63 -0
  32. package/.claude/skills/cfn-agent-spawning/spawn-agent-wrapper.sh.backup +41 -0
  33. package/.claude/skills/cfn-agent-spawning/spawn-agent.sh +26 -1
  34. package/.claude/skills/cfn-agent-spawning/spawn-templates.sh +22 -0
  35. package/.claude/skills/cfn-agent-spawning/spawn-templates.sh.backup +613 -0
  36. package/.claude/skills/cfn-agent-spawning/spawn-worker.sh +22 -0
  37. package/.claude/skills/cfn-agent-spawning/spawn-worker.sh.backup +176 -0
  38. package/.claude/skills/cfn-backlog-management/SKILL.md +1 -1
  39. package/.claude/skills/cfn-loop-orchestration/.backups/unknown/1763619700_33aff4a69b99159e4e849107ebc4d09f/metadata.json +8 -0
  40. package/.claude/skills/cfn-loop-orchestration/.backups/unknown/1763619700_33aff4a69b99159e4e849107ebc4d09f/original +271 -0
  41. package/.claude/skills/cfn-loop-orchestration/.backups/unknown/1763619700_33aff4a69b99159e4e849107ebc4d09f/revert.sh +7 -0
  42. package/.claude/skills/cfn-loop-orchestration/.backups/unknown/1763671642_06496e8c399a79db08167cc00ed4b31e/metadata.json +8 -0
  43. package/.claude/skills/cfn-loop-orchestration/.backups/unknown/1763671642_06496e8c399a79db08167cc00ed4b31e/original +325 -0
  44. package/.claude/skills/cfn-loop-orchestration/.backups/unknown/1763671642_06496e8c399a79db08167cc00ed4b31e/revert.sh +7 -0
  45. package/.claude/skills/cfn-loop-orchestration/CLI_IMPLEMENTATION_SUMMARY.md +330 -0
  46. package/.claude/skills/cfn-loop-orchestration/CONFIGURATION_IMPROVEMENTS.md +318 -0
  47. package/.claude/skills/cfn-loop-orchestration/CONTEXT_LOOKUP_MIGRATION.md +308 -0
  48. package/.claude/skills/cfn-loop-orchestration/CONTEXT_LOOKUP_QUICK_START.md +378 -0
  49. package/.claude/skills/cfn-loop-orchestration/E2E_VALIDATION_REPORT.md +262 -0
  50. package/.claude/skills/cfn-loop-orchestration/IMPLEMENTATION_SUMMARY.md +319 -519
  51. package/.claude/skills/cfn-loop-orchestration/NORTH_STAR_E2E_REPORT.md +299 -0
  52. package/.claude/skills/cfn-loop-orchestration/NORTH_STAR_EXECUTION_SUMMARY.md +403 -0
  53. package/.claude/skills/cfn-loop-orchestration/NORTH_STAR_INDEX.md +323 -0
  54. package/.claude/skills/cfn-loop-orchestration/SKILL.md +159 -48
  55. package/.claude/skills/cfn-loop-orchestration/SPAWN_AGENTS_IMPLEMENTATION.md +188 -0
  56. package/.claude/skills/cfn-loop-orchestration/TEST_COVERAGE_REPORT.md +335 -0
  57. package/.claude/skills/cfn-loop-orchestration/TEST_COVERAGE_SUMMARY.md +456 -0
  58. package/.claude/skills/cfn-loop-orchestration/TYPESCRIPT_INTEGRATION_REPORT.md +709 -0
  59. package/.claude/skills/cfn-loop-orchestration/TYPESCRIPT_INTEGRATION_SUMMARY.md +257 -0
  60. package/.claude/skills/cfn-loop-orchestration/VALIDATION_REPORT.md +572 -0
  61. package/.claude/skills/cfn-loop-orchestration/VALIDATION_SUMMARY.txt +196 -0
  62. package/.claude/skills/cfn-loop-orchestration/VALIDATOR_MODULE_GUIDE.md +526 -0
  63. package/.claude/skills/cfn-loop-orchestration/archive/legacy-bash/README.md +167 -0
  64. package/.claude/skills/cfn-loop-orchestration/archive/legacy-bash/orchestrate-enhanced.sh +548 -0
  65. package/.claude/skills/cfn-loop-orchestration/{orchestrate-wrapper.sh → archive/legacy-bash/orchestrate-wrapper.sh} +11 -1
  66. package/.claude/skills/cfn-loop-orchestration/archive/legacy-bash/orchestrate.sh +182 -0
  67. package/.claude/skills/cfn-loop-orchestration/e2e-validation-fixed.js +240 -0
  68. package/.claude/skills/cfn-loop-orchestration/e2e-validation.js +213 -0
  69. package/.claude/skills/cfn-loop-orchestration/package-lock.json +3 -0
  70. package/.claude/skills/cfn-loop-orchestration/package.json +4 -0
  71. package/.claude/skills/cfn-loop-orchestration/run-north-star-e2e.ts +210 -0
  72. package/.claude/skills/cfn-loop-orchestration/src/cli/orchestrator-cli.ts +396 -0
  73. package/.claude/skills/cfn-loop-orchestration/src/helpers/CONFIDENCE_AGGREGATOR.md +564 -0
  74. package/.claude/skills/cfn-loop-orchestration/src/helpers/CONFIDENCE_AGGREGATOR_QUICK_REF.md +241 -0
  75. package/.claude/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_IMPLEMENTATION.md +375 -0
  76. package/.claude/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_QUICK_REFERENCE.md +362 -0
  77. package/.claude/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_README.md +307 -0
  78. package/.claude/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_USAGE_GUIDE.md +508 -0
  79. package/.claude/skills/cfn-loop-orchestration/src/helpers/confidence-aggregator.ts +473 -0
  80. package/.claude/skills/cfn-loop-orchestration/src/helpers/consensus.ts +1 -1
  81. package/.claude/skills/cfn-loop-orchestration/src/helpers/context-injector.ts +349 -0
  82. package/.claude/skills/cfn-loop-orchestration/src/helpers/context-lookup.ts +486 -0
  83. package/.claude/skills/cfn-loop-orchestration/src/helpers/deliverable-verifier.ts +6 -2
  84. package/.claude/skills/cfn-loop-orchestration/src/helpers/gate-check.ts +1 -1
  85. package/.claude/skills/cfn-loop-orchestration/src/helpers/product-owner-decision.ts +316 -0
  86. package/.claude/skills/cfn-loop-orchestration/src/helpers/spawn-agents.ts +357 -0
  87. package/.claude/skills/cfn-loop-orchestration/src/helpers/validator.ts +276 -0
  88. package/.claude/skills/cfn-loop-orchestration/src/index.ts +2 -0
  89. package/.claude/skills/cfn-loop-orchestration/src/orchestrate.ts +743 -2
  90. package/.claude/skills/cfn-loop-orchestration/src/types.ts +56 -0
  91. package/.claude/skills/cfn-loop-orchestration/test-cli.sh +92 -0
  92. package/.claude/skills/cfn-loop-orchestration/test-typescript-integration.sh +442 -0
  93. package/.claude/skills/cfn-loop-orchestration/tests/agent-spawner.test.ts +124 -0
  94. package/.claude/skills/cfn-loop-orchestration/tests/confidence-aggregator.test.ts +604 -0
  95. package/.claude/skills/cfn-loop-orchestration/tests/context-injector.test.ts +561 -0
  96. package/.claude/skills/cfn-loop-orchestration/tests/context-lookup.test.ts +661 -0
  97. package/.claude/skills/cfn-loop-orchestration/tests/deliverable-verifier.test.ts +2 -2
  98. package/.claude/skills/cfn-loop-orchestration/tests/gate-check-edge-cases.test.ts +422 -0
  99. package/.claude/skills/cfn-loop-orchestration/tests/gate-checker.test.ts +276 -0
  100. package/.claude/skills/cfn-loop-orchestration/tests/logger.test.ts +291 -0
  101. package/.claude/skills/cfn-loop-orchestration/tests/north-star-e2e.test.ts +334 -0
  102. package/.claude/skills/cfn-loop-orchestration/tests/redis-coordinator.test.ts +321 -0
  103. package/.claude/skills/cfn-loop-orchestration/tests/spawn-agents.test.ts +284 -0
  104. package/.claude/skills/cfn-loop-orchestration/tests/validator.test.ts +643 -0
  105. package/.claude/skills/cfn-loop-validation/IMPLEMENTATION_SUMMARY.md +672 -0
  106. package/.claude/skills/cfn-loop-validation/INDEX.md +531 -0
  107. package/.claude/skills/cfn-loop-validation/README_TYPESCRIPT.md +454 -0
  108. package/.claude/skills/cfn-loop-validation/SKILL.md +48 -1
  109. package/.claude/skills/cfn-loop-validation/SKILL.md.backup +353 -0
  110. package/.claude/skills/cfn-loop-validation/SKILL_TYPESCRIPT.md +782 -0
  111. package/.claude/skills/cfn-loop-validation/VAPOR_DETECTION_EXAMPLES.md +598 -0
  112. package/.claude/skills/cfn-loop-validation/check-dependencies.sh +22 -0
  113. package/{claude-assets/skills/cfn-redis-coordination/check-dependencies.sh → .claude/skills/cfn-loop-validation/check-dependencies.sh.backup} +4 -5
  114. package/.claude/skills/cfn-loop-validation/detect-vapor.sh +59 -0
  115. package/.claude/skills/cfn-loop-validation/detect-vapor.sh.backup +37 -0
  116. package/.claude/skills/cfn-loop-validation/dist/.tsbuildinfo +1 -0
  117. package/.claude/skills/cfn-loop-validation/dist/cli/detect-vapor.d.ts +14 -0
  118. package/.claude/skills/cfn-loop-validation/dist/cli/detect-vapor.d.ts.map +1 -0
  119. package/.claude/skills/cfn-loop-validation/dist/cli/detect-vapor.js +185 -0
  120. package/.claude/skills/cfn-loop-validation/dist/cli/detect-vapor.js.map +1 -0
  121. package/.claude/skills/cfn-loop-validation/dist/cli/validate-deliverables.d.ts +14 -0
  122. package/.claude/skills/cfn-loop-validation/dist/cli/validate-deliverables.d.ts.map +1 -0
  123. package/.claude/skills/cfn-loop-validation/dist/cli/validate-deliverables.js +176 -0
  124. package/.claude/skills/cfn-loop-validation/dist/cli/validate-deliverables.js.map +1 -0
  125. package/.claude/skills/cfn-loop-validation/dist/cli/validate-gate.d.ts +19 -0
  126. package/.claude/skills/cfn-loop-validation/dist/cli/validate-gate.d.ts.map +1 -0
  127. package/.claude/skills/cfn-loop-validation/dist/cli/validate-gate.js +123 -0
  128. package/.claude/skills/cfn-loop-validation/dist/cli/validate-gate.js.map +1 -0
  129. package/.claude/skills/cfn-loop-validation/dist/types.d.ts +156 -0
  130. package/.claude/skills/cfn-loop-validation/dist/types.d.ts.map +1 -0
  131. package/.claude/skills/cfn-loop-validation/dist/types.js +66 -0
  132. package/.claude/skills/cfn-loop-validation/dist/types.js.map +1 -0
  133. package/.claude/skills/cfn-loop-validation/dist/validator.d.ts +85 -0
  134. package/.claude/skills/cfn-loop-validation/dist/validator.d.ts.map +1 -0
  135. package/.claude/skills/cfn-loop-validation/dist/validator.js +411 -0
  136. package/.claude/skills/cfn-loop-validation/dist/validator.js.map +1 -0
  137. package/.claude/skills/cfn-loop-validation/orchestrate-cfn-loop.sh +22 -0
  138. package/.claude/skills/cfn-loop-validation/orchestrate-cfn-loop.sh.backup +252 -0
  139. package/.claude/skills/cfn-loop-validation/package.json +93 -0
  140. package/.claude/skills/cfn-loop-validation/src/cli/detect-vapor.ts +177 -0
  141. package/.claude/skills/cfn-loop-validation/src/cli/validate-deliverables.ts +161 -0
  142. package/.claude/skills/cfn-loop-validation/src/cli/validate-gate.ts +139 -0
  143. package/.claude/skills/cfn-loop-validation/src/types.ts +215 -0
  144. package/.claude/skills/cfn-loop-validation/src/validator.ts +503 -0
  145. package/.claude/skills/cfn-loop-validation/tests/validator.test.ts +537 -0
  146. package/.claude/skills/{cfn-redis-coordination → cfn-loop-validation}/tsconfig.json +34 -31
  147. package/.claude/skills/cfn-loop-validation/validate-deliverables.sh +59 -0
  148. package/.claude/skills/cfn-loop-validation/validate-deliverables.sh.backup +37 -0
  149. package/.claude/skills/cfn-loop-validation/validate-gate.sh +63 -0
  150. package/.claude/skills/cfn-loop-validation/validate-gate.sh.backup +41 -0
  151. package/.claude/skills/cfn-loop-validation/validate-iteration.sh +22 -0
  152. package/.claude/skills/cfn-loop-validation/validate-iteration.sh.backup +134 -0
  153. package/.claude/skills/cfn-product-owner-decision/SKILL.md +479 -147
  154. package/.claude/skills/cfn-product-owner-decision/TYPESCRIPT_IMPLEMENTATION.md +653 -0
  155. package/.claude/skills/cfn-product-owner-decision/{execute-decision.sh → archive/legacy-bash/execute-decision.sh} +24 -2
  156. package/.claude/skills/pre-edit-backup/SKILL.md +324 -0
  157. package/.claude/skills/pre-edit-backup/SKILL.md.backup +277 -0
  158. package/.claude/skills/pre-edit-backup/backup.sh +22 -0
  159. package/.claude/skills/pre-edit-backup/backup.sh.backup +107 -0
  160. package/claude-assets/agents/cfn-dev-team/analysts/root-cause-analyst.md +2 -2
  161. package/claude-assets/agents/cfn-dev-team/architecture/base-template-generator.md +1 -1
  162. package/claude-assets/agents/cfn-dev-team/coordinators/cfn-frontend-coordinator.md +3 -2
  163. package/claude-assets/agents/cfn-dev-team/coordinators/consensus-builder.md +1 -0
  164. package/claude-assets/agents/cfn-dev-team/coordinators/handoff-coordinator.md +2 -1
  165. package/claude-assets/agents/cfn-dev-team/coordinators/multi-sprint-coordinator.md +1 -0
  166. package/claude-assets/agents/cfn-dev-team/dev-ops/devops-engineer.md +11 -1
  167. package/claude-assets/agents/cfn-dev-team/dev-ops/docker-specialist.md +58 -35
  168. package/claude-assets/agents/cfn-dev-team/dev-ops/github-commit-agent.md +2 -2
  169. package/claude-assets/agents/cfn-dev-team/dev-ops/kubernetes-specialist.md +47 -37
  170. package/claude-assets/agents/cfn-dev-team/developers/api-gateway-specialist.md +18 -18
  171. package/claude-assets/agents/cfn-dev-team/developers/backend-developer.md +40 -58
  172. package/claude-assets/agents/cfn-dev-team/developers/data/data-engineer.md +19 -21
  173. package/claude-assets/agents/cfn-dev-team/developers/database/database-architect.md +20 -29
  174. package/claude-assets/agents/cfn-dev-team/developers/frontend/mobile-dev.md +15 -19
  175. package/claude-assets/agents/cfn-dev-team/developers/frontend/react-frontend-engineer.md +15 -10
  176. package/claude-assets/agents/cfn-dev-team/developers/frontend/typescript-specialist.md +16 -11
  177. package/claude-assets/agents/cfn-dev-team/developers/frontend/ui-designer.md +16 -26
  178. package/claude-assets/agents/cfn-dev-team/developers/graphql-specialist.md +18 -22
  179. package/claude-assets/agents/cfn-dev-team/developers/rust-developer.md +17 -21
  180. package/claude-assets/agents/cfn-dev-team/documentation/pseudocode.md +1 -1
  181. package/claude-assets/agents/cfn-dev-team/product-owners/accessibility-advocate-persona.md +1 -1
  182. package/claude-assets/agents/cfn-dev-team/product-owners/cto-agent.md +1 -1
  183. package/claude-assets/agents/cfn-dev-team/product-owners/power-user-persona.md +1 -1
  184. package/claude-assets/agents/cfn-dev-team/product-owners/product-owner.md +1 -5
  185. package/claude-assets/agents/cfn-dev-team/reviewers/code-reviewer.md +20 -51
  186. package/claude-assets/agents/cfn-dev-team/reviewers/quality/code-quality-validator.md +22 -71
  187. package/claude-assets/agents/cfn-dev-team/reviewers/quality/perf-analyzer.md +21 -64
  188. package/claude-assets/agents/cfn-dev-team/reviewers/quality/performance-benchmarker.md +22 -67
  189. package/claude-assets/agents/cfn-dev-team/reviewers/quality/security-specialist.md +24 -68
  190. package/claude-assets/agents/cfn-dev-team/testers/api-testing-specialist.md +8 -36
  191. package/claude-assets/agents/cfn-dev-team/testers/chaos-engineering-specialist.md +9 -38
  192. package/claude-assets/agents/cfn-dev-team/testers/contract-tester.md +17 -55
  193. package/claude-assets/agents/cfn-dev-team/testers/e2e/playwright-tester.md +1 -1
  194. package/claude-assets/agents/cfn-dev-team/testers/integration-tester.md +18 -56
  195. package/claude-assets/agents/cfn-dev-team/testers/interaction-tester.md +9 -37
  196. package/claude-assets/agents/cfn-dev-team/testers/load-testing-specialist.md +18 -56
  197. package/claude-assets/agents/cfn-dev-team/testers/mutation-testing-specialist.md +18 -49
  198. package/claude-assets/agents/cfn-dev-team/testers/playwright-tester.md +8 -37
  199. package/claude-assets/agents/cfn-dev-team/testers/tester.md +7 -27
  200. package/claude-assets/agents/cfn-dev-team/testers/unit/tdd-london-unit-swarm.md +1 -1
  201. package/claude-assets/agents/cfn-dev-team/utility/agent-builder.md +11 -0
  202. package/claude-assets/agents/cfn-dev-team/utility/analyst.md +13 -29
  203. package/claude-assets/agents/cfn-dev-team/utility/claude-code-expert.md +1 -1
  204. package/claude-assets/agents/cfn-dev-team/utility/code-booster.md +13 -13
  205. package/claude-assets/agents/cfn-dev-team/utility/context-curator.md +7 -2
  206. package/claude-assets/agents/cfn-dev-team/utility/epic-creator.md +6 -11
  207. package/claude-assets/agents/cfn-dev-team/utility/memory-leak-specialist.md +121 -715
  208. package/claude-assets/agents/cfn-dev-team/utility/researcher.md +13 -22
  209. package/claude-assets/agents/cfn-dev-team/utility/z-ai-specialist.md +147 -573
  210. package/claude-assets/agents/custom/cfn-docker-expert.md +103 -0
  211. package/claude-assets/agents/custom/cfn-loops-cli-expert.md +438 -0
  212. package/claude-assets/agents/custom/cfn-redis-operations.md +529 -529
  213. package/claude-assets/agents/custom/cfn-system-expert.md +1 -1
  214. package/claude-assets/agents/custom/trigger-dev-expert.md +369 -0
  215. package/claude-assets/agents/docker-team/micro-sprint-planner.md +747 -747
  216. package/claude-assets/agents/project-only-agents/npm-package-specialist.md +1 -1
  217. package/claude-assets/cfn-extras/agents/cfn-v3-coordinator.md +517 -0
  218. package/claude-assets/cfn-extras/skills/GOOGLE_SHEETS_SKILLS_README.md +1 -1
  219. package/claude-assets/cfn-extras/skills/google-sheets-api-coordinator/SKILL.md +1 -1
  220. package/claude-assets/cfn-extras/skills/google-sheets-formula-builder/SKILL.md +1 -1
  221. package/claude-assets/cfn-extras/skills/google-sheets-progress/SKILL.md +1 -1
  222. package/claude-assets/commands/CFN_LOOP_FRONTEND.md +1 -1
  223. package/claude-assets/commands/cfn-loop-cli.md +214 -442
  224. package/claude-assets/commands/cfn-loop-frontend.md +1 -1
  225. package/claude-assets/commands/cfn-loop-task.md +2 -2
  226. package/claude-assets/commands/cfn-loop-trigger.md +114 -0
  227. package/claude-assets/commands/deprecated/cfn-loop.md +2 -2
  228. package/claude-assets/hooks/GIT-HOOKS-USAGE-EXAMPLES.md +116 -0
  229. package/claude-assets/hooks/README-GIT-HOOKS.md +443 -0
  230. package/claude-assets/hooks/SKILL.md +518 -0
  231. package/claude-assets/hooks/SKILL.md.backup +471 -0
  232. package/claude-assets/hooks/cfn-invoke-post-edit-ts.sh +100 -0
  233. package/claude-assets/hooks/cfn-invoke-post-edit-ts.sh.backup +78 -0
  234. package/claude-assets/hooks/cfn-invoke-post-edit.sh +53 -5
  235. package/claude-assets/hooks/cfn-invoke-post-edit.sh.backup +87 -0
  236. package/claude-assets/hooks/cfn-invoke-pre-edit-ts.sh +116 -0
  237. package/claude-assets/hooks/cfn-invoke-pre-edit-ts.sh.backup +94 -0
  238. package/claude-assets/hooks/cfn-invoke-pre-edit.sh +22 -0
  239. package/claude-assets/hooks/cfn-invoke-pre-edit.sh.backup +88 -0
  240. package/claude-assets/hooks/cfn-post-edit.config.json +9 -2
  241. package/claude-assets/hooks/install-git-hooks.sh +243 -0
  242. package/claude-assets/hooks/subagent-start.sh +98 -0
  243. package/claude-assets/hooks/subagent-stop.sh +93 -0
  244. package/claude-assets/hooks/validators/credential-scanner.sh +172 -0
  245. package/claude-assets/root-claude-distribute/CFN-CLAUDE.md +1 -1
  246. package/claude-assets/skills/cfn-agent-selection-with-fallback/DELIVERABLES.md +409 -0
  247. package/claude-assets/skills/cfn-agent-selection-with-fallback/IMPLEMENTATION_SUMMARY.md +396 -0
  248. package/claude-assets/skills/cfn-agent-selection-with-fallback/INTEGRATION_GUIDE.md +308 -0
  249. package/claude-assets/skills/cfn-agent-selection-with-fallback/QUICK_REFERENCE.md +239 -0
  250. package/claude-assets/skills/cfn-agent-selection-with-fallback/SKILL.md +107 -1
  251. package/claude-assets/skills/cfn-agent-selection-with-fallback/SKILL.md.backup +302 -0
  252. package/claude-assets/skills/cfn-agent-selection-with-fallback/TYPESCRIPT_MIGRATION.md +295 -0
  253. package/claude-assets/skills/cfn-agent-selection-with-fallback/dist/agent-selector.cjs +297 -0
  254. package/claude-assets/skills/cfn-agent-selection-with-fallback/dist/agent-selector.js +297 -0
  255. package/claude-assets/skills/cfn-agent-selection-with-fallback/dist/cli.cjs +96 -0
  256. package/claude-assets/skills/cfn-agent-selection-with-fallback/dist/cli.js +96 -0
  257. package/claude-assets/skills/cfn-agent-selection-with-fallback/select-agents-ts.sh +45 -0
  258. package/claude-assets/skills/cfn-agent-selection-with-fallback/select-agents-ts.sh.backup +23 -0
  259. package/claude-assets/skills/cfn-agent-selection-with-fallback/select-agents.sh +22 -0
  260. package/claude-assets/skills/cfn-agent-selection-with-fallback/select-agents.sh.backup +173 -0
  261. package/claude-assets/skills/cfn-agent-selection-with-fallback/src/agent-selector.test.ts +357 -0
  262. package/claude-assets/skills/cfn-agent-selection-with-fallback/src/agent-selector.ts +350 -0
  263. package/claude-assets/skills/cfn-agent-selection-with-fallback/src/cli.ts +74 -0
  264. package/claude-assets/skills/cfn-agent-selection-with-fallback/task-classifier.sh +22 -0
  265. package/claude-assets/skills/cfn-agent-selection-with-fallback/task-classifier.sh.backup +71 -0
  266. package/claude-assets/skills/cfn-agent-selection-with-fallback/tsconfig.json +18 -0
  267. package/claude-assets/skills/cfn-agent-spawning/SKILL.md +48 -1
  268. package/claude-assets/skills/cfn-agent-spawning/SKILL.md.backup +135 -0
  269. package/claude-assets/skills/cfn-agent-spawning/TYPESCRIPT_MIGRATION.md +567 -0
  270. package/claude-assets/skills/cfn-agent-spawning/check-dependencies.sh +22 -0
  271. package/claude-assets/skills/cfn-agent-spawning/check-dependencies.sh.backup +30 -0
  272. package/claude-assets/skills/cfn-agent-spawning/get-agent-provider-env.sh +22 -0
  273. package/claude-assets/skills/cfn-agent-spawning/get-agent-provider-env.sh.backup +127 -0
  274. package/claude-assets/skills/cfn-agent-spawning/parse-agent-provider.sh +22 -0
  275. package/claude-assets/skills/cfn-agent-spawning/parse-agent-provider.sh.backup +59 -0
  276. package/claude-assets/skills/cfn-agent-spawning/spawn-agent-wrapper.sh +63 -0
  277. package/claude-assets/skills/cfn-agent-spawning/spawn-agent-wrapper.sh.backup +41 -0
  278. package/claude-assets/skills/cfn-agent-spawning/spawn-agent.sh +26 -1
  279. package/claude-assets/skills/cfn-agent-spawning/spawn-templates.sh +22 -0
  280. package/claude-assets/skills/cfn-agent-spawning/spawn-templates.sh.backup +613 -0
  281. package/claude-assets/skills/cfn-agent-spawning/spawn-worker.sh +22 -0
  282. package/claude-assets/skills/cfn-agent-spawning/spawn-worker.sh.backup +176 -0
  283. package/claude-assets/skills/cfn-backlog-management/SKILL.md +1 -1
  284. package/claude-assets/skills/cfn-coordination/agent-completion.sh.backup +36 -0
  285. package/claude-assets/skills/cfn-coordination/coordination-signal.sh.backup +36 -0
  286. package/claude-assets/skills/cfn-coordination/coordination-wait.sh.backup +36 -0
  287. package/claude-assets/skills/cfn-dependency-ingestion/README.md +101 -0
  288. package/claude-assets/skills/cfn-dependency-ingestion/SKILL.md +397 -0
  289. package/claude-assets/skills/cfn-dependency-ingestion/build.sh +23 -0
  290. package/claude-assets/skills/cfn-dependency-ingestion/dist/ingest-dependencies.js +478 -0
  291. package/claude-assets/skills/cfn-dependency-ingestion/ingest-dependencies.sh +295 -0
  292. package/claude-assets/skills/cfn-dependency-ingestion/ingest.sh +237 -0
  293. package/claude-assets/skills/cfn-dependency-ingestion/manifests/cli-mode-dependencies.txt +73 -0
  294. package/claude-assets/skills/cfn-dependency-ingestion/manifests/shared-dependencies.txt +57 -0
  295. package/claude-assets/skills/cfn-dependency-ingestion/manifests/trigger-dev-dependencies.txt +82 -0
  296. package/claude-assets/skills/cfn-dependency-ingestion/manifests/trigger-mode-dependencies.txt +80 -0
  297. package/claude-assets/skills/cfn-dependency-ingestion/src/ingest-dependencies.ts +563 -0
  298. package/claude-assets/skills/cfn-environment-sanitization/sanitize-environment.sh +14 -4
  299. package/claude-assets/skills/cfn-loop-orchestration/.backups/unknown/1763619700_33aff4a69b99159e4e849107ebc4d09f/metadata.json +8 -0
  300. package/claude-assets/skills/cfn-loop-orchestration/.backups/unknown/1763619700_33aff4a69b99159e4e849107ebc4d09f/original +271 -0
  301. package/claude-assets/skills/cfn-loop-orchestration/.backups/unknown/1763619700_33aff4a69b99159e4e849107ebc4d09f/revert.sh +7 -0
  302. package/claude-assets/skills/cfn-loop-orchestration/.backups/unknown/1763671642_06496e8c399a79db08167cc00ed4b31e/metadata.json +8 -0
  303. package/claude-assets/skills/cfn-loop-orchestration/.backups/unknown/1763671642_06496e8c399a79db08167cc00ed4b31e/original +325 -0
  304. package/claude-assets/skills/cfn-loop-orchestration/.backups/unknown/1763671642_06496e8c399a79db08167cc00ed4b31e/revert.sh +7 -0
  305. package/claude-assets/skills/cfn-loop-orchestration/CLI_IMPLEMENTATION_SUMMARY.md +330 -0
  306. package/claude-assets/skills/cfn-loop-orchestration/CONFIGURATION_IMPROVEMENTS.md +318 -0
  307. package/claude-assets/skills/cfn-loop-orchestration/CONTEXT_LOOKUP_MIGRATION.md +308 -0
  308. package/claude-assets/skills/cfn-loop-orchestration/CONTEXT_LOOKUP_QUICK_START.md +378 -0
  309. package/claude-assets/skills/cfn-loop-orchestration/E2E_VALIDATION_REPORT.md +262 -0
  310. package/claude-assets/skills/cfn-loop-orchestration/IMPLEMENTATION_SUMMARY.md +319 -519
  311. package/claude-assets/skills/cfn-loop-orchestration/NORTH_STAR_E2E_REPORT.md +299 -0
  312. package/claude-assets/skills/cfn-loop-orchestration/NORTH_STAR_EXECUTION_SUMMARY.md +403 -0
  313. package/claude-assets/skills/cfn-loop-orchestration/NORTH_STAR_INDEX.md +323 -0
  314. package/claude-assets/skills/cfn-loop-orchestration/SKILL.md +159 -48
  315. package/claude-assets/skills/cfn-loop-orchestration/SPAWN_AGENTS_IMPLEMENTATION.md +188 -0
  316. package/claude-assets/skills/cfn-loop-orchestration/TEST_COVERAGE_REPORT.md +335 -0
  317. package/claude-assets/skills/cfn-loop-orchestration/TEST_COVERAGE_SUMMARY.md +456 -0
  318. package/claude-assets/skills/cfn-loop-orchestration/TYPESCRIPT_INTEGRATION_REPORT.md +709 -0
  319. package/claude-assets/skills/cfn-loop-orchestration/TYPESCRIPT_INTEGRATION_SUMMARY.md +257 -0
  320. package/claude-assets/skills/cfn-loop-orchestration/VALIDATION_REPORT.md +572 -0
  321. package/claude-assets/skills/cfn-loop-orchestration/VALIDATION_SUMMARY.txt +196 -0
  322. package/claude-assets/skills/cfn-loop-orchestration/VALIDATOR_MODULE_GUIDE.md +526 -0
  323. package/claude-assets/skills/cfn-loop-orchestration/archive/legacy-bash/README.md +167 -0
  324. package/claude-assets/skills/cfn-loop-orchestration/archive/legacy-bash/orchestrate-enhanced.sh +548 -0
  325. package/claude-assets/skills/cfn-loop-orchestration/{orchestrate-wrapper.sh → archive/legacy-bash/orchestrate-wrapper.sh} +11 -1
  326. package/claude-assets/skills/cfn-loop-orchestration/archive/legacy-bash/orchestrate.sh +182 -0
  327. package/claude-assets/skills/cfn-loop-orchestration/e2e-validation-fixed.js +240 -0
  328. package/claude-assets/skills/cfn-loop-orchestration/e2e-validation.js +213 -0
  329. package/claude-assets/skills/cfn-loop-orchestration/package-lock.json +3 -0
  330. package/claude-assets/skills/cfn-loop-orchestration/package.json +4 -0
  331. package/claude-assets/skills/cfn-loop-orchestration/run-north-star-e2e.ts +210 -0
  332. package/claude-assets/skills/cfn-loop-orchestration/src/cli/orchestrator-cli.ts +396 -0
  333. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/CONFIDENCE_AGGREGATOR.md +564 -0
  334. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/CONFIDENCE_AGGREGATOR_QUICK_REF.md +241 -0
  335. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_IMPLEMENTATION.md +375 -0
  336. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_QUICK_REFERENCE.md +362 -0
  337. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_README.md +307 -0
  338. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_USAGE_GUIDE.md +508 -0
  339. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/confidence-aggregator.ts +473 -0
  340. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/consensus.ts +1 -1
  341. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/context-injector.ts +349 -0
  342. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/context-lookup.ts +486 -0
  343. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/deliverable-verifier.ts +6 -2
  344. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/gate-check.ts +1 -1
  345. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/product-owner-decision.ts +316 -0
  346. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/spawn-agents.ts +357 -0
  347. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/validator.ts +276 -0
  348. package/claude-assets/skills/cfn-loop-orchestration/src/index.ts +2 -0
  349. package/claude-assets/skills/cfn-loop-orchestration/src/orchestrate.ts +743 -2
  350. package/claude-assets/skills/cfn-loop-orchestration/src/types.ts +56 -0
  351. package/claude-assets/skills/cfn-loop-orchestration/test-cli.sh +92 -0
  352. package/claude-assets/skills/cfn-loop-orchestration/test-typescript-integration.sh +442 -0
  353. package/claude-assets/skills/cfn-loop-orchestration/tests/agent-spawner.test.ts +124 -0
  354. package/claude-assets/skills/cfn-loop-orchestration/tests/confidence-aggregator.test.ts +604 -0
  355. package/claude-assets/skills/cfn-loop-orchestration/tests/context-injector.test.ts +561 -0
  356. package/claude-assets/skills/cfn-loop-orchestration/tests/context-lookup.test.ts +661 -0
  357. package/claude-assets/skills/cfn-loop-orchestration/tests/deliverable-verifier.test.ts +2 -2
  358. package/claude-assets/skills/cfn-loop-orchestration/tests/gate-check-edge-cases.test.ts +422 -0
  359. package/claude-assets/skills/cfn-loop-orchestration/tests/gate-checker.test.ts +276 -0
  360. package/claude-assets/skills/cfn-loop-orchestration/tests/logger.test.ts +291 -0
  361. package/claude-assets/skills/cfn-loop-orchestration/tests/north-star-e2e.test.ts +334 -0
  362. package/claude-assets/skills/cfn-loop-orchestration/tests/redis-coordinator.test.ts +321 -0
  363. package/claude-assets/skills/cfn-loop-orchestration/tests/spawn-agents.test.ts +284 -0
  364. package/claude-assets/skills/cfn-loop-orchestration/tests/validator.test.ts +643 -0
  365. package/claude-assets/skills/cfn-loop-output-processing/.eslintrc.json +33 -0
  366. package/claude-assets/skills/cfn-loop-output-processing/DELIVERY_SUMMARY.txt +462 -0
  367. package/claude-assets/skills/cfn-loop-output-processing/DEPRECATION_NOTICE.md +183 -0
  368. package/claude-assets/skills/cfn-loop-output-processing/EXAMPLES.md +609 -0
  369. package/claude-assets/skills/cfn-loop-output-processing/IMPLEMENTATION_SUMMARY.md +418 -0
  370. package/claude-assets/skills/cfn-loop-output-processing/INDEX.md +531 -0
  371. package/claude-assets/skills/cfn-loop-output-processing/MIGRATION.md +362 -0
  372. package/claude-assets/skills/cfn-loop-output-processing/README.md +114 -0
  373. package/claude-assets/skills/cfn-loop-output-processing/SKILL.md +633 -0
  374. package/{.claude/skills/cfn-docker-redis-coordination → claude-assets/skills/cfn-loop-output-processing}/jest.config.js +7 -15
  375. package/claude-assets/skills/cfn-loop-output-processing/package.json +50 -0
  376. package/claude-assets/skills/cfn-loop-output-processing/src/cli/process-loop2.ts +195 -0
  377. package/claude-assets/skills/cfn-loop-output-processing/src/cli/process-loop3.ts +157 -0
  378. package/claude-assets/skills/cfn-loop-output-processing/src/output-processor.ts +632 -0
  379. package/claude-assets/skills/cfn-loop-output-processing/tests/output-processor.test.ts +617 -0
  380. package/claude-assets/skills/{cfn-docker-redis-coordination → cfn-loop-output-processing}/tsconfig.json +16 -7
  381. package/claude-assets/skills/cfn-loop-validation/IMPLEMENTATION_SUMMARY.md +672 -0
  382. package/claude-assets/skills/cfn-loop-validation/INDEX.md +531 -0
  383. package/claude-assets/skills/cfn-loop-validation/README_TYPESCRIPT.md +454 -0
  384. package/claude-assets/skills/cfn-loop-validation/SKILL.md +48 -1
  385. package/claude-assets/skills/cfn-loop-validation/SKILL.md.backup +353 -0
  386. package/claude-assets/skills/cfn-loop-validation/SKILL_TYPESCRIPT.md +782 -0
  387. package/claude-assets/skills/cfn-loop-validation/VAPOR_DETECTION_EXAMPLES.md +598 -0
  388. package/claude-assets/skills/cfn-loop-validation/check-dependencies.sh +22 -0
  389. package/claude-assets/skills/cfn-loop-validation/check-dependencies.sh.backup +31 -0
  390. package/claude-assets/skills/cfn-loop-validation/detect-vapor.sh +59 -0
  391. package/claude-assets/skills/cfn-loop-validation/detect-vapor.sh.backup +37 -0
  392. package/claude-assets/skills/cfn-loop-validation/dist/.tsbuildinfo +1 -0
  393. package/claude-assets/skills/cfn-loop-validation/dist/cli/detect-vapor.d.ts +14 -0
  394. package/claude-assets/skills/cfn-loop-validation/dist/cli/detect-vapor.d.ts.map +1 -0
  395. package/claude-assets/skills/cfn-loop-validation/dist/cli/detect-vapor.js +185 -0
  396. package/claude-assets/skills/cfn-loop-validation/dist/cli/detect-vapor.js.map +1 -0
  397. package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-deliverables.d.ts +14 -0
  398. package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-deliverables.d.ts.map +1 -0
  399. package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-deliverables.js +176 -0
  400. package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-deliverables.js.map +1 -0
  401. package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-gate.d.ts +19 -0
  402. package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-gate.d.ts.map +1 -0
  403. package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-gate.js +123 -0
  404. package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-gate.js.map +1 -0
  405. package/claude-assets/skills/cfn-loop-validation/dist/types.d.ts +156 -0
  406. package/claude-assets/skills/cfn-loop-validation/dist/types.d.ts.map +1 -0
  407. package/claude-assets/skills/cfn-loop-validation/dist/types.js +66 -0
  408. package/claude-assets/skills/cfn-loop-validation/dist/types.js.map +1 -0
  409. package/claude-assets/skills/cfn-loop-validation/dist/validator.d.ts +85 -0
  410. package/claude-assets/skills/cfn-loop-validation/dist/validator.d.ts.map +1 -0
  411. package/claude-assets/skills/cfn-loop-validation/dist/validator.js +411 -0
  412. package/claude-assets/skills/cfn-loop-validation/dist/validator.js.map +1 -0
  413. package/claude-assets/skills/cfn-loop-validation/orchestrate-cfn-loop.sh +22 -0
  414. package/claude-assets/skills/cfn-loop-validation/orchestrate-cfn-loop.sh.backup +252 -0
  415. package/claude-assets/skills/cfn-loop-validation/package.json +93 -0
  416. package/claude-assets/skills/cfn-loop-validation/src/cli/detect-vapor.ts +177 -0
  417. package/claude-assets/skills/cfn-loop-validation/src/cli/validate-deliverables.ts +161 -0
  418. package/claude-assets/skills/cfn-loop-validation/src/cli/validate-gate.ts +139 -0
  419. package/claude-assets/skills/cfn-loop-validation/src/types.ts +215 -0
  420. package/claude-assets/skills/cfn-loop-validation/src/validator.ts +503 -0
  421. package/claude-assets/skills/cfn-loop-validation/tests/validator.test.ts +537 -0
  422. package/claude-assets/skills/{cfn-redis-coordination → cfn-loop-validation}/tsconfig.json +34 -31
  423. package/claude-assets/skills/cfn-loop-validation/validate-deliverables.sh +59 -0
  424. package/claude-assets/skills/cfn-loop-validation/validate-deliverables.sh.backup +37 -0
  425. package/claude-assets/skills/cfn-loop-validation/validate-gate.sh +63 -0
  426. package/claude-assets/skills/cfn-loop-validation/validate-gate.sh.backup +41 -0
  427. package/claude-assets/skills/cfn-loop-validation/validate-iteration.sh +22 -0
  428. package/claude-assets/skills/cfn-loop-validation/validate-iteration.sh.backup +134 -0
  429. package/claude-assets/skills/cfn-product-owner-decision/SKILL.md +479 -147
  430. package/claude-assets/skills/cfn-product-owner-decision/TYPESCRIPT_IMPLEMENTATION.md +653 -0
  431. package/claude-assets/skills/cfn-product-owner-decision/{execute-decision.sh → archive/legacy-bash/execute-decision.sh} +24 -2
  432. package/claude-assets/skills/cfn-provider-routing/README.md +129 -0
  433. package/claude-assets/skills/cfn-provider-routing/SKILL.md +215 -0
  434. package/claude-assets/skills/cfn-provider-routing/resolve-provider-model.ts +223 -0
  435. package/claude-assets/skills/docker-build/build.sh +1 -1
  436. package/claude-assets/skills/pre-edit-backup/SKILL.md +324 -0
  437. package/claude-assets/skills/pre-edit-backup/SKILL.md.backup +277 -0
  438. package/claude-assets/skills/pre-edit-backup/backup.sh +22 -0
  439. package/claude-assets/skills/pre-edit-backup/backup.sh.backup +107 -0
  440. package/dist/agent/skill-mcp-selector.js +2 -1
  441. package/dist/agent/skill-mcp-selector.js.map +1 -1
  442. package/dist/api/auth-endpoints.js +415 -0
  443. package/dist/api/auth-endpoints.js.map +1 -0
  444. package/dist/api/task-endpoints.js +562 -0
  445. package/dist/api/task-endpoints.js.map +1 -0
  446. package/dist/backend/server.js +418 -0
  447. package/dist/backend/server.js.map +1 -0
  448. package/dist/cfn-loop/product-owner/decision-parser.js +356 -0
  449. package/dist/cfn-loop/product-owner/decision-parser.js.map +1 -0
  450. package/dist/cfn-loop/product-owner/index.js +1 -0
  451. package/dist/cfn-loop/product-owner/index.js.map +1 -1
  452. package/dist/cli/agent-command.js +1 -1
  453. package/dist/cli/agent-command.js.map +1 -1
  454. package/dist/cli/agent-completion.js +273 -0
  455. package/dist/cli/agent-completion.js.map +1 -0
  456. package/dist/cli/agent-executor.js +470 -26
  457. package/dist/cli/agent-executor.js.map +1 -1
  458. package/dist/cli/agent-prompt-builder.js +83 -48
  459. package/dist/cli/agent-prompt-builder.js.map +1 -1
  460. package/dist/cli/agent-spawn.js +7 -4
  461. package/dist/cli/agent-spawn.js.map +1 -1
  462. package/dist/cli/agent-spawner.js +546 -0
  463. package/dist/cli/agent-spawner.js.map +1 -0
  464. package/dist/cli/agent-token-manager.js +2 -1
  465. package/dist/cli/agent-token-manager.js.map +1 -1
  466. package/dist/cli/anthropic-client.js +127 -14
  467. package/dist/cli/anthropic-client.js.map +1 -1
  468. package/dist/cli/cfn-context.js +2 -1
  469. package/dist/cli/cfn-context.js.map +1 -1
  470. package/dist/cli/cfn-metrics.js +2 -1
  471. package/dist/cli/cfn-metrics.js.map +1 -1
  472. package/dist/cli/cfn-redis.js +2 -1
  473. package/dist/cli/cfn-redis.js.map +1 -1
  474. package/dist/cli/cli-agent-context.js +2 -0
  475. package/dist/cli/cli-agent-context.js.map +1 -1
  476. package/dist/cli/config-manager.js +90 -356
  477. package/dist/cli/config-manager.js.map +1 -1
  478. package/dist/cli/conversation-fork-cleanup.js +2 -1
  479. package/dist/cli/conversation-fork-cleanup.js.map +1 -1
  480. package/dist/cli/conversation-fork.js +2 -1
  481. package/dist/cli/conversation-fork.js.map +1 -1
  482. package/dist/cli/coordination/agent-messaging.js +415 -0
  483. package/dist/cli/coordination/agent-messaging.js.map +1 -0
  484. package/dist/cli/coordination/wait-for-threshold.js +232 -0
  485. package/dist/cli/coordination/wait-for-threshold.js.map +1 -0
  486. package/dist/cli/index.js +11 -0
  487. package/dist/cli/index.js.map +1 -1
  488. package/dist/cli/iteration-history.js +2 -1
  489. package/dist/cli/iteration-history.js.map +1 -1
  490. package/dist/cli/parse-decision-cli.js +268 -0
  491. package/dist/cli/parse-decision-cli.js.map +1 -0
  492. package/dist/cli/post-edit-hook.js +83 -0
  493. package/dist/cli/post-edit-hook.js.map +1 -0
  494. package/dist/cli/pre-edit-hook.js +77 -0
  495. package/dist/cli/pre-edit-hook.js.map +1 -0
  496. package/dist/cli/process-lifecycle.js +5 -1
  497. package/dist/cli/process-lifecycle.js.map +1 -1
  498. package/dist/cli/spawn-agent-cli.js +244 -0
  499. package/dist/cli/spawn-agent-cli.js.map +1 -0
  500. package/dist/coordination/coordination-wrapper.js +383 -0
  501. package/dist/coordination/coordination-wrapper.js.map +1 -0
  502. package/dist/coordination/redis-waiting-mode.js +4 -0
  503. package/dist/coordination/redis-waiting-mode.js.map +1 -1
  504. package/dist/coordination/store-success-criteria.js +68 -0
  505. package/dist/coordination/store-success-criteria.js.map +1 -0
  506. package/dist/coordination/store-task-context.js +65 -0
  507. package/dist/coordination/store-task-context.js.map +1 -0
  508. package/dist/hooks/backup-manager.js +273 -0
  509. package/dist/hooks/backup-manager.js.map +1 -0
  510. package/dist/hooks/post-edit-validator.js +388 -0
  511. package/dist/hooks/post-edit-validator.js.map +1 -0
  512. package/dist/integration/index.js +19 -0
  513. package/dist/integration/index.js.map +1 -0
  514. package/dist/integration/task-mode-adapter.js +297 -0
  515. package/dist/integration/task-mode-adapter.js.map +1 -0
  516. package/dist/integration/trigger-dev-client.js +253 -0
  517. package/dist/integration/trigger-dev-client.js.map +1 -0
  518. package/dist/integration/trigger-dev-webhooks.js +362 -0
  519. package/dist/integration/trigger-dev-webhooks.js.map +1 -0
  520. package/dist/lib/artifact-registry.js +4 -0
  521. package/dist/lib/artifact-registry.js.map +1 -1
  522. package/dist/lib/connection-pool.js +390 -0
  523. package/dist/lib/connection-pool.js.map +1 -0
  524. package/dist/lib/environment-contract.js +258 -0
  525. package/dist/lib/environment-contract.js.map +1 -0
  526. package/dist/lib/path-validator.js +14 -5
  527. package/dist/lib/path-validator.js.map +1 -1
  528. package/dist/lib/query-optimizer.js +388 -0
  529. package/dist/lib/query-optimizer.js.map +1 -0
  530. package/dist/lib/redis-queue-manager.js +5 -1
  531. package/dist/lib/redis-queue-manager.js.map +1 -1
  532. package/dist/lib/result-cache.js +285 -0
  533. package/dist/lib/result-cache.js.map +1 -0
  534. package/dist/mcp/auth-middleware.js +2 -1
  535. package/dist/mcp/auth-middleware.js.map +1 -1
  536. package/dist/mcp/playwright-mcp-server-auth.js +2 -1
  537. package/dist/mcp/playwright-mcp-server-auth.js.map +1 -1
  538. package/dist/middleware/authentication.js +317 -0
  539. package/dist/middleware/authentication.js.map +1 -0
  540. package/dist/services/authentication.js +669 -0
  541. package/dist/services/authentication.js.map +1 -0
  542. package/dist/services/session-management.js +436 -0
  543. package/dist/services/session-management.js.map +1 -0
  544. package/dist/services/skill-deployment.js +8 -6
  545. package/dist/services/skill-deployment.js.map +1 -1
  546. package/dist/services/user-service.js +710 -0
  547. package/dist/services/user-service.js.map +1 -0
  548. package/dist/types/trigger-dev-events.d.js +10 -0
  549. package/dist/types/trigger-dev-events.d.js.map +1 -0
  550. package/docs/README.md +240 -0
  551. package/package.json +15 -4
  552. package/scripts/build-agent-image.sh +1 -1
  553. package/scripts/compare-workflow-performance.sh +556 -0
  554. package/scripts/cost-allocation-tracker.sh +632 -0
  555. package/scripts/docker-rebuild-all-agents.sh +2 -2
  556. package/scripts/migrate-to-optimized-workflows.sh +438 -0
  557. package/scripts/organize-docs.sh +338 -0
  558. package/scripts/reorganize-tests.sh +280 -0
  559. package/scripts/trigger-dev-setup.sh +279 -0
  560. package/tests/README.md +45 -0
  561. package/.claude/commands/cost-savings-status.md +0 -34
  562. package/.claude/commands/metrics-summary.md +0 -58
  563. package/.claude/skills/cfn-docker-redis-coordination/MIGRATION_SUMMARY.md +0 -348
  564. package/.claude/skills/cfn-docker-redis-coordination/README.md +0 -294
  565. package/.claude/skills/cfn-docker-redis-coordination/SKILL.md +0 -435
  566. package/.claude/skills/cfn-docker-redis-coordination/coordinate.sh +0 -650
  567. package/.claude/skills/cfn-docker-redis-coordination/coordinate.sh.backup-1763145142 +0 -641
  568. package/.claude/skills/cfn-docker-redis-coordination/package-lock.json +0 -5259
  569. package/.claude/skills/cfn-docker-redis-coordination/package.json +0 -40
  570. package/.claude/skills/cfn-docker-redis-coordination/src/coordinator.ts +0 -801
  571. package/.claude/skills/cfn-docker-redis-coordination/src/index.ts +0 -42
  572. package/.claude/skills/cfn-docker-redis-coordination/src/types.ts +0 -351
  573. package/.claude/skills/cfn-docker-redis-coordination/tests/coordinator.test.ts +0 -1464
  574. package/.claude/skills/cfn-docker-redis-coordination/tsconfig.json +0 -30
  575. package/.claude/skills/cfn-loop-orchestration/helpers/auto-tune-timeouts.sh +0 -228
  576. package/.claude/skills/cfn-loop-orchestration/helpers/consensus-ts.sh +0 -104
  577. package/.claude/skills/cfn-loop-orchestration/helpers/consensus.sh +0 -94
  578. package/.claude/skills/cfn-loop-orchestration/helpers/context-injection.sh +0 -142
  579. package/.claude/skills/cfn-loop-orchestration/helpers/context-lookup.sh +0 -359
  580. package/.claude/skills/cfn-loop-orchestration/helpers/deliverable-verifier-ts.sh +0 -123
  581. package/.claude/skills/cfn-loop-orchestration/helpers/deliverable-verifier.sh +0 -71
  582. package/.claude/skills/cfn-loop-orchestration/helpers/gate-check.sh +0 -56
  583. package/.claude/skills/cfn-loop-orchestration/helpers/iteration-manager-ts.sh +0 -89
  584. package/.claude/skills/cfn-loop-orchestration/helpers/iteration-manager.sh +0 -87
  585. package/.claude/skills/cfn-loop-orchestration/helpers/orchestrate-ts.sh +0 -104
  586. package/.claude/skills/cfn-loop-orchestration/helpers/parse-test-results.sh +0 -56
  587. package/.claude/skills/cfn-loop-orchestration/helpers/spawn-agents.sh +0 -290
  588. package/.claude/skills/cfn-loop-orchestration/helpers/timeout-calculator-ts.sh +0 -47
  589. package/.claude/skills/cfn-loop-orchestration/helpers/timeout-calculator.sh +0 -51
  590. package/.claude/skills/cfn-loop-orchestration/orchestrate.sh +0 -1345
  591. package/.claude/skills/cfn-redis-coordination/AGENT_LOGGING.md +0 -280
  592. package/.claude/skills/cfn-redis-coordination/BZPOPMIN_FIX_SUMMARY.md +0 -209
  593. package/.claude/skills/cfn-redis-coordination/CENTRALIZED_REDIS_WRAPPER.md +0 -319
  594. package/.claude/skills/cfn-redis-coordination/agent-log.sh.bak +0 -124
  595. package/.claude/skills/cfn-redis-coordination/config.json +0 -61
  596. package/.claude/skills/cfn-redis-coordination/demos/phase4-wake-queue-test-report.md +0 -82
  597. package/.claude/skills/cfn-redis-coordination/demos/test-bzpopmin-fix.sh +0 -274
  598. package/.claude/skills/cfn-redis-coordination/demos/test-cancel-swarm.sh +0 -0
  599. package/.claude/skills/cfn-redis-coordination/docs/migration/PHASE_3_REDIS_COORDINATION_COMPLETION_REPORT.md +0 -553
  600. package/.claude/skills/cfn-redis-coordination/jest.config.js +0 -23
  601. package/.claude/skills/cfn-redis-coordination/package-lock.json +0 -5272
  602. package/.claude/skills/cfn-redis-coordination/package.json +0 -45
  603. package/.claude/skills/cfn-redis-coordination/src/agent-logger.ts +0 -446
  604. package/.claude/skills/cfn-redis-coordination/src/agent-recovery.ts +0 -454
  605. package/.claude/skills/cfn-redis-coordination/src/completion-reporter.ts +0 -396
  606. package/.claude/skills/cfn-redis-coordination/src/context-manager.ts +0 -327
  607. package/.claude/skills/cfn-redis-coordination/src/index.ts +0 -82
  608. package/.claude/skills/cfn-redis-coordination/src/mode-detector.ts +0 -155
  609. package/.claude/skills/cfn-redis-coordination/src/redis/redis-client.ts +0 -305
  610. package/.claude/skills/cfn-redis-coordination/src/redis/redis-functions.ts +0 -283
  611. package/.claude/skills/cfn-redis-coordination/src/redis-client.ts +0 -654
  612. package/.claude/skills/cfn-redis-coordination/src/result-collector.ts +0 -437
  613. package/.claude/skills/cfn-redis-coordination/src/swarm-manager.ts +0 -494
  614. package/.claude/skills/cfn-redis-coordination/src/task-analyzer.ts +0 -404
  615. package/.claude/skills/cfn-redis-coordination/src/task-executor.ts +0 -423
  616. package/.claude/skills/cfn-redis-coordination/src/types.ts +0 -235
  617. package/.claude/skills/cfn-redis-coordination/src/waiting-coordinator.ts +0 -587
  618. package/.claude/skills/cfn-redis-coordination/store-success-criteria.sh +0 -85
  619. package/.claude/skills/cfn-redis-coordination/test-connection-attempts.js +0 -70
  620. package/.claude/skills/cfn-redis-coordination/test-mode-simple.js +0 -121
  621. package/.claude/skills/cfn-redis-coordination/test-redis-check.js +0 -84
  622. package/.claude/skills/cfn-redis-coordination/test-task-mode-redis.cjs +0 -391
  623. package/.claude/skills/cfn-redis-coordination/tests/coordination.test.ts +0 -788
  624. package/.claude/skills/cfn-redis-coordination/update-all-scripts.sh +0 -67
  625. package/claude-assets/agents/cfn-dev-team/coordinators/cfn-v3-coordinator.md +0 -980
  626. package/claude-assets/agents/cfn-dev-team/dev-ops/monitoring-specialist.md +0 -759
  627. package/claude-assets/agents/custom/test-mcp-access.md +0 -24
  628. package/claude-assets/agents/typescript-specialist.md +0 -280
  629. package/claude-assets/commands/cost-savings-status.md +0 -34
  630. package/claude-assets/commands/metrics-summary.md +0 -58
  631. package/claude-assets/skills/cfn-docker-redis-coordination/MIGRATION_SUMMARY.md +0 -348
  632. package/claude-assets/skills/cfn-docker-redis-coordination/README.md +0 -294
  633. package/claude-assets/skills/cfn-docker-redis-coordination/SKILL.md +0 -435
  634. package/claude-assets/skills/cfn-docker-redis-coordination/coordinate.sh +0 -650
  635. package/claude-assets/skills/cfn-docker-redis-coordination/coordinate.sh.backup-1763145142 +0 -641
  636. package/claude-assets/skills/cfn-docker-redis-coordination/jest.config.js +0 -37
  637. package/claude-assets/skills/cfn-docker-redis-coordination/package-lock.json +0 -5259
  638. package/claude-assets/skills/cfn-docker-redis-coordination/package.json +0 -40
  639. package/claude-assets/skills/cfn-docker-redis-coordination/src/coordinator.ts +0 -801
  640. package/claude-assets/skills/cfn-docker-redis-coordination/src/index.ts +0 -42
  641. package/claude-assets/skills/cfn-docker-redis-coordination/src/types.ts +0 -351
  642. package/claude-assets/skills/cfn-docker-redis-coordination/tests/coordinator.test.ts +0 -1464
  643. package/claude-assets/skills/cfn-loop-orchestration/helpers/auto-tune-timeouts.sh +0 -228
  644. package/claude-assets/skills/cfn-loop-orchestration/helpers/consensus-ts.sh +0 -104
  645. package/claude-assets/skills/cfn-loop-orchestration/helpers/consensus.sh +0 -94
  646. package/claude-assets/skills/cfn-loop-orchestration/helpers/context-injection.sh +0 -142
  647. package/claude-assets/skills/cfn-loop-orchestration/helpers/context-lookup.sh +0 -359
  648. package/claude-assets/skills/cfn-loop-orchestration/helpers/deliverable-verifier-ts.sh +0 -123
  649. package/claude-assets/skills/cfn-loop-orchestration/helpers/deliverable-verifier.sh +0 -71
  650. package/claude-assets/skills/cfn-loop-orchestration/helpers/gate-check.sh +0 -56
  651. package/claude-assets/skills/cfn-loop-orchestration/helpers/iteration-manager-ts.sh +0 -89
  652. package/claude-assets/skills/cfn-loop-orchestration/helpers/iteration-manager.sh +0 -87
  653. package/claude-assets/skills/cfn-loop-orchestration/helpers/orchestrate-ts.sh +0 -104
  654. package/claude-assets/skills/cfn-loop-orchestration/helpers/parse-test-results.sh +0 -56
  655. package/claude-assets/skills/cfn-loop-orchestration/helpers/spawn-agents.sh +0 -290
  656. package/claude-assets/skills/cfn-loop-orchestration/helpers/timeout-calculator-ts.sh +0 -47
  657. package/claude-assets/skills/cfn-loop-orchestration/helpers/timeout-calculator.sh +0 -51
  658. package/claude-assets/skills/cfn-loop-orchestration/orchestrate.sh +0 -1345
  659. package/claude-assets/skills/cfn-redis-cleanup/cleanup-redis.sh +0 -130
  660. package/claude-assets/skills/cfn-redis-coordination/AGENT_LOGGING.md +0 -280
  661. package/claude-assets/skills/cfn-redis-coordination/BZPOPMIN_FIX_SUMMARY.md +0 -209
  662. package/claude-assets/skills/cfn-redis-coordination/CENTRALIZED_REDIS_WRAPPER.md +0 -319
  663. package/claude-assets/skills/cfn-redis-coordination/agent-log.sh.bak +0 -124
  664. package/claude-assets/skills/cfn-redis-coordination/config.json +0 -61
  665. package/claude-assets/skills/cfn-redis-coordination/demos/phase4-wake-queue-test-report.md +0 -82
  666. package/claude-assets/skills/cfn-redis-coordination/demos/test-bzpopmin-fix.sh +0 -274
  667. package/claude-assets/skills/cfn-redis-coordination/demos/test-cancel-swarm.sh +0 -0
  668. package/claude-assets/skills/cfn-redis-coordination/docs/migration/PHASE_3_REDIS_COORDINATION_COMPLETION_REPORT.md +0 -553
  669. package/claude-assets/skills/cfn-redis-coordination/jest.config.js +0 -23
  670. package/claude-assets/skills/cfn-redis-coordination/package-lock.json +0 -5272
  671. package/claude-assets/skills/cfn-redis-coordination/package.json +0 -45
  672. package/claude-assets/skills/cfn-redis-coordination/src/agent-logger.ts +0 -446
  673. package/claude-assets/skills/cfn-redis-coordination/src/agent-recovery.ts +0 -454
  674. package/claude-assets/skills/cfn-redis-coordination/src/completion-reporter.ts +0 -396
  675. package/claude-assets/skills/cfn-redis-coordination/src/context-manager.ts +0 -327
  676. package/claude-assets/skills/cfn-redis-coordination/src/index.ts +0 -82
  677. package/claude-assets/skills/cfn-redis-coordination/src/mode-detector.ts +0 -155
  678. package/claude-assets/skills/cfn-redis-coordination/src/redis/redis-client.ts +0 -305
  679. package/claude-assets/skills/cfn-redis-coordination/src/redis/redis-functions.ts +0 -283
  680. package/claude-assets/skills/cfn-redis-coordination/src/redis-client.ts +0 -654
  681. package/claude-assets/skills/cfn-redis-coordination/src/result-collector.ts +0 -437
  682. package/claude-assets/skills/cfn-redis-coordination/src/swarm-manager.ts +0 -494
  683. package/claude-assets/skills/cfn-redis-coordination/src/task-analyzer.ts +0 -404
  684. package/claude-assets/skills/cfn-redis-coordination/src/task-executor.ts +0 -423
  685. package/claude-assets/skills/cfn-redis-coordination/src/types.ts +0 -235
  686. package/claude-assets/skills/cfn-redis-coordination/src/waiting-coordinator.ts +0 -587
  687. package/claude-assets/skills/cfn-redis-coordination/store-success-criteria.sh +0 -85
  688. package/claude-assets/skills/cfn-redis-coordination/test-connection-attempts.js +0 -70
  689. package/claude-assets/skills/cfn-redis-coordination/test-mode-simple.js +0 -121
  690. package/claude-assets/skills/cfn-redis-coordination/test-redis-check.js +0 -84
  691. package/claude-assets/skills/cfn-redis-coordination/test-task-mode-redis.cjs +0 -391
  692. package/claude-assets/skills/cfn-redis-coordination/tests/coordination.test.ts +0 -788
  693. package/claude-assets/skills/cfn-redis-coordination/update-all-scripts.sh +0 -67
  694. package/claude-assets/skills/cfn-redis-data-extraction/SKILL.md +0 -442
  695. package/claude-assets/skills/cfn-redis-data-extraction/extract.sh +0 -306
  696. package/dist/coordination/index.js +0 -25
  697. package/dist/coordination/index.js.map +0 -1
  698. package/docs/BUG_19_MEMORY_LEAK_TASK_MODE.md +0 -405
  699. package/docs/MEMORY_CLEANUP_GUIDE.md +0 -358
  700. package/docs/MEMORY_LEAK_FIX_SUMMARY.md +0 -322
  701. package/docs/REDIS_CLEANUP_EXECUTIVE_SUMMARY.md +0 -319
  702. package/docs/REDIS_CLEANUP_VERIFICATION_REPORT.md +0 -574
  703. package/tests/test-memory-leak-task-mode.sh +0 -435
  704. /package/.claude/skills/cfn-loop-orchestration/{inject-loop-context.sh → archive/legacy-bash/inject-loop-context.sh} +0 -0
  705. /package/.claude/skills/cfn-loop-orchestration/{monitor-execution.sh → archive/legacy-bash/monitor-execution.sh} +0 -0
  706. /package/.claude/skills/cfn-redis-coordination/{agent-log.sh → agent-log.sh.backup} +0 -0
  707. /package/.claude/skills/cfn-redis-coordination/{agent-recovery.sh → agent-recovery.sh.backup} +0 -0
  708. /package/.claude/skills/cfn-redis-coordination/{analyze-task-complexity.sh → analyze-task-complexity.sh.backup} +0 -0
  709. /package/.claude/skills/cfn-redis-coordination/bash-wrappers/{store-context.sh → store-context.sh.backup} +0 -0
  710. /package/.claude/skills/cfn-redis-coordination/{cancel-swarm.sh → cancel-swarm.sh.backup} +0 -0
  711. /package/.claude/skills/cfn-redis-coordination/{cfn-loop-exec.sh → cfn-loop-exec.sh.backup} +0 -0
  712. /package/.claude/skills/cfn-redis-coordination/{cfn-loop-relaunch.sh → cfn-loop-relaunch.sh.backup} +0 -0
  713. /package/.claude/skills/cfn-redis-coordination/{collect-confidence-scores.sh → collect-confidence-scores.sh.backup} +0 -0
  714. /package/.claude/skills/cfn-redis-coordination/{collect-results.sh → collect-results.sh.backup} +0 -0
  715. /package/.claude/skills/cfn-redis-coordination/{complete-swarm.sh → complete-swarm.sh.backup} +0 -0
  716. /package/.claude/skills/cfn-redis-coordination/{get-context.sh → get-context.sh.backup} +0 -0
  717. /package/.claude/skills/cfn-redis-coordination/{get-success-criteria.sh → get-success-criteria.sh.backup} +0 -0
  718. /package/.claude/skills/cfn-redis-coordination/{invoke-waiting-mode.sh → invoke-waiting-mode.sh.backup} +0 -0
  719. /package/.claude/skills/cfn-redis-coordination/{redis-cli-wrapper.sh → redis-cli-wrapper.sh.backup} +0 -0
  720. /package/.claude/skills/cfn-redis-coordination/{redis-functions.sh → redis-functions.sh.backup} +0 -0
  721. /package/.claude/skills/cfn-redis-coordination/{report-completion.sh → report-completion.sh.backup} +0 -0
  722. /package/.claude/skills/cfn-redis-coordination/{store-context.sh → store-context.sh.backup} +0 -0
  723. /package/claude-assets/skills/cfn-loop-orchestration/{inject-loop-context.sh → archive/legacy-bash/inject-loop-context.sh} +0 -0
  724. /package/claude-assets/skills/cfn-loop-orchestration/{monitor-execution.sh → archive/legacy-bash/monitor-execution.sh} +0 -0
  725. /package/claude-assets/skills/cfn-redis-coordination/{agent-log.sh → agent-log.sh.backup} +0 -0
  726. /package/claude-assets/skills/cfn-redis-coordination/{agent-recovery.sh → agent-recovery.sh.backup} +0 -0
  727. /package/claude-assets/skills/cfn-redis-coordination/{analyze-task-complexity.sh → analyze-task-complexity.sh.backup} +0 -0
  728. /package/claude-assets/skills/cfn-redis-coordination/bash-wrappers/{store-context.sh → store-context.sh.backup} +0 -0
  729. /package/claude-assets/skills/cfn-redis-coordination/{cancel-swarm.sh → cancel-swarm.sh.backup} +0 -0
  730. /package/claude-assets/skills/cfn-redis-coordination/{cfn-loop-exec.sh → cfn-loop-exec.sh.backup} +0 -0
  731. /package/claude-assets/skills/cfn-redis-coordination/{cfn-loop-relaunch.sh → cfn-loop-relaunch.sh.backup} +0 -0
  732. /package/claude-assets/skills/cfn-redis-coordination/{collect-confidence-scores.sh → collect-confidence-scores.sh.backup} +0 -0
  733. /package/claude-assets/skills/cfn-redis-coordination/{collect-results.sh → collect-results.sh.backup} +0 -0
  734. /package/claude-assets/skills/cfn-redis-coordination/{complete-swarm.sh → complete-swarm.sh.backup} +0 -0
  735. /package/claude-assets/skills/cfn-redis-coordination/{get-context.sh → get-context.sh.backup} +0 -0
  736. /package/claude-assets/skills/cfn-redis-coordination/{get-success-criteria.sh → get-success-criteria.sh.backup} +0 -0
  737. /package/claude-assets/skills/cfn-redis-coordination/{invoke-waiting-mode.sh → invoke-waiting-mode.sh.backup} +0 -0
  738. /package/claude-assets/skills/cfn-redis-coordination/{redis-cli-wrapper.sh → redis-cli-wrapper.sh.backup} +0 -0
  739. /package/claude-assets/skills/cfn-redis-coordination/{redis-functions.sh → redis-functions.sh.backup} +0 -0
  740. /package/claude-assets/skills/cfn-redis-coordination/{report-completion.sh → report-completion.sh.backup} +0 -0
  741. /package/claude-assets/skills/cfn-redis-coordination/{store-context.sh → store-context.sh.backup} +0 -0
@@ -162,7 +162,8 @@ const logger = createLogger('skill-deployment');
162
162
  skillName,
163
163
  lockResource
164
164
  });
165
- lock = await this.lockManager.acquire(lockResource, {
165
+ lock = await this.lockManager.acquireLock({
166
+ resource: lockResource,
166
167
  timeout: 10000,
167
168
  ttl: 60000,
168
169
  correlationId: `deploy-${skillName}-${Date.now()}`
@@ -249,7 +250,7 @@ const logger = createLogger('skill-deployment');
249
250
  auditId
250
251
  });
251
252
  // Step 10: Release distributed lock
252
- await this.lockManager.release(lock.id);
253
+ await this.lockManager.releaseLock(lock.id);
253
254
  logger.info('Skill deployed successfully', {
254
255
  skillId,
255
256
  skillName,
@@ -290,7 +291,7 @@ const logger = createLogger('skill-deployment');
290
291
  // Ensure lock is released even if transaction fails
291
292
  if (lock) {
292
293
  try {
293
- await this.lockManager.release(lock.id);
294
+ await this.lockManager.releaseLock(lock.id);
294
295
  logger.debug('Distributed lock released in finally block', {
295
296
  lockId: lock.id
296
297
  });
@@ -331,7 +332,8 @@ const logger = createLogger('skill-deployment');
331
332
  const skillName = skillId.replace(/^skill-/, '').replace(/-\d+-\d+$/, '');
332
333
  // Step 2: Acquire distributed lock for this skill
333
334
  const lockResource = this.buildLockResource(skillName);
334
- lock = await this.lockManager.acquire(lockResource, {
335
+ lock = await this.lockManager.acquireLock({
336
+ resource: lockResource,
335
337
  timeout: 10000,
336
338
  ttl: 60000,
337
339
  correlationId: `rollback-${deploymentId}-${Date.now()}`
@@ -372,7 +374,7 @@ const logger = createLogger('skill-deployment');
372
374
  skillId
373
375
  });
374
376
  // Step 6: Release distributed lock
375
- await this.lockManager.release(lock.id);
377
+ await this.lockManager.releaseLock(lock.id);
376
378
  logger.info('Deployment rollback succeeded', {
377
379
  deploymentId,
378
380
  skillId
@@ -393,7 +395,7 @@ const logger = createLogger('skill-deployment');
393
395
  // Ensure lock is released
394
396
  if (lock) {
395
397
  try {
396
- await this.lockManager.release(lock.id);
398
+ await this.lockManager.releaseLock(lock.id);
397
399
  logger.debug('Distributed lock released in rollback finally block', {
398
400
  lockId: lock.id
399
401
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/services/skill-deployment.ts"],"sourcesContent":["/**\r\n * Skill Deployment Pipeline (Refactored with Transaction Framework)\r\n *\r\n * Orchestrates atomic deployment of skills from APPROVED → DEPLOYED state.\r\n * Part of Task 3.2: Skill Deployment Transaction Integration\r\n *\r\n * Features:\r\n * - Atomic cross-database transactions via TransactionManager (PostgreSQL + SQLite)\r\n * - Distributed locking to prevent concurrent deployments\r\n * - Automatic validation before deployment\r\n * - Version conflict detection and resolution within transaction\r\n * - Content hash validation within transaction\r\n * - Rollback capability on failure (automatic via transaction)\r\n * - Comprehensive audit trail (atomically updated)\r\n *\r\n * @example\r\n * ```typescript\r\n * const pipeline = new SkillDeploymentPipeline(dbService, txManager, lockManager);\r\n * const result = await pipeline.deploySkill({\r\n * skillPath: '.claude/skills/authentication',\r\n * deployedBy: 'admin@example.com'\r\n * });\r\n *\r\n * if (!result.success) {\r\n * console.error('Deployment failed:', result.error);\r\n * // Transaction automatically rolled back\r\n * }\r\n * ```\r\n */\r\n\r\nimport * as fs from 'fs';\r\nimport * as path from 'path';\r\nimport { DatabaseService } from '../lib/database-service.js';\r\nimport { TransactionManager } from '../lib/database-service/transaction-manager.js';\r\nimport { DistributedLock, LockResource } from '../lib/distributed-lock.js';\r\nimport { StandardError, ErrorCode } from '../lib/errors.js';\r\nimport { createLogger } from '../lib/logging.js';\r\nimport { validateSkill, parseFrontmatter, ValidationResult } from './skill-validator.js';\r\nimport { getNextVersion, versionExists } from './skill-versioning.js';\r\n\r\nconst logger = createLogger('skill-deployment');\r\n\r\n/**\r\n * Deployment request parameters\r\n */\r\nexport interface DeploymentRequest {\r\n /** Path to skill directory */\r\n skillPath: string;\r\n /** User or system performing deployment */\r\n deployedBy?: string;\r\n /** Optional: Override auto-versioning with explicit version */\r\n explicitVersion?: string;\r\n /** Optional: Skip validation (dangerous, admin only) */\r\n skipValidation?: boolean;\r\n}\r\n\r\n/**\r\n * Deployment result\r\n */\r\nexport interface DeploymentResult {\r\n /** Whether deployment succeeded */\r\n success: boolean;\r\n /** Unique deployment ID for tracking */\r\n deploymentId?: number;\r\n /** Deployed skill ID */\r\n skillId?: string;\r\n /** Skill name */\r\n skillName?: string;\r\n /** Deployed version */\r\n version?: string;\r\n /** Error message if failed */\r\n error?: string;\r\n /** Validation result if validation failed */\r\n validationResult?: ValidationResult;\r\n /** Path to backup for rollback */\r\n rollbackPath?: string;\r\n /** Timestamp of deployment */\r\n deployedAt?: Date;\r\n /** Transaction ID for tracking */\r\n transactionId?: string;\r\n /** Lock ID for tracking */\r\n lockId?: string;\r\n}\r\n\r\n/**\r\n * Skill metadata for database operations\r\n */\r\ninterface SkillMetadata {\r\n id: string;\r\n name: string;\r\n version: string;\r\n contentPath: string;\r\n status: string;\r\n metadata: string;\r\n}\r\n\r\n/**\r\n * Skill Deployment Pipeline (Transaction-Aware)\r\n *\r\n * Handles atomic deployment of skills with validation, versioning, rollback,\r\n * and distributed locking to prevent concurrent modifications.\r\n */\r\nexport class SkillDeploymentPipeline {\r\n private dbService: DatabaseService;\r\n private txManager: TransactionManager;\r\n private lockManager: DistributedLock;\r\n\r\n constructor(\r\n dbService: DatabaseService,\r\n txManager: TransactionManager,\r\n lockManager: DistributedLock\r\n ) {\r\n this.dbService = dbService;\r\n this.txManager = txManager;\r\n this.lockManager = lockManager;\r\n }\r\n\r\n /**\r\n * Generate unique skill ID\r\n */\r\n private generateSkillId(skillName: string, version: string): string {\r\n const timestamp = Date.now();\r\n const sanitizedName = skillName.replace(/[^a-zA-Z0-9_-]/g, '-');\r\n return `skill-${sanitizedName}-${version}-${timestamp}`;\r\n }\r\n\r\n /**\r\n * Create backup of current skill state (for rollback)\r\n */\r\n private async createBackup(skillPath: string): Promise<string> {\r\n // For now, we'll just return the original path\r\n // In production, this would copy to a backup location\r\n logger.info('Creating deployment backup', { skillPath });\r\n return skillPath;\r\n }\r\n\r\n /**\r\n * Build lock resource for skill deployment\r\n */\r\n private buildLockResource(skillName: string): LockResource {\r\n return {\r\n database: 'skills',\r\n table: 'skills',\r\n key: skillName,\r\n };\r\n }\r\n\r\n /**\r\n * Record deployment attempt in audit trail (transaction-aware)\r\n *\r\n * NOTE: This must be called within a transaction context\r\n */\r\n private async recordDeploymentAudit(\r\n adapter: any,\r\n skillId: string,\r\n fromStatus: string | null,\r\n toStatus: string,\r\n version: string,\r\n success: boolean,\r\n deployedBy: string,\r\n errorMessage?: string,\r\n metadata?: Record<string, any>\r\n ): Promise<number> {\r\n logger.info('Recording deployment audit', {\r\n skillId,\r\n fromStatus,\r\n toStatus,\r\n version,\r\n success,\r\n });\r\n\r\n try {\r\n const result: any = await adapter.raw(\r\n `INSERT INTO deployment_audit\r\n (skill_id, from_status, to_status, version, success, deployed_by, error_message, metadata)\r\n VALUES (?, ?, ?, ?, ?, ?, ?, ?)`,\r\n [\r\n skillId,\r\n fromStatus,\r\n toStatus,\r\n version,\r\n success ? 1 : 0,\r\n deployedBy,\r\n errorMessage || null,\r\n metadata ? JSON.stringify(metadata) : null,\r\n ]\r\n );\r\n\r\n const auditId = result.lastInsertId || 0;\r\n logger.info('Deployment audit recorded', { auditId, skillId });\r\n return auditId;\r\n } catch (error) {\r\n logger.error('Failed to record deployment audit', error as Error, { skillId });\r\n // In transaction mode, we want to fail the transaction if audit fails\r\n throw error;\r\n }\r\n }\r\n\r\n /**\r\n * Deploy skill atomically across all databases with distributed locking\r\n *\r\n * Uses TransactionManager for atomic operations and DistributedLock\r\n * to prevent concurrent deployments of the same skill.\r\n *\r\n * @param request - Deployment request parameters\r\n * @returns Deployment result\r\n */\r\n async deploySkill(request: DeploymentRequest): Promise<DeploymentResult> {\r\n const { skillPath, deployedBy = 'system', explicitVersion, skipValidation = false } = request;\r\n\r\n logger.info('Starting skill deployment', { skillPath, deployedBy });\r\n\r\n let lock: any = null;\r\n let tx: any = null;\r\n\r\n try {\r\n // Step 1: Validate skill (unless skipped) - BEFORE acquiring lock\r\n if (!skipValidation) {\r\n const validationResult = await validateSkill(this.dbService, skillPath);\r\n\r\n if (!validationResult.valid) {\r\n logger.warn('Skill validation failed', {\r\n skillPath,\r\n errorCount: validationResult.errors.length,\r\n });\r\n\r\n // Record validation failure (no transaction needed for failure records)\r\n try {\r\n const adapter = this.dbService.getAdapter('sqlite');\r\n await this.recordDeploymentAudit(\r\n adapter,\r\n 'unknown',\r\n null,\r\n 'FAILED',\r\n 'unknown',\r\n false,\r\n deployedBy,\r\n `Validation failed: ${validationResult.errors.map(e => e.message).join('; ')}`,\r\n { validationErrors: validationResult.errors }\r\n );\r\n } catch (auditError) {\r\n logger.warn('Failed to record validation failure audit (non-blocking)', {\r\n error: (auditError as Error).message,\r\n });\r\n }\r\n\r\n return {\r\n success: false,\r\n error: 'Validation failed',\r\n validationResult,\r\n };\r\n }\r\n }\r\n\r\n // Step 2: Parse skill metadata\r\n const frontmatter = parseFrontmatter(skillPath);\r\n const skillName = frontmatter.name;\r\n\r\n // Step 3: Acquire distributed lock for this skill (prevents concurrent deployments)\r\n const lockResource = this.buildLockResource(skillName);\r\n\r\n logger.debug('Acquiring distributed lock', { skillName, lockResource });\r\n\r\n lock = await this.lockManager.acquire(lockResource, {\r\n timeout: 10000, // 10 second timeout\r\n ttl: 60000, // 1 minute TTL (auto-release)\r\n correlationId: `deploy-${skillName}-${Date.now()}`,\r\n });\r\n\r\n logger.info('Distributed lock acquired', {\r\n lockId: lock.id,\r\n skillName,\r\n });\r\n\r\n // Step 4: Begin cross-database transaction\r\n // Note: Currently only using SQLite, but framework supports PostgreSQL too\r\n tx = await this.txManager.begin(['sqlite'], {\r\n timeout: 30000, // 30 second transaction timeout\r\n correlationId: lock.correlationId,\r\n });\r\n\r\n logger.info('Transaction began', {\r\n transactionId: tx.id,\r\n skillName,\r\n });\r\n\r\n // Step 5: Determine version within transaction (prevents version conflicts)\r\n let version: string;\r\n\r\n await tx.execute('sqlite', async (adapter: any) => {\r\n if (explicitVersion) {\r\n // Check if explicit version already exists\r\n const exists = await versionExists(this.dbService, skillName, explicitVersion);\r\n if (exists) {\r\n throw new StandardError(\r\n ErrorCode.DB_DUPLICATE_KEY,\r\n `Version ${explicitVersion} already exists for skill: ${skillName}`,\r\n { skillName, version: explicitVersion }\r\n );\r\n }\r\n version = explicitVersion;\r\n } else {\r\n // Auto-increment version (patch by default)\r\n version = await getNextVersion(this.dbService, skillName, 'patch');\r\n }\r\n });\r\n\r\n // Step 6: Generate skill ID\r\n const skillId = this.generateSkillId(skillName, version!);\r\n\r\n // Step 7: Create backup for rollback\r\n const rollbackPath = await this.createBackup(skillPath);\r\n\r\n logger.info('Deploying skill within transaction', {\r\n skillId,\r\n skillName,\r\n version,\r\n transactionId: tx.id,\r\n });\r\n\r\n // Step 8: Execute atomic deployment operations\r\n let auditId: number = 0;\r\n\r\n await tx.execute('sqlite', async (adapter: any) => {\r\n // Insert into skills table\r\n await adapter.raw(\r\n `INSERT INTO skills (id, name, version, content_path, status, metadata)\r\n VALUES (?, ?, ?, ?, ?, ?)`,\r\n [\r\n skillId,\r\n skillName,\r\n version,\r\n skillPath,\r\n 'DEPLOYED',\r\n JSON.stringify({\r\n deployedBy,\r\n deployedAt: new Date().toISOString(),\r\n description: frontmatter.description || '',\r\n author: frontmatter.author || '',\r\n transactionId: tx.id,\r\n lockId: lock.id,\r\n }),\r\n ]\r\n );\r\n\r\n // Record successful deployment in audit trail (within same transaction)\r\n auditId = await this.recordDeploymentAudit(\r\n adapter,\r\n skillId,\r\n 'APPROVED',\r\n 'DEPLOYED',\r\n version!,\r\n true,\r\n deployedBy,\r\n undefined,\r\n {\r\n skillName,\r\n contentPath: skillPath,\r\n transactionId: tx.id,\r\n lockId: lock.id,\r\n }\r\n );\r\n });\r\n\r\n // Step 9: Commit transaction (atomic across all operations)\r\n await tx.commit();\r\n\r\n logger.info('Transaction committed successfully', {\r\n transactionId: tx.id,\r\n skillId,\r\n skillName,\r\n version,\r\n auditId,\r\n });\r\n\r\n // Step 10: Release distributed lock\r\n await this.lockManager.release(lock.id);\r\n\r\n logger.info('Skill deployed successfully', {\r\n skillId,\r\n skillName,\r\n version,\r\n auditId,\r\n transactionId: tx.id,\r\n lockId: lock.id,\r\n });\r\n\r\n return {\r\n success: true,\r\n deploymentId: auditId,\r\n skillId,\r\n skillName,\r\n version,\r\n rollbackPath,\r\n deployedAt: new Date(),\r\n transactionId: tx.id,\r\n lockId: lock.id,\r\n };\r\n } catch (error) {\r\n logger.error('Deployment failed', error as Error, { skillPath });\r\n\r\n // Transaction automatically rolled back by TransactionManager on error\r\n if (tx) {\r\n logger.info('Transaction automatically rolled back', {\r\n transactionId: tx.id,\r\n });\r\n }\r\n\r\n const errorMessage =\r\n error instanceof StandardError\r\n ? error.message\r\n : `Deployment failed: ${(error as Error).message}`;\r\n\r\n return {\r\n success: false,\r\n error: errorMessage,\r\n transactionId: tx?.id,\r\n lockId: lock?.id,\r\n };\r\n } finally {\r\n // Ensure lock is released even if transaction fails\r\n if (lock) {\r\n try {\r\n await this.lockManager.release(lock.id);\r\n logger.debug('Distributed lock released in finally block', {\r\n lockId: lock.id,\r\n });\r\n } catch (lockError) {\r\n logger.error('Failed to release lock in finally block', lockError as Error, {\r\n lockId: lock.id,\r\n });\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Rollback a deployment\r\n *\r\n * Uses TransactionManager for atomic rollback across all databases.\r\n *\r\n * @param deploymentId - Deployment audit ID to rollback\r\n * @returns True if rollback succeeded\r\n */\r\n async rollbackDeployment(deploymentId: number): Promise<boolean> {\r\n logger.info('Starting deployment rollback', { deploymentId });\r\n\r\n let lock: any = null;\r\n let tx: any = null;\r\n\r\n try {\r\n // Step 1: Get deployment details (outside transaction to avoid deadlock)\r\n const adapter = this.dbService.getAdapter('sqlite');\r\n const auditResult: any = await adapter.raw(\r\n 'SELECT skill_id, version FROM deployment_audit WHERE id = ?',\r\n [deploymentId]\r\n );\r\n\r\n if (!auditResult || auditResult.length === 0) {\r\n throw new StandardError(\r\n ErrorCode.DB_NOT_FOUND,\r\n `Deployment audit not found: ${deploymentId}`,\r\n { deploymentId }\r\n );\r\n }\r\n\r\n const { skill_id: skillId, version } = auditResult[0];\r\n\r\n // Extract skill name from skill ID\r\n const skillName = skillId.replace(/^skill-/, '').replace(/-\\d+-\\d+$/, '');\r\n\r\n // Step 2: Acquire distributed lock for this skill\r\n const lockResource = this.buildLockResource(skillName);\r\n\r\n lock = await this.lockManager.acquire(lockResource, {\r\n timeout: 10000,\r\n ttl: 60000,\r\n correlationId: `rollback-${deploymentId}-${Date.now()}`,\r\n });\r\n\r\n logger.info('Distributed lock acquired for rollback', {\r\n lockId: lock.id,\r\n deploymentId,\r\n });\r\n\r\n // Step 3: Begin rollback transaction\r\n tx = await this.txManager.begin(['sqlite'], {\r\n timeout: 30000,\r\n correlationId: lock.correlationId,\r\n });\r\n\r\n logger.info('Rollback transaction began', {\r\n transactionId: tx.id,\r\n deploymentId,\r\n });\r\n\r\n // Step 4: Execute rollback operations within transaction\r\n await tx.execute('sqlite', async (adapter: any) => {\r\n // Delete from skills table\r\n await adapter.raw('DELETE FROM skills WHERE id = ?', [skillId]);\r\n\r\n // Record rollback in audit trail (within same transaction)\r\n await this.recordDeploymentAudit(\r\n adapter,\r\n skillId,\r\n 'DEPLOYED',\r\n 'ROLLED_BACK',\r\n version as string,\r\n true,\r\n 'system',\r\n 'Deployment rolled back',\r\n {\r\n originalDeploymentId: deploymentId,\r\n transactionId: tx.id,\r\n lockId: lock.id,\r\n }\r\n );\r\n });\r\n\r\n // Step 5: Commit rollback transaction\r\n await tx.commit();\r\n\r\n logger.info('Rollback transaction committed', {\r\n transactionId: tx.id,\r\n deploymentId,\r\n skillId,\r\n });\r\n\r\n // Step 6: Release distributed lock\r\n await this.lockManager.release(lock.id);\r\n\r\n logger.info('Deployment rollback succeeded', { deploymentId, skillId });\r\n return true;\r\n } catch (error) {\r\n logger.error('Deployment rollback failed', error as Error, { deploymentId });\r\n\r\n // Transaction automatically rolled back on error\r\n if (tx) {\r\n logger.info('Rollback transaction automatically rolled back', {\r\n transactionId: tx.id,\r\n });\r\n }\r\n\r\n return false;\r\n } finally {\r\n // Ensure lock is released\r\n if (lock) {\r\n try {\r\n await this.lockManager.release(lock.id);\r\n logger.debug('Distributed lock released in rollback finally block', {\r\n lockId: lock.id,\r\n });\r\n } catch (lockError) {\r\n logger.error('Failed to release lock in rollback finally block', lockError as Error, {\r\n lockId: lock.id,\r\n });\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Get deployment history for a skill\r\n *\r\n * @param skillName - Name of the skill\r\n * @param limit - Maximum number of results\r\n * @returns Array of deployment audit records\r\n */\r\n async getDeploymentHistory(skillName: string, limit: number = 10): Promise<any[]> {\r\n logger.debug('Fetching deployment history', { skillName, limit });\r\n\r\n try {\r\n const adapter = this.dbService.getAdapter('sqlite');\r\n\r\n const result: any = await adapter.raw(\r\n `SELECT da.*\r\n FROM deployment_audit da\r\n JOIN skills s ON da.skill_id = s.id\r\n WHERE s.name = ?\r\n ORDER BY da.deployed_at DESC\r\n LIMIT ?`,\r\n [skillName, limit]\r\n );\r\n\r\n return result || [];\r\n } catch (error) {\r\n logger.error('Failed to fetch deployment history', error as Error, { skillName });\r\n throw new StandardError(\r\n ErrorCode.DB_QUERY_FAILED,\r\n `Failed to fetch deployment history for skill: ${skillName}`,\r\n { skillName },\r\n error as Error\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Get all deployments with a specific status\r\n *\r\n * @param status - Deployment status to filter by\r\n * @param limit - Maximum number of results\r\n * @returns Array of deployment audit records\r\n */\r\n async getDeploymentsByStatus(status: string, limit: number = 50): Promise<any[]> {\r\n logger.debug('Fetching deployments by status', { status, limit });\r\n\r\n try {\r\n const adapter = this.dbService.getAdapter('sqlite');\r\n\r\n const result: any = await adapter.raw(\r\n `SELECT * FROM deployment_audit\r\n WHERE to_status = ?\r\n ORDER BY deployed_at DESC\r\n LIMIT ?`,\r\n [status, limit]\r\n );\r\n\r\n return result || [];\r\n } catch (error) {\r\n logger.error('Failed to fetch deployments by status', error as Error, { status });\r\n throw new StandardError(\r\n ErrorCode.DB_QUERY_FAILED,\r\n `Failed to fetch deployments by status: ${status}`,\r\n { status },\r\n error as Error\r\n );\r\n }\r\n }\r\n}\r\n"],"names":["StandardError","ErrorCode","createLogger","validateSkill","parseFrontmatter","getNextVersion","versionExists","logger","SkillDeploymentPipeline","dbService","txManager","lockManager","generateSkillId","skillName","version","timestamp","Date","now","sanitizedName","replace","createBackup","skillPath","info","buildLockResource","database","table","key","recordDeploymentAudit","adapter","skillId","fromStatus","toStatus","success","deployedBy","errorMessage","metadata","result","raw","JSON","stringify","auditId","lastInsertId","error","deploySkill","request","explicitVersion","skipValidation","lock","tx","validationResult","valid","warn","errorCount","errors","length","getAdapter","map","e","message","join","validationErrors","auditError","frontmatter","name","lockResource","debug","acquire","timeout","ttl","correlationId","lockId","id","begin","transactionId","execute","exists","DB_DUPLICATE_KEY","rollbackPath","deployedAt","toISOString","description","author","undefined","contentPath","commit","release","deploymentId","lockError","rollbackDeployment","auditResult","DB_NOT_FOUND","skill_id","originalDeploymentId","getDeploymentHistory","limit","DB_QUERY_FAILED","getDeploymentsByStatus","status"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BC,GAOD,SAASA,aAAa,EAAEC,SAAS,QAAQ,mBAAmB;AAC5D,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,aAAa,EAAEC,gBAAgB,QAA0B,uBAAuB;AACzF,SAASC,cAAc,EAAEC,aAAa,QAAQ,wBAAwB;AAEtE,MAAMC,SAASL,aAAa;AAwD5B;;;;;CAKC,GACD,OAAO,MAAMM;IACHC,UAA2B;IAC3BC,UAA8B;IAC9BC,YAA6B;IAErC,YACEF,SAA0B,EAC1BC,SAA6B,EAC7BC,WAA4B,CAC5B;QACA,IAAI,CAACF,SAAS,GAAGA;QACjB,IAAI,CAACC,SAAS,GAAGA;QACjB,IAAI,CAACC,WAAW,GAAGA;IACrB;IAEA;;GAEC,GACD,AAAQC,gBAAgBC,SAAiB,EAAEC,OAAe,EAAU;QAClE,MAAMC,YAAYC,KAAKC,GAAG;QAC1B,MAAMC,gBAAgBL,UAAUM,OAAO,CAAC,mBAAmB;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yCA,OAAgB;gBAAEuD;YAAO;YAC/E,MAAM,IAAIjG,cACRC,UAAU8F,eAAe,EACzB,CAAC,uCAAuC,EAAEE,QAAQ,EAClD;gBAAEA;YAAO,GACTvD;QAEJ;IACF;AACF"}
1
+ {"version":3,"sources":["../../src/services/skill-deployment.ts"],"sourcesContent":["/**\r\n * Skill Deployment Pipeline (Refactored with Transaction Framework)\r\n *\r\n * Orchestrates atomic deployment of skills from APPROVED → DEPLOYED state.\r\n * Part of Task 3.2: Skill Deployment Transaction Integration\r\n *\r\n * Features:\r\n * - Atomic cross-database transactions via TransactionManager (PostgreSQL + SQLite)\r\n * - Distributed locking to prevent concurrent deployments\r\n * - Automatic validation before deployment\r\n * - Version conflict detection and resolution within transaction\r\n * - Content hash validation within transaction\r\n * - Rollback capability on failure (automatic via transaction)\r\n * - Comprehensive audit trail (atomically updated)\r\n *\r\n * @example\r\n * ```typescript\r\n * const pipeline = new SkillDeploymentPipeline(dbService, txManager, lockManager);\r\n * const result = await pipeline.deploySkill({\r\n * skillPath: '.claude/skills/authentication',\r\n * deployedBy: 'admin@example.com'\r\n * });\r\n *\r\n * if (!result.success) {\r\n * console.error('Deployment failed:', result.error);\r\n * // Transaction automatically rolled back\r\n * }\r\n * ```\r\n */\r\n\r\nimport * as fs from 'fs';\r\nimport * as path from 'path';\r\nimport { DatabaseService } from '../lib/database-service.js';\r\nimport { TransactionManager } from '../lib/database-service/transaction-manager.js';\r\nimport { DistributedLock, LockResource } from '../lib/distributed-lock.js';\r\nimport { StandardError, ErrorCode } from '../lib/errors.js';\r\nimport { createLogger } from '../lib/logging.js';\r\nimport { validateSkill, parseFrontmatter, ValidationResult } from './skill-validator.js';\r\nimport { getNextVersion, versionExists } from './skill-versioning.js';\r\n\r\nconst logger = createLogger('skill-deployment');\r\n\r\n/**\r\n * Deployment request parameters\r\n */\r\nexport interface DeploymentRequest {\r\n /** Path to skill directory */\r\n skillPath: string;\r\n /** User or system performing deployment */\r\n deployedBy?: string;\r\n /** Optional: Override auto-versioning with explicit version */\r\n explicitVersion?: string;\r\n /** Optional: Skip validation (dangerous, admin only) */\r\n skipValidation?: boolean;\r\n}\r\n\r\n/**\r\n * Deployment result\r\n */\r\nexport interface DeploymentResult {\r\n /** Whether deployment succeeded */\r\n success: boolean;\r\n /** Unique deployment ID for tracking */\r\n deploymentId?: number;\r\n /** Deployed skill ID */\r\n skillId?: string;\r\n /** Skill name */\r\n skillName?: string;\r\n /** Deployed version */\r\n version?: string;\r\n /** Error message if failed */\r\n error?: string;\r\n /** Validation result if validation failed */\r\n validationResult?: ValidationResult;\r\n /** Path to backup for rollback */\r\n rollbackPath?: string;\r\n /** Timestamp of deployment */\r\n deployedAt?: Date;\r\n /** Transaction ID for tracking */\r\n transactionId?: string;\r\n /** Lock ID for tracking */\r\n lockId?: string;\r\n}\r\n\r\n/**\r\n * Skill metadata for database operations\r\n */\r\ninterface SkillMetadata {\r\n id: string;\r\n name: string;\r\n version: string;\r\n contentPath: string;\r\n status: string;\r\n metadata: string;\r\n}\r\n\r\n/**\r\n * Skill Deployment Pipeline (Transaction-Aware)\r\n *\r\n * Handles atomic deployment of skills with validation, versioning, rollback,\r\n * and distributed locking to prevent concurrent modifications.\r\n */\r\nexport class SkillDeploymentPipeline {\r\n private dbService: DatabaseService;\r\n private txManager: TransactionManager;\r\n private lockManager: DistributedLock;\r\n\r\n constructor(\r\n dbService: DatabaseService,\r\n txManager: TransactionManager,\r\n lockManager: DistributedLock\r\n ) {\r\n this.dbService = dbService;\r\n this.txManager = txManager;\r\n this.lockManager = lockManager;\r\n }\r\n\r\n /**\r\n * Generate unique skill ID\r\n */\r\n private generateSkillId(skillName: string, version: string): string {\r\n const timestamp = Date.now();\r\n const sanitizedName = skillName.replace(/[^a-zA-Z0-9_-]/g, '-');\r\n return `skill-${sanitizedName}-${version}-${timestamp}`;\r\n }\r\n\r\n /**\r\n * Create backup of current skill state (for rollback)\r\n */\r\n private async createBackup(skillPath: string): Promise<string> {\r\n // For now, we'll just return the original path\r\n // In production, this would copy to a backup location\r\n logger.info('Creating deployment backup', { skillPath });\r\n return skillPath;\r\n }\r\n\r\n /**\r\n * Build lock resource for skill deployment\r\n */\r\n private buildLockResource(skillName: string): LockResource {\r\n return {\r\n database: 'skills',\r\n table: 'skills',\r\n key: skillName,\r\n };\r\n }\r\n\r\n /**\r\n * Record deployment attempt in audit trail (transaction-aware)\r\n *\r\n * NOTE: This must be called within a transaction context\r\n */\r\n private async recordDeploymentAudit(\r\n adapter: any,\r\n skillId: string,\r\n fromStatus: string | null,\r\n toStatus: string,\r\n version: string,\r\n success: boolean,\r\n deployedBy: string,\r\n errorMessage?: string,\r\n metadata?: Record<string, any>\r\n ): Promise<number> {\r\n logger.info('Recording deployment audit', {\r\n skillId,\r\n fromStatus,\r\n toStatus,\r\n version,\r\n success,\r\n });\r\n\r\n try {\r\n const result: any = await adapter.raw(\r\n `INSERT INTO deployment_audit\r\n (skill_id, from_status, to_status, version, success, deployed_by, error_message, metadata)\r\n VALUES (?, ?, ?, ?, ?, ?, ?, ?)`,\r\n [\r\n skillId,\r\n fromStatus,\r\n toStatus,\r\n version,\r\n success ? 1 : 0,\r\n deployedBy,\r\n errorMessage || null,\r\n metadata ? JSON.stringify(metadata) : null,\r\n ]\r\n );\r\n\r\n const auditId = result.lastInsertId || 0;\r\n logger.info('Deployment audit recorded', { auditId, skillId });\r\n return auditId;\r\n } catch (error) {\r\n logger.error('Failed to record deployment audit', error as Error, { skillId });\r\n // In transaction mode, we want to fail the transaction if audit fails\r\n throw error;\r\n }\r\n }\r\n\r\n /**\r\n * Deploy skill atomically across all databases with distributed locking\r\n *\r\n * Uses TransactionManager for atomic operations and DistributedLock\r\n * to prevent concurrent deployments of the same skill.\r\n *\r\n * @param request - Deployment request parameters\r\n * @returns Deployment result\r\n */\r\n async deploySkill(request: DeploymentRequest): Promise<DeploymentResult> {\r\n const { skillPath, deployedBy = 'system', explicitVersion, skipValidation = false } = request;\r\n\r\n logger.info('Starting skill deployment', { skillPath, deployedBy });\r\n\r\n let lock: any = null;\r\n let tx: any = null;\r\n\r\n try {\r\n // Step 1: Validate skill (unless skipped) - BEFORE acquiring lock\r\n if (!skipValidation) {\r\n const validationResult = await validateSkill(this.dbService, skillPath);\r\n\r\n if (!validationResult.valid) {\r\n logger.warn('Skill validation failed', {\r\n skillPath,\r\n errorCount: validationResult.errors.length,\r\n });\r\n\r\n // Record validation failure (no transaction needed for failure records)\r\n try {\r\n const adapter = this.dbService.getAdapter('sqlite');\r\n await this.recordDeploymentAudit(\r\n adapter,\r\n 'unknown',\r\n null,\r\n 'FAILED',\r\n 'unknown',\r\n false,\r\n deployedBy,\r\n `Validation failed: ${validationResult.errors.map(e => e.message).join('; ')}`,\r\n { validationErrors: validationResult.errors }\r\n );\r\n } catch (auditError) {\r\n logger.warn('Failed to record validation failure audit (non-blocking)', {\r\n error: (auditError as Error).message,\r\n });\r\n }\r\n\r\n return {\r\n success: false,\r\n error: 'Validation failed',\r\n validationResult,\r\n };\r\n }\r\n }\r\n\r\n // Step 2: Parse skill metadata\r\n const frontmatter = parseFrontmatter(skillPath);\r\n const skillName = frontmatter.name;\r\n\r\n // Step 3: Acquire distributed lock for this skill (prevents concurrent deployments)\r\n const lockResource = this.buildLockResource(skillName);\r\n\r\n logger.debug('Acquiring distributed lock', { skillName, lockResource });\r\n\r\n lock = await this.lockManager.acquireLock({\r\n resource: lockResource,\r\n timeout: 10000, // 10 second timeout\r\n ttl: 60000, // 1 minute TTL (auto-release)\r\n correlationId: `deploy-${skillName}-${Date.now()}`,\r\n });\r\n\r\n logger.info('Distributed lock acquired', {\r\n lockId: lock.id,\r\n skillName,\r\n });\r\n\r\n // Step 4: Begin cross-database transaction\r\n // Note: Currently only using SQLite, but framework supports PostgreSQL too\r\n tx = await this.txManager.begin(['sqlite'], {\r\n timeout: 30000, // 30 second transaction timeout\r\n correlationId: lock.correlationId,\r\n });\r\n\r\n logger.info('Transaction began', {\r\n transactionId: tx.id,\r\n skillName,\r\n });\r\n\r\n // Step 5: Determine version within transaction (prevents version conflicts)\r\n let version: string;\r\n\r\n await tx.execute('sqlite', async (adapter: any) => {\r\n if (explicitVersion) {\r\n // Check if explicit version already exists\r\n const exists = await versionExists(this.dbService, skillName, explicitVersion);\r\n if (exists) {\r\n throw new StandardError(\r\n ErrorCode.DB_DUPLICATE_KEY,\r\n `Version ${explicitVersion} already exists for skill: ${skillName}`,\r\n { skillName, version: explicitVersion }\r\n );\r\n }\r\n version = explicitVersion;\r\n } else {\r\n // Auto-increment version (patch by default)\r\n version = await getNextVersion(this.dbService, skillName, 'patch');\r\n }\r\n });\r\n\r\n // Step 6: Generate skill ID\r\n const skillId = this.generateSkillId(skillName, version!);\r\n\r\n // Step 7: Create backup for rollback\r\n const rollbackPath = await this.createBackup(skillPath);\r\n\r\n logger.info('Deploying skill within transaction', {\r\n skillId,\r\n skillName,\r\n version,\r\n transactionId: tx.id,\r\n });\r\n\r\n // Step 8: Execute atomic deployment operations\r\n let auditId: number = 0;\r\n\r\n await tx.execute('sqlite', async (adapter: any) => {\r\n // Insert into skills table\r\n await adapter.raw(\r\n `INSERT INTO skills (id, name, version, content_path, status, metadata)\r\n VALUES (?, ?, ?, ?, ?, ?)`,\r\n [\r\n skillId,\r\n skillName,\r\n version,\r\n skillPath,\r\n 'DEPLOYED',\r\n JSON.stringify({\r\n deployedBy,\r\n deployedAt: new Date().toISOString(),\r\n description: frontmatter.description || '',\r\n author: frontmatter.author || '',\r\n transactionId: tx.id,\r\n lockId: lock.id,\r\n }),\r\n ]\r\n );\r\n\r\n // Record successful deployment in audit trail (within same transaction)\r\n auditId = await this.recordDeploymentAudit(\r\n adapter,\r\n skillId,\r\n 'APPROVED',\r\n 'DEPLOYED',\r\n version!,\r\n true,\r\n deployedBy,\r\n undefined,\r\n {\r\n skillName,\r\n contentPath: skillPath,\r\n transactionId: tx.id,\r\n lockId: lock.id,\r\n }\r\n );\r\n });\r\n\r\n // Step 9: Commit transaction (atomic across all operations)\r\n await tx.commit();\r\n\r\n logger.info('Transaction committed successfully', {\r\n transactionId: tx.id,\r\n skillId,\r\n skillName,\r\n version,\r\n auditId,\r\n });\r\n\r\n // Step 10: Release distributed lock\r\n await this.lockManager.releaseLock(lock.id);\r\n\r\n logger.info('Skill deployed successfully', {\r\n skillId,\r\n skillName,\r\n version,\r\n auditId,\r\n transactionId: tx.id,\r\n lockId: lock.id,\r\n });\r\n\r\n return {\r\n success: true,\r\n deploymentId: auditId,\r\n skillId,\r\n skillName,\r\n version,\r\n rollbackPath,\r\n deployedAt: new Date(),\r\n transactionId: tx.id,\r\n lockId: lock.id,\r\n };\r\n } catch (error) {\r\n logger.error('Deployment failed', error as Error, { skillPath });\r\n\r\n // Transaction automatically rolled back by TransactionManager on error\r\n if (tx) {\r\n logger.info('Transaction automatically rolled back', {\r\n transactionId: tx.id,\r\n });\r\n }\r\n\r\n const errorMessage =\r\n error instanceof StandardError\r\n ? error.message\r\n : `Deployment failed: ${(error as Error).message}`;\r\n\r\n return {\r\n success: false,\r\n error: errorMessage,\r\n transactionId: tx?.id,\r\n lockId: lock?.id,\r\n };\r\n } finally {\r\n // Ensure lock is released even if transaction fails\r\n if (lock) {\r\n try {\r\n await this.lockManager.releaseLock(lock.id);\r\n logger.debug('Distributed lock released in finally block', {\r\n lockId: lock.id,\r\n });\r\n } catch (lockError) {\r\n logger.error('Failed to release lock in finally block', lockError as Error, {\r\n lockId: lock.id,\r\n });\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Rollback a deployment\r\n *\r\n * Uses TransactionManager for atomic rollback across all databases.\r\n *\r\n * @param deploymentId - Deployment audit ID to rollback\r\n * @returns True if rollback succeeded\r\n */\r\n async rollbackDeployment(deploymentId: number): Promise<boolean> {\r\n logger.info('Starting deployment rollback', { deploymentId });\r\n\r\n let lock: any = null;\r\n let tx: any = null;\r\n\r\n try {\r\n // Step 1: Get deployment details (outside transaction to avoid deadlock)\r\n const adapter = this.dbService.getAdapter('sqlite');\r\n const auditResult: any = await adapter.raw(\r\n 'SELECT skill_id, version FROM deployment_audit WHERE id = ?',\r\n [deploymentId]\r\n );\r\n\r\n if (!auditResult || auditResult.length === 0) {\r\n throw new StandardError(\r\n ErrorCode.DB_NOT_FOUND,\r\n `Deployment audit not found: ${deploymentId}`,\r\n { deploymentId }\r\n );\r\n }\r\n\r\n const { skill_id: skillId, version } = auditResult[0];\r\n\r\n // Extract skill name from skill ID\r\n const skillName = skillId.replace(/^skill-/, '').replace(/-\\d+-\\d+$/, '');\r\n\r\n // Step 2: Acquire distributed lock for this skill\r\n const lockResource = this.buildLockResource(skillName);\r\n\r\n lock = await this.lockManager.acquireLock({\r\n resource: lockResource,\r\n timeout: 10000,\r\n ttl: 60000,\r\n correlationId: `rollback-${deploymentId}-${Date.now()}`,\r\n });\r\n\r\n logger.info('Distributed lock acquired for rollback', {\r\n lockId: lock.id,\r\n deploymentId,\r\n });\r\n\r\n // Step 3: Begin rollback transaction\r\n tx = await this.txManager.begin(['sqlite'], {\r\n timeout: 30000,\r\n correlationId: lock.correlationId,\r\n });\r\n\r\n logger.info('Rollback transaction began', {\r\n transactionId: tx.id,\r\n deploymentId,\r\n });\r\n\r\n // Step 4: Execute rollback operations within transaction\r\n await tx.execute('sqlite', async (adapter: any) => {\r\n // Delete from skills table\r\n await adapter.raw('DELETE FROM skills WHERE id = ?', [skillId]);\r\n\r\n // Record rollback in audit trail (within same transaction)\r\n await this.recordDeploymentAudit(\r\n adapter,\r\n skillId,\r\n 'DEPLOYED',\r\n 'ROLLED_BACK',\r\n version as string,\r\n true,\r\n 'system',\r\n 'Deployment rolled back',\r\n {\r\n originalDeploymentId: deploymentId,\r\n transactionId: tx.id,\r\n lockId: lock.id,\r\n }\r\n );\r\n });\r\n\r\n // Step 5: Commit rollback transaction\r\n await tx.commit();\r\n\r\n logger.info('Rollback transaction committed', {\r\n transactionId: tx.id,\r\n deploymentId,\r\n skillId,\r\n });\r\n\r\n // Step 6: Release distributed lock\r\n await this.lockManager.releaseLock(lock.id);\r\n\r\n logger.info('Deployment rollback succeeded', { deploymentId, skillId });\r\n return true;\r\n } catch (error) {\r\n logger.error('Deployment rollback failed', error as Error, { deploymentId });\r\n\r\n // Transaction automatically rolled back on error\r\n if (tx) {\r\n logger.info('Rollback transaction automatically rolled back', {\r\n transactionId: tx.id,\r\n });\r\n }\r\n\r\n return false;\r\n } finally {\r\n // Ensure lock is released\r\n if (lock) {\r\n try {\r\n await this.lockManager.releaseLock(lock.id);\r\n logger.debug('Distributed lock released in rollback finally block', {\r\n lockId: lock.id,\r\n });\r\n } catch (lockError) {\r\n logger.error('Failed to release lock in rollback finally block', lockError as Error, {\r\n lockId: lock.id,\r\n });\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Get deployment history for a skill\r\n *\r\n * @param skillName - Name of the skill\r\n * @param limit - Maximum number of results\r\n * @returns Array of deployment audit records\r\n */\r\n async getDeploymentHistory(skillName: string, limit: number = 10): Promise<any[]> {\r\n logger.debug('Fetching deployment history', { skillName, limit });\r\n\r\n try {\r\n const adapter = this.dbService.getAdapter('sqlite');\r\n\r\n const result: any = await adapter.raw(\r\n `SELECT da.*\r\n FROM deployment_audit da\r\n JOIN skills s ON da.skill_id = s.id\r\n WHERE s.name = ?\r\n ORDER BY da.deployed_at DESC\r\n LIMIT ?`,\r\n [skillName, limit]\r\n );\r\n\r\n return result || [];\r\n } catch (error) {\r\n logger.error('Failed to fetch deployment history', error as Error, { skillName });\r\n throw new StandardError(\r\n ErrorCode.DB_QUERY_FAILED,\r\n `Failed to fetch deployment history for skill: ${skillName}`,\r\n { skillName },\r\n error as Error\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Get all deployments with a specific status\r\n *\r\n * @param status - Deployment status to filter by\r\n * @param limit - Maximum number of results\r\n * @returns Array of deployment audit records\r\n */\r\n async getDeploymentsByStatus(status: string, limit: number = 50): Promise<any[]> {\r\n logger.debug('Fetching deployments by status', { status, limit });\r\n\r\n try {\r\n const adapter = this.dbService.getAdapter('sqlite');\r\n\r\n const result: any = await adapter.raw(\r\n `SELECT * FROM deployment_audit\r\n WHERE to_status = ?\r\n ORDER BY deployed_at DESC\r\n LIMIT ?`,\r\n [status, limit]\r\n );\r\n\r\n return result || [];\r\n } catch (error) {\r\n logger.error('Failed to fetch deployments by status', error as Error, { status });\r\n throw new StandardError(\r\n ErrorCode.DB_QUERY_FAILED,\r\n `Failed to fetch deployments by status: ${status}`,\r\n { status },\r\n error as Error\r\n );\r\n }\r\n }\r\n}\r\n"],"names":["StandardError","ErrorCode","createLogger","validateSkill","parseFrontmatter","getNextVersion","versionExists","logger","SkillDeploymentPipeline","dbService","txManager","lockManager","generateSkillId","skillName","version","timestamp","Date","now","sanitizedName","replace","createBackup","skillPath","info","buildLockResource","database","table","key","recordDeploymentAudit","adapter","skillId","fromStatus","toStatus","success","deployedBy","errorMessage","metadata","result","raw","JSON","stringify","auditId","lastInsertId","error","deploySkill","request","explicitVersion","skipValidation","lock","tx","validationResult","valid","warn","errorCount","errors","length","getAdapter","map","e","message","join","validationErrors","auditError","frontmatter","name","lockResource","debug","acquireLock","resource","timeout","ttl","correlationId","lockId","id","begin","transactionId","execute","exists","DB_DUPLICATE_KEY","rollbackPath","deployedAt","toISOString","description","author","undefined","contentPath","commit","releaseLock","deploymentId","lockError","rollbackDeployment","auditResult","DB_NOT_FOUND","skill_id","originalDeploymentId","getDeploymentHistory","limit","DB_QUERY_FAILED","getDeploymentsByStatus","status"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BC,GAOD,SAASA,aAAa,EAAEC,SAAS,QAAQ,mBAAmB;AAC5D,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,aAAa,EAAEC,gBAAgB,QAA0B,uBAAuB;AACzF,SAASC,cAAc,EAAEC,aAAa,QAAQ,wBAAwB;AAEtE,MAAMC,SAASL,aAAa;AAwD5B;;;;;CAKC,GACD,OAAO,MAAMM;IACHC,UAA2B;IAC3BC,UAA8B;IAC9BC,YAA6B;IAErC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