Module: Legion::CLI::InitHelpers::ConfigGenerator
- Defined in:
- lib/legion/cli/init/config_generator.rb
Constant Summary collapse
- TEMPLATE_DIR =
File.('../templates', __dir__)
- CONFIG_DIR =
File.('~/.legionio/settings')
- GITIGNORE_ENTRIES =
%w[ .legion-context/ .legion-worktrees/ ].freeze
Class Method Summary collapse
Class Method Details
.generate(options = {}) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/legion/cli/init/config_generator.rb', line 14 def generate( = {}) FileUtils.mkdir_p(CONFIG_DIR) generated = [] %w[core].each do |name| template_path = File.join(TEMPLATE_DIR, "#{name}.json.erb") next unless File.exist?(template_path) output_path = File.join(CONFIG_DIR, "#{name}.json") next if File.exist?(output_path) && ![:force] content = render_template(template_path, ) File.write(output_path, content) generated << output_path end generated end |
.scaffold_workspace(dir = '.') ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/legion/cli/init/config_generator.rb', line 33 def scaffold_workspace(dir = '.') workspace_dir = File.join(dir, '.legion') FileUtils.mkdir_p(File.join(workspace_dir, 'agents')) FileUtils.mkdir_p(File.join(workspace_dir, 'skills')) FileUtils.mkdir_p(File.join(workspace_dir, 'memory')) settings_path = File.join(workspace_dir, 'settings.json') File.write(settings_path, "{}\n") unless File.exist?(settings_path) ensure_gitignore_entries(dir) workspace_dir end |