Class: Ace::Review::CLI::Commands::FeedbackSubcommands::List
- Inherits:
-
Support::Cli::Command
- Object
- Support::Cli::Command
- Ace::Review::CLI::Commands::FeedbackSubcommands::List
- Includes:
- SessionDiscovery, Support::Cli::Base
- Defined in:
- lib/ace/review/cli/commands/feedback/list.rb
Overview
ace-support-cli Command class for feedback list
Lists feedback items with optional filters.
Instance Method Summary collapse
- #call(**options) ⇒ Object
-
#call_all_sessions(options) ⇒ Object
Handle –session all: aggregate feedback from all sessions.
Methods included from SessionDiscovery
#find_all_sessions, #find_latest_session, #resolve_feedback_path, #resolve_session_dir
Instance Method Details
#call(**options) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/ace/review/cli/commands/feedback/list.rb', line 49 def call(**) # Handle --session all if [:session] == "all" call_all_sessions() return end # Resolve feedback path from session context base_path = resolve_feedback_path() unless base_path raise Ace::Support::Cli::Error.new("Could not determine feedback path. Use --session to specify a review session.") end debug_log("Feedback base path: #{base_path}", ) # Get feedback manager manager = Organisms::FeedbackManager.new # List items with filters items = manager.list( base_path, status: [:status], priority: [:priority] ) # Get archived count for summary (always, for UX awareness) archived_count = count_archived_items(base_path, manager) # Include archived items if requested if [:archived] archive_dir = manager.directory_manager.archive_path(base_path) if Dir.exist?(archive_dir) archived_items = manager.file_reader.read_all(archive_dir) # Apply filters to archived items archived_items = archived_items.select { |i| i.status == [:status] } if [:status] archived_items = archived_items.select { |i| Atoms::PriorityFilter.matches?(i.priority, [:priority]) } if [:priority] items.concat(archived_items) end end # Sort by status priority, then by ID (chronological) items.sort_by! { |item| [status_sort_order(item.status), item.id] } # Output in requested format case [:format] when "json" output_json(items) else output_table(items, archived_count, ) end end |
#call_all_sessions(options) ⇒ Object
Handle –session all: aggregate feedback from all sessions
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/ace/review/cli/commands/feedback/list.rb', line 105 def call_all_sessions() sessions = find_all_sessions if sessions.empty? puts "No sessions found." return end debug_log("Found #{sessions.length} sessions", ) manager = Organisms::FeedbackManager.new all_items = [] total_archived = 0 sessions.each do |session_path| session_name = File.basename(session_path) # List items with filters items = manager.list( session_path, status: [:status], priority: [:priority] ) # Tag items with session name items.each { |item| item.instance_variable_set(:@_session_name, session_name) } # Get archived count total_archived += count_archived_items(session_path, manager) # Include archived items if requested if [:archived] archive_dir = manager.directory_manager.archive_path(session_path) if Dir.exist?(archive_dir) archived_items = manager.file_reader.read_all(archive_dir) archived_items = archived_items.select { |i| i.status == [:status] } if [:status] archived_items = archived_items.select { |i| Atoms::PriorityFilter.matches?(i.priority, [:priority]) } if [:priority] archived_items.each { |item| item.instance_variable_set(:@_session_name, session_name) } items.concat(archived_items) end end all_items.concat(items) end # Sort by status priority, then by ID all_items.sort_by! { |item| [status_sort_order(item.status), item.id] } # Output in requested format case [:format] when "json" output_json_all_sessions(all_items) else output_table_all_sessions(all_items, total_archived, ) end end |