@xera-ai/skills 0.1.0

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 ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "@xera-ai/skills",
3
+ "version": "0.1.0",
4
+ "files": ["*.md", "version.json"]
5
+ }
package/version.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "skills": "0.1.0",
3
+ "compatible_prompts": "^1.0.0",
4
+ "skill_files": [
5
+ "xera-run.md",
6
+ "xera-fetch.md",
7
+ "xera-feature.md",
8
+ "xera-script.md",
9
+ "xera-exec.md",
10
+ "xera-report.md",
11
+ "xera-promote.md"
12
+ ]
13
+ }
package/xera-exec.md ADDED
@@ -0,0 +1,18 @@
1
+ ---
2
+ name: xera-exec
3
+ description: Run the Playwright test for a ticket. Refreshes auth state automatically. Use when QA wants to execute an existing spec without regenerating.
4
+ ---
5
+
6
+ The user invoked `/xera-exec <TICKET>`. If no key, ask.
7
+
8
+ 1. Verify `.xera/{{TICKET}}/spec.ts` exists. If not: "Generate the spec first with `/xera-script {{TICKET}}`." STOP.
9
+
10
+ 2. Run: `bun run xera:exec {{TICKET}}`
11
+ - Exit 0 → all scenarios passed.
12
+ - Exit 1 → user/config error (lock held, missing env var). Show the error verbatim and STOP.
13
+ - Exit 3 → test failure. This is expected; continue.
14
+ - Exit 4 → infra error (Playwright crashed). Show stderr; STOP.
15
+
16
+ 3. Read the latest run directory: `.xera/{{TICKET}}/runs/<latest>/`. Tell the user the runId.
17
+
18
+ 4. Suggest: "Diagnose this run with `/xera-report {{TICKET}}`."
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: xera-feature
3
+ description: Generate or regenerate the Gherkin test.feature file for a Jira ticket. Use when QA wants AI to produce Gherkin scenarios from the fetched user story.
4
+ ---
5
+
6
+ You are running inside a project repo configured for xera. The user has invoked `/xera-feature <TICKET>`.
7
+
8
+ If no ticket key was given, ask for one.
9
+
10
+ 1. Verify `.xera/{{TICKET}}/story.md` exists. If not, say: "No story.md yet. Run `/xera-fetch {{TICKET}}` first." STOP.
11
+
12
+ 2. Read `.xera/{{TICKET}}/meta.json`:
13
+ - If `feature_generated_from_story_hash === story_hash` AND `.xera/{{TICKET}}/test.feature` exists, the feature is current. Ask the user: "test.feature is up-to-date with the current story. Regenerate anyway? (y/N)". If no, STOP and tell user nothing to do.
14
+ - If `story_hash` differs (story drift), say so: "Story has changed since the last feature was generated. Regenerating."
15
+
16
+ 3. Read the prompt template from `node_modules/@xera-ai/prompts/feature-from-story.md`. Follow its hard rules.
17
+
18
+ 4. Read `.xera/{{TICKET}}/story.md` and write `.xera/{{TICKET}}/test.feature` following the prompt. Do NOT include any text outside the Gherkin file body.
19
+
20
+ 5. Run: `bun run xera:validate-feature {{TICKET}}`
21
+ - Exit 0 → success.
22
+ - Exit 2 → parse error. Read the line/message, rewrite test.feature to fix it, re-run. Try at most 2 retries. If still failing, show the user the parser output and stop.
23
+
24
+ 6. Update `.xera/{{TICKET}}/meta.json`:
25
+ - `feature_generated_at` = now (ISO)
26
+ - `feature_generated_from_story_hash` = the current `story_hash`
27
+ - `feature_hash` = sha256 of the file contents (the skill will compute by reading the file and using the same hashing scheme as `xera-internal`; just record `feature_generated_at` and let `xera:fetch`-style helpers re-hash as needed).
28
+
29
+ 7. Summarize to the user: number of scenarios, list of scenario names. Suggest: "Generate Playwright spec? `/xera-script {{TICKET}}`."
package/xera-fetch.md ADDED
@@ -0,0 +1,35 @@
1
+ ---
2
+ name: xera-fetch
3
+ description: Fetch a Jira ticket and write its user story to .xera/<TICKET>/story.md. Use when QA wants to start working on a ticket without yet generating tests.
4
+ ---
5
+
6
+ You are running inside a project repo configured for xera. The user has invoked `/xera-fetch <TICKET>`.
7
+
8
+ If the user did not provide a ticket key, ask: "Which Jira ticket key?" and wait. The key must look like `PROJ-123`.
9
+
10
+ 1. Check whether `.xera/{{TICKET}}/story.md` already exists.
11
+ - If yes, read its first line to confirm the ticket key matches.
12
+ - If the file exists and the user did not explicitly ask to re-fetch, ask: "story.md exists for {{TICKET}}. Re-fetch from Jira and overwrite? (y/N)". Default to no.
13
+
14
+ 2. Detect Jira backend:
15
+ - If an Atlassian MCP tool is available in this session (a tool whose name starts with `mcp__atlassian__` or `mcp__plugin_engineering_atlassian__`), use it:
16
+ a. Call `getJiraIssue` (or equivalent) with the ticket key.
17
+ b. Map the response into the shape `xera-internal fetch` expects: `{ key, summary, story, acceptanceCriteria?, attachments, raw }`.
18
+ - `story` is the value of the field named in `xera.config.ts.jira.fields.story`.
19
+ - `acceptanceCriteria` is the value of `jira.fields.acceptanceCriteria` if set.
20
+ - `attachments` is the array of attachments, each mapped to `{ filename, url }`.
21
+ c. Write that object as JSON to a temp file at `$TMPDIR/xera-mcp/{{TICKET}}.json` (create the dir if missing).
22
+ d. Set the environment variable `XERA_MCP_JIRA=1` for the next subprocess call.
23
+ - Else: use the REST backend implicitly via `JIRA_EMAIL` + `JIRA_API_TOKEN` from `.env`.
24
+
25
+ 3. Run: `bun run xera:fetch {{TICKET}}`
26
+ - Exit 0 → continue.
27
+ - Exit 1 → user/config error. Read stderr, show the user the fix instructions, STOP.
28
+ - Exit 4 → infra error. Show error, STOP.
29
+
30
+ 4. Read `.xera/{{TICKET}}/story.md` and `.xera/{{TICKET}}/meta.json`. Summarize to the user:
31
+ - Ticket key, summary
32
+ - First 200 chars of story
33
+ - Whether AC was found in a separate field
34
+
35
+ 5. Suggest next step: "Generate Gherkin? Run `/xera-feature {{TICKET}}` or run the full pipeline with `/xera-run {{TICKET}}`."
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: xera-promote
3
+ description: Promote a Page Object Model from a single ticket's .xera/<TICKET>/page-objects/ to shared/page-objects/ so other tests can reuse it. Use when QA notices a POM is generally useful.
4
+ ---
5
+
6
+ The user invoked `/xera-promote <TICKET> <PomClassName>`.
7
+
8
+ 1. Verify `.xera/<TICKET>/page-objects/<PomClassName>.ts` exists. If not, list available POMs in that directory and ask the user to pick.
9
+
10
+ 2. Check `shared/page-objects/<PomClassName>.ts`:
11
+ - If it does NOT exist → safe to promote.
12
+ - If it exists with identical content → just delete the ticket-local copy and update the import (run `bun run xera:promote {{TICKET}} {{POM}}` will refuse; manually delete with the user's confirmation).
13
+ - If it exists with different content → STOP. Show a unified diff. Ask the user to reconcile manually.
14
+
15
+ 3. Run: `bun run xera:promote {{TICKET}} {{POM}}`
16
+ - This moves the file and rewrites the import in `.xera/{{TICKET}}/spec.ts`.
17
+
18
+ 4. Run `bun run xera:typecheck {{TICKET}}` to confirm nothing broke. If errors, surface them.
19
+
20
+ 5. Suggest the user commit the changes:
21
+ ```
22
+ git add shared/page-objects/{{POM}}.ts .xera/{{TICKET}}/
23
+ git commit -m "tests: promote {{POM}} from {{TICKET}}"
24
+ ```
package/xera-report.md ADDED
@@ -0,0 +1,31 @@
1
+ ---
2
+ name: xera-report
3
+ description: Classify the latest run, draft a Jira comment, and post it. Use after `/xera-exec` when QA wants the diagnosis and Jira update.
4
+ ---
5
+
6
+ The user invoked `/xera-report <TICKET>`. If no key, ask.
7
+
8
+ 1. Verify `.xera/{{TICKET}}/runs/` has at least one run directory. If not: "Run the test first with `/xera-exec {{TICKET}}`." STOP.
9
+
10
+ 2. Run: `bun run xera:normalize {{TICKET}}`
11
+ - Exit 0 → continue.
12
+ - Otherwise show stderr, STOP.
13
+
14
+ 3. Read the latest `.xera/{{TICKET}}/runs/<latest>/normalized.json`. Also read:
15
+ - `.xera/{{TICKET}}/test.feature`
16
+ - `.xera/{{TICKET}}/story.md`
17
+ - `.xera/{{TICKET}}/spec.ts`
18
+ - `.xera/{{TICKET}}/status.json` (may not exist on first run)
19
+ - `.xera/{{TICKET}}/meta.json`
20
+
21
+ 4. Read `node_modules/@xera-ai/prompts/diagnose-failure.md`. Follow its decision algorithm. Produce `classifier-input.json` matching the exact shape described. Save to `.xera/{{TICKET}}/classifier-input.json`.
22
+
23
+ 5. Run: `bun run xera:report {{TICKET}} -- --input=.xera/{{TICKET}}/classifier-input.json`
24
+
25
+ 6. Read the drafted Jira comment at `.xera/{{TICKET}}/jira-comment.draft.md`. Show it to the user. Ask: "Post to Jira? (Y/n)"
26
+
27
+ 7. If yes:
28
+ - If Atlassian MCP is available, use `addCommentToJiraIssue` with the draft as the body. Capture the comment id.
29
+ - Else: run `bun run xera:post {{TICKET}}` (will use REST creds from .env).
30
+
31
+ 8. Summarize result and link to the Jira comment (if MCP returned a URL).
package/xera-run.md ADDED
@@ -0,0 +1,43 @@
1
+ ---
2
+ name: xera-run
3
+ description: Run the full xera pipeline for a Jira ticket end-to-end — fetch story, generate Gherkin, generate Playwright spec, execute, diagnose, post to Jira. Use when QA wants to test a ticket from scratch.
4
+ ---
5
+
6
+ The user invoked `/xera-run <TICKET>`. If no key, ask.
7
+
8
+ This skill orchestrates the other six skills with quality gates between each step. If any step fails non-recoverably, STOP and surface the cause.
9
+
10
+ ## Step 0 — Health gate
11
+
12
+ Run: `bunx xera doctor --strict {{TICKET}}`
13
+ If non-zero exit → STOP. Show the output verbatim. Suggest the user fix env and re-run.
14
+
15
+ ## Step 1 — Fetch
16
+
17
+ Follow the same instructions as `xera-fetch.md`, but never prompt the user about re-fetching here — just proceed unless story.md already exists and meta.json shows a `story_hash` < 24 hours old (then skip fetch).
18
+
19
+ If meta is missing or story_hash is older, refresh.
20
+
21
+ ## Step 2 — Feature
22
+
23
+ Follow `xera-feature.md`. If `feature_generated_from_story_hash !== story_hash`, regenerate. If unchanged AND spec.ts exists, skip feature generation entirely.
24
+
25
+ ## Step 3 — Script
26
+
27
+ Follow `xera-script.md`. If `script_generated_from_feature_hash !== feature_hash`, regenerate. Else skip.
28
+
29
+ ## Step 4 — Exec
30
+
31
+ Run `bun run xera:exec {{TICKET}}`.
32
+
33
+ ## Step 5 — Normalize
34
+
35
+ Run `bun run xera:normalize {{TICKET}}`.
36
+
37
+ ## Step 6 — Diagnose + report + post
38
+
39
+ Follow `xera-report.md` from step 3 onwards. If the user is the SAMPLE-001 ticket (meta.source === "local"), do NOT post to Jira and do NOT prompt about posting — only print the drafted comment.
40
+
41
+ ## Step 7 — Summary
42
+
43
+ Print a single-paragraph summary covering: overall result, classification, per-scenario counts, link to Jira comment (if posted), and the reproduce command (`bunx xera-internal exec {{TICKET}} --replay=<runId>`).
package/xera-script.md ADDED
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: xera-script
3
+ description: Generate the Playwright spec.ts and any new Page Objects for a ticket from its Gherkin feature. Use when QA wants AI to produce test code from the agreed-on Gherkin.
4
+ ---
5
+
6
+ The user invoked `/xera-script <TICKET>`. If no key, ask.
7
+
8
+ 1. Verify `.xera/{{TICKET}}/test.feature` exists. Otherwise say "Generate Gherkin first with `/xera-feature {{TICKET}}`." STOP.
9
+
10
+ 2. Read `.xera/{{TICKET}}/meta.json`:
11
+ - If `script_generated_from_feature_hash === feature_hash` AND `.xera/{{TICKET}}/spec.ts` exists, ask "spec.ts is up-to-date. Regenerate? (y/N)". Default no.
12
+
13
+ 3. List existing shared POMs by reading `shared/page-objects/` (every `.ts` file, parse exported class names). Pass this list to yourself as context for reuse decisions.
14
+
15
+ 4. Read `node_modules/@xera-ai/prompts/script-from-feature.md`. Follow its hard rules.
16
+
17
+ 5. Read `.xera/{{TICKET}}/test.feature` and `.xera/{{TICKET}}/story.md`. Generate:
18
+ - `.xera/{{TICKET}}/spec.ts`
19
+ - `.xera/{{TICKET}}/page-objects/<ClassName>.ts` for each new POM
20
+ Do not modify anything under `shared/`.
21
+
22
+ 6. Run quality gates:
23
+ - `bun run xera:typecheck {{TICKET}}` — if exit 2, read errors, fix in the generated files, retry up to 2 times.
24
+ - `bun run xera:lint {{TICKET}}` — same retry policy. If a CSS selector is truly necessary, add `// xera-allow-css: <reason>` on the line above it.
25
+
26
+ 7. Update meta.json: `script_generated_at`, `script_generated_from_feature_hash`.
27
+
28
+ 8. Summarize: list of files written, count of new POMs, mention any POM that *looked* reusable but didn't quite fit (suggest the user might want `/xera-promote` later).
29
+ Suggest: "Run the test now with `/xera-exec {{TICKET}}`, or do the whole pipeline with `/xera-run {{TICKET}}`."