execute method
Execute the command.
Implementation
@override
Future<CommandResult> execute(String args, ToolUseContext context) async {
final name = args.trim().isNotEmpty ? args.trim() : null;
// Check prerequisites.
final prerequisiteResult = await checkBridgePrerequisites();
if (!prerequisiteResult.canConnect) {
return TextCommandResult(
prerequisiteResult.errorMessage ?? 'Remote Control is not available.',
);
}
// In the full implementation, this would:
// 1. Check if already connected (show disconnect dialog)
// 2. Check if remote callout should be shown
// 3. Enable bridge in app state
// 4. Return connecting message
//
// For the CLI port, we return the connecting message and let the
// bridge system handle the actual connection.
return TextCommandResult(
'Remote Control connecting...\n'
'${name != null ? 'Session name: $name\n' : ''}'
'The bridge will register this environment and create a session.\n'
'You can then control this CLI session from neomage.ai.',
);
}