Newshot

Maak v1.0.0 :: infinitely extensible command runner, build sys in Lisp

Summary

maak is a command runner, and its task list is a Lisp file. You write maak.scm, a perfectly normal Lisp (Guile Scheme) module, and every procedure in it becomes a task you can name on the command line. There is no DSL to learn and no second language to keep in your head: the build is the program. Repo: https://github.com/jjba23/maak (define-module (maak) #:declarative? #t #:use-module (maak maak)) (define (deploy host) "Ship release.tar.gz to HOST." (build) (run (list "rsync" "-avz" "release.tar.gz" (string-append host ":srv/www/")))) $ maak deploy -- example.org The docstring is the entry maak --list prints. The lambda list is the argument grammar. Tasks call each other with a function call, not a subprocess that re-parses a file. There is no second language, and nothing to keep in sync between the task list and the code that runs. run takes a program and its arguments as separate strings, so a path with a space in it stays one argument. run-pipeline connects stages with pipe / dup2 ,…

Original text(via Lobsters)

maak is a command runner, and its task list is a Lisp file. You write maak.scm, a perfectly normal Lisp (Guile Scheme) module, and every procedure in it becomes a task you can name on the command line. There is no DSL to learn and no second language to keep in your head: the build is the program.

Repo: https://github.com/jjba23/maak


        (define-module (maak)
  #:declarative? #t
  #:use-module (maak maak))

(define (deploy host)
  "Ship release.tar.gz to HOST."
  (build)
  (run (list "rsync" "-avz" "release.tar.gz"
             (string-append host ":srv/www/"))))


$ maak deploy -- example.org
      

The docstring is the entry maak --list prints. The lambda list is the argument grammar. Tasks call each other with a function call, not a subprocess that re-parses a file. There is no second language, and nothing to keep in sync between the task list and the code that runs.

  • run takes a program and its arguments as separate strings, so a path with a space in it stays one argument.
  • run-pipeline connects stages with pipe/dup2, reports every failing stage instead of only the last one, can tee what a stage wrote, and can run the whole pipeline as a background job with a pid you can poll.
  • maak -j 4 -- fmt,lint,test forks a worker per task and prints each task's output as one block, in the order you named them.
  • Dry run and quiet are Scheme parameters, so a test can parameterize them instead of threading --dry-run through five layers.
  • A task can declare #:depends, #:hidden? and #:example, and -j orders by those dependencies instead of only fanning out.

You can also use plain static Maak files, maak.yaml, maak.toml and maak.json work with the same --list, --plan and --watch and running of course.


        version: 1

tasks:
  lint:
    doc: Lint and format-check, failing on warnings.
    commands:
      - [cargo, clippy, --, -D, warnings]
      - [cargo, fmt, --check]
      

maak --plan deploy -- example.org runs nothing and prints the typed plan: each argv, working directory, environment, elevation, and whether it would run in the background. With --json the same plan is a versioned object a CI job can archive or diff.

maak explain deploy prints the call graph (what deploy calls, what calls deploy), the load path, the escalation, and which .env file wins for each variable. It answers "why did this run as root" without making you read the file.

There is also maak --watch TASK, which re-runs and reloads the file on change, and maak --list --json, the versioned task description that the Emacs, Neovim, Vim, VS Code, Helix, IntelliJ, Zed and Sublime integrations all read.

Supporting many features for common development and devex, cargo and rustup, uv and pyproject, npm/pnpm/yarn, Maven and Gradle, Guix and Nix (a pinned Guix resolves to a value a task can decide on, not a string another tool re-reads), Podman/Docker and Compose, git, tar and zip, curl and wget, GNU gettext, Emacs Lisp packaging, sift, and Veritas.

I'd love to hear your thoughts, critique and ideas! More improvements to come for sure, now actively looking into improving some shell completions and more things 😄

Happy hacking :)

The text above was extracted automatically from the source page and may miss images, tables or code blocks. The original is authoritative.

Published by Lobsters
This site only summarises and aggregates; copyright stays with the original author. Headlines and summaries follow the source — where they differ, the original wins.
Read the original ↗