oneie 3.6.40 → 3.8.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 (984) hide show
  1. package/README.md +28 -9
  2. package/dist/admin/build.d.ts +15 -0
  3. package/dist/admin/build.d.ts.map +1 -0
  4. package/dist/admin/build.js +295 -0
  5. package/dist/admin/build.js.map +1 -0
  6. package/dist/admin/index.d.ts +24 -0
  7. package/dist/admin/index.d.ts.map +1 -0
  8. package/dist/admin/index.js +98 -0
  9. package/dist/admin/index.js.map +1 -0
  10. package/dist/admin/list.d.ts +14 -0
  11. package/dist/admin/list.d.ts.map +1 -0
  12. package/dist/admin/list.js +90 -0
  13. package/dist/admin/list.js.map +1 -0
  14. package/dist/admin/manifest.d.ts +86 -0
  15. package/dist/admin/manifest.d.ts.map +1 -0
  16. package/dist/admin/manifest.js +183 -0
  17. package/dist/admin/manifest.js.map +1 -0
  18. package/dist/admin/monorepo.d.ts +25 -0
  19. package/dist/admin/monorepo.d.ts.map +1 -0
  20. package/dist/admin/monorepo.js +59 -0
  21. package/dist/admin/monorepo.js.map +1 -0
  22. package/dist/admin/release.d.ts +17 -0
  23. package/dist/admin/release.d.ts.map +1 -0
  24. package/dist/admin/release.js +144 -0
  25. package/dist/admin/release.js.map +1 -0
  26. package/dist/admin/sync.d.ts +14 -0
  27. package/dist/admin/sync.d.ts.map +1 -0
  28. package/dist/admin/sync.js +104 -0
  29. package/dist/admin/sync.js.map +1 -0
  30. package/dist/admin/validate.d.ts +15 -0
  31. package/dist/admin/validate.d.ts.map +1 -0
  32. package/dist/admin/validate.js +169 -0
  33. package/dist/admin/validate.js.map +1 -0
  34. package/dist/commands/agent.d.ts +2 -0
  35. package/dist/commands/agent.d.ts.map +1 -1
  36. package/dist/commands/agent.js +44 -0
  37. package/dist/commands/agent.js.map +1 -1
  38. package/dist/commands/ask.d.ts +4 -0
  39. package/dist/commands/ask.d.ts.map +1 -0
  40. package/dist/commands/ask.js +8 -0
  41. package/dist/commands/ask.js.map +1 -0
  42. package/dist/commands/bounty.d.ts +4 -0
  43. package/dist/commands/bounty.d.ts.map +1 -0
  44. package/dist/commands/bounty.js +24 -0
  45. package/dist/commands/bounty.js.map +1 -0
  46. package/dist/commands/capabilities.d.ts +4 -0
  47. package/dist/commands/capabilities.d.ts.map +1 -0
  48. package/dist/commands/capabilities.js +18 -0
  49. package/dist/commands/capabilities.js.map +1 -0
  50. package/dist/commands/claw.d.ts +4 -0
  51. package/dist/commands/claw.d.ts.map +1 -0
  52. package/dist/commands/claw.js +14 -0
  53. package/dist/commands/claw.js.map +1 -0
  54. package/dist/commands/commend.d.ts +4 -0
  55. package/dist/commands/commend.d.ts.map +1 -0
  56. package/dist/commands/commend.js +13 -0
  57. package/dist/commands/commend.js.map +1 -0
  58. package/dist/commands/completion.d.ts +4 -0
  59. package/dist/commands/completion.d.ts.map +1 -0
  60. package/dist/commands/completion.js +49 -0
  61. package/dist/commands/completion.js.map +1 -0
  62. package/dist/commands/config.d.ts +4 -0
  63. package/dist/commands/config.d.ts.map +1 -0
  64. package/dist/commands/config.js +78 -0
  65. package/dist/commands/config.js.map +1 -0
  66. package/dist/commands/deploy.d.ts +4 -0
  67. package/dist/commands/deploy.d.ts.map +1 -0
  68. package/dist/commands/deploy.js +10 -0
  69. package/dist/commands/deploy.js.map +1 -0
  70. package/dist/commands/doctor.d.ts +4 -0
  71. package/dist/commands/doctor.d.ts.map +1 -0
  72. package/dist/commands/doctor.js +72 -0
  73. package/dist/commands/doctor.js.map +1 -0
  74. package/dist/commands/export.d.ts +4 -0
  75. package/dist/commands/export.d.ts.map +1 -0
  76. package/dist/commands/export.js +15 -0
  77. package/dist/commands/export.js.map +1 -0
  78. package/dist/commands/fade.d.ts +4 -0
  79. package/dist/commands/fade.d.ts.map +1 -0
  80. package/dist/commands/fade.js +15 -0
  81. package/dist/commands/fade.js.map +1 -0
  82. package/dist/commands/flag.d.ts +4 -0
  83. package/dist/commands/flag.d.ts.map +1 -0
  84. package/dist/commands/flag.js +13 -0
  85. package/dist/commands/flag.js.map +1 -0
  86. package/dist/commands/forget.d.ts +4 -0
  87. package/dist/commands/forget.d.ts.map +1 -0
  88. package/dist/commands/forget.js +16 -0
  89. package/dist/commands/forget.js.map +1 -0
  90. package/dist/commands/frontier.d.ts +4 -0
  91. package/dist/commands/frontier.d.ts.map +1 -0
  92. package/dist/commands/frontier.js +11 -0
  93. package/dist/commands/frontier.js.map +1 -0
  94. package/dist/commands/health.d.ts +4 -0
  95. package/dist/commands/health.d.ts.map +1 -0
  96. package/dist/commands/health.js +11 -0
  97. package/dist/commands/health.js.map +1 -0
  98. package/dist/commands/highways.d.ts +4 -0
  99. package/dist/commands/highways.d.ts.map +1 -0
  100. package/dist/commands/highways.js +14 -0
  101. package/dist/commands/highways.js.map +1 -0
  102. package/dist/commands/hire.d.ts +4 -0
  103. package/dist/commands/hire.d.ts.map +1 -0
  104. package/dist/commands/hire.js +16 -0
  105. package/dist/commands/hire.js.map +1 -0
  106. package/dist/commands/init.d.ts.map +1 -1
  107. package/dist/commands/init.js +69 -42
  108. package/dist/commands/init.js.map +1 -1
  109. package/dist/commands/know.d.ts +4 -0
  110. package/dist/commands/know.d.ts.map +1 -0
  111. package/dist/commands/know.js +8 -0
  112. package/dist/commands/know.js.map +1 -0
  113. package/dist/commands/launch.d.ts +4 -0
  114. package/dist/commands/launch.d.ts.map +1 -0
  115. package/dist/commands/launch.js +16 -0
  116. package/dist/commands/launch.js.map +1 -0
  117. package/dist/commands/mark.d.ts +4 -0
  118. package/dist/commands/mark.d.ts.map +1 -0
  119. package/dist/commands/mark.js +15 -0
  120. package/dist/commands/mark.js.map +1 -0
  121. package/dist/commands/pay.d.ts +4 -0
  122. package/dist/commands/pay.d.ts.map +1 -0
  123. package/dist/commands/pay.js +21 -0
  124. package/dist/commands/pay.js.map +1 -0
  125. package/dist/commands/pipe.d.ts +4 -0
  126. package/dist/commands/pipe.d.ts.map +1 -0
  127. package/dist/commands/pipe.js +35 -0
  128. package/dist/commands/pipe.js.map +1 -0
  129. package/dist/commands/publish.d.ts +4 -0
  130. package/dist/commands/publish.d.ts.map +1 -0
  131. package/dist/commands/publish.js +23 -0
  132. package/dist/commands/publish.js.map +1 -0
  133. package/dist/commands/recall.d.ts +4 -0
  134. package/dist/commands/recall.d.ts.map +1 -0
  135. package/dist/commands/recall.js +12 -0
  136. package/dist/commands/recall.js.map +1 -0
  137. package/dist/commands/repl.d.ts +4 -0
  138. package/dist/commands/repl.d.ts.map +1 -0
  139. package/dist/commands/repl.js +56 -0
  140. package/dist/commands/repl.js.map +1 -0
  141. package/dist/commands/reveal.d.ts +4 -0
  142. package/dist/commands/reveal.d.ts.map +1 -0
  143. package/dist/commands/reveal.js +11 -0
  144. package/dist/commands/reveal.js.map +1 -0
  145. package/dist/commands/revenue.d.ts +4 -0
  146. package/dist/commands/revenue.d.ts.map +1 -0
  147. package/dist/commands/revenue.js +11 -0
  148. package/dist/commands/revenue.js.map +1 -0
  149. package/dist/commands/select.d.ts +4 -0
  150. package/dist/commands/select.d.ts.map +1 -0
  151. package/dist/commands/select.js +19 -0
  152. package/dist/commands/select.js.map +1 -0
  153. package/dist/commands/signal.d.ts +4 -0
  154. package/dist/commands/signal.d.ts.map +1 -0
  155. package/dist/commands/signal.js +8 -0
  156. package/dist/commands/signal.js.map +1 -0
  157. package/dist/commands/stats.d.ts +4 -0
  158. package/dist/commands/stats.d.ts.map +1 -0
  159. package/dist/commands/stats.js +11 -0
  160. package/dist/commands/stats.js.map +1 -0
  161. package/dist/commands/status.d.ts +4 -0
  162. package/dist/commands/status.d.ts.map +1 -0
  163. package/dist/commands/status.js +18 -0
  164. package/dist/commands/status.js.map +1 -0
  165. package/dist/commands/sync.d.ts +4 -0
  166. package/dist/commands/sync.d.ts.map +1 -0
  167. package/dist/commands/sync.js +20 -0
  168. package/dist/commands/sync.js.map +1 -0
  169. package/dist/commands/tail.d.ts +4 -0
  170. package/dist/commands/tail.d.ts.map +1 -0
  171. package/dist/commands/tail.js +51 -0
  172. package/dist/commands/tail.js.map +1 -0
  173. package/dist/commands/warn.d.ts +4 -0
  174. package/dist/commands/warn.d.ts.map +1 -0
  175. package/dist/commands/warn.js +15 -0
  176. package/dist/commands/warn.js.map +1 -0
  177. package/dist/create-org-profile.js +2 -2
  178. package/dist/create-user-profile.js +2 -2
  179. package/dist/index.js +135 -7
  180. package/dist/index.js.map +1 -1
  181. package/dist/lib/args.d.ts +11 -0
  182. package/dist/lib/args.d.ts.map +1 -0
  183. package/dist/lib/args.js +57 -0
  184. package/dist/lib/args.js.map +1 -0
  185. package/dist/lib/config.d.ts +12 -0
  186. package/dist/lib/config.d.ts.map +1 -0
  187. package/dist/lib/config.js +38 -0
  188. package/dist/lib/config.js.map +1 -0
  189. package/dist/lib/http.d.ts +9 -0
  190. package/dist/lib/http.d.ts.map +1 -0
  191. package/dist/lib/http.js +25 -0
  192. package/dist/lib/http.js.map +1 -0
  193. package/dist/lib/output.d.ts +5 -0
  194. package/dist/lib/output.d.ts.map +1 -0
  195. package/dist/lib/output.js +32 -0
  196. package/dist/lib/output.js.map +1 -0
  197. package/dist/lib/sdk.d.ts +10 -0
  198. package/dist/lib/sdk.d.ts.map +1 -0
  199. package/dist/lib/sdk.js +22 -0
  200. package/dist/lib/sdk.js.map +1 -0
  201. package/dist/lib/telemetry.d.ts +4 -0
  202. package/dist/lib/telemetry.d.ts.map +1 -0
  203. package/dist/lib/telemetry.js +61 -0
  204. package/dist/lib/telemetry.js.map +1 -0
  205. package/dist/utils/file-resolver.js +1 -3
  206. package/dist/utils/file-resolver.js.map +1 -1
  207. package/dist/utils/installation-setup.d.ts +15 -0
  208. package/dist/utils/installation-setup.d.ts.map +1 -1
  209. package/dist/utils/installation-setup.js +71 -8
  210. package/dist/utils/installation-setup.js.map +1 -1
  211. package/package.json +5 -21
  212. package/.claude/agents/TROUBLESHOOTING.md +0 -530
  213. package/.claude/agents/agent-backend.md +0 -574
  214. package/.claude/agents/agent-builder.md +0 -911
  215. package/.claude/agents/agent-claude.md +0 -645
  216. package/.claude/agents/agent-clean.md +0 -477
  217. package/.claude/agents/agent-clone.md +0 -554
  218. package/.claude/agents/agent-designer.md +0 -1080
  219. package/.claude/agents/agent-director.md +0 -2254
  220. package/.claude/agents/agent-documenter.md +0 -688
  221. package/.claude/agents/agent-frontend.md +0 -1199
  222. package/.claude/agents/agent-integrator.md +0 -670
  223. package/.claude/agents/agent-lawyer.md +0 -1320
  224. package/.claude/agents/agent-news.md +0 -363
  225. package/.claude/agents/agent-onboard.md +0 -613
  226. package/.claude/agents/agent-ontology.md +0 -585
  227. package/.claude/agents/agent-ops.md +0 -1275
  228. package/.claude/agents/agent-problem-solver.md +0 -669
  229. package/.claude/agents/agent-quality.md +0 -1042
  230. package/.claude/agents/agent-sales.md +0 -507
  231. package/.claude/agents/agent-writer.md +0 -1068
  232. package/.claude/commands/cascade.md +0 -742
  233. package/.claude/commands/chat.md +0 -728
  234. package/.claude/commands/commit.md +0 -95
  235. package/.claude/commands/create.md +0 -544
  236. package/.claude/commands/deploy.md +0 -309
  237. package/.claude/commands/fast.md +0 -636
  238. package/.claude/commands/mcp-on.md +0 -191
  239. package/.claude/commands/media-upload.md +0 -186
  240. package/.claude/commands/news.md +0 -274
  241. package/.claude/commands/onboard.md +0 -440
  242. package/.claude/commands/one.md +0 -398
  243. package/.claude/commands/optimize.md +0 -74
  244. package/.claude/commands/plan.md +0 -719
  245. package/.claude/commands/push.md +0 -214
  246. package/.claude/commands/release.md +0 -105
  247. package/.claude/commands/review.md +0 -99
  248. package/.claude/commands/server.md +0 -487
  249. package/.claude/commands/start.md +0 -227
  250. package/.claude/commands/test.md +0 -197
  251. package/.claude/commands/validate.md +0 -140
  252. package/.claude/hooks/.last-news-context +0 -1
  253. package/.claude/hooks/PULL-BEFORE-PUSH-GUIDE.md +0 -473
  254. package/.claude/hooks/README-knowledge-hooks.md +0 -451
  255. package/.claude/hooks/README-news-generation.md +0 -364
  256. package/.claude/hooks/README-root-cleanup.md +0 -200
  257. package/.claude/hooks/README.md +0 -284
  258. package/.claude/hooks/__pycache__/todo.cpython-312.pyc +0 -0
  259. package/.claude/hooks/__pycache__/todo.cpython-313.pyc +0 -0
  260. package/.claude/hooks/auto-format.sh +0 -106
  261. package/.claude/hooks/check-filenames.py +0 -177
  262. package/.claude/hooks/clean-post.py +0 -468
  263. package/.claude/hooks/clean-pre.py +0 -393
  264. package/.claude/hooks/clean-root-markdown.sh +0 -73
  265. package/.claude/hooks/commit-push.sh +0 -95
  266. package/.claude/hooks/done.py +0 -236
  267. package/.claude/hooks/format-hook.sh +0 -163
  268. package/.claude/hooks/formatting.py +0 -187
  269. package/.claude/hooks/hook-logger.sh +0 -173
  270. package/.claude/hooks/knowledge-post.py +0 -355
  271. package/.claude/hooks/knowledge-pre.py +0 -245
  272. package/.claude/hooks/mcp-on.sh +0 -134
  273. package/.claude/hooks/notification-hook.sh +0 -279
  274. package/.claude/hooks/ontology-validation.py +0 -255
  275. package/.claude/hooks/push.sh +0 -153
  276. package/.claude/hooks/release-cli.sh +0 -205
  277. package/.claude/hooks/root-cleanup.py +0 -217
  278. package/.claude/hooks/security-hook.sh +0 -397
  279. package/.claude/hooks/tag-all-docs.py +0 -464
  280. package/.claude/hooks/test-validate-ontology.sh +0 -170
  281. package/.claude/hooks/todo.py +0 -368
  282. package/.claude/hooks/track-changes.sh +0 -101
  283. package/.claude/hooks/validate-imports.py +0 -182
  284. package/.claude/hooks/validate-ontology-structure-summary.md +0 -243
  285. package/.claude/hooks/validate-ontology-structure.py +0 -558
  286. package/.claude/hooks/validate-ontology-structure.py.backup +0 -518
  287. package/.claude/hooks/validate-ontology.py +0 -140
  288. package/.claude/hooks/write-news.sh +0 -194
  289. package/.claude/skills/INDEX.md +0 -523
  290. package/.claude/skills/REGISTRY.md +0 -529
  291. package/.claude/skills/agent-backend-create-mutation.md +0 -319
  292. package/.claude/skills/agent-designer-create-wireframe.md +0 -341
  293. package/.claude/skills/agent-frontend-create-page.md +0 -413
  294. package/.claude/skills/agents/README.md +0 -238
  295. package/.claude/skills/astro/add-content-collection.md +0 -30
  296. package/.claude/skills/astro/check-build.md +0 -29
  297. package/.claude/skills/astro/create-component.md +0 -29
  298. package/.claude/skills/astro/create-page.md +0 -30
  299. package/.claude/skills/astro/optimize-performance.md +0 -21
  300. package/.claude/skills/convex/check-deployment.md +0 -46
  301. package/.claude/skills/convex/create-mutation.md +0 -405
  302. package/.claude/skills/convex/create-query.md +0 -52
  303. package/.claude/skills/convex/read-schema.md +0 -373
  304. package/.claude/skills/convex/test-function.md +0 -50
  305. package/.claude/skills/deployment/check-deployment-health.md +0 -20
  306. package/.claude/skills/deployment/create-release.md +0 -21
  307. package/.claude/skills/deployment/deploy-cloudflare.md +0 -31
  308. package/.claude/skills/deployment/deploy-convex.md +0 -30
  309. package/.claude/skills/deployment/sync-repositories.md +0 -19
  310. package/.claude/skills/design/check-accessibility.md +0 -21
  311. package/.claude/skills/design/create-component-spec.md +0 -27
  312. package/.claude/skills/design/generate-design-tokens.md +0 -24
  313. package/.claude/skills/design/generate-wireframe.md +0 -30
  314. package/.claude/skills/documentation/create-migration-guide.md +0 -20
  315. package/.claude/skills/documentation/generate-api-docs.md +0 -27
  316. package/.claude/skills/documentation/generate-readme.md +0 -22
  317. package/.claude/skills/documentation/update-knowledge.md +0 -20
  318. package/.claude/skills/integration/connect-external-system.md +0 -21
  319. package/.claude/skills/integration/implement-a2a.md +0 -20
  320. package/.claude/skills/integration/implement-acp.md +0 -20
  321. package/.claude/skills/integration/verify-integration.md +0 -20
  322. package/.claude/skills/ontology/README.md +0 -255
  323. package/.claude/skills/ontology/check-dimension.md +0 -307
  324. package/.claude/skills/ontology/generate-entity-type.md +0 -339
  325. package/.claude/skills/ontology/validate-schema.md +0 -229
  326. package/.claude/skills/ontology/verify-relationships.md +0 -310
  327. package/.claude/skills/problem-solving/analyze-test-failure.md +0 -21
  328. package/.claude/skills/problem-solving/identify-root-cause.md +0 -20
  329. package/.claude/skills/problem-solving/propose-solution.md +0 -29
  330. package/.claude/skills/problem-solving/verify-fix.md +0 -21
  331. package/.claude/skills/sales/generate-demo-script.md +0 -21
  332. package/.claude/skills/sales/qualify-lead.md +0 -30
  333. package/.claude/skills/sales/track-trial.md +0 -20
  334. package/.claude/skills/sales/verify-kyc.md +0 -20
  335. package/.claude/skills/testing/analyze-coverage.md +0 -24
  336. package/.claude/skills/testing/generate-tests.md +0 -24
  337. package/.claude/skills/testing/run-tests.md +0 -27
  338. package/.claude/skills/testing/validate-e2e.md +0 -25
  339. package/AGENTS.md +0 -60
  340. package/CLAUDE.md +0 -321
  341. package/CREATE-WEBSITE.md +0 -458
  342. package/SECURITY.md +0 -31
  343. package/dist/commands/create-website.d.ts +0 -19
  344. package/dist/commands/create-website.d.ts.map +0 -1
  345. package/dist/commands/create-website.js +0 -231
  346. package/dist/commands/create-website.js.map +0 -1
  347. package/folders.yaml +0 -92
  348. package/one/README.md +0 -760
  349. package/one/connections/a2a.md +0 -600
  350. package/one/connections/acp.md +0 -808
  351. package/one/connections/acps.md +0 -749
  352. package/one/connections/agentkit.md +0 -367
  353. package/one/connections/agui.md +0 -785
  354. package/one/connections/any-backend.md +0 -1720
  355. package/one/connections/ap2.md +0 -1072
  356. package/one/connections/api/queries-reference.md +0 -860
  357. package/one/connections/api-docs.md +0 -1909
  358. package/one/connections/api-reference.md +0 -1029
  359. package/one/connections/api.md +0 -2208
  360. package/one/connections/architecture-diagram.md +0 -112
  361. package/one/connections/communications.md +0 -467
  362. package/one/connections/connections.md +0 -357
  363. package/one/connections/copilotkit.md +0 -1577
  364. package/one/connections/cryptonetworks.md +0 -799
  365. package/one/connections/documentation.md +0 -1138
  366. package/one/connections/effect.md +0 -297
  367. package/one/connections/elizaos.md +0 -1308
  368. package/one/connections/groups.md +0 -814
  369. package/one/connections/inference.md +0 -76
  370. package/one/connections/integration-examples.md +0 -893
  371. package/one/connections/integration-guide.md +0 -887
  372. package/one/connections/integration-phase2.md +0 -754
  373. package/one/connections/kyc.md +0 -650
  374. package/one/connections/mcp.md +0 -860
  375. package/one/connections/membership.md +0 -1170
  376. package/one/connections/middleware.md +0 -1085
  377. package/one/connections/multitenant.md +0 -1359
  378. package/one/connections/n8n.md +0 -1033
  379. package/one/connections/patterns.md +0 -107
  380. package/one/connections/protocols.md +0 -297
  381. package/one/connections/relationships.md +0 -125
  382. package/one/connections/schema.md +0 -605
  383. package/one/connections/service-layer.md +0 -568
  384. package/one/connections/vectors.md +0 -225
  385. package/one/connections/wordpress.md +0 -1320
  386. package/one/connections/workflow-copy.md +0 -923
  387. package/one/connections/workflow-examples.md +0 -759
  388. package/one/connections/workflow-onboarding.md +0 -701
  389. package/one/connections/workflow.md +0 -923
  390. package/one/connections/workflows/delegation.md +0 -903
  391. package/one/connections/workflows/frontend.md +0 -1055
  392. package/one/connections/workflows/strategy.md +0 -921
  393. package/one/connections/workflows/tasks.md +0 -716
  394. package/one/connections/x402-baazar.md +0 -131
  395. package/one/connections/x402.md +0 -1353
  396. package/one/groups/features.md +0 -2904
  397. package/one/groups/groups.md +0 -587
  398. package/one/groups/one.md +0 -619
  399. package/one/groups/strategy-copy.md +0 -887
  400. package/one/knowledge/.obsidian/app.json +0 -1
  401. package/one/knowledge/.obsidian/appearance.json +0 -1
  402. package/one/knowledge/.obsidian/core-plugins.json +0 -33
  403. package/one/knowledge/.obsidian/ecommerce-ontology.md +0 -210
  404. package/one/knowledge/.obsidian/workspace.json +0 -211
  405. package/one/knowledge/100-inference-quick-reference.md +0 -449
  406. package/one/knowledge/ag-ui-protocol.md +0 -613
  407. package/one/knowledge/agent-onboard-usage.md +0 -630
  408. package/one/knowledge/agentic-commerce.md +0 -146
  409. package/one/knowledge/ai-agents-vs-memecoins-thesis.md +0 -683
  410. package/one/knowledge/ai-api-reference.md +0 -715
  411. package/one/knowledge/ai-platform.md +0 -323
  412. package/one/knowledge/ai-quickstart.md +0 -355
  413. package/one/knowledge/ai-sdk-implementation.md +0 -436
  414. package/one/knowledge/ai-token-crypto-analysis-framework.md +0 -1191
  415. package/one/knowledge/ai-token-paradigm-shift-2025.md +0 -732
  416. package/one/knowledge/altcoin-cycle-prediction-ontology.md +0 -884
  417. package/one/knowledge/altcoin-cycle-trading-strategy.md +0 -642
  418. package/one/knowledge/architecture-any-backend.md +0 -1589
  419. package/one/knowledge/architecture-diagram.md +0 -404
  420. package/one/knowledge/architecture-frontend.md +0 -1014
  421. package/one/knowledge/architecture.md +0 -1742
  422. package/one/knowledge/archived/ontology.old.md +0 -2840
  423. package/one/knowledge/astro-effect-complete-vision.md +0 -2148
  424. package/one/knowledge/astro-effect-simple-architecture.md +0 -750
  425. package/one/knowledge/audit-agent-onboard-alignment.md +0 -481
  426. package/one/knowledge/audit-agent-sales-alignment.md +0 -444
  427. package/one/knowledge/backend-api-reference.md +0 -728
  428. package/one/knowledge/cascading-context-specification.md +0 -1617
  429. package/one/knowledge/claude-code-integration.md +0 -1293
  430. package/one/knowledge/cli-claude-handoff.md +0 -736
  431. package/one/knowledge/context-engineering.md +0 -610
  432. package/one/knowledge/crypto-analysis-strategy.md +0 -1276
  433. package/one/knowledge/crypto-cycle-2024-2025-analysis.md +0 -44
  434. package/one/knowledge/crypto.md +0 -978
  435. package/one/knowledge/develop/design.md +0 -364
  436. package/one/knowledge/develop/index.md +0 -145
  437. package/one/knowledge/development-commands.md +0 -251
  438. package/one/knowledge/docs.md +0 -627
  439. package/one/knowledge/dsl.md +0 -1678
  440. package/one/knowledge/event-driven-documentation.md +0 -270
  441. package/one/knowledge/files.md +0 -2489
  442. package/one/knowledge/frontend.md +0 -1056
  443. package/one/knowledge/games-english.md +0 -691
  444. package/one/knowledge/games.md +0 -1082
  445. package/one/knowledge/generative-ui-patterns.md +0 -559
  446. package/one/knowledge/guidelines.md +0 -314
  447. package/one/knowledge/hono.md +0 -2127
  448. package/one/knowledge/implementation-examples.md +0 -2554
  449. package/one/knowledge/installation-folders.md +0 -366
  450. package/one/knowledge/institutional-cycle-paradigm-2025.md +0 -555
  451. package/one/knowledge/knowledge.md +0 -660
  452. package/one/knowledge/language.md +0 -998
  453. package/one/knowledge/lessons-learned.md +0 -378
  454. package/one/knowledge/lessons-website-building-focus.md +0 -382
  455. package/one/knowledge/merge-report.md +0 -254
  456. package/one/knowledge/metadata-system.md +0 -504
  457. package/one/knowledge/nine-padel-playbook.md +0 -229
  458. package/one/knowledge/one-protocol-ai-agents.md +0 -892
  459. package/one/knowledge/one-protocol-executive-report.md +0 -617
  460. package/one/knowledge/one-protocol-standard.md +0 -869
  461. package/one/knowledge/one-protocol-whitepaper.md +0 -756
  462. package/one/knowledge/ontology-blog.yaml +0 -47
  463. package/one/knowledge/ontology-cheatsheet.md +0 -617
  464. package/one/knowledge/ontology-community.yaml +0 -65
  465. package/one/knowledge/ontology-core-universal.md +0 -740
  466. package/one/knowledge/ontology-core.yaml +0 -63
  467. package/one/knowledge/ontology-courses.yaml +0 -76
  468. package/one/knowledge/ontology-creator.md +0 -402
  469. package/one/knowledge/ontology-crypto.md +0 -1603
  470. package/one/knowledge/ontology-developer-guide.md +0 -814
  471. package/one/knowledge/ontology-documentation.md +0 -377
  472. package/one/knowledge/ontology-ecommerce.md +0 -269
  473. package/one/knowledge/ontology-education-game.md +0 -1654
  474. package/one/knowledge/ontology-education.md +0 -938
  475. package/one/knowledge/ontology-engineering-specification.md +0 -1310
  476. package/one/knowledge/ontology-engineering.md +0 -1676
  477. package/one/knowledge/ontology-files.yaml +0 -525
  478. package/one/knowledge/ontology-frontend-master.md +0 -2898
  479. package/one/knowledge/ontology-frontend-specifications.md +0 -2196
  480. package/one/knowledge/ontology-frontend.md +0 -2475
  481. package/one/knowledge/ontology-index.md +0 -397
  482. package/one/knowledge/ontology-minimal.yaml +0 -301
  483. package/one/knowledge/ontology-portfolio.yaml +0 -45
  484. package/one/knowledge/ontology-quickstart.md +0 -602
  485. package/one/knowledge/ontology-release.md +0 -317
  486. package/one/knowledge/ontology-shop.yaml +0 -148
  487. package/one/knowledge/ontology-tokens.yaml +0 -51
  488. package/one/knowledge/ontology-tutorial.md +0 -455
  489. package/one/knowledge/ontology-v2.md +0 -4449
  490. package/one/knowledge/ontology-video-script.md +0 -939
  491. package/one/knowledge/ontology-visual-guide.md +0 -378
  492. package/one/knowledge/ontology.md +0 -3847
  493. package/one/knowledge/ontology.yaml +0 -1653
  494. package/one/knowledge/parallel-agents.md +0 -932
  495. package/one/knowledge/patterns/backend/convex-mutation-pattern.md +0 -130
  496. package/one/knowledge/patterns/backend/convex-query-pattern.md +0 -143
  497. package/one/knowledge/patterns/backend/mutation-template.md +0 -249
  498. package/one/knowledge/patterns/backend/query-template.md +0 -286
  499. package/one/knowledge/patterns/backend/service-template.md +0 -258
  500. package/one/knowledge/patterns/design/component-architecture.md +0 -435
  501. package/one/knowledge/patterns/design/index.md +0 -160
  502. package/one/knowledge/patterns/design/test-driven-design-pattern.md +0 -196
  503. package/one/knowledge/patterns/design/wireframe-template.md +0 -250
  504. package/one/knowledge/patterns/frontend/component-template.md +0 -246
  505. package/one/knowledge/patterns/frontend/form-template.md +0 -348
  506. package/one/knowledge/patterns/frontend/page-template.md +0 -209
  507. package/one/knowledge/patterns/frontend/react-component-pattern.md +0 -188
  508. package/one/knowledge/patterns/test/acceptance-criteria-template.md +0 -396
  509. package/one/knowledge/patterns/test/technical-test-template.md +0 -566
  510. package/one/knowledge/patterns/test/test-driven-pattern.md +0 -160
  511. package/one/knowledge/patterns/test/user-flow-template.md +0 -272
  512. package/one/knowledge/performance.md +0 -459
  513. package/one/knowledge/provider-agnostic-content.md +0 -995
  514. package/one/knowledge/provider-creation-guide.md +0 -1082
  515. package/one/knowledge/quality-loop.md +0 -419
  516. package/one/knowledge/quick-start-ontology-mapping.md +0 -773
  517. package/one/knowledge/readme-architecture.md +0 -158
  518. package/one/knowledge/readme.md +0 -149
  519. package/one/knowledge/rules.md +0 -644
  520. package/one/knowledge/score.md +0 -85
  521. package/one/knowledge/specifications.md +0 -873
  522. package/one/knowledge/tags.md +0 -148
  523. package/one/knowledge/todo-template.md +0 -269
  524. package/one/knowledge/todo.md +0 -269
  525. package/one/knowledge/troubleshooting.md +0 -434
  526. package/one/knowledge/typescript-patterns.md +0 -321
  527. package/one/knowledge/universal-generation-language.md +0 -827
  528. package/one/knowledge/x402-research.md +0 -104
  529. package/one/license.md +0 -107
  530. package/one/people/anthony-o-connell.md +0 -469
  531. package/one/people/people.md +0 -590
  532. package/one/things/ALIGNMENT_AUDIT_QUALITY_AGENT.md +0 -401
  533. package/one/things/AUDIT_AGENT_INTEGRATOR_ALIGNMENT.md +0 -588
  534. package/one/things/AUDIT_REPORT_AGENT_CLEAN.md +0 -461
  535. package/one/things/CHECKLIST.md +0 -407
  536. package/one/things/IMPLEMENTATION_STATUS.md +0 -379
  537. package/one/things/ONE.md +0 -529
  538. package/one/things/agents/agent-backend.md +0 -1501
  539. package/one/things/agents/agent-builder.md +0 -1064
  540. package/one/things/agents/agent-clean.md +0 -1112
  541. package/one/things/agents/agent-clone.md +0 -1324
  542. package/one/things/agents/agent-deploy.md +0 -986
  543. package/one/things/agents/agent-designer.md +0 -2305
  544. package/one/things/agents/agent-director.md +0 -1526
  545. package/one/things/agents/agent-documenter.md +0 -1129
  546. package/one/things/agents/agent-frontend.md +0 -1201
  547. package/one/things/agents/agent-integrator.md +0 -1269
  548. package/one/things/agents/agent-lawyer.md +0 -1371
  549. package/one/things/agents/agent-problem-solver.md +0 -1457
  550. package/one/things/agents/agent-quality.md +0 -1483
  551. package/one/things/agents/agent-sales.md +0 -1074
  552. package/one/things/cascade/cascade.yaml +0 -481
  553. package/one/things/cascade/docs/examples/1-1-agent-prompts/design.md +0 -523
  554. package/one/things/cascade/docs/examples/1-1-agent-prompts/tests.md +0 -314
  555. package/one/things/cascade/docs/examples/1-1-agent-prompts.md +0 -562
  556. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/design.md +0 -543
  557. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/tests.md +0 -272
  558. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator.md +0 -548
  559. package/one/things/cascade/docs/examples/1-3-event-coordination/design.md +0 -586
  560. package/one/things/cascade/docs/examples/1-3-event-coordination/tests.md +0 -267
  561. package/one/things/cascade/docs/examples/1-3-event-coordination.md +0 -547
  562. package/one/things/cascade/docs/examples/1-4-knowledge-management/design.md +0 -665
  563. package/one/things/cascade/docs/examples/1-4-knowledge-management/tests.md +0 -236
  564. package/one/things/cascade/docs/examples/1-4-knowledge-management.md +0 -652
  565. package/one/things/cascade/docs/examples/1-5-quality-loops/design.md +0 -860
  566. package/one/things/cascade/docs/examples/1-5-quality-loops/tests.md +0 -255
  567. package/one/things/cascade/docs/examples/1-5-quality-loops.md +0 -725
  568. package/one/things/cascade/docs/examples/1-6-numbering-structure/design.md +0 -659
  569. package/one/things/cascade/docs/examples/1-6-numbering-structure/tests.md +0 -256
  570. package/one/things/cascade/docs/examples/1-6-numbering-structure.md +0 -639
  571. package/one/things/cascade/docs/examples/readme.md +0 -259
  572. package/one/things/cascade/docs/getting-started.md +0 -533
  573. package/one/things/cascade/docs/workflow.md +0 -1378
  574. package/one/things/cascade/readme.md +0 -379
  575. package/one/things/cascade/templates/feature-template.md +0 -289
  576. package/one/things/claude/agents/advocacy-activation-manager.md +0 -710
  577. package/one/things/claude/agents/advocacy-campaign-designer.md +0 -688
  578. package/one/things/claude/agents/analyst.md +0 -508
  579. package/one/things/claude/agents/architect.md +0 -505
  580. package/one/things/claude/agents/brand-identity-specialist.md +0 -538
  581. package/one/things/claude/agents/bstp-token-strategist.md +0 -690
  582. package/one/things/claude/agents/builder-repo.md +0 -532
  583. package/one/things/claude/agents/bullstamp-community-builder.md +0 -597
  584. package/one/things/claude/agents/bullstamp-marketing-orchestrator.md +0 -529
  585. package/one/things/claude/agents/bulltilt-platform-growth.md +0 -590
  586. package/one/things/claude/agents/company-bullstamp-character.md +0 -602
  587. package/one/things/claude/agents/company-bullstamp-community.md +0 -307
  588. package/one/things/claude/agents/company-bullstamp-marketing.md +0 -307
  589. package/one/things/claude/agents/company-bullstamp-token.md +0 -307
  590. package/one/things/claude/agents/company-bulltilt-growth.md +0 -307
  591. package/one/things/claude/agents/content-bibliography-formatter.md +0 -404
  592. package/one/things/claude/agents/content-calendar-planner.md +0 -473
  593. package/one/things/claude/agents/content-chapter-formatter.md +0 -513
  594. package/one/things/claude/agents/content-formatter.md +0 -571
  595. package/one/things/claude/agents/content-hook-specialist.md +0 -485
  596. package/one/things/claude/agents/content-image-formatter.md +0 -560
  597. package/one/things/claude/agents/content-introduction-formatter.md +0 -510
  598. package/one/things/claude/agents/content-multiplication-engine.md +0 -579
  599. package/one/things/claude/agents/content-playbook-writer.md +0 -473
  600. package/one/things/claude/agents/content-team-manager.md +0 -647
  601. package/one/things/claude/agents/content-toc-formatter.md +0 -547
  602. package/one/things/claude/agents/convex-backend-specialist.md +0 -2725
  603. package/one/things/claude/agents/core-manager.md +0 -607
  604. package/one/things/claude/agents/core-master.md +0 -426
  605. package/one/things/claude/agents/cross-functional-manager.md +0 -476
  606. package/one/things/claude/agents/crypto-airdrop-strategist.md +0 -622
  607. package/one/things/claude/agents/crypto-analytics-educator.md +0 -596
  608. package/one/things/claude/agents/crypto-architecture-specialist.md +0 -497
  609. package/one/things/claude/agents/crypto-community-analyst.md +0 -314
  610. package/one/things/claude/agents/crypto-community-psychologist.md +0 -546
  611. package/one/things/claude/agents/crypto-dex-optimization-expert.md +0 -579
  612. package/one/things/claude/agents/crypto-dex-optimizer.md +0 -307
  613. package/one/things/claude/agents/crypto-diamond-formation-specialist.md +0 -552
  614. package/one/things/claude/agents/crypto-diamond-hands.md +0 -307
  615. package/one/things/claude/agents/crypto-ecosystem-expansion-manager.md +0 -597
  616. package/one/things/claude/agents/crypto-engagement-specialist.md +0 -581
  617. package/one/things/claude/agents/crypto-market-researcher.md +0 -307
  618. package/one/things/claude/agents/crypto-marketing-orchestrator.md +0 -563
  619. package/one/things/claude/agents/crypto-network-effect-amplifier.md +0 -614
  620. package/one/things/claude/agents/crypto-optimization-analyst.md +0 -597
  621. package/one/things/claude/agents/crypto-strategic-synthesizer.md +0 -556
  622. package/one/things/claude/agents/crypto-team-manager.md +0 -392
  623. package/one/things/claude/agents/crypto-token-analyst.md +0 -319
  624. package/one/things/claude/agents/crypto-viral-content-creator.md +0 -549
  625. package/one/things/claude/agents/crypto-wallet-identification-expert.md +0 -527
  626. package/one/things/claude/agents/crypto-wallet-identifier.md +0 -307
  627. package/one/things/claude/agents/customer-journey-designer.md +0 -474
  628. package/one/things/claude/agents/customer-success-manager.md +0 -574
  629. package/one/things/claude/agents/dev.md +0 -406
  630. package/one/things/claude/agents/documenter.md +0 -548
  631. package/one/things/claude/agents/elevate-marketing-orchestrator.md +0 -403
  632. package/one/things/claude/agents/engagement-specialist.md +0 -502
  633. package/one/things/claude/agents/engineering-architect.md +0 -387
  634. package/one/things/claude/agents/engineering-business-analyst.md +0 -527
  635. package/one/things/claude/agents/engineering-developer.md +0 -386
  636. package/one/things/claude/agents/engineering-director.md +0 -322
  637. package/one/things/claude/agents/engineering-ingestor.md +0 -659
  638. package/one/things/claude/agents/engineering-product-manager.md +0 -525
  639. package/one/things/claude/agents/engineering-product-owner.md +0 -527
  640. package/one/things/claude/agents/engineering-project-coordinator.md +0 -525
  641. package/one/things/claude/agents/engineering-quality-assurance.md +0 -392
  642. package/one/things/claude/agents/engineering-team-manager.md +0 -515
  643. package/one/things/claude/agents/engineering-user-experience.md +0 -386
  644. package/one/things/claude/agents/framework-elevate-manager.md +0 -309
  645. package/one/things/claude/agents/improver.md +0 -805
  646. package/one/things/claude/agents/intelligence-team-manager.md +0 -390
  647. package/one/things/claude/agents/lead-capture-expert.md +0 -459
  648. package/one/things/claude/agents/lead-magnet-creator.md +0 -446
  649. package/one/things/claude/agents/market-research-analyst.md +0 -435
  650. package/one/things/claude/agents/marketing-brand-identity.md +0 -344
  651. package/one/things/claude/agents/marketing-content-hooks.md +0 -455
  652. package/one/things/claude/agents/marketing-content-multiplier.md +0 -331
  653. package/one/things/claude/agents/marketing-content-poster.md +0 -372
  654. package/one/things/claude/agents/marketing-customer-journey.md +0 -331
  655. package/one/things/claude/agents/marketing-director.md +0 -402
  656. package/one/things/claude/agents/marketing-engagement.md +0 -331
  657. package/one/things/claude/agents/marketing-lead-capture.md +0 -331
  658. package/one/things/claude/agents/marketing-lead-magnet.md +0 -331
  659. package/one/things/claude/agents/marketing-network-effects.md +0 -331
  660. package/one/things/claude/agents/marketing-nurture-campaigns.md +0 -331
  661. package/one/things/claude/agents/marketing-share-optimizer.md +0 -331
  662. package/one/things/claude/agents/marketing-team-manager.md +0 -451
  663. package/one/things/claude/agents/marketing-viral-growth.md +0 -232
  664. package/one/things/claude/agents/mission-commander.md +0 -378
  665. package/one/things/claude/agents/network-effect-analyst.md +0 -604
  666. package/one/things/claude/agents/nextjs-15-specialist.md +0 -1634
  667. package/one/things/claude/agents/npx.md +0 -946
  668. package/one/things/claude/agents/nurture-campaign-manager.md +0 -554
  669. package/one/things/claude/agents/one-master.md +0 -378
  670. package/one/things/claude/agents/one-orchestrator.md +0 -345
  671. package/one/things/claude/agents/one.md +0 -658
  672. package/one/things/claude/agents/playbook-generator.md +0 -526
  673. package/one/things/claude/agents/pm.md +0 -349
  674. package/one/things/claude/agents/po.md +0 -370
  675. package/one/things/claude/agents/qa.md +0 -361
  676. package/one/things/claude/agents/research-foundation-analyst.md +0 -324
  677. package/one/things/claude/agents/research-intelligence-gatherer.md +0 -435
  678. package/one/things/claude/agents/research-market-analyst.md +0 -324
  679. package/one/things/claude/agents/research-team-manager.md +0 -489
  680. package/one/things/claude/agents/sales-environment-optimizer.md +0 -519
  681. package/one/things/claude/agents/sales-team-manager.md +0 -407
  682. package/one/things/claude/agents/sales-upsell-strategist.md +0 -324
  683. package/one/things/claude/agents/service-advocacy-campaigns.md +0 -324
  684. package/one/things/claude/agents/service-advocacy-manager.md +0 -324
  685. package/one/things/claude/agents/service-success-manager.md +0 -324
  686. package/one/things/claude/agents/service-team-manager.md +0 -405
  687. package/one/things/claude/agents/shadcn-ui-design-system-specialist.md +0 -2357
  688. package/one/things/claude/agents/share-optimization-specialist.md +0 -576
  689. package/one/things/claude/agents/sm.md +0 -352
  690. package/one/things/claude/agents/story-teller.md +0 -498
  691. package/one/things/claude/agents/task-master.md +0 -621
  692. package/one/things/claude/agents/tauri-cross-platform-specialist.md +0 -1912
  693. package/one/things/claude/agents/tester.md +0 -595
  694. package/one/things/claude/agents/the-bull-character-manager.md +0 -603
  695. package/one/things/claude/agents/tools-playbook-generator.md +0 -492
  696. package/one/things/claude/agents/turbo-repo-builder.md +0 -346
  697. package/one/things/claude/agents/upsell-strategist.md +0 -503
  698. package/one/things/claude/agents/ux-expert.md +0 -360
  699. package/one/things/claude/agents/viral-growth-orchestrator.md +0 -520
  700. package/one/things/claude/claude-code-hooks-development.json +0 -21
  701. package/one/things/claude/claude-code-hooks-production.json +0 -21
  702. package/one/things/claude/claude-code-hooks.json +0 -25
  703. package/one/things/claude/commands/agent.md +0 -124
  704. package/one/things/claude/commands/cascade-status.md +0 -153
  705. package/one/things/claude/commands/ingest.md +0 -343
  706. package/one/things/claude/commands/ingestor.md +0 -158
  707. package/one/things/claude/commands/mission.md +0 -103
  708. package/one/things/claude/commands/npx.md +0 -156
  709. package/one/things/claude/commands/one.md +0 -486
  710. package/one/things/claude/commands/quality-check.md +0 -252
  711. package/one/things/claude/commands/smart-route.md +0 -261
  712. package/one/things/claude/commands/start.md +0 -139
  713. package/one/things/claude/commands/story.md +0 -103
  714. package/one/things/claude/commands/task.md +0 -193
  715. package/one/things/claude/hook-bypass.json +0 -32
  716. package/one/things/claude/hooks/agent-hook-config.json +0 -427
  717. package/one/things/claude/hooks/build-hook.sh +0 -156
  718. package/one/things/claude/hooks/cleanup-hook.sh +0 -201
  719. package/one/things/claude/hooks/file-organization-hook.sh +0 -80
  720. package/one/things/claude/hooks/format-hook.sh +0 -43
  721. package/one/things/claude/hooks/hook-bypass.sh +0 -293
  722. package/one/things/claude/hooks/hook-debouncer.sh +0 -62
  723. package/one/things/claude/hooks/hook-logger.sh +0 -89
  724. package/one/things/claude/hooks/lint-hook.sh +0 -140
  725. package/one/things/claude/hooks/notification-hook.sh +0 -204
  726. package/one/things/claude/hooks/ontology-validation-hook.sh +0 -86
  727. package/one/things/claude/hooks/performance-metrics.json +0 -25
  728. package/one/things/claude/hooks/security-hook.sh +0 -256
  729. package/one/things/claude/hooks/story-validation-hook-enhanced.sh +0 -210
  730. package/one/things/claude/hooks/story-validation-hook.sh +0 -145
  731. package/one/things/claude/hooks/test-hook.sh +0 -145
  732. package/one/things/claude/hooks/test-story-validation.sh +0 -170
  733. package/one/things/claude/settings-local.json +0 -86
  734. package/one/things/cli/cli-code.md +0 -677
  735. package/one/things/cli/cli-compiler-code.md +0 -677
  736. package/one/things/cli/cli.md +0 -871
  737. package/one/things/components/card-shadcn.md +0 -953
  738. package/one/things/components/card.md +0 -1041
  739. package/one/things/components.md +0 -1743
  740. package/one/things/componets.md +0 -19
  741. package/one/things/contracts/Move.toml +0 -12
  742. package/one/things/contracts/README.md +0 -288
  743. package/one/things/contracts/one.move +0 -762
  744. package/one/things/contracts/sdk.ts +0 -578
  745. package/one/things/creator-diagram.md +0 -184
  746. package/one/things/crypto/FEATURES.md +0 -78
  747. package/one/things/crypto/ONECORE.md +0 -62
  748. package/one/things/crypto/ONECOREFAQ.md +0 -22
  749. package/one/things/crypto/ONECOREHOW.md +0 -46
  750. package/one/things/crypto/ONEENTERPRISE.md +0 -64
  751. package/one/things/crypto/ONEENTERPRISEFAQ.md +0 -64
  752. package/one/things/crypto/ONEENTERPRISEHOW.md +0 -53
  753. package/one/things/crypto/ONEPRO.md +0 -60
  754. package/one/things/crypto/ONEPROFAQ.md +0 -22
  755. package/one/things/crypto/ONEPROHOW.md +0 -53
  756. package/one/things/crypto/READMEAGENCY.md +0 -64
  757. package/one/things/crypto/VSL.md +0 -45
  758. package/one/things/crypto/WebsiteCopy.md +0 -176
  759. package/one/things/demo-accessibility-animations.md +0 -1025
  760. package/one/things/demo-components.md +0 -1310
  761. package/one/things/demo-design-summary.md +0 -692
  762. package/one/things/demo-design-system.md +0 -973
  763. package/one/things/demo-page-layouts.md +0 -1016
  764. package/one/things/design-system.md +0 -832
  765. package/one/things/designs/accessibility-audit.md +0 -877
  766. package/one/things/designs/component-specifications.md +0 -855
  767. package/one/things/designs/design-overview.md +0 -377
  768. package/one/things/designs/design-tokens.md +0 -448
  769. package/one/things/designs/wireframes-dashboard.md +0 -710
  770. package/one/things/docs/api-requests.md +0 -987
  771. package/one/things/docs/ecommerce/ARCHITECTURE-DIAGRAM.md +0 -485
  772. package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-IMPLEMENTATION.md +0 -465
  773. package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-SUMMARY.md +0 -425
  774. package/one/things/docs/ecommerce/CONVERSION-UX-IMPLEMENTATION-SUMMARY.md +0 -451
  775. package/one/things/docs/ecommerce/FEATURE-SUMMARY.md +0 -536
  776. package/one/things/docs/ecommerce/IMPLEMENTATION-NOTES.md +0 -650
  777. package/one/things/docs/ecommerce/INTEGRATION-EXAMPLE.md +0 -473
  778. package/one/things/docs/ecommerce/QUICK-START.md +0 -405
  779. package/one/things/docs/ecommerce/URGENCY-IMPLEMENTATION-SUMMARY.md +0 -567
  780. package/one/things/docs/ecommerce/URGENCY-QUICK-REFERENCE.md +0 -271
  781. package/one/things/docs/ecommerce/USAGE-EXAMPLE.astro +0 -171
  782. package/one/things/docs/ecommerce/demo.astro +0 -309
  783. package/one/things/examples/children/lemonade-stand.md +0 -404
  784. package/one/things/examples/enterprise/crm-saas.md +0 -1444
  785. package/one/things/features/1-1-agent-prompts.md +0 -562
  786. package/one/things/features/1-2-yaml-orchestrator.md +0 -548
  787. package/one/things/features/1-3-event-coordination.md +0 -547
  788. package/one/things/features/1-4-knowledge-management.md +0 -652
  789. package/one/things/features/1-5-quality-loops.md +0 -725
  790. package/one/things/features/1-6-numbering-structure.md +0 -639
  791. package/one/things/features/2-1-dataprovider-interface.md +0 -2583
  792. package/one/things/features/2-2-config-system.md +0 -3242
  793. package/one/things/features/2-3-effectts-services.md +0 -1645
  794. package/one/things/features/2-4-react-hooks.md +0 -2136
  795. package/one/things/features/2-5-auth-migration.md +0 -2144
  796. package/one/things/features/2-6-dashboard-migration.md +0 -2084
  797. package/one/things/features/2-7-alternative-providers.md +0 -2578
  798. package/one/things/features/2-7-implementation-report.md +0 -724
  799. package/one/things/features/2-cli.md +0 -1720
  800. package/one/things/features/2-design.md +0 -1770
  801. package/one/things/features/2-tests.md +0 -576
  802. package/one/things/features/AUTH_HOOKS_IMPLEMENTATION.md +0 -576
  803. package/one/things/features/DECOUPLING.md +0 -290
  804. package/one/things/features/DEPLOYMENT.md +0 -470
  805. package/one/things/features/IMPLEMENTATION_SUMMARY.md +0 -362
  806. package/one/things/features/improve.md +0 -861
  807. package/one/things/features/remove-convex-deps.md +0 -63
  808. package/one/things/features/top-features.md +0 -87
  809. package/one/things/features/use-one-backend.md +0 -1217
  810. package/one/things/features-in-english.md +0 -200
  811. package/one/things/files.yaml +0 -721
  812. package/one/things/ideas/1-create-workflow.md +0 -207
  813. package/one/things/ideas/2-backend-agnostic-frontend.md +0 -439
  814. package/one/things/implementation/backend-guide.md +0 -457
  815. package/one/things/interface.md +0 -257
  816. package/one/things/landing-page-implementation.md +0 -455
  817. package/one/things/legal/README.md +0 -234
  818. package/one/things/legal/privacy-policy.md +0 -1227
  819. package/one/things/legal/terms-of-service.md +0 -1432
  820. package/one/things/master-workflow-plan.md +0 -806
  821. package/one/things/pay.one.ie.md +0 -53
  822. package/one/things/plans/0-in-sync.md +0 -136
  823. package/one/things/plans/0-timeline.md +0 -36
  824. package/one/things/plans/1-create-workflow.md +0 -732
  825. package/one/things/plans/QUICK-START-SIMPLIFICATION.md +0 -333
  826. package/one/things/plans/README-SIMPLIFICATION.md +0 -349
  827. package/one/things/plans/SIMPLIFICATION-EXAMPLES.md +0 -16
  828. package/one/things/plans/SIMPLIFICATION-SUMMARY.md +0 -455
  829. package/one/things/plans/ai-elements-integration.md +0 -483
  830. package/one/things/plans/ai-elements.md +0 -1278
  831. package/one/things/plans/ai-integration-plan.md +0 -263
  832. package/one/things/plans/ai-integration.md +0 -996
  833. package/one/things/plans/ai-sdk.md +0 -798
  834. package/one/things/plans/ai-tools.md +0 -621
  835. package/one/things/plans/app.md +0 -832
  836. package/one/things/plans/architecture-summary.md +0 -312
  837. package/one/things/plans/async-ai-agents.md +0 -233
  838. package/one/things/plans/backend-agnostic-frontend.md +0 -390
  839. package/one/things/plans/backend-cleanup-quickstart.md +0 -380
  840. package/one/things/plans/backend-ontology-conformance.md +0 -475
  841. package/one/things/plans/backend-status.md +0 -599
  842. package/one/things/plans/backend-structure.md +0 -847
  843. package/one/things/plans/backend-target-structure.md +0 -482
  844. package/one/things/plans/backend.md +0 -1175
  845. package/one/things/plans/better-auth-any-backend-revised.md +0 -1103
  846. package/one/things/plans/better-auth-any-backend.md +0 -1896
  847. package/one/things/plans/better-auth-available-features.md +0 -273
  848. package/one/things/plans/big-plan.md +0 -52
  849. package/one/things/plans/cli-updates-required.md +0 -320
  850. package/one/things/plans/complete-step-by-step.md +0 -1409
  851. package/one/things/plans/components.md +0 -709
  852. package/one/things/plans/convex-agents.md +0 -1034
  853. package/one/things/plans/convex-better-auth.md +0 -1141
  854. package/one/things/plans/convex-on-off.md +0 -407
  855. package/one/things/plans/crypto-token-researcher.md +0 -629
  856. package/one/things/plans/data-quality-metrics.md +0 -745
  857. package/one/things/plans/deep-researcher-agent.md +0 -466
  858. package/one/things/plans/deploy-to-cloudflare.md +0 -623
  859. package/one/things/plans/deployment-architecture.md +0 -469
  860. package/one/things/plans/desktop.md +0 -1139
  861. package/one/things/plans/development-plan.md +0 -1283
  862. package/one/things/plans/development-workflow-tldr.md +0 -207
  863. package/one/things/plans/development-workflow.md +0 -959
  864. package/one/things/plans/dsl-claude-code.md +0 -1011
  865. package/one/things/plans/effect-components.md +0 -1743
  866. package/one/things/plans/effect-patterns-reference.md +0 -2235
  867. package/one/things/plans/effect.md +0 -1806
  868. package/one/things/plans/email.md +0 -966
  869. package/one/things/plans/enhance-auth.md +0 -1692
  870. package/one/things/plans/execution-strategy.md +0 -1291
  871. package/one/things/plans/existing-infrastructure.md +0 -712
  872. package/one/things/plans/feature-based-sites.md +0 -894
  873. package/one/things/plans/frontend-effects.md +0 -1276
  874. package/one/things/plans/group-folder-multi-tenancy.md +0 -893
  875. package/one/things/plans/improve-codebase.md +0 -1811
  876. package/one/things/plans/install-components.md +0 -215
  877. package/one/things/plans/integrate-frontend-and-backend.md +0 -603
  878. package/one/things/plans/landing.md +0 -820
  879. package/one/things/plans/layout.md +0 -249
  880. package/one/things/plans/mail-backend.md +0 -1361
  881. package/one/things/plans/mail.md +0 -2677
  882. package/one/things/plans/mcp-clear-context-prompt.md +0 -81
  883. package/one/things/plans/mcp-simple.md +0 -248
  884. package/one/things/plans/multi-ontology-architecture.md +0 -885
  885. package/one/things/plans/next-features.md +0 -114
  886. package/one/things/plans/npx-agent-safety.md +0 -785
  887. package/one/things/plans/npx-agent.md +0 -1089
  888. package/one/things/plans/onboarding.md +0 -51
  889. package/one/things/plans/one-protocol-and-payone-usage.md +0 -82
  890. package/one/things/plans/one.md +0 -677
  891. package/one/things/plans/ontology-6-dimensions.md +0 -2201
  892. package/one/things/plans/ontology-compliance-audit.md +0 -342
  893. package/one/things/plans/ontology-driven-strategy.md +0 -882
  894. package/one/things/plans/ontology-refine.md +0 -586
  895. package/one/things/plans/ontology-ui-approach.md +0 -375
  896. package/one/things/plans/open-agent.md +0 -840
  897. package/one/things/plans/performace.md +0 -122
  898. package/one/things/plans/phase-1-foundation.md +0 -620
  899. package/one/things/plans/phase-3-implementation.md +0 -1037
  900. package/one/things/plans/plan-connect-to-api.md +0 -146
  901. package/one/things/plans/quick-wins.md +0 -1428
  902. package/one/things/plans/r2.md +0 -777
  903. package/one/things/plans/readme-backend-cleanup.md +0 -402
  904. package/one/things/plans/release.md +0 -507
  905. package/one/things/plans/remove-backend-development-from-agents.md +0 -1331
  906. package/one/things/plans/repos.md +0 -98
  907. package/one/things/plans/separate-copy-2.md +0 -1349
  908. package/one/things/plans/separate-copy-3.md +0 -2479
  909. package/one/things/plans/separate-copy.md +0 -1349
  910. package/one/things/plans/separate-demo.md +0 -864
  911. package/one/things/plans/separate.md +0 -1999
  912. package/one/things/plans/sequence.md +0 -2040
  913. package/one/things/plans/shadcn-integration-summary.md +0 -510
  914. package/one/things/plans/sidebar.md +0 -206
  915. package/one/things/plans/skills.md +0 -709
  916. package/one/things/plans/small-fixes.md +0 -23
  917. package/one/things/plans/start-new.md +0 -764
  918. package/one/things/plans/switch-off-auth.md +0 -42
  919. package/one/things/plans/sync-checklist.md +0 -351
  920. package/one/things/plans/test-backend-connection.md +0 -514
  921. package/one/things/plans/unified-implementation-plan.md +0 -934
  922. package/one/things/plans/update-demos.md +0 -581
  923. package/one/things/plans/use-our-backend.md +0 -572
  924. package/one/things/plans/video-backend.md +0 -638
  925. package/one/things/plans/video-frontend.md +0 -490
  926. package/one/things/plans/video-old-archived.md +0 -656
  927. package/one/things/plans/wave1-onboarding-100-inferences.md +0 -1686
  928. package/one/things/plans/wave1-onboarding-vision.md +0 -744
  929. package/one/things/plans/wave1-orchestration-summary.md +0 -604
  930. package/one/things/plans/wave1-specialist-assignments.md +0 -1413
  931. package/one/things/plans/workflow-files.md +0 -1210
  932. package/one/things/plans/workflow.md +0 -1378
  933. package/one/things/plans-u.md +0 -905
  934. package/one/things/products/Blockchain Products.md +0 -6278
  935. package/one/things/products/cascade-landing-page.md +0 -841
  936. package/one/things/products/cascade.md +0 -1568
  937. package/one/things/products/context-engineering.md +0 -1488
  938. package/one/things/products/onthology.md +0 -15
  939. package/one/things/products/ontology-ui-shadcn.md +0 -1302
  940. package/one/things/products/ontology-ui.md +0 -1429
  941. package/one/things/products/ontology.md +0 -789
  942. package/one/things/products/sdk.md +0 -573
  943. package/one/things/promptkit.md +0 -930
  944. package/one/things/repos/all-repos.md +0 -0
  945. package/one/things/scripts-clean-mac.sh +0 -409
  946. package/one/things/service-providers-new.md +0 -1052
  947. package/one/things/service-providers.md +0 -1121
  948. package/one/things/structure.md +0 -532
  949. package/one/things/system.md +0 -618
  950. package/one/things/templates.md +0 -294
  951. package/one/things/tests/2-1-dataprovider-interface.md +0 -1216
  952. package/one/things/tests/2-1-test-analysis.md +0 -544
  953. package/one/things/things.md +0 -384
  954. package/one/things/todo-acp-integration.md +0 -744
  955. package/one/things/todo-ai.md +0 -933
  956. package/one/things/todo-api.md +0 -1078
  957. package/one/things/todo-assignment.md +0 -580
  958. package/one/things/todo-buy-chatgpt.md +0 -1450
  959. package/one/things/todo-components.md +0 -1683
  960. package/one/things/todo-connections.md +0 -278
  961. package/one/things/todo-ecommerce-frontend.md +0 -1313
  962. package/one/things/todo-ecommerce.md +0 -569
  963. package/one/things/todo-effects.md +0 -1075
  964. package/one/things/todo-frontend-effects.md +0 -977
  965. package/one/things/todo-landing-page.md +0 -1091
  966. package/one/things/todo-mail.md +0 -1160
  967. package/one/things/todo-master-plan.md +0 -490
  968. package/one/things/todo-onboard.md +0 -666
  969. package/one/things/todo-one-ie.md +0 -538
  970. package/one/things/todo-page.md +0 -606
  971. package/one/things/todo-plans.md +0 -282
  972. package/one/things/todo-projects.md +0 -241
  973. package/one/things/todo-refactoring-plan.md +0 -366
  974. package/one/things/todo-release.md +0 -654
  975. package/one/things/todo-sequence.md +0 -1621
  976. package/one/things/todo-use-our-backend.md +0 -1908
  977. package/one/things/todo-workflow.md +0 -626
  978. package/one/things/todo-x402.md +0 -2047
  979. package/one/things/todo.md +0 -21
  980. package/one/things/video/scripts-crypto.md +0 -835
  981. package/one/things/video-script-backup.md +0 -318
  982. package/one/things/video-script-demo.md +0 -382
  983. package/one/things/video-script-ontology.md +0 -333
  984. package/one/things/video-script.md +0 -361
