Files
zeekay f5ff92c37f fix: repair Go identifier errors and protobuf from rebrand
The AgentField-to-HanzoAgents rebrand introduced invalid Go
identifiers (hanzo-agentsXxx with hyphens), corrupted protobuf
raw descriptors, and missing TypeScript type exports. This commit:

- Renames all `hanzo-agentsXxx` Go vars to `hanzoAgentsXxx`
- Regenerates protobuf .pb.go with correct go_package path
- Copies agentfield.ts types to hanzo-agents.ts for UI build
- Adds amd64 cross-compiler support to Dockerfile
2026-02-09 23:16:43 -08:00

83 lines
2.1 KiB
Go

package cli
import (
"errors"
"fmt"
"os"
"path/filepath"
"github.com/hanzoai/agents/control-plane/internal/packages"
"github.com/spf13/cobra"
"gopkg.in/yaml.v3"
)
// NewListCommand creates the list command
func NewListCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "list",
Short: "List installed HanzoAgents agent node packages",
Long: `Display all installed HanzoAgents agent node packages with their status.
Shows package name, version, status (running/stopped), and port if running.
Examples:
af list`,
Run: runListCommand,
}
return cmd
}
func runListCommand(cmd *cobra.Command, args []string) {
hanzoAgentsHome := getHanzoAgentsHomeDir()
registryPath := filepath.Join(hanzoAgentsHome, "installed.yaml")
// Load registry
registry := &packages.InstallationRegistry{
Installed: make(map[string]packages.InstalledPackage),
}
if data, err := os.ReadFile(registryPath); err == nil {
if err := yaml.Unmarshal(data, registry); err != nil {
cmd.PrintErrf("failed to parse registry: %v\n", err)
return
}
} else if !errors.Is(err, os.ErrNotExist) {
cmd.PrintErrf("failed to read registry: %v\n", err)
return
}
if len(registry.Installed) == 0 {
fmt.Println("đŸ“Ļ No agent node packages installed")
fmt.Println("💡 Install packages with: hanzo-agents install <package-path>")
return
}
fmt.Printf("đŸ“Ļ Installed Agent Node Packages (%d total):\n\n", len(registry.Installed))
for name, pkg := range registry.Installed {
status := pkg.Status
statusIcon := "âšī¸"
if status == "running" {
statusIcon = "đŸŸĸ"
} else if status == "error" {
statusIcon = "🔴"
}
fmt.Printf("%s %s (v%s)\n", statusIcon, name, pkg.Version)
fmt.Printf(" %s\n", pkg.Description)
if status == "running" && pkg.Runtime.Port != nil {
fmt.Printf(" 🌐 Running on port %d (PID: %d)\n", *pkg.Runtime.Port, *pkg.Runtime.PID)
}
fmt.Printf(" 📁 %s\n", pkg.Path)
fmt.Println()
}
fmt.Println("💡 Commands:")
fmt.Println(" af run <name> - Start an agent node")
fmt.Println(" af stop <name> - Stop a running agent node")
fmt.Println(" af logs <name> - View agent node logs")
}