Skip to content

Make ArkType optional (Built-in Standard Schema) through explicit validator mode#723

Merged
yamcodes merged 68 commits intomainfrom
722-make-arktype-optional-and-use-standard-schema-directly
Jan 16, 2026
Merged

Make ArkType optional (Built-in Standard Schema) through explicit validator mode#723
yamcodes merged 68 commits intomainfrom
722-make-arktype-optional-and-use-standard-schema-directly

Conversation

@yamcodes
Copy link
Owner

@yamcodes yamcodes commented Jan 14, 2026

Summary by CodeRabbit

  • New Features

    • Added explicit validator mode option: choose between "arktype" (default with coercion) or "standard" (using Zod, Valibot, etc. without ArkType).
    • ArkType is now an optional peer dependency.
  • Bug Fixes

    • Improved error handling for Standard Schema validators.
  • Documentation

    • Added validator mode guide and configuration options.
    • Updated import paths for type helper.
  • Breaking Changes

    • Type helper moved from arkenv to arkenv/arktype.
    • createEnv now accepts configuration as second argument.

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

- Decouple standard mode from ArkType dependency
- Introduce `validator` config option for `createEnv`
- Outline design decisions and implementation tasks
- Added non-goals section
- Clarified type inference is not a goal
- Emphasized external validator reliance
…rkType loading, `createEnv` branching, coercion, proxy usage, and updated trade-offs.
…tor mode for ArkType DSL and non-standard validators, and clarify coercion details.
@changeset-bot
Copy link

changeset-bot bot commented Jan 14, 2026

🦋 Changeset detected

Latest commit: 288df49

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

This PR includes changesets to release 4 packages
Name Type
arkenv Minor
@repo/types Patch
@arkenv/bun-plugin Patch
@arkenv/vite-plugin 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 14, 2026

Warning

Rate limit exceeded

@yamcodes has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 7 minutes and 20 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 c2e50b0 and 288df49.

⛔ Files ignored due to path filters (1)
  • examples/without-arktype/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (5)
  • apps/www/content/docs/arkenv/meta.json
  • apps/www/content/docs/arkenv/validator-mode.mdx
  • examples/without-arktype/package.json
  • examples/without-arktype/src/index.ts
  • packages/arkenv/src/arktype/README.md

Walkthrough

ArkEnv now supports two explicit validator modes: "arktype" (default with coercion) and "standard" (standard schema validators only). ArkType becomes an optional peer dependency, relocated to arkenv/arktype. A new parseStandard function enables validation without ArkType using Standard Schema 1.0 validators.

Changes

Cohort / File(s) Summary
Core Validator Mode Dispatcher
packages/arkenv/src/create-env.ts, packages/arkenv/src/parse-standard.ts
Refactored createEnv into a dual-mode dispatcher selecting between parseArkType and parseStandard based on config.validator; introduced parseStandard to validate using Standard Schema validators with per-key validation and onUndeclaredKey handling.
ArkType Isolation & Lazy Loading
packages/arkenv/src/utils/load-arktype.ts, packages/arkenv/src/arktype/index.ts, packages/arkenv/src/type.ts
Introduced loadArkTypeValidator() for dynamic ArkType loading with clear error messaging; moved type export to arkenv/arktype/index.ts; removed type from main arkenv export; created arktype/index.ts with parse function to encapsulate ArkType-specific logic.
Error Handling & Formatting
packages/arkenv/src/errors.ts, packages/arkenv/src/errors.test.ts
Added InternalValidationError type and dual-path error formatting via formatArkErrors and formatInternalErrors; updated ArkEnvError constructor to handle both ArkType and internal validation errors.
Type System & Schemas
packages/internal/types/src/standard-schema.ts, packages/internal/types/src/schema.ts, packages/internal/types/src/infer-type.ts, packages/internal/types/src/helpers.ts, packages/internal/types/src/index.ts
Introduced comprehensive Standard Schema 1.0 type definitions (StandardTypedV1, StandardSchemaV1, StandardJSONSchemaV1); simplified SchemaShape to Record<string, unknown>; added Dict utility; updated InferType to support object shape { t: U } pattern; reorganized type exports.
Coercion Pipeline
packages/arkenv/src/arktype/coercion/coerce.ts, packages/arkenv/src/arktype/coercion/coerce.test.ts
Updated coerce signature to accept at parameter (ArkType instance) before schema; refactored coercion pipeline initialization; updated all test invocations to pass type argument.
Build & Configuration
packages/arkenv/package.json, packages/arkenv/tsdown.config.ts, packages/arkenv/tsconfig.json
Reorganized package exports with conditional arkenv/arktype sub-export; marked arktype as optional peer dependency; increased size limit from 2 kB to 3 kB; added external/noExternal tsdown configuration; enabled allowImportingTsExtensions.
Import Path Migrations
apps/playgrounds/bun-react/src/env.ts, apps/playgrounds/solid-start/app.config.ts, apps/playgrounds/vite-legacy/vite.config.ts, apps/playgrounds/vite/vite.config.ts, examples/with-bun-react/src/env.ts, examples/with-solid-start/app.config.ts, examples/with-vite-react/vite.config.ts, packages/vite-plugin/src/__fixtures__/*
Updated 15+ files to import type from arkenv/arktype instead of arkenv; split combined imports into separate statements where needed.
New Standard-Schema Examples
examples/without-arktype/package.json, examples/without-arktype/src/index.ts, examples/without-arktype/tsconfig.json, apps/playgrounds/standard-schema/index.ts, examples/with-standard-schema/index.ts
Added new without-arktype example showcasing standard-validator mode with Zod; updated standard-schema playground and example to use validator: "standard" with Zod validators (DATABASE_URL, API_KEY, MAX_RETRIES, TIMEOUT_MS, ALLOWED_ORIGINS, NODE_ENV, DEBUG).
Documentation & Specs
openspec/changes/add-explicit-validator-mode/{design.md, proposal.md, tasks.md, specs/...}, .changeset/{every-tips-shout.md, tender-books-shout.md}
Added comprehensive specification documents detailing validator modes, design decisions, implementation tasks, and error handling; created changesets documenting ArkType as optional peer dependency and validator configuration.
Documentation Updates
apps/www/content/docs/arkenv/{quickstart.mdx, validator-mode.mdx, integrations/standard-schema.mdx, how-to/load-environment-variables.mdx, coercion.mdx, index.mdx}, apps/www/content/docs/bun-plugin/index.mdx, apps/www/content/docs/vite-plugin/{arkenv-in-viteconfig.mdx, typing-import-meta-env.mdx}, examples/{with-solid-start, with-vite-react}/README.md
Added validator-mode documentation; updated quickstart with installation options; added configuration options section; rewrote standard-schema integration docs; updated code examples throughout; added IDE integration guidance; clarified coercion availability in ArkType mode.
Test Additions & Updates
packages/arkenv/src/isolation.test.ts, packages/arkenv/src/utils/load-arktype.test.ts, packages/arkenv/src/arktype/*.test.ts
Added isolation tests for ArkType lazy loading in standard vs. default modes; added loadArkTypeValidator tests for successful loading, missing peer dependency, and error handling; updated 8+ arktype tests to use explicit .ts extensions and adjusted import paths.
Workspace & Metadata
arkenv.code-workspace, examples/README.md, apps/www/package.json, apps/www/source.config.ts, packages/vite-plugin/package.json, packages/arkenv/README.md, .gitignore
Added without-arktype example to workspace; updated examples table; added @repo/scope and @repo/types dependencies; added arkenv/arktype path alias resolution; updated size documentation; narrowed gitignore pattern for arktype/.
Vitest Configuration
packages/vite-plugin/vitest.config.ts, packages/arkenv/src/utils/index.ts
Converted single alias object to array-based rule format with find/replacement patterns for arkenv and arkenv/arktype; updated utils exports to use explicit .ts extensions.

Sequence Diagram

sequenceDiagram
    participant User
    participant createEnv as createEnv(def, config?)
    participant Dispatcher
    participant loadValidator as config.validator?
    participant Standard as parseStandard
    participant ArkType as loadArkTypeValidator
    participant Parser as Parse
    participant Env as env (output)

    User->>createEnv: call with schema & config
    createEnv->>Dispatcher: extract validator mode
    Dispatcher->>loadValidator: mode = config.validator ?? "arktype"
    
    alt validator: "standard"
        loadValidator-->>Dispatcher: "standard"
        Dispatcher->>Standard: parseStandard(def, config)
        Standard->>Standard: iterate keys & validate<br/>via validator["~standard"].validate()
        Standard->>Env: return validated output<br/>or throw ArkEnvError
    else validator: "arktype" (default)
        loadValidator-->>Dispatcher: "arktype"
        Dispatcher->>ArkType: loadArkTypeValidator()
        ArkType->>ArkType: dynamically require ArkType<br/>or throw on missing
        ArkType->>Parser: return validator.parse()
        Parser->>Parser: coerce, validate, handle<br/>undeclaredKey, return env
        Parser->>Env: validated env object
    end
    
    Env-->>User: typed environment
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related issues

Possibly related PRs

Suggested reviewers

  • yamcodes

Poem

🐰 Hopping through modes with glee,
ArkType now optional, you'll see!
Standard Schema takes the stage,
Validator modes turn the page,
Two paths forward, pure and free!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically summarizes the main objective: making ArkType optional through an explicit validator mode that supports Standard Schema. It directly reflects the primary architectural change in the changeset.

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


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions github-actions bot added the docs Improvements or additions to documentation label Jan 14, 2026
@arkenv-bot
Copy link
Contributor

arkenv-bot bot commented Jan 14, 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 16 2026, 9:58 PM (Asia/Almaty)

…r `standard` validation, enabling `arkenv` to run without `arktype` and removing auto-detection logic.
…Env` to separate ArkType-dependent and ArkType-independent validation modes.
…ercion rules and detailing implementation tasks for dependency isolation.
…le, adjusting the `validator` option's opt-out description, and explicitly stating that standard mode will not include coercion.
@yamcodes yamcodes changed the base branch from main to remove-keywords-package January 15, 2026 20:10
Base automatically changed from remove-keywords-package to main January 15, 2026 20:20
- Add `validator` option to `createEnv` function
- Support `arktype` (default) and `standard` validation modes
- Lazily load Ark
@github-actions github-actions bot added the arkenv Changes to the `arkenv` npm package. label Jan 15, 2026
@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 15, 2026

Open in StackBlitz

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

commit: 3a57eab

@arkenv-bot
Copy link
Contributor

arkenv-bot bot commented Jan 15, 2026

📦 Bundle Size Report

Package Size Limit Diff Status
@arkenv/vite-plugin 1.55 kB 1.95 kB 0.0%
arkenv 1.38 kB 2.93 kB 0.0%

All size limits passed!

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

🤖 Fix all issues with AI agents
In `@apps/www/content/docs/arkenv/how-to/load-environment-variables.mdx`:
- Around line 206-223: The Standard-mode example uses z.number() which rejects
string ENV values; update the validator in the env2 arkenv call to use
z.coerce.number() for PORT (i.e., replace z.number().int().min(0).max(65535)
with z.coerce.number().int().min(0).max(65535)) so string environment variables
are correctly coerced to numbers; keep DATABASE_URL as z.string().url() and
leave the arkenv call and validator: "standard" option unchanged.

In `@apps/www/content/docs/arkenv/integrations/standard-schema.mdx`:
- Around line 59-84: The example uses z.number() and z.boolean() but in
standard-only mode env vars are raw strings, so replace those validators with
Zod coercion variants (e.g., use z.coerce.number() for PORT and
z.coerce.boolean().default(false) for DEBUG) in the env constant passed to
arkenv(..., { validator: "standard" }) so the strings are converted before
validation; keep DATABASE_URL as z.string().url() and preserve the arkenv(env)
call.

In `@packages/arkenv/src/create-env.ts`:
- Around line 93-105: The code may pass an EnvSchemaWithType (ArkType object)
into parseStandard when mode === "standard"; add a runtime guard before calling
parseStandard to detect and reject ArkType values (e.g., inspect each entry of
def and fail if any value looks like an ArkType/EnvSchemaWithType rather than a
plain standard validator — check for missing "~standard" property or for
ArkType-identifying shape) and throw a clear error indicating validator must be
"arktype" for EnvSchemaWithType; update the branch around mode, parseStandard,
and validator (references: mode, parseStandard, EnvSchemaWithType, validator,
loadArkTypeValidator, parse) to perform this check and fail-fast instead of
passing incompatible values to parseStandard.

In `@packages/arkenv/src/utils/load-arktype.ts`:
- Around line 10-57: The searchPaths array causes require(path) to pick up ESM
.js files first and throw ERR_REQUIRE_ESM; update the searchPaths used in
load-arktype (the searchPaths constant) to prioritize .cjs variants (e.g.,
"./arktype.cjs", "../arktype.cjs", "./arktype/index.cjs",
"../arktype/index.cjs") before the .js/.ts entries so require(path) will load
the CommonJS build when available; keep the existing fallback entries and leave
the rest of the require()/MODULE_NOT_FOUND handling intact.

In `@packages/vite-plugin/package.json`:
- Line 15: The workspace dependency line for "@repo/scope": "workspace:*" was
added but the pnpm lockfile is out of sync; run pnpm install from the repository
root to regenerate pnpm-lock.yaml so CI no longer fails, then commit the updated
lockfile alongside the change to packages/vite-plugin/package.json to ensure the
lockfile includes the new workspace dependency.
🧹 Nitpick comments (5)
packages/vite-plugin/package.json (1)

44-45: Duplicate keyword in array.

"arkenv" appears twice in the keywords array. Consider removing the duplicate.

🔧 Suggested fix
 	"keywords": [
 		"arktype",
 		"arkenv",
-		"arkenv",
 		"environment",
 		"variables",
 		"vite",
 		"plugin",
 		"vite-plugin"
 	],
apps/playgrounds/solid-start/README.md (1)

9-31: Add prerequisite note about ArkType dependency.

Since ArkType is now optional and this example uses ArkType-specific features (coercion via string.numeric and boolean), consider adding a note in the Setup section clarifying that ArkType must be installed and that the validator defaults to "arktype" mode.

📝 Suggested documentation addition

Add a note after line 11 or before the code example:

> **Note:** This example uses ArkType-specific features including type coercion (e.g., `string.numeric``number`). Ensure ArkType is installed:
> ```bash
> pnpm add arktype
> ```
> The validator mode defaults to `"arktype"`. For Standard Schema validation without coercion, see the [validator configuration docs](https://arkenv.js.org/docs/validator-mode).

Based on PR objectives clarifying that coercion is only available in ArkType mode and that installation guidance should be updated.

apps/playgrounds/vite/README.md (1)

16-16: Split imports to separate lines for readability.

Having two import statements on a single line is non-idiomatic and reduces readability.

📝 Suggested formatting
-import arkenv from "arkenv"; import { type } from "arkenv/arktype";
+import arkenv from "arkenv";
+import { type } from "arkenv/arktype";
packages/arkenv/src/errors.ts (1)

5-8: Add JSDoc for the new public exports.

These are exported APIs; adding doc comments will keep the public surface consistent with project standards.

♻️ Suggested JSDoc additions
-export type InternalValidationError = {
+/**
+ * Internal validation error produced by non-ArkType validators.
+ */
+export type InternalValidationError = {
 	path: string;
 	message: string;
 };
