@sun-asterisk/sungen 2.6.1 → 2.6.3

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 (62) hide show
  1. package/dist/cli/commands/dashboard.d.ts +10 -0
  2. package/dist/cli/commands/dashboard.d.ts.map +1 -0
  3. package/dist/cli/commands/dashboard.js +171 -0
  4. package/dist/cli/commands/dashboard.js.map +1 -0
  5. package/dist/cli/index.js +4 -2
  6. package/dist/cli/index.js.map +1 -1
  7. package/dist/dashboard/history-store.d.ts +27 -0
  8. package/dist/dashboard/history-store.d.ts.map +1 -0
  9. package/dist/dashboard/history-store.js +112 -0
  10. package/dist/dashboard/history-store.js.map +1 -0
  11. package/dist/dashboard/html-renderer.d.ts +30 -0
  12. package/dist/dashboard/html-renderer.d.ts.map +1 -0
  13. package/dist/dashboard/html-renderer.js +111 -0
  14. package/dist/dashboard/html-renderer.js.map +1 -0
  15. package/dist/dashboard/snapshot-builder.d.ts +30 -0
  16. package/dist/dashboard/snapshot-builder.d.ts.map +1 -0
  17. package/dist/dashboard/snapshot-builder.js +263 -0
  18. package/dist/dashboard/snapshot-builder.js.map +1 -0
  19. package/dist/dashboard/templates/index.html +287 -0
  20. package/dist/dashboard/types.d.ts +122 -0
  21. package/dist/dashboard/types.d.ts.map +1 -0
  22. package/dist/dashboard/types.js +11 -0
  23. package/dist/dashboard/types.js.map +1 -0
  24. package/dist/exporters/json-exporter.d.ts +25 -0
  25. package/dist/exporters/json-exporter.d.ts.map +1 -0
  26. package/dist/exporters/json-exporter.js +135 -0
  27. package/dist/exporters/json-exporter.js.map +1 -0
  28. package/dist/exporters/playwright-report-parser.d.ts +2 -1
  29. package/dist/exporters/playwright-report-parser.d.ts.map +1 -1
  30. package/dist/exporters/playwright-report-parser.js +12 -5
  31. package/dist/exporters/playwright-report-parser.js.map +1 -1
  32. package/dist/exporters/spec-parser.d.ts.map +1 -1
  33. package/dist/exporters/spec-parser.js +8 -3
  34. package/dist/exporters/spec-parser.js.map +1 -1
  35. package/dist/orchestrator/ai-rules-updater.d.ts.map +1 -1
  36. package/dist/orchestrator/ai-rules-updater.js +4 -0
  37. package/dist/orchestrator/ai-rules-updater.js.map +1 -1
  38. package/dist/orchestrator/templates/ai-instructions/claude-cmd-dashboard.md +62 -0
  39. package/dist/orchestrator/templates/ai-instructions/claude-skill-dashboard.md +121 -0
  40. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-dashboard.md +62 -0
  41. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-dashboard.md +121 -0
  42. package/dist/orchestrator/templates/playwright.config.d.ts.map +1 -1
  43. package/dist/orchestrator/templates/playwright.config.js +17 -1
  44. package/dist/orchestrator/templates/playwright.config.js.map +1 -1
  45. package/dist/orchestrator/templates/playwright.config.ts +20 -1
  46. package/package.json +4 -3
  47. package/src/cli/commands/dashboard.ts +158 -0
  48. package/src/cli/index.ts +4 -2
  49. package/src/dashboard/history-store.ts +86 -0
  50. package/src/dashboard/html-renderer.ts +90 -0
  51. package/src/dashboard/snapshot-builder.ts +273 -0
  52. package/src/dashboard/templates/index.html +287 -0
  53. package/src/dashboard/types.ts +148 -0
  54. package/src/exporters/json-exporter.ts +162 -0
  55. package/src/exporters/playwright-report-parser.ts +12 -5
  56. package/src/exporters/spec-parser.ts +8 -3
  57. package/src/orchestrator/ai-rules-updater.ts +4 -0
  58. package/src/orchestrator/templates/ai-instructions/claude-cmd-dashboard.md +62 -0
  59. package/src/orchestrator/templates/ai-instructions/claude-skill-dashboard.md +121 -0
  60. package/src/orchestrator/templates/ai-instructions/copilot-cmd-dashboard.md +62 -0
  61. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-dashboard.md +121 -0
  62. package/src/orchestrator/templates/playwright.config.ts +20 -1
@@ -0,0 +1,121 @@
1
+ ---
2
+ name: sungen-dashboard
3
+ description: 'Build a single-file HTML dashboard summarising test cases & Playwright results. Auto-loaded by /sungen:dashboard.'
4
+ user-invocable: false
5
+ ---
6
+
7
+ ## Purpose
8
+
9
+ Generate `qa/dashboard/index.html` — a single-file, share-ready test report covering all (or selected) screens and flows. The HTML embeds the snapshot data inline, so it can be emailed, Slacked, or committed and opened by anyone via `file://` without any server.
10
+
11
+ **This skill delegates all heavy work to the `sungen dashboard` CLI.** The CLI is the source of truth for parsing logic — do NOT re-parse files in AI. Your role is only to:
12
+
13
+ 1. Invoke the CLI.
14
+ 2. Show its output verbatim.
15
+ 3. Help the user decide next actions.
16
+
17
+ ---
18
+
19
+ ## Architecture
20
+
21
+ ```
22
+ User → /sungen:dashboard [screen...]
23
+
24
+
25
+ sungen dashboard CLI (deterministic — no AI tokens)
26
+ ├─ Discovery: qa/screens/* + qa/flows/*
27
+ ├─ Reuse delivery parsers (.feature, .spec.ts, test-data.yaml, results.json)
28
+ ├─ Build DashboardSnapshot JSON
29
+ ├─ Write qa/dashboard/history/<runId>.json (max 20 retained, oldest pruned)
30
+ ├─ Inject payload into pre-built HTML template
31
+ └─ Write qa/dashboard/index.html (~1MB, fully self-contained)
32
+ ```
33
+
34
+ Source modules: `src/dashboard/*.ts` + `src/exporters/json-exporter.ts`.
35
+ UI source: `dashboard/` (built once, ships in npm package as `dist/dashboard/templates/index.html`).
36
+
37
+ ---
38
+
39
+ ## Required sources (CLI tolerates missing files)
40
+
41
+ | # | Source | Path | Required? |
42
+ |---|--------|------|-----------|
43
+ | 1 | Feature file | `qa/screens/<name>/features/<name>.feature` (or `qa/flows/...`) | Yes — screens without a feature are skipped |
44
+ | 2 | Test data | `qa/screens/<name>/test-data/<name>.yaml` | Optional — `{{vars}}` fall back to literal |
45
+ | 3 | Compiled spec | `specs/generated/<name>/<name>.spec.ts` | Optional — flagged as "Not compiled" if missing |
46
+ | 4 | Test results | `specs/generated/<name>/<name>-test-result.json` (or `test-results/results.json`) | Optional — TCs show as "Pending" if missing |
47
+
48
+ Unlike `sungen delivery`, the dashboard CLI is **forgiving** — it always renders whatever data is available. Pre-flight is implicit, not blocking.
49
+
50
+ ---
51
+
52
+ ## Output structure
53
+
54
+ ```
55
+ qa/dashboard/
56
+ ├── index.html # share-ready single-file report
57
+ └── history/
58
+ ├── 2026-04-26T...Z.json # past snapshots, oldest → newest
59
+ ├── 2026-04-27T...Z.json
60
+ └── … # max 20, older pruned automatically
61
+ ```
62
+
63
+ Both should be committed to git so collaborators see the same trend lines.
64
+
65
+ ---
66
+
67
+ ## Dashboard views
68
+
69
+ | View | What it shows |
70
+ |------|---------------|
71
+ | **Overview** | Stat cards (total/passed/failed/pending), pass-rate donut, priority bar chart, trend mini-chart, per-screen progress bars |
72
+ | **Suites** | Tree: screen → scenarios; filter by search/status/priority; click → detail modal with steps, expected, error, trace |
73
+ | **Trends** | Pass-rate line chart + stacked status bars across all retained runs (requires ≥2 runs) |
74
+ | **Compare** | Pick base/head run; per-screen Δ table; lists of newly passing/failing/added/removed/changed tests |
75
+ | **Export** | Browser-side CSV / XLSX download. One-button generation, no server. Same column layout as `sungen delivery` |
76
+
77
+ Trends + Compare are disabled in the sidebar until at least 2 runs exist in history.
78
+
79
+ ---
80
+
81
+ ## CLI command reference
82
+
83
+ ```bash
84
+ # All screens + flows
85
+ sungen dashboard
86
+
87
+ # Specific targets
88
+ sungen dashboard kudos awards flow/checkout
89
+
90
+ # Skip history persistence (one-off / CI ephemeral)
91
+ sungen dashboard --no-history
92
+
93
+ # Cap retained history (default: 20)
94
+ sungen dashboard --max-history 50
95
+
96
+ # Auto-open in default browser
97
+ sungen dashboard --open
98
+ ```
99
+
100
+ ---
101
+
102
+ ## Skill responsibilities (when invoked from /sungen:dashboard)
103
+
104
+ 1. **Run the CLI** with whatever arguments came from `$ARGUMENTS`.
105
+ 2. **Show the CLI output verbatim** — do not summarize, paraphrase, or omit warnings.
106
+ 3. **Offer next-step options via `AskUserQuestion`** based on what just happened:
107
+ - On success → open dashboard, share file, run more tests, build for another screen, done.
108
+ - On error → diagnose from the error message; common causes are missing `qa/` directories or no targets.
109
+ 4. **Do NOT** parse `.feature`, `.spec.ts`, or results files yourself — that is the CLI's job.
110
+ 5. **Do NOT** touch files under `qa/dashboard/` directly — only the CLI writes there.
111
+
112
+ ---
113
+
114
+ ## Sharing the dashboard
115
+
116
+ The HTML is self-contained:
117
+ - No CDN or external font — system font stack only.
118
+ - All JS, CSS, charts, and the SheetJS library are inlined.
119
+ - The snapshot payload sits in `<script id="__SUNGEN_DASHBOARD__" type="application/json">…</script>`.
120
+
121
+ Acceptable sharing: email, Slack upload, S3 bucket, committed in git. The recipient opens it directly, no install required. ~1MB on disk, ~300KB gzipped over the wire.
@@ -28,7 +28,14 @@ export default defineConfig({
28
28
  /* Output file path is controlled by PLAYWRIGHT_JSON_OUTPUT_NAME env var for per-screen isolation. */
29
29
  reporter: [
30
30
  ['html'],
31
- ['json', { outputFile: process.env.PLAYWRIGHT_JSON_OUTPUT_NAME || 'test-results/results.json' }],
31
+ [
32
+ 'json',
33
+ {
34
+ outputFile:
35
+ process.env.PLAYWRIGHT_JSON_OUTPUT_NAME ||
36
+ 'test-results/results.json',
37
+ },
38
+ ],
32
39
  ],
33
40
  /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
34
41
  use: {
@@ -40,6 +47,18 @@ export default defineConfig({
40
47
 
41
48
  /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
42
49
  trace: 'on-first-retry',
50
+
51
+ /**
52
+ * Capture screenshot after each test failure.
53
+ * See https://playwright.dev/docs/api/class-testoptions#test-options-screenshot
54
+ */
55
+ screenshot: 'only-on-failure',
56
+
57
+ /**
58
+ * Record video for each test, but remove all videos from successful test runs.
59
+ * See https://playwright.dev/docs/api/class-testoptions#test-options-video
60
+ */
61
+ // video: 'retain-on-failure',
43
62
  },
44
63
 
45
64
  /* Configure projects for major browsers */