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,2148 +0,0 @@
1
- ---
2
- title: Astro Effect Complete Vision
3
- dimension: knowledge
4
- category: astro-effect-complete-vision.md
5
- tags: architecture
6
- related_dimensions: events, things
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 knowledge dimension in the astro-effect-complete-vision.md category.
13
- Location: one/knowledge/astro-effect-complete-vision.md
14
- Purpose: Documents complete vision: astro + effect.ts in 5 layers
15
- Related dimensions: events, things
16
- For AI agents: Read this to understand astro effect complete vision.
17
- ---
18
-
19
- # Complete Vision: Astro + Effect.ts in 5 Layers
20
-
21
- ## Overview: Progressive Enhancement Architecture
22
-
23
- This document shows **real-world examples** of building with Astro + Effect.ts, progressing through 5 layers of complexity. Each layer builds on the previous, showing when and why to add each piece.
24
-
25
- **Foundation:** Read `astro-effect-simple-architecture.md` first for the core philosophy.
26
-
27
- ## The 5 Layers
28
-
29
- ```
30
- Layer 1: Static Content (Astro + Content Collections)
31
- ↓
32
- Layer 2: Validation (+ Zod schemas + Effect.ts)
33
- ↓
34
- Layer 3: Client State (+ React islands)
35
- ↓
36
- Layer 4: Data Persistence (+ REST API)
37
- ↓
38
- Layer 5: Full-Stack App (+ Database + Auth)
39
- ```
40
-
41
- **Golden Rule:** Start at Layer 1. Only move to the next layer when you need it.
42
-
43
- ---
44
-
45
- ## Layer 1: Static Content (Blog Example)
46
-
47
- **Use Case:** Marketing site, blog, documentation - anything that's mostly read-only.
48
-
49
- **What You Need:**
50
- - Astro pages (routing)
51
- - Content collections (markdown/YAML)
52
- - shadcn components (UI)
53
-
54
- **What You DON'T Need:**
55
- - ❌ State management
56
- - ❌ Database
57
- - ❌ API
58
- - ❌ Authentication
59
-
60
- ### Complete File Structure
61
-
62
- ```
63
- src/
64
- ├── pages/
65
- │ ├── index.astro # Homepage
66
- │ ├── blog/
67
- │ │ ├── index.astro # Blog list
68
- │ │ └── [...slug].astro # Blog post detail
69
- │ └── about.astro # About page
70
- │
71
- ├── content/
72
- │ ├── config.ts # Content schemas
73
- │ └── blog/
74
- │ ├── first-post.md
75
- │ ├── second-post.md
76
- │ └── third-post.md
77
- │
78
- ├── components/
79
- │ ├── BlogCard.tsx # Post preview card
80
- │ ├── BlogPost.tsx # Full post display
81
- │ └── ui/ # shadcn components
82
- │ ├── card.tsx
83
- │ ├── button.tsx
84
- │ └── badge.tsx
85
- │
86
- └── layouts/
87
- └── Layout.astro # Base layout
88
- ```
89
-
90
- ### Schema Definition
91
-
92
- ```typescript
93
- // src/content/config.ts
94
- import { defineCollection, z } from "astro:content";
95
-
96
- const blogCollection = defineCollection({
97
- type: "content",
98
- schema: z.object({
99
- title: z.string(),
100
- description: z.string(),
101
- author: z.string(),
102
- date: z.date(),
103
- tags: z.array(z.string()).default([]),
104
- featured: z.boolean().default(false),
105
- }),
106
- });
107
-
108
- export const collections = { blog: blogCollection };
109
- ```
110
-
111
- ### Content Files
112
-
113
- ```markdown
114
- ---
115
- # src/content/blog/first-post.md
116
- title: "Getting Started with Astro"
117
- description: "Learn how to build lightning-fast websites"
118
- author: "Alice Developer"
119
- date: 2025-01-15
120
- tags: ["astro", "web-dev"]
121
- featured: true
122
- ---
123
-
124
- # Getting Started with Astro
125
-
126
- Astro is a modern static site generator that lets you build faster websites...
127
-
128
- ## Key Features
129
-
130
- - **Islands Architecture**: Ship less JavaScript
131
- - **Content Collections**: Type-safe content
132
- - **Framework Agnostic**: Use React, Vue, Svelte, or none
133
- ```
134
-
135
- ### List Page
136
-
137
- ```astro
138
- ---
139
- // src/pages/blog/index.astro
140
- import Layout from "@/layouts/Layout.astro";
141
- import { getCollection } from "astro:content";
142
- import BlogCard from "@/components/BlogCard.tsx";
143
-
144
- // Get all blog posts, sorted by date
145
- const posts = (await getCollection("blog"))
146
- .sort((a, b) => b.data.date.valueOf() - a.data.date.valueOf());
147
-
148
- const featuredPosts = posts.filter(p => p.data.featured);
149
- const regularPosts = posts.filter(p => !p.data.featured);
150
- ---
151
-
152
- <Layout title="Blog">
153
- <div class="container py-12">
154
- <h1 class="text-5xl font-bold mb-4">Blog</h1>
155
- <p class="text-xl text-gray-600 mb-12">
156
- Thoughts on web development, design, and technology
157
- </p>
158
-
159
- {featuredPosts.length > 0 && (
160
- <section class="mb-12">
161
- <h2 class="text-3xl font-bold mb-6">Featured Posts</h2>
162
- <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
163
- {featuredPosts.map(post => (
164
- <BlogCard post={post} featured={true} />
165
- ))}
166
- </div>
167
- </section>
168
- )}
169
-
170
- <section>
171
- <h2 class="text-3xl font-bold mb-6">All Posts</h2>
172
- <div class="grid grid-cols-1 md:grid-cols-3 gap-6">
173
- {regularPosts.map(post => (
174
- <BlogCard post={post} />
175
- ))}
176
- </div>
177
- </section>
178
- </div>
179
- </Layout>
180
- ```
181
-
182
- ### Detail Page
183
-
184
- ```astro
185
- ---
186
- // src/pages/blog/[...slug].astro
187
- import Layout from "@/layouts/Layout.astro";
188
- import { getCollection, type CollectionEntry } from "astro:content";
189
- import { Badge } from "@/components/ui/badge";
190
-
191
- export async function getStaticPaths() {
192
- const posts = await getCollection("blog");
193
- return posts.map(post => ({
194
- params: { slug: post.slug },
195
- props: { post },
196
- }));
197
- }
198
-
199
- type Props = { post: CollectionEntry<"blog"> };
200
- const { post } = Astro.props;
201
- const { Content } = await post.render();
202
- ---
203
-
204
- <Layout title={post.data.title}>
205
- <article class="container max-w-4xl py-12">
206
- <header class="mb-8">
207
- <h1 class="text-5xl font-bold mb-4">{post.data.title}</h1>
208
- <p class="text-xl text-gray-600 mb-4">{post.data.description}</p>
209
-
210
- <div class="flex items-center gap-4 text-sm text-gray-500 mb-4">
211
- <span>By {post.data.author}</span>
212
- <span>•</span>
213
- <time datetime={post.data.date.toISOString()}>
214
- {post.data.date.toLocaleDateString()}
215
- </time>
216
- </div>
217
-
218
- <div class="flex gap-2">
219
- {post.data.tags.map(tag => (
220
- <Badge variant="secondary">{tag}</Badge>
221
- ))}
222
- </div>
223
- </header>
224
-
225
- <div class="prose prose-lg max-w-none">
226
- <Content />
227
- </div>
228
- </article>
229
- </Layout>
230
- ```
231
-
232
- ### Component
233
-
234
- ```tsx
235
- // src/components/BlogCard.tsx
236
- import { Card, CardHeader, CardTitle, CardDescription, CardContent } from "@/components/ui/card";
237
- import { Badge } from "@/components/ui/badge";
238
- import type { CollectionEntry } from "astro:content";
239
-
240
- type Props = {
241
- post: CollectionEntry<"blog">;
242
- featured?: boolean;
243
- };
244
-
245
- export function BlogCard({ post, featured = false }: Props) {
246
- return (
247
- <a href={`/blog/${post.slug}`} class="block transition hover:scale-105">
248
- <Card className={featured ? "border-2 border-blue-500" : ""}>
249
- <CardHeader>
250
- <CardTitle>{post.data.title}</CardTitle>
251
- <CardDescription>{post.data.description}</CardDescription>
252
- </CardHeader>
253
- <CardContent>
254
- <div class="flex items-center justify-between text-sm text-gray-500">
255
- <span>{post.data.author}</span>
256
- <time datetime={post.data.date.toISOString()}>
257
- {post.data.date.toLocaleDateString()}
258
- </time>
259
- </div>
260
- <div class="flex gap-2 mt-3">
261
- {post.data.tags.slice(0, 3).map(tag => (
262
- <Badge key={tag} variant="outline">{tag}</Badge>
263
- ))}
264
- </div>
265
- </CardContent>
266
- </Card>
267
- </a>
268
- );
269
- }
270
- ```
271
-
272
- **Layer 1 Result:** Static blog with type-safe content, beautiful UI, and zero JavaScript overhead.
273
-
274
- ---
275
-
276
- ## Layer 2: Validation (Product Catalog Example)
277
-
278
- **Use Case:** E-commerce product catalog, pricing calculator - anything needing input validation.
279
-
280
- **Added to Layer 1:**
281
- - ✅ Effect.ts services (validation logic)
282
- - ✅ Zod refinements (advanced validation)
283
-
284
- **Still Don't Need:**
285
- - ❌ Client state
286
- - ❌ Database
287
- - ❌ API
288
-
289
- ### Complete File Structure
290
-
291
- ```
292
- src/
293
- ├── pages/
294
- │ ├── products/
295
- │ │ ├── index.astro # Product list
296
- │ │ └── [slug].astro # Product detail
297
- │ └── calculator.astro # Price calculator
298
- │
299
- ├── content/
300
- │ ├── config.ts
301
- │ └── products/
302
- │ ├── product-1.yaml
303
- │ └── product-2.yaml
304
- │
305
- ├── components/
306
- │ ├── ProductCard.tsx
307
- │ ├── PriceCalculator.tsx # Uses Effect.ts validation
308
- │ └── ui/
309
- │
310
- └── lib/
311
- └── services/
312
- └── productService.ts # Effect.ts validation logic
313
- ```
314
-
315
- ### Enhanced Schema with Validation
316
-
317
- ```typescript
318
- // src/content/config.ts
319
- import { defineCollection, z } from "astro:content";
320
-
321
- const productCollection = defineCollection({
322
- type: "data",
323
- schema: z.object({
324
- name: z.string().min(1, "Product name required"),
325
- slug: z.string().regex(/^[a-z0-9-]+$/, "Invalid slug format"),
326
- description: z.string(),
327
- price: z.number().positive("Price must be positive"),
328
- currency: z.enum(["USD", "EUR", "GBP"]).default("USD"),
329
- category: z.enum(["software", "hardware", "service"]),
330
- inStock: z.boolean().default(true),
331
- features: z.array(z.string()).min(1, "At least one feature required"),
332
- specifications: z.record(z.string(), z.any()).optional(),
333
- }).refine(
334
- data => data.price > 0 || !data.inStock,
335
- { message: "In-stock products must have a positive price" }
336
- ),
337
- });
338
-
339
- export const collections = { products: productCollection };
340
- ```
341
-
342
- ### Product Content
343
-
344
- ```yaml
345
- # src/content/products/pro-plan.yaml
346
- name: "Pro Plan"
347
- slug: "pro-plan"
348
- description: "Professional features for growing teams"
349
- price: 49.99
350
- currency: "USD"
351
- category: "software"
352
- inStock: true
353
- features:
354
- - "Unlimited projects"
355
- - "Advanced analytics"
356
- - "Priority support"
357
- - "Custom integrations"
358
- specifications:
359
- users: "Up to 50"
360
- storage: "1TB"
361
- apiCalls: "100,000/month"
362
- ```
363
-
364
- ### Effect.ts Service
365
-
366
- ```typescript
367
- // src/lib/services/productService.ts
368
- import { Effect, Data } from "effect";
369
-
370
- // Tagged errors
371
- export class ValidationError extends Data.TaggedError("ValidationError")<{
372
- field: string;
373
- message: string;
374
- }> {}
375
-
376
- export class PriceError extends Data.TaggedError("PriceError")<{
377
- reason: string;
378
- }> {}
379
-
380
- // Validation functions
381
- export const validateQuantity = (
382
- quantity: number
383
- ): Effect.Effect<number, ValidationError> =>
384
- Effect.gen(function* () {
385
- if (!Number.isInteger(quantity)) {
386
- return yield* new ValidationError({
387
- field: "quantity",
388
- message: "Quantity must be an integer",
389
- });
390
- }
391
- if (quantity < 1) {
392
- return yield* new ValidationError({
393
- field: "quantity",
394
- message: "Quantity must be at least 1",
395
- });
396
- }
397
- if (quantity > 1000) {
398
- return yield* new ValidationError({
399
- field: "quantity",
400
- message: "Quantity cannot exceed 1000",
401
- });
402
- }
403
- return quantity;
404
- });
405
-
406
- export const calculatePrice = (
407
- basePrice: number,
408
- quantity: number,
409
- discountCode?: string
410
- ): Effect.Effect<{ total: number; discount: number }, PriceError | ValidationError> =>
411
- Effect.gen(function* () {
412
- // Validate quantity first
413
- const validQuantity = yield* validateQuantity(quantity);
414
-
415
- if (basePrice <= 0) {
416
- return yield* new PriceError({ reason: "Invalid base price" });
417
- }
418
-
419
- let discount = 0;
420
-
421
- // Apply volume discount
422
- if (validQuantity >= 10) discount += 0.1; // 10% off
423
- if (validQuantity >= 50) discount += 0.05; // Additional 5% off
424
-
425
- // Apply promo code
426
- if (discountCode === "SAVE20") discount += 0.2;
427
- if (discountCode === "SAVE10") discount += 0.1;
428
-
429
- const subtotal = basePrice * validQuantity;
430
- const discountAmount = subtotal * discount;
431
- const total = subtotal - discountAmount;
432
-
433
- return { total, discount: discountAmount };
434
- });
435
-
436
- // Composable validation pipeline
437
- export const validateAndPrice = (
438
- product: { price: number; inStock: boolean },
439
- quantity: number,
440
- discountCode?: string
441
- ): Effect.Effect<{ total: number; discount: number }, ValidationError | PriceError> =>
442
- Effect.gen(function* () {
443
- if (!product.inStock) {
444
- return yield* new PriceError({ reason: "Product out of stock" });
445
- }
446
-
447
- return yield* calculatePrice(product.price, quantity, discountCode);
448
- });
449
- ```
450
-
451
- ### Calculator Component (Client Island)
452
-
453
- ```tsx
454
- // src/components/PriceCalculator.tsx
455
- import { useState } from "react";
456
- import { Button } from "@/components/ui/button";
457
- import { Input } from "@/components/ui/input";
458
- import { Label } from "@/components/ui/label";
459
- import { Card, CardHeader, CardTitle, CardContent } from "@/components/ui/card";
460
- import { Alert, AlertDescription } from "@/components/ui/alert";
461
- import { Effect } from "effect";
462
- import { calculatePrice, type ValidationError, type PriceError } from "@/lib/services/productService";
463
-
464
- type Props = {
465
- basePrice: number;
466
- };
467
-
468
- export function PriceCalculator({ basePrice }: Props) {
469
- const [quantity, setQuantity] = useState(1);
470
- const [discountCode, setDiscountCode] = useState("");
471
- const [result, setResult] = useState<{ total: number; discount: number } | null>(null);
472
- const [error, setError] = useState<string | null>(null);
473
-
474
- const handleCalculate = async () => {
475
- setError(null);
476
-
477
- const effect = calculatePrice(basePrice, quantity, discountCode || undefined);
478
-
479
- const result = await Effect.runPromise(
480
- Effect.either(effect)
481
- );
482
-
483
- if (result._tag === "Left") {
484
- const err = result.left;
485
- if (err._tag === "ValidationError") {
486
- setError(`${err.field}: ${err.message}`);
487
- } else if (err._tag === "PriceError") {
488
- setError(err.reason);
489
- }
490
- setResult(null);
491
- } else {
492
- setResult(result.right);
493
- }
494
- };
495
-
496
- return (
497
- <Card>
498
- <CardHeader>
499
- <CardTitle>Price Calculator</CardTitle>
500
- </CardHeader>
501
- <CardContent className="space-y-4">
502
- <div>
503
- <Label htmlFor="quantity">Quantity</Label>
504
- <Input
505
- id="quantity"
506
- type="number"
507
- min="1"
508
- value={quantity}
509
- onChange={(e) => setQuantity(Number(e.target.value))}
510
- />
511
- </div>
512
-
513
- <div>
514
- <Label htmlFor="discount">Discount Code (optional)</Label>
515
- <Input
516
- id="discount"
517
- type="text"
518
- placeholder="SAVE20"
519
- value={discountCode}
520
- onChange={(e) => setDiscountCode(e.target.value.toUpperCase())}
521
- />
522
- </div>
523
-
524
- <Button onClick={handleCalculate} className="w-full">
525
- Calculate Price
526
- </Button>
527
-
528
- {error && (
529
- <Alert variant="destructive">
530
- <AlertDescription>{error}</AlertDescription>
531
- </Alert>
532
- )}
533
-
534
- {result && (
535
- <div className="p-4 bg-green-50 rounded-lg">
536
- <p className="text-sm text-gray-600">Discount: ${result.discount.toFixed(2)}</p>
537
- <p className="text-2xl font-bold text-green-600">
538
- Total: ${result.total.toFixed(2)}
539
- </p>
540
- </div>
541
- )}
542
- </CardContent>
543
- </Card>
544
- );
545
- }
546
- ```
547
-
548
- ### Product Page with Calculator
549
-
550
- ```astro
551
- ---
552
- // src/pages/products/[slug].astro
553
- import Layout from "@/layouts/Layout.astro";
554
- import { getCollection } from "astro:content";
555
- import PriceCalculator from "@/components/PriceCalculator.tsx";
556
- import { Badge } from "@/components/ui/badge";
557
-
558
- export async function getStaticPaths() {
559
- const products = await getCollection("products");
560
- return products.map(product => ({
561
- params: { slug: product.data.slug },
562
- props: { product },
563
- }));
564
- }
565
-
566
- const { product } = Astro.props;
567
- ---
568
-
569
- <Layout title={product.data.name}>
570
- <div class="container max-w-6xl py-12">
571
- <div class="grid grid-cols-1 md:grid-cols-2 gap-12">
572
- <!-- Product Info -->
573
- <div>
574
- <h1 class="text-4xl font-bold mb-4">{product.data.name}</h1>
575
- <p class="text-xl text-gray-600 mb-6">{product.data.description}</p>
576
-
577
- <div class="mb-6">
578
- <Badge variant={product.data.inStock ? "default" : "destructive"}>
579
- {product.data.inStock ? "In Stock" : "Out of Stock"}
580
- </Badge>
581
- <Badge variant="outline" class="ml-2">{product.data.category}</Badge>
582
- </div>
583
-
584
- <div class="mb-6">
585
- <h2 class="text-2xl font-bold mb-3">Features</h2>
586
- <ul class="list-disc list-inside space-y-2">
587
- {product.data.features.map(feature => (
588
- <li>{feature}</li>
589
- ))}
590
- </ul>
591
- </div>
592
-
593
- {product.data.specifications && (
594
- <div>
595
- <h2 class="text-2xl font-bold mb-3">Specifications</h2>
596
- <dl class="space-y-2">
597
- {Object.entries(product.data.specifications).map(([key, value]) => (
598
- <div class="flex justify-between">
599
- <dt class="font-medium">{key}:</dt>
600
- <dd class="text-gray-600">{value}</dd>
601
- </div>
602
- ))}
603
- </dl>
604
- </div>
605
- )}
606
- </div>
607
-
608
- <!-- Price Calculator -->
609
- <div>
610
- <PriceCalculator basePrice={product.data.price} client:load />
611
- </div>
612
- </div>
613
- </div>
614
- </Layout>
615
- ```
616
-
617
- **Layer 2 Result:** Product catalog with sophisticated validation, pricing logic, and error handling - all type-safe.
618
-
619
- ---
620
-
621
- ## Layer 3: Client State (Shopping Cart Example)
622
-
623
- **Use Case:** Shopping cart, interactive forms, multi-step wizards - anything needing client-side state.
624
-
625
- **Added to Layer 2:**
626
- - ✅ React state hooks (useState, useReducer)
627
- - ✅ Client-side interactivity
628
- - ✅ nanostores (for global client state)
629
-
630
- **Still Don't Need:**
631
- - ❌ Database
632
- - ❌ API (state is ephemeral)
633
-
634
- ### Complete File Structure
635
-
636
- ```
637
- src/
638
- ├── pages/
639
- │ ├── shop/
640
- │ │ ├── index.astro # Product listing
641
- │ │ ├── [slug].astro # Product detail
642
- │ │ └── cart.astro # Shopping cart page
643
- │ └── checkout.astro # Checkout flow
644
- │
645
- ├── content/
646
- │ └── products/
647
- │
648
- ├── components/
649
- │ ├── ProductCard.tsx
650
- │ ├── AddToCartButton.tsx # Client island
651
- │ ├── ShoppingCart.tsx # Client island
652
- │ └── CartSummary.tsx # Client island
653
- │
654
- ├── lib/
655
- │ ├── services/
656
- │ │ ├── productService.ts
657
- │ │ └── cartService.ts # Effect.ts cart logic
658
- │ └── stores/
659
- │ └── cart.ts # nanostores global state
660
- ```
661
-
662
- ### Cart Store (nanostores)
663
-
664
- ```typescript
665
- // src/lib/stores/cart.ts
666
- import { atom, map } from "nanostores";
667
-
668
- export type CartItem = {
669
- productId: string;
670
- name: string;
671
- price: number;
672
- quantity: number;
673
- };
674
-
675
- export const cartItems = map<Record<string, CartItem>>({});
676
-
677
- export const cartCount = atom(0);
678
-
679
- // Actions
680
- export function addToCart(item: Omit<CartItem, "quantity">) {
681
- const current = cartItems.get();
682
- const existing = current[item.productId];
683
-
684
- if (existing) {
685
- cartItems.setKey(item.productId, {
686
- ...existing,
687
- quantity: existing.quantity + 1,
688
- });
689
- } else {
690
- cartItems.setKey(item.productId, { ...item, quantity: 1 });
691
- }
692
-
693
- updateCartCount();
694
- }
695
-
696
- export function removeFromCart(productId: string) {
697
- const current = cartItems.get();
698
- const { [productId]: removed, ...rest } = current;
699
- cartItems.set(rest);
700
- updateCartCount();
701
- }
702
-
703
- export function updateQuantity(productId: string, quantity: number) {
704
- if (quantity <= 0) {
705
- removeFromCart(productId);
706
- } else {
707
- const current = cartItems.get();
708
- const item = current[productId];
709
- if (item) {
710
- cartItems.setKey(productId, { ...item, quantity });
711
- }
712
- }
713
- updateCartCount();
714
- }
715
-
716
- export function clearCart() {
717
- cartItems.set({});
718
- cartCount.set(0);
719
- }
720
-
721
- function updateCartCount() {
722
- const items = Object.values(cartItems.get());
723
- const total = items.reduce((sum, item) => sum + item.quantity, 0);
724
- cartCount.set(total);
725
- }
726
- ```
727
-
728
- ### Cart Service (Effect.ts)
729
-
730
- ```typescript
731
- // src/lib/services/cartService.ts
732
- import { Effect, Data } from "effect";
733
- import type { CartItem } from "@/lib/stores/cart";
734
-
735
- export class CartError extends Data.TaggedError("CartError")<{
736
- reason: string;
737
- }> {}
738
-
739
- export const validateCartItem = (
740
- item: CartItem
741
- ): Effect.Effect<CartItem, CartError> =>
742
- Effect.gen(function* () {
743
- if (item.quantity < 1) {
744
- return yield* new CartError({ reason: "Quantity must be at least 1" });
745
- }
746
- if (item.quantity > 99) {
747
- return yield* new CartError({ reason: "Quantity cannot exceed 99" });
748
- }
749
- if (item.price <= 0) {
750
- return yield* new CartError({ reason: "Invalid price" });
751
- }
752
- return item;
753
- });
754
-
755
- export const calculateCartTotal = (
756
- items: CartItem[]
757
- ): Effect.Effect<{ subtotal: number; tax: number; total: number }, CartError> =>
758
- Effect.gen(function* () {
759
- // Validate all items
760
- const validatedItems = yield* Effect.all(
761
- items.map(validateCartItem),
762
- { concurrency: "unbounded" }
763
- );
764
-
765
- const subtotal = validatedItems.reduce(
766
- (sum, item) => sum + item.price * item.quantity,
767
- 0
768
- );
769
-
770
- const tax = subtotal * 0.08; // 8% tax
771
- const total = subtotal + tax;
772
-
773
- return { subtotal, tax, total };
774
- });
775
-
776
- export const applyDiscount = (
777
- total: number,
778
- code: string
779
- ): Effect.Effect<{ discount: number; finalTotal: number }, CartError> =>
780
- Effect.gen(function* () {
781
- let discount = 0;
782
-
783
- switch (code.toUpperCase()) {
784
- case "SAVE10":
785
- discount = total * 0.1;
786
- break;
787
- case "SAVE20":
788
- discount = total * 0.2;
789
- break;
790
- case "FREESHIP":
791
- discount = 10; // Free shipping
792
- break;
793
- default:
794
- return yield* new CartError({ reason: "Invalid discount code" });
795
- }
796
-
797
- return {
798
- discount,
799
- finalTotal: total - discount,
800
- };
801
- });
802
- ```
803
-
804
- ### Add to Cart Button
805
-
806
- ```tsx
807
- // src/components/AddToCartButton.tsx
808
- import { useState } from "react";
809
- import { Button } from "@/components/ui/button";
810
- import { addToCart } from "@/lib/stores/cart";
811
- import { ShoppingCart, Check } from "lucide-react";
812
-
813
- type Props = {
814
- productId: string;
815
- name: string;
816
- price: number;
817
- };
818
-
819
- export function AddToCartButton({ productId, name, price }: Props) {
820
- const [added, setAdded] = useState(false);
821
-
822
- const handleAdd = () => {
823
- addToCart({ productId, name, price });
824
- setAdded(true);
825
- setTimeout(() => setAdded(false), 2000);
826
- };
827
-
828
- return (
829
- <Button onClick={handleAdd} className="w-full" disabled={added}>
830
- {added ? (
831
- <>
832
- <Check className="mr-2 h-4 w-4" />
833
- Added!
834
- </>
835
- ) : (
836
- <>
837
- <ShoppingCart className="mr-2 h-4 w-4" />
838
- Add to Cart
839
- </>
840
- )}
841
- </Button>
842
- );
843
- }
844
- ```
845
-
846
- ### Shopping Cart Component
847
-
848
- ```tsx
849
- // src/components/ShoppingCart.tsx
850
- import { useStore } from "@nanostores/react";
851
- import { cartItems, removeFromCart, updateQuantity } from "@/lib/stores/cart";
852
- import { calculateCartTotal } from "@/lib/services/cartService";
853
- import { Card, CardHeader, CardTitle, CardContent } from "@/components/ui/card";
854
- import { Button } from "@/components/ui/button";
855
- import { Input } from "@/components/ui/input";
856
- import { Trash2 } from "lucide-react";
857
- import { useEffect, useState } from "react";
858
- import { Effect } from "effect";
859
-
860
- export function ShoppingCart() {
861
- const $cartItems = useStore(cartItems);
862
- const items = Object.values($cartItems);
863
-
864
- const [totals, setTotals] = useState<{
865
- subtotal: number;
866
- tax: number;
867
- total: number;
868
- } | null>(null);
869
-
870
- useEffect(() => {
871
- const calculateTotals = async () => {
872
- if (items.length === 0) {
873
- setTotals(null);
874
- return;
875
- }
876
-
877
- const result = await Effect.runPromise(
878
- Effect.either(calculateCartTotal(items))
879
- );
880
-
881
- if (result._tag === "Right") {
882
- setTotals(result.right);
883
- }
884
- };
885
-
886
- calculateTotals();
887
- }, [$cartItems]);
888
-
889
- if (items.length === 0) {
890
- return (
891
- <Card>
892
- <CardContent className="p-12 text-center">
893
- <p className="text-gray-500">Your cart is empty</p>
894
- </CardContent>
895
- </Card>
896
- );
897
- }
898
-
899
- return (
900
- <Card>
901
- <CardHeader>
902
- <CardTitle>Shopping Cart ({items.length} items)</CardTitle>
903
- </CardHeader>
904
- <CardContent className="space-y-4">
905
- {items.map(item => (
906
- <div key={item.productId} className="flex items-center gap-4 p-4 border rounded">
907
- <div className="flex-1">
908
- <h3 className="font-semibold">{item.name}</h3>
909
- <p className="text-sm text-gray-600">${item.price.toFixed(2)} each</p>
910
- </div>
911
-
912
- <div className="flex items-center gap-2">
913
- <Input
914
- type="number"
915
- min="1"
916
- max="99"
917
- value={item.quantity}
918
- onChange={(e) => updateQuantity(item.productId, Number(e.target.value))}
919
- className="w-20"
920
- />
921
- </div>
922
-
923
- <div className="font-bold">
924
- ${(item.price * item.quantity).toFixed(2)}
925
- </div>
926
-
927
- <Button
928
- variant="ghost"
929
- size="icon"
930
- onClick={() => removeFromCart(item.productId)}
931
- >
932
- <Trash2 className="h-4 w-4" />
933
- </Button>
934
- </div>
935
- ))}
936
-
937
- {totals && (
938
- <div className="border-t pt-4 space-y-2">
939
- <div className="flex justify-between text-sm">
940
- <span>Subtotal:</span>
941
- <span>${totals.subtotal.toFixed(2)}</span>
942
- </div>
943
- <div className="flex justify-between text-sm">
944
- <span>Tax (8%):</span>
945
- <span>${totals.tax.toFixed(2)}</span>
946
- </div>
947
- <div className="flex justify-between text-lg font-bold">
948
- <span>Total:</span>
949
- <span>${totals.total.toFixed(2)}</span>
950
- </div>
951
- </div>
952
- )}
953
-
954
- <Button className="w-full" size="lg">
955
- Proceed to Checkout
956
- </Button>
957
- </CardContent>
958
- </Card>
959
- );
960
- }
961
- ```
962
-
963
- ### Cart Page
964
-
965
- ```astro
966
- ---
967
- // src/pages/shop/cart.astro
968
- import Layout from "@/layouts/Layout.astro";
969
- import ShoppingCart from "@/components/ShoppingCart.tsx";
970
- ---
971
-
972
- <Layout title="Shopping Cart">
973
- <div class="container max-w-4xl py-12">
974
- <h1 class="text-4xl font-bold mb-8">Shopping Cart</h1>
975
- <ShoppingCart client:load />
976
- </div>
977
- </Layout>
978
- ```
979
-
980
- ### Product Page with Cart Button
981
-
982
- ```astro
983
- ---
984
- // src/pages/shop/[slug].astro
985
- import Layout from "@/layouts/Layout.astro";
986
- import { getCollection } from "astro:content";
987
- import AddToCartButton from "@/components/AddToCartButton.tsx";
988
-
989
- export async function getStaticPaths() {
990
- const products = await getCollection("products");
991
- return products.map(product => ({
992
- params: { slug: product.data.slug },
993
- props: { product },
994
- }));
995
- }
996
-
997
- const { product } = Astro.props;
998
- ---
999
-
1000
- <Layout title={product.data.name}>
1001
- <div class="container max-w-4xl py-12">
1002
- <h1 class="text-4xl font-bold mb-4">{product.data.name}</h1>
1003
- <p class="text-xl text-gray-600 mb-6">{product.data.description}</p>
1004
-
1005
- <div class="text-3xl font-bold text-green-600 mb-6">
1006
- ${product.data.price.toFixed(2)}
1007
- </div>
1008
-
1009
- <div class="max-w-sm">
1010
- <AddToCartButton
1011
- productId={product.id}
1012
- name={product.data.name}
1013
- price={product.data.price}
1014
- client:load
1015
- />
1016
- </div>
1017
- </div>
1018
- </Layout>
1019
- ```
1020
-
1021
- **Layer 3 Result:** Interactive shopping cart with client-side state management, all validated with Effect.ts.
1022
-
1023
- ---
1024
-
1025
- ## Layer 4: Data Persistence (Multi-Source Migration Example)
1026
-
1027
- **Use Case:** Data migrations, external API integration, CMS syncing - anything that fetches/transforms data from external sources.
1028
-
1029
- **Added to Layer 3:**
1030
- - ✅ REST API integration
1031
- - ✅ External data fetching
1032
- - ✅ Data transformation pipelines
1033
-
1034
- **Still Don't Need:**
1035
- - ❌ Your own database (reading from external sources)
1036
-
1037
- ### Complete File Structure
1038
-
1039
- ```
1040
- src/
1041
- ├── pages/
1042
- │ ├── migrate/
1043
- │ │ ├── index.astro # Migration dashboard
1044
- │ │ └── [source].astro # Source-specific migration
1045
- │ └── api/
1046
- │ └── migrate.ts # API endpoint for migrations
1047
- │
1048
- ├── lib/
1049
- │ └── services/
1050
- │ ├── migrationService.ts # Effect.ts migration logic
1051
- │ ├── githubAdapter.ts # GitHub API adapter
1052
- │ ├── notionAdapter.ts # Notion API adapter
1053
- │ └── stripeAdapter.ts # Stripe API adapter
1054
- │
1055
- └── components/
1056
- └── MigrationStatus.tsx # Real-time status display
1057
- ```
1058
-
1059
- ### Migration Service (Effect.ts)
1060
-
1061
- ```typescript
1062
- // src/lib/services/migrationService.ts
1063
- import { Effect, Data, Context } from "effect";
1064
-
1065
- // Tagged errors
1066
- export class FetchError extends Data.TaggedError("FetchError")<{
1067
- source: string;
1068
- reason: string;
1069
- }> {}
1070
-
1071
- export class TransformError extends Data.TaggedError("TransformError")<{
1072
- item: string;
1073
- reason: string;
1074
- }> {}
1075
-
1076
- export class ValidationError extends Data.TaggedError("ValidationError")<{
1077
- field: string;
1078
- message: string;
1079
- }> {}
1080
-
1081
- // Data source interface
1082
- export interface DataSource {
1083
- readonly name: string;
1084
- readonly fetch: () => Effect.Effect<unknown[], FetchError>;
1085
- readonly transform: (data: unknown) => Effect.Effect<MigratedItem, TransformError>;
1086
- readonly validate: (item: MigratedItem) => Effect.Effect<MigratedItem, ValidationError>;
1087
- }
1088
-
1089
- export const DataSource = Context.GenericTag<DataSource>("DataSource");
1090
-
1091
- // Migrated item schema
1092
- export type MigratedItem = {
1093
- id: string;
1094
- title: string;
1095
- content: string;
1096
- author: string;
1097
- createdAt: Date;
1098
- tags: string[];
1099
- metadata: Record<string, any>;
1100
- };
1101
-
1102
- // Migration pipeline
1103
- export const migrateFromSource = (
1104
- source: DataSource
1105
- ): Effect.Effect<MigratedItem[], FetchError | TransformError | ValidationError> =>
1106
- Effect.gen(function* () {
1107
- console.log(`Starting migration from ${source.name}...`);
1108
-
1109
- // Step 1: Fetch raw data
1110
- const rawData = yield* source.fetch();
1111
- console.log(`Fetched ${rawData.length} items from ${source.name}`);
1112
-
1113
- // Step 2: Transform each item
1114
- const transformed = yield* Effect.all(
1115
- rawData.map(item => source.transform(item)),
1116
- { concurrency: 5 } // Process 5 items at a time
1117
- );
1118
- console.log(`Transformed ${transformed.length} items`);
1119
-
1120
- // Step 3: Validate each item
1121
- const validated = yield* Effect.all(
1122
- transformed.map(item => source.validate(item)),
1123
- { concurrency: "unbounded" }
1124
- );
1125
- console.log(`Validated ${validated.length} items`);
1126
-
1127
- return validated;
1128
- });
1129
-
1130
- // Batch migration from multiple sources
1131
- export const migrateFromMultipleSources = (
1132
- sources: DataSource[]
1133
- ): Effect.Effect<
1134
- Map<string, MigratedItem[]>,
1135
- FetchError | TransformError | ValidationError
1136
- > =>
1137
- Effect.gen(function* () {
1138
- const results = yield* Effect.all(
1139
- sources.map(source =>
1140
- migrateFromSource(source).pipe(
1141
- Effect.map(items => [source.name, items] as const)
1142
- )
1143
- ),
1144
- { concurrency: 3 } // Process 3 sources at a time
1145
- );
1146
-
1147
- return new Map(results);
1148
- });
1149
-
1150
- // Validation helper
1151
- export const validateMigratedItem = (
1152
- item: MigratedItem
1153
- ): Effect.Effect<MigratedItem, ValidationError> =>
1154
- Effect.gen(function* () {
1155
- if (!item.id?.trim()) {
1156
- return yield* new ValidationError({
1157
- field: "id",
1158
- message: "ID is required",
1159
- });
1160
- }
1161
- if (!item.title?.trim()) {
1162
- return yield* new ValidationError({
1163
- field: "title",
1164
- message: "Title is required",
1165
- });
1166
- }
1167
- if (item.tags.length === 0) {
1168
- return yield* new ValidationError({
1169
- field: "tags",
1170
- message: "At least one tag required",
1171
- });
1172
- }
1173
- return item;
1174
- });
1175
- ```
1176
-
1177
- ### GitHub Adapter
1178
-
1179
- ```typescript
1180
- // src/lib/services/githubAdapter.ts
1181
- import { Effect } from "effect";
1182
- import { FetchError, TransformError, validateMigratedItem, type MigratedItem, type DataSource } from "./migrationService";
1183
-
1184
- type GitHubIssue = {
1185
- id: number;
1186
- number: number;
1187
- title: string;
1188
- body: string;
1189
- user: { login: string };
1190
- created_at: string;
1191
- labels: Array<{ name: string }>;
1192
- };
1193
-
1194
- export const GitHubDataSource: DataSource = {
1195
- name: "GitHub",
1196
-
1197
- fetch: (): Effect.Effect<GitHubIssue[], FetchError> =>
1198
- Effect.tryPromise({
1199
- try: async () => {
1200
- const response = await fetch(
1201
- "https://api.github.com/repos/owner/repo/issues",
1202
- {
1203
- headers: {
1204
- Authorization: `token ${import.meta.env.GITHUB_TOKEN}`,
1205
- Accept: "application/vnd.github.v3+json",
1206
- },
1207
- }
1208
- );
1209
-
1210
- if (!response.ok) {
1211
- throw new Error(`GitHub API error: ${response.statusText}`);
1212
- }
1213
-
1214
- return response.json();
1215
- },
1216
- catch: (error) =>
1217
- new FetchError({
1218
- source: "GitHub",
1219
- reason: error instanceof Error ? error.message : "Unknown error",
1220
- }),
1221
- }),
1222
-
1223
- transform: (data: unknown): Effect.Effect<MigratedItem, TransformError> =>
1224
- Effect.try({
1225
- try: () => {
1226
- const issue = data as GitHubIssue;
1227
-
1228
- return {
1229
- id: `github-${issue.number}`,
1230
- title: issue.title,
1231
- content: issue.body || "",
1232
- author: issue.user.login,
1233
- createdAt: new Date(issue.created_at),
1234
- tags: issue.labels.map(l => l.name),
1235
- metadata: {
1236
- source: "github",
1237
- issueNumber: issue.number,
1238
- url: `https://github.com/owner/repo/issues/${issue.number}`,
1239
- },
1240
- };
1241
- },
1242
- catch: (error) =>
1243
- new TransformError({
1244
- item: JSON.stringify(data),
1245
- reason: error instanceof Error ? error.message : "Transform failed",
1246
- }),
1247
- }),
1248
-
1249
- validate: validateMigratedItem,
1250
- };
1251
- ```
1252
-
1253
- ### Notion Adapter
1254
-
1255
- ```typescript
1256
- // src/lib/services/notionAdapter.ts
1257
- import { Effect } from "effect";
1258
- import { FetchError, TransformError, validateMigratedItem, type MigratedItem, type DataSource } from "./migrationService";
1259
-
1260
- type NotionPage = {
1261
- id: string;
1262
- properties: {
1263
- Title: { title: Array<{ plain_text: string }> };
1264
- Tags: { multi_select: Array<{ name: string }> };
1265
- Created: { created_time: string };
1266
- };
1267
- url: string;
1268
- };
1269
-
1270
- export const NotionDataSource: DataSource = {
1271
- name: "Notion",
1272
-
1273
- fetch: (): Effect.Effect<NotionPage[], FetchError> =>
1274
- Effect.tryPromise({
1275
- try: async () => {
1276
- const response = await fetch(
1277
- "https://api.notion.com/v1/databases/DATABASE_ID/query",
1278
- {
1279
- method: "POST",
1280
- headers: {
1281
- Authorization: `Bearer ${import.meta.env.NOTION_TOKEN}`,
1282
- "Notion-Version": "2022-06-28",
1283
- "Content-Type": "application/json",
1284
- },
1285
- }
1286
- );
1287
-
1288
- if (!response.ok) {
1289
- throw new Error(`Notion API error: ${response.statusText}`);
1290
- }
1291
-
1292
- const json = await response.json();
1293
- return json.results;
1294
- },
1295
- catch: (error) =>
1296
- new FetchError({
1297
- source: "Notion",
1298
- reason: error instanceof Error ? error.message : "Unknown error",
1299
- }),
1300
- }),
1301
-
1302
- transform: (data: unknown): Effect.Effect<MigratedItem, TransformError> =>
1303
- Effect.try({
1304
- try: () => {
1305
- const page = data as NotionPage;
1306
-
1307
- return {
1308
- id: `notion-${page.id}`,
1309
- title: page.properties.Title.title[0]?.plain_text || "Untitled",
1310
- content: "", // Would need to fetch page content separately
1311
- author: "notion-import",
1312
- createdAt: new Date(page.properties.Created.created_time),
1313
- tags: page.properties.Tags.multi_select.map(t => t.name),
1314
- metadata: {
1315
- source: "notion",
1316
- pageId: page.id,
1317
- url: page.url,
1318
- },
1319
- };
1320
- },
1321
- catch: (error) =>
1322
- new TransformError({
1323
- item: JSON.stringify(data),
1324
- reason: error instanceof Error ? error.message : "Transform failed",
1325
- }),
1326
- }),
1327
-
1328
- validate: validateMigratedItem,
1329
- };
1330
- ```
1331
-
1332
- ### Migration Page
1333
-
1334
- ```astro
1335
- ---
1336
- // src/pages/migrate/index.astro
1337
- import Layout from "@/layouts/Layout.astro";
1338
- import { Button } from "@/components/ui/button";
1339
- import { Card, CardHeader, CardTitle, CardContent } from "@/components/ui/card";
1340
- import MigrationStatus from "@/components/MigrationStatus.tsx";
1341
-
1342
- const sources = [
1343
- { name: "GitHub", description: "Import issues as blog posts", icon: "📦" },
1344
- { name: "Notion", description: "Import database pages", icon: "📝" },
1345
- { name: "Stripe", description: "Import customer data", icon: "💳" },
1346
- ];
1347
- ---
1348
-
1349
- <Layout title="Data Migration">
1350
- <div class="container max-w-6xl py-12">
1351
- <h1 class="text-4xl font-bold mb-4">Data Migration</h1>
1352
- <p class="text-xl text-gray-600 mb-12">
1353
- Import content from external sources
1354
- </p>
1355
-
1356
- <div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-12">
1357
- {sources.map(source => (
1358
- <Card>
1359
- <CardHeader>
1360
- <CardTitle class="flex items-center gap-2">
1361
- <span class="text-3xl">{source.icon}</span>
1362
- {source.name}
1363
- </CardTitle>
1364
- </CardHeader>
1365
- <CardContent>
1366
- <p class="text-sm text-gray-600 mb-4">{source.description}</p>
1367
- <Button asChild class="w-full">
1368
- <a href={`/migrate/${source.name.toLowerCase()}`}>
1369
- Start Migration
1370
- </a>
1371
- </Button>
1372
- </CardContent>
1373
- </Card>
1374
- ))}
1375
- </div>
1376
-
1377
- <MigrationStatus client:load />
1378
- </div>
1379
- </Layout>
1380
- ```
1381
-
1382
- ### Migration Status Component
1383
-
1384
- ```tsx
1385
- // src/components/MigrationStatus.tsx
1386
- import { useState } from "react";
1387
- import { Card, CardHeader, CardTitle, CardContent } from "@/components/ui/card";
1388
- import { Button } from "@/components/ui/button";
1389
- import { Alert, AlertDescription } from "@/components/ui/alert";
1390
- import { Effect } from "effect";
1391
- import { migrateFromMultipleSources } from "@/lib/services/migrationService";
1392
- import { GitHubDataSource } from "@/lib/services/githubAdapter";
1393
- import { NotionDataSource } from "@/lib/services/notionAdapter";
1394
-
1395
- type MigrationState = "idle" | "running" | "success" | "error";
1396
-
1397
- export function MigrationStatus() {
1398
- const [state, setState] = useState<MigrationState>("idle");
1399
- const [results, setResults] = useState<Map<string, any[]> | null>(null);
1400
- const [error, setError] = useState<string | null>(null);
1401
-
1402
- const runMigration = async () => {
1403
- setState("running");
1404
- setError(null);
1405
-
1406
- const sources = [GitHubDataSource, NotionDataSource];
1407
-
1408
- const result = await Effect.runPromise(
1409
- Effect.either(migrateFromMultipleSources(sources))
1410
- );
1411
-
1412
- if (result._tag === "Left") {
1413
- const err = result.left;
1414
- setError(`Migration failed: ${err._tag} - ${JSON.stringify(err)}`);
1415
- setState("error");
1416
- } else {
1417
- setResults(result.right);
1418
- setState("success");
1419
- }
1420
- };
1421
-
1422
- return (
1423
- <Card>
1424
- <CardHeader>
1425
- <CardTitle>Migration Status</CardTitle>
1426
- </CardHeader>
1427
- <CardContent className="space-y-4">
1428
- <Button
1429
- onClick={runMigration}
1430
- disabled={state === "running"}
1431
- className="w-full"
1432
- >
1433
- {state === "running" ? "Migrating..." : "Run Migration"}
1434
- </Button>
1435
-
1436
- {error && (
1437
- <Alert variant="destructive">
1438
- <AlertDescription>{error}</AlertDescription>
1439
- </Alert>
1440
- )}
1441
-
1442
- {results && (
1443
- <div className="space-y-4">
1444
- <Alert>
1445
- <AlertDescription>
1446
- Migration completed successfully!
1447
- </AlertDescription>
1448
- </Alert>
1449
-
1450
- {Array.from(results.entries()).map(([source, items]) => (
1451
- <div key={source} className="p-4 border rounded">
1452
- <h3 className="font-semibold mb-2">{source}</h3>
1453
- <p className="text-sm text-gray-600">
1454
- Migrated {items.length} items
1455
- </p>
1456
- <ul className="mt-2 space-y-1">
1457
- {items.slice(0, 5).map(item => (
1458
- <li key={item.id} className="text-sm">
1459
- • {item.title}
1460
- </li>
1461
- ))}
1462
- {items.length > 5 && (
1463
- <li className="text-sm text-gray-500">
1464
- ... and {items.length - 5} more
1465
- </li>
1466
- )}
1467
- </ul>
1468
- </div>
1469
- ))}
1470
- </div>
1471
- )}
1472
- </CardContent>
1473
- </Card>
1474
- );
1475
- }
1476
- ```
1477
-
1478
- **Layer 4 Result:** Multi-source data migration with Effect.ts pipelines, error handling, and concurrent processing.
1479
-
1480
- ---
1481
-
1482
- ## Layer 5: Full-Stack App (Team Management Example)
1483
-
1484
- **Use Case:** Full CRUD application with authentication, database persistence, and real-time updates.
1485
-
1486
- **Added to Layer 4:**
1487
- - ✅ Database (PostgreSQL via Drizzle ORM)
1488
- - ✅ Authentication (Better Auth)
1489
- - ✅ REST API (Hono)
1490
- - ✅ WebSockets (real-time updates)
1491
-
1492
- **Complete File Structure**
1493
-
1494
- ```
1495
- src/
1496
- ├── pages/
1497
- │ ├── teams/
1498
- │ │ ├── index.astro # Team list
1499
- │ │ ├── [id].astro # Team detail
1500
- │ │ ├── new.astro # Create team
1501
- │ │ └── [id]/
1502
- │ │ ├── edit.astro # Edit team
1503
- │ │ └── members.astro # Manage members
1504
- │ ├── auth/
1505
- │ │ ├── login.astro
1506
- │ │ ├── register.astro
1507
- │ │ └── logout.astro
1508
- │ └── api/
1509
- │ └── teams/
1510
- │ ├── index.ts # List/create teams
1511
- │ ├── [id].ts # Get/update/delete team
1512
- │ └── [id]/
1513
- │ └── members.ts # Manage members
1514
- │
1515
- ├── components/
1516
- │ ├── TeamList.tsx # Real-time team list
1517
- │ ├── TeamForm.tsx # Create/edit form
1518
- │ ├── MemberManager.tsx # Add/remove members
1519
- │ └── AuthGuard.tsx # Protected routes
1520
- │
1521
- ├── lib/
1522
- │ ├── db/
1523
- │ │ ├── schema.ts # Drizzle schema
1524
- │ │ └── client.ts # Database client
1525
- │ ├── auth/
1526
- │ │ └── config.ts # Better Auth config
1527
- │ └── services/
1528
- │ ├── teamService.ts # Effect.ts team logic
1529
- │ └── memberService.ts # Effect.ts member logic
1530
- │
1531
- └── backend/
1532
- └── src/
1533
- ├── routes/
1534
- │ └── teams.ts # Hono routes
1535
- └── server.ts # Main server
1536
- ```
1537
-
1538
- ### Database Schema (Drizzle)
1539
-
1540
- ```typescript
1541
- // src/lib/db/schema.ts
1542
- import { pgTable, uuid, varchar, timestamp, boolean, json } from "drizzle-orm/pg-core";
1543
-
1544
- export const users = pgTable("users", {
1545
- id: uuid("id").primaryKey().defaultRandom(),
1546
- email: varchar("email", { length: 255 }).notNull().unique(),
1547
- name: varchar("name", { length: 255 }).notNull(),
1548
- passwordHash: varchar("password_hash", { length: 255 }).notNull(),
1549
- createdAt: timestamp("created_at").defaultNow().notNull(),
1550
- });
1551
-
1552
- export const teams = pgTable("teams", {
1553
- id: uuid("id").primaryKey().defaultRandom(),
1554
- name: varchar("name", { length: 255 }).notNull(),
1555
- description: varchar("description", { length: 1000 }),
1556
- ownerId: uuid("owner_id").references(() => users.id).notNull(),
1557
- status: varchar("status", { length: 50 }).notNull().default("active"),
1558
- settings: json("settings").$type<Record<string, any>>(),
1559
- createdAt: timestamp("created_at").defaultNow().notNull(),
1560
- updatedAt: timestamp("updated_at").defaultNow().notNull(),
1561
- });
1562
-
1563
- export const teamMembers = pgTable("team_members", {
1564
- id: uuid("id").primaryKey().defaultRandom(),
1565
- teamId: uuid("team_id").references(() => teams.id).notNull(),
1566
- userId: uuid("user_id").references(() => users.id).notNull(),
1567
- role: varchar("role", { length: 50 }).notNull().default("member"),
1568
- joinedAt: timestamp("joined_at").defaultNow().notNull(),
1569
- });
1570
- ```
1571
-
1572
- ### Team Service (Effect.ts)
1573
-
1574
- ```typescript
1575
- // src/lib/services/teamService.ts
1576
- import { Effect, Data, Context } from "effect";
1577
- import { db } from "@/lib/db/client";
1578
- import { teams, teamMembers, users } from "@/lib/db/schema";
1579
- import { eq, and } from "drizzle-orm";
1580
-
1581
- // Tagged errors
1582
- export class TeamNotFoundError extends Data.TaggedError("TeamNotFoundError")<{
1583
- teamId: string;
1584
- }> {}
1585
-
1586
- export class UnauthorizedError extends Data.TaggedError("UnauthorizedError")<{
1587
- reason: string;
1588
- }> {}
1589
-
1590
- export class ValidationError extends Data.TaggedError("ValidationError")<{
1591
- field: string;
1592
- message: string;
1593
- }> {}
1594
-
1595
- export class DatabaseError extends Data.TaggedError("DatabaseError")<{
1596
- operation: string;
1597
- reason: string;
1598
- }> {}
1599
-
1600
- // Types
1601
- export type Team = typeof teams.$inferSelect;
1602
- export type CreateTeamInput = {
1603
- name: string;
1604
- description?: string;
1605
- ownerId: string;
1606
- };
1607
- export type UpdateTeamInput = Partial<CreateTeamInput>;
1608
-
1609
- // Database context
1610
- export interface Database {
1611
- readonly db: typeof db;
1612
- }
1613
-
1614
- export const Database = Context.GenericTag<Database>("Database");
1615
-
1616
- // Validation
1617
- export const validateTeamName = (
1618
- name: string
1619
- ): Effect.Effect<string, ValidationError> =>
1620
- Effect.gen(function* () {
1621
- if (!name?.trim()) {
1622
- return yield* new ValidationError({
1623
- field: "name",
1624
- message: "Team name is required",
1625
- });
1626
- }
1627
- if (name.length < 2) {
1628
- return yield* new ValidationError({
1629
- field: "name",
1630
- message: "Team name must be at least 2 characters",
1631
- });
1632
- }
1633
- if (name.length > 100) {
1634
- return yield* new ValidationError({
1635
- field: "name",
1636
- message: "Team name cannot exceed 100 characters",
1637
- });
1638
- }
1639
- return name.trim();
1640
- });
1641
-
1642
- // Create team
1643
- export const createTeam = (
1644
- input: CreateTeamInput
1645
- ): Effect.Effect<Team, ValidationError | DatabaseError, Database> =>
1646
- Effect.gen(function* () {
1647
- const database = yield* Database;
1648
-
1649
- // Validate input
1650
- const validName = yield* validateTeamName(input.name);
1651
-
1652
- // Insert into database
1653
- const result = yield* Effect.tryPromise({
1654
- try: async () => {
1655
- const [team] = await database.db
1656
- .insert(teams)
1657
- .values({
1658
- name: validName,
1659
- description: input.description,
1660
- ownerId: input.ownerId,
1661
- status: "active",
1662
- settings: {},
1663
- })
1664
- .returning();
1665
- return team;
1666
- },
1667
- catch: (error) =>
1668
- new DatabaseError({
1669
- operation: "createTeam",
1670
- reason: error instanceof Error ? error.message : "Unknown error",
1671
- }),
1672
- });
1673
-
1674
- return result;
1675
- });
1676
-
1677
- // Get team by ID
1678
- export const getTeamById = (
1679
- teamId: string
1680
- ): Effect.Effect<Team, TeamNotFoundError | DatabaseError, Database> =>
1681
- Effect.gen(function* () {
1682
- const database = yield* Database;
1683
-
1684
- const result = yield* Effect.tryPromise({
1685
- try: async () => {
1686
- const [team] = await database.db
1687
- .select()
1688
- .from(teams)
1689
- .where(eq(teams.id, teamId))
1690
- .limit(1);
1691
- return team;
1692
- },
1693
- catch: (error) =>
1694
- new DatabaseError({
1695
- operation: "getTeamById",
1696
- reason: error instanceof Error ? error.message : "Unknown error",
1697
- }),
1698
- });
1699
-
1700
- if (!result) {
1701
- return yield* new TeamNotFoundError({ teamId });
1702
- }
1703
-
1704
- return result;
1705
- });
1706
-
1707
- // Update team
1708
- export const updateTeam = (
1709
- teamId: string,
1710
- userId: string,
1711
- input: UpdateTeamInput
1712
- ): Effect.Effect<Team, TeamNotFoundError | UnauthorizedError | ValidationError | DatabaseError, Database> =>
1713
- Effect.gen(function* () {
1714
- const database = yield* Database;
1715
-
1716
- // Get existing team
1717
- const team = yield* getTeamById(teamId);
1718
-
1719
- // Check authorization
1720
- if (team.ownerId !== userId) {
1721
- return yield* new UnauthorizedError({
1722
- reason: "Only team owner can update team",
1723
- });
1724
- }
1725
-
1726
- // Validate input
1727
- const validName = input.name
1728
- ? yield* validateTeamName(input.name)
1729
- : team.name;
1730
-
1731
- // Update database
1732
- const result = yield* Effect.tryPromise({
1733
- try: async () => {
1734
- const [updated] = await database.db
1735
- .update(teams)
1736
- .set({
1737
- name: validName,
1738
- description: input.description ?? team.description,
1739
- updatedAt: new Date(),
1740
- })
1741
- .where(eq(teams.id, teamId))
1742
- .returning();
1743
- return updated;
1744
- },
1745
- catch: (error) =>
1746
- new DatabaseError({
1747
- operation: "updateTeam",
1748
- reason: error instanceof Error ? error.message : "Unknown error",
1749
- }),
1750
- });
1751
-
1752
- return result;
1753
- });
1754
-
1755
- // Delete team
1756
- export const deleteTeam = (
1757
- teamId: string,
1758
- userId: string
1759
- ): Effect.Effect<void, TeamNotFoundError | UnauthorizedError | DatabaseError, Database> =>
1760
- Effect.gen(function* () {
1761
- const database = yield* Database;
1762
-
1763
- // Get existing team
1764
- const team = yield* getTeamById(teamId);
1765
-
1766
- // Check authorization
1767
- if (team.ownerId !== userId) {
1768
- return yield* new UnauthorizedError({
1769
- reason: "Only team owner can delete team",
1770
- });
1771
- }
1772
-
1773
- // Delete from database
1774
- yield* Effect.tryPromise({
1775
- try: async () => {
1776
- await database.db.delete(teams).where(eq(teams.id, teamId));
1777
- },
1778
- catch: (error) =>
1779
- new DatabaseError({
1780
- operation: "deleteTeam",
1781
- reason: error instanceof Error ? error.message : "Unknown error",
1782
- }),
1783
- });
1784
- });
1785
-
1786
- // List user's teams
1787
- export const listUserTeams = (
1788
- userId: string
1789
- ): Effect.Effect<Team[], DatabaseError, Database> =>
1790
- Effect.gen(function* () {
1791
- const database = yield* Database;
1792
-
1793
- const result = yield* Effect.tryPromise({
1794
- try: async () => {
1795
- // Teams where user is owner OR member
1796
- const ownedTeams = await database.db
1797
- .select()
1798
- .from(teams)
1799
- .where(eq(teams.ownerId, userId));
1800
-
1801
- const memberTeamIds = await database.db
1802
- .select({ teamId: teamMembers.teamId })
1803
- .from(teamMembers)
1804
- .where(eq(teamMembers.userId, userId));
1805
-
1806
- const memberTeams = await database.db
1807
- .select()
1808
- .from(teams)
1809
- .where(
1810
- eq(
1811
- teams.id,
1812
- memberTeamIds.map(m => m.teamId)[0] // Simplified - should use IN clause
1813
- )
1814
- );
1815
-
1816
- // Combine and deduplicate
1817
- const allTeams = [...ownedTeams, ...memberTeams];
1818
- const uniqueTeams = Array.from(
1819
- new Map(allTeams.map(t => [t.id, t])).values()
1820
- );
1821
-
1822
- return uniqueTeams;
1823
- },
1824
- catch: (error) =>
1825
- new DatabaseError({
1826
- operation: "listUserTeams",
1827
- reason: error instanceof Error ? error.message : "Unknown error",
1828
- }),
1829
- });
1830
-
1831
- return result;
1832
- });
1833
- ```
1834
-
1835
- ### API Routes (Hono)
1836
-
1837
- ```typescript
1838
- // backend/src/routes/teams.ts
1839
- import { Hono } from "hono";
1840
- import { Effect, Context } from "effect";
1841
- import {
1842
- createTeam,
1843
- getTeamById,
1844
- updateTeam,
1845
- deleteTeam,
1846
- listUserTeams,
1847
- Database,
1848
- } from "@/lib/services/teamService";
1849
- import { db } from "@/lib/db/client";
1850
-
1851
- const app = new Hono();
1852
-
1853
- // Middleware: Provide database context
1854
- const withDatabase = <R, E, A>(
1855
- effect: Effect.Effect<A, E, Database | R>
1856
- ): Effect.Effect<A, E, R> =>
1857
- effect.pipe(
1858
- Effect.provideService(Database, { db })
1859
- );
1860
-
1861
- // GET /api/teams - List user's teams
1862
- app.get("/", async (c) => {
1863
- const userId = c.get("userId"); // From auth middleware
1864
-
1865
- const result = await Effect.runPromise(
1866
- Effect.either(withDatabase(listUserTeams(userId)))
1867
- );
1868
-
1869
- if (result._tag === "Left") {
1870
- const error = result.left;
1871
- return c.json({ error: error._tag, details: error }, 500);
1872
- }
1873
-
1874
- return c.json({ data: result.right });
1875
- });
1876
-
1877
- // POST /api/teams - Create team
1878
- app.post("/", async (c) => {
1879
- const userId = c.get("userId");
1880
- const body = await c.req.json();
1881
-
1882
- const result = await Effect.runPromise(
1883
- Effect.either(
1884
- withDatabase(
1885
- createTeam({
1886
- name: body.name,
1887
- description: body.description,
1888
- ownerId: userId,
1889
- })
1890
- )
1891
- )
1892
- );
1893
-
1894
- if (result._tag === "Left") {
1895
- const error = result.left;
1896
- const status = error._tag === "ValidationError" ? 400 : 500;
1897
- return c.json({ error: error._tag, details: error }, status);
1898
- }
1899
-
1900
- return c.json({ data: result.right }, 201);
1901
- });
1902
-
1903
- // GET /api/teams/:id - Get team
1904
- app.get("/:id", async (c) => {
1905
- const teamId = c.req.param("id");
1906
-
1907
- const result = await Effect.runPromise(
1908
- Effect.either(withDatabase(getTeamById(teamId)))
1909
- );
1910
-
1911
- if (result._tag === "Left") {
1912
- const error = result.left;
1913
- const status = error._tag === "TeamNotFoundError" ? 404 : 500;
1914
- return c.json({ error: error._tag, details: error }, status);
1915
- }
1916
-
1917
- return c.json({ data: result.right });
1918
- });
1919
-
1920
- // PATCH /api/teams/:id - Update team
1921
- app.patch("/:id", async (c) => {
1922
- const teamId = c.req.param("id");
1923
- const userId = c.get("userId");
1924
- const body = await c.req.json();
1925
-
1926
- const result = await Effect.runPromise(
1927
- Effect.either(
1928
- withDatabase(
1929
- updateTeam(teamId, userId, {
1930
- name: body.name,
1931
- description: body.description,
1932
- })
1933
- )
1934
- )
1935
- );
1936
-
1937
- if (result._tag === "Left") {
1938
- const error = result.left;
1939
- const status =
1940
- error._tag === "TeamNotFoundError"
1941
- ? 404
1942
- : error._tag === "UnauthorizedError"
1943
- ? 403
1944
- : error._tag === "ValidationError"
1945
- ? 400
1946
- : 500;
1947
- return c.json({ error: error._tag, details: error }, status);
1948
- }
1949
-
1950
- return c.json({ data: result.right });
1951
- });
1952
-
1953
- // DELETE /api/teams/:id - Delete team
1954
- app.delete("/:id", async (c) => {
1955
- const teamId = c.req.param("id");
1956
- const userId = c.get("userId");
1957
-
1958
- const result = await Effect.runPromise(
1959
- Effect.either(withDatabase(deleteTeam(teamId, userId)))
1960
- );
1961
-
1962
- if (result._tag === "Left") {
1963
- const error = result.left;
1964
- const status =
1965
- error._tag === "TeamNotFoundError"
1966
- ? 404
1967
- : error._tag === "UnauthorizedError"
1968
- ? 403
1969
- : 500;
1970
- return c.json({ error: error._tag, details: error }, status);
1971
- }
1972
-
1973
- return c.json({ success: true }, 204);
1974
- });
1975
-
1976
- export default app;
1977
- ```
1978
-
1979
- ### Team List Component
1980
-
1981
- ```tsx
1982
- // src/components/TeamList.tsx
1983
- import { useEffect, useState } from "react";
1984
- import { Card, CardHeader, CardTitle, CardContent } from "@/components/ui/card";
1985
- import { Button } from "@/components/ui/button";
1986
- import { Alert, AlertDescription } from "@/components/ui/alert";
1987
- import { Plus, Users } from "lucide-react";
1988
-
1989
- type Team = {
1990
- id: string;
1991
- name: string;
1992
- description: string | null;
1993
- status: string;
1994
- createdAt: string;
1995
- };
1996
-
1997
- export function TeamList() {
1998
- const [teams, setTeams] = useState<Team[]>([]);
1999
- const [loading, setLoading] = useState(true);
2000
- const [error, setError] = useState<string | null>(null);
2001
-
2002
- useEffect(() => {
2003
- fetchTeams();
2004
- }, []);
2005
-
2006
- const fetchTeams = async () => {
2007
- try {
2008
- const response = await fetch("/api/teams");
2009
- const json = await response.json();
2010
-
2011
- if (response.ok) {
2012
- setTeams(json.data);
2013
- } else {
2014
- setError(json.error);
2015
- }
2016
- } catch (err) {
2017
- setError("Failed to fetch teams");
2018
- } finally {
2019
- setLoading(false);
2020
- }
2021
- };
2022
-
2023
- if (loading) {
2024
- return <div>Loading teams...</div>;
2025
- }
2026
-
2027
- if (error) {
2028
- return (
2029
- <Alert variant="destructive">
2030
- <AlertDescription>{error}</AlertDescription>
2031
- </Alert>
2032
- );
2033
- }
2034
-
2035
- return (
2036
- <div className="space-y-6">
2037
- <div className="flex justify-between items-center">
2038
- <h2 className="text-2xl font-bold">Your Teams</h2>
2039
- <Button asChild>
2040
- <a href="/teams/new">
2041
- <Plus className="mr-2 h-4 w-4" />
2042
- Create Team
2043
- </a>
2044
- </Button>
2045
- </div>
2046
-
2047
- {teams.length === 0 ? (
2048
- <Card>
2049
- <CardContent className="p-12 text-center">
2050
- <Users className="h-12 w-12 mx-auto text-gray-400 mb-4" />
2051
- <p className="text-gray-500">No teams yet. Create your first team!</p>
2052
- </CardContent>
2053
- </Card>
2054
- ) : (
2055
- <div className="grid grid-cols-1 md:grid-cols-3 gap-6">
2056
- {teams.map(team => (
2057
- <a key={team.id} href={`/teams/${team.id}`}>
2058
- <Card className="hover:shadow-lg transition">
2059
- <CardHeader>
2060
- <CardTitle>{team.name}</CardTitle>
2061
- </CardHeader>
2062
- <CardContent>
2063
- <p className="text-sm text-gray-600">
2064
- {team.description || "No description"}
2065
- </p>
2066
- </CardContent>
2067
- </Card>
2068
- </a>
2069
- ))}
2070
- </div>
2071
- )}
2072
- </div>
2073
- );
2074
- }
2075
- ```
2076
-
2077
- ### Team List Page
2078
-
2079
- ```astro
2080
- ---
2081
- // src/pages/teams/index.astro
2082
- import Layout from "@/layouts/Layout.astro";
2083
- import TeamList from "@/components/TeamList.tsx";
2084
-
2085
- // Server-side auth check
2086
- const session = Astro.locals.session;
2087
- if (!session) {
2088
- return Astro.redirect("/auth/login");
2089
- }
2090
- ---
2091
-
2092
- <Layout title="Teams">
2093
- <div class="container max-w-6xl py-12">
2094
- <TeamList client:load />
2095
- </div>
2096
- </Layout>
2097
- ```
2098
-
2099
- **Layer 5 Result:** Full-stack team management app with database, authentication, type-safe API, and Effect.ts business logic.
2100
-
2101
- ---
2102
-
2103
- ## Summary: When to Use Each Layer
2104
-
2105
- | Layer | Use Case | Example |
2106
- |-------|----------|---------|
2107
- | **Layer 1** | Static content, marketing sites, docs | Blog, portfolio, documentation |
2108
- | **Layer 2** | Add validation/transformation | Product catalog, pricing calculator |
2109
- | **Layer 3** | Add client interactivity | Shopping cart, multi-step forms |
2110
- | **Layer 4** | Fetch/transform external data | Data migrations, API integrations |
2111
- | **Layer 5** | Full CRUD with auth/database | Team management, SaaS apps |
2112
-
2113
- ## Development Workflow
2114
-
2115
- ```bash
2116
- # Start with Layer 1
2117
- npm run dev
2118
-
2119
- # Add content
2120
- echo "name: My Team" > src/content/teams/myteam.yaml
2121
-
2122
- # Generate types
2123
- bunx astro sync
2124
-
2125
- # Add Layer 2 validation
2126
- # Create Effect.ts service in src/lib/services/
2127
-
2128
- # Add Layer 3 interactivity
2129
- # Create React component with client:load
2130
-
2131
- # Add Layer 4 persistence
2132
- # Set up backend API
2133
-
2134
- # Add Layer 5 full-stack
2135
- # Add database + auth
2136
- ```
2137
-
2138
- ## Key Principles
2139
-
2140
- 1. **Start simple** - Begin at Layer 1, only add complexity when needed
2141
- 2. **Type-safe everywhere** - Zod schemas → TypeScript types → Effect.ts services
2142
- 3. **Progressive enhancement** - Each layer builds on the previous
2143
- 4. **Effect.ts for logic** - All business logic uses Effect.ts for error handling
2144
- 5. **Content collections first** - Use content collections before reaching for a database
2145
-
2146
- ---
2147
-
2148
- **Built for clarity. Designed for scale. Perfect for AI agents.**