Docz CLI
No description available
Ask AI about Docz CLI
Powered by Claude Β· Grounded in docs
I know everything about Docz CLI. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
Quick Start
# Login
npx docz-cli@latest login --token <your-token>
# Browse
npx docz-cli@latest spaces
npx docz-cli@latest ls η ε
npx docz-cli@latest cat η ε:docs/guide.md
# Write
npx docz-cli@latest write ε΄ιΉι£:notes/todo.md '# TODO List'
Features
- Simple addressing β
<space>:<path>format, Space supports name or ID - Short URL support β paste
https://docz.xxx.com/s/slug/f/fileIddirectly into cat/ls/log, or generate withshortlink - Full file operations β ls, cat, upload, write, mkdir, rm, mv
- Share links β create, list, update, access, delete share links from CLI
- File diff β view file-level unified diff or space-level change summary
- Git-backed β every write creates a commit, built-in version history
- Trash recovery β deleted files recoverable within 30 days
- MCP Server β built-in stdio MCP server for AI agent integration
- Zero config β single token, works immediately
Installation
Requirements: Node.js >= 22.0.0
npx docz-cli@latest <command> # Always uses the latest version (recommended)
npm install -g docz-cli # Or global install, then use `docz` shorthand
Auto-update: Using
npx docz-cli@latestensures you always run the latest version without manual updates. Global install requiresnpm update -g docz-clito update.
Global install registers both
docz-clianddoczcommands. Examples below usedocz-cli; replace withdoczif installed globally.
Authentication
Get your API Token:
- Login to https://docz.zhenguanyu.com (SSO)
- Go to Settings β Account β API Tokens (or visit
/settingsdirectly) - Click New Token, name it, copy the token (shown only once)
Then configure:
# Option 1: login command (saved to ~/.docz/config.json)
docz-cli login --token <your-token>
# Option 2: environment variable
export DOCSYNC_API_TOKEN=<your-token>
Commands
| Command | Description |
|---|---|
login --token <t> | Configure credentials |
whoami | Show current user |
spaces | List all accessible spaces |
ls <space>[:<path>] | List files and folders |
cat <space>:<path> | Read file content |
upload <file> <space>[:<dir>] | Upload local file |
write <space>:<path> <content> | Write content to file (- for stdin) |
mkdir <space>:<path> | Create folder |
rm <space>:<path> | Delete file/folder (30-day trash) |
mv <space>:<from> <to> | Rename or move |
log <space>[:<path>] | Show change history |
shortlink <space>:<path> | Get short URL for file |
trash <space> | Show deleted files |
diff <space>[:<path>] <commit> [<from>] | Show changes (file or space level) |
share create <space>:<path> | Create share link |
share list <space> | List share links |
share update <space> <link-id> | Update share link |
share cat <token-or-url> | Read shared file |
share info <token-or-url> | Show share link info |
share rm <space> <link-id> | Delete share link |
mcp | Start MCP stdio server |
Usage Examples
Browse
docz-cli spaces # List all spaces
docz-cli ls η ε # List root directory
docz-cli ls η ε:docs # List subdirectory
docz-cli cat η ε:docs/guide.md # Read file content
Short URL
Generate a short URL for any file, or paste existing short URLs into cat/ls/log:
# Generate short URL
docz-cli shortlink ι«ζ΄ͺεΊ·:AI-Codingζε·§ζ»η»12.md
# β https://docz.zhenguanyu.com/s/yanhongkang/f/NNjrcj8c
# Short URLs work with cat, ls, log
docz-cli cat https://docz.zhenguanyu.com/s/yanhongkang/f/NNjrcj8c
docz-cli ls https://docz.zhenguanyu.com/s/yanfa
docz-cli log https://docz.zhenguanyu.com/s/yanhongkang/f/NNjrcj8c
Write
docz-cli write ε΄ιΉι£:notes/todo.md '# TODO List' # Write content
echo '# Report' | docz-cli write ε΄ιΉι£:reports/daily.md - # From stdin
docz-cli upload ./report.pdf η ε:reports # Upload file
docz-cli mkdir η ε:new-project # Create folder
Manage
docz-cli mv η ε:old.md new.md # Rename
docz-cli rm η ε:deprecated.md # Delete (recoverable)
docz-cli log η ε # Space history
docz-cli log η ε:docs/guide.md # File history
docz-cli trash η ε # View trash
Share Links
# Create (with optional expiry and visibility)
docz-cli share create η ε:docs/guide.md --expires 7d --users user@co.com
# List all share links in a space
docz-cli share list η ε
docz-cli share list η ε --file docs/guide.md # Filter by file
# Access shared content (token or full URL)
docz-cli share cat xYz123AbC
docz-cli share cat https://docz.zhenguanyu.com/share/xYz123AbC
docz-cli share cat xYz123AbC --raw | grep "ι¨η½²" # Raw output for pipes
# View share link info
docz-cli share info xYz123AbC
# Update and delete (requires space context)
docz-cli share update η ε <link-id> --expires 30d
docz-cli share rm η ε <link-id>
Diff
# View what changed in a commit (file level)
docz-cli diff η ε:docs/guide.md af0fb9b
# Compare two commits
docz-cli diff η ε:docs/guide.md af0fb9b b2c3d4e
# Space-level: which files changed in a commit
docz-cli diff η ε af0fb9b
# Typical workflow: log β pick commit β diff
docz-cli log η ε:docs/guide.md
docz-cli diff η ε:docs/guide.md af0fb9b
Pipes
cat outputs to stdout, write ... - reads from stdin. Combine with any Unix tool:
# Search content
docz-cli cat η ε:docs/guide.md | grep "ι¨η½²"
# Extract CSV columns
docz-cli cat η ε:data.csv | cut -d',' -f1,3 | head -10
# Read β transform β write back
docz-cli cat ε΄ιΉι£:config.md | sed 's/old/new/g' | docz-cli write ε΄ιΉι£:config.md -
# Local command output β DocSync
echo "# Generated at $(date)" | docz-cli write ε΄ιΉι£:notes/auto.md -
cat local-file.md | docz-cli write ε΄ιΉι£:docs/remote.md -
MCP Server
Built-in MCP server for AI agent integration (Claude Code, Cursor, etc.).
Configuration
Add to your MCP settings:
{
"mcpServers": {
"docz-mcp": {
"command": "npx",
"args": ["-y", "docz-cli@latest", "mcp"],
"env": {
"DOCSYNC_API_TOKEN": "<your-token>"
}
}
}
}
Using
docz-cli@latestin MCP config ensures AI agents always use the latest version.
MCP Tools
| Tool | Description |
|---|---|
docz_list_spaces | List all accessible spaces |
docz_list_files | List files in a directory |
docz_read_file | Read file content |
docz_upload_file | Upload/create a file |
docz_mkdir | Create a folder |
docz_delete | Delete file/folder |
docz_file_history | View change history |
docz_share_create | Create share link |
docz_share_list | List share links |
docz_share_read | Read shared file by token |
docz_share_info | View share link info |
docz_share_delete | Delete share link |
docz_shortlink | Get short URL for file |
docz_diff | View file or space diff |
AI Agent Skill
Install as a reskill skill to teach AI agents how to use docz-cli:
npx reskill install github:kanyun-inc/docz-cli/skills -a claude-code cursor -y
The skill provides command reference, usage scenarios, and addressing format documentation so agents can autonomously browse, read, and write DocSync documents.
API Reference
docz-cli wraps the DocSync REST API:
| Command | API Endpoint |
|---|---|
spaces | GET /api/spaces |
ls | GET /api/spaces/{id}/tree?path= |
cat | GET /api/spaces/{id}/blob/{path} |
upload / write | POST /api/spaces/{id}/files/upload |
mkdir | POST /api/spaces/{id}/files/mkdir |
rm | POST /api/spaces/{id}/files/delete |
mv | POST /api/spaces/{id}/files/rename |
log | GET /api/spaces/{id}/log/[{path}] |
trash | GET /api/spaces/{id}/trash |
diff | GET /api/spaces/{id}/diff/[{path}]?from=&to= |
share create | POST /api/spaces/{id}/share-links |
share list | GET /api/spaces/{id}/share-links |
share update | PUT /api/spaces/{id}/share-links/{linkId} |
share cat | GET /api/share/{token} |
share info | GET /api/share/{token}/info |
share rm | DELETE /api/spaces/{id}/share-links/{linkId} |
shortlink | GET /api/spaces/{id}/file-ref?path= |
| Short URL resolve | GET /api/spaces/by-slug/{slug} + GET /api/file-refs/{fileId} |
Auth: Authorization: Bearer <token>. Backend is Git β every write is a commit.
Contributing
See CONTRIBUTING.md. Quick version:
# New branch
git checkout -b feature-xxx
# Code + tests
pnpm typecheck && pnpm lint && pnpm test && pnpm build
# Add a changeset (skipping this means no release)
pnpm changeset
# Open a PR
Once merged into main, GitHub Actions automatically bumps the version and publishes to npm β no manual npm publish, no tag, no OTP.
License
MIT
