@knocklabs/cli 0.1.0 → 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.
@@ -104,6 +104,7 @@ class TranslationPush extends _baseCommand.default {
104
104
  this.log(`‣ Successfully ${actioned} ${translations.length} translation(s):\n` + (0, _string.indentString)(handledRefs.join("\n"), 4));
105
105
  }
106
106
  }
107
+ TranslationPush.summary = "Push one or more translations from a local file system to Knock.";
107
108
  TranslationPush.flags = {
108
109
  environment: _core.Flags.string({
109
110
  summary: "Pushing a translation is only allowed in the development environment",
@@ -112,8 +113,11 @@ TranslationPush.flags = {
112
113
  _const.KnockEnv.Development
113
114
  ]
114
115
  }),
115
- all: _core.Flags.boolean(),
116
+ all: _core.Flags.boolean({
117
+ summary: "Whether to push all translations from the target directory."
118
+ }),
116
119
  "translations-dir": _flag.dirPath({
120
+ summary: "The target directory path to find all translations to push.",
117
121
  dependsOn: [
118
122
  "all"
119
123
  ]
@@ -129,9 +133,9 @@ TranslationPush.flags = {
129
133
  ]
130
134
  })
131
135
  };
132
- TranslationPush.args = [
133
- {
134
- name: "translationRef",
136
+ TranslationPush.args = {
137
+ translationRef: _core.Args.string({
138
+ description: _translation.translationRefDescription,
135
139
  required: false
136
- }
137
- ];
140
+ })
141
+ };
@@ -99,24 +99,28 @@ class TranslationValidate extends _baseCommand.default {
99
99
  return errors;
100
100
  }
101
101
  }
102
+ TranslationValidate.summary = "Validate one or more translations from a local file system.";
102
103
  TranslationValidate.flags = {
103
104
  environment: _core.Flags.string({
104
- summary: "Validating a workflow is only done in the development environment",
105
+ summary: "Validating a translation is only done in the development environment",
105
106
  default: _const.KnockEnv.Development,
106
107
  options: [
107
108
  _const.KnockEnv.Development
108
109
  ]
109
110
  }),
110
- all: _core.Flags.boolean(),
111
+ all: _core.Flags.boolean({
112
+ summary: "Whether to validate all translations from the target directory."
113
+ }),
111
114
  "translations-dir": _flag.dirPath({
115
+ summary: "The target directory path to find all translations to validate.",
112
116
  dependsOn: [
113
117
  "all"
114
118
  ]
115
119
  })
116
120
  };
