Skip to content

refactor: eliminate duplicate constants and standardize messages#95

Merged
kubrickcode merged 1 commit into
mainfrom
develop/shlee/75
Nov 18, 2025
Merged

refactor: eliminate duplicate constants and standardize messages#95
kubrickcode merged 1 commit into
mainfrom
develop/shlee/75

Conversation

@kubrickcode

Copy link
Copy Markdown
Owner

Unified configuration keys, message types, and UI texts from Extension and Web-view into shared constants

  • Define CONFIG, CONFIGURATION_TARGET, MESSAGE_TYPE, MESSAGES constants
  • Remove magic strings and enhance type safety
  • Delete unnecessary comments for improved code conciseness

fix #75

@github-actions github-actions Bot added the refactor Refactoring code label Nov 18, 2025
@kubrickcode

Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @kubrickcode, 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 significantly refactors the codebase by centralizing all configuration keys, message types, and user interface texts into a single shared constants file. This change aims to eliminate magic strings, enhance type safety, and standardize messaging across both the VS Code extension and its web-view components, ultimately improving code maintainability and readability.

Highlights

  • Centralized Constants: Introduced a new src/shared/constants.ts file to house common configuration keys, message types, and UI texts, promoting a single source of truth.
  • Eliminated Magic Strings: Replaced numerous hardcoded string literals across the extension and web-view components with references to the newly defined constants, improving maintainability.
  • Enhanced Type Safety: Leveraged TypeScript's as const assertion for the new constants, which improves type inference and ensures immutability and stronger type checking.
  • Standardized Messaging: Consolidated all user-facing messages (errors, info, quick pick titles/placeholders) into a MESSAGES object, including functions for dynamic message generation.
  • Improved Readability & Maintainability: Removed redundant comments and simplified code by consistently using named constants instead of inline string literals throughout the codebase.
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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

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 does a great job of refactoring hardcoded strings and configuration keys into shared constants, which significantly improves maintainability and type safety across the extension and web-view. The changes are clean and follow the stated goal. I've added a few review comments related to style guide adherence, specifically regarding the alphabetical ordering of object keys, and a minor consistency improvement in one of the files.

Comment thread src/extension/src/config-constants.ts
Comment thread src/shared/constants.ts Outdated
Unified configuration keys, message types, and UI texts from Extension and Web-view into shared constants
- Define CONFIG, CONFIGURATION_TARGET, MESSAGE_TYPE, MESSAGES constants
- Remove magic strings and enhance type safety
- Delete unnecessary comments for improved code conciseness

fix #75
@kubrickcode

Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

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 is a solid refactoring effort that successfully centralizes constants and messages into a shared file, which significantly improves code maintainability and eliminates magic strings across the extension and web-view. The changes are well-executed and align with the project's goal of improving code quality. I've included a couple of minor suggestions in the new constants.ts file to ensure full adherence to the repository's style guide regarding alphabetical ordering.

Comment thread src/shared/constants.ts
Comment thread src/shared/constants.ts
@kubrickcode kubrickcode merged commit 98d16b5 into main Nov 18, 2025
5 checks passed
@kubrickcode kubrickcode deleted the develop/shlee/75 branch November 18, 2025 11:49
@kubrickcode

Copy link
Copy Markdown
Owner Author

🎉 This PR is included in version 0.3.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Refactoring code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add shared constants package and remove magic strings

1 participant