Skip to content
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,16 @@ menlo config default-robot <robot-id>
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
```bash
sh -c "$(curl -fsSL https://raw.githubusercontent.com/menloresearch/cli/release/uninstall.sh)"
```
```
14 changes: 4 additions & 10 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -232,4 +226,4 @@ while [ $# -gt 0 ]; do
done

# Run install
install
install
2 changes: 1 addition & 1 deletion internal/clients/platform/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}

Expand Down
28 changes: 7 additions & 21 deletions internal/commands/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -39,7 +23,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 <your-api-key>")
return nil
Expand Down Expand Up @@ -98,7 +82,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
Expand Down Expand Up @@ -128,7 +115,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()
Expand Down Expand Up @@ -159,6 +146,5 @@ func saveAPIKey(apiKey string) error {
}

func init() {
configCmd.AddCommand(defaultRobotCmd)
configCmd.AddCommand(apikeyCmd)
}
}
10 changes: 5 additions & 5 deletions internal/commands/robot.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:\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
}
Expand Down Expand Up @@ -351,9 +351,9 @@ 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)
rootCmd.AddCommand(robotCmd)
}
}
5 changes: 4 additions & 1 deletion internal/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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)
}
}
32 changes: 10 additions & 22 deletions internal/commands/version.go
Original file line number Diff line number Diff line change
@@ -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)
}
4 changes: 2 additions & 2 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
14 changes: 4 additions & 10 deletions uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -132,4 +126,4 @@ while [ $# -gt 0 ]; do
done

# Run uninstall
uninstall
uninstall
Loading