@dboio/cli 0.11.3 → 0.13.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 (50) hide show
  1. package/README.md +126 -3
  2. package/bin/dbo.js +4 -0
  3. package/package.json +1 -1
  4. package/plugins/claude/dbo/.claude-plugin/plugin.json +1 -1
  5. package/plugins/claude/dbo/commands/dbo.md +65 -244
  6. package/plugins/claude/dbo/docs/_audit_required/API/all.md +40 -0
  7. package/plugins/claude/dbo/docs/_audit_required/API/app.md +38 -0
  8. package/plugins/claude/dbo/docs/_audit_required/API/athenticate.md +26 -0
  9. package/plugins/claude/dbo/docs/_audit_required/API/cache.md +29 -0
  10. package/plugins/claude/dbo/docs/_audit_required/API/content.md +14 -0
  11. package/plugins/claude/dbo/docs/_audit_required/API/data_source.md +28 -0
  12. package/plugins/claude/dbo/docs/_audit_required/API/email.md +18 -0
  13. package/plugins/claude/dbo/docs/_audit_required/API/input.md +25 -0
  14. package/plugins/claude/dbo/docs/_audit_required/API/instance.md +28 -0
  15. package/plugins/claude/dbo/docs/_audit_required/API/log.md +8 -0
  16. package/plugins/claude/dbo/docs/_audit_required/API/media.md +12 -0
  17. package/plugins/claude/dbo/docs/_audit_required/API/output_by_entity.md +12 -0
  18. package/plugins/claude/dbo/docs/_audit_required/API/upload.md +7 -0
  19. package/plugins/claude/dbo/docs/_audit_required/dbo-api-syntax.md +1487 -0
  20. package/plugins/claude/dbo/docs/_audit_required/dbo-problems-code.md +111 -0
  21. package/plugins/claude/dbo/docs/_audit_required/dbo-problems-performance.md +109 -0
  22. package/plugins/claude/dbo/docs/_audit_required/dbo-problems-syntax.md +97 -0
  23. package/plugins/claude/dbo/docs/_audit_required/dbo-product-market.md +119 -0
  24. package/plugins/claude/dbo/docs/_audit_required/dbo-white-paper.md +125 -0
  25. package/plugins/claude/dbo/docs/dbo-cheat-sheet.md +323 -0
  26. package/plugins/claude/dbo/docs/dbo-cli-readme.md +2222 -0
  27. package/plugins/claude/dbo/docs/dbo-core-entities.md +878 -0
  28. package/plugins/claude/dbo/docs/dbo-output-customsql.md +677 -0
  29. package/plugins/claude/dbo/docs/dbo-output-query.md +967 -0
  30. package/plugins/claude/dbo/skills/cli/SKILL.md +62 -246
  31. package/src/commands/add.js +366 -62
  32. package/src/commands/build.js +102 -0
  33. package/src/commands/clone.js +602 -139
  34. package/src/commands/diff.js +4 -0
  35. package/src/commands/init.js +16 -2
  36. package/src/commands/input.js +3 -1
  37. package/src/commands/mv.js +12 -4
  38. package/src/commands/push.js +265 -70
  39. package/src/commands/rm.js +16 -3
  40. package/src/commands/run.js +81 -0
  41. package/src/lib/client.js +4 -7
  42. package/src/lib/config.js +39 -0
  43. package/src/lib/delta.js +7 -1
  44. package/src/lib/diff.js +24 -2
  45. package/src/lib/filenames.js +120 -41
  46. package/src/lib/ignore.js +6 -0
  47. package/src/lib/input-parser.js +13 -4
  48. package/src/lib/scripts.js +232 -0
  49. package/src/lib/toe-stepping.js +17 -2
  50. package/src/migrations/006-remove-uid-companion-filenames.js +181 -0
@@ -1,280 +1,96 @@
1
1
  ---
2
2
  name: cli
3
- description: Execute DBO.io CLI commands (pull, push, add, clone, output, input, content, deploy, etc.)
3
+ description: Run DBO.io CLI commands for local file sync, project management, and deployment (push/pull/clone/add/rm/diff/build/deploy). NOT for direct API operations — use docs/ for that.
4
4
  user-invokable: true
5
5
  ---
6
6
 
7
- # DBO CLI Command
7
+ # DBO CLI Skill
8
8
 
