processDirectory method

Future<ProcessingResult> processDirectory()

Process all files in the target directory

Implementation

Future<ProcessingResult> processDirectory() async {
  _processedCount = 0;
  _failedCount = 0;
  _totalEmbeddings = 0;
  _errors.clear();

  final targetDir = Directory(targetDirectory);
  if (!await targetDir.exists()) {
    throw Exception('Target directory not found: $targetDirectory');
  }

  _logger.info('📁 Starting directory processing: $targetDirectory');
  if (verbose) {
    _logger.fine(
      '🔍 [VERBOSE] Absolute path: ${Directory(targetDirectory).absolute.path}',
    );
  }

  // Recursive traversal of all files
  await _processDirectoryRecursive(targetDir);

  return ProcessingResult(
    processedCount: _processedCount,
    failedCount: _failedCount,
    totalEmbeddings: _totalEmbeddings,
    errors: List.unmodifiable(_errors),
  );
}