Skip to content

Support arkenv add host [provider] for flat layouts (Phase 2) - #1324

Merged
yamcodes merged 7 commits into
yamcodes:devfrom
abhimanyutiwaribot:add-host-preset-phase-2
Jul 20, 2026
Merged

Support arkenv add host [provider] for flat layouts (Phase 2)#1324
yamcodes merged 7 commits into
yamcodes:devfrom
abhimanyutiwaribot:add-host-preset-phase-2

Conversation

@abhimanyutiwaribot

Copy link
Copy Markdown
Contributor

Description

Support the command arkenv add host [provider] to dynamically add hosting provider presets (Vercel, Netlify) to an existing env.ts config file. the change, auto detects the framework prefix and validator (ie. zod, valibot, or arktype) to inject the correct schemas.
if env.ts is missing or unparseable, it prints the proposed fields (the command prints the keys to stdout and exits gracefully with a message).

Fixes #1267

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactor

Checklist

  • My code follows the code style of this project (double quotes, tabs, no parameter reassignment).
  • I have written sentence-case imperative commits / PR title (e.g. Add support for custom error messages - no feat:, no trailing period, capitalized).
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have created a changeset using pnpm changeset (if this affects a published package).

For v0 (dev) PRs:

  • Forward-Porting: (For maintainers) Has this change been manually forward-ported to the v1 branch?

Images

1.Screenshot 2026-07-16 175637

2.Screenshot 2026-07-16 175700

3.Screenshot 2026-07-16 181215

@changeset-bot

changeset-bot Bot commented Jul 16, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e894a3e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@arkenv/cli Patch

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

@github-actions github-actions Bot added tests This issue or PR is about adding, removing or changing tests @arkenv/cli Issues or Pull Requests involving the ArkEnv CLI labels Jul 16, 2026
@pkg-pr-new

pkg-pr-new Bot commented Jul 16, 2026

Copy link
Copy Markdown

Open in StackBlitz

arkenv

npm i https://pkg.pr.new/arkenv@1324

@arkenv/build

npm i https://pkg.pr.new/@arkenv/build@1324

@arkenv/bun-plugin

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

@arkenv/cli

npm i https://pkg.pr.new/@arkenv/cli@1324

@arkenv/fumadocs-ui

npm i https://pkg.pr.new/@arkenv/fumadocs-ui@1324

@arkenv/nextjs

npm i https://pkg.pr.new/@arkenv/nextjs@1324

@arkenv/nuxt

npm i https://pkg.pr.new/@arkenv/nuxt@1324

@arkenv/vite-plugin

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

commit: e894a3e

@github-actions github-actions Bot added the docs Adds or changes documentation, or acts as documentation in and of itself label Jul 16, 2026

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Important

Two issues need attention before merge: the PR is missing a changeset for the new @arkenv/cli feature, and arkenv add host does not respect the global --agent/--yes non-interactive flag when the provider is omitted.

Reviewed changes — Added the arkenv add host [provider] command, including CLI parsing, prompt wiring, a new AddUseCase, and an AST-based mutateEnvConfig helper that injects Vercel/Netlify preset keys into an existing flat env.ts schema.

  • Add AddUseCase and wire it through composition/dispatchpackages/cli/src/cli/commands/add.ts, packages/cli/src/cli/composition.ts, packages/cli/src/index.ts
  • Parse add host [provider] in CLIpackages/cli/src/cli/cli.ts
  • Add select prompt to PromptPortpackages/cli/src/adapters/prompt.adapter.ts, packages/cli/src/shared/ports/prompt.port.ts
  • Add mutateEnvConfig AST helperpackages/cli/src/features/config-mutation/config-mutation.ts
  • Update help output and add testspackages/cli/src/cli/commands/help.ts, help.test.ts, cli.test.ts, add.test.ts, config-mutation.test.ts

⚠️ No changeset for the new command

This PR introduces a published-package feature for @arkenv/cli and the checklist claims a changeset was created, but .changeset/ contains no new changeset file. Without one, the change will not be included in a release.

Technical details
# No changeset for the new command

## Affected sites
- `.changeset/` — no new changeset file present for `@arkenv/cli`

## Required outcome
- Add a changeset describing the new `arkenv add host [provider]` command and the planned version bump for `@arkenv/cli`.

Pullfrog  | Fix all ➔Fix 👍s ➔View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏

Comment thread packages/cli/src/cli/commands/add.ts
Comment thread packages/cli/src/cli/commands/add.ts Outdated
Comment thread packages/cli/src/cli/commands/add.ts Outdated

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ The previously missing changeset has been added; the agent-mode concern from the prior review remains unresolved.

Reviewed changes — The incremental commit adds a correctly-formatted changeset for the new arkenv add host [provider] command.

  • Add changeset for @arkenv/cli.changeset/add-host-preset-add-command.md

Pullfrog  | Fix it ➔View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏

Support adding a hosting provider preset (Vercel or Netlify) to an existing `env.ts` configuration file:

```bash
npx arkenv add host [provider]

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Suggested change
npx arkenv add host [provider]
npx @arkenv/cli@latest add host [provider]

}

/**
* Prompts the user to select one option from a list.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

(nitpick)

Suggested change
* Prompts the user to select one option from a list.
* Prompt the user to select one option from a list.

Comment thread packages/cli/src/cli/commands/add.ts
Comment thread packages/cli/src/cli/commands/add.ts Outdated
Comment thread packages/cli/src/cli/commands/add.ts Outdated
Comment on lines +8 to +14
import type { Framework, Validator } from "../scaffold/plan";
import {
getFieldDefinition,
getFrameworkPrefix,
getPresetKeys,
type HostPreset,
} from "../scaffold/templates/presets";

@yamcodes yamcodes Jul 20, 2026

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Suggested change
import type { Framework, Validator } from "../scaffold/plan";
import {
getFieldDefinition,
getFrameworkPrefix,
getPresetKeys,
type HostPreset,
} from "../scaffold/templates/presets";
import {
getFieldDefinition,
getFrameworkPrefix,
getPresetKeys,
type HostPreset,
type Framework,
type Validator
} from "@/features/scaffold";

}

/**
* Transforms an env.ts schema file by merging host preset keys.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Suggested change
* Transforms an env.ts schema file by merging host preset keys.
* Transform an env.ts schema file by merging host preset keys.

isYes?: boolean,
): Promise<ProjectOptions | null>;
/**
* Prompts the user to select one option from a list.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Suggested change
* Prompts the user to select one option from a list.
* Prompt the user to select one option from a list.

Comment thread packages/cli/src/index.ts

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Consider a better approach than these if-else chains

@abhimanyutiwaribot
abhimanyutiwaribot force-pushed the add-host-preset-phase-2 branch from 5b6ed5a to bf265be Compare July 20, 2026 16:41

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No critical issues — minor suggestions inline.

Reviewed changes — the incremental commits since the prior review addressed the outstanding feedback for the arkenv add host [provider] command.

  • Added isYes to AddInput so --yes/--agent skips the provider prompt and defaults to Vercel.
  • Expanded env.ts discovery to check ./env.ts, src/env.ts, and the scanner-suggested path.
  • Extracted detectValidator to strip comments and match Zod/Valibot import statements, with unit tests.
  • Refactored index.ts command dispatch into a command map and shared error-handling path.
  • Fixed changeset command example and JSDoc wording from the prior review.

Pullfrog  | Fix all ➔Fix 👍s ➔View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏

Comment thread packages/cli/src/cli/commands/add.ts Outdated

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes — the commits since the prior review tightened validator import detection and added coverage for multi-line imports.

  • Support multi-line import { ... } from "zod" / from "valibot" in detectValidatorpackages/cli/src/cli/commands/add.ts
  • Add unit tests for multi-line Zod and Valibot importspackages/cli/src/cli/commands/add.test.ts

Pullfrog  | View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏

@yamcodes

Copy link
Copy Markdown
Owner

What a nice PR @abhimanyutiwaribot! Killing it 🚀

@yamcodes
yamcodes merged commit eed3cce into yamcodes:dev Jul 20, 2026
21 checks passed
@arkenv-bot arkenv-bot Bot mentioned this pull request Jul 20, 2026
yamcodes added a commit that referenced this pull request Jul 20, 2026
Bring arkenv add host [provider] onto v1, adapting field rendering to
dialects and FRAMEWORK_CLIENT_PREFIXES instead of the v0 template helpers.

Co-authored-by: Cursor <cursoragent@cursor.com>
yamcodes added a commit that referenced this pull request Jul 20, 2026
## Summary
- Forward-ports [#1324](#1324)
(`arkenv add host [provider]`) from `dev` onto `v1`
- Re-implements under `packages/arkenv/` (v1 CLI) with dialect-based
field rendering via `DIALECTS` / `tryFormatPresetFieldValue` and
`FRAMEWORK_CLIENT_PREFIXES`
- Adds `mutateEnvConfig`, prompt `select`, help/parser coverage, and a
`minor` changeset for `arkenv`

Fixes #1267 (v1 parity)

## Test plan
- [x] `pnpm --filter arkenv exec vitest run` (342 tests)
- [x] `pnpm --filter arkenv typecheck`
- [ ] Manually: `arkenv add host vercel` against a flat `env.ts`
- [ ] Manually: `arkenv add host` interactive prompt and
missing-`env.ts` fallback


Made with [Cursor](https://cursor.com)

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
yamcodes pushed a commit that referenced this pull request Jul 20, 2026
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 dev, this PR will
be updated.


# Releases
## @arkenv/cli@0.5.1

### Patch Changes

- #### Add `add host` command to CLI for adding hosting presets to
existing schemas
_[`#1324`](#1324)
[`eed3cce`](eed3cce)
[@abhimanyutiwaribot](https://github.com/abhimanyutiwaribot)_

Support adding a hosting provider preset (Vercel or Netlify) to an
existing `env.ts` configuration file:

  ```bash
  npx @arkenv/cli@latest add host [provider]
  ```

- Prompts interactively to select Vercel or Netlify if the provider is
omitted.
- Auto-detects the framework (Next.js, Nuxt, Vite, Bun) and the
validator engine (Zod, Valibot, or ArkType) to inject the preset fields
with the correct syntax.
- Fallback to logging the generated variable schemas to stdout with
manual configuration instructions if `env.ts` is missing or unparseable.
## @arkenv/nuxt@0.0.7

### Patch Changes

- #### Fix number and boolean env values returning as strings
_[`#1420`](#1420)
[`aecac94`](aecac94)
[@yamcodes](https://github.com/yamcodes)_

Keep coerced types when reading from `env`. A key declared as `"number"`
or `"boolean"` now returns a number or boolean at runtime, not the raw
string from Nuxt runtime config.

  ```ts
  import { createEnv } from "@arkenv/nuxt";

  export const env = createEnv({
    NUXT_PUBLIC_PORT: "number",
    PORT: "number",
  });

  // Was "3000" (string) — now 3000 (number)
  env.NUXT_PUBLIC_PORT;
  env.PORT;
  ```

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

@arkenv/cli Issues or Pull Requests involving the ArkEnv CLI docs Adds or changes documentation, or acts as documentation in and of itself tests This issue or PR is about adding, removing or changing tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support arkenv add host for flat layouts (Phase 2)

2 participants