chrometools-mcp 1.8.2 → 2.2.0

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/CHANGELOG.md CHANGED
@@ -1,494 +1,757 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- ## [1.8.2] - 2025-12-19
6
-
7
- ### Fixed
8
- - **Code Generator Bugs** - Fixed multiple issues in test code generators
9
- - **Python generators**: Fixed comment syntax - now use `#` instead of `//`
10
- - **Python generators**: Moved `import re` to top of file instead of inline
11
- - **Java generator**: Fixed variable name conflicts - now uses unique names (`typeElement`, `hoverElement`, etc.) instead of reusing `element`
12
- - **Java generator**: Added missing imports (`JavascriptExecutor`, `Select`)
13
- - **All generators**: Implemented language-specific comment generation via `generateComment()` method
14
- - Location: `utils/code-generators/code-generator-base.js`, `playwright-python.js`, `selenium-python.js`, `selenium-java.js`
15
-
16
- ## [1.8.1] - 2025-12-19
17
-
18
- ### Added
19
- - **Smart Project Directory Detection** - Scenarios now automatically save to the correct project directory
20
- - Auto-detection cascade: `CLAUDE_PROJECT_DIR` env var `PROJECT_DIR` env var → Git root → current working directory
21
- - Optional `directory` parameter on all recorder tools (`enableRecorder`, `executeScenario`, `listScenarios`, `searchScenarios`, `getScenarioInfo`, `deleteScenario`, `exportScenarioAsCode`)
22
- - Session memory: once directory is set (explicitly or auto-detected), it's remembered for the entire MCP server session
23
- - Solves issue where scenarios were saved to unpredictable locations based on where MCP process was launched
24
- - Location: `utils/project-detector.js`, `index.js:97-115`
25
-
26
- ### Changed
27
- - **All recorder storage functions now accept `baseDir` parameter** - Breaking change for direct API usage
28
- - Updated: `saveScenario()`, `loadScenario()`, `listScenarios()`, `searchScenarios()`, `deleteScenario()`, `loadIndex()`, and all other storage functions
29
- - MCP tool users: no breaking changes, just new optional `directory` parameter
30
- - Location: `recorder/scenario-storage.js`, `recorder/scenario-executor.js`, `recorder/recorder-script.js`
31
-
32
- ## [1.8.0] - 2025-12-19
33
-
34
- ### Added
35
- - **Test Code Generation** - New MCP tool `exportScenarioAsCode` for generating executable test code from recorded scenarios
36
- - Supports 4 test frameworks: Playwright (TypeScript/Python), Selenium (Python/Java)
37
- - Automatic selector cleaning - removes unstable CSS classes (CSS Modules, styled-components, Emotion, hashed classes)
38
- - Generates clean, readable test code with comments
39
- - Smart selector stability analysis with pattern-based detection
40
- - Fallback selector selection - chooses most stable selector from fallbacks
41
- - Location: `utils/code-generators/`, `utils/selector-cleaner.js`
42
-
43
- **Unstable patterns detected:**
44
- - CSS Modules: `Button_primary__2x3yZ`
45
- - Styled-components: `sc-AbCdEf-0`
46
- - Emotion: `css-1a2b3c4d`
47
- - Hash suffixes: `component_a1b2c3d`
48
- - Random hashes: `_1a2b3c4d`
49
-
50
- **Usage:**
51
- ```javascript
52
- exportScenarioAsCode('checkout', {
53
- language: 'playwright-typescript',
54
- cleanSelectors: true,
55
- includeComments: true
56
- })
57
- ```
58
-
59
- ## [1.7.4] - 2025-12-19
60
-
61
- ### Changed
62
- - **executeScenario auto-opens browser** - No longer throws error when no page is open
63
- - Automatically opens browser at scenario's `entryUrl` if no page is currently open
64
- - Eliminates need to manually call `openBrowser` before executing scenarios
65
- - Improves user experience by treating browser opening as a side effect
66
- - Falls back gracefully: shows error only if scenario has no `entryUrl`
67
- - Location: `index.js:3417-3469`
68
-
69
- ## [1.7.3] - 2025-12-19
70
-
71
- ### Fixed
72
- - **Fixed CSS selector generation crash** - `analyzePage` now handles attribute values with special characters
73
- - Added `isSafeSelectorValue()` function to validate attribute values before using in selectors
74
- - Filters out attributes containing problematic characters: `["'\\[]{}()]`
75
- - Added try-catch blocks to prevent selector syntax errors
76
- - Example: `button[data-counter="["b"]"]` (invalid) is now skipped
77
- - Location: `element-finder-utils.js:302-360`
78
-
79
- ### Improved
80
- - **Recorder now skips hidden elements** - Prevents recording actions on invisible elements
81
- - Added `isElementVisible()` function to check element visibility before recording
82
- - Checks: offsetWidth/Height, display, visibility, opacity
83
- - Applies to all event types: click, type, select, upload, hover, drag
84
- - Prevents scenarios with duplicate/invisible element actions (e.g., Yandex search with hidden input)
85
- - Console logs when skipping hidden elements for debugging
86
- - Location: `recorder/recorder-script.js:1173-1188`
87
-
88
- ## [1.7.2] - 2025-12-16
89
-
90
- ### Added
91
- - **Figma API Token Setup documentation** - Added comprehensive guide on how to obtain and configure Figma Personal Access Token
92
- - Step-by-step instructions for getting token from Figma account settings
93
- - Configuration examples for both Claude Desktop and Claude Code
94
- - Environment variable setup (`FIGMA_TOKEN`)
95
- - Note about alternative parameter-based token passing
96
-
97
- ## [1.7.1] - 2025-12-15
98
-
99
- ### Performance
100
- - **Optimized tool descriptions** - Reduced token usage by 35-45% (~1,500-2,000 tokens)
101
- - Shortened main tool descriptions from verbose to concise format
102
- - Reduced parameter descriptions (e.g., "CSS selector for element to click" → "CSS selector")
103
- - Standardized Figma tool parameters (7 tools optimized)
104
- - Pattern-based reductions across all 41 tools
105
- - Impact: Saves 1,500-2,000 tokens in every request to Claude
106
- - Examples:
107
- - `analyzePage`: 95 tokens 30 tokens (68% reduction)
108
- - `screenshot`: 75 tokens → 25 tokens (66% reduction)
109
- - `listNetworkRequests`: 50 tokens → 20 tokens (60% reduction)
110
-
111
- ### Changed
112
- - All tool descriptions now use imperative voice and remove redundancy
113
- - Figma tools: "Figma API token (optional if FIGMA_TOKEN env var is set)" → "API token (optional)"
114
- - Common patterns: "Milliseconds to wait" → "Wait ms", "Maximum" → "Max", etc.
115
-
116
- ## [1.7.0] - 2025-12-14
117
-
118
- ### Removed
119
- - **Removed Angular tools** - Removed all 5 Angular-specific tools to reduce context window usage
120
- - Removed tools: `listAngularComponents`, `getAngularComponent`, `callAngularMethod`, `getAngularForm`, `submitAngularForm`
121
- - Removed from: tool definitions, handlers, Zod schemas, README documentation
122
- - Impact: Reduced token usage by ~2500-3000 tokens (~10 pages of context)
123
- - Tool count: 45 40 tools
124
-
125
- ### Changed
126
- - **Simplified tool descriptions** - Removed Angular references from `screenshot` and `executeScript` descriptions
127
- - Cleaner, more focused descriptions for remaining tools
128
-
129
- ## [1.6.2] - 2025-12-14
130
-
131
- ### Fixed
132
- - **Fixed JSON Schema validation error for `callAngularMethod`** - Added missing `items` field to `args` array parameter
133
- - Error: "array schema missing items" when using with OpenAI/OpenRouter providers
134
- - Impact: Tool now works correctly with all LLM providers that validate JSON Schema strictly
135
- - Note: This tool was subsequently removed in v1.7.0
136
-
137
- ## [1.6.1] - 2025-12-03
138
-
139
- ### Changed
140
- - **Optimized `listNetworkRequests` with pagination** - Added `limit` and `offset` parameters
141
- - Default limit: 50 requests (max: 500)
142
- - Returns: `{ totalCount, returnedCount, hasMore, offset, limit, requests: [...] }`
143
- - Prevents excessive token usage when pages have hundreds of network requests
144
- - Example: `listNetworkRequests({ limit: 20, offset: 20 })` returns requests 21-40
145
-
146
- ### Performance
147
- - Reduced token usage for network request inspection on pages with many requests
148
- - AI receives pagination metadata (`hasMore`, `totalCount`) to request additional pages as needed
149
-
150
- ## [1.6.0] - 2025-12-03
151
-
152
- ### Changed
153
- - **Code organization improved** - Major refactoring to modular architecture
154
- - Created `tools/` directory with `tool-schemas.js` (all Zod validation schemas)
155
- - Created `utils/` directory with specialized utility modules:
156
- - `css-helpers.js` - CSS categorization and filtering (~133 lines)
157
- - `screenshot-processor.js` - Screenshot processing and image comparison (~210 lines)
158
- - `element-actions.js` - Element interaction actions (~115 lines)
159
- - Total **~712 lines moved to separate modules** for better maintainability
160
- - Created REFACTORING.md documenting modular structure and future improvements
161
-
162
- ### Benefits
163
- - **Better code organization** - Related functionality grouped logically
164
- - **Improved maintainability** - Easier to find and modify specific functionality
165
- - **Reusability** - Modules can be tested and used independently
166
- - **Cleaner main file** - index.js reduced by ~20% (712 lines)
167
-
168
- ### Technical Details
169
- - Backup created (index.js.backup) before refactoring
170
- - Modules are independent with no circular dependencies
171
- - Additional utility modules prepared for future integration (browser-manager, network-monitor, recorder-helper)
172
-
173
- ## [1.5.0] - 2025-12-02
174
-
175
- ### Added
176
- - **6 new Figma tools** - Major enhancement to Figma integration (total: 9 Figma tools)
177
- - `parseFigmaUrl` - Parse full Figma URLs to extract fileKey and nodeId automatically
178
- - `listFigmaPages` - Browse entire file structure: all pages and frames with IDs
179
- - `searchFigmaFrames` - Search frames/components by name across entire file
180
- - `getFigmaComponents` - Extract all components (Design System)
181
- - `getFigmaStyles` - Get all shared styles (colors, text, effects, grids)
182
- - `getFigmaColorPalette` - Extract complete color palette with usage statistics
183
- - **figma-tools.js module** - All Figma functionality moved to dedicated module for better organization
184
- - **URL support for all Figma tools** - All tools now accept full Figma URLs or fileKeys
185
- - **Automatic URL parsing** - No need to manually extract fileKey and nodeId from Figma links
186
-
187
- ### Changed
188
- - **Figma code refactored** - Moved all Figma functions to separate figma-tools.js module
189
- - **Improved Figma workflow** - Use `listFigmaPages` `searchFigmaFrames` → specific tool workflow
190
-
191
- ### Use Cases
192
- - Browse Figma files without opening Figma UI
193
- - Extract design system components and styles
194
- - Generate CSS variables from color palette
195
- - Find frames by name across all pages
196
- - Copy-paste Figma URLs directly into tools
197
-
198
- ## [1.4.0] - 2025-12-02
199
-
200
- ### Added
201
- - **getFigmaSpecs text extraction** - Extract all text content from Figma designs (buttons, labels, headings, paragraphs)
202
- - `textContent`: Direct text for TEXT nodes with character count
203
- - `allTextContent`: Array of all text nodes (name, text, visibility) from entire tree
204
- - `textSummary`: Statistics (total nodes, visible nodes, combined text)
205
- - Recursive extraction from all child elements
206
- - Example use: Get button labels, form placeholders, UI copy from designs
207
- - **getComputedCss filtering** - Intelligent CSS property filtering to reduce token usage from ~14k to ~1-2k tokens
208
- - `category` parameter: Filter by 'layout', 'typography', 'colors', 'visual', or 'all' (default)
209
- - `properties` parameter: Request specific CSS properties (e.g., `['color', 'font-size']`)
210
- - `includeDefaults` parameter: Optionally include/exclude properties with default values (default: false)
211
- - Returns metadata: total properties, filtered count, applied filters
212
- - Example: `{ selector: ".header", category: "layout" }` returns only layout-related properties
213
-
214
- ### Changed
215
- - **getFigmaSpecs children structure enhanced** - Now includes text content and dimensions for all child elements
216
-
217
- ### Performance
218
- - **getComputedCss now 7-14x more efficient** - Filtering reduces output from ~300 properties to 10-50 properties
219
- - Default behavior (no filters) filters out default values, reducing typical response from ~14k to ~3-5k tokens
220
-
221
- ## [1.3.8] - 2025-12-02
222
-
223
- ### Added
224
- - **Automatic image compression to 3 MB limit** - All screenshots and Figma images are now automatically compressed if they exceed 3 MB
225
- - Images are first compressed by reducing JPEG quality (from 85 to 10 in steps of 10)
226
- - If quality reduction is insufficient, images are scaled down to fit within the size limit
227
- - PNG images that exceed 3 MB are automatically converted to JPEG and compressed
228
- - Compression metadata includes: final file size, quality level, compression ratio, number of compression attempts
229
-
230
- ### Changed
231
- - `processScreenshot` function now includes `maxFileSize` parameter (default: 3 MB)
232
- - `getFigmaFrame` now applies automatic compression to exported Figma images
233
- - `compareFigmaToElement` now compresses all three images (Figma design, page screenshot, difference map)
234
- - All image processing preserves original dimensions by default, only scaling down if necessary to meet size limits
235
-
236
- ## [1.3.7] - 2025-12-01
237
-
238
- ### Added
239
- - **Angular-specific tools** - 5 new tools for working with Angular applications
240
- - `listAngularComponents` - Discover all Angular components on page with methods/properties
241
- - `getAngularComponent` - Get detailed info about specific component (methods, properties, state)
242
- - `callAngularMethod` - Call component methods reliably with auto change detection
243
- - `getAngularForm` - Get form data, validation state, errors (ReactiveFormsModule & Template-driven)
244
- - `submitAngularForm` - Submit forms with automatic fallback strategies (method → button → event)
245
- - **`waitForElement`** - Wait for elements to appear (autocomplete, lazy loading, dynamic content)
246
-
247
- ### Fixed (additional)
248
- - **`findElementsByText` token overflow** - removed `fullText`, added visibility check, limit 20 results
249
- - Prioritizes visible elements over hidden ones
250
- - Now returns `truncated: true` when results are limited
251
-
252
- ### Fixed
253
- - **Auto-reconnection after Chrome closure**
254
- - Browser now automatically reconnects when Chrome is closed and reopened with debug port
255
- - Added `browser.isConnected()` check before reusing cached browser instance
256
- - Added `disconnected` event handler to reset browser state
257
- - Fixes "Connection closed" error when Chrome debug session is manually restarted
258
- - **scrollTo tool now works correctly**
259
- - Fixed incorrect usage of `element.scrollIntoView()` method (not available in Puppeteer ElementHandle)
260
- - Now uses `page.evaluate()` to properly execute `scrollIntoView()` in browser context
261
- - Added `block: 'center'` for better element positioning
262
- - Increased wait time to 500ms for smooth scrolling completion
263
-
264
- ### Changed
265
- - **Angular tools descriptions updated** - emphasize use BEFORE executeScript
266
- - `getAngularComponent` - marked as PREFERRED over executeScript with ng.getComponent
267
- - `getAngularForm` - now returns both value and rawValue (shows disabled controls!)
268
- - `executeScript` - explicit warnings: DO NOT use for Angular (use specialized tools instead)
269
- - **`analyzePage` description updated** - clarified use AFTER page changes (clicks, submissions, AJAX)
270
- - Now emphasizes `refresh:true` to get current state after interactions
271
- - Compares favorably to screenshot for debugging (2-5k vs 15-25k tokens, actual data vs visual)
272
- - **`screenshot` description updated** - clarified when NOT to use (debugging data, after clicks)
273
- - Emphasizes use for visual comparison only, not for inspecting form values or state
274
- - **Network monitoring split into 3 specialized tools** (massive token reduction)
275
- - `listNetworkRequests` - compact summary (requestId, method, URL, status only)
276
- - `getNetworkRequest` - full details of single request by requestId
277
- - `filterNetworkRequests` - filter by URL pattern with full details
278
- - Replaces monolithic `getNetworkRequests` with targeted workflow
279
- - **`analyzePage` description emphasizes REQUIRED usage on every page**
280
- - Tool descriptions updated to prioritize `analyzePage` over manual element searching
281
- - `executeScript` description clarified as last resort after `analyzePage`
282
- - `smartFindElement` now recommends `analyzePage` first for better performance
283
- - `getElement` now recommends `analyzePage` for bulk element inspection
284
- - `getBrowser()` now validates connection status before returning cached browser
285
- - Browser promise is reset on disconnect for automatic reconnection
286
- - `scrollTo` implementation rewritten to use proper Puppeteer API
287
-
288
- ### Removed
289
- - `getNetworkRequests` tool (replaced by 3 specialized tools above)
290
-
291
- ## [1.3.6] - 2025-12-01
292
-
293
- ### Changed
294
- - **Optimized getNetworkRequests output for reduced token usage**
295
- - Default filter now Fetch/XHR only (excludes images, scripts, stylesheets, etc.)
296
- - Minified JSON payloads (request/response bodies now compact, no whitespace)
297
- - Essential headers only (content-type, authorization, x-api-key, set-cookie)
298
- - Conditional fields (error details only on failure, cache flag only when true)
299
- - Duration calculation instead of separate timestamp fields
300
-
301
- ### Performance
302
- - Significantly reduced output size (50-80% reduction typical)
303
- - Better for AI context windows with large API traces
304
- - Essential data preserved, noise eliminated
305
-
306
- ## [1.3.5] - 2025-01-26
307
-
308
- ### Added
309
- - **Request/Response payload and headers now included in getNetworkRequests**
310
- - `postData` - POST request body (e.g., form data, JSON payload)
311
- - `requestHeaders` - Request headers
312
- - `responseHeaders` - Response headers
313
-
314
- ### Changed
315
- - `getNetworkRequests` now returns complete request/response details
316
- - Essential for debugging API calls with payloads
317
-
318
- ### Example
319
- ```javascript
320
- getNetworkRequests({ urlPattern: 'send_otp' })
321
-
322
- // Now returns:
323
- {
324
- "url": "http://localhost:4200/api/auth/send_otp/",
325
- "method": "POST",
326
- "postData": "{\"phone\":\"+79001234567\"}", // NEW!
327
- "requestHeaders": { // NEW!
328
- "content-type": "application/json",
329
- "authorization": "Bearer ..."
330
- },
331
- "responseHeaders": { // ← NEW!
332
- "content-type": "application/json"
333
- },
334
- "status": 200,
335
- ...
336
- }
337
- ```
338
-
339
- ## [1.3.4] - 2025-01-26
340
-
341
- ### Fixed
342
- - **Network monitoring now persists across page navigations** - auto-reinitializes on navigation
343
- - Network requests are now captured correctly after form submissions, link clicks, and redirects
344
- - Added WeakSet tracking to prevent duplicate CDP session setup
345
- - Added 100ms debounce on navigation to ensure stability
346
-
347
- ### Changed
348
- - Refactored network monitoring into `setupNetworkMonitoring()` helper function
349
- - Network monitoring automatically re-enables on framenavigated events
350
- - Global `networkRequests[]` array preserves history across all navigations
351
-
352
- ### Technical Details
353
- - CDP (Chrome DevTools Protocol) session is recreated on each navigation
354
- - Network.enable is automatically re-sent after navigation completes
355
- - Request history accumulates across multiple pages in the same session
356
- - Use `getNetworkRequests({ clear: true })` to reset history when needed
357
-
358
- ### Example Use Case
359
- ```javascript
360
- // 1. Open login page
361
- openBrowser({ url: 'https://app.com/login' })
362
- // Network monitoring: ✅ active
363
-
364
- // 2. Fill form and submit (navigates to /dashboard)
365
- click({ selector: 'button[type="submit"]' })
366
- // Network monitoring: auto-reinitialized
367
- // Captures POST /api/login, GET /dashboard, etc.
368
-
369
- // 3. Check all requests from both pages
370
- getNetworkRequests({ types: ['XHR', 'Fetch'] })
371
- // Returns requests from /login AND /dashboard
372
- ```
373
-
374
- ## [1.3.3] - 2025-01-26
375
-
376
- ### Added
377
- - `getNetworkRequests` tool - monitor all network requests (XHR, Fetch, API calls, resources)
378
- - Network monitoring via Chrome DevTools Protocol (CDP)
379
- - Automatic capture of all HTTP/HTTPS requests from page load
380
- - Filter requests by type (XHR, Fetch, Script, Document, etc.)
381
- - Filter by status (pending, completed, failed)
382
- - Filter by URL pattern (regex support)
383
- - Request details include: URL, method, status, headers, timing, cache info, errors
384
-
385
- ### Changed
386
- - Network.enable added to CDP session setup in getOrCreatePage
387
- - Global networkRequests array for request storage
388
-
389
- ### Examples
390
- ```javascript
391
- // Get all network requests
392
- getNetworkRequests()
393
-
394
- // Get only XHR and Fetch requests (API calls)
395
- getNetworkRequests({
396
- types: ['XHR', 'Fetch']
397
- })
398
-
399
- // Get failed requests
400
- getNetworkRequests({
401
- status: 'failed'
402
- })
403
-
404
- // Get requests to specific API
405
- getNetworkRequests({
406
- urlPattern: 'api\\.example\\.com'
407
- })
408
-
409
- // Get requests and clear history
410
- getNetworkRequests({
411
- types: ['XHR', 'Fetch'],
412
- clear: true
413
- })
414
- ```
415
-
416
- ## [1.3.2] - 2025-01-26
417
-
418
- ### Added
419
- - `action` parameter for `smartFindElement` - perform actions (click, type, scrollTo, screenshot, hover, setStyles) on the best match immediately
420
- - `action` parameter for `findElementsByText` - perform actions on the first matching element immediately
421
- - New helper function `executeElementAction` for unified action execution
422
-
423
- ### Changed
424
- - `smartFindElement` can now execute actions on found elements in a single call
425
- - `findElementsByText` can now execute actions on found elements in a single call
426
- - Reduces need for separate find + action calls, improving performance
427
-
428
- ### Examples
429
- ```javascript
430
- // Find and click in one call
431
- smartFindElement({
432
- description: 'login button',
433
- action: { type: 'click' }
434
- })
435
-
436
- // Find and type in one call
437
- findElementsByText({
438
- text: 'Email',
439
- action: { type: 'type', text: 'user@example.com' }
440
- })
441
-
442
- // Find, style and screenshot
443
- smartFindElement({
444
- description: 'submit button',
445
- action: {
446
- type: 'setStyles',
447
- styles: [{ name: 'background', value: 'red' }],
448
- screenshot: true
449
- }
450
- })
451
- ```
452
-
453
- ## [1.3.1] - 2025-01-26
454
-
455
- ### Performance Improvements
456
- - **BREAKING BEHAVIOR CHANGE**: `click` and `executeScript` commands no longer capture screenshots by default
457
- - Screenshots were causing significant performance overhead (2-10x slowdown)
458
- - Add `screenshot: true` parameter to explicitly request screenshots when needed
459
- - This is backward compatible but changes default behavior for better performance
460
-
461
- ### Added
462
- - `screenshot` parameter for `click` command (boolean, default: `false`)
463
- - `screenshot` parameter for `executeScript` command (boolean, default: `false`)
464
- - `timeout` parameter for `click` command (number, default: `30000ms`)
465
- - `timeout` parameter for `executeScript` command (number, default: `30000ms`)
466
-
467
- ### Changed
468
- - `click` command now executes 2-10x faster without screenshots
469
- - `executeScript` command now executes 2-10x faster without screenshots
470
- - Both commands now have 30-second timeout by default to prevent hanging
471
-
472
- ### Fixed
473
- - Commands no longer hang indefinitely if operations fail
474
- - Reduced memory usage by not capturing unnecessary screenshots
475
-
476
- ### Migration
477
- If you relied on automatic screenshots, add `screenshot: true` to your calls:
478
- ```javascript
479
- // Before (v1.3.0 and earlier)
480
- await click({ selector: 'button' }) // Always included screenshot
481
-
482
- // After (v1.3.1+)
483
- await click({ selector: 'button', screenshot: true }) // Explicitly request screenshot
484
- await click({ selector: 'button' }) // Fast mode (no screenshot)
485
- ```
486
-
487
- ## [1.3.0] - Previous version
488
- - Scenario recorder with auto-reinjection
489
- - Smart element finder
490
- - Page analysis tools
491
- - Figma integration
492
-
493
- ## Earlier versions
494
- See git history for details.
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [2.2.0] - 2025-12-21
6
+
7
+ ### Added
8
+ - **Page Object Model (POM) Generator** - New `generatePageObject` MCP tool for automated Page Object creation
9
+ - Analyzes current page and extracts interactive elements (inputs, buttons, links, etc.)
10
+ - Smart selector generation: prioritizes id > name > data-testid > unique class > CSS path
11
+ - Auto-generates meaningful element names from labels, placeholders, text content
12
+ - Groups elements by semantic sections (header, nav, form, footer, etc.)
13
+ - Supports 4 frameworks: Playwright TypeScript/Python, Selenium Python/Java
14
+ - Generates helper methods automatically (fill/click methods for common actions)
15
+ - Example: `generatePageObject({ framework: 'playwright-typescript' })`
16
+ - Location: `recorder/page-object-generator.js`, `index.js:46,2098-2136`
17
+
18
+ - **Page Object Integration in exportScenarioAsCode** - Optional Page Object generation when exporting scenarios
19
+ - New parameter `generatePageObject` (default: false) to generate both test code and Page Object class
20
+ - New parameter `pageObjectClassName` for custom Page Object class names
21
+ - Opens scenario's entry URL and analyzes page structure automatically
22
+ - Returns JSON with both `testCode` and `pageObjectCode` when enabled
23
+ - Example: `exportScenarioAsCode({ scenarioName: "login", language: "playwright-typescript", generatePageObject: true })`
24
+ - Location: `index.js:2090-2186`, `server/tool-schemas.js:281-282`, `server/tool-definitions.js:565-572`
25
+
26
+ - **Append Mode for exportScenarioAsCode** - Ability to append generated tests to existing test files
27
+ - New parameter `appendToFile`: Path to existing test file to append to (enables append mode)
28
+ - New parameter `testName`: Override test name (default: from scenario name)
29
+ - New parameter `insertPosition`: Where to insert test - 'end' (default), 'before', or 'after' a reference test
30
+ - New parameter `referenceTestName`: Reference test name for 'before'/'after' insertion
31
+ - Supports all 4 frameworks: Playwright TypeScript/Python, Selenium Python/Java
32
+ - Automatic file validation (extension must match language)
33
+ - Automatic backup before file modification (.backup extension)
34
+ - Smart test name conversion (camelCase for Java, snake_case for Python, kebab-case for TypeScript)
35
+ - Framework-specific parsing: brace counting for TypeScript/Java, indentation-based for Python
36
+ - PEP 8 compliance: 2 blank lines between Python functions
37
+ - Example: `exportScenarioAsCode({ scenarioName: "new_test", language: "playwright-typescript", appendToFile: "./tests/suite.spec.ts" })`
38
+ - Location: `utils/code-generators/file-appender.js` (new 177 lines), `index.js:2044-2116`, `server/tool-schemas.js:283-286`, `utils/code-generators/*.js`
39
+
40
+ ### Fixed
41
+ - **Dependency Resolution with projectId** - Fixed collision errors when executing scenarios with dependencies
42
+ - Dependencies now correctly inherit parent scenario's projectId when not explicitly specified
43
+ - Explicit dependency projectId in metadata takes precedence over inherited value
44
+ - Fixes error: "Dependency 'test': Multiple scenarios named 'test' found"
45
+ - Location: `recorder/scenario-executor.js:63-119`
46
+
47
+ ## [2.1.1] - 2025-12-21
48
+
49
+ ### Fixed
50
+ - **executeScenario Timeout Fix** - Prevents hanging when no browser tab is attached
51
+ - Auto-opens browser at scenario's entryUrl if no page is open
52
+ - Added timeout protection (1s) for page state checks to prevent hanging on `isClosed()`
53
+ - Added 30s timeout for browser opening operation
54
+ - Added 5min timeout for scenario execution with clear error messages
55
+ - Location: `browser/page-manager.js:255-290`, `index.js:1875-1955`
56
+
57
+ - **URL Validation Fix** - Fixed false negative in scenario exit URL validation
58
+ - Added 500ms wait before URL check to allow navigation/redirects to complete
59
+ - Changed from `page.url()` to `page.evaluate(() => window.location.href)` for more reliable current URL
60
+ - Fixes issue where correct URL was reported as wrong due to timing
61
+ - Location: `recorder/scenario-executor.js:186-191`
62
+
63
+ - **Global Timeout Protection** - All MCP tools now protected from hanging
64
+ - Added `executeToolWithTimeout()` wrapper for all tool calls
65
+ - Default timeout: 2 minutes for regular tools, 6 minutes for executeScenario
66
+ - Tools return clear error messages instead of hanging indefinitely
67
+ - Location: `index.js:183-217`
68
+
69
+ ### Changed
70
+ - **Code Refactoring** - Reduced index.js from 3761 to 2093 lines (-44%)
71
+ - Extracted tool schemas to `server/tool-schemas.js` (34 schemas, 282 lines)
72
+ - Extracted tool definitions to `server/tool-definitions.js` (41 tools, 569 lines)
73
+ - Extracted browser management to `browser/browser-manager.js` (207 lines)
74
+ - Extracted page management to `browser/page-manager.js` (268 lines)
75
+ - Extracted image processing to `utils/image-processing.js` (254 lines)
76
+ - Extracted CSS utilities to `utils/css-utils.js` (163 lines)
77
+ - Extracted platform utilities to `utils/platform-utils.js` (63 lines)
78
+ - Better code organization and maintainability
79
+
80
+ ## [2.1.0] - 2025-12-21
81
+
82
+ ### Added
83
+ - **Name Collision Detection** - Smart handling of scenarios with same name across different projects
84
+ - `executeScenario` now detects when multiple scenarios share the same name
85
+ - Returns helpful error with list of available `projectId` values
86
+ - Optional `projectId` parameter to disambiguate: `executeScenario({ name: "login", projectId: "google" })`
87
+ - Location: `recorder/scenario-storage.js:111-163`, `recorder/scenario-executor.js:33,49-61,86-90`, `index.js:1677,3558-3571,3597-3600`
88
+
89
+ ### Changed
90
+ - **URL-Based Scenario Organization** - Scenarios now organized by website domain instead of file system project
91
+ - Project ID automatically extracted from URL where recording starts: `https://google.com` `google`
92
+ - Main domain only (subdomains stripped): `mail.google.com` `google`
93
+ - Ports included for ALL domains: `localhost:3000` `localhost-3000`, `example.com:8080` → `example-8080`
94
+ - Protocol ignored: `http` and `https` both map to same projectId
95
+ - File URLs: `file:///` `local`
96
+ - Location: `utils/url-to-project.js`, `recorder/recorder-script.js:30-78`
97
+
98
+ - **Global Scenario Access** - All tools now return scenarios from ALL websites
99
+ - `listScenarios()` returns ALL scenarios with `projectId`, `entryUrl`, `exitUrl` metadata
100
+ - `searchScenarios()` searches ALL scenarios across all websites
101
+ - Agent can filter results by `projectId`, `entryUrl`, or `exitUrl` as needed
102
+ - Removed `allProjects` parameter (no longer needed, always returns all)
103
+ - Location: `index.js:3586-3610`
104
+
105
+ - **Simplified API** - Recorder no longer depends on file system project detection
106
+ - `injectRecorder()` signature changed from `(page, projectDir, projectId, projectPath)` to `(page)`
107
+ - Project ID determined automatically from page URL in browser context
108
+ - Removed dependency on `utils/project-detector.js`
109
+ - Location: `recorder/recorder-script.js:1710-1763`, `index.js:3512-3533`
110
+
111
+ ### Added
112
+ - **URL Normalization Utilities** - New module for extracting project ID from URLs
113
+ - `urlToProjectId(url)` - Extract and sanitize domain-based project ID
114
+ - `sanitizeProjectId(id)` - Clean project IDs (lowercase, alphanumeric, hyphens)
115
+ - Browser-compatible version injected into recorder widget
116
+ - Location: `utils/url-to-project.js`
117
+
118
+ ### Migration
119
+ - **Automatic v2.1.0 Migration** - Old project-based scenarios removed on first run
120
+ - Deletes `~/.config/chrometools-mcp/projects/` directory from v2.0
121
+ - Deletes old global index
122
+ - Creates `.migration-v2.1.0-done` flag file
123
+ - One-time migration, starts fresh with URL-based organization
124
+ - Location: `index.js:780-811`
125
+
126
+ ### Removed
127
+ - **Removed `utils/project-detector.js`** - No longer needed for URL-based organization
128
+ - **Removed helper functions** - `getProjectId()`, `getProjectDir()`, `getCurrentProjectDir()`
129
+ - **Removed old scenarios** - All v2.0 scenarios deleted during migration
130
+
131
+ ### Documentation
132
+ - **Updated README.md** - Complete rewrite of Recorder Tools section
133
+ - Explained URL-based storage approach with examples
134
+ - Updated all tool descriptions and examples
135
+ - Documented domain extraction rules
136
+ - Added filtering examples for agents
137
+ - Location: `README.md:507-618`
138
+
139
+ ## [2.0.2] - 2025-12-21
140
+
141
+ ### Fixed
142
+ - **Project Detection for VS Code** - Improved project root detection for IDE environments
143
+ - Added support for `INIT_CWD` and `npm_config_local_prefix` environment variables
144
+ - Added `findProjectRootByMarkers()` to detect project by package.json, pom.xml, etc.
145
+ - Walks up parent directories to find Git root when cwd is IDE installation
146
+ - Now correctly detects `C:\prj\automation` instead of `Microsoft VS Code` when running in VS Code
147
+ - Location: `utils/project-detector.js:38-68`, `utils/project-detector.js:85-140`
148
+
149
+ ### Added
150
+ - **Enhanced Project Detection Strategy** - Multiple fallback mechanisms for project root detection
151
+ - Priority: CLAUDE_PROJECT_DIR → PROJECT_DIR → INIT_CWD → npm prefix → Git root → markers → parent Git → cwd
152
+ - Supports 8+ project markers: package.json, pom.xml, build.gradle, Cargo.toml, go.mod, etc.
153
+ - Better logging with `console.error` for debugging project detection
154
+
155
+ ### Documentation
156
+ - **VS Code Setup Guide** - Add instructions for setting PROJECT_DIR in MCP config for VS Code users
157
+
158
+ ## [2.0.1] - 2025-12-21
159
+
160
+ ### Fixed
161
+ - **Recorder Auto-Reinjection** - Fixed critical bug where recorder widget didn't reinject after page navigation
162
+ - Updated `setupRecorderAutoReinjection()` to use new v2.0 API signature
163
+ - Fixed both navigation (`framenavigated`) and reload (`load`) event handlers
164
+ - Recorder now correctly passes `projectDir`, `projectId`, and `projectPath` instead of deprecated `baseDir`
165
+ - Location: `index.js:483-486`, `index.js:499-502`
166
+
167
+ ## [2.0.0] - 2025-12-21
168
+
169
+ ### Breaking Changes
170
+ - **Project-Based Scenario Storage** - Complete restructuring of scenario storage system
171
+ - Scenarios now stored in `~/.config/chrometools-mcp/projects/{projectName}/scenarios/`
172
+ - Each project has its own isolated scenario storage
173
+ - Automatic project detection via `detectProjectRoot()` (CLAUDE_PROJECT_DIR → PROJECT_DIR → git root → cwd)
174
+ - Global index file at `~/.config/chrometools-mcp/index.json` for fast scenario discovery
175
+ - Scenarios include `projectId` and `projectPath` in metadata
176
+ - Old scenarios in `~/.config/chrometools-mcp/scenarios/` will no longer be accessible
177
+ - Location: `index.js:66-159`, `recorder/scenario-storage.js`
178
+
179
+ - **Removed `directory` parameter** - All scenario tools no longer accept explicit directory parameter
180
+ - Removed from: `enableRecorder`, `executeScenario`, `listScenarios`, `searchScenarios`, `getScenarioInfo`, `deleteScenario`, `exportScenarioAsCode`
181
+ - Project directory is now automatically determined
182
+ - Simplifies API and improves consistency
183
+ - Location: `index.js:1659-1750` (tool definitions)
184
+
185
+ ### Added
186
+ - **Global Scenario Index** - Fast O(1) scenario lookups without filesystem scanning
187
+ - Location: `~/.config/chrometools-mcp/index.json`
188
+ - Contains all projects and their scenarios
189
+ - Enables quick discovery of scenarios across all projects
190
+ - AI-friendly: agents can read global index to understand all available scenarios
191
+ - Location: `index.js:103-159`, `recorder/scenario-storage.js:23-136`
192
+
193
+ - **Multi-Project Filtering** - New `allProjects` parameter for `listScenarios` and `searchScenarios`
194
+ - `allProjects: false` (default) - shows only current project's scenarios
195
+ - `allProjects: true` - shows scenarios from all projects
196
+ - Enables cross-project scenario discovery and reuse
197
+ - Location: `index.js:1685`, `index.js:1697`, `recorder/scenario-storage.js:385-453`
198
+
199
+ - **Cross-Project Dependency Support** - Scenarios can depend on scenarios from other projects
200
+ - Dependencies automatically resolved across projects via global index
201
+ - Enables scenario reuse between projects
202
+ - Location: `recorder/scenario-executor.js:27-121`
203
+
204
+ - **Storage Path in Tool Descriptions** - All scenario tools now document storage location
205
+ - Every tool description includes: "Scenarios are stored in ~/.config/chrometools-mcp/projects/{projectName}/scenarios/"
206
+ - Helps AI agents understand where to find scenarios
207
+ - Includes reference to global index location
208
+ - Location: `index.js:1660`, `index.js:1668`, `index.js:1681`, etc.
209
+
210
+ ### Changed
211
+ - **Scenario Storage Functions** - Updated all storage functions for new architecture
212
+ - `saveScenario(scenario, projectId, projectPath)` - now requires project info instead of baseDir
213
+ - `loadScenario(name, includeSecrets, projectId)` - searches globally, optional project filter
214
+ - `listScenarios(projectId, allProjects)` - reads from global index
215
+ - `searchScenarios(query, projectId, allProjects)` - searches global index
216
+ - `deleteScenario(name, projectId)` - finds and deletes from correct project
217
+ - Location: `recorder/scenario-storage.js:191-500`
218
+
219
+ - **Recorder Injection** - Updated to pass project information
220
+ - `injectRecorder(page, projectDir, projectId, projectPath)` - now accepts project details
221
+ - Scenarios saved with project context automatically
222
+ - Location: `recorder/recorder-script.js:1659`
223
+
224
+ ### Migration Guide
225
+ - **Old scenarios are inaccessible** - Scenarios in `~/.config/chrometools-mcp/scenarios/` will no longer be found
226
+ - To migrate: Manually move scenarios to new structure or re-record them
227
+ - New structure: `~/.config/chrometools-mcp/projects/{projectName}/scenarios/`
228
+ - **No code changes needed** - All changes are internal, MCP tool interface remains compatible (except removed `directory` parameter)
229
+
230
+ ## [1.9.1] - 2025-12-19
231
+
232
+ ### Fixed
233
+ - **MCP Protocol Errors** - Fixed "Unexpected token" JSON parsing errors caused by console output
234
+ - Added debug mode (`CHROMETOOLS_DEBUG=true`) to control logging
235
+ - Replaced all `console.log/error` with `debugLog` to prevent STDIO pollution
236
+ - MCP uses STDIO for JSON-RPC, debug logs were breaking the protocol
237
+ - Fixed errors: `"Unexpected token 'c', "[chrometool"... is not valid JSON"`
238
+ - Fixed errors: `"Unexpected token 'S', "[Smart Wait"... is not valid JSON"`
239
+ - Location: `index.js:21-24`, `recorder/scenario-executor.js:15-17`
240
+
241
+ - **Recorder localStorage Corruption** - Added robust error handling for corrupted state data
242
+ - Validates JSON before parsing from localStorage
243
+ - Validates state structure after parsing
244
+ - Automatic cleanup of corrupted data with error logging
245
+ - Location: `recorder/recorder-script.js:64-159`
246
+
247
+ ### Added
248
+ - **Scenario Index Enhancement** - Added `entryUrl` and `exitUrl` to scenario index
249
+ - `listScenarios` now returns entry and exit URLs for each scenario
250
+ - Helps identify scenario flow and dependencies
251
+ - Location: `recorder/scenario-storage.js:197-198`
252
+
253
+ ### Changed
254
+ - **Code Cleanup** - Removed backup files and improved .gitignore
255
+ - Added `*.bak`, `*.backup`, `*~`, `*.tmp` to .gitignore
256
+ - Removed leftover `index.js.backup` file
257
+
258
+ ## [1.9.0] - 2025-12-19
259
+
260
+ ### Changed
261
+ - **Default Scenarios Storage Location** - Scenarios now save to `~/.config/chrometools-mcp` by default
262
+ - Previous behavior: auto-detected project root (Git root or cwd) which could be unpredictable
263
+ - New behavior: consistent location in user's home folder (`~/.config/chrometools-mcp`)
264
+ - Can still override with explicit `directory` parameter on recorder tools
265
+ - Improves reliability for AI agents and users without Git repositories
266
+ - Location: `index.js:64`, `index.js:101-119`
267
+
268
+ ## [1.8.2] - 2025-12-19
269
+
270
+ ### Fixed
271
+ - **Code Generator Bugs** - Fixed multiple issues in test code generators
272
+ - **Python generators**: Fixed comment syntax - now use `#` instead of `//`
273
+ - **Python generators**: Moved `import re` to top of file instead of inline
274
+ - **Java generator**: Fixed variable name conflicts - now uses unique names (`typeElement`, `hoverElement`, etc.) instead of reusing `element`
275
+ - **Java generator**: Added missing imports (`JavascriptExecutor`, `Select`)
276
+ - **All generators**: Implemented language-specific comment generation via `generateComment()` method
277
+ - Location: `utils/code-generators/code-generator-base.js`, `playwright-python.js`, `selenium-python.js`, `selenium-java.js`
278
+
279
+ ## [1.8.1] - 2025-12-19
280
+
281
+ ### Added
282
+ - **Smart Project Directory Detection** - Scenarios now automatically save to the correct project directory
283
+ - Auto-detection cascade: `CLAUDE_PROJECT_DIR` env var `PROJECT_DIR` env var Git root → current working directory
284
+ - Optional `directory` parameter on all recorder tools (`enableRecorder`, `executeScenario`, `listScenarios`, `searchScenarios`, `getScenarioInfo`, `deleteScenario`, `exportScenarioAsCode`)
285
+ - Session memory: once directory is set (explicitly or auto-detected), it's remembered for the entire MCP server session
286
+ - Solves issue where scenarios were saved to unpredictable locations based on where MCP process was launched
287
+ - Location: `utils/project-detector.js`, `index.js:97-115`
288
+
289
+ ### Changed
290
+ - **All recorder storage functions now accept `baseDir` parameter** - Breaking change for direct API usage
291
+ - Updated: `saveScenario()`, `loadScenario()`, `listScenarios()`, `searchScenarios()`, `deleteScenario()`, `loadIndex()`, and all other storage functions
292
+ - MCP tool users: no breaking changes, just new optional `directory` parameter
293
+ - Location: `recorder/scenario-storage.js`, `recorder/scenario-executor.js`, `recorder/recorder-script.js`
294
+
295
+ ## [1.8.0] - 2025-12-19
296
+
297
+ ### Added
298
+ - **Test Code Generation** - New MCP tool `exportScenarioAsCode` for generating executable test code from recorded scenarios
299
+ - Supports 4 test frameworks: Playwright (TypeScript/Python), Selenium (Python/Java)
300
+ - Automatic selector cleaning - removes unstable CSS classes (CSS Modules, styled-components, Emotion, hashed classes)
301
+ - Generates clean, readable test code with comments
302
+ - Smart selector stability analysis with pattern-based detection
303
+ - Fallback selector selection - chooses most stable selector from fallbacks
304
+ - Location: `utils/code-generators/`, `utils/selector-cleaner.js`
305
+
306
+ **Unstable patterns detected:**
307
+ - CSS Modules: `Button_primary__2x3yZ`
308
+ - Styled-components: `sc-AbCdEf-0`
309
+ - Emotion: `css-1a2b3c4d`
310
+ - Hash suffixes: `component_a1b2c3d`
311
+ - Random hashes: `_1a2b3c4d`
312
+
313
+ **Usage:**
314
+ ```javascript
315
+ exportScenarioAsCode('checkout', {
316
+ language: 'playwright-typescript',
317
+ cleanSelectors: true,
318
+ includeComments: true
319
+ })
320
+ ```
321
+
322
+ ## [1.7.4] - 2025-12-19
323
+
324
+ ### Changed
325
+ - **executeScenario auto-opens browser** - No longer throws error when no page is open
326
+ - Automatically opens browser at scenario's `entryUrl` if no page is currently open
327
+ - Eliminates need to manually call `openBrowser` before executing scenarios
328
+ - Improves user experience by treating browser opening as a side effect
329
+ - Falls back gracefully: shows error only if scenario has no `entryUrl`
330
+ - Location: `index.js:3417-3469`
331
+
332
+ ## [1.7.3] - 2025-12-19
333
+
334
+ ### Fixed
335
+ - **Fixed CSS selector generation crash** - `analyzePage` now handles attribute values with special characters
336
+ - Added `isSafeSelectorValue()` function to validate attribute values before using in selectors
337
+ - Filters out attributes containing problematic characters: `["'\\[]{}()]`
338
+ - Added try-catch blocks to prevent selector syntax errors
339
+ - Example: `button[data-counter="["b"]"]` (invalid) is now skipped
340
+ - Location: `element-finder-utils.js:302-360`
341
+
342
+ ### Improved
343
+ - **Recorder now skips hidden elements** - Prevents recording actions on invisible elements
344
+ - Added `isElementVisible()` function to check element visibility before recording
345
+ - Checks: offsetWidth/Height, display, visibility, opacity
346
+ - Applies to all event types: click, type, select, upload, hover, drag
347
+ - Prevents scenarios with duplicate/invisible element actions (e.g., Yandex search with hidden input)
348
+ - Console logs when skipping hidden elements for debugging
349
+ - Location: `recorder/recorder-script.js:1173-1188`
350
+
351
+ ## [1.7.2] - 2025-12-16
352
+
353
+ ### Added
354
+ - **Figma API Token Setup documentation** - Added comprehensive guide on how to obtain and configure Figma Personal Access Token
355
+ - Step-by-step instructions for getting token from Figma account settings
356
+ - Configuration examples for both Claude Desktop and Claude Code
357
+ - Environment variable setup (`FIGMA_TOKEN`)
358
+ - Note about alternative parameter-based token passing
359
+
360
+ ## [1.7.1] - 2025-12-15
361
+
362
+ ### Performance
363
+ - **Optimized tool descriptions** - Reduced token usage by 35-45% (~1,500-2,000 tokens)
364
+ - Shortened main tool descriptions from verbose to concise format
365
+ - Reduced parameter descriptions (e.g., "CSS selector for element to click""CSS selector")
366
+ - Standardized Figma tool parameters (7 tools optimized)
367
+ - Pattern-based reductions across all 41 tools
368
+ - Impact: Saves 1,500-2,000 tokens in every request to Claude
369
+ - Examples:
370
+ - `analyzePage`: 95 tokens → 30 tokens (68% reduction)
371
+ - `screenshot`: 75 tokens 25 tokens (66% reduction)
372
+ - `listNetworkRequests`: 50 tokens → 20 tokens (60% reduction)
373
+
374
+ ### Changed
375
+ - All tool descriptions now use imperative voice and remove redundancy
376
+ - Figma tools: "Figma API token (optional if FIGMA_TOKEN env var is set)" → "API token (optional)"
377
+ - Common patterns: "Milliseconds to wait" "Wait ms", "Maximum" "Max", etc.
378
+
379
+ ## [1.7.0] - 2025-12-14
380
+
381
+ ### Removed
382
+ - **Removed Angular tools** - Removed all 5 Angular-specific tools to reduce context window usage
383
+ - Removed tools: `listAngularComponents`, `getAngularComponent`, `callAngularMethod`, `getAngularForm`, `submitAngularForm`
384
+ - Removed from: tool definitions, handlers, Zod schemas, README documentation
385
+ - Impact: Reduced token usage by ~2500-3000 tokens (~10 pages of context)
386
+ - Tool count: 45 40 tools
387
+
388
+ ### Changed
389
+ - **Simplified tool descriptions** - Removed Angular references from `screenshot` and `executeScript` descriptions
390
+ - Cleaner, more focused descriptions for remaining tools
391
+
392
+ ## [1.6.2] - 2025-12-14
393
+
394
+ ### Fixed
395
+ - **Fixed JSON Schema validation error for `callAngularMethod`** - Added missing `items` field to `args` array parameter
396
+ - Error: "array schema missing items" when using with OpenAI/OpenRouter providers
397
+ - Impact: Tool now works correctly with all LLM providers that validate JSON Schema strictly
398
+ - Note: This tool was subsequently removed in v1.7.0
399
+
400
+ ## [1.6.1] - 2025-12-03
401
+
402
+ ### Changed
403
+ - **Optimized `listNetworkRequests` with pagination** - Added `limit` and `offset` parameters
404
+ - Default limit: 50 requests (max: 500)
405
+ - Returns: `{ totalCount, returnedCount, hasMore, offset, limit, requests: [...] }`
406
+ - Prevents excessive token usage when pages have hundreds of network requests
407
+ - Example: `listNetworkRequests({ limit: 20, offset: 20 })` returns requests 21-40
408
+
409
+ ### Performance
410
+ - Reduced token usage for network request inspection on pages with many requests
411
+ - AI receives pagination metadata (`hasMore`, `totalCount`) to request additional pages as needed
412
+
413
+ ## [1.6.0] - 2025-12-03
414
+
415
+ ### Changed
416
+ - **Code organization improved** - Major refactoring to modular architecture
417
+ - Created `tools/` directory with `tool-schemas.js` (all Zod validation schemas)
418
+ - Created `utils/` directory with specialized utility modules:
419
+ - `css-helpers.js` - CSS categorization and filtering (~133 lines)
420
+ - `screenshot-processor.js` - Screenshot processing and image comparison (~210 lines)
421
+ - `element-actions.js` - Element interaction actions (~115 lines)
422
+ - Total **~712 lines moved to separate modules** for better maintainability
423
+ - Created REFACTORING.md documenting modular structure and future improvements
424
+
425
+ ### Benefits
426
+ - **Better code organization** - Related functionality grouped logically
427
+ - **Improved maintainability** - Easier to find and modify specific functionality
428
+ - **Reusability** - Modules can be tested and used independently
429
+ - **Cleaner main file** - index.js reduced by ~20% (712 lines)
430
+
431
+ ### Technical Details
432
+ - Backup created (index.js.backup) before refactoring
433
+ - Modules are independent with no circular dependencies
434
+ - Additional utility modules prepared for future integration (browser-manager, network-monitor, recorder-helper)
435
+
436
+ ## [1.5.0] - 2025-12-02
437
+
438
+ ### Added
439
+ - **6 new Figma tools** - Major enhancement to Figma integration (total: 9 Figma tools)
440
+ - `parseFigmaUrl` - Parse full Figma URLs to extract fileKey and nodeId automatically
441
+ - `listFigmaPages` - Browse entire file structure: all pages and frames with IDs
442
+ - `searchFigmaFrames` - Search frames/components by name across entire file
443
+ - `getFigmaComponents` - Extract all components (Design System)
444
+ - `getFigmaStyles` - Get all shared styles (colors, text, effects, grids)
445
+ - `getFigmaColorPalette` - Extract complete color palette with usage statistics
446
+ - **figma-tools.js module** - All Figma functionality moved to dedicated module for better organization
447
+ - **URL support for all Figma tools** - All tools now accept full Figma URLs or fileKeys
448
+ - **Automatic URL parsing** - No need to manually extract fileKey and nodeId from Figma links
449
+
450
+ ### Changed
451
+ - **Figma code refactored** - Moved all Figma functions to separate figma-tools.js module
452
+ - **Improved Figma workflow** - Use `listFigmaPages` → `searchFigmaFrames` → specific tool workflow
453
+
454
+ ### Use Cases
455
+ - Browse Figma files without opening Figma UI
456
+ - Extract design system components and styles
457
+ - Generate CSS variables from color palette
458
+ - Find frames by name across all pages
459
+ - Copy-paste Figma URLs directly into tools
460
+
461
+ ## [1.4.0] - 2025-12-02
462
+
463
+ ### Added
464
+ - **getFigmaSpecs text extraction** - Extract all text content from Figma designs (buttons, labels, headings, paragraphs)
465
+ - `textContent`: Direct text for TEXT nodes with character count
466
+ - `allTextContent`: Array of all text nodes (name, text, visibility) from entire tree
467
+ - `textSummary`: Statistics (total nodes, visible nodes, combined text)
468
+ - Recursive extraction from all child elements
469
+ - Example use: Get button labels, form placeholders, UI copy from designs
470
+ - **getComputedCss filtering** - Intelligent CSS property filtering to reduce token usage from ~14k to ~1-2k tokens
471
+ - `category` parameter: Filter by 'layout', 'typography', 'colors', 'visual', or 'all' (default)
472
+ - `properties` parameter: Request specific CSS properties (e.g., `['color', 'font-size']`)
473
+ - `includeDefaults` parameter: Optionally include/exclude properties with default values (default: false)
474
+ - Returns metadata: total properties, filtered count, applied filters
475
+ - Example: `{ selector: ".header", category: "layout" }` returns only layout-related properties
476
+
477
+ ### Changed
478
+ - **getFigmaSpecs children structure enhanced** - Now includes text content and dimensions for all child elements
479
+
480
+ ### Performance
481
+ - **getComputedCss now 7-14x more efficient** - Filtering reduces output from ~300 properties to 10-50 properties
482
+ - Default behavior (no filters) filters out default values, reducing typical response from ~14k to ~3-5k tokens
483
+
484
+ ## [1.3.8] - 2025-12-02
485
+
486
+ ### Added
487
+ - **Automatic image compression to 3 MB limit** - All screenshots and Figma images are now automatically compressed if they exceed 3 MB
488
+ - Images are first compressed by reducing JPEG quality (from 85 to 10 in steps of 10)
489
+ - If quality reduction is insufficient, images are scaled down to fit within the size limit
490
+ - PNG images that exceed 3 MB are automatically converted to JPEG and compressed
491
+ - Compression metadata includes: final file size, quality level, compression ratio, number of compression attempts
492
+
493
+ ### Changed
494
+ - `processScreenshot` function now includes `maxFileSize` parameter (default: 3 MB)
495
+ - `getFigmaFrame` now applies automatic compression to exported Figma images
496
+ - `compareFigmaToElement` now compresses all three images (Figma design, page screenshot, difference map)
497
+ - All image processing preserves original dimensions by default, only scaling down if necessary to meet size limits
498
+
499
+ ## [1.3.7] - 2025-12-01
500
+
501
+ ### Added
502
+ - **Angular-specific tools** - 5 new tools for working with Angular applications
503
+ - `listAngularComponents` - Discover all Angular components on page with methods/properties
504
+ - `getAngularComponent` - Get detailed info about specific component (methods, properties, state)
505
+ - `callAngularMethod` - Call component methods reliably with auto change detection
506
+ - `getAngularForm` - Get form data, validation state, errors (ReactiveFormsModule & Template-driven)
507
+ - `submitAngularForm` - Submit forms with automatic fallback strategies (method → button → event)
508
+ - **`waitForElement`** - Wait for elements to appear (autocomplete, lazy loading, dynamic content)
509
+
510
+ ### Fixed (additional)
511
+ - **`findElementsByText` token overflow** - removed `fullText`, added visibility check, limit 20 results
512
+ - Prioritizes visible elements over hidden ones
513
+ - Now returns `truncated: true` when results are limited
514
+
515
+ ### Fixed
516
+ - **Auto-reconnection after Chrome closure**
517
+ - Browser now automatically reconnects when Chrome is closed and reopened with debug port
518
+ - Added `browser.isConnected()` check before reusing cached browser instance
519
+ - Added `disconnected` event handler to reset browser state
520
+ - Fixes "Connection closed" error when Chrome debug session is manually restarted
521
+ - **scrollTo tool now works correctly**
522
+ - Fixed incorrect usage of `element.scrollIntoView()` method (not available in Puppeteer ElementHandle)
523
+ - Now uses `page.evaluate()` to properly execute `scrollIntoView()` in browser context
524
+ - Added `block: 'center'` for better element positioning
525
+ - Increased wait time to 500ms for smooth scrolling completion
526
+
527
+ ### Changed
528
+ - **Angular tools descriptions updated** - emphasize use BEFORE executeScript
529
+ - `getAngularComponent` - marked as PREFERRED over executeScript with ng.getComponent
530
+ - `getAngularForm` - now returns both value and rawValue (shows disabled controls!)
531
+ - `executeScript` - explicit warnings: DO NOT use for Angular (use specialized tools instead)
532
+ - **`analyzePage` description updated** - clarified use AFTER page changes (clicks, submissions, AJAX)
533
+ - Now emphasizes `refresh:true` to get current state after interactions
534
+ - Compares favorably to screenshot for debugging (2-5k vs 15-25k tokens, actual data vs visual)
535
+ - **`screenshot` description updated** - clarified when NOT to use (debugging data, after clicks)
536
+ - Emphasizes use for visual comparison only, not for inspecting form values or state
537
+ - **Network monitoring split into 3 specialized tools** (massive token reduction)
538
+ - `listNetworkRequests` - compact summary (requestId, method, URL, status only)
539
+ - `getNetworkRequest` - full details of single request by requestId
540
+ - `filterNetworkRequests` - filter by URL pattern with full details
541
+ - Replaces monolithic `getNetworkRequests` with targeted workflow
542
+ - **`analyzePage` description emphasizes REQUIRED usage on every page**
543
+ - Tool descriptions updated to prioritize `analyzePage` over manual element searching
544
+ - `executeScript` description clarified as last resort after `analyzePage`
545
+ - `smartFindElement` now recommends `analyzePage` first for better performance
546
+ - `getElement` now recommends `analyzePage` for bulk element inspection
547
+ - `getBrowser()` now validates connection status before returning cached browser
548
+ - Browser promise is reset on disconnect for automatic reconnection
549
+ - `scrollTo` implementation rewritten to use proper Puppeteer API
550
+
551
+ ### Removed
552
+ - `getNetworkRequests` tool (replaced by 3 specialized tools above)
553
+
554
+ ## [1.3.6] - 2025-12-01
555
+
556
+ ### Changed
557
+ - **Optimized getNetworkRequests output for reduced token usage**
558
+ - Default filter now Fetch/XHR only (excludes images, scripts, stylesheets, etc.)
559
+ - Minified JSON payloads (request/response bodies now compact, no whitespace)
560
+ - Essential headers only (content-type, authorization, x-api-key, set-cookie)
561
+ - Conditional fields (error details only on failure, cache flag only when true)
562
+ - Duration calculation instead of separate timestamp fields
563
+
564
+ ### Performance
565
+ - Significantly reduced output size (50-80% reduction typical)
566
+ - Better for AI context windows with large API traces
567
+ - Essential data preserved, noise eliminated
568
+
569
+ ## [1.3.5] - 2025-01-26
570
+
571
+ ### Added
572
+ - **Request/Response payload and headers now included in getNetworkRequests**
573
+ - `postData` - POST request body (e.g., form data, JSON payload)
574
+ - `requestHeaders` - Request headers
575
+ - `responseHeaders` - Response headers
576
+
577
+ ### Changed
578
+ - `getNetworkRequests` now returns complete request/response details
579
+ - Essential for debugging API calls with payloads
580
+
581
+ ### Example
582
+ ```javascript
583
+ getNetworkRequests({ urlPattern: 'send_otp' })
584
+
585
+ // Now returns:
586
+ {
587
+ "url": "http://localhost:4200/api/auth/send_otp/",
588
+ "method": "POST",
589
+ "postData": "{\"phone\":\"+79001234567\"}", // ← NEW!
590
+ "requestHeaders": { // ← NEW!
591
+ "content-type": "application/json",
592
+ "authorization": "Bearer ..."
593
+ },
594
+ "responseHeaders": { // ← NEW!
595
+ "content-type": "application/json"
596
+ },
597
+ "status": 200,
598
+ ...
599
+ }
600
+ ```
601
+
602
+ ## [1.3.4] - 2025-01-26
603
+
604
+ ### Fixed
605
+ - **Network monitoring now persists across page navigations** - auto-reinitializes on navigation
606
+ - Network requests are now captured correctly after form submissions, link clicks, and redirects
607
+ - Added WeakSet tracking to prevent duplicate CDP session setup
608
+ - Added 100ms debounce on navigation to ensure stability
609
+
610
+ ### Changed
611
+ - Refactored network monitoring into `setupNetworkMonitoring()` helper function
612
+ - Network monitoring automatically re-enables on framenavigated events
613
+ - Global `networkRequests[]` array preserves history across all navigations
614
+
615
+ ### Technical Details
616
+ - CDP (Chrome DevTools Protocol) session is recreated on each navigation
617
+ - Network.enable is automatically re-sent after navigation completes
618
+ - Request history accumulates across multiple pages in the same session
619
+ - Use `getNetworkRequests({ clear: true })` to reset history when needed
620
+
621
+ ### Example Use Case
622
+ ```javascript
623
+ // 1. Open login page
624
+ openBrowser({ url: 'https://app.com/login' })
625
+ // Network monitoring: ✅ active
626
+
627
+ // 2. Fill form and submit (navigates to /dashboard)
628
+ click({ selector: 'button[type="submit"]' })
629
+ // Network monitoring: ✅ auto-reinitialized
630
+ // Captures POST /api/login, GET /dashboard, etc.
631
+
632
+ // 3. Check all requests from both pages
633
+ getNetworkRequests({ types: ['XHR', 'Fetch'] })
634
+ // Returns requests from /login AND /dashboard
635
+ ```
636
+
637
+ ## [1.3.3] - 2025-01-26
638
+
639
+ ### Added
640
+ - `getNetworkRequests` tool - monitor all network requests (XHR, Fetch, API calls, resources)
641
+ - Network monitoring via Chrome DevTools Protocol (CDP)
642
+ - Automatic capture of all HTTP/HTTPS requests from page load
643
+ - Filter requests by type (XHR, Fetch, Script, Document, etc.)
644
+ - Filter by status (pending, completed, failed)
645
+ - Filter by URL pattern (regex support)
646
+ - Request details include: URL, method, status, headers, timing, cache info, errors
647
+
648
+ ### Changed
649
+ - Network.enable added to CDP session setup in getOrCreatePage
650
+ - Global networkRequests array for request storage
651
+
652
+ ### Examples
653
+ ```javascript
654
+ // Get all network requests
655
+ getNetworkRequests()
656
+
657
+ // Get only XHR and Fetch requests (API calls)
658
+ getNetworkRequests({
659
+ types: ['XHR', 'Fetch']
660
+ })
661
+
662
+ // Get failed requests
663
+ getNetworkRequests({
664
+ status: 'failed'
665
+ })
666
+
667
+ // Get requests to specific API
668
+ getNetworkRequests({
669
+ urlPattern: 'api\\.example\\.com'
670
+ })
671
+
672
+ // Get requests and clear history
673
+ getNetworkRequests({
674
+ types: ['XHR', 'Fetch'],
675
+ clear: true
676
+ })
677
+ ```
678
+
679
+ ## [1.3.2] - 2025-01-26
680
+
681
+ ### Added
682
+ - `action` parameter for `smartFindElement` - perform actions (click, type, scrollTo, screenshot, hover, setStyles) on the best match immediately
683
+ - `action` parameter for `findElementsByText` - perform actions on the first matching element immediately
684
+ - New helper function `executeElementAction` for unified action execution
685
+
686
+ ### Changed
687
+ - `smartFindElement` can now execute actions on found elements in a single call
688
+ - `findElementsByText` can now execute actions on found elements in a single call
689
+ - Reduces need for separate find + action calls, improving performance
690
+
691
+ ### Examples
692
+ ```javascript
693
+ // Find and click in one call
694
+ smartFindElement({
695
+ description: 'login button',
696
+ action: { type: 'click' }
697
+ })
698
+
699
+ // Find and type in one call
700
+ findElementsByText({
701
+ text: 'Email',
702
+ action: { type: 'type', text: 'user@example.com' }
703
+ })
704
+
705
+ // Find, style and screenshot
706
+ smartFindElement({
707
+ description: 'submit button',
708
+ action: {
709
+ type: 'setStyles',
710
+ styles: [{ name: 'background', value: 'red' }],
711
+ screenshot: true
712
+ }
713
+ })
714
+ ```
715
+
716
+ ## [1.3.1] - 2025-01-26
717
+
718
+ ### Performance Improvements
719
+ - **BREAKING BEHAVIOR CHANGE**: `click` and `executeScript` commands no longer capture screenshots by default
720
+ - Screenshots were causing significant performance overhead (2-10x slowdown)
721
+ - Add `screenshot: true` parameter to explicitly request screenshots when needed
722
+ - This is backward compatible but changes default behavior for better performance
723
+
724
+ ### Added
725
+ - `screenshot` parameter for `click` command (boolean, default: `false`)
726
+ - `screenshot` parameter for `executeScript` command (boolean, default: `false`)
727
+ - `timeout` parameter for `click` command (number, default: `30000ms`)
728
+ - `timeout` parameter for `executeScript` command (number, default: `30000ms`)
729
+
730
+ ### Changed
731
+ - `click` command now executes 2-10x faster without screenshots
732
+ - `executeScript` command now executes 2-10x faster without screenshots
733
+ - Both commands now have 30-second timeout by default to prevent hanging
734
+
735
+ ### Fixed
736
+ - Commands no longer hang indefinitely if operations fail
737
+ - Reduced memory usage by not capturing unnecessary screenshots
738
+
739
+ ### Migration
740
+ If you relied on automatic screenshots, add `screenshot: true` to your calls:
741
+ ```javascript
742
+ // Before (v1.3.0 and earlier)
743
+ await click({ selector: 'button' }) // Always included screenshot
744
+
745
+ // After (v1.3.1+)
746
+ await click({ selector: 'button', screenshot: true }) // Explicitly request screenshot
747
+ await click({ selector: 'button' }) // Fast mode (no screenshot)
748
+ ```
749
+
750
+ ## [1.3.0] - Previous version
751
+ - Scenario recorder with auto-reinjection
752
+ - Smart element finder
753
+ - Page analysis tools
754
+ - Figma integration
755
+
756
+ ## Earlier versions
757
+ See git history for details.