117
- TranslationValidate.args = [
118
- {
119
- name: "translationRef",
121
+ TranslationValidate.args = {
122
+ translationRef: _core.Args.string({
123
+ description: _translation.translationRefDescription,
120
124
  required: false
121
- }
122
- ];
125
+ })
126
+ };
@@ -17,6 +17,8 @@ function _interopRequireDefault(obj) {
17
17
  class Whoami extends _baseCommand.default {
18
18
  async run() {
19
19
  const resp = await (0, _request.withSpinner)(()=>this.apiV1.whoami());
20
+ const { flags } = this.props;
21
+ if (flags.json) return resp.data;
20
22
  this.log(`‣ Successfully verified the provided service token:`);
21
23
  const info = [
22
24
  `Account name: ${resp.data.account_name}`,
@@ -25,4 +27,5 @@ class Whoami extends _baseCommand.default {
25
27
  this.log((0, _string.indentString)(info.join("\n"), 4));
26
28
  }
27
29
  }
30
+ Whoami.summary = "Verify the provided service token.";
28
31
  Whoami.enableJsonFlag = true;
@@ -35,20 +35,31 @@ class WorkflowActivate extends _baseCommand.default {
35
35
  this.log(`‣ Successfully ${actioned} \`${args.workflowKey}\` workflow in \`${flags.environment}\` environment`);
36
36
  }
37
37
  }
38
+ WorkflowActivate.summary = "Activate or deactivate a workflow in a given environment.";
39
+ WorkflowActivate.description = `
40
+ This immediately enables or disables a workflow in a given environment without
41
+ needing to go through environment promotion.
42
+
43
+ By default, this command activates a given workflow. Pass in the --status flag
44
+ with \`false\` in order to deactivate it.
45
+ `.trim();
38
46
  WorkflowActivate.flags = {
39
47
  // Do not default to any env for this command, since this action runs
40
48
  // directly in each environment outside the commit and promote flow.
41
49
  environment: _core.Flags.string({
42
- required: true
50
+ required: true,
51
+ summary: "The environment to use."
43
52
  }),
44
53
  status: (0, _flag.booleanStr)({
45
- default: true
54
+ default: true,
55
+ summary: "The workflow active status to set."
46
56
  }),
47
- force: _core.Flags.boolean()
57
+ force: _core.Flags.boolean({
58
+ summary: "Remove the confirmation prompt."
59
+ })
48
60
  };
49
- WorkflowActivate.args = [
50
- {
51
- name: "workflowKey",
61
+ WorkflowActivate.args = {
62
+ workflowKey: _core.Args.string({
52
63
  required: true
53
- }
54
- ];
64
+ })
65
+ };
@@ -102,7 +102,7 @@ class WorkflowGet extends _baseCommand.default {
102
102
  value: (0, _date.formatDateTime)(workflow.updated_at)
103
103
  }
104
104
  ];
105
- _core.CliUx.ux.table(rows, {
105
+ _core.ux.table(rows, {
106
106
  key: {
107
107
  header: "Workflow",
108
108
  minWidth: 24
@@ -113,8 +113,9 @@ class WorkflowGet extends _baseCommand.default {
113
113
  }
114
114
  });
115
115
  this.log("");
116
+ // Leading space is there intentionally to align the left padding.
116
117
  if (workflow.steps.length === 0) {
117
- return _core.CliUx.ux.log(" This workflow has no steps to display.");
118
+ return _core.ux.log(" This workflow has no steps to display.");
118
119
  }
119
120
  /*
120
121
  * Workflow steps table
@@ -122,7 +123,7 @@ class WorkflowGet extends _baseCommand.default {
122
123
  ...step,
123
124
  index
124
125
  }));
125
- _core.CliUx.ux.table(steps, {
126
+ _core.ux.table(steps, {
126
127
  index: {
127
128
  header: "Steps",
128
129
  get: (step)=>step.index + 1
@@ -146,16 +147,19 @@ class WorkflowGet extends _baseCommand.default {
146
147
  });
147
148
  }
148
149
  }
150
+ WorkflowGet.summary = "Display a single workflow from an environment.";
149
151
  WorkflowGet.flags = {
150
152
  environment: _core.Flags.string({
151
- default: "development"
153
+ default: "development",
154
+ summary: "The environment to use."
152
155
  }),
153
- "hide-uncommitted-changes": _core.Flags.boolean()
156
+ "hide-uncommitted-changes": _core.Flags.boolean({
157
+ summary: "Hide any uncommitted changes."
158
+ })
154
159
  };
155
- WorkflowGet.args = [
156
- {
157
- name: "workflowKey",
160
+ WorkflowGet.args = {
161
+ workflowKey: _core.Args.string({
158
162
  required: true
159
- }
160
- ];
163
+ })
164
+ };
161
165
  WorkflowGet.enableJsonFlag = true;
@@ -79,7 +79,7 @@ class WorkflowList extends _baseCommand.default {
79
79
  this.log(`‣ Showing ${entries.length} workflows in \`${env}\` environment ${qualifier}\n`);
80
80
  /*
81
81
  * Workflows list table
82
- */ _core.CliUx.ux.table(entries, {
82
+ */ _core.ux.table(entries, {
83
83
  key: {
84
84
  header: "Key"
85
85
  },
@@ -118,11 +118,15 @@ class WorkflowList extends _baseCommand.default {
118
118
  }
119
119
  }
120
120
  }
121
+ WorkflowList.summary = "Display all workflows for an environment.";
121
122
  WorkflowList.flags = {
122
123
  environment: _core.Flags.string({
123
- default: "development"
124
+ default: "development",
125
+ summary: "The environment to use."
126
+ }),
127
+ "hide-uncommitted-changes": _core.Flags.boolean({
128
+ summary: "Hide any uncommitted changes."
124
129
  }),
125
- "hide-uncommitted-changes": _core.Flags.boolean(),
126
130
  ..._page.pageFlags
127
131
  };
128
132
  WorkflowList.enableJsonFlag = true;
@@ -125,11 +125,10 @@ WorkflowNew.flags = {
125
125
  }),
126
126
  force: _core.Flags.boolean()
127
127
  };
128
- WorkflowNew.args = [
129
- {
130
- name: "workflowKey",
128
+ WorkflowNew.args = {
129
+ workflowKey: _core.Args.string({
131
130
  required: true
132
- }
133
- ];
131
+ })
132
+ };
134
133
  // TODO(KNO-3072): Unhide after we move the generator logic to the backend.
135
134
  WorkflowNew.hidden = true;
@@ -171,22 +171,30 @@ class WorkflowPull extends _baseCommand.default {
171
171
  }, workflows) : workflows;
172
172
  }
173
173
  }
174
+ WorkflowPull.summary = "Pull one or more workflows from an environment into a local file system.";
174
175
  WorkflowPull.flags = {
175
176
  environment: _core.Flags.string({
176
- default: "development"
177
+ default: "development",
178
+ summary: "The environment to use."
179
+ }),
180
+ all: _core.Flags.boolean({
181
+ summary: "Whether to pull all workflows from the specified environment."
177
182
  }),
178
- all: _core.Flags.boolean(),
179
183
  "workflows-dir": _flag.dirPath({
184
+ summary: "The target directory path to pull all workflows into.",
180
185
  dependsOn: [
181
186
  "all"
182
187
  ]
183
188
  }),
184
- "hide-uncommitted-changes": _core.Flags.boolean(),
185
- force: _core.Flags.boolean()
189
+ "hide-uncommitted-changes": _core.Flags.boolean({
190
+ summary: "Hide any uncommitted changes."
191
+ }),
192
+ force: _core.Flags.boolean({
193
+ summary: "Remove the confirmation prompt."
194
+ })
186
195
  };
187
- WorkflowPull.args = [
188
- {
189
- name: "workflowKey",
196
+ WorkflowPull.args = {
197
+ workflowKey: _core.Args.string({
190
198
  required: false
191
- }
192
- ];
199
+ })
200
+ };
@@ -116,6 +116,7 @@ class WorkflowPush extends _baseCommand.default {
116
116
  this.log(`‣ Successfully ${actioned} ${workflows.length} workflow(s):\n` + (0, _string.indentString)(workflowKeys.join("\n"), 4));
117
117
  }
118
118
  }
