Skip to content

fix: make task command required#224

Merged
branchseer merged 2 commits intomainfrom
claude/require-command-field-TvKMW
Mar 12, 2026
Merged

fix: make task command required#224
branchseer merged 2 commits intomainfrom
claude/require-command-field-TvKMW

Conversation

@branchseer
Copy link
Member

Summary

This change makes the command field mandatory in task configurations within vite-task.json. Previously, tasks could omit the command and fall back to a corresponding script defined in package.json. This change simplifies the configuration model by requiring explicit command definitions.

Key Changes

  • Made command field required: Changed UserTaskConfig.command from Option<Box<str>> to Box<str>, making it a required field during deserialization
  • Removed fallback logic: Eliminated the fallback mechanism that would use package.json scripts when a task command was omitted
  • Removed error variants: Deleted ResolveTaskConfigError::CommandConflict and ResolveTaskConfigError::NoCommand as they are no longer needed
  • Simplified task resolution: Updated ResolvedTaskConfig::resolve() to only accept user config and package directory, removing the package_json_script parameter
  • Updated test fixtures: Modified all test fixtures to explicitly define commands in vite-task.json instead of relying on package.json scripts
  • Updated documentation: Modified TypeScript type definitions and CLAUDE.md to reflect that command is now required

Implementation Details

  • Tasks defined in vite-task.json must now include an explicit command field
  • Package.json scripts are no longer used as fallbacks for task commands
  • The configuration is now more explicit and reduces ambiguity about which command will be executed
  • All existing test fixtures were updated to comply with the new requirement

https://claude.ai/code/session_01LMFoqFGF6abfJ3WuSeEoRk

claude added 2 commits March 11, 2026 14:30
The `command` field in `UserTaskConfig` is now required instead of
optional. Tasks in the `tasks` map must always specify their command
explicitly rather than falling back to a package.json script with the
same name. Package.json scripts not in the tasks map continue to work
as standalone tasks.

- Change `command` from `Option<Box<str>>` to `Box<str>` in
  `UserTaskConfig`
- Remove `CommandConflict` and `NoCommand` error variants since they
  no longer apply
- Simplify `ResolvedTaskConfig::resolve()` to no longer accept
  `package_json_script` parameter
- Update all test fixtures to include explicit `command` fields
- Regenerate TypeScript type definitions (`run-config.ts`)
- Update documentation in CLAUDE.md

https://claude.ai/code/session_01LMFoqFGF6abfJ3WuSeEoRk
A task in the `tasks` map with the same name as a package.json script
now produces a `ScriptConflict` error, since both define a command and
the intent is ambiguous. The error message guides users to either
remove the script from package.json or rename the task.

Adds a `script-conflict` plan snapshot test fixture to verify the error.

https://claude.ai/code/session_01LMFoqFGF6abfJ3WuSeEoRk
@branchseer branchseer changed the title Make task command required in vite-task.json fix: make task command required in vite-task.json Mar 12, 2026
@branchseer branchseer requested review from cpojer and fengmk2 March 12, 2026 00:42
@branchseer branchseer changed the title fix: make task command required in vite-task.json fix: make task command required Mar 12, 2026
@branchseer branchseer merged commit 34bce5c into main Mar 12, 2026
6 checks passed
@branchseer branchseer deleted the claude/require-command-field-TvKMW branch March 12, 2026 00:54
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.

3 participants