-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add CpToInstance and CpFromInstance functions #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
Cherry-picked from stainless-sdks/hypeman-go preview/feature/hypeman-cp. - Add InstanceService.Stat() method - Add PathInfo response type with Error field for stat failures - Add InstanceStatParams query parameters
Add file copy functionality to the SDK for copying files to/from running instances via WebSocket streaming. Features: - CpToInstance: Copy local file/directory to instance - CpFromInstance: Copy file/directory from instance to local - WebSocket-based streaming with JSON control messages - Recursive directory operations with cycle detection - Archive mode preserving UID/GID/permissions - FollowLinks option for symlink handling - Progress callbacks via CpCallbacks - Path traversal protection Includes comprehensive unit tests with mock WebSocket.
e893d90 to
00c6817
Compare
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.
Summary
Add manually-maintained cp functionality to the Go SDK for copying files to/from running VM instances.
Usage
Features
CpToInstance: Copy local file/directory to instanceCpFromInstance: Copy file/directory from instance to localImplementation
Located in
lib/cp.gofollowing the SDK's convention for custom extensions that won't conflict with auto-generated code.Dependencies
Requires corresponding API server changes: onkernel/hypeman#45
Note
Adds high-level file transfer and a new filesystem stat API.
libpackage:CpToInstance/CpFromInstancestream files/dirs over WebSocket with progress callbacks, archive UID/GID preservation, link following, cycle detection, and path/symlink sanitization; mockable viaWsConn/WsDialer(lib/ws_connector.go)GET /instances/{id}/statviaclient.Instances.Stat(...)withInstanceStatParamsandPathInforesponseInstanceNewParamsgainsdevicesfieldInstances.Statgithub.com/gorilla/websocketandgithub.com/stretchr/testify; docs (api.md) and stats updatedWritten by Cursor Bugbot for commit 00c6817. This will update automatically on new commits. Configure here.