run method
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.\nRun: contextforge init');
return;
}
ContextService.ensureDataFilesExist();
final decisions = ContextService.loadDecisions();
if (decisions.isEmpty) {
print('No decisions tracked yet.\nRun: contextforge decision add');
return;
}
// Sort by date (newest first)
decisions.sort((a, b) => b.createdAt.compareTo(a.createdAt));
print('\n🔧 Decisions\n');
for (final decision in decisions) {
print(decision.title);
print(' Reason: ${decision.reason}');
if (decision.alternatives.isNotEmpty) {
print(' Alternatives: ${decision.alternatives.join(", ")}');
}
print('');
}
print('Total: ${decisions.length} decisions');
}