@formant/formant-cli 0.1.0 → 0.3.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.
Files changed (56) hide show
  1. package/README.md +380 -116
  2. package/dist/base-command.d.ts +5 -0
  3. package/dist/base-command.js +9 -0
  4. package/dist/base-command.js.map +1 -1
  5. package/dist/commands/devices/create.d.ts +13 -0
  6. package/dist/commands/devices/create.js +62 -0
  7. package/dist/commands/devices/create.js.map +1 -0
  8. package/dist/commands/devices/delete.d.ts +10 -0
  9. package/dist/commands/devices/delete.js +49 -0
  10. package/dist/commands/devices/delete.js.map +1 -0
  11. package/dist/commands/devices/rename.d.ts +11 -0
  12. package/dist/commands/devices/rename.js +42 -0
  13. package/dist/commands/devices/rename.js.map +1 -0
  14. package/dist/commands/devices/tag.d.ts +13 -0
  15. package/dist/commands/devices/tag.js +69 -0
  16. package/dist/commands/devices/tag.js.map +1 -0
  17. package/dist/commands/devices/untag.d.ts +13 -0
  18. package/dist/commands/devices/untag.js +79 -0
  19. package/dist/commands/devices/untag.js.map +1 -0
  20. package/dist/commands/ingest/batch.d.ts +21 -0
  21. package/dist/commands/ingest/batch.js +170 -0
  22. package/dist/commands/ingest/batch.js.map +1 -0
  23. package/dist/commands/ingest/bitset.d.ts +15 -0
  24. package/dist/commands/ingest/bitset.js +128 -0
  25. package/dist/commands/ingest/bitset.js.map +1 -0
  26. package/dist/commands/ingest/health.d.ts +15 -0
  27. package/dist/commands/ingest/health.js +94 -0
  28. package/dist/commands/ingest/health.js.map +1 -0
  29. package/dist/commands/ingest/image.d.ts +15 -0
  30. package/dist/commands/ingest/image.js +99 -0
  31. package/dist/commands/ingest/image.js.map +1 -0
  32. package/dist/commands/ingest/json.d.ts +16 -0
  33. package/dist/commands/ingest/json.js +92 -0
  34. package/dist/commands/ingest/json.js.map +1 -0
  35. package/dist/commands/ingest/numeric.d.ts +16 -0
  36. package/dist/commands/ingest/numeric.js +83 -0
  37. package/dist/commands/ingest/numeric.js.map +1 -0
  38. package/dist/commands/ingest/text.d.ts +16 -0
  39. package/dist/commands/ingest/text.js +80 -0
  40. package/dist/commands/ingest/text.js.map +1 -0
  41. package/dist/commands/ingest/video.d.ts +16 -0
  42. package/dist/commands/ingest/video.js +120 -0
  43. package/dist/commands/ingest/video.js.map +1 -0
  44. package/dist/commands/org/get.d.ts +7 -0
  45. package/dist/commands/org/get.js +54 -0
  46. package/dist/commands/org/get.js.map +1 -0
  47. package/dist/commands/org/update.d.ts +11 -0
  48. package/dist/commands/org/update.js +75 -0
  49. package/dist/commands/org/update.js.map +1 -0
  50. package/dist/help.js +103 -53
  51. package/dist/help.js.map +1 -1
  52. package/dist/lib/api.d.ts +1 -1
  53. package/dist/lib/api.js +3 -0
  54. package/dist/lib/api.js.map +1 -1
  55. package/oclif.manifest.json +1861 -612
  56. package/package.json +7 -1
package/README.md CHANGED
@@ -9,21 +9,97 @@
9
9
  ╚═╝ ╚═════╝╚══════╝╚═╝
