safe-chains 0.57.5

Auto-allow safe, read-only bash commands in agentic coding tools
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
import { execFileSync } from "node:child_process";

export const SafeChains = async () => ({
  "tool.execute.before": async (input, output) => {
    if (input.tool === "bash") {
      try {
        execFileSync("safe-chains", [output.args.command]);
      } catch {
        throw new Error("Command not in safe-chains allowlist");
      }
    }
  }
})