flutter_fix_common_issues
Fix common Flutter development issues by automatically running clean, pub get, pod install, gradle sync, and cache invalidation commands in your project directory.
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 (registration)Registration of the 'flutter_fix_common_issues' tool including inline schema and handler implementationtools.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:517-576 (handler)The handler function executes the tool logic: flutter clean, pub get, conditional pod install, and optional deep cleaning with rm and gradlew clean.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 defining cwd (required) and optional deep boolean 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-352 (helper)Metadata registration in TOOL_REGISTRY providing category, platform, requirements, and performance info for the tool.'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 }