zefiro 0.3.4 → 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 CHANGED
@@ -6,56 +6,63 @@ AI-powered codebase scanner and QA map generator. Scans your project's AST, iden
6
6
 
7
7
  ```bash
8
8
  npm install -g zefiro
9
+ # or
10
+ bun add -g zefiro
9
11
  ```
10
12
 
11
- ### Environment Variables
12
-
13
- | Variable | Required | Description |
14
- |----------|----------|-------------|
15
- | `OPENAI_API_KEY` | Yes (if using OpenAI) | OpenAI API key |
16
- | `ANTHROPIC_API_KEY` | Yes (if using Anthropic) | Anthropic API key |
17
- | `E2E_AI_API_URL` | No | Remote API URL for QA map push |
18
- | `E2E_AI_API_KEY` | No | API key for push authentication |
19
-
20
13
  ## Quick Start
21
14
 
22
15
  ```bash
23
- # Initialize config and agents
16
+ # 1. Initialize copies agents, writes QAI_* env vars to .env
24
17
  zefiro init
25
18
 
26
- # Scan → Analyze → Push
19
+ # 2. Scan → Analyze → Push
27
20
  zefiro scan
28
21
  zefiro analyze
29
22
  zefiro push
30
23
  ```
31
24
 
32
- ## CLI Usage
25
+ ---
33
26
 
34
- ### Global Options
27
+ ## Environment Variables
35
28
 
36
- ```
37
- -k, --key <KEY> Issue key (e.g., PROJ-101)
38
- --provider <provider> LLM provider: openai | anthropic
39
- --model <model> LLM model override
40
- -v, --verbose Verbose output
41
- ```
29
+ `zefiro init` writes the `QAI_*` variables to your `.env`. You can also set them manually.
42
30
 
43
- ### Commands
31
+ | Variable | Description |
32
+ |----------|-------------|
33
+ | `QAI_INPUT_SOURCE` | Issue tracker: `none` \| `jira` \| `linear` |
34
+ | `QAI_OUTPUT_TARGET` | QA format: `markdown` \| `zephyr` \| `both` |
35
+ | `QAI_BASE_URL` | QA Intelligence API base URL |
36
+ | `QAI_API_URL` | Full push endpoint (overrides base URL) |
37
+ | `QAI_API_KEY` | API key for authenticated push |
38
+ | `OPENAI_API_KEY` | OpenAI API key (for `analyze` with OpenAI) |
39
+ | `ANTHROPIC_API_KEY` | Anthropic API key (for `analyze` with Anthropic) |
44
40
 
45
- #### `zefiro init`
41
+ ---
46
42
 
47
- Initialize zefiro in your project. Creates `.qai/zefiro/` with config and agent templates.
43
+ ## Commands
44
+
45
+ ### `zefiro init`
46
+
47
+ Initialize zefiro in your project. Copies agent templates to `.qai/zefiro/agents/` and writes `QAI_*` variables to `.env`.
48
48
 
49
49
  ```bash
50
50
  zefiro init
51
- zefiro init --non-interactive
51
+ zefiro init --non-interactive # skip prompts, use defaults
52
52
  ```
53
53
 
54
- Interactive setup prompts for issue tracker, output format, LLM provider, and base URL.
54
+ On re-run (`.qai/zefiro/agents/` already exists), preserves your existing setup and only updates agents and workflow guide.
55
+
56
+ **After init:**
57
+ 1. Generate `.qai/zefiro/context.md` using the `init-agent` prompt in your AI tool, or via MCP (`zefiro_scan_codebase`)
58
+ 2. Review the generated context
59
+ 3. Run `zefiro scan`
60
+
61
+ ---
55
62
 
56
- #### `zefiro scan`
63
+ ### `zefiro scan`
57
64
 
58
- Scan your codebase AST to extract routes, components, hooks, imports, and dependencies.
65
+ Scan your codebase AST extracts routes, components, hooks, imports, and dependencies.
59
66
 
60
67
  ```bash
61
68
  zefiro scan
@@ -70,17 +77,19 @@ zefiro scan --no-cache
70
77
  | `--scan-dir <dir>` | Directory to scan (overrides config) |
71
78
  | `--no-cache` | Disable file-level MD5 caching |
72
79
 
73
- #### `zefiro analyze [input]`
80
+ ---
74
81
 
75
- Run two-stage AI analysis to generate a QA map from the AST scan.
82
+ ### `zefiro analyze [input]`
76
83
 
77
- **Stage 1:** Feature analysis identifies features, workflows, and components.
78
- **Stage 2:** Scenario planning — generates test scenarios for each workflow.
84
+ Two-stage AI analysis that generates a QA map from the AST scan.
85
+
86
+ **Stage 1:** Feature analysis — identifies features, workflows, and components (runs in parallel).
87
+ **Stage 2:** Scenario planning — generates test scenarios for each workflow (runs in parallel).
79
88
 
80
89
  ```bash
