Files
blackroad-cli/internal/commands/root.go

68 lines
1.5 KiB
Go

package commands
import (
"fmt"
"os"
"github.com/fatih/color"
"github.com/spf13/cobra"
)
var (
// Colors
cyan = color.New(color.FgCyan).SprintFunc()
green = color.New(color.FgGreen).SprintFunc()
yellow = color.New(color.FgYellow).SprintFunc()
red = color.New(color.FgRed).SprintFunc()
magenta = color.New(color.FgMagenta).SprintFunc()
bold = color.New(color.Bold).SprintFunc()
)
var rootCmd = &cobra.Command{
Use: "blackroad",
Short: "BlackRoad CLI - Manage your AI infrastructure",
Long: fmt.Sprintf(`%s
The official command-line interface for BlackRoad.
Manage agents, tasks, memory, and deployments from your terminal.
%s
blackroad agents list
blackroad tasks dispatch "Deploy auth service" --priority high
blackroad memory log deployed auth-service "v2.0.0 released"
blackroad deploy my-project
blackroad status
%s
Run 'blackroad config set api_key <your-key>' to get started.
`,
cyan("BlackRoad CLI"),
yellow("Examples:"),
yellow("Getting Started:"),
),
Version: "1.0.0",
}
func Execute() error {
return rootCmd.Execute()
}
func init() {
rootCmd.AddCommand(agentsCmd)
rootCmd.AddCommand(tasksCmd)
rootCmd.AddCommand(memoryCmd)
rootCmd.AddCommand(deployCmd)
rootCmd.AddCommand(statusCmd)
rootCmd.AddCommand(configCmd)
}
// Helper to print errors
func printError(msg string) {
fmt.Fprintf(os.Stderr, "%s %s\n", red("Error:"), msg)
}
// Helper to print success
func printSuccess(msg string) {
fmt.Printf("%s %s\n", green("✓"), msg)
}