@dboio/cli 0.11.4 → 0.15.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 (57) hide show
  1. package/README.md +183 -3
  2. package/bin/dbo.js +6 -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 +66 -243
  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 +2279 -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 +63 -246
  31. package/src/commands/add.js +373 -64
  32. package/src/commands/build.js +102 -0
  33. package/src/commands/clone.js +719 -212
  34. package/src/commands/deploy.js +9 -2
  35. package/src/commands/diff.js +7 -3
  36. package/src/commands/init.js +16 -2
  37. package/src/commands/input.js +3 -1
  38. package/src/commands/login.js +30 -4
  39. package/src/commands/mv.js +28 -7
  40. package/src/commands/push.js +298 -78
  41. package/src/commands/rm.js +21 -6
  42. package/src/commands/run.js +81 -0
  43. package/src/commands/tag.js +65 -0
  44. package/src/lib/config.js +67 -0
  45. package/src/lib/delta.js +7 -1
  46. package/src/lib/deploy-config.js +137 -0
  47. package/src/lib/diff.js +28 -5
  48. package/src/lib/filenames.js +198 -54
  49. package/src/lib/ignore.js +6 -0
  50. package/src/lib/input-parser.js +13 -4
  51. package/src/lib/scaffold.js +1 -1
  52. package/src/lib/scripts.js +232 -0
  53. package/src/lib/tagging.js +380 -0
  54. package/src/lib/toe-stepping.js +2 -1
  55. package/src/migrations/006-remove-uid-companion-filenames.js +181 -0
  56. package/src/migrations/007-natural-entity-companion-filenames.js +165 -0
  57. package/src/migrations/008-metadata-uid-in-suffix.js +70 -0
package/README.md CHANGED
@@ -181,13 +181,26 @@ All configuration is **directory-scoped**. Each project folder maintains its own
181
181
  | `metadata_templates.json` | Column templates per entity/descriptor (auto-generated by `dbo clone`) | Committable (shared) |
182
182
  | `synchronize.json` | Pending deletions and sync state (updated by `dbo rm` and `dbo push`) | Committable (shared) |
183
183
  | `.app_baseline.json` | Server-state snapshot for delta detection — stores column values at last clone/push so `dbo push` can detect which columns changed locally. Read-only (chmod 444); auto-migrated from legacy root `.app.json`. | Committable (shared) |
