getRecentProgress static method

List<String> getRecentProgress({
  1. int lines = 5,
})

Get recent progress updates from progress.md

Implementation

static List<String> getRecentProgress({int lines = 5}) {
  try {
    final path = '$contextDir/progress.md';
    if (!FileService.fileExists(path)) {
      return [];
    }

    final content = FileService.readFile(path);
    final fileLines = content.split('\n');

    // Get non-empty lines (skip headers, etc)
    final progressLines = fileLines
        .where((line) => line.trim().isNotEmpty && !line.startsWith('#'))
        .toList();

    // Return last N lines
    if (progressLines.isEmpty) return [];
    return progressLines.sublist(
      progressLines.length > lines ? progressLines.length - lines : 0,
    );
  } catch (e) {
    return [];
  }
}