Class: Harbor::CLI::Projects
- Inherits:
-
Object
- Object
- Harbor::CLI::Projects
- Defined in:
- lib/harbor/cli/projects.rb
Instance Method Summary collapse
-
#initialize(options) ⇒ Projects
constructor
A new instance of Projects.
- #setup ⇒ Object
Constructor Details
#initialize(options) ⇒ Projects
Returns a new instance of Projects.
8 9 10 |
# File 'lib/harbor/cli/projects.rb', line 8 def initialize() @options = end |
Instance Method Details
#setup ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 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 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/harbor/cli/projects.rb', line 12 def setup puts "Harbor Setup" puts "============" puts "" # Step 1: Find KAMAL projects puts "Scanning for KAMAL projects..." home = ENV["HOME"] || "~" search_dirs = [ File.join(home, "src"), File.join(home, "projects"), File.join(home, "code"), Dir.pwd ].select { |d| File.directory?(d) } found = [] search_dirs.each do |dir| Dir.glob(File.join(dir, "*", "config", "deploy.yml")).each do |deploy_yml| project_path = File.dirname(File.dirname(deploy_yml)) found << project_path end end found.uniq! if found.empty? puts "No KAMAL projects found in #{search_dirs.join(', ')}" puts "Add one manually: harbor add NAME /path/to/project" return end puts "Found #{found.length} KAMAL project(s):" found.each_with_index do |path, i| puts " #{i + 1}) #{File.basename(path)} (#{path})" end puts "" # Step 2: Register them config = Config.load(@options[:config]) found.each do |path| name = File.basename(path) begin config.add_project(name, path) puts " Added: #{name}" rescue Harbor::Error => e puts " Skipped #{name}: #{e.}" end end puts "" # Step 3: Output MCP config puts "MCP Configuration (add to your Claude Code settings):" puts "" mcp_config = { "mcpServers" => { "harbor" => { "command" => "harbor", "args" => ["mcp"] } } } puts JSON.pretty_generate(mcp_config) puts "" puts "Setup complete! Run 'harbor list' to see your projects." end |