From 9c5e3618b33156341719fd9f9f550c5a72d2b807 Mon Sep 17 00:00:00 2001 From: LazyYuuki Date: Mon, 20 Apr 2026 22:22:27 +0800 Subject: [PATCH 1/9] replace version subcommand with --version and -V flags --- internal/commands/root.go | 5 ++++- internal/commands/version.go | 32 ++++++++++---------------------- 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/internal/commands/root.go b/internal/commands/root.go index 52db3b5..25d2362 100644 --- a/internal/commands/root.go +++ b/internal/commands/root.go @@ -12,6 +12,7 @@ var rootCmd = &cobra.Command{ Long: `A CLI tool for Menlo research and development.`, DisableAutoGenTag: true, SilenceUsage: true, + Version: versionString(), } func Execute() { @@ -21,5 +22,7 @@ func Execute() { } func init() { + rootCmd.SetVersionTemplate("{{printf \"%s %s\\n\" .Name .Version}}") + rootCmd.Flags().BoolP("version", "V", false, "Print the version number") rootCmd.AddCommand(configCmd) -} \ No newline at end of file +} diff --git a/internal/commands/version.go b/internal/commands/version.go index 818e239..2879bf8 100644 --- a/internal/commands/version.go +++ b/internal/commands/version.go @@ -1,31 +1,19 @@ package commands import ( - "fmt" - "github.com/menloresearch/cli/internal/config" - "github.com/spf13/cobra" ) -var versionCmd = &cobra.Command{ - Use: "version", - Short: "Print the version number", - Run: func(cmd *cobra.Command, args []string) { - cfg, err := config.Load() - if err != nil { - // If no config, use default - cfg = config.DefaultConfig() - } +func versionString() string { + cfg, err := config.Load() + if err != nil { + cfg = config.DefaultConfig() + } - version := cfg.Version - if version == "" { - version = "dev" - } + version := cfg.Version + if version == "" { + return "dev" + } - fmt.Printf("menlo %s\n", version) - }, + return version } - -func init() { - rootCmd.AddCommand(versionCmd) -} \ No newline at end of file From c6efb4e8e6f58c2b5071fd211ab495bb40a011e9 Mon Sep 17 00:00:00 2001 From: LazyYuuki Date: Mon, 20 Apr 2026 22:31:39 +0800 Subject: [PATCH 2/9] fix first-run config handling in init/config commands --- internal/commands/config.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/internal/commands/config.go b/internal/commands/config.go index 5d343ff..955e8ab 100644 --- a/internal/commands/config.go +++ b/internal/commands/config.go @@ -39,7 +39,7 @@ var apikeyCmd = &cobra.Command{ // Show current or instructions cfg, err := config.Load() if err != nil { - if os.IsNotExist(err) { + if config.IsNotExist(err) { fmt.Println("Get your API key from: https://platform.menlo.ai/account/api-keys") fmt.Println("Then run: menlo config apikey ") return nil @@ -98,7 +98,10 @@ func runRobotSelector() error { func saveDefaultRobot(robotID string) error { cfg, err := config.Load() if err != nil { - return err + if !config.IsNotExist(err) { + return err + } + cfg = config.DefaultConfig() } cfg.DefaultRobotID = robotID @@ -128,7 +131,7 @@ func saveDefaultRobot(robotID string) error { func saveAPIKey(apiKey string) error { cfg, err := config.Load() if err != nil { - if !os.IsNotExist(err) { + if !config.IsNotExist(err) { return err } cfg = config.DefaultConfig() From f6bd6dc38d629ca13ddf9a02161df0844248e9ef Mon Sep 17 00:00:00 2001 From: LazyYuuki Date: Mon, 20 Apr 2026 22:31:52 +0800 Subject: [PATCH 3/9] cleanup remaining config.go assignment --- internal/commands/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/commands/config.go b/internal/commands/config.go index 955e8ab..8e115a9 100644 --- a/internal/commands/config.go +++ b/internal/commands/config.go @@ -164,4 +164,4 @@ func saveAPIKey(apiKey string) error { func init() { configCmd.AddCommand(defaultRobotCmd) configCmd.AddCommand(apikeyCmd) -} \ No newline at end of file +} From e9c7574aa20988df6df0ff2a4fd1c94734a66cbf Mon Sep 17 00:00:00 2001 From: LazyYuuki Date: Mon, 20 Apr 2026 23:44:38 +0800 Subject: [PATCH 4/9] remove duplicate default-robot config command --- internal/commands/config.go | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/internal/commands/config.go b/internal/commands/config.go index 8e115a9..f261662 100644 --- a/internal/commands/config.go +++ b/internal/commands/config.go @@ -14,22 +14,6 @@ var configCmd = &cobra.Command{ Short: "Manage configuration", } -var defaultRobotCmd = &cobra.Command{ - Use: "default-robot [robot-id]", - Short: "Set or show the default robot", - Args: cobra.MaximumNArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - if len(args) == 0 { - // Interactive mode - show selection - return runRobotSelector() - } - - // Set robot ID directly - robotID := args[0] - return saveDefaultRobot(robotID) - }, -} - var apikeyCmd = &cobra.Command{ Use: "apikey [key]", Short: "Manage your API key", @@ -162,6 +146,5 @@ func saveAPIKey(apiKey string) error { } func init() { - configCmd.AddCommand(defaultRobotCmd) configCmd.AddCommand(apikeyCmd) } From cce175589fa3c93237c0e2d6bb29bc748656df08 Mon Sep 17 00:00:00 2001 From: LazyYuuki Date: Mon, 20 Apr 2026 23:44:55 +0800 Subject: [PATCH 5/9] rename robot session output labels for clarity --- internal/commands/robot.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/commands/robot.go b/internal/commands/robot.go index 47f88bc..824bfd9 100644 --- a/internal/commands/robot.go +++ b/internal/commands/robot.go @@ -275,9 +275,9 @@ func createRobotSession(robotID string) error { meetURL := generateMeetLink(session.SFUEndpoint, session.WebRTCToken) fmt.Printf("Session created for robot %s\n\n", robotID) - fmt.Printf("SFU Endpoint: %s\n", session.SFUEndpoint) - fmt.Printf("WebRTC Token: %s\n\n", session.WebRTCToken) - fmt.Printf("Join URL: %s\n", meetURL) + fmt.Printf("Connection Endpoint: %s\n", session.SFUEndpoint) + fmt.Printf("Agent Token: %s\n\n", session.WebRTCToken) + fmt.Printf("You can also paste this URL into your browser to debug the sim: %s\n", meetURL) return nil } From 2c1e5be2fd9908464c82a281ad5c8f16a580b631 Mon Sep 17 00:00:00 2001 From: LazyYuuki Date: Mon, 20 Apr 2026 23:44:59 +0800 Subject: [PATCH 6/9] finalize robot session output text update --- internal/commands/robot.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/commands/robot.go b/internal/commands/robot.go index 824bfd9..2078969 100644 --- a/internal/commands/robot.go +++ b/internal/commands/robot.go @@ -275,9 +275,9 @@ func createRobotSession(robotID string) error { meetURL := generateMeetLink(session.SFUEndpoint, session.WebRTCToken) fmt.Printf("Session created for robot %s\n\n", robotID) - fmt.Printf("Connection Endpoint: %s\n", session.SFUEndpoint) - fmt.Printf("Agent Token: %s\n\n", session.WebRTCToken) - fmt.Printf("You can also paste this URL into your browser to debug the sim: %s\n", meetURL) + fmt.Printf("Connection Endpoint:\n%s\n\n", session.SFUEndpoint) + fmt.Printf("Agent Token:\n%s\n\n", session.WebRTCToken) + fmt.Printf("Debug View:\n%s\n", meetURL) return nil } @@ -356,4 +356,4 @@ func init() { // robotCmd.AddCommand(robotSnapshotCmd) // disabled robotCmd.AddCommand(robotConnectCmd) rootCmd.AddCommand(robotCmd) -} \ No newline at end of file +} From 7a0891f1b0d0c65b4c37f1b8403ca9e995a77f72 Mon Sep 17 00:00:00 2001 From: LazyYuuki Date: Tue, 21 Apr 2026 00:23:23 +0800 Subject: [PATCH 7/9] re-enable robot movement action command --- internal/commands/robot.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/commands/robot.go b/internal/commands/robot.go index 2078969..d17428a 100644 --- a/internal/commands/robot.go +++ b/internal/commands/robot.go @@ -351,7 +351,7 @@ func init() { robotSnapshotCmd.Flags().String("robot-id", "", "Robot ID") robotCmd.AddCommand(robotListCmd) robotCmd.AddCommand(robotStatusCmd) - // robotCmd.AddCommand(robotActionCmd) // disabled + robotCmd.AddCommand(robotActionCmd) robotCmd.AddCommand(robotSessionCmd) // robotCmd.AddCommand(robotSnapshotCmd) // disabled robotCmd.AddCommand(robotConnectCmd) From c25a2910fcc4d48c474ba7b8ecbac44962368112 Mon Sep 17 00:00:00 2001 From: LazyYuuki Date: Tue, 21 Apr 2026 00:38:18 +0800 Subject: [PATCH 8/9] move cli config storage to ~/.menlo and update docs/scripts --- README.md | 6 ++---- install.sh | 12 +++--------- internal/clients/platform/platform.go | 2 +- internal/config/config.go | 4 ++-- uninstall.sh | 12 +++--------- 5 files changed, 11 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 75019b2..4dd9db7 100644 --- a/README.md +++ b/README.md @@ -96,15 +96,13 @@ menlo config default-robot Or interactively: ```bash -menlo config default-robot +menlo robot connect ``` ## Configuration Configuration is stored in: -- macOS: `~/Library/Application Support/menlo/config.yaml` -- Linux: `~/.config/menlo/config.yaml` -- Windows: `%APPDATA%\menlo\config.yaml` +- `~/.menlo/config.yaml` # Uninstall diff --git a/install.sh b/install.sh index 38603f6..5d44d55 100755 --- a/install.sh +++ b/install.sh @@ -39,14 +39,9 @@ detect_arch() { esac } -# Detect config directory (matches Go's os.UserConfigDir) +# Detect config directory (matches Go's os.UserHomeDir + ~/.menlo) detect_config_dir() { - case "$(uname -s)" in - Darwin*) echo "$HOME/Library/Application Support";; - Linux*) echo "$HOME/.config";; - CYGWIN*|MINGW*) echo "$APPDATA";; - *) echo "$HOME/.config";; - esac + echo "$HOME/.menlo" } # Get latest version from GitHub @@ -125,8 +120,7 @@ install() { fi # Write version to config (preserve existing config) - CONFIG_BASE_DIR=$(detect_config_dir) - CONFIG_DIR="$CONFIG_BASE_DIR/menlo" + CONFIG_DIR=$(detect_config_dir) mkdir -p "$CONFIG_DIR" CONFIG_FILE="$CONFIG_DIR/config.yaml" if [ -f "$CONFIG_FILE" ]; then diff --git a/internal/clients/platform/platform.go b/internal/clients/platform/platform.go index 614d568..7e40aa2 100644 --- a/internal/clients/platform/platform.go +++ b/internal/clients/platform/platform.go @@ -42,7 +42,7 @@ func NewClient() (*Client, error) { // Battery represents battery status type Battery struct { - Level int `json:"level"` + Level int `json:"level"` Charging bool `json:"charging"` } diff --git a/internal/config/config.go b/internal/config/config.go index 7b8a261..dfd6a2d 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -31,11 +31,11 @@ func (c *Config) SetDefaults() { } func ConfigDir() (string, error) { - dir, err := os.UserConfigDir() + homeDir, err := os.UserHomeDir() if err != nil { return "", err } - return filepath.Join(dir, "menlo"), nil + return filepath.Join(homeDir, ".menlo"), nil } func ConfigPath() (string, error) { diff --git a/uninstall.sh b/uninstall.sh index 69693ac..2da4b8a 100644 --- a/uninstall.sh +++ b/uninstall.sh @@ -19,14 +19,9 @@ log_error() { printf "${RED}[ERROR]${NC} %s\n" "$1" } -# Detect config directory (matches Go's os.UserConfigDir) +# Detect config directory (matches Go's os.UserHomeDir + ~/.menlo) detect_config_dir() { - case "$(uname -s)" in - Darwin*) echo "$HOME/Library/Application Support";; - Linux*) echo "$HOME/.config";; - CYGWIN*|MINGW*) echo "$APPDATA";; - *) echo "$HOME/.config";; - esac + echo "$HOME/.menlo" } # Prompt user for confirmation @@ -60,8 +55,7 @@ uninstall() { fi # Detect config directory - CONFIG_BASE_DIR=$(detect_config_dir) - CONFIG_DIR="$CONFIG_BASE_DIR/menlo" + CONFIG_DIR=$(detect_config_dir) # Ask about config removal if [ -d "$CONFIG_DIR" ]; then From e27cabb2d9ae3cd29926b7284bd92dbe21673de0 Mon Sep 17 00:00:00 2001 From: LazyYuuki Date: Tue, 21 Apr 2026 00:38:28 +0800 Subject: [PATCH 9/9] finalize docs and installer paths for ~/.menlo --- README.md | 2 +- install.sh | 2 +- uninstall.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4dd9db7..2977930 100644 --- a/README.md +++ b/README.md @@ -108,4 +108,4 @@ Configuration is stored in: # Uninstall ```bash sh -c "$(curl -fsSL https://raw.githubusercontent.com/menloresearch/cli/release/uninstall.sh)" -``` \ No newline at end of file +``` diff --git a/install.sh b/install.sh index 5d44d55..4cee4e4 100755 --- a/install.sh +++ b/install.sh @@ -226,4 +226,4 @@ while [ $# -gt 0 ]; do done # Run install -install \ No newline at end of file +install diff --git a/uninstall.sh b/uninstall.sh index 2da4b8a..07988a7 100644 --- a/uninstall.sh +++ b/uninstall.sh @@ -126,4 +126,4 @@ while [ $# -gt 0 ]; do done # Run uninstall -uninstall \ No newline at end of file +uninstall