feat(skills,cli): adapt ArkEnv skill and CLI for framework plugins#943
Conversation
- Updated arkenv skill in SKILL.md to emphasize plugin usage and type augmentation. - Modified CLI template generation to export only the schema (Env) for Vite projects. - Added test cases for Vite template generation in the CLI. - Improved CLI templates to export the schema (Env) by default even in Node.js. Fixes #940
🦋 Changeset detectedLatest commit: 8f66e2a The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughCLI template generators were made framework-aware: Vite and Bun emit schema-only modules for plugin/augmentation use, while Node (default) emits runtime-validated ChangesFramework-aware template generation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 |
|
🤖 Hi @yamcodes, I've received your request, and I'm working on it now! You can track my progress in the logs for more details. |
|
🤖 I'm sorry @yamcodes, but I was unable to process your request. Please see the logs for more details. |
arkenv
@arkenv/bun-plugin
@arkenv/cli
@arkenv/fumadocs-ui
@arkenv/vite-plugin
commit: |
📦 Bundle Size Report✅ All size limits passed! |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/cli/src/env-template.test.ts (1)
35-59: ⚡ Quick winConsider adding Vite-specific test coverage for Zod and Valibot.
The new Vite template generation logic is only tested for the
arktypevalidator (lines 20-33). The Zod and Valibot templates also have Vite-specific branches (inzod.tsandvalibot.ts) that generate schema-only exports, but these aren't covered by tests.🧪 Suggested test additions
Add similar test cases for Zod and Valibot:
it("returns zod template for vite when validator is zod", () => { const options = { validator: "zod" as any, framework: "vite" as any, path: ".env.config.ts", language: "ts" as const, shouldUpdateTsConfig: false, shouldInstall: false, }; const template = getEnvTemplate(options); expect(template).toContain('import { z } from "zod"'); expect(template).not.toContain("export const env = arkenv(Env)"); expect(template).toContain("export const Env = z.object({"); }); it("returns valibot template for vite when validator is valibot", () => { const options = { validator: "valibot" as any, framework: "vite" as any, path: ".env.config.ts", language: "ts" as const, shouldUpdateTsConfig: false, shouldInstall: false, }; const template = getEnvTemplate(options); expect(template).toContain('import * as v from "valibot"'); expect(template).not.toContain("export const env = arkenv(Env)"); expect(template).toContain("export const Env = v.object({"); });🤖 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 `@packages/cli/src/env-template.test.ts` around lines 35 - 59, Add Vite-specific test cases for Zod and Valibot in the same test file where getEnvTemplate is exercised: create two new tests that call getEnvTemplate with options.validator set to "zod" and "valibot" respectively and framework set to "vite" (same shape as existing tests), then assert the template contains the respective import strings ('import { z } from "zod"' and 'import * as v from "valibot"'), assert it does NOT contain the runtime export 'export const env = arkenv(Env)', and assert it contains the schema-only export lines ('export const Env = z.object({' for zod and 'export const Env = v.object({' for valibot) to cover the Vite branches implemented in zod.ts and valibot.ts when invoking getEnvTemplate.
🤖 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.
Nitpick comments:
In `@packages/cli/src/env-template.test.ts`:
- Around line 35-59: Add Vite-specific test cases for Zod and Valibot in the
same test file where getEnvTemplate is exercised: create two new tests that call
getEnvTemplate with options.validator set to "zod" and "valibot" respectively
and framework set to "vite" (same shape as existing tests), then assert the
template contains the respective import strings ('import { z } from "zod"' and
'import * as v from "valibot"'), assert it does NOT contain the runtime export
'export const env = arkenv(Env)', and assert it contains the schema-only export
lines ('export const Env = z.object({' for zod and 'export const Env =
v.object({' for valibot) to cover the Vite branches implemented in zod.ts and
valibot.ts when invoking getEnvTemplate.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 7f30b4b0-0a0f-47c6-b096-67e77e038829
📒 Files selected for processing (6)
packages/cli/src/env-template.test.tspackages/cli/src/env-template.tspackages/cli/src/templates/arktype.tspackages/cli/src/templates/valibot.tspackages/cli/src/templates/zod.tsskills/arkenv/SKILL.md
- Updated SKILL.md to stress use of import.meta.env (Vite) and process.env (Bun). - Updated CLI templates for Bun to provide schema-only export by default. - Added test case for Bun template generation.
|
The latest updates on your projects. Learn more about Vercel for GitHub. Warning Rate limit exceeded@yamcodes has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 12 minutes and 35 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered by pushing new commits to this PR or by re-running the workflow. We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?We enforce hourly and daily rate limits to ensure stability and fair usage of resources. |
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/cli@0.0.4 ### Patch Changes - #### Add ArkEnv Agent Skill as recommended next step _[`#944`](#944) [`718fb4b`](718fb4b) [@yamcodes](https://github.com/yamcodes)_ - #### Adapt CLI templates for framework plugins (Vite/Bun) _[`#943`](#943) [`eba2f83`](eba2f83) [@yamcodes](https://github.com/yamcodes)_ ## @arkenv/fumadocs-ui@0.0.8 ### Patch Changes - #### Fix hamburger menu fade-in behavior on mobile _[`#935`](#935) [`f1ee3de`](f1ee3de) [@yamcodes](https://github.com/yamcodes)_ Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Fixes #940
This PR updates the ArkEnv skill and the CLI to follow best practices for framework plugins (Vite/Bun).
Key changes:
@arkenv/vite-pluginand@arkenv/bun-plugin, emphasizing type augmentation forimport.meta.envandprocess.env.Env) for Vite projects, discouraging the use of runtime-validatedenvimports in the frontend.Env) is now exported by default in all templates to allow easy integration with plugins.Summary by CodeRabbit
New Features
Documentation
Tests
Chores