Skip to content

Add Bun plugin#439

Merged
yamcodes merged 51 commits intomainfrom
bun-plugin
Nov 28, 2025
Merged

Add Bun plugin#439
yamcodes merged 51 commits intomainfrom
bun-plugin

Conversation

@yamcodes
Copy link
Owner

@yamcodes yamcodes commented Nov 25, 2025

Closes #181

Summary by CodeRabbit

  • New Features

    • Adds an ArkEnv Bun plugin and playground updates: simplified build/preview, typed env config, .env.production, and an in-app env table showing BUN_PUBLIC_* values and types.
  • Documentation

    • New Bun plugin docs, spec/design/proposal/tasks, docs site page/meta, site banner, and updated install button.
  • Tests

    • Initial test suite, mocks, and test config for the Bun plugin.
  • Chores

    • New package manifest, workspace entry, README, gitignore, tooling/config files, and build scripts.

✏️ Tip: You can customize this high-level summary in your review settings.

- Integrated the Banner component to provide announcements about Vite support.
- Updated the Banner content with a link to the new documentation for better user guidance.
- Removed obsolete commented-out code, improving the clarity and maintainability of the layout file.
@vercel
Copy link

vercel bot commented Nov 25, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
arkenv Ready Ready Preview Comment Nov 28, 2025 6:08pm

@changeset-bot
Copy link

changeset-bot bot commented Nov 25, 2025

🦋 Changeset detected

Latest commit: 6cd680c

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

This PR includes changesets to release 1 package
Name Type
@arkenv/bun-plugin 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
Copy link
Contributor

coderabbitai bot commented Nov 25, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Adds a new @arkenv/bun-plugin package with implementation, types, tests, docs, workspace and playground integration to discover, validate, and inline BUN_PUBLIC_* environment variables during Bun build/serve.

Changes

Cohort / File(s) Summary
Bun plugin core & types
packages/bun-plugin/src/index.ts, packages/bun-plugin/src/types.ts
New Bun plugin implementation and types: plugin factory + default hybrid export, zero‑config/manual schema discovery (./src/env.ts or ./env.ts), build/serve-time validation, and replacement of process.env.* occurrences with JSON values for BUN_PUBLIC_*; exports ProcessEnvAugmented.
Bun plugin package config & tooling
packages/bun-plugin/package.json, packages/bun-plugin/tsconfig.json, packages/bun-plugin/tsdown.config.ts, packages/bun-plugin/turbo.json, packages/bun-plugin/.gitignore
New package manifest and supporting config for build, types, docs generation, turborepo task, and ignores.
Tests & mocks
packages/bun-plugin/src/index.test.ts, packages/bun-plugin/src/__mocks__/bun.ts, packages/bun-plugin/vitest.config.ts
Unit tests verifying plugin behavior, a Bun mock for tests, and Vitest config with aliases.
Playground build & config
apps/playgrounds/bun-react/bin/build.ts, apps/playgrounds/bun-react/package.json, apps/playgrounds/bun-react/bunfig.toml
Add Bun build script (bin/build.ts) using plugin, replace CLI build command with script, add preview script and depend on @arkenv/bun-plugin; add plugin entry in bunfig.toml.
Playground types & env module
apps/playgrounds/bun-react/bun-env.d.ts, apps/playgrounds/bun-react/src/env.ts
Add ambient Bun-typed env declarations (BUN_PUBLIC_API_URL, BUN_PUBLIC_DEBUG), switch some module declarations to export default, and add typed env.ts using arkenv.
Playground UI & app changes
apps/playgrounds/bun-react/src/App.tsx, apps/playgrounds/bun-react/src/index.tsx, apps/playgrounds/bun-react/src/index.css
Render environment variables in the app UI, remove unused req param in route handlers, and add .env-table CSS styles.
Website docs & nav
apps/www/content/docs/bun-plugin/index.mdx, apps/www/content/docs/bun-plugin/meta.json, apps/www/content/docs/meta.json
Add Bun plugin docs page, metadata, and register it in site navigation.
Website banner & install button
apps/www/components/banner.tsx, apps/www/app/layout.tsx, apps/www/components/docs/install-button.tsx
New Banner component linking to Bun plugin docs; layout uses it and install button logic extended to detect Bun plugin page and adjust label/href.
Design & spec docs
openspec/changes/add-bun-plugin/* (spec.md, design.md, proposal.md, tasks.md)
Add spec, design, proposal, and task checklist for Bun plugin implementation and integration patterns.
Workspace & release metadata
.changeset/bun-plugin.md, arkenv.code-workspace
Add changeset announcing the Bun plugin and include packages/bun-plugin in the workspace.
Repository top-level change
package.json
Add bun to pnpm onlyBuiltDependencies.
Playground env file
apps/playgrounds/bun-react/.env.production
Add production env file with BUN_PUBLIC_API_URL and BUN_PUBLIC_DEBUG.
Agent workflows & docs
.agent/workflows/*.md, .cursor/commands/openspec-proposal.md
Add workflow scaffolds and guidance for OpenSpec apply/proposal/archive steps.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer
    participant BunCLI as bun/bin/build.ts (Bun.build)
    participant Plugin as `@arkenv/bun-plugin`
    participant Schema as Schema module (./src/env.ts or ./env.ts)
    participant Bundler as Bun bundler (onLoad)
    participant Output as Dist

    Dev->>BunCLI: run build script
    BunCLI->>Plugin: initialize plugin (setup)
    alt zero-config
        Plugin->>Schema: try import conventional schema paths
        Schema-->>Plugin: schema module (default or env) or not found
    end
    Plugin->>Plugin: validate schema → build envMap (BUN_PUBLIC_*)
    Bundler->>Plugin: onLoad(file)
    Plugin->>Plugin: transform file contents (replace process.env.* with JSON values)
    Plugin-->>Bundler: transformed contents
    Bundler->>Output: write outputs
    Output-->>Dev: build completed
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Areas needing extra attention:

  • packages/bun-plugin/src/index.ts — regex substitutions, loader selection, startup schema discovery, onStart/onLoad wiring, shared envMap updates, and logging/error behavior.
  • packages/bun-plugin/src/types.ts — type-level prefix filtering and InferType usage.
  • Playground integration: apps/playgrounds/bun-react/bin/build.ts, bun-env.d.ts, bunfig.toml, and package.json scripts/dependency correctness.
  • Tests & Vitest config to ensure mocks/aliases match runtime behavior.

Possibly related PRs

Suggested labels

arkenv, example

Poem

🐰 I hopped into Bun with a careful tap,
I chased BUN_PUBLIC_* across the map,
At build I check, replace, and then I bake,
Type-safe carrots for devs to take,
Joyful bunting, a plugin-shaped snack.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 37.50% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ 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 'Add Bun plugin' is concise and directly describes the primary change in the changeset—the addition of a new Bun plugin for ArkEnv.
Linked Issues check ✅ Passed The PR implements all key requirements from issue #181: a Bun plugin for environment variable prefixing, type-safe schema validation, browser-compatible builds, and integration patterns for both Bun.build and Bun.serve.
Out of Scope Changes check ✅ Passed All changes are scoped to Bun plugin implementation, documentation, playground setup, and website updates. The Vite reference update and banner addition are minor scope creep but directly support the new Bun plugin feature promotion.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bun-plugin

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.

@github-actions github-actions bot added the docs Improvements or additions to documentation label Nov 25, 2025
- Added `@types/bun` and `typescript` as devDependencies for the Bun plugin.
- Updated package resolutions for `@types/bun` and `bun-types` to version 1.3.3, ensuring compatibility and stability in the project.
- Included a new entry for the Bun plugin `@arkenv/bun-plugin` in the workspace configuration file, enhancing the organization of project dependencies and supporting the integration of the Bun plugin into the project.
- Added the @arkenv/bun-plugin package to validate environment variables at build-time using ArkEnv.
- Configured TypeScript and build settings in package.json and tsconfig.json.
- Enhanced README.md with installation instructions, usage examples, and features.
- Updated pnpm-lock.yaml to include necessary dependencies and resolutions for the Bun plugin.
- Completed initial tasks for package setup, core implementation, type augmentation, and testing.
@github-actions github-actions bot added the tests This issue or PR is about adding, removing or changing tests label Nov 25, 2025
- Included the @arkenv/bun-plugin in the pnpm-lock.yaml and package.json for the bun-react application.
- Added vitest as a dependency in pnpm-lock.yaml to support testing.
- Updated package.json to reflect the new dependencies, ensuring proper integration and functionality.
@yamcodes yamcodes changed the title Update layout.tsx to enhance user experience Add Bun plugin Nov 25, 2025
- Moved the bun dependency entry from the importers section to the devDependencies section, ensuring proper categorization and clarity in the project's dependency management.
- Downgraded bun and related packages to version 1.1.0 in pnpm-lock.yaml for consistency.
- Enhanced bun-env.d.ts to include environment variable validation using @arkenv/bun-plugin.
- Updated bunfig.toml to include plugin configuration.
- Modified build script in package.json for improved build process.
- Refactored server code in index.tsx to validate environment variables at startup.
@github-actions github-actions bot added the @arkenv/vite-plugin Issues or Pull Requests involving the Vite plugin for ArkEnv label Nov 25, 2025
@arkenv-bot
Copy link
Contributor

arkenv-bot bot commented Nov 25, 2025

📦 Bundle Size Report

Package Size Limit Diff Status
@arkenv/bun-plugin 1.04 kB 2 kB

All size limits passed!

- Introduced two primary configuration patterns for the Bun plugin: Direct Reference for `Bun.build()` and Package Reference for `Bun.serve()`.
- Implemented schema discovery for environment variable validation and transformation during the bundling phase.
- Enhanced error handling to provide descriptive messages when schema files are not found.
- Updated documentation to reflect new usage patterns and scenarios for the plugin.
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (1)
packages/bun-plugin/src/index.ts (1)

179-228: Static plugin path still only warns on missing schema; spec says Bun.serve should fail fast.

In the hybrid.setup path, if no schema is discovered you log a warning and return (lines 212‑216), leaving the plugin effectively as a no‑op with an empty envMap. The Bun plugin spec / issue notes (“Bun.serve configuration fails when no schema file is found”) expect configuration errors to stop the app from booting, so misconfigured apps don’t silently run without validation or substitutions. This matches a previous review comment that appears unresolved.

To align behavior with the spec, consider turning this into a hard failure, e.g.:

-		if (!schema) {
-			console.warn(
-				"No env schema found in src/env.ts or env.ts. Skipping @arkenv/bun-plugin validation.",
-			);
-			return;
-		}
+		if (!schema) {
+			const message =
+				"No env schema found in src/env.ts or env.ts; @arkenv/bun-plugin requires a schema when used via bunfig.toml.";
+			// Either throw…
+			throw new Error(message);
+			// …or, if you prefer Bun/esbuild-style plugin results:
+			// return { errors: [{ text: message }] };
+		}

This way Bun.serve / Bun.build fail loudly when the schema is missing instead of silently skipping validation.

As per coding guidelines, failing fast on configuration errors avoids running with unvalidated environment state.

🧹 Nitpick comments (1)
packages/bun-plugin/src/index.ts (1)

55-69: Dynamic regex from env keys looks safe; consider documenting to silence static-analysis noise.

Static analysis flags the new RegExp(...) calls as “regex from variable input”, but keys are fully escaped via .replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), and the pattern adds only simple literals and \b, so there’s no user-controlled quantifiers or backtracking complexity. That makes ReDoS from env keys effectively a non-issue here.

If these warnings are noisy in CI, you might add a short comment noting that keys are fully escaped, or centralize the escaping into a helper for clarity.

As per coding guidelines, this keeps the implementation simple while acknowledging static-analysis concerns.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f1ba897 and cd702be.

📒 Files selected for processing (1)
  • packages/bun-plugin/src/index.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx,js,jsx}: Use createEnv(schema) function (available as default export, typically imported as arkenv) to create validated environment objects with ArkType schema definitions
Use built-in validators (host, port, url, email) from ArkEnv when available in environment schemas instead of writing custom validators
Provide default values for optional environment variables in schemas using the = value syntax
Use descriptive environment variable names that indicate purpose and format in schema definitions

Files:

  • packages/bun-plugin/src/index.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/coding-guidelines.mdc)

**/*.{ts,tsx}: Prefer type over interface for type definitions in TypeScript
Use TypeScript 5.1+ features when appropriate
Leverage const type parameters for better inference in TypeScript
Use JSDoc comments for public APIs
Use tabs for indentation (configured in Biome)
Use double quotes for strings (configured in Biome)
Organize imports automatically (Biome handles this)
Avoid explicit types when TypeScript can infer them (noInferrableTypes error)
Use as const where appropriate for immutable values (useAsConstAssertion error)
Don't reassign function parameters (noParameterAssign error)
Place default parameters last in function signatures (useDefaultParameterLast error)
Always initialize enum values (useEnumInitializers error)
Declare one variable per statement (useSingleVarDeclarator error)
Avoid unnecessary template literals (noUnusedTemplateLiteral error)
Prefer Number.parseInt over global parseInt (useNumberNamespace error)
Use kebab-case for TypeScript filenames (e.g., create-env.ts)
Use camelCase for function names (e.g., createEnv)
Use PascalCase for type names (e.g., ArkEnvError)
Use UPPER_SNAKE_CASE for environment variables and constants
Include examples in JSDoc comments when helpful for public APIs
Document complex type logic with JSDoc comments
Use ArkEnvError for environment variable validation errors
Provide clear, actionable error messages that include the variable name and expected type

Files:

  • packages/bun-plugin/src/index.ts
**/index.ts

📄 CodeRabbit inference engine (.cursor/rules/coding-guidelines.mdc)

Use barrel exports (index.ts) for package entry points

Files:

  • packages/bun-plugin/src/index.ts
🧠 Learnings (16)
📓 Common learnings
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.603Z
Learning: Applies to apps/playgrounds/bun/**/package.json : Use `bun install` instead of `npm install`, `yarn install`, or `pnpm install` for dependency management
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-11-24T16:04:36.928Z
Learning: Achieve coverage goals: environment variable parsing and validation, type checking and error handling, default value handling, custom type validation, plugin integration with Vite, and real project build testing using examples as fixtures
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.603Z
Learning: Applies to apps/playgrounds/bun/**/*.{html,ts,tsx,css} : Use `bun build <file.html|file.ts|file.css>` instead of `webpack` or `esbuild` for bundling
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.550Z
Learning: Applies to apps/playgrounds/bun-react/**/package.json : Use `bun install` instead of `npm install`, `yarn install`, or `pnpm install` in package.json scripts
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.550Z
Learning: Applies to apps/playgrounds/bun-react/**/*.{ts,tsx,js,jsx} : Bun automatically loads .env files, so don't use the dotenv package
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.603Z
Learning: Applies to apps/playgrounds/bun/**/*.{ts,tsx,js,jsx} : Bun automatically loads .env files, so don't use `dotenv` library
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.550Z
Learning: Applies to apps/playgrounds/bun-react/**/*.{ts,tsx,js,jsx,html,css} : Use `bun build <file.html|file.ts|file.css>` instead of `webpack` or `esbuild` for bundling
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.603Z
Learning: Applies to apps/playgrounds/bun/**/package.json : Use `bun run <script>` instead of `npm run <script>`, `yarn run <script>`, or `pnpm run <script>` for running scripts
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.550Z
Learning: Applies to apps/playgrounds/bun-react/**/*.test.{ts,tsx,js,jsx} : Use `bun:test` for unit and integration testing with `test` and `expect` from the built-in test module
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.603Z
Learning: Applies to apps/playgrounds/bun/**/index.ts : Run frontend development with `bun --hot ./index.ts` for hot module reloading
📚 Learning: 2025-11-24T16:03:45.283Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.283Z
Learning: Applies to packages/arkenv/**/*.ts : Keep environment variable schemas readable and TypeScript-like using ArkType syntax

Applied to files:

  • packages/bun-plugin/src/index.ts
📚 Learning: 2025-11-24T16:03:35.734Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T16:03:35.734Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `createEnv(schema)` function (available as default export, typically imported as `arkenv`) to create validated environment objects with ArkType schema definitions

Applied to files:

  • packages/bun-plugin/src/index.ts
📚 Learning: 2025-11-24T16:04:58.603Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.603Z
Learning: Applies to apps/playgrounds/bun/**/*.{ts,tsx,js,jsx} : Bun automatically loads .env files, so don't use `dotenv` library

Applied to files:

  • packages/bun-plugin/src/index.ts
📚 Learning: 2025-11-24T16:03:45.283Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.283Z
Learning: Applies to packages/arkenv/**/*.ts : Convert ArkType validation errors to `ArkEnvError` for user-friendly error messages that include variable name and expected type

Applied to files:

  • packages/bun-plugin/src/index.ts
📚 Learning: 2025-11-24T16:03:45.283Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.283Z
Learning: Applies to packages/arkenv/**/*.ts : Leverage ArkType's built-in types (e.g., `string.host`, `number.port`) where possible in environment schemas

Applied to files:

  • packages/bun-plugin/src/index.ts
📚 Learning: 2025-11-24T16:04:47.550Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.550Z
Learning: Applies to apps/playgrounds/bun-react/**/*.{ts,tsx,js,jsx} : Bun automatically loads .env files, so don't use the dotenv package

Applied to files:

  • packages/bun-plugin/src/index.ts
📚 Learning: 2025-11-24T16:04:00.943Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.943Z
Learning: Applies to **/*.{ts,tsx} : Use `ArkEnvError` for environment variable validation errors

Applied to files:

  • packages/bun-plugin/src/index.ts
📚 Learning: 2025-11-24T16:03:45.283Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.283Z
Learning: Applies to packages/arkenv/**/*.ts : Leverage ArkType's type inference for TypeScript types instead of manual type definitions

Applied to files:

  • packages/bun-plugin/src/index.ts
📚 Learning: 2025-11-24T16:03:45.283Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.283Z
Learning: Applies to packages/arkenv/**/*.ts : Use union types for enums in ArkType schemas (e.g., `"'dev' | 'prod'"`) instead of separate enum definitions

Applied to files:

  • packages/bun-plugin/src/index.ts
📚 Learning: 2025-11-24T16:03:45.283Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.283Z
Learning: Applies to packages/arkenv/**/*.ts : Use ArkType's `type()` function to define schemas in environment variable definitions

Applied to files:

  • packages/bun-plugin/src/index.ts
📚 Learning: 2025-11-24T16:03:35.734Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T16:03:35.734Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use descriptive environment variable names that indicate purpose and format in schema definitions

Applied to files:

  • packages/bun-plugin/src/index.ts
📚 Learning: 2025-11-24T16:03:35.734Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T16:03:35.734Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Provide default values for optional environment variables in schemas using the `= value` syntax

Applied to files:

  • packages/bun-plugin/src/index.ts
📚 Learning: 2025-11-24T16:04:00.943Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.943Z
Learning: Prefer tree-shakeable exports for better bundling

Applied to files:

  • packages/bun-plugin/src/index.ts
📚 Learning: 2025-11-24T16:03:35.734Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T16:03:35.734Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use built-in validators (host, port, url, email) from ArkEnv when available in environment schemas instead of writing custom validators

Applied to files:

  • packages/bun-plugin/src/index.ts
📚 Learning: 2025-11-24T16:03:45.283Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.283Z
Learning: ArkType validates environment variables at runtime and TypeScript types are inferred from the schema definition

Applied to files:

  • packages/bun-plugin/src/index.ts
🪛 ast-grep (0.40.0)
packages/bun-plugin/src/index.ts