@@
-export const formatInternalErrors = (
+/**
+ * Format internal validation errors into a readable string.
+ * `@param` errors - Internal validation errors.
+ * `@returns` Formatted error message.
+ */
+export const formatInternalErrors = (
 	errors: InternalValidationError[],
 ): string =>

As per coding guidelines, add JSDoc for public APIs.

Also applies to: 62-70

packages/arkenv/src/utils/load-arktype.test.ts (1)

13-51: Reset mocks between tests to avoid cross-test leakage.

Adding a small reset will keep this suite resilient if additional cases are added later.

♻️ Suggested tweak
-import { describe, expect, it, vi } from "vitest";
+import { afterEach, describe, expect, it, vi } from "vitest";

+afterEach(() => {
+	vi.resetAllMocks();
+});
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 54d5c19 and ed40bdf.

⛔ Files ignored due to path filters (2)
  • examples/without-arktype/package-lock.json is excluded by !**/package-lock.json
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (49)
  • .changeset/every-tips-shout.md
  • .changeset/tender-books-shout.md
  • apps/playgrounds/bun-react/src/env.ts
  • apps/playgrounds/solid-start/README.md
  • apps/playgrounds/solid-start/app.config.ts
  • apps/playgrounds/vite-legacy/vite.config.ts
  • apps/playgrounds/vite/README.md
  • apps/playgrounds/vite/vite.config.ts
  • apps/www/content/docs/arkenv/coercion.mdx
  • apps/www/content/docs/arkenv/how-to/load-environment-variables.mdx
  • apps/www/content/docs/arkenv/how-to/reuse-schemas.mdx
  • apps/www/content/docs/arkenv/integrations/standard-schema.mdx
  • apps/www/content/docs/arkenv/quickstart.mdx
  • apps/www/content/docs/bun-plugin/index.mdx
  • apps/www/content/docs/vite-plugin/arkenv-in-viteconfig.mdx
  • apps/www/content/docs/vite-plugin/typing-import-meta-env.mdx
  • apps/www/package.json
  • apps/www/source.config.ts
  • examples/without-arktype/package.json
  • examples/without-arktype/src/index.ts
  • packages/arkenv/package.json
  • packages/arkenv/src/array-defaults.integration.test.ts
  • packages/arkenv/src/coercion/coerce.test.ts
  • packages/arkenv/src/coercion/coerce.ts
  • packages/arkenv/src/coercion/coercion.integration.test.ts
  • packages/arkenv/src/coercion/index.ts
  • packages/arkenv/src/coercion/morphs.test.ts
  • packages/arkenv/src/coercion/morphs.ts
  • packages/arkenv/src/create-env.test.ts
  • packages/arkenv/src/create-env.ts
  • packages/arkenv/src/custom-types.integration.test.ts
  • packages/arkenv/src/error.integration.test.ts
  • packages/arkenv/src/errors.ts
  • packages/arkenv/src/index.ts
  • packages/arkenv/src/isolation.test.ts
  • packages/arkenv/src/object-parsing.integration.test.ts
  • packages/arkenv/src/parse-standard.ts
  • packages/arkenv/src/type.test.ts
  • packages/arkenv/src/type.ts
  • packages/arkenv/src/utils/index.ts
  • packages/arkenv/src/utils/load-arktype.test.ts
  • packages/arkenv/src/utils/load-arktype.ts
  • packages/arkenv/tsconfig.json
  • packages/arkenv/tsdown.config.ts
  • packages/internal/types/src/index.ts
  • packages/vite-plugin/package.json
  • packages/vite-plugin/src/__fixtures__/basic/config.ts
  • packages/vite-plugin/src/__fixtures__/with-env-dir/config.ts
  • packages/vite-plugin/vitest.config.ts
💤 Files with no reviewable changes (13)
  • packages/arkenv/src/coercion/index.ts
  • packages/arkenv/src/coercion/morphs.ts
  • packages/arkenv/src/coercion/coerce.test.ts
  • packages/arkenv/src/type.ts
  • packages/arkenv/src/error.integration.test.ts
  • packages/arkenv/src/coercion/morphs.test.ts
  • packages/arkenv/src/custom-types.integration.test.ts
  • packages/arkenv/src/array-defaults.integration.test.ts
  • packages/arkenv/src/type.test.ts
  • packages/arkenv/src/create-env.test.ts
  • packages/arkenv/src/coercion/coerce.ts
  • packages/arkenv/src/coercion/coercion.integration.test.ts
  • packages/arkenv/src/object-parsing.integration.test.ts
✅ Files skipped from review due to trivial changes (5)
  • .changeset/tender-books-shout.md
  • apps/www/content/docs/arkenv/coercion.mdx
  • packages/vite-plugin/src/fixtures/basic/config.ts
  • packages/vite-plugin/src/fixtures/with-env-dir/config.ts
  • packages/arkenv/src/utils/index.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • packages/arkenv/src/parse-standard.ts
  • packages/arkenv/tsdown.config.ts
  • examples/without-arktype/src/index.ts
  • examples/without-arktype/package.json
🧰 Additional context used
📓 Path-based instructions (14)
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/utils/load-arktype.ts
  • packages/arkenv/src/errors.ts
  • packages/arkenv/src/isolation.test.ts
  • packages/arkenv/src/utils/load-arktype.test.ts
  • packages/arkenv/src/create-env.ts
  • packages/arkenv/src/index.ts
**/*.{ts,tsx}

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

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

**/*.{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/utils/load-arktype.ts
  • packages/arkenv/src/errors.ts
  • apps/www/source.config.ts
  • packages/vite-plugin/vitest.config.ts
  • packages/arkenv/src/isolation.test.ts
  • packages/arkenv/src/utils/load-arktype.test.ts
  • apps/playgrounds/solid-start/app.config.ts
  • apps/playgrounds/bun-react/src/env.ts
  • packages/arkenv/src/create-env.ts
  • packages/internal/types/src/index.ts
  • apps/playgrounds/vite/vite.config.ts
  • apps/playgrounds/vite-legacy/vite.config.ts
  • packages/arkenv/src/index.ts
packages/*/package.json

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

Packages in packages/ directory must be published to npm and require changesets for versioning, proper exports, and type definitions

Files:

  • packages/vite-plugin/package.json
  • packages/arkenv/package.json
**/package.json

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

Use workspace:* protocol for workspace dependencies between packages

Files:

  • packages/vite-plugin/package.json
  • apps/www/package.json
  • packages/arkenv/package.json
{packages,apps,tooling}/**/package.json

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

When referencing workspace packages in dependencies, use the workspace:* protocol instead of version numbers

Files:

  • packages/vite-plugin/package.json
  • apps/www/package.json
  • packages/arkenv/package.json
apps/www/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (apps/www/.cursor/rules/posthog-integration.mdc)

apps/www/**/*.{ts,tsx,js,jsx}: If using TypeScript, use an enum to store feature flag names. If using JavaScript, store feature flag names as strings to an object declared as a constant to simulate an enum. Use UPPERCASE_WITH_UNDERSCORE naming convention for enum/const object members.
If a custom property for a person or event is referenced in two or more files or two or more callsites in the same file, use an enum or const object with UPPERCASE_WITH_UNDERSCORE naming convention, similar to feature flags.

Files:

  • apps/www/source.config.ts
apps/*/package.json

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

Applications in apps/ directory are not published to npm and may depend on workspace packages

Files:

  • apps/www/package.json
**/*.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/isolation.test.ts
  • packages/arkenv/src/utils/load-arktype.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/isolation.test.ts
  • packages/arkenv/src/utils/load-arktype.test.ts
apps/playgrounds/bun-react/**/*.{ts,tsx,js,jsx}

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

apps/playgrounds/bun-react/**/*.{ts,tsx,js,jsx}: Use bun <file> instead of node <file> or ts-node <file> for running TypeScript and JavaScript files
Bun automatically loads .env files, so don't use the dotenv package
Use Bun.serve() with built-in WebSocket, HTTPS, and route support instead of express
Use bun:sqlite for SQLite database operations instead of better-sqlite3
Use Bun.redis for Redis operations instead of ioredis
Use Bun.sql for Postgres database operations instead of pg or postgres.js
Use built-in WebSocket instead of the ws package
Prefer Bun.file over node:fs readFile/writeFile methods for file operations
Use Bun.$ template literal syntax for shell commands instead of execa

Files:

  • apps/playgrounds/bun-react/src/env.ts
apps/playgrounds/bun-react/**/*.{ts,tsx,js,jsx,html,css}

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

Use bun build <file.html|file.ts|file.css> instead of webpack or esbuild for bundling

Files:

  • apps/playgrounds/bun-react/src/env.ts
apps/playgrounds/bun-react/**/*.{ts,tsx,js,jsx,html}

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

CSS files can be imported directly in TypeScript/JavaScript or referenced in HTML <link> tags, and Bun will automatically bundle them

Files:

  • apps/playgrounds/bun-react/src/env.ts
apps/playgrounds/bun-react/**/*.ts

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

Use bun --hot to run TypeScript entry files with hot module reloading enabled

Files:

  • apps/playgrounds/bun-react/src/env.ts
**/index.ts

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

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

Files:

  • packages/internal/types/src/index.ts
  • packages/arkenv/src/index.ts
🧠 Learnings (44)
📓 Common learnings
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 : 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: 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/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: yamcodes
Repo: yamcodes/arkenv PR: 498
File: apps/playgrounds/node/index.ts:2-2
Timestamp: 2025-12-05T20:33:10.676Z
Learning: ArkType 2.1.28+ supports Standard Schema specification, allowing interoperability with other Standard Schema-compliant validation libraries (e.g., Zod, Valibot) within the same schema definition
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} : 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} : 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 : 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: .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
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
📚 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:

  • apps/www/content/docs/vite-plugin/typing-import-meta-env.mdx
  • packages/arkenv/src/utils/load-arktype.ts
  • packages/vite-plugin/package.json
  • packages/arkenv/src/errors.ts
  • apps/www/source.config.ts
  • packages/arkenv/tsconfig.json
  • apps/www/content/docs/arkenv/how-to/load-environment-variables.mdx
  • packages/vite-plugin/vitest.config.ts
  • packages/arkenv/src/isolation.test.ts
  • packages/arkenv/src/utils/load-arktype.test.ts
  • apps/playgrounds/vite/README.md
  • packages/arkenv/package.json
  • apps/playgrounds/solid-start/README.md
  • apps/www/content/docs/arkenv/integrations/standard-schema.mdx
  • apps/www/content/docs/bun-plugin/index.mdx
  • apps/www/content/docs/vite-plugin/arkenv-in-viteconfig.mdx
  • apps/playgrounds/solid-start/app.config.ts
  • apps/playgrounds/bun-react/src/env.ts
  • packages/arkenv/src/create-env.ts
  • packages/internal/types/src/index.ts
  • apps/playgrounds/vite/vite.config.ts
  • apps/playgrounds/vite-legacy/vite.config.ts
  • apps/www/content/docs/arkenv/how-to/reuse-schemas.mdx
  • .changeset/every-tips-shout.md
  • packages/arkenv/src/index.ts
  • apps/www/content/docs/arkenv/quickstart.mdx