119
+ WorkflowPush.summary = "Push one or more workflows from a local file system to Knock.";
119
120
  WorkflowPush.flags = {
120
121
  environment: _core.Flags.string({
121
122
  summary: "Pushing a workflow is only allowed in the development environment",
@@ -124,8 +125,11 @@ WorkflowPush.flags = {
124
125
  _const.KnockEnv.Development
125
126
  ]
126
127
  }),
127
- all: _core.Flags.boolean(),
128
+ all: _core.Flags.boolean({
129
+ summary: "Whether to push all workflows from the target directory."
130
+ }),
128
131
  "workflows-dir": _flag.dirPath({
132
+ summary: "The target directory path to find all workflows to push.",
129
133
  dependsOn: [
130
134
  "all"
131
135
  ]
@@ -141,9 +145,8 @@ WorkflowPush.flags = {
141
145
  ]
142
146
  })
143
147
  };
144
- WorkflowPush.args = [
145
- {
146
- name: "workflowKey",
148
+ WorkflowPush.args = {
149
+ workflowKey: _core.Args.string({
147
150
  required: false
148
- }
149
- ];
151
+ })
152
+ };
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: ()=>WorkflowRun
8
+ });
9
+ const _core = require("@oclif/core");
10
+ const _baseCommand = /*#__PURE__*/ _interopRequireDefault(require("../../lib/base-command"));
11
+ const _flag = require("../../lib/helpers/flag");
12
+ const _request = require("../../lib/helpers/request");
13
+ const _string = require("../../lib/helpers/string");
14
+ function _interopRequireDefault(obj) {
15
+ return obj && obj.__esModule ? obj : {
16
+ default: obj
17
+ };
18
+ }
19
+ class WorkflowRun extends _baseCommand.default {
20
+ async run() {
21
+ const { args , flags } = this.props;
22
+ const resp = await (0, _request.withSpinner)(()=>this.apiV1.runWorkflow(this.props), {
23
+ action: "‣ Running"
24
+ });
25
+ this.log(`‣ Successfully ran \`${args.workflowKey}\` workflow in \`${flags.environment}\` environment`);
26
+ this.log((0, _string.indentString)(`Workflow run id: ${resp.data.workflow_run_id}`), 4);
27
+ }
28
+ }
29
+ WorkflowRun.summary = "Test run a workflow using the latest version from Knock, or a local workflow directory.";
30
+ WorkflowRun.flags = {
31
+ environment: _core.Flags.string({
32
+ default: "development",
33
+ summary: "The environment in which to run the workflow"
34
+ }),
35
+ recipients: _core.Flags.string({
36
+ required: true,
37
+ aliases: [
38
+ "recipient"
39
+ ],
40
+ summary: "One or more recipient ids for this workflow run, separated by comma.",
41
+ multiple: true,
42
+ delimiter: ","
43
+ }),
44
+ actor: _core.Flags.string({
45
+ summary: "An actor id for the workflow run."
46
+ }),
47
+ tenant: _core.Flags.string({
48
+ summary: "A tenant id for the workflow run."
49
+ }),
50
+ data: (0, _flag.jsonStr)({
51
+ summary: "A JSON string of the data for this workflow"
52
+ })
53
+ };
54
+ WorkflowRun.args = {
55
+ workflowKey: _core.Args.string({
56
+ required: true
57
+ })
58
+ };
@@ -103,6 +103,7 @@ class WorkflowValidate extends _baseCommand.default {
103
103
  return errors;
104
104
  }
