Module: Ace::Review::CLI
- Defined in:
- lib/ace/review/cli.rb,
lib/ace/review/cli/commands/review.rb,
lib/ace/review/cli/commands/feedback.rb,
lib/ace/review/cli/commands/feedback/list.rb,
lib/ace/review/cli/commands/feedback/show.rb,
lib/ace/review/cli/commands/feedback/skip.rb,
lib/ace/review/cli/commands/feedback/create.rb,
lib/ace/review/cli/commands/feedback/verify.rb,
lib/ace/review/cli/commands/feedback/resolve.rb,
lib/ace/review/cli/commands/feedback/session_discovery.rb
Overview
CLI namespace for ace-review command loading.
ace-review uses a single-command ace-support-cli entrypoint that calls CLI::Commands::Review directly from the executable.
Defined Under Namespace
Modules: Commands
Constant Summary collapse
- ARRAY_SEPARATOR =
Separator for array options that won’t conflict with internal commas ASCII Unit Separator (0x1F) is designed for separating fields
"\x1F"
Class Method Summary collapse
-
.extract_flag_value(arg, args, index) ⇒ String
Extract value from flag argument.
-
.preprocess_array_options(args) ⇒ Array<String>
Pre-process array options to work around ace-support-cli limitation.
-
.skip_to_next_arg(args, index) ⇒ Integer
Calculate next index after consuming flag value.
-
.start(args) ⇒ Object
Entry point for CLI invocation (used by tests via cli_helpers).
Class Method Details
.extract_flag_value(arg, args, index) ⇒ String
Extract value from flag argument
72 73 74 75 76 77 78 79 80 |
# File 'lib/ace/review/cli.rb', line 72 def self.extract_flag_value(arg, args, index) if arg.include?("=") arg.split("=", 2)[1] elsif index + 1 < args.length && !args[index + 1].start_with?("--") args[index + 1] else "" end end |
.preprocess_array_options(args) ⇒ Array<String>
Pre-process array options to work around ace-support-cli limitation
ace-support-cli’s type: :array only captures the last occurrence of a flag. This method merges multiple occurrences using ARRAY_SEPARATOR (not comma) to preserve internal commas in subject values like “files:a.rb,b.rb”.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/ace/review/cli.rb', line 29 def self.(args) result = [] i = 0 accumulated_subject = [] accumulated_model = [] while i < args.length arg = args[i] # Track --subject occurrences for merging if arg == "--subject" || arg.start_with?("--subject=") value = extract_flag_value(arg, args, i) accumulated_subject << value i = skip_to_next_arg(args, i) next end # Track --model occurrences for merging if arg == "--model" || arg.start_with?("--model=") value = extract_flag_value(arg, args, i) accumulated_model << value i = skip_to_next_arg(args, i) next end result << arg i += 1 end # Insert merged flags at position 0 (single-command mode, no command name to skip) result.insert(0, "--model", accumulated_model.join(",")) unless accumulated_model.empty? # Subject uses ARRAY_SEPARATOR to preserve internal commas (e.g., files:a.rb,b.rb) result.insert(0, "--subject", accumulated_subject.join(ARRAY_SEPARATOR)) unless accumulated_subject.empty? result end |
.skip_to_next_arg(args, index) ⇒ Integer
Calculate next index after consuming flag value
87 88 89 90 91 92 93 |
# File 'lib/ace/review/cli.rb', line 87 def self.skip_to_next_arg(args, index) if args[index].include?("=") || (index + 1 < args.length && !args[index + 1].start_with?("--")) index + 2 else index + 1 end end |