📚 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:

  • apps/www/content/docs/vite-plugin/typing-import-meta-env.mdx
  • packages/arkenv/src/utils/load-arktype.ts
  • packages/arkenv/src/errors.ts
  • apps/www/source.config.ts
  • apps/www/content/docs/arkenv/how-to/load-environment-variables.mdx
  • packages/vite-plugin/vitest.config.ts
  • packages/arkenv/src/isolation.test.ts
  • packages/arkenv/src/utils/load-arktype.test.ts
  • apps/playgrounds/vite/README.md
  • packages/arkenv/package.json
  • apps/playgrounds/solid-start/README.md
  • apps/www/content/docs/arkenv/integrations/standard-schema.mdx
  • apps/www/content/docs/bun-plugin/index.mdx
  • apps/www/content/docs/vite-plugin/arkenv-in-viteconfig.mdx
  • apps/playgrounds/solid-start/app.config.ts
  • apps/playgrounds/bun-react/src/env.ts
  • packages/arkenv/src/create-env.ts
  • packages/internal/types/src/index.ts
  • apps/playgrounds/vite/vite.config.ts
  • apps/playgrounds/vite-legacy/vite.config.ts
  • apps/www/content/docs/arkenv/how-to/reuse-schemas.mdx
  • .changeset/every-tips-shout.md
  • packages/arkenv/src/index.ts
  • apps/www/content/docs/arkenv/quickstart.mdx
📚 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:

  • apps/www/content/docs/vite-plugin/typing-import-meta-env.mdx
  • packages/arkenv/src/utils/load-arktype.ts
  • packages/arkenv/src/errors.ts
  • apps/www/source.config.ts
  • packages/arkenv/tsconfig.json
  • apps/www/content/docs/arkenv/how-to/load-environment-variables.mdx
  • packages/arkenv/src/isolation.test.ts
  • packages/arkenv/src/utils/load-arktype.test.ts
  • apps/playgrounds/vite/README.md
  • packages/arkenv/package.json
  • apps/playgrounds/solid-start/README.md
  • apps/www/content/docs/arkenv/integrations/standard-schema.mdx
  • apps/www/content/docs/bun-plugin/index.mdx
  • apps/www/content/docs/vite-plugin/arkenv-in-viteconfig.mdx
  • apps/playgrounds/solid-start/app.config.ts
  • apps/playgrounds/bun-react/src/env.ts
  • packages/arkenv/src/create-env.ts
  • packages/internal/types/src/index.ts
  • apps/playgrounds/vite/vite.config.ts
  • apps/playgrounds/vite-legacy/vite.config.ts
  • apps/www/content/docs/arkenv/how-to/reuse-schemas.mdx
  • packages/arkenv/src/index.ts
  • apps/www/content/docs/arkenv/quickstart.mdx
📚 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:

  • apps/www/content/docs/vite-plugin/typing-import-meta-env.mdx
  • packages/arkenv/src/utils/load-arktype.ts
  • packages/arkenv/src/errors.ts
  • apps/www/content/docs/arkenv/how-to/load-environment-variables.mdx
  • packages/arkenv/src/isolation.test.ts
  • packages/arkenv/src/utils/load-arktype.test.ts
  • apps/playgrounds/vite/README.md
  • packages/arkenv/package.json
  • apps/playgrounds/solid-start/README.md
  • apps/www/content/docs/bun-plugin/index.mdx
  • apps/www/content/docs/vite-plugin/arkenv-in-viteconfig.mdx
  • apps/playgrounds/solid-start/app.config.ts
  • apps/playgrounds/bun-react/src/env.ts
  • packages/arkenv/src/create-env.ts
  • packages/internal/types/src/index.ts
  • apps/playgrounds/vite/vite.config.ts
  • apps/playgrounds/vite-legacy/vite.config.ts
  • apps/www/content/docs/arkenv/how-to/reuse-schemas.mdx
  • .changeset/every-tips-shout.md
  • packages/arkenv/src/index.ts
  • apps/www/content/docs/arkenv/quickstart.mdx
📚 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/www/content/docs/vite-plugin/typing-import-meta-env.mdx
  • packages/vite-plugin/package.json
  • packages/arkenv/src/errors.ts
  • apps/www/source.config.ts
  • packages/arkenv/tsconfig.json
  • apps/www/content/docs/arkenv/how-to/load-environment-variables.mdx
  • packages/vite-plugin/vitest.config.ts
  • apps/playgrounds/vite/README.md
  • packages/arkenv/package.json
  • apps/playgrounds/solid-start/README.md
  • apps/www/content/docs/arkenv/integrations/standard-schema.mdx
  • apps/www/content/docs/bun-plugin/index.mdx
  • apps/www/content/docs/vite-plugin/arkenv-in-viteconfig.mdx
  • apps/playgrounds/solid-start/app.config.ts
  • apps/playgrounds/bun-react/src/env.ts
  • packages/arkenv/src/create-env.ts
  • packages/internal/types/src/index.ts
  • apps/playgrounds/vite/vite.config.ts
  • apps/www/content/docs/arkenv/how-to/reuse-schemas.mdx
  • .changeset/every-tips-shout.md
  • packages/arkenv/src/index.ts
  • apps/www/content/docs/arkenv/quickstart.mdx
📚 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:

  • apps/www/content/docs/vite-plugin/typing-import-meta-env.mdx
  • packages/arkenv/src/utils/load-arktype.ts
  • packages/arkenv/src/errors.ts
  • apps/www/source.config.ts
  • packages/arkenv/tsconfig.json
  • apps/www/content/docs/arkenv/how-to/load-environment-variables.mdx
  • packages/vite-plugin/vitest.config.ts
  • packages/arkenv/src/isolation.test.ts
  • packages/arkenv/src/utils/load-arktype.test.ts
  • apps/playgrounds/vite/README.md
  • packages/arkenv/package.json
  • apps/playgrounds/solid-start/README.md
  • apps/www/content/docs/arkenv/integrations/standard-schema.mdx
  • apps/www/content/docs/bun-plugin/index.mdx
  • apps/www/content/docs/vite-plugin/arkenv-in-viteconfig.mdx
  • apps/playgrounds/solid-start/app.config.ts
  • apps/playgrounds/bun-react/src/env.ts
  • packages/arkenv/src/create-env.ts
  • packages/internal/types/src/index.ts
  • apps/playgrounds/vite/vite.config.ts
  • apps/playgrounds/vite-legacy/vite.config.ts
  • apps/www/content/docs/arkenv/how-to/reuse-schemas.mdx
  • .changeset/every-tips-shout.md
  • packages/arkenv/src/index.ts
  • apps/www/content/docs/arkenv/quickstart.mdx
📚 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:

  • apps/www/content/docs/vite-plugin/typing-import-meta-env.mdx
  • packages/arkenv/src/utils/load-arktype.ts
  • packages/arkenv/src/errors.ts
  • apps/www/source.config.ts
  • packages/arkenv/tsconfig.json
  • packages/vite-plugin/vitest.config.ts
  • packages/arkenv/src/utils/load-arktype.test.ts
  • apps/playgrounds/vite/README.md
  • packages/arkenv/package.json
  • apps/playgrounds/solid-start/README.md
  • apps/www/content/docs/bun-plugin/index.mdx
  • apps/www/content/docs/vite-plugin/arkenv-in-viteconfig.mdx
  • apps/playgrounds/solid-start/app.config.ts
  • apps/playgrounds/bun-react/src/env.ts
  • packages/arkenv/src/create-env.ts
  • packages/internal/types/src/index.ts
  • apps/playgrounds/vite/vite.config.ts
  • apps/playgrounds/vite-legacy/vite.config.ts
  • apps/www/content/docs/arkenv/how-to/reuse-schemas.mdx
  • .changeset/every-tips-shout.md
  • packages/arkenv/src/index.ts
  • apps/www/content/docs/arkenv/quickstart.mdx
📚 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:

  • apps/www/content/docs/vite-plugin/typing-import-meta-env.mdx
  • packages/arkenv/src/errors.ts
  • packages/arkenv/tsconfig.json
  • apps/www/content/docs/arkenv/how-to/load-environment-variables.mdx
  • apps/www/content/docs/bun-plugin/index.mdx
  • apps/www/content/docs/vite-plugin/arkenv-in-viteconfig.mdx
  • apps/playgrounds/solid-start/app.config.ts
  • apps/playgrounds/bun-react/src/env.ts
  • packages/arkenv/src/create-env.ts
  • apps/playgrounds/vite/vite.config.ts
  • apps/playgrounds/vite-legacy/vite.config.ts
  • packages/arkenv/src/index.ts
  • apps/www/content/docs/arkenv/quickstart.mdx
