@dboio/cli 0.19.4 → 0.20.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.
package/README.md CHANGED
@@ -140,7 +140,6 @@ my-project/
140
140
  │ │ └── app/ # Default application bin
141
141
  │ ├── automation/ # Automation entity records
142
142
  │ ├── app_version/ # App version entity records
143
- │ ├── entity/ # Entity definitions
144
143
  │ ├── entity_column/ # Column definitions
145
144
  │ ├── entity_column_value/ # Column value definitions
146
145
  │ ├── extension/ # Extension entity records (organized by descriptor type)
@@ -149,7 +148,7 @@ my-project/
149
148
  │ ├── integration/ # Integration entity records
150
149
  │ ├── security/ # Security policy records
151
150
  │ ├── security_column/ # Column-level security records
152
- │ ├── data_source/ # (created when data sources exist)
151
+ │ ├── data_source/ # Data source configs + entity (table) definitions
153
152
  │ ├── group/ # (created when groups exist)
154
153
  │ ├── site/ # (created when sites exist)
155
154
  │ └── redirect/ # (created when redirects exist)
@@ -157,7 +156,9 @@ my-project/
157
156
  ├── test/ # Project-level tests
158
157
  ├── trash/ # Staged soft-deleted files from dbo rm
159
158
  ├── docs/ # Project documentation and docs entities
160
- ├── manifest.json # PWA web app manifest (auto-generated from app metadata)
159
+ ├── manifest.json # PWA web app manifest (root content file — server-tracked)
160
+ ├── CLAUDE.md # Claude Code instructions (root content file — server-tracked)
161
+ ├── README.md # Project readme (root content file — server-tracked)
161
162
  ├── .gitignore # Tells Git to ignore files in the repo sync
162
163
  ├── .dboignore # Tells dbo cli to ignore files in commands
163
164
  ├── package.json # Metadata, scripts, and dependency list
@@ -201,7 +202,9 @@ Per-user settings (plugin scopes, completed migrations) are stored globally in `
201
202
 
202
203
  > **Upgrading to 0.16.0+**: `metadata_templates.json` is renamed to `metadata_schema.json`. The `_contentColumns` field in metadata files is renamed to `_companionReferenceColumns`. Extension companion file prompts during `dbo clone` are replaced by automatic derivation from `descriptor_definition` `form-control-code` data. Migration 011 runs automatically on first use.
203
204
 
204
- > **Upgrading to 0.14.0+**: Metadata files now use `name.metadata~uid.json` instead of `name~uid.metadata.json`. Migration 008 automatically renames all metadata files.
205
+ > **Upgrading to 0.19.0+**: Metadata filenames no longer include `~UID` (e.g. `colors.metadata.json` instead of `colors.metadata~uid.json`). The UID is stored inside the JSON. Migration 013 automatically renames all metadata files.
206
+
207
+ > **Upgrading to 0.14.0+**: Metadata files previously used `name.metadata~uid.json` instead of `name~uid.metadata.json`. Migration 008 handles this rename automatically.
205
208
 
206
209
  > **Upgrading to 0.13.3+**: Entity and extension companion files no longer include `~UID` in the filename. Migration 007 automatically renames legacy files.
207
210
 
@@ -244,6 +247,7 @@ Use `dbo status` to see how many pending migrations exist.
244
247
  | `TicketSuggestionOutput` | string | Output UID for ticket suggestions (auto-set during init, default `ojaie9t3o0kfvliahnuuda`) |
245
248
  | `cloneSource` | `"default"` \| file path \| URL | Where the last `dbo clone` fetched app JSON from. `"default"` = server fetch via `AppShortName`; any other value = the explicit local file path or URL used. Set automatically after each successful clone. |
246
249
  | `ContentPlacement` | `bin` \| `path` | Where to place content files during clone (default: `bin`) |
250
+ | `UserMedia` | `true` \| `false` | Whether to download user media (`/media/<app>/user/...`) during clone. Set on first clone via prompt (or `false` in non-interactive mode). |
247
251
  | `<Entity>FilenameCol` | column name | Filename column for entity-dir records (e.g., `ExtensionFilenameCol`) |
248
252
  | `dependencies` | string[] | Array of app short-names to auto-clone as read-only local checkouts. Default: `["_system"]` |
249
253
  | `dependencyLastUpdated` | object | Map of dependency short-name to last-cloned `_LastUpdated` ISO string |
@@ -286,20 +290,49 @@ Clone of the original app JSON from the server with entity entries replaced by `
286
290
 
287
291
  The `_domain` field in the app metadata file stores the project's reference domain (set during `dbo clone`). This is committed to git and used for domain-change detection when running `dbo init --force` or `dbo clone --domain`. It provides a stable cross-user baseline — all collaborators share the same reference domain.
288
292
 
