Skip to content

Array coercion#693

Merged
yamcodes merged 30 commits intomainfrom
574-array-parsing
Jan 4, 2026
Merged

Array coercion#693
yamcodes merged 30 commits intomainfrom
574-array-parsing

Conversation

@yamcodes
Copy link
Owner

@yamcodes yamcodes commented Jan 3, 2026

Closes #574

Summary by CodeRabbit

  • New Features

    • Added array coercion for environment values with configurable parsing formats (comma or JSON)
    • Added an option to customize array parsing behavior during coercion
  • Chores

    • Added VS Code task configurations across projects
    • Renamed two public types for brevity: maybeParsedNumber → maybeNumber, maybeParsedBoolean → maybeBoolean
  • Tests

    • Activated and expanded array-related and integration tests covering comma/JSON parsing, defaults, coercion, and error handling

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

@yamcodes yamcodes linked an issue Jan 3, 2026 that may be closed by this pull request
@changeset-bot
Copy link

changeset-bot bot commented Jan 3, 2026

🦋 Changeset detected

Latest commit: 1acc28d

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

This PR includes changesets to release 6 packages
Name Type
@repo/keywords Minor
arkenv Patch
@repo/scope Patch
@arkenv/bun-plugin Patch
@arkenv/vite-plugin Patch
@repo/types Patch

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 Jan 3, 2026

Warning

Rate limit exceeded

@yamcodes has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 4 minutes and 21 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 028b42b and 1acc28d.

📒 Files selected for processing (2)
  • packages/arkenv/src/create-env.test.ts
  • packages/arkenv/src/custom-types.integration.test.ts

Walkthrough

Adds configurable array coercion to ArkEnv (supports "comma" and "json"), threads an arrayFormat option through coercion APIs, renames two exported keywords (maybeParsedNumbermaybeNumber, maybeParsedBooleanmaybeBoolean), adds VS Code task configs, and expands array-related tests.

Changes

Cohort / File(s) Summary
Changesets
\.changeset/silly-bats-rush.md, \.changeset/smooth-garlics-lay.md
Records rename of two keywords and documents the new array coercion option/behavior.
VSCode Tasks
apps/playgrounds/node/.vscode/tasks.json, examples/basic/.vscode/tasks.json, packages/arkenv/.vscode/tasks.json, /.vscode/tasks.json
Adds npm task definitions (start/dev/build/fix) with problem matchers and details across project locations.
Core Array Coercion
packages/arkenv/src/utils/coerce.ts
Exports CoerceOptions (arrayFormat), marks array vs primitive coercion targets, implements "comma"/"json" parsing, and updates coerce/applyCoercion signatures and traversal logic to accept options.
Configuration & API
packages/arkenv/src/create-env.ts
Adds arrayFormat?: CoerceOptions["arrayFormat"] to ArkEnvConfig and forwards it into coerce.
Tests — array parsing & coercion
packages/arkenv/src/create-env.test.ts, packages/arkenv/src/array-defaults.integration.test.ts, packages/arkenv/src/coercion.integration.test.ts, packages/arkenv/src/custom-types.integration.test.ts
Activates/extends tests for comma/json array parsing, mixed-type arrays, numeric coercion, custom-type arrays, error cases, and default handling; tightened test typings.
Keyword exports
packages/internal/keywords/src/index.ts
Renames public exports maybeParsedNumbermaybeNumber and maybeParsedBooleanmaybeBoolean without changing implementations.

Sequence Diagram

sequenceDiagram
    participant User
    participant createEnv
    participant coerce
    participant applyCoercion
    participant arrayParser

    rect `#f3f8ff`
    User->>createEnv: createEnv(schema, { arrayFormat: "comma" })
    end

    createEnv->>coerce: coerce(schema, { arrayFormat })
    coerce->>coerce: discover targets (mark type: "array" | "primitive")
    coerce->>applyCoercion: applyCoercion(envData, targets, { arrayFormat })

    loop for each target
        applyCoercion->>applyCoercion: inspect target.type
        alt target.type == "array"
            applyCoercion->>arrayParser: parse string using arrayFormat
            alt arrayFormat == "comma"
                arrayParser->>arrayParser: split on commas, trim
            else arrayFormat == "json"
                arrayParser->>arrayParser: JSON.parse (error -> fallback)
            end
            arrayParser-->>applyCoercion: parsed array
        else target.type == "primitive"
            applyCoercion->>applyCoercion: coerce numbers/booleans/strings
        end
    end

    applyCoercion-->>coerce: coerced data
    coerce-->>createEnv: schema with coercion applied
    createEnv-->>User: configured env reader
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 I nibbled commas, munched on JSON seeds,

I hopped through types and parsed the env weeds,
From maybeParsed to maybe I sprang,
Arrays now split where once strings sang,
A happy rabbit dancing over new feeds!

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings, 1 inconclusive)
Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR includes scope creep: type renames (maybeParsedNumber→maybeNumber, maybeParsedBoolean→maybeBoolean) and VS Code task configurations are unrelated to array parsing requirements. Remove type rename changes and VS Code task.json additions from this PR and move them to separate PRs focused on their respective concerns.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title 'Array coercion' is concise but vague and does not clearly convey the primary change; it lacks specificity about adding array parsing support to environment variables. Consider a more descriptive title like 'Add array coercion support with configurable parsing formats' to better communicate the main feature addition.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed The PR successfully implements array parsing in ArkEnv with configurable formats (comma and JSON) as required by issue #574, including comprehensive tests and integration examples.

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 arkenv Changes to the `arkenv` npm package. tests This issue or PR is about adding, removing or changing tests labels Jan 3, 2026
@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 3, 2026

Open in StackBlitz

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

commit: 1acc28d

@arkenv-bot
Copy link
Contributor

arkenv-bot bot commented Jan 3, 2026

📦 Bundle Size Report

Package Size Limit Diff Status
arkenv 1.5 kB 2 kB +4.9%

All size limits passed!

