debug-workflow.tsโข4.13 kB
import { McpError, ErrorCode } from '@modelcontextprotocol/sdk/types.js';
interface DebugWorkflowArgs {
projectPath: string;
scheme: string;
simulator?: string;
}
export async function debugWorkflowPrompt(args: any) {
const { projectPath, scheme, simulator } = args as DebugWorkflowArgs;
if (!projectPath || !scheme) {
throw new McpError(
ErrorCode.InvalidRequest,
'debug-workflow requires projectPath and scheme arguments'
);
}
const simulatorText = simulator
? ` targeting simulator "${simulator}"`
: ' (will auto-select optimal simulator)';
return {
description: 'iOS Debug Workflow - Complete build, install, and test cycle',
messages: [
{
role: 'user' as const,
content: {
type: 'text' as const,
text: `XC-MCP iOS Debug Workflow for project: ${projectPath}
๐จ **CRITICAL: After ANY code changes, you MUST REBUILD to get a FRESH INSTALL!**
๐จ **Without rebuilding, you're testing the OLD cached version = wasted time!**
๐จ **Always use XC-MCP tools - they provide intelligent caching and better error handling than raw CLI!**
**Project**: ${projectPath}
**Scheme**: ${scheme}${simulatorText}
## Essential Steps (NEVER skip these):
### 1. ๐๏ธ BUILD (ALWAYS FIRST) - Use XC-MCP Tool
**Call the \`xcodebuild-build\` XC-MCP tool** (NOT raw xcodebuild CLI):
- projectPath: "${projectPath}"
- scheme: "${scheme}"${simulator ? `\n- destination: "platform=iOS Simulator,name=${simulator}"` : ''}
๐ง **XC-MCP Advantage**: Intelligent caching, progressive disclosure, and build optimization!
โ ๏ธ **VALIDATION CHECKPOINT**: Build MUST succeed before proceeding!
### 2. ๐ VALIDATE BUILD SUCCESS
- Check the \`xcodebuild-build\` tool response for \`"success": true\`
- If build fails, use \`xcodebuild-get-details\` tool for full error logs
- Fix errors and restart from step 1
- DO NOT proceed to testing with a failed build
### 3. ๐ ENSURE SIMULATOR IS READY (If Needed)
- If simulator isn't running, use \`simctl-boot\` XC-MCP tool to start it
- Use \`simctl-list\` tool to see available simulators (not raw simctl!)
### 4. ๐ฑ FRESH REINSTALL (Automatic but Critical)
- App automatically REINSTALLS FRESH to simulator during successful XC-MCP build
- This OVERWRITES the old version with your new changes
- The fresh install happens automatically during the build process
- **CRITICAL**: Without using XC-MCP build tools, you'll test the OLD cached version!
### 5. ๐งช TEST YOUR CHANGES
- Launch your app on the simulator
- Test the specific changes you made
- Verify expected behavior
## ๐ **AFTER MAKING CODE CHANGES**
**You MUST restart from Step 1 (XC-MCP BUILD TOOL) - never test without rebuilding!**
## โ ๏ธ Common Mistakes to Avoid:
โ **FATAL ERROR**: Using raw xcodebuild CLI instead of XC-MCP tools
โ **FATAL ERROR**: Testing without rebuilding after code changes
โ **FATAL ERROR**: Testing the old cached app version instead of fresh rebuild
โ Proceeding to test after a failed build
โ Forgetting to validate build success with XC-MCP tools
โ Assuming your code changes are active without rebuilding
## ๐ฏ Remember:
**XC-MCP REBUILD = FRESH REINSTALL = NEW CODE ACTIVE**
**NO XC-MCP REBUILD = OLD CACHED APP = WASTED TIME DEBUGGING**
**ALWAYS USE XC-MCP TOOLS FOR INTELLIGENT CACHING & ERROR HANDLING**
This workflow ensures you're always testing the LATEST version of your code changes using XC-MCP's intelligent tooling.`,
},
},
],
};
}
export const debugWorkflowPromptDefinition = {
name: 'debug-workflow',
description:
'Complete iOS debug workflow: build โ install โ test cycle with validation to prevent testing stale app versions',
arguments: [
{
name: 'projectPath',
description: 'Path to .xcodeproj or .xcworkspace file',
required: true,
},
{
name: 'scheme',
description: 'Build scheme name',
required: true,
},
{
name: 'simulator',
description: 'Target simulator (optional - will use smart defaults if not provided)',
required: false,
},
],
};