@deriv-com/fe-mcp-servers 0.0.12 → 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)
@@ -197,6 +215,108 @@ Automatically analyzes actual git changes in a repository and provides test reco
197
215
 
198
216
  ---
199
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
+
200
320
  ## 🚀 Test Execution Tools
201
321
 
202
322
  ### `maestro_write_test` Tool
@@ -458,18 +578,78 @@ maestro_discover_tests(
458
578
  | `lastCommit` | Most recent commit | `git diff HEAD~1` |
459
579
  | `branch` | Compare to base branch | `git diff {baseBranch}...HEAD` |
460
580
 
461
- ## 🔄 Complete Workflow Example
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?"
462
594
 
463
- ### ⚠️ IMPORTANT: Always Check Installation First!
595
+ # Step 3+: Based on user response, continue workflow
596
+ ```
464
597
 
465
- When a user asks to "generate and run test cases" or use Maestro, follow this order:
598
+ ### Workflow with ClickUp Integration (ASK FIRST)
599
+
600
+ When user prompts: "use maestro-ai to generate and run tests"
466
601
 
467
602
  ```bash
468
- # Step 0: ALWAYS check Maestro installation first!
603
+ # Step 1: ALWAYS check Maestro installation first!
469
604
  maestro_ensure_installed()
470
605
 
471
- # If not installed, the tool will automatically install it via:
472
- # curl -fsSL "https://get.maestro.mobile.dev" | bash
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(...)
473
653
  ```
474
654
 
475
655
  ### End-to-End: Analyze Changes → Generate → Execute