Skip to content

feat(config): support task command shorthands#391

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

feat(config): support task command shorthands#391
branchseer 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? 🙇‍♂️

branchseer 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>
@branchseer branchseer 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>
@branchseer branchseer force-pushed the feat/task-command-shorthands branch from ec1607b to 9f4be7b Compare May 24, 2026 17:16
branchseer 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>
@branchseer branchseer merged commit 636351d into voidzero-dev:main May 24, 2026
12 checks passed
@branchseer
Copy link
Copy Markdown
Member

Thanks!

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