@sun-asterisk/sungen 2.6.15 → 2.7.0-beta.1

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 (90) hide show
  1. package/dist/cli/index.js +3 -1
  2. package/dist/cli/index.js.map +1 -1
  3. package/dist/exporters/feature-parser.d.ts +9 -2
  4. package/dist/exporters/feature-parser.d.ts.map +1 -1
  5. package/dist/exporters/feature-parser.js +12 -4
  6. package/dist/exporters/feature-parser.js.map +1 -1
  7. package/dist/orchestrator/ai-rules-updater.d.ts.map +1 -1
  8. package/dist/orchestrator/ai-rules-updater.js +10 -0
  9. package/dist/orchestrator/ai-rules-updater.js.map +1 -1
  10. package/dist/orchestrator/project-initializer.d.ts +5 -0
  11. package/dist/orchestrator/project-initializer.d.ts.map +1 -1
  12. package/dist/orchestrator/project-initializer.js +16 -0
  13. package/dist/orchestrator/project-initializer.js.map +1 -1
  14. package/dist/orchestrator/templates/ai-instructions/claude-cmd-create-test.md +9 -1
  15. package/dist/orchestrator/templates/ai-instructions/claude-cmd-review.md +13 -12
  16. package/dist/orchestrator/templates/ai-instructions/claude-cmd-run-test.md +4 -2
  17. package/dist/orchestrator/templates/ai-instructions/claude-config.md +1 -1
  18. package/dist/orchestrator/templates/ai-instructions/claude-skill-delivery.md +1 -1
  19. package/dist/orchestrator/templates/ai-instructions/claude-skill-gherkin-syntax.md +14 -0
  20. package/dist/orchestrator/templates/ai-instructions/claude-skill-selector-fix.md +57 -11
  21. package/dist/orchestrator/templates/ai-instructions/claude-skill-selector-keys.md +41 -31
  22. package/dist/orchestrator/templates/ai-instructions/claude-skill-tc-generation.md +386 -326
  23. package/dist/orchestrator/templates/ai-instructions/claude-skill-tc-review.md +268 -90
  24. package/dist/orchestrator/templates/ai-instructions/claude-skill-test-design-techniques.md +23 -49
  25. package/dist/orchestrator/templates/ai-instructions/claude-skill-viewpoint-group-a-data-entry.md +203 -0
  26. package/dist/orchestrator/templates/ai-instructions/claude-skill-viewpoint-group-b-data-ops.md +179 -0
  27. package/dist/orchestrator/templates/ai-instructions/claude-skill-viewpoint-group-c-data-explore.md +233 -0
  28. package/dist/orchestrator/templates/ai-instructions/claude-skill-viewpoint-group-d-display.md +226 -0
  29. package/dist/orchestrator/templates/ai-instructions/claude-skill-viewpoint-group-e-identity.md +177 -0
  30. package/dist/orchestrator/templates/ai-instructions/claude-skill-viewpoint.md +69 -240
  31. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-create-test.md +9 -1
  32. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-review.md +13 -12
  33. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-run-test.md +4 -2
  34. package/dist/orchestrator/templates/ai-instructions/copilot-config.md +1 -1
  35. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-delivery.md +1 -1
  36. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-gherkin-syntax.md +15 -21
  37. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-selector-fix.md +61 -15
  38. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-selector-keys.md +41 -31
  39. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-tc-generation.md +371 -324
  40. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-tc-review.md +262 -102
  41. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-test-design-techniques.md +23 -49
  42. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-viewpoint-group-a-data-entry.md +203 -0
  43. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-viewpoint-group-b-data-ops.md +179 -0
  44. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-viewpoint-group-c-data-explore.md +233 -0
  45. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-viewpoint-group-d-display.md +226 -0
  46. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-viewpoint-group-e-identity.md +177 -0
  47. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-viewpoint.md +69 -240
  48. package/dist/orchestrator/templates/qa-context.md +90 -0
  49. package/dist/orchestrator/templates/readme.md +16 -13
  50. package/package.json +9 -1
  51. package/src/cli/index.ts +4 -1
  52. package/src/exporters/feature-parser.ts +12 -4
  53. package/src/orchestrator/ai-rules-updater.ts +10 -0
  54. package/src/orchestrator/project-initializer.ts +20 -0
  55. package/src/orchestrator/templates/ai-instructions/claude-cmd-create-test.md +9 -1
  56. package/src/orchestrator/templates/ai-instructions/claude-cmd-review.md +13 -12
  57. package/src/orchestrator/templates/ai-instructions/claude-cmd-run-test.md +4 -2
  58. package/src/orchestrator/templates/ai-instructions/claude-config.md +1 -1
  59. package/src/orchestrator/templates/ai-instructions/claude-skill-delivery.md +1 -1
  60. package/src/orchestrator/templates/ai-instructions/claude-skill-gherkin-syntax.md +14 -0
  61. package/src/orchestrator/templates/ai-instructions/claude-skill-selector-fix.md +57 -11
  62. package/src/orchestrator/templates/ai-instructions/claude-skill-selector-keys.md +41 -31
  63. package/src/orchestrator/templates/ai-instructions/claude-skill-tc-generation.md +386 -326
  64. package/src/orchestrator/templates/ai-instructions/claude-skill-tc-review.md +268 -90
  65. package/src/orchestrator/templates/ai-instructions/claude-skill-test-design-techniques.md +23 -49
  66. package/src/orchestrator/templates/ai-instructions/claude-skill-viewpoint-group-a-data-entry.md +203 -0
  67. package/src/orchestrator/templates/ai-instructions/claude-skill-viewpoint-group-b-data-ops.md +179 -0
  68. package/src/orchestrator/templates/ai-instructions/claude-skill-viewpoint-group-c-data-explore.md +233 -0
  69. package/src/orchestrator/templates/ai-instructions/claude-skill-viewpoint-group-d-display.md +226 -0
  70. package/src/orchestrator/templates/ai-instructions/claude-skill-viewpoint-group-e-identity.md +177 -0
  71. package/src/orchestrator/templates/ai-instructions/claude-skill-viewpoint.md +69 -240
  72. package/src/orchestrator/templates/ai-instructions/copilot-cmd-create-test.md +9 -1
  73. package/src/orchestrator/templates/ai-instructions/copilot-cmd-review.md +13 -12
  74. package/src/orchestrator/templates/ai-instructions/copilot-cmd-run-test.md +4 -2
  75. package/src/orchestrator/templates/ai-instructions/copilot-config.md +1 -1
  76. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-delivery.md +1 -1
  77. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-gherkin-syntax.md +15 -21
  78. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-selector-fix.md +61 -15
  79. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-selector-keys.md +41 -31
  80. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-tc-generation.md +371 -324
  81. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-tc-review.md +262 -102
  82. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-test-design-techniques.md +23 -49
  83. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-viewpoint-group-a-data-entry.md +203 -0
  84. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-viewpoint-group-b-data-ops.md +179 -0
  85. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-viewpoint-group-c-data-explore.md +233 -0
  86. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-viewpoint-group-d-display.md +226 -0
  87. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-viewpoint-group-e-identity.md +177 -0
  88. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-viewpoint.md +69 -240
  89. package/src/orchestrator/templates/qa-context.md +90 -0
  90. package/src/orchestrator/templates/readme.md +16 -13