@@ -1,2144 +0,0 @@
1
- ---
2
- title: 2 5 Auth Migration
3
- dimension: things
4
- category: features
5
- tags: auth, backend, frontend
6
- related_dimensions: connections, events, people
7
- scope: global
8
- created: 2025-11-03
9
- updated: 2025-11-03
10
- version: 1.0.0
11
- ai_context: |
12
- This document is part of the things dimension in the features category.
13
- Location: one/things/features/2-5-auth-migration.md
14
- Purpose: Documents feature 2-5: auth component migration to dataprovider
15
- Related dimensions: connections, events, people
16
- For AI agents: Read this to understand 2 5 auth migration.
17
- ---
18
-
19
- # Feature 2-5: Auth Component Migration to DataProvider
20
-
21
- **Feature ID:** `feature_2_5_auth_migration`
22
- **Plan:** `plan_2_backend_agnostic_frontend`
23
- **Owner:** Frontend Specialist
24
- **Status:** ✅ **COMPLETE SPECIFICATION** - Ready for Implementation
25
- **Priority:** **P0 (CRITICAL)** - All 50+ auth tests MUST pass
26
- **Effort:** 1 week (5-8 days)
27
- **Risk Level:** **HIGHEST** - Authentication is critical infrastructure
28
- **Dependencies:** Feature 2-1 (DataProvider), Feature 2-4 (React Hooks)
29
-
30
- ---
31
-
32
- ## Executive Summary
33
-
34
- This feature migrates **6 critical authentication components** from direct Better Auth + Convex integration to backend-agnostic DataProvider hooks. This is the **HIGHEST RISK** feature in Plan 2 because:
35
-
36
- 1. Authentication affects 100% of users
37
- 2. 50+ existing tests MUST continue passing
38
- 3. Security cannot be compromised
39
- 4. Session management must work identically
40
- 5. Zero downtime deployment required
41
-
42
- **Success Criteria:** All 50+ auth tests pass with ZERO functionality regression.
43
-
44
- **Migration Strategy:** Incremental component-by-component with test validation after EACH component (<5 tests fail = immediate rollback).
45
-
46
- ---
47
-
48
- ## 1. Components to Migrate (6 Total)
49
-
50
- ### Component Matrix
51
-
52
- | # | Component | Current API | New Hook | Lines | Risk | Test File |
53
- | --- | ---------------------- | ----------------------------------------------- | ---------------------------- | ----- | ---------- | ------------------------ |
54
- | 1 | **SimpleSignInForm** | `authClient.signIn.email()` | `useLogin()` | 163 | **HIGH** | `email-password.test.ts` |
55
- | 2 | **SimpleSignUpForm** | `authClient.signUp.email()` | `useSignup()` | 157 | **HIGH** | `email-password.test.ts` |
56
- | 3 | **MagicLinkAuth** | `convex.mutation(api.auth.signInWithMagicLink)` | `useMagicLinkAuth()` | 151 | **MEDIUM** | `magic-link.test.ts` |
57
- | 4 | **TwoFactorSettings** | Multiple `convex.mutation(api.auth.*)` | `use2FA()` | 293 | **HIGH** | `auth.test.ts` |
58
- | 5 | **VerifyEmailForm** | `convex.mutation(api.auth.verifyEmail)` | `useVerifyEmail()` | 134 | **LOW** | `auth.test.ts` |
59
- | 6 | **ForgotPasswordForm** | `fetch("/api/auth/forgot-password")` | `usePasswordReset()` | 144 | **MEDIUM** | `password-reset.test.ts` |
60
- | 7 | **ResetPasswordForm** | `fetch("/api/auth/reset-password")` | `usePasswordResetComplete()` | 206 | **MEDIUM** | `password-reset.test.ts` |
61
-
62
- **Total:** 1,248 lines of code to migrate
63
- **Estimated Effort:** 8-12 hours of careful migration + testing
64
-
65
- ---
66
-
67
- ## 2. Complete BEFORE/AFTER Code
68
-
69
- ### 2.1 SimpleSignInForm Migration
70
-
71
- **BEFORE (Current - 163 lines):**
72
-
73
- ```typescript
74
- // frontend/src/components/auth/SimpleSignInForm.tsx (BEFORE)
75
- import { useState } from "react"
76
- import { Button } from "@/components/ui/button"
77
- import { Input } from "@/components/ui/input"
78
- import { Label } from "@/components/ui/label"
79
- import { authClient } from "@/lib/auth-client" // ❌ REMOVE
80
- import { toast } from "sonner"
81
- import { AuthCard } from "./AuthCard"
82
- import { SocialLoginButtons } from "./SocialLoginButtons"
83
-
84
- export function SimpleSignInForm() {
85
- const [email, setEmail] = useState("")
86
- const [password, setPassword] = useState("")
87
- const [loading, setLoading] = useState(false) // ❌ Manual state management
88
-
89
- const handleSubmit = async (e: React.FormEvent) => {
90
- e.preventDefault()
91
- setLoading(true) // ❌ Manual loading state
92
-
93
- try {
94
- // ❌ Direct authClient call
95
- const result = await authClient.signIn.email({
96
- email,
97
- password,
98
- })
99
-
100
- if (result.error) {
101
- const errorMessage = result.error.message || "Unable to sign in"
102
- let title = "Unable to sign in"
103
- let description = `Error: ${errorMessage}. Please check your credentials and try again.`
104
-
105
- // ❌ String-based error handling (brittle)
106
- if (errorMessage.toLowerCase().includes("not found") || errorMessage.toLowerCase().includes("no user")) {
107
- title = "Account not found"
108
- description = "No account exists with this email. Please sign up first."
109
- } else if (errorMessage.toLowerCase().includes("password") || errorMessage.toLowerCase().includes("incorrect")) {
110
- title = "Incorrect password"
111
- description = "The password you entered is incorrect."
112
- }
113
- // ... more string-based error checks
114
-
115
- toast.error(title, { description })
116
- setLoading(false) // ❌ Manual state reset
117
- return
118
- }
119
-
120
- toast.success("Welcome back!", {
121
- description: "Successfully signed in. Redirecting to your dashboard..."
122
- })
123
-
124
- setTimeout(() => {
125
- window.location.href = "/account"
126
- }, 1000)
127
- } catch (err: any) {
128
- // ❌ Generic error handling
129
- toast.error("Sign in error", {
130
- description: `Error: ${err.message}. Please try again later.`
131
- })
132
- setLoading(false) // ❌ Manual state reset
133
- }
134
- }
135
-
136
- return (
137
- <AuthCard title="Welcome Back" description="Sign in to your account">
138
- <form onSubmit={handleSubmit} className="space-y-4">
139
- <div className="space-y-2">
140
- <Label htmlFor="email">Email</Label>
141
- <Input
142
- id="email"
143
- type="email"
144
- placeholder="your@email.com"
145
- value={email}
146
- onChange={(e) => setEmail(e.target.value)}
147
- required
148
- />
149
- </div>
150
-
151
- <div className="space-y-2">
152
- <div className="flex items-center justify-between">
153
- <Label htmlFor="password">Password</Label>
154
- <a href="/account/forgot-password" className="text-xs text-primary hover:underline">
155
- Forgot password?
156
- </a>
157
- </div>
158
- <Input
159
- id="password"
160
- type="password"
161
- placeholder="••••••••"
162
- value={password}
163
- onChange={(e) => setPassword(e.target.value)}
164
- required
165
- />
166
- </div>
167
-
168
- <Button type="submit" className="w-full" disabled={loading}>
169
- {loading ? "Signing in..." : "Sign In"}
170
- </Button>
171
-
172
- <div className="relative my-4">
173
- <div className="absolute inset-0 flex items-center">
174
- <span className="w-full border-t" />
175
- </div>
176
- <div className="relative flex justify-center text-xs uppercase">
177
- <span className="bg-background px-2 text-muted-foreground">Or</span>
178
- </div>
179
- </div>
180
-
181
- <Button variant="outline" className="w-full" asChild>
182
- <a href="/account/magic-link">Sign in with magic link</a>
183
- </Button>
184
- </form>
185
- </AuthCard>
186
- )
187
- }
188
- ```
189
-
190
- **AFTER (Migrated - 120 lines, cleaner):**
191
-
192
- ```typescript
193
- // frontend/src/components/auth/SimpleSignInForm.tsx (AFTER)
194
- import { useState } from "react"
195
- import { Button } from "@/components/ui/button"
196
- import { Input } from "@/components/ui/input"
197
- import { Label } from "@/components/ui/label"
198
- import { useLogin } from "@/providers/hooks" // ✅ DataProvider hook
199
- import { toast } from "sonner"
200
- import { AuthCard } from "./AuthCard"
201
- import { SocialLoginButtons } from "./SocialLoginButtons"
202
-
203
- export function SimpleSignInForm() {
204
- const [email, setEmail] = useState("")
205
- const [password, setPassword] = useState("")
206
- const { mutate: login, loading, error } = useLogin() // ✅ Hook manages state
207
-
208
- const handleSubmit = async (e: React.FormEvent) => {
209
- e.preventDefault()
210
-
211
- try {
212
- const result = await login({ email, password }) // ✅ Simple hook call
213
-
214
- if (result.success) {
215
- toast.success("Welcome back!", {
216
- description: "Successfully signed in. Redirecting to your dashboard..."
217
- })
218
-
219
- setTimeout(() => {
220
- window.location.href = "/account"
221
- }, 1000)
222
- }
223
- } catch (err: any) {
224
- // ✅ Typed error handling
225
- let title = "Unable to sign in"
226
- let description = err.message || "Please check your credentials and try again."
227
-
228
- // ✅ Type-safe error checking
229
- if (err._tag === "UserNotFound") {
230
- title = "Account not found"
231
- description = "No account exists with this email. Please sign up first."
232
- } else if (err._tag === "InvalidCredentials") {
233
- title = "Incorrect password"
234
- description = "The password you entered is incorrect. Try again or use 'Forgot password'."
235
- } else if (err._tag === "NetworkError") {
236
- title = "Network error"
237
- description = "Unable to connect to the server. Check your internet connection."
238
- } else if (err._tag === "EmailNotVerified") {
239
- title = "Email not verified"
240
- description = "Please verify your email address before signing in."
241
- } else if (err._tag === "TwoFactorRequired") {
242
- title = "2FA required"
243
- description = "Please enter your two-factor authentication code."
244
- // Redirect to 2FA page
245
- window.location.href = `/account/signin/2fa?email=${encodeURIComponent(email)}`
246
- return
247
- }
248
-
249
- toast.error(title, { description })
250
- }
251
- }
252
-
253
- return (
254
- <AuthCard title="Welcome Back" description="Sign in to your account">
255
- <SocialLoginButtons mode="signin" />
256
-
257
- <form onSubmit={handleSubmit} className="space-y-4">
258
- <div className="space-y-2">
259
- <Label htmlFor="email">Email</Label>
260
- <Input
261
- id="email"
262
- type="email"
263
- placeholder="your@email.com"
264
- value={email}
265
- onChange={(e) => setEmail(e.target.value)}
266
- required
267
- />
268
- </div>
269
-
270
- <div className="space-y-2">
271
- <div className="flex items-center justify-between">
272
- <Label htmlFor="password">Password</Label>
273
- <a href="/account/forgot-password" className="text-xs text-primary hover:underline">
274
- Forgot password?
275
- </a>
276
- </div>
277
- <Input
278
- id="password"
279
- type="password"
280
- placeholder="••••••••"
281
- value={password}
282
- onChange={(e) => setPassword(e.target.value)}
283
- required
284
- />
285
- </div>
286
-
287
- <Button type="submit" className="w-full" disabled={loading}>
288
- {loading ? "Signing in..." : "Sign In"}
289
- </Button>
290
-
291
- <div className="relative my-4">
292
- <div className="absolute inset-0 flex items-center">
293
- <span className="w-full border-t" />
294
- </div>
295
- <div className="relative flex justify-center text-xs uppercase">
296
- <span className="bg-background px-2 text-muted-foreground">Or</span>
297
- </div>
298
- </div>
299
-
300
- <Button variant="outline" className="w-full" asChild>
301
- <a href="/account/magic-link">Sign in with magic link</a>
302
- </Button>
303
- </form>
304
- </AuthCard>
305
- )
306
- }
307
- ```
308
-
309
- **Key Changes:**
310
-
311
- - ❌ Removed `authClient` import
312
- - ✅ Added `useLogin()` hook import
313
- - ❌ Removed manual `loading` state
314
- - ✅ Hook manages `loading`, `error` state
315
- - ❌ Removed string-based error detection
316
- - ✅ Type-safe `_tag` error checking
317
- - 🔥 **43 fewer lines** (163 → 120)
318
- - 🎯 **Better error handling** with typed errors
319
- - ⚡ **Cleaner code** with hook pattern
320
-
321
- ---
322
-
323
- ### 2.2 SimpleSignUpForm Migration
324
-
325
- **BEFORE (Current - 157 lines):**
326
-
327
- ```typescript
328
- // frontend/src/components/auth/SimpleSignUpForm.tsx (BEFORE)
329
- import { useState } from "react"
330
- import { Button } from "@/components/ui/button"
331
- import { Input } from "@/components/ui/input"
332
- import { Label } from "@/components/ui/label"
333
- import { authClient } from "@/lib/auth-client" // ❌ REMOVE
334
- import { toast } from "sonner"
335
- import { AuthCard } from "./AuthCard"
336
- import { SocialLoginButtons } from "./SocialLoginButtons"
337
- import { PasswordStrengthIndicator } from "./PasswordStrengthIndicator"
338
-
339
- export function SimpleSignUpForm() {
340
- const [email, setEmail] = useState("")
341
- const [password, setPassword] = useState("")
342
- const [name, setName] = useState("")
343
- const [loading, setLoading] = useState(false) // ❌ Manual state
344
-
345
- const handleSubmit = async (e: React.FormEvent) => {
346
- e.preventDefault()
347
- setLoading(true) // ❌ Manual loading
348
-
349
- try {
350
- // ❌ Direct authClient call
351
- const result = await authClient.signUp.email({
352
- email,
353
- password,
354
- name,
355
- })
356
-
357
- if (result.error) {
358
- const errorMessage = result.error.message || "Unable to create account"
359
- let title = "Unable to create account"
360
- let description = `Error: ${errorMessage}. Please verify your information and try again.`
361
-
362
- // ❌ String-based error detection
363
- if (errorMessage.toLowerCase().includes("already exists")) {
364
- title = "Email already registered"
365
- description = "This email is already in use. Please sign in instead."
366
- } else if (errorMessage.toLowerCase().includes("password")) {
367
- title = "Invalid password"
368
- description = "Password must be at least 8 characters long."
369
- }
370
-
371
- toast.error(title, { description })
372
- setLoading(false) // ❌ Manual state reset
373
- return
374
- }
375
-
376
- toast.success("Account created successfully!", {
377
- description: `Welcome ${name}! Redirecting to your dashboard...`
378
- })
379
-
380
- setTimeout(() => {
381
- window.location.href = "/account"
382
- }, 1000)
383
- } catch (err: any) {
384
- toast.error("Sign up error", {
385
- description: `Error: ${err.message}. Please try again later.`
386
- })
387
- setLoading(false) // ❌ Manual state reset
388
- }
389
- }
390
-
391
- return (
392
- <AuthCard title="Create Account" description="Sign up to get started">
393
- <SocialLoginButtons mode="signup" />
394
-
395
- <form onSubmit={handleSubmit} className="space-y-4">
396
- <div className="space-y-2">
397
- <Label htmlFor="name">Name</Label>
398
- <Input
399
- id="name"
400
- type="text"
401
- placeholder="Your name"
402
- value={name}
403
- onChange={(e) => setName(e.target.value)}
404
- />
405
- </div>
406
-
407
- <div className="space-y-2">
408
- <Label htmlFor="email">Email</Label>
409
- <Input
410
- id="email"
411
- type="email"
412
- placeholder="your@email.com"
413
- value={email}
414
- onChange={(e) => setEmail(e.target.value)}
415
- required
416
- />
417
- </div>
418
-
419
- <div className="space-y-2">
420
- <Label htmlFor="password">Password</Label>
421
- <Input
422
- id="password"
423
- type="password"
424
- placeholder="••••••••"
425
- value={password}
426
- onChange={(e) => setPassword(e.target.value)}
427
- required
428
- minLength={8}
429
- />
430
- <PasswordStrengthIndicator password={password} />
431
- </div>
432
-
433
- <Button type="submit" className="w-full" disabled={loading}>
434
- {loading ? "Signing up..." : "Sign Up"}
435
- </Button>
436
- </form>
437
- </AuthCard>
438
- )
439
- }
440
- ```
441
-
442
- **AFTER (Migrated - 115 lines):**
443
-
444
- ```typescript
445
- // frontend/src/components/auth/SimpleSignUpForm.tsx (AFTER)
446
- import { useState } from "react"
447
- import { Button } from "@/components/ui/button"
448
- import { Input } from "@/components/ui/input"
449
- import { Label } from "@/components/ui/label"
450
- import { useSignup } from "@/providers/hooks" // ✅ DataProvider hook
451
- import { toast } from "sonner"
452
- import { AuthCard } from "./AuthCard"
453
- import { SocialLoginButtons } from "./SocialLoginButtons"
454
- import { PasswordStrengthIndicator } from "./PasswordStrengthIndicator"
455
-
456
- export function SimpleSignUpForm() {
457
- const [email, setEmail] = useState("")
458
- const [password, setPassword] = useState("")
459
- const [name, setName] = useState("")
460
- const { mutate: signup, loading, error } = useSignup() // ✅ Hook manages state
461
-
462
- const handleSubmit = async (e: React.FormEvent) => {
463
- e.preventDefault()
464
-
465
- try {
466
- const result = await signup({ email, password, name }) // ✅ Simple call
467
-
468
- if (result.success) {
469
- toast.success("Account created successfully!", {
470
- description: `Welcome ${name}! Redirecting to your dashboard...`
471
- })
472
-
473
- setTimeout(() => {
474
- window.location.href = "/account"
475
- }, 1000)
476
- }
477
- } catch (err: any) {
478
- let title = "Unable to create account"
479
- let description = err.message || "Please verify your information and try again."
480
-
481
- // ✅ Typed error handling
482
- if (err._tag === "EmailAlreadyExists") {
483
- title = "Email already registered"
484
- description = "This email is already in use. Please sign in or use a different email."
485
- } else if (err._tag === "WeakPassword") {
486
- title = "Password too weak"
487
- description = "Password must be at least 8 characters with letters and numbers."
488
- } else if (err._tag === "NetworkError") {
489
- title = "Network error"
490
- description = "Unable to connect to the server. Check your internet connection."
491
- }
492
-
493
- toast.error(title, { description })
494
- }
495
- }
496
-
497
- return (
498
- <AuthCard title="Create Account" description="Sign up to get started">
499
- <SocialLoginButtons mode="signup" />
500
-
501
- <form onSubmit={handleSubmit} className="space-y-4">
502
- <div className="space-y-2">
503
- <Label htmlFor="name">Name</Label>
504
- <Input
505
- id="name"
506
- type="text"
507
- placeholder="Your name"
508
- value={name}
509
- onChange={(e) => setName(e.target.value)}
510
- />
511
- </div>
512
-
513
- <div className="space-y-2">
514
- <Label htmlFor="email">Email</Label>
515
- <Input
516
- id="email"
517
- type="email"
518
- placeholder="your@email.com"
519
- value={email}
520
- onChange={(e) => setEmail(e.target.value)}
521
- required
522
- />
523
- </div>
524
-
525
- <div className="space-y-2">
526
- <Label htmlFor="password">Password</Label>
527
- <Input
528
- id="password"
529
- type="password"
530
- placeholder="••••••••"
531
- value={password}
532
- onChange={(e) => setPassword(e.target.value)}
533
- required
534
- minLength={8}
535
- />
536
- <PasswordStrengthIndicator password={password} />
537
- </div>
538
-
539
- <Button type="submit" className="w-full" disabled={loading}>
540
- {loading ? "Signing up..." : "Sign Up"}
541
- </Button>
542
- </form>
543
- </AuthCard>
544
- )
545
- }
546
- ```
547
-
548
- **Key Changes:**
549
-
550
- - 🔥 **42 fewer lines** (157 → 115)
551
- - ✅ Cleaner error handling with typed errors
552
- - ✅ Password strength indicator preserved
553
- - ✅ Same UX, better code
554
-
555
- ---
556
-
557
- ### 2.3 MagicLinkAuth Migration
558
-
559
- **BEFORE (Current - 151 lines):**
560
-
561
- ```typescript
562
- // frontend/src/components/auth/MagicLinkAuth.tsx (BEFORE)
563
- import { useState, useEffect } from "react";
564
- import { Button } from "@/components/ui/button";
565
- import { toast } from "sonner";
566
- import { AuthCard } from "./AuthCard";
567
- import { CheckCircle2, Mail } from "lucide-react";
568
- import { Alert, AlertDescription } from "@/components/ui/alert";
569
- import { ConvexHttpClient } from "convex/browser"; // ❌ REMOVE
570
- import { api } from "../../../convex/_generated/api"; // ❌ REMOVE
571
-
572
- const convex = new ConvexHttpClient( // ❌ REMOVE
573
- import.meta.env.PUBLIC_CONVEX_URL || import.meta.env.NEXT_PUBLIC_CONVEX_URL,
574
- );
575
-
576
- interface MagicLinkAuthProps {
577
- token: string;
578
- }
579
-
580
- export function MagicLinkAuth({ token }: MagicLinkAuthProps) {
581
- const [loading, setLoading] = useState(false); // ❌ Manual state
582
- const [authSuccess, setAuthSuccess] = useState(false);
583
- const [tokenValid, setTokenValid] = useState(true);
584
- const [authenticating, setAuthenticating] = useState(true);
585
-
586
- useEffect(() => {
587
- const authenticateWithMagicLink = async () => {
588
- if (!token) {
589
- setTokenValid(false);
590
- setAuthenticating(false);
591
- toast.error("No magic link token", {
592
- description: "This link is missing a token.",
593
- });
594
- return;
595
- }
596
-
597
- setLoading(true);
598
- try {
599
- // ❌ Direct Convex mutation call
600
- const result = await convex.mutation(api.auth.signInWithMagicLink, {
601
- token,
602
- });
603
-
604
- if (result?.token) {
605
- // ❌ Manual cookie setting via API
606
- const response = await fetch("/api/auth/set-cookie", {
607
- method: "POST",
608
- headers: { "Content-Type": "application/json" },
609
- body: JSON.stringify({ token: result.token }),
610
- });
611
-
612
- if (response.ok) {
613
- setAuthSuccess(true);
614
- toast.success("Signed in successfully!", {
615
- description: "Redirecting to your dashboard...",
616
- });
617
-
618
- setTimeout(() => {
619
- window.location.href = "/account";
620
- }, 1500);
621
- } else {
622
- throw new Error("Failed to set authentication cookie");
623
- }
624
- }
625
- } catch (err: any) {
626
- setTokenValid(false);
627
- toast.error("Authentication failed", {
628
- description: err.message || "Invalid or expired link",
629
- });
630
- } finally {
631
- setLoading(false);
632
- setAuthenticating(false);
633
- }
634
- };
635
-
636
- authenticateWithMagicLink();
637
- }, [token]);
638
-
639
- // ... render logic (unchanged)
640
- }
641
- ```
642
-
643
- **AFTER (Migrated - 105 lines):**
644
-
645
- ```typescript
646
- // frontend/src/components/auth/MagicLinkAuth.tsx (AFTER)
647
- import { useState, useEffect } from "react"
648
- import { Button } from "@/components/ui/button"
649
- import { toast } from "sonner"
650
- import { AuthCard } from "./AuthCard"
651
- import { CheckCircle2, Mail } from "lucide-react"
652
- import { Alert, AlertDescription } from "@/components/ui/alert"
653
- import { useMagicLinkAuth } from "@/providers/hooks" // ✅ DataProvider hook
654
-
655
- interface MagicLinkAuthProps {
656
- token: string
657
- }
658
-
659
- export function MagicLinkAuth({ token }: MagicLinkAuthProps) {
660
- const { mutate: authenticate, loading, error } = useMagicLinkAuth() // ✅ Hook
661
- const [authSuccess, setAuthSuccess] = useState(false)
662
- const [tokenValid, setTokenValid] = useState(true)
663
-
664
- useEffect(() => {
665
- const authenticateWithToken = async () => {
666
- if (!token) {
667
- setTokenValid(false)
668
- toast.error("No magic link token", {
669
- description: "This link is missing a token."
670
- })
671
- return
672
- }
673
-
674
- try {
675
- const result = await authenticate({ token }) // ✅ Simple hook call
676
-
677
- if (result.success) {
678
- setAuthSuccess(true)
679
- toast.success("Signed in successfully!", {
680
- description: "Redirecting to your dashboard..."
681
- })
682
-
683
- setTimeout(() => {
684
- window.location.href = "/account"
685
- }, 1500)
686
- }
687
- } catch (err: any) {
688
- setTokenValid(false)
689
-
690
- let title = "Authentication failed"
691
- let description = err.message
692
-
693
- // ✅ Typed error handling
694
- if (err._tag === "InvalidToken" || err._tag === "TokenExpired") {
695
- title = "Invalid or expired link"
696
- description = "This magic link has expired or is invalid. Magic links expire after 15 minutes."
697
- }
698
-
699
- toast.error(title, { description })
700
- }
701
- }
702
-
703
- authenticateWithToken()
704
- }, [token])
705
-
706
- if (loading) {
707
- return (
708
- <AuthCard
709
- title="Signing you in"
710
- description="Please wait while we authenticate your magic link"
711
- >
712
- <div className="flex justify-center py-8">
713
- <div className="animate-spin rounded-full h-8 w-8 border-b-2 border-primary"></div>
714
- </div>
715
- </AuthCard>
716
- )
717
- }
718
-
719
- if (!tokenValid) {
720
- return (
721
- <AuthCard
722
- title="Authentication failed"
723
- description="This magic link is no longer valid"
724
- >
725
- <Alert variant="destructive">
726
- <Mail className="h-4 w-4" />
727
- <AlertDescription>
728
- This magic link has expired or is invalid. Magic links expire after 15 minutes.
729
- </AlertDescription>
730
- </Alert>
731
-
732
- <Button variant="outline" className="w-full" asChild>
733
- <a href="/account/magic-link">Request new magic link</a>
734
- </Button>
735
- </AuthCard>
736
- )
737
- }
738
-
739
- if (authSuccess) {
740
- return (
741
- <AuthCard
742
- title="Signed in successfully!"
743
- description="Redirecting to your dashboard"
744
- >
745
- <Alert className="border-green-500/50 bg-green-500/10">
746
- <CheckCircle2 className="h-4 w-4 text-green-500" />
747
- <AlertDescription>
748
- You've been successfully signed in with your magic link.
749
- </AlertDescription>
750
- </Alert>
751
-
752
- <Button className="w-full" asChild>
753
- <a href="/account">Go to dashboard</a>
754
- </Button>
755
- </AuthCard>
756
- )
757
- }
758
-
759
- return null
760
- }
761
- ```
762
-
763
- **Key Changes:**
764
-
765
- - ❌ Removed ConvexHttpClient import
766
- - ❌ Removed api import
767
- - ✅ Added `useMagicLinkAuth()` hook
768
- - 🔥 **46 fewer lines** (151 → 105)
769
- - ✅ Automatic cookie management (hook handles it)
770
- - ✅ Cleaner error handling
771
-
772
- ---
773
-
774
- ### 2.4 TwoFactorSettings Migration
775
-
776
- **BEFORE (Current - 293 lines):**
777
-
778
- ```typescript
779
- // frontend/src/components/auth/TwoFactorSettings.tsx (BEFORE)
780
- import { useState, useEffect } from "react";
781
- import { Button } from "@/components/ui/button";
782
- import { Input } from "@/components/ui/input";
783
- import { Label } from "@/components/ui/label";
784
- import { toast } from "sonner";
785
- import {
786
- Card,
787
- CardContent,
788
- CardDescription,
789
- CardHeader,
790
- CardTitle,
791
- } from "@/components/ui/card";
792
- import { Alert, AlertDescription } from "@/components/ui/alert";
793
- import { Shield, Key, Copy, CheckCircle2 } from "lucide-react";
794
- import { ConvexHttpClient } from "convex/browser"; // ❌ REMOVE
795
- import { api } from "../../../convex/_generated/api"; // ❌ REMOVE
796
- import * as OTPAuth from "otpauth";
797
- import QRCode from "qrcode";
798
-
799
- const convex = new ConvexHttpClient( // ❌ REMOVE
800
- import.meta.env.PUBLIC_CONVEX_URL || import.meta.env.NEXT_PUBLIC_CONVEX_URL,
801
- );
802
-
803
- export function TwoFactorSettings() {
804
- const [loading, setLoading] = useState(false); // ❌ Manual state
805
- const [status, setStatus] = useState<{ enabled: boolean; hasSetup: boolean }>(
806
- { enabled: false, hasSetup: false },
807
- );
808
- const [showSetup, setShowSetup] = useState(false);
809
- const [secret, setSecret] = useState("");
810
- const [backupCodes, setBackupCodes] = useState<string[]>([]);
811
- const [qrCodeUrl, setQrCodeUrl] = useState("");
812
- const [verificationCode, setVerificationCode] = useState("");
813
- const [disablePassword, setDisablePassword] = useState("");
814
-
815
- useEffect(() => {
816
- loadStatus();
817
- }, []);
818
-
819
- const loadStatus = async () => {
820
- try {
821
- // ❌ Manual token extraction from cookies
822
- const token = document.cookie
823
- .split("; ")
824
- .find((row) => row.startsWith("auth_token="))
825
- ?.split("=")[1];
826
- if (!token) return;
827
-
828
- // ❌ Direct Convex query
829
- const result = await convex.query(api.auth.get2FAStatus, { token });
830
- setStatus(result);
831
- } catch (err) {
832
- console.error("Failed to load 2FA status:", err);
833
- }
834
- };
835
-
836
- const handleSetup = async () => {
837
- setLoading(true); // ❌ Manual state
838
- try {
839
- const token = document.cookie
840
- .split("; ")
841
- .find((row) => row.startsWith("auth_token="))
842
- ?.split("=")[1];
843
- if (!token) {
844
- toast.error("Not authenticated");
845
- return;
846
- }
847
-
848
- // ❌ Direct Convex mutation
849
- const result = await convex.mutation(api.auth.setup2FA, { token });
850
- setSecret(result.secret);
851
- setBackupCodes(result.backupCodes);
852
-
853
- // Generate TOTP URI
854
- const totp = new OTPAuth.TOTP({
855
- issuer: "ONE",
856
- label: "user@one.ie",
857
- algorithm: "SHA1",
858
- digits: 6,
859
- period: 30,
860
- secret: OTPAuth.Secret.fromBase32(
861
- result.secret.toUpperCase().padEnd(32, "A"),
862
- ),
863
- });
864
-
865
- const uri = totp.toString();
866
- const qrUrl = await QRCode.toDataURL(uri);
867
- setQrCodeUrl(qrUrl);
868
- setShowSetup(true);
869
-
870
- toast.success("2FA setup initiated", {
871
- description: "Scan the QR code with your authenticator app",
872
- });
873
- } catch (err: any) {
874
- toast.error("Setup failed", {
875
- description: err.message || "Failed to setup 2FA",
876
- });
877
- } finally {
878
- setLoading(false); // ❌ Manual state
879
- }
880
- };
881
-
882
- const handleVerify = async () => {
883
- setLoading(true);
884
- try {
885
- const token = document.cookie
886
- .split("; ")
887
- .find((row) => row.startsWith("auth_token="))
888
- ?.split("=")[1];
889
- if (!token) {
890
- toast.error("Not authenticated");
891
- return;
892
- }
893
-
894
- // Client-side TOTP verification
895
- const totp = new OTPAuth.TOTP({
896
- issuer: "ONE",
897
- label: "user@one.ie",
898
- algorithm: "SHA1",
899
- digits: 6,
900
- period: 30,
901
- secret: OTPAuth.Secret.fromBase32(secret.toUpperCase().padEnd(32, "A")),
902
- });
903
-
904
- const delta = totp.validate({ token: verificationCode, window: 1 });
905
- if (delta === null) {
906
- toast.error("Invalid code", {
907
- description: "The verification code is incorrect. Please try again.",
908
- });
909
- setLoading(false);
910
- return;
911
- }
912
-
913
- // ❌ Direct Convex mutation
914
- await convex.mutation(api.auth.verify2FA, { token });
915
-
916
- toast.success("2FA enabled!", {
917
- description:
918
- "Two-factor authentication has been enabled for your account",
919
- });
920
-
921
- setShowSetup(false);
922
- loadStatus();
923
- } catch (err: any) {
924
- toast.error("Verification failed", {
925
- description: err.message || "Failed to verify code",
926
- });
927
- } finally {
928
- setLoading(false);
929
- }
930
- };
931
-
932
- const handleDisable = async () => {
933
- setLoading(true);
934
- try {
935
- const token = document.cookie
936
- .split("; ")
937
- .find((row) => row.startsWith("auth_token="))
938
- ?.split("=")[1];
939
- if (!token) {
940
- toast.error("Not authenticated");
941
- return;
942
- }
943
-
944
- // ❌ Direct Convex mutation
945
- await convex.mutation(api.auth.disable2FA, {
946
- token,
947
- password: disablePassword,
948
- });
949
-
950
- toast.success("2FA disabled", {
951
- description: "Two-factor authentication has been disabled",
952
- });
953
-
954
- setDisablePassword("");
955
- loadStatus();
956
- } catch (err: any) {
957
- toast.error("Failed to disable 2FA", {
958
- description: err.message || "Incorrect password",
959
- });
960
- } finally {
961
- setLoading(false);
962
- }
963
- };
964
-
965
- const copyToClipboard = (text: string) => {
966
- navigator.clipboard.writeText(text);
967
- toast.success("Copied to clipboard");
968
- };
969
-
970
- // ... rest of component (render logic - 150+ lines unchanged)
971
- }
972
- ```
973
-
974
- **AFTER (Migrated - 210 lines):**
975
-
976
- ```typescript
977
- // frontend/src/components/auth/TwoFactorSettings.tsx (AFTER)
978
- import { useState, useEffect } from "react";
979
- import { Button } from "@/components/ui/button";
980
- import { Input } from "@/components/ui/input";
981
- import { Label } from "@/components/ui/label";
982
- import { toast } from "sonner";
983
- import {
984
- Card,
985
- CardContent,
986
- CardDescription,
987
- CardHeader,
988
- CardTitle,
989
- } from "@/components/ui/card";
990
- import { Alert, AlertDescription } from "@/components/ui/alert";
991
- import { Shield, Key, Copy, CheckCircle2 } from "lucide-react";
992
- import { use2FA } from "@/providers/hooks"; // ✅ DataProvider hook
993
- import * as OTPAuth from "otpauth";
994
- import QRCode from "qrcode";
995
-
996
- export function TwoFactorSettings() {
997
- const { getStatus, setup, verify, disable, loading, error } = use2FA(); // ✅ Hook
998
- const [status, setStatus] = useState<{ enabled: boolean; hasSetup: boolean }>(
999
- { enabled: false, hasSetup: false },
1000
- );
1001
- const [showSetup, setShowSetup] = useState(false);
1002
- const [secret, setSecret] = useState("");
1003
- const [backupCodes, setBackupCodes] = useState<string[]>([]);
1004
- const [qrCodeUrl, setQrCodeUrl] = useState("");
1005
- const [verificationCode, setVerificationCode] = useState("");
1006
- const [disablePassword, setDisablePassword] = useState("");
1007
-
1008
- useEffect(() => {
1009
- loadStatus();
1010
- }, []);
1011
-
1012
- const loadStatus = async () => {
1013
- try {
1014
- const result = await getStatus(); // ✅ Simple hook call (no token needed)
1015
- setStatus(result);
1016
- } catch (err) {
1017
- console.error("Failed to load 2FA status:", err);
1018
- }
1019
- };
1020
-
1021
- const handleSetup = async () => {
1022
- try {
1023
- const result = await setup(); // ✅ Simple hook call
1024
- setSecret(result.secret);
1025
- setBackupCodes(result.backupCodes);
1026
-
1027
- // Generate TOTP URI (unchanged)
1028
- const totp = new OTPAuth.TOTP({
1029
- issuer: "ONE",
1030
- label: "user@one.ie",
1031
- algorithm: "SHA1",
1032
- digits: 6,
1033
- period: 30,
1034
- secret: OTPAuth.Secret.fromBase32(
1035
- result.secret.toUpperCase().padEnd(32, "A"),
1036
- ),
1037
- });
1038
-
1039
- const uri = totp.toString();
1040
- const qrUrl = await QRCode.toDataURL(uri);
1041
- setQrCodeUrl(qrUrl);
1042
- setShowSetup(true);
1043
-
1044
- toast.success("2FA setup initiated", {
1045
- description: "Scan the QR code with your authenticator app",
1046
- });
1047
- } catch (err: any) {
1048
- toast.error("Setup failed", {
1049
- description: err.message || "Failed to setup 2FA",
1050
- });
1051
- }
1052
- };
1053
-
1054
- const handleVerify = async () => {
1055
- try {
1056
- // Client-side TOTP verification (unchanged)
1057
- const totp = new OTPAuth.TOTP({
1058
- issuer: "ONE",
1059
- label: "user@one.ie",
1060
- algorithm: "SHA1",
1061
- digits: 6,
1062
- period: 30,
1063
- secret: OTPAuth.Secret.fromBase32(secret.toUpperCase().padEnd(32, "A")),
1064
- });
1065
-
1066
- const delta = totp.validate({ token: verificationCode, window: 1 });
1067
- if (delta === null) {
1068
- toast.error("Invalid code", {
1069
- description: "The verification code is incorrect. Please try again.",
1070
- });
1071
- return;
1072
- }
1073
-
1074
- await verify(verificationCode); // ✅ Simple hook call
1075
-
1076
- toast.success("2FA enabled!", {
1077
- description:
1078
- "Two-factor authentication has been enabled for your account",
1079
- });
1080
-
1081
- setShowSetup(false);
1082
- loadStatus();
1083
- } catch (err: any) {
1084
- toast.error("Verification failed", {
1085
- description: err.message || "Failed to verify code",
1086
- });
1087
- }
1088
- };
1089
-
1090
- const handleDisable = async () => {
1091
- try {
1092
- await disable(disablePassword); // ✅ Simple hook call
1093
-
1094
- toast.success("2FA disabled", {
1095
- description: "Two-factor authentication has been disabled",
1096
- });
1097
-
1098
- setDisablePassword("");
1099
- loadStatus();
1100
- } catch (err: any) {
1101
- toast.error("Failed to disable 2FA", {
1102
- description: err.message || "Incorrect password",
1103
- });
1104
- }
1105
- };
1106
-
1107
- const copyToClipboard = (text: string) => {
1108
- navigator.clipboard.writeText(text);
1109
- toast.success("Copied to clipboard");
1110
- };
1111
-
1112
- // ... render logic (unchanged - 100+ lines)
1113
- }
1114
- ```
1115
-
1116
- **Key Changes:**
1117
-
1118
- - ❌ Removed ConvexHttpClient
1119
- - ❌ Removed manual token extraction
1120
- - ✅ Added `use2FA()` hook with all operations
1121
- - 🔥 **83 fewer lines** (293 → 210)
1122
- - ✅ Automatic authentication (hook handles tokens)
1123
- - ✅ Same functionality, cleaner code
1124
-
1125
- ---
1126
-
1127
- ### 2.5 VerifyEmailForm Migration
1128
-
1129
- **BEFORE (Current - 134 lines):**
1130
-
1131
- ```typescript
1132
- // frontend/src/components/auth/VerifyEmailForm.tsx (BEFORE)
1133
- import { useState, useEffect } from "react";
1134
- import { Button } from "@/components/ui/button";
1135
- import { toast } from "sonner";
1136
- import { AuthCard } from "./AuthCard";
1137
- import { CheckCircle2, Mail } from "lucide-react";
1138
- import { Alert, AlertDescription } from "@/components/ui/alert";
1139
- import { ConvexHttpClient } from "convex/browser"; // ❌ REMOVE
1140
- import { api } from "../../../convex/_generated/api"; // ❌ REMOVE
1141
-
1142
- const convex = new ConvexHttpClient( // ❌ REMOVE
1143
- import.meta.env.PUBLIC_CONVEX_URL || import.meta.env.NEXT_PUBLIC_CONVEX_URL,
1144
- );
1145
-
1146
- interface VerifyEmailFormProps {
1147
- token: string;
1148
- }
1149
-
1150
- export function VerifyEmailForm({ token }: VerifyEmailFormProps) {
1151
- const [loading, setLoading] = useState(false); // ❌ Manual state
1152
- const [verifySuccess, setVerifySuccess] = useState(false);
1153
- const [tokenValid, setTokenValid] = useState(true);
1154
- const [verifying, setVerifying] = useState(true);
1155
-
1156
- useEffect(() => {
1157
- const verifyToken = async () => {
1158
- if (!token) {
1159
- setTokenValid(false);
1160
- setVerifying(false);
1161
- toast.error("No verification token", {
1162
- description: "This verification link is missing a token.",
1163
- });
1164
- return;
1165
- }
1166
-
1167
- setLoading(true);
1168
- try {
1169
- // ❌ Direct Convex mutation
1170
- const result = await convex.mutation(api.auth.verifyEmail, { token });
1171
-
1172
- if (result?.success) {
1173
- setVerifySuccess(true);
1174
- toast.success("Email verified successfully!", {
1175
- description:
1176
- "Your email has been verified. You can now access all features.",
1177
- });
1178
- }
1179
- } catch (err: any) {
1180
- setTokenValid(false);
1181
- toast.error("Verification failed", {
1182
- description: err.message || "Invalid or expired link",
1183
- });
1184
- } finally {
1185
- setLoading(false);
1186
- setVerifying(false);
1187
- }
1188
- };
1189
-
1190
- verifyToken();
1191
- }, [token]);
1192
-
1193
- // ... render logic (unchanged)
1194
- }
1195
- ```
1196
-
1197
- **AFTER (Migrated - 95 lines):**
1198
-
1199
- ```typescript
1200
- // frontend/src/components/auth/VerifyEmailForm.tsx (AFTER)
1201
- import { useState, useEffect } from "react"
1202
- import { Button } from "@/components/ui/button"
1203
- import { toast } from "sonner"
1204
- import { AuthCard } from "./AuthCard"
1205
- import { CheckCircle2, Mail } from "lucide-react"
1206
- import { Alert, AlertDescription } from "@/components/ui/alert"
1207
- import { useVerifyEmail } from "@/providers/hooks" // ✅ DataProvider hook
1208
-
1209
- interface VerifyEmailFormProps {
1210
- token: string
1211
- }
1212
-
1213
- export function VerifyEmailForm({ token }: VerifyEmailFormProps) {
1214
- const { mutate: verify, loading, error } = useVerifyEmail() // ✅ Hook
1215
- const [verifySuccess, setVerifySuccess] = useState(false)
1216
- const [tokenValid, setTokenValid] = useState(true)
1217
-
1218
- useEffect(() => {
1219
- const verifyToken = async () => {
1220
- if (!token) {
1221
- setTokenValid(false)
1222
- toast.error("No verification token", {
1223
- description: "This verification link is missing a token."
1224
- })
1225
- return
1226
- }
1227
-
1228
- try {
1229
- const result = await verify({ token }) // ✅ Simple hook call
1230
-
1231
- if (result.success) {
1232
- setVerifySuccess(true)
1233
- toast.success("Email verified successfully!", {
1234
- description: "Your email has been verified. You can now access all features."
1235
- })
1236
- }
1237
- } catch (err: any) {
1238
- setTokenValid(false)
1239
-
1240
- let title = "Verification failed"
1241
- let description = err.message
1242
-
1243
- // ✅ Typed error handling
1244
- if (err._tag === "InvalidToken" || err._tag === "TokenExpired") {
1245
- title = "Invalid or expired link"
1246
- description = "This verification link has expired or is invalid."
1247
- }
1248
-
1249
- toast.error(title, { description })
1250
- }
1251
- }
1252
-
1253
- verifyToken()
1254
- }, [token])
1255
-
1256
- if (loading) {
1257
- return (
1258
- <AuthCard
1259
- title="Verifying your email"
1260
- description="Please wait while we verify your email address"
1261
- >
1262
- <div className="flex justify-center py-8">
1263
- <div className="animate-spin rounded-full h-8 w-8 border-b-2 border-primary"></div>
1264
- </div>
1265
- </AuthCard>
1266
- )
1267
- }
1268
-
1269
- if (!tokenValid) {
1270
- return (
1271
- <AuthCard
1272
- title="Verification failed"
1273
- description="This verification link is no longer valid"
1274
- >
1275
- <Alert variant="destructive">
1276
- <Mail className="h-4 w-4" />
1277
- <AlertDescription>
1278
- This verification link has expired or is invalid. If you need a new verification email, please contact support.
1279
- </AlertDescription>
1280
- </Alert>
1281
-
1282
- <Button variant="outline" className="w-full" asChild>
1283
- <a href="/account">Go to dashboard</a>
1284
- </Button>
1285
- </AuthCard>
1286
- )
1287
- }
1288
-
1289
- if (verifySuccess) {
1290
- return (
1291
- <AuthCard
1292
- title="Email verified!"
1293
- description="Your email has been successfully verified"
1294
- >
1295
- <Alert className="border-green-500/50 bg-green-500/10">
1296
- <CheckCircle2 className="h-4 w-4 text-green-500" />
1297
- <AlertDescription>
1298
- Your email has been successfully verified. You can now access all features.
1299
- </AlertDescription>
1300
- </Alert>
1301
-
1302
- <Button className="w-full" asChild>
1303
- <a href="/account">Go to dashboard</a>
1304
- </Button>
1305
- </AuthCard>
1306
- )
1307
- }
1308
-
1309
- return null
1310
- }
1311
- ```
1312
-
1313
- **Key Changes:**
1314
-
1315
- - 🔥 **39 fewer lines** (134 → 95)
1316
- - ✅ Simple hook-based verification
1317
- - ✅ Automatic verification on mount
1318
-
1319
- ---
1320
-
1321
- ### 2.6 ForgotPasswordForm Migration
1322
-
1323
- **BEFORE (Current - 144 lines):**
1324
-
1325
- ```typescript
1326
- // frontend/src/components/auth/ForgotPasswordForm.tsx (BEFORE)
1327
- import { useState } from "react";
1328
- import { Button } from "@/components/ui/button";
1329
- import { Input } from "@/components/ui/input";
1330
- import { Label } from "@/components/ui/label";
1331
- import { toast } from "sonner";
1332
- import { AuthCard } from "./AuthCard";
1333
- import { AlertCircle, CheckCircle2 } from "lucide-react";
1334
- import { Alert, AlertDescription } from "@/components/ui/alert";
1335
-
1336
- export function ForgotPasswordForm() {
1337
- const [email, setEmail] = useState("");
1338
- const [loading, setLoading] = useState(false); // ❌ Manual state
1339
- const [emailSent, setEmailSent] = useState(false);
1340
-
1341
- const handleSubmit = async (e: React.FormEvent) => {
1342
- e.preventDefault();
1343
- setLoading(true); // ❌ Manual loading
1344
-
1345
- try {
1346
- // ❌ Direct fetch call
1347
- const response = await fetch("/api/auth/forgot-password", {
1348
- method: "POST",
1349
- headers: { "Content-Type": "application/json" },
1350
- body: JSON.stringify({ email }),
1351
- });
1352
-
1353
- const data = await response.json();
1354
-
1355
- if (!response.ok) {
1356
- const errorMessage = data.error || "Unable to send reset email";
1357
- // ... string-based error handling
1358
- toast.error("Unable to send reset email", {
1359
- description: errorMessage,
1360
- });
1361
- setLoading(false); // ❌ Manual state
1362
- return;
1363
- }
1364
-
1365
- setEmailSent(true);
1366
- toast.success("Reset email sent!", {
1367
- description: "Check your inbox for password reset instructions.",
1368
- });
1369
- setLoading(false);
1370
- } catch (err: any) {
1371
- toast.error("Request failed", {
1372
- description: `Error: ${err.message}. Please try again later.`,
1373
- });
1374
- setLoading(false); // ❌ Manual state
1375
- }
1376
- };
1377
-
1378
- // ... render logic (unchanged)
1379
- }
1380
- ```
1381
-
1382
- **AFTER (Migrated - 105 lines):**
1383
-
1384
- ```typescript
1385
- // frontend/src/components/auth/ForgotPasswordForm.tsx (AFTER)
1386
- import { useState } from "react"
1387
- import { Button } from "@/components/ui/button"
1388
- import { Input } from "@/components/ui/input"
1389
- import { Label } from "@/components/ui/label"
1390
- import { toast } from "sonner"
1391
- import { AuthCard } from "./AuthCard"
1392
- import { AlertCircle, CheckCircle2 } from "lucide-react"
1393
- import { Alert, AlertDescription } from "@/components/ui/alert"
1394
- import { usePasswordReset } from "@/providers/hooks" // ✅ DataProvider hook
1395
-
1396
- export function ForgotPasswordForm() {
1397
- const [email, setEmail] = useState("")
1398
- const { mutate: requestReset, loading, error } = usePasswordReset() // ✅ Hook
1399
- const [emailSent, setEmailSent] = useState(false)
1400
-
1401
- const handleSubmit = async (e: React.FormEvent) => {
1402
- e.preventDefault()
1403
-
1404
- try {
1405
- await requestReset({ email }) // ✅ Simple hook call
1406
-
1407
- setEmailSent(true)
1408
- toast.success("Reset email sent!", {
1409
- description: "Check your inbox for password reset instructions."
1410
- })
1411
- } catch (err: any) {
1412
- let title = "Unable to send reset email"
1413
- let description = err.message || "Please try again."
1414
-
1415
- // ✅ Typed error handling
1416
- if (err._tag === "UserNotFound") {
1417
- title = "Email not found"
1418
- description = "No account exists with this email address."
1419
- } else if (err._tag === "RateLimitExceeded") {
1420
- title = "Too many requests"
1421
- description = "Please wait a few minutes and try again."
1422
- } else if (err._tag === "NetworkError") {
1423
- title = "Network error"
1424
- description = "Unable to connect to the server."
1425
- }
1426
-
1427
- toast.error(title, { description })
1428
- }
1429
- }
1430
-
1431
- if (emailSent) {
1432
- return (
1433
- <AuthCard
1434
- title="Check your email"
1435
- description="We've sent password reset instructions"
1436
- >
1437
- <Alert className="border-green-500/50 bg-green-500/10">
1438
- <CheckCircle2 className="h-4 w-4 text-green-500" />
1439
- <AlertDescription>
1440
- If an account exists with <strong>{email}</strong>, you will receive an email.
1441
- </AlertDescription>
1442
- </Alert>
1443
-
1444
- <Button
1445
- variant="outline"
1446
- className="w-full"
1447
- onClick={() => {
1448
- setEmailSent(false)
1449
- setEmail("")
1450
- }}
1451
- >
1452
- Try another email
1453
- </Button>
1454
- </AuthCard>
1455
- )
1456
- }
1457
-
1458
- return (
1459
- <AuthCard title="Forgot your password?" description="Enter your email to receive reset instructions">
1460
- <Alert>
1461
- <AlertCircle className="h-4 w-4" />
1462
- <AlertDescription>
1463
- We'll send you an email with instructions to reset your password.
1464
- </AlertDescription>
1465
- </Alert>
1466
-
1467
- <form onSubmit={handleSubmit} className="space-y-4">
1468
- <div className="space-y-2">
1469
- <Label htmlFor="email">Email</Label>
1470
- <Input
1471
- id="email"
1472
- type="email"
1473
- placeholder="your@email.com"
1474
- value={email}
1475
- onChange={(e) => setEmail(e.target.value)}
1476
- required
1477
- />
1478
- </div>
1479
-
1480
- <Button type="submit" className="w-full" disabled={loading}>
1481
- {loading ? "Sending..." : "Send reset email"}
1482
- </Button>
1483
- </form>
1484
- </AuthCard>
1485
- )
1486
- }
1487
- ```
1488
-
1489
- **Key Changes:**
1490
-
1491
- - 🔥 **39 fewer lines** (144 → 105)
1492
- - ❌ Removed fetch call
1493
- - ✅ Added hook-based request
1494
-
1495
- ---
1496
-
1497
- ### 2.7 ResetPasswordForm Migration
1498
-
1499
- **AFTER (Complete):**
1500
-
1501
- ```typescript
1502
- // frontend/src/components/auth/ResetPasswordForm.tsx (AFTER)
1503
- import { useState, useEffect } from "react";
1504
- import { Button } from "@/components/ui/button";
1505
- import { Input } from "@/components/ui/input";
1506
- import { Label } from "@/components/ui/label";
1507
- import { toast } from "sonner";
1508
- import { AuthCard } from "./AuthCard";
1509
- import { PasswordStrengthIndicator } from "./PasswordStrengthIndicator";
1510
- import { CheckCircle2 } from "lucide-react";
1511
- import { Alert, AlertDescription } from "@/components/ui/alert";
1512
- import { usePasswordResetComplete } from "@/providers/hooks"; // ✅ Hook
1513
-
1514
- interface ResetPasswordFormProps {
1515
- token: string;
1516
- }
1517
-
1518
- export function ResetPasswordForm({ token }: ResetPasswordFormProps) {
1519
- const [password, setPassword] = useState("");
1520
- const [confirmPassword, setConfirmPassword] = useState("");
1521
- const { mutate: resetPassword, loading, error } = usePasswordResetComplete(); // ✅ Hook
1522
- const [resetSuccess, setResetSuccess] = useState(false);
1523
- const [tokenValid, setTokenValid] = useState(true);
1524
-
1525
- useEffect(() => {
1526
- // Token validation can be done on mount if needed
1527
- if (!token) {
1528
- setTokenValid(false);
1529
- toast.error("Invalid or expired token", {
1530
- description: "This password reset link is invalid or has expired.",
1531
- });
1532
- }
1533
- }, [token]);
1534
-
1535
- const handleSubmit = async (e: React.FormEvent) => {
1536
- e.preventDefault();
1537
-
1538
- if (password !== confirmPassword) {
1539
- toast.error("Passwords don't match", {
1540
- description: "Please make sure both password fields match.",
1541
- });
1542
- return;
1543
- }
1544
-
1545
- if (password.length < 8) {
1546
- toast.error("Password too short", {
1547
- description: "Password must be at least 8 characters long.",
1548
- });
1549
- return;
1550
- }
1551
-
1552
- try {
1553
- await resetPassword({ token, newPassword: password }); // ✅ Simple hook call
1554
-
1555
- setResetSuccess(true);
1556
- toast.success("Password reset successful!", {
1557
- description:
1558
- "Your password has been updated. Redirecting to sign in...",
1559
- });
1560
-
1561
- setTimeout(() => {
1562
- window.location.href = "/account/signin";
1563
- }, 2000);
1564
- } catch (err: any) {
1565
- let title = "Unable to reset password";
1566
- let description = err.message || "Please try again.";
1567
-
1568
- // ✅ Typed error handling
1569
- if (err._tag === "InvalidToken" || err._tag === "TokenExpired") {
1570
- title = "Invalid or expired token";
1571
- description =
1572
- "This password reset link is invalid or has expired. Please request a new one.";
1573
- setTokenValid(false);
1574
- } else if (err._tag === "WeakPassword") {
1575
- title = "Invalid password";
1576
- description =
1577
- "Password must be at least 8 characters with letters and numbers.";
1578
- } else if (err._tag === "NetworkError") {
1579
- title = "Network error";
1580
- description = "Unable to connect to the server.";
1581
- }
1582
-
1583
- toast.error(title, { description });
1584
- }
1585
- };
1586
-
1587
- // ... render logic (similar to BEFORE)
1588
- }
1589
- ```
1590
-
1591
- ---
1592
-
1593
- ## 3. Implementation Procedure (60 Steps)
1594
-
1595
- ### Phase 1: Pre-Migration Setup (Steps 1-12)
1596
-
1597
- **Step 1: Audit Current Implementation**
1598
-
1599
- ```bash
1600
- cd /Users/toc/Server/ONE/frontend
1601
-
1602
- # Count lines
1603
- wc -l src/components/auth/*.tsx
1604
-
1605
- # Find dependencies
1606
- grep -r "authClient" src/components/auth/
1607
- grep -r "ConvexHttpClient" src/components/auth/
1608
- grep -r "import.*convex" src/components/auth/
1609
- ```
1610
-
1611
- **Expected Output:**
1612
-
1613
- ```
1614
- 163 SimpleSignInForm.tsx
1615
- 157 SimpleSignUpForm.tsx
1616
- 151 MagicLinkAuth.tsx
1617
- 293 TwoFactorSettings.tsx
1618
- 134 VerifyEmailForm.tsx
1619
- 144 ForgotPasswordForm.tsx
1620
- 206 ResetPasswordForm.tsx
1621
- ```
1622
-
1623
- **Step 2: Run Baseline Tests**
1624
-
1625
- ```bash
1626
- # Save baseline results
1627
- bun test test/auth > baseline-auth-tests.txt 2>&1
1628
-
1629
- # Count passing tests
1630
- grep -c "PASS" baseline-auth-tests.txt
1631
- ```
1632
-
1633
- **Expected:** 50+ passing tests
1634
-
1635
- **Step 3: Create Migration Branch**
1636
-
1637
- ```bash
1638
- git checkout -b feature/auth-migration-2-5
1639
- git push -u origin feature/auth-migration-2-5
1640
- ```
1641
-
1642
- **Step 4: Create Rollback Tags**
1643
-
1644
- ```bash
1645
- # Tag before any changes
1646
- git tag rollback-pre-auth-migration
1647
- git push --tags
1648
- ```
1649
-
1650
- **Step 5: Verify Dependencies**
1651
-
1652
- ```bash
1653
- # Check DataProvider exists
1654
- test -f src/providers/DataProvider.ts || echo "ERROR: DataProvider missing"
1655
-
1656
- # Check hooks exist
1657
- test -f src/providers/hooks/index.ts || echo "ERROR: hooks missing"
1658
-
1659
- # Check ConvexAuthProvider exists
1660
- grep -q "ConvexAuthProvider" src/providers/ConvexProvider.ts || echo "ERROR: Provider missing"
1661
- ```
1662
-
1663
- **Step 6-12: Create Auth Hook Infrastructure**
1664
-
1665
- See full hook implementations in Appendix A.
1666
-
1667
- ---
1668
-
1669
- ### Phase 2: SimpleSignInForm Migration (Steps 13-17)
1670
-
1671
- **Step 13: Backup Current File**
1672
-
1673
- ```bash
1674
- cp src/components/auth/SimpleSignInForm.tsx src/components/auth/SimpleSignInForm.tsx.backup
1675
- ```
1676
-
1677
- **Step 14: Migrate SimpleSignInForm**
1678
-
1679
- Apply BEFORE → AFTER changes shown in section 2.1 above.
1680
-
1681
- **Step 15: Test SimpleSignInForm**
1682
-
1683
- ```bash
1684
- # Run login tests only
1685
- bun test test/auth/email-password.test.ts -t "login"
1686
-
1687
- # Manual testing checklist:
1688
- # 1. Login with valid credentials succeeds ✓
1689
- # 2. Login with invalid credentials shows error ✓
1690
- # 3. Login with non-existent email shows error ✓
1691
- # 4. Loading state displays correctly ✓
1692
- # 5. Success redirects to /account ✓
1693
- # 6. Session persists after refresh ✓
1694
- ```
1695
-
1696
- **Quality Gate:** ALL login tests must pass. If >5 tests fail → ROLLBACK.
1697
-
1698
- **Step 16: Compare Results**
1699
-
1700
- ```bash
1701
- bun test test/auth > step16-results.txt 2>&1
1702
- diff baseline-auth-tests.txt step16-results.txt
1703
- ```
1704
-
1705
- **Step 17: Commit SimpleSignInForm**
1706
-
1707
- ```bash
1708
- git add src/components/auth/SimpleSignInForm.tsx
1709
- git add src/providers/hooks/auth.ts
1710
- git commit -m "feat(auth): migrate SimpleSignInForm to DataProvider
1711
-
1712
- - Replace authClient.signIn.email() with useLogin() hook
1713
- - Improve error handling with typed errors (_tag pattern)
1714
- - Reduce code from 163 to 120 lines
1715
- - Preserve all existing functionality
1716
- - All login tests passing
1717
-
1718
- TESTS: bun test test/auth/email-password.test.ts
1719
- BREAKING: None
1720
- "
1721
- git tag rollback-post-signin-migration
1722
- git push --tags
1723
- ```
1724
-
1725
- ---
1726
-
1727
- ### Phase 3: SimpleSignUpForm Migration (Steps 18-22)
1728
-
1729
- **Step 18: Backup**
1730
-
1731
- ```bash
1732
- cp src/components/auth/SimpleSignUpForm.tsx src/components/auth/SimpleSignUpForm.tsx.backup
1733
- ```
1734
-
1735
- **Step 19: Migrate**
1736
-
1737
- Apply BEFORE → AFTER changes from section 2.2.
1738
-
1739
- **Step 20: Test**
1740
-
1741
- ```bash
1742
- bun test test/auth/email-password.test.ts -t "signup"
1743
- bun test test/auth
1744
-
1745
- # Manual tests:
1746
- # 1. Signup with new email succeeds ✓
1747
- # 2. Signup with existing email shows error ✓
1748
- # 3. Weak password shows error ✓
1749
- # 4. Password strength indicator works ✓
1750
- # 5. Success creates user + org membership ✓
1751
- ```
1752
-
1753
- **Step 21: Compare**
1754
-
1755
- ```bash
1756
- bun test test/auth > step21-results.txt 2>&1
1757
- diff baseline-auth-tests.txt step21-results.txt
1758
- ```
1759
-
1760
- **Step 22: Commit**
1761
-
1762
- ```bash
1763
- git add src/components/auth/SimpleSignUpForm.tsx
1764
- git commit -m "feat(auth): migrate SimpleSignUpForm to DataProvider
1765
-
1766
- - Replace authClient.signUp.email() with useSignup() hook
1767
- - Reduce code from 157 to 115 lines
1768
- - Preserve password strength indicator
1769
- - All signup tests passing
1770
-
1771
- TESTS: bun test test/auth/email-password.test.ts
1772
- "
1773
- git tag rollback-post-signup-migration
1774
- git push --tags
1775
- ```
1776
-
1777
- ---
1778
-
1779
- ### Phase 4: MagicLinkAuth Migration (Steps 23-27)
1780
-
1781
- **Step 23-27:** Follow same pattern as Phase 2-3.
1782
-
1783
- **Quality Gate:** All magic link tests must pass.
1784
-
1785
- ---
1786
-
1787
- ### Phase 5: TwoFactorSettings Migration (Steps 28-32)
1788
-
1789
- **Step 28-32:** Follow same pattern. This is the most complex component.
1790
-
1791
- **Quality Gate:** All 2FA tests must pass (TOTP generation, QR codes, backup codes).
1792
-
1793
- ---
1794
-
1795
- ### Phase 6: VerifyEmailForm Migration (Steps 33-37)
1796
-
1797
- **Step 33-37:** Follow same pattern.
1798
-
1799
- **Quality Gate:** Email verification tests must pass.
1800
-
1801
- ---
1802
-
1803
- ### Phase 7: Password Reset Forms (Steps 38-45)
1804
-
1805
- Migrate both ForgotPasswordForm and ResetPasswordForm.
1806
-
1807
- **Quality Gate:** All password reset tests must pass.
1808
-
1809
- ---
1810
-
1811
- ### Phase 8: Final Validation (Steps 46-60)
1812
-
1813
- **Step 46: Remove Direct Imports**
1814
-
1815
- ```bash
1816
- # Find remaining direct imports
1817
- grep -r "authClient" src/components/auth/
1818
- grep -r "ConvexHttpClient" src/components/auth/
1819
- grep -r "api\.auth" src/components/auth/
1820
-
1821
- # Should return NO results
1822
- ```
1823
-
1824
- **Step 47: TypeScript Check**
1825
-
1826
- ```bash
1827
- bunx astro check
1828
-
1829
- # Expected: 0 errors
1830
- ```
1831
-
1832
- **Step 48: Full Test Suite**
1833
-
1834
- ```bash
1835
- bun test test/auth > final-auth-tests.txt 2>&1
1836
-
1837
- # Compare to baseline
1838
- diff baseline-auth-tests.txt final-auth-tests.txt
1839
-
1840
- # Count passing
1841
- grep -c "PASS" final-auth-tests.txt
1842
- ```
1843
-
1844
- **Expected:** 50+ tests passing, same as baseline.
1845
-
1846
- **Step 49: Performance Testing**
1847
-
1848
- ```bash
1849
- # Measure login time
1850
- time curl -X POST http://localhost:4321/api/auth/signin \
1851
- -H "Content-Type: application/json" \
1852
- -d '{"email":"test@example.com","password":"password123"}'
1853
-
1854
- # Should complete in <2 seconds
1855
- ```
1856
-
1857
- **Step 50-60:** Documentation, cleanup, final review.
1858
-
1859
- ---
1860
-
1861
- ## 4. Rollback Plan
1862
-
1863
- ### Level 1: Single Component Rollback
1864
-
1865
- ```bash
1866
- # Example: Rollback SimpleSignInForm
1867
- git reset --hard rollback-pre-signin-migration
1868
-
1869
- # Restore backup
1870
- cp src/components/auth/SimpleSignInForm.tsx.backup src/components/auth/SimpleSignInForm.tsx
1871
-
1872
- # Verify tests pass
1873
- bun test test/auth/email-password.test.ts
1874
- ```
1875
-
1876
- **Time:** <5 minutes
1877
-
1878
- ### Level 2: Full Feature Rollback
1879
-
1880
- ```bash
1881
- # Rollback to pre-migration state
1882
- git reset --hard rollback-pre-auth-migration
1883
-
1884
- # Verify all tests pass
1885
- bun test test/auth
1886
- diff baseline-auth-tests.txt current-tests.txt
1887
- ```
1888
-
1889
- **Time:** <10 minutes
1890
-
1891
- ### Level 3: Feature Flag Rollback
1892
-
1893
- Create environment variable to toggle between old and new:
1894
-
1895
- ```bash
1896
- # .env.local
1897
- USE_NEW_AUTH_HOOKS=false # Use old authClient
1898
- USE_NEW_AUTH_HOOKS=true # Use new DataProvider (default)
1899
- ```
1900
-
1901
- **Time:** <2 minutes (just change env var and restart)
1902
-
1903
- ---
1904
-
1905
- ## 5. Testing Strategy
1906
-
1907
- ### Test Execution After Each Component
1908
-
1909
- ```bash
1910
- # Pattern:
1911
- bun test test/auth/[specific-test].test.ts
1912
- bun test test/auth # Full suite
1913
-
1914
- # If >5 tests fail:
1915
- # 1. Review errors
1916
- # 2. Check DataProvider implementation
1917
- # 3. Rollback to previous tag
1918
- # 4. Investigate and fix
1919
- # 5. Retry
1920
- ```
1921
-
1922
- ### Critical Test Cases (50+)
1923
-
1924
- **Email/Password (20 tests):**
1925
-
1926
- - ✅ Login with valid credentials
1927
- - ✅ Login with invalid password
1928
- - ✅ Login with non-existent email
1929
- - ✅ Signup with new email
1930
- - ✅ Signup with existing email
1931
- - ✅ Password strength validation
1932
- - ✅ Session persistence
1933
- - ✅ Logout functionality
1934
-
1935
- **OAuth (10 tests):**
1936
-
1937
- - ✅ GitHub OAuth flow
1938
- - ✅ Google OAuth flow
1939
- - ✅ Account linking
1940
- - ✅ OAuth error handling
1941
-
1942
- **Magic Links (8 tests):**
1943
-
1944
- - ✅ Request magic link
1945
- - ✅ Authenticate with valid token
1946
- - ✅ Expired token (>15 min)
1947
- - ✅ Used token (single-use)
1948
- - ✅ Invalid token
1949
-
1950
- **Password Reset (8 tests):**
1951
-
1952
- - ✅ Request reset
1953
- - ✅ Reset with valid token
1954
- - ✅ Expired token (>1 hour)
1955
- - ✅ New password works
1956
-
1957
- **Email Verification (4 tests):**
1958
-
1959
- - ✅ Verify with valid token
1960
- - ✅ Expired token
1961
- - ✅ Already verified
1962
-
1963
- **2FA (8 tests):**
1964
-
1965
- - ✅ Enable 2FA
1966
- - ✅ QR code generation
1967
- - ✅ Backup codes
1968
- - ✅ TOTP verification
1969
- - ✅ Disable 2FA
1970
-
1971
- ---
1972
-
1973
- ## 6. Quality Gates
1974
-
1975
- ### Mandatory Gates (MUST PASS)
1976
-
1977
- 1. **All 50+ auth tests pass** ✅
1978
- 2. **No direct Convex imports** ✅
1979
- 3. **TypeScript compiles (0 errors)** ✅
1980
- 4. **Performance within 10% baseline** ✅
1981
- 5. **Zero functionality regression** ✅
1982
-
1983
- ### Quality Metrics
1984
-
1985
- - Code reduction: **~250 fewer lines** (1,248 → ~1,000)
1986
- - Type safety: **100% typed errors** (no string checking)
1987
- - Maintainability: **Cleaner hook-based code**
1988
- - Testability: **Easier to mock providers**
1989
-
1990
- ---
1991
-
1992
- ## 7. Success Criteria
1993
-
1994
- ✅ **All 50+ tests passing**
1995
- ✅ **No direct authClient or Convex imports**
1996
- ✅ **TypeScript clean (0 errors)**
1997
- ✅ **Performance maintained**
1998
- ✅ **Documentation updated**
1999
- ✅ **Rollback plan tested**
2000
-
2001
- **Sign-Off Requirements:**
2002
-
2003
- 1. Frontend Specialist approval
2004
- 2. Quality Agent validation
2005
- 3. All tests green
2006
- 4. Performance benchmarks met
2007
- 5. Code review complete
2008
-
2009
- ---
2010
-
2011
- ## Appendix A: Complete Hook Implementations
2012
-
2013
- ### useLogin Hook
2014
-
2015
- ```typescript
2016
- // frontend/src/providers/hooks/auth.ts
2017
- import { useState } from "react";
2018
- import { useDataProvider } from "../DataProviderContext";
2019
- import type { AuthResult, LoginArgs } from "../types";
2020
-
2021
- export function useLogin() {
2022
- const provider = useDataProvider();
2023
- const [loading, setLoading] = useState(false);
2024
- const [error, setError] = useState<Error | null>(null);
2025
-
2026
- const mutate = async (args: LoginArgs): Promise<AuthResult> => {
2027
- setLoading(true);
2028
- setError(null);
2029
-
2030
- try {
2031
- const result = await provider.auth.login(args);
2032
- setLoading(false);
2033
- return result;
2034
- } catch (err) {
2035
- const error = err instanceof Error ? err : new Error(String(err));
2036
- setError(error);
2037
- setLoading(false);
2038
- throw error;
2039
- }
2040
- };
2041
-
2042
- return { mutate, loading, error };
2043
- }
2044
- ```
2045
-
2046
- ### use2FA Hook
2047
-
2048
- ```typescript
2049
- export function use2FA() {
2050
- const provider = useDataProvider();
2051
- const [loading, setLoading] = useState(false);
2052
- const [error, setError] = useState<Error | null>(null);
2053
-
2054
- const getStatus = async (): Promise<{
2055
- enabled: boolean;
2056
- hasSetup: boolean;
2057
- }> => {
2058
- try {
2059
- return await provider.auth.get2FAStatus();
2060
- } catch (err) {
2061
- throw err instanceof Error ? err : new Error(String(err));
2062
- }
2063
- };
2064
-
2065
- const setup = async (): Promise<{
2066
- secret: string;
2067
- backupCodes: string[];
2068
- }> => {
2069
- setLoading(true);
2070
- setError(null);
2071
-
2072
- try {
2073
- const result = await provider.auth.setup2FA();
2074
- setLoading(false);
2075
- return result;
2076
- } catch (err) {
2077
- const error = err instanceof Error ? err : new Error(String(err));
2078
- setError(error);
2079
- setLoading(false);
2080
- throw error;
2081
- }
2082
- };
2083
-
2084
- const verify = async (code: string): Promise<void> => {
2085
- setLoading(true);
2086
- setError(null);
2087
-
2088
- try {
2089
- await provider.auth.verify2FA({ code });
2090
- setLoading(false);
2091
- } catch (err) {
2092
- const error = err instanceof Error ? err : new Error(String(err));
2093
- setError(error);
2094
- setLoading(false);
2095
- throw error;
2096
- }
2097
- };
2098
-
2099
- const disable = async (password: string): Promise<void> => {
2100
- setLoading(true);
2101
- setError(null);
2102
-
2103
- try {
2104
- await provider.auth.disable2FA({ password });
2105
- setLoading(false);
2106
- } catch (err) {
2107
- const error = err instanceof Error ? err : new Error(String(err));
2108
- setError(error);
2109
- setLoading(false);
2110
- throw error;
2111
- }
2112
- };
2113
-
2114
- return { getStatus, setup, verify, disable, loading, error };
2115
- }
2116
- ```
2117
-
2118
- ---
2119
-
2120
- ## Appendix B: Error Types
2121
-
2122
- ```typescript
2123
- // frontend/src/providers/types/auth-errors.ts
2124
- export type AuthError =
2125
- | { _tag: "InvalidCredentials"; message: string; suggestion: string }
2126
- | { _tag: "UserNotFound"; message: string; suggestion: string }
2127
- | { _tag: "EmailAlreadyExists"; message: string; suggestion: string }
2128
- | { _tag: "WeakPassword"; message: string; suggestion: string }
2129
- | { _tag: "InvalidToken"; message: string; suggestion: string }
2130
- | { _tag: "TokenExpired"; message: string; suggestion: string }
2131
- | { _tag: "NetworkError"; message: string; suggestion: string }
2132
- | { _tag: "RateLimitExceeded"; message: string; suggestion: string }
2133
- | { _tag: "EmailNotVerified"; message: string; suggestion: string }
2134
- | { _tag: "TwoFactorRequired"; message: string; suggestion: string }
2135
- | { _tag: "Invalid2FACode"; message: string; suggestion: string };
2136
- ```
2137
-
2138
- ---
2139
-
2140
- **Total Specification Length:** 950+ lines
2141
- **Status:** ✅ COMPLETE - Ready for Implementation
2142
- **Next:** Wait for Feature 2-1 and 2-4 completion, then execute migration
2143
-
2144
- **Critical Reminder:** ALL 50+ auth tests MUST pass. <5 failures = continue. >5 failures = STOP and ROLLBACK immediately.