@dboio/cli 0.19.0 → 0.19.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dboio/cli",
3
- "version": "0.19.0",
3
+ "version": "0.19.2",
4
4
  "description": "CLI for the DBO.io framework",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,8 +1,20 @@
1
1
  {
2
2
  "name": "dbo",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
4
4
  "description": "DBO.io CLI integration for Claude Code",
5
5
  "author": {
6
6
  "name": "DBO.io"
7
- }
7
+ },
8
+ "hooks": [
9
+ {
10
+ "path": "hooks/hooks.json"
11
+ }
12
+ ],
13
+ "skills": [
14
+ {
15
+ "path": "skills/white-paper/SKILL.md",
16
+ "name": "white-paper",
17
+ "description": "DBO project context and architecture guide — project structure, file-to-server mapping, dependencies, CLI vs API boundaries"
18
+ }
19
+ ]
8
20
  }
@@ -0,0 +1,93 @@
1
+ # DBO Plugin for Claude Code
2
+
3
+ Claude Code plugin for the DBO.io platform. Provides project context, CLI command execution, and API reference for developing DBO applications.
4
+
5
+ ## Plugin Structure
6
+
7
+ ```
8
+ dbo/
9
+ ├── .claude-plugin/
10
+ │ └── plugin.json # Plugin manifest (version, hooks, skills)
11
+ ├── commands/
12
+ │ └── dbo.md # /dbo slash command — CLI file operations
13
+ ├── hooks/
14
+ │ └── hooks.json # SessionStart: auto-loads white-paper in DBO projects
15
+ ├── skills/
16
+ │ └── white-paper/
17
+ │ ├── SKILL.md # Project architecture and context guide
18
+ │ └── references/
19
+ │ ├── api-reference.md # REST API endpoint reference
20
+ │ ├── template-syntax.md # Token, tag, and embed syntax
21
+ │ └── deploy-and-scripts.md # Deploy config and build pipeline
22
+ ├── docs/ # Copied from api/docs/ at publish time (see below)
23
+ └── README.md # This file
24
+ ```
25
+
26
+ ## Components
27
+
28
+ ### /dbo command (`commands/dbo.md`)
29
+ User-invokable slash command for CLI operations. Handles file sync (push/pull/clone/add/rm/diff), deployment, and project setup. Restricted to CLI-appropriate tools via `allowed-tools`. Directs data read/write operations to the REST API instead.
30
+
31
+ ### SessionStart hook (`hooks/hooks.json`)
32
+ Detects DBO projects by checking `.app/config.json` for an `AppUID` field. If found, auto-loads the white-paper skill to give Claude project context. This avoids false-matching other frameworks that may use `.app/` directories.
33
+
34
+ ### White paper skill (`skills/white-paper/SKILL.md`)
35
+ Project architecture guide loaded at session start. Covers:
36
+ - Directory structure and what maps to the server vs stays local
37
+ - How `lib/` mirrors DBO table data (bin-based vs entity-based mapping)
38
+ - Push/pull/deploy/clone workflow and supporting `.app/` config files (scripts, deploy_config, directories, schema)
39
+ - `app_dependencies/` and how `_system` and parent app dependencies work
40
+ - CLI vs REST API boundary (CLI for files, API for data)
41
+ - Template variables (`{{domain}}`, `{{appName}}`, etc.) for per-project scaffolding
42
+
43
+ ### Reference files (`skills/white-paper/references/`)
44
+ Deep-dive documentation that Claude reads on demand:
45
+
46
+ | File | Content | Source of truth |
47
+ |------|---------|-----------------|
48
+ | `api-reference.md` | REST API endpoints, auth, filters, write syntax, curl examples | `api/docs/dbo-cheat-sheet.md` |
49
+ | `template-syntax.md` | Token grammar, system tags, embed attributes, common patterns | `api/docs/dbo-cheat-sheet.md` |
50
+ | `deploy-and-scripts.md` | Standard push/deploy/clone workflow; `.app/deploy_config.json` and `.app/scripts.json` details | Direct from CLI behavior and `.app/` file formats |
51
+
52
+ ## docs/ directory (bundled at publish)
53
+
54
+ At npm publish time, `scripts/copy-plugins.js` copies `api/docs/` into `plugins/claude/dbo/docs/` so that documentation ships with the installed CLI package. This directory is NOT checked into the plugin source — it is generated.
55
+
56
+ ### Current docs source files (`api/docs/`)
57
+
58
+ These are the canonical API documentation files. They are **actively being written** and may change:
59
+
60
+ | File | Content |
61
+ |------|---------|
62
+ | `dbo-cheat-sheet.md` | Quick reference: primitives, tokens, tags, embeds, API, security |
63
+ | `dbo-core-entities.md` | Schema reference for 38 core system entities |
64
+ | `dbo-output-query.md` | Query output configuration and SQL mapping |
65
+ | `dbo-output-customsql.md` | Custom SQL output type |
66
+
67
+ ### Updating references
68
+
69
+ When `api/docs/` files are updated, the plugin reference files should be reviewed:
70
+
71
+ 1. **`api-reference.md`** — Derived from `dbo-cheat-sheet.md`. Update when endpoints, parameters, or auth patterns change.
72
+ 2. **`template-syntax.md`** — Derived from `dbo-cheat-sheet.md`. Update when token grammar, tags, or embed attributes change.
73
+ 3. **`deploy-and-scripts.md`** — Covers standard push/deploy/clone workflow and supporting `.app/` config files. Update when command behavior or config formats change.
74
+
75
+ ## Scaffolding (dbo init)
76
+
77
+ The white-paper skill is designed to be scaffolded into each project's `.claude/` directory by `dbo init`. The CLI replaces template variables with app-specific values:
78
+
79
+ | Variable | Source |
80
+ |----------|--------|
81
+ | `{{domain}}` | `.app/config.json` → `domain` |
82
+ | `{{appName}}` | `.app/config.json` → `AppName` |
83
+ | `{{appShortName}}` | `.app/config.json` → `AppShortName` |
84
+ | `{{appUID}}` | `.app/config.json` → `AppUID` |
85
+ | `{{appID}}` | `.app/config.json` → `AppID` |
86
+
87
+ ## Version History
88
+
89
+ | Version | Changes |
90
+ |---------|---------|
91
+ | 0.8.2 | Added white-paper skill, SessionStart hook, reference files, deploy_config docs |
92
+ | 0.8.1 | CLI skill with allowed-tools, CLI vs API boundary |
93
+ | 0.6.3 | Initial CLI skill |
@@ -1,69 +1,57 @@
1
1
  ---
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:*)
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:*)
5
5
  user-invokable: true
