@deriv-com/fe-mcp-servers 0.0.11 → 0.0.13

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.
@@ -31,12 +31,30 @@ Add to your MCP client configuration (e.g., in Cursor settings):
31
31
  "command": "node",
32
32
  "args": [
33
33
  "/Users/user/.nvm/versions/node/v20.17.0/lib/node_modules/@deriv-com/fe-mcp-servers/dist/maestro-ai/mcp-server.js"
34
- ]
34
+ ],
35
+ "env": {
36
+ "CLICKUP_API_TOKEN": "${env:CLICKUP_API_TOKEN}",
37
+ "CLICKUP_AC_SOURCE": "${env:CLICKUP_AC_SOURCE}"
38
+ }
35
39
  }
36
40
  }
37
41
  }
38
42
  ```
39
43
 
44
+ ### Environment Variables (Optional - for ClickUp Integration)
45
+
46
+ Set these in your shell profile (`.bashrc`, `.zshrc`, etc.):
47
+
48
+ ```bash
49
+ # ClickUp API token for fetching task acceptance criteria
50
+ export CLICKUP_API_TOKEN="pk_your_api_token_here"
51
+
52
+ # Source for acceptance criteria (default: "checklist:Acceptance Criteria")
53
+ # Supports: checklist:Name, custom_field:Name, description
54
+ # Multiple sources: "checklist:Acceptance Criteria,custom_field:AC,description"
55
+ export CLICKUP_AC_SOURCE="checklist:Acceptance Criteria"
56
+ ```
57
+
40
58
  ## 🛠️ Development Structure
41
59
 
42
60
  ### Source Code (Development)
@@ -147,6 +165,37 @@ Returns common Maestro patterns with "when to use" guidance.
147
165
  - Pattern YAML code
148
166
  - Usage guidance for each pattern
149
167
 
168
+ ### `maestro_ensure_installed` Tool
169
+
170
+ ⚠️ **PREREQUISITE**: Call this FIRST before using `maestro_write_test` or `maestro_run_all_tests`!
171
+
172
+ Checks if Maestro CLI is installed and automatically installs it if missing.
173
+
174
+ **When to Call:**
175
+
176
+ - ALWAYS before `maestro_write_test` (when execute=true)
177
+ - ALWAYS before `maestro_run_all_tests`
178
+ - When setting up a new development environment
179
+
180
+ **Parameters:**
181
+
182
+ - `autoInstall` (boolean, optional): Whether to automatically install if not found (default: true)
183
+ - `forceReinstall` (boolean, optional): Whether to force reinstall even if already installed (default: false)
184
+
185
+ **Returns:**
186
+
187
+ - `installed`: boolean - Whether Maestro is now installed
188
+ - `version`: string - Installed version (if available)
189
+ - `wasInstalled`: boolean - Whether this call performed the installation
190
+ - `message`: string - Status message
191
+ - `details`: object - Additional info (path, install method)
192
+
193
+ **Installation Method:**
194
+
195
+ ```bash
196
+ curl -fsSL "https://get.maestro.mobile.dev" | bash
197
+ ```
198
+
150
199
  ### `maestro_analyze_changes` Tool
151
200
 
152
201
  Automatically analyzes actual git changes in a repository and provides test recommendations.
@@ -164,6 +213,224 @@ Automatically analyzes actual git changes in a repository and provides test reco
164
213
  - Interactive elements detected (onClick, Button, Form, etc.)
165
214
  - Suggested flow type and whether to create tests
166
215
 
216
+ ---
217
+
218
+ ## 🔗 ClickUp Integration Tools
219
+
220
+ These tools enable test generation based on ClickUp task acceptance criteria.
221
+
222
+ ### `clickup_fetch_task` Tool
223
+
224
+ Fetches a ClickUp task by URL to extract acceptance criteria for test generation.
225
+
226
+ **ASK FIRST Pattern:**
227
+ When called WITHOUT a `taskUrl`, this tool returns a prompt asking the user:
228
+
229
+ > "Do you have a ClickUp task URL for this feature? Paste the URL to generate tests based on acceptance criteria, or type 'skip' to continue with git-based analysis only."
230
+
231
+ **Parameters:**
232
+
233
+ - `taskUrl` (string, optional): ClickUp task URL. If omitted, returns a prompt. Use "skip" to bypass.
234
+
235
+ **URL Formats Supported:**
236
+
237
+ - `https://app.clickup.com/t/abc123`
238
+ - `https://app.clickup.com/t/86abc123`
239
+ - `https://app.clickup.com/{workspace}/v/...?p=abc123`
240
+
241
+ **Returns:**
242
+
243
+ - If no URL: `{ needsInput: true, prompt: "..." }` - asking for URL
244
+ - If URL provided: Full task object with checklists, custom fields, description
245
+ - If "skip": `{ skipped: true }` - continue without ClickUp
246
+
247
+ **Environment Variable Required:** `CLICKUP_API_TOKEN`
248
+
249
+ ### `validate_acceptance_criteria` Tool
250
+
251
+ Parses and validates acceptance criteria from a ClickUp task for testability.
252
+
253
+ **Parameters:**
254
+
255
+ - `task` (object, required): ClickUp task object from `clickup_fetch_task`
256
+ - `acSource` (string, optional): AC source specification (uses `CLICKUP_AC_SOURCE` env var if not provided)
257
+
258
+ **AC Source Formats:**
259
+
260
+ - `checklist:Checklist Name` - Parse from a specific checklist
261
+ - `custom_field:Field Name` - Parse from a custom field
262
+ - `description` - Parse from task description
263
+ - Multiple: `"checklist:Acceptance Criteria,custom_field:AC,description"`
264
+
265
+ **Returns:**
266
+
267
+ - `validatedItems`: Array of AC items with testability analysis
268
+ - `testableCount`: Number of items that can be tested via Maestro
269
+ - `suggestedFlowTypes`: Recommended flow types based on AC content
270
+
271
+ ### `map_AC_to_UI` Tool
272
+
273
+ ⚠️ **HARD VALIDATION** - Maps acceptance criteria items to UI elements and **FAILS on mismatches**.
274
+
275
+ This tool performs strict validation of AC against actual UI implementation. If the AC specifies one value but the UI has a different value, this tool will:
276
+
277
+ 1. **FAIL** (`success: false`)
278
+ 2. **Report** the exact mismatch
279
+ 3. **Block** test generation until resolved
280
+
281
+ **Example:** If AC says "20 days option" but the UI has "Last 30 days", this is a **validation error** - the test should NOT be generated until the discrepancy is resolved.
282
+
283
+ **Parameters:**
284
+
285
+ - `acItems` (array, optional): Validated AC items. If omitted, uses git-only analysis (soft mode).
286
+ - `repoPath` (string, optional): Path to git repository (default: current directory)
287
+ - `changedFiles` (array, optional): List of changed files (auto-detected if omitted)
288
+
289
+ **Returns:**
290
+
291
+ - `success`: **false** if any AC doesn't match UI, **true** if all validated
292
+ - `validationErrors`: Array of mismatches with AC expected vs UI actual
293
+ - `validationWarnings`: Items that couldn't be fully verified
294
+ - `actualUITexts`: Sample of UI text strings extracted from source code
295
+ - `mappings`: Array of AC items with validation status
296
+ - `matchedCount`: Number of fully validated items
297
+ - `failedCount`: Number of items that failed validation
298
+ - `recommendations`: Action items if validation fails
299
+
300
+ **When Validation Fails (success: false):**
301
+
302
+ 🛑 **STOP THE WORKFLOW** - Output recommendation and END.
303
+
304
+ ```
305
+ ❌ Validation Failed - Cannot generate tests.
306
+
307
+ Mismatches found:
308
+ - "Yearly" - Not found in UI
309
+ - "20 days" - Not found. Available: "Last 7 days", "Last 30 days", "Last 90 days"
310
+
311
+ Recommendation: Update the ClickUp AC to match actual UI, OR fix the implementation.
312
+
313
+ Workflow stopped. Re-run after resolving mismatches.
314
+ ```
315
+
316
+ ❌ **FORBIDDEN:** Continuing to generate tests, asking questions, or modifying tests to match UI.
317
+
318
+ ---
319
+
320
+ ## 🚀 Test Execution Tools
321
+
322
+ ### `maestro_write_test` Tool
323
+
324
+ Writes a Maestro test YAML file to disk.
325
+
326
+ **Parameters:**
327
+
328
+ - `yaml` (string, required): The YAML content to write
329
+ - `fileName` (string, required): Name of the file (e.g., "login_test.yaml")
330
+ - `directory` (string, optional): Target directory (default: "maestro")
331
+ - `basePath` (string, optional): Project base path (default: current directory)
332
+
333
+ **Returns:**
334
+
335
+ - `success`: boolean
336
+ - `filePath`: Path where file was written
337
+ - `message`: Status message
338
+
339
+ ### `maestro_execute_test` Tool
340
+
341
+ Executes a single Maestro test file using the Maestro CLI.
342
+
343
+ **Prerequisites:**
344
+
345
+ - Maestro CLI must be installed (`curl -fsSL https://get.maestro.dev | bash`)
346
+ - A device/simulator must be running
347
+
348
+ **Parameters:**
349
+
350
+ - `flowFile` (string, required): Path to the .yaml flow file
351
+ - `deviceId` (string, optional): Target device ID
352
+ - `env` (object, optional): Environment variables to pass
353
+ - `timeout` (number, optional): Execution timeout in ms (default: 120000)
354
+
355
+ **Returns:**
356
+
357
+ - `success`: boolean
358
+ - `output`: Test output/logs
359
+ - `exitCode`: Process exit code
360
+ - `duration`: Execution time in ms
361
+
362
+ ### `maestro_execute_tests_sequential` Tool
363
+
364
+ Executes multiple Maestro test files sequentially with aggregated results.
365
+
366
+ **Parameters:**
367
+
368
+ - `flowFiles` (array, required): Array of flow file paths to execute
369
+ - `deviceId` (string, optional): Target device ID
370
+ - `env` (object, optional): Environment variables to pass
371
+ - `stopOnFailure` (boolean, optional): Stop on first failure (default: false)
372
+
373
+ **Returns:**
374
+
375
+ - `success`: boolean (true if all tests passed)
376
+ - `results`: Array of individual test results
377
+ - `summary`: Aggregated statistics (passed, failed, skipped, duration)
378
+
379
+ ### `maestro_generate_and_run` Tool
380
+
381
+ All-in-one workflow: Generate, write, and execute a Maestro test.
382
+
383
+ **Parameters:**
384
+
385
+ - `feature` (string, required): Feature being tested
386
+ - `action` (string, required): Action being tested
387
+ - `flowType` (string, required): Flow type (auth, form, sidebar, modal, navigation, extended)
388
+ - `basePath` (string, optional): Project base path
389
+ - `deviceId` (string, optional): Target device ID
390
+ - `env` (object, optional): Environment variables
391
+ - `execute` (boolean, optional): Execute after writing (default: true)
392
+ - `changedElements` (array, optional): List of changed UI elements
393
+ - `existingTests` (array, optional): List of existing related test files
394
+
395
+ **Returns:**
396
+
397
+ - `generation`: Generated template and guidelines
398
+ - `write`: File write result
399
+ - `execution`: Test execution results (if execute=true)
400
+ - `summary`: Human-readable summary
401
+
402
+ ### `maestro_discover_tests` Tool
403
+
404
+ Discovers all Maestro test files in a directory.
405
+
406
+ **Parameters:**
407
+
408
+ - `directory` (string, optional): Directory to search (default: "maestro")
409
+ - `basePath` (string, optional): Project base path
410
+
411
+ **Returns:**
412
+
413
+ - `files`: Array of file paths
414
+ - `count`: Number of files found
415
+
416
+ ### `maestro_run_all_tests` Tool
417
+
418
+ Runs all Maestro tests in a directory sequentially.
419
+
420
+ **Parameters:**
421
+
422
+ - `directory` (string, optional): Directory containing tests (default: "maestro")
423
+ - `basePath` (string, optional): Project base path
424
+ - `deviceId` (string, optional): Target device ID
425
+ - `env` (object, optional): Environment variables
426
+ - `stopOnFailure` (boolean, optional): Stop on first failure (default: false)
427
+
428
+ **Returns:**
429
+
430
+ - `discovery`: List of discovered test files
431
+ - `execution`: Results with pass/fail status for each test
432
+ - `summary`: Aggregated statistics
433
+
167
434
  ## 🎯 Usage Examples