105
105
  }
106
+ WorkflowValidate.summary = "Validate one or more workflows from a local file system.";
106
107
  WorkflowValidate.flags = {
107
108
  environment: _core.Flags.string({
108
109
  summary: "Validating a workflow is only done in the development environment",
@@ -111,16 +112,18 @@ WorkflowValidate.flags = {
111
112
  _const.KnockEnv.Development
112
113
  ]
113
114
  }),
114
- all: _core.Flags.boolean(),
115
+ all: _core.Flags.boolean({
116
+ summary: "Whether to validate all workflows from the target directory."
117
+ }),
115
118
  "workflows-dir": _flag.dirPath({
119
+ summary: "The target directory path to find all workflows to validate.",
116
120
  dependsOn: [
117
121
  "all"
118
122
  ]
119
123
  })
120
124
  };
121
- WorkflowValidate.args = [
122
- {
123
- name: "workflowKey",
125
+ WorkflowValidate.args = {
126
+ workflowKey: _core.Args.string({
124
127
  required: false
125
- }
126
- ];
128
+ })
129
+ };
@@ -79,6 +79,18 @@ class ApiV1 {
79
79
  params
80
80
  });
81
81
  }
82
+ async runWorkflow({ args , flags }) {
83
+ const params = (0, _object.prune)({
84
+ environment: flags.environment,
85
+ recipients: flags.recipients,
86
+ tenant: flags.tenant,
87
+ data: flags.data,
88
+ actor: flags.actor
89
+ });
90
+ return this.put(`/workflows/${args.workflowKey}/run`, {}, {
91
+ params
92
+ });
93
+ }
82
94
  // By resources: Commits