10
10
  ```
11
11
 
12
- The official command-line interface for [Formant](https://formant.io) — manage your robot fleet, query telemetry, trigger investigations, and more, all from your terminal.
12
+ **The official command-line interface for [Formant](https://formant.io) — a cloud platform for monitoring, operating, and analyzing robot fleets at scale.**
13
+
14
+ Formant helps robotics teams observe, troubleshoot, and control their robots in production. With `fcli`, you can manage your entire fleet from the terminal: query telemetry, trigger AI-powered investigations, send remote commands, manage users and permissions, and automate workflows.
15
+
16
+ ## What is Formant?
17
+
18
+ [Formant](https://formant.io) is a cloud observability and operations platform designed specifically for robotics. It provides:
19
+
20
+ - **Real-time monitoring** — Live telemetry streams (battery, sensors, cameras, logs) from all your robots
21
+ - **Event tracking** — Automatic detection and alerting of critical issues (crashes, errors, anomalies)
22
+ - **AI-powered investigations** — Intelligent root cause analysis that diagnoses problems automatically
23
+ - **Remote operations** — Send commands, trigger actions, and control robots from anywhere
24
+ - **Fleet management** — Organize devices by location, type, or purpose; manage user permissions
25
+ - **Analytics & reporting** — Query historical data with SQL to understand performance trends
13
26
 
14
27
  ## Features
15
28
 
16
- - 📋 **Device Management** List, inspect, and configure robots and sensors
17
- - 📊 **Telemetry Queries** — Retrieve battery, temperature, and sensor data
18
- - 🔍 **Event Monitoring** — View and filter device events by severity
19
- - 🤖 **AI Investigations** — Trigger and monitor AI-powered analysis workflows
20
- - 📡 **Signal Management** Track and trace investigation signals
21
- - 💬 **Command Execution** Send commands to devices
22
- - 🚨 **Event Triggers** — Configure rules that generate events and signals
23
- - 👥 **User & Fleet Management** — Manage users, teams, and device groups
24
- - 📅 **Scheduled Tasks** — Set up recurring jobs and one-time schedules
25
- - 📈 **Analytics** Execute SQL queries against analytics data
26
- - 🗂️ **Key-Value Store** Manage device metadata
29
+ This CLI provides programmatic access to all Formant capabilities:
30
+
31
+ ### 🤖 Device Management
32
+ - List, create, rename, and delete robots/sensors
33
+ - Add tags for organization (environment, location, customer)
34
+ - View real-time device status and configuration
35
+ - List available telemetry streams
36
+
37
+ ### 📊 Telemetry Queries
38
+ - Query historical sensor data (battery, temperature, position, custom metrics)
39
+ - Retrieve latest values for any stream
40
+ - Filter by time range and device
41
+ - Export data as JSON for analysis
42
+
43
+ ### 📤 Telemetry Ingestion
44
+ - Send numeric, text, JSON, image, video, bitset, and health data to devices
45
+ - Add tags and custom timestamps to telemetry points
46
+ - Batch upload multiple data points in a single request
47
+ - Programmatically populate device streams from scripts and automation
48
+
49
+ ### 🔍 Event Monitoring
50
+ - View events filtered by severity (info, warning, critical, error)
51
+ - Track device online/offline status
52
+ - Investigate alert history for troubleshooting
53
+ - Filter events by device, time range, or type
54
+
55
+ ### 🤖 AI Investigations
56
+ - List available investigation workflows
57
+ - Trigger investigations manually or on-demand
58
+ - View investigation runs, execution logs, and results
59
+ - Get investigation statistics and success rates
60
+ - Trace investigations back to their triggering signals
61
+
62
+ ### 📡 Signal Management
63
+ - List and query signals (investigation triggers)
64
+ - Count signals by type
65
+ - Trace the workflow: Signal → Investigation → Run → Result
66
+ - Understand what triggered each investigation
67
+
68
+ ### 💬 Remote Commands
69
+ - List available command templates for your fleet
70
+ - Send commands to individual devices with parameters
71
+ - View command execution history
72
+ - Check command delivery status
73
+
74
+ ### 🚨 Event Triggers (Automation)
75
+ - View configured trigger rules
76
+ - Understand what conditions create events and signals
77
+ - See trigger configuration (thresholds, exit conditions, device scope)
78
+
79
+ ### 👥 User & Organization Management
80
+ - View organization details (plan, retention, support tier)
81
+ - Update organization name and description
82
+ - List all users and their roles
83
+ - Inspect user permissions and account status
84
+
85
+ ### 🚀 Fleet & Group Management
86
+ - Create logical groups of devices (by location, project, customer)
87
+ - List all fleets and their member devices
88
+ - Organize your fleet for easier management
89
+
90
+ ### 📅 Scheduled Tasks
91
+ - View scheduled investigations and commands
92
+ - Understand recurring workflows and automation
93
+
94
+ ### 📈 Analytics & SQL
95
+ - Execute custom SQL queries against your analytics database
96
+ - List available tables and schemas
97
+ - Analyze fleet performance, uptime, and trends
98
+
99
+ ### 🗂️ Key-Value Metadata Store
100
+ - Store custom metadata per device
101
+ - Retrieve configuration values
102
+ - Update device-specific settings
27
103
 
28
104
  ## Installation
29
105
 
@@ -45,120 +121,258 @@ yarn global add @formant/formant-cli
45
121
  pnpm add -g @formant/formant-cli
46
122
  ```
