Authoring Commands
Commands are executable files located at:
.aynig/command/<state>When dwp-state: <state> appears in the latest commit trailer, AYNIG executes the matching command.
Example
Create a command review:
cat > .aynig/command/review <<'EOF'#!/usr/bin/env bashset -euo pipefail
echo "Review requested: $BODY" >&2printf '%s\n' 'SET_STATE {"state":"done","subject":"review: done","body":"Review completed.","keep_trailers":true}'EOF
chmod +x .aynig/command/reviewTips
- Commands run with the working directory set to the worktree.
- Keep commands idempotent when possible.
- Commands should emit a
SET_STATE {...}line on stdout instead of creating the final commit directly. - Use
"keep_trailers": truewhen the next state should preserve existing workflow metadata such asdwp-attempt,dwp-issue, or similardwp-*trailers. - The runner watches stdout for lines that begin with
SET_STATEand applies the last valid one only if the command exits successfully. - A non-zero exit moves the branch to
stalled; a zero exit with no validSET_STATErefreshesworking. - stderr is not parsed for state transitions.
- Honor
LOG_LEVELif your command supports verbosity.