9
- The dbo CLI interacts with DBO.io a database-driven application framework.
9
+ Run `dbo` CLI commands for local file sync, project management, and deployment.
10
10
 
11
- **STEP 1: Check if `$ARGUMENTS` is empty or blank.**
11
+ ## When to use this skill
12
12
 
13
- If `$ARGUMENTS` is empty — meaning the user typed just `/dbo:cli` 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
+ Use this skill when the user wants to:
14
+ - Run a local workflow command (push, pull, clone, add, rm, diff, build, deploy)
15
+ - Set up a project (`dbo init`, `dbo login`, `dbo clone`)
16
+ - Deploy files to the server (`dbo push`, `dbo deploy`)
14
17
 
15
- ---
18
+ ## When NOT to use this skill
16
19
 
17
- Hi there! I can help you with running dbo commands. What would you like to do?
20
+ Do NOT use this skill for direct API operations. The following CLI commands are thin wrappers around REST endpoints — use the `docs/` reference instead for the canonical API syntax:
21
+ - `dbo input` wraps `POST /api/input/submit` — use `docs/dbo-cheat-sheet.md`
22
+ - `dbo output` wraps `GET /api/output/` — use `docs/dbo-output-query.md`
23
+ - `dbo content` wraps `GET /api/content/` — use `docs/dbo-cheat-sheet.md`
24
+ - `dbo media` wraps `GET /api/media/` — use `docs/dbo-cheat-sheet.md`
25
+ - `dbo upload` wraps `POST /api/upload/submit` — use `docs/dbo-cheat-sheet.md`
26
+ - `dbo message` wraps `GET /api/message/` — use `docs/dbo-cheat-sheet.md`
27
+ - `dbo cache` wraps `/api/cache/` — use `docs/dbo-cheat-sheet.md`
18
28
 
19
- Here are the available commands:
29
+ Also do NOT use this skill for:
30
+ - **Entity schemas / column names** — use `docs/dbo-core-entities.md`
31
+ - **Token/tag syntax** (`#{...}`, `<#_embed>`, etc.) — use `docs/dbo-cheat-sheet.md`
32
+ - **Building server-side templates or content records** — use `docs/`
20
33
 
21
- | Command | Description |
22
- |-----------|--------------------------------------------------|
23
- | init | Initialize .dbo/ configuration |
24
- | login | Authenticate with a DBO.io instance |
25
- | logout | Clear session |
26
- | status | Show config, domain, and session info |
27
- | input | Submit CRUD operations (add/edit/delete records) |
28
- | output | Query data from outputs or entities |
29
- | content | Get or deploy content |
30
- | media | Get media files |
31
- | upload | Upload a file |
32
- | message | Send messages (email, SMS, chatbot) |
33
- | pull | Pull records to local files |
34
- | push | Push local files back to DBO.io |
35
- | add | Add a new file to DBO.io |
36
- | clone | Clone an app to local project structure |
37
- | diff | Compare local files with server versions |
38
- | rm | Remove a file and stage server deletion |
39
- | deploy | Deploy via manifest |
40
- | cache | Manage cache |
41
- | install | Install or upgrade CLI, plugins, Claude commands (shorthand: `i`) |
34
+ All doc files are bundled in the `docs/` subdirectory of this plugin (copied during npm publish). When working in the repo, the API docs are at the repo root `docs/` and the CLI README is at `tools/cli/README.md`.
42
35
 
43
- Just tell me what you'd like to do and I'll help you build the right command!
36
+ For detailed CLI command flags, options, and behavior read `docs/dbo-cli-readme.md`.
44
37
 
45
- ---
38
+ ## Running commands
46
39
 
47
- 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.
40
+ **If `$ARGUMENTS` is empty**, show the command table and guide interactively.
48
41
 
49
- **STEP 2: If `$ARGUMENTS` is NOT empty, run the command:**
42
+ **If `$ARGUMENTS` is provided**, run:
50
43
 
51
44
  ```bash
52
45
  dbo $ARGUMENTS
53
46
  ```
54
47
 
55
- ## Command Reference
56
-
57
- Available subcommands:
58
- - `init` — Initialize .dbo/ configuration for the current directory
59
- - `login` — Authenticate with a DBO.io instance
60
- - `logout` — Clear session
61
- - `status` — Show config, domain, and session info
62
- - `input -d '<expr>'` — CRUD operations (add/edit/delete records)
63
- - `output -e <entity>` — Query data from entities
64
- - `output <uid>` — Query custom outputs
65
- - `content <uid>` — Get content, `content deploy <uid> <file>` to deploy
66
- - `pull [uid]` — Pull records to local files (default: content entity)
67
- - `pull -e <entity> [uid]` — Pull from any entity
68
- - `push <path>` — Push local files back to DBO using metadata
69
- - `add <path>` — Add a new file to DBO (creates record on server)
70
- - `media <uid>` — Get media files
71
- - `upload <file>` — Upload binary files
72
- - `message <uid>` — Send messages (email, SMS, chatbot)
73
- - `cache list|refresh` — Manage cache
74
- - `clone [source]` — Clone an app to local project (from file or server)
75
- - `clone --app <name>` — Clone by app short name from server
76
- - `diff [path]` — Compare local files against server and selectively merge changes
77
- - `diff -y` — Accept all server changes without prompting
78
- - `diff --no-interactive` — Show diffs without prompting to accept
79
- - `rm <file>` — Remove a file locally and stage server deletion for next push
80
- - `rm <directory>` — Remove a directory, all files, and sub-directories recursively
81
- - `rm -f <path>` — Remove without confirmation prompts
82
- - `rm --keep-local <path>` — Stage server deletions without deleting local files/directories
83
- - `deploy [name]` — Deploy via .dbo/deploy_config.json manifest
84
- - `install` (alias: `i`) — Install or upgrade CLI, plugins, or Claude commands
85
- - `i dbo` or `i dbo@latest` — Install/upgrade the CLI from npm
86
- - `i dbo@0.4.1` — Install a specific CLI version
87
- - `install /path/to/src` — Install CLI from local source
88
- - `install plugins` — Install/upgrade Claude command plugins
89
- - `install plugins --global` — Install plugins to `~/.claude/commands/` (shared across projects)
90
- - `install plugins --local` — Install plugins to `.claude/commands/` (project only)
91
- - `install claudecommands` — Install/upgrade Claude Code commands
92
- - `install claudecode` — Install Claude Code CLI + commands
93
- - `install --claudecommand dbo --global` — Install a specific command globally
94
-
95
- ## Change Detection (pull, clone, diff)
96
-
97
- When pulling or cloning records that already exist locally, the CLI compares file modification times against the server's `_LastUpdated` timestamp. If the server has newer data, you'll be prompted with options:
98
-
99
- 1. **Overwrite** — Replace local files with server version
100
- 2. **Compare** — Show a line-by-line diff and selectively merge
101
- 3. **Skip** — Keep local files unchanged
102
- 4. **Overwrite all** — Accept all remaining server changes
103
- 5. **Skip all** — Skip all remaining files
104
-
105
- Use `dbo diff [path]` to compare without pulling. Use `-y` to auto-accept all changes.
106
-
107
- ## Smart Command Building
108
-
109
- When helping the user build a command interactively:
110
-
111
- 1. **Check readiness first**: Run `dbo status` to see if initialized and authenticated. If not, guide them through `dbo init` and `dbo login` first.
112
- 2. **Understand intent**: Ask what they want to do (query data, deploy a file, add a record, etc.)
113
- 3. **Gather parameters**: Ask for the specific values needed (entity name, UID, file path, filters, etc.)
114
- 4. **Build the command**: Construct the full `dbo` command with proper flags and syntax
115
- 5. **Execute**: Run it and explain the results
116
-
117
- ### Common workflows to suggest:
118
-
119
- - **"I want to query data"** → Guide toward `dbo output -e <entity>` with filters
120
- - **"I want to deploy/update a file"** → Check if `.metadata.json` exists → `dbo push` or `dbo content deploy`
121
- - **"I want to add a new file"** → `dbo add <path>` (will create metadata interactively)
122
- - **"I want to pull files from the server"** → `dbo pull` or `dbo pull -e <entity>`
123
- - **"I want to delete/remove a file"** → `dbo rm <file>` (stages deletion for next `dbo push`)
124
- - **"I want to delete a directory"** → `dbo rm <directory>` (removes all files + sub-dirs, stages bin deletions)
125
- - **"I want to see what's on the server"** → `dbo output -e <entity> --format json`
126
- - **"I need to set up this project"** → `dbo init` → `dbo login` → `dbo status`
127
- - **"I want to clone an app"** → `dbo clone --app <name>` or `dbo clone <local.json>`
128
- - **"I want to set up and clone"** → `dbo init --domain <host> --app <name> --clone`
129
-
130
- ## Add Command Details
131
-
132
- `dbo add <path>` registers a new local file with the DBO server by creating an insert record.
133
-
134
- ```bash
135
- # Add a single file (interactive metadata wizard if no .metadata.json exists)
136
- dbo add assets/css/colors.css
137
-
138
- # Add with auto-accept and ticket
139
- dbo add assets/css/colors.css -y --ticket abc123
140
-
141
- # Scan current directory for all un-added files
142
- dbo add .
143
-
144
- # Scan a specific directory
145
- dbo add assets/
146
- ```
147
-
148
- Flags: `-C/--confirm <true|false>`, `--ticket <id>`, `-y/--yes`, `--json`, `--jq <expr>`, `-v/--verbose`, `--domain <host>`
149
-
150
- ### How add works
151
-
152
- 1. Checks for a companion `<basename>.metadata.json` next to the file
153
- 2. If metadata exists with `_CreatedOn` → already on server, skips (use `push` instead)
154
- 3. If metadata exists without `_CreatedOn` → uses it to insert the record
155
- 4. If no metadata → interactive wizard prompts for: entity, content column, AppID, BinID, SiteID, Path
156
- 5. Creates `.metadata.json`, submits insert to `/api/input/submit`
157
- 6. Writes returned UID back to metadata file
158
- 7. Suggests running `dbo pull -e <entity> <uid>` to populate all server columns
159
-
160
- ### Non-interactive add (for scripting)
161
-
162
- To add without prompts, create the `.metadata.json` first, then run `dbo add <file> -y`:
163
-
164
- ```json
165
- {
166
- "Name": "colors",
167
- "Path": "assets/css/colors.css",
168
- "Content": "@colors.css",
169
- "_entity": "content",
170
- "_contentColumns": ["Content"]
171
- }
172
- ```
173
-
174
- Optional fields like `AppID`, `BinID`, `SiteID` are only included if the user provides values — they have no defaults and are omitted when left blank.
175
-
176
- The `@colors.css` value means "read content from colors.css in the same directory".
177
-
178
- ### Directory scan (`dbo add .`)
48
+ ## Command overview
179
49
 
