@xera-ai/skills 0.4.0 → 0.4.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xera-ai/skills",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "files": [
5
5
  "*.md",
6
6
  "version.json"
package/version.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
- "skills": "0.4.0",
3
- "compatible_prompts": "^2.2.0",
2
+ "skills": "0.4.2",
3
+ "compatible_prompts": "^2.3.0",
4
4
  "skill_files": [
5
5
  "xera-run.md",
6
6
  "xera-fetch.md",
@@ -8,6 +8,7 @@
8
8
  "xera-script.md",
9
9
  "xera-exec.md",
10
10
  "xera-report.md",
11
- "xera-promote.md"
11
+ "xera-promote.md",
12
+ "xera-impact.md"
12
13
  ]
13
14
  }
package/xera-impact.md ADDED
@@ -0,0 +1,82 @@
1
+ ---
2
+ name: xera-impact
3
+ description: Pre-flight impact analysis. Given a ticket, identify scenarios that may be affected by its changes (graph-walk via project knowledge graph), then optionally re-run them. Use before merging or when AC has just changed for a ticket. Available v0.6.2+.
4
+ ---
5
+
6
+ The user invoked `/xera-impact <TICKET> [--depth 1|2|3] [--min-priority p0|p1|p2]`. If no key, ask.
7
+
8
+ This skill walks the project knowledge graph (`.xera/graph/`) to find scenarios that depend on the modified areas of `<TICKET>`. It does NOT re-fetch or re-script — it's strictly a query + optional re-execution.
9
+
10
+ ## Step 1 — Verify graph snapshot is fresh
11
+
12
+ Run:
13
+
14
+ ```bash
15
+ bun run xera:graph-snapshot --check
16
+ ```
17
+
18
+ If stale, the subcommand auto-rebuilds. If `<TICKET>` is not in the graph, this step will succeed but Step 2 will exit with code 2 — that means you must run `/xera-fetch {{TICKET}}` first.
19
+
20
+ ## Step 2 — Compute impact
21
+
22
+ Run:
23
+
24
+ ```bash
25
+ bun run xera:impact-prepare {{TICKET}} [--depth N] [--min-priority P]
26
+ ```
27
+
28
+ Pass through any flags the user provided. On exit code 2, surface: *"Ticket {{TICKET}} not in graph — run `/xera-fetch {{TICKET}}` first"* and STOP.
29
+
30
+ The subcommand writes:
31
+ - `.xera/impact/{{TICKET}}.json` (machine-readable)
32
+ - `.xera/impact/{{TICKET}}.md` (human-readable)
33
+
34
+ ## Step 3 — Display summary
35
+
36
+ Read `.xera/impact/{{TICKET}}.json`. If `scenarios.length === 0`, show:
37
+
38
+ ```
39
+ Impact analysis for {{TICKET}} → no prior scenarios in modified areas
40
+ (this is normal for new feature areas; nothing to re-run)
41
+ ```
42
+
43
+ And STOP.
44
+
45
+ Otherwise, count scenarios in 3 score buckets (high ≥7.0, medium ≥4.0, low <4.0). Display:
46
+
47
+ ```
48
+ Impact analysis for {{TICKET}} → .xera/impact/{{TICKET}}.md
49
+
50
+ N scenarios impacted (H high · M medium · L low)
51
+
52
+ Top 3:
53
+ <ticketId> / "<name>" [Pn] <score> <edge-summary>
54
+ ...
55
+ ```
56
+
57
+ ## Step 4 — Prompt re-run
58
+
59
+ Ask the user: `Re-run impacted scenarios? [Y]es / [p] P0 only / [s]elect / [n]o`
60
+
61
+ - **[n]:** STOP. The user can inspect `.xera/impact/{{TICKET}}.md` separately.
62
+
63
+ - **[Y]:** Group impacted scenarios by their owner ticket (`scenario.ticketId`). For each owner ticket, invoke `bun run xera:exec <owner-ticket>` (the existing exec subcommand). Collect the `RUN_ID` from each. Note: this re-runs the ENTIRE spec for each impacted owner, not just the impacted scenarios — Playwright doesn't natively support per-test selection from a json list without test-name regex. Acceptable for v0.6.2; precise per-scenario selection is a v0.6.x patch.
64
+
65
+ - **[p]:** Filter `scenarios` array to `priority === 'p0'` only, then proceed as [Y].
66
+
67
+ - **[s]:** Show numbered list with checkboxes; let the user pick. Then proceed as [Y] with the selected subset.
68
+
69
+ ## Step 5 — Recommend follow-up
70
+
71
+ After exec runs complete, recommend:
72
+
73
+ ```
74
+ {{N}} owner tickets re-run. Run `/xera-report {{TICKET}}` next to classify failures
75
+ (TEST_OUTDATED detection will flag failures caused by THIS ticket's AC change).
76
+ ```
77
+
78
+ ## Edge cases
79
+
80
+ - If `xera:impact-prepare` exits non-zero for any reason other than 2 (e.g. graph corrupted), surface the stderr and STOP.
81
+ - If a re-run via `xera:exec` fails non-recoverably, continue with remaining tickets but note the failure in the final summary.
82
+ - Respect `xera.config.run.autoImpact.enabled = false` — skip this skill if invoked recursively from `/xera-run` and config disables it.
package/xera-report.md CHANGED
@@ -50,8 +50,38 @@ Step 4 below is *cognitive work that YOU, the session, must do*. It is not a she
50
50
 
51
51
  **Do not skip this step.** If you find yourself about to call `bun run xera:report` without having written this file, stop and write the file first.
52
52
 
53
+ ## Step 4b — TEST_OUTDATED pre-check (v0.6.1)
54
+
55
+ For every scenario in `classifier-input.json` whose `outcome === "FAIL"`:
56
+
57
+ 1. Compute `scenarioId = sha1(<TICKET> + ":" + normalize(scenario.name))` (lowercase, single-spaced).
58
+ 2. Query the graph: `bun run xera:graph-query --ticket <TICKET> --format json | jq '.edges[] | select(.kind == "modifies") | select(.discoveredAt > <scenario.generatedAt>)'`.
59
+ 3. If there are 0 candidates → skip this scenario, no LLM call needed.
60
+ 4. If there are ≥1 candidates → run the `classify-outdated.md` prompt (located at `packages/prompts/classify-outdated.md`):
61
+ - Inputs: scenario gherkin + original AC, candidate tickets' AC, failure expected/actual from trace.
62
+ - Wrap untrusted ticket text using the v0.3 untrusted-input preamble pattern (boundary tags + refusal label).
63
+ - Output: JSON `{ classification, confidence, evidence }` per the prompt schema.
64
+ 5. Aggregate all decisions into `.xera/<TICKET>/runs/<RUN_ID>/outdated-decisions.json` keyed by `scenarioId`.
65
+
66
+ **If lazy similarity is needed** (a candidate ticket exists but has no `similar` edges and is hot for many scenarios), first run:
67
+
68
+ ```bash
69
+ bun run xera:graph-enrich --ticket <CANDIDATE>
70
+ ```
71
+
72
+ This populates `similar` edges so future graph queries are richer. Skip if not needed.
73
+
53
74
  4a. **Heal sub-flow (only if SELECTOR_DRIFT present).** If the user passed `--no-heal` in the invocation, skip this entire sub-flow and proceed directly to step 5.
54
75
 
76
+ **v0.6.1 update:** Before invoking heal, check whether the scenario's failure was classified as TEST_OUTDATED. Read `.xera/{{TICKET}}/runs/{{RUN_ID}}/outdated-decisions.json` (written at step 4b, available in the current session). If the scenario's entry has `classification === 'TEST_OUTDATED'` and `confidence >= 0.7`, **SKIP heal** and instead instruct the user to regenerate the scenario from the candidate ticket's new AC:
77
+
78
+ ```bash
79
+ # Example:
80
+ bun run xera:script <ORIGINAL_TICKET> --refresh-from <CANDIDATE_TICKET>
81
+ ```
82
+
83
+ Heal is for selector drift (DOM moved); TEST_OUTDATED requires a scenario rewrite, not a heal.
84
+
55
85
  Otherwise: read `.xera/{{TICKET}}/classifier-input.json` (which you just wrote in step 4) and check whether any scenario has `class: "SELECTOR_DRIFT"`. If none, skip this entire sub-flow and proceed directly to step 5 (Aggregate + draft).
56
86
 
57
87
  If at least one scenario is SELECTOR_DRIFT, take the FIRST such scenario (by array order — the single-heal guard) and execute Phases A–C below. Subsequent SELECTOR_DRIFT scenarios are NOT auto-healed in the same `/xera-report` invocation; list them in the report output as "additional drifts: re-run /xera-report after applying the first heal."
@@ -118,8 +148,13 @@ If at least one scenario is SELECTOR_DRIFT, take the FIRST such scenario (by arr
118
148
 
119
149
  After the heal sub-flow finishes (whether it applied, refused, or errored), continue to step 5 below to aggregate + draft the report. The Jira comment in step 5 reflects the run as it was originally classified — heal results are a separate concern not (in v0.5) folded into the Jira comment.
120
150
 
121
- 5. **Aggregate + draft.** Run: `bun run xera:report {{TICKET}} -- --input=.xera/{{TICKET}}/classifier-input.json`
122
- This CLI: aggregates per-scenario classifications into an overall verdict, updates `status.json` with history, and writes `jira-comment.draft.md`. If exit code is non-zero, surface the error to the user; do not proceed to post.
151
+ 5. **Aggregate + draft.** Now invoke the existing `xera:report` flow as before:
152
+
153
+ ```bash
154
+ bun run xera:report {{TICKET}} --input=.xera/{{TICKET}}/classifier-input.json
155
+ ```
156
+
157
+ The `xera:report` subcommand reads `outdated-decisions.json` (if present) and may upgrade scenario classifications to `TEST_OUTDATED`. It aggregates per-scenario classifications into an overall verdict, updates `status.json` with history, and writes `jira-comment.draft.md`. If exit code is non-zero, surface the error to the user; do not proceed to post.
123
158
 
124
159
  6. **Show the draft.** Read `.xera/{{TICKET}}/jira-comment.draft.md`. Display its content to the user verbatim. Ask: "Post to Jira? (Y/n)" (default: Y, unless `meta.json.source === "local"` for SAMPLE tickets — then never post).
125
160
 
@@ -136,3 +171,54 @@ bun run xera:graph-record classify <TICKET> --run-id <RUN_ID>
136
171
  ```
137
172
 
138
173
  Non-fatal. Note: TEST_OUTDATED detection ships in v0.6.1 — for v0.6.0 this just emits `run.classified` events with existing 4-bucket classifications.
174
+
175
+ ## Step 10 — Notify ticket owner when TEST_OUTDATED detected (v0.6.1)
176
+
177
+ For every scenario classified as `TEST_OUTDATED` in `outdated-decisions.json`, find the **original ticket** that owns the scenario (from graph: `xera:graph-query --ticket <SCENARIO_OWNER_TICKET> --format json`). Then post a Jira sub-task on that ticket via the existing Jira backend (the same code path `/xera-fetch` uses to read tickets — re-use the configured backend per `xera.config.ts.jira`):
178
+
179
+ Body template:
180
+
181
+ ```
182
+ Test for this ticket may be outdated due to changes introduced by <CURRENT_TICKET>. Confidence: <conf>. Run `xera:script <ORIGINAL_TICKET> --refresh-from <CURRENT_TICKET>` to regenerate the test from the new AC.
183
+ ```
184
+
185
+ Tag the original ticket's assignee. This routes the signal to the right person, not the current QA running this report.
186
+
187
+ In the current QA's session, only show a summary line:
188
+ ```
189
+ 3 impact tickets notified (ABC-100, ABC-145, ABC-178). No action required from you.
190
+ ```
191
+
192
+ **Config:** Respects `xera.config.report.testOutdatedNotify`:
193
+ - `'jira-subtask'` (default) — post sub-task as above
194
+ - `'comment'` — post comment instead
195
+ - `'console-only'` — only print to terminal, no Jira write
196
+
197
+ ## Step 11 — Dispute capture (v0.6.1, optional)
198
+
199
+ After classification is displayed to the user, if any scenario has classification `TEST_OUTDATED` or `REAL_BUG`, prompt the user:
200
+
201
+ ```
202
+ Agree with classifications above? [Y]es / [d]ispute
203
+ ```
204
+
205
+ If the user picks `d`, prompt:
206
+ ```
207
+ Which scenario? [N]
208
+ What classification do you think it should be? (REAL_BUG / TEST_BUG / SELECTOR_DRIFT / FLAKY / TEST_OUTDATED)
209
+ Reason (optional, single line):
210
+ ```
211
+
212
+ Then emit a dispute event:
213
+
214
+ ```bash
215
+ bun run xera:graph-record dispute \
216
+ --run-id <RUN_ID> \
217
+ --scenario-id <SCENARIO_ID> \
218
+ --from <ORIGINAL_CLASSIFICATION> \
219
+ --to <DISPUTED_CLASSIFICATION> \
220
+ --actor "$(git config user.email)" \
221
+ --reason "<REASON>"
222
+ ```
223
+
224
+ Non-fatal: if it fails, log warning and continue. Dispute events are captured for v0.7+ classifier learning; v0.6.1 does not change classifier behavior based on disputes.
package/xera-run.md CHANGED
@@ -18,6 +18,35 @@ Follow the same instructions as `xera-fetch.md`, but never prompt the user about
18
18
 
19
19
  If meta is missing or story_hash is older, refresh.
20
20
 
21
+ ## Step 1.5 — Auto-trigger impact analysis (v0.6.2)
22
+
23
+ After `/xera-fetch` completes, check whether this ticket modifies areas that other tests depend on.
24
+
25
+ Read `xera.config.run.autoImpact` (defaults: `{ enabled: true, threshold: 6.0 }`). If `enabled === false`, SKIP this step.
26
+
27
+ Run:
28
+
29
+ ```bash
30
+ bun run xera:impact-prepare {{TICKET}} --quiet
31
+ ```
32
+
33
+ This writes `.xera/impact/{{TICKET}}.json` (no markdown). Exit code 2 means the ticket is not yet in graph — surface a warning and proceed (graph data only accumulates over time).
34
+
35
+ Read the JSON. Count scenarios with `riskScore >= autoImpact.threshold`. If 0, no prompt — continue silently to Step 2.
36
+
37
+ If ≥1 high-risk scenario, prompt the user:
38
+
39
+ ```
40
+ {{N}} high-risk impacted scenarios detected for {{TICKET}}.
41
+ Re-run them before generating the new script? [Y/n/details]
42
+ ```
43
+
44
+ - **[Y]:** Iterate `bun run xera:exec <owner-ticket>` for each unique owner ticket. After each, check status; if all pass, continue to Step 2. If any fail, surface the failure and STOP — the user should diagnose existing-test breakage before introducing more changes.
45
+ - **[n]:** Continue to Step 2.
46
+ - **[details]:** Suggest the user run `/xera-impact {{TICKET}}` interactively for full details, then ask again.
47
+
48
+ Non-fatal: if `xera:impact-prepare` itself exits abnormally, log the warning but continue to Step 2 — graph features are advisory, not gating.
49
+
21
50
  ## Step 2 — Feature
22
51
 
23
52
  Follow `xera-feature.md`. If `feature_generated_from_story_hash !== story_hash`, regenerate. If unchanged AND spec.ts exists, skip feature generation entirely.