@mutagent/cli 0.1.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/README.md +447 -0
- package/dist/bin/cli.js +17510 -0
- package/dist/bin/cli.js.map +411 -0
- package/dist/index.js +13935 -0
- package/dist/index.js.map +378 -0
- package/package.json +77 -0
package/README.md
ADDED
|
@@ -0,0 +1,447 @@
|
|
|
1
|
+
# MutagenT CLI
|
|
2
|
+
|
|
3
|
+
```bash
|
|
4
|
+
╔══════════════════════════════════════════════════════════════════════════════════╗
|
|
5
|
+
║ ║
|
|
6
|
+
║ ███╗ ███╗██╗ ██╗████████╗ █████╗ ██████╗ ███████╗███╗ ██╗████████╗ ║
|
|
7
|
+
║ ████╗ ████║██║ ██║╚══██╔══╝██╔══██╗██╔════╝ ██╔════╝████╗ ██║╚══██╔══╝ ║
|
|
8
|
+
║ ██╔████╔██║██║ ██║ ██║ ███████║██║ ███╗█████╗ ██╔██╗ ██║ ██║ ║
|
|
9
|
+
║ ██║╚██╔╝██║██║ ██║ ██║ ██╔══██║██║ ██║██╔══╝ ██║╚██╗██║ ██║ ║
|
|
10
|
+
║ ██║ ╚═╝ ██║╚██████╔╝ ██║ ██║ ██║╚██████╔╝███████╗██║ ╚████║ ██║ ║
|
|
11
|
+
║ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═══╝ ╚═╝ ║
|
|
12
|
+
║ ║
|
|
13
|
+
║ ██████╗██╗ ██╗ ║
|
|
14
|
+
║ ██╔════╝██║ ██║ ║
|
|
15
|
+
║ ██║ ██║ ██║ ║
|
|
16
|
+
║ ██║ ██║ ██║ ║
|
|
17
|
+
║ ╚██████╗███████╗██║ ║
|
|
18
|
+
║ ╚═════╝╚══════╝╚═╝ ║
|
|
19
|
+
║ ║
|
|
20
|
+
║ AI-Native Prompt Optimization Platform. ║
|
|
21
|
+
║ ║
|
|
22
|
+
╚══════════════════════════════════════════════════════════════════════════════════╝
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
<p align="center">
|
|
26
|
+
<a href="https://bun.sh"><img src="https://img.shields.io/badge/Bun-1.1+-f472b6?style=for-the-badge&logo=bun&logoColor=white" alt="Bun"></a>
|
|
27
|
+
<a href="https://nodejs.org"><img src="https://img.shields.io/badge/Node-18+-339933?style=for-the-badge&logo=node.js&logoColor=white" alt="Node.js"></a>
|
|
28
|
+
<a href="https://www.typescriptlang.org"><img src="https://img.shields.io/badge/TypeScript-5.0+-3178C6?style=for-the-badge&logo=typescript&logoColor=white" alt="TypeScript"></a>
|
|
29
|
+
<a href="#"><img src="https://img.shields.io/badge/License-Proprietary-ff6b6b?style=for-the-badge" alt="License: Proprietary"></a>
|
|
30
|
+
</p>
|
|
31
|
+
|
|
32
|
+
<p align="center">
|
|
33
|
+
<strong>Replace Langfuse. Optimize Prompts. Integrate Any Framework.</strong>
|
|
34
|
+
</p>
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## 🚀 What is MutagenT CLI?
|
|
39
|
+
|
|
40
|
+
MutagenT CLI is the command-line interface for the **MutagenT AI platform** — a next-generation prompt optimization and observability system designed for AI-native development workflows.
|
|
41
|
+
|
|
42
|
+
### Key Features
|
|
43
|
+
|
|
44
|
+
- 🎯 **Prompt-Centric**: Datasets, evaluations, and optimizations are all scoped to prompts
|
|
45
|
+
- 📊 **Langfuse Replacement**: Native trace observability without external dependencies
|
|
46
|
+
- 🤖 **AI-First Design**: Every command supports `--json` for programmatic usage
|
|
47
|
+
- 🔌 **Framework Integrations**: One-command setup for Mastra, LangChain, LangGraph, Vercel AI SDK, Claude Code
|
|
48
|
+
- ⚡ **Bun-Native**: Built for speed with Bun runtime (Node.js 18+ compatible)
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## 📦 Installation
|
|
53
|
+
|
|
54
|
+
### Using Bun (Recommended)
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
bun install -g @mutagent/cli
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Using npm
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
npm install -g @mutagent/cli
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Using pnpm
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pnpm add -g @mutagent/cli
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Verify Installation
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
mutagent --version
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## 🔑 Quick Start
|
|
81
|
+
|
|
82
|
+
### 1. Authenticate
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
mutagent auth login
|
|
86
|
+
# Enter your API key when prompted
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Or use environment variables:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
export MUTAGENT_API_KEY="sk_live_xxxxxxxx"
|
|
93
|
+
export MUTAGENT_ENDPOINT="https://api.mutagent.io/v1"
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### 2. Check Status
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
mutagent auth status
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### 3. Get Framework Integration
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# Interactive selection
|
|
106
|
+
mutagent integrate
|
|
107
|
+
|
|
108
|
+
# Direct framework
|
|
109
|
+
mutagent integrate mastra
|
|
110
|
+
mutagent integrate langchain
|
|
111
|
+
mutagent integrate vercel-ai
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### 4. Start Using
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# List prompts
|
|
118
|
+
mutagent prompts list
|
|
119
|
+
|
|
120
|
+
# Create a prompt
|
|
121
|
+
mutagent prompts create --file ./my-prompt.json
|
|
122
|
+
|
|
123
|
+
# Run optimization
|
|
124
|
+
mutagent prompts optimize <prompt-id> --dataset <dataset-id>
|
|
125
|
+
|
|
126
|
+
# View traces (replaces Langfuse)
|
|
127
|
+
mutagent traces list --prompt <prompt-id>
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## 📚 Commands Reference
|
|
133
|
+
|
|
134
|
+
### Global Options
|
|
135
|
+
|
|
136
|
+
| Option | Description |
|
|
137
|
+
|--------|-------------|
|
|
138
|
+
| `--json` | Output results as JSON (for AI agents) |
|
|
139
|
+
| `--api-key <key>` | MutagenT API key |
|
|
140
|
+
| `--endpoint <url>` | MutagenT server endpoint |
|
|
141
|
+
| `--help` | Display help for command |
|
|
142
|
+
| `--version` | Display version number |
|
|
143
|
+
|
|
144
|
+
### Authentication
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
mutagent auth login # Interactive login
|
|
148
|
+
mutagent auth status # Check authentication
|
|
149
|
+
mutagent auth logout # Clear credentials
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Configuration
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
mutagent config list # List all configuration
|
|
156
|
+
mutagent config get <key> # Get specific config value
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Prompts
|
|
160
|
+
|
|
161
|
+
Prompts are the root entity. Datasets, evaluations, and optimizations are scoped to prompts.
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
# CRUD Operations
|
|
165
|
+
mutagent prompts list # List all prompts
|
|
166
|
+
mutagent prompts get <id> # Get prompt details
|
|
167
|
+
mutagent prompts get <id> --with-datasets # Include datasets
|
|
168
|
+
mutagent prompts get <id> --with-evals # Include evaluations
|
|
169
|
+
mutagent prompts create --file prompt.json # Create from file
|
|
170
|
+
mutagent prompts create --name "My Prompt" --content "..."
|
|
171
|
+
mutagent prompts update <id> --file prompt.json
|
|
172
|
+
mutagent prompts delete <id>
|
|
173
|
+
|
|
174
|
+
# Datasets (scoped to prompt)
|
|
175
|
+
mutagent prompts datasets <prompt-id> # List datasets
|
|
176
|
+
mutagent prompts datasets:add <id> --file data.jsonl # Add dataset
|
|
177
|
+
mutagent prompts datasets:remove <id> <dataset-id> # Remove dataset
|
|
178
|
+
|
|
179
|
+
# Evaluations (scoped to prompt + dataset)
|
|
180
|
+
mutagent prompts evals <prompt-id> # List evaluations
|
|
181
|
+
mutagent prompts evals:run <id> --dataset <dataset-id> # Run evaluation
|
|
182
|
+
mutagent prompts evals:results <run-id> # Get results
|
|
183
|
+
|
|
184
|
+
# Optimization (scoped to prompt + dataset)
|
|
185
|
+
mutagent prompts optimize <id> --dataset <dataset-id> # Start optimization
|
|
186
|
+
mutagent prompts optimize:status <job-id> # Check status
|
|
187
|
+
mutagent prompts optimize:results <job-id> # Get results
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Traces (Langfuse Replacement)
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
mutagent traces list # List all traces
|
|
194
|
+
mutagent traces list --prompt <id> # Filter by prompt
|
|
195
|
+
mutagent traces get <trace-id> # Get trace details
|
|
196
|
+
mutagent traces analyze <prompt-id> # Analyze trace patterns
|
|
197
|
+
mutagent traces export --format json # Export as JSON
|
|
198
|
+
mutagent traces export --format csv # Export as CSV
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### Framework Integration
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
# List available frameworks
|
|
205
|
+
mutagent integrate list
|
|
206
|
+
|
|
207
|
+
# Get integration guide (markdown format)
|
|
208
|
+
mutagent integrate mastra
|
|
209
|
+
mutagent integrate langchain
|
|
210
|
+
mutagent integrate langgraph
|
|
211
|
+
mutagent integrate vercel-ai
|
|
212
|
+
mutagent integrate claude-code
|
|
213
|
+
mutagent integrate generic
|
|
214
|
+
|
|
215
|
+
# Save to file
|
|
216
|
+
mutagent integrate mastra --output ./INTEGRATION.md
|
|
217
|
+
|
|
218
|
+
# Raw markdown output
|
|
219
|
+
mutagent integrate mastra --raw
|
|
220
|
+
|
|
221
|
+
# Verify integration
|
|
222
|
+
mutagent integrate mastra --verify
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## 🤖 AI-First Usage
|
|
228
|
+
|
|
229
|
+
Every command supports `--json` for machine-readable output:
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
# AI agent checking available prompts
|
|
233
|
+
mutagent --json prompts list
|
|
234
|
+
|
|
235
|
+
# AI agent creating a prompt
|
|
236
|
+
mutagent --json prompts create --file prompt.json
|
|
237
|
+
|
|
238
|
+
# AI agent running evaluation
|
|
239
|
+
mutagent --json prompts evals:run <id> --dataset <ds-id>
|
|
240
|
+
|
|
241
|
+
# AI agent getting integration guide
|
|
242
|
+
mutagent --json integrate mastra
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### Exit Codes
|
|
246
|
+
|
|
247
|
+
| Code | Meaning |
|
|
248
|
+
|------|---------|
|
|
249
|
+
| `0` | Success |
|
|
250
|
+
| `1` | Error |
|
|
251
|
+
| `2` | Partial success / Authentication required |
|
|
252
|
+
|
|
253
|
+
### Structured Errors (JSON Mode)
|
|
254
|
+
|
|
255
|
+
```json
|
|
256
|
+
{
|
|
257
|
+
"error": {
|
|
258
|
+
"code": "AUTH_REQUIRED",
|
|
259
|
+
"message": "Authentication required",
|
|
260
|
+
"suggestion": "Run: mutagent auth login"
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
## 🔌 Framework Integrations
|
|
268
|
+
|
|
269
|
+
### Supported Frameworks
|
|
270
|
+
|
|
271
|
+
| Framework | Package | Description |
|
|
272
|
+
|-----------|---------|-------------|
|
|
273
|
+
| **Mastra** | `@mastra/core` | Modern AI agent framework with observability |
|
|
274
|
+
| **LangChain** | `langchain` | Popular LLM application framework |
|
|
275
|
+
| **LangGraph** | `@langchain/langgraph` | Agent workflow framework |
|
|
276
|
+
| **Vercel AI SDK** | `ai` | AI SDK for streaming chat UIs |
|
|
277
|
+
| **Claude Code SDK** | `@anthropic-ai/claude-code` | Native Anthropic integration |
|
|
278
|
+
| **Generic** | `openai` | Any OpenAI-compatible API |
|
|
279
|
+
|
|
280
|
+
### Integration Output Format
|
|
281
|
+
|
|
282
|
+
Integration guides are output as **Markdown with YAML frontmatter** (similar to Claude Skills):
|
|
283
|
+
|
|
284
|
+
```markdown
|
|
285
|
+
---
|
|
286
|
+
name: mutagent-mastra-integration
|
|
287
|
+
framework: mastra
|
|
288
|
+
version: 1.0.0
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
# MutagenT + Mastra Integration
|
|
292
|
+
|
|
293
|
+
## Prerequisites Verification
|
|
294
|
+
|
|
295
|
+
✓ MUTAGENT_API_KEY: sk_live_...xxxx
|
|
296
|
+
✓ MUTAGENT_ENDPOINT: https://api.mutagent.io/v1
|
|
297
|
+
✓ API Connection: Verified
|
|
298
|
+
|
|
299
|
+
## Installation
|
|
300
|
+
|
|
301
|
+
```bash
|
|
302
|
+
bun add @mutagent/sdk
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
## Configuration
|
|
306
|
+
|
|
307
|
+
MutagenT CLI merges configuration in this order (highest → lowest priority):
|
|
308
|
+
|
|
309
|
+
1. Environment variables
|
|
310
|
+
2. Credentials file (`~/.config/mutagent/credentials.json`)
|
|
311
|
+
3. RC files via `cosmiconfig`
|
|
312
|
+
4. Defaults
|
|
313
|
+
|
|
314
|
+
Supported keys:
|
|
315
|
+
- `apiKey`
|
|
316
|
+
- `endpoint` (default: `https://api.mutagent.io/v1`)
|
|
317
|
+
- `format` (`table` | `json`, default: `table`)
|
|
318
|
+
- `timeout` (default: `30000`)
|
|
319
|
+
- `defaultWorkspace`
|
|
320
|
+
- `defaultOrganization`
|
|
321
|
+
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
---
|
|
325
|
+
|
|
326
|
+
## 📁 Configuration Files
|
|
327
|
+
|
|
328
|
+
### Environment Variables
|
|
329
|
+
|
|
330
|
+
```bash
|
|
331
|
+
MUTAGENT_API_KEY=sk_live_xxxxxxxx
|
|
332
|
+
MUTAGENT_ENDPOINT=https://api.mutagent.io/v1
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
### RC Files
|
|
336
|
+
|
|
337
|
+
Create `.mutagentrc` or `.mutagentrc.json`:
|
|
338
|
+
|
|
339
|
+
```json
|
|
340
|
+
{
|
|
341
|
+
"endpoint": "https://api.mutagent.io/v1",
|
|
342
|
+
"format": "table"
|
|
343
|
+
}
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
Or `mutagent.config.js`:
|
|
347
|
+
|
|
348
|
+
```javascript
|
|
349
|
+
module.exports = {
|
|
350
|
+
endpoint: 'https://api.mutagent.io/v1',
|
|
351
|
+
format: 'table',
|
|
352
|
+
};
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
### Global Config
|
|
356
|
+
|
|
357
|
+
Stored in `~/.config/mutagent/credentials.json` (created by `mutagent auth login`)
|
|
358
|
+
|
|
359
|
+
---
|
|
360
|
+
|
|
361
|
+
## 🛠️ Development
|
|
362
|
+
|
|
363
|
+
### Prerequisites
|
|
364
|
+
|
|
365
|
+
- [Bun](https://bun.sh) >= 1.1.0
|
|
366
|
+
- Node.js >= 18.0.0 (fallback)
|
|
367
|
+
|
|
368
|
+
### Setup
|
|
369
|
+
|
|
370
|
+
```bash
|
|
371
|
+
git clone https://github.com/mutagent/mutagent-cli.git
|
|
372
|
+
cd mutagent-cli
|
|
373
|
+
bun install
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
### Development Commands
|
|
377
|
+
|
|
378
|
+
```bash
|
|
379
|
+
# Run in development mode
|
|
380
|
+
bun run dev -- --help
|
|
381
|
+
|
|
382
|
+
# Type check
|
|
383
|
+
bun run typecheck
|
|
384
|
+
|
|
385
|
+
# Build
|
|
386
|
+
bun run build
|
|
387
|
+
|
|
388
|
+
# Test
|
|
389
|
+
bun test
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
---
|
|
393
|
+
|
|
394
|
+
## 🔄 Migration from Langfuse
|
|
395
|
+
|
|
396
|
+
Replace Langfuse with MutagenT:
|
|
397
|
+
|
|
398
|
+
```typescript
|
|
399
|
+
// Before (Langfuse)
|
|
400
|
+
import { Langfuse } from 'langfuse';
|
|
401
|
+
|
|
402
|
+
const langfuse = new Langfuse({
|
|
403
|
+
publicKey: process.env.LANGFUSE_PUBLIC_KEY,
|
|
404
|
+
secretKey: process.env.LANGFUSE_SECRET_KEY,
|
|
405
|
+
});
|
|
406
|
+
|
|
407
|
+
// After (MutagenT)
|
|
408
|
+
import { MutagentObserver } from '@mutagent/sdk/mastra';
|
|
409
|
+
|
|
410
|
+
const observer = new MutagentObserver({
|
|
411
|
+
apiKey: process.env.MUTAGENT_API_KEY,
|
|
412
|
+
});
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
---
|
|
416
|
+
|
|
417
|
+
## 📖 Documentation
|
|
418
|
+
|
|
419
|
+
- [Full Documentation](https://docs.mutagent.io)
|
|
420
|
+
- [API Reference](https://docs.mutagent.io/api)
|
|
421
|
+
- [Framework Guides](https://docs.mutagent.io/frameworks)
|
|
422
|
+
|
|
423
|
+
---
|
|
424
|
+
|
|
425
|
+
## 🤝 Contributing
|
|
426
|
+
|
|
427
|
+
Contributions are welcome! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
|
|
428
|
+
|
|
429
|
+
---
|
|
430
|
+
|
|
431
|
+
## 📄 License
|
|
432
|
+
|
|
433
|
+
This software is proprietary and confidential. Unauthorized copying, distribution, or use is strictly prohibited.
|
|
434
|
+
|
|
435
|
+
© 2026 MutagenT. All rights reserved.
|
|
436
|
+
|
|
437
|
+
---
|
|
438
|
+
|
|
439
|
+
<p align="center">
|
|
440
|
+
<sub>Built with ❤️ by the MutagenT Team</sub>
|
|
441
|
+
</p>
|
|
442
|
+
|
|
443
|
+
<p align="center">
|
|
444
|
+
<a href="https://twitter.com/mutagent">Twitter</a> •
|
|
445
|
+
<a href="https://discord.gg/mutagent">Discord</a> •
|
|
446
|
+
<a href="https://mutagent.io">Website</a>
|
|
447
|
+
</p>
|