Skip to content

Commit 588a63f

Browse files
carlos-cubasclaudePennyroyalTea
authored
feat: add agent branch support to CLI (#66)
* feat: add agent branch support to CLI (#56) Add support for working with agent branches, allowing users to list branches, and pull/push from specific branches instead of only main. New commands: - `elevenlabs agents branches list --agent <id>` with --include-archived - `elevenlabs agents pull --agent <id> --branch <name_or_id>` - `elevenlabs agents push --agent <id> --branch <name_or_id>` Branch identification accepts both human-readable names and IDs (auto-detected by agtbrch_ prefix). --branch requires --agent since branch names are per-agent. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add persistent branch config storage for CI/CD workflows Branch configs are now stored as separate files in agent_configs/ and tracked in agents.json under a `branches` map per agent, enabling git-based version control and CI/CD pipelines. New features: - `pull --all-branches`: fetch all branches as separate config files - `pull --branch <name>`: now persistently stores branch config - `push`: auto-pushes all registered branch configs alongside main - `init`: updated next-steps with branch workflow guidance Schema: agents.json entries now support an optional `branches` map: { "staging": { "config": "agent_configs/Agent.staging.json", "branch_id": "agtbrch_xxx", "version_id": "ver_xxx" } } Fully backward compatible - agents without branches work unchanged. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address code review findings - Fix variable shadowing: rename inner agentId to currentAgentId in push-impl.ts loop body to avoid confusion with the parameter - Fix dry-run: restructure push-impl.ts so --dry-run previews branch pushes instead of skipping them (previously dead code) - Fix React key: use branch.id instead of array index in BranchesListView Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * docs: add branch support documentation to README - Add branch support to features list - Show branch config files in directory structure - Document branch commands (branches list, --branch, --all-branches) - Add Branch Workflows section with CI/CD pipeline example - Document agents.json branches schema Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address bugs in agent branch support - Fall back to non-UI codepath for --all-branches (UI view doesn't support it, was silently ignored) - Auto-push registered branch configs in PushView UI mode (previously only worked with --no-ui) - Fix main branch duplication in pullAllBranches when branch_id is unset on the agent entry (fall back to name="main" check) - Move dry-run check before client init and branch resolution in push-impl so --dry-run doesn't make network calls - Remove redundant resolveBranchId call in PullView (resolve once in initial effect, pass through to processNextAgent) - Include archived branches when resolving branch names so resolution doesn't silently fail for archived branches Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Boris Starkov <boris.starkow@gmail.com>
1 parent 58f1554 commit 588a63f

File tree

16 files changed

+1055
-32
lines changed

16 files changed

+1055
-32
lines changed

README.md

Lines changed: 65 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Manage ElevenLabs with local configuration files. This tool is an experimental e
1515
- **Smart Updates**: Hash-based change detection
1616
- **Import/Export**: Fetch existing agents and tools from workspace
1717
- **Tool Management**: Import and manage tools from ElevenLabs workspace
18+
- **Branch Support**: Pull/push specific agent branches, CI/CD-friendly multi-branch workflows
1819
- **Widget Generation**: HTML widget snippets
1920
- **Secure Storage**: OS keychain integration with secure file fallback
2021

@@ -102,10 +103,12 @@ elevenlabs agents push
102103

103104
```
104105
your_project/
105-
├── agents.json # Central configuration
106+
├── agents.json # Central configuration (includes branch mappings)
106107
├── tools.json # Tool configurations
107108
├── tests.json # Test configurations
108109
├── agent_configs/ # Agent configuration files
110+
│ ├── My-Agent.json # Main branch config
111+
│ └── My-Agent.staging.json # Branch config (auto-created by --all-branches)
109112
├── tool_configs/ # Tool configurations
110113
└── test_configs/ # Test configurations
111114
```
@@ -158,8 +161,14 @@ elevenlabs tools add-webhook "Tool Name" [--config-path path]
158161
# Create client tool
159162
elevenlabs tools add-client "Tool Name" [--config-path path]
160163

161-
# Push changes
162-
elevenlabs agents push [--agent "Agent Name"] [--dry-run]
164+
# Push changes (main + all registered branches)
165+
elevenlabs agents push [--agent <agent_id>] [--dry-run]
166+
167+
# Push to a specific branch
168+
elevenlabs agents push --agent <agent_id> --branch <branch_name_or_id>
169+
170+
# List branches for an agent
171+
elevenlabs agents branches list --agent <agent_id> [--include-archived]
163172

164173
# Sync tools
165174
elevenlabs tools push [--tool "Tool Name"] [--dry-run]
@@ -173,6 +182,12 @@ elevenlabs agents status [--agent "Agent Name"]
173182
# Pull agents from ElevenLabs
174183
elevenlabs agents pull [--search "term"] [--update] [--dry-run]
175184

185+
# Pull from a specific branch
186+
elevenlabs agents pull --agent <agent_id> --branch <branch_name_or_id>
187+
188+
# Pull all branches for each agent (stores as separate config files)
189+
elevenlabs agents pull --all --all-branches
190+
176191
# Pull tools from ElevenLabs
177192
elevenlabs tools pull [--search "term"] [--tool "tool-name"] [--dry-run] [--output-dir tool_configs]
178193

@@ -339,13 +354,59 @@ elevenlabs agents list
339354
elevenlabs agents delete agent_123456789
340355
```
341356

357+
## Branch Workflows
358+
359+
Agent branches let you manage different configurations (e.g., staging vs production) alongside the main agent. Branch configs are stored as separate files in `agent_configs/` and tracked in `agents.json`, making them git-friendly and CI/CD-ready.
360+
361+
**Work with branches locally:**
362+
363+
```bash
364+
# List branches for an agent
365+
elevenlabs agents branches list --agent <agent_id>
366+
367+
# Pull a specific branch config
368+
elevenlabs agents pull --agent <agent_id> --branch staging
369+
370+
# Push to a specific branch
371+
elevenlabs agents push --agent <agent_id> --branch staging
372+
```
373+
374+
**CI/CD pipeline (sync all branches):**
375+
376+
```bash
377+
elevenlabs agents pull --all --all-branches --update --no-ui
378+
# Make config changes...
379+
elevenlabs agents push --no-ui
380+
# Push auto-pushes main + all registered branch configs
381+
```
382+
383+
Branch configs in `agents.json`:
384+
385+
```json
386+
{
387+
"agents": [{
388+
"config": "agent_configs/My-Agent.json",
389+
"id": "agent_123",
390+
"branches": {
391+
"staging": {
392+
"config": "agent_configs/My-Agent.staging.json",
393+
"branch_id": "agtbrch_xxx",
394+
"version_id": "ver_xxx"
395+
}
396+
}
397+
}]
398+
}
399+
```
400+
401+
The `--branch` flag accepts both human-readable names (`staging`) and branch IDs (`agtbrch_xxx`).
402+
342403
## Workflow Examples
343404

344405
```bash
345406
# List all agents
346407
elevenlabs agents list
347408

348-
# Push all agents
409+
# Push all agents (main + branches)
349410
elevenlabs agents push
350411

351412
# Pull agents (skips existing local agents)

0 commit comments

Comments
 (0)