47
123
 
124
+ After installation, verify it works:
125
+
126
+ ```bash
127
+ fcli --help
128
+ ```
129
+
48
130
  ## Authentication
49
131
 
50
- Set your Formant credentials as environment variables:
132
+ Formant CLI uses **service account credentials** for authentication. You'll need to create a service account in your Formant organization first.
133
+
134
+ ### Creating a Service Account
135
+
136
+ 1. Log in to [Formant](https://app.formant.io)
137
+ 2. Go to **Settings** → **Users**
138
+ 3. Click **Create Service Account**
139
+ 4. Copy the generated email and password
140
+
141
+ ### Setting Credentials
142
+
143
+ Set your credentials as environment variables:
51
144
 
52
145
  ```bash
53
- export FORMANT_USER="your-service-account@example.com"
146
+ export FORMANT_USER="your-service-account@org.iam.formant.io"
54
147
  export FORMANT_PASSWORD="your-password"
55
148
  ```
56
149
 
57
150
  Or create a `.env` file in your project:
58
151
 
59
152
  ```env
60
- FORMANT_USER=your-service-account@example.com
153
+ FORMANT_USER=your-service-account@org.iam.formant.io
61
154
  FORMANT_PASSWORD=your-password
62
155
  ```
63
156
 
157
+ The CLI will automatically load credentials from your `.env` file.
158
+
64
159
  ## Quick Start
65
160
 
66
161
  ```bash
67
- # View help
68
- fcli --help
162
+ # View your organization
163
+ fcli org get
69
164
 
70
- # List all devices in dev environment
165
+ # List all devices
71
166
  fcli devices list --dev
72
167
 
73
168
  # Get device details
74
169
  fcli devices get <device-id> --dev
75
170
 
76
- # Query battery telemetry
77
- fcli query --device <device-id> --stream battery_level --start 2026-01-01 --end 2026-01-02 --dev
171
+ # Query battery telemetry over the last day
172
+ fcli query --device <device-id> --stream battery_level \
173
+ --start 2026-02-17 --end 2026-02-18 --dev
78
174
 
79
- # View recent events
80
- fcli events list --device <device-id> --severity critical --limit 20 --dev
175
+ # View recent critical events
176
+ fcli events list --severity critical --limit 20 --dev
81
177
 
82
- # List investigations
178
+ # List all investigations
83
179
  fcli investigations list --dev
84
180
 
85
- # Send a command to a device
181
+ # Send a command to a robot
86
182
  fcli commands send <device-id> <template-id> --param speed=5 --dev
87
183
  ```
88
184
 
89
- ## Commands
185
+ ## Command Reference
186
+
187
+ ### Organization
188
+
189
+ Manage your Formant account settings.
190
+
191
+ ```bash
192
+ fcli org get # View organization details
193
+ fcli org update --name "Acme Robotics" # Update organization name
194
+ fcli org update --description "Production fleet" # Update description
195
+ ```
90
196
 
91
197
  ### Devices
92
198
 
93
- Manage robots and sensors in your fleet.
199
+ Create, list, and manage robots/sensors in your fleet.
94
200
 
95
201
  ```bash
96
- fcli devices list [--tag <key>=<value>] [--online] [--dev]
97
- fcli devices get <device-id> [--dev]
98
- fcli devices config <device-id> [--dev]
99
- fcli devices streams <device-id> [--dev]
100
- fcli devices last-seen <device-id> [--dev]
202
+ # Listing and filtering
203
+ fcli devices list # List all devices
204
+ fcli devices list --online # Only online devices
205
+ fcli devices list --tag location=warehouse # Filter by tag
206
+
207
+ # Device details
208
+ fcli devices get <device-id> # Get full device details
209
+ fcli devices config <device-id> # Get device configuration
210
+ fcli devices streams <device-id> # List available data streams
211
+ fcli devices last-seen <device-id> # Get last activity timestamp
212
+
213
+ # Device management
214
+ fcli devices create --name "robot-001" # Create a new device
215
+ fcli devices rename <device-id> --name "new-name" # Rename a device
216
+ fcli devices delete <device-id> # Delete (disable) a device
217
+
218
+ # Tagging
219
+ fcli devices tag <device-id> --key env --value prod # Add/update tag
220
+ fcli devices untag <device-id> --key env # Remove tag
101
221
  ```
102
222
 
103
223
  ### Events
104
224
 
105
- View important events emitted by devices.
225
+ View and filter important events emitted by your devices.
106
226
 
107
227
  ```bash
108
- fcli events list [--device <id>] [--severity <level>] [--limit <n>] [--dev]
109
- fcli events get <event-id> [--dev]
228
+ fcli events list # List all recent events
229
+ fcli events list --device <device-id> # Events for one device
230
+ fcli events list --severity critical # Filter by severity
231
+ fcli events list --limit 50 # Limit results
232
+ fcli events list --start 2026-01-01 # Filter by date range
233
+ fcli events get <event-id> # Get event details
110
234
  ```
111
235
 
236
+ **Severity levels:** `info`, `warning`, `error`, `critical`
237
+
112
238
  ### Query
113
239
 
114
- Retrieve telemetry and sensor data from devices.
240
+ Retrieve historical telemetry and sensor data.
115
241
 
116
242
  ```bash
117
- fcli query --device <id> --stream <name> --start <date> --end <date> [--dev]
118
- fcli query latest-values --device <id> --stream <name> [--dev]
243
+ # Historical data
244
+ fcli query --device <device-id> --stream battery_level \
245
+ --start 2026-01-01 --end 2026-01-02
246
+
247
+ # Latest values
248
+ fcli query latest-values --device <device-id> --stream battery_level
249
+
250
+ # Common streams: battery_level, temperature, cpu_usage, memory_usage, location
251
+ ```
252
+
253
+ ### Ingest
254
+
255
+ Send telemetry data to devices via the Formant ingestion API.
256
+
257
+ ```bash
258
+ # Numeric data
259
+ fcli ingest numeric 42.5 --device <device-id> --stream battery_level
260
+ fcli ingest numeric 23.8 --device <device-id> --stream temperature --tag location=warehouse
261
+
262
+ # Text data
263
+ fcli ingest text "System operational" --device <device-id> --stream status
264
+ fcli ingest text "Low battery warning" --device <device-id> --stream alerts --tag severity=warning
265
+
266
+ # JSON data
267
+ fcli ingest json '{"x":10,"y":20}' --device <device-id> --stream position
268
+ fcli ingest json '{"speed":15,"heading":90}' --device <device-id> --stream nav_data
269
+
270
+ # Image data
271
+ fcli ingest image https://example.com/camera.jpg --device <device-id> --stream camera_front
272
+ fcli ingest image https://example.com/image.jpg --device <device-id> --stream camera --size 102400
273
+
274
+ # Video data
275
+ fcli ingest video https://example.com/recording.mp4 --device <device-id> --stream camera_feed --duration 30000
276
+ fcli ingest video https://cdn.example.com/video.webm --device <device-id> --stream video --duration 15000 --mime-type video/webm
277
+
278
+ # Bitset data (multiple boolean key-value pairs)
279
+ fcli ingest bitset --device <device-id> --stream sensors \
280
+ --keys motor_on,door_open,battery_charging \
281
+ --values true,false,true
282
+
283
+ # Health status
284
+ fcli ingest health --device <device-id> --stream health_status --status operational
285
+ fcli ingest health --device <device-id> --stream health --status error --clock-skew 1500
286
+
287
+ # Batch ingestion (multiple items from JSON file or stdin)
288
+ fcli ingest batch --file payload.json
289
+ cat batch.json | fcli ingest batch --stdin
290
+ ```
291
+
292
+ **Common flags for all ingest commands:**
293
+ - `--device <id>` - Target device ID (required)
294
+ - `--stream <name>` - Stream name (required)
295
+ - `--tag key=value` - Add tags as string key-value pairs (repeatable: `--tag env=prod --tag region=us-west`)
296
+ - `--timestamp <ms>` - Unix timestamp in milliseconds (defaults to current time)
297
+
298
+ **Health status values:** `unknown`, `operational`, `offline`, `error`
299
+
300
+ **Batch format example** (`payload.json`):
301
+ ```json
302
+ {
303
+ "items": [
304
+ {
305
+ "deviceId": "abc-123",
306
+ "name": "battery_level",
307
+ "type": "numeric",
308
+ "tags": {"env": "prod"},
309
+ "points": [[1642867200000, 42.5]]
310
+ },
311
+ {
312
+ "deviceId": "abc-123",
313
+ "name": "status",
314
+ "type": "text",
315
+ "tags": {"env": "prod"},
316
+ "points": [[1642867200000, "operational"]]
317
+ }
318
+ ]
319
+ }
119
320
  ```
120
321
 
322
+ **Note:** The `tags` field is optional and contains string key-value pairs only. Use `"tags": {}` if no tags are needed.
323
+
121
324
  ### Investigations
122
325
 
123
- Run and monitor AI-powered analysis workflows.
326
+ Trigger and monitor AI-powered analysis workflows that diagnose device issues.
124
327
 
125
328
  ```bash
126
- fcli investigations list [--dev]
127
- fcli investigations get <investigation-id> [--dev]
128
- fcli investigations stats [--start <date>] [--end <date>] [--dev]
129
- fcli investigations runs-list <investigation-id> [--dev]
130
- fcli investigations run <investigation-id> <run-id> [--trace-signal] [--dev]
131
- fcli investigations trigger <investigation-id> <device-id> [--dev]
132
- fcli investigations analytics <investigation-id> [--dev]
329
+ # Listing
330
+ fcli investigations list # List all investigations
331
+ fcli investigations get <investigation-id> # Get investigation details
332
+
333
+ # Triggering
334
+ fcli investigations trigger <inv-id> <device-id> # Start an investigation
335
+
336
+ # Runs
337
+ fcli investigations runs <investigation-id> # List all runs
338
+ fcli investigations run <inv-id> <run-id> # Get run details & logs
339
+ fcli investigations run <inv-id> <run-id> --trace-signal # Trace back to signal
340
+
341
+ # Analytics
342
+ fcli investigations stats --start 2026-01-01 # Get metrics
343
+ fcli investigations analytics <investigation-id> # Get investigation analytics
133
344
  ```
134
345
 
135
346
  ### Signals
136
347
 
137
- Manage signals (points of interest that trigger analysis).
348
+ Signals are points of interest (from events, schedules, or manual triggers) that start investigations.
138
349
 
139
350
  ```bash
140
- fcli signals list [--start <date>] [--end <date>] [--dev]
351
+ fcli signals list # List all signals
352
+ fcli signals query --start 2026-01-01 --end 2026-02-01 # Query by time
353
+ fcli signals count # Count signals by type
354
+ fcli signals get <signal-id> # Get signal details
141
355
  ```
142
356
 
143
357
  ### Commands
144
358
 
145
- Manage command templates and send commands to devices.
359
+ Send remote commands to devices and view execution history.
146
360
 
147
361
  ```bash
148
- fcli commands list [--dev]
149
- fcli commands get <command-id> [--dev]
150
- fcli commands for-device <device-id> [--dev]
151
- fcli commands send <device-id> <template-id> [--param <key>=<value>] [--dev]
152
- fcli commands history <device-id> [--dev]
362
+ fcli commands list # List all command templates
363
+ fcli commands get <command-id> # Get template details
364
+ fcli commands for-device <device-id> # Commands available for device
365
+ fcli commands send <device-id> <template-id> --param key=value # Send command
366
+ fcli commands history <device-id> # View command history
153
367
  ```
154
368
 
155
369
  ### Event Triggers
156
370
 
157
- Manage event trigger rules that generate events and signals.
371
+ View automated trigger rules that generate events and signals based on device conditions.
158
372
 
159
373
  ```bash
160
- fcli event-triggers list [--dev]
161
- fcli event-triggers get <trigger-id> [--dev]
374
+ fcli event-triggers list # List all trigger rules
375
+ fcli event-triggers get <trigger-id> # Get trigger configuration
162
376
  ```
163
377
 
164
378
  ### Users
@@ -166,117 +380,163 @@ fcli event-triggers get <trigger-id> [--dev]
166
380
  Manage users in your organization.
167
381
 
168
382
  ```bash
169
- fcli users list [--dev]
170
- fcli users get <user-id> [--dev]
383
+ fcli users list # List all users
384
+ fcli users get <user-id> # Get user details
171
385
  ```
172
386
 
173
387
  ### Fleets
174
388
 
175
- Manage device groups (fleets).
389
+ Organize devices into logical groups (by location, type, project, customer).
176
390
 
177
391
  ```bash
178
- fcli fleets list [--dev]
179
- fcli fleets get <fleet-id> [--dev]
392
+ fcli fleets list # List all fleets
393
+ fcli fleets get <fleet-id> # Get fleet details
180
394
  ```
181
395
 
182
396
  ### Schedules
183
397
 
184
- Manage scheduled tasks and recurring jobs.
398
+ View recurring tasks and one-time scheduled jobs.
185
399
 
186
400
  ```bash
187
- fcli schedules list [--dev]
188
- fcli schedules get <schedule-id> [--dev]
401
+ fcli schedules list # List all schedules
402
+ fcli schedules get <schedule-id> # Get schedule details
189
403
  ```
190
404
 
191
405
  ### Analytics
192
406
 
193
- Execute SQL queries against analytics data.
407
+ Execute custom SQL queries against your Formant analytics database.
194
408
 
195
409
  ```bash
196
- fcli analytics query --sql "<query>" [--dev]
197
- fcli analytics tables [--dev]
410
+ fcli analytics tables # List available tables
411
+ fcli analytics query --sql "SELECT * FROM events WHERE severity='critical' LIMIT 10"
198
412
  ```
199
413
 
200
414
  ### Key-Value Store
201
415
 
202
- Manage key-value store for device metadata.
416
+ Store and retrieve custom metadata for devices.
203
417
 
204
418
  ```bash
205
- fcli kv list <device-id> [--dev]
206
- fcli kv get <device-id> <key> [--dev]
207
- fcli kv set <device-id> <key> <value> [--dev]
419
+ fcli kv list <device-id> # List all keys
420
+ fcli kv get <device-id> <key> # Get value
421
+ fcli kv set <device-id> <key> <value> # Set value
208
422
  ```
209
423
 
210
424
  ## Global Flags
211
425
 
212
- - `--dev` Target the dev environment
213
- - `--stage` — Target the stage environment
214
- - `--json` — Format output as JSON
215
- - `-h, --help` — Show help for a command
426
+ These flags work with any command:
216
427
 
217
- ## Environment Variables
428
+ - `--dev` — Target the dev environment (for testing)
429
+ - `--stage` — Target the stage environment (for staging)
430
+ - `--json` — Output raw JSON instead of formatted tables
431
+ - `-h, --help` — Show help for any command
218
432
 
219
- | Variable | Description | Required |
220
- |----------|-------------|----------|
221
- | `FORMANT_USER` | Service account email | Yes |
222
- | `FORMANT_PASSWORD` | Service account password | Yes |
433
+ **Default environment:** Production (unless `--dev` or `--stage` is specified)
223
434
 
224
- ## Examples
435
+ ## Output Formats
436
+
437
+ ### Table (default)
225
438
 
226
- ### List online devices with specific tag
439
+ Human-readable tables optimized for terminal viewing:
227
440
 
228
441
  ```bash
229
- fcli devices list --tag location=warehouse --online --dev
442
+ $ fcli devices list --dev
443
+
444
+ Devices (dev):
445
+
446
+ NAME ID STATUS TAGS
447
+ ────────────────────────────────────────────────────────────────────────
448
+ robot-001 a1b2c3d4-... online env=prod, location=warehouse
449
+ robot-002 e5f6g7h8-... offline env=dev
230
450
  ```
231
451
 
232
- ### Query telemetry data over a time range
452
+ ### JSON
453
+
454
+ Machine-readable JSON for scripting and automation:
233
455
 
234
456
  ```bash
235
- fcli query --device abc123 --stream battery_level \
236
- --start 2026-01-01 --end 2026-01-02 --dev --json
457
+ $ fcli devices list --dev --json
458
+ {
459
+ "items": [
460
+ {
461
+ "id": "a1b2c3d4-...",
462
+ "name": "robot-001",
463
+ "online": true,
464
+ "tags": {
465
+ "env": "prod",
466
+ "location": "warehouse"
467
+ }
468
+ }
469
+ ]
470
+ }
237
471
  ```
238
472
 
239
- ### Trace an investigation back to its signal
473
+ Use with `jq` for advanced processing:
240
474
 
241
475
  ```bash
242
- # Get investigation run
243
- fcli investigations run <investigation-id> <run-id> --trace-signal --dev
244
-
245
- # Get the signal details
246
- fcli signals get <signal-id> --dev
476
+ fcli devices list --json | jq '.items[] | select(.online==true) | .name'
247
477
  ```
248
478
 
249
- ### Monitor critical events
479
+ ## Examples
480
+
481
+ ### Monitor fleet health
250
482
 
251
483
  ```bash
252
- fcli events list --severity critical --limit 50 --dev
484
+ # Check which devices are offline
485
+ fcli devices list --json | jq '.items[] | select(.online==false) | .name'
486
+
487
+ # View recent critical events across the fleet
488
+ fcli events list --severity critical --limit 50
489
+
490
+ # Check battery levels
491
+ for device in $(fcli devices list --json | jq -r '.items[].id'); do
492
+ echo "Device: $device"
493
+ fcli query latest-values --device $device --stream battery_level
494
+ done
253
495
  ```
254
496
 
255
- ### Send a command with parameters
497
+ ### Investigate a device issue
256
498
 
257
499
  ```bash
258
- fcli commands send device-123 template-456 \
259
- --param speed=10 \
260
- --param direction=forward \
261
- --dev
262
- ```
500
+ # 1. View recent events for the device
501
+ fcli events list --device <device-id> --limit 20
263
502
 
264
- ## Output Formats
503
+ # 2. Check what investigations have run
504
+ fcli investigations runs <investigation-id>
265
505
 
266
- ### Table (default)
506
+ # 3. Get detailed logs for a specific run
507
+ fcli investigations run <inv-id> <run-id>
508
+
509
+ # 4. Query relevant telemetry
510
+ fcli query --device <device-id> --stream temperature \
511
+ --start 2026-02-17T10:00:00Z --end 2026-02-17T12:00:00Z
512
+ ```
267
513
 
268
- Human-readable tables for terminal viewing:
514
+ ### Automate fleet operations
269
515
 
270
516
  ```bash
271
- fcli devices list --dev
517
+ # Tag all production devices
518
+ for device in $(fcli devices list --json | jq -r '.items[].id'); do
519
+ fcli devices tag $device --key environment --value production
520
+ done
521
+
522
+ # Send command to all devices in a fleet
523
+ for device in $(fcli fleets get <fleet-id> --json | jq -r '.devices[].id'); do
524
+ fcli commands send $device <template-id> --param mode=standby
525
+ done
272
526
  ```
273
527
 
274
- ### JSON
275
-
276
- Machine-readable JSON for scripting and automation:
528
+ ### Export data for analysis
277
529
 
278
530
  ```bash
279
- fcli devices list --dev --json | jq '.items[] | .name'
531
+ # Export all critical events to JSON
532
+ fcli events list --severity critical --limit 1000 --json > critical_events.json
533
+
534
+ # Export device list with tags
535
+ fcli devices list --json | jq '.items[] | {name, id, tags}' > devices.json
536
+
537
+ # Query analytics and save results
538
+ fcli analytics query --sql "SELECT * FROM events WHERE created_at > '2026-01-01'" \
539
+ --json > analytics_export.json
280
540
  ```
281
541
 
282
542
  ## Development
@@ -296,27 +556,31 @@ npm run build
296
556
  npm run dev -- devices list --dev
297
557
  ```
298
558
 
299
- ### Build and pack
559
+ ### Run directly
300
560
 
301
561
  ```bash
302
- npm run prepack
562
+ ./bin/run.js --help
303
563
  ```
304
564
 
305
565
  ## Requirements
306
566
 
307
- - Node.js >= 18.0.0
308
- - A Formant service account with appropriate permissions
567
+ - **Node.js** >= 18.0.0
568
+ - A **Formant account** with service account credentials
569
+ - Appropriate **permissions** for the operations you want to perform
309
570
 
310
- ## Support
571
+ ## Support & Resources
311
572
 
312
- - Documentation: [https://formant.io/docs](https://formant.io/docs)
313
- - Support: [support@formant.io](mailto:support@formant.io)
314
- - Issues: [https://github.com/FormantIO/formant-cli/issues](https://github.com/FormantIO/formant-cli/issues)
573
+ - **Documentation:** [https://formant.io/docs](https://formant.io/docs)
574
+ - **Support Email:** [support@formant.io](mailto:support@formant.io)
575
+ - **GitHub Issues:** [https://github.com/FormantIO/formant-cli/issues](https://github.com/FormantIO/formant-cli/issues)
576
+ - **Formant Platform:** [https://app.formant.io](https://app.formant.io)
315
577
 
316
578
  ## License
317
579
 
318
580
  UNLICENSED — Proprietary software for Formant customers.
319
581
 
582
+ See [LICENSE](./LICENSE) for details.
583
+
320
584
  ---
321
585
 
322
586
  Made with ⚡ by [Formant](https://formant.io)
@@ -27,6 +27,11 @@ export declare abstract class BaseCommand<T extends typeof Command> extends Comm
27
27
  method?: 'DELETE' | 'GET' | 'PATCH' | 'POST' | 'PUT';
28
28
  query?: Record<string, string>;
29
29
  }): Promise<R>;
30
+ /**
31
+ * Get the organization ID from the authenticated session.
32
+ * Uses the cached login token so no extra network call if already authenticated.
33
+ */
34
+ protected getOrgId(): Promise<string>;
30
35
  protected catch(err: Error & {
31
36
  exitCode?: number;
32
37
  }): Promise<void>;