@getmagical/cli 0.1.5 → 0.1.7

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/dist/index.js CHANGED
@@ -1,4 +1,734 @@
1
1
  #!/usr/bin/env node
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJS = (cb, mod) => function __require() {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+
28
+ // ../../node_modules/ts-essentials/dist/primitive/index.js
29
+ var require_primitive = __commonJS({
30
+ "../../node_modules/ts-essentials/dist/primitive/index.js"(exports) {
31
+ "use strict";
32
+ Object.defineProperty(exports, "__esModule", { value: true });
33
+ }
34
+ });
35
+
36
+ // ../../node_modules/ts-essentials/dist/built-in/index.js
37
+ var require_built_in = __commonJS({
38
+ "../../node_modules/ts-essentials/dist/built-in/index.js"(exports) {
39
+ "use strict";
40
+ Object.defineProperty(exports, "__esModule", { value: true });
41
+ }
42
+ });
43
+
44
+ // ../../node_modules/ts-essentials/dist/key-of-base/index.js
45
+ var require_key_of_base = __commonJS({
46
+ "../../node_modules/ts-essentials/dist/key-of-base/index.js"(exports) {
47
+ "use strict";
48
+ Object.defineProperty(exports, "__esModule", { value: true });
49
+ }
50
+ });
51
+
52
+ // ../../node_modules/ts-essentials/dist/strict-exclude/index.js
53
+ var require_strict_exclude = __commonJS({
54
+ "../../node_modules/ts-essentials/dist/strict-exclude/index.js"(exports) {
55
+ "use strict";
56
+ Object.defineProperty(exports, "__esModule", { value: true });
57
+ }
58
+ });
59
+
60
+ // ../../node_modules/ts-essentials/dist/strict-extract/index.js
61
+ var require_strict_extract = __commonJS({
62
+ "../../node_modules/ts-essentials/dist/strict-extract/index.js"(exports) {
63
+ "use strict";
64
+ Object.defineProperty(exports, "__esModule", { value: true });
65
+ }
66
+ });
67
+
68
+ // ../../node_modules/ts-essentials/dist/strict-omit/index.js
69
+ var require_strict_omit = __commonJS({
70
+ "../../node_modules/ts-essentials/dist/strict-omit/index.js"(exports) {
71
+ "use strict";
72
+ Object.defineProperty(exports, "__esModule", { value: true });
73
+ }
74
+ });
75
+
76
+ // ../../node_modules/ts-essentials/dist/writable/index.js
77
+ var require_writable = __commonJS({
78
+ "../../node_modules/ts-essentials/dist/writable/index.js"(exports) {
79
+ "use strict";
80
+ Object.defineProperty(exports, "__esModule", { value: true });
81
+ }
82
+ });
83
+
84
+ // ../../node_modules/ts-essentials/dist/async-or-sync/index.js
85
+ var require_async_or_sync = __commonJS({
86
+ "../../node_modules/ts-essentials/dist/async-or-sync/index.js"(exports) {
87
+ "use strict";
88
+ Object.defineProperty(exports, "__esModule", { value: true });
89
+ }
90
+ });
91
+
92
+ // ../../node_modules/ts-essentials/dist/async-or-sync-type/index.js
93
+ var require_async_or_sync_type = __commonJS({
94
+ "../../node_modules/ts-essentials/dist/async-or-sync-type/index.js"(exports) {
95
+ "use strict";
96
+ Object.defineProperty(exports, "__esModule", { value: true });
97
+ }
98
+ });
99
+
100
+ // ../../node_modules/ts-essentials/dist/dictionary/index.js
101
+ var require_dictionary = __commonJS({
102
+ "../../node_modules/ts-essentials/dist/dictionary/index.js"(exports) {
103
+ "use strict";
104
+ Object.defineProperty(exports, "__esModule", { value: true });
105
+ }
106
+ });
107
+
108
+ // ../../node_modules/ts-essentials/dist/dictionary-values/index.js
109
+ var require_dictionary_values = __commonJS({
110
+ "../../node_modules/ts-essentials/dist/dictionary-values/index.js"(exports) {
111
+ "use strict";
112
+ Object.defineProperty(exports, "__esModule", { value: true });
113
+ }
114
+ });
115
+
116
+ // ../../node_modules/ts-essentials/dist/merge/index.js
117
+ var require_merge = __commonJS({
118
+ "../../node_modules/ts-essentials/dist/merge/index.js"(exports) {
119
+ "use strict";
120
+ Object.defineProperty(exports, "__esModule", { value: true });
121
+ }
122
+ });
123
+
124
+ // ../../node_modules/ts-essentials/dist/merge-n/index.js
125
+ var require_merge_n = __commonJS({
126
+ "../../node_modules/ts-essentials/dist/merge-n/index.js"(exports) {
127
+ "use strict";
128
+ Object.defineProperty(exports, "__esModule", { value: true });
129
+ }
130
+ });
131
+
132
+ // ../../node_modules/ts-essentials/dist/newable/index.js
133
+ var require_newable = __commonJS({
134
+ "../../node_modules/ts-essentials/dist/newable/index.js"(exports) {
135
+ "use strict";
136
+ Object.defineProperty(exports, "__esModule", { value: true });
137
+ }
138
+ });
139
+
140
+ // ../../node_modules/ts-essentials/dist/non-never/index.js
141
+ var require_non_never = __commonJS({
142
+ "../../node_modules/ts-essentials/dist/non-never/index.js"(exports) {
143
+ "use strict";
144
+ Object.defineProperty(exports, "__esModule", { value: true });
145
+ }
146
+ });
147
+
148
+ // ../../node_modules/ts-essentials/dist/omit-properties/index.js
149
+ var require_omit_properties = __commonJS({
150
+ "../../node_modules/ts-essentials/dist/omit-properties/index.js"(exports) {
151
+ "use strict";
152
+ Object.defineProperty(exports, "__esModule", { value: true });
153
+ }
154
+ });
155
+
156
+ // ../../node_modules/ts-essentials/dist/opaque/index.js
157
+ var require_opaque = __commonJS({
158
+ "../../node_modules/ts-essentials/dist/opaque/index.js"(exports) {
159
+ "use strict";
160
+ Object.defineProperty(exports, "__esModule", { value: true });
161
+ }
162
+ });
163
+
164
+ // ../../node_modules/ts-essentials/dist/path-value/index.js
165
+ var require_path_value = __commonJS({
166
+ "../../node_modules/ts-essentials/dist/path-value/index.js"(exports) {
167
+ "use strict";
168
+ Object.defineProperty(exports, "__esModule", { value: true });
169
+ }
170
+ });
171
+
172
+ // ../../node_modules/ts-essentials/dist/paths/index.js
173
+ var require_paths = __commonJS({
174
+ "../../node_modules/ts-essentials/dist/paths/index.js"(exports) {
175
+ "use strict";
176
+ Object.defineProperty(exports, "__esModule", { value: true });
177
+ }
178
+ });
179
+
180
+ // ../../node_modules/ts-essentials/dist/pick-properties/index.js
181
+ var require_pick_properties = __commonJS({
182
+ "../../node_modules/ts-essentials/dist/pick-properties/index.js"(exports) {
183
+ "use strict";
184
+ Object.defineProperty(exports, "__esModule", { value: true });
185
+ }
186
+ });
187
+
188
+ // ../../node_modules/ts-essentials/dist/prettify/index.js
189
+ var require_prettify = __commonJS({
190
+ "../../node_modules/ts-essentials/dist/prettify/index.js"(exports) {
191
+ "use strict";
192
+ Object.defineProperty(exports, "__esModule", { value: true });
193
+ }
194
+ });
195
+
196
+ // ../../node_modules/ts-essentials/dist/safe-dictionary/index.js
197
+ var require_safe_dictionary = __commonJS({
198
+ "../../node_modules/ts-essentials/dist/safe-dictionary/index.js"(exports) {
199
+ "use strict";
200
+ Object.defineProperty(exports, "__esModule", { value: true });
201
+ }
202
+ });
203
+
204
+ // ../../node_modules/ts-essentials/dist/union-to-intersection/index.js
205
+ var require_union_to_intersection = __commonJS({
206
+ "../../node_modules/ts-essentials/dist/union-to-intersection/index.js"(exports) {
207
+ "use strict";
208
+ Object.defineProperty(exports, "__esModule", { value: true });
209
+ }
210
+ });
211
+
212
+ // ../../node_modules/ts-essentials/dist/value-of/index.js
213
+ var require_value_of = __commonJS({
214
+ "../../node_modules/ts-essentials/dist/value-of/index.js"(exports) {
215
+ "use strict";
216
+ Object.defineProperty(exports, "__esModule", { value: true });
217
+ }
218
+ });
219
+
220
+ // ../../node_modules/ts-essentials/dist/xor/index.js
221
+ var require_xor = __commonJS({
222
+ "../../node_modules/ts-essentials/dist/xor/index.js"(exports) {
223
+ "use strict";
224
+ Object.defineProperty(exports, "__esModule", { value: true });
225
+ }
226
+ });
227
+
228
+ // ../../node_modules/ts-essentials/dist/mark-optional/index.js
229
+ var require_mark_optional = __commonJS({
230
+ "../../node_modules/ts-essentials/dist/mark-optional/index.js"(exports) {
231
+ "use strict";
232
+ Object.defineProperty(exports, "__esModule", { value: true });
233
+ }
234
+ });
235
+
236
+ // ../../node_modules/ts-essentials/dist/mark-readonly/index.js
237
+ var require_mark_readonly = __commonJS({
238
+ "../../node_modules/ts-essentials/dist/mark-readonly/index.js"(exports) {
239
+ "use strict";
240
+ Object.defineProperty(exports, "__esModule", { value: true });
241
+ }
242
+ });
243
+
244
+ // ../../node_modules/ts-essentials/dist/mark-required/index.js
245
+ var require_mark_required = __commonJS({
246
+ "../../node_modules/ts-essentials/dist/mark-required/index.js"(exports) {
247
+ "use strict";
248
+ Object.defineProperty(exports, "__esModule", { value: true });
249
+ }
250
+ });
251
+
252
+ // ../../node_modules/ts-essentials/dist/mark-writable/index.js
253
+ var require_mark_writable = __commonJS({
254
+ "../../node_modules/ts-essentials/dist/mark-writable/index.js"(exports) {
255
+ "use strict";
256
+ Object.defineProperty(exports, "__esModule", { value: true });
257
+ }
258
+ });
259
+
260
+ // ../../node_modules/ts-essentials/dist/buildable/index.js
261
+ var require_buildable = __commonJS({
262
+ "../../node_modules/ts-essentials/dist/buildable/index.js"(exports) {
263
+ "use strict";
264
+ Object.defineProperty(exports, "__esModule", { value: true });
265
+ }
266
+ });
267
+
268
+ // ../../node_modules/ts-essentials/dist/deep-mark-optional/index.js
269
+ var require_deep_mark_optional = __commonJS({
270
+ "../../node_modules/ts-essentials/dist/deep-mark-optional/index.js"(exports) {
271
+ "use strict";
272
+ Object.defineProperty(exports, "__esModule", { value: true });
273
+ }
274
+ });
275
+
276
+ // ../../node_modules/ts-essentials/dist/deep-mark-required/index.js
277
+ var require_deep_mark_required = __commonJS({
278
+ "../../node_modules/ts-essentials/dist/deep-mark-required/index.js"(exports) {
279
+ "use strict";
280
+ Object.defineProperty(exports, "__esModule", { value: true });
281
+ }
282
+ });
283
+
284
+ // ../../node_modules/ts-essentials/dist/deep-non-nullable/index.js
285
+ var require_deep_non_nullable = __commonJS({
286
+ "../../node_modules/ts-essentials/dist/deep-non-nullable/index.js"(exports) {
287
+ "use strict";
288
+ Object.defineProperty(exports, "__esModule", { value: true });
289
+ }
290
+ });
291
+
292
+ // ../../node_modules/ts-essentials/dist/deep-nullable/index.js
293
+ var require_deep_nullable = __commonJS({
294
+ "../../node_modules/ts-essentials/dist/deep-nullable/index.js"(exports) {
295
+ "use strict";
296
+ Object.defineProperty(exports, "__esModule", { value: true });
297
+ }
298
+ });
299
+
300
+ // ../../node_modules/ts-essentials/dist/deep-omit/index.js
301
+ var require_deep_omit = __commonJS({
302
+ "../../node_modules/ts-essentials/dist/deep-omit/index.js"(exports) {
303
+ "use strict";
304
+ Object.defineProperty(exports, "__esModule", { value: true });
305
+ }
306
+ });
307
+
308
+ // ../../node_modules/ts-essentials/dist/deep-partial/index.js
309
+ var require_deep_partial = __commonJS({
310
+ "../../node_modules/ts-essentials/dist/deep-partial/index.js"(exports) {
311
+ "use strict";
312
+ Object.defineProperty(exports, "__esModule", { value: true });
313
+ }
314
+ });
315
+
316
+ // ../../node_modules/ts-essentials/dist/deep-pick/index.js
317
+ var require_deep_pick = __commonJS({
318
+ "../../node_modules/ts-essentials/dist/deep-pick/index.js"(exports) {
319
+ "use strict";
320
+ Object.defineProperty(exports, "__esModule", { value: true });
321
+ }
322
+ });
323
+
324
+ // ../../node_modules/ts-essentials/dist/deep-readonly/index.js
325
+ var require_deep_readonly = __commonJS({
326
+ "../../node_modules/ts-essentials/dist/deep-readonly/index.js"(exports) {
327
+ "use strict";
328
+ Object.defineProperty(exports, "__esModule", { value: true });
329
+ }
330
+ });
331
+
332
+ // ../../node_modules/ts-essentials/dist/deep-required/index.js
333
+ var require_deep_required = __commonJS({
334
+ "../../node_modules/ts-essentials/dist/deep-required/index.js"(exports) {
335
+ "use strict";
336
+ Object.defineProperty(exports, "__esModule", { value: true });
337
+ }
338
+ });
339
+
340
+ // ../../node_modules/ts-essentials/dist/deep-undefinable/index.js
341
+ var require_deep_undefinable = __commonJS({
342
+ "../../node_modules/ts-essentials/dist/deep-undefinable/index.js"(exports) {
343
+ "use strict";
344
+ Object.defineProperty(exports, "__esModule", { value: true });
345
+ }
346
+ });
347
+
348
+ // ../../node_modules/ts-essentials/dist/deep-writable/index.js
349
+ var require_deep_writable = __commonJS({
350
+ "../../node_modules/ts-essentials/dist/deep-writable/index.js"(exports) {
351
+ "use strict";
352
+ Object.defineProperty(exports, "__esModule", { value: true });
353
+ }
354
+ });
355
+
356
+ // ../../node_modules/ts-essentials/dist/strict-deep-omit/index.js
357
+ var require_strict_deep_omit = __commonJS({
358
+ "../../node_modules/ts-essentials/dist/strict-deep-omit/index.js"(exports) {
359
+ "use strict";
360
+ Object.defineProperty(exports, "__esModule", { value: true });
361
+ }
362
+ });
363
+
364
+ // ../../node_modules/ts-essentials/dist/strict-deep-pick/index.js
365
+ var require_strict_deep_pick = __commonJS({
366
+ "../../node_modules/ts-essentials/dist/strict-deep-pick/index.js"(exports) {
367
+ "use strict";
368
+ Object.defineProperty(exports, "__esModule", { value: true });
369
+ }
370
+ });
371
+
372
+ // ../../node_modules/ts-essentials/dist/optional-keys/index.js
373
+ var require_optional_keys = __commonJS({
374
+ "../../node_modules/ts-essentials/dist/optional-keys/index.js"(exports) {
375
+ "use strict";
376
+ Object.defineProperty(exports, "__esModule", { value: true });
377
+ }
378
+ });
379
+
380
+ // ../../node_modules/ts-essentials/dist/pick-keys/index.js
381
+ var require_pick_keys = __commonJS({
382
+ "../../node_modules/ts-essentials/dist/pick-keys/index.js"(exports) {
383
+ "use strict";
384
+ Object.defineProperty(exports, "__esModule", { value: true });
385
+ }
386
+ });
387
+
388
+ // ../../node_modules/ts-essentials/dist/readonly-keys/index.js
389
+ var require_readonly_keys = __commonJS({
390
+ "../../node_modules/ts-essentials/dist/readonly-keys/index.js"(exports) {
391
+ "use strict";
392
+ Object.defineProperty(exports, "__esModule", { value: true });
393
+ }
394
+ });
395
+
396
+ // ../../node_modules/ts-essentials/dist/required-keys/index.js
397
+ var require_required_keys = __commonJS({
398
+ "../../node_modules/ts-essentials/dist/required-keys/index.js"(exports) {
399
+ "use strict";
400
+ Object.defineProperty(exports, "__esModule", { value: true });
401
+ }
402
+ });
403
+
404
+ // ../../node_modules/ts-essentials/dist/writable-keys/index.js
405
+ var require_writable_keys = __commonJS({
406
+ "../../node_modules/ts-essentials/dist/writable-keys/index.js"(exports) {
407
+ "use strict";
408
+ Object.defineProperty(exports, "__esModule", { value: true });
409
+ }
410
+ });
411
+
412
+ // ../../node_modules/ts-essentials/dist/exact/index.js
413
+ var require_exact = __commonJS({
414
+ "../../node_modules/ts-essentials/dist/exact/index.js"(exports) {
415
+ "use strict";
416
+ Object.defineProperty(exports, "__esModule", { value: true });
417
+ }
418
+ });
419
+
420
+ // ../../node_modules/ts-essentials/dist/is-any/index.js
421
+ var require_is_any = __commonJS({
422
+ "../../node_modules/ts-essentials/dist/is-any/index.js"(exports) {
423
+ "use strict";
424
+ Object.defineProperty(exports, "__esModule", { value: true });
425
+ }
426
+ });
427
+
428
+ // ../../node_modules/ts-essentials/dist/is-never/index.js
429
+ var require_is_never = __commonJS({
430
+ "../../node_modules/ts-essentials/dist/is-never/index.js"(exports) {
431
+ "use strict";
432
+ Object.defineProperty(exports, "__esModule", { value: true });
433
+ }
434
+ });
435
+
436
+ // ../../node_modules/ts-essentials/dist/is-unknown/index.js
437
+ var require_is_unknown = __commonJS({
438
+ "../../node_modules/ts-essentials/dist/is-unknown/index.js"(exports) {
439
+ "use strict";
440
+ Object.defineProperty(exports, "__esModule", { value: true });
441
+ }
442
+ });
443
+
444
+ // ../../node_modules/ts-essentials/dist/is-tuple/index.js
445
+ var require_is_tuple = __commonJS({
446
+ "../../node_modules/ts-essentials/dist/is-tuple/index.js"(exports) {
447
+ "use strict";
448
+ Object.defineProperty(exports, "__esModule", { value: true });
449
+ }
450
+ });
451
+
452
+ // ../../node_modules/ts-essentials/dist/non-empty-object/index.js
453
+ var require_non_empty_object = __commonJS({
454
+ "../../node_modules/ts-essentials/dist/non-empty-object/index.js"(exports) {
455
+ "use strict";
456
+ Object.defineProperty(exports, "__esModule", { value: true });
457
+ }
458
+ });
459
+
460
+ // ../../node_modules/ts-essentials/dist/any-array/index.js
461
+ var require_any_array = __commonJS({
462
+ "../../node_modules/ts-essentials/dist/any-array/index.js"(exports) {
463
+ "use strict";
464
+ Object.defineProperty(exports, "__esModule", { value: true });
465
+ }
466
+ });
467
+
468
+ // ../../node_modules/ts-essentials/dist/array-or-single/index.js
469
+ var require_array_or_single = __commonJS({
470
+ "../../node_modules/ts-essentials/dist/array-or-single/index.js"(exports) {
471
+ "use strict";
472
+ Object.defineProperty(exports, "__esModule", { value: true });
473
+ }
474
+ });
475
+
476
+ // ../../node_modules/ts-essentials/dist/element-of/index.js
477
+ var require_element_of = __commonJS({
478
+ "../../node_modules/ts-essentials/dist/element-of/index.js"(exports) {
479
+ "use strict";
480
+ Object.defineProperty(exports, "__esModule", { value: true });
481
+ }
482
+ });
483
+
484
+ // ../../node_modules/ts-essentials/dist/head/index.js
485
+ var require_head = __commonJS({
486
+ "../../node_modules/ts-essentials/dist/head/index.js"(exports) {
487
+ "use strict";
488
+ Object.defineProperty(exports, "__esModule", { value: true });
489
+ }
490
+ });
491
+
492
+ // ../../node_modules/ts-essentials/dist/non-empty-array/index.js
493
+ var require_non_empty_array = __commonJS({
494
+ "../../node_modules/ts-essentials/dist/non-empty-array/index.js"(exports) {
495
+ "use strict";
496
+ Object.defineProperty(exports, "__esModule", { value: true });
497
+ }
498
+ });
499
+
500
+ // ../../node_modules/ts-essentials/dist/readonly-array-or-single/index.js
501
+ var require_readonly_array_or_single = __commonJS({
502
+ "../../node_modules/ts-essentials/dist/readonly-array-or-single/index.js"(exports) {
503
+ "use strict";
504
+ Object.defineProperty(exports, "__esModule", { value: true });
505
+ }
506
+ });
507
+
508
+ // ../../node_modules/ts-essentials/dist/tail/index.js
509
+ var require_tail = __commonJS({
510
+ "../../node_modules/ts-essentials/dist/tail/index.js"(exports) {
511
+ "use strict";
512
+ Object.defineProperty(exports, "__esModule", { value: true });
513
+ }
514
+ });
515
+
516
+ // ../../node_modules/ts-essentials/dist/tuple/index.js
517
+ var require_tuple = __commonJS({
518
+ "../../node_modules/ts-essentials/dist/tuple/index.js"(exports) {
519
+ "use strict";
520
+ Object.defineProperty(exports, "__esModule", { value: true });
521
+ }
522
+ });
523
+
524
+ // ../../node_modules/ts-essentials/dist/camel-case/index.js
525
+ var require_camel_case = __commonJS({
526
+ "../../node_modules/ts-essentials/dist/camel-case/index.js"(exports) {
527
+ "use strict";
528
+ Object.defineProperty(exports, "__esModule", { value: true });
529
+ }
530
+ });
531
+
532
+ // ../../node_modules/ts-essentials/dist/deep-camel-case-properties/index.js
533
+ var require_deep_camel_case_properties = __commonJS({
534
+ "../../node_modules/ts-essentials/dist/deep-camel-case-properties/index.js"(exports) {
535
+ "use strict";
536
+ Object.defineProperty(exports, "__esModule", { value: true });
537
+ }
538
+ });
539
+
540
+ // ../../node_modules/ts-essentials/dist/any-function/index.js
541
+ var require_any_function = __commonJS({
542
+ "../../node_modules/ts-essentials/dist/any-function/index.js"(exports) {
543
+ "use strict";
544
+ Object.defineProperty(exports, "__esModule", { value: true });
545
+ }
546
+ });
547
+
548
+ // ../../node_modules/ts-essentials/dist/predicate-function/index.js
549
+ var require_predicate_function = __commonJS({
550
+ "../../node_modules/ts-essentials/dist/predicate-function/index.js"(exports) {
551
+ "use strict";
552
+ Object.defineProperty(exports, "__esModule", { value: true });
553
+ }
554
+ });
555
+
556
+ // ../../node_modules/ts-essentials/dist/predicate-type/index.js
557
+ var require_predicate_type = __commonJS({
558
+ "../../node_modules/ts-essentials/dist/predicate-type/index.js"(exports) {
559
+ "use strict";
560
+ Object.defineProperty(exports, "__esModule", { value: true });
561
+ }
562
+ });
563
+
564
+ // ../../node_modules/ts-essentials/dist/functions/unreachable-case-error/index.js
565
+ var require_unreachable_case_error = __commonJS({
566
+ "../../node_modules/ts-essentials/dist/functions/unreachable-case-error/index.js"(exports) {
567
+ "use strict";
568
+ Object.defineProperty(exports, "__esModule", { value: true });
569
+ exports.UnreachableCaseError = void 0;
570
+ var UnreachableCaseError2 = class extends Error {
571
+ constructor(value) {
572
+ super(`Unreachable case: ${value}`);
573
+ }
574
+ };
575
+ exports.UnreachableCaseError = UnreachableCaseError2;
576
+ }
577
+ });
578
+
579
+ // ../../node_modules/ts-essentials/dist/functions/assert/index.js
580
+ var require_assert = __commonJS({
581
+ "../../node_modules/ts-essentials/dist/functions/assert/index.js"(exports) {
582
+ "use strict";
583
+ Object.defineProperty(exports, "__esModule", { value: true });
584
+ exports.assert = void 0;
585
+ function assert(condition, message = "no additional info provided") {
586
+ if (!condition) {
587
+ throw new Error("Assertion Error: " + message);
588
+ }
589
+ }
590
+ exports.assert = assert;
591
+ }
592
+ });
593
+
594
+ // ../../node_modules/ts-essentials/dist/functions/create-factory-with-constraint/index.js
595
+ var require_create_factory_with_constraint = __commonJS({
596
+ "../../node_modules/ts-essentials/dist/functions/create-factory-with-constraint/index.js"(exports) {
597
+ "use strict";
598
+ Object.defineProperty(exports, "__esModule", { value: true });
599
+ exports.createFactoryWithConstraint = void 0;
600
+ var createFactoryWithConstraint = () => (value) => value;
601
+ exports.createFactoryWithConstraint = createFactoryWithConstraint;
602
+ }
603
+ });
604
+
605
+ // ../../node_modules/ts-essentials/dist/functions/is-exact/index.js
606
+ var require_is_exact = __commonJS({
607
+ "../../node_modules/ts-essentials/dist/functions/is-exact/index.js"(exports) {
608
+ "use strict";
609
+ Object.defineProperty(exports, "__esModule", { value: true });
610
+ exports.isExact = void 0;
611
+ var isExact = () => (x) => x;
612
+ exports.isExact = isExact;
613
+ }
614
+ });
615
+
616
+ // ../../node_modules/ts-essentials/dist/functions/noop/index.js
617
+ var require_noop = __commonJS({
618
+ "../../node_modules/ts-essentials/dist/functions/noop/index.js"(exports) {
619
+ "use strict";
620
+ Object.defineProperty(exports, "__esModule", { value: true });
621
+ exports.noop = void 0;
622
+ function noop(..._args) {
623
+ }
624
+ exports.noop = noop;
625
+ }
626
+ });
627
+
628
+ // ../../node_modules/ts-essentials/dist/awaited/index.js
629
+ var require_awaited = __commonJS({
630
+ "../../node_modules/ts-essentials/dist/awaited/index.js"(exports) {
631
+ "use strict";
632
+ Object.defineProperty(exports, "__esModule", { value: true });
633
+ }
634
+ });
635
+
636
+ // ../../node_modules/ts-essentials/dist/index.js
637
+ var require_dist = __commonJS({
638
+ "../../node_modules/ts-essentials/dist/index.js"(exports) {
639
+ "use strict";
640
+ var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
641
+ if (k2 === void 0) k2 = k;
642
+ var desc = Object.getOwnPropertyDescriptor(m, k);
643
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
644
+ desc = { enumerable: true, get: function() {
645
+ return m[k];
646
+ } };
647
+ }
648
+ Object.defineProperty(o, k2, desc);
649
+ }) : (function(o, m, k, k2) {
650
+ if (k2 === void 0) k2 = k;
651
+ o[k2] = m[k];
652
+ }));
653
+ var __exportStar = exports && exports.__exportStar || function(m, exports2) {
654
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
655
+ };
656
+ Object.defineProperty(exports, "__esModule", { value: true });
657
+ __exportStar(require_primitive(), exports);
658
+ __exportStar(require_built_in(), exports);
659
+ __exportStar(require_key_of_base(), exports);
660
+ __exportStar(require_strict_exclude(), exports);
661
+ __exportStar(require_strict_extract(), exports);
662
+ __exportStar(require_strict_omit(), exports);
663
+ __exportStar(require_writable(), exports);
664
+ __exportStar(require_async_or_sync(), exports);
665
+ __exportStar(require_async_or_sync_type(), exports);
666
+ __exportStar(require_dictionary(), exports);
667
+ __exportStar(require_dictionary_values(), exports);
668
+ __exportStar(require_merge(), exports);
669
+ __exportStar(require_merge_n(), exports);
670
+ __exportStar(require_newable(), exports);
671
+ __exportStar(require_non_never(), exports);
672
+ __exportStar(require_omit_properties(), exports);
673
+ __exportStar(require_opaque(), exports);
674
+ __exportStar(require_path_value(), exports);
675
+ __exportStar(require_paths(), exports);
676
+ __exportStar(require_pick_properties(), exports);
677
+ __exportStar(require_prettify(), exports);
678
+ __exportStar(require_safe_dictionary(), exports);
679
+ __exportStar(require_union_to_intersection(), exports);
680
+ __exportStar(require_value_of(), exports);
681
+ __exportStar(require_xor(), exports);
682
+ __exportStar(require_mark_optional(), exports);
683
+ __exportStar(require_mark_readonly(), exports);
684
+ __exportStar(require_mark_required(), exports);
685
+ __exportStar(require_mark_writable(), exports);
686
+ __exportStar(require_buildable(), exports);
687
+ __exportStar(require_deep_mark_optional(), exports);
688
+ __exportStar(require_deep_mark_required(), exports);
689
+ __exportStar(require_deep_non_nullable(), exports);
690
+ __exportStar(require_deep_nullable(), exports);
691
+ __exportStar(require_deep_omit(), exports);
692
+ __exportStar(require_deep_partial(), exports);
693
+ __exportStar(require_deep_pick(), exports);
694
+ __exportStar(require_deep_readonly(), exports);
695
+ __exportStar(require_deep_required(), exports);
696
+ __exportStar(require_deep_undefinable(), exports);
697
+ __exportStar(require_deep_writable(), exports);
698
+ __exportStar(require_strict_deep_omit(), exports);
699
+ __exportStar(require_strict_deep_pick(), exports);
700
+ __exportStar(require_optional_keys(), exports);
701
+ __exportStar(require_pick_keys(), exports);
702
+ __exportStar(require_readonly_keys(), exports);
703
+ __exportStar(require_required_keys(), exports);
704
+ __exportStar(require_writable_keys(), exports);
705
+ __exportStar(require_exact(), exports);
706
+ __exportStar(require_is_any(), exports);
707
+ __exportStar(require_is_never(), exports);
708
+ __exportStar(require_is_unknown(), exports);
709
+ __exportStar(require_is_tuple(), exports);
710
+ __exportStar(require_non_empty_object(), exports);
711
+ __exportStar(require_any_array(), exports);
712
+ __exportStar(require_array_or_single(), exports);
713
+ __exportStar(require_element_of(), exports);
714
+ __exportStar(require_head(), exports);
715
+ __exportStar(require_non_empty_array(), exports);
716
+ __exportStar(require_readonly_array_or_single(), exports);
717
+ __exportStar(require_tail(), exports);
718
+ __exportStar(require_tuple(), exports);
719
+ __exportStar(require_camel_case(), exports);
720
+ __exportStar(require_deep_camel_case_properties(), exports);
721
+ __exportStar(require_any_function(), exports);
722
+ __exportStar(require_predicate_function(), exports);
723
+ __exportStar(require_predicate_type(), exports);
724
+ __exportStar(require_unreachable_case_error(), exports);
725
+ __exportStar(require_assert(), exports);
726
+ __exportStar(require_create_factory_with_constraint(), exports);
727
+ __exportStar(require_is_exact(), exports);
728
+ __exportStar(require_noop(), exports);
729
+ __exportStar(require_awaited(), exports);
730
+ }
731
+ });
2
732
 
