Skip to content

Commit Submission Guidelines ​

This document defines the Git commit conventions for the YaoXiang project, with the goal of keeping the commit history clear, readable, and easy to understand.


Contents ​


Commit Format ​

VERY IMPORTANT!!!!!! DO NOT FORGET!!! All commit messages must follow the following format:

:emoji代码: type(scope): 主题(中文)

[可选的主体内容]

[可选的页脚]

⚠️ Important: You must use emoji codes (such as :sparkles:) rather than entering emoji characters directly.

Chinese commit messages are recommended to keep team communication consistent.

Components ​

PartDescriptionRequired
emoji codeEmoji identifier for the commit type✅
typeCommit type✅
scopeArea affected✅
subjectBrief description (in Chinese, ≤ 50 characters)✅
bodyDetailed description (optional)❌
footerBreaking changes or issue closure (optional)❌

Commit Types ​

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

Complete Emoji Reference ​

The following is the complete list of emojis consistent with the gitmoji project. Choose the appropriate emoji based on the commit content:

emojiemoji codeCommit description
🎨:art:Improve code structure/formatting
⚡️:zap: / :racehorse:Improve performance
🔥:fire:Remove code or files
🐛:bug:Fix a bug
🚑:ambulance:Critical patch
✨:sparkles:Introduce a new feature
📝:memo:Write documentation
🚀:rocket:Deploy functionality
💄:lipstick:Update the UI and style files
🎉:tada:Initial commit
✅:white_check_mark:Add tests
🔒:lock:Fix a security issue
🍎:apple:Fix content on macOS
🐧:penguin:Fix content on Linux
🏁:checkered_flag:Fix content on Windows
🤖:robot:Fix certain issues on Android
🍏:green_apple:Solve certain issues on iOS
🔖: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 a 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 a typo
💩:hankey:Write error 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 licenses
💥:boom:Introduce a breaking change
🍱:bento:Add or update assets
👌:ok_hand:Update code due to code review changes
♿️:wheelchair:Improve accessibility
💡:bulb:Document source code
🍻:beers:Write code drunkenly
💬: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 the .gitignore file
📸:camera_flash:Add or update snapshots

Commit Granularity ​

One commit = one understandable reason + one independently revertable unit.

  • Bookkeeping-only commits are prohibited: Changes with no substantive information, such as checkboxes, number/count adjustments, and typos, should be included in an adjacent feature commit or wrap-up commit rather than committed separately.
  • Substantive documentation rides with the code: Corrections to RFCs / specifications / contract descriptions are committed together with their corresponding code changes.
  • Generated artifacts ride with the code: Documentation regenerated by generators is included in the feature commit to which it belongs; documentation tables reconciled against multiple sources by the gate must be committed together with their code. Exception: The error code reference page is a build-time artifact and is not committed (see HOWTO, “Pre-commit Validation”), so commits that change diagnostic codes do not include the generated page.
  • Wrap-up documentation lands last: Task status, transcripts, and registry pointers are gathered into the final commit for that push; do not create a separate commit merely for one registry entry.
  • Each commit carries all the information: Use the body to explain what changed, why it changed, the acceptance criteria, and the measured gate figures.
  • Obtain the commit ID after pushing: pull --rebase rewrites local hashes, and commits referenced in documentation must come from the remote after the push. Therefore, the wrap-up line is written only after the implementation commits have been pushed; the wrap-up commit itself does not include an ID.

Commit Window ​

Before running hooks, pre-commit stashes all unstaged changes and restores them after the hooks finish (logs: Stashing unstaged files to … / Restored changes from …). While a commit is in progress, others reading the working tree may see the false impression that only staged files remain. During this period, measure only using the frozen SHA and do not read the working tree; after each commit, use git status to verify that the remaining changes are intact.


Scopes ​

Scopes are based on the repository directory structure, and the following defined scopes must be used:

Top-Level Modules ​

ScopeDirectoryDescription
frontendsrc/frontend/Frontend: lexing, parsing, and type checking
middlesrc/middle/Middle layer: IR, optimization, and monomorphization
backendssrc/backends/Backends: interpreter, runtime, and REPL
stdsrc/std/Standard library
formattersrc/formatter/Code formatter
lspsrc/lsp/Language Server Protocol
packagesrc/package/Package manager
utilsrc/util/Utility library: diagnostics, caching, and i18n
proofsrc/frontend/core/typecheck/proof/Proof and verification support (RFC-039 final state promoted to a top-level domain)
driversrc/driver/L1 orchestration layer: unified Driver and stage contracts (established by RFC-039 P4)

Frontend Submodules ​

