@raybase/create 0.0.1 → 0.3.3
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.
- package/LICENSE +21 -0
- package/THIRD_PARTY_NOTICES.md +38 -0
- package/assets/apple-touch-icons/0.png +0 -0
- package/assets/apple-touch-icons/1.png +0 -0
- package/assets/apple-touch-icons/2.png +0 -0
- package/assets/apple-touch-icons/3.png +0 -0
- package/assets/apple-touch-icons/4.png +0 -0
- package/assets/apple-touch-icons/5.png +0 -0
- package/assets/apple-touch-icons/6.png +0 -0
- package/assets/apple-touch-icons/7.png +0 -0
- package/assets/apple-touch-icons/8.png +0 -0
- package/assets/apple-touch-icons/9.png +0 -0
- package/assets/apple-touch-icons/A.png +0 -0
- package/assets/apple-touch-icons/B.png +0 -0
- package/assets/apple-touch-icons/C.png +0 -0
- package/assets/apple-touch-icons/D.png +0 -0
- package/assets/apple-touch-icons/E.png +0 -0
- package/assets/apple-touch-icons/F.png +0 -0
- package/assets/apple-touch-icons/G.png +0 -0
- package/assets/apple-touch-icons/H.png +0 -0
- package/assets/apple-touch-icons/I.png +0 -0
- package/assets/apple-touch-icons/J.png +0 -0
- package/assets/apple-touch-icons/K.png +0 -0
- package/assets/apple-touch-icons/L.png +0 -0
- package/assets/apple-touch-icons/M.png +0 -0
- package/assets/apple-touch-icons/N.png +0 -0
- package/assets/apple-touch-icons/O.png +0 -0
- package/assets/apple-touch-icons/P.png +0 -0
- package/assets/apple-touch-icons/Q.png +0 -0
- package/assets/apple-touch-icons/R.png +0 -0
- package/assets/apple-touch-icons/S.png +0 -0
- package/assets/apple-touch-icons/T.png +0 -0
- package/assets/apple-touch-icons/U.png +0 -0
- package/assets/apple-touch-icons/V.png +0 -0
- package/assets/apple-touch-icons/W.png +0 -0
- package/assets/apple-touch-icons/X.png +0 -0
- package/assets/apple-touch-icons/Y.png +0 -0
- package/assets/apple-touch-icons/Z.png +0 -0
- package/assets/apple-touch-icons/default.png +0 -0
- package/dist/.source-hash +1 -0
- package/dist/index.d.ts +56 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2351 -0
- package/dist/index.js.map +1 -0
- package/dist/raybase-package-ranges.d.ts +11 -0
- package/dist/raybase-package-ranges.d.ts.map +1 -0
- package/dist/raybase-package-ranges.js +11 -0
- package/dist/raybase-package-ranges.js.map +1 -0
- package/dist/source-fetch.d.ts +91 -0
- package/dist/source-fetch.d.ts.map +1 -0
- package/dist/source-fetch.js +325 -0
- package/dist/source-fetch.js.map +1 -0
- package/dist/source-hash.d.ts +2 -0
- package/dist/source-hash.d.ts.map +1 -0
- package/dist/source-hash.js +23 -0
- package/dist/source-hash.js.map +1 -0
- package/dist/starter-description.d.ts +44 -0
- package/dist/starter-description.d.ts.map +1 -0
- package/dist/starter-description.js +273 -0
- package/dist/starter-description.js.map +1 -0
- package/dist/starter-source.d.ts +43 -0
- package/dist/starter-source.d.ts.map +1 -0
- package/dist/starter-source.js +156 -0
- package/dist/starter-source.js.map +1 -0
- package/dist/store-app-apply.d.ts +27 -0
- package/dist/store-app-apply.d.ts.map +1 -0
- package/dist/store-app-apply.js +100 -0
- package/dist/store-app-apply.js.map +1 -0
- package/dist/store-app-manifest.d.ts +86 -0
- package/dist/store-app-manifest.d.ts.map +1 -0
- package/dist/store-app-manifest.js +110 -0
- package/dist/store-app-manifest.js.map +1 -0
- package/dist/store-app-registry.d.ts +30 -0
- package/dist/store-app-registry.d.ts.map +1 -0
- package/dist/store-app-registry.js +232 -0
- package/dist/store-app-registry.js.map +1 -0
- package/models/recommended.json +42 -0
- package/modules/api/templates/react-router/app/api/operations.ts +8 -0
- package/modules/api/templates/tanstack-start/src/api/operations.ts +15 -0
- package/modules/docs/templates/astro-emdash/content/docs/getting-started.mdx +13 -0
- package/modules/docs/templates/astro-emdash/content/docs/index.mdx +13 -0
- package/modules/docs/templates/astro-emdash/content/docs/mcp.mdx +11 -0
- package/modules/docs/templates/astro-emdash/content/docs/meta.json +4 -0
- package/modules/docs/templates/astro-emdash/site/content/docs/getting-started.mdx +12 -0
- package/modules/docs/templates/astro-emdash/site/content/docs/index.mdx +12 -0
- package/modules/docs/templates/astro-emdash/site/content/docs/mcp.mdx +10 -0
- package/modules/docs/templates/astro-emdash/site/content/docs/meta.json +4 -0
- package/modules/docs/templates/astro-emdash/site/source.config.ts +10 -0
- package/modules/docs/templates/astro-emdash/site/src/docs/docs-assets.ts +1 -0
- package/modules/docs/templates/astro-emdash/site/src/docs/docs-client.tsx +22 -0
- package/modules/docs/templates/astro-emdash/site/src/docs/docs-data.ts +24 -0
- package/modules/docs/templates/astro-emdash/site/src/docs/docs-handler.tsx +105 -0
- package/modules/docs/templates/astro-emdash/site/src/docs/docs-layout.tsx +56 -0
- package/modules/docs/templates/astro-emdash/site/src/docs/docs-mdx.tsx +79 -0
- package/modules/docs/templates/astro-emdash/site/src/docs/docs-page-actions.tsx +146 -0
- package/modules/docs/templates/astro-emdash/site/src/docs/docs-page.tsx +70 -0
- package/modules/docs/templates/astro-emdash/site/src/docs/llm-text.ts +61 -0
- package/modules/docs/templates/astro-emdash/site/src/docs/source.ts +7 -0
- package/modules/docs/templates/astro-emdash/site/src/pages/docs/[...slug].ts +6 -0
- package/modules/docs/templates/astro-emdash/site/src/pages/docs/api/markdown.ts +4 -0
- package/modules/docs/templates/astro-emdash/site/src/pages/docs/api/search.ts +4 -0
- package/modules/docs/templates/astro-emdash/site/src/pages/llms.txt.ts +8 -0
- package/modules/docs/templates/astro-emdash/site/src/styles-docs.css +3 -0
- package/modules/docs/templates/astro-emdash/source.config.ts +10 -0
- package/modules/docs/templates/astro-emdash/src/docs/docs-assets.ts +1 -0
- package/modules/docs/templates/astro-emdash/src/docs/docs-client.tsx +22 -0
- package/modules/docs/templates/astro-emdash/src/docs/docs-data.ts +24 -0
- package/modules/docs/templates/astro-emdash/src/docs/docs-handler.tsx +105 -0
- package/modules/docs/templates/astro-emdash/src/docs/docs-layout.tsx +56 -0
- package/modules/docs/templates/astro-emdash/src/docs/docs-mdx.tsx +79 -0
- package/modules/docs/templates/astro-emdash/src/docs/docs-page-actions.tsx +146 -0
- package/modules/docs/templates/astro-emdash/src/docs/docs-page.tsx +70 -0
- package/modules/docs/templates/astro-emdash/src/docs/llm-text.ts +61 -0
- package/modules/docs/templates/astro-emdash/src/docs/source.ts +7 -0
- package/modules/docs/templates/astro-emdash/src/routes/docs/$.tsx +22 -0
- package/modules/docs/templates/astro-emdash/src/routes/docs/api/markdown.ts +12 -0
- package/modules/docs/templates/astro-emdash/src/routes/docs/api/search.ts +12 -0
- package/modules/docs/templates/astro-emdash/src/routes/docs.index.tsx +22 -0
- package/modules/docs/templates/astro-emdash/src/routes/docs.tsx +22 -0
- package/modules/docs/templates/astro-emdash/src/styles-docs.css +3 -0
- package/modules/docs/templates/react-router/app/components/mdx.tsx +79 -0
- package/modules/docs/templates/react-router/app/lib/layout.shared.tsx +54 -0
- package/modules/docs/templates/react-router/app/lib/source.ts +7 -0
- package/modules/docs/templates/react-router/app/routes/docs.$.tsx +49 -0
- package/modules/docs/templates/react-router/app/routes/docs.api.search.ts +10 -0
- package/modules/docs/templates/react-router/app/routes/docs.tsx +13 -0
- package/modules/docs/templates/react-router/content/docs/getting-started.mdx +8 -0
- package/modules/docs/templates/react-router/content/docs/index.mdx +8 -0
- package/modules/docs/templates/react-router/content/docs/mcp.mdx +121 -0
- package/modules/docs/templates/react-router/content/docs/meta.json +4 -0
- package/modules/docs/templates/react-router/source.config.ts +5 -0
- package/modules/docs/templates/tanstack-start/content/docs/getting-started.mdx +10 -0
- package/modules/docs/templates/tanstack-start/content/docs/index.mdx +8 -0
- package/modules/docs/templates/tanstack-start/content/docs/mcp.mdx +121 -0
- package/modules/docs/templates/tanstack-start/content/docs/meta.json +4 -0
- package/modules/docs/templates/tanstack-start/source.config.ts +10 -0
- package/modules/docs/templates/tanstack-start/src/docs/docs-assets.ts +1 -0
- package/modules/docs/templates/tanstack-start/src/docs/docs-client.tsx +22 -0
- package/modules/docs/templates/tanstack-start/src/docs/docs-data.ts +24 -0
- package/modules/docs/templates/tanstack-start/src/docs/docs-handler.tsx +105 -0
- package/modules/docs/templates/tanstack-start/src/docs/docs-layout.tsx +56 -0
- package/modules/docs/templates/tanstack-start/src/docs/docs-mdx.tsx +79 -0
- package/modules/docs/templates/tanstack-start/src/docs/docs-page-actions.tsx +146 -0
- package/modules/docs/templates/tanstack-start/src/docs/docs-page.tsx +70 -0
- package/modules/docs/templates/tanstack-start/src/docs/llm-text.ts +61 -0
- package/modules/docs/templates/tanstack-start/src/docs/source.ts +7 -0
- package/modules/docs/templates/tanstack-start/src/routes/docs/$.tsx +22 -0
- package/modules/docs/templates/tanstack-start/src/routes/docs/api/markdown.ts +12 -0
- package/modules/docs/templates/tanstack-start/src/routes/docs/api/search.ts +12 -0
- package/modules/docs/templates/tanstack-start/src/routes/docs.index.tsx +22 -0
- package/modules/docs/templates/tanstack-start/src/routes/docs.tsx +22 -0
- package/modules/docs/templates/tanstack-start/src/styles-docs.css +3 -0
- package/modules/guide/templates/astro-emdash/content/guide/capability-map.md +17 -0
- package/modules/guide/templates/astro-emdash/src/components/guide-widget.tsx +41 -0
- package/modules/guide/templates/astro-emdash/src/guide/actions.ts +8 -0
- package/modules/guide/templates/astro-emdash/src/guide/config.ts +21 -0
- package/modules/guide/templates/astro-emdash/src/guide/corpus.gen.ts +4 -0
- package/modules/guide/templates/astro-emdash/src/guide/corpus.manifest.json +72 -0
- package/modules/guide/templates/astro-emdash/src/guide/corpus.ts +4 -0
- package/modules/guide/templates/astro-emdash/src/guide/resources.json +4 -0
- package/modules/guide/templates/react-router/app/components/guide-widget.tsx +29 -0
- package/modules/guide/templates/react-router/app/guide/actions.ts +3 -0
- package/modules/guide/templates/react-router/app/guide/config.ts +21 -0
- package/modules/guide/templates/react-router/app/guide/corpus.gen.ts +4 -0
- package/modules/guide/templates/react-router/app/guide/corpus.manifest.json +22 -0
- package/modules/guide/templates/react-router/app/guide/corpus.ts +4 -0
- package/modules/guide/templates/react-router/app/guide/resources.json +4 -0
- package/modules/guide/templates/react-router/content/guide/capability-map.md +13 -0
- package/modules/guide/templates/tanstack-start/content/guide/capability-map.md +17 -0
- package/modules/guide/templates/tanstack-start/src/components/guide-widget.tsx +41 -0
- package/modules/guide/templates/tanstack-start/src/guide/actions.ts +17 -0
- package/modules/guide/templates/tanstack-start/src/guide/config.ts +21 -0
- package/modules/guide/templates/tanstack-start/src/guide/corpus.gen.ts +4 -0
- package/modules/guide/templates/tanstack-start/src/guide/corpus.manifest.json +22 -0
- package/modules/guide/templates/tanstack-start/src/guide/corpus.ts +4 -0
- package/modules/guide/templates/tanstack-start/src/guide/resources.json +4 -0
- package/modules/openai-subscription/templates/astro-emdash/.agents/skills/raybase-openai-subscription/SKILL.md +57 -0
- package/modules/openai-subscription/templates/astro-emdash/.agents/skills/raybase-openai-subscription/references/compatibility-and-testing.md +129 -0
- package/modules/openai-subscription/templates/astro-emdash/.agents/skills/raybase-openai-subscription/references/module-contract.md +133 -0
- package/modules/openai-subscription/templates/astro-emdash/.agents/skills/raybase-openai-subscription/references/structured-outputs.md +159 -0
- package/modules/openai-subscription/templates/astro-emdash/src/openai-subscription.ts +11 -0
- package/modules/openai-subscription/templates/react-router/.agents/skills/raybase-openai-subscription/SKILL.md +57 -0
- package/modules/openai-subscription/templates/react-router/.agents/skills/raybase-openai-subscription/references/compatibility-and-testing.md +129 -0
- package/modules/openai-subscription/templates/react-router/.agents/skills/raybase-openai-subscription/references/module-contract.md +133 -0
- package/modules/openai-subscription/templates/react-router/.agents/skills/raybase-openai-subscription/references/structured-outputs.md +159 -0
- package/modules/openai-subscription/templates/react-router/app/openai-subscription.ts +11 -0
- package/modules/openai-subscription/templates/tanstack-start/.agents/skills/raybase-openai-subscription/SKILL.md +57 -0
- package/modules/openai-subscription/templates/tanstack-start/.agents/skills/raybase-openai-subscription/references/compatibility-and-testing.md +129 -0
- package/modules/openai-subscription/templates/tanstack-start/.agents/skills/raybase-openai-subscription/references/module-contract.md +133 -0
- package/modules/openai-subscription/templates/tanstack-start/.agents/skills/raybase-openai-subscription/references/structured-outputs.md +159 -0
- package/modules/openai-subscription/templates/tanstack-start/src/openai-subscription.ts +11 -0
- package/package.json +34 -8
- package/skills/README.md +122 -0
- package/skills/raybase-actions/SKILL.md +223 -0
- package/skills/raybase-actions/references/action-patterns.md +190 -0
- package/skills/raybase-actions/references/adapting-actions.md +93 -0
- package/skills/raybase-actions/references/testing-actions.md +48 -0
- package/skills/raybase-agent-debugging/SKILL.md +230 -0
- package/skills/raybase-ai/SKILL.md +1310 -0
- package/skills/raybase-api/SKILL.md +45 -0
- package/skills/raybase-astro-emdash/SKILL.md +143 -0
- package/skills/raybase-astro-emdash-content-model/SKILL.md +217 -0
- package/skills/raybase-astro-emdash-content-model/references/LICENSE-emdash +9 -0
- package/skills/raybase-astro-emdash-content-model/references/emdash-collections.md +265 -0
- package/skills/raybase-astro-emdash-design/LICENSE-impeccable +60 -0
- package/skills/raybase-astro-emdash-design/SKILL.md +170 -0
- package/skills/raybase-astro-emdash-design/reference/color.md +91 -0
- package/skills/raybase-astro-emdash-design/reference/copy.md +73 -0
- package/skills/raybase-astro-emdash-design/reference/direction.md +115 -0
- package/skills/raybase-astro-emdash-design/reference/imagery.md +84 -0
- package/skills/raybase-astro-emdash-design/reference/layout.md +69 -0
- package/skills/raybase-astro-emdash-design/reference/motion.md +75 -0
- package/skills/raybase-astro-emdash-design/reference/polish.md +75 -0
- package/skills/raybase-astro-emdash-design/reference/typography.md +72 -0
- package/skills/raybase-astro-emdash-galley/SKILL.md +265 -0
- package/skills/raybase-astro-emdash-migration/SKILL.md +218 -0
- package/skills/raybase-astro-emdash-migration/references/inventory-and-conversion.md +242 -0
- package/skills/raybase-astro-emdash-security-review/SKILL.md +68 -0
- package/skills/raybase-astro-emdash-theme-selection/SKILL.md +216 -0
- package/skills/raybase-auth/SKILL.md +358 -0
- package/skills/raybase-background-jobs/SKILL.md +774 -0
- package/skills/raybase-building/SKILL.md +409 -0
- package/skills/raybase-building/references/interview-and-spec.md +87 -0
- package/skills/raybase-building/references/planning-docs.md +26 -0
- package/skills/raybase-building/references/schema-and-config.md +70 -0
- package/skills/raybase-changing-a-live-app/SKILL.md +119 -0
- package/skills/raybase-data-and-policies/SKILL.md +377 -0
- package/skills/raybase-deploy/SKILL.md +136 -0
- package/skills/raybase-docs-writing/SKILL.md +119 -0
- package/skills/raybase-guide/SKILL.md +235 -0
- package/skills/raybase-mcp/SKILL.md +309 -0
- package/skills/raybase-mcp/agents/openai.yaml +4 -0
- package/skills/raybase-notifications/SKILL.md +138 -0
- package/skills/raybase-pro-migration/SKILL.md +28 -0
- package/skills/raybase-react-router/SKILL.md +241 -0
- package/skills/raybase-react-router-design/LICENSE-impeccable +60 -0
- package/skills/raybase-react-router-design/SKILL.md +135 -0
- package/skills/raybase-react-router-design/reference/color.md +87 -0
- package/skills/raybase-react-router-design/reference/copy.md +83 -0
- package/skills/raybase-react-router-design/reference/delight.md +48 -0
- package/skills/raybase-react-router-design/reference/interaction.md +91 -0
- package/skills/raybase-react-router-design/reference/layout.md +82 -0
- package/skills/raybase-react-router-design/reference/motion.md +86 -0
- package/skills/raybase-react-router-design/reference/polish.md +79 -0
- package/skills/raybase-react-router-design/reference/typography.md +71 -0
- package/skills/raybase-react-router-security-review/LICENSE +22 -0
- package/skills/raybase-react-router-security-review/SKILL.md +190 -0
- package/skills/raybase-react-router-security-review/agents/openai.yaml +4 -0
- package/skills/raybase-react-router-security-review/references/api-security.md +519 -0
- package/skills/raybase-react-router-security-review/references/authentication.md +353 -0
- package/skills/raybase-react-router-security-review/references/authorization.md +372 -0
- package/skills/raybase-react-router-security-review/references/business-logic.md +443 -0
- package/skills/raybase-react-router-security-review/references/cryptography.md +329 -0
- package/skills/raybase-react-router-security-review/references/csrf.md +398 -0
- package/skills/raybase-react-router-security-review/references/data-protection.md +378 -0
- package/skills/raybase-react-router-security-review/references/deserialization.md +410 -0
- package/skills/raybase-react-router-security-review/references/error-handling.md +436 -0
- package/skills/raybase-react-router-security-review/references/file-security.md +457 -0
- package/skills/raybase-react-router-security-review/references/injection.md +259 -0
- package/skills/raybase-react-router-security-review/references/logging.md +433 -0
- package/skills/raybase-react-router-security-review/references/misconfiguration.md +435 -0
- package/skills/raybase-react-router-security-review/references/modern-threats.md +475 -0
- package/skills/raybase-react-router-security-review/references/raybase-react-router-security.md +235 -0
- package/skills/raybase-react-router-security-review/references/ssrf.md +413 -0
- package/skills/raybase-react-router-security-review/references/supply-chain.md +405 -0
- package/skills/raybase-react-router-security-review/references/xss.md +336 -0
- package/skills/raybase-realtime/SKILL.md +158 -0
- package/skills/raybase-realtime/agents/openai.yaml +4 -0
- package/skills/raybase-schema/SKILL.md +209 -0
- package/skills/raybase-search/SKILL.md +137 -0
- package/skills/raybase-search/agents/openai.yaml +4 -0
- package/skills/raybase-settings/SKILL.md +139 -0
- package/skills/raybase-settings/agents/openai.yaml +4 -0
- package/skills/raybase-tanstack-start/SKILL.md +166 -0
- package/skills/raybase-tanstack-start-design/LICENSE-impeccable +60 -0
- package/skills/raybase-tanstack-start-design/SKILL.md +140 -0
- package/skills/raybase-tanstack-start-design/reference/color.md +80 -0
- package/skills/raybase-tanstack-start-design/reference/copy.md +83 -0
- package/skills/raybase-tanstack-start-design/reference/delight.md +48 -0
- package/skills/raybase-tanstack-start-design/reference/interaction.md +91 -0
- package/skills/raybase-tanstack-start-design/reference/layout.md +82 -0
- package/skills/raybase-tanstack-start-design/reference/motion.md +86 -0
- package/skills/raybase-tanstack-start-design/reference/polish.md +79 -0
- package/skills/raybase-tanstack-start-design/reference/typography.md +71 -0
- package/skills/raybase-tanstack-start-security-review/LICENSE +22 -0
- package/skills/raybase-tanstack-start-security-review/SKILL.md +194 -0
- package/skills/raybase-tanstack-start-security-review/agents/openai.yaml +4 -0
- package/skills/raybase-tanstack-start-security-review/references/api-security.md +519 -0
- package/skills/raybase-tanstack-start-security-review/references/authentication.md +353 -0
- package/skills/raybase-tanstack-start-security-review/references/authorization.md +372 -0
- package/skills/raybase-tanstack-start-security-review/references/business-logic.md +443 -0
- package/skills/raybase-tanstack-start-security-review/references/cryptography.md +329 -0
- package/skills/raybase-tanstack-start-security-review/references/csrf.md +398 -0
- package/skills/raybase-tanstack-start-security-review/references/data-protection.md +378 -0
- package/skills/raybase-tanstack-start-security-review/references/deserialization.md +410 -0
- package/skills/raybase-tanstack-start-security-review/references/error-handling.md +436 -0
- package/skills/raybase-tanstack-start-security-review/references/file-security.md +457 -0
- package/skills/raybase-tanstack-start-security-review/references/injection.md +259 -0
- package/skills/raybase-tanstack-start-security-review/references/logging.md +433 -0
- package/skills/raybase-tanstack-start-security-review/references/misconfiguration.md +435 -0
- package/skills/raybase-tanstack-start-security-review/references/modern-threats.md +475 -0
- package/skills/raybase-tanstack-start-security-review/references/raybase-tanstack-security.md +208 -0
- package/skills/raybase-tanstack-start-security-review/references/ssrf.md +413 -0
- package/skills/raybase-tanstack-start-security-review/references/supply-chain.md +405 -0
- package/skills/raybase-tanstack-start-security-review/references/xss.md +336 -0
- package/skills-manifest.json +41 -0
- package/templates/astro-emdash/.dev.vars.example +7 -0
- package/templates/astro-emdash/AGENTS.md +122 -0
- package/templates/astro-emdash/DESIGN.md +90 -0
- package/templates/astro-emdash/components.json +21 -0
- package/templates/astro-emdash/content/docs/getting-started.mdx +20 -0
- package/templates/astro-emdash/content/docs/index.mdx +13 -0
- package/templates/astro-emdash/content/docs/mcp.mdx +11 -0
- package/templates/astro-emdash/content/docs/meta.json +4 -0
- package/templates/astro-emdash/content/docs/site-templates.mdx +62 -0
- package/templates/astro-emdash/dev/CODEBASE-MAP.md +46 -0
- package/templates/astro-emdash/dev/SPEC-OVERVIEW.md +15 -0
- package/templates/astro-emdash/dev/SPEC.md +84 -0
- package/templates/astro-emdash/dev/features/archive/.gitkeep +1 -0
- package/templates/astro-emdash/docs/theme-previews/base.svg +24 -0
- package/templates/astro-emdash/docs/theme-previews/steel.svg +24 -0
- package/templates/astro-emdash/docs/theme-previews/zen.svg +24 -0
- package/templates/astro-emdash/docs/themes.md +106 -0
- package/templates/astro-emdash/drizzle.config.ts +5 -0
- package/templates/astro-emdash/gitignore +11 -0
- package/templates/astro-emdash/migrations/app/meta/_journal.json +5 -0
- package/templates/astro-emdash/package.json +79 -0
- package/templates/astro-emdash/pnpm-workspace.yaml +71 -0
- package/templates/astro-emdash/public/_headers +4 -0
- package/templates/astro-emdash/site/astro.config.mjs +120 -0
- package/templates/astro-emdash/site/demo/README.md +72 -0
- package/templates/astro-emdash/site/demo/content/collection.json +43 -0
- package/templates/astro-emdash/site/demo/content/entries.json +120 -0
- package/templates/astro-emdash/site/demo/templates/demo-article-card/manifest.json +51 -0
- package/templates/astro-emdash/site/demo/templates/demo-article-card/sample-content.json +5 -0
- package/templates/astro-emdash/site/demo/templates/demo-article-card/template.liquid +48 -0
- package/templates/astro-emdash/site/demo/templates/demo-article-page/host.json +9 -0
- package/templates/astro-emdash/site/demo/templates/demo-article-page/manifest.json +38 -0
- package/templates/astro-emdash/site/demo/templates/demo-article-page/sample-content.json +34 -0
- package/templates/astro-emdash/site/demo/templates/demo-article-page/template.liquid +84 -0
- package/templates/astro-emdash/site/demo/templates/demo-articles-index/manifest.json +64 -0
- package/templates/astro-emdash/site/demo/templates/demo-articles-index/page.json +7 -0
- package/templates/astro-emdash/site/demo/templates/demo-articles-index/sample-content.json +24 -0
- package/templates/astro-emdash/site/demo/templates/demo-articles-index/template.liquid +100 -0
- package/templates/astro-emdash/site/demo/templates/demo-menu-nav/manifest.json +51 -0
- package/templates/astro-emdash/site/demo/templates/demo-menu-nav/sample-content.json +5 -0
- package/templates/astro-emdash/site/demo/templates/demo-menu-nav/template.liquid +70 -0
- package/templates/astro-emdash/site/gitignore +1 -0
- package/templates/astro-emdash/site/package.json +56 -0
- package/templates/astro-emdash/site/scripts/apply-site-templates.mjs +560 -0
- package/templates/astro-emdash/site/scripts/galley-demo.mjs +298 -0
- package/templates/astro-emdash/site/scripts/seed-galley-starter.mjs +360 -0
- package/templates/astro-emdash/site/scripts/site-origin.mjs +45 -0
- package/templates/astro-emdash/site/seed/seed.json +154 -0
- package/templates/astro-emdash/site/seed/templates/.gitkeep +1 -0
- package/templates/astro-emdash/site/src/components/RaybaseSignedInMenu.astro +163 -0
- package/templates/astro-emdash/site/src/components/blocks/RaybaseActionIsland.astro +41 -0
- package/templates/astro-emdash/site/src/content-door/raybase-routes.ts +738 -0
- package/templates/astro-emdash/site/src/content-door/resolve-page.ts +142 -0
- package/templates/astro-emdash/site/src/content-door/seed.ts +85 -0
- package/templates/astro-emdash/site/src/env.d.ts +12 -0
- package/templates/astro-emdash/site/src/layouts/SiteLayout.astro +68 -0
- package/templates/astro-emdash/site/src/lib/palettes.gen.ts +7 -0
- package/templates/astro-emdash/site/src/lib/site-motion.ts +169 -0
- package/templates/astro-emdash/site/src/lib/site-shell.ts +294 -0
- package/templates/astro-emdash/site/src/live.config.ts +8 -0
- package/templates/astro-emdash/site/src/middleware.ts +20 -0
- package/templates/astro-emdash/site/src/pages/[...slug].astro +113 -0
- package/templates/astro-emdash/site/src/pages/_raybase/handoff/consume.ts +6 -0
- package/templates/astro-emdash/site/src/pages/_raybase/islands/action.ts +8 -0
- package/templates/astro-emdash/site/src/pages/_raybase/sign-out/index.ts +6 -0
- package/templates/astro-emdash/site/src/styles/palette-fonts.gen.css +1 -0
- package/templates/astro-emdash/site/src/styles/palettes.gen.css +3 -0
- package/templates/astro-emdash/site/src/styles.css +607 -0
- package/templates/astro-emdash/site/tsconfig.json +12 -0
- package/templates/astro-emdash/site/wrangler.jsonc +34 -0
- package/templates/astro-emdash/source.config.ts +10 -0
- package/templates/astro-emdash/src/actions.ts +58 -0
- package/templates/astro-emdash/src/ai/agents.ts +20 -0
- package/templates/astro-emdash/src/ai/retrieval.ts +36 -0
- package/templates/astro-emdash/src/auth-door.ts +18 -0
- package/templates/astro-emdash/src/client.tsx +25 -0
- package/templates/astro-emdash/src/components/.gitkeep +1 -0
- package/templates/astro-emdash/src/components/account-menu.tsx +91 -0
- package/templates/astro-emdash/src/components/auth-shell.tsx +69 -0
- package/templates/astro-emdash/src/components/mode-toggle.tsx +32 -0
- package/templates/astro-emdash/src/components/search-command-palette.tsx +107 -0
- package/templates/astro-emdash/src/components/setup-token-page.tsx +196 -0
- package/templates/astro-emdash/src/components/ui/avatar.tsx +107 -0
- package/templates/astro-emdash/src/components/ui/badge.tsx +52 -0
- package/templates/astro-emdash/src/components/ui/button.tsx +69 -0
- package/templates/astro-emdash/src/components/ui/checkbox.tsx +29 -0
- package/templates/astro-emdash/src/components/ui/dialog.tsx +158 -0
- package/templates/astro-emdash/src/components/ui/dropdown-menu.tsx +303 -0
- package/templates/astro-emdash/src/components/ui/input.tsx +20 -0
- package/templates/astro-emdash/src/components/ui/label.tsx +20 -0
- package/templates/astro-emdash/src/components/ui/scroll-area.tsx +53 -0
- package/templates/astro-emdash/src/components/ui/select.tsx +215 -0
- package/templates/astro-emdash/src/components/ui/separator.tsx +23 -0
- package/templates/astro-emdash/src/components/ui/sheet.tsx +138 -0
- package/templates/astro-emdash/src/components/ui/sidebar.tsx +728 -0
- package/templates/astro-emdash/src/components/ui/skeleton.tsx +13 -0
- package/templates/astro-emdash/src/components/ui/textarea.tsx +18 -0
- package/templates/astro-emdash/src/components/ui/tooltip.tsx +66 -0
- package/templates/astro-emdash/src/db/migrations.gen.ts +6 -0
- package/templates/astro-emdash/src/db/schema.ts +6 -0
- package/templates/astro-emdash/src/db/seed.ts +16 -0
- package/templates/astro-emdash/src/db/storage.ts +32 -0
- package/templates/astro-emdash/src/docs/docs-assets.ts +1 -0
- package/templates/astro-emdash/src/docs/docs-client.tsx +22 -0
- package/templates/astro-emdash/src/docs/docs-data.ts +24 -0
- package/templates/astro-emdash/src/docs/docs-handler.tsx +105 -0
- package/templates/astro-emdash/src/docs/docs-layout.tsx +56 -0
- package/templates/astro-emdash/src/docs/docs-mdx.tsx +79 -0
- package/templates/astro-emdash/src/docs/docs-page-actions.tsx +146 -0
- package/templates/astro-emdash/src/docs/docs-page.tsx +70 -0
- package/templates/astro-emdash/src/docs/llm-text.ts +61 -0
- package/templates/astro-emdash/src/docs/source.ts +7 -0
- package/templates/astro-emdash/src/guide/corpus.gen.ts +4 -0
- package/templates/astro-emdash/src/guide/corpus.manifest.json +72 -0
- package/templates/astro-emdash/src/hooks/use-mobile.ts +19 -0
- package/templates/astro-emdash/src/jobs.example.ts +48 -0
- package/templates/astro-emdash/src/lib/account.ts +12 -0
- package/templates/astro-emdash/src/lib/auth-client.ts +181 -0
- package/templates/astro-emdash/src/lib/utils.ts +6 -0
- package/templates/astro-emdash/src/mcp-app.ts +57 -0
- package/templates/astro-emdash/src/notifications.example.ts +37 -0
- package/templates/astro-emdash/src/raybase.auth.ts +70 -0
- package/templates/astro-emdash/src/raybase.config.ts +49 -0
- package/templates/astro-emdash/src/raybase.server.ts +56 -0
- package/templates/astro-emdash/src/realtime.example.ts +18 -0
- package/templates/astro-emdash/src/router.tsx +19 -0
- package/templates/astro-emdash/src/routes/__root.tsx +56 -0
- package/templates/astro-emdash/src/routes/_app/admin.tsx +13 -0
- package/templates/astro-emdash/src/routes/_app/forgot-password.tsx +97 -0
- package/templates/astro-emdash/src/routes/_app/index.tsx +169 -0
- package/templates/astro-emdash/src/routes/_app/invite.$token.tsx +11 -0
- package/templates/astro-emdash/src/routes/_app/login.tsx +193 -0
- package/templates/astro-emdash/src/routes/_app/profile.tsx +98 -0
- package/templates/astro-emdash/src/routes/_app/reset-password.$token.tsx +15 -0
- package/templates/astro-emdash/src/routes/_app/reset-password.tsx +115 -0
- package/templates/astro-emdash/src/routes/_app/setup.$token.tsx +11 -0
- package/templates/astro-emdash/src/routes/_app/signup.tsx +141 -0
- package/templates/astro-emdash/src/routes/_app/verify-email.$token.tsx +15 -0
- package/templates/astro-emdash/src/routes/_app/verify-email.tsx +154 -0
- package/templates/astro-emdash/src/routes/_app.tsx +33 -0
- package/templates/astro-emdash/src/routes/admin/$.ts +20 -0
- package/templates/astro-emdash/src/routes/api/$.ts +19 -0
- package/templates/astro-emdash/src/routes/docs/$.tsx +22 -0
- package/templates/astro-emdash/src/routes/docs/api/markdown.ts +12 -0
- package/templates/astro-emdash/src/routes/docs/api/search.ts +12 -0
- package/templates/astro-emdash/src/routes/docs.index.tsx +22 -0
- package/templates/astro-emdash/src/routes/docs.tsx +22 -0
- package/templates/astro-emdash/src/search.ts +6 -0
- package/templates/astro-emdash/src/settings.ts +12 -0
- package/templates/astro-emdash/src/styles-docs.css +3 -0
- package/templates/astro-emdash/src/styles.css +101 -0
- package/templates/astro-emdash/src/themes/base.css +76 -0
- package/templates/astro-emdash/src/themes/carbon.css +76 -0
- package/templates/astro-emdash/src/themes/fonts.css +25 -0
- package/templates/astro-emdash/src/themes/sage.css +76 -0
- package/templates/astro-emdash/src/themes/sand.css +76 -0
- package/templates/astro-emdash/src/themes/slate.css +81 -0
- package/templates/astro-emdash/src/themes/ultra.css +76 -0
- package/templates/astro-emdash/src/themes/zen.css +76 -0
- package/templates/astro-emdash/src/worker-entry.ts +31 -0
- package/templates/astro-emdash/tests/raybase-patterns.test.ts +29 -0
- package/templates/astro-emdash/tsconfig.json +36 -0
- package/templates/astro-emdash/vite.config.ts +130 -0
- package/templates/astro-emdash/vitest.config.ts +8 -0
- package/templates/astro-emdash/wrangler.jsonc +112 -0
- package/templates/react-router/.dev.vars.example +5 -0
- package/templates/react-router/.editorconfig +15 -0
- package/templates/react-router/AGENTS.md +54 -0
- package/templates/react-router/README.md +52 -0
- package/templates/react-router/app/app.css +44 -0
- package/templates/react-router/app/components/mdx.tsx +79 -0
- package/templates/react-router/app/components/ui/button.tsx +45 -0
- package/templates/react-router/app/components/ui/card.tsx +87 -0
- package/templates/react-router/app/components/ui/separator.tsx +22 -0
- package/templates/react-router/app/db/migrations.gen.ts +6 -0
- package/templates/react-router/app/db/schema.ts +56 -0
- package/templates/react-router/app/db/seed.ts +14 -0
- package/templates/react-router/app/entry.server.tsx +41 -0
- package/templates/react-router/app/globals.d.ts +1 -0
- package/templates/react-router/app/lib/layout.shared.tsx +52 -0
- package/templates/react-router/app/lib/source.ts +7 -0
- package/templates/react-router/app/lib/utils.ts +6 -0
- package/templates/react-router/app/raybase.server.ts +65 -0
- package/templates/react-router/app/root.tsx +23 -0
- package/templates/react-router/app/routes/_index.tsx +53 -0
- package/templates/react-router/app/routes/docs.$.tsx +49 -0
- package/templates/react-router/app/routes/docs.api.search.ts +10 -0
- package/templates/react-router/app/routes/docs.tsx +13 -0
- package/templates/react-router/app/routes.ts +3 -0
- package/templates/react-router/components.json +22 -0
- package/templates/react-router/content/docs/getting-started.mdx +15 -0
- package/templates/react-router/content/docs/index.mdx +8 -0
- package/templates/react-router/content/docs/mcp.mdx +121 -0
- package/templates/react-router/content/docs/meta.json +4 -0
- package/templates/react-router/dev/CODEBASE-MAP.md +48 -0
- package/templates/react-router/dev/SPEC-OVERVIEW.md +35 -0
- package/templates/react-router/dev/SPEC.md +93 -0
- package/templates/react-router/dev/features/archive/.gitkeep +1 -0
- package/templates/react-router/drizzle.config.ts +5 -0
- package/templates/react-router/env.d.ts +53 -0
- package/templates/react-router/gitignore +23 -0
- package/templates/react-router/migrations/app/meta/_journal.json +1 -0
- package/templates/react-router/package.json +70 -0
- package/templates/react-router/public/_headers +4 -0
- package/templates/react-router/public/favicon.ico +0 -0
- package/templates/react-router/react-router.config.ts +9 -0
- package/templates/react-router/source.config.ts +5 -0
- package/templates/react-router/tests/raybase-patterns.test.ts +23 -0
- package/templates/react-router/tsconfig.json +27 -0
- package/templates/react-router/vite.config.ts +59 -0
- package/templates/react-router/vitest.config.ts +8 -0
- package/templates/react-router/workers/app.ts +40 -0
- package/templates/react-router/wrangler.jsonc +111 -0
- package/templates/tanstack-start/.dev.vars.example +5 -0
- package/templates/tanstack-start/AGENTS.md +95 -0
- package/templates/tanstack-start/DESIGN.md +65 -0
- package/templates/tanstack-start/components.json +21 -0
- package/templates/tanstack-start/content/docs/getting-started.mdx +65 -0
- package/templates/tanstack-start/content/docs/index.mdx +10 -0
- package/templates/tanstack-start/content/docs/mcp.mdx +122 -0
- package/templates/tanstack-start/content/docs/meta.json +4 -0
- package/templates/tanstack-start/dev/CODEBASE-MAP.md +84 -0
- package/templates/tanstack-start/dev/SPEC-OVERVIEW.md +46 -0
- package/templates/tanstack-start/dev/SPEC.md +213 -0
- package/templates/tanstack-start/dev/features/archive/.gitkeep +1 -0
- package/templates/tanstack-start/docs/theme-previews/base.svg +24 -0
- package/templates/tanstack-start/docs/theme-previews/steel.svg +24 -0
- package/templates/tanstack-start/docs/theme-previews/zen.svg +24 -0
- package/templates/tanstack-start/docs/themes.md +116 -0
- package/templates/tanstack-start/drizzle.config.ts +5 -0
- package/templates/tanstack-start/gitignore +11 -0
- package/templates/tanstack-start/migrations/app/0000_low_karen_page.sql +26 -0
- package/templates/tanstack-start/migrations/app/meta/0000_snapshot.json +196 -0
- package/templates/tanstack-start/migrations/app/meta/_journal.json +13 -0
- package/templates/tanstack-start/package.json +77 -0
- package/templates/tanstack-start/public/_headers +8 -0
- package/templates/tanstack-start/public/icons/app-icon-maskable.svg +1 -0
- package/templates/tanstack-start/public/icons/app-icon.svg +1 -0
- package/templates/tanstack-start/public/icons/apple-touch-icon.png +0 -0
- package/templates/tanstack-start/public/manifest.webmanifest +14 -0
- package/templates/tanstack-start/public/raybase-push-sw.js +32 -0
- package/templates/tanstack-start/source.config.ts +10 -0
- package/templates/tanstack-start/src/actions.ts +560 -0
- package/templates/tanstack-start/src/ai/agents.ts +78 -0
- package/templates/tanstack-start/src/ai/retrieval.ts +36 -0
- package/templates/tanstack-start/src/auth-door.ts +18 -0
- package/templates/tanstack-start/src/client.tsx +25 -0
- package/templates/tanstack-start/src/components/.gitkeep +1 -0
- package/templates/tanstack-start/src/components/account-menu.tsx +127 -0
- package/templates/tanstack-start/src/components/auth-shell.tsx +69 -0
- package/templates/tanstack-start/src/components/install-app.tsx +35 -0
- package/templates/tanstack-start/src/components/mode-toggle.tsx +32 -0
- package/templates/tanstack-start/src/components/search-command-palette.tsx +107 -0
- package/templates/tanstack-start/src/components/setup-token-page.tsx +197 -0
- package/templates/tanstack-start/src/components/ui/avatar.tsx +107 -0
- package/templates/tanstack-start/src/components/ui/badge.tsx +52 -0
- package/templates/tanstack-start/src/components/ui/button.tsx +69 -0
- package/templates/tanstack-start/src/components/ui/checkbox.tsx +29 -0
- package/templates/tanstack-start/src/components/ui/dialog.tsx +158 -0
- package/templates/tanstack-start/src/components/ui/dropdown-menu.tsx +303 -0
- package/templates/tanstack-start/src/components/ui/input.tsx +20 -0
- package/templates/tanstack-start/src/components/ui/label.tsx +20 -0
- package/templates/tanstack-start/src/components/ui/scroll-area.tsx +53 -0
- package/templates/tanstack-start/src/components/ui/select.tsx +215 -0
- package/templates/tanstack-start/src/components/ui/separator.tsx +23 -0
- package/templates/tanstack-start/src/components/ui/sheet.tsx +138 -0
- package/templates/tanstack-start/src/components/ui/sidebar.tsx +728 -0
- package/templates/tanstack-start/src/components/ui/skeleton.tsx +13 -0
- package/templates/tanstack-start/src/components/ui/textarea.tsx +18 -0
- package/templates/tanstack-start/src/components/ui/tooltip.tsx +66 -0
- package/templates/tanstack-start/src/db/migrations.gen.ts +6 -0
- package/templates/tanstack-start/src/db/schema.ts +90 -0
- package/templates/tanstack-start/src/db/seed.ts +106 -0
- package/templates/tanstack-start/src/db/storage.ts +32 -0
- package/templates/tanstack-start/src/docs/docs-assets.ts +1 -0
- package/templates/tanstack-start/src/docs/docs-client.tsx +22 -0
- package/templates/tanstack-start/src/docs/docs-data.ts +24 -0
- package/templates/tanstack-start/src/docs/docs-handler.tsx +105 -0
- package/templates/tanstack-start/src/docs/docs-layout.tsx +56 -0
- package/templates/tanstack-start/src/docs/docs-mdx.tsx +79 -0
- package/templates/tanstack-start/src/docs/docs-page-actions.tsx +146 -0
- package/templates/tanstack-start/src/docs/docs-page.tsx +70 -0
- package/templates/tanstack-start/src/docs/llm-text.ts +61 -0
- package/templates/tanstack-start/src/docs/source.ts +7 -0
- package/templates/tanstack-start/src/hooks/use-mobile.ts +19 -0
- package/templates/tanstack-start/src/hooks/use-pwa-install.ts +77 -0
- package/templates/tanstack-start/src/jobs.example.ts +56 -0
- package/templates/tanstack-start/src/lib/account.ts +13 -0
- package/templates/tanstack-start/src/lib/auth-client.ts +187 -0
- package/templates/tanstack-start/src/lib/push-client.ts +98 -0
- package/templates/tanstack-start/src/lib/utils.ts +6 -0
- package/templates/tanstack-start/src/mcp-app.ts +74 -0
- package/templates/tanstack-start/src/notifications.example.ts +37 -0
- package/templates/tanstack-start/src/raybase.auth.ts +86 -0
- package/templates/tanstack-start/src/raybase.config.ts +86 -0
- package/templates/tanstack-start/src/raybase.server.ts +155 -0
- package/templates/tanstack-start/src/realtime.example.ts +46 -0
- package/templates/tanstack-start/src/router.tsx +19 -0
- package/templates/tanstack-start/src/routes/__root.tsx +73 -0
- package/templates/tanstack-start/src/routes/_app/admin.tsx +13 -0
- package/templates/tanstack-start/src/routes/_app/forgot-password.tsx +97 -0
- package/templates/tanstack-start/src/routes/_app/index.tsx +1316 -0
- package/templates/tanstack-start/src/routes/_app/invite.$token.tsx +11 -0
- package/templates/tanstack-start/src/routes/_app/login.tsx +193 -0
- package/templates/tanstack-start/src/routes/_app/profile.tsx +98 -0
- package/templates/tanstack-start/src/routes/_app/reset-password.$token.tsx +16 -0
- package/templates/tanstack-start/src/routes/_app/reset-password.tsx +115 -0
- package/templates/tanstack-start/src/routes/_app/setup.$token.tsx +11 -0
- package/templates/tanstack-start/src/routes/_app/signup.tsx +141 -0
- package/templates/tanstack-start/src/routes/_app/verify-email.$token.tsx +15 -0
- package/templates/tanstack-start/src/routes/_app/verify-email.tsx +154 -0
- package/templates/tanstack-start/src/routes/_app.tsx +33 -0
- package/templates/tanstack-start/src/routes/admin/$.ts +20 -0
- package/templates/tanstack-start/src/routes/api/$.ts +19 -0
- package/templates/tanstack-start/src/routes/docs/$.tsx +22 -0
- package/templates/tanstack-start/src/routes/docs/api/markdown.ts +12 -0
- package/templates/tanstack-start/src/routes/docs/api/search.ts +12 -0
- package/templates/tanstack-start/src/routes/docs.index.tsx +22 -0
- package/templates/tanstack-start/src/routes/docs.tsx +22 -0
- package/templates/tanstack-start/src/search.ts +26 -0
- package/templates/tanstack-start/src/settings.ts +12 -0
- package/templates/tanstack-start/src/styles-docs.css +3 -0
- package/templates/tanstack-start/src/styles.css +73 -0
- package/templates/tanstack-start/src/themes/base.css +76 -0
- package/templates/tanstack-start/src/themes/carbon.css +76 -0
- package/templates/tanstack-start/src/themes/fonts.css +18 -0
- package/templates/tanstack-start/src/themes/sage.css +76 -0
- package/templates/tanstack-start/src/themes/sand.css +76 -0
- package/templates/tanstack-start/src/themes/slate.css +76 -0
- package/templates/tanstack-start/src/themes/ultra.css +76 -0
- package/templates/tanstack-start/src/themes/zen.css +76 -0
- package/templates/tanstack-start/src/worker-entry.ts +30 -0
- package/templates/tanstack-start/tests/raybase-patterns.test.ts +247 -0
- package/templates/tanstack-start/tsconfig.json +33 -0
- package/templates/tanstack-start/vite.config.ts +132 -0
- package/templates/tanstack-start/vitest.config.ts +8 -0
- package/templates/tanstack-start/wrangler.jsonc +112 -0
- package/README.md +0 -3
|
@@ -0,0 +1,560 @@
|
|
|
1
|
+
import { actionError, defineAction, defineActions, getAppUserById, listAppUsers, role } from "@raybase/core";
|
|
2
|
+
import type { RaybaseActionContext } from "@raybase/core";
|
|
3
|
+
import type { RaybaseEnv } from "@raybase/core/worker";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import type { schema } from "./db/schema";
|
|
6
|
+
import { appRoles } from "./raybase.config";
|
|
7
|
+
|
|
8
|
+
type AppActionContext = RaybaseActionContext<RaybaseEnv, typeof schema>;
|
|
9
|
+
|
|
10
|
+
const projectStatusSchema = z.enum(["active", "paused", "done"]);
|
|
11
|
+
const todoStatusSchema = z.enum(["todo", "doing", "done"]);
|
|
12
|
+
const prioritySchema = z.enum(["low", "medium", "high"]);
|
|
13
|
+
const nullableString = z.string().nullable();
|
|
14
|
+
const optionalText = z.string().trim().max(2000).optional();
|
|
15
|
+
const optionalNullableText = z.string().trim().max(2000).nullable().optional();
|
|
16
|
+
const optionalDate = z.string().regex(/^\d{4}-\d{2}-\d{2}$/).nullable().optional();
|
|
17
|
+
const optionalUserId = z.string().min(1).nullable().optional();
|
|
18
|
+
|
|
19
|
+
const userSummarySchema = z.object({
|
|
20
|
+
id: z.string(),
|
|
21
|
+
name: z.string(),
|
|
22
|
+
email: z.string().email().or(z.string()),
|
|
23
|
+
roles: z.array(z.string()),
|
|
24
|
+
disabled: z.boolean().optional()
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const projectSummarySchema = z.object({
|
|
28
|
+
id: z.string(),
|
|
29
|
+
name: z.string(),
|
|
30
|
+
description: nullableString,
|
|
31
|
+
status: projectStatusSchema,
|
|
32
|
+
archivedAt: nullableString,
|
|
33
|
+
createdBy: z.string()
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const todoSummarySchema = z.object({
|
|
37
|
+
id: z.string(),
|
|
38
|
+
projectId: z.string(),
|
|
39
|
+
projectName: nullableString,
|
|
40
|
+
title: z.string(),
|
|
41
|
+
notes: nullableString,
|
|
42
|
+
status: todoStatusSchema,
|
|
43
|
+
priority: prioritySchema,
|
|
44
|
+
assigneeId: nullableString,
|
|
45
|
+
assigneeName: nullableString,
|
|
46
|
+
dueDate: nullableString,
|
|
47
|
+
archivedAt: nullableString,
|
|
48
|
+
createdBy: z.string()
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const projectOutputSchema = z.object({ project: projectSummarySchema });
|
|
52
|
+
const todoOutputSchema = z.object({ todo: todoSummarySchema });
|
|
53
|
+
|
|
54
|
+
function isManager(ctx: AppActionContext): boolean {
|
|
55
|
+
return Boolean(ctx.user?.appRoles?.includes("manager"));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function currentUser(ctx: AppActionContext) {
|
|
59
|
+
return {
|
|
60
|
+
id: ctx.user?.id ?? "",
|
|
61
|
+
name: ctx.user?.name ?? "User",
|
|
62
|
+
email: ctx.user?.email ?? "",
|
|
63
|
+
roles: ctx.user?.appRoles ?? ["user"]
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function nowIso(): string {
|
|
68
|
+
return new Date().toISOString();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function normalizeNullableText(value: string | null | undefined): string | null | undefined {
|
|
72
|
+
if (value === undefined) return undefined;
|
|
73
|
+
if (value === null) return null;
|
|
74
|
+
const trimmed = value.trim();
|
|
75
|
+
return trimmed.length ? trimmed : null;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function activeFilter(showArchived?: boolean) {
|
|
79
|
+
return showArchived ? undefined : { archivedAt: { op: "eq", value: null } as const };
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
async function visibleProjects(ctx: AppActionContext, options: { showArchived?: boolean; limit?: number } = {}) {
|
|
83
|
+
const result = await ctx.db.list("projects", {
|
|
84
|
+
...(activeFilter(options.showArchived) ? { filter: activeFilter(options.showArchived) } : {}),
|
|
85
|
+
sort: { column: "updatedAt", direction: "desc" },
|
|
86
|
+
limit: options.limit ?? 100
|
|
87
|
+
});
|
|
88
|
+
return result.rows;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
async function visibleTodos(ctx: AppActionContext, options: { showArchived?: boolean; limit?: number } = {}) {
|
|
92
|
+
const result = await ctx.db.list("todos", {
|
|
93
|
+
...(activeFilter(options.showArchived) ? { filter: activeFilter(options.showArchived) } : {}),
|
|
94
|
+
sort: { column: "dueDate", direction: "asc" },
|
|
95
|
+
limit: options.limit ?? 200
|
|
96
|
+
});
|
|
97
|
+
return result.rows;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
async function userNames(ctx: AppActionContext, ids: Array<string | null | undefined>): Promise<Map<string, string>> {
|
|
101
|
+
const unique = Array.from(new Set(ids.filter((id): id is string => typeof id === "string" && id.length > 0)));
|
|
102
|
+
const names = new Map<string, string>();
|
|
103
|
+
if (!ctx.control || unique.length === 0) return names;
|
|
104
|
+
await Promise.all(
|
|
105
|
+
unique.map(async (id) => {
|
|
106
|
+
const user = await getAppUserById(ctx.control!, id).catch(() => null);
|
|
107
|
+
if (user) names.set(id, user.name || user.email || id);
|
|
108
|
+
})
|
|
109
|
+
);
|
|
110
|
+
return names;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function summarizeProject(project: Record<string, unknown>) {
|
|
114
|
+
return {
|
|
115
|
+
id: String(project.id),
|
|
116
|
+
name: String(project.name ?? ""),
|
|
117
|
+
description: typeof project.description === "string" ? project.description : null,
|
|
118
|
+
status: project.status as "active" | "paused" | "done",
|
|
119
|
+
archivedAt: typeof project.archivedAt === "string" ? project.archivedAt : null,
|
|
120
|
+
createdBy: String(project.createdBy ?? "")
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function summarizeTodo(todo: Record<string, unknown>, projectById = new Map<string, { name: string }>(), userNameById = new Map<string, string>()) {
|
|
125
|
+
const projectId = String(todo.projectId ?? "");
|
|
126
|
+
const assigneeId = typeof todo.assigneeId === "string" ? todo.assigneeId : null;
|
|
127
|
+
return {
|
|
128
|
+
id: String(todo.id),
|
|
129
|
+
projectId,
|
|
130
|
+
projectName: projectById.get(projectId)?.name ?? null,
|
|
131
|
+
title: String(todo.title ?? ""),
|
|
132
|
+
notes: typeof todo.notes === "string" ? todo.notes : null,
|
|
133
|
+
status: todo.status as "todo" | "doing" | "done",
|
|
134
|
+
priority: todo.priority as "low" | "medium" | "high",
|
|
135
|
+
assigneeId,
|
|
136
|
+
assigneeName: assigneeId ? userNameById.get(assigneeId) ?? null : null,
|
|
137
|
+
dueDate: typeof todo.dueDate === "string" ? todo.dueDate : null,
|
|
138
|
+
archivedAt: typeof todo.archivedAt === "string" ? todo.archivedAt : null,
|
|
139
|
+
createdBy: String(todo.createdBy ?? "")
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
async function assertProjectVisible(ctx: AppActionContext, projectId: string) {
|
|
144
|
+
const project = await ctx.db.get("projects", projectId);
|
|
145
|
+
if (!project) {
|
|
146
|
+
throw actionError("Project not found or not visible.", {
|
|
147
|
+
code: "project_not_found",
|
|
148
|
+
status: 404,
|
|
149
|
+
guidance: "Choose a project from the visible project list."
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
return project;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
async function assertTodoVisible(ctx: AppActionContext, id: string) {
|
|
156
|
+
const todo = await ctx.db.get("todos", id);
|
|
157
|
+
if (!todo) {
|
|
158
|
+
throw actionError("Task not found or not visible.", {
|
|
159
|
+
code: "todo_not_found",
|
|
160
|
+
status: 404,
|
|
161
|
+
guidance: "Choose a task from the visible task list."
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
return todo;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
async function resolveAssignee(ctx: AppActionContext, assigneeId: string | null | undefined, options: { defaultToSelf?: boolean } = {}): Promise<string | null | undefined> {
|
|
168
|
+
if (assigneeId === undefined) return options.defaultToSelf ? ctx.user?.id ?? null : undefined;
|
|
169
|
+
if (assigneeId === null) {
|
|
170
|
+
if (!isManager(ctx)) {
|
|
171
|
+
throw actionError("Only managers can leave a task unassigned.", {
|
|
172
|
+
code: "assignment_denied",
|
|
173
|
+
status: 403,
|
|
174
|
+
guidance: "Assign the task to yourself or ask a manager to leave it unassigned."
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
return null;
|
|
178
|
+
}
|
|
179
|
+
if (!isManager(ctx) && assigneeId !== ctx.user?.id) {
|
|
180
|
+
throw actionError("Users can only assign tasks to themselves.", {
|
|
181
|
+
code: "assignment_denied",
|
|
182
|
+
status: 403,
|
|
183
|
+
guidance: "Assign the task to yourself or ask a manager to assign it to someone else."
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
if (ctx.control) {
|
|
187
|
+
const user = await getAppUserById(ctx.control, assigneeId);
|
|
188
|
+
if (!user) {
|
|
189
|
+
throw actionError("Assignee not found.", {
|
|
190
|
+
code: "assignee_not_found",
|
|
191
|
+
status: 404,
|
|
192
|
+
guidance: "Choose an active user from the assignable user list."
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return assigneeId;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export const actions = defineActions<RaybaseEnv, typeof schema>({
|
|
200
|
+
workspaceSnapshot: defineAction({
|
|
201
|
+
name: "workspace.snapshot",
|
|
202
|
+
description: "Read visible projects, tasks, archive counts, and the signed-in user's role context.",
|
|
203
|
+
input: z.object({ showArchived: z.boolean().optional() }).strict(),
|
|
204
|
+
output: z.object({
|
|
205
|
+
currentUser: userSummarySchema.extend({ isManager: z.boolean(), visibilityLabel: z.string() }),
|
|
206
|
+
counts: z.object({
|
|
207
|
+
projects: z.number(),
|
|
208
|
+
todos: z.number(),
|
|
209
|
+
activeProjects: z.number(),
|
|
210
|
+
archivedProjects: z.number(),
|
|
211
|
+
openTodos: z.number(),
|
|
212
|
+
doneTodos: z.number(),
|
|
213
|
+
archivedTodos: z.number(),
|
|
214
|
+
highPriorityTodos: z.number()
|
|
215
|
+
}),
|
|
216
|
+
projects: z.array(projectSummarySchema),
|
|
217
|
+
todos: z.array(todoSummarySchema)
|
|
218
|
+
}),
|
|
219
|
+
policy: role(appRoles, "user"),
|
|
220
|
+
annotations: { title: "Workspace snapshot", readOnlyHint: true },
|
|
221
|
+
resource: { name: "workspace", operation: "read" },
|
|
222
|
+
effects: [],
|
|
223
|
+
handler: async (ctx, input) => {
|
|
224
|
+
const [projects, todos] = await Promise.all([
|
|
225
|
+
visibleProjects(ctx, { showArchived: true }),
|
|
226
|
+
visibleTodos(ctx, { showArchived: true })
|
|
227
|
+
]);
|
|
228
|
+
const projectById = new Map(projects.map((project) => [project.id, { name: project.name }]));
|
|
229
|
+
const userNameById = await userNames(ctx, todos.map((todo) => todo.assigneeId));
|
|
230
|
+
const summarizedProjects = projects.map(summarizeProject);
|
|
231
|
+
const summarizedTodos = todos.map((todo) => summarizeTodo(todo, projectById, userNameById));
|
|
232
|
+
const shownProjects = input.showArchived ? summarizedProjects : summarizedProjects.filter((project) => !project.archivedAt);
|
|
233
|
+
const shownTodos = input.showArchived ? summarizedTodos : summarizedTodos.filter((todo) => !todo.archivedAt);
|
|
234
|
+
return {
|
|
235
|
+
currentUser: {
|
|
236
|
+
...currentUser(ctx),
|
|
237
|
+
isManager: isManager(ctx),
|
|
238
|
+
visibilityLabel: isManager(ctx) ? "All team tasks" : "Your tasks"
|
|
239
|
+
},
|
|
240
|
+
counts: {
|
|
241
|
+
projects: summarizedProjects.length,
|
|
242
|
+
todos: summarizedTodos.length,
|
|
243
|
+
activeProjects: summarizedProjects.filter((project) => !project.archivedAt).length,
|
|
244
|
+
archivedProjects: summarizedProjects.filter((project) => project.archivedAt).length,
|
|
245
|
+
openTodos: summarizedTodos.filter((todo) => !todo.archivedAt && todo.status !== "done").length,
|
|
246
|
+
doneTodos: summarizedTodos.filter((todo) => !todo.archivedAt && todo.status === "done").length,
|
|
247
|
+
archivedTodos: summarizedTodos.filter((todo) => todo.archivedAt).length,
|
|
248
|
+
highPriorityTodos: summarizedTodos.filter((todo) => !todo.archivedAt && todo.priority === "high").length
|
|
249
|
+
},
|
|
250
|
+
projects: shownProjects,
|
|
251
|
+
todos: shownTodos
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
}),
|
|
255
|
+
|
|
256
|
+
listVisibleProjects: defineAction({
|
|
257
|
+
name: "projects.list_visible",
|
|
258
|
+
description: "List visible projects with archive and workflow status.",
|
|
259
|
+
input: z.object({ showArchived: z.boolean().optional() }).strict(),
|
|
260
|
+
output: z.object({ total: z.number(), projects: z.array(projectSummarySchema) }),
|
|
261
|
+
policy: role(appRoles, "user"),
|
|
262
|
+
annotations: { title: "List visible projects", readOnlyHint: true },
|
|
263
|
+
resource: { name: "projects", operation: "list" },
|
|
264
|
+
effects: [],
|
|
265
|
+
handler: async (ctx, input) => {
|
|
266
|
+
const projects = await visibleProjects(ctx, { showArchived: input.showArchived });
|
|
267
|
+
const summarized = projects.map(summarizeProject);
|
|
268
|
+
return { total: summarized.length, projects: summarized };
|
|
269
|
+
}
|
|
270
|
+
}),
|
|
271
|
+
|
|
272
|
+
listVisibleTodos: defineAction({
|
|
273
|
+
name: "todos.list_visible",
|
|
274
|
+
description: "List visible tasks with project and assignment context.",
|
|
275
|
+
input: z.object({ showArchived: z.boolean().optional() }).strict(),
|
|
276
|
+
output: z.object({ total: z.number(), todos: z.array(todoSummarySchema) }),
|
|
277
|
+
policy: role(appRoles, "user"),
|
|
278
|
+
annotations: { title: "List visible tasks", readOnlyHint: true },
|
|
279
|
+
resource: { name: "todos", operation: "list" },
|
|
280
|
+
effects: [],
|
|
281
|
+
handler: async (ctx, input) => {
|
|
282
|
+
const [projects, todos] = await Promise.all([
|
|
283
|
+
visibleProjects(ctx, { showArchived: true }),
|
|
284
|
+
visibleTodos(ctx, { showArchived: input.showArchived })
|
|
285
|
+
]);
|
|
286
|
+
const projectById = new Map(projects.map((project) => [project.id, { name: project.name }]));
|
|
287
|
+
const userNameById = await userNames(ctx, todos.map((todo) => todo.assigneeId));
|
|
288
|
+
const summarized = todos.map((todo) => summarizeTodo(todo, projectById, userNameById));
|
|
289
|
+
return { total: summarized.length, todos: summarized };
|
|
290
|
+
}
|
|
291
|
+
}),
|
|
292
|
+
|
|
293
|
+
createProject: defineAction({
|
|
294
|
+
name: "projects.create",
|
|
295
|
+
description: "Create a project visible to the team.",
|
|
296
|
+
input: z.object({
|
|
297
|
+
name: z.string().trim().min(1).max(120),
|
|
298
|
+
description: optionalText,
|
|
299
|
+
status: projectStatusSchema.optional()
|
|
300
|
+
}).strict(),
|
|
301
|
+
output: projectOutputSchema,
|
|
302
|
+
policy: role(appRoles, "user"),
|
|
303
|
+
annotations: { title: "Create project" },
|
|
304
|
+
resource: { name: "projects", operation: "create" },
|
|
305
|
+
effects: ["creates projects"],
|
|
306
|
+
handler: async (ctx, input) => {
|
|
307
|
+
const project = await ctx.db.create("projects", {
|
|
308
|
+
name: input.name,
|
|
309
|
+
description: normalizeNullableText(input.description) ?? null,
|
|
310
|
+
status: input.status ?? "active"
|
|
311
|
+
});
|
|
312
|
+
return { project: summarizeProject(project) };
|
|
313
|
+
}
|
|
314
|
+
}),
|
|
315
|
+
|
|
316
|
+
updateProject: defineAction({
|
|
317
|
+
name: "projects.update",
|
|
318
|
+
description: "Update a project name, description, or workflow status when allowed.",
|
|
319
|
+
input: z.object({
|
|
320
|
+
id: z.string().min(1),
|
|
321
|
+
name: z.string().trim().min(1).max(120).optional(),
|
|
322
|
+
description: optionalNullableText,
|
|
323
|
+
status: projectStatusSchema.optional()
|
|
324
|
+
}).strict(),
|
|
325
|
+
output: projectOutputSchema,
|
|
326
|
+
policy: role(appRoles, "user"),
|
|
327
|
+
annotations: { title: "Update project" },
|
|
328
|
+
resource: { name: "projects", operation: "update", inputRefs: { id: { kind: "internal-id", required: true } } },
|
|
329
|
+
effects: ["updates projects"],
|
|
330
|
+
handler: async (ctx, input) => {
|
|
331
|
+
const patch: Record<string, unknown> = {};
|
|
332
|
+
if (input.name !== undefined) patch.name = input.name;
|
|
333
|
+
if (input.description !== undefined) patch.description = normalizeNullableText(input.description) ?? null;
|
|
334
|
+
if (input.status !== undefined) patch.status = input.status;
|
|
335
|
+
if (Object.keys(patch).length === 0) {
|
|
336
|
+
throw actionError("No project changes were provided.", { code: "empty_update", retryable: true });
|
|
337
|
+
}
|
|
338
|
+
const project = await ctx.db.update("projects", input.id, patch);
|
|
339
|
+
return { project: summarizeProject(project) };
|
|
340
|
+
}
|
|
341
|
+
}),
|
|
342
|
+
|
|
343
|
+
archiveProject: defineAction({
|
|
344
|
+
name: "projects.archive",
|
|
345
|
+
description: "Archive a project and hide it from the active workspace.",
|
|
346
|
+
input: z.object({ id: z.string().min(1) }).strict(),
|
|
347
|
+
output: projectOutputSchema,
|
|
348
|
+
policy: role(appRoles, "user"),
|
|
349
|
+
annotations: { title: "Archive project", idempotentHint: true },
|
|
350
|
+
resource: { name: "projects", operation: "update", inputRefs: { id: { kind: "internal-id", required: true } } },
|
|
351
|
+
effects: ["updates projects.archivedAt"],
|
|
352
|
+
handler: async (ctx, input) => {
|
|
353
|
+
const current = await assertProjectVisible(ctx, input.id);
|
|
354
|
+
const project = current.archivedAt
|
|
355
|
+
? current
|
|
356
|
+
: await ctx.db.update("projects", input.id, { archivedAt: nowIso() });
|
|
357
|
+
return { project: summarizeProject(project) };
|
|
358
|
+
}
|
|
359
|
+
}),
|
|
360
|
+
|
|
361
|
+
deleteProject: defineAction({
|
|
362
|
+
name: "projects.delete",
|
|
363
|
+
description: "Hard delete an archived empty project. Managers only.",
|
|
364
|
+
input: z.object({ id: z.string().min(1) }).strict(),
|
|
365
|
+
output: z.object({ ok: z.literal(true), id: z.string() }),
|
|
366
|
+
policy: role(appRoles, "manager"),
|
|
367
|
+
annotations: { title: "Delete project", destructiveHint: true },
|
|
368
|
+
resource: { name: "projects", operation: "delete", inputRefs: { id: { kind: "internal-id", required: true } } },
|
|
369
|
+
effects: ["deletes projects"],
|
|
370
|
+
handler: async (ctx, input) => {
|
|
371
|
+
const project = await assertProjectVisible(ctx, input.id);
|
|
372
|
+
if (!project.archivedAt) {
|
|
373
|
+
throw actionError("Archive the project before deleting it.", {
|
|
374
|
+
code: "archive_required",
|
|
375
|
+
guidance: "Project deletion is only available for archived projects."
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
const todos = await ctx.db.list("todos", { filter: { projectId: { op: "eq", value: input.id } }, limit: 1 });
|
|
379
|
+
if (todos.total > 0) {
|
|
380
|
+
throw actionError("Only empty archived projects can be deleted.", {
|
|
381
|
+
code: "project_not_empty",
|
|
382
|
+
guidance: "Archive or delete the remaining tasks first."
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
await ctx.db.delete("projects", input.id);
|
|
386
|
+
return { ok: true as const, id: input.id };
|
|
387
|
+
}
|
|
388
|
+
}),
|
|
389
|
+
|
|
390
|
+
createTodo: defineAction({
|
|
391
|
+
name: "todos.create",
|
|
392
|
+
description: "Create a task inside a visible project.",
|
|
393
|
+
input: z.object({
|
|
394
|
+
projectId: z.string().min(1),
|
|
395
|
+
title: z.string().trim().min(1).max(160),
|
|
396
|
+
notes: optionalText,
|
|
397
|
+
status: todoStatusSchema.optional(),
|
|
398
|
+
priority: prioritySchema.optional(),
|
|
399
|
+
assigneeId: optionalUserId,
|
|
400
|
+
dueDate: optionalDate
|
|
401
|
+
}).strict(),
|
|
402
|
+
output: todoOutputSchema,
|
|
403
|
+
policy: role(appRoles, "user"),
|
|
404
|
+
annotations: { title: "Create task" },
|
|
405
|
+
resource: { name: "todos", operation: "create" },
|
|
406
|
+
effects: ["creates todos"],
|
|
407
|
+
handler: async (ctx, input) => {
|
|
408
|
+
const project = await assertProjectVisible(ctx, input.projectId);
|
|
409
|
+
if (project.archivedAt) {
|
|
410
|
+
throw actionError("Tasks cannot be added to an archived project.", {
|
|
411
|
+
code: "project_archived",
|
|
412
|
+
guidance: "Choose an active project or restore the project first."
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
const assigneeId = await resolveAssignee(ctx, input.assigneeId, { defaultToSelf: true });
|
|
416
|
+
const todo = await ctx.db.create("todos", {
|
|
417
|
+
projectId: input.projectId,
|
|
418
|
+
title: input.title,
|
|
419
|
+
notes: normalizeNullableText(input.notes) ?? null,
|
|
420
|
+
status: input.status ?? "todo",
|
|
421
|
+
priority: input.priority ?? "medium",
|
|
422
|
+
assigneeId: assigneeId ?? null,
|
|
423
|
+
dueDate: input.dueDate ?? null
|
|
424
|
+
});
|
|
425
|
+
const userNameById = await userNames(ctx, [todo.assigneeId]);
|
|
426
|
+
return { todo: summarizeTodo(todo, new Map([[project.id, { name: project.name }]]), userNameById) };
|
|
427
|
+
}
|
|
428
|
+
}),
|
|
429
|
+
|
|
430
|
+
updateTodo: defineAction({
|
|
431
|
+
name: "todos.update",
|
|
432
|
+
description: "Update a task title, notes, status, priority, due date, or assignee when allowed.",
|
|
433
|
+
input: z.object({
|
|
434
|
+
id: z.string().min(1),
|
|
435
|
+
title: z.string().trim().min(1).max(160).optional(),
|
|
436
|
+
notes: optionalNullableText,
|
|
437
|
+
status: todoStatusSchema.optional(),
|
|
438
|
+
priority: prioritySchema.optional(),
|
|
439
|
+
assigneeId: optionalUserId,
|
|
440
|
+
dueDate: optionalDate
|
|
441
|
+
}).strict(),
|
|
442
|
+
output: todoOutputSchema,
|
|
443
|
+
policy: role(appRoles, "user"),
|
|
444
|
+
annotations: { title: "Update task" },
|
|
445
|
+
resource: { name: "todos", operation: "update", inputRefs: { id: { kind: "internal-id", required: true } } },
|
|
446
|
+
effects: ["updates todos"],
|
|
447
|
+
handler: async (ctx, input) => {
|
|
448
|
+
const current = await assertTodoVisible(ctx, input.id);
|
|
449
|
+
if (current.archivedAt) {
|
|
450
|
+
throw actionError("Archived tasks cannot be edited.", {
|
|
451
|
+
code: "todo_archived",
|
|
452
|
+
guidance: "Use an active task for edits."
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
const patch: Record<string, unknown> = {};
|
|
456
|
+
if (input.title !== undefined) patch.title = input.title;
|
|
457
|
+
if (input.notes !== undefined) patch.notes = normalizeNullableText(input.notes) ?? null;
|
|
458
|
+
if (input.status !== undefined) patch.status = input.status;
|
|
459
|
+
if (input.priority !== undefined) patch.priority = input.priority;
|
|
460
|
+
if (input.dueDate !== undefined) patch.dueDate = input.dueDate;
|
|
461
|
+
if (input.assigneeId !== undefined) patch.assigneeId = await resolveAssignee(ctx, input.assigneeId);
|
|
462
|
+
if (Object.keys(patch).length === 0) {
|
|
463
|
+
throw actionError("No task changes were provided.", { code: "empty_update", retryable: true });
|
|
464
|
+
}
|
|
465
|
+
const todo = await ctx.db.update("todos", input.id, patch);
|
|
466
|
+
const project = await assertProjectVisible(ctx, todo.projectId);
|
|
467
|
+
const userNameById = await userNames(ctx, [todo.assigneeId]);
|
|
468
|
+
return { todo: summarizeTodo(todo, new Map([[project.id, { name: project.name }]]), userNameById) };
|
|
469
|
+
}
|
|
470
|
+
}),
|
|
471
|
+
|
|
472
|
+
markTodoDone: defineAction({
|
|
473
|
+
name: "todos.mark_done",
|
|
474
|
+
description: "Mark a visible task as done when the signed-in user is allowed to update it.",
|
|
475
|
+
input: z.object({ id: z.string().min(1) }).strict(),
|
|
476
|
+
output: todoOutputSchema,
|
|
477
|
+
policy: role(appRoles, "user"),
|
|
478
|
+
annotations: { title: "Mark task done", idempotentHint: true },
|
|
479
|
+
resource: { name: "todos", operation: "update", inputRefs: { id: { kind: "internal-id", required: true } } },
|
|
480
|
+
effects: ["updates todos.status"],
|
|
481
|
+
handler: async (ctx, input) => {
|
|
482
|
+
const current = await assertTodoVisible(ctx, input.id);
|
|
483
|
+
if (current.status === "done") {
|
|
484
|
+
throw actionError("Task is already done.", { code: "invalid_state", retryable: false });
|
|
485
|
+
}
|
|
486
|
+
const todo = await ctx.db.update("todos", input.id, { status: "done" });
|
|
487
|
+
const project = await assertProjectVisible(ctx, todo.projectId);
|
|
488
|
+
const userNameById = await userNames(ctx, [todo.assigneeId]);
|
|
489
|
+
return { todo: summarizeTodo(todo, new Map([[project.id, { name: project.name }]]), userNameById) };
|
|
490
|
+
}
|
|
491
|
+
}),
|
|
492
|
+
|
|
493
|
+
archiveTodo: defineAction({
|
|
494
|
+
name: "todos.archive",
|
|
495
|
+
description: "Archive a visible task and remove it from active views.",
|
|
496
|
+
input: z.object({ id: z.string().min(1) }).strict(),
|
|
497
|
+
output: todoOutputSchema,
|
|
498
|
+
policy: role(appRoles, "user"),
|
|
499
|
+
annotations: { title: "Archive task", idempotentHint: true },
|
|
500
|
+
resource: { name: "todos", operation: "update", inputRefs: { id: { kind: "internal-id", required: true } } },
|
|
501
|
+
effects: ["updates todos.archivedAt"],
|
|
502
|
+
handler: async (ctx, input) => {
|
|
503
|
+
const current = await assertTodoVisible(ctx, input.id);
|
|
504
|
+
const todo = current.archivedAt
|
|
505
|
+
? current
|
|
506
|
+
: await ctx.db.update("todos", input.id, { archivedAt: nowIso() });
|
|
507
|
+
const project = await assertProjectVisible(ctx, todo.projectId);
|
|
508
|
+
const userNameById = await userNames(ctx, [todo.assigneeId]);
|
|
509
|
+
return { todo: summarizeTodo(todo, new Map([[project.id, { name: project.name }]]), userNameById) };
|
|
510
|
+
}
|
|
511
|
+
}),
|
|
512
|
+
|
|
513
|
+
deleteTodo: defineAction({
|
|
514
|
+
name: "todos.delete",
|
|
515
|
+
description: "Hard delete a task when the signed-in user is allowed to delete it.",
|
|
516
|
+
input: z.object({ id: z.string().min(1) }).strict(),
|
|
517
|
+
output: z.object({ ok: z.literal(true), id: z.string() }),
|
|
518
|
+
policy: role(appRoles, "user"),
|
|
519
|
+
annotations: { title: "Delete task", destructiveHint: true },
|
|
520
|
+
resource: { name: "todos", operation: "delete", inputRefs: { id: { kind: "internal-id", required: true } } },
|
|
521
|
+
effects: ["deletes todos"],
|
|
522
|
+
handler: async (ctx, input) => {
|
|
523
|
+
await assertTodoVisible(ctx, input.id);
|
|
524
|
+
await ctx.db.delete("todos", input.id);
|
|
525
|
+
return { ok: true as const, id: input.id };
|
|
526
|
+
}
|
|
527
|
+
}),
|
|
528
|
+
|
|
529
|
+
listAssignableUsers: defineAction({
|
|
530
|
+
name: "users.list_assignable",
|
|
531
|
+
description: "List active app users that the current signed-in user can assign tasks to.",
|
|
532
|
+
input: z.object({ search: z.string().trim().max(120).optional(), limit: z.number().int().min(1).max(50).optional() }).strict(),
|
|
533
|
+
output: z.object({ users: z.array(userSummarySchema), total: z.number() }),
|
|
534
|
+
policy: role(appRoles, "user"),
|
|
535
|
+
annotations: { title: "List assignable users", readOnlyHint: true },
|
|
536
|
+
resource: { name: "users", operation: "list" },
|
|
537
|
+
effects: [],
|
|
538
|
+
handler: async (ctx, input) => {
|
|
539
|
+
if (!isManager(ctx)) {
|
|
540
|
+
const self = currentUser(ctx);
|
|
541
|
+
return { users: [{ ...self, disabled: false }], total: 1 };
|
|
542
|
+
}
|
|
543
|
+
if (!ctx.control) {
|
|
544
|
+
const self = currentUser(ctx);
|
|
545
|
+
return { users: [{ ...self, disabled: false }], total: 1 };
|
|
546
|
+
}
|
|
547
|
+
const result = await listAppUsers(ctx.control, { search: input.search, limit: input.limit ?? 50 });
|
|
548
|
+
return {
|
|
549
|
+
total: result.total,
|
|
550
|
+
users: result.users.map((user) => ({
|
|
551
|
+
id: user.id,
|
|
552
|
+
name: user.name,
|
|
553
|
+
email: user.email,
|
|
554
|
+
roles: user.appRoles,
|
|
555
|
+
disabled: user.disabled
|
|
556
|
+
}))
|
|
557
|
+
};
|
|
558
|
+
}
|
|
559
|
+
})
|
|
560
|
+
});
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// Example:
|
|
2
|
+
// import {
|
|
3
|
+
// defineAgent,
|
|
4
|
+
// defineAgentSkill,
|
|
5
|
+
// defineAgentSkills,
|
|
6
|
+
// defineAgents,
|
|
7
|
+
// defineRemoteMcpServer,
|
|
8
|
+
// defineRemoteMcpServers,
|
|
9
|
+
// role
|
|
10
|
+
// } from "@raybase/core";
|
|
11
|
+
// import { actions } from "../actions";
|
|
12
|
+
//
|
|
13
|
+
// export const agentSkills = defineAgentSkills/* opt-in example */({
|
|
14
|
+
// projectWorkflows: defineAgentSkill/* opt-in example */({
|
|
15
|
+
// name: "projectWorkflows",
|
|
16
|
+
// title: "Project workflows",
|
|
17
|
+
// guidance: "Use project workflow actions for app data. Ask before changing important status.",
|
|
18
|
+
// actions: [actions.markTodoDone],
|
|
19
|
+
// limits: {
|
|
20
|
+
// maxToolCallsPerTurn: 4,
|
|
21
|
+
// maxLoopStepsPerTurn: 6
|
|
22
|
+
// }
|
|
23
|
+
// })
|
|
24
|
+
// });
|
|
25
|
+
//
|
|
26
|
+
// export const remoteMcpServers = defineRemoteMcpServers/* opt-in example */({
|
|
27
|
+
// docs: defineRemoteMcpServer/* opt-in example */({
|
|
28
|
+
// name: "docs",
|
|
29
|
+
// endpoint: "https://mcp.docs.example/mcp",
|
|
30
|
+
// credentials: { type: "env", envVar: "DOCS_MCP_TOKEN" },
|
|
31
|
+
// tools: {
|
|
32
|
+
// search_docs: {
|
|
33
|
+
// description: "Search approved external docs.",
|
|
34
|
+
// inputSchema: {
|
|
35
|
+
// type: "object",
|
|
36
|
+
// properties: { query: { type: "string" } },
|
|
37
|
+
// required: ["query"],
|
|
38
|
+
// additionalProperties: false
|
|
39
|
+
// },
|
|
40
|
+
// annotations: { readOnlyHint: true },
|
|
41
|
+
// policy: role("user"),
|
|
42
|
+
// timeoutMs: 5000
|
|
43
|
+
// }
|
|
44
|
+
// }
|
|
45
|
+
// })
|
|
46
|
+
// });
|
|
47
|
+
//
|
|
48
|
+
// export const agents = defineAgents/* opt-in example */({
|
|
49
|
+
// project: defineAgent/* opt-in example */({
|
|
50
|
+
// runtime: "ai-chat",
|
|
51
|
+
// title: "Project agent",
|
|
52
|
+
// description: "Helps users summarize projects and update todos.",
|
|
53
|
+
// system: "Help the user work with projects and todos. Ask before changing important status.",
|
|
54
|
+
// skills: [{ skill: agentSkills.projectWorkflows, mode: "include" }],
|
|
55
|
+
// remoteMcpServers: [{ server: remoteMcpServers.docs, tools: ["search_docs"] }],
|
|
56
|
+
// wakes: {
|
|
57
|
+
// enabled: true,
|
|
58
|
+
// purposes: ["follow-up", "review-watermark"],
|
|
59
|
+
// limits: { maxPending: 8, dailySchedules: 48 }
|
|
60
|
+
// },
|
|
61
|
+
// followUps: {
|
|
62
|
+
// enabled: true,
|
|
63
|
+
// limits: { maxPending: 32, dailyCreates: 48 }
|
|
64
|
+
// },
|
|
65
|
+
// retention: {
|
|
66
|
+
// hotTtl: "4h",
|
|
67
|
+
// idleGap: "1h",
|
|
68
|
+
// onExpiry: "archive"
|
|
69
|
+
// },
|
|
70
|
+
// limits: {
|
|
71
|
+
// maxToolCallsPerTurn: 4,
|
|
72
|
+
// maxLoopStepsPerTurn: 6,
|
|
73
|
+
// maxOutputTokens: 1000
|
|
74
|
+
// }
|
|
75
|
+
// })
|
|
76
|
+
// });
|
|
77
|
+
|
|
78
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Optional semantic retrieval example. This file is not imported by default.
|
|
2
|
+
//
|
|
3
|
+
// Use SQL FTS search in src/search.ts for exact terms, IDs, names, statuses,
|
|
4
|
+
// and command palettes. Enable retrieval only when the app needs fuzzy
|
|
5
|
+
// meaning-based lookup or RAG over longer text.
|
|
6
|
+
//
|
|
7
|
+
// To enable retrieval for a real app:
|
|
8
|
+
// 1. Uncomment the declarations below.
|
|
9
|
+
// 2. Import { retrieval } in src/raybase.server.ts and pass retrieval to
|
|
10
|
+
// createRaybaseApp().
|
|
11
|
+
// 3. Provision Vectorize and the Worker binding only when semantic retrieval
|
|
12
|
+
// is actually needed. Local development can use the SQLite local backend.
|
|
13
|
+
// 4. Run `raybase migrate`, `raybase retrieval status --dry-run`,
|
|
14
|
+
// `raybase doctor`, and reindex after changing sources.
|
|
15
|
+
//
|
|
16
|
+
// import { defineEmbeddingIndex, defineRetrieval, tableSource } from "@raybase/core";
|
|
17
|
+
// import { todos } from "../db/schema";
|
|
18
|
+
//
|
|
19
|
+
// export const retrieval = defineRetrieval/* opt-in example */({
|
|
20
|
+
// indexes: {
|
|
21
|
+
// todoNotes: defineEmbeddingIndex/* opt-in example */({
|
|
22
|
+
// description: "Semantic search over todo notes.",
|
|
23
|
+
// backend: "vectorize",
|
|
24
|
+
// localBackend: "sqlite",
|
|
25
|
+
// sources: [
|
|
26
|
+
// tableSource(todos, {
|
|
27
|
+
// text: (row) => [row.title, row.notes].filter(Boolean).join("\\n"),
|
|
28
|
+
// title: (row) => String(row.title ?? "Todo"),
|
|
29
|
+
// version: (row) => String(row.updatedAt ?? "")
|
|
30
|
+
// })
|
|
31
|
+
// ]
|
|
32
|
+
// })
|
|
33
|
+
// }
|
|
34
|
+
// });
|
|
35
|
+
|
|
36
|
+
export {};
|