@@ -1,268 +1,97 @@
1
1
  ---
2
2
  name: sungen-viewpoint
3
- description: '10 UI patterns x 4 viewpoints — structured checklist for test case generation and review. Auto-loaded by create-test and review commands.'
3
+ description: '17 UI patterns x 4 viewpoints — structured checklist for test case
4
+ generation and review. Auto-loaded by create-test and review commands.'
4
5
  user-invocable: false
5
6
  ---
6
7
 
7
- ## 4 Viewpoints
8
-
9
- | VP | Focus | Keyword |
10
- |---|---|---|
11
- | **UI/UX** | Interface states, layout, feedback | VP-UI |
12
- | **Data & Validate** | Input constraints, data integrity, error messages | VP-VAL |
13
- | **Logic** | Business rules, interactions, state changes | VP-LOGIC |
14
- | **Security** | Auth, injection, permissions | VP-SEC |
15
-
16
- ## Shared Checks (apply across all patterns)
17
-
18
- These appear in multiple patterns — test once per screen, not per pattern:
19
-
20
- | Check | ER |
21
- |---|---|
22
- | **Loading State** | Spinner/skeleton shown, UI interaction locked during fetch |
23
- | **Empty State** | Clear message when no data, layout intact |
24
- | **XSS/Injection** | Malicious input sanitized to plain text, never executed |
25
- | **URL Manipulation** | Invalid URL params fallback to defaults, no server crash |
26
-
27
- ---
28
-
29
- ## GROUP 1: DATA ENTRY
30
-
31
- ### 1. Form & Inputs
32
-
33
- **UI/UX**
34
- - Field States: disabled/readonly fields dimmed and locked, no interaction allowed
35
- - Button States: Submit disabled when form invalid, auto-enabled when valid
36
- - Keyboard Nav: Tab order correct, Enter submits form
37
-
38
- **Data & Validate**
39
- - Required/Optional: blank required field shows error; optional allows blank
40
- - Boundaries & Format: min/max length, format (email, number) with error messages
41
- - Whitespace: auto-trim or reject spaces-only input
42
- - Error Recovery: error at correct field, disappears immediately when user corrects data
43
-
44
- **Logic**
45
- - Field Dependencies: Field A value determines Field B status/options
46
- - Double Submit Prevention: button disabled after first click, only 1 request sent
47
- - Success Flow: redirect / success toast / form reset
48
- - Failure Flow: server error retains form data + shows system error
49
-
50
- **Security**
51
- - → Shared: XSS/Injection
52
-
53
- ---
54
-
55
- ## GROUP 2: DATA MANAGEMENT
8
+ ## How to use this skill
56
9
 
57
- ### 2. Data Table
10
+ This skill is a **router**. The detailed checklists live in 5 group files — load only the ones relevant to the screen under test.
58
11
 
