@hesed/conni 0.1.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 +449 -0
- package/bin/dev.cmd +3 -0
- package/bin/dev.js +5 -0
- package/bin/run.cmd +3 -0
- package/bin/run.js +5 -0
- package/dist/commands/conni/auth/add.d.ts +14 -0
- package/dist/commands/conni/auth/add.js +55 -0
- package/dist/commands/conni/auth/test.d.ts +10 -0
- package/dist/commands/conni/auth/test.js +32 -0
- package/dist/commands/conni/auth/update.d.ts +14 -0
- package/dist/commands/conni/auth/update.js +77 -0
- package/dist/commands/conni/content/attachment-download.d.ts +13 -0
- package/dist/commands/conni/content/attachment-download.js +44 -0
- package/dist/commands/conni/content/attachment.d.ts +13 -0
- package/dist/commands/conni/content/attachment.js +40 -0
- package/dist/commands/conni/content/comment-delete.d.ts +12 -0
- package/dist/commands/conni/content/comment-delete.js +29 -0
- package/dist/commands/conni/content/comment-update.d.ts +13 -0
- package/dist/commands/conni/content/comment-update.js +35 -0
- package/dist/commands/conni/content/comment.d.ts +13 -0
- package/dist/commands/conni/content/comment.js +35 -0
- package/dist/commands/conni/content/create.d.ts +11 -0
- package/dist/commands/conni/content/create.js +50 -0
- package/dist/commands/conni/content/delete.d.ts +12 -0
- package/dist/commands/conni/content/delete.js +29 -0
- package/dist/commands/conni/content/get.d.ts +12 -0
- package/dist/commands/conni/content/get.js +29 -0
- package/dist/commands/conni/content/search.d.ts +14 -0
- package/dist/commands/conni/content/search.js +34 -0
- package/dist/commands/conni/content/update.d.ts +12 -0
- package/dist/commands/conni/content/update.js +35 -0
- package/dist/commands/conni/space/get.d.ts +12 -0
- package/dist/commands/conni/space/get.js +29 -0
- package/dist/commands/conni/space/list.d.ts +9 -0
- package/dist/commands/conni/space/list.js +26 -0
- package/dist/config.d.ts +10 -0
- package/dist/config.js +18 -0
- package/dist/conni/conni-api.d.ts +88 -0
- package/dist/conni/conni-api.js +447 -0
- package/dist/conni/conni-client.d.ts +88 -0
- package/dist/conni/conni-client.js +148 -0
- package/dist/format.d.ts +4 -0
- package/dist/format.js +10 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +1 -0
- package/oclif.manifest.json +667 -0
- package/package.json +107 -0
package/README.md
ADDED
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
# conni
|
|
2
|
+
|
|
3
|
+
CLI for Confluence API interaction
|
|
4
|
+
|
|
5
|
+
[](https://npmjs.org/package/@hesed/conni)
|
|
6
|
+
[](https://npmjs.org/package/@hesed/conni)
|
|
7
|
+
|
|
8
|
+
# Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
sdkck plugins install @hesed/conni
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
<!-- toc -->
|
|
15
|
+
* [conni](#conni)
|
|
16
|
+
* [Install](#install)
|
|
17
|
+
* [Usage](#usage)
|
|
18
|
+
* [Commands](#commands)
|
|
19
|
+
<!-- tocstop -->
|
|
20
|
+
|
|
21
|
+
# Usage
|
|
22
|
+
|
|
23
|
+
<!-- usage -->
|
|
24
|
+
```sh-session
|
|
25
|
+
$ npm install -g @hesed/conni
|
|
26
|
+
$ conni COMMAND
|
|
27
|
+
running command...
|
|
28
|
+
$ conni (--version)
|
|
29
|
+
@hesed/conni/0.1.0 darwin-arm64 node-v22.14.0
|
|
30
|
+
$ conni --help [COMMAND]
|
|
31
|
+
USAGE
|
|
32
|
+
$ conni COMMAND
|
|
33
|
+
...
|
|
34
|
+
```
|
|
35
|
+
<!-- usagestop -->
|
|
36
|
+
|
|
37
|
+
# Commands
|
|
38
|
+
|
|
39
|
+
<!-- commands -->
|
|
40
|
+
* [`conni conni auth add`](#conni-conni-auth-add)
|
|
41
|
+
* [`conni conni auth test`](#conni-conni-auth-test)
|
|
42
|
+
* [`conni conni auth update`](#conni-conni-auth-update)
|
|
43
|
+
* [`conni conni content attachment PAGEID FILE`](#conni-conni-content-attachment-pageid-file)
|
|
44
|
+
* [`conni conni content attachment-download ATTACHMENTID [OUTPUTPATH]`](#conni-conni-content-attachment-download-attachmentid-outputpath)
|
|
45
|
+
* [`conni conni content comment PAGEID BODY`](#conni-conni-content-comment-pageid-body)
|
|
46
|
+
* [`conni conni content comment-delete ID`](#conni-conni-content-comment-delete-id)
|
|
47
|
+
* [`conni conni content comment-update ID BODY`](#conni-conni-content-comment-update-id-body)
|
|
48
|
+
* [`conni conni content create`](#conni-conni-content-create)
|
|
49
|
+
* [`conni conni content delete PAGEID`](#conni-conni-content-delete-pageid)
|
|
50
|
+
* [`conni conni content get PAGEID`](#conni-conni-content-get-pageid)
|
|
51
|
+
* [`conni conni content search CQL`](#conni-conni-content-search-cql)
|
|
52
|
+
* [`conni conni content update PAGEID`](#conni-conni-content-update-pageid)
|
|
53
|
+
* [`conni conni space get SPACEKEY`](#conni-conni-space-get-spacekey)
|
|
54
|
+
* [`conni conni space list`](#conni-conni-space-list)
|
|
55
|
+
|
|
56
|
+
## `conni conni auth add`
|
|
57
|
+
|
|
58
|
+
Add Atlassian authentication
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
USAGE
|
|
62
|
+
$ conni conni auth add [--json] [-e <value>] [-t <value>] [-u <value>]
|
|
63
|
+
|
|
64
|
+
FLAGS
|
|
65
|
+
-e, --email=<value> Account email:
|
|
66
|
+
-t, --token=<value> API Token:
|
|
67
|
+
-u, --url=<value> Atlassian URL (start with https://):
|
|
68
|
+
|
|
69
|
+
GLOBAL FLAGS
|
|
70
|
+
--json Format output as json.
|
|
71
|
+
|
|
72
|
+
DESCRIPTION
|
|
73
|
+
Add Atlassian authentication
|
|
74
|
+
|
|
75
|
+
EXAMPLES
|
|
76
|
+
$ conni conni auth add
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
_See code: [src/commands/conni/auth/add.ts](https://github.com/hesedcasa/conni/blob/v0.1.0/src/commands/conni/auth/add.ts)_
|
|
80
|
+
|
|
81
|
+
## `conni conni auth test`
|
|
82
|
+
|
|
83
|
+
Test authentication and connection
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
USAGE
|
|
87
|
+
$ conni conni auth test [--json]
|
|
88
|
+
|
|
89
|
+
GLOBAL FLAGS
|
|
90
|
+
--json Format output as json.
|
|
91
|
+
|
|
92
|
+
DESCRIPTION
|
|
93
|
+
Test authentication and connection
|
|
94
|
+
|
|
95
|
+
EXAMPLES
|
|
96
|
+
$ conni conni auth test
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
_See code: [src/commands/conni/auth/test.ts](https://github.com/hesedcasa/conni/blob/v0.1.0/src/commands/conni/auth/test.ts)_
|
|
100
|
+
|
|
101
|
+
## `conni conni auth update`
|
|
102
|
+
|
|
103
|
+
Update existing authentication
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
USAGE
|
|
107
|
+
$ conni conni auth update [--json] [-e <value>] [-t <value>] [-u <value>]
|
|
108
|
+
|
|
109
|
+
FLAGS
|
|
110
|
+
-e, --email=<value> Account email
|
|
111
|
+
-t, --token=<value> API Token
|
|
112
|
+
-u, --url=<value> Atlassian instance URL (start with https://)
|
|
113
|
+
|
|
114
|
+
GLOBAL FLAGS
|
|
115
|
+
--json Format output as json.
|
|
116
|
+
|
|
117
|
+
DESCRIPTION
|
|
118
|
+
Update existing authentication
|
|
119
|
+
|
|
120
|
+
EXAMPLES
|
|
121
|
+
$ conni conni auth update
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
_See code: [src/commands/conni/auth/update.ts](https://github.com/hesedcasa/conni/blob/v0.1.0/src/commands/conni/auth/update.ts)_
|
|
125
|
+
|
|
126
|
+
## `conni conni content attachment PAGEID FILE`
|
|
127
|
+
|
|
128
|
+
Add attachment to Confluence content
|
|
129
|
+
|
|
130
|
+
```
|
|
131
|
+
USAGE
|
|
132
|
+
$ conni conni content attachment PAGEID FILE [--toon]
|
|
133
|
+
|
|
134
|
+
ARGUMENTS
|
|
135
|
+
PAGEID Page ID
|
|
136
|
+
FILE Path to the file to upload
|
|
137
|
+
|
|
138
|
+
FLAGS
|
|
139
|
+
--toon Format output as toon
|
|
140
|
+
|
|
141
|
+
DESCRIPTION
|
|
142
|
+
Add attachment to Confluence content
|
|
143
|
+
|
|
144
|
+
EXAMPLES
|
|
145
|
+
$ conni conni content attachment 123456 ./document.pdf
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
_See code: [src/commands/conni/content/attachment.ts](https://github.com/hesedcasa/conni/blob/v0.1.0/src/commands/conni/content/attachment.ts)_
|
|
149
|
+
|
|
150
|
+
## `conni conni content attachment-download ATTACHMENTID [OUTPUTPATH]`
|
|
151
|
+
|
|
152
|
+
Download attachment from Confluence content
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
USAGE
|
|
156
|
+
$ conni conni content attachment-download ATTACHMENTID [OUTPUTPATH] [--toon]
|
|
157
|
+
|
|
158
|
+
ARGUMENTS
|
|
159
|
+
ATTACHMENTID Attachment ID
|
|
160
|
+
[OUTPUTPATH] Output file path
|
|
161
|
+
|
|
162
|
+
FLAGS
|
|
163
|
+
--toon Format output as toon
|
|
164
|
+
|
|
165
|
+
DESCRIPTION
|
|
166
|
+
Download attachment from Confluence content
|
|
167
|
+
|
|
168
|
+
EXAMPLES
|
|
169
|
+
$ conni conni content attachment-download att12345
|
|
170
|
+
|
|
171
|
+
$ conni conni content attachment-download att12345 ./document.pdf
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
_See code: [src/commands/conni/content/attachment-download.ts](https://github.com/hesedcasa/conni/blob/v0.1.0/src/commands/conni/content/attachment-download.ts)_
|
|
175
|
+
|
|
176
|
+
## `conni conni content comment PAGEID BODY`
|
|
177
|
+
|
|
178
|
+
Add comment to Confluence content
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
USAGE
|
|
182
|
+
$ conni conni content comment PAGEID BODY [--toon]
|
|
183
|
+
|
|
184
|
+
ARGUMENTS
|
|
185
|
+
PAGEID Page ID
|
|
186
|
+
BODY Comment in Markdown format
|
|
187
|
+
|
|
188
|
+
FLAGS
|
|
189
|
+
--toon Format output as toon
|
|
190
|
+
|
|
191
|
+
DESCRIPTION
|
|
192
|
+
Add comment to Confluence content
|
|
193
|
+
|
|
194
|
+
EXAMPLES
|
|
195
|
+
$ conni conni content comment 123456 "
|
|
196
|
+
# Header
|
|
197
|
+
## Sub-header
|
|
198
|
+
- Item 1
|
|
199
|
+
- Item 2
|
|
200
|
+
```bash
|
|
201
|
+
ls -a
|
|
202
|
+
```"
|
|
203
|
+
|
|
204
|
+
$ conni conni content comment 123456 "$(cat content.md)"
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
_See code: [src/commands/conni/content/comment.ts](https://github.com/hesedcasa/conni/blob/v0.1.0/src/commands/conni/content/comment.ts)_
|
|
208
|
+
|
|
209
|
+
## `conni conni content comment-delete ID`
|
|
210
|
+
|
|
211
|
+
Delete comment from Confluence content
|
|
212
|
+
|
|
213
|
+
```
|
|
214
|
+
USAGE
|
|
215
|
+
$ conni conni content comment-delete ID [--toon]
|
|
216
|
+
|
|
217
|
+
ARGUMENTS
|
|
218
|
+
ID Comment ID to delete
|
|
219
|
+
|
|
220
|
+
FLAGS
|
|
221
|
+
--toon Format output as toon
|
|
222
|
+
|
|
223
|
+
DESCRIPTION
|
|
224
|
+
Delete comment from Confluence content
|
|
225
|
+
|
|
226
|
+
EXAMPLES
|
|
227
|
+
$ conni conni content comment-delete 1544224770
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
_See code: [src/commands/conni/content/comment-delete.ts](https://github.com/hesedcasa/conni/blob/v0.1.0/src/commands/conni/content/comment-delete.ts)_
|
|
231
|
+
|
|
232
|
+
## `conni conni content comment-update ID BODY`
|
|
233
|
+
|
|
234
|
+
Update a comment
|
|
235
|
+
|
|
236
|
+
```
|
|
237
|
+
USAGE
|
|
238
|
+
$ conni conni content comment-update ID BODY [--toon]
|
|
239
|
+
|
|
240
|
+
ARGUMENTS
|
|
241
|
+
ID Comment ID to update
|
|
242
|
+
BODY Comment in Markdown format
|
|
243
|
+
|
|
244
|
+
FLAGS
|
|
245
|
+
--toon Format output as toon
|
|
246
|
+
|
|
247
|
+
DESCRIPTION
|
|
248
|
+
Update a comment
|
|
249
|
+
|
|
250
|
+
EXAMPLES
|
|
251
|
+
$ conni conni content comment-update 1544224770 "
|
|
252
|
+
# Header
|
|
253
|
+
## Sub-header
|
|
254
|
+
- Item 1
|
|
255
|
+
- Item 2
|
|
256
|
+
```bash
|
|
257
|
+
ls -a
|
|
258
|
+
```"
|
|
259
|
+
|
|
260
|
+
$ conni conni content comment-update 1544224770 "$(cat content.md)"
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
_See code: [src/commands/conni/content/comment-update.ts](https://github.com/hesedcasa/conni/blob/v0.1.0/src/commands/conni/content/comment-update.ts)_
|
|
264
|
+
|
|
265
|
+
## `conni conni content create`
|
|
266
|
+
|
|
267
|
+
Create a new Confluence page
|
|
268
|
+
|
|
269
|
+
```
|
|
270
|
+
USAGE
|
|
271
|
+
$ conni conni content create --fields <value>... [--toon]
|
|
272
|
+
|
|
273
|
+
FLAGS
|
|
274
|
+
--fields=<value>... (required) Content fields in key=value format
|
|
275
|
+
--toon Format output as toon
|
|
276
|
+
|
|
277
|
+
DESCRIPTION
|
|
278
|
+
Create a new Confluence page
|
|
279
|
+
|
|
280
|
+
EXAMPLES
|
|
281
|
+
$ conni conni content create --fields spaceKey="DEV" title="New title" body="New description" status="draft"
|
|
282
|
+
|
|
283
|
+
$ conni conni content create --fields spaceKey="DEV" title="New title" body='
|
|
284
|
+
# Header
|
|
285
|
+
## Sub-header
|
|
286
|
+
- Item 1
|
|
287
|
+
- Item 2
|
|
288
|
+
```bash
|
|
289
|
+
ls -a
|
|
290
|
+
```'
|
|
291
|
+
|
|
292
|
+
FLAG DESCRIPTIONS
|
|
293
|
+
--fields=<value>... Content fields in key=value format
|
|
294
|
+
|
|
295
|
+
Minimum fields required: spaceKey, title & body
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
_See code: [src/commands/conni/content/create.ts](https://github.com/hesedcasa/conni/blob/v0.1.0/src/commands/conni/content/create.ts)_
|
|
299
|
+
|
|
300
|
+
## `conni conni content delete PAGEID`
|
|
301
|
+
|
|
302
|
+
Delete a Confluence page
|
|
303
|
+
|
|
304
|
+
```
|
|
305
|
+
USAGE
|
|
306
|
+
$ conni conni content delete PAGEID [--toon]
|
|
307
|
+
|
|
308
|
+
ARGUMENTS
|
|
309
|
+
PAGEID Page ID to delete
|
|
310
|
+
|
|
311
|
+
FLAGS
|
|
312
|
+
--toon Format output as toon
|
|
313
|
+
|
|
314
|
+
DESCRIPTION
|
|
315
|
+
Delete a Confluence page
|
|
316
|
+
|
|
317
|
+
EXAMPLES
|
|
318
|
+
$ conni conni content delete 1543634992
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
_See code: [src/commands/conni/content/delete.ts](https://github.com/hesedcasa/conni/blob/v0.1.0/src/commands/conni/content/delete.ts)_
|
|
322
|
+
|
|
323
|
+
## `conni conni content get PAGEID`
|
|
324
|
+
|
|
325
|
+
Get details of a Confluence content
|
|
326
|
+
|
|
327
|
+
```
|
|
328
|
+
USAGE
|
|
329
|
+
$ conni conni content get PAGEID [--toon]
|
|
330
|
+
|
|
331
|
+
ARGUMENTS
|
|
332
|
+
PAGEID Page ID
|
|
333
|
+
|
|
334
|
+
FLAGS
|
|
335
|
+
--toon Format output as toon
|
|
336
|
+
|
|
337
|
+
DESCRIPTION
|
|
338
|
+
Get details of a Confluence content
|
|
339
|
+
|
|
340
|
+
EXAMPLES
|
|
341
|
+
$ conni conni content get 1544060948
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
_See code: [src/commands/conni/content/get.ts](https://github.com/hesedcasa/conni/blob/v0.1.0/src/commands/conni/content/get.ts)_
|
|
345
|
+
|
|
346
|
+
## `conni conni content search CQL`
|
|
347
|
+
|
|
348
|
+
Search for Confluence contents using CQL
|
|
349
|
+
|
|
350
|
+
```
|
|
351
|
+
USAGE
|
|
352
|
+
$ conni conni content search CQL [--expand <value>] [--limit <value>] [--toon]
|
|
353
|
+
|
|
354
|
+
ARGUMENTS
|
|
355
|
+
CQL CQL expression
|
|
356
|
+
|
|
357
|
+
FLAGS
|
|
358
|
+
--expand=<value> Properties of the content to expand
|
|
359
|
+
--limit=<value> Maximum number of contents per page
|
|
360
|
+
--toon Format output as toon
|
|
361
|
+
|
|
362
|
+
DESCRIPTION
|
|
363
|
+
Search for Confluence contents using CQL
|
|
364
|
+
|
|
365
|
+
EXAMPLES
|
|
366
|
+
$ conni conni content search 'space=DEV AND title ~ "Implement email OTP login" AND creator=currentUser()'
|
|
367
|
+
|
|
368
|
+
$ conni conni content search 'created > startOfMonth()' --limit=5 --expand=body,version
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
_See code: [src/commands/conni/content/search.ts](https://github.com/hesedcasa/conni/blob/v0.1.0/src/commands/conni/content/search.ts)_
|
|
372
|
+
|
|
373
|
+
## `conni conni content update PAGEID`
|
|
374
|
+
|
|
375
|
+
Update an existing Confluence content
|
|
376
|
+
|
|
377
|
+
```
|
|
378
|
+
USAGE
|
|
379
|
+
$ conni conni content update PAGEID --fields <value>...
|
|
380
|
+
|
|
381
|
+
ARGUMENTS
|
|
382
|
+
PAGEID Page ID
|
|
383
|
+
|
|
384
|
+
FLAGS
|
|
385
|
+
--fields=<value>... (required) Content fields to update in key=value format
|
|
386
|
+
|
|
387
|
+
DESCRIPTION
|
|
388
|
+
Update an existing Confluence content
|
|
389
|
+
|
|
390
|
+
EXAMPLES
|
|
391
|
+
$ conni conni content update 1076199489 --fields title='New summary' body='New description'
|
|
392
|
+
|
|
393
|
+
$ conni conni content update 1076199489 --fields body='
|
|
394
|
+
# Header
|
|
395
|
+
## Sub-header
|
|
396
|
+
- Item 1
|
|
397
|
+
- Item 2
|
|
398
|
+
```bash
|
|
399
|
+
ls -a
|
|
400
|
+
```'
|
|
401
|
+
|
|
402
|
+
$ conni conni content update 1076199489 --fields body="$(cat content.md)"
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
_See code: [src/commands/conni/content/update.ts](https://github.com/hesedcasa/conni/blob/v0.1.0/src/commands/conni/content/update.ts)_
|
|
406
|
+
|
|
407
|
+
## `conni conni space get SPACEKEY`
|
|
408
|
+
|
|
409
|
+
Get details of a Confluence space
|
|
410
|
+
|
|
411
|
+
```
|
|
412
|
+
USAGE
|
|
413
|
+
$ conni conni space get SPACEKEY [--toon]
|
|
414
|
+
|
|
415
|
+
ARGUMENTS
|
|
416
|
+
SPACEKEY Space key
|
|
417
|
+
|
|
418
|
+
FLAGS
|
|
419
|
+
--toon Format output as toon
|
|
420
|
+
|
|
421
|
+
DESCRIPTION
|
|
422
|
+
Get details of a Confluence space
|
|
423
|
+
|
|
424
|
+
EXAMPLES
|
|
425
|
+
$ conni conni space get DEV
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
_See code: [src/commands/conni/space/get.ts](https://github.com/hesedcasa/conni/blob/v0.1.0/src/commands/conni/space/get.ts)_
|
|
429
|
+
|
|
430
|
+
## `conni conni space list`
|
|
431
|
+
|
|
432
|
+
List all Confluence spaces
|
|
433
|
+
|
|
434
|
+
```
|
|
435
|
+
USAGE
|
|
436
|
+
$ conni conni space list [--toon]
|
|
437
|
+
|
|
438
|
+
FLAGS
|
|
439
|
+
--toon Format output as toon
|
|
440
|
+
|
|
441
|
+
DESCRIPTION
|
|
442
|
+
List all Confluence spaces
|
|
443
|
+
|
|
444
|
+
EXAMPLES
|
|
445
|
+
$ conni conni space list
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
_See code: [src/commands/conni/space/list.ts](https://github.com/hesedcasa/conni/blob/v0.1.0/src/commands/conni/space/list.ts)_
|
|
449
|
+
<!-- commandsstop -->
|
package/bin/dev.cmd
ADDED
package/bin/dev.js
ADDED
package/bin/run.cmd
ADDED
package/bin/run.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import { ApiResult } from '../../../conni/conni-api.js';
|
|
3
|
+
export default class AuthAdd extends Command {
|
|
4
|
+
static args: {};
|
|
5
|
+
static description: string;
|
|
6
|
+
static enableJsonFlag: boolean;
|
|
7
|
+
static examples: string[];
|
|
8
|
+
static flags: {
|
|
9
|
+
email: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
url: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
};
|
|
13
|
+
run(): Promise<ApiResult>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { input } from '@inquirer/prompts';
|
|
2
|
+
import { Command, Flags } from '@oclif/core';
|
|
3
|
+
import { action } from '@oclif/core/ux';
|
|
4
|
+
import { default as fs } from 'fs-extra';
|
|
5
|
+
import { default as path } from 'node:path';
|
|
6
|
+
import { clearClients, testConnection } from '../../../conni/conni-client.js';
|
|
7
|
+
export default class AuthAdd extends Command {
|
|
8
|
+
static args = {};
|
|
9
|
+
static description = 'Add Atlassian authentication';
|
|
10
|
+
static enableJsonFlag = true;
|
|
11
|
+
static examples = ['<%= config.bin %> <%= command.id %>'];
|
|
12
|
+
static flags = {
|
|
13
|
+
email: Flags.string({ char: 'e', description: 'Account email:', required: !process.stdout.isTTY }),
|
|
14
|
+
token: Flags.string({ char: 't', description: 'API Token:', required: !process.stdout.isTTY }),
|
|
15
|
+
url: Flags.string({
|
|
16
|
+
char: 'u',
|
|
17
|
+
description: 'Atlassian URL (start with https://):',
|
|
18
|
+
required: !process.stdout.isTTY,
|
|
19
|
+
}),
|
|
20
|
+
};
|
|
21
|
+
async run() {
|
|
22
|
+
const { flags } = await this.parse(AuthAdd);
|
|
23
|
+
const apiToken = flags.token ?? (await input({ message: 'API Token:', required: true }));
|
|
24
|
+
const email = flags.email ?? (await input({ message: 'Account email:', required: true }));
|
|
25
|
+
const host = flags.url ?? (await input({ message: 'Atlassian instance URL (start with https://):', required: true }));
|
|
26
|
+
const configPath = path.join(this.config.configDir, 'conni-config.json');
|
|
27
|
+
const auth = {
|
|
28
|
+
auth: {
|
|
29
|
+
apiToken,
|
|
30
|
+
email,
|
|
31
|
+
host,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
const exists = await fs.pathExists(configPath);
|
|
35
|
+
if (!exists) {
|
|
36
|
+
await fs.createFile(configPath);
|
|
37
|
+
}
|
|
38
|
+
await fs.writeJSON(configPath, auth, {
|
|
39
|
+
mode: 0o600, // owner read/write only
|
|
40
|
+
});
|
|
41
|
+
action.start('Authenticating');
|
|
42
|
+
const config = await fs.readJSON(configPath);
|
|
43
|
+
const result = await testConnection(config.auth);
|
|
44
|
+
clearClients();
|
|
45
|
+
if (result.success) {
|
|
46
|
+
action.stop('✓ successful');
|
|
47
|
+
this.log('Authentication added successfully');
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
action.stop('✗ failed');
|
|
51
|
+
this.error('Authentication is invalid. Please check your email, token, and URL.');
|
|
52
|
+
}
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import { ApiResult } from '../../../conni/conni-api.js';
|
|
3
|
+
export default class AuthTest extends Command {
|
|
4
|
+
static args: {};
|
|
5
|
+
static description: string;
|
|
6
|
+
static enableJsonFlag: boolean;
|
|
7
|
+
static examples: string[];
|
|
8
|
+
static flags: {};
|
|
9
|
+
run(): Promise<ApiResult>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import { action } from '@oclif/core/ux';
|
|
3
|
+
import { readConfig } from '../../../config.js';
|
|
4
|
+
import { clearClients, testConnection } from '../../../conni/conni-client.js';
|
|
5
|
+
export default class AuthTest extends Command {
|
|
6
|
+
static args = {};
|
|
7
|
+
static description = 'Test authentication and connection';
|
|
8
|
+
static enableJsonFlag = true;
|
|
9
|
+
static examples = ['<%= config.bin %> <%= command.id %>'];
|
|
10
|
+
static flags = {};
|
|
11
|
+
async run() {
|
|
12
|
+
const config = await readConfig(this.config.configDir, this.log.bind(this));
|
|
13
|
+
if (!config) {
|
|
14
|
+
return {
|
|
15
|
+
error: 'Missing authentication config',
|
|
16
|
+
success: false,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
action.start('Authenticating connection');
|
|
20
|
+
const result = await testConnection(config.auth);
|
|
21
|
+
clearClients();
|
|
22
|
+
if (result.success) {
|
|
23
|
+
action.stop('✓ successful');
|
|
24
|
+
this.log('Successful connect to Confluence');
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
action.stop('✗ failed');
|
|
28
|
+
this.error('Failed to connect to Confluence.');
|
|
29
|
+
}
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import { ApiResult } from '../../../conni/conni-api.js';
|
|
3
|
+
export default class AuthUpdate extends Command {
|
|
4
|
+
static args: {};
|
|
5
|
+
static description: string;
|
|
6
|
+
static enableJsonFlag: boolean;
|
|
7
|
+
static examples: string[];
|
|
8
|
+
static flags: {
|
|
9
|
+
email: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
url: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
};
|
|
13
|
+
run(): Promise<ApiResult | void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { confirm, input } from '@inquirer/prompts';
|
|
2
|
+
import { Command, Flags } from '@oclif/core';
|
|
3
|
+
import { action } from '@oclif/core/ux';
|
|
4
|
+
import { default as fs } from 'fs-extra';
|
|
5
|
+
import { default as path } from 'node:path';
|
|
6
|
+
import { clearClients, testConnection } from '../../../conni/conni-client.js';
|
|
7
|
+
export default class AuthUpdate extends Command {
|
|
8
|
+
static args = {};
|
|
9
|
+
static description = 'Update existing authentication';
|
|
10
|
+
static enableJsonFlag = true;
|
|
11
|
+
static examples = ['<%= config.bin %> <%= command.id %>'];
|
|
12
|
+
static flags = {
|
|
13
|
+
email: Flags.string({ char: 'e', description: 'Account email', required: !process.stdout.isTTY }),
|
|
14
|
+
token: Flags.string({ char: 't', description: 'API Token', required: !process.stdout.isTTY }),
|
|
15
|
+
url: Flags.string({
|
|
16
|
+
char: 'u',
|
|
17
|
+
description: 'Atlassian instance URL (start with https://)',
|
|
18
|
+
required: !process.stdout.isTTY,
|
|
19
|
+
}),
|
|
20
|
+
};
|
|
21
|
+
async run() {
|
|
22
|
+
const { flags } = await this.parse(AuthUpdate);
|
|
23
|
+
const configPath = path.join(this.config.configDir, 'conni-config.json');
|
|
24
|
+
let config;
|
|
25
|
+
try {
|
|
26
|
+
config = await fs.readJSON(configPath);
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
30
|
+
if (msg.toLowerCase().includes('no such file or directory')) {
|
|
31
|
+
this.log('Run auth:add instead');
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
this.log(msg);
|
|
35
|
+
}
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const apiToken = flags.token ??
|
|
39
|
+
(await input({ default: config.auth.apiToken, message: 'API Token:', prefill: 'tab', required: true }));
|
|
40
|
+
const email = flags.email ??
|
|
41
|
+
(await input({ default: config.auth.email, message: 'Account email:', prefill: 'tab', required: true }));
|
|
42
|
+
const host = flags.url ??
|
|
43
|
+
(await input({
|
|
44
|
+
default: config.auth.host,
|
|
45
|
+
message: 'Atlassian instance URL (start with https://):',
|
|
46
|
+
prefill: 'tab',
|
|
47
|
+
required: true,
|
|
48
|
+
}));
|
|
49
|
+
const answer = await confirm({ message: 'Override existing config?' });
|
|
50
|
+
if (!answer) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const auth = {
|
|
54
|
+
auth: {
|
|
55
|
+
apiToken,
|
|
56
|
+
email,
|
|
57
|
+
host,
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
await fs.writeJSON(configPath, auth, {
|
|
61
|
+
mode: 0o600, // owner read/write only
|
|
62
|
+
});
|
|
63
|
+
action.start('Authenticating');
|
|
64
|
+
config = await fs.readJSON(configPath);
|
|
65
|
+
const result = await testConnection(config.auth);
|
|
66
|
+
clearClients();
|
|
67
|
+
if (result.success) {
|
|
68
|
+
action.stop('✓ successful');
|
|
69
|
+
this.log('Authentication updated successfully');
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
action.stop('✗ failed');
|
|
73
|
+
this.error('Authentication is invalid. Please check your email, token, and URL.');
|
|
74
|
+
}
|
|
75
|
+
return result;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class ContentDownloadAttachment extends Command {
|
|
3
|
+
static args: {
|
|
4
|
+
attachmentId: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
+
outputPath: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
6
|
+
};
|
|
7
|
+
static description: string;
|
|
8
|
+
static examples: string[];
|
|
9
|
+
static flags: {
|
|
10
|
+
toon: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
};
|
|
12
|
+
run(): Promise<void>;
|
|
13
|
+
}
|