Class: Caruso::Adapters::CommandAdapter

Inherits:
Base
  • Object
show all
Defined in:
lib/caruso/adapters/command_adapter.rb

Instance Attribute Summary

Attributes inherited from Base

#agent, #files, #marketplace_name, #plugin_name, #target_dir

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Caruso::Adapters::Base

Instance Method Details

#adapt ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/caruso/adapters/command_adapter.rb', line 8

def adapt
  created_files = []
  files.each do |file_path|
    content = SafeFile.read(file_path)
    rewritten_content, copied_scripts = copy_command_scripts_and_rewrite_paths(content, file_path)
    adapted_content = adapt_command_content(rewritten_content, file_path)

    # Commands are flat .md files in .cursor/commands/
    # NOT nested like rules, so we override the save behavior
    created_file = save_command_file(file_path, adapted_content)

    created_files << created_file
    created_files.concat(copied_scripts)
  end
  created_files
end