Introduction
Quickly scaffold ArkEnv projects with an interactive CLI.
The ArkEnv CLI is the command-line interface used to initialize and configure ArkEnv in your project.
Usage
Run the CLI using your package manager of choice. The CLI will guide you through the setup process interactively.
npx @arkenv/cli@latest init [project-name] [options]pnpm dlx @arkenv/cli@latest init [project-name] [options]yarn dlx @arkenv/cli@latest init [project-name] [options]bunx @arkenv/cli@latest init [project-name] [options]Behavior
The CLI automatically adjusts its workflow depending on where it is executed:
- Existing project: If a
package.jsonexists in the target directory, the CLI configures ArkEnv directly in the project. It scans for any.envor.env.examplefiles to automatically pre-populate the schema fields, installs the selected validator dependencies, and generates theenv.tsfile. - New project: If the target directory does not contain a
package.jsonand is empty, the CLI guides you through creating a new project from an ArkEnv starter template. See our official examples for a list of available templates.
Options
Configure the CLI behavior using the following command-line flags:
| Flag | Alias | Description |
|---|---|---|
--yes | -y | Skip all prompts and use the default configuration. |
--quiet | -q | Suppress all output logs unless an error occurs. |
--json | -j | Print a structured JSON summary to stdout upon completion. |
--agent | -a | Enable non-interactive, machine-readable mode for AI agents. Bypasses all prompts and outputs structured JSON. Macro for --yes --quiet --json. |
--example | -e | Specify an example name when creating a new project. |
--force | -f | Bypass checks and force initialization. |
--no-codegen | -C | Disable automatic env.gen.ts code generation for Next.js (falls back to manual runtimeEnv destructuring). |
--help | -h | Display the CLI help information. |