@teambit/cli 0.0.1432 → 0.0.1434

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.
@@ -22,7 +22,7 @@ export declare class CLIParser {
22
22
  private configureGlobalFlags;
23
23
  private throwForNonExistsCommand;
24
24
  /**
25
- * manipulate the command help output. there is no API from Yarn to do any of this, so it needs to be done manually.
25
+ * manipulate the command help output. there is no API from Yargs to do any of this, so it needs to be done manually.
26
26
  * see https://github.com/yargs/yargs/issues/1956
27
27
  *
28
28
  * the original order of the output:
@@ -210,11 +210,11 @@ class CLIParser {
210
210
  });
211
211
  }
212
212
  parseCommandWithSubCommands(command) {
213
- const yarnCommand = this.getYargsCommand(command);
213
+ const yargsCommand = this.getYargsCommand(command);
214
214
  // registering the sub-commands has to happen from a builder, which replaces the adapter's own
215
215
  // builder. that one registers this command's flags, positionals and examples, so without
216
216
  // delegating to it, running the parent with any of its own flags fails as an unknown argument.
217
- const registerOwnOptions = yarnCommand.builder;
217
+ const registerOwnOptions = yargsCommand.builder;
218
218
  const builderFunc = yargsInstance => {
219
219
  command.commands?.forEach(cmd => {
220
220
  const subCommand = this.getYargsCommand(cmd);
@@ -222,8 +222,8 @@ class CLIParser {
222
222
  });
223
223
  return registerOwnOptions(yargsInstance);
224
224
  };
225
- yarnCommand.builder = builderFunc;
226
- this.addYargsCommand(yarnCommand);
225
+ yargsCommand.builder = builderFunc;
226
+ this.addYargsCommand(yargsCommand);
227
227
  }
228
228
  getYargsCommand(command) {
229
229
  const yargsCommand = new (_yargsAdapter().YargsAdapter)(command, this.onCommandStartSlot);
@@ -261,7 +261,7 @@ class CLIParser {
261
261
  }
262
262
 
263
263
  /**
264
- * manipulate the command help output. there is no API from Yarn to do any of this, so it needs to be done manually.
264
+ * manipulate the command help output. there is no API from Yargs to do any of this, so it needs to be done manually.
265
265
  * see https://github.com/yargs/yargs/issues/1956
266
266
  *
267
267
  * the original order of the output:
@@ -1 +1 @@
1
- {"version":3,"names":["_didyoumean","data","_interopRequireDefault","require","_yargs","_lodash","_legacy","_legacy2","_legacy3","_chalk","_getCommandId","_help","_yargsAdapter","_commandNotFound","_yargsExitWorkaround","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","CLIParser","constructor","commands","groups","onCommandStartSlot","yargs","parse","args","process","argv","slice","throwForNonExistsCommand","logger","debug","join","writeCommandHistoryStart","help","configureParser","forEach","command","length","parseCommandWithSubCommands","yargsCommand","getYargsCommand","addYargsCommand","configureGlobalFlags","setHelpMiddleware","handleCommandFailure","configureCompletion","strict","wrap","currentYargsCommand","yargsCommands","find","y","commandRunner","Error","push","middleware","_","shouldShowInternalCommands","Boolean","internal","printHelp","exit","loader","off","showHelp","logCommandHelp","bind","fail","msg","err","stop","isHelpFlagEntered","includes","msgForDaemon","error","YargsExitWorkaround","helpMsg","isMsgAboutMissingArgs","startsWith","console","log","chalk","yellow","isDaemon","commandsToShowComponentIdsForCompletion","completion","current","completionFilter","done","consumer","loadConsumerIfExist","bitmapIdsFromCurrentLane","map","id","toStringWithoutVersion","formatHelp","parserConfiguration","yarnCommand","registerOwnOptions","builder","builderFunc","yargsInstance","cmd","subCommand","YargsAdapter","handler","option","alias","describe","group","GLOBAL_GROUP","global","commandName","commandsNames","c","getCommandId","name","aliases","filter","a","existingGlobalFlags","validCommands","commandExist","didYouMean","returnFirstMatch","suggestions","private","suggestion","Array","isArray","CommandNotFound","findCommandByArgv","lines","split","linesWithoutEmpty","compact","cmdLine","enteredCommand","commandId","replace","description","options","globalOptions","subCommands","examples","optionsStarted","globalStarted","subCommandsStarted","positionalsStarted","examplesStarted","currentLine","STANDARD_GROUP","optionsColored","optLine","match","leadingSpaces","optionPart","rest","coloredOptionPart","m","p1","p2","green","argsColored","arg","argName","optionsStr","argumentsStr","examplesStr","subCommandsStr","descriptionColored","desc","bold","extendedDescription","helpUrl","underline","descriptionStr","globalOptionsStr","finalOutput","exports","enteredSubCommand","undefined","isCommandMatch","str"],"sources":["cli-parser.ts"],"sourcesContent":["import didYouMean from 'didyoumean';\nimport yargs from 'yargs';\nimport type { Command } from './command';\nimport type { GroupsType } from './command-groups';\nimport { compact } from 'lodash';\nimport { loadConsumerIfExist } from '@teambit/legacy.consumer';\nimport { logger } from '@teambit/legacy.logger';\nimport { loader } from '@teambit/legacy.loader';\nimport chalk from 'chalk';\nimport { getCommandId } from './get-command-id';\nimport { formatHelp } from './help';\nimport { GLOBAL_GROUP, STANDARD_GROUP, YargsAdapter } from './yargs-adapter';\nimport { CommandNotFound } from './exceptions/command-not-found';\nimport type { OnCommandStartSlot } from './cli.main.runtime';\nimport type { CommandRunner } from './command-runner';\nimport { YargsExitWorkaround } from './exceptions/yargs-exit-workaround';\n\nexport class CLIParser {\n public parser = yargs;\n private yargsCommands: YargsAdapter[] = [];\n constructor(\n private commands: Command[],\n private groups: GroupsType,\n private onCommandStartSlot: OnCommandStartSlot\n ) {}\n\n async parse(args = process.argv.slice(2)): Promise<CommandRunner> {\n this.throwForNonExistsCommand(args[0]);\n logger.debug(`[+] CLI-INPUT: ${args.join(' ')}`);\n logger.writeCommandHistoryStart();\n yargs(args);\n yargs.help(false);\n this.configureParser();\n this.commands.forEach((command: Command) => {\n if (command.commands && command.commands.length) {\n this.parseCommandWithSubCommands(command);\n } else {\n const yargsCommand = this.getYargsCommand(command);\n this.addYargsCommand(yargsCommand);\n }\n });\n this.configureGlobalFlags();\n this.setHelpMiddleware();\n this.handleCommandFailure();\n this.configureCompletion();\n // yargs.showHelpOnFail(false); // doesn't help. it still shows the help on failure.\n yargs.strict(); // don't allow non-exist flags and non-exist commands\n\n yargs\n // .recommendCommands() // don't use it, it brings the global help of yargs, we have a custom one\n .wrap(null);\n\n await yargs.parse();\n\n const currentYargsCommand = this.yargsCommands.find((y) => y.commandRunner);\n if (!currentYargsCommand) {\n // this happens when the args/flags are wrong. in this case, it prints the help of the command and in most cases\n // exits the process before reaching this line. however, in case logger.isDaemon is true, which is for bit-cli-server,\n // it doesn't exits the process, so we need to return undefined here.\n throw new Error(`yargs failed to parse the command \"${args.join(' ')}\" and also failed to catch it properly`);\n }\n return currentYargsCommand.commandRunner as CommandRunner;\n }\n\n private addYargsCommand(yargsCommand: YargsAdapter) {\n this.yargsCommands.push(yargsCommand);\n yargs.command(yargsCommand);\n }\n\n private setHelpMiddleware() {\n yargs.middleware((argv) => {\n if (argv._.length === 0 && argv.help) {\n const shouldShowInternalCommands = Boolean(argv.internal);\n // this is the main help page\n this.printHelp(shouldShowInternalCommands);\n process.exit(0);\n }\n if (argv.help) {\n loader.off(); // stop the \"loading bit...\" before showing help if needed\n // this is a command help page\n yargs.showHelp(this.logCommandHelp.bind(this));\n process.exit(0);\n }\n }, true);\n }\n\n private handleCommandFailure() {\n yargs.fail((msg, err) => {\n loader.stop();\n if (err) {\n throw err;\n }\n const args = process.argv.slice(2);\n const isHelpFlagEntered = args.includes('--help') || args.includes('-h');\n let msgForDaemon = '';\n try {\n yargs.showHelp(this.logCommandHelp.bind(this));\n } catch (error: any) {\n if (error instanceof YargsExitWorkaround) {\n msgForDaemon = error.helpMsg;\n } else {\n throw error;\n }\n }\n const isMsgAboutMissingArgs = msg.startsWith('Not enough non-option arguments');\n // avoid showing the \"Not enough non-option arguments\" message when the user is trying to get the command help\n if (!isMsgAboutMissingArgs || !isHelpFlagEntered) {\n // eslint-disable-next-line no-console\n console.log(`\\n${chalk.yellow(msg)}`);\n msgForDaemon += `\\n${chalk.yellow(msg)}`;\n }\n if (logger.isDaemon) throw new YargsExitWorkaround(1, msgForDaemon);\n process.exit(1);\n });\n }\n\n private configureCompletion() {\n const commandsToShowComponentIdsForCompletion = [\n 'show',\n 'diff',\n 'tag',\n 'export',\n 'env',\n 'envs',\n 'compile',\n 'build',\n 'test',\n 'lint',\n 'log',\n 'dependents',\n 'dependencies',\n ];\n // @ts-ignore\n yargs.completion('completion', async function (current, argv, completionFilter, done) {\n if (!current.startsWith('-') && commandsToShowComponentIdsForCompletion.includes(argv._[1])) {\n const consumer = await loadConsumerIfExist();\n done(consumer?.bitmapIdsFromCurrentLane.map((id) => id.toStringWithoutVersion()));\n } else {\n completionFilter();\n }\n });\n }\n\n private printHelp(shouldShowInternalCommands = false) {\n const help = formatHelp(this.commands, this.groups, shouldShowInternalCommands);\n if (logger.isDaemon) throw new YargsExitWorkaround(0, help);\n else console.log(help); // eslint-disable-line no-console\n }\n\n private configureParser() {\n yargs.parserConfiguration({\n // 'strip-dashed': true, // we can't enable it, otherwise, the completion doesn't work\n 'strip-aliased': true,\n 'boolean-negation': false,\n 'populate--': true,\n });\n }\n\n private parseCommandWithSubCommands(command: Command) {\n const yarnCommand = this.getYargsCommand(command);\n // registering the sub-commands has to happen from a builder, which replaces the adapter's own\n // builder. that one registers this command's flags, positionals and examples, so without\n // delegating to it, running the parent with any of its own flags fails as an unknown argument.\n const registerOwnOptions = yarnCommand.builder as (yargsInstance: typeof yargs) => typeof yargs;\n const builderFunc = (yargsInstance: typeof yargs) => {\n command.commands?.forEach((cmd) => {\n const subCommand = this.getYargsCommand(cmd);\n this.addYargsCommand(subCommand);\n });\n return registerOwnOptions(yargsInstance);\n };\n yarnCommand.builder = builderFunc;\n this.addYargsCommand(yarnCommand);\n }\n\n private getYargsCommand(command: Command): YargsAdapter {\n const yargsCommand = new YargsAdapter(command, this.onCommandStartSlot);\n yargsCommand.builder = yargsCommand.builder.bind(yargsCommand);\n yargsCommand.handler = yargsCommand.handler.bind(yargsCommand);\n\n return yargsCommand;\n }\n\n private configureGlobalFlags() {\n yargs\n .option('help', {\n alias: 'h',\n describe: 'show help',\n group: GLOBAL_GROUP,\n })\n .option('version', {\n global: false,\n alias: 'v',\n describe: 'show version',\n group: GLOBAL_GROUP,\n });\n }\n\n private throwForNonExistsCommand(commandName: string) {\n if (!commandName || commandName.startsWith('-')) {\n return;\n }\n const commandsNames = this.commands.map((c) => getCommandId(c.name));\n const aliases = this.commands.map((c) => c.alias).filter((a) => a);\n const existingGlobalFlags = ['-V', '--version'];\n const validCommands = [...commandsNames, ...aliases, ...existingGlobalFlags];\n const commandExist = validCommands.includes(commandName);\n\n if (!commandExist) {\n didYouMean.returnFirstMatch = true;\n const suggestions = didYouMean(\n commandName,\n this.commands.filter((c) => !c.private).map((c) => getCommandId(c.name))\n );\n const suggestion = suggestions && Array.isArray(suggestions) ? suggestions[0] : suggestions;\n\n throw new CommandNotFound(commandName, suggestion as string);\n }\n }\n\n /**\n * manipulate the command help output. there is no API from Yarn to do any of this, so it needs to be done manually.\n * see https://github.com/yargs/yargs/issues/1956\n *\n * the original order of the output:\n * description\n * Options\n * Commands\n * Global\n * Positionals\n * Examples\n */\n private logCommandHelp(help: string) {\n const command = findCommandByArgv(this.commands);\n\n const lines = help.split('\\n');\n const linesWithoutEmpty = compact(lines);\n let cmdLine = linesWithoutEmpty[0];\n if (command?.alias) {\n const enteredCommand = process.argv[2];\n if (enteredCommand === command.alias) {\n const commandId = getCommandId(command.name);\n cmdLine = cmdLine.replace(commandId, command.alias);\n }\n }\n const description: string[] = [];\n const options: string[] = [];\n const globalOptions: string[] = [];\n const subCommands: string[] = [];\n const args: string[] = [];\n const examples: string[] = [];\n\n let optionsStarted = false;\n let globalStarted = false;\n let subCommandsStarted = false;\n let positionalsStarted = false;\n let examplesStarted = false;\n for (let i = 1; i < linesWithoutEmpty.length; i += 1) {\n const currentLine = linesWithoutEmpty[i];\n if (currentLine === STANDARD_GROUP) {\n optionsStarted = true;\n } else if (currentLine === GLOBAL_GROUP) {\n globalStarted = true;\n } else if (currentLine === 'Commands:') {\n subCommandsStarted = true;\n } else if (currentLine === 'Positionals:') {\n positionalsStarted = true;\n } else if (currentLine === 'Examples:') {\n examplesStarted = true;\n } else if (examplesStarted) {\n examples.push(currentLine);\n } else if (positionalsStarted) {\n args.push(currentLine);\n } else if (globalStarted) {\n globalOptions.push(currentLine);\n } else if (optionsStarted) {\n options.push(currentLine);\n } else if (subCommandsStarted) {\n subCommands.push(currentLine);\n } else {\n description.push(currentLine);\n }\n }\n\n // show the flags in green\n const optionsColored = options.map((optLine) => {\n const match = optLine.match(/^(\\s*)(.+?)(\\s{2,}.*)/);\n if (match) {\n const leadingSpaces = match[1];\n const optionPart = match[2];\n const rest = match[3];\n const coloredOptionPart = optionPart.replace(\n /(^|[^a-zA-Z0-9])(--?[a-zA-Z][a-zA-Z-]*)/g,\n (m, p1, p2) => p1 + chalk.green(p2)\n );\n return leadingSpaces + coloredOptionPart + rest;\n } else {\n return optLine;\n }\n });\n const argsColored = args.map((arg) => arg.replace(/^ {2}\\S+/, (argName) => chalk.green(argName))); // regex: two spaces then the first word until a white space\n const optionsStr = options.length ? `\\n${STANDARD_GROUP}\\n${optionsColored.join('\\n')}\\n` : '';\n const argumentsStr = args.length ? `\\nArguments:\\n${argsColored.join('\\n')}\\n` : '';\n const examplesStr = examples.length ? `\\nExamples:\\n${examples.join('\\n')}\\n` : '';\n const subCommandsStr = subCommands.length ? `\\n${'Commands:'}\\n${subCommands.join('\\n')}\\n` : '';\n // show the description in bold\n const descriptionColored = description.map((desc) => chalk.bold(desc));\n if (command?.extendedDescription) {\n descriptionColored.push(command?.extendedDescription);\n }\n if (command?.helpUrl) {\n descriptionColored.push(`for more info, visit: ${chalk.underline(command.helpUrl)}`);\n }\n const descriptionStr = descriptionColored.join('\\n');\n const globalOptionsStr = globalOptions.join('\\n');\n\n const finalOutput = `${cmdLine}\n\n${descriptionStr}\n${argumentsStr}${subCommandsStr}${optionsStr}${examplesStr}\n${GLOBAL_GROUP}\n${globalOptionsStr}`;\n\n if (logger.isDaemon) throw new YargsExitWorkaround(0, finalOutput);\n else console.log(finalOutput); // eslint-disable-line no-console\n }\n}\n\nexport function findCommandByArgv(commands: Command[]): Command | undefined {\n const args = process.argv.slice(2);\n const enteredCommand = args[0];\n const enteredSubCommand = args[1];\n if (!enteredCommand) {\n return undefined;\n }\n const isCommandMatch = (cmd: Command, str: string) => {\n return (\n cmd.name.startsWith(`${str} `) || // e.g. \"tag <id>\".startsWith(\"tag \")\n cmd.name === str || // e.g. \"globals\" === \"globals\"\n cmd.alias === str\n ); // e.g. \"t\" === \"t\"\n };\n const command = commands.find((cmd) => isCommandMatch(cmd, enteredCommand));\n if (!command) {\n return undefined;\n }\n if (!command.commands || !enteredSubCommand) {\n return command; // no sub-commands.\n }\n const subCommand = command.commands.find((cmd) => isCommandMatch(cmd, enteredSubCommand));\n return subCommand || command;\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,OAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,SAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,QAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,SAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,QAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,OAAA;EAAA,MAAAR,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAM,MAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,I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AAI,CAACjJ,OAAO,CAACjB,QAAQ,IAAI,CAACiK,iBAAiB,EAAE;IAC3C,OAAOhJ,OAAO,CAAC,CAAC;EAClB;EACA,MAAMmE,UAAU,GAAGnE,OAAO,CAACjB,QAAQ,CAAC+B,IAAI,CAAEoD,GAAG,IAAKgF,cAAc,CAAChF,GAAG,EAAE8E,iBAAiB,CAAC,CAAC;EACzF,OAAO7E,UAAU,IAAInE,OAAO;AAC9B","ignoreList":[]}
1
+ {"version":3,"names":["_didyoumean","data","_interopRequireDefault","require","_yargs","_lodash","_legacy","_legacy2","_legacy3","_chalk","_getCommandId","_help","_yargsAdapter","_commandNotFound","_yargsExitWorkaround","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","CLIParser","constructor","commands","groups","onCommandStartSlot","yargs","parse","args","process","argv","slice","throwForNonExistsCommand","logger","debug","join","writeCommandHistoryStart","help","configureParser","forEach","command","length","parseCommandWithSubCommands","yargsCommand","getYargsCommand","addYargsCommand","configureGlobalFlags","setHelpMiddleware","handleCommandFailure","configureCompletion","strict","wrap","currentYargsCommand","yargsCommands","find","y","commandRunner","Error","push","middleware","_","shouldShowInternalCommands","Boolean","internal","printHelp","exit","loader","off","showHelp","logCommandHelp","bind","fail","msg","err","stop","isHelpFlagEntered","includes","msgForDaemon","error","YargsExitWorkaround","helpMsg","isMsgAboutMissingArgs","startsWith","console","log","chalk","yellow","isDaemon","commandsToShowComponentIdsForCompletion","completion","current","completionFilter","done","consumer","loadConsumerIfExist","bitmapIdsFromCurrentLane","map","id","toStringWithoutVersion","formatHelp","parserConfiguration","registerOwnOptions","builder","builderFunc","yargsInstance","cmd","subCommand","YargsAdapter","handler","option","alias","describe","group","GLOBAL_GROUP","global","commandName","commandsNames","c","getCommandId","name","aliases","filter","a","existingGlobalFlags","validCommands","commandExist","didYouMean","returnFirstMatch","suggestions","private","suggestion","Array","isArray","CommandNotFound","findCommandByArgv","lines","split","linesWithoutEmpty","compact","cmdLine","enteredCommand","commandId","replace","description","options","globalOptions","subCommands","examples","optionsStarted","globalStarted","subCommandsStarted","positionalsStarted","examplesStarted","currentLine","STANDARD_GROUP","optionsColored","optLine","match","leadingSpaces","optionPart","rest","coloredOptionPart","m","p1","p2","green","argsColored","arg","argName","optionsStr","argumentsStr","examplesStr","subCommandsStr","descriptionColored","desc","bold","extendedDescription","helpUrl","underline","descriptionStr","globalOptionsStr","finalOutput","exports","enteredSubCommand","undefined","isCommandMatch","str"],"sources":["cli-parser.ts"],"sourcesContent":["import didYouMean from 'didyoumean';\nimport yargs from 'yargs';\nimport type { Command } from './command';\nimport type { GroupsType } from './command-groups';\nimport { compact } from 'lodash';\nimport { loadConsumerIfExist } from '@teambit/legacy.consumer';\nimport { logger } from '@teambit/legacy.logger';\nimport { loader } from '@teambit/legacy.loader';\nimport chalk from 'chalk';\nimport { getCommandId } from './get-command-id';\nimport { formatHelp } from './help';\nimport { GLOBAL_GROUP, STANDARD_GROUP, YargsAdapter } from './yargs-adapter';\nimport { CommandNotFound } from './exceptions/command-not-found';\nimport type { OnCommandStartSlot } from './cli.main.runtime';\nimport type { CommandRunner } from './command-runner';\nimport { YargsExitWorkaround } from './exceptions/yargs-exit-workaround';\n\nexport class CLIParser {\n public parser = yargs;\n private yargsCommands: YargsAdapter[] = [];\n constructor(\n private commands: Command[],\n private groups: GroupsType,\n private onCommandStartSlot: OnCommandStartSlot\n ) {}\n\n async parse(args = process.argv.slice(2)): Promise<CommandRunner> {\n this.throwForNonExistsCommand(args[0]);\n logger.debug(`[+] CLI-INPUT: ${args.join(' ')}`);\n logger.writeCommandHistoryStart();\n yargs(args);\n yargs.help(false);\n this.configureParser();\n this.commands.forEach((command: Command) => {\n if (command.commands && command.commands.length) {\n this.parseCommandWithSubCommands(command);\n } else {\n const yargsCommand = this.getYargsCommand(command);\n this.addYargsCommand(yargsCommand);\n }\n });\n this.configureGlobalFlags();\n this.setHelpMiddleware();\n this.handleCommandFailure();\n this.configureCompletion();\n // yargs.showHelpOnFail(false); // doesn't help. it still shows the help on failure.\n yargs.strict(); // don't allow non-exist flags and non-exist commands\n\n yargs\n // .recommendCommands() // don't use it, it brings the global help of yargs, we have a custom one\n .wrap(null);\n\n await yargs.parse();\n\n const currentYargsCommand = this.yargsCommands.find((y) => y.commandRunner);\n if (!currentYargsCommand) {\n // this happens when the args/flags are wrong. in this case, it prints the help of the command and in most cases\n // exits the process before reaching this line. however, in case logger.isDaemon is true, which is for bit-cli-server,\n // it doesn't exits the process, so we need to return undefined here.\n throw new Error(`yargs failed to parse the command \"${args.join(' ')}\" and also failed to catch it properly`);\n }\n return currentYargsCommand.commandRunner as CommandRunner;\n }\n\n private addYargsCommand(yargsCommand: YargsAdapter) {\n this.yargsCommands.push(yargsCommand);\n yargs.command(yargsCommand);\n }\n\n private setHelpMiddleware() {\n yargs.middleware((argv) => {\n if (argv._.length === 0 && argv.help) {\n const shouldShowInternalCommands = Boolean(argv.internal);\n // this is the main help page\n this.printHelp(shouldShowInternalCommands);\n process.exit(0);\n }\n if (argv.help) {\n loader.off(); // stop the \"loading bit...\" before showing help if needed\n // this is a command help page\n yargs.showHelp(this.logCommandHelp.bind(this));\n process.exit(0);\n }\n }, true);\n }\n\n private handleCommandFailure() {\n yargs.fail((msg, err) => {\n loader.stop();\n if (err) {\n throw err;\n }\n const args = process.argv.slice(2);\n const isHelpFlagEntered = args.includes('--help') || args.includes('-h');\n let msgForDaemon = '';\n try {\n yargs.showHelp(this.logCommandHelp.bind(this));\n } catch (error: any) {\n if (error instanceof YargsExitWorkaround) {\n msgForDaemon = error.helpMsg;\n } else {\n throw error;\n }\n }\n const isMsgAboutMissingArgs = msg.startsWith('Not enough non-option arguments');\n // avoid showing the \"Not enough non-option arguments\" message when the user is trying to get the command help\n if (!isMsgAboutMissingArgs || !isHelpFlagEntered) {\n // eslint-disable-next-line no-console\n console.log(`\\n${chalk.yellow(msg)}`);\n msgForDaemon += `\\n${chalk.yellow(msg)}`;\n }\n if (logger.isDaemon) throw new YargsExitWorkaround(1, msgForDaemon);\n process.exit(1);\n });\n }\n\n private configureCompletion() {\n const commandsToShowComponentIdsForCompletion = [\n 'show',\n 'diff',\n 'tag',\n 'export',\n 'env',\n 'envs',\n 'compile',\n 'build',\n 'test',\n 'lint',\n 'log',\n 'dependents',\n 'dependencies',\n ];\n // @ts-ignore\n yargs.completion('completion', async function (current, argv, completionFilter, done) {\n if (!current.startsWith('-') && commandsToShowComponentIdsForCompletion.includes(argv._[1])) {\n const consumer = await loadConsumerIfExist();\n done(consumer?.bitmapIdsFromCurrentLane.map((id) => id.toStringWithoutVersion()));\n } else {\n completionFilter();\n }\n });\n }\n\n private printHelp(shouldShowInternalCommands = false) {\n const help = formatHelp(this.commands, this.groups, shouldShowInternalCommands);\n if (logger.isDaemon) throw new YargsExitWorkaround(0, help);\n else console.log(help); // eslint-disable-line no-console\n }\n\n private configureParser() {\n yargs.parserConfiguration({\n // 'strip-dashed': true, // we can't enable it, otherwise, the completion doesn't work\n 'strip-aliased': true,\n 'boolean-negation': false,\n 'populate--': true,\n });\n }\n\n private parseCommandWithSubCommands(command: Command) {\n const yargsCommand = this.getYargsCommand(command);\n // registering the sub-commands has to happen from a builder, which replaces the adapter's own\n // builder. that one registers this command's flags, positionals and examples, so without\n // delegating to it, running the parent with any of its own flags fails as an unknown argument.\n const registerOwnOptions = yargsCommand.builder as (yargsInstance: typeof yargs) => typeof yargs;\n const builderFunc = (yargsInstance: typeof yargs) => {\n command.commands?.forEach((cmd) => {\n const subCommand = this.getYargsCommand(cmd);\n this.addYargsCommand(subCommand);\n });\n return registerOwnOptions(yargsInstance);\n };\n yargsCommand.builder = builderFunc;\n this.addYargsCommand(yargsCommand);\n }\n\n private getYargsCommand(command: Command): YargsAdapter {\n const yargsCommand = new YargsAdapter(command, this.onCommandStartSlot);\n yargsCommand.builder = yargsCommand.builder.bind(yargsCommand);\n yargsCommand.handler = yargsCommand.handler.bind(yargsCommand);\n\n return yargsCommand;\n }\n\n private configureGlobalFlags() {\n yargs\n .option('help', {\n alias: 'h',\n describe: 'show help',\n group: GLOBAL_GROUP,\n })\n .option('version', {\n global: false,\n alias: 'v',\n describe: 'show version',\n group: GLOBAL_GROUP,\n });\n }\n\n private throwForNonExistsCommand(commandName: string) {\n if (!commandName || commandName.startsWith('-')) {\n return;\n }\n const commandsNames = this.commands.map((c) => getCommandId(c.name));\n const aliases = this.commands.map((c) => c.alias).filter((a) => a);\n const existingGlobalFlags = ['-V', '--version'];\n const validCommands = [...commandsNames, ...aliases, ...existingGlobalFlags];\n const commandExist = validCommands.includes(commandName);\n\n if (!commandExist) {\n didYouMean.returnFirstMatch = true;\n const suggestions = didYouMean(\n commandName,\n this.commands.filter((c) => !c.private).map((c) => getCommandId(c.name))\n );\n const suggestion = suggestions && Array.isArray(suggestions) ? suggestions[0] : suggestions;\n\n throw new CommandNotFound(commandName, suggestion as string);\n }\n }\n\n /**\n * manipulate the command help output. there is no API from Yargs to do any of this, so it needs to be done manually.\n * see https://github.com/yargs/yargs/issues/1956\n *\n * the original order of the output:\n * description\n * Options\n * Commands\n * Global\n * Positionals\n * Examples\n */\n private logCommandHelp(help: string) {\n const command = findCommandByArgv(this.commands);\n\n const lines = help.split('\\n');\n const linesWithoutEmpty = compact(lines);\n let cmdLine = linesWithoutEmpty[0];\n if (command?.alias) {\n const enteredCommand = process.argv[2];\n if (enteredCommand === command.alias) {\n const commandId = getCommandId(command.name);\n cmdLine = cmdLine.replace(commandId, command.alias);\n }\n }\n const description: string[] = [];\n const options: string[] = [];\n const globalOptions: string[] = [];\n const subCommands: string[] = [];\n const args: string[] = [];\n const examples: string[] = [];\n\n let optionsStarted = false;\n let globalStarted = false;\n let subCommandsStarted = false;\n let positionalsStarted = false;\n let examplesStarted = false;\n for (let i = 1; i < linesWithoutEmpty.length; i += 1) {\n const currentLine = linesWithoutEmpty[i];\n if (currentLine === STANDARD_GROUP) {\n optionsStarted = true;\n } else if (currentLine === GLOBAL_GROUP) {\n globalStarted = true;\n } else if (currentLine === 'Commands:') {\n subCommandsStarted = true;\n } else if (currentLine === 'Positionals:') {\n positionalsStarted = true;\n } else if (currentLine === 'Examples:') {\n examplesStarted = true;\n } else if (examplesStarted) {\n examples.push(currentLine);\n } else if (positionalsStarted) {\n args.push(currentLine);\n } else if (globalStarted) {\n globalOptions.push(currentLine);\n } else if (optionsStarted) {\n options.push(currentLine);\n } else if (subCommandsStarted) {\n subCommands.push(currentLine);\n } else {\n description.push(currentLine);\n }\n }\n\n // show the flags in green\n const optionsColored = options.map((optLine) => {\n const match = optLine.match(/^(\\s*)(.+?)(\\s{2,}.*)/);\n if (match) {\n const leadingSpaces = match[1];\n const optionPart = match[2];\n const rest = match[3];\n const coloredOptionPart = optionPart.replace(\n /(^|[^a-zA-Z0-9])(--?[a-zA-Z][a-zA-Z-]*)/g,\n (m, p1, p2) => p1 + chalk.green(p2)\n );\n return leadingSpaces + coloredOptionPart + rest;\n } else {\n return optLine;\n }\n });\n const argsColored = args.map((arg) => arg.replace(/^ {2}\\S+/, (argName) => chalk.green(argName))); // regex: two spaces then the first word until a white space\n const optionsStr = options.length ? `\\n${STANDARD_GROUP}\\n${optionsColored.join('\\n')}\\n` : '';\n const argumentsStr = args.length ? `\\nArguments:\\n${argsColored.join('\\n')}\\n` : '';\n const examplesStr = examples.length ? `\\nExamples:\\n${examples.join('\\n')}\\n` : '';\n const subCommandsStr = subCommands.length ? `\\n${'Commands:'}\\n${subCommands.join('\\n')}\\n` : '';\n // show the description in bold\n const descriptionColored = description.map((desc) => chalk.bold(desc));\n if (command?.extendedDescription) {\n descriptionColored.push(command?.extendedDescription);\n }\n if (command?.helpUrl) {\n descriptionColored.push(`for more info, visit: ${chalk.underline(command.helpUrl)}`);\n }\n const descriptionStr = descriptionColored.join('\\n');\n const globalOptionsStr = globalOptions.join('\\n');\n\n const finalOutput = `${cmdLine}\n\n${descriptionStr}\n${argumentsStr}${subCommandsStr}${optionsStr}${examplesStr}\n${GLOBAL_GROUP}\n${globalOptionsStr}`;\n\n if (logger.isDaemon) throw new YargsExitWorkaround(0, finalOutput);\n else console.log(finalOutput); // eslint-disable-line no-console\n }\n}\n\nexport function findCommandByArgv(commands: Command[]): Command | undefined {\n const args = process.argv.slice(2);\n const enteredCommand = args[0];\n const enteredSubCommand = args[1];\n if (!enteredCommand) {\n return undefined;\n }\n const isCommandMatch = (cmd: Command, str: string) => {\n return (\n cmd.name.startsWith(`${str} `) || // e.g. \"tag <id>\".startsWith(\"tag \")\n cmd.name === str || // e.g. \"globals\" === \"globals\"\n cmd.alias === str\n ); // e.g. \"t\" === \"t\"\n };\n const command = commands.find((cmd) => isCommandMatch(cmd, enteredCommand));\n if (!command) {\n return undefined;\n }\n if (!command.commands || !enteredSubCommand) {\n return command; // no sub-commands.\n }\n const subCommand = command.commands.find((cmd) => isCommandMatch(cmd, enteredSubCommand));\n return subCommand || command;\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,OAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,SAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,QAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA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I;IAClCjF,GAAG,CAACc,IAAI,KAAKmE,GAAG;IAAI;IACpBjF,GAAG,CAACK,KAAK,KAAK4E,GAAG,CACjB,CAAC;EACL,CAAC;EACD,MAAMlJ,OAAO,GAAGjB,QAAQ,CAAC+B,IAAI,CAAEmD,GAAG,IAAKgF,cAAc,CAAChF,GAAG,EAAEmC,cAAc,CAAC,CAAC;EAC3E,IAAI,CAACpG,OAAO,EAAE;IACZ,OAAOgJ,SAAS;EAClB;EACA,IAAI,CAAChJ,OAAO,CAACjB,QAAQ,IAAI,CAACgK,iBAAiB,EAAE;IAC3C,OAAO/I,OAAO,CAAC,CAAC;EAClB;EACA,MAAMkE,UAAU,GAAGlE,OAAO,CAACjB,QAAQ,CAAC+B,IAAI,CAAEmD,GAAG,IAAKgF,cAAc,CAAChF,GAAG,EAAE8E,iBAAiB,CAAC,CAAC;EACzF,OAAO7E,UAAU,IAAIlE,OAAO;AAC9B","ignoreList":[]}
package/dist/command.d.ts CHANGED
@@ -88,11 +88,6 @@ export interface Command {
88
88
  * default is true.
89
89
  */
90
90
  loadAspects?: boolean;
91
- /**
92
- * do not set this. it is being set once the command run.
93
- * the values are those followed `--` in the command line. (e.g. `bit import -- --no-optional`)
94
- */
95
- _packageManagerArgs?: string[];
96
91
  /**
97
92
  * Command handler which prints the return value to the console and exits.
98
93
  * If the command has both, `render` and `report`, this one will be called when process.isTTY is false.
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["command.ts"],"sourcesContent":["import type { Group } from './command-groups';\n\ntype CommandOption = [string, string, string];\nexport type CommandOptions = Array<CommandOption>;\n\nexport interface Command {\n /**\n * Name of command with arguments:\n * <> for mandatory arguments.\n * [] for optional arguments.\n * e.g. 'add <path>'\n */\n name: string;\n\n /**\n * command alias (for example: 't' for 'tag')\n */\n alias?: string;\n\n /**\n * The description of the command. Being used in the commands summery (`bit --help`) and the help (e.g. `bit create --help`).\n * should be short and precise. not more than one line. (use extendedDescription for more info).\n */\n description: string;\n\n /**\n * The extended description of the command. Will be seen in only in the command help, just after the description.\n */\n extendedDescription?: string;\n\n /**\n * url to a doc page explaining the command. shown in the command help just after the extendedDescription.\n * if a relative url is entered, the base url will be retrieved from `teambit.community/community` aspect.\n */\n helpUrl?: string;\n\n /**\n * allow grouping of commands to hint summery renderer\n * Places in default automatic help\n */\n group?: Group | string;\n\n /**\n * should a command be exposed to the user (by bit help).\n * e.g. experimental or plumbing commands should be hidden.\n */\n private?: boolean;\n\n /**\n * should turn on Loader.\n * the default is false for internal-commands and true for others.\n * @see cliMain.setDefaults()\n */\n loader?: boolean;\n\n /**\n * opt this command's `report` output into paging (like git's log/diff).\n * when true, and stdout is an interactive human terminal, the output is piped through a pager\n * (`less` by default). non-interactive contexts (piped output, CI, ai-agents, bit-cli-server)\n * always get the full output at once. users can override with --pager / --no-pager.\n * the default is false.\n */\n pager?: boolean;\n\n /**\n * Array of command options where each element is a tuple.\n * ['flag alias', 'flag name', 'flag description']\n * for example:\n * ['j', 'json', 'output json format']\n */\n options: CommandOptions;\n\n /**\n * arguments are defined in the \"name\" property, and that's where the source of truth is.\n * this prop is optional and provides a way to describe the args. later, it'll support more fields, such as defaultValue.\n * if this is set, it'll be shown in the command help under \"Arguments\" section.\n */\n arguments?: CommandArg[];\n\n /**\n * sub commands for example:\n * bit capsule list to list active capsules.\n */\n commands?: Command[];\n\n /**\n * interact with a remote, e.g. \"export\" push to a remote\n * for now, the only difference is that they get a \"token\" flag to authenticate anonymously.\n */\n remoteOp?: boolean;\n\n /**\n * if true, it indicates that it doesn't need the workspace to work and can be executed outside a\n * workspace\n */\n skipWorkspace?: boolean;\n\n /**\n * optionally, give some examples how to use the command.\n */\n examples?: Example[];\n\n /**\n * whether to load aspects set in workspace.jsonc before running the command.\n * default is true.\n */\n loadAspects?: boolean;\n\n /**\n * do not set this. it is being set once the command run.\n * the values are those followed `--` in the command line. (e.g. `bit import -- --no-optional`)\n */\n _packageManagerArgs?: string[];\n\n /**\n * Command handler which prints the return value to the console and exits.\n * If the command has both, `render` and `report`, this one will be called when process.isTTY is false.\n * @param args - arguments object as defined in name.\n * @param flags - command flags as described in options.\n * @return - Report object. The Report.data is printed to the stdout as is.\n * Optionally include Report.details for expanded output accessible via `bit details` after the command completes.\n */\n report?(args: CLIArgs, flags: Flags): Promise<string | Report>;\n\n /**\n * Command handler which never exits the process\n * @param args - arguments object as defined in name.\n * @param flags - command flags as described in options.\n */\n wait?(args: CLIArgs, flags: Flags): Promise<void>;\n\n /**\n * Optional handler to provide a raw result of the command.\n * Will be go called if '-j'/'--json' option is provided by user.\n * @param args - arguments object as defined in name.\n * @param flags - command flags as described in options.\n * @return a GenericObject to be rendered to string (by json.stringify) in the console.\n */\n json?(args: CLIArgs, flags: Flags): Promise<GenericObject>;\n}\nexport type Flags = { [flagName: string]: string | boolean | undefined | any };\nexport type CLIArgs = Array<string[] | string>;\nexport type GenericObject = { [k: string]: any };\nexport type Report = {\n data: string;\n code: number;\n /**\n * Optional expanded output persisted to disk and viewable via `bit details`.\n * Use this for verbose information (e.g. auto-tagged dependents) that would clutter\n * the default output but is useful after a one-shot command has already completed.\n */\n details?: string;\n};\nexport type CommandArg = { name: string; description?: string };\nexport type Example = { cmd: string; description: string };\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["command.ts"],"sourcesContent":["import type { Group } from './command-groups';\n\ntype CommandOption = [string, string, string];\nexport type CommandOptions = Array<CommandOption>;\n\nexport interface Command {\n /**\n * Name of command with arguments:\n * <> for mandatory arguments.\n * [] for optional arguments.\n * e.g. 'add <path>'\n */\n name: string;\n\n /**\n * command alias (for example: 't' for 'tag')\n */\n alias?: string;\n\n /**\n * The description of the command. Being used in the commands summery (`bit --help`) and the help (e.g. `bit create --help`).\n * should be short and precise. not more than one line. (use extendedDescription for more info).\n */\n description: string;\n\n /**\n * The extended description of the command. Will be seen in only in the command help, just after the description.\n */\n extendedDescription?: string;\n\n /**\n * url to a doc page explaining the command. shown in the command help just after the extendedDescription.\n * if a relative url is entered, the base url will be retrieved from `teambit.community/community` aspect.\n */\n helpUrl?: string;\n\n /**\n * allow grouping of commands to hint summery renderer\n * Places in default automatic help\n */\n group?: Group | string;\n\n /**\n * should a command be exposed to the user (by bit help).\n * e.g. experimental or plumbing commands should be hidden.\n */\n private?: boolean;\n\n /**\n * should turn on Loader.\n * the default is false for internal-commands and true for others.\n * @see cliMain.setDefaults()\n */\n loader?: boolean;\n\n /**\n * opt this command's `report` output into paging (like git's log/diff).\n * when true, and stdout is an interactive human terminal, the output is piped through a pager\n * (`less` by default). non-interactive contexts (piped output, CI, ai-agents, bit-cli-server)\n * always get the full output at once. users can override with --pager / --no-pager.\n * the default is false.\n */\n pager?: boolean;\n\n /**\n * Array of command options where each element is a tuple.\n * ['flag alias', 'flag name', 'flag description']\n * for example:\n * ['j', 'json', 'output json format']\n */\n options: CommandOptions;\n\n /**\n * arguments are defined in the \"name\" property, and that's where the source of truth is.\n * this prop is optional and provides a way to describe the args. later, it'll support more fields, such as defaultValue.\n * if this is set, it'll be shown in the command help under \"Arguments\" section.\n */\n arguments?: CommandArg[];\n\n /**\n * sub commands for example:\n * bit capsule list to list active capsules.\n */\n commands?: Command[];\n\n /**\n * interact with a remote, e.g. \"export\" push to a remote\n * for now, the only difference is that they get a \"token\" flag to authenticate anonymously.\n */\n remoteOp?: boolean;\n\n /**\n * if true, it indicates that it doesn't need the workspace to work and can be executed outside a\n * workspace\n */\n skipWorkspace?: boolean;\n\n /**\n * optionally, give some examples how to use the command.\n */\n examples?: Example[];\n\n /**\n * whether to load aspects set in workspace.jsonc before running the command.\n * default is true.\n */\n loadAspects?: boolean;\n\n /**\n * Command handler which prints the return value to the console and exits.\n * If the command has both, `render` and `report`, this one will be called when process.isTTY is false.\n * @param args - arguments object as defined in name.\n * @param flags - command flags as described in options.\n * @return - Report object. The Report.data is printed to the stdout as is.\n * Optionally include Report.details for expanded output accessible via `bit details` after the command completes.\n */\n report?(args: CLIArgs, flags: Flags): Promise<string | Report>;\n\n /**\n * Command handler which never exits the process\n * @param args - arguments object as defined in name.\n * @param flags - command flags as described in options.\n */\n wait?(args: CLIArgs, flags: Flags): Promise<void>;\n\n /**\n * Optional handler to provide a raw result of the command.\n * Will be go called if '-j'/'--json' option is provided by user.\n * @param args - arguments object as defined in name.\n * @param flags - command flags as described in options.\n * @return a GenericObject to be rendered to string (by json.stringify) in the console.\n */\n json?(args: CLIArgs, flags: Flags): Promise<GenericObject>;\n}\nexport type Flags = { [flagName: string]: string | boolean | undefined | any };\nexport type CLIArgs = Array<string[] | string>;\nexport type GenericObject = { [k: string]: any };\nexport type Report = {\n data: string;\n code: number;\n /**\n * Optional expanded output persisted to disk and viewable via `bit details`.\n * Use this for verbose information (e.g. auto-tagged dependents) that would clutter\n * the default output but is useful after a one-shot command has already completed.\n */\n details?: string;\n};\nexport type CommandArg = { name: string; description?: string };\nexport type Example = { cmd: string; description: string };\n"],"mappings":"","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_cli@0.0.1432/dist/cli.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_cli@0.0.1432/dist/cli.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_cli@0.0.1434/dist/cli.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_cli@0.0.1434/dist/cli.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -68,7 +68,6 @@ class YargsAdapter {
68
68
  acc[current] = val;
69
69
  return acc;
70
70
  }, {});
71
- this.commanderCommand._packageManagerArgs = argv['--'] || [];
72
71
  const commandRunner = new (_commandRunner().CommandRunner)(this.commanderCommand, argsValues, flags, this.onCommandStartSlot);
73
72
  this.commandRunner = commandRunner;
74
73
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_legacy","data","require","_commandRunner","_commandHelper","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","GLOBAL_GROUP","exports","STANDARD_GROUP","YargsAdapter","constructor","commanderCommand","onCommandStartSlot","command","name","describe","description","aliases","alias","builder","yargs","options","optionsToBuilder","option","arg","positional","examples","example","cmd","handler","argv","commandArgs","getArgsData","map","nameCamelCase","argsValues","a","flags","reduce","acc","current","val","_packageManagerArgs","commandRunner","CommandRunner","flagsData","getFlagsData","isLocalToCommand","Boolean","commands","flag","group","type","requiresArg","global","globalOptions","getGlobalOptions","remoteOp","TOKEN_FLAG","log","pager"],"sources":["yargs-adapter.ts"],"sourcesContent":["import type { Command } from './command';\nimport type { Arguments, CommandModule, Argv, Options } from 'yargs';\nimport { TOKEN_FLAG } from '@teambit/legacy.constants';\nimport { CommandRunner } from './command-runner';\nimport type { OnCommandStartSlot } from './cli.main.runtime';\nimport { getArgsData, getFlagsData } from './command-helper';\n\nexport const GLOBAL_GROUP = 'Global';\nexport const STANDARD_GROUP = 'Options';\n\nexport class YargsAdapter implements CommandModule {\n command: string;\n describe?: string;\n aliases?: string;\n commandRunner?: CommandRunner;\n constructor(\n private commanderCommand: Command,\n private onCommandStartSlot: OnCommandStartSlot\n ) {\n this.command = commanderCommand.name;\n this.describe = commanderCommand.description;\n this.aliases = commanderCommand.alias;\n }\n\n builder(yargs: Argv) {\n const options = YargsAdapter.optionsToBuilder(this.commanderCommand);\n yargs.option(options);\n this.commanderCommand.arguments?.forEach((arg) => {\n yargs.positional(arg.name, { description: arg.description });\n });\n this.commanderCommand.examples?.forEach((example) => {\n yargs.example(example.cmd, example.description);\n });\n\n return yargs;\n }\n\n handler(argv: Arguments) {\n const commandArgs = getArgsData(this.commanderCommand).map((arg) => arg.nameCamelCase);\n const argsValues = commandArgs.map((a) => argv[a]) as any[];\n // a workaround to get a flag syntax such as \"--all [version]\" work with yargs.\n const flags = Object.keys(argv).reduce((acc, current) => {\n if (current === '_' || current === '$0' || current === '--') return acc;\n // const flagName = current.split(' ')[0];\n const val = typeof argv[current] === 'string' && !argv[current] ? true : argv[current];\n acc[current] = val;\n return acc;\n }, {});\n this.commanderCommand._packageManagerArgs = (argv['--'] || []) as string[];\n\n const commandRunner = new CommandRunner(this.commanderCommand, argsValues, flags, this.onCommandStartSlot);\n this.commandRunner = commandRunner;\n }\n\n get positional() {\n return this.commanderCommand.arguments;\n }\n\n static optionsToBuilder(command: Command): { [key: string]: Options } {\n const flagsData = getFlagsData(command);\n // yargs options are global by default, which would let a command's own flags reach its\n // sub-commands. a sub-command may declare the same flag name with a different arity - e.g.\n // `bit lane --remote <scope>` takes a value where `bit lane remove --remote` is a boolean - and\n // the parent's definition would shadow it. the global options below stay global on purpose.\n const isLocalToCommand = Boolean(command.commands?.length);\n const option = flagsData.reduce((acc, flag) => {\n acc[flag.name] = {\n alias: flag.alias,\n describe: flag.description,\n group: STANDARD_GROUP,\n type: flag.type,\n requiresArg: flag.requiresArg,\n ...(isLocalToCommand ? { global: false } : {}),\n } as Options;\n return acc;\n }, {});\n\n const globalOptions = YargsAdapter.getGlobalOptions(command);\n\n return { ...option, ...globalOptions };\n }\n\n static getGlobalOptions(command: Command): Record<string, any> {\n const globalOptions: Record<string, any> = {};\n if (command.remoteOp) {\n globalOptions[TOKEN_FLAG] = {\n describe: 'authentication token',\n group: GLOBAL_GROUP,\n };\n }\n globalOptions.log = {\n describe:\n 'print log messages to the screen, options are: [trace, debug, info, warn, error, fatal], the default is info',\n group: GLOBAL_GROUP,\n };\n globalOptions['safe-mode'] = {\n describe:\n 'useful when it fails to load normally. it skips loading aspects from workspace.jsonc, and for legacy-commands it initializes only the CLI aspect',\n group: GLOBAL_GROUP,\n };\n if (command.pager) {\n globalOptions.pager = {\n describe: 'force paging the output through a pager (e.g. less), even if it fits on one screen',\n group: GLOBAL_GROUP,\n type: 'boolean',\n };\n globalOptions['no-pager'] = {\n describe: 'do not use a pager; print all output at once (default for ai-agents, CI, and piped output)',\n group: GLOBAL_GROUP,\n type: 'boolean',\n };\n }\n return globalOptions;\n }\n}\n"],"mappings":";;;;;;AAEA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,eAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,cAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,eAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,cAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA6D,SAAAI,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAAU,cAAAZ,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAY,SAAA,CAAAC,MAAA,EAAAb,CAAA,UAAAC,CAAA,WAAAW,SAAA,CAAAZ,CAAA,IAAAY,SAAA,CAAAZ,CAAA,QAAAA,CAAA,OAAAF,OAAA,CAAAI,MAAA,CAAAD,CAAA,OAAAa,OAAA,WAAAd,CAA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ACrB4C,IAAI,EAAEF,IAAI,CAACE,IAAI;QACfC,WAAW,EAAEH,IAAI,CAACG;MAAW,GACzBN,gBAAgB,GAAG;QAAEO,MAAM,EAAE;MAAM,CAAC,GAAG,CAAC,CAAC,CACnC;MACZ,OAAOf,GAAG;IACZ,CAAC,EAAE,CAAC,CAAC,CAAC;IAEN,MAAMgB,aAAa,GAAG9C,YAAY,CAAC+C,gBAAgB,CAAC3C,OAAO,CAAC;IAE5D,OAAA3B,aAAA,CAAAA,aAAA,KAAYqC,MAAM,GAAKgC,aAAa;EACtC;EAEA,OAAOC,gBAAgBA,CAAC3C,OAAgB,EAAuB;IAC7D,MAAM0C,aAAkC,GAAG,CAAC,CAAC;IAC7C,IAAI1C,OAAO,CAAC4C,QAAQ,EAAE;MACpBF,aAAa,CAACG,oBAAU,CAAC,GAAG;QAC1B3C,QAAQ,EAAE,sBAAsB;QAChCoC,KAAK,EAAE7C;MACT,CAAC;IACH;IACAiD,aAAa,CAACI,GAAG,GAAG;MAClB5C,QAAQ,EACN,8GAA8G;MAChHoC,KAAK,EAAE7C;IACT,CAAC;IACDiD,aAAa,CAAC,WAAW,CAAC,GAAG;MAC3BxC,QAAQ,EACN,kJAAkJ;MACpJoC,KAAK,EAAE7C;IACT,CAAC;IACD,IAAIO,OAAO,CAAC+C,KAAK,EAAE;MACjBL,aAAa,CAACK,KAAK,GAAG;QACpB7C,QAAQ,EAAE,oFAAoF;QAC9FoC,KAAK,EAAE7C,YAAY;QACnB8C,IAAI,EAAE;MACR,CAAC;MACDG,aAAa,CAAC,UAAU,CAAC,GAAG;QAC1BxC,QAAQ,EAAE,4FAA4F;QACtGoC,KAAK,EAAE7C,YAAY;QACnB8C,IAAI,EAAE;MACR,CAAC;IACH;IACA,OAAOG,aAAa;EACtB;AACF;AAAChD,OAAA,CAAAE,YAAA,GAAAA,YAAA","ignoreList":[]}
1
+ {"version":3,"names":["_legacy","data","require","_commandRunner","_commandHelper","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","GLOBAL_GROUP","exports","STANDARD_GROUP","YargsAdapter","constructor","commanderCommand","onCommandStartSlot","command","name","describe","description","aliases","alias","builder","yargs","options","optionsToBuilder","option","arg","positional","examples","example","cmd","handler","argv","commandArgs","getArgsData","map","nameCamelCase","argsValues","a","flags","reduce","acc","current","val","commandRunner","CommandRunner","flagsData","getFlagsData","isLocalToCommand","Boolean","commands","flag","group","type","requiresArg","global","globalOptions","getGlobalOptions","remoteOp","TOKEN_FLAG","log","pager"],"sources":["yargs-adapter.ts"],"sourcesContent":["import type { Command } from './command';\nimport type { Arguments, CommandModule, Argv, Options } from 'yargs';\nimport { TOKEN_FLAG } from '@teambit/legacy.constants';\nimport { CommandRunner } from './command-runner';\nimport type { OnCommandStartSlot } from './cli.main.runtime';\nimport { getArgsData, getFlagsData } from './command-helper';\n\nexport const GLOBAL_GROUP = 'Global';\nexport const STANDARD_GROUP = 'Options';\n\nexport class YargsAdapter implements CommandModule {\n command: string;\n describe?: string;\n aliases?: string;\n commandRunner?: CommandRunner;\n constructor(\n private commanderCommand: Command,\n private onCommandStartSlot: OnCommandStartSlot\n ) {\n this.command = commanderCommand.name;\n this.describe = commanderCommand.description;\n this.aliases = commanderCommand.alias;\n }\n\n builder(yargs: Argv) {\n const options = YargsAdapter.optionsToBuilder(this.commanderCommand);\n yargs.option(options);\n this.commanderCommand.arguments?.forEach((arg) => {\n yargs.positional(arg.name, { description: arg.description });\n });\n this.commanderCommand.examples?.forEach((example) => {\n yargs.example(example.cmd, example.description);\n });\n\n return yargs;\n }\n\n handler(argv: Arguments) {\n const commandArgs = getArgsData(this.commanderCommand).map((arg) => arg.nameCamelCase);\n const argsValues = commandArgs.map((a) => argv[a]) as any[];\n // a workaround to get a flag syntax such as \"--all [version]\" work with yargs.\n const flags = Object.keys(argv).reduce((acc, current) => {\n if (current === '_' || current === '$0' || current === '--') return acc;\n // const flagName = current.split(' ')[0];\n const val = typeof argv[current] === 'string' && !argv[current] ? true : argv[current];\n acc[current] = val;\n return acc;\n }, {});\n const commandRunner = new CommandRunner(this.commanderCommand, argsValues, flags, this.onCommandStartSlot);\n this.commandRunner = commandRunner;\n }\n\n get positional() {\n return this.commanderCommand.arguments;\n }\n\n static optionsToBuilder(command: Command): { [key: string]: Options } {\n const flagsData = getFlagsData(command);\n // yargs options are global by default, which would let a command's own flags reach its\n // sub-commands. a sub-command may declare the same flag name with a different arity - e.g.\n // `bit lane --remote <scope>` takes a value where `bit lane remove --remote` is a boolean - and\n // the parent's definition would shadow it. the global options below stay global on purpose.\n const isLocalToCommand = Boolean(command.commands?.length);\n const option = flagsData.reduce((acc, flag) => {\n acc[flag.name] = {\n alias: flag.alias,\n describe: flag.description,\n group: STANDARD_GROUP,\n type: flag.type,\n requiresArg: flag.requiresArg,\n ...(isLocalToCommand ? { global: false } : {}),\n } as Options;\n return acc;\n }, {});\n\n const globalOptions = YargsAdapter.getGlobalOptions(command);\n\n return { ...option, ...globalOptions };\n }\n\n static getGlobalOptions(command: Command): Record<string, any> {\n const globalOptions: Record<string, any> = {};\n if (command.remoteOp) {\n globalOptions[TOKEN_FLAG] = {\n describe: 'authentication token',\n group: GLOBAL_GROUP,\n };\n }\n globalOptions.log = {\n describe:\n 'print log messages to the screen, options are: [trace, debug, info, warn, error, fatal], the default is info',\n group: GLOBAL_GROUP,\n };\n globalOptions['safe-mode'] = {\n describe:\n 'useful when it fails to load normally. it skips loading aspects from workspace.jsonc, and for legacy-commands it initializes only the CLI aspect',\n group: GLOBAL_GROUP,\n };\n if (command.pager) {\n globalOptions.pager = {\n describe: 'force paging the output through a pager (e.g. less), even if it fits on one screen',\n group: GLOBAL_GROUP,\n type: 'boolean',\n };\n globalOptions['no-pager'] = {\n describe: 'do not use a pager; print all output at once (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AEN,MAAMe,aAAa,GAAG7C,YAAY,CAAC8C,gBAAgB,CAAC1C,OAAO,CAAC;IAE5D,OAAA3B,aAAA,CAAAA,aAAA,KAAYqC,MAAM,GAAK+B,aAAa;EACtC;EAEA,OAAOC,gBAAgBA,CAAC1C,OAAgB,EAAuB;IAC7D,MAAMyC,aAAkC,GAAG,CAAC,CAAC;IAC7C,IAAIzC,OAAO,CAAC2C,QAAQ,EAAE;MACpBF,aAAa,CAACG,oBAAU,CAAC,GAAG;QAC1B1C,QAAQ,EAAE,sBAAsB;QAChCmC,KAAK,EAAE5C;MACT,CAAC;IACH;IACAgD,aAAa,CAACI,GAAG,GAAG;MAClB3C,QAAQ,EACN,8GAA8G;MAChHmC,KAAK,EAAE5C;IACT,CAAC;IACDgD,aAAa,CAAC,WAAW,CAAC,GAAG;MAC3BvC,QAAQ,EACN,kJAAkJ;MACpJmC,KAAK,EAAE5C;IACT,CAAC;IACD,IAAIO,OAAO,CAAC8C,KAAK,EAAE;MACjBL,aAAa,CAACK,KAAK,GAAG;QACpB5C,QAAQ,EAAE,oFAAoF;QAC9FmC,KAAK,EAAE5C,YAAY;QACnB6C,IAAI,EAAE;MACR,CAAC;MACDG,aAAa,CAAC,UAAU,CAAC,GAAG;QAC1BvC,QAAQ,EAAE,4FAA4F;QACtGmC,KAAK,EAAE5C,YAAY;QACnB6C,IAAI,EAAE;MACR,CAAC;IACH;IACA,OAAOG,aAAa;EACtB;AACF;AAAC/C,OAAA,CAAAE,YAAA,GAAAA,YAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/cli",
3
- "version": "0.0.1432",
3
+ "version": "0.0.1434",
4
4
  "homepage": "https://bit.cloud/teambit/harmony/cli",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.harmony",
8
8
  "name": "cli",
9
- "version": "0.0.1432"
9
+ "version": "0.0.1434"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "4.1.2",
@@ -17,17 +17,17 @@
17
17
  "fs-extra": "10.0.0",
18
18
  "pad-right": "0.2.2",
19
19
  "@teambit/legacy.loader": "0.0.34",
20
- "@teambit/legacy.logger": "0.0.71",
20
+ "@teambit/legacy.logger": "0.0.72",
21
21
  "@teambit/harmony.modules.runtimes": "0.0.4",
22
22
  "@teambit/harmony": "0.4.12",
23
23
  "@teambit/bit.get-bit-version": "0.0.31",
24
- "@teambit/logger": "0.0.1502",
25
- "@teambit/legacy.analytics": "0.0.117",
26
- "@teambit/legacy.constants": "0.0.50",
24
+ "@teambit/logger": "0.0.1503",
25
+ "@teambit/legacy.analytics": "0.0.118",
26
+ "@teambit/legacy.constants": "0.0.51",
27
27
  "@teambit/bit-error": "0.0.404",
28
- "@teambit/legacy.cli.error": "0.0.72",
28
+ "@teambit/legacy.cli.error": "0.0.73",
29
29
  "@teambit/legacy.utils": "0.0.57",
30
- "@teambit/legacy.consumer": "0.0.201"
30
+ "@teambit/legacy.consumer": "0.0.203"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/didyoumean": "1.2.0",