run method

  1. @override
Future<void> run()
override

Runs this command.

The return value is wrapped in a Future if necessary and returned by CommandRunner.runCommand.

Implementation

@override
Future<void> run() async {
  final String serverDir = Project.serverDir;

  if (!Directory(serverDir).existsSync()) {
    Logger.fail('Server directory not found: $serverDir');
    exit(1);
  }

  // Validate .env and test database connection (exits on failure)
  await EnvService.validate(serverDir);

  await RustServerService.stopExisting();
  await RustServerService.buildAndRun(serverDir);
}