class ClaudeCodeSlashCommands::Installer
def install_command_from_github(command)
def install_command_from_github(command) filename = command["name"] target_file = @commands_target.join(filename) # Fetch the content of the command file stdout, stderr, status = Open3.capture3( "gh", "api", "repos/#{@repo}/contents/" + command["path"], "--jq", ".content" ) unless status.success? raise "Failed to fetch command content for #{filename}: #{stderr}" end content = Base64.decode64(stdout) if target_file.exist? if target_file.read == content puts "⏭️ #{filename} already exists and is identical" return end unless confirm_overwrite(filename) puts "⏭️ Skipping #{filename}" return end end target_file.write(content) puts "📄 Installed #{filename}" end