Skip to content

feat(config): support task command shorthands#391

Merged
wan9chi merged 22 commits into
voidzero-dev:mainfrom
jong-kyung:feat/task-command-shorthands
May 24, 2026
Merged

feat(config): support task command shorthands#391
wan9chi merged 22 commits into
voidzero-dev:mainfrom
jong-kyung:feat/task-command-shorthands

Conversation

@jong-kyung
Copy link
Copy Markdown
Contributor

Summary

Closes #381.

Adds task command shorthands:

  • "build": "cmd"
  • "build": ["cmd1", "cmd2", ...]
  • { "command": ["cmd1", "cmd2", ...] }

Arrays reuse the existing && planning path, so cache behavior, dependsOn, and task options stay consistent. Empty arrays and empty/whitespace-only entries are rejected.

Allow task definitions to use command string and command array shorthands, and allow object-form command arrays to normalize through the existing && command planning path. Update generated config types, docs, changelog, and plan snapshots for the new syntax.
@jong-kyung
Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/vite_task_graph/src/config/user.rs Outdated
Comment thread crates/vite_task_graph/src/config/user.rs Outdated
Comment thread crates/vite_task_graph/src/config/user.rs Outdated
Comment thread crates/vite_task_graph/src/config/user.rs Outdated
Keep task command arrays as config data through graph loading and parse each array entry in the planner. This preserves quoting boundaries, supports nested vp runs and mixed && entries, and reports empty array entries during planning.
@jong-kyung jong-kyung marked this pull request as draft May 19, 2026 12:28
@jong-kyung
Copy link
Copy Markdown
Contributor Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 32ded09d72

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/vite_task_plan/src/plan.rs Outdated
@jong-kyung
Copy link
Copy Markdown
Contributor Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fc17f5041e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/vite_task_plan/src/plan.rs Outdated
@jong-kyung
Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@jong-kyung jong-kyung marked this pull request as ready for review May 19, 2026 15:15
@jong-kyung
Copy link
Copy Markdown
Contributor Author

@branchseer I've addressed all of the suggested changes from your review and incorporated the feedback from Codex as well. Could you please review it again when you have a chance?

jong-kyung and others added 2 commits May 20, 2026 22:31
Join command array entries with && before planning so string[] shorthands preserve existing shell semantics instead of relying on partial cwd-change detection.
@jong-kyung
Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Drop the explicit cache:false command-array plan snapshot now that cache behavior is covered elsewhere and this fixture can stay focused on shorthand planning semantics.
Comment thread crates/vite_task_graph/src/config/mod.rs Outdated
Comment thread crates/vite_task_plan/src/plan.rs Outdated
Comment thread crates/vite_task_plan/src/plan.rs Outdated
…rthands

# Conflicts:
#	crates/vite_task_plan/src/plan.rs
@jong-kyung jong-kyung force-pushed the feat/task-command-shorthands branch from 06dbb70 to a7ad522 Compare May 21, 2026 11:58
Normalize resolved task commands to arrays so the planner parses each configured command item independently. Include command_item_index in UserTask cache keys and update snapshots for the new resolved config shape.
@jong-kyung jong-kyung force-pushed the feat/task-command-shorthands branch from a7ad522 to 3d2e41a Compare May 21, 2026 11:59
@jong-kyung
Copy link
Copy Markdown
Contributor Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3d2e41a72e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/vite_task_plan/src/plan.rs Outdated
@jong-kyung
Copy link
Copy Markdown
Contributor Author

@branchseer I’ve addressed the suggested changes. Could you please review it again? 🙇‍♂️

wan9chi and others added 2 commits May 24, 2026 23:56
Collapses the two-variant `UserTaskConfig` enum (`String`/`Array`, each
carrying duplicate `options`) into a struct with a `Command::Single |
Command::Array` field, dropping the `options()`/`into_parts()` accessors
in favor of public fields. The generated TS now factors `Command` out
instead of duplicating every option across both command shapes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Merges `CommandString` and `CommandArray` into a single
`CommandShorthand(Command)` variant, reusing the `Command` enum
introduced for `UserTaskConfig` instead of redefining its two shapes.
Also renames `Config` to `Object` to match the variant's existing doc.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@wan9chi wan9chi force-pushed the feat/task-command-shorthands branch from 0114121 to ec1607b Compare May 24, 2026 16:42
Wraps the existing parse-and-iterate body in an outer per-command loop
instead of going through a `PlannedCommand` intermediate. The
"last and-item gets extra args" condition becomes `is_last_command &&
index == and_item_count - 1`. The shell-fallback branch (else of
`try_parse_as_and_list`) now runs per command and respects prior `cd`
mutations to `cwd`.