59
- **UI/UX**
60
- - Shared: Empty State, Loading State
61
- - Truncation: long content shows `...` with tooltip on hover, column width stable
62
- - Sticky Elements: fixed header on vertical scroll, fixed action column on horizontal scroll
12
+ 1. Read the **4 Viewpoints** and **Shared Checks** below (always).
13
+ 2. Identify which UI patterns the screen contains, resolve any overlap via **Pattern selection** below, then read **only** the matching group file(s) from the routing table.
14
+ 3. Generate Tier 1 (`@high`) scenarios first, then Tier 2 (`@normal` + `@low`). Apply each Shared Check **once per screen**, not once per pattern.
63
15
 
64
- **Data & Validate**
65
- - Record Count: "Total records" on UI matches server data exactly
66
- - Row Limit: displayed rows never exceed configured page size
67
- - Cell Integrity: cell data matches database, correct format (date, currency, status label)
68
-
69
- **Logic**
70
- - Sorting: column sort refreshes table with correct order, updates header icon
71
- - Row Actions: Edit/Delete/View buttons act on correct row ID
72
-
73
- **Security**
74
- - RBAC: hide sensitive columns or privileged action buttons without authority
75
- - → Shared: XSS/Injection (data from DB displayed safely)
76
-
77
- ---
78
-
79
- ### 3. Create / Add
80
-
81
- **UI/UX**
82
- - Blank Slate: all fields empty or BA-specified defaults, NO cache from previous operation
83
- - Required Indicator: required fields marked with visual cue (e.g., red *)
84
- - Unsaved Changes: navigate away with dirty form → browser/system warning popup
85
-
86
- **Data & Validate**
87
- - → Inherited: all Form & Inputs validation rules apply
88
- - Unique Constraint: duplicate unique field (e.g., Employee ID) → reject save, inline error
89
- - Data Dependency: selecting parent field loads correct child options
90
-
91
- **Logic**
92
- - Save & Close: toast notification, redirect to list, new record visible per sort rule
93
- - Save & Add Another: save to DB, form resets to blank for next entry
94
- - Double Submit Prevention: → same as Form & Inputs
95
- - Cancel: form closes, NO garbage record in DB, next open shows blank form
96
-
97
- **Security**
98
- - API Bypass / 403: unauthorized POST → system blocks (403 Forbidden), no record created
99
- - → Shared: XSS/Injection (persisted safely, not executed on display)
100
-
101
- ---
102
-
103
- ### 4. Update / Edit
104
-
105
- **UI/UX**
106
- - Pre-fill / Data Binding: all fields display exact current DB data (text, dropdown, radio, date...)
107
- - Readonly Fields: identity fields (ID, username, employee code) disabled, no interaction
108
- - Cancel: no data changed in DB; if dirty → unsaved changes warning
109
-
110
- **Data & Validate**
111
- - → Inherited: all Form & Inputs validation rules apply
112
- - Unique Self: saving without changing unique field → success, no self-duplicate error
113
- - Unique Conflict: changing unique field to existing value → duplicate error, block save
114
- - Unchanged Submit: Save disabled until dirty, or success without DB UPDATE
115
-
116
- **Logic**
117
- - Update Success: toast "Updated successfully", new data reflects on UI immediately without reload
118
- - Concurrent Edit: another user already edited → conflict warning, require reload
119
-
120
- **Security**
121
- - Authorization / 403: access edit without permission → 403 page
122
- - Not Found / 404: edit deleted object → 404
123
-
124
- ---
16
+ > All checklist items are written in English. Render scenario names, step text, and test IDs in English.
125
17
 
126
- ### 5. Delete
18
+ ## Routing table
127
19
 
128
- **UI/UX**
129
- - Confirmation: click Delete → MUST show confirmation dialog, delete button in warning color
130
- - Cancel: popup closes, record intact on UI and DB, no API called
131
- - Success Update: toast "Deleted successfully", record disappears immediately without reload
132
- - Pagination Fallback: delete only record on current page auto-navigate to previous page
133
-
134
- **Data & Validate Dependencies**
135
- - Independent: delete succeeds normally
136
- - Referenced (Restrict): delete parent with children blocked, clear error "in use at [Module]"
137
- - Referenced (Cascade): warning first, then deletes parent AND all related children
138
- - Referenced (Set Null): parent deleted, child reference set to Unassigned/Empty
139
-
140
- **Logic Storage**
141
- - Soft Delete: record hidden from UI, DB retains with status flag (is_deleted, deleted_at)
142
- - Hard Delete: record removed from UI AND permanently deleted from DB
143
-
144
- **Security**
145
- - Deleted Access / 404: soft or hard delete direct URL/API returns 404
146
- - API Bypass: API delete on restricted object backend rejects with business error, no 500
147
-
148
- ---
149
-
150
- ### 6. Search
151
-
152
- **UI/UX**
153
- - → Shared: Empty State ("No results found"), Loading State
154
- - Clear Action: search box empties, list reloads default data
155
-
156
- **Data & Validate**
157
- - Whitespace: auto-trim, results match cleaned keyword
158
- - Input Limits: prevent beyond max length or show error
159
- - Normalization: case-insensitive, handles accented characters correctly
160
-
161
- **Logic**
162
- - Matching: partial/exact match returns correct results, no 500
163
- - Multi-keyword: results based on AND/OR logic per spec
164
- - Debounce: ~300ms delay before API call
165
-
166
- **Security**
167
- - → Shared: XSS/Injection
168
- - Wildcards: `%`, `_`, `*` treated as literal text (escaped), not DB commands
169
-
170
- ---
171
-
172
- ### 7. Filter
173
-
174
- **UI/UX**
175
- - Feedback: selected filters displayed as tags/badges
176
- - Persistence: collapse/expand retains selected values
177
- - Conflicts: conflicting conditions show "No data" message, layout intact
178
-
179
- **Data & Validate**
180
- - Range Validation: start > end or min > max → field error, Apply disabled
181
- - Dropdown Integrity: options match 100% of actual data, hide unauthorized values
182
-
183
- **Logic**
184
- - AND/OR Logic: results satisfy correct filter logic, total count updated
185
- - Dependent Filters: selecting Filter A updates Filter B options
186
- - Reset & Navigation: reset returns original data or preserves state per spec
187
-
188
- **Security**
189
- - → Shared: URL Manipulation
190
-
191
- ---
192
-
193
- ### 8. Pagination
194
-
195
- **UI/UX**
196
- - Boundary States: Previous/First disabled on page 1, Next/Last disabled on last page
197
- - Active Page: highlighted, loading effect during page transition
198
- - Hidden: pagination bar hidden when data fits one page
199
-
200
- **Data & Validate**
201
- - Label Consistency: "Viewing X of Y" matches actual data exactly
202
- - Zero Records: pagination hidden, empty state displayed
203
-
204
- **Logic**
205
- - Navigation: loads correct dataset for page (page 2, limit 10 = records 11-20)
206
- - Change Page Size: shows correct quantity, resets to page 1
207
- - Interaction Resets: new search/filter resets to page 1
208
-
209
- **Security**
210
- - → Shared: URL Manipulation
211
-
212
- ---
213
-
214
- ## GROUP 3: NAVIGATION & CONTAINERS
215
-
216
- ### 9. Modal / Dialog
217
-
218
- **UI/UX**
219
- - Overlay: centered modal, backdrop blur, background scroll locked
220
- - Focus Trapping: Tab key cycles only within modal elements
221
- - Responsive: modal resizes, action buttons always visible or scrollable
20
+ | UI element on the screen | Pattern | Read file |
21
+ |---|---|---|
22
+ | Plain input form (settings, profile, contact) | 1. Form & Inputs **(base)** | `group-a-data-entry.md` |
23
+ | File picker / drop zone | 2. File Upload | `group-a-data-entry.md` |
24
+ | Bulk import / export | 3. Import / Export | `group-a-data-entry.md` |
25
+ | "Add" / "Create" / "New" | 4. Create / Add | `group-b-data-ops.md` |
26
+ | "Edit" / pencil icon / inline edit | 5. Update / Edit | `group-b-data-ops.md` |
27
+ | "Delete" / trash icon | 6. Delete | `group-b-data-ops.md` |
28
+ | Rows + columns grid | 7. Data Table | `group-c-data-explore.md` |
29
+ | Search box / search bar | 8. Search | `group-c-data-explore.md` |
30
+ | Filter controls (dropdown, date range, checkboxes) | 9. Filter | `group-c-data-explore.md` |
31
+ | Card / list grid, infinite scroll, "Load More" | 10. List / Card View | `group-c-data-explore.md` |
32
+ | Charts / KPI cards / dashboard | 11. Chart / Analytics | `group-d-display.md` |
33
+ | Overlay panel on top of the page | 12. Modal / Dialog | `group-d-display.md` |
34
+ | Side menu / tabs / breadcrumb / top nav | 13. Navigation | `group-d-display.md` |
35
+ | Toast / snackbar / alert / banner | 14. Notification / Toast / Alert | `group-d-display.md` |
36
+ | Login form / logout button | 15. Login / Logout | `group-e-identity.md` |
37
+ | Sign-up form / SSO | 16. Register | `group-e-identity.md` |
38
+ | Forgot / reset / change password | 17. Password Management | `group-e-identity.md` |
39
+
40
+ ## Pattern selection (precedence & inheritance)
41
+
42
+ A screen often matches several patterns at once — a login screen is *both* a form and an authentication flow. Use these rules so the choice is deterministic and scenarios are never duplicated:
43
+
44
+ 1. **Most specific wins.** Pick the most specialized pattern as the screen's primary section. Auth and CRUD forms route to their specific pattern, NOT to Form & Inputs:
45
+ - Login/logout **15**, sign-up **16**, forgot/reset/change password **17**
46
+ - Create form **4**, edit form **5**
47
+ 2. **Form & Inputs (1) is a BASE pattern, not a sibling.** Generate it as its own section only for a plain form with no more-specific role (settings, profile, contact). When a specialization applies, do NOT also create a separate "Form & Inputs" section.
48
+ 3. **Inheritance.** A specialized form pattern (4, 5, 15, 16, 17) **inherits** Form & Inputs field-level validation (required, format, maxlength, whitespace, real-time error clear) and adds its own rules. Apply the inherited checks inside the specialized section — generate each check once, never twice.
49
+ 4. **Genuinely parallel pairs** these cover different concerns; choose per the table:
50
+
51
+ | If the screen has… | Decision |
52
+ |---|---|
53
+ | A grid of records | Pick **7. Data Table** *or* **10. List/Card** by layout (rows+columns → Table; cards/tiles/infinite-scroll → List/Card) — not both for the same surface |
54
+ | Both a keyword box and filter controls | Apply **8. Search** *and* **9. Filter** (Search = free-text match; Filter = structured narrowing) + one combined AND-logic scenario |
55
+ | A form rendered inside an overlay | Apply the form's pattern (1/4/5/15…) for fields/submit **and** **12. Modal/Dialog** for open/close/focus-trap/backdrop |
222
56
 
