@knocklabs/cli 0.2.1 → 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.
Files changed (64) hide show
  1. package/README.md +258 -36
  2. package/dist/commands/branch/create.js +1 -1
  3. package/dist/commands/branch/delete.js +1 -1
  4. package/dist/commands/branch/exit.js +44 -0
  5. package/dist/commands/branch/switch.js +161 -0
  6. package/dist/commands/commit/get.js +4 -4
  7. package/dist/commands/commit/index.js +47 -2
  8. package/dist/commands/commit/list.js +61 -13
  9. package/dist/commands/guide/activate.js +48 -4
  10. package/dist/commands/guide/generate-types.js +4 -1
  11. package/dist/commands/guide/get.js +46 -3
  12. package/dist/commands/guide/list.js +46 -3
  13. package/dist/commands/guide/pull.js +6 -4
  14. package/dist/commands/guide/push.js +4 -3
  15. package/dist/commands/guide/validate.js +4 -3
  16. package/dist/commands/layout/get.js +46 -1
  17. package/dist/commands/layout/list.js +46 -1
  18. package/dist/commands/layout/pull.js +6 -2
  19. package/dist/commands/layout/push.js +4 -1
  20. package/dist/commands/layout/validate.js +4 -1
  21. package/dist/commands/login.js +1 -0
  22. package/dist/commands/logout.js +1 -0
  23. package/dist/commands/message-type/get.js +46 -3
  24. package/dist/commands/message-type/list.js +46 -3
  25. package/dist/commands/message-type/pull.js +6 -4
  26. package/dist/commands/message-type/push.js +4 -3
  27. package/dist/commands/message-type/validate.js +4 -3
  28. package/dist/commands/partial/get.js +46 -1
  29. package/dist/commands/partial/list.js +46 -1
  30. package/dist/commands/partial/pull.js +6 -2
  31. package/dist/commands/partial/push.js +4 -1
  32. package/dist/commands/partial/validate.js +6 -1
  33. package/dist/commands/pull.js +28 -8
  34. package/dist/commands/push.js +27 -8
  35. package/dist/commands/translation/get.js +5 -1
  36. package/dist/commands/translation/list.js +5 -1
  37. package/dist/commands/translation/pull.js +8 -3
  38. package/dist/commands/translation/push.js +4 -1
  39. package/dist/commands/translation/validate.js +4 -1
  40. package/dist/commands/workflow/activate.js +47 -3
  41. package/dist/commands/workflow/generate-types.js +4 -1
  42. package/dist/commands/workflow/get.js +9 -4
  43. package/dist/commands/workflow/list.js +5 -1
  44. package/dist/commands/workflow/pull.js +6 -2
  45. package/dist/commands/workflow/push.js +4 -1
  46. package/dist/commands/workflow/run.js +46 -2
  47. package/dist/commands/workflow/validate.js +4 -1
  48. package/dist/lib/api-v1.js +35 -12
  49. package/dist/lib/helpers/arg.js +6 -5
  50. package/dist/lib/helpers/branch.js +124 -0
  51. package/dist/lib/helpers/command.js +14 -0
  52. package/dist/lib/helpers/error.js +5 -0
  53. package/dist/lib/helpers/flag.js +23 -0
  54. package/dist/lib/helpers/git.js +25 -0
  55. package/dist/lib/helpers/request.js +1 -1
  56. package/dist/lib/helpers/string.js +4 -0
  57. package/dist/lib/marshal/commit/index.js +0 -1
  58. package/dist/lib/marshal/translation/helpers.js +1 -1
  59. package/dist/lib/resources.js +6 -1
  60. package/dist/lib/urls.js +4 -0
  61. package/oclif.manifest.json +414 -50
  62. package/package.json +15 -5
  63. package/dist/commands/ping.js +0 -37
  64. package/dist/lib/marshal/commit/types.js +0 -5
@@ -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
+ });
@@ -33,10 +33,10 @@ function _interop_require_default(obj) {
33
33
  }
