@qa-gentic/stlc-agents 1.0.26 → 1.0.28

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 (90) hide show
  1. package/ARCHITECTURE-ADO.md +350 -0
  2. package/ARCHITECTURE-JIRA.md +203 -0
  3. package/QUICKSTART-ADO.md +400 -0
  4. package/QUICKSTART-JIRA.md +334 -0
  5. package/README.md +49 -0
  6. package/package.json +18 -6
  7. package/skills/migrate-framework/SKILL.md +207 -0
  8. package/src/stlc_agents/__pycache__/__init__.cpython-313.pyc +0 -0
  9. package/src/stlc_agents/agent_gherkin_generator/__pycache__/__init__.cpython-313.pyc +0 -0
  10. package/src/stlc_agents/agent_gherkin_generator/__pycache__/server.cpython-313.pyc +0 -0
  11. package/src/stlc_agents/agent_gherkin_generator/tools/__pycache__/__init__.cpython-313.pyc +0 -0
  12. package/src/stlc_agents/agent_gherkin_generator/tools/__pycache__/ado_gherkin.cpython-313.pyc +0 -0
  13. package/src/stlc_agents/agent_helix_writer/__pycache__/__init__.cpython-313.pyc +0 -0
  14. package/src/stlc_agents/agent_helix_writer/__pycache__/server.cpython-313.pyc +0 -0
  15. package/src/stlc_agents/agent_helix_writer/tools/__pycache__/__init__.cpython-313.pyc +0 -0
  16. package/src/stlc_agents/agent_helix_writer/tools/__pycache__/boilerplate.cpython-313.pyc +0 -0
  17. package/src/stlc_agents/agent_helix_writer/tools/__pycache__/helix_write.cpython-313.pyc +0 -0
  18. package/src/stlc_agents/agent_jira_manager/__pycache__/__init__.cpython-313.pyc +0 -0
  19. package/src/stlc_agents/agent_jira_manager/__pycache__/server.cpython-313.pyc +0 -0
  20. package/src/stlc_agents/agent_jira_manager/tools/__pycache__/__init__.cpython-313.pyc +0 -0
  21. package/src/stlc_agents/agent_jira_manager/tools/__pycache__/jira_workitem.cpython-313.pyc +0 -0
  22. package/src/stlc_agents/agent_migration/__init__.py +0 -0
  23. package/src/stlc_agents/agent_migration/__pycache__/__init__.cpython-313.pyc +0 -0
  24. package/src/stlc_agents/agent_migration/__pycache__/_migrate.cpython-313.pyc +0 -0
  25. package/src/stlc_agents/agent_migration/__pycache__/cli.cpython-313.pyc +0 -0
  26. package/src/stlc_agents/agent_migration/__pycache__/detector.cpython-313.pyc +0 -0
  27. package/src/stlc_agents/agent_migration/__pycache__/mapper.cpython-313.pyc +0 -0
  28. package/src/stlc_agents/agent_migration/__pycache__/reporter.cpython-313.pyc +0 -0
  29. package/src/stlc_agents/agent_migration/__pycache__/server.cpython-313.pyc +0 -0
  30. package/src/stlc_agents/agent_migration/_migrate.py +1398 -0
  31. package/src/stlc_agents/agent_migration/cli.py +217 -0
  32. package/src/stlc_agents/agent_migration/detector.py +81 -0
  33. package/src/stlc_agents/agent_migration/mapper.py +439 -0
  34. package/src/stlc_agents/agent_migration/reporter.py +86 -0
  35. package/src/stlc_agents/agent_migration/server.py +267 -0
  36. package/src/stlc_agents/agent_migration/transformer/__init__.py +0 -0
  37. package/src/stlc_agents/agent_migration/transformer/__pycache__/__init__.cpython-313.pyc +0 -0
  38. package/src/stlc_agents/agent_migration/transformer/__pycache__/config_merger.cpython-313.pyc +0 -0
  39. package/src/stlc_agents/agent_migration/transformer/__pycache__/healer_injector.cpython-313.pyc +0 -0
  40. package/src/stlc_agents/agent_migration/transformer/__pycache__/import_fixer.cpython-313.pyc +0 -0
  41. package/src/stlc_agents/agent_migration/transformer/__pycache__/js_to_ts.cpython-313.pyc +0 -0
  42. package/src/stlc_agents/agent_migration/transformer/__pycache__/local_var_hoister.cpython-313.pyc +0 -0
  43. package/src/stlc_agents/agent_migration/transformer/__pycache__/locator_moderniser.cpython-313.pyc +0 -0
  44. package/src/stlc_agents/agent_migration/transformer/__pycache__/locator_registrar.cpython-313.pyc +0 -0
  45. package/src/stlc_agents/agent_migration/transformer/__pycache__/spec_to_bdd.cpython-313.pyc +0 -0
  46. package/src/stlc_agents/agent_migration/transformer/config_merger.py +513 -0
  47. package/src/stlc_agents/agent_migration/transformer/healer_injector.py +1143 -0
  48. package/src/stlc_agents/agent_migration/transformer/import_fixer.py +419 -0
  49. package/src/stlc_agents/agent_migration/transformer/js_to_ts.py +413 -0
  50. package/src/stlc_agents/agent_migration/transformer/local_var_hoister.py +378 -0
  51. package/src/stlc_agents/agent_migration/transformer/locator_moderniser.py +132 -0
  52. package/src/stlc_agents/agent_migration/transformer/locator_registrar.py +328 -0
  53. package/src/stlc_agents/agent_migration/transformer/spec_to_bdd.py +820 -0
  54. package/src/stlc_agents/agent_playwright_generator/__pycache__/__init__.cpython-313.pyc +0 -0
  55. package/src/stlc_agents/agent_playwright_generator/__pycache__/server.cpython-313.pyc +0 -0
  56. package/src/stlc_agents/agent_playwright_generator/server.py +926 -91
  57. package/src/stlc_agents/agent_playwright_generator/tools/__pycache__/__init__.cpython-313.pyc +0 -0
  58. package/src/stlc_agents/agent_playwright_generator/tools/__pycache__/ado_attach.cpython-313.pyc +0 -0
  59. package/src/stlc_agents/agent_test_case_manager/__pycache__/__init__.cpython-313.pyc +0 -0
  60. package/src/stlc_agents/agent_test_case_manager/__pycache__/server.cpython-313.pyc +0 -0
  61. package/src/stlc_agents/agent_test_case_manager/tools/__pycache__/__init__.cpython-313.pyc +0 -0
  62. package/src/stlc_agents/agent_test_case_manager/tools/__pycache__/ado_workitem.cpython-313.pyc +0 -0
  63. package/src/stlc_agents/shared/__pycache__/__init__.cpython-313.pyc +0 -0
  64. package/src/stlc_agents/shared/__pycache__/auth.cpython-313.pyc +0 -0
  65. package/src/stlc_agents/shared/__pycache__/cost_tracker.cpython-313.pyc +0 -0
  66. package/src/stlc_agents/shared/__pycache__/pricing.cpython-313.pyc +0 -0
  67. package/src/stlc_agents/shared_jira/__pycache__/__init__.cpython-313.pyc +0 -0
  68. package/src/stlc_agents/shared_jira/__pycache__/auth.cpython-313.pyc +0 -0
  69. package/src/stlc_agents/webhook_orchestrator/__pycache__/__init__.cpython-313.pyc +0 -0
  70. package/src/stlc_agents/webhook_orchestrator/__pycache__/agent_runner.cpython-313.pyc +0 -0
  71. package/src/stlc_agents/webhook_orchestrator/__pycache__/models.cpython-313.pyc +0 -0
  72. package/src/stlc_agents/webhook_orchestrator/__pycache__/orchestrator.cpython-313.pyc +0 -0
  73. package/src/stlc_agents/webhook_orchestrator/__pycache__/webhook_bridge.cpython-313.pyc +0 -0
  74. package/src/stlc_agents/agent_gherkin_generator/__pycache__/__init__.cpython-314.pyc +0 -0
  75. package/src/stlc_agents/agent_gherkin_generator/__pycache__/server.cpython-314.pyc +0 -0
  76. package/src/stlc_agents/agent_gherkin_generator/tools/__pycache__/__init__.cpython-314.pyc +0 -0
  77. package/src/stlc_agents/agent_gherkin_generator/tools/__pycache__/ado_gherkin.cpython-314.pyc +0 -0
  78. package/src/stlc_agents/agent_helix_writer/__pycache__/server.cpython-314.pyc +0 -0
  79. package/src/stlc_agents/agent_playwright_generator/__pycache__/__init__.cpython-314.pyc +0 -0
  80. package/src/stlc_agents/agent_playwright_generator/__pycache__/server.cpython-314.pyc +0 -0
  81. package/src/stlc_agents/agent_playwright_generator/tools/__pycache__/__init__.cpython-314.pyc +0 -0
  82. package/src/stlc_agents/agent_playwright_generator/tools/__pycache__/ado_attach.cpython-314.pyc +0 -0
  83. package/src/stlc_agents/agent_test_case_manager/__pycache__/__init__.cpython-314.pyc +0 -0
  84. package/src/stlc_agents/agent_test_case_manager/__pycache__/server.cpython-314.pyc +0 -0
  85. package/src/stlc_agents/agent_test_case_manager/tools/__pycache__/__init__.cpython-314.pyc +0 -0
  86. package/src/stlc_agents/agent_test_case_manager/tools/__pycache__/ado_workitem.cpython-314.pyc +0 -0
  87. package/src/stlc_agents/shared/__pycache__/__init__.cpython-314.pyc +0 -0
  88. package/src/stlc_agents/shared/__pycache__/auth.cpython-314.pyc +0 -0
  89. package/src/stlc_agents/shared/__pycache__/cost_tracker.cpython-314.pyc +0 -0
  90. package/src/stlc_agents/shared/__pycache__/pricing.cpython-314.pyc +0 -0
