@lisa.ai/agent 2.9.7 → 2.11.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.
Files changed (3) hide show
  1. package/README.md +189 -72
  2. package/dist/index.js +283 -155
  3. 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 `LISA_GOOGLE_MODEL`, `LISA_CLAUDE_MODEL`, or `LISA_OPENAI_MODEL`.
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 --command "npm test" --model gemini
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 specific E2E files
39
- lisa-agent heal --type e2e --files e2e/login.spec.ts
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 100% coverage, and generates new test specs to close the gaps. Auto-detects your test framework and builds the correct coverage command.
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 --model gemini
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 --model gemini
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 --model gemini
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 --model gemini
139
+ lisa-agent audit
126
140
  ```
127
141
 
128
142
  **How it works:**
@@ -132,12 +146,52 @@ lisa-agent audit --model gemini
132
146
  4. **Targeted upgrades** — applies non-breaking semver-minor fixes
133
147
  5. **LLM guidance** — for remaining breaking/unfixable vulnerabilities, consults the LLM and saves a remediation report to `lisa-audit-report.md`
134
148
 
149
+ ### `chat` — Interactive Mode
150
+
151
+ Multi-turn interactive REPL with streaming LLM responses. Ask questions about your project, analyze test failures, heal specific files, and generate tests — all in a conversational loop.
152
+
153
+ ```bash
154
+ lisa-agent chat
155
+
156
+ # Use a specific LLM provider
157
+ lisa-agent chat -m claude
158
+ ```
159
+
160
+ **Slash commands:**
161
+
162
+ | Command | Description |
163
+ |---|---|
164
+ | `/test [cmd]` | Run tests and show results |
165
+ | `/explain <file>` | Analyze why a test is failing (no file changes) |
166
+ | `/heal <file>` | Auto-heal a specific failing test file |
167
+ | `/generate <file>` | Generate test spec for a source file |
168
+ | `/status` | Show test pass/fail summary |
169
+ | `/help` | Show available commands |
170
+ | `/exit` | Exit chat |
171
+
172
+ **Example session:**
173
+ ```
174
+ lisa> why would an Angular test get NullInjectorError for HttpClient?
175
+ [streams explanation suggesting HttpClientTestingModule]
176
+
177
+ lisa> /test
178
+ Running: npx ng test --no-watch --browsers=ChromeHeadless...
179
+ ✗ 3 of 47 tests failed
180
+
181
+ lisa> /heal src/app/services/auth.service.spec.ts
182
+ Healing src/app/services/auth.service.spec.ts...
183
+ ✅ Healed via Cloud.
184
+
185
+ lisa> /status
186
+ [████████████████████] 100% ✅ 47 passed 47 total
187
+ ```
188
+
135
189
  ### `diagnose` — Test LLM Connectivity
136
190
 
137
191
  Sends a simple probe to your configured LLM provider to verify your API key works and the model is reachable.
138
192
 
139
193
  ```bash
140
- lisa-agent diagnose --model claude
194
+ lisa-agent diagnose
141
195
  ```
142
196
 
143
197
  ### `init` — Create Project Config
@@ -166,19 +220,19 @@ The generated workflow:
166
220
  4. If tests fail and Lisa heals them, opens a PR automatically
167
221
  5. Writes a step summary to the GitHub Actions UI
168
222
 
169
- **Required setup:** Add your LLM API key as a repository secret in GitHub (Settings > Secrets > Actions). The secret name depends on the provider:
223
+ **Required setup:** Add your LLM API key as a repository secret in GitHub (Settings > Secrets > Actions).
170
224
 
171
225
  | Provider | Secret name |
172
226
  |---|---|
173
- | Gemini | `GOOGLE_GENERATIVE_AI_API_KEY` |
174
227
  | Claude | `ANTHROPIC_API_KEY` |
228
+ | Gemini | `GOOGLE_GENERATIVE_AI_API_KEY` |
175
229
  | OpenAI | `OPENAI_API_KEY` |
176
230
 
177
231
  `GITHUB_TOKEN` is provided automatically by GitHub Actions — no PAT needed.
178
232
 
179
233
  ## Common Options
180
234
 
181
- All test commands (`heal`, `unit`, `e2e`, `integration`, `audit`) accept:
235
+ All test commands (`heal`, `unit`, `e2e`, `integration`) accept:
182
236
 
183
237
  | Flag | Description | Default |
184
238
  |---|---|---|
@@ -197,8 +251,9 @@ Place a `.lisai.json` in your project root to configure the agent without CLI fl
197
251
 
198
252
  ```json
