<task>
Generate a Git commit message based on the provided staged file changes.
</task>

<context>
The user is working in a Git repository at the following location:
<project_path>
{{ projectPath }}
</project_path>

And has staged several files for commit:
<file_changes>
{{ fileChanges }}
</file_changes>

You need to analyze these file changes by reading the actual file content from the project path,
and generate an appropriate commit message.
</context>

<working_directory>
Use this project path as your working directory: {{ projectPath }}
</working_directory>

<requirements>
  <requirement>
    Follow the Conventional Commits specification:
    https://www.conventionalcommits.org/
  </requirement>
  <requirement>
    Use one of the following types:
    - feat: A new feature
    - fix: A bug fix
    - docs: Documentation only changes
    - style: Changes that do not affect the meaning of the code
    - refactor: A code change that neither fixes a bug nor adds a feature
    - perf: A code change that improves performance
    - test: Adding missing tests or correcting existing tests
    - build: Changes that affect the build system or external dependencies
    - ci: Changes to CI configuration files and scripts
    - chore: Other changes that don't modify src or test files
    - revert: Reverts a previous commit
  </requirement>
  <requirement>
    Optional scope in parentheses after the type (e.g., feat(auth), fix(api))
  </requirement>
  <requirement>
    Subject line MUST:
    - Use imperative mood (add, not added)
    - Be 50-72 characters maximum
    - Not end with a period
    - Start with type(scope): prefix
  </requirement>
  <requirement>
    Optional body paragraphs for detailed explanation
  </requirement>
  <requirement>
    Optional footer with BREAKING CHANGE notice or metadata
  </requirement>
  <requirement>
    Do NOT include file paths in the commit message
  </requirement>
  <requirement>
    Focus on WHAT and WHY, not HOW
  </requirement>
  <requirement>
    Read the actual file content from the project path to understand the changes
  </requirement>
</requirements>

<analysis>
Analyze the file changes to understand:
1. What type of change is this? (feature, bug fix, refactor, etc.)
2. What is the primary purpose of these changes?
3. What area of the codebase is affected? (for scope)
4. Are there any breaking changes?

Use the Read tool to examine the changed files and understand their content.

**Historical Format Analysis**:
Before generating the commit message, you MUST analyze the current repository's commit history:
1. Run `git log -n 10 --pretty=format:"%s%n%b"` to see recent commit messages
2. Identify patterns: structure (single vs multi-paragraph), language (English/Chinese), common types, special formatting
3. Match the detected style when generating your commit message
4. If no history exists, use standard Conventional Commits format
</analysis>

<output_format>
CRITICAL: Return ONLY the raw commit message text. NO explanations, NO markdown formatting, NO code blocks.
Start directly with the commit message like this:

feat(scope): subject line

Optional body text.

Optional footer text.

DO NOT prefix with "Here is the commit message:" or similar text.
DO NOT wrap in markdown code blocks.
DO NOT add any commentary before or after.
</output_format>

<examples>
Good examples:
- feat(auth): add JWT token refresh mechanism
- fix(api): handle null response from user service
- refactor(user): simplify validation logic
- docs(readme): update installation instructions
- chore(deps): upgrade to React 19

Bad examples:
- Fixed a bug (too vague, no type)
- feat: added some stuff (too vague)
- Update file.ts (includes file path)
- Adding feature (not imperative mood)
</examples>

<final_instruction>
Your response must contain ONLY the commit message. No other text.
</final_instruction>
