Repository navigation
feat(cli): Codex-style auto-update prompt and e2b update command - #2007
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
Co-Authored-By: mish@e2b.dev <mish@e2b.dev>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
🦋 Changeset detectedLatest commit: f28b382 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 |
Package ArtifactsBuilt from 4a108ea. Download artifacts from this workflow run. JS SDK ( npm install ./e2b-dockerfile-utils-0.1.2-devin-1792518652-cli-auto-updater.0.tgz ./e2b-2.58.1-devin-1792518652-cli-auto-updater.0.tgzCLI ( npm install ./e2b-cli-2.22.4-devin-1792518652-cli-auto-updater.0.tgzCode Interpreter JS SDK ( npm install ./e2b-code-interpreter-2.9.1-devin-1792518652-cli-auto-updater.0.tgzDesktop JS SDK ( npm install ./e2b-desktop-2.5.1-devin-1792518652-cli-auto-updater.0.tgzPython SDK ( pip install ./e2b_dockerfile_utils-0.1.1+devin.1792518652.cli.auto.updater-py3-none-any.whl ./e2b-2.58.0+devin.1792518652.cli.auto.updater-py3-none-any.whlCode Interpreter Python SDK ( pip install ./e2b_code_interpreter-2.11.2+devin.1792518652.cli.auto.updater-py3-none-any.whlDesktop Python SDK ( pip install ./e2b_desktop-2.7.1+devin.1792518652.cli.auto.updater-py3-none-any.whl |
There was a problem hiding this comment.
TASTE.md compliance review (CLI-only PR, so the SDK-surface rules T-1–T-46 and T-54–T-74 mostly don't apply).
Checked: T-12 (acronym casing), T-43 (shell composition: spawn uses fixed argv arrays, nothing is interpolated, OK), T-47 (named default constants), T-49/T-50 (env-var config and empty-means-unset), T-56 (version imported from package.json, OK), T-62/T-63 (actionable error messages).
Violations: 3 rules, 4 inline comments
- T-50:
NO_UPDATE_NOTIFIER/CIare checked with!== undefined, so an empty value counts as set. Flagged in bothindex.tsandupdater.ts. This also regresses from the old truthiness check. - T-47: the 5000 ms fetch timeout is a magic number in
fetchLatestVersion. - T-62:
e2b updatedoesn't tell the user what to do when the version fetch fails.
Not tied to a line / not counted:
- T-49:
NO_UPDATE_NOTIFIERisn'tE2B_-prefixed. It's the existing cross-tool opt-out shared withupdate-notifier, and this PR keeps it, so I'm not counting it. - T-12: the new
import * as packageJSONincommands/update.tswould bepackageJsonunder the rule, but it copies the existing name insrc/index.ts. Rename both together if at all.
| process.env.NO_UPDATE_NOTIFIER !== undefined || | ||
| process.env.CI !== undefined || |
There was a problem hiding this comment.
T-50 — an env var set to the empty string means unset. !== undefined treats an exported-but-empty NO_UPDATE_NOTIFIER= (or CI=) as set, so a blank value silently disables the updater. The code this replaces used truthiness (process.env.NO_UPDATE_NOTIFIER ? …), so this is also a behavior change for anyone with an empty var in their shell profile.
| process.env.NO_UPDATE_NOTIFIER !== undefined || | |
| process.env.CI !== undefined || | |
| !!process.env.NO_UPDATE_NOTIFIER || | |
| !!process.env.CI || |
| env.CI !== undefined || | ||
| env.NO_UPDATE_NOTIFIER !== undefined || |
There was a problem hiding this comment.
T-50 — same issue here: an empty CI= / NO_UPDATE_NOTIFIER= should count as unset, but !== undefined makes it suppress the prompt. Check truthiness so this matches the index.ts gate. (This also repeats isUpdaterDisabled() from index.ts; keeping one shared check would stop the two from drifting apart.)
| env.CI !== undefined || | |
| env.NO_UPDATE_NOTIFIER !== undefined || | |
| !!env.CI || | |
| !!env.NO_UPDATE_NOTIFIER || |
| fetchFn: typeof fetch = fetch | ||
| ): Promise<string> { | ||
| const url = method === 'brew' ? BREW_FORMULA_URL : NPM_REGISTRY_URL | ||
| const response = await fetchFn(url, { signal: AbortSignal.timeout(5000) }) |
There was a problem hiding this comment.
T-47 — defaults go in named module constants, not magic numbers at the call site. UPDATE_CHECK_INTERVAL_MS already does this; the 5 s request timeout should too. Declare const UPDATE_CHECK_REQUEST_TIMEOUT_MS = 5_000 next to UPDATE_CHECK_INTERVAL_MS and use it here:
| const response = await fetchFn(url, { signal: AbortSignal.timeout(5000) }) | |
| const response = await fetchFn(url, { | |
| signal: AbortSignal.timeout(UPDATE_CHECK_REQUEST_TIMEOUT_MS), | |
| }) |
| try { | ||
| latestVersion = await fetchLatestVersion(method) | ||
| } catch (error) { | ||
| console.error('Failed to fetch the latest E2B CLI version:', error) |
There was a problem hiding this comment.
T-62 — error messages should be actionable and say what to do, not just what failed. This prints the raw error (including its stack) and leaves the user stuck. The other failure paths in this command already name the manual fallback; do the same here:
| console.error('Failed to fetch the latest E2B CLI version:', error) | |
| console.error( | |
| `Failed to fetch the latest E2B CLI version: ${error instanceof Error ? error.message : String(error)}. Check your network connection, or update manually with \`${getUpdateCommandDisplay(method) ?? 'npm install -g @e2b/cli@latest'}\`.` | |
| ) |
Summary
Replaces the passive
simple-update-notifierbox with a Codex-CLI-style updater (src/utils/updater.ts) that knows how the CLI was installed and can run the upgrade itself.detectInstallMethod(realpath(argv[1]))checks the path in this order:/Cellar/e2b/→ brew/_npx/→ other/.bun/install/global/→ bun/pnpm/global/→ pnpm/lib/node_modules/@e2b/cli/or Windows%APPDATA%\npm\node_modules\@e2b\cli→ npmother, which only gets a noticenpm install -g @e2b/cli@latestpnpm add -g @e2b/cli@latestbun add -g @e2b/cli@latestbrew upgrade e2bformulae.brew.sh/api/formula/e2b.json, because the formula lags npm (2.22.0 vs 2.22.2 today).~/.e2b/update-check.jsonstores{ lastCheckedAt, latestVersion, dismissedVersion? }and is refreshed in the background every 20h. Startup reads only the cache and never waits on the network, so a new version shows up on the next run (same as Codex).--version,--help,help,update, underCI, and whenNO_UPDATE_NOTIFIERis set.other), a one-line notice goes to stderr after the command, only if stderr is a TTY.e2b update: always fetches the latest version fresh and runs the detected upgrade. If it can't detect the install method, it prints the npm command as an example and exits 1.simple-update-notifieris removed.Usage:
Linear: SDK-396
Link to Devin session: https://app.devin.ai/sessions/1789eb3090a04ff9a5c2987719899361
Open in Devin Desktop: https://app.devin.ai/desktop/session/1789eb3090a04ff9a5c2987719899361?variant=devin
Requested by: @mishushakov