@qa-gentic/stlc-agents 1.0.16 → 1.0.17

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 (41) hide show
  1. package/README.md +59 -314
  2. package/bin/postinstall.js +17 -1
  3. package/bin/qa-stlc.js +23 -0
  4. package/package.json +1 -1
  5. package/skills/write-helix-files/SKILL.md +6 -0
  6. package/src/cli/cmd-cost.js +253 -0
  7. package/src/cli/cmd-mcp-config.js +124 -59
  8. package/src/stlc_agents/agent_gherkin_generator/server.py +88 -4
  9. package/src/stlc_agents/agent_helix_writer/tools/helix_write.py +60 -28
  10. package/src/stlc_agents/agent_jira_manager/server.py +209 -2
  11. package/src/stlc_agents/agent_jira_manager/tools/jira_workitem.py +36 -0
  12. package/src/stlc_agents/agent_playwright_generator/server.py +968 -105
  13. package/src/stlc_agents/agent_test_case_manager/server.py +121 -2
  14. package/src/stlc_agents/shared/cost_tracker.py +395 -0
  15. package/src/stlc_agents/shared/pricing.py +72 -0
  16. package/src/stlc_agents/__pycache__/__init__.cpython-310.pyc +0 -0
  17. package/src/stlc_agents/agent_gherkin_generator/__pycache__/__init__.cpython-310.pyc +0 -0
  18. package/src/stlc_agents/agent_gherkin_generator/__pycache__/server.cpython-310.pyc +0 -0
  19. package/src/stlc_agents/agent_gherkin_generator/tools/__pycache__/__init__.cpython-310.pyc +0 -0
  20. package/src/stlc_agents/agent_gherkin_generator/tools/__pycache__/ado_gherkin.cpython-310.pyc +0 -0
  21. package/src/stlc_agents/agent_helix_writer/__pycache__/__init__.cpython-310.pyc +0 -0
  22. package/src/stlc_agents/agent_helix_writer/__pycache__/server.cpython-310.pyc +0 -0
  23. package/src/stlc_agents/agent_helix_writer/tools/__pycache__/__init__.cpython-310.pyc +0 -0
  24. package/src/stlc_agents/agent_helix_writer/tools/__pycache__/boilerplate.cpython-310.pyc +0 -0
  25. package/src/stlc_agents/agent_helix_writer/tools/__pycache__/helix_write.cpython-310.pyc +0 -0
  26. package/src/stlc_agents/agent_jira_manager/__pycache__/__init__.cpython-310.pyc +0 -0
  27. package/src/stlc_agents/agent_jira_manager/__pycache__/server.cpython-310.pyc +0 -0
  28. package/src/stlc_agents/agent_jira_manager/tools/__pycache__/__init__.cpython-310.pyc +0 -0
  29. package/src/stlc_agents/agent_jira_manager/tools/__pycache__/jira_workitem.cpython-310.pyc +0 -0
  30. package/src/stlc_agents/agent_playwright_generator/__pycache__/__init__.cpython-310.pyc +0 -0
  31. package/src/stlc_agents/agent_playwright_generator/__pycache__/server.cpython-310.pyc +0 -0
  32. package/src/stlc_agents/agent_playwright_generator/tools/__pycache__/__init__.cpython-310.pyc +0 -0
  33. package/src/stlc_agents/agent_playwright_generator/tools/__pycache__/ado_attach.cpython-310.pyc +0 -0
  34. package/src/stlc_agents/agent_test_case_manager/__pycache__/__init__.cpython-310.pyc +0 -0
  35. package/src/stlc_agents/agent_test_case_manager/__pycache__/server.cpython-310.pyc +0 -0
  36. package/src/stlc_agents/agent_test_case_manager/tools/__pycache__/__init__.cpython-310.pyc +0 -0
  37. package/src/stlc_agents/agent_test_case_manager/tools/__pycache__/ado_workitem.cpython-310.pyc +0 -0
  38. package/src/stlc_agents/shared/__pycache__/__init__.cpython-310.pyc +0 -0
  39. package/src/stlc_agents/shared/__pycache__/auth.cpython-310.pyc +0 -0
  40. package/src/stlc_agents/shared_jira/__pycache__/__init__.cpython-310.pyc +0 -0
  41. package/src/stlc_agents/shared_jira/__pycache__/auth.cpython-310.pyc +0 -0
package/README.md CHANGED
@@ -19,71 +19,60 @@ Five Python MCP servers cover the full QA Software Test Life Cycle:
19
19
  | Agent | Input | Output |
20
20
  |---|---|---|
21
21
  | `qa-test-case-manager` | ADO PBI / Bug / Feature ID | Manual test cases created & linked via TestedBy-Forward |
22
- | `qa-gherkin-generator` | ADO / Jira Epic / Feature / PBI / Bug ID | `.feature` file attached to ADO work item or saved locally |
23
- | `qa-playwright-generator` | Gherkin + live browser | `locators.ts` + page objects + step defs attached to ADO or saved locally |
22
+ | `qa-gherkin-generator` | ADO or Jira Epic / Feature / PBI / Bug ID | `.feature` file attached to work item or saved locally |
23
+ | `qa-playwright-generator` | Gherkin + live browser AX tree | `locators.ts` + page objects + step defs |
24
24
  | `qa-helix-writer` | Generated `.ts` files + `helix_root` | Files written to Helix-QA directory layout on disk |
25
- | `qa-jira-manager` | **Jira** Story / Bug / Task / Epic | Test cases created in Jira Gherkin Playwright TypeScript → Helix-QA files |
25
+ | `qa-jira-manager` | Jira Story / Bug / Task / Epic | Test cases in Jira + full pipeline to Helix-QA |
26
26
 
27
27
  A sixth server — **Playwright MCP** (`http://localhost:8931/mcp`) — drives a real browser during code generation, replacing hand-authored locators with accessibility-tree-derived, zero-hallucination selectors.
28
28
 
29
- > **ADO or Jira?** Both pipelines now run the full STLC: fetch → analyse → test cases → Gherkin → Playwright → Helix-QA. ADO uses `qa-test-case-manager` as the entry point; Jira uses `qa-jira-manager`. Agents 2–4 (`qa-gherkin-generator`, `qa-playwright-generator`, `qa-helix-writer`) are shared by both pipelines.
29
+ > **ADO or Jira?** Both pipelines run the full STLC: fetch → analyse → test cases → Gherkin → Playwright → Helix-QA. ADO uses `qa-test-case-manager` as the entry point; Jira uses `qa-jira-manager`. Agents 2–4 (`qa-gherkin-generator`, `qa-playwright-generator`, `qa-helix-writer`) are shared by both pipelines.
30
30
 
31
31
  ---
32
32
 
33
33
  ## Install
34
34
 
35
-
36
35
  ```bash
37
36
  # 1. Install the CLI + npm package globally
38
37
  # You will be prompted to choose your integration: ado / jira / both
39
- # The choice is saved to ~/.qa-stlc/integration and reused by all subsequent commands.
40
38
  npm install -g @qa-gentic/stlc-agents
41
39
  ```
42
40
 
43
- > **Note:** On most systems, the installer will prompt you to select your integration (ADO, Jira, or both) and then automatically run `qa-stlc init` and offer to scaffold a new project. If you do **not** see the prompt (for example, if npm skips postinstall for an already-installed package, or in some non-interactive environments), simply run:
44
- >
45
- > ```bash
46
- > qa-stlc init
47
- > qa-stlc scaffold
48
- > ```
49
- >
50
- > This will perform the same setup steps as the postinstall script.
51
-
52
41
  ```bash
53
- # 2. Bootstrap your project (installs Python agents, copies skills, writes MCP config)
54
- # --integration overrides the saved preference; omit to reuse the choice from step 1.
55
- qa-stlc init --vscode --integration ado # GitHub Copilot / VS Code — ADO pipeline
56
- qa-stlc init --vscode --integration jira # GitHub Copilot / VS Code — Jira pipeline
57
- qa-stlc init --vscode --integration both # GitHub Copilot / VS Code — both pipelines
58
- # or for Claude Code (no --vscode flag):
42
+ # 2. Bootstrap your project
43
+ qa-stlc init --vscode --integration ado # GitHub Copilot / VS Code ADO
44
+ qa-stlc init --vscode --integration jira # GitHub Copilot / VS Code — Jira
45
+ qa-stlc init --vscode --integration both # GitHub Copilot / VS Code — both
46
+ # or for Claude Code:
59
47
  qa-stlc init --integration ado
60
48
 
61
49
  # 3. Scaffold a new Playwright + Cucumber + TypeScript QA project
62
50
  qa-stlc scaffold --name my-qa-project
63
- # or into an existing directory
64
- qa-stlc scaffold --name acme-e2e --dir /path/to/acme-e2e
65
51
 
66
52
  # 4. Start the Playwright browser server (required for code generation)
67
53
  npx @playwright/mcp@latest --port 8931
68
54
  ```
69
55
 
70
56
  `qa-stlc init` does four things:
57
+
71
58
  1. `pip install qa-gentic-stlc-agents` — installs all five Python MCP servers
72
59
  2. Copies skill files to `.github/copilot-instructions/` (and `.claude/` if not `--vscode`)
73
- 3. Copies custom agent files to `.github/agents/` (used by GitHub Copilot and Claude's agent picker)
60
+ 3. Copies custom agent files to `.github/agents/`
74
61
  4. Writes `.vscode/mcp.json` with all six servers configured
75
62
 
76
- > **Integration flag:** `--integration` controls which agents and skill files are installed.
77
- > If omitted, the value saved during `npm install -g` is used.
78
- > You can change it at any time by re-running `qa-stlc init --integration <ado|jira|both>`.
79
-
80
63
  ---
81
64
 
82
65
  ## Requirements
83
66
 
84
- - Node.js 18
85
- - Python ≥ 3.10, < 3.14
86
- - For **Azure DevOps** (Agents 1–4) — a `.env` containing:
67
+ | Requirement | Value |
68
+ |---|---|
69
+ | Node.js | >= 18 |
70
+ | Python | >= 3.10, < 3.14 |
71
+ | ADO PAT | Required for Agents 1–4 (ADO pipeline) |
72
+ | Jira OAuth 2.0 (3LO) | Required for Agent 5 (Jira pipeline) |
73
+ | Playwright MCP | `npx @playwright/mcp@latest --port 8931` |
74
+
75
+ **ADO `.env` vars:**
87
76
 
88
77
  ```env
89
78
  ADO_ORGANIZATION_URL=https://dev.azure.com/your-org
@@ -94,65 +83,25 @@ APP_EMAIL=your-test-email@example.com
94
83
  APP_PASSWORD=your-test-password
95
84
  ```
96
85
 
97
- - For **Jira Cloud** (Agent 5) — additional `.env` vars:
86
+ **Jira `.env` vars (additional):**
98
87
 
99
88
  ```env
100
89
  JIRA_CLIENT_ID=your-atlassian-oauth-client-id
101
90
  JIRA_CLIENT_SECRET=your-atlassian-oauth-client-secret
102
91
  JIRA_CLOUD_ID=your-atlassian-cloud-id
103
- # Optional — defaults to http://localhost:8765/callback
104
- # JIRA_REDIRECT_URI=http://localhost:8765/callback
105
92
  ```
106
93
 
107
- See [Jira Authentication Setup](#jira-authentication-setup) for how to obtain these values.
108
-
109
94
  ---
110
95
 
111
- ## Commands
96
+ ## CLI Commands
112
97
 
113
- ```bash
114
- qa-stlc init [--vscode] [--python <path>] [--integration ado|jira|both]
115
- # Full bootstrap: pip install + skills + agent files + MCP config
116
- # Integration defaults to the value saved during npm install -g (prompted at that time)
117
-
118
- qa-stlc scaffold [--name <name>] [--dir <path>] [--no-install]
119
- # Copy full Playwright + Cucumber + TypeScript boilerplate to a new project directory
120
-
121
- qa-stlc skills [--target claude|vscode|cursor|windsurf|both|print]
122
- # Copy skill files to the correct AI coding agent directory
123
-
124
- qa-stlc mcp-config [--vscode] [--print] [--python <path>] [--playwright-port <n>]
125
- # Write .vscode/mcp.json (--vscode) or .mcp.json (Claude Code)
126
-
127
- qa-stlc verify
128
- # Check that all six MCP servers are reachable
129
- ```
130
-
131
- ---
132
-
133
- ## Usage
134
-
135
- Open your AI coding agent and use natural language:
136
-
137
- ```
138
- # Azure DevOps — Generate test cases
139
- Generate test cases for work item #12345 in MyProject at https://dev.azure.com/myorg
140
-
141
- # Azure DevOps — Generate Gherkin BDD
142
- Generate a Gherkin regression suite for Feature #11000 in MyProject at https://dev.azure.com/myorg
143
-
144
- # Jira — Fetch issue and generate test cases
145
- Generate test cases for Jira issue PROJ-123
146
-
147
- # Jira — Fetch an Epic hierarchy
148
- Fetch the full Epic hierarchy for PROJ-10 in Jira
149
-
150
- # Generate Playwright code (requires Playwright MCP running — works with both ADO and Jira flows)
151
- Generate Playwright TypeScript for the Gherkin I just created. The login page is at /auth/login
152
-
153
- # Write to Helix-QA project
154
- Write the generated files to my Helix-QA project at /workspace/my-qa-project
155
- ```
98
+ | Command | Description |
99
+ |---|---|
100
+ | `qa-stlc init [--vscode] [--integration ado\|jira\|both]` | Full bootstrap: pip install + skills + agent files + MCP config |
101
+ | `qa-stlc scaffold [--name n] [--dir path]` | Copy full Playwright + Cucumber + TypeScript boilerplate to a new project |
102
+ | `qa-stlc skills [--target claude\|vscode\|cursor\|windsurf]` | Copy skill files to the correct AI coding agent directory |
103
+ | `qa-stlc mcp-config [--vscode] [--print]` | Write `.vscode/mcp.json` or `.mcp.json` with all servers configured |
104
+ | `qa-stlc verify` | Check that all six MCP servers are reachable |
156
105
 
157
106
  ---
158
107
 
@@ -162,166 +111,58 @@ Write the generated files to my Helix-QA project at /workspace/my-qa-project
162
111
 
163
112
  | Tool | Description |
164
113
  |---|---|
165
- | `fetch_work_item` | Fetch a PBI, Bug, or Feature with acceptance criteria, linked test cases, and coverage hints. Returns `epic_not_supported` for Epics. Returns `confirmation_required: true` for Features. |
166
- | `get_linked_test_cases` | List all test cases already linked to a work item. Call before generating to power the deduplication diff. |
167
- | `create_and_link_test_cases` | Create structured manual test cases in ADO and link them via TestedBy-Forward. |
114
+ | `fetch_work_item` | Fetch a PBI, Bug, or Feature with acceptance criteria, coverage hints, and existing TC count. Returns `epic_not_supported` for Epics; `confirmation_required: true` for Features. |
115
+ | `get_linked_test_cases` | List all test cases already linked to a work item (deduplication). |
116
+ | `create_and_link_test_cases` | Create structured manual test cases in ADO and link via TestedBy-Forward. |
168
117
 
169
118
  ### qa-gherkin-generator _(Azure DevOps)_
170
119
 
171
120
  | Tool | Description |
172
121
  |---|---|
173
- | `fetch_feature_hierarchy` | Fetch a Feature and all child PBIs/Bugs with acceptance criteria and existing attachments. |
174
- | `fetch_work_item_for_gherkin` | Fetch a PBI or Bug with parent Feature context, suggested file name, and linked test case steps. |
122
+ | `fetch_feature_hierarchy` | Fetch a Feature and all child PBIs/Bugs with acceptance criteria and test case steps. |
123
+ | `fetch_work_item_for_gherkin` | Fetch a PBI or Bug with parent Feature context and suggested file name. |
175
124
  | `attach_gherkin_to_feature` | Validate and attach a `.feature` file to a Feature work item. |
176
- | `attach_gherkin_to_work_item` | Validate and attach a `.feature` file to a PBI or Bug work item. |
177
- | `validate_gherkin_content` | Structural validation — tags, scenario count, navigation steps. Returns `valid: bool` + `errors` + `warnings`. |
125
+ | `attach_gherkin_to_work_item` | Validate and attach a `.feature` file to a PBI or Bug. |
126
+ | `validate_gherkin_content` | Structural validation — returns `valid: bool` + `errors` + `warnings`. |
178
127
 
179
128
  ### qa-playwright-generator _(ADO + Jira)_
180
129
 
181
130
  | Tool | Description |
182
131
  |---|---|
183
- | `generate_playwright_code` | Generate `locators.ts`, `*Page.ts`, `*.steps.ts`, and `cucumber-profile.js` from validated Gherkin + live AX-tree `context_map`. Hard-blocks if `context_map` is absent to prevent hallucinated locators. |
184
- | `scaffold_locator_repository` | Generate the six Helix-QA healing infrastructure files. |
132
+ | `generate_playwright_code` | Generate `locators.ts`, `*Page.ts`, `*.steps.ts`, and `cucumber-profile.js` from Gherkin + live AX-tree `context_map`. Hard-blocks if `context_map` is absent. |
133
+ | `scaffold_locator_repository` | Generate the five Helix-QA healing infrastructure files. |
185
134
  | `validate_gherkin_steps` | Check for duplicate step strings and missing `When` steps. |
186
- | `attach_code_to_work_item` | Attach delta Playwright TypeScript files to an ADO work item. Pass only net-new delta files. |
135
+ | `attach_code_to_work_item` | Attach delta Playwright TypeScript files to an ADO work item. |
187
136
 
188
137
  ### qa-helix-writer _(ADO + Jira)_
189
138
 
190
139
  | Tool | Description |
191
140
  |---|---|
192
141
  | `inspect_helix_project` | Returns `framework_state` (`present` / `partial` / `absent`) and `recommendation`. |
193
- | `list_helix_tree` | List the full directory tree of a Helix-QA project. |
194
- | `read_helix_file` | Read an existing file from the Helix-QA project for overlap detection. |
142
+ | `list_helix_tree` | Full directory listing of a Helix-QA project. |
143
+ | `read_helix_file` | Read an existing file for overlap detection. |
195
144
  | `write_helix_files` | Write generated files to the correct Helix-QA paths. |
196
145
 
197
146
  ### qa-jira-manager _(Jira Cloud)_
198
147
 
199
148
  | Tool | Description |
200
149
  |---|---|
201
- | `fetch_jira_issue` | Fetch a Story, Bug, or Task with acceptance criteria, coverage hints, and existing linked test case count. Returns `epic_use_hierarchy` for Epics. |
150
+ | `fetch_jira_issue` | Fetch a Story, Bug, or Task with acceptance criteria and coverage hints. Returns `epic_use_hierarchy` for Epics. |
202
151
  | `fetch_jira_epic_hierarchy` | Fetch an Epic with all child issues (Stories, Tasks, Bugs, Sub-tasks). |
203
- | `create_and_link_test_cases` | Create test case issues in Jira (type `Test`, falls back to `Task`) and link them via `is tested by`. Steps stored as an ADF table — no Xray required. Returns `confirmation_required: true` for Epics. |
204
- | `get_linked_test_cases` | List all issues linked to a Jira issue via `is tested by` / `Test` link type. Call before generating to avoid duplicates. |
205
-
206
- ### playwright _(external)_
207
-
208
- | Tool | Description |
209
- |---|---|
210
- | `browser_navigate` | Navigate to a URL in the live browser. |
211
- | `browser_snapshot` | Capture the full AX tree — source for zero-hallucination locators. |
212
- | `browser_fill_form` | Fill multiple form fields by ref. |
213
- | `browser_click` | Click an element by ref. |
214
- | `browser_file_upload` | Upload a file to a file input by ref. |
215
-
216
- ---
217
-
218
- ## MCP Config
219
-
220
- ### VS Code / GitHub Copilot (`.vscode/mcp.json`)
221
-
222
- ```json
223
- {
224
- "servers": {
225
- "qa-test-case-manager": { "command": "/path/to/.venv/bin/qa-test-case-manager" },
226
- "qa-gherkin-generator": { "command": "/path/to/.venv/bin/qa-gherkin-generator" },
227
- "qa-playwright-generator": { "command": "/path/to/.venv/bin/qa-playwright-generator" },
228
- "qa-helix-writer": { "command": "/path/to/.venv/bin/qa-helix-writer" },
229
- "qa-jira-manager": {
230
- "command": "/path/to/.venv/bin/qa-jira-manager",
231
- "env": {
232
- "JIRA_CLIENT_ID": "${env:JIRA_CLIENT_ID}",
233
- "JIRA_CLIENT_SECRET": "${env:JIRA_CLIENT_SECRET}",
234
- "JIRA_CLOUD_ID": "${env:JIRA_CLOUD_ID}"
235
- }
236
- },
237
- "playwright": { "type": "http", "url": "http://localhost:8931/mcp" }
238
- }
239
- }
240
- ```
241
-
242
- ### Claude Code (`.mcp.json`)
243
-
244
- ```json
245
- {
246
- "mcpServers": {
247
- "qa-test-case-manager": { "command": "/path/to/.venv/bin/qa-test-case-manager" },
248
- "qa-gherkin-generator": { "command": "/path/to/.venv/bin/qa-gherkin-generator" },
249
- "qa-playwright-generator": { "command": "/path/to/.venv/bin/qa-playwright-generator" },
250
- "qa-helix-writer": { "command": "/path/to/.venv/bin/qa-helix-writer" },
251
- "qa-jira-manager": {
252
- "command": "/path/to/.venv/bin/qa-jira-manager",
253
- "env": {
254
- "JIRA_CLIENT_ID": "${env:JIRA_CLIENT_ID}",
255
- "JIRA_CLIENT_SECRET": "${env:JIRA_CLIENT_SECRET}",
256
- "JIRA_CLOUD_ID": "${env:JIRA_CLOUD_ID}"
257
- }
258
- },
259
- "playwright": { "type": "url", "url": "ws://localhost:8931" }
260
- }
261
- }
262
- ```
263
-
264
- > VS Code requires `http://localhost:8931/mcp` (with `/mcp` suffix).
265
- > Claude Code requires `ws://localhost:8931` (WebSocket, no `/mcp`).
266
- > `qa-stlc mcp-config` writes the correct format automatically.
152
+ | `create_and_link_test_cases` | Create test case issues in Jira (type `Test`, falls back to `Task`) and link via `is tested by`. Steps stored as ADF table — no Xray required. |
153
+ | `get_linked_test_cases` | List all issues linked via `is tested by` / `Test` link type (deduplication). |
267
154
 
268
155
  ---
269
156
 
270
- ## Skills Installed
271
-
272
- Skills follow the [Agent Skills specification](https://agentskills.io/specification) and live under `skills/<n>/SKILL.md`.
273
-
274
- | Skill | Purpose |
275
- |---|---|
276
- | `AGENT-BEHAVIOR.md` | Zero-inference contract. Read first. Always. |
277
- | `generate-test-cases/SKILL.md` | PBI / Bug / Feature → ADO manual test cases |
278
- | `generate-gherkin/SKILL.md` | Epic / Feature / PBI / Bug → validated `.feature` + ADO attach |
279
- | `generate-playwright-code/SKILL.md` | Gherkin + live browser → three-layer self-healing Playwright TypeScript |
280
- | `write-helix-files/SKILL.md` | Generated files → Helix-QA disk layout, scaffold or merge |
281
- | `deduplication-protocol/SKILL.md` | READ → DIFF → CREATE mandatory pre-flight gate |
282
- | `qa-jira-manager/SKILL.md` | Jira issue → test case issues + `is tested by` links |
283
-
284
- > **Installed copies** (`.claude/skills/`, `.github/copilot-instructions/`) are generated by
285
- > `qa-stlc init` / `qa-stlc skills` at project bootstrap time and are gitignored.
286
- > The canonical source for all skills is the `skills/` directory.
287
-
288
- ---
289
-
290
- ## Jira Authentication Setup
291
-
292
- `qa-jira-manager` uses **Jira OAuth 2.0 (3LO)** with a persistent file-based token cache
293
- at `~/.jira-cache/jira-token.json` — the same silent-cache / browser-fallback pattern
294
- used by the ADO MSAL auth module.
295
-
296
- ### Step 1 — Create an Atlassian OAuth 2.0 (3LO) app
297
-
298
- 1. Go to <https://developer.atlassian.com/console/myapps/>
299
- 2. Click **Create** → **OAuth 2.0 integration**
300
- 3. Add callback URL: `http://localhost:8765/callback`
301
- 4. Under **Permissions**, enable: `read:jira-user`, `read:jira-work`, `write:jira-work`, `offline_access`
302
- 5. Copy the **Client ID** and **Secret**
303
-
304
- ### Step 2 — Find your Cloud ID
305
-
306
- ```bash
307
- curl -H "Authorization: Bearer <any-token>" \
308
- https://api.atlassian.com/oauth/token/accessible-resources
309
- ```
310
-
311
- Copy the `id` field for your Jira site.
312
-
313
- ### Step 3 — Add to `.env`
314
-
315
- ```env
316
- JIRA_CLIENT_ID=your-client-id
317
- JIRA_CLIENT_SECRET=your-client-secret
318
- JIRA_CLOUD_ID=your-cloud-id
319
- ```
157
+ ## Three-Layer Self-Healing Architecture
320
158
 
321
- ### Step 4 First run
159
+ | Layer | Class | What It Heals |
160
+ |---|---|---|
161
+ | 1 — Locator | `LocatorHealer` | primary selector → role → label → text → AI Vision → CDPSession AX tree |
162
+ | 2 — Timing | `TimingHealer` | network-trace drift → auto-adjusted timeouts → HealingDashboard |
163
+ | 3 — Visual | `VisualIntentChecker` | element screenshot diff at assertions → HealingDashboard |
322
164
 
323
- The browser opens once on startup. Sign in to Jira. The token is cached silently
324
- and refreshed automatically for ~60 days — no re-prompting.
165
+ Healed selectors persist in `LocatorRepository`. All AI suggestions require human approval at `http://localhost:7890` before entering version control.
325
166
 
326
167
  ---
327
168
 
@@ -330,10 +171,10 @@ and refreshed automatically for ~60 days — no re-prompting.
330
171
  | Step | Azure DevOps | Jira Cloud |
331
172
  |---|---|---|
332
173
  | Fetch issue | `fetch_work_item` | `fetch_jira_issue` |
333
- | Fetch Epic hierarchy | Not supported — warn user | Not supported — warn user |
174
+ | Fetch Epic hierarchy | Not supported — warn user | `fetch_jira_epic_hierarchy` |
334
175
  | Check for duplicates | `get_linked_test_cases` | `get_linked_test_cases` |
335
176
  | Create & link test cases | `create_and_link_test_cases` | `create_and_link_test_cases` |
336
- | Generate Gherkin | `fetch_work_item_for_gherkin` → `attach_gherkin_to_work_item` | `qa-gherkin-generator` with Jira issue AC (save locally or attach to Jira) |
177
+ | Generate Gherkin | `fetch_work_item_for_gherkin` → `attach_gherkin_to_work_item` | `qa-gherkin-generator` with Jira AC |
337
178
  | Generate Playwright | `generate_playwright_code` (shared) | `generate_playwright_code` (shared) |
338
179
  | Write to disk | `write_helix_files` (shared) | `write_helix_files` (shared) |
339
180
  | Authentication | MSAL silent + browser (`~/.msal-cache/`) | OAuth 2.0 (3LO) + browser (`~/.jira-cache/`) |
@@ -341,20 +182,6 @@ and refreshed automatically for ~60 days — no re-prompting.
341
182
 
342
183
  ---
343
184
 
344
- ## Three-Layer Self-Healing Architecture
345
-
346
- | Layer | Class | What it heals |
347
- |---|---|---|
348
- | 1 — Locator | `LocatorHealer` | primary selector → role → label → text → AI Vision → CDPSession AX tree |
349
- | 2 — Timing | `TimingHealer` | network-trace drift → auto-adjusted timeouts → HealingDashboard |
350
- | 3 — Visual | `VisualIntentChecker` | element screenshot diff at assertions → HealingDashboard |
351
-
352
- Healed selectors persist in `LocatorRepository`. HealingDashboard: `http://localhost:7890`.
353
-
354
- All suggestions require human approval before entering version control.
355
-
356
- ---
357
-
358
185
  ## Run Tests
359
186
 
360
187
  ```bash
@@ -371,96 +198,14 @@ cucumber-js --config=config/cucumber.js -p <feature_profile> --tags "@smoke"
371
198
 
372
199
  ---
373
200
 
374
- ## Scaffold a New QA Project
375
-
376
- The `scaffold` command copies the full Playwright + Cucumber + TypeScript boilerplate framework — including three-layer AI self-healing, BDD templates, and CI/CD integration — into a new project directory.
377
-
378
- ```bash
379
- # Scaffold into ./my-qa-project (default name)
380
- qa-stlc scaffold
381
-
382
- # Custom project name and location
383
- qa-stlc scaffold --name acme-e2e --dir /path/to/workspace/acme-e2e
384
-
385
- # Skip npm install (e.g. to inspect files first)
386
- qa-stlc scaffold --name acme-e2e --no-install
387
- ```
388
-
389
- After scaffolding:
390
-
391
- ```bash
392
- cd my-qa-project
393
- npx playwright install chromium # install browser binaries
394
- cp .env.example .env # already done by scaffold
395
- # Edit .env — set BASE_URL and optionally AI_API_KEY
396
- npm test # run the example scenario
397
- ```
398
-
399
- ### What Gets Scaffolded
400
-
401
- | Layer | Contents |
402
- |---|---|
403
- | **Config** | `package.json`, `tsconfig.json`, `cucumber.js`, `.env.example`, `.gitignore` |
404
- | **CI/CD** | `Dockerfile`, `docker-compose.yml`, `azure-pipelines.yml` |
405
- | **Framework** | `src/hooks/`, `src/pages/BasePage.ts`, `src/locators/`, `src/config/` |
406
- | **Self-healing** | All healing utilities: `LocatorHealer`, `TimingHealer`, `VisualIntentChecker`, `HealingDashboard`, `review-server`, `healix-ci-apply`, etc. |
407
- | **AI utilities** | `AILocatorGenerator`, `AISelfHealing`, `AITestGenerator` |
408
- | **Auth** | `AuthManager`, `AuthSetup` |
409
- | **Templates** | `_template.feature`, `_template.locators.ts`, `_template.steps.ts`, `_TemplatePage.ts` |
410
- | **Example test** | `src/test/features/example.feature` + steps |
411
-
412
- ### Healing Dashboard
413
-
414
- During a test run the live dashboard is available at **http://localhost:7890**. After the run use the review server for promote-to-source + PR creation:
415
-
416
- ```bash
417
- npm run healix:review # http://localhost:7891
418
- # or in CI:
419
- HEALIX_CI_AUTO_APPROVE=true npm run healix:apply-ci
420
- ```
421
-
422
- ---
423
-
424
- ## Development
425
-
426
- ```bash
427
- # Install (all five agents from one pip package)
428
- make install-ado # install + ADO next steps
429
- make install-jira # install + Jira next steps
430
- make install-both # install + Both next steps
431
-
432
- # Verify
433
- make verify-ado # ADO agents + MSAL auth cache
434
- make verify-jira # Jira agents + OAuth token cache
435
- make verify-both # all agents + both auth caches
436
-
437
- # Skills
438
- make skills-ado # ADO skill files → .claude/skills/ + copilot-instructions/
439
- make skills-jira # Jira skill files
440
- make skills-both # all skill files
441
-
442
- # MCP config
443
- make mcp-config-ado # write .mcp.json for ADO pipeline
444
- make mcp-config-jira # write .mcp.json for Jira pipeline
445
- make mcp-config-both # write .mcp.json for both pipelines
446
-
447
- # Test + clean
448
- make test # run pytest tests/ -v
449
- make clean # remove .venv, __pycache__, dist
450
- ```
451
-
452
- ---
453
-
454
201
  ## Documentation
455
202
 
456
- - [Quick Start: Azure DevOps](QUICKSTART-ADO.md)
457
- - [Quick Start: Jira Cloud](QUICKSTART-JIRA.md)
458
- - [Architecture: ADO](ARCHITECTURE-ADO.md)
459
- - [Architecture: Jira](ARCHITECTURE-JIRA.md)
460
- - [Walkthrough: ADO](WALKTHROUGH-ADO.md)
461
- - [Walkthrough: Jira](WALKTHROUGH-JIRA.md)
462
- - [Architecture Reference](docs/architecture.md)
463
- - [End-to-End Walkthrough](docs/walkthrough.md)
203
+ - [ARCHITECTURE-ADO.md](ARCHITECTURE-ADO.md) — Full technical architecture, ADO pipeline
204
+ - [ARCHITECTURE-JIRA.md](ARCHITECTURE-JIRA.md) — Full technical architecture, Jira pipeline
205
+ - [WALKTHROUGH-ADO.md](WALKTHROUGH-ADO.md) — End-to-end walkthrough, ADO pipeline
206
+ - [WALKTHROUGH-JIRA.md](WALKTHROUGH-JIRA.md) — End-to-end walkthrough, Jira pipeline
207
+ - [PEER-DEV-PRESENTATION.md](PEER-DEV-PRESENTATION.md) — Developer team overview
208
+ - [MANAGEMENT-ROI.md](MANAGEMENT-ROI.md) — ROI, quality impact, and cost analysis
464
209
 
465
210
  ---
466
211
 
@@ -84,7 +84,23 @@ if (!python) {
84
84
  }
85
85
  }
86
86
 
87
- // ── 3. Print next-step instructions ──────────────────────────────────────────
87
+ // ── 3. Activate cost tracking on MCP servers ─────────────────────────────
88
+ info("Activating cost tracking on MCP servers...");
89
+ const costPatch = spawnSync(
90
+ python,
91
+ ["-m", "stlc_agents.shared.install_hook"],
92
+ { encoding: "utf8", stdio: "pipe" }
93
+ );
94
+ if (costPatch.status === 0) {
95
+ // Print each output line through our TTY writer
96
+ (costPatch.stdout || "").split("\n").filter(Boolean).forEach((l) => console.log(l));
97
+ ok("Cost tracking active — every tool call will log tokens + cost");
98
+ } else {
99
+ warn("Cost tracking patch skipped (run manually: python -m stlc_agents.shared.install_hook)");
100
+ if (costPatch.stderr) console.log(d(costPatch.stderr.slice(0, 300)));
101
+ }
102
+
103
+ // ── 4. Print next-step instructions ──────────────────────────────────────────
88
104
  console.log(`
89
105
  ${b("Next steps")} — run these inside your project root:
90
106
 
package/bin/qa-stlc.js CHANGED
@@ -22,6 +22,7 @@ const cmdSkills = require("../src/cli/cmd-skills");
22
22
  const cmdMcpConfig = require("../src/cli/cmd-mcp-config");
23
23
  const cmdVerify = require("../src/cli/cmd-verify");
24
24
  const cmdScaffold = require("../src/cli/cmd-scaffold");
25
+ const cmdCost = require("../src/cli/cmd-cost");
25
26
 
26
27
  program
27
28
  .name("qa-stlc")
@@ -83,6 +84,28 @@ program
83
84
  .option("--no-install", "Skip npm install after scaffolding")
84
85
  .action(cmdScaffold);
85
86
 
87
+ program
88
+ .command("cost")
89
+ .description(
90
+ "Show token usage and cost for stlc-agents pipeline sessions.\n" +
91
+ "Reads logs from ~/.qa-stlc/cost-*.jsonl written on every MCP tool call.\n\n" +
92
+ "Model detection order (first match wins):\n" +
93
+ " 1. STLC_CODING_AGENT_MODEL env var (explicit override)\n" +
94
+ " 2. ANTHROPIC_MODEL env var (set automatically by Claude Code)\n" +
95
+ " 3. GITHUB_COPILOT_MODEL env var (set by Copilot if configured)\n" +
96
+ " 4. ~/.qa-stlc/agent-model file (saved by --set-model)\n" +
97
+ " 5. claude-sonnet-4-6 (default fallback)\n\n" +
98
+ "Claude Code users: no setup needed — model is detected automatically.\n" +
99
+ "Cursor / Windsurf users: run qa-stlc cost --set-model <model-id> once."
100
+ )
101
+ .option("--all", "Show all sessions (default: last session only)")
102
+ .option("--session <id>", "Show a specific session by ID")
103
+ .option("--json", "Output raw JSON instead of a formatted table")
104
+ .option("--set-model <model>","Save your coding agent model for accurate pricing.\n" +
105
+ " e.g. claude-opus-4-6 | gpt-4o | claude-sonnet-4-6")
106
+ .option("--model-help", "Explain model detection and all ways to configure it")
107
+ .action(cmdCost);
108
+
86
109
  // ── Quick-start hint appended to every --help output ─────────────────────────
87
110
  program.addHelpText("after", `
88
111
  Quick Start (run once in your project root):
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qa-gentic/stlc-agents",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "description": "QA STLC Agents — five MCP servers + skills for AI-powered test case, Gherkin, Playwright generation, and Helix-QA file writing against Azure DevOps and Jira Cloud. Full pipeline for both: fetch → test cases → Gherkin → Playwright → Helix-QA. Works with Claude Code, GitHub Copilot, Cursor, Windsurf.",
5
5
  "keywords": [
6
6
  "playwright",
@@ -47,6 +47,12 @@ When(/^the user enters "([^"]*)" in the username field$/, async function (value:
47
47
  If `generate_playwright_code` produced regex patterns, use `pre_validate_cucumber_steps`
48
48
  to identify them, then convert to Cucumber expressions before calling `write_helix_files`.
49
49
 
50
+ **HARD STOP 4 — Cucumber config: append only, never create.**
51
+ If any Cucumber config file exists (`src/config/cucumber.config.ts` or project-root
52
+ `cucumber.js`), only append new profiles—never create a new file.
53
+ `write_helix_files` will automatically skip profile creation if the file does not
54
+ exist, to prevent orphaned config files from being left behind.
55
+
50
56
  ---
51
57
 
52
58
  Place files produced by `qa-playwright-generator` into a local Helix-QA