From 8c13a73b20aef21d83417f6cd7a792c090979920 Mon Sep 17 00:00:00 2001 From: JongKyung Lee Date: Thu, 4 Jun 2026 20:57:49 +0900 Subject: [PATCH] fix(cli): set VP_COMMAND in LSP wrappers --- packages/cli/bin/oxfmt | 7 +++++-- packages/cli/bin/oxlint | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/cli/bin/oxfmt b/packages/cli/bin/oxfmt index 124431fdc4..142b0989ff 100755 --- a/packages/cli/bin/oxfmt +++ b/packages/cli/bin/oxfmt @@ -21,7 +21,10 @@ const require = createRequire(import.meta.url); const oxfmtMainPath = require.resolve('oxfmt'); const oxfmtBin = join(dirname(dirname(oxfmtMainPath)), 'bin', 'oxfmt'); -// This allows oxfmt to load vite.config.ts -// For `vp check` and `vp fmt`, it is injected by `merge_resolved_envs_with_version()` in `cli.rs` +// This allows oxfmt to load vite.config.ts. +// For `vp check` and `vp fmt`, VP_VERSION is injected by +// `merge_resolved_envs_with_version()` in `cli.rs`, and VP_COMMAND is injected +// by `SubcommandResolver::resolve()`. process.env.VP_VERSION = pkg.version; +process.env.VP_COMMAND ??= 'fmt'; await import(pathToFileURL(oxfmtBin).href); diff --git a/packages/cli/bin/oxlint b/packages/cli/bin/oxlint index 4d5824c1c9..e1a0316937 100755 --- a/packages/cli/bin/oxlint +++ b/packages/cli/bin/oxlint @@ -19,7 +19,10 @@ const require = createRequire(import.meta.url); const oxlintMainPath = require.resolve('oxlint'); const oxlintBin = join(dirname(dirname(oxlintMainPath)), 'bin', 'oxlint'); -// This allows oxlint to load vite.config.ts -// For `vp check` and `vp lint`, it is injected by `merge_resolved_envs_with_version()` in `cli.rs` +// This allows oxlint to load vite.config.ts. +// For `vp check` and `vp lint`, VP_VERSION is injected by +// `merge_resolved_envs_with_version()` in `cli.rs`, and VP_COMMAND is injected +// by `SubcommandResolver::resolve()`. process.env.VP_VERSION = pkg.version; +process.env.VP_COMMAND ??= 'lint'; await import(pathToFileURL(oxlintBin).href);