3
733
  // src/cli-formatting.ts
4
734
  import { inspect, stripVTControlCharacters, styleText } from "util";
@@ -1276,7 +2006,7 @@ mutation UpdateAutomationById($id: ID!, $input: UpdateAutomationInput!) {
1276
2006
  ];
1277
2007
 
1278
2008
  // src/program.ts
1279
- import { Command, InvalidArgumentError, Option } from "commander";
2009
+ import { Command as Command2, InvalidArgumentError as InvalidArgumentError2, Option as Option2 } from "commander";
1280
2010
 
1281
2011
  // src/api.ts
1282
2012
  import { z as z2 } from "zod";
@@ -1323,15 +2053,20 @@ function getApiErrorDetail(responseBody) {
1323
2053
  }
1324
2054
  return parsedResponse.data.errors.map((error) => error.message).join("\n");
1325
2055
  }
2056
+ function trimTrailingSlash(value) {
2057
+ return value.replace(/\/+$/u, "");
2058
+ }
1326
2059
  function createMagicalApiClient({
1327
2060
  apiBaseUrl,
1328
2061
  fetchFn = fetch
1329
2062
  }) {
2063
+ const resolveApiBaseUrl = typeof apiBaseUrl === "string" ? () => apiBaseUrl : apiBaseUrl;
1330
2064
  async function fetchJson({
1331
2065
  accessToken,
1332
- url,
2066
+ path: path5,
1333
2067
  init
1334
2068
  }) {
2069
+ const url = `${trimTrailingSlash(await resolveApiBaseUrl())}${path5}`;
1335
2070
  const headers = new Headers(init?.headers);
1336
2071
  headers.set("authorization", `Bearer ${accessToken}`);
1337
2072
  const response = await fetchFn(url, {
@@ -1339,7 +2074,7 @@ function createMagicalApiClient({
1339
2074
  headers
1340
2075
  }).catch((error) => {
1341
2076
  throw new CliError(
1342
- `Failed to reach Magical API at ${url}. Check MAGICAL_API_URL and make sure service-main is running.`,
2077
+ `Failed to reach Magical API at ${url}. Check your configured base URL and make sure service-main is running.`,
1343
2078
  { cause: error }
1344
2079
  );
1345
2080
  });
@@ -1379,7 +2114,7 @@ function createMagicalApiClient({
1379
2114
  const parsedResponse = graphQlResponseSchema.safeParse(
1380
2115
  await fetchJson({
1381
2116
  accessToken,
1382
- url: `${apiBaseUrl}/graphql`,
2117
+ path: "/graphql",
1383
2118
  init: {
1384
2119
  method: "POST",
1385
2120
  headers,
@@ -1404,7 +2139,7 @@ function createMagicalApiClient({
1404
2139
  const parsedResponse = workosOrganizationsResponseSchema.safeParse(
1405
2140
  await fetchJson({
1406
2141
  accessToken,
1407
- url: `${apiBaseUrl}/workos/organizations`
2142
+ path: "/workos/organizations"
1408
2143
  })
1409
2144
  );
1410
2145
  if (!parsedResponse.success) {
@@ -1423,7 +2158,7 @@ function createMagicalApiClient({
1423
2158
  const parsedResponse = workosUserSchema.safeParse(
1424
2159
  await fetchJson({
1425
2160
  accessToken,
1426
- url: `${apiBaseUrl}/workos/user/${userId}`
2161
+ path: `/workos/user/${userId}`
1427
2162
  })
1428
2163
  );
1429
2164
  if (!parsedResponse.success) {
@@ -1434,57 +2169,19 @@ function createMagicalApiClient({
1434
2169
  };
1435
2170
  }
1436
2171
 
1437
- // src/command-presentation.ts
1438
- var rootOperationalGroupDescriptions = /* @__PURE__ */ new Map([
1439
- ["agents", "Query agents."],
1440
- ["agent-runs", "Query agent runs."],
1441
- ["automations", "Manage automations."],
1442
- ["automation-runs", "Inspect and control automation runs."],
1443
- ["catalog", "Inspect available commands, models, and tools."],
1444
- ["graphql", "Inspect GraphQL metadata."]
1445
- ]);
1446
- function configureCommandPresentation(command) {
1447
- const originalCreateCommand = command.createCommand.bind(command);
1448
- command.createCommand = (name) => configureCommandPresentation(originalCreateCommand(name));
1449
- command.createHelp = () => new MagicalHelp();
1450
- return command;
1451
- }
1452
- function createOperationHelpExamples(operationSpec) {
1453
- const baseCommand = `mgcl ${operationSpec.cli.path.join(" ")}`;
1454
- const requiredOptions = operationSpec.cli.options.filter((optionSpec) => optionSpec.required).map((optionSpec) => {
1455
- if (optionSpec.valueType === "boolean") {
1456
- return `--${optionSpec.flagName}`;
1457
- }
1458
- if (optionSpec.valueType === "number") {
1459
- return `--${optionSpec.flagName} 10`;
1460
- }
1461
- if (optionSpec.valueType === "json") {
1462
- return `--${optionSpec.flagName} '{...}'`;
1463
- }
1464
- if (optionSpec.valueType === "string-array") {
1465
- return `--${optionSpec.flagName} value-a,value-b`;
1466
- }
1467
- return `--${optionSpec.flagName} <${optionSpec.flagName}>`;
1468
- });
1469
- const baseInvocation = [baseCommand, ...requiredOptions].join(" ");
1470
- return [
1471
- baseInvocation,
1472
- `${baseInvocation} --org <org>`,
1473
- `${baseInvocation} --json`
1474
- ];
1475
- }
1476
-
1477
2172
  // src/config.ts
1478
2173
  import os from "os";
1479
2174
  import path from "path";
1480
2175
  var DEFAULT_MAGICAL_API_URL = "https://api-agt.getmagical.io";
1481
2176
  var DEFAULT_WORKOS_API_URL = "https://api.workos.com";
1482
2177
  var DEFAULT_WORKOS_CLIENT_ID = "client_01JJZ6XJ1RF248P20WF63M4VAM";
2178
+ var DEFAULT_STAGING_WORKOS_CLIENT_ID = "client_01JJZ6X26BGFBT8AC303XPQ9EQ";
1483
2179
  var DEFAULT_KEYCHAIN_SERVICE_NAME = "@getmagical/mcp-cli";
1484
2180
  var DEFAULT_CLI_DIST_TAG = "latest";
1485
2181
  var DEFAULT_CLI_NPM_REGISTRY_URL = "https://registry.npmjs.org/";
1486
2182
  var CLI_CONFIG_DIRECTORY_NAME = "magical-mcp-cli";
1487
2183
  var CLI_STATE_FILE_NAME = "state.json";
2184
+ var CLI_SETTINGS_FILE_NAME = "settings.json";
1488
2185
  function resolvePlatformConfigDirectory() {
1489
2186
  const customConfigDirectory = process.env["MAGICAL_CLI_CONFIG_DIR"];
1490
2187
  if (customConfigDirectory) {
@@ -1506,19 +2203,768 @@ function getRuntimeConfig() {
1506
2203
  );
1507
2204
  return {
1508
2205
  cliDistTag: process.env["MAGICAL_CLI_DIST_TAG"] ?? DEFAULT_CLI_DIST_TAG,
1509
- magicalApiUrl: process.env["MAGICAL_API_URL"] ?? DEFAULT_MAGICAL_API_URL,
2206
+ magicalApiUrl: DEFAULT_MAGICAL_API_URL,
1510
2207
  npmRegistryUrl: process.env["MAGICAL_CLI_NPM_REGISTRY_URL"] ?? DEFAULT_CLI_NPM_REGISTRY_URL,
1511
2208
  stateFilePath: path.join(configDirectory, CLI_STATE_FILE_NAME),
1512
2209
  workosApiUrl: DEFAULT_WORKOS_API_URL,
1513
- workosClientId: process.env["WORKOS_CLIENT_ID"] ?? DEFAULT_WORKOS_CLIENT_ID,
1514
- keychainServiceName: DEFAULT_KEYCHAIN_SERVICE_NAME,
1515
- ...process.env["WORKOS_AUTHKIT_DOMAIN"] ? { workosAuthkitDomain: process.env["WORKOS_AUTHKIT_DOMAIN"] } : {}
2210
+ workosClientId: DEFAULT_WORKOS_CLIENT_ID,
2211
+ keychainServiceName: DEFAULT_KEYCHAIN_SERVICE_NAME
1516
2212
  };
1517
2213
  }
1518
2214
  function requireWorkosClientId(config) {
1519
2215
  return config.workosClientId;
1520
2216
  }
1521
2217
 
2218
+ // src/settings.ts
2219
+ import { mkdir, readFile, rm, writeFile } from "fs/promises";
2220
+ import path2 from "path";
2221
+
2222
+ // ../common/dist/src/stdlib/json.util.js
2223
+ var import_ts_essentials = __toESM(require_dist(), 1);
2224
+
2225
+ // ../common/dist/src/stdlib/result.util.js
2226
+ import { z as z3 } from "zod";
2227
+
2228
+ // ../common/dist/src/stdlib/error-user-facing.js
2229
+ var USER_FACING_STATUS_MESSAGES = /* @__PURE__ */ new Map([
2230
+ [400, "Bad Request"],
2231
+ [401, "Unauthorized"],
2232
+ [403, "Forbidden"],
2233
+ [404, "Not Found"],
2234
+ [500, "Internal Server Error"]
2235
+ ]);
2236
+ var USER_FACING_DEFAULT_ACTIONS = /* @__PURE__ */ new Map([
2237
+ [400, "Review the request payload and retry."],
2238
+ [401, "Authenticate and retry the request."],
2239
+ [403, "Verify your permissions and retry the request."],
2240
+ [404, "Verify the requested resource exists and retry."],
2241
+ [
2242
+ 500,
2243
+ "Retry the request. If this keeps happening, contact support and share the correlation ID."
2244
+ ]
2245
+ ]);
2246
+ var USER_FACING_FALLBACK_CODES = /* @__PURE__ */ new Map([
2247
+ [400, "BAD_REQUEST"],
2248
+ [401, "UNAUTHORIZED"],
2249
+ [403, "FORBIDDEN"],
2250
+ [404, "NOT_FOUND"],
2251
+ [500, "INTERNAL_SERVER_ERROR"]
2252
+ ]);
2253
+ function isCustomerUsageError(appError) {
2254
+ return appError.categories.includes("customer_usage");
2255
+ }
2256
+ function getStatusCodeFromAppErrorCode(code) {
2257
+ if (typeof code !== "number" || !Number.isInteger(code)) {
2258
+ return void 0;
2259
+ }
2260
+ if (code >= 400 && code <= 599) {
2261
+ return code;
2262
+ }
2263
+ return void 0;
2264
+ }
2265
+ function getStatusFamilyFallbackCode(statusCode) {
2266
+ if (statusCode >= 400 && statusCode <= 499) {
2267
+ return 400;
2268
+ }
2269
+ return 500;
2270
+ }
2271
+ function getStatusMessage(statusCode) {
2272
+ const directMessage = USER_FACING_STATUS_MESSAGES.get(statusCode);
2273
+ if (directMessage !== void 0) {
2274
+ return directMessage;
2275
+ }
2276
+ return getStatusFamilyFallbackCode(statusCode) === 400 ? "Bad Request" : "Internal Server Error";
2277
+ }
2278
+ function getDefaultSuggestedAction(statusCode) {
2279
+ const directAction = USER_FACING_DEFAULT_ACTIONS.get(statusCode);
2280
+ if (directAction !== void 0) {
2281
+ return directAction;
2282
+ }
2283
+ return getStatusFamilyFallbackCode(statusCode) === 400 ? "Review the request payload and retry." : "Retry the request. If this keeps happening, contact support and share the correlation ID.";
2284
+ }
2285
+ function getFallbackErrorCode(statusCode) {
2286
+ const directCode = USER_FACING_FALLBACK_CODES.get(statusCode);
2287
+ if (directCode !== void 0) {
2288
+ return directCode;
2289
+ }
2290
+ return getStatusFamilyFallbackCode(statusCode) === 400 ? "BAD_REQUEST" : "INTERNAL_SERVER_ERROR";
2291
+ }
2292
+ function shouldExposeMessage({ appError, statusCode }) {
2293
+ if (statusCode >= 500) {
2294
+ return false;
2295
+ }
2296
+ return isCustomerUsageError(appError);
2297
+ }
2298
+ function resolveApiMessage({ appError, statusCode }) {
2299
+ if (!shouldExposeMessage({ appError, statusCode })) {
2300
+ return getStatusMessage(statusCode);
2301
+ }
2302
+ const trimmedMessage = appError.message.trim();
2303
+ if (trimmedMessage.length > 0) {
2304
+ return trimmedMessage;
2305
+ }
2306
+ return getStatusMessage(statusCode);
2307
+ }
2308
+ function resolveApiErrorCode({ appError, statusCode }) {
2309
+ if (!shouldExposeMessage({ appError, statusCode })) {
2310
+ return getFallbackErrorCode(statusCode);
2311
+ }
2312
+ return normalizeUserFacingErrorCode({
2313
+ type: appError.type,
2314
+ fallbackCode: getFallbackErrorCode(statusCode)
2315
+ });
2316
+ }
2317
+ function resolveSuggestedAction({ appError, statusCode }) {
2318
+ const trimmedSuggestedAction = appError.suggestedAction?.trim();
2319
+ if (shouldExposeMessage({ appError, statusCode }) && trimmedSuggestedAction) {
2320
+ return trimmedSuggestedAction;
2321
+ }
2322
+ return getDefaultSuggestedAction(statusCode);
2323
+ }
2324
+ function getZodIssuesFromCause(cause, maxDepth = 10) {
2325
+ if (maxDepth < 0 || typeof cause !== "object" || cause === null) {
2326
+ return void 0;
2327
+ }
2328
+ if ("issues" in cause && Array.isArray(cause.issues)) {
2329
+ return cause.issues;
2330
+ }
2331
+ if ("cause" in cause) {
2332
+ return getZodIssuesFromCause(cause.cause, maxDepth - 1);
2333
+ }
2334
+ return void 0;
2335
+ }
2336
+ function toUserFacingDetailsValue(value, depth) {
2337
+ if (depth < 0) {
2338
+ return void 0;
2339
+ }
2340
+ if (value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
2341
+ return value;
2342
+ }
2343
+ if (Array.isArray(value)) {
2344
+ const serializedValues = value.map((item) => toUserFacingDetailsValue(item, depth - 1)).filter((item) => item !== void 0);
2345
+ return serializedValues;
2346
+ }
2347
+ if (value && typeof value === "object") {
2348
+ const serializedObject = {};
2349
+ for (const [key, itemValue] of Object.entries(value)) {
2350
+ const serializedItemValue = toUserFacingDetailsValue(itemValue, depth - 1);
2351
+ if (serializedItemValue !== void 0) {
2352
+ serializedObject[key] = serializedItemValue;
2353
+ }
2354
+ }
2355
+ if (Object.keys(serializedObject).length === 0) {
2356
+ return void 0;
2357
+ }
2358
+ return serializedObject;
2359
+ }
2360
+ return void 0;
2361
+ }
2362
+ function resolveApiDetails({ appError, statusCode }) {
2363
+ if (!shouldExposeMessage({ appError, statusCode })) {
2364
+ return void 0;
2365
+ }
2366
+ const zodIssues = getZodIssuesFromCause(appError.cause);
2367
+ if (zodIssues && zodIssues.length > 0) {
2368
+ return {
2369
+ validationErrors: zodIssues.map((issue) => ({
2370
+ path: Array.isArray(issue.path) ? issue.path.map(String).join(".") : "",
2371
+ message: typeof issue.message === "string" ? issue.message : "Invalid value",
2372
+ ...typeof issue.code === "string" ? { code: issue.code } : {}
2373
+ }))
2374
+ };
2375
+ }
2376
+ const rawDetails = toUserFacingDetailsValue(appError.details, 4);
2377
+ if (rawDetails && typeof rawDetails === "object" && !Array.isArray(rawDetails) && Object.keys(rawDetails).length > 0) {
2378
+ return rawDetails;
2379
+ }
2380
+ return void 0;
2381
+ }
2382
+ function getGraphQLErrorCodeFromAppErrorCode(code) {
2383
+ if (code === 400) {
2384
+ return "BAD_USER_INPUT";
2385
+ }
2386
+ if (code === 401) {
2387
+ return "UNAUTHORIZED";
2388
+ }
2389
+ if (code === 403) {
2390
+ return "FORBIDDEN";
2391
+ }
2392
+ if (code === 404) {
2393
+ return "NOT_FOUND";
2394
+ }
2395
+ if (code === 500) {
2396
+ return "INTERNAL_SERVER_ERROR";
2397
+ }
2398
+ return void 0;
2399
+ }
2400
+ function resolveGraphQLErrorCode(appError) {
2401
+ const codeFromAppErrorCode = getGraphQLErrorCodeFromAppErrorCode(appError.statusCode);
2402
+ if (codeFromAppErrorCode !== void 0) {
2403
+ return codeFromAppErrorCode;
2404
+ }
2405
+ const normalizedErrorType = appError.type.toLowerCase();
2406
+ if (normalizedErrorType.includes("unauthorized")) {
2407
+ return "UNAUTHORIZED";
2408
+ }
2409
+ if (normalizedErrorType.includes("forbidden")) {
2410
+ return "FORBIDDEN";
2411
+ }
2412
+ if (normalizedErrorType.includes("not-found")) {
2413
+ return "NOT_FOUND";
2414
+ }
2415
+ if (isCustomerUsageError(appError)) {
2416
+ return "BAD_USER_INPUT";
2417
+ }
2418
+ return "INTERNAL_SERVER_ERROR";
2419
+ }
2420
+ function getStatusCodeFromGraphQLErrorCode(code) {
2421
+ switch (code) {
2422
+ case "BAD_USER_INPUT": {
2423
+ return 400;
2424
+ }
2425
+ case "UNAUTHORIZED": {
2426
+ return 401;
2427
+ }
2428
+ case "FORBIDDEN": {
2429
+ return 403;
2430
+ }
2431
+ case "NOT_FOUND": {
2432
+ return 404;
2433
+ }
2434
+ case "INTERNAL_SERVER_ERROR": {
2435
+ return 500;
2436
+ }
2437
+ }
2438
+ }
2439
+ function getGraphQLErrorMessage({ code, apiMessage }) {
2440
+ switch (code) {
2441
+ case "BAD_USER_INPUT":
2442
+ case "NOT_FOUND":
2443
+ case "INTERNAL_SERVER_ERROR": {
2444
+ return apiMessage;
2445
+ }
2446
+ case "UNAUTHORIZED": {
2447
+ return "Unauthorized";
2448
+ }
2449
+ case "FORBIDDEN": {
2450
+ return "Forbidden";
2451
+ }
2452
+ }
2453
+ }
2454
+ function getGraphQLAppErrorCode({ code, apiCode }) {
2455
+ if (code === "INTERNAL_SERVER_ERROR" || code === "UNAUTHORIZED" || code === "FORBIDDEN") {
2456
+ return code;
2457
+ }
2458
+ return apiCode;
2459
+ }
2460
+ function normalizeErrorCodeSegment(value) {
2461
+ return value.trim().toUpperCase().replaceAll(/[^\dA-Z]+/gu, "_").replaceAll(/^_+/gu, "").replaceAll(/_+$/gu, "");
2462
+ }
2463
+ function getStatusCodeForAppErrorFromAppError(appError) {
2464
+ const statusCodeFromCode = getStatusCodeFromAppErrorCode(appError.statusCode);
2465
+ if (statusCodeFromCode !== void 0) {
2466
+ return statusCodeFromCode;
2467
+ }
2468
+ if (isCustomerUsageError(appError)) {
2469
+ return 400;
2470
+ }
2471
+ return 500;
2472
+ }
2473
+ function normalizeUserFacingErrorCode({ type, fallbackCode, prefix }) {
2474
+ if (!type) {
2475
+ return fallbackCode;
2476
+ }
2477
+ const normalized = normalizeErrorCodeSegment(type);
2478
+ if (normalized.length === 0) {
2479
+ return fallbackCode;
2480
+ }
2481
+ const normalizedPrefix = prefix ? normalizeErrorCodeSegment(prefix) : void 0;
2482
+ if (!normalizedPrefix) {
2483
+ return normalized;
2484
+ }
2485
+ if (normalized.startsWith(`${normalizedPrefix}_`)) {
2486
+ return normalized;
2487
+ }
2488
+ return `${normalizedPrefix}_${normalized}`;
2489
+ }
2490
+ function toUserFacingApiErrorFromAppError({ appError, correlationId, statusCode }) {
2491
+ const resolvedStatusCode = statusCode ?? getStatusCodeForAppErrorFromAppError(appError);
2492
+ const message = resolveApiMessage({
2493
+ appError,
2494
+ statusCode: resolvedStatusCode
2495
+ });
2496
+ const suggestedAction = resolveSuggestedAction({
2497
+ appError,
2498
+ statusCode: resolvedStatusCode
2499
+ });
2500
+ const details = resolveApiDetails({
2501
+ appError,
2502
+ statusCode: resolvedStatusCode
2503
+ });
2504
+ return {
2505
+ code: resolveApiErrorCode({
2506
+ appError,
2507
+ statusCode: resolvedStatusCode
2508
+ }),
2509
+ message,
2510
+ correlationId,
2511
+ suggestedAction,
2512
+ ...details ? { details } : {}
2513
+ };
2514
+ }
2515
+ function toUserFacingGraphQLErrorFromAppError({ appError, correlationId }) {
2516
+ const code = resolveGraphQLErrorCode(appError);
2517
+ const statusCode = getStatusCodeFromGraphQLErrorCode(code);
2518
+ const apiError = toUserFacingApiErrorFromAppError({
2519
+ appError,
2520
+ correlationId,
2521
+ statusCode
2522
+ });
2523
+ return {
2524
+ code,
2525
+ errorCode: getGraphQLAppErrorCode({ code, apiCode: apiError.code }),
2526
+ message: getGraphQLErrorMessage({ code, apiMessage: apiError.message }),
2527
+ correlationId
2528
+ };
2529
+ }
2530
+
2531
+ // ../common/dist/src/stdlib/error.js
2532
+ var INTERNAL_STACK_PATHS = [
2533
+ "/src/stdlib/result.util.ts",
2534
+ "/src/stdlib/error.ts"
2535
+ ];
2536
+ function stripInternalFrames(stack, internalFrames) {
2537
+ const lines = stack.split("\n");
2538
+ return lines.filter((line) => !internalFrames.some((internalFrame) => line.includes(internalFrame)));
2539
+ }
2540
+ var ORDERED_APP_ERROR_CATEGORIES = [
2541
+ "internal_platform",
2542
+ "customer_usage",
2543
+ "third_party"
2544
+ ];
2545
+ function isAppErrorCategory(category) {
2546
+ return typeof category === "string" && // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
2547
+ ORDERED_APP_ERROR_CATEGORIES.includes(category);
2548
+ }
2549
+ var APP_ERROR_SEVERITIES = ["warn", "error", "fatal"];
2550
+ function isAppErrorCode(code) {
2551
+ return typeof code === "number" && Number.isInteger(code) && code >= 400 && code <= 599;
2552
+ }
2553
+ function isAppErrorSeverity(severity) {
2554
+ return typeof severity === "string" && // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
2555
+ APP_ERROR_SEVERITIES.includes(severity);
2556
+ }
2557
+ var AppError = class _AppError extends Error {
2558
+ type;
2559
+ categories;
2560
+ severity;
2561
+ statusCode;
2562
+ suggestedAction;
2563
+ nonRetryable;
2564
+ details;
2565
+ constructor({ type, categories, severity, statusCode, code, message, suggestedAction, cause, nonRetryable, stack, internalFrames, ...details }) {
2566
+ super(_AppError.resolveMessage(message, cause, type), { cause });
2567
+ this.type = type;
2568
+ this.name = type;
2569
+ this.details = details;
2570
+ this.categories = categories ?? _AppError.extractCategoriesFromCause(cause);
2571
+ this.severity = severity ?? _AppError.extractSeverityFromCause(cause);
2572
+ this.statusCode = statusCode ?? code ?? _AppError.extractStatusCodeFromCause(cause);
2573
+ this.suggestedAction = suggestedAction ?? _AppError.extractSuggestedActionFromCause(cause);
2574
+ this.nonRetryable = nonRetryable ?? false;
2575
+ _AppError.applyStack(this, stack, internalFrames);
2576
+ }
2577
+ static resolveMessage(message, cause, type) {
2578
+ if (message) {
2579
+ return message;
2580
+ }
2581
+ if (cause instanceof Error) {
2582
+ return cause.message;
2583
+ }
2584
+ return type;
2585
+ }
2586
+ static extractCategoriesFromCause(cause) {
2587
+ if (!cause || typeof cause !== "object" || !("categories" in cause)) {
2588
+ return ["internal_platform"];
2589
+ }
2590
+ if (Array.isArray(cause.categories) && cause.categories.length > 0 && cause.categories.every(isAppErrorCategory)) {
2591
+ return cause.categories;
2592
+ }
2593
+ return ["internal_platform"];
2594
+ }
2595
+ static extractSeverityFromCause(cause) {
2596
+ if (cause && typeof cause === "object" && "severity" in cause && isAppErrorSeverity(cause.severity)) {
2597
+ return cause.severity;
2598
+ }
2599
+ return "error";
2600
+ }
2601
+ static extractStatusCodeFromCause(cause) {
2602
+ if (cause && typeof cause === "object" && "statusCode" in cause && isAppErrorCode(cause.statusCode)) {
2603
+ return cause.statusCode;
2604
+ }
2605
+ if (cause && typeof cause === "object" && "code" in cause && isAppErrorCode(cause.code)) {
2606
+ return cause.code;
2607
+ }
2608
+ return void 0;
2609
+ }
2610
+ /** @deprecated Use statusCode instead. */
2611
+ get code() {
2612
+ return this.statusCode;
2613
+ }
2614
+ static extractSuggestedActionFromCause(cause) {
2615
+ if (cause && typeof cause === "object" && "suggestedAction" in cause && typeof cause.suggestedAction === "string") {
2616
+ const trimmedSuggestedAction = cause.suggestedAction.trim();
2617
+ if (trimmedSuggestedAction.length > 0) {
2618
+ return trimmedSuggestedAction;
2619
+ }
2620
+ }
2621
+ return void 0;
2622
+ }
2623
+ static applyStack(error, stack, internalFrames) {
2624
+ if (stack) {
2625
+ error.stack = stack;
2626
+ }
2627
+ error.stack &&= stripInternalFrames(error.stack, [
2628
+ ...INTERNAL_STACK_PATHS,
2629
+ ...internalFrames ?? []
2630
+ ]).join("\n");
2631
+ }
2632
+ toApiError({ correlationId }) {
2633
+ return toUserFacingApiError({
2634
+ error: this,
2635
+ correlationId,
2636
+ statusCode: getStatusCodeForAppError(this)
2637
+ });
2638
+ }
2639
+ toGqlError({ correlationId }) {
2640
+ return toUserFacingGraphQLError({
2641
+ error: this,
2642
+ correlationId
2643
+ });
2644
+ }
2645
+ };
2646
+ function toAppError(error) {
2647
+ return error instanceof AppError ? error : new AppError(error);
2648
+ }
2649
+ function getStatusCodeForAppError(error) {
2650
+ const appError = toAppError(error);
2651
+ return getStatusCodeForAppErrorFromAppError(appError);
2652
+ }
2653
+ function toUserFacingApiError({ error, correlationId, statusCode }) {
2654
+ const appError = toAppError(error);
2655
+ return toUserFacingApiErrorFromAppError({
2656
+ appError,
2657
+ correlationId,
2658
+ statusCode
2659
+ });
2660
+ }
2661
+ function toUserFacingGraphQLError({ error, correlationId }) {
2662
+ const appError = toAppError(error);
2663
+ return toUserFacingGraphQLErrorFromAppError({
2664
+ appError,
2665
+ correlationId
2666
+ });
2667
+ }
2668
+
2669
+ // ../common/dist/src/stdlib/result.util.js
2670
+ var Result;
2671
+ (function(Result2) {
2672
+ function partition(responses) {
2673
+ const oks = responses.filter((resp) => resp._tag === "Ok").map((resp) => resp.value);
2674
+ const errs = responses.filter((resp) => resp._tag === "Err").map((resp) => resp.error);
2675
+ return [oks, errs];
2676
+ }
2677
+ Result2.partition = partition;
2678
+ async function promiseAllAndPartition(promises) {
2679
+ const results = await Promise.all(promises);
2680
+ return partition(results);
2681
+ }
2682
+ Result2.promiseAllAndPartition = promiseAllAndPartition;
2683
+ function unwrapOrThrow(result) {
2684
+ if (isErr(result)) {
2685
+ throw result.error;
2686
+ }
2687
+ return result.value;
2688
+ }
2689
+ Result2.unwrapOrThrow = unwrapOrThrow;
2690
+ async function all(promises) {
2691
+ const results = await fromThrowable(async () => Promise.all(promises.map(async (promise) => {
2692
+ const result = await promise;
2693
+ if (isErr(result)) {
2694
+ throw result.error;
2695
+ }
2696
+ return result;
2697
+ })), "unknown-error");
2698
+ if (isErr(results)) {
2699
+ return ErrFromThrowable(results.error.cause);
2700
+ }
2701
+ return Ok(results.value.map((r) => r.value));
2702
+ }
2703
+ Result2.all = all;
2704
+ function andThenSync(fnFirst, ...fns) {
2705
+ let result = fnFirst();
2706
+ const values = [];
2707
+ for (const fn of fns) {
2708
+ if (isErr(result)) {
2709
+ return result;
2710
+ }
2711
+ values.unshift(result.value);
2712
+ result = fn(...values);
2713
+ }
2714
+ return result;
2715
+ }
2716
+ Result2.andThenSync = andThenSync;
2717
+ async function andThen(fnFirst, ...fns) {
2718
+ let result = await fnFirst();
2719
+ const values = [];
2720
+ for (const fn of fns) {
2721
+ if (isErr(result)) {
2722
+ return result;
2723
+ }
2724
+ values.unshift(result.value);
2725
+ result = await fn(...values);
2726
+ }
2727
+ return result;
2728
+ }
2729
+ Result2.andThen = andThen;
2730
+ })(Result || (Result = {}));
2731
+ function Ok(value) {
2732
+ if (arguments.length === 0) {
2733
+ return {
2734
+ _tag: "Ok",
2735
+ value: void 0
2736
+ };
2737
+ }
2738
+ return {
2739
+ _tag: "Ok",
2740
+ value
2741
+ };
2742
+ }
2743
+ function Err(error) {
2744
+ return {
2745
+ _tag: "Err",
2746
+ error: new AppError(error)
2747
+ };
2748
+ }
2749
+ function ErrFromThrowable(error) {
2750
+ return {
2751
+ _tag: "Err",
2752
+ error
2753
+ };
2754
+ }
2755
+ function isErr(result) {
2756
+ return result._tag === "Err";
2757
+ }
2758
+ function fromThrowable(fn, errorType, errorInfo) {
2759
+ try {
2760
+ const result = fn();
2761
+ if (result && typeof result.then === "function") {
2762
+ return result.then((value) => Ok(value)).catch((err) => Err({
2763
+ ...errorInfo,
2764
+ type: errorType,
2765
+ cause: err
2766
+ }));
2767
+ }
2768
+ return Ok(result);
2769
+ } catch (err) {
2770
+ return Err({
2771
+ ...errorInfo,
2772
+ type: errorType,
2773
+ cause: err
2774
+ });
2775
+ }
2776
+ }
2777
+
2778
+ // ../common/dist/src/stdlib/json.util.js
2779
+ function safeJsonParse(json) {
2780
+ try {
2781
+ return Ok(JSON.parse(json));
2782
+ } catch (error) {
2783
+ console.warn("Failed to parse JSON", { error, json });
2784
+ return Err({ type: "invalid-json", cause: error, json });
2785
+ }
2786
+ }
2787
+
2788
+ // src/settings.ts
2789
+ import { z as z4 } from "zod";
2790
+ var cliSettingsSchema = z4.object({
2791
+ env: z4.object({
2792
+ baseUrl: z4.url().optional()
2793
+ }).default({})
2794
+ });
2795
+ function createEmptyCliSettings() {
2796
+ return {
2797
+ env: {}
2798
+ };
2799
+ }
2800
+ function hasCliSettingsOverrides(settings) {
2801
+ return settings.env.baseUrl !== void 0;
2802
+ }
2803
+ function resolveSettingsFilePath(stateFilePath) {
2804
+ return path2.join(path2.dirname(stateFilePath), CLI_SETTINGS_FILE_NAME);
2805
+ }
2806
+ function resolveConfiguredApiBaseUrl({
2807
+ defaultApiBaseUrl,
2808
+ settings
2809
+ }) {
2810
+ return settings.env.baseUrl ?? defaultApiBaseUrl;
2811
+ }
2812
+ function shouldUseStagingWorkosClientId(settings) {
2813
+ return settings.env.baseUrl !== void 0;
2814
+ }
2815
+ function createFileSettingsStore(stateFilePath) {
2816
+ const settingsFilePath = resolveSettingsFilePath(stateFilePath);
2817
+ return {
2818
+ async load() {
2819
+ const fileContents = await readFile(settingsFilePath, "utf8").catch(
2820
+ (error) => {
2821
+ if (error instanceof Error && "code" in error && error.code === "ENOENT") {
2822
+ return null;
2823
+ }
2824
+ throw new CliError("Failed to load CLI settings.", { cause: error });
2825
+ }
2826
+ );
2827
+ if (fileContents === null) {
2828
+ return createEmptyCliSettings();
2829
+ }
2830
+ const parsedJson = safeJsonParse(fileContents);
2831
+ if (isErr(parsedJson)) {
2832
+ throw new CliError("Stored CLI settings are invalid.", {
2833
+ cause: parsedJson.error.cause
2834
+ });
2835
+ }
2836
+ const parsed = cliSettingsSchema.safeParse(parsedJson.value);
2837
+ if (!parsed.success) {
2838
+ throw new CliError("Stored CLI settings are invalid.", {
2839
+ cause: parsed.error
2840
+ });
2841
+ }
2842
+ return parsed.data;
2843
+ },
2844
+ async save(settings) {
2845
+ if (!hasCliSettingsOverrides(settings)) {
2846
+ await rm(settingsFilePath, { force: true });
2847
+ return;
2848
+ }
2849
+ await mkdir(path2.dirname(settingsFilePath), { recursive: true });
2850
+ await writeFile(
2851
+ settingsFilePath,
2852
+ `${JSON.stringify(settings, null, 2)}
2853
+ `
2854
+ );
2855
+ }
2856
+ };
2857
+ }
2858
+
2859
+ // src/auth-login.ts
2860
+ function writeJsonOutput(io, value) {
2861
+ io.info(JSON.stringify(value, null, 2));
2862
+ }
2863
+ async function handleAuthLogin(dependencies, options) {
2864
+ const settings = await dependencies.settingsStore?.load() ?? createEmptyCliSettings();
2865
+ const clientId = shouldUseStagingWorkosClientId(settings) ? DEFAULT_STAGING_WORKOS_CLIENT_ID : requireWorkosClientId(dependencies.runtimeConfig);
2866
+ const deviceAuthorization = await dependencies.authClient.startDeviceAuthorization({ clientId });
2867
+ const verificationUrl = deviceAuthorization.verification_uri_complete ?? deviceAuthorization.verification_uri;
2868
+ const promptWriter = options.json ? dependencies.io.error : dependencies.io.info;
2869
+ promptWriter(
2870
+ formatAuthLoginPrompt({
2871
+ userCode: deviceAuthorization.user_code,
2872
+ verificationUrl
2873
+ })
2874
+ );
2875
+ await dependencies.openExternalUrl(verificationUrl).catch(() => {
2876
+ promptWriter(formatBrowserOpenFallback());
2877
+ });
2878
+ const tokenResponse = await dependencies.authClient.pollForDeviceTokens({
2879
+ clientId,
2880
+ deviceCode: deviceAuthorization.device_code,
2881
+ ...deviceAuthorization.expires_in ? { expiresInSeconds: deviceAuthorization.expires_in } : {},
2882
+ ...deviceAuthorization.interval ? { intervalSeconds: deviceAuthorization.interval } : {}
2883
+ });
2884
+ const accessTokenClaims = dependencies.authClient.decodeAccessTokenClaims(
2885
+ tokenResponse.access_token
2886
+ );
2887
+ const [user, organizations] = await Promise.all([
2888
+ dependencies.apiClient.fetchUser({
2889
+ accessToken: tokenResponse.access_token,
2890
+ userId: accessTokenClaims.sub
2891
+ }),
2892
+ dependencies.apiClient.fetchOrganizations({
2893
+ accessToken: tokenResponse.access_token
2894
+ })
2895
+ ]);
2896
+ const defaultOrgId = accessTokenClaims.org_id ?? organizations[0]?.id ?? null;
2897
+ const nextState = {
2898
+ account: {
2899
+ clientId,
2900
+ email: user.email,
2901
+ userId: user.id
2902
+ },
2903
+ defaultOrgId,
2904
+ lastUsedOrgId: defaultOrgId,
2905
+ organizations
2906
+ };
2907
+ await Promise.all([
2908
+ dependencies.refreshTokenStore.save(
2909
+ nextState.account,
2910
+ tokenResponse.refresh_token
2911
+ ),
2912
+ dependencies.stateStore.save(nextState)
2913
+ ]);
2914
+ const defaultOrganization = organizations.find((organization) => organization.id === defaultOrgId) ?? null;
2915
+ if (options.json) {
2916
+ writeJsonOutput(dependencies.io, nextState);
2917
+ return;
2918
+ }
2919
+ dependencies.io.info(
2920
+ formatAuthLoginSuccess({
2921
+ account: nextState.account,
2922
+ defaultOrganization,
2923
+ organizationCount: organizations.length
2924
+ })
2925
+ );
2926
+ }
2927
+
2928
+ // src/command-presentation.ts
2929
+ var rootOperationalGroupDescriptions = /* @__PURE__ */ new Map([
2930
+ ["agents", "Query agents."],
2931
+ ["agent-runs", "Query agent runs."],
2932
+ ["automations", "Manage automations."],
2933
+ ["automation-runs", "Inspect and control automation runs."],
2934
+ ["catalog", "Inspect available commands, models, and tools."],
2935
+ ["graphql", "Inspect GraphQL metadata."]
2936
+ ]);
2937
+ function configureCommandPresentation(command) {
2938
+ const originalCreateCommand = command.createCommand.bind(command);
2939
+ command.createCommand = (name) => configureCommandPresentation(originalCreateCommand(name));
2940
+ command.createHelp = () => new MagicalHelp();
2941
+ return command;
2942
+ }
2943
+ function createOperationHelpExamples(operationSpec) {
2944
+ const baseCommand = `mgcl ${operationSpec.cli.path.join(" ")}`;
2945
+ const requiredOptions = operationSpec.cli.options.filter((optionSpec) => optionSpec.required).map((optionSpec) => {
2946
+ if (optionSpec.valueType === "boolean") {
2947
+ return `--${optionSpec.flagName}`;
2948
+ }
2949
+ if (optionSpec.valueType === "number") {
2950
+ return `--${optionSpec.flagName} 10`;
2951
+ }
2952
+ if (optionSpec.valueType === "json") {
2953
+ return `--${optionSpec.flagName} '{...}'`;
2954
+ }
2955
+ if (optionSpec.valueType === "string-array") {
2956
+ return `--${optionSpec.flagName} value-a,value-b`;
2957
+ }
2958
+ return `--${optionSpec.flagName} <${optionSpec.flagName}>`;
2959
+ });
2960
+ const baseInvocation = [baseCommand, ...requiredOptions].join(" ");
2961
+ return [
2962
+ baseInvocation,
2963
+ `${baseInvocation} --org <org>`,
2964
+ `${baseInvocation} --json`
2965
+ ];
2966
+ }
2967
+
1522
2968
  // src/keychain.ts
1523
2969
  import keytar from "keytar";
1524
2970
  function buildKeychainAccountName(account) {
@@ -1574,7 +3020,7 @@ function resolveOpenCommand(url) {
1574
3020
  // src/self-update.ts
1575
3021
  import { spawn as spawn2 } from "child_process";
1576
3022
  import fs from "fs";
1577
- import path2 from "path";
3023
+ import path3 from "path";
1578
3024
  import { fileURLToPath } from "url";
1579
3025
  var CLI_PACKAGE_NAME = "@getmagical/cli";
1580
3026
  var DEFAULT_CLI_DIST_TAG2 = "latest";
@@ -1585,9 +3031,9 @@ function resolveInstalledPackageRoot({
1585
3031
  packageName
1586
3032
  }) {
1587
3033
  const packagePathSegments = packageName.split("/");
1588
- let currentPath = path2.dirname(entryFilePath);
3034
+ let currentPath = path3.dirname(entryFilePath);
1589
3035
  for (; ; ) {
1590
- const currentPathSegments = currentPath.split(path2.sep).filter(Boolean);
3036
+ const currentPathSegments = currentPath.split(path3.sep).filter(Boolean);
1591
3037
  const currentPackageSegments = currentPathSegments.slice(
1592
3038
  -packagePathSegments.length
1593
3039
  );
@@ -1596,7 +3042,7 @@ function resolveInstalledPackageRoot({
1596
3042
  )) {
1597
3043
  return currentPath;
1598
3044
  }
1599
- const parentPath = path2.dirname(currentPath);
3045
+ const parentPath = path3.dirname(currentPath);
1600
3046
  if (parentPath === currentPath) {
1601
3047
  return null;
1602
3048
  }
@@ -1606,14 +3052,14 @@ function resolveInstalledPackageRoot({
1606
3052
  function resolveInstallPrefixFromPackageRoot(packageRootPath) {
1607
3053
  let currentPath = packageRootPath;
1608
3054
  for (; ; ) {
1609
- if (path2.basename(currentPath) === "node_modules") {
1610
- const nodeModulesParentPath = path2.dirname(currentPath);
1611
- if (path2.basename(nodeModulesParentPath) === "lib") {
1612
- return path2.dirname(nodeModulesParentPath);
3055
+ if (path3.basename(currentPath) === "node_modules") {
3056
+ const nodeModulesParentPath = path3.dirname(currentPath);
3057
+ if (path3.basename(nodeModulesParentPath) === "lib") {
3058
+ return path3.dirname(nodeModulesParentPath);
1613
3059
  }
1614
3060
  return nodeModulesParentPath;
1615
3061
  }
1616
- const parentPath = path2.dirname(currentPath);
3062
+ const parentPath = path3.dirname(currentPath);
1617
3063
  if (parentPath === currentPath) {
1618
3064
  return null;
1619
3065
  }
@@ -1630,13 +3076,13 @@ function resolveManagedNpmCommand(installPrefix) {
1630
3076
  if (process.platform === "win32") {
1631
3077
  return null;
1632
3078
  }
1633
- const managedNodeExecutable = path2.join(
3079
+ const managedNodeExecutable = path3.join(
1634
3080
  installPrefix,
1635
3081
  MANAGED_NODE_SUBPATH,
1636
3082
  "bin",
1637
3083
  "node"
1638
3084
  );
1639
- const managedNpmCli = path2.join(
3085
+ const managedNpmCli = path3.join(
1640
3086
  installPrefix,
1641
3087
  MANAGED_NODE_SUBPATH,
1642
3088
  "lib",
@@ -1734,34 +3180,146 @@ async function selfUpdateInstalledCli({
1734
3180
  });
1735
3181
  }
1736
3182
 
3183
+ // ../common/dist/src/stdlib/url.utils.js
3184
+ function safeUrlConstructor(url) {
3185
+ try {
3186
+ return Ok(new URL(url));
3187
+ } catch {
3188
+ return Err({
3189
+ type: "invalid-url",
3190
+ message: `Invalid URL`,
3191
+ url
3192
+ });
3193
+ }
3194
+ }
3195
+
3196
+ // src/settings-command.ts
3197
+ import { Command, InvalidArgumentError, Option } from "commander";
3198
+ function writeJsonOutput2(io, value) {
3199
+ io.info(JSON.stringify(value, null, 2));
3200
+ }
3201
+ function requireSettingsStore(settingsStore) {
3202
+ if (!settingsStore) {
3203
+ throw new CliError("CLI settings are not configured for this instance.");
3204
+ }
3205
+ return settingsStore;
3206
+ }
3207
+ function parseBaseUrl(value) {
3208
+ const parsedUrl = safeUrlConstructor(value);
3209
+ if (isErr(parsedUrl)) {
3210
+ throw new InvalidArgumentError("Expected a valid URL for base-url.");
3211
+ }
3212
+ return parsedUrl.value.toString().replace(/\/$/u, "");
3213
+ }
3214
+ async function clearSavedAuth(dependencies) {
3215
+ const state = await dependencies.stateStore.load();
3216
+ if (!state) {
3217
+ return false;
3218
+ }
3219
+ await dependencies.refreshTokenStore.clear(state.account);
3220
+ await dependencies.stateStore.clear();
3221
+ return true;
3222
+ }
3223
+ async function handleSettingsEnvBaseUrl(dependencies, rawBaseUrl, options) {
3224
+ if (options.reset && rawBaseUrl) {
3225
+ throw new CliError("Pass either a base URL or --reset, not both.");
3226
+ }
3227
+ if (!options.reset && !rawBaseUrl) {
3228
+ throw new CliError("Provide a base URL or pass --reset.");
3229
+ }
3230
+ const settingsStore = requireSettingsStore(dependencies.settingsStore);
3231
+ const currentSettings = await settingsStore.load();
3232
+ const { baseUrl: _baseUrl, ...remainingEnvSettings } = currentSettings.env;
3233
+ if (options.reset) {
3234
+ const nextSettings2 = {
3235
+ ...currentSettings,
3236
+ env: remainingEnvSettings
3237
+ };
3238
+ await settingsStore.save(nextSettings2);
3239
+ const authCleared2 = await clearSavedAuth(dependencies);
3240
+ if (options.json) {
3241
+ writeJsonOutput2(dependencies.io, {
3242
+ authCleared: authCleared2,
3243
+ settings: nextSettings2
3244
+ });
3245
+ return;
3246
+ }
3247
+ dependencies.io.info(
3248
+ authCleared2 ? 'Cleared the persisted base-url override and removed saved auth. Run "mgcl auth login" again.' : "Cleared the persisted base-url override."
3249
+ );
3250
+ return;
3251
+ }
3252
+ const nextBaseUrl = parseBaseUrl(rawBaseUrl ?? "");
3253
+ const nextSettings = {
3254
+ ...currentSettings,
3255
+ env: {
3256
+ ...currentSettings.env,
3257
+ baseUrl: nextBaseUrl
3258
+ }
3259
+ };
3260
+ await settingsStore.save(nextSettings);
3261
+ const authCleared = await clearSavedAuth(dependencies);
3262
+ if (options.json) {
3263
+ writeJsonOutput2(dependencies.io, {
3264
+ authCleared,
3265
+ settings: nextSettings
3266
+ });
3267
+ return;
3268
+ }
3269
+ dependencies.io.info(
3270
+ authCleared ? `Saved base-url override ${nextBaseUrl} and removed saved auth. Run "mgcl auth login" again.` : `Saved base-url override ${nextBaseUrl}.`
3271
+ );
3272
+ }
3273
+ function createSettingsCommand(dependencies) {
3274
+ const settingsCommand = configureCommandPresentation(
3275
+ new Command("settings").description("Manage persisted CLI settings.")
3276
+ ).helpGroup("Workspace:").addHelpText(
3277
+ "after",
3278
+ `
3279
+ ${formatExamples("Examples", [
3280
+ "mgcl settings env base-url http://main.localhost:1355",
3281
+ "mgcl settings env base-url --reset"
3282
+ ])}`
3283
+ );
3284
+ const settingsEnvCommand = settingsCommand.command("env").description("Manage persisted environment overrides.");
3285
+ settingsEnvCommand.command("base-url [url]").description("Set or clear the persisted Magical API base URL override.").addOption(new Option("--reset", "Clear the persisted base URL override.")).action(async function(baseUrl) {
3286
+ await handleSettingsEnvBaseUrl(
3287
+ dependencies,
3288
+ baseUrl,
3289
+ this.optsWithGlobals()
3290
+ );
3291
+ });
3292
+ return settingsCommand;
3293
+ }
3294
+
1737
3295
  // src/state.ts
1738
- import { mkdir, readFile, rm, writeFile } from "fs/promises";
1739
- import path3 from "path";
1740
- import { z as z3 } from "zod";
1741
- var cliAccountSchema = z3.object({
1742
- clientId: z3.string().min(1),
1743
- email: z3.string().nullable(),
1744
- userId: z3.string().min(1)
3296
+ import { mkdir as mkdir2, readFile as readFile2, rm as rm2, writeFile as writeFile2 } from "fs/promises";
3297
+ import path4 from "path";
3298
+ import { z as z5 } from "zod";
3299
+ var cliAccountSchema = z5.object({
3300
+ clientId: z5.string().min(1),
3301
+ email: z5.string().nullable(),
3302
+ userId: z5.string().min(1)
1745
3303
  });
1746
- var cliOrganizationSchema = z3.object({
1747
- id: z3.string().min(1),
1748
- name: z3.string().min(1),
1749
- primaryDomain: z3.string().nullable().default(null)
3304
+ var cliOrganizationSchema = z5.object({
3305
+ id: z5.string().min(1),
3306
+ name: z5.string().min(1),
3307
+ primaryDomain: z5.string().nullable().default(null)
1750
3308
  });
1751
- var cliStateSchema = z3.object({
3309
+ var cliStateSchema = z5.object({
1752
3310
  account: cliAccountSchema,
1753
- defaultOrgId: z3.string().nullable(),
1754
- lastUsedOrgId: z3.string().nullable(),
1755
- organizations: z3.array(cliOrganizationSchema)
3311
+ defaultOrgId: z5.string().nullable(),
3312
+ lastUsedOrgId: z5.string().nullable(),
3313
+ organizations: z5.array(cliOrganizationSchema)
1756
3314
  });
1757
3315
  function createFileStateStore(stateFilePath) {
1758
3316
  return {
1759
3317
  async clear() {
1760
- await rm(stateFilePath, { force: true });
3318
+ await rm2(stateFilePath, { force: true });
1761
3319
  },
1762
3320
  async load() {
1763
3321
  try {
1764
- const fileContents = await readFile(stateFilePath, "utf8");
3322
+ const fileContents = await readFile2(stateFilePath, "utf8");
1765
3323
  const parsed = cliStateSchema.safeParse(JSON.parse(fileContents));
1766
3324
  if (!parsed.success) {
1767
3325
  throw new CliError("Stored CLI state is invalid.");
@@ -1778,43 +3336,43 @@ function createFileStateStore(stateFilePath) {
1778
3336
  }
1779
3337
  },
1780
3338
  async save(state) {
1781
- await mkdir(path3.dirname(stateFilePath), { recursive: true });
1782
- await writeFile(stateFilePath, `${JSON.stringify(state, null, 2)}
3339
+ await mkdir2(path4.dirname(stateFilePath), { recursive: true });
3340
+ await writeFile2(stateFilePath, `${JSON.stringify(state, null, 2)}
1783
3341
  `);
1784
3342
  }
1785
3343
  };
1786
3344
  }
1787
3345
 
1788
3346
  // src/workos-auth.ts
1789
- import { z as z4 } from "zod";
3347
+ import { z as z6 } from "zod";
1790
3348
  var DEFAULT_DEVICE_POLL_INTERVAL_SECONDS = 5;
1791
3349
  function buildFormHeaders() {
1792
3350
  const headers = new Headers();
1793
3351
  headers.set("content-type", "application/x-www-form-urlencoded");
1794
3352
  return headers;
1795
3353
  }
1796
- var deviceAuthorizationSchema = z4.object({
1797
- device_code: z4.string().min(1),
1798
- expires_in: z4.number().int().positive().optional(),
1799
- interval: z4.number().int().positive().optional(),
1800
- user_code: z4.string().min(1),
1801
- verification_uri: z4.url(),
1802
- verification_uri_complete: z4.url().optional()
1803
- });
1804
- var tokenResponseSchema = z4.object({
1805
- access_token: z4.string().min(1),
1806
- expires_in: z4.number().int().positive().optional(),
1807
- refresh_token: z4.string().min(1),
1808
- token_type: z4.string().optional()
1809
- });
1810
- var tokenErrorSchema = z4.object({
1811
- error: z4.string().min(1),
1812
- error_description: z4.string().optional()
1813
- });
1814
- var accessTokenClaimsSchema = z4.object({
1815
- org_id: z4.string().min(1).optional(),
1816
- sid: z4.string().min(1).optional(),
1817
- sub: z4.string().min(1)
3354
+ var deviceAuthorizationSchema = z6.object({
3355
+ device_code: z6.string().min(1),
3356
+ expires_in: z6.number().int().positive().optional(),
3357
+ interval: z6.number().int().positive().optional(),
3358
+ user_code: z6.string().min(1),
3359
+ verification_uri: z6.url(),
3360
+ verification_uri_complete: z6.url().optional()
3361
+ });
3362
+ var tokenResponseSchema = z6.object({
3363
+ access_token: z6.string().min(1),
3364
+ expires_in: z6.number().int().positive().optional(),
3365
+ refresh_token: z6.string().min(1),
3366
+ token_type: z6.string().optional()
3367
+ });
3368
+ var tokenErrorSchema = z6.object({
3369
+ error: z6.string().min(1),
3370
+ error_description: z6.string().optional()
3371
+ });
3372
+ var accessTokenClaimsSchema = z6.object({
3373
+ org_id: z6.string().min(1).optional(),
3374
+ sid: z6.string().min(1).optional(),
3375
+ sub: z6.string().min(1)
1818
3376
  });
1819
3377
  function createWorkosAuthClient({
1820
3378
  fetchFn = fetch,
@@ -1971,7 +3529,7 @@ function parseCommandOptionValue(rawValue, optionSpec) {
1971
3529
  case "number": {
1972
3530
  const parsedNumber = Number(rawValue);
1973
3531
  if (Number.isNaN(parsedNumber)) {
1974
- throw new InvalidArgumentError(
3532
+ throw new InvalidArgumentError2(
1975
3533
  `Expected a number for --${optionSpec.flagName}.`
1976
3534
  );
1977
3535
  }
@@ -1984,7 +3542,7 @@ function parseCommandOptionValue(rawValue, optionSpec) {
1984
3542
  try {
1985
3543
  return JSON.parse(rawValue);
1986
3544
  } catch {
1987
- throw new InvalidArgumentError(
3545
+ throw new InvalidArgumentError2(
1988
3546
  `Expected valid JSON for --${optionSpec.flagName}.`
1989
3547
  );
1990
3548
  }
@@ -2038,7 +3596,7 @@ function requireLoggedInState(state) {
2038
3596
  }
2039
3597
  return state;
2040
3598
  }
2041
- function writeJsonOutput(io, value) {
3599
+ function writeJsonOutput3(io, value) {
2042
3600
  io.info(JSON.stringify(value, null, 2));
2043
3601
  }
2044
3602
  function collectOperationVariables(operationSpec, options) {
@@ -2094,69 +3652,6 @@ async function withOrgScopedAccessToken({
2094
3652
  accessToken: tokenResponse.access_token
2095
3653
  };
2096
3654
  }
2097
- async function handleAuthLogin(dependencies, options) {
2098
- const clientId = requireWorkosClientId(dependencies.runtimeConfig);
2099
- const deviceAuthorization = await dependencies.authClient.startDeviceAuthorization({ clientId });
2100
- const verificationUrl = deviceAuthorization.verification_uri_complete ?? deviceAuthorization.verification_uri;
2101
- const promptWriter = options.json ? dependencies.io.error : dependencies.io.info;
2102
- promptWriter(
2103
- formatAuthLoginPrompt({
2104
- userCode: deviceAuthorization.user_code,
2105
- verificationUrl
2106
- })
2107
- );
2108
- await dependencies.openExternalUrl(verificationUrl).catch(() => {
2109
- promptWriter(formatBrowserOpenFallback());
2110
- });
2111
- const tokenResponse = await dependencies.authClient.pollForDeviceTokens({
2112
- clientId,
2113
- deviceCode: deviceAuthorization.device_code,
2114
- ...deviceAuthorization.expires_in ? { expiresInSeconds: deviceAuthorization.expires_in } : {},
2115
- ...deviceAuthorization.interval ? { intervalSeconds: deviceAuthorization.interval } : {}
2116
- });
2117
- const accessTokenClaims = dependencies.authClient.decodeAccessTokenClaims(
2118
- tokenResponse.access_token
2119
- );
2120
- const [user, organizations] = await Promise.all([
2121
- dependencies.apiClient.fetchUser({
2122
- accessToken: tokenResponse.access_token,
2123
- userId: accessTokenClaims.sub
2124
- }),
2125
- dependencies.apiClient.fetchOrganizations({
2126
- accessToken: tokenResponse.access_token
2127
- })
2128
- ]);
2129
- const defaultOrgId = accessTokenClaims.org_id ?? organizations[0]?.id ?? null;
2130
- const nextState = {
2131
- account: {
2132
- clientId,
2133
- email: user.email,
2134
- userId: user.id
2135
- },
2136
- defaultOrgId,
2137
- lastUsedOrgId: defaultOrgId,
2138
- organizations
2139
- };
2140
- await Promise.all([
2141
- dependencies.refreshTokenStore.save(
2142
- nextState.account,
2143
- tokenResponse.refresh_token
2144
- ),
2145
- dependencies.stateStore.save(nextState)
2146
- ]);
2147
- const defaultOrganization = organizations.find((organization) => organization.id === defaultOrgId) ?? null;
2148
- if (options.json) {
2149
- writeJsonOutput(dependencies.io, nextState);
2150
- return;
2151
- }
2152
- dependencies.io.info(
2153
- formatAuthLoginSuccess({
2154
- account: nextState.account,
2155
- defaultOrganization,
2156
- organizationCount: organizations.length
2157
- })
2158
- );
2159
- }
2160
3655
  async function handleAuthLogout(dependencies, options) {
2161
3656
  const state = await dependencies.stateStore.load();
2162
3657
  if (state) {
@@ -2164,7 +3659,7 @@ async function handleAuthLogout(dependencies, options) {
2164
3659
  }
2165
3660
  await dependencies.stateStore.clear();
2166
3661
  if (options.json) {
2167
- writeJsonOutput(dependencies.io, { loggedOut: true });
3662
+ writeJsonOutput3(dependencies.io, { loggedOut: true });
2168
3663
  return;
2169
3664
  }
2170
3665
  dependencies.io.info(formatLogoutSuccess());
@@ -2172,7 +3667,7 @@ async function handleAuthLogout(dependencies, options) {
2172
3667
  async function handleOrgList(dependencies, options) {
2173
3668
  const state = requireLoggedInState(await dependencies.stateStore.load());
2174
3669
  if (options.json) {
2175
- writeJsonOutput(dependencies.io, state.organizations);
3670
+ writeJsonOutput3(dependencies.io, state.organizations);
2176
3671
  return;
2177
3672
  }
2178
3673
  dependencies.io.info(
@@ -2196,7 +3691,7 @@ async function handleOrgUse(dependencies, organizationSelector, options) {
2196
3691
  };
2197
3692
  await dependencies.stateStore.save(nextState);
2198
3693
  if (options.json) {
2199
- writeJsonOutput(dependencies.io, {
3694
+ writeJsonOutput3(dependencies.io, {
2200
3695
  defaultOrgId: organization.id,
2201
3696
  organization
2202
3697
  });
@@ -2211,7 +3706,7 @@ async function handleSelfUpdate(dependencies, options) {
2211
3706
  }
2212
3707
  const updateResult = await selfUpdateCli();
2213
3708
  if (options.json) {
2214
- writeJsonOutput(dependencies.io, {
3709
+ writeJsonOutput3(dependencies.io, {
2215
3710
  installPrefix: updateResult.installPrefix,
2216
3711
  packageSpecifier: updateResult.packageSpecifier,
2217
3712
  registryUrl: updateResult.registryUrl,
@@ -2246,7 +3741,7 @@ async function handleOperationCommand(dependencies, operationSpec, commandOption
2246
3741
  lastUsedOrgId: organization.id
2247
3742
  });
2248
3743
  if (commandOptions.json) {
2249
- writeJsonOutput(dependencies.io, result);
3744
+ writeJsonOutput3(dependencies.io, result);
2250
3745
  return;
2251
3746
  }
2252
3747
  dependencies.io.info(formatHumanReadableOutput(result));
@@ -2294,7 +3789,7 @@ function addRegistryOperationCommand({
2294
3789
  }
2295
3790
  function configureOperationalCommand(command, dependencies, operationSpec) {
2296
3791
  command.description(operationSpec.cli.description).addOption(
2297
- new Option(
3792
+ new Option2(
2298
3793
  "--org <org>",
2299
3794
  "Organization ID or exact organization name to use."
2300
3795
  ).helpGroup("Shared options:")
@@ -2309,7 +3804,7 @@ ${formatExamples(
2309
3804
  for (const optionSpec of operationSpec.cli.options) {
2310
3805
  const optionFlags = optionSpec.valueType === "boolean" ? `--${optionSpec.flagName}` : `--${optionSpec.flagName} <value>`;
2311
3806
  const optionDescription = optionSpec.valueHint ? `${optionSpec.description} (${optionSpec.valueHint})` : optionSpec.description;
2312
- const nextOption = new Option(optionFlags, optionDescription).helpGroup(
3807
+ const nextOption = new Option2(optionFlags, optionDescription).helpGroup(
2313
3808
  operationSpec.kind === "query" ? "Query options:" : "Mutation options:"
2314
3809
  );
2315
3810
  if (optionSpec.valueType === "boolean") {
@@ -2347,13 +3842,17 @@ function createConsoleIo() {
2347
3842
  }
2348
3843
  function createDefaultDependencies() {
2349
3844
  const runtimeConfig = getRuntimeConfig();
3845
+ const settingsStore = createFileSettingsStore(runtimeConfig.stateFilePath);
2350
3846
  const selfUpdateOptions = {
2351
3847
  ...runtimeConfig.cliDistTag ? { distTag: runtimeConfig.cliDistTag } : {},
2352
3848
  ...runtimeConfig.npmRegistryUrl ? { registryUrl: runtimeConfig.npmRegistryUrl } : {}
2353
3849
  };
2354
3850
  return {
2355
3851
  apiClient: createMagicalApiClient({
2356
- apiBaseUrl: runtimeConfig.magicalApiUrl
3852
+ apiBaseUrl: async () => resolveConfiguredApiBaseUrl({
3853
+ defaultApiBaseUrl: runtimeConfig.magicalApiUrl,
3854
+ settings: await settingsStore.load()
3855
+ })
2357
3856
  }),
2358
3857
  authClient: createWorkosAuthClient({
2359
3858
  workosApiUrl: runtimeConfig.workosApiUrl
@@ -2364,15 +3863,16 @@ function createDefaultDependencies() {
2364
3863
  runtimeConfig.keychainServiceName
2365
3864
  ),
2366
3865
  runtimeConfig,
3866
+ settingsStore,
2367
3867
  selfUpdateCli: async () => selfUpdateInstalledCli(selfUpdateOptions),
2368
3868
  stateStore: createFileStateStore(runtimeConfig.stateFilePath)
2369
3869
  };
2370
3870
  }
2371
3871
  function buildProgram(dependencies) {
2372
3872
  const program2 = configureCommandPresentation(
2373
- new Command().name("mgcl").description("Run Magical operations from the command line.")
2374
- ).addOption(new Option("--json", "Render JSON output.")).addOption(
2375
- new Option(
3873
+ new Command2().name("mgcl").description("Run Magical operations from the command line.")
3874
+ ).addOption(new Option2("--json", "Render JSON output.")).addOption(
3875
+ new Option2(
2376
3876
  "--update",
2377
3877
  "Update mgcl to the latest published npm release."
2378
3878
  )
@@ -2398,14 +3898,11 @@ ${formatOutputModesNote()}`
2398
3898
  this.outputHelp();
2399
3899
  });
2400
3900
  const authCommand = configureCommandPresentation(
2401
- new Command("auth").description("Manage CLI authentication.")
3901
+ new Command2("auth").description("Manage CLI authentication.")
2402
3902
  ).helpGroup("Workspace:").addHelpText(
2403
3903
  "after",
2404
3904
  `
2405
- ${formatExamples("Examples", [
2406
- "mgcl auth login",
2407
- "mgcl auth logout"
2408
- ])}`
3905
+ ${formatExamples("Examples", ["mgcl auth login", "mgcl auth logout"])}`
2409
3906
  );
2410
3907
  authCommand.command("login").description("Authenticate with Magical and load organization memberships.").action(async function() {
2411
3908
  await handleAuthLogin(dependencies, this.optsWithGlobals());
@@ -2414,8 +3911,9 @@ ${formatExamples("Examples", [
2414
3911
  await handleAuthLogout(dependencies, this.optsWithGlobals());
2415
3912
  });
2416
3913
  program2.addCommand(authCommand);
3914
+ program2.addCommand(createSettingsCommand(dependencies));
2417
3915
  const orgCommand = configureCommandPresentation(
2418
- new Command("org").description("Manage organization selection.")
3916
+ new Command2("org").description("Manage organization selection.")
2419
3917
  ).helpGroup("Workspace:").addHelpText(
2420
3918
  "after",
2421
3919
  `
@@ -2436,7 +3934,7 @@ ${formatExamples("Examples", [
2436
3934
  });
2437
3935
  program2.addCommand(orgCommand);
2438
3936
  const updateCommand = configureCommandPresentation(
2439
- new Command("update").description(
3937
+ new Command2("update").description(
2440
3938
  "Update mgcl to the latest published npm release."
2441
3939
  )
2442
3940
  ).helpGroup("Workspace:").addHelpText(