Skip to main content
The moon tasks command lists all tasks available in the workspace as a table of information, including task target, command, type, preset, toolchains, and description.
$ moon tasks
This command provides a comprehensive overview of all executable tasks across your entire workspace, making it easy to discover available tasks and understand your build pipeline.

Synopsis

moon tasks [project] [OPTIONS]

Arguments

  • [project] - Optional project ID to filter tasks. When specified, only tasks from that project are listed.

Options

OptionTypeDescription
--jsonbooleanPrint the tasks as JSON

Example output

The following output shows an example table of tasks:
$ moon tasks
╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│Task                          Command          Type        Preset      Toolchains                                Description                        │
│─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────│
│cli:build                     cargo            build                   rust                                      Build the CLI binary               │
│cli:test                      cargo            test                    rust                                      Run unit tests                     │
│runtime:build                 packemon         build                   typescript, javascript, node, yarn        Build the package                  │
│runtime:format                prettier         test                    javascript, node, yarn                    Check code formatting              │
│runtime:lint                  eslint           test                    javascript, node, yarn                    Lint source code                   │
│runtime:test                  jest             test                    javascript, node, yarn                    Run unit tests                     │
│runtime:typecheck             tsc              test                    typescript, javascript, node, yarn        Check TypeScript types             │
│website:build                 docusaurus       build                   typescript, javascript, node, yarn        Build the docs site                │
│website:dev                   docusaurus       run         server      typescript, javascript, node, yarn        Start dev server                   │
│website:format                prettier         test                    javascript, node, yarn                    Check code formatting              │
│website:lint                  eslint           test                    javascript, node, yarn                    Lint source code                   │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
The table includes the following columns:
  • Task - The fully qualified task target (project:task)
  • Command - The primary command being executed (or (script) for script tasks)
  • Type - Task type (build, test, run, etc.)
  • Preset - Preset identifier if the task uses a preset configuration
  • Toolchains - Comma-separated list of toolchains used
  • Description - Task description from configuration
:::info Use moon query tasks for advanced querying and filtering of tasks. :::

JSON output

Use the --json flag to output the complete task list as JSON:
$ moon tasks --json
[
  {
    "id": "build",
    "target": "runtime:build",
    "command": "packemon",
    "type": "build",
    "toolchains": ["typescript", "javascript", "node", "yarn"],
    "description": "Build the package"
  },
  {
    "id": "test",
    "target": "runtime:test",
    "command": "jest",
    "type": "test",
    "toolchains": ["javascript", "node", "yarn"],
    "description": "Run unit tests"
  }
]

Usage examples

List all tasks

$ moon tasks

Filter tasks by project

$ moon tasks runtime

Export tasks as JSON

$ moon tasks --json > tasks.json

Count tasks by type

$ moon tasks --json | jq 'group_by(.type) | map({type: .[0].type, count: length})'

List all test tasks

$ moon tasks --json | jq '.[] | select(.type == "test") | .target'

Find tasks using a specific toolchain

$ moon tasks --json | jq '.[] | select(.toolchains[] == "node") | .target'

Get all tasks for a project

$ moon tasks website

Filtering by project

When you provide a project ID, only tasks from that project are shown:
$ moon tasks runtime
╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│Task                          Command          Type        Preset      Toolchains                                Description │
│───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────│
│runtime:build                 packemon         build                   typescript, javascript, node, yarn        Build pkg   │
│runtime:format                prettier         test                    javascript, node, yarn                    Format code │
│runtime:lint                  eslint           test                    javascript, node, yarn                    Lint code   │
│runtime:test                  jest             test                    javascript, node, yarn                    Run tests   │
│runtime:typecheck             tsc              test                    typescript, javascript, node, yarn        Type check  │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
If no tasks exist for the specified project:
There are no tasks for the project <runtime>

Empty workspace

If no tasks are configured in any project, you’ll see:
No tasks exist. Have any been configured?
Make sure you have tasks defined in either:

Task types

Tasks are categorized by type, which affects how they’re treated by commands like moon check:
  • build - Compilation and build tasks
  • test - Testing and verification tasks
  • run - General execution tasks
  • setup - Setup and initialization tasks
  • dev - Development server tasks

Understanding presets

Presets are predefined task configurations that provide common defaults. Examples:
  • server - Long-running development servers
  • watch - File watching tasks
  • script - Simple script execution

Configuration

Build docs developers (and LLMs) love