Skip to main content
The moon task [target] (or moon t) command displays comprehensive information about a task that has been configured and exists within a project. If a task does not exist, the program will return with a 1 exit code.
$ moon task web:build
This command is essential for understanding task configuration, dependencies, inputs/outputs, environment variables, and execution behavior.

Synopsis

moon task [target] [OPTIONS]

Arguments

  • [target] - Fully qualified project + task target (e.g., project:task). If not provided, you’ll be prompted to select from available tasks.

Options

OptionTypeDescription
--jsonbooleanPrint the task and its configuration as JSON

Example output

The following output is an example of what this command prints for a build task:
$ moon task runtime:build
RUNTIME:BUILD

Builds the runtime package for distribution.

About:

  Target: runtime:build
  Project: runtime
  Task: build
  Toolchain: node
  Type: build
  Preset: (none)
  Mode: (none)
  Depends on:
    - types:build

Process:

  Command: packemon build --addFiles --addExports --declaration
  Environment variables:
    NODE_ENV: production
  Working directory: ~/Projects/moon/packages/runtime
  Lookup paths:
    - ~/Projects/moon/packages/runtime/node_modules/.bin
    - ~/Projects/moon/node_modules/.bin
  Runs dependencies: Parallel
  Runs in CI: Yes

Configuration:

  Inherits from:
    - .moon/tasks/node.yml
  Inputs:
    - .moon/*.yml
    - .moon/tasks/node.yml
    - packages/runtime/package.json
    - packages/runtime/src/**/*
    - packages/runtime/tsconfig.*.json
    - packages/runtime/tsconfig.json
    - packages/runtime/types/**/*
    - tsconfig.options.json
  Outputs:
    - packages/runtime/cjs
    - packages/runtime/esm
    - packages/runtime/dts

Sections explained

About

Provides core task identification and metadata:
  • Target - Full target identifier
  • Project - Project ID this task belongs to
  • Task - Task ID within the project
  • Toolchain - Toolchain(s) used to execute the task
  • Type - Task type (build, test, run, etc.)
  • Preset - Preset configuration if applicable
  • Mode - Special modes (internal, interactive, persistent)
  • Depends on - Other tasks that must run before this one

Process

Describes how the task executes:
  • Command - The command line that will be executed
  • Script - If a script is used instead of direct command
  • Shell - Shell used for execution (if applicable)
  • Environment variables - Env vars set during execution
  • Working directory - Directory where the command runs
  • Lookup paths - Paths searched for executables
  • Runs dependencies - How deps are executed (Parallel/Serial)
  • Runs in CI - Whether task runs in CI environments

Configuration

Shows task configuration sources and behavior:
  • Inherits from - Configuration files that define this task
  • Inputs - Files/globs that affect task caching
  • Outputs - Files/dirs produced by the task

JSON output

Use the --json flag to output the full task configuration as JSON:
$ moon task runtime:build --json
{
  "id": "build",
  "target": "runtime:build",
  "command": "packemon",
  "args": ["build", "--addFiles", "--addExports", "--declaration"],
  "type": "build",
  "description": "Builds the runtime package for distribution.",
  "options": {
    "runDepsInParallel": true,
    "runInCI": true
  },
  "deps": [
    {
      "target": "types:build"
    }
  ],
  "env": {
    "NODE_ENV": "production"
  },
  "inputFiles": [
    "package.json",
    "src/**/*",
    "types/**/*"
  ],
  "outputDirs": [
    "cjs",
    "esm",
    "dts"
  ]
}

Usage examples

Inspect a task

$ moon task app:build

View task configuration as JSON

$ moon task app:test --json

Export task details for documentation

$ moon task app:build --json | jq '{command, description, deps}'

Check if task runs in CI

$ moon task app:build --json | jq '.options.runInCI'

List task dependencies

$ moon task app:build --json | jq '.deps[].target'

Task modes

Tasks can have special execution modes:
  • internal - System task, not meant for direct execution
  • interactive - Requires user input (not cacheable)
  • persistent - Long-running process (like dev servers)

Understanding inputs and outputs

Inputs

Inputs determine when a task needs to re-run. They include:
  • File globs - Patterns matching source files
  • Environment variables - Env vars prefixed with $
  • Configuration files - Files affecting task behavior
When any input changes, the task cache is invalidated.

Outputs

Outputs are artifacts produced by the task:
  • Files - Specific output files
  • Directories - Output directories
Outputs are cached and restored on subsequent runs when inputs haven’t changed.

Configuration

Build docs developers (and LLMs) love