Skip to content

Conversation

@yamcodes
Copy link
Owner

@yamcodes yamcodes commented Dec 31, 2025

Closes #677

Summary by CodeRabbit

  • Improvements

    • Internal links are now normalized: absolute internal URLs convert to relative paths for smoother navigation.
    • External URL detection refined with better handling for development hosts.
  • Documentation

    • Streamlined intro and reference lines in project docs; tightened spacing around a docs image.
  • Tests

    • Added unit tests covering URL detection and link optimization.
  • Chores

    • Added MDX/rehype support and a local dev task plus required tooling dependencies.

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

@changeset-bot
Copy link

changeset-bot bot commented Dec 31, 2025

⚠️ No Changeset found

Latest commit: f3da857

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 31, 2025

Walkthrough

Adds a rehype plugin that normalizes internal documentation links to relative paths, new URL utilities and tests, MDX plugin wiring, package dependency updates, minor README and MDX formatting edits, and a VS Code background task for local dev.

Changes

Cohort / File(s) Summary
Link Optimization Plugin
apps/www/lib/plugins/rehype-optimize-internal-links.ts
New rehype plugin that visits HTML and MDX JSX nodes to replace absolute internal href/url strings with optimized relative paths via optimizeInternalLink().
URL Utilities
apps/www/lib/utils/url.ts
Added optimizeInternalLink(href) export and isInternalDomain() helper; refactored isExternalUrl() to use internal-domain detection and adjusted localhost handling for SSR.
URL Utilities Tests
apps/www/lib/utils/url.test.ts
New Vitest suites for isExternalUrl() and optimizeInternalLink() covering internal/external detection, production URL normalization, localhost/IP behavior, relative paths, and undefined input.
MDX & Remark Configuration
apps/www/source.config.ts
Added remark-directive to remark plugins and registered rehypeOptimizeInternalLinks in rehype pipeline.
Dependencies
apps/www/package.json
Added runtime deps remark-directive, unist-util-visit and dev deps @types/hast, @types/mdast, mdast-util-mdx-jsx.
Documentation
packages/arkenv/README.md
Minor content edits: removed repetitive “read the docs” tip, adjusted intro flow, added superscript note and spacing tweaks.
Documentation Formatting
apps/www/content/docs/arkenv/index.mdx
Removed extra blank lines around the ArkEnv icon image tag.
Development Configuration
apps/www/.vscode/tasks.json
New VS Code background task "dev" that runs a compound conc command to start Next.js and next-video sync concurrently.

Sequence Diagram(s)

sequenceDiagram
    participant MDX as MDX Document
    participant Rehype as rehypeOptimizeInternalLinks
    participant Visitor as AST Visitor
    participant Utils as optimizeInternalLink
    participant Out as Transformed AST

    MDX->>Rehype: pass hast Root
    activate Rehype

    rect rgba(90,160,255,0.08)
    Note over Rehype,Visitor: Scan HTML elements
    Rehype->>Visitor: find nodes with properties.href
    Visitor->>Utils: href string
    Utils-->>Visitor: maybe-relative href
    Visitor->>Rehype: update node.properties.href
    end

    rect rgba(90,160,255,0.08)
    Note over Rehype,Visitor: Scan MDX JSX elements
    Rehype->>Visitor: find mdxJsxFlow/Text elements
    Visitor->>Visitor: locate href/url attributes
    Visitor->>Utils: attribute string value
    Utils-->>Visitor: maybe-relative value
    Visitor->>Rehype: update attribute.value
    end

    deactivate Rehype
    Rehype->>Out: return transformed AST
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Add external link indicators to documentation #645: Modifies apps/www/lib/utils/url.ts internal-domain and URL detection logic—direct overlap with this PR's URL utilities changes.
  • Fix playground #189: Touches www UI and media/demo components—relevant to next-video integration and site behavior that this PR's dev task and link handling affect.
  • Move readme #132: Edits README and MDX configuration—overlaps with documentation and MDX plugin changes made here.

Poem

🐰 I hopped through links both long and wide,
Turned full URLs into paths that hide,
I nibbled at hrefs, made them small and sweet,
Now docs link neatly, tidy and complete. 🥕

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR includes out-of-scope changes: new rehype plugin for internal link optimization, URL utility functions, tests, and dependency additions not mentioned in issue #677. Separate internal link optimization work (.vscode/tasks.json, rehype plugin, URL utilities, tests, package.json) into a distinct PR; keep this PR focused only on reducing repetitive docs CTAs in README.
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: reducing repetitive CTAs for reading docs in the README by consolidating messaging.
Linked Issues check ✅ Passed The PR addresses issue #677 by removing the repetitive TIP block from README and replacing it with a concise superscript note, reducing redundancy while maintaining awareness of docs-only features.
✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2d5e810 and f3da857.

