Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

fix: CLI instances command should return only [] when no instances running

Mario8449f1c2f1e6
diff --git a/cmd/pinchtab/cmd_cli.go b/cmd/pinchtab/cmd_cli.go
index 984dfcd4..34c835b4 100644
--- a/cmd/pinchtab/cmd_cli.go
+++ b/cmd/pinchtab/cmd_cli.go
@@ -635,31 +635,37 @@ func cliHealth(client *http.Client, base, token string) {
// --- instances ---
func cliInstances(client *http.Client, base, token string) {
- result := doGet(client, base, token, "/instances", nil)
+ body := doGetRaw(client, base, token, "/instances", nil)
- // Display instances in a friendly format
- if instances, ok := result["instances"].([]interface{}); ok && len(instances) > 0 {
- fmt.Println()
- for _, inst := range instances {
- if m, ok := inst.(map[string]any); ok {
- id, _ := m["id"].(string)
- name, _ := m["name"].(string)
- port, _ := m["port"].(string)
- headless, _ := m["headless"].(bool)
- status, _ := m["status"].(string)
+ // Parse array of instances
+ var instances []map[string]any
+ if err := json.Unmarshal(body, &instances); err != nil {
+ fmt.Fprintf(os.Stderr, "Failed to parse instances: %v\n", err)
+ os.Exit(1)
+ }
- mode := "headless"
- if !headless {
- mode = "headed"
- }
+ // Display instances in a friendly format, or empty if none
+ if len(instances) == 0 {
+ fmt.Println("[]")
+ return
+ }
- fmt.Printf("📍 %s (ID: %s, Port: %s, Mode: %s, Status: %s)\n", name, id, port, mode, status)
- }
+ fmt.Println()
+ for _, inst := range instances {
+ id, _ := inst["id"].(string)
+ name, _ := inst["profileName"].(string)
+ port, _ := inst["port"].(string)
+ headless, _ := inst["headless"].(bool)
+ status, _ := inst["status"].(string)
+
+ mode := "headless"
+ if !headless {
+ mode = "headed"
}
- fmt.Println()
- } else {
- fmt.Println("No running instances")
+
+ fmt.Printf("📍 %s (ID: %s, Port: %s, Mode: %s, Status: %s)\n", name, id, port, mode, status)
}
+ fmt.Println()
}
// --- profiles ---