Check a command first
moat policy check "git push origin main"→ defer rules : default reason: no rule matched shell "git push origin main"moat policy check runs nothing. It parses the command the way the hook does and prints the answer, the rules that decided it and the reason.
More examples
Section titled “More examples”moat policy check "cat ~/.ssh/id_rsa" # deny: secrets-pathsmoat policy check "git config core.hooksPath .h" # ask: git-internalsmoat policy check "https://docs.rs/serde" --kind fetch # a web fetch, not a shell commandmoat policy check "~/.aws/credentials" --kind fs-read # a file read by a file toolUse it in scripts
Section titled “Use it in scripts”The exit code is the answer:
| Exit code | Answer |
|---|---|
0 |
allow or defer |
2 |
deny |
3 |
ask |
64 |
a usage or configuration error |