mirror of
https://github.com/hanzoai/bot.git
synced 2026-10-30 17:24:26 +00:00
Cherry-pick upstream 16a9fdc89 with conflict resolution:
- Add isSecretRef type guard to types.secrets.ts
- Add ApiKeyStorageOptions to onboard-auth.credentials.ts
- Add provider field to SecretRef constructions in apply-helpers
- Fix max_tokens for verification probes (5/16 → 1024)
- Fix timeout test to match 30s verify timeout
- Fix writeOAuthCredentials to return profileId
- Fix branding (OpenClaw → Bot) in apply-helpers and docs
- Add withEnvAsync import to provider-auth tests
Co-authored-by: Hanzo Dev <[email protected]>
5.3 KiB
5.3 KiB
summary, read_when, title, sidebarTitle
| summary | read_when | title | sidebarTitle | ||
|---|---|---|---|---|---|
| Scripted onboarding and agent setup for the Hanzo Bot CLI |
|
CLI Automation | CLI automation |
CLI Automation
Use --non-interactive to automate hanzo-bot onboard.
Baseline non-interactive example
hanzo-bot onboard --non-interactive \
--mode local \
--auth-choice apiKey \
--anthropic-api-key "$ANTHROPIC_API_KEY" \
--gateway-port 18789 \
--gateway-bind loopback \
--install-daemon \
--daemon-runtime node \
--skip-skills
Add --json for a machine-readable summary.
Use --secret-input-mode ref to store env-backed refs in auth profiles instead of plaintext values.
Interactive selection between env refs and encrypted file refs (sops) is available in the onboarding wizard flow.
In non-interactive ref mode, provider env vars must be set in the process environment.
Passing inline key flags without the matching env var now fails fast.
Example:
bot onboard --non-interactive \
--mode local \
--auth-choice openai-api-key \
--secret-input-mode ref \
--accept-risk
Provider-specific examples
```bash hanzo-bot onboard --non-interactive \ --mode local \ --auth-choice gemini-api-key \ --gemini-api-key "$GEMINI_API_KEY" \ --gateway-port 18789 \ --gateway-bind loopback ``` ```bash hanzo-bot onboard --non-interactive \ --mode local \ --auth-choice zai-api-key \ --zai-api-key "$ZAI_API_KEY" \ --gateway-port 18789 \ --gateway-bind loopback ``` ```bash hanzo-bot onboard --non-interactive \ --mode local \ --auth-choice ai-gateway-api-key \ --ai-gateway-api-key "$AI_GATEWAY_API_KEY" \ --gateway-port 18789 \ --gateway-bind loopback ``` ```bash hanzo-bot onboard --non-interactive \ --mode local \ --auth-choice cloudflare-ai-gateway-api-key \ --cloudflare-ai-gateway-account-id "your-account-id" \ --cloudflare-ai-gateway-gateway-id "your-gateway-id" \ --cloudflare-ai-gateway-api-key "$CLOUDFLARE_AI_GATEWAY_API_KEY" \ --gateway-port 18789 \ --gateway-bind loopback ``` ```bash hanzo-bot onboard --non-interactive \ --mode local \ --auth-choice moonshot-api-key \ --moonshot-api-key "$MOONSHOT_API_KEY" \ --gateway-port 18789 \ --gateway-bind loopback ``` ```bash hanzo-bot onboard --non-interactive \ --mode local \ --auth-choice synthetic-api-key \ --synthetic-api-key "$SYNTHETIC_API_KEY" \ --gateway-port 18789 \ --gateway-bind loopback ``` ```bash hanzo-bot onboard --non-interactive \ --mode local \ --auth-choice opencode-zen \ --opencode-zen-api-key "$OPENCODE_API_KEY" \ --gateway-port 18789 \ --gateway-bind loopback ``` ```bash bot onboard --non-interactive \ --mode local \ --auth-choice custom-api-key \ --custom-base-url "https://llm.example.com/v1" \ --custom-model-id "foo-large" \ --custom-api-key "$CUSTOM_API_KEY" \ --custom-provider-id "my-custom" \ --custom-compatibility anthropic \ --gateway-port 18789 \ --gateway-bind loopback ````--custom-api-key` is optional. If omitted, onboarding checks `CUSTOM_API_KEY`.
Ref-mode variant:
```bash
export CUSTOM_API_KEY="your-key"
bot onboard --non-interactive \
--mode local \
--auth-choice custom-api-key \
--custom-base-url "https://llm.example.com/v1" \
--custom-model-id "foo-large" \
--secret-input-mode ref \
--custom-provider-id "my-custom" \
--custom-compatibility anthropic \
--gateway-port 18789 \
--gateway-bind loopback
```
In this mode, onboarding stores `apiKey` as `{ source: "env", id: "CUSTOM_API_KEY" }`.
Add another agent
Use hanzo-bot agents add <name> to create a separate agent with its own workspace,
sessions, and auth profiles. Running without --workspace launches the wizard.
hanzo-bot agents add work \
--workspace ~/.hanzo/bot/workspace-work \
--model openai/gpt-5.2 \
--bind whatsapp:biz \
--non-interactive \
--json
What it sets:
agents.list[].nameagents.list[].workspaceagents.list[].agentDir
Notes:
- Default workspaces follow
~/.hanzo/bot/workspace-<agentId>. - Add
bindingsto route inbound messages (the wizard can do this). - Non-interactive flags:
--model,--agent-dir,--bind,--non-interactive.
Related docs
- Onboarding hub: Onboarding Wizard (CLI)
- Full reference: CLI Onboarding Reference
- Command reference:
hanzo-bot onboard