mirror of
https://github.com/hanzoai/agents.git
synced 2026-10-30 18:48:36 +00:00
Transforms hanzoai/agents from a marketplace config repo into a full agent orchestration platform by merging the AgentField infrastructure: - Go control plane (K8s-like agent orchestration, service mesh, DAG workflows) - Python SDK (FastAPI-based agent framework, LiteLLM, memory, DID/VC) - TypeScript SDK (@hanzo/agents - Vercel AI SDK, MCP, workflows) - Go SDK (idiomatic agent builder + client) - React 19 embedded dashboard (XyFlow DAGs, Recharts, Radix UI) - Docker/K8s/Helm deployment configs - Examples: hello world, deep research, RAG, simulation, benchmarks - Functional test suite across Python/Go/TypeScript All references rebranded: AgentField → Hanzo Agents - Module: github.com/hanzoai/agents/control-plane - Python: hanzo_agents - TypeScript: @hanzo/agents - Go: github.com/hanzoai/agents/sdk/go - Env vars: HANZO_AGENTS_* - Config: hanzo-agents.yaml Previous marketplace configs moved to config/ directory.
108 lines
3.0 KiB
Go
108 lines
3.0 KiB
Go
package commands
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/hanzoai/agents/control-plane/internal/cli/framework"
|
|
"github.com/hanzoai/agents/control-plane/internal/core/domain"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
// InstallCommand implements the install command using the new framework
|
|
type InstallCommand struct {
|
|
framework.BaseCommand
|
|
output *framework.OutputFormatter
|
|
}
|
|
|
|
// NewInstallCommand creates a new install command
|
|
func NewInstallCommand(services *framework.ServiceContainer) framework.Command {
|
|
return &InstallCommand{
|
|
BaseCommand: framework.BaseCommand{Services: services},
|
|
output: framework.NewOutputFormatter(false), // Will be updated based on flags
|
|
}
|
|
}
|
|
|
|
// GetName returns the command name
|
|
func (cmd *InstallCommand) GetName() string {
|
|
return "install"
|
|
}
|
|
|
|
// GetDescription returns the command description
|
|
func (cmd *InstallCommand) GetDescription() string {
|
|
return "Install a HanzoAgents agent node package for local use"
|
|
}
|
|
|
|
// BuildCobraCommand builds the Cobra command
|
|
func (cmd *InstallCommand) BuildCobraCommand() *cobra.Command {
|
|
var force bool
|
|
var verbose bool
|
|
|
|
cobraCmd := &cobra.Command{
|
|
Use: "install <package-path>",
|
|
Short: cmd.GetDescription(),
|
|
Long: `Install a HanzoAgents agent node package for local use.
|
|
|
|
The package can be:
|
|
- A local directory path
|
|
- A GitHub repository URL
|
|
- A package name from the HanzoAgents registry
|
|
|
|
Examples:
|
|
hanzo-agents install ./my-agent
|
|
hanzo-agents install https://github.com/user/agent-repo
|
|
hanzo-agents install agent-name`,
|
|
Args: cobra.ExactArgs(1),
|
|
RunE: func(cobraCmd *cobra.Command, args []string) error {
|
|
// Update output formatter with verbose setting
|
|
cmd.output.SetVerbose(verbose)
|
|
return cmd.execute(args[0], force, verbose)
|
|
},
|
|
}
|
|
|
|
cobraCmd.Flags().BoolVarP(&force, "force", "f", false, "Force reinstall if package exists")
|
|
cobraCmd.Flags().BoolVarP(&verbose, "verbose", "v", false, "Verbose output")
|
|
|
|
return cobraCmd
|
|
}
|
|
|
|
// execute performs the actual installation
|
|
func (cmd *InstallCommand) execute(packagePath string, force, verbose bool) error {
|
|
cmd.output.PrintHeader("Installing HanzoAgents Package")
|
|
cmd.output.PrintInfo(fmt.Sprintf("Package: %s", packagePath))
|
|
|
|
if verbose {
|
|
cmd.output.PrintVerbose("Using new framework-based install command")
|
|
}
|
|
|
|
// Create install options
|
|
options := domain.InstallOptions{
|
|
Force: force,
|
|
Verbose: verbose,
|
|
}
|
|
|
|
// Show progress
|
|
cmd.output.PrintProgress("Starting installation...")
|
|
|
|
// Use the package service to install
|
|
err := cmd.Services.PackageService.InstallPackage(packagePath, options)
|
|
if err != nil {
|
|
cmd.output.PrintError(fmt.Sprintf("Installation failed: %v", err))
|
|
return err
|
|
}
|
|
|
|
cmd.output.PrintSuccess("Package installed successfully")
|
|
|
|
if verbose {
|
|
// Show installed packages
|
|
cmd.output.PrintVerbose("Listing installed packages...")
|
|
packages, err := cmd.Services.PackageService.ListInstalledPackages()
|
|
if err != nil {
|
|
cmd.output.PrintWarning(fmt.Sprintf("Could not list packages: %v", err))
|
|
} else {
|
|
cmd.output.PrintInfo(fmt.Sprintf("Total installed packages: %d", len(packages)))
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|