Skip to content

Commit Submission Guide ​

This document defines the Git commit conventions for the YaoXiang project, aiming to keep the commit history clear, readable, and easy to understand.


Table of Contents ​


Commit Format ​

Very important!!!!!! Don't forget!!! All commit messages must follow the format below:

:emoji_code: type(scope): subject (in Chinese)

[Optional body]

[Optional footer]

⚠️ Important: You must use the emoji code (e.g., :sparkles:) instead of typing the emoji character directly.

Commit messages in Chinese are recommended to maintain team communication consistency.

Components ​

PartDescriptionRequired
emoji_codeEmoji identifier for the commit type✅
typeCommit type✅
scopeArea of impact✅
subjectBrief description (in Chinese, ≤ 50 chars)✅
bodyDetailed explanation (optional)❌
footerBreaking changes or closing issues (optional)❌

Commit Types ​

emoji codetypeDescription
✨featNew feature
🐛fixBug fix
📝docsDocumentation only
💄styleCode formatting (no functional change)
♻️refactorCode refactoring
⚡perfPerformance optimization
✅testAdd or modify tests
🔧choreBuild tools, auxiliary tool changes
🏗️buildBuild system changes
🚀ciCI configuration changes

Complete Emoji Reference ​

Below is the complete emoji list consistent with the gitmoji project. Pick the appropriate emoji based on the commit content:

EmojiEmoji CodeCommit Description
🎨:art:Improve code structure/format
⚡️:zap: / :racehorse:Improve performance
🔥:fire:Remove code or files
🐛:bug:Fix a bug
🚑:ambulance:Critical hotfix
✨:sparkles:Introduce new features
📝:memo:Write documentation
🚀:rocket:Deploy stuff
💄:lipstick:Update UI and style files
🎉:tada:Initial commit
✅:white_check_mark:Add tests
🔒:lock:Fix security issues
🍎:apple:Fix macOS-specific issues
🐧:penguin:Fix Linux-specific issues
🏁:checkered_flag:Fix Windows-specific issues
🤖:robot:Fix Android-specific issues
🍏:green_apple:Fix iOS-specific issues
🔖:bookmark:Release/version tag
🚨:rotating_light:Remove linter warnings
🚧:construction:Work in progress
💚:green_heart:Fix CI build issues
⬇️:arrow_down:Downgrade dependencies
⬆️:arrow_up:Upgrade dependencies
📌:pushpin:Pin dependencies to a specific version
👷:construction_worker:Add CI build system
📈:chart_with_upwards_trend:Add analytics or tracking code
♻️:recycle:Refactor code
🔨:hammer:Major refactoring
➖:heavy_minus_sign:Remove a dependency
🐳:whale:Docker related work
➕:heavy_plus_sign:Add a dependency
🔧:wrench:Modify configuration files
🌐:globe_with_meridians:Internationalization and localization
✏️:pencil2:Fix typos
💩:hankey:Write bad code that needs improvement
⏪️:rewind:Revert changes
🔀:twisted_rightwards_arrows:Merge branches
📦:package:Update compiled files or packages
👽:alien:Update code due to external API changes
🚚:truck:Move or rename files
📄:page_facing_up:Add or update license
💥:boom:Introduce breaking changes
🍱:bento:Add or update assets
👌:ok_hand:Update code due to code review changes
♿️:wheelchair:Improve accessibility
💡:bulb:Document source code
🍻:beers:Write code under the influence
💬:speech_balloon:Update text and literals
🗃️:card_file_box:Perform database-related changes
🔊:loud_sound:Add logs
🔇:mute:Remove logs
👥:busts_in_silhouette:Add contributors
🚸:children_crossing:Improve user experience/usability
🏗️:building_construction:Make architectural changes
📱:iphone:Work on responsive design
🤡:clown_face:Mock things
🥚:egg:Add an easter egg
🙈:see_no_evil:Add or update .gitignore files
📸:camera_flash:Add or update snapshots

Scopes ​

Scopes are based on the src/ directory structure of the project. You must use one of the scopes defined below:

Top-Level Modules ​

ScopeCorresponding DirectoryDescription
frontendsrc/frontend/Frontend: lexing, parsing, type checking
middlesrc/middle/Middle layer: IR, optimization, monomorphization
backendssrc/backends/Backend: interpreter, runtime, REPL
stdsrc/std/Standard library
formattersrc/formatter/Code formatter
lspsrc/lsp/Language Server Protocol
packagesrc/package/Package manager
utilsrc/util/Utility library: diagnostics, cache, i18n

Frontend Submodules ​

