@teambit/cli 0.0.590 → 0.0.592

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 (38) hide show
  1. package/dist/cli-parser.js +21 -106
  2. package/dist/cli-parser.js.map +1 -1
  3. package/dist/cli.aspect.js +0 -6
  4. package/dist/cli.aspect.js.map +1 -1
  5. package/dist/cli.cmd.js +3 -44
  6. package/dist/cli.cmd.js.map +1 -1
  7. package/dist/cli.composition.js +0 -6
  8. package/dist/cli.composition.js.map +1 -1
  9. package/dist/cli.main.runtime.js +11 -79
  10. package/dist/cli.main.runtime.js.map +1 -1
  11. package/dist/command-runner.js +6 -73
  12. package/dist/command-runner.js.map +1 -1
  13. package/dist/completion.cmd.js +0 -7
  14. package/dist/completion.cmd.js.map +1 -1
  15. package/dist/exceptions/already-exists.js +0 -6
  16. package/dist/exceptions/already-exists.js.map +1 -1
  17. package/dist/exceptions/command-not-found.js +0 -16
  18. package/dist/exceptions/command-not-found.js.map +1 -1
  19. package/dist/exceptions/index.js +0 -3
  20. package/dist/exceptions/index.js.map +1 -1
  21. package/dist/generate-doc-md.js +0 -33
  22. package/dist/generate-doc-md.js.map +1 -1
  23. package/dist/get-command-id.js +0 -3
  24. package/dist/get-command-id.js.map +1 -1
  25. package/dist/help.cmd.js +1 -12
  26. package/dist/help.cmd.js.map +1 -1
  27. package/dist/help.js +0 -23
  28. package/dist/help.js.map +1 -1
  29. package/dist/index.js +0 -11
  30. package/dist/index.js.map +1 -1
  31. package/dist/legacy-command-adapter.js +0 -14
  32. package/dist/legacy-command-adapter.js.map +1 -1
  33. package/dist/yargs-adapter.js +6 -41
  34. package/dist/yargs-adapter.js.map +1 -1
  35. package/package-tar/teambit-cli-0.0.592.tgz +0 -0
  36. package/package.json +5 -5
  37. package/{preview-1666312873430.js → preview-1666669368175.js} +2 -2
  38. package/package-tar/teambit-cli-0.0.590.tgz +0 -0
package/dist/cli.cmd.js CHANGED
@@ -1,89 +1,64 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  require("core-js/modules/es.promise.js");
6
-
7
5
  require("core-js/modules/es.regexp.exec.js");
8
-
9
6
  require("core-js/modules/es.string.trim.js");
10
-
11
7
  Object.defineProperty(exports, "__esModule", {
12
8
  value: true
13
9
  });
14
10
  exports.CliGenerateCmd = exports.CliCmd = void 0;
15
-
16
11
  function _defineProperty2() {
17
12
  const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
18
-
19
13
  _defineProperty2 = function () {
20
14
  return data;
21
15
  };
22
-
23
16
  return data;
24
17
  }
25
-
26
18
  function _logger() {
27
19
  const data = _interopRequireDefault(require("@teambit/legacy/dist/logger/logger"));
28
-
29
20
  _logger = function () {
30
21
  return data;
31
22
  };
32
-
33
23
  return data;
34
24
  }
35
-
36
25
  function _handleErrors() {
37
26
  const data = require("@teambit/legacy/dist/cli/handle-errors");
38
-
39
27
  _handleErrors = function () {
40
28
  return data;
41
29
  };
42
-
43
30
  return data;
44
31
  }
45
-
46
32
  function _consumer() {
47
33
  const data = require("@teambit/legacy/dist/consumer");
48
-
49
34
  _consumer = function () {
50
35
  return data;
51
36
  };
52
-
53
37
  return data;
54
38
  }
55
-
56
39
  function _readline() {
57
40
  const data = _interopRequireDefault(require("readline"));
58
-
59
41
  _readline = function () {
60
42
  return data;
61
43
  };
62
-
63
44
  return data;
64
45
  }
65
-
66
46
  function _cliParser() {
67
47
  const data = require("./cli-parser");
68
-
69
48
  _cliParser = function () {
70
49
  return data;
71
50
  };
72
-
73
51
  return data;
74
52
  }
75
-
76
53
  function _generateDocMd() {
77
54
  const data = require("./generate-doc-md");
78
-
79
55
  _generateDocMd = function () {
80
56
  return data;
81
57
  };
82
-
83
58
  return data;
84
59
  }
85
-
86
60
  // eslint-disable-next-line max-classes-per-file
61
+
87
62
  class CliGenerateCmd {
88
63
  constructor(cliMain) {
89
64
  this.cliMain = cliMain;
@@ -94,7 +69,6 @@ class CliGenerateCmd {
94
69
  (0, _defineProperty2().default)(this, "group", 'general');
95
70
  (0, _defineProperty2().default)(this, "options", [['', 'metadata', 'metadata/front-matter to place at the top of the .md file, enter as an object e.g. --metadata.id=cli --metadata.title=commands'], ['j', 'json', 'output the commands info as JSON']]);
96
71
  }
97
-
98
72
  async report(args, {
99
73
  metadata
100
74
  }) {
@@ -102,15 +76,11 @@ class CliGenerateCmd {
102
76
  metadata
103
77
  }).generate();
104
78
  }
105
-
106
79
  async json() {
107
80
  return new (_generateDocMd().GenerateCommandsDoc)(this.cliMain.commands, {}).generateJson();
108
81
  }
109
-
110
82
  }
111
-
112
83
  exports.CliGenerateCmd = CliGenerateCmd;
