Skip to content

Conversation

@aka1976mb
Copy link

Summary

Details

Related Issues

How to Validate

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

Co-authored-by: riddhi <[email protected]>

## Summary

<!-- Concisely describe what this PR changes and why. Focus on impact and
urgency. -->

## Details

<!-- Add any extra context and design decisions. Keep it brief but complete. -->

## Related Issues

<!-- Use keywords to auto-close issues (Closes google-gemini#123, Fixes google-gemini#456). If this PR is
only related to an issue or is a partial fix, simply reference the issue number
without a keyword (Related to google-gemini#123). -->

## How to Validate

<!-- List exact steps for reviewers to validate the change. Include commands,
expected results, and edge cases. -->

## Pre-Merge Checklist

<!-- Check all that apply before requesting review or merging. -->

- [ ] Updated relevant documentation and README (if needed)
- [ ] Added/updated tests (if needed)
- [ ] Noted breaking changes (if any)
- [ ] Validated on required platforms/methods:
  - [ ] MacOS
    - [ ] npm run
    - [ ] npx
    - [ ] Docker
    - [ ] Podman
    - [ ] Seatbelt
  - [ ] Windows
    - [ ] npm run
    - [ ] npx
    - [ ] Docker
  - [ ] Linux
    - [ ] npm run
    - [ ] npx
    - [ ] Docker
This commit introduces a new setting in `.vscode/settings.json` to store the Gemini API key.
This key will be used for authentication when interacting with the Gemini API.
…configuration file. Here's a cleaned up version that resolves the issues:

```yaml
have_fun: false
code_review:
  disable: false
  comment_severity_threshold: 'MEDIUM'  # Changed from HIGH to MEDIUM
  max_review_comments: 20               # Changed from -1 to 20
  pull_request_opened:
    help: false
    summary: true
    code_review: true
ignore_patterns:
  - "**/*.md"
  - "**/package-lock.json"
  - "**/dist/"
```

1. **Removed duplicate `ignore_patterns`** - You had two separate `ignore_patterns` sections
2. **Resolved conflicting values** - The later settings were overriding the earlier ones
3. **Applied your intended changes** - Now using MEDIUM severity and 20 comment limit

- **More detailed reviews** (MEDIUM severity catches more issues than HIGH)
- **Prevents comment overload** (max 20 comments instead of unlimited)
- **Ignores common noise files** (docs, lock files, build outputs)
- **Still provides summaries and code reviews** on PR open

This should give you balanced, actionable code reviews without being overwhelmed by too many comments!
…onfigurations for code formatting and linting. These changes aim to improve code consistency and quality across the project.
This commit updates the `.github/CODEOWNERS` file to reflect recent team changes and ensure proper ownership of code. These changes aim to improve maintainability and streamline the code review process.
This commit introduces a new utility function getRemoteName and its
corresponding tests.

The getRemoteName function is designed to determine the remote name
associated with a given Git URL by parsing the output of git remote -v.
This utility can be crucial for various Git-related operations within the CLI,
especially when dealing with multiple remotes or needing to programmatically
identify the remote linked to a specific repository URL.

This feature is separated from other changes to adhere to the single
responsibility principle, allowing for independent review, testing, and
potential future reverts without impacting unrelated functionalities.
@aka1976mb aka1976mb requested review from a team as code owners December 6, 2025 00:45
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @aka1976mb, 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 focuses on improving developer utilities and configuration management within the project. It introduces a new function to identify Git remote names, streamlines the handling of Gemini API keys by allowing direct configuration and establishing a clear priority for key sources, and updates development environment settings. These changes aim to enhance the robustness of Git interactions and simplify API key management within the application.

Highlights

  • Git Remote Name Utility: A new utility function, getRemoteName, has been introduced to programmatically determine the Git remote name associated with a given repository URL. This includes comprehensive unit tests to ensure its reliability across various scenarios.
  • Gemini API Key Configuration Enhancement: The application's configuration system now allows specifying the Gemini API key directly within the configuration object. This key is prioritized over environment variables and previously loaded keys, and new tests validate this priority order and ensure API keys are masked in proxy settings for security.
  • Dependency Management Updates: The package-lock.json file has been updated with refined peer dependency declarations for various packages, ensuring more accurate and consistent dependency resolution within the project.
  • Developer Tooling Configuration: The .vscode/settings.json file has been updated to include new configurations for GitHub Pull Requests (ignoring the 'main' branch) and enabling Copilot's next edit suggestions, aiming to improve the overall developer experience.
Ignored Files
  • Ignored by pattern: .gemini/** (1)
    • .gemini/config.yaml
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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 a new utility for determining the git remote name and refactors the Gemini API key configuration to prioritize keys from the config file. While the changes are generally well-tested, there are two critical issues. A new utility function getRemoteName has a reference to an undefined function, which will cause a runtime error. Additionally, a new security-focused test for redacting API keys from proxy URLs is being added, but the corresponding implementation is missing, creating a risk of credential leakage.

@aka1976mb
Copy link
Author

It looks like you're encountering shell parsing errors when trying to run a command. These errors are coming from PowerShell because you're trying to run code snippets as shell commands, which won't work.

Let me help you fix the two critical issues properly. Here's what you actually need to do:

Fix 1: Add the missing import in GetRemoteName.ts
Open the file packages/cli/src/utils/GetRemoteName.ts and add the import at the top:

typescript
// Add this line at the top of the file
import { run_shell_command } from '../core/shell.js';
Or if it's a TypeScript project:

typescript
import { run_shell_command } from '../core/shell';
Fix 2: Implement API key redaction in config.ts
Open packages/core/src/config/config.ts and add this method to the Config class:

typescript
// Add this method to your Config class
getRedactedProxy(): string | undefined {
if (!this.proxy) {
return undefined;
}

let redactedProxy = this.proxy;

// Redact the API key if it exists
if (this.geminiApiKey && this.geminiApiKey.trim()) {
// Escape special regex characters in the API key
const escapedKey = this.geminiApiKey.replace(/[.+?^${}()|[]\]/g, '\$&');
redactedProxy = redactedProxy.replace(
new RegExp(escapedKey, 'g'),
'
**'
);
}

return redactedProxy;
}
Then update the createContentGeneratorConfig function to use this method. Find where it's defined (likely in packages/cli/src/config/geminiApiKey.ts or similar) and change:

typescript
// Change from this:
proxy: config.proxy,

// To this:
proxy: config.getRedactedProxy(),
Or if you want to modify the existing getProxy() method instead:

typescript
getProxy(redact: boolean = false): string | undefined {
if (!this.proxy) {
return undefined;
}

if (!redact) {
return this.proxy;
}

let redactedProxy = this.proxy;

if (this.geminiApiKey && this.geminiApiKey.trim()) {
const escapedKey = this.geminiApiKey.replace(/[.+?^${}()|[]\]/g, '\$&');
redactedProxy = redactedProxy.replace(
new RegExp(escapedKey, 'g'),
'
**'
);
}

return redactedProxy;
}
And then update the call to:

typescript
proxy: config.getProxy(true),
What you should NOT do:
Don't try to run TypeScript/JavaScript code in your shell directly

The code snippets I provided are for editing files in your code editor (VS Code, etc.)

Open the actual files and make the edits there

- Added missing import for 
un_shell_command in GetRemoteName.ts.
- Implemented robust API key redaction in Config.getProxy() method.
- Updated calls to getProxy() to redact the API key where necessary.
@aka1976mb
Copy link
Author

Here's a summary of the actions taken:

  • Fixed the ReferenceError in GetRemoteName.ts: Added the missing import for run_shell_command.
  • Implemented robust API key redaction: Modified the getProxy() method in Config.ts to redact API keys from proxy
    URLs.
  • Updated getProxy() call sites: Changed calls to getProxy() to getProxy(true) where necessary, ensuring API keys
    are redacted when exposed (e.g., in logging).
  • Addressed Git issues: Resolved issues with unstaged changes and diverged branches, successfully pushing the fixes
    to the remote repository.
  • Created GitHub Issues: Created two issues for the identified problems (issues ReferenceError in getRemoteName utility #14665 and Missing Implementation for API Key Redaction in Proxy URLs #14666) to ensure they are
    tracked.

@jackwotherspoon
Copy link
Collaborator

@aka1976mb Closing for same reason as your other PRs. Please respect the contribution guidelines and provide PR descriptions and link to proper issues.

@aka1976mb aka1976mb deleted the feat/git-remote-name-utility branch December 8, 2025 03:46
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