Move "Bun fullstack dev server" to be its own thing separate from "Vanilla"#1016
Conversation
|
Pullfrog stalled — likely cause: The agent stopped emitting events for 300s and was killed by the activity-timeout watchdog. No events were emitted before the failure. Recent agent stderr
|
🦋 Changeset detectedLatest commit: 429253e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThis PR refactors ArkEnv CLI detection and scaffolding to distinguish Bun runtime/server (Bun.serve) from Bun bundler (Bun.build). It introduces bunFeatures detection (serve/build), updates framework names to bun-fullstack/vanilla, and propagates feature-aware wiring through prompts, planner, executor, bootstrappers, templates, tests, and docs. ChangesBun Server/Bundler Separation in ArkEnv CLI
Estimated code review effort 🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
🤖 Hi @yamcodes, I've received your request, and I'm working on it now! You can track my progress in the logs for more details. |
arkenv
@arkenv/bun-plugin
@arkenv/cli
@arkenv/fumadocs-ui
@arkenv/vite-plugin
commit: |
📦 Bundle Size Report✅ All size limits passed! |
|
🤖 I'm sorry @yamcodes, but I was unable to process your request. Please see the logs for more details. |
This comment was marked as resolved.
This comment was marked as resolved.
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 6
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/cli/src/features/scaffold/executor.ts (1)
128-142:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winAlways run Bun bootstrap for
bun-fullstackplans.Line 128’s guard skips
bootstrapBunConfigwhen both config and features are absent, which bypasses the vanilla guidance path and falls back to a misleading manual-bootstrap message.Proposed fix
} else if (plan.bootstrap.framework === "bun-fullstack") { const bunConfigPath = await this.workspace.findBunConfig(); - if (bunConfigPath || plan.bootstrap.bunFeatures?.length) { - const result = await this.workspace.bootstrapBunConfig( - bunConfigPath, - plan.bootstrap.bunFeatures, - ); - if (result.success && result.instructions) { - this.reporter.info(result.instructions); - } else if (!result.success) { - this.reporter.error(result.error || "Bun bootstrap failed"); - } - } else { - this.reporter.info( - `No Bun config found — create a ${code("bun.config.ts")} or run ${code("bun init")} to bootstrap manually.`, - ); - } + const result = await this.workspace.bootstrapBunConfig( + bunConfigPath, + plan.bootstrap.bunFeatures, + ); + if (result.success && result.instructions) { + this.reporter.info(result.instructions); + } else if (!result.success) { + this.reporter.error(result.error || "Bun bootstrap failed"); + } }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/cli/src/features/scaffold/executor.ts` around lines 128 - 142, The guard around calling this.workspace.bootstrapBunConfig skips the bootstrap flow when neither bunConfigPath nor plan.bootstrap.bunFeatures exist, causing incorrect messaging for bun-fullstack plans; update the logic to always invoke workspace.bootstrapBunConfig for plans where plan.type === "bun-fullstack" (use plan.bootstrap or plan.type check) regardless of bunConfigPath or bunFeatures, then keep the existing result handling (reporter.info(result.instructions) on success, reporter.error(result.error || "Bun bootstrap failed") on failure); for non-bun-fullstack plans preserve the original conditional that falls back to reporter.info about creating bun.config.ts or running bun init. Ensure you reference bootstrapBunConfig, bunConfigPath, plan.bootstrap.bunFeatures, and reporter.info/reporter.error when making the change.
🧹 Nitpick comments (1)
CONTEXT.md (1)
195-197: ⚡ Quick winClarify the relationship between Bun.serve and bundling integration.
The description of
Bun.serveas providing "integrated frontend bundling" is technically accurate—Bun.serve does integrate with Bun's bundler in full-stack setups. However, the current phrasing may suggest thatBun.serveitself performs bundling, which could be misleading.Consider clarifying that
Bun.serveis an HTTP server runtime that integrates with Bun's bundler (scanning HTML, triggering bundling on-demand, and serving assets), rather than implying it performs bundling directly. This distinction helps readers understand that bundling and serving are separate concerns coordinated together, similar to howBun.buildis the explicit bundling API for custom scripts.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@CONTEXT.md` around lines 195 - 197, The wording conflates Bun.serve with the bundler; update the text to clarify that Bun.serve is an HTTP server runtime that integrates with Bun's bundler (it scans HTML, triggers on-demand bundling, and serves resulting assets) rather than performing bundling itself; explicitly state that bundling is handled by Bun's bundler/APIs (e.g., Bun.build) and note the integration point via `@arkenv/bun-plugin` in bunfig.toml so readers understand Bun.serve and Bun.build are separate but coordinated concerns.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/cli/src/adapters/node-project-scanner/utils/detector.ts`:
- Around line 40-48: The Bun feature detection is currently skipped when the
isBun flag is false, causing projects that use Bun APIs without Bun types or
when running under Node to be misclassified; update the logic in detector.ts so
detectBunFeatures(cwd, tsConfig) is called unconditionally (or at least when
other heuristics are inconclusive) instead of only when isBun is true, and keep
the check that if features.length > 0 then return "bun-fullstack"; reference the
isBun variable and the detectBunFeatures function in your change to locate and
modify the gated block.
- Around line 90-100: The feature detector in detector.ts misses single-quoted
Bun imports because it only checks for the literal string from "bun"; update the
checks around foundServe/features.push("serve") and foundBuild to detect both
single and double quotes (or use a small regex like /from\s+['"]bun['"]/), and
ensure the same pattern is used where you currently check content.includes('from
"bun"') so imports like import { serve } from 'bun' and import { build } from
'bun' are recognized.
In `@packages/cli/src/adapters/node-workspace/workspace.ts`:
- Line 57: The current detectFramework() logic classifies projects as
"bun-fullstack" solely based on dependencies (allDeps["`@types/bun`"] ||
allDeps.bun), which over-classifies; change it to require feature-based
detection instead: remove or guard the dependency-only branch and only return
"bun-fullstack" when the codebase uses Bun APIs (e.g., detect features like
"Bun.serve" or "Bun.build" via the same feature/AST checks used elsewhere in
detectFramework()), and apply the same fix to the similar checks around the
other Bun detection sites mentioned (the blocks corresponding to lines ~73-75)
so dependency presence alone no longer triggers bun-fullstack.
In `@packages/cli/src/cli/ui/prompts/steps/framework.ts`:
- Line 18: Update the hint string currently set as "Client-side and build-time
validation" to use the new "Static Inlining" terminology; locate the property
with hint: "Client-side and build-time validation" in the prompt step and change
it to a wording like "Client-side and static inlining validation" (or
"Client-side validation and static inlining") so it matches the new terminology
across the codebase.
In `@packages/cli/src/cli/ui/prompts/utils.ts`:
- Around line 8-9: Update the type predicate that narrows result to non-null
properties: replace the conditional type `T[K] extends null ? never : T[K]` in
the return type `result is { [K in keyof T]: ... }` with `Exclude<T[K], null>`
so the predicate correctly removes null from union types (e.g., `string | null`)
and matches the runtime `Object.values(result).every((v) => v !== null)` check.
In `@packages/cli/src/cli/ui/prompts/wizard.ts`:
- Around line 51-54: The interactive Bun flow currently overwrites detected
build capability by returning only results.bunBuild; change the bunBuild branch
so it invokes steps.bunBuild(...) with a default/initial value that preserves
detection (e.g. pass defaults.bunFeatures?.build || results.bunBuild as the
initial value) so detection is kept unless user changes it; update the
bunBuildStep implementation (bunBuildStep / steps.bunBuild) to accept an
initial/default parameter and seed the prompt with that value; apply the same
preservation logic to the other affected branches (the mapped block around lines
73-78) so detected defaults are used as the prompt defaults.
---
Outside diff comments:
In `@packages/cli/src/features/scaffold/executor.ts`:
- Around line 128-142: The guard around calling
this.workspace.bootstrapBunConfig skips the bootstrap flow when neither
bunConfigPath nor plan.bootstrap.bunFeatures exist, causing incorrect messaging
for bun-fullstack plans; update the logic to always invoke
workspace.bootstrapBunConfig for plans where plan.type === "bun-fullstack" (use
plan.bootstrap or plan.type check) regardless of bunConfigPath or bunFeatures,
then keep the existing result handling (reporter.info(result.instructions) on
success, reporter.error(result.error || "Bun bootstrap failed") on failure); for
non-bun-fullstack plans preserve the original conditional that falls back to
reporter.info about creating bun.config.ts or running bun init. Ensure you
reference bootstrapBunConfig, bunConfigPath, plan.bootstrap.bunFeatures, and
reporter.info/reporter.error when making the change.
---
Nitpick comments:
In `@CONTEXT.md`:
- Around line 195-197: The wording conflates Bun.serve with the bundler; update
the text to clarify that Bun.serve is an HTTP server runtime that integrates
with Bun's bundler (it scans HTML, triggers on-demand bundling, and serves
resulting assets) rather than performing bundling itself; explicitly state that
bundling is handled by Bun's bundler/APIs (e.g., Bun.build) and note the
integration point via `@arkenv/bun-plugin` in bunfig.toml so readers understand
Bun.serve and Bun.build are separate but coordinated concerns.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: c664cb94-368a-41e9-87d4-e8374788733d
📒 Files selected for processing (33)
.changeset/1015-separate-bun-server-and-bundler.mdCONTEXT.mdpackages/cli/README.mdpackages/cli/src/adapters/injection.test.tspackages/cli/src/adapters/injection.tspackages/cli/src/adapters/node-project-scanner/node-project-scanner.adapter.test.tspackages/cli/src/adapters/node-project-scanner/node-project-scanner.adapter.tspackages/cli/src/adapters/node-project-scanner/utils/detector.tspackages/cli/src/adapters/node-workspace/node-workspace.test.tspackages/cli/src/adapters/node-workspace/node-workspace.tspackages/cli/src/adapters/node-workspace/utils/bootstrappers.tspackages/cli/src/adapters/node-workspace/workspace.tspackages/cli/src/adapters/prompt.adapter.tspackages/cli/src/cli/commands/init.tspackages/cli/src/cli/ui/prompts.test.tspackages/cli/src/cli/ui/prompts/steps.tspackages/cli/src/cli/ui/prompts/steps/framework.tspackages/cli/src/cli/ui/prompts/utils.tspackages/cli/src/cli/ui/prompts/wizard.tspackages/cli/src/features/scaffold/env-template.test.tspackages/cli/src/features/scaffold/executor.test.tspackages/cli/src/features/scaffold/executor.tspackages/cli/src/features/scaffold/plan.tspackages/cli/src/features/scaffold/planner.test.tspackages/cli/src/features/scaffold/planner.tspackages/cli/src/features/scaffold/templates/arktype.tspackages/cli/src/features/scaffold/templates/valibot.tspackages/cli/src/features/scaffold/templates/zod.tspackages/cli/src/shared/ports/project-scanner.port.tspackages/cli/src/shared/ports/prompt.port.tspackages/cli/src/shared/ports/workspace.port.tspackages/cli/src/test/utils.tsskills/tackle-issue/SKILL.md
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
…ns-bundler-in-arkenv-cli-init
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/cli/src/adapters/node-workspace/workspace.ts`:
- Around line 58-59: The current logic gates Bun fullstack detection on declared
deps (hasBunDep) which misses projects that use Bun APIs without listing
bun/@types/bun; update the branches that check for Bun to call and await
this.hasBunFeatures() unconditionally (after the Vite detection step) and return
"bun-fullstack" if it returns true—replace both occurrences that reference
hasBunDep/hasBunFeatures (the lines with hasBunDep && (await
this.hasBunFeatures()) and the similar block later) so the runtime feature check
runs regardless of declared dependencies.
In `@packages/cli/src/cli/ui/prompts/wizard.ts`:
- Around line 36-37: The fast-path assignment for the bunFeatures field can
become undefined for framework === "bun-fullstack" when defaults?.bunFeatures is
missing; update the bunFeatures assignment (the bunFeatures property in the
answers/build or wizard fast-path) to fallback to the interactive default (e.g.,
["serve"]) when defaults?.bunFeatures is falsy so bunFeatures becomes
defaults?.bunFeatures ?? ["serve"] for the "bun-fullstack" branch.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 3510cd80-a526-4280-bba8-55148c2ea2ec
📒 Files selected for processing (10)
CONTEXT.mdpackages/cli/src/adapters/node-project-scanner/utils/detector.tspackages/cli/src/adapters/node-workspace/workspace.tspackages/cli/src/adapters/prompt.adapter.tspackages/cli/src/cli/commands/init.tspackages/cli/src/cli/ui/prompts/steps/framework.tspackages/cli/src/cli/ui/prompts/utils.tspackages/cli/src/cli/ui/prompts/wizard.tspackages/cli/src/features/scaffold/executor.test.tspackages/cli/src/features/scaffold/executor.ts
🚧 Files skipped from review as they are similar to previous changes (5)
- packages/cli/src/features/scaffold/executor.test.ts
- packages/cli/src/adapters/prompt.adapter.ts
- packages/cli/src/cli/ui/prompts/utils.ts
- packages/cli/src/cli/ui/prompts/steps/framework.ts
- packages/cli/src/cli/commands/init.ts
| const hasBunDep = allDeps["@types/bun"] || allDeps.bun; | ||
| if (hasBunDep && (await this.hasBunFeatures())) return "bun-fullstack"; |
There was a problem hiding this comment.
Bun feature detection is still dependency/runtime-gated and can miss real Bun fullstack projects.
If a project uses Bun.serve/Bun.build but doesn’t declare bun/@types/bun (and CLI runs under Node), this returns "vanilla" despite detected source features. Detect hasBunFeatures() unconditionally after Vite checks.
Suggested fix
- const hasBunDep = allDeps["`@types/bun`"] || allDeps.bun;
- if (hasBunDep && (await this.hasBunFeatures())) return "bun-fullstack";
+ if (allDeps["`@types/bun`"] || allDeps.bun) {
+ if (await this.hasBunFeatures()) return "bun-fullstack";
+ }
@@
- // Check for bun runtime
- if ("bun" in process.versions && (await this.hasBunFeatures())) {
- return "bun-fullstack";
- }
+ // Feature-first Bun detection
+ if (await this.hasBunFeatures()) return "bun-fullstack";
return "vanilla";Also applies to: 75-79
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/cli/src/adapters/node-workspace/workspace.ts` around lines 58 - 59,
The current logic gates Bun fullstack detection on declared deps (hasBunDep)
which misses projects that use Bun APIs without listing bun/@types/bun; update
the branches that check for Bun to call and await this.hasBunFeatures()
unconditionally (after the Vite detection step) and return "bun-fullstack" if it
returns true—replace both occurrences that reference hasBunDep/hasBunFeatures
(the lines with hasBunDep && (await this.hasBunFeatures()) and the similar block
later) so the runtime feature check runs regardless of declared dependencies.
| bunFeatures: | ||
| framework === "bun-fullstack" ? defaults?.bunFeatures : undefined, |
There was a problem hiding this comment.
--yes Bun fullstack path can lose default Bun feature selection.
In the fast path, bunFeatures becomes undefined when framework === "bun-fullstack" and defaults don’t include it. This diverges from interactive flow (which defaults to at least ["serve"]).
Suggested fix
framework,
bunFeatures:
- framework === "bun-fullstack" ? defaults?.bunFeatures : undefined,
+ framework === "bun-fullstack"
+ ? (defaults?.bunFeatures ?? ["serve"])
+ : undefined,📝 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.
| bunFeatures: | |
| framework === "bun-fullstack" ? defaults?.bunFeatures : undefined, | |
| bunFeatures: | |
| framework === "bun-fullstack" | |
| ? (defaults?.bunFeatures ?? ["serve"]) | |
| : undefined, |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/cli/src/cli/ui/prompts/wizard.ts` around lines 36 - 37, The
fast-path assignment for the bunFeatures field can become undefined for
framework === "bun-fullstack" when defaults?.bunFeatures is missing; update the
bunFeatures assignment (the bunFeatures property in the answers/build or wizard
fast-path) to fallback to the interactive default (e.g., ["serve"]) when
defaults?.bunFeatures is falsy so bunFeatures becomes defaults?.bunFeatures ??
["serve"] for the "bun-fullstack" branch.
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @arkenv/cli@0.0.9 ### Patch Changes - #### Refined setup experience in `arkenv init` _[`#1016`](#1016) [`d536ed7`](d536ed7) [@yamcodes](https://github.com/yamcodes)_ - **Clearer Framework Options**: Updated terminology to better distinguish between server-side runtime validation and client-side bundling integrations. - **Architecture Detection**: Improved detection logic recommends the most efficient configuration based on your project's features. - **Better In-File Guidance**: Generated templates now include comments clarifying validation behavior for your specific environment. - #### Add keyboard navigation hints _[`ac3adcc`](ac3adcc) [@yamcodes](https://github.com/yamcodes)_ - #### Improve Ctrl+C handling and implement graceful shutdown _[`#1019`](#1019) [`102ce4a`](102ce4a) [@yamcodes](https://github.com/yamcodes)_ - Implemented graceful shutdown for `SIGINT` (Ctrl+C) to flush logs and JSON data, with a 2-second safety timeout and support for immediate exit on a second Ctrl+C. - Corrected exit code (130) for `SIGINT` terminations. - Fixed a bug where the `init` wizard would continue after a prompt was cancelled. - #### Respect `tsconfig.json` for path resolution and scaffolding _[`#1013`](#1013) [`0a18edd`](0a18edd) [@yamcodes](https://github.com/yamcodes)_ The Arkenv CLI now dynamically resolves configuration paths and scans project files by respecting `tsconfig.json` settings (`rootDir`, `paths`, `baseUrl`). Key improvements include: - **Robust `tsconfig` Parser**: Added support for parsing `tsconfig.json` files with comments (`jsonc-parser`), handling `extends`, `rootDir`, `baseUrl`, and `paths` alias resolution. - **Dynamic Scaffolding Defaults**: Updated `init` scaffolding logic to suggest project-appropriate default paths based on `compilerOptions.rootDir` rather than hardcoding `./src/env.ts`. - **Advanced Environment Scanning**: Enhanced `getEnvExampleKeys` to scan project source files for `process.env` and `import.meta.env` usages, correctly resolving aliased imports (e.g. `@/env`). - **Framework & Package Manager Detection**: Leveraged parsed `tsconfig.json` context to accurately identify project frameworks and package managers. Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

Fixes #1015
This PR enhances the
arkenv initcommand to support both Vanilla Bun runtime usage and full-stack/frontend bundling via Bun's dev server (Bun.serve) or programmatic Bundler (Bun.build).Changes:
envobject without needing build-time plugins.Bun.serveorBun.buildto suggest optional inlining integration.CONTEXT.mdand CLI strings to use "Vanilla" terminology, "Fullstack" specific grammars, and imperative verbs.ProjectOptionsandScaffoldingPlanto handle optional properties more strictly (exactOptionalPropertyTypes).Summary by CodeRabbit
New Features
arkenv initflow with smarter architecture detection and explicit framework choices: Vite, Bun Fullstack, or VanillaDocumentation