Skip to content

fix(js-sdk): export the Git argument and status types - #1642

Merged
mishushakov merged 1 commit into
mainfrom
fix/export-git-argument-types
Aug 5, 2026
Merged

fix(js-sdk): export the Git argument and status types#1642
mishushakov merged 1 commit into
mainfrom
fix/export-git-argument-types

Conversation

@mishushakov

Copy link
Copy Markdown
Member

Carries the change from #1635 (by @karpovantonme) into main as a single squash commit — #1635 was retargeted at fix/export-git-argument-types, merged there, and this PR promotes that branch.

Git.reset(), Git.restore() and Git.status() are public, but the types naming their arguments and results were not reachable from the package entry point.

src/index.ts re-exported fifteen Git* types and omitted GitResetMode, GitResetOpts and GitRestoreOpts. GitStatusLabel was worse off — src/sandbox/git/index.ts re-exported GitBranches, GitConfigScope, GitFileStatus and GitStatus from ./utils but not GitStatusLabel, so it was unreachable from anywhere in the package, even though it is the type of GitFileStatus.status.

The practical effect: you could call the methods, but you could not name what you pass them, so you could not write a typed wrapper.

// before — all four fail
import type {
  GitResetMode,
  GitResetOpts,
  GitRestoreOpts,
  GitStatusLabel,
} from 'e2b'

// the workaround people end up with
type ResetMode = Parameters<Git['reset']>[0] extends { mode?: infer M } ? M : never
// after
import { Sandbox } from 'e2b'
import type { GitResetMode, GitResetOpts, GitStatusLabel } from 'e2b'

async function hardResetTo(sbx: Sandbox, repo: string, target: string) {
  const mode: GitResetMode = 'hard'
  const opts: GitResetOpts = { mode, target, cwd: repo }
  return sbx.git.reset(opts)
}

function isBlocking(status: GitStatusLabel) {
  return status === 'conflict' || status === 'deleted'
}

On SDK parity

Python already exports GitResetMode (e2b.GitResetMode), so this brings JS up to it. The other three have no Python counterpart by design: the sync and async implementations take keyword arguments rather than option objects, so there is nothing shaped like GitResetOpts/GitRestoreOpts, and GitFileStatus.status is typed as a plain str there, so there is no GitStatusLabel either. Nothing to mirror on the Python side.

Notes

  • Type-only re-exports, no runtime change. Changeset included (e2b: patch).
  • No test: a missing re-export is invisible to tsc --noEmit because packages/js-sdk/tsconfig.json includes only src, so an import type … from '../src' test passes either way. A declaration-reading test was dropped from fix(js-sdk): export the Git argument and status types #1635 during review.

Not touched

The same gap exists for a few non-Git types — FilesystemListOpts, WatchOpts, PtyCreateOpts and PtyConnectOpts are exported from their own modules but not from src/index.ts. Scope kept to the Git surface, as in #1635.

🤖 Generated with Claude Code

`git.reset()`, `git.restore()` and `git.status()` are public, but the
types naming their arguments and results were not reachable from the
package entry point: `GitResetMode`, `GitResetOpts` and `GitRestoreOpts`
were missing from src/index.ts, and `GitStatusLabel` was not re-exported
by the git module either, so it was unreachable from anywhere.

Python already exports `GitResetMode`; the other three have no Python
counterpart, since the sync and async implementations take keyword
arguments rather than option objects and type `GitFileStatus.status` as
a plain str.

Co-authored-by: Anton Karpov <karpovantonme@gmail.com>
@changeset-bot

changeset-bot Bot commented Aug 5, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3c1763f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
e2b Patch

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

@cla-bot cla-bot Bot added the cla-signed label Aug 5, 2026
@cursor

cursor Bot commented Aug 5, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Type-only barrel re-exports with no runtime or behavioral change.

Overview
The e2b package entry now re-exports GitResetMode, GitResetOpts, GitRestoreOpts, and GitStatusLabel so callers can import type them for git.reset(), git.restore(), and git.status() without workarounds. GitStatusLabel is also added to the git module’s ./utils re-exports so it is reachable through the public barrel. This is type-only; a patch changeset is included.

Reviewed by Cursor Bugbot for commit 3c1763f. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Package Artifacts

Built from d57fa8d. Download artifacts from this workflow run.

JS SDK (e2b@2.38.1-fix-export-git-argument-types.0):

npm install ./e2b-2.38.1-fix-export-git-argument-types.0.tgz

CLI (@e2b/cli@2.16.2-fix-export-git-argument-types.0):

npm install ./e2b-cli-2.16.2-fix-export-git-argument-types.0.tgz

Python SDK (e2b==2.37.0+fix.export.git.argument.types):

pip install ./e2b-2.37.0+fix.export.git.argument.types-py3-none-any.whl

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — straightforward type-only re-export fix.

What was reviewed: traced the re-export chain for GitResetMode, GitResetOpts, GitRestoreOpts (defined in sandbox/git/index.ts, exported via src/index.ts) and GitStatusLabel (defined in sandbox/git/utils.ts, now re-exported through sandbox/git/index.ts and src/index.ts); confirmed all four names exist at their source and are correctly wired through to the package entry point. No runtime code changed.

Extended reasoning...

Overview

This PR adds four missing type re-exports (GitResetMode, GitResetOpts, GitRestoreOpts, GitStatusLabel) to the JS SDK's public entry points (packages/js-sdk/src/index.ts and packages/js-sdk/src/sandbox/git/index.ts), plus a changeset. It is a promotion of an already-reviewed and merged branch (#1635) into main as a squash commit.

Security risks

None. These are type-only re-exports (export type { ... }) with zero runtime behavior change — nothing here affects auth, data handling, or execution paths.

Level of scrutiny

Low. This is a mechanical, additive change to type exports in a non-critical part of the SDK surface. I verified each newly exported name is actually defined at its claimed source module and that the re-export chain (utils.ts -> sandbox/git/index.ts -> src/index.ts) is correct, which is the only way this kind of change could go wrong (e.g., a typo'd or non-existent export name).

Other factors

The changeset is included and correctly scoped as a patch. The PR description transparently explains why no test was added (a gap in tsconfig's include makes such a test ineffective) and explicitly scopes out similar gaps in Filesystem/Pty types as future work rather than silently ignoring them. No outstanding review comments to address.

@mishushakov
mishushakov merged commit 86f7b8e into main Aug 5, 2026
34 checks passed
@mishushakov
mishushakov deleted the fix/export-git-argument-types branch August 5, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants