Skip to content

Conversation

joshsny
Copy link
Collaborator

@joshsny joshsny commented Jul 23, 2025

No description provided.

@Copilot Copilot AI review requested due to automatic review settings July 23, 2025 13:13
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes the husky pre-commit hook configuration to properly handle code formatting and linting during commits. The changes ensure that when code is auto-fixed by the linting and formatting tools, the changes are staged and the commit is rejected with a clear message for the developer to commit again.

  • Updated the biome lint command flag from --fix to --write for consistency
  • Enhanced the pre-commit hook with proper husky setup and auto-staging logic
  • Added a blank line formatting fix in the types file

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
package.json Updated lint:fix script to use --write flag instead of --fix
.husky/pre-commit Added complete pre-commit hook implementation with auto-staging and proper error handling
typescript/src/tools/types.ts Added blank line formatting in Context type definition

# Check if anything changed
if ! git diff --quiet; then
# Stage changed files
git diff --name-only | xargs git add
Copy link

Copilot AI Jul 23, 2025

Choose a reason for hiding this comment

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

This command will fail if there are files with spaces in their names. Use 'git diff --name-only -z | xargs -0 git add' to handle filenames with spaces safely.

Suggested change
git diff --name-only | xargs git add
git diff --name-only -z | xargs -0 git add

Copilot uses AI. Check for mistakes.

# Check if anything changed
if ! git diff --quiet; then
# Stage changed files
git diff --name-only | xargs git add
Copy link

Copilot AI Jul 23, 2025

Choose a reason for hiding this comment

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

If no files are changed, 'git diff --name-only' will output nothing and xargs may fail. Consider using 'git add -u' instead, or add a check to ensure there are files to stage.

Suggested change
git diff --name-only | xargs git add
git diff --name-only | grep -q . && git diff --name-only | xargs git add

Copilot uses AI. Check for mistakes.

Comment on lines +8 to +12
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

pnpm run lint:fix
pnpm run format
Copy link
Member

Choose a reason for hiding this comment

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

why are we running again?

@jonathanlab
Copy link
Collaborator

@joshsny This PR's quite stale, do we want to keep it open?

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.

3 participants