Skip to content

fix(codemods): colour the upgrade by-hand list and print summaries last - #3063

Open
mfal wants to merge 1 commit into
mainfrom
claude/codemod-upgrade-output-format-898b20
Open

fix(codemods): colour the upgrade by-hand list and print summaries last#3063
mfal wants to merge 1 commit into
mainfrom
claude/codemod-upgrade-output-format-898b20

Conversation

@mfal

@mfal mfal commented Sep 1, 2026

Copy link
Copy Markdown
Member

What & why

The upgrade command's output had two issues:

  1. No colour. list detects a real TTY and NO_COLOR to decide whether to colour its output, but upgrade never wired that through to the by-hand migration list it renders via renderList — so that list always printed in plain text, even in an interactive terminal.
  2. Summaries printed before the by-hand list, not after. The "N codemods run, N changed something" and "N codemod(s) did not complete" lines logged right after the codemod loop, ahead of the by-hand migrations block — so on a run with a long by-hand list, the summary scrolled out of view before the reader reached the bottom.

Changes

  • UpgradeDeps gains optional color/width fields; cli.ts computes them the same way it already does for list (TTY + NO_COLOR check) and passes them through to runUpgrade.
  • The by-hand renderList call in upgrade.ts now receives color/width instead of defaulting to no colour.
  • Moved both closing summaries ("N codemods run…" and "N codemod(s) did not complete…") to after the by-hand list, so they're the last thing printed.

Verification

  • pnpm nx test:compile codemods — clean
  • pnpm nx test:unit codemods — 307 tests pass
  • Manual run of the built CLI under a pseudo-TTY (script -q /dev/null node dist/cli.js upgrade major --dry --allow-dirty -y) confirms ANSI colour codes now appear in the by-hand list and the summary line lands after it.

`upgrade`'s by-hand migration list never got the TTY/NO_COLOR colour
detection `list` already had, so it always rendered plain. The "N codemods
run" and "N codemod(s) did not complete" summaries also logged before the
by-hand list instead of after it, so they scrolled out of view on longer
runs. Wire color/width through UpgradeDeps like list.ts does, and move both
closing summaries to the end of the output.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@mfal
mfal requested a review from a team September 1, 2026 14:20
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for ./packages/components/

Status Category Percentage Covered / Total
🔵 Lines 78.69% 746 / 948
🔵 Statements 78.57% 763 / 971
🔵 Functions 80.09% 165 / 206
🔵 Branches 70.33% 377 / 536
File CoverageNo changed files found.
Generated in workflow #6508 for commit caadd02 by the Vitest Coverage Report Action

@mfal
mfal enabled auto-merge (squash) September 1, 2026 14:23
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

🚀 Preview Deployment

Preview environments are ready:

Type URL
docs pr-3063.docs.review.flow-components.de
storybook pr-3063.storybook.review.flow-components.de

Images:

  • docs: ghcr.io/mittwald/flow/docs:pr-3063
  • storybook: ghcr.io/mittwald/flow/storybook:pr-3063

@mfal
mfal requested a review from ins0 September 1, 2026 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant