fix(js-sdk): export the Git argument and status types - #1642
Conversation
`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 detectedLatest commit: 3c1763f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
PR SummaryLow Risk Overview Reviewed by Cursor Bugbot for commit 3c1763f. Bugbot is set up for automated code reviews on this repo. Configure here. |
Package ArtifactsBuilt from d57fa8d. Download artifacts from this workflow run. JS SDK ( npm install ./e2b-2.38.1-fix-export-git-argument-types.0.tgzCLI ( npm install ./e2b-cli-2.16.2-fix-export-git-argument-types.0.tgzPython SDK ( pip install ./e2b-2.37.0+fix.export.git.argument.types-py3-none-any.whl |
There was a problem hiding this comment.
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.
Carries the change from #1635 (by @karpovantonme) into
mainas a single squash commit — #1635 was retargeted atfix/export-git-argument-types, merged there, and this PR promotes that branch.Git.reset(),Git.restore()andGit.status()are public, but the types naming their arguments and results were not reachable from the package entry point.src/index.tsre-exported fifteenGit*types and omittedGitResetMode,GitResetOptsandGitRestoreOpts.GitStatusLabelwas worse off —src/sandbox/git/index.tsre-exportedGitBranches,GitConfigScope,GitFileStatusandGitStatusfrom./utilsbut notGitStatusLabel, so it was unreachable from anywhere in the package, even though it is the type ofGitFileStatus.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.
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 likeGitResetOpts/GitRestoreOpts, andGitFileStatus.statusis typed as a plainstrthere, so there is noGitStatusLabeleither. Nothing to mirror on the Python side.Notes
e2b: patch).tsc --noEmitbecausepackages/js-sdk/tsconfig.jsonincludes onlysrc, so animport 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,PtyCreateOptsandPtyConnectOptsare exported from their own modules but not fromsrc/index.ts. Scope kept to the Git surface, as in #1635.🤖 Generated with Claude Code