~/bash-gate $ cat README.md | head -4
┌┐ ┌─┐┌─┐┬ ┬ ┌─┐┌─┐┌┬┐┌─┐
├┴┐├─┤└─┐├─┤───│ ┬├─┤ │ ├┤
└─┘┴ ┴└─┘┴ ┴ └─┘┴ ┴ ┴ └─┘
Static analysis of Bash commands: every program a command line may run, with its subcommands, options, paths and effects, and a
policy that allows, asks about or denies it.
Built for gating the commands an AI agent runs. No Node APIs, no native code: the analysis below is the library itself, running in
your browser.
# your own rules
A policy is a list of rules and a default. recommended is a starting point; the
tutorial lets you edit one live.
import { allow, ask, deny, type Policy } from 'bash-gate';
const policy: Policy = {
default: 'ask',
rules: [
allow('git status|log|diff'),
deny('git push', { options: ['-f', '--force-with-lease'], reason: 'No force pushes' }),
deny('rm', { options: ['-r'], args: ['/', '/*', '~', '~/*'] }),
ask({ effects: ['network', 'exec:arbitrary'] }),
ask({ writes: ['..', '../**', '~/**'] }),
],
};