Skip to content

Commit adb3d19

Browse files
committed
docs(ai-docs): keep generic playwright docs and drop code deltas
1 parent 2a910fb commit adb3d19

25 files changed

Lines changed: 335 additions & 1609 deletions

AGENTS.md

Lines changed: 20 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
This is the main orchestrator for AI assistants working on this repository. It routes you to the correct templates and documentation based on the developer's task.
66

7-
**For every developer request:** (1) Identify task type (A–E below). (2) If the work is in an existing package or widget, load that scope's ai-docs (see [Package and widget ai-docs reference](#package-and-widget-ai-docs-reference)) and follow its AGENTS.md. (3) Open the template for that type and complete its mandatory pre-steps (see [Mandatory pre-steps by task type](#mandatory-pre-steps-by-task-type)). (4) Then follow the rest of this guide and the template.
7+
**For every developer request:** (1) Identify task type (A–F below). (2) If the work is in an existing package, widget, or test framework scope, load that scope's ai-docs (see [Package and widget ai-docs reference](#package-and-widget-ai-docs-reference)) and follow its AGENTS.md. (3) Open the template for that type and complete its mandatory pre-steps (see [Mandatory pre-steps by task type](#mandatory-pre-steps-by-task-type)). (4) Then follow the rest of this guide and the template.
88

99
---
1010

@@ -32,35 +32,36 @@ If the developer's message contains multiple distinct task types (for example, "
3232
### Task Types
3333

3434
**A. Create New Widget**
35-
3635
- Developer wants to build a completely new widget from scratch
3736
- **Route to:** [templates/new-widget/00-master.md](./ai-docs/templates/new-widget/00-master.md)
3837
- **Follow:** All 7 modules (pre-questions → validation)
3938
- **⚠️ MANDATORY FIRST STEP:** Collect design input (see below)
4039

4140
**B. Fix Bug in Existing Widget**
42-
4341
- Developer reports a bug or issue in existing code
4442
- **Route to:** [templates/existing-widget/bug-fix.md](./ai-docs/templates/existing-widget/bug-fix.md)
4543
- **Follow:** Bug fix workflow with root cause analysis
4644

4745
**C. Add Feature to Existing Widget**
48-
4946
- Developer wants to enhance existing widget with new functionality
5047
- **Route to:** [templates/existing-widget/feature-enhancement.md](./ai-docs/templates/existing-widget/feature-enhancement.md)
5148
- **Follow:** Feature addition workflow with backward compatibility
5249

5350
**D. Generate/Update Documentation Only**
54-
5551
- Developer needs documentation for existing code
5652
- **Route to:** [templates/documentation/create-agent-md.md](./ai-docs/templates/documentation/create-agent-md.md) and [templates/documentation/create-architecture-md.md](./ai-docs/templates/documentation/create-architecture-md.md)
5753
- **Follow:** Documentation templates (reusable for all packages)
5854

5955
**E. Understanding Architecture**
60-
6156
- Developer needs to understand how something works
6257
- **Read:** That scope's `ai-docs/AGENTS.md` (usage) and `ai-docs/ARCHITECTURE.md` (technical details); use [Package and widget ai-docs reference](#package-and-widget-ai-docs-reference) to find the path.
63-
- **Available for:** station-login, user-state, store, cc-components, cc-widgets, ui-logging, test-fixtures; for task package use per-widget ai-docs (CallControl, IncomingTask, OutdialCall, TaskList).
58+
- **Available for:** station-login, user-state, store, cc-components, cc-widgets, ui-logging, test-fixtures, playwright; for task package use per-widget ai-docs (CallControl, IncomingTask, OutdialCall, TaskList).
59+
60+
**F. Playwright E2E Test Work**
61+
- Developer wants to add/update/stabilize Playwright tests, suites, sets, or test framework docs
62+
- **Route to:** [templates/playwright/00-master.md](./ai-docs/templates/playwright/00-master.md)
63+
- **Follow:** Playwright template workflow (pre-questions → implementation → validation)
64+
- **⚠️ MANDATORY FIRST STEP:** Complete pre-questions in [templates/playwright/01-pre-questions.md](./ai-docs/templates/playwright/01-pre-questions.md)
6465

6566
---
6667

