claude-flow-novice 2.15.11 → 2.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (636) hide show
  1. package/.claude/cfn-extras/agents/cfn-v3-coordinator.md +517 -0
  2. package/.claude/commands/cfn-loop-cli.md +158 -464
  3. package/.claude/commands/cfn-loop-trigger.md +114 -0
  4. package/.claude/hooks/cfn-invoke-post-edit-ts.sh +100 -0
  5. package/.claude/hooks/cfn-invoke-post-edit-ts.sh.backup +78 -0
  6. package/.claude/hooks/cfn-invoke-post-edit.sh +22 -0
  7. package/.claude/hooks/cfn-invoke-post-edit.sh.backup +87 -0
  8. package/.claude/hooks/cfn-invoke-pre-edit-ts.sh +116 -0
  9. package/.claude/hooks/cfn-invoke-pre-edit-ts.sh.backup +94 -0
  10. package/.claude/hooks/cfn-invoke-pre-edit.sh +22 -0
  11. package/.claude/hooks/cfn-invoke-pre-edit.sh.backup +88 -0
  12. package/.claude/skills/cfn-agent-spawning/SKILL.md +48 -1
  13. package/.claude/skills/cfn-agent-spawning/SKILL.md.backup +135 -0
  14. package/.claude/skills/cfn-agent-spawning/TYPESCRIPT_MIGRATION.md +567 -0
  15. package/.claude/skills/cfn-agent-spawning/check-dependencies.sh +22 -0
  16. package/.claude/skills/{cfn-redis-coordination/check-dependencies.sh → cfn-agent-spawning/check-dependencies.sh.backup} +3 -5
  17. package/.claude/skills/cfn-agent-spawning/get-agent-provider-env.sh +22 -0
  18. package/.claude/skills/cfn-agent-spawning/get-agent-provider-env.sh.backup +127 -0
  19. package/.claude/skills/cfn-agent-spawning/parse-agent-provider.sh +22 -0
  20. package/.claude/skills/cfn-agent-spawning/parse-agent-provider.sh.backup +59 -0
  21. package/.claude/skills/cfn-agent-spawning/spawn-agent-wrapper.sh +63 -0
  22. package/.claude/skills/cfn-agent-spawning/spawn-agent-wrapper.sh.backup +41 -0
  23. package/.claude/skills/cfn-agent-spawning/spawn-agent.sh +26 -1
  24. package/.claude/skills/cfn-agent-spawning/spawn-templates.sh +22 -0
  25. package/.claude/skills/cfn-agent-spawning/spawn-templates.sh.backup +613 -0
  26. package/.claude/skills/cfn-agent-spawning/spawn-worker.sh +22 -0
  27. package/.claude/skills/cfn-agent-spawning/spawn-worker.sh.backup +176 -0
  28. package/.claude/skills/cfn-loop-orchestration/.backups/unknown/1763619700_33aff4a69b99159e4e849107ebc4d09f/metadata.json +8 -0
  29. package/.claude/skills/cfn-loop-orchestration/.backups/unknown/1763619700_33aff4a69b99159e4e849107ebc4d09f/original +271 -0
  30. package/.claude/skills/cfn-loop-orchestration/.backups/unknown/1763619700_33aff4a69b99159e4e849107ebc4d09f/revert.sh +7 -0
  31. package/.claude/skills/cfn-loop-orchestration/.backups/unknown/1763671642_06496e8c399a79db08167cc00ed4b31e/metadata.json +8 -0
  32. package/.claude/skills/cfn-loop-orchestration/.backups/unknown/1763671642_06496e8c399a79db08167cc00ed4b31e/original +325 -0
  33. package/.claude/skills/cfn-loop-orchestration/.backups/unknown/1763671642_06496e8c399a79db08167cc00ed4b31e/revert.sh +7 -0
  34. package/.claude/skills/cfn-loop-orchestration/CLI_IMPLEMENTATION_SUMMARY.md +330 -0
  35. package/.claude/skills/cfn-loop-orchestration/CONFIGURATION_IMPROVEMENTS.md +318 -0
  36. package/.claude/skills/cfn-loop-orchestration/CONTEXT_LOOKUP_MIGRATION.md +308 -0
  37. package/.claude/skills/cfn-loop-orchestration/CONTEXT_LOOKUP_QUICK_START.md +378 -0
  38. package/.claude/skills/cfn-loop-orchestration/E2E_VALIDATION_REPORT.md +262 -0
  39. package/.claude/skills/cfn-loop-orchestration/IMPLEMENTATION_SUMMARY.md +319 -519
  40. package/.claude/skills/cfn-loop-orchestration/NORTH_STAR_E2E_REPORT.md +299 -0
  41. package/.claude/skills/cfn-loop-orchestration/NORTH_STAR_EXECUTION_SUMMARY.md +403 -0
  42. package/.claude/skills/cfn-loop-orchestration/NORTH_STAR_INDEX.md +323 -0
  43. package/.claude/skills/cfn-loop-orchestration/SKILL.md +159 -48
  44. package/.claude/skills/cfn-loop-orchestration/SPAWN_AGENTS_IMPLEMENTATION.md +188 -0
  45. package/.claude/skills/cfn-loop-orchestration/TEST_COVERAGE_REPORT.md +335 -0
  46. package/.claude/skills/cfn-loop-orchestration/TEST_COVERAGE_SUMMARY.md +456 -0
  47. package/.claude/skills/cfn-loop-orchestration/TYPESCRIPT_INTEGRATION_REPORT.md +709 -0
  48. package/.claude/skills/cfn-loop-orchestration/TYPESCRIPT_INTEGRATION_SUMMARY.md +257 -0
  49. package/.claude/skills/cfn-loop-orchestration/VALIDATION_REPORT.md +572 -0
  50. package/.claude/skills/cfn-loop-orchestration/VALIDATION_SUMMARY.txt +196 -0
  51. package/.claude/skills/cfn-loop-orchestration/VALIDATOR_MODULE_GUIDE.md +526 -0
  52. package/.claude/skills/cfn-loop-orchestration/archive/legacy-bash/README.md +167 -0
  53. package/.claude/skills/cfn-loop-orchestration/archive/legacy-bash/orchestrate-enhanced.sh +548 -0
  54. package/{claude-assets/skills/cfn-loop-orchestration → .claude/skills/cfn-loop-orchestration/archive/legacy-bash}/orchestrate-wrapper.sh +11 -1
  55. package/.claude/skills/cfn-loop-orchestration/archive/legacy-bash/orchestrate.sh +182 -0
  56. package/.claude/skills/cfn-loop-orchestration/e2e-validation-fixed.js +240 -0
  57. package/.claude/skills/cfn-loop-orchestration/e2e-validation.js +213 -0
  58. package/.claude/skills/cfn-loop-orchestration/package-lock.json +3 -0
  59. package/.claude/skills/cfn-loop-orchestration/package.json +4 -0
  60. package/.claude/skills/cfn-loop-orchestration/run-north-star-e2e.ts +210 -0
  61. package/.claude/skills/cfn-loop-orchestration/src/cli/orchestrator-cli.ts +396 -0
  62. package/.claude/skills/cfn-loop-orchestration/src/helpers/CONFIDENCE_AGGREGATOR.md +564 -0
  63. package/.claude/skills/cfn-loop-orchestration/src/helpers/CONFIDENCE_AGGREGATOR_QUICK_REF.md +241 -0
  64. package/.claude/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_IMPLEMENTATION.md +375 -0
  65. package/.claude/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_QUICK_REFERENCE.md +362 -0
  66. package/.claude/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_README.md +307 -0
  67. package/.claude/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_USAGE_GUIDE.md +508 -0
  68. package/.claude/skills/cfn-loop-orchestration/src/helpers/confidence-aggregator.ts +473 -0
  69. package/.claude/skills/cfn-loop-orchestration/src/helpers/consensus.ts +1 -1
  70. package/.claude/skills/cfn-loop-orchestration/src/helpers/context-injector.ts +349 -0
  71. package/.claude/skills/cfn-loop-orchestration/src/helpers/context-lookup.ts +486 -0
  72. package/.claude/skills/cfn-loop-orchestration/src/helpers/deliverable-verifier.ts +6 -2
  73. package/.claude/skills/cfn-loop-orchestration/src/helpers/gate-check.ts +1 -1
  74. package/.claude/skills/cfn-loop-orchestration/src/helpers/product-owner-decision.ts +316 -0
  75. package/.claude/skills/cfn-loop-orchestration/src/helpers/spawn-agents.ts +357 -0
  76. package/.claude/skills/cfn-loop-orchestration/src/helpers/validator.ts +276 -0
  77. package/.claude/skills/cfn-loop-orchestration/src/index.ts +2 -0
  78. package/.claude/skills/cfn-loop-orchestration/src/orchestrate.ts +743 -2
  79. package/.claude/skills/cfn-loop-orchestration/src/types.ts +56 -0
  80. package/.claude/skills/cfn-loop-orchestration/test-cli.sh +92 -0
  81. package/.claude/skills/cfn-loop-orchestration/test-typescript-integration.sh +442 -0
  82. package/.claude/skills/cfn-loop-orchestration/tests/agent-spawner.test.ts +124 -0
  83. package/.claude/skills/cfn-loop-orchestration/tests/confidence-aggregator.test.ts +604 -0
  84. package/.claude/skills/cfn-loop-orchestration/tests/context-injector.test.ts +561 -0
  85. package/.claude/skills/cfn-loop-orchestration/tests/context-lookup.test.ts +661 -0
  86. package/.claude/skills/cfn-loop-orchestration/tests/deliverable-verifier.test.ts +2 -2
  87. package/.claude/skills/cfn-loop-orchestration/tests/gate-check-edge-cases.test.ts +422 -0
  88. package/.claude/skills/cfn-loop-orchestration/tests/gate-checker.test.ts +276 -0
  89. package/.claude/skills/cfn-loop-orchestration/tests/logger.test.ts +291 -0
  90. package/.claude/skills/cfn-loop-orchestration/tests/north-star-e2e.test.ts +334 -0
  91. package/.claude/skills/cfn-loop-orchestration/tests/redis-coordinator.test.ts +321 -0
  92. package/.claude/skills/cfn-loop-orchestration/tests/spawn-agents.test.ts +284 -0
  93. package/.claude/skills/cfn-loop-orchestration/tests/validator.test.ts +643 -0
  94. package/.claude/skills/cfn-loop-validation/IMPLEMENTATION_SUMMARY.md +672 -0
  95. package/.claude/skills/cfn-loop-validation/INDEX.md +531 -0
  96. package/.claude/skills/cfn-loop-validation/README_TYPESCRIPT.md +454 -0
  97. package/.claude/skills/cfn-loop-validation/SKILL.md +48 -1
  98. package/.claude/skills/cfn-loop-validation/SKILL.md.backup +353 -0
  99. package/.claude/skills/cfn-loop-validation/SKILL_TYPESCRIPT.md +782 -0
  100. package/.claude/skills/cfn-loop-validation/VAPOR_DETECTION_EXAMPLES.md +598 -0
  101. package/.claude/skills/cfn-loop-validation/check-dependencies.sh +22 -0
  102. package/{claude-assets/skills/cfn-redis-coordination/check-dependencies.sh → .claude/skills/cfn-loop-validation/check-dependencies.sh.backup} +4 -5
  103. package/.claude/skills/cfn-loop-validation/detect-vapor.sh +59 -0
  104. package/.claude/skills/cfn-loop-validation/detect-vapor.sh.backup +37 -0
  105. package/.claude/skills/cfn-loop-validation/dist/.tsbuildinfo +1 -0
  106. package/.claude/skills/cfn-loop-validation/dist/cli/detect-vapor.d.ts +14 -0
  107. package/.claude/skills/cfn-loop-validation/dist/cli/detect-vapor.d.ts.map +1 -0
  108. package/.claude/skills/cfn-loop-validation/dist/cli/detect-vapor.js +185 -0
  109. package/.claude/skills/cfn-loop-validation/dist/cli/detect-vapor.js.map +1 -0
  110. package/.claude/skills/cfn-loop-validation/dist/cli/validate-deliverables.d.ts +14 -0
  111. package/.claude/skills/cfn-loop-validation/dist/cli/validate-deliverables.d.ts.map +1 -0
  112. package/.claude/skills/cfn-loop-validation/dist/cli/validate-deliverables.js +176 -0
  113. package/.claude/skills/cfn-loop-validation/dist/cli/validate-deliverables.js.map +1 -0
  114. package/.claude/skills/cfn-loop-validation/dist/cli/validate-gate.d.ts +19 -0
  115. package/.claude/skills/cfn-loop-validation/dist/cli/validate-gate.d.ts.map +1 -0
  116. package/.claude/skills/cfn-loop-validation/dist/cli/validate-gate.js +123 -0
  117. package/.claude/skills/cfn-loop-validation/dist/cli/validate-gate.js.map +1 -0
  118. package/.claude/skills/cfn-loop-validation/dist/types.d.ts +156 -0
  119. package/.claude/skills/cfn-loop-validation/dist/types.d.ts.map +1 -0
  120. package/.claude/skills/cfn-loop-validation/dist/types.js +66 -0
  121. package/.claude/skills/cfn-loop-validation/dist/types.js.map +1 -0
  122. package/.claude/skills/cfn-loop-validation/dist/validator.d.ts +85 -0
  123. package/.claude/skills/cfn-loop-validation/dist/validator.d.ts.map +1 -0
  124. package/.claude/skills/cfn-loop-validation/dist/validator.js +411 -0
  125. package/.claude/skills/cfn-loop-validation/dist/validator.js.map +1 -0
  126. package/.claude/skills/cfn-loop-validation/orchestrate-cfn-loop.sh +22 -0
  127. package/.claude/skills/cfn-loop-validation/orchestrate-cfn-loop.sh.backup +252 -0
  128. package/.claude/skills/cfn-loop-validation/package.json +93 -0
  129. package/.claude/skills/cfn-loop-validation/src/cli/detect-vapor.ts +177 -0
  130. package/.claude/skills/cfn-loop-validation/src/cli/validate-deliverables.ts +161 -0
  131. package/.claude/skills/cfn-loop-validation/src/cli/validate-gate.ts +139 -0
  132. package/.claude/skills/cfn-loop-validation/src/types.ts +215 -0
  133. package/.claude/skills/cfn-loop-validation/src/validator.ts +503 -0
  134. package/.claude/skills/cfn-loop-validation/tests/validator.test.ts +537 -0
  135. package/.claude/skills/{cfn-redis-coordination → cfn-loop-validation}/tsconfig.json +34 -31
  136. package/.claude/skills/cfn-loop-validation/validate-deliverables.sh +59 -0
  137. package/.claude/skills/cfn-loop-validation/validate-deliverables.sh.backup +37 -0
  138. package/.claude/skills/cfn-loop-validation/validate-gate.sh +63 -0
  139. package/.claude/skills/cfn-loop-validation/validate-gate.sh.backup +41 -0
  140. package/.claude/skills/cfn-loop-validation/validate-iteration.sh +22 -0
  141. package/.claude/skills/cfn-loop-validation/validate-iteration.sh.backup +134 -0
  142. package/.claude/skills/cfn-product-owner-decision/SKILL.md +479 -147
  143. package/.claude/skills/cfn-product-owner-decision/TYPESCRIPT_IMPLEMENTATION.md +653 -0
  144. package/{claude-assets/skills/cfn-product-owner-decision → .claude/skills/cfn-product-owner-decision/archive/legacy-bash}/execute-decision.sh +24 -2
  145. package/.claude/skills/pre-edit-backup/SKILL.md +324 -0
  146. package/.claude/skills/pre-edit-backup/SKILL.md.backup +277 -0
  147. package/.claude/skills/pre-edit-backup/backup.sh +22 -0
  148. package/.claude/skills/pre-edit-backup/backup.sh.backup +107 -0
  149. package/claude-assets/agents/cfn-dev-team/coordinators/cfn-frontend-coordinator.md +1 -0
  150. package/claude-assets/agents/cfn-dev-team/coordinators/consensus-builder.md +1 -0
  151. package/claude-assets/agents/cfn-dev-team/coordinators/handoff-coordinator.md +1 -0
  152. package/claude-assets/agents/cfn-dev-team/coordinators/multi-sprint-coordinator.md +1 -0
  153. package/claude-assets/agents/cfn-dev-team/dev-ops/devops-engineer.md +10 -0
  154. package/claude-assets/agents/cfn-dev-team/dev-ops/docker-specialist.md +56 -33
  155. package/claude-assets/agents/cfn-dev-team/dev-ops/kubernetes-specialist.md +46 -36
  156. package/claude-assets/agents/cfn-dev-team/dev-ops/monitoring-specialist.md +9 -0
  157. package/claude-assets/agents/cfn-dev-team/developers/api-gateway-specialist.md +17 -17
  158. package/claude-assets/agents/cfn-dev-team/developers/backend-developer.md +40 -58
  159. package/claude-assets/agents/cfn-dev-team/developers/data/data-engineer.md +18 -20
  160. package/claude-assets/agents/cfn-dev-team/developers/database/database-architect.md +19 -28
  161. package/claude-assets/agents/cfn-dev-team/developers/frontend/mobile-dev.md +15 -19
  162. package/claude-assets/agents/cfn-dev-team/developers/frontend/react-frontend-engineer.md +15 -10
  163. package/claude-assets/agents/cfn-dev-team/developers/frontend/typescript-specialist.md +15 -10
  164. package/claude-assets/agents/cfn-dev-team/developers/frontend/ui-designer.md +15 -25
  165. package/claude-assets/agents/cfn-dev-team/developers/graphql-specialist.md +17 -21
  166. package/claude-assets/agents/cfn-dev-team/developers/rust-developer.md +17 -21
  167. package/claude-assets/agents/cfn-dev-team/product-owners/product-owner.md +1 -5
  168. package/claude-assets/agents/cfn-dev-team/reviewers/code-reviewer.md +20 -51
  169. package/claude-assets/agents/cfn-dev-team/reviewers/quality/code-quality-validator.md +22 -71
  170. package/claude-assets/agents/cfn-dev-team/reviewers/quality/perf-analyzer.md +21 -64
  171. package/claude-assets/agents/cfn-dev-team/reviewers/quality/performance-benchmarker.md +22 -67
  172. package/claude-assets/agents/cfn-dev-team/reviewers/quality/security-specialist.md +23 -67
  173. package/claude-assets/agents/cfn-dev-team/testers/api-testing-specialist.md +7 -35
  174. package/claude-assets/agents/cfn-dev-team/testers/chaos-engineering-specialist.md +8 -37
  175. package/claude-assets/agents/cfn-dev-team/testers/contract-tester.md +16 -54
  176. package/claude-assets/agents/cfn-dev-team/testers/integration-tester.md +17 -55
  177. package/claude-assets/agents/cfn-dev-team/testers/interaction-tester.md +9 -37
  178. package/claude-assets/agents/cfn-dev-team/testers/load-testing-specialist.md +17 -55
  179. package/claude-assets/agents/cfn-dev-team/testers/mutation-testing-specialist.md +17 -48
  180. package/claude-assets/agents/cfn-dev-team/testers/playwright-tester.md +8 -37
  181. package/claude-assets/agents/cfn-dev-team/testers/tester.md +7 -27
  182. package/claude-assets/agents/cfn-dev-team/utility/analyst.md +12 -28
  183. package/claude-assets/agents/cfn-dev-team/utility/code-booster.md +13 -13
  184. package/claude-assets/agents/cfn-dev-team/utility/context-curator.md +7 -2
  185. package/claude-assets/agents/cfn-dev-team/utility/epic-creator.md +5 -10
  186. package/claude-assets/agents/cfn-dev-team/utility/memory-leak-specialist.md +120 -714
  187. package/claude-assets/agents/cfn-dev-team/utility/researcher.md +12 -21
  188. package/claude-assets/agents/cfn-dev-team/utility/z-ai-specialist.md +146 -572
  189. package/claude-assets/agents/custom/cfn-docker-expert.md +102 -0
  190. package/claude-assets/agents/custom/cfn-loops-cli-expert.md +129 -0
  191. package/claude-assets/cfn-extras/agents/cfn-v3-coordinator.md +517 -0
  192. package/claude-assets/commands/cfn-loop-cli.md +158 -464
  193. package/claude-assets/commands/cfn-loop-trigger.md +114 -0
  194. package/claude-assets/hooks/SKILL.md +518 -0
  195. package/claude-assets/hooks/SKILL.md.backup +471 -0
  196. package/claude-assets/hooks/cfn-invoke-post-edit-ts.sh +100 -0
  197. package/claude-assets/hooks/cfn-invoke-post-edit-ts.sh.backup +78 -0
  198. package/claude-assets/hooks/cfn-invoke-post-edit.sh +22 -0
  199. package/claude-assets/hooks/cfn-invoke-post-edit.sh.backup +87 -0
  200. package/claude-assets/hooks/cfn-invoke-pre-edit-ts.sh +116 -0
  201. package/claude-assets/hooks/cfn-invoke-pre-edit-ts.sh.backup +94 -0
  202. package/claude-assets/hooks/cfn-invoke-pre-edit.sh +22 -0
  203. package/claude-assets/hooks/cfn-invoke-pre-edit.sh.backup +88 -0
  204. package/claude-assets/skills/cfn-agent-selection-with-fallback/DELIVERABLES.md +409 -0
  205. package/claude-assets/skills/cfn-agent-selection-with-fallback/IMPLEMENTATION_SUMMARY.md +396 -0
  206. package/claude-assets/skills/cfn-agent-selection-with-fallback/INTEGRATION_GUIDE.md +308 -0
  207. package/claude-assets/skills/cfn-agent-selection-with-fallback/QUICK_REFERENCE.md +239 -0
  208. package/claude-assets/skills/cfn-agent-selection-with-fallback/SKILL.md +107 -1
  209. package/claude-assets/skills/cfn-agent-selection-with-fallback/SKILL.md.backup +302 -0
  210. package/claude-assets/skills/cfn-agent-selection-with-fallback/TYPESCRIPT_MIGRATION.md +295 -0
  211. package/claude-assets/skills/cfn-agent-selection-with-fallback/dist/agent-selector.cjs +297 -0
  212. package/claude-assets/skills/cfn-agent-selection-with-fallback/dist/agent-selector.js +297 -0
  213. package/claude-assets/skills/cfn-agent-selection-with-fallback/dist/cli.cjs +96 -0
  214. package/claude-assets/skills/cfn-agent-selection-with-fallback/dist/cli.js +96 -0
  215. package/claude-assets/skills/cfn-agent-selection-with-fallback/select-agents-ts.sh +45 -0
  216. package/claude-assets/skills/cfn-agent-selection-with-fallback/select-agents-ts.sh.backup +23 -0
  217. package/claude-assets/skills/cfn-agent-selection-with-fallback/select-agents.sh +22 -0
  218. package/claude-assets/skills/cfn-agent-selection-with-fallback/select-agents.sh.backup +173 -0
  219. package/claude-assets/skills/cfn-agent-selection-with-fallback/src/agent-selector.test.ts +357 -0
  220. package/claude-assets/skills/cfn-agent-selection-with-fallback/src/agent-selector.ts +350 -0
  221. package/claude-assets/skills/cfn-agent-selection-with-fallback/src/cli.ts +74 -0
  222. package/claude-assets/skills/cfn-agent-selection-with-fallback/task-classifier.sh +22 -0
  223. package/claude-assets/skills/cfn-agent-selection-with-fallback/task-classifier.sh.backup +71 -0
  224. package/claude-assets/skills/cfn-agent-selection-with-fallback/tsconfig.json +18 -0
  225. package/claude-assets/skills/cfn-agent-spawning/SKILL.md +48 -1
  226. package/claude-assets/skills/cfn-agent-spawning/SKILL.md.backup +135 -0
  227. package/claude-assets/skills/cfn-agent-spawning/TYPESCRIPT_MIGRATION.md +567 -0
  228. package/claude-assets/skills/cfn-agent-spawning/check-dependencies.sh +22 -0
  229. package/claude-assets/skills/cfn-agent-spawning/check-dependencies.sh.backup +30 -0
  230. package/claude-assets/skills/cfn-agent-spawning/get-agent-provider-env.sh +22 -0
  231. package/claude-assets/skills/cfn-agent-spawning/get-agent-provider-env.sh.backup +127 -0
  232. package/claude-assets/skills/cfn-agent-spawning/parse-agent-provider.sh +22 -0
  233. package/claude-assets/skills/cfn-agent-spawning/parse-agent-provider.sh.backup +59 -0
  234. package/claude-assets/skills/cfn-agent-spawning/spawn-agent-wrapper.sh +63 -0
  235. package/claude-assets/skills/cfn-agent-spawning/spawn-agent-wrapper.sh.backup +41 -0
  236. package/claude-assets/skills/cfn-agent-spawning/spawn-agent.sh +26 -1
  237. package/claude-assets/skills/cfn-agent-spawning/spawn-templates.sh +22 -0
  238. package/claude-assets/skills/cfn-agent-spawning/spawn-templates.sh.backup +613 -0
  239. package/claude-assets/skills/cfn-agent-spawning/spawn-worker.sh +22 -0
  240. package/claude-assets/skills/cfn-agent-spawning/spawn-worker.sh.backup +176 -0
  241. package/claude-assets/skills/cfn-coordination/agent-completion.sh.backup +36 -0
  242. package/claude-assets/skills/cfn-coordination/coordination-signal.sh.backup +36 -0
  243. package/claude-assets/skills/cfn-coordination/coordination-wait.sh.backup +36 -0
  244. package/claude-assets/skills/cfn-dependency-ingestion/README.md +101 -0
  245. package/claude-assets/skills/cfn-dependency-ingestion/SKILL.md +369 -0
  246. package/claude-assets/skills/cfn-dependency-ingestion/build.sh +23 -0
  247. package/claude-assets/skills/cfn-dependency-ingestion/dist/ingest-dependencies.js +478 -0
  248. package/claude-assets/skills/cfn-dependency-ingestion/ingest-dependencies.sh +295 -0
  249. package/claude-assets/skills/cfn-dependency-ingestion/src/ingest-dependencies.ts +563 -0
  250. package/claude-assets/skills/cfn-loop-orchestration/.backups/unknown/1763619700_33aff4a69b99159e4e849107ebc4d09f/metadata.json +8 -0
  251. package/claude-assets/skills/cfn-loop-orchestration/.backups/unknown/1763619700_33aff4a69b99159e4e849107ebc4d09f/original +271 -0
  252. package/claude-assets/skills/cfn-loop-orchestration/.backups/unknown/1763619700_33aff4a69b99159e4e849107ebc4d09f/revert.sh +7 -0
  253. package/claude-assets/skills/cfn-loop-orchestration/.backups/unknown/1763671642_06496e8c399a79db08167cc00ed4b31e/metadata.json +8 -0
  254. package/claude-assets/skills/cfn-loop-orchestration/.backups/unknown/1763671642_06496e8c399a79db08167cc00ed4b31e/original +325 -0
  255. package/claude-assets/skills/cfn-loop-orchestration/.backups/unknown/1763671642_06496e8c399a79db08167cc00ed4b31e/revert.sh +7 -0
  256. package/claude-assets/skills/cfn-loop-orchestration/CLI_IMPLEMENTATION_SUMMARY.md +330 -0
  257. package/claude-assets/skills/cfn-loop-orchestration/CONFIGURATION_IMPROVEMENTS.md +318 -0
  258. package/claude-assets/skills/cfn-loop-orchestration/CONTEXT_LOOKUP_MIGRATION.md +308 -0
  259. package/claude-assets/skills/cfn-loop-orchestration/CONTEXT_LOOKUP_QUICK_START.md +378 -0
  260. package/claude-assets/skills/cfn-loop-orchestration/E2E_VALIDATION_REPORT.md +262 -0
  261. package/claude-assets/skills/cfn-loop-orchestration/IMPLEMENTATION_SUMMARY.md +319 -519
  262. package/claude-assets/skills/cfn-loop-orchestration/NORTH_STAR_E2E_REPORT.md +299 -0
  263. package/claude-assets/skills/cfn-loop-orchestration/NORTH_STAR_EXECUTION_SUMMARY.md +403 -0
  264. package/claude-assets/skills/cfn-loop-orchestration/NORTH_STAR_INDEX.md +323 -0
  265. package/claude-assets/skills/cfn-loop-orchestration/SKILL.md +159 -48
  266. package/claude-assets/skills/cfn-loop-orchestration/SPAWN_AGENTS_IMPLEMENTATION.md +188 -0
  267. package/claude-assets/skills/cfn-loop-orchestration/TEST_COVERAGE_REPORT.md +335 -0
  268. package/claude-assets/skills/cfn-loop-orchestration/TEST_COVERAGE_SUMMARY.md +456 -0
  269. package/claude-assets/skills/cfn-loop-orchestration/TYPESCRIPT_INTEGRATION_REPORT.md +709 -0
  270. package/claude-assets/skills/cfn-loop-orchestration/TYPESCRIPT_INTEGRATION_SUMMARY.md +257 -0
  271. package/claude-assets/skills/cfn-loop-orchestration/VALIDATION_REPORT.md +572 -0
  272. package/claude-assets/skills/cfn-loop-orchestration/VALIDATION_SUMMARY.txt +196 -0
  273. package/claude-assets/skills/cfn-loop-orchestration/VALIDATOR_MODULE_GUIDE.md +526 -0
  274. package/claude-assets/skills/cfn-loop-orchestration/archive/legacy-bash/README.md +167 -0
  275. package/claude-assets/skills/cfn-loop-orchestration/archive/legacy-bash/orchestrate-enhanced.sh +548 -0
  276. package/{.claude/skills/cfn-loop-orchestration → claude-assets/skills/cfn-loop-orchestration/archive/legacy-bash}/orchestrate-wrapper.sh +11 -1
  277. package/claude-assets/skills/cfn-loop-orchestration/archive/legacy-bash/orchestrate.sh +182 -0
  278. package/claude-assets/skills/cfn-loop-orchestration/e2e-validation-fixed.js +240 -0
  279. package/claude-assets/skills/cfn-loop-orchestration/e2e-validation.js +213 -0
  280. package/claude-assets/skills/cfn-loop-orchestration/package-lock.json +3 -0
  281. package/claude-assets/skills/cfn-loop-orchestration/package.json +4 -0
  282. package/claude-assets/skills/cfn-loop-orchestration/run-north-star-e2e.ts +210 -0
  283. package/claude-assets/skills/cfn-loop-orchestration/src/cli/orchestrator-cli.ts +396 -0
  284. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/CONFIDENCE_AGGREGATOR.md +564 -0
  285. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/CONFIDENCE_AGGREGATOR_QUICK_REF.md +241 -0
  286. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_IMPLEMENTATION.md +375 -0
  287. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_QUICK_REFERENCE.md +362 -0
  288. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_README.md +307 -0
  289. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_USAGE_GUIDE.md +508 -0
  290. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/confidence-aggregator.ts +473 -0
  291. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/consensus.ts +1 -1
  292. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/context-injector.ts +349 -0
  293. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/context-lookup.ts +486 -0
  294. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/deliverable-verifier.ts +6 -2
  295. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/gate-check.ts +1 -1
  296. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/product-owner-decision.ts +316 -0
  297. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/spawn-agents.ts +357 -0
  298. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/validator.ts +276 -0
  299. package/claude-assets/skills/cfn-loop-orchestration/src/index.ts +2 -0
  300. package/claude-assets/skills/cfn-loop-orchestration/src/orchestrate.ts +743 -2
  301. package/claude-assets/skills/cfn-loop-orchestration/src/types.ts +56 -0
  302. package/claude-assets/skills/cfn-loop-orchestration/test-cli.sh +92 -0
  303. package/claude-assets/skills/cfn-loop-orchestration/test-typescript-integration.sh +442 -0
  304. package/claude-assets/skills/cfn-loop-orchestration/tests/agent-spawner.test.ts +124 -0
  305. package/claude-assets/skills/cfn-loop-orchestration/tests/confidence-aggregator.test.ts +604 -0
  306. package/claude-assets/skills/cfn-loop-orchestration/tests/context-injector.test.ts +561 -0
  307. package/claude-assets/skills/cfn-loop-orchestration/tests/context-lookup.test.ts +661 -0
  308. package/claude-assets/skills/cfn-loop-orchestration/tests/deliverable-verifier.test.ts +2 -2
  309. package/claude-assets/skills/cfn-loop-orchestration/tests/gate-check-edge-cases.test.ts +422 -0
  310. package/claude-assets/skills/cfn-loop-orchestration/tests/gate-checker.test.ts +276 -0
  311. package/claude-assets/skills/cfn-loop-orchestration/tests/logger.test.ts +291 -0
  312. package/claude-assets/skills/cfn-loop-orchestration/tests/north-star-e2e.test.ts +334 -0
  313. package/claude-assets/skills/cfn-loop-orchestration/tests/redis-coordinator.test.ts +321 -0
  314. package/claude-assets/skills/cfn-loop-orchestration/tests/spawn-agents.test.ts +284 -0
  315. package/claude-assets/skills/cfn-loop-orchestration/tests/validator.test.ts +643 -0
  316. package/claude-assets/skills/cfn-loop-output-processing/.eslintrc.json +33 -0
  317. package/claude-assets/skills/cfn-loop-output-processing/DELIVERY_SUMMARY.txt +462 -0
  318. package/claude-assets/skills/cfn-loop-output-processing/DEPRECATION_NOTICE.md +183 -0
  319. package/claude-assets/skills/cfn-loop-output-processing/EXAMPLES.md +609 -0
  320. package/claude-assets/skills/cfn-loop-output-processing/IMPLEMENTATION_SUMMARY.md +418 -0
  321. package/claude-assets/skills/cfn-loop-output-processing/INDEX.md +531 -0
  322. package/claude-assets/skills/cfn-loop-output-processing/MIGRATION.md +362 -0
  323. package/claude-assets/skills/cfn-loop-output-processing/README.md +114 -0
  324. package/claude-assets/skills/cfn-loop-output-processing/SKILL.md +633 -0
  325. package/{.claude/skills/cfn-docker-redis-coordination → claude-assets/skills/cfn-loop-output-processing}/jest.config.js +7 -15
  326. package/claude-assets/skills/cfn-loop-output-processing/package.json +50 -0
  327. package/claude-assets/skills/cfn-loop-output-processing/src/cli/process-loop2.ts +195 -0
  328. package/claude-assets/skills/cfn-loop-output-processing/src/cli/process-loop3.ts +157 -0
  329. package/claude-assets/skills/cfn-loop-output-processing/src/output-processor.ts +632 -0
  330. package/claude-assets/skills/cfn-loop-output-processing/tests/output-processor.test.ts +617 -0
  331. package/claude-assets/skills/{cfn-docker-redis-coordination → cfn-loop-output-processing}/tsconfig.json +16 -7
  332. package/claude-assets/skills/cfn-loop-validation/IMPLEMENTATION_SUMMARY.md +672 -0
  333. package/claude-assets/skills/cfn-loop-validation/INDEX.md +531 -0
  334. package/claude-assets/skills/cfn-loop-validation/README_TYPESCRIPT.md +454 -0
  335. package/claude-assets/skills/cfn-loop-validation/SKILL.md +48 -1
  336. package/claude-assets/skills/cfn-loop-validation/SKILL.md.backup +353 -0
  337. package/claude-assets/skills/cfn-loop-validation/SKILL_TYPESCRIPT.md +782 -0
  338. package/claude-assets/skills/cfn-loop-validation/VAPOR_DETECTION_EXAMPLES.md +598 -0
  339. package/claude-assets/skills/cfn-loop-validation/check-dependencies.sh +22 -0
  340. package/claude-assets/skills/cfn-loop-validation/check-dependencies.sh.backup +31 -0
  341. package/claude-assets/skills/cfn-loop-validation/detect-vapor.sh +59 -0
  342. package/claude-assets/skills/cfn-loop-validation/detect-vapor.sh.backup +37 -0
  343. package/claude-assets/skills/cfn-loop-validation/dist/.tsbuildinfo +1 -0
  344. package/claude-assets/skills/cfn-loop-validation/dist/cli/detect-vapor.d.ts +14 -0
  345. package/claude-assets/skills/cfn-loop-validation/dist/cli/detect-vapor.d.ts.map +1 -0
  346. package/claude-assets/skills/cfn-loop-validation/dist/cli/detect-vapor.js +185 -0
  347. package/claude-assets/skills/cfn-loop-validation/dist/cli/detect-vapor.js.map +1 -0
  348. package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-deliverables.d.ts +14 -0
  349. package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-deliverables.d.ts.map +1 -0
  350. package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-deliverables.js +176 -0
  351. package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-deliverables.js.map +1 -0
  352. package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-gate.d.ts +19 -0
  353. package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-gate.d.ts.map +1 -0
  354. package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-gate.js +123 -0
  355. package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-gate.js.map +1 -0
  356. package/claude-assets/skills/cfn-loop-validation/dist/types.d.ts +156 -0
  357. package/claude-assets/skills/cfn-loop-validation/dist/types.d.ts.map +1 -0
  358. package/claude-assets/skills/cfn-loop-validation/dist/types.js +66 -0
  359. package/claude-assets/skills/cfn-loop-validation/dist/types.js.map +1 -0
  360. package/claude-assets/skills/cfn-loop-validation/dist/validator.d.ts +85 -0
  361. package/claude-assets/skills/cfn-loop-validation/dist/validator.d.ts.map +1 -0
  362. package/claude-assets/skills/cfn-loop-validation/dist/validator.js +411 -0
  363. package/claude-assets/skills/cfn-loop-validation/dist/validator.js.map +1 -0
  364. package/claude-assets/skills/cfn-loop-validation/orchestrate-cfn-loop.sh +22 -0
  365. package/claude-assets/skills/cfn-loop-validation/orchestrate-cfn-loop.sh.backup +252 -0
  366. package/claude-assets/skills/cfn-loop-validation/package.json +93 -0
  367. package/claude-assets/skills/cfn-loop-validation/src/cli/detect-vapor.ts +177 -0
  368. package/claude-assets/skills/cfn-loop-validation/src/cli/validate-deliverables.ts +161 -0
  369. package/claude-assets/skills/cfn-loop-validation/src/cli/validate-gate.ts +139 -0
  370. package/claude-assets/skills/cfn-loop-validation/src/types.ts +215 -0
  371. package/claude-assets/skills/cfn-loop-validation/src/validator.ts +503 -0
  372. package/claude-assets/skills/cfn-loop-validation/tests/validator.test.ts +537 -0
  373. package/claude-assets/skills/{cfn-redis-coordination → cfn-loop-validation}/tsconfig.json +34 -31
  374. package/claude-assets/skills/cfn-loop-validation/validate-deliverables.sh +59 -0
  375. package/claude-assets/skills/cfn-loop-validation/validate-deliverables.sh.backup +37 -0
  376. package/claude-assets/skills/cfn-loop-validation/validate-gate.sh +63 -0
  377. package/claude-assets/skills/cfn-loop-validation/validate-gate.sh.backup +41 -0
  378. package/claude-assets/skills/cfn-loop-validation/validate-iteration.sh +22 -0
  379. package/claude-assets/skills/cfn-loop-validation/validate-iteration.sh.backup +134 -0
  380. package/claude-assets/skills/cfn-product-owner-decision/SKILL.md +479 -147
  381. package/claude-assets/skills/cfn-product-owner-decision/TYPESCRIPT_IMPLEMENTATION.md +653 -0
  382. package/{.claude/skills/cfn-product-owner-decision → claude-assets/skills/cfn-product-owner-decision/archive/legacy-bash}/execute-decision.sh +24 -2
  383. package/claude-assets/skills/cfn-provider-routing/README.md +129 -0
  384. package/claude-assets/skills/cfn-provider-routing/SKILL.md +192 -0
  385. package/claude-assets/skills/cfn-provider-routing/resolve-provider-model.ts +223 -0
  386. package/claude-assets/skills/pre-edit-backup/SKILL.md +324 -0
  387. package/claude-assets/skills/pre-edit-backup/SKILL.md.backup +277 -0
  388. package/claude-assets/skills/pre-edit-backup/backup.sh +22 -0
  389. package/claude-assets/skills/pre-edit-backup/backup.sh.backup +107 -0
  390. package/dist/agents/agent-loader.js +146 -165
  391. package/dist/agents/agent-loader.js.map +1 -1
  392. package/dist/api/auth-endpoints.js +415 -0
  393. package/dist/api/auth-endpoints.js.map +1 -0
  394. package/dist/api/task-endpoints.js +562 -0
  395. package/dist/api/task-endpoints.js.map +1 -0
  396. package/dist/backend/server.js +418 -0
  397. package/dist/backend/server.js.map +1 -0
  398. package/dist/cfn-loop/product-owner/decision-parser.js +356 -0
  399. package/dist/cfn-loop/product-owner/decision-parser.js.map +1 -0
  400. package/dist/cfn-loop/product-owner/index.js +1 -0
  401. package/dist/cfn-loop/product-owner/index.js.map +1 -1
  402. package/dist/cli/agent-command.js +1 -1
  403. package/dist/cli/agent-command.js.map +1 -1
  404. package/dist/cli/agent-completion.js +273 -0
  405. package/dist/cli/agent-completion.js.map +1 -0
  406. package/dist/cli/agent-prompt-builder.js +83 -48
  407. package/dist/cli/agent-prompt-builder.js.map +1 -1
  408. package/dist/cli/agent-spawner.js +499 -0
  409. package/dist/cli/agent-spawner.js.map +1 -0
  410. package/dist/cli/anthropic-client.js +10 -3
  411. package/dist/cli/anthropic-client.js.map +1 -1
  412. package/dist/cli/config-manager.js +91 -109
  413. package/dist/cli/index.js +11 -0
  414. package/dist/cli/index.js.map +1 -1
  415. package/dist/cli/parse-decision-cli.js +268 -0
  416. package/dist/cli/parse-decision-cli.js.map +1 -0
  417. package/dist/cli/post-edit-hook.js +83 -0
  418. package/dist/cli/post-edit-hook.js.map +1 -0
  419. package/dist/cli/pre-edit-hook.js +77 -0
  420. package/dist/cli/pre-edit-hook.js.map +1 -0
  421. package/dist/cli/spawn-agent-cli.js +209 -0
  422. package/dist/cli/spawn-agent-cli.js.map +1 -0
  423. package/dist/coordination/coordination-wrapper.js +383 -0
  424. package/dist/coordination/coordination-wrapper.js.map +1 -0
  425. package/dist/coordination/store-success-criteria.js +68 -0
  426. package/dist/coordination/store-success-criteria.js.map +1 -0
  427. package/dist/coordination/store-task-context.js +65 -0
  428. package/dist/coordination/store-task-context.js.map +1 -0
  429. package/dist/hooks/backup-manager.js +273 -0
  430. package/dist/hooks/backup-manager.js.map +1 -0
  431. package/dist/hooks/post-edit-validator.js +388 -0
  432. package/dist/hooks/post-edit-validator.js.map +1 -0
  433. package/dist/integration/index.js +19 -0
  434. package/dist/integration/index.js.map +1 -0
  435. package/dist/integration/task-mode-adapter.js +297 -0
  436. package/dist/integration/task-mode-adapter.js.map +1 -0
  437. package/dist/integration/trigger-dev-client.js +253 -0
  438. package/dist/integration/trigger-dev-client.js.map +1 -0
  439. package/dist/integration/trigger-dev-webhooks.js +362 -0
  440. package/dist/integration/trigger-dev-webhooks.js.map +1 -0
  441. package/dist/lib/path-validator.js +14 -5
  442. package/dist/lib/path-validator.js.map +1 -1
  443. package/dist/lib/redis-queue-manager.js +5 -1
  444. package/dist/lib/redis-queue-manager.js.map +1 -1
  445. package/dist/middleware/authentication.js +317 -0
  446. package/dist/middleware/authentication.js.map +1 -0
  447. package/dist/services/authentication.js +669 -0
  448. package/dist/services/authentication.js.map +1 -0
  449. package/dist/services/session-management.js +436 -0
  450. package/dist/services/session-management.js.map +1 -0
  451. package/dist/services/skill-deployment.js +8 -6
  452. package/dist/services/skill-deployment.js.map +1 -1
  453. package/dist/services/user-service.js +710 -0
  454. package/dist/services/user-service.js.map +1 -0
  455. package/dist/types/trigger-dev-events.d.js +10 -0
  456. package/dist/types/trigger-dev-events.d.js.map +1 -0
  457. package/docs/README.md +240 -0
  458. package/package.json +13 -4
  459. package/scripts/compare-workflow-performance.sh +556 -0
  460. package/scripts/migrate-to-optimized-workflows.sh +438 -0
  461. package/scripts/organize-docs.sh +338 -0
  462. package/scripts/trigger-dev-setup.sh +267 -0
  463. package/.claude/skills/cfn-docker-redis-coordination/MIGRATION_SUMMARY.md +0 -348
  464. package/.claude/skills/cfn-docker-redis-coordination/README.md +0 -294
  465. package/.claude/skills/cfn-docker-redis-coordination/SKILL.md +0 -435
  466. package/.claude/skills/cfn-docker-redis-coordination/coordinate.sh +0 -650
  467. package/.claude/skills/cfn-docker-redis-coordination/coordinate.sh.backup-1763145142 +0 -641
  468. package/.claude/skills/cfn-docker-redis-coordination/package-lock.json +0 -5259
  469. package/.claude/skills/cfn-docker-redis-coordination/package.json +0 -40
  470. package/.claude/skills/cfn-docker-redis-coordination/src/coordinator.ts +0 -801
  471. package/.claude/skills/cfn-docker-redis-coordination/src/index.ts +0 -42
  472. package/.claude/skills/cfn-docker-redis-coordination/src/types.ts +0 -351
  473. package/.claude/skills/cfn-docker-redis-coordination/tests/coordinator.test.ts +0 -1464
  474. package/.claude/skills/cfn-docker-redis-coordination/tsconfig.json +0 -30
  475. package/.claude/skills/cfn-loop-orchestration/helpers/auto-tune-timeouts.sh +0 -228
  476. package/.claude/skills/cfn-loop-orchestration/helpers/consensus-ts.sh +0 -104
  477. package/.claude/skills/cfn-loop-orchestration/helpers/consensus.sh +0 -94
  478. package/.claude/skills/cfn-loop-orchestration/helpers/context-injection.sh +0 -142
  479. package/.claude/skills/cfn-loop-orchestration/helpers/context-lookup.sh +0 -359
  480. package/.claude/skills/cfn-loop-orchestration/helpers/deliverable-verifier-ts.sh +0 -123
  481. package/.claude/skills/cfn-loop-orchestration/helpers/deliverable-verifier.sh +0 -71
  482. package/.claude/skills/cfn-loop-orchestration/helpers/gate-check.sh +0 -56
  483. package/.claude/skills/cfn-loop-orchestration/helpers/iteration-manager-ts.sh +0 -89
  484. package/.claude/skills/cfn-loop-orchestration/helpers/iteration-manager.sh +0 -87
  485. package/.claude/skills/cfn-loop-orchestration/helpers/orchestrate-ts.sh +0 -104
  486. package/.claude/skills/cfn-loop-orchestration/helpers/parse-test-results.sh +0 -56
  487. package/.claude/skills/cfn-loop-orchestration/helpers/spawn-agents.sh +0 -290
  488. package/.claude/skills/cfn-loop-orchestration/helpers/timeout-calculator-ts.sh +0 -47
  489. package/.claude/skills/cfn-loop-orchestration/helpers/timeout-calculator.sh +0 -51
  490. package/.claude/skills/cfn-loop-orchestration/orchestrate.sh +0 -1345
  491. package/.claude/skills/cfn-redis-coordination/AGENT_LOGGING.md +0 -280
  492. package/.claude/skills/cfn-redis-coordination/BZPOPMIN_FIX_SUMMARY.md +0 -209
  493. package/.claude/skills/cfn-redis-coordination/CENTRALIZED_REDIS_WRAPPER.md +0 -319
  494. package/.claude/skills/cfn-redis-coordination/agent-log.sh.bak +0 -124
  495. package/.claude/skills/cfn-redis-coordination/config.json +0 -61
  496. package/.claude/skills/cfn-redis-coordination/demos/phase4-wake-queue-test-report.md +0 -82
  497. package/.claude/skills/cfn-redis-coordination/demos/test-bzpopmin-fix.sh +0 -274
  498. package/.claude/skills/cfn-redis-coordination/demos/test-cancel-swarm.sh +0 -0
  499. package/.claude/skills/cfn-redis-coordination/docs/migration/PHASE_3_REDIS_COORDINATION_COMPLETION_REPORT.md +0 -553
  500. package/.claude/skills/cfn-redis-coordination/jest.config.js +0 -23
  501. package/.claude/skills/cfn-redis-coordination/package-lock.json +0 -5272
  502. package/.claude/skills/cfn-redis-coordination/package.json +0 -45
  503. package/.claude/skills/cfn-redis-coordination/src/agent-logger.ts +0 -446
  504. package/.claude/skills/cfn-redis-coordination/src/agent-recovery.ts +0 -454
  505. package/.claude/skills/cfn-redis-coordination/src/completion-reporter.ts +0 -396
  506. package/.claude/skills/cfn-redis-coordination/src/context-manager.ts +0 -327
  507. package/.claude/skills/cfn-redis-coordination/src/index.ts +0 -82
  508. package/.claude/skills/cfn-redis-coordination/src/mode-detector.ts +0 -155
  509. package/.claude/skills/cfn-redis-coordination/src/redis/redis-client.ts +0 -305
  510. package/.claude/skills/cfn-redis-coordination/src/redis/redis-functions.ts +0 -283
  511. package/.claude/skills/cfn-redis-coordination/src/redis-client.ts +0 -654
  512. package/.claude/skills/cfn-redis-coordination/src/result-collector.ts +0 -437
  513. package/.claude/skills/cfn-redis-coordination/src/swarm-manager.ts +0 -494
  514. package/.claude/skills/cfn-redis-coordination/src/task-analyzer.ts +0 -404
  515. package/.claude/skills/cfn-redis-coordination/src/task-executor.ts +0 -423
  516. package/.claude/skills/cfn-redis-coordination/src/types.ts +0 -235
  517. package/.claude/skills/cfn-redis-coordination/src/waiting-coordinator.ts +0 -587
  518. package/.claude/skills/cfn-redis-coordination/store-success-criteria.sh +0 -85
  519. package/.claude/skills/cfn-redis-coordination/test-connection-attempts.js +0 -70
  520. package/.claude/skills/cfn-redis-coordination/test-mode-simple.js +0 -121
  521. package/.claude/skills/cfn-redis-coordination/test-redis-check.js +0 -84
  522. package/.claude/skills/cfn-redis-coordination/test-task-mode-redis.cjs +0 -391
  523. package/.claude/skills/cfn-redis-coordination/tests/coordination.test.ts +0 -788
  524. package/.claude/skills/cfn-redis-coordination/update-all-scripts.sh +0 -67
  525. package/claude-assets/agents/cfn-dev-team/coordinators/cfn-v3-coordinator.md +0 -980
  526. package/claude-assets/agents/typescript-specialist.md +0 -280
  527. package/claude-assets/skills/cfn-docker-redis-coordination/MIGRATION_SUMMARY.md +0 -348
  528. package/claude-assets/skills/cfn-docker-redis-coordination/README.md +0 -294
  529. package/claude-assets/skills/cfn-docker-redis-coordination/SKILL.md +0 -435
  530. package/claude-assets/skills/cfn-docker-redis-coordination/coordinate.sh +0 -650
  531. package/claude-assets/skills/cfn-docker-redis-coordination/coordinate.sh.backup-1763145142 +0 -641
  532. package/claude-assets/skills/cfn-docker-redis-coordination/jest.config.js +0 -37
  533. package/claude-assets/skills/cfn-docker-redis-coordination/package-lock.json +0 -5259
  534. package/claude-assets/skills/cfn-docker-redis-coordination/package.json +0 -40
  535. package/claude-assets/skills/cfn-docker-redis-coordination/src/coordinator.ts +0 -801
  536. package/claude-assets/skills/cfn-docker-redis-coordination/src/index.ts +0 -42
  537. package/claude-assets/skills/cfn-docker-redis-coordination/src/types.ts +0 -351
  538. package/claude-assets/skills/cfn-docker-redis-coordination/tests/coordinator.test.ts +0 -1464
  539. package/claude-assets/skills/cfn-loop-orchestration/helpers/auto-tune-timeouts.sh +0 -228
  540. package/claude-assets/skills/cfn-loop-orchestration/helpers/consensus-ts.sh +0 -104
  541. package/claude-assets/skills/cfn-loop-orchestration/helpers/consensus.sh +0 -94
  542. package/claude-assets/skills/cfn-loop-orchestration/helpers/context-injection.sh +0 -142
  543. package/claude-assets/skills/cfn-loop-orchestration/helpers/context-lookup.sh +0 -359
  544. package/claude-assets/skills/cfn-loop-orchestration/helpers/deliverable-verifier-ts.sh +0 -123
  545. package/claude-assets/skills/cfn-loop-orchestration/helpers/deliverable-verifier.sh +0 -71
  546. package/claude-assets/skills/cfn-loop-orchestration/helpers/gate-check.sh +0 -56
  547. package/claude-assets/skills/cfn-loop-orchestration/helpers/iteration-manager-ts.sh +0 -89
  548. package/claude-assets/skills/cfn-loop-orchestration/helpers/iteration-manager.sh +0 -87
  549. package/claude-assets/skills/cfn-loop-orchestration/helpers/orchestrate-ts.sh +0 -104
  550. package/claude-assets/skills/cfn-loop-orchestration/helpers/parse-test-results.sh +0 -56
  551. package/claude-assets/skills/cfn-loop-orchestration/helpers/spawn-agents.sh +0 -290
  552. package/claude-assets/skills/cfn-loop-orchestration/helpers/timeout-calculator-ts.sh +0 -47
  553. package/claude-assets/skills/cfn-loop-orchestration/helpers/timeout-calculator.sh +0 -51
  554. package/claude-assets/skills/cfn-loop-orchestration/orchestrate.sh +0 -1345
  555. package/claude-assets/skills/cfn-redis-cleanup/cleanup-redis.sh +0 -130
  556. package/claude-assets/skills/cfn-redis-coordination/AGENT_LOGGING.md +0 -280
  557. package/claude-assets/skills/cfn-redis-coordination/BZPOPMIN_FIX_SUMMARY.md +0 -209
  558. package/claude-assets/skills/cfn-redis-coordination/CENTRALIZED_REDIS_WRAPPER.md +0 -319
  559. package/claude-assets/skills/cfn-redis-coordination/agent-log.sh.bak +0 -124
  560. package/claude-assets/skills/cfn-redis-coordination/config.json +0 -61
  561. package/claude-assets/skills/cfn-redis-coordination/demos/phase4-wake-queue-test-report.md +0 -82
  562. package/claude-assets/skills/cfn-redis-coordination/demos/test-bzpopmin-fix.sh +0 -274
  563. package/claude-assets/skills/cfn-redis-coordination/demos/test-cancel-swarm.sh +0 -0
  564. package/claude-assets/skills/cfn-redis-coordination/docs/migration/PHASE_3_REDIS_COORDINATION_COMPLETION_REPORT.md +0 -553
  565. package/claude-assets/skills/cfn-redis-coordination/jest.config.js +0 -23
  566. package/claude-assets/skills/cfn-redis-coordination/package-lock.json +0 -5272
  567. package/claude-assets/skills/cfn-redis-coordination/package.json +0 -45
  568. package/claude-assets/skills/cfn-redis-coordination/src/agent-logger.ts +0 -446
  569. package/claude-assets/skills/cfn-redis-coordination/src/agent-recovery.ts +0 -454
  570. package/claude-assets/skills/cfn-redis-coordination/src/completion-reporter.ts +0 -396
  571. package/claude-assets/skills/cfn-redis-coordination/src/context-manager.ts +0 -327
  572. package/claude-assets/skills/cfn-redis-coordination/src/index.ts +0 -82
  573. package/claude-assets/skills/cfn-redis-coordination/src/mode-detector.ts +0 -155
  574. package/claude-assets/skills/cfn-redis-coordination/src/redis/redis-client.ts +0 -305
  575. package/claude-assets/skills/cfn-redis-coordination/src/redis/redis-functions.ts +0 -283
  576. package/claude-assets/skills/cfn-redis-coordination/src/redis-client.ts +0 -654
  577. package/claude-assets/skills/cfn-redis-coordination/src/result-collector.ts +0 -437
  578. package/claude-assets/skills/cfn-redis-coordination/src/swarm-manager.ts +0 -494
  579. package/claude-assets/skills/cfn-redis-coordination/src/task-analyzer.ts +0 -404
  580. package/claude-assets/skills/cfn-redis-coordination/src/task-executor.ts +0 -423
  581. package/claude-assets/skills/cfn-redis-coordination/src/types.ts +0 -235
  582. package/claude-assets/skills/cfn-redis-coordination/src/waiting-coordinator.ts +0 -587
  583. package/claude-assets/skills/cfn-redis-coordination/store-success-criteria.sh +0 -85
  584. package/claude-assets/skills/cfn-redis-coordination/test-connection-attempts.js +0 -70
  585. package/claude-assets/skills/cfn-redis-coordination/test-mode-simple.js +0 -121
  586. package/claude-assets/skills/cfn-redis-coordination/test-redis-check.js +0 -84
  587. package/claude-assets/skills/cfn-redis-coordination/test-task-mode-redis.cjs +0 -391
  588. package/claude-assets/skills/cfn-redis-coordination/tests/coordination.test.ts +0 -788
  589. package/claude-assets/skills/cfn-redis-coordination/update-all-scripts.sh +0 -67
  590. package/claude-assets/skills/cfn-redis-data-extraction/SKILL.md +0 -442
  591. package/claude-assets/skills/cfn-redis-data-extraction/extract.sh +0 -306
  592. package/dist/coordination/index.js +0 -25
  593. package/dist/coordination/index.js.map +0 -1
  594. package/docs/BUG_19_MEMORY_LEAK_TASK_MODE.md +0 -405
  595. package/docs/MEMORY_CLEANUP_GUIDE.md +0 -358
  596. package/docs/MEMORY_LEAK_FIX_SUMMARY.md +0 -322
  597. package/docs/REDIS_CLEANUP_EXECUTIVE_SUMMARY.md +0 -319
  598. package/docs/REDIS_CLEANUP_VERIFICATION_REPORT.md +0 -574
  599. /package/.claude/skills/cfn-loop-orchestration/{inject-loop-context.sh → archive/legacy-bash/inject-loop-context.sh} +0 -0
  600. /package/.claude/skills/cfn-loop-orchestration/{monitor-execution.sh → archive/legacy-bash/monitor-execution.sh} +0 -0
  601. /package/.claude/skills/cfn-redis-coordination/{agent-log.sh → agent-log.sh.backup} +0 -0
  602. /package/.claude/skills/cfn-redis-coordination/{agent-recovery.sh → agent-recovery.sh.backup} +0 -0
  603. /package/.claude/skills/cfn-redis-coordination/{analyze-task-complexity.sh → analyze-task-complexity.sh.backup} +0 -0
  604. /package/.claude/skills/cfn-redis-coordination/bash-wrappers/{store-context.sh → store-context.sh.backup} +0 -0
  605. /package/.claude/skills/cfn-redis-coordination/{cancel-swarm.sh → cancel-swarm.sh.backup} +0 -0
  606. /package/.claude/skills/cfn-redis-coordination/{cfn-loop-exec.sh → cfn-loop-exec.sh.backup} +0 -0
  607. /package/.claude/skills/cfn-redis-coordination/{cfn-loop-relaunch.sh → cfn-loop-relaunch.sh.backup} +0 -0
  608. /package/.claude/skills/cfn-redis-coordination/{collect-confidence-scores.sh → collect-confidence-scores.sh.backup} +0 -0
  609. /package/.claude/skills/cfn-redis-coordination/{collect-results.sh → collect-results.sh.backup} +0 -0
  610. /package/.claude/skills/cfn-redis-coordination/{complete-swarm.sh → complete-swarm.sh.backup} +0 -0
  611. /package/.claude/skills/cfn-redis-coordination/{get-context.sh → get-context.sh.backup} +0 -0
  612. /package/.claude/skills/cfn-redis-coordination/{get-success-criteria.sh → get-success-criteria.sh.backup} +0 -0
  613. /package/.claude/skills/cfn-redis-coordination/{invoke-waiting-mode.sh → invoke-waiting-mode.sh.backup} +0 -0
  614. /package/.claude/skills/cfn-redis-coordination/{redis-cli-wrapper.sh → redis-cli-wrapper.sh.backup} +0 -0
  615. /package/.claude/skills/cfn-redis-coordination/{redis-functions.sh → redis-functions.sh.backup} +0 -0
  616. /package/.claude/skills/cfn-redis-coordination/{report-completion.sh → report-completion.sh.backup} +0 -0
  617. /package/.claude/skills/cfn-redis-coordination/{store-context.sh → store-context.sh.backup} +0 -0
  618. /package/claude-assets/skills/cfn-loop-orchestration/{inject-loop-context.sh → archive/legacy-bash/inject-loop-context.sh} +0 -0
  619. /package/claude-assets/skills/cfn-loop-orchestration/{monitor-execution.sh → archive/legacy-bash/monitor-execution.sh} +0 -0
  620. /package/claude-assets/skills/cfn-redis-coordination/{agent-log.sh → agent-log.sh.backup} +0 -0
  621. /package/claude-assets/skills/cfn-redis-coordination/{agent-recovery.sh → agent-recovery.sh.backup} +0 -0
  622. /package/claude-assets/skills/cfn-redis-coordination/{analyze-task-complexity.sh → analyze-task-complexity.sh.backup} +0 -0
  623. /package/claude-assets/skills/cfn-redis-coordination/bash-wrappers/{store-context.sh → store-context.sh.backup} +0 -0
  624. /package/claude-assets/skills/cfn-redis-coordination/{cancel-swarm.sh → cancel-swarm.sh.backup} +0 -0
  625. /package/claude-assets/skills/cfn-redis-coordination/{cfn-loop-exec.sh → cfn-loop-exec.sh.backup} +0 -0
  626. /package/claude-assets/skills/cfn-redis-coordination/{cfn-loop-relaunch.sh → cfn-loop-relaunch.sh.backup} +0 -0
  627. /package/claude-assets/skills/cfn-redis-coordination/{collect-confidence-scores.sh → collect-confidence-scores.sh.backup} +0 -0
  628. /package/claude-assets/skills/cfn-redis-coordination/{collect-results.sh → collect-results.sh.backup} +0 -0
  629. /package/claude-assets/skills/cfn-redis-coordination/{complete-swarm.sh → complete-swarm.sh.backup} +0 -0
  630. /package/claude-assets/skills/cfn-redis-coordination/{get-context.sh → get-context.sh.backup} +0 -0
  631. /package/claude-assets/skills/cfn-redis-coordination/{get-success-criteria.sh → get-success-criteria.sh.backup} +0 -0
  632. /package/claude-assets/skills/cfn-redis-coordination/{invoke-waiting-mode.sh → invoke-waiting-mode.sh.backup} +0 -0
  633. /package/claude-assets/skills/cfn-redis-coordination/{redis-cli-wrapper.sh → redis-cli-wrapper.sh.backup} +0 -0
  634. /package/claude-assets/skills/cfn-redis-coordination/{redis-functions.sh → redis-functions.sh.backup} +0 -0
  635. /package/claude-assets/skills/cfn-redis-coordination/{report-completion.sh → report-completion.sh.backup} +0 -0
  636. /package/claude-assets/skills/cfn-redis-coordination/{store-context.sh → store-context.sh.backup} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/services/user-service.ts"],"sourcesContent":["/**\r\n * User Service\r\n *\r\n * Comprehensive user management service with authentication, authorization,\r\n * and security features for the CFN Loop system.\r\n */\r\n\r\nimport { DatabaseService } from '../lib/database-service/index.js';\r\nimport { v4 as uuidv4 } from 'uuid';\r\nimport { User, UserRole, UserStatus, CreateUserRequest, UpdateUserRequest, UserSecurity } from '../types/user.js';\r\nimport { PasswordUtils, JWTUtils, AuthRateLimit } from '../middleware/authentication.js';\r\nimport { AuthMiddleware, UserContext, RBACEnforcer, PromotionOperation } from '../middleware/auth-middleware.js';\r\nimport { createLogger } from '../lib/logging.js';\r\nimport { StandardError, ErrorCode } from '../lib/errors.js';\r\n\r\nconst logger = createLogger('user-service');\r\n\r\nexport interface LoginRequest {\r\n email: string;\r\n password: string;\r\n rememberMe?: boolean;\r\n}\r\n\r\nexport interface LoginResponse {\r\n user: PublicUser;\r\n accessToken: string;\r\n refreshToken: string;\r\n expiresIn: number;\r\n}\r\n\r\nexport interface RegisterRequest {\r\n username: string;\r\n email: string;\r\n password: string;\r\n firstName: string;\r\n lastName: string;\r\n displayName?: string;\r\n}\r\n\r\nexport interface PublicUser {\r\n id: string;\r\n username: string;\r\n email: string;\r\n role: UserRole;\r\n status: UserStatus;\r\n profile: {\r\n displayName: string;\r\n firstName: string;\r\n lastName: string;\r\n bio?: string;\r\n avatar?: string;\r\n };\r\n security: {\r\n emailVerified: boolean;\r\n twoFactorEnabled: boolean;\r\n };\r\n}\r\n\r\nexport interface AuthTokens {\r\n accessToken: string;\r\n refreshToken: string;\r\n expiresIn: number;\r\n}\r\n\r\nexport interface UserServiceConfig {\r\n jwtSecret: string;\r\n jwtExpiration: string;\r\n refreshExpiration: string;\r\n bcryptRounds: number;\r\n maxLoginAttempts: number;\r\n loginLockoutMs: number;\r\n emailVerificationRequired: boolean;\r\n twoFactorRequired: boolean;\r\n}\r\n\r\n/**\r\n * User Service Class\r\n *\r\n * Manages user lifecycle, authentication, and authorization.\r\n */\r\nexport class UserService {\r\n private db: DatabaseService;\r\n private authMiddleware: AuthMiddleware;\r\n private rbacEnforcer: RBACEnforcer;\r\n private config: UserServiceConfig;\r\n\r\n constructor(db: DatabaseService, config: UserServiceConfig) {\r\n this.db = db;\r\n this.config = config;\r\n this.authMiddleware = new AuthMiddleware(config.jwtSecret);\r\n this.rbacEnforcer = new RBACEnforcer(this.authMiddleware);\r\n }\r\n\r\n /**\r\n * Initialize the user service\r\n * Creates necessary tables and indexes if they don't exist\r\n */\r\n async initialize(): Promise<void> {\r\n try {\r\n const sqliteAdapter = this.db.getAdapter('sqlite');\r\n \r\n // Create users table\r\n await sqliteAdapter.execute(`\r\n CREATE TABLE IF NOT EXISTS users (\r\n id TEXT PRIMARY KEY,\r\n username TEXT UNIQUE NOT NULL,\r\n email TEXT UNIQUE NOT NULL,\r\n role TEXT NOT NULL DEFAULT 'user',\r\n status TEXT NOT NULL DEFAULT 'pending_verification',\r\n password_hash TEXT NOT NULL,\r\n salt TEXT NOT NULL,\r\n profile_json TEXT NOT NULL,\r\n privacy_json TEXT NOT NULL,\r\n preferences_json TEXT NOT NULL,\r\n security_json TEXT NOT NULL,\r\n stats_json TEXT NOT NULL,\r\n created_at INTEGER NOT NULL,\r\n updated_at INTEGER NOT NULL,\r\n last_login_at INTEGER,\r\n email_verified_at INTEGER,\r\n phone_verified_at INTEGER\r\n )\r\n `);\r\n\r\n // Create refresh tokens table\r\n await sqliteAdapter.execute(`\r\n CREATE TABLE IF NOT EXISTS refresh_tokens (\r\n id TEXT PRIMARY KEY,\r\n user_id TEXT NOT NULL,\r\n token_hash TEXT NOT NULL,\r\n expires_at INTEGER NOT NULL,\r\n created_at INTEGER NOT NULL,\r\n last_used_at INTEGER,\r\n is_revoked BOOLEAN DEFAULT FALSE,\r\n FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE\r\n )\r\n `);\r\n\r\n // Create password reset tokens table\r\n await sqliteAdapter.execute(`\r\n CREATE TABLE IF NOT EXISTS password_reset_tokens (\r\n id TEXT PRIMARY KEY,\r\n user_id TEXT NOT NULL,\r\n token_hash TEXT NOT NULL,\r\n expires_at INTEGER NOT NULL,\r\n created_at INTEGER NOT NULL,\r\n used_at INTEGER,\r\n FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE\r\n )\r\n `);\r\n\r\n // Create email verification tokens table\r\n await sqliteAdapter.execute(`\r\n CREATE TABLE IF NOT EXISTS email_verification_tokens (\r\n id TEXT PRIMARY KEY,\r\n user_id TEXT NOT NULL,\r\n email TEXT NOT NULL,\r\n token_hash TEXT NOT NULL,\r\n expires_at INTEGER NOT NULL,\r\n created_at INTEGER NOT NULL,\r\n verified_at INTEGER,\r\n FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE\r\n )\r\n `);\r\n\r\n // Create indexes\r\n await sqliteAdapter.execute('CREATE INDEX IF NOT EXISTS idx_users_email ON users (email)');\r\n await sqliteAdapter.execute('CREATE INDEX IF NOT EXISTS idx_users_username ON users (username)');\r\n await sqliteAdapter.execute('CREATE INDEX IF NOT EXISTS idx_users_role ON users (role)');\r\n await sqliteAdapter.execute('CREATE INDEX IF NOT EXISTS idx_users_status ON users (status)');\r\n await sqliteAdapter.execute('CREATE INDEX IF NOT EXISTS idx_refresh_tokens_user_id ON refresh_tokens (user_id)');\r\n await sqliteAdapter.execute('CREATE INDEX IF NOT EXISTS idx_refresh_tokens_expires_at ON refresh_tokens (expires_at)');\r\n\r\n logger.info('User service initialized successfully');\r\n } catch (error) {\r\n logger.error('Failed to initialize user service:', error);\r\n throw new StandardError(\r\n ErrorCode.INTERNAL_ERROR,\r\n 'Failed to initialize user service',\r\n {},\r\n error as Error\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Register a new user\r\n */\r\n async register(request: RegisterRequest): Promise<{ user: PublicUser; tokens: AuthTokens }> {\r\n const { username, email, password, firstName, lastName, displayName } = request;\r\n\r\n try {\r\n // Validate input\r\n this.validateEmail(email);\r\n this.validateUsername(username);\r\n this.validatePassword(password);\r\n\r\n // Check if user already exists\r\n const existingUser = await this.findUserByEmailOrUsername(email, username);\r\n if (existingUser) {\r\n throw new StandardError(\r\n ErrorCode.CONFLICT,\r\n existingUser.email === email ? 'Email already registered' : 'Username already taken',\r\n { field: existingUser.email === email ? 'email' : 'username' }\r\n );\r\n }\r\n\r\n // Hash password\r\n const salt = await PasswordUtils.generateSalt();\r\n const passwordHash = await PasswordUtils.hashPassword(password, this.config.bcryptRounds);\r\n\r\n // Create user\r\n const now = Math.floor(Date.now() / 1000);\r\n const userId = uuidv4();\r\n\r\n const user: User = {\r\n id: userId,\r\n username,\r\n email,\r\n role: UserRole.USER,\r\n status: this.config.emailVerificationRequired ? UserStatus.PENDING_VERIFICATION : UserStatus.ACTIVE,\r\n profile: {\r\n firstName,\r\n lastName,\r\n displayName: displayName || `${firstName} ${lastName}`,\r\n },\r\n privacy: {\r\n profileVisibility: 'public',\r\n allowFriendRequests: true,\r\n allowMessages: true,\r\n allowStoryTagging: true,\r\n allowLocationSharing: false,\r\n showOnlineStatus: true,\r\n },\r\n preferences: {\r\n theme: 'auto',\r\n language: 'en',\r\n timezone: 'UTC',\r\n emailNotifications: true,\r\n pushNotifications: true,\r\n autoSaveStories: true,\r\n storyVisibilityDefault: 'private',\r\n },\r\n security: {\r\n email,\r\n emailVerified: !this.config.emailVerificationRequired,\r\n twoFactorEnabled: false,\r\n loginAttempts: 0,\r\n },\r\n stats: {\r\n storiesCount: 0,\r\n friendsCount: 0,\r\n followersCount: 0,\r\n followingCount: 0,\r\n },\r\n createdAt: new Date(now * 1000),\r\n updatedAt: new Date(now * 1000),\r\n };\r\n\r\n // Save user to database\r\n await this.saveUser(user, passwordHash, salt);\r\n\r\n // Create email verification token if required\r\n if (this.config.emailVerificationRequired) {\r\n await this.createEmailVerificationToken(userId, email);\r\n }\r\n\r\n // Generate tokens\r\n const tokens = await this.generateAuthTokens(user);\r\n\r\n // Log user registration\r\n logger.info('User registered successfully', { userId, username, email });\r\n\r\n return {\r\n user: this.toPublicUser(user),\r\n tokens,\r\n };\r\n } catch (error) {\r\n if (error instanceof StandardError) {\r\n throw error;\r\n }\r\n logger.error('User registration failed:', error);\r\n throw new StandardError(\r\n ErrorCode.INTERNAL_ERROR,\r\n 'User registration failed',\r\n {},\r\n error as Error\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Authenticate user and generate tokens\r\n */\r\n async login(request: LoginRequest): Promise<LoginResponse> {\r\n const { email, password, rememberMe } = request;\r\n\r\n try {\r\n // Check rate limiting\r\n if (AuthRateLimit.hasExceededAttempts(email, this.config.maxLoginAttempts, this.config.loginLockoutMs)) {\r\n throw new StandardError(\r\n ErrorCode.TOO_MANY_REQUESTS,\r\n 'Too many login attempts. Please try again later.',\r\n { retryAfter: Math.ceil(this.config.loginLockoutMs / 1000) }\r\n );\r\n }\r\n\r\n // Find user by email\r\n const user = await this.findUserByEmail(email);\r\n if (!user) {\r\n AuthRateLimit.hasExceededAttempts(email, this.config.maxLoginAttempts, this.config.loginLockoutMs);\r\n throw new StandardError(\r\n ErrorCode.NOT_FOUND,\r\n 'Invalid email or password'\r\n );\r\n }\r\n\r\n // Check user status\r\n if (user.status === UserStatus.SUSPENDED) {\r\n throw new StandardError(\r\n ErrorCode.FORBIDDEN,\r\n 'Account suspended. Please contact support.'\r\n );\r\n }\r\n\r\n if (user.status === UserStatus.INACTIVE) {\r\n throw new StandardError(\r\n ErrorCode.FORBIDDEN,\r\n 'Account inactive. Please contact support.'\r\n );\r\n }\r\n\r\n // Get user credentials\r\n const credentials = await this.getUserCredentials(user.id);\r\n if (!credentials) {\r\n throw new StandardError(\r\n ErrorCode.INTERNAL_ERROR,\r\n 'User credentials not found'\r\n );\r\n }\r\n\r\n // Verify password\r\n const isPasswordValid = await PasswordUtils.comparePassword(password, credentials.passwordHash);\r\n if (!isPasswordValid) {\r\n AuthRateLimit.hasExceededAttempts(email, this.config.maxLoginAttempts, this.config.loginLockoutMs);\r\n \r\n // Update failed login attempts\r\n await this.updateFailedLoginAttempts(user.id, user.security.loginAttempts + 1);\r\n \r\n throw new StandardError(\r\n ErrorCode.NOT_FOUND,\r\n 'Invalid email or password'\r\n );\r\n }\r\n\r\n // Clear failed login attempts\r\n AuthRateLimit.clearAttempts(email);\r\n await this.updateFailedLoginAttempts(user.id, 0);\r\n\r\n // Update last login\r\n await this.updateLastLogin(user.id);\r\n\r\n // Generate tokens\r\n const tokens = await this.generateAuthTokens(user, rememberMe);\r\n\r\n // Log successful login\r\n logger.info('User logged in successfully', { userId: user.id, email });\r\n\r\n return {\r\n user: this.toPublicUser(user),\r\n accessToken: tokens.accessToken,\r\n refreshToken: tokens.refreshToken,\r\n expiresIn: tokens.expiresIn,\r\n };\r\n } catch (error) {\r\n if (error instanceof StandardError) {\r\n throw error;\r\n }\r\n logger.error('Login failed:', error);\r\n throw new StandardError(\r\n ErrorCode.INTERNAL_ERROR,\r\n 'Login failed',\r\n {},\r\n error as Error\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Refresh access token using refresh token\r\n */\r\n async refreshToken(refreshToken: string): Promise<AuthTokens> {\r\n try {\r\n // Validate refresh token\r\n const payload = JWTUtils.verifyToken(refreshToken, this.config.jwtSecret);\r\n if (payload.type !== 'refresh') {\r\n throw new StandardError(\r\n ErrorCode.INVALID_TOKEN,\r\n 'Invalid refresh token'\r\n );\r\n }\r\n\r\n // Check if refresh token exists and is not revoked\r\n const tokenRecord = await this.findRefreshToken(payload.jti!, payload.userId);\r\n if (!tokenRecord || tokenRecord.isRevoked) {\r\n throw new StandardError(\r\n ErrorCode.INVALID_TOKEN,\r\n 'Invalid or revoked refresh token'\r\n );\r\n }\r\n\r\n // Find user\r\n const user = await this.findUserById(payload.userId);\r\n if (!user) {\r\n throw new StandardError(\r\n ErrorCode.NOT_FOUND,\r\n 'User not found'\r\n );\r\n }\r\n\r\n // Check user status\r\n if (user.status !== UserStatus.ACTIVE) {\r\n throw new StandardError(\r\n ErrorCode.FORBIDDEN,\r\n 'Account is not active'\r\n );\r\n }\r\n\r\n // Revoke old refresh token\r\n await this.revokeRefreshToken(payload.jti!);\r\n\r\n // Generate new tokens\r\n const tokens = await this.generateAuthTokens(user);\r\n\r\n // Update last used timestamp\r\n await this.updateRefreshTokenLastUsed(payload.jti!);\r\n\r\n logger.info('Token refreshed successfully', { userId: user.id });\r\n\r\n return tokens;\r\n } catch (error) {\r\n if (error instanceof StandardError) {\r\n throw error;\r\n }\r\n logger.error('Token refresh failed:', error);\r\n throw new StandardError(\r\n ErrorCode.INTERNAL_ERROR,\r\n 'Token refresh failed',\r\n {},\r\n error as Error\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Logout user and revoke tokens\r\n */\r\n async logout(refreshToken: string): Promise<void> {\r\n try {\r\n // Validate refresh token\r\n const payload = JWTUtils.decodeToken(refreshToken);\r\n if (!payload || payload.type !== 'refresh') {\r\n return; // Invalid token, just return success\r\n }\r\n\r\n // Revoke refresh token\r\n if (payload.jti) {\r\n await this.revokeRefreshToken(payload.jti);\r\n }\r\n\r\n logger.info('User logged out successfully', { userId: payload.userId });\r\n } catch (error) {\r\n logger.error('Logout failed:', error);\r\n // Don't throw error on logout to prevent client issues\r\n }\r\n }\r\n\r\n /**\r\n * Get user by ID\r\n */\r\n async getUserById(userId: string): Promise<PublicUser | null> {\r\n try {\r\n const user = await this.findUserById(userId);\r\n return user ? this.toPublicUser(user) : null;\r\n } catch (error) {\r\n logger.error('Failed to get user by ID:', error);\r\n return null;\r\n }\r\n }\r\n\r\n /**\r\n * Update user profile\r\n */\r\n async updateUserProfile(userId: string, updates: UpdateUserRequest): Promise<PublicUser> {\r\n try {\r\n const user = await this.findUserById(userId);\r\n if (!user) {\r\n throw new StandardError(\r\n ErrorCode.NOT_FOUND,\r\n 'User not found'\r\n );\r\n }\r\n\r\n // Update user\r\n const updatedUser = {\r\n ...user,\r\n profile: {\r\n ...user.profile,\r\n ...updates.profile,\r\n },\r\n privacy: {\r\n ...user.privacy,\r\n ...updates.privacy,\r\n },\r\n preferences: {\r\n ...user.preferences,\r\n ...updates.preferences,\r\n },\r\n updatedAt: new Date(),\r\n };\r\n\r\n await this.saveUser(updatedUser);\r\n\r\n logger.info('User profile updated successfully', { userId });\r\n\r\n return this.toPublicUser(updatedUser);\r\n } catch (error) {\r\n if (error instanceof StandardError) {\r\n throw error;\r\n }\r\n logger.error('Failed to update user profile:', error);\r\n throw new StandardError(\r\n ErrorCode.INTERNAL_ERROR,\r\n 'Failed to update user profile',\r\n {},\r\n error as Error\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Change user password\r\n */\r\n async changePassword(userId: string, currentPassword: string, newPassword: string): Promise<void> {\r\n try {\r\n // Validate new password\r\n this.validatePassword(newPassword);\r\n\r\n // Get current credentials\r\n const credentials = await this.getUserCredentials(userId);\r\n if (!credentials) {\r\n throw new StandardError(\r\n ErrorCode.NOT_FOUND,\r\n 'User not found'\r\n );\r\n }\r\n\r\n // Verify current password\r\n const isCurrentPasswordValid = await PasswordUtils.comparePassword(currentPassword, credentials.passwordHash);\r\n if (!isCurrentPasswordValid) {\r\n throw new StandardError(\r\n ErrorCode.VALIDATION_FAILED,\r\n 'Current password is incorrect'\r\n );\r\n }\r\n\r\n // Hash new password\r\n const salt = await PasswordUtils.generateSalt();\r\n const newPasswordHash = await PasswordUtils.hashPassword(newPassword, this.config.bcryptRounds);\r\n\r\n // Update password\r\n await this.updateUserPassword(userId, newPasswordHash, salt);\r\n\r\n // Revoke all refresh tokens for this user\r\n await this.revokeAllUserRefreshTokens(userId);\r\n\r\n logger.info('Password changed successfully', { userId });\r\n } catch (error) {\r\n if (error instanceof StandardError) {\r\n throw error;\r\n }\r\n logger.error('Failed to change password:', error);\r\n throw new StandardError(\r\n ErrorCode.INTERNAL_ERROR,\r\n 'Failed to change password',\r\n {},\r\n error as Error\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Validate JWT token and return user context\r\n */\r\n async validateToken(token: string): Promise<UserContext> {\r\n try {\r\n return this.authMiddleware.validateToken(token);\r\n } catch (error) {\r\n throw new StandardError(\r\n ErrorCode.INVALID_TOKEN,\r\n 'Invalid authentication token',\r\n {},\r\n error as Error\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Check if user has permission for an operation\r\n */\r\n async checkPermission(userContext: UserContext, operation: PromotionOperation): Promise<boolean> {\r\n try {\r\n return this.rbacEnforcer.hasPermission(userContext, operation);\r\n } catch (error) {\r\n logger.error('Permission check failed:', error);\r\n return false;\r\n }\r\n }\r\n\r\n /**\r\n * Enforce permission check - throws if user lacks permission\r\n */\r\n async enforcePermission(userContext: UserContext, operation: PromotionOperation, skillId?: string): Promise<void> {\r\n try {\r\n this.rbacEnforcer.enforcePermission(userContext, operation, skillId);\r\n } catch (error) {\r\n if (error instanceof StandardError) {\r\n throw error;\r\n }\r\n throw new StandardError(\r\n ErrorCode.FORBIDDEN,\r\n 'Permission check failed',\r\n {},\r\n error as Error\r\n );\r\n }\r\n }\r\n\r\n // Private helper methods\r\n\r\n private validateEmail(email: string): void {\r\n const emailRegex = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\r\n if (!emailRegex.test(email)) {\r\n throw new StandardError(\r\n ErrorCode.VALIDATION_FAILED,\r\n 'Invalid email format'\r\n );\r\n }\r\n }\r\n\r\n private validateUsername(username: string): void {\r\n if (username.length < 3 || username.length > 30) {\r\n throw new StandardError(\r\n ErrorCode.VALIDATION_FAILED,\r\n 'Username must be between 3 and 30 characters'\r\n );\r\n }\r\n\r\n const usernameRegex = /^[a-zA-Z0-9_-]+$/;\r\n if (!usernameRegex.test(username)) {\r\n throw new StandardError(\r\n ErrorCode.VALIDATION_FAILED,\r\n 'Username can only contain letters, numbers, underscores, and hyphens'\r\n );\r\n }\r\n }\r\n\r\n private validatePassword(password: string): void {\r\n if (!PasswordUtils.validatePasswordStrength(password)) {\r\n throw new StandardError(\r\n ErrorCode.VALIDATION_FAILED,\r\n 'Password must be at least 8 characters long and contain uppercase, lowercase, number, and special character'\r\n );\r\n }\r\n }\r\n\r\n private async generateAuthTokens(user: User, rememberMe: boolean = false): Promise<AuthTokens> {\r\n const expiresIn = rememberMe ? '30d' : this.config.jwtExpiration;\r\n const refreshExpiresIn = rememberMe ? '90d' : this.config.refreshExpiration;\r\n\r\n // Generate access token\r\n const accessTokenPayload = {\r\n userId: user.id,\r\n email: user.email,\r\n role: user.role,\r\n type: 'access',\r\n };\r\n const accessToken = JWTUtils.generateToken(accessTokenPayload, this.config.jwtSecret, expiresIn);\r\n\r\n // Generate refresh token\r\n const refreshTokenId = uuidv4();\r\n const refreshTokenPayload = {\r\n userId: user.id,\r\n email: user.email,\r\n role: user.role,\r\n type: 'refresh',\r\n jti: refreshTokenId,\r\n };\r\n const refreshToken = JWTUtils.generateToken(refreshTokenPayload, this.config.jwtSecret, refreshExpiresIn);\r\n\r\n // Save refresh token to database\r\n const now = Math.floor(Date.now() / 1000);\r\n const refreshTokenHash = await PasswordUtils.hashPassword(refreshToken, 10);\r\n const expiresAt = now + (rememberMe ? 90 * 24 * 60 * 60 : 7 * 24 * 60 * 60); // 90 days or 7 days\r\n\r\n await this.saveRefreshToken(refreshTokenId, user.id, refreshTokenHash, expiresAt);\r\n\r\n // Calculate expiresIn in seconds\r\n const expiresInSeconds = rememberMe ? 30 * 24 * 60 * 60 : 24 * 60 * 60; // 30 days or 24 hours\r\n\r\n return {\r\n accessToken,\r\n refreshToken,\r\n expiresIn: expiresInSeconds,\r\n };\r\n }\r\n\r\n private toPublicUser(user: User): PublicUser {\r\n return {\r\n id: user.id,\r\n username: user.username,\r\n email: user.email,\r\n role: user.role,\r\n status: user.status,\r\n profile: {\r\n displayName: user.profile.displayName,\r\n firstName: user.profile.firstName,\r\n lastName: user.profile.lastName,\r\n bio: user.profile.bio,\r\n avatar: user.profile.avatar,\r\n },\r\n security: {\r\n emailVerified: user.security.emailVerified,\r\n twoFactorEnabled: user.security.twoFactorEnabled,\r\n },\r\n };\r\n }\r\n\r\n // Database helper methods\r\n\r\n private async findUserById(userId: string): Promise<User | null> {\r\n const adapter = this.db.getAdapter('sqlite');\r\n const row = await adapter.get(\r\n 'SELECT * FROM users WHERE id = ?',\r\n [userId]\r\n );\r\n return row ? this.rowToUser(row) : null;\r\n }\r\n\r\n private async findUserByEmail(email: string): Promise<User | null> {\r\n const adapter = this.db.getAdapter('sqlite');\r\n const row = await adapter.get(\r\n 'SELECT * FROM users WHERE email = ?',\r\n [email]\r\n );\r\n return row ? this.rowToUser(row) : null;\r\n }\r\n\r\n private async findUserByEmailOrUsername(email: string, username: string): Promise<User | null> {\r\n const adapter = this.db.getAdapter('sqlite');\r\n const row = await adapter.get(\r\n 'SELECT * FROM users WHERE email = ? OR username = ?',\r\n [email, username]\r\n );\r\n return row ? this.rowToUser(row) : null;\r\n }\r\n\r\n private async getUserCredentials(userId: string): Promise<{ passwordHash: string; salt: string } | null> {\r\n const adapter = this.db.getAdapter('sqlite');\r\n const row = await adapter.get(\r\n 'SELECT password_hash, salt FROM users WHERE id = ?',\r\n [userId]\r\n );\r\n return row ? { passwordHash: row.password_hash, salt: row.salt } : null;\r\n }\r\n\r\n private async saveUser(user: User, passwordHash?: string, salt?: string): Promise<void> {\r\n const adapter = this.db.getAdapter('sqlite');\r\n const now = Math.floor(Date.now() / 1000);\r\n\r\n await adapter.execute(`\r\n INSERT OR REPLACE INTO users (\r\n id, username, email, role, status, password_hash, salt,\r\n profile_json, privacy_json, preferences_json, security_json, stats_json,\r\n created_at, updated_at, last_login_at, email_verified_at, phone_verified_at\r\n ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\r\n `, [\r\n user.id,\r\n user.username,\r\n user.email,\r\n user.role,\r\n user.status,\r\n passwordHash,\r\n salt,\r\n JSON.stringify(user.profile),\r\n JSON.stringify(user.privacy),\r\n JSON.stringify(user.preferences),\r\n JSON.stringify(user.security),\r\n JSON.stringify(user.stats),\r\n Math.floor(user.createdAt.getTime() / 1000),\r\n now,\r\n user.updatedAt ? Math.floor(user.updatedAt.getTime() / 1000) : now,\r\n user.security.emailVerifiedAt ? Math.floor(user.security.emailVerifiedAt.getTime() / 1000) : null,\r\n user.security.phoneVerifiedAt ? Math.floor(user.security.phoneVerifiedAt.getTime() / 1000) : null,\r\n ]);\r\n }\r\n\r\n private async updateFailedLoginAttempts(userId: string, attempts: number): Promise<void> {\r\n const adapter = this.db.getAdapter('sqlite');\r\n const lockedUntil = attempts >= this.config.maxLoginAttempts ? \r\n Math.floor(Date.now() / 1000) + Math.floor(this.config.loginLockoutMs / 1000) : null;\r\n\r\n await adapter.execute(`\r\n UPDATE users \r\n SET security_json = json_set(\r\n json_set(security_json, '$.loginAttempts', ?),\r\n '$.lockedUntil',\r\n ?\r\n )\r\n WHERE id = ?\r\n `, [attempts, lockedUntil, userId]);\r\n }\r\n\r\n private async updateLastLogin(userId: string): Promise<void> {\r\n const adapter = this.db.getAdapter('sqlite');\r\n const now = Math.floor(Date.now() / 1000);\r\n\r\n await adapter.execute(`\r\n UPDATE users \r\n SET last_login_at = ?, updated_at = ?\r\n WHERE id = ?\r\n `, [now, now, userId]);\r\n }\r\n\r\n private async updateRefreshTokenLastUsed(tokenId: string): Promise<void> {\r\n const adapter = this.db.getAdapter('sqlite');\r\n const now = Math.floor(Date.now() / 1000);\r\n\r\n await adapter.execute(`\r\n UPDATE refresh_tokens \r\n SET last_used_at = ?\r\n WHERE id = ?\r\n `, [now, tokenId]);\r\n }\r\n\r\n private async saveRefreshToken(\r\n tokenId: string,\r\n userId: string,\r\n tokenHash: string,\r\n expiresAt: number\r\n ): Promise<void> {\r\n const adapter = this.db.getAdapter('sqlite');\r\n const now = Math.floor(Date.now() / 1000);\r\n\r\n await adapter.execute(`\r\n INSERT INTO refresh_tokens (id, user_id, token_hash, expires_at, created_at)\r\n VALUES (?, ?, ?, ?, ?)\r\n `, [tokenId, userId, tokenHash, expiresAt, now]);\r\n }\r\n\r\n private async findRefreshToken(tokenId: string, userId: string): Promise<{ id: string; isRevoked: boolean } | null> {\r\n const adapter = this.db.getAdapter('sqlite');\r\n const row = await adapter.get(\r\n 'SELECT id, is_revoked FROM refresh_tokens WHERE id = ? AND user_id = ? AND expires_at > ?',\r\n [tokenId, userId, Math.floor(Date.now() / 1000)]\r\n );\r\n return row;\r\n }\r\n\r\n private async revokeRefreshToken(tokenId: string): Promise<void> {\r\n const adapter = this.db.getAdapter('sqlite');\r\n await adapter.execute(\r\n 'UPDATE refresh_tokens SET is_revoked = TRUE WHERE id = ?',\r\n [tokenId]\r\n );\r\n }\r\n\r\n private async revokeAllUserRefreshTokens(userId: string): Promise<void> {\r\n const adapter = this.db.getAdapter('sqlite');\r\n await adapter.execute(\r\n 'UPDATE refresh_tokens SET is_revoked = TRUE WHERE user_id = ?',\r\n [userId]\r\n );\r\n }\r\n\r\n private async updateUserPassword(userId: string, passwordHash: string, salt: string): Promise<void> {\r\n const adapter = this.db.getAdapter('sqlite');\r\n const now = Math.floor(Date.now() / 1000);\r\n\r\n await adapter.execute(`\r\n UPDATE users \r\n SET password_hash = ?, salt = ?, updated_at = ?,\r\n security_json = json_set(security_json, '$.lastPasswordChange', ?)\r\n WHERE id = ?\r\n `, [passwordHash, salt, now, now, userId]);\r\n }\r\n\r\n private async createEmailVerificationToken(userId: string, email: string): Promise<void> {\r\n const adapter = this.db.getAdapter('sqlite');\r\n const tokenId = uuidv4();\r\n const token = uuidv4();\r\n const tokenHash = await PasswordUtils.hashPassword(token, 10);\r\n const expiresAt = Math.floor(Date.now() / 1000) + (24 * 60 * 60); // 24 hours\r\n\r\n await adapter.execute(`\r\n INSERT INTO email_verification_tokens (id, user_id, email, token_hash, expires_at, created_at)\r\n VALUES (?, ?, ?, ?, ?, ?)\r\n `, [tokenId, userId, email, tokenHash, expiresAt, Math.floor(Date.now() / 1000)]);\r\n\r\n // In a real implementation, send email with token\r\n logger.info('Email verification token created', { userId, email, token });\r\n }\r\n\r\n private rowToUser(row: any): User {\r\n return {\r\n id: row.id,\r\n username: row.username,\r\n email: row.email,\r\n role: row.role as UserRole,\r\n status: row.status as UserStatus,\r\n profile: JSON.parse(row.profile_json),\r\n privacy: JSON.parse(row.privacy_json),\r\n preferences: JSON.parse(row.preferences_json),\r\n security: JSON.parse(row.security_json),\r\n stats: JSON.parse(row.stats_json),\r\n createdAt: new Date(row.created_at * 1000),\r\n updatedAt: new Date(row.updated_at * 1000),\r\n };\r\n }\r\n}\r\n\r\nexport default UserService;"],"names":["v4","uuidv4","UserRole","UserStatus","PasswordUtils","JWTUtils","AuthRateLimit","AuthMiddleware","RBACEnforcer","createLogger","StandardError","ErrorCode","logger","UserService","db","authMiddleware","rbacEnforcer","config","jwtSecret","initialize","sqliteAdapter","getAdapter","execute","info","error","INTERNAL_ERROR","register","request","username","email","password","firstName","lastName","displayName","validateEmail","validateUsername","validatePassword","existingUser","findUserByEmailOrUsername","CONFLICT","field","salt","generateSalt","passwordHash","hashPassword","bcryptRounds","now","Math","floor","Date","userId","user","id","role","USER","status","emailVerificationRequired","PENDING_VERIFICATION","ACTIVE","profile","privacy","profileVisibility","allowFriendRequests","allowMessages","allowStoryTagging","allowLocationSharing","showOnlineStatus","preferences","theme","language","timezone","emailNotifications","pushNotifications","autoSaveStories","storyVisibilityDefault","security","emailVerified","twoFactorEnabled","loginAttempts","stats","storiesCount","friendsCount","followersCount","followingCount","createdAt","updatedAt","saveUser","createEmailVerificationToken","tokens","generateAuthTokens","toPublicUser","login","rememberMe","hasExceededAttempts","maxLoginAttempts","loginLockoutMs","TOO_MANY_REQUESTS","retryAfter","ceil","findUserByEmail","NOT_FOUND","SUSPENDED","FORBIDDEN","INACTIVE","credentials","getUserCredentials","isPasswordValid","comparePassword","updateFailedLoginAttempts","clearAttempts","updateLastLogin","accessToken","refreshToken","expiresIn","payload","verifyToken","type","INVALID_TOKEN","tokenRecord","findRefreshToken","jti","isRevoked","findUserById","revokeRefreshToken","updateRefreshTokenLastUsed","logout","decodeToken","getUserById","updateUserProfile","updates","updatedUser","changePassword","currentPassword","newPassword","isCurrentPasswordValid","VALIDATION_FAILED","newPasswordHash","updateUserPassword","revokeAllUserRefreshTokens","validateToken","token","checkPermission","userContext","operation","hasPermission","enforcePermission","skillId","emailRegex","test","length","usernameRegex","validatePasswordStrength","jwtExpiration","refreshExpiresIn","refreshExpiration","accessTokenPayload","generateToken","refreshTokenId","refreshTokenPayload","refreshTokenHash","expiresAt","saveRefreshToken","expiresInSeconds","bio","avatar","adapter","row","get","rowToUser","password_hash","JSON","stringify","getTime","emailVerifiedAt","phoneVerifiedAt","attempts","lockedUntil","tokenId","tokenHash","parse","profile_json","privacy_json","preferences_json","security_json","stats_json","created_at","updated_at"],"mappings":"AAAA;;;;;CAKC,GAGD,SAASA,MAAMC,MAAM,QAAQ,OAAO;AACpC,SAAeC,QAAQ,EAAEC,UAAU,QAA4D,mBAAmB;AAClH,SAASC,aAAa,EAAEC,QAAQ,EAAEC,aAA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;YAChBwB,MAAMiH,IAAIjH,IAAI;YACdE,QAAQ+G,IAAI/G,MAAM;YAClBI,SAAS+G,KAAKS,KAAK,CAACb,IAAIc,YAAY;YACpCxH,SAAS8G,KAAKS,KAAK,CAACb,IAAIe,YAAY;YACpClH,aAAauG,KAAKS,KAAK,CAACb,IAAIgB,gBAAgB;YAC5C3G,UAAU+F,KAAKS,KAAK,CAACb,IAAIiB,aAAa;YACtCxG,OAAO2F,KAAKS,KAAK,CAACb,IAAIkB,UAAU;YAChCpG,WAAW,IAAInC,KAAKqH,IAAImB,UAAU,GAAG;YACrCpG,WAAW,IAAIpC,KAAKqH,IAAIoB,UAAU,GAAG;QACvC;IACF;AACF;AAEA,eAAe7K,YAAY"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * TypeScript declarations for trigger.dev webhook events and CFN Loop integration
3
+ * Used for type-safe event handling in trigger.dev orchestration
4
+ */ /**
5
+ * Run status literal type matching trigger.dev API
6
+ */ /**
7
+ * Task mode agent result
8
+ */ export { };
9
+
10
+ //# sourceMappingURL=trigger-dev-events.d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/types/trigger-dev-events.d.ts"],"sourcesContent":["/**\r\n * TypeScript declarations for trigger.dev webhook events and CFN Loop integration\r\n * Used for type-safe event handling in trigger.dev orchestration\r\n */\r\n\r\n/**\r\n * Run status literal type matching trigger.dev API\r\n */\r\nexport type RunStatusType = 'PENDING' | 'RUNNING' | 'SUCCESS' | 'FAILURE' | 'CANCELED' | 'TIMEOUT' | 'WAITING';\r\n\r\n/**\r\n * CFN Loop agent type discriminated union\r\n */\r\nexport type AgentType = 'loop3-implementer' | 'loop2-validator' | 'product-owner' | 'orchestrator';\r\n\r\n/**\r\n * Agent completion event payload\r\n */\r\nexport interface AgentCompletePayload {\r\n agentId: string;\r\n agentType: AgentType;\r\n taskId: string;\r\n status: 'success' | 'failure';\r\n output: string;\r\n confidenceScore?: number;\r\n executionTimeMs: number;\r\n metadata?: Record<string, unknown>;\r\n}\r\n\r\n/**\r\n * Gate check result from Loop 3\r\n */\r\nexport interface GateResultPayload {\r\n taskId: string;\r\n gateType: 'loop3-test-gate' | 'loop2-consensus-gate';\r\n passed: boolean;\r\n passRate?: number;\r\n details: {\r\n threshold: number;\r\n actualValue: number;\r\n failureReason?: string;\r\n };\r\n timestamp: string;\r\n}\r\n\r\n/**\r\n * Consensus collection result from Loop 2\r\n */\r\nexport interface ConsensusResultPayload {\r\n taskId: string;\r\n validatorCount: number;\r\n consensusScore: number;\r\n consensusThreshold: number;\r\n passed: boolean;\r\n validatorScores: Array<{\r\n validatorId: string;\r\n score: number;\r\n feedback?: string;\r\n }>;\r\n timestamp: string;\r\n}\r\n\r\n/**\r\n * Product Owner decision payload\r\n */\r\nexport interface PODecisionPayload {\r\n taskId: string;\r\n decision: 'PROCEED' | 'ITERATE' | 'ABORT';\r\n reasoning: string;\r\n reviewNotes?: string;\r\n deliverablesSummary?: string;\r\n timestamp: string;\r\n}\r\n\r\n/**\r\n * CFN Loop trigger payload\r\n */\r\nexport interface CFNLoopPayload {\r\n taskId: string;\r\n description: string;\r\n mode: 'standard' | 'mvp' | 'enterprise';\r\n successCriteria: {\r\n gate: string;\r\n consensusThreshold: number;\r\n testPassRateThreshold: number;\r\n };\r\n context?: Record<string, unknown>;\r\n webhookUrl?: string;\r\n}\r\n\r\n/**\r\n * Trigger.dev run status response\r\n */\r\nexport interface RunStatusResponse {\r\n id: string;\r\n status: RunStatusType;\r\n startedAt?: string;\r\n completedAt?: string;\r\n output?: unknown;\r\n error?: string;\r\n}\r\n\r\n/**\r\n * Trigger.dev run object\r\n */\r\nexport interface Run {\r\n id: string;\r\n taskId: string;\r\n status: RunStatusType;\r\n createdAt: string;\r\n updatedAt: string;\r\n startedAt?: string;\r\n completedAt?: string;\r\n output?: unknown;\r\n error?: string;\r\n metadata?: Record<string, unknown>;\r\n}\r\n\r\n/**\r\n * Webhook signature verification options\r\n */\r\nexport interface WebhookVerificationOptions {\r\n algorithmType: 'sha256' | 'sha512';\r\n headerName: string;\r\n}\r\n\r\n/**\r\n * Typed webhook request context\r\n */\r\nexport interface WebhookContext<T> {\r\n payload: T;\r\n isVerified: boolean;\r\n timestamp: number;\r\n signature?: string;\r\n}\r\n\r\n/**\r\n * Webhook handler result\r\n */\r\nexport interface WebhookHandlerResult {\r\n success: boolean;\r\n message: string;\r\n data?: unknown;\r\n}\r\n\r\n/**\r\n * Task mode coordination event (in-memory)\r\n */\r\nexport interface TaskModeEvent {\r\n type: 'agent-complete' | 'gate-result' | 'consensus-result' | 'po-decision';\r\n taskId: string;\r\n payload: AgentCompletePayload | GateResultPayload | ConsensusResultPayload | PODecisionPayload;\r\n timestamp: number;\r\n}\r\n\r\n/**\r\n * Task mode agent spawning request\r\n */\r\nexport interface TaskModeSpawnRequest {\r\n agentType: AgentType;\r\n taskId: string;\r\n payload: Record<string, unknown>;\r\n timeoutMs?: number;\r\n}\r\n\r\n/**\r\n * Task mode agent result\r\n */\r\nexport interface TaskModeAgentResult {\r\n agentId: string;\r\n agentType: AgentType;\r\n success: boolean;\r\n output: string;\r\n confidenceScore?: number;\r\n executionTimeMs: number;\r\n}\r\n"],"names":[],"mappings":"AAAA;;;CAGC,GAED;;CAEC,GA8JD;;CAEC,GACD,WAOC"}
package/docs/README.md ADDED
@@ -0,0 +1,240 @@
1
+ # Documentation Structure - Quick Start
2
+
3
+ **Last Updated:** November 20, 2025
4
+ **Structure:** 15 folders, 732 files
5
+
6
+ ---
7
+
8
+ ## Finding What You Need
9
+
10
+ ### By Topic
11
+
12
+ **Architecture & System Design**
13
+ → `docs/architecture/` - System patterns, agent models, database design
14
+
15
+ **Orchestration & CFN Loop**
16
+ → `docs/cfn-system/` - Methodology, coordinator/orchestrator patterns
17
+
18
+ **Deployment & Operations**
19
+ → `docs/operations/` - Runbooks, environment setup, configuration
20
+
21
+ **Testing & Quality**
22
+ → `docs/testing/` - Test patterns, frameworks, performance benchmarks
23
+ → `docs/quality-assurance/` - QA strategy, coverage targets
24
+
25
+ **Code & Implementation**
26
+ → `docs/implementation/` - Execution patterns, delivery guides
27
+ → `docs/guides/` - Developer tutorials, quick references
28
+
29
+ **Bug Tracking & Issues**
30
+ → `docs/bugs/` - Issue database, fixes, investigations
31
+
32
+ **Security & Compliance**
33
+ → `docs/security/` - Audits, compliance, threat analysis
34
+
35
+ **Reports & Analytics**
36
+ → `docs/analysis-reports/` - Test coverage, metrics, dashboards
37
+ → `docs/analytics/` - System intelligence, organizational insights
38
+
39
+ **Code Reviews & Feedback**
40
+ → `docs/reviews/` - Review guidelines, consistency analysis
41
+
42
+ **Strategic Planning**
43
+ → `docs/roadmap/` - Product roadmap, iteration planning
44
+
45
+ **Major Migrations**
46
+ → `docs/migration/` - Version upgrades, deprecation notices
47
+
48
+ ---
49
+
50
+ ## By Role
51
+
52
+ ### Product Manager
53
+ - **Roadmap:** `docs/roadmap/`
54
+ - **Analytics:** `docs/analytics/`
55
+ - **Architecture:** `docs/architecture/`
56
+
57
+ ### Developer
58
+ - **Setup:** `docs/guides/`
59
+ - **Code Patterns:** `docs/implementation/`
60
+ - **Testing:** `docs/testing/`
61
+ - **Architecture:** `docs/architecture/`
62
+
63
+ ### DevOps
64
+ - **Deployment:** `docs/operations/`
65
+ - **Docker:** `docs/docker/`
66
+ - **Security:** `docs/security/`
67
+
68
+ ### QA/Tester
69
+ - **Test Strategy:** `docs/quality-assurance/`
70
+ - **Test Patterns:** `docs/testing/`
71
+ - **Test Reports:** `docs/analysis-reports/`
72
+ - **Issues:** `docs/bugs/`
73
+
74
+ ### Technical Lead
75
+ - **System Design:** `docs/architecture/`
76
+ - **Orchestration:** `docs/cfn-system/`
77
+ - **Security:** `docs/security/`
78
+ - **Operations:** `docs/operations/`
79
+
80
+ ---
81
+
82
+ ## Folder Structure (15 folders)
83
+
84
+ ```
85
+ docs/
86
+ ├── analytics/ (23 files) System analytics & intelligence
87
+ ├── analysis-reports/ (53 files) Reports & metrics
88
+ ├── architecture/ (134 files) System design & patterns
89
+ ├── bugs/ (73 files) Issue tracking & fixes
90
+ ├── cfn-system/ (36 files) Orchestration methodology
91
+ ├── docker/ (59 files) Containers & CI/CD
92
+ ├── guides/ (55 files) Developer guides & tutorials
93
+ ├── implementation/ (51 files) Execution patterns
94
+ ├── migration/ (53 files) Version upgrades
95
+ ├── operations/ (58 files) Deployment & operations
96
+ ├── quality-assurance/ (28 files) QA strategy & validation
97
+ ├── reviews/ (43 files) Code reviews & feedback
98
+ ├── roadmap/ (18 files) Strategic planning
99
+ ├── security/ (47 files) Compliance & security
100
+ └── testing/ (33 files) All testing disciplines
101
+ ```
102
+
103
+ ---
104
+
105
+ ## Consolidated from (Old Folders)
106
+
107
+ If you're looking for content that was previously in:
108
+
109
+ - **testing-performance/** → Now in `docs/testing/`
110
+ - **resources/** → Now in `docs/guides/`
111
+ - **analysis/, meta/, handoff/** → Now in `docs/reviews/`
112
+ - **fixes/** → Now in `docs/bugs/`
113
+ - **environment, environment-config/** → Now in `docs/operations/`
114
+ - **features, agent-spawner, database/** → Now in `docs/architecture/`
115
+ - **cfn-loop, reports/** → Now in `docs/analysis-reports/`
116
+ - **ace-system, organization/** → Now in `docs/analytics/`
117
+ - **iteration-reports/** → Now in `docs/roadmap/`
118
+
119
+ ---
120
+
121
+ ## Quick Search
122
+
123
+ ```bash
124
+ # Find documentation by keyword
125
+ grep -r "search term" docs/
126
+
127
+ # Find in specific folder
128
+ grep -r "term" docs/testing/
129
+
130
+ # Find markdown files only
131
+ grep -r "term" docs/ --include="*.md"
132
+ ```
133
+
134
+ ---
135
+
136
+ ## Key Documents
137
+
138
+ ### Getting Started
139
+ - `docs/guides/DEVELOPER_TYPESCRIPT_MIGRATION_GUIDE.md`
140
+ - `docs/architecture/AGENT_OUTPUT_STANDARDS.md`
141
+ - `docs/NAVIGATION_GUIDE.md` (detailed navigation reference)
142
+
143
+ ### Architecture
144
+ - `docs/architecture/` - Browse architecture decisions
145
+ - `docs/cfn-system/CFN_LOOP_ARCHITECTURE.md`
146
+ - `docs/docker/` - Container patterns
147
+
148
+ ### Operations
149
+ - `docs/operations/` - Deployment procedures
150
+ - `docs/security/` - Security policies
151
+ - `docs/bugs/` - Issue tracking
152
+
153
+ ### Quality
154
+ - `docs/testing/` - Test frameworks
155
+ - `docs/quality-assurance/` - QA strategy
156
+ - `docs/analysis-reports/` - Test coverage
157
+
158
+ ---
159
+
160
+ ## Recent Changes
161
+
162
+ **Consolidation Completed:** November 20, 2025
163
+
164
+ The documentation structure was consolidated from 29 folders to 15 folders:
165
+ - **48% folder reduction** while maintaining all 732 files
166
+ - **Improved navigation** with domain-based organization
167
+ - **Zero data loss** - all content preserved
168
+
169
+ See `CONSOLIDATION_REPORT.md` for details.
170
+
171
+ ---
172
+
173
+ ## Documentation Files
174
+
175
+ For detailed navigation and information:
176
+
177
+ - **NAVIGATION_GUIDE.md** - How to find documentation
178
+ - **CONSOLIDATION_PLAN.md** - Original consolidation strategy
179
+ - **CONSOLIDATION_REPORT.md** - Complete execution report
180
+ - **CONSOLIDATION_COMMANDS.md** - Technical reference
181
+ - **CONSOLIDATION_STATUS.md** - Final status (in root directory)
182
+ - **CONSOLIDATION_EXECUTION_SUMMARY.md** - Executive summary (in root directory)
183
+
184
+ ---
185
+
186
+ ## Folder Responsibilities
187
+
188
+ ### Kept Intact (7 folders)
189
+ - architecture - System design & patterns
190
+ - cfn-system - Orchestration methodology
191
+ - docker - Container infrastructure
192
+ - implementation - Execution patterns
193
+ - migration - Version upgrades
194
+ - quality-assurance - QA strategy
195
+ - security - Compliance & security
196
+
197
+ ### Expanded (6 folders)
198
+ - testing - All testing disciplines (added performance)
199
+ - guides - Developer guides (added resources)
200
+ - operations - Operations management (added environment)
201
+ - bugs - Issue tracking (added fixes)
202
+ - reviews - Code reviews (added analysis, meta)
203
+ - roadmap - Strategic planning (added iterations)
204
+
205
+ ### New (2 folders)
206
+ - analytics - System intelligence & insights
207
+ - analysis-reports - Reports & metrics
208
+
209
+ ---
210
+
211
+ ## Next Steps
212
+
213
+ 1. **Bookmark this README** for quick reference
214
+ 2. **Read NAVIGATION_GUIDE.md** for detailed navigation
215
+ 3. **Explore folders** for your area of interest
216
+ 4. **Use grep** to search for specific topics
217
+ 5. **Report issues** if you find broken links
218
+
219
+ ---
220
+
221
+ ## Support
222
+
223
+ **Questions?** Check:
224
+ - NAVIGATION_GUIDE.md - Detailed folder descriptions
225
+ - CONSOLIDATION_PLAN.md - Why folders were consolidated
226
+ - CONSOLIDATION_REPORT.md - What changed and how
227
+
228
+ **Can't find something?**
229
+ ```bash
230
+ grep -r "your search term" docs/
231
+ ```
232
+
233
+ ---
234
+
235
+ **Status:** Complete
236
+ **Files Preserved:** 732 (100%)
237
+ **Data Loss:** 0
238
+ **Ready for Use:** Yes
239
+
240
+ For more details, see CONSOLIDATION_STATUS.md in the root directory.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-flow-novice",
3
- "version": "2.15.11",
3
+ "version": "2.16.0",
4
4
  "description": "AI agent orchestration framework with namespace-isolated skills, agents, and CFN Loop validation. Safe installation with ~0.01% collision risk.",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -98,8 +98,13 @@
98
98
  "homepage": "https://github.com/yourusername/claude-flow-novice#readme",
99
99
  "scripts": {
100
100
  "dev": "tsx src/cli/index.ts",
101
- "build": "npm run clean && npm run build:swc",
101
+ "build": "npm run clean && npm run build:swc && npm run build:orchestrator",
102
102
  "build:swc": "swc src -d dist --config-file .swcrc --ignore '**/*.test.ts' --ignore '**/*.test.tsx' --ignore '**/*.spec.ts'",
103
+ "build:orchestrator": "cd .claude/skills/cfn-loop-orchestration && npm run build 2>/dev/null || echo 'Orchestrator build skipped (optional)'",
104
+ "build:all": "npm run build && npm run build:spawner && npm run build:selector && npm run build:coordination",
105
+ "build:spawner": "cd src/coordination && tsc spawn-agent.ts --outDir ../../dist/coordination --module commonjs --target es2020 --skipLibCheck 2>/dev/null || echo 'Spawner build skipped'",
106
+ "build:selector": "cd .claude/skills/cfn-agent-selection-with-fallback && npm run build 2>/dev/null || echo 'Selector build skipped'",
107
+ "build:coordination": "cd src/coordination && tsc store-task-context.ts store-success-criteria.ts --outDir ../../dist/coordination --module es2020 --target es2020 --esModuleInterop --allowSyntheticDefaultImports --skipLibCheck 2>/dev/null || echo 'Coordination build skipped'",
103
108
  "clean": "rm -rf dist",
104
109
  "test": "jest",
105
110
  "test:skills": "jest skill-markdown-validator.test.ts",
@@ -125,7 +130,7 @@
125
130
  "portal:status": "./scripts/portal-status.sh",
126
131
  "test:watch": "jest --watch",
127
132
  "test:coverage": "jest --coverage",
128
- "test:integration": "jest tests/integration --maxWorkers=4",
133
+ "test:integration": "jest --config=jest.integration.config.ts --maxWorkers=4",
129
134
  "test:performance": "jest tests/performance --maxWorkers=2",
130
135
  "test:load": "jest tests/load-testing --maxWorkers=2 --testTimeout=30000",
131
136
  "docker:build": "docker build -f Dockerfile.production -t claude-flow-novice:production .",
@@ -146,7 +151,9 @@
146
151
  "db:rollback:dry-run": "tsx scripts/migrations/rollback.ts --dry-run",
147
152
  "db:migrations:list": "tsx scripts/migrations/list-migrations.ts",
148
153
  "db:migrations:validate": "tsx scripts/migrations/validate.ts",
149
- "db:migrations:history": "tsx scripts/migrations/history.ts"
154
+ "db:migrations:history": "tsx scripts/migrations/history.ts",
155
+ "test:integration:verbose": "jest --config=jest.integration.config.ts --maxWorkers=4 --verbose",
156
+ "test:integration:watch": "jest --config=jest.integration.config.ts --maxWorkers=2 --watch"
150
157
  },
151
158
  "dependencies": {
152
159
  "@anthropic-ai/sdk": "^0.67.0",
@@ -166,6 +173,7 @@
166
173
  "jsonwebtoken": "^9.0.2",
167
174
  "lodash": "^4.17.21",
168
175
  "redis": "^5.8.3",
176
+ "shell-quote": "^1.8.3",
169
177
  "socket.io": "^4.8.1",
170
178
  "sqlite": "^5.1.1",
171
179
  "sqlite3": "^5.1.7",
@@ -184,6 +192,7 @@
184
192
  "@types/jest": "^30.0.0",
185
193
  "@types/lodash": "^4.17.20",
186
194
  "@types/pg": "^8.15.6",
195
+ "@types/shell-quote": "^1.7.5",
187
196
  "@types/sqlite3": "^3.1.11",
188
197
  "@types/uuid": "^10.0.0",
189
198
  "@types/yaml": "^1.9.6",