Skip to content

Commit 0246a2c

Browse files
committed
fix: require mcp subcommand in QA docs and harden Swift escaping
1 parent 2d480e5 commit 0246a2c

2 files changed

Lines changed: 15 additions & 7 deletions

File tree

.claude/agents/xcodebuild-mcp-qa-tester.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ After testing `list_sims` tool, update the report:
7676
## Detailed Test Results
7777

7878
### Tool: list_sims ✅ PASSED
79-
**Command:** `npx reloaderoo@latest inspect call-tool list_sims --params '{}' -- node build/cli.js`
79+
**Command:** `npx reloaderoo@latest inspect call-tool list_sims --params '{}' -- node build/cli.js mcp`
8080
**Verification:** Command returned JSON array with 6 simulator objects
8181
**Validation Summary:** Successfully discovered 6 available simulators with UUIDs, names, and boot status
8282
**Timestamp:** 2025-01-29 14:30:15
@@ -87,8 +87,8 @@ After testing `list_sims` tool, update the report:
8787
### Pre-Testing Setup
8888
- Always start by building the project: `npm run build`
8989
- Verify Reloaderoo is available: `npx reloaderoo@latest --help`
90-
- Check server connectivity: `npx reloaderoo@latest inspect ping -- node build/cli.js`
91-
- Get server information: `npx reloaderoo@latest inspect server-info -- node build/cli.js`
90+
- Check server connectivity: `npx reloaderoo@latest inspect ping -- node build/cli.js mcp`
91+
- Get server information: `npx reloaderoo@latest inspect server-info -- node build/cli.js mcp`
9292

9393
### Systematic Testing Workflow
9494
1. **Create Initial Report**: Generate test report with all checkboxes unchecked
@@ -108,15 +108,15 @@ After testing `list_sims` tool, update the report:
108108

109109
### Tool Testing Process
110110
For each tool:
111-
1. Execute test with `npx reloaderoo@latest inspect call-tool <tool_name> --params '<json>' -- node build/cli.js`
111+
1. Execute test with `npx reloaderoo@latest inspect call-tool <tool_name> --params '<json>' -- node build/cli.js mcp`
112112
2. Verify response format and content
113113
3. **IMMEDIATELY** update test report with result
114114
4. Check the box and add detailed verification summary
115115
5. Move to next tool
116116

117117
### Resource Testing Process
118118
For each resource:
119-
1. Execute test with `npx reloaderoo@latest inspect read-resource "<uri>" -- node build/cli.js`
119+
1. Execute test with `npx reloaderoo@latest inspect read-resource "<uri>" -- node build/cli.js mcp`
120120
2. Verify resource accessibility and content format
121121
3. **IMMEDIATELY** update test report with result
122122
4. Check the box and add detailed verification summary

src/mcp/tools/ui-automation/screenshot.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,22 @@ interface SimctlDeviceList {
4343
devices: Record<string, SimctlDevice[]>;
4444
}
4545

46+
function escapeSwiftStringLiteral(value: string): string {
47+
return value
48+
.replace(/\\/g, '\\\\')
49+
.replace(/"/g, '\\"')
50+
.replace(/\n/g, '\\n')
51+
.replace(/\r/g, '\\r')
52+
.replace(/\t/g, '\\t');
53+
}
54+
4655
/**
4756
* Generates Swift code to detect simulator window dimensions via CoreGraphics.
4857
* Filters by device name to handle multiple open simulators correctly.
4958
* Returns "width,height" of the matching simulator window.
5059
*/
5160
function getWindowDetectionSwiftCode(deviceName: string): string {
52-
// Escape the device name for use in Swift string
53-
const escapedDeviceName = deviceName.replace(/"/g, '\\"');
61+
const escapedDeviceName = escapeSwiftStringLiteral(deviceName);
5462
// Use hasPrefix + boundary check to avoid matching "iPhone 15" when looking for "iPhone 15 Pro"
5563
// Window titles are formatted like "iPhone 15 Pro – iOS 17.2"
5664
return `

0 commit comments

Comments
 (0)