34
34
  class CommitGet extends _basecommand.default {
35
35
  async run() {
36
- const { flags } = this.props;
37
- const resp = await (0, _request.withSpinner)(()=>this.apiV1.getCommit(this.props));
38
- if (flags.json) return resp.data;
39
- this.render(resp.data);
36
+ const { flags, args } = this.props;
37
+ const resp = await (0, _request.withSpinnerV2)(()=>this.apiV1.mgmtClient.commits.retrieve(args.id));
38
+ if (flags.json) return resp;
39
+ this.render(resp);
40
40
  }
41
41
  render(commit) {
42
42
  this.log(`‣ Showing commit \`${commit.id}\` in \`${commit.environment}\` environment`);
@@ -10,7 +10,9 @@ Object.defineProperty(exports, "default", {
10
10
  });
11
11
  const _core = require("@oclif/core");
12
12
  const _basecommand = /*#__PURE__*/ _interop_require_default(require("../../lib/base-command"));
13
+ const _command = require("../../lib/helpers/command");
13
14
  const _const = require("../../lib/helpers/const");
15
+ const _flag = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/helpers/flag"));
14
16
  const _request = require("../../lib/helpers/request");
15
17
  const _ux = require("../../lib/helpers/ux");
16
18
  function _define_property(obj, key, value) {
@@ -31,16 +33,58 @@ function _interop_require_default(obj) {
31
33
  default: obj
32
34
  };
33
35
  }
36
+ function _getRequireWildcardCache(nodeInterop) {
37
+ if (typeof WeakMap !== "function") return null;
38
+ var cacheBabelInterop = new WeakMap();
39
+ var cacheNodeInterop = new WeakMap();
40
+ return (_getRequireWildcardCache = function(nodeInterop) {
41
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
42
+ })(nodeInterop);
43
+ }
44
+ function _interop_require_wildcard(obj, nodeInterop) {
45
+ if (!nodeInterop && obj && obj.__esModule) {
46
+ return obj;
47
+ }
48
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
49
+ return {
50
+ default: obj
51
+ };
52
+ }
53
+ var cache = _getRequireWildcardCache(nodeInterop);
54
+ if (cache && cache.has(obj)) {
55
+ return cache.get(obj);
56
+ }
57
+ var newObj = {
58
+ __proto__: null
59
+ };
60
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
61
+ for(var key in obj){
62
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
63
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
64
+ if (desc && (desc.get || desc.set)) {
65
+ Object.defineProperty(newObj, key, desc);
66
+ } else {
67
+ newObj[key] = obj[key];
68
+ }
69
+ }
70
+ }
71
+ newObj.default = obj;
72
+ if (cache) {
73
+ cache.set(obj, newObj);
74
+ }
75
+ return newObj;
76
+ }
34
77
  class Commit extends _basecommand.default {
35
78
  async run() {
36
79
  const { flags } = this.props;
80
+ const scope = (0, _command.formatCommandScope)(flags);
37
81
  // Confirm first as we are about to commit changes to go live in the
38
82
  // development environment, unless forced.
39
- const prompt = "Commit all changes in the development environment?";
83
+ const prompt = `Commit all changes in the ${scope}?`;
40
84
  const input = flags.force || await (0, _ux.promptToConfirm)(prompt);
41
85
  if (!input) return;
42
86
  await (0, _request.withSpinner)(()=>this.apiV1.commitAllChanges(this.props));
43
- this.log(`‣ Successfully committed all changes in \`${flags.environment}\` environment`);
87
+ this.log(`‣ Successfully committed all changes in ${scope}`);
44
88
  }
45
89
  }
46
90
  _define_property(Commit, "summary", "Commit all changes in development environment.");
@@ -52,6 +96,7 @@ _define_property(Commit, "flags", {
52
96
  _const.KnockEnv.Development
53
97
  ]
54
98
  }),