📚 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:

  • apps/www/content/docs/vite-plugin/typing-import-meta-env.mdx
  • apps/www/source.config.ts
  • packages/arkenv/tsconfig.json
  • apps/www/content/docs/arkenv/how-to/load-environment-variables.mdx
  • packages/vite-plugin/vitest.config.ts
  • apps/playgrounds/vite/README.md
  • packages/arkenv/package.json
  • apps/playgrounds/solid-start/README.md
  • apps/www/content/docs/bun-plugin/index.mdx
  • apps/www/content/docs/vite-plugin/arkenv-in-viteconfig.mdx
  • apps/playgrounds/solid-start/app.config.ts
  • apps/playgrounds/bun-react/src/env.ts
  • packages/arkenv/src/create-env.ts
  • apps/playgrounds/vite/vite.config.ts
  • apps/playgrounds/vite-legacy/vite.config.ts
  • packages/arkenv/src/index.ts
  • apps/www/content/docs/arkenv/quickstart.mdx
📚 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:

  • apps/www/content/docs/vite-plugin/typing-import-meta-env.mdx
  • packages/arkenv/src/utils/load-arktype.ts
  • packages/arkenv/src/errors.ts
  • apps/www/content/docs/arkenv/how-to/load-environment-variables.mdx
  • packages/arkenv/src/utils/load-arktype.test.ts
  • apps/playgrounds/vite/README.md
  • packages/arkenv/package.json
  • apps/playgrounds/solid-start/README.md
  • apps/www/content/docs/arkenv/integrations/standard-schema.mdx
  • apps/www/content/docs/bun-plugin/index.mdx
  • apps/www/content/docs/vite-plugin/arkenv-in-viteconfig.mdx
  • apps/playgrounds/solid-start/app.config.ts
  • packages/arkenv/src/create-env.ts
  • apps/playgrounds/vite/vite.config.ts
  • apps/playgrounds/vite-legacy/vite.config.ts
  • .changeset/every-tips-shout.md
  • packages/arkenv/src/index.ts
  • apps/www/content/docs/arkenv/quickstart.mdx
📚 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:

  • apps/www/content/docs/vite-plugin/typing-import-meta-env.mdx
  • packages/arkenv/src/utils/load-arktype.ts
  • packages/arkenv/src/errors.ts
  • apps/www/content/docs/arkenv/how-to/load-environment-variables.mdx
  • packages/arkenv/src/isolation.test.ts
  • packages/arkenv/src/utils/load-arktype.test.ts
  • apps/www/content/docs/arkenv/integrations/standard-schema.mdx
  • apps/www/content/docs/bun-plugin/index.mdx
  • apps/playgrounds/bun-react/src/env.ts
  • packages/arkenv/src/create-env.ts
  • apps/www/content/docs/arkenv/how-to/reuse-schemas.mdx
  • .changeset/every-tips-shout.md
  • apps/www/content/docs/arkenv/quickstart.mdx
📚 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:

  • apps/www/content/docs/vite-plugin/typing-import-meta-env.mdx
  • packages/arkenv/src/utils/load-arktype.ts
  • packages/arkenv/src/errors.ts
  • apps/www/source.config.ts
  • packages/arkenv/tsconfig.json
  • packages/vite-plugin/vitest.config.ts
  • packages/arkenv/src/utils/load-arktype.test.ts
  • apps/playgrounds/vite/README.md
  • packages/arkenv/package.json
  • apps/playgrounds/solid-start/README.md
  • apps/www/content/docs/arkenv/integrations/standard-schema.mdx
  • apps/www/content/docs/bun-plugin/index.mdx
  • apps/www/content/docs/vite-plugin/arkenv-in-viteconfig.mdx
  • apps/playgrounds/solid-start/app.config.ts
  • apps/playgrounds/bun-react/src/env.ts
  • packages/arkenv/src/create-env.ts
  • packages/internal/types/src/index.ts
  • apps/playgrounds/vite/vite.config.ts
  • apps/playgrounds/vite-legacy/vite.config.ts
  • apps/www/content/docs/arkenv/how-to/reuse-schemas.mdx
  • .changeset/every-tips-shout.md
  • packages/arkenv/src/index.ts
  • apps/www/content/docs/arkenv/quickstart.mdx
📚 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:

  • apps/www/content/docs/vite-plugin/typing-import-meta-env.mdx
  • packages/arkenv/src/utils/load-arktype.ts
  • apps/www/content/docs/arkenv/how-to/load-environment-variables.mdx
  • packages/arkenv/src/isolation.test.ts
  • packages/arkenv/src/utils/load-arktype.test.ts
  • apps/playgrounds/vite/README.md
  • packages/arkenv/package.json
  • apps/playgrounds/solid-start/README.md
  • apps/www/content/docs/arkenv/integrations/standard-schema.mdx
  • apps/www/content/docs/bun-plugin/index.mdx
  • apps/playgrounds/solid-start/app.config.ts
  • packages/arkenv/src/create-env.ts
  • packages/internal/types/src/index.ts
  • apps/playgrounds/vite/vite.config.ts
  • apps/playgrounds/vite-legacy/vite.config.ts
  • apps/www/content/docs/arkenv/how-to/reuse-schemas.mdx
  • .changeset/every-tips-shout.md
  • packages/arkenv/src/index.ts
  • apps/www/content/docs/arkenv/quickstart.mdx
📚 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:

  • apps/www/content/docs/vite-plugin/typing-import-meta-env.mdx
  • packages/arkenv/src/utils/load-arktype.ts
  • packages/arkenv/src/errors.ts
  • apps/www/source.config.ts
  • packages/arkenv/src/isolation.test.ts
  • packages/arkenv/src/utils/load-arktype.test.ts
  • apps/playgrounds/solid-start/README.md
  • apps/www/content/docs/arkenv/integrations/standard-schema.mdx
  • apps/www/content/docs/bun-plugin/index.mdx
  • apps/playgrounds/bun-react/src/env.ts
  • packages/arkenv/src/create-env.ts
  • .changeset/every-tips-shout.md
  • apps/www/content/docs/arkenv/quickstart.mdx
📚 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/load-arktype.ts
  • packages/vite-plugin/package.json
  • packages/arkenv/src/utils/load-arktype.test.ts
  • apps/playgrounds/vite/README.md
  • packages/arkenv/package.json
  • apps/www/content/docs/bun-plugin/index.mdx
  • packages/arkenv/src/create-env.ts
  • packages/internal/types/src/index.ts
  • apps/www/content/docs/arkenv/how-to/reuse-schemas.mdx
  • packages/arkenv/src/index.ts
  • apps/www/content/docs/arkenv/quickstart.mdx
📚 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 tooling/*/package.json : Tooling in tooling/ directory contains development and testing tools that are not published to npm and excluded from changesets

Applied to files:

  • packages/vite-plugin/package.json
  • apps/www/package.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: packages/arkenv should not depend on other workspace packages; packages/vite-plugin depends on arkenv; apps/www may depend on workspace packages

Applied to files:

  • packages/vite-plugin/package.json
  • apps/www/source.config.ts
  • apps/www/package.json
  • apps/www/content/docs/vite-plugin/arkenv-in-viteconfig.mdx
  • apps/playgrounds/vite/vite.config.ts
  • apps/playgrounds/vite-legacy/vite.config.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 the scoped `$` type system for custom types defined in `scope.ts`

Applied to files:

  • packages/vite-plugin/package.json
  • apps/www/source.config.ts
  • packages/arkenv/tsconfig.json
  • apps/playgrounds/vite/README.md
  • packages/arkenv/package.json
  • apps/playgrounds/solid-start/README.md
  • packages/internal/types/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 **/package.json : Use workspace:* protocol for workspace dependencies between packages

Applied to files:

  • packages/vite-plugin/package.json
  • apps/www/package.json
📚 Learning: 2025-11-29T08:00:08.044Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/pnpm.mdc:0-0
Timestamp: 2025-11-29T08:00:08.044Z
Learning: Applies to {packages,apps,tooling}/**/package.json : When referencing workspace packages in dependencies, use the `workspace:*` protocol instead of version numbers

Applied to files:

  • packages/vite-plugin/package.json
  • apps/www/package.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 PascalCase for type names (e.g., `ArkEnvError`)

Applied to files:

  • packages/arkenv/src/errors.ts
  • apps/www/source.config.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 TypeScript 5.1+ features when appropriate

Applied to files:

  • packages/arkenv/tsconfig.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:

  • packages/arkenv/tsconfig.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 apps/*/package.json : Applications in apps/ directory are not published to npm and may depend on workspace packages

Applied to files:

  • apps/www/package.json
📚 Learning: 2025-11-29T08:00:08.044Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/pnpm.mdc:0-0
Timestamp: 2025-11-29T08:00:08.044Z
Learning: Applies to package.json : Configure only built dependencies (native modules) in `pnpm.onlyBuiltDependencies`, including: biomejs/biome, sentry/cli, swc/core, tailwindcss/oxide, vercel/speed-insights, esbuild, and sharp

Applied to files:

  • apps/www/package.json
  • packages/arkenv/package.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:

  • apps/www/package.json
  • packages/arkenv/package.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/vite-plugin/vitest.config.ts
  • packages/arkenv/src/isolation.test.ts
  • packages/arkenv/src/utils/load-arktype.test.ts
  • apps/playgrounds/vite/README.md
  • apps/playgrounds/solid-start/README.md
  • apps/www/content/docs/vite-plugin/arkenv-in-viteconfig.mdx
  • apps/playgrounds/solid-start/app.config.ts
  • apps/playgrounds/vite/vite.config.ts
  • apps/playgrounds/vite-legacy/vite.config.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 : Use fixture-based testing pattern for Vite plugin tests by placing fixtures in __fixtures__ directory

Applied to files:

  • packages/vite-plugin/vitest.config.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} : Use Vitest for unit and integration tests

Applied to files:

  • packages/vite-plugin/vitest.config.ts
  • packages/arkenv/src/utils/load-arktype.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/vite-plugin/vitest.config.ts
  • packages/arkenv/src/utils/load-arktype.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/vite-plugin/vitest.config.ts
  • packages/arkenv/src/utils/load-arktype.test.ts
  • apps/playgrounds/vite/vite.config.ts
  • apps/playgrounds/vite-legacy/vite.config.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/isolation.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 individual functions, components, and hooks in isolation with mocked dependencies in unit tests

Applied to files:

  • packages/arkenv/src/isolation.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.{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:

  • packages/arkenv/src/isolation.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/isolation.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} : Mock at component boundaries (network, time, context)

Applied to files:

  • packages/arkenv/src/isolation.test.ts
📚 Learning: 2025-09-10T19:35:18.179Z
Learnt from: yamcodes
Repo: yamcodes/arkenv PR: 136
File: .changeset/vast-bananas-win.md:2-3
Timestamp: 2025-09-10T19:35:18.179Z
Learning: The arkenv package is currently in v0.x.x (pre-1.0) development phase, where breaking changes are acceptable in minor version bumps according to semantic versioning conventions.

Applied to files:

  • packages/arkenv/package.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: Avoid adding new dependencies without considering bundle size impact (target: <2kB gzipped, enforced limit: 2kB gzipped)

Applied to files:

  • packages/arkenv/package.json
📚 Learning: 2025-12-05T20:33:10.676Z
Learnt from: yamcodes
Repo: yamcodes/arkenv PR: 498
File: apps/playgrounds/node/index.ts:2-2
Timestamp: 2025-12-05T20:33:10.676Z
Learning: ArkType 2.1.28+ supports Standard Schema specification, allowing interoperability with other Standard Schema-compliant validation libraries (e.g., Zod, Valibot) within the same schema definition

Applied to files:

  • apps/www/content/docs/arkenv/integrations/standard-schema.mdx
📚 Learning: 2025-09-09T17:37:19.650Z
Learnt from: yamcodes
Repo: yamcodes/arkenv PR: 132
File: packages/arkenv/README.md:13-14
Timestamp: 2025-09-09T17:37:19.650Z
Learning: For yamcodes/arkenv project: Runtime support documentation should link to specific examples: Node.js (examples/basic), Bun (examples/with-bun), Vite (examples/with-vite-react-ts).

Applied to files:

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

Applied to files:

  • apps/www/content/docs/bun-plugin/index.mdx
📚 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/**/*.{ts,tsx,js,jsx} : Bun automatically loads .env files, so don't use the dotenv package

