docz-cli 0.3.0 → 0.5.0
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/README.md +94 -8
- package/dist/chunk-EBJ32KUL.js +562 -0
- package/dist/chunk-EBJ32KUL.js.map +1 -0
- package/dist/index.js +4 -210
- package/dist/index.js.map +1 -1
- package/dist/{mcp-LTB2ZUCO.js → mcp-26HFT6SQ.js} +149 -4
- package/dist/mcp-26HFT6SQ.js.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-N4DS7U4I.js +0 -138
- package/dist/chunk-N4DS7U4I.js.map +0 -1
- package/dist/mcp-LTB2ZUCO.js.map +0 -1
package/README.md
CHANGED
|
@@ -15,21 +15,24 @@
|
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
17
|
# Login
|
|
18
|
-
npx docz-cli login --token <your-token>
|
|
18
|
+
npx docz-cli@latest login --token <your-token>
|
|
19
19
|
|
|
20
20
|
# Browse
|
|
21
|
-
npx docz-cli spaces
|
|
22
|
-
npx docz-cli ls 研发
|
|
23
|
-
npx docz-cli cat 研发:docs/guide.md
|
|
21
|
+
npx docz-cli@latest spaces
|
|
22
|
+
npx docz-cli@latest ls 研发
|
|
23
|
+
npx docz-cli@latest cat 研发:docs/guide.md
|
|
24
24
|
|
|
25
25
|
# Write
|
|
26
|
-
npx docz-cli write 吴鹏飞:notes/todo.md '# TODO List'
|
|
26
|
+
npx docz-cli@latest write 吴鹏飞:notes/todo.md '# TODO List'
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
## Features
|
|
30
30
|
|
|
31
31
|
- **Simple addressing** — `<space>:<path>` format, Space supports name or ID
|
|
32
|
+
- **Short URL support** — paste `https://docz.xxx.com/s/slug/f/fileId` directly into cat/ls/log, or generate with `shortlink`
|
|
32
33
|
- **Full file operations** — ls, cat, upload, write, mkdir, rm, mv
|
|
34
|
+
- **Share links** — create, list, update, access, delete share links from CLI
|
|
35
|
+
- **File diff** — view file-level unified diff or space-level change summary
|
|
33
36
|
- **Git-backed** — every write creates a commit, built-in version history
|
|
34
37
|
- **Trash recovery** — deleted files recoverable within 30 days
|
|
35
38
|
- **MCP Server** — built-in stdio MCP server for AI agent integration
|
|
@@ -40,10 +43,12 @@ npx docz-cli write 吴鹏飞:notes/todo.md '# TODO List'
|
|
|
40
43
|
**Requirements:** Node.js >= 22.0.0
|
|
41
44
|
|
|
42
45
|
```bash
|
|
43
|
-
npx docz-cli <command>
|
|
44
|
-
npm install -g docz-cli
|
|
46
|
+
npx docz-cli@latest <command> # Always uses the latest version (recommended)
|
|
47
|
+
npm install -g docz-cli # Or global install, then use `docz` shorthand
|
|
45
48
|
```
|
|
46
49
|
|
|
50
|
+
> **Auto-update**: Using `npx docz-cli@latest` ensures you always run the latest version without manual updates. Global install requires `npm update -g docz-cli` to update.
|
|
51
|
+
|
|
47
52
|
> Global install registers both `docz-cli` and `docz` commands. Examples below use `docz-cli`; replace with `docz` if installed globally.
|
|
48
53
|
|
|
49
54
|
## Authentication
|
|
@@ -79,7 +84,15 @@ export DOCSYNC_API_TOKEN=<your-token>
|
|
|
79
84
|
| `rm <space>:<path>` | Delete file/folder (30-day trash) |
|
|
80
85
|
| `mv <space>:<from> <to>` | Rename or move |
|
|
81
86
|
| `log <space>[:<path>]` | Show change history |
|
|
87
|
+
| `shortlink <space>:<path>` | Get short URL for file |
|
|
82
88
|
| `trash <space>` | Show deleted files |
|
|
89
|
+
| `diff <space>[:<path>] <commit> [<from>]` | Show changes (file or space level) |
|
|
90
|
+
| `share create <space>:<path>` | Create share link |
|
|
91
|
+
| `share list <space>` | List share links |
|
|
92
|
+
| `share update <space> <link-id>` | Update share link |
|
|
93
|
+
| `share cat <token-or-url>` | Read shared file |
|
|
94
|
+
| `share info <token-or-url>` | Show share link info |
|
|
95
|
+
| `share rm <space> <link-id>` | Delete share link |
|
|
83
96
|
| `mcp` | Start MCP stdio server |
|
|
84
97
|
|
|
85
98
|
## Usage Examples
|
|
@@ -93,6 +106,21 @@ docz-cli ls 研发:docs # List subdirectory
|
|
|
93
106
|
docz-cli cat 研发:docs/guide.md # Read file content
|
|
94
107
|
```
|
|
95
108
|
|
|
109
|
+
### Short URL
|
|
110
|
+
|
|
111
|
+
Generate a short URL for any file, or paste existing short URLs into cat/ls/log:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
# Generate short URL
|
|
115
|
+
docz-cli shortlink 闫洪康:AI-Coding技巧总结12.md
|
|
116
|
+
# → https://docz.zhenguanyu.com/s/yanhongkang/f/NNjrcj8c
|
|
117
|
+
|
|
118
|
+
# Short URLs work with cat, ls, log
|
|
119
|
+
docz-cli cat https://docz.zhenguanyu.com/s/yanhongkang/f/NNjrcj8c
|
|
120
|
+
docz-cli ls https://docz.zhenguanyu.com/s/yanfa
|
|
121
|
+
docz-cli log https://docz.zhenguanyu.com/s/yanhongkang/f/NNjrcj8c
|
|
122
|
+
```
|
|
123
|
+
|
|
96
124
|
### Write
|
|
97
125
|
|
|
98
126
|
```bash
|
|
@@ -112,6 +140,46 @@ docz-cli log 研发:docs/guide.md # File history
|
|
|
112
140
|
docz-cli trash 研发 # View trash
|
|
113
141
|
```
|
|
114
142
|
|
|
143
|
+
### Share Links
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
# Create (with optional expiry and visibility)
|
|
147
|
+
docz-cli share create 研发:docs/guide.md --expires 7d --users user@co.com
|
|
148
|
+
|
|
149
|
+
# List all share links in a space
|
|
150
|
+
docz-cli share list 研发
|
|
151
|
+
docz-cli share list 研发 --file docs/guide.md # Filter by file
|
|
152
|
+
|
|
153
|
+
# Access shared content (token or full URL)
|
|
154
|
+
docz-cli share cat xYz123AbC
|
|
155
|
+
docz-cli share cat https://docz.zhenguanyu.com/share/xYz123AbC
|
|
156
|
+
docz-cli share cat xYz123AbC --raw | grep "部署" # Raw output for pipes
|
|
157
|
+
|
|
158
|
+
# View share link info
|
|
159
|
+
docz-cli share info xYz123AbC
|
|
160
|
+
|
|
161
|
+
# Update and delete (requires space context)
|
|
162
|
+
docz-cli share update 研发 <link-id> --expires 30d
|
|
163
|
+
docz-cli share rm 研发 <link-id>
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Diff
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
# View what changed in a commit (file level)
|
|
170
|
+
docz-cli diff 研发:docs/guide.md af0fb9b
|
|
171
|
+
|
|
172
|
+
# Compare two commits
|
|
173
|
+
docz-cli diff 研发:docs/guide.md af0fb9b b2c3d4e
|
|
174
|
+
|
|
175
|
+
# Space-level: which files changed in a commit
|
|
176
|
+
docz-cli diff 研发 af0fb9b
|
|
177
|
+
|
|
178
|
+
# Typical workflow: log → pick commit → diff
|
|
179
|
+
docz-cli log 研发:docs/guide.md
|
|
180
|
+
docz-cli diff 研发:docs/guide.md af0fb9b
|
|
181
|
+
```
|
|
182
|
+
|
|
115
183
|
### Pipes
|
|
116
184
|
|
|
117
185
|
`cat` outputs to stdout, `write ... -` reads from stdin. Combine with any Unix tool:
|
|
@@ -144,7 +212,7 @@ Add to your MCP settings:
|
|
|
144
212
|
"mcpServers": {
|
|
145
213
|
"docz-mcp": {
|
|
146
214
|
"command": "npx",
|
|
147
|
-
"args": ["-y", "docz-cli", "mcp"],
|
|
215
|
+
"args": ["-y", "docz-cli@latest", "mcp"],
|
|
148
216
|
"env": {
|
|
149
217
|
"DOCSYNC_API_TOKEN": "<your-token>"
|
|
150
218
|
}
|
|
@@ -153,6 +221,8 @@ Add to your MCP settings:
|
|
|
153
221
|
}
|
|
154
222
|
```
|
|
155
223
|
|
|
224
|
+
> Using `docz-cli@latest` in MCP config ensures AI agents always use the latest version.
|
|
225
|
+
|
|
156
226
|
### MCP Tools
|
|
157
227
|
|
|
158
228
|
| Tool | Description |
|
|
@@ -164,6 +234,13 @@ Add to your MCP settings:
|
|
|
164
234
|
| `docz_mkdir` | Create a folder |
|
|
165
235
|
| `docz_delete` | Delete file/folder |
|
|
166
236
|
| `docz_file_history` | View change history |
|
|
237
|
+
| `docz_share_create` | Create share link |
|
|
238
|
+
| `docz_share_list` | List share links |
|
|
239
|
+
| `docz_share_read` | Read shared file by token |
|
|
240
|
+
| `docz_share_info` | View share link info |
|
|
241
|
+
| `docz_share_delete` | Delete share link |
|
|
242
|
+
| `docz_shortlink` | Get short URL for file |
|
|
243
|
+
| `docz_diff` | View file or space diff |
|
|
167
244
|
|
|
168
245
|
## AI Agent Skill
|
|
169
246
|
|
|
@@ -190,6 +267,15 @@ docz-cli wraps the DocSync REST API:
|
|
|
190
267
|
| `mv` | `POST /api/spaces/{id}/files/rename` |
|
|
191
268
|
| `log` | `GET /api/spaces/{id}/log/[{path}]` |
|
|
192
269
|
| `trash` | `GET /api/spaces/{id}/trash` |
|
|
270
|
+
| `diff` | `GET /api/spaces/{id}/diff/[{path}]?from=&to=` |
|
|
271
|
+
| `share create` | `POST /api/spaces/{id}/share-links` |
|
|
272
|
+
| `share list` | `GET /api/spaces/{id}/share-links` |
|
|
273
|
+
| `share update` | `PUT /api/spaces/{id}/share-links/{linkId}` |
|
|
274
|
+
| `share cat` | `GET /api/share/{token}` |
|
|
275
|
+
| `share info` | `GET /api/share/{token}/info` |
|
|
276
|
+
| `share rm` | `DELETE /api/spaces/{id}/share-links/{linkId}` |
|
|
277
|
+
| `shortlink` | `GET /api/spaces/{id}/file-ref?path=` |
|
|
278
|
+
| Short URL resolve | `GET /api/spaces/by-slug/{slug}` + `GET /api/file-refs/{fileId}` |
|
|
193
279
|
|
|
194
280
|
Auth: `Authorization: Bearer <token>`. Backend is Git — every write is a commit.
|
|
195
281
|
|