Skip to content

Conversation

@KMSorSMS
Copy link
Collaborator

No description provided.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @KMSorSMS, 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 improves the developer experience by introducing detailed contribution guidelines and making the Git pre-commit hooks more robust and compatible with a monorepo setup. It also includes general code formatting improvements across various Python scripts and a minor dependency adjustment in the MOE kernel, alongside a small cleanup in the main README documentation.

Highlights

  • Enhanced Contribution Guidelines: A new CONTRIBUTING.md file has been added, providing comprehensive guidelines for developers. This includes instructions for setting up Git hooks, using code formatting tools like clang-format and black, and adhering to Conventional Commits, with content available in both English and Chinese.
  • Monorepo-Aware Git Hooks: The Git pre-commit hook and its CMake installation logic have been updated to correctly function within a monorepo structure. This ensures that code formatting and commit message checks are applied specifically to the kt-kernel subdirectory, respecting the top-level Git repository.
  • Code Formatting and Cleanup: Several Python scripts (convert_cpu_weights.py, convert_gpu_weights.py, convert_kimi_k2_fp8_to_bf16_cpu.py, convert_moe_to_bf16.py) received minor formatting adjustments, including whitespace changes, string literal consistency, and improved readability. A C++ include reordering was also performed in shared_mem_buffer.cpp.
  • MOE Kernel Dependency Update: The moe-tp.hpp and moe_kernel/moe.hpp files now explicitly include ../cpu_backend/shared_mem_buffer.h, indicating a clarified dependency or usage of shared memory buffer utilities within the Mixture-of-Experts (MOE) operations.
  • Documentation Refinement: The README.md file has been updated to remove the 'GitHub Discussions' link from both the main navigation and the 'Community & Support' section, streamlining the project's primary documentation.
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.

@KMSorSMS KMSorSMS closed this Nov 15, 2025
Copy link
Contributor

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

Code Review

This pull request primarily focuses on adapting the repository for a monorepo structure by updating documentation, build scripts, and Git hooks. A new CONTRIBUTING.md file has been added, and various scripts have been refactored to be aware of the new directory layout. The changes are generally well-implemented and improve the developer workflow. However, I've identified a high-severity issue in the pre-commit hook that could cause it to fail for developers with spaces in their repository path. A code suggestion to fix this has been provided.

Comment on lines +44 to 55
BLACK_PATHS=""
if [ -d "$KERNEL_DIR/python" ]; then
BLACK_PATHS="$BLACK_PATHS $KERNEL_DIR/python"
fi
if [ -d "$KERNEL_DIR/scripts" ]; then
BLACK_PATHS="$BLACK_PATHS $KERNEL_DIR/scripts"
fi
if [ -n "$BLACK_PATHS" ]; then
echo "[pre-commit] running black on:$BLACK_PATHS" >&2
# shellcheck disable=SC2086
$BLACK_BIN $BLACK_PATHS
fi
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The current method of constructing BLACK_PATHS as a space-separated string is not robust and will fail if the repository path contains spaces. The shell will perform word splitting on the unquoted $BLACK_PATHS variable, passing incorrect paths to black. Using a bash array to store the paths and then expanding it with "${BLACK_PATHS[@]}" ensures that each path is passed as a single, correctly quoted argument, making the script reliable for all users regardless of their directory structure.

Suggested change
BLACK_PATHS=""
if [ -d "$KERNEL_DIR/python" ]; then
BLACK_PATHS="$BLACK_PATHS $KERNEL_DIR/python"
fi
if [ -d "$KERNEL_DIR/scripts" ]; then
BLACK_PATHS="$BLACK_PATHS $KERNEL_DIR/scripts"
fi
if [ -n "$BLACK_PATHS" ]; then
echo "[pre-commit] running black on:$BLACK_PATHS" >&2
# shellcheck disable=SC2086
$BLACK_BIN $BLACK_PATHS
fi
declare -a BLACK_PATHS=()
if [ -d "$KERNEL_DIR/python" ]; then
BLACK_PATHS+=("$KERNEL_DIR/python")
fi
if [ -d "$KERNEL_DIR/scripts" ]; then
BLACK_PATHS+=("$KERNEL_DIR/scripts")
fi
if [ ${#BLACK_PATHS[@]} -gt 0 ]; then
echo "[pre-commit] running black on: ${BLACK_PATHS[*]}" >&2
"$BLACK_BIN" "${BLACK_PATHS[@]}"
fi

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.

1 participant