Applied to files:

  • apps/playgrounds/bun-react/src/env.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:

  • apps/www/content/docs/arkenv/quickstart.mdx
🧬 Code graph analysis (3)
packages/arkenv/src/errors.ts (2)
packages/arkenv/src/utils/style-text.ts (1)
  • styleText (49-59)
packages/arkenv/src/utils/indent.ts (1)
  • indent (18-32)
packages/arkenv/src/utils/load-arktype.test.ts (1)
packages/arkenv/src/utils/load-arktype.ts (1)
  • loadArkTypeValidator (7-69)
packages/arkenv/src/create-env.ts (4)
packages/arkenv/src/index.ts (1)
  • EnvSchema (4-4)
packages/internal/types/src/helpers.ts (1)
  • Dict (1-1)
packages/arkenv/src/parse-standard.ts (1)
  • parseStandard (9-75)
packages/arkenv/src/utils/load-arktype.ts (1)
  • loadArkTypeValidator (7-69)
🪛 ast-grep (0.40.5)
packages/arkenv/src/errors.ts

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

(regexp-from-variable)

🪛 GitHub Actions: pkg.pr.new
packages/vite-plugin/package.json

[error] 1-1: specifiers in the lockfile don't match specifiers in package.json: 1 dependencies were added: @repo/scope@workspace:*

🪛 GitHub Actions: test
packages/vite-plugin/package.json

[error] 1-1: Lockfile out of date relative to this package.json. The install failed due to a mismatch between the lockfile and package.json. Run 'pnpm install --no-frozen-lockfile' to update.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

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

🤖 Fix all issues with AI agents
In `@apps/www/content/docs/arkenv/how-to/load-environment-variables.mdx`:
- Around line 238-245: The comment for the example using arkenv (env2) is
misleading: when passing { coerce: false } ArkType expects actual numeric types
for the schema key "PORT" ("number.port"), but process.env values are strings so
validation will fail unless the source supplies real numbers; update the comment
next to env2 to clarify that with coerce: false the validator expects a number
type (not a numeric string) and either enable coercion or show an error
scenario/note that process.env strings will not pass validation.
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 842feca and b3def59.

📒 Files selected for processing (4)
  • apps/www/content/docs/arkenv/how-to/load-environment-variables.mdx
  • apps/www/content/docs/arkenv/integrations/standard-schema.mdx
  • packages/arkenv/src/create-env.ts
  • packages/arkenv/src/utils/load-arktype.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/arkenv/src/utils/load-arktype.ts
🧰 Additional context used
📓 Path-based instructions (2)
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.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.ts
🧠 Learnings (19)
📓 Common learnings
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 : 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: 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/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} : 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 ArkType's `type()` function to define schemas in environment variable 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 `createEnv(schema)` function (or default import as `arkenv`) to create validated environment objects in TypeScript
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
Learnt from: yamcodes
Repo: yamcodes/arkenv PR: 498
File: apps/playgrounds/node/index.ts:2-2
Timestamp: 2025-12-05T20:33:10.676Z
Learning: ArkType 2.1.28+ supports Standard Schema specification, allowing interoperability with other Standard Schema-compliant validation libraries (e.g., Zod, Valibot) within the same schema definition
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
📚 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.ts
  • apps/www/content/docs/arkenv/integrations/standard-schema.mdx
  • apps/www/content/docs/arkenv/how-to/load-environment-variables.mdx
📚 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.ts
  • apps/www/content/docs/arkenv/integrations/standard-schema.mdx
  • apps/www/content/docs/arkenv/how-to/load-environment-variables.mdx
📚 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.ts
  • apps/www/content/docs/arkenv/integrations/standard-schema.mdx
  • apps/www/content/docs/arkenv/how-to/load-environment-variables.mdx
📚 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/create-env.ts
  • apps/www/content/docs/arkenv/integrations/standard-schema.mdx
  • apps/www/content/docs/arkenv/how-to/load-environment-variables.mdx
📚 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.ts
  • apps/www/content/docs/arkenv/integrations/standard-schema.mdx
  • apps/www/content/docs/arkenv/how-to/load-environment-variables.mdx
📚 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.ts
  • apps/www/content/docs/arkenv/integrations/standard-schema.mdx
📚 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.ts
  • apps/www/content/docs/arkenv/integrations/standard-schema.mdx
  • apps/www/content/docs/arkenv/how-to/load-environment-variables.mdx
📚 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/create-env.ts
  • apps/www/content/docs/arkenv/integrations/standard-schema.mdx
  • apps/www/content/docs/arkenv/how-to/load-environment-variables.mdx
📚 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
  • apps/www/content/docs/arkenv/integrations/standard-schema.mdx
  • apps/www/content/docs/arkenv/how-to/load-environment-variables.mdx
📚 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.ts
  • apps/www/content/docs/arkenv/how-to/load-environment-variables.mdx
📚 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.ts
  • apps/www/content/docs/arkenv/integrations/standard-schema.mdx
  • apps/www/content/docs/arkenv/how-to/load-environment-variables.mdx
📚 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/create-env.ts
  • apps/www/content/docs/arkenv/integrations/standard-schema.mdx
  • apps/www/content/docs/arkenv/how-to/load-environment-variables.mdx
📚 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/create-env.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.ts
  • apps/www/content/docs/arkenv/integrations/standard-schema.mdx
  • apps/www/content/docs/arkenv/how-to/load-environment-variables.mdx
📚 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
📚 Learning: 2025-12-05T20:33:10.676Z
Learnt from: yamcodes
Repo: yamcodes/arkenv PR: 498
File: apps/playgrounds/node/index.ts:2-2
Timestamp: 2025-12-05T20:33:10.676Z
Learning: ArkType 2.1.28+ supports Standard Schema specification, allowing interoperability with other Standard Schema-compliant validation libraries (e.g., Zod, Valibot) within the same schema definition

Applied to files:

  • apps/www/content/docs/arkenv/integrations/standard-schema.mdx
📚 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:

  • apps/www/content/docs/arkenv/integrations/standard-schema.mdx
  • apps/www/content/docs/arkenv/how-to/load-environment-variables.mdx
📚 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:

  • apps/www/content/docs/arkenv/how-to/load-environment-variables.mdx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: test-e2e (e2e)
  • GitHub Check: Deploy-Preview
🔇 Additional comments (11)
apps/www/content/docs/arkenv/how-to/load-environment-variables.mdx (2)

206-224: LGTM!

The Standard mode example now correctly uses z.coerce.number() to handle string-to-number conversion for environment variables.


247-298: LGTM!

The custom environment source and array format sections provide clear, practical examples that demonstrate the configuration options effectively.

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

1-62: LGTM!

The imports are well-organized and the ArkEnvConfig type is properly extended with the validator option. The JSDoc comments clearly explain the behavior of each mode.


70-92: LGTM!

The function overloads properly support both schema formats, and the JSDoc accurately describes the dual-mode behavior with appropriate error documentation.


93-142: LGTM!

The standard mode implementation properly addresses the previous review concerns:

  • Runtime validation rejects ArkType DSL strings and non-Standard Schema validators
  • The ~standard property check ensures Standard Schema 1.0 compliance
  • Error messages are clear, actionable, and include the variable path
  • The type cast to Record<string, unknown> is now correct

As per coding guidelines, ArkEnvError is properly used for validation errors with user-friendly messages.


144-148: LGTM!

The ArkType mode delegation is clean and centralizes the ArkType dependency through loadArkTypeValidator(). The as any casts are acceptable given the overload complexity and type flexibility required for the dual-mode API.

apps/www/content/docs/arkenv/integrations/standard-schema.mdx (5)

6-10: Clear intro and mode overview.

The opening sets expectations for default vs. Standard-only behavior nicely.


18-20: Supported validators list is clear and helpful.


22-54: Default-mode usage and mixed-schema example read well.


55-70: Standard-only mode example is solid.


73-90: Guidance and limitations section is concise and accurate.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

…supporting ArkType, Zod, and Valibot schemas.
…or modes, updating the quickstart guide and twoslash configuration.
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

🤖 Fix all issues with AI agents
In `@apps/www/content/docs/arkenv/quickstart.mdx`:
- Line 53: The internal Markdown link "[any Standard Schema
validator](docs/arkenv/integrations/standard-schema)" is missing a leading slash
causing a relative path; update that link target to an absolute path by
prefixing it with "/" so it becomes "/docs/arkenv/integrations/standard-schema"
in the quickstart content (look for the link text "any Standard Schema
validator" to locate the exact markdown).
- Around line 125-128: The card with title "IDE Integrations" currently links
via href="/docs/arkenv/integrations/vscode" but its description references VS
Code, Cursor, and JetBrains; update this by either (A) changing href to a new
integrations index that aggregates open-vsx.mdx and jetbrains.mdx (create an
integrations landing page and point "IDE Integrations" to it), (B) if you don't
want a landing page, change the description to only mention VS Code to match
href="/docs/arkenv/integrations/vscode", or (C) change href to a multi-target
page that directly documents all three (include/open references to open-vsx.mdx
and jetbrains.mdx); locate the card by the title "IDE Integrations" and the href
"/docs/arkenv/integrations/vscode" to apply the chosen fix.
🧹 Nitpick comments (1)
apps/www/content/docs/arkenv/quickstart.mdx (1)

93-112: Schema in "Use in your code" differs from "Define the schema" step.

The schema defined in this code block (DATABASE_HOST, DATABASE_PORT, NODE_ENV) differs from the schema in Step 3 (LOG_LEVEL, ALLOWED_ORIGINS, FEATURE_FLAGS, API_KEY). This may confuse users following the quickstart sequentially.

Consider using the same schema throughout, or adding a note explaining this is a different example scenario.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b3def59 and b71e26c.

📒 Files selected for processing (4)
  • apps/www/content/docs/arkenv/how-to/load-environment-variables.mdx
  • apps/www/content/docs/arkenv/meta.json
  • apps/www/content/docs/arkenv/quickstart.mdx
  • apps/www/content/docs/arkenv/validator-mode.mdx
✅ Files skipped from review due to trivial changes (1)
  • apps/www/content/docs/arkenv/validator-mode.mdx
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/www/content/docs/arkenv/how-to/load-environment-variables.mdx
🧰 Additional context used
🧠 Learnings (17)
📓 Common learnings
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 : 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: 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/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 : 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} : 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} : Use `createEnv(schema)` function (or default import as `arkenv`) to create validated environment objects in TypeScript
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: .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
Learnt from: yamcodes
Repo: yamcodes/arkenv PR: 498
File: apps/playgrounds/node/index.ts:2-2
Timestamp: 2025-12-05T20:33:10.676Z
Learning: ArkType 2.1.28+ supports Standard Schema specification, allowing interoperability with other Standard Schema-compliant validation libraries (e.g., Zod, Valibot) within the same schema definition
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
📚 Learning: 2025-09-09T17:37:19.650Z
Learnt from: yamcodes
Repo: yamcodes/arkenv PR: 132
File: packages/arkenv/README.md:13-14
Timestamp: 2025-09-09T17:37:19.650Z
Learning: For yamcodes/arkenv project: Runtime support documentation should link to specific examples: Node.js (examples/basic), Bun (examples/with-bun), Vite (examples/with-vite-react-ts).

Applied to files:

  • apps/www/content/docs/arkenv/meta.json
  • apps/www/content/docs/arkenv/quickstart.mdx
📚 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:

  • apps/www/content/docs/arkenv/quickstart.mdx