99
+ branch: _flag.branch,
55
100
  "commit-message": _core.Flags.string({
56
101
  summary: "Use the given value as the commit message.",
57
102
  char: "m"
@@ -10,7 +10,9 @@ Object.defineProperty(exports, "default", {
10
10
  });
11
11
  const _core = require("@oclif/core");
12
12
  const _basecommand = /*#__PURE__*/ _interop_require_default(require("../../lib/base-command"));
13
+ const _command = require("../../lib/helpers/command");
13
14
  const _date = require("../../lib/helpers/date");
15
+ const _flag = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/helpers/flag"));
14
16
  const _objectisomorphic = require("../../lib/helpers/object.isomorphic");
15
17
  const _page = require("../../lib/helpers/page");
16
18
  const _request = require("../../lib/helpers/request");
@@ -33,6 +35,47 @@ function _interop_require_default(obj) {
33
35
  default: obj
34
36
  };
35
37
  }
38
+ function _getRequireWildcardCache(nodeInterop) {
39
+ if (typeof WeakMap !== "function") return null;
40
+ var cacheBabelInterop = new WeakMap();
41
+ var cacheNodeInterop = new WeakMap();
42
+ return (_getRequireWildcardCache = function(nodeInterop) {
43
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
44
+ })(nodeInterop);
45
+ }
46
+ function _interop_require_wildcard(obj, nodeInterop) {
47
+ if (!nodeInterop && obj && obj.__esModule) {
48
+ return obj;
49
+ }
50
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
51
+ return {
52
+ default: obj
53
+ };
54
+ }
55
+ var cache = _getRequireWildcardCache(nodeInterop);
56
+ if (cache && cache.has(obj)) {
57
+ return cache.get(obj);
58
+ }
59
+ var newObj = {
60
+ __proto__: null
61
+ };
62
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
63
+ for(var key in obj){
64
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
65
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
66
+ if (desc && (desc.get || desc.set)) {
67
+ Object.defineProperty(newObj, key, desc);
68
+ } else {
69
+ newObj[key] = obj[key];
70
+ }
71
+ }
72
+ }
73
+ newObj.default = obj;
74
+ if (cache) {
75
+ cache.set(obj, newObj);
76
+ }
77
+ return newObj;
78
+ }
36
79
  class CommitList extends _basecommand.default {
37
80
  async run() {
38
81
  // Validate that resource-type and resource-id are used together
@@ -56,7 +99,7 @@ class CommitList extends _basecommand.default {
56
99
  }
57
100
  async render(data) {
58
101
  const { entries } = data;
59
- const { environment: env, promoted } = this.props.flags;
102
+ const { promoted } = this.props.flags;
60
103
  let qualifier = "";
61
104
  if (promoted === true) {
62
105
  qualifier = "(showing only promoted)";
@@ -64,32 +107,36 @@ class CommitList extends _basecommand.default {
64
107
  if (promoted === false) {
65
108
  qualifier = "(showing only unpromoted)";
66
109
  }
67
- this.log(`‣ Showing ${entries.length} commits in \`${env}\` environment ${qualifier}\n`);
110
+ const scope = (0, _command.formatCommandScope)(this.props.flags);
111
+ this.log(`‣ Showing ${entries.length} commits in ${scope} ${qualifier}\n`);
68
112
  /*
69
113
  * Commits table
70
- */ _core.ux.table(entries, {
114
+ */ const formattedEntries = entries.map((entry)=>({
115
+ id: entry.id,
116
+ resource: entry.resource.type,
117
+ identifier: entry.resource.identifier,
118
+ author: (0, _commit.formatCommitAuthor)(entry),
119
+ commit_message: entry.commit_message ? entry.commit_message.trim() : "",
120
+ created_at: (0, _date.formatDate)(entry.created_at)
121
+ }));
122
+ _core.ux.table(formattedEntries, {
71
123
  id: {
72
124
  header: "ID"
73
125
  },
74
126
  resource: {
75
- header: "Resource",
76
- get: (entry)=>entry.resource.type
127
+ header: "Resource"
77
128
  },
78
129
  identifier: {
79
- header: "Identifier",
80
- get: (entry)=>entry.resource.identifier
130
+ header: "Identifier"
81
131
  },
82
132
  author: {
83
- header: "Author",
84
- get: (entry)=>(0, _commit.formatCommitAuthor)(entry)
133
+ header: "Author"
85
134
  },
86
135
  commit_message: {
87
- header: "Commit message",
88
- get: (entry)=>entry.commit_message ? entry.commit_message.trim() : ""
136
+ header: "Commit message"
89
137
  },
90
138
  created_at: {
91
- header: "Created at",
92
- get: (entry)=>(0, _date.formatDate)(entry.created_at)
139
+ header: "Created at"
93
140
  }
94
141
  });
95
142
  return this.prompt(data);
@@ -111,6 +158,7 @@ _define_property(CommitList, "flags", {
111
158
  default: "development",
112
159
  summary: "The environment to use."
113
160
  }),
161
+ branch: _flag.branch,
114
162
  promoted: _core.Flags.boolean({
115
163
  summary: "Show only promoted or unpromoted changes between the given environment and the subsequent environment.",
116
164
  allowNo: true
@@ -10,7 +10,8 @@ Object.defineProperty(exports, "default", {
10
10
  });
11
11
  const _core = require("@oclif/core");
12
12
  const _basecommand = /*#__PURE__*/ _interop_require_default(require("../../lib/base-command"));
13
- const _flag = require("../../lib/helpers/flag");
13
+ const _command = require("../../lib/helpers/command");
14
+ const _flag = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/helpers/flag"));
14
15
  const _request = require("../../lib/helpers/request");
15
16
  const _ux = require("../../lib/helpers/ux");
16
17
  function _define_property(obj, key, value) {
@@ -31,9 +32,51 @@ function _interop_require_default(obj) {
31
32
  default: obj
32
33
  };
33
34
  }
35
+ function _getRequireWildcardCache(nodeInterop) {
36
+ if (typeof WeakMap !== "function") return null;
37
+ var cacheBabelInterop = new WeakMap();
38
+ var cacheNodeInterop = new WeakMap();
39
+ return (_getRequireWildcardCache = function(nodeInterop) {
40
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
41
+ })(nodeInterop);
42
+ }
43
+ function _interop_require_wildcard(obj, nodeInterop) {
44
+ if (!nodeInterop && obj && obj.__esModule) {
45
+ return obj;
46
+ }
47
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
48
+ return {
49
+ default: obj
50
+ };
51
+ }
52
+ var cache = _getRequireWildcardCache(nodeInterop);
53
+ if (cache && cache.has(obj)) {
54
+ return cache.get(obj);
55
+ }
56
+ var newObj = {
57
+ __proto__: null
58
+ };
59
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
60
+ for(var key in obj){
61
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
62
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
63
+ if (desc && (desc.get || desc.set)) {
64
+ Object.defineProperty(newObj, key, desc);
65
+ } else {
66
+ newObj[key] = obj[key];
67
+ }
68
+ }
69
+ }
70
+ newObj.default = obj;
71
+ if (cache) {
72
+ cache.set(obj, newObj);
73
+ }
74
+ return newObj;
75
+ }
34
76
  class GuideActivate extends _basecommand.default {
35
77
  async run() {
36
78
  const { args, flags } = this.props;
79
+ const scope = (0, _command.formatCommandScope)(flags);
37
80
  // Validate that either status OR from/until is provided
38
81
  const hasStatus = flags.status !== undefined;
39
82
  const hasFrom = Boolean(flags.from);
@@ -52,7 +95,7 @@ class GuideActivate extends _basecommand.default {
52
95
  action = `Deactivate at ${flags.until}`;
53
96
  }
54
97
  // 1. Confirm before activating or deactivating the guide, unless forced.
55
- const prompt = `${action} \`${args.guideKey}\` guide in \`${flags.environment}\` environment?`;
98
+ const prompt = `${action} \`${args.guideKey}\` guide in ${scope}?`;
56
99
  const input = flags.force || await (0, _ux.promptToConfirm)(prompt);
57
100
  if (!input) return;
58
101
  // 2. Proceed to make a request to set the guide status.
@@ -73,7 +116,7 @@ class GuideActivate extends _basecommand.default {
73
116
  } else {
74
117
  actioned = "scheduled";
75
118
  }
76
- this.log(`‣ Successfully ${actioned} \`${args.guideKey}\` guide in \`${flags.environment}\` environment`);
119
+ this.log(`‣ Successfully ${actioned} \`${args.guideKey}\` guide in ${scope}`);
77
120
  }
78
121
  }
79
122
  _define_property(GuideActivate, "summary", "Activate or deactivate a guide in a given environment.");
@@ -81,7 +124,7 @@ _define_property(GuideActivate, "description", `
81
124
  This enables or disables a guide in a given environment without
82
125
  needing to go through environment promotion.
83
126
 
84
- You can activate or deactivate a guide immediately or schedule it to be activated
127
+ You can activate or deactivate a guide immediately or schedule it to be activated
85
128
  or deactivated at a later time using the --from and --until flags.
86
129
  `.trim());
87
130
  _define_property(GuideActivate, "flags", {
@@ -91,6 +134,7 @@ _define_property(GuideActivate, "flags", {
91
134
  required: true,
92
135
  summary: "The environment to use."
93
136
  }),
137
+ branch: _flag.branch,
94
138
  status: (0, _flag.booleanStr)({
95
139
  summary: "The guide active status to set. Cannot be used with --from/--until.",
96
140
  exclusive: [
@@ -12,6 +12,7 @@ const _nodepath = /*#__PURE__*/ _interop_require_default(require("node:path"));
12
12
  const _core = require("@oclif/core");
13
13
  const _fsextra = /*#__PURE__*/ _interop_require_wildcard(require("fs-extra"));
14
14
  const _basecommand = /*#__PURE__*/ _interop_require_default(require("../../lib/base-command"));
15
+ const _command = require("../../lib/helpers/command");
15
16
  const _const = require("../../lib/helpers/const");
16
17
  const _error = require("../../lib/helpers/error");
17
18
  const _flag = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/helpers/flag"));
@@ -109,7 +110,8 @@ class GuideGenerateTypes extends _basecommand.default {
109
110
  const lines = _guide.generateIndexTypeTS(mapping);
110
111
  await _fsextra.appendFile(outputFilePath, lines.join("\n"));
111
112
  }
112
- this.log(`‣ Successfully generated types for ${count} message type(s) and wrote them to ${outputFilePath}`);
113
+ const scope = (0, _command.formatCommandScope)(flags);
114
+ this.log(`‣ Successfully generated types for ${count} message type(s) using ${scope} and wrote them to ${outputFilePath}`);
113
115
  }
114
116
  async listAllGuides(pageParams = {}, guidesFetchedSoFar = []) {
115
117
  const props = (0, _objectisomorphic.merge)(this.props, {
@@ -141,6 +143,7 @@ _define_property(GuideGenerateTypes, "flags", {
141
143
  summary: "Select the environment to generate types for.",
142
144
  default: _const.KnockEnv.Development
143
145
  }),
146
+ branch: _flag.branch,
144
147
  "output-file": _flag.filePath({
145
148
  summary: `The output file to write the generated types to. We currently support ${supportedExts} files only. Your file extension will determine the target language for the generated types.`,
146
149
  required: true
@@ -10,8 +10,10 @@ Object.defineProperty(exports, "default", {
10
10
  });
11
11
  const _core = require("@oclif/core");
12
12
  const _basecommand = /*#__PURE__*/ _interop_require_default(require("../../lib/base-command"));
13
+ const _command = require("../../lib/helpers/command");
13
14
  const _date = require("../../lib/helpers/date");
14
15
  const _error = require("../../lib/helpers/error");
16
+ const _flag = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/helpers/flag"));
15
17
  const _request = require("../../lib/helpers/request");
16
18
  const _ux = require("../../lib/helpers/ux");
17
19
  const _conditions = require("../../lib/marshal/conditions");
@@ -34,6 +36,47 @@ function _interop_require_default(obj) {
34
36
  default: obj
35
37
  };
36
38
  }
39
+ function _getRequireWildcardCache(nodeInterop) {
40
+ if (typeof WeakMap !== "function") return null;
41
+ var cacheBabelInterop = new WeakMap();
42
+ var cacheNodeInterop = new WeakMap();
43
+ return (_getRequireWildcardCache = function(nodeInterop) {
44
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
45
+ })(nodeInterop);
46
+ }
47
+ function _interop_require_wildcard(obj, nodeInterop) {
48
+ if (!nodeInterop && obj && obj.__esModule) {
49
+ return obj;
50
+ }
51
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
52
+ return {
53
+ default: obj
54
+ };
55
+ }
56
+ var cache = _getRequireWildcardCache(nodeInterop);
57
+ if (cache && cache.has(obj)) {
58
+ return cache.get(obj);
59
+ }
60
+ var newObj = {
61
+ __proto__: null
62
+ };
63
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
64
+ for(var key in obj){
65
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
66
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
67
+ if (desc && (desc.get || desc.set)) {
68
+ Object.defineProperty(newObj, key, desc);
69
+ } else {
70
+ newObj[key] = obj[key];
71
+ }
72
+ }
73
+ }
74
+ newObj.default = obj;
75
+ if (cache) {
76
+ cache.set(obj, newObj);
77
+ }
78
+ return newObj;
79
+ }
37
80
  class GuideGet extends _basecommand.default {
38
81
  async run() {
39
82
  _ux.spinner.start("‣ Loading");
@@ -57,7 +100,8 @@ class GuideGet extends _basecommand.default {
57
100
  const { guideKey } = this.props.args;
58
101
  const { environment: env, "hide-uncommitted-changes": committedOnly } = this.props.flags;
59
102
  const qualifier = env === "development" && !committedOnly ? "(including uncommitted)" : "";
60
- this.log(`‣ Showing guide \`${guideKey}\` in \`${env}\` environment ${qualifier}\n`);
103
+ const scope = (0, _command.formatCommandScope)(this.props.flags);
104
+ this.log(`‣ Showing guide \`${guideKey}\` in ${scope} ${qualifier}\n`);
61
105
  /*
62
106
  * Guide table
63
107
  */ const rows = [
@@ -120,13 +164,12 @@ class GuideGet extends _basecommand.default {
120
164
  }
121
165
  }
122
166
  _define_property(GuideGet, "summary", "Display a single guide from an environment.");
123
- // Hide until guides are released in GA.
124
- _define_property(GuideGet, "hidden", true);
125
167
  _define_property(GuideGet, "flags", {
126
168
  environment: _core.Flags.string({
127
169
  default: "development",
128
170
  summary: "The environment to use."
129
171
  }),
172
+ branch: _flag.branch,
130
173
  "hide-uncommitted-changes": _core.Flags.boolean({
131
174
  summary: "Hide any uncommitted changes."
132
175
  })
@@ -10,7 +10,9 @@ Object.defineProperty(exports, "default", {
10
10
  });
11
11
  const _core = require("@oclif/core");
12
12
  const _basecommand = /*#__PURE__*/ _interop_require_default(require("../../lib/base-command"));
13
+ const _command = require("../../lib/helpers/command");
13
14
  const _date = require("../../lib/helpers/date");
15
+ const _flag = /*#__PURE__*/ _interop_require_wildcard(require("../../lib/helpers/flag"));
14
16
  const _objectisomorphic = require("../../lib/helpers/object.isomorphic");
15
17
  const _page = require("../../lib/helpers/page");
16
18
  const _request = require("../../lib/helpers/request");
@@ -33,6 +35,47 @@ function _interop_require_default(obj) {
33
35
  default: obj
34
36
  };
35
37
  }
38
+ function _getRequireWildcardCache(nodeInterop) {
39
+ if (typeof WeakMap !== "function") return null;
40
+ var cacheBabelInterop = new WeakMap();
41
+ var cacheNodeInterop = new WeakMap();
42
+ return (_getRequireWildcardCache = function(nodeInterop) {
43
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
44
+ })(nodeInterop);
45
+ }
46
+ function _interop_require_wildcard(obj, nodeInterop) {
47
+ if (!nodeInterop && obj && obj.__esModule) {
48
+ return obj;
49
+ }
50
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
51
+ return {
52
+ default: obj
53
+ };
54
+ }
55
+ var cache = _getRequireWildcardCache(nodeInterop);
56
+ if (cache && cache.has(obj)) {
57
+ return cache.get(obj);
58
+ }
59
+ var newObj = {
60
+ __proto__: null
61
+ };
62
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
63
+ for(var key in obj){
64
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
65
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
66
+ if (desc && (desc.get || desc.set)) {
67
+ Object.defineProperty(newObj, key, desc);
68
+ } else {
69
+ newObj[key] = obj[key];
70
+ }
71
+ }
72
+ }
73
+ newObj.default = obj;
74
+ if (cache) {
75
+ cache.set(obj, newObj);
76
+ }
77
+ return newObj;
78
+ }
36
79
  class GuideList extends _basecommand.default {
37
80
  async run() {
38
81
  const resp = await this.request();
@@ -52,7 +95,8 @@ class GuideList extends _basecommand.default {
52
95
  const { entries } = data;
53
96
  const { environment: env, "hide-uncommitted-changes": committedOnly } = this.props.flags;
54
97
  const qualifier = env === "development" && !committedOnly ? "(including uncommitted)" : "";
55
- this.log(`‣ Showing ${entries.length} guides in \`${env}\` environment ${qualifier}\n`);
98
+ const scope = (0, _command.formatCommandScope)(this.props.flags);
99
+ this.log(`‣ Showing ${entries.length} guides in ${scope} ${qualifier}\n`);
56
100
  /*
57
101
  * Guides list table
58
102
  */ _core.ux.table(entries, {
@@ -97,13 +141,12 @@ class GuideList extends _basecommand.default {
97
141
  }
98
142
  }
99
143
  _define_property(GuideList, "summary", "Display all guides for an environment.");
100
- // Hide until guides are released in GA.
101
- _define_property(GuideList, "hidden", true);
102
144
  _define_property(GuideList, "flags", {
103
145
  environment: _core.Flags.string({
104
146
  default: "development",
105
147
  summary: "The environment to use."
106
148
  }),
149
+ branch: _flag.branch,
107
150
  "hide-uncommitted-changes": _core.Flags.boolean({
108
151
  summary: "Hide any uncommitted changes."
109
152
  }),