@hesed/conni 0.5.0 → 0.6.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.
Files changed (41) hide show
  1. package/README.md +131 -56
  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 +1 -0
  23. package/dist/commands/conni/content/create.js +2 -1
  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 +3 -0
  31. package/dist/commands/conni/content/update.js +29 -4
  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 +1 -1
  39. package/dist/conni/conni-api.js +11 -4
  40. package/oclif.manifest.json +235 -7
  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.5.0 linux-x64 node-v24.14.1
29
+ @hesed/conni/0.6.1 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 -e <value> -t <value> -u <value> [--json]
64
+ $ conni conni auth add -e <value> -t <value> -u <value> [--json] [-p <value>]
63
65
 
64
66
  FLAGS
65
- -e, --email=<value> (required) Account email:
66
- -t, --token=<value> (required) API Token:
67
- -u, --url=<value> (required) 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.1/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.5.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.1/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.1/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.5.0/src/commands/conni/auth/test.ts)_
154
+ _See code: [src/commands/conni/auth/test.ts](https://github.com/hesedcasa/conni/blob/v0.6.1/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 -e <value> -t <value> -u <value> [--json]
162
+ $ conni conni auth update -e <value> -t <value> -u <value> [--json] [-p <value>]
108
163
 
109
164
  FLAGS
110
- -e, --email=<value> (required) Account email
111
- -t, --token=<value> (required) API Token
112
- -u, --url=<value> (required) 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.5.0/src/commands/conni/auth/update.ts)_
182
+ _See code: [src/commands/conni/auth/update.ts](https://github.com/hesedcasa/conni/blob/v0.6.1/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.5.0/src/commands/conni/content/attachment.ts)_
207
+ _See code: [src/commands/conni/content/attachment.ts](https://github.com/hesedcasa/conni/blob/v0.6.1/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.5.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.1/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.5.0/src/commands/conni/content/comment.ts)_
268
+ _See code: [src/commands/conni/content/comment.ts](https://github.com/hesedcasa/conni/blob/v0.6.1/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.5.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.1/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.5.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.1/src/commands/conni/content/comment-update.ts)_
264
327
 
265
328
  ## `conni conni content create`
266
329
 
@@ -268,13 +331,14 @@ Create a new Confluence page
268
331
 
269
332
  ```
270
333
  USAGE
271
- $ conni conni content create --fields <value>... [--attach <value>...] [--full-width] [--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) Minimum fields required: spaceKey, title & body
276
- --full-width Set page appearance to full-width
277
- --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
278
342
 
279
343
  DESCRIPTION
280
344
  Create a new Confluence page
@@ -306,7 +370,7 @@ FLAG DESCRIPTIONS
306
370
  Content fields in key=value format. Use @file to read value from a file (e.g. body=@content.xml)
307
371
  ```
308
372
 
309
- _See code: [src/commands/conni/content/create.ts](https://github.com/hesedcasa/conni/blob/v0.5.0/src/commands/conni/content/create.ts)_
373
+ _See code: [src/commands/conni/content/create.ts](https://github.com/hesedcasa/conni/blob/v0.6.1/src/commands/conni/content/create.ts)_
310
374
 
311
375
  ## `conni conni content delete PAGEID`
312
376
 
@@ -314,13 +378,14 @@ Delete a Confluence page
314
378
 
315
379
  ```
316
380
  USAGE
317
- $ conni conni content delete PAGEID [--toon]
381
+ $ conni conni content delete PAGEID [-p <value>] [--toon]
318
382
 
319
383
  ARGUMENTS
320
384
  PAGEID Page ID to delete
321
385
 
322
386
  FLAGS
323
- --toon Format output as toon
387
+ -p, --profile=<value> Authentication profile name
388
+ --toon Format output as toon
324
389
 
325
390
  DESCRIPTION
326
391
  Delete a Confluence page
@@ -329,7 +394,7 @@ EXAMPLES
329
394
  $ conni conni content delete 1543634992
330
395
  ```
331
396
 
332
- _See code: [src/commands/conni/content/delete.ts](https://github.com/hesedcasa/conni/blob/v0.5.0/src/commands/conni/content/delete.ts)_
397
+ _See code: [src/commands/conni/content/delete.ts](https://github.com/hesedcasa/conni/blob/v0.6.1/src/commands/conni/content/delete.ts)_
333
398
 
334
399
  ## `conni conni content get PAGEID`
335
400
 
@@ -337,13 +402,14 @@ Get details of a Confluence content
337
402
 
338
403
  ```
339
404
  USAGE
340
- $ conni conni content get PAGEID [--toon]
405
+ $ conni conni content get PAGEID [-p <value>] [--toon]
341
406
 
342
407
  ARGUMENTS
343
408
  PAGEID Page ID
344
409
 
345
410
  FLAGS
346
- --toon Format output as toon
411
+ -p, --profile=<value> Authentication profile name
412
+ --toon Format output as toon
347
413
 
348
414
  DESCRIPTION
349
415
  Get details of a Confluence content
@@ -352,7 +418,7 @@ EXAMPLES
352
418
  $ conni conni content get 1544060948
353
419
  ```
354
420
 
355
- _See code: [src/commands/conni/content/get.ts](https://github.com/hesedcasa/conni/blob/v0.5.0/src/commands/conni/content/get.ts)_
421
+ _See code: [src/commands/conni/content/get.ts](https://github.com/hesedcasa/conni/blob/v0.6.1/src/commands/conni/content/get.ts)_
356
422
 
357
423
  ## `conni conni content search CQL`
358
424
 
@@ -360,15 +426,16 @@ Search for Confluence contents using CQL
360
426
 
361
427
  ```
362
428
  USAGE
363
- $ conni conni content search CQL [--expand <value>] [--limit <value>] [--toon]
429
+ $ conni conni content search CQL [--expand <value>] [--limit <value>] [-p <value>] [--toon]
364
430
 
365
431
  ARGUMENTS
366
432
  CQL CQL expression
367
433
 
368
434
  FLAGS
369
- --expand=<value> Properties of the content to expand
370
- --limit=<value> Maximum number of contents per page
371
- --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
372
439
 
373
440
  DESCRIPTION
374
441
  Search for Confluence contents using CQL
@@ -379,7 +446,7 @@ EXAMPLES
379
446
  $ conni conni content search 'created > startOfMonth()' --limit=5 --expand=body,version
380
447
  ```
381
448
 
382
- _See code: [src/commands/conni/content/search.ts](https://github.com/hesedcasa/conni/blob/v0.5.0/src/commands/conni/content/search.ts)_
449
+ _See code: [src/commands/conni/content/search.ts](https://github.com/hesedcasa/conni/blob/v0.6.1/src/commands/conni/content/search.ts)_
383
450
 
384
451
  ## `conni conni content update PAGEID`
385
452
 
@@ -387,13 +454,17 @@ Update an existing Confluence content
387
454
 
388
455
  ```
389
456
  USAGE
390
- $ conni conni content update PAGEID --fields <value>...
457
+ $ conni conni content update PAGEID --fields <value>... [--full-width] [-p <value>] [--toon]
391
458
 
392
459
  ARGUMENTS
393
460
  PAGEID Page ID
394
461
 
395
462
  FLAGS
396
- --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. Use @file to read value from a file
465
+ (e.g. body=@content.xml)
466
+ --full-width Set page appearance to full-width
467
+ --toon Format output as toon
397
468
 
398
469
  DESCRIPTION
399
470
  Update an existing Confluence content
@@ -411,9 +482,11 @@ EXAMPLES
411
482
  ```'
412
483
 
413
484
  $ conni conni content update 1076199489 --fields body="$(cat content.md)"
485
+
486
+ $ conni conni content update 1076199489 --fields body=@storage.xml representation=storage --full-width
414
487
  ```
415
488
 
416
- _See code: [src/commands/conni/content/update.ts](https://github.com/hesedcasa/conni/blob/v0.5.0/src/commands/conni/content/update.ts)_
489
+ _See code: [src/commands/conni/content/update.ts](https://github.com/hesedcasa/conni/blob/v0.6.1/src/commands/conni/content/update.ts)_
417
490
 
418
491
  ## `conni conni space get SPACEKEY`
419
492
 
@@ -421,13 +494,14 @@ Get details of a Confluence space
421
494
 
422
495
  ```
423
496
  USAGE
424
- $ conni conni space get SPACEKEY [--toon]
497
+ $ conni conni space get SPACEKEY [-p <value>] [--toon]
425
498
 
426
499
  ARGUMENTS
427
500
  SPACEKEY Space key
428
501
 
429
502
  FLAGS
430
- --toon Format output as toon
503
+ -p, --profile=<value> Authentication profile name
504
+ --toon Format output as toon
431
505
 
432
506
  DESCRIPTION
433
507
  Get details of a Confluence space
@@ -436,7 +510,7 @@ EXAMPLES
436
510
  $ conni conni space get DEV
437
511
  ```
438
512
 
439
- _See code: [src/commands/conni/space/get.ts](https://github.com/hesedcasa/conni/blob/v0.5.0/src/commands/conni/space/get.ts)_
513
+ _See code: [src/commands/conni/space/get.ts](https://github.com/hesedcasa/conni/blob/v0.6.1/src/commands/conni/space/get.ts)_
440
514
 
441
515
  ## `conni conni space list`
442
516
 
@@ -444,10 +518,11 @@ List all Confluence spaces
444
518
 
445
519
  ```
446
520
  USAGE
447
- $ conni conni space list [--toon]
521
+ $ conni conni space list [-p <value>] [--toon]
448
522
 
449
523
  FLAGS
450
- --toon Format output as toon
524
+ -p, --profile=<value> Authentication profile name
525
+ --toon Format output as toon
451
526
 
452
527
  DESCRIPTION
453
528
  List all Confluence spaces
@@ -456,5 +531,5 @@ EXAMPLES
456
531
  $ conni conni space list
457
532
  ```
458
533
 
459
- _See code: [src/commands/conni/space/list.ts](https://github.com/hesedcasa/conni/blob/v0.5.0/src/commands/conni/space/list.ts)_
534
+ _See code: [src/commands/conni/space/list.ts](https://github.com/hesedcasa/conni/blob/v0.6.1/src/commands/conni/space/list.ts)_
460
535
  <!-- 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
  }