ScopeCorresponding DirectoryDescription
parsersrc/frontend/core/parser/Parser
lexersrc/frontend/core/lexer/Lexer
typechecksrc/frontend/core/typecheck/Type checking
typessrc/frontend/core/types/Type system definition

Middle Layer Submodules ​

ScopeCorresponding DirectoryDescription
codegensrc/middle/passes/codegen/Code generation (bytecode)
monomorphizesrc/middle/passes/monomorphize/Monomorphization
lifetimesrc/middle/passes/lifetime/Lifetime analysis

Backend Submodules ​

ScopeCorresponding DirectoryDescription
replsrc/backends/dev/repl/REPL interactive command line
shellsrc/backends/dev/shell.rsShell command handling
runtimesrc/backends/runtime/Runtime execution engine

Documentation Scopes ​

ScopeDescription
docsGeneral documentation updates
designLanguage design specification (RFC)
planImplementation plan documents

Other Scopes ​

ScopeDescription
buildBuild system, Cargo configuration
ciCI/CD configuration (GitHub Actions)
testTesting related
releaseRelease related
metaProject meta configuration (.claude, .gitignore, etc.)

Message Conventions ​

Version Management ​

The version number is defined in the version field of Cargo.toml at the project root:

toml
[package]
version = "0.7.2"

Semantic versioning MAJOR.MINOR.PATCH is used:

Version TypeDescriptionExample
majorMajor update, incompatible API changes0.7.2 → 1.0.0
minorNew features, backward compatible0.7.2 → 0.8.0
patchBug fix, backward compatible0.7.2 → 0.7.3

⚠️ When releasing, update the Cargo.toml version number on the dev branch. After merging the PR to main, CI will automatically create the tag and Release. Do not push tags manually, otherwise CI will skip the release workflow.


CI Release Workflow ​

Releases are performed automatically by GitHub Actions (release.yml). The workflow is as follows:

1. Update the version field in Cargo.toml on the dev branch
2. cargo build to update Cargo.lock
3. Commit following the release format (see 🔖 Release Commits below)
   - The commit message must include all changes since the last release (i.e., the full content of the PR)
4. Create a PR from dev to main
5. Merge the PR to main
6. CI automatically detects:
   - Reads Cargo.toml version number → "v{version}"
   - Checks whether the tag already exists
   - Not exists → Triggers the full release workflow
   - Exists → Skips (no duplicate release)
7. CI automatically executes:
   - In parallel: cross-platform builds (Linux/Windows/macOS) + security audit + tests
   - After all pass: create tag, package artifacts, publish GitHub Release

Key Rules ​

RuleDescription
Do not push tags manuallyCI decides whether to release based on whether the tag exists; manual tags will cause CI to skip
Bump version on devThe release commit is completed on dev, then merged to main via PR
Release commit includes full changelogThe commit message must contain all changes in this release, as it is the source of the PR description
Do not merge main back to devdev will sync automatically after the PR is merged; no reverse merge is needed

Message Conventions ​

Language Conventions ​

Commit messages in Chinese are recommended to maintain team communication consistency.

  • Subject: Use Chinese, be concise and clear
  • Body: Can use Chinese for detailed explanations
  • Keep English for special technical terms if needed

Subject ​

  • Use Chinese, be concise and clear
  • Keep within 50 characters
  • No trailing period

Body ​

  • Explain why and how the changes were made
  • Each line should not exceed 72 characters
  • Use - or * for bullet points
  • Breaking changes: Start with BREAKING CHANGE:
  • Closing issues: Use Closes #123 or Fixes #456

Examples ​

✨ feat - New feature ​

:sparkles: feat(parser): Add closure syntax parsing support

Implement closure expression parsing:
- Support |args| body shorthand syntax
- Support move semantics capture
- Add closure type inference

Closes #42

🐛 fix - Bug fix ​

:bug: fix(repl): Fix completer failing on multi-line input

SessionREPL did not register the completer correctly in multi-line mode,
causing Tab completion to fail to trigger.

Fixes #128

📝 docs - Documentation update ​

:memo: docs(design): Update ownership model and type system specification

Sync the latest design changes from RFC-009 and RFC-011.

♻️ refactor - Refactoring ​

:recycle: refactor(typecheck): Separate primitive value types from Dup shallow copy semantics

Decouple value types from copy semantics in MonoType,
eliminating special cases in match branches.

⚡️ perf - Performance optimization ​

:zap: perf(types): Optimize const generic evaluation performance

Add a depth limit for recursive evaluation (default 128),
to prevent stack overflow caused by maliciously constructed type expressions.

