Skip to main content

CLI Reference

The Presetter CLI provides powerful commands for managing your project configuration and running scripts efficiently.

Available Commands

Project Setup

Script Execution

Command Shortcuts

For convenience, Presetter provides these standalone binaries:

  • runpresetter run
  • run-spresetter run-s
  • run-ppresetter run-p

Global Options

All commands support these global options:

  • --help - Show help information for the command
  • --version - Show version number

Advanced Pattern Matching

Presetter supports sophisticated task selection patterns:

Single-level Wildcards (*)

  • test:* - Run all direct subtasks of test
  • build:* - Run all direct subtasks of build

Multi-level Wildcards (**)

  • test:** - Run all test-related tasks at any depth
  • build:** - Run all build-related tasks recursively

Specific Pattern Examples

# Available tasks: task1, task1:subtask1, task1:subtask2, task1:subtask1:deep
presetter run "task1:*" # Runs: task1:subtask1, task1:subtask2
presetter run "task1:**" # Runs: task1:subtask1, task1:subtask2, task1:subtask1:deep
presetter run "task1:*:deep" # Runs: task1:subtask1:deep

Argument Handling

Global Arguments

Use -- to separate global arguments that apply to all tasks:

presetter run-s lint test build -- --verbose --strict

Task-Specific Arguments

For sequential and parallel execution, specify arguments per task:

presetter run-s "lint -- --fix" "test -- --coverage" "build -- --minify"

Argument Substitution

Use {@} to inject global arguments into specific positions:

presetter run-s "test -- {@} --coverage" "lint -- --fix {@}" -- --verbose
# Expands to: test --verbose --coverage && lint --fix --verbose

Quick Start Examples

Basic Usage

# Setup project with preset
presetter bootstrap

# Run single task
presetter run build

# Run with arguments
presetter run test -- --watch

Sequential Execution

# Basic sequence
presetter run-s clean build

# With arguments
presetter run-s "lint -- --fix" "test -- --coverage" build

Parallel Execution

# Run multiple tasks simultaneously
presetter run-p lint test typecheck

# With arguments
presetter run-p "test -- --watch" "lint -- --cache"

Pattern-Based Selection

# Run all test variants
presetter run "test:*"

# Run all build-related tasks
presetter run "build:**"

Integration with Package Scripts

Presetter merges template scripts with your local package.json scripts, with local scripts taking priority:

{
"scripts": {
"build": "presetter run build",
"test": "presetter run test",
"ci": "presetter run-s lint test build"
}
}

Error Handling

  • Exit codes: Commands return appropriate exit codes for CI/CD integration
  • Script failures: In sequential mode, execution stops on first failure
  • Parallel failures: All tasks complete, but command fails if any task fails
  • Pattern matching: No error if pattern matches no tasks (returns success)

Next Steps

Explore each command in detail:

  • bootstrap - Learn about project setup and configuration generation
  • run - Master single task execution and template scripts
  • run-s - Understand sequential task orchestration
  • run-p - Leverage parallel execution for performance