Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
4f2f093
docs: propose varlock integration for schema-validated env files
fengmk2 Oct 28, 2026
59377ce
wip: add vp dotenv and the varlock Vite integration
fengmk2 Oct 28, 2026
76d13e6
fix(dotenv): address review findings in the varlock integration
fengmk2 Oct 28, 2026
66f95fe
fix(dotenv): bundle varlock for SSR and require a schema
fengmk2 Oct 28, 2026
627e417
fix(dotenv): check a required schema against the merged config
fengmk2 Oct 28, 2026
23ff863
fix(dotenv): keep a direct varlock for types and survive closed pipes
fengmk2 Oct 29, 2026
e7c49da
chore(deps): lock varlock and its Vite integration
fengmk2 Oct 29, 2026
90cab73
fix(dotenv): list dotenv and varlock everywhere, record snapshots
fengmk2 Oct 29, 2026
8a5140d
fix(dotenv): keep the temporary PATH out of varlock's env snapshot
fengmk2 Oct 29, 2026
8e2dca3
fix(dotenv): fail Vitest on invalid env, pin the root, defer the import
fengmk2 Oct 29, 2026
cf3ca0f
fix(dotenv): validate in container test roots, allow one schema per p…
fengmk2 Oct 29, 2026
96bfe24
fix(dotenv): pin the integration to the detected schema root
fengmk2 Oct 29, 2026
a06cf9f
fix(dotenv): keep sensitive values out of import.meta.env, guard preview
fengmk2 Oct 29, 2026
4d4dacf
fix(dotenv): cover independent test projects, reject mixed schemas
fengmk2 Oct 30, 2026
27247f4
chore(deps): update varlock to 1.25.0 and its Vite integration to 1.5.6
fengmk2 Nov 20, 2026
9728fe4
fix(dotenv): point users from `vp env` and `.env` to `vp dotenv`
fengmk2 Dec 3, 2026
c94e660
docs(dotenv): explain the direct varlock dependency, skip import.meta…
fengmk2 Dec 3, 2026
749270f
fix(dotenv): pin varlock after init, export from vite-plus/dotenv, fo…
fengmk2 Dec 3, 2026
8a001cd
fix(dotenv): add varlock before varlock init so it skips its own install
fengmk2 Dec 3, 2026
e701c50
feat(dotenv): type ENV through a vite-plus varlock plugin, add no var…
fengmk2 Dec 3, 2026
07dbb89
feat(dotenv): work with Vite modes, the VITE_ prefix, and ENV in vite…
fengmk2 Dec 3, 2026
60233d4
feat(dotenv): follow the Vite mode through viteMode()
fengmk2 Dec 3, 2026
cc78061
feat(migrate): move an existing varlock Vite setup to Vite+
fengmk2 Dec 4, 2026
2e7fe90
feat(dotenv): add vp dotenv encrypt and lock, mark vp dotenv experime…
fengmk2 Dec 4, 2026
a82db6d
feat(dotenv): add vp dotenv keychain for macOS Keychain items
fengmk2 Dec 4, 2026
3a56a2c
fix(dotenv): count every item in check, adapt init to servers
fengmk2 Dec 4, 2026
cb84294
docs(rfc): explain why the dotenv command is exec, not run
fengmk2 Dec 4, 2026
74cb686
fix(dotenv): find a schema header without a divider
fengmk2 Dec 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ Use `vp migrate` to migrate to Vite+. It merges tool-specific config files such
- **lint** - Lint code
- **fmt** - Format code
- **test** - Run tests
- **dotenv** - Validate and inspect project environment variables using `.env.schema` (experimental)

#### Execute

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Develop:
lint Lint code
fmt, format Format code
test Run tests
dotenv Validate and inspect project environment variables using .env.schema

Execute:
run Run tasks (also available as standalone `vpr`)
Expand Down Expand Up @@ -84,6 +85,7 @@ Tools:
oxlint <version>
tsrs <version>
tsdown <version>
varlock <version>

Environment:
Package manager Not found
Expand Down Expand Up @@ -475,6 +477,7 @@ VITE+ - The Unified Toolchain for the Web
Usage: vp env [COMMAND]

Manage Node.js and package-manager environments
For project environment variables, see vp dotenv.

Setup:
setup Create or update shims in VP_HOME/bin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Core Commands:
config Configure hooks and agent integration
hooks Manage the Git hook dispatcher
staged Run linters on staged files
dotenv Validate and inspect project environment variables using .env.schema
toolchain Show Vite+ tool versions and relationships

Package Manager Commands:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[[case]]
name = "command_dotenv_help"
vp = ["local", "global"]
steps = [
{ argv = ["vp", "dotenv", "-h"], continue-on-failure = true },
{ argv = ["vp", "dotenv", "print", "--help"], continue-on-failure = true },
{ argv = ["vp", "help", "dotenv"], continue-on-failure = true },
]

[[case]]
name = "command_dotenv_errors"
vp = "global"
steps = [
{ argv = ["vp", "dotenv", "check"], comment = "fails without a schema instead of passing an empty config", continue-on-failure = true },
{ argv = ["vp", "dotenv", "exec", "--env", "production", "--", "node"], comment = "an option before the command is rejected, not run as the command", continue-on-failure = true },
{ argv = ["vp", "dotenv", "print", "--format", "yaml"], continue-on-failure = true },
]

[[case]]
name = "command_dotenv_schema"
vp = "global"
steps = [
{ argv = ["vpt", "write-file", ".env.schema", "# @defaultSensitive=false\n# ---\n\n# @type=url\nAPI_URL=http://localhost:3000\n\n# @required @sensitive\nSTRIPE_SECRET_KEY=\n"], snapshot = false },
{ argv = ["vp", "dotenv", "check"], comment = "the required secret has no value", continue-on-failure = true },
{ argv = ["vpt", "write-file", ".env.local", "STRIPE_SECRET_KEY=sk_test_1234567890abcdef\n"], snapshot = false },
{ argv = ["vp", "dotenv", "check"], continue-on-failure = true },
{ argv = ["vp", "dotenv", "print"], comment = "the secret is masked", continue-on-failure = true },
{ argv = ["vp", "dotenv", "print", "--format", "json"], continue-on-failure = true },
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# command_dotenv_errors

## `vp dotenv check`

fails without a schema instead of passing an empty config

**Exit code:** 1

```
error: No .env.schema in <workspace>, and its package.json sets no `varlock.loadPath`. Run this command from the project root, or run `vp dotenv init` to create a schema.
```

## `vp dotenv exec --env production -- node`

an option before the command is rejected, not run as the command

**Exit code:** 1

```
VITE+ - The Unified Toolchain for the Web

error: unexpected argument '--env' found

tip: to pass '--env' as a value, use '-- --env'

Usage: vp dotenv exec [OPTIONS] <COMMAND>...

For more information, try '--help'.
```

## `vp dotenv print --format yaml`

**Exit code:** 1

```
VITE+ - The Unified Toolchain for the Web

error: invalid value 'yaml' for '--format <format>'
[possible values: env, json, shell]

For more information, try '--help'.
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# command_dotenv_help

## `vp dotenv -h`

```
VITE+ - The Unified Toolchain for the Web

Usage: vp dotenv <COMMAND> [OPTIONS]

Validate project environment variables against .env.schema, including values supplied by CI.

Options:
-h, --help Show this help message

Commands:
init Create .env.schema from the existing .env files
check Validate the .env files against .env.schema without printing values
print Print the resolved values, with sensitive values masked
explain Show how config items resolve, with sensitive values masked
scan Find plaintext copies of sensitive values in files
exec Run a command with the resolved environment
encrypt Encrypt a value with a key stored on this device
lock Require biometric authentication for the next decryption
keychain Manage the macOS Keychain items that keychain() reads (macOS only)

Examples:
vp dotenv init
vp dotenv check
vp dotenv print --format json
vp dotenv scan --staged
vp dotenv exec -- node scripts/seed.ts
vp dotenv encrypt --file .env.local

Documentation: https://viteplus.dev/guide/dotenv
```

## `vp dotenv print --help`

```
VITE+ - The Unified Toolchain for the Web

Usage: vp dotenv print [OPTIONS]

Print the resolved values, with sensitive values masked

Options:
--env <name> Environment to load, such as production (@currentEnv takes priority)
--mode <name> Vite mode for viteMode() in .env.schema, as in vp build --mode
--format <format> Output format
--reveal Print sensitive values in plaintext
-h, --help Show this help message

Documentation: https://viteplus.dev/guide/dotenv
```

## `vp help dotenv`

```
VITE+ - The Unified Toolchain for the Web

Usage: vp dotenv <COMMAND> [OPTIONS]

Validate project environment variables against .env.schema, including values supplied by CI.

Options:
-h, --help Show this help message

Commands:
init Create .env.schema from the existing .env files
check Validate the .env files against .env.schema without printing values
print Print the resolved values, with sensitive values masked
explain Show how config items resolve, with sensitive values masked
scan Find plaintext copies of sensitive values in files
exec Run a command with the resolved environment
encrypt Encrypt a value with a key stored on this device
lock Require biometric authentication for the next decryption
keychain Manage the macOS Keychain items that keychain() reads (macOS only)

Examples:
vp dotenv init
vp dotenv check
vp dotenv print --format json
vp dotenv scan --staged
vp dotenv exec -- node scripts/seed.ts
vp dotenv encrypt --file .env.local

Documentation: https://viteplus.dev/guide/dotenv
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# command_dotenv_help

## `vp dotenv -h`

```
VITE+ - The Unified Toolchain for the Web

Usage: vp dotenv <COMMAND> [OPTIONS]

Validate project environment variables against .env.schema, including values supplied by CI.

Options:
-h, --help Show this help message

Commands:
init Create .env.schema from the existing .env files
check Validate the .env files against .env.schema without printing values
print Print the resolved values, with sensitive values masked
explain Show how config items resolve, with sensitive values masked
scan Find plaintext copies of sensitive values in files
exec Run a command with the resolved environment
encrypt Encrypt a value with a key stored on this device
lock Require biometric authentication for the next decryption
keychain Manage the macOS Keychain items that keychain() reads (macOS only)

Examples:
vp dotenv init
vp dotenv check
vp dotenv print --format json
vp dotenv scan --staged
vp dotenv exec -- node scripts/seed.ts
vp dotenv encrypt --file .env.local

Documentation: https://viteplus.dev/guide/dotenv
```

## `vp dotenv print --help`

```
VITE+ - The Unified Toolchain for the Web

Usage: vp dotenv print [OPTIONS]

Print the resolved values, with sensitive values masked

Options:
--env <name> Environment to load, such as production (@currentEnv takes priority)
--mode <name> Vite mode for viteMode() in .env.schema, as in vp build --mode
--format <format> Output format
--reveal Print sensitive values in plaintext
-h, --help Show this help message

Documentation: https://viteplus.dev/guide/dotenv
```

## `vp help dotenv`

```
VITE+ - The Unified Toolchain for the Web

Usage: vp dotenv <COMMAND> [OPTIONS]

Validate project environment variables against .env.schema, including values supplied by CI.

Options:
-h, --help Show this help message

Commands:
init Create .env.schema from the existing .env files
check Validate the .env files against .env.schema without printing values
print Print the resolved values, with sensitive values masked
explain Show how config items resolve, with sensitive values masked
scan Find plaintext copies of sensitive values in files
exec Run a command with the resolved environment
encrypt Encrypt a value with a key stored on this device
lock Require biometric authentication for the next decryption
keychain Manage the macOS Keychain items that keychain() reads (macOS only)

Examples:
vp dotenv init
vp dotenv check
vp dotenv print --format json
vp dotenv scan --staged
vp dotenv exec -- node scripts/seed.ts
vp dotenv encrypt --file .env.local

Documentation: https://viteplus.dev/guide/dotenv
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# command_dotenv_schema

## `vpt write-file .env.schema '# @defaultSensitive=false
# ---

# @type=url
API_URL=http://localhost:3000

# @required @sensitive
STRIPE_SECRET_KEY=
'`


## `vp dotenv check`

the required secret has no value

**Exit code:** 1

```

🚨🚨🚨 Configuration is currently invalid 🚨🚨🚨

❓ STRIPE_SECRET_KEY* 🔐sensitive
└ undefined
- Value is required but is currently empty
```

## `vpt write-file .env.local 'STRIPE_SECRET_KEY=sk_test_1234567890abcdef
'`


## `vp dotenv check`

```
pass: Found no errors in 2 config items (2 have a value)
```

## `vp dotenv print`

the secret is masked

```
API_URL=http://localhost:3000
STRIPE_SECRET_KEY='sk▒▒▒▒▒'
```

## `vp dotenv print --format json`

```
{
"API_URL": "http://localhost:3000",
"STRIPE_SECRET_KEY": "sk▒▒▒▒▒"
}
```
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Core Commands:
config Configure hooks and agent integration
hooks Manage the Git hook dispatcher
staged Run linters on staged files
dotenv Validate and inspect project environment variables using .env.schema
toolchain Show Vite+ tool versions and relationships

Package Manager Commands:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ vite-plus@<version>
├── depends on oxlint@<version>
├── depends on tsrs@<version>
├── depends on oxfmt@<version>
├── depends on varlock@<version>
├── compiles vite-task (built <build-time>, revision <revision>)
└── compiles oxc-node@<version> (<revision>)
├── compiles oxc@<version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ vite-plus@<version>
├── depends on oxlint@<version>
├── depends on tsrs@<version>
├── depends on oxfmt@<version>
├── depends on varlock@<version>
├── compiles vite-task (built <build-time>, revision <revision>)
└── compiles oxc-node@<version> (<revision>)
├── compiles oxc@<version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ vite-plus@<version>
├── depends on oxlint@<version>
├── depends on tsrs@<version>
├── depends on oxfmt@<version>
├── depends on varlock@<version>
├── compiles vite-task (built <build-time>, revision <revision>)
└── compiles oxc-node@<version> (<revision>)
├── compiles oxc@<version>
Expand Down Expand Up @@ -87,6 +88,7 @@ vite-plus@<version>
├── depends on oxlint@<version>
├── depends on tsrs@<version>
├── depends on oxfmt@<version>
├── depends on varlock@<version>
├── compiles vite-task (built <build-time>, revision <revision>)
└── compiles oxc-node@<version> (<revision>)
├── compiles oxc@<version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ Tools:
oxlint <version>
tsrs <version>
tsdown <version>
varlock <version>
```
Loading
Loading