editkit — a robust LLM edit-format toolkit for TypeScript. Parse and apply
SEARCH/REPLACE blocks, unified diffs, and whole-file edits with battle-tested fuzzy
matching ported from aider.
npm i editkit
# or: pnpm add editkit / bun add editkitimport { applyEdits } from "editkit";
const results = await applyEdits(llmOutput, (path) => readFile(path, "utf8"));
for (const r of results) {
if (r.ok) await writeFile(r.path, r.after);
}Full library docs: packages/editkit/README.md.
| Package | Description | Version |
|---|---|---|
editkit |
The library. Parsers, applier, AI SDK adapter. | |
editkit-docs |
Documentation site (Fumadocs + Next.js). | private |
| Example | What it shows |
|---|---|
agent-loop |
Aider's canonical test-fix loop. Deterministic mock LLM, runs offline. |
ai-sdk-v5 |
Minimal streamEdits demo against OpenAI via the Vercel AI SDK. |
mini-coding-agent |
Full coding-agent loop with multi-file streaming edits, mixed formats, and retry recovery. |
New users — start with mini-coding-agent. It runs without
an API key.
editkit-ts/
├── packages/
│ └── editkit/ # the published library
├── apps/
│ └── docs/ # Fumadocs documentation site
├── examples/
│ ├── agent-loop/
│ ├── ai-sdk-v5/
│ └── mini-coding-agent/
├── .changeset/ # release management (changesets)
├── .github/workflows/ # CI + release automation
├── turbo.json # build orchestration
└── package.json # bun workspaces root
This repo uses Bun workspaces and Turborepo for build orchestration, and Changesets for releases.
bun install # install workspace deps
bun run build # turbo: build all packages (cached)
bun run test # turbo: run all package tests (cached)
bun run typecheck # turbo: typecheck all packages (cached)
bun run lint # biome: lint the whole repo
bun run format # biome: format the whole repo
bun run docs # next dev for the docs site
bun run docs:build # next build for the docs siteRun a task for a single workspace with --filter:
bunx turbo run test --filter=editkit
bunx turbo run build --filter=editkit-example-mini-coding-agentChanges that should ship to npm need a changeset:
bun run changeset # interactive — describe what changedCommit the resulting .changeset/*.md file with your PR. When the PR merges to main, the
release workflow opens (or updates) a "Version Packages" PR that bumps versions and
generates the CHANGELOG. Merging that PR publishes to npm and creates a GitHub release.
See CONTRIBUTING.md. All contributors are expected to follow the Code of Conduct.
Security issues: see SECURITY.md.
See packages/editkit/CHANGELOG.md. Generated by Changesets — every release on npm has a matching entry plus a GitHub release.
MIT — see LICENSE. Portions of the SEARCH/REPLACE fuzzy-matching design are ports of aider's MIT-licensed code; see the package's LICENSE for the original copyright notice.