289
- #### `manifest.json`
293
+ #### Root content files (`manifest.json`, `CLAUDE.md`, `README.md`)
294
+
295
+ Certain files live at the **project root** (not inside `lib/`) but are still tracked and synced to the server as `content` entities. Their metadata companions live in `lib/bins/app/` with a root-relative `@/` reference (`Content: "@/manifest.json"`).
296
+
297
+ | File | Server entity | Public | Description |
298
+ |------|--------------|--------|-------------|
299
+ | `manifest.json` | content | Yes | [PWA web app manifest](https://developer.mozilla.org/en-US/docs/Web/Manifest) |
300
+ | `CLAUDE.md` | content | No | Claude Code project instructions |
301
+ | `README.md` | content | Yes | Project readme |
302
+ | `package.json` | content | No | Node.js package metadata and scripts |
303
+ | `.dboignore` | content | No | DBO CLI ignore patterns |
304
+ | `.gitignore` | content | No | Git ignore patterns |
305
+
306
+ **`dbo clone`** writes all six to the project root. If the server has no record for a file, a stub is generated automatically (`manifest.json` from app metadata, `CLAUDE.md` and `README.md` from app name/description, `package.json` as a minimal stub). Matching works regardless of the server record's `BinID`: records are matched by name, `@`-reference, or `Path`, then relocated to the root — whether they live in `lib/bins/app/`, another bin, or have `BinID=null`. Records with `BinID=null` that aren't in the configured list are also promoted to the project root automatically.
307
+
308
+ **`dbo push`** auto-creates the companion metadata in `lib/bins/app/` for any listed root file that exists locally but has no tracked metadata yet — no manual `dbo adopt` needed before the first push.
309
+
310
+ **`dbo adopt <filename>`** called from the project root also works for any root content file: it bypasses the `.dboignore` check and entity inference, and writes the metadata directly to `lib/bins/app/`.
290
311
 
291
- A [PWA web app manifest](https://developer.mozilla.org/en-US/docs/Web/Manifest) auto-generated during scaffolding (`dbo init` or `dbo clone`). Values are derived from `app.json` when available:
312
+ **`manifest.json`** generated fields (when produced as a stub):
292
313
 
293
314
  | Field | Source |
294
315
  |-------|--------|
295
- | `name` | `<AppName> \| <domain>` |
316
+ | `name` | `AppName` |
296
317
  | `short_name` | `AppShortName` |
297
318
  | `description` | `App.Description` |
298
319
  | `start_url` / `scope` | `/app/<ShortName>/ui/` |
299
- | `background_color` | Extracted from the `widget` extension matching the app's `ShortName` (field `String4`), defaults to `#ffffff` |
320
+ | `background_color` | Extracted from the `widget` extension matching `ShortName` (field `String4`), defaults to `#ffffff` |
300
321
  | `theme_color` | `#000000` |
301
322
 
302
- The file is only created if absent — it is never overwritten by subsequent clones, so local edits (icons, screenshots, display overrides) are preserved. A companion `manifest.metadata.json` is auto-created by `dbo push` if missing, allowing the manifest to be pushed to the server as a content record.
323
+ #### `rootContentFiles` config
324
+
325
+ The list of root content files is stored in `.app/config.json` under `rootContentFiles`:
326
+
327
+ ```json
328
+ {
329
+ "rootContentFiles": ["CLAUDE.md", "README.md", "manifest.json", "package.json", ".dboignore", ".gitignore"]
330
+ }
331
+ ```
332
+
333
+ - **Absent**: defaults are written on the first `dbo push` — `["CLAUDE.md", "README.md", "manifest.json", "package.json", ".dboignore", ".gitignore"]`
334
+ - **`[]`, `false`, or `null`**: feature disabled — no root content files are auto-managed
335
+ - **Custom list**: any filename can be added; metadata is derived from the file extension
303
336
 
304
337
  ### `.dboignore`
305
338
 
@@ -395,7 +428,7 @@ dbo init --scaffold --yes # scaffold dirs non-intera
395
428
  | `--clone` | Clone the app after initialization |
396
429
  | `-g, --global` | Install Claude commands globally (`~/.claude/commands/`) |
397
430
  | `--local` | Install Claude commands to project (`.claude/commands/`) |
398
- | `--scaffold` | Pre-create standard project directories (`app_version`, `automation`, `bins`, `data_source`, `docs`, `extension`, `group`, `integration`, `site`, `src`, `tests`, `trash`) |
431
+ | `--scaffold` | Pre-create standard project directories (`app_version`, `automation`, `bins`, `data_source`, `docs`, `extension`, `group`, `integration`, `site`, `src`, `tests`, `trash`). Note: `data_source/` is always scaffolded and also holds `entity` (table definition) records |
399
432
  | `--dboignore` | Create `.dboignore` with default patterns (use with `--force` to overwrite existing) |
400
433
  | `-y, --yes` | Skip all interactive prompts (legacy migration, Claude Code setup) |
401
434
  | `--non-interactive` | Alias for `--yes` |
@@ -460,8 +493,8 @@ The project's reference domain is stored in `.app/<shortName>.metadata.json._dom
460
493
  6. **Creates directories** — processes `children.bin` to build the directory hierarchy based on `ParentBinID` relationships
461
494
  7. **Saves `.app/directories.json`** — maps BinIDs to directory paths for file placement
462
495
  8. **Writes content files** — decodes base64 content, creates `*.metadata.json` + content files in the correct bin directory. Filename columns and companion file extraction preferences are auto-applied with sensible defaults on first clone (use `--configure` to re-prompt)
463
- 9. **Downloads media files** — fetches binary files (images, CSS, fonts) from the server using a fallback chain: `FullPath` directly (`/media/{app}/{path}`) → `/dir/` route → `/api/media/{uid}`, and saves with metadata. 404 errors create stale metadata to prevent re-prompting. Errors are logged to `.app/errors.log`
464
- 10. **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/`)
496
+ 9. **Downloads media files** — classifies records into three scopes before downloading: `app` (`/media/<app>/app/...` or no FullPath — always downloaded), `user` (`/media/<app>/user/...` — opt-in, preference saved as `UserMedia` in `config.json`), and `foreign` (`/media/<other_app>/...` — silently skipped with stale metadata written). Fetches using a fallback chain: `FullPath` directly (`/media/{app}/{path}`) → `/dir/` route → `/api/media/{uid}`. 404 errors create stale metadata to prevent re-prompting. Errors are logged to `.app/errors.log`
497
+ 10. **Processes entity-dir records** — entities matching project directories (`extension`, `app_version`, `data_source`, `entity`, `site`, `group`, `integration`, `automation`) are saved as `.metadata.json` files in their corresponding directory. Note: `entity` (table definitions) shares `lib/data_source/` with `data_source` records rather than using a separate directory
465
498
  11. **Processes other entities** — remaining entities with a `BinID` are placed in the corresponding bin directory
466
499
  12. **Saves `.app/<shortName>.metadata.json`** — clone of the original JSON with processed entries replaced by `@path/to/*.metadata.json` references
467
500
  13. **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
@@ -526,6 +559,24 @@ This helps keep your app clean by removing database records for media files that
526
559
 
527
560
  In non-interactive mode (`-y`), stale cleanup is skipped (conservative default).
528
561
 
562
+ #### Media scope filtering
563
+
564
+ During `dbo clone`, media records are classified by their `FullPath` relative to the app short name:
565
+
566
+ | Scope | Path pattern | Behavior |
567
+ |-------|-------------|----------|
568
+ | `app` | `/media/<app>/app/...` or no `FullPath` | Always downloaded |
569
+ | `user` | `/media/<app>/user/...` | Downloaded only if `UserMedia=true` in `.app/config.json` |
570
+ | `foreign` | `/media/<other_app>/...` | Never downloaded — stale metadata written to prevent re-prompts |
571
+
572
+ On the first clone with user media present, you'll be prompted once:
573
+
574
+ ```
575
+ App has 14 user media file(s) (e.g. "avatar.jpg"). Download user media? (saves preference)
576
+ ```
577
+
578
+ The answer is saved as `UserMedia` in `.app/config.json` and reused on subsequent clones. In non-interactive mode (`-y`), user media defaults to skipped (`UserMedia=false`).
579
+
529
580
  #### Path resolution
530
581
 
531
582
  When a content record has both `Path` and `BinID`, the CLI prompts:
@@ -537,13 +588,14 @@ Where do you want me to place filename.ext?
537
588
 
538
589
  #### Entity directory processing
539
590
 
540
- Entity types that correspond to project directories (`extension`, `app_version`, `data_source`, `site`, `group`, `integration`, `automation`) are processed into their named directories without requiring a `BinID`:
591
+ Entity types that correspond to project directories (`extension`, `app_version`, `data_source`, `entity`, `site`, `group`, `integration`, `automation`) are processed into their named directories without requiring a `BinID`:
541
592
 
542
593
  | Entity Key | Directory |
543
594
  |------------|-----------|
544
595
  | `extension` | `extension/<Descriptor>/` (see below) |
545
596
  | `app_version` | `app_version/` |
546
597
  | `data_source` | `data_source/` |
598
+ | `entity` | `data_source/` (co-located with data source records) |
547
599
  | `site` | `site/` |
548
600
  | `group` | `group/` |
549
601
  | `integration` | `integration/` |
@@ -553,7 +605,7 @@ For each entity type, the CLI prompts to choose which column becomes the filenam
553
605
 
554
606
  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 `_companionReferenceColumns` array (legacy name: `_contentColumns`, supported for backward compatibility).
555
607
 
556
- **Companion file naming convention:** Only `.metadata.json` files carry the `~UID` suffix (e.g. `Add-Asst-Execute-Security.metadata~wxl6ivcwfkix3zgantszjg.json`). Companion content files use the natural base name without `~UID` (e.g. `Add-Asst-Execute-Security.String5.html`). When a `{title}` is defined in the `@reference` expression (see [Metadata Schema](#metadata-schema)), the title replaces the column name in the filename (e.g. `Add-Asst-Execute-Security.Add-Form-Parameters.js` instead of `Add-Asst-Execute-Security.String5.js`). If two records share the same name within a directory, the second gets a `-1` suffix. Migration 007 automatically renames legacy `~UID` companion files to the natural convention.
608
+ **Companion file naming convention:** Metadata files use `name.metadata.json` (e.g. `Add-Asst-Execute-Security.metadata.json`). The UID is stored inside the JSON, not in the filename. Companion content files use the natural base name (e.g. `Add-Asst-Execute-Security.String5.html`). When a `{title}` is defined in the `@reference` expression (see [Metadata Schema](#metadata-schema)), the title replaces the column name in the filename (e.g. `Add-Asst-Execute-Security.Add-Form-Parameters.js` instead of `Add-Asst-Execute-Security.String5.js`). If two records share the same name within a directory, the second gets a `-1` suffix (e.g. `Add-Asst-Execute-Security-1.metadata.json`); content records have priority over output records for the unsuffixed slot.
557
609
 
558
610
  Use `-y` to skip prompts (uses `Name` column, no content extraction).
559
611
 
@@ -597,7 +649,7 @@ dbo clone -e extension --descriptor-types false # Flat layout (no descript
597
649
 
598
650
  #### Entity children embedding
599
651
 
600
- When a server entity record contains nested child records (e.g., `entity_column` records nested under `entity` parents), `dbo clone` embeds them inline in the parent's `.metadata~uid.json` file under a `children` key:
652
+ When a server entity record contains nested child records (e.g., `entity_column` records nested under `entity` parents), `dbo clone` embeds them inline in the parent's `.metadata.json` file under a `children` key:
601
653
 
602
654
  ```json
603
655
  {
@@ -646,7 +698,8 @@ project/
646
698
  docs/ # ← root-placed documentation MD files (optional)
647
699
  MyDoc.md
648
700
  data_source/
649
- MySQL-Primary.metadata.json
701
+ MySQL-Primary.metadata.json # _entity: "data_source"
702
+ Users.metadata.json # _entity: "entity" (table defs co-locate here)
650
703
  site/
651
704
  MainSite.metadata.json
652
705
  # Media files placed by BinID into bins/ (alongside content)
package/bin/dbo.js CHANGED
@@ -101,4 +101,9 @@ program.addCommand(tagCommand);
101
101
  // Show welcome message on first run
102
102
  checkFirstRun();
103
103
 
104
+ // Show help (exit 0) when invoked with no arguments
105
+ if (process.argv.length <= 2) {
106
+ program.help();
107
+ }
108
+
104
109
  program.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dboio/cli",
3
- "version": "0.19.4",
3
+ "version": "0.20.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.8.2",
3
+ "version": "0.8.3",
4
4
  "description": "DBO.io CLI integration for Claude Code",
5
5
  "author": {
6
6
  "name": "DBO.io"
@@ -15,6 +15,11 @@
15
15
  "path": "skills/white-paper/SKILL.md",
16
16
  "name": "white-paper",
17
17
  "description": "DBO project context and architecture guide — project structure, file-to-server mapping, dependencies, CLI vs API boundaries"
18
+ },
19
+ {
20
+ "path": "skills/cookbook/SKILL.md",
21
+ "name": "cookbook",
22
+ "description": "Operational DOs and DON'Ts for working correctly in any DBO project — file operations, build recipes, metadata handling, gotchas"
18
23
  }
19
24
  ]
20
25
  }
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: dbo
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 — for data reads/writes and runtime queries, use the REST API via curl with .app/cookies.txt instead.
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(dbo build:*), Bash(git stash:*), Bash(grep:*), Bash(which dbo:*)
3
+ description: Run DBO.io CLI commands for local file sync, project management, and deployment (push/pull/clone/adopt/rm/diff/build/deploy). NOT for direct API operations — for data reads/writes and runtime queries, use the REST API via curl with .app/cookies.txt instead.
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 adopt:*), 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(dbo build:*), Bash(git stash:*), Bash(grep:*), Bash(which dbo:*)
5
5
  user-invokable: true
6
6
  ---
7
7
 
@@ -12,7 +12,7 @@ Run `dbo` CLI commands for local file operations, project management, and deploy
12
12
  ## CLI vs REST API — When to use what
13
13
 
14
14
  **Use this CLI skill for file operations:**
15
- - `pull`, `push`, `add`, `clone`, `rm`, `diff` — sync files between local project and server
15
+ - `pull`, `push`, `adopt`, `clone`, `rm`, `diff` — sync files between local project and server
16
16
  - `deploy` — push a file to DBO by UID or named shorthand (shorthands defined in `.app/deploy_config.json`)
17
17
  - `build`, `run` — compile source and run lifecycle scripts (configured in `.app/scripts.json`)
18
18
  - `init`, `login`, `status` — project setup and auth
@@ -43,10 +43,10 @@ dbo $ARGUMENTS
43
43
  | `init` | Initialize `.app/` configuration |
44
44
  | `login` / `logout` | Authenticate / clear session |
45
45
  | `status` | Show config, domain, session info |
46
- | `clone` | Clone an app to local project structure |
47
- | `pull` | Pull records to local files |
46
+ | `clone` | Full project setup: config, bin dirs, dependencies, schema, then all records. Also used to refresh deps/schema without a full re-clone (see below). |
47
+ | `pull` | Content-only update — re-downloads changed records into existing local files. No dependency sync, no config changes, no scaffolding. Use this for routine day-to-day syncing. |
48
48
  | `push` | Push local changes to server |
49
- | `add` | Add a new file to DBO.io |
49
+ | `adopt` | Create metadata companion for a local file (required before `push` for new files). Always pass `-e <entity>` — auto-inference is unreliable for content files. |
50
50
  | `diff` | Compare local files vs server versions |
51
51
  | `rm` | Remove file and stage server deletion |
52
52
  | `deploy` | Push a file to DBO by UID or named shorthand |
@@ -54,6 +54,19 @@ dbo $ARGUMENTS
54
54
  | `run` | Run a named script from `.app/scripts.json` |
55
55
  | `install` | Install/upgrade CLI, plugins (alias: `i`) |
56
56
 
57
+ ## clone vs pull — when to use each
58
+
59
+ | Situation | Command |
60
+ |-----------|---------|
61
+ | First-time project setup | `dbo clone` |
62
+ | Get latest file changes from server (routine) | `dbo pull` |
63
+ | Refresh a dependency app (`app_dependencies/`) | `dbo clone --dependencies <name> -y` |
64
+ | Refresh schema.json from server | `dbo clone --schema -y` (also re-clones records) |
65
+ | Add a new dependency app to the project | `dbo clone --dependencies <name> -y` |
66
+ | Re-clone without touching deps | `dbo clone --no-deps` |
67
+
68
+ `dbo pull` is a subset of `dbo clone`. It calls the same underlying logic but skips config setup, dependency sync, directory scaffolding, and collision detection. Use `pull` whenever you just need updated file content.
69
+
57
70
  ## Common workflows
58
71
 
59
72
  ```bash
@@ -61,6 +74,12 @@ dbo $ARGUMENTS
61
74
  dbo init --domain my-domain.com --app myapp --clone
62
75
  dbo login
63
76
 
77
+ # Routine content sync (day-to-day)
78
+ dbo pull # re-download changed records
79
+ dbo pull -y # auto-accept all incoming changes
80
+ dbo pull -e content # only content records
81
+ dbo pull --dry-run # preview what would change
82
+
64
83
  # Edit and push
65
84
  dbo push # push all changes in current dir
66
85
  dbo push lib/bins/app/assets/ # push specific directory
@@ -76,14 +95,22 @@ dbo push --no-scripts # push without any hooks
76
95
  dbo deploy css:colors # deploy using deploy_config.json shorthand
77
96
  dbo deploy albain3dwkofbhnd1qtd1q # deploy by UID directly
78
97
 
79
- # Pull
80
- dbo pull -e content --filter 'AppID=10100'
81
-
82
- # Add new files
83
- dbo add assets/css/newstyle.css
84
- dbo add . # scan for un-added files
98
+ # Add a new file (adopt → push — both steps required for new assets)
99
+ # Always pass -e <entity>. Auto-inference is unreliable; omitting -e causes failure.
100
+ dbo adopt -e content lib/bins/app/assets/css/newstyle.css # HTML/CSS/JS → content
101
+ dbo push lib/bins/app/assets/css/newstyle.css
102
+ dbo adopt -e media lib/bins/app/assets/img/logo.png # images/binaries → media
103
+ dbo push lib/bins/app/assets/img/logo.png
85
104
 
86
105
  # Compare and merge
87
106
  dbo diff # compare all local vs server
88
107
  dbo diff -y # auto-accept all server changes
108
+
109
+ # Refresh dependencies and/or schema
110
+ # clone is the dependency/schema refresh mechanism — not intuitive from the name.
111
+ # --dependencies adds the app to config.json deps (union) then syncs only those apps (force).
112
+ dbo clone --dependencies operator -y # re-fetch one dependency
113
+ dbo clone --dependencies _system,operator -y # multiple deps (comma-separated)
114
+ dbo clone --schema -y # refresh schema.json (also re-clones records)
115
+ dbo clone --dependencies operator --schema -y # dep + schema in one pass
89
116
  ```
@@ -140,7 +140,6 @@ my-project/
140
140
  │ │ └── app/ # Default application bin
141
141
  │ ├── automation/ # Automation entity records
142
142
  │ ├── app_version/ # App version entity records
143
- │ ├── entity/ # Entity definitions
144
143
  │ ├── entity_column/ # Column definitions
145
144
  │ ├── entity_column_value/ # Column value definitions
146
145
  │ ├── extension/ # Extension entity records (organized by descriptor type)
@@ -149,7 +148,7 @@ my-project/
149
148
  │ ├── integration/ # Integration entity records
150
149
  │ ├── security/ # Security policy records
151
150
  │ ├── security_column/ # Column-level security records
152
- │ ├── data_source/ # (created when data sources exist)
151
+ │ ├── data_source/ # Data source configs + entity (table) definitions
153
152
  │ ├── group/ # (created when groups exist)
154
153
  │ ├── site/ # (created when sites exist)
155
154
  │ └── redirect/ # (created when redirects exist)
@@ -157,7 +156,9 @@ my-project/
157
156
  ├── test/ # Project-level tests
158
157
  ├── trash/ # Staged soft-deleted files from dbo rm
159
158
  ├── docs/ # Project documentation and docs entities
160
- ├── manifest.json # PWA web app manifest (auto-generated from app metadata)
159
+ ├── manifest.json # PWA web app manifest (root content file — server-tracked)
160
+ ├── CLAUDE.md # Claude Code instructions (root content file — server-tracked)
161
+ ├── README.md # Project readme (root content file — server-tracked)
161
162
  ├── .gitignore # Tells Git to ignore files in the repo sync
162
163
  ├── .dboignore # Tells dbo cli to ignore files in commands
163
164
  ├── package.json # Metadata, scripts, and dependency list
@@ -201,7 +202,9 @@ Per-user settings (plugin scopes, completed migrations) are stored globally in `
201
202
 
202
203
  > **Upgrading to 0.16.0+**: `metadata_templates.json` is renamed to `metadata_schema.json`. The `_contentColumns` field in metadata files is renamed to `_companionReferenceColumns`. Extension companion file prompts during `dbo clone` are replaced by automatic derivation from `descriptor_definition` `form-control-code` data. Migration 011 runs automatically on first use.
203
204
 
204
- > **Upgrading to 0.14.0+**: Metadata files now use `name.metadata~uid.json` instead of `name~uid.metadata.json`. Migration 008 automatically renames all metadata files.
205
+ > **Upgrading to 0.19.0+**: Metadata filenames no longer include `~UID` (e.g. `colors.metadata.json` instead of `colors.metadata~uid.json`). The UID is stored inside the JSON. Migration 013 automatically renames all metadata files.
206
+
207
+ > **Upgrading to 0.14.0+**: Metadata files previously used `name.metadata~uid.json` instead of `name~uid.metadata.json`. Migration 008 handles this rename automatically.
205
208
 
206
209
  > **Upgrading to 0.13.3+**: Entity and extension companion files no longer include `~UID` in the filename. Migration 007 automatically renames legacy files.
207
210
 
@@ -244,6 +247,7 @@ Use `dbo status` to see how many pending migrations exist.
244
247
  | `TicketSuggestionOutput` | string | Output UID for ticket suggestions (auto-set during init, default `ojaie9t3o0kfvliahnuuda`) |
245
248
  | `cloneSource` | `"default"` \| file path \| URL | Where the last `dbo clone` fetched app JSON from. `"default"` = server fetch via `AppShortName`; any other value = the explicit local file path or URL used. Set automatically after each successful clone. |
246
249
  | `ContentPlacement` | `bin` \| `path` | Where to place content files during clone (default: `bin`) |
250
+ | `UserMedia` | `true` \| `false` | Whether to download user media (`/media/<app>/user/...`) during clone. Set on first clone via prompt (or `false` in non-interactive mode). |
247
251
  | `<Entity>FilenameCol` | column name | Filename column for entity-dir records (e.g., `ExtensionFilenameCol`) |
248
252
  | `dependencies` | string[] | Array of app short-names to auto-clone as read-only local checkouts. Default: `["_system"]` |
249
253
  | `dependencyLastUpdated` | object | Map of dependency short-name to last-cloned `_LastUpdated` ISO string |
@@ -286,20 +290,49 @@ Clone of the original app JSON from the server with entity entries replaced by `
286
290
 
287
291
  The `_domain` field in the app metadata file stores the project's reference domain (set during `dbo clone`). This is committed to git and used for domain-change detection when running `dbo init --force` or `dbo clone --domain`. It provides a stable cross-user baseline — all collaborators share the same reference domain.
288
292
 
289
- #### `manifest.json`
293
+ #### Root content files (`manifest.json`, `CLAUDE.md`, `README.md`)
294
+
295
+ Certain files live at the **project root** (not inside `lib/`) but are still tracked and synced to the server as `content` entities. Their metadata companions live in `lib/bins/app/` with a root-relative `@/` reference (`Content: "@/manifest.json"`).
296
+
297
+ | File | Server entity | Public | Description |
298
+ |------|--------------|--------|-------------|
299
+ | `manifest.json` | content | Yes | [PWA web app manifest](https://developer.mozilla.org/en-US/docs/Web/Manifest) |
300
+ | `CLAUDE.md` | content | No | Claude Code project instructions |
301
+ | `README.md` | content | Yes | Project readme |
302
+ | `package.json` | content | No | Node.js package metadata and scripts |
303
+ | `.dboignore` | content | No | DBO CLI ignore patterns |
304
+ | `.gitignore` | content | No | Git ignore patterns |
305
+
306
+ **`dbo clone`** writes all six to the project root. If the server has no record for a file, a stub is generated automatically (`manifest.json` from app metadata, `CLAUDE.md` and `README.md` from app name/description, `package.json` as a minimal stub). Matching works regardless of the server record's `BinID`: records are matched by name, `@`-reference, or `Path`, then relocated to the root — whether they live in `lib/bins/app/`, another bin, or have `BinID=null`. Records with `BinID=null` that aren't in the configured list are also promoted to the project root automatically.
307
+
308
+ **`dbo push`** auto-creates the companion metadata in `lib/bins/app/` for any listed root file that exists locally but has no tracked metadata yet — no manual `dbo adopt` needed before the first push.
309
+
310
+ **`dbo adopt <filename>`** called from the project root also works for any root content file: it bypasses the `.dboignore` check and entity inference, and writes the metadata directly to `lib/bins/app/`.
290
311
 
291
- A [PWA web app manifest](https://developer.mozilla.org/en-US/docs/Web/Manifest) auto-generated during scaffolding (`dbo init` or `dbo clone`). Values are derived from `app.json` when available:
312
+ **`manifest.json`** generated fields (when produced as a stub):
292
313
 
293
314
  | Field | Source |
294
315
  |-------|--------|
295
- | `name` | `<AppName> \| <domain>` |
316
+ | `name` | `AppName` |
296
317
  | `short_name` | `AppShortName` |
297
318
  | `description` | `App.Description` |
298
319
  | `start_url` / `scope` | `/app/<ShortName>/ui/` |
299
- | `background_color` | Extracted from the `widget` extension matching the app's `ShortName` (field `String4`), defaults to `#ffffff` |
320
+ | `background_color` | Extracted from the `widget` extension matching `ShortName` (field `String4`), defaults to `#ffffff` |
300
321
  | `theme_color` | `#000000` |
301
322
 
302
- The file is only created if absent — it is never overwritten by subsequent clones, so local edits (icons, screenshots, display overrides) are preserved. A companion `manifest.metadata.json` is auto-created by `dbo push` if missing, allowing the manifest to be pushed to the server as a content record.
323
+ #### `rootContentFiles` config
324
+
325
+ The list of root content files is stored in `.app/config.json` under `rootContentFiles`:
326
+
327
+ ```json
328
+ {
329
+ "rootContentFiles": ["CLAUDE.md", "README.md", "manifest.json", "package.json", ".dboignore", ".gitignore"]
330
+ }
331
+ ```
332
+
333
+ - **Absent**: defaults are written on the first `dbo push` — `["CLAUDE.md", "README.md", "manifest.json", "package.json", ".dboignore", ".gitignore"]`
334
+ - **`[]`, `false`, or `null`**: feature disabled — no root content files are auto-managed
335
+ - **Custom list**: any filename can be added; metadata is derived from the file extension
303
336
 
304
337
  ### `.dboignore`
305
338
 
@@ -395,7 +428,7 @@ dbo init --scaffold --yes # scaffold dirs non-intera
395
428
  | `--clone` | Clone the app after initialization |
396
429
  | `-g, --global` | Install Claude commands globally (`~/.claude/commands/`) |
397
430
  | `--local` | Install Claude commands to project (`.claude/commands/`) |
398
- | `--scaffold` | Pre-create standard project directories (`app_version`, `automation`, `bins`, `data_source`, `docs`, `extension`, `group`, `integration`, `site`, `src`, `tests`, `trash`) |
431
+ | `--scaffold` | Pre-create standard project directories (`app_version`, `automation`, `bins`, `data_source`, `docs`, `extension`, `group`, `integration`, `site`, `src`, `tests`, `trash`). Note: `data_source/` is always scaffolded and also holds `entity` (table definition) records |
399
432
  | `--dboignore` | Create `.dboignore` with default patterns (use with `--force` to overwrite existing) |
400
433
  | `-y, --yes` | Skip all interactive prompts (legacy migration, Claude Code setup) |
401
434
  | `--non-interactive` | Alias for `--yes` |
@@ -460,8 +493,8 @@ The project's reference domain is stored in `.app/<shortName>.metadata.json._dom
460
493
  6. **Creates directories** — processes `children.bin` to build the directory hierarchy based on `ParentBinID` relationships
461
494
  7. **Saves `.app/directories.json`** — maps BinIDs to directory paths for file placement
462
495
  8. **Writes content files** — decodes base64 content, creates `*.metadata.json` + content files in the correct bin directory. Filename columns and companion file extraction preferences are auto-applied with sensible defaults on first clone (use `--configure` to re-prompt)
463
- 9. **Downloads media files** — fetches binary files (images, CSS, fonts) from the server using a fallback chain: `FullPath` directly (`/media/{app}/{path}`) → `/dir/` route → `/api/media/{uid}`, and saves with metadata. 404 errors create stale metadata to prevent re-prompting. Errors are logged to `.app/errors.log`
464
- 10. **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/`)
496
+ 9. **Downloads media files** — classifies records into three scopes before downloading: `app` (`/media/<app>/app/...` or no FullPath — always downloaded), `user` (`/media/<app>/user/...` — opt-in, preference saved as `UserMedia` in `config.json`), and `foreign` (`/media/<other_app>/...` — silently skipped with stale metadata written). Fetches using a fallback chain: `FullPath` directly (`/media/{app}/{path}`) → `/dir/` route → `/api/media/{uid}`. 404 errors create stale metadata to prevent re-prompting. Errors are logged to `.app/errors.log`
497
+ 10. **Processes entity-dir records** — entities matching project directories (`extension`, `app_version`, `data_source`, `entity`, `site`, `group`, `integration`, `automation`) are saved as `.metadata.json` files in their corresponding directory. Note: `entity` (table definitions) shares `lib/data_source/` with `data_source` records rather than using a separate directory
465
498
  11. **Processes other entities** — remaining entities with a `BinID` are placed in the corresponding bin directory
466
499
  12. **Saves `.app/<shortName>.metadata.json`** — clone of the original JSON with processed entries replaced by `@path/to/*.metadata.json` references
467
500
  13. **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
@@ -526,6 +559,24 @@ This helps keep your app clean by removing database records for media files that
526
559
 
527
560
  In non-interactive mode (`-y`), stale cleanup is skipped (conservative default).
528
561
 
562
+ #### Media scope filtering
563
+
564
+ During `dbo clone`, media records are classified by their `FullPath` relative to the app short name:
565
+
566
+ | Scope | Path pattern | Behavior |
567
+ |-------|-------------|----------|
568
+ | `app` | `/media/<app>/app/...` or no `FullPath` | Always downloaded |
569
+ | `user` | `/media/<app>/user/...` | Downloaded only if `UserMedia=true` in `.app/config.json` |
570
+ | `foreign` | `/media/<other_app>/...` | Never downloaded — stale metadata written to prevent re-prompts |
571
+
572
+ On the first clone with user media present, you'll be prompted once:
573
+
574
+ ```
575
+ App has 14 user media file(s) (e.g. "avatar.jpg"). Download user media? (saves preference)
576
+ ```
577
+
578
+ The answer is saved as `UserMedia` in `.app/config.json` and reused on subsequent clones. In non-interactive mode (`-y`), user media defaults to skipped (`UserMedia=false`).
579
+
529
580
  #### Path resolution
530
581
 
531
582
  When a content record has both `Path` and `BinID`, the CLI prompts:
@@ -537,13 +588,14 @@ Where do you want me to place filename.ext?
537
588
 
538
589
  #### Entity directory processing
539
590
 
540
- Entity types that correspond to project directories (`extension`, `app_version`, `data_source`, `site`, `group`, `integration`, `automation`) are processed into their named directories without requiring a `BinID`:
591
+ Entity types that correspond to project directories (`extension`, `app_version`, `data_source`, `entity`, `site`, `group`, `integration`, `automation`) are processed into their named directories without requiring a `BinID`:
541
592
 
542
593
  | Entity Key | Directory |
543
594
  |------------|-----------|
544
595
  | `extension` | `extension/<Descriptor>/` (see below) |
545
596
  | `app_version` | `app_version/` |
546
597
  | `data_source` | `data_source/` |
598
+ | `entity` | `data_source/` (co-located with data source records) |
547
599
  | `site` | `site/` |
548
600
  | `group` | `group/` |
549
601
  | `integration` | `integration/` |
@@ -553,7 +605,7 @@ For each entity type, the CLI prompts to choose which column becomes the filenam
553
605
 
554
606
  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 `_companionReferenceColumns` array (legacy name: `_contentColumns`, supported for backward compatibility).
555
607
 
556
- **Companion file naming convention:** Only `.metadata.json` files carry the `~UID` suffix (e.g. `Add-Asst-Execute-Security.metadata~wxl6ivcwfkix3zgantszjg.json`). Companion content files use the natural base name without `~UID` (e.g. `Add-Asst-Execute-Security.String5.html`). When a `{title}` is defined in the `@reference` expression (see [Metadata Schema](#metadata-schema)), the title replaces the column name in the filename (e.g. `Add-Asst-Execute-Security.Add-Form-Parameters.js` instead of `Add-Asst-Execute-Security.String5.js`). If two records share the same name within a directory, the second gets a `-1` suffix. Migration 007 automatically renames legacy `~UID` companion files to the natural convention.
608
+ **Companion file naming convention:** Metadata files use `name.metadata.json` (e.g. `Add-Asst-Execute-Security.metadata.json`). The UID is stored inside the JSON, not in the filename. Companion content files use the natural base name (e.g. `Add-Asst-Execute-Security.String5.html`). When a `{title}` is defined in the `@reference` expression (see [Metadata Schema](#metadata-schema)), the title replaces the column name in the filename (e.g. `Add-Asst-Execute-Security.Add-Form-Parameters.js` instead of `Add-Asst-Execute-Security.String5.js`). If two records share the same name within a directory, the second gets a `-1` suffix (e.g. `Add-Asst-Execute-Security-1.metadata.json`); content records have priority over output records for the unsuffixed slot.
557
609
 
558
610
  Use `-y` to skip prompts (uses `Name` column, no content extraction).
559
611
 
@@ -597,7 +649,7 @@ dbo clone -e extension --descriptor-types false # Flat layout (no descript
597
649
 
598
650
  #### Entity children embedding
599
651
 
600
- When a server entity record contains nested child records (e.g., `entity_column` records nested under `entity` parents), `dbo clone` embeds them inline in the parent's `.metadata~uid.json` file under a `children` key:
652
+ When a server entity record contains nested child records (e.g., `entity_column` records nested under `entity` parents), `dbo clone` embeds them inline in the parent's `.metadata.json` file under a `children` key:
601
653
 
602
654
  ```json
603
655
  {
@@ -646,7 +698,8 @@ project/
646
698
  docs/ # ← root-placed documentation MD files (optional)
647
699
  MyDoc.md
648
700
  data_source/
649
- MySQL-Primary.metadata.json
701
+ MySQL-Primary.metadata.json # _entity: "data_source"
702
+ Users.metadata.json # _entity: "entity" (table defs co-locate here)
650
703
  site/
651
704
  MainSite.metadata.json
652
705
  # Media files placed by BinID into bins/ (alongside content)