Also drops the planner-side emptiness/whitespace check (and the now-dead
`Error::InvalidTaskCommand` variant). The two `empty_*` fixtures whose
sole purpose was asserting those errors are removed; behavior fixtures
(`array_shorthand`, `array_with_and`, etc.) are unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@wan9chi wan9chi force-pushed the feat/task-command-shorthands branch from ec1607b to 9f4be7b Compare May 24, 2026 17:16
wan9chi and others added 5 commits May 25, 2026 01:22
Replaces `array_cd_spawn`, `array_cd_shell`, `array_shell_cd_before_next`,
and `array_compound_cd_before_next` with one `array_cd` fixture
(`["vtt print before_cd", "cd snapshots && vtt print after_cd", "vtt print after_cd2"]`).

The new fixture verifies in one snapshot that:
- the first array element runs at the original cwd,
- `cd` as the first `&&`-and-item mutates cwd and produces no item,
- the cwd mutation persists into the next array element.

The compound/shell `cd` detection still has unit coverage in
`vite_shell::tests::test_shell_command_may_change_cwd_*`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The docs edits in this PR (task-cache.md, terminologies.md) are not
necessary for the task command shorthand feature; reverting to keep
the PR scope tight.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The `windows_cmd_shim_rewrite` fixture was missed when ResolvedTaskConfig
switched from `command: Str` to `commands: Arc<[Str]>`. The fixture is
gated to `cfg(windows)` so non-Windows local runs skip it, but CI on
Windows fails. Updates the singular `"command"` field to the new array
form.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The `command_item_index` field was added to `ExecutionCacheKey::UserTask`
for the array-shorthand work but the windows-gated fixture's
`query_dev_in_subpackage.jsonc` and `query_dev_filter_from_root.jsonc`
were missed (the `task_graph.jsonc` already got updated in the prior
commit). CI on Windows catches it.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@wan9chi wan9chi merged commit 636351d into voidzero-dev:main May 24, 2026
12 checks passed
@wan9chi
Copy link
Copy Markdown
Member

wan9chi commented May 24, 2026

Thanks!

fengmk2 added a commit to voidzero-dev/vite-plus that referenced this pull request May 29, 2026
Release vite-plus v0.1.23.

Enterprise-ready HTTP (proxy + custom CA), task command shorthands in
`vite.config.ts`, a smoother `vp create`/`vp migrate`, and the
oxc/vite/rolldown bundled stack moves forward.

### Highlights

