chore: 合并 main 分支,统一 CLAUDE.md 格式规范

合并 main 分支对 CLAUDE.md 的格式改进,同时保留 feature 分支新增的标准开发工作流(第 8 节)。

主要改动:
- 更新 Godot 版本要求从 4.2+ 到 4.5+
- 规范化 Markdown 格式(代码块、粗体、列表)
- 保留新增的「Standard Development Workflow」章节
- 调整章节编号(第 9、10 节)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-06 19:41:29 +08:00

View File

@@ -2,7 +2,7 @@
## 1. Project Vision & Context ## 1. Project Vision & Context
- **Project**: "WhaleTown" - A 2D top-down pixel art RPG. - **Project**: "WhaleTown" - A 2D top-down pixel art RPG.
- **Engine**: Godot 4.2+ (Strictly NO Godot 3.x syntax). - **Engine**: Godot 4.5+ (Strictly NO Godot 3.x syntax).
- **Architecture**: Strictly layered: `_Core` (Framework), `Scenes` (Gameplay), `UI` (Interface). - **Architecture**: Strictly layered: `_Core` (Framework), `Scenes` (Gameplay), `UI` (Interface).
- **Core Principle**: "Signal Up, Call Down". High decoupling via `EventSystem`. - **Core Principle**: "Signal Up, Call Down". High decoupling via `EventSystem`.
@@ -46,28 +46,31 @@
const PLAYER_MOVED = "player_moved" const PLAYER_MOVED = "player_moved"
const INTERACT_PRESSED = "interact_pressed" const INTERACT_PRESSED = "interact_pressed"
const NPC_TALKED = "npc_talked" const NPC_TALKED = "npc_talked"
Singletons: Only GameManager, SceneManager, EventSystem allowed as Autoloads. ```
Decoupling: Low-level entities MUST NOT reference GameManager. Use events. - **Singletons**: Only GameManager, SceneManager, EventSystem allowed as Autoloads.
6. 🏗 Implementation Details - **Decoupling**: Low-level entities MUST NOT reference GameManager. Use events.
Player: CharacterBody2D. Must include Camera2D with position_smoothing_enabled = true.
NPC/Interactables: Use Area2D named InteractionArea. Trigger via EventSystem. ## 6. 🏗 Implementation Details
TileMap Layers: - **Player**: CharacterBody2D. Must include Camera2D with `position_smoothing_enabled = true`.
Layer 0: Ground (No collision). - **NPC/Interactables**: Use Area2D named InteractionArea. Trigger via EventSystem.
Layer 1: Obstacles (Physics Layer enabled). - **TileMap Layers**:
Layer 2: Decoration (Y-Sort enabled). - Layer 0: Ground (No collision).
Camera: Must auto-calculate limits via TileMap.get_used_rect(). - Layer 1: Obstacles (Physics Layer enabled).
7. 🧪 Testing Requirements (MANDATORY) - Layer 2: Decoration (Y-Sort enabled).
Coverage: Every Manager/System in _Core/ MUST have a GUT test. - **Camera**: Must auto-calculate limits via `TileMap.get_used_rect()`.
Naming: Test files must start with test_ and extend GutTest.
Example: ## 7. 🧪 Testing Requirements (MANDATORY)
code - **Coverage**: Every Manager/System in `_Core/` MUST have a GUT test.
Gdscript - **Naming**: Test files must start with `test_` and extend GutTest.
extends GutTest - **Example**:
func test_event_emission(): ```gdscript
extends GutTest
func test_event_emission():
var sender = Node.new() var sender = Node.new()
watch_signals(EventSystem) watch_signals(EventSystem)
EventSystem.emit_event(EventNames.PLAYER_MOVED, {}) EventSystem.emit_event(EventNames.PLAYER_MOVED, {})
assert_signal_emitted(EventSystem, "event_raised") assert_signal_emitted(EventSystem, "event_raised")
```
## 🔄 8. Standard Development Workflow (MANDATORY) ## 🔄 8. Standard Development Workflow (MANDATORY)
@@ -130,14 +133,14 @@ See `docs/02-开发规范/命名规范.md` for complete details.
**Remember**: Consistency through automation. Use `/whaletown-developer` to ensure no steps are missed. **Remember**: Consistency through automation. Use `/whaletown-developer` to ensure no steps are missed.
9. 🧘 The Zen of Development ## 9. 🧘 The Zen of Development
Juice or Death: Every interaction (UI popup, NPC talk) MUST have a Tween placeholder. - **Juice or Death**: Every interaction (UI popup, NPC talk) MUST have a Tween placeholder.
Zero Magic Numbers: All speeds/timers MUST be @export or defined in Config/. - **Zero Magic Numbers**: All speeds/timers MUST be `@export` or defined in `Config/`.
Simplicity: If a function does two things, split it. - **Simplicity**: If a function does two things, split it.
Back of the Fence: Hidden logic (like ResponseHandler.gd) must be as clean as the HUD. - **Back of the Fence**: Hidden logic (like ResponseHandler.gd) must be as clean as the HUD.
9. 📝 Code Template (Entity Pattern)
code ## 10. 📝 Code Template (Entity Pattern)
Gdscript ```gdscript
extends CharacterBody2D extends CharacterBody2D
class_name Player class_name Player