flutter_fix_common_issues
Automatically resolve common Flutter development issues by cleaning projects, restoring dependencies, and syncing build systems to restore functionality.
Instructions
Auto-fix common issues: clean, pub get, pod install, gradle sync, invalidate caches
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | Yes | Working directory (Flutter project root) | |
| deep | No | Perform deep cleaning (slower but more thorough) |
Implementation Reference
- src/tools/super-tools.ts:499-577 (handler)Full implementation of the 'flutter_fix_common_issues' super-tool including name, description, input schema, and handler function. The handler orchestrates multiple steps: flutter clean, pub get, pod install (on macOS), and optional deep clean removing build artifacts, dart_tool, packages, gradle clean, and Xcode DerivedData.tools.set('flutter_fix_common_issues', { name: 'flutter_fix_common_issues', description: 'Auto-fix common issues: clean, pub get, pod install, gradle sync, invalidate caches', inputSchema: { type: 'object', properties: { cwd: { type: 'string', description: 'Working directory (Flutter project root)' }, deep: { type: 'boolean', description: 'Perform deep cleaning (slower but more thorough)', default: false } }, required: ['cwd'] }, handler: async (args: any) => { const fixes = []; try { // Step 1: Flutter clean const cleanResult = await flutterTools.get('flutter_clean').handler({ cwd: args.cwd }); fixes.push({ step: 'flutter_clean', ...cleanResult }); // Step 2: Flutter pub get const pubResult = await flutterTools.get('flutter_pub_get').handler({ cwd: args.cwd }); fixes.push({ step: 'flutter_pub_get', ...pubResult }); // Step 3: iOS pod install (if on macOS) if (process.platform === 'darwin') { try { const { stdout } = await processExecutor.execute( 'pod', ['install'], { cwd: `${args.cwd}/ios` } ); fixes.push({ step: 'pod_install', success: true, data: stdout }); } catch (e) { fixes.push({ step: 'pod_install', success: false, error: 'Pod install failed' }); } } // Step 4: Deep clean if requested if (args.deep) { // Remove build directories await processExecutor.execute('rm', ['-rf', 'build'], { cwd: args.cwd }); await processExecutor.execute('rm', ['-rf', '.dart_tool'], { cwd: args.cwd }); await processExecutor.execute('rm', ['-rf', '.packages'], { cwd: args.cwd }); // Android specific await processExecutor.execute('./gradlew', ['clean'], { cwd: `${args.cwd}/android` }); // iOS specific if (process.platform === 'darwin') { await processExecutor.execute('rm', ['-rf', 'ios/Pods'], { cwd: args.cwd }); await processExecutor.execute('rm', ['-rf', `${process.env.HOME}/Library/Developer/Xcode/DerivedData`], {}); } fixes.push({ step: 'deep_clean', success: true }); } return { success: true, data: { fixes, message: 'Common issues fixed successfully' } }; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error), data: { fixes } }; } } });
- src/tools/super-tools.ts:502-516 (schema)Input schema definition for the tool, specifying cwd (required) and optional deep cleaning flag.inputSchema: { type: 'object', properties: { cwd: { type: 'string', description: 'Working directory (Flutter project root)' }, deep: { type: 'boolean', description: 'Perform deep cleaning (slower but more thorough)', default: false } }, required: ['cwd'] },
- src/utils/tool-categories.ts:345-353 (registration)Metadata registration of the tool in the central TOOL_REGISTRY, including category, platform, requirements, description, and performance expectations.'flutter_fix_common_issues': { name: 'flutter_fix_common_issues', category: ToolCategory.ESSENTIAL, platform: 'flutter', requiredTools: [RequiredTool.FLUTTER], description: 'Auto-fix common issues: clean, pub get, pod install, gradle sync, invalidate caches', safeForTesting: false, performance: { expectedDuration: 60000, timeout: 300000 } },