run method

  1. @override
void run()
override

Runs this command.

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

Implementation

@override
void run() {
  if (!ContextService.isInitialized()) {
    print('ContextForge has not been initialized in this repository.\n');
    print('Run:');
    print('  contextforge init');
    return;
  }

  ContextService.ensureContextFilesExist();

  print('What did you complete today?');
  final completed = _readLine();

  print('What are you currently working on?');
  final inProgress = _readLine();

  print('What is next?');
  final next = _readLine();

  final date = DateTime.now().toIso8601String().split('T').first; // YYYY-MM-DD
  final updateEntry = '''

## Update – $date

Completed
- $completed

In Progress
- $inProgress

Next
- $next
''';

  FileService.appendFile('${ContextService.contextDir}/progress.md', updateEntry);

  print('✔ Progress updated');
}