feat(cli): redesign checkout, reset, test, log, lane and merge outputs#10271
feat(cli): redesign checkout, reset, test, log, lane and merge outputs#10271davidfirst wants to merge 6 commits intomasterfrom
Conversation
…d outputs Apply the shared CLI formatting toolkit to 8 more commands: checkout, reset, test, log, lane show, lane create, lane list, and lane merge (including switch). Replace chalk.underline headers with formatTitle, manual item lists with formatSection/formatItem, raw chalk.green success messages with formatSuccessSummary, chalk.yellow hints with formatHint, compact().join with joinSections, and hardcoded [deleted]/[deprecated] markers with errorSymbol/warnSymbol.
There was a problem hiding this comment.
Pull request overview
Extends the shared CLI output formatting toolkit (@teambit/cli output-formatter helpers) to additional commands, continuing the CLI output redesign work from #10269 and updating e2e assertions to match the new strings.
Changes:
- Refactors multiple command outputs (
checkout,reset,test,log,lane*,merge,switch) to useformatTitle/formatSection/formatItem/formatHint/formatSuccessSummaryandjoinSections. - Replaces hardcoded markers/symbols and ad-hoc list formatting with consistent toolkit-based sections and summaries.
- Updates e2e tests to assert against the redesigned output text.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| scopes/lanes/merge-lanes/merge-lane.cmd.ts | Uses joinSections() to assemble merge + delete outputs consistently. |
| scopes/lanes/lanes/switch.cmd.ts | Converts switch output to toolkit sections/summaries and removes lodash compact. |
| scopes/lanes/lanes/lane.cmd.ts | Redesigns lane list/show/create outputs using sections, titles, hints, and symbols. |
| scopes/defender/tester/test.cmd.ts | Updates bit test output messages to use formatHint/formatSuccessSummary. |
| scopes/component/snapping/reset-cmd.ts | Refactors reset output into sections + summary, joined via joinSections. |
| scopes/component/merging/merge-cmd.ts | Updates merge output sections/items and removes lodash compact import. |
| scopes/component/component-log/log-cmd.ts | Replaces [deleted]/[deprecated] markers with errorSymbol/warnSymbol. |
| scopes/component/checkout/checkout-cmd.ts | Refactors checkout output into sections/titles/hints and uses joinSections. |
| e2e/harmony/snap.e2e.2.ts | Updates merge-related output assertions to match redesigned merge output. |
| e2e/harmony/lanes/merge-lanes-remote.e2e.ts | Updates lane-merge skip output assertion to new section title. |
| e2e/harmony/lanes/lane-snapping.e2e.ts | Updates reset output assertion to new success-summary phrasing. |
| e2e/harmony/delete.e2e.ts | Updates reset output assertion to new success-summary phrasing. |
| e2e/flows/id-with-wildcard.e2e.2.ts | Updates reset output assertion to new success-summary phrasing. |
| e2e/commands/reset.e2e.ts | Updates reset output assertions to new success-summary phrasing. |
- Use joinSections for remote delete output in lane merge - Use formatHint instead of formatSuccessSummary for informational lane list results - Use formatHint for lane create note instead of chalk.yellow - Only show warnSymbol for unsnapped readme components
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
scopes/component/component-log/log-cmd.ts:102
deletedStr/deprecatedStrnow include pre-colorederrorSymbol/warnSymbol, but the wholetitleis wrapped inc.yellow(title). The ANSI reset inside the symbol strings will cancel the outer yellow styling, so parts of the title after the symbol may render in the default terminal color. To keep consistent coloring, avoid wrapping a string that contains independently-colored segments (e.g., color only the base title parts and append the colored markers separately).
const deletedStr = deleted ? ` ${errorSymbol} deleted` : '';
const deprecatedStr = !deleted && deprecated ? ` ${warnSymbol} deprecated` : '';
const title = tag ? `tag ${tag} (${hash})${deletedStr}${deprecatedStr}\n` : `snap ${hash}\n`;
return (
c.yellow(title) +
paintAuthor(email, username) +
| if (mergeSnapError) { | ||
| return `${chalk.bold( | ||
| return `${formatTitle('snap error')}\n${chalk.red( | ||
| 'snapping merged components failed with the following error, please fix the issues and snap manually' | ||
| )} | ||
| ${mergeSnapError.message} | ||
| `; | ||
| )}\n${mergeSnapError.message}`; |
There was a problem hiding this comment.
In the merge-snap error case, the section title is rendered as formatTitle('snap error') without the errorSymbol prefix. The CLI output style guide recommends prefixing error section titles with errorSymbol so errors are visually consistent and easy to scan.
| const data = | ||
| code === 0 | ||
| ? formatSuccessSummary(`tests completed in ${seconds} seconds`) | ||
| : formatHint(`tests completed in ${seconds} seconds`); |
There was a problem hiding this comment.
When tests fail (code !== 0), the completion line is formatted with formatHint(...), which renders dim text and can make a failing run look non-actionable. Consider using formatWarningSummary(...) (or another non-dim format) for the non-zero exit path so failures remain prominent while still using the shared formatter toolkit.
| const items = results.map((result) => | ||
| formatItem(`${chalk.cyan(result.id.toStringWithoutVersion())} - version(s): ${result.versions.join(', ')}`) | ||
| ); | ||
| return joinSections([ | ||
| formatSection(`${titleSuffix} components`, '', items), |
There was a problem hiding this comment.
The reset output for isSoftUntag used to include important context that soft-untagged versions are no longer candidates for tagging. With titleSuffix now just 'soft-untagged', that information is lost from the CLI output. Consider adding that context back as the formatSection(...) description (or similar) when isSoftUntag is true so users understand the implication of soft-untag.
| const items = results.map((result) => | |
| formatItem(`${chalk.cyan(result.id.toStringWithoutVersion())} - version(s): ${result.versions.join(', ')}`) | |
| ); | |
| return joinSections([ | |
| formatSection(`${titleSuffix} components`, '', items), | |
| const description = isSoftUntag ? 'soft-untagged versions are no longer candidates for tagging' : ''; | |
| const items = results.map((result) => | |
| formatItem(`${chalk.cyan(result.id.toStringWithoutVersion())} - version(s): ${result.versions.join(', ')}`) | |
| ); | |
| return joinSections([ | |
| formatSection(`${titleSuffix} components`, description, items), |
Applies the shared CLI formatting toolkit (
@teambit/cli) to 8 more commands, continuing the work from #10269.Commands redesigned:
checkout,reset,test,log,lane show,lane create,lane list,lane merge(+switch)What changed:
chalk.underlinesection headers →formatTitle(bold white)formatSection+formatItemwith bullet symbolschalk.green(...)success messages →formatSuccessSummary(✔ prefix)chalk.yellowhints →formatHint(dim text)compact([...]).join('\n\n')→joinSections[deleted]/[deprecated]markers inbit log→errorSymbol/warnSymbolchalk.bold.underline('Summary')in checkout →formatTitle('Checkout Summary')formatSectionfor available lanes,formatHintfor footerformatTitlefor lane name,joinSectionsfor metadataformatSuccessSummary+formatHintfor scope infoformatSection/formatItemfor skipped/resolved/aborted/snapped sectionsE2e test assertions updated to match new output strings (12 assertions across 6 test files).