199
253
  {
200
- "provider": "gemini",
201
- "model": "gemini-2.0-flash",
254
+ "projectId": "my-project-123",
255
+ "provider": "claude",
256
+ "model": "claude-haiku-4-5",
202
257
  "testCommand": "npm test",
203
258
  "testingFramework": "jest",
204
259
  "e2eFramework": "playwright",
@@ -207,12 +262,17 @@ Place a `.lisai.json` in your project root to configure the agent without CLI fl
207
262
  "maxRetries": 5,
208
263
  "skipFiles": ["server.js", "app.js"],
209
264
  "skipDirs": ["scripts", "migrations"],
210
- "skipPaths": ["src/generated", "src/fixtures"]
265
+ "skipPaths": ["src/generated", "src/fixtures"],
266
+ "lisaLlm": {
267
+ "enabled": true,
268
+ "model": "qwen2.5-coder:7b"
269
+ }
211
270
  }
212
271
  ```
213
272
 
214
273
  | Field | Type | Description |
215
274
  |---|---|---|
275
+ | `projectId` | `string` | Control Plane project ID — saves you from passing `--project-id` every time |
216
276
  | `provider` | `gemini \| claude \| openai` | LLM provider |
217
277
  | `model` | `string` | Pin a specific model ID (e.g. `claude-sonnet-4-6`) |
218
278
  | `testCommand` | `string` | Override unit test command (skips auto-detection) |
@@ -220,27 +280,99 @@ Place a `.lisai.json` in your project root to configure the agent without CLI fl
220
280
  | `e2eFramework` | `playwright \| cypress` | Override E2E framework detection |
221
281
  | `e2eCommand` | `string` | Override E2E test command |
222
282
  | `testTypes` | `string[]` | Types of tests to generate: `unit`, `integration`, `e2e` |
223
- | `maxRetries` | `number` | Max heal/generation retries per session (default 5) |
283
+ | `maxRetries` | `number` | Max heal/generation retries per file (default 5) |
224
284
  | `skipFiles` | `string[]` | Filenames to exclude from analysis |
225
285
  | `skipDirs` | `string[]` | Directory names to exclude |
226
286
  | `skipPaths` | `string[]` | Path prefixes to exclude |
287
+ | `lisaLlm` | `object` | Lisa LLM local tier config (see below) |
227
288
 
228
289
  All fields are **optional**. The agent auto-detects everything. This file is the escape hatch for unusual setups.
229
290
 
291
+ ### Lisa LLM — Local-First Tier (v2.10.0)
292
+
293
+ 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.
294
+
295
+ **Enable via `.lisai.json`:**
296
+ ```json
297
+ {
298
+ "lisaLlm": {
299
+ "enabled": true,
300
+ "provider": "ollama",
301
+ "model": "qwen2.5-coder:7b",
302
+ "baseUrl": "http://localhost:11434",
303
+ "confidenceThreshold": 0.8
304
+ }
305
+ }
306
+ ```
307
+
308
+ **Or via environment variables:**
309
+ ```bash
310
+ LISA_LLM_ENABLED=true
311
+ LISA_LLM_MODEL=qwen2.5-coder:7b
312
+ LISA_LLM_URL=http://localhost:11434
313
+ ```
314
+
315
+ | Field | Default | Description |
316
+ |---|---|---|
317
+ | `enabled` | `false` | Opt-in. Set `true` or `LISA_LLM_ENABLED=true` |
318
+ | `provider` | `"ollama"` | Any OpenAI-compatible server works (LM Studio, LocalAI, vLLM) |
319
+ | `model` | `"qwen2.5-coder:7b"` | Swappable — `deepseek-coder-v3`, `codestral`, etc. |
320
+ | `baseUrl` | `"http://localhost:11434"` | Ollama default. Override for other servers |
321
+ | `confidenceThreshold` | `0.8` | Minimum pattern confidence to trigger local tier |
322
+
323
+ **How it works:**
324
+ 1. Memory Engine returns proven patterns with confidence scores
325
+ 2. If `confidence >= threshold` and Lisa LLM is enabled → Tier 1 (local) attempt
326
+ 3. Local fix verified → **done** (zero API cost, logged as `resolvedBy: 'lisa-llm'`)
327
+ 4. Local fix fails → falls through to Tier 2 (cloud) — **doesn't burn a retry**
328
+ 5. No high-confidence patterns → skip local, go directly to cloud
329
+
330
+ **Requirements:** [Ollama](https://ollama.com/) running locally with a code model pulled:
331
+ ```bash
332
+ ollama pull qwen2.5-coder:7b
333
+ ```
334
+
335
+ **Dashboard:** The project page shows a "Lisa LLM vs Cloud" breakdown card with resolution counts and success rate when Lisa LLM data exists.
336
+
337
+ ### `.env` File
338
+
339
+ The agent loads `.env` from your project root (the directory where you run the command). You can put all config here:
340
+
341
+ ```env
342
+ ANTHROPIC_API_KEY=sk-ant-your-key-here
343
+ LISA_CLAUDE_MODEL=claude-sonnet-4-6
344
+ LISA_CONTROL_PLANE_URL=http://localhost:3088
345
+ ```
346
+
230
347
  ### Config Priority
231
348
 
232
349
  Settings are resolved in this order (highest wins):
233
350
 
234
351
  ```
235
- Shell env var > Control Plane > CLI flag > .lisai.json > built-in default
352
+ Shell env var > .lisai.json > Control Plane > CLI flag > built-in default
236
353
  ```
237
354
 
355
+ `.lisai.json` overrides Control Plane defaults for `maxRetries` and `provider`, so you can always fine-tune locally even when connected to the Dashboard.
356
+
238
357
  ## Control Plane Integration
239
358
 
240
359
  Connect the agent to the Lisa.ai Dashboard for remote configuration, telemetry, and the Memory Engine:
241
360
 
361
+ ```json
362
+ // .lisai.json
363
+ {
364
+ "projectId": "my-project-123",
365
+ "provider": "claude"
366
+ }
367
+ ```
368
+
369
+ ```bash
370
+ lisa-agent heal # automatically uses projectId from .lisai.json
371
+ ```
372
+
373
+ Or via CLI flag:
242
374
  ```bash
243
- lisa-agent heal --command "npm test" --project-id "my-project-123"
375
+ lisa-agent heal --project-id "my-project-123"
244
376
  ```
245
377
 
246
378
  With a project ID, the agent will:
@@ -257,7 +389,8 @@ The Memory Engine stores proven fix patterns from previous heal runs. When the a
257
389
  - Patterns are keyed by normalized error shape + framework + project
258
390
  - Only patterns with confidence >= 50% are injected
259
391
  - Confidence = `successCount / totalAttempts`, updated after each heal attempt
260
- - Memory is project-scoped and stored on the Control Plane (requires `--project-id`)
392
+ - Memory is project-scoped and stored on the Control Plane (requires `projectId`)
393
+ - Supports hybrid vector + exact search for semantically similar error matching
261
394
 
262
395
  ## Auto-Detection
263
396
 
@@ -273,77 +406,61 @@ The agent **adapts to your project** — zero config required. If no `--command`
273
406
 
274
407
  ### Heal a broken Angular project
275
408
  ```bash
276
- export GOOGLE_GENERATIVE_AI_API_KEY="your-key"
277
- lisa-agent heal --command "npx ng test --no-watch --browsers=ChromeHeadless" --model gemini
409
+ export ANTHROPIC_API_KEY="sk-ant-..."
410
+ lisa-agent heal
278
411
  ```
279
412
 
280
- ### Generate unit tests for a Node.js API
413
+ ### Generate unit tests for uncovered files
281
414
  ```bash
282
- export ANTHROPIC_API_KEY="your-key"
283
- lisa-agent unit --model claude
415
+ lisa-agent unit
284
416
  ```
285
417
 
286
418
  ### Generate Playwright E2E tests
287
419
  ```bash
288
- export GOOGLE_GENERATIVE_AI_API_KEY="your-key"
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
420
+ lisa-agent e2e
301
421
  ```
302
422
 
303
423
  ### Target specific files (skip discovery for large projects)
304
424
  ```bash
305
- lisa-agent heal --files src/app/todo.spec.ts,src/app/auth.spec.ts --model gemini
306
- lisa-agent unit --files src/services/auth.service.ts --model claude
307
- lisa-agent e2e --files e2e/login.spec.ts --model gemini
308
- lisa-agent integration --files src/services/user.service.ts --model openai
425
+ lisa-agent heal --files src/app/todo.spec.ts,src/app/auth.spec.ts
426
+ lisa-agent unit --files src/services/auth.service.ts
427
+ lisa-agent e2e --files e2e/login.spec.ts
428
+ lisa-agent integration --files src/services/user.service.ts
309
429
  ```
310
430
 
311
431
  ### GitHub Actions CI — auto-heal on every push
312
432
  ```bash
313
- # One-time setup: generate the workflow file
314
- lisa-agent init-ci --model gemini
433
+ # One-time setup
434
+ lisa-agent init-ci --model claude
315
435
 
316
- # Then add your API key as a GitHub secret:
317
- # Repo > Settings > Secrets > Actions > GOOGLE_GENERATIVE_AI_API_KEY
436
+ # Add your API key as a GitHub secret:
437
+ # Repo > Settings > Secrets > Actions > ANTHROPIC_API_KEY
318
438
 
319
439
  # That's it! On every push, Lisa.ai will:
320
440
  # 1. Run your tests
321
441
  # 2. Auto-heal any failures
322
- # 3. Open a PR with the fixes for review
442
+ # 3. Open a PR with the fixes
323
443
  ```
324
444
 
325
- ### Run heal in CI mode locally (test without pushing)
445
+ ### Full pipeline with Control Plane
326
446
  ```bash
327
- lisa-agent heal --ci --model gemini
328
- # Runs the full heal loop, then attempts to commit + open PR.
329
- # Without GITHUB_TOKEN set, PR creation is gracefully skipped.
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"
447
+ lisa-agent heal --project-id "prod-api"
448
+ lisa-agent unit --project-id "prod-api"
449
+ lisa-agent e2e --project-id "prod-api"
450
+ lisa-agent integration --project-id "prod-api"
451
+ lisa-agent audit --project-id "prod-api"
339
452
  ```
340
453
 
341
454
  ## Requirements
342
455
 
343
456
  - Node.js 18+
344
- - At least one LLM API key (Gemini, Claude, or OpenAI)
457
+ - At least one LLM API key (Claude, Gemini, or OpenAI)
345
458
  - A JavaScript/TypeScript project with a test suite
346
459
 
460
+ ## License
461
+
462
+ ISC
463
+
347
464
  ---
348
465
 
349
- *Built by the Lisa.ai Platform team.*
466
+ *Built by the Lisa.ai team.*