retell-cli 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,140 @@
1
+ # Changelog
2
+
3
+ All notable changes to the Retell AI CLI will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.0.0] - 2025-11-15
9
+
10
+ ### Added
11
+
12
+ #### Authentication
13
+ - `retell login` command for interactive API key authentication
14
+ - Support for `.retellrc.json` config file (auto-created with secure 0600 permissions)
15
+ - Support for `RETELL_API_KEY` environment variable
16
+ - Clear error messages for missing or invalid API keys
17
+
18
+ #### Transcript Management
19
+ - `retell transcripts list` - List all call transcripts with pagination support
20
+ - `retell transcripts get <call_id>` - Retrieve detailed transcript for a specific call
21
+ - `retell transcripts analyze <call_id>` - Get comprehensive call analysis with:
22
+ - Call metadata (duration, status, agent info)
23
+ - Performance metrics (latency P50/P90/P99 for E2E, LLM, TTS)
24
+ - Sentiment analysis
25
+ - Call success indicators
26
+ - Full transcript with speaker labels and timestamps
27
+
28
+ #### Agent Management
29
+ - `retell agents list` - List all agents with formatted output
30
+ - `retell agents info <agent_id>` - Get detailed agent configuration
31
+ - Support for `--limit` option to control pagination
32
+ - Clear display of response engine types (retell-llm, conversation-flow, custom-llm)
33
+
34
+ #### Prompt Engineering
35
+ - `retell prompts pull <agent_id>` - Download current agent prompts
36
+ - `retell prompts update <agent_id>` - Update agent prompts from local file
37
+ - Automatic prompt type detection (Retell LLM vs Conversation Flow)
38
+ - Support for `--output` flag to specify custom file paths
39
+ - Validation of prompt structure before updates
40
+
41
+ #### Agent Publishing
42
+ - `retell agent publish <agent_id>` - Publish draft agents to production
43
+
44
+ #### Documentation
45
+ - Comprehensive README with quick start guide
46
+ - Detailed user guide with command reference and examples
47
+ - Developer documentation (CONTRIBUTING.md, architecture.md, api-reference.md)
48
+ - Example workflows (basic usage, prompt management, troubleshooting)
49
+ - Troubleshooting guide with common issues and solutions
50
+
51
+ #### Testing & Quality
52
+ - 130+ unit tests with >90% code coverage
53
+ - Integration tests for complete workflows
54
+ - Shell compatibility testing (bash, zsh, fish)
55
+ - Comprehensive error handling and validation
56
+
57
+ ### Features
58
+
59
+ - **JSON Output by Default** - All commands output JSON for easy parsing and integration with AI tools
60
+ - **Cross-Shell Compatibility** - Works seamlessly across bash, zsh, and fish shells
61
+ - **AI-Friendly Design** - Structured output perfect for AI coding assistants
62
+ - **Helpful Error Messages** - Clear, actionable error messages with suggestions
63
+ - **Command Examples** - Every command includes usage examples in help text
64
+ - **Secure Configuration** - Config files created with restricted permissions (0600)
65
+ - **Type Safety** - Built with TypeScript for reliability and maintainability
66
+ - **Fast & Lightweight** - Single bundled binary, ~28KB output size
67
+
68
+ ### Developer Experience
69
+
70
+ - Clean command pattern architecture
71
+ - Service-oriented design with clear separation of concerns
72
+ - Comprehensive unit and integration test coverage
73
+ - Type-safe implementation with TypeScript
74
+ - Easy to extend with new commands
75
+ - Professional development workflow with CI/CD ready scripts
76
+
77
+ ### Dependencies
78
+
79
+ - Node.js >= 18.0.0
80
+ - commander.js 11.x - CLI framework
81
+ - retell-sdk 4.5.x - Official Retell AI SDK
82
+ - TypeScript 5.x - Type safety
83
+ - Vitest 1.x - Testing framework
84
+ - esbuild 0.19.x - Fast bundling
85
+
86
+ ### Package
87
+
88
+ - Published to npm as `retell-cli`
89
+ - Global installation: `npm install -g retell-cli`
90
+ - Direct usage: `npx retell-cli@latest`
91
+ - Clean package structure with only necessary files
92
+ - Comprehensive keywords for discoverability
93
+
94
+ ---
95
+
96
+ ## Release Notes
97
+
98
+ ### What's New in v1.0.0
99
+
100
+ This is the first production-ready release of the Retell AI CLI! 🎉
101
+
102
+ The CLI provides a complete command-line interface for:
103
+ - Analyzing call transcripts with detailed performance metrics
104
+ - Managing Retell AI agents and configurations
105
+ - Engineering and updating agent prompts
106
+ - Publishing agents to production
107
+
108
+ **Key Highlights:**
109
+ - ✅ Full feature parity with core Retell AI workflows
110
+ - ✅ Comprehensive documentation for users and developers
111
+ - ✅ Production-ready with extensive testing (130+ tests)
112
+ - ✅ Cross-platform and cross-shell compatible
113
+ - ✅ AI-friendly JSON output for automation
114
+
115
+ **Installation:**
116
+ ```bash
117
+ npm install -g retell-cli
118
+ retell login
119
+ retell --help
120
+ ```
121
+
122
+ **Quick Start:**
123
+ ```bash
124
+ # List your agents
125
+ retell agents list
126
+
127
+ # Analyze a call
128
+ retell transcripts analyze call_abc123
129
+
130
+ # Update prompts
131
+ retell prompts pull agent_123abc
132
+ # Edit the downloaded file
133
+ retell prompts update agent_123abc
134
+ ```
135
+
136
+ For complete documentation, visit: https://github.com/awccom/retell-cli
137
+
138
+ ---
139
+
140
+ [1.0.0]: https://github.com/awccom/retell-cli/releases/tag/v1.0.0
package/README.md ADDED
@@ -0,0 +1,470 @@
1
+ # Retell AI CLI
2
+
3
+ [![npm version](https://badge.fury.io/js/retell-cli.svg)](https://www.npmjs.com/package/retell-cli)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ Official command-line tool for Retell AI - analyze call transcripts and manage agent prompts.
7
+
8
+ ## Features
9
+
10
+ - **Transcript Management** - List, retrieve, and analyze call transcripts
11
+ - **Agent Management** - View and configure Retell AI agents
12
+ - **Prompt Engineering** - Pull, edit, and update agent prompts
13
+ - **Multi-format Support** - Works with Retell LLM and Conversation Flows
14
+ - **AI-Friendly** - JSON output by default for AI coding assistants
15
+ - **Cross-Shell** - Works in bash, fish, zsh, and more
16
+
17
+ ## Installation
18
+
19
+ ```bash
20
+ npm install -g retell-cli
21
+ ```
22
+
23
+ Or use directly with npx (no installation required):
24
+
25
+ ```bash
26
+ npx retell-cli@latest --help
27
+ ```
28
+
29
+ ## Quick Start
30
+
31
+ ### 1. Authenticate
32
+
33
+ ```bash
34
+ retell login
35
+ # Enter your Retell API key when prompted
36
+ ```
37
+
38
+ Your API key will be saved to `.retellrc.json` in the current directory.
39
+
40
+ ### 2. List Your Agents
41
+
42
+ ```bash
43
+ retell agents list
44
+ ```
45
+
46
+ **Output:**
47
+ ```json
48
+ [
49
+ {
50
+ "agent_id": "agent_123abc",
51
+ "agent_name": "Customer Support Bot",
52
+ "response_engine": {
53
+ "type": "retell-llm"
54
+ }
55
+ }
56
+ ]
57
+ ```
58
+
59
+ ### 3. Analyze a Call Transcript
60
+
61
+ ```bash
62
+ # List recent calls
63
+ retell transcripts list --limit 10
64
+
65
+ # Analyze a specific call
66
+ retell transcripts analyze call_abc123
67
+ ```
68
+
69
+ **Output:**
70
+ ```json
71
+ {
72
+ "call_id": "call_abc123",
73
+ "metadata": {
74
+ "status": "ended",
75
+ "duration_ms": 45000,
76
+ "agent_name": "Customer Support Bot"
77
+ },
78
+ "analysis": {
79
+ "summary": "Customer inquired about product pricing",
80
+ "sentiment": "positive",
81
+ "successful": true
82
+ },
83
+ "performance": {
84
+ "latency_p50_ms": {
85
+ "e2e": 500,
86
+ "llm": 200,
87
+ "tts": 100
88
+ }
89
+ }
90
+ }
91
+ ```
92
+
93
+ ### 4. Manage Agent Prompts
94
+
95
+ ```bash
96
+ # Pull current prompts
97
+ retell prompts pull agent_123abc --output prompts.json
98
+
99
+ # Edit prompts.json with your changes
100
+
101
+ # Update agent with new prompts (dry run first)
102
+ retell prompts update agent_123abc --source prompts.json --dry-run
103
+
104
+ # Apply changes
105
+ retell prompts update agent_123abc --source prompts.json
106
+
107
+ # Publish the updated agent
108
+ retell agent-publish agent_123abc
109
+ ```
110
+
111
+ ## Authentication
112
+
113
+ The CLI supports three authentication methods (in order of precedence):
114
+
115
+ ### 1. Environment Variable (Best for CI/CD)
116
+
117
+ ```bash
118
+ export RETELL_API_KEY=your_api_key_here
119
+ retell agents list
120
+ ```
121
+
122
+ ### 2. Local Config File (Best for Development)
123
+
124
+ ```bash
125
+ retell login
126
+ # Creates .retellrc.json in current directory
127
+ ```
128
+
129
+ The config file format:
130
+ ```json
131
+ {
132
+ "apiKey": "your_api_key_here"
133
+ }
134
+ ```
135
+
136
+ ### 3. Per-Command Override
137
+
138
+ ```bash
139
+ RETELL_API_KEY=key_abc123 retell agents list
140
+ ```
141
+
142
+ **Note for Fish shell users:**
143
+ ```fish
144
+ env RETELL_API_KEY=key_abc123 retell agents list
145
+ ```
146
+
147
+ ## Command Reference
148
+
149
+ ### Authentication
150
+
151
+ #### `retell login`
152
+
153
+ Save your API key to a local config file.
154
+
155
+ ```bash
156
+ retell login
157
+ # Prompts: Enter your Retell API key:
158
+ ```
159
+
160
+ ### Transcripts
161
+
162
+ #### `retell transcripts list [options]`
163
+
164
+ List call transcripts with optional filtering.
165
+
166
+ **Options:**
167
+ - `-l, --limit <number>` - Maximum number of calls to return (default: 50)
168
+
169
+ **Examples:**
170
+ ```bash
171
+ # List recent calls
172
+ retell transcripts list
173
+
174
+ # List up to 100 calls
175
+ retell transcripts list --limit 100
176
+ ```
177
+
178
+ #### `retell transcripts get <call_id>`
179
+
180
+ Get detailed information about a specific call.
181
+
182
+ **Example:**
183
+ ```bash
184
+ retell transcripts get call_abc123
185
+ ```
186
+
187
+ #### `retell transcripts analyze <call_id>`
188
+
189
+ Analyze a call transcript with structured insights including sentiment, performance metrics, and cost breakdown.
190
+
191
+ **Example:**
192
+ ```bash
193
+ retell transcripts analyze call_abc123
194
+ ```
195
+
196
+ ### Agents
197
+
198
+ #### `retell agents list [options]`
199
+
200
+ List all agents in your account.
201
+
202
+ **Options:**
203
+ - `-l, --limit <number>` - Maximum number of agents to return (default: 100)
204
+
205
+ **Example:**
206
+ ```bash
207
+ retell agents list
208
+ ```
209
+
210
+ #### `retell agents info <agent_id>`
211
+
212
+ Get detailed information about a specific agent.
213
+
214
+ **Example:**
215
+ ```bash
216
+ retell agents info agent_123abc
217
+ ```
218
+
219
+ ### Prompts
220
+
221
+ #### `retell prompts pull <agent_id> [options]`
222
+
223
+ Download agent prompts to a local file.
224
+
225
+ **Options:**
226
+ - `-o, --output <path>` - Output file path (default: `.retell-prompts/<agent_id>.json`)
227
+
228
+ **Examples:**
229
+ ```bash
230
+ # Pull to default location
231
+ retell prompts pull agent_123abc
232
+
233
+ # Pull to specific file
234
+ retell prompts pull agent_123abc --output my-prompts.json
235
+ ```
236
+
237
+ #### `retell prompts update <agent_id> [options]`
238
+
239
+ Update agent prompts from a local file.
240
+
241
+ **Options:**
242
+ - `-s, --source <path>` - Source file path (default: `.retell-prompts/<agent_id>.json`)
243
+ - `--dry-run` - Preview changes without applying them
244
+
245
+ **Examples:**
246
+ ```bash
247
+ # Dry run first (recommended)
248
+ retell prompts update agent_123abc --source my-prompts.json --dry-run
249
+
250
+ # Apply changes
251
+ retell prompts update agent_123abc --source my-prompts.json
252
+ ```
253
+
254
+ **Important:** After updating prompts, remember to publish the agent:
255
+ ```bash
256
+ retell agent-publish agent_123abc
257
+ ```
258
+
259
+ #### `retell agent-publish <agent_id>`
260
+
261
+ Publish a draft agent to make changes live.
262
+
263
+ **Example:**
264
+ ```bash
265
+ retell agent-publish agent_123abc
266
+ ```
267
+
268
+ ## Common Workflows
269
+
270
+ ### Analyzing Failed Calls
271
+
272
+ ```bash
273
+ # List recent calls (look for error status)
274
+ retell transcripts list --limit 50 > calls.json
275
+
276
+ # Filter for failed calls (using jq)
277
+ jq '.[] | select(.call_status == "error")' calls.json
278
+
279
+ # Analyze each failed call
280
+ retell transcripts analyze call_xyz789
281
+ ```
282
+
283
+ ### Bulk Prompt Updates
284
+
285
+ ```bash
286
+ # Pull prompts for all agents
287
+ for agent_id in $(retell agents list | jq -r '.[].agent_id'); do
288
+ retell prompts pull $agent_id --output "prompts-${agent_id}.json"
289
+ done
290
+
291
+ # ... edit prompt files ...
292
+
293
+ # Update all agents
294
+ for file in prompts-*.json; do
295
+ agent_id=$(echo $file | sed 's/prompts-//;s/.json//')
296
+ retell prompts update $agent_id --source $file
297
+ retell agent-publish $agent_id
298
+ done
299
+ ```
300
+
301
+ ### Daily Performance Monitoring
302
+
303
+ ```bash
304
+ #!/bin/bash
305
+ # Save as: daily-report.sh
306
+
307
+ # Get all calls from today
308
+ retell transcripts list --limit 100 > today-calls.json
309
+
310
+ # Analyze each call and save report
311
+ for call_id in $(jq -r '.[].call_id' today-calls.json); do
312
+ retell transcripts analyze $call_id > "analysis-${call_id}.json"
313
+ done
314
+
315
+ # Generate summary report (using jq)
316
+ echo "Performance Summary:"
317
+ jq -s '[.[] | .performance.latency_p50_ms.e2e] | add / length' analysis-*.json
318
+ ```
319
+
320
+ ## For AI Agents
321
+
322
+ All commands output JSON by default, making this CLI perfect for AI coding assistants like Claude Code, Cursor, and GitHub Copilot.
323
+
324
+ ### Example AI Workflow
325
+
326
+ ```bash
327
+ # AI agent lists all calls and finds issues
328
+ retell transcripts list | jq '.[] | select(.call_status == "error")'
329
+
330
+ # AI analyzes a problematic call
331
+ retell transcripts analyze call_123
332
+
333
+ # AI pulls current prompts
334
+ retell prompts pull agent_456 --output current-prompts.json
335
+
336
+ # AI reads and suggests improvements to prompts
337
+ # Then updates with improved version
338
+ retell prompts update agent_456 --source improved-prompts.json --dry-run
339
+ retell prompts update agent_456 --source improved-prompts.json
340
+ retell agent-publish agent_456
341
+ ```
342
+
343
+ ### Error Format
344
+
345
+ All errors are returned as JSON for easy parsing:
346
+
347
+ ```json
348
+ {
349
+ "error": "Descriptive error message",
350
+ "code": "ERROR_CODE"
351
+ }
352
+ ```
353
+
354
+ **Common error codes:**
355
+ - `AUTHENTICATION_ERROR` - Invalid API key
356
+ - `NOT_FOUND` - Resource not found
357
+ - `CUSTOM_LLM_ERROR` - Cannot manage custom LLM agents
358
+ - `TYPE_MISMATCH` - Prompt file type doesn't match agent type
359
+
360
+ ## Troubleshooting
361
+
362
+ ### "API key is missing or invalid"
363
+
364
+ **Solution:**
365
+ 1. Run `retell login` to set up authentication
366
+ 2. Or set `RETELL_API_KEY` environment variable
367
+ 3. Verify your API key in the [Retell dashboard](https://app.retellai.com)
368
+
369
+ ### "Cannot manage custom LLM agents"
370
+
371
+ **Cause:** Custom LLM agents use external WebSocket connections and cannot be managed via the API.
372
+
373
+ **Solution:** Use the [Retell dashboard](https://app.retellai.com) to manage custom LLM agents.
374
+
375
+ ### "Type mismatch" error
376
+
377
+ **Cause:** The prompt file type must match the agent's response engine type.
378
+
379
+ **Solution:** Check your agent type:
380
+ ```bash
381
+ retell agents info <agent_id> | jq '.response_engine.type'
382
+ ```
383
+
384
+ Ensure your prompt file has the correct type:
385
+ - `retell-llm` - For Retell LLM agents
386
+ - `conversation-flow` - For Conversation Flow agents
387
+
388
+ ### Permission denied on config file
389
+
390
+ **Cause:** The CLI creates `.retellrc.json` with restricted permissions (0600) for security.
391
+
392
+ **Solution:** Check file ownership and permissions:
393
+ ```bash
394
+ ls -la .retellrc.json
395
+ # Should show: -rw------- (readable/writable by owner only)
396
+ ```
397
+
398
+ ### Command not found after installation
399
+
400
+ **Solution:** Ensure npm global bin directory is in your PATH:
401
+ ```bash
402
+ npm config get prefix
403
+ # Add this path to your PATH environment variable
404
+ ```
405
+
406
+ For npm global installs:
407
+ ```bash
408
+ export PATH="$(npm config get prefix)/bin:$PATH"
409
+ ```
410
+
411
+ ## Development
412
+
413
+ Want to contribute or run the CLI locally? See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and guidelines.
414
+
415
+ ```bash
416
+ # Clone the repository
417
+ git clone https://github.com/awccom/retell-cli.git
418
+ cd retell-cli
419
+
420
+ # Install dependencies
421
+ npm install
422
+
423
+ # Build
424
+ npm run build
425
+
426
+ # Run tests
427
+ npm test
428
+
429
+ # Link for local development
430
+ npm link
431
+ retell --version
432
+ ```
433
+
434
+ ## Shell Compatibility
435
+
436
+ The Retell CLI is fully compatible with:
437
+ - **Bash** (GNU Bash 5.x)
438
+ - **Zsh** (5.x)
439
+ - **Fish** (3.x)
440
+
441
+ See [docs/shell-compatibility.md](docs/shell-compatibility.md) for detailed test results.
442
+
443
+ ## Contributing
444
+
445
+ Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
446
+
447
+ ## License
448
+
449
+ MIT License - see [LICENSE](LICENSE) for details.
450
+
451
+ ## Resources
452
+
453
+ - [Documentation](https://docs.retellai.com)
454
+ - [User Guide](docs/user-guide.md)
455
+ - [GitHub Issues](https://github.com/awccom/retell-cli/issues)
456
+ - [Retell AI Dashboard](https://app.retellai.com)
457
+ - [Retell AI API Docs](https://docs.retellai.com/api-references/overview)
458
+
459
+ ## Support
460
+
461
+ If you encounter any issues or have questions:
462
+
463
+ 1. Check the [Troubleshooting](#troubleshooting) section
464
+ 2. Review the [User Guide](docs/user-guide.md)
465
+ 3. Search [existing issues](https://github.com/awccom/retell-cli/issues)
466
+ 4. Open a [new issue](https://github.com/awccom/retell-cli/issues/new)
467
+
468
+ ---
469
+
470
+ Built with by the Retell AI community.