- **Proxy and custom-CA aware HTTP**: a new process-wide
`vite_shared::shared_http_client()` honors `HTTPS_PROXY` / `HTTP_PROXY`
/ `NO_PROXY`, picks up macOS System Settings / Windows registry proxies,
loads custom CAs from `SSL_CERT_FILE` and `NODE_EXTRA_CA_CERTS`, and
exposes a `VP_INSECURE_TLS` diagnostic switch; makes `vp` work through
Socket Firewall Free and other TLS-intercepting proxies
([#1686](#1686)), by
@fengmk2
- **Task command shorthands**: `run.tasks` entries in `vite.config.ts`
now accept a bare string (`"build": "cmd"`) or array (`"build": ["cmd1",
"cmd2"]`) instead of always requiring `{ command: ... }`; arrays reuse
the existing `&&` planning path so cache, `dependsOn`, and task options
stay consistent
([vite-task#391](voidzero-dev/vite-task#391)),
by @jong-kyung
- **Managed `vp outdated -g`**: routes through Vite+'s managed global
package metadata instead of delegating to the underlying `npm outdated
-g` store, so all installed global packages are reported consistently
([#1659](#1659)), by
@liangmiQwQ

### Features

- `vp pm approve-builds`: new unified subcommand that mirrors `pnpm
approve-builds` one-to-one, adapts to `bun pm trust`, and
warns-and-noops on npm/yarn
([#1662](#1662)), by
@fengmk2
- `vp create`: opt-in GitHub Copilot setup; selecting `--agent copilot`
now generates a `.github/workflows/copilot-setup-steps.yml` so the
Copilot Coding Agent can set up Vite+ and run `vp` in the new project
out of the box
([#1683](#1683)), by
@jong-kyung
- `vp migrate`: prompt to remove `baseUrl` from `tsconfig.json` before
applying type-aware lint defaults (runs `@andrewbranch/ts5to6
--fixBaseUrl .` under the hood; auto-applied in non-interactive mode)
([#1692](#1692)), by
@TheAlexLichter
- Respect `packageManager` in package-manager shims (`npm`/`npx`,
`pnpm`/`pnpx`, `yarn`/`yarnpkg`, `bun`/`bunx`); add non-mutating
`packageManager` resolution metadata for `vp env current` and `vp env
which` ([#1654](#1654)),
by @fengmk2
- vite-task: `--filter` no-match now exits `0` by default; add
`--fail-if-no-match` to opt back in
([vite-task#393](voidzero-dev/vite-task#393)),
by @kazupon

### Fixes & Enhancements

- `vp create`: keep generated `.vscode/settings.json` trackable when the
VS Code editor option is selected (avoid templates' `.vscode/*`
`.gitignore` masking it)
([#1700](#1700)), by
@jong-kyung
- `vp create vite:monorepo`: normalize sub-package `vite-plus` to
`catalog:` even when only `vite-plus` (not `vite`/`vitest`/...) is
present, and drop the `vite`/`vitest` aliases generated by the upstream
library template
([#1697](#1697)), by
@fengmk2
- `vp add/install -g <path>`: resolve the real package name from
`package.json` instead of using the path string, so local-path installs
don't create broken directories
([#1685](#1685)), by
@liangmiQwQ
- `vp test --coverage` and other direct built-in commands now expose the
workspace's `package.json#packageManager` to child processes so tools
like Vitest coverage can spawn the configured PM
([#1696](#1696)), by
@jong-kyung
- `vp migrate`: clean up the whole ESLint ecosystem (plugins, configs,
parser/resolver, type-utils) rather than just `eslint`; skip the
migration entirely when `@nuxt/eslint` is detected
([#1682](#1682)), by
@fengmk2
- `vp create`: write `fmt.configPath` (not `configPath`) for Zed oxfmt
settings to match the official Zed OXC extension layout
([#1687](#1687)), by
@chungweileong94
- `vp migrate`: parse `tsconfig.json` as JSONC so files with comments
don't break `baseUrl` detection/removal
([#1688](#1688)), by
@TheAlexLichter
- `vp env setup`: Unix env shims now point at the active `vp` executable
instead of always assuming `VP_HOME/current/bin/vp`, so Homebrew-style
installs work
([#1631](#1631)), by
@leohara
- `vp outdated -g` / `vp why -g`: don't require a local `package.json`;
global commands run regardless of cwd
([#1622](#1622)), by
@liangmiQwQ
- `vp create`: default the "Initialize a git repository?" prompt to yes
([#1650](#1650)), by
@fengmk2
- `vp` hooks: include the managed Node bin in `PATH` so
`./node_modules/.bin/vp` can find `node` from a VS Code commit on macOS
([#1647](#1647)), by
@TheAlexLichter
- `vpx` on Windows now invokes the package's `.cmd` shim instead of the
Unix binary
([#1652](#1652)), by
@tobynguyen27
- vite-task: bump cache database schema to version 13 (forces a one-time
rebuild of the local task cache)
([vite-task#402](voidzero-dev/vite-task#402)),
by @branchseer
- Bump vite-task to `d02b257` and `5833b374`; also bumps the repo's Rust
nightly toolchain to `nightly-2026-05-24` and ships the regenerated
`run` config types and docs for the new task command shorthand
([#1689](#1689),
[#1695](#1695)), by
@branchseer

### Refactor

- Replace `VP_SHELL_NU`/`VP_SHELL_PWSH` with a single `VP_SHELL`
override; add explicit shell parsing for `bash`, `zsh`, `fish`, `nu`,
`pwsh`, and `cmd`, and harden auto-detection against nested shells
([#1658](#1658)), by
@nekomoyi
- vite-task: replace `allocator-api2` with `bumpalo` collections
([vite-task#400](voidzero-dev/vite-task#400)),
by @branchseer
- vite-task: drop the unused `and_item_index` field from
`ExecutionItemDisplay`
([vite-task#394](voidzero-dev/vite-task#394)),
by @branchseer

### Docs

- Add the root `AGENTS.md` as the primary AI-agent guide for the
vite-plus repository; convert `CLAUDE.md` into a compatibility pointer
([#1670](#1670)), by
@jong-kyung
- Align the agent validation table to match `AGENTS.md`
([#1673](#1673)), by
@jong-kyung
- Update the task output caching guide so the documented behavior
matches what vite-task actually does
([#1639](#1639)), by
@ericclemmons
- Correct the bundled-source location in `packages/core/BUNDLING.md`
([#1660](#1660)), by
@shulaoda

### Chore

- Clarify `--help` text for `vp env default`/`pin`/`use`/`exec` with
`Examples:` blocks
([#1664](#1664)), by
@Boshen
- Refresh trusted stack stats on the docs homepage
([#1680](#1680)), by
@voidzero-guard[bot]
- Drop the standalone `pnpm --filter @rolldown/pluginutils build` step
now that `@rolldown/pluginutils` is published from its own package
([#1655](#1655)), by
@shulaoda
- Preserve single-quote style when `sync-remote` rewrites
`pnpm-workspace.yaml`
([#1672](#1672)), by
@lyzno1
- Enable `vite_pm_cli` lib tests by removing a stale `test = false` flag
([#1661](#1661)), by
@shulaoda
- CI: switch macOS runners back to `namespace-profile-mac-default`
([#1701](#1701)), by
@fengmk2
- CI: fix release-day flakes in the upgrade test and snap test when the
dev `package.json` version equals npm latest
([#1645](#1645)), by
@fengmk2
- CI: replace `zizmor` and `cargo-deny` workflows with
`oxc-project/security-action`
([#1635](#1635)), by
@Boshen
- CI: warm-up monorepo cache test under npm
([#1649](#1649)), by
@fengmk2
- CI: attach per-target `vp` binary archives (`.tar.gz`/`.zip`) to
GitHub Releases alongside the existing `vp-setup-*.exe` installers
([#1665](#1665)), by
@Boshen
- CI: declare Playwright via `repo.json` in ecosystem tests and bump
consumers to `>=1.60` to dodge the Node 24.16.0 hang
([#1668](#1668)), by
@fengmk2
- Update GitHub Actions
([#1640](#1640),
[#1675](#1675),
[#1678](#1678),
[#1679](#1679),
[#1691](#1691)), by
@renovate[bot]
- Upgrade upstream dependencies: vite `8.0.11 → 8.0.14`, rolldown `1.0.0
→ 1.0.3`, vitest `4.1.6 → 4.1.7`, oxlint `1.63.0 → 1.67.0`, oxfmt
`0.48.0 → 0.52.0`, oxlint-tsgolint `0.22.1 → 0.23.0`, `@oxc-project/*`
and oxc Rust crates `0.129.0 → 0.133.0`
([#1646](#1646),
[#1653](#1653),
[#1693](#1693),
[#1699](#1699)), by
@voidzero-guard[bot]

### Bundled Versions

| Tool | Version | Source |
| --- | --- | --- |
| vite | `8.0.14` |
[`c917f1e`](vitejs/vite@c917f1e)
|
| rolldown | `1.0.3` |
[`a287faa`](rolldown/rolldown@a287faa)
|
| tsdown | `0.22.0` | [npm](https://npmx.dev/package/tsdown/v/0.22.0) |
| vitest | `4.1.7` | [npm](https://npmx.dev/package/vitest/v/4.1.7) |
| oxlint | `1.67.0` | [npm](https://npmx.dev/package/oxlint/v/1.67.0) |
| oxlint-tsgolint | `0.23.0` |
[npm](https://npmx.dev/package/oxlint-tsgolint/v/0.23.0) |
| oxfmt | `0.52.0` | [npm](https://npmx.dev/package/oxfmt/v/0.52.0) |

### New Contributors

Welcome to all new contributors! 🎉

@ericclemmons, @tobynguyen27, @shulaoda, @leohara, @chungweileong94

**Full Changelog**:
v0.1.22...v0.1.23

Merging this PR will trigger the release workflow.

---------

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support task string shorthand and command string[] shorthand

2 participants