184
+ | `scripts.json` | Build/push lifecycle hooks (see [Script Hooks](#script-hooks)) | Committable (shared) |
185
+ | `scripts.local.json` | Per-user hook overrides | Gitignored (per-user) |
184
186
 
185
- `dbo init` automatically adds `.dbo/credentials.json`, `.dbo/cookies.txt`, `.dbo/config.local.json`, and `.dbo/ticketing.local.json` to `.gitignore` (creates the file if it doesn't exist).
187
+ `dbo init` automatically adds `.dbo/credentials.json`, `.dbo/cookies.txt`, `.dbo/config.local.json`, `.dbo/ticketing.local.json`, and `.dbo/scripts.local.json` to `.gitignore` (creates the file if it doesn't exist).
186
188
 
187
189
  > **Upgrading from pre-0.9.9**: The baseline file `.app.json` in the project root has moved to `.dbo/.app_baseline.json`. Running any `dbo` command will auto-migrate the file. You can also manually remove the `.app.json` entry from your `.gitignore`.
188
190
 
189
191
  > **Upgrading from pre-0.11.0**: `TransactionKeyPreset` now applies only to records that carry a `UID` column (core assets). Data records without a UID are always submitted with `RowID` regardless of the preset. Migration 001 runs automatically on first command after upgrade and logs a one-time notice.
190
192
 
193
+ > **Upgrading to 0.13.3+**: Entity and extension companion files no longer include `~UID` in the filename. Migration 007 automatically renames legacy `name~uid.Column.ext` files to `name.Column.ext` and updates `@references` in metadata.
194
+
195
+ > **Upgrading to 0.14.0+**: Metadata files now use `name.metadata~uid.json` instead of `name~uid.metadata.json`. The UID has moved from the base name into the `.metadata~uid` suffix. Migration 008 automatically renames all metadata files. Output child companions use index-based naming (`Sales.column.CustomSQL.sql`, `Sales.column-1.CustomSQL.sql`) instead of UID-based naming.
196
+ >
197
+ > | Record type | Example metadata file |
198
+ > |---|---|
199
+ > | Content | `colors.metadata~abc123.json` |
200
+ > | Media | `logo.png.metadata~def456.json` |
201
+ > | Output | `Sales.metadata~ghi789.json` |
202
+ > | Extension | `MyExtension.metadata~jkl012.json` |
203
+
191
204
  #### Automatic migrations
192
205
 
193
206
  When the CLI version is upgraded, one-time migration scripts in `tools/cli/src/migrations/` run automatically on the first command invocation in a project directory. Completed migration IDs are recorded in `.dbo/config.local.json` under `_completedMigrations` (per-user, gitignored) so each developer runs them independently and they never re-fire.
@@ -411,6 +424,7 @@ The project's reference domain is stored in `app.json._domain` (committed to git
411
424
  8. **Processes entity-dir records** — entities matching project directories (`extension`, `app_version`, `data_source`, `site`, `group`, `integration`, `automation`) are saved as `.metadata.json` files in their corresponding directory (e.g., `extension/`, `data_source/`)
412
425
  9. **Processes other entities** — remaining entities with a `BinID` are placed in the corresponding bin directory
413
426
  10. **Saves `app.json`** — clone of the original JSON with processed entries replaced by `@path/to/*.metadata.json` references
427
+ 11. **Orphan cleanup** — any local `.metadata.json` files whose UID is absent from the server response are automatically moved to `trash/` along with their companion content and media files. This prevents stale records (deleted server-side) from causing false positives in `dbo push`. Skipped during `--entity-filter` clones
414
428
 
415
429
  #### Clone source tracking
416
430
 
@@ -495,6 +509,8 @@ For each entity type, the CLI prompts to choose which column becomes the filenam
495
509
 
496
510
  If any columns contain base64-encoded content, the CLI prompts to extract them as companion files. Extracted columns produce files named `<name>.<Column>.<ext>` alongside the metadata, with `@reference` entries in the metadata and a `_contentColumns` array.
497
511
 
512
+ **Companion file naming convention:** Only `.metadata.json` files carry the `~UID` suffix (e.g. `Add-Asst-Execute-Security~wxl6ivcwfkix3zgantszjg.metadata.json`). Companion content files use the natural base name without `~UID` (e.g. `Add-Asst-Execute-Security.String16.js`). If two records share the same name within a directory, the second gets a `-1` suffix (e.g. `Add-Asst-Execute-Security-1.String16.js` with metadata `Add-Asst-Execute-Security-1~otheruid.metadata.json`). Migration 007 automatically renames legacy `~UID` companion files to the natural convention.
513
+
498
514
  Use `-y` to skip prompts (uses `Name` column, no content extraction).
499
515
 
500
516
  #### Extension descriptor sub-directories
@@ -1237,7 +1253,10 @@ The push command finds `assets/js/main.metadata.json`, reads the UID and entity,
1237
1253
  #### Directory (recursive)
1238
1254
 
1239
1255
  ```bash
1240
- # Push all records in a directory
1256
+ # Push all changed records in the current directory
1257
+ dbo push
1258
+
1259
+ # Push all records in a specific directory
1241
1260
  dbo push assets/
1242
1261
 
1243
1262
  # Push with auto-accept for all prompts
@@ -1280,7 +1299,7 @@ The `@colors.css` reference tells push to read the content from that file. All o
1280
1299
 
1281
1300
  | Flag | Description |
1282
1301
  |------|-------------|
1283
- | `<path>` | File or directory to push |
1302
+ | `[path]` | File or directory to push (default: current directory) |
1284
1303
  | `-C, --confirm <true\|false>` | Commit (default: `true`) |
1285
1304
  | `--ticket <id>` | Override ticket ID |
1286
1305
  | `--modify-key <key>` | Provide ModifyKey directly (skips interactive prompt) |
@@ -1289,6 +1308,8 @@ The `@colors.css` reference tells push to read the content from that file. All o
1289
1308
  | `--content-only` | Only push file content, skip metadata |
1290
1309
  | `-y, --yes` | Auto-accept all prompts |
1291
1310
  | `--toe-stepping <true\|false>` | Check server for conflicts before pushing (default: `true`). Set to `false` to skip the check and push unconditionally |
1311
+ | `--no-scripts` | Bypass all script hooks; run default push pipeline |
1312
+ | `--no-build` | Skip the build phase; run push phase only |
1292
1313
  | `--json` | Output raw JSON |
1293
1314
  | `--jq <expr>` | Filter JSON response |
1294
1315
 
@@ -1300,6 +1321,31 @@ You can then choose to overwrite the server changes or cancel and pull first. Us
1300
1321
 
1301
1322
  ---
1302
1323
 
1324
+ ### `dbo tag`
1325
+
1326
+ Apply macOS Finder color tags or Linux gio emblems to companion files based on their sync status relative to the server. Tags are automatically refreshed after `dbo clone` and `dbo push`.
1327
+
1328
+ | Tag | Color | Meaning |
1329
+ |-----|-------|---------|
1330
+ | `dbo:Synced` | 🟢 Green | File matches server — no local changes |
1331
+ | `dbo:Modified` | 🔵 Blue | Local edits not yet pushed |
1332
+ | `dbo:Untracked` | 🟡 Yellow | No metadata — not yet added with `dbo add` |
1333
+ | `dbo:Trashed` | 🔴 Red | File is in the `trash/` directory |
1334
+
1335
+ ```bash
1336
+ dbo tag # Refresh tags for all project files
1337
+ dbo tag --clear # Remove all dbo:* tags (preserves other Finder tags)
1338
+ dbo tag --status # Show counts per category
1339
+ dbo tag --verbose # Log each file and its status
1340
+ dbo tag path/to/dir # Tag a specific file or directory subtree
1341
+ dbo tag --enable # Enable automatic tagging after clone/push (default)
1342
+ dbo tag --disable # Disable automatic tagging
1343
+ ```
1344
+
1345
+ Tagging is silently skipped on Windows and unsupported platforms. Only macOS (Finder color tags via `xattr`) and Linux (gio emblems) are supported. The `--clear` flag only removes `dbo:*` prefixed tags, preserving any user-applied Finder tags.
1346
+
1347
+ ---
1348
+
1303
1349
  ### `dbo rm`
1304
1350
 
1305
1351
  Remove a file or directory locally and stage server deletions for the next `dbo push`. Similar to `git rm`.
@@ -1765,6 +1811,25 @@ Create a `.dbo/deploy_config.json` file to define named deployments:
1765
1811
 
1766
1812
  This replaces the curl commands typically embedded in `package.json` scripts.
1767
1813
 
1814
+ #### Automatic deploy config generation
1815
+
1816
+ When you run `dbo clone` or `dbo add`, each companion file (CSS, JS, HTML, SQL, etc.) is automatically registered in `.dbo/deploy_config.json` under an `<extension>:<name>` key — no manual authoring needed:
1817
+
1818
+ ```bash
1819
+ dbo clone # → .dbo/deploy_config.json auto-populated with one entry per companion file
1820
+ ```
1821
+
1822
+ Keys are derived as `<extension>:<basename>` from the companion file path. If two files share the same key, a parent directory segment is appended to disambiguate (`css:colors` and `css:admin/colors`). Entries include `entity` and `column` from the record metadata.
1823
+
1824
+ Once generated, you can deploy by name or by UID:
1825
+
1826
+ ```bash
1827
+ dbo deploy css:colors # deploy by key name
1828
+ dbo deploy cdlftyk2lkg21whojzqqoa # deploy by UID (scans manifest values)
1829
+ ```
1830
+
1831
+ Entries are updated automatically on re-clone (path changes are reflected in place) and removed when you run `dbo rm`. When you `dbo mv` a file, the old entry is removed and a new entry is inserted with the correct key for the new path.
1832
+
1768
1833
  #### Non-interactive mode (npm scripts)
1769
1834
 
1770
1835
  When running `dbo deploy` (or any submission command) inside npm scripts or piped commands where stdin is not a TTY, the CLI automatically skips all interactive prompts and uses stored credentials:
@@ -1794,6 +1859,121 @@ To set up for non-interactive use:
1794
1859
 
1795
1860
  ---
1796
1861
 
1862
+ ## Script Hooks
1863
+
1864
+ Script hooks let you define build and push lifecycle commands in `.dbo/scripts.json`. Hooks run automatically during `dbo push` and can also be triggered independently with `dbo build` and `dbo run`.
1865
+
1866
+ ### Configuration Files
1867
+
1868
+ | File | Tracked | Purpose |
1869
+ |------|---------|---------|
1870
+ | `.dbo/scripts.json` | Yes | Shared hook definitions (committed to git) |
1871
+ | `.dbo/scripts.local.json` | No | Per-user overrides (gitignored) |
1872
+
1873
+ ### Top-level Keys
1874
+
1875
+ | Key | Description |
1876
+ |-----|-------------|
1877
+ | `scripts` | Global hooks and named scripts (apply to all targets) |
1878
+ | `targets` | Per-file or per-directory hooks (highest priority) |
1879
+ | `entities` | Per-entity-type hooks (e.g., `content`, `extension.control`) |
1880
+
1881
+ ### Example `.dbo/scripts.json`
1882
+
1883
+ ```json
1884
+ {
1885
+ "scripts": {
1886
+ "prepush": "echo pushing $DBO_TARGET"
1887
+ },
1888
+ "targets": {
1889
+ "lib/bins/app/assets/js/operator.js": {
1890
+ "build": "rollup -c src/rollup_config.mjs",
1891
+ "push": false
1892
+ }
1893
+ },
1894
+ "entities": {
1895
+ "extension.control": {
1896
+ "prebuild": "npm run compile-controls"
1897
+ }
1898
+ }
1899
+ }
1900
+ ```
1901
+
1902
+ ### Lifecycle Hooks
1903
+
1904
+ | Hook | Phase | Description |
1905
+ |------|-------|-------------|
1906
+ | `prebuild` | Build | Runs before build |
1907
+ | `build` | Build | Main build step |
1908
+ | `postbuild` | Build | Runs after build |
1909
+ | `prepush` | Push | Runs before push |
1910
+ | `push` | Push | Custom push (replaces default HTTP submit) |
1911
+ | `postpush` | Push | Runs after push |
1912
+
1913
+ ### Resolution Order
1914
+
1915
+ Hooks resolve per-hook from lowest to highest priority:
1916
+
1917
+ 1. **Global** (`scripts`) — applies to all targets
1918
+ 2. **Entity** (`entities`) — applies to targets matching the entity type
1919
+ 3. **Target** (`targets`) — applies to a specific file or directory
1920
+
1921
+ A target can override `build` while the global `prepush` still applies.
1922
+
1923
+ ### Hook Value Types
1924
+
1925
+ | Value | Behavior |
1926
+ |-------|----------|
1927
+ | `"command"` | Run as shell command |
1928
+ | `["cmd1", "cmd2"]` | Run sequentially; fail-fast on first non-zero exit |
1929
+ | `false` | Skip (for `push`: skip HTTP submit) |
1930
+ | `true` / omitted | Use default behavior |
1931
+
1932
+ ### Environment Variables
1933
+
1934
+ These env vars are injected into all hook processes:
1935
+
1936
+ | Variable | Description |
1937
+ |----------|-------------|
1938
+ | `DBO_TARGET` | Relative file path being processed |
1939
+ | `DBO_ENTITY` | Entity type (e.g., `content`, `extension`) |
1940
+ | `DBO_DOMAIN` | Configured domain |
1941
+ | `DBO_APP` | App short name |
1942
+ | `DBO_APP_UID` | App UID |
1943
+
1944
+ ### Push Flags
1945
+
1946
+ | Flag | Description |
1947
+ |------|-------------|
1948
+ | `--no-scripts` | Bypass all script hooks; run default push pipeline |
1949
+ | `--no-build` | Skip build phase; run push phase only |
1950
+
1951
+ ### `dbo build [path]`
1952
+
1953
+ Runs the build lifecycle (`prebuild` → `build` → `postbuild`) without pushing.
1954
+
1955
+ ```bash
1956
+ # Build a specific target
1957
+ dbo build lib/bins/app/assets/js/operator.js
1958
+
1959
+ # Build all targets with a build hook
1960
+ dbo build
1961
+ ```
1962
+
1963
+ ### `dbo run [script-name]`
1964
+
1965
+ Runs a named global script from `.dbo/scripts.json` (like `npm run`). Automatically runs `pre<name>` and `post<name>` scripts if defined.
1966
+
1967
+ ```bash
1968
+ # List all available scripts
1969
+ dbo run
1970
+
1971
+ # Run a specific script
1972
+ dbo run prepush
1973
+ ```
1974
+
1975
+ ---
1976
+
1797
1977
  ## Global Flags
1798
1978
 
1799
1979
  These flags are available on most commands:
package/bin/dbo.js CHANGED
@@ -31,6 +31,9 @@ import { diffCommand } from '../src/commands/diff.js';
31
31
  import { rmCommand } from '../src/commands/rm.js';
32
32
  import { mvCommand } from '../src/commands/mv.js';
33
33
  import { syncCommand } from '../src/commands/sync.js';
34
+ import { buildCommand } from '../src/commands/build.js';
35
+ import { runCommand } from '../src/commands/run.js';
36
+ import { tagCommand } from '../src/commands/tag.js';
34
37
 
35
38
  // First-run welcome message
36
39
  function checkFirstRun() {
@@ -91,6 +94,9 @@ program.addCommand(diffCommand);
91
94
  program.addCommand(rmCommand);
92
95
  program.addCommand(mvCommand);
93
96
  program.addCommand(syncCommand);
97
+ program.addCommand(buildCommand);
98
+ program.addCommand(runCommand);
99
+ program.addCommand(tagCommand);
94
100
 
95
101
  // Show welcome message on first run
96
102
  checkFirstRun();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dboio/cli",
3
- "version": "0.11.4",
3
+ "version": "0.15.0",
4
4
  "description": "CLI for the DBO.io framework",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dbo",
3
- "version": "0.6.8",
3
+ "version": "0.8.0",
4
4
  "description": "DBO.io CLI integration for Claude Code",
5
5
  "author": {
6
6
  "name": "DBO.io"
@@ -1,274 +1,97 @@
1
- # DBO CLI Command
2
-
3
- The dbo CLI interacts with DBO.io — a database-driven application framework.
4
-
5
- **STEP 1: Check if `$ARGUMENTS` is empty or blank.**
6
-
7
- 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:
8
-
9
1
  ---
10
-
11
- Hi there! I can help you with running dbo commands. What would you like to do?
12
-
13
- Here are the available commands:
14
-
15
- | Command | Description |
16
- |-----------|--------------------------------------------------|
17
- | init | Initialize .dbo/ configuration |
18
- | login | Authenticate with a DBO.io instance |
19
- | logout | Clear session |
20
- | status | Show config, domain, and session info |
21
- | input | Submit CRUD operations (add/edit/delete records) |
22
- | output | Query data from outputs or entities |
23
- | content | Get or deploy content |
24
- | media | Get media files |
25
- | upload | Upload a file |
26
- | message | Send messages (email, SMS, chatbot) |
27
- | pull | Pull records to local files |
28
- | push | Push local files back to DBO.io |
29
- | add | Add a new file to DBO.io |
30
- | clone | Clone an app to local project structure |
31
- | diff | Compare local files with server versions |
32
- | rm | Remove a file and stage server deletion |
33
- | deploy | Deploy via manifest |
34
- | cache | Manage cache |
35
- | install | Install or upgrade CLI, plugins, Claude commands (shorthand: `i`) |
36
-
37
- Just tell me what you'd like to do and I'll help you build the right command!
38
-
2
+ name: cli
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
+ allowed-tools: Read, Write, Glob, Bash(git status:*), Bash(git branch:*), Bash(git diff:*), Bash(ls:*), Bash(dbo init:*), Bash(dbo login:*), Bash(dbo status:*), Bash(dbo deploy:*), Bash(dbo add:*), Bash(dbo clone:*), Bash(dbo push:*), Bash(dbo pull:*), Bash(dbo diff:*), Bash(dbo rm:*), Bash(dbo mv:*), Bash(dbo run:*), Bash(dbo install:*), Bash(git stash:*), Bash(grep:*), Bash(which dbo:*)
5
+ user-invokable: true
39
6
  ---
40
7
 
41
- 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.
42
-
43
- **STEP 2: If `$ARGUMENTS` is NOT empty, run the command:**
44
-
45
- ```bash
46
- dbo $ARGUMENTS
47
- ```
48
-
49
- ## Command Reference
8
+ # DBO CLI Skill
50
9
 
51
- Available subcommands:
52
- - `init` — Initialize .dbo/ configuration for the current directory
53
- - `login` — Authenticate with a DBO.io instance
54
- - `logout` — Clear session
55
- - `status` — Show config, domain, and session info
56
- - `input -d '<expr>'` — CRUD operations (add/edit/delete records)
57
- - `output -e <entity>` — Query data from entities
58
- - `output <uid>` — Query custom outputs
59
- - `content <uid>` — Get content, `content deploy <uid> <file>` to deploy
60
- - `pull [uid]` — Pull records to local files (default: content entity)
61
- - `pull -e <entity> [uid]` — Pull from any entity
62
- - `push <path>` — Push local files back to DBO using metadata
63
- - `add <path>` — Add a new file to DBO (creates record on server)
64
- - `media <uid>` — Get media files
65
- - `upload <file>` — Upload binary files
66
- - `message <uid>` — Send messages (email, SMS, chatbot)
67
- - `cache list|refresh` — Manage cache
68
- - `clone [source]` — Clone an app to local project (from file or server)
69
- - `clone --app <name>` — Clone by app short name from server
70
- - `diff [path]` — Compare local files against server and selectively merge changes
71
- - `diff -y` — Accept all server changes without prompting
72
- - `diff --no-interactive` — Show diffs without prompting to accept
73
- - `rm <file>` — Remove a file locally and stage server deletion for next push
74
- - `rm <directory>` — Remove a directory, all files, and sub-directories recursively
75
- - `rm -f <path>` — Remove without confirmation prompts
76
- - `rm --keep-local <path>` — Stage server deletions without deleting local files/directories
77
- - `deploy [name]` — Deploy via .dbo/deploy_config.json manifest
78
- - `install` (alias: `i`) — Install or upgrade CLI, plugins, or Claude commands
79
- - `i dbo` or `i dbo@latest` — Install/upgrade the CLI from npm
80
- - `i dbo@0.4.1` — Install a specific CLI version
81
- - `install /path/to/src` — Install CLI from local source
82
- - `install plugins` — Install/upgrade Claude command plugins
83
- - `install plugins --global` — Install plugins to `~/.claude/commands/` (shared across projects)
84
- - `install plugins --local` — Install plugins to `.claude/commands/` (project only)
85
- - `install claudecommands` — Install/upgrade Claude Code commands
86
- - `install claudecode` — Install Claude Code CLI + commands
87
- - `install --claudecommand dbo --global` — Install a specific command globally
10
+ Run `dbo` CLI commands for local file sync, project management, and deployment.
88
11
 
89
- ## Change Detection (pull, clone, diff)
12
+ ## When to use this skill
90
13
 
91
- 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:
14
+ Use this skill when the user wants to:
15
+ - Run a local workflow command (push, pull, clone, add, rm, diff, build, deploy)
16
+ - Set up a project (`dbo init`, `dbo login`, `dbo clone`)
17
+ - Deploy files to the server (`dbo push`, `dbo deploy`)
92
18
 
93
- 1. **Overwrite** Replace local files with server version
94
- 2. **Compare** — Show a line-by-line diff and selectively merge
95
- 3. **Skip** — Keep local files unchanged
96
- 4. **Overwrite all** — Accept all remaining server changes
97
- 5. **Skip all** — Skip all remaining files
19
+ ## When NOT to use this skill
98
20
 
99
- Use `dbo diff [path]` to compare without pulling. Use `-y` to auto-accept all changes.
21
+ 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:
22
+ - `dbo input` wraps `POST /api/input/submit` — use `docs/dbo-cheat-sheet.md`
23
+ - `dbo output` wraps `GET /api/output/` — use `docs/dbo-output-query.md`
24
+ - `dbo content` wraps `GET /api/content/` — use `docs/dbo-cheat-sheet.md`
25
+ - `dbo media` wraps `GET /api/media/` — use `docs/dbo-cheat-sheet.md`
26
+ - `dbo upload` wraps `POST /api/upload/submit` — use `docs/dbo-cheat-sheet.md`
27
+ - `dbo message` wraps `GET /api/message/` — use `docs/dbo-cheat-sheet.md`
28
+ - `dbo cache` wraps `/api/cache/` — use `docs/dbo-cheat-sheet.md`
100
29
 
101
- ## Smart Command Building
30
+ Also do NOT use this skill for:
31
+ - **Entity schemas / column names** — use `docs/dbo-core-entities.md`
32
+ - **Token/tag syntax** (`#{...}`, `<#_embed>`, etc.) — use `docs/dbo-cheat-sheet.md`
33
+ - **Building server-side templates or content records** — use `docs/`
102
34
 
103
- When helping the user build a command interactively:
35
+ 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`.
104
36
 
105
- 1. **Check readiness first**: Run `dbo status` to see if initialized and authenticated. If not, guide them through `dbo init` and `dbo login` first.
106
- 2. **Understand intent**: Ask what they want to do (query data, deploy a file, add a record, etc.)
107
- 3. **Gather parameters**: Ask for the specific values needed (entity name, UID, file path, filters, etc.)
108
- 4. **Build the command**: Construct the full `dbo` command with proper flags and syntax
109
- 5. **Execute**: Run it and explain the results
37
+ For detailed CLI command flags, options, and behavior read `docs/dbo-cli-readme.md`.
110
38
 
111
- ### Common workflows to suggest:
39
+ ## Running commands
112
40
 
113
- - **"I want to query data"** Guide toward `dbo output -e <entity>` with filters
114
- - **"I want to deploy/update a file"** → Check if `.metadata.json` exists → `dbo push` or `dbo content deploy`
115
- - **"I want to add a new file"** → `dbo add <path>` (will create metadata interactively)
116
- - **"I want to pull files from the server"** → `dbo pull` or `dbo pull -e <entity>`
117
- - **"I want to delete/remove a file"** → `dbo rm <file>` (stages deletion for next `dbo push`)
118
- - **"I want to delete a directory"** → `dbo rm <directory>` (removes all files + sub-dirs, stages bin deletions)
119
- - **"I want to see what's on the server"** → `dbo output -e <entity> --format json`
120
- - **"I need to set up this project"** → `dbo init` → `dbo login` → `dbo status`
121
- - **"I want to clone an app"** → `dbo clone --app <name>` or `dbo clone <local.json>`
122
- - **"I want to set up and clone"** → `dbo init --domain <host> --app <name> --clone`
41
+ **If `$ARGUMENTS` is empty**, show the command table and guide interactively.
123
42
 
124
- ## Add Command Details
125
-
126
- `dbo add <path>` registers a new local file with the DBO server by creating an insert record.
43
+ **If `$ARGUMENTS` is provided**, check if command exists in the command table in the available commands (use best guess, eg: initialize => init), then on match run the command:**:
127
44
 
128
45
  ```bash
129
- # Add a single file (interactive metadata wizard if no .metadata.json exists)
130
- dbo add assets/css/colors.css
131
-
132
- # Add with auto-accept and ticket
133
- dbo add assets/css/colors.css -y --ticket abc123
134
-
135
- # Scan current directory for all un-added files
136
- dbo add .
137
-
138
- # Scan a specific directory
139
- dbo add assets/
140
- ```
141
-
142
- Flags: `-C/--confirm <true|false>`, `--ticket <id>`, `-y/--yes`, `--json`, `--jq <expr>`, `-v/--verbose`, `--domain <host>`
143
-
144
- ### How add works
145
-
146
- 1. Checks for a companion `<basename>.metadata.json` next to the file
147
- 2. If metadata exists with `_CreatedOn` → already on server, skips (use `push` instead)
148
- 3. If metadata exists without `_CreatedOn` → uses it to insert the record
149
- 4. If no metadata → interactive wizard prompts for: entity, content column, AppID, BinID, SiteID, Path
150
- 5. Creates `.metadata.json`, submits insert to `/api/input/submit`
151
- 6. Writes returned UID back to metadata file
152
- 7. Suggests running `dbo pull -e <entity> <uid>` to populate all server columns
153
-
154
- ### Non-interactive add (for scripting)
155
-
156
- To add without prompts, create the `.metadata.json` first, then run `dbo add <file> -y`:
157
-
158
- ```json
159
- {
160
- "Name": "colors",
161
- "Path": "assets/css/colors.css",
162
- "Content": "@colors.css",
163
- "_entity": "content",
164
- "_contentColumns": ["Content"]
165
- }
46
+ dbo $ARGUMENTS
166
47
  ```
167
48
 
168
- Optional fields like `AppID`, `BinID`, `SiteID` are only included if the user provides values — they have no defaults and are omitted when left blank.
169
-
170
- The `@colors.css` value means "read content from colors.css in the same directory".
171
-
172
- ### Directory scan (`dbo add .`)
49
+ ## Command overview
173
50
 
174
- 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.
51
+ These are the local workflow commands this skill covers:
175
52
 
176
- ## Push Command Details
53
+ | Command | Description |
54
+ |---------|-------------|
55
+ | `init` | Initialize .dbo/ configuration |
56
+ | `login` / `logout` | Authenticate / clear session |
57
+ | `status` | Show config, domain, session info |
58
+ | `clone` | Clone an app to local project |
59
+ | `pull` | Pull records to local files |
60
+ | `push` | Push local changes (default: current dir) |
61
+ | `add` | Add a new file to DBO.io |
62
+ | `diff` | Compare local vs server |
63
+ | `rm` | Remove file, stage server deletion |
64
+ | `deploy` | Deploy via .dbo/deploy_config.json manifest |
65
+ | `build` | Run build hooks (.dbo/scripts.json) |
66
+ | `run` | Run named script (.dbo/scripts.json) |
67
+ | `install` | Install/upgrade CLI, plugins (alias: `i`) |
177
68
 
178
- `dbo push <path>` pushes local file changes back to existing DBO records using their `.metadata.json`.
69
+ ## Common workflows
179
70
 
180
71
  ```bash
181
- dbo push assets/css/colors.css # single file
182
- dbo push assets/ # all records in directory
183
- dbo push assets/ --content-only # only file content, skip metadata
184
- dbo push assets/ --meta-only # only metadata columns, skip files
185
- dbo push assets/ -y --ticket abc123 # auto-accept + ticket
186
- ```
187
-
188
- Flags: `-C/--confirm`, `--ticket <id>`, `--meta-only`, `--content-only`, `-y/--yes`, `--json`, `--jq`, `-v/--verbose`, `--domain`
189
-
190
- ## Column Filtering (add & push)
72
+ # Setup
73
+ dbo init --domain my-domain.com --app myapp --clone
74
+ dbo login
191
75
 
192
- These columns are **never submitted** in add or push payloads:
193
- - `_CreatedOn`, `_LastUpdated` server-managed timestamps
194
- - `_LastUpdatedUserID`, `_LastUpdatedTicketID` session-provided values
195
- - `UID` server-assigned on insert; used as identifier on push (not as column value)
196
- - `_id`, `_entity`, `_contentColumns`, `_mediaFile` — internal/metadata fields
76
+ # Edit and push
77
+ dbo push # push all changes in current dir
78
+ dbo push lib/bins/app/assets/ # push specific directory
79
+ dbo push colors.css # push single file
197
80
 
198
- ## Pull Edit Push/Add Workflow
81
+ # Build and push (with script hooks)
82
+ dbo build # run build hooks only
83
+ dbo push # build + push (hooks run automatically)
84
+ dbo push --no-build # push without build phase
85
+ dbo push --no-scripts # push without any hooks
199
86
 
200
- ```bash
201
- # Pull existing records
87
+ # Pull
202
88
  dbo pull -e content --filter 'AppID=10100'
203
89
 
204
- # Edit files locally, then push changes back
205
- dbo push assets/css/colors.css
206
-
207
- # Or add a brand new file
90
+ # Add new files
208
91
  dbo add assets/css/newstyle.css
209
- ```
210
-
211
- ## Clone Command Details
92
+ dbo add . # scan for un-added files
212
93
 
213
- `dbo clone` scaffolds a local project from a DBO.io app export JSON, creating directories, files, metadata, and config.
214
-
215
- ```bash
216
- # Clone from a local JSON export file
217
- dbo clone /path/to/app_export.json
218
-
219
- # Clone from server by app short name (requires login)
220
- dbo clone --app myapp
221
-
222
- # Clone using AppShortName already in config
223
- dbo clone
224
-
225
- # Init + clone in one step
226
- dbo init --domain my-domain.com --app myapp --clone
94
+ # Compare and merge
95
+ dbo diff # compare all local vs server
96
+ dbo diff -y # auto-accept all server changes
227
97
  ```
228
-
229
- Flags: `--app <name>`, `--domain <host>`, `-y/--yes`, `-v/--verbose`
230
-
231
- ### What clone does
232
-
233
- 1. Loads app JSON (local file, server API, or prompt)
234
- 2. Updates `.dbo/config.json` with `AppID`, `AppUID`, `AppName`, `AppShortName`
235
- 3. Updates `package.json` with `name`, `productName`, `description`, `homepage`, and `deploy` script
236
- 4. Creates directory structure from `children.bin` hierarchy → saves `.dbo/structure.json`
237
- 5. Writes content files (decodes base64) with `*.metadata.json` into bin directories
238
- 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`
239
- 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
240
- 8. Processes remaining entities with BinID into corresponding bin directories
241
- 9. Saves `app.json` to project root with `@path/to/*.metadata.json` references
242
-
243
- ### Placement preferences
244
-
245
- 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:
246
-
247
- - `ContentPlacement`: `bin` | `path` | `ask` — for content and other entities
248
- - `MediaPlacement`: `bin` | `fullpath` | `ask` — for media files
249
-
250
- 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).
251
-
252
- ### AppID awareness (add & input)
253
-
254
- After cloning, the config has an `AppID`. When running `dbo add` or `dbo input` without an AppID in the data, the CLI prompts:
255
- 1. Yes, use AppID from config
256
- 2. No
257
- 3. Enter custom AppID
258
-
259
- ### Init flags for clone
260
-
261
- `dbo init` now supports `--app <shortName>` and `--clone` flags to combine initialization with app cloning.
262
-
263
- ## Error Handling
264
-
265
- - If the command fails with a session/authentication error, suggest: `dbo login`
266
- - If it fails with "No domain configured", suggest: `dbo init`
267
- - If a command is not found, suggest: `dbo --help`
268
-
269
- ## Output
270
-
271
- When showing results:
272
- - Format JSON output readably
273
- - For pull/push/add operations, list the files created or modified
274
- - For query operations, summarize the row count and key fields