Conversation
…th corresponding tests.
🦋 Changeset detectedLatest commit: 3cfc81c The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 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 |
WalkthroughThis PR removes the Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ 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)
✏️ Tip: You can disable this entire section by setting 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 |
commit: |
…ts from the `morphs` module.
📦 Bundle Size Report
✅ All size limits passed! |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…e internal/scope package.
…/scope` packages.
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/internal/scope/src/root.test.ts (1)
28-31: Verify test input type for invalid port.The test passes a string
"99999"to the port validator, but based on theporttype definition (0 <= number.integer <= 65535), the validator expects anumber. This test might be passing for the wrong reason (type mismatch rather than value out of range).Consider using a numeric value to properly test the range validation:
Proposed fix
it("should throw for invalid port", () => { const portType = $.type({ PORT: "number.port" }); - expect(() => portType.assert({ PORT: "99999" })).toThrow(); + expect(() => portType.assert({ PORT: 99999 })).toThrow(); });
🤖 Fix all issues with AI agents
In `@packages/internal/scope/src/keywords.test.ts`:
- Around line 14-20: The tests are passing due to type mismatch because
port.assert is given string inputs; update the two failing tests to pass numeric
values so range validation is exercised: replace port.assert("-2") with
port.assert(-2) in the "should throw when the port is negative" test and replace
port.assert("65536") with port.assert(65536) in the "should throw when the port
is too large" test so port.assert (the port validator) receives numbers and
correctly throws for out-of-range values.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (25)
.changeset/real-toes-heal.mdarkenv.code-workspacepackages/arkenv/package.jsonpackages/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.tspackages/arkenv/src/utils/index.tspackages/internal/keywords/CHANGELOG.mdpackages/internal/keywords/README.mdpackages/internal/keywords/package.jsonpackages/internal/keywords/src/index.test.tspackages/internal/keywords/src/index.tspackages/internal/keywords/tsconfig.jsonpackages/internal/keywords/tsdown.config.tspackages/internal/keywords/vitest.config.tspackages/internal/scope/package.jsonpackages/internal/scope/src/index.tspackages/internal/scope/src/keywords.test.tspackages/internal/scope/src/keywords.tspackages/internal/scope/src/root.test.tspackages/internal/scope/src/root.ts
💤 Files with no reviewable changes (12)
- arkenv.code-workspace
- packages/internal/scope/package.json
- packages/internal/keywords/README.md
- packages/arkenv/package.json
- packages/arkenv/src/utils/index.ts
- packages/internal/keywords/tsconfig.json
- packages/internal/keywords/src/index.ts
- packages/internal/keywords/src/index.test.ts
- packages/internal/keywords/package.json
- packages/internal/keywords/vitest.config.ts
- packages/internal/keywords/tsdown.config.ts
- packages/internal/keywords/CHANGELOG.md
🧰 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/coercion/index.tspackages/arkenv/src/coercion/morphs.tspackages/arkenv/src/coercion/morphs.test.tspackages/arkenv/src/coercion/coercion.integration.test.tspackages/arkenv/src/create-env.tspackages/arkenv/src/coercion/coerce.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/coercion/index.tspackages/arkenv/src/coercion/morphs.tspackages/internal/scope/src/keywords.tspackages/arkenv/src/coercion/morphs.test.tspackages/internal/scope/src/root.test.tspackages/internal/scope/src/root.tspackages/arkenv/src/coercion/coercion.integration.test.tspackages/internal/scope/src/index.tspackages/arkenv/src/create-env.tspackages/arkenv/src/coercion/coerce.tspackages/internal/scope/src/keywords.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/coercion/index.tspackages/internal/scope/src/index.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/coercion/morphs.test.tspackages/internal/scope/src/root.test.tspackages/arkenv/src/coercion/coercion.integration.test.tspackages/internal/scope/src/keywords.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/coercion/morphs.test.tspackages/internal/scope/src/root.test.tspackages/arkenv/src/coercion/coercion.integration.test.tspackages/internal/scope/src/keywords.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/coercion/coercion.integration.test.ts
🧠 Learnings (37)
📓 Common learnings
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Leverage ArkType's built-in types (e.g., `string.host`, `number.port`) where possible in environment schemas
📚 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 **/index.ts : Use barrel exports (`index.ts`) for package entry points
Applied to files:
packages/arkenv/src/coercion/index.tspackages/internal/scope/src/root.test.tspackages/internal/scope/src/index.ts
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Use union types for enums in ArkType schemas (e.g., `"'dev' | 'prod'"`) instead of separate enum definitions
Applied to files:
packages/arkenv/src/coercion/index.tspackages/arkenv/src/coercion/morphs.tspackages/internal/scope/src/keywords.tspackages/internal/scope/src/root.tspackages/arkenv/src/create-env.tspackages/arkenv/src/coercion/coerce.ts
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Leverage ArkType's type inference for TypeScript types instead of manual type definitions
Applied to files:
packages/arkenv/src/coercion/index.tspackages/arkenv/src/coercion/morphs.tspackages/internal/scope/src/keywords.tspackages/arkenv/src/coercion/coercion.integration.test.tspackages/arkenv/src/create-env.tspackages/arkenv/src/coercion/coerce.ts
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Keep environment variable schemas readable and TypeScript-like using ArkType syntax
Applied to files:
packages/arkenv/src/coercion/index.tspackages/arkenv/src/coercion/morphs.tspackages/internal/scope/src/keywords.tspackages/internal/scope/src/root.tspackages/arkenv/src/coercion/coercion.integration.test.tspackages/internal/scope/src/index.tspackages/arkenv/src/create-env.tspackages/arkenv/src/coercion/coerce.ts
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Use the scoped `$` type system for custom types defined in `scope.ts`
Applied to files:
packages/arkenv/src/coercion/index.ts.changeset/real-toes-heal.mdpackages/internal/scope/src/keywords.tspackages/internal/scope/src/root.test.tspackages/internal/scope/src/root.tspackages/internal/scope/src/index.tspackages/arkenv/src/create-env.ts
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/scope.ts : Define custom types in `scope.ts` using ArkType's scoped type system for reusability across schemas
Applied to files:
packages/arkenv/src/coercion/index.ts.changeset/real-toes-heal.mdpackages/internal/scope/src/keywords.tspackages/internal/scope/src/root.tspackages/internal/scope/src/index.tspackages/arkenv/src/create-env.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/coercion/index.tspackages/arkenv/src/coercion/morphs.tspackages/internal/scope/src/keywords.tspackages/internal/scope/src/root.tspackages/internal/scope/src/index.tspackages/arkenv/src/create-env.tspackages/arkenv/src/coercion/coerce.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:
.changeset/real-toes-heal.md
📚 Learning: 2025-11-24T16:04:00.957Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.957Z
Learning: Applies to **/*.{ts,tsx} : Prefer `Number.parseInt` over global `parseInt` (`useNumberNamespace` error)
Applied to files:
packages/arkenv/src/coercion/morphs.ts
📚 Learning: 2025-12-22T19:44:11.474Z
Learnt from: yamcodes
Repo: yamcodes/arkenv PR: 596
File: examples/basic/index.ts:4-5
Timestamp: 2025-12-22T19:44:11.474Z
Learning: In examples/basic/index.ts: Use explicit ArkType syntax (e.g., "string.ip | 'localhost'", "0 <= number.integer <= 65535") instead of built-in validators (string.host, number.port) to showcase ArkType's type system capabilities for educational purposes.
Applied to files:
packages/internal/scope/src/keywords.tspackages/arkenv/src/coercion/morphs.test.tspackages/internal/scope/src/root.tspackages/internal/scope/src/index.tspackages/internal/scope/src/keywords.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 built-in validators (host, port, url, email) from ArkEnv when available instead of custom ArkType schemas
Applied to files:
packages/internal/scope/src/keywords.tspackages/internal/scope/src/root.tspackages/internal/scope/src/index.tspackages/internal/scope/src/keywords.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/internal/scope/src/keywords.tspackages/internal/scope/src/root.tspackages/internal/scope/src/index.tspackages/arkenv/src/create-env.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/internal/scope/src/keywords.tspackages/internal/scope/src/root.tspackages/internal/scope/src/index.tspackages/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 **/*.{test,integration.test}.{ts,tsx} : Test both success and failure cases in unit and integration tests
Applied to files:
packages/arkenv/src/coercion/morphs.test.tspackages/arkenv/src/coercion/coercion.integration.test.tspackages/internal/scope/src/keywords.test.ts
📚 Learning: 2025-12-12T13:20:01.954Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-12-12T13:20:01.954Z
Learning: Applies to **/*.test.{ts,tsx} : Test component public API (props, events, and component contract), user behavior (clicks, typing, focus, keyboard, ARIA), state transitions, accessibility, and side effects in component tests
Applied to files:
packages/arkenv/src/coercion/morphs.test.tspackages/internal/scope/src/keywords.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/coercion/morphs.test.tspackages/arkenv/src/coercion/coercion.integration.test.ts
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.test.{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/coercion/morphs.test.tspackages/internal/scope/src/root.test.tspackages/internal/scope/src/keywords.test.ts
📚 Learning: 2025-12-12T13:20:01.954Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-12-12T13:20:01.954Z
Learning: Applies to **/*.integration.test.{ts,tsx} : Integration tests should focus on component and hook interactions, function composition and data flow, real dependencies between units, and state synchronization across boundaries
Applied to files:
packages/arkenv/src/coercion/morphs.test.tspackages/arkenv/src/coercion/coercion.integration.test.ts
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.integration.test.{ts,tsx} : Create integration tests with `.integration.test.ts` or `.integration.test.tsx` suffix, testing how multiple units work together without mocking their interactions (except external APIs)
Applied to files:
packages/arkenv/src/coercion/morphs.test.tspackages/internal/scope/src/root.test.tspackages/arkenv/src/coercion/coercion.integration.test.ts
📚 Learning: 2025-12-12T13:20:01.954Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-12-12T13:20:01.954Z
Learning: Applies to **/*.test.{ts,tsx} : Unit tests should focus on individual function logic and edge cases, component rendering and props, error handling and validation, and type checking
Applied to files:
packages/arkenv/src/coercion/morphs.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/coercion/morphs.test.tspackages/internal/scope/src/root.test.tspackages/arkenv/src/coercion/coercion.integration.test.tspackages/internal/scope/src/keywords.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} : Co-locate unit test files with source files using naming convention: source file → test file (e.g., create-env.ts → create-env.test.ts)
Applied to files:
packages/arkenv/src/coercion/morphs.test.tspackages/internal/scope/src/root.test.tspackages/arkenv/src/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/internal/scope/src/root.test.tspackages/arkenv/src/coercion/coercion.integration.test.tspackages/internal/scope/src/keywords.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/internal/scope/src/root.test.tspackages/arkenv/src/coercion/coercion.integration.test.ts
📚 Learning: 2025-12-12T13:20:01.954Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-12-12T13:20:01.954Z
Learning: Applies to **/*.integration.test.{ts,tsx} : Use *.integration.test.ts suffix to distinguish integration tests from unit tests
Applied to files:
packages/internal/scope/src/root.test.tspackages/arkenv/src/coercion/coercion.integration.test.ts
📚 Learning: 2025-12-12T13:20:01.954Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-12-12T13:20:01.954Z
Learning: Applies to **/*.test.{ts,tsx} : Use Vitest for unit and integration tests
Applied to files:
packages/internal/scope/src/root.test.tspackages/arkenv/src/coercion/coercion.integration.test.tspackages/internal/scope/src/keywords.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/internal/scope/src/root.test.tspackages/arkenv/src/coercion/coercion.integration.test.tspackages/internal/scope/src/keywords.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/internal/scope/src/root.test.tspackages/arkenv/src/coercion/coercion.integration.test.ts
📚 Learning: 2025-12-12T13:20:01.954Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-12-12T13:20:01.954Z
Learning: Applies to 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/internal/scope/src/root.test.tspackages/internal/scope/src/keywords.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/internal/scope/src/root.test.tspackages/arkenv/src/coercion/coercion.integration.test.ts
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : Use `createEnv(schema)` function (or default import as `arkenv`) to create validated environment objects in TypeScript
Applied to files:
packages/internal/scope/src/root.tspackages/internal/scope/src/index.tspackages/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/internal/scope/src/root.tspackages/internal/scope/src/index.tspackages/arkenv/src/create-env.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/coercion/coercion.integration.test.tspackages/arkenv/src/create-env.tspackages/arkenv/src/coercion/coerce.ts
📚 Learning: 2025-12-23T07:09:57.130Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T07:09:57.130Z
Learning: Applies to **/*.{ts,tsx} : Use ArkEnvError for environment variable errors instead of generic Error types
Applied to files:
packages/arkenv/src/create-env.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 camelCase for function names (e.g., `createEnv`)
Applied to files:
packages/arkenv/src/create-env.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: ArkType validates environment variables at runtime and TypeScript types are inferred from the schema definition
Applied to files:
packages/arkenv/src/create-env.ts
🧬 Code graph analysis (5)
packages/internal/scope/src/keywords.ts (1)
packages/arkenv/src/type.ts (1)
type(3-3)
packages/arkenv/src/coercion/morphs.test.ts (1)
packages/arkenv/src/coercion/morphs.ts (3)
coerceNumber(12-20)coerceBoolean(32-36)coerceJson(48-57)
packages/internal/scope/src/root.ts (1)
packages/arkenv/src/type.ts (1)
type(3-3)
packages/arkenv/src/coercion/coerce.ts (2)
packages/arkenv/src/coercion/morphs.ts (3)
coerceJson(48-57)coerceNumber(12-20)coerceBoolean(32-36)packages/arkenv/src/type.ts (1)
type(3-3)
packages/internal/scope/src/keywords.test.ts (1)
packages/internal/scope/src/keywords.ts (2)
port(6-6)host(11-11)
⏰ 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). (4)
- GitHub Check: Deploy-Preview
- GitHub Check: test-e2e (e2e)
- GitHub Check: test-e2e (a11y)
- GitHub Check: test-typesafety
🔇 Additional comments (16)
.changeset/real-toes-heal.md (1)
1-10: LGTM!The changeset appropriately documents the removal of the internal
@repo/keywordspackage with patch version bumps. The description clearly explains the motivation for the change.packages/arkenv/src/coercion/index.ts (1)
1-1: LGTM!Clean barrel export following the project's coding guidelines for package entry points.
packages/arkenv/src/create-env.ts (1)
4-4: LGTM!Import path correctly updated to the new coercion module location. The CoerceOptions type and coerce function are properly re-exported from the barrel.
packages/arkenv/src/coercion/coercion.integration.test.ts (1)
2-3: LGTM!Import paths correctly adjusted to reflect the test file's new location within the coercion subdirectory. The comprehensive test coverage for coercion scenarios is maintained.
packages/arkenv/src/coercion/coerce.ts (4)
2-2: LGTM!Clean migration from external
@repo/keywordshelpers to local morphs. The import consolidates the coercion utilities within the arkenv package.
175-179: LGTM!The coercion priority (number → boolean) is correctly applied. Numeric strings are coerced first, allowing "true"/"false" strings to fall through to boolean coercion. This maintains the expected behavior from the previous implementation.
209-217: LGTM!Array item coercion correctly applies the same number → boolean priority pattern, with object coercion handled via
coerceJsonfor nested structures.
242-258: LGTM!Record property coercion maintains consistency with the rest of the coercion logic. The pattern correctly handles both array elements within records and direct primitive values.
packages/arkenv/src/coercion/morphs.test.ts (1)
1-96: Well-structured test suite with comprehensive coverage.The tests follow Vitest's
describe/itstructure, are co-located with the source file, and cover both success and failure cases as per the coding guidelines. Good coverage of edge cases including:
- Numeric edge cases (0, negative, floating point, whitespace-padded)
- NaN handling
- Non-coercible value passthrough
- Invalid JSON resilience
packages/arkenv/src/coercion/morphs.ts (1)
1-57: Clean implementation of coercion utilities.The implementation is well-documented with JSDoc comments, handles edge cases correctly, and follows defensive programming patterns by returning original values when coercion fails. Good use of
Number.isNaNover the globalisNaNfunction.packages/internal/scope/src/keywords.ts (1)
1-11: LGTM!Clean implementation of the
portandhostvalidators using explicit ArkType syntax. The constraints are correct (port range 0-65535, IP addresses or localhost), and the JSDoc comments provide clear documentation. Based on learnings, using explicit ArkType syntax here appropriately showcases the type system capabilities.packages/internal/scope/src/root.ts (1)
1-20: LGTM!Well-structured root scope definition that properly extends ArkType's built-in
stringandnumbermodules with the customhostandportvalidators. The dual export pattern (const$and type$) follows ArkType's scoped type system conventions. As per coding guidelines, this leverages ArkType's built-in types while adding ArkEnv-specific extensions.packages/internal/scope/src/root.test.ts (1)
2-2: LGTM!Import path correctly updated to reference the new
root.tsmodule directly.packages/internal/scope/src/keywords.test.ts (2)
1-9: LGTM!Good test setup with proper Vitest structure and a valid success case for port validation.
23-37: LGTM!Host validation tests are well-structured, covering valid IP addresses, localhost, and invalid input scenarios. Tests both success and failure cases as per coding guidelines.
packages/internal/scope/src/index.ts (1)
1-1: LGTM!Clean barrel export pattern that properly re-exports from
root.ts. This separation maintains the package's public API while keeping implementation details in a dedicated module. As per coding guidelines, usingindex.tsfor package entry points is the recommended approach.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
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
✏️ Tip: You can customize this high-level summary in your review settings.