md-confluence-cli 5.6.3 → 5.6.4
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 +128 -9
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -4,38 +4,150 @@
|
|
|
4
4
|
|
|
5
5
|
## Pull Commands
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
The `pull` command allows you to download Confluence pages as markdown files to your local machine. This is useful for:
|
|
8
|
+
|
|
9
|
+
- **Backup documentation** from Confluence
|
|
10
|
+
- **Work offline** with local markdown files
|
|
11
|
+
- **Migrate documentation** between Confluence spaces
|
|
12
|
+
- **Version control** documentation changes
|
|
13
|
+
- **Edit and republish** pages locally
|
|
8
14
|
|
|
9
15
|
### Pull a Single Page
|
|
10
16
|
|
|
17
|
+
Pull a single Confluence page by its page ID:
|
|
18
|
+
|
|
11
19
|
```bash
|
|
12
|
-
# Pull a
|
|
20
|
+
# Pull a page to default directory (./pulled-pages)
|
|
13
21
|
npx md-confluence-cli@latest pull 123456789
|
|
14
22
|
|
|
15
23
|
# Pull to a specific directory
|
|
16
24
|
npx md-confluence-cli@latest pull 123456789 --output ./docs
|
|
25
|
+
|
|
26
|
+
# Pull with overwrite existing files
|
|
27
|
+
npx md-confluence-cli@latest pull 123456789 --output ./docs --overwrite
|
|
17
28
|
```
|
|
18
29
|
|
|
19
30
|
### Pull a Page Tree (Recursive)
|
|
20
31
|
|
|
32
|
+
Pull a page and all its children recursively to create a complete documentation tree:
|
|
33
|
+
|
|
21
34
|
```bash
|
|
22
|
-
# Pull a page and all
|
|
35
|
+
# Pull a page and all children recursively (default max-depth: 10)
|
|
23
36
|
npx md-confluence-cli@latest pull 123456789 --recursive
|
|
24
37
|
|
|
25
|
-
#
|
|
38
|
+
# Pull with custom output directory
|
|
39
|
+
npx md-confluence-cli@latest pull 123456789 --output ./docs --recursive
|
|
40
|
+
|
|
41
|
+
# Limit recursion depth (useful for large page trees)
|
|
26
42
|
npx md-confluence-cli@latest pull 123456789 --recursive --max-depth 5
|
|
27
43
|
```
|
|
28
44
|
|
|
29
|
-
###
|
|
45
|
+
### Pull Command Options
|
|
46
|
+
|
|
47
|
+
| Option | Alias | Type | Default | Description |
|
|
48
|
+
|--------|-------|------|---------|-------------|
|
|
49
|
+
| `--output` | `-o` | string | `./pulled-pages` | Output directory for markdown files |
|
|
50
|
+
| `--recursive` | `-r` | boolean | `false` | Pull page and all children recursively |
|
|
51
|
+
| `--max-depth` | - | number | `10` | Maximum recursion depth when using `--recursive` |
|
|
52
|
+
| `--overwrite` | `-w` | boolean | `false` | Overwrite existing files |
|
|
53
|
+
| `--file-name-template` | `-t` | string | `{title}.md` | Template for filename generation |
|
|
54
|
+
|
|
55
|
+
### Pulled File Structure
|
|
56
|
+
|
|
57
|
+
When pulling pages with `--recursive`, the CLI creates a nested folder structure that mirrors the Confluence page hierarchy:
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
docs/
|
|
61
|
+
├── frontend/
|
|
62
|
+
│ ├── index.md # Root page (has children)
|
|
63
|
+
│ ├── mobile_app/
|
|
64
|
+
│ │ ├── index.md # Page with children
|
|
65
|
+
│ │ ├── app_info.md # Page without children
|
|
66
|
+
│ │ └── adjust_tracking_install_and_more.md
|
|
67
|
+
│ ├── launch_game.md # Page without children
|
|
68
|
+
│ └── fe_integration_credentials.md
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**Structure Rules:**
|
|
72
|
+
- **Pages with children** → Saved as `index.md` inside a folder named after the page title
|
|
73
|
+
- **Pages without children** → Saved as `{title}.md` in the parent folder
|
|
74
|
+
- **Nested hierarchy** → Maintains the exact parent-child relationships from Confluence
|
|
75
|
+
|
|
76
|
+
### Pulled File Frontmatter
|
|
77
|
+
|
|
78
|
+
Each pulled markdown file includes comprehensive frontmatter with Confluence metadata:
|
|
79
|
+
|
|
80
|
+
```yaml
|
|
81
|
+
---
|
|
82
|
+
pageId: 123456789
|
|
83
|
+
title: "Page Title"
|
|
84
|
+
spaceKey: S5
|
|
85
|
+
version: 3
|
|
86
|
+
lastUpdated: "712020:0aa84074-41f8-442b-b137-ac2d5bd53315"
|
|
87
|
+
pulledAt: "2025-11-04T10:07:13.904Z"
|
|
88
|
+
confluenceUrl: "https://s5philippines.atlassian.net/pages/viewpage.action?pageId=123456789"
|
|
89
|
+
parentId: 987654321
|
|
90
|
+
---
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Frontmatter Fields:**
|
|
94
|
+
- `pageId` - Confluence page ID (used for republishing)
|
|
95
|
+
- `title` - Page title from Confluence
|
|
96
|
+
- `spaceKey` - Confluence space key
|
|
97
|
+
- `version` - Current page version number
|
|
98
|
+
- `lastUpdated` - Last update timestamp
|
|
99
|
+
- `pulledAt` - When the page was pulled locally
|
|
100
|
+
- `confluenceUrl` - Direct link to the Confluence page
|
|
101
|
+
- `parentId` - Parent page ID (for hierarchy)
|
|
102
|
+
|
|
103
|
+
### Publishing Pulled Pages
|
|
30
104
|
|
|
105
|
+
Pulled pages can be republished back to Confluence. The `pageId` in frontmatter ensures pages are updated (not duplicated):
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# After pulling and editing locally
|
|
109
|
+
npx md-confluence-cli@latest publish "docs/frontend/index.md"
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
**Important Notes:**
|
|
113
|
+
- Pages with `pageId` in frontmatter will **update** existing Confluence pages
|
|
114
|
+
- Pages without `pageId` will **create new** pages
|
|
115
|
+
- The `connie-publish: true` frontmatter flag controls whether a page should be published
|
|
116
|
+
|
|
117
|
+
### Pull Examples
|
|
118
|
+
|
|
119
|
+
**Example 1: Pull entire documentation tree**
|
|
120
|
+
```bash
|
|
121
|
+
# Pull the "Frontend" documentation tree
|
|
122
|
+
npx md-confluence-cli@latest pull 46923777 --output ./docs --recursive
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**Example 2: Pull single page for editing**
|
|
31
126
|
```bash
|
|
32
|
-
#
|
|
33
|
-
npx md-confluence-cli@latest pull
|
|
127
|
+
# Pull a specific page to edit locally
|
|
128
|
+
npx md-confluence-cli@latest pull 94732294 --output ./docs
|
|
129
|
+
```
|
|
34
130
|
|
|
35
|
-
|
|
131
|
+
**Example 3: Pull with custom filename**
|
|
132
|
+
```bash
|
|
133
|
+
# Use custom filename template
|
|
36
134
|
npx md-confluence-cli@latest pull 123 --file-name-template "{id}_{title}.md"
|
|
37
135
|
```
|
|
38
136
|
|
|
137
|
+
**Example 4: Pull shallow tree (only 2 levels deep)**
|
|
138
|
+
```bash
|
|
139
|
+
# Limit depth for large documentation trees
|
|
140
|
+
npx md-confluence-cli@latest pull 46923777 --recursive --max-depth 2 --output ./docs
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Pull Best Practices
|
|
144
|
+
|
|
145
|
+
- **Use `--output`** to organize pulled pages into your project structure
|
|
146
|
+
- **Use `--max-depth`** when pulling large page trees to avoid excessive downloads
|
|
147
|
+
- **Use `--overwrite`** carefully - it will replace existing local files
|
|
148
|
+
- **Review frontmatter** after pulling to ensure `pageId` is correct for republishing
|
|
149
|
+
- **Test locally** before republishing pulled pages to avoid overwriting Confluence content
|
|
150
|
+
|
|
39
151
|
## Usage Examples
|
|
40
152
|
|
|
41
153
|
### CLI
|
|
@@ -69,10 +181,17 @@ set ATLASSIAN_API_TOKEN="YOUR API TOKEN"
|
|
|
69
181
|
|
|
70
182
|
[Learn more about `set` command](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/set_1)
|
|
71
183
|
|
|
72
|
-
**CLI
|
|
184
|
+
**CLI Commands**
|
|
73
185
|
|
|
74
186
|
```bash
|
|
187
|
+
# Publish markdown files to Confluence (default command)
|
|
75
188
|
npx md-confluence-cli
|
|
189
|
+
|
|
190
|
+
# Pull a single page from Confluence
|
|
191
|
+
npx md-confluence-cli pull <pageId>
|
|
192
|
+
|
|
193
|
+
# Pull a page tree recursively
|
|
194
|
+
npx md-confluence-cli pull <pageId> --recursive --output ./docs
|
|
76
195
|
```
|
|
77
196
|
|
|
78
197
|
### Docker Container
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "md-confluence-cli",
|
|
3
|
-
"version": "5.6.
|
|
3
|
+
"version": "5.6.4",
|
|
4
4
|
"description": "This CLI allows you to publish your notes to Confluence",
|
|
5
5
|
"bin": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"confluence.js": "^1.6.3",
|
|
20
20
|
"boxen": "7.1.1",
|
|
21
21
|
"chalk": "5.3.0",
|
|
22
|
-
"md-confluence-lib": "5.6.
|
|
23
|
-
"md-confluence-mermaid-puppeteer-renderer": "5.6.
|
|
22
|
+
"md-confluence-lib": "5.6.4",
|
|
23
|
+
"md-confluence-mermaid-puppeteer-renderer": "5.6.4"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"yargs": "^17.7.2"
|