@hesed/conni 0.4.0 → 0.6.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.
Files changed (41) hide show
  1. package/README.md +130 -57
  2. package/dist/commands/conni/auth/add.d.ts +1 -0
  3. package/dist/commands/conni/auth/add.js +24 -18
  4. package/dist/commands/conni/auth/list.d.ts +20 -0
  5. package/dist/commands/conni/auth/list.js +36 -0
  6. package/dist/commands/conni/auth/profile.d.ts +11 -0
  7. package/dist/commands/conni/auth/profile.js +23 -0
  8. package/dist/commands/conni/auth/test.d.ts +3 -1
  9. package/dist/commands/conni/auth/test.js +10 -4
  10. package/dist/commands/conni/auth/update.d.ts +1 -0
  11. package/dist/commands/conni/auth/update.js +22 -23
  12. package/dist/commands/conni/content/attachment-download.d.ts +1 -0
  13. package/dist/commands/conni/content/attachment-download.js +2 -1
  14. package/dist/commands/conni/content/attachment.d.ts +1 -0
  15. package/dist/commands/conni/content/attachment.js +2 -1
  16. package/dist/commands/conni/content/comment-delete.d.ts +1 -0
  17. package/dist/commands/conni/content/comment-delete.js +2 -1
  18. package/dist/commands/conni/content/comment-update.d.ts +1 -0
  19. package/dist/commands/conni/content/comment-update.js +2 -1
  20. package/dist/commands/conni/content/comment.d.ts +1 -0
  21. package/dist/commands/conni/content/comment.js +2 -1
  22. package/dist/commands/conni/content/create.d.ts +2 -0
  23. package/dist/commands/conni/content/create.js +19 -4
  24. package/dist/commands/conni/content/delete.d.ts +1 -0
  25. package/dist/commands/conni/content/delete.js +2 -1
  26. package/dist/commands/conni/content/get.d.ts +1 -0
  27. package/dist/commands/conni/content/get.js +2 -1
  28. package/dist/commands/conni/content/search.d.ts +1 -0
  29. package/dist/commands/conni/content/search.js +2 -1
  30. package/dist/commands/conni/content/update.d.ts +1 -0
  31. package/dist/commands/conni/content/update.js +2 -1
  32. package/dist/commands/conni/space/get.d.ts +1 -0
  33. package/dist/commands/conni/space/get.js +2 -1
  34. package/dist/commands/conni/space/list.d.ts +1 -0
  35. package/dist/commands/conni/space/list.js +2 -1
  36. package/dist/config.d.ts +6 -2
  37. package/dist/config.js +68 -3
  38. package/dist/conni/conni-api.d.ts +5 -1
  39. package/dist/conni/conni-api.js +27 -3
  40. package/oclif.manifest.json +305 -84
  41. package/package.json +1 -1
package/README.md CHANGED
@@ -26,7 +26,7 @@ $ npm install -g @hesed/conni
26
26
  $ conni COMMAND
27
27
  running command...
28
28
  $ conni (--version)
29
- @hesed/conni/0.4.0 darwin-arm64 node-v22.14.0
29
+ @hesed/conni/0.6.0 linux-x64 node-v24.14.1
30
30
  $ conni --help [COMMAND]
31
31
  USAGE
32
32
  $ conni COMMAND
@@ -38,6 +38,8 @@ USAGE
38
38
 
39
39
  <!-- commands -->
40
40
  * [`conni conni auth add`](#conni-conni-auth-add)
41
+ * [`conni conni auth list`](#conni-conni-auth-list)
42
+ * [`conni conni auth profile`](#conni-conni-auth-profile)
41
43
  * [`conni conni auth test`](#conni-conni-auth-test)
42
44
  * [`conni conni auth update`](#conni-conni-auth-update)
43
45
  * [`conni conni content attachment PAGEID FILE`](#conni-conni-content-attachment-pageid-file)
@@ -59,12 +61,13 @@ Add Atlassian authentication
59
61
 
60
62
  ```
61
63
  USAGE
62
- $ conni conni auth add [--json] [-e <value>] [-t <value>] [-u <value>]
64
+ $ conni conni auth add -e <value> -t <value> -u <value> [--json] [-p <value>]
63
65
 
64
66
  FLAGS
65
- -e, --email=<value> Account email:
66
- -t, --token=<value> API Token:
67
- -u, --url=<value> Atlassian URL (start with https://):
67
+ -e, --email=<value> (required) Account email:
68
+ -p, --profile=<value> Profile name:
69
+ -t, --token=<value> (required) API Token:
70
+ -u, --url=<value> (required) Atlassian URL (start with https://):
68
71
 
69
72
  GLOBAL FLAGS
70
73
  --json Format output as json.
@@ -74,9 +77,56 @@ DESCRIPTION
74
77
 
75
78
  EXAMPLES
76
79
  $ conni conni auth add
80
+
81
+ $ conni conni auth add --profile work
82
+ ```
83
+
84
+ _See code: [src/commands/conni/auth/add.ts](https://github.com/hesedcasa/conni/blob/v0.6.0/src/commands/conni/auth/add.ts)_
85
+
86
+ ## `conni conni auth list`
87
+
88
+ List authentication profiles
89
+
77
90
  ```
91
+ USAGE
92
+ $ conni conni auth list [--json]
78
93
 
79
- _See code: [src/commands/conni/auth/add.ts](https://github.com/hesedcasa/conni/blob/v0.4.0/src/commands/conni/auth/add.ts)_
94
+ GLOBAL FLAGS
95
+ --json Format output as json.
96
+
97
+ DESCRIPTION
98
+ List authentication profiles
99
+
100
+ EXAMPLES
101
+ $ conni conni auth list
102
+ ```
103
+
104
+ _See code: [src/commands/conni/auth/list.ts](https://github.com/hesedcasa/conni/blob/v0.6.0/src/commands/conni/auth/list.ts)_
105
+
106
+ ## `conni conni auth profile`
107
+
108
+ Set or show the default authentication profile
109
+
110
+ ```
111
+ USAGE
112
+ $ conni conni auth profile [--json] [--default <value>]
113
+
114
+ FLAGS
115
+ --default=<value> Profile name to set as default
116
+
117
+ GLOBAL FLAGS
118
+ --json Format output as json.
119
+
120
+ DESCRIPTION
121
+ Set or show the default authentication profile
122
+
123
+ EXAMPLES
124
+ $ conni conni auth profile
125
+
126
+ $ conni conni auth profile --default work
127
+ ```
128
+
129
+ _See code: [src/commands/conni/auth/profile.ts](https://github.com/hesedcasa/conni/blob/v0.6.0/src/commands/conni/auth/profile.ts)_
80
130
 
81
131
  ## `conni conni auth test`
82
132
 
@@ -84,7 +134,10 @@ Test authentication and connection
84
134
 
85
135
  ```
86
136
  USAGE
87
- $ conni conni auth test [--json]
137
+ $ conni conni auth test [--json] [-p <value>]
138
+
139
+ FLAGS
140
+ -p, --profile=<value> Authentication profile name
88
141
 
89
142
  GLOBAL FLAGS
90
143
  --json Format output as json.
@@ -94,34 +147,39 @@ DESCRIPTION
94
147
 
95
148
  EXAMPLES
96
149
  $ conni conni auth test
150
+
151
+ $ conni conni auth test --profile work
97
152
  ```
98
153
 
99
- _See code: [src/commands/conni/auth/test.ts](https://github.com/hesedcasa/conni/blob/v0.4.0/src/commands/conni/auth/test.ts)_
154
+ _See code: [src/commands/conni/auth/test.ts](https://github.com/hesedcasa/conni/blob/v0.6.0/src/commands/conni/auth/test.ts)_
100
155
 
101
156
  ## `conni conni auth update`
102
157
 
103
- Update existing authentication
158
+ Update existing authentication profile
104
159
 
105
160
  ```
106
161
  USAGE
107
- $ conni conni auth update [--json] [-e <value>] [-t <value>] [-u <value>]
162
+ $ conni conni auth update -e <value> -t <value> -u <value> [--json] [-p <value>]
108
163
 
109
164
  FLAGS
110
- -e, --email=<value> Account email
111
- -t, --token=<value> API Token
112
- -u, --url=<value> Atlassian instance URL (start with https://)
165
+ -e, --email=<value> (required) Account email
166
+ -p, --profile=<value> Profile name to update (default: "default")
167
+ -t, --token=<value> (required) API Token
168
+ -u, --url=<value> (required) Atlassian instance URL (start with https://)
113
169
 
114
170
  GLOBAL FLAGS
115
171
  --json Format output as json.
116
172
 
117
173
  DESCRIPTION
118
- Update existing authentication
174
+ Update existing authentication profile
119
175
 
120
176
  EXAMPLES
121
177
  $ conni conni auth update
178
+
179
+ $ conni conni auth update --profile work
122
180
  ```
123
181
 
124
- _See code: [src/commands/conni/auth/update.ts](https://github.com/hesedcasa/conni/blob/v0.4.0/src/commands/conni/auth/update.ts)_
182
+ _See code: [src/commands/conni/auth/update.ts](https://github.com/hesedcasa/conni/blob/v0.6.0/src/commands/conni/auth/update.ts)_
125
183
 
126
184
  ## `conni conni content attachment PAGEID FILE`
127
185
 
@@ -129,14 +187,15 @@ Add attachment to Confluence content
129
187
 
130
188
  ```
131
189
  USAGE
132
- $ conni conni content attachment PAGEID FILE [--toon]
190
+ $ conni conni content attachment PAGEID FILE [-p <value>] [--toon]
133
191
 
134
192
  ARGUMENTS
135
193
  PAGEID Page ID
136
194
  FILE Path to the file to upload
137
195
 
138
196
  FLAGS
139
- --toon Format output as toon
197
+ -p, --profile=<value> Authentication profile name
198
+ --toon Format output as toon
140
199
 
141
200
  DESCRIPTION
142
201
  Add attachment to Confluence content
@@ -145,7 +204,7 @@ EXAMPLES
145
204
  $ conni conni content attachment 123456 ./document.pdf
146
205
  ```
147
206
 
148
- _See code: [src/commands/conni/content/attachment.ts](https://github.com/hesedcasa/conni/blob/v0.4.0/src/commands/conni/content/attachment.ts)_
207
+ _See code: [src/commands/conni/content/attachment.ts](https://github.com/hesedcasa/conni/blob/v0.6.0/src/commands/conni/content/attachment.ts)_
149
208
 
150
209
  ## `conni conni content attachment-download ATTACHMENTID [OUTPUTPATH]`
151
210
 
@@ -153,14 +212,15 @@ Download attachment from Confluence content
153
212
 
154
213
  ```
155
214
  USAGE
156
- $ conni conni content attachment-download ATTACHMENTID [OUTPUTPATH] [--toon]
215
+ $ conni conni content attachment-download ATTACHMENTID [OUTPUTPATH] [-p <value>] [--toon]
157
216
 
158
217
  ARGUMENTS
159
218
  ATTACHMENTID Attachment ID
160
219
  [OUTPUTPATH] Output file path
161
220
 
162
221
  FLAGS
163
- --toon Format output as toon
222
+ -p, --profile=<value> Authentication profile name
223
+ --toon Format output as toon
164
224
 
165
225
  DESCRIPTION
166
226
  Download attachment from Confluence content
@@ -171,7 +231,7 @@ EXAMPLES
171
231
  $ conni conni content attachment-download att12345 ./document.pdf
172
232
  ```
173
233
 
174
- _See code: [src/commands/conni/content/attachment-download.ts](https://github.com/hesedcasa/conni/blob/v0.4.0/src/commands/conni/content/attachment-download.ts)_
234
+ _See code: [src/commands/conni/content/attachment-download.ts](https://github.com/hesedcasa/conni/blob/v0.6.0/src/commands/conni/content/attachment-download.ts)_
175
235
 
176
236
  ## `conni conni content comment PAGEID BODY`
177
237
 
@@ -179,14 +239,15 @@ Add comment to Confluence content
179
239
 
180
240
  ```
181
241
  USAGE
182
- $ conni conni content comment PAGEID BODY [--toon]
242
+ $ conni conni content comment PAGEID BODY [-p <value>] [--toon]
183
243
 
184
244
  ARGUMENTS
185
245
  PAGEID Page ID
186
246
  BODY Comment in Markdown format
187
247
 
188
248
  FLAGS
189
- --toon Format output as toon
249
+ -p, --profile=<value> Authentication profile name
250
+ --toon Format output as toon
190
251
 
191
252
  DESCRIPTION
192
253
  Add comment to Confluence content
@@ -204,7 +265,7 @@ EXAMPLES
204
265
  $ conni conni content comment 123456 "$(cat content.md)"
205
266
  ```
206
267
 
207
- _See code: [src/commands/conni/content/comment.ts](https://github.com/hesedcasa/conni/blob/v0.4.0/src/commands/conni/content/comment.ts)_
268
+ _See code: [src/commands/conni/content/comment.ts](https://github.com/hesedcasa/conni/blob/v0.6.0/src/commands/conni/content/comment.ts)_
208
269
 
209
270
  ## `conni conni content comment-delete ID`
210
271
 
@@ -212,13 +273,14 @@ Delete comment from Confluence content
212
273
 
213
274
  ```
214
275
  USAGE
215
- $ conni conni content comment-delete ID [--toon]
276
+ $ conni conni content comment-delete ID [-p <value>] [--toon]
216
277
 
217
278
  ARGUMENTS
218
279
  ID Comment ID to delete
219
280
 
220
281
  FLAGS
221
- --toon Format output as toon
282
+ -p, --profile=<value> Authentication profile name
283
+ --toon Format output as toon
222
284
 
223
285
  DESCRIPTION
224
286
  Delete comment from Confluence content
@@ -227,7 +289,7 @@ EXAMPLES
227
289
  $ conni conni content comment-delete 1544224770
228
290
  ```
229
291
 
230
- _See code: [src/commands/conni/content/comment-delete.ts](https://github.com/hesedcasa/conni/blob/v0.4.0/src/commands/conni/content/comment-delete.ts)_
292
+ _See code: [src/commands/conni/content/comment-delete.ts](https://github.com/hesedcasa/conni/blob/v0.6.0/src/commands/conni/content/comment-delete.ts)_
231
293
 
232
294
  ## `conni conni content comment-update ID BODY`
233
295
 
@@ -235,14 +297,15 @@ Update a comment in Confluence content
235
297
 
236
298
  ```
237
299
  USAGE
238
- $ conni conni content comment-update ID BODY [--toon]
300
+ $ conni conni content comment-update ID BODY [-p <value>] [--toon]
239
301
 
240
302
  ARGUMENTS
241
303
  ID Comment ID to update
242
304
  BODY Comment in Markdown format
243
305
 
244
306
  FLAGS
245
- --toon Format output as toon
307
+ -p, --profile=<value> Authentication profile name
308
+ --toon Format output as toon
246
309
 
247
310
  DESCRIPTION
248
311
  Update a comment in Confluence content
@@ -260,7 +323,7 @@ EXAMPLES
260
323
  $ conni conni content comment-update 1544224770 "$(cat content.md)"
261
324
  ```
262
325
 
263
- _See code: [src/commands/conni/content/comment-update.ts](https://github.com/hesedcasa/conni/blob/v0.4.0/src/commands/conni/content/comment-update.ts)_
326
+ _See code: [src/commands/conni/content/comment-update.ts](https://github.com/hesedcasa/conni/blob/v0.6.0/src/commands/conni/content/comment-update.ts)_
264
327
 
265
328
  ## `conni conni content create`
266
329
 
@@ -268,12 +331,14 @@ Create a new Confluence page
268
331
 
269
332
  ```
270
333
  USAGE
271
- $ conni conni content create --fields <value>... [--attach <value>...] [--toon]
334
+ $ conni conni content create --fields <value>... [--attach <value>...] [--full-width] [-p <value>] [--toon]
272
335
 
273
336
  FLAGS
274
- --attach=<value>... Path to a file to upload and embed inline (can be used multiple times)
275
- --fields=<value>... (required) Content fields in key=value format
276
- --toon Format output as toon
337
+ -p, --profile=<value> Authentication profile name
338
+ --attach=<value>... Path to a file to upload and embed inline (can be used multiple times)
339
+ --fields=<value>... (required) Minimum fields required: spaceKey, title & body
340
+ --full-width Set page appearance to full-width
341
+ --toon Format output as toon
277
342
 
278
343
  DESCRIPTION
279
344
  Create a new Confluence page
@@ -297,13 +362,15 @@ EXAMPLES
297
362
 
298
363
  $ conni conni content create --fields spaceKey="DEV" title="Page with files" body="Content" --attach ./image.png --attach ./report.pdf
299
364
 
365
+ $ conni conni content create --fields spaceKey="DEV" title="Storage page" body=@storage.xml representation=storage --full-width
366
+
300
367
  FLAG DESCRIPTIONS
301
- --fields=<value>... Content fields in key=value format
368
+ --fields=<value>... Minimum fields required: spaceKey, title & body
302
369
 
303
- Minimum fields required: spaceKey, title & body
370
+ Content fields in key=value format. Use @file to read value from a file (e.g. body=@content.xml)
304
371
  ```
305
372
 
306
- _See code: [src/commands/conni/content/create.ts](https://github.com/hesedcasa/conni/blob/v0.4.0/src/commands/conni/content/create.ts)_
373
+ _See code: [src/commands/conni/content/create.ts](https://github.com/hesedcasa/conni/blob/v0.6.0/src/commands/conni/content/create.ts)_
307
374
 
308
375
  ## `conni conni content delete PAGEID`
309
376
 
@@ -311,13 +378,14 @@ Delete a Confluence page
311
378
 
312
379
  ```
313
380
  USAGE
314
- $ conni conni content delete PAGEID [--toon]
381
+ $ conni conni content delete PAGEID [-p <value>] [--toon]
315
382
 
316
383
  ARGUMENTS
317
384
  PAGEID Page ID to delete
318
385
 
319
386
  FLAGS
320
- --toon Format output as toon
387
+ -p, --profile=<value> Authentication profile name
388
+ --toon Format output as toon
321
389
 
322
390
  DESCRIPTION
323
391
  Delete a Confluence page
@@ -326,7 +394,7 @@ EXAMPLES
326
394
  $ conni conni content delete 1543634992
327
395
  ```
328
396
 
329
- _See code: [src/commands/conni/content/delete.ts](https://github.com/hesedcasa/conni/blob/v0.4.0/src/commands/conni/content/delete.ts)_
397
+ _See code: [src/commands/conni/content/delete.ts](https://github.com/hesedcasa/conni/blob/v0.6.0/src/commands/conni/content/delete.ts)_
330
398
 
331
399
  ## `conni conni content get PAGEID`
332
400
 
@@ -334,13 +402,14 @@ Get details of a Confluence content
334
402
 
335
403
  ```
336
404
  USAGE
337
- $ conni conni content get PAGEID [--toon]
405
+ $ conni conni content get PAGEID [-p <value>] [--toon]
338
406
 
339
407
  ARGUMENTS
340
408
  PAGEID Page ID
341
409
 
342
410
  FLAGS
343
- --toon Format output as toon
411
+ -p, --profile=<value> Authentication profile name
412
+ --toon Format output as toon
344
413
 
345
414
  DESCRIPTION
346
415
  Get details of a Confluence content
@@ -349,7 +418,7 @@ EXAMPLES
349
418
  $ conni conni content get 1544060948
350
419
  ```
351
420
 
352
- _See code: [src/commands/conni/content/get.ts](https://github.com/hesedcasa/conni/blob/v0.4.0/src/commands/conni/content/get.ts)_
421
+ _See code: [src/commands/conni/content/get.ts](https://github.com/hesedcasa/conni/blob/v0.6.0/src/commands/conni/content/get.ts)_
353
422
 
354
423
  ## `conni conni content search CQL`
355
424
 
@@ -357,15 +426,16 @@ Search for Confluence contents using CQL
357
426
 
358
427
  ```
359
428
  USAGE
360
- $ conni conni content search CQL [--expand <value>] [--limit <value>] [--toon]
429
+ $ conni conni content search CQL [--expand <value>] [--limit <value>] [-p <value>] [--toon]
361
430
 
362
431
  ARGUMENTS
363
432
  CQL CQL expression
364
433
 
365
434
  FLAGS
366
- --expand=<value> Properties of the content to expand
367
- --limit=<value> Maximum number of contents per page
368
- --toon Format output as toon
435
+ -p, --profile=<value> Authentication profile name
436
+ --expand=<value> Properties of the content to expand
437
+ --limit=<value> Maximum number of contents per page
438
+ --toon Format output as toon
369
439
 
370
440
  DESCRIPTION
371
441
  Search for Confluence contents using CQL
@@ -376,7 +446,7 @@ EXAMPLES
376
446
  $ conni conni content search 'created > startOfMonth()' --limit=5 --expand=body,version
377
447
  ```
378
448
 
379
- _See code: [src/commands/conni/content/search.ts](https://github.com/hesedcasa/conni/blob/v0.4.0/src/commands/conni/content/search.ts)_
449
+ _See code: [src/commands/conni/content/search.ts](https://github.com/hesedcasa/conni/blob/v0.6.0/src/commands/conni/content/search.ts)_
380
450
 
381
451
  ## `conni conni content update PAGEID`
382
452
 
@@ -384,13 +454,14 @@ Update an existing Confluence content
384
454
 
385
455
  ```
386
456
  USAGE
387
- $ conni conni content update PAGEID --fields <value>...
457
+ $ conni conni content update PAGEID --fields <value>... [-p <value>]
388
458
 
389
459
  ARGUMENTS
390
460
  PAGEID Page ID
391
461
 
392
462
  FLAGS
393
- --fields=<value>... (required) Content fields to update in key=value format
463
+ -p, --profile=<value> Authentication profile name
464
+ --fields=<value>... (required) Content fields to update in key=value format
394
465
 
395
466
  DESCRIPTION
396
467
  Update an existing Confluence content
@@ -410,7 +481,7 @@ EXAMPLES
410
481
  $ conni conni content update 1076199489 --fields body="$(cat content.md)"
411
482
  ```
412
483
 
413
- _See code: [src/commands/conni/content/update.ts](https://github.com/hesedcasa/conni/blob/v0.4.0/src/commands/conni/content/update.ts)_
484
+ _See code: [src/commands/conni/content/update.ts](https://github.com/hesedcasa/conni/blob/v0.6.0/src/commands/conni/content/update.ts)_
414
485
 
415
486
  ## `conni conni space get SPACEKEY`
416
487
 
@@ -418,13 +489,14 @@ Get details of a Confluence space
418
489
 
419
490
  ```
420
491
  USAGE
421
- $ conni conni space get SPACEKEY [--toon]
492
+ $ conni conni space get SPACEKEY [-p <value>] [--toon]
422
493
 
423
494
  ARGUMENTS
424
495
  SPACEKEY Space key
425
496
 
426
497
  FLAGS
427
- --toon Format output as toon
498
+ -p, --profile=<value> Authentication profile name
499
+ --toon Format output as toon
428
500
 
429
501
  DESCRIPTION
430
502
  Get details of a Confluence space
@@ -433,7 +505,7 @@ EXAMPLES
433
505
  $ conni conni space get DEV
434
506
  ```
435
507
 
436
- _See code: [src/commands/conni/space/get.ts](https://github.com/hesedcasa/conni/blob/v0.4.0/src/commands/conni/space/get.ts)_
508
+ _See code: [src/commands/conni/space/get.ts](https://github.com/hesedcasa/conni/blob/v0.6.0/src/commands/conni/space/get.ts)_
437
509
 
438
510
  ## `conni conni space list`
439
511
 
@@ -441,10 +513,11 @@ List all Confluence spaces
441
513
 
442
514
  ```
443
515
  USAGE
444
- $ conni conni space list [--toon]
516
+ $ conni conni space list [-p <value>] [--toon]
445
517
 
446
518
  FLAGS
447
- --toon Format output as toon
519
+ -p, --profile=<value> Authentication profile name
520
+ --toon Format output as toon
448
521
 
449
522
  DESCRIPTION
450
523
  List all Confluence spaces
@@ -453,5 +526,5 @@ EXAMPLES
453
526
  $ conni conni space list
454
527
  ```
455
528
 
456
- _See code: [src/commands/conni/space/list.ts](https://github.com/hesedcasa/conni/blob/v0.4.0/src/commands/conni/space/list.ts)_
529
+ _See code: [src/commands/conni/space/list.ts](https://github.com/hesedcasa/conni/blob/v0.6.0/src/commands/conni/space/list.ts)_
457
530
  <!-- commandsstop -->
@@ -7,6 +7,7 @@ export default class AuthAdd extends Command {
7
7
  static examples: string[];
8
8
  static flags: {
9
9
  email: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
11
  token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
12
  url: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
13
  };
@@ -8,9 +8,13 @@ export default class AuthAdd extends Command {
8
8
  static args = {};
9
9
  static description = 'Add Atlassian authentication';
10
10
  static enableJsonFlag = true;
11
- static examples = ['<%= config.bin %> <%= command.id %>'];
11
+ static examples = [
12
+ '<%= config.bin %> <%= command.id %>',
13
+ '<%= config.bin %> <%= command.id %> --profile work',
14
+ ];
12
15
  static flags = {
13
16
  email: Flags.string({ char: 'e', description: 'Account email:', required: !process.stdout.isTTY }),
17
+ profile: Flags.string({ char: 'p', description: 'Profile name:', required: false }),
14
18
  token: Flags.string({ char: 't', description: 'API Token:', required: !process.stdout.isTTY }),
15
19
  url: Flags.string({
16
20
  char: 'u',
@@ -20,31 +24,33 @@ export default class AuthAdd extends Command {
20
24
  };
21
25
  async run() {
22
26
  const { flags } = await this.parse(AuthAdd);
27
+ const profileName = flags.profile ?? (process.stdout.isTTY ? await input({ message: 'Profile name:', required: true }) : 'default');
23
28
  const apiToken = flags.token ?? (await input({ message: 'API Token:', required: true }));
24
29
  const email = flags.email ?? (await input({ message: 'Account email:', required: true }));
25
30
  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);
31
+ const configFilePath = path.join(this.config.configDir, 'conni-config.json');
32
+ let existing = {};
33
+ try {
34
+ existing = await fs.readJSON(configFilePath);
37
35
  }
38
- await fs.writeJSON(configPath, auth, {
39
- mode: 0o600, // owner read/write only
40
- });
36
+ catch {
37
+ // file doesn't exist yet
38
+ }
39
+ const profiles = (existing.profiles ?? (existing.auth ? { default: existing.auth } : {}));
40
+ if (profileName in profiles) {
41
+ this.error(`Profile '${profileName}' already exists. Use 'conni auth update' to modify it.`);
42
+ }
43
+ profiles[profileName] = { apiToken, email, host };
44
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
45
+ const { auth: _auth, ...rest } = existing;
46
+ await fs.writeJSON(configFilePath, { ...rest, profiles }, { mode: 0o600 });
41
47
  action.start('Authenticating');
42
- const config = await fs.readJSON(configPath);
43
- const result = await testConnection(config.auth);
48
+ const result = await testConnection({ apiToken, email, host });
44
49
  clearClients();
45
50
  if (result.success) {
46
51
  action.stop('✓ successful');
47
- this.log('Authentication added successfully');
52
+ const profileSuffix = profileName === 'default' ? '' : ` as profile '${profileName}'`;
53
+ this.log(`Authentication added${profileSuffix} successfully`);
48
54
  }
49
55
  else {
50
56
  action.stop('✗ failed');
@@ -0,0 +1,20 @@
1
+ import { Command } from '@oclif/core';
2
+ interface ProfileInfo {
3
+ apiToken: string;
4
+ default?: boolean;
5
+ email?: string;
6
+ host: string;
7
+ name: string;
8
+ }
9
+ interface ListResult {
10
+ profiles: ProfileInfo[];
11
+ }
12
+ export default class AuthList extends Command {
13
+ static args: {};
14
+ static description: string;
15
+ static enableJsonFlag: boolean;
16
+ static examples: string[];
17
+ static flags: {};
18
+ run(): Promise<ListResult>;
19
+ }
20
+ export {};
@@ -0,0 +1,36 @@
1
+ import { Command } from '@oclif/core';
2
+ import { getDefaultProfile, readProfiles } from '../../../config.js';
3
+ export default class AuthList extends Command {
4
+ static args = {};
5
+ static description = 'List authentication profiles';
6
+ static enableJsonFlag = true;
7
+ static examples = ['<%= config.bin %> <%= command.id %>'];
8
+ static flags = {};
9
+ async run() {
10
+ await this.parse(AuthList);
11
+ const profiles = await readProfiles(this.config.configDir, this.log.bind(this));
12
+ if (!profiles || Object.keys(profiles).length === 0) {
13
+ this.log('No authentication profiles found. Run auth:add to add one.');
14
+ return { profiles: [] };
15
+ }
16
+ const defaultProfile = await getDefaultProfile(this.config.configDir);
17
+ const profileList = Object.entries(profiles).map(([name, auth]) => ({
18
+ ...(auth.email && { email: auth.email }),
19
+ ...(name === defaultProfile && { default: true }),
20
+ apiToken: `${auth.apiToken.slice(0, 3)}...${auth.apiToken.slice(-4)}`,
21
+ host: auth.host,
22
+ name,
23
+ }));
24
+ for (const profile of profileList) {
25
+ const details = [
26
+ ` host: ${profile.host}`,
27
+ ` token: ${profile.apiToken}`,
28
+ profile.email ? ` email: ${profile.email}` : '',
29
+ ]
30
+ .filter(Boolean)
31
+ .join('\n');
32
+ this.log(`${profile.name}${profile.default ? ' (default):' : ':'}\n${details}`);
33
+ }
34
+ return { profiles: profileList };
35
+ }
36
+ }
@@ -0,0 +1,11 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class AuthProfile extends Command {
3
+ static args: {};
4
+ static description: string;
5
+ static enableJsonFlag: boolean;
6
+ static examples: string[];
7
+ static flags: {
8
+ default: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
+ };
10
+ run(): Promise<void>;
11
+ }
@@ -0,0 +1,23 @@
1
+ import { Command, Flags } from '@oclif/core';
2
+ import { getDefaultProfile, setDefaultProfile } from '../../../config.js';
3
+ export default class AuthProfile extends Command {
4
+ static args = {};
5
+ static description = 'Set or show the default authentication profile';
6
+ static enableJsonFlag = true;
7
+ static examples = [
8
+ '<%= config.bin %> <%= command.id %>',
9
+ '<%= config.bin %> <%= command.id %> --default work',
10
+ ];
11
+ static flags = {
12
+ default: Flags.string({ description: 'Profile name to set as default', required: false }),
13
+ };
14
+ async run() {
15
+ const { flags } = await this.parse(AuthProfile);
16
+ if (flags.default) {
17
+ await setDefaultProfile(this.config.configDir, flags.default, this.log.bind(this));
18
+ return;
19
+ }
20
+ const current = await getDefaultProfile(this.config.configDir);
21
+ this.log(current);
22
+ }
23
+ }
@@ -5,6 +5,8 @@ export default class AuthTest extends Command {
5
5
  static description: string;
6
6
  static enableJsonFlag: boolean;
7
7
  static examples: string[];
8
- static flags: {};
8
+ static flags: {
9
+ profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ };
9
11
  run(): Promise<ApiResult>;
10
12
  }