Class: Ace::Idea::CLI::Commands::Create
- Inherits:
-
Support::Cli::Command
- Object
- Support::Cli::Command
- Ace::Idea::CLI::Commands::Create
- Includes:
- Support::Cli::Base
- Defined in:
- lib/ace/idea/cli/commands/create.rb
Overview
ace-support-cli Command class for ace-idea create
Instance Method Summary collapse
Instance Method Details
#call(content: nil, **options) ⇒ Object
44 45 46 47 48 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 |
# File 'lib/ace/idea/cli/commands/create.rb', line 44 def call(content: nil, **) clipboard = [:clipboard] llm_enhance = [:"llm-enhance"] move_to = [:"move-to"] title = [:title] = [:tags] dry_run = [:"dry-run"] # Parse tags from comma-separated string = ? .split(",").map(&:strip).reject(&:empty?) : [] # Require content or clipboard if content.nil? && !clipboard warn "Error: provide content or --clipboard" warn "" warn "Usage: ace-idea create [CONTENT] [--clipboard] [--title T] [--tags T1,T2] [--move-to FOLDER]" raise Ace::Support::Cli::Error.new("Content or --clipboard required") end if dry_run puts "Would create idea:" puts " Content: #{content || "(from clipboard)"}" puts " Title: #{title || "(auto-generated)"}" puts " Tags: #{.any? ? .join(", ") : "(none)"}" puts " Folder: #{move_to ? "_#{move_to.delete_prefix("_")}" : "(root)"}" puts " LLM: #{llm_enhance ? "yes" : "no"}" return end manager = Ace::Idea::Organisms::IdeaManager.new idea = begin manager.create( content, title: title, tags: , move_to: move_to, clipboard: clipboard || false, llm_enhance: llm_enhance || false ) rescue Ace::Idea::Organisms::IdeaManager::CreateRetriesExhaustedError => e raise Ace::Support::Cli::Error, e. end folder_info = idea.special_folder ? " (#{idea.special_folder})" : "" puts "Idea created: #{idea.id} #{idea.title}#{folder_info}" puts " Path: #{idea.file_path}" if [:git_commit] Ace::Support::Items::Molecules::GitCommitter.commit( paths: [idea.path], intention: "create idea #{idea.id}" ) end end |