223
- **Data & Validate**
224
- - Dismiss Actions: close via X, Cancel, Escape, backdrop click → resets data to default on reopen
57
+ ## 4 Viewpoints
225
58
 
226
- **Logic**
227
- - Submit Success: action button shows loading, modal closes, background data updated
228
- - Submit Failure: modal stays open, shows error message, retains entered data
229
- - Stacked Modals: Modal B over A has higher z-index, closing B keeps A intact
59
+ | VP | Focus | Tag |
60
+ |---|---|---|
61
+ | **UI/UX** | Interface state, layout, visual feedback | VP-UI |
62
+ | **Data & Validate** | Input constraints, data integrity, error messages | VP-VAL |
63
+ | **Logic** | Business rules, interactions, state changes | VP-LOGIC |
64
+ | **Security** | Authentication, authorization, injection | VP-SEC |
230
65
 
231
- **Security**
232
- - DOM Cleanup: remove HTML from DOM on close to protect sensitive data
233
- - Reload: handles deep linking if present
66
+ **Classification rules:**
67
+ - VP-UI = state that is always true regardless of what the user does (element present, layout, label)
68
+ - VP-VAL = outcome depends on the input *value* (valid / invalid / boundary)
69
+ - VP-LOGIC = outcome depends on the user's *action* (click, submit, navigate)
70
+ - VP-SEC = checks access control and malicious input
234
71
 
235
72
  ---
236
73
 
237
- ## GROUP 4: DISPLAY PATTERNS
238
-
239
- ### 10. List / Card
240
-
241
- **UI/UX**
242
- - → Shared: Empty State, Loading State
243
- - Hover Effect: shadow/scale on card hover
244
- - Content: text truncation without breaking card height, placeholder image on broken image
74
+ ## Shared Checks
245
75
 
246
- **Data & Validate**
247
- - Integrity: data fields (price, status, tag) 100% accurate vs system
248
- - Total Count: matches actual database count after filtering
76
+ Generate **once per screen**, do not repeat for each pattern.
77
+ Each pattern only points back with "Shared checks applied: [name]".
249
78
 
250
- **Logic**
251
- - Navigation: clicking card navigates to correct detail page
252
- - Direct Actions: Like/Add to Cart updates immediately without reloading list
253
- - Infinite Scroll / Load More: appends records, maintains scroll position
254
- - Layout Toggle: Grid/List view switch changes UI but preserves data
79
+ | Check | Condition → Expected | VP | Priority |
80
+ |---|---|---|---|
81
+ | **Loading State** | Data fetch in progress → spinner/skeleton shown, user cannot interact | UI | @normal |
82
+ | **Empty State** | Query returns 0 records → clear message shown, layout does not break | UI | @normal |
83
+ | **XSS** | Script tag entered into a field rendered as literal text, not executed | SEC | @high |
84
+ | **SQL injection** | SQL payload entered into a field → DB unaffected, no data exposed | SEC | @high |
85
+ | **URL Manipulation** | URL params wrong/missing/out-of-range → fallback to default, no 500 crash | SEC | @high |
255
86
 
256
- **Security**
257
- - RBAC: hide sensitive data or privileged buttons from DOM
258
- - Network Resilience: error message + "Retry" button on connection loss
87
+ > **SQL injection — 2 layers for search/LIKE fields**: (1) field-level: UI blocks special chars → `@high` automated; (2) API-level: if the field reaches a LIKE query (search, partial-match), send `1 OR 1=1` straight to the API endpoint (bypassing the UI) → verify a parameterized query is used → `@high @manual`. Missing layer 2 = a real attack vector is overlooked even when field validation is correct.
259
88
 
260
89
  ---
261
90
 
262
91
  ## Security Tag Rules
263
92
 
264
93
  For VP-SEC scenarios testing **unauthorized access** (no login, wrong role, direct URL):
265
- - Use **`@no-auth`** tag — runs without authentication to verify redirect/block.
94
+ - Use the **`@no-auth`** tag — runs without authentication to verify the redirect/block.
266
95
  - Do NOT use `@manual` for these — they are automatable.
267
96
 
268
97
  ```gherkin
@@ -0,0 +1,90 @@
1
+ # Project Context
2
+
3
+ > Read by the AI before generating test cases for any screen in this project.
4
+ > Fill in what applies — leave sections empty if not relevant.
5
+ > **The more specific you are, the more accurate the generated test cases.**
6
+
7
+ ---
8
+
9
+ ## Project Overview
10
+
11
+ **Application:**
12
+ <!-- One sentence: what does this app do? -->
13
+ <!-- Example: B2B award nomination platform for enterprise HR teams. -->
14
+
15
+ **Target users:**
16
+ <!-- Who uses this app and in what context? -->
17
+ <!-- Example: HR managers submit nominations; employees view results. -->
18
+
19
+ **Domain notes:**
20
+ <!-- Key terminology, conventions, or constraints the AI should know. -->
21
+ <!-- Example: "Nomination = an award record. Once submitted, status cannot revert to Draft." -->
22
+ <!-- Example: "All monetary values are in JPY. No decimal places." -->
23
+
24
+ ---
25
+
26
+ ## Auth Roles
27
+
28
+ > The AI maps these directly to `@auth:X` tags and generates permission-boundary test scenarios.
29
+ > Leave the table empty (or delete it) if the app has no auth system.
30
+
31
+ | Role | Can do | Cannot do |
32
+ |------|--------|-----------|
33
+ | | | |
34
+
35
+ <!--
36
+ Example:
37
+ | Role | Can do | Cannot do |
38
+ |---------|---------------------------------------------|--------------------------------------|
39
+ | admin | All CRUD, manage users, configure settings | Nothing blocked |
40
+ | manager | Create/edit records, view reports | Delete records, manage users |
41
+ | staff | View and submit own records only | Edit others' records, view reports |
42
+ -->
43
+
44
+ ---
45
+
46
+ ## Testing Strategy
47
+
48
+ **Focus areas** — what to cover thoroughly:
49
+ <!-- List from: functional, security, ui, accessibility, performance -->
50
+ <!-- Example: functional, security -->
51
+
52
+ **Mandatory coverage:**
53
+ <!-- Rules that override the AI's default tier decisions for every screen. -->
54
+ <!-- Example: "Every screen with admin-only actions MUST have a non-admin blocked-access scenario." -->
55
+ <!-- Example: "All free-text inputs MUST have XSS + SQL injection scenarios regardless of screen risk level." -->
56
+
57
+ **Deprioritize / skip:**
58
+ <!-- What to move to @low or skip entirely for this project. -->
59
+ <!-- Example: "Skip VP-UI cosmetic checks (label/placeholder presence) — handled separately by design review." -->
60
+ <!-- Example: "Skip accessibility scenarios — separate audit planned." -->
61
+
62
+ ---
63
+
64
+ ## Global Business Rules
65
+
66
+ > Rules that apply across multiple screens.
67
+ > The AI adds these to the Coverage Map for every screen as `[G]`-tagged Business rules.
68
+ > Screen-specific rules belong in `requirements/spec.md`, not here.
69
+
70
+ <!-- - Soft-delete only: records are never hard-deleted, only marked inactive -->
71
+ <!-- - All timestamps stored in UTC, displayed in UTC+7 -->
72
+ <!-- - Pagination default: 20 items per page; max 100 -->
73
+ <!-- - File uploads: PNG/JPG/PDF only, max 5 MB -->
74
+ <!-- - After any write operation, the list view must refresh automatically -->
75
+
76
+ ---
77
+
78
+ ## Error Message Patterns
79
+
80
+ > If your app follows consistent validation error formats, list them here.
81
+ > The AI uses these to fill `test-data.yaml` error keys when `spec.md` doesn't specify exact text.
82
+ > Leave empty to let the AI infer from spec.md.
83
+
84
+ - Required field: `<!-- "This field is required" -->`
85
+ - Max length: `<!-- "Must be X characters or less" -->`
86
+ - Min length: `<!-- "Must be at least X characters" -->`
87
+ - Invalid format: `<!-- "Invalid format" -->`
88
+ - Unique constraint: `<!-- "Already exists" -->`
89
+ - Not found: `<!-- "Not found" -->`
90
+ - Unauthorized: `<!-- "You do not have permission to perform this action" -->`
@@ -12,14 +12,16 @@ sungen generate → compiles Gherkin + selectors + data → Playwright .spec.ts
12
12
  ## Directory Structure
13
13
 
14
14
  ```
15
- ├── qa/screens/<name>/
16
- │ ├── features/ # .feature files (Gherkin)
17
- │ ├── selectors/ # Element locator YAML mappings
18
- │ ├── test-data/ # Test data YAML values
19
- └── requirements/ # Screen specs, UI designs, notes
20
- ├── spec.md # Structured screen specification
21
- ├── ui/ # Screenshots, mockups, design images
22
- └── test-viewpoint.md # Edge cases, decisions (optional)
15
+ ├── qa/
16
+ │ ├── context.md # Project-wide context: roles, testing strategy, global rules (fill once)
17
+ │ ├── screens/<name>/
18
+ ├── features/ # .feature files (Gherkin)
19
+ │ ├── selectors/ # Element locator YAML mappings
20
+ ├── test-data/ # Test data YAML values
21
+ │ └── requirements/ # Screen specs, UI designs, notes
22
+ ├── spec.md # Structured screen specification
23
+ │ │ ├── ui/ # Screenshots, mockups, design images
24
+ │ │ └── test-viewpoint.md # Edge cases, decisions (optional)
23
25
  ├── specs/
24
26
  │ └── generated/ # Auto-generated Playwright tests
25
27
  ├── .claude/