@@ -72,21 +73,21 @@ If the developer's message contains multiple distinct task types (for example, "
7273

7374
```typescript
7475
// ❌ WRONG - Circular dependencies
75-
import {Widget} from '@webex/cc-widgets'; // In widget package code
76-
import {Widget} from '@webex/cc-widget-name'; // In cc-components code
76+
import { Widget } from '@webex/cc-widgets'; // In widget package code
77+
import { Widget } from '@webex/cc-widget-name'; // In cc-components code
7778
```
7879

7980
**ALWAYS use this pattern:**
8081

8182
```typescript
8283
// ✅ CORRECT - Proper dependency flow
8384
// In widget code:
84-
import {Component} from '@webex/cc-components';
85+
import { Component } from '@webex/cc-components';
8586
import store from '@webex/cc-store';
86-
import {withMetrics} from '@webex/cc-ui-logging';
87+
import { withMetrics } from '@webex/cc-ui-logging';
8788

8889
// In cc-widgets aggregator (ONLY):
89-
import {Widget} from '@webex/cc-widget-name';
90+
import { Widget } from '@webex/cc-widget-name';
9091
```
9192

9293
**Dependency Flow (One Direction Only):**
@@ -111,12 +112,10 @@ cc-widgets → widget packages → cc-components → store → SDK
111112
#### Required Input (ONE of these):
112113

113114
1. **Figma Link/File**
114-
115115
- Share Figma link or file
116116
- LLM will extract design tokens, components, interactions
117117

118118
2. **Screenshot/Mockup**
119-
120119
- Upload image of desired widget UI
121120
- LLM will analyze colors, layout, components, spacing
122121

@@ -131,7 +130,6 @@ cc-widgets → widget packages → cc-components → store → SDK
131130
#### If Design Input Provided:
132131

133132
**Analyze and document:**
134-
135133
- **Colors:** Extract hex/RGB values or Momentum tokens
136134
- **Components:** Identify Momentum UI components to use
137135
- **Layout:** Grid, flex, spacing patterns (8px/0.5rem grid)
@@ -177,6 +175,7 @@ Before generating or changing any code, you MUST complete the **pre-step section
177175
| **C. Add Feature** | [existing-widget/feature-enhancement.md](./ai-docs/templates/existing-widget/feature-enhancement.md) | [Pre-Enhancement Questions](./ai-docs/templates/existing-widget/feature-enhancement.md) (feature info, requirements, compatibility, design input) |
178176
| **D. Documentation only** | documentation templates | Optional: confirm scope with developer (no code change) |
179177
| **E. Understanding** | Package ai-docs | None (read-only) |
178+
| **F. Playwright E2E Test Work** | [playwright/00-master.md](./ai-docs/templates/playwright/00-master.md) | [Pre-Questions](./ai-docs/templates/playwright/01-pre-questions.md) (scope, scenarios, setup/utilities, stability expectations) |
180179

181180
---
182181

@@ -185,9 +184,7 @@ Before generating or changing any code, you MUST complete the **pre-step section
185184
**Before generating code, load appropriate context:**
186185

187186
### Always Read (Minimal Context)
188-
189187
1. **Pattern documentation** - [patterns/](./ai-docs/patterns/) folder
190-
191188
- [typescript-patterns.md](./ai-docs/patterns/typescript-patterns.md) - Type safety, naming conventions
192189
- [react-patterns.md](./ai-docs/patterns/react-patterns.md) - Component patterns, hooks
193190
- [mobx-patterns.md](./ai-docs/patterns/mobx-patterns.md) - State management with observer HOC
@@ -212,29 +209,22 @@ Before generating or changing any code, you MUST complete the **pre-step section
212209
| **cc-widgets** | [packages/contact-center/cc-widgets/ai-docs/AGENTS.md](packages/contact-center/cc-widgets/ai-docs/AGENTS.md) | Same folder |
213210
| **ui-logging** | [packages/contact-center/ui-logging/ai-docs/AGENTS.md](packages/contact-center/ui-logging/ai-docs/AGENTS.md) | Same folder |
214211
| **samples-cc-react-app** | [widgets-samples/cc/samples-cc-react-app/ai-docs/AGENTS.md](widgets-samples/cc/samples-cc-react-app/ai-docs/AGENTS.md) | Same folder if present |
212+
| **playwright framework** | [playwright/ai-docs/AGENTS.md](playwright/ai-docs/AGENTS.md) | [playwright/ai-docs/ARCHITECTURE.md](playwright/ai-docs/ARCHITECTURE.md) |
215213

