@knocklabs/cli 0.1.0-rc.4 → 0.1.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.
Files changed (34) hide show
  1. package/README.md +172 -77
  2. package/dist/commands/commit/index.js +6 -3
  3. package/dist/commands/commit/promote.js +5 -2
  4. package/dist/commands/knock.js +102 -0
  5. package/dist/commands/ping.js +2 -4
  6. package/dist/commands/translation/get.js +128 -0
  7. package/dist/commands/translation/list.js +57 -9
  8. package/dist/commands/translation/pull.js +72 -21
  9. package/dist/commands/translation/push.js +23 -12
  10. package/dist/commands/translation/validate.js +12 -8
  11. package/dist/commands/whoami.js +31 -0
  12. package/dist/commands/workflow/activate.js +19 -8
  13. package/dist/commands/workflow/get.js +14 -10
  14. package/dist/commands/workflow/list.js +7 -3
  15. package/dist/commands/workflow/new.js +4 -5
  16. package/dist/commands/workflow/pull.js +18 -10
  17. package/dist/commands/workflow/push.js +60 -47
  18. package/dist/commands/workflow/run.js +58 -0
  19. package/dist/commands/workflow/validate.js +52 -48
  20. package/dist/lib/api-v1.js +32 -5
  21. package/dist/lib/base-command.js +8 -4
  22. package/dist/lib/helpers/flag.js +12 -1
  23. package/dist/lib/helpers/page.js +7 -2
  24. package/dist/lib/helpers/request.js +1 -1
  25. package/dist/lib/helpers/ux.js +2 -2
  26. package/dist/lib/marshal/translation/helpers.js +21 -7
  27. package/dist/lib/marshal/translation/reader.js +17 -14
  28. package/dist/lib/marshal/translation/types.js +1 -0
  29. package/dist/lib/marshal/translation/writer.js +26 -16
  30. package/dist/lib/marshal/workflow/helpers.js +64 -2
  31. package/dist/lib/marshal/workflow/reader.js +62 -0
  32. package/dist/lib/run-context/helpers.js +2 -2
  33. package/oclif.manifest.json +281 -24
  34. package/package.json +25 -19
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.1.0-rc.4 linux-x64 node-v16.4.2
19
+ @knocklabs/cli/0.1.3 linux-x64 node-v18.16.0
20
20
  $ knock --help [COMMAND]
21
21
  USAGE
22
22
  $ knock COMMAND
@@ -30,7 +30,6 @@ USAGE
30
30
  * [`knock commit`](#knock-commit)
31
31
  * [`knock commit promote`](#knock-commit-promote)
32
32
  * [`knock help [COMMANDS]`](#knock-help-commands)
33
- * [`knock ping`](#knock-ping)
34
33
  * [`knock plugins`](#knock-plugins)
35
34
  * [`knock plugins:install PLUGIN...`](#knock-pluginsinstall-plugin)
36
35
  * [`knock plugins:inspect PLUGIN...`](#knock-pluginsinspect-plugin)
@@ -40,44 +39,51 @@ USAGE
40
39
  * [`knock plugins:uninstall PLUGIN...`](#knock-pluginsuninstall-plugin-1)
41
40
  * [`knock plugins:uninstall PLUGIN...`](#knock-pluginsuninstall-plugin-2)
42
41
  * [`knock plugins update`](#knock-plugins-update)
42
+ * [`knock translation get TRANSLATIONREF`](#knock-translation-get-translationref)
43
43
  * [`knock translation list`](#knock-translation-list)
44
- * [`knock translation pull`](#knock-translation-pull)
44
+ * [`knock translation pull [TRANSLATIONREF]`](#knock-translation-pull-translationref)
45
45
  * [`knock translation push [TRANSLATIONREF]`](#knock-translation-push-translationref)
46
46
  * [`knock translation validate [TRANSLATIONREF]`](#knock-translation-validate-translationref)
47
+ * [`knock whoami`](#knock-whoami)
47
48
  * [`knock workflow activate WORKFLOWKEY`](#knock-workflow-activate-workflowkey)
48
49
  * [`knock workflow get WORKFLOWKEY`](#knock-workflow-get-workflowkey)
49
50
  * [`knock workflow list`](#knock-workflow-list)
50
51
  * [`knock workflow pull [WORKFLOWKEY]`](#knock-workflow-pull-workflowkey)
51
52
  * [`knock workflow push [WORKFLOWKEY]`](#knock-workflow-push-workflowkey)
53
+ * [`knock workflow run WORKFLOWKEY`](#knock-workflow-run-workflowkey)
52
54
  * [`knock workflow validate [WORKFLOWKEY]`](#knock-workflow-validate-workflowkey)
53
55
 
54
56
  ## `knock commit`
55
57
 
58
+ Commit all changes in development environment.
59
+
56
60
  ```
57
61
  USAGE
58
62
  $ knock commit --service-token <value> [--environment development] [-m <value>] [--force]
59
63
 
60
64
  FLAGS
61
- -m, --commit-message=<value> Use the given value as the commit message
65
+ -m, --commit-message=<value> Use the given value as the commit message.
62
66
  --environment=<option> [default: development] Committing changes applies to the development environment only,
63
- use `commit promote` to promote changes to a later environment
67
+ use `commit promote` to promote changes to a subsequent environment.
64
68
  <options: development>
65
- --force
66
- --service-token=<value> (required) The service token to authenticate with
69
+ --force Remove the confirmation prompt.
70
+ --service-token=<value> (required) The service token to authenticate with.
67
71
  ```
68
72
 
69
- _See code: [dist/commands/commit/index.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.0-rc.4/dist/commands/commit/index.ts)_
73
+ _See code: [dist/commands/commit/index.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.3/dist/commands/commit/index.ts)_
70
74
 
71
75
  ## `knock commit promote`
72
76
 
77
+ Promote all changes to the destination environment.
78
+
73
79
  ```
74
80
  USAGE
75
81
  $ knock commit promote --service-token <value> --to <value> [--force]
76
82
 
77
83
  FLAGS
78
- --force
79
- --service-token=<value> (required) The service token to authenticate with
80
- --to=<value> (required) The destination environment to promote changes from the preceding environment
84
+ --force Remove the confirmation prompt.
85
+ --service-token=<value> (required) The service token to authenticate with.
86
+ --to=<value> (required) The destination environment to promote changes from the preceding environment.
81
87
  ```
82
88
 
83
89
  ## `knock help [COMMANDS]`
@@ -100,26 +106,6 @@ DESCRIPTION
100
106
 
101
107
  _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.2.9/src/commands/help.ts)_
102
108
 
103
- ## `knock ping`
104
-
105
- Ping the Knock management API to verify access.
106
-
107
- ```
108
- USAGE
109
- $ knock ping --service-token <value>
110
-
111
- FLAGS
112
- --service-token=<value> (required) The service token to authenticate with
113
-
114
- DESCRIPTION
115
- Ping the Knock management API to verify access.
116
-
117
- EXAMPLES
118
- $ knock ping
119
- ```
120
-
121
- _See code: [dist/commands/ping.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.0-rc.4/dist/commands/ping.ts)_
122
-
123
109
  ## `knock plugins`
124
110
 
125
111
  List installed plugins.
@@ -138,7 +124,7 @@ EXAMPLES
138
124
  $ knock plugins
139
125
  ```
140
126
 
141
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v2.4.7/src/commands/plugins/index.ts)_
127
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v3.0.1/src/commands/plugins/index.ts)_
142
128
 
143
129
  ## `knock plugins:install PLUGIN...`
144
130
 
@@ -353,99 +339,176 @@ DESCRIPTION
353
339
  Update installed plugins.
354
340
  ```
355
341
 
342
+ ## `knock translation get TRANSLATIONREF`
343
+
344
+ Display a single translation from an environment.
345
+
346
+ ```
347
+ USAGE
348
+ $ knock translation get TRANSLATIONREF --service-token <value> [--environment <value>] [--hide-uncommitted-changes]
349
+ [--json]
350
+
351
+ ARGUMENTS
352
+ TRANSLATIONREF Translation ref is a identifier string that refers to a unique translation.
353
+ If a translation has no namespace, it is the same as the locale, e.g. `en`.
354
+ If namespaced, it is formatted as namespace.locale, e.g. `admin.en`.
355
+
356
+ FLAGS
357
+ --environment=<value> [default: development] The environment to use.
358
+ --hide-uncommitted-changes Hide any uncommitted changes.
359
+ --service-token=<value> (required) The service token to authenticate with.
360
+
361
+ GLOBAL FLAGS
362
+ --json Format output as json.
363
+ ```
364
+
356
365
  ## `knock translation list`
357
366
 
367
+ Display all translations for an environment.
368
+
358
369
  ```
359
370
  USAGE
360
371
  $ knock translation list --service-token <value> [--environment <value>] [--hide-uncommitted-changes] [--after
361
372
  <value>] [--before <value>] [--limit <value>] [--json]
362
373
 
363
374
  FLAGS
364
- --after=<value>
365
- --before=<value>
366
- --environment=<value> [default: development]
367
- --hide-uncommitted-changes
368
- --limit=<value>
369
- --service-token=<value> (required) The service token to authenticate with
375
+ --after=<value> The cursor after which to fetch the next page.
376
+ --before=<value> The cursor before which to fetch the previous page.
377
+ --environment=<value> [default: development] The environment to use.
378
+ --hide-uncommitted-changes Hide any uncommitted changes.
379
+ --limit=<value> The total number of entries to fetch per page.
380
+ --service-token=<value> (required) The service token to authenticate with.
370
381
 
371
382
  GLOBAL FLAGS
372
383
  --json Format output as json.
373
384
  ```
374
385
 
375
- ## `knock translation pull`
386
+ ## `knock translation pull [TRANSLATIONREF]`
387
+
388
+ Pull one or more translations from an environment into a local file system.
376
389
 
377
390
  ```
378
391
  USAGE
379
- $ knock translation pull --service-token <value> [--environment <value>] [--translations-dir <value> --all]
380
- [--hide-uncommitted-changes] [--force]
392
+ $ knock translation pull [TRANSLATIONREF] --service-token <value> [--environment <value>] [--translations-dir
393
+ <value> --all] [--hide-uncommitted-changes] [--force]
394
+
395
+ ARGUMENTS
396
+ TRANSLATIONREF Translation ref is a identifier string that refers to a unique translation.
397
+ If a translation has no namespace, it is the same as the locale, e.g. `en`.
398
+ If namespaced, it is formatted as namespace.locale, e.g. `admin.en`.
381
399
 
382
400
  FLAGS
383
- --all
384
- --environment=<value> [default: development]
385
- --force
386
- --hide-uncommitted-changes
387
- --service-token=<value> (required) The service token to authenticate with
388
- --translations-dir=<value>
401
+ --all Whether to pull all translations from the specified environment.
402
+ --environment=<value> [default: development] The environment to use.
403
+ --force Remove the confirmation prompt.
404
+ --hide-uncommitted-changes Hide any uncommitted changes.
405
+ --service-token=<value> (required) The service token to authenticate with.
406
+ --translations-dir=<value> The target directory path to pull all translations into.
389
407
  ```
390
408
 
391
409
  ## `knock translation push [TRANSLATIONREF]`
392
410
 
411
+ Push one or more translations from a local file system to Knock.
412
+
393
413
  ```
394
414
  USAGE
395
415
  $ knock translation push [TRANSLATIONREF] --service-token <value> [--environment development] [--translations-dir
396
416
  <value> --all] [-m <value> --commit]
397
417
 
418
+ ARGUMENTS
419
+ TRANSLATIONREF Translation ref is a identifier string that refers to a unique translation.
420
+ If a translation has no namespace, it is the same as the locale, e.g. `en`.
421
+ If namespaced, it is formatted as namespace.locale, e.g. `admin.en`.
422
+
398
423
  FLAGS
399
424
  -m, --commit-message=<value> Use the given value as the commit message
400
- --all
425
+ --all Whether to push all translations from the target directory.
401
426
  --commit Push and commit the translation(s) at the same time
402
427
  --environment=<option> [default: development] Pushing a translation is only allowed in the development
403
428
  environment
404
429
  <options: development>
405
- --service-token=<value> (required) The service token to authenticate with
406
- --translations-dir=<value>
430
+ --service-token=<value> (required) The service token to authenticate with.
431
+ --translations-dir=<value> The target directory path to find all translations to push.
407
432
  ```
408
433
 
409
434
  ## `knock translation validate [TRANSLATIONREF]`
410
435
 
436
+ Validate one or more translations from a local file system.
437
+
411
438
  ```
412
439
  USAGE
413
440
  $ knock translation validate [TRANSLATIONREF] --service-token <value> [--environment development] [--translations-dir
414
441
  <value> --all]
415
442
 
443
+ ARGUMENTS
444
+ TRANSLATIONREF Translation ref is a identifier string that refers to a unique translation.
445
+ If a translation has no namespace, it is the same as the locale, e.g. `en`.
446
+ If namespaced, it is formatted as namespace.locale, e.g. `admin.en`.
447
+
416
448
  FLAGS
417
- --all
418
- --environment=<option> [default: development] Validating a workflow is only done in the development environment
449
+ --all Whether to validate all translations from the target directory.
450
+ --environment=<option> [default: development] Validating a translation is only done in the development
451
+ environment
419
452
  <options: development>
420
- --service-token=<value> (required) The service token to authenticate with
421
- --translations-dir=<value>
453
+ --service-token=<value> (required) The service token to authenticate with.
454
+ --translations-dir=<value> The target directory path to find all translations to validate.
455
+ ```
456
+
457
+ ## `knock whoami`
458
+
459
+ Verify the provided service token.
460
+
422
461
  ```
462
+ USAGE
463
+ $ knock whoami --service-token <value> [--json]
464
+
465
+ FLAGS
466
+ --service-token=<value> (required) The service token to authenticate with.
467
+
468
+ GLOBAL FLAGS
469
+ --json Format output as json.
470
+ ```
471
+
472
+ _See code: [dist/commands/whoami.ts](https://github.com/knocklabs/knock-cli/blob/v0.1.3/dist/commands/whoami.ts)_
423
473
 
424
474
  ## `knock workflow activate WORKFLOWKEY`
425
475
 
476
+ Activate or deactivate a workflow in a given environment.
477
+
426
478
  ```
427
479
  USAGE
428
480
  $ knock workflow activate WORKFLOWKEY --service-token <value> --environment <value> [--status true|false] [--force]
429
481
 
430
482
  FLAGS
431
- --environment=<value> (required)
432
- --force
433
- --service-token=<value> (required) The service token to authenticate with
434
- --status=<option> [default: true]
483
+ --environment=<value> (required) The environment to use.
484
+ --force Remove the confirmation prompt.
485
+ --service-token=<value> (required) The service token to authenticate with.
486
+ --status=<option> [default: true] The workflow active status to set.
435
487
  <options: true|false>
488
+
489
+ DESCRIPTION
490
+ Activate or deactivate a workflow in a given environment.
491
+
492
+ This immediately enables or disables a workflow in a given environment without
493
+ needing to go through environment promotion.
494
+
495
+ By default, this command activates a given workflow. Pass in the --status flag
496
+ with `false` in order to deactivate it.
436
497
  ```
437
498
 
438
499
  ## `knock workflow get WORKFLOWKEY`
439
500
 
501
+ Display a single workflow from an environment.
502
+
440
503
  ```
441
504
  USAGE
442
505
  $ knock workflow get WORKFLOWKEY --service-token <value> [--environment <value>] [--hide-uncommitted-changes]
443
506
  [--json]
444
507
 
445
508
  FLAGS
446
- --environment=<value> [default: development]
447
- --hide-uncommitted-changes
448
- --service-token=<value> (required) The service token to authenticate with
509
+ --environment=<value> [default: development] The environment to use.
510
+ --hide-uncommitted-changes Hide any uncommitted changes.
511
+ --service-token=<value> (required) The service token to authenticate with.
449
512
 
450
513
  GLOBAL FLAGS
451
514
  --json Format output as json.
@@ -453,18 +516,20 @@ GLOBAL FLAGS
453
516
 
454
517
  ## `knock workflow list`
455
518
 
519
+ Display all workflows for an environment.
520
+
456
521
  ```
457
522
  USAGE
458
523
  $ knock workflow list --service-token <value> [--environment <value>] [--hide-uncommitted-changes] [--after
459
524
  <value>] [--before <value>] [--limit <value>] [--json]
460
525
 
461
526
  FLAGS
462
- --after=<value>
463
- --before=<value>
464
- --environment=<value> [default: development]
465
- --hide-uncommitted-changes
466
- --limit=<value>
467
- --service-token=<value> (required) The service token to authenticate with
527
+ --after=<value> The cursor after which to fetch the next page.
528
+ --before=<value> The cursor before which to fetch the previous page.
529
+ --environment=<value> [default: development] The environment to use.
530
+ --hide-uncommitted-changes Hide any uncommitted changes.
531
+ --limit=<value> The total number of entries to fetch per page.
532
+ --service-token=<value> (required) The service token to authenticate with.
468
533
 
469
534
  GLOBAL FLAGS
470
535
  --json Format output as json.
@@ -472,43 +537,73 @@ GLOBAL FLAGS
472
537
 
473
538
  ## `knock workflow pull [WORKFLOWKEY]`
474
539
 
540
+ Pull one or more workflows from an environment into a local file system.
541
+
475
542
  ```
476
543
  USAGE
477
544
  $ knock workflow pull [WORKFLOWKEY] --service-token <value> [--environment <value>] [--workflows-dir <value>
478
545
  --all] [--hide-uncommitted-changes] [--force]
479
546
 
480
547
  FLAGS
481
- --all
482
- --environment=<value> [default: development]
483
- --force
484
- --hide-uncommitted-changes
485
- --service-token=<value> (required) The service token to authenticate with
486
- --workflows-dir=<value>
548
+ --all Whether to pull all workflows from the specified environment.
549
+ --environment=<value> [default: development] The environment to use.
550
+ --force Remove the confirmation prompt.
551
+ --hide-uncommitted-changes Hide any uncommitted changes.
552
+ --service-token=<value> (required) The service token to authenticate with.
553
+ --workflows-dir=<value> The target directory path to pull all workflows into.
487
554
  ```
488
555
 
489
556
  ## `knock workflow push [WORKFLOWKEY]`
490
557
 
558
+ Push one or more workflows from a local file system to Knock.
559
+
491
560
  ```
492
561
  USAGE
493
- $ knock workflow push [WORKFLOWKEY] --service-token <value> [--environment development] [-m <value> --commit]
562
+ $ knock workflow push [WORKFLOWKEY] --service-token <value> [--environment development] [--workflows-dir <value>
563
+ --all] [-m <value> --commit]
494
564
 
495
565
  FLAGS
496
566
  -m, --commit-message=<value> Use the given value as the commit message
567
+ --all Whether to push all workflows from the target directory.
497
568
  --commit Push and commit the workflow(s) at the same time
498
569
  --environment=<option> [default: development] Pushing a workflow is only allowed in the development environment
499
570
  <options: development>
500
- --service-token=<value> (required) The service token to authenticate with
571
+ --service-token=<value> (required) The service token to authenticate with.
572
+ --workflows-dir=<value> The target directory path to find all workflows to push.
573
+ ```
574
+
575
+ ## `knock workflow run WORKFLOWKEY`
576
+
577
+ Test run a workflow using the latest version from Knock, or a local workflow directory.
578
+
579
+ ```
580
+ USAGE
581
+ $ knock workflow run WORKFLOWKEY --service-token <value> --recipients <value> [--environment <value>] [--actor
582
+ <value>] [--tenant <value>] [--data <value>]
583
+
584
+ FLAGS
585
+ --actor=<value> An actor id for the workflow run.
586
+ --data=<value> A JSON string of the data for this workflow
587
+ --environment=<value> [default: development] The environment in which to run the workflow
588
+ --recipients=<value>... (required) One or more recipient ids for this workflow run, separated by comma.
589
+ --service-token=<value> (required) The service token to authenticate with.
590
+ --tenant=<value> A tenant id for the workflow run.
501
591
  ```
502
592
 
503
593
  ## `knock workflow validate [WORKFLOWKEY]`
504
594
 
595
+ Validate one or more workflows from a local file system.
596
+
505
597
  ```
506
598
  USAGE
507
- $ knock workflow validate [WORKFLOWKEY] --service-token <value> [--environment development]
599
+ $ knock workflow validate [WORKFLOWKEY] --service-token <value> [--environment development] [--workflows-dir <value>
600
+ --all]
508
601
 
509
602
  FLAGS
603
+ --all Whether to validate all workflows from the target directory.
510
604
  --environment=<option> [default: development] Validating a workflow is only done in the development environment
511
605
  <options: development>
512
- --service-token=<value> (required) The service token to authenticate with
606
+ --service-token=<value> (required) The service token to authenticate with.
607
+ --workflows-dir=<value> The target directory path to find all workflows to validate.
513
608
  ```
514
609
  <!-- commandsstop -->
@@ -28,17 +28,20 @@ class Commit extends _baseCommand.default {
28
28
  this.log(`‣ Successfully committed all changes in \`${flags.environment}\` environment`);
29
29
  }
30
30
  }
31
+ Commit.summary = "Commit all changes in development environment.";
31
32
  Commit.flags = {
32
33
  environment: _core.Flags.string({
33
- summary: "Committing changes applies to the development environment only, use `commit promote` to promote changes to a later environment",
34
+ summary: "Committing changes applies to the development environment only, use `commit promote` to promote changes to a subsequent environment.",
34
35
  default: _const.KnockEnv.Development,
35
36
  options: [
36
37
  _const.KnockEnv.Development
37
38
  ]
38
39
  }),
39
40
  "commit-message": _core.Flags.string({
40
- summary: "Use the given value as the commit message",
41
+ summary: "Use the given value as the commit message.",
41
42
  char: "m"
42
43
  }),
43
- force: _core.Flags.boolean()
44
+ force: _core.Flags.boolean({
45
+ summary: "Remove the confirmation prompt."
46
+ })
44
47
  };
@@ -27,10 +27,13 @@ class CommitPromote extends _baseCommand.default {
27
27
  this.log(`‣ Successfully promoted all changes to \`${flags.to}\` environment`);
28
28
  }
29
29
  }
30
+ CommitPromote.summary = "Promote all changes to the destination environment.";
30
31
  CommitPromote.flags = {
31
32
  to: _core.Flags.string({
32
- summary: "The destination environment to promote changes from the preceding environment",
33
+ summary: "The destination environment to promote changes from the preceding environment.",
33
34
  required: true
34
35
  }),
35
- force: _core.Flags.boolean()
36
+ force: _core.Flags.boolean({
37
+ summary: "Remove the confirmation prompt."
38
+ })
36
39
  };
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: ()=>Knock
8
+ });
9
+ const _enquirer = /*#__PURE__*/ _interopRequireDefault(require("enquirer"));
10
+ const _baseCommand = /*#__PURE__*/ _interopRequireDefault(require("../lib/base-command"));
11
+ function _interopRequireDefault(obj) {
12
+ return obj && obj.__esModule ? obj : {
13
+ default: obj
14
+ };
15
+ }
16
+ const JOKES = [
17
+ [
18
+ "Boo.",
19
+ "Boo who?",
20
+ "Don't cry, it's just a joke!"
21
+ ],
22
+ [
23
+ "Cows go.",
24
+ "Cows go who?",
25
+ "No silly, cows go moo!"
26
+ ],
27
+ [
28
+ "Lettuce.",
29
+ "Lettuce who?",
30
+ "Lettuce in!"
31
+ ],
32
+ [
33
+ "Interrupting cow.",
34
+ "Interrupting cow wh—",
35
+ "MOO!"
36
+ ],
37
+ [
38
+ "Alpaca.",
39
+ "Alpaca who?",
40
+ "Alpaca the suitcase, let's go on vacation!"
41
+ ],
42
+ [
43
+ "To.",
44
+ "To who?",
45
+ "It's to whom."
46
+ ],
47
+ [
48
+ "HIPAA.",
49
+ "HIPAA who?",
50
+ "I'm sorry, I’m not authorized to release that information."
51
+ ],
52
+ [
53
+ "Control freak.",
54
+ "Con–",
55
+ "Okay, now you say, 'Control freak who?'."
56
+ ],
57
+ [
58
+ "Dejav.",
59
+ "Dejav who?",
60
+ "Knock, knock."
61
+ ],
62
+ [
63
+ "Art.",
64
+ "Art who?",
65
+ "R2D2!"
66
+ ],
67
+ [
68
+ "Spell.",
69
+ "Spell who?",
70
+ "W-h-o"
71
+ ],
72
+ [
73
+ "Beets.",
74
+ "Beets who?",
75
+ "Beets me!"
76
+ ]
77
+ ];
78
+ class Knock extends _baseCommand.default {
79
+ async run() {
80
+ const promptOpts = {
81
+ type: "invisible",
82
+ name: "input"
83
+ };
84
+ await _enquirer.default.prompt({
85
+ ...promptOpts,
86
+ message: "Who's there?"
87
+ });
88
+ const randomIndex = Math.floor(Math.random() * JOKES.length);
89
+ const lines = JOKES[randomIndex];
90
+ for (const line of lines){
91
+ // eslint-disable-next-line no-await-in-loop
92
+ await _enquirer.default.prompt({
93
+ ...promptOpts,
94
+ message: line
95
+ });
96
+ }
97
+ this.log("");
98
+ this.log("Thank you for using Knock, and have a nice day! 🙂");
99
+ }
100
+ }
101
+ // Because, it's a secret :)
102
+ Knock.hidden = true;
@@ -18,7 +18,5 @@ class Ping extends _baseCommand.default {
18
18
  this.log(resp.data);
19
19
  }
20
20
  }
21
- Ping.description = "Ping the Knock management API to verify access.";
22
- Ping.examples = [
23
- "<%= config.bin %> <%= command.id %>"
24
- ];
21
+ // Deprecated, in favor of the whoami command.
22
+ Ping.hidden = true;