@@ -66,11 +68,12 @@ Scaffolds `qa/screens/<name>/` with empty feature, selectors, test-data, and req
66
68
  | `/sungen:create-test login` | `/sungen-create-test login` |
67
69
 
68
70
  AI acts as a **Senior QA Engineer**:
69
- 1. Reads `requirements/spec.md` for screen specs (fields, validation, business rules, states)
70
- 2. Optionally explores the live page via Playwright MCP to verify and supplement
71
- 3. Identifies screen sections asks user which to focus on
72
- 4. Generates **20+ scenarios per viewpoint** (UI/UX, Validation, Logic, Security) for each section
73
- 5. Confirms test plan before generating `.feature` + `test-data.yaml`
71
+ 1. Reads `qa/context.md` for project-wide context (roles, testing strategy, global rules)
72
+ 2. Reads `requirements/spec.md` for screen specs (fields, validation, business rules, states)
73
+ 3. Optionally explores the live page via Playwright MCP to verify and supplement
74
+ 4. Identifies screen sections asks user which to focus on
75
+ 5. Generates **20+ scenarios per viewpoint** (UI/UX, Validation, Logic, Security) for each section
76
+ 6. Confirms test plan before generating `.feature` + `test-data.yaml`
74
77
 
75
78
  ### Step 3: Compile & run tests
76
79
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sun-asterisk/sungen",
3
- "version": "2.6.15",
3
+ "version": "2.7.0-beta.1",
4
4
  "description": "Deterministic E2E Test Compiler - Gherkin + Selectors → Playwright tests",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -65,6 +65,14 @@
65
65
  "peerDependencies": {
66
66
  "@playwright/test": "^1.57.0"
67
67
  },
68
+ "overrides": {
69
+ "brace-expansion": "^5.0.6",
70
+ "uuid": "^11.1.1"
71
+ },
72
+ "resolutions": {
73
+ "brace-expansion": "^5.0.6",
74
+ "uuid": "^11.1.1"
75
+ },
68
76
  "files": [
69
77
  "dist",
70
78
  "bin",
package/src/cli/index.ts CHANGED
@@ -15,13 +15,16 @@ import { registerFigmaCommand } from './commands/figma';
15
15
  import { registerAddFlowCommand } from './commands/add-flow';
16
16
  import { registerDashboardCommand } from './commands/dashboard';
17
17
 
18
+ // Read version from package.json so `--version` never drifts from the released version.
19
+ const { version } = require('../../package.json') as { version: string };
20
+
18
21
  async function main() {
19
22
  const program = new Command();
20
23
 
21
24
  program
22
25
  .name('sungen')
23
26
  .description('Deterministic E2E Test Compiler — Gherkin + Selectors → Playwright')
24
- .version('2.6.15');
27
+ .version(version);
25
28
 
26
29
  // Global options
27
30
  program
@@ -178,13 +178,21 @@ export function mapVpToCategory2(vpId: string | undefined, scenarioName?: string
178
178
  }
179
179
 
180
180
  /**
181
- * Generate TC ID: keep VP ID exactly as written (e.g. VP-UI-001) when present,
182
- * or fall back to <SCREEN_UPPER>-<NNN> for scenarios without a VP ID.
181
+ * Generate TC ID, namespaced by screen/flow so it is globally unique across the
182
+ * whole project. This matters because the dashboard tracks each test case by its
183
+ * tcId — without a namespace, `VP-SEC-001` collides across screens (every screen
184
+ * starts its VP numbering at 001) and one screen's results overwrite another's.
185
+ *
186
+ * - With VP ID: VP-SEC-001 + screen "login" → "LOGIN-SEC-001" (strip leading "VP-")
187
+ * - Without VP ID: "LOGIN-001" via the fallback index
188
+ *
189
+ * The scenario title in the .feature still keeps the bare `VP-SEC-001` (human-facing).
183
190
  */
184
191
  export function generateTcId(screen: string, vpId: string | undefined, fallbackIndex: number): string {
192
+ const screenUpper = screen.toUpperCase().replace(/[^A-Z0-9]/g, '-');
185
193
  if (vpId) {
186
- return vpId;
194
+ const vpCore = vpId.replace(/^VP-/, '');
195
+ return `${screenUpper}-${vpCore}`;
187
196
  }
188
- const screenUpper = screen.toUpperCase().replace(/[^A-Z0-9]/g, '-');
189
197
  return `${screenUpper}-${String(fallbackIndex).padStart(3, '0')}`;
190
198
  }
@@ -43,6 +43,11 @@ export const AI_RULES_FILE_MAPPING: [string, string][] = [
43
43
  ['claude-skill-selector-fix.md', '.claude/skills/sungen-selector-fix/SKILL.md'],
44
44
  ['claude-skill-tc-review.md', '.claude/skills/sungen-tc-review/SKILL.md'],
45
45
  ['claude-skill-viewpoint.md', '.claude/skills/sungen-viewpoint/SKILL.md'],
46
+ ['claude-skill-viewpoint-group-a-data-entry.md', '.claude/skills/sungen-viewpoint/group-a-data-entry.md'],
47
+ ['claude-skill-viewpoint-group-b-data-ops.md', '.claude/skills/sungen-viewpoint/group-b-data-ops.md'],
48
+ ['claude-skill-viewpoint-group-c-data-explore.md', '.claude/skills/sungen-viewpoint/group-c-data-explore.md'],
49
+ ['claude-skill-viewpoint-group-d-display.md', '.claude/skills/sungen-viewpoint/group-d-display.md'],
50
+ ['claude-skill-viewpoint-group-e-identity.md', '.claude/skills/sungen-viewpoint/group-e-identity.md'],
46
51
  ['claude-skill-delivery.md', '.claude/skills/sungen-delivery/SKILL.md'],
47
52
  ['claude-skill-dashboard.md', '.claude/skills/sungen-dashboard/SKILL.md'],
48
53
  ['claude-skill-capture-figma.md', '.claude/skills/sungen-capture-figma/SKILL.md'],
@@ -63,6 +68,11 @@ export const AI_RULES_FILE_MAPPING: [string, string][] = [
63
68
  ['github-skill-sungen-selector-fix.md', '.github/skills/sungen-selector-fix/SKILL.md'],
64
69
  ['github-skill-sungen-tc-review.md', '.github/skills/sungen-tc-review/SKILL.md'],
65
70
  ['github-skill-sungen-viewpoint.md', '.github/skills/sungen-viewpoint/SKILL.md'],
71
+ ['github-skill-sungen-viewpoint-group-a-data-entry.md', '.github/skills/sungen-viewpoint/group-a-data-entry.md'],
72
+ ['github-skill-sungen-viewpoint-group-b-data-ops.md', '.github/skills/sungen-viewpoint/group-b-data-ops.md'],
73
+ ['github-skill-sungen-viewpoint-group-c-data-explore.md', '.github/skills/sungen-viewpoint/group-c-data-explore.md'],
74
+ ['github-skill-sungen-viewpoint-group-d-display.md', '.github/skills/sungen-viewpoint/group-d-display.md'],
75
+ ['github-skill-sungen-viewpoint-group-e-identity.md', '.github/skills/sungen-viewpoint/group-e-identity.md'],
66
76
  ['github-skill-sungen-delivery.md', '.github/skills/sungen-delivery/SKILL.md'],
67
77
  ['github-skill-sungen-dashboard.md', '.github/skills/sungen-dashboard/SKILL.md'],
68
78
  ['github-skill-sungen-capture-figma.md', '.github/skills/sungen-capture-figma/SKILL.md'],
@@ -39,6 +39,9 @@ export class ProjectInitializer {
39
39
  // Create directories
40
40
  this.createDirectories();
41
41
 
42
+ // Create qa/context.md for QA lead to fill project-wide context
43
+ this.createContext();
44
+
42
45
  // Ensure package.json and install Playwright
43
46
  await this.setupDependencies();
44
47
 
@@ -363,6 +366,23 @@ export class ProjectInitializer {
363
366
 
364
367
  }
365
368
 
369
+ /**
370
+ * Create qa/context.md for the QA lead to fill project-wide context
371
+ * (roles, testing strategy, global rules, error patterns).
372
+ */
373
+ private createContext(): void {
374
+ const contextPath = path.join(this.cwd, 'qa', 'context.md');
375
+
376
+ if (fs.existsSync(contextPath)) {
377
+ this.skippedItems.push('qa/context.md');
378
+ return;
379
+ }
380
+
381
+ const content = this.readTemplate('qa-context.md');
382
+ fs.writeFileSync(contextPath, content, 'utf-8');
383
+ this.createdItems.push('qa/context.md');
384
+ }
385
+
366
386
  /**
367
387
  * Create specs/base.ts for shared browser context
368
388
  */
@@ -32,7 +32,15 @@ Parse **name** from `$ARGUMENTS`. If missing, ask the user.
32
32
  - If no → fresh creation. Use `AskUserQuestion` to ask generation scope:
33
33
  - **Tier 1 — Critical & High priority** — ~10-15 scenarios/section covering happy paths, core validation, security basics **(Recommended)**
34
34
  - **Full coverage — All tiers at once** — generates Tier 1 + 2 + 3 in one run. Large output (~40-60 scenarios/section), best for experienced users who want complete coverage immediately
35
- 3. **Read requirements & resolve visual source** — check `qa/<screens|flows>/<name>/requirements/`:
35
+ 3. **Read project context + screen requirements**
36
+
37
+ **Project context** — check `qa/context.md` (project root, not screen-specific):
38
+ - If exists → read it. Extract: roles, testing strategy directives, global business rules, error patterns.
39
+ - Summarize what you found in one line (e.g. `"Roles: admin/staff/user | Strategy: focus security, skip VP-UI T1 | 2 global rules"`).
40
+ - These are carried into the Coverage Map when invoking `sungen-tc-generation`.
41
+ - If absent → continue without it, no action needed.
42
+
43
+ **Screen requirements** — check `qa/<screens|flows>/<name>/requirements/`:
36
44
  - If `spec.md` exists → read it as PRIMARY source (sections, fields, validation rules, business rules, states).
37
45
  - If `test-viewpoint.md` exists → read it. If it only contains HTML comments (scaffold template), use `AskUserQuestion` to ask:
38
46
  - **Fill test-viewpoint.md first** — I'll help you identify edge cases, known issues, and design decisions for this screen before generating tests