@sun-asterisk/sungen 2.6.12 → 2.6.15
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/dist/cli/commands/delivery.d.ts.map +1 -1
- package/dist/cli/commands/delivery.js +215 -65
- package/dist/cli/commands/delivery.js.map +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/dashboard/snapshot-builder.d.ts.map +1 -1
- package/dist/dashboard/snapshot-builder.js +173 -32
- package/dist/dashboard/snapshot-builder.js.map +1 -1
- package/dist/dashboard/templates/index.html +84 -84
- package/dist/dashboard/types.d.ts +35 -0
- package/dist/dashboard/types.d.ts.map +1 -1
- package/dist/exporters/csv-exporter.d.ts +24 -3
- package/dist/exporters/csv-exporter.d.ts.map +1 -1
- package/dist/exporters/csv-exporter.js +28 -7
- package/dist/exporters/csv-exporter.js.map +1 -1
- package/dist/exporters/json-exporter.d.ts +15 -0
- package/dist/exporters/json-exporter.d.ts.map +1 -1
- package/dist/exporters/json-exporter.js +7 -2
- package/dist/exporters/json-exporter.js.map +1 -1
- package/dist/exporters/playwright-report-parser.d.ts +7 -0
- package/dist/exporters/playwright-report-parser.d.ts.map +1 -1
- package/dist/exporters/playwright-report-parser.js +20 -0
- package/dist/exporters/playwright-report-parser.js.map +1 -1
- package/dist/exporters/selector-key-resolver.d.ts +55 -0
- package/dist/exporters/selector-key-resolver.d.ts.map +1 -0
- package/dist/exporters/selector-key-resolver.js +208 -0
- package/dist/exporters/selector-key-resolver.js.map +1 -0
- package/dist/exporters/test-data-resolver.d.ts +15 -2
- package/dist/exporters/test-data-resolver.d.ts.map +1 -1
- package/dist/exporters/test-data-resolver.js +61 -8
- package/dist/exporters/test-data-resolver.js.map +1 -1
- package/dist/exporters/types.d.ts +1 -0
- package/dist/exporters/types.d.ts.map +1 -1
- package/dist/exporters/xlsx-exporter.d.ts +28 -3
- package/dist/exporters/xlsx-exporter.d.ts.map +1 -1
- package/dist/exporters/xlsx-exporter.js +34 -6
- package/dist/exporters/xlsx-exporter.js.map +1 -1
- package/dist/generators/test-generator/code-generator.d.ts.map +1 -1
- package/dist/generators/test-generator/code-generator.js +13 -0
- package/dist/generators/test-generator/code-generator.js.map +1 -1
- package/dist/orchestrator/ai-rules-updater.d.ts.map +1 -1
- package/dist/orchestrator/ai-rules-updater.js +4 -0
- package/dist/orchestrator/ai-rules-updater.js.map +1 -1
- package/dist/orchestrator/templates/ai-instructions/claude-cmd-add-screen.md +48 -14
- package/dist/orchestrator/templates/ai-instructions/claude-cmd-dashboard.md +4 -1
- package/dist/orchestrator/templates/ai-instructions/claude-cmd-delivery.md +22 -11
- package/dist/orchestrator/templates/ai-instructions/claude-cmd-locale.md +71 -0
- package/dist/orchestrator/templates/ai-instructions/claude-cmd-review.md +23 -8
- package/dist/orchestrator/templates/ai-instructions/claude-cmd-run-test.md +45 -6
- package/dist/orchestrator/templates/ai-instructions/claude-config.md +4 -1
- package/dist/orchestrator/templates/ai-instructions/claude-skill-locale.md +316 -0
- package/dist/orchestrator/templates/ai-instructions/copilot-cmd-add-screen.md +50 -13
- package/dist/orchestrator/templates/ai-instructions/copilot-cmd-dashboard.md +4 -1
- package/dist/orchestrator/templates/ai-instructions/copilot-cmd-delivery.md +20 -9
- package/dist/orchestrator/templates/ai-instructions/copilot-cmd-locale.md +70 -0
- package/dist/orchestrator/templates/ai-instructions/copilot-cmd-review.md +23 -8
- package/dist/orchestrator/templates/ai-instructions/copilot-cmd-run-test.md +44 -6
- package/dist/orchestrator/templates/ai-instructions/copilot-config.md +4 -1
- package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-locale.md +291 -0
- package/dist/orchestrator/templates/playwright.config.ts +25 -8
- package/dist/orchestrator/templates/specs-base.ts +9 -0
- package/dist/orchestrator/templates/specs-locale-fixture.ts +105 -0
- package/package.json +1 -1
- package/src/cli/commands/delivery.ts +256 -65
- package/src/cli/index.ts +1 -1
- package/src/dashboard/snapshot-builder.ts +207 -32
- package/src/dashboard/templates/index.html +84 -84
- package/src/dashboard/types.ts +40 -3
- package/src/exporters/csv-exporter.ts +36 -7
- package/src/exporters/json-exporter.ts +22 -2
- package/src/exporters/playwright-report-parser.ts +20 -0
- package/src/exporters/selector-key-resolver.ts +190 -0
- package/src/exporters/test-data-resolver.ts +65 -7
- package/src/exporters/types.ts +1 -0
- package/src/exporters/xlsx-exporter.ts +61 -7
- package/src/generators/test-generator/code-generator.ts +14 -0
- package/src/orchestrator/ai-rules-updater.ts +4 -0
- package/src/orchestrator/templates/ai-instructions/claude-cmd-add-screen.md +48 -14
- package/src/orchestrator/templates/ai-instructions/claude-cmd-dashboard.md +4 -1
- package/src/orchestrator/templates/ai-instructions/claude-cmd-delivery.md +22 -11
- package/src/orchestrator/templates/ai-instructions/claude-cmd-locale.md +71 -0
- package/src/orchestrator/templates/ai-instructions/claude-cmd-review.md +23 -8
- package/src/orchestrator/templates/ai-instructions/claude-cmd-run-test.md +45 -6
- package/src/orchestrator/templates/ai-instructions/claude-config.md +4 -1
- package/src/orchestrator/templates/ai-instructions/claude-skill-locale.md +316 -0
- package/src/orchestrator/templates/ai-instructions/copilot-cmd-add-screen.md +50 -13
- package/src/orchestrator/templates/ai-instructions/copilot-cmd-dashboard.md +4 -1
- package/src/orchestrator/templates/ai-instructions/copilot-cmd-delivery.md +20 -9
- package/src/orchestrator/templates/ai-instructions/copilot-cmd-locale.md +70 -0
- package/src/orchestrator/templates/ai-instructions/copilot-cmd-review.md +23 -8
- package/src/orchestrator/templates/ai-instructions/copilot-cmd-run-test.md +44 -6
- package/src/orchestrator/templates/ai-instructions/copilot-config.md +4 -1
- package/src/orchestrator/templates/ai-instructions/github-skill-sungen-locale.md +291 -0
- package/src/orchestrator/templates/playwright.config.ts +25 -8
- package/src/orchestrator/templates/specs-base.ts +9 -0
- package/src/orchestrator/templates/specs-locale-fixture.ts +105 -0
- package/dist/orchestrator/templates/playwright.config.d.ts +0 -10
- package/dist/orchestrator/templates/playwright.config.d.ts.map +0 -1
- package/dist/orchestrator/templates/playwright.config.js +0 -104
- package/dist/orchestrator/templates/playwright.config.js.map +0 -1
- package/dist/orchestrator/templates/specs-base.d.ts +0 -14
- package/dist/orchestrator/templates/specs-base.d.ts.map +0 -1
- package/dist/orchestrator/templates/specs-base.js +0 -77
- package/dist/orchestrator/templates/specs-base.js.map +0 -1
- package/dist/orchestrator/templates/specs-test-data.d.ts +0 -16
- package/dist/orchestrator/templates/specs-test-data.d.ts.map +0 -1
- package/dist/orchestrator/templates/specs-test-data.js +0 -151
- package/dist/orchestrator/templates/specs-test-data.js.map +0 -1
|
@@ -22,6 +22,7 @@ export const AI_RULES_FILE_MAPPING: [string, string][] = [
|
|
|
22
22
|
['claude-cmd-review.md', '.claude/commands/sungen/review.md'],
|
|
23
23
|
['claude-cmd-delivery.md', '.claude/commands/sungen/delivery.md'],
|
|
24
24
|
['claude-cmd-dashboard.md', '.claude/commands/sungen/dashboard.md'],
|
|
25
|
+
['claude-cmd-locale.md', '.claude/commands/sungen/locale.md'],
|
|
25
26
|
|
|
26
27
|
// Commands — GitHub Copilot
|
|
27
28
|
['copilot-cmd-add-screen.md', '.github/prompts/sungen-add-screen.prompt.md'],
|
|
@@ -31,6 +32,7 @@ export const AI_RULES_FILE_MAPPING: [string, string][] = [
|
|
|
31
32
|
['copilot-cmd-review.md', '.github/prompts/sungen-review.prompt.md'],
|
|
32
33
|
['copilot-cmd-delivery.md', '.github/prompts/sungen-delivery.prompt.md'],
|
|
33
34
|
['copilot-cmd-dashboard.md', '.github/prompts/sungen-dashboard.prompt.md'],
|
|
35
|
+
['copilot-cmd-locale.md', '.github/prompts/sungen-locale.prompt.md'],
|
|
34
36
|
|
|
35
37
|
// Skills — Claude Code
|
|
36
38
|
['claude-skill-gherkin-syntax.md', '.claude/skills/sungen-gherkin-syntax/SKILL.md'],
|
|
@@ -47,6 +49,7 @@ export const AI_RULES_FILE_MAPPING: [string, string][] = [
|
|
|
47
49
|
['claude-skill-capture-local.md', '.claude/skills/sungen-capture-local/SKILL.md'],
|
|
48
50
|
['claude-skill-capture-live.md', '.claude/skills/sungen-capture-live/SKILL.md'],
|
|
49
51
|
['claude-skill-figma-source.md', '.claude/skills/sungen-figma-source/SKILL.md'],
|
|
52
|
+
['claude-skill-locale.md', '.claude/skills/sungen-locale/SKILL.md'],
|
|
50
53
|
|
|
51
54
|
// Skills — Copilot (prompt-based)
|
|
52
55
|
['copilot-skill-figma-source.md', '.github/prompts/sungen-figma-source.prompt.md'],
|
|
@@ -66,6 +69,7 @@ export const AI_RULES_FILE_MAPPING: [string, string][] = [
|
|
|
66
69
|
['github-skill-sungen-capture-local.md', '.github/skills/sungen-capture-local/SKILL.md'],
|
|
67
70
|
['github-skill-sungen-capture-live.md', '.github/skills/sungen-capture-live/SKILL.md'],
|
|
68
71
|
['github-skill-sungen-figma-source.md', '.github/skills/sungen-figma-source/SKILL.md'],
|
|
72
|
+
['github-skill-sungen-locale.md', '.github/skills/sungen-locale/SKILL.md'],
|
|
69
73
|
];
|
|
70
74
|
|
|
71
75
|
export class AIRulesUpdater {
|
|
@@ -1,40 +1,55 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: add-screen
|
|
3
|
-
description: 'Add a new Sungen screen — scaffolds directories, helps fill spec.md, and can capture visuals from Figma (pre-launch) or live page via the capture skills'
|
|
4
|
-
argument-hint: [screen-name] [url-path] [--figma <url>]
|
|
3
|
+
description: 'Add a new Sungen screen or a sub-feature to an existing one — scaffolds directories, helps fill spec.md, and can capture visuals from Figma (pre-launch) or live page via the capture skills'
|
|
4
|
+
argument-hint: "[screen-name] [url-path] [--feature <name>] [--figma <url>]"
|
|
5
5
|
allowed-tools: Read, Grep, Bash, Glob, Edit, Write, AskUserQuestion, mcp__playwright__browser_navigate, mcp__playwright__browser_take_screenshot, mcp__playwright__browser_snapshot, mcp__figma__get_design_context, mcp__figma__get_variable_defs, mcp__figma__get_screenshot
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
You are adding a new Sungen screen for test generation.
|
|
8
|
+
You are adding a new Sungen screen for test generation, or extending an existing screen with an additional `.feature` file (sub-feature).
|
|
9
9
|
|
|
10
10
|
## Parameters
|
|
11
11
|
|
|
12
12
|
Parse from `$ARGUMENTS`:
|
|
13
13
|
- **screen** — screen name (e.g., `login`, `dashboard`, `settings`)
|
|
14
|
-
- **path** — URL path (e.g., `/login`, `/dashboard`, `/settings`) - optional when `--figma` is provided
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
14
|
+
- **path** — URL path (e.g., `/login`, `/dashboard`, `/settings`) - optional when `--figma` is provided or when adding a sub-feature to an existing screen
|
|
15
|
+
- **`--feature <name>`** — sub-feature name to add to an existing screen (e.g., `modal`, `filter`, `create-flow`). Creates `<screen>-<feature>.feature` + matching `selectors/<screen>-<feature>.yaml` + `test-data/<screen>-<feature>.yaml` without touching the screen's other files. Use this when one screen has multiple `.feature` files (e.g. main listing + modal + filter panel).
|
|
16
|
+
- **`--figma <url>`** — Figma share URL (optional)
|
|
17
|
+
- **`--refresh`** — bypass Figma cache and re-fetch (optional, use with `--figma`)
|
|
18
|
+
- **`--scale <n>`** — PNG export scale factor, default 2 (optional)
|
|
19
|
+
- **`--hi-res`** — export at 4× scale, shorthand for `--scale 4` (optional)
|
|
19
20
|
|
|
20
21
|
If **screen** is missing, ask: "What is the screen name? (e.g., `login`, `dashboard`)"
|
|
21
|
-
If **path** is missing and `--figma` was NOT provided, ask: "What is the URL path? (e.g., `/login`, `/dashboard`)"
|
|
22
|
+
If **path** is missing and **`--feature`** is NOT used and `--figma` was NOT provided, ask: "What is the URL path? (e.g., `/login`, `/dashboard`)"
|
|
23
|
+
|
|
24
|
+
**Mode detection** — before invoking the CLI, check whether `qa/screens/<screen>/` already exists:
|
|
25
|
+
- Screen does NOT exist → fresh screen creation (need `--path` unless `--figma` provided)
|
|
26
|
+
- Screen exists AND `--feature <name>` provided → sub-feature mode (skip spec.md, only generate the 3 new files)
|
|
27
|
+
- Screen exists AND no `--feature` → ask the user whether they meant to add a sub-feature (offer `--feature <suggested-name>`) or refresh visuals only (with `--figma`)
|
|
22
28
|
|
|
23
29
|
## Steps
|
|
24
30
|
|
|
25
|
-
### 1. Scaffold the screen
|
|
31
|
+
### 1. Scaffold the screen (or sub-feature)
|
|
26
32
|
|
|
27
|
-
**Standard path (no `--figma`):**
|
|
33
|
+
**Standard path (no `--figma`, no `--feature`):**
|
|
28
34
|
```bash
|
|
29
35
|
sungen add --screen <screen> --path <path>
|
|
30
36
|
```
|
|
31
37
|
|
|
38
|
+
**Sub-feature mode (`--feature <name>` provided):**
|
|
39
|
+
```bash
|
|
40
|
+
sungen add --screen <screen> --feature <name> [--path <path>]
|
|
41
|
+
# Generates qa/screens/<screen>/{features,selectors,test-data}/<screen>-<name>.{feature,yaml,yaml}
|
|
42
|
+
# Existing screen files (awards.feature, spec.md, …) are untouched.
|
|
43
|
+
# --path is optional — defaults to /<screen> when omitted. Pass --path only if the sub-feature lives at a different URL.
|
|
44
|
+
```
|
|
45
|
+
|
|
32
46
|
**Figma branch (when `--figma <url>` is in `$ARGUMENTS`):**
|
|
33
47
|
|
|
34
48
|
Invoke the `sungen-figma-source` skill by running:
|
|
35
49
|
```bash
|
|
36
|
-
sungen add --screen <screen> --figma '<url>' [--path <path>] [--refresh] [--scale <n>]
|
|
50
|
+
sungen add --screen <screen> --figma '<url>' [--path <path>] [--feature <name>] [--refresh] [--scale <n>]
|
|
37
51
|
# Single-quote the URL — Figma links contain `&` which bash otherwise treats as a background operator.
|
|
52
|
+
# --feature can be combined with --figma when the new sub-feature has its own Figma frame.
|
|
38
53
|
```
|
|
39
54
|
|
|
40
55
|
This CLI command automatically:
|
|
@@ -84,15 +99,34 @@ Each capture skill writes outputs into `qa/screens/<screen>/requirements/ui/` an
|
|
|
84
99
|
|
|
85
100
|
### 3. Fill spec.md
|
|
86
101
|
|
|
87
|
-
|
|
102
|
+
**Skip this step when `--feature` was used** — the screen's existing `spec.md` is reused for all sub-features; only suggest the user append a new section for the sub-feature if useful (e.g. `## Modal — Confirm Withdrawal`).
|
|
103
|
+
|
|
104
|
+
For fresh screen creation, use `AskUserQuestion`: *"Fill `spec.md` now? (You can reference the captured visuals)"* — offer **Yes, fill now (Recommended)** / **Skip, fill later**.
|
|
88
105
|
|
|
89
106
|
If yes → open `qa/screens/<screen>/requirements/spec.md` and help the user fill sections, fields, validation rules, business rules, and states. Reference the captured visuals from Step 2 to suggest field names, form elements, and UI states. Especially prompt for the optional **Figma URL** and **Live URL** fields in Overview — those unlock auto-capture without re-asking next run.
|
|
90
107
|
|
|
91
108
|
### 4. Next steps
|
|
92
109
|
|
|
93
|
-
Tell the user what was created,
|
|
110
|
+
Tell the user what was created. When `--feature` was used, list the 3 new files explicitly (`features/<screen>-<name>.feature`, `selectors/<screen>-<name>.yaml`, `test-data/<screen>-<name>.yaml`) and remind that `/sungen:create-test` currently operates at the screen level — it will see both the parent feature and the new sub-feature and ask which one to update.
|
|
111
|
+
|
|
112
|
+
Then use `AskUserQuestion` to offer next steps:
|
|
94
113
|
|
|
95
114
|
- **`/sungen:create-test <screen>`** — Create test cases from requirements/designs (Recommended)
|
|
96
115
|
- **Done for now** — I'll come back later
|
|
97
116
|
|
|
98
117
|
If user picks `/sungen:create-test`, **you MUST use the Skill tool** to invoke it. Do NOT generate test cases yourself — the skill auto-loads `sungen-gherkin-syntax` and `sungen-tc-generation`.
|
|
118
|
+
|
|
119
|
+
## CLI Reference
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
sungen add --screen <name>
|
|
123
|
+
[-p, --path <path>] URL route (e.g., /awards). Required for capture; defaults to /<screen> when omitted.
|
|
124
|
+
[-f, --feature <name>] Add a sub-feature .feature file to an existing screen.
|
|
125
|
+
Output filename = <screen>-<feature>.{feature,yaml,yaml}.
|
|
126
|
+
[-c, --capture] Auto-capture a live screenshot to requirements/ui/ (needs --path).
|
|
127
|
+
[-d, --description <text>] Screen description (used in spec.md stub).
|
|
128
|
+
[--figma <url>] Figma share URL — generates spec_figma.md + ui/*.png.
|
|
129
|
+
[--refresh] Bypass Figma cache (use with --figma).
|
|
130
|
+
[--scale <n>] PNG export scale (default 2).
|
|
131
|
+
[--hi-res] Shorthand for --scale 4.
|
|
132
|
+
```
|
|
@@ -19,8 +19,11 @@ Parse **screens** from `$ARGUMENTS`:
|
|
|
19
19
|
|
|
20
20
|
### 1. Invoke the CLI
|
|
21
21
|
|
|
22
|
+
Prefer the local `./bin/sungen.js` when it exists (this is the canonical entry point when developing sungen itself, and ships any unpublished features the global package doesn't have yet). Fall back to `npx sungen` for downstream projects that consume sungen as a dependency.
|
|
23
|
+
|
|
22
24
|
```bash
|
|
23
|
-
|
|
25
|
+
# Local-first dispatcher — works in both the sungen monorepo and consumer projects:
|
|
26
|
+
[ -x ./bin/sungen.js ] && ./bin/sungen.js dashboard <screens> || npx sungen dashboard <screens>
|
|
24
27
|
```
|
|
25
28
|
|
|
26
29
|
- No args → all screens + flows.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: delivery
|
|
3
3
|
description: 'Export Gherkin scenarios + Playwright results to CSV test case file for QA delivery.'
|
|
4
|
-
argument-hint: "[screen-name...] (omit for all
|
|
4
|
+
argument-hint: "[screen-name...] [--env <locale>] (omit screens for all; --env for locale-specific export)"
|
|
5
5
|
allowed-tools: Bash, Read, AskUserQuestion
|
|
6
6
|
---
|
|
7
7
|
|
|
@@ -11,28 +11,34 @@ You are a **QA Test Delivery Engineer**. Your job is to invoke the deterministic
|
|
|
11
11
|
|
|
12
12
|
## Parameters
|
|
13
13
|
|
|
14
|
-
Parse
|
|
15
|
-
-
|
|
16
|
-
-
|
|
14
|
+
Parse from `$ARGUMENTS`:
|
|
15
|
+
- **screens** — zero or more screen/flow names. Empty → CLI processes all targets in `qa/screens/` + `qa/flows/`.
|
|
16
|
+
- **`--env <locale>`** — optional. Sets `SUNGEN_ENV=<locale>` for the run so the CLI merges `<name>.<locale>.yaml` over the base test-data and writes `<name>-testcases.<locale>.csv` / `.xlsx`. Accept `--locale <locale>` as an alias.
|
|
17
|
+
|
|
18
|
+
If `--env` is passed but no value follows, ask the user which locale to use.
|
|
17
19
|
|
|
18
20
|
## Steps
|
|
19
21
|
|
|
20
22
|
### 1. Invoke the CLI
|
|
21
23
|
|
|
22
|
-
Run via Bash (single command, no extra parsing)
|
|
24
|
+
Run via Bash (single command, no extra parsing). Prefer the local `./bin/sungen.js` when it exists — the sungen monorepo ships local-only features the global npm package doesn't have yet (multi-sheet locale aggregation, `.<env>` filename suffix, locale-aware step rendering). Fall back to `npx sungen` in downstream projects.
|
|
23
25
|
|
|
24
26
|
```bash
|
|
25
|
-
|
|
27
|
+
# No env — local-first dispatcher:
|
|
28
|
+
[ -x ./bin/sungen.js ] && ./bin/sungen.js delivery <screens> || npx sungen delivery <screens>
|
|
29
|
+
|
|
30
|
+
# Locale-specific:
|
|
31
|
+
[ -x ./bin/sungen.js ] && SUNGEN_ENV=<locale> ./bin/sungen.js delivery <screens> || SUNGEN_ENV=<locale> npx sungen delivery <screens>
|
|
26
32
|
```
|
|
27
33
|
|
|
28
|
-
- If no screen args →
|
|
29
|
-
- If
|
|
34
|
+
- If no screen args → omit `<screens>` (CLI processes all targets).
|
|
35
|
+
- If `--env <locale>` was provided → prepend `SUNGEN_ENV=<locale>` to the command. Do NOT pass `--env` to the CLI itself — it's not a CLI flag, only a slash-command convenience.
|
|
30
36
|
|
|
31
37
|
The CLI handles:
|
|
32
|
-
- Scope detection (all screens vs specific)
|
|
38
|
+
- Scope detection (all screens + flows vs specific)
|
|
33
39
|
- Pre-flight source checks with colorful output
|
|
34
|
-
- Parsing `.feature`, `.spec.ts`, `test-data.yaml
|
|
35
|
-
- Generating CSV at `qa/deliverables/<
|
|
40
|
+
- Parsing `.feature`, `.spec.ts`, `test-data.yaml` (+ `<name>.<env>.yaml` overlay when `SUNGEN_ENV` is set), and per-target `<name>-test-result[.<env>].json`
|
|
41
|
+
- Generating CSV/XLSX at `qa/deliverables/<name>-testcases[.<env>].csv` / `.xlsx`
|
|
36
42
|
- Printing summary table
|
|
37
43
|
|
|
38
44
|
### 2. Handle pre-flight failures (if CLI exits non-zero)
|
|
@@ -68,4 +74,9 @@ Forward the CLI's summary table to the user verbatim. Then use `AskUserQuestion`
|
|
|
68
74
|
sungen delivery [screens...]
|
|
69
75
|
[--skip-preflight] Skip pre-flight checks (not recommended)
|
|
70
76
|
[--continue-on-missing] Skip screens with blocking misses
|
|
77
|
+
|
|
78
|
+
# Locale-aware export (env var, not a CLI flag):
|
|
79
|
+
SUNGEN_ENV=<locale> sungen delivery [screens...]
|
|
80
|
+
→ reads <name>.<locale>.yaml overlay, picks <name>-test-result.<locale>.json,
|
|
81
|
+
writes <name>-testcases.<locale>.csv / .xlsx
|
|
71
82
|
```
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 'Bootstrap i18n for a screen/flow — audit selectors, detect locale switch mechanism via Playwright, generate test-data overlay so `sungen:run-test --env <locale>` works.'
|
|
3
|
+
argument-hint: "<name> <locale> [--base-locale <code>] [--offline]"
|
|
4
|
+
allowed-tools: Read, Grep, Bash, Glob, Edit, Write, AskUserQuestion, mcp__playwright__browser_navigate, mcp__playwright__browser_snapshot, mcp__playwright__browser_take_screenshot, mcp__playwright__browser_wait_for, mcp__playwright__browser_evaluate, mcp__playwright__browser_click, mcp__playwright__browser_storage_state, mcp__playwright__browser_set_storage_state
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Role
|
|
8
|
+
|
|
9
|
+
You are a **Senior QA Localization Engineer**. Use the `sungen-locale` skill — it contains the full phased strategy. Your job in this command is parameter parsing, context detection, and final hand-off.
|
|
10
|
+
|
|
11
|
+
## Parameters
|
|
12
|
+
|
|
13
|
+
Parse from `$ARGUMENTS`:
|
|
14
|
+
- **name** — screen or flow name (e.g. `home`, `awards`, `kudo-to-display-on-kudos`). If missing → AskUserQuestion.
|
|
15
|
+
- **locale** — target locale code (e.g. `en`, `ja`, `en-US`, `staging-ja`). If missing → AskUserQuestion. This becomes the suffix in `test-data/<feature>.<locale>.yaml` and `SUNGEN_ENV=<locale>` at run time.
|
|
16
|
+
- **`--base-locale <code>`** — optional. The locale of existing `test-data/<feature>.yaml`. Default `vi`. Used only for reporting/UX — files never get renamed.
|
|
17
|
+
- **`--offline`** — force OFFLINE mode (skip Playwright capture). Useful when you know the live page can't be reached or when prepping a test-only template.
|
|
18
|
+
|
|
19
|
+
Reject if name == locale (common typo).
|
|
20
|
+
|
|
21
|
+
## Auto-detect context
|
|
22
|
+
|
|
23
|
+
Same as `/sungen:run-test`:
|
|
24
|
+
- `qa/flows/<name>/` exists → flow mode (base path: `qa/flows/<name>/`)
|
|
25
|
+
- Else `qa/screens/<name>/` exists → screen mode (base path: `qa/screens/<name>/`)
|
|
26
|
+
- Neither exists → tell user and stop
|
|
27
|
+
|
|
28
|
+
## Steps
|
|
29
|
+
|
|
30
|
+
The `sungen-locale` skill defines 7 phases. Execute them in order:
|
|
31
|
+
|
|
32
|
+
1. **Phase 1 — Selector audit** (always, no MCP)
|
|
33
|
+
2. **Phase 2 — Capture base locale** (Live mode only)
|
|
34
|
+
3. **Phase 3 — Switch locale + detect mechanism** (Live mode only)
|
|
35
|
+
4. **Phase 4 — Diff base ↔ target** (Live mode only)
|
|
36
|
+
5. **Phase 5 — Confirm proposal** (always)
|
|
37
|
+
6. **Phase 6 — Apply files** (always, after confirmation)
|
|
38
|
+
7. **Phase 7 — Hand off** (always)
|
|
39
|
+
|
|
40
|
+
**Mode selection** happens at the start of Phase 2:
|
|
41
|
+
|
|
42
|
+
- If `--offline` flag → OFFLINE mode (skip Phases 2-4, Phase 5 shows empty `target text` column for user to fill manually).
|
|
43
|
+
- Else try `browser_navigate(baseURL)` — if it succeeds and page renders content → LIVE mode.
|
|
44
|
+
- If navigate fails / page redirects to login / shows blocker → fall back to OFFLINE mode automatically. Announce the fallback clearly so the user knows what they got.
|
|
45
|
+
|
|
46
|
+
## Enumerate features
|
|
47
|
+
|
|
48
|
+
For multi-feature screens (e.g. `home` has `home.feature` + `home-modal.feature`), run Phases 1, 4, 6 once **per feature file**; run Phases 2 & 3 (live capture + mechanism detection) **once per screen** — the mechanism doesn't change between features in the same screen.
|
|
49
|
+
|
|
50
|
+
Discover features the same way delivery does:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
ls qa/screens/<name>/features/*.feature
|
|
54
|
+
# or
|
|
55
|
+
ls qa/flows/<name>/features/*.feature
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## After Phase 7
|
|
59
|
+
|
|
60
|
+
Use `AskUserQuestion` to offer next steps:
|
|
61
|
+
|
|
62
|
+
- **`/sungen:run-test <name> --env <locale>`** — Run the tests against the new locale (Recommended)
|
|
63
|
+
- **`/sungen:locale <name> <other-locale>`** — Bootstrap another locale (e.g. add `ja` after `en`)
|
|
64
|
+
- **Open the overlay file** — Show `test-data/<feature>.<locale>.yaml` so user can review / edit before running
|
|
65
|
+
- **Done** — Stop
|
|
66
|
+
|
|
67
|
+
## Notes
|
|
68
|
+
|
|
69
|
+
- Do NOT run tests yourself. `/sungen:run-test` is the executor. This command only PREPS files.
|
|
70
|
+
- Do NOT modify `.feature` files. Localization happens entirely through `selectors/*.yaml` + `test-data/*.yaml`.
|
|
71
|
+
- Auth blocker on SAA staging? Use `--offline`. See [[saa-auth-blocker]] memory.
|
|
@@ -17,13 +17,28 @@ Parse **name** from `$ARGUMENTS`. If missing, ask the user.
|
|
|
17
17
|
|
|
18
18
|
## Steps
|
|
19
19
|
|
|
20
|
-
1.
|
|
21
|
-
2.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
1. **Enumerate feature files** — glob `<base>/<name>/features/*.feature`. A screen may have one main file (`<name>.feature`) plus sub-features (`<name>-<sub>.feature` like `awards-modal.feature`); a flow has a single `<name>.feature`. If zero `.feature` files found → `/sungen:create-test` first.
|
|
21
|
+
2. **Review every feature file** — for each `<basename>.feature` discovered in step 1:
|
|
22
|
+
- Read `<basename>.feature` and the matching `test-data/<basename>.yaml`.
|
|
23
|
+
- Apply the `sungen-tc-review` skill — score 3 dimensions: Syntax (30pts), Coverage (40pts), Viewpoint (30pts). **For flows**, also apply the "Flow Review Additions" section. Use `sungen-viewpoint` for pattern checklists.
|
|
24
|
+
- Apply the **Unverified Selectors check** — if `<base>/<name>/selectors/<basename>.yaml` exists, count lines matching `@needs-live-verify`. Include in the per-file report as a non-scoring metric. Does NOT affect the 60% threshold.
|
|
25
|
+
3. **Aggregated output** — present scores in a per-feature table, then a screen-level rollup:
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
Feature Syntax Coverage Viewpoint Total Verdict
|
|
29
|
+
──────────────────────────────────────────────────────────────────
|
|
30
|
+
home.feature 28/30 36/40 27/30 91% PASS
|
|
31
|
+
home-modal.feature 26/30 24/40 22/30 72% PASS
|
|
32
|
+
──────────────────────────────────────────────────────────────────
|
|
33
|
+
Screen rollup (mean) 27/30 30/40 24.5/30 81.5% PASS
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
- **>= 60% per file**: PASS that file.
|
|
37
|
+
- **< 60% per file**: FAIL that file with recommendations.
|
|
38
|
+
- Show the full per-file report (recommendations, top issues) **only for files that fail**, or when the user asks for the deep report.
|
|
39
|
+
4. If any file is FAIL and user confirms → update that file's test cases following `sungen-gherkin-syntax` and `sungen-tc-generation` skills, then re-review **only the failing files** (skip already-passing ones to save time).
|
|
40
|
+
5. After all files PASS (or user decides to proceed), use `AskUserQuestion` to offer next steps:
|
|
41
|
+
|
|
42
|
+
- **`/sungen:run-test <name>`** — Generate selectors, compile, and run tests for **every feature** in this screen (Recommended)
|
|
28
43
|
- **`/sungen:create-test <name>`** — Add more test cases before running
|
|
29
44
|
- **Done for now** — I'll come back later
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: run-test
|
|
3
3
|
description: 'Generate selectors + auth state via Playwright MCP, compile, and run Playwright tests — auto-fixes selectors on failure'
|
|
4
|
-
argument-hint: [screen-name]
|
|
4
|
+
argument-hint: "[screen-name] [--env <locale>]"
|
|
5
5
|
allowed-tools: Read, Grep, Bash, Glob, Edit, Write, AskUserQuestion, mcp__playwright__browser_navigate, mcp__playwright__browser_snapshot, mcp__playwright__browser_take_screenshot, mcp__playwright__browser_wait_for, mcp__playwright__browser_evaluate, mcp__playwright__browser_run_code, mcp__playwright__browser_storage_state, mcp__playwright__browser_set_storage_state
|
|
6
6
|
---
|
|
7
7
|
|
|
@@ -11,7 +11,24 @@ You are a **Senior Developer**. Use `sungen-selector-fix`, `sungen-selector-keys
|
|
|
11
11
|
|
|
12
12
|
## Parameters
|
|
13
13
|
|
|
14
|
-
Parse
|
|
14
|
+
Parse from `$ARGUMENTS`:
|
|
15
|
+
- **name** — screen or flow name. If missing, ask the user.
|
|
16
|
+
- **`--env <locale>`** — optional. Sets `SUNGEN_ENV=<locale>` for the test run so the runtime test-data resolver merges `<name>.<locale>.yaml` over the base, and `playwright.config.ts` writes results to `<name>-test-result.<locale>.json`. Accept `--locale <locale>` as an alias.
|
|
17
|
+
|
|
18
|
+
If `--env` is passed but no value follows, ask the user which locale to use.
|
|
19
|
+
|
|
20
|
+
**`--env <locale>` pre-flight**: when `--env` is passed AND the matching overlay file doesn't exist yet (`test-data/<feature>.<locale>.yaml` missing), tests will silently fall back to base locale values — the run will execute but won't actually exercise the locale. Before kicking off Phase 0.5, check:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
ls qa/<screens|flows>/<name>/test-data/*.<locale>.yaml 2>/dev/null | wc -l
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
If the count is 0 → use `AskUserQuestion` to offer:
|
|
27
|
+
- **Run `/sungen:locale <name> <locale>` first** (Recommended) — bootstrap the overlay before running tests
|
|
28
|
+
- **Continue anyway** — run with empty overlay (tests will assert base-locale text, will likely fail on a real locale page)
|
|
29
|
+
- **Cancel**
|
|
30
|
+
|
|
31
|
+
Skip this pre-flight when `--env` matches the base locale (no overlay needed in that case).
|
|
15
32
|
|
|
16
33
|
**Auto-detect context**: check if `qa/flows/<name>/` exists → flow mode (base path: `qa/flows/<name>/`). Else check `qa/screens/<name>/` → screen mode (base path: `qa/screens/<name>/`).
|
|
17
34
|
|
|
@@ -52,7 +69,11 @@ Parse **name** from `$ARGUMENTS`. If missing, ask the user.
|
|
|
52
69
|
name: "Submit"
|
|
53
70
|
```
|
|
54
71
|
3. **Phase 0.5 — Auth Persistence**: if the feature has `@auth:<role>` tags and `specs/.auth/<role>.json` is missing/expired, run Phase 0.5 from `sungen-selector-fix` — user logs in manually in MCP browser → `browser_storage_state` → `specs/.auth/<role>.json`. Offer `sungen makeauth <role>` as CLI fallback only if `browser_storage_state` isn't available in this MCP version.
|
|
55
|
-
4. Compile
|
|
72
|
+
4. Compile via local-first dispatcher so the sungen monorepo's unpublished selector-resolver features (i18n `{{var}}` interpolation, namespaced selector lookup) are picked up:
|
|
73
|
+
- **Screen**: `[ -x ./bin/sungen.js ] && ./bin/sungen.js generate --screen <name> || npx sungen generate --screen <name>`
|
|
74
|
+
- **Flow**: `[ -x ./bin/sungen.js ] && ./bin/sungen.js generate --flow <name> || npx sungen generate --flow <name>`
|
|
75
|
+
|
|
76
|
+
Default: runtime data loading from YAML. Use `--inline-data` only if user requests compile-time hardcoded values.
|
|
56
77
|
|
|
57
78
|
## Run & Fix (phased — per `sungen-selector-fix` skill)
|
|
58
79
|
|
|
@@ -63,13 +84,31 @@ Parse **name** from `$ARGUMENTS`. If missing, ask the user.
|
|
|
63
84
|
|
|
64
85
|
## Playwright command guidelines
|
|
65
86
|
|
|
66
|
-
**
|
|
87
|
+
**Multi-feature screens** — `sungen generate --screen <name>` produces one `<basename>.spec.ts` per `.feature` file (e.g. `home.spec.ts` + `home-modal.spec.ts`). You must **invoke playwright once per spec file** so each gets its own JSON result that `sungen delivery` can pick up. Do NOT run a single command with the directory as the test argument — that bundles everything into one results file that delivery can't disambiguate.
|
|
88
|
+
|
|
89
|
+
**Per-spec JSON results** — each invocation writes its JSON report to a path matching the spec basename. When `--env <locale>` was parsed from `$ARGUMENTS`, prepend `SUNGEN_ENV=<locale>` — `playwright.config.ts` auto-inserts `.<locale>` before `.json` in the output path:
|
|
67
90
|
|
|
68
91
|
```bash
|
|
69
|
-
# ✅ Screen
|
|
92
|
+
# ✅ Screen with 1 feature
|
|
70
93
|
PLAYWRIGHT_JSON_OUTPUT_NAME=specs/generated/<name>/<name>-test-result.json \
|
|
71
94
|
npx playwright test specs/generated/<name>/<name>.spec.ts
|
|
72
95
|
|
|
96
|
+
# ✅ Screen with multiple features — loop in shell:
|
|
97
|
+
for spec in specs/generated/<name>/*.spec.ts; do
|
|
98
|
+
base=$(basename "$spec" .spec.ts)
|
|
99
|
+
PLAYWRIGHT_JSON_OUTPUT_NAME="specs/generated/<name>/${base}-test-result.json" \
|
|
100
|
+
npx playwright test "$spec"
|
|
101
|
+
done
|
|
102
|
+
|
|
103
|
+
# ✅ Locale 'vi' — same loop, just prepend SUNGEN_ENV=vi
|
|
104
|
+
for spec in specs/generated/<name>/*.spec.ts; do
|
|
105
|
+
base=$(basename "$spec" .spec.ts)
|
|
106
|
+
SUNGEN_ENV=vi \
|
|
107
|
+
PLAYWRIGHT_JSON_OUTPUT_NAME="specs/generated/<name>/${base}-test-result.json" \
|
|
108
|
+
npx playwright test "$spec"
|
|
109
|
+
done
|
|
110
|
+
# → writes <basename>-test-result.vi.json for each feature
|
|
111
|
+
|
|
73
112
|
# ✅ Flow
|
|
74
113
|
PLAYWRIGHT_JSON_OUTPUT_NAME=specs/generated/flows/<name>/<name>-test-result.json \
|
|
75
114
|
npx playwright test specs/generated/flows/<name>/<name>.spec.ts
|
|
@@ -88,7 +127,7 @@ npx playwright test specs/generated/<screen>/<screen>.spec.ts
|
|
|
88
127
|
|
|
89
128
|
If you want to filter scenarios, use `-g "<pattern>"` instead of a reporter override.
|
|
90
129
|
|
|
91
|
-
`sungen delivery` reads the per-
|
|
130
|
+
`sungen delivery` reads per-feature `<basename>-test-result[.env].json` files (one per feature in the screen) and writes one CSV/XLSX per feature (e.g. `home-testcases.csv` + `home-modal-testcases.csv`). When `--env <locale>` was used here, run delivery with the same locale (`/sungen:delivery <name> --env <locale>`) so it picks the matching `*-test-result.<locale>.json` files and produces `*-testcases.<locale>.csv` / `.xlsx`.
|
|
92
131
|
|
|
93
132
|
## Next steps
|
|
94
133
|
|
|
@@ -20,8 +20,9 @@ You generate 3 files for sungen — a Gherkin compiler that produces Playwright
|
|
|
20
20
|
| `sungen-capture-local` | Load existing UI assets (screenshots, mockups, Figma exports) from `requirements/ui/` |
|
|
21
21
|
| `sungen-capture-live` | Capture a live running page via Playwright MCP (snapshot + screenshot) |
|
|
22
22
|
| `sungen-figma-source` | Figma URL → spec_figma.md + ui/*.png + provisional selectors |
|
|
23
|
+
| `sungen-locale` | Bootstrap i18n — audit selectors, detect locale switch mechanism, generate test-data overlay |
|
|
23
24
|
|
|
24
|
-
## Workflow (
|
|
25
|
+
## Workflow (7 AI commands)
|
|
25
26
|
|
|
26
27
|
| Command | What it does |
|
|
27
28
|
|---|---|
|
|
@@ -31,9 +32,11 @@ You generate 3 files for sungen — a Gherkin compiler that produces Playwright
|
|
|
31
32
|
| `/sungen:review <name>` | Score syntax, coverage, viewpoint quality (auto-detects screen or flow) |
|
|
32
33
|
| `/sungen:run-test <name>` | Generate `selectors.yaml`, compile, run, auto-fix (auto-detects screen or flow) |
|
|
33
34
|
| `/sungen:delivery [name...]` | Export test cases → CSV for QA delivery (all screens if no arg) |
|
|
35
|
+
| `/sungen:locale <name> <locale>` | Bootstrap i18n for a screen — audit selectors, detect locale switch, generate overlay (run before `/sungen:run-test --env <locale>`) |
|
|
34
36
|
|
|
35
37
|
**Screen path:** add-screen → create-test → review → run-test → delivery.
|
|
36
38
|
**Flow path:** add-flow → create-test → review → run-test → delivery.
|
|
39
|
+
**i18n path:** (after run-test passes for base locale) → locale → run-test --env <locale> → delivery --env <locale>.
|
|
37
40
|
|
|
38
41
|
`create-test`, `review`, and `run-test` auto-detect context: if `qa/flows/<name>/` exists → flow mode, else `qa/screens/<name>/` → screen mode.
|
|
39
42
|
|