-
Notifications
You must be signed in to change notification settings - Fork 5
fix all problem and test the windows version #28
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
Conversation
…e gh auth login error
Summary of ChangesHello @m7medVision, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces significant improvements to the application's authentication flow, particularly for the Copilot provider, by integrating with the GitHub CLI for token management. It also enhances cross-platform compatibility, specifically for Windows environments, by refining configuration path resolution. These changes aim to resolve authentication errors and provide a more robust and user-friendly experience. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces several fixes, primarily focused on GitHub authentication and improving Windows compatibility. Key changes include integrating with the gh CLI to fetch authentication tokens, removing the now-obsolete Copilot token exchange mechanism, and correcting the configuration directory path logic for Windows. My review identifies a critical issue where the application would exit if the user's home directory couldn't be found on Windows. I've also pointed out a medium-severity regression where support for configuring API keys via environment variables was removed, and I've provided suggestions to address both points.
| if err != nil { | ||
| fmt.Println("Error getting user home directory:", err) | ||
| os.Exit(1) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling os.Exit(1) within a library function like getConfigDir is a critical issue, as it will terminate the entire application if it fails to determine the user's home directory. This makes the package non-reusable and difficult to test. The function should handle this error gracefully instead of exiting. For instance, it could log the error to stderr and fall back to a sensible default, such as the current directory.
if err != nil {
fmt.Fprintf(os.Stderr, "Warning: could not determine user home directory: %v. Using current directory for config.\n", err)
return "."
}| tok, err := tryGetTokenFromGHCLI() | ||
| if err == nil && tok != "" { | ||
| return tok, nil | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change removes the logic for loading the GitHub token from GITHUB_TOKEN or GITHUB_MODELS_TOKEN environment variables. This is a regression in functionality, as users who previously relied on these environment variables will find that they no longer work. It's a common and good practice to check for environment variables before falling back to other methods like executing an external command, as it's faster and provides a conventional configuration method.
if token := os.Getenv("GITHUB_TOKEN"); token != "" {
return token, nil
}
if token := os.Getenv("GITHUB_MODELS_TOKEN"); token != "" {
return token, nil
}
tok, err := tryGetTokenFromGHCLI()
if err == nil && tok != "" {
return tok, nil
}
…e gh auth login error