Skip to content

docs(godot): add architecture integration and design pattern docs#184

Merged
GeWuYou merged 1 commit into
mainfrom
docs/godot-architecture-and-patterns
Apr 6, 2026
Merged

docs(godot): add architecture integration and design pattern docs#184
GeWuYou merged 1 commit into
mainfrom
docs/godot-architecture-and-patterns

Conversation

@GeWuYou

@GeWuYou GeWuYou commented Apr 6, 2026

Copy link
Copy Markdown
Owner
  • Add documentation for Godot architecture integration, including AbstractArchitecture, ArchitectureAnchor, and IGodotModule
  • Describe basic usage: architecture creation, initialization, and anchor usage
  • Provide advanced examples: module system, lifecycle hooks, and hot-reload support
  • Document ContextAware usage for accessing architecture within nodes
  • Include best practices for multi-architecture setups and common pitfalls
  • Add architecture design patterns guide (MVC, MVVM, Command, etc.)
  • Cover event-driven, DI, and service locator patterns with examples

Note:

  • Normalize line endings to LF to fix inconsistent diffs caused by CRLF/LF mismatch
  • No functional code changes

Summary by CodeRabbit

  • Documentation

    • Updated migration guide documenting the transition to explicit module registration approach.
  • Chores

    • Normalized line endings and whitespace across codebase and documentation files for consistency.

- Add documentation for Godot architecture integration, including AbstractArchitecture,
  ArchitectureAnchor, and IGodotModule
- Describe basic usage: architecture creation, initialization, and anchor usage
- Provide advanced examples: module system, lifecycle hooks, and hot-reload support
- Document ContextAware usage for accessing architecture within nodes
- Include best practices for multi-architecture setups and common pitfalls
- Add architecture design patterns guide (MVC, MVVM, Command, etc.)
- Cover event-driven, DI, and service locator patterns with examples

Note:
- Normalize line endings to LF to fix inconsistent diffs caused by CRLF/LF mismatch
- No functional code changes

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, we are unable to review this pull request

The GitHub API does not allow us to fetch diffs exceeding 20000 lines

@deepsource-io

deepsource-io Bot commented Apr 6, 2026

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in c62893d...aab0995 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
C# Apr 6, 2026 2:13a.m. Review ↗
Secrets Apr 6, 2026 2:13a.m. Review ↗

@coderabbitai

coderabbitai Bot commented Apr 6, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This PR standardizes line endings (CRLF to LF) across source files and documentation, normalizes YAML front-matter delimiters in Chinese documentation files, and updates migration guidance to reflect a shift from automatic ModuleInitializer-based registration to explicit AddArch integration.

Changes

