feat(core): add SSH remote directory references#31900
Draft
heitorfreitasferreira wants to merge 3 commits into
Draft
feat(core): add SSH remote directory references#31900heitorfreitasferreira wants to merge 3 commits into
heitorfreitasferreira wants to merge 3 commits into
Conversation
Add a new reference type that syncs a remote directory via rsync over SSH. Configured with host and remotePath, plus optional user, port, and identityFile fields. The remote directory is cached locally using EffectFlock-based concurrency control. Follows the same async materialization pattern as Git references: Info is created synchronously with the computed cache path, while the rsync sync runs in a background fiber.
1 task
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #31901
Type of change
What does this PR do?
Adds a new SSH remote directory reference type to opencode's references system. Currently references support local paths and Git repositories. This adds a third type that syncs a remote directory via rsync over SSH and makes it available as a project reference.
The implementation follows the same patterns as existing reference types: a config schema class (
ConfigSsh), a config plugin with three-way dispatch (local → ssh → git), a runtimeSshSourcetype in theSourcetagged union, and async cache materialization viaSshCache.ensure()forked in background (same pattern as Git references).The rsync approach was chosen over ssh2/SFTP because it provides incremental sync, delete propagation, and uses the user's existing SSH config (
~/.ssh/config, ssh-agent) without additional dependencies.How did you verify your code works?
tsgo --noEmit— typecheck clean across all 29 packagesbun test test/reference.test.ts— 5/5 pass (3 existing + 2 SSH-specific)bun test test/reference-guidance.test.ts— 3/3 passScreenshots / recordings
N/A — no UI changes.
Checklist