Skip to content

Feat/use edgee api instead#32

Merged
NicolasGirardot merged 8 commits intomainfrom
feat/use-edgee-api-instead
Mar 25, 2026
Merged

Feat/use edgee api instead#32
NicolasGirardot merged 8 commits intomainfrom
feat/use-edgee-api-instead

Conversation

@NicolasGirardot
Copy link
Member

Checklist

  • I have read the Contributor Guide
  • I have read and agree to the Code of Conduct
  • I have added a description of my changes and why I'd like them included in the section below

Description of Changes

Describe your changes here

Related Issues

List related issues here

NicolasGirardot and others added 5 commits March 23, 2026 10:18
The authorize page now returns a User API Token instead of a gateway key. After browser auth, the CLI calls the Edgee management API to select an org, create/retrieve a gateway API key (with compression), and store it. - Add API client module (src/api.rs) for Edgee management API calls - Update login flow: remove compression param, add org selection and get-or-create key endpoint - Add user_token, api_key_id, org_id fields to credentials (v3) - Separate gateway URL (EDGEE_API_URL) from console API (EDGEE_CONSOLE_API_URL) - Show re-login tip for users with legacy v2 credentials Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
user_token, email, user_id, org_slug, org_id are account-level and shared across providers. Reuse existing user_token when setting up a new coding assistant instead of requiring browser auth again. - Separate gateway URL (EDGEE_API_URL) from console API (EDGEE_CONSOLE_API_URL) - Use get-or-create endpoint with compression flag - Extract browser_auth into its own function - Skip browser auth when user_token already exists Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@NicolasGirardot NicolasGirardot requested a review from a team as a code owner March 24, 2026 16:29
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the CLI authentication/config flow to use an Edgee Console API client for org selection and API key provisioning, and switches launch commands to use the Edgee gateway base URL.

Changes:

  • Add ApiClient (reqwest-based) to list organizations and get/create gateway API keys during edgee auth login.
  • Restructure credentials (v3) to store a user token + org info at the top level, and add api_key_id to provider configs.
  • Update Claude/Codex launch to use gateway_base_url() and read org slug from top-level credentials.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/main.rs Registers the new api module.
src/api.rs Adds Console API client for org listing and API key provisioning.
src/config.rs Bumps credentials version to v3; adds new credential fields and base URL helpers.
src/commands/auth/login.rs Reworks login flow to reuse a user token and provision provider keys via Console API.
src/commands/auth/status.rs Updates status output to reflect new credential fields.
src/commands/launch/claude.rs Switches Claude launch to gateway URL + top-level org slug.
src/commands/launch/codex.rs Switches Codex launch to gateway URL + top-level org slug.
Cargo.toml Adds reqwest and serde_json.
Cargo.lock Locks new dependencies.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +29 to +40
match &creds.email {
Some(e) if !e.is_empty() => println!(
"\n {} {}",
style("✓").green().bold(),
style(format!("Logged in as {e}")).bold()
),
_ => println!(
"\n {} {}",
style("✓").green().bold(),
style("Logged in").bold()
),
}
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

The status output always prints a green "✓ Logged in" message even when only provider API keys exist and user_token is missing. This is misleading for users and inconsistent with the launch commands’ "Tip: Run edgee auth login" behavior. Consider printing "Authenticated" only when user_token is set, and otherwise printing something like "API key configured" / "Not authenticated" with a suggested next step.

Copilot uses AI. Check for mistakes.
Comment on lines +4 to 6
mod api;
mod commands;
mod config;
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

The PR description template hasn't been filled out (it still contains placeholders for "Description of Changes" / related issues). Please add a brief summary of what changed and why so reviewers can validate the intent against the implementation.

Copilot uses AI. Check for mistakes.
Comment on lines +63 to +66
Some(2) => {
let creds: Credentials = toml::from_str(content)?;
Ok((creds, true))
}
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

migrate() for credentials version 2 deserializes directly into the new Credentials/ProviderConfig structs. Any fields that existed in v2 but were removed from ProviderConfig (e.g. provider-scoped email, user_id, org_slug) will be silently dropped and then permanently lost when read() rewrites the file. Consider defining a CredentialsV2 + ProviderConfigV2 that matches the v2 schema and explicitly mapping/moving those values into the new top-level Credentials fields (and leaving api_key_id as None if not available).

Copilot uses AI. Check for mistakes.
Comment on lines +9 to 11
let has_any = creds.user_token.as_deref().filter(|t| !t.is_empty()).is_some()
|| creds.claude.as_ref().map(|c| !c.api_key.is_empty()).unwrap_or(false)
|| creds.codex.as_ref().map(|c| !c.api_key.is_empty()).unwrap_or(false);
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

has_any treats having a provider API key configured as equivalent to being authenticated (user_token present). This makes edgee auth status report a logged-in state even when the user is not actually authenticated (and other commands show a tip to run edgee auth login). Consider separating "authenticated" (user_token present) from "configured" (provider api keys present) and adjust the output accordingly.

Copilot uses AI. Check for mistakes.
@NicolasGirardot NicolasGirardot merged commit 22fd480 into main Mar 25, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants