@lisa.ai/agent 2.9.7 → 2.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +149 -72
- package/dist/index.js +189 -161
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,11 +14,32 @@ You need at least one LLM API key set as an environment variable:
|
|
|
14
14
|
|
|
15
15
|
| Provider | Env var | Default model |
|
|
16
16
|
|---|---|---|
|
|
17
|
-
| Google Gemini | `GOOGLE_GENERATIVE_AI_API_KEY` | `gemini-2.0-flash` |
|
|
18
17
|
| Anthropic Claude | `ANTHROPIC_API_KEY` | `claude-haiku-4-5` |
|
|
18
|
+
| Google Gemini | `GOOGLE_GENERATIVE_AI_API_KEY` | `gemini-2.0-flash` |
|
|
19
19
|
| OpenAI | `OPENAI_API_KEY` | `gpt-4o-mini` |
|
|
20
20
|
|
|
21
|
-
Override the default model per provider with `
|
|
21
|
+
Override the default model per provider with `LISA_CLAUDE_MODEL`, `LISA_GOOGLE_MODEL`, or `LISA_OPENAI_MODEL`.
|
|
22
|
+
|
|
23
|
+
## Quick Start
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# 1. Set your API key
|
|
27
|
+
export ANTHROPIC_API_KEY="sk-ant-..."
|
|
28
|
+
|
|
29
|
+
# 2. (Optional) Create project config
|
|
30
|
+
lisa-agent init
|
|
31
|
+
|
|
32
|
+
# 3. Heal broken tests
|
|
33
|
+
lisa-agent heal
|
|
34
|
+
|
|
35
|
+
# 4. Generate missing unit tests
|
|
36
|
+
lisa-agent unit
|
|
37
|
+
|
|
38
|
+
# 5. Generate E2E tests
|
|
39
|
+
lisa-agent e2e
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
**Zero config required.** The agent auto-detects your test framework, package manager, and builds the correct commands automatically.
|
|
22
43
|
|
|
23
44
|
## Commands
|
|
24
45
|
|
|
@@ -27,7 +48,7 @@ Override the default model per provider with `LISA_GOOGLE_MODEL`, `LISA_CLAUDE_M
|
|
|
27
48
|
Runs your test command, identifies every failing spec, and autonomously fixes them using LLM-generated patches. Each fix is verified in isolation before moving on.
|
|
28
49
|
|
|
29
50
|
```bash
|
|
30
|
-
lisa-agent heal
|
|
51
|
+
lisa-agent heal
|
|
31
52
|
|
|
32
53
|
# Heal specific files only (skip discovery)
|
|
33
54
|
lisa-agent heal --files src/app/todo.spec.ts,src/app/auth.spec.ts
|
|
@@ -35,8 +56,8 @@ lisa-agent heal --files src/app/todo.spec.ts,src/app/auth.spec.ts
|
|
|
35
56
|
# Heal E2E tests
|
|
36
57
|
lisa-agent heal --type e2e
|
|
37
58
|
|
|
38
|
-
# Heal
|
|
39
|
-
lisa-agent heal --
|
|
59
|
+
# Heal in CI mode (commit + open PR)
|
|
60
|
+
lisa-agent heal --ci
|
|
40
61
|
```
|
|
41
62
|
|
|
42
63
|
**How it works:**
|
|
@@ -50,11 +71,10 @@ lisa-agent heal --type e2e --files e2e/login.spec.ts
|
|
|
50
71
|
|
|
51
72
|
### `unit` — Generate Unit Tests
|
|
52
73
|
|
|
53
|
-
Runs your test suite with coverage enabled, identifies files below
|
|
74
|
+
Runs your test suite with coverage enabled, identifies files below threshold, discovers source files with no tests at all, and generates new test specs to close the gaps.
|
|
54
75
|
|
|
55
76
|
```bash
|
|
56
|
-
lisa-agent unit
|
|
57
|
-
lisa-agent unit --command "npx jest --coverage --coverageReporters=json-summary" --model claude
|
|
77
|
+
lisa-agent unit
|
|
58
78
|
|
|
59
79
|
# Generate tests for specific source files only
|
|
60
80
|
lisa-agent unit --files src/services/auth.service.ts,src/services/user.service.ts
|
|
@@ -63,9 +83,9 @@ lisa-agent unit --files src/services/auth.service.ts,src/services/user.service.t
|
|
|
63
83
|
**How it works:**
|
|
64
84
|
1. Auto-detects test framework (Jest, Vitest, Karma, Mocha) and builds coverage command
|
|
65
85
|
2. Runs tests with coverage, parses `coverage-summary.json`
|
|
66
|
-
3. Identifies uncovered source files
|
|
86
|
+
3. Identifies uncovered files from coverage report **and** source files with no spec at all
|
|
67
87
|
4. Generates unit test specs targeting uncovered code via LLM
|
|
68
|
-
5. If generated tests fail, delegates to the heal loop
|
|
88
|
+
5. If generated tests fail, delegates to the heal loop automatically
|
|
69
89
|
6. Re-runs coverage and reports delta
|
|
70
90
|
|
|
71
91
|
**Auto-detected coverage commands:**
|
|
@@ -82,7 +102,7 @@ lisa-agent unit --files src/services/auth.service.ts,src/services/user.service.t
|
|
|
82
102
|
Generates Playwright end-to-end tests by discovering your app's routes and creating specs for each page/flow. Auto-installs Playwright if no E2E framework is detected.
|
|
83
103
|
|
|
84
104
|
```bash
|
|
85
|
-
lisa-agent e2e
|
|
105
|
+
lisa-agent e2e
|
|
86
106
|
|
|
87
107
|
# Generate E2E test for a specific spec path
|
|
88
108
|
lisa-agent e2e --files e2e/login.spec.ts
|
|
@@ -100,18 +120,12 @@ lisa-agent e2e --files e2e/login.spec.ts
|
|
|
100
120
|
Generates integration tests that exercise module seams — testing 2+ modules together without full E2E overhead.
|
|
101
121
|
|
|
102
122
|
```bash
|
|
103
|
-
lisa-agent integration
|
|
123
|
+
lisa-agent integration
|
|
104
124
|
|
|
105
125
|
# Generate integration test for specific files
|
|
106
126
|
lisa-agent integration --files src/services/auth.service.ts
|
|
107
127
|
```
|
|
108
128
|
|
|
109
|
-
**How it works:**
|
|
110
|
-
1. Detects app type (Angular, React, Express, NestJS, Node)
|
|
111
|
-
2. Discovers integration targets: component+service pairs, controller files, multi-import modules
|
|
112
|
-
3. Generates integration specs with real services (not mocked) via LLM
|
|
113
|
-
4. Runs specs and heals failures
|
|
114
|
-
|
|
115
129
|
**What it generates:**
|
|
116
130
|
- **Angular:** TestBed with real services, multi-component interactions, `HttpClientTestingModule`
|
|
117
131
|
- **Express/NestJS:** Supertest-based endpoint tests with test DB, middleware chains
|
|
@@ -122,7 +136,7 @@ lisa-agent integration --files src/services/auth.service.ts
|
|
|
122
136
|
Scans your project for npm vulnerabilities, applies safe fixes automatically, and consults an LLM for breaking changes that need manual intervention.
|
|
123
137
|
|
|
124
138
|
```bash
|
|
125
|
-
lisa-agent audit
|
|
139
|
+
lisa-agent audit
|
|
126
140
|
```
|
|
127
141
|
|
|
128
142
|
**How it works:**
|
|
@@ -137,7 +151,7 @@ lisa-agent audit --model gemini
|
|
|
137
151
|
Sends a simple probe to your configured LLM provider to verify your API key works and the model is reachable.
|
|
138
152
|
|
|
139
153
|
```bash
|
|
140
|
-
lisa-agent diagnose
|
|
154
|
+
lisa-agent diagnose
|
|
141
155
|
```
|
|
142
156
|
|
|
143
157
|
### `init` — Create Project Config
|
|
@@ -166,19 +180,19 @@ The generated workflow:
|
|
|
166
180
|
4. If tests fail and Lisa heals them, opens a PR automatically
|
|
167
181
|
5. Writes a step summary to the GitHub Actions UI
|
|
168
182
|
|
|
169
|
-
**Required setup:** Add your LLM API key as a repository secret in GitHub (Settings > Secrets > Actions).
|
|
183
|
+
**Required setup:** Add your LLM API key as a repository secret in GitHub (Settings > Secrets > Actions).
|
|
170
184
|
|
|
171
185
|
| Provider | Secret name |
|
|
172
186
|
|---|---|
|
|
173
|
-
| Gemini | `GOOGLE_GENERATIVE_AI_API_KEY` |
|
|
174
187
|
| Claude | `ANTHROPIC_API_KEY` |
|
|
188
|
+
| Gemini | `GOOGLE_GENERATIVE_AI_API_KEY` |
|
|
175
189
|
| OpenAI | `OPENAI_API_KEY` |
|
|
176
190
|
|
|
177
191
|
`GITHUB_TOKEN` is provided automatically by GitHub Actions — no PAT needed.
|
|
178
192
|
|
|
179
193
|
## Common Options
|
|
180
194
|
|
|
181
|
-
All test commands (`heal`, `unit`, `e2e`, `integration
|
|
195
|
+
All test commands (`heal`, `unit`, `e2e`, `integration`) accept:
|
|
182
196
|
|
|
183
197
|
| Flag | Description | Default |
|
|
184
198
|
|---|---|---|
|
|
@@ -197,8 +211,9 @@ Place a `.lisai.json` in your project root to configure the agent without CLI fl
|
|
|
197
211
|
|
|
198
212
|
```json
|
|
199
213
|
{
|
|
200
|
-
"
|
|
201
|
-
"
|
|
214
|
+
"projectId": "my-project-123",
|
|
215
|
+
"provider": "claude",
|
|
216
|
+
"model": "claude-haiku-4-5",
|
|
202
217
|
"testCommand": "npm test",
|
|
203
218
|
"testingFramework": "jest",
|
|
204
219
|
"e2eFramework": "playwright",
|
|
@@ -207,12 +222,17 @@ Place a `.lisai.json` in your project root to configure the agent without CLI fl
|
|
|
207
222
|
"maxRetries": 5,
|
|
208
223
|
"skipFiles": ["server.js", "app.js"],
|
|
209
224
|
"skipDirs": ["scripts", "migrations"],
|
|
210
|
-
"skipPaths": ["src/generated", "src/fixtures"]
|
|
225
|
+
"skipPaths": ["src/generated", "src/fixtures"],
|
|
226
|
+
"lisaLlm": {
|
|
227
|
+
"enabled": true,
|
|
228
|
+
"model": "qwen2.5-coder:7b"
|
|
229
|
+
}
|
|
211
230
|
}
|
|
212
231
|
```
|
|
213
232
|
|
|
214
233
|
| Field | Type | Description |
|
|
215
234
|
|---|---|---|
|
|
235
|
+
| `projectId` | `string` | Control Plane project ID — saves you from passing `--project-id` every time |
|
|
216
236
|
| `provider` | `gemini \| claude \| openai` | LLM provider |
|
|
217
237
|
| `model` | `string` | Pin a specific model ID (e.g. `claude-sonnet-4-6`) |
|
|
218
238
|
| `testCommand` | `string` | Override unit test command (skips auto-detection) |
|
|
@@ -220,27 +240,99 @@ Place a `.lisai.json` in your project root to configure the agent without CLI fl
|
|
|
220
240
|
| `e2eFramework` | `playwright \| cypress` | Override E2E framework detection |
|
|
221
241
|
| `e2eCommand` | `string` | Override E2E test command |
|
|
222
242
|
| `testTypes` | `string[]` | Types of tests to generate: `unit`, `integration`, `e2e` |
|
|
223
|
-
| `maxRetries` | `number` | Max heal/generation retries per
|
|
243
|
+
| `maxRetries` | `number` | Max heal/generation retries per file (default 5) |
|
|
224
244
|
| `skipFiles` | `string[]` | Filenames to exclude from analysis |
|
|
225
245
|
| `skipDirs` | `string[]` | Directory names to exclude |
|
|
226
246
|
| `skipPaths` | `string[]` | Path prefixes to exclude |
|
|
247
|
+
| `lisaLlm` | `object` | Lisa LLM local tier config (see below) |
|
|
227
248
|
|
|
228
249
|
All fields are **optional**. The agent auto-detects everything. This file is the escape hatch for unusual setups.
|
|
229
250
|
|
|
251
|
+
### Lisa LLM — Local-First Tier (v2.10.0)
|
|
252
|
+
|
|
253
|
+
Lisa LLM adds a local LLM tier (Ollama or any OpenAI-compatible server) that attempts fixes **before** calling cloud APIs. When the Memory Engine has a high-confidence proven fix pattern, the agent tries the local model first — **zero API cost**. Falls back to cloud on failure.
|
|
254
|
+
|
|
255
|
+
**Enable via `.lisai.json`:**
|
|
256
|
+
```json
|
|
257
|
+
{
|
|
258
|
+
"lisaLlm": {
|
|
259
|
+
"enabled": true,
|
|
260
|
+
"provider": "ollama",
|
|
261
|
+
"model": "qwen2.5-coder:7b",
|
|
262
|
+
"baseUrl": "http://localhost:11434",
|
|
263
|
+
"confidenceThreshold": 0.8
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
**Or via environment variables:**
|
|
269
|
+
```bash
|
|
270
|
+
LISA_LLM_ENABLED=true
|
|
271
|
+
LISA_LLM_MODEL=qwen2.5-coder:7b
|
|
272
|
+
LISA_LLM_URL=http://localhost:11434
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
| Field | Default | Description |
|
|
276
|
+
|---|---|---|
|
|
277
|
+
| `enabled` | `false` | Opt-in. Set `true` or `LISA_LLM_ENABLED=true` |
|
|
278
|
+
| `provider` | `"ollama"` | Any OpenAI-compatible server works (LM Studio, LocalAI, vLLM) |
|
|
279
|
+
| `model` | `"qwen2.5-coder:7b"` | Swappable — `deepseek-coder-v3`, `codestral`, etc. |
|
|
280
|
+
| `baseUrl` | `"http://localhost:11434"` | Ollama default. Override for other servers |
|
|
281
|
+
| `confidenceThreshold` | `0.8` | Minimum pattern confidence to trigger local tier |
|
|
282
|
+
|
|
283
|
+
**How it works:**
|
|
284
|
+
1. Memory Engine returns proven patterns with confidence scores
|
|
285
|
+
2. If `confidence >= threshold` and Lisa LLM is enabled → Tier 1 (local) attempt
|
|
286
|
+
3. Local fix verified → **done** (zero API cost, logged as `resolvedBy: 'lisa-llm'`)
|
|
287
|
+
4. Local fix fails → falls through to Tier 2 (cloud) — **doesn't burn a retry**
|
|
288
|
+
5. No high-confidence patterns → skip local, go directly to cloud
|
|
289
|
+
|
|
290
|
+
**Requirements:** [Ollama](https://ollama.com/) running locally with a code model pulled:
|
|
291
|
+
```bash
|
|
292
|
+
ollama pull qwen2.5-coder:7b
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
**Dashboard:** The project page shows a "Lisa LLM vs Cloud" breakdown card with resolution counts and success rate when Lisa LLM data exists.
|
|
296
|
+
|
|
297
|
+
### `.env` File
|
|
298
|
+
|
|
299
|
+
The agent loads `.env` from your project root (the directory where you run the command). You can put all config here:
|
|
300
|
+
|
|
301
|
+
```env
|
|
302
|
+
ANTHROPIC_API_KEY=sk-ant-your-key-here
|
|
303
|
+
LISA_CLAUDE_MODEL=claude-sonnet-4-6
|
|
304
|
+
LISA_CONTROL_PLANE_URL=http://localhost:3088
|
|
305
|
+
```
|
|
306
|
+
|
|
230
307
|
### Config Priority
|
|
231
308
|
|
|
232
309
|
Settings are resolved in this order (highest wins):
|
|
233
310
|
|
|
234
311
|
```
|
|
235
|
-
Shell env var > Control Plane > CLI flag >
|
|
312
|
+
Shell env var > .lisai.json > Control Plane > CLI flag > built-in default
|
|
236
313
|
```
|
|
237
314
|
|
|
315
|
+
`.lisai.json` overrides Control Plane defaults for `maxRetries` and `provider`, so you can always fine-tune locally even when connected to the Dashboard.
|
|
316
|
+
|
|
238
317
|
## Control Plane Integration
|
|
239
318
|
|
|
240
319
|
Connect the agent to the Lisa.ai Dashboard for remote configuration, telemetry, and the Memory Engine:
|
|
241
320
|
|
|
321
|
+
```json
|
|
322
|
+
// .lisai.json
|
|
323
|
+
{
|
|
324
|
+
"projectId": "my-project-123",
|
|
325
|
+
"provider": "claude"
|
|
326
|
+
}
|
|
327
|
+
```
|
|
328
|
+
|
|
242
329
|
```bash
|
|
243
|
-
lisa-agent heal
|
|
330
|
+
lisa-agent heal # automatically uses projectId from .lisai.json
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
Or via CLI flag:
|
|
334
|
+
```bash
|
|
335
|
+
lisa-agent heal --project-id "my-project-123"
|
|
244
336
|
```
|
|
245
337
|
|
|
246
338
|
With a project ID, the agent will:
|
|
@@ -257,7 +349,8 @@ The Memory Engine stores proven fix patterns from previous heal runs. When the a
|
|
|
257
349
|
- Patterns are keyed by normalized error shape + framework + project
|
|
258
350
|
- Only patterns with confidence >= 50% are injected
|
|
259
351
|
- Confidence = `successCount / totalAttempts`, updated after each heal attempt
|
|
260
|
-
- Memory is project-scoped and stored on the Control Plane (requires
|
|
352
|
+
- Memory is project-scoped and stored on the Control Plane (requires `projectId`)
|
|
353
|
+
- Supports hybrid vector + exact search for semantically similar error matching
|
|
261
354
|
|
|
262
355
|
## Auto-Detection
|
|
263
356
|
|
|
@@ -273,77 +366,61 @@ The agent **adapts to your project** — zero config required. If no `--command`
|
|
|
273
366
|
|
|
274
367
|
### Heal a broken Angular project
|
|
275
368
|
```bash
|
|
276
|
-
export
|
|
277
|
-
lisa-agent heal
|
|
369
|
+
export ANTHROPIC_API_KEY="sk-ant-..."
|
|
370
|
+
lisa-agent heal
|
|
278
371
|
```
|
|
279
372
|
|
|
280
|
-
### Generate unit tests for
|
|
373
|
+
### Generate unit tests for uncovered files
|
|
281
374
|
```bash
|
|
282
|
-
|
|
283
|
-
lisa-agent unit --model claude
|
|
375
|
+
lisa-agent unit
|
|
284
376
|
```
|
|
285
377
|
|
|
286
378
|
### Generate Playwright E2E tests
|
|
287
379
|
```bash
|
|
288
|
-
|
|
289
|
-
lisa-agent e2e --model gemini
|
|
290
|
-
```
|
|
291
|
-
|
|
292
|
-
### Generate integration tests
|
|
293
|
-
```bash
|
|
294
|
-
export OPENAI_API_KEY="your-key"
|
|
295
|
-
lisa-agent integration --model openai
|
|
296
|
-
```
|
|
297
|
-
|
|
298
|
-
### Fix npm vulnerabilities with LLM guidance
|
|
299
|
-
```bash
|
|
300
|
-
lisa-agent audit --model gemini
|
|
380
|
+
lisa-agent e2e
|
|
301
381
|
```
|
|
302
382
|
|
|
303
383
|
### Target specific files (skip discovery for large projects)
|
|
304
384
|
```bash
|
|
305
|
-
lisa-agent heal --files src/app/todo.spec.ts,src/app/auth.spec.ts
|
|
306
|
-
lisa-agent unit --files src/services/auth.service.ts
|
|
307
|
-
lisa-agent e2e --files e2e/login.spec.ts
|
|
308
|
-
lisa-agent integration --files src/services/user.service.ts
|
|
385
|
+
lisa-agent heal --files src/app/todo.spec.ts,src/app/auth.spec.ts
|
|
386
|
+
lisa-agent unit --files src/services/auth.service.ts
|
|
387
|
+
lisa-agent e2e --files e2e/login.spec.ts
|
|
388
|
+
lisa-agent integration --files src/services/user.service.ts
|
|
309
389
|
```
|
|
310
390
|
|
|
311
391
|
### GitHub Actions CI — auto-heal on every push
|
|
312
392
|
```bash
|
|
313
|
-
# One-time setup
|
|
314
|
-
lisa-agent init-ci --model
|
|
393
|
+
# One-time setup
|
|
394
|
+
lisa-agent init-ci --model claude
|
|
315
395
|
|
|
316
|
-
#
|
|
317
|
-
# Repo > Settings > Secrets > Actions >
|
|
396
|
+
# Add your API key as a GitHub secret:
|
|
397
|
+
# Repo > Settings > Secrets > Actions > ANTHROPIC_API_KEY
|
|
318
398
|
|
|
319
399
|
# That's it! On every push, Lisa.ai will:
|
|
320
400
|
# 1. Run your tests
|
|
321
401
|
# 2. Auto-heal any failures
|
|
322
|
-
# 3. Open a PR with the fixes
|
|
402
|
+
# 3. Open a PR with the fixes
|
|
323
403
|
```
|
|
324
404
|
|
|
325
|
-
###
|
|
405
|
+
### Full pipeline with Control Plane
|
|
326
406
|
```bash
|
|
327
|
-
lisa-agent heal --
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
### Full CI/CD pipeline with Control Plane
|
|
333
|
-
```bash
|
|
334
|
-
lisa-agent heal --command "npm test" --model gemini --project-id "prod-api"
|
|
335
|
-
lisa-agent unit --model gemini --project-id "prod-api"
|
|
336
|
-
lisa-agent e2e --model gemini --project-id "prod-api"
|
|
337
|
-
lisa-agent integration --model gemini --project-id "prod-api"
|
|
338
|
-
lisa-agent audit --model gemini --project-id "prod-api"
|
|
407
|
+
lisa-agent heal --project-id "prod-api"
|
|
408
|
+
lisa-agent unit --project-id "prod-api"
|
|
409
|
+
lisa-agent e2e --project-id "prod-api"
|
|
410
|
+
lisa-agent integration --project-id "prod-api"
|
|
411
|
+
lisa-agent audit --project-id "prod-api"
|
|
339
412
|
```
|
|
340
413
|
|
|
341
414
|
## Requirements
|
|
342
415
|
|
|
343
416
|
- Node.js 18+
|
|
344
|
-
- At least one LLM API key (
|
|
417
|
+
- At least one LLM API key (Claude, Gemini, or OpenAI)
|
|
345
418
|
- A JavaScript/TypeScript project with a test suite
|
|
346
419
|
|
|
420
|
+
## License
|
|
421
|
+
|
|
422
|
+
ISC
|
|
423
|
+
|
|
347
424
|
---
|
|
348
425
|
|
|
349
|
-
*Built by the Lisa.ai
|
|
426
|
+
*Built by the Lisa.ai team.*
|