Skip to content
mlavrinenkoPublic

About

Memoized command runner

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

216 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mmz
mmz

Memoize what’s done.


CI crates.io License: MIT

Configure inputs for a command and run it with mmz ... as a prefix. mmz remembers the last successful run and skips further executions while those inputs remain unchanged.

For example, the demo project’s .mmz/config.yaml declares two commands and their inputs:

scopes:
  data: ["data/*.json"]
  bin: ["bin/*.sh"]

probes:
  # jq's version is an input, but not a file.
  jq-version:
    run: jq --version

on_hit: "mmz: skipped {cache:command} (inputs unchanged)"

commands:
  - name: ./bin/validate.sh
    inputs: [data, bin, jq-version]
    tags: [gate]

  - name: ./bin/report.sh
    inputs: [data, bin, jq-version]
    outputs:
      - out/report.txt
    tags: [gate, report]

Running mmz ./bin/validate.sh does the work:

validate: 4 orders, 2 customers OK

Running it again skips the command:

mmz: skipped ./bin/validate.sh (inputs unchanged)

Then, you can put mmz --is-fresh --tag gate in your git pre-commit hook to refuse a commit when a gated check is out of date:

#!/usr/bin/env sh
# .git/hooks/pre-commit
mmz --is-fresh --tag gate || {
  echo "run the gated checks first" >&2
  exit 1
}

No checks run during git commit, but you’re still covered.

See how it compares with other tools.

Installation

cargo install mmz

Quickstart covers the prebuilt binaries, nix run, and scaffolding a manifest.

Usage

mmz --init                # write a starter .mmz/config.yaml
mmz cargo test            # skipped when its inputs are unchanged
mmz --status              # each command's state and last-run age
mmz --is-fresh --tag gate # exit 0 if every gate-tagged command is up to date; runs nothing
mmz --prune               # drop cache records for commands that no longer exist
mmz --import ../wt        # copy cache records from another checkout

Documentation

Start here

  • Quickstart — Install mmz and watch a command skip.
  • Concepts — How rules, records, and freshness fit together.

Writing a manifest

  • Inputs — The files and tool versions a command depends on.
  • Code inputs — Depend on a function or type instead of a whole file.
  • Matching — How a command finds its rule, and how one rule can cover many files.
  • Declared outputs — Declare what a run leaves behind.
  • Gating with tags — Require a check to have passed, without running it again.
  • Composition — Split one manifest across several files.

Reference

More

Contributing

See CONTRIBUTING.md.

License

MIT.

About

Memoized command runner

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages