Skip to content

refactor: move the shared prompt types to core and drop dead exports - #47

Merged
beeman merged 1 commit into
mainfrom
beeman/clean-up-shared-types-and-dead-exports
Sep 4, 2026
Merged

refactor: move the shared prompt types to core and drop dead exports#47
beeman merged 1 commit into
mainfrom
beeman/clean-up-shared-types-and-dead-exports

Conversation

@beeman

@beeman beeman commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Cleanup the command-factory series (#41, #45, #46) exposed. With every feature's imports now visible in its own file instead of buried in a 660-line app.ts, a few things stood out as living in the wrong place.

No behaviour change. 487 tests pass with and without a TTY.

The prompt types were never emulator-specific

emulator/ui/emulator-ui-prompt-types.tscore/ui/core-ui-prompt-types.ts.

Its contents are the generic clack prompt contracts — MultiSelectPrompt, SelectPrompt, TextPrompt, PromptDependencies — plus resolvePromptCancellation. Nothing about emulators. 24 files across five features imported it from emulator, including every device/ui/* selector, webshell-ui-prompts.ts, and playground-feature-serve.ts.

Measured effect on the cross-feature import graph (counting both ../feature/ and ../../feature/ forms; -> core edges excluded as legitimate):

edge before after
device -> emulator 4 1
playground -> emulator 1 0
webshell -> emulator 1 0
device -> localnet 15 15
playground -> localnet 7 7
emulator -> device 6 6
playground -> device 3 3
doctor -> emulator 2 2
localnet -> emulator 1 1

Two edges gone entirely and the third down to a single import, and every one removed existed only to borrow types that had nothing to do with emulators. The device -> emulator import that remains is real: list-connected-devices.ts uses parseRunningEmulatorName to label emulator serials.

What still crosses feature boundaries is mostly device and playground reaching into localnet for adb primitives — 11 of those 15 device imports are just for the Adb* types in localnet-types.ts, and device/data-access/device-types.ts is one of them, so device's own type file currently depends on localnet's. That is a follow-up. emulator -> device is deliberate and dates from #40.

A barrel survived inside a types file

emulator/data-access/emulator-types.ts re-exported CommandRunner, InteractiveCommandRunner and RunCommandOptions from core/data-access/command-types.ts. That is the same indirection this series removed seven times over, and it let files take a core type by way of emulator. Its four consumers now import from core directly.

RunCommandOptions had no consumer at all, so that line was serving one live import and two dead ones. The file's own import block also moves to the top, where it was sitting mid-file after several interface declarations.

Dead code

core/ui/core-ui-select-command.ts is deleted — selectCommand and CommandOption had zero references in src, test or scripts.

extractTemplateOptions and parsePackageManagerOption lose their export; they were public so app.ts could call them, and #46 moved the create wiring into the same file. createDoctorReport loses its own for the same reason, from #45.

Exports with no consumer outside their own file: 77 → 72. The remaining 72 are pre-existing, mostly dependency-injection types, and want a tool like knip rather than a hand audit — biome 2.x has noUnusedImports but no project-wide unused-export rule.

Verification

bun run ci — build, lint, tsc -b --noEmit, 487 pass / 0 fail. Also 487/0 under a pseudo-TTY, and the CLI boots.

Apart from resolvePromptCancellation changing file, the move is type-only. No changeset: the solana-mobile bin and the ./templates export are unchanged.

Cleanup the command-factory series exposed, now that every feature's imports are visible in one place instead of buried in `app.ts`.

`emulator-ui-prompt-types.ts` moves to `core/ui/core-ui-prompt-types.ts`. Nothing in it was ever emulator-specific — it is the generic clack prompt contracts (`MultiSelectPrompt`, `SelectPrompt`, `TextPrompt`, `PromptDependencies`) plus `resolvePromptCancellation` — and 24 files across five features imported it from emulator. That removes the last `device -> emulator`, `playground -> emulator` and `webshell -> emulator` edges in the import graph; what is left crossing feature boundaries is device and playground reaching into localnet for adb, and emulator reusing device's tweak UI.

`emulator-types.ts` no longer re-exports `CommandRunner`, `InteractiveCommandRunner` and `RunCommandOptions` from core. It was the same barrel indirection the series removed elsewhere, and it let files take a core type by way of emulator. Its four consumers now import from `core/data-access/command-types.ts` directly; `RunCommandOptions` turned out to have no consumer at all, and the file's own import block moves to the top where the rest are.

`core/ui/core-ui-select-command.ts` is deleted. `selectCommand` and `CommandOption` had no reference anywhere in `src`, `test` or `scripts`.

`extractTemplateOptions` and `parsePackageManagerOption` lose their `export`: they were public for `app.ts`, which no longer calls them now that the create wiring lives beside them. `createDoctorReport` loses its own for the same reason.

No behaviour change: 487 tests pass with and without a TTY, and the move is type-only apart from `resolvePromptCancellation` changing file.
@changeset-bot

changeset-bot Bot commented Sep 4, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 39c2fce

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 26 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available. Your 88 included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: c403a6a5-b41e-4ebc-a655-3cbf5c69319d

📥 Commits

Reviewing files that changed from the base of the PR and between 56f6149 and 39c2fce.

📒 Files selected for processing (32)
  • src/core/ui/core-ui-prompt-types.ts
  • src/core/ui/core-ui-select-command.ts
  • src/create/create-feature.ts
  • src/device/device-feature-install.ts
  • src/device/device-feature-open.ts
  • src/device/device-feature-tune.ts
  • src/device/ui/device-ui-resolve-target-device.ts
  • src/device/ui/device-ui-select-catalog-apks.ts
  • src/device/ui/device-ui-select-connected-device.ts
  • src/device/ui/device-ui-select-device-tweaks.ts
  • src/device/ui/device-ui-select-open-url.ts
  • src/doctor/doctor-feature-check.ts
  • src/emulator/data-access/emulator-types.ts
  • src/emulator/data-access/list-emulator-statuses.ts
  • src/emulator/data-access/system-image-package-manager.ts
  • src/emulator/data-access/tune-emulator.ts
  • src/emulator/emulator-feature-delete.ts
  • src/emulator/emulator-feature-images.ts
  • src/emulator/emulator-feature-start.ts
  • src/emulator/emulator-feature-stop.ts
  • src/emulator/emulator-feature-tune.ts
  • src/emulator/ui/emulator-ui-prompt-emulator-name.ts
  • src/emulator/ui/emulator-ui-select-installed-emulator-name.ts
  • src/emulator/ui/emulator-ui-select-installed-emulator-names.ts
  • src/emulator/ui/emulator-ui-select-installed-system-images.ts
  • src/emulator/ui/emulator-ui-select-running-emulator-serial.ts
  • src/emulator/ui/emulator-ui-select-system-image.ts
  • src/playground/playground-feature-serve.ts
  • src/webshell/ui/webshell-ui-prompts.ts
  • src/webshell/webshell-feature-init.ts
  • test/device.test.ts
  • test/webshell.test.ts

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-new Bot commented Sep 4, 2026

Copy link
Copy Markdown

Open in StackBlitz

bun add https://pkg.pr.new/solana-mobile/solana-mobile-cli/solana-mobile@47

commit: 39c2fce

@beeman
beeman added this pull request to the merge queue Sep 4, 2026
Merged via the queue into main with commit 3c91bc9 Sep 4, 2026
7 checks passed
@beeman
beeman deleted the beeman/clean-up-shared-types-and-dead-exports branch September 4, 2026 00:48
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