Skip to content

Split command-parser by responsibility; merge tiny ui and react-native helper files - #75

Merged
ashirman merged 1 commit into
mainfrom
feature/rev-143
Oct 15, 2026
Merged

ashirman merged 1 commit into
mainfrom
feature/rev-143

Conversation

@revopushbot

Copy link
Copy Markdown
Contributor

Last step of the CLI restructuring (REV-143). Code is moved without behaviour changes.

Each file now has one responsibility. Files aren't split just to make them smaller, and tiny files that had no other reason to exist are folded back.

Parser

command-parser.ts (1,470 lines) becomes two files, one per job:

script/parser/
  commands.ts        what the CLI accepts: yargs commands, shared release options, help  (1,009 lines)
  create-command.ts  turns the parsed arguments into a command object                      (474 lines)
  • Load order kept: commands.ts still parses argv when it loads, before command-executor is loaded. create-command.ts imports isHelpShown from it, so the commands are always defined before createCommand parses.
  • Single shared option list: the options shared by release-react and release-expo stay with the command definitions.

Small files merged

Two earlier steps of this series left files too small to justify on their own:

  • ui/log.ts (3 lines), ui/prompt.ts and ui/progress.ts → one ui/terminal.ts (83 lines): printing, y/N and access-key prompts, and the upload progress bar. ui/printers.ts stays separate, since it formats tables.
  • platforms/react-native/project.ts (13 lines) → bundler.ts. It only finds the installed react-native package; hermes.ts now imports it from there.
  • Tests: tests that stubbed ui/log and ui/prompt now stub ui/terminal.

The other small files (validation-utils, types/index, source-maps, sign, auth/connection) each have their own job and several callers, so they stay.

Verification against main

Check Result
154 argument lists: every command and alias, --help for each, invalid input, -v, no arguments Identical parsed commands and help text
Real cli.js entry: no arguments, --help, -v, unknown and incomplete commands Identical output and exit codes
24 release-react/release-expo runs through a fake SDK and bundler All 476 transcript lines identical
45 CLI commands against a fake server Same output, exit codes and server requests
Native release: Android metadata zip and upload Same zip, same request
  • Build, lint and format: tsc, npm run lint and npm run format:check are clean.
  • Tests: all 159 pass on macOS and on Linux (Docker, Node 20.19.0).

The review noted that argv is parsed twice: once when commands.ts loads and again in createCommand. That's existing behaviour, so I didn't change it here. It's tracked as optional in REV-144.

🤖 Generated with Claude Code

…merge tiny ui and react-native helper files

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ashirman
ashirman merged commit efda614 into main Oct 15, 2026
2 checks passed
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.

2 participants