@qa-gentic/stlc-agents 1.0.16 → 1.0.18

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 (45) hide show
  1. package/ORCHESTRATION_RULES.md +283 -0
  2. package/README.md +246 -321
  3. package/bin/postinstall.js +26 -2
  4. package/bin/qa-stlc.js +23 -0
  5. package/package.json +15 -2
  6. package/skills/write-helix-files/SKILL.md +6 -0
  7. package/src/cli/cmd-cost.js +253 -0
  8. package/src/cli/cmd-init.js +19 -2
  9. package/src/cli/cmd-mcp-config.js +123 -62
  10. package/src/cli/cmd-skills.js +21 -4
  11. package/src/stlc_agents/agent_gherkin_generator/server.py +88 -4
  12. package/src/stlc_agents/agent_helix_writer/tools/helix_write.py +60 -28
  13. package/src/stlc_agents/agent_jira_manager/server.py +209 -2
  14. package/src/stlc_agents/agent_jira_manager/tools/jira_workitem.py +36 -0
  15. package/src/stlc_agents/agent_playwright_generator/server.py +968 -105
  16. package/src/stlc_agents/agent_test_case_manager/server.py +121 -2
  17. package/src/stlc_agents/shared/cost_tracker.py +395 -0
  18. package/src/stlc_agents/shared/install_hook.py +154 -0
  19. package/src/stlc_agents/shared/pricing.py +72 -0
  20. package/src/stlc_agents/__pycache__/__init__.cpython-310.pyc +0 -0
  21. package/src/stlc_agents/agent_gherkin_generator/__pycache__/__init__.cpython-310.pyc +0 -0
  22. package/src/stlc_agents/agent_gherkin_generator/__pycache__/server.cpython-310.pyc +0 -0
  23. package/src/stlc_agents/agent_gherkin_generator/tools/__pycache__/__init__.cpython-310.pyc +0 -0
  24. package/src/stlc_agents/agent_gherkin_generator/tools/__pycache__/ado_gherkin.cpython-310.pyc +0 -0
  25. package/src/stlc_agents/agent_helix_writer/__pycache__/__init__.cpython-310.pyc +0 -0
  26. package/src/stlc_agents/agent_helix_writer/__pycache__/server.cpython-310.pyc +0 -0
  27. package/src/stlc_agents/agent_helix_writer/tools/__pycache__/__init__.cpython-310.pyc +0 -0
  28. package/src/stlc_agents/agent_helix_writer/tools/__pycache__/boilerplate.cpython-310.pyc +0 -0
  29. package/src/stlc_agents/agent_helix_writer/tools/__pycache__/helix_write.cpython-310.pyc +0 -0
  30. package/src/stlc_agents/agent_jira_manager/__pycache__/__init__.cpython-310.pyc +0 -0
  31. package/src/stlc_agents/agent_jira_manager/__pycache__/server.cpython-310.pyc +0 -0
  32. package/src/stlc_agents/agent_jira_manager/tools/__pycache__/__init__.cpython-310.pyc +0 -0
  33. package/src/stlc_agents/agent_jira_manager/tools/__pycache__/jira_workitem.cpython-310.pyc +0 -0
  34. package/src/stlc_agents/agent_playwright_generator/__pycache__/__init__.cpython-310.pyc +0 -0
  35. package/src/stlc_agents/agent_playwright_generator/__pycache__/server.cpython-310.pyc +0 -0
  36. package/src/stlc_agents/agent_playwright_generator/tools/__pycache__/__init__.cpython-310.pyc +0 -0
  37. package/src/stlc_agents/agent_playwright_generator/tools/__pycache__/ado_attach.cpython-310.pyc +0 -0
  38. package/src/stlc_agents/agent_test_case_manager/__pycache__/__init__.cpython-310.pyc +0 -0
  39. package/src/stlc_agents/agent_test_case_manager/__pycache__/server.cpython-310.pyc +0 -0
  40. package/src/stlc_agents/agent_test_case_manager/tools/__pycache__/__init__.cpython-310.pyc +0 -0
  41. package/src/stlc_agents/agent_test_case_manager/tools/__pycache__/ado_workitem.cpython-310.pyc +0 -0
  42. package/src/stlc_agents/shared/__pycache__/__init__.cpython-310.pyc +0 -0
  43. package/src/stlc_agents/shared/__pycache__/auth.cpython-310.pyc +0 -0
  44. package/src/stlc_agents/shared_jira/__pycache__/__init__.cpython-310.pyc +0 -0
  45. package/src/stlc_agents/shared_jira/__pycache__/auth.cpython-310.pyc +0 -0
