Files
goclaw/cmd/root.go
T
Viet TranandClaude Opus 4.6 f3f4c67b36 Initial commit: GoClaw AI agent gateway
Multi-agent AI gateway with WebSocket RPC, HTTP API, and messaging channel integrations.
Go port of OpenClaw with multi-tenant PostgreSQL, per-user isolation, security hardening,
and production observability.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 14:58:07 +07:00

70 lines
1.6 KiB
Go

package cmd
import (
"fmt"
"os"
"github.com/spf13/cobra"
"github.com/nextlevelbuilder/goclaw/pkg/protocol"
)
var (
cfgFile string
verbose bool
)
var rootCmd = &cobra.Command{
Use: "goclaw",
Short: "GoClaw — AI agent gateway",
Long: "GoClaw: multi-agent AI platform with WebSocket RPC, tool execution, and channel integration. A Go port of OpenClaw with enhanced security and multi-tenant support.",
Run: func(cmd *cobra.Command, args []string) {
runGateway()
},
}
func init() {
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default: config.json or $GOCLAW_CONFIG)")
rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "enable debug logging")
rootCmd.AddCommand(onboardCmd())
rootCmd.AddCommand(versionCmd())
rootCmd.AddCommand(pairingCmd())
rootCmd.AddCommand(agentCmd())
rootCmd.AddCommand(doctorCmd())
rootCmd.AddCommand(configCmd())
rootCmd.AddCommand(modelsCmd())
rootCmd.AddCommand(channelsCmd())
rootCmd.AddCommand(cronCmd())
rootCmd.AddCommand(skillsCmd())
rootCmd.AddCommand(sessionsCmd())
rootCmd.AddCommand(migrateCmd())
}
func versionCmd() *cobra.Command {
return &cobra.Command{
Use: "version",
Short: "Print version information",
Run: func(cmd *cobra.Command, args []string) {
fmt.Printf("goclaw v0.2.0 (protocol %d)\n", protocol.ProtocolVersion)
},
}
}
func resolveConfigPath() string {
if cfgFile != "" {
return cfgFile
}
if v := os.Getenv("GOCLAW_CONFIG"); v != "" {
return v
}
return "config.json"
}
// Execute runs the root cobra command.
func Execute() {
if err := rootCmd.Execute(); err != nil {
os.Exit(1)
}
}