Class: Ace::Review::CLI::Commands::FeedbackSubcommands::Verify

Inherits:
Support::Cli::Command
  • Object
show all
Includes:
SessionDiscovery, Support::Cli::Base
Defined in:
lib/ace/review/cli/commands/feedback/verify.rb

Overview

ace-support-cli Command class for feedback verify

Verifies a draft feedback item by marking it as valid or invalid.

Instance Method Summary collapse

Methods included from SessionDiscovery

#find_all_sessions, #find_latest_session, #resolve_feedback_path, #resolve_session_dir

Instance Method Details

#call(id:, **options) ⇒ Object



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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/ace/review/cli/commands/feedback/verify.rb', line 63

def call(id:, **options)
  # Validate: must specify exactly one of --valid, --invalid, or --skip
  mode_count = [options[:valid], options[:invalid], options[:skip]].count { |v| v }

  if mode_count > 1
    raise Ace::Support::Cli::Error.new("Cannot specify multiple modes. Use exactly one of: --valid, --invalid, --skip.")
  end

  unless mode_count == 1
    raise Ace::Support::Cli::Error.new("Must specify exactly one of: --valid, --invalid, --skip.")
  end

  # Resolve feedback path from session context
  base_path = resolve_feedback_path(options)

  unless base_path
    raise Ace::Support::Cli::Error.new("No session found. Run a review first or use --session to specify path.")
  end

  debug_log("Feedback base path: #{base_path}", options)

  # Find item first for partial ID matching
  resolved_id = resolve_full_id(base_path, id)

  unless resolved_id
    raise Ace::Support::Cli::Error.new("Feedback item not found: #{id}")
  end

  # Verify the item
  manager = Organisms::FeedbackManager.new
  result = manager.verify(
    base_path,
    resolved_id,
    valid: if options[:valid] == true
             true
           else
             ((options[:invalid] == true) ? false : nil)
           end,
    skip: (options[:skip] == true) ? true : nil,
    research: options[:research]
  )

  if result[:success]
    status = if options[:valid]
      "valid (pending)"
    elsif options[:invalid]
      "invalid (archived)"
    else
      "skipped (archived)"
    end
    puts "Feedback #{resolved_id} marked as #{status}."
    puts "Research: #{options[:research]}" if options[:research] && !quiet?(options)
  else
    raise Ace::Support::Cli::Error.new(result[:error])
  end
end