[go: up one dir, main page]

cmdy 0.1.2

Lists and runs predefined command snippets
amends "package://github.com/jdx/hk/releases/download/v1.0.0/hk@1.0.0#/Config.pkl"
import "package://github.com/jdx/hk/releases/download/v1.0.0/hk@1.0.0#/Builtins.pkl"

local linters = new Mapping<String, Step> {
    // uses builtin prettier linter config
    ["prettier"] = Builtins.prettier

    // Custom linter for pkl files
    ["pkl"] {
        glob = "*.pkl"
        check = "pkl eval {{files}} >/dev/null"
    }

    ["cargo-check"] = Builtins.cargo_check
    ["cargo-clippy"] = Builtins.cargo_clippy
    ["cargo-fmt"] = Builtins.cargo_fmt
    ["taplo"] = Builtins.taplo
}

hooks {
    ["pre-commit"] {
        stash = "patch-file" // stashes unstaged changes while running fix steps
        steps = linters
    }

    ["commit-msg"] {
        steps {
            ["conventional-commits"] {
                check = "scripts/check-commit-msg {{commit_msg_file}}"
            }
        }
    }
    ["pre-push"] {
        steps = linters
    }

    // "fix" and "check" are special steps for `hk fix` and `hk check` commands
    ["fix"] {
        steps = linters
    }
    ["check"] {
        steps = linters
    }
}