# CLI Reference — agentdock-cli

46 commands for document management from the terminal.

Install: `npm install -g agentdock-cli`

## Authentication

| Command | Description |
|---------|-------------|
| `agentdock login` | Log in through your browser |
| `agentdock login --force` | Re-authorize even when a valid token is already stored |
| `agentdock logout` | Clear the stored token (server-side key stays valid until expiry) |
| `agentdock whoami` | Verify the stored token and show the authorized user |
| `agentdock token` | Show current token info |
| `agentdock config set-url <url>` | Set API base URL |
| `agentdock config set-token <token>` | Set auth token manually |

## Documents (24 commands)

| Command | Description |
|---------|-------------|
| `agentdock docs list` | List your documents |
| `agentdock docs read <id>` | Read a document (outputs markdown with title as H1) |
| `agentdock docs write <id> <file>` | Write a markdown file to a document (leading H1 becomes title) |
| `agentdock docs create` | Create a new blank document |
| `agentdock docs title <id> <title>` | Update a document's title |
| `agentdock docs duplicate <id>` | Create a copy of a document |
| `agentdock docs publish <id>` | Publish a document (requires a non-empty title; set one with `agentdock docs title <id> <title>` first) |
| `agentdock docs unpublish <id>` | Unpublish (revert to draft) |
| `agentdock docs import-url <url>` | Import a web page as a document |
| `agentdock docs delete <id>` | Delete a document |
| `agentdock docs move <id> <folder-id>` | Move to a folder (use "root" for no folder) |
| `agentdock docs suggest <id> <find> <replace>` | Suggest a text change (tracked changes) |
| `agentdock docs suggestions <id>` | List pending suggestions |
| `agentdock docs accept-suggestion <id> <sid>` | Accept a suggestion |
| `agentdock docs reject-suggestion <id> <sid>` | Reject a suggestion |
| `agentdock docs cite <id> <identifier>` | Add citation by DOI, URL, PMID, or arXiv ID |
| `agentdock docs citations <id>` | List all citations in a document |
| `agentdock docs remove-citation <id> <citation-id>` | Remove a citation from a document |
| `agentdock docs search-citations <query>` | Search for papers to cite |
| `agentdock docs set-citation-style <id> <style>` | Set citation style (APA, MLA, etc.) |
| `agentdock docs versions <id>` | List version history |
| `agentdock docs version <id> <versionId>` | Read a specific version's content |
| `agentdock docs prompts` | List your prompts |
| `agentdock docs prompt <promptId>` | Read a specific prompt |

## Folders (4 commands)

| Command | Description |
|---------|-------------|
| `agentdock docs folders list` | List document folders |
| `agentdock docs folders create <name>` | Create a folder |
| `agentdock docs folders rename <folderId> <name>` | Rename a folder |
| `agentdock docs folders delete <folderId>` | Delete a folder (child folders deleted, docs moved to root) |

## Citation Library (6 commands)

| Command | Description |
|---------|-------------|
| `agentdock docs library list` | List saved citations |
| `agentdock docs library get <citationId>` | Get a single citation from your library |
| `agentdock docs library save <title>` | Save a citation |
| `agentdock docs library search <query>` | Search citation library |
| `agentdock docs library format <title>` | Preview citation formatting |
| `agentdock docs library delete <citationId>` | Delete a citation from your library |

## Collections (5 commands)

| Command | Description |
|---------|-------------|
| `agentdock docs collections list` | List citation collections |
| `agentdock docs collections create <name>` | Create a collection |
| `agentdock docs collections add <collectionId> <citationId>` | Add a citation to a collection |
| `agentdock docs collections remove <collectionId> <citationId>` | Remove a citation from a collection |
| `agentdock docs collections delete <collectionId>` | Delete a citation collection |

## MCP Setup

| Command | Description |
|---------|-------------|
| `agentdock mcp-setup` | Print MCP config JSON for your MCP client |

## Output Modes

- All commands print human-readable text (tables and `label: value` lines).
- The only structured output is `agentdock docs read <id> --format json` (raw
  TipTap) and `--format nodes` (block list with nodeIds). There is no global
  JSON mode and no pipe-based format switching.