83
95
  async commitAllChanges({ flags }) {
84
96
  const params = (0, _object.prune)({
@@ -60,21 +60,25 @@ class BaseCommand extends _core.Command {
60
60
  // 1. Load user's config from the config dir, as available.
61
61
  await _userConfig.default.load(this.config.configDir);
62
62
  // 2. Parse flags and args, must come after the user config load.
63
- this.props = await this.parse(this.constructor);
63
+ const { args , flags } = await this.parse(this.ctor);
64
+ this.props = {
65
+ args: args,
66
+ flags: flags
67
+ };
64
68
  // 3. Instantiate a knock api client.
65
69
  this.apiV1 = new _apiV1.default(this.props.flags, this.config);
66
70
  // 4. Load the run context of the invoked command.
67
71
  this.runContext = await _runContext.load(this.id);
68
72
  }
69
73
  }
70
- // Global flags are inherited by any command that extends BaseCommand.
71
- BaseCommand.globalFlags = {
74
+ // Base flags are inherited by any command that extends BaseCommand.
75
+ BaseCommand.baseFlags = {
72
76
  // Evaluated in the following precedence:
73
77
  // - service token flag passed into the command
74
78
  // - if not provided, fall back to env variable
75
79
  // - if not available, fall back to user config
76
80
  "service-token": _core.Flags.string({
77
- summary: "The service token to authenticate with",
81
+ summary: "The service token to authenticate with.",
78
82
  required: true,
79
83
  multiple: false,
80
84
  env: "KNOCK_SERVICE_TOKEN",
@@ -10,7 +10,8 @@ function _export(target, all) {
10
10
  }
11
11
  _export(exports, {
12
12
  booleanStr: ()=>booleanStr,
13
- dirPath: ()=>dirPath
13
+ dirPath: ()=>dirPath,
14
+ jsonStr: ()=>jsonStr
14
15
  });
15
16
  const _nodePath = /*#__PURE__*/ _interopRequireWildcard(require("node:path"));
16
17
  const _core = require("@oclif/core");
@@ -74,3 +75,13 @@ const dirPath = _core.Flags.custom({
74
75
  };
75
76
  }
76
77
  });
78
+ const jsonStr = _core.Flags.custom({
79
+ parse: async (input)=>{
80
+ try {
81
+ const data = JSON.parse(input);
82
+ return data;
83
+ } catch {
84
+ throw new Error(`${input} is not a valid JSON string.`);
85
+ }
86
+ }
87
+ });
@@ -28,9 +28,14 @@ function _interopRequireDefault(obj) {
28
28
  }
29
29
  const MAX_PAGINATION_LIMIT = 100;
30
30
  const pageFlags = {
31
- after: _core.Flags.string(),
32
- before: _core.Flags.string(),
31
+ after: _core.Flags.string({
32
+ summary: "The cursor after which to fetch the next page."
33
+ }),
34
+ before: _core.Flags.string({
35
+ summary: "The cursor before which to fetch the previous page."
36
+ }),
33
37
  limit: _core.Flags.integer({
38
+ summary: "The total number of entries to fetch per page.",
34
39
  max: MAX_PAGINATION_LIMIT
35
40
  })
36
41
  };
@@ -38,7 +38,7 @@ const withSpinner = async (requestFn, opts = {})=>{
38
38
  // Error out before the action stop so the spinner can update accordingly.
39
39
  if (ensureSuccess && !isSuccessResp(resp)) {
40
40
  const message = formatErrorRespMessage(resp);
41
- _core.CliUx.ux.error(new _error.ApiError(message));
41
+ _core.ux.error(new _error.ApiError(message));
42
42
  }
43
43
  _ux.spinner.stop();
44
44
  return resp;
@@ -34,9 +34,9 @@ const promptToConfirm = async (message)=>{
34
34
  };
35
35
  const spinner = {
36
36
  start (action) {
37
- if (!_const.isTestEnv) _core.CliUx.ux.action.start(action);
37
+ if (!_const.isTestEnv) _core.ux.action.start(action);
38
38
  },
39
39
  stop () {
40
- _core.CliUx.ux.action.stop();
40
+ _core.ux.action.stop();
41
41
  }
42
42
  };
@@ -9,6 +9,7 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
+ translationRefDescription: ()=>translationRefDescription,
12
13
  formatLanguage: ()=>formatLanguage,
13
14
  formatRef: ()=>formatRef,
14
15
  isValidLocale: ()=>isValidLocale,
@@ -67,6 +68,11 @@ function _interopRequireWildcard(obj, nodeInterop) {
67
68
  }
68
69
  return newObj;
69
70
  }
71
+ const translationRefDescription = `
72
+ Translation ref is a identifier string that refers to a unique translation.
73
+ If a translation has no namespace, it is the same as the locale, e.g. \`en\`.
74
+ If namespaced, it is formatted as namespace.locale, e.g. \`admin.en\`.
75
+ `.trim();
70
76
  const formatLanguage = (translation)=>{
71
77
  const lang = _localeCodes.default.getByTag(translation.locale_code);
72
78
  return lang.location ? `${lang.name}, ${lang.location}` : lang.name;
@@ -113,11 +119,11 @@ const ensureValidCommandTarget = async (props, runContext)=>{
113
119
  const { commandId , resourceDir: resourceDirCtx , cwd: runCwd } = runContext;
114
120
  // Error, trying to run the command not in a translation directory.
115
121
  if (resourceDirCtx && resourceDirCtx.type !== "translation") {
116
- return _core.CliUx.ux.error(`Cannot run ${commandId} inside a ${resourceDirCtx.type} directory`);
122
+ return _core.ux.error(`Cannot run ${commandId} inside a ${resourceDirCtx.type} directory`);
117
123
  }
118
124
  // Error, got neither the translationRef arg nor the --all flag.
119
125
  if (!args.translationRef && !flags.all) {
120
- _core.CliUx.ux.error("At least one of translation ref arg or --all flag must be given");
126
+ _core.ux.error("At least one of translation ref arg or --all flag must be given");
121
127
  }
122
128
  // No translationRef arg, which means --all flag is used.
123
129
  if (!args.translationRef) {
@@ -143,12 +149,12 @@ const ensureValidCommandTarget = async (props, runContext)=>{
143
149
  // From this point on, we have translationRef so parse and validate the format.
144
150
  const parsedRef = parseTranslationRef(args.translationRef);
145
151
  if (!parsedRef) {
146
- return _core.CliUx.ux.error(`Invalid translation ref \`${args.translationRef}\`, use valid <locale> or <namespace>.<locale> for namespaced translations`);
152
+ return _core.ux.error(`Invalid translation ref \`${args.translationRef}\`, use valid <locale> or <namespace>.<locale> for namespaced translations`);
147
153
  }
148
154
  const { localeCode , namespace } = parsedRef;
149
155
  // If we are in the translation dir, make sure the locale matches.
150
156
  if (resourceDirCtx && resourceDirCtx.key !== localeCode) {
151
- return _core.CliUx.ux.error(`Cannot run ${commandId} with \`${args.translationRef}\` inside a ${resourceDirCtx.key} directory`);
157
+ return _core.ux.error(`Cannot run ${commandId} with \`${args.translationRef}\` inside a ${resourceDirCtx.key} directory`);
152
158
  }
153
159
  const targetDirPath = resourceDirCtx ? resourceDirCtx.abspath : _nodePath.resolve(runCwd, localeCode);
154
160
  // Got translationRef arg but no --all flag, which means target only a single
@@ -163,7 +169,7 @@ const ensureValidCommandTarget = async (props, runContext)=>{
163
169
  // From this point on, we have both translationRef and --all flag used
164
170
  // together, so make sure we are targeting a non-namespaced top-level locale.
165
171
  if (namespace) {
166
- return _core.CliUx.ux.error(`Cannot use --all with a namespaced translation \`${args.translationRef}\``);
172
+ return _core.ux.error(`Cannot use --all with a namespaced translation \`${args.translationRef}\``);
167
173
  }
168
174
  const translationDirCtx = {
169
175
  type: "translation",
@@ -92,7 +92,7 @@ const readAllForCommandTarget = async (target)=>{
92
92
  const { type: targetType , context: targetCtx } = target;
93
93
  if (!targetCtx.exists) {
94
94
  const subject = targetType === "translationFile" ? "a translation file at" : "translation files in";
95
- return _core.CliUx.ux.error(`Cannot locate ${subject} \`${targetCtx.abspath}\``);
95
+ return _core.ux.error(`Cannot locate ${subject} \`${targetCtx.abspath}\``);
96
96
  }
97
97
  switch(targetType){
98
98
  case "translationFile":
@@ -159,18 +159,18 @@ const ensureValidCommandTarget = async (props, runContext)=>{
159
159
  // If the target resource is a different type than the current resource dir
160
160
  // type, error out.
161
161
  if (resourceDirCtx && resourceDirCtx.type !== "workflow") {
162
- return _core.CliUx.ux.error(`Cannot run ${commandId} inside a ${resourceDirCtx.type} directory`);
162
+ return _core.ux.error(`Cannot run ${commandId} inside a ${resourceDirCtx.type} directory`);
163
163
  }
164
164
  // Cannot accept both workflow key arg and --all flag.
165
165
  if (flags.all && args.workflowKey) {
166
- return _core.CliUx.ux.error(`workflowKey arg \`${args.workflowKey}\` cannot also be provided when using --all`);
166
+ return _core.ux.error(`workflowKey arg \`${args.workflowKey}\` cannot also be provided when using --all`);
167
167
  }
168
168
  // --all flag is given, which means no workflow key arg.
169
169
  if (flags.all) {
170
170
  // If --all flag used inside a workflow directory, then require a workflows
171
171
  // dir path.
172
172
  if (resourceDirCtx && !flags["workflows-dir"]) {
173
- return _core.CliUx.ux.error("Missing required flag workflows-dir");
173
+ return _core.ux.error("Missing required flag workflows-dir");
174
174
  }
175
175
  // Targeting all workflow dirs in the workflows index dir.
176
176
  // TODO: Default to the knock project config first if present before cwd.
@@ -187,7 +187,7 @@ const ensureValidCommandTarget = async (props, runContext)=>{
187
187
  // Workflow key arg is given, which means no --all flag.
188
188
  if (args.workflowKey) {
189
189
  if (resourceDirCtx && resourceDirCtx.key !== args.workflowKey) {
190
- return _core.CliUx.ux.error(`Cannot run ${commandId} \`${args.workflowKey}\` inside another workflow directory:\n${resourceDirCtx.key}`);
190
+ return _core.ux.error(`Cannot run ${commandId} \`${args.workflowKey}\` inside another workflow directory:\n${resourceDirCtx.key}`);
191
191
  }
192
192
  const targetDirPath = resourceDirCtx ? resourceDirCtx.abspath : _nodePath.resolve(runCwd, args.workflowKey);
193
193
  const workflowDirCtx = {
@@ -209,5 +209,5 @@ const ensureValidCommandTarget = async (props, runContext)=>{
209
209
  context: resourceDirCtx
210
210
  };
211
211
  }
212
- return _core.CliUx.ux.error("Missing 1 required arg:\nworkflowKey");
212
+ return _core.ux.error("Missing 1 required arg:\nworkflowKey");
213
213
  };
@@ -278,7 +278,7 @@ const readAllForCommandTarget = async (target, opts = {})=>{
278
278
  const { type: targetType , context: targetCtx } = target;
279
279
  if (!targetCtx.exists) {
280
280
  const subject = targetType === "workflowDir" ? "a workflow directory at" : "workflow directories in";
281
- return _core.CliUx.ux.error(`Cannot locate ${subject} \`${targetCtx.abspath}\``);
281
+ return _core.ux.error(`Cannot locate ${subject} \`${targetCtx.abspath}\``);
282
282
  }
283
283
  switch(targetType){
284
284
  case "workflowDir":
@@ -11,7 +11,7 @@ const ensureResourceDirForTarget = (resourceDirCtx, target)=>{
11
11
  // If the target resource is a different type than the current resource dir
12
12
  // type, error out.
13
13
  if (resourceDirCtx.type !== target.type) {
14
- return _core.CliUx.ux.error(`Cannot run ${target.commandId} inside a ${resourceDirCtx.type} directory`);
14
+ return _core.ux.error(`Cannot run ${target.commandId} inside a ${resourceDirCtx.type} directory`);
15
15
  }
16
16
  // If the resource key was not provided with the command, then infer from the
17
17
  // current resource directory context.
@@ -23,5 +23,5 @@ const ensureResourceDirForTarget = (resourceDirCtx, target)=>{
23
23
  if (target.key === resourceDirCtx.key) {
24
24
  return resourceDirCtx;
25
25
  }
26
- return _core.CliUx.ux.error(`Cannot run ${target.commandId} \`${target.key}\` inside another ${resourceDirCtx.type} directory:\n${resourceDirCtx.key}`);
26
+ return _core.ux.error(`Cannot run ${target.commandId} \`${target.key}\` inside another ${resourceDirCtx.type} directory:\n${resourceDirCtx.key}`);
27
27
  };