Skip to content

feat(vcs): add git commit/push/pull/stage/unstage/log API endpoints#28828

Open
gaboolic wants to merge 3 commits into
anomalyco:devfrom
gaboolic:feat/git-commit-push
Open

feat(vcs): add git commit/push/pull/stage/unstage/log API endpoints#28828
gaboolic wants to merge 3 commits into
anomalyco:devfrom
gaboolic:feat/git-commit-push

Conversation

@gaboolic
Copy link
Copy Markdown

@gaboolic gaboolic commented May 22, 2026

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.

Issue for this PR

#15886

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

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

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

If you do not follow this template your PR will be automatically rejected.

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.
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label May 22, 2026
@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label May 22, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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.

1 participant