Skip to content

Move printers, validation, saved login and iOS version detection out of command-executor - #72

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

ashirman merged 1 commit into
mainfrom
feature/rev-139

Conversation

@revopushbot

Copy link
Copy Markdown
Contributor

Step 2 of the CLI restructuring (REV-139). There's no behaviour change. command-executor.ts keeps the commands and release flows; helpers move out by concern, and the file goes from 1,885 to about 1,260 lines.

Changes

New file What moved there
ui/printers.ts Table and JSON output for apps, collaborators, deployments, history, access keys and sessions, plus formatDate, printTable and printJson. Only the six print* entry points are exported.
utils/validation-utils.ts throwForInvalidEmail, throwForInvalidSemverRange, throwForInvalidOutputFormat, isCommandOptionSpecified
auth/connection.ts The saved login file (~/.revopush.config: read, write, delete), the CLI version header, and getSdk with its handler that deletes an expired login
utils/ios-utils.ts iOS version detection from Info.plist, falling back to the Xcode project. It sits next to utils/gradle-utils.ts, which does the same for Android.
types/index.ts UpdateMetricsWithTotalActive and PackageWithMetrics
  • Moved code is unchanged: a token-level comparison confirmed that every moved function is identical apart from export keywords and line wrapping.
  • getSdk drops its headers parameter. It always used its own CLI_HEADERS constant, which is now private to auth/connection.ts.
  • Naming: auth/ rather than session/, because "session" already means server sessions here (revopush session ls, the Session type). validation-utils.ts matches the other *-utils.ts files in utils/.

Verification

  • Build, lint and format check: tsc, npm run lint (0 problems) and npm run format:check are clean.
  • Tests: all 158 pass on macOS and on Linux (Docker, Node 20.19.0).
  • End to end: the real CLI binary from main and from this branch, run against a local fake server with 45 commands. These include reading, writing and deleting the saved login file, every table and JSON printer, and validation errors. Output, exit codes and server requests are identical.
  • iOS version detection: compared with main on 10 generated iOS projects:
    • plain Info.plist;
    • $(MARKETING_VERSION) with an Xcode project;
    • plist prefix, explicit plist, explicit Xcode project;
    • five error cases.
    • Detected versions and error messages are identical.
  • Version header: X-CodePush-CLI-Version still reads package.json correctly from the new folder.

Found during review and tracked in REV-144: register may pass its server URL into the wrong parameter; an unused parameter in initiateExternalAuthenticationAsync; and three identical version types to merge.

🤖 Generated with Claude Code

…of command-executor

command-executor keeps the commands; the helpers move by concern:
- ui/printers.ts: table and JSON output
- utils/validation-utils.ts: input checks
- auth/connection.ts: the saved login file and getSdk
- utils/ios-utils.ts: iOS app version detection, next to gradle-utils
- types/index.ts: the metrics interfaces

getSdk drops its unused headers parameter. No behaviour change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ashirman
ashirman merged commit aac5b27 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