…dBoolean` to `maybeBoolean` and update their usages.
@arkenv-bot
Copy link
Contributor

arkenv-bot bot commented Jan 3, 2026

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

Project Deployment Review Updated (Asia/Almaty)
arkenv Ready Ready Preview, Comment Jan 5 2026, 2:24 AM (Asia/Almaty)

@github-actions github-actions bot added the example Issues or Pull Requests concerning at least one ArkEnv example. (Found in the `examples/` directory) label Jan 4, 2026
@yamcodes yamcodes changed the title 574 array parsing Array coercion Jan 4, 2026
@github-actions github-actions bot added the docs Improvements or additions to documentation label Jan 4, 2026
@yamcodes yamcodes marked this pull request as ready for review January 4, 2026 19:25
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)
.changeset/smooth-garlics-lay.md (2)

8-8: Use hyphenated compound adjective.

"Comma separated" should be hyphenated as "comma-separated" when used as a compound adjective modifying a noun.

🔎 Proposed fix
-Arrays are parsed using trimmed, comma separated values by default.
+Arrays are parsed using trimmed, comma-separated values by default.
-- `comma` (default): Strings are split by comma and trimmed.
+- `comma` (default): Strings are split by comma-separated values and trimmed.

Also applies to: 11-11


23-24: Replace hard tabs with spaces.

Lines 23-24 use hard tabs for indentation. Use spaces consistently throughout the code example for better compatibility across editors.

🔎 Proposed fix
 const env = arkenv({
-	MY_ARRAY: "string[]",
-    MY_JSON_ARRAY: "string[]"
+  MY_ARRAY: "string[]",
+  MY_JSON_ARRAY: "string[]"
 }, {
-    // optional, 'comma' is default
-    arrayFormat: 'comma'
+  // optional, 'comma' is default
+  arrayFormat: 'comma'
 });
packages/arkenv/src/array-defaults.integration.test.ts (1)

31-43: Consider enabling or removing the TODO test.

This PR introduces array coercion with arrayFormat support. The commented-out test for "arrays with defaults and environment overrides" may now be implementable. Based on the new tests in create-env.test.ts, comma-separated string parsing is now functional.

Would you like me to help enable this test or open an issue to track it?

packages/arkenv/src/create-env.test.ts (1)

475-520: Good coverage of arrayFormat configuration.

Tests verify:

  • JSON parsing with arrayFormat: "json"
  • Error handling for invalid JSON
  • Default comma separation behavior
  • Numeric arrays with JSON format

Consider adding edge case tests for completeness:

🔎 Suggested additional test cases
it("should handle empty comma-separated string", () => {
	const env = createEnv(
		{ TAGS: "string[]" },
		{ env: { TAGS: "" } },
	);
	expect(env.TAGS).toEqual([]);
});

it("should handle single-element array", () => {
	const env = createEnv(
		{ TAGS: "string[]" },
		{ env: { TAGS: "only-one" } },
	);
	expect(env.TAGS).toEqual(["only-one"]);
});

it("should handle empty JSON array", () => {
	const env = createEnv(
		{ TAGS: "string[]" },
		{
			env: { TAGS: "[]" },
			arrayFormat: "json",
		},
	);
	expect(env.TAGS).toEqual([]);
});
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1492ceb and 03b3feb.

📒 Files selected for processing (10)
  • .changeset/silly-bats-rush.md
  • .changeset/smooth-garlics-lay.md
  • apps/playgrounds/node/.vscode/tasks.json
  • examples/basic/.vscode/tasks.json
  • packages/arkenv/.vscode/tasks.json
  • packages/arkenv/src/array-defaults.integration.test.ts
  • packages/arkenv/src/create-env.test.ts
  • packages/arkenv/src/create-env.ts
  • packages/arkenv/src/utils/coerce.ts
  • packages/internal/keywords/src/index.ts
🧰 Additional context used
📓 Path-based instructions (6)
packages/arkenv/**/*.ts

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

packages/arkenv/**/*.ts: Use ArkType's type() function to define schemas in environment variable definitions
Leverage ArkType's type inference for TypeScript types instead of manual type definitions
Use the scoped $ type system for custom types defined in scope.ts
Keep environment variable schemas readable and TypeScript-like using ArkType syntax
Use union types for enums in ArkType schemas (e.g., "'dev' | 'prod'") instead of separate enum definitions
Leverage ArkType's built-in types (e.g., string.host, number.port) where possible in environment schemas
Convert ArkType validation errors to ArkEnvError for user-friendly error messages that include variable name and expected type

Files:

  • packages/arkenv/src/create-env.test.ts
  • packages/arkenv/src/array-defaults.integration.test.ts
  • packages/arkenv/src/create-env.ts
  • packages/arkenv/src/utils/coerce.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

**/*.{ts,tsx}: Use createEnv(schema) function (or default import as arkenv) to create validated environment objects in TypeScript
Use built-in validators (host, port, url, email) from ArkEnv when available instead of custom ArkType schemas
Provide default values for optional environment variables using ArkType syntax (e.g., 'boolean = false')
Use ArkEnvError for environment variable errors instead of generic Error types
For environment schema definition, use ArkType string literal syntax for enumerated values (e.g., "'deve...

Files:

  • packages/arkenv/src/create-env.test.ts
  • packages/internal/keywords/src/index.ts
  • packages/arkenv/src/array-defaults.integration.test.ts
  • packages/arkenv/src/create-env.ts
  • packages/arkenv/src/utils/coerce.ts
**/*.test.{ts,tsx}

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

Co-locate tests with components: Component.tsx next to Component.test.tsx

**/*.test.{ts,tsx}: Use Vitest for unit and integration tests
Test individual functions, components, and hooks in isolation with mocked dependencies in unit tests
Unit tests should focus on individual function logic and edge cases, component rendering and props, error handling and validation, and type checking
Unit tests should execute in less than 100ms per test
Mock external dependencies (clipboard, network, etc.) in unit tests
Co-locate unit test files with source files using naming convention: source file → test file (e.g., create-env.ts → create-env.test.ts)
Test component behavior, not aesthetics, and focus on what users can do and what the component guarantees through its API
Test component public API (props, events, and component contract), user behavior (clicks, typing, focus, keyboard, ARIA), state transitions, accessibility, and side effects in component tests
Do not test pure styling or CSS classes, library internals (Radix/shadcn), implementation details (hooks, setState, private variables), or visual variants in component tests
Use Testing Library with user-event for real user simulation in component tests
Query by role, name, label, and text (accessibility first) in component tests
Use beforeEach/afterEach for cleanup, not beforeAll/afterAll when possible
Keep tests fast, deterministic, and parallelizable
Mock at component boundaries (network, time, context)

Create unit tests with .test.ts or .test.tsx suffix located alongside source files, testing individual functions and components in isolation with mocked dependencies

Files:

  • packages/arkenv/src/create-env.test.ts
  • packages/arkenv/src/array-defaults.integration.test.ts
**/*.{test,integration.test}.{ts,tsx}

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

**/*.{test,integration.test}.{ts,tsx}: Use Vitest's describe/it structure for all test files
Test both success and failure cases in unit and integration tests
Mock process.env in unit tests to test different environment variable scenarios

Files:

  • packages/arkenv/src/create-env.test.ts
  • packages/arkenv/src/array-defaults.integration.test.ts
**/index.ts

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

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

Files:

  • packages/internal/keywords/src/index.ts
**/*.integration.test.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/test-patterns.mdc)

**/*.integration.test.{ts,tsx}: Test how multiple units (components, hooks, functions) work together without mocking their interactions in integration tests
Integration tests should focus on component and hook interactions, function composition and data flow, real dependencies between units, and state synchronization across boundaries
Integration tests should execute between 100ms - 2000ms per test
Use *.integration.test.ts suffix to distinguish integration tests from unit tests

Create integration tests with .integration.test.ts or .integration.test.tsx suffix, testing how multiple units work together without mocking their interactions (except external APIs)

Files:

  • packages/arkenv/src/array-defaults.integration.test.ts
🧠 Learnings (32)
📓 Common learnings
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Leverage ArkType's built-in types (e.g., `string.host`, `number.port`) where possible in environment schemas
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Keep environment variable schemas readable and TypeScript-like using ArkType syntax
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : For environment schema definition, use ArkType string literal syntax for enumerated values (e.g., "'development' | 'production' | 'test'")
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : Provide default values for optional environment variables using ArkType syntax (e.g., 'boolean = false')
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Use union types for enums in ArkType schemas (e.g., `"'dev' | 'prod'"`) instead of separate enum definitions
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Convert ArkType validation errors to `ArkEnvError` for user-friendly error messages that include variable name and expected type
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : Use ArkEnvError for environment variable errors instead of generic Error types
Learnt from: yamcodes
Repo: yamcodes/arkenv PR: 596
File: examples/basic/index.ts:4-5
Timestamp: 2025-12-22T19:44:11.474Z
Learning: In examples/basic/index.ts: Use explicit ArkType syntax (e.g., "string.ip | 'localhost'", "0 <= number.integer <= 65535") instead of built-in validators (string.host, number.port) to showcase ArkType's type system capabilities for educational purposes.
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.957Z
Learning: Applies to **/*.{ts,tsx} : Use `ArkEnvError` for environment variable validation errors
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Use ArkType's `type()` function to define schemas in environment variable definitions
📚 Learning: 2025-11-24T16:04:00.957Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.957Z
Learning: Applies to **/*.{ts,tsx} : Prefer `Number.parseInt` over global `parseInt` (`useNumberNamespace` error)

Applied to files:

  • .changeset/silly-bats-rush.md
  • packages/internal/keywords/src/index.ts
📚 Learning: 2025-11-24T16:04:11.901Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/monorepo.mdc:0-0
Timestamp: 2025-11-24T16:04:11.901Z
Learning: Applies to turbo.json : Turborepo tasks are defined in turbo.json with common tasks: build, dev, typecheck, test, and test:e2e

Applied to files:

  • apps/playgrounds/node/.vscode/tasks.json
  • examples/basic/.vscode/tasks.json
  • packages/arkenv/.vscode/tasks.json
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : For environment schema definition, use ArkType string literal syntax for enumerated values (e.g., "'development' | 'production' | 'test'")

Applied to files:

  • apps/playgrounds/node/.vscode/tasks.json
  • packages/arkenv/src/create-env.test.ts
  • packages/arkenv/src/array-defaults.integration.test.ts
  • packages/arkenv/src/create-env.ts
  • packages/arkenv/src/utils/coerce.ts
  • .changeset/smooth-garlics-lay.md
  • examples/basic/.vscode/tasks.json
  • packages/arkenv/.vscode/tasks.json
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Keep environment variable schemas readable and TypeScript-like using ArkType syntax

Applied to files:

  • packages/arkenv/src/create-env.test.ts
  • packages/arkenv/src/array-defaults.integration.test.ts
  • packages/arkenv/src/create-env.ts
  • packages/arkenv/src/utils/coerce.ts
  • .changeset/smooth-garlics-lay.md
  • packages/arkenv/.vscode/tasks.json
📚 Learning: 2025-12-26T19:27:11.710Z
Learnt from: danciudev
Repo: yamcodes/arkenv PR: 614
File: packages/vite-plugin/src/index.test.ts:641-654
Timestamp: 2025-12-26T19:27:11.710Z
Learning: In packages/vite-plugin/src/**/*.test.ts: The test suite uses `env.test` files (without leading dot) as test fixtures that are manually read by the `readTestConfig` helper function and stubbed into process.env with `vi.stubEnv`, not as files to be read by Vite's loadEnv during tests.

Applied to files:

  • packages/arkenv/src/create-env.test.ts
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
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/arkenv/src/create-env.test.ts
  • packages/arkenv/src/array-defaults.integration.test.ts
  • packages/arkenv/src/create-env.ts
  • packages/arkenv/src/utils/coerce.ts
  • .changeset/smooth-garlics-lay.md
  • packages/arkenv/.vscode/tasks.json
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
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/arkenv/src/create-env.test.ts
  • packages/arkenv/src/create-env.ts
  • packages/arkenv/src/utils/coerce.ts
  • .changeset/smooth-garlics-lay.md
  • packages/arkenv/.vscode/tasks.json
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
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/arkenv/src/create-env.test.ts
  • packages/arkenv/src/array-defaults.integration.test.ts
  • packages/arkenv/src/create-env.ts
  • .changeset/smooth-garlics-lay.md
  • packages/arkenv/.vscode/tasks.json
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : Use `createEnv(schema)` function (or default import as `arkenv`) to create validated environment objects in TypeScript

Applied to files:

  • packages/arkenv/src/create-env.test.ts
  • packages/arkenv/src/array-defaults.integration.test.ts
  • packages/arkenv/src/create-env.ts
📚 Learning: 2025-12-22T19:44:11.474Z
Learnt from: yamcodes
Repo: yamcodes/arkenv PR: 596
File: examples/basic/index.ts:4-5
Timestamp: 2025-12-22T19:44:11.474Z
Learning: In examples/basic/index.ts: Use explicit ArkType syntax (e.g., "string.ip | 'localhost'", "0 <= number.integer <= 65535") instead of built-in validators (string.host, number.port) to showcase ArkType's type system capabilities for educational purposes.

Applied to files:

  • packages/arkenv/src/create-env.test.ts
  • packages/arkenv/src/array-defaults.integration.test.ts
  • packages/arkenv/src/utils/coerce.ts
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : Use ArkEnvError for environment variable errors instead of generic Error types

Applied to files:

  • packages/arkenv/src/create-env.test.ts
  • packages/arkenv/src/array-defaults.integration.test.ts
  • packages/arkenv/src/create-env.ts
  • .changeset/smooth-garlics-lay.md
📚 Learning: 2025-11-24T16:04:00.957Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.957Z
Learning: Applies to **/*.{ts,tsx} : Use `ArkEnvError` for environment variable validation errors

Applied to files:

  • packages/arkenv/src/create-env.test.ts
  • packages/arkenv/src/array-defaults.integration.test.ts
  • packages/arkenv/src/create-env.ts
  • .changeset/smooth-garlics-lay.md
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{test,integration.test}.{ts,tsx} : Mock `process.env` in unit tests to test different environment variable scenarios

Applied to files:

  • packages/arkenv/src/create-env.test.ts
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : Use descriptive environment variable names that indicate purpose and format (e.g., DATABASE_URL, NODE_ENV, FEATURE_FLAG)

Applied to files:

  • packages/arkenv/src/create-env.test.ts
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{test,integration.test}.{ts,tsx} : Test both success and failure cases in unit and integration tests

Applied to files:

  • packages/arkenv/src/create-env.test.ts
  • packages/arkenv/src/array-defaults.integration.test.ts
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{test,integration.test}.{ts,tsx} : Use Vitest's `describe`/`it` structure for all test files

Applied to files:

  • packages/arkenv/src/create-env.test.ts
  • packages/arkenv/src/array-defaults.integration.test.ts
📚 Learning: 2025-12-12T13:20:01.954Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-12-12T13:20:01.954Z
Learning: Applies to **/*.integration.test.{ts,tsx} : Use *.integration.test.ts suffix to distinguish integration tests from unit tests

Applied to files:

  • packages/arkenv/src/array-defaults.integration.test.ts
📚 Learning: 2025-12-12T13:20:01.954Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-12-12T13:20:01.954Z
Learning: Applies to **/*.integration.test.{ts,tsx} : Integration tests should focus on component and hook interactions, function composition and data flow, real dependencies between units, and state synchronization across boundaries

Applied to files:

  • packages/arkenv/src/array-defaults.integration.test.ts
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.integration.test.{ts,tsx} : Create integration tests with `.integration.test.ts` or `.integration.test.tsx` suffix, testing how multiple units work together without mocking their interactions (except external APIs)

Applied to files:

  • packages/arkenv/src/array-defaults.integration.test.ts
📚 Learning: 2025-12-12T13:20:01.954Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-12-12T13:20:01.954Z
Learning: Applies to **/*.test.{ts,tsx} : Test component public API (props, events, and component contract), user behavior (clicks, typing, focus, keyboard, ARIA), state transitions, accessibility, and side effects in component tests

Applied to files:

  • packages/arkenv/src/array-defaults.integration.test.ts
📚 Learning: 2025-12-12T13:20:01.954Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-12-12T13:20:01.954Z
Learning: Applies to **/*.integration.test.{ts,tsx} : Test how multiple units (components, hooks, functions) work together without mocking their interactions in integration tests

Applied to files:

  • packages/arkenv/src/array-defaults.integration.test.ts
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : Provide default values for optional environment variables using ArkType syntax (e.g., 'boolean = false')

Applied to files:

  • packages/arkenv/src/array-defaults.integration.test.ts
  • packages/arkenv/src/create-env.ts
  • packages/arkenv/src/utils/coerce.ts
  • .changeset/smooth-garlics-lay.md
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Use ArkType's `type()` function to define schemas in environment variable definitions

Applied to files:

  • packages/arkenv/src/array-defaults.integration.test.ts
  • packages/arkenv/src/create-env.ts
  • packages/arkenv/src/utils/coerce.ts
  • .changeset/smooth-garlics-lay.md
  • packages/arkenv/.vscode/tasks.json
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Leverage ArkType's type inference for TypeScript types instead of manual type definitions

Applied to files:

  • packages/arkenv/src/create-env.ts
  • packages/arkenv/src/utils/coerce.ts
  • packages/arkenv/.vscode/tasks.json
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: ArkType validates environment variables at runtime and TypeScript types are inferred from the schema definition

Applied to files:

  • packages/arkenv/src/create-env.ts
  • packages/arkenv/src/utils/coerce.ts
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : Use built-in validators (host, port, url, email) from ArkEnv when available instead of custom ArkType schemas

Applied to files:

  • packages/arkenv/src/utils/coerce.ts
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/scope.ts : Define custom types in `scope.ts` using ArkType's scoped type system for reusability across schemas

Applied to files:

  • packages/arkenv/src/utils/coerce.ts
📚 Learning: 2025-12-12T13:20:01.954Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-12-12T13:20:01.954Z
Learning: Applies to **/*.test.{ts,tsx} : Co-locate unit test files with source files using naming convention: source file → test file (e.g., create-env.ts → create-env.test.ts)

Applied to files:

  • examples/basic/.vscode/tasks.json
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.test.{ts,tsx} : Create unit tests with `.test.ts` or `.test.tsx` suffix located alongside source files, testing individual functions and components in isolation with mocked dependencies

Applied to files:

  • examples/basic/.vscode/tasks.json
📚 Learning: 2025-11-24T16:04:11.901Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/monorepo.mdc:0-0
Timestamp: 2025-11-24T16:04:11.901Z
Learning: Applies to packages/*/package.json : Packages in packages/ directory must be published to npm and require changesets for versioning, proper exports, and type definitions

Applied to files:

  • packages/arkenv/.vscode/tasks.json
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Use the scoped `$` type system for custom types defined in `scope.ts`

Applied to files:

  • packages/arkenv/.vscode/tasks.json
🧬 Code graph analysis (4)
packages/arkenv/src/create-env.test.ts (1)
packages/arkenv/src/create-env.ts (1)
  • createEnv (75-105)
packages/internal/keywords/src/index.ts (1)
packages/arkenv/src/type.ts (1)
  • type (3-3)
packages/arkenv/src/create-env.ts (1)
packages/arkenv/src/utils/coerce.ts (2)
  • CoerceOptions (22-28)
  • coerce (277-303)
packages/arkenv/src/utils/coerce.ts (2)
packages/internal/keywords/src/index.ts (2)
  • maybeNumber (12-20)
  • maybeBoolean (31-35)
packages/arkenv/src/type.ts (1)
  • type (3-3)
🪛 LanguageTool
.changeset/smooth-garlics-lay.md

[grammar] ~8-~8: Use a hyphen to join words.
Context: .... Arrays are parsed using trimmed, comma separated values by default. You can cu...

(QB_NEW_EN_HYPHEN)

🪛 markdownlint-cli2 (0.18.1)
.changeset/smooth-garlics-lay.md

23-23: Hard tabs
Column: 1

(MD010, no-hard-tabs)

⏰ 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). (6)
  • GitHub Check: test-e2e (a11y)
  • GitHub Check: test-e2e (e2e)
  • GitHub Check: Deploy-Preview
  • GitHub Check: test-typesafety
  • GitHub Check: test-build (latest)
  • GitHub Check: test-build (lts/*)
🔇 Additional comments (18)
.changeset/silly-bats-rush.md (1)

1-7: LGTM!

The changeset clearly documents the type renames for improved brevity and clarity.

packages/arkenv/.vscode/tasks.json (1)

1-13: LGTM!

Standard VSCode task configuration for the build process.

examples/basic/.vscode/tasks.json (1)

1-19: LGTM!

The task configuration properly sets up development workflows with appropriate problem matchers for TypeScript.

apps/playgrounds/node/.vscode/tasks.json (1)

1-19: LGTM!

Task configuration follows the same pattern as other examples in the repository and is correctly set up.

packages/internal/keywords/src/index.ts (2)

31-35: Consistent rename applied.

The maybeBoolean rename follows the same pattern as maybeNumber, keeping the API surface consistent.


12-20: LGTM! Cleaner naming convention.

The rename from maybeParsedNumber to maybeNumber and maybeParsedBoolean to maybeBoolean improves API ergonomics while maintaining identical behavior. All old references have been successfully removed from the codebase.

packages/arkenv/src/array-defaults.integration.test.ts (1)

5-11: LGTM! More descriptive test name.

The updated description better reflects what the test validates (arrow function array defaults) rather than referencing an external issue.

packages/arkenv/src/create-env.ts (3)

6-6: LGTM! Clean import of the new type.

Importing CoerceOptions maintains type consistency between createEnv and the underlying coerce function.


38-48: Well-documented configuration option.

The arrayFormat option is properly documented with JSDoc, including format descriptions and the default value. The type is correctly derived from CoerceOptions["arrayFormat"] ensuring consistency.


81-81: Correct wiring of arrayFormat through the pipeline.

The option is properly destructured with a default and passed to coerce(). This ensures consistent behavior whether the option is explicitly provided or defaulted.

Also applies to: 94-94

packages/arkenv/src/create-env.test.ts (1)

152-200: Solid test coverage for standard array syntax.

The tests cover the key scenarios: string, number, boolean, and mixed-type arrays with comma-separated inputs. The whitespace trimming behavior (e.g., "3000, 8080") is also implicitly tested.

packages/arkenv/src/utils/coerce.ts (7)

1-1: Import reflects the renamed exports.

Correctly updated to use the new maybeNumber and maybeBoolean names.


14-28: Well-designed type extensions.

The CoercionTarget.type discriminator cleanly separates array vs primitive coercion logic, and CoerceOptions provides a clear extension point for future formats.


114-127: Deduplication logic correctly updated.

Including type in the unique key ensures both primitive and array targets for the same path are preserved when needed (e.g., union types).


154-169: Root-level coercion logic is correct.

The code properly handles root-level array coercion when the data is a string and the target type is "array", falling back to primitive coercion otherwise.


210-213: Good early return after array coercion.

Converting the string to an array and returning prevents further primitive coercion attempts on the already-coerced value.


277-302: Clean API extension.

The coerce function signature now accepts optional CoerceOptions and correctly threads them through to applyCoercion. The pipeline composition remains unchanged.


141-152: Handle non-array JSON values returned by splitString.

The splitString helper is called only when the target type is "array" (lines 159 and 211), yet JSON.parse() can return any valid JSON type—primitives ("123"123), objects ("{}"{}), etc. This violates the function's implicit contract to always return an array when used in array-coercion contexts. Add validation to ensure JSON.parse() returns an array, or return the original string if it doesn't:

if (arrayFormat === "json") {
	try {
		const parsed = JSON.parse(val);
		if (Array.isArray(parsed)) {
			return parsed;
		}
		return val;
	} catch {
		return val;
	}
}

Test coverage is also missing for non-array valid JSON values—only valid arrays and invalid JSON are tested.

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: 2

🧹 Nitpick comments (1)
.changeset/smooth-garlics-lay.md (1)

21-30: Consider showing both arrayFormat options in the code example.

The documentation describes both 'comma' and 'json' array formats, but the code example only demonstrates the 'comma' format. Adding a second example with arrayFormat: 'json' would better showcase the feature's flexibility, particularly with the MY_JSON_ARRAY environment variable already defined.

🔎 Suggested enhancement
 const env = arkenv({
   MY_ARRAY: "string[]",
   MY_JSON_ARRAY: "string[]"
 }, {
   // optional, 'comma' is default
   arrayFormat: 'comma'
 });

 console.log(env.MY_ARRAY); // ["one", "two", "three"]
+console.log(env.MY_JSON_ARRAY); // ["a", "b"]

Alternatively, show a second example with arrayFormat: 'json':

const env = arkenv({
  MY_ARRAY: "string[]",
  MY_JSON_ARRAY: "string[]"
}, {
  arrayFormat: 'json'
});

console.log(env.MY_JSON_ARRAY); // ["a", "b"]
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 03b3feb and fd1faf3.

📒 Files selected for processing (4)
  • .changeset/smooth-garlics-lay.md
  • .vscode/tasks.json
  • packages/arkenv/src/array-defaults.integration.test.ts
  • packages/arkenv/src/create-env.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/arkenv/src/array-defaults.integration.test.ts
  • packages/arkenv/src/create-env.test.ts
🧰 Additional context used
🧠 Learnings (11)
📓 Common learnings
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Keep environment variable schemas readable and TypeScript-like using ArkType syntax
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Leverage ArkType's built-in types (e.g., `string.host`, `number.port`) where possible in environment schemas
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Convert ArkType validation errors to `ArkEnvError` for user-friendly error messages that include variable name and expected type
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : For environment schema definition, use ArkType string literal syntax for enumerated values (e.g., "'development' | 'production' | 'test'")
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Use union types for enums in ArkType schemas (e.g., `"'dev' | 'prod'"`) instead of separate enum definitions
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : Provide default values for optional environment variables using ArkType syntax (e.g., 'boolean = false')
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : Use ArkEnvError for environment variable errors instead of generic Error types
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.957Z
Learning: Applies to **/*.{ts,tsx} : Use `ArkEnvError` for environment variable validation errors
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Use ArkType's `type()` function to define schemas in environment variable definitions
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : Use built-in validators (host, port, url, email) from ArkEnv when available instead of custom ArkType schemas
📚 Learning: 2025-11-24T16:04:11.901Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/monorepo.mdc:0-0
Timestamp: 2025-11-24T16:04:11.901Z
Learning: Applies to turbo.json : Turborepo tasks are defined in turbo.json with common tasks: build, dev, typecheck, test, and test:e2e

Applied to files:

  • .vscode/tasks.json
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Keep environment variable schemas readable and TypeScript-like using ArkType syntax

Applied to files:

  • .changeset/smooth-garlics-lay.md
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
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:

  • .changeset/smooth-garlics-lay.md
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : Provide default values for optional environment variables using ArkType syntax (e.g., 'boolean = false')

Applied to files:

  • .changeset/smooth-garlics-lay.md
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : For environment schema definition, use ArkType string literal syntax for enumerated values (e.g., "'development' | 'production' | 'test'")

Applied to files:

  • .changeset/smooth-garlics-lay.md
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
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:

  • .changeset/smooth-garlics-lay.md
📚 Learning: 2025-11-24T16:04:00.957Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.957Z
Learning: Applies to **/*.{ts,tsx} : Use `ArkEnvError` for environment variable validation errors

Applied to files:

  • .changeset/smooth-garlics-lay.md
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
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:

  • .changeset/smooth-garlics-lay.md
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : Use ArkEnvError for environment variable errors instead of generic Error types

Applied to files:

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

Applied to files:

  • .changeset/smooth-garlics-lay.md
🪛 LanguageTool
.changeset/smooth-garlics-lay.md

[grammar] ~11-~11: Ensure spelling is correct
Context: ...): Strings are split by comma-separated valuesand trimmed. - json: Strings are parsed a...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

⏰ 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). (3)
  • GitHub Check: test-e2e (a11y)
  • GitHub Check: test-e2e (e2e)
  • GitHub Check: Deploy-Preview

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 (1)
.vscode/tasks.json (1)

11-18: Consider removing or adjusting the problem matcher for Turborepo output.

The $tsc problem matcher expects raw TypeScript compiler output, but turbo run build wraps task output with its own formatting (task names, colors, prefixes). This may prevent VS Code from correctly parsing and displaying errors from the underlying builds. Consider removing the problemMatcher or using a Turborepo-compatible matcher if available.

</review_comment_end>

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fd1faf3 and a9d8153.

📒 Files selected for processing (1)
  • .vscode/tasks.json
🧰 Additional context used
🧠 Learnings (12)
📓 Common learnings
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Keep environment variable schemas readable and TypeScript-like using ArkType syntax
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Leverage ArkType's built-in types (e.g., `string.host`, `number.port`) where possible in environment schemas
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : For environment schema definition, use ArkType string literal syntax for enumerated values (e.g., "'development' | 'production' | 'test'")
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Use union types for enums in ArkType schemas (e.g., `"'dev' | 'prod'"`) instead of separate enum definitions
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Convert ArkType validation errors to `ArkEnvError` for user-friendly error messages that include variable name and expected type
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : Provide default values for optional environment variables using ArkType syntax (e.g., 'boolean = false')
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : Use ArkEnvError for environment variable errors instead of generic Error types
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.957Z
Learning: Applies to **/*.{ts,tsx} : Use `ArkEnvError` for environment variable validation errors
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : Use built-in validators (host, port, url, email) from ArkEnv when available instead of custom ArkType schemas
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Use ArkType's `type()` function to define schemas in environment variable definitions
📚 Learning: 2025-11-24T16:04:11.901Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/monorepo.mdc:0-0
Timestamp: 2025-11-24T16:04:11.901Z
Learning: Applies to turbo.json : Turborepo tasks are defined in turbo.json with common tasks: build, dev, typecheck, test, and test:e2e

Applied to files:

  • .vscode/tasks.json
📚 Learning: 2025-11-24T16:04:00.957Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.957Z
Learning: Applies to **/*.{ts,tsx} : Avoid unnecessary template literals (`noUnusedTemplateLiteral` error)

Applied to files:

  • .vscode/tasks.json
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : For environment schema definition, use ArkType string literal syntax for enumerated values (e.g., "'development' | 'production' | 'test'")

Applied to files:

  • .vscode/tasks.json
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : Use descriptive environment variable names that indicate purpose and format (e.g., DATABASE_URL, NODE_ENV, FEATURE_FLAG)

Applied to files:

  • .vscode/tasks.json
📚 Learning: 2025-11-24T16:04:00.957Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.957Z
Learning: Applies to **/*.{ts,tsx} : Provide clear, actionable error messages that include the variable name and expected type

Applied to files:

  • .vscode/tasks.json
📚 Learning: 2025-12-26T19:27:11.710Z
Learnt from: danciudev
Repo: yamcodes/arkenv PR: 614
File: packages/vite-plugin/src/index.test.ts:641-654
Timestamp: 2025-12-26T19:27:11.710Z
Learning: In packages/vite-plugin/src/**/*.test.ts: The test suite uses `env.test` files (without leading dot) as test fixtures that are manually read by the `readTestConfig` helper function and stubbed into process.env with `vi.stubEnv`, not as files to be read by Vite's loadEnv during tests.

Applied to files:

  • .vscode/tasks.json
📚 Learning: 2025-11-24T16:04:00.957Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.957Z
Learning: Applies to **/*.{ts,tsx} : Use `as const` where appropriate for immutable values (`useAsConstAssertion` error)

Applied to files:

  • .vscode/tasks.json
📚 Learning: 2025-11-24T16:04:00.957Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.957Z
Learning: Applies to **/*.{ts,tsx} : Avoid explicit types when TypeScript can infer them (`noInferrableTypes` error)

Applied to files:

  • .vscode/tasks.json
📚 Learning: 2025-11-24T16:04:47.583Z
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.583Z
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:

  • .vscode/tasks.json
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Keep environment variable schemas readable and TypeScript-like using ArkType syntax

Applied to files:

  • .vscode/tasks.json
📚 Learning: 2025-11-24T16:04:00.957Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.957Z
Learning: Applies to **/*.{ts,tsx} : Organize imports automatically (Biome handles this)

Applied to files:

  • .vscode/tasks.json
⏰ 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). (3)
  • GitHub Check: test-e2e (a11y)
  • GitHub Check: test-e2e (e2e)
  • GitHub Check: Deploy-Preview

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: 1

🧹 Nitpick comments (1)
.vscode/tasks.json (1)

10-16: LGTM!

The build task is correctly configured and appropriately grouped.

Optional: Make this the default build task

If you want this to be the default build task (invoked via Ctrl+Shift+B), you can update the group configuration:

 		{
 			"type": "npm",
 			"script": "build",
-			"group": "build",
+			"group": {
+				"kind": "build",
+				"isDefault": true
+			},
 			"label": "build",
 			"detail": "turbo run build"
 		}

This is purely a developer convenience improvement and entirely optional.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a9d8153 and 7659383.

📒 Files selected for processing (2)
  • .changeset/smooth-garlics-lay.md
  • .vscode/tasks.json
🧰 Additional context used
🧠 Learnings (18)
📓 Common learnings
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Keep environment variable schemas readable and TypeScript-like using ArkType syntax
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Leverage ArkType's built-in types (e.g., `string.host`, `number.port`) where possible in environment schemas
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : For environment schema definition, use ArkType string literal syntax for enumerated values (e.g., "'development' | 'production' | 'test'")
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Use union types for enums in ArkType schemas (e.g., `"'dev' | 'prod'"`) instead of separate enum definitions
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Convert ArkType validation errors to `ArkEnvError` for user-friendly error messages that include variable name and expected type
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : Provide default values for optional environment variables using ArkType syntax (e.g., 'boolean = false')
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : Use ArkEnvError for environment variable errors instead of generic Error types
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.957Z
Learning: Applies to **/*.{ts,tsx} : Use `ArkEnvError` for environment variable validation errors
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : Use built-in validators (host, port, url, email) from ArkEnv when available instead of custom ArkType schemas
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Use ArkType's `type()` function to define schemas in environment variable definitions
📚 Learning: 2025-11-24T16:04:11.901Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/monorepo.mdc:0-0
Timestamp: 2025-11-24T16:04:11.901Z
Learning: Applies to turbo.json : Turborepo tasks are defined in turbo.json with common tasks: build, dev, typecheck, test, and test:e2e

Applied to files:

  • .vscode/tasks.json
📚 Learning: 2025-11-24T16:04:00.957Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.957Z
Learning: Applies to **/*.{ts,tsx} : Avoid unnecessary template literals (`noUnusedTemplateLiteral` error)

Applied to files:

  • .vscode/tasks.json
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : For environment schema definition, use ArkType string literal syntax for enumerated values (e.g., "'development' | 'production' | 'test'")

Applied to files:

  • .vscode/tasks.json
  • .changeset/smooth-garlics-lay.md
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : Use descriptive environment variable names that indicate purpose and format (e.g., DATABASE_URL, NODE_ENV, FEATURE_FLAG)

Applied to files:

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

Applied to files:

  • .vscode/tasks.json
📚 Learning: 2025-12-26T19:27:11.710Z
Learnt from: danciudev
Repo: yamcodes/arkenv PR: 614
File: packages/vite-plugin/src/index.test.ts:641-654
Timestamp: 2025-12-26T19:27:11.710Z
Learning: In packages/vite-plugin/src/**/*.test.ts: The test suite uses `env.test` files (without leading dot) as test fixtures that are manually read by the `readTestConfig` helper function and stubbed into process.env with `vi.stubEnv`, not as files to be read by Vite's loadEnv during tests.

Applied to files:

  • .vscode/tasks.json
📚 Learning: 2025-11-24T16:04:00.957Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.957Z
Learning: Applies to **/*.{ts,tsx} : Use `as const` where appropriate for immutable values (`useAsConstAssertion` error)

Applied to files:

  • .vscode/tasks.json
📚 Learning: 2025-11-24T16:04:00.957Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.957Z
Learning: Applies to **/*.{ts,tsx} : Provide clear, actionable error messages that include the variable name and expected type

Applied to files:

  • .vscode/tasks.json
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Keep environment variable schemas readable and TypeScript-like using ArkType syntax

Applied to files:

  • .vscode/tasks.json
  • .changeset/smooth-garlics-lay.md
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : Use ArkEnvError for environment variable errors instead of generic Error types

Applied to files:

  • .vscode/tasks.json
  • .changeset/smooth-garlics-lay.md
📚 Learning: 2025-11-24T16:04:00.957Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.957Z
Learning: Applies to **/*.{ts,tsx} : Organize imports automatically (Biome handles this)

Applied to files:

  • .vscode/tasks.json
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
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:

  • .changeset/smooth-garlics-lay.md
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : Provide default values for optional environment variables using ArkType syntax (e.g., 'boolean = false')

Applied to files:

  • .changeset/smooth-garlics-lay.md
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
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:

  • .changeset/smooth-garlics-lay.md
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
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:

  • .changeset/smooth-garlics-lay.md
📚 Learning: 2025-11-24T16:04:00.957Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.957Z
Learning: Applies to **/*.{ts,tsx} : Use `ArkEnvError` for environment variable validation errors

Applied to files:

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

Applied to files:

  • .changeset/smooth-garlics-lay.md
🪛 markdownlint-cli2 (0.18.1)
.changeset/smooth-garlics-lay.md

23-23: Hard tabs
Column: 1

(MD010, no-hard-tabs)

⏰ 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). (3)
  • GitHub Check: test-e2e (a11y)
  • GitHub Check: test-e2e (e2e)
  • GitHub Check: Deploy-Preview
🔇 Additional comments (2)
.changeset/smooth-garlics-lay.md (1)

5-39: Feature documentation is clear and well-structured.

The changeset entry provides a helpful overview of array coercion with:

  • Clear explanation of default behavior (comma-separated, trimmed)
  • Configurable arrayFormat option with supported values documented
  • Practical code examples demonstrating both comma and json formats
  • Expected output in console.log comments
.vscode/tasks.json (1)

4-9: LGTM! Previous issue resolved.

The inappropriate $tsc problemMatcher has been successfully removed. The task definition is now clean and appropriate for running the fix script.

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: 1

🧹 Nitpick comments (1)
packages/arkenv/src/custom-types.integration.test.ts (1)

226-234: Optional: Remove redundant env: process.env parameter.

The env parameter defaults to process.env, so explicitly passing it is unnecessary.

🔎 Proposed simplification
-			const env = createEnv({ EMAILS: Email.array() }, { env: process.env });
+			const env = createEnv({ EMAILS: Email.array() });
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 78d6a7d and 028b42b.

📒 Files selected for processing (3)
  • packages/arkenv/src/coercion.integration.test.ts
  • packages/arkenv/src/create-env.test.ts
  • packages/arkenv/src/custom-types.integration.test.ts
🧰 Additional context used
📓 Path-based instructions (5)
packages/arkenv/**/*.ts

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

packages/arkenv/**/*.ts: Use ArkType's type() function to define schemas in environment variable definitions
Leverage ArkType's type inference for TypeScript types instead of manual type definitions
Use the scoped $ type system for custom types defined in scope.ts
Keep environment variable schemas readable and TypeScript-like using ArkType syntax
Use union types for enums in ArkType schemas (e.g., "'dev' | 'prod'") instead of separate enum definitions
Leverage ArkType's built-in types (e.g., string.host, number.port) where possible in environment schemas
Convert ArkType validation errors to ArkEnvError for user-friendly error messages that include variable name and expected type

Files:

  • packages/arkenv/src/custom-types.integration.test.ts
  • packages/arkenv/src/coercion.integration.test.ts
  • packages/arkenv/src/create-env.test.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

**/*.{ts,tsx}: Use createEnv(schema) function (or default import as arkenv) to create validated environment objects in TypeScript
Use built-in validators (host, port, url, email) from ArkEnv when available instead of custom ArkType schemas
Provide default values for optional environment variables using ArkType syntax (e.g., 'boolean = false')
Use ArkEnvError for environment variable errors instead of generic Error types
For environment schema definition, use ArkType string literal syntax for enumerated values (e.g., "'deve...

Files:

  • packages/arkenv/src/custom-types.integration.test.ts
  • packages/arkenv/src/coercion.integration.test.ts
  • packages/arkenv/src/create-env.test.ts
**/*.test.{ts,tsx}

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

Co-locate tests with components: Component.tsx next to Component.test.tsx

**/*.test.{ts,tsx}: Use Vitest for unit and integration tests
Test individual functions, components, and hooks in isolation with mocked dependencies in unit tests
Unit tests should focus on individual function logic and edge cases, component rendering and props, error handling and validation, and type checking
Unit tests should execute in less than 100ms per test
Mock external dependencies (clipboard, network, etc.) in unit tests
Co-locate unit test files with source files using naming convention: source file → test file (e.g., create-env.ts → create-env.test.ts)
Test component behavior, not aesthetics, and focus on what users can do and what the component guarantees through its API
Test component public API (props, events, and component contract), user behavior (clicks, typing, focus, keyboard, ARIA), state transitions, accessibility, and side effects in component tests
Do not test pure styling or CSS classes, library internals (Radix/shadcn), implementation details (hooks, setState, private variables), or visual variants in component tests
Use Testing Library with user-event for real user simulation in component tests
Query by role, name, label, and text (accessibility first) in component tests
Use beforeEach/afterEach for cleanup, not beforeAll/afterAll when possible
Keep tests fast, deterministic, and parallelizable
Mock at component boundaries (network, time, context)

Create unit tests with .test.ts or .test.tsx suffix located alongside source files, testing individual functions and components in isolation with mocked dependencies

Files:

  • packages/arkenv/src/custom-types.integration.test.ts
  • packages/arkenv/src/coercion.integration.test.ts
  • packages/arkenv/src/create-env.test.ts
**/*.integration.test.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/test-patterns.mdc)

**/*.integration.test.{ts,tsx}: Test how multiple units (components, hooks, functions) work together without mocking their interactions in integration tests
Integration tests should focus on component and hook interactions, function composition and data flow, real dependencies between units, and state synchronization across boundaries
Integration tests should execute between 100ms - 2000ms per test
Use *.integration.test.ts suffix to distinguish integration tests from unit tests

Create integration tests with .integration.test.ts or .integration.test.tsx suffix, testing how multiple units work together without mocking their interactions (except external APIs)

Files:

  • packages/arkenv/src/custom-types.integration.test.ts
  • packages/arkenv/src/coercion.integration.test.ts
**/*.{test,integration.test}.{ts,tsx}

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

**/*.{test,integration.test}.{ts,tsx}: Use Vitest's describe/it structure for all test files
Test both success and failure cases in unit and integration tests
Mock process.env in unit tests to test different environment variable scenarios

Files:

  • packages/arkenv/src/custom-types.integration.test.ts
  • packages/arkenv/src/coercion.integration.test.ts
  • packages/arkenv/src/create-env.test.ts
🧠 Learnings (22)
📓 Common learnings
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Keep environment variable schemas readable and TypeScript-like using ArkType syntax
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Leverage ArkType's built-in types (e.g., `string.host`, `number.port`) where possible in environment schemas
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : For environment schema definition, use ArkType string literal syntax for enumerated values (e.g., "'development' | 'production' | 'test'")
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Use union types for enums in ArkType schemas (e.g., `"'dev' | 'prod'"`) instead of separate enum definitions
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Convert ArkType validation errors to `ArkEnvError` for user-friendly error messages that include variable name and expected type
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : Provide default values for optional environment variables using ArkType syntax (e.g., 'boolean = false')
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : Use ArkEnvError for environment variable errors instead of generic Error types
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.957Z
Learning: Applies to **/*.{ts,tsx} : Use `ArkEnvError` for environment variable validation errors
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : Use built-in validators (host, port, url, email) from ArkEnv when available instead of custom ArkType schemas
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Use ArkType's `type()` function to define schemas in environment variable definitions
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : Use built-in validators (host, port, url, email) from ArkEnv when available instead of custom ArkType schemas

Applied to files:

  • packages/arkenv/src/custom-types.integration.test.ts
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : For environment schema definition, use ArkType string literal syntax for enumerated values (e.g., "'development' | 'production' | 'test'")

Applied to files:

  • packages/arkenv/src/custom-types.integration.test.ts
  • packages/arkenv/src/coercion.integration.test.ts
  • packages/arkenv/src/create-env.test.ts
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
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/arkenv/src/custom-types.integration.test.ts
  • packages/arkenv/src/coercion.integration.test.ts
  • packages/arkenv/src/create-env.test.ts
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Keep environment variable schemas readable and TypeScript-like using ArkType syntax

Applied to files:

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

Applied to files:

  • packages/arkenv/src/custom-types.integration.test.ts
  • packages/arkenv/src/create-env.test.ts
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
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/arkenv/src/custom-types.integration.test.ts
  • packages/arkenv/src/coercion.integration.test.ts
  • packages/arkenv/src/create-env.test.ts
📚 Learning: 2025-12-22T19:44:11.474Z
Learnt from: yamcodes
Repo: yamcodes/arkenv PR: 596
File: examples/basic/index.ts:4-5
Timestamp: 2025-12-22T19:44:11.474Z
Learning: In examples/basic/index.ts: Use explicit ArkType syntax (e.g., "string.ip | 'localhost'", "0 <= number.integer <= 65535") instead of built-in validators (string.host, number.port) to showcase ArkType's type system capabilities for educational purposes.

Applied to files:

  • packages/arkenv/src/custom-types.integration.test.ts
  • packages/arkenv/src/coercion.integration.test.ts
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
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/arkenv/src/custom-types.integration.test.ts
  • packages/arkenv/src/coercion.integration.test.ts
  • packages/arkenv/src/create-env.test.ts
📚 Learning: 2025-12-26T19:27:11.710Z
Learnt from: danciudev
Repo: yamcodes/arkenv PR: 614
File: packages/vite-plugin/src/index.test.ts:641-654
Timestamp: 2025-12-26T19:27:11.710Z
Learning: In packages/vite-plugin/src/**/*.test.ts: The test suite uses `env.test` files (without leading dot) as test fixtures that are manually read by the `readTestConfig` helper function and stubbed into process.env with `vi.stubEnv`, not as files to be read by Vite's loadEnv during tests.

Applied to files:

  • packages/arkenv/src/custom-types.integration.test.ts
  • packages/arkenv/src/coercion.integration.test.ts
  • packages/arkenv/src/create-env.test.ts
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : Use `createEnv(schema)` function (or default import as `arkenv`) to create validated environment objects in TypeScript

Applied to files:

  • packages/arkenv/src/custom-types.integration.test.ts
  • packages/arkenv/src/coercion.integration.test.ts
  • packages/arkenv/src/create-env.test.ts
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{test,integration.test}.{ts,tsx} : Mock `process.env` in unit tests to test different environment variable scenarios

Applied to files:

  • packages/arkenv/src/custom-types.integration.test.ts
  • packages/arkenv/src/coercion.integration.test.ts
  • packages/arkenv/src/create-env.test.ts
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{test,integration.test}.{ts,tsx} : Use Vitest's `describe`/`it` structure for all test files

Applied to files:

  • packages/arkenv/src/custom-types.integration.test.ts
  • packages/arkenv/src/create-env.test.ts
📚 Learning: 2025-12-12T13:20:01.954Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-12-12T13:20:01.954Z
Learning: Applies to **/*.integration.test.{ts,tsx} : Test how multiple units (components, hooks, functions) work together without mocking their interactions in integration tests

Applied to files:

  • packages/arkenv/src/custom-types.integration.test.ts
  • packages/arkenv/src/coercion.integration.test.ts
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{test,integration.test}.{ts,tsx} : Test both success and failure cases in unit and integration tests

Applied to files:

  • packages/arkenv/src/coercion.integration.test.ts
  • packages/arkenv/src/create-env.test.ts
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.integration.test.{ts,tsx} : Create integration tests with `.integration.test.ts` or `.integration.test.tsx` suffix, testing how multiple units work together without mocking their interactions (except external APIs)

Applied to files:

  • packages/arkenv/src/coercion.integration.test.ts
📚 Learning: 2025-12-12T13:20:01.954Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-12-12T13:20:01.954Z
Learning: Applies to **/*.integration.test.{ts,tsx} : Integration tests should focus on component and hook interactions, function composition and data flow, real dependencies between units, and state synchronization across boundaries

Applied to files:

  • packages/arkenv/src/coercion.integration.test.ts
📚 Learning: 2025-12-12T13:20:01.954Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-12-12T13:20:01.954Z
Learning: Applies to **/*.integration.test.{ts,tsx} : Use *.integration.test.ts suffix to distinguish integration tests from unit tests

Applied to files:

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

Applied to files:

  • packages/arkenv/src/coercion.integration.test.ts
  • packages/arkenv/src/create-env.test.ts
📚 Learning: 2025-12-12T13:20:01.954Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-12-12T13:20:01.954Z
Learning: Applies to packages/vite-plugin/src/**/*.test.ts : Test the Vite plugin using the with-vite-react example as a fixture and validate that the plugin works with real Vite projects

Applied to files:

  • packages/arkenv/src/coercion.integration.test.ts
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : Provide default values for optional environment variables using ArkType syntax (e.g., 'boolean = false')

Applied to files:

  • packages/arkenv/src/create-env.test.ts
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : Use descriptive environment variable names that indicate purpose and format (e.g., DATABASE_URL, NODE_ENV, FEATURE_FLAG)

Applied to files:

  • packages/arkenv/src/create-env.test.ts
🧬 Code graph analysis (2)
packages/arkenv/src/custom-types.integration.test.ts (2)
packages/arkenv/src/type.ts (1)
  • type (3-3)
packages/arkenv/src/create-env.ts (1)
  • createEnv (75-105)
packages/arkenv/src/create-env.test.ts (2)
packages/arkenv/src/create-env.ts (1)
  • createEnv (75-105)
packages/arkenv/src/index.ts (1)
  • createEnv (13-13)
⏰ 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). (3)
  • GitHub Check: test-e2e (e2e)
  • GitHub Check: test-e2e (a11y)
  • GitHub Check: Deploy-Preview
🔇 Additional comments (5)
packages/arkenv/src/coercion.integration.test.ts (2)

146-175: LGTM! Comprehensive integration test.

This test effectively validates the interaction between multiple features: array defaults, JSON array parsing with numeric coercion, standard number coercion, regex validation, and undeclared key stripping. The test design aligns well with integration testing best practices.


177-187: LGTM! Good error handling test.

Validates that invalid JSON array parsing produces an actionable error message, ensuring good user experience when configuration mistakes occur.

packages/arkenv/src/create-env.test.ts (3)

171-219: LGTM! Comprehensive array syntax coverage.

The test suite thoroughly covers various array types (string[], number[], boolean[], and union types) with comma-separated parsing. Good edge case coverage for mixed type arrays.


442-442: LGTM! Improved type assertions.

Replacing as any with as Record<string, string | undefined> provides better type safety while still allowing the test to include undeclared keys for validation testing.

Also applies to: 456-456, 471-471, 485-485


494-563: LGTM! Thorough array format configuration tests.

Excellent coverage of the arrayFormat option including JSON parsing, validation failures, default behavior, and edge cases (empty arrays, single elements). The tests validate both success and failure paths as required by coding guidelines.

@yamcodes yamcodes merged commit 7919b6d into main Jan 4, 2026
20 of 21 checks passed
@yamcodes yamcodes deleted the 574-array-parsing branch January 4, 2026 21:25
@arkenv-bot arkenv-bot bot mentioned this pull request Jan 4, 2026
yamcodes pushed a commit that referenced this pull request Jan 5, 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@0.8.2

### Patch Changes

- #### Array coercion
_[`#693`](#693)
[`7919b6d`](7919b6d)
[@yamcodes](https://github.com/yamcodes)_

ArkEnv now coerces arrays when the `coerce` option is enabled (true by
default).
    Arrays are parsed using trimmed, comma-separated values by default.

    You can customize this behavior with the `arrayFormat` option:

- `comma` (default): Strings are split by comma-separated values and
trimmed.
    -   `json`: Strings are parsed as JSON.

    Example:

    ```dotenv
    MY_ARRAY=one,two,three
    MY_JSON_ARRAY=["a", "b"]
    ```

    ```ts
    const env = arkenv(
      {
        MY_ARRAY: "string[]",
      },
      {
        // optional, 'comma' is default
        arrayFormat: "comma",
      }
    );

    console.log(env.MY_ARRAY); // ["one", "two", "three"]

    // Using JSON format
    const jsonEnv = arkenv(
      {
        MY_JSON_ARRAY: "string[]",
      },
      {
        arrayFormat: "json",
      }
    );

    console.log(jsonEnv.MY_JSON_ARRAY); // ["a", "b"]
    ```

## @arkenv/bun-plugin@0.0.7

### Patch Changes

<details><summary>Updated 1 dependency</summary>

<small>


[`7919b6d`](7919b6d)

</small>

-   `arkenv@0.8.2`

</details>

## @arkenv/vite-plugin@0.0.25

### Patch Changes

<details><summary>Updated 1 dependency</summary>

<small>


[`7919b6d`](7919b6d)

</small>

-   `arkenv@0.8.2`

</details>

## @repo/keywords@0.2.0

### Minor Changes

- #### Rename `maybeParsedNumber`/`maybeParsedBoolean` to
`maybeNumber`/`maybeBoolean`
_[`#693`](#693)
[`7919b6d`](7919b6d)
[@yamcodes](https://github.com/yamcodes)_

    Rename these types for brevity and clarity.

## @repo/scope@0.1.1

### Patch Changes

<details><summary>Updated 1 dependency</summary>

<small>


[`7919b6d`](7919b6d)

</small>

-   `@repo/keywords@0.2.0`

</details>

## @repo/types@0.0.5

### Patch Changes

<details><summary>Updated 1 dependency</summary>

<small>

</small>

-   `@repo/scope@0.1.1`

</details>

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@arkenv-bot arkenv-bot bot mentioned this pull request Jan 5, 2026
yamcodes pushed a commit that referenced this pull request Jan 5, 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@0.8.2

### Patch Changes

- #### Array coercion
_[`#693`](#693)
[`7919b6d`](7919b6d)
[@yamcodes](https://github.com/yamcodes)_

ArkEnv now coerces arrays when the `coerce` option is enabled (true by
default).
    Arrays are parsed using trimmed, comma-separated values by default.

    You can customize this behavior with the `arrayFormat` option:

- `comma` (default): Strings are split by comma-separated values and
trimmed.
    -   `json`: Strings are parsed as JSON.

    Example:

    ```dotenv
    MY_ARRAY=one,two,three
    MY_JSON_ARRAY=["a", "b"]
    ```

    ```ts
    const env = arkenv(
      {
        MY_ARRAY: "string[]",
      },
      {
        // optional, 'comma' is default
        arrayFormat: "comma",
      }
    );

    console.log(env.MY_ARRAY); // ["one", "two", "three"]

    // Using JSON format
    const jsonEnv = arkenv(
      {
        MY_JSON_ARRAY: "string[]",
      },
      {
        arrayFormat: "json",
      }
    );

    console.log(jsonEnv.MY_JSON_ARRAY); // ["a", "b"]
    ```

## @arkenv/bun-plugin@0.0.7

### Patch Changes

<details><summary>Updated 1 dependency</summary>

<small>


[`7919b6d`](7919b6d)

</small>

-   `arkenv@0.8.2`

</details>

## @arkenv/vite-plugin@0.0.25

### Patch Changes

<details><summary>Updated 1 dependency</summary>

<small>


[`7919b6d`](7919b6d)

</small>

-   `arkenv@0.8.2`

</details>

## @repo/keywords@0.2.0

### Minor Changes

- #### Rename `maybeParsedNumber`/`maybeParsedBoolean` to
`maybeNumber`/`maybeBoolean`
_[`#693`](#693)
[`7919b6d`](7919b6d)
[@yamcodes](https://github.com/yamcodes)_

    Rename these types for brevity and clarity.

## @repo/scope@0.1.1

### Patch Changes

<details><summary>Updated 1 dependency</summary>

<small>


[`7919b6d`](7919b6d)

</small>

-   `@repo/keywords@0.2.0`

</details>

## @repo/types@0.0.5

### Patch Changes

<details><summary>Updated 1 dependency</summary>

<small>

</small>

-   `@repo/scope@0.1.1`

</details>

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 Changes to the `arkenv` npm package. docs Improvements or additions to documentation example Issues or Pull Requests concerning at least one ArkEnv example. (Found in the `examples/` directory) 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.

Array parsing

1 participant