Skip to content

feat(tasks): enhance pixi task add#3884

Open
DishankChauhan wants to merge 6 commits intoprefix-dev:mainfrom
DishankChauhan:feature/improve-task-add-cli
Open

feat(tasks): enhance pixi task add#3884
DishankChauhan wants to merge 6 commits intoprefix-dev:mainfrom
DishankChauhan:feature/improve-task-add-cli

Conversation

@DishankChauhan
Copy link

@DishankChauhan DishankChauhan commented Jun 2, 2025

Summary

This PR enhances the pixi task add CLI command to address all requirements from issue #3828.

Changes Made

🔧 Enhanced CLI Features

  • Enhanced dependency parsing: Support for task:env and task::arg1,arg2 formats
  • Task arguments with defaults: --arg name and --arg name=default
  • Inputs/outputs support: --inputs "*.rs" and --outputs "target/*" Removed to unblock PR
  • Alias creation: Create aliases using --depends-on without commands
  • Validation: Ensures either commands or dependencies are provided

🔄 Backward Compatibility

  • All existing functionality preserved
  • Existing task definitions continue to work unchanged
  • No breaking changes to the API

✅ Testing

  • Comprehensive manual testing of all new features
  • All existing tests pass
  • Fixed integration test compilation
  • Clippy and formatting checks pass

Example Usage

# Enhanced dependency with environment
pixi task add deploy --depends-on build:production

# Task with arguments and defaults
pixi task add compile echo "Mode: $MODE" --arg mode=debug

# Alias creation (no commands, just dependencies)
pixi task add test-all --depends-on test-unit test-integration

Partly resolves #3828

…pends-on parsing with environment and arguments - Add task arguments with default values support - Enable alias creation via depends-on without commands - Add inputs and outputs glob patterns support - Add validation to ensure either commands or dependencies are provided - Maintain backward compatibility with existing functionality - Fix clippy linting issues and update tests - Fixes prefix-dev#3828
Copy link
Contributor

@ruben-arts ruben-arts left a comment

Choose a reason for hiding this comment

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

Great additions! It's not yet hooked up properly as i found out with the inputs and outputs. I really like the idea of the splitting you implemented on the args and depends on!

Could you add all possible new commands as an integration test?
The best location for that would be: tests/integration_python/test_main_cli.py.

src/cli/task.rs Outdated
depends_on,
inputs: None,
outputs: None,
inputs: value.inputs,
Copy link
Contributor

Choose a reason for hiding this comment

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

The inputs and outputs are not serialized when adding e.g.:

pixi task add test10 --inputs "*.rs" --outputs "target" echo hello

results in:

test10 = { cmd = "echo hello" }

@ruben-arts
Copy link
Contributor

I removed the --inputs --outputs as they didn't work, and I really wanted the other features.

I would like to converse about the listing of the inputs, maybe pixi task add --input "*.sh" --input "*.md" or pixi task add --inputs "*.sh:src/*.cpp" could make more sence compared to the --inputs "*.sh,src/*.cpp" as they are paths I think it makes sense to support the same separator as paths.

But I wasn't confident about that...

@ruben-arts ruben-arts requested a review from nichmor June 27, 2025 12:20
@lucascolley lucascolley added enhancement New features area:tasks Related to pixi tasks labels Jul 21, 2025
@lucascolley lucascolley mentioned this pull request Jul 29, 2025
6 tasks
@lucascolley lucascolley changed the title feat: enhance pixi task add CLI command to support issue #3828 feat(tasks): enhance pixi task add Jul 29, 2025
@lucascolley lucascolley added the cli Issue related to CLI label Jul 29, 2025
@baszalmstra
Copy link
Contributor

@DishankChauhan Do you think you could take another look at this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:tasks Related to pixi tasks cli Issue related to CLI enhancement New features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve pixi task add CLI command.

5 participants