@dboio/cli 0.4.1

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 ADDED
@@ -0,0 +1,1161 @@
1
+ # dbo — Command Line Interface for DBO.io
2
+
3
+ A terminal-based CLI for interacting with the [DBO.io](https://dbo.io) framework. Replaces raw curl commands with a clean, subcommand-driven interface for CRUD operations, querying, content deployment, media management, and more.
4
+
5
+ ## Installation
6
+
7
+ ### From the repository (local development)
8
+
9
+ ```bash
10
+ cd tools/dbo-cli
11
+ npm install
12
+ npm link
13
+ ```
14
+
15
+ This makes the `dbo` command available globally on your system.
16
+
17
+ ### From npm (when published)
18
+
19
+ ```bash
20
+ npm install -g @dboio/cli
21
+ ```
22
+
23
+ ### Without installing (npx)
24
+
25
+ ```bash
26
+ npx @dboio/cli <command>
27
+ ```
28
+
29
+ ### Requirements
30
+
31
+ - **Node.js 18+** (uses native `fetch` and `FormData`)
32
+ - A DBO.io instance to connect to
33
+
34
+ ## Claude Code Integration
35
+
36
+ The dbo CLI can be used as a `/dbo` slash command inside Claude Code sessions.
37
+
38
+ ### Install Claude Code commands
39
+
40
+ ```bash
41
+ # Install the /dbo command into your project's .claude/commands/
42
+ dbo install claudecommands
43
+
44
+ # Or install Claude Code CLI + commands together
45
+ dbo install claudecode
46
+ ```
47
+
48
+ Once installed, use `/dbo` in Claude Code:
49
+ ```
50
+ /dbo pull albain3dwkofbhnd1qtd1q
51
+ /dbo output -e user --maxrows 5
52
+ /dbo push assets/css/
53
+ ```
54
+
55
+ The command source lives in `tools/dbo-cli/src/plugins/claudecommands/`. Installed copies in `.claude/commands/` are gitignored and managed by `dbo install` / `dbo update`.
56
+
57
+ ---
58
+
59
+ ## Updating
60
+
61
+ ```bash
62
+ # Update everything (CLI + Claude commands)
63
+ dbo update
64
+
65
+ # Update only the CLI
66
+ dbo update cli
67
+
68
+ # Update only Claude Code commands
69
+ dbo update claudecommands
70
+
71
+ # Update a specific Claude command
72
+ dbo update --claudecommand dbo
73
+
74
+ # Check your version
75
+ dbo --version
76
+ ```
77
+
78
+ For manual updates:
79
+
80
+ ```bash
81
+ # From git repo
82
+ cd tools/dbo-cli && git pull && npm install
83
+
84
+ # From npm
85
+ npm update -g @dboio/cli
86
+ ```
87
+
88
+ If you used `npm link`, the link updates automatically — no need to re-link.
89
+
90
+ ---
91
+
92
+ ## Quick Start
93
+
94
+ ```bash
95
+ # 1. Initialize configuration for the current directory
96
+ dbo init --domain beta-dev_model.dbo.io
97
+
98
+ # 2. Authenticate
99
+ dbo login
100
+
101
+ # 3. Check your session
102
+ dbo status
103
+
104
+ # 4. Query some data
105
+ dbo output -e user --format json --maxrows 5
106
+
107
+ # 5. Deploy a CSS file
108
+ dbo content deploy albain3dwkofbhnd1qtd1q assets/css/colors.css
109
+ ```
110
+
111
+ ---
112
+
113
+ ## Configuration
114
+
115
+ All configuration is **directory-scoped**. Each project folder maintains its own `.dbo/` directory with its own domain and session. Switch environments by switching directories:
116
+
117
+ ```bash
118
+ ~/projects/operator-beta/ → .dbo/ → beta-dev_model.dbo.io
119
+ ~/projects/operator-prod/ → .dbo/ → prod.dbo.io
120
+ ```
121
+
122
+ ### `.dbo/` directory contents
123
+
124
+ | File | Purpose | Git |
125
+ |------|---------|-----|
126
+ | `config.json` | Domain, app metadata, placement preferences | Committable (shared) |
127
+ | `credentials.json` | Username, user ID, UID, name, email (no password) | Gitignored (per-user) |
128
+ | `cookies.txt` | Session cookie (Netscape format) | Gitignored (per-user) |
129
+ | `structure.json` | Bin directory mapping (created by `dbo clone`) | Committable (shared) |
130
+
131
+ `dbo init` automatically adds `.dbo/credentials.json` and `.dbo/cookies.txt` to `.gitignore` (creates the file if it doesn't exist).
132
+
133
+ #### config.json reference
134
+
135
+ ```json
136
+ {
137
+ "domain": "beta-dev_model.dbo.io",
138
+ "AppID": 10198,
139
+ "AppUID": "abc123",
140
+ "AppName": "My App",
141
+ "AppShortName": "myapp",
142
+ "ContentPlacement": "bin",
143
+ "MediaPlacement": "fullpath"
144
+ }
145
+ ```
146
+
147
+ | Key | Values | Description |
148
+ |-----|--------|-------------|
149
+ | `domain` | hostname | DBO.io instance to connect to |
150
+ | `AppID` | number | App ID (set by `dbo clone`, used by `dbo add`/`dbo input`) |
151
+ | `AppUID` | string | App UID |
152
+ | `AppName` | string | App display name |
153
+ | `AppShortName` | string | App short name (used for `dbo clone --app`) |
154
+ | `ContentPlacement` | `bin` \| `path` \| `ask` | Where to place content files during clone |
155
+ | `MediaPlacement` | `bin` \| `fullpath` \| `ask` | Where to place media files during clone |
156
+
157
+ **Placement values:**
158
+ - `bin` — Place files in the BinID-mapped directory (from `structure.json`)
159
+ - `path` / `fullpath` — Place files in the Path/FullPath directory from the record
160
+ - `ask` — Prompt for each file that has both a BinID and a Path/FullPath
161
+
162
+ These are set interactively on first clone and saved for future use. Pre-set them in `config.json` to skip the prompt entirely.
163
+
164
+ ### Legacy migration
165
+
166
+ If your project uses the older `.domain`, `.username`, `.password`, `.cookies` files, `dbo init` will detect them and offer to migrate automatically.
167
+
168
+ ### Environment variables
169
+
170
+ Environment variables override file-based configuration:
171
+
172
+ - `DBO_DOMAIN` — target domain
173
+ - `DBO_USERNAME` — username
174
+ - `DBO_PASSWORD` — password
175
+
176
+ ---
177
+
178
+ ## Commands
179
+
180
+ ### `dbo init`
181
+
182
+ Initialize DBO CLI configuration for the current directory.
183
+
184
+ ```bash
185
+ dbo init # interactive prompts
186
+ dbo init --domain beta-dev_model.dbo.io # non-interactive
187
+ dbo init --domain dev.dbo.io --username me@co.io # with credentials
188
+ dbo init --force # overwrite existing config
189
+ dbo init --domain dev.dbo.io --app myapp --clone # init + clone an app
190
+ ```
191
+
192
+ | Flag | Description |
193
+ |------|-------------|
194
+ | `--domain <host>` | DBO instance domain |
195
+ | `--username <user>` | DBO username (stored for login default) |
196
+ | `--force` | Overwrite existing configuration |
197
+ | `--app <shortName>` | App short name (triggers clone after init) |
198
+ | `--clone` | Clone the app after initialization |
199
+
200
+ ---
201
+
202
+ ### `dbo clone`
203
+
204
+ Clone an app from DBO.io to a local project structure. Creates directories, files, metadata, and populates `config.json` and `package.json`.
205
+
206
+ ```bash
207
+ # Clone using config (AppShortName from .dbo/config.json)
208
+ dbo clone
209
+
210
+ # Clone from a local JSON export file
211
+ dbo clone /path/to/app_export.json
212
+
213
+ # Clone from server by app short name
214
+ dbo clone --app myapp
215
+
216
+ # Combined with init
217
+ dbo init --domain beta-dev.dbo.io --app myapp --clone
218
+ ```
219
+
220
+ | Flag | Description |
221
+ |------|-------------|
222
+ | `<source>` | Local JSON file path (optional positional argument) |
223
+ | `--app <name>` | App short name to fetch from server |
224
+ | `--domain <host>` | Override domain |
225
+ | `-y, --yes` | Auto-accept all prompts |
226
+ | `-v, --verbose` | Show HTTP request details |
227
+
228
+ #### What clone does
229
+
230
+ 1. **Loads app JSON** — from a local file, server API, or interactive prompt
231
+ 2. **Updates `.dbo/config.json`** — saves `AppID`, `AppUID`, `AppName`, `AppShortName`
232
+ 3. **Updates `package.json`** — populates `name`, `productName`, `description`, `homepage`, and `deploy` script
233
+ 4. **Creates directories** — processes `children.bin` to build the directory hierarchy based on `ParentBinID` relationships
234
+ 5. **Saves `.dbo/structure.json`** — maps BinIDs to directory paths for file placement
235
+ 6. **Writes content files** — decodes base64 content, creates `*.metadata.json` + content files in the correct bin directory
236
+ 7. **Downloads media files** — fetches binary files (images, CSS, fonts) from the server via `/api/media/{uid}` and saves with metadata
237
+ 8. **Processes other entities** — entities with a `BinID` are placed in the corresponding directory
238
+ 9. **Saves `app.json`** — clone of the original JSON with processed entries replaced by `@path/to/*.metadata.json` references
239
+
240
+ #### Path resolution
241
+
242
+ When a content record has both `Path` and `BinID`, the CLI prompts:
243
+ ```
244
+ Where do you want me to place filename.ext?
245
+ 1. Into the Path of /path/from/path/column
246
+ 2. Into the BinID of 12345 (mapped BinName → bin/directory)
247
+ ```
248
+
249
+ #### Output structure
250
+
251
+ ```
252
+ project/
253
+ .dbo/
254
+ config.json # Updated with app metadata
255
+ structure.json # Bin directory mapping
256
+ .gitignore # credentials.json + cookies.txt added
257
+ package.json # Updated with app info + deploy script
258
+ app.json # Clone of original with @references
259
+ bins/ # ← root for all bin-placed files
260
+ app/ # ← directory from children.bin
261
+ thomas-scratch.md
262
+ thomas-scratch.metadata.json
263
+ CurrentTicketID.cs
264
+ CurrentTicketID.metadata.json
265
+ ticket_test/ # ← another bin directory
266
+ ...
267
+ media/operator/app/... # ← FullPath placement (when MediaPlacement=fullpath)
268
+ ```
269
+
270
+ ---
271
+
272
+ ### `dbo login`
273
+
274
+ Authenticate with a DBO.io instance and store the session cookie.
275
+
276
+ After successful authentication, the CLI automatically fetches and stores the current user's ID, UID, name, and email in `.dbo/credentials.json`. The ID and UID are used for automatic retry when server submissions require user identity (see [Automatic error recovery](#automatic-error-recovery)). The name and email are used to populate `package.json` author fields during `dbo clone`.
277
+
278
+ > **Note:** User info is currently retrieved via a separate API call after login. This is a temporary workaround — the authentication endpoint should include user info in its response directly.
279
+
280
+ ```bash
281
+ dbo login # uses stored credentials
282
+ dbo login -u user@example.com -p myPassword # explicit credentials
283
+ dbo login -e user@example.com # authenticate by email
284
+ dbo login --phone +15551234567 -p myPassword # authenticate by phone
285
+ dbo login --passkey abc123def # authenticate with passkey
286
+ ```
287
+
288
+ | Flag | Description |
289
+ |------|-------------|
290
+ | `-u, --username <value>` | Username identity |
291
+ | `-e, --email <value>` | Email identity |
292
+ | `--phone <value>` | Phone number identity |
293
+ | `-p, --password <value>` | Password credential |
294
+ | `--passkey <value>` | Passkey credential (rotating API key) |
295
+ | `--domain <host>` | Override domain for this request |
296
+
297
+ ---
298
+
299
+ ### `dbo logout`
300
+
301
+ Log out and clear the local session cookie.
302
+
303
+ ```bash
304
+ dbo logout
305
+ ```
306
+
307
+ ---
308
+
309
+ ### `dbo status`
310
+
311
+ Show current configuration, domain, and session status.
312
+
313
+ ```bash
314
+ dbo status
315
+ ```
316
+
317
+ Output:
318
+ ```
319
+ Initialized: Yes (.dbo/)
320
+ Domain: beta-dev_model.dbo.io
321
+ Username: user@example.com
322
+ User ID: 10296
323
+ User UID: albain3dwkofbhnd1qtd1q
324
+ Directory: /Users/me/projects/operator
325
+ Session: Active (expires: 2026-03-15T10:30:00.000Z)
326
+ Cookies: /Users/me/projects/operator/.dbo/cookies.txt
327
+ ```
328
+
329
+ User ID and UID are populated by `dbo login`. If they show "(not set)", run `dbo login` to fetch them.
330
+
331
+ ---
332
+
333
+ ### `dbo input`
334
+
335
+ Submit CRUD operations (add, edit, delete records) to DBO.io. This is the core data manipulation command.
336
+
337
+ ```bash
338
+ # Add a record
339
+ dbo input -d 'RowID:add1;column:user.FirstName=John' -d 'RowID:add1;column:user.LastName=Doe'
340
+
341
+ # Edit a record by UID
342
+ dbo input -d 'RowUID:albain3dwkofbhnd1qtd1q;column:content.Content@assets/css/colors.css'
343
+
344
+ # Delete a record
345
+ dbo input -d 'RowID:del10062;entity:user=true'
346
+
347
+ # Multiple operations in one call
348
+ dbo input -d 'RowID:add1;column:user.LastName=Doe&RowUID:abc;column:content.Content@file.css'
349
+
350
+ # With file upload (multipart)
351
+ dbo input -d 'RowID:add1;column:media.BinID=12345' -f file=@path/to/image.jpg
352
+
353
+ # Validation only (no commit)
354
+ dbo input -d 'RowID:add1;column:user.FirstName=John' --confirm false
355
+
356
+ # With ticket ID override
357
+ dbo input -d 'RowID:add1;column:content.Name=test' --ticket abc123
358
+
359
+ # See the HTTP request being made
360
+ dbo input -d 'RowUID:abc;column:content.Content@file.css' -v
361
+ ```
362
+
363
+ | Flag | Description |
364
+ |------|-------------|
365
+ | `-d, --data <expr>` | DBO input expression (repeatable) |
366
+ | `-f, --file <field=@path>` | File attachment for multipart upload (repeatable) |
367
+ | `-C, --confirm <true\|false>` | Commit changes (default: `true`). Use `false` for validation only |
368
+ | `--ticket <id>` | Override ticket ID (`_OverrideTicketID`) |
369
+ | `--login` | Auto-login user created by this submission |
370
+ | `--transactional` | Use transactional processing |
371
+ | `--json` | Output raw JSON response |
372
+ | `-v, --verbose` | Show HTTP request details |
373
+ | `--domain <host>` | Override domain |
374
+
375
+ #### Input expression syntax
376
+
377
+ ```
378
+ RowID:identifier;column:entity.ColumnName=value # direct value
379
+ RowUID:identifier;column:entity.ColumnName@filepath # value from file
380
+ RowID:delIdentifier;entity:entityName=true # delete
381
+ ```
382
+
383
+ The `@filepath` syntax reads the file contents and uses them as the column value. This is how CSS, JS, HTML, and other text content is deployed to DBO.
384
+
385
+ ---
386
+
387
+ ### `dbo output`
388
+
389
+ Query data from DBO.io outputs or entities.
390
+
391
+ ```bash
392
+ # Custom output by UID
393
+ dbo output qfkyyp2vxeaggdeo7dwbig
394
+
395
+ # Entity query
396
+ dbo output -e user --format json
397
+
398
+ # Single record
399
+ dbo output -e user --row 10296
400
+
401
+ # With filtering and sorting
402
+ dbo output -e user --filter 'FirstName=John' --sort 'LastName:asc' --format json
403
+
404
+ # Contains filter
405
+ dbo output -e content --filter 'Name:contains=color' --format json
406
+
407
+ # Pagination
408
+ dbo output -e user --page 2 --rows-per-page 25
409
+
410
+ # Save results to local files (interactive)
411
+ dbo output -e content --filter 'AppID=10100' --save
412
+
413
+ # Save results to local files (non-interactive / scripting)
414
+ dbo output -e content --save-filename Name --save-path Path --save-content Content --save-extension Extension
415
+
416
+ # Entity metadata
417
+ dbo output -e user --meta
418
+
419
+ # Debug SQL
420
+ dbo output myOutputUID --debug-sql
421
+ ```
422
+
423
+ | Flag | Description |
424
+ |------|-------------|
425
+ | `<uid>` | Output UID (positional argument) |
426
+ | `-e, --entity <uid>` | Query by entity UID |
427
+ | `--row <id>` | Specific row ID |
428
+ | `--filter <expr>` | Filter expression (repeatable) |
429
+ | `--format <type>` | Output format: `json`, `html`, `csv`, `xml`, `txt`, `pdf` |
430
+ | `--sort <expr>` | Sort expression (repeatable), e.g., `LastName:asc` |
431
+ | `--search <expr>` | Full-text search |
432
+ | `--page <n>` | Page number |
433
+ | `--rows-per-page <n>` | Rows per page |
434
+ | `--maxrows <n>` | Maximum rows |
435
+ | `--rows <range>` | Row range, e.g., `1-10` |
436
+ | `--template <value>` | Custom template |
437
+ | `--debug` | Include debug info |
438
+ | `--debug-sql` | Include SQL debug info |
439
+ | `--meta` | Use meta output endpoint |
440
+ | `--meta-column <uid>` | Column metadata |
441
+ | `--save` | Interactive save-to-disk mode |
442
+ | `--save-filename <col>` | Column for filenames (non-interactive) |
443
+ | `--save-path <col>` | Column for file path (non-interactive) |
444
+ | `--save-content <col>` | Column for file content (non-interactive) |
445
+ | `--save-extension <col>` | Column or literal extension (non-interactive) |
446
+ | `--json` | Output raw JSON |
447
+ | `-v, --verbose` | Show HTTP request details |
448
+
449
+ #### Save to Disk (`--save`)
450
+
451
+ The save-to-disk feature fetches data and persists records as local files. It uses an interactive flow with arrow-key selection prompts:
452
+
453
+ 1. **Filename column** — which column value becomes the filename (default: `Name` or `UID`)
454
+ 2. **Path column** — which column contains the directory path (builds local directories)
455
+ 3. **Content column(s)** — which column(s) to save as file content (skip for metadata only)
456
+ 4. **Extension** — use an entity column or specify manually
457
+
458
+ Each record produces:
459
+ - A content file: `[filename].[extension]`
460
+ - A metadata file: `[filename].metadata.json` (all column values)
461
+
462
+ If the path column contains a filename (e.g., `assets/js/main.js`), the CLI detects it and asks if you want to use it.
463
+
464
+ ---
465
+
466
+ ### `dbo content`
467
+
468
+ Get, deploy, or pull content from DBO.io.
469
+
470
+ ```bash
471
+ # Get content by UID
472
+ dbo content ykqucv0eb0ggjqgcncj6dq
473
+
474
+ # Save content to a local file
475
+ dbo content ykqucv0eb0ggjqgcncj6dq -o local/file.html
476
+
477
+ # Get as plain text (disable minification)
478
+ dbo content ykqucv0eb0ggjqgcncj6dq --format txt --no-minify
479
+ ```
480
+
481
+ | Flag | Description |
482
+ |------|-------------|
483
+ | `<uid>` | Content UID |
484
+ | `-o, --output <path>` | Save to local file |
485
+ | `--format <type>` | Output format |
486
+ | `--no-minify` | Disable minification |
487
+ | `--json` | Output raw JSON |
488
+
489
+ #### `dbo content deploy`
490
+
491
+ Deploy a local file's contents to a DBO content record.
492
+
493
+ ```bash
494
+ dbo content deploy albain3dwkofbhnd1qtd1q assets/css/colors.css
495
+ dbo content deploy rncjivlghu65bmkbjnxynq assets/js/app.js
496
+ dbo content deploy abc123 docs/readme.md --ticket myTicket
497
+ dbo content deploy abc123 test.html --confirm false # validate only
498
+ ```
499
+
500
+ This is a shorthand for:
501
+ ```bash
502
+ dbo input -d 'RowUID:albain3dwkofbhnd1qtd1q;column:content.Content@assets/css/colors.css'
503
+ ```
504
+
505
+ | Flag | Description |
506
+ |------|-------------|
507
+ | `<uid>` | Content UID (RowUID) |
508
+ | `<filepath>` | Local file path |
509
+ | `-C, --confirm <true\|false>` | Commit (default: `true`) |
510
+ | `--ticket <id>` | Override ticket ID |
511
+
512
+ #### `dbo content pull`
513
+
514
+ Pull content records from DBO to local files. Uses the content entity's well-known columns (`Name`, `Path`, `Content`, `Extension`) automatically — no interactive prompts.
515
+
516
+ ```bash
517
+ # Pull a single content record
518
+ dbo content pull ykqucv0eb0ggjqgcncj6dq
519
+
520
+ # Pull all content for an app
521
+ dbo content pull --filter 'AppID=10100'
522
+
523
+ # Pull with row limit
524
+ dbo content pull --filter 'AppID=10100' --maxrows 50
525
+ ```
526
+
527
+ Creates local files matching the content entity's `Path` and `Extension` columns:
528
+ ```
529
+ css/
530
+ colors.css # content.Content value
531
+ colors.metadata.json # all column values as JSON
532
+ js/
533
+ app.js
534
+ app.metadata.json
535
+ ```
536
+
537
+ ---
538
+
539
+ ### `dbo media`
540
+
541
+ Get media files from DBO.io.
542
+
543
+ ```bash
544
+ # Get media by UID
545
+ dbo media albain3dwkofbhnd1qtd1q
546
+
547
+ # Save to local file
548
+ dbo media albain3dwkofbhnd1qtd1q -o logo.png
549
+
550
+ # Get by numeric ID
551
+ dbo media --id 12345 -o file.jpg
552
+
553
+ # Get by path
554
+ dbo media --path assets/images/logo.png -o logo.png
555
+
556
+ # Force download
557
+ dbo media albain3dwkofbhnd1qtd1q --download -o file.pdf
558
+ ```
559
+
560
+ | Flag | Description |
561
+ |------|-------------|
562
+ | `<uid>` | Media UID |
563
+ | `--id <id>` | Media by numeric ID |
564
+ | `--path <path>` | Media by directory path |
565
+ | `-o, --output <path>` | Save to local file |
566
+ | `--download` | Force download (attachment disposition) |
567
+
568
+ ---
569
+
570
+ ### `dbo upload`
571
+
572
+ Upload a binary file to DBO.io.
573
+
574
+ ```bash
575
+ dbo upload image.jpg --bin 12345 --app 67890 --ownership app --path assets/images
576
+ dbo upload logo.svg --bin 12345 --app 67890 --ownership app --path assets/gfx --name brand-logo
577
+ dbo upload doc.pdf --bin 12345 --app 67890 --ownership user --path docs --confirm false
578
+ ```
579
+
580
+ | Flag | Description |
581
+ |------|-------------|
582
+ | `<filepath>` | Local file to upload |
583
+ | `--bin <id>` | BinID (required) |
584
+ | `--app <id>` | AppID (required) |
585
+ | `--ownership <type>` | Ownership: `app`, `user`, or `system` (required) |
586
+ | `--path <dir>` | Media path (required) |
587
+ | `--name <value>` | Override filename |
588
+ | `-C, --confirm <true\|false>` | Commit (default: `true`) |
589
+
590
+ ---
591
+
592
+ ### `dbo message`
593
+
594
+ Send messages via DBO.io (email, SMS/MMS, chatbot).
595
+
596
+ ```bash
597
+ # Send an email
598
+ dbo message emailTemplateUID
599
+
600
+ # Send a chatbot message with thread
601
+ dbo message chatbotTemplateUID --thread conversation123
602
+
603
+ # Validate without sending
604
+ dbo message emailTemplateUID --confirm false
605
+ ```
606
+
607
+ | Flag | Description |
608
+ |------|-------------|
609
+ | `<uid>` | Content UID for the message template |
610
+ | `-C, --confirm <true\|false>` | Commit (default: `true`) |
611
+ | `--thread <id>` | Thread ID for chatbot conversations |
612
+ | `--json` | Output raw JSON |
613
+
614
+ ---
615
+
616
+ ### `dbo cache`
617
+
618
+ Manage the DBO.io cache.
619
+
620
+ ```bash
621
+ # List all cached items
622
+ dbo cache list
623
+
624
+ # List with metadata
625
+ dbo cache list --metadata
626
+
627
+ # Refresh a specific cache key
628
+ dbo cache refresh --key 'content:myContentUID'
629
+ ```
630
+
631
+ #### `dbo cache list`
632
+
633
+ | Flag | Description |
634
+ |------|-------------|
635
+ | `--metadata` | Include cache provider metadata |
636
+ | `--json` | Output raw JSON |
637
+
638
+ #### `dbo cache refresh`
639
+
640
+ | Flag | Description |
641
+ |------|-------------|
642
+ | `--key <value>` | Cache key to refresh (required) |
643
+ | `--part <value>` | Cache partition |
644
+
645
+ ---
646
+
647
+ ### `dbo instance`
648
+
649
+ Manage DBO.io instances.
650
+
651
+ ```bash
652
+ # Export the current instance
653
+ dbo instance export
654
+
655
+ # Build an instance
656
+ dbo instance build instanceUID
657
+
658
+ # Validate without executing
659
+ dbo instance export --confirm false
660
+ ```
661
+
662
+ #### `dbo instance export`
663
+
664
+ | Flag | Description |
665
+ |------|-------------|
666
+ | `-C, --confirm <true\|false>` | Commit (default: `true`) |
667
+
668
+ #### `dbo instance build <uid>`
669
+
670
+ | Flag | Description |
671
+ |------|-------------|
672
+ | `<uid>` | Instance UID |
673
+ | `-C, --confirm <true\|false>` | Commit (default: `true`) |
674
+
675
+ ---
676
+
677
+ ### `dbo push`
678
+
679
+ Push local files back to DBO.io using metadata from a previous pull. This is the counterpart to `dbo content pull` and `dbo output --save`.
680
+
681
+ #### Round-trip workflow
682
+
683
+ ```bash
684
+ # 1. Pull content to local files
685
+ dbo content pull --filter 'AppID=10100' --maxrows 10
686
+
687
+ # 2. Edit files locally
688
+ vim css/colors.css
689
+
690
+ # 3. Push changes back to DBO
691
+ dbo push css/colors.css
692
+ ```
693
+
694
+ #### Single file
695
+
696
+ ```bash
697
+ # Push a single file (uses companion .metadata.json)
698
+ dbo push assets/js/main.js
699
+
700
+ # Validate without submitting
701
+ dbo push assets/js/main.js --confirm false
702
+
703
+ # Push only the file content, not metadata columns
704
+ dbo push assets/js/main.js --content-only
705
+
706
+ # Push only metadata changes, skip file content
707
+ dbo push assets/js/main.js --meta-only
708
+ ```
709
+
710
+ The push command finds `assets/js/main.metadata.json`, reads the UID and entity, and builds input expressions for all columns.
711
+
712
+ #### Directory (recursive)
713
+
714
+ ```bash
715
+ # Push all records in a directory
716
+ dbo push assets/
717
+
718
+ # Push with auto-accept for all prompts
719
+ dbo push assets/ -y
720
+ ```
721
+
722
+ Recursively finds all `*.metadata.json` files, verifies `@filename` references exist, and pushes each record.
723
+
724
+ #### Path mismatch detection
725
+
726
+ If you move a file to a different directory after pulling, the push detects the mismatch:
727
+
728
+ ```
729
+ ⚠ Path mismatch for "main":
730
+ Metadata Path: css/main.css
731
+ Current path: assets/css/main.css
732
+ Update Path column to "assets/css/main.css"? (Y/n)
733
+ ```
734
+
735
+ The `--yes` flag auto-accepts path updates.
736
+
737
+ #### Metadata format
738
+
739
+ After a pull, metadata files contain `@filename` references for content columns:
740
+
741
+ ```json
742
+ {
743
+ "_entity": "content",
744
+ "_contentColumns": ["Content"],
745
+ "UID": "abc123",
746
+ "Name": "colors",
747
+ "Content": "@colors.css",
748
+ "Extension": "CSS",
749
+ "Path": "css/colors.css",
750
+ "Type": "Code"
751
+ }
752
+ ```
753
+
754
+ The `@colors.css` reference tells push to read the content from that file. All other values are pushed as literal column values.
755
+
756
+ | Flag | Description |
757
+ |------|-------------|
758
+ | `<path>` | File or directory to push |
759
+ | `-C, --confirm <true\|false>` | Commit (default: `true`) |
760
+ | `--ticket <id>` | Override ticket ID |
761
+ | `--meta-only` | Only push metadata, skip file content |
762
+ | `--content-only` | Only push file content, skip metadata |
763
+ | `-y, --yes` | Auto-accept all prompts |
764
+ | `--json` | Output raw JSON |
765
+ | `--jq <expr>` | Filter JSON response |
766
+
767
+ ---
768
+
769
+ ### `dbo add`
770
+
771
+ Add a new file to DBO.io by creating a server record. Similar to `git add`, this registers a local file with the server.
772
+
773
+ #### Single file
774
+
775
+ ```bash
776
+ # Add a file (interactive metadata setup if no .metadata.json exists)
777
+ dbo add assets/css/colors.css
778
+
779
+ # Add with auto-accept prompts
780
+ dbo add assets/css/colors.css -y
781
+
782
+ # Add with ticket ID
783
+ dbo add assets/css/colors.css --ticket abc123
784
+ ```
785
+
786
+ If the file has no companion `.metadata.json`, an interactive wizard prompts for the entity name, content column, AppID, BinID, SiteID, and Path. It then creates the metadata file and submits the insert.
787
+
788
+ #### Directory scan
789
+
790
+ ```bash
791
+ # Scan current directory for un-added files
792
+ dbo add .
793
+
794
+ # Scan a specific directory
795
+ dbo add assets/
796
+ ```
797
+
798
+ Recursively finds files that either have no `.metadata.json` companion or have metadata without `_CreatedOn` (never been on the server). Lists them and prompts for confirmation before adding.
799
+
800
+ When adding multiple files, the entity and column defaults from the first file are reused for subsequent files.
801
+
802
+ #### After adding
803
+
804
+ After a successful add, the server returns a UID which is written back to the metadata file. To populate all server-side columns (like `_CreatedOn`, `Extension`, etc.), run:
805
+
806
+ ```bash
807
+ dbo pull -e content <uid>
808
+ ```
809
+
810
+ #### Metadata generated by add
811
+
812
+ Minimal (no optional fields provided):
813
+ ```json
814
+ {
815
+ "Name": "colors",
816
+ "Path": "assets/css/colors.css",
817
+ "Content": "@colors.css",
818
+ "_entity": "content",
819
+ "_contentColumns": ["Content"]
820
+ }
821
+ ```
822
+
823
+ With optional fields (only included if the user provides values during the wizard):
824
+ ```json
825
+ {
826
+ "AppID": 10100,
827
+ "BinID": 11045,
828
+ "SiteID": 10061,
829
+ "Name": "colors",
830
+ "Path": "assets/css/colors.css",
831
+ "Content": "@colors.css",
832
+ "_entity": "content",
833
+ "_contentColumns": ["Content"]
834
+ }
835
+ ```
836
+
837
+ The `@colors.css` reference tells the CLI to read the file content from `colors.css` in the same directory.
838
+
839
+ | Flag | Description |
840
+ |------|-------------|
841
+ | `<path>` | File or `.` to scan current directory |
842
+ | `-C, --confirm <true\|false>` | Commit (default: `true`) |
843
+ | `--ticket <id>` | Override ticket ID |
844
+ | `-y, --yes` | Auto-accept all prompts |
845
+ | `--json` | Output raw JSON |
846
+ | `--jq <expr>` | Filter JSON response |
847
+
848
+ #### Column filtering
849
+
850
+ The `add` and `push` commands never submit these server-managed columns:
851
+ - `_CreatedOn`, `_LastUpdated` — set by the server
852
+ - `_LastUpdatedUserID`, `_LastUpdatedTicketID` — session-provided values
853
+ - `UID` — assigned by the server on insert
854
+ - `_id` — internal database ID
855
+
856
+ ---
857
+
858
+ ### Automatic error recovery
859
+
860
+ The `input`, `push`, and `add` commands automatically detect recoverable server errors and prompt for missing values instead of failing immediately.
861
+
862
+ #### Ticket ID required
863
+
864
+ When the server returns `ticket_lookup_required_error`, the CLI prompts:
865
+
866
+ ```
867
+ ⚠ This operation requires a Ticket ID.
868
+ ? Ticket ID Required: ___
869
+ ```
870
+
871
+ The submission is then retried with `_OverrideTicketID`. To skip the prompt, pass `--ticket <id>` upfront.
872
+
873
+ #### User identity required
874
+
875
+ When the server returns an error mentioning `LoggedInUser_UID`, `LoggedInUserID`, `CurrentUserID`, or `UserID`, the CLI checks for a stored user identity from `dbo login`:
876
+
877
+ ```
878
+ ⚠ This operation requires an authenticated user (LoggedInUser_UID).
879
+ Your session may have expired, or you may not be logged in.
880
+ You can log in with "dbo login" to avoid this prompt in the future.
881
+ Stored session user UID: albain3dwkofbhnd1qtd1q
882
+ ? User UID Required:
883
+ ❯ Use session user (UID: albain3dwkofbhnd1qtd1q)
884
+ Enter a different User UID
885
+ ```
886
+
887
+ If no stored user info is available, it prompts for direct input. The CLI automatically determines whether the server needs a UID or numeric ID based on the error message pattern.
888
+
889
+ ---
890
+
891
+ ### `dbo install`
892
+
893
+ Install dbo-cli components including Claude Code integration.
894
+
895
+ ```bash
896
+ # Interactive — choose what to install
897
+ dbo install
898
+
899
+ # Install Claude Code commands into .claude/commands/
900
+ dbo install claudecommands
901
+
902
+ # Install Claude Code CLI (if not present) + commands
903
+ dbo install claudecode
904
+
905
+ # Install a specific command plugin
906
+ dbo install --claudecommand dbo
907
+ ```
908
+
909
+ | Flag | Description |
910
+ |------|-------------|
911
+ | `[target]` | What to install: `claudecode`, `claudecommands` |
912
+ | `--claudecommand <name>` | Install a specific command by name |
913
+
914
+ When installing Claude commands:
915
+ - Creates `.claude/commands/` if it doesn't exist (prompts first)
916
+ - Prompts before overwriting existing commands
917
+ - Adds installed files to `.gitignore` (source of truth is `src/plugins/claudecommands/`)
918
+
919
+ ---
920
+
921
+ ### `dbo update`
922
+
923
+ Update the dbo CLI, plugins, or Claude Code commands.
924
+
925
+ ```bash
926
+ # Update CLI + ask about Claude commands
927
+ dbo update
928
+
929
+ # Update only the CLI (git pull or npm update)
930
+ dbo update cli
931
+
932
+ # Update all plugins
933
+ dbo update plugins
934
+
935
+ # Re-sync Claude commands from source
936
+ dbo update claudecommands
937
+
938
+ # Update a specific Claude command
939
+ dbo update --claudecommand dbo
940
+ ```
941
+
942
+ | Flag | Description |
943
+ |------|-------------|
944
+ | `[target]` | What to update: `cli`, `plugins`, `claudecommands` |
945
+ | `--claudecommand <name>` | Update a specific command by name |
946
+
947
+ The update compares file hashes — unchanged files are skipped with "already up to date".
948
+
949
+ ---
950
+
951
+ ### `dbo deploy`
952
+
953
+ Deploy files to DBO.io using a `dbo.deploy.json` manifest or direct arguments.
954
+
955
+ ```bash
956
+ # Deploy a named entry from the manifest
957
+ dbo deploy css:colors
958
+
959
+ # Deploy all entries
960
+ dbo deploy --all
961
+
962
+ # Deploy with ticket ID
963
+ dbo deploy js:app --ticket abc123
964
+
965
+ # Validate without deploying
966
+ dbo deploy css:colors --confirm false
967
+ ```
968
+
969
+ | Flag | Description |
970
+ |------|-------------|
971
+ | `<name>` | Deployment name from `dbo.deploy.json` |
972
+ | `--all` | Deploy all entries in the manifest |
973
+ | `-C, --confirm <true\|false>` | Commit (default: `true`) |
974
+ | `--ticket <id>` | Override ticket ID |
975
+
976
+ #### `dbo.deploy.json` manifest
977
+
978
+ Create a `dbo.deploy.json` file in your project root to define named deployments:
979
+
980
+ ```json
981
+ {
982
+ "deployments": {
983
+ "css:colors": {
984
+ "uid": "albain3dwkofbhnd1qtd1q",
985
+ "file": "assets/css/colors.css"
986
+ },
987
+ "js:app": {
988
+ "uid": "rncjivlghu65bmkbjnxynq",
989
+ "file": "assets/js/app.js"
990
+ },
991
+ "doc:colors": {
992
+ "uid": "l2uv2gu8gu6ziyluuncv0w",
993
+ "file": "docs/colors.md",
994
+ "entity": "extension",
995
+ "column": "Text"
996
+ }
997
+ }
998
+ }
999
+ ```
1000
+
1001
+ | Field | Description | Default |
1002
+ |-------|-------------|---------|
1003
+ | `uid` | Target record UID (required) | — |
1004
+ | `file` | Local file path (required) | — |
1005
+ | `entity` | Target entity name | `content` |
1006
+ | `column` | Target column name | `Content` |
1007
+
1008
+ This replaces the curl commands typically embedded in `package.json` scripts.
1009
+
1010
+ ---
1011
+
1012
+ ## Global Flags
1013
+
1014
+ These flags are available on most commands:
1015
+
1016
+ | Flag | Description |
1017
+ |------|-------------|
1018
+ | `-C, --confirm <true\|false>` | Commit changes (default: `true`). Use `false` for validation only |
1019
+ | `--json` | Output raw JSON response with syntax highlighting |
1020
+ | `--jq <expr>` | Filter JSON response with a jq-like expression (implies `--json`) |
1021
+ | `-v, --verbose` | Show HTTP request details (method, URL, body) |
1022
+ | `--domain <host>` | Override the configured domain for this request |
1023
+ | `-h, --help` | Show help for any command |
1024
+
1025
+ ---
1026
+
1027
+ ## JSON Filtering (`--jq`)
1028
+
1029
+ The `--jq` flag provides built-in jq-like JSON filtering without requiring `jq` to be installed. It supports the most common patterns:
1030
+
1031
+ ```bash
1032
+ # Pretty-print the entire response (with syntax highlighting)
1033
+ dbo output -e user --jq '.'
1034
+
1035
+ # Extract a specific key
1036
+ dbo output -e user --jq '.Payload'
1037
+
1038
+ # Nested key access
1039
+ dbo input -d '...' --jq '.Payload.Results.Add'
1040
+
1041
+ # Pluck a field from every item in an array
1042
+ dbo output -e user --jq '.Payload.Results.Add[].UID'
1043
+
1044
+ # Array index
1045
+ dbo output -e user --jq '.Payload.Results.Add[0]'
1046
+
1047
+ # Pipe: iterate then access
1048
+ dbo output -e user --jq '.Payload.Results.Add[] | .UID'
1049
+
1050
+ # Use with any command that returns JSON
1051
+ dbo cache list --jq '.Payload'
1052
+ dbo message myUID --jq '.Successful'
1053
+ ```
1054
+
1055
+ ### Supported expressions
1056
+
1057
+ | Expression | Description |
1058
+ |-----------|-------------|
1059
+ | `.` | Identity (entire response) |
1060
+ | `.key` | Access a top-level key |
1061
+ | `.key.nested` | Nested key access |
1062
+ | `.[0]` | Array index |
1063
+ | `.[]` | Iterate array |
1064
+ | `.[].field` | Pluck field from each array item |
1065
+ | `.[] \| .field` | Pipe: iterate then access |
1066
+ | `.["key.name"]` | Bracket notation for keys with dots |
1067
+
1068
+ When `--jq` is used, the API request is automatically made with `_format=json`.
1069
+
1070
+ ### JSON syntax highlighting
1071
+
1072
+ Both `--json` and `--jq` output use syntax highlighting:
1073
+ - **Keys** in cyan
1074
+ - **Strings** in green
1075
+ - **Numbers** in yellow
1076
+ - **Booleans/null** in magenta
1077
+
1078
+ ---
1079
+
1080
+ ## Migration from curl
1081
+
1082
+ The `dbo` CLI is a drop-in replacement for the curl-based workflow. Here's how common operations translate:
1083
+
1084
+ ### Authentication
1085
+
1086
+ **Before:**
1087
+ ```bash
1088
+ echo "beta-dev_model.dbo.io" > .domain
1089
+ echo "user@example.com" > .username
1090
+ echo "mypassword" > .password
1091
+ curl --cookie-jar .cookies -K authenticate.curl
1092
+ ```
1093
+
1094
+ **After:**
1095
+ ```bash
1096
+ dbo init --domain beta-dev_model.dbo.io --username user@example.com
1097
+ dbo login
1098
+ ```
1099
+
1100
+ ### Edit a record
1101
+
1102
+ **Before:**
1103
+ ```bash
1104
+ curl -K config-data.curl -d "RowID:10065;column:user.FirstName=Jane"
1105
+ ```
1106
+
1107
+ **After:**
1108
+ ```bash
1109
+ dbo input -d 'RowID:10065;column:user.FirstName=Jane'
1110
+ ```
1111
+
1112
+ ### Deploy CSS from a local file
1113
+
1114
+ **Before:**
1115
+ ```bash
1116
+ curl -K config-data.curl --data-urlencode RowUID%3Aalbain3dwkofbhnd1qtd1q%3Bcolumn%3Acontent.Content@assets/css/colors.css
1117
+ ```
1118
+
1119
+ **After:**
1120
+ ```bash
1121
+ dbo content deploy albain3dwkofbhnd1qtd1q assets/css/colors.css
1122
+ ```
1123
+
1124
+ ### Upload a media file
1125
+
1126
+ **Before:**
1127
+ ```bash
1128
+ curl -K config-form.curl -F file=@path/to/image.jpg -F "RowID:add1;column:media.BinID=12345" -F "RowID:add1;column:media.AppID=67890" -F "RowID:add1;column:media.Ownership=app" -F "RowID:add1;column:media.Path=assets/images"
1129
+ ```
1130
+
1131
+ **After:**
1132
+ ```bash
1133
+ dbo upload image.jpg --bin 12345 --app 67890 --ownership app --path assets/images
1134
+ ```
1135
+
1136
+ ### Query data
1137
+
1138
+ **Before:**
1139
+ ```bash
1140
+ curl -b .cookies "https://beta-dev_model.dbo.io/api/output/entity/user?_format=json&_filter@FirstName=John"
1141
+ ```
1142
+
1143
+ **After:**
1144
+ ```bash
1145
+ dbo output -e user --filter 'FirstName=John' --format json
1146
+ ```
1147
+
1148
+ ### Cookie compatibility
1149
+
1150
+ The `dbo` CLI writes cookies in Netscape format (same as curl's `--cookie-jar`). You can use the same cookie file with both tools during migration:
1151
+
1152
+ ```bash
1153
+ dbo login
1154
+ curl -b .dbo/cookies.txt https://beta-dev_model.dbo.io/api/content/myUID
1155
+ ```
1156
+
1157
+ ---
1158
+
1159
+ ## License
1160
+
1161
+ Copyright manolab, LLC