@@ -23,11 +23,11 @@ Use JSON help to discover whether a command supports structured command output:
2323dbxcli put --help --output=json
2424```
2525
26- JSON help is also the Command Manifest v1 surface for tools and agents. Each
27- command manifest includes structured positional arguments, flag enum values and
28- conflicts, prompt/sensitive-input metadata, examples, auth modes, best-effort
29- Dropbox scopes, stdin/stdout behavior, schema refs, result statuses/kinds, and
30- known warning codes.
26+ JSON help is also the Command Manifest v1 surface for tools and agents. Command
27+ manifests expose machine-readable metadata such as structured positional
28+ arguments, flag enum values and conflicts, prompt/sensitive-input metadata,
29+ examples, auth modes, best-effort Dropbox scopes, stdin/stdout behavior, schema
30+ refs, result statuses/kinds, and known warning codes when available .
3131
3232Successful JSON responses use a stable envelope:
3333
@@ -88,7 +88,7 @@ Automation should treat the CLI and schemas as the stable interface:
8888* Use ` error.schema.json ` to validate JSON error responses.
8989* Prefer schema URLs from a pinned release tag when reproducibility matters.
9090
91- dbxcli intentionally does not expose a separate machine protocol. Tools should
91+ dbxcli currently does not expose a separate machine protocol. Tools should
9292invoke the CLI, read stdout as JSON in ` --output=json ` mode, and treat stderr as
9393status, progress, warnings, diagnostics, and verbose logs.
9494
@@ -130,6 +130,60 @@ Use `--output=json` when the caller needs stable statuses, result kinds,
130130warnings, or error codes. Use text output when a command is part of a human
131131terminal workflow or when the command intentionally writes file bytes to stdout.
132132
133+ Check auth and identity before running a job:
134+
135+ ``` sh
136+ dbxcli account --output=json
137+ ```
138+
139+ Use direct token auth for short-lived CI jobs:
140+
141+ ``` sh
142+ DBXCLI_ACCESS_TOKEN=" $DROPBOX_ACCESS_TOKEN " dbxcli ls --output=json /
143+ ```
144+
145+ Use a dedicated saved-auth file when a job needs refreshable credentials. Store
146+ the file in a private temp or secret-backed path, not in the repository working
147+ directory:
148+
149+ ``` sh
150+ export DBXCLI_AUTH_FILE=" ${RUNNER_TEMP:-/ tmp} /dbxcli-auth.json"
151+ dbxcli login
152+ dbxcli ls /
153+ ```
154+
155+ Do not commit, cache, or upload this file as an artifact; it can contain refresh
156+ tokens.
157+
158+ Capture JSON output and handle failure by exit code:
159+
160+ ``` sh
161+ if ! dbxcli put --if-exists fail --output=json report.md /Reports/report.md > result.json; then
162+ jq -r ' .error.code + ": " + .error.message' result.json >&2
163+ exit 1
164+ fi
165+
166+ jq -r ' .results[] | [.status, .kind] | @tsv' result.json
167+ ```
168+
169+ GitHub Actions example:
170+
171+ This example assumes ` dbxcli ` is already installed on the runner.
172+
173+ ``` yaml
174+ jobs :
175+ publish-report :
176+ runs-on : ubuntu-latest
177+ steps :
178+ - uses : actions/checkout@v6
179+ - name : Upload report to Dropbox
180+ env :
181+ DBXCLI_ACCESS_TOKEN : ${{ secrets.DROPBOX_ACCESS_TOKEN }}
182+ run : |
183+ dbxcli account --output=json
184+ dbxcli put --if-exists fail --output=json report.md /Reports/report.md
185+ ` ` `
186+
133187## Authentication for automation
134188
135189By default, ` dbxcli` stores OAuth credentials in:
@@ -225,6 +279,10 @@ Stdin uploads are spooled to a temp file before uploading, so disk space up to
225279the full input size is required. Stdout downloads are byte-clean : progress,
226280diagnostic output, human-facing warnings, and verbose logs go to stderr.
227281
282+ Commands that write file bytes to stdout cannot also write JSON results to
283+ stdout. `dbxcli get <path> - --output=json` and
284+ ` dbxcli share-link download <url> - --output=json` return `invalid_arguments`.
285+
228286A bare `-` means stdin/stdout only when it appears as the local operand. Dropbox
229287paths named `-` are valid, for example `dbxcli put - /-` and `dbxcli get /- -`.
230288To upload a local file literally named `-`, use `./-`.
@@ -245,19 +303,22 @@ exit `0`, including successful commands that return warnings.
245303| `5` | Conflict | `path_conflict` |
246304| `6` | Rate limited | `rate_limited` |
247305| `7` | Validation or usage error | `invalid_arguments`, `unknown_command`, `unknown_flag`, `structured_output_unsupported` |
248- | ` 8 ` | Partial stdout/output transfer | ` partial_transfer ` |
306+ | `8` | Partial stdout transfer | `partial_transfer` |
249307
250308In JSON mode, inspect both the process exit code and `error.code` for the most
251309specific machine-readable failure reason.
252310
253311# # Shell completion
254312
255- Shell completion commands intentionally remain text-only because shells expect
256- completion scripts or protocol output:
313+ Completion script/protocol output is text-only because shells expect completion
314+ scripts or protocol output :
257315
258316` ` ` sh
259317dbxcli completion bash
260318dbxcli completion zsh
261319dbxcli completion fish
262320dbxcli completion powershell
263321` ` `
322+
323+ Passing `--output=json` to completion commands returns
324+ ` structured_output_unsupported` .
0 commit comments