Skip to content

refactor(ssh): replace the SshConfig class with module functions - #1227

Merged
EhabY merged 2 commits into
mainfrom
refactor/ssh-config-module
Dec 2, 2026
Merged

EhabY merged 2 commits into
mainfrom
refactor/ssh-config-module

Conversation

@EhabY

@EhabY EhabY commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

Closes VSC-58

Stack: #1221 (Git for Windows) → #1226 (Linux/macOS ssh home) → this PR.

No behavior change. SshConfig was only ever constructed for a single operation, and its cached raw text duplicated what the operations could return. It becomes three module functions that take grouped options and return the resulting text:

  • readSshConfig(path)
  • writeCoderSshConfig(file, host, logger): only the Coder file accepts permissions, so the user's config can never be secured by mistake.
  • includeCoderSshConfig(path, include, logger)

Also:

  • The injectable FileSystem is gone, since the tests already mock node:fs/promises.
  • Tests made redundant by the stateless API are merged or removed.
  • The JSDoc is tightened, and the ManagedPermissions doc no longer calls a config without permissions unmanaged (off Windows, Coder's own file has none).

prod +310/−327, tests +114/−135. The Windows test matrix from #1221 gave identical results before and after this refactor.


🤖 Generated with Claude Code

@linear-code

linear-code Bot commented Nov 30, 2026

Copy link
Copy Markdown

VSC-58

Comment thread src/remote/sshConfig.ts Resolved
Comment thread src/remote/sshConfig.ts Resolved
@EhabY
EhabY force-pushed the refactor/ssh-config-module branch from 6050602 to d4c4349 Compare December 2, 2026 10:24
@EhabY
EhabY force-pushed the refactor/ssh-config-module branch from d4c4349 to 2636242 Compare December 2, 2026 10:37
Base automatically changed from fix/ssh-home-from-passwd to main December 2, 2026 10:41
EhabY added 2 commits December 2, 2026 13:41
SshConfig was only ever constructed for a single operation, and its cached
raw text duplicated what the operations could return. Replace it with
readSshConfig, writeCoderSshConfig and includeCoderSshConfig, which take
grouped options and return the resulting text. Permissions are only
accepted for the Coder file, so the user's config can never be secured.

Drop the injectable FileSystem: the tests already mock node:fs/promises.
Tighten the JSDoc, and remove tests made redundant by the stateless API.
@EhabY
EhabY force-pushed the refactor/ssh-config-module branch from 2636242 to 1d2b4aa Compare December 2, 2026 10:41
@EhabY
EhabY merged commit 2fc92c6 into main Dec 2, 2026
15 of 17 checks passed
@EhabY
EhabY deleted the refactor/ssh-config-module branch December 2, 2026 10: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.

2 participants