create-sidekick-app 0.0.1 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +202 -0
- package/NOTICE +27 -0
- package/README.md +29 -2
- package/dist/index.js +59 -0
- package/package.json +65 -4
- package/template/base/ai-chat/.env.example +6 -0
- package/template/base/ai-chat/.prettierignore +2 -0
- package/template/base/ai-chat/.prettierrc.json +5 -0
- package/template/base/ai-chat/README.md +38 -0
- package/template/base/ai-chat/_gitignore +41 -0
- package/template/base/ai-chat/components.json +23 -0
- package/template/base/ai-chat/next.config.ts +5 -0
- package/template/base/ai-chat/package.json +61 -0
- package/template/base/ai-chat/postcss.config.mjs +5 -0
- package/template/base/ai-chat/src/app/api/chat/route.ts +141 -0
- package/template/base/ai-chat/src/app/api/instant/route.ts +5 -0
- package/template/base/ai-chat/src/app/chat/[id]/page.tsx +20 -0
- package/template/base/ai-chat/src/app/globals.css +124 -0
- package/template/base/ai-chat/src/app/layout.tsx +34 -0
- package/template/base/ai-chat/src/app/page.tsx +6 -0
- package/template/base/ai-chat/src/components/AuthGate.tsx +15 -0
- package/template/base/ai-chat/src/components/Chat.tsx +228 -0
- package/template/base/ai-chat/src/components/InstantProvider.tsx +18 -0
- package/template/base/ai-chat/src/components/Login.tsx +163 -0
- package/template/base/ai-chat/src/components/Sidebar.tsx +100 -0
- package/template/base/ai-chat/src/components/ai-elements/agent.tsx +142 -0
- package/template/base/ai-chat/src/components/ai-elements/artifact.tsx +149 -0
- package/template/base/ai-chat/src/components/ai-elements/attachments.tsx +427 -0
- package/template/base/ai-chat/src/components/ai-elements/audio-player.tsx +229 -0
- package/template/base/ai-chat/src/components/ai-elements/canvas.tsx +26 -0
- package/template/base/ai-chat/src/components/ai-elements/chain-of-thought.tsx +223 -0
- package/template/base/ai-chat/src/components/ai-elements/checkpoint.tsx +72 -0
- package/template/base/ai-chat/src/components/ai-elements/code-block.tsx +556 -0
- package/template/base/ai-chat/src/components/ai-elements/commit.tsx +449 -0
- package/template/base/ai-chat/src/components/ai-elements/confirmation.tsx +173 -0
- package/template/base/ai-chat/src/components/ai-elements/connection.tsx +28 -0
- package/template/base/ai-chat/src/components/ai-elements/context.tsx +410 -0
- package/template/base/ai-chat/src/components/ai-elements/controls.tsx +19 -0
- package/template/base/ai-chat/src/components/ai-elements/conversation.tsx +167 -0
- package/template/base/ai-chat/src/components/ai-elements/edge.tsx +144 -0
- package/template/base/ai-chat/src/components/ai-elements/environment-variables.tsx +325 -0
- package/template/base/ai-chat/src/components/ai-elements/file-tree.tsx +298 -0
- package/template/base/ai-chat/src/components/ai-elements/image.tsx +25 -0
- package/template/base/ai-chat/src/components/ai-elements/inline-citation.tsx +294 -0
- package/template/base/ai-chat/src/components/ai-elements/jsx-preview.tsx +250 -0
- package/template/base/ai-chat/src/components/ai-elements/message.tsx +356 -0
- package/template/base/ai-chat/src/components/ai-elements/mic-selector.tsx +372 -0
- package/template/base/ai-chat/src/components/ai-elements/model-selector.tsx +214 -0
- package/template/base/ai-chat/src/components/ai-elements/node.tsx +72 -0
- package/template/base/ai-chat/src/components/ai-elements/open-in-chat.tsx +367 -0
- package/template/base/ai-chat/src/components/ai-elements/package-info.tsx +235 -0
- package/template/base/ai-chat/src/components/ai-elements/panel.tsx +16 -0
- package/template/base/ai-chat/src/components/ai-elements/persona.tsx +280 -0
- package/template/base/ai-chat/src/components/ai-elements/plan.tsx +144 -0
- package/template/base/ai-chat/src/components/ai-elements/prompt-input.tsx +1341 -0
- package/template/base/ai-chat/src/components/ai-elements/queue.tsx +275 -0
- package/template/base/ai-chat/src/components/ai-elements/reasoning.tsx +229 -0
- package/template/base/ai-chat/src/components/ai-elements/sandbox.tsx +128 -0
- package/template/base/ai-chat/src/components/ai-elements/schema-display.tsx +473 -0
- package/template/base/ai-chat/src/components/ai-elements/shimmer.tsx +78 -0
- package/template/base/ai-chat/src/components/ai-elements/snippet.tsx +141 -0
- package/template/base/ai-chat/src/components/ai-elements/sources.tsx +78 -0
- package/template/base/ai-chat/src/components/ai-elements/speech-input.tsx +324 -0
- package/template/base/ai-chat/src/components/ai-elements/stack-trace.tsx +531 -0
- package/template/base/ai-chat/src/components/ai-elements/suggestion.tsx +55 -0
- package/template/base/ai-chat/src/components/ai-elements/task.tsx +88 -0
- package/template/base/ai-chat/src/components/ai-elements/terminal.tsx +277 -0
- package/template/base/ai-chat/src/components/ai-elements/test-results.tsx +497 -0
- package/template/base/ai-chat/src/components/ai-elements/tool.tsx +174 -0
- package/template/base/ai-chat/src/components/ai-elements/toolbar.tsx +17 -0
- package/template/base/ai-chat/src/components/ai-elements/transcription.tsx +126 -0
- package/template/base/ai-chat/src/components/ai-elements/voice-selector.tsx +525 -0
- package/template/base/ai-chat/src/components/ai-elements/web-preview.tsx +282 -0
- package/template/base/ai-chat/src/components/ui/accordion.tsx +66 -0
- package/template/base/ai-chat/src/components/ui/alert.tsx +66 -0
- package/template/base/ai-chat/src/components/ui/avatar.tsx +109 -0
- package/template/base/ai-chat/src/components/ui/badge.tsx +48 -0
- package/template/base/ai-chat/src/components/ui/button-group.tsx +83 -0
- package/template/base/ai-chat/src/components/ui/button.tsx +64 -0
- package/template/base/ai-chat/src/components/ui/card.tsx +92 -0
- package/template/base/ai-chat/src/components/ui/carousel.tsx +241 -0
- package/template/base/ai-chat/src/components/ui/collapsible.tsx +33 -0
- package/template/base/ai-chat/src/components/ui/command.tsx +184 -0
- package/template/base/ai-chat/src/components/ui/dialog.tsx +158 -0
- package/template/base/ai-chat/src/components/ui/dropdown-menu.tsx +257 -0
- package/template/base/ai-chat/src/components/ui/hover-card.tsx +44 -0
- package/template/base/ai-chat/src/components/ui/input-group.tsx +170 -0
- package/template/base/ai-chat/src/components/ui/input.tsx +21 -0
- package/template/base/ai-chat/src/components/ui/popover.tsx +89 -0
- package/template/base/ai-chat/src/components/ui/progress.tsx +31 -0
- package/template/base/ai-chat/src/components/ui/scroll-area.tsx +58 -0
- package/template/base/ai-chat/src/components/ui/select.tsx +190 -0
- package/template/base/ai-chat/src/components/ui/separator.tsx +28 -0
- package/template/base/ai-chat/src/components/ui/spinner.tsx +16 -0
- package/template/base/ai-chat/src/components/ui/switch.tsx +35 -0
- package/template/base/ai-chat/src/components/ui/tabs.tsx +91 -0
- package/template/base/ai-chat/src/components/ui/textarea.tsx +18 -0
- package/template/base/ai-chat/src/components/ui/tooltip.tsx +57 -0
- package/template/base/ai-chat/src/instant.perms.ts +34 -0
- package/template/base/ai-chat/src/instant.schema.ts +107 -0
- package/template/base/ai-chat/src/lib/adminDb.ts +8 -0
- package/template/base/ai-chat/src/lib/db.ts +8 -0
- package/template/base/ai-chat/src/lib/mockModel.ts +119 -0
- package/template/base/ai-chat/src/lib/utils.ts +6 -0
- package/template/base/ai-chat/tsconfig.json +33 -0
- package/template/base/bun-react/.env.example +2 -0
- package/template/base/bun-react/README.md +12 -0
- package/template/base/bun-react/_gitignore +34 -0
- package/template/base/bun-react/bun-env.d.ts +17 -0
- package/template/base/bun-react/bunfig.toml +4 -0
- package/template/base/bun-react/package.json +22 -0
- package/template/base/bun-react/src/App.tsx +168 -0
- package/template/base/bun-react/src/frontend.tsx +20 -0
- package/template/base/bun-react/src/getUnusedPort.ts +32 -0
- package/template/base/bun-react/src/index.css +25 -0
- package/template/base/bun-react/src/index.html +13 -0
- package/template/base/bun-react/src/index.ts +21 -0
- package/template/base/bun-react/src/instant.perms.ts +24 -0
- package/template/base/bun-react/src/instant.schema.ts +46 -0
- package/template/base/bun-react/src/lib/db.ts +8 -0
- package/template/base/bun-react/src/logo.svg +1 -0
- package/template/base/bun-react/tsconfig.json +36 -0
- package/template/base/expo/.env.example +2 -0
- package/template/base/expo/README.md +18 -0
- package/template/base/expo/_gitignore +41 -0
- package/template/base/expo/app/+not-found.tsx +16 -0
- package/template/base/expo/app/_layout.tsx +37 -0
- package/template/base/expo/app/index.tsx +64 -0
- package/template/base/expo/app.json +42 -0
- package/template/base/expo/assets/fonts/SpaceMono-Regular.ttf +0 -0
- package/template/base/expo/assets/images/adaptive-icon.png +0 -0
- package/template/base/expo/assets/images/favicon.png +0 -0
- package/template/base/expo/assets/images/icon.png +0 -0
- package/template/base/expo/assets/images/partial-react-logo.png +0 -0
- package/template/base/expo/assets/images/react-logo.png +0 -0
- package/template/base/expo/assets/images/react-logo@2x.png +0 -0
- package/template/base/expo/assets/images/react-logo@3x.png +0 -0
- package/template/base/expo/assets/images/splash-icon.png +0 -0
- package/template/base/expo/babel.config.js +12 -0
- package/template/base/expo/constants/Colors.ts +26 -0
- package/template/base/expo/eslint.config.js +10 -0
- package/template/base/expo/global.css +3 -0
- package/template/base/expo/hooks/useColorScheme.ts +1 -0
- package/template/base/expo/hooks/useColorScheme.web.ts +21 -0
- package/template/base/expo/hooks/useThemeColor.ts +21 -0
- package/template/base/expo/instant.perms.ts +24 -0
- package/template/base/expo/instant.schema.ts +44 -0
- package/template/base/expo/lib/db.ts +7 -0
- package/template/base/expo/metro.config.js +6 -0
- package/template/base/expo/nativewind-env.d.ts +1 -0
- package/template/base/expo/package.json +57 -0
- package/template/base/expo/scripts/reset-project.js +112 -0
- package/template/base/expo/tailwind.config.js +9 -0
- package/template/base/expo/tsconfig.json +18 -0
- package/template/base/next-js-app-dir/.env.example +2 -0
- package/template/base/next-js-app-dir/README.md +18 -0
- package/template/base/next-js-app-dir/_gitignore +41 -0
- package/template/base/next-js-app-dir/next.config.ts +7 -0
- package/template/base/next-js-app-dir/package.json +27 -0
- package/template/base/next-js-app-dir/postcss.config.mjs +5 -0
- package/template/base/next-js-app-dir/public/file.svg +1 -0
- package/template/base/next-js-app-dir/public/globe.svg +1 -0
- package/template/base/next-js-app-dir/public/next.svg +1 -0
- package/template/base/next-js-app-dir/public/vercel.svg +1 -0
- package/template/base/next-js-app-dir/public/window.svg +1 -0
- package/template/base/next-js-app-dir/src/app/favicon.ico +0 -0
- package/template/base/next-js-app-dir/src/app/globals.css +26 -0
- package/template/base/next-js-app-dir/src/app/layout.tsx +34 -0
- package/template/base/next-js-app-dir/src/app/page.tsx +169 -0
- package/template/base/next-js-app-dir/src/instant.perms.ts +24 -0
- package/template/base/next-js-app-dir/src/instant.schema.ts +50 -0
- package/template/base/next-js-app-dir/src/lib/db.ts +8 -0
- package/template/base/next-js-app-dir/tsconfig.json +41 -0
- package/template/base/solidjs-vite/README.md +15 -0
- package/template/base/solidjs-vite/_gitignore +25 -0
- package/template/base/solidjs-vite/index.html +15 -0
- package/template/base/solidjs-vite/package.json +25 -0
- package/template/base/solidjs-vite/src/App.tsx +171 -0
- package/template/base/solidjs-vite/src/index.css +25 -0
- package/template/base/solidjs-vite/src/index.tsx +16 -0
- package/template/base/solidjs-vite/src/instant.perms.ts +24 -0
- package/template/base/solidjs-vite/src/instant.schema.ts +46 -0
- package/template/base/solidjs-vite/src/lib/db.ts +8 -0
- package/template/base/solidjs-vite/tsconfig.json +20 -0
- package/template/base/solidjs-vite/vite.config.ts +11 -0
- package/template/base/sveltekit/README.md +15 -0
- package/template/base/sveltekit/_gitignore +26 -0
- package/template/base/sveltekit/package.json +25 -0
- package/template/base/sveltekit/src/app.css +25 -0
- package/template/base/sveltekit/src/app.html +11 -0
- package/template/base/sveltekit/src/instant.perms.ts +24 -0
- package/template/base/sveltekit/src/instant.schema.ts +46 -0
- package/template/base/sveltekit/src/lib/db.ts +8 -0
- package/template/base/sveltekit/src/routes/+layout.svelte +6 -0
- package/template/base/sveltekit/src/routes/+page.svelte +236 -0
- package/template/base/sveltekit/src/routes/+page.ts +1 -0
- package/template/base/sveltekit/svelte.config.js +10 -0
- package/template/base/sveltekit/tsconfig.json +14 -0
- package/template/base/sveltekit/vite.config.ts +7 -0
- package/template/base/tanstack-start/.cta.json +12 -0
- package/template/base/tanstack-start/README.md +17 -0
- package/template/base/tanstack-start/_gitignore +13 -0
- package/template/base/tanstack-start/package.json +43 -0
- package/template/base/tanstack-start/public/favicon.ico +0 -0
- package/template/base/tanstack-start/public/logo192.png +0 -0
- package/template/base/tanstack-start/public/logo512.png +0 -0
- package/template/base/tanstack-start/public/manifest.json +25 -0
- package/template/base/tanstack-start/public/robots.txt +3 -0
- package/template/base/tanstack-start/public/tanstack-circle-logo.png +0 -0
- package/template/base/tanstack-start/public/tanstack-word-logo-white.svg +1 -0
- package/template/base/tanstack-start/src/components/Header.tsx +21 -0
- package/template/base/tanstack-start/src/instant.perms.ts +24 -0
- package/template/base/tanstack-start/src/instant.schema.ts +50 -0
- package/template/base/tanstack-start/src/lib/adminDb.ts +12 -0
- package/template/base/tanstack-start/src/lib/db.ts +9 -0
- package/template/base/tanstack-start/src/logo.svg +12 -0
- package/template/base/tanstack-start/src/routeTree.gen.ts +104 -0
- package/template/base/tanstack-start/src/router.tsx +22 -0
- package/template/base/tanstack-start/src/routes/__root.tsx +70 -0
- package/template/base/tanstack-start/src/routes/api/instant.ts +18 -0
- package/template/base/tanstack-start/src/routes/index.tsx +238 -0
- package/template/base/tanstack-start/src/routes/login.tsx +140 -0
- package/template/base/tanstack-start/src/styles.css +18 -0
- package/template/base/tanstack-start/tsconfig.json +28 -0
- package/template/base/tanstack-start/vite.config.ts +33 -0
- package/template/base/tanstack-start-with-tanstack-query/.cta.json +12 -0
- package/template/base/tanstack-start-with-tanstack-query/README.md +18 -0
- package/template/base/tanstack-start-with-tanstack-query/_gitignore +13 -0
- package/template/base/tanstack-start-with-tanstack-query/package.json +46 -0
- package/template/base/tanstack-start-with-tanstack-query/public/favicon.ico +0 -0
- package/template/base/tanstack-start-with-tanstack-query/public/logo192.png +0 -0
- package/template/base/tanstack-start-with-tanstack-query/public/logo512.png +0 -0
- package/template/base/tanstack-start-with-tanstack-query/public/manifest.json +25 -0
- package/template/base/tanstack-start-with-tanstack-query/public/robots.txt +3 -0
- package/template/base/tanstack-start-with-tanstack-query/public/tanstack-circle-logo.png +0 -0
- package/template/base/tanstack-start-with-tanstack-query/public/tanstack-word-logo-white.svg +1 -0
- package/template/base/tanstack-start-with-tanstack-query/src/components/Header.tsx +21 -0
- package/template/base/tanstack-start-with-tanstack-query/src/instant.perms.ts +24 -0
- package/template/base/tanstack-start-with-tanstack-query/src/instant.schema.ts +50 -0
- package/template/base/tanstack-start-with-tanstack-query/src/lib/adminDb.ts +9 -0
- package/template/base/tanstack-start-with-tanstack-query/src/lib/db.ts +11 -0
- package/template/base/tanstack-start-with-tanstack-query/src/lib/instantQuery.ts +93 -0
- package/template/base/tanstack-start-with-tanstack-query/src/logo.svg +12 -0
- package/template/base/tanstack-start-with-tanstack-query/src/routeTree.gen.ts +104 -0
- package/template/base/tanstack-start-with-tanstack-query/src/router.tsx +108 -0
- package/template/base/tanstack-start-with-tanstack-query/src/routes/__root.tsx +76 -0
- package/template/base/tanstack-start-with-tanstack-query/src/routes/api/instant.ts +16 -0
- package/template/base/tanstack-start-with-tanstack-query/src/routes/index.tsx +231 -0
- package/template/base/tanstack-start-with-tanstack-query/src/routes/login.tsx +140 -0
- package/template/base/tanstack-start-with-tanstack-query/src/styles.css +17 -0
- package/template/base/tanstack-start-with-tanstack-query/tsconfig.json +28 -0
- package/template/base/tanstack-start-with-tanstack-query/vite.config.ts +33 -0
- package/template/base/vite-react/README.md +16 -0
- package/template/base/vite-react/_gitignore +26 -0
- package/template/base/vite-react/eslint.config.js +23 -0
- package/template/base/vite-react/index.html +13 -0
- package/template/base/vite-react/package.json +35 -0
- package/template/base/vite-react/public/favicon.svg +1 -0
- package/template/base/vite-react/src/App.tsx +167 -0
- package/template/base/vite-react/src/index.css +1 -0
- package/template/base/vite-react/src/instant.perms.ts +24 -0
- package/template/base/vite-react/src/instant.schema.ts +51 -0
- package/template/base/vite-react/src/lib/db.ts +8 -0
- package/template/base/vite-react/src/main.tsx +10 -0
- package/template/base/vite-react/tsconfig.app.json +25 -0
- package/template/base/vite-react/tsconfig.json +7 -0
- package/template/base/vite-react/tsconfig.node.json +24 -0
- package/template/base/vite-react/vite.config.ts +8 -0
- package/template/base/vite-vanilla/.env.example +2 -0
- package/template/base/vite-vanilla/README.md +17 -0
- package/template/base/vite-vanilla/_gitignore +25 -0
- package/template/base/vite-vanilla/index.html +13 -0
- package/template/base/vite-vanilla/package.json +20 -0
- package/template/base/vite-vanilla/pnpm-lock.yaml +707 -0
- package/template/base/vite-vanilla/public/vite.svg +1 -0
- package/template/base/vite-vanilla/src/instant.perms.ts +24 -0
- package/template/base/vite-vanilla/src/instant.schema.ts +50 -0
- package/template/base/vite-vanilla/src/lib/db.ts +11 -0
- package/template/base/vite-vanilla/src/main.ts +242 -0
- package/template/base/vite-vanilla/src/style.css +96 -0
- package/template/base/vite-vanilla/src/typescript.svg +1 -0
- package/template/base/vite-vanilla/src/vite-env.d.ts +1 -0
- package/template/base/vite-vanilla/tsconfig.json +24 -0
- package/template/base/vue-vite/README.md +15 -0
- package/template/base/vue-vite/_gitignore +43 -0
- package/template/base/vue-vite/env.d.ts +1 -0
- package/template/base/vue-vite/index.html +12 -0
- package/template/base/vue-vite/package.json +34 -0
- package/template/base/vue-vite/src/App.vue +238 -0
- package/template/base/vue-vite/src/assets/main.css +25 -0
- package/template/base/vue-vite/src/instant.perms.ts +24 -0
- package/template/base/vue-vite/src/instant.schema.ts +46 -0
- package/template/base/vue-vite/src/lib/db.ts +8 -0
- package/template/base/vue-vite/src/main.ts +6 -0
- package/template/base/vue-vite/tsconfig.app.json +15 -0
- package/template/base/vue-vite/tsconfig.json +11 -0
- package/template/base/vue-vite/tsconfig.node.json +27 -0
- package/template/base/vue-vite/vite.config.ts +16 -0
- package/template/rules/AGENTS.md +450 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
SidekickDB
|
|
2
|
+
https://github.com/SidekickDB/sidekick
|
|
3
|
+
|
|
4
|
+
SidekickDB is a modified version of InstantDB
|
|
5
|
+
(https://github.com/instantdb/instant), which was created by Instant and
|
|
6
|
+
its contributors and is licensed under the Apache License, Version 2.0. A
|
|
7
|
+
copy of the license is in LICENSE.md.
|
|
8
|
+
|
|
9
|
+
SidekickDB is an independent continuation of that code. It is not
|
|
10
|
+
affiliated with or endorsed by Instant. "Instant" and "InstantDB" are used
|
|
11
|
+
here only to say where the code comes from.
|
|
12
|
+
|
|
13
|
+
Files in this repository have been changed from the original. The
|
|
14
|
+
intentional changes are listed in UPSTREAM.md under "Intentional
|
|
15
|
+
divergences". Some of them are marked with a "SidekickDB:" comment in the
|
|
16
|
+
file; most changed files carry no per-file marker. Every change is recorded
|
|
17
|
+
in the git history, which also keeps the original authors of every upstream
|
|
18
|
+
commit.
|
|
19
|
+
|
|
20
|
+
The admin package contains a copy of eventsource
|
|
21
|
+
(https://github.com/EventSource/eventsource) by Espen Hovlandsdal and
|
|
22
|
+
contributors, as published in the @instantdb/eventsource 4.1.0-2 package,
|
|
23
|
+
which adds a "messageEvent" option, with one type taken from eventsource
|
|
24
|
+
5.1.5. It is in client/packages/admin/src/eventsource/ in the repository and
|
|
25
|
+
in src/eventsource/ in the @sidekickdb/admin package, and is licensed under
|
|
26
|
+
the MIT License, Copyright (c) EventSource GitHub organisation. The license
|
|
27
|
+
text is in the LICENSE file in that directory.
|
package/README.md
CHANGED
|
@@ -1,4 +1,31 @@
|
|
|
1
|
+
<!-- SidekickDB: plain-text header in place of upstream's logo, badges and links. -->
|
|
2
|
+
|
|
1
3
|
# create-sidekick-app
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
+
Part of [SidekickDB](https://github.com/SidekickDB/sidekick), an independent continuation of the Apache-2.0 InstantDB code. It is not affiliated with or endorsed by Instant.
|
|
6
|
+
|
|
7
|
+
Welcome to `create-sidekick-app`.
|
|
8
|
+
|
|
9
|
+
# Get Started
|
|
10
|
+
|
|
11
|
+
Run the command to spin up different apps!
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
INSTANT_CLI_API_URI=https://sidekick.example.com \
|
|
15
|
+
INSTANT_CLI_DASH_URI=https://dash.sidekick.example.com \
|
|
16
|
+
npx create-sidekick-app
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`INSTANT_CLI_API_URI` is required (there is no default server) and is written into the generated project. `INSTANT_CLI_DASH_URI` is needed to log in from the browser.
|
|
20
|
+
|
|
21
|
+
And you're ready to go!
|
|
22
|
+
|
|
23
|
+
# Development
|
|
24
|
+
|
|
25
|
+
Build or develop code with `pnpm run build` or `pnpm run dev`
|
|
26
|
+
|
|
27
|
+
Then link with pnpm: `pnpm link --global`
|
|
28
|
+
|
|
29
|
+
Now you can use the command anywhere! `create-sidekick-app`
|
|
30
|
+
|
|
31
|
+
Once you're done, you can unlink: `pnpm uninstall create-sidekick-app --global`
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var Ge=/^((?:[A-Z0-9]+_)*?)SIDEKICK_([A-Z0-9_]+)$/;function We(e){let t=Ge.exec(e);return t?`${t[1]}INSTANT_${t[2]}`:null}function ze(e=process.env){for(let[t,n]of Object.entries(e)){let r=We(t);!r||n===void 0||n.trim()===""||(e[r]=n)}}ze();import{Command as qe,Option as c}from"commander";import*as J from"@clack/prompts";import{spawn as Ke}from"child_process";import{execa as Je}from"execa";async function W(){return new Promise(e=>{let t=process.env.SHELL||"/bin/bash",n=Ke(t,["-i","-c","which claude"],{stdio:["ignore","pipe","ignore"]}),r="";n.stdout.on("data",a=>{r+=a.toString()}),n.on("close",a=>{if(a===0){let i=r.trim();i.includes("aliased to ")?e(i.split("aliased to ")[1]||null):e(i)}else e(null)})})}var re=async(e,t)=>{let n=await W();if(!n)throw new Error("Claude not found in path");await Je(n,[e],{stdio:"inherit",cwd:t})};import{version as Xe}from"@sidekickdb/version";import oe from"path";var ie=e=>(e.length>1&&e.endsWith("/")&&(e=e.slice(0,-1)),e),He=/^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/,ae=e=>{let n=ie(e).split("/"),r=n[n.length-1];if(r==="."){let o=oe.resolve(process.cwd());r=oe.basename(o)}let a=n.findIndex(o=>o.startsWith("@"));n.findIndex(o=>o.startsWith("@"))!==-1&&(r=n.slice(a).join("/"));let i=n.filter(o=>!o.startsWith("@")).join("/");return[r,i]},F=e=>e.trim(),z=e=>{let t=ie(e),n=t.split("/"),r=n.findIndex(i=>i.startsWith("@")),a=n[n.length-1];if(n.findIndex(i=>i.startsWith("@"))!==-1&&(a=n.slice(r).join("/")),!(t==="."||He.test(a??"")))return"App name must consist of only lowercase alphanumeric characters, '-', and '_'"};import{renderUnwrap as _,UI as g}from"@sidekickdb/cli/ui";var h=(e="src/lib/db.ts",t={})=>({type:"typescript",path:e,initializer:"init",websocket:!0,injectDevtoolConfig:t.injectDevtoolConfig??!0}),B=(e="init")=>({type:"typescript",path:"src/lib/adminDb.ts",initializer:e,websocket:!1,injectDevtoolConfig:!1}),T={"next-js-app-dir":{appIdEnvName:"NEXT_PUBLIC_INSTANT_APP_ID",backendConfigFiles:[h()],bundled:!0},"vite-react":{appIdEnvName:"VITE_INSTANT_APP_ID",backendConfigFiles:[h()],bundled:!0},"vite-vanilla":{appIdEnvName:"VITE_INSTANT_APP_ID",backendConfigFiles:[h()],bundled:!0},expo:{appIdEnvName:"EXPO_PUBLIC_INSTANT_APP_ID",backendConfigFiles:[h("lib/db.ts",{injectDevtoolConfig:!1})],bundled:!0},"tanstack-start":{appIdEnvName:"VITE_INSTANT_APP_ID",backendConfigFiles:[h(),B()],bundled:!0},"tanstack-start-with-tanstack-query":{appIdEnvName:"VITE_INSTANT_APP_ID",backendConfigFiles:[h(),B()],bundled:!0},"bun-react":{appIdEnvName:"BUN_PUBLIC_INSTANT_APP_ID",backendConfigFiles:[h()],bundled:!0},"solidjs-vite":{appIdEnvName:"VITE_INSTANT_APP_ID",backendConfigFiles:[h()],bundled:!0},sveltekit:{appIdEnvName:"VITE_INSTANT_APP_ID",backendConfigFiles:[h()],bundled:!0},"vue-vite":{appIdEnvName:"VITE_INSTANT_APP_ID",backendConfigFiles:[h()],bundled:!0},"vercel-ai-sdk":{appIdEnvName:"NEXT_PUBLIC_INSTANT_APP_ID",backendConfigFiles:[h(),B("initAdmin")],bundled:!1},"ai-chat":{appIdEnvName:"NEXT_PUBLIC_INSTANT_APP_ID",backendConfigFiles:[h(),B()],bundled:!0},"python-script":{appIdEnvName:"INSTANT_APP_ID",backendConfigFiles:[{type:"python",path:"main.py"}],bundled:!0}},Ye=["python-script","vercel-ai-sdk"],K=Object.keys(T).filter(e=>!Ye.includes(e)),Xt=K.filter(e=>T[e].bundled);var $={base:"next-js-app-dir",appName:"Awesome Todos",ruleFiles:null,createRepo:!0,prompt:null,app:null,token:null,yes:!1,temporary:!1},se=e=>e.base||e.viteReact&&"vite-react"||e.vanilla&&"vite-vanilla"||e.next&&"next-js-app-dir"||e.expo&&"expo"||e.sv&&"sveltekit"||e.vue&&"vue-vite"||null,pe=e=>e.cursor&&"cursor"||e.claude&&"claude"||e.codex&&"codex"||e.gemini&&"gemini"||e.rules&&"codex"||null,le=async()=>{let e=$,t=new qe().name("create-sidekick-app").description("A CLI for creating web/mobile applications with SidekickDB").argument("[dir]","The name of the application, as well as the name of the directory to create").addOption(new c("-b --base <template>","The base template to scaffold from").choices(K)).addOption(new c("-g --git","Create a git repo in the new project").default(!0)).addOption(new c("--expo","Use the Expo starter template").default(!1)).addOption(new c("--next","Use the NextJS starter template").default(!1)).addOption(new c("--vanilla","Use the vanilla JS starter template").default(!1)).addOption(new c("--vite-react","Use the Vite + React starter template").default(!1)).addOption(new c("--sv","Use the SvelteKit starter template").default(!1)).addOption(new c("--vue","Use the Vue + Vite starter template").default(!1)).addOption(new c("--no-git","Don't create a git repo in the new project")).addOption(new c("--cursor","Include a Cursor rules file in the scaffold")).addOption(new c("--claude","Include a CLAUDE.md file in the scaffold")).addOption(new c("--codex","Include an AGENTS.md file in the scaffold")).addOption(new c("--gemini","Include a GEMINI.md file in the scaffold")).addOption(new c("--rules","Include an AGENTS.md file in the scaffold")).addOption(new c("--ai","Create a new SidekickDB app based off of a prompt. (requires Claude Code)")).addOption(new c("-a --app <app-id>","Link to an existing SidekickDB app by ID (requires login or --token)")).addOption(new c("-t --token <token>","Auth token override (use with --app when not logged in)")).addOption(new c("-y --yes","Use all defaults (requires project name as first argument)").default(!1)).addOption(new c("--temp","Create a temporary app by default").default(!1)).version(Xe).parse(process.argv),n=t.args[0]&&F(t.args[0]);if(n){let i=z(n);if(i)throw new Error("Invalid app name: "+i);e.appName=n}let r=t.opts();if(r.app&&r.temp)throw new Error("--app and --temp cannot be used together");if(r.yes){if(r.ai)throw new Error("--yes is not supported with --ai");if(!n)throw new Error(`When using --yes, you must specify a project name as the first argument.
|
|
3
|
+
Usage: npx create-sidekick-app my-app --yes`);return{...$,appName:n,base:se(r)??$.base,ruleFiles:pe(r)??"claude",createRepo:r.git??$.createRepo,app:r.app??null,token:r.token??null,yes:!0,temporary:r.temp??!1}}if(r.ai&&!await W())throw new Error("--ai only works with Claude Code, but we couldn't find it in your machine. Install it first, and run it again : ). Alternatively you can scaffold out a project without --ai");return{...await J.group({appName:async()=>{if(n)return n.trim();let i=await _(new g.TextInput({prompt:"What will your project/folder be called?",placeholder:"awesome-todos",defaultValue:"awesome-todos",validate:s=>z(F(s)),modifyOutput:g.ciaModifier()}));return F(i)},prompt:async()=>r.ai?await _(new g.TextInput({prompt:"What would you like to create?",placeholder:"Create an app that...",modifyOutput:g.modifiers.piped([g.ciaModifier()])})):null,base:async({results:i})=>{let o=se(r);return o||(i.prompt?_(new g.Select({promptText:"What framework would you like to use?",options:[{value:"next-js-app-dir",label:"Web: Next.js"},{value:"vite-react",label:"Web: Vite React"},{value:"expo",label:"Mobile: Expo"}],defaultValue:"next-js-app-dir",modifyOutput:g.modifiers.piped([g.ciaModifier()])})):_(new g.Select({promptText:"What framework would you like to use?",options:[{value:"next-js-app-dir",label:"Web: Next.js"},{value:"expo",label:"Mobile: Expo"},{value:"vite-react",label:"Vite: React",secondary:!0},{value:"vite-vanilla",label:"Vite: Vanilla TS",secondary:!0},{value:"tanstack-start",label:"Tanstack Start",secondary:!0},{value:"bun-react",label:"Bun + React",secondary:!0},{value:"solidjs-vite",label:"Vite: SolidJS",secondary:!0},{value:"sveltekit",label:"SvelteKit",secondary:!0},{value:"vue-vite",label:"Vite: Vue",secondary:!0},{value:"ai-chat",label:"Vercel AI SDK Chat App",secondary:!0}],defaultValue:"next-js-app-dir",modifyOutput:g.modifiers.piped([g.ciaModifier()])})))},ruleFiles:async({results:i})=>{if(i.prompt)return"claude";let o=pe(r);return o||_(new g.Select({promptText:"Which AI tool would you like to add rule files for?",options:[{value:"claude",label:"Claude"},{value:"cursor",label:"Cursor"},{value:"codex",label:"Codex"},{value:"gemini",label:"Gemini"},{value:"zed",label:"Zed"},{value:"windsurf",label:"Windsurf"},{value:null,label:"None"}],defaultValue:"claude",modifyOutput:g.ciaModifier()}))},createRepo:async()=>r.git!==void 0?r.git:!0,temporary:async()=>r.temp??!1},{onCancel(){process.exit(1)}}),app:r.app??null,token:r.token??null,yes:!1}};import ee from"path";import G from"fs-extra";import{log as Me,outro as Vt}from"@clack/prompts";import{intro as Ze}from"@clack/prompts";import Qe from"chalk";var ce=()=>{Ze(Qe.bold(" SidekickDB "))};import m from"path";import rt from"tiged";import d from"fs-extra";import de from"path";import{fileURLToPath as et}from"url";var tt=et(import.meta.url),nt=de.dirname(tt),D=de.join(nt,"../");import S from"chalk";var U=e=>{if(e==="bun-react")return"bun";let t=process.env.npm_config_user_agent;return t?t.startsWith("yarn")?"yarn":t.startsWith("pnpm")?"pnpm":t.startsWith("bun")?"bun":"npm":"npm"};import{renderUnwrap as ue,UI as w}from"@sidekickdb/cli/ui";import ot from"slugify";import it from"ignore";var me=async(e,t)=>{let n=m.resolve(process.cwd(),t);if(d.existsSync(n))if(d.readdirSync(n).length===0)w.log(`${S.cyan.bold(e.appName)} exists but is empty, continuing...`,w.ciaModifier(null));else{let i=await ue(new w.Select({promptText:S.redBright(`${S.bold("Warning:")} ${S.bold(e.appName)} already exists and isn't empty. How would you like to proceed?`),options:[{label:"Abort installation",value:"abort"},{label:"Clear the directory and continue installation",value:"clear"}],defaultValue:"abort",modifyOutput:w.ciaModifier()}));i==="abort"&&(w.log("Aborting installation..."),process.exit(1)),i==="clear"&&d.emptyDirSync(n)}let r=pt({projectDir:n,baseTemplateName:e.base}),a=e.appName==="."?"App":S.hex("#EA570B").bold(e.appName);if(await ue(new w.Spinner({promise:r,workingText:"Scaffolding project files...",doneText:`Successfully scaffolded ${a}!`,errorText:"Error scaffolding project files",modifyOutput:w.ciaModifier(null)})),d.pathExistsSync(m.join(n,"pnpm-lock.yaml"))&&d.removeSync(m.join(n,"pnpm-lock.yaml")),d.pathExistsSync(m.join(n,"bun.lock"))&&d.removeSync(m.join(n,"bun.lock")),U(e.base)==="pnpm"&&e.base==="expo"&&await d.appendFile(m.join(n,".npmrc"),`node-linker=hoisted
|
|
4
|
+
enable-pre-post-scripts=true`),e.base==="expo"){let i=ot.default(t);H(m.join(n,"app.json"),'"name": "expo-template"',`"name": "${t}"`),H(m.join(n,"app.json"),'"slug": "expo-template"',`"slug": "${i}"`),H(m.join(n,"app/_layout.tsx"),'"My SidekickDB App"',`"${t}"`)}return n},H=(e,t,n)=>{let a=d.readFileSync(e,"utf8").replaceAll(t,n);d.writeFileSync(e,a)},at=async({projectDir:e,baseTemplateName:t})=>{let n=`SidekickDB/sidekick/examples/${t}`;await rt(n,{mode:"tar",disableCache:!0}).clone(e)};async function st(e,t){let n=it();n.add(".git");try{let r=m.join(e,".gitignore"),a=await d.readFile(r,"utf8");n.add(a)}catch{}await d.copy(e,t,{filter:r=>{let a=m.relative(e,r);return a===""?!0:!n.ignores(a)}})}var pt=async({projectDir:e,baseTemplateName:t})=>{let n=m.join(D,`template/base/${t}`),r=!!process.env.INSTANT_CLI_DEV&&!!process.env.INSTANT_REPO_FOLDER,a=d.pathExistsSync(n),i=r?"dev":a?"bundled-template":"tiged";if(i==="bundled-template"){d.copySync(n,e);let o=m.join(e,"_gitignore"),s=m.join(e,".gitignore");d.pathExistsSync(o)&&d.renameSync(o,s);return}if(i==="dev"){let o=process.env.INSTANT_REPO_FOLDER;if(!o)throw new Error("INSTANT_REPO_FOLDER is required when using repo-examples scaffolding.");let s=m.join(o,"examples",t);await st(s,e);return}process.env.INSTANT_CLI_DEV&&!process.env.INSTANT_REPO_FOLDER&&w.log(S.bold.yellowBright(`WARNING: INSTANT_CLI_DEV is TRUE but no INSTANT_REPO_FOLDER is set.
|
|
5
|
+
Using git to clone from main...`),w.ciaModifier(null)),await at({projectDir:e,baseTemplateName:t})};import{execa as lt}from"execa";import{renderUnwrap as ct,UI as M}from"@sidekickdb/cli/ui";var fe=async(e,t)=>{let n=lt(e,["install"],{cwd:t}),r=await ct(new M.Spinner({promise:n,workingText:`Installing dependencies with ${e}...`,doneText:"Successfully installed dependencies!",modifyOutput:M.ciaModifier(null)}));r.exitCode!==0&&(M.log(r.stderr,M.ciaModifier(null)),process.exit(1))};import te from"chalk";import dt from"fs-extra";import ge from"path";var ut={claude:"CLAUDE.md",gemini:"GEMINI.md",cursor:"AGENTS.md",codex:"AGENTS.md",zed:"AGENTS.md",windsurf:"AGENTS.md"},he=({projectDir:e,ruleFilesToAdd:t})=>{t!==null&&dt.copyFileSync(ge.join(D,"template/rules/AGENTS.md"),ge.join(e,ut[t]))};import{execSync as q}from"child_process";import Y from"path";import*as we from"@clack/prompts";import L from"chalk";import{execa as v}from"execa";import ke from"fs-extra";import{renderUnwrap as ye,UI as x}from"@sidekickdb/cli/ui";var mt=e=>{try{return q("git --version",{cwd:e}),!0}catch{return!1}},ft=e=>ke.existsSync(Y.join(e,".git")),gt=async e=>{try{return await v("git",["rev-parse","--is-inside-work-tree"],{cwd:e,stdout:"ignore"}),!0}catch{return!1}},ht=()=>{let t=q("git --version").toString().trim().split(" ")[2],n=t?.split(".")[0],r=t?.split(".")[1];return{major:Number(n),minor:Number(r)}},yt=()=>q("git config --global init.defaultBranch || echo main").toString().trim(),be=async e=>{if(!mt(e)){we.log.warn("Git is not installed. Skipping Git initialization.");return}let t=ft(e),n=await gt(e),r=Y.parse(e).name;if(n&&t){if(!await ye(new x.Confirmation({promptText:`${L.redBright.bold("Warning:")} Git is already initialized in "${r}". Initializing a new git repository would delete the previous history. Would you like to continue anyways?`,defaultValue:!1,modifyOutput:x.ciaModifier()})))return;ke.removeSync(Y.join(e,".git"))}else if(n&&!t&&!await ye(new x.Confirmation({promptText:`${L.redBright.bold("Warning:")} "${r}" is already in a git worktree.
|
|
6
|
+
Would you still like to initialize a new git repository in this directory?
|
|
7
|
+
`,defaultValue:!1,modifyOutput:x.ciaModifier()})))return;try{let a=yt(),{major:i,minor:o}=ht();i<2||i==2&&o<28?(await v("git",["init"],{cwd:e}),await v("git",["symbolic-ref","HEAD",`refs/heads/${a}`],{cwd:e})):await v("git",["init",`--initial-branch=${a}`],{cwd:e}),await v("git",["add","."],{cwd:e}),await v("git",["commit","-m","Initial commit (create-sidekick-app)"],{cwd:e}),x.log(L.dim(`${L.green("\u2713")} Git repository initialized successfully.`),x.ciaModifier(null))}catch{}};import bt from"open";import{randomUUID as Se}from"node:crypto";import{version as wt}from"@sidekickdb/version";var Ie=!!process.env.INSTANT_CLI_DEV,A=process.env.INSTANT_CLI_DASH_URI||(Ie?"http://localhost:3000":null),P=process.env.INSTANT_CLI_API_URI||(Ie?"http://localhost:8888":null),X="No SidekickDB server URL configured. Set the SIDEKICK_CLI_API_URI environment variable (or its older name, INSTANT_CLI_API_URI), for example SIDEKICK_CLI_API_URI=https://sidekick.example.com. SidekickDB has no default server.",kt="No SidekickDB dashboard URL configured. Set the SIDEKICK_CLI_DASH_URI environment variable (or its older name, INSTANT_CLI_DASH_URI), for example SIDEKICK_CLI_DASH_URI=https://dash.sidekick.example.com. SidekickDB has no default dashboard.";function E(){if(!P)throw new Error(X);return P}function Te(){if(!A)throw new Error(kt);return A}async function k({path:e,body:t,method:n="GET",authToken:r,metadata:a}){let o={"Content-Type":"application/json","X-Instant-Source":"create-instant-app","X-Instant-Version":wt,"X-Instant-Command":"create"};r&&(o.Authorization=`Bearer ${r}`),a&&(o["X-Instant-Metadata"]=JSON.stringify(a));let s=await fetch(`${E()}${e}`,{method:n??"GET",headers:o,body:t?JSON.stringify(t):void 0,signal:AbortSignal.timeout(3e5)}),p;try{p=await s.json()}catch{p=null}if(!s.ok){let l=p.message||p.hint?.errors?.[0]?.message||"There was an error";throw new Error(l)}return p}import{renderUnwrap as O,UI as u}from"@sidekickdb/cli/ui";import{readAuthToken as It,writeAuthToken as Tt}from"@sidekickdb/cli/auth";function b(e){return e.replace(/[-_]/g," ").replace(/\b\w/g,t=>t.toUpperCase())}var St=!!process.env.INSTANT_CLI_FORCE_EPHEMERAL,xe=async(e,t,n,r)=>{let a=Se(),i=Se(),o={id:a,title:e,admin_token:i,org_id:n};return r?.rules&&(o.rules=r.rules),r?.schema&&(o.schema=r.schema),await k({method:"POST",authToken:t,path:"/dash/apps",body:o,metadata:r}),{appId:a,adminToken:i,source:"created"}},Z=(e,t,n)=>{k({method:"POST",path:`/dash/apps/${e}/track-import`,authToken:t,metadata:n}).catch(()=>{})},ve=async e=>await k({method:"GET",path:"/dash",authToken:e}),Ae=async(e,t)=>await k({method:"GET",path:`/dash/orgs/${t}`,authToken:e});var xt=async(e,t)=>{try{let n=await ve(e),r=n.apps.find(a=>a.id===t);if(r)return{appId:r.id,adminToken:r.admin_token};for(let a of n.orgs){let{apps:i}=await Ae(e,a.id),o=i.find(s=>s.id===t);if(o)return{appId:o.id,adminToken:o.admin_token}}return null}catch{return null}},vt=async(e,t)=>{try{return await k({method:"GET",path:`/dash/apps/${e}/schema/pull`,authToken:t}),!0}catch{return!1}},At=async()=>St?null:process.env.INSTANT_CLI_AUTH_TOKEN?process.env.INSTANT_CLI_AUTH_TOKEN:It(E()).catch(()=>null),V=async(e,t)=>{let n=await k({authToken:null,method:"POST",path:"/dash/apps/ephemeral",body:{title:e,schema:t?.schema,rules:{$users:{view:"true"},$files:{allow:{view:"true",create:"true",delete:"true"}}}},metadata:t});return{appId:n.app.id,adminToken:n.app["admin-token"]}},Pe=async(e,t,n)=>{let r=await At();if(t?.yes&&!t?.app)if(r&&!t.temporary){let{appId:s,adminToken:p}=await xe(b(e),r,void 0,n);return{appId:s,adminToken:p,approach:"create"}}else{let{appId:s,adminToken:p}=await V(b(e),n);return{appId:s,adminToken:p,approach:"ephemeral"}}if(t?.temporary){let s=await O(new u.TextInput({defaultValue:b(e),prompt:"Enter a name for your temporary app:",placeholder:b(e),modifyOutput:u.ciaModifier()}));return{...await V(s,n),approach:"ephemeral"}}if(t?.app){if(t.token){if(!await vt(t.app,t.token))throw new Error("Invalid app ID and token combination. Please verify both the app ID and token are correct.");return u.log(`Linking to app: ${t.app}`,u.ciaModifier(null)),Z(t.app,t.token,n),{appId:t.app,adminToken:t.token,approach:"import"}}if(r){let s=await xt(r,t.app);if(!s)throw new Error(`You don't have access to app "${t.app}". Please check the app ID or use --token to provide a token.`);return u.log(`Linking to app: ${t.app}`,u.ciaModifier(null)),Z(s.appId,r,n),{appId:s.appId,adminToken:s.adminToken,approach:"import"}}throw new Error(`You must be logged in or provide --token when using --app. Either run 'npx @sidekickdb/cli login' first, or use: --app ${t.app} --token <token>`)}if(!r){let s=await O(new u.Select({promptText:"You are not logged in.",options:[{label:"Login to your SidekickDB account",value:"login"},{label:"Create a temporary app",value:"ephemeral"},{label:"Create an app later",value:"skip"}],modifyOutput:u.ciaModifier()}));if(s==="login"){let p=Te(),l=await k({authToken:null,method:"POST",path:"/dash/cli/auth/register"}).catch(Ve=>{throw new Error("Failed to register",{cause:Ve})}),{secret:y,ticket:C}=l;bt(`${p}/dash?ticket=${C}`);let Le=Nt({secret:y}),ne=await O(new u.Spinner({promise:Le,workingText:"Waiting for login in browser",disappearWhenDone:!0,modifyOutput:u.ciaModifier(null)}));await Ct(ne.token),r=ne.token}if(s==="skip")return u.log("Skipping app link step",u.ciaModifier(null)),null;if(s==="ephemeral"){let p=await O(new u.TextInput({defaultValue:b(e),prompt:"Enter a name for your temporary app:",placeholder:b(e),modifyOutput:u.ciaModifier()}));return{...await V(p,n),approach:"ephemeral"}}}if(!r)return null;let a=await ve(r).catch(s=>{throw new Error("Failed to fetch dashboard",{cause:s})}),i=a.orgs.filter(s=>s.role!=="app-member");a.orgs=i;let o=await O(new u.AppSelector({startingMenuIndex:0,defaultAppName:b(e),allowCreate:!0,allowEphemeral:!0,api:{getDash(){return a},createEphemeralApp(s){return V(s,n)},getAppsForOrg:async s=>{let{apps:p}=await Ae(r,s);return{apps:p}},createApp:async(s,p)=>{let{appId:l,adminToken:y}=await xe(s,r,p,n);return{appId:l,adminToken:y}}},modifyOutput:u.ciaModifier()}));return o?.approach==="import"&&Z(o.appId,r,n),o};function Pt(e){return new Promise(t=>setTimeout(t,e))}async function Nt({secret:e}){for(let t=1;t<=120;t++){await Pt(1e3);let n=await fetch(`${E()}/dash/cli/auth/check`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({secret:e})});if(!(!n.ok&&(await n.json()).hint.errors?.[0]?.issue==="waiting-for-user")&&n.ok)return n.json()}throw new Error("Timed out waiting for login")}async function Ct(e){return Tt(E(),e)}import _t from"fs-extra";import Et from"path";var Ne=(e,t,n,r)=>{let a=Et.join(t,".env"),o=`${T[e].appIdEnvName}=${n}
|
|
8
|
+
INSTANT_APP_ADMIN_TOKEN=${r}`;_t.writeFileSync(a,o)};import{stdin as I,stdout as Ce}from"process";import{setRawModeWindowsFriendly as _e}from"@sidekickdb/cli/ui";async function Ot(){return new Promise(e=>{if(!Ce.isTTY||!I.isTTY){e(null);return}let t=I.isRaw;t||_e(I,!0);let n=setTimeout(()=>{a(),e(null)},100),r="",a=()=>{clearTimeout(n),I.removeListener("data",i),!t&&I.isTTY&&_e(I,!1)},i=o=>{let s=o.toString();r+=s;let p=r.match(/\x1b\]11;rgb:([0-9a-fA-F]+)\/([0-9a-fA-F]+)\/([0-9a-fA-F]+)(?:\x1b\\|\x07)/);if(p){a();let[,l,y,C]=p;e(`rgb:${l}/${y}/${C}`)}};I.on("data",i),Ce.write("\x1B]11;?\x1B\\")})}function jt(e){let t=e.match(/rgb:([0-9a-fA-F]+)\/([0-9a-fA-F]+)\/([0-9a-fA-F]+)/);if(!t)return null;let[,n,r,a]=t,i=Math.round(parseInt(n,16)/257),o=Math.round(parseInt(r,16)/257),s=Math.round(parseInt(a,16)/257);return{r:i,g:o,b:s}}function Rt(e){return(.299*e.r+.587*e.g+.114*e.b)/255>.5}async function Ee(){try{let e=await Ot();if(!e)return"unknown";let t=jt(e);return t?Rt(t)?"light":"dark":"unknown"}catch(e){return console.error("Error detecting terminal theme:",e),"unknown"}}import j from"chalk";var f=(e,t)=>e==="light"?j.bgYellowBright(t):j.bgBlackBright(t),Oe=(e,t=console.log,n=!1)=>{let r=(process.stdout.columns||80)-4,a=e.split(`
|
|
9
|
+
`),i=!0;a.forEach(o=>{if(o.length===0){i?(t(""),i=!1):console.log(j.gray("\u2502"));return}for(let s=0;s<o.length;s+=r){let p=o.slice(s,s+r);s+r<o.length&&p.length===r&&(p=p+"-"),i?(t(p),i=!1):console.log(j.gray("\u2502 ")+p)}}),n&&console.log(j.gray("\u2502"))};var R="\x1B[?25h";import{execa as Gt}from"execa";import je from"fs-extra";import{permsTypescriptFileToCode as Ft,schemaTypescriptFileToInstantSchema as Bt}from"@sidekickdb/platform";function Re(e){for(let t of["src/sidekick.perms.ts","sidekick.perms.ts","src/instant.perms.ts","instant.perms.ts"])try{let n=je.readFileSync(`${e}/${t}`,"utf8");return{code:Ft(n,t)}}catch{}return null}function Fe(e){for(let t of["src/sidekick.schema.ts","sidekick.schema.ts","src/instant.schema.ts","instant.schema.ts"])try{let n=je.readFileSync(`${e}/${t}`,"utf8");return Bt(n,t)}catch{}return null}import{UI as N}from"@sidekickdb/cli/ui";var Be=e=>{if(e){if(e.approach==="import"){N.log(`Imported app with App ID: ${e.appId}`,N.ciaModifier());return}e.approach==="create"&&N.log(`Created new app with App ID: ${e.appId}`,N.ciaModifier()),e.approach==="ephemeral"&&N.log(`Created temporary app with App ID: ${e.appId}`,N.ciaModifier())}};import Q from"fs-extra";import $e from"path";var De=e=>e.replace(/\/+$/,""),$t=(e,t)=>`export default {
|
|
10
|
+
${[` apiURI: ${JSON.stringify(e)},`,t?` dashURI: ${JSON.stringify(t)},`:null].filter(Boolean).join(`
|
|
11
|
+
`)}
|
|
12
|
+
};
|
|
13
|
+
`,Dt=e=>{let t;try{t=new URL(De(e))}catch{throw new Error("INSTANT_CLI_API_URI must be a valid HTTP(S) URL")}if(t.protocol==="http:")t.protocol="ws:";else if(t.protocol==="https:")t.protocol="wss:";else throw new Error("INSTANT_CLI_API_URI must be a valid HTTP(S) URL");return t.pathname=`${t.pathname.replace(/\/+$/,"")}/runtime/session`,t.search="",t.hash="",t.toString()},Ut=({contents:e,initializer:t,apiURI:n,websocketURI:r,dashURI:a})=>{let i=`${t}({`;if(!e.includes(i))throw new Error(`Could not find ${i} in scaffolded database file`);let o=[` apiURI: ${JSON.stringify(n)},`,r?` websocketURI: ${JSON.stringify(r)},`:null,a?` devtool: {
|
|
14
|
+
dashURI: ${JSON.stringify(a)},
|
|
15
|
+
},`:null].filter(Boolean).join(`
|
|
16
|
+
`);return e.replace(i,`${i}
|
|
17
|
+
${o}`)},Mt=(e,t)=>{let n="db = Instant()";if(!e.includes(n))throw new Error(`Could not find ${n} in scaffolded database file`);return e.replace(n,`db = Instant(api_uri=${JSON.stringify(t)})`)},Lt=(e,t,n,r,a)=>e.type==="python"?Mt(t,n):Ut({contents:t,initializer:e.initializer,apiURI:n,websocketURI:e.websocket?r:void 0,dashURI:e.injectDevtoolConfig?a:void 0}),Ue=(e,t,n,r)=>{let a=De(n),i=Dt(a),o=T[e].backendConfigFiles.map(s=>{let p=$e.join(t,s.path),l=Q.readFileSync(p,"utf8");return{filePath:p,contents:Lt(s,l,a,i,r)}});for(let s of o)Q.writeFileSync(s.filePath,s.contents);Q.writeFileSync($e.join(t,"instant.config.ts"),$t(a,r))};var Wt=async()=>{process.argv.some(l=>["-h","--help","--version","-V"].includes(l))||(ce(),P||(console.error(te.red(X)),process.exit(1)));let e=await Ee(),t=await le(),[n,r]=ae(t.appName),a=t.base==="python-script",i=U(t.base),o=await me(t,r);P&&Ue(t.base,o,P,A??void 0),he({projectDir:o,ruleFilesToAdd:t.ruleFiles});let s={template:t.base,aiTool:t.ruleFiles??"none",usedAiPrompt:!!t.prompt,rules:Re(o),schema:Fe(o)},p=await Pe(r==="."?n:r,t,s);if(Be(p),p&&Ne(t.base,o,p.appId,p.adminToken),a){let l=n.replace(/^@/,"").replace(/\//g,"-"),y=ee.join(o,"pyproject.toml"),C=G.readFileSync(y,"utf-8");G.writeFileSync(y,C.replace(/^name = .*$/m,`name = "${l}"`))}else{let l=G.readJSONSync(ee.join(o,"package.json"));if(l.name=n,i!=="bun"){let{stdout:y}=await Gt(i,["-v"],{cwd:o});l.packageManager=`${i}@${y.trim()}`}G.writeJSONSync(ee.join(o,"package.json"),l,{spaces:2}),await fe(i,o)}if(t.createRepo&&await be(o),t.prompt&&(await re(t.prompt,o),process.stdout.write(R)),Vt("Done!"),a)p?(console.log(`
|
|
18
|
+
\u{1F389} Success! Your project is ready to go!
|
|
19
|
+
|
|
20
|
+
To get started:
|
|
21
|
+
1. ${f(e,"cd "+r)}
|
|
22
|
+
2. ${f(e,"uv sync")}
|
|
23
|
+
3. ${f(e,"uv run python main.py")}
|
|
24
|
+
|
|
25
|
+
To push schema and permissions:
|
|
26
|
+
${f(e,"npx @sidekickdb/cli push")}
|
|
27
|
+
`),p.approach==="ephemeral"&&console.log(`
|
|
28
|
+
An ephemeral app has been created and added to your .env file.
|
|
29
|
+
It will expire in two weeks. For a permanent app, sign in and use ${f(e,"npx @sidekickdb/cli claim")}
|
|
30
|
+
`)):console.log(`
|
|
31
|
+
\u{1F389} Success! Your project is ready to go!
|
|
32
|
+
|
|
33
|
+
To get started:
|
|
34
|
+
1. ${f(e,"cd "+r)}
|
|
35
|
+
2. Create a new app on ${te.underline(A??"your SidekickDB dashboard")}
|
|
36
|
+
3. Add your APP_ID and admin token to the .env file
|
|
37
|
+
4. ${f(e,"uv sync")}
|
|
38
|
+
5. ${f(e,"uv run python main.py")}
|
|
39
|
+
|
|
40
|
+
To push schema and permissions:
|
|
41
|
+
${f(e,"npx @sidekickdb/cli push")}
|
|
42
|
+
`);else{let l=t.base==="expo"?"start":"dev";p?(console.log(`
|
|
43
|
+
\u{1F389} Success! Your project is ready to go!
|
|
44
|
+
|
|
45
|
+
To get started:
|
|
46
|
+
1. ${f(e,"cd "+r)}
|
|
47
|
+
2. ${f(e,i+" run "+l)}
|
|
48
|
+
`),p.approach==="ephemeral"&&console.log(`
|
|
49
|
+
An ephemeral app has been created and added to your .env file.
|
|
50
|
+
It will expire in two weeks. For a permanent app, sign in and use ${f(e,"npx @sidekickdb/cli claim")}
|
|
51
|
+
`)):console.log(`
|
|
52
|
+
\u{1F389} Success! Your project is ready to go!
|
|
53
|
+
|
|
54
|
+
To get started:
|
|
55
|
+
1. ${f(e,"cd "+r)}
|
|
56
|
+
2. Create a new app on ${te.underline(A??"your SidekickDB dashboard")}
|
|
57
|
+
3. Add your APP_ID to the .env file
|
|
58
|
+
4. ${f(e,i+" run "+l)}
|
|
59
|
+
`)}process.stdout.write(R),process.exit(0)};Wt().catch(e=>{Me.error("Aborting installation..."),Oe(e.message,Me.error),process.stdout.write(R),process.exit(1)});process.on("SIGINT",()=>{process.stdout.write(R),process.exit(0)});
|
package/package.json
CHANGED
|
@@ -1,11 +1,72 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-sidekick-app",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
3
|
+
"version": "2.0.1",
|
|
4
|
+
"description": "Scaffold a new web/mobile app with SidekickDB",
|
|
5
|
+
"homepage": "https://sidekickdb.co/docs/create-instant-app",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git+https://github.com/SidekickDB/sidekick.git",
|
|
9
9
|
"directory": "client/packages/create-instant-app"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/SidekickDB/sidekick/issues"
|
|
13
|
+
},
|
|
14
|
+
"type": "module",
|
|
15
|
+
"exports": "./dist/index.js",
|
|
16
|
+
"bin": {
|
|
17
|
+
"create-sidekick-app": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist",
|
|
21
|
+
"template",
|
|
22
|
+
"README.md",
|
|
23
|
+
"package.json",
|
|
24
|
+
"LICENSE.md",
|
|
25
|
+
"NOTICE"
|
|
26
|
+
],
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@clack/core": "^0.5.0",
|
|
29
|
+
"@clack/prompts": "^0.11.0",
|
|
30
|
+
"@ianvs/prettier-plugin-sort-imports": "^4.2.1",
|
|
31
|
+
"chalk": "5.2.0",
|
|
32
|
+
"commander": "^10.0.1",
|
|
33
|
+
"execa": "^7.2.0",
|
|
34
|
+
"fs-extra": "^11.3.1",
|
|
35
|
+
"gradient-string": "^2.0.2",
|
|
36
|
+
"ignore": "^7.0.5",
|
|
37
|
+
"open": "^10.1.0",
|
|
38
|
+
"ora": "6.3.1",
|
|
39
|
+
"slugify": "^1.6.6",
|
|
40
|
+
"sort-package-json": "^2.10.0",
|
|
41
|
+
"tiged": "^2.12.7",
|
|
42
|
+
"@sidekickdb/platform": "2.0.1",
|
|
43
|
+
"@sidekickdb/version": "2.0.1",
|
|
44
|
+
"@sidekickdb/cli": "2.0.1"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@anthropic-ai/sdk": "^0.60.0",
|
|
48
|
+
"@types/degit": "^2.8.6",
|
|
49
|
+
"@types/fs-extra": "^11.0.4",
|
|
50
|
+
"@types/node": "^18.11.18",
|
|
51
|
+
"tsup": "^6.7.0",
|
|
52
|
+
"type-fest": "^4.41.0",
|
|
53
|
+
"typescript": "^5.9.3",
|
|
54
|
+
"vitest": "^4.1.2"
|
|
55
|
+
},
|
|
56
|
+
"keywords": [],
|
|
57
|
+
"author": "",
|
|
58
|
+
"license": "ISC",
|
|
59
|
+
"scripts": {
|
|
60
|
+
"typecheck": "tsc --noEmit",
|
|
61
|
+
"prebuild": "pnpm run copy-examples",
|
|
62
|
+
"build": "tsup",
|
|
63
|
+
"dev": "tsup --watch",
|
|
64
|
+
"copy-examples": "tsx scripts/copyExamples.ts",
|
|
65
|
+
"test": "vitest --project unit",
|
|
66
|
+
"test:e2e": "vitest --project e2e",
|
|
67
|
+
"test:ci": "vitest run",
|
|
68
|
+
"clean": "rm -rf dist .turbo node_modules",
|
|
69
|
+
"publish-package": "pnpm pack && npm publish *.tgz --access public",
|
|
70
|
+
"start": "node dist/index.js"
|
|
10
71
|
}
|
|
11
|
-
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# AI Chat
|
|
2
|
+
|
|
3
|
+
A multi-conversation chat app built with the Vercel AI SDK and SidekickDB Streams.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Streams AI responses to the browser via SidekickDB streams
|
|
8
|
+
- Resumes in-progress streams on page reload (no lost responses)
|
|
9
|
+
- Persists chat history and messages in SidekickDB
|
|
10
|
+
- Multi-conversation support with a sidebar
|
|
11
|
+
- Works out of the box with a mock Wikipedia model (no API key needed)
|
|
12
|
+
|
|
13
|
+
## Setup
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm install
|
|
17
|
+
npx @sidekickdb/cli push
|
|
18
|
+
pnpm dev
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Environment variables
|
|
22
|
+
|
|
23
|
+
| Variable | Required | Description |
|
|
24
|
+
| ---------------------------- | -------- | ---------------------------------------------------------------- |
|
|
25
|
+
| `NEXT_PUBLIC_INSTANT_APP_ID` | yes | SidekickDB app ID |
|
|
26
|
+
| `INSTANT_APP_ADMIN_TOKEN` | yes | SidekickDB admin token for server-side operations |
|
|
27
|
+
| `ANTHROPIC_API_KEY` | no | Anthropic API key (preferred). Falls back to mock model if unset |
|
|
28
|
+
| `OPENAI_API_KEY` | no | OpenAI API key. Falls back to mock model if unset |
|
|
29
|
+
|
|
30
|
+
## Scripts
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pnpm dev # Start dev server
|
|
34
|
+
pnpm build # Production build
|
|
35
|
+
pnpm start # Start production server
|
|
36
|
+
pnpm typecheck # Type-check without emitting
|
|
37
|
+
pnpm format # Format with Prettier
|
|
38
|
+
```
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
|
2
|
+
|
|
3
|
+
# dependencies
|
|
4
|
+
/node_modules
|
|
5
|
+
/.pnp
|
|
6
|
+
.pnp.*
|
|
7
|
+
.yarn/*
|
|
8
|
+
!.yarn/patches
|
|
9
|
+
!.yarn/plugins
|
|
10
|
+
!.yarn/releases
|
|
11
|
+
!.yarn/versions
|
|
12
|
+
|
|
13
|
+
# testing
|
|
14
|
+
/coverage
|
|
15
|
+
|
|
16
|
+
# next.js
|
|
17
|
+
/.next/
|
|
18
|
+
/out/
|
|
19
|
+
|
|
20
|
+
# production
|
|
21
|
+
/build
|
|
22
|
+
|
|
23
|
+
# misc
|
|
24
|
+
.DS_Store
|
|
25
|
+
*.pem
|
|
26
|
+
|
|
27
|
+
# debug
|
|
28
|
+
npm-debug.log*
|
|
29
|
+
yarn-debug.log*
|
|
30
|
+
yarn-error.log*
|
|
31
|
+
.pnpm-debug.log*
|
|
32
|
+
|
|
33
|
+
# env files (can opt-in for committing if needed)
|
|
34
|
+
.env
|
|
35
|
+
|
|
36
|
+
# vercel
|
|
37
|
+
.vercel
|
|
38
|
+
|
|
39
|
+
# typescript
|
|
40
|
+
*.tsbuildinfo
|
|
41
|
+
next-env.d.ts
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema.json",
|
|
3
|
+
"style": "new-york",
|
|
4
|
+
"rsc": true,
|
|
5
|
+
"tsx": true,
|
|
6
|
+
"tailwind": {
|
|
7
|
+
"config": "",
|
|
8
|
+
"css": "src/app/globals.css",
|
|
9
|
+
"baseColor": "neutral",
|
|
10
|
+
"cssVariables": true,
|
|
11
|
+
"prefix": ""
|
|
12
|
+
},
|
|
13
|
+
"iconLibrary": "lucide",
|
|
14
|
+
"rtl": false,
|
|
15
|
+
"aliases": {
|
|
16
|
+
"components": "@/components",
|
|
17
|
+
"utils": "@/lib/utils",
|
|
18
|
+
"ui": "@/components/ui",
|
|
19
|
+
"lib": "@/lib",
|
|
20
|
+
"hooks": "@/hooks"
|
|
21
|
+
},
|
|
22
|
+
"registries": {}
|
|
23
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ai-chat",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "next dev --turbopack",
|
|
7
|
+
"build": "next build",
|
|
8
|
+
"start": "next start",
|
|
9
|
+
"typecheck": "tsc --noEmit",
|
|
10
|
+
"format": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\""
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@ai-sdk/anthropic": "latest",
|
|
14
|
+
"@ai-sdk/openai": "latest",
|
|
15
|
+
"@ai-sdk/provider": "^3.0.8",
|
|
16
|
+
"@ai-sdk/react": "latest",
|
|
17
|
+
"@sidekickdb/admin": "latest",
|
|
18
|
+
"@sidekickdb/react": "latest",
|
|
19
|
+
"@radix-ui/react-use-controllable-state": "^1.2.2",
|
|
20
|
+
"@rive-app/react-webgl2": "^4.27.0",
|
|
21
|
+
"@streamdown/cjk": "^1.0.2",
|
|
22
|
+
"@streamdown/code": "^1.0.3",
|
|
23
|
+
"@streamdown/math": "^1.0.2",
|
|
24
|
+
"@streamdown/mermaid": "^1.0.2",
|
|
25
|
+
"@xyflow/react": "^12.10.1",
|
|
26
|
+
"ai": "^6.0.106",
|
|
27
|
+
"ansi-to-react": "^6.2.6",
|
|
28
|
+
"class-variance-authority": "^0.7.1",
|
|
29
|
+
"clsx": "^2.1.1",
|
|
30
|
+
"cmdk": "^1.1.1",
|
|
31
|
+
"embla-carousel-react": "^8.6.0",
|
|
32
|
+
"lucide-react": "^0.576.0",
|
|
33
|
+
"media-chrome": "^4.18.0",
|
|
34
|
+
"motion": "^12.34.4",
|
|
35
|
+
"nanoid": "^5.1.6",
|
|
36
|
+
"next": "latest",
|
|
37
|
+
"node-html-markdown": "^2.0.0",
|
|
38
|
+
"radix-ui": "^1.4.3",
|
|
39
|
+
"react": "latest",
|
|
40
|
+
"react-dom": "latest",
|
|
41
|
+
"react-jsx-parser": "^2.4.1",
|
|
42
|
+
"shiki": "^4.0.1",
|
|
43
|
+
"streamdown": "^2.3.0",
|
|
44
|
+
"tailwind-merge": "^3.5.0",
|
|
45
|
+
"tokenlens": "^1.3.1",
|
|
46
|
+
"use-stick-to-bottom": "^1.1.3"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@tailwindcss/postcss": "latest",
|
|
50
|
+
"@types/node": "latest",
|
|
51
|
+
"@types/react": "latest",
|
|
52
|
+
"@types/react-dom": "latest",
|
|
53
|
+
"prettier": "^3.8.1",
|
|
54
|
+
"prettier-plugin-tailwindcss": "^0.7.2",
|
|
55
|
+
"shadcn": "^3.8.5",
|
|
56
|
+
"tailwindcss": "latest",
|
|
57
|
+
"tw-animate-css": "^1.4.0",
|
|
58
|
+
"typescript": "latest"
|
|
59
|
+
},
|
|
60
|
+
"packageManager": "pnpm@10.2.0"
|
|
61
|
+
}
|