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.
Arguments
<hash>
The hash to inspect. Can be the full hash or a partial hash (minimum 8 characters).
[diff-hash]
Another hash to diff against. When provided, the command will show differences between the two hashes.
Options
--json
Display the hash or diff in JSON format instead of pretty-printed output.
Comparing Hashes
The command can be used to compare two hashes by diffing their contents. Simply pass two hashes as arguments.git diff, this will feel familiar.
Output:
JSON Diff Output
The differences can also be output in JSON by passing the--json flag:
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 runargs- Command argumentstarget- The task target (e.g.,app:build)platform- Platform/runtime (node, system, etc.)
Inputs
inputs- File patterns that are inputs to the taskdeps- Dependency hashes this task depends onenv- Environment variables that affect the task
Metadata
version- Hash manifest versionpassthrough_args- Additional arguments passed throughoutput_style- Output rendering style
Finding Hashes
Hashes are displayed in:-
Task output - When running tasks:
-
Cache directory - Stored in
.moon/cache/hashes/: -
Action graph - Via
moon action-graphormoon task-graph
Use Cases
Debug Cache Misses
When a task doesn’t hit cache, compare the old and new hashes:Verify Task Inputs
Ensure your task is tracking the correct inputs:inputs array matches your expectations.
Understand Dependencies
See what dependencies a task depends on:deps array for dependency hashes.
Examples
View a hash
Compare two hashes
Export hash as JSON
Compare and export diff
Configuration
hasherin.moon/workspace.*
See Also
- Hashing - Learn how moon generates hashes
- Task inputs - Configure task inputs
moon run- Run tasks with caching