@elsium-ai/cli 0.2.1 → 0.2.2

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.
Files changed (3) hide show
  1. package/README.md +439 -12
  2. package/dist/cli.js +10 -10
  3. package/package.json +4 -4
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @elsium-ai/cli
2
2
 
3
- CLI tool for [ElsiumAI](https://github.com/elsium-ai/elsium-ai) projects.
3
+ Command-line interface for scaffolding, developing, evaluating, and observing ElsiumAI projects.
4
4
 
5
5
  [![npm](https://img.shields.io/npm/v/@elsium-ai/cli.svg)](https://www.npmjs.com/package/@elsium-ai/cli)
6
6
  [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/elsium-ai/elsium-ai/blob/main/LICENSE)
@@ -9,34 +9,461 @@ CLI tool for [ElsiumAI](https://github.com/elsium-ai/elsium-ai) projects.
9
9
 
10
10
  ```bash
11
11
  npm install -g @elsium-ai/cli
12
- # or use directly
13
- npx @elsium-ai/cli init
14
12
  ```
15
13
 
14
+ Or run commands directly without installing:
15
+
16
+ ```bash
17
+ npx @elsium-ai/cli init my-ai-app
18
+ ```
19
+
20
+ ## What's Inside
21
+
22
+ | Command | Description |
23
+ | --- | --- |
24
+ | `elsium init [name]` | Scaffold a new ElsiumAI project with best-practice directory structure |
25
+ | `elsium dev [entry]` | Start a development server with hot reload |
26
+ | `elsium eval <file>` | Run an evaluation suite against your agents |
27
+ | `elsium cost` | Display the cost report from the last run |
28
+ | `elsium trace [id]` | List recent traces or inspect a specific trace |
29
+ | `elsium xray` | Inspect raw LLM request/response details (X-Ray mode) |
30
+ | `elsium prompt <subcommand>` | Manage versioned prompts (list, show, diff, history) |
31
+
32
+ Global options:
33
+
34
+ | Flag | Description |
35
+ | --- | --- |
36
+ | `--help`, `-h` | Show help message |
37
+ | `--version`, `-v` | Show CLI version |
38
+
39
+ ---
40
+
16
41
  ## Commands
17
42
 
18
- - **`elsium init`** — Scaffold a new ElsiumAI project with best-practice structure
19
- - **`elsium dev`** — Start development server with hot reload
20
- - **`elsium eval`** — Run evaluation suites against your agents
43
+ ### `elsium init`
21
44
 
22
- ## Usage
45
+ Scaffolds a new ElsiumAI project with a complete directory structure, configuration files, example agents, tools, workflows, evaluations, and tests.
46
+
47
+ **Usage**
48
+
49
+ ```
50
+ elsium init [name]
51
+ ```
52
+
53
+ **Arguments**
54
+
55
+ | Argument | Default | Description |
56
+ | --- | --- | --- |
57
+ | `name` | `my-elsium-app` | Name of the project directory to create |
58
+
59
+ The generated project includes:
60
+
61
+ | Path | Purpose |
62
+ | --- | --- |
63
+ | `src/agents/` | Agent definitions with guardrails |
64
+ | `src/tools/` | Tool schemas validated by Zod |
65
+ | `src/policies/` | Policy sets (model allowlist, cost caps) |
66
+ | `src/gateway/` | Provider mesh with circuit breaker |
67
+ | `src/workflows/` | Multi-step workflows |
68
+ | `evals/` | Evaluation suites (quality + determinism) |
69
+ | `test/` | Unit tests with mock providers and replay |
70
+ | `.elsium/` | ElsiumAI local state (baselines, recordings) |
71
+ | `elsium.config.ts` | Central project configuration |
72
+ | `biome.json` | Linter/formatter settings |
73
+
74
+ **Example**
23
75
 
24
76
  ```bash
25
- # Create a new project
26
77
  elsium init my-ai-app
27
-
28
- # Start development
29
78
  cd my-ai-app
79
+ cp .env.example .env # add your API keys
80
+ npm install
81
+ npm run dev
82
+ ```
83
+
84
+ ---
85
+
86
+ ### `elsium dev`
87
+
88
+ Starts a development server that watches your entry file for changes and automatically restarts on save. Powered by `bun --watch` under the hood.
89
+
90
+ **Usage**
91
+
92
+ ```
93
+ elsium dev [entry]
94
+ ```
95
+
96
+ **Arguments**
97
+
98
+ | Argument | Default | Description |
99
+ | --- | --- | --- |
100
+ | `entry` | `src/index.ts` | Path to the entry file (must be within the project directory) |
101
+
102
+ The command validates that the entry file exists and is inside the current working directory before starting the server. Press `Ctrl+C` to stop.
103
+
104
+ **Example**
105
+
106
+ ```bash
107
+ # Start with default entry point
30
108
  elsium dev
31
109
 
32
- # Run evaluations
33
- elsium eval
110
+ # Start with a custom entry file
111
+ elsium dev src/server.ts
112
+ ```
113
+
114
+ ---
115
+
116
+ ### `elsium eval`
117
+
118
+ Runs an evaluation suite defined in a TypeScript file against your agents or LLM pipelines. The eval file must export a default `EvalSuiteConfig` object (from `@elsium-ai/testing`) containing a `name`, an array of `cases`, and a `runner` function.
119
+
120
+ **Usage**
121
+
122
+ ```
123
+ elsium eval <file>
34
124
  ```
35
125
 
126
+ **Arguments**
127
+
128
+ | Argument | Required | Description |
129
+ | --- | --- | --- |
130
+ | `file` | Yes | Path to the eval suite file (e.g. `./evals/quality.eval.ts`) |
131
+
132
+ Running `elsium eval` without a file argument prints usage instructions and an example `EvalSuiteConfig`.
133
+
134
+ Each case in the suite can specify criteria such as:
135
+
136
+ - `{ type: 'contains', value: 'expected substring' }`
137
+ - `{ type: 'length_min', value: 20 }`
138
+
139
+ The command dynamically imports `runEvalSuite` and `formatEvalReport` from `@elsium-ai/testing`, runs all cases, prints a formatted report, and exits with code `1` if any case fails.
140
+
141
+ **Example**
142
+
143
+ ```bash
144
+ # Run quality evaluations
145
+ elsium eval ./evals/quality.eval.ts
146
+
147
+ # Run determinism evaluations
148
+ elsium eval ./evals/determinism.eval.ts
149
+ ```
150
+
151
+ ---
152
+
153
+ ### `elsium cost`
154
+
155
+ Displays a formatted cost report from the last application run. The report is read from `.elsium/cost-report.json`, which is generated automatically when your app runs with cost tracking enabled.
156
+
157
+ **Usage**
158
+
159
+ ```
160
+ elsium cost
161
+ ```
162
+
163
+ This command takes no arguments or flags. If no cost report file exists, it prints instructions on how to enable cost tracking in your app configuration.
164
+
165
+ The report includes:
166
+
167
+ - Total cost (USD)
168
+ - Total tokens (input + output breakdown)
169
+ - Total API call count
170
+ - Per-model breakdown (cost, tokens, calls)
171
+
172
+ **Example**
173
+
174
+ ```bash
175
+ elsium cost
176
+ ```
177
+
178
+ Output:
179
+
180
+ ```
181
+ ElsiumAI Cost Report
182
+ ──────────────────────────────────────────────────
183
+ Generated: 2026-01-15T10:30:00.000Z
184
+
185
+ Total Cost: $0.003450
186
+ Total Tokens: 1,250
187
+ Input Tokens: 800
188
+ Output Tokens: 450
189
+ Total API Calls: 3
190
+
191
+ By Model:
192
+ ──────────────────────────────────────────────────
193
+ claude-sonnet-4-6
194
+ Cost: $0.002100
195
+ Tokens: 750
196
+ Calls: 2
197
+ claude-haiku-4-5
198
+ Cost: $0.001350
199
+ Tokens: 500
200
+ Calls: 1
201
+ ```
202
+
203
+ To enable cost tracking, configure your app:
204
+
205
+ ```typescript
206
+ const app = createApp({
207
+ observe: {
208
+ costTracking: true,
209
+ },
210
+ })
211
+ ```
212
+
213
+ ---
214
+
215
+ ### `elsium trace`
216
+
217
+ Lists recent traces or inspects a specific trace in detail. Traces are stored as JSON files in `.elsium/traces/` and are recorded when tracing is enabled in your app configuration.
218
+
219
+ **Usage**
220
+
221
+ ```
222
+ elsium trace # List up to 20 recent traces
223
+ elsium trace <id> # Inspect a specific trace by ID
224
+ ```
225
+
226
+ **Arguments**
227
+
228
+ | Argument | Required | Description |
229
+ | --- | --- | --- |
230
+ | `id` | No | Trace ID to inspect. If omitted, lists recent traces. |
231
+
232
+ When listing traces, each entry shows its status (`OK`, `ERR`, or `...`), trace ID, root span name, and duration.
233
+
234
+ When inspecting a single trace, the command renders a full span tree showing:
235
+
236
+ - Span kind, name, status, and duration
237
+ - Metadata key-value pairs
238
+ - Events with timestamps and optional data
239
+
240
+ **Example**
241
+
242
+ ```bash
243
+ # List recent traces
244
+ elsium trace
245
+
246
+ # Inspect a specific trace
247
+ elsium trace trc_abc123
248
+ ```
249
+
250
+ To enable tracing, configure your app:
251
+
252
+ ```typescript
253
+ const app = createApp({
254
+ observe: {
255
+ tracing: true,
256
+ },
257
+ })
258
+ ```
259
+
260
+ ---
261
+
262
+ ### `elsium xray`
263
+
264
+ Inspects raw LLM call details including HTTP requests, responses, token usage, and cost. X-Ray data is captured when X-Ray mode is enabled on your gateway and stored in `.elsium/xray-history.json`.
265
+
266
+ **Usage**
267
+
268
+ ```
269
+ elsium xray # Show the last call
270
+ elsium xray --last N # Show the last N calls
271
+ elsium xray --trace <id> # Show a specific call by trace ID
272
+ elsium xray --raw # Include full request/response bodies
273
+ ```
274
+
275
+ **Flags**
276
+
277
+ | Flag | Description |
278
+ | --- | --- |
279
+ | `--last N` | Show the last N calls (default: 5 when flag is present, 1 otherwise) |
280
+ | `--trace <id>` | Look up a specific call by its trace ID |
281
+ | `--raw` | Include full HTTP request and response details (headers, body) |
282
+ | `--help`, `-h` | Show help message |
283
+
284
+ Each entry displays: trace ID, timestamp, provider, model, latency, token usage (input/output/total), and cost. When `--raw` is passed, the full HTTP request (method, URL, headers, body) and response (status, headers, body) are also printed.
285
+
286
+ **Example**
287
+
288
+ ```bash
289
+ # Show the most recent LLM call
290
+ elsium xray
291
+
292
+ # Show the last 5 calls with full request/response bodies
293
+ elsium xray --last 5 --raw
294
+
295
+ # Look up a specific call
296
+ elsium xray --trace trc_abc123
297
+ ```
298
+
299
+ To enable X-Ray mode, configure your gateway:
300
+
301
+ ```typescript
302
+ const gw = gateway({ provider: 'anthropic', apiKey: '...', xray: true })
303
+ ```
304
+
305
+ ---
306
+
307
+ ### `elsium prompt`
308
+
309
+ Manages versioned prompts stored as JSON files in `.elsium/prompts/`. Provides subcommands to list, inspect, compare, and view the history of prompt versions.
310
+
311
+ **Usage**
312
+
313
+ ```
314
+ elsium prompt list # List all registered prompts
315
+ elsium prompt show <name> [version] # Show prompt content (latest if version omitted)
316
+ elsium prompt history <name> # Show version history for a prompt
317
+ elsium prompt diff <name> <v1> <v2> # Show a line-by-line diff between two versions
318
+ ```
319
+
320
+ **Subcommands**
321
+
322
+ | Subcommand | Arguments | Description |
323
+ | --- | --- | --- |
324
+ | `list` | None | List all prompts with their version counts |
325
+ | `show` | `<name> [version]` | Display prompt content; defaults to the latest version |
326
+ | `history` | `<name>` | Show all versions of a prompt sorted chronologically |
327
+ | `diff` | `<name> <v1> <v2>` | Line-by-line diff between two prompt versions |
328
+
329
+ Prompt files are JSON objects with the following shape:
330
+
331
+ ```json
332
+ {
333
+ "name": "greeting",
334
+ "version": "1.0",
335
+ "content": "Hello {{user_name}}, how can I help you today?",
336
+ "variables": ["user_name"],
337
+ "metadata": {}
338
+ }
339
+ ```
340
+
341
+ **Example**
342
+
343
+ ```bash
344
+ # List all prompts
345
+ elsium prompt list
346
+
347
+ # Show the latest version of a prompt
348
+ elsium prompt show greeting
349
+
350
+ # Show a specific version
351
+ elsium prompt show greeting 1.0
352
+
353
+ # Compare two versions
354
+ elsium prompt diff greeting 1.0 2.0
355
+
356
+ # View version history
357
+ elsium prompt history greeting
358
+ ```
359
+
360
+ ---
361
+
362
+ ## Programmatic API
363
+
364
+ The package exports each command function for use in custom tooling, scripts, or programmatic integrations. All exports are available from the package entry point.
365
+
366
+ ```typescript
367
+ import {
368
+ initCommand,
369
+ devCommand,
370
+ evalCommand,
371
+ costCommand,
372
+ traceCommand,
373
+ } from '@elsium-ai/cli'
374
+ ```
375
+
376
+ ### `initCommand`
377
+
378
+ ```typescript
379
+ function initCommand(args: string[]): Promise<void>
380
+ ```
381
+
382
+ Scaffolds a new ElsiumAI project. Pass the project name as the first element of `args`, or omit it to default to `"my-elsium-app"`.
383
+
384
+ ```typescript
385
+ import { initCommand } from '@elsium-ai/cli'
386
+
387
+ await initCommand(['my-ai-app'])
388
+ ```
389
+
390
+ ### `devCommand`
391
+
392
+ ```typescript
393
+ function devCommand(args: string[]): Promise<void>
394
+ ```
395
+
396
+ Starts the development server with hot reload. Pass a custom entry file path as the first element of `args`, or omit it to default to `"src/index.ts"`.
397
+
398
+ ```typescript
399
+ import { devCommand } from '@elsium-ai/cli'
400
+
401
+ await devCommand(['src/server.ts'])
402
+ ```
403
+
404
+ ### `evalCommand`
405
+
406
+ ```typescript
407
+ function evalCommand(args: string[]): Promise<void>
408
+ ```
409
+
410
+ Runs an evaluation suite. The first element of `args` must be the path to an eval file exporting a default `EvalSuiteConfig`. If no file is provided, prints usage information.
411
+
412
+ ```typescript
413
+ import { evalCommand } from '@elsium-ai/cli'
414
+
415
+ await evalCommand(['./evals/quality.eval.ts'])
416
+ ```
417
+
418
+ ### `costCommand`
419
+
420
+ ```typescript
421
+ function costCommand(args: string[]): Promise<void>
422
+ ```
423
+
424
+ Reads and displays the cost report from `.elsium/cost-report.json`. The `args` parameter is accepted for interface consistency but is currently unused.
425
+
426
+ ```typescript
427
+ import { costCommand } from '@elsium-ai/cli'
428
+
429
+ await costCommand([])
430
+ ```
431
+
432
+ ### `traceCommand`
433
+
434
+ ```typescript
435
+ function traceCommand(args: string[]): Promise<void>
436
+ ```
437
+
438
+ Lists recent traces when called with an empty `args` array, or inspects a specific trace when a trace ID is provided as the first element.
439
+
440
+ ```typescript
441
+ import { traceCommand } from '@elsium-ai/cli'
442
+
443
+ // List recent traces
444
+ await traceCommand([])
445
+
446
+ // Inspect a specific trace
447
+ await traceCommand(['trc_abc123'])
448
+ ```
449
+
450
+ ---
451
+
36
452
  ## Part of ElsiumAI
37
453
 
38
454
  This package is the CLI for the [ElsiumAI](https://github.com/elsium-ai/elsium-ai) framework. See the [full documentation](https://github.com/elsium-ai/elsium-ai) for guides and examples.
39
455
 
456
+ Other packages in the framework:
457
+
458
+ - [`@elsium-ai/core`](https://www.npmjs.com/package/@elsium-ai/core) -- Runtime, policies, and utilities
459
+ - [`@elsium-ai/gateway`](https://www.npmjs.com/package/@elsium-ai/gateway) -- Multi-provider LLM gateway
460
+ - [`@elsium-ai/agents`](https://www.npmjs.com/package/@elsium-ai/agents) -- Agent definitions and execution
461
+ - [`@elsium-ai/tools`](https://www.npmjs.com/package/@elsium-ai/tools) -- Tool schemas and handlers
462
+ - [`@elsium-ai/workflows`](https://www.npmjs.com/package/@elsium-ai/workflows) -- Multi-step workflow orchestration
463
+ - [`@elsium-ai/observe`](https://www.npmjs.com/package/@elsium-ai/observe) -- Tracing, cost tracking, and observability
464
+ - [`@elsium-ai/testing`](https://www.npmjs.com/package/@elsium-ai/testing) -- Mocks, replay, and evaluation harness
465
+ - [`@elsium-ai/app`](https://www.npmjs.com/package/@elsium-ai/app) -- Application bootstrap and server
466
+
40
467
  ## License
41
468
 
42
469
  [MIT](https://github.com/elsium-ai/elsium-ai/blob/main/LICENSE)
package/dist/cli.js CHANGED
@@ -1577,8 +1577,8 @@ async function initCommand(args) {
1577
1577
  console.log(" Next steps:");
1578
1578
  console.log(` cd ${projectName}`);
1579
1579
  console.log(" cp .env.example .env # add your API keys");
1580
- console.log(" bun install");
1581
- console.log(" bun run dev");
1580
+ console.log(" npm install");
1581
+ console.log(" npm run dev");
1582
1582
  console.log();
1583
1583
  }
1584
1584
  function packageJsonContent(projectName) {
@@ -1902,20 +1902,20 @@ Built with [ElsiumAI](https://github.com/elsium-ai/elsium-ai).
1902
1902
 
1903
1903
  \`\`\`bash
1904
1904
  cp .env.example .env # add your API keys
1905
- bun install
1906
- bun run dev
1905
+ npm install
1906
+ npm run dev
1907
1907
  \`\`\`
1908
1908
 
1909
1909
  ## Scripts
1910
1910
 
1911
1911
  | Command | Description |
1912
1912
  | --- | --- |
1913
- | \`bun run dev\` | Start the dev server |
1914
- | \`bun run test\` | Run unit tests |
1915
- | \`bun run eval\` | Run quality eval suite |
1916
- | \`bun run eval:determinism\` | Run determinism eval |
1917
- | \`bun run lint\` | Lint with Biome |
1918
- | \`bun run format\` | Auto-format with Biome |
1913
+ | \`npm run dev\` | Start the dev server |
1914
+ | \`npm run test\` | Run unit tests |
1915
+ | \`npm run eval\` | Run quality eval suite |
1916
+ | \`npm run eval:determinism\` | Run determinism eval |
1917
+ | \`npm run lint\` | Lint with Biome |
1918
+ | \`npm run format\` | Auto-format with Biome |
1919
1919
 
1920
1920
  ## Project structure
1921
1921
 
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@elsium-ai/cli",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "CLI tool for ElsiumAI projects",
5
5
  "license": "MIT",
6
6
  "author": "Eric Utrera <ebutrera9103@gmail.com>",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "https://github.com/elsium-ai/elsium-ai",
9
+ "url": "git+https://github.com/elsium-ai/elsium-ai.git",
10
10
  "directory": "packages/cli"
11
11
  },
12
12
  "type": "module",
@@ -24,8 +24,8 @@
24
24
  "dev": "bun --watch src/cli.ts"
25
25
  },
26
26
  "dependencies": {
27
- "@elsium-ai/core": "^0.2.1",
28
- "@elsium-ai/observe": "^0.2.1"
27
+ "@elsium-ai/core": "^0.2.2",
28
+ "@elsium-ai/observe": "^0.2.2"
29
29
  },
30
30
  "devDependencies": {
31
31
  "typescript": "^5.7.0"