81
90
  zefiro analyze
82
91
  zefiro analyze custom-scan.json
83
- zefiro analyze --skip-scenarios
92
+ zefiro analyze --skip-scenarios # features and workflows only
84
93
  zefiro analyze --output custom-qa-map.json
85
94
  ```
86
95
 
@@ -88,11 +97,15 @@ zefiro analyze --output custom-qa-map.json
88
97
  |--------|-------------|
89
98
  | `[input]` | AST scan file (default: `.qai/zefiro/ast-scan.json`) |
90
99
  | `--output <file>` | QA map output (default: `.qai/zefiro/qa-map.json`) |
91
- | `--skip-scenarios` | Only run feature analysis, skip scenario generation |
100
+ | `--skip-scenarios` | Skip scenario generation |
101
+
102
+ **Incremental:** if the AST is unchanged since the last run, analysis is skipped. If the AST changed, only affected features are re-analyzed.
92
103
 
93
- #### `zefiro push [input]`
104
+ ---
94
105
 
95
- Push the generated QA map to a remote API.
106
+ ### `zefiro push [input]`
107
+
108
+ Push the generated QA map to QA Intelligence (or a custom endpoint).
96
109
 
97
110
  ```bash
98
111
  zefiro push
@@ -103,34 +116,108 @@ zefiro push --commit-sha abc1234
103
116
  | Option | Description |
104
117
  |--------|-------------|
105
118
  | `[input]` | QA map file (default: `.qai/zefiro/qa-map.json`) |
106
- | `--commit-sha <sha>` | Git commit SHA to associate with the push |
119
+ | `--commit-sha <sha>` | Git commit SHA to associate with this version |
120
+
121
+ Authenticates via `zefiro auth login` session first, falls back to `QAI_API_URL` + `QAI_API_KEY`.
122
+
123
+ ---
124
+
125
+ ### `zefiro auth`
126
+
127
+ Manage authentication with QA Intelligence.
128
+
129
+ ```bash
130
+ zefiro auth login # open browser for OAuth sign-in
131
+ zefiro auth logout # revoke CLI token
132
+ zefiro auth status # show current auth status
133
+ zefiro auth switch # re-authenticate with a different org/project/app
134
+ ```
135
+
136
+ ---
137
+
138
+ ### `zefiro mcp`
139
+
140
+ Print MCP server setup instructions.
141
+
142
+ ```bash
143
+ zefiro mcp
144
+ ```
145
+
146
+ **Claude Code:**
147
+ ```bash
148
+ claude mcp add zefiro -- zefiro-mcp # project-scoped
149
+ claude mcp add zefiro -s user -- zefiro-mcp # global
150
+ ```
151
+
152
+ **Claude Desktop / other clients:**
153
+ ```json
154
+ {
155
+ "mcpServers": {
156
+ "zefiro": { "command": "zefiro-mcp" }
157
+ }
158
+ }
159
+ ```
160
+
161
+ **Available MCP tools:**
162
+
163
+ | Tool | Description |
164
+ |------|-------------|
165
+ | `zefiro_scan_codebase` | Scan project test infrastructure |
166
+ | `zefiro_scan_ast` | Deep AST scan: routes, components, hooks |
167
+ | `zefiro_scan_ast_detail` | Drill into a specific AST category |
168
+ | `zefiro_build_qa_map` | Validate and write a QAMapV2Payload |
169
+ | `zefiro_read_qa_map` | Read the existing QA map file |
107
170
 
108
- Requires `push.apiUrl` and `push.apiKey` in config or via environment variables.
171
+ ---
172
+
173
+ ## Global Options
174
+
175
+ ```
176
+ -k, --key <KEY> Issue key context (e.g. PROJ-101, LIN-42)
177
+ --provider <provider> LLM provider: openai | anthropic
178
+ --model <model> LLM model override
179
+ --verbose Verbose output
180
+ -v, --version Show version
181
+ -h, --help Show help
182
+ ```
183
+
184
+ ---
109
185
 
110
186
  ## Configuration
111
187
 
112
- Configuration lives in `.qai/zefiro/config.ts`:
188
+ For most projects, the `.env` variables written by `zefiro init` are sufficient. For advanced setups (custom paths, per-agent model overrides, integrations), create `.qai/zefiro/config.ts`:
113
189
 