[warning] 56-59: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(
process\\.env\\.${key.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\b,
"g",
)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html

(regexp-from-variable)


[warning] 63-66: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(
process\\.env\\[(["'])${key.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\1\\],
"g",
)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html

(regexp-from-variable)

🔇 Additional comments (2)
packages/bun-plugin/src/index.ts (2)

122-137: Manual arkenv(options) API looks good; ensure callers pass a schema, not a validated env object.

The overloads and const generic on arkenv assemble a clean BunPlugin wrapper around processEnvSchema, and this matches the documented “manual configuration” usage. Just double‑check that examples for Env in ./src/env export a schema compatible with EnvSchema<T> | type.Any (i.e., what createEnv expects), rather than the already-created env object, to avoid double validation or runtime type mismatches.

Based on learnings, this keeps createEnv(schema) as the single source of truth for env validation.


12-32: I'll help you verify this review comment. Let me start by examining the full file structure and understanding the configurability of the prefix.
<function_calls>

First, get the line count and examine the full file

wc -l packages/bun-plugin/src/index.ts


</function_calls>

Let me run this script to check the file size:
<function_calls>


#!/bin/bash
wc -l packages/bun-plugin/src/index.ts 2>/dev/null || echo "File not found or error"


</function_calls>

Now let me examine the full file to understand the complete context:
<function_calls>


#!/bin/bash

Examine the full file

cat -n packages/bun-plugin/src/index.ts


</function_calls>

Now let me check the PR description and issue references:
<function_calls>


#!/bin/bash

Check for PR and issue references in git or repo files

git log --oneline -5 2>/dev/null | head -10
git show --no-patch 2>/dev/null | head -30


</function_calls>

Let me also search for any existing issue or PR discussions mentioning prefix configuration:
<function_calls>


#!/bin/bash

Search for "prefix" mentions in the codebase

rg -n "prefix" packages/bun-plugin/ -i -C 3


</function_calls>

Let me search for issue #181 references or configurability patterns:
<function_calls>


#!/bin/bash

Search for issue references and options handling

rg -n "(#181|options|config)" packages/bun-plugin/ -C 2


</function_calls>

Let me also check if there's a README or documentation for the Bun plugin:
<function_calls>


#!/bin/bash

Look for documentation files

find packages/bun-plugin -name "README*" -o -name "*.md" | head -5


</function_calls>

Now let me check the function signatures to understand the API design:
<function_calls>


#!/bin/bash

Look at function signatures and parameter handling

ast-grep --pattern 'function $_($$$) {
$$$
}'


</function_calls>

<function_calls>


#!/bin/bash

Check how registerLoader and arkenv functions are defined

rg -n "registerLoader|arkenv" packages/bun-plugin/src/index.ts -A 5


</function_calls>

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
packages/bun-plugin/README.md (1)

14-20: Consider documenting prefix customization (if supported).

The features mention "Automatic filtering of client-exposed variables (defaults to BUN_PUBLIC_*)" which implies the prefix is customizable. The basic example doesn't show how to configure a custom prefix. If this is a supported feature, it would be helpful to document it here or in a separate "Advanced Configuration" section.

Can you confirm whether the plugin API supports customizing the prefix (e.g., arkenv({ prefix: 'MY_PREFIX_' }))? If so, consider adding a brief example showing this configuration option.

openspec/changes/add-bun-plugin/proposal.md (1)

57-57: Minor: Use markdown headings instead of emphasis for section titles.

Lines 57, 76, and 108 use bold text (**Pattern 1**, **Pattern 2**, **Future / Advanced Mode**) for section headers within the embedded design documentation. For consistency with markdown best practices (and to resolve linting warnings), consider using markdown heading syntax (###) instead.

Example:

-**Pattern 1: Bun.build (Direct Reference)**
+### Pattern 1: Bun.build (Direct Reference)

This is a style refinement; the content is otherwise sound.

Also applies to: 76-76, 108-108

packages/bun-plugin/src/index.ts (1)

12-32: Env validation and filtering logic look good; consider configurable prefix.

processEnvSchema correctly defers to createEnv for validation and then filters down to BUN_PUBLIC_* keys, returning a Map<string, string> of JSON‑encoded values, which fits the Bun frontend use case well. The only thing you might want to consider for future flexibility is making the "BUN_PUBLIC_" prefix configurable (with this default), either via an optional argument here or via plugin options, so consumers who standardize on a different public prefix can still reuse the plugin. As per coding guidelines, the use of createEnv for validation is exactly what we want.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cd702be and 84c6c1f.

📒 Files selected for processing (6)
  • openspec/changes/add-bun-plugin/proposal.md (1 hunks)
  • openspec/changes/add-bun-plugin/tasks.md (1 hunks)
  • packages/bun-plugin/README.md (1 hunks)
  • packages/bun-plugin/src/index.test.ts (1 hunks)
  • packages/bun-plugin/src/index.ts (1 hunks)
  • packages/bun-plugin/tsconfig.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/bun-plugin/src/index.test.ts
  • openspec/changes/add-bun-plugin/tasks.md
  • packages/bun-plugin/tsconfig.json
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx,js,jsx}: Use createEnv(schema) function (available as default export, typically imported as arkenv) to create validated environment objects with ArkType schema definitions
Use built-in validators (host, port, url, email) from ArkEnv when available in environment schemas instead of writing custom validators
Provide default values for optional environment variables in schemas using the = value syntax
Use descriptive environment variable names that indicate purpose and format in schema definitions

Files:

  • packages/bun-plugin/src/index.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/coding-guidelines.mdc)

**/*.{ts,tsx}: Prefer type over interface for type definitions in TypeScript
Use TypeScript 5.1+ features when appropriate
Leverage const type parameters for better inference in TypeScript
Use JSDoc comments for public APIs
Use tabs for indentation (configured in Biome)
Use double quotes for strings (configured in Biome)
Organize imports automatically (Biome handles this)
Avoid explicit types when TypeScript can infer them (noInferrableTypes error)
Use as const where appropriate for immutable values (useAsConstAssertion error)
Don't reassign function parameters (noParameterAssign error)
Place default parameters last in function signatures (useDefaultParameterLast error)
Always initialize enum values (useEnumInitializers error)
Declare one variable per statement (useSingleVarDeclarator error)
Avoid unnecessary template literals (noUnusedTemplateLiteral error)
Prefer Number.parseInt over global parseInt (useNumberNamespace error)
Use kebab-case for TypeScript filenames (e.g., create-env.ts)
Use camelCase for function names (e.g., createEnv)
Use PascalCase for type names (e.g., ArkEnvError)
Use UPPER_SNAKE_CASE for environment variables and constants
Include examples in JSDoc comments when helpful for public APIs
Document complex type logic with JSDoc comments
Use ArkEnvError for environment variable validation errors
Provide clear, actionable error messages that include the variable name and expected type

Files:

  • packages/bun-plugin/src/index.ts
**/index.ts

📄 CodeRabbit inference engine (.cursor/rules/coding-guidelines.mdc)

Use barrel exports (index.ts) for package entry points

Files:

  • packages/bun-plugin/src/index.ts
openspec/changes/*/proposal.md

📄 CodeRabbit inference engine (openspec/AGENTS.md)

Create proposal.md with sections: Why, What Changes (with BREAKING markers), and Impact

Files:

  • openspec/changes/add-bun-plugin/proposal.md
🧠 Learnings (25)
📓 Common learnings
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.603Z
Learning: Applies to apps/playgrounds/bun/**/*.{ts,tsx,js,jsx} : Bun automatically loads .env files, so don't use `dotenv` library
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.603Z
Learning: Applies to apps/playgrounds/bun/**/package.json : Use `bun install` instead of `npm install`, `yarn install`, or `pnpm install` for dependency management
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.550Z
Learning: Applies to apps/playgrounds/bun-react/**/package.json : Use `bun install` instead of `npm install`, `yarn install`, or `pnpm install` in package.json scripts
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.603Z
Learning: Applies to apps/playgrounds/bun/**/*.{html,ts,tsx,css} : Use `bun build <file.html|file.ts|file.css>` instead of `webpack` or `esbuild` for bundling
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.550Z
Learning: Applies to apps/playgrounds/bun-react/**/*.{ts,tsx,js,jsx,html,css} : Use `bun build <file.html|file.ts|file.css>` instead of `webpack` or `esbuild` for bundling
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.603Z
Learning: Applies to apps/playgrounds/bun/**/package.json : Use `bun run <script>` instead of `npm run <script>`, `yarn run <script>`, or `pnpm run <script>` for running scripts
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.550Z
Learning: Applies to apps/playgrounds/bun-react/**/*.{ts,tsx,js,jsx} : Bun automatically loads .env files, so don't use the dotenv package
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.550Z
Learning: Applies to apps/playgrounds/bun-react/**/*.test.{ts,tsx,js,jsx} : Use `bun:test` for unit and integration testing with `test` and `expect` from the built-in test module
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.603Z
Learning: Applies to apps/playgrounds/bun/**/index.ts : Run frontend development with `bun --hot ./index.ts` for hot module reloading
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.550Z
Learning: Applies to apps/playgrounds/bun-react/**/package.json : Use `bun run <script>` instead of `npm run <script>`, `yarn run <script>`, or `pnpm run <script>` in package.json scripts
📚 Learning: 2025-11-24T16:04:58.603Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.603Z
Learning: Applies to apps/playgrounds/bun/**/package.json : Use `bun install` instead of `npm install`, `yarn install`, or `pnpm install` for dependency management

Applied to files:

  • packages/bun-plugin/README.md
📚 Learning: 2025-11-24T16:04:47.550Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.550Z
Learning: Applies to apps/playgrounds/bun-react/**/package.json : Use `bun install` instead of `npm install`, `yarn install`, or `pnpm install` in package.json scripts

Applied to files:

  • packages/bun-plugin/README.md
📚 Learning: 2025-11-24T16:03:35.734Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T16:03:35.734Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `createEnv(schema)` function (available as default export, typically imported as `arkenv`) to create validated environment objects with ArkType schema definitions

Applied to files:

  • packages/bun-plugin/README.md
  • packages/bun-plugin/src/index.ts
  • openspec/changes/add-bun-plugin/proposal.md
📚 Learning: 2025-11-24T16:03:45.283Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.283Z
Learning: Applies to packages/arkenv/**/*.ts : Keep environment variable schemas readable and TypeScript-like using ArkType syntax

Applied to files:

  • packages/bun-plugin/README.md
  • packages/bun-plugin/src/index.ts
  • openspec/changes/add-bun-plugin/proposal.md
📚 Learning: 2025-11-24T16:03:35.734Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T16:03:35.734Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use descriptive environment variable names that indicate purpose and format in schema definitions

Applied to files:

  • packages/bun-plugin/README.md
  • packages/bun-plugin/src/index.ts
📚 Learning: 2025-11-24T16:04:00.943Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.943Z
Learning: Applies to **/*.{ts,tsx} : Use `ArkEnvError` for environment variable validation errors

Applied to files:

  • packages/bun-plugin/README.md
  • packages/bun-plugin/src/index.ts
  • openspec/changes/add-bun-plugin/proposal.md
📚 Learning: 2025-11-24T16:03:45.283Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.283Z
Learning: Applies to packages/arkenv/**/*.ts : Convert ArkType validation errors to `ArkEnvError` for user-friendly error messages that include variable name and expected type

Applied to files:

  • packages/bun-plugin/README.md
  • packages/bun-plugin/src/index.ts
  • openspec/changes/add-bun-plugin/proposal.md
📚 Learning: 2025-09-09T17:37:19.650Z
Learnt from: yamcodes
Repo: yamcodes/arkenv PR: 132
File: packages/arkenv/README.md:13-14
Timestamp: 2025-09-09T17:37:19.650Z
Learning: For yamcodes/arkenv project: Runtime support documentation should link to specific examples: Node.js (examples/basic), Bun (examples/with-bun), Vite (examples/with-vite-react-ts).

Applied to files:

  • packages/bun-plugin/README.md
  • openspec/changes/add-bun-plugin/proposal.md
📚 Learning: 2025-11-24T16:04:00.943Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.943Z
Learning: Applies to **/*.{ts,tsx} : Use PascalCase for type names (e.g., `ArkEnvError`)

Applied to files:

  • packages/bun-plugin/README.md
📚 Learning: 2025-11-24T16:04:47.550Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.550Z
Learning: Applies to apps/playgrounds/bun-react/**/*.{ts,tsx,js,jsx} : Bun automatically loads .env files, so don't use the dotenv package

Applied to files:

  • packages/bun-plugin/README.md
  • packages/bun-plugin/src/index.ts
📚 Learning: 2025-11-24T16:03:45.283Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.283Z
Learning: Applies to packages/arkenv/**/*.ts : Leverage ArkType's built-in types (e.g., `string.host`, `number.port`) where possible in environment schemas

Applied to files:

  • packages/bun-plugin/README.md
  • packages/bun-plugin/src/index.ts
  • openspec/changes/add-bun-plugin/proposal.md
📚 Learning: 2025-11-24T16:04:00.943Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.943Z
Learning: Applies to **/*.{ts,tsx} : Use camelCase for function names (e.g., `createEnv`)

Applied to files:

  • packages/bun-plugin/README.md
📚 Learning: 2025-11-24T16:04:58.603Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.603Z
Learning: Applies to apps/playgrounds/bun/**/*.{ts,tsx,js,jsx} : Bun automatically loads .env files, so don't use `dotenv` library

Applied to files:

  • packages/bun-plugin/README.md
  • packages/bun-plugin/src/index.ts
  • openspec/changes/add-bun-plugin/proposal.md
📚 Learning: 2025-11-24T16:03:45.283Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.283Z
Learning: Applies to packages/arkenv/**/*.ts : Use ArkType's `type()` function to define schemas in environment variable definitions

Applied to files:

  • packages/bun-plugin/README.md
  • packages/bun-plugin/src/index.ts
  • openspec/changes/add-bun-plugin/proposal.md
📚 Learning: 2025-11-24T16:04:58.603Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.603Z
Learning: Applies to apps/playgrounds/bun/**/*.{html,ts,tsx,css} : Use `bun build <file.html|file.ts|file.css>` instead of `webpack` or `esbuild` for bundling

Applied to files:

  • packages/bun-plugin/README.md
  • openspec/changes/add-bun-plugin/proposal.md
📚 Learning: 2025-11-24T16:03:35.734Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T16:03:35.734Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use built-in validators (host, port, url, email) from ArkEnv when available in environment schemas instead of writing custom validators

Applied to files:

  • packages/bun-plugin/README.md
  • packages/bun-plugin/src/index.ts
📚 Learning: 2025-11-24T16:03:45.283Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.283Z
Learning: Applies to packages/arkenv/**/*.ts : Use union types for enums in ArkType schemas (e.g., `"'dev' | 'prod'"`) instead of separate enum definitions

Applied to files:

  • packages/bun-plugin/src/index.ts
  • openspec/changes/add-bun-plugin/proposal.md
📚 Learning: 2025-11-24T16:03:35.734Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T16:03:35.734Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Provide default values for optional environment variables in schemas using the `= value` syntax

Applied to files:

  • packages/bun-plugin/src/index.ts
📚 Learning: 2025-11-24T16:04:00.943Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.943Z
Learning: Prefer tree-shakeable exports for better bundling

Applied to files:

  • packages/bun-plugin/src/index.ts
📚 Learning: 2025-11-24T16:03:45.283Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.283Z
Learning: ArkType validates environment variables at runtime and TypeScript types are inferred from the schema definition

Applied to files:

  • packages/bun-plugin/src/index.ts
📚 Learning: 2025-11-24T16:04:47.550Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.550Z
Learning: Applies to apps/playgrounds/bun-react/**/*.{ts,tsx,js,jsx,html,css} : Use `bun build <file.html|file.ts|file.css>` instead of `webpack` or `esbuild` for bundling

Applied to files:

  • openspec/changes/add-bun-plugin/proposal.md
📚 Learning: 2025-11-24T16:05:35.696Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-24T16:05:35.696Z
Learning: Applies to openspec/changes/*/proposal.md : Create proposal.md with sections: Why, What Changes (with BREAKING markers), and Impact

Applied to files:

  • openspec/changes/add-bun-plugin/proposal.md
📚 Learning: 2025-11-24T16:03:45.283Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.283Z
Learning: Applies to packages/arkenv/**/*.ts : Leverage ArkType's type inference for TypeScript types instead of manual type definitions

Applied to files:

  • openspec/changes/add-bun-plugin/proposal.md
📚 Learning: 2025-11-24T16:04:36.928Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-11-24T16:04:36.928Z
Learning: Achieve coverage goals: environment variable parsing and validation, type checking and error handling, default value handling, custom type validation, plugin integration with Vite, and real project build testing using examples as fixtures

Applied to files:

  • openspec/changes/add-bun-plugin/proposal.md
🪛 ast-grep (0.40.0)
packages/bun-plugin/src/index.ts

[warning] 56-59: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(
process\\.env\\.${key.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\b,
"g",
)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html

(regexp-from-variable)


[warning] 63-66: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(
process\\.env\\[(["'])${key.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\1\\],
"g",
)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html

(regexp-from-variable)

🪛 markdownlint-cli2 (0.18.1)
openspec/changes/add-bun-plugin/proposal.md

57-57: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


76-76: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


108-108: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: test-e2e (e2e)
🔇 Additional comments (6)
packages/bun-plugin/README.md (2)

75-89: Type augmentation example is now correct.

The import syntax now properly matches the default export pattern used in the actual implementation, and the clarifying note on line 85 explains the assumption. This resolves the previous issue where the named import example conflicted with the actual default export behavior.


59-73: Basic example looks good.

The example correctly demonstrates arkenv plugin integration with Bun.build() and shows the schema using BUN_PUBLIC_* prefixed variables, which aligns with the feature description of automatic client-exposed variable filtering.

openspec/changes/add-bun-plugin/proposal.md (1)

139-182: Proposal meets all required sections with complete, well-structured content.

The document includes all three required sections per coding guidelines:

  • Why (lines 142–152): Clearly articulates Bun's environment variable prefixing challenge and the value of build-time validation
  • What Changes (lines 154–174): Lists new additions (no BREAKING changes needed for this opt-in feature)
  • Impact (lines 176–182): Properly addresses backward compatibility, new dependency implications, and opt-in nature

The proposal correctly emphasizes this is a pure addition with no breaking changes, and the examples align with the actual API (correct imports, plugin usage patterns for both Bun.build and Bun.serve modes).

packages/bun-plugin/src/index.ts (3)

37-89: process.env replacement strategy is solid; regex safety warning is effectively a false positive.

The registerLoader hook looks robust: it skips node_modules, reads source via Bun.file, and replaces both dot and bracket access forms of process.env.KEY using an envMap of JSON‑encoded values, then picks the appropriate loader based on extension. The static analysis warning about constructing regexes from variables is mitigated here because:

  • keys are derived from a validated env schema (not arbitrary user input), and
  • each key is fully escaped with .replace(/[.*+?^${}()|[\]\\]/g, "\\$&") before being embedded in the pattern.

Given the small, schema‑controlled key set, ReDoS is not a realistic concern; this implementation is fine as‑is.


122-137: Manual arkenv(options) plugin path is well‑shaped and tree‑shakeable.

The overloads for arkenv cleanly support both EnvSchema<T> and raw type.Any schemas, and creating envMap once at plugin construction time is appropriate for the manual Bun.build usage. Returning a plain { name, setup } object that satisfies BunPlugin keeps this path simple and tree‑shakeable.


172-239: Static bunfig plugin shape, schema discovery, and fail‑fast behavior align with the spec.

Casting to a hybrid function/object and wiring setup for bunfig usage is a nice pattern: onStart discovers src/env.ts or env.ts, supports both default and env named exports, and repopulates a shared envMap that the loader closes over. Throwing a descriptive error (with checked paths and an example schema) when no schema is found satisfies the “fail fast when schema is missing” requirement and avoids silently running with an empty env map.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (4)
.agent/workflows/openspec-apply.md (1)

5-19: Use markdown headings instead of bold text for section titles.

Lines marked with MD036 violations use bold emphasis for section headers. Convert **Guardrails**, **Steps**, and **Reference** to proper markdown headings using ## to improve document structure.

-**Guardrails**
+## Guardrails
.agent/workflows/openspec-proposal.md (1)

5-24: Use markdown headings instead of bold text for section titles.

Lines with MD036 violations use bold emphasis for section headers. Convert **Guardrails**, **Steps**, and **Reference** to proper markdown headings.

-**Guardrails**
+## Guardrails
.agent/workflows/openspec-archive.md (1)

5-23: Use markdown headings instead of bold text for section titles.

Convert **Guardrails**, **Steps**, and **Reference** to proper markdown headings using ## syntax to comply with markdown standards.

openspec/changes/add-bun-plugin/proposal.md (1)

57-137: Use markdown headings for design pattern sections.

Lines 57, 76, and 108 use bold text (**Pattern 1...**, **Pattern 2...**, **Future / Advanced Mode**) before code examples. For better document structure, convert these to markdown headings (### ).

-**Pattern 1: Bun.build (Direct Reference)**
+### Pattern 1: Bun.build (Direct Reference)
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 84c6c1f and 6cd680c.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (9)
  • .agent/workflows/openspec-apply.md (1 hunks)
  • .agent/workflows/openspec-archive.md (1 hunks)
  • .agent/workflows/openspec-proposal.md (1 hunks)
  • .cursor/commands/openspec-proposal.md (1 hunks)
  • apps/playgrounds/bun-react/.env.production (1 hunks)
  • apps/playgrounds/bun-react/bin/build.ts (1 hunks)
  • apps/playgrounds/bun-react/package.json (1 hunks)
  • openspec/changes/add-bun-plugin/design.md (1 hunks)
  • openspec/changes/add-bun-plugin/proposal.md (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • openspec/changes/add-bun-plugin/design.md
  • apps/playgrounds/bun-react/bin/build.ts
🧰 Additional context used
📓 Path-based instructions (5)
**/package.json

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Use workspace:* protocol for workspace dependencies between packages

When referencing workspace packages, use the workspace:* protocol in dependencies

Files:

  • apps/playgrounds/bun-react/package.json
{**/package.json,pnpm-lock.yaml,pnpm-workspace.yaml}

📄 CodeRabbit inference engine (.cursor/rules/pnpm.mdc)

{**/package.json,pnpm-lock.yaml,pnpm-workspace.yaml}: Always use pnpm for all package management operations
Never use npm or yarn commands

Files:

  • apps/playgrounds/bun-react/package.json
{pnpm-workspace.yaml,**/package.json}

📄 CodeRabbit inference engine (.cursor/rules/pnpm.mdc)

Certain native dependencies are configured with onlyBuiltDependencies in pnpm configuration: @biomejs/biome, @sentry/cli, @swc/core, @tailwindcss/oxide, @vercel/speed-insights, esbuild, sharp

Files:

  • apps/playgrounds/bun-react/package.json
apps/playgrounds/bun-react/**/package.json

📄 CodeRabbit inference engine (apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc)

apps/playgrounds/bun-react/**/package.json: Use bun install instead of npm install, yarn install, or pnpm install in package.json scripts
Use bun run <script> instead of npm run <script>, yarn run <script>, or pnpm run <script> in package.json scripts

Files:

  • apps/playgrounds/bun-react/package.json
openspec/changes/*/proposal.md

📄 CodeRabbit inference engine (openspec/AGENTS.md)

Create proposal.md with sections: Why, What Changes (with BREAKING markers), and Impact

Files:

  • openspec/changes/add-bun-plugin/proposal.md
🧠 Learnings (59)
📓 Common learnings
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.603Z
Learning: Applies to apps/playgrounds/bun/**/*.{ts,tsx,js,jsx} : Bun automatically loads .env files, so don't use `dotenv` library
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.603Z
Learning: Applies to apps/playgrounds/bun/**/package.json : Use `bun install` instead of `npm install`, `yarn install`, or `pnpm install` for dependency management
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.550Z
Learning: Applies to apps/playgrounds/bun-react/**/*.{ts,tsx,js,jsx} : Bun automatically loads .env files, so don't use the dotenv package
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.550Z
Learning: Applies to apps/playgrounds/bun-react/**/package.json : Use `bun run <script>` instead of `npm run <script>`, `yarn run <script>`, or `pnpm run <script>` in package.json scripts
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.550Z
Learning: Applies to apps/playgrounds/bun-react/**/package.json : Use `bun install` instead of `npm install`, `yarn install`, or `pnpm install` in package.json scripts
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.603Z
Learning: Applies to apps/playgrounds/bun/**/*.{html,ts,tsx,css} : Use `bun build <file.html|file.ts|file.css>` instead of `webpack` or `esbuild` for bundling
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.550Z
Learning: Applies to apps/playgrounds/bun-react/**/*.{ts,tsx,js,jsx,html,css} : Use `bun build <file.html|file.ts|file.css>` instead of `webpack` or `esbuild` for bundling
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.603Z
Learning: Applies to apps/playgrounds/bun/**/package.json : Use `bun run <script>` instead of `npm run <script>`, `yarn run <script>`, or `pnpm run <script>` for running scripts
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.550Z
Learning: Applies to apps/playgrounds/bun-react/**/*.test.{ts,tsx,js,jsx} : Use `bun:test` for unit and integration testing with `test` and `expect` from the built-in test module
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.603Z
Learning: Applies to apps/playgrounds/bun/**/index.ts : Run frontend development with `bun --hot ./index.ts` for hot module reloading
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.603Z
Learning: Applies to apps/playgrounds/bun/**/*.{html,tsx,jsx} : Use HTML imports with `Bun.serve()` instead of Vite for frontend development
📚 Learning: 2025-11-24T16:05:17.626Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T16:05:17.626Z
Learning: Use `@/openspec/AGENTS.md` to learn how to create and apply change proposals

Applied to files:

  • .agent/workflows/openspec-archive.md
  • .cursor/commands/openspec-proposal.md
  • .agent/workflows/openspec-apply.md
  • .agent/workflows/openspec-proposal.md
📚 Learning: 2025-11-24T16:05:35.696Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-24T16:05:35.696Z
Learning: Applies to openspec/changes/*/proposal.md : Create proposal.md with sections: Why, What Changes (with BREAKING markers), and Impact

Applied to files:

  • .agent/workflows/openspec-archive.md
  • .cursor/commands/openspec-proposal.md
  • .agent/workflows/openspec-apply.md
  • .agent/workflows/openspec-proposal.md
  • openspec/changes/add-bun-plugin/proposal.md
📚 Learning: 2025-11-24T16:05:17.626Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T16:05:17.626Z
Learning: Always open `@/openspec/AGENTS.md` when the request introduces new capabilities, breaking changes, architecture shifts, or big performance/security work

Applied to files:

  • .agent/workflows/openspec-archive.md
  • .cursor/commands/openspec-proposal.md
  • .agent/workflows/openspec-apply.md
  • .agent/workflows/openspec-proposal.md
📚 Learning: 2025-11-24T16:05:35.696Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-24T16:05:35.696Z
Learning: Applies to openspec/changes/*/specs/**/spec.md : Ensure change proposals contain delta specs for each affected capability under changes/[change-id]/specs/[capability]/spec.md

Applied to files:

  • .agent/workflows/openspec-archive.md
  • .cursor/commands/openspec-proposal.md
  • .agent/workflows/openspec-apply.md
  • .agent/workflows/openspec-proposal.md
📚 Learning: 2025-11-24T16:05:35.696Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-24T16:05:35.696Z
Learning: After deployment, archive changes by moving changes/[name]/ to changes/archive/YYYY-MM-DD-[name]/ and updating specs/

Applied to files:

  • .agent/workflows/openspec-archive.md
📚 Learning: 2025-11-24T16:05:17.626Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T16:05:17.626Z
Learning: Use `@/openspec/AGENTS.md` to learn spec format and conventions

Applied to files:

  • .agent/workflows/openspec-archive.md
  • .cursor/commands/openspec-proposal.md
  • .agent/workflows/openspec-apply.md
  • .agent/workflows/openspec-proposal.md
📚 Learning: 2025-11-24T16:05:35.696Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-24T16:05:35.696Z
Learning: Applies to openspec/changes/*/specs/**/spec.md : Use ## ADDED|MODIFIED|REMOVED|RENAMED Requirements as delta headers in spec.md files under changes

Applied to files:

  • .agent/workflows/openspec-archive.md
  • .cursor/commands/openspec-proposal.md
  • .agent/workflows/openspec-apply.md
  • .agent/workflows/openspec-proposal.md
📚 Learning: 2025-11-24T16:05:35.696Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-24T16:05:35.696Z
Learning: Run openspec validate [change-id] --strict before requesting approval to ensure specs are valid

Applied to files:

  • .agent/workflows/openspec-archive.md
  • .cursor/commands/openspec-proposal.md
  • .agent/workflows/openspec-apply.md
  • .agent/workflows/openspec-proposal.md
📚 Learning: 2025-11-24T16:05:35.696Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-24T16:05:35.696Z
Learning: Use openspec spec list --long to enumerate specs, openspec list to enumerate changes, and rg for full-text search

Applied to files:

  • .agent/workflows/openspec-archive.md
📚 Learning: 2025-11-24T16:04:47.550Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.550Z
Learning: Applies to apps/playgrounds/bun-react/**/*.{ts,tsx,js,jsx} : Bun automatically loads .env files, so don't use the dotenv package

Applied to files:

  • apps/playgrounds/bun-react/.env.production
📚 Learning: 2025-11-24T16:04:58.603Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.603Z
Learning: Applies to apps/playgrounds/bun/**/*.{ts,tsx,js,jsx} : Bun automatically loads .env files, so don't use `dotenv` library

Applied to files:

  • apps/playgrounds/bun-react/.env.production
  • openspec/changes/add-bun-plugin/proposal.md
📚 Learning: 2025-11-24T16:04:47.550Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.550Z
Learning: Applies to apps/playgrounds/bun-react/**/*.{ts,tsx,js,jsx,html,css} : Use `bun build <file.html|file.ts|file.css>` instead of `webpack` or `esbuild` for bundling

Applied to files:

  • apps/playgrounds/bun-react/.env.production
  • apps/playgrounds/bun-react/package.json
  • openspec/changes/add-bun-plugin/proposal.md
📚 Learning: 2025-11-24T16:04:47.550Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.550Z
Learning: Applies to apps/playgrounds/bun-react/**/*.{ts,tsx,js,jsx} : Use `Bun.redis` for Redis operations instead of `ioredis`

Applied to files:

  • apps/playgrounds/bun-react/.env.production
📚 Learning: 2025-11-24T16:04:47.550Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.550Z
Learning: Applies to apps/playgrounds/bun-react/**/*.ts : Use `bun --hot` to run TypeScript entry files with hot module reloading enabled

Applied to files:

  • apps/playgrounds/bun-react/.env.production
  • apps/playgrounds/bun-react/package.json
📚 Learning: 2025-11-24T16:04:47.550Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.550Z
Learning: Applies to apps/playgrounds/bun-react/**/*.html : Use HTML imports with `Bun.serve()` and don't use Vite for frontend bundling and development

Applied to files:

  • apps/playgrounds/bun-react/.env.production
  • openspec/changes/add-bun-plugin/proposal.md
📚 Learning: 2025-11-24T16:04:58.603Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.603Z
Learning: Applies to apps/playgrounds/bun/**/*.{html,ts,tsx,css} : Use `bun build <file.html|file.ts|file.css>` instead of `webpack` or `esbuild` for bundling

Applied to files:

  • apps/playgrounds/bun-react/.env.production
  • apps/playgrounds/bun-react/package.json
  • openspec/changes/add-bun-plugin/proposal.md
📚 Learning: 2025-11-24T16:04:47.550Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.550Z
Learning: Applies to apps/playgrounds/bun-react/**/*.{ts,tsx,js,jsx} : Use `bun <file>` instead of `node <file>` or `ts-node <file>` for running TypeScript and JavaScript files

Applied to files:

  • apps/playgrounds/bun-react/.env.production
  • apps/playgrounds/bun-react/package.json
📚 Learning: 2025-11-24T16:04:47.550Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.550Z
Learning: Applies to apps/playgrounds/bun-react/**/package.json : Use `bun run <script>` instead of `npm run <script>`, `yarn run <script>`, or `pnpm run <script>` in package.json scripts

Applied to files:

  • apps/playgrounds/bun-react/.env.production
  • apps/playgrounds/bun-react/package.json
📚 Learning: 2025-11-24T16:04:47.550Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.550Z
Learning: Applies to apps/playgrounds/bun-react/**/*.{ts,tsx,js,jsx} : Use `Bun.$` template literal syntax for shell commands instead of `execa`

Applied to files:

  • apps/playgrounds/bun-react/.env.production
  • apps/playgrounds/bun-react/package.json
📚 Learning: 2025-11-24T16:04:58.603Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.603Z
Learning: Applies to apps/playgrounds/bun/**/index.ts : Run frontend development with `bun --hot ./index.ts` for hot module reloading

Applied to files:

  • apps/playgrounds/bun-react/.env.production
  • apps/playgrounds/bun-react/package.json
📚 Learning: 2025-11-24T16:04:58.603Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.603Z
Learning: Applies to apps/playgrounds/bun/**/*.{ts,tsx,js,jsx} : Use `Bun.serve()` with built-in WebSocket, HTTPS, and route support instead of `express`

Applied to files:

  • apps/playgrounds/bun-react/.env.production
📚 Learning: 2025-11-24T16:04:58.603Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.603Z
Learning: Applies to apps/playgrounds/bun/**/*.{ts,tsx,js,jsx} : Use `Bun.redis` for Redis operations instead of `ioredis`

Applied to files:

  • apps/playgrounds/bun-react/.env.production
📚 Learning: 2025-11-24T16:04:58.603Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.603Z
Learning: Applies to apps/playgrounds/bun/**/*.{ts,js} : Use `bun <file>` instead of `node <file>` or `ts-node <file>` for running scripts

Applied to files:

  • apps/playgrounds/bun-react/.env.production
  • apps/playgrounds/bun-react/package.json
📚 Learning: 2025-11-24T16:04:47.550Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.550Z
Learning: Applies to apps/playgrounds/bun-react/**/*.{ts,tsx,js,jsx} : Use `Bun.serve()` with built-in WebSocket, HTTPS, and route support instead of `express`

Applied to files:

  • apps/playgrounds/bun-react/.env.production
📚 Learning: 2025-11-24T16:05:35.696Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-24T16:05:35.696Z
Learning: Create design.md only when needed: for cross-cutting changes, new dependencies, significant data model changes, security/performance complexity, or ambiguity

Applied to files:

  • .cursor/commands/openspec-proposal.md
  • .agent/workflows/openspec-apply.md
  • .agent/workflows/openspec-proposal.md
📚 Learning: 2025-11-24T16:05:17.626Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T16:05:17.626Z
Learning: Always open `@/openspec/AGENTS.md` when the request mentions planning or proposals (words like proposal, spec, change, plan)

Applied to files:

  • .cursor/commands/openspec-proposal.md
  • .agent/workflows/openspec-apply.md
  • .agent/workflows/openspec-proposal.md
📚 Learning: 2025-11-24T16:05:35.696Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-24T16:05:35.696Z
Learning: Applies to openspec/**/spec.md : Use SHALL/MUST for normative requirements rather than should/may unless intentionally non-normative

Applied to files:

  • .cursor/commands/openspec-proposal.md
📚 Learning: 2025-11-24T16:05:35.696Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-24T16:05:35.696Z
Learning: For bug fixes, typos, formatting, comments, non-breaking dependency updates, and configuration changes, fix directly without creating a proposal

Applied to files:

  • .cursor/commands/openspec-proposal.md
📚 Learning: 2025-11-24T16:05:17.626Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T16:05:17.626Z
Learning: Use `@/openspec/AGENTS.md` to learn project structure and guidelines

Applied to files:

  • .cursor/commands/openspec-proposal.md
  • .agent/workflows/openspec-apply.md
  • .agent/workflows/openspec-proposal.md
📚 Learning: 2025-11-24T16:05:17.626Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T16:05:17.626Z
Learning: Always open `@/openspec/AGENTS.md` when the request sounds ambiguous and you need the authoritative spec before coding

Applied to files:

  • .cursor/commands/openspec-proposal.md
  • .agent/workflows/openspec-apply.md
📚 Learning: 2025-11-24T16:05:35.696Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-24T16:05:35.696Z
Learning: Organize specifications in openspec/specs/[capability]/spec.md with optional design.md for technical patterns

Applied to files:

  • .cursor/commands/openspec-proposal.md
  • .agent/workflows/openspec-proposal.md
📚 Learning: 2025-11-24T16:04:58.603Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.603Z
Learning: Applies to apps/playgrounds/bun/**/package.json : Use `bun run <script>` instead of `npm run <script>`, `yarn run <script>`, or `pnpm run <script>` for running scripts

Applied to files:

  • apps/playgrounds/bun-react/package.json
📚 Learning: 2025-11-24T16:04:47.550Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.550Z
Learning: Applies to apps/playgrounds/bun-react/**/package.json : Use `bun install` instead of `npm install`, `yarn install`, or `pnpm install` in package.json scripts

Applied to files:

  • apps/playgrounds/bun-react/package.json
📚 Learning: 2025-11-24T16:04:58.603Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.603Z
Learning: Applies to apps/playgrounds/bun/**/package.json : Use `bun install` instead of `npm install`, `yarn install`, or `pnpm install` for dependency management

Applied to files:

  • apps/playgrounds/bun-react/package.json
📚 Learning: 2025-11-24T16:04:47.550Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.550Z
Learning: Applies to apps/playgrounds/bun-react/**/*.html : HTML files can import `.tsx`, `.jsx`, or `.js` files directly as modules, and Bun will automatically transpile and bundle them

Applied to files:

  • apps/playgrounds/bun-react/package.json
📚 Learning: 2025-11-24T16:04:11.869Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/monorepo.mdc:0-0
Timestamp: 2025-11-24T16:04:11.869Z
Learning: Applies to **/package.json : Use workspace:* protocol for workspace dependencies between packages

Applied to files:

  • apps/playgrounds/bun-react/package.json
📚 Learning: 2025-11-24T16:04:19.392Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:19.392Z
Learning: Applies to **/package.json : When referencing workspace packages, use the `workspace:*` protocol in dependencies

Applied to files:

  • apps/playgrounds/bun-react/package.json
📚 Learning: 2025-11-24T16:04:47.550Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.550Z
Learning: Applies to apps/playgrounds/bun-react/**/*.{ts,tsx,js,jsx} : Use built-in `WebSocket` instead of the `ws` package

Applied to files:

  • apps/playgrounds/bun-react/package.json
📚 Learning: 2025-11-24T16:04:47.550Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.550Z
Learning: Applies to apps/playgrounds/bun-react/**/*.{ts,tsx,js,jsx} : Prefer `Bun.file` over `node:fs` readFile/writeFile methods for file operations

Applied to files:

  • apps/playgrounds/bun-react/package.json
📚 Learning: 2025-11-24T16:03:35.734Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T16:03:35.734Z
Learning: Use pnpm workspaces for package management across the monorepo instead of npm or yarn

Applied to files:

  • apps/playgrounds/bun-react/package.json
📚 Learning: 2025-11-24T16:04:19.392Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:19.392Z
Learning: Applies to package.json : The project uses `pnpm10.20.0` (specified in `packageManager` field)

Applied to files:

  • apps/playgrounds/bun-react/package.json
📚 Learning: 2025-11-24T16:04:19.392Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:19.392Z
Learning: Applies to {**/package.json,pnpm-lock.yaml,pnpm-workspace.yaml} : Always use `pnpm` for all package management operations

Applied to files:

  • apps/playgrounds/bun-react/package.json
📚 Learning: 2025-11-24T16:04:19.392Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:19.392Z
Learning: Applies to {**/package.json,pnpm-lock.yaml,pnpm-workspace.yaml} : Never use `npm` or `yarn` commands

Applied to files:

  • apps/playgrounds/bun-react/package.json
📚 Learning: 2025-11-24T16:04:11.869Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/monorepo.mdc:0-0
Timestamp: 2025-11-24T16:04:11.869Z
Learning: Only packages in packages/ directory are published to npm; publishing is handled by changesets using pnpm release

Applied to files:

  • apps/playgrounds/bun-react/package.json
📚 Learning: 2025-11-24T16:04:19.392Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:19.392Z
Learning: Applies to {pnpm-workspace.yaml,**/package.json} : Certain native dependencies are configured with `onlyBuiltDependencies` in pnpm configuration: biomejs/biome, sentry/cli, swc/core, tailwindcss/oxide, vercel/speed-insights, esbuild, sharp

Applied to files:

  • apps/playgrounds/bun-react/package.json
📚 Learning: 2025-11-24T16:04:47.550Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.550Z
Learning: Applies to apps/playgrounds/bun-react/**/*.test.{ts,tsx,js,jsx} : Use `bun:test` for unit and integration testing with `test` and `expect` from the built-in test module

Applied to files:

  • apps/playgrounds/bun-react/package.json
📚 Learning: 2025-11-24T16:05:35.696Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-24T16:05:35.696Z
Learning: Applies to openspec/changes/*/tasks.md : Create tasks.md with numbered implementation checklist items as checkboxes (- [ ] format)

Applied to files:

  • .agent/workflows/openspec-apply.md
  • .agent/workflows/openspec-proposal.md
📚 Learning: 2025-11-24T16:04:58.603Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.603Z
Learning: Applies to apps/playgrounds/bun/**/*.{html,tsx,jsx} : Use HTML imports with `Bun.serve()` instead of Vite for frontend development

Applied to files:

  • openspec/changes/add-bun-plugin/proposal.md
📚 Learning: 2025-09-09T17:37:19.650Z
Learnt from: yamcodes
Repo: yamcodes/arkenv PR: 132
File: packages/arkenv/README.md:13-14
Timestamp: 2025-09-09T17:37:19.650Z
Learning: For yamcodes/arkenv project: Runtime support documentation should link to specific examples: Node.js (examples/basic), Bun (examples/with-bun), Vite (examples/with-vite-react-ts).

Applied to files:

  • openspec/changes/add-bun-plugin/proposal.md
📚 Learning: 2025-11-24T16:03:35.734Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T16:03:35.734Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `createEnv(schema)` function (available as default export, typically imported as `arkenv`) to create validated environment objects with ArkType schema definitions

Applied to files:

  • openspec/changes/add-bun-plugin/proposal.md
📚 Learning: 2025-11-24T16:03:45.283Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.283Z
Learning: Applies to packages/arkenv/**/*.ts : Leverage ArkType's built-in types (e.g., `string.host`, `number.port`) where possible in environment schemas

Applied to files:

  • openspec/changes/add-bun-plugin/proposal.md
📚 Learning: 2025-11-24T16:03:45.283Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.283Z
Learning: Applies to packages/arkenv/**/*.ts : Use ArkType's `type()` function to define schemas in environment variable definitions

Applied to files:

  • openspec/changes/add-bun-plugin/proposal.md
📚 Learning: 2025-11-24T16:03:45.283Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.283Z
Learning: Applies to packages/arkenv/**/*.ts : Keep environment variable schemas readable and TypeScript-like using ArkType syntax

Applied to files:

  • openspec/changes/add-bun-plugin/proposal.md
📚 Learning: 2025-11-24T16:03:45.283Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.283Z
Learning: Applies to packages/arkenv/**/*.ts : Convert ArkType validation errors to `ArkEnvError` for user-friendly error messages that include variable name and expected type

Applied to files:

  • openspec/changes/add-bun-plugin/proposal.md
📚 Learning: 2025-11-24T16:04:00.943Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.943Z
Learning: Applies to **/*.{ts,tsx} : Use `ArkEnvError` for environment variable validation errors

Applied to files:

  • openspec/changes/add-bun-plugin/proposal.md
📚 Learning: 2025-11-24T16:03:45.283Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.283Z
Learning: Applies to packages/arkenv/**/*.ts : Use union types for enums in ArkType schemas (e.g., `"'dev' | 'prod'"`) instead of separate enum definitions

Applied to files:

  • openspec/changes/add-bun-plugin/proposal.md
📚 Learning: 2025-11-24T16:03:45.283Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.283Z
Learning: Applies to packages/arkenv/**/*.ts : Leverage ArkType's type inference for TypeScript types instead of manual type definitions

Applied to files:

  • openspec/changes/add-bun-plugin/proposal.md
📚 Learning: 2025-11-24T16:04:36.928Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-11-24T16:04:36.928Z
Learning: Achieve coverage goals: environment variable parsing and validation, type checking and error handling, default value handling, custom type validation, plugin integration with Vite, and real project build testing using examples as fixtures

Applied to files:

  • openspec/changes/add-bun-plugin/proposal.md
🧬 Code graph analysis (2)
apps/playgrounds/bun-react/.env.production (1)
packages/arkenv/src/create-env.ts (1)
  • createEnv (34-52)
apps/playgrounds/bun-react/package.json (2)
apps/playgrounds/bun-react/src/App.tsx (1)
  • App (7-22)
apps/playgrounds/bun-react/src/index.tsx (1)
  • PUT (16-21)
🪛 markdownlint-cli2 (0.18.1)
.agent/workflows/openspec-archive.md

5-5: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


10-10: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


21-21: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)

.agent/workflows/openspec-apply.md

5-5: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


10-10: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)

.agent/workflows/openspec-proposal.md

5-5: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


12-12: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


21-21: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)

openspec/changes/add-bun-plugin/proposal.md

57-57: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


76-76: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


108-108: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: test-e2e (e2e)
  • GitHub Check: test-e2e (a11y)
🔇 Additional comments (4)
apps/playgrounds/bun-react/.env.production (1)

1-2: Environment configuration is correct and follows Bun conventions.

The file properly declares BUN_PUBLIC_* prefixed variables that align with the type definitions (BUN_PUBLIC_API_URL as string, BUN_PUBLIC_DEBUG as boolean) and Bun's frontend environment variable model. The example values are appropriate for the playground.

apps/playgrounds/bun-react/package.json (2)

8-9: Build and preview scripts correctly use Bun.

The updated build script properly executes the TypeScript build file via bun, and the new preview script follows Bun conventions for serving the built output.


14-16: Workspace dependencies correctly configured.

Dependencies use the workspace:* protocol (consistent with pnpm monorepo management) and catalog: for coordinated versioning, aligning with both coding guidelines and the PR's Bun plugin integration.

openspec/changes/add-bun-plugin/proposal.md (1)

1-182: Proposal structure and content meet all guidelines.

The proposal correctly includes:

  • Why: Clear problem statement (Bun process.env limitations, build-time validation needs)
  • What Changes: Five concrete additions with no breaking changes marked (correct for new feature)
  • Impact: Addresses existing users, backward compatibility, and new dependencies
  • Spec: Follows ADDED Requirements + Scenario pattern with two primary configuration modes and error behavior
  • Design: Documents rationale, implementation patterns with code examples, and future considerations
  • Past issues resolved: API consistency, package naming, and Impact section all addressed in prior commits

The dual configuration approach (Direct Reference for Bun.build + Package Reference with convention for Bun.serve) balances ease-of-use with flexibility, consistent with the PR objectives for issue #181.

@yamcodes yamcodes merged commit 61a7c52 into main Nov 28, 2025
16 of 18 checks passed
@yamcodes yamcodes deleted the bun-plugin branch November 28, 2025 18:27
@arkenv-bot arkenv-bot bot mentioned this pull request Nov 28, 2025
yamcodes pushed a commit that referenced this pull request Nov 28, 2025
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/bun-plugin@0.0.1

### Patch Changes

- Add Bun plugin for build-time environment variable validation and
type-safe access, similar to the Vite plugin.
_[`#439`](#439)
[`61a7c52`](61a7c52)
[@yamcodes](https://github.com/yamcodes)_

    Check out the docs: <https://arkenv.js.org/docs/bun-plugin>

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@coderabbitai coderabbitai bot mentioned this pull request Dec 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

@arkenv/bun-plugin Issues or Pull Requests involving the Bun plugin for ArkEnv docs Improvements or additions to documentation tests This issue or PR is about adding, removing or changing tests www Improvements or additions to arkenv.js.org

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Bun frontend process.env prefixing (e.g. BUN_PUBLIC_*)

1 participant