{"id":23746514,"url":"https://github.com/ffimnsr/mk-rs","last_synced_at":"2025-07-08T11:05:08.351Z","repository":{"id":269964361,"uuid":"908848891","full_name":"ffimnsr/mk-rs","owner":"ffimnsr","description":"Yet another simple task runner. 🦀","archived":false,"fork":false,"pushed_at":"2025-02-21T09:03:51.000Z","size":526,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-30T21:06:29.489Z","etag":null,"topics":["cli","command-line","make","rust","utility"],"latest_commit_sha":null,"homepage":"http://me.vastorigins.com/mk-rs/","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ffimnsr.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE-APACHE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["ffimnsr"]}},"created_at":"2024-12-27T05:49:47.000Z","updated_at":"2025-02-21T08:55:30.000Z","dependencies_parsed_at":"2025-01-21T10:23:35.011Z","dependency_job_id":"e162191b-c0f5-4730-b3ab-65afea50cb5a","html_url":"https://github.com/ffimnsr/mk-rs","commit_stats":null,"previous_names":["ffimnsr/mk-rs"],"tags_count":23,"template":false,"template_full_name":null,"purl":"pkg:github/ffimnsr/mk-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ffimnsr%2Fmk-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ffimnsr%2Fmk-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ffimnsr%2Fmk-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ffimnsr%2Fmk-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ffimnsr","download_url":"https://codeload.github.com/ffimnsr/mk-rs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ffimnsr%2Fmk-rs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262850263,"owners_count":23374354,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","command-line","make","rust","utility"],"created_at":"2024-12-31T13:38:44.729Z","updated_at":"2025-06-30T21:07:15.805Z","avatar_url":"https://github.com/ffimnsr.png","language":"HTML","funding_links":["https://github.com/sponsors/ffimnsr"],"categories":[],"sub_categories":[],"readme":"# mk (Make)\n\n[![Crates.io Package](https://img.shields.io/crates/v/mk?style=flat-square)](https://crates.io/crates/mk)\n[![Crates.io Downloads](https://img.shields.io/crates/d/mk?style=flat-square)](https://crates.io/crates/mk)\n[![License](https://img.shields.io/crates/l/mk?style=flat-square)](https://github.com/ffimnsr/mk-rs/blob/master/LICENSE-APACHE)\n[![Github Workflow Status](https://img.shields.io/github/actions/workflow/status/ffimnsr/mk-rs/ci.yml?style=flat-square)](https://github.com/ffimnsr/mk-rs/blob/master/.github/workflows/ci.yml)\n\n\u003e Efficiency is doing things right; effectiveness is doing the right things. This tool helps you do both.\n\u003e One task runner to rule them all.\n\n\nYet another simple task runner.\n\n`mk` is a powerful and flexible task runner designed to help you automate and manage your tasks efficiently. It supports running commands both locally and inside containers, making it versatile for various environments and use cases. Running tasks in containers is a first-class citizen, ensuring seamless integration with containerized workflows.\n\n![preview](./docs/images/preview.png)\n\n## Features\n\n- **Simple Configuration**: Define your tasks in a straightforward YAML file.\n- **Flexible Execution**: Run tasks locally, in containers, or as nested tasks.\n- **Error Handling**: Control how errors are handled with `ignore_errors`.\n- **Verbose Output**: Enable verbose output for detailed logs.\n\n## Configuration format support\n\nOther supported file type configurations format:\n\n- JSON\n- TOML\n- Lua\n\nSee example folder for sample configuration file.\n\n## Installation\n\nBinary for different OS distribution can be downloaded [here](https://github.com/ffimnsr/mk-rs/releases). Linux, macOS, and Windows are supported.\n\n### Install using script\n\n`mk` runs on most major platforms. If your platform isn't listed below, please [open an issue](https://github.com/ffimnsr/mk-rs/issues/new).\n\n\u003cdetails\u003e\n  \u003csummary\u003eLinux / WSL / MSYS2 / Cygwin / Git Bash\u003c/summary\u003e\n\n  \u003e The recommended way to install mk is via the install script:\n  \u003e\n  \u003e\n  \u003e ```sh\n  \u003e curl -sSfL https://raw.githubusercontent.com/ffimnsr/mk-rs/main/install.sh | sh\n  \u003e ```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eBSD / Android\u003c/summary\u003e\n\n  \u003e The recommended way to install mk is via the install script:\n  \u003e\n  \u003e\n  \u003e ```sh\n  \u003e curl -sS https://raw.githubusercontent.com/ffimnsr/mk-rs/main/install.sh | bash\n  \u003e ```\n\u003c/details\u003e\n\n### From source\n\nIf you're into **Rust**, then `mk` can be installed with `cargo`. The minimum supported version of Rust is `1.37.0`. The binaries produce may be bigger than expected as it contains debug symbols.\n\n```bash\ncargo install --locked mk\n```\n\n### Manual installation\n\nFollow the instruction below to install and use `mk` on your system.\n\n1. Download the binary for your OS distribution [here](https://github.com/ffimnsr/mk-rs/releases).\n2. Copy it to your system binary directory (`/usr/local/bin`) or to your userspace binary directory (`$HOME/.local/bin`).\n\n\n## Usage\n\n### Using CLI\n\n```bash\nYet another simple task runner 🦀\n\nUsage: mk [OPTIONS] [TASK_NAME] [COMMAND]\n\nCommands:\n  run          Run specific tasks [aliases: r]\n  list         List all available tasks [aliases: ls]\n  completions  Generate shell completions [aliases: comp]\n  secrets      Access stored secrets [aliases: s]\n  help         Print this message or the help of the given subcommand(s)\n\nArguments:\n  [TASK_NAME]  The task name to run\n\nOptions:\n  -c, --config \u003cCONFIG\u003e  Config file to source [default: tasks.yaml]\n  -h, --help             Print help\n  -V, --version          Print version\n```\n\nHere is a sample command line usage of `mk`.\n\n```bash\nmk -c tasks.yaml \u003ctask_name\u003e\n\n...or...\n\nmk run \u003ctask_name\u003e\n```\n\nBoth commands above are equivalent. The config file can be omitted as `mk` defaults to file `tasks.yaml`.\n\n### Makefile and task.yaml comparison\n\nBelow is the Makefile:\n\n```makefile\ncov := \"--cov=test --cov-branch --cov-report=term-missing\"\n\nall:\n    @just --list\n\ninstall:\n    pip install -r requirements/dev.txt -r requirements/test.txt -e .\n\nclean: clean-build clean-pyc\n\nclean-build:\n    rm -rf build dist test.egg-info\n\nclean-pyc:\n    find . -type f -name *.pyc -delete\n\nlint:\n    ruff check test --line-length 100\n\nbuild: lint clean\n    python setup.py sdist bdist_wheel\n\nrelease: build \u0026\u0026 tag\n    twine upload dist/*\n\ntag:\n    #!/usr/bin/env zsh\n    tag=$(python -c 'import test; print(\"v\" + test.__version__)')\n    git tag -a $tag -m \"Details: https://github.com/sample/sample.git\"\n    git push origin $tag\n\ntest:\n    pytest {{ cov }}\n\nptw:\n    ptw -- {{ cov }}\n\ncov-report:\n    coverage report -m\n```\n\nAnd here's the rewritten tasks.yaml file, converted from the original Makefile above:\n\n```yaml\ntasks:\n  install: pip install -r requirements/dev.txt -r requirements/test.txt -e .\n  clean:\n    commands:\n      - task: clean-build\n      - task: clean-pyc\n  clean-build: |\n    rm -rf build dist test.egg-info\n  clean-pyc: find . -type f -name *.pyc -delete\n  lint: ruff check test --line-length 100\n  build:\n    depends_on:\n      - lint\n      - clean\n    commands:\n      - python setup.py sdist bdist_wheel\n  release:\n    depends_on:\n      - build\n      - tag\n    commands:\n      - twine upload dist/*\n  tag:\n    commands:\n      - command: |\n          tag=$(python -c 'import test; print(\"v\" + test.__version__)')\n          git tag -a $tag -m \"Details: https://github.com/sample/sample.git\"\n          git push origin $tag\n        shell: zsh\n  test: pytest --cov=test --cov-branch --cov-report=term-missing\n  ptw: ptw -- --cov=test --cov-branch --cov-report=term-missing\n  cov-report: coverage html\n```\n\nBy transforming our 40-line Makefile into a streamlined 30-line tasks.yaml file, we can achieve a cleaner and more efficient setup.\nThis new format is not only more editor-friendly but also supports code folding for better readability.\n\nAs you can see, most of the fields are optional and can be omitted. You only need to modify them when deeper configuration is required.\n\n### Sample real-world task yaml\n\nLet's create a sample yaml file called `tasks.yaml`.\n\n```yaml\ntasks:\n  task1:\n    commands:\n      - command: |\n          echo $FOO\n          echo $BAR\n        shell: bash\n        ignore_errors: false\n        verbose: true\n      - command: 'true'\n        shell: zsh\n        ignore_errors: true\n        verbose: true\n      - command: echo $BAR\n        ignore_errors: false\n        verbose: true\n    depends_on:\n      - name: task1\n    description: This is a task\n    labels: {}\n    environment:\n      FOO: bar\n    env_file:\n      - test.env\n```\n\nHere's the `test.env` that needed by the yaml file:\n\n```dotenv\nBAR=foo\n```\n\nThis yaml task named `task1` can be run on `mk` with the command below:\n\n\n```bash\nmk task1\n```\n\nHere's a longer version Yaml that utilize container run on `task5`:\n\n```yaml\ntasks:\n  task1:\n    depends_on:\n      - name: task4\n    preconditions:\n      - command: echo \"Precondition 1\"\n      - command: echo \"Precondition 2\"\n    commands:\n      - command: |\n          echo $FOO\n          echo $BAR\n        verbose: true\n      - command: echo fubar\n        verbose: true\n      - command: echo $BAR\n        verbose: true\n      - task: task3\n    description: This is a task\n    labels:\n      - label=1\n      - label=2\n    environment:\n      FOO: bar\n    env_file:\n      - test.env\n  task2:\n    commands:\n      - command: echo $FOO\n        verbose: true\n    depends_on:\n      - name: task1\n    description: This is a task\n    labels: {}\n    environment:\n      FOO: bar\n    env_file:\n      - test.env\n  task3:\n    commands:\n      - command: echo $FOO\n        verbose: true\n    description: This is a task\n    labels: {}\n    environment:\n      FOO: bar\n    env_file:\n      - test.env\n  task4:\n    commands:\n      - command: echo $FOO\n        verbose: true\n    description: This is a task\n    labels: {}\n    environment:\n      FOO: fubar\n    env_file:\n      - test.env\n  task5:\n    commands:\n      - container_command:\n          - bash\n          - -c\n          - echo $FOO\n        image: docker.io/library/bash:latest\n        verbose: true\n    description: This is a task\n    labels: {}\n    environment:\n      FOO: fubar\n    env_file:\n      - test.env\n```\n\n#### Support for anchors and aliases\n\nThe tasks.yaml file currently supports YAML anchors and aliases, allowing you to avoid repetition.\nHere's a sample configuration:\n\n```yaml\nx-sample: \u0026task-precondition\n  preconditions:\n    - command: echo \"Precondition 1\"\n    - command: echo \"Precondition 2\"\n\ntasks:\n  task_a:\n    \u003c\u003c: *task-precondition\n    commands:\n      - command: echo \"I'm on macOS\"\n        test: test $(uname) = 'Darwin'\n      - command: echo \"I'm on Linux\"\n        test: test $(uname) = 'Linux'\n```\n\n#### Handling Cyclic Dependencies\n\nCyclic dependencies occur when a task depends on itself, either directly or indirectly, creating a loop that can cause the system to run indefinitely. To prevent this, the system detects cyclic dependencies and exits immediately with an error message.\n\n##### Example of Cyclic Dependency\n\nConsider the following tasks:\n\n```yaml\ntasks:\n  task_a:\n    depends_on:\n      - task_b\n    commands:\n      - command: \"echo 'Running task A'\"\n        shell: \"sh\"\n        ignore_errors: false\n        verbose: true\n  task_b:\n    depends_on:\n      - task_c\n    commands:\n      - command: \"echo 'Running task B'\"\n        shell: \"sh\"\n        ignore_errors: false\n        verbose: true\n  task_c:\n    depends_on:\n      - task_a\n    commands:\n      - command: \"echo 'Running task C'\"\n        shell: \"sh\"\n        ignore_errors: false\n        verbose: true\n```\n\nIn this example, task_a depends on task_b, task_b depends on task_c, and task_c depends on task_a, creating a cyclic dependency.\n\n#### How the System Handles Cyclic Dependencies\n\nWhen the system detects a cyclic dependency, it exits immediately with an error message indicating the cycle. This prevents the system from entering an infinite loop.\n\n## Secret Vault\n\nTo generate secrets, first create a private key:\n\n```bash\nmk secrets key gen\n```\n\nThe key will be saved in the default directory `~/.config/mk/priv`. This can be changed if needed.\n\nNext, initialize a secret vault:\n\n```bash\nmk secrets vault init\n```\n\nTo store secrets (for example, saving a dotenv file in the vault):\n\n```bash\ncat .env | mk secrets vault set app/development/jobserver\n```\n\nTo display secrets:\n\n```bash\nmk secrets vault show app/development/jobserver\n```\n\nTo export secrets back to a dotenv file:\n\n```bash\nmk secrets vault export --output .env app/development/jobserver\n\n...or...\n\nmk secrets vault export app/development/jobserver \u003e .env\n```\n\n## Config Schema\n\nThe docs can be found [here](https://me.vastorigins.com/mk-rs/#/schema).\n\n## What's on the roadmap?\n\n- [ ] Add global context for environment and output\n- [ ] Add support for makefile, markdown and org-mode as task config format\n- [ ] Add `interactive` field for commands that can accept stdin (i.e. python, psql)\n- [ ] Add support for saving and reusing command output (output can be reused on other command inside a task)\n- [ ] Add implementation to use vault secrets\n- [ ] Add proper documentation\n- [ ] Add support for cargo env\n- [ ] Add support for trigger reload when on cargo run\n- [ ] Add fuzzy finder for tasks\n- [ ] Add more unit tests and benchmarks\n- [ ] Add support for npm commands\n- [ ] Add fuzzer scripts for code fuzzing\n- [ ] Complete the code coverage\n- [ ] Import and include yaml from local (relative paths, and absolute) and remote sources\n- [ ] Make sure to support windows and macOS\n- [ ] Make use of labels\n- [ ] Proper prop argument drilling so ignore_errors on defined on task would go down properly on child commands\n- [ ] Support for lima and nerdctrl\n- [ ] There's still a lot of unknown, if you found a bug please report.\n\n## License\n\nLicensed under either of\n\n- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or\n  http://www.apache.org/licenses/LICENSE-2.0)\n- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\n### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n\n## References\n\n- https://taskfile.dev/ - Taskfile\n- https://compose-spec.github.io/compose-spec/ - Docker Compose\n- https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_intro.html - Ansible\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fffimnsr%2Fmk-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fffimnsr%2Fmk-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fffimnsr%2Fmk-rs/lists"}