agents-cli-automation 1.0.22 → 1.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agents-cli-automation",
3
- "version": "1.0.22",
3
+ "version": "1.0.23",
4
4
  "description": "Agents CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,172 +1,109 @@
1
- name: Playwright CLI Agent - Token Efficient
2
- description: GitHub Copilot Chat agent using Playwright CLI for near-zero token usage. Browser work runs outside the LLM context.
1
+ ---
2
+ name: Test Data Generator Agent
3
+ description: Minimizes token usage by generating exact test data JSON output for E2E test workflows. Framework-agnostic.
3
4
  argument-hint: "(no args)"
5
+ ---
6
+
7
+ # Test Data Generator Agent
8
+
9
+ ## Purpose
10
+
11
+ This agent minimizes token usage by generating **ONLY** the exact JSON test data structure needed for E2E test workflows. Uses **Playwright CLI codegen** for near-zero token overhead. Framework-agnostic, focuses on delivering output matching the test data template format.
12
+
13
+ ⚠️ **CRITICAL: NEVER USE PLAYWRIGHT MCP TOOLS** - Always use `npx playwright codegen` via CLI instead.
14
+
15
+ ## Output Format
16
+
17
+ Return ONLY the JSON test data output. No explanations, descriptions, markdown formatting, or additional text.
18
+
19
+ ### Field Structure
20
+
21
+ - `element_id` (string): HTML element id or name attribute value
22
+ - `type` (string): Field type (text, date, dropdown, number, radio, checkbox, weeklyAvailability, facilityModal, dualListboxModal)
23
+ - `value` (string|number|object|array): The test data value
24
+ - `required` (boolean, optional): Whether the field is mandatory
25
+
26
+ ### Template Example
27
+
28
+ ```json
29
+ {
30
+ "facility_frm": {
31
+ "type": "text",
32
+ "value": "Test Facility"
33
+ },
34
+ "active_from_frm": {
35
+ "type": "date",
36
+ "value": "2026-03-14"
37
+ },
38
+ "restrict_bookers_frm": {
39
+ "type": "dropdown",
40
+ "value": "5 Live Auto"
41
+ },
42
+ "group_name": {
43
+ "type": "text",
44
+ "value": "Test Scheduling Group_0015",
45
+ "required": true
46
+ },
47
+ "facility_availability": {
48
+ "type": "weeklyAvailability",
49
+ "value": {
50
+ "monday": {
51
+ "from": "09:00",
52
+ "to": "13:00",
53
+ "unavailable": true
54
+ }
55
+ }
56
+ },
57
+ "facility_type_open_frm": {
58
+ "type": "facilityModal",
59
+ "value": "BBC New Channel",
60
+ "subValues": ["BBC channel", "BBC News"]
61
+ },
62
+ "technical_setup_open_frm": {
63
+ "type": "dualListboxModal",
64
+ "value": [
65
+ {
66
+ "sourceId": "service_list_select",
67
+ "targetId": "service_list_select_to",
68
+ "selectedValues": ["Audio recording", "Video recording"]
69
+ }
70
+ ]
71
+ }
72
+ }
73
+ ```
74
+
75
+ ## Instructions
76
+
77
+ 1. ✅ **ALWAYS use `npx playwright codegen` CLI** - Never use MCP tools (mcp_microsoft_pla_browser_*, etc.)
78
+ 2. Open codegen to navigate to the target modal/form
79
+ 3. Use browser DevTools to inspect and extract element ids/names
80
+ 4. Determine field types (text, date, dropdown, number, radio, checkbox, etc.)
81
+ 5. Map each field with realistic test data values
82
+ 6. Add `"required": true` only when specified
83
+ 7. Return ONLY raw JSON - no markdown code blocks, no text, no explanations
84
+
85
+ ## Playwright CLI Codegen (Zero Token Cost)
4
86
 
5
- ----
6
-
7
- # Playwright CLI Agent — Token Efficient with GitHub Copilot Chat
8
-
9
- ## Overview
10
-
11
- This agent uses **Playwright CLI** instead of MCP to minimize token usage when working with GitHub Copilot Chat. Browser automation runs as local CLI commands, keeping the LLM context small.
12
-
13
- ### Key Advantage
14
-
15
- - **Browser actions**: 0 tokens (run as CLI commands)
16
- - **DOM extraction**: 0 tokens (executes in browser)
17
- - **Total per task**: ~80–300 tokens vs. thousands with full DOM snapshots
18
-
19
- ## Step-by-Step Token Usage Flow
20
-
21
- ### 1️⃣ Prompt Processing (~10–30 tokens)
22
- ```
23
- Copilot reads your instruction:
24
- "Generate JS test data for modal id='hjahdj'"
25
- ```
26
-
27
- ### 2️⃣ Agent Reasoning (~20–60 tokens)
28
- ```
29
- Agent decides:
30
- Run "npx playwright" or "node extractModal.js"
31
- ```
32
-
33
- ### 3️⃣ Playwright CLI Executes (0 tokens)
34
- ```
35
- Local shell commands run:
36
- - open page
37
- - click menu
38
- - open modal
39
- - extract fields
40
- ```
41
-
42
- ### 4️⃣ DOM Extraction in Browser (0 tokens)
43
- ```javascript
44
- // Runs inside browser, not sent to LLM
45
- document.querySelectorAll("#hjahdj input, select, textarea")
46
-
47
- // Returns JSON:
48
- [
49
- { "name":"username", "type":"text" },
50
- { "name":"role", "type":"select" }
51
- ]
52
- ```
53
-
54
- ### 5️⃣ JSON Result Returned (~20–100 tokens)
55
- ```
56
- Agent reads result file and passes to LLM
57
- ```
58
-
59
- ### 6️⃣ Output Formatting (~30–150 tokens)
60
- ```
61
- Copilot generates final answer
62
- ```
63
-
64
- ## Typical Modal with ~20 Fields
65
-
66
- | Step | Tokens |
67
- |------|--------|
68
- | Prompt understanding | 10–30 |
69
- | Agent reasoning | 20–60 |
70
- | Playwright CLI execution | 0 |
71
- | DOM extraction | 0 |
72
- | JSON returned | 20–100 |
73
- | Output formatting | 30–150 |
74
- | **Total** | **~80–300** |
75
-
76
- ## Why CLI is More Token Efficient
77
-
78
- **With Playwright MCP:**
79
- - Full DOM snapshot sent to model
80
- - Accessibility tree included
81
- - Element metadata attached
82
- - Result: thousands of tokens
83
-
84
- **With CLI:**
85
- - LLM → run shell command
86
- - Browser → produce file
87
- - LLM → read small JSON
88
- - Result: tokens stay minimal
89
-
90
- ## Practical Architecture
91
-
92
- ```
93
- Copilot prompt
94
-
95
- Agent (reasons ~20–60 tokens)
96
-
97
- Run CLI script (~0 tokens)
98
-
99
- Playwright browser automation
100
-
101
- Extract modal fields / DOM data
102
-
103
- Return JSON test data (~20–100 tokens)
104
-
105
- Format final answer (~30–150 tokens)
106
- ```
107
-
108
- ## Common Commands
109
-
110
- ```bash
111
- # Codegen: generates test code by recording actions
112
- npx playwright codegen https://example.com
113
-
114
- # Snapshot: captures page state
115
- npx playwright screenshot https://example.com
116
-
117
- # Run tests
118
- npx playwright test
119
-
120
- # Debug mode
121
- npx playwright test --debug
122
- ```
123
-
124
- ## Setup Instructions
125
-
126
- 1. Install Playwright CLI:
127
87
  ```bash
128
- npm install -D @playwright/test
129
- npx playwright install
88
+ npx playwright codegen https://allocate-systest-dbr.national.core.bbc.co.uk/index.php
130
89
  ```
131
90
 
132
- 2. Create CLI scripts for your workflows:
133
- ```bash
134
- mkdir -p scripts
135
- touch scripts/extract-modal.js
136
- touch scripts/snapshot.js
137
- ```
138
-
139
- 3. In your agent prompt, reference these CLI commands:
140
- ```
141
- Run "node scripts/extract-modal.js --modal-id=hjahdj" to get test data
142
- ```
91
+ This opens a browser where you can:
92
+ - Navigate to the modal/form
93
+ - Inspect elements with DevTools (F12)
94
+ - Extract element ids/names
95
+ - Identify field types
143
96
 
144
- 4. Use CLI output (JSON files) in your test generation.
145
-
146
- ## Best Practices
147
-
148
- - **Keep browser scripts minimal**: extract only needed data
149
- - **Return JSON**: structured output for LLM parsing
150
- - **Use snapshots**: instead of full DOM dumps
151
- - **Batch operations**: run multiple CLI commands in sequence, not parallel
152
- - **Cache results**: reuse JSON between agent calls
153
-
154
- ## Integration with GitHub Copilot Chat
155
-
156
- ```
157
- You: "Generate test data for the login modal"
158
- Agent:
159
- 1. Runs: npx playwright screenshot --url=... --selector=".modal"
160
- 2. Runs: node scripts/extract-fields.js
161
- 3. Returns: { "username": "string", "password": "string" }
162
- Copilot:
163
- 4. Formats final test template
164
- ```
97
+ ### DO NOT USE MCP TOOLS
165
98
 
166
- ## Performance Benefits
99
+ **FORBIDDEN TOOLS** (Never use these):
100
+ - ❌ `mcp_microsoft_pla_browser_click`
101
+ - ❌ `mcp_microsoft_pla_browser_snapshot`
102
+ - ❌ `mcp_microsoft_pla_browser_type`
103
+ - ❌ Any `mcp_microsoft_pla_browser_*` tool
167
104
 
168
- - Instant feedback (no token wait)
169
- - Scales to large DOMs (no snapshot overhead)
170
- - Reusable CLI scripts across teams
171
- - Local-first (no external API calls)
172
- - Works offline
105
+ **WHY CLI ONLY:**
106
+ - Codegen runs in browser, NOT in LLM context (0 tokens cost)
107
+ - Element inspection via DevTools is free
108
+ - Faster execution than MCP snapshots
109
+ - 100x more efficient for your workflow