Improve plugin docs - #891
Conversation
…afe setup and clarify advanced configurations.
… across documentation and specifications
…tions and type usage patterns
|
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ 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. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
WalkthroughStandardizes wording to "typesafety", restructures Vite and Bun plugin docs into Quickstarts, adds ChangesDocs, typing, examples & site tooling
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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: |
📦 Bundle Size Report
✅ All size limits passed! |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@apps/www/content/docs/bun-plugin/index.mdx`:
- Around line 121-150: Add a short prerequisite note to this section stating
that external validators (e.g., Zod or Valibot) must be installed when used
alongside ArkType; specifically call out the imported symbol "z" from "zod" in
the src/env.ts example and provide a one-line install suggestion (e.g., install
zod or valibot) so readers don't get an unresolved-module error when copying the
snippet; update the prose around the code block mentioning the dependency and,
if helpful, list the package names "zod" and "valibot" as optional
prerequisites.
In `@apps/www/content/docs/vite-plugin/index.mdx`:
- Around line 87-106: Add a brief prerequisite note above the "Using Standard
Schema validators (Zod, Valibot)" example that calls out external validator
packages must be installed (e.g., zod or valibot) when using Standard Schema
validators; reference the example's import { z } from "zod" and the Env = type({
... }) usage so readers know to run npm/yarn install for those validator
packages before copying the vite.config.ts snippet.
In `@apps/www/lib/twoslash-options.ts`:
- Line 28: The CLI's MDX twoslash regex in apps/www/bin/twoslash-mdx.ts
currently only matches (ts|js) code blocks so newly added "tsx"/"jsx" blocks
from twoslash-options.ts won't be processed; update the regex (the
codeBlockRegex or equivalent constant used in twoslash-mdx.ts) to include tsx
and jsx (i.e. match ts|tsx|js|jsx) so the CLI path picks up those code fences
and captures their content the same way as ts/js blocks.
In `@openspec/changes/improve-plugin-docs/design.md`:
- Line 44: The doc mentions arkenvVitePlugin(Env) but the implemented docs use
arkenv(Env); update the reference in the design text to match the implemented
API by replacing arkenvVitePlugin(Env) with arkenv(Env) (or vice versa if you
intend to change the implementation) and ensure the example and any surrounding
text refer to the same symbol (arkenv(Env)) as used in
apps/www/content/docs/vite-plugin/index.mdx.
In `@openspec/changes/improve-plugin-docs/walkthrough.md`:
- Line 38: The walkthrough uses a different env key (VITE_MY_ENV) than the
examples (VITE_MY_VAR); update the walkthrough sentence that mentions export
const Env in the vite.config.ts / vite-env.d.ts snippet to use the same key name
as the examples (VITE_MY_VAR) so import.meta.env.VITE_MY_VAR is consistently
referenced across the walkthrough and example schema.
🪄 Autofix (Beta)
✅ Autofix completed
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 1e6dbfcf-0618-4235-9d38-11cdb88f2457
📒 Files selected for processing (28)
apps/playgrounds/vite/README.mdapps/playgrounds/vite/src/vite-env.d.tsapps/www/content/docs/bun-plugin/index.mdxapps/www/content/docs/bun-plugin/typing-process-env.mdxapps/www/content/docs/vite-plugin/arkenv-in-viteconfig.mdxapps/www/content/docs/vite-plugin/index.mdxapps/www/content/docs/vite-plugin/meta.jsonapps/www/content/docs/vite-plugin/typing-import-meta-env.mdxapps/www/lib/twoslash-options.tsapps/www/source.config.tsexamples/with-vite-react/README.mdopenspec/changes/archive/2025-11-20-add-arkenv-vite-config/design.mdopenspec/changes/archive/2025-11-20-add-arkenv-vite-config/proposal.mdopenspec/changes/archive/2025-11-20-add-arkenv-vite-config/specs/vite-config-usage/spec.mdopenspec/changes/archive/2025-11-20-add-arkenv-vite-config/tasks.mdopenspec/changes/archive/2025-11-20-fix-vite-plugin-env-filter/design.mdopenspec/changes/archive/2025-11-28-add-bun-plugin/design.mdopenspec/changes/archive/2025-11-28-add-bun-plugin/proposal.mdopenspec/changes/archive/2025-12-22-coercion-public-api/proposal.mdopenspec/changes/archive/2026-01-21-fix-standard-mode-inference/proposal.mdopenspec/changes/improve-plugin-docs/design.mdopenspec/changes/improve-plugin-docs/proposal.mdopenspec/changes/improve-plugin-docs/tasks.mdopenspec/changes/improve-plugin-docs/walkthrough.mdopenspec/specs/vite-config-usage/spec.mdpackages/arkenv/CHANGELOG.mdpackages/arkenv/src/standard-mode.test.tspackages/vite-plugin/CHANGELOG.md
|
Note Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it. Fixes Applied SuccessfullyFixed 5 file(s) based on 5 unresolved review comments. Files modified:
Commit: The changes have been pushed to the Time taken: |
Fixed 5 file(s) based on 5 unresolved review comments. Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
apps/www/bin/twoslash-mdx.ts (1)
17-18: ⚡ Quick winDerive fence languages from shared Twoslash config to prevent drift.
This regex duplicates
arktypeTwoslashOptions.langs; future updates can silently desync extraction vs processing. Build the alternation from the sharedlangslist instead.♻️ Proposed refactor
-const codeBlockRegex = - /```(ts|tsx|js|jsx) twoslash(?:.*)\r?\n([\s\S]*?)\r?\n```/g; +const escapedLangs = arktypeTwoslashOptions.langs + .map((lang) => lang.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")) + .join("|"); + +const codeBlockRegex = new RegExp( + "```(" + escapedLangs + ")\\s+twoslash(?:.*)\\r?\\n([\\s\\S]*?)\\r?\\n```", + "g", +);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/www/bin/twoslash-mdx.ts` around lines 17 - 18, Replace the hard-coded language alternation in the existing const codeBlockRegex with a RegExp built from arktypeTwoslashOptions.langs: map and escape each lang (escape special regex chars), join them with "|" to form the alternation, then construct a new RegExp string that captures the language group and the twoslash code block body (preserving the same capture groups and \r?\n handling) and instantiate it with the "g" flag; overwrite the previous codeBlockRegex declaration so extraction stays in sync with arktypeTwoslashOptions.langs.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@apps/www/content/docs/vite-plugin/index.mdx`:
- Line 4: Update the description string at the top of the MDX (the line that
currently reads "The ArkEnv plugin for Vite lets you validate environment
variables at build-time with ArkEnv") to end with "with ArkType" instead of
"with ArkEnv" so it reads "The ArkEnv plugin for Vite lets you validate
environment variables at build-time with ArkType"; edit the description field in
the document (the same line shown in the diff) to replace the trailing "ArkEnv"
with "ArkType".
- Line 4: Update the description frontmatter in
apps/www/content/docs/vite-plugin/index.mdx: replace the trailing phrase "with
ArkEnv" with "with ArkType" so the sentence reads "The ArkEnv plugin for Vite
lets you validate environment variables at build-time with ArkType." Locate and
edit the description string in the file's frontmatter (the line starting with
description:) to make this one-word replacement.
---
Nitpick comments:
In `@apps/www/bin/twoslash-mdx.ts`:
- Around line 17-18: Replace the hard-coded language alternation in the existing
const codeBlockRegex with a RegExp built from arktypeTwoslashOptions.langs: map
and escape each lang (escape special regex chars), join them with "|" to form
the alternation, then construct a new RegExp string that captures the language
group and the twoslash code block body (preserving the same capture groups and
\r?\n handling) and instantiate it with the "g" flag; overwrite the previous
codeBlockRegex declaration so extraction stays in sync with
arktypeTwoslashOptions.langs.
🪄 Autofix (Beta)
✅ Autofix completed
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 6c12d0b9-2578-457c-8e25-2a146913fa32
⛔ Files ignored due to path filters (2)
examples/with-bun-react/bun.lockis excluded by!**/*.lockexamples/with-bun/bun.lockis excluded by!**/*.lock
📒 Files selected for processing (6)
apps/www/bin/twoslash-mdx.tsapps/www/content/docs/bun-plugin/index.mdxapps/www/content/docs/vite-plugin/index.mdxexamples/with-vite-react/src/vite-env.d.tsopenspec/changes/improve-plugin-docs/design.mdopenspec/changes/improve-plugin-docs/walkthrough.md
🚧 Files skipped from review as they are similar to previous changes (3)
- openspec/changes/improve-plugin-docs/walkthrough.md
- apps/www/content/docs/bun-plugin/index.mdx
- openspec/changes/improve-plugin-docs/design.md
|
Note Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it. Fixes Applied SuccessfullyFixed 1 file(s) based on 1 unresolved review comment. Files modified:
Commit: The changes have been pushed to the Time taken: |
Fixed 1 file(s) based on 1 unresolved review comment. Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
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)
apps/www/content/docs/vite-plugin/index.mdx (1)
132-137:⚠️ Potential issue | 🟡 Minor | ⚡ Quick win"Static Analysis" feature description misleads about the plugin's actual role.
The documented claim that the plugin "Automatically replaces
import.meta.env.VARIABLEwith validated values during the build" overstates ArkEnv's responsibility. The plugin validates environment variables using its schema and configures Vite'sdefineoption to expose them. The actual replacement and inlining of values is Vite's standard behavior, not unique to ArkEnv. Reword the bullet to emphasize the plugin's core feature—validation against a schema—rather than the replacement mechanism, which Vite handles automatically.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/www/content/docs/vite-plugin/index.mdx` around lines 132 - 137, Update the "Static Analysis" bullet to avoid claiming ArkEnv performs value replacement; instead state that ArkEnv validates env vars against a schema and configures Vite's define option to expose validated values, leaving the actual inlining/replacement to Vite; specifically edit the bullet that mentions `import.meta.env.VARIABLE` and reference ArkEnv and Vite's `define` behavior (`define`) so the text emphasizes schema validation and configuration rather than implying ArkEnv does the replacement.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/www/content/docs/vite-plugin/index.mdx`:
- Around line 7-16: Update the installation example in the package-install block
so it installs both the plugin and its peer dependency: change the current
package line that reads "@arkenv/vite-plugin arkenv" to explicitly include
"arktype" as well, ensuring users run a single install command that lists
arkenv/vite-plugin, arkenv, and arktype to avoid missing peer dependency import
errors.
---
Outside diff comments:
In `@apps/www/content/docs/vite-plugin/index.mdx`:
- Around line 132-137: Update the "Static Analysis" bullet to avoid claiming
ArkEnv performs value replacement; instead state that ArkEnv validates env vars
against a schema and configures Vite's define option to expose validated values,
leaving the actual inlining/replacement to Vite; specifically edit the bullet
that mentions `import.meta.env.VARIABLE` and reference ArkEnv and Vite's
`define` behavior (`define`) so the text emphasizes schema validation and
configuration rather than implying ArkEnv does the replacement.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 102ba14b-2dbb-4462-858b-091ad0aea84b
📒 Files selected for processing (1)
apps/www/content/docs/vite-plugin/index.mdx
…include arktype dependency in installation instructions
…y instead of passing an array
Summary by CodeRabbit
Documentation
Improvements