levante 0.3.5 → 0.3.6
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 +263 -83
- package/dist/cli.js +64 -54
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
# Levante
|
|
2
2
|
|
|
3
|
-
AI-powered end-to-end test pipeline for Playwright. Record, transcribe, generate
|
|
3
|
+
AI-powered end-to-end test pipeline for Playwright. Record interactions, transcribe narration, generate Playwright tests, self-heal failures, and produce QA documentation — all driven by LLM agents.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
npm install -g levante
|
|
9
|
+
# or
|
|
10
|
+
bun add -g levante
|
|
9
11
|
```
|
|
10
12
|
|
|
11
13
|
Levante requires Playwright as a peer dependency:
|
|
@@ -14,82 +16,109 @@ Levante requires Playwright as a peer dependency:
|
|
|
14
16
|
npm install -D @playwright/test
|
|
15
17
|
```
|
|
16
18
|
|
|
17
|
-
### Environment Variables
|
|
18
|
-
|
|
19
|
-
| Variable | Required | Description |
|
|
20
|
-
|----------|----------|-------------|
|
|
21
|
-
| `OPENAI_API_KEY` | Yes (if using OpenAI) | OpenAI API key |
|
|
22
|
-
| `ANTHROPIC_API_KEY` | Yes (if using Anthropic) | Anthropic API key |
|
|
23
|
-
| `E2E_AI_API_URL` | No | Remote API URL for QA map push |
|
|
24
|
-
| `E2E_AI_API_KEY` | No | API key for push authentication |
|
|
25
|
-
|
|
26
19
|
## Quick Start
|
|
27
20
|
|
|
28
21
|
```bash
|
|
29
|
-
# Initialize config and agents
|
|
22
|
+
# 1. Initialize config and agents
|
|
30
23
|
levante init
|
|
31
24
|
|
|
32
|
-
# Run full pipeline for a test case
|
|
25
|
+
# 2. Run full pipeline for a test case
|
|
33
26
|
levante run --key PROJ-101
|
|
34
27
|
|
|
35
|
-
# Or
|
|
28
|
+
# Or step by step
|
|
36
29
|
levante record --key PROJ-101
|
|
37
30
|
levante transcribe --key PROJ-101
|
|
38
31
|
levante scenario --key PROJ-101
|
|
39
32
|
levante generate --key PROJ-101
|
|
33
|
+
levante refine --key PROJ-101
|
|
40
34
|
levante test --key PROJ-101
|
|
35
|
+
levante heal --key PROJ-101 # only if test fails
|
|
36
|
+
levante qa --key PROJ-101
|
|
41
37
|
```
|
|
42
38
|
|
|
43
|
-
|
|
39
|
+
---
|
|
44
40
|
|
|
45
|
-
|
|
41
|
+
## Environment Variables
|
|
46
42
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
```
|
|
43
|
+
| Variable | Description |
|
|
44
|
+
|----------|-------------|
|
|
45
|
+
| `OPENAI_API_KEY` | OpenAI API key |
|
|
46
|
+
| `ANTHROPIC_API_KEY` | Anthropic API key |
|
|
47
|
+
| `QAI_BASE_URL` | QA Intelligence API base URL |
|
|
48
|
+
| `QAI_API_URL` | Full push endpoint (overrides base URL) |
|
|
49
|
+
| `QAI_API_KEY` | API key for authenticated push |
|
|
55
50
|
|
|
56
|
-
|
|
51
|
+
---
|
|
57
52
|
|
|
58
|
-
|
|
53
|
+
## Commands
|
|
59
54
|
|
|
60
|
-
|
|
55
|
+
### `levante init`
|
|
56
|
+
|
|
57
|
+
Initialize levante in your project. Generates `.qai/levante/config.ts`, copies agent templates, and optionally connects to QA Intelligence.
|
|
61
58
|
|
|
62
59
|
```bash
|
|
63
60
|
levante init
|
|
64
|
-
levante init --non-interactive
|
|
61
|
+
levante init --non-interactive # skip prompts, use defaults
|
|
65
62
|
```
|
|
66
63
|
|
|
67
|
-
|
|
64
|
+
On re-run, preserves your existing config and context, and only updates agents.
|
|
65
|
+
|
|
66
|
+
**After init:**
|
|
67
|
+
1. Generate `.qai/levante/context.md` using the `init-agent` prompt in your AI tool, or via MCP (`levante_scan_codebase`)
|
|
68
|
+
2. Review the generated context
|
|
69
|
+
3. Start recording: `levante record --key PROJ-101`
|
|
70
|
+
|
|
71
|
+
---
|
|
68
72
|
|
|
69
|
-
|
|
73
|
+
### `levante record [session]`
|
|
74
|
+
|
|
75
|
+
Launch Playwright codegen with optional voice narration recording.
|
|
70
76
|
|
|
71
77
|
```bash
|
|
72
78
|
levante record --key PROJ-101
|
|
73
|
-
levante record --key PROJ-101 --no-voice
|
|
79
|
+
levante record --key PROJ-101 --no-companion # voice only, no companion UI
|
|
80
|
+
levante record --key PROJ-101 --no-voice # codegen only, no audio
|
|
74
81
|
```
|
|
75
82
|
|
|
76
|
-
|
|
83
|
+
| Option | Description |
|
|
84
|
+
|--------|-------------|
|
|
85
|
+
| `--no-companion` | Disable companion UI (voice recording only) |
|
|
86
|
+
| `--no-voice` | Disable voice recording entirely |
|
|
77
87
|
|
|
78
|
-
|
|
88
|
+
**Output:** codegen TypeScript file + `.wav` audio (if voice enabled)
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
### `levante transcribe [session]`
|
|
93
|
+
|
|
94
|
+
Transcribe the `.wav` voice recording via OpenAI Whisper. If a live transcript from the recording session exists, Whisper is skipped.
|
|
79
95
|
|
|
80
96
|
```bash
|
|
81
97
|
levante transcribe --key PROJ-101
|
|
98
|
+
levante transcribe --key PROJ-101 --force # re-transcribe even if transcript exists
|
|
82
99
|
```
|
|
83
100
|
|
|
84
|
-
|
|
101
|
+
Merges voice annotations (with timestamps) back into the codegen file as inline comments.
|
|
102
|
+
|
|
103
|
+
**Output:** `*-transcript.json`, `*-transcript.md`, annotated codegen file
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
### `levante scenario [session]`
|
|
85
108
|
|
|
86
|
-
Generate a structured YAML scenario from codegen output and transcript.
|
|
109
|
+
Generate a structured YAML scenario from codegen output and voice transcript.
|
|
87
110
|
|
|
88
111
|
```bash
|
|
89
112
|
levante scenario --key PROJ-101
|
|
90
113
|
```
|
|
91
114
|
|
|
92
|
-
|
|
115
|
+
Uses `transcript-agent` (if transcript available) to extract narrative and action intents, then `scenario-agent` to produce a YAML scenario with title, precondition, steps, and postcondition. Jira/Linear issue context is included automatically if `--key` is set.
|
|
116
|
+
|
|
117
|
+
**Output:** `.yaml` scenario file in `e2e/tests/[key]/`
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
### `levante generate [scenario]`
|
|
93
122
|
|
|
94
123
|
Generate a Playwright `.test.ts` file from a YAML scenario.
|
|
95
124
|
|
|
@@ -97,118 +126,238 @@ Generate a Playwright `.test.ts` file from a YAML scenario.
|
|
|
97
126
|
levante generate --key PROJ-101
|
|
98
127
|
```
|
|
99
128
|
|
|
100
|
-
|
|
129
|
+
Uses `playwright-generator-agent` with scenario + project context. If Zephyr is configured, also generates a Zephyr test case export.
|
|
130
|
+
|
|
131
|
+
**Output:** `[key].test.ts` in `e2e/tests/[key]/`
|
|
132
|
+
|
|
133
|
+
---
|
|
101
134
|
|
|
102
|
-
|
|
135
|
+
### `levante refine [test]`
|
|
136
|
+
|
|
137
|
+
Refactor a generated test with AI — replaces raw selectors, improves structure, applies project patterns.
|
|
103
138
|
|
|
104
139
|
```bash
|
|
105
140
|
levante refine --key PROJ-101
|
|
106
141
|
```
|
|
107
142
|
|
|
108
|
-
|
|
143
|
+
Uses `refactor-agent`. Rewrites the test file in-place.
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
### `levante test [test]`
|
|
109
148
|
|
|
110
|
-
Run the Playwright test with trace
|
|
149
|
+
Run the Playwright test with trace, video, and screenshot capture.
|
|
111
150
|
|
|
112
151
|
```bash
|
|
113
152
|
levante test --key PROJ-101
|
|
153
|
+
levante test --key PROJ-101 --no-trace
|
|
114
154
|
```
|
|
115
155
|
|
|
116
|
-
|
|
156
|
+
**Output:** Test execution logs, trace files in `e2e/traces/`
|
|
117
157
|
|
|
118
|
-
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
### `levante heal [test]`
|
|
161
|
+
|
|
162
|
+
Self-heal a failing test. Diagnoses the failure, patches the test, and re-runs — up to 3 retries.
|
|
119
163
|
|
|
120
164
|
```bash
|
|
121
165
|
levante heal --key PROJ-101
|
|
122
166
|
```
|
|
123
167
|
|
|
124
|
-
|
|
168
|
+
Each attempt uses `self-healing-agent` with test content + error output + trace data to produce:
|
|
169
|
+
- `diagnosis` (failure type, root cause, confidence)
|
|
170
|
+
- `patchedTest` (updated test file)
|
|
171
|
+
- `changes` (summary of what was fixed)
|
|
172
|
+
|
|
173
|
+
Exits with error if all 3 attempts fail.
|
|
125
174
|
|
|
126
|
-
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
### `levante qa [test]`
|
|
178
|
+
|
|
179
|
+
Generate QA documentation from the test and scenario.
|
|
127
180
|
|
|
128
181
|
```bash
|
|
129
182
|
levante qa --key PROJ-101
|
|
130
183
|
```
|
|
131
184
|
|
|
132
|
-
|
|
185
|
+
Uses `qa-testcase-agent` with test + scenario + Jira context. Produces markdown and/or Zephyr export depending on `outputTarget`.
|
|
186
|
+
|
|
187
|
+
**Output:** `qa/[testId].md` and/or Zephyr JSON
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
### `levante run [session]`
|
|
133
192
|
|
|
134
|
-
Run the full pipeline: record → transcribe → scenario → generate → refine → test → heal → qa
|
|
193
|
+
Run the full pipeline: `record → transcribe → scenario → generate → refine → test → heal → qa`.
|
|
135
194
|
|
|
136
195
|
```bash
|
|
137
196
|
levante run --key PROJ-101
|
|
138
|
-
levante run --key PROJ-101 --from generate
|
|
197
|
+
levante run --key PROJ-101 --from generate # resume from a specific step
|
|
139
198
|
levante run --key PROJ-101 --skip transcribe,heal
|
|
199
|
+
levante run --key PROJ-101 --no-voice # skip recording + transcription
|
|
140
200
|
```
|
|
141
201
|
|
|
142
202
|
| Option | Description |
|
|
143
203
|
|--------|-------------|
|
|
144
|
-
| `--from <step>` | Start from a specific step |
|
|
145
|
-
| `--skip <steps>` |
|
|
204
|
+
| `--from <step>` | Start from a specific step (skips earlier steps) |
|
|
205
|
+
| `--skip <steps>` | Comma-separated step names to skip |
|
|
206
|
+
| `--no-voice` | Disable voice recording (skips transcription too) |
|
|
207
|
+
| `--no-trace` | Disable trace capture |
|
|
146
208
|
|
|
147
|
-
|
|
209
|
+
**Steps (in order):** `record` → `transcribe` → `scenario` → `generate` → `refine` → `test` → `heal` → `qa`
|
|
148
210
|
|
|
149
|
-
|
|
211
|
+
---
|
|
150
212
|
|
|
151
|
-
###
|
|
213
|
+
### `levante auth`
|
|
214
|
+
|
|
215
|
+
Manage authentication with QA Intelligence.
|
|
152
216
|
|
|
153
217
|
```bash
|
|
154
|
-
|
|
218
|
+
levante auth login # open browser for OAuth sign-in
|
|
219
|
+
levante auth logout # revoke CLI token
|
|
220
|
+
levante auth status # show current auth status
|
|
221
|
+
levante auth switch # re-authenticate with a different org/project/app
|
|
155
222
|
```
|
|
156
223
|
|
|
157
|
-
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
### `levante jira`
|
|
227
|
+
|
|
228
|
+
Interactive Jira integration for issue discovery and workflow launch.
|
|
158
229
|
|
|
159
|
-
|
|
230
|
+
#### `levante jira browse`
|
|
160
231
|
|
|
232
|
+
Interactive browser — search, view, and select Jira issues to start a test workflow.
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
levante jira browse
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
Select an issue to:
|
|
239
|
+
- **run** — save context and launch `levante run --key <KEY>`
|
|
240
|
+
- **save** — save issue context without running
|
|
241
|
+
- **view** — display full issue details
|
|
242
|
+
|
|
243
|
+
#### `levante jira search <query>`
|
|
244
|
+
|
|
245
|
+
Search Jira issues by text or raw JQL.
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
levante jira search "login flow"
|
|
249
|
+
levante jira search --jql "project = QA AND status = 'In Progress'"
|
|
250
|
+
levante jira search "dashboard" --max 10
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
| Option | Description |
|
|
254
|
+
|--------|-------------|
|
|
255
|
+
| `<query>` | Text search query |
|
|
256
|
+
| `--jql <jql>` | Use raw JQL instead of text search |
|
|
257
|
+
| `--max <n>` | Maximum results to return (default: 20) |
|
|
258
|
+
|
|
259
|
+
#### `levante jira show <issueKey>`
|
|
260
|
+
|
|
261
|
+
Display full details for a Jira issue.
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
levante jira show PROJ-101
|
|
265
|
+
levante jira show PROJ-101 --save # also save context for pipeline use
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
| Option | Description |
|
|
269
|
+
|--------|-------------|
|
|
270
|
+
| `--save` | Save issue context to `.qai/levante/issues/[KEY].json` |
|
|
271
|
+
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
### `levante mcp`
|
|
275
|
+
|
|
276
|
+
Print MCP server setup instructions.
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
levante mcp
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
**Claude Code:**
|
|
283
|
+
```bash
|
|
284
|
+
claude mcp add levante -- levante-mcp # project-scoped
|
|
285
|
+
claude mcp add levante -s user -- levante-mcp # global
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
**Claude Desktop / other clients:**
|
|
161
289
|
```json
|
|
162
290
|
{
|
|
163
291
|
"mcpServers": {
|
|
164
|
-
"levante": {
|
|
165
|
-
"command": "npx",
|
|
166
|
-
"args": ["levante-mcp"]
|
|
167
|
-
}
|
|
292
|
+
"levante": { "command": "levante-mcp" }
|
|
168
293
|
}
|
|
169
294
|
}
|
|
170
295
|
```
|
|
171
296
|
|
|
172
|
-
|
|
297
|
+
**Available MCP tools:**
|
|
173
298
|
|
|
174
299
|
| Tool | Description |
|
|
175
300
|
|------|-------------|
|
|
176
301
|
| `levante_plan_workflow` | Get ordered step list with prerequisite checks |
|
|
177
302
|
| `levante_execute_step` | Execute a single pipeline step |
|
|
178
|
-
| `levante_get_workflow_guide` |
|
|
303
|
+
| `levante_get_workflow_guide` | Read the full workflow guide |
|
|
179
304
|
| `levante_scan_codebase` | Scan project for test infrastructure |
|
|
180
305
|
| `levante_validate_context` | Validate context.md completeness |
|
|
181
306
|
| `levante_read_agent` | Load an agent prompt by name |
|
|
182
|
-
| `levante_get_example` | Get example context.md template |
|
|
307
|
+
| `levante_get_example` | Get an example context.md template |
|
|
183
308
|
| `levante_scan_ast` | Run AST scanner |
|
|
184
309
|
| `levante_scan_ast_detail` | Drill into routes/components/hooks |
|
|
185
310
|
| `levante_build_qa_map` | Build and validate QA map |
|
|
186
311
|
| `levante_read_qa_map` | Load existing QA map |
|
|
187
312
|
|
|
313
|
+
---
|
|
314
|
+
|
|
315
|
+
## Global Options
|
|
316
|
+
|
|
317
|
+
```
|
|
318
|
+
-k, --key <KEY> Issue key (e.g. PROJ-101, LIN-42)
|
|
319
|
+
--provider <provider> LLM provider: openai | anthropic
|
|
320
|
+
--model <model> LLM model override
|
|
321
|
+
--verbose Verbose output
|
|
322
|
+
--no-voice Disable voice recording
|
|
323
|
+
--no-trace Disable trace capture
|
|
324
|
+
-v, --version Show version
|
|
325
|
+
-h, --help Show help
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
---
|
|
329
|
+
|
|
188
330
|
## Configuration
|
|
189
331
|
|
|
190
|
-
Configuration lives in `.qai/levante/config.ts
|
|
332
|
+
Configuration lives in `.qai/levante/config.ts` (generated by `levante init`):
|
|
191
333
|
|
|
192
334
|
```typescript
|
|
193
|
-
import { defineConfig } from 'levante
|
|
335
|
+
import { defineConfig } from 'levante';
|
|
194
336
|
|
|
195
337
|
export default defineConfig({
|
|
196
|
-
inputSource: 'jira',
|
|
197
|
-
outputTarget: 'both',
|
|
338
|
+
inputSource: 'jira', // 'none' | 'jira' | 'linear'
|
|
339
|
+
outputTarget: 'both', // 'markdown' | 'zephyr' | 'both'
|
|
198
340
|
baseUrl: 'http://localhost:3000',
|
|
199
341
|
|
|
200
342
|
llm: {
|
|
201
|
-
provider: 'openai',
|
|
202
|
-
model: 'gpt-4o',
|
|
203
|
-
agentModels: {
|
|
343
|
+
provider: 'openai', // 'openai' | 'anthropic'
|
|
344
|
+
model: 'gpt-4o',
|
|
345
|
+
agentModels: { // per-agent model overrides
|
|
204
346
|
'scenario-agent': 'claude-sonnet-4-20250514',
|
|
205
347
|
},
|
|
206
348
|
},
|
|
207
349
|
|
|
208
350
|
playwright: {
|
|
209
|
-
browser: 'chromium',
|
|
351
|
+
browser: 'chromium', // 'chromium' | 'firefox' | 'webkit'
|
|
210
352
|
timeout: 120_000,
|
|
211
|
-
|
|
353
|
+
retries: 0,
|
|
354
|
+
traceMode: 'on', // 'on' | 'off' | 'retain-on-failure'
|
|
355
|
+
},
|
|
356
|
+
|
|
357
|
+
voice: {
|
|
358
|
+
enabled: true,
|
|
359
|
+
engine: 'webspeech', // 'webspeech' | 'whisper'
|
|
360
|
+
language: 'en-US',
|
|
212
361
|
},
|
|
213
362
|
|
|
214
363
|
paths: {
|
|
@@ -221,36 +370,67 @@ export default defineConfig({
|
|
|
221
370
|
},
|
|
222
371
|
|
|
223
372
|
integrations: {
|
|
224
|
-
jira: { /*
|
|
373
|
+
jira: { /* Jira config */ },
|
|
225
374
|
zephyr: { titlePrefix: 'UI Automation' },
|
|
226
375
|
},
|
|
227
376
|
|
|
228
377
|
push: {
|
|
229
|
-
apiUrl: 'https://
|
|
378
|
+
apiUrl: 'https://qaligent.space/api',
|
|
230
379
|
apiKey: 'your-key',
|
|
231
380
|
},
|
|
232
381
|
});
|
|
233
382
|
```
|
|
234
383
|
|
|
235
|
-
|
|
384
|
+
---
|
|
385
|
+
|
|
386
|
+
## AI Agents
|
|
387
|
+
|
|
388
|
+
Levante ships with agents copied to `.qai/levante/agents/` on `init`. Edit them to tune AI behavior for your project.
|
|
236
389
|
|
|
237
|
-
|
|
390
|
+
| Agent | Purpose |
|
|
391
|
+
|-------|---------|
|
|
392
|
+
| `0.init-agent` | Generate project `context.md` |
|
|
393
|
+
| `1_1.transcript-agent` | Analyze voice transcript + codegen into narrative |
|
|
394
|
+
| `1_2.scenario-agent` | Generate YAML scenario from narrative and actions |
|
|
395
|
+
| `2.playwright-generator-agent` | Generate Playwright test from YAML scenario |
|
|
396
|
+
| `3.refactor-agent` | Refactor test code for quality and conventions |
|
|
397
|
+
| `4.self-healing-agent` | Diagnose and patch failing tests |
|
|
398
|
+
| `5.qa-testcase-agent` | Generate QA documentation and Zephyr export |
|
|
399
|
+
|
|
400
|
+
Add `.qai/levante/context.md` to inject project-specific context into every agent call.
|
|
401
|
+
|
|
402
|
+
---
|
|
403
|
+
|
|
404
|
+
## Project Structure
|
|
238
405
|
|
|
239
406
|
```
|
|
240
407
|
your-project/
|
|
241
408
|
.qai/levante/
|
|
242
|
-
config.ts
|
|
243
|
-
context.md
|
|
244
|
-
agents/
|
|
245
|
-
workflow.md
|
|
409
|
+
config.ts # Configuration
|
|
410
|
+
context.md # Project context for AI agents
|
|
411
|
+
agents/ # Agent prompts (customizable)
|
|
412
|
+
workflow.md # Pipeline workflow guide
|
|
413
|
+
issues/ # Saved Jira issue contexts
|
|
246
414
|
e2e/
|
|
247
|
-
tests/{key}/
|
|
248
|
-
recordings/
|
|
249
|
-
transcripts/
|
|
250
|
-
traces/
|
|
251
|
-
qa/
|
|
415
|
+
tests/{key}/ # Generated test files + scenario YAML
|
|
416
|
+
recordings/ # Codegen + voice recordings
|
|
417
|
+
transcripts/ # Transcription output
|
|
418
|
+
traces/ # Playwright traces
|
|
419
|
+
qa/ # QA documentation output
|
|
252
420
|
```
|
|
253
421
|
|
|
422
|
+
---
|
|
423
|
+
|
|
424
|
+
## Interactive TUI
|
|
425
|
+
|
|
426
|
+
Running `levante` with no arguments launches an interactive terminal UI (requires TTY, ≥ 60×20).
|
|
427
|
+
|
|
428
|
+
```bash
|
|
429
|
+
levante
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
---
|
|
433
|
+
|
|
254
434
|
## License
|
|
255
435
|
|
|
256
436
|
MIT
|
package/dist/cli.js
CHANGED
|
@@ -57497,19 +57497,22 @@ async function launchTui(program2) {
|
|
|
57497
57497
|
version: version2,
|
|
57498
57498
|
onRunCommand: (argv) => {
|
|
57499
57499
|
runningCommand = true;
|
|
57500
|
-
instance.waitUntilExit().then(
|
|
57501
|
-
|
|
57502
|
-
|
|
57500
|
+
instance.waitUntilExit().then(() => {
|
|
57501
|
+
setTimeout(async () => {
|
|
57502
|
+
process.stdin.resume();
|
|
57503
|
+
process.stdin.ref();
|
|
57504
|
+
process.stdout.write(`
|
|
57503
57505
|
$ levante ${argv.join(" ")}
|
|
57504
57506
|
|
|
57505
57507
|
`);
|
|
57506
|
-
|
|
57507
|
-
|
|
57508
|
-
|
|
57509
|
-
|
|
57510
|
-
|
|
57511
|
-
|
|
57512
|
-
|
|
57508
|
+
try {
|
|
57509
|
+
await program2.parseAsync(argv, { from: "user" });
|
|
57510
|
+
} catch (err) {
|
|
57511
|
+
if (err?.name !== "ExitPromptError")
|
|
57512
|
+
throw err;
|
|
57513
|
+
}
|
|
57514
|
+
done();
|
|
57515
|
+
}, 50);
|
|
57513
57516
|
});
|
|
57514
57517
|
},
|
|
57515
57518
|
onQuit: done
|
|
@@ -75507,54 +75510,61 @@ async function migrateFromLegacy(projectRoot, nonInteractive) {
|
|
|
75507
75510
|
// src/commands/init.ts
|
|
75508
75511
|
function registerInit(program2) {
|
|
75509
75512
|
program2.command("init").description("Initialize levante configuration for your project").option("--non-interactive", "Skip interactive prompts, use defaults").action(async (cmdOpts) => {
|
|
75510
|
-
|
|
75511
|
-
|
|
75512
|
-
|
|
75513
|
-
|
|
75514
|
-
|
|
75515
|
-
|
|
75516
|
-
|
|
75517
|
-
|
|
75518
|
-
|
|
75513
|
+
try {
|
|
75514
|
+
const projectRoot = getProjectRoot();
|
|
75515
|
+
const nonInteractive = !!cmdOpts?.nonInteractive;
|
|
75516
|
+
header("levante init");
|
|
75517
|
+
await migrateFromLegacy(projectRoot, nonInteractive);
|
|
75518
|
+
const qaiDir = join17(projectRoot, CONFIG_DIR);
|
|
75519
|
+
const configPath = join17(qaiDir, "config.ts");
|
|
75520
|
+
const isReInit = fileExists(configPath);
|
|
75521
|
+
if (isReInit) {
|
|
75522
|
+
info(`Existing ${CONFIG_DIR}/ detected — preserving config and context.
|
|
75519
75523
|
`);
|
|
75520
|
-
|
|
75521
|
-
|
|
75522
|
-
|
|
75523
|
-
|
|
75524
|
-
|
|
75525
|
-
|
|
75526
|
-
|
|
75527
|
-
|
|
75528
|
-
|
|
75529
|
-
|
|
75530
|
-
|
|
75531
|
-
|
|
75532
|
-
|
|
75533
|
-
|
|
75534
|
-
|
|
75535
|
-
|
|
75536
|
-
|
|
75537
|
-
|
|
75538
|
-
|
|
75539
|
-
|
|
75540
|
-
|
|
75541
|
-
|
|
75542
|
-
|
|
75543
|
-
|
|
75524
|
+
await copyAgentsToLocal(projectRoot, nonInteractive);
|
|
75525
|
+
await copyWorkflowGuide(projectRoot, nonInteractive);
|
|
75526
|
+
} else {
|
|
75527
|
+
const answers = nonInteractive ? getDefaultAnswers() : await askConfigQuestions();
|
|
75528
|
+
const config2 = buildConfigFromAnswers(answers);
|
|
75529
|
+
writeFile(configPath, generateConfigFile(config2));
|
|
75530
|
+
success2(`Config written: ${configPath}`);
|
|
75531
|
+
await copyAgentsToLocal(projectRoot, nonInteractive);
|
|
75532
|
+
await copyWorkflowGuide(projectRoot, nonInteractive);
|
|
75533
|
+
}
|
|
75534
|
+
if (!nonInteractive) {
|
|
75535
|
+
const { confirm: confirmPrompt } = await Promise.resolve().then(() => (init_dist9(), exports_dist));
|
|
75536
|
+
const connectAuth = await confirmPrompt({
|
|
75537
|
+
message: "Connect to QA Intelligence?",
|
|
75538
|
+
default: false
|
|
75539
|
+
});
|
|
75540
|
+
if (connectAuth) {
|
|
75541
|
+
try {
|
|
75542
|
+
const { login: login2 } = await Promise.resolve().then(() => (init_dist10(), exports_dist2));
|
|
75543
|
+
const session = await login2({ webappUrl: "https://qaligent.space" });
|
|
75544
|
+
success2(`Authenticated as ${session.user.email}`);
|
|
75545
|
+
success2(`Linked to: ${session.scope.orgSlug} / ${session.scope.projectSlug} / ${session.scope.appSlug}`);
|
|
75546
|
+
} catch (err) {
|
|
75547
|
+
warn(`Authentication skipped: ${err instanceof Error ? err.message : "unknown error"}`);
|
|
75548
|
+
}
|
|
75544
75549
|
}
|
|
75545
75550
|
}
|
|
75546
|
-
|
|
75547
|
-
|
|
75548
|
-
success2(`Initialization complete!
|
|
75551
|
+
console.log("");
|
|
75552
|
+
success2(`Initialization complete!
|
|
75549
75553
|
`);
|
|
75550
|
-
|
|
75551
|
-
|
|
75552
|
-
|
|
75553
|
-
|
|
75554
|
-
|
|
75555
|
-
|
|
75556
|
-
|
|
75557
|
-
|
|
75554
|
+
if (!isReInit) {
|
|
75555
|
+
console.log(import_picocolors5.default.bold("Next steps:"));
|
|
75556
|
+
console.log(` 1. Use the ${import_picocolors5.default.cyan("init-agent")} in your AI tool to generate ${import_picocolors5.default.cyan(`${CONFIG_DIR}/context.md`)}`);
|
|
75557
|
+
console.log(` (or use the MCP server: ${import_picocolors5.default.cyan("levante_scan_codebase")} + ${import_picocolors5.default.cyan("levante_read_agent")})`);
|
|
75558
|
+
console.log(` 2. Review the generated ${import_picocolors5.default.cyan(`${CONFIG_DIR}/context.md`)}`);
|
|
75559
|
+
console.log(` 3. Run: ${import_picocolors5.default.cyan("levante run --key PROJ-101")}`);
|
|
75560
|
+
} else {
|
|
75561
|
+
console.log(import_picocolors5.default.dim("Config and context.md were preserved. Only agents and workflow were checked."));
|
|
75562
|
+
}
|
|
75563
|
+
} catch (err) {
|
|
75564
|
+
if (err?.name === "ExitPromptError") {
|
|
75565
|
+
process.exit(0);
|
|
75566
|
+
}
|
|
75567
|
+
throw err;
|
|
75558
75568
|
}
|
|
75559
75569
|
});
|
|
75560
75570
|
}
|