@@ -0,0 +1,350 @@
1
+ # STLC Agents — Architecture: Azure DevOps Pipeline
2
+
3
+ > Technical reference for the Azure DevOps pipeline.
4
+ > For the Jira Cloud pipeline see [ARCHITECTURE-JIRA.md](ARCHITECTURE-JIRA.md).
5
+
6
+ ---
7
+
8
+ ## System Overview
9
+
10
+ STLC Agents is a Python monorepo of four Model Context Protocol (MCP) servers that together automate the full Software Test Life Cycle on top of Azure DevOps. Each server is an independent Python process. A coding agent (Claude Code, GitHub Copilot, Cursor, Windsurf) installs all four with a single `npm install -g @qa-gentic/stlc-agents`, reads the skill files once, and can then drive the entire STLC pipeline — from work item to running self-healing Playwright tests — in a single prompt.
11
+
12
+ A fifth server, the external **Playwright MCP** (`http://localhost:8931/mcp`), drives a real browser during code generation to produce zero-hallucination selectors from the live accessibility tree.
13
+
14
+ ---
15
+
16
+ ## Data Flow
17
+
18
+ ```
19
+ ADO Work Item (PBI / Bug / Feature)
20
+
21
+ │ Agent 1: qa-test-case-manager
22
+ ├─ fetch_work_item → coverage hints, complexity
23
+ └─ create_and_link_test_cases → TC work items in ADO (TestedBy-Forward)
24
+
25
+
26
+ ADO Test Cases linked to work item
27
+
28
+ │ Agent 2: qa-gherkin-generator
29
+ ├─ fetch_feature_hierarchy → full child hierarchy
30
+ ├─ validate_gherkin_content → structural check
31
+ └─ attach_gherkin_to_feature → .feature file in ADO
32
+
33
+
34
+ Gherkin .feature file
35
+
36
+ │ Playwright MCP (external)
37
+ ├─ browser_navigate → live app page
38
+ └─ browser_snapshot → AX tree → context_map
39
+
40
+ │ Agent 3: qa-playwright-generator
41
+ ├─ generate_playwright_code → 4 TS files per feature
42
+ ├─ scaffold_locator_repository → 5 infra files
43
+ └─ attach_code_to_work_item → files in ADO
44
+
45
+ │ Agent 4: qa-helix-writer
46
+ └─ write_helix_files → Helix-QA disk layout
47
+
48
+
49
+ cucumber-js test run
50
+
51
+ HealingDashboard :7890
52
+ (human review of AI suggestions)
53
+ ```
54
+
55
+ ---
56
+
57
+ ## Agent 1 — `qa-test-case-manager`
58
+
59
+ **Purpose:** Convert ADO work item acceptance criteria into structured manual test cases, linked back via `TestedBy-Forward` relation.
60
+
61
+ ### Tools
62
+
63
+ | Tool | ADO API Call | Returns |
64
+ |---|---|---|
65
+ | `fetch_work_item` | `GET /wit/workitems/{id}?$expand=relations` | Title, AC, story points, coverage hints, existing TC count, parent feature |
66
+ | `get_linked_test_cases` | `GET /wit/workitems/{id}/relations` | Titles and IDs of TCs already linked (deduplication gate) |
67
+ | `create_and_link_test_cases` | `POST /wit/workitems/$Test Case` + `PATCH` | Created TC IDs and ADO URLs |
68
+
69
+ ### Coverage Hint Extraction
70
+
71
+ `_extract_coverage_hints()` scans acceptance criteria text for keywords and returns which of 11 categories need test cases:
72
+
73
+ ```
74
+ toast_notifications file_size_boundary post_action_state platform_specific
75
+ computed_values data_persistence accessibility image_manipulation
76
+ file_formats cancel_flows validation_errors
77
+ ```
78
+
79
+ ### Complexity Classification
80
+
81
+ | Story Points | Complexity | TC Range |
82
+ |---|---|---|
83
+ | 1–3 | Simple | 3–6 |
84
+ | 4–8 | Medium | 6–12 |
85
+ | 9+ | Complex | 12–18 |
86
+
87
+ ### Work Item Type Routing
88
+
89
+ | Work Item Type | Behaviour |
90
+ |---|---|
91
+ | Epic | Returns `epic_not_supported` — manual TCs are never created for Epics |
92
+ | Feature | Returns `confirmation_required: true` — user must confirm before creation |
93
+ | PBI / Bug | Normal deduplication + creation flow |
94
+
95
+ ---
96
+
97
+ ## Agent 2 — `qa-gherkin-generator`
98
+
99
+ **Purpose:** Convert an ADO work item hierarchy into a validated Gherkin `.feature` file and attach it.
100
+
101
+ ### Tools
102
+
103
+ | Tool | Description |
104
+ |---|---|
105
+ | `fetch_feature_hierarchy` | Fetch a Feature with all child PBIs/Bugs and linked test case steps |
106
+ | `fetch_work_item_for_gherkin` | Fetch a PBI or Bug with parent Feature context |
107
+ | `attach_gherkin_to_feature` | Validate and attach a `.feature` file to a Feature work item |
108
+ | `attach_gherkin_to_work_item` | Validate and attach a `.feature` file to a PBI or Bug |
109
+ | `validate_gherkin_content` | Structural validation — returns `valid: bool` + `errors` + `warnings` |
110
+
111
+ ### Work Item Type Routing (strict — no inference)
112
+
113
+ ```
114
+ Epic ID → ⛔ Not supported — warn user; ask for a Feature or PBI/Bug ID
115
+ Feature ID → fetch_feature_hierarchy
116
+ PBI/Bug ID → fetch_work_item_for_gherkin
117
+ Unknown → call fetch tool; read work_item_type from response
118
+ ```
119
+
120
+ ### Skill-Enforced Gherkin Rules
121
+
122
+ - 5–10 scenarios per feature file
123
+ - `@smoke` on the primary happy path; `@regression` on all others
124
+ - `Scenario Outline` for data-driven boundary tests
125
+ - `Background` only when 2+ scenarios share identical preconditions
126
+ - Every scenario must include explicit navigation steps
127
+ - File naming: `{id}_{title-in-kebab-case}_regression.feature`
128
+
129
+ ---
130
+
131
+ ## Agent 3 — `qa-playwright-generator`
132
+
133
+ **Purpose:** Convert a validated Gherkin file into production-ready, three-layer self-healing Playwright TypeScript, with selectors derived from the live browser accessibility tree.
134
+
135
+ ### Tools
136
+
137
+ | Tool | Description |
138
+ |---|---|
139
+ | `generate_playwright_code` | Gherkin + `context_map` → 4 TypeScript files per feature. Hard-blocks if `context_map` is absent — prevents hallucinated locators. |
140
+ | `scaffold_locator_repository` | Generate 5 shared healing infrastructure files (once per project) |
141
+ | `validate_gherkin_steps` | Check for duplicate step strings and missing `When` steps |
142
+ | `attach_code_to_work_item` | Attach delta TypeScript files to an ADO work item |
143
+
144
+ ### Generated Files Per Feature
145
+
146
+ | File | Contents |
147
+ |---|---|
148
+ | `src/locators/{kebab}.locators.ts` | AX-tree-verified selectors as `{ selector, intent, stability }` entries |
149
+ | `src/pages/{kebab}.page.ts` | Page object with healer fields + ctor registrations under both namespaced (`<page>.<key>`) and bare-key conventions |
150
+ | `src/test/steps/{kebab}.steps.ts` | Cucumber step definitions via PageFixture DI |
151
+ | `src/test/features/{kebab}.feature` | Generated Gherkin (when Agent 3 emits it) |
152
+ | `config/cucumber.js` | Cucumber profile entry (kept compatible with the `dotenv/config` + `ts-node/register` + `tsconfig-paths/register` `requireModule` chain) |
153
+
154
+ ### Shared Healing Infrastructure (once per project)
155
+
156
+ | File | Purpose |
157
+ |---|---|
158
+ | `src/utils/locators/LocatorHealer.ts` | 8-strategy locator resolution chain (tunable via `HEAL_STRATEGY_ORDER`); after match, introspects the element and persists a **specific** single-attribute selector (`#id`, `[data-testid=…]`, …), not the search union |
159
+ | `src/utils/locators/LocatorRepository.ts` | Heal-store JSON with schema v1 envelope, heal-only persist filter, debounced writes, singleton exit-flush, per-env file suffix via `ENV` / `HELIX_ENV`, `HEAL_HISTORY_CAP` |
160
+ | `src/utils/locators/TimingHealer.ts` | Network trace drift detection and auto-healing |
161
+ | `src/utils/locators/VisualIntentChecker.ts` | Element screenshot pixel diff against approved baseline |
162
+ | `src/utils/locators/HealingDashboard.ts` | Two-server HTTP UI — read/write at `HEALING_DASHBOARD_PORT` (default 7890), read-only mirror at `HEALIX_REVIEW_PORT` (opt-in). Auto-discovers all sibling heal-store files in the directory. Confirm on a healed entry writes the healed selector back to the source `*.locators.ts` |
163
+ | `src/utils/locators/dashboard-server.ts` | Standalone launcher behind `npm run healix:dashboard` / `healix:review` |
164
+ | `src/utils/locators/{ElementContextHelper, HealApplicator, LocatorRules, LocatorStrategy, healix-ci-apply, review-server}.ts` | Filled from BOILERPLATE — pure additions that integrate with the enhanced scaffolds above |
165
+
166
+ ### Zero-Hallucination Guarantee
167
+
168
+ Agent 3 requires a `context_map` derived from Playwright MCP `browser_snapshot` calls. It hard-blocks generation if `context_map` is absent. Every selector in the context map is validated against the live DOM before being written to `locators.ts` — only selectors matching exactly one element are used.
169
+
170
+ ---
171
+
172
+ ## Agent 4 — `qa-helix-writer`
173
+
174
+ **Purpose:** Write already-generated files to disk at the correct Helix-QA directory layout. No ADO dependency; no LLM calls.
175
+
176
+ ### Helix-QA Directory Mapping
177
+
178
+ | Generated File | Helix-QA Path |
179
+ |---|---|
180
+ | `locators.ts` | `src/locators/<kebab>.locators.ts` |
181
+ | `<Page>.page.ts` | `src/pages/<Page>.page.ts` |
182
+ | `<feature>.steps.ts` | `src/test/steps/<feature>.steps.ts` |
183
+ | `<feature>.feature` | `src/test/features/<feature>.feature` |
184
+ | Cucumber profile key | `src/config/cucumber.config.ts` (appended, not replaced) |
185
+ | `utils/locators/*.ts` | `src/utils/locators/<file>` |
186
+
187
+ ### Mandatory Tool Call Order
188
+
189
+ 1. `list_helix_tree` — always first, to see what exists
190
+ 2. `read_helix_file` — for specific file deduplication
191
+ 3. `write_helix_files` — pass the `files` dict from Agent 3 directly
192
+
193
+ ---
194
+
195
+ ## Three-Layer Self-Healing Architecture
196
+
197
+ ### Layer 1 — Locator Healing (`LocatorHealer.ts`)
198
+
199
+ When a primary selector fails, `LocatorHealer.resolve()` walks an ordered
200
+ chain of strategies — order is controlled by `HEAL_STRATEGY_ORDER` (CSV env
201
+ var, default order below):
202
+
203
+ | Strategy | Method | Default timeout | Notes |
204
+ |---|---|---|---|
205
+ | 1 | `LocatorRepository.getHealed()` — cached selector from prior run | 3s attach | Persisted via singleton exit-flush; survives process restart |
206
+ | 2 | `page.locator(primarySelector)` — selector from `locators.ts` | 5s | Original definition |
207
+ | 3 | **Attribute partial-match** — single combined CSS selector across `name`, `placeholder`, `id`, `aria-label`, `data-testid`, `data-test`, `autocomplete` | 3s | Most reliable for form inputs without an accessible name |
208
+ | 4 | **Type-hint heuristics** — keyword-driven `input[type=password]`, `[type=email]`, `button[type=submit]`, etc. | 3s | Per `LOCATOR_TIMEOUT` |
209
+ | 5 | `page.getByRole(role, { name: regex })` for `button`/`link`/`textbox`/`combobox`/`checkbox`/`radio` | 3s × 6 roles | |
210
+ | 6 | `page.getByLabel(intent, { exact: false })` | 3s | |
211
+ | 7 | `page.getByText(keyword, { exact: false })` | 3s | First word > 3 chars |
212
+ | 8 | **AI Vision** — `ariaSnapshot` → Anthropic / Copilot / Claude Code | ~10s | Off via `ENABLE_AI_HEALING=false`; requires API key |
213
+
214
+ After any strategy matches, **`_resolveSpecificSelector(loc)` introspects
215
+ the live element** and persists the most stable single-attribute selector
216
+ (`data-testid` > `id` > `name` > `placeholder` > `aria-label` >
217
+ `autocomplete` > `input[type]`) — not the broad selector the strategy
218
+ itself used to search. So heals look like the qa-playwright-generator's
219
+ own generation-time output: concrete, stable, single-attribute.
220
+
221
+ `LOCATOR_HEAL_ATTEMPTS=N` bounds the total number of probes before
222
+ falling through to AI Vision (default 0 = unlimited).
223
+
224
+ ### Layer 2 — Timing Healing (`TimingHealer.ts`)
225
+
226
+ Measures actual network duration per named action, compares to stored baseline. When drift exceeds 20%, it auto-adjusts with 50% headroom for the current run and queues a suggestion to HealingDashboard.
227
+
228
+ ### Layer 3 — Visual Healing (`VisualIntentChecker.ts`)
229
+
230
+ At locators marked `visualIntent: true`, captures a scoped element screenshot and pixel-diffs against an approved baseline. A 0.5% threshold catches colour changes, truncated labels, or layout shifts that the locator layer would miss.
231
+
232
+ ### Selector Stability Ranking
233
+
234
+ | Selector Strategy | Score | Rationale |
235
+ |---|---|---|
236
+ | `data-testid` | 100 | Explicit test contract — never changes incidentally |
237
+ | `aria-role + aria-label` | 90 | Semantic; survives CSS and DOM restructuring |
238
+ | Non-generated `id` | 80 | Stable when `id` is not auto-generated |
239
+ | `aria-label` alone | 70 | Semantic but may be internationalised |
240
+ | `placeholder` | 60 | Input-only; survives minor refactors |
241
+ | Role + text (XPath) | 50 | Fallback; validated at runtime |
242
+
243
+ ### HealingDashboard — Heal Review + Source Write-Back
244
+
245
+ Two HTTP servers:
246
+
247
+ | Port (env var) | Default | Role |
248
+ |---|---|---|
249
+ | `HEALING_DASHBOARD_PORT` | 7890 | Full UI — **Healed locators** table (Confirm / Revert) + **Pending AI suggestions** table (Approve / Reject). POST endpoints commit changes. |
250
+ | `HEALIX_REVIEW_PORT` | 0 (opt-in) | Read-only mirror — same GET endpoints (`/api/healed`, `/api/pending`, `/api/analytics`, `/api/heal-log`) but rejects POST with HTTP 403. For QA leads / external dashboards. |
251
+
252
+ Two heal flows converge on the dashboard:
253
+
254
+ | Source | Default behaviour | Dashboard action |
255
+ |---|---|---|
256
+ | Automatic strategies (attribute / type-hint / role / label / text) | Commit immediately — test proceeds, heal persisted to `self-heals/healed-locators[.<env>].json` | **Confirm** marks the heal `appliedToSourceAt` AND rewrites the source `*.locators.ts` file's `selector:` field so future runs use it as the primary probe. **Revert** clears the heal — file is purged from the heal-store. |
257
+ | AI Vision (strategy 8) | Queued as `pendingSuggestion` — operator must approve before commit | **Approve** commits + writes back. **Reject** discards. |
258
+
259
+ The heal store is **heal-only** — pure-registered baseline entries don't get written, so the JSON only contains entries a human needs to review. `HEAL_STORE_PATH` controls the location; `ENV` / `HELIX_ENV` auto-suffix it (`healed-locators.qa4.json`) so multi-env runs don't trample each other. Set `HEALING_DASHBOARD_PORT=0` to disable the UI in fully automated pipelines — heals are still written to disk for async review. A tab-separated audit log (`HEAL_LOG_PATH`, default `./self-heals/heal.log`) is appended per heal.
260
+
261
+ ---
262
+
263
+ ## Authentication
264
+
265
+ Agents 1–4 share `shared/auth.py` for ADO authentication via MSAL. The module uses the same cache as `microsoft/azure-devops-mcp`, so signing into any Microsoft tool (VS Code, `az login`) also authenticates these agents.
266
+
267
+ **Token acquisition sequence:**
268
+
269
+ ```
270
+ 1. Load ~/.msal-cache/msal-cache.json
271
+ 2. msal.acquire_token_silent() → token found and valid → Bearer token (zero UI)
272
+ 3. msal.acquire_token_interactive() → browser opens once → cached for ~90 days
273
+ CI/CD: AZURE_CLIENT_ID + AZURE_CLIENT_SECRET + AZURE_TENANT_ID → service principal
274
+ ```
275
+
276
+ **Constants (must match `microsoft/azure-devops-mcp` exactly):**
277
+
278
+ | Constant | Value |
279
+ |---|---|
280
+ | `_ADO_SCOPE` | `499b84ac-1321-427f-aa17-267ca6975798/.default` |
281
+ | `_DEFAULT_CLIENT_ID` | `04b07795-8ddb-461a-bbee-02f9e1bf7b46` (Azure CLI) |
282
+ | `_CACHE_FILE` | `~/.msal-cache/msal-cache.json` |
283
+
284
+ ---
285
+
286
+ ## MCP Configuration
287
+
288
+ **VS Code / GitHub Copilot (`.vscode/mcp.json`):**
289
+
290
+ ```json
291
+ {
292
+ "servers": {
293
+ "qa-test-case-manager": { "command": "/path/.venv/bin/qa-test-case-manager" },
294
+ "qa-gherkin-generator": { "command": "/path/.venv/bin/qa-gherkin-generator" },
295
+ "qa-playwright-generator": { "command": "/path/.venv/bin/qa-playwright-generator" },
296
+ "qa-helix-writer": { "command": "/path/.venv/bin/qa-helix-writer" },
297
+ "qa-migration": { "command": "/path/.venv/bin/stlc-migrate" },
298
+ "playwright": { "type": "http", "url": "http://localhost:8931/mcp" }
299
+ }
300
+ }
301
+ ```
302
+
303
+ **Claude Code (`.mcp.json`):**
304
+
305
+ ```json
306
+ {
307
+ "mcpServers": {
308
+ "qa-test-case-manager": { "command": "/path/.venv/bin/qa-test-case-manager" },
309
+ "qa-gherkin-generator": { "command": "/path/.venv/bin/qa-gherkin-generator" },
310
+ "qa-playwright-generator": { "command": "/path/.venv/bin/qa-playwright-generator" },
311
+ "qa-helix-writer": { "command": "/path/.venv/bin/qa-helix-writer" },
312
+ "qa-migration": { "command": "/path/.venv/bin/stlc-migrate" },
313
+ "playwright": { "command": "npx", "args": ["@playwright/mcp@latest", "--isolated"] }
314
+ }
315
+ }
316
+ ```
317
+
318
+ Use `qa-stlc mcp-config [--vscode]` to generate this manually, or let
319
+ `stlc-migrate` emit `.mcp.json` automatically as part of a migration (with
320
+ absolute binary paths discovered from the active venv).
321
+
322
+ ---
323
+
324
+ ## Migration (Existing Playwright project → Helix-QA)
325
+
326
+ Use `stlc-migrate` to bring an existing project onto the agent rails. See
327
+ `skills/migrate-framework/SKILL.md` for the full pipeline reference. In
328
+ short:
329
+
330
+ ```bash
331
+ stlc-migrate --source ./my-old-tests --helix ./helix-qa --integration ado
332
+ ```
333
+
334
+ The tool writes the entire Helix-QA tree, including the healer scaffolds
335
+ listed above, `.claude/skills/`, `.github/copilot-instructions/`,
336
+ `AGENT-BEHAVIOR.md`, `ORCHESTRATION_RULES.md`, and `.mcp.json` with
337
+ absolute paths to every agent in the active venv. Healed selectors land in
338
+ `self-heals/healed-locators[.<env>].json` per the new healing architecture.
339
+
340
+ ---
341
+
342
+ ## Design Decisions
343
+
344
+ **Why four separate MCP servers rather than one?** Each agent has a distinct concern and a distinct skill file. A team can use just Agent 1 without knowing anything about Playwright. Failures in one server do not affect the others. All four share `shared/auth.py` to avoid duplication.
345
+
346
+ **Why Python for the MCP servers?** The MCP Python SDK maps cleanly to stdio transport. `requests` covers all ADO REST needs. Code generation is pure string manipulation — no TypeScript compiler is needed server-side.
347
+
348
+ **Why not auto-commit healed selectors?** AI suggestions are probabilistic. A healed selector that works for one run may not be semantically correct. HealingDashboard makes every AI-generated change visible, attributable, and reversible before it enters version control.
349
+
350
+ **Why validate selectors at generation time?** AI-generated selectors frequently match zero or multiple elements. Validating against the live browser during the `context_map` capture phase eliminates this class of error entirely — only selectors matching exactly one element reach `locators.ts`.
@@ -0,0 +1,203 @@
1
+ # STLC Agents — Architecture: Jira Cloud Pipeline
2
+
3
+ > Technical reference for the Jira Cloud pipeline.
4
+ > For the Azure DevOps pipeline see [ARCHITECTURE-ADO.md](ARCHITECTURE-ADO.md).
5
+
6
+ ---
7
+
8
+ ## System Overview
9
+
10
+ The Jira Cloud pipeline runs the same full STLC as the ADO pipeline. `qa-jira-manager` replaces `qa-test-case-manager` as the entry point and manages Jira OAuth 2.0 (3LO) authentication. Agents 2–4 (`qa-gherkin-generator`, `qa-playwright-generator`, `qa-helix-writer`) are shared between both pipelines and behave identically.
11
+
12
+ | Agent | Role | Pipeline |
13
+ |---|---|---|
14
+ | `qa-jira-manager` | Fetch Jira issues, generate and link test cases | Jira only |
15
+ | `qa-gherkin-generator` | Generate `.feature` files from acceptance criteria | Shared |
16
+ | `qa-playwright-generator` | Generate self-healing Playwright TypeScript | Shared |
17
+ | `qa-helix-writer` | Write generated files to Helix-QA disk layout | Shared |
18
+
19
+ ---
20
+
21
+ ## Data Flow
22
+
23
+ ```
24
+ Jira Issue (Story / Bug / Task / Epic)
25
+
26
+ │ Agent 5: qa-jira-manager
27
+ ├─ fetch_jira_issue / fetch_jira_epic_hierarchy
28
+ ├─ get_linked_test_cases → deduplication
29
+ └─ create_and_link_test_cases → Jira test case issues ("is tested by")
30
+
31
+
32
+ Jira Test Case Issues linked to source story
33
+
34
+ │ Agent 2: qa-gherkin-generator
35
+ ├─ generate .feature from AC
36
+ └─ save locally or attach to Jira issue
37
+
38
+
39
+ Gherkin .feature file
40
+
41
+ │ Playwright MCP (external)
42
+ ├─ browser_navigate → live app page
43
+ └─ browser_snapshot → AX tree → context_map
44
+
45
+ │ Agent 3: qa-playwright-generator
46
+ ├─ generate_playwright_code → 4 TS files per feature
47
+ ├─ scaffold_locator_repository → 5 infra files
48
+ └─ save locally or attach to Jira issue
49
+
50
+ │ Agent 4: qa-helix-writer
51
+ └─ write_helix_files → Helix-QA disk layout
52
+
53
+
54
+ cucumber-js test run + HealingDashboard :7890
55
+ ```
56
+
57
+ ---
58
+
59
+ ## Agent 5 — `qa-jira-manager`
60
+
61
+ **Purpose:** Run the full Jira STLC pipeline — fetch Jira issues, generate and create test cases in Jira with `is tested by` links, then hand off to Agents 2–4.
62
+
63
+ ### Tools
64
+
65
+ | Tool | Description |
66
+ |---|---|
67
+ | `fetch_jira_issue` | Fetch a Story, Bug, Task, or Sub-task from Jira Cloud with AC and coverage hints. Returns `epic_use_hierarchy` for Epics. |
68
+ | `fetch_jira_epic_hierarchy` | Fetch a Jira Epic and enumerate all child issues (Stories, Tasks, Bugs, Sub-tasks). |
69
+ | `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. Returns `confirmation_required: true` for Epics. |
70
+ | `get_linked_test_cases` | Return test cases already linked to a Jira issue (deduplication). |
71
+
72
+ ### Coverage Hint Extraction
73
+
74
+ Identical to Agent 1 — scans acceptance criteria for 11 categories:
75
+
76
+ ```
77
+ toast_notifications file_size_boundary post_action_state platform_specific
78
+ computed_values data_persistence accessibility image_manipulation
79
+ file_formats cancel_flows validation_errors
80
+ ```
81
+
82
+ ### Jira-Specific Behaviours
83
+
84
+ - Test cases are Jira issues of type `Test` (falls back to `Task` — no Xray required)
85
+ - Steps stored as ADF (Atlassian Document Format) tables in the issue description
86
+ - Links use `is tested by` / `Test` Jira link type
87
+ - Epic ID → returns `epic_use_hierarchy` to route to `fetch_jira_epic_hierarchy`
88
+ - `confirmation_required: true` returned for Epic-level creation before any action
89
+
90
+ ---
91
+
92
+ ## Authentication — Jira OAuth 2.0 (3LO)
93
+
94
+ Agent 5 uses `shared_jira/auth.py`. Token cached at `~/.jira-cache/jira-token.json` and silently refreshed for approximately 60 days.
95
+
96
+ ### Token Acquisition Sequence
97
+
98
+ ```
99
+ 1. Load ~/.jira-cache/jira-token.json
100
+ 2. Attempt silent token refresh → if valid, Bearer token returned (zero UI)
101
+ 3. If expired: browser opens once for Jira sign-in → token cached ~60 days
102
+ CI/CD: JIRA_CLIENT_ID + JIRA_CLIENT_SECRET + JIRA_CLOUD_ID → no browser
103
+ ```
104
+
105
+ ### Setup Steps
106
+
107
+ 1. Go to <https://developer.atlassian.com/console/myapps/> → Create → OAuth 2.0 integration
108
+ 2. Add callback URL: `http://localhost:8765/callback`
109
+ 3. Enable permissions: `read:jira-user`, `read:jira-work`, `write:jira-work`, `offline_access`
110
+ 4. Find your Cloud ID:
111
+ ```bash
112
+ curl https://api.atlassian.com/oauth/token/accessible-resources
113
+ ```
114
+ 5. Add to `.env`:
115
+ ```env
116
+ JIRA_CLIENT_ID=your-client-id
117
+ JIRA_CLIENT_SECRET=your-client-secret
118
+ JIRA_CLOUD_ID=your-cloud-id
119
+ ```
120
+
121
+ ---
122
+
123
+ ## Shared Pipeline — Agents 2–4
124
+
125
+ These agents are identical in both pipelines. See [ARCHITECTURE-ADO.md](ARCHITECTURE-ADO.md) for full detail on each. Key differences in the Jira context:
126
+
127
+ ### Agent 2 — `qa-gherkin-generator`
128
+
129
+ In the Jira pipeline, acceptance criteria are sourced from `fetch_jira_issue` or `fetch_jira_epic_hierarchy` rather than ADO API calls. The same 5-tool interface, Gherkin rules, and validation logic applies. Feature files can be saved locally or attached to the Jira issue — the agent asks explicitly rather than inferring.
130
+
131
+ ### Agent 3 — `qa-playwright-generator`
132
+
133
+ Identical in both pipelines. Requires `context_map` from Playwright MCP `browser_snapshot`. Hard-blocks if absent. Generates the same per-feature TypeScript files and the same shared infrastructure files (see ARCHITECTURE-ADO.md for the full breakdown — `LocatorHealer.ts`, `LocatorRepository.ts`, `TimingHealer.ts`, `VisualIntentChecker.ts`, `HealingDashboard.ts`, `dashboard-server.ts`, plus the BOILERPLATE-filled strategy / rules / apply layer). Code can be attached to the Jira issue or saved locally.
134
+
135
+ ### Agent 4 — `qa-helix-writer`
136
+
137
+ Identical in both pipelines. No ADO or Jira dependency. Writes files to the Helix-QA directory layout on disk. The `inspect_helix_project` tool verifies `LocatorHealer.ts` + `LocatorRepository.ts` exist; in a migrated tree these come from `stlc-migrate`'s enhanced scaffolds, not the BOILERPLATE versions.
138
+
139
+ ### Self-Healing Architecture
140
+
141
+ Refer to [ARCHITECTURE-ADO.md § Three-Layer Self-Healing Architecture](ARCHITECTURE-ADO.md#three-layer-self-healing-architecture) — the chain (cached → primary → attribute → type-hint → role → label → text → AI Vision), the post-match specific-selector introspection, and the HealingDashboard write-back-to-source behaviour are identical regardless of whether the test data originated in ADO or Jira.
142
+
143
+ ---
144
+
145
+ ## Pipeline Comparison: ADO vs Jira
146
+
147
+ | Aspect | Azure DevOps | Jira Cloud |
148
+ |---|---|---|
149
+ | Entry agent | `qa-test-case-manager` | `qa-jira-manager` |
150
+ | Work item fetch | ADO REST API | Jira REST API v3 |
151
+ | Test case storage | ADO Test Case work items | Jira issues of type `Test` or `Task` |
152
+ | Link type | `TestedBy-Forward` | `is tested by` / `Test` |
153
+ | Step format | `Microsoft.VSTS.TCM.Steps` XML | ADF table in issue description |
154
+ | Authentication | MSAL (`~/.msal-cache/`) | OAuth 2.0 3LO (`~/.jira-cache/`) |
155
+ | Epic support | Not supported — warn user | `fetch_jira_epic_hierarchy` |
156
+ | Gherkin delivery | `attach_gherkin_to_work_item` (ADO attachment) | Save locally or attach to Jira issue |
157
+ | Code delivery | `attach_code_to_work_item` (ADO attachment) | Save locally or attach to Jira issue |
158
+
159
+ ---
160
+
161
+ ## MCP Configuration
162
+
163
+ **VS Code / GitHub Copilot (`.vscode/mcp.json`):**
164
+
165
+ ```json
166
+ {
167
+ "servers": {
168
+ "qa-jira-manager": {
169
+ "command": "/path/.venv/bin/qa-jira-manager",
170
+ "env": {
171
+ "JIRA_CLIENT_ID": "${env:JIRA_CLIENT_ID}",
172
+ "JIRA_CLIENT_SECRET": "${env:JIRA_CLIENT_SECRET}",
173
+ "JIRA_CLOUD_ID": "${env:JIRA_CLOUD_ID}"
174
+ }
175
+ },
176
+ "qa-gherkin-generator": { "command": "/path/.venv/bin/qa-gherkin-generator" },
177
+ "qa-playwright-generator": { "command": "/path/.venv/bin/qa-playwright-generator" },
178
+ "qa-helix-writer": { "command": "/path/.venv/bin/qa-helix-writer" },
179
+ "qa-migration": { "command": "/path/.venv/bin/stlc-migrate" },
180
+ "playwright": { "type": "http", "url": "http://localhost:8931/mcp" }
181
+ }
182
+ }
183
+ ```
184
+
185
+ Use `qa-stlc mcp-config --vscode --integration jira` to generate this
186
+ manually, or let `stlc-migrate --integration jira` emit it automatically
187
+ as part of a migration.
188
+
189
+ ---
190
+
191
+ ## Migration (Existing Playwright project → Helix-QA, Jira variant)
192
+
193
+ ```bash
194
+ stlc-migrate --source ./my-old-tests --helix ./helix-qa --integration jira
195
+ ```
196
+
197
+ `--integration jira` installs only the Jira-relevant skills
198
+ (`qa-jira-manager`, plus the shared Gherkin / Playwright / Helix-writer /
199
+ deduplication / migrate-framework skills) and writes a `.mcp.json` whose
200
+ `qa-jira-manager` entry includes the `JIRA_CLIENT_ID` / `JIRA_CLIENT_SECRET`
201
+ / `JIRA_CLOUD_ID` env passthroughs above. Everything else (healer scaffold,
202
+ `.env.example`, BOILERPLATE fill, etc.) is identical to the ADO case — see
203
+ `skills/migrate-framework/SKILL.md` for the full pipeline reference.