Skip to content

Move "Bun fullstack dev server" to be its own thing separate from "Vanilla"#1016

Merged
yamcodes merged 22 commits into
mainfrom
1015-separate-buns-development-server-and-buns-bundler-in-arkenv-cli-init
May 18, 2026
Merged

Move "Bun fullstack dev server" to be its own thing separate from "Vanilla"#1016
yamcodes merged 22 commits into
mainfrom
1015-separate-buns-development-server-and-buns-bundler-in-arkenv-cli-init

Conversation

@yamcodes

@yamcodes yamcodes commented May 17, 2026

Copy link
Copy Markdown
Owner

Fixes #1015

This PR enhances the arkenv init command 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:

  • Pivot to Vanilla Default: Optimized the workflow for the majority of Bun users. Vanilla integration is now the default, emphasizing type-safe usage via the env object without needing build-time plugins.
  • Bun Full-Stack Application Grouping: Grouped Fullstack dev server (Bun.serve) and Fullstack programmatic bundler (Bun.build) under a single category for better clarity on when they are needed (specifically for static inlining of environment variables).
  • Refined Detection: Automatically detect usage of Bun.serve or Bun.build to suggest optional inlining integration.
  • Terminology Refinement: Removed confusing "build-time" grammar from Bun Fullstack descriptions, replacing it with "Static Inlining" and "static replacement during bundling".
  • Vocabulary Alignment: Updated CONTEXT.md and CLI strings to use "Vanilla" terminology, "Fullstack" specific grammars, and imperative verbs.
  • Improved Type Safety: Updated ProjectOptions and ScaffoldingPlan to handle optional properties more strictly (exactOptionalPropertyTypes).

Summary by CodeRabbit

  • New Features

    • Improved arkenv init flow with smarter architecture detection and explicit framework choices: Vite, Bun Fullstack, or Vanilla
    • Added Bun Fullstack handling (serve/build options) and a prompt to bootstrap Bun build integration
  • Documentation

    • Updated integration guides and generated templates with clearer client vs server environment validation guidance and framework-specific instructions

Review Change Stack

@yamcodes yamcodes added the enhancement New feature or improvement label May 17, 2026
@pullfrog

pullfrog Bot commented May 17, 2026

Copy link
Copy Markdown
Contributor

Pullfrog stalled — likely cause: rate limited (429)

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
... (older lines truncated)
ission mode.","parameters":{"required":["branchName"],"type":"object","properties":{"branchName":{"description":"Remote branch to delete","type":"string"}}}},{"name":"pullfrog_create_pull_request","description":"Create a pull request from the current branch","parameters":{"required":["base","body","title"],"type":"object","properties":{"base":{"description":"the base branch to merge into (e.g., 'main')","type":"string"},"body":{"description":"the body content of the pull request","type":"string"},"title":{"description":"the title of the pull request","type":"string"},"draft":{"description":"if true, create the pull request as a draft. use when the user explicitly asks for a draft PR.","type":"boolean"}}}},{"name":"pullfrog_update_pull_request_body","description":"Update the body/description of an existing pull request","parameters":{"required":["body","pull_number"],"type":"object","properties":{"body":{"description":"the new body content for the pull request","type":"string"},"pull_number":{"description":"the pull request number to update","type":"number"}}}}]}],"toolConfig":{"functionCallingConfig":{"mode":"AUTO"}}},"statusCode":429,"responseHeaders":{"alt-svc":"h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000","content-length":"308","content-type":"text/event-stream","date":"Sun, 17 May 2026 09:02:44 GMT","server":"scaffolding on HTTPServer2","server-timing":"gfet4t7; dur=256","vary":"Origin, X-Origin, Referer","x-content-type-options":"nosniff","x-frame-options":"SAMEORIGIN","x-xss-protection":"0"},"responseBody":"{\n  \"error\": {\n    \"code\": 429,\n    \"message\": \"Your project has exceeded its monthly spending cap. Please go to AI Studio at https://ai.studio/spend to manage your project spend cap. Learn more at https://ai.google.dev/gemini-api/docs/billing#project-spend-caps. \",\n    \"status\": \"RESOURCE_EXHAUSTED\"\n  }\n}\n","isRetryable":true,"data":{"error":{"code":429,"message":"Your project has exceeded its monthly spending cap. Please go to AI Studio at https://ai.studio/spend to manage your project spend cap. Learn more at https://ai.google.dev/gemini-api/docs/billing#project-spend-caps. ","status":"RESOURCE_EXHAUSTED"}}}} stream error
ERROR 2026-05-17T09:02:44 +0ms service=session.processor error=Your project has exceeded its monthly spending cap. Please go to AI Studio at https://ai.studio/spend to manage your project spend cap. Learn more at https://ai.google.dev/gemini-api/docs/billing#project-spend-caps.  stack="AI_APICallError: Your project has exceeded its monthly spending cap. Please go to AI Studio at https://ai.studio/spend to manage your project spend cap. Learn more at https://ai.google.dev/gemini-api/docs/billing#project-spend-caps. \n    at <anonymous> (../../node_modules/.bun/@ai-sdk+provider-utils@3.0.20+d6123d32214422cb/node_modules/@ai-sdk/provider-utils/dist/index.mjs:936:18)\n    at processTicksAndRejections (native:7:39)" process
INFO  2026-05-17T09:02:44 +1ms service=bus type=session.status publishing