180
- 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.
50
+ These are the local workflow commands this skill covers:
181
51
 
182
- ## Push Command Details
52
+ | Command | Description |
53
+ |---------|-------------|
54
+ | `init` | Initialize .dbo/ configuration |
55
+ | `login` / `logout` | Authenticate / clear session |
56
+ | `status` | Show config, domain, session info |
57
+ | `clone` | Clone an app to local project |
58
+ | `pull` | Pull records to local files |
59
+ | `push` | Push local changes (default: current dir) |
60
+ | `add` | Add a new file to DBO.io |
61
+ | `diff` | Compare local vs server |
62
+ | `rm` | Remove file, stage server deletion |
63
+ | `deploy` | Deploy via .dbo/deploy_config.json manifest |
64
+ | `build` | Run build hooks (.dbo/scripts.json) |
65
+ | `run` | Run named script (.dbo/scripts.json) |
66
+ | `install` | Install/upgrade CLI, plugins (alias: `i`) |
183
67
 
184
- `dbo push <path>` pushes local file changes back to existing DBO records using their `.metadata.json`.
68
+ ## Common workflows
185
69
 
186
70
  ```bash
187
- dbo push assets/css/colors.css # single file
188
- dbo push assets/ # all records in directory
189
- dbo push assets/ --content-only # only file content, skip metadata
190
- dbo push assets/ --meta-only # only metadata columns, skip files
191
- dbo push assets/ -y --ticket abc123 # auto-accept + ticket
192
- ```
193
-
194
- Flags: `-C/--confirm`, `--ticket <id>`, `--meta-only`, `--content-only`, `-y/--yes`, `--json`, `--jq`, `-v/--verbose`, `--domain`
195
-
196
- ## Column Filtering (add & push)
71
+ # Setup
72
+ dbo init --domain my-domain.com --app myapp --clone
73
+ dbo login
197
74
 
198
- These columns are **never submitted** in add or push payloads:
199
- - `_CreatedOn`, `_LastUpdated` server-managed timestamps
200
- - `_LastUpdatedUserID`, `_LastUpdatedTicketID` session-provided values
201
- - `UID` server-assigned on insert; used as identifier on push (not as column value)
202
- - `_id`, `_entity`, `_contentColumns`, `_mediaFile` — internal/metadata fields
75
+ # Edit and push
76
+ dbo push # push all changes in current dir
77
+ dbo push lib/bins/app/assets/ # push specific directory
78
+ dbo push colors.css # push single file
203
79
 
204
- ## Pull Edit Push/Add Workflow
80
+ # Build and push (with script hooks)
81
+ dbo build # run build hooks only
82
+ dbo push # build + push (hooks run automatically)
83
+ dbo push --no-build # push without build phase
84
+ dbo push --no-scripts # push without any hooks
205
85
 
206
- ```bash
207
- # Pull existing records
86
+ # Pull
208
87
  dbo pull -e content --filter 'AppID=10100'
209
88
 
210
- # Edit files locally, then push changes back
211
- dbo push assets/css/colors.css
212
-
213
- # Or add a brand new file
89
+ # Add new files
214
90
  dbo add assets/css/newstyle.css
215
- ```
216
-
217
- ## Clone Command Details
91
+ dbo add . # scan for un-added files
218
92
 
219
- `dbo clone` scaffolds a local project from a DBO.io app export JSON, creating directories, files, metadata, and config.
220
-
221
- ```bash
222
- # Clone from a local JSON export file
223
- dbo clone /path/to/app_export.json
224
-
225
- # Clone from server by app short name (requires login)
226
- dbo clone --app myapp
227
-
228
- # Clone using AppShortName already in config
229
- dbo clone
230
-
231
- # Init + clone in one step
232
- dbo init --domain my-domain.com --app myapp --clone
93
+ # Compare and merge
94
+ dbo diff # compare all local vs server
95
+ dbo diff -y # auto-accept all server changes
233
96
  ```
234
-
235
- Flags: `--app <name>`, `--domain <host>`, `-y/--yes`, `-v/--verbose`
236
-
237
- ### What clone does
238
-
239
- 1. Loads app JSON (local file, server API, or prompt)
240
- 2. Updates `.dbo/config.json` with `AppID`, `AppUID`, `AppName`, `AppShortName`
241
- 3. Updates `package.json` with `name`, `productName`, `description`, `homepage`, and `deploy` script
242
- 4. Creates directory structure from `children.bin` hierarchy → saves `.dbo/structure.json`
243
- 5. Writes content files (decodes base64) with `*.metadata.json` into bin directories
244
- 6. Downloads media files from server using fallback chain: FullPath (`/media/{app}/{path}`) → `/dir/` route → `/api/media/{uid}`, with `*.metadata.json`. Errors logged to `.dbo/errors.log`
245
- 7. Processes entity-dir records (`extension`, `app_version`, `data_source`, `site`, `group`, `integration`, `automation`) into `lib/` project directories as `.metadata.json` files with optional companion content files
246
- 8. Processes remaining entities with BinID into corresponding bin directories
247
- 9. Saves `app.json` to project root with `@path/to/*.metadata.json` references
248
-
249
- ### Placement preferences
250
-
251
- 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:
252
-
253
- - `ContentPlacement`: `bin` | `path` | `ask` — for content and other entities
254
- - `MediaPlacement`: `bin` | `fullpath` | `ask` — for media files
255
-
256
- 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).
257
-
258
- ### AppID awareness (add & input)
259
-
260
- After cloning, the config has an `AppID`. When running `dbo add` or `dbo input` without an AppID in the data, the CLI prompts:
261
- 1. Yes, use AppID from config
262
- 2. No
263
- 3. Enter custom AppID
264
-
265
- ### Init flags for clone
266
-
267
- `dbo init` now supports `--app <shortName>` and `--clone` flags to combine initialization with app cloning.
268
-
269
- ## Error Handling
270
-
271
- - If the command fails with a session/authentication error, suggest: `dbo login`
272
- - If it fails with "No domain configured", suggest: `dbo init`
273
- - If a command is not found, suggest: `dbo --help`
274
-
275
- ## Output
276
-
277
- When showing results:
278
- - Format JSON output readably
279
- - For pull/push/add operations, list the files created or modified
280
- - For query operations, summarize the row count and key fields