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.
94 lines
2.0 KiB
Go
94 lines
2.0 KiB
Go
package cli
|
|
|
|
import (
|
|
"io"
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"github.com/spf13/cobra"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func resetCLIStateForTest() {
|
|
cfgFile = ""
|
|
verbose = false
|
|
openBrowserFlag = true
|
|
uiDevFlag = false
|
|
backendOnlyFlag = false
|
|
portFlag = 0
|
|
noVCExecution = false
|
|
}
|
|
|
|
func TestRootCommandDisplaysHelp(t *testing.T) {
|
|
t.Setenv("HOME", t.TempDir())
|
|
resetCLIStateForTest()
|
|
|
|
cmd := NewRootCommand(func(cmd *cobra.Command, args []string) {}, VersionInfo{
|
|
Version: "test",
|
|
Commit: "test",
|
|
Date: "test",
|
|
})
|
|
cmd.SetOut(io.Discard)
|
|
cmd.SetErr(io.Discard)
|
|
cmd.SetArgs([]string{"--help"})
|
|
|
|
require.NoError(t, cmd.Execute())
|
|
}
|
|
|
|
func TestRootCommandServerFlags(t *testing.T) {
|
|
t.Setenv("HOME", t.TempDir())
|
|
resetCLIStateForTest()
|
|
|
|
invoked := false
|
|
cmd := NewRootCommand(func(cmd *cobra.Command, args []string) {
|
|
invoked = true
|
|
require.False(t, GetOpenBrowserFlag())
|
|
require.True(t, GetBackendOnlyFlag())
|
|
require.True(t, GetUIDevFlag())
|
|
require.Equal(t, 9090, GetPortFlag())
|
|
require.True(t, noVCExecution)
|
|
}, VersionInfo{
|
|
Version: "test",
|
|
Commit: "test",
|
|
Date: "test",
|
|
})
|
|
cmd.SetOut(io.Discard)
|
|
cmd.SetErr(io.Discard)
|
|
cmd.SetArgs([]string{
|
|
"server",
|
|
"--open=false",
|
|
"--backend-only",
|
|
"--ui-dev",
|
|
"--port=9090",
|
|
"--no-vc-execution",
|
|
})
|
|
|
|
require.NoError(t, cmd.Execute())
|
|
require.True(t, invoked)
|
|
}
|
|
|
|
func TestRootCommandHonorsConfigFlag(t *testing.T) {
|
|
t.Setenv("HOME", t.TempDir())
|
|
resetCLIStateForTest()
|
|
|
|
configDir := t.TempDir()
|
|
configPath := filepath.Join(configDir, "hanzo-agents.yaml")
|
|
require.NoError(t, os.WriteFile(configPath, []byte("hanzo-agents:\n port: 7000\n"), 0o644))
|
|
|
|
var received string
|
|
cmd := NewRootCommand(func(cmd *cobra.Command, args []string) {
|
|
received = GetConfigFilePath()
|
|
}, VersionInfo{
|
|
Version: "test",
|
|
Commit: "test",
|
|
Date: "test",
|
|
})
|
|
cmd.SetOut(io.Discard)
|
|
cmd.SetErr(io.Discard)
|
|
cmd.SetArgs([]string{"--config", configPath, "server", "--open=false"})
|
|
|
|
require.NoError(t, cmd.Execute())
|
|
require.Equal(t, configPath, received)
|
|
}
|