feat(vcs): add git commit/push/pull/stage/unstage/log API endpoints#28828
Open
gaboolic wants to merge 3 commits into
Open
feat(vcs): add git commit/push/pull/stage/unstage/log API endpoints#28828gaboolic wants to merge 3 commits into
gaboolic wants to merge 3 commits into
Conversation
Add new VCS operations to the backend API: - POST /vcs/stage - Stage files for commit - POST /vcs/unstage - Unstage files from the index - POST /vcs/commit - Commit staged changes - POST /vcs/push - Push commits to remote - POST /vcs/pull - Pull from remote - GET /vcs/log - Get commit history These operations work through the existing Git service layer, supporting both local and remote repositories via the OpenCode backend.
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.
Add new VCS operations to the backend API:
These operations work through the existing Git service layer, supporting both local and remote repositories via the OpenCode backend.
Issue for this PR
#15886
Type of change
What does this PR do?
This PR adds a comprehensive set of VCS (Version Control System) API endpoints to the backend, enabling remote Git operations via HTTP. These endpoints are required because users need to interact with Git repositories through a web interface without direct command-line or filesystem access — for example, when working in a browser-based IDE, CI/CD pipeline, or automated workflow scenario where only API access is available.
Why this is needed: There are scenarios where users must perform Git operations remotely through a web-based interface. Traditional Git workflows require shell access, which is not feasible in browser-based environments, shared infrastructure, or automated pipelines. These endpoints bridge that gap by exposing core Git functionality as RESTful APIs, making version control accessible from any web client.
How did you verify your code works?
Started the OpenCode backend locally and ran the full workflow — stage → commit → push → pull — against a test repository, confirming all operations succeed sequentially
Tested error scenarios manually: invoking operations outside a Git directory returns a 400 error, pushing a non-existent branch yields an appropriate error message, attempting an empty commit returns a descriptive response
Verified that commit history retrieved via GET /vcs/log matches the output of git log executed directly in the repository
Confirmed request parameter validation works correctly (e.g., empty commit messages are rejected with a meaningful error)
Screenshots / recordings
This is a backend-only API change with no UI modifications.
Checklist
If you do not follow this template your PR will be automatically rejected.