cleanupPartialClone function

Future<void> cleanupPartialClone(
  1. String clientId
)

Cleans up a partial or broken clone by removing its associated directory.

This function deletes the entire directory corresponding to the specified clientId within the ./clonify/clones/ path. This is useful for removing incomplete or problematic clone setups.

clientId The ID of the client whose clone directory should be removed.

Throws a FileSystemException if the directory exists but cannot be deleted.

Implementation

Future<void> cleanupPartialClone(String clientId) async {
  final cloneDir = Directory('./clonify/clones/$clientId');
  if (cloneDir.existsSync()) {
    cloneDir.deleteSync(recursive: true);
    logger.i('🧹 Partial clone cleaned up for $clientId.');
  }
}