confluence-cli 1.20.0 → 1.21.1
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/.claude/skills/confluence/SKILL.md +615 -0
- package/README.md +15 -5
- package/bin/confluence.js +44 -0
- package/package.json +7 -2
- package/.eslintrc.js +0 -23
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -34
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -26
- package/.github/ISSUE_TEMPLATE/feedback.md +0 -37
- package/.github/pull_request_template.md +0 -31
- package/.github/workflows/ci.yml +0 -68
- package/.releaserc +0 -17
- package/CHANGELOG.md +0 -274
- package/CONTRIBUTING.md +0 -246
- package/docs/PROMOTION.md +0 -63
- package/eslint.config.js +0 -33
- package/examples/copy-tree-example.sh +0 -117
- package/examples/create-child-page-example.sh +0 -67
- package/examples/demo-page-management.sh +0 -68
- package/examples/demo.sh +0 -43
- package/examples/sample-page.md +0 -30
- package/jest.config.js +0 -13
- package/llms.txt +0 -46
- package/tests/config.test.js +0 -79
- package/tests/confluence-client.test.js +0 -1063
|
@@ -0,0 +1,615 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: confluence
|
|
3
|
+
description: Use confluence-cli to read, search, create, update, move, and delete Confluence pages and attachments from the terminal.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# confluence-cli Skill
|
|
7
|
+
|
|
8
|
+
A CLI tool for Atlassian Confluence. Lets you read, search, create, update, move, and delete pages and attachments from the terminal or from an agent.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
npm install -g confluence-cli
|
|
14
|
+
confluence --version # verify install
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Configuration
|
|
18
|
+
|
|
19
|
+
**Preferred for agents — environment variables (no interactive prompt):**
|
|
20
|
+
|
|
21
|
+
| Variable | Description | Example |
|
|
22
|
+
|---|---|---|
|
|
23
|
+
| `CONFLUENCE_DOMAIN` | Your Confluence hostname | `company.atlassian.net` |
|
|
24
|
+
| `CONFLUENCE_API_PATH` | REST API base path | `/wiki/rest/api` (Cloud) or `/rest/api` (Server/DC) |
|
|
25
|
+
| `CONFLUENCE_AUTH_TYPE` | `basic` or `bearer` | `basic` |
|
|
26
|
+
| `CONFLUENCE_EMAIL` | Email address (basic auth only) | `user@company.com` |
|
|
27
|
+
| `CONFLUENCE_API_TOKEN` | API token or personal access token | `ATATT3x...` |
|
|
28
|
+
|
|
29
|
+
**Non-interactive init (good for CI/CD scripts):**
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
confluence init \
|
|
33
|
+
--domain "company.atlassian.net" \
|
|
34
|
+
--api-path "/wiki/rest/api" \
|
|
35
|
+
--auth-type basic \
|
|
36
|
+
--email "user@company.com" \
|
|
37
|
+
--token "ATATT3x..."
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**Cloud vs Server/DC:**
|
|
41
|
+
- Atlassian Cloud (`*.atlassian.net`): use `--api-path "/wiki/rest/api"`, auth type `basic` with email + API token
|
|
42
|
+
- Self-hosted / Data Center: use `--api-path "/rest/api"`, auth type `bearer` with a personal access token (no email needed)
|
|
43
|
+
|
|
44
|
+
## Page ID Resolution
|
|
45
|
+
|
|
46
|
+
Most commands accept `<pageId>` — a numeric ID or any of the supported URL formats below.
|
|
47
|
+
|
|
48
|
+
**Supported formats:**
|
|
49
|
+
|
|
50
|
+
| Format | Example |
|
|
51
|
+
|---|---|
|
|
52
|
+
| Numeric ID | `123456789` |
|
|
53
|
+
| `?pageId=` URL | `https://company.atlassian.net/wiki/viewpage.action?pageId=123456789` |
|
|
54
|
+
| Pretty `/pages/<id>` URL | `https://company.atlassian.net/wiki/spaces/SPACE/pages/123456789/Page+Title` |
|
|
55
|
+
| Display `/display/<space>/<title>` URL | `https://company.atlassian.net/wiki/display/SPACE/Page+Title` |
|
|
56
|
+
|
|
57
|
+
```sh
|
|
58
|
+
confluence read 123456789
|
|
59
|
+
confluence read "https://company.atlassian.net/wiki/viewpage.action?pageId=123456789"
|
|
60
|
+
confluence read "https://company.atlassian.net/wiki/spaces/MYSPACE/pages/123456789/My+Page"
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
> **Note:** Display-style URLs (`/display/<space>/<title>`) perform a title-based lookup, so the page title in the URL must match exactly. When possible, prefer numeric IDs or `/pages/<id>` URLs for reliability.
|
|
64
|
+
|
|
65
|
+
## Content Formats
|
|
66
|
+
|
|
67
|
+
| Format | Notes |
|
|
68
|
+
|---|---|
|
|
69
|
+
| `markdown` | Recommended for agent-generated content. Automatically converted by the API. |
|
|
70
|
+
| `storage` | Confluence XML storage format (default for create/update). Use for programmatic round-trips. |
|
|
71
|
+
| `html` | Raw HTML. |
|
|
72
|
+
| `text` | Plain text — for read/export output only, not for creation. |
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Commands Reference
|
|
77
|
+
|
|
78
|
+
### `init`
|
|
79
|
+
|
|
80
|
+
Initialize configuration. Saves credentials to `~/.confluence-cli/config.json`.
|
|
81
|
+
|
|
82
|
+
```sh
|
|
83
|
+
confluence init [--domain <domain>] [--api-path <path>] [--auth-type basic|bearer] [--email <email>] [--token <token>]
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
All flags are optional; omitting any flag triggers an interactive prompt for that field. Provide all flags to run fully non-interactive.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
### `read <pageId>`
|
|
91
|
+
|
|
92
|
+
Read page content. Outputs to stdout.
|
|
93
|
+
|
|
94
|
+
```sh
|
|
95
|
+
confluence read <pageId> [--format html|text|markdown]
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
| Option | Default | Description |
|
|
99
|
+
|---|---|---|
|
|
100
|
+
| `--format` | `text` | Output format: `html`, `text`, or `markdown` |
|
|
101
|
+
|
|
102
|
+
```sh
|
|
103
|
+
confluence read 123456789
|
|
104
|
+
confluence read 123456789 --format markdown
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
### `info <pageId>`
|
|
110
|
+
|
|
111
|
+
Get page metadata (title, ID, type, status, space).
|
|
112
|
+
|
|
113
|
+
```sh
|
|
114
|
+
confluence info <pageId>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
```sh
|
|
118
|
+
confluence info 123456789
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
### `find <title>`
|
|
124
|
+
|
|
125
|
+
Find a page by exact or partial title. Returns the first match.
|
|
126
|
+
|
|
127
|
+
```sh
|
|
128
|
+
confluence find <title> [--space <spaceKey>]
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
| Option | Description |
|
|
132
|
+
|---|---|
|
|
133
|
+
| `--space` | Restrict search to a specific space key |
|
|
134
|
+
|
|
135
|
+
```sh
|
|
136
|
+
confluence find "Architecture Overview"
|
|
137
|
+
confluence find "API Reference" --space MYSPACE
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
### `search <query>`
|
|
143
|
+
|
|
144
|
+
Search pages using a keyword or CQL expression.
|
|
145
|
+
|
|
146
|
+
```sh
|
|
147
|
+
confluence search <query> [--limit <number>]
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
| Option | Default | Description |
|
|
151
|
+
|---|---|---|
|
|
152
|
+
| `--limit` | `10` | Maximum number of results |
|
|
153
|
+
|
|
154
|
+
```sh
|
|
155
|
+
confluence search "deployment pipeline"
|
|
156
|
+
confluence search "type=page AND space=MYSPACE" --limit 50
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
### `spaces`
|
|
162
|
+
|
|
163
|
+
List all accessible Confluence spaces (key and name).
|
|
164
|
+
|
|
165
|
+
```sh
|
|
166
|
+
confluence spaces
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
### `children <pageId>`
|
|
172
|
+
|
|
173
|
+
List child pages of a page.
|
|
174
|
+
|
|
175
|
+
```sh
|
|
176
|
+
confluence children <pageId> [--recursive] [--max-depth <number>] [--format list|tree|json] [--show-id] [--show-url]
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
| Option | Default | Description |
|
|
180
|
+
|---|---|---|
|
|
181
|
+
| `--recursive` | false | List all descendants recursively |
|
|
182
|
+
| `--max-depth` | `10` | Maximum depth for recursive listing |
|
|
183
|
+
| `--format` | `list` | Output format: `list`, `tree`, or `json` |
|
|
184
|
+
| `--show-id` | false | Show page IDs |
|
|
185
|
+
| `--show-url` | false | Show page URLs |
|
|
186
|
+
|
|
187
|
+
```sh
|
|
188
|
+
confluence children 123456789
|
|
189
|
+
confluence children 123456789 --recursive --format json
|
|
190
|
+
confluence children 123456789 --recursive --format tree --show-id
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
### `create <title> <spaceKey>`
|
|
196
|
+
|
|
197
|
+
Create a new top-level page in a space.
|
|
198
|
+
|
|
199
|
+
```sh
|
|
200
|
+
confluence create <title> <spaceKey> [--content <string>] [--file <path>] [--format storage|html|markdown]
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
| Option | Default | Description |
|
|
204
|
+
|---|---|---|
|
|
205
|
+
| `--content` | — | Inline content string |
|
|
206
|
+
| `--file` | — | Path to content file |
|
|
207
|
+
| `--format` | `storage` | Content format |
|
|
208
|
+
|
|
209
|
+
Either `--content` or `--file` is required.
|
|
210
|
+
|
|
211
|
+
```sh
|
|
212
|
+
confluence create "Project Overview" MYSPACE --content "# Hello" --format markdown
|
|
213
|
+
confluence create "Release Notes" MYSPACE --file ./notes.md --format markdown
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Outputs the new page ID and URL on success.
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
### `create-child <title> <parentId>`
|
|
221
|
+
|
|
222
|
+
Create a child page under an existing page. Inherits the parent's space automatically.
|
|
223
|
+
|
|
224
|
+
```sh
|
|
225
|
+
confluence create-child <title> <parentId> [--content <string>] [--file <path>] [--format storage|html|markdown]
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Options are identical to `create`. Either `--content` or `--file` is required.
|
|
229
|
+
|
|
230
|
+
```sh
|
|
231
|
+
confluence create-child "Chapter 1" 123456789 --content "Content here" --format markdown
|
|
232
|
+
confluence create-child "API Guide" 123456789 --file ./api.md --format markdown
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
### `update <pageId>`
|
|
238
|
+
|
|
239
|
+
Update an existing page's title and/or content. At least one of `--title`, `--content`, or `--file` is required.
|
|
240
|
+
|
|
241
|
+
```sh
|
|
242
|
+
confluence update <pageId> [--title <title>] [--content <string>] [--file <path>] [--format storage|html|markdown]
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
| Option | Default | Description |
|
|
246
|
+
|---|---|---|
|
|
247
|
+
| `--title` | — | New title |
|
|
248
|
+
| `--content` | — | Inline content string |
|
|
249
|
+
| `--file` | — | Path to content file |
|
|
250
|
+
| `--format` | `storage` | Content format |
|
|
251
|
+
|
|
252
|
+
```sh
|
|
253
|
+
confluence update 123456789 --title "New Title"
|
|
254
|
+
confluence update 123456789 --file ./updated.md --format markdown
|
|
255
|
+
confluence update 123456789 --title "New Title" --file ./updated.xml --format storage
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
### `move <pageId_or_url> <newParentId_or_url>`
|
|
261
|
+
|
|
262
|
+
Move a page to a new parent. Both pages must be in the same space.
|
|
263
|
+
|
|
264
|
+
```sh
|
|
265
|
+
confluence move <pageId_or_url> <newParentId_or_url> [--title <newTitle>]
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
| Option | Description |
|
|
269
|
+
|---|---|
|
|
270
|
+
| `--title` | Rename the page during the move |
|
|
271
|
+
|
|
272
|
+
```sh
|
|
273
|
+
confluence move 123456789 987654321
|
|
274
|
+
confluence move 123456789 987654321 --title "Renamed After Move"
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
### `delete <pageIdOrUrl>`
|
|
280
|
+
|
|
281
|
+
Delete (trash) a page by ID or URL.
|
|
282
|
+
|
|
283
|
+
```sh
|
|
284
|
+
confluence delete <pageIdOrUrl> [--yes]
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
| Option | Description |
|
|
288
|
+
|---|---|
|
|
289
|
+
| `--yes` | Skip confirmation prompt (required for non-interactive/agent use) |
|
|
290
|
+
|
|
291
|
+
```sh
|
|
292
|
+
confluence delete 123456789 --yes
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
### `edit <pageId>`
|
|
298
|
+
|
|
299
|
+
Fetch a page's raw storage-format content for editing locally.
|
|
300
|
+
|
|
301
|
+
```sh
|
|
302
|
+
confluence edit <pageId> [--output <file>]
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
| Option | Description |
|
|
306
|
+
|---|---|
|
|
307
|
+
| `--output` | Save content to a file (instead of printing to stdout) |
|
|
308
|
+
|
|
309
|
+
```sh
|
|
310
|
+
confluence edit 123456789 --output ./page.xml
|
|
311
|
+
# Edit page.xml, then:
|
|
312
|
+
confluence update 123456789 --file ./page.xml --format storage
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
---
|
|
316
|
+
|
|
317
|
+
### `export <pageId>`
|
|
318
|
+
|
|
319
|
+
Export a page and its attachments to a local directory.
|
|
320
|
+
|
|
321
|
+
```sh
|
|
322
|
+
confluence export <pageId> [--format html|text|markdown] [--dest <directory>] [--file <filename>] [--attachments-dir <name>] [--pattern <glob>] [--referenced-only] [--skip-attachments]
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
| Option | Default | Description |
|
|
326
|
+
|---|---|---|
|
|
327
|
+
| `--format` | `markdown` | Content format for the exported file |
|
|
328
|
+
| `--dest` | `.` | Base directory to export into |
|
|
329
|
+
| `--file` | `page.<ext>` | Filename for the content file |
|
|
330
|
+
| `--attachments-dir` | `attachments` | Subdirectory name for attachments |
|
|
331
|
+
| `--pattern` | — | Glob filter for attachments (e.g. `*.png`) |
|
|
332
|
+
| `--referenced-only` | false | Only download attachments referenced in the page content |
|
|
333
|
+
| `--skip-attachments` | false | Do not download attachments |
|
|
334
|
+
|
|
335
|
+
```sh
|
|
336
|
+
confluence export 123456789 --format markdown --dest ./docs
|
|
337
|
+
confluence export 123456789 --format markdown --dest ./docs --skip-attachments
|
|
338
|
+
confluence export 123456789 --pattern "*.png" --dest ./output
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
Creates a subdirectory named after the page title under `--dest`.
|
|
342
|
+
|
|
343
|
+
---
|
|
344
|
+
|
|
345
|
+
### `attachments <pageId>`
|
|
346
|
+
|
|
347
|
+
List or download attachments for a page.
|
|
348
|
+
|
|
349
|
+
```sh
|
|
350
|
+
confluence attachments <pageId> [--limit <n>] [--pattern <glob>] [--download] [--dest <directory>]
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
| Option | Default | Description |
|
|
354
|
+
|---|---|---|
|
|
355
|
+
| `--limit` | all | Maximum number of attachments to fetch |
|
|
356
|
+
| `--pattern` | — | Filter by filename glob (e.g. `*.pdf`) |
|
|
357
|
+
| `--download` | false | Download matching attachments |
|
|
358
|
+
| `--dest` | `.` | Directory to save downloads |
|
|
359
|
+
|
|
360
|
+
```sh
|
|
361
|
+
confluence attachments 123456789
|
|
362
|
+
confluence attachments 123456789 --pattern "*.pdf" --download --dest ./downloads
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
---
|
|
366
|
+
|
|
367
|
+
### `attachment-upload <pageId>`
|
|
368
|
+
|
|
369
|
+
Upload one or more files to a page. `--file` can be repeated for multiple files.
|
|
370
|
+
|
|
371
|
+
```sh
|
|
372
|
+
confluence attachment-upload <pageId> --file <path> [--file <path> ...] [--comment <text>] [--replace] [--minor-edit]
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
| Option | Description |
|
|
376
|
+
|---|---|
|
|
377
|
+
| `--file` | File to upload (required, repeatable) |
|
|
378
|
+
| `--comment` | Comment for the attachment(s) |
|
|
379
|
+
| `--replace` | Replace an existing attachment with the same filename |
|
|
380
|
+
| `--minor-edit` | Mark the upload as a minor edit |
|
|
381
|
+
|
|
382
|
+
```sh
|
|
383
|
+
confluence attachment-upload 123456789 --file ./report.pdf
|
|
384
|
+
confluence attachment-upload 123456789 --file ./a.png --file ./b.png --replace
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
---
|
|
388
|
+
|
|
389
|
+
### `attachment-delete <pageId> <attachmentId>`
|
|
390
|
+
|
|
391
|
+
Delete an attachment from a page.
|
|
392
|
+
|
|
393
|
+
```sh
|
|
394
|
+
confluence attachment-delete <pageId> <attachmentId> [--yes]
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
| Option | Description |
|
|
398
|
+
|---|---|
|
|
399
|
+
| `--yes` | Skip confirmation prompt |
|
|
400
|
+
|
|
401
|
+
```sh
|
|
402
|
+
confluence attachment-delete 123456789 att-987 --yes
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
---
|
|
406
|
+
|
|
407
|
+
### `comments <pageId>`
|
|
408
|
+
|
|
409
|
+
List comments for a page.
|
|
410
|
+
|
|
411
|
+
```sh
|
|
412
|
+
confluence comments <pageId> [--format text|markdown|json] [--limit <n>] [--start <n>] [--location inline,footer,resolved] [--depth all] [--all]
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
| Option | Default | Description |
|
|
416
|
+
|---|---|---|
|
|
417
|
+
| `--format` | `text` | Output format: `text`, `markdown`, or `json` |
|
|
418
|
+
| `--limit` | `25` | Maximum comments per page |
|
|
419
|
+
| `--start` | `0` | Start index for pagination |
|
|
420
|
+
| `--location` | — | Filter by location: `inline`, `footer`, `resolved` (comma-separated) |
|
|
421
|
+
| `--depth` | — | Leave empty for root-only; `all` for all nested replies |
|
|
422
|
+
| `--all` | false | Fetch all comments (ignores pagination) |
|
|
423
|
+
|
|
424
|
+
```sh
|
|
425
|
+
confluence comments 123456789
|
|
426
|
+
confluence comments 123456789 --format json --all
|
|
427
|
+
confluence comments 123456789 --location footer --depth all
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
---
|
|
431
|
+
|
|
432
|
+
### `comment <pageId>`
|
|
433
|
+
|
|
434
|
+
Create a comment on a page (footer or inline).
|
|
435
|
+
|
|
436
|
+
```sh
|
|
437
|
+
confluence comment <pageId> [--content <string>] [--file <path>] [--format storage|html|markdown] [--parent <commentId>] [--location footer|inline] [--inline-selection <text>] [--inline-original-selection <text>] [--inline-marker-ref <ref>] [--inline-properties <json>]
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
| Option | Default | Description |
|
|
441
|
+
|---|---|---|
|
|
442
|
+
| `--content` | — | Inline content string |
|
|
443
|
+
| `--file` | — | Path to content file |
|
|
444
|
+
| `--format` | `storage` | Content format |
|
|
445
|
+
| `--parent` | — | Reply to a comment by ID |
|
|
446
|
+
| `--location` | `footer` | `footer` or `inline` |
|
|
447
|
+
| `--inline-selection` | — | Highlighted selection text (inline only) |
|
|
448
|
+
| `--inline-original-selection` | — | Original selection text (inline only) |
|
|
449
|
+
| `--inline-marker-ref` | — | Marker reference (inline only) |
|
|
450
|
+
| `--inline-properties` | — | Full inline properties as JSON (advanced) |
|
|
451
|
+
|
|
452
|
+
Either `--content` or `--file` is required.
|
|
453
|
+
|
|
454
|
+
```sh
|
|
455
|
+
confluence comment 123456789 --content "Looks good!" --location footer
|
|
456
|
+
confluence comment 123456789 --content "See note" --parent 456 --location footer
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
> **Note on inline comments**: Creating a brand-new inline comment requires editor highlight metadata (`matchIndex`, `lastFetchTime`, `serializedHighlights`) that is only available in the Confluence editor. This metadata is not accessible via the REST API, so inline comment creation will typically fail with a 400 error. Use `--location footer` or reply to an existing inline comment with `--parent <commentId>` instead.
|
|
460
|
+
|
|
461
|
+
---
|
|
462
|
+
|
|
463
|
+
### `comment-delete <commentId>`
|
|
464
|
+
|
|
465
|
+
Delete a comment by its ID.
|
|
466
|
+
|
|
467
|
+
```sh
|
|
468
|
+
confluence comment-delete <commentId> [--yes]
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
| Option | Description |
|
|
472
|
+
|---|---|
|
|
473
|
+
| `--yes` | Skip confirmation prompt |
|
|
474
|
+
|
|
475
|
+
```sh
|
|
476
|
+
confluence comment-delete 456789 --yes
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
---
|
|
480
|
+
|
|
481
|
+
### `copy-tree <sourcePageId> <targetParentId> [newTitle]`
|
|
482
|
+
|
|
483
|
+
Copy a page and all its children to a new location.
|
|
484
|
+
|
|
485
|
+
```sh
|
|
486
|
+
confluence copy-tree <sourcePageId> <targetParentId> [newTitle] [--max-depth <depth>] [--exclude <patterns>] [--delay-ms <ms>] [--copy-suffix <suffix>] [--dry-run] [--fail-on-error] [--quiet]
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
| Option | Default | Description |
|
|
490
|
+
|---|---|---|
|
|
491
|
+
| `--max-depth` | `10` | Maximum depth to copy |
|
|
492
|
+
| `--exclude` | — | Comma-separated title patterns to exclude (supports wildcards) |
|
|
493
|
+
| `--delay-ms` | `100` | Delay between sibling creations in ms |
|
|
494
|
+
| `--copy-suffix` | `" (Copy)"` | Suffix appended to the root page title |
|
|
495
|
+
| `--dry-run` | false | Preview operations without creating pages |
|
|
496
|
+
| `--fail-on-error` | false | Exit with non-zero code if any page fails |
|
|
497
|
+
| `--quiet` | false | Suppress progress output |
|
|
498
|
+
|
|
499
|
+
```sh
|
|
500
|
+
# Preview first
|
|
501
|
+
confluence copy-tree 123456789 987654321 --dry-run
|
|
502
|
+
|
|
503
|
+
# Copy with a custom title
|
|
504
|
+
confluence copy-tree 123456789 987654321 "Backup Copy"
|
|
505
|
+
|
|
506
|
+
# Copy excluding certain pages
|
|
507
|
+
confluence copy-tree 123456789 987654321 --exclude "Draft*,Archive*"
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
---
|
|
511
|
+
|
|
512
|
+
### `stats`
|
|
513
|
+
|
|
514
|
+
Show local usage statistics.
|
|
515
|
+
|
|
516
|
+
```sh
|
|
517
|
+
confluence stats
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
---
|
|
521
|
+
|
|
522
|
+
### `install-skill`
|
|
523
|
+
|
|
524
|
+
Copy the Claude Code skill documentation into your project's `.claude/skills/` directory so Claude Code can learn confluence-cli automatically.
|
|
525
|
+
|
|
526
|
+
```sh
|
|
527
|
+
confluence install-skill [--dest <directory>] [--yes]
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
| Option | Default | Description |
|
|
531
|
+
|---|---|---|
|
|
532
|
+
| `--dest` | `./.claude/skills/confluence` | Target directory |
|
|
533
|
+
| `--yes` | false | Skip overwrite confirmation |
|
|
534
|
+
|
|
535
|
+
```sh
|
|
536
|
+
confluence install-skill
|
|
537
|
+
```
|
|
538
|
+
|
|
539
|
+
---
|
|
540
|
+
|
|
541
|
+
## Common Agent Workflows
|
|
542
|
+
|
|
543
|
+
### Read → Edit → Update (round-trip)
|
|
544
|
+
|
|
545
|
+
```sh
|
|
546
|
+
# 1. Fetch raw storage XML
|
|
547
|
+
confluence edit 123456789 --output ./page.xml
|
|
548
|
+
|
|
549
|
+
# 2. Modify page.xml with your tool of choice
|
|
550
|
+
|
|
551
|
+
# 3. Push the updated content
|
|
552
|
+
confluence update 123456789 --file ./page.xml --format storage
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
### Build a documentation hierarchy
|
|
556
|
+
|
|
557
|
+
```sh
|
|
558
|
+
# Create root page, note the returned ID (e.g. 111222333)
|
|
559
|
+
confluence create "Project Overview" MYSPACE --content "# Overview" --format markdown
|
|
560
|
+
|
|
561
|
+
# Add children under it
|
|
562
|
+
confluence create-child "Architecture" 111222333 --content "# Architecture" --format markdown
|
|
563
|
+
confluence create-child "API Reference" 111222333 --file ./api.md --format markdown
|
|
564
|
+
confluence create-child "Runbooks" 111222333 --content "# Runbooks" --format markdown
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
### Copy a full page tree
|
|
568
|
+
|
|
569
|
+
```sh
|
|
570
|
+
# Preview first
|
|
571
|
+
confluence copy-tree 123456789 987654321 --dry-run
|
|
572
|
+
|
|
573
|
+
# Execute the copy
|
|
574
|
+
confluence copy-tree 123456789 987654321 "Backup Copy"
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
### Export a page for local editing
|
|
578
|
+
|
|
579
|
+
```sh
|
|
580
|
+
confluence export 123456789 --format markdown --dest ./local-docs
|
|
581
|
+
# => ./local-docs/<page-title>/page.md + ./local-docs/<page-title>/attachments/
|
|
582
|
+
```
|
|
583
|
+
|
|
584
|
+
### Process children as JSON
|
|
585
|
+
|
|
586
|
+
```sh
|
|
587
|
+
confluence children 123456789 --recursive --format json | jq '.[].id'
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
### Search and process results
|
|
591
|
+
|
|
592
|
+
```sh
|
|
593
|
+
confluence search "release notes" --limit 20
|
|
594
|
+
```
|
|
595
|
+
|
|
596
|
+
---
|
|
597
|
+
|
|
598
|
+
## Agent Tips
|
|
599
|
+
|
|
600
|
+
- **Always use `--yes`** on destructive commands (`delete`, `comment-delete`, `attachment-delete`) to avoid interactive prompts blocking the agent.
|
|
601
|
+
- **Prefer `--format markdown`** when creating or updating content from agent-generated text — it's the most natural format and the API converts it automatically.
|
|
602
|
+
- **Use `--format json`** on `children` and `comments` for machine-parseable output.
|
|
603
|
+
- **ANSI color codes**: stdout may contain ANSI escape sequences. Pipe through `| cat` or use `NO_COLOR=1` if your downstream tool doesn't handle them.
|
|
604
|
+
- **Page ID vs URL**: when you have a Confluence URL, extract `?pageId=<number>` and pass the number. Do not pass pretty/display URLs — they are not supported.
|
|
605
|
+
- **Cross-space moves**: `confluence move` only works within the same space. Moving across spaces is not supported.
|
|
606
|
+
|
|
607
|
+
## Error Patterns
|
|
608
|
+
|
|
609
|
+
| Error | Cause | Fix |
|
|
610
|
+
|---|---|---|
|
|
611
|
+
| `No configuration found` | No config file and no env vars set | Set env vars or run `confluence init` |
|
|
612
|
+
| `Cross-space moves are not supported` | `move` used across spaces | Copy with `copy-tree` instead |
|
|
613
|
+
| 400 on inline comment creation | Editor metadata required | Use `--location footer` or reply to existing inline comment with `--parent` |
|
|
614
|
+
| `File not found: <path>` | `--file` path doesn't exist | Check the path before calling the command |
|
|
615
|
+
| `At least one of --title, --file, or --content must be provided` | `update` called with no content options | Provide at least one of the required options |
|
package/README.md
CHANGED
|
@@ -29,6 +29,18 @@ Or run directly with npx:
|
|
|
29
29
|
npx confluence-cli
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
+
## Claude Code AI Skills
|
|
33
|
+
|
|
34
|
+
If you use [Claude Code](https://claude.ai/code) or any AI agent that reads `.claude/skills/`, install the skill documentation so the agent understands all confluence-cli commands automatically.
|
|
35
|
+
|
|
36
|
+
Run this from your project root after installing confluence-cli:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
confluence install-skill
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
This creates `.claude/skills/confluence/SKILL.md` in your current directory. Claude Code picks it up automatically and can help you with any confluence-cli command.
|
|
43
|
+
|
|
32
44
|
## Quick Start
|
|
33
45
|
|
|
34
46
|
1. **Initialize configuration:**
|
|
@@ -521,12 +533,10 @@ Check out our [Contributing Guide](CONTRIBUTING.md) - all contributions are welc
|
|
|
521
533
|
|
|
522
534
|
### 📈 Usage Analytics
|
|
523
535
|
|
|
524
|
-
|
|
525
|
-
- Command usage
|
|
526
|
-
- Error patterns (to fix bugs faster)
|
|
527
|
-
- Feature adoption metrics
|
|
536
|
+
confluence-cli tracks command usage statistics **locally** on your machine (`~/.confluence-cli/stats.json`). No data is sent to any external server. This includes:
|
|
537
|
+
- Command usage counts (success/error)
|
|
528
538
|
|
|
529
|
-
You can
|
|
539
|
+
You can view your stats with `confluence stats`, or disable tracking by setting: `export CONFLUENCE_CLI_ANALYTICS=false`
|
|
530
540
|
|
|
531
541
|
---
|
|
532
542
|
|
package/bin/confluence.js
CHANGED
|
@@ -140,6 +140,50 @@ program
|
|
|
140
140
|
}
|
|
141
141
|
});
|
|
142
142
|
|
|
143
|
+
// Install skill command
|
|
144
|
+
program
|
|
145
|
+
.command('install-skill')
|
|
146
|
+
.description('Copy Claude Code skill files into your project\'s .claude/skills/ directory')
|
|
147
|
+
.option('--dest <directory>', 'Target directory', './.claude/skills/confluence')
|
|
148
|
+
.option('-y, --yes', 'Skip confirmation prompt')
|
|
149
|
+
.action(async (options) => {
|
|
150
|
+
const fs = require('fs');
|
|
151
|
+
const path = require('path');
|
|
152
|
+
|
|
153
|
+
const skillSrc = path.join(__dirname, '..', '.claude', 'skills', 'confluence', 'SKILL.md');
|
|
154
|
+
|
|
155
|
+
if (!fs.existsSync(skillSrc)) {
|
|
156
|
+
console.error(chalk.red('Error: skill file not found in package. Try reinstalling confluence-cli.'));
|
|
157
|
+
process.exit(1);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const destDir = path.resolve(options.dest);
|
|
161
|
+
const destFile = path.join(destDir, 'SKILL.md');
|
|
162
|
+
|
|
163
|
+
if (fs.existsSync(destFile) && !options.yes) {
|
|
164
|
+
const { confirmed } = await inquirer.prompt([
|
|
165
|
+
{
|
|
166
|
+
type: 'confirm',
|
|
167
|
+
name: 'confirmed',
|
|
168
|
+
default: true,
|
|
169
|
+
message: `Overwrite existing skill file at ${destFile}?`
|
|
170
|
+
}
|
|
171
|
+
]);
|
|
172
|
+
|
|
173
|
+
if (!confirmed) {
|
|
174
|
+
console.log(chalk.yellow('Cancelled.'));
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
fs.mkdirSync(destDir, { recursive: true });
|
|
180
|
+
fs.copyFileSync(skillSrc, destFile);
|
|
181
|
+
|
|
182
|
+
console.log(chalk.green('✅ Skill installed successfully!'));
|
|
183
|
+
console.log(`Location: ${chalk.gray(destFile)}`);
|
|
184
|
+
console.log(chalk.yellow('Claude Code will now pick up confluence-cli knowledge from this file.'));
|
|
185
|
+
});
|
|
186
|
+
|
|
143
187
|
// Create command
|
|
144
188
|
program
|
|
145
189
|
.command('create <title> <spaceKey>')
|