Conversation
- 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 detectedLatest commit: 288df49 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
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 |
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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. ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (5)
WalkthroughArkEnv 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
Sequence DiagramsequenceDiagram
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
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related issues
Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ 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. Comment |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…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.
- Add `validator` option to `createEnv` function - Support `arktype` (default) and `standard` validation modes - Lazily load Ark
commit: |
📦 Bundle Size Report
✅ All size limits passed! |
…Type scope, and enhance error handling.
…e their formatting within `ArkEnvError`.
…including API changes, dispatcher refactoring, and ArkType type handling.
…prove startup performance.
…nfigurations and documentation.
There was a problem hiding this comment.
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.numericandboolean), 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
⛔ Files ignored due to path filters (2)
examples/without-arktype/package-lock.jsonis excluded by!**/package-lock.jsonpnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (49)
.changeset/every-tips-shout.md.changeset/tender-books-shout.mdapps/playgrounds/bun-react/src/env.tsapps/playgrounds/solid-start/README.mdapps/playgrounds/solid-start/app.config.tsapps/playgrounds/vite-legacy/vite.config.tsapps/playgrounds/vite/README.mdapps/playgrounds/vite/vite.config.tsapps/www/content/docs/arkenv/coercion.mdxapps/www/content/docs/arkenv/how-to/load-environment-variables.mdxapps/www/content/docs/arkenv/how-to/reuse-schemas.mdxapps/www/content/docs/arkenv/integrations/standard-schema.mdxapps/www/content/docs/arkenv/quickstart.mdxapps/www/content/docs/bun-plugin/index.mdxapps/www/content/docs/vite-plugin/arkenv-in-viteconfig.mdxapps/www/content/docs/vite-plugin/typing-import-meta-env.mdxapps/www/package.jsonapps/www/source.config.tsexamples/without-arktype/package.jsonexamples/without-arktype/src/index.tspackages/arkenv/package.jsonpackages/arkenv/src/array-defaults.integration.test.tspackages/arkenv/src/coercion/coerce.test.tspackages/arkenv/src/coercion/coerce.tspackages/arkenv/src/coercion/coercion.integration.test.tspackages/arkenv/src/coercion/index.tspackages/arkenv/src/coercion/morphs.test.tspackages/arkenv/src/coercion/morphs.tspackages/arkenv/src/create-env.test.tspackages/arkenv/src/create-env.tspackages/arkenv/src/custom-types.integration.test.tspackages/arkenv/src/error.integration.test.tspackages/arkenv/src/errors.tspackages/arkenv/src/index.tspackages/arkenv/src/isolation.test.tspackages/arkenv/src/object-parsing.integration.test.tspackages/arkenv/src/parse-standard.tspackages/arkenv/src/type.test.tspackages/arkenv/src/type.tspackages/arkenv/src/utils/index.tspackages/arkenv/src/utils/load-arktype.test.tspackages/arkenv/src/utils/load-arktype.tspackages/arkenv/tsconfig.jsonpackages/arkenv/tsdown.config.tspackages/internal/types/src/index.tspackages/vite-plugin/package.jsonpackages/vite-plugin/src/__fixtures__/basic/config.tspackages/vite-plugin/src/__fixtures__/with-env-dir/config.tspackages/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'stype()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 inscope.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 toArkEnvErrorfor user-friendly error messages that include variable name and expected type
Files:
packages/arkenv/src/utils/load-arktype.tspackages/arkenv/src/errors.tspackages/arkenv/src/isolation.test.tspackages/arkenv/src/utils/load-arktype.test.tspackages/arkenv/src/create-env.tspackages/arkenv/src/index.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/coding-guidelines.mdc)
**/*.{ts,tsx}: Prefertypeoverinterfacefor type definitions in TypeScript
Use TypeScript 5.1+ features when appropriate
Leverageconsttype 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 (noInferrableTypeserror)
Useas constwhere appropriate for immutable values (useAsConstAssertionerror)
Don't reassign function parameters (noParameterAssignerror)
Place default parameters last in function signatures (useDefaultParameterLasterror)
Always initialize enum values (useEnumInitializerserror)
Declare one variable per statement (useSingleVarDeclaratorerror)
Avoid unnecessary template literals (noUnusedTemplateLiteralerror)
PreferNumber.parseIntover globalparseInt(useNumberNamespaceerror)
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
UseArkEnvErrorfor environment variable validation errors
Provide clear, actionable error messages that include the variable name and expected type
**/*.{ts,tsx}: UsecreateEnv(schema)function (or default import asarkenv) 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.tspackages/arkenv/src/errors.tsapps/www/source.config.tspackages/vite-plugin/vitest.config.tspackages/arkenv/src/isolation.test.tspackages/arkenv/src/utils/load-arktype.test.tsapps/playgrounds/solid-start/app.config.tsapps/playgrounds/bun-react/src/env.tspackages/arkenv/src/create-env.tspackages/internal/types/src/index.tsapps/playgrounds/vite/vite.config.tsapps/playgrounds/vite-legacy/vite.config.tspackages/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.jsonpackages/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.jsonapps/www/package.jsonpackages/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.jsonapps/www/package.jsonpackages/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.tsxnext toComponent.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.tsor.test.tsxsuffix located alongside source files, testing individual functions and components in isolation with mocked dependencies
Files:
packages/arkenv/src/isolation.test.tspackages/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'sdescribe/itstructure for all test files
Test both success and failure cases in unit and integration tests
Mockprocess.envin unit tests to test different environment variable scenarios
Files:
packages/arkenv/src/isolation.test.tspackages/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}: Usebun <file>instead ofnode <file>orts-node <file>for running TypeScript and JavaScript files
Bun automatically loads .env files, so don't use the dotenv package
UseBun.serve()with built-in WebSocket, HTTPS, and route support instead ofexpress
Usebun:sqlitefor SQLite database operations instead ofbetter-sqlite3
UseBun.redisfor Redis operations instead ofioredis
UseBun.sqlfor Postgres database operations instead ofpgorpostgres.js
Use built-inWebSocketinstead of thewspackage
PreferBun.fileovernode:fsreadFile/writeFile methods for file operations
UseBun.$template literal syntax for shell commands instead ofexeca
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 ofwebpackoresbuildfor 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 --hotto 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.tspackages/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.mdxpackages/arkenv/src/utils/load-arktype.tspackages/vite-plugin/package.jsonpackages/arkenv/src/errors.tsapps/www/source.config.tspackages/arkenv/tsconfig.jsonapps/www/content/docs/arkenv/how-to/load-environment-variables.mdxpackages/vite-plugin/vitest.config.tspackages/arkenv/src/isolation.test.tspackages/arkenv/src/utils/load-arktype.test.tsapps/playgrounds/vite/README.mdpackages/arkenv/package.jsonapps/playgrounds/solid-start/README.mdapps/www/content/docs/arkenv/integrations/standard-schema.mdxapps/www/content/docs/bun-plugin/index.mdxapps/www/content/docs/vite-plugin/arkenv-in-viteconfig.mdxapps/playgrounds/solid-start/app.config.tsapps/playgrounds/bun-react/src/env.tspackages/arkenv/src/create-env.tspackages/internal/types/src/index.tsapps/playgrounds/vite/vite.config.tsapps/playgrounds/vite-legacy/vite.config.tsapps/www/content/docs/arkenv/how-to/reuse-schemas.mdx.changeset/every-tips-shout.mdpackages/arkenv/src/index.tsapps/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.mdxpackages/arkenv/src/utils/load-arktype.tspackages/arkenv/src/errors.tsapps/www/source.config.tsapps/www/content/docs/arkenv/how-to/load-environment-variables.mdxpackages/vite-plugin/vitest.config.tspackages/arkenv/src/isolation.test.tspackages/arkenv/src/utils/load-arktype.test.tsapps/playgrounds/vite/README.mdpackages/arkenv/package.jsonapps/playgrounds/solid-start/README.mdapps/www/content/docs/arkenv/integrations/standard-schema.mdxapps/www/content/docs/bun-plugin/index.mdxapps/www/content/docs/vite-plugin/arkenv-in-viteconfig.mdxapps/playgrounds/solid-start/app.config.tsapps/playgrounds/bun-react/src/env.tspackages/arkenv/src/create-env.tspackages/internal/types/src/index.tsapps/playgrounds/vite/vite.config.tsapps/playgrounds/vite-legacy/vite.config.tsapps/www/content/docs/arkenv/how-to/reuse-schemas.mdx.changeset/every-tips-shout.mdpackages/arkenv/src/index.tsapps/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.mdxpackages/arkenv/src/utils/load-arktype.tspackages/arkenv/src/errors.tsapps/www/source.config.tspackages/arkenv/tsconfig.jsonapps/www/content/docs/arkenv/how-to/load-environment-variables.mdxpackages/arkenv/src/isolation.test.tspackages/arkenv/src/utils/load-arktype.test.tsapps/playgrounds/vite/README.mdpackages/arkenv/package.jsonapps/playgrounds/solid-start/README.mdapps/www/content/docs/arkenv/integrations/standard-schema.mdxapps/www/content/docs/bun-plugin/index.mdxapps/www/content/docs/vite-plugin/arkenv-in-viteconfig.mdxapps/playgrounds/solid-start/app.config.tsapps/playgrounds/bun-react/src/env.tspackages/arkenv/src/create-env.tspackages/internal/types/src/index.tsapps/playgrounds/vite/vite.config.tsapps/playgrounds/vite-legacy/vite.config.tsapps/www/content/docs/arkenv/how-to/reuse-schemas.mdxpackages/arkenv/src/index.tsapps/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.mdxpackages/arkenv/src/utils/load-arktype.tspackages/arkenv/src/errors.tsapps/www/content/docs/arkenv/how-to/load-environment-variables.mdxpackages/arkenv/src/isolation.test.tspackages/arkenv/src/utils/load-arktype.test.tsapps/playgrounds/vite/README.mdpackages/arkenv/package.jsonapps/playgrounds/solid-start/README.mdapps/www/content/docs/bun-plugin/index.mdxapps/www/content/docs/vite-plugin/arkenv-in-viteconfig.mdxapps/playgrounds/solid-start/app.config.tsapps/playgrounds/bun-react/src/env.tspackages/arkenv/src/create-env.tspackages/internal/types/src/index.tsapps/playgrounds/vite/vite.config.tsapps/playgrounds/vite-legacy/vite.config.tsapps/www/content/docs/arkenv/how-to/reuse-schemas.mdx.changeset/every-tips-shout.mdpackages/arkenv/src/index.tsapps/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.mdxpackages/vite-plugin/package.jsonpackages/arkenv/src/errors.tsapps/www/source.config.tspackages/arkenv/tsconfig.jsonapps/www/content/docs/arkenv/how-to/load-environment-variables.mdxpackages/vite-plugin/vitest.config.tsapps/playgrounds/vite/README.mdpackages/arkenv/package.jsonapps/playgrounds/solid-start/README.mdapps/www/content/docs/arkenv/integrations/standard-schema.mdxapps/www/content/docs/bun-plugin/index.mdxapps/www/content/docs/vite-plugin/arkenv-in-viteconfig.mdxapps/playgrounds/solid-start/app.config.tsapps/playgrounds/bun-react/src/env.tspackages/arkenv/src/create-env.tspackages/internal/types/src/index.tsapps/playgrounds/vite/vite.config.tsapps/www/content/docs/arkenv/how-to/reuse-schemas.mdx.changeset/every-tips-shout.mdpackages/arkenv/src/index.tsapps/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.mdxpackages/arkenv/src/utils/load-arktype.tspackages/arkenv/src/errors.tsapps/www/source.config.tspackages/arkenv/tsconfig.jsonapps/www/content/docs/arkenv/how-to/load-environment-variables.mdxpackages/vite-plugin/vitest.config.tspackages/arkenv/src/isolation.test.tspackages/arkenv/src/utils/load-arktype.test.tsapps/playgrounds/vite/README.mdpackages/arkenv/package.jsonapps/playgrounds/solid-start/README.mdapps/www/content/docs/arkenv/integrations/standard-schema.mdxapps/www/content/docs/bun-plugin/index.mdxapps/www/content/docs/vite-plugin/arkenv-in-viteconfig.mdxapps/playgrounds/solid-start/app.config.tsapps/playgrounds/bun-react/src/env.tspackages/arkenv/src/create-env.tspackages/internal/types/src/index.tsapps/playgrounds/vite/vite.config.tsapps/playgrounds/vite-legacy/vite.config.tsapps/www/content/docs/arkenv/how-to/reuse-schemas.mdx.changeset/every-tips-shout.mdpackages/arkenv/src/index.tsapps/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.mdxpackages/arkenv/src/utils/load-arktype.tspackages/arkenv/src/errors.tsapps/www/source.config.tspackages/arkenv/tsconfig.jsonpackages/vite-plugin/vitest.config.tspackages/arkenv/src/utils/load-arktype.test.tsapps/playgrounds/vite/README.mdpackages/arkenv/package.jsonapps/playgrounds/solid-start/README.mdapps/www/content/docs/bun-plugin/index.mdxapps/www/content/docs/vite-plugin/arkenv-in-viteconfig.mdxapps/playgrounds/solid-start/app.config.tsapps/playgrounds/bun-react/src/env.tspackages/arkenv/src/create-env.tspackages/internal/types/src/index.tsapps/playgrounds/vite/vite.config.tsapps/playgrounds/vite-legacy/vite.config.tsapps/www/content/docs/arkenv/how-to/reuse-schemas.mdx.changeset/every-tips-shout.mdpackages/arkenv/src/index.tsapps/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.mdxpackages/arkenv/src/errors.tspackages/arkenv/tsconfig.jsonapps/www/content/docs/arkenv/how-to/load-environment-variables.mdxapps/www/content/docs/bun-plugin/index.mdxapps/www/content/docs/vite-plugin/arkenv-in-viteconfig.mdxapps/playgrounds/solid-start/app.config.tsapps/playgrounds/bun-react/src/env.tspackages/arkenv/src/create-env.tsapps/playgrounds/vite/vite.config.tsapps/playgrounds/vite-legacy/vite.config.tspackages/arkenv/src/index.tsapps/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.mdxapps/www/source.config.tspackages/arkenv/tsconfig.jsonapps/www/content/docs/arkenv/how-to/load-environment-variables.mdxpackages/vite-plugin/vitest.config.tsapps/playgrounds/vite/README.mdpackages/arkenv/package.jsonapps/playgrounds/solid-start/README.mdapps/www/content/docs/bun-plugin/index.mdxapps/www/content/docs/vite-plugin/arkenv-in-viteconfig.mdxapps/playgrounds/solid-start/app.config.tsapps/playgrounds/bun-react/src/env.tspackages/arkenv/src/create-env.tsapps/playgrounds/vite/vite.config.tsapps/playgrounds/vite-legacy/vite.config.tspackages/arkenv/src/index.tsapps/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.mdxpackages/arkenv/src/utils/load-arktype.tspackages/arkenv/src/errors.tsapps/www/content/docs/arkenv/how-to/load-environment-variables.mdxpackages/arkenv/src/utils/load-arktype.test.tsapps/playgrounds/vite/README.mdpackages/arkenv/package.jsonapps/playgrounds/solid-start/README.mdapps/www/content/docs/arkenv/integrations/standard-schema.mdxapps/www/content/docs/bun-plugin/index.mdxapps/www/content/docs/vite-plugin/arkenv-in-viteconfig.mdxapps/playgrounds/solid-start/app.config.tspackages/arkenv/src/create-env.tsapps/playgrounds/vite/vite.config.tsapps/playgrounds/vite-legacy/vite.config.ts.changeset/every-tips-shout.mdpackages/arkenv/src/index.tsapps/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.mdxpackages/arkenv/src/utils/load-arktype.tspackages/arkenv/src/errors.tsapps/www/content/docs/arkenv/how-to/load-environment-variables.mdxpackages/arkenv/src/isolation.test.tspackages/arkenv/src/utils/load-arktype.test.tsapps/www/content/docs/arkenv/integrations/standard-schema.mdxapps/www/content/docs/bun-plugin/index.mdxapps/playgrounds/bun-react/src/env.tspackages/arkenv/src/create-env.tsapps/www/content/docs/arkenv/how-to/reuse-schemas.mdx.changeset/every-tips-shout.mdapps/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.mdxpackages/arkenv/src/utils/load-arktype.tspackages/arkenv/src/errors.tsapps/www/source.config.tspackages/arkenv/tsconfig.jsonpackages/vite-plugin/vitest.config.tspackages/arkenv/src/utils/load-arktype.test.tsapps/playgrounds/vite/README.mdpackages/arkenv/package.jsonapps/playgrounds/solid-start/README.mdapps/www/content/docs/arkenv/integrations/standard-schema.mdxapps/www/content/docs/bun-plugin/index.mdxapps/www/content/docs/vite-plugin/arkenv-in-viteconfig.mdxapps/playgrounds/solid-start/app.config.tsapps/playgrounds/bun-react/src/env.tspackages/arkenv/src/create-env.tspackages/internal/types/src/index.tsapps/playgrounds/vite/vite.config.tsapps/playgrounds/vite-legacy/vite.config.tsapps/www/content/docs/arkenv/how-to/reuse-schemas.mdx.changeset/every-tips-shout.mdpackages/arkenv/src/index.tsapps/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.mdxpackages/arkenv/src/utils/load-arktype.tsapps/www/content/docs/arkenv/how-to/load-environment-variables.mdxpackages/arkenv/src/isolation.test.tspackages/arkenv/src/utils/load-arktype.test.tsapps/playgrounds/vite/README.mdpackages/arkenv/package.jsonapps/playgrounds/solid-start/README.mdapps/www/content/docs/arkenv/integrations/standard-schema.mdxapps/www/content/docs/bun-plugin/index.mdxapps/playgrounds/solid-start/app.config.tspackages/arkenv/src/create-env.tspackages/internal/types/src/index.tsapps/playgrounds/vite/vite.config.tsapps/playgrounds/vite-legacy/vite.config.tsapps/www/content/docs/arkenv/how-to/reuse-schemas.mdx.changeset/every-tips-shout.mdpackages/arkenv/src/index.tsapps/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.mdxpackages/arkenv/src/utils/load-arktype.tspackages/arkenv/src/errors.tsapps/www/source.config.tspackages/arkenv/src/isolation.test.tspackages/arkenv/src/utils/load-arktype.test.tsapps/playgrounds/solid-start/README.mdapps/www/content/docs/arkenv/integrations/standard-schema.mdxapps/www/content/docs/bun-plugin/index.mdxapps/playgrounds/bun-react/src/env.tspackages/arkenv/src/create-env.ts.changeset/every-tips-shout.mdapps/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.tspackages/vite-plugin/package.jsonpackages/arkenv/src/utils/load-arktype.test.tsapps/playgrounds/vite/README.mdpackages/arkenv/package.jsonapps/www/content/docs/bun-plugin/index.mdxpackages/arkenv/src/create-env.tspackages/internal/types/src/index.tsapps/www/content/docs/arkenv/how-to/reuse-schemas.mdxpackages/arkenv/src/index.tsapps/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.jsonapps/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.jsonapps/www/source.config.tsapps/www/package.jsonapps/www/content/docs/vite-plugin/arkenv-in-viteconfig.mdxapps/playgrounds/vite/vite.config.tsapps/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.jsonapps/www/source.config.tspackages/arkenv/tsconfig.jsonapps/playgrounds/vite/README.mdpackages/arkenv/package.jsonapps/playgrounds/solid-start/README.mdpackages/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.jsonapps/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.jsonapps/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.tsapps/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.jsonpackages/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.jsonpackages/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.tspackages/arkenv/src/isolation.test.tspackages/arkenv/src/utils/load-arktype.test.tsapps/playgrounds/vite/README.mdapps/playgrounds/solid-start/README.mdapps/www/content/docs/vite-plugin/arkenv-in-viteconfig.mdxapps/playgrounds/solid-start/app.config.tsapps/playgrounds/vite/vite.config.tsapps/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.tspackages/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.tspackages/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.tspackages/arkenv/src/utils/load-arktype.test.tsapps/playgrounds/vite/vite.config.tsapps/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.mdxapps/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.
There was a problem hiding this comment.
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
📒 Files selected for processing (4)
apps/www/content/docs/arkenv/how-to/load-environment-variables.mdxapps/www/content/docs/arkenv/integrations/standard-schema.mdxpackages/arkenv/src/create-env.tspackages/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'stype()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 inscope.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 toArkEnvErrorfor 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}: Prefertypeoverinterfacefor type definitions in TypeScript
Use TypeScript 5.1+ features when appropriate
Leverageconsttype 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 (noInferrableTypeserror)
Useas constwhere appropriate for immutable values (useAsConstAssertionerror)
Don't reassign function parameters (noParameterAssignerror)
Place default parameters last in function signatures (useDefaultParameterLasterror)
Always initialize enum values (useEnumInitializerserror)
Declare one variable per statement (useSingleVarDeclaratorerror)
Avoid unnecessary template literals (noUnusedTemplateLiteralerror)
PreferNumber.parseIntover globalparseInt(useNumberNamespaceerror)
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
UseArkEnvErrorfor environment variable validation errors
Provide clear, actionable error messages that include the variable name and expected type
**/*.{ts,tsx}: UsecreateEnv(schema)function (or default import asarkenv) 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.tsapps/www/content/docs/arkenv/integrations/standard-schema.mdxapps/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.tsapps/www/content/docs/arkenv/integrations/standard-schema.mdxapps/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.tsapps/www/content/docs/arkenv/integrations/standard-schema.mdxapps/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.tsapps/www/content/docs/arkenv/integrations/standard-schema.mdxapps/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.tsapps/www/content/docs/arkenv/integrations/standard-schema.mdxapps/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.tsapps/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.tsapps/www/content/docs/arkenv/integrations/standard-schema.mdxapps/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.tsapps/www/content/docs/arkenv/integrations/standard-schema.mdxapps/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.tsapps/www/content/docs/arkenv/integrations/standard-schema.mdxapps/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.tsapps/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.tsapps/www/content/docs/arkenv/integrations/standard-schema.mdxapps/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.tsapps/www/content/docs/arkenv/integrations/standard-schema.mdxapps/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.tsapps/www/content/docs/arkenv/integrations/standard-schema.mdxapps/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.mdxapps/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
ArkEnvConfigtype is properly extended with thevalidatoroption. 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
~standardproperty 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 correctAs per coding guidelines,
ArkEnvErroris 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(). Theas anycasts 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.
There was a problem hiding this comment.
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
📒 Files selected for processing (4)
apps/www/content/docs/arkenv/how-to/load-environment-variables.mdxapps/www/content/docs/arkenv/meta.jsonapps/www/content/docs/arkenv/quickstart.mdxapps/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.jsonapps/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-modedocumentation entry is correctly placed in the API section and follows the same format as the adjacentcoercionentry. 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
typefromarkenv/arktypeas 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
.envexample 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-modeis 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.
There was a problem hiding this comment.
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
📒 Files selected for processing (2)
apps/www/content/docs/arkenv/index.mdxapps/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.mdxapps/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.mdxapps/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.mdxapps/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.mdxapps/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.mdxapps/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.mdxapps/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.mdxapps/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.mdxapps/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.mdxapps/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.mdxapps/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
arkenvandarkenv/arktypeand 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.
…orting numbers, booleans, JSON, and arrays.
There was a problem hiding this comment.
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).nameand line 29 checksenvError.namefor the same value. SinceenvErroris justerror 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 addingtoBeInstanceOf(Error)check for consistency.This test case checks
(error as any).namebut doesn't verify that the error is an instance ofError, 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).namecheck on line 64 is redundant withenvError.namecheck 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:ArkEnvErrorThe
ArkEnvErrorimport is not used in this file. Consider removing it to avoid confusion.🧹 Proposed fix
-import { ArkEnvError } from "../../errors.ts";
294-298: Consider typing theatparameter more explicitly.The
at: anyparameter loses type safety. Sinceatis the ArkTypetypefunction (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 likecoerce($.type, ...).packages/arkenv/src/arktype/index.ts (1)
16-49: Add JSDoc for the publicparseAPI.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
📒 Files selected for processing (15)
.gitignorepackages/arkenv/src/arktype/README.mdpackages/arkenv/src/arktype/array-defaults.integration.test.tspackages/arkenv/src/arktype/coercion/coerce.test.tspackages/arkenv/src/arktype/coercion/coerce.tspackages/arkenv/src/arktype/coercion/coercion.integration.test.tspackages/arkenv/src/arktype/coercion/index.tspackages/arkenv/src/arktype/coercion/morphs.test.tspackages/arkenv/src/arktype/coercion/morphs.tspackages/arkenv/src/arktype/create-env.test.tspackages/arkenv/src/arktype/custom-types.integration.test.tspackages/arkenv/src/arktype/error.integration.test.tspackages/arkenv/src/arktype/index.tspackages/arkenv/src/arktype/object-parsing.integration.test.tspackages/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'stype()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 inscope.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 toArkEnvErrorfor user-friendly error messages that include variable name and expected type
Files:
packages/arkenv/src/arktype/custom-types.integration.test.tspackages/arkenv/src/arktype/coercion/coerce.test.tspackages/arkenv/src/arktype/coercion/coerce.tspackages/arkenv/src/arktype/index.tspackages/arkenv/src/arktype/object-parsing.integration.test.tspackages/arkenv/src/arktype/coercion/coercion.integration.test.tspackages/arkenv/src/arktype/array-defaults.integration.test.tspackages/arkenv/src/arktype/create-env.test.tspackages/arkenv/src/arktype/error.integration.test.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/coding-guidelines.mdc)
**/*.{ts,tsx}: Prefertypeoverinterfacefor type definitions in TypeScript
Use TypeScript 5.1+ features when appropriate
Leverageconsttype 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 (noInferrableTypeserror)
Useas constwhere appropriate for immutable values (useAsConstAssertionerror)
Don't reassign function parameters (noParameterAssignerror)
Place default parameters last in function signatures (useDefaultParameterLasterror)
Always initialize enum values (useEnumInitializerserror)
Declare one variable per statement (useSingleVarDeclaratorerror)
Avoid unnecessary template literals (noUnusedTemplateLiteralerror)
PreferNumber.parseIntover globalparseInt(useNumberNamespaceerror)
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
UseArkEnvErrorfor environment variable validation errors
Provide clear, actionable error messages that include the variable name and expected type
**/*.{ts,tsx}: UsecreateEnv(schema)function (or default import asarkenv) 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.tspackages/arkenv/src/arktype/coercion/coerce.test.tspackages/arkenv/src/arktype/coercion/coerce.tspackages/arkenv/src/arktype/index.tspackages/arkenv/src/arktype/object-parsing.integration.test.tspackages/arkenv/src/arktype/coercion/coercion.integration.test.tspackages/arkenv/src/arktype/array-defaults.integration.test.tspackages/arkenv/src/arktype/create-env.test.tspackages/arkenv/src/arktype/error.integration.test.ts
**/*.test.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/coding-guidelines.mdc)
Co-locate tests with components:
Component.tsxnext toComponent.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.tsor.test.tsxsuffix located alongside source files, testing individual functions and components in isolation with mocked dependencies
Files:
packages/arkenv/src/arktype/custom-types.integration.test.tspackages/arkenv/src/arktype/coercion/coerce.test.tspackages/arkenv/src/arktype/object-parsing.integration.test.tspackages/arkenv/src/arktype/coercion/coercion.integration.test.tspackages/arkenv/src/arktype/array-defaults.integration.test.tspackages/arkenv/src/arktype/create-env.test.tspackages/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 testsCreate integration tests with
.integration.test.tsor.integration.test.tsxsuffix, testing how multiple units work together without mocking their interactions (except external APIs)
Files:
packages/arkenv/src/arktype/custom-types.integration.test.tspackages/arkenv/src/arktype/object-parsing.integration.test.tspackages/arkenv/src/arktype/coercion/coercion.integration.test.tspackages/arkenv/src/arktype/array-defaults.integration.test.tspackages/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'sdescribe/itstructure for all test files
Test both success and failure cases in unit and integration tests
Mockprocess.envin unit tests to test different environment variable scenarios
Files:
packages/arkenv/src/arktype/custom-types.integration.test.tspackages/arkenv/src/arktype/coercion/coerce.test.tspackages/arkenv/src/arktype/object-parsing.integration.test.tspackages/arkenv/src/arktype/coercion/coercion.integration.test.tspackages/arkenv/src/arktype/array-defaults.integration.test.tspackages/arkenv/src/arktype/create-env.test.tspackages/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.tspackages/arkenv/src/arktype/coercion/coerce.test.tspackages/arkenv/src/arktype/coercion/coerce.tspackages/arkenv/src/arktype/index.tspackages/arkenv/src/arktype/object-parsing.integration.test.tspackages/arkenv/src/arktype/coercion/coercion.integration.test.tspackages/arkenv/src/arktype/array-defaults.integration.test.tspackages/arkenv/src/arktype/create-env.test.tspackages/arkenv/src/arktype/error.integration.test.tspackages/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.tspackages/arkenv/src/arktype/coercion/coercion.integration.test.tspackages/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.tspackages/arkenv/src/arktype/coercion/coerce.test.tspackages/arkenv/src/arktype/coercion/coerce.tspackages/arkenv/src/arktype/index.tspackages/arkenv/src/arktype/object-parsing.integration.test.tspackages/arkenv/src/arktype/coercion/coercion.integration.test.tspackages/arkenv/src/arktype/array-defaults.integration.test.tspackages/arkenv/src/arktype/create-env.test.tspackages/arkenv/src/arktype/error.integration.test.tspackages/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.tspackages/arkenv/src/arktype/coercion/coerce.test.tspackages/arkenv/src/arktype/coercion/coerce.tspackages/arkenv/src/arktype/index.tspackages/arkenv/src/arktype/object-parsing.integration.test.tspackages/arkenv/src/arktype/coercion/coercion.integration.test.tspackages/arkenv/src/arktype/array-defaults.integration.test.tspackages/arkenv/src/arktype/create-env.test.tspackages/arkenv/src/arktype/error.integration.test.tspackages/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.tspackages/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.tspackages/arkenv/src/arktype/coercion/coerce.test.tspackages/arkenv/src/arktype/coercion/coerce.tspackages/arkenv/src/arktype/index.tspackages/arkenv/src/arktype/object-parsing.integration.test.tspackages/arkenv/src/arktype/coercion/coercion.integration.test.tspackages/arkenv/src/arktype/array-defaults.integration.test.tspackages/arkenv/src/arktype/create-env.test.tspackages/arkenv/src/arktype/error.integration.test.tspackages/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.tspackages/arkenv/src/arktype/coercion/coerce.test.tspackages/arkenv/src/arktype/coercion/coerce.tspackages/arkenv/src/arktype/index.tspackages/arkenv/src/arktype/object-parsing.integration.test.tspackages/arkenv/src/arktype/coercion/coercion.integration.test.tspackages/arkenv/src/arktype/array-defaults.integration.test.tspackages/arkenv/src/arktype/create-env.test.tspackages/arkenv/src/arktype/error.integration.test.tspackages/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.tspackages/arkenv/src/arktype/coercion/coerce.test.tspackages/arkenv/src/arktype/coercion/coerce.tspackages/arkenv/src/arktype/index.tspackages/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.tspackages/arkenv/src/arktype/coercion/coerce.test.tspackages/arkenv/src/arktype/coercion/coerce.tspackages/arkenv/src/arktype/index.tspackages/arkenv/src/arktype/object-parsing.integration.test.tspackages/arkenv/src/arktype/coercion/coercion.integration.test.tspackages/arkenv/src/arktype/array-defaults.integration.test.tspackages/arkenv/src/arktype/create-env.test.tspackages/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.tspackages/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.tspackages/arkenv/src/arktype/object-parsing.integration.test.tspackages/arkenv/src/arktype/coercion/coercion.integration.test.tspackages/arkenv/src/arktype/array-defaults.integration.test.tspackages/arkenv/src/arktype/create-env.test.tspackages/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.tspackages/arkenv/src/arktype/object-parsing.integration.test.tspackages/arkenv/src/arktype/coercion/coercion.integration.test.tspackages/arkenv/src/arktype/array-defaults.integration.test.tspackages/arkenv/src/arktype/create-env.test.tspackages/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.tspackages/arkenv/src/arktype/object-parsing.integration.test.tspackages/arkenv/src/arktype/coercion/coercion.integration.test.tspackages/arkenv/src/arktype/create-env.test.tspackages/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.tspackages/arkenv/src/arktype/object-parsing.integration.test.tspackages/arkenv/src/arktype/coercion/coercion.integration.test.tspackages/arkenv/src/arktype/create-env.test.tspackages/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.tspackages/arkenv/src/arktype/object-parsing.integration.test.tspackages/arkenv/src/arktype/coercion/coercion.integration.test.tspackages/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.tspackages/arkenv/src/arktype/coercion/coerce.test.tspackages/arkenv/src/arktype/coercion/coerce.tspackages/arkenv/src/arktype/index.tspackages/arkenv/src/arktype/object-parsing.integration.test.tspackages/arkenv/src/arktype/coercion/coercion.integration.test.tspackages/arkenv/src/arktype/array-defaults.integration.test.tspackages/arkenv/src/arktype/create-env.test.tspackages/arkenv/src/arktype/error.integration.test.tspackages/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.tspackages/arkenv/src/arktype/object-parsing.integration.test.tspackages/arkenv/src/arktype/create-env.test.tspackages/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.tspackages/arkenv/src/arktype/object-parsing.integration.test.tspackages/arkenv/src/arktype/coercion/coercion.integration.test.tspackages/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.tspackages/arkenv/src/arktype/object-parsing.integration.test.tspackages/arkenv/src/arktype/coercion/coercion.integration.test.tspackages/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.tspackages/arkenv/src/arktype/coercion/coerce.tspackages/arkenv/src/arktype/index.tspackages/arkenv/src/arktype/object-parsing.integration.test.tspackages/arkenv/src/arktype/coercion/coercion.integration.test.tspackages/arkenv/src/arktype/create-env.test.tspackages/arkenv/src/arktype/error.integration.test.tspackages/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.tspackages/arkenv/src/arktype/coercion/coerce.tspackages/arkenv/src/arktype/index.tspackages/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.tspackages/arkenv/src/arktype/coercion/coercion.integration.test.tspackages/arkenv/src/arktype/create-env.test.tspackages/arkenv/src/arktype/error.integration.test.tspackages/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.tspackages/arkenv/src/arktype/coercion/coerce.tspackages/arkenv/src/arktype/coercion/coercion.integration.test.tspackages/arkenv/src/arktype/create-env.test.tspackages/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.tspackages/arkenv/src/arktype/coercion/coerce.tspackages/arkenv/src/arktype/index.tspackages/arkenv/src/arktype/create-env.test.tspackages/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.tspackages/arkenv/src/arktype/array-defaults.integration.test.tspackages/arkenv/src/arktype/create-env.test.tspackages/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.tspackages/arkenv/src/arktype/create-env.test.tspackages/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.tspackages/arkenv/src/arktype/create-env.test.tspackages/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.tspackages/arkenv/src/arktype/create-env.test.tspackages/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.tspackages/arkenv/src/arktype/error.integration.test.tspackages/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 newarkenv/arktypemodule 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.stubEnvto 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
afterEachThe test cases comprehensively cover ArkEnvError propagation through the
createEnv+typestack.
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.tsextensions in imports are a consistent pattern throughout thepackages/arkenvtest files, indicating this is a deliberate choice supported by the project's build and test tooling. This pattern appears specific to thepackages/arkenvpackage 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")toat("unknown")correctly enables dynamic ArkType loading by accepting the type constructor as a parameter. The casts toanyare 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)tocoerce(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
.tsextensions and adjusted relative paths, consistent with the PR's module reorganization wherecreateEnvis in the parent directory andtypeis 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.tsand./index.tswith 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
.tsextensions:../index.tsfor the defaultarkenvexport and./index.tsfor thetypefunction. 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: stringannotation 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, centralizedtypere-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.
…tion entry to a full link with a 'New' tag.
…in without-arktype example.
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>
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) |  |  | --- ### 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) [@​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) [@​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>
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Breaking Changes
arkenvtoarkenv/arktype.✏️ Tip: You can customize this high-level summary in your review settings.