168
435
 
169
436
  Once configured in your MCP client, you can use the tools in your conversations:
@@ -237,6 +504,58 @@ env:
237
504
  3. **Quick Reference**: `maestro_cheat_sheet()`
238
505
  4. **Pattern Lookup**: `maestro_pattern(patternType: "login")`
239
506
  5. **UI Discovery**: `maestro_ui_inspection()`
507
+ 6. **Pre-check Installation**: `maestro_ensure_installed()` - Verifies Maestro CLI is ready
508
+
509
+ ### Test Execution Use Cases
510
+
511
+ 6. **Generate & Run Test**:
512
+
513
+ ```
514
+ maestro_generate_and_run(
515
+ feature: "Login",
516
+ action: "OAuth flow",
517
+ flowType: "auth",
518
+ basePath: "/path/to/project"
519
+ )
520
+ ```
521
+
522
+ 7. **Run All Tests in Directory**:
523
+
524
+ ```
525
+ maestro_run_all_tests(
526
+ directory: "maestro",
527
+ basePath: "/path/to/project",
528
+ stopOnFailure: false
529
+ )
530
+ ```
531
+
532
+ 8. **Execute Specific Tests Sequentially**:
533
+
534
+ ```
535
+ maestro_execute_tests_sequential(
536
+ flowFiles: ["maestro/login.yaml", "maestro/checkout.yaml"],
537
+ env: { "BASE_URL": "https://staging.example.com" }
538
+ )
539
+ ```
540
+
541
+ 9. **Write Test File Only (No Execution)**:
542
+
543
+ ```
544
+ maestro_write_test(
545
+ yaml: "<generated yaml content>",
546
+ fileName: "user_settings_reset.yaml",
547
+ basePath: "/path/to/project"
548
+ )
549
+ ```
550
+
551
+ 10. **Discover Available Tests**:
552
+
553
+ ```
554
+ maestro_discover_tests(
555
+ directory: "maestro",
556
+ basePath: "/path/to/project"
557
+ )
558
+ ```
240
559
 
241
560
  ## Flow Types
242
561
 
@@ -259,6 +578,133 @@ env:
259
578
  | `lastCommit` | Most recent commit | `git diff HEAD~1` |
260
579
  | `branch` | Compare to base branch | `git diff {baseBranch}...HEAD` |
261
580
 
581
+ ## 🔄 Complete Workflow Examples
582
+
583
+ ### ⚠️ IMPORTANT: Standard Workflow Order
584
+
585
+ When a user asks to "generate and run test cases" or use Maestro, follow this exact sequence:
586
+
587
+ ```bash
588
+ # Step 1: ALWAYS check Maestro installation first!
589
+ maestro_ensure_installed()
590
+
591
+ # Step 2: ALWAYS ask for ClickUp URL (this is mandatory!)
592
+ clickup_fetch_task()
593
+ # This prompts the user: "Do you have a ClickUp task URL?"
594
+
595
+ # Step 3+: Based on user response, continue workflow
596
+ ```
597
+
598
+ ### Workflow with ClickUp Integration (ASK FIRST)
599
+
600
+ When user prompts: "use maestro-ai to generate and run tests"
601
+
602
+ ```bash
603
+ # Step 1: ALWAYS check Maestro installation first!
604
+ maestro_ensure_installed()
605
+
606
+ # Step 2: ASK for ClickUp task URL
607
+ clickup_fetch_task()
608
+ # Returns: "Do you have a ClickUp task URL for this feature?
609
+ # Paste the URL or type 'skip' to continue."
610
+
611
+ # If user provides URL (e.g., "https://app.clickup.com/t/abc123"):
612
+ clickup_fetch_task(taskUrl: "https://app.clickup.com/t/abc123")
613
+ # Extracts task ID, fetches task data
614
+
615
+ # Step 3: Parse acceptance criteria
616
+ validate_acceptance_criteria(task: <task_from_step_2>)
617
+ # Returns: validatedItems with testability scores
618
+
619
+ # Step 4: Analyze git changes
620
+ maestro_analyze_changes(repoPath: ".")
621
+
622
+ # Step 5: Map AC to UI elements
623
+ map_AC_to_UI(
624
+ acItems: <validated_items>,
625
+ repoPath: ".",
626
+ changedFiles: <from_git_analysis>
627
+ )
628
+
629
+ # Step 6-7: Generate and write test
630
+ maestro_generate_test(...)
631
+ maestro_write_test(...)
632
+ ```
633
+
634
+ ### Workflow without ClickUp (Skip)
635
+
636
+ ```bash
637
+ # Step 1: ALWAYS check Maestro installation first!
638
+ maestro_ensure_installed()
639
+
640
+ # Step 2: ASK for ClickUp task URL
641
+ clickup_fetch_task()
642
+ # User responds: "skip"
643
+
644
+ # Step 3: Analyze git changes (normal flow)
645
+ maestro_analyze_changes(repoPath: ".")
646
+
647
+ # Step 4: Map based on git analysis only
648
+ map_AC_to_UI(repoPath: ".")
649
+
650
+ # Step 5-6: Generate and write test
651
+ maestro_generate_test(...)
652
+ maestro_write_test(...)
653
+ ```
654
+
655
+ ### End-to-End: Analyze Changes → Generate → Execute
656
+
657
+ ```bash
658
+ # Step 0: Ensure Maestro is installed (REQUIRED)
659
+ maestro_ensure_installed()
660
+
661
+ # Step 1: Analyze git changes to see what needs testing
662
+ maestro_analyze_changes(repoPath: "/path/to/project", changeType: "staged")
663
+
664
+ # Output shows: Settings.tsx changed with onClick handler
665
+ # Suggested flow type: form
666
+
667
+ # Step 2: Generate and run the test in one call
668
+ maestro_generate_and_run(
669
+ feature: "User Settings",
670
+ action: "Reset defaults",
671
+ flowType: "form",
672
+ basePath: "/path/to/project",
673
+ env: { "BASE_URL": "https://localhost:8443" }
674
+ )
675
+
676
+ # Output:
677
+ # - File written to: /path/to/project/maestro/user_settings_reset_defaults.yaml
678
+ # - Test executed: ✅ Passed (duration: 12.5s)
679
+ ```
680
+
681
+ ### Sequential Test Suite Execution
682
+
683
+ ```bash
684
+ # Step 0: Ensure Maestro is installed (REQUIRED)
685
+ maestro_ensure_installed()
686
+
687
+ # Discover all tests
688
+ maestro_discover_tests(basePath: "/path/to/project")
689
+ # Output: Found 5 test files
690
+
691
+ # Run all tests with stop-on-failure
692
+ maestro_run_all_tests(
693
+ basePath: "/path/to/project",
694
+ stopOnFailure: true,
695
+ env: { "BASE_URL": "https://staging.example.com" }
696
+ )
697
+
698
+ # Output:
699
+ # ✅ login_basic.yaml (8.2s)
700
+ # ✅ user_settings_open.yaml (5.1s)
701
+ # ❌ checkout_submit.yaml (12.3s) - FAILED
702
+ # ⏭️ payment_confirm.yaml - SKIPPED
703
+ # ⏭️ logout.yaml - SKIPPED
704
+ #
705
+ # Summary: 2 passed, 1 failed, 2 skipped
706
+ ```
707
+
262
708
  ## 📊 Examples
263
709
 
264
710
  ### Auth Flow Template
@@ -280,6 +726,9 @@ env:
280
726
  - tapOn:
281
727
  text: "Next"
282
728
  repeat: 3
729
+ - tapOn:
730
+ text: "Got it"
731
+ repeat: 3
283
732
  - tapOn:
284
733
  text: "Log in"
285
734
  - inputText: ${USER_EMAIL}