Skip to content

Add getCallbackUri to the HostProvider #5322

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 4, 2025
Merged

Add getCallbackUri to the HostProvider #5322

merged 1 commit into from
Aug 4, 2025

Conversation

sjf
Copy link
Contributor

@sjf sjf commented Aug 3, 2025

Centralize callback URI management through the HostProvider instead of having it in multiple places in the codebase. This moves the dependency on the vscode.env.uriScheme into the vscode specific code.

1. AuthHandler.ts

  • Simplify error handling by making the callback URI required rather than optional.
  • Now throws an error if AuthHandler is not enabled instead of returning undefined

2. HostProvider.ts - Added callback URI provider

  • Added a new getCallbackUri property that returns a Promise<string>
  • This allows the host provider to supply callback URIs for authentication

3. extension.ts

  • Implemented callback URI provider using the vscode uriScheme

4. cline-core.ts

  • Implemented callback URI provider using the AuthHandler

5. AuthService.ts

  • Updated to use HostProvider to get the callback URI

Test Procedure

Tested manually in the vscode extension host and with cline-core standalone service.

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • ♻️ Refactor Changes
  • 💅 Cosmetic Changes
  • 📚 Documentation update
  • 🏃 Workflow Changes

Pre-flight Checklist

  • Changes are limited to a single feature, bugfix or chore (split larger changes into separate PRs)
  • Tests are passing (npm test) and code is formatted and linted (npm run format && npm run lint)
  • I have created a changeset using npm run changeset (required for user-facing changes)
  • I have reviewed contributor guidelines

Screenshots

Additional Notes


Important

Centralized callback URI management by adding getCallbackUri to HostProvider, updating AuthHandler, AuthService, extension.ts, and cline-core.ts to use it.

  • Centralized Callback URI Management:
    • Added getCallbackUri to HostProvider to centralize callback URI management.
    • getCallbackUri returns a Promise<string> for authentication callback URIs.
  • AuthHandler.ts:
    • Simplified error handling by making callback URI required.
    • Throws error if AuthHandler is not enabled.
  • AuthService.ts:
    • Updated to use HostProvider.getCallbackUri() for callback URIs.
  • extension.ts:
    • Implemented callback URI provider using vscode.env.uriScheme.
  • cline-core.ts:
    • Implemented callback URI provider using AuthHandler.

This description was created by Ellipsis for aff145d. You can customize this summary. It will automatically update as commits are pushed.

Copy link

changeset-bot bot commented Aug 3, 2025

⚠️ No Changeset found

Latest commit: aff145d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@sjf sjf force-pushed the sjf-a3-jlkjlkj branch from a07dff9 to e72fe59 Compare August 3, 2025 21:20
Copy link
Contributor

github-actions bot commented Aug 3, 2025

Coverage Report

Extension Coverage

Base branch: 47%

PR branch: 48%

✅ Coverage increased or remained the same

Webview Coverage

Base branch: 17%

PR branch: 17%

✅ Coverage increased or remained the same

Overall Assessment

Test coverage has been maintained or improved

Last updated: 2025-08-03T23:53:40.460067

**Centralize callback URI management** through the HostProvider instead of having it in multiple places in the codebase.

**Simplify error handling** by making the callback URI required rather than optional

The changes are related to **authentication callback URI handling** in the Cline extension. Here's what's being modified:

  - Simplified callback URI retrieval
- Changed return type from `Promise<string | undefined>` to `Promise<string>`
- Now throws an error if AuthHandler is not enabled instead of returning undefined

- Added a new `getCallbackUri` property that returns a `Promise<string>`
- This allows the host provider to supply callback URIs for authentication

  - Implemented callback URI provider

  - Updated to use HostProvider for callback URI

  - Updated to match new signature
@sjf sjf force-pushed the sjf-a3-jlkjlkj branch from e72fe59 to aff145d Compare August 3, 2025 23:43
@sjf sjf changed the title Add getCallUri to the HostProvider Add getCallbackUri to the HostProvider Aug 4, 2025
Copy link
Contributor

@tseglevskiy tseglevskiy left a comment

Choose a reason for hiding this comment

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

Thank you!

@sjf sjf merged commit b8227c1 into main Aug 4, 2025
13 checks passed
abeatrix added a commit that referenced this pull request Aug 4, 2025
abeatrix added a commit that referenced this pull request Aug 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants