docs(ai-reading): 完善AI代码检查规范文档

范围: docs/ai-reading/
涉及文件:
- README.md
- step7-code-commit.md

主要改进:
- 增强执行前强制性检查要求,添加明确的检查点
- 完善Step 0的执行流程和验证机制
- 强化代码提交原则,明确提交所有Git变更的规范
- 优化文档结构,提升可读性和执行指导性
- 添加更清晰的警告信息和错误示例
This commit is contained in:
moyin
2026-01-19 18:35:45 +08:00
parent cf1b37af78
commit 7cac8ad8a5
2 changed files with 186 additions and 13 deletions

View File

@@ -1,9 +1,17 @@
# AI Code Inspection Guide - Whale Town Game Server
## 🎯 Pre-execution Setup
## ⚠️ 🚨 CRITICAL: MANDATORY PRE-EXECUTION REQUIREMENTS 🚨 ⚠️
### 🚀 User Information Setup
**Before starting any inspection steps, run the user information script:**
**<EFBFBD> AI MUST READ THIS SECTION FIRST - EXECUTION WITHOUT COMPLETING THESE STEPS IS STRICTLY FORBIDDEN 🔴**
**⛔ STOP! Before executing ANY step (including Step 1), you MUST complete ALL items in this section! ⛔**
---
## 🎯 Pre-execution Setup (MANDATORY - CANNOT BE SKIPPED)
### 🚀 User Information Setup (STEP 0 - MUST EXECUTE FIRST)
**⚠️ CRITICAL: Before starting any inspection steps (including Step 1), MUST run the user information script:**
```bash
# Enter AI-reading directory
@@ -13,6 +21,13 @@ cd docs/ai-reading
node tools/setup-user-info.js
```
**🚨 VERIFICATION CHECKPOINT:**
- [ ] Have you executed `node tools/setup-user-info.js`?
- [ ] Does `docs/ai-reading/me.config.json` file exist?
- [ ] Have you read and confirmed the user's date and name from the config file?
**⛔ IF ANY CHECKBOX ABOVE IS UNCHECKED, YOU CANNOT PROCEED TO STEP 1! ⛔**
#### Script Functions
- Automatically get current date (YYYY-MM-DD format)
- Check if config file exists or date matches
@@ -43,13 +58,49 @@ const userName = config.name; // e.g.: "John"
const modifyRecord = `- ${userDate}: Code standard optimization - Clean unused imports (Modified by: ${userName})`;
```
### 🏗️ Project Characteristics
### 🏗️ Project Characteristics (MUST UNDERSTAND BEFORE STEP 1)
**⚠️ AI MUST read and understand these characteristics BEFORE executing Step 1:**
This project is a **NestJS Game Server** with the following features:
- **Dual-mode Architecture**: Supports both database and memory modes
- **Real-time Communication**: WebSocket-based real-time bidirectional communication
- **Property Testing**: Admin modules use fast-check for randomized testing
- **Layered Architecture**: Core layer (technical implementation) + Business layer (business logic)
**🚨 VERIFICATION CHECKPOINT:**
- [ ] Have you read and understood the project is a NestJS Game Server?
- [ ] Have you understood the dual-mode architecture?
- [ ] Have you understood the WebSocket real-time communication feature?
- [ ] Have you understood the property testing requirements?
- [ ] Have you understood the layered architecture?
**⛔ IF ANY CHECKBOX ABOVE IS UNCHECKED, YOU CANNOT PROCEED TO STEP 1! ⛔**
---
## 🚨 FINAL PRE-EXECUTION CHECKLIST (MUST COMPLETE BEFORE STEP 1) 🚨
**Before proceeding to Step 1, AI MUST confirm ALL of the following:**
### ✅ Mandatory Completion Checklist:
- [ ] ✅ Executed `node tools/setup-user-info.js` script
- [ ] ✅ Confirmed `me.config.json` file exists and contains valid date and name
- [ ] ✅ Read and stored user's date from config file
- [ ] ✅ Read and stored user's name from config file
- [ ] ✅ Understood this is a NestJS Game Server project
- [ ] ✅ Understood the dual-mode architecture (database + memory)
- [ ] ✅ Understood the WebSocket real-time communication feature
- [ ] ✅ Understood the property testing requirements
- [ ] ✅ Understood the layered architecture (Core + Business)
- [ ] ✅ Read and understood the execution principles below
### 🔴 CRITICAL RULE:
**IF ANY ITEM IN THE CHECKLIST ABOVE IS NOT COMPLETED, AI IS ABSOLUTELY FORBIDDEN FROM EXECUTING STEP 1 OR ANY OTHER STEPS!**
**AI MUST explicitly confirm completion of ALL checklist items before proceeding to Step 1!**
---
## 🔄 Execution Principles
### 🚨 Mid-step Start Requirements (Important)
@@ -95,9 +146,19 @@ Start Executing Specified Step
```
User Requests Code Inspection
Collect User Info (date, name)
🚨 MANDATORY: Execute node tools/setup-user-info.js
Identify Project Characteristics
🚨 MANDATORY: Verify me.config.json exists
🚨 MANDATORY: Read and Store User Info (date, name)
🚨 MANDATORY: Understand Project Characteristics
🚨 MANDATORY: Complete Pre-execution Checklist
🚨 MANDATORY: Explicitly Confirm ALL Checklist Items Completed
⛔ CHECKPOINT: Cannot proceed without completing above steps ⛔
Execute Step 1 → Provide Report → Wait for Confirmation
@@ -132,7 +193,18 @@ Execute Step 7 → Provide Report → Wait for Confirmation
## 📚 Step Execution Guide
**🚨 REMINDER: Before executing Step 1, ensure you have completed ALL items in the "FINAL PRE-EXECUTION CHECKLIST" above! 🚨**
### Step 1: Naming Convention Check
**⚠️ BEFORE STARTING STEP 1, AI MUST:**
1. ✅ Confirm `node tools/setup-user-info.js` has been executed
2. ✅ Confirm user date and name have been read from `me.config.json`
3. ✅ Confirm project characteristics have been understood
4. ✅ Explicitly state: "Pre-execution checklist completed, now starting Step 1"
**ONLY AFTER EXPLICIT CONFIRMATION CAN STEP 1 BEGIN!**
---
**Read when executing:** `step1-naming-convention.md`
**Focus on:** Folder structure flattening, game server special file types
**After completion:** Provide inspection report, wait for user confirmation
@@ -203,8 +275,9 @@ Execute Step 7 → Provide Report → Wait for Confirmation
### Step 7: Code Commit
**Read when executing:** `step7-code-commit.md`
**Focus on:** Git change verification, modification record consistency check, standardized commit process
**After completion:** Provide inspection report, wait for user confirmation
**Focus on:** Git change detection, branch management, commit message standards, merge document generation
**🚨 Important Principle:** Regardless of when or what type of changes were made, if Git detects changes, provide commit service
**After completion:** Provide commit report, generate merge document
## 📋 Unified Report Template
@@ -394,4 +467,56 @@ When issues are discovered and modifications made in any step, must follow this
---
**Before starting execution, please first run `node tools/setup-user-info.js` to set user information!**
## 🔴 FINAL WARNING 🔴
**⚠️ AI EXECUTION REQUIREMENTS SUMMARY:**
1. **STEP 0 (MANDATORY)**: Execute `node tools/setup-user-info.js`
2. **STEP 0.1 (MANDATORY)**: Verify `me.config.json` exists and read user info
3. **STEP 0.2 (MANDATORY)**: Understand project characteristics
4. **STEP 0.3 (MANDATORY)**: Complete and explicitly confirm pre-execution checklist
5. **ONLY THEN**: Begin Step 1
**🚨 VIOLATION CONSEQUENCES:**
- If AI skips Step 0 and directly executes Step 1, user MUST stop AI and require restart
- If AI does not explicitly confirm checklist completion, user MUST stop AI and require confirmation
- If AI does not read user info from config file, all subsequent steps are INVALID
**✅ CORRECT EXECUTION START:**
```
AI: "I will now begin the code inspection process.
Step 0 - Pre-execution Setup:
1. ✅ Executing user information setup script...
Command: cd docs/ai-reading && node tools/setup-user-info.js
2. ✅ Verifying me.config.json exists...
File found: docs/ai-reading/me.config.json
3. ✅ Reading user information...
User Date: 2026-01-19
User Name: [Name from config]
4. ✅ Understanding project characteristics...
- NestJS Game Server ✓
- Dual-mode Architecture ✓
- WebSocket Communication ✓
- Property Testing ✓
- Layered Architecture ✓
5. ✅ Pre-execution checklist completed!
All mandatory pre-execution requirements have been satisfied.
Now proceeding to Step 1: Naming Convention Check..."
```
**⛔ INCORRECT EXECUTION START (FORBIDDEN):**
```
AI: "I will start with Step 1: Naming Convention Check..." ❌ WRONG!
AI: "Let me check the naming conventions..." ❌ WRONG!
AI: "Starting code inspection..." ❌ WRONG!
```
---
**🎯 Remember: Step 0 is NOT optional - it is MANDATORY before ANY other step!**