@@ -0,0 +1,283 @@
1
+ # Orchestration Rules — Multi-Step Pipeline Agents
2
+
3
+ > **Universal rules file for coding agents (Claude, Copilot, Cursor, Windsurf, Gemini, etc.)**
4
+ > Place this file in your project root or `.ai/` folder. Reference it in your prompt with:
5
+ > `"Apply all rules from ORCHESTRATION_RULES.md before executing any step."`
6
+
7
+ ---
8
+
9
+ ## 1. Core Principle
10
+
11
+ Every intermediate output is an **input contract** for the next step — not a done state.
12
+ A step is only complete when its output has been validated against its spec and confirmed
13
+ fit for downstream consumption. Never proceed on a "good enough" assumption.
14
+
15
+ ---
16
+
17
+ ## 2. Mandatory Behaviours
18
+
19
+ ### 2.1 Explicit Task Breakdown
20
+
21
+ - Before executing, decompose the full task into named steps using a todo/task list tool
22
+ (e.g. `manage_todo_list`, GitHub Copilot Tasks, Cursor task panel).
23
+ - Each step must have a declared **input**, **action**, and **output spec**.
24
+ - Mark steps as `[ ] pending`, `[~] in-progress`, `[x] done`, `[!] blocked` — update in real time.
25
+ - Never treat a step as in-progress and done simultaneously.
26
+
27
+ ### 2.2 No Skipping Intermediate Steps
28
+
29
+ - If a step produces data that the next step consumes, that data must be:
30
+ 1. **Extracted** from raw output (not left embedded)
31
+ 2. **Structured** into the agreed schema
32
+ 3. **Validated** against the checkpoint gate
33
+ 4. **Explicitly handed off** as a named artefact
34
+ - Do NOT jump ahead assuming the downstream step can infer missing data.
35
+ - Do NOT proceed if a required input is absent or malformed.
36
+
37
+ ### 2.3 Checkpoint Gates Are Blocking — Pre-Flight Required
38
+
39
+ Gates are not a post-generation reflection. They run **before** output is produced.
40
+
41
+ **Before generating output for any step, you MUST:**
42
+ 1. Output the pre-flight checklist with your intended answers filled in.
43
+ 2. Only if all items are YES — proceed to generate the output.
44
+ 3. If any item is NO — stop, state what is missing, and wait for the user.
45
+
46
+ This is not optional. Generating output first and checking after is a rule violation.
47
+
48
+ Pre-flight format (required before every step):
49
+ ```
50
+ PRE-FLIGHT: Step [N] — [Step Name]
51
+ [ ] Input artefact "[name]" received from Step [N-1]?
52
+ [ ] Input matches expected schema?
53
+ [ ] [Step-specific countable check, e.g. "11 scenarios in scenario_inventory?"]
54
+ [ ] [Any tool or selector availability check]
55
+ → PROCEED / → BLOCKED: [state what is missing]
56
+ ```
57
+
58
+ ### 2.4 Data Handoff Must Be Explicit
59
+
60
+ - Output data in full — not summarised, not truncated.
61
+ - Use a consistent schema (JSON, YAML, or named list) — do not change shape between steps.
62
+ - Name the artefact (e.g. `context_map`, `test_case_list`, `scenario_inventory`).
63
+ - The receiving step must reference the artefact by name, not re-derive it.
64
+
65
+ ### 2.5 No Placeholder or Stub Outputs
66
+
67
+ This rule applies at generation time, not reflection time. The agent must not produce
68
+ stubs and then acknowledge the violation — it must prevent them before generating.
69
+
70
+ - Never produce output containing `TODO`, `placeholder`, `// implement later`,
71
+ `throw new Error('pending')`, or any empty method/step body.
72
+ - Before generating a file, state the **expected item count** (e.g. number of step
73
+ definitions, number of test cases). The generated file must match that count exactly.
74
+ - If a step cannot produce a complete output, declare it `[!] blocked` and stop.
75
+ - Partial outputs passed downstream cause compounding failures and wasted tokens.
76
+
77
+ **Countable verification pattern (required for code generation steps):**
78
+ ```
79
+ Expected: [N] step definitions (from scenario_inventory)
80
+ Generating: [N] step definitions
81
+ Verify after: count implemented bodies — must equal [N], zero empty
82
+ ```
83
+
84
+ ### 2.6 Query-Driven Data Capture (Snapshot / Scraping Steps)
85
+
86
+ - Navigation is NOT the deliverable — **structured data extraction** is.
87
+ - For every screen or page visited, immediately extract all required fields before moving on.
88
+ - Do not defer extraction to a later step.
89
+ - Capture only what downstream steps need (defined by the step's output spec).
90
+ - Validate coverage: every field required by downstream must be present in the captured data.
91
+
92
+ ### 2.7 Split Generation Steps to Prevent Silent Stubs
93
+
94
+ For any step that generates code or structured output consumed by a subsequent step,
95
+ split it into two sub-steps:
96
+
97
+ - **[N]a — Signatures only:** generate method/step signatures (names, parameters) with no bodies.
98
+ Output as an inventory list. This makes the expected count explicit and visible.
99
+ - **[N]b — Implement each signature:** implement every item from the [N]a inventory.
100
+ No body may be left empty. Reference `context_map` or equivalent for all selectors/data.
101
+
102
+ This forces a visible count before implementation begins, eliminating silent stub generation.
103
+
104
+ ### 2.8 Token Efficiency
105
+
106
+ - Avoid re-deriving data already produced in a prior step.
107
+ - Reference prior artefacts by name; do not re-fetch or re-generate unless a gate failed.
108
+ - If rework is needed, state which gate failed, what was missing, and what the corrected output is.
109
+
110
+ ---
111
+
112
+ ## 3. Error Handling
113
+
114
+ | Situation | Required Action |
115
+ |---|---|
116
+ | Gate fails | STOP. Report failed items. Wait for user input or resolution. |
117
+ | Required input missing | STOP. Name the missing input. Do not guess. |
118
+ | Tool call returns empty | STOP. Report. Do not silently continue. |
119
+ | Partial output produced | Mark step `[!] blocked`. Do not pass partial output downstream. |
120
+ | Schema mismatch | STOP. Show expected vs actual schema. Do not transform silently. |
121
+ | Ambiguous instruction | Ask one clarifying question before proceeding. Do not assume. |
122
+ | Stub/TODO found in output | STOP. Do not accept the output. Regenerate from signatures. |
123
+ | Count mismatch (generated vs expected) | STOP. List which items are missing. Do not proceed. |
124
+
125
+ ---
126
+
127
+ ## 4. Checkpoint Gate Template
128
+
129
+ Run this **before** generating output — not after.
130
+
131
+ ```
132
+ CHECKPOINT GATE [N] — [Step Name]
133
+ ---------------------------------------
134
+ PRE-FLIGHT (run before generating):
135
+ [ ] Input artefact received and named
136
+ [ ] Input matches expected schema
137
+ [ ] Expected output count stated: [N items]
138
+ [ ] All required tools/selectors available
139
+
140
+ POST-GENERATION (run before handing off):
141
+ [ ] Actual output count matches expected: [N of N]
142
+ [ ] No stubs, TODOs, or empty bodies in output
143
+ [ ] All items from upstream list are accounted for
144
+ [ ] Output is in agreed schema / format
145
+
146
+ RESULT: [ ] PASS — hand off artefact to Step [N+1]
147
+ [ ] FAIL — stop and report: [list what failed]
148
+ ```
149
+
150
+ ---
151
+
152
+ ## 5. Step Definition Template
153
+
154
+ ```
155
+ STEP [N] — [Name]
156
+ ---------------------------------------
157
+ Tool / Agent: [name of tool, MCP server, or agent]
158
+
159
+ Input (required):
160
+ - [Named artefact from Step N-1]
161
+ - [Any other required input]
162
+
163
+ Pre-flight check:
164
+ - State expected output count before generating
165
+ - Confirm all inputs available and schema-valid
166
+
167
+ Action:
168
+ [Precise description — not vague verbs like "process" or "handle"]
169
+ If code generation: split into [N]a (signatures) and [N]b (implementations)
170
+
171
+ Output spec (the contract):
172
+ - Artefact name: [e.g. context_map]
173
+ - Format: [JSON | YAML | list | file | etc.]
174
+ - Required fields: [enumerate them]
175
+ - Coverage requirement: [e.g. one implementation per Gherkin step]
176
+
177
+ Checkpoint Gate: → run Gate [N] template above
178
+ ```
179
+
180
+ ---
181
+
182
+ ## 6. Anti-Patterns (Never Do These)
183
+
184
+ | Anti-Pattern | Why It Fails | Correct Behaviour |
185
+ |---|---|---|
186
+ | Generating output then checking the gate | Gate runs after stubs already exist — violation acknowledged but not prevented | Run pre-flight checklist before generating |
187
+ | Treating gate as a reflection step | Agent notices violation after the fact; output is already committed | Gate is a pre-condition, not a review |
188
+ | Skipping data extraction after capture | Downstream step receives raw/unstructured input and must infer | Extract and structure data immediately after capture |
189
+ | Jumping to generation without verified inputs | Output based on inference, not facts — stubs and errors result | Validate inputs at gate before calling the generator |
190
+ | Treating "good enough" output as done | Errors compound; rework costs more tokens than doing it right | Validate against spec before marking a step complete |
191
+ | Producing stubs with TODO | Downstream steps receive incomplete contracts and silently fail | Block the step; declare it incomplete; stop |
192
+ | Re-deriving upstream data in a downstream step | Wasted tokens; divergence risk if re-derivation differs | Reference the named artefact from the prior step |
193
+ | Proceeding past a failed gate | Snowballing failures requiring full rework | Stop at the gate; surface the gap; wait for resolution |
194
+ | Single atomic generation step for code | No visible count before generation — stubs go undetected | Split into signatures ([N]a) then implementations ([N]b) |
195
+
196
+ ---
197
+
198
+ ## 7. Orchestration Health Checks
199
+
200
+ Run at the start of any multi-step task:
201
+
202
+ - [ ] Are all steps named and sequenced in the task list?
203
+ - [ ] Does each step have a declared input and output spec?
204
+ - [ ] Does each step have a defined pre-flight and post-generation gate?
205
+ - [ ] Are code generation steps split into signatures + implementations?
206
+ - [ ] Are all required tools / MCP servers available?
207
+ - [ ] Are named artefacts from prior steps available as inputs?
208
+
209
+ If any health check fails before execution begins, resolve it first.
210
+
211
+ ---
212
+
213
+ ## 8. Agent-Specific Integration Notes
214
+
215
+ ### Claude (claude.ai / API)
216
+ - Reference this file in your system prompt or project instructions.
217
+ - Use `manage_todo_list` for step tracking.
218
+ - Attach this file as a project document so it persists across sessions.
219
+ - Pre-flight checklists work reliably as Claude outputs reasoning before tool calls.
220
+
221
+ ### GitHub Copilot (VS Code / JetBrains)
222
+ - Add to `.github/copilot-instructions.md` or reference in your workspace prompt.
223
+ - **Critical:** Copilot treats rules as advisory context — gates are not enforced at runtime.
224
+ Mitigate by scoping rules to file types (e.g. `When generating *.steps.ts files, you must...`).
225
+ - Always include the pre-flight checklist directly in your chat message for the current step,
226
+ not just in the rules file. Copilot applies in-message instructions more reliably than
227
+ file-level rules for generation constraints.
228
+ - Use the countable verification pattern (section 2.5) explicitly in each chat prompt:
229
+ "There are 11 scenarios. Generate exactly 11 step definitions. State the count before writing."
230
+ - For step definition files: add a file-type-scoped rule to `.github/copilot-instructions.md`:
231
+ ```
232
+ When generating Playwright step definition files (*.steps.ts):
233
+ 1. Count Given/When/Then steps in the linked .feature file and state the count first.
234
+ 2. Every step body must contain real implementation — no TODO, no throw pending, no empty bodies.
235
+ 3. If a selector is missing from context_map, name the missing step and stop. Do not stub it.
236
+ ```
237
+
238
+ ### Cursor
239
+ - Place in `.cursor/rules/` as `orchestration.mdc` (set scope: `always`).
240
+ - Or add to `.cursorrules` in the project root.
241
+ - Cursor applies project-level rules more consistently than Copilot for generation steps.
242
+ - Use `@file` references in chat to explicitly pull the rules into context per step.
243
+
244
+ ### Windsurf (Codeium)
245
+ - Place in `.windsurf/rules.md` or reference in the global rules panel.
246
+ - Windsurf's Cascade agent picks up project-level markdown rules automatically.
247
+
248
+ ### Gemini CLI / Vertex AI Agent Builder
249
+ - Reference via system instruction or as a grounding document.
250
+ - Use the Step Definition Template when constructing task configs.
251
+
252
+ ---
253
+
254
+ ## 9. Quick Reference Card
255
+
256
+ ```
257
+ BEFORE EACH STEP:
258
+ 1. Output the pre-flight checklist — fill in all items.
259
+ 2. If all YES → state expected output count → generate.
260
+ 3. If any NO → stop and report.
261
+
262
+ AFTER EACH STEP:
263
+ 1. Run post-generation gate — count actual vs expected.
264
+ 2. If PASS → hand off named artefact to next step.
265
+ 3. If FAIL → stop, report, regenerate.
266
+
267
+ FOR CODE GENERATION:
268
+ 1. Generate signatures/names only first ([N]a).
269
+ 2. State the count from [N]a.
270
+ 3. Implement every item ([N]b) — zero empty bodies allowed.
271
+
272
+ NEVER:
273
+ - Generate output then check the gate.
274
+ - Proceed past a failed gate.
275
+ - Pass unstructured or partial data downstream.
276
+ - Produce stubs and acknowledge them — prevent them.
277
+ ```
278
+
279
+ ---
280
+
281
+ *Version 1.1 — Updated to add pre-flight gate enforcement, countable verification,
282
+ split generation step pattern, and Copilot-specific stub prevention guidance.
283
+ Root cause addressed: gates were post-generation reflections, not pre-generation blockers.*