Pullfrog  | Rerun failed job ➔View workflow run | via Pullfrog | Using Gemini Pro𝕏

@changeset-bot

changeset-bot Bot commented May 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 429253e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@arkenv/cli Minor

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

@coderabbitai

coderabbitai Bot commented May 17, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ac5f87d0-b7d4-4e1c-a4b3-b387f99dad8f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This 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.

Changes

Bun Server/Bundler Separation in ArkEnv CLI

Layer / File(s) Summary
Docs & Changeset
.changeset/1015-separate-bun-server-and-bundler.md, CONTEXT.md, packages/cli/README.md, skills/tackle-issue/SKILL.md
Add changeset release notes; new Framework & Runtime Integrations docs; CLI README architecture section; skill workflow lint/format change.
Ports & Core Types
packages/cli/src/shared/ports/project-scanner.port.ts, packages/cli/src/shared/ports/prompt.port.ts, packages/cli/src/shared/ports/workspace.port.ts, packages/cli/src/features/scaffold/plan.ts
Framework union updated to vite | bun-fullstack | vanilla; `bunFeatures?: ("serve"
Bun Feature Detection
packages/cli/src/adapters/node-project-scanner/utils/detector.ts, packages/cli/src/adapters/node-project-scanner/node-project-scanner.adapter.ts, tests
New detectBunFeatures parses bunfig.toml and scans files for Bun.serve/Bun.build; detectFramework returns bun-fullstack only when features found, otherwise vanilla.
Workspace Adapter & Bootstrappers
packages/cli/src/adapters/node-workspace/node-workspace.ts, packages/cli/src/adapters/node-workspace/utils/bootstrappers.ts, tests
bootstrapBunConfig accepts features and builds instructions for vanilla/serve/build cases; NodeWorkspace forwards features and narrows safeAppend framework to bun-fullstack.
CLI Wizard & Prompt Steps
packages/cli/src/cli/ui/prompts/steps/framework.ts, packages/cli/src/cli/ui/prompts/steps.ts, packages/cli/src/cli/ui/prompts/utils.ts, packages/cli/src/cli/ui/prompts/wizard.ts, tests
frameworkStep shows vanilla/vite/bun-fullstack; new bunBuildStep asks about Bun.build; wizard accepts and propagates bunFeatures; isSuccess now excludes only null.
Init Command Integration
packages/cli/src/cli/commands/init.ts
InitUseCase calls scanner.detectBunFeatures() for bun-fullstack, includes detectedBunFeatures in collected state, and selects Bun env typing path for bun-fullstack.
Planner & Executor Wiring
packages/cli/src/features/scaffold/planner.ts, packages/cli/src/features/scaffold/executor.ts, tests
createPlan adds @arkenv/bun-plugin only when bunFeatures non-empty; plan.bootstrap includes bunFeatures for bun-fullstack; Executor bootstraps bun-fullstack with optional features and updates append gating.
Templates & Template Tests
packages/cli/src/features/scaffold/templates/*, packages/cli/src/features/scaffold/env-template.test.ts
Templates branch on vite (import.meta.env), bun-fullstack (process.env client-side), and server/runtime fallback; JSDoc and tests updated to use vanilla and bun-fullstack.
Safe Append Injection Changes
packages/cli/src/adapters/injection.ts, packages/cli/src/adapters/injection.test.ts
safeAppend framework type changed to include bun-fullstack; injection tests updated accordingly.
Test Utilities & Coverage
packages/cli/src/test/utils.ts, various test files
Add stripAnsi utility; update tests to expect vanilla defaults and cover bun-fullstack feature cases across planner, executor, workspace bootstrappers, and wizard.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • yamcodes/arkenv#998: This PR builds directly on the planner refactor introduced in PR #998, extending the same scaffolding flow to support the new bun-fullstack + bunFeatures framework wiring.
  • yamcodes/arkenv#464: Aligns with updates referencing @arkenv/bun-plugin and client-side process.env typing behavior used by Bun Fullstack templates.
  • yamcodes/arkenv#897: Related earlier work on framework/runtime detection and init scaffolding that this PR refactors into bun-fullstack/vanilla distinctions.

Suggested labels

refactor, arkenv

Poem

🐇 I hopped through code and found a splice—
Bun split in two, now each has its slice.
Serve hums the server, Build packs the site,
Vanilla waits steady, templates just right.
Hooray for features detected tonight!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 30.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: renaming/separating Bun into distinct 'Vanilla' and 'Bun Fullstack' categories.
Linked Issues check ✅ Passed The PR fully implements issue #1015's objective: separates Bun.serve (runtime) from Bun.build (bundler) into 'Vanilla' and 'Bun Fullstack' modes with automatic detection and proper CLI support.
Out of Scope Changes check ✅ Passed All changes directly support the separation objective. Minor skill workflow update is incidental infrastructure improvement and within scope.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 1015-separate-buns-development-server-and-buns-bundler-in-arkenv-cli-init

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@arkenv-bot

arkenv-bot Bot commented May 17, 2026

Copy link
Copy Markdown
Contributor

🤖 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.

@github-actions github-actions Bot added docs Adds or changes documentation, or acts as documentation in and of itself tests This issue or PR is about adding, removing or changing tests @arkenv/cli Issues or Pull Requests involving the ArkEnv CLI labels May 17, 2026
@pkg-pr-new

pkg-pr-new Bot commented May 17, 2026

Copy link
Copy Markdown

Open in StackBlitz

arkenv

npm i https://pkg.pr.new/arkenv@1016

@arkenv/bun-plugin

npm i https://pkg.pr.new/@arkenv/bun-plugin@1016

@arkenv/cli

npm i https://pkg.pr.new/@arkenv/cli@1016

@arkenv/fumadocs-ui

npm i https://pkg.pr.new/@arkenv/fumadocs-ui@1016

@arkenv/vite-plugin

npm i https://pkg.pr.new/@arkenv/vite-plugin@1016

commit: bc2ef5a

@arkenv-bot

arkenv-bot Bot commented May 17, 2026

Copy link
Copy Markdown
Contributor

📦 Bundle Size Report

No results found

All size limits passed!

@arkenv-bot

arkenv-bot Bot commented May 17, 2026

Copy link
Copy Markdown
Contributor

🤖 I'm sorry @yamcodes, but I was unable to process your request. Please see the logs for more details.

@yamcodes

This comment was marked as resolved.

@yamcodes yamcodes changed the title feat: separate Bun server and bundler in init wizard Move "Bun fullstack dev server" to be its own thing separate from "Vanilla" May 17, 2026
@yamcodes

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 17, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@yamcodes

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 17, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 win

Always run Bun bootstrap for bun-fullstack plans.

Line 128’s guard skips bootstrapBunConfig when 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 win

Clarify the relationship between Bun.serve and bundling integration.

The description of Bun.serve as 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 that Bun.serve itself performs bundling, which could be misleading.

Consider clarifying that Bun.serve is 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 how Bun.build is 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

📥 Commits

Reviewing files that changed from the base of the PR and between 59ec209 and 0cdc3d5.

📒 Files selected for processing (33)
  • .changeset/1015-separate-bun-server-and-bundler.md
  • CONTEXT.md
  • packages/cli/README.md
  • packages/cli/src/adapters/injection.test.ts
  • packages/cli/src/adapters/injection.ts
  • packages/cli/src/adapters/node-project-scanner/node-project-scanner.adapter.test.ts
  • packages/cli/src/adapters/node-project-scanner/node-project-scanner.adapter.ts
  • packages/cli/src/adapters/node-project-scanner/utils/detector.ts
  • packages/cli/src/adapters/node-workspace/node-workspace.test.ts
  • packages/cli/src/adapters/node-workspace/node-workspace.ts
  • packages/cli/src/adapters/node-workspace/utils/bootstrappers.ts
  • packages/cli/src/adapters/node-workspace/workspace.ts
  • packages/cli/src/adapters/prompt.adapter.ts
  • packages/cli/src/cli/commands/init.ts
  • packages/cli/src/cli/ui/prompts.test.ts
  • packages/cli/src/cli/ui/prompts/steps.ts
  • packages/cli/src/cli/ui/prompts/steps/framework.ts
  • packages/cli/src/cli/ui/prompts/utils.ts
  • packages/cli/src/cli/ui/prompts/wizard.ts
  • packages/cli/src/features/scaffold/env-template.test.ts
  • packages/cli/src/features/scaffold/executor.test.ts
  • packages/cli/src/features/scaffold/executor.ts
  • packages/cli/src/features/scaffold/plan.ts
  • packages/cli/src/features/scaffold/planner.test.ts
  • packages/cli/src/features/scaffold/planner.ts
  • packages/cli/src/features/scaffold/templates/arktype.ts
  • packages/cli/src/features/scaffold/templates/valibot.ts
  • packages/cli/src/features/scaffold/templates/zod.ts
  • packages/cli/src/shared/ports/project-scanner.port.ts
  • packages/cli/src/shared/ports/prompt.port.ts
  • packages/cli/src/shared/ports/workspace.port.ts
  • packages/cli/src/test/utils.ts
  • skills/tackle-issue/SKILL.md

Comment thread packages/cli/src/adapters/node-project-scanner/utils/detector.ts Outdated
Comment thread packages/cli/src/adapters/node-project-scanner/utils/detector.ts Outdated
Comment thread packages/cli/src/adapters/node-workspace/workspace.ts Outdated
Comment thread packages/cli/src/cli/ui/prompts/steps/framework.ts Outdated
Comment thread packages/cli/src/cli/ui/prompts/utils.ts Outdated
Comment thread packages/cli/src/cli/ui/prompts/wizard.ts
@yamcodes

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@yamcodes

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0cdc3d5 and bc2ef5a.

📒 Files selected for processing (10)
  • CONTEXT.md
  • packages/cli/src/adapters/node-project-scanner/utils/detector.ts
  • packages/cli/src/adapters/node-workspace/workspace.ts
  • packages/cli/src/adapters/prompt.adapter.ts
  • packages/cli/src/cli/commands/init.ts
  • packages/cli/src/cli/ui/prompts/steps/framework.ts
  • packages/cli/src/cli/ui/prompts/utils.ts
  • packages/cli/src/cli/ui/prompts/wizard.ts
  • packages/cli/src/features/scaffold/executor.test.ts
  • packages/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

Comment on lines +58 to +59
const hasBunDep = allDeps["@types/bun"] || allDeps.bun;
if (hasBunDep && (await this.hasBunFeatures())) return "bun-fullstack";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

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.

Comment on lines +36 to +37
bunFeatures:
framework === "bun-fullstack" ? defaults?.bunFeatures : undefined,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

--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.

Suggested change
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.

@yamcodes
yamcodes merged commit d536ed7 into main May 18, 2026
15 checks passed
@yamcodes
yamcodes deleted the 1015-separate-buns-development-server-and-buns-bundler-in-arkenv-cli-init branch May 18, 2026 03:53
@arkenv-bot arkenv-bot Bot mentioned this pull request May 18, 2026
yamcodes pushed a commit that referenced this pull request May 18, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

@arkenv/cli Issues or Pull Requests involving the ArkEnv CLI docs Adds or changes documentation, or acts as documentation in and of itself enhancement New feature or improvement tests This issue or PR is about adding, removing or changing tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Separate Bun's Development Server and Bun's Bundler in ArkEnv CLI Init

1 participant