Skip to content

feat(cli): deprecate --team flag and scope template commands to API key team#1571

Closed
mishushakov wants to merge 3 commits into
mainfrom
cli-e2b-team-id-usage
Closed

feat(cli): deprecate --team flag and scope template commands to API key team#1571
mishushakov wants to merge 3 commits into
mainfrom
cli-e2b-team-id-usage

Conversation

@mishushakov

@mishushakov mishushakov commented Jul 21, 2026

Copy link
Copy Markdown
Member

Summary

Deprecates the --team flag on template list, template publish, template unpublish, and template delete: the flag is still accepted but is now a no-op that prints a deprecation warning, and the E2B_TEAM_ID env var and config-file team ID are no longer read. These commands are always scoped to the currently active project — the one the authenticated API key belongs to; verified against prod that GET /templates returns the identical template set with and without an explicit teamID param, so resolveTeamId() and the teamID query param were removed as redundant. template publish, template unpublish, and template delete now call ensureAPIKey() up front, showing the "run e2b auth login" hint instead of failing with a raw 401 from the API. Switching projects remains available via e2b auth configure or by setting E2B_API_KEY to another project's key.

Usage

# Scoped to the currently active project (E2B_API_KEY or the project from `e2b auth configure`)
e2b template list
e2b template delete my-template

# Still accepted, but ignored with a warning:
e2b template list --team 460355b3-4f64-48f9-9a16-4442817f79f5
# Warning: The '--team' option is deprecated and will be removed in future releases.
# The operation is scoped to the currently active project.

# Without credentials, publish/unpublish/delete now show a login hint instead of a 401:
e2b template publish my-template
# ╭─ You must be logged in to use this command. Run e2b auth login. ─╮

Testing

New team_option.test.ts covers the deprecated flag against a mock API server (warning printed, flag accepted, no teamID query param sent) and the ensureAPIKey() guards for publish/unpublish/delete with credentials fully isolated (empty HOME, no E2B env vars).

🤖 Generated with Claude Code

…ey team

The --team flag on template list/publish/unpublish/delete is now a no-op
that prints a deprecation warning; E2B_TEAM_ID and the config file team ID
are no longer read. The API scopes these endpoints to the authenticated
API key's team, so the explicit teamID param was redundant. publish,
unpublish, and delete now require an API key up front via ensureAPIKey()
and show a login hint instead of a raw 401.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 800a786

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

This PR includes changesets to release 1 package
Name Type
@e2b/cli Minor

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

@cursor

cursor Bot commented Jul 21, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Breaking for workflows that relied on --team or E2B_TEAM_ID to target another project; scope is now always the API key’s project.

Overview
--team on template list, publish, unpublish, and delete is deprecated: it only prints a warning and does not change scope. resolveTeamId, E2B_TEAM_ID, and config-based team ID are removed; GET /templates is called without a teamID query param.

template publish, unpublish, and delete call ensureAPIKey() before API calls so missing credentials show the login hint instead of a 401. Tests cover deprecation behavior and the auth guard.

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

@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Package Artifacts

Built from a29d8eb. Download artifacts from this workflow run.

JS SDK (e2b@2.35.1-cli-e2b-team-id-usage.0):

npm install ./e2b-2.35.1-cli-e2b-team-id-usage.0.tgz

CLI (@e2b/cli@2.13.4-cli-e2b-team-id-usage.0):

npm install ./e2b-cli-2.13.4-cli-e2b-team-id-usage.0.tgz

Python SDK (e2b==2.34.0+cli.e2b.team.id.usage):

pip install ./e2b-2.34.0+cli.e2b.team.id.usage-py3-none-any.whl

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f4c4363e5c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/cli/src/commands/template/publish.ts
Comment thread packages/cli/src/options.ts Outdated
Adds a mock-API test that --team prints the deprecation warning and sends
no teamID query param, and no-credential tests (isolated HOME) that
publish/unpublish/delete show the login hint instead of a 401.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Kraci added a commit that referenced this pull request Jul 22, 2026
…l output (#1577)

## Summary

Copy-only rename of the remaining user-visible "team" strings to
"project" in the CLI (EN-1891) — part of the Teams → Projects rename,
following the dashboard copy pass. 12 string literals across `auth
login`, `auth info`, `auth configure`, and `template publish`; no flag,
env var, config key, API call, or exit-code behavior changes.

Explicitly untouched (owned by other PRs): `--team` flag + help text
(#1571), `~/.e2b/config.json` keys (#1570), `e2b.toml` `team_id`
(#1569), internal identifiers and API `Team` types. Best merged after
#1569#1571 to keep their rebases trivial.

## Usage examples

```
$ e2b auth login
Logged in as you@e2b.dev with selected project Your Project

$ e2b auth info
You are logged in as you@e2b.dev,
Selected project: Your Project (a1b2c3d4)

$ e2b auth configure
? Select project
  Your Project (a1b2c3d4) (currently selected project)
Project Your Project (a1b2c3d4) selected.

$ e2b template publish
⚠️ This will make the template public to everyone outside your project
```

## Testing

- No new tests — strings only, not functionality (per review). Existing
suite passes except the pre-existing backend-integration suites that
need live sandbox access (fail identically on main).
- Patch changeset included.
@mishushakov

Copy link
Copy Markdown
Member Author

closing in favor of less-intrusive #1580

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.

1 participant