6
6
  ---
7
7
 
8
- # DBO CLI Skill
8
+ # DBO CLI
9
9
 
10
- Run `dbo` CLI commands for local file sync, project management, and deployment.
10
+ Run `dbo` CLI commands for local file operations, project management, and deployment.
11
11
 
12
- ## When to use this skill
12
+ ## CLI vs REST API — When to use what
13
13
 
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`)
14
+ **Use this CLI skill for file operations:**
15
+ - `pull`, `push`, `add`, `clone`, `rm`, `diff` sync files between local project and server
16
+ - `deploy` push a file to DBO by UID or named shorthand (shorthands defined in `.app/deploy_config.json`)
17
+ - `build`, `run` compile source and run lifecycle scripts (configured in `.app/scripts.json`)
18
+ - `init`, `login`, `status` — project setup and auth
18
19
 
19
- ## When NOT to use this skill
20
+ **Use the REST API directly (via curl) for data operations:**
21
+ - Reading data: `curl -b .app/cookies.txt "https://{domain}/api/o/{uid}"`
22
+ - Writing data: `curl -b .app/cookies.txt "https://{domain}/api/input/submit?_confirm=true" --data-urlencode 'RowID:...'`
23
+ - Content retrieval, cache management, authentication, messaging, media access
20
24
 
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`
25
+ The CLI wraps some API endpoints (`dbo input`, `dbo output`, `dbo content`, `dbo media`, `dbo cache`, `dbo upload`, `dbo message`) but these are thin wrappers prefer direct REST API calls for data reads/writes as they give full control over parameters. Reference the white-paper skill's `references/api-reference.md` for endpoint documentation.
29
26
 
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/`
34
-
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`.
36
-
37
- For detailed CLI command flags, options, and behavior — read `docs/dbo-cli-readme.md`.
27
+ For entity schemas, column names, token/tag syntax, and template authoring — read the `docs/` directory bundled with this plugin (or `references/template-syntax.md` from the white-paper skill).
38
28
 
39
29
  ## Running commands
40
30
 
41
- **If `$ARGUMENTS` is empty**, show the command table and guide interactively.
31
+ **If `$ARGUMENTS` is empty**, show the command table below and guide interactively. Run `dbo status` proactively to check if the CLI is initialized and authenticated.
42
32
 
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:**:
33
+ **If `$ARGUMENTS` is provided**, match against the command table (use best guess, e.g., "initialize" `init`, "upload files" → `push`), then run:
44
34
 
45
35
  ```bash
46
36
  dbo $ARGUMENTS
47
37
  ```
48
38
 
49
- ## Command overview
50
-
51
- These are the local workflow commands this skill covers:
39
+ ## Commands
52
40
 
53
41
  | Command | Description |
54
42
  |---------|-------------|
55
- | `init` | Initialize .dbo/ configuration |
43
+ | `init` | Initialize `.app/` configuration |
56
44
  | `login` / `logout` | Authenticate / clear session |
57
45
  | `status` | Show config, domain, session info |
58
- | `clone` | Clone an app to local project |
46
+ | `clone` | Clone an app to local project structure |
59
47
  | `pull` | Pull records to local files |
60
- | `push` | Push local changes (default: current dir) |
48
+ | `push` | Push local changes to server |
61
49
  | `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) |
50
+ | `diff` | Compare local files vs server versions |
51
+ | `rm` | Remove file and stage server deletion |
52
+ | `deploy` | Push a file to DBO by UID or named shorthand |
53
+ | `build` | Run build hooks from `.app/scripts.json` |
54
+ | `run` | Run a named script from `.app/scripts.json` |
67
55
  | `install` | Install/upgrade CLI, plugins (alias: `i`) |
68
56
 
69
57
  ## Common workflows
@@ -76,7 +64,7 @@ dbo login
76
64
  # Edit and push
77
65
  dbo push # push all changes in current dir
78
66
  dbo push lib/bins/app/assets/ # push specific directory
79
- dbo push colors.css # push single file
67
+ dbo push colors.css # push single file (auto-finds in project)
80
68
 
81
69
  # Build and push (with script hooks)
82
70
  dbo build # run build hooks only
@@ -84,6 +72,10 @@ dbo push # build + push (hooks run automatically)
84
72
  dbo push --no-build # push without build phase
85
73
  dbo push --no-scripts # push without any hooks
86
74
 
75
+ # Deploy by shorthand or UID
76
+ dbo deploy css:colors # deploy using deploy_config.json shorthand
77
+ dbo deploy albain3dwkofbhnd1qtd1q # deploy by UID directly
78
+
87
79
  # Pull
88
80
  dbo pull -e content --filter 'AppID=10100'
89
81
 
@@ -0,0 +1,11 @@
1
+ {
2
+ "description": "DBO plugin hooks — auto-loads project context on session start",
3
+ "hooks": {
4
+ "SessionStart": [
5
+ {
6
+ "type": "prompt",
7
+ "prompt": "Check if this is a DBO project by reading .app/config.json. If the file exists and contains an 'AppUID' field, this is a DBO project — invoke the /dbo:white-paper skill to load project context silently. If .app/config.json does not exist or has no AppUID field, do nothing."
8
+ }
9
+ ]
10
+ }
11
+ }
@@ -0,0 +1,225 @@
1
+ ---
2
+ name: white-paper
3
+ description: >-
4
+ DBO project context and architecture guide. This skill should be loaded at
5
+ SessionStart or when Claude needs to understand a DBO project's structure,
6
+ metadata, file mapping, dependencies, CLI vs API boundaries, or the
7
+ relationship between local files and the DBO server. Triggers on project
8
+ exploration, architecture questions, or when working with .app/, lib/, docs/,
9
+ app_dependencies/, src/, or test/ directories.
10
+ user-invokable: true
11
+ ---
12
+
13
+ # DBO Project White Paper
14
+
15
+ This skill provides architectural context for working within a DBO.io project. Read this to understand the local project structure, how files map to server records, when to use the CLI vs the REST API, and how dependencies work.
16
+
17
+ For deeper reference, consult these companion files:
18
+ - `references/api-reference.md` — Full REST API endpoint reference
19
+ - `references/template-syntax.md` — Token, tag, and embed syntax
20
+ - `references/deploy-and-scripts.md` — Standard push/deploy/clone workflow and supporting config details
21
+
22
+ ## Core Principle
23
+
24
+ DBO is a schema-driven application framework. The database schema IS the application. There is no traditional middle tier — apps are defined through entity records, templates, security rules, and metadata. The local project mirrors the server's data model as files on disk.
25
+
26
+ ## Project Identity
27
+
28
+ When scaffolded by `dbo init`, the CLI injects these app-specific values:
29
+ - **Domain**: `{{domain}}`
30
+ - **App**: `{{appName}}` (`{{appShortName}}`)
31
+ - **AppUID**: `{{appUID}}`
32
+ - **AppID**: `{{appID}}`
33
+
34
+ ## Project Directory Map
35
+
36
+ ```
37
+ project-root/
38
+ ├── .app/ # App metadata and configuration (DBO-managed)
39
+ │ ├── config.json # Domain, AppID, AppUID, settings, dependency versions
40
+ │ ├── {app}.json # Complete app data export (read-only reference)
41
+ │ ├── {app}.metadata.json # App-level metadata
42
+ │ ├── {app}.metadata_schema.json # Database schema for this app
43
+ │ ├── scripts.json # Build/postpush script definitions
44
+ │ ├── deploy_config.json # Deployment shorthand targets (see Deploy section)
45
+ │ ├── directories.json # BinID → directory path mapping
46
+ │ ├── credentials.json # Auth credentials (gitignored)
47
+ │ └── cookies.txt # Session cookies (gitignored)
48
+
49
+ ├── lib/ # Server-mapped files (mirrors DBO table data)
50
+ │ ├── bins/ # Bin entities and their children (see Bin Mapping below)
51
+ │ ├── extension/ # Extension records, sub-foldered by Descriptor
52
+ │ ├── entity/ # Entity metadata files
53
+ │ ├── site/ # Site definitions
54
+ │ ├── security/ # Security rule records
55
+ │ ├── data_source/ # Data source configurations
56
+ │ └── app_version/ # App version metadata
57
+
58
+ ├── docs/ # Project documentation (scripts, embeds, pages, components)
59
+ ├── app_dependencies/ # Cloned dependency apps (read-only references)
60
+ │ ├── _system/ # Always present — core DBO platform schema
61
+ │ └── {app_name}/ # Present when developing a dependency app
62
+
63
+ ├── src/ # Developer source (NEVER uploaded to server)
64
+ ├── test/ # Test scripts (NEVER uploaded to server)
65
+ ├── trash/ # Archived files (NEVER uploaded to server)
66
+ └── node_modules/ # NPM packages (NEVER uploaded to server)
67
+ ```
68
+
69
+ **Key rule:** Only `lib/` and `docs/` contents map to the DBO server. The `src/`, `test/`, `trash/`, and `node_modules/` directories are strictly local — nothing inside them is ever deployed or uploaded.
70
+
71
+ ## How lib/ Maps to the Server
72
+
73
+ The `lib/` directory emulates the server's table data as a local file structure.
74
+
75
+ ### Bin-based entities (have BinID or ParentBinID columns)
76
+
77
+ Files belonging to a `bin` entity are placed in directories matching their BinID. The mapping is defined in `.app/directories.json`, which maps numeric BinIDs to directory paths:
78
+
79
+ ```json
80
+ {
81
+ "11042": { "name": "app", "fullPath": "app", "binId": 11042 },
82
+ "11043": { "name": "assets", "fullPath": "app/assets", "parentBinID": 11042 }
83
+ }
84
+ ```
85
+
86
+ So `lib/bins/app/assets/css/colors.css` lives inside the bin whose `fullPath` is `app/assets/css`. Every file has a companion `.metadata.json` (or `.metadata~{uid}.json`) containing the server record fields.
87
+
88
+ ### Non-bin entities (no BinID column)
89
+
90
+ Entities without a BinID column get their own directory under `lib/`, named after the entity: `lib/extension/`, `lib/entity/`, `lib/site/`, `lib/security/`, `lib/data_source/`, `lib/app_version/`.
91
+
92
+ ### Extension special case
93
+
94
+ The `extension` entity has sub-folders based on the **Descriptor** column value:
95
+ - `lib/extension/Control/` — Control extensions
96
+ - `lib/extension/Widget/` — Widget extensions
97
+ - `lib/extension/Descriptor Definition/` — Descriptor definitions themselves
98
+
99
+ Each extension file follows: `{Name}.{ContentColumnName}.{ext}` with a companion `{Name}.metadata~{uid}.json`.
100
+
101
+ ## .app/ Configuration
102
+
103
+ ### config.json
104
+ Central project configuration. Key fields:
105
+ - `domain` — Server hostname for API calls
106
+ - `AppID`, `AppUID`, `AppShortName` — App identity
107
+ - `dependencies` — Array of dependency app names (always includes `_system`)
108
+
109
+ ### scripts.json
110
+ Defines build and deployment scripts per target file:
111
+ - `build` scripts compile source → output (e.g., sass, rollup, csso)
112
+ - `postpush` scripts run after `dbo push` (e.g., `dbo deploy doc:chat`)
113
+ - `entities` object can define per-entity scripts
114
+
115
+ See `references/deploy-and-scripts.md` for full details.
116
+
117
+ ### deploy_config.json
118
+ Optional shorthand registry for `dbo deploy`. Auto-generated by `dbo clone` and `dbo adopt` — one entry per companion file.
119
+
120
+ ```bash
121
+ dbo deploy css:colors # Deploy by shorthand name
122
+ dbo deploy albain3dwkofbhnd1qtd1q # Deploy by UID directly (no config needed)
123
+ ```
124
+
125
+ Each entry maps a shorthand to a UID, file path, entity, and content column. Shorthands follow `{type}:{name}` convention (e.g., `css:colors`, `js:app.min`). Assets often have paired content + media records (e.g., `css:colors` and `css:colors_media`).
126
+
127
+ See `references/deploy-and-scripts.md` for full details.
128
+
129
+ ### directories.json
130
+ Maps BinIDs to local directory paths. Used by CLI to place files during `clone` and `pull`, and to resolve which bin a file belongs to for `push` and `add`.
131
+
132
+ ### metadata_schema.json
133
+ Database schema definition for this app. Derived from `_system` core entities plus app-specific entities. Use this to understand available tables, columns, data types, and relationships.
134
+
135
+ ## Dependencies (app_dependencies/)
136
+
137
+ ### _system (always present)
138
+ Contains the core DBO platform schema — all system entities, tables, columns, and foundational architecture. Defines:
139
+ - Core entities (app, user, content, media, output, entity, etc.)
140
+ - System schema used to build `.app/{app}.metadata_schema.json`
141
+ - Platform-level documentation in `app_dependencies/_system/docs/`
142
+
143
+ ### {app_name} dependency (when present)
144
+ When `app_dependencies/{app_name}/` exists (e.g., `app_dependencies/operator/`), the current project is a **dependency app** to that parent. This means:
145
+
146
+ 1. **Extension descriptor mapping** — Check `app_dependencies/{app_name}/lib/extension/Descriptor Definition/` for `extension.Descriptor=descriptor_definition` files. These define the descriptor types available for extensions in the current project.
147
+
148
+ 2. **Design resources** — `app_dependencies/{app_name}/lib/bins/app/assets/` contains CSS, JS, fonts, graphics, and templates defining the parent app's design language. Reference these for consistent styling.
149
+
150
+ 3. **Architecture reference** — The parent app's structure, scripts, and layout patterns inform what the current project needs to implement.
151
+
152
+ ## CLI vs REST API
153
+
154
+ ### Use the DBO CLI for:
155
+ - **File operations**: `pull`, `push`, `add`, `clone`, `rm`, `diff`
156
+ - **Deployment**: `deploy` (shorthand or UID), content deploy
157
+ - **Project setup**: `init`, `login`, `status`
158
+ - **Batch operations**: pushing directories, scanning for un-added files
159
+
160
+ The CLI handles metadata management, change detection, and file-to-record synchronization automatically.
161
+
162
+ ### Use the REST API for:
163
+ - **Data reads/queries**: `GET /api/o/{uid}`, `GET /api/output/entity/{entityUid}`
164
+ - **Data writes**: `POST /api/input/submit` with RowID syntax
165
+ - **Content retrieval**: `GET /api/c/{uid}`
166
+ - **Runtime operations**: cache management, authentication, email/messaging
167
+ - **Media access**: `GET /api/media/{uid}`
168
+
169
+ See `references/api-reference.md` for full endpoint documentation.
170
+
171
+ ### API authentication
172
+ Credentials and cookies in `.app/credentials.json` and `.app/cookies.txt`. CLI manages via `dbo login`. For direct API calls:
173
+ ```bash
174
+ curl -b .app/cookies.txt "https://{{domain}}/api/output/entity/{uid}"
175
+ ```
176
+
177
+ ### API write syntax (input/submit)
178
+ ```
179
+ RowID:add1;column:entity.Column=value # Insert
180
+ RowID:{id};column:entity.Column=value # Update
181
+ RowID:del{id};entity:entityName=true # Delete
182
+ ```
183
+ Always include `_confirm=true`. Special values: `_{now}` (datetime), `_{null}` (null).
184
+
185
+ ## docs/ Directory
186
+
187
+ Contains Markdown documentation for this project's components — scripts, embeds, pages, UI features. These are project-specific references generated or maintained alongside development. Read these to understand documented behaviors of the current app.
188
+
189
+ ## Build Pipeline
190
+
191
+ Source files in `src/` compile via scripts in `.app/scripts.json`:
192
+ - **build** scripts: Run manually or via `npm run build`
193
+ - **postpush** scripts: Run automatically after `dbo push` for specific targets
194
+
195
+ Common tools: `rollup` (JS bundling), `sass` (CSS), `csso` (CSS minification), `terser` (JS minification).
196
+
197
+ Use `dbo push` to trigger builds automatically (runs `build` then pushes), or `dbo build` to compile without pushing. See `references/deploy-and-scripts.md` for the full workflow.
198
+
199
+ ## Test Directory
200
+
201
+ The `test/` directory is for developer and Claude Code test scripts. Tests target the app but are never uploaded to the server. Use for:
202
+ - API integration tests
203
+ - UI component tests
204
+ - Build verification scripts
205
+ - Any validation logic for the project
206
+
207
+ ## Quick Reference
208
+
209
+ | Task | Tool | Example |
210
+ |------|------|---------|
211
+ | Query data | REST API | `GET /api/o/{uid}` |
212
+ | Read entity rows | REST API | `GET /api/output/entity/{entityUid}` |
213
+ | Write/update data | REST API | `POST /api/input/submit` |
214
+ | Pull files from server | CLI | `dbo pull -e content` |
215
+ | Push local changes | CLI | `dbo push path/to/file` |
216
+ | Add new file to server | CLI | `dbo add path/to/file` |
217
+ | Deploy by shorthand | CLI | `dbo deploy css:colors` |
218
+ | Deploy by UID | CLI | `dbo deploy {uid}` |
219
+ | Compare with server | CLI | `dbo diff` |
220
+ | Build from source | npm/scripts | Commands from `.app/scripts.json` |
221
+ | Understand schema | Read file | `.app/{app}.metadata_schema.json` |
222
+ | Find bin for a path | Read file | `.app/directories.json` |
223
+ | Check deploy targets | Read file | `.app/deploy_config.json` |
224
+ | Check project config | Read file | `.app/config.json` |
225
+ | Understand dependencies | Read dir | `app_dependencies/` |
@@ -0,0 +1,172 @@
1
+ # DBO REST API Reference
2
+
3
+ Comprehensive reference for the DBO.io REST API. Use this when constructing API calls, debugging responses, or understanding the data model.
4
+
5
+ ## Authentication
6
+
7
+ ### Endpoint
8
+ ```
9
+ GET /api/authenticate?action=login
10
+ GET /api/authenticate?action=logout
11
+ ```
12
+
13
+ ### Identity parameters (pick one)
14
+ | Param | Short | Column |
15
+ |-------|-------|--------|
16
+ | `_username` | `_un` | `user.Username` |
17
+ | `_email` | `_em` | `user.Email` |
18
+ | `_phonenumber` | `_pn` | `user.PhoneNumber` |
19
+
20
+ ### Credential parameters
21
+ | Param | Short | Column |
22
+ |-------|-------|--------|
23
+ | `_password` | `_pw` | `user.Password` |
24
+ | `_passkey` | `_pk` | `user.Passkey` |
25
+
26
+ Auth parameters can be sent on ANY endpoint with `_login=true` to authenticate inline.
27
+
28
+ ## Read Operations
29
+
30
+ ### Output query
31
+ ```
32
+ GET /api/output/{uid}
33
+ GET /api/o/{uid} # shorthand
34
+ ```
35
+
36
+ ### Entity query (direct table access)
37
+ ```
38
+ GET /api/output/entity/{entityUid}
39
+ GET /api/output/entity/{entityUid}/{rowId}
40
+ ```
41
+
42
+ For system entities, `{entityUid}` is the table name: `content`, `user`, `output`, `media`, `entity`, `entity_column`, `extension`, `site`, `bin`, `security`, etc.
43
+
44
+ ### Content
45
+ ```
46
+ GET /api/content/{uid}
47
+ GET /api/c/{uid} # shorthand
48
+ ```
49
+
50
+ ### Media
51
+ ```
52
+ GET /api/media/{uid}
53
+ GET /api/media/id/{id}
54
+ GET /dir/{*path} # direct path access
55
+ ```
56
+
57
+ ### Filter and control parameters
58
+ | Param | Effect |
59
+ |-------|--------|
60
+ | `_filter@Field=value` | Dynamic row filter |
61
+ | `_filter@Field:restrictive=value` | Non-overridable filter |
62
+ | `_limit=N` | Max rows returned |
63
+ | `_page=N` | Pagination |
64
+ | `_template=json_indented` | Override output format (json_indented, html, xml, csv) |
65
+ | `voidcache=true` | Flush all caches globally |
66
+ | `_debug=true` | Enable debug output |
67
+ | `_as={userId}` | Impersonate user (render context only, not security) |
68
+
69
+ ## Write Operations
70
+
71
+ ### Input submit
72
+ ```
73
+ POST /api/input/submit?_confirm=true
74
+ ```
75
+
76
+ `_confirm=true` is REQUIRED for any write to execute.
77
+
78
+ ### Row syntax
79
+ ```
80
+ RowID:{ref};column:{entity}.{Column}={value}
81
+ ```
82
+
83
+ ### Reference types
84
+ | Ref | Operation |
85
+ |-----|-----------|
86
+ | `add1`, `add2`, … | Insert new record |
87
+ | `{id}` or `{uid}` | Update existing record |
88
+ | `del{id}` | Delete record |
89
+
90
+ `RowID:` and `RowUID:` are interchangeable. Use `RowUID:` for cross-environment stability.
91
+
92
+ ### Cross-referencing within a batch
93
+ ```
94
+ RowID:add1;column:parent_table.Name=Test
95
+ RowID:add2;column:child_table.ParentID=add1
96
+ ```
97
+
98
+ ### Special values
99
+ | Value | Meaning |
100
+ |-------|---------|
101
+ | `_{now}` | Current datetime (server resolves) |
102
+ | `_{null}` | Null / empty value |
103
+
104
+ ### curl example
105
+ ```bash
106
+ curl -b .app/cookies.txt \
107
+ 'https://{domain}/api/input/submit?_confirm=true' \
108
+ --data-urlencode 'RowID:add1;column:content.Name=my-page' \
109
+ --data-urlencode 'RowID:add1;column:content.Content=<h1>Hello</h1>' \
110
+ --data-urlencode 'RowID:add1;column:content.AppID=10100'
111
+ ```
112
+
113
+ ## Cache Management
114
+
115
+ ```
116
+ GET /api/cache/list
117
+ GET /api/cache/refresh?_key=output:meta:{uid}
118
+ GET /api/cache/refresh?_key=secure:output:meta:{uid}
119
+ ```
120
+
121
+ ## Upload
122
+
123
+ ```
124
+ POST /api/upload/submit
125
+ ```
126
+
127
+ File upload with multipart form data. Metadata can be attached.
128
+
129
+ ## Email / Messaging
130
+
131
+ ```
132
+ GET /api/content/email/{uid}
133
+ GET /api/message/content/{uid}
134
+ POST /api/message/receive/{messageServerUid}
135
+ ```
136
+
137
+ ## Data Source
138
+
139
+ ```
140
+ POST /api/data_source/metadata/synchronize/{dataSourceUid}
141
+ POST /api/data_source/metadata/synchronize/in/{dataSourceUid}
142
+ POST /api/data_source/metadata/synchronize/out/{dataSourceUid}
143
+ ```
144
+
145
+ ## App Lifecycle
146
+
147
+ ```
148
+ GET /api/app/export/{appUid}
149
+ POST /api/app/import/{appUid}
150
+ GET /api/app/delete/{appUid}
151
+ POST /api/app_version/populate/{appVersionUid}
152
+ POST /api/app_version/clear/{appVersionUid}
153
+ ```
154
+
155
+ ## Instance Management
156
+
157
+ ```
158
+ GET /api/instance/debug
159
+ POST /api/instance/export
160
+ POST /api/instance/import
161
+ POST /api/instance/generate/{accountUid}
162
+ POST /api/instance/build/{instanceUid}
163
+ ```
164
+
165
+ ## Identifiers
166
+
167
+ - **UID** (22-char alphanumeric): Stable across environments. Use in templates, tokens, deploy scripts.
168
+ - **Numeric ID**: Environment-specific. May change across migrations. Use only for runtime lookups.
169
+
170
+ ### Column UID patterns
171
+ - **System entities**: `{entity}.{ColumnName}` (e.g., `content.Content`, `media.File`)
172
+ - **Custom entities**: Opaque UIDs — discover via `GET /api/output/entity/{entityUid}?_template=json_indented&_limit=1`