Skip to content

Conversation

@friggeri
Copy link
Collaborator

Draft PR until we land the upstream changes in the CLI.

--

Enable SDK clients to customize authentication when spawning the CLI server.

Node.js:

  • Add githubToken and useLoggedInUser options to CopilotClientOptions
  • Set COPILOT_SDK_AUTH_TOKEN env var and pass --auth-token-env flag
  • Pass --no-auto-login when useLoggedInUser is false
  • Default useLoggedInUser to false when githubToken is provided

Python:

  • Add github_token and use_logged_in_user options
  • Same behavior as Node.js SDK

Go:

  • Add GithubToken and UseLoggedInUser fields to ClientOptions
  • Same behavior as Node.js SDK

.NET:

  • Add GithubToken and UseLoggedInUser properties to CopilotClientOptions
  • Same behavior as Node.js SDK

All SDKs include validation to prevent use with cliUrl (external server) and tests for the new options.

…ients

Enable SDK clients to customize authentication when spawning the CLI server.

Node.js:
- Add githubToken and useLoggedInUser options to CopilotClientOptions
- Set COPILOT_SDK_AUTH_TOKEN env var and pass --auth-token-env flag
- Pass --no-auto-login when useLoggedInUser is false
- Default useLoggedInUser to false when githubToken is provided

Python:
- Add github_token and use_logged_in_user options
- Same behavior as Node.js SDK

Go:
- Add GithubToken and UseLoggedInUser fields to ClientOptions
- Same behavior as Node.js SDK

.NET:
- Add GithubToken and UseLoggedInUser properties to CopilotClientOptions
- Same behavior as Node.js SDK

All SDKs include validation to prevent use with cliUrl (external server)
and tests for the new options.
@github-actions
Copy link

✅ Cross-SDK Consistency Review

This PR demonstrates excellent consistency across all four SDK implementations. The authentication feature has been implemented uniformly with proper attention to language-specific conventions.

Consistency Verified ✓

API Naming (properly adapted to language conventions):

  • Node.js/TypeScript: githubToken, useLoggedInUser (camelCase) ✓
  • Python: github_token, use_logged_in_user (snake_case) ✓
  • Go: GithubToken, UseLoggedInUser (PascalCase for exported fields) ✓
  • .NET: GithubToken, UseLoggedInUser (PascalCase) ✓

Behavior consistency across all SDKs:

  1. ✓ Both options added to client options/configuration
  2. ✓ Validation prevents use with cliUrl/CliUrl/CLIUrl (external servers manage their own auth)
  3. githubToken/GithubToken passed via COPILOT_SDK_AUTH_TOKEN environment variable
  4. ✓ CLI flag --auth-token-env COPILOT_SDK_AUTH_TOKEN added when token provided
  5. ✓ CLI flag --no-auto-login added when useLoggedInUser is false
  6. ✓ Default logic: useLoggedInUser defaults to false when githubToken is provided, otherwise true
  7. ✓ Users can explicitly override the default by setting useLoggedInUser

Test coverage - all SDKs include equivalent tests:

  • ✓ Accept token option
  • ✓ Default useLoggedInUser behavior with/without token
  • ✓ Explicit override of useLoggedInUser
  • ✓ Validation errors when auth options used with external server URL

Documentation - consistent comments/docstrings across all SDKs explaining:

  • ✓ Token takes priority over other auth methods
  • useLoggedInUser controls fallback to stored OAuth/gh CLI auth
  • ✓ Default behavior clearly documented

Summary

This PR maintains excellent feature parity and API design consistency. The implementation correctly accounts for each language's idioms while keeping the semantic behavior identical. No inconsistencies found—great work! 🎉

AI generated by SDK Consistency Review Agent

… expression'

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
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.

4 participants