216214
**Task package note:** The task package has multiple widgets (CallControl, IncomingTask, OutdialCall, TaskList). When working on one of them, use that widget's ai-docs path above, not a generic task path.
217215

218216
### Conditionally Read
219217

220218
**If using SDK APIs:**
221-
222219
- Scan: [contact-centre-sdk-apis/contact-center.json](./contact-centre-sdk-apis/contact-center.json)
223220
- Find available methods, events, types
224221
- Check method signatures before using
225222

226-
**If modifying store:**
227-
228-
- Read: `packages/contact-center/store/ai-docs/AGENTS.md`
229-
- Read: `packages/contact-center/store/ai-docs/ARCHITECTURE.md`
230-
231-
**If creating/using components:**
232-
233-
- Read: `packages/contact-center/cc-components/ai-docs/AGENTS.md`
223+
**If working on Playwright tests/framework:**
224+
- Read: `playwright/ai-docs/AGENTS.md`
225+
- Read: `playwright/ai-docs/ARCHITECTURE.md`
226+
- Use: `ai-docs/templates/playwright/00-master.md` and complete `01-pre-questions.md` before implementation
234227

235-
**If working with metrics/logging:**
236-
237-
- Read: `packages/contact-center/ui-logging/ai-docs/AGENTS.md`
238228
---
239229

240230
## Step 3: SDK API Consultation (Before Code Generation)
@@ -246,7 +236,6 @@ Before generating or changing any code, you MUST complete the **pre-step section
246236
#### 1. Identify Required SDK Functionality
247237

248238
Based on widget requirements, list needed operations:
249-
250239
- Making calls? → Search: "call", "dial", "telephony", "outdial"
251240
- Fetching agents? → Search: "agent", "buddy", "team"
252241
- Managing tasks? → Search: "task", "interaction", "contact"
@@ -257,15 +246,13 @@ Based on widget requirements, list needed operations:
257246
**File:** [contact-centre-sdk-apis/contact-center.json](./contact-centre-sdk-apis/contact-center.json)
258247

259248
**Search Strategy:**
260-
261249
- Use keyword search in JSON
262250
- Look for method names, descriptions
263251
- Check similar/related methods
264252

265253
#### 3. Verify API Signature
266254

267255
For each method found, confirm:
268-
269256
- ✅ Method name (exact spelling)
270257
- ✅ Parameters (names, types, required vs optional)
271258
- ✅ Return type
@@ -345,7 +332,6 @@ SDK (Contact Center API)
345332
```
346333

347334
**Key Rules:**
348-
349335
- Widget consumes SDK methods via the store (through a hook) — it NEVER calls the SDK directly
350336
- Component NEVER accesses store (receives props)
351337
- Always use `observer` HOC for widgets
@@ -362,7 +348,6 @@ SDK (Contact Center API)
362348
You must have already completed that template's pre-step section (Pre-Enhancement Questions, Pre-Fix Questions, or 01-pre-questions as applicable); if not, do that first.
363349

364350
**During code generation:**
365-
366351
1. Follow pattern documentation strictly
367352
2. Reference existing widgets for examples
368353
3. Use proper TypeScript types (no `any`)
@@ -468,7 +453,6 @@ yarn build
468453
```
469454

470455
**Common errors:**
471-
472456
- Missing types → Add type definitions
473457
- Import errors → Check paths and exports
474458
- Circular dependencies → Refactor imports
@@ -487,60 +471,51 @@ yarn build
487471
### Documentation to Consider
488472

489473
**If new widget created:**
490-
491474
- Generated via templates (AGENTS.md + ARCHITECTURE.md)
492475

493476
**If widget modified:**
494-
495477
- Update: `packages/contact-center/{widget-name}/ai-docs/AGENTS.md` (if API changed)
496478
- Update: `packages/contact-center/{widget-name}/ai-docs/ARCHITECTURE.md` (if architecture changed)
497479
- Add: New examples to AGENTS.md (if new use cases)
498480
- Update: Troubleshooting in ARCHITECTURE.md (if new issues discovered)
499481

500482
**If store modified:**
501-
502483
- Update: `packages/contact-center/store/ai-docs/AGENTS.md`
503484
- Update: `packages/contact-center/store/ai-docs/ARCHITECTURE.md`
504485

505486
**If component library modified:**
506-
507487
- Update: `packages/contact-center/cc-components/ai-docs/AGENTS.md`
508488

509489
**If new pattern established:**
510-
511490
- Update: Relevant pattern file in [patterns/](./ai-docs/patterns/)
512491

513492
**If architecture changed:**
514-
515493
- Update: Relevant architecture documentation as needed
516494

517495
**If Playwright E2E framework/docs changed:**
518-
519496
- Update: `playwright/ai-docs/AGENTS.md`
520497
- Update: `playwright/ai-docs/ARCHITECTURE.md`
521498
- Update relevant modules in: `ai-docs/templates/playwright/`
499+
522500
---
523501

524502
## Step 7: Validation & Review
525503

526504
**Before marking task complete:**
527505

528506
1. **Run validation checks**
529-
530507
- Tests pass: `yarn test:unit`
531508
- Linting passes: `yarn test:styles`
532509
- Build succeeds: `yarn build`
533510

534511
2. **Code quality checks**
535-
536512
- Follows patterns
537513
- No layer violations
538514
- Error handling present
539515
- Types are correct
540516
- Code is precise and concise (no unnecessary complexity or dead code)
541517

542518
3. **Documentation checks**
543-
544519
- AGENTS.md updated if needed
545520
- ARCHITECTURE.md updated if needed
546521
- Examples work
@@ -583,19 +558,16 @@ ccWidgets/
583558
## Common Questions to Ask
584559

585560
**Before starting any work:**
586-
587561
- "What component/widget are you working on?"
588562
- "Is this a new widget, bug fix, or enhancement?"
589563
- "Do you have design specifications (Figma, screenshots)?"
590564

591565
**During code generation:**
592-
593566
- "Should I add/update tests?"
594567
- "Do you want examples in documentation?"
595568
- "Should I update the sample apps?"
596569

597570
**After code generation:**
598-
599571
- "The code is complete. Should I update documentation?"
600572
- "Would you like to review before I mark this complete?"
601573
- "Should I check for any other impacted components?"
@@ -607,14 +579,12 @@ ccWidgets/
607579
**Location:** [contact-centre-sdk-apis/contact-center.json](./contact-centre-sdk-apis/contact-center.json)
608580

609581
**Contents:**
610-
611582
- All exposed SDK APIs (methods, events, types)
612583
- Method signatures and parameters
613584
- Event names and data structures
614585
- Links to SDK source code (next branch)
615586

616587
**Usage:**
617-
618588
- Scan JSON when using SDK methods
619589
- Search for API by name or functionality
620590
- Check parameter types and return values
@@ -627,7 +597,6 @@ ccWidgets/
627597
## Success Criteria
628598

629599
**Code generation/fix is successful when:**
630-
631600
- ✅ Follows architecture pattern (Widget → Hook → Component → Store → SDK)
632601
- ✅ Uses patterns correctly (TypeScript, React, MobX, WC)
633602
- ✅ Includes proper error handling

ai-docs/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ Widget (Observer) → Custom Hook (Business Logic) → Component (UI) → Store
176176

177177
**Repository Patterns:**
178178
- `ai-docs/patterns/` - TypeScript, MobX, React, Web Components, Testing patterns
179-
- `ai-docs/templates/` - Task templates (new widget, bug fix, feature enhancement, documentation, Playwright spec generation)
179+
- `ai-docs/templates/` - Task templates (new widget, bug fix, feature enhancement, documentation, Playwright)
180180

181181
**Component Documentation:**
182182
- `packages/*/ai-docs/README.md` - API and usage
@@ -200,4 +200,4 @@ See [AGENTS.md](./AGENTS.md) for AI navigation guidance, task-based workflows, a
200200

201201
---
202202

203-
_Last Updated: 2026-02-18_
203+
_Last Updated: 2026-03-04_

0 commit comments

Comments
 (0)