Repository navigation
feat(cli): add alchemy and improve cli tooling and structure #520
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
8c5ba31
0ec0301
f807e00
2d8fd0a
34505f3
c017331
d2c197a
29eb171
54af26d
5b7ffa9
0af501c
8c98333
cdad96e
690c2e8
8a8952e
971fe8f
df5bd78
cae5650
8ddba0f
011f035
8be9c73
ed425ad
9a556f9
63a3fcd
75585bb
15112eb
205775b
dccfacf
5d0cd23
dd57289
0b6f540
ee4c69e
ec2bbe3
f1912e9
88769d6
4a10404
7db03e6
9bb4f33
20c8e95
0a90621
38a6c01
41540a8
79a0519
2ec142a
0ed8c9e
472e841
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| --- | ||
| alwaysApply: true | ||
| --- | ||
| Default to using Bun instead of Node.js. | ||
|
|
||
| - Use `bun <file>` instead of `node <file>` or `ts-node <file>` | ||
| - Use `bun test` instead of `jest` or `vitest` | ||
| - Use `bun build <file.html|file.ts|file.css>` instead of `webpack` or `esbuild` | ||
| - Use `bun install` instead of `npm install` or `yarn install` or `pnpm install` | ||
| - Use `bun run <script>` instead of `npm run <script>` or `yarn run <script>` or `pnpm run <script>` | ||
| - Bun automatically loads .env, so don't use dotenv. | ||
|
|
||
| ## APIs | ||
|
|
||
| - `Bun.serve()` supports WebSockets, HTTPS, and routes. Don't use `express`. | ||
| - `bun:sqlite` for SQLite. Don't use `better-sqlite3`. | ||
| - `Bun.redis` for Redis. Don't use `ioredis`. | ||
| - `Bun.sql` for Postgres. Don't use `pg` or `postgres.js`. | ||
| - `WebSocket` is built-in. Don't use `ws`. | ||
| - Prefer `Bun.file` over `node:fs`'s readFile/writeFile | ||
| - Bun.$`ls` instead of execa. | ||
|
|
||
| ## Testing | ||
|
|
||
| Use `bun test` to run tests. | ||
|
|
||
| ```ts#index.test.ts | ||
| import { test, expect } from "bun:test"; | ||
|
|
||
| test("hello world", () => { | ||
| expect(1).toBe(1); | ||
| }); | ||
| ``` | ||
|
|
||
| ## Frontend | ||
|
|
||
| Use HTML imports with `Bun.serve()`. Don't use `vite`. HTML imports fully support React, CSS, Tailwind. | ||
|
|
||
| Server: | ||
|
|
||
| ```ts#index.ts | ||
| import index from "./index.html" | ||
|
|
||
| Bun.serve({ | ||
| routes: { | ||
| "/": index, | ||
| "/api/users/:id": { | ||
| GET: (req) => { | ||
| return new Response(JSON.stringify({ id: req.params.id })); | ||
| }, | ||
| }, | ||
| }, | ||
| // optional websocket support | ||
| websocket: { | ||
| open: (ws) => { | ||
| ws.send("Hello, world!"); | ||
| }, | ||
| message: (ws, message) => { | ||
| ws.send(message); | ||
| }, | ||
| close: (ws) => { | ||
| // handle close | ||
| } | ||
| }, | ||
| development: { | ||
| hmr: true, | ||
| console: true, | ||
| } | ||
| }) | ||
| ``` | ||
|
|
||
| HTML files can import .tsx, .jsx or .js files directly and Bun's bundler will transpile & bundle automatically. `<link>` tags can point to stylesheets and Bun's CSS bundler will bundle. | ||
|
|
||
| ```html#index.html | ||
| <html> | ||
| <body> | ||
| <h1>Hello, world!</h1> | ||
| <script type="module" src="./frontend.tsx"></script> | ||
| </body> | ||
| </html> | ||
| ``` | ||
|
|
||
| With the following `frontend.tsx`: | ||
|
|
||
| ```tsx#frontend.tsx | ||
| import React from "react"; | ||
|
|
||
| // import .css files directly and it works | ||
| import './index.css'; | ||
|
|
||
| import { createRoot } from "react-dom/client"; | ||
|
|
||
| const root = createRoot(document.body); | ||
|
|
||
| export default function Frontend() { | ||
| return <h1>Hello, world!</h1>; | ||
| } | ||
|
|
||
| root.render(<Frontend />); | ||
| ``` | ||
|
|
||
| Then, run index.ts | ||
|
|
||
| ```sh | ||
| bun --hot ./index.ts | ||
| ``` | ||
|
|
||
| For more information, read the Bun API docs in `node_modules/bun-types/docs/**.md`. | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,17 +1,12 @@ | ||||||||||||||||
| name: Release | ||||||||||||||||
|
|
||||||||||||||||
| permissions: | ||||||||||||||||
| contents: write | ||||||||||||||||
|
|
||||||||||||||||
| on: | ||||||||||||||||
| push: | ||||||||||||||||
| branches: | ||||||||||||||||
| - main | ||||||||||||||||
| - beta | ||||||||||||||||
| paths: | ||||||||||||||||
| - "apps/cli/**" | ||||||||||||||||
| - ".changeset/**" | ||||||||||||||||
| - "package.json" | ||||||||||||||||
| - "bun.lock" | ||||||||||||||||
|
|
||||||||||||||||
| concurrency: ${{ github.workflow }}-${{ github.ref }} | ||||||||||||||||
| tags: | ||||||||||||||||
| - 'v*' | ||||||||||||||||
|
|
||||||||||||||||
| jobs: | ||||||||||||||||
| release: | ||||||||||||||||
|
|
@@ -30,14 +25,19 @@ jobs: | |||||||||||||||
| - name: Install Dependencies | ||||||||||||||||
| run: bun install --frozen-lockfile | ||||||||||||||||
|
|
||||||||||||||||
| - name: Create Release Pull Request or Publish | ||||||||||||||||
| id: changesets | ||||||||||||||||
| uses: changesets/action@v1 | ||||||||||||||||
| with: | ||||||||||||||||
| publish: bun run publish-packages | ||||||||||||||||
| - name: Build CLI | ||||||||||||||||
| run: bun run build:cli | ||||||||||||||||
| env: | ||||||||||||||||
| BTS_TELEMETRY: 1 | ||||||||||||||||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||||||||||||
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||||||||||||||||
| POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} | ||||||||||||||||
| POSTHOG_HOST: ${{ secrets.POSTHOG_HOST }} | ||||||||||||||||
| POSTHOG_HOST: ${{ secrets.POSTHOG_HOST }} | ||||||||||||||||
|
|
||||||||||||||||
| - name: Generate Changelog | ||||||||||||||||
| run: bun run release | ||||||||||||||||
| env: | ||||||||||||||||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||||||||||||
|
|
||||||||||||||||
| - name: Publish CLI to NPM | ||||||||||||||||
| run: cd apps/cli && bun publish --access public | ||||||||||||||||
| env: | ||||||||||||||||
| NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }} | ||||||||||||||||
|
Comment on lines
+41
to
+43
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use the standard env var for npm auth in CI (
- - name: Publish CLI to NPM
- run: cd apps/cli && bun publish --access public
- env:
- NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}
+ - name: Publish CLI to NPM
+ run: cd apps/cli && bun publish --access public
+ env:
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}If you rely on a custom 📝 Committable suggestion
Suggested change
🧰 Tools🪛 YAMLlint (1.37.1)[error] 43-43: no new line character at the end of file (new-line-at-end-of-file) 🤖 Prompt for AI Agents |
||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -7,25 +7,37 @@ const __filename = fileURLToPath(import.meta.url); | |||||||||||||||||||||
| const distPath = path.dirname(__filename); | ||||||||||||||||||||||
| export const PKG_ROOT = path.join(distPath, "../"); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| export const DEFAULT_CONFIG: ProjectConfig = { | ||||||||||||||||||||||
| export const DEFAULT_CONFIG_BASE = { | ||||||||||||||||||||||
| projectName: "my-better-t-app", | ||||||||||||||||||||||
| projectDir: path.resolve(process.cwd(), "my-better-t-app"), | ||||||||||||||||||||||
| relativePath: "my-better-t-app", | ||||||||||||||||||||||
| frontend: ["tanstack-router"], | ||||||||||||||||||||||
| database: "sqlite", | ||||||||||||||||||||||
| orm: "drizzle", | ||||||||||||||||||||||
| frontend: ["tanstack-router"] as const, | ||||||||||||||||||||||
| database: "sqlite" as const, | ||||||||||||||||||||||
| orm: "drizzle" as const, | ||||||||||||||||||||||
| auth: true, | ||||||||||||||||||||||
| addons: ["turborepo"], | ||||||||||||||||||||||
| examples: [], | ||||||||||||||||||||||
| addons: ["turborepo"] as const, | ||||||||||||||||||||||
| examples: [] as const, | ||||||||||||||||||||||
| git: true, | ||||||||||||||||||||||
| packageManager: getUserPkgManager(), | ||||||||||||||||||||||
| install: true, | ||||||||||||||||||||||
| dbSetup: "none", | ||||||||||||||||||||||
| backend: "hono", | ||||||||||||||||||||||
| runtime: "bun", | ||||||||||||||||||||||
| api: "trpc", | ||||||||||||||||||||||
| webDeploy: "none", | ||||||||||||||||||||||
| }; | ||||||||||||||||||||||
| dbSetup: "none" as const, | ||||||||||||||||||||||
| backend: "hono" as const, | ||||||||||||||||||||||
| runtime: "bun" as const, | ||||||||||||||||||||||
| api: "trpc" as const, | ||||||||||||||||||||||
| webDeploy: "none" as const, | ||||||||||||||||||||||
| serverDeploy: "none" as const, | ||||||||||||||||||||||
| } as const; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| export function getDefaultConfig(): ProjectConfig { | ||||||||||||||||||||||
| return { | ||||||||||||||||||||||
| ...DEFAULT_CONFIG_BASE, | ||||||||||||||||||||||
| projectDir: path.resolve(process.cwd(), DEFAULT_CONFIG_BASE.projectName), | ||||||||||||||||||||||
| packageManager: getUserPkgManager(), | ||||||||||||||||||||||
| frontend: [...DEFAULT_CONFIG_BASE.frontend], | ||||||||||||||||||||||
| addons: [...DEFAULT_CONFIG_BASE.addons], | ||||||||||||||||||||||
| examples: [...DEFAULT_CONFIG_BASE.examples], | ||||||||||||||||||||||
| }; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| export const DEFAULT_CONFIG = getDefaultConfig(); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| export const dependencyVersionMap = { | ||||||||||||||||||||||
| "better-auth": "^1.3.4", | ||||||||||||||||||||||
|
|
@@ -106,7 +118,8 @@ export const dependencyVersionMap = { | |||||||||||||||||||||
| "convex-nuxt": "0.1.5", | ||||||||||||||||||||||
| "convex-vue": "^0.1.5", | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| "@tanstack/svelte-query": "^5.74.4", | ||||||||||||||||||||||
| "@tanstack/svelte-query": "^5.85.3", | ||||||||||||||||||||||
| "@tanstack/svelte-query-devtools": "^5.85.3", | ||||||||||||||||||||||
|
Comment on lines
+121
to
+122
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainDevtools entries: ensure they are added as devDependencies (not production deps). Given these are tooling/dev-only, verify the scaffolding places:
Use this quick check across templates: Also applies to: 121-121 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "🔍 Where are devtools referenced in templates?"
rg -n -C2 -P '"@tanstack/(svelte-query-devtools|solid-router-devtools)"' apps/cli/templates
echo
echo "🔍 package.json(.hbs) blocks that define devDependencies:"
rg -n -C1 -P '"devDependencies"\s*:\s*\{' apps/cli/templates | sed 's/^/• /'Length of output: 4179 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "🔍 Checking for @tanstack/svelte-query-devtools in Svelte template package.json.hbs:"
rg -n -C2 '"@tanstack/svelte-query-devtools"' apps/cli/templates/frontend/svelte/package.json.hbs || echo "→ Not found in Svelte template"
echo
echo "🔍 Checking for @tanstack/solid-router-devtools in Solid template package.json.hbs:"
rg -n -C2 '"@tanstack/solid-router-devtools"' apps/cli/templates/frontend/solid/package.json.hbs || echo "→ Not found in Solid template"Length of output: 722 Ensure devtools entries live under devDependencies The CLI’s constants.ts currently lists the devtools packages as production dependencies, and none of the package.json.hbs templates include them in their devDependencies blocks. This will break the generated projects (imports of Devtools in the route templates won’t resolve). • In apps/cli/src/constants.ts – move "@tanstack/svelte-query-devtools": "^5.85.3",
"@tanstack/solid-router-devtools": "^5.85.3",out of the dependencies object and into the devDependencies object. • In apps/cli/templates/frontend/svelte/package.json.hbs – under the "@tanstack/svelte-query-devtools": "{{constants.versions['@tanstack/svelte-query-devtools']}}"• In apps/cli/templates/frontend/solid/package.json.hbs – under the "@tanstack/solid-query-devtools": "{{constants.versions['@tanstack/solid-query-devtools']}}",
"@tanstack/solid-router-devtools": "{{constants.versions['@tanstack/solid-router-devtools']}}"This aligns the scaffolding with the Devtools imports in __root.tsx.hbs and keeps these packages in devDependencies. 🤖 Prompt for AI Agents |
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| "@tanstack/vue-query-devtools": "^5.83.0", | ||||||||||||||||||||||
| "@tanstack/vue-query": "^5.83.0", | ||||||||||||||||||||||
|
|
@@ -116,19 +129,27 @@ export const dependencyVersionMap = { | |||||||||||||||||||||
|
|
||||||||||||||||||||||
| "@tanstack/solid-query": "^5.75.0", | ||||||||||||||||||||||
| "@tanstack/solid-query-devtools": "^5.75.0", | ||||||||||||||||||||||
| "@tanstack/solid-router-devtools": "^1.131.25", | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| wrangler: "^4.23.0", | ||||||||||||||||||||||
| "@cloudflare/vite-plugin": "^1.9.0", | ||||||||||||||||||||||
| "@opennextjs/cloudflare": "^1.3.0", | ||||||||||||||||||||||
| "nitro-cloudflare-dev": "^0.2.2", | ||||||||||||||||||||||
| "@sveltejs/adapter-cloudflare": "^7.0.4", | ||||||||||||||||||||||
| "@sveltejs/adapter-cloudflare": "^7.2.1", | ||||||||||||||||||||||
| "@cloudflare/workers-types": "^4.20250813.0", | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
Comment on lines
+138
to
+140
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainCloudflare stack bumps: verify types are picked up via tsconfig Versions look fine. Since worker types generation was removed from create flow, ensure templates set "types": ["@cloudflare/workers-types"] in tsconfig for Worker runtimes (web and server). Run: Expected: tsconfig files for Cloudflare-bound projects reference the workers types explicitly. 🏁 Script executed: #!/bin/bash
# Check that at least the backend/frontend worker runtimes reference workers-types in tsconfig
rg -n -C2 -P '"types"\s*:\s*\[.*"@cloudflare/workers-types".*\]' --type=jsonLength of output: 78 🏁 Script executed: #!/bin/bash
set -euo pipefail
# 1. Locate all tsconfig files in the repo
echo "🔍 Searching for tsconfig files..."
tsconfigs=$(fd --hidden --type f 'tsconfig*.json')
if [[ -z "$tsconfigs" ]]; then
echo "⚠️ No tsconfig*.json files found in the repo."
exit 0
fi
# 2. For each tsconfig, show any references to workers-types and the "types" array
for cfg in $tsconfigs; do
echo
echo "=== Checking $cfg ==="
grep -Hn '"@cloudflare/workers-types"' "$cfg" || echo "— no explicit @cloudflare/workers-types entry"
echo
grep -Hn '"types"\s*:' "$cfg" || echo "— no \"types\" array found"
doneLength of output: 10892 Ensure Cloudflare Worker types are declared in your tsconfig templates Most of the generated tsconfig.json.hbs files don’t include the Files to update:
Example diff for {
"compilerOptions": {
- "types": ["vite/client"]
+ "types": [
+ "vite/client",
+ "@cloudflare/workers-types"
+ ]
}
}
|
||||||||||||||||||||||
| alchemy: "^0.62.1", | ||||||||||||||||||||||
| // temporary workaround for alchemy + tanstack start | ||||||||||||||||||||||
| nitropack: "^2.12.4", | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| dotenv: "^17.2.1", | ||||||||||||||||||||||
|
Comment on lines
+141
to
+145
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainSanity-check new packages and the “temporary workaround”
Additionally, consider changing the in-code comment to a TODO with a link to an issue for traceability. 🌐 Web query: 💡 Result: Short answers (checked on Aug 18, 2025):
What that implies for deployments
Breaking / noteworthy changes since v16 (practical effects)
Practical checklist for upgrading from v16 → latest (or for adopting latest now)
If you want I can:
Citations:
Sanity-check Dependency Versions and Track Temporary Fixes
📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||
| } as const; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| export type AvailableDependencies = keyof typeof dependencyVersionMap; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| export const ADDON_COMPATIBILITY: Record<Addons, readonly Frontend[]> = { | ||||||||||||||||||||||
| pwa: ["tanstack-router", "react-router", "solid", "next"], | ||||||||||||||||||||||
| tauri: ["tanstack-router", "react-router", "nuxt", "svelte", "solid"], | ||||||||||||||||||||||
| tauri: ["tanstack-router", "react-router", "nuxt", "svelte", "solid", "next"], | ||||||||||||||||||||||
| biome: [], | ||||||||||||||||||||||
| husky: [], | ||||||||||||||||||||||
| turborepo: [], | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.