-
Notifications
You must be signed in to change notification settings - Fork 763
Feature: Add Git Support #1101
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
matthewlouisbrockman
merged 70 commits into
main
from
feat/sandbox-first-class-git-support
Jan 29, 2026
Merged
Feature: Add Git Support #1101
matthewlouisbrockman
merged 70 commits into
main
from
feat/sandbox-first-class-git-support
Jan 29, 2026
+5,874
−0
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
…ing this in (keeps the node for vscode correct)
…y create_github_repo
🦋 Changeset detectedLatest commit: 3f2c972 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
mishushakov
reviewed
Jan 29, 2026
mishushakov
reviewed
Jan 29, 2026
mishushakov
reviewed
Jan 29, 2026
mishushakov
reviewed
Jan 29, 2026
mishushakov
reviewed
Jan 29, 2026
mishushakov
reviewed
Jan 29, 2026
mishushakov
reviewed
Jan 29, 2026
mishushakov
reviewed
Jan 29, 2026
mishushakov
reviewed
Jan 29, 2026
mishushakov
reviewed
Jan 29, 2026
mishushakov
reviewed
Jan 29, 2026
mishushakov
reviewed
Jan 29, 2026
mishushakov
reviewed
Jan 29, 2026
mishushakov
reviewed
Jan 29, 2026
mishushakov
reviewed
Jan 29, 2026
mishushakov
approved these changes
Jan 29, 2026
Member
mishushakov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think all looking good, here some tips:
- move some utility functions into utils if they're not dependent on another other private method like runShell or runGitCommand
- I am still unsure about this.runShell, whether we need a whole separate function only to fill the env variables, think just calling this.commands.run() with the env vars would be enough since there's no other logic... up to you
- in some places we do buildGitCommand and then runShell, but in most places we do runGitCommand, idk. maybe there's some way to make it more uniform?
- lets put some tests into the same file, like remote add/get
- in tests, let's not explicitly specify when we have defaults like all: true and setUpstream: true
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.
Sandbox Git Commands
Adds Git support to the sandbox class. This allows the sandbox to manage git via standard clone, checkout, branch, add, pull, and push commands without needing to use commands.run. The API mirrors common Git workflows while handling sandbox-specific concerns like auth injection and safe remote handling.
Python example
JavaScript / TypeScript example
Main commands
clone: Clone a repo into the sandbox. Supportsbranch,depth, optionalusername+passwordfor private repos, anddangerously_store_credentials/dangerouslyStoreCredentialsto keep credentials in the remote URL.init: Initialize a new repo. Supportsinitial_branch/initialBranchandbare.status: Get parsedgit status --porcelain -binfo.branches: List branches and current branch.create_branch/createBranch: Create and check out a new branch.checkout_branch/checkoutBranch: Switch to an existing branch.delete_branch/deleteBranch: Delete a branch. Supportsforce.add: Stage files. Supports explicit files orall.commit: Create a commit. Supports author override andallow_empty.reset/reset: ResetHEAD(supports modes likesoft,mixed,hard, etc.) and optional paths.restore/restore: Restore files or unstage changes (worktree/staged) from a source ref.pull: Pull from a remote. Supportsremote,branch, and optional auth.push: Push to a remote. Supportsremote,branch,set_upstream, and optional auth.remote_add/remoteAdd: Add a remote. Supportsoverwriteandfetch.remote_get/remoteGet: Read a remote URL.set_config/setConfig: Set a git config value. Supportsscope(global,local,system), andpathfor local scope.get_config/getConfig: Read a git config value. Supports the samescopeoptions and returnsNone/undefinedif unset.dangerously_authenticate/dangerouslyAuthenticate: Persist credentials via the git credential helper (global).configure_user/configureUser: Set defaultuser.nameanduser.emailfor commits.create_github_repo(Python only): Create a GitHub repo from inside the sandbox and optionally add it as a remote.Status shape
statusreturns aGitStatuswithcurrent_branch/currentBranch,upstream,ahead,behind,detached, andfile_status/fileStatus.file_statusentries includename,status,index_status/indexStatus,working_tree_status/workingTreeStatus,staged, and optionalrenamed_from/renamedFrom.is_clean/isClean,has_changes/hasChanges,has_staged/hasStaged,has_untracked/hasUntracked,has_conflicts/hasConflicts, plus counts (total_count/totalCount,staged_count/stagedCount,unstaged_count/unstagedCount,untracked_count/untrackedCount,conflict_count/conflictCount). In Python these are properties on theGitStatusobject; in JS they are fields on the returned object.Notes
username+password(token) onclone,pull, orpush.remote_add/remoteAddwithoverwrite=Trueto update an existing remote URL andfetch=Trueto fetch after.dangerously_authenticate/dangerouslyAuthenticateonly when you want to persist credentials globally on the sandbox.