ScopeDirectoryDescription
parsersrc/frontend/core/parser/Syntax parser
lexersrc/frontend/core/lexer/Lexer
typechecksrc/frontend/core/typecheck/Type checking
typessrc/frontend/core/types/Type system definitions

Middle-Layer Submodules ​

ScopeDirectoryDescription
codegensrc/middle/passes/codegen/Code generation (bytecode)
monomorphizesrc/middle/passes/mono/Monomorphization processing (directory rename follows the RFC-039 P6 ruling)
lifetimesrc/middle/passes/lifetime/Lifetime analysis

Backend Submodules ​

ScopeDirectoryDescription
replsrc/repl/Interactive REPL command line
runtimesrc/backends/runtime/Runtime execution engine

Documentation Scopes ​

ScopeDescription
docsGeneral documentation updates
designLanguage design specification (docs/src/dev/design/)
planImplementation plan documents
rfcRFC documents (docs/src/rfc/)

Other Scopes ​

ScopeDescription
buildBuild system and Cargo configuration
ciCI/CD configuration (GitHub Actions)
testTest-related changes
releaseRelease-related changes
metaProject meta-configuration (.claude, .gitignore, etc.)
depsDependency upgrades (same naming convention as dependabot)
examplesExamples directory examples/
vscodeVS Code extension vscode-extension/
benchesBenchmarks benches/

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 with incompatible API changes0.7.2 → 1.0.0
minorNew feature with backward compatibility0.7.2 → 0.8.0
patchBackward-compatible bug fix0.7.2 → 0.7.3

⚠️ When releasing, update the Cargo.toml version number on the dev branch and merge it into main through a PR; CI will then automatically create the tag and Release. Do not push the tag manually, otherwise CI will skip the release process.


CI Release Workflow ​

Releases are automatically completed by GitHub Actions (dist-release.yml) as follows:

1. 在 dev 分支上更新 Cargo.toml 的 version 字段
2. cargo build 更新 Cargo.lock
3. 按发版格式 commit(见下方 🔖 发版提交)
   - commit message 必须包含自上次发版以来的所有变更(即 PR 的完整内容)
4. 从 dev 创建 PR 到 main
5. 合并 PR 到 main
6. gate job 自动检测:
   - 读取 Cargo.toml 版本号 → "v{version}"
   - 检查该 tag 是否已存在
   - 不存在 → 触发完整 release 流程
   - 已存在 → 跳过(不会重复发布)
7. 门禁:安全审计 + fmt/clippy/单测/doc test 全过
8. 全过之后:创建并推送 tag
9. tag 后构建与发布:
   - cargo-dist 跨平台构建(Linux/Windows/macOS 五平台)+ 重组包(bin/ + lib/)+ wasm + Inno 向导
   - 发布 GitHub Release(body 由 generate-commit-list.ts 生成);apt 仓库另发 GitHub Pages

Key Rules ​

RuleDescription
Do not push tags manuallyReleases rely only on the gate check after pushing main; manually pushed tags do not trigger a release (to republish, use workflow_dispatch in dist-release.yml and specify a tag)
Bump the version on devRelease commits are completed on dev and merged into main through a PR
Release commits include the complete changelogThe commit message must contain all changes in the release because it is the source of the PR description
Do not merge main back into devDev is synchronized automatically after the PR is merged; no reverse merge is required

Message Conventions ​

Language Guidelines ​

Chinese commit messages are recommended to keep team communication consistent.

  • Use Chinese for the subject, keeping it concise and clear
  • The body may provide detailed explanations in Chinese
  • Special technical terms may remain in English

Subject (Topic) ​

  • Use Chinese, keeping it concise and clear
  • No more than 50 characters
  • Do not end with a period

Body (Details) ​

  • Explain in detail why and how the change was made
  • No more than 72 characters per line
  • Use - or * to list key points
  • Breaking changes: Start with BREAKING CHANGE:
  • Close an issue: Use 关闭 #123 or 修复 #456

Examples ​

✨ feat - New Features ​

:sparkles: feat(parser): 添加闭包语法解析支持

实现闭包表达式解析:
- 支持 |args| body 简写语法
- 支持 move 语义捕获
- 添加闭包类型推断

关闭 #42

🐛 fix - Bug Fixes ​

:bug: fix(repl): 修复多行输入时补全器失效的问题

SessionREPL 在多行模式下未正确注册补全器,
导致 Tab 补全无法触发。

修复 #128

📝 docs - Documentation Updates ​

:memo: docs(design): 更新所有权模型与类型系统规范

同步 RFC-009 和 RFC-011 的最新设计变更。

♻️ refactor - Refactoring ​

:recycle: refactor(typecheck): 分离原语值类型与 Dup 浅拷贝语义

将 MonoType 中的值类型和拷贝语义解耦,
消除 match 分支中的特殊情况。

⚡️ perf - Performance Optimization ​

:zap: perf(types): 优化 const generic 求值性能

为递归求值添加深度限制(默认 128),
避免恶意构造的类型表达式导致栈溢出。

✅ test - Tests ​

:white_check_mark: test(typecheck): 补充 scope VarInfo 可变性测试

覆盖场景:
- 不可变绑定的只读访问
- mut 绑定的可变性追踪
- 跨作用域的可变性传播

🔧 chore - Miscellaneous ​

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

升级 6 个生产依赖至最新稳定版本。

🚀 ci - CI Configuration ​

:rocket: ci: 修复 nightly 构建 Rust 版本过低的问题

将 RUST_TOOLCHAIN 从 1.91.0 更新至 1.96.0,
匹配 Cargo.toml 中的 rust-version 要求。

💄 style - Formatting Changes ​

:lipstick: style(frontend): 应用 cargo fmt 格式化

统一函数签名的换行风格。


🔖 Release Commit ​

When the current commit is a release, the following conventions must be followed:

Release Commit Format ​

:bookmark: V<版本号>: <发版标题>

## 📦 版本信息

**发布日期:** YYYY-MM-DD

**版本号:** <旧版本> → <新版本>

---

## ✨ 新功能

### <功能模块>
- :sparkles: feat(<scope>): <功能描述>

---

## ♻️ 重构优化

- :recycle: refactor(<scope>): <重构描述>

---

## 🐛 Bug 修复

- :bug: fix(<scope>): <修复描述>

---

## 🔧 其他变更

- :wrench: chore: <变更描述>

---

## 📦 新增文件

- `<文件路径>` - <文件说明>

Release Requirements ​

  1. Message header: Must use the :bookmark: + V<version number> format
  2. Version number: Must follow semantic versioning
  3. Content completeness: Must include a description of the contents of every commit since the previous release
  4. Categorization by type: Organize the content by types such as feat, fix, refactor, and chore

Release Example ​


:bookmark: V0.7.2: REPL 重写与类型系统改进

## 📦 版本信息

**发布日期:** 2026-06-01

**版本号:** 0.7.1 → 0.7.2

---

## ✨ 新功能

- :sparkles: feat(typecheck): 实现泛型类型参数自动推断
- :sparkles: feat(typecheck): 添加 MonoType::Generic 结构化泛型表示
- feat: 接入 CLI REPL 命令到 SessionREPL

---

## ♻️ 重构优化

- :recycle: refactor(backends): 移除 tui_repl 模块,重写为 SessionREPL
- :recycle: refactor(typecheck): scope 变量存储引入 VarInfo 追踪可变性
- :recycle: refactor(typecheck): 分离原语值类型与 Dup 浅拷贝语义

---

## 🐛 Bug 修复

- :bug: fix(repl): 配置默认 REPL 历史记录,修复 shell evaluate_code
- :bug: fix(repl): 注册补全器并修复多行输入
- :bug: fix(repl): 移除 wrap_code 中多余的分号以保留表达式值

---

## ⚡ 性能优化

- :zap: perf(types): 为 const generic 求值添加递归深度限制

---

## 🔧 其他变更

- :wrench: chore(build): bump rand, hashbrown, tempfile, ron, clap, owo-colors
- :white_check_mark: test(typecheck): 补充 scope VarInfo 可变性测试

Reference Template ​

Refer to the release.md template format when writing release documentation.


1. Setting Up the Commit Template ​

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

2. Template File ​

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

# emoji code type(scope): subject (Chinese)
#
# Body content (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, runtime, proof,
#         std, formatter, lsp, package, util, docs, design, plan, rfc,
#         build, ci, test, release, meta, deps, examples, vscode, benches
#
# Example:
# ✨ feat(db): Add bulk deletion of to-do items
# 🐛 fix(provider): Fix timer resumption in the background
#
# Release format: 🔖 V1.0.0: Release title

FAQ ​

Q: How Should I Choose a Commit Type? ​

  • feat: User-visible feature changes
  • fix: Fixes issues reported by users
  • docs: README files, comments, and other documentation
  • chore: Dependency updates and configuration files
  • refactor: Code optimizations that do not change behavior

Q: When Should I Split a Commit? ​

  • Each commit should do only one thing
  • Commit related functionality together and separate unrelated changes
  • Follow the Atomic Commits principle

References ​


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