aider-client
v0.1.0
Published
Minimal Node.js wrapper and test suite for Aider CLI
Readme
aider-client
An unofficial minimal Node.js / TypeScript wrapper around the Aider CLI. Lets you run prompts, capture output, and inspect or commit changes programmatically.
🧩 What it does
- Runs the Aider CLI as a child process from Node
- Streams progress output
- Parses commits and file diffs
- Optionally executes safe shell suggestions returned by Aider
- Works with Git repositories — no temporary clones or extra setup
You still need Aider installed locally (pip install aider-chat) and accessible in your PATH.
⚙️ Installation
bun add aider-client
# or
npm install aider-clientRequirements
- Node ≥ 18 (or Bun / Deno)
- A working Git repository (
git initin your project) - The Aider CLI installed and available as
aider
If Aider isn’t on your PATH, pass its full path in aiderPath.
🚀 Quick start
import { AiderClient } from "aider-client";
const aider = new AiderClient({
// aiderPath: "aider", // optional: path to aider binary
// cwd: "/path/to/repo", // optional: repo root
model: "gpt-4o", // optional
});
const result = await aider.runPrompt(
"Overwrite a.txt with the text 'HELLO WORLD'.",
{
autoCommits: true,
yesAlways: true,
}
);
console.log(result.output);
console.log(result.commit);
console.log(result.changes);💬 Handling shell suggestions
When Aider returns shell commands inside its JSON markers:
<<<AIDER_SHELL_JSON>>>
{"shellCommands":[["rm","old.txt"],["mv","foo.txt","bar.txt"]]}
<<<END_AIDER_SHELL_JSON>>>the client can execute them automatically with a safe allow-list:
await aider.runPrompt("Delete old.txt", {
execShellSuggestions: { allow: ["rm", "mv"] },
});Only the allowed commands will run, within the current repository. Disallowed or unsafe commands are skipped.
🧪 Testing
Run the suite (requires an OpenAI key and Aider installed):
npm test
# or
bun testEach integration test sets up a temporary Git repo, runs Aider, and verifies file changes and commits.
📦 Publishing notes
This package ships as TypeScript source (src/ only).
Bun, Deno, and modern TypeScript runtimes import it directly—no build step needed.
If you prefer precompiled JS, you can tsc into dist/ and point "main" there instead.
🧪 License
MIT © 2025 Not affiliated with the official Aider project.