113
-
114
84
  class CliCmd {
115
85
  constructor(cliMain, docsDomain) {
116
86
  this.cliMain = cliMain;
@@ -123,61 +93,50 @@ class CliCmd {
123
93
  (0, _defineProperty2().default)(this, "group", 'general');
124
94
  (0, _defineProperty2().default)(this, "options", []);
125
95
  }
126
-
127
96
  async report() {
128
97
  _logger().default.isDaemon = true;
129
-
130
98
  const rl = _readline().default.createInterface({
131
99
  input: process.stdin,
132
100
  output: process.stdout,
133
101
  prompt: 'bit > ',
134
102
  completer: (line, cb) => completer(line, cb, this.cliMain)
135
103
  });
136
-
137
104
  const cliParser = new (_cliParser().CLIParser)(this.cliMain.commands, this.cliMain.groups, undefined, this.docsDomain);
138
105
  rl.prompt();
139
106
  return new Promise(resolve => {
140
107
  // eslint-disable-next-line @typescript-eslint/no-misused-promises
141
108
  rl.on('line', async line => {
142
109
  const cmd = line.trim().split(' ');
143
-
144
110
  try {
145
111
  await cliParser.parse(cmd);
146
112
  } catch (err) {
147
113
  await (0, _handleErrors().handleErrorAndExit)(err, cmd[0]);
148
114
  }
149
-
150
115
  rl.prompt();
151
116
  }).on('close', () => {
152
117
  resolve('Have a great day!');
153
118
  });
154
119
  });
155
120
  }
156
-
157
121
  }
158
-
159
122
  exports.CliCmd = CliCmd;
160
-
161
123
  function completer(line, cb, cliMain) {
162
124
  const lineSplit = line.split(' ');
163
125
  let values = [];
164
-
165
126
  if (lineSplit.length <= 1) {
166
127
  values = completeCommand(line, cliMain);
167
128
  cb(null, [values, line]);
168
129
  }
169
-
170
130
  (0, _consumer().loadConsumerIfExist)().then(consumer => {
171
131
  const comps = (consumer === null || consumer === void 0 ? void 0 : consumer.bitmapIdsFromCurrentLane.map(id => id.toStringWithoutVersion())) || [];
172
- values = comps.filter(c => c.includes(lineSplit[1])); // eslint-disable-next-line promise/no-callback-in-promise
173
-
132
+ values = comps.filter(c => c.includes(lineSplit[1]));
133
+ // eslint-disable-next-line promise/no-callback-in-promise
174
134
  cb(null, [values, line]);
175
135
  }).catch(err => {
176
136
  // eslint-disable-next-line promise/no-callback-in-promise
177
137
  cb(err, [[], line]);
178
138
  });
179
139
  }
180
-
181
140
  function completeCommand(line, cliMain) {
182
141
  const commands = cliMain.commands.filter(cmd => cmd.name.startsWith(line));
183
142
  return commands.map(c => c.name).map(name => name.split(' ')[0]);
@@ -1 +1 @@
1
- {"version":3,"names":["CliGenerateCmd","constructor","cliMain","report","args","metadata","GenerateCommandsDoc","commands","generate","json","generateJson","CliCmd","docsDomain","logger","isDaemon","rl","readline","createInterface","input","process","stdin","output","stdout","prompt","completer","line","cb","cliParser","CLIParser","groups","undefined","Promise","resolve","on","cmd","trim","split","parse","err","handleErrorAndExit","lineSplit","values","length","completeCommand","loadConsumerIfExist","then","consumer","comps","bitmapIdsFromCurrentLane","map","id","toStringWithoutVersion","filter","c","includes","catch","name","startsWith"],"sources":["cli.cmd.ts"],"sourcesContent":["// eslint-disable-next-line max-classes-per-file\nimport { Command, CommandOptions } from '@teambit/cli';\nimport logger from '@teambit/legacy/dist/logger/logger';\nimport { handleErrorAndExit } from '@teambit/legacy/dist/cli/handle-errors';\nimport { loadConsumerIfExist } from '@teambit/legacy/dist/consumer';\nimport readline from 'readline';\nimport { CLIParser } from './cli-parser';\nimport { CLIMain } from './cli.main.runtime';\nimport { GenerateCommandsDoc, GenerateOpts } from './generate-doc-md';\n\nexport class CliGenerateCmd implements Command {\n name = 'generate';\n description = 'EXPERIMENTAL. generate an .md file with all commands details';\n alias = '';\n loader = false;\n group = 'general';\n options = [\n [\n '',\n 'metadata',\n 'metadata/front-matter to place at the top of the .md file, enter as an object e.g. --metadata.id=cli --metadata.title=commands',\n ],\n ['j', 'json', 'output the commands info as JSON'],\n ] as CommandOptions;\n\n constructor(private cliMain: CLIMain) {}\n\n async report(args, { metadata }: GenerateOpts): Promise<string> {\n return new GenerateCommandsDoc(this.cliMain.commands, { metadata }).generate();\n }\n\n async json() {\n return new GenerateCommandsDoc(this.cliMain.commands, {}).generateJson();\n }\n}\n\nexport class CliCmd implements Command {\n name = 'cli';\n description = 'EXPERIMENTAL. enters bit cli program and generates commands list';\n alias = '';\n commands: Command[] = [];\n loader = false;\n group = 'general';\n options = [] as CommandOptions;\n\n constructor(private cliMain: CLIMain, private docsDomain: string) {}\n\n async report(): Promise<string> {\n logger.isDaemon = true;\n const rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n prompt: 'bit > ',\n completer: (line, cb) => completer(line, cb, this.cliMain),\n });\n\n const cliParser = new CLIParser(this.cliMain.commands, this.cliMain.groups, undefined, this.docsDomain);\n\n rl.prompt();\n\n return new Promise((resolve) => {\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n rl.on('line', async (line) => {\n const cmd = line.trim().split(' ');\n try {\n await cliParser.parse(cmd);\n } catch (err: any) {\n await handleErrorAndExit(err, cmd[0]);\n }\n rl.prompt();\n }).on('close', () => {\n resolve('Have a great day!');\n });\n });\n }\n}\n\nfunction completer(line: string, cb: Function, cliMain: CLIMain) {\n const lineSplit = line.split(' ');\n let values: string[] = [];\n if (lineSplit.length <= 1) {\n values = completeCommand(line, cliMain);\n cb(null, [values, line]);\n }\n loadConsumerIfExist()\n .then((consumer) => {\n const comps = consumer?.bitmapIdsFromCurrentLane.map((id) => id.toStringWithoutVersion()) || [];\n values = comps.filter((c) => c.includes(lineSplit[1]));\n // eslint-disable-next-line promise/no-callback-in-promise\n cb(null, [values, line]);\n })\n .catch((err) => {\n // eslint-disable-next-line promise/no-callback-in-promise\n cb(err, [[], line]);\n });\n}\n\nfunction completeCommand(line: string, cliMain: CLIMain): string[] {\n const commands = cliMain.commands.filter((cmd) => cmd.name.startsWith(line));\n return commands.map((c) => c.name).map((name) => name.split(' ')[0]);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AARA;AAUO,MAAMA,cAAN,CAAwC;EAe7CC,WAAW,CAASC,OAAT,EAA2B;IAAA,KAAlBA,OAAkB,GAAlBA,OAAkB;IAAA,8CAd/B,UAc+B;IAAA,qDAbxB,8DAawB;IAAA,+CAZ9B,EAY8B;IAAA,gDAX7B,KAW6B;IAAA,+CAV9B,SAU8B;IAAA,iDAT5B,CACR,CACE,EADF,EAEE,UAFF,EAGE,gIAHF,CADQ,EAMR,CAAC,GAAD,EAAM,MAAN,EAAc,kCAAd,CANQ,CAS4B;EAAE;;EAE5B,MAANC,MAAM,CAACC,IAAD,EAAO;IAAEC;EAAF,CAAP,EAAoD;IAC9D,OAAO,KAAIC,oCAAJ,EAAwB,KAAKJ,OAAL,CAAaK,QAArC,EAA+C;MAAEF;IAAF,CAA/C,EAA6DG,QAA7D,EAAP;EACD;;EAES,MAAJC,IAAI,GAAG;IACX,OAAO,KAAIH,oCAAJ,EAAwB,KAAKJ,OAAL,CAAaK,QAArC,EAA+C,EAA/C,EAAmDG,YAAnD,EAAP;EACD;;AAvB4C;;;;AA0Bx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,IAAJ,CAASC,UAAT,CAAoBhC,IAApB,CAAjC,CAAjB;EACA,OAAOlB,QAAQ,CAAC0C,GAAT,CAAcI,CAAD,IAAOA,CAAC,CAACG,IAAtB,EAA4BP,GAA5B,CAAiCO,IAAD,IAAUA,IAAI,CAACpB,KAAL,CAAW,GAAX,EAAgB,CAAhB,CAA1C,CAAP;AACD"}
1
+ {"version":3,"names":["CliGenerateCmd","constructor","cliMain","report","args","metadata","GenerateCommandsDoc","commands","generate","json","generateJson","CliCmd","docsDomain","logger","isDaemon","rl","readline","createInterface","input","process","stdin","output","stdout","prompt","completer","line","cb","cliParser","CLIParser","groups","undefined","Promise","resolve","on","cmd","trim","split","parse","err","handleErrorAndExit","lineSplit","values","length","completeCommand","loadConsumerIfExist","then","consumer","comps","bitmapIdsFromCurrentLane","map","id","toStringWithoutVersion","filter","c","includes","catch","name","startsWith"],"sources":["cli.cmd.ts"],"sourcesContent":["// eslint-disable-next-line max-classes-per-file\nimport { Command, CommandOptions } from '@teambit/cli';\nimport logger from '@teambit/legacy/dist/logger/logger';\nimport { handleErrorAndExit } from '@teambit/legacy/dist/cli/handle-errors';\nimport { loadConsumerIfExist } from '@teambit/legacy/dist/consumer';\nimport readline from 'readline';\nimport { CLIParser } from './cli-parser';\nimport { CLIMain } from './cli.main.runtime';\nimport { GenerateCommandsDoc, GenerateOpts } from './generate-doc-md';\n\nexport class CliGenerateCmd implements Command {\n name = 'generate';\n description = 'EXPERIMENTAL. generate an .md file with all commands details';\n alias = '';\n loader = false;\n group = 'general';\n options = [\n [\n '',\n 'metadata',\n 'metadata/front-matter to place at the top of the .md file, enter as an object e.g. --metadata.id=cli --metadata.title=commands',\n ],\n ['j', 'json', 'output the commands info as JSON'],\n ] as CommandOptions;\n\n constructor(private cliMain: CLIMain) {}\n\n async report(args, { metadata }: GenerateOpts): Promise<string> {\n return new GenerateCommandsDoc(this.cliMain.commands, { metadata }).generate();\n }\n\n async json() {\n return new GenerateCommandsDoc(this.cliMain.commands, {}).generateJson();\n }\n}\n\nexport class CliCmd implements Command {\n name = 'cli';\n description = 'EXPERIMENTAL. enters bit cli program and generates commands list';\n alias = '';\n commands: Command[] = [];\n loader = false;\n group = 'general';\n options = [] as CommandOptions;\n\n constructor(private cliMain: CLIMain, private docsDomain: string) {}\n\n async report(): Promise<string> {\n logger.isDaemon = true;\n const rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n prompt: 'bit > ',\n completer: (line, cb) => completer(line, cb, this.cliMain),\n });\n\n const cliParser = new CLIParser(this.cliMain.commands, this.cliMain.groups, undefined, this.docsDomain);\n\n rl.prompt();\n\n return new Promise((resolve) => {\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n rl.on('line', async (line) => {\n const cmd = line.trim().split(' ');\n try {\n await cliParser.parse(cmd);\n } catch (err: any) {\n await handleErrorAndExit(err, cmd[0]);\n }\n rl.prompt();\n }).on('close', () => {\n resolve('Have a great day!');\n });\n });\n }\n}\n\nfunction completer(line: string, cb: Function, cliMain: CLIMain) {\n const lineSplit = line.split(' ');\n let values: string[] = [];\n if (lineSplit.length <= 1) {\n values = completeCommand(line, cliMain);\n cb(null, [values, line]);\n }\n loadConsumerIfExist()\n .then((consumer) => {\n const comps = consumer?.bitmapIdsFromCurrentLane.map((id) => id.toStringWithoutVersion()) || [];\n values = comps.filter((c) => c.includes(lineSplit[1]));\n // eslint-disable-next-line promise/no-callback-in-promise\n cb(null, [values, line]);\n })\n .catch((err) => {\n // eslint-disable-next-line promise/no-callback-in-promise\n cb(err, [[], line]);\n });\n}\n\nfunction completeCommand(line: string, cliMain: CLIMain): string[] {\n const commands = cliMain.commands.filter((cmd) => cmd.name.startsWith(line));\n return commands.map((c) => c.name).map((name) => name.split(' ')[0]);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;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IAAI,EAAE,CAACe,MAAM,EAAEhB,IAAI,CAAC,CAAC;EAC1B;EACA,IAAAmB,+BAAmB,GAAE,CAClBC,IAAI,CAAEC,QAAQ,IAAK;IAClB,MAAMC,KAAK,GAAG,CAAAD,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEE,wBAAwB,CAACC,GAAG,CAAEC,EAAE,IAAKA,EAAE,CAACC,sBAAsB,EAAE,CAAC,KAAI,EAAE;IAC/FV,MAAM,GAAGM,KAAK,CAACK,MAAM,CAAEC,CAAC,IAAKA,CAAC,CAACC,QAAQ,CAACd,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IACtD;IACAd,EAAE,CAAC,IAAI,EAAE,CAACe,MAAM,EAAEhB,IAAI,CAAC,CAAC;EAC1B,CAAC,CAAC,CACD8B,KAAK,CAAEjB,GAAG,IAAK;IACd;IACAZ,EAAE,CAACY,GAAG,EAAE,CAAC,EAAE,EAAEb,IAAI,CAAC,CAAC;EACrB,CAAC,CAAC;AACN;AAEA,SAASkB,eAAe,CAAClB,IAAY,EAAEvB,OAAgB,EAAY;EACjE,MAAMK,QAAQ,GAAGL,OAAO,CAACK,QAAQ,CAAC6C,MAAM,CAAElB,GAAG,IAAKA,GAAG,CAACsB,IAAI,CAACC,UAAU,CAAChC,IAAI,CAAC,CAAC;EAC5E,OAAOlB,QAAQ,CAAC0C,GAAG,CAAEI,CAAC,IAAKA,CAAC,CAACG,IAAI,CAAC,CAACP,GAAG,CAAEO,IAAI,IAAKA,IAAI,CAACpB,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACtE"}
@@ -1,22 +1,17 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.Logo = void 0;
9
-
10
8
  function _react() {
11
9
  const data = _interopRequireDefault(require("react"));
12
-
13
10
  _react = function () {
14
11
  return data;
15
12
  };
16
-
17
13
  return data;
18
14
  }
19
-
20
15
  const Logo = () => /*#__PURE__*/_react().default.createElement("div", {
21
16
  style: {
22
17
  height: '100%',
@@ -29,7 +24,6 @@ const Logo = () => /*#__PURE__*/_react().default.createElement("div", {
29
24
  },
30
25
  src: "https://static.bit.dev/extensions-icons/cli.svg"
31
26
  }));
32
-
33
27
  exports.Logo = Logo;
34
28
 
35
29
  //# sourceMappingURL=cli.composition.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Logo","height","display","justifyContent","width"],"sources":["cli.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/cli.svg\" />\n </div>\n);\n"],"mappings":";;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,IAAI,GAAG,mBAClB;EAAK,KAAK,EAAE;IAAEC,MAAM,EAAE,MAAV;IAAkBC,OAAO,EAAE,MAA3B;IAAmCC,cAAc,EAAE;EAAnD;AAAZ,gBACE;EAAK,KAAK,EAAE;IAAEC,KAAK,EAAE;EAAT,CAAZ;EAA2B,GAAG,EAAC;AAA/B,EADF,CADK"}
1
+ {"version":3,"names":["Logo","height","display","justifyContent","width"],"sources":["cli.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/cli.svg\" />\n </div>\n);\n"],"mappings":";;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,IAAI,GAAG,mBAClB;EAAK,KAAK,EAAE;IAAEC,MAAM,EAAE,MAAM;IAAEC,OAAO,EAAE,MAAM;IAAEC,cAAc,EAAE;EAAS;AAAE,gBACxE;EAAK,KAAK,EAAE;IAAEC,KAAK,EAAE;EAAG,CAAE;EAAC,GAAG,EAAC;AAAiD,EAAG,CAEtF;AAAC"}
@@ -1,172 +1,120 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  require("core-js/modules/es.symbol.description.js");
6
-
7
5
  require("core-js/modules/es.array.flat.js");
8
-
9
6
  require("core-js/modules/es.array.iterator.js");
10
-
11
7
  require("core-js/modules/es.array.unscopables.flat.js");
12
-
13
8
  require("core-js/modules/es.promise.js");
14
-
15
9
  Object.defineProperty(exports, "__esModule", {
16
10
  value: true
17
11
  });
18
12
  exports.CLIMain = void 0;
19
-
20
13
  function _defineProperty2() {
21
14
  const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
22
-
23
15
  _defineProperty2 = function () {
24
16
  return data;
25
17
  };
26
-
27
18
  return data;
28
19
  }
29
-
30
20
  function _harmony() {
31
21
  const data = require("@teambit/harmony");
32
-
33
22
  _harmony = function () {
34
23
  return data;
35
24
  };
36
-
37
25
  return data;
38
26
  }
39
-
40
27
  function _cli() {
41
28
  const data = require("@teambit/legacy/dist/cli");
42
-
43
29
  _cli = function () {
44
30
  return data;
45
31
  };
46
-
47
32
  return data;
48
33
  }
49
-
50
34
  function _community() {
51
35
  const data = require("@teambit/community");
52
-
53
36
  _community = function () {
54
37
  return data;
55
38
  };
56
-
57
39
  return data;
58
40
  }
59
-
60
41
  function _commandGroups() {
61
42
  const data = require("@teambit/legacy/dist/cli/command-groups");
62
-
63
43
  _commandGroups = function () {
64
44
  return data;
65
45
  };
66
-
67
46
  return data;
68
47
  }
69
-
70
48
  function _consumer() {
71
49
  const data = require("@teambit/legacy/dist/consumer");
72
-
73
50
  _consumer = function () {
74
51
  return data;
75
52
  };
76
-
77
53
  return data;
78
54
  }
79
-
80
55
  function _logger() {
81
56
  const data = require("@teambit/logger");
82
-
83
57
  _logger = function () {
84
58
  return data;
85
59
  };
86
-
87
60
  return data;
88
61
  }
89
-
90
62
  function _lodash() {
91
63
  const data = require("lodash");
92
-
93
64
  _lodash = function () {
94
65
  return data;
95
66
  };
96
-
97
67
  return data;
98
68
  }
99
-
100
69
  function _cli2() {
101
70
  const data = require("./cli.aspect");
102
-
103
71
  _cli2 = function () {
104
72
  return data;
105
73
  };
106
-
107
74
  return data;
108
75
  }
109
-
110
76
  function _getCommandId() {
111
77
  const data = require("./get-command-id");
112
-
113
78
  _getCommandId = function () {
114
79
  return data;
115
80
  };
116
-
117
81
  return data;
118
82
  }
119
-
120
83
  function _legacyCommandAdapter() {
121
84
  const data = require("./legacy-command-adapter");
122
-
123
85
  _legacyCommandAdapter = function () {
124
86
  return data;
125
87
  };
126
-
127
88
  return data;
128
89
  }
129
-
130
90
  function _cliParser() {
131
91
  const data = require("./cli-parser");
132
-
133
92
  _cliParser = function () {
134
93
  return data;
135
94
  };
136
-
137
95
  return data;
138
96
  }
139
-
140
97
  function _completion() {
141
98
  const data = require("./completion.cmd");
142
-
143
99
  _completion = function () {
144
100
  return data;
145
101
  };
146
-
147
102
  return data;
148
103
  }
149
-
150
104
  function _cli3() {
151
105
  const data = require("./cli.cmd");
152
-
153
106
  _cli3 = function () {
154
107
  return data;
155
108
  };
156
-
157
109
  return data;
158
110
  }
159
-
160
111
  function _help() {
161
112
  const data = require("./help.cmd");
162
-
163
113
  _help = function () {
164
114
  return data;
165
115
  };
166
-
167
116
  return data;
168
117
  }
169
-
170
118
  class CLIMain {
171
119
  // if it's not cloned, it is cached across loadBit() instances
172
120
  constructor(commandsSlot, onStartSlot, community, logger) {
@@ -176,25 +124,23 @@ class CLIMain {
176
124
  this.logger = logger;
177
125
  (0, _defineProperty2().default)(this, "groups", (0, _lodash().clone)(_commandGroups().groups));
178
126
  }
127
+
179
128
  /**
180
129
  * registers a new command in to the CLI.
181
130
  */
182
-
183
-
184
131
  register(...commands) {
185
132
  commands.forEach(command => {
186
- this.setDefaults(command); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
187
-
133
+ this.setDefaults(command);
134
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
188
135
  command.commands.forEach(cmd => this.setDefaults(cmd));
189
136
  });
190
137
  this.commandsSlot.register(commands);
191
138
  }
139
+
192
140
  /**
193
141
  * helpful for having the same command name in different environments (e.g. legacy and non-legacy).
194
142
  * for example `cli.unregister('tag');` removes the "bit tag" command.
195
143
  */
196
-
197
-
198
144
  unregister(commandName) {
199
145
  this.commandsSlot.toArray().forEach(([aspectId, commands]) => {
200
146
  const filteredCommands = commands.filter(command => {
@@ -203,30 +149,27 @@ class CLIMain {
203
149
  this.commandsSlot.map.set(aspectId, filteredCommands);
204
150
  });
205
151
  }
152
+
206
153
  /**
207
154
  * list of all registered commands. (legacy and new).
208
155
  */
209
-
210
-
211
156
  get commands() {
212
157
  return this.commandsSlot.values().flat();
213
158
  }
159
+
214
160
  /**
215
161
  * get an instance of a registered command. (useful for aspects to modify and extend existing commands)
216
162
  */
217
-
218
-
219
163
  getCommand(name) {
220
164
  return this.commands.find(command => (0, _getCommandId().getCommandId)(command.name) === name);
221
165
  }
166
+
222
167
  /**
223
168
  * when running `bit help`, commands are grouped by categories.
224
169
  * this method helps registering a new group by providing its name and a description.
225
170
  * the name is what needs to be assigned to the `group` property of the Command interface.
226
171
  * the description is what shown in the `bit help` output.
227
172
  */
228
-
229
-
230
173
  registerGroup(name, description) {
231
174
  if (this.groups[name]) {
232
175
  this.logger.consoleWarning(`CLI group "${name}" is already registered`);
@@ -234,28 +177,24 @@ class CLIMain {
234
177
  this.groups[name] = description;
235
178
  }
236
179
  }
237
-
238
180
  registerOnStart(onStartFn) {
239
181
  this.onStartSlot.register(onStartFn);
240
182
  return this;
241
183
  }
184
+
242
185
  /**
243
186
  * execute commands registered to this aspect.
244
187
  */
245
-
246
-
247
188
  async run(hasWorkspace) {
248
189
  await this.invokeOnStart(hasWorkspace);
249
190
  const CliParser = new (_cliParser().CLIParser)(this.commands, this.groups, undefined, this.community.getDocsDomain());
250
191
  await CliParser.parse();
251
192
  }
252
-
253
193
  async invokeOnStart(hasWorkspace) {
254
194
  const onStartFns = this.onStartSlot.values();
255
195
  const promises = onStartFns.map(async onStart => onStart(hasWorkspace));
256
196
  return Promise.all(promises);
257
197
  }
258
-
259
198
  setDefaults(command) {
260
199
  command.alias = command.alias || '';
261
200
  command.description = command.description || '';
@@ -264,7 +203,6 @@ class CLIMain {
264
203
  command.options = command.options || [];
265
204
  command.private = command.private || false;
266
205
  command.commands = command.commands || [];
267
-
268
206
  if (command.loader === undefined) {
269
207
  if (command.internal) {
270
208
  command.loader = false;
@@ -272,12 +210,10 @@ class CLIMain {
272
210
  command.loader = true;
273
211
  }
274
212
  }
275
-
276
213
  if (command.helpUrl && !isFullUrl(command.helpUrl)) {
277
214
  command.helpUrl = `https://${this.community.getDocsDomain()}/${command.helpUrl}`;
278
215
  }
279
216
  }
280
-
281
217
  static async provider([community, loggerMain], config, [commandsSlot, onStartSlot]) {
282
218
  const logger = loggerMain.createLogger(_cli2().CLIAspect.id);
283
219
  const cliMain = new CLIMain(commandsSlot, onStartSlot, community, logger);
@@ -292,30 +228,26 @@ class CLIMain {
292
228
  cliMain.register(...legacyCommandsAdapters, new (_completion().CompletionCmd)(), cliCmd, helpCmd);
293
229
  return cliMain;
294
230
  }
295
-
296
231
  }
297
-
298
232
  exports.CLIMain = CLIMain;
299
233
  (0, _defineProperty2().default)(CLIMain, "dependencies", [_community().CommunityAspect, _logger().LoggerAspect]);
300
234
  (0, _defineProperty2().default)(CLIMain, "runtime", _cli2().MainRuntime);
301
235
  (0, _defineProperty2().default)(CLIMain, "slots", [_harmony().Slot.withType(), _harmony().Slot.withType()]);
302
-
303
236
  _cli2().CLIAspect.addRuntime(CLIMain);
237
+
304
238
  /**
305
239
  * kind of a hack.
306
240
  * in the legacy, this is running at the beginning and it take care of issues when Bit files are missing,
307
241
  * such as ".bit".
308
242
  * (to make this process better, you can easily remove it and run the e2e-tests. you'll see some failing)
309
243
  */
310
-
311
-
312
244
  async function ensureWorkspaceAndScope() {
313
245
  try {
314
246
  await (0, _consumer().loadConsumerIfExist)();
315
- } catch (err) {// do nothing. it could fail for example with ScopeNotFound error, which is taken care of in "bit init".
247
+ } catch (err) {
248
+ // do nothing. it could fail for example with ScopeNotFound error, which is taken care of in "bit init".
316
249
  }
317
250
  }
318
-
319
251
  function isFullUrl(url) {
320
252
  return url.startsWith('http://') || url.startsWith('https://');
321
253
  }
@@ -1 +1 @@
1
- {"version":3,"names":["CLIMain","constructor","commandsSlot","onStartSlot","community","logger","clone","groups","register","commands","forEach","command","setDefaults","cmd","unregister","commandName","toArray","aspectId","filteredCommands","filter","getCommandId","name","map","set","values","flat","getCommand","find","registerGroup","description","consoleWarning","registerOnStart","onStartFn","run","hasWorkspace","invokeOnStart","CliParser","CLIParser","undefined","getDocsDomain","parse","onStartFns","promises","onStart","Promise","all","alias","extendedDescription","group","options","private","loader","internal","helpUrl","isFullUrl","provider","loggerMain","config","createLogger","CLIAspect","id","cliMain","legacyRegistry","buildRegistry","ensureWorkspaceAndScope","legacyCommands","legacyCommandsAdapters","LegacyCommandAdapter","cliGenerateCmd","CliGenerateCmd","cliCmd","CliCmd","helpCmd","HelpCmd","push","CompletionCmd","CommunityAspect","LoggerAspect","MainRuntime","Slot","withType","addRuntime","loadConsumerIfExist","err","url","startsWith"],"sources":["cli.main.runtime.ts"],"sourcesContent":["import { Slot, SlotRegistry } from '@teambit/harmony';\nimport { buildRegistry } from '@teambit/legacy/dist/cli';\nimport { Command } from '@teambit/legacy/dist/cli/command';\nimport { CommunityAspect } from '@teambit/community';\nimport type { CommunityMain } from '@teambit/community';\n\nimport { groups, GroupsType } from '@teambit/legacy/dist/cli/command-groups';\nimport { loadConsumerIfExist } from '@teambit/legacy/dist/consumer';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { clone } from 'lodash';\nimport { CLIAspect, MainRuntime } from './cli.aspect';\nimport { getCommandId } from './get-command-id';\nimport { LegacyCommandAdapter } from './legacy-command-adapter';\nimport { CLIParser } from './cli-parser';\nimport { CompletionCmd } from './completion.cmd';\nimport { CliCmd, CliGenerateCmd } from './cli.cmd';\nimport { HelpCmd } from './help.cmd';\n\nexport type CommandList = Array<Command>;\nexport type OnStart = (hasWorkspace: boolean) => Promise<void>;\n\nexport type OnStartSlot = SlotRegistry<OnStart>;\nexport type CommandsSlot = SlotRegistry<CommandList>;\n\nexport class CLIMain {\n public groups: GroupsType = clone(groups); // if it's not cloned, it is cached across loadBit() instances\n constructor(\n private commandsSlot: CommandsSlot,\n private onStartSlot: OnStartSlot,\n private community: CommunityMain,\n private logger: Logger\n ) {}\n\n /**\n * registers a new command in to the CLI.\n */\n register(...commands: CommandList) {\n commands.forEach((command) => {\n this.setDefaults(command);\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n command.commands!.forEach((cmd) => this.setDefaults(cmd));\n });\n this.commandsSlot.register(commands);\n }\n\n /**\n * helpful for having the same command name in different environments (e.g. legacy and non-legacy).\n * for example `cli.unregister('tag');` removes the \"bit tag\" command.\n */\n unregister(commandName: string) {\n this.commandsSlot.toArray().forEach(([aspectId, commands]) => {\n const filteredCommands = commands.filter((command) => {\n return getCommandId(command.name) !== commandName;\n });\n this.commandsSlot.map.set(aspectId, filteredCommands);\n });\n }\n\n /**\n * list of all registered commands. (legacy and new).\n */\n get commands(): CommandList {\n return this.commandsSlot.values().flat();\n }\n\n /**\n * get an instance of a registered command. (useful for aspects to modify and extend existing commands)\n */\n getCommand(name: string): Command | undefined {\n return this.commands.find((command) => getCommandId(command.name) === name);\n }\n\n /**\n * when running `bit help`, commands are grouped by categories.\n * this method helps registering a new group by providing its name and a description.\n * the name is what needs to be assigned to the `group` property of the Command interface.\n * the description is what shown in the `bit help` output.\n */\n registerGroup(name: string, description: string) {\n if (this.groups[name]) {\n this.logger.consoleWarning(`CLI group \"${name}\" is already registered`);\n } else {\n this.groups[name] = description;\n }\n }\n\n registerOnStart(onStartFn: OnStart) {\n this.onStartSlot.register(onStartFn);\n return this;\n }\n\n /**\n * execute commands registered to this aspect.\n */\n async run(hasWorkspace: boolean) {\n await this.invokeOnStart(hasWorkspace);\n const CliParser = new CLIParser(this.commands, this.groups, undefined, this.community.getDocsDomain());\n await CliParser.parse();\n }\n\n private async invokeOnStart(hasWorkspace: boolean) {\n const onStartFns = this.onStartSlot.values();\n const promises = onStartFns.map(async (onStart) => onStart(hasWorkspace));\n return Promise.all(promises);\n }\n\n private setDefaults(command: Command) {\n command.alias = command.alias || '';\n command.description = command.description || '';\n command.extendedDescription = command.extendedDescription || '';\n command.group = command.group || 'ungrouped';\n command.options = command.options || [];\n command.private = command.private || false;\n command.commands = command.commands || [];\n if (command.loader === undefined) {\n if (command.internal) {\n command.loader = false;\n } else {\n command.loader = true;\n }\n }\n if (command.helpUrl && !isFullUrl(command.helpUrl)) {\n command.helpUrl = `https://${this.community.getDocsDomain()}/${command.helpUrl}`;\n }\n }\n\n static dependencies = [CommunityAspect, LoggerAspect];\n static runtime = MainRuntime;\n static slots = [Slot.withType<CommandList>(), Slot.withType<OnStart>()];\n\n static async provider(\n [community, loggerMain]: [CommunityMain, LoggerMain],\n config,\n [commandsSlot, onStartSlot]: [CommandsSlot, OnStartSlot]\n ) {\n const logger = loggerMain.createLogger(CLIAspect.id);\n const cliMain = new CLIMain(commandsSlot, onStartSlot, community, logger);\n const legacyRegistry = buildRegistry();\n await ensureWorkspaceAndScope();\n const legacyCommands = legacyRegistry.commands;\n const legacyCommandsAdapters = legacyCommands.map((command) => new LegacyCommandAdapter(command, cliMain));\n const cliGenerateCmd = new CliGenerateCmd(cliMain);\n const cliCmd = new CliCmd(cliMain, community.getDocsDomain());\n const helpCmd = new HelpCmd(cliMain, community.getDocsDomain());\n cliCmd.commands.push(cliGenerateCmd);\n cliMain.register(...legacyCommandsAdapters, new CompletionCmd(), cliCmd, helpCmd);\n return cliMain;\n }\n}\n\nCLIAspect.addRuntime(CLIMain);\n\n/**\n * kind of a hack.\n * in the legacy, this is running at the beginning and it take care of issues when Bit files are missing,\n * such as \".bit\".\n * (to make this process better, you can easily remove it and run the e2e-tests. you'll see some failing)\n */\nasync function ensureWorkspaceAndScope() {\n try {\n await loadConsumerIfExist();\n } catch (err) {\n // do nothing. it could fail for example with ScopeNotFound error, which is taken care of in \"bit init\".\n }\n}\n\nfunction isFullUrl(url: string) {\n return url.startsWith('http://') || url.startsWith('https://');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAQO,MAAMA,OAAN,CAAc;EACwB;EAC3CC,WAAW,CACDC,YADC,EAEDC,WAFC,EAGDC,SAHC,EAIDC,MAJC,EAKT;IAAA,KAJQH,YAIR,GAJQA,YAIR;IAAA,KAHQC,WAGR,GAHQA,WAGR;IAAA,KAFQC,SAER,GAFQA,SAER;IAAA,KADQC,MACR,GADQA,MACR;IAAA,gDAN0B,IAAAC,eAAA,EAAMC,uBAAN,CAM1B;EAAE;EAEJ;AACF;AACA;;;EACEC,QAAQ,CAAC,GAAGC,QAAJ,EA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P,CAAgBiE,IAAhB,CAAqBN,cAArB;IACAP,OAAO,CAACrD,QAAR,CAAiB,GAAG0D,sBAApB,EAA4C,KAAIS,2BAAJ,GAA5C,EAAiEL,MAAjE,EAAyEE,OAAzE;IACA,OAAOX,OAAP;EACD;;AA3HkB;;;gCAAR7D,O,kBAsGW,CAAC4E,4BAAD,EAAkBC,sBAAlB,C;gCAtGX7E,O,aAuGM8E,mB;gCAvGN9E,O,WAwGI,CAAC+E,eAAA,CAAKC,QAAL,EAAD,EAA+BD,eAAA,CAAKC,QAAL,EAA/B,C;;AAsBjBrB,iBAAA,CAAUsB,UAAV,CAAqBjF,OAArB;AAEA;AACA;AACA;AACA;AACA;AACA;;;AACA,eAAegE,uBAAf,GAAyC;EACvC,IAAI;IACF,MAAM,IAAAkB,+BAAA,GAAN;EACD,CAFD,CAEE,OAAOC,GAAP,EAAY,CACZ;EACD;AACF;;AAED,SAAS7B,SAAT,CAAmB8B,GAAnB,EAAgC;EAC9B,OAAOA,GAAG,CAACC,UAAJ,CAAe,SAAf,KAA6BD,GAAG,CAACC,UAAJ,CAAe,UAAf,CAApC;AACD"}
1
+ {"version":3,"names":["CLIMain","constructor","commandsSlot","onStartSlot","community","logger","clone","groups","register","commands","forEach","command","setDefaults","cmd","unregister","commandName","toArray","aspectId","filteredCommands","filter","getCommandId","name","map","set","values","flat","getCommand","find","registerGroup","description","consoleWarning","registerOnStart","onStartFn","run","hasWorkspace","invokeOnStart","CliParser","CLIParser","undefined","getDocsDomain","parse","onStartFns","promises","onStart","Promise","all","alias","extendedDescription","group","options","private","loader","internal","helpUrl","isFullUrl","provider","loggerMain","config","createLogger","CLIAspect","id","cliMain","legacyRegistry","buildRegistry","ensureWorkspaceAndScope","legacyCommands","legacyCommandsAdapters","LegacyCommandAdapter","cliGenerateCmd","CliGenerateCmd","cliCmd","CliCmd","helpCmd","HelpCmd","push","CompletionCmd","CommunityAspect","LoggerAspect","MainRuntime","Slot","withType","addRuntime","loadConsumerIfExist","err","url","startsWith"],"sources":["cli.main.runtime.ts"],"sourcesContent":["import { Slot, SlotRegistry } from '@teambit/harmony';\nimport { buildRegistry } from '@teambit/legacy/dist/cli';\nimport { Command } from '@teambit/legacy/dist/cli/command';\nimport { CommunityAspect } from '@teambit/community';\nimport type { CommunityMain } from '@teambit/community';\n\nimport { groups, GroupsType } from '@teambit/legacy/dist/cli/command-groups';\nimport { loadConsumerIfExist } from '@teambit/legacy/dist/consumer';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { clone } from 'lodash';\nimport { CLIAspect, MainRuntime } from './cli.aspect';\nimport { getCommandId } from './get-command-id';\nimport { LegacyCommandAdapter } from './legacy-command-adapter';\nimport { CLIParser } from './cli-parser';\nimport { CompletionCmd } from './completion.cmd';\nimport { CliCmd, CliGenerateCmd } from './cli.cmd';\nimport { HelpCmd } from './help.cmd';\n\nexport type CommandList = Array<Command>;\nexport type OnStart = (hasWorkspace: boolean) => Promise<void>;\n\nexport type OnStartSlot = SlotRegistry<OnStart>;\nexport type CommandsSlot = SlotRegistry<CommandList>;\n\nexport class CLIMain {\n public groups: GroupsType = clone(groups); // if it's not cloned, it is cached across loadBit() instances\n constructor(\n private commandsSlot: CommandsSlot,\n private onStartSlot: OnStartSlot,\n private community: CommunityMain,\n private logger: Logger\n ) {}\n\n /**\n * registers a new command in to the CLI.\n */\n register(...commands: CommandList) {\n commands.forEach((command) => {\n this.setDefaults(command);\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n command.commands!.forEach((cmd) => this.setDefaults(cmd));\n });\n this.commandsSlot.register(commands);\n }\n\n /**\n * helpful for having the same command name in different environments (e.g. legacy and non-legacy).\n * for example `cli.unregister('tag');` removes the \"bit tag\" command.\n */\n unregister(commandName: string) {\n this.commandsSlot.toArray().forEach(([aspectId, commands]) => {\n const filteredCommands = commands.filter((command) => {\n return getCommandId(command.name) !== commandName;\n });\n this.commandsSlot.map.set(aspectId, filteredCommands);\n });\n }\n\n /**\n * list of all registered commands. (legacy and new).\n */\n get commands(): CommandList {\n return this.commandsSlot.values().flat();\n }\n\n /**\n * get an instance of a registered command. (useful for aspects to modify and extend existing commands)\n */\n getCommand(name: string): Command | undefined {\n return this.commands.find((command) => getCommandId(command.name) === name);\n }\n\n /**\n * when running `bit help`, commands are grouped by categories.\n * this method helps registering a new group by providing its name and a description.\n * the name is what needs to be assigned to the `group` property of the Command interface.\n * the description is what shown in the `bit help` output.\n */\n registerGroup(name: string, description: string) {\n if (this.groups[name]) {\n this.logger.consoleWarning(`CLI group \"${name}\" is already registered`);\n } else {\n this.groups[name] = description;\n }\n }\n\n registerOnStart(onStartFn: OnStart) {\n this.onStartSlot.register(onStartFn);\n return this;\n }\n\n /**\n * execute commands registered to this aspect.\n */\n async run(hasWorkspace: boolean) {\n await this.invokeOnStart(hasWorkspace);\n const CliParser = new CLIParser(this.commands, this.groups, undefined, this.community.getDocsDomain());\n await CliParser.parse();\n }\n\n private async invokeOnStart(hasWorkspace: boolean) {\n const onStartFns = this.onStartSlot.values();\n const promises = onStartFns.map(async (onStart) => onStart(hasWorkspace));\n return Promise.all(promises);\n }\n\n private setDefaults(command: Command) {\n command.alias = command.alias || '';\n command.description = command.description || '';\n command.extendedDescription = command.extendedDescription || '';\n command.group = command.group || 'ungrouped';\n command.options = command.options || [];\n command.private = command.private || false;\n command.commands = command.commands || [];\n if (command.loader === undefined) {\n if (command.internal) {\n command.loader = false;\n } else {\n command.loader = true;\n }\n }\n if (command.helpUrl && !isFullUrl(command.helpUrl)) {\n command.helpUrl = `https://${this.community.getDocsDomain()}/${command.helpUrl}`;\n }\n }\n\n static dependencies = [CommunityAspect, LoggerAspect];\n static runtime = MainRuntime;\n static slots = [Slot.withType<CommandList>(), Slot.withType<OnStart>()];\n\n static async provider(\n [community, loggerMain]: [CommunityMain, LoggerMain],\n config,\n [commandsSlot, onStartSlot]: [CommandsSlot, OnStartSlot]\n ) {\n const logger = loggerMain.createLogger(CLIAspect.id);\n const cliMain = new CLIMain(commandsSlot, onStartSlot, community, logger);\n const legacyRegistry = buildRegistry();\n await ensureWorkspaceAndScope();\n const legacyCommands = legacyRegistry.commands;\n const legacyCommandsAdapters = legacyCommands.map((command) => new LegacyCommandAdapter(command, cliMain));\n const cliGenerateCmd = new CliGenerateCmd(cliMain);\n const cliCmd = new CliCmd(cliMain, community.getDocsDomain());\n const helpCmd = new HelpCmd(cliMain, community.getDocsDomain());\n cliCmd.commands.push(cliGenerateCmd);\n cliMain.register(...legacyCommandsAdapters, new CompletionCmd(), cliCmd, helpCmd);\n return cliMain;\n }\n}\n\nCLIAspect.addRuntime(CLIMain);\n\n/**\n * kind of a hack.\n * in the legacy, this is running at the beginning and it take care of issues when Bit files are missing,\n * such as \".bit\".\n * (to make this process better, you can easily remove it and run the e2e-tests. you'll see some failing)\n */\nasync function ensureWorkspaceAndScope() {\n try {\n await loadConsumerIfExist();\n } catch (err) {\n // do nothing. it could fail for example with ScopeNotFound error, which is taken care of in \"bit init\".\n }\n}\n\nfunction isFullUrl(url: string) {\n return url.startsWith('http://') || url.startsWith('https://');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAC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