Skip to content

Split remote.ts by topic, starting with migrations #1066

Description

@EhabY

`src/remote/remote.ts` is 1,207 lines and mixes every concern of remote setup in one class. Recent work (per-editor SSH configs, legacy authority migration) keeps growing it.

Topics currently mixed into the class

  • Setup orchestration: `setup`, `setupCoderRemote`
  • Migrations: `migrateLegacyAuthority` (authority), `migrateToSecretsStorage`, `migrateSessionTokenFile`, `migrateSessionAuthFromFiles` (credentials)
  • SSH config assembly: `updateSSHConfig`, `writeRemoteSshConfig`, `buildProxyCommand`, `getSshConfigPath`, `getLogArgs`, `getLogDir`
  • Workspace lifecycle: `lookupWorkspace`, `waitForWorkspaceReady`, `resolveAgent`
  • Auth/session: `ensureLoggedInAndRetry`, `showSessionExpiredDialog`, `watchRemoteSessionAuth`
  • Binary management: `resolveRemoteBinary`, `checkCompatibility`
  • Window/UI glue: `createAgentMetadataStatusBar`, `watchSettings`, `registerLabelFormatter`, `closeRemote`, `reloadWindow`

Proposal

  1. Extract migrations first, e.g. into `src/remote/migrations.ts`. They are self-contained, interact little with the rest of setup, and each has a deletion horizon; keeping them together makes them easy to find and eventually remove.
  2. If that lands well, extract SSH config assembly next. It is the most test-heavy area and only needs the path resolver, settings, and logger.
  3. Keep orchestration (`setup`/`setupCoderRemote`) in `remote.ts`.

Non-goals: no behavior changes and no new abstractions; move plain methods by topic and keep the telemetry span threading as is.

Filed by Claude Code for @EhabY.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions