feat(config): support task command shorthands#391
Conversation
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.
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
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.
|
@codex review |
There was a problem hiding this comment.
💡 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".
|
@codex review |
There was a problem hiding this comment.
💡 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".
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
@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? |
Join command array entries with && before planning so string[] shorthands preserve existing shell semantics instead of relying on partial cwd-change detection.
|
@codex review |
|
Codex Review: Didn't find any major issues. 🎉 ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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.
…rthands # Conflicts: # crates/vite_task_plan/src/plan.rs
06dbb70 to
a7ad522
Compare
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.
a7ad522 to
3d2e41a
Compare
|
@codex review |
There was a problem hiding this comment.
💡 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".
|
@branchseer I’ve addressed the suggested changes. Could you please review it again? 🙇♂️ |
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>
0114121 to
ec1607b
Compare
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>
ec1607b to
9f4be7b
Compare
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>
|
Thanks! |
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.