Skip to content

chore: add a gemini cli hook to run format on file changes#242

Open
MichaelDoyle wants to merge 1 commit into
mainfrom
md/hooks
Open

chore: add a gemini cli hook to run format on file changes#242
MichaelDoyle wants to merge 1 commit into
mainfrom
md/hooks

Conversation

@MichaelDoyle

Copy link
Copy Markdown
Contributor

No description provided.

@MichaelDoyle MichaelDoyle requested a review from pavelgj March 27, 2026 14:33

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

Copy link
Copy Markdown
Contributor

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 Dart CLI hook to run 'dart format' on specific files or the entire project. The review feedback suggests correcting a typo in the documentation, simplifying the JSON parsing logic using Dart's pattern matching to reduce nesting, and improving the robustness of stdout/stderr handling by checking types directly and adhering to single-line if statement conventions.

Comment thread tools/hooks/format.dart Outdated
Comment thread tools/hooks/format.dart
Comment thread tools/hooks/format.dart Outdated
Comment thread tools/hooks/format.dart Outdated
@MichaelDoyle

Copy link
Copy Markdown
Contributor Author

/gemini review

@MichaelDoyle MichaelDoyle enabled auto-merge (squash) April 29, 2026 14:31
@MichaelDoyle MichaelDoyle disabled auto-merge April 29, 2026 14:31
@MichaelDoyle MichaelDoyle enabled auto-merge (squash) April 29, 2026 14:31

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

Copy link
Copy Markdown
Contributor

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 Dart script, tools/hooks/format.dart, which serves as a Gemini CLI hook to automate code formatting via dart format. The script reads a file path from stdin or defaults to the current directory. Feedback was provided regarding the silent suppression of errors during input parsing, which could lead to unintended full-project formatting; it is recommended to log these errors to provide better visibility to the user.

Comment thread tools/hooks/format.dart
@MichaelDoyle MichaelDoyle requested a review from kevmoo April 29, 2026 14:35

@kevmoo kevmoo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it, but we should see what @pavelgj says

Also see

kevmoo/personal_dotfiles@0fa84ca#diff-1f6eec92873f0e01ec265c80f26c4d5cc8be4a1a833f08fa848c815d95b61fbdR18-R27

MUSH be paranoid about partially staged files!

@MichaelDoyle

Copy link
Copy Markdown
Contributor Author

WDYT @pavelgj

BTW, on a totally separate, but related not, I see we have .agent/rules but this doesn't seem to be gemini/jetski friendly. which tool wants .agent and does it support some of the other locations?

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