Class: Chiron::CLI
- Inherits:
-
Thor
- Object
- Thor
- Chiron::CLI
- Defined in:
- lib/chiron/cli.rb
Class Method Summary collapse
Instance Method Summary collapse
- #add_workflow(workflow_name) ⇒ Object
- #doctor ⇒ Object
- #init ⇒ Object
- #migrate_cursor ⇒ Object
- #update ⇒ Object
- #version ⇒ Object
Class Method Details
.exit_on_failure? ⇒ Boolean
12 13 14 |
# File 'lib/chiron/cli.rb', line 12 def self.exit_on_failure? true end |
Instance Method Details
#add_workflow(workflow_name) ⇒ Object
88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/chiron/cli.rb', line 88 def add_workflow(workflow_name) available_workflows = Dir.glob(File.join(templates_path, 'commands/**/*.md')) .map { |f| File.basename(f, '.md') } unless available_workflows.include?(workflow_name) error "Unknown workflow: #{workflow_name}" say "Available workflows: #{available_workflows.join(', ')}" exit 1 end copy_workflow(workflow_name) say "✅ Added #{workflow_name} workflow".colorize(:green) end |
#doctor ⇒ Object
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/chiron/cli.rb', line 118 def doctor say '🏥 Running Claude setup diagnostics...'.colorize(:blue) project_type = detect_project_type checks = { "#{project_type.to_s.capitalize} project" => project_type != :unknown, 'CLAUDE.md exists' => File.exist?('CLAUDE.md'), '.claude directory' => Dir.exist?('.claude'), '.claude/commands' => Dir.exist?('.claude/commands'), 'Development journal' => File.exist?('docs/development_journal.md'), 'Tasks directory' => Dir.exist?('tasks'), '.gitignore entry' => begin File.read('.gitignore').include?('.claude/') rescue StandardError false end } # Add project-specific checks case project_type when :rails checks['Gemfile exists'] = File.exist?('Gemfile') checks['Rails app structure'] = Dir.exist?('app') when :python checks['Python package file'] = python_package_exists? end checks.each do |check, result| status = result ? '✅'.colorize(:green) : '❌'.colorize(:red) say "#{status} #{check}" end if checks.values.all? say "\n✨ All checks passed!".colorize(:green) else say "\n⚠️ Some checks failed. Run 'chiron init' to fix.".colorize(:yellow) end end |
#init ⇒ Object
25 26 27 28 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 65 |
# File 'lib/chiron/cli.rb', line 25 def init say '🤖 Initializing Claude Setup...'.colorize(:blue) @prompt = TTY::Prompt.new @project_type = determine_project_type @project_name = [:project_name] || prompt_for_project_name @user_name = [:user_name] || detect_user_name # Set up project configuration if @project_type == :python @python_framework = detect_python_framework @config = ProjectConfig.new(@project_type, @python_framework) else @config = ProjectConfig.new(@project_type) end check_project_compatibility create_directories copy_templates update_gitignore say "\n✨ Claude workflow initialized successfully!".colorize(:green) say "\nNext steps:".colorize(:yellow) say ' 1. Review and customize CLAUDE.md for your project' say ' 2. Check .claude/commands/ for available workflows' say " 3. Run 'claude' to start using Claude with your new setup" # Project-specific suggestions case @project_type when :python say "\nPython project tips:".colorize(:yellow) say ' - Install dev dependencies: pip install pytest black flake8' say ' - Set up pre-commit hooks for code quality' say ' - Configure your IDE to use black formatting' when :rails say "\nRails project tips:".colorize(:yellow) say ' - Ensure binstubs are set up: bundle binstubs bundler --force' say " - Run 'bin/rubocop' to check code style" say " - Use 'bin/rspec' for running tests" end end |
#migrate_cursor ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/chiron/cli.rb', line 68 def migrate_cursor say '🔄 Migrating from .cursor to .claude...'.colorize(:blue) unless Dir.exist?('.cursor/rules') error 'No .cursor/rules directory found!' exit 1 end create_directories migrate_rules if @prompt.yes?('Remove .cursor directory after migration?') FileUtils.rm_rf('.cursor') say '✅ .cursor directory removed'.colorize(:green) end say "\n✨ Migration completed!".colorize(:green) end |
#update ⇒ Object
103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/chiron/cli.rb', line 103 def update say '🔄 Updating Claude workflows...'.colorize(:blue) # Backup current commands if Dir.exist?('.claude/commands') backup_dir = ".claude/commands.backup.#{Time.now.strftime('%Y%m%d%H%M%S')}" FileUtils.cp_r('.claude/commands', backup_dir) say "📦 Backed up current commands to #{backup_dir}".colorize(:yellow) end copy_templates(update: true) say "\n✨ Workflows updated!".colorize(:green) end |