Runs the command with the named secrets in its environment, and nowhere else. Nothing in the line holds a secret, so nothing you write can spill one.
monkeys run [@profile] <KEY[,KEY...]> <command> [argument...]monkeys run [@profile] --all <command> [argument...]monkeys run <command> [argument...] # inside a project
Runs the command with the named secrets in its environment, and nowhere else.
Nothing in the line holds a secret, so nothing you write can spill one:
monkeys run OPENROUTER_API_KEY ./hello.shmonkeys run OPENROUTER_API_KEY,GITHUB_TOKEN ./deploy
Once every secret is in place, run stays between the command and your
terminal to redact what comes back; the exit status and the signals are the
command's own.
In a directory that holds a .monkeys file, or below it within the checkout,
run takes only the command and reads the file's keys from the default
profile. A leading @profile picks another declared one:
monkeys run ./hello.shmonkeys run npm run devmonkeys run @production ./deploy
A key the file already lists is refused rather than run as a program:
monkeys run STRIPE_SECRET_KEY ./hello.sh
monkeys: ~/foo/.monkeys already lists STRIPE_SECRET_KEY for @testinside a project, run takes only the command: monkeys run <command>
run sets the variable for the command it starts, so that command is what
expands it. Written into the monkeys run line itself, your own shell gets
there first, and yours does not have the secret:
A stored secret in the command's output comes back as [redacted KEY]:
monkeys run OPENROUTER_API_KEY sh -c 'echo "key=$OPENROUTER_API_KEY"'
key=[redacted OPENROUTER_API_KEY]
That is the reflex this exists for. An agent that meets an empty variable will
echo it, and now the echo says which secret was there and nothing else. The
output is streamed as it arrives: a byte is held back only while it could
still be the start of a secret, and on a terminal that moment shows as *
until the next byte settles it.
It catches the secret written whole or in pieces, on stdout or stderr. It
does not catch the secret transformed, so echo $KEY | base64 goes through;
this is for the reflex, not for someone trying.
A short secret is redacted wherever it appears, so store secrets here and keep
PORT=3000 in the repository.
--no-redact turns redaction off and runs the command in monkeys's place,
for the one case that needs the secret in the output, such as writing it into
a file a program will read:
monkeys run --no-redact OPENROUTER_API_KEY envsubst < template > config
monkeys run @production zsh hands a whole profile to one shell, which forgets it on
exit. That is the way to work with a profile for a while without putting it
into every shell you open.