shell — Shell exec
Execute shell commands and capture stdout and stderr. Enable with "shell" in your tools array.
WarningThe
shell tool can run arbitrary commands. Only enable it when your task genuinely requires it, and always review the plan with testy-claw plan before running.Functions
| Function | Description |
|---|---|
| shell.exec(cmd) | Run a command, return { stdout, stderr, exitCode } |
| shell.exec(cmd, { cwd }) | Run in a specific working directory |
| shell.exec(cmd, { env }) | Run with extra environment variables |
| shell.exec(cmd, { timeout }) | Override the per-command timeout |
Example
terminal
testy-claw run "install dependencies and run the build"
✓ shell.exec("npm install") → added 142 packages
✓ shell.exec("npm run build") → dist/ created (12 files)
✓ Done in 18.4sRestricting commands
You can whitelist allowed commands in your config to prevent the agent from running unexpected shell operations.
claw.config.ts
export default defineConfig({
tools: ["fs", "shell"],
shellAllowList: ["npm", "npx", "node", "git"],
// Any command not in this list will be blocked
});