Skip to main content
Use the moon hash command to inspect the contents and sources of a generated hash, also known as the hash manifest. This is extremely useful in debugging task inputs and understanding why a task was re-run.
$ moon hash 0b55b234f1018581c45b00241d7340dc648c63e639fbafdaf85a4cd7e718fdde

# Query hash using short form
$ moon hash 0b55b234
By default, this will output the contents of the hash manifest (which is JSON), and the fully qualified resolved hash. Output:
Hash: 0b55b234f1018581c45b00241d7340dc648c63e639fbafdaf85a4cd7e718fdde

{
  "command": "build",
  "args": ["./build"],
  "inputs": [
    "src/**/*.ts",
    "package.json"
  ],
  "deps": [],
  "env": {
    "NODE_ENV": "production"
  },
  "platform": "node",
  "target": "app:build",
  "version": "1.0.0"
}

Arguments

<hash>

The hash to inspect. Can be the full hash or a partial hash (minimum 8 characters).
# Full hash
$ moon hash 0b55b234f1018581c45b00241d7340dc648c63e639fbafdaf85a4cd7e718fdde

# Short hash (first 8+ characters)
$ moon hash 0b55b234

[diff-hash]

Another hash to diff against. When provided, the command will show differences between the two hashes.
$ moon hash 0b55b234 2388552f

Options

--json

Display the hash or diff in JSON format instead of pretty-printed output.
$ moon hash 0b55b234 --json

Comparing Hashes

The command can be used to compare two hashes by diffing their contents. Simply pass two hashes as arguments.
# Diff between 2 hashes
$ moon hash 0b55b234f1018581c45b00241d7340dc648c63e639fbafdaf85a4cd7e718fdde 2388552fee5a02062d0ef402bdc7232f0a447458b058c80ce9c3d0d4d7cfe171

# Diff between 2 hashes using short form
$ moon hash 0b55b234 2388552f
By default, this will output the contents highlighting the differences between the left and right hashes. Lines that match will be printed in white, while the left differences printed in green, and right differences printed in red. If you use git diff, this will feel familiar. Output:
Left:  0b55b234f1018581c45b00241d7340dc648c63e639fbafdaf85a4cd7e718fdde
Right: 2388552fee5a02062d0ef402bdc7232f0a447458b058c80ce9c3d0d4d7cfe171

{
  "command": "build",
  "args": [
+   "./dist"
-   "./build"
  ],
  "inputs": [
    "src/**/*.ts",
    "package.json"
  ],
  "env": {
+   "NODE_ENV": "development"
-   "NODE_ENV": "production"
  }
}

JSON Diff Output

The differences can also be output in JSON by passing the --json flag:
$ moon hash 0b55b234 2388552f --json
Output structure:
{
  "left": { /* full left hash manifest */ },
  "left_hash": "0b55b234f1018581c45b00241d7340dc648c63e639fbafdaf85a4cd7e718fdde",
  "left_diffs": {
    "3": "\"./dist\"",
    "10": "\"NODE_ENV\": \"development\""
  },
  "right": { /* full right hash manifest */ },
  "right_hash": "2388552fee5a02062d0ef402bdc7232f0a447458b058c80ce9c3d0d4d7cfe171",
  "right_diffs": {
    "3": "\"./build\"",
    "10": "\"NODE_ENV\": \"production\""
  }
}
The left_diffs and right_diffs objects map line numbers to the differing content.

Hash Manifest Contents

A hash manifest typically contains:

Task Information

  • command - The command being run
  • args - Command arguments
  • target - The task target (e.g., app:build)
  • platform - Platform/runtime (node, system, etc.)

Inputs

  • inputs - File patterns that are inputs to the task
  • deps - Dependency hashes this task depends on
  • env - Environment variables that affect the task

Metadata

  • version - Hash manifest version
  • passthrough_args - Additional arguments passed through
  • output_style - Output rendering style

Finding Hashes

Hashes are displayed in:
  1. Task output - When running tasks:
    app:build | cache hit 0b55b234
    
  2. Cache directory - Stored in .moon/cache/hashes/:
    $ ls .moon/cache/hashes/
    0b55b234f1018581c45b00241d7340dc648c63e639fbafdaf85a4cd7e718fdde.json
    
  3. Action graph - Via moon action-graph or moon task-graph

Use Cases

Debug Cache Misses

When a task doesn’t hit cache, compare the old and new hashes:
# Get previous hash from logs
$ moon hash <old-hash> <new-hash>
This shows exactly what changed to cause the cache miss.

Verify Task Inputs

Ensure your task is tracking the correct inputs:
$ moon hash <hash>
Check the inputs array matches your expectations.

Understand Dependencies

See what dependencies a task depends on:
$ moon hash <hash>
Look at the deps array for dependency hashes.

Examples

View a hash

$ moon hash 0b55b234

Compare two hashes

$ moon hash 0b55b234 2388552f

Export hash as JSON

$ moon hash 0b55b234 --json > hash.json

Compare and export diff

$ moon hash 0b55b234 2388552f --json > diff.json

Configuration

See Also

Build docs developers (and LLMs) love