-
Notifications
You must be signed in to change notification settings - Fork 0
feat: git-broom package #490
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
base: release
Are you sure you want to change the base?
Conversation
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.
Hello @Leksat, 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!
Summary of Changes
Hello team,
Gemini (gemini-code-assist) here, providing a summary of this pull request authored by @Leksat.
This PR introduces a new package called git-broom. The motivation behind this is to replace the existing clean script, which is noted as being insufficient and dependent on devbox. The new git-broom package aims to provide a more robust and independent solution for cleaning untracked files in a Git repository.
Highlights
- New Package: git-broom: A completely new package
git-broomhas been added to the monorepo. - Improved Git Cleaning: The
git-broomtool wrapsgit clean -dxffbut adds user prompts before deletion and supports custom ignore rules. - .gitbroomignore Support: Users can create a
.gitbroomignorefile in the repository root to specify files or directories that should not be cleaned, overriding default excludes. - Default Excludes: By default, the tool excludes
/_localand/.ideadirectories from being cleaned, unless a.gitbroomignorefile is present. - Unit Tests: Comprehensive unit tests have been added to verify the behavior of the
git-broomCLI under various conditions, including prompting, ignoring files, and handling errors.
Changelog
Click here to see the changelog
- lerna.json
- Added the new
packages/git-broompath to the list of managed packages.
- Added the new
- packages/git-broom/.gitignore
- Added
git-broom-*.tgzto ignore packaged tarballs.
- Added
- packages/git-broom/README.md
- Added documentation explaining the purpose, features, usage (
npx -y git-broom), and development instructions for thegit-broompackage.
- Added documentation explaining the purpose, features, usage (
- packages/git-broom/tests/cli.test.ts
- Added a new test file containing multiple unit tests for the
git-broomCLI. - Tests cover scenarios like prompting for confirmation, cleaning untracked files, respecting
.gitignoreand.gitbroomignore, default excludes (/_local,/.idea), handling empty.gitbroomignore, ignoring comments in.gitbroomignore, error handling, and user abortion.
- Added a new test file containing multiple unit tests for the
- packages/git-broom/eslint.config.mjs
- Added ESLint configuration for the new package, extending the base custom config.
- packages/git-broom/index.ts
- This is the main executable script for
git-broom. - Uses
zxfor shell command execution. - Finds the Git repository root.
- Performs a dry run (
git clean -dfn) to list untracked files. - Prompts the user for confirmation if untracked files are found.
- Reads
.gitbroomignoreif it exists, using its contents as ignore patterns. - If
.gitbroomignoredoes not exist or is empty, defaults to ignoring/_localand/.idea. - Executes
git clean -dxffwith the determined ignore patterns (-e <pattern>). - Includes basic error handling for Git command failures.
- This is the main executable script for
- packages/git-broom/package.json
- Defined the new
git-broompackage with name, version, description, license, and entry point (index.ts). - Configured
binto makegit-broomexecutable. - Added dependencies:
tsx(for running TypeScript files directly) andzx(for shell scripting). - Added devDependencies:
@custom/eslint-config,execa(used in tests), andvitest(for unit testing). - Defined scripts for development (
dev), static analysis (test:static), and unit tests (test:unit).
- Defined the new
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| 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 issue 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 is currently in preview and 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 to provide feedback.
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.
Files untracked hide,
Broom sweeps clean with gentle hand,
Ask first, then delete.
Footnotes
-
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. ↩
Description of changes
Added
git-broompackage.Motivation and context
Our
cleanscript isn't good enough. Also, it requiresdevbox.How has this been tested?