114
190
  ```typescript
115
- import { defineConfig } from 'zefiro/config';
191
+ import { defineConfig } from 'zefiro';
116
192
 
117
193
  export default defineConfig({
118
- inputSource: 'jira', // 'none' | 'jira' | 'linear'
119
- outputTarget: 'markdown', // 'markdown' | 'zephyr' | 'both'
194
+ inputSource: 'jira', // 'none' | 'jira' | 'linear'
195
+ outputTarget: 'markdown', // 'markdown' | 'zephyr' | 'both'
196
+ baseUrl: 'https://qaligent.space',
197
+
198
+ scanner: {
199
+ scanDir: 'src',
200
+ include: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
201
+ exclude: ['**/node_modules/**', '**/dist/**', '**/*.test.*'],
202
+ cacheDir: '.qai/zefiro/scan-cache',
203
+ },
120
204
 
121
205
  llm: {
122
- provider: 'openai', // 'openai' | 'anthropic'
123
- model: 'gpt-4o', // Override default model
124
- agentModels: { // Per-agent overrides
206
+ provider: 'openai', // 'openai' | 'anthropic'
207
+ model: 'gpt-4o',
208
+ agentModels: { // per-agent model overrides
125
209
  'feature-analyzer-agent': 'claude-sonnet-4-20250514',
126
210
  },
127
211
  },
128
212
 
129
- scanner: {
130
- scanDir: 'src',
131
- include: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
132
- exclude: ['**/node_modules/**', '**/dist/**'],
133
- cacheDir: '.qai/zefiro/scan-cache',
213
+ paths: {
214
+ tests: 'e2e/tests',
215
+ scenarios: 'e2e/scenarios',
216
+ qaOutput: 'qa',
217
+ },
218
+
219
+ integrations: {
220
+ zephyr: { titlePrefix: 'UI Automation' },
134
221
  },
135
222
 
136
223
  push: {
@@ -140,41 +227,64 @@ export default defineConfig({
140
227
  });
141
228
  ```
142
229
 
230
+ > `QAI_*` env vars take precedence over `config.ts` values when both are set.
231
+
232
+ ---
233
+
143
234
  ## AI Agents
144
235
 
145
- Zefiro ships with 3 agents (customizable in `.qai/zefiro/agents/`):
236
+ Zefiro ships with agents copied to `.qai/zefiro/agents/` on `init`. Edit them to tune AI behavior for your project.
146
237
 
147
238
  | Agent | Purpose |
148
239
  |-------|---------|
149
- | `feature-analyzer-agent` | Identifies features, workflows, and components from AST |
150
- | `scenario-planner-agent` | Generates test scenarios for each workflow |
151
- | `scanner-agent` | Interactive agent for manual QA map building (MCP) |
240
+ | `1.feature-analyzer-agent` | Identifies features, workflows, and components from AST |
241
+ | `2.scenario-planner-agent` | Generates test scenarios for each workflow |
242
+ | `3.scanner-agent` | Interactive QA map building (used via MCP) |
243
+ | `input-agent` | Enriches form component input definitions |
244
+ | `workflow-agent` | Maps user workflows within features |
245
+
246
+ Add `.qai/zefiro/context.md` to inject project-specific context into every agent call.
247
+
248
+ ---
152
249
 
153
250
  ## QA Map Output
154
251
 
155
- The generated QA map contains:
252
+ The generated `.qai/zefiro/qa-map.json` contains:
156
253
 
157
254
  - **Features** — User-facing capabilities grouped by routes
158
- - **Workflows** — User journeys (navigation, CRUD, multi-step, configuration, search/filter)
159
- - **Components** — UI elements (forms, modals, navigation, display)
160
- - **Scenarios** — Test cases with categories (happy-path, validation, error, edge-case, permission)
255
+ - **Workflows** — User journeys (navigation, CRUD, multi-step, search/filter, configuration)
256
+ - **Components** — UI elements (forms, modals, navigation, data display)
257
+ - **Scenarios** — Test cases per workflow (happy-path, validation, error, edge-case, permission)
161
258
 
162
- ## Project Structure
259
+ ---
163
260
 
164
- After initialization, zefiro creates:
261
+ ## Project Structure
165
262
 
166
263
  ```
167
264
  your-project/
265
+ .env # QAI_* variables (written by zefiro init)
168
266
  .qai/zefiro/
169
- config.ts # Configuration
170
- context.md # Project context for AI agents
171
- agents/ # Agent prompts (customizable)
172
- workflow.md # Workflow guide
173
- ast-scan.json # AST scan output
174
- qa-map.json # Generated QA map
175
- scan-cache/ # File-level MD5 cache
267
+ config.ts # Advanced config (optional)
268
+ context.md # Project context for AI agents
269
+ agents/ # Agent prompts (customizable)
270
+ workflow.md # Workflow guide
271
+ ast-scan.json # Latest AST scan output
272
+ qa-map.json # Generated QA map
273
+ scan-cache/ # File-level MD5 cache
176
274
  ```
177
275
 
276
+ ---
277
+
278
+ ## Interactive TUI
279
+
280
+ Running `zefiro` with no arguments launches an interactive terminal UI (requires TTY, ≥ 60×20).
281
+
282
+ ```bash
283
+ zefiro
284
+ ```
285
+
286
+ ---
287
+
178
288
  ## License
179
289
 
180
290
  MIT