✅ test - Tests ​

:white_check_mark: test(typecheck): Add scope VarInfo mutability tests

Coverage scenarios:
- Read-only access to immutable bindings
- Mutability tracking for mut bindings
- Cross-scope mutability propagation

🔧 chore - Miscellaneous ​

:wrench: chore(build): bump rand, hashbrown, tempfile, ron, clap

Upgrade 6 production dependencies to the latest stable versions.

🚀 ci - CI configuration ​

:rocket: ci: Fix nightly build Rust version being too low

Update RUST_TOOLCHAIN from 1.91.0 to 1.96.0,
to match the rust-version requirement in Cargo.toml.

💄 style - Formatting ​

:lipstick: style(frontend): Apply cargo fmt formatting

Unify the line-breaking style of function signatures.


🔖 Release Commits ​

When this commit is a Release, you must follow the conventions below:

Release Commit Format ​

:bookmark: V<version>: <release title>

## 📦 Version Info

**Release Date:** YYYY-MM-DD

**Version:** <old version> → <new version>

---

## ✨ New Features

### <feature module>
- :sparkles: feat(<scope>): <feature description>

---

## ♻️ Refactoring

- :recycle: refactor(<scope>): <refactoring description>

---

## 🐛 Bug Fixes

- :bug: fix(<scope>): <fix description>

---

## 🔧 Other Changes

- :wrench: chore: <change description>

---

## 📦 New Files

- `<file path>` - <file description>

---



### Release Requirements

1. **Message header**: Must use `:bookmark:` + `V<version>` format
2. **Version number**: Follow semantic versioning
3. **Content completeness**: Must include the introduction of **all commits** since the last release
4. **Categorize by type**: Organize by `feat`, `fix`, `refactor`, `chore`, etc.

### Release Example

🔖 V0.7.2: REPL Rewrite and Type System Improvements

📦 Version Info ​

Release Date: 2026-06-01

Version: 0.7.1 → 0.7.2


✨ New Features ​

  • ✨ feat(typecheck): Implement automatic inference for generic type parameters
  • ✨ feat(typecheck): Add MonoType::Generic structured generic representation
  • feat: Wire up CLI REPL commands to SessionREPL

♻️ Refactoring ​

  • ♻️ refactor(backends): Remove tui_repl module, rewrite as SessionREPL
  • ♻️ refactor(typecheck): Introduce VarInfo in scope variable storage to track mutability
  • ♻️ refactor(typecheck): Separate primitive value types from Dup shallow copy semantics

🐛 Bug Fixes ​

  • 🐛 fix(repl): Configure default REPL history, fix shell evaluate_code
  • 🐛 fix(repl): Register completer and fix multi-line input
  • 🐛 fix(repl): Remove redundant semicolon in wrap_code to preserve expression value

⚡ Performance ​

  • ⚡ perf(types): Add recursion depth limit for const generic evaluation

🔧 Other Changes ​

  • 🔧 chore(build): bump rand, hashbrown, tempfile, ron, clap, owo-colors
  • ✅ test(typecheck): Add scope VarInfo mutability tests

Reference Template ​

For the release document, please refer to the release.md template format.


1. Set the Commit Template ​

bash
# Run in the project root directory
git config commit.template .gitmessage.txt

2. Template File ​

The .gitmessage.txt file at the project root has the following format:

# emoji_code type(scope): subject (in Chinese)
#
# Body (optional)
#
# Footer (optional)
#
# Types: ✨feat, 🐛fix, 📝docs, 💄style, ♻️refactor, ⚡️perf, ✅test, 🔧chore, 🚀ci, 🔖release
# Scopes: frontend, parser, lexer, typecheck, types, middle, codegen,
#         monomorphize, lifetime, backends, repl, shell, runtime,
#         std, formatter, lsp, package, util, docs, design, plan,
#         build, ci, test, release, meta
#
# Examples:
# ✨ feat(db): Add batch delete todo feature
# 🐛 fix(provider): Fix timer background recovery issue
#
# Release format: 🔖 V1.0.0: Release title

FAQ ​

Q: How do I choose a commit type? ​

  • feat: User-visible feature changes
  • fix: Fix issues reported by users
  • docs: README, comments, etc.
  • chore: Dependency updates, configuration files
  • refactor: Code optimization without behavior changes

Q: When should I split commits? ​

  • Each commit should do one thing
  • Group related features together, separate unrelated ones
  • Follow the Atomic Commits principle

References ​


💡 Tip: Keep commits atomic and descriptions clear to make code review and history navigation more efficient!