# CLI · `pagedrop` The official PageDrop command-line client uploads and shares single files from your terminal or CI. It uses the same v1 REST API as the MCP server. ## Install ```bash npm install -g https://pagedrop.space/downloads/pagedrop-cli-0.1.1.tgz ``` Alternatively use `npx -y https://pagedrop.space/downloads/pagedrop-cli-0.1.1.tgz ...`. The npm name is reserved as `@pagedrop/cli`; once published, `npm i -g @pagedrop/cli` replaces the tarball URL. ## Authentication Save credentials to `~/.pagedrop.json`: ```bash pagedrop login https://pagedrop.space pd_XXXXXXXX_YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY pagedrop whoami ``` Or use environment variables in CI: ```bash export PAGEDROP_API_URL=https://pagedrop.space export PAGEDROP_API_KEY=pd_xxx_yyy pagedrop whoami ``` Environment variables take precedence over the saved configuration. ## Commands ### `login ` Checks the token and saves credentials to `~/.pagedrop.json` with mode `600`. Set `PAGEDROP_CONFIG=/path` to use another location. ### `whoami` Shows the current user, authentication source (token or session) and API URL. ### `config` Shows the loaded configuration with secrets redacted. ### `ls` Lists your files: ID, type, size and name. ### `upload [--share '']` Uploads one HTML, Markdown or TXT file. `--share` accepts a JSON policy, but the share is **deferred, not created** — an upload is always `PENDING`, so no link comes back yet (see [Scanning gates sharing](#scanning-gates-sharing)): ```bash pagedrop upload notes.md --share '{"expiresInDays":7,"password":"hello12"}' ``` A bare `--share` records a permanent, password-free policy; it still has to be applied with `pagedrop share`. ## Scanning gates sharing ```text 1. pagedrop upload report.md → file_id: … / share: deferred — … 2. wait until scanStatus is CLEAN 3. pagedrop share --expires-in 7 → share: https://…/s/u-/ ``` Running `pagedrop share` against a file that has not cleared the scan returns 425 `SCAN_PENDING` (retryable); a scan service that never reached a verdict (`SCAN_ERROR`) does not block the share, but the file is not actually scanned; an infected file returns 409 `INFECTED`. ### `share [opts]` Creates another share for an existing file. | Flag | Meaning | |---|---| | `--password ` | Password, 4–32 characters | | `--slug ` | Custom URL slug, 3–32 base62 characters plus `-` and `_` | | `--expires-in ` | Expiration, 1–3650 days | | `--max-visits ` | Total visit limit | | `--one-time` | Expires after the first visit | | `--watermark ` | Watermark text, up to 80 characters | | `--copy-protect` | Disable copy / cut / drag / context menu | | `--burn-after-read` | Burn after read: paragraphs the reader scrolls past are cleared and covered; the scroll position is kept in that browser, and the file itself is not deleted | ```bash pagedrop share cm... --password secret12 --expires-in 1 ``` ### `rm ` Moves a file to Trash and revokes its shares. ## CI example ```yaml # .github/workflows/share.yml - name: Generate report run: npm run report - name: Share report to PageDrop env: PAGEDROP_API_URL: https://pagedrop.space PAGEDROP_API_KEY: ${{ secrets.PAGEDROP_API_KEY }} run: | CLI="npx -y https://pagedrop.space/downloads/pagedrop-cli-0.1.1.tgz" FID=$($CLI upload ./report.md | awk '/^file_id:/{print $2}') # Poll the file status only; call share once, after a verdict until curl -fsS -H "Authorization: Bearer $PAGEDROP_API_KEY" "$PAGEDROP_API_URL/api/v1/files/$FID" | grep -Eq '"scanStatus": ?"(CLEAN|INFECTED|SCAN_ERROR)"'; do sleep 5; done $CLI share "$FID" --expires-in 30 ``` ## Source - Packages: - Source: `packages/cli/src/` in the PageDrop repository