@knocklabs/cli 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -45
- package/dist/commands/branch/exit.js +44 -0
- package/dist/commands/branch/switch.js +161 -0
- package/dist/lib/helpers/branch.js +124 -0
- package/dist/lib/helpers/error.js +5 -0
- package/dist/lib/helpers/flag.js +6 -1
- package/dist/lib/helpers/git.js +25 -0
- package/dist/lib/helpers/request.js +1 -1
- package/dist/lib/marshal/translation/helpers.js +1 -1
- package/oclif.manifest.json +99 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ $ npm install -g @knocklabs/cli
|
|
|
16
16
|
$ knock COMMAND
|
|
17
17
|
running command...
|
|
18
18
|
$ knock (--version)
|
|
19
|
-
@knocklabs/cli/0.2.
|
|
19
|
+
@knocklabs/cli/0.2.3 linux-x64 node-v18.20.8
|
|
20
20
|
$ knock --help [COMMAND]
|
|
21
21
|
USAGE
|
|
22
22
|
$ knock COMMAND
|
|
@@ -90,7 +90,7 @@ FLAGS
|
|
|
90
90
|
--service-token=<value> The service token to authenticate with.
|
|
91
91
|
```
|
|
92
92
|
|
|
93
|
-
_See code: [src/commands/commit/index.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
93
|
+
_See code: [src/commands/commit/index.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/commit/index.ts)_
|
|
94
94
|
|
|
95
95
|
## `knock commit get ID`
|
|
96
96
|
|
|
@@ -107,7 +107,7 @@ GLOBAL FLAGS
|
|
|
107
107
|
--json Format output as json.
|
|
108
108
|
```
|
|
109
109
|
|
|
110
|
-
_See code: [src/commands/commit/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
110
|
+
_See code: [src/commands/commit/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/commit/get.ts)_
|
|
111
111
|
|
|
112
112
|
## `knock commit list`
|
|
113
113
|
|
|
@@ -137,7 +137,7 @@ GLOBAL FLAGS
|
|
|
137
137
|
--json Format output as json.
|
|
138
138
|
```
|
|
139
139
|
|
|
140
|
-
_See code: [src/commands/commit/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
140
|
+
_See code: [src/commands/commit/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/commit/list.ts)_
|
|
141
141
|
|
|
142
142
|
## `knock commit promote`
|
|
143
143
|
|
|
@@ -154,7 +154,7 @@ FLAGS
|
|
|
154
154
|
--to=<value> The destination environment to promote all changes from the preceding environment.
|
|
155
155
|
```
|
|
156
156
|
|
|
157
|
-
_See code: [src/commands/commit/promote.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
157
|
+
_See code: [src/commands/commit/promote.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/commit/promote.ts)_
|
|
158
158
|
|
|
159
159
|
## `knock guide activate GUIDEKEY`
|
|
160
160
|
|
|
@@ -184,7 +184,7 @@ DESCRIPTION
|
|
|
184
184
|
or deactivated at a later time using the --from and --until flags.
|
|
185
185
|
```
|
|
186
186
|
|
|
187
|
-
_See code: [src/commands/guide/activate.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
187
|
+
_See code: [src/commands/guide/activate.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/guide/activate.ts)_
|
|
188
188
|
|
|
189
189
|
## `knock guide generate-types`
|
|
190
190
|
|
|
@@ -205,7 +205,7 @@ DESCRIPTION
|
|
|
205
205
|
Generate types for all guides in an environment and write them to a file.
|
|
206
206
|
```
|
|
207
207
|
|
|
208
|
-
_See code: [src/commands/guide/generate-types.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
208
|
+
_See code: [src/commands/guide/generate-types.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/guide/generate-types.ts)_
|
|
209
209
|
|
|
210
210
|
## `knock guide get GUIDEKEY`
|
|
211
211
|
|
|
@@ -225,7 +225,7 @@ GLOBAL FLAGS
|
|
|
225
225
|
--json Format output as json.
|
|
226
226
|
```
|
|
227
227
|
|
|
228
|
-
_See code: [src/commands/guide/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
228
|
+
_See code: [src/commands/guide/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/guide/get.ts)_
|
|
229
229
|
|
|
230
230
|
## `knock guide list`
|
|
231
231
|
|
|
@@ -248,7 +248,7 @@ GLOBAL FLAGS
|
|
|
248
248
|
--json Format output as json.
|
|
249
249
|
```
|
|
250
250
|
|
|
251
|
-
_See code: [src/commands/guide/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
251
|
+
_See code: [src/commands/guide/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/guide/list.ts)_
|
|
252
252
|
|
|
253
253
|
## `knock guide pull [GUIDEKEY]`
|
|
254
254
|
|
|
@@ -268,7 +268,7 @@ FLAGS
|
|
|
268
268
|
--service-token=<value> The service token to authenticate with.
|
|
269
269
|
```
|
|
270
270
|
|
|
271
|
-
_See code: [src/commands/guide/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
271
|
+
_See code: [src/commands/guide/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/guide/pull.ts)_
|
|
272
272
|
|
|
273
273
|
## `knock guide push [GUIDEKEY]`
|
|
274
274
|
|
|
@@ -289,7 +289,7 @@ FLAGS
|
|
|
289
289
|
--service-token=<value> The service token to authenticate with.
|
|
290
290
|
```
|
|
291
291
|
|
|
292
|
-
_See code: [src/commands/guide/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
292
|
+
_See code: [src/commands/guide/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/guide/push.ts)_
|
|
293
293
|
|
|
294
294
|
## `knock guide validate [GUIDEKEY]`
|
|
295
295
|
|
|
@@ -308,7 +308,7 @@ FLAGS
|
|
|
308
308
|
--service-token=<value> The service token to authenticate with.
|
|
309
309
|
```
|
|
310
310
|
|
|
311
|
-
_See code: [src/commands/guide/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
311
|
+
_See code: [src/commands/guide/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/guide/validate.ts)_
|
|
312
312
|
|
|
313
313
|
## `knock help [COMMAND]`
|
|
314
314
|
|
|
@@ -348,7 +348,7 @@ GLOBAL FLAGS
|
|
|
348
348
|
--json Format output as json.
|
|
349
349
|
```
|
|
350
350
|
|
|
351
|
-
_See code: [src/commands/layout/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
351
|
+
_See code: [src/commands/layout/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/layout/get.ts)_
|
|
352
352
|
|
|
353
353
|
## `knock layout list`
|
|
354
354
|
|
|
@@ -371,7 +371,7 @@ GLOBAL FLAGS
|
|
|
371
371
|
--json Format output as json.
|
|
372
372
|
```
|
|
373
373
|
|
|
374
|
-
_See code: [src/commands/layout/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
374
|
+
_See code: [src/commands/layout/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/layout/list.ts)_
|
|
375
375
|
|
|
376
376
|
## `knock layout pull [EMAILLAYOUTKEY]`
|
|
377
377
|
|
|
@@ -391,7 +391,7 @@ FLAGS
|
|
|
391
391
|
--service-token=<value> The service token to authenticate with.
|
|
392
392
|
```
|
|
393
393
|
|
|
394
|
-
_See code: [src/commands/layout/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
394
|
+
_See code: [src/commands/layout/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/layout/pull.ts)_
|
|
395
395
|
|
|
396
396
|
## `knock layout push [EMAILLAYOUTKEY]`
|
|
397
397
|
|
|
@@ -413,7 +413,7 @@ FLAGS
|
|
|
413
413
|
--service-token=<value> The service token to authenticate with.
|
|
414
414
|
```
|
|
415
415
|
|
|
416
|
-
_See code: [src/commands/layout/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
416
|
+
_See code: [src/commands/layout/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/layout/push.ts)_
|
|
417
417
|
|
|
418
418
|
## `knock layout validate [EMAILLAYOUTKEY]`
|
|
419
419
|
|
|
@@ -432,7 +432,7 @@ FLAGS
|
|
|
432
432
|
--service-token=<value> The service token to authenticate with.
|
|
433
433
|
```
|
|
434
434
|
|
|
435
|
-
_See code: [src/commands/layout/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
435
|
+
_See code: [src/commands/layout/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/layout/validate.ts)_
|
|
436
436
|
|
|
437
437
|
## `knock login`
|
|
438
438
|
|
|
@@ -446,7 +446,7 @@ FLAGS
|
|
|
446
446
|
--service-token=<value> The service token to authenticate with.
|
|
447
447
|
```
|
|
448
448
|
|
|
449
|
-
_See code: [src/commands/login.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
449
|
+
_See code: [src/commands/login.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/login.ts)_
|
|
450
450
|
|
|
451
451
|
## `knock logout`
|
|
452
452
|
|
|
@@ -460,7 +460,7 @@ FLAGS
|
|
|
460
460
|
--service-token=<value> The service token to authenticate with.
|
|
461
461
|
```
|
|
462
462
|
|
|
463
|
-
_See code: [src/commands/logout.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
463
|
+
_See code: [src/commands/logout.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/logout.ts)_
|
|
464
464
|
|
|
465
465
|
## `knock message-type get MESSAGETYPEKEY`
|
|
466
466
|
|
|
@@ -480,7 +480,7 @@ GLOBAL FLAGS
|
|
|
480
480
|
--json Format output as json.
|
|
481
481
|
```
|
|
482
482
|
|
|
483
|
-
_See code: [src/commands/message-type/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
483
|
+
_See code: [src/commands/message-type/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/message-type/get.ts)_
|
|
484
484
|
|
|
485
485
|
## `knock message-type list`
|
|
486
486
|
|
|
@@ -503,7 +503,7 @@ GLOBAL FLAGS
|
|
|
503
503
|
--json Format output as json.
|
|
504
504
|
```
|
|
505
505
|
|
|
506
|
-
_See code: [src/commands/message-type/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
506
|
+
_See code: [src/commands/message-type/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/message-type/list.ts)_
|
|
507
507
|
|
|
508
508
|
## `knock message-type pull [MESSAGETYPEKEY]`
|
|
509
509
|
|
|
@@ -523,7 +523,7 @@ FLAGS
|
|
|
523
523
|
--service-token=<value> The service token to authenticate with.
|
|
524
524
|
```
|
|
525
525
|
|
|
526
|
-
_See code: [src/commands/message-type/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
526
|
+
_See code: [src/commands/message-type/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/message-type/pull.ts)_
|
|
527
527
|
|
|
528
528
|
## `knock message-type push [MESSAGETYPEKEY]`
|
|
529
529
|
|
|
@@ -545,7 +545,7 @@ FLAGS
|
|
|
545
545
|
--service-token=<value> The service token to authenticate with.
|
|
546
546
|
```
|
|
547
547
|
|
|
548
|
-
_See code: [src/commands/message-type/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
548
|
+
_See code: [src/commands/message-type/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/message-type/push.ts)_
|
|
549
549
|
|
|
550
550
|
## `knock message-type validate [MESSAGETYPEKEY]`
|
|
551
551
|
|
|
@@ -565,7 +565,7 @@ FLAGS
|
|
|
565
565
|
--service-token=<value> The service token to authenticate with.
|
|
566
566
|
```
|
|
567
567
|
|
|
568
|
-
_See code: [src/commands/message-type/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
568
|
+
_See code: [src/commands/message-type/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/message-type/validate.ts)_
|
|
569
569
|
|
|
570
570
|
## `knock partial get PARTIALKEY`
|
|
571
571
|
|
|
@@ -585,7 +585,7 @@ GLOBAL FLAGS
|
|
|
585
585
|
--json Format output as json.
|
|
586
586
|
```
|
|
587
587
|
|
|
588
|
-
_See code: [src/commands/partial/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
588
|
+
_See code: [src/commands/partial/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/partial/get.ts)_
|
|
589
589
|
|
|
590
590
|
## `knock partial list`
|
|
591
591
|
|
|
@@ -608,7 +608,7 @@ GLOBAL FLAGS
|
|
|
608
608
|
--json Format output as json.
|
|
609
609
|
```
|
|
610
610
|
|
|
611
|
-
_See code: [src/commands/partial/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
611
|
+
_See code: [src/commands/partial/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/partial/list.ts)_
|
|
612
612
|
|
|
613
613
|
## `knock partial pull [PARTIALKEY]`
|
|
614
614
|
|
|
@@ -628,7 +628,7 @@ FLAGS
|
|
|
628
628
|
--service-token=<value> The service token to authenticate with.
|
|
629
629
|
```
|
|
630
630
|
|
|
631
|
-
_See code: [src/commands/partial/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
631
|
+
_See code: [src/commands/partial/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/partial/pull.ts)_
|
|
632
632
|
|
|
633
633
|
## `knock partial push [PARTIALKEY]`
|
|
634
634
|
|
|
@@ -649,7 +649,7 @@ FLAGS
|
|
|
649
649
|
--service-token=<value> The service token to authenticate with.
|
|
650
650
|
```
|
|
651
651
|
|
|
652
|
-
_See code: [src/commands/partial/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
652
|
+
_See code: [src/commands/partial/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/partial/push.ts)_
|
|
653
653
|
|
|
654
654
|
## `knock partial validate [PARTIALKEY]`
|
|
655
655
|
|
|
@@ -668,7 +668,7 @@ FLAGS
|
|
|
668
668
|
--service-token=<value> The service token to authenticate with.
|
|
669
669
|
```
|
|
670
670
|
|
|
671
|
-
_See code: [src/commands/partial/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
671
|
+
_See code: [src/commands/partial/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/partial/validate.ts)_
|
|
672
672
|
|
|
673
673
|
## `knock pull`
|
|
674
674
|
|
|
@@ -687,7 +687,7 @@ FLAGS
|
|
|
687
687
|
--service-token=<value> The service token to authenticate with.
|
|
688
688
|
```
|
|
689
689
|
|
|
690
|
-
_See code: [src/commands/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
690
|
+
_See code: [src/commands/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/pull.ts)_
|
|
691
691
|
|
|
692
692
|
## `knock push`
|
|
693
693
|
|
|
@@ -707,7 +707,7 @@ FLAGS
|
|
|
707
707
|
--service-token=<value> The service token to authenticate with.
|
|
708
708
|
```
|
|
709
709
|
|
|
710
|
-
_See code: [src/commands/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
710
|
+
_See code: [src/commands/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/push.ts)_
|
|
711
711
|
|
|
712
712
|
## `knock translation get TRANSLATIONREF`
|
|
713
713
|
|
|
@@ -734,7 +734,7 @@ GLOBAL FLAGS
|
|
|
734
734
|
--json Format output as json.
|
|
735
735
|
```
|
|
736
736
|
|
|
737
|
-
_See code: [src/commands/translation/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
737
|
+
_See code: [src/commands/translation/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/translation/get.ts)_
|
|
738
738
|
|
|
739
739
|
## `knock translation list`
|
|
740
740
|
|
|
@@ -757,7 +757,7 @@ GLOBAL FLAGS
|
|
|
757
757
|
--json Format output as json.
|
|
758
758
|
```
|
|
759
759
|
|
|
760
|
-
_See code: [src/commands/translation/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
760
|
+
_See code: [src/commands/translation/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/translation/list.ts)_
|
|
761
761
|
|
|
762
762
|
## `knock translation pull [TRANSLATIONREF]`
|
|
763
763
|
|
|
@@ -784,7 +784,7 @@ FLAGS
|
|
|
784
784
|
--translations-dir=<value> The target directory path to pull all translations into.
|
|
785
785
|
```
|
|
786
786
|
|
|
787
|
-
_See code: [src/commands/translation/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
787
|
+
_See code: [src/commands/translation/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/translation/pull.ts)_
|
|
788
788
|
|
|
789
789
|
## `knock translation push [TRANSLATIONREF]`
|
|
790
790
|
|
|
@@ -811,7 +811,7 @@ FLAGS
|
|
|
811
811
|
--translations-dir=<value> The target directory path to find all translations to push.
|
|
812
812
|
```
|
|
813
813
|
|
|
814
|
-
_See code: [src/commands/translation/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
814
|
+
_See code: [src/commands/translation/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/translation/push.ts)_
|
|
815
815
|
|
|
816
816
|
## `knock translation validate [TRANSLATIONREF]`
|
|
817
817
|
|
|
@@ -836,7 +836,7 @@ FLAGS
|
|
|
836
836
|
--translations-dir=<value> The target directory path to find all translations to validate.
|
|
837
837
|
```
|
|
838
838
|
|
|
839
|
-
_See code: [src/commands/translation/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
839
|
+
_See code: [src/commands/translation/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/translation/validate.ts)_
|
|
840
840
|
|
|
841
841
|
## `knock whoami`
|
|
842
842
|
|
|
@@ -853,7 +853,7 @@ GLOBAL FLAGS
|
|
|
853
853
|
--json Format output as json.
|
|
854
854
|
```
|
|
855
855
|
|
|
856
|
-
_See code: [src/commands/whoami.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
856
|
+
_See code: [src/commands/whoami.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/whoami.ts)_
|
|
857
857
|
|
|
858
858
|
## `knock workflow activate WORKFLOWKEY`
|
|
859
859
|
|
|
@@ -880,7 +880,7 @@ DESCRIPTION
|
|
|
880
880
|
with `false` in order to deactivate it.
|
|
881
881
|
```
|
|
882
882
|
|
|
883
|
-
_See code: [src/commands/workflow/activate.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
883
|
+
_See code: [src/commands/workflow/activate.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/workflow/activate.ts)_
|
|
884
884
|
|
|
885
885
|
## `knock workflow generate-types`
|
|
886
886
|
|
|
@@ -901,7 +901,7 @@ DESCRIPTION
|
|
|
901
901
|
Generate types for all workflows in an environment and write them to a file.
|
|
902
902
|
```
|
|
903
903
|
|
|
904
|
-
_See code: [src/commands/workflow/generate-types.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
904
|
+
_See code: [src/commands/workflow/generate-types.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/workflow/generate-types.ts)_
|
|
905
905
|
|
|
906
906
|
## `knock workflow get WORKFLOWKEY`
|
|
907
907
|
|
|
@@ -921,7 +921,7 @@ GLOBAL FLAGS
|
|
|
921
921
|
--json Format output as json.
|
|
922
922
|
```
|
|
923
923
|
|
|
924
|
-
_See code: [src/commands/workflow/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
924
|
+
_See code: [src/commands/workflow/get.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/workflow/get.ts)_
|
|
925
925
|
|
|
926
926
|
## `knock workflow list`
|
|
927
927
|
|
|
@@ -944,7 +944,7 @@ GLOBAL FLAGS
|
|
|
944
944
|
--json Format output as json.
|
|
945
945
|
```
|
|
946
946
|
|
|
947
|
-
_See code: [src/commands/workflow/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
947
|
+
_See code: [src/commands/workflow/list.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/workflow/list.ts)_
|
|
948
948
|
|
|
949
949
|
## `knock workflow pull [WORKFLOWKEY]`
|
|
950
950
|
|
|
@@ -964,7 +964,7 @@ FLAGS
|
|
|
964
964
|
--workflows-dir=<value> The target directory path to pull all workflows into.
|
|
965
965
|
```
|
|
966
966
|
|
|
967
|
-
_See code: [src/commands/workflow/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
967
|
+
_See code: [src/commands/workflow/pull.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/workflow/pull.ts)_
|
|
968
968
|
|
|
969
969
|
## `knock workflow push [WORKFLOWKEY]`
|
|
970
970
|
|
|
@@ -985,7 +985,7 @@ FLAGS
|
|
|
985
985
|
--workflows-dir=<value> The target directory path to find all workflows to push.
|
|
986
986
|
```
|
|
987
987
|
|
|
988
|
-
_See code: [src/commands/workflow/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
988
|
+
_See code: [src/commands/workflow/push.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/workflow/push.ts)_
|
|
989
989
|
|
|
990
990
|
## `knock workflow run WORKFLOWKEY`
|
|
991
991
|
|
|
@@ -1006,7 +1006,7 @@ FLAGS
|
|
|
1006
1006
|
--tenant=<value> A tenant id for the workflow run.
|
|
1007
1007
|
```
|
|
1008
1008
|
|
|
1009
|
-
_See code: [src/commands/workflow/run.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
1009
|
+
_See code: [src/commands/workflow/run.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/workflow/run.ts)_
|
|
1010
1010
|
|
|
1011
1011
|
## `knock workflow validate [WORKFLOWKEY]`
|
|
1012
1012
|
|
|
@@ -1025,5 +1025,5 @@ FLAGS
|
|
|
1025
1025
|
--workflows-dir=<value> The target directory path to find all workflows to validate.
|
|
1026
1026
|
```
|
|
1027
1027
|
|
|
1028
|
-
_See code: [src/commands/workflow/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.
|
|
1028
|
+
_See code: [src/commands/workflow/validate.ts](https://github.com/knocklabs/knock-cli/blob/v0.2.3/src/commands/workflow/validate.ts)_
|
|
1029
1029
|
<!-- commandsstop -->
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return BranchExit;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _findup = /*#__PURE__*/ _interop_require_default(require("find-up"));
|
|
12
|
+
const _basecommand = /*#__PURE__*/ _interop_require_default(require("../../lib/base-command"));
|
|
13
|
+
const _branch = require("../../lib/helpers/branch");
|
|
14
|
+
function _define_property(obj, key, value) {
|
|
15
|
+
if (key in obj) {
|
|
16
|
+
Object.defineProperty(obj, key, {
|
|
17
|
+
value: value,
|
|
18
|
+
enumerable: true,
|
|
19
|
+
configurable: true,
|
|
20
|
+
writable: true
|
|
21
|
+
});
|
|
22
|
+
} else {
|
|
23
|
+
obj[key] = value;
|
|
24
|
+
}
|
|
25
|
+
return obj;
|
|
26
|
+
}
|
|
27
|
+
function _interop_require_default(obj) {
|
|
28
|
+
return obj && obj.__esModule ? obj : {
|
|
29
|
+
default: obj
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
class BranchExit extends _basecommand.default {
|
|
33
|
+
async run() {
|
|
34
|
+
const branchFilePath = await (0, _findup.default)(_branch.BRANCH_FILE_NAME);
|
|
35
|
+
if (!branchFilePath) {
|
|
36
|
+
throw new Error(`No ${_branch.BRANCH_FILE_NAME} file found. Run \`knock branch switch\` to start working on a branch.`);
|
|
37
|
+
}
|
|
38
|
+
await (0, _branch.clearBranchFile)(branchFilePath);
|
|
39
|
+
this.log("‣ Successfully exited the branch");
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
// Hide until branches are released in GA
|
|
43
|
+
_define_property(BranchExit, "hidden", true);
|
|
44
|
+
_define_property(BranchExit, "summary", "Exits the current branch.");
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return BranchSwitch;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _nodepath = /*#__PURE__*/ _interop_require_wildcard(require("node:path"));
|
|
12
|
+
const _core = require("@oclif/core");
|
|
13
|
+
const _findup = /*#__PURE__*/ _interop_require_default(require("find-up"));
|
|
14
|
+
const _fsextra = /*#__PURE__*/ _interop_require_wildcard(require("fs-extra"));
|
|
15
|
+
const _basecommand = /*#__PURE__*/ _interop_require_default(require("../../lib/base-command"));
|
|
16
|
+
const _arg = require("../../lib/helpers/arg");
|
|
17
|
+
const _branch = require("../../lib/helpers/branch");
|
|
18
|
+
const _error = require("../../lib/helpers/error");
|
|
19
|
+
const _git = require("../../lib/helpers/git");
|
|
20
|
+
const _request = require("../../lib/helpers/request");
|
|
21
|
+
const _ux = require("../../lib/helpers/ux");
|
|
22
|
+
function _define_property(obj, key, value) {
|
|
23
|
+
if (key in obj) {
|
|
24
|
+
Object.defineProperty(obj, key, {
|
|
25
|
+
value: value,
|
|
26
|
+
enumerable: true,
|
|
27
|
+
configurable: true,
|
|
28
|
+
writable: true
|
|
29
|
+
});
|
|
30
|
+
} else {
|
|
31
|
+
obj[key] = value;
|
|
32
|
+
}
|
|
33
|
+
return obj;
|
|
34
|
+
}
|
|
35
|
+
function _interop_require_default(obj) {
|
|
36
|
+
return obj && obj.__esModule ? obj : {
|
|
37
|
+
default: obj
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
41
|
+
if (typeof WeakMap !== "function") return null;
|
|
42
|
+
var cacheBabelInterop = new WeakMap();
|
|
43
|
+
var cacheNodeInterop = new WeakMap();
|
|
44
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
45
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
46
|
+
})(nodeInterop);
|
|
47
|
+
}
|
|
48
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
49
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
50
|
+
return obj;
|
|
51
|
+
}
|
|
52
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
53
|
+
return {
|
|
54
|
+
default: obj
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
58
|
+
if (cache && cache.has(obj)) {
|
|
59
|
+
return cache.get(obj);
|
|
60
|
+
}
|
|
61
|
+
var newObj = {
|
|
62
|
+
__proto__: null
|
|
63
|
+
};
|
|
64
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
65
|
+
for(var key in obj){
|
|
66
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
67
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
68
|
+
if (desc && (desc.get || desc.set)) {
|
|
69
|
+
Object.defineProperty(newObj, key, desc);
|
|
70
|
+
} else {
|
|
71
|
+
newObj[key] = obj[key];
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
newObj.default = obj;
|
|
76
|
+
if (cache) {
|
|
77
|
+
cache.set(obj, newObj);
|
|
78
|
+
}
|
|
79
|
+
return newObj;
|
|
80
|
+
}
|
|
81
|
+
class BranchSwitch extends _basecommand.default {
|
|
82
|
+
async run() {
|
|
83
|
+
const { args } = this.props;
|
|
84
|
+
const currDir = process.cwd();
|
|
85
|
+
let branchFilePath = await (0, _findup.default)(_branch.BRANCH_FILE_NAME, {
|
|
86
|
+
cwd: currDir
|
|
87
|
+
});
|
|
88
|
+
if (!branchFilePath) {
|
|
89
|
+
const projectRoot = await (0, _branch.findProjectRoot)();
|
|
90
|
+
branchFilePath = await this.promptToCreateBranchFile(projectRoot);
|
|
91
|
+
// User declined to create the branch file
|
|
92
|
+
if (!branchFilePath) return;
|
|
93
|
+
const isBranchFileIgnoredByGit = await (0, _git.isFileIgnoredByGit)(projectRoot, branchFilePath);
|
|
94
|
+
if (!isBranchFileIgnoredByGit) {
|
|
95
|
+
await this.promptToUpdateGitIgnoreFile(projectRoot);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
await this.switchToBranch(branchFilePath, args.slug);
|
|
99
|
+
}
|
|
100
|
+
async promptToCreateBranchFile(projectRoot) {
|
|
101
|
+
const { flags } = this.props;
|
|
102
|
+
const prompt = `Create \`${_branch.BRANCH_FILE_NAME}\` at ${projectRoot}?`;
|
|
103
|
+
const input = flags.force || await (0, _ux.promptToConfirm)(prompt);
|
|
104
|
+
if (!input) return undefined;
|
|
105
|
+
return _nodepath.resolve(projectRoot, _branch.BRANCH_FILE_NAME);
|
|
106
|
+
}
|
|
107
|
+
async promptToUpdateGitIgnoreFile(projectRoot) {
|
|
108
|
+
const { flags } = this.props;
|
|
109
|
+
const gitIgnoreFilePath = _nodepath.resolve(projectRoot, ".gitignore");
|
|
110
|
+
const gitIgnoreFileExists = await _fsextra.exists(gitIgnoreFilePath);
|
|
111
|
+
const prompt = gitIgnoreFileExists ? `Update \`${gitIgnoreFilePath}\` to ignore \`${_branch.BRANCH_FILE_NAME}\`?` : `Create \`${gitIgnoreFilePath}\` to ignore \`${_branch.BRANCH_FILE_NAME}\`?`;
|
|
112
|
+
const input = flags.force || await (0, _ux.promptToConfirm)(prompt);
|
|
113
|
+
if (!input) return;
|
|
114
|
+
await (0, _branch.appendBranchFileToGitIgnore)(gitIgnoreFilePath, gitIgnoreFileExists);
|
|
115
|
+
}
|
|
116
|
+
async switchToBranch(branchFilePath, slug) {
|
|
117
|
+
this.log(`‣ Switching to branch \`${slug}\``);
|
|
118
|
+
const branch = await this.resolveBranch(slug);
|
|
119
|
+
await (0, _branch.writeSlugToBranchFile)(branchFilePath, branch.slug);
|
|
120
|
+
this.log(`‣ Successfully switched to branch \`${branch.slug}\``);
|
|
121
|
+
}
|
|
122
|
+
async resolveBranch(slug) {
|
|
123
|
+
const { flags } = this.props;
|
|
124
|
+
try {
|
|
125
|
+
return await this.fetchBranch(slug);
|
|
126
|
+
} catch (error) {
|
|
127
|
+
// Create the branch when --create flag is provided and the branch is not found
|
|
128
|
+
if (flags.create && error instanceof _error.ApiError && error.status === 404 && error.code === "branch_not_found") {
|
|
129
|
+
return this.createBranch(slug);
|
|
130
|
+
}
|
|
131
|
+
throw error;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
async fetchBranch(slug) {
|
|
135
|
+
return (0, _request.withSpinnerV2)(()=>this.apiV1.mgmtClient.get(`/v1/branches/${slug}`), {
|
|
136
|
+
action: "‣ Fetching branch"
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
async createBranch(slug) {
|
|
140
|
+
return (0, _request.withSpinnerV2)(()=>this.apiV1.mgmtClient.post(`/v1/branches/${slug}`), {
|
|
141
|
+
action: "‣ Creating branch"
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
// Hide until branches are released in GA
|
|
146
|
+
_define_property(BranchSwitch, "hidden", true);
|
|
147
|
+
_define_property(BranchSwitch, "summary", "Switches to an existing branch with the given slug.");
|
|
148
|
+
_define_property(BranchSwitch, "flags", {
|
|
149
|
+
create: _core.Flags.boolean({
|
|
150
|
+
summary: "Create the branch if it doesn't yet exist."
|
|
151
|
+
}),
|
|
152
|
+
force: _core.Flags.boolean({
|
|
153
|
+
summary: "Remove the confirmation prompt."
|
|
154
|
+
})
|
|
155
|
+
});
|
|
156
|
+
_define_property(BranchSwitch, "args", {
|
|
157
|
+
slug: _arg.CustomArgs.slug({
|
|
158
|
+
required: true,
|
|
159
|
+
description: "The slug of the branch to switch to"
|
|
160
|
+
})
|
|
161
|
+
});
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get BRANCH_FILE_NAME () {
|
|
13
|
+
return BRANCH_FILE_NAME;
|
|
14
|
+
},
|
|
15
|
+
get appendBranchFileToGitIgnore () {
|
|
16
|
+
return appendBranchFileToGitIgnore;
|
|
17
|
+
},
|
|
18
|
+
get clearBranchFile () {
|
|
19
|
+
return clearBranchFile;
|
|
20
|
+
},
|
|
21
|
+
get findProjectRoot () {
|
|
22
|
+
return findProjectRoot;
|
|
23
|
+
},
|
|
24
|
+
get parseSlugFromBranchFile () {
|
|
25
|
+
return parseSlugFromBranchFile;
|
|
26
|
+
},
|
|
27
|
+
get readSlugFromBranchFile () {
|
|
28
|
+
return readSlugFromBranchFile;
|
|
29
|
+
},
|
|
30
|
+
get writeSlugToBranchFile () {
|
|
31
|
+
return writeSlugToBranchFile;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
const _nodepath = /*#__PURE__*/ _interop_require_default(require("node:path"));
|
|
35
|
+
const _findup = /*#__PURE__*/ _interop_require_default(require("find-up"));
|
|
36
|
+
const _fsextra = /*#__PURE__*/ _interop_require_wildcard(require("fs-extra"));
|
|
37
|
+
function _interop_require_default(obj) {
|
|
38
|
+
return obj && obj.__esModule ? obj : {
|
|
39
|
+
default: obj
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
43
|
+
if (typeof WeakMap !== "function") return null;
|
|
44
|
+
var cacheBabelInterop = new WeakMap();
|
|
45
|
+
var cacheNodeInterop = new WeakMap();
|
|
46
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
47
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
48
|
+
})(nodeInterop);
|
|
49
|
+
}
|
|
50
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
51
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
52
|
+
return obj;
|
|
53
|
+
}
|
|
54
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
55
|
+
return {
|
|
56
|
+
default: obj
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
60
|
+
if (cache && cache.has(obj)) {
|
|
61
|
+
return cache.get(obj);
|
|
62
|
+
}
|
|
63
|
+
var newObj = {
|
|
64
|
+
__proto__: null
|
|
65
|
+
};
|
|
66
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
67
|
+
for(var key in obj){
|
|
68
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
69
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
70
|
+
if (desc && (desc.get || desc.set)) {
|
|
71
|
+
Object.defineProperty(newObj, key, desc);
|
|
72
|
+
} else {
|
|
73
|
+
newObj[key] = obj[key];
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
newObj.default = obj;
|
|
78
|
+
if (cache) {
|
|
79
|
+
cache.set(obj, newObj);
|
|
80
|
+
}
|
|
81
|
+
return newObj;
|
|
82
|
+
}
|
|
83
|
+
const BRANCH_FILE_NAME = ".knockbranch";
|
|
84
|
+
/**
|
|
85
|
+
* A comment written to the `.gitignore` file when it's updated.
|
|
86
|
+
*/ const GITIGNORE_COMMENT = "# Knock CLI config files\n";
|
|
87
|
+
const readSlugFromBranchFile = async ()=>{
|
|
88
|
+
const branchFilePath = await (0, _findup.default)(BRANCH_FILE_NAME);
|
|
89
|
+
const slug = branchFilePath ? await parseSlugFromBranchFile(branchFilePath) : undefined;
|
|
90
|
+
return slug;
|
|
91
|
+
};
|
|
92
|
+
const parseSlugFromBranchFile = async (branchFilePath)=>{
|
|
93
|
+
const input = (await _fsextra.readFile(branchFilePath, "utf-8")).trim();
|
|
94
|
+
return /^[\w-]+$/.test(input) ? input : undefined;
|
|
95
|
+
};
|
|
96
|
+
const clearBranchFile = async (branchFilePath)=>{
|
|
97
|
+
// The empty string indicates that no branch is currently active
|
|
98
|
+
await _fsextra.writeFile(branchFilePath, "");
|
|
99
|
+
};
|
|
100
|
+
const writeSlugToBranchFile = async (branchFilePath, branchSlug)=>{
|
|
101
|
+
await _fsextra.writeFile(branchFilePath, `${branchSlug}\n`);
|
|
102
|
+
};
|
|
103
|
+
const findProjectRoot = async ()=>{
|
|
104
|
+
const currDir = process.cwd();
|
|
105
|
+
const gitIgnoreFilePath = await (0, _findup.default)(async (directory)=>{
|
|
106
|
+
const filePath = _nodepath.default.join(directory, ".gitignore");
|
|
107
|
+
const gitIgnoreFileExists = await _fsextra.exists(filePath);
|
|
108
|
+
if (gitIgnoreFileExists) {
|
|
109
|
+
return filePath;
|
|
110
|
+
}
|
|
111
|
+
// Stop search when we find a .git directory
|
|
112
|
+
const gitDirExists = await _fsextra.exists(_nodepath.default.join(directory, ".git"));
|
|
113
|
+
if (gitDirExists) {
|
|
114
|
+
return _findup.default.stop;
|
|
115
|
+
}
|
|
116
|
+
}, {
|
|
117
|
+
cwd: currDir
|
|
118
|
+
});
|
|
119
|
+
return gitIgnoreFilePath ? _nodepath.default.dirname(gitIgnoreFilePath) : currDir;
|
|
120
|
+
};
|
|
121
|
+
const appendBranchFileToGitIgnore = async (gitIgnoreFilePath, addLeadingNewline = true)=>{
|
|
122
|
+
const appendedContent = (addLeadingNewline ? "\n" : "") + GITIGNORE_COMMENT + BRANCH_FILE_NAME + "\n";
|
|
123
|
+
await _fsextra.appendFile(gitIgnoreFilePath, appendedContent);
|
|
124
|
+
};
|
|
@@ -58,6 +58,11 @@ class CustomError extends Error {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
class ApiError extends CustomError {
|
|
61
|
+
constructor(message, status, code){
|
|
62
|
+
super(message), _define_property(this, "status", void 0), _define_property(this, "code", void 0);
|
|
63
|
+
this.status = status;
|
|
64
|
+
this.code = code;
|
|
65
|
+
}
|
|
61
66
|
}
|
|
62
67
|
class JsonSyntaxError extends CustomError {
|
|
63
68
|
}
|
package/dist/lib/helpers/flag.js
CHANGED
|
@@ -34,6 +34,8 @@ _export(exports, {
|
|
|
34
34
|
const _nodepath = /*#__PURE__*/ _interop_require_wildcard(require("node:path"));
|
|
35
35
|
const _core = require("@oclif/core");
|
|
36
36
|
const _fsextra = /*#__PURE__*/ _interop_require_wildcard(require("fs-extra"));
|
|
37
|
+
const _lodash = require("lodash");
|
|
38
|
+
const _branch = require("./branch");
|
|
37
39
|
const _json = require("./json");
|
|
38
40
|
const _string = require("./string");
|
|
39
41
|
function _getRequireWildcardCache(nodeInterop) {
|
|
@@ -147,5 +149,8 @@ const slug = _core.Flags.custom({
|
|
|
147
149
|
const branch = slug({
|
|
148
150
|
summary: "The slug of the branch to use.",
|
|
149
151
|
// TODO Hide until branching is released in GA
|
|
150
|
-
hidden: true
|
|
152
|
+
hidden: true,
|
|
153
|
+
// Memoize this flag's default. oclif runs this default function even when the flag is unused.
|
|
154
|
+
// Using lodash's once avoids unnecessarily reading the branch file multiple times.
|
|
155
|
+
default: (0, _lodash.once)(_branch.readSlugFromBranchFile)
|
|
151
156
|
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "isFileIgnoredByGit", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return isFileIgnoredByGit;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _nodechild_process = require("node:child_process");
|
|
12
|
+
const isFileIgnoredByGit = async (currDir, filePath)=>{
|
|
13
|
+
try {
|
|
14
|
+
(0, _nodechild_process.execSync)(`git check-ignore "${filePath}"`, {
|
|
15
|
+
cwd: currDir,
|
|
16
|
+
// Suppress output since we only care about exit status
|
|
17
|
+
stdio: "pipe"
|
|
18
|
+
});
|
|
19
|
+
// If we reach here, git check-ignore returned exit status 0 (file is ignored)
|
|
20
|
+
// See https://git-scm.com/docs/git-check-ignore#_exit_status
|
|
21
|
+
return true;
|
|
22
|
+
} catch {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
@@ -90,7 +90,7 @@ const withSpinnerV2 = async (requestFn, opts = {})=>{
|
|
|
90
90
|
} catch (error) {
|
|
91
91
|
if (error instanceof _mgmt.default.APIError) {
|
|
92
92
|
const message = formatMgmtError(error);
|
|
93
|
-
return _core.ux.error(new _error.ApiError(message));
|
|
93
|
+
return _core.ux.error(new _error.ApiError(message, error.status, error.error.code));
|
|
94
94
|
}
|
|
95
95
|
throw error;
|
|
96
96
|
}
|
|
@@ -178,7 +178,7 @@ const ensureValidCommandTarget = async (props, runContext)=>{
|
|
|
178
178
|
if (resourceDirCtx && resourceDirCtx.key !== localeCode) {
|
|
179
179
|
return _core.ux.error(`Cannot run ${commandId} with \`${args.translationRef}\` inside a ${resourceDirCtx.key} directory`);
|
|
180
180
|
}
|
|
181
|
-
const targetDirPath = resourceDirCtx ? resourceDirCtx.abspath : _nodepath.resolve(runCwd, localeCode);
|
|
181
|
+
const targetDirPath = resourceDirCtx ? resourceDirCtx.abspath : flags["translations-dir"] ? _nodepath.resolve(flags["translations-dir"].abspath, localeCode) : _nodepath.resolve(runCwd, localeCode);
|
|
182
182
|
// Got translationRef arg but no --all flag, which means target only a single
|
|
183
183
|
// translation file.
|
|
184
184
|
if (!flags.all) {
|
package/oclif.manifest.json
CHANGED
|
@@ -420,6 +420,46 @@
|
|
|
420
420
|
"delete.js"
|
|
421
421
|
]
|
|
422
422
|
},
|
|
423
|
+
"branch:exit": {
|
|
424
|
+
"aliases": [],
|
|
425
|
+
"args": {},
|
|
426
|
+
"flags": {
|
|
427
|
+
"service-token": {
|
|
428
|
+
"env": "KNOCK_SERVICE_TOKEN",
|
|
429
|
+
"name": "service-token",
|
|
430
|
+
"required": false,
|
|
431
|
+
"summary": "The service token to authenticate with.",
|
|
432
|
+
"hasDynamicHelp": false,
|
|
433
|
+
"multiple": false,
|
|
434
|
+
"type": "option"
|
|
435
|
+
},
|
|
436
|
+
"api-origin": {
|
|
437
|
+
"hidden": true,
|
|
438
|
+
"name": "api-origin",
|
|
439
|
+
"required": false,
|
|
440
|
+
"hasDynamicHelp": false,
|
|
441
|
+
"multiple": false,
|
|
442
|
+
"type": "option"
|
|
443
|
+
}
|
|
444
|
+
},
|
|
445
|
+
"hasDynamicHelp": false,
|
|
446
|
+
"hidden": true,
|
|
447
|
+
"hiddenAliases": [],
|
|
448
|
+
"id": "branch:exit",
|
|
449
|
+
"pluginAlias": "@knocklabs/cli",
|
|
450
|
+
"pluginName": "@knocklabs/cli",
|
|
451
|
+
"pluginType": "core",
|
|
452
|
+
"strict": true,
|
|
453
|
+
"summary": "Exits the current branch.",
|
|
454
|
+
"enableJsonFlag": false,
|
|
455
|
+
"isESM": false,
|
|
456
|
+
"relativePath": [
|
|
457
|
+
"dist",
|
|
458
|
+
"commands",
|
|
459
|
+
"branch",
|
|
460
|
+
"exit.js"
|
|
461
|
+
]
|
|
462
|
+
},
|
|
423
463
|
"branch:list": {
|
|
424
464
|
"aliases": [],
|
|
425
465
|
"args": {},
|
|
@@ -488,6 +528,64 @@
|
|
|
488
528
|
"list.js"
|
|
489
529
|
]
|
|
490
530
|
},
|
|
531
|
+
"branch:switch": {
|
|
532
|
+
"aliases": [],
|
|
533
|
+
"args": {
|
|
534
|
+
"slug": {
|
|
535
|
+
"description": "The slug of the branch to switch to",
|
|
536
|
+
"name": "slug",
|
|
537
|
+
"required": true
|
|
538
|
+
}
|
|
539
|
+
},
|
|
540
|
+
"flags": {
|
|
541
|
+
"service-token": {
|
|
542
|
+
"env": "KNOCK_SERVICE_TOKEN",
|
|
543
|
+
"name": "service-token",
|
|
544
|
+
"required": false,
|
|
545
|
+
"summary": "The service token to authenticate with.",
|
|
546
|
+
"hasDynamicHelp": false,
|
|
547
|
+
"multiple": false,
|
|
548
|
+
"type": "option"
|
|
549
|
+
},
|
|
550
|
+
"api-origin": {
|
|
551
|
+
"hidden": true,
|
|
552
|
+
"name": "api-origin",
|
|
553
|
+
"required": false,
|
|
554
|
+
"hasDynamicHelp": false,
|
|
555
|
+
"multiple": false,
|
|
556
|
+
"type": "option"
|
|
557
|
+
},
|
|
558
|
+
"create": {
|
|
559
|
+
"name": "create",
|
|
560
|
+
"summary": "Create the branch if it doesn't yet exist.",
|
|
561
|
+
"allowNo": false,
|
|
562
|
+
"type": "boolean"
|
|
563
|
+
},
|
|
564
|
+
"force": {
|
|
565
|
+
"name": "force",
|
|
566
|
+
"summary": "Remove the confirmation prompt.",
|
|
567
|
+
"allowNo": false,
|
|
568
|
+
"type": "boolean"
|
|
569
|
+
}
|
|
570
|
+
},
|
|
571
|
+
"hasDynamicHelp": false,
|
|
572
|
+
"hidden": true,
|
|
573
|
+
"hiddenAliases": [],
|
|
574
|
+
"id": "branch:switch",
|
|
575
|
+
"pluginAlias": "@knocklabs/cli",
|
|
576
|
+
"pluginName": "@knocklabs/cli",
|
|
577
|
+
"pluginType": "core",
|
|
578
|
+
"strict": true,
|
|
579
|
+
"summary": "Switches to an existing branch with the given slug.",
|
|
580
|
+
"enableJsonFlag": false,
|
|
581
|
+
"isESM": false,
|
|
582
|
+
"relativePath": [
|
|
583
|
+
"dist",
|
|
584
|
+
"commands",
|
|
585
|
+
"branch",
|
|
586
|
+
"switch.js"
|
|
587
|
+
]
|
|
588
|
+
},
|
|
491
589
|
"commit:get": {
|
|
492
590
|
"aliases": [],
|
|
493
591
|
"args": {
|
|
@@ -3826,5 +3924,5 @@
|
|
|
3826
3924
|
]
|
|
3827
3925
|
}
|
|
3828
3926
|
},
|
|
3829
|
-
"version": "0.2.
|
|
3927
|
+
"version": "0.2.3"
|
|
3830
3928
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knocklabs/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Knock CLI",
|
|
5
5
|
"author": "@knocklabs",
|
|
6
6
|
"bin": {
|
|
@@ -24,13 +24,14 @@
|
|
|
24
24
|
"axios": "^1.11.0",
|
|
25
25
|
"date-fns": "^2.30.0",
|
|
26
26
|
"enquirer": "^2.4.1",
|
|
27
|
+
"find-up": "^5.0.0",
|
|
27
28
|
"fs-extra": "^11.3.2",
|
|
28
29
|
"liquidjs": "^10.21.1",
|
|
29
30
|
"locale-codes": "^1.3.1",
|
|
30
31
|
"lodash": "^4.17.21",
|
|
31
32
|
"open": "8.4.2",
|
|
32
33
|
"quicktype-core": "^23.2.6",
|
|
33
|
-
"zod": "^4.1.
|
|
34
|
+
"zod": "^4.1.12"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
37
|
"@oclif/test": "^3",
|
|
@@ -57,7 +58,7 @@
|
|
|
57
58
|
"ts-node": "^10.9.1",
|
|
58
59
|
"tsconfig-paths": "^4.2.0",
|
|
59
60
|
"tslib": "^2.8.1",
|
|
60
|
-
"typescript": "^5.9.
|
|
61
|
+
"typescript": "^5.9.3"
|
|
61
62
|
},
|
|
62
63
|
"oclif": {
|
|
63
64
|
"bin": "knock",
|