-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Add Tanstack Start to bun init #24648
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
Conversation
- Add --react=tanstack flag support - Rename package and remove nitro from default - Add tests for TanStack template
|
Updated 5:56 PM PT - Dec 1st, 2025
❌ @alii, your commit 67e4974 has 5 failures in
🧪 To try this PR locally: bunx bun-pr 24648That installs a local version of the PR into your bun-24648 --bun |
WalkthroughAdds a new Bun + TanStack Start project template and integrates CLI support for --react=tanstack, including template assets (package.json, Vite/TS configs, routes, router, styles, README/rule), dependency mappings, CLAUDE/cursor rules, and an init integration test. Changes
Suggested reviewers
Pre-merge checks❌ Failed checks (1 inconclusive)
✅ Passed checks (1 passed)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 7
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/cli/init_command.zig (2)
1283-1304: Incorrect instruction: “bun start” won’t work (no start script)react_tanstack defines dev/build/serve. Replace “bun start” with “bun run serve”.
- \\<b><green>Production<r><d> - serve a full-stack production build<r> + \\<b><green>Production<r><d> - serve a full-stack production build<r> @@ - \\ <green><b>bun start<r> + \\ <green><b>bun run serve<r>
1047-1068: Robustness: ensure .cursor/rules exists before writing rule filecreateNew doesn’t create parent directories; writing to .cursor/rules can fail. Create the directory when targeting the cursor path.
- if (this.getCursorRule()) |template_file| { + if (this.getCursorRule()) |template_file| { var did_create_agent_rule = false; @@ - const asset_path = if (@"create CLAUDE.md") "CLAUDE.md" else template_file.path; + const asset_path = if (@"create CLAUDE.md") "CLAUDE.md" else template_file.path; + if (!@"create CLAUDE.md") { + // Ensure .cursor/rules exists when writing the cursor rule + bun.makePath(bun.FD.cwd().stdDir(), ".cursor/rules") catch {}; + } const result = InitCommand.Assets.createNew(asset_path, template_file.contents);
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (1)
src/init/react-tanstack/assets/favicon.icois excluded by!**/*.ico
📒 Files selected for processing (13)
src/cli/init/README-tanstack.default.md(1 hunks)src/cli/init_command.zig(17 hunks)src/init/react-tanstack/package.json(1 hunks)src/init/react-tanstack/src/routeTree.gen.ts(1 hunks)src/init/react-tanstack/src/router.tsx(1 hunks)src/init/react-tanstack/src/routes/__root.tsx(1 hunks)src/init/react-tanstack/src/routes/index.tsx(1 hunks)src/init/react-tanstack/src/routes/stats.tsx(1 hunks)src/init/react-tanstack/styles.css(1 hunks)src/init/react-tanstack/tsconfig.json(1 hunks)src/init/react-tanstack/vite.config.ts(1 hunks)src/init/rule-tanstack.md(1 hunks)test/cli/init/init.test.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
test/**
📄 CodeRabbit inference engine (.cursor/rules/writing-tests.mdc)
Place all tests under the test/ directory
Files:
test/cli/init/init.test.ts
test/cli/**/*.{js,ts}
📄 CodeRabbit inference engine (.cursor/rules/writing-tests.mdc)
test/cli/**/*.{js,ts}: Place CLI command tests (e.g., bun install, bun init) under test/cli/
When testing Bun as a CLI, use spawn with bunExe() and bunEnv from harness, and capture stdout/stderr via pipes
Files:
test/cli/init/init.test.ts
test/**/*.{js,ts}
📄 CodeRabbit inference engine (.cursor/rules/writing-tests.mdc)
test/**/*.{js,ts}: Write tests in JavaScript or TypeScript using Bun’s Jest-style APIs (test, describe, expect) and run with bun test
Prefer data-driven tests (e.g., test.each) to reduce boilerplate
Use shared utilities from test/harness.ts where applicable
Files:
test/cli/init/init.test.ts
**/*.zig
📄 CodeRabbit inference engine (.cursor/rules/javascriptcore-class.mdc)
**/*.zig: Declare the extern C symbol in Zig and export a Zig-friendly alias for use
Wrap the Bun____toJS extern in a Zig method that takes a JSGlobalObject and returns JSC.JSValue
Files:
src/cli/init_command.zig
src/**/*.zig
📄 CodeRabbit inference engine (.cursor/rules/building-bun.mdc)
When adding debug logs in Zig, create a scoped logger and log via Bun APIs:
const log = bun.Output.scoped(.${SCOPE}, .hidden);thenlog("...", .{})
src/**/*.zig: Use Zig private fields with the # prefix for encapsulation (e.g., struct { #foo: u32 })
Prefer Decl literals for initialization (e.g., const decl: Decl = .{ .binding = 0, .value = 0 };)
Place @import statements at the bottom of the file (formatter will handle ordering)
Files:
src/cli/init_command.zig
🧠 Learnings (28)
📚 Learning: 2025-08-30T00:09:39.100Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: .cursor/rules/dev-server-tests.mdc:0-0
Timestamp: 2025-08-30T00:09:39.100Z
Learning: Applies to test/bake/dev/css.test.ts : css.test.ts should contain CSS bundling tests in dev mode
Applied to files:
src/init/react-tanstack/styles.csstest/cli/init/init.test.ts
📚 Learning: 2025-10-19T02:52:37.412Z
Learnt from: theshadow27
Repo: oven-sh/bun PR: 23798
File: packages/bun-otel/tsconfig.json:1-15
Timestamp: 2025-10-19T02:52:37.412Z
Learning: In the Bun repository, packages under packages/ (e.g., bun-otel) can follow a TypeScript-first pattern where package.json exports point directly to .ts files (not compiled .js files). Bun natively runs TypeScript, so consumers import .ts sources directly and receive full type information without needing compiled .d.ts declaration files. For such packages, adding "declaration": true or "outDir" in tsconfig.json is unnecessary and would break the export structure.
<!-- [remove_learning]
ceedde95-980e-4898-a2c6-40ff73913664
Applied to files:
src/init/react-tanstack/tsconfig.jsonsrc/init/rule-tanstack.mdsrc/init/react-tanstack/package.jsonsrc/cli/init/README-tanstack.default.md
📚 Learning: 2025-10-04T09:52:49.414Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/js/CLAUDE.md:0-0
Timestamp: 2025-10-04T09:52:49.414Z
Learning: Applies to src/js/{builtins,node,bun,thirdparty,internal}/**/*.{ts,js} : Use process.platform and process.arch for platform detection (rely on inlining/dead-code elimination)
Applied to files:
src/init/react-tanstack/tsconfig.json
📚 Learning: 2025-10-04T09:52:49.414Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/js/CLAUDE.md:0-0
Timestamp: 2025-10-04T09:52:49.414Z
Learning: Applies to src/js/{builtins,node,bun,thirdparty,internal}/**/*.{ts,js} : Do not use ESM import syntax; write modules as CommonJS with export default { ... }
Applied to files:
src/init/react-tanstack/tsconfig.json
📚 Learning: 2025-08-30T00:09:39.100Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: .cursor/rules/dev-server-tests.mdc:0-0
Timestamp: 2025-08-30T00:09:39.100Z
Learning: Applies to test/bake/dev/react-spa.test.ts : react-spa.test.ts should contain React SPA, react-refresh, and basic server component transform tests
Applied to files:
src/init/react-tanstack/tsconfig.jsonsrc/init/react-tanstack/src/routes/stats.tsxsrc/init/react-tanstack/package.jsonsrc/init/react-tanstack/src/routes/index.tsxtest/cli/init/init.test.tssrc/init/react-tanstack/vite.config.tssrc/init/react-tanstack/src/routeTree.gen.tssrc/init/react-tanstack/src/routes/__root.tsx
📚 Learning: 2025-10-04T09:52:49.414Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/js/CLAUDE.md:0-0
Timestamp: 2025-10-04T09:52:49.414Z
Learning: Applies to src/js/{builtins,node,bun,thirdparty,internal}/**/*.{ts,js} : Export via export default {} for modules
Applied to files:
src/init/react-tanstack/tsconfig.json
📚 Learning: 2025-08-30T00:09:39.100Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: .cursor/rules/dev-server-tests.mdc:0-0
Timestamp: 2025-08-30T00:09:39.100Z
Learning: Applies to test/bake/dev/bundle.test.ts : bundle.test.ts should contain DevServer-specific bundling tests
Applied to files:
src/init/react-tanstack/tsconfig.jsonsrc/init/rule-tanstack.mdsrc/init/react-tanstack/package.jsonsrc/cli/init/README-tanstack.default.mdtest/cli/init/init.test.tssrc/init/react-tanstack/vite.config.ts
📚 Learning: 2025-10-04T09:52:49.414Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/js/CLAUDE.md:0-0
Timestamp: 2025-10-04T09:52:49.414Z
Learning: Applies to src/js/bun/**/*.{ts,js} : Place Bun-specific modules (e.g., bun:ffi, bun:sqlite) under bun/
Applied to files:
src/init/rule-tanstack.mdsrc/cli/init/README-tanstack.default.md
📚 Learning: 2025-08-30T00:12:56.803Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: .cursor/rules/writing-tests.mdc:0-0
Timestamp: 2025-08-30T00:12:56.803Z
Learning: Applies to test/js/bun/**/*.{js,ts} : Place Bun API tests under test/js/bun/, separated by category (e.g., test/js/bun/glob/)
Applied to files:
src/init/rule-tanstack.mdsrc/cli/init/README-tanstack.default.mdtest/cli/init/init.test.ts
📚 Learning: 2025-10-19T02:44:46.354Z
Learnt from: theshadow27
Repo: oven-sh/bun PR: 23798
File: packages/bun-otel/context-propagation.test.ts:1-1
Timestamp: 2025-10-19T02:44:46.354Z
Learning: In the Bun repository, standalone packages under packages/ (e.g., bun-vscode, bun-inspector-protocol, bun-plugin-yaml, bun-plugin-svelte, bun-debug-adapter-protocol, bun-otel) co-locate their tests with package source code using *.test.ts files. This follows standard npm/monorepo patterns. The test/ directory hierarchy (test/js/bun/, test/cli/, test/js/node/) is reserved for testing Bun's core runtime APIs and built-in functionality, not standalone packages.
Applied to files:
src/init/rule-tanstack.mdsrc/init/react-tanstack/package.jsonsrc/cli/init/README-tanstack.default.mdtest/cli/init/init.test.ts
📚 Learning: 2025-08-30T00:12:56.803Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: .cursor/rules/writing-tests.mdc:0-0
Timestamp: 2025-08-30T00:12:56.803Z
Learning: Applies to test/**/*.{js,ts} : Write tests in JavaScript or TypeScript using Bun’s Jest-style APIs (test, describe, expect) and run with bun test
Applied to files:
src/init/rule-tanstack.mdsrc/init/react-tanstack/package.jsonsrc/cli/init/README-tanstack.default.mdtest/cli/init/init.test.ts
📚 Learning: 2025-10-13T13:26:39.391Z
Learnt from: mastermakrela
Repo: oven-sh/bun PR: 19167
File: docs/api/csv.md:1-20
Timestamp: 2025-10-13T13:26:39.391Z
Learning: In the Bun repository, documentation files in docs/api/ should NOT include H1 headings. The page titles are provided via the nav.ts file using the page() function's title parameter, and the documentation framework generates the H1 heading automatically. This is the consistent pattern across all API documentation files.
Applied to files:
src/init/rule-tanstack.md
📚 Learning: 2025-08-30T00:12:56.803Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: .cursor/rules/writing-tests.mdc:0-0
Timestamp: 2025-08-30T00:12:56.803Z
Learning: Applies to test/cli/**/*.{js,ts} : When testing Bun as a CLI, use spawn with bunExe() and bunEnv from harness, and capture stdout/stderr via pipes
Applied to files:
src/init/rule-tanstack.mdtest/cli/init/init.test.tssrc/cli/init_command.zig
📚 Learning: 2025-10-26T01:32:04.844Z
Learnt from: Jarred-Sumner
Repo: oven-sh/bun PR: 24082
File: test/cli/test/coverage.test.ts:60-112
Timestamp: 2025-10-26T01:32:04.844Z
Learning: In the Bun repository test files (test/cli/test/*.test.ts), when spawning Bun CLI commands with Bun.spawnSync for testing, prefer using stdio: ["inherit", "inherit", "inherit"] to inherit stdio streams rather than piping them.
Applied to files:
src/init/rule-tanstack.mdtest/cli/init/init.test.tssrc/cli/init_command.zig
📚 Learning: 2025-09-02T05:33:37.517Z
Learnt from: Jarred-Sumner
Repo: oven-sh/bun PR: 22323
File: test/js/web/websocket/websocket-subprotocol.test.ts:74-75
Timestamp: 2025-09-02T05:33:37.517Z
Learning: In Bun's runtime, `await using` with Node.js APIs like `net.createServer()` is properly supported and should not be replaced with explicit cleanup. Bun has extended Node.js APIs with proper async dispose support.
Applied to files:
src/init/rule-tanstack.md
📚 Learning: 2025-10-08T03:11:45.286Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: .cursor/rules/building-bun.mdc:0-0
Timestamp: 2025-10-08T03:11:45.286Z
Learning: To run a file, use `bun bd <file> <...args>`; never use `bun <file>` directly
Applied to files:
src/init/rule-tanstack.md
📚 Learning: 2025-10-19T04:38:37.720Z
Learnt from: theshadow27
Repo: oven-sh/bun PR: 23798
File: packages/bun-otel/examples/basic.ts:10-10
Timestamp: 2025-10-19T04:38:37.720Z
Learning: In packages/bun-otel/bun-sdk.ts, BunSDK.start() is intentionally synchronous (returns void) unlike NodeSDK.start() which is async. This is because BunSDK performs resource detection synchronously in the constructor using detectResourcesSync, while NodeSDK performs async resource detection during start(). The start() method only performs synchronous operations (setting context manager, propagator, creating tracer provider, calling installBunNativeTracing), so an async signature would be misleading.
Applied to files:
src/cli/init/README-tanstack.default.md
📚 Learning: 2025-09-08T00:41:12.052Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/bun.js/bindings/v8/CLAUDE.md:0-0
Timestamp: 2025-09-08T00:41:12.052Z
Learning: Applies to src/bun.js/bindings/v8/test/v8/v8.test.ts : Add a corresponding test case in test/v8/v8.test.ts that invokes checkSameOutput with the new function
Applied to files:
test/cli/init/init.test.ts
📚 Learning: 2025-08-30T00:12:56.803Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: .cursor/rules/writing-tests.mdc:0-0
Timestamp: 2025-08-30T00:12:56.803Z
Learning: Applies to test/cli/**/*.{js,ts} : Place CLI command tests (e.g., bun install, bun init) under test/cli/
Applied to files:
test/cli/init/init.test.ts
📚 Learning: 2025-08-30T00:09:39.100Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: .cursor/rules/dev-server-tests.mdc:0-0
Timestamp: 2025-08-30T00:09:39.100Z
Learning: Applies to test/bake/dev/*.test.ts : Write Dev Server and HMR tests in test/bake/dev/*.test.ts using devTest from the shared harness
Applied to files:
test/cli/init/init.test.ts
📚 Learning: 2025-10-08T13:48:02.430Z
Learnt from: Jarred-Sumner
Repo: oven-sh/bun PR: 23373
File: test/js/bun/tarball/extract.test.ts:107-111
Timestamp: 2025-10-08T13:48:02.430Z
Learning: In Bun's test runner, use `expect(async () => { await ... }).toThrow()` to assert async rejections. Unlike Jest/Vitest, Bun does not require `await expect(...).rejects.toThrow()` - the async function wrapper with `.toThrow()` is the correct pattern for async error assertions in Bun tests.
Applied to files:
test/cli/init/init.test.ts
📚 Learning: 2025-11-06T00:58:23.965Z
Learnt from: markovejnovic
Repo: oven-sh/bun PR: 24417
File: test/js/bun/spawn/spawn.test.ts:903-918
Timestamp: 2025-11-06T00:58:23.965Z
Learning: In Bun test files, `await using` with spawn() is appropriate for long-running processes that need guaranteed cleanup on scope exit or when explicitly testing disposal behavior. For short-lived processes that exit naturally (e.g., console.log scripts), the pattern `const proc = spawn(...); await proc.exited;` is standard and more common, as evidenced by 24 instances vs 4 `await using` instances in test/js/bun/spawn/spawn.test.ts.
Applied to files:
test/cli/init/init.test.ts
📚 Learning: 2025-09-20T03:39:41.770Z
Learnt from: pfgithub
Repo: oven-sh/bun PR: 22534
File: test/regression/issue/21830.fixture.ts:14-63
Timestamp: 2025-09-20T03:39:41.770Z
Learning: Bun's test runner supports async describe callbacks, unlike Jest/Vitest where describe callbacks must be synchronous. The syntax `describe("name", async () => { ... })` is valid in Bun.
Applied to files:
test/cli/init/init.test.ts
📚 Learning: 2025-10-07T07:39:54.720Z
Learnt from: shadcn
Repo: oven-sh/bun PR: 23328
File: src/init/react-shadcn/src/components/ui/button.tsx:26-27
Timestamp: 2025-10-07T07:39:54.720Z
Learning: In the react-shadcn template (src/init/react-shadcn/src/components/ui/button.tsx), the button size variants `icon-sm` and `icon-lg` are intentionally included even if not immediately used in the template, as they are part of the design system API.
Applied to files:
src/cli/init_command.zig
📚 Learning: 2025-11-08T04:06:33.198Z
Learnt from: Jarred-Sumner
Repo: oven-sh/bun PR: 24491
File: test/js/bun/transpiler/declare-global.test.ts:17-17
Timestamp: 2025-11-08T04:06:33.198Z
Learning: In Bun test files, `await using` with Bun.spawn() is the preferred pattern for spawned processes regardless of whether they are short-lived or long-running. Do not suggest replacing `await using proc = Bun.spawn(...)` with `const proc = Bun.spawn(...); await proc.exited;`.
Applied to files:
src/cli/init_command.zig
📚 Learning: 2025-10-08T13:56:00.875Z
Learnt from: Jarred-Sumner
Repo: oven-sh/bun PR: 23373
File: src/bun.js/api/BunObject.zig:2514-2521
Timestamp: 2025-10-08T13:56:00.875Z
Learning: For Bun codebase: prefer using `bun.path` utilities (e.g., `bun.path.joinAbsStringBuf`, `bun.path.join`) over `std.fs.path` functions for path operations.
Applied to files:
src/cli/init_command.zig
📚 Learning: 2025-10-08T03:11:45.286Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: .cursor/rules/building-bun.mdc:0-0
Timestamp: 2025-10-08T03:11:45.286Z
Learning: Run any command with the debug build via `bun bd <command>`
Applied to files:
src/cli/init_command.zig
📚 Learning: 2025-10-08T03:11:45.286Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: .cursor/rules/building-bun.mdc:0-0
Timestamp: 2025-10-08T03:11:45.286Z
Learning: Build the debug version using `bun bd` or `bun run build:debug`; the build outputs to `./build/debug/bun-debug` and takes ~2.5 minutes
Applied to files:
src/cli/init_command.zig
🧬 Code graph analysis (5)
src/init/react-tanstack/src/routes/stats.tsx (2)
src/init/react-tanstack/src/routes/__root.tsx (1)
Route(8-29)src/init/react-tanstack/src/routes/index.tsx (1)
Route(4-6)
src/init/react-tanstack/src/routes/index.tsx (2)
src/init/react-tanstack/src/routes/__root.tsx (1)
Route(8-29)src/init/react-tanstack/src/routes/stats.tsx (1)
Route(39-45)
test/cli/init/init.test.ts (1)
test/harness.ts (3)
tempDirWithFiles(259-266)bunExe(102-105)bunEnv(49-64)
src/init/react-tanstack/src/routeTree.gen.ts (1)
src/init/react-tanstack/src/router.tsx (1)
getRouter(4-11)
src/init/react-tanstack/src/routes/__root.tsx (2)
src/init/react-tanstack/src/routes/index.tsx (1)
Route(4-6)src/init/react-tanstack/src/routes/stats.tsx (1)
Route(39-45)
🪛 Biome (2.1.2)
src/init/react-tanstack/src/routes/__root.tsx
[error] 77-78: Provide a lang attribute when using the html element.
Setting a lang attribute on HTML document elements configures the languageused by screen readers when no user default is specified.
(lint/a11y/useHtmlLang)
🪛 markdownlint-cli2 (0.18.1)
src/init/rule-tanstack.md
7-7: First line in a file should be a top-level heading
(MD041, first-line-heading, first-line-h1)
🔇 Additional comments (6)
src/init/react-tanstack/vite.config.ts (1)
11-17: Plugin order is correcttanstackStart before viteReact is required; config looks good.
src/init/react-tanstack/src/routes/stats.tsx (2)
21-36: Good server-only stats collectionUsing createServerFn with Bun/version/revision and os.cpus()/totalmem is appropriate; optional chaining on bunRevision is safe.
Please confirm tsconfig includes Bun types (see separate script in Zig comment) so Bun.* is typed.
84-85: Fix invalid Tailwind classmax-h-4/5 isn’t generated by default. Use an arbitrary value.
- <div className="relative bg-card/80 backdrop-blur-xl text-card-foreground rounded-2xl border border-border/50 shadow-2xl overflow-hidden h-[550px] max-h-4/5 grid grid-rows-[auto_1fr_auto]"> + <div className="relative bg-card/80 backdrop-blur-xl text-card-foreground rounded-2xl border border-border/50 shadow-2xl overflow-hidden h-[550px] max-h-[80vh] grid grid-rows-[auto_1fr_auto]">Likely an incorrect or invalid review comment.
src/init/react-tanstack/src/routes/__root.tsx (1)
22-25: Head links look goodStylesheet and favicon wiring matches the scaffold.
src/init/react-tanstack/src/routeTree.gen.ts (1)
7-10: Generated file — LGTMRoute augmentation and type registration look correct. Keep this file generated.
Also applies to: 75-84
src/init/react-tanstack/src/routes/index.tsx (1)
12-12: Fix invalid Tailwind classes that won’t compile
- max-h-5/6 → use an arbitrary value
- text-md → text-base (or another valid size)
- font-regular → font-normal
- -mt → requires a size (e.g., -mt-1)
- border-border/3 → border-border/30 (likely intended)
Apply:
- <div className="relative bg-card/80 backdrop-blur-xl text-card-foreground rounded-2xl border border-border/50 shadow-2xl overflow-hidden h-[550px] max-h-5/6 grid grid-rows-[auto_1fr_auto]"> + <div className="relative bg-card/80 backdrop-blur-xl text-card-foreground rounded-2xl border border-border/50 shadow-2xl overflow-hidden h-[550px] max-h-[83vh] grid grid-rows-[auto_1fr_auto]"> @@ - <p className="text-sm sm:text-md text-muted-foreground font-regular tracking-wide -mt pb-2"> + <p className="text-sm sm:text-base text-muted-foreground font-normal tracking-wide -mt-1 pb-2"> @@ - <p className="text-xs text-muted-foreground/80 font-regular leading-relaxed max-w-sm mx-auto mt-2 border-t border-border/3"> + <p className="text-xs text-muted-foreground/80 font-normal leading-relaxed max-w-sm mx-auto mt-2 border-t border-border/30"> @@ - <code className="text-[11px] bg-zinc-800 px-1 py-0.5 rounded-xs mx-0.5">src/routes/index.tsx</code>{" "} + <code className="text-[11px] bg-zinc-800 px-1 py-0.5 rounded-sm mx-0.5">src/routes/index.tsx</code>{" "}Also applies to: 27-35
⛔ Skipped due to learnings
Learnt from: shadcn Repo: oven-sh/bun PR: 23328 File: src/init/react-shadcn/src/components/ui/button.tsx:16-16 Timestamp: 2025-10-07T07:39:39.050Z Learning: In Tailwind CSS v4, `shadow-xs` is a valid box shadow utility class. Tailwind v4 includes new shadow scale tokens including `shadow-2xs`, `shadow-xs`, `shadow-sm`, `shadow`, `shadow-md`, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
src/init/react-tanstack/src/routes/index.tsx(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-30T00:09:39.100Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: .cursor/rules/dev-server-tests.mdc:0-0
Timestamp: 2025-08-30T00:09:39.100Z
Learning: Applies to test/bake/dev/react-spa.test.ts : react-spa.test.ts should contain React SPA, react-refresh, and basic server component transform tests
Applied to files:
src/init/react-tanstack/src/routes/index.tsx
🧬 Code graph analysis (1)
src/init/react-tanstack/src/routes/index.tsx (2)
src/init/react-tanstack/src/routes/__root.tsx (1)
Route(8-29)src/init/react-tanstack/src/routes/stats.tsx (1)
Route(39-45)
🔇 Additional comments (1)
src/init/react-tanstack/src/routes/index.tsx (1)
45-52: LGTM: Proper security attributes on external links.The external links correctly use
target="_blank"withrel="noopener noreferrer", which prevents potential security vulnerabilities (tabnabbing) and performance issues.Also applies to: 56-63
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
src/init/react-tanstack/src/routes/index.tsx(1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: .cursor/rules/writing-tests.mdc:0-0
Timestamp: 2025-08-30T00:12:56.803Z
Learning: Applies to test/**/*.{js,ts} : Write tests in JavaScript or TypeScript using Bun’s Jest-style APIs (test, describe, expect) and run with bun test
Learnt from: theshadow27
Repo: oven-sh/bun PR: 23798
File: packages/bun-otel/context-propagation.test.ts:1-1
Timestamp: 2025-10-19T02:44:46.354Z
Learning: In the Bun repository, standalone packages under packages/ (e.g., bun-vscode, bun-inspector-protocol, bun-plugin-yaml, bun-plugin-svelte, bun-debug-adapter-protocol, bun-otel) co-locate their tests with package source code using *.test.ts files. This follows standard npm/monorepo patterns. The test/ directory hierarchy (test/js/bun/, test/cli/, test/js/node/) is reserved for testing Bun's core runtime APIs and built-in functionality, not standalone packages.
📚 Learning: 2025-08-30T00:09:39.100Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: .cursor/rules/dev-server-tests.mdc:0-0
Timestamp: 2025-08-30T00:09:39.100Z
Learning: Applies to test/bake/dev/react-spa.test.ts : react-spa.test.ts should contain React SPA, react-refresh, and basic server component transform tests
Applied to files:
src/init/react-tanstack/src/routes/index.tsx
📚 Learning: 2025-10-07T07:39:54.720Z
Learnt from: shadcn
Repo: oven-sh/bun PR: 23328
File: src/init/react-shadcn/src/components/ui/button.tsx:26-27
Timestamp: 2025-10-07T07:39:54.720Z
Learning: In the react-shadcn template (src/init/react-shadcn/src/components/ui/button.tsx), the button size variants `icon-sm` and `icon-lg` are intentionally included even if not immediately used in the template, as they are part of the design system API.
Applied to files:
src/init/react-tanstack/src/routes/index.tsx
🧬 Code graph analysis (1)
src/init/react-tanstack/src/routes/index.tsx (2)
src/init/react-tanstack/src/routes/__root.tsx (1)
Route(8-29)src/init/react-tanstack/src/routes/stats.tsx (1)
Route(39-45)
🔇 Additional comments (4)
src/init/react-tanstack/src/routes/index.tsx (4)
1-6: LGTM! Proper TanStack Router integration.The route definition correctly uses
createFileRoute("/")to establish the root route and follows the pattern shown in other routes like/stats. The imports are appropriate for the component's needs.
8-16: LGTM! Good accessibility and responsive design.The component structure includes proper alt text for the header image and uses responsive Tailwind classes effectively.
45-63: LGTM! Proper security attributes on external links.Both external links correctly include
rel="noopener noreferrer"andtarget="_blank", following security best practices for opening links in new tabs.
71-80: LGTM! Proper internal routing with good UX.The CTA correctly uses TanStack's
<Link>component for internal navigation to/stats, with appropriate hover states and accessibility through thetext-centerand clear labeling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
src/init/react-tanstack/src/routes/index.tsx(1 hunks)src/init/react-tanstack/src/routes/stats.tsx(1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-08-30T00:09:39.100Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: .cursor/rules/dev-server-tests.mdc:0-0
Timestamp: 2025-08-30T00:09:39.100Z
Learning: Applies to test/bake/dev/react-spa.test.ts : react-spa.test.ts should contain React SPA, react-refresh, and basic server component transform tests
Applied to files:
src/init/react-tanstack/src/routes/stats.tsxsrc/init/react-tanstack/src/routes/index.tsx
📚 Learning: 2025-10-07T07:39:54.720Z
Learnt from: shadcn
Repo: oven-sh/bun PR: 23328
File: src/init/react-shadcn/src/components/ui/button.tsx:26-27
Timestamp: 2025-10-07T07:39:54.720Z
Learning: In the react-shadcn template (src/init/react-shadcn/src/components/ui/button.tsx), the button size variants `icon-sm` and `icon-lg` are intentionally included even if not immediately used in the template, as they are part of the design system API.
Applied to files:
src/init/react-tanstack/src/routes/index.tsx
📚 Learning: 2025-10-07T07:39:39.050Z
Learnt from: shadcn
Repo: oven-sh/bun PR: 23328
File: src/init/react-shadcn/src/components/ui/button.tsx:16-16
Timestamp: 2025-10-07T07:39:39.050Z
Learning: In Tailwind CSS v4, `shadow-xs` is a valid box shadow utility class. Tailwind v4 includes new shadow scale tokens including `shadow-2xs`, `shadow-xs`, `shadow-sm`, `shadow`, `shadow-md`, etc.
Applied to files:
src/init/react-tanstack/src/routes/index.tsx
🧬 Code graph analysis (2)
src/init/react-tanstack/src/routes/stats.tsx (2)
src/init/react-tanstack/src/routes/index.tsx (1)
Route(14-20)src/init/react-tanstack/src/routes/__root.tsx (1)
Route(8-29)
src/init/react-tanstack/src/routes/index.tsx (2)
src/init/react-tanstack/src/routes/stats.tsx (1)
Route(39-45)src/init/react-tanstack/src/routes/__root.tsx (1)
Route(8-29)
🔇 Additional comments (7)
src/init/react-tanstack/src/routes/index.tsx (3)
5-12: LGTM!The server function correctly uses
createServerFnto expose Bun runtime information. The pattern follows TanStack Start conventions.
14-20: LGTM!The route definition correctly uses
createFileRoutewith a loader that fetches server-side data. This follows TanStack Router conventions.
22-96: LGTM!The component structure is well-organized with proper data fetching, responsive layout, and appropriate use of TanStack Router's
Linkcomponent for navigation. External links correctly include security attributes.src/init/react-tanstack/src/routes/stats.tsx (4)
5-37: LGTM!The server function correctly gathers process and system statistics. The CPU percentage calculation is sound: it converts cumulative times to an average usage across cores with appropriate guards (zero-check, 100% cap).
39-45: LGTM!The route definition follows the same pattern as the index route, correctly using
createFileRoutewith a loader for server-side data fetching.
50-61: LGTM!The uptime formatter correctly converts seconds to a human-readable format (hours/minutes/seconds) with appropriate conditional formatting.
63-157: LGTM!The byte formatter correctly uses binary (1024-based) conversion with locale-aware number formatting. The Stats component is well-structured, displaying server information in a clean, responsive layout with proper TanStack Router navigation.
|
i would add an actual bun based server impl such as we have in this example: https://github.com/TanStack/router/blob/main/examples/react/start-bun/server.ts otherwise, you wont be able to launch the prod build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (4)
src/cli/init_command.zig (2)
922-938: Move @tailwindcss/vite to devDependenciesThis issue was already flagged in a previous review. The
@tailwindcss/vitepackage is a Vite plugin used only during development and build time, so it belongs in devDependencies rather than dependencies to reduce production bundle size.
1211-1225: Add "types": ["bun-types"] to tsconfig.jsonThis issue was already flagged in a previous review. The TanStack template's
stats.tsxreferencesBun.versionandBun.revision, but the template doesn't shipbun-env.d.ts(unlike other React templates) and thetsconfig.jsondoesn't include"types": ["bun-types"]in compilerOptions. TypeScript will not recognize Bun globals without this configuration.src/init/react-tanstack/src/routes/__root.tsx (1)
77-85: Add lang attribute for accessibility compliance.
<html>still omits alang, which blocks screen readers and keeps Biome’s a11y lint failing. This needs to ship with a default locale (or a locale prop) before the template is released.Apply this diff:
- <html> + <html lang="en">src/init/react-tanstack/src/routes/index.tsx (1)
63-63: Replace non-standard Tailwind font weight.
font-regularisn’t a Tailwind utility, so the intended weight is ignored. Switch to the standardfont-normal(unless you add a custom utility) to keep the template consistent.- <p className="text-sm text-muted-foreground/90 font-regular leading-relaxed max-w-sm mx-auto mt-2"> + <p className="text-sm text-muted-foreground/90 font-normal leading-relaxed max-w-sm mx-auto mt-2">
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (1)
src/init/react-tanstack/public/favicon.icois excluded by!**/*.ico
📒 Files selected for processing (4)
src/cli/init_command.zig(17 hunks)src/init/react-tanstack/src/routes/__root.tsx(1 hunks)src/init/react-tanstack/src/routes/index.tsx(1 hunks)test/cli/init/init.test.ts(1 hunks)
🧰 Additional context used
🧠 Learnings (22)
📓 Common learnings
Learnt from: schiller-manuel
Repo: oven-sh/bun PR: 24648
File: src/init/react-tanstack/src/router.tsx:4-11
Timestamp: 2025-11-13T21:47:52.502Z
Learning: In TanStack Start projects, router type registration happens automatically in the generated `routeTree.gen.ts` file via module augmentation. Do not suggest adding manual type registration (e.g., `declare module "tanstack/react-router" { interface Register { router: AppRouter } }`) in `router.tsx` or other files when `routeTree.gen.ts` is present and generated by TanStack Start.
📚 Learning: 2025-10-19T02:44:46.354Z
Learnt from: theshadow27
Repo: oven-sh/bun PR: 23798
File: packages/bun-otel/context-propagation.test.ts:1-1
Timestamp: 2025-10-19T02:44:46.354Z
Learning: In the Bun repository, standalone packages under packages/ (e.g., bun-vscode, bun-inspector-protocol, bun-plugin-yaml, bun-plugin-svelte, bun-debug-adapter-protocol, bun-otel) co-locate their tests with package source code using *.test.ts files. This follows standard npm/monorepo patterns. The test/ directory hierarchy (test/js/bun/, test/cli/, test/js/node/) is reserved for testing Bun's core runtime APIs and built-in functionality, not standalone packages.
Applied to files:
test/cli/init/init.test.tssrc/cli/init_command.zig
📚 Learning: 2025-11-14T16:07:01.011Z
Learnt from: RiskyMH
Repo: oven-sh/bun PR: 24719
File: docs/bundler/executables.mdx:527-560
Timestamp: 2025-11-14T16:07:01.011Z
Learning: In the Bun repository, certain bundler features like compile with code splitting (--compile --splitting) are CLI-only and not supported in the Bun.build() JavaScript API. Tests for CLI-only features use backend: "cli" flag (e.g., test/bundler/bundler_compile_splitting.test.ts). The CompileBuildConfig interface correctly restricts these with splitting?: never;. When documenting CLI-only bundler features, add a note clarifying they're not available via the programmatic API.
Applied to files:
test/cli/init/init.test.tssrc/cli/init_command.zig
📚 Learning: 2025-10-26T01:32:04.844Z
Learnt from: Jarred-Sumner
Repo: oven-sh/bun PR: 24082
File: test/cli/test/coverage.test.ts:60-112
Timestamp: 2025-10-26T01:32:04.844Z
Learning: In the Bun repository test files (test/cli/test/*.test.ts), when spawning Bun CLI commands with Bun.spawnSync for testing, prefer using stdio: ["inherit", "inherit", "inherit"] to inherit stdio streams rather than piping them.
Applied to files:
test/cli/init/init.test.tssrc/cli/init_command.zig
📚 Learning: 2025-10-19T02:52:37.412Z
Learnt from: theshadow27
Repo: oven-sh/bun PR: 23798
File: packages/bun-otel/tsconfig.json:1-15
Timestamp: 2025-10-19T02:52:37.412Z
Learning: In the Bun repository, packages under packages/ (e.g., bun-otel) can follow a TypeScript-first pattern where package.json exports point directly to .ts files (not compiled .js files). Bun natively runs TypeScript, so consumers import .ts sources directly and receive full type information without needing compiled .d.ts declaration files. For such packages, adding "declaration": true or "outDir" in tsconfig.json is unnecessary and would break the export structure.
<!-- [remove_learning]
ceedde95-980e-4898-a2c6-40ff73913664
Applied to files:
test/cli/init/init.test.tssrc/init/react-tanstack/src/routes/index.tsxsrc/cli/init_command.zig
📚 Learning: 2025-10-08T13:48:02.430Z
Learnt from: Jarred-Sumner
Repo: oven-sh/bun PR: 23373
File: test/js/bun/tarball/extract.test.ts:107-111
Timestamp: 2025-10-08T13:48:02.430Z
Learning: In Bun's test runner, use `expect(async () => { await ... }).toThrow()` to assert async rejections. Unlike Jest/Vitest, Bun does not require `await expect(...).rejects.toThrow()` - the async function wrapper with `.toThrow()` is the correct pattern for async error assertions in Bun tests.
Applied to files:
test/cli/init/init.test.ts
📚 Learning: 2025-09-20T03:39:41.770Z
Learnt from: pfgithub
Repo: oven-sh/bun PR: 22534
File: test/regression/issue/21830.fixture.ts:14-63
Timestamp: 2025-09-20T03:39:41.770Z
Learning: Bun's test runner supports async describe callbacks, unlike Jest/Vitest where describe callbacks must be synchronous. The syntax `describe("name", async () => { ... })` is valid in Bun.
Applied to files:
test/cli/init/init.test.ts
📚 Learning: 2025-11-06T00:58:23.965Z
Learnt from: markovejnovic
Repo: oven-sh/bun PR: 24417
File: test/js/bun/spawn/spawn.test.ts:903-918
Timestamp: 2025-11-06T00:58:23.965Z
Learning: In Bun test files, `await using` with spawn() is appropriate for long-running processes that need guaranteed cleanup on scope exit or when explicitly testing disposal behavior. For short-lived processes that exit naturally (e.g., console.log scripts), the pattern `const proc = spawn(...); await proc.exited;` is standard and more common, as evidenced by 24 instances vs 4 `await using` instances in test/js/bun/spawn/spawn.test.ts.
Applied to files:
test/cli/init/init.test.ts
📚 Learning: 2025-11-08T04:06:33.198Z
Learnt from: Jarred-Sumner
Repo: oven-sh/bun PR: 24491
File: test/js/bun/transpiler/declare-global.test.ts:17-17
Timestamp: 2025-11-08T04:06:33.198Z
Learning: In Bun test files, `await using` with Bun.spawn() is the preferred pattern for spawned processes regardless of whether they are short-lived or long-running. Do not suggest replacing `await using proc = Bun.spawn(...)` with `const proc = Bun.spawn(...); await proc.exited;`.
Applied to files:
test/cli/init/init.test.tssrc/cli/init_command.zig
📚 Learning: 2025-10-25T17:20:19.041Z
Learnt from: theshadow27
Repo: oven-sh/bun PR: 24063
File: test/js/bun/telemetry/server-header-injection.test.ts:5-20
Timestamp: 2025-10-25T17:20:19.041Z
Learning: In the Bun telemetry codebase, tests are organized into two distinct layers: (1) Internal API tests in test/js/bun/telemetry/ use numeric InstrumentKind enum values to test Zig↔JS injection points and low-level integration; (2) Public API tests in packages/bun-otel/test/ use string InstrumentKind values ("http", "fetch", etc.) to test the public-facing BunSDK and instrumentation APIs. This separation allows internal tests to use efficient numeric enums for refactoring flexibility while the public API maintains a developer-friendly string-based interface.
Applied to files:
test/cli/init/init.test.ts
📚 Learning: 2025-11-13T07:23:11.159Z
Learnt from: RiskyMH
Repo: oven-sh/bun PR: 24668
File: docs/quickstart.mdx:181-197
Timestamp: 2025-11-13T07:23:11.159Z
Learning: In Bun.serve's routes configuration, imported HTML files can be assigned directly to routes without wrapping them in a function that returns a Response. For example, `import index from './index.html'` followed by `"/": index` in the routes object is valid Bun syntax for serving HTML content.
Applied to files:
src/init/react-tanstack/src/routes/index.tsxsrc/init/react-tanstack/src/routes/__root.tsx
📚 Learning: 2025-11-13T21:47:52.502Z
Learnt from: schiller-manuel
Repo: oven-sh/bun PR: 24648
File: src/init/react-tanstack/src/router.tsx:4-11
Timestamp: 2025-11-13T21:47:52.502Z
Learning: In TanStack Start projects, router type registration happens automatically in the generated `routeTree.gen.ts` file via module augmentation. Do not suggest adding manual type registration (e.g., `declare module "tanstack/react-router" { interface Register { router: AppRouter } }`) in `router.tsx` or other files when `routeTree.gen.ts` is present and generated by TanStack Start.
Applied to files:
src/init/react-tanstack/src/routes/index.tsxsrc/init/react-tanstack/src/routes/__root.tsx
📚 Learning: 2025-10-07T07:39:54.720Z
Learnt from: shadcn
Repo: oven-sh/bun PR: 23328
File: src/init/react-shadcn/src/components/ui/button.tsx:26-27
Timestamp: 2025-10-07T07:39:54.720Z
Learning: In the react-shadcn template (src/init/react-shadcn/src/components/ui/button.tsx), the button size variants `icon-sm` and `icon-lg` are intentionally included even if not immediately used in the template, as they are part of the design system API.
Applied to files:
src/init/react-tanstack/src/routes/index.tsxsrc/cli/init_command.zig
📚 Learning: 2025-10-07T07:39:39.050Z
Learnt from: shadcn
Repo: oven-sh/bun PR: 23328
File: src/init/react-shadcn/src/components/ui/button.tsx:16-16
Timestamp: 2025-10-07T07:39:39.050Z
Learning: In Tailwind CSS v4, `shadow-xs` is a valid box shadow utility class. Tailwind v4 includes new shadow scale tokens including `shadow-2xs`, `shadow-xs`, `shadow-sm`, `shadow`, `shadow-md`, etc.
Applied to files:
src/init/react-tanstack/src/routes/index.tsx
📚 Learning: 2025-10-17T20:50:58.644Z
Learnt from: taylordotfish
Repo: oven-sh/bun PR: 23755
File: src/bun.js/api/bun/socket/Handlers.zig:154-159
Timestamp: 2025-10-17T20:50:58.644Z
Learning: In Bun socket configuration error messages (src/bun.js/api/bun/socket/Handlers.zig), use the user-facing JavaScript names "data" and "drain" instead of internal field names "onData" and "onWritable", as these are the names users see in the API according to SocketConfig.bindv2.ts.
Applied to files:
src/cli/init_command.zig
📚 Learning: 2025-10-18T01:49:31.037Z
Learnt from: taylordotfish
Repo: oven-sh/bun PR: 23755
File: src/bun.js/api/bun/socket/SocketConfig.bindv2.ts:58-58
Timestamp: 2025-10-18T01:49:31.037Z
Learning: In Bun's bindgenv2 TypeScript bindings (e.g., src/bun.js/api/bun/socket/SocketConfig.bindv2.ts), the pattern `b.String.loose.nullable.loose` is intentional and not a duplicate. The first `.loose` applies to the String type (loose string conversion), while the second `.loose` applies to the nullable (loose nullable, treating all falsy values as null rather than just null/undefined).
Applied to files:
src/cli/init_command.zig
📚 Learning: 2025-10-29T19:05:25.638Z
Learnt from: theshadow27
Repo: oven-sh/bun PR: 24063
File: packages/bun-types/telemetry.d.ts:252-261
Timestamp: 2025-10-29T19:05:25.638Z
Learning: In packages/bun-types/telemetry.d.ts and src/telemetry/telemetry.zig, the naming inconsistency between `kind` (public API) and `type` (internal implementation) is intentional. The public API uses `InstrumentInfo.kind: InstrumentKind` with string values ("http", "fetch", etc.) for developer ergonomics, while the internal implementation uses `InstrumentRecord.type: InstrumentType` with numeric enum (0-6) for O(1) dispatch performance. This dual naming provides both ergonomic strings externally and efficient numeric dispatch internally without compromising either developer experience or runtime performance.
Applied to files:
src/cli/init_command.zig
📚 Learning: 2025-10-19T03:01:29.084Z
Learnt from: theshadow27
Repo: oven-sh/bun PR: 23798
File: src/bun.js/telemetry.zig:286-289
Timestamp: 2025-10-19T03:01:29.084Z
Learning: In src/bun.js/telemetry.zig, the guard preventing double configuration (lines 213-216) is intentional. The telemetry API uses a single-shot configuration model where configure() is called once during application startup. Users must call Bun.telemetry.configure(null) to reset before reconfiguring. This design ensures: (1) predictable state—callbacks don't change mid-request, avoiding race conditions; (2) zero overhead when disabled—no checking for callback changes on every request; (3) clear ownership—one adapter (e.g., bun-otel) owns the telemetry config. Merge-style reconfiguration would require atomic updates during active requests, adding overhead to the hot path.
<!-- [/add_learning]
Applied to files:
src/cli/init_command.zig
📚 Learning: 2025-10-16T17:32:03.074Z
Learnt from: markovejnovic
Repo: oven-sh/bun PR: 23710
File: src/install/PackageManager/PackageManagerOptions.zig:187-193
Timestamp: 2025-10-16T17:32:03.074Z
Learning: In Bun's codebase (particularly in files like src/install/PackageManager/PackageManagerOptions.zig), mixing bun.EnvVar.*.get() and bun.EnvVar.*.platformGet() for environment variable lookups is intentional and safe. The code is protected by compile-time platform checks (Environment.isWindows, etc.), and compilation will fail if the wrong function is used on the wrong platform. This pattern should not be flagged as a consistency issue.
Applied to files:
src/cli/init_command.zig
📚 Learning: 2025-09-12T18:16:50.754Z
Learnt from: RiskyMH
Repo: oven-sh/bun PR: 22606
File: src/glob/GlobWalker.zig:449-452
Timestamp: 2025-09-12T18:16:50.754Z
Learning: For Bun codebase: prefer using `std.fs.path.sep` over manual platform separator detection, and use `bun.strings.lastIndexOfChar` instead of `std.mem.lastIndexOfScalar` for string operations.
Applied to files:
src/cli/init_command.zig
📚 Learning: 2025-10-08T13:56:00.875Z
Learnt from: Jarred-Sumner
Repo: oven-sh/bun PR: 23373
File: src/bun.js/api/BunObject.zig:2514-2521
Timestamp: 2025-10-08T13:56:00.875Z
Learning: For Bun codebase: prefer using `bun.path` utilities (e.g., `bun.path.joinAbsStringBuf`, `bun.path.join`) over `std.fs.path` functions for path operations.
Applied to files:
src/cli/init_command.zig
📚 Learning: 2025-11-11T22:55:08.547Z
Learnt from: pfgithub
Repo: oven-sh/bun PR: 24571
File: src/css/values/url.zig:97-116
Timestamp: 2025-11-11T22:55:08.547Z
Learning: In Zig 0.15, the standard library module `std.io` was renamed to `std.Io` (with capital I). Code using `std.Io.Writer.Allocating` and similar types is correct for Zig 0.15+.
Applied to files:
src/cli/init_command.zig
🧬 Code graph analysis (3)
test/cli/init/init.test.ts (1)
test/harness.ts (3)
tempDirWithFiles(259-266)bunExe(102-105)bunEnv(49-64)
src/init/react-tanstack/src/routes/index.tsx (2)
src/init/react-tanstack/src/routes/__root.tsx (1)
Route(8-29)src/init/react-tanstack/src/routes/stats.tsx (1)
Route(39-45)
src/init/react-tanstack/src/routes/__root.tsx (2)
src/init/react-tanstack/src/routes/index.tsx (1)
Route(13-19)src/init/react-tanstack/src/routes/stats.tsx (1)
Route(39-45)
🪛 Biome (2.1.2)
src/init/react-tanstack/src/routes/__root.tsx
[error] 77-78: Provide a lang attribute when using the html element.
Setting a lang attribute on HTML document elements configures the languageused by screen readers when no user default is specified.
(lint/a11y/useHtmlLang)
🔇 Additional comments (2)
src/cli/init_command.zig (2)
1279-1287: LGTM! Cross-platform getcwd implementationThe previous review correctly flagged
std.posix.getcwdas Windows-incompatible. This implementation properly usesbun.sys.getcwd, which is a cross-platform wrapper with appropriate error handling. The directory name is then extracted using the standardstd.fs.path.basename, which works across all platforms.
386-389: LGTM! Well-integrated TanStack Start templateThe TanStack Start template integration follows established patterns:
- CLI argument parsing (lines 386-389) matches the existing shadcn/tailwind syntax
- Interactive menu option (lines 593-610) fits naturally into the existing flow
- Template-aware agent rules (lines 1047-1096, 1131-1140) properly handle TanStack-specific documentation
- File structure (lines 1210-1226) follows the same pattern as other React templates
The implementation is consistent with the codebase conventions.
Also applies to: 593-610, 1025-1027, 1047-1096, 1131-1140, 1210-1226, 1239-1239
| test("bun init --react=tanstack works", async () => { | ||
| const temp = tempDirWithFiles("bun-init--react=tanstack-works", {}); | ||
|
|
||
| const { exited } = Bun.spawn({ | ||
| cmd: [bunExe(), "init", "--react=tanstack"], | ||
| cwd: temp, | ||
| stdio: ["ignore", "inherit", "inherit"], | ||
| env: bunEnv, | ||
| }); | ||
|
|
||
| expect(await exited).toBe(0); | ||
|
|
||
| const pkg = JSON.parse(fs.readFileSync(path.join(temp, "package.json"), "utf8")); | ||
| expect(pkg).toHaveProperty("dependencies.react"); | ||
| expect(pkg).toHaveProperty("dependencies.react-dom"); | ||
| expect(pkg).toHaveProperty("dependencies.@tanstack/react-router"); | ||
| expect(pkg).toHaveProperty("dependencies.@tanstack/react-start"); | ||
| expect(pkg).toHaveProperty("dependencies.@tailwindcss/vite"); | ||
| expect(pkg).toHaveProperty("dependencies.tailwindcss"); | ||
|
|
||
| expect(fs.existsSync(path.join(temp, "src"))).toBe(true); | ||
| expect(fs.existsSync(path.join(temp, "src/router.tsx"))).toBe(true); | ||
| expect(fs.existsSync(path.join(temp, "src/routes"))).toBe(true); | ||
| expect(fs.existsSync(path.join(temp, "vite.config.ts"))).toBe(true); | ||
| expect(fs.existsSync(path.join(temp, "public"))).toBe(true); | ||
| }, 30_000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improve test coverage for dependencies
The test has two issues:
-
Line 316 expects
@tailwindcss/viteindependencies, but this package should be indevDependencies(as flagged in the src/cli/init_command.zig review). Once that's fixed, this test assertion should be updated to checkdevDependenciesinstead. -
The test doesn't verify any devDependencies. The
tanstackDependencyGroup includes@types/react,@types/react-dom,@vitejs/plugin-react,vite, andvite-tsconfig-pathsin devDependencies, but none are checked.
Consider adding checks for devDependencies:
expect(pkg).toHaveProperty("dependencies.react");
expect(pkg).toHaveProperty("dependencies.react-dom");
expect(pkg).toHaveProperty("dependencies.@tanstack/react-router");
expect(pkg).toHaveProperty("dependencies.@tanstack/react-start");
- expect(pkg).toHaveProperty("dependencies.@tailwindcss/vite");
expect(pkg).toHaveProperty("dependencies.tailwindcss");
+
+ expect(pkg).toHaveProperty("devDependencies.@tailwindcss/vite");
+ expect(pkg).toHaveProperty("devDependencies.@types/react");
+ expect(pkg).toHaveProperty("devDependencies.@types/react-dom");
+ expect(pkg).toHaveProperty("devDependencies.@vitejs/plugin-react");
+ expect(pkg).toHaveProperty("devDependencies.vite");
+ expect(pkg).toHaveProperty("devDependencies.vite-tsconfig-paths");📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| test("bun init --react=tanstack works", async () => { | |
| const temp = tempDirWithFiles("bun-init--react=tanstack-works", {}); | |
| const { exited } = Bun.spawn({ | |
| cmd: [bunExe(), "init", "--react=tanstack"], | |
| cwd: temp, | |
| stdio: ["ignore", "inherit", "inherit"], | |
| env: bunEnv, | |
| }); | |
| expect(await exited).toBe(0); | |
| const pkg = JSON.parse(fs.readFileSync(path.join(temp, "package.json"), "utf8")); | |
| expect(pkg).toHaveProperty("dependencies.react"); | |
| expect(pkg).toHaveProperty("dependencies.react-dom"); | |
| expect(pkg).toHaveProperty("dependencies.@tanstack/react-router"); | |
| expect(pkg).toHaveProperty("dependencies.@tanstack/react-start"); | |
| expect(pkg).toHaveProperty("dependencies.@tailwindcss/vite"); | |
| expect(pkg).toHaveProperty("dependencies.tailwindcss"); | |
| expect(fs.existsSync(path.join(temp, "src"))).toBe(true); | |
| expect(fs.existsSync(path.join(temp, "src/router.tsx"))).toBe(true); | |
| expect(fs.existsSync(path.join(temp, "src/routes"))).toBe(true); | |
| expect(fs.existsSync(path.join(temp, "vite.config.ts"))).toBe(true); | |
| expect(fs.existsSync(path.join(temp, "public"))).toBe(true); | |
| }, 30_000); | |
| test("bun init --react=tanstack works", async () => { | |
| const temp = tempDirWithFiles("bun-init--react=tanstack-works", {}); | |
| const { exited } = Bun.spawn({ | |
| cmd: [bunExe(), "init", "--react=tanstack"], | |
| cwd: temp, | |
| stdio: ["ignore", "inherit", "inherit"], | |
| env: bunEnv, | |
| }); | |
| expect(await exited).toBe(0); | |
| const pkg = JSON.parse(fs.readFileSync(path.join(temp, "package.json"), "utf8")); | |
| expect(pkg).toHaveProperty("dependencies.react"); | |
| expect(pkg).toHaveProperty("dependencies.react-dom"); | |
| expect(pkg).toHaveProperty("dependencies.@tanstack/react-router"); | |
| expect(pkg).toHaveProperty("dependencies.@tanstack/react-start"); | |
| expect(pkg).toHaveProperty("dependencies.tailwindcss"); | |
| expect(pkg).toHaveProperty("devDependencies.@tailwindcss/vite"); | |
| expect(pkg).toHaveProperty("devDependencies.@types/react"); | |
| expect(pkg).toHaveProperty("devDependencies.@types/react-dom"); | |
| expect(pkg).toHaveProperty("devDependencies.@vitejs/plugin-react"); | |
| expect(pkg).toHaveProperty("devDependencies.vite"); | |
| expect(pkg).toHaveProperty("devDependencies.vite-tsconfig-paths"); | |
| expect(fs.existsSync(path.join(temp, "src"))).toBe(true); | |
| expect(fs.existsSync(path.join(temp, "src/router.tsx"))).toBe(true); | |
| expect(fs.existsSync(path.join(temp, "src/routes"))).toBe(true); | |
| expect(fs.existsSync(path.join(temp, "vite.config.ts"))).toBe(true); | |
| expect(fs.existsSync(path.join(temp, "public"))).toBe(true); | |
| }, 30_000); |
🤖 Prompt for AI Agents
In test/cli/init/init.test.ts around lines 299 to 324, update the dependency
assertions: change the assertion that currently checks "@tailwindcss/vite" in
pkg.dependencies to instead check pkg.devDependencies for "@tailwindcss/vite"
(reflecting the CLI change moving it to devDependencies), and add assertions
that verify the tanstack DependencyGroup devDependencies exist (e.g., check
pkg.devDependencies has "@types/react", "@types/react-dom",
"@vitejs/plugin-react", "vite", and "vite-tsconfig-paths"); keep the existing
checks for runtime dependencies (react, react-dom, @tanstack/react-router,
@tanstack/react-start, tailwindcss) and the filesystem assertions unchanged.
Adding a 260 KB bun header image is not a good use of binary size This reverts commit 830fd9b.
This PR adds a new
--react=tanstackoption to bun init that scaffolds a TanStack Start project on the buntime: