Skip to content

Conversation

@Leksat
Copy link
Contributor

@Leksat Leksat commented May 29, 2025

Description of changes

Added git-broom package.

Motivation and context

Our clean script isn't good enough. Also, it requires devbox.

How has this been tested?

  • Manually
  • Unit tests
  • Integration tests

Copy link

@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.

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-broom has been added to the monorepo.
  • Improved Git Cleaning: The git-broom tool wraps git clean -dxff but adds user prompts before deletion and supports custom ignore rules.
  • .gitbroomignore Support: Users can create a .gitbroomignore file in the repository root to specify files or directories that should not be cleaned, overriding default excludes.
  • Default Excludes: By default, the tool excludes /_local and /.idea directories from being cleaned, unless a .gitbroomignore file is present.
  • Unit Tests: Comprehensive unit tests have been added to verify the behavior of the git-broom CLI under various conditions, including prompting, ignoring files, and handling errors.

Changelog

Click here to see the changelog
  • lerna.json
    • Added the new packages/git-broom path to the list of managed packages.
  • packages/git-broom/.gitignore
    • Added git-broom-*.tgz to ignore packaged tarballs.
  • packages/git-broom/README.md
    • Added documentation explaining the purpose, features, usage (npx -y git-broom), and development instructions for the git-broom package.
  • packages/git-broom/tests/cli.test.ts
    • Added a new test file containing multiple unit tests for the git-broom CLI.
    • Tests cover scenarios like prompting for confirmation, cleaning untracked files, respecting .gitignore and .gitbroomignore, default excludes (/_local, /.idea), handling empty .gitbroomignore, ignoring comments in .gitbroomignore, error handling, and user abortion.
  • 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 zx for 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 .gitbroomignore if it exists, using its contents as ignore patterns.
    • If .gitbroomignore does not exist or is empty, defaults to ignoring /_local and /.idea.
    • Executes git clean -dxff with the determined ignore patterns (-e <pattern>).
    • Includes basic error handling for Git command failures.
  • packages/git-broom/package.json
    • Defined the new git-broom package with name, version, description, license, and entry point (index.ts).
    • Configured bin to make git-broom executable.
    • Added dependencies: tsx (for running TypeScript files directly) and zx (for shell scripting).
    • Added devDependencies: @custom/eslint-config, execa (used in tests), and vitest (for unit testing).
    • Defined scripts for development (dev), static analysis (test:static), and unit tests (test:unit).
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

  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[bot]

This comment was marked as resolved.

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