Stop writing tests.
Let AI cover the gaps.

Lacuna finds your uncovered code, writes real tests with AI, runs them, and retries until they pass — from the terminal or right inside VS Code. Powered by DeepSeek by default — cheap enough to run on every PR.

$ npm install -g lacuna-cli Copied!
View on GitHub
lacuna generate
$  lacuna generate -w 3
 
Model:     deepseek-chat
Runner:    vitest
Threshold: 80%
 
w1  ✓  passed      src/utils/__tests__/math.test.ts
w2  ↻  regen       src/components/__tests__/Modal.test.tsx
w3  ⠸  generating  src/lib/__tests__/formatters.test.ts_
 
✓ 3 fixed   ·   ✗ 0 failed   ·   3 remaining

Field-tested ✓

TypeScript / JavaScript React React Native / Expo Next.js

Supported, not yet field-tested

Vue Python / pytest PHP / PHPUnit

Runner support only

Go Ruby / RSpec Rust C# / Java / Swift

Everything you need to close the gap

Lacuna isn't a code assistant that suggests tests. It's an autonomous agent that writes, runs, and verifies them — and recovers when something goes wrong.

AI-powered generation

Lacuna sends your source file, existing tests, type definitions, and project dependencies to the model — giving it everything needed to write real, meaningful tests.

Verify and retry

Every generated test is immediately run against your actual test suite. If it fails, lacuna records what went wrong and retries with negative constraints so it doesn't repeat the same mistake.

Fix failing tests

Run lacuna fix to repair existing failing tests without rewriting them. The model surgically fixes what's broken and leaves everything else untouched.

Parallel workers

Process multiple files simultaneously with -w 4. Each worker runs independently with a live status display showing what every worker is doing in real time.

Safe by default

If all retries fail or the model gets stuck, your original test file is automatically restored. Oscillation detection stops the loop early when the model is spinning in circles.

Any model, any provider

Works with Claude, GPT-4o, Gemini, DeepSeek, Groq, OpenRouter, Ollama, and LM Studio — or any OpenAI-compatible API. Switch models with a single flag.


From zero to covered in one command

Three steps. No configuration required to get started.

1

Analyze your coverage

Lacuna runs your test suite, reads the coverage report, and finds every file and function below your threshold — without touching any files.

2

Generate and verify

For each gap, lacuna builds a full context — source code, type definitions, existing tests, imports, and mocks — then asks the model to write tests that actually exercise the behavior.

3

Retry until it passes

Generated tests are run immediately. Failures are diagnosed, constraints are recorded, and the model retries with specific instructions not to repeat what failed.

# install once
npm install -g lacuna-cli
 
# in your project
lacuna init      # interactive setup wizard
lacuna analyze   # see what's uncovered
lacuna generate  # fill the gaps (deepseek default)
 
# parallel workers — faster on large repos
lacuna generate -w 4
 
# target a single file
lacuna generate -f src/utils/math.ts
 
# fix failing tests (auto-retries + regenerates)
lacuna fix
lacuna fix -w 4        # fix in parallel
 
# switch model (override default)
lacuna generate -m claude
lacuna generate -m gemini-flash
# .lacuna.json — optional config
{
"model": "deepseek",               // default
"testRunner": "vitest",
"threshold": 80,
"workers": 2,                  // parallel
"mocksFile": "src/test/mocks.ts",
"format": true,               // eslint --fix + prettier
"nodeEnvRouting": true   // DOM-free tests skip jsdom (run in node)
}

Use the model you already have

Lacuna works with any AI provider. Bring your own API key, or run fully local with Ollama or LM Studio — no data leaves your machine.

DeepSeek is the default — it's fast, affordable, and has no rate-limit headaches. Switch to any other provider with a single flag: lacuna generate -m claude

DeepSeek
deepseek-chat · deepseek-reasoner
Default Affordable
Claude
Anthropic · Sonnet 4 / Opus 4
GPT-4o
OpenAI
Gemini
Google · 2.5 Pro / Flash
Groq
Llama 3.3 70B · Fast
Free tier
OpenRouter
100+ models, one key
Ollama
Any local model
Fully local
LM Studio
Any local model
Fully local

Lacuna extension New

Now inside your editor

The same agent, embedded in VS Code (and Cursor, Windsurf, VSCodium). Right-click a file to generate or fix tests, watch a live progress panel, and review every change in a diff before it's kept — without ever leaving your editor.

Install for VS Code Get it on Open VSX

Right-click to generate or fix

Right-click any source file → Generate Tests, or a failing test → Fix Tests. Run a whole folder at once, with parallel workers processing files concurrently.

Live progress, with a real Stop

A legible progress panel streams every phase — generating, running, retrying — plus request count and the learned rules in play. Hit Stop and the in-flight run aborts instantly.

Nothing kept without review

Every generated or fixed file opens in a diff you accept or reject. Shared mock files are always reviewed separately — a run never silently rewrites what the whole suite depends on.

Coverage gaps in the sidebar

A sidebar tree lists every file below threshold or with no test — one click to generate. Uncovered lines are painted in the gutter of the file you're already looking at.

Learned rules, browsable

Lacuna's confidence-weighted memory of framework quirks and mock patterns is browsable in its own view — sort by confidence, and flag a rule that stops helping.

Your key stays yours

Your API key is stored in the OS keychain (VS Code SecretStorage), never written to .lacuna.json. Every run is confirmed and metered up front.

Get started in the editor

Same .lacuna.json, same models — a UI instead of a terminal.

1

Install from the Marketplace

Get it on the VS Code Marketplace or Open VSX (Cursor, Windsurf, VSCodium) — or just search “Lacuna” in the Extensions view.

2

Set up & add your key

Run Lacuna: Set Up to create .lacuna.json, then Lacuna: Set API Key — stored securely in your OS keychain.

3

Right-click → Generate

Pick a source file or a whole folder. Watch the live panel, then accept the diff. Below-threshold files show up in the Coverage Gaps sidebar too.

# the extension embeds the same core —
# nothing to install globally, no shelling out
 
# from the Command Palette (⌘⇧P):
Lacuna: Set Up
Lacuna: Set API Key
Lacuna: Generate Tests
Lacuna: Fix Failing Tests
Lacuna: Toggle Auto Mode
 
# or just right-click a file / folder
 
# editor-only settings (VS Code settings)
{
"lacuna.workers": 4,       // parallel folder runs
"lacuna.alwaysVerbose": true,
"lacuna.confirmBeforeRun": true
}

Ship with confidence.
Coverage handled.