📒 Files selected for processing (3)
  • apps/www/lib/plugins/rehype-optimize-internal-links.ts
  • apps/www/lib/utils/url.test.ts
  • apps/www/source.config.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • apps/www/source.config.ts
  • apps/www/lib/plugins/rehype-optimize-internal-links.ts
  • apps/www/lib/utils/url.test.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: test-e2e (e2e)
  • GitHub Check: test-e2e (a11y)
  • GitHub Check: test-typesafety
  • GitHub Check: test-build (latest)
  • GitHub Check: test-build (lts/*)
  • GitHub Check: Deploy-Preview

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

❤️ Share

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

@github-actions github-actions bot added docs Improvements or additions to documentation arkenv Changes to the `arkenv` npm package. www Improvements or additions to arkenv.js.org labels Dec 31, 2025
@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 31, 2025

Open in StackBlitz

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

commit: f3da857

@arkenv-bot
Copy link
Contributor

arkenv-bot bot commented Dec 31, 2025

📦 Bundle Size Report

Package Size Limit Diff Status
arkenv 1.43 kB 2 kB 0.0%

All size limits passed!

@arkenv-bot
Copy link
Contributor

arkenv-bot bot commented Dec 31, 2025

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

Project Deployment Review Updated (Asia/Almaty)
arkenv Ready Ready Preview, Comment Dec 31 2025, 5:59 PM (Asia/Almaty)

@github-actions github-actions bot added the tests This issue or PR is about adding, removing or changing tests. label Dec 31, 2025
@yamcodes yamcodes marked this pull request as ready for review December 31, 2025 12:56
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
apps/www/source.config.ts (1)

199-200: Remove the placeholder comment.

The // ... comment appears to be a leftover placeholder and should be removed to avoid confusion.

🔎 Proposed fix
 		rehypeCodeOptions: {
-			// ...
-
 			langs: ["ts", "js", "json", "bash", "dotenv"],
apps/www/lib/utils/url.test.ts (1)

27-35: Consider adding a test for hash preservation.

The optimizeInternalLink implementation preserves hash fragments (url.hash), but there's no explicit test for this behavior.

🔎 Suggested test case
it("preserves hash fragments", () => {
	expect(
		optimizeInternalLink("https://arkenv.js.org/docs/quickstart#installation"),
	).toBe("/docs/quickstart#installation");
});
apps/www/lib/plugins/rehype-optimize-internal-links.ts (1)

16-18: Minor: Simplify the optimization check.

Since href is already verified as a string (line 12 and line 40), optimizeInternalLink will never return undefined for valid string input. The optimized && check is redundant.

🔎 Proposed simplification
-			if (optimized && optimized !== href) {
+			if (optimized !== href) {
 				node.properties.href = optimized;
 			}

And similarly for the MDX JSX case:

-				if (optimized && optimized !== href) {
+				if (optimized !== href) {
 					hrefAttr.value = optimized;
 				}

Also applies to: 43-45

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 89f0870 and 2d5e810.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (8)
  • apps/www/.vscode/tasks.json
  • apps/www/content/docs/arkenv/index.mdx
  • apps/www/lib/plugins/rehype-optimize-internal-links.ts
  • apps/www/lib/utils/url.test.ts
  • apps/www/lib/utils/url.ts
  • apps/www/package.json
  • apps/www/source.config.ts
  • packages/arkenv/README.md
💤 Files with no reviewable changes (1)
  • apps/www/content/docs/arkenv/index.mdx
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{ts,tsx}

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

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

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

Files:

  • apps/www/lib/plugins/rehype-optimize-internal-links.ts
  • apps/www/lib/utils/url.test.ts
  • apps/www/source.config.ts
  • apps/www/lib/utils/url.ts
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/lib/plugins/rehype-optimize-internal-links.ts
  • apps/www/lib/utils/url.test.ts
  • apps/www/source.config.ts
  • apps/www/lib/utils/url.ts
**/*.test.{ts,tsx}

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

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

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

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

Files:

  • apps/www/lib/utils/url.test.ts
**/*.{test,integration.test}.{ts,tsx}

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

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

Files:

  • apps/www/lib/utils/url.test.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
**/package.json

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

Use workspace:* protocol for workspace dependencies between packages

Files:

  • apps/www/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:

  • apps/www/package.json
🧠 Learnings (31)
📚 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:

  • apps/www/lib/utils/url.test.ts
  • apps/www/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:

  • apps/www/lib/utils/url.test.ts
  • apps/www/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: 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:

  • apps/www/lib/utils/url.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:

  • apps/www/lib/utils/url.test.ts
  • apps/www/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: 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:

  • apps/www/lib/utils/url.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:

  • apps/www/lib/utils/url.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:

  • apps/www/lib/utils/url.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 external dependencies (clipboard, network, etc.) in unit tests

Applied to files:

  • apps/www/lib/utils/url.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:

  • apps/www/lib/utils/url.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:

  • apps/www/lib/utils/url.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:

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

Applied to files:

  • apps/www/lib/utils/url.test.ts
📚 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/lib/utils/url.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 JSDoc comments for public APIs

Applied to files:

  • apps/www/source.config.ts
📚 Learning: 2025-11-24T16:04:11.901Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/monorepo.mdc:0-0
Timestamp: 2025-11-24T16:04:11.901Z
Learning: Applies to turbo.json : Turborepo tasks are defined in turbo.json with common tasks: build, dev, typecheck, test, and test:e2e

Applied to files:

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

Applied to files:

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

Applied to files:

  • apps/www/package.json
📚 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` instead of `jest` or `vitest` for running tests

Applied to files:

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

Applied to files:

  • packages/arkenv/README.md
📚 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/README.md
📚 Learning: 2025-11-24T16:04:00.957Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.957Z
Learning: Applies to **/*.{ts,tsx} : Use `ArkEnvError` for environment variable validation errors

Applied to files:

  • packages/arkenv/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 `createEnv(schema)` function (or default import as `arkenv`) to create validated environment objects in TypeScript

Applied to files:

  • packages/arkenv/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/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 : Convert ArkType validation errors to `ArkEnvError` for user-friendly error messages that include variable name and expected type

Applied to files:

  • packages/arkenv/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 ArkType's `type()` function to define schemas in environment variable definitions

Applied to files:

  • packages/arkenv/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/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 : Leverage ArkType's built-in types (e.g., `string.host`, `number.port`) where possible in environment schemas

Applied to files:

  • packages/arkenv/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} : Provide default values for optional environment variables using ArkType syntax (e.g., 'boolean = false')

Applied to files:

  • packages/arkenv/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/README.md
📚 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:

  • packages/arkenv/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} : For environment schema definition, use ArkType string literal syntax for enumerated values (e.g., "'development' | 'production' | 'test'")

Applied to files:

  • packages/arkenv/README.md
🧬 Code graph analysis (2)
apps/www/lib/plugins/rehype-optimize-internal-links.ts (1)
apps/www/lib/utils/url.ts (1)
  • optimizeInternalLink (73-95)
apps/www/source.config.ts (1)
apps/www/lib/plugins/rehype-optimize-internal-links.ts (1)
  • rehypeOptimizeInternalLinks (8-50)
⏰ 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). (5)
  • GitHub Check: test-e2e (a11y)
  • GitHub Check: test-e2e (e2e)
  • GitHub Check: Deploy-Preview
  • GitHub Check: test-build (latest)
  • GitHub Check: test-build (lts/*)
🔇 Additional comments (9)
apps/www/package.json (1)

45-72: LGTM!

The new dependencies for MDX processing (remark-directive, unist-util-visit) and type definitions (@types/hast, @types/mdast, mdast-util-mdx-jsx) are appropriate for the internal link optimization feature. Since this is an app (not published to npm), the use of caret versioning for these stable AST libraries is acceptable.

apps/www/.vscode/tasks.json (1)

1-13: LGTM!

Well-configured VS Code task for the development workflow. The $tsc-watch problem matcher and isBackground: true are appropriate for a long-running dev server.

packages/arkenv/README.md (1)

26-36: Nice improvement to the documentation structure.

The changes effectively address issue #677 by:

  1. Replacing the repetitive TIP block with a concise superscript note
  2. Streamlining the Introduction section

The new format communicates the value of the docs (interactive code blocks and type hints) without being intrusive.

apps/www/source.config.ts (1)

196-197: LGTM!

The plugin registrations are correctly configured. rehypeOptimizeInternalLinks is properly invoked as a function (matching its factory pattern), and remarkDirective is passed directly as expected for remark plugins.

apps/www/lib/utils/url.test.ts (1)

1-60: Well-structured test suite following coding guidelines.

Good coverage of edge cases including:

  • Relative paths and anchors
  • Internal vs external domains
  • Query string preservation
  • Localhost handling in client context
  • Undefined input handling
apps/www/lib/utils/url.ts (2)

11-16: Good subdomain matching logic.

The check hostname.endsWith(.${domain}) correctly prevents false positives like "evilarkenv.js.org" from matching "arkenv.js.org". This is a secure pattern for domain validation.


73-95: Well-designed utility with clear documentation.

The optimizeInternalLink function correctly:

  1. Preserves already-relative paths (early return)
  2. Constructs complete relative URLs with pathname, search, and hash
  3. Intentionally excludes localhost to preserve "tutorial style" links
  4. Gracefully handles malformed URLs via try-catch

The JSDoc clearly explains the three use cases this enables.

apps/www/lib/plugins/rehype-optimize-internal-links.ts (2)

8-20: Clean implementation of the rehype transformer.

The plugin correctly handles standard HTML elements with href properties. The in-place mutation pattern is appropriate for rehype transformers.


22-48: Good coverage for MDX JSX elements.

Including both href and url attribute names ensures the optimization works with various component APIs. The type guard (node): node is MdxJsxElement provides proper type narrowing.

@yamcodes yamcodes merged commit a6c0927 into main Dec 31, 2025
18 of 19 checks passed
@yamcodes yamcodes deleted the reduce-repetition-read-the-docs branch December 31, 2025 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arkenv Changes to the `arkenv` npm package. docs Improvements or additions to documentation tests This issue or PR is about adding, removing or changing tests. www Improvements or additions to arkenv.js.org

Projects

None yet

Development

Successfully merging this pull request may close these issues.

“Read the docs” comment repetitive/annoying

2 participants