watch method

  1. @cliCommand
Future<void> watch({
  1. String? source,
  2. String? type,
  3. String? prefix,
  4. int? maxSize,
  5. bool? removeComments,
  6. String? format,
  7. String? profile,
  8. bool verbose = false,
})

Watch mode - auto-regenerate when source files change

Monitors the source directory for changes and automatically regenerates output files when files are modified.

Implementation

@cliCommand
Future<void> watch({
  /// Source directory to watch (default: auto-detect)
  String? source,

  /// Project type: auto, dart, python, javascript, typescript, go, rust, java, kotlin, swift, cpp, csharp, ruby, php, web, generic
  String? type,

  /// Output file prefix (default: CLAUDIO)
  String? prefix,

  /// Maximum size per output file in KB (default: 1000)
  int? maxSize,

  /// Remove comments from output (default: true)
  bool? removeComments,

  /// Output format: text, markdown, or json (default: text)
  String? format,

  /// Load settings from a saved profile
  String? profile,

  /// Show verbose output
  bool verbose = false,
}) async {
  try {
    // Build configuration
    final config = await _buildConfig(
      source: source,
      type: type,
      prefix: prefix,
      maxSize: maxSize,
      removeComments: removeComments,
      format: format,
      profile: profile,
      verbose: verbose,
    );

    // Start watching
    final watcher = FileWatcher(config);
    await watcher.startWatching();
  } catch (e) {
    error('Watch mode failed: $e');
    exit(1);
  }
}