Cohort / File(s) Summary
Source Code Files
GFramework.Core/Logging/Formatters/DefaultLogFormatter.cs, GFramework.Game.Abstractions/Internals/IsExternalInit.cs
Line-ending normalization (CRLF to LF) and whitespace adjustments; no functional logic changes.
Architecture Documentation
GFramework.Ecs.Arch/INTEGRATION_PATTERN.md, GFramework.Ecs.Arch/MIGRATION_FROM_AUTO_TO_EXPLICIT.md
Markdown formatting and line-ending normalization; migration guide updated to document shift from ModuleInitializer-based auto-registration to explicit AddArch() extension method pattern.
Chinese Core & Game Documentation
docs/zh-CN/core/*, docs/zh-CN/game/scene.md, docs/zh-CN/game/serialization.md, docs/zh-CN/game/ui.md
Line-ending normalization (CRLF to LF), YAML front-matter delimiter standardization (---- to ---), and markdown formatting consistency; content and structure preserved.
Chinese Best Practices Documentation
docs/zh-CN/best-practices/*
Line-ending normalization (CRLF to LF) and whitespace adjustments; no semantic content changes.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 Hop, hop, formatting flows,
Line endings aligned in tidy rows,
ModuleInitializer bids farewell,
AddArch() rings the new bell,
Whitespace whispers, docs pristine and neat!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'docs(godot): add architecture integration and design pattern docs' accurately summarizes the primary change: documentation additions for Godot architecture integration and design patterns.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/godot-architecture-and-patterns

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 11

🧹 Nitpick comments (3)
docs/zh-CN/core/system.md (1)

1-663: LGTM! Formatting normalization preserves technical content.

This file has been updated with consistent line endings and whitespace formatting while preserving all documentation content about the System component, its lifecycle, and usage patterns within the GFramework architecture.

Optional: Consider adding language identifiers to code blocks.

Static analysis flagged several code blocks missing language identifiers (e.g., lines 285, 351, 403, 488, 567, 615, 640). While this is a pre-existing issue not introduced by this PR, adding language tags (```csharp) would improve syntax highlighting and documentation quality in a future update.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/zh-CN/core/system.md` around lines 1 - 663, The doc contains fenced code
blocks without language identifiers; update each C# code fence (e.g., blocks
showing AbstractSystem, CombatSystem, PlayerModel, InventorySystem, BuffSystem,
QuestSystem, RewardSystem, DataLoadSystem examples and other triple-backtick
blocks) to use ```csharp so they get proper syntax highlighting—locate the
triple-backtick fences around those class/method examples and replace the
opening ``` with ```csharp consistently across the document.
docs/zh-CN/core/architecture.md (1)

1-239: LGTM! Formatting normalization completed.

This file has undergone systematic line-ending and whitespace normalization (CRLF → LF) while preserving all documentation content describing the Architecture system, lifecycle phases, and component interactions. The changes improve git diff consistency without altering any technical information.

Optional: Address static analysis warnings in future PR.

The static analysis tools flagged some pre-existing documentation quality issues (not introduced by this PR):

  • Missing language identifiers on fenced code blocks (MD040)
  • Link fragment validation warnings (MD051)

These could be addressed in a follow-up documentation improvement PR.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/zh-CN/core/architecture.md` around lines 1 - 239, The PR normalized line
endings but left markdown lint warnings (MD040, MD051); update the documentation
by adding explicit language identifiers to all fenced code blocks (e.g., replace
``` with ```text or ```csharp where appropriate in the Architecture, 类图,
构造函数初始化, 生命周期示例 blocks) and validate/fix any broken link fragments referenced in
the TOC and "相关文档" links (ensure anchors/filenames in the markdown headings and
links match exactly) so the static analyzer no longer reports MD040/MD051.
GFramework.Ecs.Arch/INTEGRATION_PATTERN.md (1)

1-177: 建议补充“项目目录与文件约定”小节。

这份集成文档已经覆盖了接入方式和迁移,但缺少目录布局/文件约定说明(例如扩展类放置位置、Architecture 实现推荐目录)。建议补齐,降低接入歧义。

Based on learnings: For integration-oriented features such as the AI-First config system, documentation MUST cover project directory layout and file conventions, required project or package wiring, minimal working usage example, and migration or compatibility notes.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@GFramework.Ecs.Arch/INTEGRATION_PATTERN.md` around lines 1 - 177, Add a new
"项目目录与文件约定" section to INTEGRATION_PATTERN.md describing recommended project
layout and file naming for integration: specify where to put DI extension
methods (e.g., the static class that hosts Services.AddArch), where to place
Architecture implementations (e.g., MyArchitecture.cs under /Architecture or
/App), options and configuration classes (e.g., ArchOptions.cs under
/Configuration or /Options), builder/factory types (e.g., ArchitectureBuilder or
ArchEcsModule.Create under /Boot or /Modules), and unit-testable wiring
(composition root location); include a minimal working example reference that
maps to the docs' symbols (Services.AddArch, MyArchitecture, ArchOptions,
ArchitectureBuilder, ArchEcsModule.Create) and a short migration/compatibility
note about moving from ModuleInitializer to these files and folders.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/zh-CN/best-practices/index.md`:
- Around line 119-147: The fenced code block showing the project tree triggers
MD040 because it lacks a language identifier; update the block delimiter from
``` to ```text to specify the language (use "text" for the ASCII tree) so the
block becomes ```text ... ```; locate the block containing the GameProject/ tree
in docs/zh-CN/best-practices/index.md and add the language identifier to the
opening fence.

In `@docs/zh-CN/core/events.md`:
- Around line 553-556: The list item "使用 `IUnRegisterList` 批量管理" has
inconsistent indentation causing MD005; update that line so its leading dash and
spacing match the other list items (same indentation as "始终注销事件监听" and
"在适当的生命周期点调用 `Cleanup()`") to ensure consistent Markdown list rendering and
linting for the best-practices list.
- Around line 580-591: The fenced ASCII architecture diagram block (the
three-backtick block labelled "Architecture (架构核心)" / "Components (组件)") is
missing a language tag; update that opening fence to use the text language
identifier (```text) so the diagram is correctly treated as plain text—locate
the fenced code block containing "Architecture (架构核心)" and change its opening
fence to ```text while leaving the block content unchanged.

In `@docs/zh-CN/core/index.md`:
- Around line 44-56: The fenced diagram/flow blocks in docs/zh-CN/core/index.md
lack a language identifier (triggering MD040); update each fenced block shown
(e.g., the UI/Controller/System/Model/Utility ASCII diagram and the other ranges
called out: 60-64, 70-79, 89-106, 110-133, 137-141, 446-466, 472-479, 483-490,
494-498) by changing ``` to ```text so the linter recognizes them as plain text;
ensure every non-code fenced block in the file uses the text language tag.
- Line 420: There are duplicate same-level H2 headings named "## 包说明"; locate
both occurrences of the header (the second instance in the section around line
420) and rename the second one to a unique title such as "## 包清单" (and update
any local anchors/links/TOC references that point to the old heading text to the
new heading text) so the headings are no longer identical.

In `@docs/zh-CN/core/pause.md`:
- Around line 24-28: Add a language identifier "text" to the fenced code block
that contains the pause-stack diagram (the block with lines "栈深度 3: [暂停原因:
"库存界面"]", "栈深度 2: [暂停原因: "对话框"]", "栈深度 1: [暂停原因: "暂停菜单"]") so the fence becomes
a ```text block; this satisfies MD040 by explicitly marking the diagram as plain
text.

In `@GFramework.Ecs.Arch/INTEGRATION_PATTERN.md`:
- Around line 46-47: The docs call a non-existent Services.AddArch(); replace
all occurrences of AddArch() with the real API UseArch<TArchitecture>() by using
the architecture instance (e.g., call architecture.UseArch() where docs show
Services.AddArch()), and update the container example similarly to call UseArch
on the architecture/container instance; reference the public extension
UseArch<TArchitecture>() defined in ArchExtensions (the extension method to use)
and update lines mentioned (46, 58, 72, 153, 169) to use that method name and
the architecture variable rather than AddArch().

In `@GFramework.Ecs.Arch/MIGRATION_FROM_AUTO_TO_EXPLICIT.md`:
- Line 256: Replace the misspelled test result token "Pas 4" with the correct
"Passed: 4" in the migration Markdown content (look for the exact string "Pas 4,
Failed: 0, Total: 4" and update it to "Passed: 4, Failed: 0, Total: 4") so the
test output line reads correctly for readers.
- Around line 7-10: The fenced code block containing the warning text "warning
CA2255: The 'ModuleInitializer' attribute is only intended to be used in
application code or advanced source generator scenarios" should be annotated
with a language to satisfy markdownlint MD040; update the fenced block in
MIGRATION_FROM_AUTO_TO_EXPLICIT.md (the block that contains that warning) to use
```text as the opening fence so the block becomes a language-specified fenced
code block.
- Line 293: The Markdown link on the line containing
"N_PATTERN.md](INTEGRATION_PATTERN.md) - 集成模式详解" is missing the opening bracket
and thus breaks rendering; fix it by restoring the link syntax and list
formatting—e.g., change the token to a proper list link like "-
[INTEGRATION_PATTERN.md](INTEGRATION_PATTERN.md) - 集成模式详解" so the link text and
target are correctly enclosed in [ ] and ( ).
- Around line 86-112: The docs show AddArch(this
IArchitectureServices/IIocContainer) but the actual API is
UseArch<TArchitecture>(this TArchitecture where TArchitecture : IArchitecture);
update the sample signatures to match UseArch<TArchitecture> or add overloads
that forward to UseArch, and ensure the created ArchOptions is passed into the
module registration by changing ArchitectureModuleRegistry.Register(() => new
ArchEcsModule(enabled: true)) to register the options:
ArchitectureModuleRegistry.Register(() => new ArchEcsModule(options, enabled:
true)); update all usage examples that currently call AddArch or that omit
options to use the correct method name and pass the configured ArchOptions to
ArchEcsModule.

---

Nitpick comments:
In `@docs/zh-CN/core/architecture.md`:
- Around line 1-239: The PR normalized line endings but left markdown lint
warnings (MD040, MD051); update the documentation by adding explicit language
identifiers to all fenced code blocks (e.g., replace ``` with ```text or
```csharp where appropriate in the Architecture, 类图, 构造函数初始化, 生命周期示例 blocks) and
validate/fix any broken link fragments referenced in the TOC and "相关文档" links
(ensure anchors/filenames in the markdown headings and links match exactly) so
the static analyzer no longer reports MD040/MD051.

In `@docs/zh-CN/core/system.md`:
- Around line 1-663: The doc contains fenced code blocks without language
identifiers; update each C# code fence (e.g., blocks showing AbstractSystem,
CombatSystem, PlayerModel, InventorySystem, BuffSystem, QuestSystem,
RewardSystem, DataLoadSystem examples and other triple-backtick blocks) to use
```csharp so they get proper syntax highlighting—locate the triple-backtick
fences around those class/method examples and replace the opening ``` with
```csharp consistently across the document.

In `@GFramework.Ecs.Arch/INTEGRATION_PATTERN.md`:
- Around line 1-177: Add a new "项目目录与文件约定" section to INTEGRATION_PATTERN.md
describing recommended project layout and file naming for integration: specify
where to put DI extension methods (e.g., the static class that hosts
Services.AddArch), where to place Architecture implementations (e.g.,
MyArchitecture.cs under /Architecture or /App), options and configuration
classes (e.g., ArchOptions.cs under /Configuration or /Options), builder/factory
types (e.g., ArchitectureBuilder or ArchEcsModule.Create under /Boot or
/Modules), and unit-testable wiring (composition root location); include a
minimal working example reference that maps to the docs' symbols
(Services.AddArch, MyArchitecture, ArchOptions, ArchitectureBuilder,
ArchEcsModule.Create) and a short migration/compatibility note about moving from
ModuleInitializer to these files and folders.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f53b5340-da52-4f51-9c3f-1707db44bddc

📥 Commits

Reviewing files that changed from the base of the PR and between c62893d and aab0995.

📒 Files selected for processing (29)
  • GFramework.Core/Logging/Formatters/DefaultLogFormatter.cs
  • GFramework.Ecs.Arch/INTEGRATION_PATTERN.md
  • GFramework.Ecs.Arch/MIGRATION_FROM_AUTO_TO_EXPLICIT.md
  • GFramework.Game.Abstractions/Internals/IsExternalInit.cs
  • docs/zh-CN/best-practices/architecture-patterns.md
  • docs/zh-CN/best-practices/index.md
  • docs/zh-CN/best-practices/performance.md
  • docs/zh-CN/core/architecture.md
  • docs/zh-CN/core/command.md
  • docs/zh-CN/core/configuration.md
  • docs/zh-CN/core/events.md
  • docs/zh-CN/core/index.md
  • docs/zh-CN/core/pause.md
  • docs/zh-CN/core/property.md
  • docs/zh-CN/core/state-machine.md
  • docs/zh-CN/core/system.md
  • docs/zh-CN/game/scene.md
  • docs/zh-CN/game/serialization.md
  • docs/zh-CN/game/ui.md
  • docs/zh-CN/getting-started/quick-start.md
  • docs/zh-CN/godot/architecture.md
  • docs/zh-CN/source-generators/context-aware-generator.md
  • docs/zh-CN/source-generators/index.md
  • docs/zh-CN/source-generators/logging-generator.md
  • docs/zh-CN/tutorials/godot-complete-project.md
  • docs/zh-CN/tutorials/pause-system.md
  • docs/zh-CN/tutorials/state-machine-tutorial.md
  • refactor-scripts/folder-mappings.json
  • refactor-scripts/refactor-namespaces.ps1

Comment on lines +119 to +147
```
GameProject/
├── Models/
│ ├── PlayerModel.cs
│ ├── GameStateModel.cs
│ └── InventoryModel.cs
├── Systems/
│ ├── CombatSystem.cs
│ ├── InventorySystem.cs
│ └── GameLogicSystem.cs
├── Commands/
│ ├── AttackCommand.cs
│ ├── MoveCommand.cs
│ └── UseItemCommand.cs
├── Queries/
│ ├── GetPlayerHealthQuery.cs
│ └── GetInventoryItemsQuery.cs
├── Events/
│ ├── PlayerDiedEvent.cs
│ ├── ItemUsedEvent.cs
│ └── EnemyDamagedEvent.cs
├── Controllers/
│ ├── PlayerController.cs
│ └── UIController.cs
├── Utilities/
│ ├── StorageUtility.cs
│ └── MathUtility.cs
└── GameArchitecture.cs
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add a language identifier to the fenced code block.

This block triggers MD040 (fenced code blocks should specify a language). Use text for the tree layout.

Suggested fix
-```
+```text
 GameProject/
 ├── Models/
 │   ├── PlayerModel.cs
 │   ├── GameStateModel.cs
 │   └── InventoryModel.cs
 ...
 └── GameArchitecture.cs
</details>

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 markdownlint-cli2 (0.22.0)</summary>

[warning] 119-119: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

</details>

</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against the current code and only fix it if needed.

In @docs/zh-CN/best-practices/index.md around lines 119 - 147, The fenced code
block showing the project tree triggers MD040 because it lacks a language
identifier; update the block delimiter from totext to specify the
language (use "text" for the ASCII tree) so the block becomes text ... ;
locate the block containing the GameProject/ tree in
docs/zh-CN/best-practices/index.md and add the language identifier to the
opening fence.


</details>

<!-- fingerprinting:phantom:triton:hawk:457f9237-4075-4e0d-ae5c-a7960c294dcb -->

<!-- This is an auto-generated comment by CodeRabbit -->

Comment thread docs/zh-CN/core/events.md
Comment on lines +553 to +556
- 始终注销事件监听
- 使用 `IUnRegisterList` 批量管理
- 在适当的生命周期点调用 `Cleanup()`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix inconsistent list indentation in best-practices list.

Line 555 uses a different indentation level than adjacent list items, which triggers MD005 and can render inconsistently across Markdown engines.

Proposed fix
-   - 在适当的生命周期点调用 `Cleanup()`
+    - 在适当的生命周期点调用 `Cleanup()`
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- 始终注销事件监听
- 使用 `IUnRegisterList` 批量管理
- 在适当的生命周期点调用 `Cleanup()`
- 始终注销事件监听
- 使用 `IUnRegisterList` 批量管理
- 在适当的生命周期点调用 `Cleanup()`
🧰 Tools
🪛 markdownlint-cli2 (0.22.0)

[warning] 555-555: Inconsistent indentation for list items at the same level
Expected: 4; Actual: 3

(MD005, list-indent)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/zh-CN/core/events.md` around lines 553 - 556, The list item "使用
`IUnRegisterList` 批量管理" has inconsistent indentation causing MD005; update that
line so its leading dash and spacing match the other list items (same
indentation as "始终注销事件监听" and "在适当的生命周期点调用 `Cleanup()`") to ensure consistent
Markdown list rendering and linting for the best-practices list.

Comment thread docs/zh-CN/core/events.md
Comment on lines +580 to +591
```
Architecture (架构核心)
├── EventBus (事件总线)
├── CommandBus (命令总线)
├── QueryBus (查询总线)
└── IocContainer (IoC容器)

Components (组件)
├── Model (发送事件)
├── System (发送/接收事件)
└── Controller (接收事件)
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add language tag to fenced architecture diagram block.

The code fence at Line 580 is missing a language identifier (MD040). Use text for ASCII diagrams.

Proposed fix
-```
+```text
 Architecture (架构核心)
 ├── EventBus (事件总线)
 ├── CommandBus (命令总线)
 ├── QueryBus (查询总线)
 └── IocContainer (IoC容器)
@@
 Components (组件)
 ├── Model (发送事件)
 ├── System (发送/接收事件)
 └── Controller (接收事件)
</details>

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 markdownlint-cli2 (0.22.0)</summary>

[warning] 580-580: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

</details>

</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against the current code and only fix it if needed.

In @docs/zh-CN/core/events.md around lines 580 - 591, The fenced ASCII
architecture diagram block (the three-backtick block labelled "Architecture
(架构核心)" / "Components (组件)") is missing a language tag; update that opening
fence to use the text language identifier (text) so the diagram is correctly treated as plain text—locate the fenced code block containing "Architecture (架构核心)" and change its opening fence to text while leaving the block content
unchanged.


</details>

<!-- fingerprinting:phantom:triton:hawk:79051d89-868e-4319-811d-5cc79536c970 -->

<!-- This is an auto-generated comment by CodeRabbit -->

Comment thread docs/zh-CN/core/index.md
Comment on lines +44 to +56
```
┌─────────────────────────────────────────┐
│ View / UI │ UI 层:用户界面
├─────────────────────────────────────────┤
│ Controller │ 控制层:连接 UI 和业务逻辑
├─────────────────────────────────────────┤
│ System │ 逻辑层:业务逻辑
├─────────────────────────────────────────┤
│ Model │ 数据层:游戏状态
├─────────────────────────────────────────┤
│ Utility │ 工具层:无状态工具
└─────────────────────────────────────────┘
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add language identifiers to fenced non-code blocks.

Several fenced blocks are missing a language tag (MD040). For diagrams/flows, text is appropriate and keeps lint clean.

Example fix pattern
-```
+```text
 初始化流程:
 None → BeforeUtilityInit → AfterUtilityInit → BeforeModelInit → AfterModelInit → BeforeSystemInit → AfterSystemInit → Ready
@@
 Any → FailedInitialization
</details>


Also applies to: 60-64, 70-79, 89-106, 110-133, 137-141, 446-466, 472-479, 483-490, 494-498

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 markdownlint-cli2 (0.22.0)</summary>

[warning] 44-44: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

</details>

</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against the current code and only fix it if needed.

In @docs/zh-CN/core/index.md around lines 44 - 56, The fenced diagram/flow
blocks in docs/zh-CN/core/index.md lack a language identifier (triggering
MD040); update each fenced block shown (e.g., the
UI/Controller/System/Model/Utility ASCII diagram and the other ranges called
out: 60-64, 70-79, 89-106, 110-133, 137-141, 446-466, 472-479, 483-490, 494-498)
by changing totext so the linter recognizes them as plain text; ensure
every non-code fenced block in the file uses the text language tag.


</details>

<!-- fingerprinting:phantom:triton:hawk:79051d89-868e-4319-811d-5cc79536c970 -->

<!-- This is an auto-generated comment by CodeRabbit -->

Comment thread docs/zh-CN/core/index.md

---

## 包说明

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Resolve duplicate H2 heading 包说明.

There are two same-level headings with identical text (## 包说明), which triggers MD024 and hurts page navigation/TOC clarity. Please rename one of them (for example, the second one to ## 包清单).

🧰 Tools
🪛 markdownlint-cli2 (0.22.0)

[warning] 420-420: Multiple headings with the same content

(MD024, no-duplicate-heading)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/zh-CN/core/index.md` at line 420, There are duplicate same-level H2
headings named "## 包说明"; locate both occurrences of the header (the second
instance in the section around line 420) and rename the second one to a unique
title such as "## 包清单" (and update any local anchors/links/TOC references that
point to the old heading text to the new heading text) so the headings are no
longer identical.

Comment on lines +46 to +47
Services.AddArch();
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify actual extension entry points and receivers in repo
set -e

echo "== Arch extension definitions =="
rg -n -C3 'static\s+.*\s+(UseArch|AddArch)\s*\(' --type=cs

echo
echo "== Calls in docs mentioning AddArch/UseArch =="
rg -n --type=md '\b(AddArch|UseArch)\s*\('

Repository: GeWuYou/GFramework

Length of output: 94


🏁 Script executed:

# Find the markdown file and examine its contents
fd -i "INTEGRATION_PATTERN.md" --type f

Repository: GeWuYou/GFramework

Length of output: 104


🏁 Script executed:

# Search for any method containing "Arch" in C# files with looser pattern
rg -n "AddArch|UseArch" --type=cs -A 2

Repository: GeWuYou/GFramework

Length of output: 2226


🏁 Script executed:

# Look for ArchExtensions file directly
fd -i "ArchExtensions" --type f

Repository: GeWuYou/GFramework

Length of output: 110


🏁 Script executed:

# Search for extension methods more broadly
rg -n "static.*\(this" --type=cs | grep -i arch

Repository: GeWuYou/GFramework

Length of output: 44


🏁 Script executed:

# Read the INTEGRATION_PATTERN.md file
cat "GFramework.Ecs.Arch/INTEGRATION_PATTERN.md"

Repository: GeWuYou/GFramework

Length of output: 2529


🏁 Script executed:

# Read ArchExtensions.cs file
cat -n "GFramework.Ecs.Arch/Extensions/ArchExtensions.cs"

Repository: GeWuYou/GFramework

Length of output: 1164


Documentation uses non-existent AddArch() method; actual API is UseArch().

The integration guide instructs users to call Services.AddArch() and container.AddArch(), but the only public extension method is UseArch<TArchitecture>() defined in ArchExtensions.cs:17, which operates on architecture instances and returns the architecture for chaining. Code following the documentation will fail to compile. Update all occurrences to use the correct method name:

  • Line 46: Change Services.AddArch(); to architecture.UseArch();
  • Line 58: Update container usage example
  • Lines 72, 153, 169: Apply same corrections
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@GFramework.Ecs.Arch/INTEGRATION_PATTERN.md` around lines 46 - 47, The docs
call a non-existent Services.AddArch(); replace all occurrences of AddArch()
with the real API UseArch<TArchitecture>() by using the architecture instance
(e.g., call architecture.UseArch() where docs show Services.AddArch()), and
update the container example similarly to call UseArch on the
architecture/container instance; reference the public extension
UseArch<TArchitecture>() defined in ArchExtensions (the extension method to use)
and update lines mentioned (46, 58, 72, 153, 169) to use that method name and
the architecture variable rather than AddArch().

Comment on lines +7 to +10
```
warning CA2255: The 'ModuleInitializer' attribute is only intended to be used
in application code or advanced source generator scenarios
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

代码块建议标注语言(MD040)。

该 fenced code block 未指定语言,建议加 text 以消除 markdownlint 警告并提升可读性。

修复建议
-```
+```text
 warning CA2255: The 'ModuleInitializer' attribute is only intended to be used
 in application code or advanced source generator scenarios
</details>

<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

```suggestion

🧰 Tools
🪛 markdownlint-cli2 (0.22.0)

[warning] 7-7: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@GFramework.Ecs.Arch/MIGRATION_FROM_AUTO_TO_EXPLICIT.md` around lines 7 - 10,
The fenced code block containing the warning text "warning CA2255: The
'ModuleInitializer' attribute is only intended to be used in application code or
advanced source generator scenarios" should be annotated with a language to
satisfy markdownlint MD040; update the fenced block in
MIGRATION_FROM_AUTO_TO_EXPLICIT.md (the block that contains that warning) to use
```text as the opening fence so the block becomes a language-specified fenced
code block.

Comment on lines +86 to +112
public static IArchitectureServices AddArch(
this IArchitectureServices services,
Action<ArchOptions>? configure = null)
{
var options = new ArchOptions();
configure?.Invoke(options);

ArchitectureModuleRegistry.Register(() => new ArchEcsModule(enabled: true));

return services;
}

/// <summary>
/// 添加 Arch ECS 支持到 IoC 容器中
/// </summary>
public static IIocContainer AddArch(
this IIocContainer container,
Action<ArchOptions>? configure = null)
{
var options = new ArchOptions();
configure?.Invoke(options);

ArchitectureModuleRegistry.Register(() => new ArchEcsModule(enabled: true));

return container;
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

find . -type f -name "*.cs" | grep -i arch | head -20

Repository: GeWuYou/GFramework

Length of output: 1487


🏁 Script executed:

git ls-files | grep -E "(Migration|Arch)" | head -20

Repository: GeWuYou/GFramework

Length of output: 1447


🏁 Script executed:

fd -e cs "ArchEcsModule|AddArch|UseArch" --type f

Repository: GeWuYou/GFramework

Length of output: 149


🏁 Script executed:

cat -n GFramework.Ecs.Arch/ArchEcsModule.cs

Repository: GeWuYou/GFramework

Length of output: 3791


🏁 Script executed:

cat -n GFramework.Ecs.Arch/MIGRATION_FROM_AUTO_TO_EXPLICIT.md | head -120

Repository: GeWuYou/GFramework

Length of output: 2998


🏁 Script executed:

rg "AddArch|UseArch" -A 10 -B 2 --type cs

Repository: GeWuYou/GFramework

Length of output: 7327


🏁 Script executed:

cat -n GFramework.Ecs.Arch/Extensions/ArchExtensions.cs

Repository: GeWuYou/GFramework

Length of output: 1164


🏁 Script executed:

cat -n GFramework.Ecs.Arch/MIGRATION_FROM_AUTO_TO_EXPLICIT.md | sed -n '86,250p'

Repository: GeWuYou/GFramework

Length of output: 3802


🏁 Script executed:

cat -n GFramework.Ecs.Arch/MIGRATION_FROM_AUTO_TO_EXPLICIT.md | sed -n '115,240p'

Repository: GeWuYou/GFramework

Length of output: 2657


迁移指南示例与实际实现不一致:API 名称错误且配置参数未传递。

需要修正两处关键问题:

  1. API 名称错误:文档显示 AddArch(IArchitectureServices/IIocContainer),但实际实现是 UseArch<TArchitecture>(this TArchitecture where TArchitecture : IArchitecture)
  2. 配置参数未传递:示例创建 ArchOptions 并调用 configure?.Invoke(options),但在注册模块时只传 enabled: true,应为 new ArchEcsModule(options, enabled: true)

这导致开发者按文档操作时会:

  • 调用不存在的 API 方法
  • 即使代码能编译,配置也无法生效
受影响的示例位置

涉及以下行:86-112 (方法定义), 132, 144-149, 180, 227, 235-239 (使用示例)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@GFramework.Ecs.Arch/MIGRATION_FROM_AUTO_TO_EXPLICIT.md` around lines 86 -
112, The docs show AddArch(this IArchitectureServices/IIocContainer) but the
actual API is UseArch<TArchitecture>(this TArchitecture where TArchitecture :
IArchitecture); update the sample signatures to match UseArch<TArchitecture> or
add overloads that forward to UseArch, and ensure the created ArchOptions is
passed into the module registration by changing
ArchitectureModuleRegistry.Register(() => new ArchEcsModule(enabled: true)) to
register the options: ArchitectureModuleRegistry.Register(() => new
ArchEcsModule(options, enabled: true)); update all usage examples that currently
call AddArch or that omit options to use the correct method name and pass the
configured ArchOptions to ArchEcsModule.


```bash
dotnet test --filter "ExplicitRegistrationTests"
# Pas 4, Failed: 0, Total: 4

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

测试结果行有拼写错误。

Pas 4 建议改为 Passed: 4,避免读者误解测试输出。

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@GFramework.Ecs.Arch/MIGRATION_FROM_AUTO_TO_EXPLICIT.md` at line 256, Replace
the misspelled test result token "Pas 4" with the correct "Passed: 4" in the
migration Markdown content (look for the exact string "Pas 4, Failed: 0, Total:
4" and update it to "Passed: 4, Failed: 0, Total: 4") so the test output line
reads correctly for readers.


### 相关文档

-N_PATTERN.md](INTEGRATION_PATTERN.md) - 集成模式详解

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Markdown 链接已损坏。

Line 293 的链接文本缺失前缀,当前渲染会异常。建议改为正常的列表链接项。

修复建议
--N_PATTERN.md](INTEGRATION_PATTERN.md) - 集成模式详解
+- [INTEGRATION_PATTERN.md](INTEGRATION_PATTERN.md) - 集成模式详解
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
-N_PATTERN.md](INTEGRATION_PATTERN.md) - 集成模式详解
- [INTEGRATION_PATTERN.md](INTEGRATION_PATTERN.md) - 集成模式详解
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@GFramework.Ecs.Arch/MIGRATION_FROM_AUTO_TO_EXPLICIT.md` at line 293, The
Markdown link on the line containing "N_PATTERN.md](INTEGRATION_PATTERN.md) -
集成模式详解" is missing the opening bracket and thus breaks rendering; fix it by
restoring the link syntax and list formatting—e.g., change the token to a proper
list link like "- [INTEGRATION_PATTERN.md](INTEGRATION_PATTERN.md) - 集成模式详解" so
the link text and target are correctly enclosed in [ ] and ( ).

@GeWuYou GeWuYou merged commit 397611d into main Apr 6, 2026
9 checks passed
@GeWuYou GeWuYou deleted the docs/godot-architecture-and-patterns branch April 6, 2026 02:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant