displayPlan function
Renders the list of planned actions before confirming apply.
Implementation
void displayPlan(List<PlanItemMessage> items) {
if (items.isEmpty) {
print(' (no actions planned)');
return;
}
// Group by pack
final byPack = <String, List<PlanItemMessage>>{};
for (final item in items) {
byPack.putIfAbsent(item.pack, () => []).add(item);
}
for (final entry in byPack.entries) {
print('\n [${entry.key}]');
for (final item in entry.value) {
final icon = switch (item.action) {
'create_file' => '+',
'patch_file' => '~',
'add_dependency' => 'd',
_ => '•',
};
print(' $icon ${item.path}');
}
}
print('');
print(' Total: ${items.length} actions across ${byPack.length} pack(s)');
}