@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 +1161 -0
- package/bin/dbo.js +51 -0
- package/package.json +22 -0
- package/src/commands/add.js +374 -0
- package/src/commands/cache.js +49 -0
- package/src/commands/clone.js +742 -0
- package/src/commands/content.js +143 -0
- package/src/commands/deploy.js +89 -0
- package/src/commands/init.js +105 -0
- package/src/commands/input.js +111 -0
- package/src/commands/install.js +186 -0
- package/src/commands/instance.js +44 -0
- package/src/commands/login.js +97 -0
- package/src/commands/logout.js +22 -0
- package/src/commands/media.js +46 -0
- package/src/commands/message.js +28 -0
- package/src/commands/output.js +129 -0
- package/src/commands/pull.js +109 -0
- package/src/commands/push.js +309 -0
- package/src/commands/status.js +41 -0
- package/src/commands/update.js +168 -0
- package/src/commands/upload.js +37 -0
- package/src/lib/client.js +161 -0
- package/src/lib/columns.js +30 -0
- package/src/lib/config.js +269 -0
- package/src/lib/cookie-jar.js +104 -0
- package/src/lib/formatter.js +310 -0
- package/src/lib/input-parser.js +212 -0
- package/src/lib/logger.js +12 -0
- package/src/lib/save-to-disk.js +383 -0
- package/src/lib/structure.js +129 -0
- package/src/lib/timestamps.js +67 -0
- package/src/plugins/claudecommands/dbo.md +248 -0
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Execute DBO.io CLI commands (pull, push, add, clone, output, input, content, deploy, etc.)
|
|
3
|
+
allowed-tools: [Bash, Read, Write, Grep, Glob]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# DBO CLI Command
|
|
7
|
+
|
|
8
|
+
The dbo CLI interacts with DBO.io — a database-driven application framework.
|
|
9
|
+
|
|
10
|
+
**STEP 1: Check if `$ARGUMENTS` is empty or blank.**
|
|
11
|
+
|
|
12
|
+
If `$ARGUMENTS` is empty — meaning the user typed just `/dbo` with nothing after it — then you MUST NOT run any bash command. Do NOT run `dbo`, `dbo --help`, or anything else. Instead, respond ONLY with this text message:
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
Hi there! I can help you with running dbo commands. What would you like to do?
|
|
17
|
+
|
|
18
|
+
Here are the available commands:
|
|
19
|
+
|
|
20
|
+
| Command | Description |
|
|
21
|
+
|-----------|--------------------------------------------------|
|
|
22
|
+
| init | Initialize .dbo/ configuration |
|
|
23
|
+
| login | Authenticate with a DBO.io instance |
|
|
24
|
+
| logout | Clear session |
|
|
25
|
+
| status | Show config, domain, and session info |
|
|
26
|
+
| input | Submit CRUD operations (add/edit/delete records) |
|
|
27
|
+
| output | Query data from outputs or entities |
|
|
28
|
+
| content | Get or deploy content |
|
|
29
|
+
| media | Get media files |
|
|
30
|
+
| upload | Upload a file |
|
|
31
|
+
| message | Send messages (email, SMS, chatbot) |
|
|
32
|
+
| pull | Pull records to local files |
|
|
33
|
+
| push | Push local files back to DBO.io |
|
|
34
|
+
| add | Add a new file to DBO.io |
|
|
35
|
+
| clone | Clone an app to local project structure |
|
|
36
|
+
| deploy | Deploy via manifest |
|
|
37
|
+
| cache | Manage cache |
|
|
38
|
+
| install | Install components |
|
|
39
|
+
| update | Update CLI or plugins |
|
|
40
|
+
|
|
41
|
+
Just tell me what you'd like to do and I'll help you build the right command!
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
Then STOP. Wait for the user to respond. Guide them step by step — asking about entities, UIDs, file paths, flags, etc. to construct the correct `dbo` command. Run `dbo status` proactively to check if the CLI is initialized and authenticated before suggesting data commands.
|
|
46
|
+
|
|
47
|
+
**STEP 2: If `$ARGUMENTS` is NOT empty, run the command:**
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
dbo $ARGUMENTS
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Command Reference
|
|
54
|
+
|
|
55
|
+
Available subcommands:
|
|
56
|
+
- `init` — Initialize .dbo/ configuration for the current directory
|
|
57
|
+
- `login` — Authenticate with a DBO.io instance
|
|
58
|
+
- `logout` — Clear session
|
|
59
|
+
- `status` — Show config, domain, and session info
|
|
60
|
+
- `input -d '<expr>'` — CRUD operations (add/edit/delete records)
|
|
61
|
+
- `output -e <entity>` — Query data from entities
|
|
62
|
+
- `output <uid>` — Query custom outputs
|
|
63
|
+
- `content <uid>` — Get content, `content deploy <uid> <file>` to deploy
|
|
64
|
+
- `pull [uid]` — Pull records to local files (default: content entity)
|
|
65
|
+
- `pull -e <entity> [uid]` — Pull from any entity
|
|
66
|
+
- `push <path>` — Push local files back to DBO using metadata
|
|
67
|
+
- `add <path>` — Add a new file to DBO (creates record on server)
|
|
68
|
+
- `media <uid>` — Get media files
|
|
69
|
+
- `upload <file>` — Upload binary files
|
|
70
|
+
- `message <uid>` — Send messages (email, SMS, chatbot)
|
|
71
|
+
- `cache list|refresh` — Manage cache
|
|
72
|
+
- `clone [source]` — Clone an app to local project (from file or server)
|
|
73
|
+
- `clone --app <name>` — Clone by app short name from server
|
|
74
|
+
- `deploy [name]` — Deploy via dbo.deploy.json manifest
|
|
75
|
+
- `install` — Install components (claudecode, claudecommands)
|
|
76
|
+
- `update` — Update CLI, plugins, or Claude commands
|
|
77
|
+
|
|
78
|
+
## Smart Command Building
|
|
79
|
+
|
|
80
|
+
When helping the user build a command interactively:
|
|
81
|
+
|
|
82
|
+
1. **Check readiness first**: Run `dbo status` to see if initialized and authenticated. If not, guide them through `dbo init` and `dbo login` first.
|
|
83
|
+
2. **Understand intent**: Ask what they want to do (query data, deploy a file, add a record, etc.)
|
|
84
|
+
3. **Gather parameters**: Ask for the specific values needed (entity name, UID, file path, filters, etc.)
|
|
85
|
+
4. **Build the command**: Construct the full `dbo` command with proper flags and syntax
|
|
86
|
+
5. **Execute**: Run it and explain the results
|
|
87
|
+
|
|
88
|
+
### Common workflows to suggest:
|
|
89
|
+
|
|
90
|
+
- **"I want to query data"** → Guide toward `dbo output -e <entity>` with filters
|
|
91
|
+
- **"I want to deploy/update a file"** → Check if `.metadata.json` exists → `dbo push` or `dbo content deploy`
|
|
92
|
+
- **"I want to add a new file"** → `dbo add <path>` (will create metadata interactively)
|
|
93
|
+
- **"I want to pull files from the server"** → `dbo pull` or `dbo pull -e <entity>`
|
|
94
|
+
- **"I want to see what's on the server"** → `dbo output -e <entity> --format json`
|
|
95
|
+
- **"I need to set up this project"** → `dbo init` → `dbo login` → `dbo status`
|
|
96
|
+
- **"I want to clone an app"** → `dbo clone --app <name>` or `dbo clone <local.json>`
|
|
97
|
+
- **"I want to set up and clone"** → `dbo init --domain <host> --app <name> --clone`
|
|
98
|
+
|
|
99
|
+
## Add Command Details
|
|
100
|
+
|
|
101
|
+
`dbo add <path>` registers a new local file with the DBO server by creating an insert record.
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Add a single file (interactive metadata wizard if no .metadata.json exists)
|
|
105
|
+
dbo add assets/css/colors.css
|
|
106
|
+
|
|
107
|
+
# Add with auto-accept and ticket
|
|
108
|
+
dbo add assets/css/colors.css -y --ticket abc123
|
|
109
|
+
|
|
110
|
+
# Scan current directory for all un-added files
|
|
111
|
+
dbo add .
|
|
112
|
+
|
|
113
|
+
# Scan a specific directory
|
|
114
|
+
dbo add assets/
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Flags: `-C/--confirm <true|false>`, `--ticket <id>`, `-y/--yes`, `--json`, `--jq <expr>`, `-v/--verbose`, `--domain <host>`
|
|
118
|
+
|
|
119
|
+
### How add works
|
|
120
|
+
|
|
121
|
+
1. Checks for a companion `<basename>.metadata.json` next to the file
|
|
122
|
+
2. If metadata exists with `_CreatedOn` → already on server, skips (use `push` instead)
|
|
123
|
+
3. If metadata exists without `_CreatedOn` → uses it to insert the record
|
|
124
|
+
4. If no metadata → interactive wizard prompts for: entity, content column, AppID, BinID, SiteID, Path
|
|
125
|
+
5. Creates `.metadata.json`, submits insert to `/api/input/submit`
|
|
126
|
+
6. Writes returned UID back to metadata file
|
|
127
|
+
7. Suggests running `dbo pull -e <entity> <uid>` to populate all server columns
|
|
128
|
+
|
|
129
|
+
### Non-interactive add (for scripting)
|
|
130
|
+
|
|
131
|
+
To add without prompts, create the `.metadata.json` first, then run `dbo add <file> -y`:
|
|
132
|
+
|
|
133
|
+
```json
|
|
134
|
+
{
|
|
135
|
+
"Name": "colors",
|
|
136
|
+
"Path": "assets/css/colors.css",
|
|
137
|
+
"Content": "@colors.css",
|
|
138
|
+
"_entity": "content",
|
|
139
|
+
"_contentColumns": ["Content"]
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Optional fields like `AppID`, `BinID`, `SiteID` are only included if the user provides values — they have no defaults and are omitted when left blank.
|
|
144
|
+
|
|
145
|
+
The `@colors.css` value means "read content from colors.css in the same directory".
|
|
146
|
+
|
|
147
|
+
### Directory scan (`dbo add .`)
|
|
148
|
+
|
|
149
|
+
Finds files that have no `.metadata.json` or whose metadata lacks `_CreatedOn`. Skips `.dbo/`, `.git/`, `node_modules/`, dotfiles, and `.metadata.json` files. When adding multiple files, defaults from the first file are reused.
|
|
150
|
+
|
|
151
|
+
## Push Command Details
|
|
152
|
+
|
|
153
|
+
`dbo push <path>` pushes local file changes back to existing DBO records using their `.metadata.json`.
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
dbo push assets/css/colors.css # single file
|
|
157
|
+
dbo push assets/ # all records in directory
|
|
158
|
+
dbo push assets/ --content-only # only file content, skip metadata
|
|
159
|
+
dbo push assets/ --meta-only # only metadata columns, skip files
|
|
160
|
+
dbo push assets/ -y --ticket abc123 # auto-accept + ticket
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Flags: `-C/--confirm`, `--ticket <id>`, `--meta-only`, `--content-only`, `-y/--yes`, `--json`, `--jq`, `-v/--verbose`, `--domain`
|
|
164
|
+
|
|
165
|
+
## Column Filtering (add & push)
|
|
166
|
+
|
|
167
|
+
These columns are **never submitted** in add or push payloads:
|
|
168
|
+
- `_CreatedOn`, `_LastUpdated` — server-managed timestamps
|
|
169
|
+
- `_LastUpdatedUserID`, `_LastUpdatedTicketID` — session-provided values
|
|
170
|
+
- `UID` — server-assigned on insert; used as identifier on push (not as column value)
|
|
171
|
+
- `_id`, `_entity`, `_contentColumns`, `_mediaFile` — internal/metadata fields
|
|
172
|
+
|
|
173
|
+
## Pull → Edit → Push/Add Workflow
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
# Pull existing records
|
|
177
|
+
dbo pull -e content --filter 'AppID=10100'
|
|
178
|
+
|
|
179
|
+
# Edit files locally, then push changes back
|
|
180
|
+
dbo push assets/css/colors.css
|
|
181
|
+
|
|
182
|
+
# Or add a brand new file
|
|
183
|
+
dbo add assets/css/newstyle.css
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Clone Command Details
|
|
187
|
+
|
|
188
|
+
`dbo clone` scaffolds a local project from a DBO.io app export JSON, creating directories, files, metadata, and config.
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
# Clone from a local JSON export file
|
|
192
|
+
dbo clone /path/to/app_export.json
|
|
193
|
+
|
|
194
|
+
# Clone from server by app short name (requires login)
|
|
195
|
+
dbo clone --app myapp
|
|
196
|
+
|
|
197
|
+
# Clone using AppShortName already in config
|
|
198
|
+
dbo clone
|
|
199
|
+
|
|
200
|
+
# Init + clone in one step
|
|
201
|
+
dbo init --domain beta-dev.dbo.io --app myapp --clone
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Flags: `--app <name>`, `--domain <host>`, `-y/--yes`, `-v/--verbose`
|
|
205
|
+
|
|
206
|
+
### What clone does
|
|
207
|
+
|
|
208
|
+
1. Loads app JSON (local file, server API, or prompt)
|
|
209
|
+
2. Updates `.dbo/config.json` with `AppID`, `AppUID`, `AppName`, `AppShortName`
|
|
210
|
+
3. Updates `package.json` with `name`, `productName`, `description`, `homepage`, and `deploy` script
|
|
211
|
+
4. Creates directory structure from `children.bin` hierarchy → saves `.dbo/structure.json`
|
|
212
|
+
5. Writes content files (decodes base64) with `*.metadata.json` into bin directories
|
|
213
|
+
6. Downloads media files from server via `/api/media/{uid}` with `*.metadata.json`
|
|
214
|
+
7. Processes other entities with BinID into corresponding directories
|
|
215
|
+
8. Saves `app.json` to project root with `@path/to/*.metadata.json` references
|
|
216
|
+
|
|
217
|
+
### Placement preferences
|
|
218
|
+
|
|
219
|
+
When a record has both `Path`/`FullPath` and `BinID`, clone prompts the user to choose placement. Preferences are saved to `.dbo/config.json` and reused on future clones:
|
|
220
|
+
|
|
221
|
+
- `ContentPlacement`: `bin` | `path` | `ask` — for content and other entities
|
|
222
|
+
- `MediaPlacement`: `bin` | `fullpath` | `ask` — for media files
|
|
223
|
+
|
|
224
|
+
Pre-set these in config.json to skip prompts. `.dbo/config.json` and `.dbo/structure.json` are shared via git; `.dbo/credentials.json` and `.dbo/cookies.txt` are gitignored (per-user).
|
|
225
|
+
|
|
226
|
+
### AppID awareness (add & input)
|
|
227
|
+
|
|
228
|
+
After cloning, the config has an `AppID`. When running `dbo add` or `dbo input` without an AppID in the data, the CLI prompts:
|
|
229
|
+
1. Yes, use AppID from config
|
|
230
|
+
2. No
|
|
231
|
+
3. Enter custom AppID
|
|
232
|
+
|
|
233
|
+
### Init flags for clone
|
|
234
|
+
|
|
235
|
+
`dbo init` now supports `--app <shortName>` and `--clone` flags to combine initialization with app cloning.
|
|
236
|
+
|
|
237
|
+
## Error Handling
|
|
238
|
+
|
|
239
|
+
- If the command fails with a session/authentication error, suggest: `dbo login`
|
|
240
|
+
- If it fails with "No domain configured", suggest: `dbo init`
|
|
241
|
+
- If a command is not found, suggest: `dbo --help`
|
|
242
|
+
|
|
243
|
+
## Output
|
|
244
|
+
|
|
245
|
+
When showing results:
|
|
246
|
+
- Format JSON output readably
|
|
247
|
+
- For pull/push/add operations, list the files created or modified
|
|
248
|
+
- For query operations, summarize the row count and key fields
|