📚 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/www/content/docs/arkenv/quickstart.mdx
📚 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:

  • apps/www/content/docs/arkenv/quickstart.mdx
📚 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:

  • apps/www/content/docs/arkenv/quickstart.mdx
📚 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:

  • apps/www/content/docs/arkenv/quickstart.mdx
📚 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:

  • apps/www/content/docs/arkenv/quickstart.mdx
📚 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:

  • apps/www/content/docs/arkenv/quickstart.mdx
📚 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:

  • apps/www/content/docs/arkenv/quickstart.mdx
📚 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:

  • apps/www/content/docs/arkenv/quickstart.mdx
📚 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:

  • apps/www/content/docs/arkenv/quickstart.mdx
📚 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:

  • apps/www/content/docs/arkenv/quickstart.mdx
📚 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:

  • apps/www/content/docs/arkenv/quickstart.mdx
📚 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:

  • apps/www/content/docs/arkenv/quickstart.mdx
📚 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:

  • apps/www/content/docs/arkenv/quickstart.mdx
📚 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:

  • apps/www/content/docs/arkenv/quickstart.mdx
⏰ 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)
apps/www/content/docs/arkenv/meta.json (1)

13-13: LGTM!

The new validator-mode documentation entry is correctly placed in the API section and follows the same format as the adjacent coercion entry. This properly exposes the new validator mode documentation to users.

apps/www/content/docs/arkenv/quickstart.mdx (4)

45-45: Good cross-reference to upstream documentation.

Linking to the official ArkType setup guide is appropriate and avoids duplicating documentation.


55-70: Code example correctly demonstrates the new import pattern.

The example properly shows importing type from arkenv/arktype as per the PR's refactoring, and demonstrates various schema patterns including defaults and optional variables.


77-91: Environment variables section is well-aligned with the schema example.

The .env example correctly corresponds to the schema defined in the previous step, and the 12-factor app reference provides valuable context for best practices.


9-25: Installation options are clear with appropriate cross-references.

The accordion structure effectively guides users through both installation paths. The internal link to /docs/arkenv/validator-mode is valid and properly references existing documentation for more details about validator modes.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

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

🤖 Fix all issues with AI agents
In `@apps/www/content/docs/arkenv/quickstart.mdx`:
- Around line 11-23: Add a short clarifying note under the "Install ArkEnv only"
Accordion (the block that shows the `arkenv` install) stating that the rest of
the quickstart uses ArkType-based examples and that if they only install
`arkenv` they must set validator: "standard" in their ArkEnv config to use a
Standard Schema validator; include a link to the Standard Schema guide (or
https://standardschema.dev) for setup instructions so readers can follow the
Standard Schema path instead of ArkType.
♻️ Duplicate comments (1)
apps/www/content/docs/arkenv/quickstart.mdx (1)

125-127: IDE Integrations card still doesn’t match the target page.

The description mentions VS Code, Cursor, and JetBrains but the link targets only the VS Code page. Either narrow the description or point to a multi-IDE landing page.

📝 One possible fix
- description="Get syntax highlighting, ErrorLens, and more for VS Code, Cursor, and JetBrains IDEs"
+ description="Get syntax highlighting, ErrorLens, and more for VS Code"
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b71e26c and 93c4b17.

📒 Files selected for processing (2)
  • apps/www/content/docs/arkenv/index.mdx
  • apps/www/content/docs/arkenv/quickstart.mdx
🧰 Additional context used
🧠 Learnings (17)
📓 Common learnings
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 : 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: 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/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 : 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} : 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} : Use `createEnv(schema)` function (or default import as `arkenv`) to create validated environment objects in TypeScript
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: .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
Learnt from: yamcodes
Repo: yamcodes/arkenv PR: 498
File: apps/playgrounds/node/index.ts:2-2
Timestamp: 2025-12-05T20:33:10.676Z
Learning: ArkType 2.1.28+ supports Standard Schema specification, allowing interoperability with other Standard Schema-compliant validation libraries (e.g., Zod, Valibot) within the same schema definition
📚 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:

  • apps/www/content/docs/arkenv/quickstart.mdx
  • apps/www/content/docs/arkenv/index.mdx
📚 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/www/content/docs/arkenv/quickstart.mdx
  • apps/www/content/docs/arkenv/index.mdx
📚 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:

  • apps/www/content/docs/arkenv/quickstart.mdx
  • apps/www/content/docs/arkenv/index.mdx
📚 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:

  • apps/www/content/docs/arkenv/quickstart.mdx
  • apps/www/content/docs/arkenv/index.mdx
📚 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:

  • apps/www/content/docs/arkenv/quickstart.mdx
📚 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:

  • apps/www/content/docs/arkenv/quickstart.mdx
  • apps/www/content/docs/arkenv/index.mdx
📚 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:

  • apps/www/content/docs/arkenv/quickstart.mdx
📚 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:

  • apps/www/content/docs/arkenv/quickstart.mdx
📚 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:

  • apps/www/content/docs/arkenv/quickstart.mdx
  • apps/www/content/docs/arkenv/index.mdx
📚 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:

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

Applied to files:

  • apps/www/content/docs/arkenv/quickstart.mdx
📚 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:

  • apps/www/content/docs/arkenv/quickstart.mdx
  • apps/www/content/docs/arkenv/index.mdx
📚 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:

  • apps/www/content/docs/arkenv/quickstart.mdx
  • apps/www/content/docs/arkenv/index.mdx
📚 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:

  • apps/www/content/docs/arkenv/quickstart.mdx
  • apps/www/content/docs/arkenv/index.mdx
📚 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:

  • apps/www/content/docs/arkenv/quickstart.mdx
📚 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:

  • apps/www/content/docs/arkenv/quickstart.mdx
⏰ 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 (5)
apps/www/content/docs/arkenv/index.mdx (1)

34-34: Looks good — absolute link improves robustness.

apps/www/content/docs/arkenv/quickstart.mdx (4)

45-45: ArkType setup callout is clear and helpful.

Nice pointer for users who want ArkType’s full feature set.


51-69: Schema section reads clearly with the new ArkType import path.

The example cleanly separates arkenv and arkenv/arktype and matches the new validator-mode framing.


77-85: .env guidance is succinct and accurate.

The sample values align with the schema and the reminder about version control is good.


91-112: Usage example is consistent and easy to follow.

Clear demonstration of typed access to validated variables.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

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

🤖 Fix all issues with AI agents
In `@packages/arkenv/src/arktype/README.md`:
- Around line 16-18: Update the README sentence so the compound modifier is
hyphenated: change the phrase "When `createEnv` is called in ArkType mode (the
default)" to use "ArkType-mode" (e.g., "When `createEnv` is called in
ArkType-mode (the default) ..."). This affects the sentence describing
`createEnv`, `arkenv` and `arktype` behavior; ensure only the modifier is
hyphenated and surrounding text remains unchanged.
🧹 Nitpick comments (8)
packages/arkenv/src/arktype/error.integration.test.ts (5)

25-29: Redundant error name assertions.

Line 25 checks (error as any).name and line 29 checks envError.name for the same value. Since envError is just error as ArkEnvError, these assertions are duplicative.

Consider keeping only the typed assertion after the cast to avoid redundancy while maintaining type safety:

Suggested change
 			} catch (error) {
-				expect((error as any).name).toBe("ArkEnvError");
 				expect(error).toBeInstanceOf(Error);
 
 				const envError = error as ArkEnvError;
 				expect(envError.name).toBe("ArkEnvError");

46-48: Consider adding toBeInstanceOf(Error) check for consistency.

This test case checks (error as any).name but doesn't verify that the error is an instance of Error, unlike the first test case (line 26). Consider adding this assertion for consistency across test cases.


64-66: Redundant error name assertions.

Same pattern as line 25-29: the (error as any).name check on line 64 is redundant with envError.name check on line 66.


81-83: Redundant error name assertions.

Same pattern: lines 81 and 83 both assert the error name.


104-106: Redundant error name assertions.

Same pattern: lines 104 and 106 both assert the error name.

packages/arkenv/src/arktype/coercion/coerce.ts (2)

2-2: Unused import: ArkEnvError

The ArkEnvError import is not used in this file. Consider removing it to avoid confusion.

🧹 Proposed fix
-import { ArkEnvError } from "../../errors.ts";

294-298: Consider typing the at parameter more explicitly.

The at: any parameter loses type safety. Since at is the ArkType type function (imported from arktype or from the scoped root), consider importing the type from arktype or defining a function type interface (e.g., (schema: string | Record<string, any>) => BaseType<unknown, $>) to capture the parameter's callable signature. This would improve type checking at call sites like coerce($.type, ...).

packages/arkenv/src/arktype/index.ts (1)

16-49: Add JSDoc for the public parse API.

This is a public entry point; documenting params/behavior will help consumers and aligns with repo guidelines. As per coding guidelines, add JSDoc for public APIs.

📚 Suggested JSDoc
+/**
+ * Validate environment variables using ArkType schemas.
+ * `@param` def - ArkType schema or compiled type definition.
+ * `@param` config - ArkEnv configuration (env source, coercion, array format, and undeclared key handling).
+ * `@returns` The validated and (optionally) coerced environment object.
+ */
 export function parse<const T extends SchemaShape>(
 	def: EnvSchema<T>,
 	config: ArkEnvConfig,
 ) {
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 57d66e7 and c2e50b0.

📒 Files selected for processing (15)
  • .gitignore
  • packages/arkenv/src/arktype/README.md
  • packages/arkenv/src/arktype/array-defaults.integration.test.ts
  • packages/arkenv/src/arktype/coercion/coerce.test.ts
  • packages/arkenv/src/arktype/coercion/coerce.ts
  • packages/arkenv/src/arktype/coercion/coercion.integration.test.ts
  • packages/arkenv/src/arktype/coercion/index.ts
  • packages/arkenv/src/arktype/coercion/morphs.test.ts
  • packages/arkenv/src/arktype/coercion/morphs.ts
  • packages/arkenv/src/arktype/create-env.test.ts
  • packages/arkenv/src/arktype/custom-types.integration.test.ts
  • packages/arkenv/src/arktype/error.integration.test.ts
  • packages/arkenv/src/arktype/index.ts
  • packages/arkenv/src/arktype/object-parsing.integration.test.ts
  • packages/arkenv/src/arktype/type.test.ts
✅ Files skipped from review due to trivial changes (1)
  • packages/arkenv/src/arktype/type.test.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/arktype/custom-types.integration.test.ts
  • packages/arkenv/src/arktype/coercion/coerce.test.ts
  • packages/arkenv/src/arktype/coercion/coerce.ts
  • packages/arkenv/src/arktype/index.ts
  • packages/arkenv/src/arktype/object-parsing.integration.test.ts
  • packages/arkenv/src/arktype/coercion/coercion.integration.test.ts
  • packages/arkenv/src/arktype/array-defaults.integration.test.ts
  • packages/arkenv/src/arktype/create-env.test.ts
  • packages/arkenv/src/arktype/error.integration.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/arktype/custom-types.integration.test.ts
  • packages/arkenv/src/arktype/coercion/coerce.test.ts
  • packages/arkenv/src/arktype/coercion/coerce.ts
  • packages/arkenv/src/arktype/index.ts
  • packages/arkenv/src/arktype/object-parsing.integration.test.ts
  • packages/arkenv/src/arktype/coercion/coercion.integration.test.ts
  • packages/arkenv/src/arktype/array-defaults.integration.test.ts
  • packages/arkenv/src/arktype/create-env.test.ts
  • packages/arkenv/src/arktype/error.integration.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/arktype/custom-types.integration.test.ts
  • packages/arkenv/src/arktype/coercion/coerce.test.ts
  • packages/arkenv/src/arktype/object-parsing.integration.test.ts
  • packages/arkenv/src/arktype/coercion/coercion.integration.test.ts
  • packages/arkenv/src/arktype/array-defaults.integration.test.ts
  • packages/arkenv/src/arktype/create-env.test.ts
  • packages/arkenv/src/arktype/error.integration.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/arktype/custom-types.integration.test.ts
  • packages/arkenv/src/arktype/object-parsing.integration.test.ts
  • packages/arkenv/src/arktype/coercion/coercion.integration.test.ts
  • packages/arkenv/src/arktype/array-defaults.integration.test.ts
  • packages/arkenv/src/arktype/error.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/arktype/custom-types.integration.test.ts
  • packages/arkenv/src/arktype/coercion/coerce.test.ts
  • packages/arkenv/src/arktype/object-parsing.integration.test.ts
  • packages/arkenv/src/arktype/coercion/coercion.integration.test.ts
  • packages/arkenv/src/arktype/array-defaults.integration.test.ts
  • packages/arkenv/src/arktype/create-env.test.ts
  • packages/arkenv/src/arktype/error.integration.test.ts
**/index.ts

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

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

Files:

  • packages/arkenv/src/arktype/index.ts
🧠 Learnings (32)
📓 Common learnings
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 : 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: .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: 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/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: .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} : 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: .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
Learnt from: yamcodes
Repo: yamcodes/arkenv PR: 498
File: apps/playgrounds/node/index.ts:2-2
Timestamp: 2025-12-05T20:33:10.676Z
Learning: ArkType 2.1.28+ supports Standard Schema specification, allowing interoperability with other Standard Schema-compliant validation libraries (e.g., Zod, Valibot) within the same schema definition
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
📚 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/arktype/custom-types.integration.test.ts
  • packages/arkenv/src/arktype/coercion/coerce.test.ts
  • packages/arkenv/src/arktype/coercion/coerce.ts
  • packages/arkenv/src/arktype/index.ts
  • packages/arkenv/src/arktype/object-parsing.integration.test.ts
  • packages/arkenv/src/arktype/coercion/coercion.integration.test.ts
  • packages/arkenv/src/arktype/array-defaults.integration.test.ts
  • packages/arkenv/src/arktype/create-env.test.ts
  • packages/arkenv/src/arktype/error.integration.test.ts
  • packages/arkenv/src/arktype/README.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 **/*.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/arktype/custom-types.integration.test.ts
  • packages/arkenv/src/arktype/coercion/coercion.integration.test.ts
  • packages/arkenv/src/arktype/error.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/arktype/custom-types.integration.test.ts
  • packages/arkenv/src/arktype/coercion/coerce.test.ts
  • packages/arkenv/src/arktype/coercion/coerce.ts
  • packages/arkenv/src/arktype/index.ts
  • packages/arkenv/src/arktype/object-parsing.integration.test.ts
  • packages/arkenv/src/arktype/coercion/coercion.integration.test.ts
  • packages/arkenv/src/arktype/array-defaults.integration.test.ts
  • packages/arkenv/src/arktype/create-env.test.ts
  • packages/arkenv/src/arktype/error.integration.test.ts
  • packages/arkenv/src/arktype/README.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 : Keep environment variable schemas readable and TypeScript-like using ArkType syntax

Applied to files:

  • packages/arkenv/src/arktype/custom-types.integration.test.ts
  • packages/arkenv/src/arktype/coercion/coerce.test.ts
  • packages/arkenv/src/arktype/coercion/coerce.ts
  • packages/arkenv/src/arktype/index.ts
  • packages/arkenv/src/arktype/object-parsing.integration.test.ts
  • packages/arkenv/src/arktype/coercion/coercion.integration.test.ts
  • packages/arkenv/src/arktype/array-defaults.integration.test.ts
  • packages/arkenv/src/arktype/create-env.test.ts
  • packages/arkenv/src/arktype/error.integration.test.ts
  • packages/arkenv/src/arktype/README.md
📚 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/arktype/custom-types.integration.test.ts
  • packages/arkenv/src/arktype/coercion/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 : Leverage ArkType's built-in types (e.g., `string.host`, `number.port`) where possible in environment schemas

Applied to files:

  • packages/arkenv/src/arktype/custom-types.integration.test.ts
  • packages/arkenv/src/arktype/coercion/coerce.test.ts
  • packages/arkenv/src/arktype/coercion/coerce.ts
  • packages/arkenv/src/arktype/index.ts
  • packages/arkenv/src/arktype/object-parsing.integration.test.ts
  • packages/arkenv/src/arktype/coercion/coercion.integration.test.ts
  • packages/arkenv/src/arktype/array-defaults.integration.test.ts
  • packages/arkenv/src/arktype/create-env.test.ts
  • packages/arkenv/src/arktype/error.integration.test.ts
  • packages/arkenv/src/arktype/README.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:

  • packages/arkenv/src/arktype/custom-types.integration.test.ts
  • packages/arkenv/src/arktype/coercion/coerce.test.ts
  • packages/arkenv/src/arktype/coercion/coerce.ts
  • packages/arkenv/src/arktype/index.ts
  • packages/arkenv/src/arktype/object-parsing.integration.test.ts
  • packages/arkenv/src/arktype/coercion/coercion.integration.test.ts
  • packages/arkenv/src/arktype/array-defaults.integration.test.ts
  • packages/arkenv/src/arktype/create-env.test.ts
  • packages/arkenv/src/arktype/error.integration.test.ts
  • packages/arkenv/src/arktype/README.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 the scoped `$` type system for custom types defined in `scope.ts`

Applied to files:

  • packages/arkenv/src/arktype/custom-types.integration.test.ts
  • packages/arkenv/src/arktype/coercion/coerce.test.ts
  • packages/arkenv/src/arktype/coercion/coerce.ts
  • packages/arkenv/src/arktype/index.ts
  • packages/arkenv/src/arktype/array-defaults.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 : Use ArkType's `type()` function to define schemas in environment variable definitions

Applied to files:

  • packages/arkenv/src/arktype/custom-types.integration.test.ts
  • packages/arkenv/src/arktype/coercion/coerce.test.ts
  • packages/arkenv/src/arktype/coercion/coerce.ts
  • packages/arkenv/src/arktype/index.ts
  • packages/arkenv/src/arktype/object-parsing.integration.test.ts
  • packages/arkenv/src/arktype/coercion/coercion.integration.test.ts
  • packages/arkenv/src/arktype/array-defaults.integration.test.ts
  • packages/arkenv/src/arktype/create-env.test.ts
  • packages/arkenv/src/arktype/README.md
📚 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/arktype/custom-types.integration.test.ts
  • packages/arkenv/src/arktype/coercion/coercion.integration.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/arktype/custom-types.integration.test.ts
  • packages/arkenv/src/arktype/object-parsing.integration.test.ts
  • packages/arkenv/src/arktype/coercion/coercion.integration.test.ts
  • packages/arkenv/src/arktype/array-defaults.integration.test.ts
  • packages/arkenv/src/arktype/create-env.test.ts
  • packages/arkenv/src/arktype/error.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/arktype/custom-types.integration.test.ts
  • packages/arkenv/src/arktype/object-parsing.integration.test.ts
  • packages/arkenv/src/arktype/coercion/coercion.integration.test.ts
  • packages/arkenv/src/arktype/array-defaults.integration.test.ts
  • packages/arkenv/src/arktype/create-env.test.ts
  • packages/arkenv/src/arktype/error.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} : Use Vitest for unit and integration tests

Applied to files:

  • packages/arkenv/src/arktype/custom-types.integration.test.ts
  • packages/arkenv/src/arktype/object-parsing.integration.test.ts
  • packages/arkenv/src/arktype/coercion/coercion.integration.test.ts
  • packages/arkenv/src/arktype/create-env.test.ts
  • packages/arkenv/src/arktype/error.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} : Mock `process.env` in unit tests to test different environment variable scenarios

Applied to files:

  • packages/arkenv/src/arktype/custom-types.integration.test.ts
  • packages/arkenv/src/arktype/object-parsing.integration.test.ts
  • packages/arkenv/src/arktype/coercion/coercion.integration.test.ts
  • packages/arkenv/src/arktype/create-env.test.ts
  • packages/arkenv/src/arktype/error.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/arktype/custom-types.integration.test.ts
  • packages/arkenv/src/arktype/object-parsing.integration.test.ts
  • packages/arkenv/src/arktype/coercion/coercion.integration.test.ts
  • packages/arkenv/src/arktype/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/arktype/custom-types.integration.test.ts
  • packages/arkenv/src/arktype/coercion/coerce.test.ts
  • packages/arkenv/src/arktype/coercion/coerce.ts
  • packages/arkenv/src/arktype/index.ts
  • packages/arkenv/src/arktype/object-parsing.integration.test.ts
  • packages/arkenv/src/arktype/coercion/coercion.integration.test.ts
  • packages/arkenv/src/arktype/array-defaults.integration.test.ts
  • packages/arkenv/src/arktype/create-env.test.ts
  • packages/arkenv/src/arktype/error.integration.test.ts
  • packages/arkenv/src/arktype/README.md
📚 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 : Use fixture-based testing pattern for Vite plugin tests by placing fixtures in __fixtures__ directory

Applied to files:

  • packages/arkenv/src/arktype/custom-types.integration.test.ts
  • packages/arkenv/src/arktype/object-parsing.integration.test.ts
  • packages/arkenv/src/arktype/create-env.test.ts
  • packages/arkenv/src/arktype/error.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 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/arktype/custom-types.integration.test.ts
  • packages/arkenv/src/arktype/object-parsing.integration.test.ts
  • packages/arkenv/src/arktype/coercion/coercion.integration.test.ts
  • packages/arkenv/src/arktype/create-env.test.ts
📚 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/**/*.test.{ts,tsx,js,jsx} : Use `bun:test` for unit and integration testing with `test` and `expect` from the built-in test module

Applied to files:

  • packages/arkenv/src/arktype/custom-types.integration.test.ts
  • packages/arkenv/src/arktype/object-parsing.integration.test.ts
  • packages/arkenv/src/arktype/coercion/coercion.integration.test.ts
  • packages/arkenv/src/arktype/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 **/*.test.{ts,tsx} : Use beforeEach/afterEach for cleanup, not beforeAll/afterAll when possible

Applied to files:

  • packages/arkenv/src/arktype/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/arktype/coercion/coerce.test.ts
  • packages/arkenv/src/arktype/coercion/coerce.ts
  • packages/arkenv/src/arktype/index.ts
  • packages/arkenv/src/arktype/object-parsing.integration.test.ts
  • packages/arkenv/src/arktype/coercion/coercion.integration.test.ts
  • packages/arkenv/src/arktype/create-env.test.ts
  • packages/arkenv/src/arktype/error.integration.test.ts
  • packages/arkenv/src/arktype/README.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/scope.ts : Define custom types in `scope.ts` using ArkType's scoped type system for reusability across schemas

Applied to files:

  • packages/arkenv/src/arktype/coercion/coerce.test.ts
  • packages/arkenv/src/arktype/coercion/coerce.ts
  • packages/arkenv/src/arktype/index.ts
  • packages/arkenv/src/arktype/README.md
📚 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/arktype/coercion/coerce.test.ts
  • packages/arkenv/src/arktype/coercion/coercion.integration.test.ts
  • packages/arkenv/src/arktype/create-env.test.ts
  • packages/arkenv/src/arktype/error.integration.test.ts
  • packages/arkenv/src/arktype/README.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 built-in validators (host, port, url, email) from ArkEnv when available instead of custom ArkType schemas

Applied to files:

  • packages/arkenv/src/arktype/coercion/coerce.test.ts
  • packages/arkenv/src/arktype/coercion/coerce.ts
  • packages/arkenv/src/arktype/coercion/coercion.integration.test.ts
  • packages/arkenv/src/arktype/create-env.test.ts
  • packages/arkenv/src/arktype/README.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: ArkType validates environment variables at runtime and TypeScript types are inferred from the schema definition

Applied to files:

  • packages/arkenv/src/arktype/coercion/coerce.test.ts
  • packages/arkenv/src/arktype/coercion/coerce.ts
  • packages/arkenv/src/arktype/index.ts
  • packages/arkenv/src/arktype/create-env.test.ts
  • packages/arkenv/src/arktype/README.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:

  • packages/arkenv/src/arktype/object-parsing.integration.test.ts
  • packages/arkenv/src/arktype/array-defaults.integration.test.ts
  • packages/arkenv/src/arktype/create-env.test.ts
  • packages/arkenv/src/arktype/error.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 PascalCase for type names (e.g., `ArkEnvError`)

Applied to files:

  • packages/arkenv/src/arktype/object-parsing.integration.test.ts
  • packages/arkenv/src/arktype/create-env.test.ts
  • packages/arkenv/src/arktype/error.integration.test.ts
📚 Learning: 2025-11-24T16:04:58.629Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.629Z
Learning: Applies to apps/playgrounds/bun/**/*.test.{ts,tsx,js,jsx} : Use `import { test, expect } from "bun:test"` for writing tests

Applied to files:

  • packages/arkenv/src/arktype/object-parsing.integration.test.ts
  • packages/arkenv/src/arktype/create-env.test.ts
  • packages/arkenv/src/arktype/error.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/arktype/coercion/coercion.integration.test.ts
  • packages/arkenv/src/arktype/create-env.test.ts
  • packages/arkenv/src/arktype/error.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/arktype/array-defaults.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/arktype/array-defaults.integration.test.ts
  • packages/arkenv/src/arktype/error.integration.test.ts
  • packages/arkenv/src/arktype/README.md
🧬 Code graph analysis (2)
packages/arkenv/src/arktype/coercion/coercion.integration.test.ts (1)
packages/arkenv/src/arktype/index.ts (1)
  • type (14-14)
packages/arkenv/src/arktype/create-env.test.ts (1)
packages/arkenv/src/arktype/index.ts (1)
  • type (14-14)
🪛 LanguageTool
packages/arkenv/src/arktype/README.md

[grammar] ~17-~17: Use a hyphen to join words.
Context: ...out arktype (e.g., for Standard Schema only projects). 2. arktype is only loa...

(QB_NEW_EN_HYPHEN)

⏰ 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 (14)
.gitignore (1)

49-49: LGTM! Essential change for the new arktype module structure.

The change from arktype/ to /arktype/ correctly restricts the ignore pattern to the repository root. This prevents unintentionally ignoring the new arkenv/arktype module directories introduced in this PR while still ignoring the root-level ArkType clone used for development.

packages/arkenv/src/arktype/error.integration.test.ts (3)

10-144: Test structure and coverage look good.

The integration tests properly:

  • Use vi.stubEnv to mock environment variables
  • Test various error scenarios (invalid type, invalid host, invalid boolean, missing required, multiple errors)
  • Verify error formatting with indentation
  • Clean up with afterEach

The test cases comprehensively cover ArkEnvError propagation through the createEnv + type stack.


165-182: Good coverage of custom type error propagation.

This test verifies that errors from ArkType's built-in validators (string.host, number.port) are correctly formatted and included in the ArkEnvError message. This aligns with the coding guidelines to use ArkType's built-in types where possible.


2-4: No issues found. Explicit .ts extensions in imports are a consistent pattern throughout the packages/arkenv test files, indicating this is a deliberate choice supported by the project's build and test tooling. This pattern appears specific to the packages/arkenv package and does not warrant a review comment.

packages/arkenv/src/arktype/coercion/coerce.ts (1)

303-320: LGTM on the coercion pipeline refactor.

The change from type("unknown") to at("unknown") correctly enables dynamic ArkType loading by accepting the type constructor as a parameter. The casts to any are necessary workarounds for scope mismatches when the arktype module is loaded dynamically from different resolution paths.

packages/arkenv/src/arktype/coercion/coerce.test.ts (1)

6-13: Tests correctly updated to new signature.

All test cases consistently updated from coerce(schema) to coerce(type, schema), matching the new function signature. The test coverage remains comprehensive.

packages/arkenv/src/arktype/object-parsing.integration.test.ts (1)

2-3: Import paths updated correctly.

The import paths now use explicit .ts extensions and adjusted relative paths, consistent with the PR's module reorganization where createEnv is in the parent directory and type is exported from the arktype module index.

packages/arkenv/src/arktype/custom-types.integration.test.ts (1)

2-3: Import paths correctly adjusted.

The imports now reference ../create-env.ts and ./index.ts with explicit extensions, aligning with the PR's module reorganization. Based on learnings, these tests properly leverage ArkType's built-in types (string.host, number.port).

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

2-3: Import paths updated consistently.

The imports now use explicit .ts extensions: ../index.ts for the default arkenv export and ./index.ts for the type function. This aligns with the PR's module reorganization separating core ArkEnv from ArkType-specific exports.

packages/arkenv/src/arktype/coercion/coercion.integration.test.ts (2)

2-3: Explicit module extensions look good.

This aligns well with explicit ESM-style resolution and the repo-wide import updates.


130-132: Typed pipe callback is a nice safety boost.

The explicit str: string annotation avoids implicit-any and keeps the morph chain strict.

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

2-4: Import path updates are consistent with the new module layout.

Nice to see explicit extensions and centralized utils imports.


85-87: Explicit callback typing is solid.

Keeps the morph pipeline type-safe under stricter TS settings.

packages/arkenv/src/arktype/index.ts (1)

11-15: Clean, centralized type re-export.

Keeps ArkType surface consistent via the scoped root.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@yamcodes yamcodes merged commit 6bd0741 into main Jan 16, 2026
17 of 18 checks passed
@yamcodes yamcodes deleted the 722-make-arktype-optional-and-use-standard-schema-directly branch January 16, 2026 16:59
@arkenv-bot arkenv-bot bot mentioned this pull request Jan 16, 2026
yamcodes pushed a commit that referenced this pull request Jan 16, 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.9.0

### Minor Changes

- #### ArkType is now an optional peer dependency
_[`#723`](#723)
[`6bd0741`](6bd0741)
[@yamcodes](https://github.com/yamcodes)_

To achieve a true zero-dependency core, ArkType is now an optional peer
dependency.

- **Breaking Change**: The `type` export has been moved from the main
`arkenv` entry point to `arkenv/arktype`.

    ```ts
    // ❌ Before
    import { type } from "arkenv";

    // ✅ After
    import { type } from "arkenv/arktype";
    ```

- **Explicit Validator Modes**: ArkEnv now supports an explicit
`validator` option.

- **`validator: "arktype"` (default)**: Uses ArkType for validation and
coercion. Requires `arktype` to be installed.
- **`validator: "standard"`**: Uses Standard Schema validators directly
(e.g., Zod, Valibot). Works without ArkType.

Existing usage of `arkenv()` remains unchanged when ArkType is
installed. Projects using ArkType features must now explicitly install
`arktype` and import ArkType-land helpers from `arkenv/arktype`.

### Patch Changes

- #### Remove internal `@repo/keywords` package
_[`#726`](#726)
[`926ef9b`](926ef9b)
[@yamcodes](https://github.com/yamcodes)_

The internal `@repo/keywords` package, which was compiled into the
`arkenv` package, has been removed. The keywords are now either defined
directly in the `arkenv` package or changed to pure functions.

This change was made to simplify the package structure for the validator
mode.

## @arkenv/bun-plugin@0.0.9

### Patch Changes

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

<small>


[`6bd0741`](6bd0741)
[`926ef9b`](926ef9b)

</small>

-   `arkenv@0.9.0`

</details>

## @arkenv/vite-plugin@0.0.27

### Patch Changes

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

<small>


[`6bd0741`](6bd0741)
[`926ef9b`](926ef9b)

</small>

-   `arkenv@0.9.0`

</details>

## @repo/scope@0.1.3

### Patch Changes

- #### Remove internal `@repo/keywords` package
_[`#726`](#726)
[`926ef9b`](926ef9b)
[@yamcodes](https://github.com/yamcodes)_

The internal `@repo/keywords` package, which was compiled into the
`arkenv` package, has been removed. The keywords are now either defined
directly in the `arkenv` package or changed to pure functions.

This change was made to simplify the package structure for the validator
mode.

## @repo/types@0.0.7

### Patch Changes

- #### Added Standard Schema, helpers
_[`#723`](#723)
[`6bd0741`](6bd0741)
[@yamcodes](https://github.com/yamcodes)_

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

<small>


[`926ef9b`](926ef9b)

</small>

-   `@repo/scope@0.1.3`

</details>

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@coderabbitai coderabbitai bot mentioned this pull request Jan 21, 2026
renovate bot added a commit that referenced this pull request Jan 23, 2026
This PR contains the following updates:

| Package | Change |
[Age](https://docs.renovatebot.com/merge-confidence/) |
[Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [arkenv](https://arkenv.js.org)
([source](https://redirect.github.com/yamcodes/arkenv)) | [`^0.8.0` →
`^0.9.0`](https://renovatebot.com/diffs/npm/arkenv/0.8.3/0.9.0) |
![age](https://developer.mend.io/api/mc/badges/age/npm/arkenv/0.9.0?slim=true)
|
![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/arkenv/0.8.3/0.9.0?slim=true)
|

---

### Release Notes

<details>
<summary>yamcodes/arkenv (arkenv)</summary>

###
[`v0.9.0`](https://redirect.github.com/yamcodes/arkenv/releases/tag/arkenv%400.9.0)

[Compare
Source](https://redirect.github.com/yamcodes/arkenv/compare/arkenv@0.8.3...arkenv@0.9.0)

##### Minor Changes

- #### ArkType is now an optional peer dependency
*[`#723`](https://redirect.github.com/yamcodes/arkenv/pull/723)
[`6bd0741`](https://redirect.github.com/yamcodes/arkenv/commit/6bd07410f97a8756366b9432be8504a8507d0876)
[@&#8203;yamcodes](https://redirect.github.com/yamcodes)*

To achieve a true zero-dependency core, ArkType is now an optional peer
dependency.

- **Breaking Change**: The `type` export has been moved from the main
`arkenv` entry point to `arkenv/arktype`.

  ```ts
  // ❌ Before
  import { type } from "arkenv";

  // ✅ After
  import { type } from "arkenv/arktype";
  ```

- **Explicit Validator Modes**: ArkEnv now supports an explicit
`validator` option.

- **`validator: "arktype"` (default)**: Uses ArkType for validation and
coercion. Requires `arktype` to be installed.
- **`validator: "standard"`**: Uses Standard Schema validators directly
(e.g., Zod, Valibot). Works without ArkType.

Existing usage of `arkenv()` remains unchanged when ArkType is
installed. Projects using ArkType features must now explicitly install
`arktype` and import ArkType-land helpers from `arkenv/arktype`.

##### Patch Changes

- #### Remove internal `@repo/keywords` package
*[`#726`](https://redirect.github.com/yamcodes/arkenv/pull/726)
[`926ef9b`](https://redirect.github.com/yamcodes/arkenv/commit/926ef9b5a322187feef7fce3a842b04d5ec197fa)
[@&#8203;yamcodes](https://redirect.github.com/yamcodes)*

The internal `@repo/keywords` package, which was compiled into the
`arkenv` package, has been removed. The keywords are now either defined
directly in the `arkenv` package or changed to pure functions.

This change was made to simplify the package structure for the validator
mode.

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "on friday" in timezone Asia/Almaty,
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/yamcodes/arkenv).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi45Mi4xIiwidXBkYXRlZEluVmVyIjoiNDIuOTIuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[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/vite-plugin Issues or Pull Requests involving the Vite plugin for ArkEnv 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 www Improvements or additions to arkenv.js.org

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Validator mode (make ArkType optional, support Standard Schema directly)

1 participant