@syntropic137/cli 0.19.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 +264 -0
- package/dist/syn.mjs +4823 -0
- package/package.json +37 -0
package/README.md
ADDED
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
# @syntropic137/cli
|
|
2
|
+
|
|
3
|
+
Command-line interface for [Syntropic137](https://github.com/syntropic137/syntropic137) — an event-sourced workflow engine for AI agents.
|
|
4
|
+
|
|
5
|
+
## Design
|
|
6
|
+
|
|
7
|
+
**Single dependency. 168 KB. Full API coverage.**
|
|
8
|
+
|
|
9
|
+
The CLI is built with a zero-dependency philosophy:
|
|
10
|
+
|
|
11
|
+
- **No Commander.js** — custom two-level command framework on `node:parseArgs`
|
|
12
|
+
- **No chalk** — direct ANSI escape codes with `NO_COLOR` support
|
|
13
|
+
- **No axios** — built-in `fetch` with timeout and streaming (SSE)
|
|
14
|
+
- **One runtime dep** — [Zod](https://zod.dev) for local file validation only
|
|
15
|
+
|
|
16
|
+
The entire CLI ships as a single `dist/syn.mjs` file (168 KB). It targets Node.js 22+ with strict TypeScript (`noUncheckedIndexedAccess`, `exactOptionalPropertyTypes`).
|
|
17
|
+
|
|
18
|
+
API response types are generated from the OpenAPI spec, so the TypeScript compiler catches any API drift at build time.
|
|
19
|
+
|
|
20
|
+
## Install
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install -g @syntropic137/cli
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Or run directly:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npx @syntropic137/cli health
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Connect to a Server
|
|
33
|
+
|
|
34
|
+
By default, the CLI connects to `http://localhost:8137` (local dev server).
|
|
35
|
+
|
|
36
|
+
### Local
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# Start the API server
|
|
40
|
+
just dev
|
|
41
|
+
|
|
42
|
+
# Use the CLI — no auth needed on localhost
|
|
43
|
+
syn health
|
|
44
|
+
syn workflow list
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Remote
|
|
48
|
+
|
|
49
|
+
Set the server URL and credentials:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
export SYN_API_URL=https://syn.example.com
|
|
53
|
+
export SYN_API_USER=admin
|
|
54
|
+
export SYN_API_PASSWORD=your-password
|
|
55
|
+
|
|
56
|
+
syn health
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Or use a bearer token:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
export SYN_API_URL=https://syn.example.com
|
|
63
|
+
export SYN_API_TOKEN=your-token
|
|
64
|
+
|
|
65
|
+
syn health
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Environment variables take precedence. When no credentials are set, requests are sent without authentication (suitable for localhost).
|
|
69
|
+
|
|
70
|
+
## Commands
|
|
71
|
+
|
|
72
|
+
### Root Commands
|
|
73
|
+
|
|
74
|
+
| Command | Description |
|
|
75
|
+
|---------|-------------|
|
|
76
|
+
| `syn health` | Check API server health |
|
|
77
|
+
| `syn version` | Show CLI version |
|
|
78
|
+
| `syn run <workflow>` | Execute a workflow (shortcut) |
|
|
79
|
+
|
|
80
|
+
### Workflow Management
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
syn workflow list # List all workflows
|
|
84
|
+
syn workflow show <id> # Show workflow details
|
|
85
|
+
syn workflow create <name> # Create a new workflow
|
|
86
|
+
syn workflow run <id> -i key=value # Execute a workflow
|
|
87
|
+
syn workflow status <id> # Show execution history
|
|
88
|
+
syn workflow validate <path> # Validate a workflow package
|
|
89
|
+
syn workflow delete <id> --force # Archive a workflow
|
|
90
|
+
syn workflow export <id> -o ./out # Export workflow files
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Workflow Packages & Marketplace
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
# Install from marketplace, git, or local path
|
|
97
|
+
syn workflow install my-plugin
|
|
98
|
+
syn workflow install https://github.com/org/repo
|
|
99
|
+
syn workflow install ./local-package
|
|
100
|
+
|
|
101
|
+
# Manage installations
|
|
102
|
+
syn workflow installed # List installed packages
|
|
103
|
+
syn workflow update my-plugin # Update to latest
|
|
104
|
+
syn workflow uninstall my-plugin # Remove workflows
|
|
105
|
+
|
|
106
|
+
# Search the marketplace
|
|
107
|
+
syn workflow search "code review"
|
|
108
|
+
syn workflow info my-plugin
|
|
109
|
+
|
|
110
|
+
# Manage registries
|
|
111
|
+
syn marketplace add https://github.com/org/registry
|
|
112
|
+
syn marketplace list
|
|
113
|
+
syn marketplace refresh
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Execution Control
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
syn execution list # List all executions
|
|
120
|
+
syn execution show <id> # Show execution detail
|
|
121
|
+
|
|
122
|
+
syn control pause <id> # Pause at next yield point
|
|
123
|
+
syn control resume <id> # Resume paused execution
|
|
124
|
+
syn control cancel <id> --force # Cancel execution
|
|
125
|
+
syn control status <id> # Check execution state
|
|
126
|
+
syn control inject <id> -m "msg" # Inject a message
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Sessions & Observability
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
syn sessions list # List agent sessions
|
|
133
|
+
syn sessions show <id> # Show session detail
|
|
134
|
+
|
|
135
|
+
syn events recent # Recent domain events
|
|
136
|
+
syn events session <id> # Session events
|
|
137
|
+
syn events timeline <id> # Tool-call timeline
|
|
138
|
+
syn events costs <id> # Token/cost breakdown
|
|
139
|
+
syn events tools <id> # Tool usage summary
|
|
140
|
+
|
|
141
|
+
syn observe tools <id> # Tool execution timeline
|
|
142
|
+
syn observe tokens <id> # Token breakdown
|
|
143
|
+
|
|
144
|
+
syn conversations show <id> # View conversation log
|
|
145
|
+
syn conversations metadata <id> # Conversation metadata
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Cost Tracking
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
syn costs summary # Global cost overview
|
|
152
|
+
syn costs sessions # Cost by session
|
|
153
|
+
syn costs session <id> # Session cost detail
|
|
154
|
+
syn costs executions # Cost by execution
|
|
155
|
+
syn costs execution <id> # Execution cost detail
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Organization Management
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
syn org create --name "Acme" # Create organization
|
|
162
|
+
syn org list # List organizations
|
|
163
|
+
syn org show <id> # Organization detail
|
|
164
|
+
|
|
165
|
+
syn system create --name "Backend" # Create system
|
|
166
|
+
syn system list # List systems
|
|
167
|
+
syn system status <id> # System health
|
|
168
|
+
syn system cost <id> # System costs
|
|
169
|
+
syn system patterns <id> # Failure patterns
|
|
170
|
+
syn system history <id> # Execution history
|
|
171
|
+
|
|
172
|
+
syn repo register --url owner/repo # Register repository
|
|
173
|
+
syn repo list # List repositories
|
|
174
|
+
syn repo health <id> # Health metrics
|
|
175
|
+
syn repo cost <id> # Cost breakdown
|
|
176
|
+
syn repo activity <id> # Recent activity
|
|
177
|
+
syn repo failures <id> # Recent failures
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Live Streaming
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
syn watch execution <id> # Stream execution events (SSE)
|
|
184
|
+
syn watch activity # Stream all activity
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Triggers
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
syn triggers register --repo r --workflow w --event push
|
|
191
|
+
syn triggers enable self-healing --repo r
|
|
192
|
+
syn triggers list
|
|
193
|
+
syn triggers show <id>
|
|
194
|
+
syn triggers history <id>
|
|
195
|
+
syn triggers pause <id>
|
|
196
|
+
syn triggers delete <id> --force
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Configuration & Metrics
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
syn config show # Show current config
|
|
203
|
+
syn config validate # Validate configuration
|
|
204
|
+
syn metrics show # Aggregated metrics
|
|
205
|
+
syn insights overview # Global system overview
|
|
206
|
+
syn insights cost --days 30 # Cost analysis
|
|
207
|
+
syn insights heatmap # Activity heatmap
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## Environment Variables
|
|
211
|
+
|
|
212
|
+
| Variable | Default | Description |
|
|
213
|
+
|----------|---------|-------------|
|
|
214
|
+
| `SYN_API_URL` | `http://localhost:8137` | API server URL |
|
|
215
|
+
| `SYN_API_TOKEN` | — | Bearer token for authentication |
|
|
216
|
+
| `SYN_API_USER` | — | Basic auth username |
|
|
217
|
+
| `SYN_API_PASSWORD` | — | Basic auth password |
|
|
218
|
+
| `NO_COLOR` | — | Disable colored output |
|
|
219
|
+
|
|
220
|
+
## Development
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
# Install dependencies
|
|
224
|
+
pnpm install
|
|
225
|
+
|
|
226
|
+
# Development mode (auto-reload)
|
|
227
|
+
pnpm dev
|
|
228
|
+
|
|
229
|
+
# Build
|
|
230
|
+
pnpm build
|
|
231
|
+
|
|
232
|
+
# Run tests
|
|
233
|
+
pnpm test
|
|
234
|
+
|
|
235
|
+
# Type check
|
|
236
|
+
pnpm typecheck
|
|
237
|
+
|
|
238
|
+
# Regenerate API types from OpenAPI spec
|
|
239
|
+
pnpm generate:types
|
|
240
|
+
|
|
241
|
+
# Check for API drift (CI)
|
|
242
|
+
pnpm check:api-drift
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## API Type Safety
|
|
246
|
+
|
|
247
|
+
Response types are generated from the OpenAPI spec (`apps/syn-docs/openapi.json`) using `openapi-typescript`. Commands import these types and pass them as generics to `apiGet<T>()` / `apiPost<T>()`, so the TypeScript compiler catches any mismatch between the CLI and API.
|
|
248
|
+
|
|
249
|
+
```typescript
|
|
250
|
+
import type { ExecutionListResponse } from "../generated/types.js";
|
|
251
|
+
|
|
252
|
+
const data = await apiGet<ExecutionListResponse>("/executions", { params });
|
|
253
|
+
// data.executions is typed as ExecutionSummaryResponse[]
|
|
254
|
+
// data.total is typed as number
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
If the API spec changes:
|
|
258
|
+
1. `pnpm generate:types` regenerates the types
|
|
259
|
+
2. `tsc` catches any CLI code that doesn't match the new schema
|
|
260
|
+
3. `pnpm check:api-drift` in CI flags stale generated types
|
|
261
|
+
|
|
262
|
+
## License
|
|
263
|
+
|
|
264
|
+
MIT
|