Class: Ace::PromptPrep::CLI::Commands::Process
- Inherits:
-
Support::Cli::Command
- Object
- Support::Cli::Command
- Ace::PromptPrep::CLI::Commands::Process
- Includes:
- Support::Cli::Base
- Defined in:
- lib/ace/prompt_prep/cli/commands/process.rb
Overview
ace-support-cli Command class for the process command
This wraps the existing PromptProcessor logic in a ace-support-cli compatible interface, maintaining complete parity with the Thor implementation.
Instance Method Summary collapse
Instance Method Details
#call(**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 |
# File 'lib/ace/prompt_prep/cli/commands/process.rb', line 63 def call(**) # Determine bundle flag bundle_enabled = determine_bundle_enabled() # Determine enhance flag enhance_enabled = determine_enhance_enabled() # Resolve task prompt path (handles both explicit --task and auto-detection) task_prompt_path = resolve_task_prompt_path([:task]) # Process prompt result = Organisms::PromptProcessor.call( input_path: task_prompt_path, bundle: bundle_enabled, enhance: enhance_enabled, model: [:model], system_prompt: [:system_prompt] ) unless result[:success] raise Ace::Support::Cli::Error.new(result[:error]) end # Handle output output_mode = [:output] || "-" if output_mode == "-" # Output to stdout puts result[:content] else # Write to file require "fileutils" FileUtils.mkdir_p(File.dirname(output_mode)) begin File.write(output_mode, result[:content], encoding: "utf-8") # Output summary to stdout $stdout.puts "Prompt archived and saved:" $stdout.puts " Archive: #{result[:archive_path]}" $stdout.puts " Output: #{File.(output_mode)}" rescue => e raise Ace::Support::Cli::Error.new("Failed to write output file: #{e.}") end end rescue Ace::PromptPrep::Error => e raise Ace::Support::Cli::Error.new(e.) end |