Skip to content

refactor: 移除 Mediator 兼容性 API 并重组源生成器项目结构#235

Merged
GeWuYou merged 8 commits into
mainfrom
refactor/cqrs-and-config-system
Apr 16, 2026
Merged

refactor: 移除 Mediator 兼容性 API 并重组源生成器项目结构#235
GeWuYou merged 8 commits into
mainfrom
refactor/cqrs-and-config-system

Conversation

@GeWuYou
Copy link
Copy Markdown
Owner

@GeWuYou GeWuYou commented Apr 16, 2026

  • 新增 CQRS 核心概念、命令查询处理器实现指南
  • 添加 CQRS 高级用法包括通知发布、管道行为和流式处理
  • 提供 CQRS 最佳实践和常见问题解决方案
  • 添加游戏配置系统完整接入模板和运行时读取示例
  • 包含 YAML 配置文件和 JSON Schema 结构定义说明
  • 提供 Godot 引擎配置桥接和热重载功能使用指南
  • 添加架构模块集成和生成查询辅助功能文档

Summary by CodeRabbit

发布说明

  • Refactor

    • 移除已废弃的 Mediator 兼容性 API,统一使用 Cqrs 注册入口;重构并拆分源码生成器项目与解决方案结构。
  • New Features

    • 新增用于注入系统集合的 GetSystems 特性;新增枚举扩展生成器以生成 Is 方法 / IsIn 支持。
  • Documentation

    • 更新 CQRS 指南、安装与示例,反映注册 API 变更与生成器包拆分。
  • Tests

    • 移除或调整与已废弃兼容性 API 相关的测试用例,更新生成器快照测试。
  • Chores

    • 规范命名空间、清理未用引用、添加行尾新行、调整项目引用与 MSBuild targets。

- 新增 CQRS 核心概念、命令查询处理器实现指南
- 添加 CQRS 高级用法包括通知发布、管道行为和流式处理
- 提供 CQRS 最佳实践和常见问题解决方案
- 添加游戏配置系统完整接入模板和运行时读取示例
- 包含 YAML 配置文件和 JSON Schema 结构定义说明
- 提供 Godot 引擎配置桥接和热重载功能使用指南
- 添加架构模块集成和生成查询辅助功能文档
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 16, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

移除旧的 Mediator 兼容别名与兼容扩展,统一以 Cqrs 命名入口;将源码生成器拆分为 Core/Cqrs/Game(及对应 Abstractions)并批量迁移命名空间;增强 Cqrs 处理器注册器生成器以支持外部程序集精确运行时类型查找;同步更新测试、项目文件与文档。(≤50字)

Changes

Cohort / File(s) Summary
Mediator 兼容性 API 移除
GFramework.Core.Abstractions/.../IArchitecture.cs, GFramework.Core.Abstractions/Ioc/IIocContainer.cs, GFramework.Core/Architectures/.../Architecture.cs, GFramework.Core/Architectures/.../ArchitectureModules.cs, GFramework.Core/Ioc/MicrosoftDiContainer.cs
移除过时的 RegisterMediatorBehavior<TBehavior>() 接口与实现别名(含 [Obsolete]/[EditorBrowsable]),仅保留 RegisterCqrsPipelineBehavior<TBehavior>()
兼容扩展/协程 类型移除
GFramework.Core/Extensions/.../ContextAwareMediator*.cs, GFramework.Core/Coroutine/Extensions/MediatorCoroutineExtensions.cs
删除一组只做转发的过时 Mediator 兼容扩展类/方法(同步/异步请求、查询、发布、协程等)。
源码生成器项目拆分与引用更新
GFramework.Core.SourceGenerators/..., GFramework.Cqrs.SourceGenerators/..., GFramework.Game.SourceGenerators/..., GFramework.Core.SourceGenerators.Abstractions/..., GFramework.sln, 多个 *.csproj
将原聚合 SourceGenerators 拆分为 Core/Cqrs/Game/Abstractions,新增/修改 csproj、targets、GlobalUsings 与解决方案引用并调整打包映射。
命名空间重定位与清理
GFramework.Core.SourceGenerators.Abstractions/..., GFramework.Core.SourceGenerators/..., GFramework.Game.SourceGenerators/..., 多个 GFramework.SourceGenerators.* 源文件
批量将 GFramework.SourceGenerators.* 前缀改为 GFramework.Core.SourceGenerators.*(或 Game/Cqrs 对应前缀),移除未使用 using,统一文件尾换行,影响类型的完全限定名。
CQRS 生成器运行时查找增强
GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs, GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
为外部程序集类型新增精确反射查找支持(新增 ReflectionAssemblyName 字段、外部查找工厂、按需生成 ResolveReferencedAssemblyType/ResolveReferencedAssembly 辅助方法),并据此调整生成逻辑与测试期望。
生成器新增功能(EnumExtensions)与快照
GFramework.Core.SourceGenerators/Enums/EnumExtensionsGenerator.cs, GFramework.SourceGenerators.Tests/Enums/snapshots/...
新增枚举扩展源生成器,依据属性参数生成 IsX/IsIn 辅助方法并添加相关测试快照。
测试与测试项目调整
GFramework.Core.Tests/..., GFramework.SourceGenerators.Tests/..., GFramework.Game.Tests/..., 若干 *.csproj
删除/修改依赖已移除兼容 API 的测试(移除兼容性断言/测试),更新生成器快照与 analyzer 引用,调整测试项目的 Analyzer ProjectReference。
Targets 与 打包映射修改
GFramework.Core.SourceGenerators/GeWuYou.GFramework.Core.SourceGenerators.targets, GFramework.Game.SourceGenerators/GeWuYou.GFramework.Game.SourceGenerators.targets, 若干 csproj
新增/修改 MSBuild targets 注册新的 analyzer DLL、调整包内 analyzer/lib/build 的位置与可见性。
文档与发行说明更新
CLAUDE.md, docs/zh-CN/core/cqrs.md, docs/zh-CN/..., README.md, AnalyzerReleases.*.md
删除/更新关于 Mediator 兼容性的文档,改写安装与包示例以反映拆分后的生成器包,并新增/调整 analyzer 发布说明文件。

Sequence Diagram(s)

sequenceDiagram
    actor Build
    participant Generator as CqrsHandlerRegistryGenerator
    participant Generated as GeneratedRegistryCode
    participant Runtime
    participant Assembly as ReferencedAssembly

    Build->>Generator: 编译时运行,分析处理器符号并识别外部程序集类型引用
    Generator->>Generated: 生成注册代码(含 ResolveReferencedAssembly/ResolveReferencedAssemblyType 辅助方法)
    Generated->>Runtime: 在应用中编译并加载注册代码
    Runtime->>Assembly: ResolveReferencedAssembly(assemblyName)
    Assembly-->>Runtime: 返回 Assembly
    Runtime->>Assembly: GetType(typeMetadataName)
    Assembly-->>Runtime: 返回 Type
    Runtime->>Runtime: DI 容器注册解析到的 Handler 类型(AddTransient / 注册闭合类型)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 分钟

Possibly related PRs

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 45.98% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR标题准确反映了本次变更的核心内容:移除Mediator兼容性API并重组源生成器项目结构,与raw_summary中的主要变更内容相符。

✏️ 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 refactor/cqrs-and-config-system

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

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
docs/zh-CN/game/config-system.md (1)

156-184: ⚠️ Potential issue | 🟠 Major

NuGet 包名引用错误:文档提到的 GeWuYou.GFramework.SourceGenerators 包不存在。

仓库内项目引用的拆分方案(第 156-178 行)是正确的,但 NuGet 迁移指引(第 182-183 行)引用了不存在的聚合包名。实际的源码生成器包已按模块拆分:

  • GeWuYou.GFramework.Core.SourceGenerators
  • GeWuYou.GFramework.Game.SourceGenerators

第 183 行应说明开发者需要根据场景引用具体的拆分包,而非一个不存在的聚合包。此错误也出现在 docs/zh-CN/getting-started/installation.mddocs/zh-CN/source-generators/index.md 等多个文档中,需统一更正。

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

In `@docs/zh-CN/game/config-system.md` around lines 156 - 184, Replace the
incorrect aggregated NuGet package reference
"GeWuYou.GFramework.SourceGenerators" with the actual split packages
"GeWuYou.GFramework.Core.SourceGenerators" and
"GeWuYou.GFramework.Game.SourceGenerators" in the docs: update the sentence in
docs/zh-CN/game/config-system.md (and the same wording in
docs/zh-CN/getting-started/installation.md and
docs/zh-CN/source-generators/index.md) to instruct consumers to reference the
runtime package GeWuYou.GFramework.Game and, depending on scenario, one or both
generator packages GeWuYou.GFramework.Core.SourceGenerators and
GeWuYou.GFramework.Game.SourceGenerators (and clarify that schema files remain
in schemas/); ensure the text no longer mentions the non-existent aggregated
package name.
🧹 Nitpick comments (4)
GFramework.Core.SourceGenerators.Abstractions/Rule/GetSystemsAttribute.cs (1)

3-8: 可选:增强 XML 文档说明。

当前文档已满足基本要求,但可考虑添加更多上下文信息以提升可用性:

  • 说明"系统"在架构模式中的具体含义(如 ISystem 组件)
  • 解释源生成器如何处理此特性
  • 提供简单的使用示例
  • 说明与 IArchitecture 的集成方式
📝 可选的文档增强示例
 /// <summary>
-///     标记字段需要自动注入系统集合。
+///     标记字段需要自动注入系统集合。源生成器将自动生成代码,从架构上下文中获取所有已注册的 ISystem 实例并注入到该字段。
+/// </summary>
+/// <remarks>
+///     此特性用于在具有架构上下文的组件中自动获取系统集合,避免手动调用 GetSystems() 的重复代码。
+///     被标记的字段类型应为 <c>IEnumerable&lt;ISystem&gt;</c> 或兼容类型。
+/// </remarks>
+/// <example>
+/// <code>
+/// public partial class MyComponent : IContextAware
+/// {
+///     [GetSystems]
+///     private IEnumerable&lt;ISystem&gt; _systems;
+/// }
+/// </code>
+/// </example>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@GFramework.Core.SourceGenerators.Abstractions/Rule/GetSystemsAttribute.cs`
around lines 3 - 8, Update the XML doc comment on the GetSystemsAttribute class
to provide richer context: clarify what "systems" refers to (e.g.,
implementations of ISystem or system components), describe how the source
generator consumes this attribute to inject a collection of systems, show a
minimal usage example of annotating a field with [GetSystems] and the expected
injected member shape, and note how this integrates with IArchitecture (e.g.,
resolution or registration expectations); keep the existing AttributeUsage note
and ensure the summary & remarks are concise and actionable for consumers.
GFramework.Cqrs.SourceGenerators/GFramework.Cqrs.SourceGenerators.csproj (1)

8-8: 建议审视 source generator 项目的 LangVersion 策略。

当前 GFramework.Cqrs.SourceGenerators 使用 latest,与仓库主库/抽象层使用 preview 的惯例不一致。注意到所有 source generator 项目(GFramework.Core.SourceGeneratorsGFramework.Game.SourceGeneratorsGFramework.Godot.SourceGenerators)均采用 latest,可能系有意设计。若此配置为例外场景(source generators 需要最新语言特性),建议在项目文档或 PR 说明中明确说明理由;否则,建议统一为 preview 以保持一致性。

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

In `@GFramework.Cqrs.SourceGenerators/GFramework.Cqrs.SourceGenerators.csproj` at
line 8, The project GFramework.Cqrs.SourceGenerators has LangVersion set to
"latest" which diverges from the repository convention of using "preview" for
generator and core projects; either change the <LangVersion> element in
GFramework.Cqrs.SourceGenerators.csproj from latest to preview to match the
other source-generator projects (GFramework.Core.SourceGenerators,
GFramework.Game.SourceGenerators, GFramework.Godot.SourceGenerators), or if
"latest" is required for specific C# features, add a brief note in the project
README or the PR description explaining why this project needs "latest" and
documenting the intentional deviation.
GFramework.Game.SourceGenerators/GFramework.Game.SourceGenerators.csproj (1)

3-13: 建议添加 GenerateDocumentationFile 属性。

根据代码规范,shipped libraries 应启用 GenerateDocumentationFile。虽然这是 Roslyn 分析器项目(IncludeBuildOutput=false),但如果 Common.dll 会被打包到 lib/netstandard2.0(如 lines 49-52 所示),建议考虑生成 XML 文档以便消费者获得 IntelliSense 支持。

As per coding guidelines: "Follow the repository defaults with GenerateDocumentationFile enabled for shipped libraries."

💡 建议的修改
     <PropertyGroup>
         <PackageId>GeWuYou.$(AssemblyName)</PackageId>
         <TargetFramework>netstandard2.0</TargetFramework>
         <IsRoslynAnalyzer>true</IsRoslynAnalyzer>
         <IncludeBuildOutput>false</IncludeBuildOutput>
         <LangVersion>latest</LangVersion>
         <Nullable>enable</Nullable>
+        <GenerateDocumentationFile>true</GenerateDocumentationFile>
         <EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
         <CompilerGeneratedFilesOutputPath>Generated</CompilerGeneratedFilesOutputPath>
         <EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
     </PropertyGroup>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@GFramework.Game.SourceGenerators/GFramework.Game.SourceGenerators.csproj`
around lines 3 - 13, Add the GenerateDocumentationFile property to the existing
<PropertyGroup> so XML docs are emitted for this shipped library; specifically,
in the GFramework.Game.SourceGenerators project’s PropertyGroup (where
TargetFramework, IsRoslynAnalyzer, IncludeBuildOutput, etc. are defined) add
GenerateDocumentationFile set to true (and optionally set DocumentationFile to a
sensible path if you want a custom location) so consumers get IntelliSense
documentation when the package includes lib/netstandard2.0.
GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs (1)

926-955: 这条回归最好也固定成整段快照。

现在只校验几个关键字符串,helper 体、控制流和注册顺序的回退仍可能漏过去。既然这次改的是生成代码形状,建议像本文件多数用例一样,把完整输出或至少相关 helper 片段固化成精确断言。

As per coding guidelines: When generator behavior changes intentionally, update snapshots together with the implementation,并且要 Preserve snapshot-based verification patterns already used in the repository for source generator tests

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

In `@GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs`
around lines 926 - 955, Replace the current sparse string checks in
CqrsHandlerRegistryGeneratorTests that only assert fragments of generatedSource
with a full snapshot assertion for generatedSource (or at minimum the complete
helper block) so the test fails on any shape/control-flow/ordering regressions;
locate the test method referencing generatedSource and the symbols
ResolveReferencedAssemblyType, ResolveReferencedAssembly,
RegisterRemainingReflectedHandlerInterfaces, knownServiceTypes0 and change the
Assert.Multiple block to assert generatedSource equals the stored expected
snapshot (or embed the full helper snippet as a single exact-string assertion)
and update the stored snapshot text to match the intentional generator output.
🤖 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/core/cqrs.md`:
- Around line 249-250: Add an explicit migration note mapping the removed alias
to the new API: state that the old RegisterMediatorBehavior<TBehavior>() call
should be replaced with RegisterCqrsPipelineBehavior<TBehavior>() (i.e.,
"RegisterMediatorBehavior<TBehavior>() ->
RegisterCqrsPipelineBehavior<TBehavior>()") so upgrade guides and
docs/zh-CN/core/cqrs.md include a clear, copy-pastable replacement for users
updating their code; mention both generic forms to cover existing usages of the
old method name.

In `@GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs`:
- Around line 349-351: The generated code currently records only the simple
assembly name via namedType.ContainingAssembly.Identity.Name when calling
RuntimeTypeReferenceSpec.FromExternalReflectionLookup, which later leads the
runtime lookup code (AppDomain.CurrentDomain.GetAssemblies()/Assembly.Load(new
AssemblyName(assemblyName))) to bind ambiguously; change the stored assembly
identity to the full assembly identity (e.g., AssemblyName.FullName / the
assembly's full identity string) wherever FromExternalReflectionLookup is called
(references at RuntimeTypeReferenceSpec.FromExternalReflectionLookup, the usages
around the namedType.ContainingAssembly.Identity.Name sites and the runtime
lookup logic that uses Assembly.Load(new AssemblyName(assemblyName))). Ensure
the runtime resolution code expects and uses the full identity string (so it
constructs AssemblyName from the full name) to guarantee precise binding across
ALCs and versions.

In `@GFramework.csproj`:
- Around line 32-42: The Link metadata contains a misspelling
"GFramework.SorceGenerators" — update each Link value to the correct
"GFramework.Core.SourceGenerators\..." for the entries referencing
logging\README.md, README.md, AnalyzerReleases.Shipped.md, and
AnalyzerReleases.Unshipped.md so the <None
Update="GFramework.Core.SourceGenerators\..."> elements and their <Link>
children match exactly (fix the Link strings used in those <None> elements).

---

Outside diff comments:
In `@docs/zh-CN/game/config-system.md`:
- Around line 156-184: Replace the incorrect aggregated NuGet package reference
"GeWuYou.GFramework.SourceGenerators" with the actual split packages
"GeWuYou.GFramework.Core.SourceGenerators" and
"GeWuYou.GFramework.Game.SourceGenerators" in the docs: update the sentence in
docs/zh-CN/game/config-system.md (and the same wording in
docs/zh-CN/getting-started/installation.md and
docs/zh-CN/source-generators/index.md) to instruct consumers to reference the
runtime package GeWuYou.GFramework.Game and, depending on scenario, one or both
generator packages GeWuYou.GFramework.Core.SourceGenerators and
GeWuYou.GFramework.Game.SourceGenerators (and clarify that schema files remain
in schemas/); ensure the text no longer mentions the non-existent aggregated
package name.

---

Nitpick comments:
In `@GFramework.Core.SourceGenerators.Abstractions/Rule/GetSystemsAttribute.cs`:
- Around line 3-8: Update the XML doc comment on the GetSystemsAttribute class
to provide richer context: clarify what "systems" refers to (e.g.,
implementations of ISystem or system components), describe how the source
generator consumes this attribute to inject a collection of systems, show a
minimal usage example of annotating a field with [GetSystems] and the expected
injected member shape, and note how this integrates with IArchitecture (e.g.,
resolution or registration expectations); keep the existing AttributeUsage note
and ensure the summary & remarks are concise and actionable for consumers.

In `@GFramework.Cqrs.SourceGenerators/GFramework.Cqrs.SourceGenerators.csproj`:
- Line 8: The project GFramework.Cqrs.SourceGenerators has LangVersion set to
"latest" which diverges from the repository convention of using "preview" for
generator and core projects; either change the <LangVersion> element in
GFramework.Cqrs.SourceGenerators.csproj from latest to preview to match the
other source-generator projects (GFramework.Core.SourceGenerators,
GFramework.Game.SourceGenerators, GFramework.Godot.SourceGenerators), or if
"latest" is required for specific C# features, add a brief note in the project
README or the PR description explaining why this project needs "latest" and
documenting the intentional deviation.

In `@GFramework.Game.SourceGenerators/GFramework.Game.SourceGenerators.csproj`:
- Around line 3-13: Add the GenerateDocumentationFile property to the existing
<PropertyGroup> so XML docs are emitted for this shipped library; specifically,
in the GFramework.Game.SourceGenerators project’s PropertyGroup (where
TargetFramework, IsRoslynAnalyzer, IncludeBuildOutput, etc. are defined) add
GenerateDocumentationFile set to true (and optionally set DocumentationFile to a
sensible path if you want a custom location) so consumers get IntelliSense
documentation when the package includes lib/netstandard2.0.

In `@GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs`:
- Around line 926-955: Replace the current sparse string checks in
CqrsHandlerRegistryGeneratorTests that only assert fragments of generatedSource
with a full snapshot assertion for generatedSource (or at minimum the complete
helper block) so the test fails on any shape/control-flow/ordering regressions;
locate the test method referencing generatedSource and the symbols
ResolveReferencedAssemblyType, ResolveReferencedAssembly,
RegisterRemainingReflectedHandlerInterfaces, knownServiceTypes0 and change the
Assert.Multiple block to assert generatedSource equals the stored expected
snapshot (or embed the full helper snippet as a single exact-string assertion)
and update the stored snapshot text to match the intentional generator output.
🪄 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: a77e4cad-3a09-4cc9-b846-57a8ff78b55d

📥 Commits

Reviewing files that changed from the base of the PR and between d883173 and 09f751a.

📒 Files selected for processing (71)
  • CLAUDE.md
  • GFramework.Core.Abstractions/Architectures/IArchitecture.cs
  • GFramework.Core.Abstractions/Ioc/IIocContainer.cs
  • GFramework.Core.SourceGenerators.Abstractions/Architectures/AutoRegisterModuleAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Architectures/RegisterModelAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Architectures/RegisterSystemAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Architectures/RegisterUtilityAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Bases/PriorityAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Directory.Build.props
  • GFramework.Core.SourceGenerators.Abstractions/Enums/GenerateEnumExtensionsAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/GFramework.Core.SourceGenerators.Abstractions.csproj
  • GFramework.Core.SourceGenerators.Abstractions/GlobalUsings.cs
  • GFramework.Core.SourceGenerators.Abstractions/Logging/LogAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Rule/ContextAwareAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Rule/GetAllAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Rule/GetModelAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Rule/GetModelsAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Rule/GetServiceAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Rule/GetServicesAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Rule/GetSystemAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Rule/GetSystemsAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Rule/GetUtilitiesAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Rule/GetUtilityAttribute.cs
  • GFramework.Core.SourceGenerators/AnalyzerReleases.Shipped.md
  • GFramework.Core.SourceGenerators/AnalyzerReleases.Unshipped.md
  • GFramework.Core.SourceGenerators/Analyzers/ContextRegistrationAnalyzer.cs
  • GFramework.Core.SourceGenerators/Analyzers/PriorityUsageAnalyzer.cs
  • GFramework.Core.SourceGenerators/Architectures/AutoRegisterModuleGenerator.cs
  • GFramework.Core.SourceGenerators/Bases/PriorityGenerator.cs
  • GFramework.Core.SourceGenerators/Diagnostics/AutoRegisterModuleDiagnostics.cs
  • GFramework.Core.SourceGenerators/Diagnostics/ContextAwareDiagnostic.cs
  • GFramework.Core.SourceGenerators/Diagnostics/ContextGetDiagnostics.cs
  • GFramework.Core.SourceGenerators/Diagnostics/ContextRegistrationDiagnostics.cs
  • GFramework.Core.SourceGenerators/Diagnostics/LoggerDiagnostic.cs
  • GFramework.Core.SourceGenerators/Diagnostics/PriorityDiagnostic.cs
  • GFramework.Core.SourceGenerators/Enums/EnumExtensionsGenerator.cs
  • GFramework.Core.SourceGenerators/GFramework.Core.SourceGenerators.csproj
  • GFramework.Core.SourceGenerators/GeWuYou.GFramework.Core.SourceGenerators.targets
  • GFramework.Core.SourceGenerators/GlobalUsings.cs
  • GFramework.Core.SourceGenerators/Logging/LoggerGenerator.cs
  • GFramework.Core.SourceGenerators/README.md
  • GFramework.Core.SourceGenerators/Rule/ContextAwareGenerator.cs
  • GFramework.Core.SourceGenerators/Rule/ContextGetGenerator.cs
  • GFramework.Core.Tests/Architectures/ArchitectureModulesBehaviorTests.cs
  • GFramework.Core.Tests/Architectures/RegistryInitializationHookBaseTests.cs
  • GFramework.Core.Tests/Cqrs/MediatorCompatibilityDeprecationTests.cs
  • GFramework.Core.Tests/GFramework.Core.Tests.csproj
  • GFramework.Core/Architectures/Architecture.cs
  • GFramework.Core/Architectures/ArchitectureModules.cs
  • GFramework.Core/Coroutine/Extensions/MediatorCoroutineExtensions.cs
  • GFramework.Core/Extensions/ContextAwareMediatorCommandExtensions.cs
  • GFramework.Core/Extensions/ContextAwareMediatorExtensions.cs
  • GFramework.Core/Extensions/ContextAwareMediatorQueryExtensions.cs
  • GFramework.Core/Ioc/MicrosoftDiContainer.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
  • GFramework.Cqrs.SourceGenerators/GFramework.Cqrs.SourceGenerators.csproj
  • GFramework.Cqrs.SourceGenerators/GlobalUsings.cs
  • GFramework.Game.SourceGenerators/AnalyzerReleases.Shipped.md
  • GFramework.Game.SourceGenerators/AnalyzerReleases.Unshipped.md
  • GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.cs
  • GFramework.Game.SourceGenerators/Diagnostics/ConfigSchemaDiagnostics.cs
  • GFramework.Game.SourceGenerators/GFramework.Game.SourceGenerators.csproj
  • GFramework.Game.SourceGenerators/GeWuYou.GFramework.Game.SourceGenerators.targets
  • GFramework.Game.SourceGenerators/GlobalUsings.cs
  • GFramework.Game.Tests/GFramework.Game.Tests.csproj
  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
  • GFramework.SourceGenerators.Tests/GFramework.SourceGenerators.Tests.csproj
  • GFramework.csproj
  • GFramework.sln
  • docs/zh-CN/core/cqrs.md
  • docs/zh-CN/game/config-system.md
💤 Files with no reviewable changes (12)
  • GFramework.Core.SourceGenerators/AnalyzerReleases.Unshipped.md
  • GFramework.Core.Tests/Cqrs/MediatorCompatibilityDeprecationTests.cs
  • GFramework.Core/Architectures/ArchitectureModules.cs
  • GFramework.Core/Architectures/Architecture.cs
  • GFramework.Core/Extensions/ContextAwareMediatorCommandExtensions.cs
  • GFramework.Core/Extensions/ContextAwareMediatorQueryExtensions.cs
  • GFramework.Core/Ioc/MicrosoftDiContainer.cs
  • GFramework.Core/Coroutine/Extensions/MediatorCoroutineExtensions.cs
  • GFramework.Core.Tests/Architectures/ArchitectureModulesBehaviorTests.cs
  • GFramework.Core.Tests/Architectures/RegistryInitializationHookBaseTests.cs
  • GFramework.Core/Extensions/ContextAwareMediatorExtensions.cs
  • GFramework.Core.Abstractions/Architectures/IArchitecture.cs

Comment thread docs/zh-CN/core/cqrs.md
Comment thread GFramework.csproj Outdated
- 新增 CQRS 架构模式详细文档,包括命令查询职责分离核心概念
- 添加命令、查询、处理器、请求分发器等基本用法示例
- 包含高级用法如通知、管道行为、流式处理等完整功能介绍
- 提供最佳实践指南和常见问题解决方案
- 添加游戏内容配置系统文档,涵盖 YAML 配置源文件和 JSON Schema 结构描述
- 包含推荐目录结构、Schema 示例和 YAML 示例配置
- 提供完整的接入模板,包括 csproj 配置、启动帮助器和运行时读取模板
- 添加 Godot 文本配置桥接、热重载和 Architecture 接入等高级功能说明
@GeWuYou GeWuYou changed the title docs: 添加 CQRS 架构模式和游戏配置系统文档 refactor: 移除 Mediator 兼容性 API 并重组源生成器项目结构 Apr 16, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
docs/zh-CN/getting-started/installation.md (1)

9-20: 考虑添加迁移指南。

文档准确地说明了当前的包拆分结构,但对于从旧版本升级的用户,建议在此处或"常见问题"部分补充明确的迁移步骤。例如:

  • 如何卸载旧的聚合包 GeWuYou.GFramework.SourceGenerators
  • 如何选择需要安装的新拆分包
  • 是否需要更新代码中的命名空间引用

这将帮助现有用户平滑过渡到新的包结构。根据 learnings,集成导向功能的文档必须包含迁移或兼容性说明。

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

In `@docs/zh-CN/getting-started/installation.md` around lines 9 - 20, Add a
concise migration guide explaining how to move from the old aggregate package
GeWuYou.GFramework.SourceGenerators to the new split packages: list explicit
steps to uninstall/unreference GeWuYou.GFramework.SourceGenerators, recommend
which new packages to install based on use case (e.g.,
GeWuYou.GFramework.Core.SourceGenerators, Game.SourceGenerators,
Godot.SourceGenerators, Cqrs.SourceGenerators), note any required changes to
using/import/namespace references in code, and include a short decision tip for
choosing the minimal set of new packages needed for users relying on
logging/context-aware features vs. schema/config generation.
🤖 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/source-generators/index.md`:
- Line 170: Update all example using directives in docs/zh-CN to the new
namespace root: replace occurrences like
"GFramework.SourceGenerators.Abstractions.Logging" with
"GFramework.Core.SourceGenerators.Abstractions.Logging" (and similarly for Rule,
Bases, Enums, Architectures). Search for the using statement shown ("using
GFramework.SourceGenerators.Abstractions.Logging;") and all other examples under
docs/zh-CN, then perform a systematic rename to the
"GFramework.Core.SourceGenerators.Abstractions.*" variants so the code samples
compile.

In
`@GFramework.SourceGenerators.Tests/Architectures/AutoRegisterModuleGeneratorTests.cs`:
- Around line 183-205: The test's embedded source still imports the old
namespace GFramework.SourceGenerators.Abstractions.Architectures so it doesn't
exercise the relocated public contracts; update the embedded source in
AutoRegisterModuleGeneratorTests to reference the new namespace
GFramework.Core.SourceGenerators.Abstractions.Architectures (or add a duplicate
test case using that new namespace) for the attributes used (AutoRegisterModule,
RegisterUtility) and the partial class GameplayModule; apply the same change to
the other embedded test block mentioned (the region covering the 208-218
snippet) so the generator tests validate the new public API location.

In
`@GFramework.SourceGenerators.Tests/Rule/ContextAwareGeneratorSnapshotTests.cs`:
- Around line 1-3: Add an explicit using for NUnit by inserting "using
NUnit.Framework;" at the top of the file so the NUnit attributes used in this
file are not reliant on global usings; locate the file containing the
[TestFixture] and [Test] attributes (in
GFramework.SourceGenerators.Tests/Rule/ContextAwareGeneratorSnapshotTests.cs)
and add the using declaration alongside the existing usings (e.g., near
System.IO, GFramework.Core.SourceGenerators.Rule,
GFramework.SourceGenerators.Tests.Core) to satisfy the coding standard requiring
explicit imports.

---

Nitpick comments:
In `@docs/zh-CN/getting-started/installation.md`:
- Around line 9-20: Add a concise migration guide explaining how to move from
the old aggregate package GeWuYou.GFramework.SourceGenerators to the new split
packages: list explicit steps to uninstall/unreference
GeWuYou.GFramework.SourceGenerators, recommend which new packages to install
based on use case (e.g., GeWuYou.GFramework.Core.SourceGenerators,
Game.SourceGenerators, Godot.SourceGenerators, Cqrs.SourceGenerators), note any
required changes to using/import/namespace references in code, and include a
short decision tip for choosing the minimal set of new packages needed for users
relying on logging/context-aware features vs. schema/config generation.
🪄 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: cc0b60ff-d018-4ab4-b94d-319eaec15e9c

📥 Commits

Reviewing files that changed from the base of the PR and between 09f751a and 0cf4945.

📒 Files selected for processing (51)
  • GFramework.Core.SourceGenerators.Abstractions/Architectures/AutoRegisterModuleAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Architectures/RegisterModelAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Architectures/RegisterSystemAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Architectures/RegisterUtilityAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Bases/PriorityAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Enums/GenerateEnumExtensionsAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Logging/LogAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Rule/ContextAwareAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Rule/GetAllAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Rule/GetModelAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Rule/GetModelsAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Rule/GetServiceAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Rule/GetServicesAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Rule/GetSystemAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Rule/GetSystemsAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Rule/GetUtilitiesAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Rule/GetUtilityAttribute.cs
  • GFramework.Core.SourceGenerators/Analyzers/ContextRegistrationAnalyzer.cs
  • GFramework.Core.SourceGenerators/Analyzers/PriorityUsageAnalyzer.cs
  • GFramework.Core.SourceGenerators/Architectures/AutoRegisterModuleGenerator.cs
  • GFramework.Core.SourceGenerators/Bases/PriorityGenerator.cs
  • GFramework.Core.SourceGenerators/Diagnostics/AutoRegisterModuleDiagnostics.cs
  • GFramework.Core.SourceGenerators/Diagnostics/ContextAwareDiagnostic.cs
  • GFramework.Core.SourceGenerators/Diagnostics/ContextGetDiagnostics.cs
  • GFramework.Core.SourceGenerators/Diagnostics/ContextRegistrationDiagnostics.cs
  • GFramework.Core.SourceGenerators/Diagnostics/LoggerDiagnostic.cs
  • GFramework.Core.SourceGenerators/Diagnostics/PriorityDiagnostic.cs
  • GFramework.Core.SourceGenerators/Enums/EnumExtensionsGenerator.cs
  • GFramework.Core.SourceGenerators/Logging/LoggerGenerator.cs
  • GFramework.Core.SourceGenerators/Rule/ContextAwareGenerator.cs
  • GFramework.Core.SourceGenerators/Rule/ContextGetGenerator.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
  • GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.cs
  • GFramework.Game.SourceGenerators/Diagnostics/ConfigSchemaDiagnostics.cs
  • GFramework.Game.SourceGenerators/GFramework.Game.SourceGenerators.csproj
  • GFramework.SourceGenerators.Tests/Analyzers/ContextRegistrationAnalyzerTests.cs
  • GFramework.SourceGenerators.Tests/Architectures/AutoRegisterModuleGeneratorTests.cs
  • GFramework.SourceGenerators.Tests/Bases/PriorityGeneratorSnapshotTests.cs
  • GFramework.SourceGenerators.Tests/Config/SchemaGeneratorTestDriver.cs
  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
  • GFramework.SourceGenerators.Tests/Logging/LoggerGeneratorSnapshotTests.cs
  • GFramework.SourceGenerators.Tests/Rule/ContextAwareGeneratorSnapshotTests.cs
  • GFramework.SourceGenerators.Tests/Rule/ContextGetGeneratorTests.cs
  • GFramework.csproj
  • README.md
  • docs/zh-CN/core/cqrs.md
  • docs/zh-CN/game/config-system.md
  • docs/zh-CN/getting-started/installation.md
  • docs/zh-CN/source-generators/index.md
  • docs/zh-CN/tutorials/basic/02-project-setup.md
✅ Files skipped from review due to trivial changes (15)
  • GFramework.Core.SourceGenerators/Enums/EnumExtensionsGenerator.cs
  • GFramework.Core.SourceGenerators/Diagnostics/ContextRegistrationDiagnostics.cs
  • GFramework.SourceGenerators.Tests/Bases/PriorityGeneratorSnapshotTests.cs
  • GFramework.Core.SourceGenerators/Diagnostics/ContextAwareDiagnostic.cs
  • GFramework.Game.SourceGenerators/Diagnostics/ConfigSchemaDiagnostics.cs
  • GFramework.Core.SourceGenerators/Diagnostics/AutoRegisterModuleDiagnostics.cs
  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
  • GFramework.SourceGenerators.Tests/Rule/ContextGetGeneratorTests.cs
  • GFramework.Core.SourceGenerators.Abstractions/Architectures/RegisterSystemAttribute.cs
  • GFramework.SourceGenerators.Tests/Analyzers/ContextRegistrationAnalyzerTests.cs
  • GFramework.Core.SourceGenerators/Analyzers/PriorityUsageAnalyzer.cs
  • README.md
  • GFramework.Game.SourceGenerators/GFramework.Game.SourceGenerators.csproj
  • GFramework.csproj
  • docs/zh-CN/game/config-system.md
🚧 Files skipped from review as they are similar to previous changes (22)
  • GFramework.Core.SourceGenerators/Rule/ContextGetGenerator.cs
  • GFramework.Core.SourceGenerators.Abstractions/Rule/ContextAwareAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Rule/GetAllAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Bases/PriorityAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Rule/GetModelsAttribute.cs
  • GFramework.Core.SourceGenerators/Diagnostics/PriorityDiagnostic.cs
  • GFramework.Core.SourceGenerators.Abstractions/Logging/LogAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Rule/GetModelAttribute.cs
  • docs/zh-CN/core/cqrs.md
  • GFramework.Core.SourceGenerators.Abstractions/Enums/GenerateEnumExtensionsAttribute.cs
  • GFramework.Core.SourceGenerators/Rule/ContextAwareGenerator.cs
  • GFramework.Core.SourceGenerators.Abstractions/Rule/GetSystemAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Rule/GetUtilityAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Rule/GetUtilitiesAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Rule/GetSystemsAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Rule/GetServicesAttribute.cs
  • GFramework.Core.SourceGenerators/Diagnostics/ContextGetDiagnostics.cs
  • GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.cs
  • GFramework.Core.SourceGenerators/Bases/PriorityGenerator.cs
  • GFramework.Core.SourceGenerators/Diagnostics/LoggerDiagnostic.cs
  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
📜 Review details
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Analyze (C#)
  • GitHub Check: Code Quality & Security
🧰 Additional context used
📓 Path-based instructions (4)
**/*.cs

📄 CodeRabbit inference engine (AGENTS.md)

**/*.cs: All public, protected, and internal types and members in C# MUST include XML documentation comments (///) using <summary>, <param>, <returns>, <exception>, and <remarks> tags where applicable
XML documentation comments must explain intent, contract, and usage constraints instead of restating syntax
If a member participates in lifecycle, threading, registration, or disposal behavior, document that behavior explicitly in XML documentation
Add inline comments for non-trivial logic, concurrency or threading behavior, performance-sensitive paths, workarounds and edge cases, and registration order or lifecycle sequencing
Avoid obvious comments such as // increment i
Core framework components such as Architecture, Module, System, Context, Registry, Service Module, and Lifecycle types MUST include high-level explanations of responsibilities, lifecycle, interaction with other components, why the abstraction exists, and when to use it instead of alternatives
Generated logic and generator pipelines MUST explain what is generated, why it is generated, the semantic assumptions the generator relies on, and any diagnostics or fallback behavior
Methods with non-trivial logic MUST document the core idea, key decisions, and edge case handling, if any
Comments MUST NOT be trivial, redundant, or misleading. Prefer explaining why and when, not just what
Code should remain understandable without requiring external context. Prefer slightly more explanation over too little for framework code
Missing required documentation is a coding standards violation. Code that does not meet the documentation rules is considered incomplete
Do not rely on implicit imports. Declare every required using explicitly in C# files
Write null-safe code that respects nullable annotations instead of suppressing warnings by default
Use the namespace pattern GFramework.{Module}.{Feature} with PascalCase segments
Follow standard C# naming: Types, methods, properties, events, and con...

Files:

  • GFramework.SourceGenerators.Tests/Rule/ContextAwareGeneratorSnapshotTests.cs
  • GFramework.Core.SourceGenerators/Logging/LoggerGenerator.cs
  • GFramework.Core.SourceGenerators.Abstractions/Architectures/RegisterUtilityAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Architectures/AutoRegisterModuleAttribute.cs
  • GFramework.SourceGenerators.Tests/Architectures/AutoRegisterModuleGeneratorTests.cs
  • GFramework.Core.SourceGenerators.Abstractions/Rule/GetServiceAttribute.cs
  • GFramework.SourceGenerators.Tests/Logging/LoggerGeneratorSnapshotTests.cs
  • GFramework.SourceGenerators.Tests/Config/SchemaGeneratorTestDriver.cs
  • GFramework.Core.SourceGenerators.Abstractions/Architectures/RegisterModelAttribute.cs
  • GFramework.Core.SourceGenerators/Architectures/AutoRegisterModuleGenerator.cs
  • GFramework.Core.SourceGenerators/Analyzers/ContextRegistrationAnalyzer.cs
{README.md,docs/**/*}

📄 CodeRabbit inference engine (AGENTS.md)

{README.md,docs/**/*}: Update the relevant README.md or docs/ page when behavior, setup steps, architecture guidance, or user-facing examples change
Keep code samples, package names, and command examples aligned with the current repository state in documentation
Prefer documenting behavior and design intent, not only API surface in documentation
If an existing documentation page no longer reflects the current implementation, fixing the code without fixing the documentation is considered incomplete work

Files:

  • docs/zh-CN/tutorials/basic/02-project-setup.md
  • docs/zh-CN/source-generators/index.md
  • docs/zh-CN/getting-started/installation.md
docs/zh-CN/**/*

📄 CodeRabbit inference engine (AGENTS.md)

docs/zh-CN/**/*: When a feature is added, removed, renamed, or substantially refactored, contributors MUST update or create the corresponding user-facing integration documentation in docs/zh-CN/ in the same change
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 when behavior changes
Do not rely on "the code is self-explanatory" for framework features that consumers need to adopt; write the adoption path down so future users do not need to rediscover it from source

Files:

  • docs/zh-CN/tutorials/basic/02-project-setup.md
  • docs/zh-CN/source-generators/index.md
  • docs/zh-CN/getting-started/installation.md
docs/**/*.md

📄 CodeRabbit inference engine (CLAUDE.md)

Documentation must be organized in docs/ directory with Chinese content in docs/zh-CN/

Files:

  • docs/zh-CN/tutorials/basic/02-project-setup.md
  • docs/zh-CN/source-generators/index.md
  • docs/zh-CN/getting-started/installation.md
🧠 Learnings (30)
📓 Common learnings
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to docs/zh-CN/**/* : When a feature is added, removed, renamed, or substantially refactored, contributors MUST update or create the corresponding user-facing integration documentation in `docs/zh-CN/` in the same change
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to docs/zh-CN/**/* : 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 when behavior changes
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-16T11:54:13.310Z
Learning: Applies to **/*.cs : Use CQRS with 'Cqrs' naming for new code; legacy 'Mediator' aliases are deprecated
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-16T11:54:13.310Z
Learning: Applies to **/GFramework.SourceGenerators/**/*.cs : SourceGenerators project should focus on Roslyn incremental source code generation and shared infrastructure
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T13:01:52.971Z
Learning: Follow all coding rules defined in AGENTS.md
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T13:01:52.971Z
Learning: IArchitecture must serve as the top-level container responsible for lifecycle management, component registration, module installation, and unified service access
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T13:01:52.971Z
Learning: IContextAware must be the unified context access interface through which components obtain IArchitectureContext via SetContext(IArchitectureContext)
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T13:01:52.971Z
Learning: IModel must implement the data and state layer, responsible for long-term state and business data modeling
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T13:01:52.971Z
Learning: ISystem must implement the business logic layer, responsible for command execution, process orchestration, and rules implementation
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T13:01:52.971Z
Learning: IUtility must implement the general stateless utility layer for reuse across other layers
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T13:01:52.971Z
Learning: ArchitectureLifecycle component must manage lifecycle phases (Init, Ready, Destroy), phase transitions, and lifecycle hooks
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T13:01:52.971Z
Learning: ArchitectureComponentRegistry component must manage registration and resolution of Model, System, and Utility components
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T13:01:52.971Z
Learning: ArchitectureModules component must manage module installation, service module integration, and extension point registration
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T13:01:52.971Z
Learning: Use CQRS (Command and Query Responsibility Segregation) pattern with support for synchronous and asynchronous execution
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T13:01:52.971Z
Learning: Use the unified CQRS naming entry point instead of the deprecated Mediator alias
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T13:01:52.971Z
Learning: EventBus must provide type-safe event publishing, subscription with priority support, filtering, and weak reference subscription
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T13:01:52.971Z
Learning: BindableProperty must implement reactive property model that drives UI or business layer updates via value change notifications
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T13:01:52.971Z
Learning: Coroutine system must be frame-driven based on IYieldInstruction and scheduler abstractions, supporting common patterns like waiting for time, events, and task completion
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T13:01:52.971Z
Learning: IoC container must use MicrosoftDiContainer as a wrapper around Microsoft.Extensions.DependencyInjection for unified component registration and service resolution
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T13:01:52.971Z
Learning: IServiceModule pattern must be used for registering built-in services (EventBus, CommandExecutor, QueryExecutor, etc.) into Architecture
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T13:01:52.971Z
Learning: LoggerGenerator source generator must automatically generate logging fields and logging helper methods from [Log] attribute
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T13:01:52.971Z
Learning: PriorityGenerator source generator must generate priority comparison implementations from [Priority] attribute
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T13:01:52.971Z
Learning: EnumExtensionsGenerator source generator must generate enum extension capabilities from [GenerateEnumExtensions] attribute
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T13:01:52.971Z
Learning: ContextAwareGenerator source generator must automatically implement IContextAware-related boilerplate logic from [ContextAware] attribute
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T13:01:52.971Z
Learning: CqrsHandlerRegistryGenerator must generate CQRS handler registrars for consuming assemblies, with runtime priority over reflection-based fallback; non-default assemblies must use RegisterCqrsHandlersFromAssembly(...) or RegisterCqrsHandlersFromAssemblies(...)
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T13:01:52.971Z
Learning: Module structure must follow the pattern of abstraction layer + implementation layer + integration layer + generator layer
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T13:01:52.971Z
Learning: Design framework architecture with clear module boundaries, composable service registration, stable abstract contracts, and moderate code generation automation rather than concentrating all capabilities in a single core class
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.SourceGenerators.Tests.cs : Preserve snapshot-based verification patterns already used in the repository for source generator tests

Applied to files:

  • GFramework.SourceGenerators.Tests/Rule/ContextAwareGeneratorSnapshotTests.cs
  • GFramework.SourceGenerators.Tests/Architectures/AutoRegisterModuleGeneratorTests.cs
  • GFramework.SourceGenerators.Tests/Logging/LoggerGeneratorSnapshotTests.cs
  • GFramework.SourceGenerators.Tests/Config/SchemaGeneratorTestDriver.cs
  • docs/zh-CN/source-generators/index.md
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.SourceGenerators.cs : When generator behavior changes intentionally, update snapshots together with the implementation

Applied to files:

  • GFramework.SourceGenerators.Tests/Rule/ContextAwareGeneratorSnapshotTests.cs
  • GFramework.Core.SourceGenerators/Logging/LoggerGenerator.cs
  • GFramework.Core.SourceGenerators.Abstractions/Architectures/RegisterUtilityAttribute.cs
  • docs/zh-CN/tutorials/basic/02-project-setup.md
  • GFramework.Core.SourceGenerators.Abstractions/Architectures/AutoRegisterModuleAttribute.cs
  • GFramework.SourceGenerators.Tests/Architectures/AutoRegisterModuleGeneratorTests.cs
  • GFramework.SourceGenerators.Tests/Logging/LoggerGeneratorSnapshotTests.cs
  • GFramework.SourceGenerators.Tests/Config/SchemaGeneratorTestDriver.cs
  • docs/zh-CN/source-generators/index.md
  • docs/zh-CN/getting-started/installation.md
  • GFramework.Core.SourceGenerators.Abstractions/Architectures/RegisterModelAttribute.cs
  • GFramework.Core.SourceGenerators/Architectures/AutoRegisterModuleGenerator.cs
  • GFramework.Core.SourceGenerators/Analyzers/ContextRegistrationAnalyzer.cs
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.SourceGenerators.Tests.cs : Source generator changes MUST be covered by generator tests

Applied to files:

  • GFramework.SourceGenerators.Tests/Rule/ContextAwareGeneratorSnapshotTests.cs
  • GFramework.Core.SourceGenerators/Logging/LoggerGenerator.cs
  • GFramework.Core.SourceGenerators.Abstractions/Architectures/AutoRegisterModuleAttribute.cs
  • GFramework.SourceGenerators.Tests/Architectures/AutoRegisterModuleGeneratorTests.cs
  • GFramework.SourceGenerators.Tests/Logging/LoggerGeneratorSnapshotTests.cs
  • GFramework.SourceGenerators.Tests/Config/SchemaGeneratorTestDriver.cs
  • docs/zh-CN/source-generators/index.md
  • docs/zh-CN/getting-started/installation.md
  • GFramework.Core.SourceGenerators/Architectures/AutoRegisterModuleGenerator.cs
📚 Learning: 2026-04-16T11:54:13.310Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-16T11:54:13.310Z
Learning: Applies to **/GFramework.SourceGenerators/**/*.cs : SourceGenerators project should focus on Roslyn incremental source code generation and shared infrastructure

Applied to files:

  • GFramework.SourceGenerators.Tests/Rule/ContextAwareGeneratorSnapshotTests.cs
  • GFramework.Core.SourceGenerators/Logging/LoggerGenerator.cs
  • GFramework.Core.SourceGenerators.Abstractions/Architectures/RegisterUtilityAttribute.cs
  • docs/zh-CN/tutorials/basic/02-project-setup.md
  • GFramework.Core.SourceGenerators.Abstractions/Architectures/AutoRegisterModuleAttribute.cs
  • GFramework.SourceGenerators.Tests/Architectures/AutoRegisterModuleGeneratorTests.cs
  • GFramework.Core.SourceGenerators.Abstractions/Rule/GetServiceAttribute.cs
  • GFramework.SourceGenerators.Tests/Logging/LoggerGeneratorSnapshotTests.cs
  • GFramework.SourceGenerators.Tests/Config/SchemaGeneratorTestDriver.cs
  • docs/zh-CN/source-generators/index.md
  • docs/zh-CN/getting-started/installation.md
  • GFramework.Core.SourceGenerators.Abstractions/Architectures/RegisterModelAttribute.cs
  • GFramework.Core.SourceGenerators/Architectures/AutoRegisterModuleGenerator.cs
  • GFramework.Core.SourceGenerators/Analyzers/ContextRegistrationAnalyzer.cs
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.Tests.csproj : Public API changes must be covered by unit or integration tests

Applied to files:

  • GFramework.SourceGenerators.Tests/Rule/ContextAwareGeneratorSnapshotTests.cs
  • GFramework.SourceGenerators.Tests/Architectures/AutoRegisterModuleGeneratorTests.cs
  • GFramework.SourceGenerators.Tests/Logging/LoggerGeneratorSnapshotTests.cs
  • GFramework.SourceGenerators.Tests/Config/SchemaGeneratorTestDriver.cs
📚 Learning: 2026-04-16T11:54:13.310Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-16T11:54:13.310Z
Learning: Applies to **/GFramework.SourceGenerators/**/*.cs : Source generators should be used to reduce boilerplate code while maintaining framework API consistency and maintainability

Applied to files:

  • GFramework.SourceGenerators.Tests/Rule/ContextAwareGeneratorSnapshotTests.cs
  • GFramework.Core.SourceGenerators/Logging/LoggerGenerator.cs
  • GFramework.Core.SourceGenerators.Abstractions/Architectures/RegisterUtilityAttribute.cs
  • docs/zh-CN/tutorials/basic/02-project-setup.md
  • GFramework.Core.SourceGenerators.Abstractions/Architectures/AutoRegisterModuleAttribute.cs
  • GFramework.SourceGenerators.Tests/Architectures/AutoRegisterModuleGeneratorTests.cs
  • GFramework.Core.SourceGenerators.Abstractions/Rule/GetServiceAttribute.cs
  • GFramework.SourceGenerators.Tests/Logging/LoggerGeneratorSnapshotTests.cs
  • GFramework.SourceGenerators.Tests/Config/SchemaGeneratorTestDriver.cs
  • docs/zh-CN/source-generators/index.md
  • docs/zh-CN/getting-started/installation.md
  • GFramework.Core.SourceGenerators.Abstractions/Architectures/RegisterModelAttribute.cs
  • GFramework.Core.SourceGenerators/Architectures/AutoRegisterModuleGenerator.cs
  • GFramework.Core.SourceGenerators/Analyzers/ContextRegistrationAnalyzer.cs
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.SourceGenerators.cs : Keep source generators deterministic and free of hidden environment or network dependencies

Applied to files:

  • GFramework.SourceGenerators.Tests/Rule/ContextAwareGeneratorSnapshotTests.cs
  • GFramework.Core.SourceGenerators/Logging/LoggerGenerator.cs
  • docs/zh-CN/tutorials/basic/02-project-setup.md
  • GFramework.SourceGenerators.Tests/Architectures/AutoRegisterModuleGeneratorTests.cs
  • GFramework.SourceGenerators.Tests/Logging/LoggerGeneratorSnapshotTests.cs
  • GFramework.SourceGenerators.Tests/Config/SchemaGeneratorTestDriver.cs
  • docs/zh-CN/source-generators/index.md
  • docs/zh-CN/getting-started/installation.md
  • GFramework.Core.SourceGenerators/Architectures/AutoRegisterModuleGenerator.cs
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.Tests.cs : Keep tests focused on observable behavior, not implementation trivia

Applied to files:

  • GFramework.SourceGenerators.Tests/Rule/ContextAwareGeneratorSnapshotTests.cs
  • GFramework.SourceGenerators.Tests/Logging/LoggerGeneratorSnapshotTests.cs
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.cs : Use the namespace pattern `GFramework.{Module}.{Feature}` with PascalCase segments

Applied to files:

  • GFramework.SourceGenerators.Tests/Rule/ContextAwareGeneratorSnapshotTests.cs
  • GFramework.Core.SourceGenerators.Abstractions/Architectures/RegisterUtilityAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Architectures/AutoRegisterModuleAttribute.cs
  • GFramework.SourceGenerators.Tests/Architectures/AutoRegisterModuleGeneratorTests.cs
  • GFramework.Core.SourceGenerators.Abstractions/Rule/GetServiceAttribute.cs
  • docs/zh-CN/getting-started/installation.md
  • GFramework.Core.SourceGenerators.Abstractions/Architectures/RegisterModelAttribute.cs
  • GFramework.Core.SourceGenerators/Architectures/AutoRegisterModuleGenerator.cs
📚 Learning: 2026-04-06T12:45:43.921Z
Learnt from: GeWuYou
Repo: GeWuYou/GFramework PR: 190
File: GFramework.Game/Config/GameConfigBootstrap.cs:1-3
Timestamp: 2026-04-06T12:45:43.921Z
Learning: In the GeWuYou/GFramework repository, C# files may omit explicit `using System*` imports because the project-wide `GlobalUsings.cs` (referenced via manual global `using` directives) supplies common namespaces (e.g., `System`, `System.Threading`, `System.Threading.Tasks`). During code review, do not flag missing `using System...` directives in `.cs` files as long as `GlobalUsings.cs` is present/used to provide those namespaces.

Applied to files:

  • GFramework.SourceGenerators.Tests/Rule/ContextAwareGeneratorSnapshotTests.cs
  • GFramework.Core.SourceGenerators/Logging/LoggerGenerator.cs
  • GFramework.Core.SourceGenerators.Abstractions/Architectures/RegisterUtilityAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Architectures/AutoRegisterModuleAttribute.cs
  • GFramework.SourceGenerators.Tests/Architectures/AutoRegisterModuleGeneratorTests.cs
  • GFramework.Core.SourceGenerators.Abstractions/Rule/GetServiceAttribute.cs
  • GFramework.SourceGenerators.Tests/Logging/LoggerGeneratorSnapshotTests.cs
  • GFramework.SourceGenerators.Tests/Config/SchemaGeneratorTestDriver.cs
  • GFramework.Core.SourceGenerators.Abstractions/Architectures/RegisterModelAttribute.cs
  • GFramework.Core.SourceGenerators/Architectures/AutoRegisterModuleGenerator.cs
  • GFramework.Core.SourceGenerators/Analyzers/ContextRegistrationAnalyzer.cs
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.Tests.cs : Regression fixes should include a test that fails before the fix and passes after it

Applied to files:

  • GFramework.SourceGenerators.Tests/Rule/ContextAwareGeneratorSnapshotTests.cs
  • GFramework.SourceGenerators.Tests/Logging/LoggerGeneratorSnapshotTests.cs
📚 Learning: 2026-04-16T11:54:13.310Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-16T11:54:13.310Z
Learning: Applies to **/{Core,GFramework.Core}/**/{Architecture,Architectures}/**/*.cs : Architecture should serve as the top-level container managing lifecycle, component registration, module installation, and unified service access

Applied to files:

  • GFramework.Core.SourceGenerators.Abstractions/Architectures/RegisterUtilityAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Architectures/AutoRegisterModuleAttribute.cs
  • GFramework.SourceGenerators.Tests/Architectures/AutoRegisterModuleGeneratorTests.cs
  • GFramework.Core.SourceGenerators.Abstractions/Architectures/RegisterModelAttribute.cs
  • GFramework.Core.SourceGenerators/Architectures/AutoRegisterModuleGenerator.cs
📚 Learning: 2026-04-16T11:54:13.310Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-16T11:54:13.310Z
Learning: Applies to **/{Core,GFramework.Core}/**/{Architecture,Architectures}/**/*.cs : Implement Architecture core coordination through ArchitectureLifecycle, ArchitectureComponentRegistry, and ArchitectureModules components

Applied to files:

  • GFramework.Core.SourceGenerators.Abstractions/Architectures/RegisterUtilityAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Architectures/AutoRegisterModuleAttribute.cs
  • GFramework.SourceGenerators.Tests/Architectures/AutoRegisterModuleGeneratorTests.cs
  • GFramework.Core.SourceGenerators.Abstractions/Architectures/RegisterModelAttribute.cs
  • GFramework.Core.SourceGenerators/Architectures/AutoRegisterModuleGenerator.cs
📚 Learning: 2026-04-16T11:54:13.310Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-16T11:54:13.310Z
Learning: Applies to **/{ServiceModules,ServiceModule}/**/*.cs : Use IServiceModule pattern for registering internal services like EventBus, CommandExecutor, QueryExecutor with Architecture

Applied to files:

  • GFramework.Core.SourceGenerators.Abstractions/Architectures/RegisterUtilityAttribute.cs
  • GFramework.Core.SourceGenerators.Abstractions/Architectures/AutoRegisterModuleAttribute.cs
  • GFramework.Core.SourceGenerators/Architectures/AutoRegisterModuleGenerator.cs
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to docs/zh-CN/**/* : 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 when behavior changes

Applied to files:

  • docs/zh-CN/tutorials/basic/02-project-setup.md
  • docs/zh-CN/source-generators/index.md
  • docs/zh-CN/getting-started/installation.md
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to docs/zh-CN/**/* : When a feature is added, removed, renamed, or substantially refactored, contributors MUST update or create the corresponding user-facing integration documentation in `docs/zh-CN/` in the same change

Applied to files:

  • docs/zh-CN/tutorials/basic/02-project-setup.md
  • docs/zh-CN/source-generators/index.md
  • docs/zh-CN/getting-started/installation.md
📚 Learning: 2026-04-16T11:54:13.310Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-16T11:54:13.310Z
Learning: Applies to docs/** : Documentation should be organized in docs/ with Chinese content in docs/zh-CN/, covering modules, generators, tutorials, and troubleshooting

Applied to files:

  • docs/zh-CN/tutorials/basic/02-project-setup.md
  • docs/zh-CN/source-generators/index.md
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to docs/zh-CN/**/* : Do not rely on "the code is self-explanatory" for framework features that consumers need to adopt; write the adoption path down so future users do not need to rediscover it from source

Applied to files:

  • docs/zh-CN/tutorials/basic/02-project-setup.md
  • docs/zh-CN/getting-started/installation.md
📚 Learning: 2026-04-16T11:54:13.310Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-16T11:54:13.310Z
Learning: Applies to **/GFramework.Godot/**/*.cs : Godot integration layer should handle adapter implementation for Godot runtime, nodes, scenes, and engine lifecycle

Applied to files:

  • docs/zh-CN/tutorials/basic/02-project-setup.md
  • docs/zh-CN/getting-started/installation.md
📚 Learning: 2026-04-16T11:54:13.310Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-16T11:54:13.310Z
Learning: Applies to **/{GFramework.Core,GFramework.Game,GFramework.Ecs.Arch}/**/*.cs : Core / Game / Ecs.Arch implementation projects should be platform-agnostic

Applied to files:

  • GFramework.Core.SourceGenerators.Abstractions/Architectures/AutoRegisterModuleAttribute.cs
  • GFramework.SourceGenerators.Tests/Architectures/AutoRegisterModuleGeneratorTests.cs
  • docs/zh-CN/source-generators/index.md
  • docs/zh-CN/getting-started/installation.md
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.cs : Any change to public API, lifecycle semantics, module behavior, or extension points MUST update the related XML docs

Applied to files:

  • GFramework.Core.SourceGenerators.Abstractions/Architectures/AutoRegisterModuleAttribute.cs
  • docs/zh-CN/source-generators/index.md
  • docs/zh-CN/getting-started/installation.md
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.Tests.cs : Reuse existing architecture test infrastructure when relevant: `ArchitectureTestsBase<T>`, `SyncTestArchitecture`, `AsyncTestArchitecture`

Applied to files:

  • GFramework.SourceGenerators.Tests/Architectures/AutoRegisterModuleGeneratorTests.cs
📚 Learning: 2026-04-16T11:55:23.931Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.931Z
Learning: Applies to **/*.cs : Generated logic and generator pipelines MUST explain what is generated, why it is generated, the semantic assumptions the generator relies on, and any diagnostics or fallback behavior

Applied to files:

  • GFramework.SourceGenerators.Tests/Architectures/AutoRegisterModuleGeneratorTests.cs
  • docs/zh-CN/source-generators/index.md
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.Tests.csproj : Every non-trivial feature, bug fix, or behavior change MUST include tests or an explicit justification for why a test is not practical

Applied to files:

  • GFramework.SourceGenerators.Tests/Logging/LoggerGeneratorSnapshotTests.cs
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.Tests.csproj : Mirror the source structure in test projects whenever practical

Applied to files:

  • GFramework.SourceGenerators.Tests/Logging/LoggerGeneratorSnapshotTests.cs
📚 Learning: 2026-04-16T11:55:23.931Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.931Z
Learning: Applies to **/*.csproj : Follow the repository defaults with `ImplicitUsings` disabled, `Nullable` enabled, `GenerateDocumentationFile` enabled for shipped libraries, and `LangVersion` generally `preview` in the main libraries and abstractions

Applied to files:

  • docs/zh-CN/source-generators/index.md
📚 Learning: 2026-04-06T12:45:47.739Z
Learnt from: GeWuYou
Repo: GeWuYou/GFramework PR: 190
File: GFramework.Game/Config/GameConfigBootstrap.cs:1-3
Timestamp: 2026-04-06T12:45:47.739Z
Learning: In the GFramework repository (GeWuYou/GFramework), even though `ImplicitUsings` is disabled in the `.csproj` files, the project uses a manual `GlobalUsings.cs` file with `global using` directives to provide common System namespaces (e.g., System, System.Threading, System.Threading.Tasks) project-wide. Do not flag missing System-level `using` imports in C# files within this repository, as they are covered by GlobalUsings.cs.

Applied to files:

  • docs/zh-CN/getting-started/installation.md
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.csproj : Minimize new package dependencies. Add them only when necessary and keep scope narrow

Applied to files:

  • docs/zh-CN/getting-started/installation.md
📚 Learning: 2026-04-16T11:54:13.310Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-16T11:54:13.310Z
Learning: Applies to **/*.cs : IContextAware should provide unified context access interface for components to obtain architecture context via SetContext(IArchitectureContext)

Applied to files:

  • GFramework.Core.SourceGenerators/Analyzers/ContextRegistrationAnalyzer.cs
🪛 LanguageTool
docs/zh-CN/getting-started/installation.md

[grammar] ~18-~18: Ensure spelling is correct
Context: ...成器 | Godot 节点、UI、项目元数据生成 | | GeWuYou.GFramework.Cqrs.SourceGenerators | CQRS 源码生成器 | 处理器注...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

🔇 Additional comments (23)
GFramework.SourceGenerators.Tests/Config/SchemaGeneratorTestDriver.cs (2)

87-87: 该变更段无需评论

仅为结构性收尾,无行为影响。


3-3: 命名空间迁移更新正确

测试驱动已对齐新的 GFramework.Game.SourceGenerators.Config 命名空间,能保持生成器类型解析与现有测试流程一致。

GFramework.Core.SourceGenerators.Abstractions/Rule/GetServiceAttribute.cs (2)

9-9: 该处仅为结构性收尾(闭合与文件结尾换行),无需额外修改。


1-1: 命名空间迁移方向正确且与规范一致。

这一改动与 Core.SourceGenerators 拆分后的命名空间结构保持一致,可读性和模块边界都更清晰。

As per coding guidelines, Use the namespace pattern GFramework.{Module}.{Feature} with PascalCase segments.

GFramework.Core.SourceGenerators/Analyzers/ContextRegistrationAnalyzer.cs (3)

1-1: 命名空间与诊断依赖迁移一致,方向正确。

GFramework.Core.SourceGenerators.* 的迁移在此处保持了分析器与诊断类型的命名空间一致性,改动清晰且可维护。

Also applies to: 6-6


14-23: 上下文方法名映射集中为静态只读表,设计合理。

GetModel/GetSystem/GetUtility 系列映射集中到单一静态字典,提升了可读性并便于后续扩展。


71-76: 这些片段属于格式与布局优化,未引入行为变化。

我检查了上述改动点,语义保持不变,主要是可读性提升与代码组织调整。

Also applies to: 372-392, 398-415, 705-706, 829-835

GFramework.Core.SourceGenerators.Abstractions/Architectures/RegisterModelAttribute.cs (1)

1-1: 命名空间迁移一致,变更清晰。

这里仅调整到 GFramework.Core.SourceGenerators.Abstractions.Architectures,与当前模块拆分方向一致,属性契约未被破坏。

GFramework.Core.SourceGenerators.Abstractions/Architectures/RegisterUtilityAttribute.cs (1)

1-1: 该命名空间调整合理。

与同目录其他 Abstractions 特性保持一致,便于统一消费路径。

GFramework.Core.SourceGenerators.Abstractions/Architectures/AutoRegisterModuleAttribute.cs (1)

1-1: 迁移方向正确。

AutoRegisterModuleAttribute 的命名空间与 Core 源生成器抽象层保持对齐。

GFramework.Core.SourceGenerators/Architectures/AutoRegisterModuleGenerator.cs (1)

1-2: 生成器命名空间与依赖引用迁移完成度高。

usingnamespace 同步切换到 GFramework.Core.SourceGenerators.*,改动聚焦且无额外行为漂移。

Also applies to: 7-7

GFramework.SourceGenerators.Tests/Architectures/AutoRegisterModuleGeneratorTests.cs (2)

1-1: 测试入口类型已对齐新生成器命名空间。

这是必要调整,确保测试运行的是迁移后的生成器实现。


250-251: 断言结构重排可读性更好,行为不变。

这里只是格式化调整,不影响生成快照比对逻辑。

GFramework.Core.SourceGenerators/Logging/LoggerGenerator.cs (3)

97-97: 该变更仅为文件收尾格式,无需额外评论。


6-6: 命名空间迁移方向正确。

GFramework.Core.SourceGenerators.Logging 与当前模块边界命名保持一致。


1-4: 该审查评论不适用于此仓库。

GFramework.Core.SourceGenerators/GlobalUsings.cs 已显式声明了文件使用的所有 Roslyn 类型(Microsoft.CodeAnalysis、Microsoft.CodeAnalysis.CSharp.Syntax 等),符合仓库的 global using 管理模式。根据项目约定,不应在文件级别重复这些声明。

			> Likely an incorrect or invalid review comment.
GFramework.SourceGenerators.Tests/Logging/LoggerGeneratorSnapshotTests.cs (2)

591-591: 该变更仅为文件收尾格式,无需额外评论。


2-2: 该审查不适用于本仓库的实践

文件依赖 global using NUnit.Framework; 来自项目级 GlobalUsings.cs 是本仓库的既定模式。根据仓库实践指引,当 ImplicitUsings 被禁用且项目使用 GlobalUsings.cs 声明全局 using 时,无需在单个文件中显式重复声明这些导入——包括 NUnit 框架依赖。该文件已符合仓库规范。

			> Likely an incorrect or invalid review comment.
docs/zh-CN/tutorials/basic/02-project-setup.md (1)

77-82: 文档更新准确且清晰!

软件包拆分的文档更新与实际的 NuGet 包结构一致,注释清楚地说明了每个生成器包的用途。

docs/zh-CN/getting-started/installation.md (1)

73-81: 源码生成器包配置正确!

为所有生成器包添加 PrivateAssets="all"ExcludeAssets="runtime" 是正确的做法,可以防止分析器/生成器被包含在最终输出中。

docs/zh-CN/source-generators/index.md (2)

33-42: 概述更新准确!

清楚地列出了拆分后的四个生成器包,并明确说明聚合包不存在,避免了用户混淆。


92-104: 安装说明完整且准确!

NuGet 包引用配置正确,并且补充说明了 Godot/Cqrs 场景的包选择以及 abstractions 依赖会自动带入,这对用户很有帮助。

GFramework.SourceGenerators.Tests/Rule/ContextAwareGeneratorSnapshotTests.cs (1)

95-95: 该变更仅为文件结尾整理,无需额外修改。

Comment thread docs/zh-CN/source-generators/index.md Outdated
- 新增完整的 GFramework.SourceGenerators 文档,涵盖所有生成器功能
- 添加 Log 属性生成器、ContextAware 属性生成器、Config Schema 生成器等详细说明
- 包含 Godot 专用生成器如 GetNode、BindNodeSignal、AutoUiPage 等使用指南
- 提供诊断信息、性能优势、使用示例和最佳实践章节
- 创建 Core.SourceGenerators.Abstractions 项目文件和配置
- 集成 Meziantou.Analyzer 和 Meziantou.Polyfill 包引用
- 配置项目构建属性和命名空间引入设置
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
docs/zh-CN/source-generators/index.md (1)

92-97: 包版本示例建议避免硬编码固定值

文档里直接写 Version="1.0.0" 容易很快过时。更稳妥的是改为“与主包版本保持一致”的占位写法或补一句“请替换为当前发布版本”,降低文档维护成本。

As per coding guidelines "Prefer documenting behavior and design intent, not only API surface in documentation".

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

In `@docs/zh-CN/source-generators/index.md` around lines 92 - 97, The
documentation currently hardcodes PackageReference Version="1.0.0" for
GeWuYou.GFramework.Core.SourceGenerators and
GeWuYou.GFramework.Game.SourceGenerators; change these examples to use a
placeholder or note (e.g., Version="{current_release_version}" or add "replace
with current release version") and/or add a short sentence advising readers to
substitute the package version to match the main package release, so the
examples remain accurate over time.
🤖 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/source-generators/index.md`:
- Line 1238: The diagram still references the removed aggregate entry
A[GFramework.SourceGenerators] which conflicts with the text; update the graph
so it reflects the current split modules (e.g. replace
A[GFramework.SourceGenerators] with nodes like GFramework.Core.SourceGenerators,
GFramework.Game.SourceGenerators, GFramework.Godot.SourceGenerators,
GFramework.Cqrs.SourceGenerators) or explicitly mark the node as
"conceptual"/"not a package" to avoid confusion; ensure the link to
B[GFramework.Core.SourceGenerators.Abstractions] points to the correct concrete
module name in the updated diagram so it aligns with the documentation text.

---

Nitpick comments:
In `@docs/zh-CN/source-generators/index.md`:
- Around line 92-97: The documentation currently hardcodes PackageReference
Version="1.0.0" for GeWuYou.GFramework.Core.SourceGenerators and
GeWuYou.GFramework.Game.SourceGenerators; change these examples to use a
placeholder or note (e.g., Version="{current_release_version}" or add "replace
with current release version") and/or add a short sentence advising readers to
substitute the package version to match the main package release, so the
examples remain accurate over time.
🪄 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: 5fa43a37-e744-426d-bb0c-66c7de276fc2

📥 Commits

Reviewing files that changed from the base of the PR and between 0cf4945 and 9f9a421.

📒 Files selected for processing (2)
  • GFramework.Core.SourceGenerators.Abstractions/GFramework.Core.SourceGenerators.Abstractions.csproj
  • docs/zh-CN/source-generators/index.md
✅ Files skipped from review due to trivial changes (1)
  • GFramework.Core.SourceGenerators.Abstractions/GFramework.Core.SourceGenerators.Abstractions.csproj
📜 Review details
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Code Quality & Security
  • GitHub Check: Analyze (C#)
🧰 Additional context used
📓 Path-based instructions (2)
{README.md,docs/**/*}

📄 CodeRabbit inference engine (AGENTS.md)

{README.md,docs/**/*}: Update the relevant README.md or docs/ page when behavior, setup steps, architecture guidance, or user-facing examples change
Keep code samples, package names, and command examples aligned with the current repository state in documentation
Prefer documenting behavior and design intent, not only API surface in documentation
If an existing documentation page no longer reflects the current implementation, fixing the code without fixing the documentation is considered incomplete work

Files:

  • docs/zh-CN/source-generators/index.md
docs/zh-CN/**/*

📄 CodeRabbit inference engine (AGENTS.md)

docs/zh-CN/**/*: When a feature is added, removed, renamed, or substantially refactored, contributors MUST update or create the corresponding user-facing integration documentation in docs/zh-CN/ in the same change
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 when behavior changes
Do not rely on "the code is self-explanatory" for framework features that consumers need to adopt; write the adoption path down so future users do not need to rediscover it from source

Files:

  • docs/zh-CN/source-generators/index.md
🧠 Learnings (24)
📓 Common learnings
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-16T11:54:13.310Z
Learning: Applies to **/*.cs : Use CQRS with 'Cqrs' naming for new code; legacy 'Mediator' aliases are deprecated
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-16T11:54:13.310Z
Learning: Applies to **/GFramework.SourceGenerators/**/*.cs : SourceGenerators project should focus on Roslyn incremental source code generation and shared infrastructure
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.SourceGenerators.cs : When generator behavior changes intentionally, update snapshots together with the implementation
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T13:18:06.926Z
Learning: Follow all coding rules defined in AGENTS.md strictly
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T13:18:06.926Z
Learning: IArchitecture should serve as the top-level container responsible for lifecycle management, component registration, module installation, and unified service access
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T13:18:06.926Z
Learning: Component lifecycle in Architecture should follow the core phases: Init, Ready, Destroy, with finer-grained initialization and destruction phases for ensuring consistency across Utility, Model, System, service modules, and hooks
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T13:18:06.926Z
Learning: Use ArchitectureLifecycle, ArchitectureComponentRegistry, and ArchitectureModules as separate components for coordinating Architecture, with lifecycle management, component registration, and module management respectively
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T13:18:06.926Z
Learning: IArchitectureContext and related Provider types should propagate context capabilities between components to provide unified access to architecture services without direct coupling to implementation details
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T13:18:06.926Z
Learning: Use CQRS (Command Query Responsibility Segregation) pattern with support for synchronous and asynchronous execution, using unified 'Cqrs' naming entry point instead of legacy 'Mediator' aliases
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T13:18:06.926Z
Learning: Use EventBus for type-safe event communication between modules with support for event publishing, subscription, priority, filtering, and weak reference subscriptions
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T13:18:06.926Z
Learning: Use BindableProperty for implementing reactive properties driven by value change notifications to update UI or business layers for lightweight state synchronization
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T13:18:06.926Z
Learning: Use Coroutine system based on IYieldInstruction and scheduler abstractions for frame-driven coroutine support with patterns for waiting on time, events, and task completion
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T13:18:06.926Z
Learning: Use MicrosoftDiContainer wrapper around Microsoft.Extensions.DependencyInjection for unified component registration and service resolution
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T13:18:06.926Z
Learning: Use IServiceModule pattern to register built-in services (EventBus, CommandExecutor, QueryExecutor, etc.) with Architecture for infrastructure capability assembly
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T13:18:06.926Z
Learning: Module structure should follow 'Abstractions + Implementation + Integration + Generators' organization pattern with stable abstractions, replaceable implementations, isolated engine integration, and independently evolving generators
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T13:18:06.926Z
Learning: Documentation should be located in docs/ directory with Chinese content in docs/zh-CN/, covering getting started, module capabilities, source generators, tutorials, best practices, and troubleshooting
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.SourceGenerators.cs : When generator behavior changes intentionally, update snapshots together with the implementation

Applied to files:

  • docs/zh-CN/source-generators/index.md
📚 Learning: 2026-04-16T11:54:13.310Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-16T11:54:13.310Z
Learning: Applies to **/GFramework.SourceGenerators/**/*.cs : SourceGenerators project should focus on Roslyn incremental source code generation and shared infrastructure

Applied to files:

  • docs/zh-CN/source-generators/index.md
📚 Learning: 2026-04-16T11:54:13.310Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-16T11:54:13.310Z
Learning: Applies to **/GFramework.SourceGenerators/**/*.cs : Source generators should be used to reduce boilerplate code while maintaining framework API consistency and maintainability

Applied to files:

  • docs/zh-CN/source-generators/index.md
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.SourceGenerators.Tests.cs : Source generator changes MUST be covered by generator tests

Applied to files:

  • docs/zh-CN/source-generators/index.md
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to docs/zh-CN/**/* : 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 when behavior changes

Applied to files:

  • docs/zh-CN/source-generators/index.md
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.SourceGenerators.cs : Keep source generators deterministic and free of hidden environment or network dependencies

Applied to files:

  • docs/zh-CN/source-generators/index.md
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.cs : Any change to public API, lifecycle semantics, module behavior, or extension points MUST update the related XML docs

Applied to files:

  • docs/zh-CN/source-generators/index.md
📚 Learning: 2026-04-16T11:54:13.310Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-16T11:54:13.310Z
Learning: Applies to docs/** : Documentation should be organized in docs/ with Chinese content in docs/zh-CN/, covering modules, generators, tutorials, and troubleshooting

Applied to files:

  • docs/zh-CN/source-generators/index.md
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to docs/zh-CN/**/* : When a feature is added, removed, renamed, or substantially refactored, contributors MUST update or create the corresponding user-facing integration documentation in `docs/zh-CN/` in the same change

Applied to files:

  • docs/zh-CN/source-generators/index.md
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.SourceGenerators.Tests.cs : Preserve snapshot-based verification patterns already used in the repository for source generator tests

Applied to files:

  • docs/zh-CN/source-generators/index.md
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.cs : If a framework abstraction changes meaning or intended usage, update the explanatory comments in code as part of the same change

Applied to files:

  • docs/zh-CN/source-generators/index.md
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to docs/zh-CN/**/* : Do not rely on "the code is self-explanatory" for framework features that consumers need to adopt; write the adoption path down so future users do not need to rediscover it from source

Applied to files:

  • docs/zh-CN/source-generators/index.md
📚 Learning: 2026-04-06T12:45:47.739Z
Learnt from: GeWuYou
Repo: GeWuYou/GFramework PR: 190
File: GFramework.Game/Config/GameConfigBootstrap.cs:1-3
Timestamp: 2026-04-06T12:45:47.739Z
Learning: In the GFramework repository (GeWuYou/GFramework), even though `ImplicitUsings` is disabled in the `.csproj` files, the project uses a manual `GlobalUsings.cs` file with `global using` directives to provide common System namespaces (e.g., System, System.Threading, System.Threading.Tasks) project-wide. Do not flag missing System-level `using` imports in C# files within this repository, as they are covered by GlobalUsings.cs.

Applied to files:

  • docs/zh-CN/source-generators/index.md
📚 Learning: 2026-04-16T11:55:23.931Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.931Z
Learning: Applies to **/*.cs : Missing required documentation is a coding standards violation. Code that does not meet the documentation rules is considered incomplete

Applied to files:

  • docs/zh-CN/source-generators/index.md
📚 Learning: 2026-04-16T11:54:13.310Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-16T11:54:13.310Z
Learning: Applies to **/{GFramework.Core,GFramework.Game,GFramework.Ecs.Arch}/**/*.cs : Core / Game / Ecs.Arch implementation projects should be platform-agnostic

Applied to files:

  • docs/zh-CN/source-generators/index.md
📚 Learning: 2026-04-16T11:55:23.931Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.931Z
Learning: Applies to **/*.csproj : Follow the repository defaults with `ImplicitUsings` disabled, `Nullable` enabled, `GenerateDocumentationFile` enabled for shipped libraries, and `LangVersion` generally `preview` in the main libraries and abstractions

Applied to files:

  • docs/zh-CN/source-generators/index.md
📚 Learning: 2026-04-16T11:54:13.310Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-16T11:54:13.310Z
Learning: Applies to **/{Systems,System}/**/*.cs : ISystem layer should handle command execution, flow orchestration, and rule implementation

Applied to files:

  • docs/zh-CN/source-generators/index.md
📚 Learning: 2026-04-16T11:55:23.931Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.931Z
Learning: Applies to **/*.cs : Code should remain understandable without requiring external context. Prefer slightly more explanation over too little for framework code

Applied to files:

  • docs/zh-CN/source-generators/index.md
📚 Learning: 2026-04-16T11:55:23.931Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.931Z
Learning: Applies to **/*.cs : Generated logic and generator pipelines MUST explain what is generated, why it is generated, the semantic assumptions the generator relies on, and any diagnostics or fallback behavior

Applied to files:

  • docs/zh-CN/source-generators/index.md
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.cs : Use the namespace pattern `GFramework.{Module}.{Feature}` with PascalCase segments

Applied to files:

  • docs/zh-CN/source-generators/index.md
📚 Learning: 2026-04-16T11:54:13.310Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-16T11:54:13.310Z
Learning: Applies to **/{Core,GFramework.Core}/**/{Architecture,Architectures}/**/*.cs : Architecture should serve as the top-level container managing lifecycle, component registration, module installation, and unified service access

Applied to files:

  • docs/zh-CN/source-generators/index.md
📚 Learning: 2026-04-16T11:54:13.310Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-16T11:54:13.310Z
Learning: Applies to **/{Core,GFramework.Core}/**/{Architecture,Architectures}/**/*.cs : Implement Architecture core coordination through ArchitectureLifecycle, ArchitectureComponentRegistry, and ArchitectureModules components

Applied to files:

  • docs/zh-CN/source-generators/index.md
📚 Learning: 2026-04-16T11:54:13.310Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-16T11:54:13.310Z
Learning: Applies to **/{ServiceModules,ServiceModule}/**/*.cs : Use IServiceModule pattern for registering internal services like EventBus, CommandExecutor, QueryExecutor with Architecture

Applied to files:

  • docs/zh-CN/source-generators/index.md
🔇 Additional comments (1)
docs/zh-CN/source-generators/index.md (1)

170-170: 命名空间迁移已对齐,示例可用性明显提升

这些 using 已统一到 GFramework.Core.SourceGenerators.Abstractions.*,与当前抽象项目结构一致,能避免读者复制示例后编译失败。

Also applies to: 249-249, 357-359, 384-384, 563-563, 867-868, 957-958

Comment thread docs/zh-CN/source-generators/index.md Outdated
- 新增完整的 GFramework.SourceGenerators 文档,涵盖所有核心特性
- 添加 Log 属性生成器、Config Schema 生成器等详细使用说明
- 添加 ContextAware、GenerateEnumExtensions 等属性生成器文档
- 添加 Godot 专用生成器如 GetNode、BindNodeSignal 等使用指南
- 添加 AutoRegisterModule、AutoUiPage、AutoScene 等自动化工具文档
- 添加诊断信息、性能优势、使用示例和最佳实践章节
- 新增 PathContests 常量类定义 GFramework 项目路径常量
- 添加 ContextRegistrationAnalyzerTests 测试类验证上下文注册分析器
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs (1)

16-16: 可选:抽取重复的测试源码模板,降低后续命名空间迁移成本

Line 16/56/95/137/176 与 Line 28/68/107/149/188 的内嵌 Attribute 片段重复度很高。后续若再调整命名空间或属性定义,维护点较多,建议抽成公共模板/辅助方法。

♻️ 可选重构示例
+    private const string EnumAttrNs = "GFramework.Core.SourceGenerators.Abstractions.Enums";
+
+    private static string BuildSource(string enumBody, string attributeUsage = "[GenerateEnumExtensions]")
+    {
+        return $$"""
+                 using System;
+
+                 namespace {{EnumAttrNs}}
+                 {
+                     [AttributeUsage(AttributeTargets.Enum)]
+                     public sealed class GenerateEnumExtensionsAttribute : Attribute
+                     {
+                         public bool GenerateIsMethods { get; set; } = true;
+                         public bool GenerateIsInMethod { get; set; } = true;
+                     }
+                 }
+
+                 namespace TestApp
+                 {
+                     using {{EnumAttrNs}};
+
+                     {{attributeUsage}}
+                     {{enumBody}}
+                 }
+                 """;
+    }

Also applies to: 28-28, 56-56, 68-68, 95-95, 107-107, 137-137, 149-149, 176-176, 188-188

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

In
`@GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs`
at line 16, The test file has highly duplicated inline attribute snippets used
in EnumExtensionsGeneratorSnapshotTests; extract the repeated attribute fragment
into a single reusable constant or helper method (e.g., a static readonly string
AttributeSnippet or private string GetAttributeSnippet()) and replace each
inline occurrence in the test snapshots with that symbol to reduce maintenance
when namespaces/attributes change; update all references inside
EnumExtensionsGeneratorSnapshotTests where the embedded attribute appears so
tests use the common symbol instead of duplicating the literal.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs`:
- Line 16: The test file has highly duplicated inline attribute snippets used in
EnumExtensionsGeneratorSnapshotTests; extract the repeated attribute fragment
into a single reusable constant or helper method (e.g., a static readonly string
AttributeSnippet or private string GetAttributeSnippet()) and replace each
inline occurrence in the test snapshots with that symbol to reduce maintenance
when namespaces/attributes change; update all references inside
EnumExtensionsGeneratorSnapshotTests where the embedded attribute appears so
tests use the common symbol instead of duplicating the literal.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4bc543bb-0fea-48b3-8204-75cfcb858aa0

📥 Commits

Reviewing files that changed from the base of the PR and between 9f9a421 and 534818f.

📒 Files selected for processing (9)
  • GFramework.SourceGenerators.Common/Constants/PathContests.cs
  • GFramework.SourceGenerators.Tests/Analyzers/ContextRegistrationAnalyzerTests.cs
  • GFramework.SourceGenerators.Tests/Architectures/AutoRegisterModuleGeneratorTests.cs
  • GFramework.SourceGenerators.Tests/Bases/PriorityGeneratorSnapshotTests.cs
  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
  • GFramework.SourceGenerators.Tests/Logging/LoggerGeneratorSnapshotTests.cs
  • GFramework.SourceGenerators.Tests/Rule/ContextAwareGeneratorSnapshotTests.cs
  • GFramework.SourceGenerators.Tests/Rule/ContextGetGeneratorTests.cs
  • docs/zh-CN/source-generators/index.md
✅ Files skipped from review due to trivial changes (6)
  • GFramework.SourceGenerators.Tests/Bases/PriorityGeneratorSnapshotTests.cs
  • GFramework.SourceGenerators.Tests/Analyzers/ContextRegistrationAnalyzerTests.cs
  • GFramework.SourceGenerators.Tests/Logging/LoggerGeneratorSnapshotTests.cs
  • GFramework.SourceGenerators.Tests/Architectures/AutoRegisterModuleGeneratorTests.cs
  • docs/zh-CN/source-generators/index.md
  • GFramework.SourceGenerators.Common/Constants/PathContests.cs
🚧 Files skipped from review as they are similar to previous changes (2)
  • GFramework.SourceGenerators.Tests/Rule/ContextAwareGeneratorSnapshotTests.cs
  • GFramework.SourceGenerators.Tests/Rule/ContextGetGeneratorTests.cs
📜 Review details
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Code Quality & Security
  • GitHub Check: Analyze (C#)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.cs

📄 CodeRabbit inference engine (AGENTS.md)

**/*.cs: All public, protected, and internal types and members in C# MUST include XML documentation comments (///) using <summary>, <param>, <returns>, <exception>, and <remarks> tags where applicable
XML documentation comments must explain intent, contract, and usage constraints instead of restating syntax
If a member participates in lifecycle, threading, registration, or disposal behavior, document that behavior explicitly in XML documentation
Add inline comments for non-trivial logic, concurrency or threading behavior, performance-sensitive paths, workarounds and edge cases, and registration order or lifecycle sequencing
Avoid obvious comments such as // increment i
Core framework components such as Architecture, Module, System, Context, Registry, Service Module, and Lifecycle types MUST include high-level explanations of responsibilities, lifecycle, interaction with other components, why the abstraction exists, and when to use it instead of alternatives
Generated logic and generator pipelines MUST explain what is generated, why it is generated, the semantic assumptions the generator relies on, and any diagnostics or fallback behavior
Methods with non-trivial logic MUST document the core idea, key decisions, and edge case handling, if any
Comments MUST NOT be trivial, redundant, or misleading. Prefer explaining why and when, not just what
Code should remain understandable without requiring external context. Prefer slightly more explanation over too little for framework code
Missing required documentation is a coding standards violation. Code that does not meet the documentation rules is considered incomplete
Do not rely on implicit imports. Declare every required using explicitly in C# files
Write null-safe code that respects nullable annotations instead of suppressing warnings by default
Use the namespace pattern GFramework.{Module}.{Feature} with PascalCase segments
Follow standard C# naming: Types, methods, properties, events, and con...

Files:

  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
**/GFramework.SourceGenerators*/**/*.cs

📄 CodeRabbit inference engine (CLAUDE.md)

SourceGenerators projects must target netstandard2.1 and contain only Roslyn incremental source generators and common infrastructure

Files:

  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
🧠 Learnings (12)
📓 Common learnings
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-16T11:54:13.310Z
Learning: Applies to **/*.cs : Use CQRS with 'Cqrs' naming for new code; legacy 'Mediator' aliases are deprecated
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T13:41:33.384Z
Learning: All coding rules must be followed as defined in AGENTS.md
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.SourceGenerators.Tests.cs : Preserve snapshot-based verification patterns already used in the repository for source generator tests

Applied to files:

  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.SourceGenerators.Tests.cs : Source generator changes MUST be covered by generator tests

Applied to files:

  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
📚 Learning: 2026-04-16T13:25:59.124Z
Learnt from: GeWuYou
Repo: GeWuYou/GFramework PR: 235
File: GFramework.SourceGenerators.Tests/Rule/ContextAwareGeneratorSnapshotTests.cs:1-3
Timestamp: 2026-04-16T13:25:59.124Z
Learning: In the GeWuYou/GFramework repo, treat `global using NUnit.Framework;` as provided project-wide by `GFramework.SourceGenerators.Tests/GlobalUsings.cs` (via GlobalUsings.cs). Do not require or flag missing per-file `using NUnit.Framework;` directives in test `.cs` files under `GFramework.SourceGenerators.Tests/`, since the project-wide global usings already include NUnit (along with other common namespaces).

Applied to files:

  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.SourceGenerators.cs : When generator behavior changes intentionally, update snapshots together with the implementation

Applied to files:

  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.Tests.csproj : Public API changes must be covered by unit or integration tests

Applied to files:

  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
📚 Learning: 2026-04-16T11:54:13.310Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-16T11:54:13.310Z
Learning: Applies to **/GFramework.SourceGenerators/**/*.cs : SourceGenerators project should focus on Roslyn incremental source code generation and shared infrastructure

Applied to files:

  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
📚 Learning: 2026-04-16T11:54:13.310Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-16T11:54:13.310Z
Learning: Applies to **/GFramework.SourceGenerators/**/*.cs : Source generators should be used to reduce boilerplate code while maintaining framework API consistency and maintainability

Applied to files:

  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.SourceGenerators.cs : Keep source generators deterministic and free of hidden environment or network dependencies

Applied to files:

  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.Tests.cs : Keep tests focused on observable behavior, not implementation trivia

Applied to files:

  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
📚 Learning: 2026-04-06T12:45:43.921Z
Learnt from: GeWuYou
Repo: GeWuYou/GFramework PR: 190
File: GFramework.Game/Config/GameConfigBootstrap.cs:1-3
Timestamp: 2026-04-06T12:45:43.921Z
Learning: In the GeWuYou/GFramework repository, C# files may omit explicit `using System*` imports because the project-wide `GlobalUsings.cs` (referenced via manual global `using` directives) supplies common namespaces (e.g., `System`, `System.Threading`, `System.Threading.Tasks`). During code review, do not flag missing `using System...` directives in `.cs` files as long as `GlobalUsings.cs` is present/used to provide those namespaces.

Applied to files:

  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.cs : Use the namespace pattern `GFramework.{Module}.{Feature}` with PascalCase segments

Applied to files:

  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
🔇 Additional comments (1)
GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs (1)

2-2: 命名空间迁移覆盖完整且与生成器入口保持一致

这次把测试中的生成器引用与内嵌源码中的 Attribute 命名空间统一迁移到 GFramework.Core.SourceGenerators.*,五个快照用例都同步到了,变更方向正确且一致性很好。

Based on learnings: Preserve snapshot-based verification patterns already used in the repository for source generator tests.

Also applies to: 16-16, 28-28, 56-56, 68-68, 95-95, 107-107, 137-137, 149-149, 176-176, 188-188

coderabbitai[bot]
coderabbitai Bot previously approved these changes Apr 16, 2026
- 实现基本枚举的 IsMethods 快照测试
- 实现基本枚举的 IsInMethod 快照测试
- 实现带标志值枚举的快照测试
- 实现禁用 IsMethods 选项的快照测试
- 实现禁用 IsInMethod 选项的快照测试
- 创建统一的源代码构建方法用于测试场景
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs (1)

83-116: 建议补一个“双开关同时关闭”的快照用例。

当前只覆盖了单开关关闭分支;GenerateIsMethodsGenerateIsInMethod 的组合分支还缺一档,回归时容易漏检。

可直接补充的测试示例
+    [Test]
+    public async Task Snapshot_DisableAllGeneratedMethods()
+    {
+        var source = BuildSource(
+            """
+            public enum Status
+            {
+                Active,
+                Inactive
+            }
+            """,
+            "[GenerateEnumExtensions(GenerateIsMethods = false, GenerateIsInMethod = false)]");
+
+        await GeneratorSnapshotTest<EnumExtensionsGenerator>.RunAsync(
+            source,
+            Path.Combine(
+                TestContext.CurrentContext.TestDirectory,
+                "enums",
+                "snapshots",
+                "EnumExtensionsGenerator",
+                "DisableAllGeneratedMethods"));
+    }

Based on learnings: When a public API defines multiple contract branches, tests MUST cover the meaningful variants, including null, empty, default, and filtered inputs when those branches change behavior.

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

In
`@GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs`
around lines 83 - 116, Add a snapshot test that covers the combination where
both GenerateIsMethods and GenerateIsInMethod are disabled: create a new async
test method (e.g., Snapshot_DisableBothIsMethodsAndIsInMethod) that uses
BuildSource with the same enum source and the attribute
"[GenerateEnumExtensions(GenerateIsMethods = false, GenerateIsInMethod =
false)]" and then calls GeneratorSnapshotTest<EnumExtensionsGenerator>.RunAsync
with the same snapshot folder pattern used by the other tests; this ensures the
combined branch for GenerateIsMethods and GenerateIsInMethod is recorded and
validated alongside Snapshot_DisableIsMethods and Snapshot_DisableIsInMethod.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs`:
- Around line 128-151: Document the BuildSource method to explain why source is
constructed inline: note that it intentionally declares
GenerateEnumExtensionsAttribute inside a fixed metadata namespace
(EnumAttributeNamespace) and inlines the attribute type to keep tests
self-contained, that the method relies on string interpolation of enumBody and
attributeUsage to inject test enums and alternate attribute usages, and state
the semantic assumptions and synchronization constraints (e.g., tests depend on
this exact attribute shape, default property values
GenerateIsMethods/GenerateIsInMethod, and the namespace must not be renamed or
moved); also mention edge cases to watch for (missing/invalid enumBody or custom
attributeUsage) so future renames/migrations update these tests accordingly.

---

Nitpick comments:
In
`@GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs`:
- Around line 83-116: Add a snapshot test that covers the combination where both
GenerateIsMethods and GenerateIsInMethod are disabled: create a new async test
method (e.g., Snapshot_DisableBothIsMethodsAndIsInMethod) that uses BuildSource
with the same enum source and the attribute
"[GenerateEnumExtensions(GenerateIsMethods = false, GenerateIsInMethod =
false)]" and then calls GeneratorSnapshotTest<EnumExtensionsGenerator>.RunAsync
with the same snapshot folder pattern used by the other tests; this ensures the
combined branch for GenerateIsMethods and GenerateIsInMethod is recorded and
validated alongside Snapshot_DisableIsMethods and Snapshot_DisableIsInMethod.
🪄 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: 2ebf6b30-68ef-420e-9300-aa1cf2b201fe

📥 Commits

Reviewing files that changed from the base of the PR and between 534818f and 08b12ae.

📒 Files selected for processing (1)
  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
📜 Review details
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Analyze (C#)
  • GitHub Check: Code Quality & Security
🧰 Additional context used
📓 Path-based instructions (1)
**/*.cs

📄 CodeRabbit inference engine (AGENTS.md)

**/*.cs: All public, protected, and internal types and members in C# MUST include XML documentation comments (///) using <summary>, <param>, <returns>, <exception>, and <remarks> tags where applicable
XML documentation comments must explain intent, contract, and usage constraints instead of restating syntax
If a member participates in lifecycle, threading, registration, or disposal behavior, document that behavior explicitly in XML documentation
Add inline comments for non-trivial logic, concurrency or threading behavior, performance-sensitive paths, workarounds and edge cases, and registration order or lifecycle sequencing
Avoid obvious comments such as // increment i
Core framework components such as Architecture, Module, System, Context, Registry, Service Module, and Lifecycle types MUST include high-level explanations of responsibilities, lifecycle, interaction with other components, why the abstraction exists, and when to use it instead of alternatives
Generated logic and generator pipelines MUST explain what is generated, why it is generated, the semantic assumptions the generator relies on, and any diagnostics or fallback behavior
Methods with non-trivial logic MUST document the core idea, key decisions, and edge case handling, if any
Comments MUST NOT be trivial, redundant, or misleading. Prefer explaining why and when, not just what
Code should remain understandable without requiring external context. Prefer slightly more explanation over too little for framework code
Missing required documentation is a coding standards violation. Code that does not meet the documentation rules is considered incomplete
Do not rely on implicit imports. Declare every required using explicitly in C# files
Write null-safe code that respects nullable annotations instead of suppressing warnings by default
Use the namespace pattern GFramework.{Module}.{Feature} with PascalCase segments
Follow standard C# naming: Types, methods, properties, events, and con...

Files:

  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
🧠 Learnings (12)
📓 Common learnings
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-16T11:54:13.310Z
Learning: Applies to **/*.cs : Use CQRS with 'Cqrs' naming for new code; legacy 'Mediator' aliases are deprecated
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T13:50:46.125Z
Learning: Repository structure must follow Abstractions layer + Implementation layer + Integration layer + Generator layer organization with stable abstractions, replaceable implementations, isolated engine integration, and independently evolving generator capabilities
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T13:50:46.125Z
Learning: Framework design must prioritize clear module boundaries, composable service registration, stable abstract contracts, and moderate automation through source generation to build a long-term maintainable game development framework
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.SourceGenerators.Tests.cs : Preserve snapshot-based verification patterns already used in the repository for source generator tests

Applied to files:

  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.SourceGenerators.cs : When generator behavior changes intentionally, update snapshots together with the implementation

Applied to files:

  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.SourceGenerators.Tests.cs : Source generator changes MUST be covered by generator tests

Applied to files:

  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
📚 Learning: 2026-04-16T13:25:59.124Z
Learnt from: GeWuYou
Repo: GeWuYou/GFramework PR: 235
File: GFramework.SourceGenerators.Tests/Rule/ContextAwareGeneratorSnapshotTests.cs:1-3
Timestamp: 2026-04-16T13:25:59.124Z
Learning: In the GeWuYou/GFramework repo, treat `global using NUnit.Framework;` as provided project-wide by `GFramework.SourceGenerators.Tests/GlobalUsings.cs` (via GlobalUsings.cs). Do not require or flag missing per-file `using NUnit.Framework;` directives in test `.cs` files under `GFramework.SourceGenerators.Tests/`, since the project-wide global usings already include NUnit (along with other common namespaces).

Applied to files:

  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.Tests.csproj : Public API changes must be covered by unit or integration tests

Applied to files:

  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
📚 Learning: 2026-04-16T11:54:13.310Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-16T11:54:13.310Z
Learning: Applies to **/GFramework.SourceGenerators/**/*.cs : SourceGenerators project should focus on Roslyn incremental source code generation and shared infrastructure

Applied to files:

  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.SourceGenerators.cs : Keep source generators deterministic and free of hidden environment or network dependencies

Applied to files:

  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
📚 Learning: 2026-04-16T11:54:13.310Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-16T11:54:13.310Z
Learning: Applies to **/GFramework.SourceGenerators/**/*.cs : Source generators should be used to reduce boilerplate code while maintaining framework API consistency and maintainability

Applied to files:

  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.Tests.cs : Keep tests focused on observable behavior, not implementation trivia

Applied to files:

  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.Tests.cs : When a public API defines multiple contract branches, tests MUST cover the meaningful variants, including null, empty, default, and filtered inputs when those branches change behavior

Applied to files:

  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
📚 Learning: 2026-04-06T12:45:43.921Z
Learnt from: GeWuYou
Repo: GeWuYou/GFramework PR: 190
File: GFramework.Game/Config/GameConfigBootstrap.cs:1-3
Timestamp: 2026-04-06T12:45:43.921Z
Learning: In the GeWuYou/GFramework repository, C# files may omit explicit `using System*` imports because the project-wide `GlobalUsings.cs` (referenced via manual global `using` directives) supplies common namespaces (e.g., `System`, `System.Threading`, `System.Threading.Tasks`). During code review, do not flag missing `using System...` directives in `.cs` files as long as `GlobalUsings.cs` is present/used to provide those namespaces.

Applied to files:

  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
🔇 Additional comments (1)
GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs (1)

2-11: 命名空间迁移与 BuildSource 抽取做得很好。

这次把测试输入统一收敛到一个构建入口,配合 GFramework.Core.SourceGenerators.* 迁移后,快照测试可维护性明显更好。

Also applies to: 15-46, 128-151

GeWuYou added 3 commits April 16, 2026 22:16
- 实现 EnumExtensionsGenerator 自动生成枚举扩展方法
- 支持 GenerateIsMethods 和 GenerateIsInMethod 两种生成开关
- 添加完整的单元测试和快照验证机制
- 实现 IsIn 扩展方法支持多值匹配功能
- 支持带显式位标志值的枚举生成扩展方法
- 提供灵活的属性参数配置选项
- 添加 isDirectChildOfRoot 参数说明到 ParseProperty 方法
- 添加 isIndexedLookup 参数说明到 ParseArrayProperty 方法
- 实现 GeneratorSnapshotTest 类用于源代码生成器的快照测试功能
- 添加 EnumExtensionsGeneratorSnapshotTests 测试类验证各种枚举配置的输出
- 创建完整的快照测试基础设施支持生成器输出验证
- 配置测试项目依赖和快照文件管理规则
- 生成多个测试场景的快照文件验证枚举扩展生成功能
@GeWuYou GeWuYou enabled auto-merge April 16, 2026 14:40
@GeWuYou
Copy link
Copy Markdown
Owner Author

GeWuYou commented Apr 16, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 16, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs (1)

31-35: 建议补一个不传 snapshotFileNameSelector 的用例,覆盖默认分支。

当前本文件所有 RunAsync 调用都传了 GetSnapshotFileName,建议至少保留一个“使用默认文件名”的场景,防止 null 分支回归。

可选补充用例(示例)
+    /// <summary>
+    ///     验证未提供快照文件名映射时,仍按生成文件名进行快照比对。
+    /// </summary>
+    [Test]
+    public async Task Snapshot_DefaultSnapshotFileNameSelector_Null()
+    {
+        var source = BuildSource(
+            """
+            public enum Status
+            {
+                Active,
+                Inactive
+            }
+            """);
+
+        await GeneratorSnapshotTest<EnumExtensionsGenerator>.RunAsync(
+            source,
+            GetSnapshotFolder("BasicEnum_IsMethods_DefaultSelector"));
+    }
Based on learnings: “When a public API defines multiple contract branches, tests MUST cover the meaningful variants, including null, empty, default, and filtered inputs when those branches change behavior”.

Also applies to: 52-56, 76-80, 98-102, 120-124, 142-145

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

In
`@GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs`
around lines 31 - 35, Add a test case that calls
GeneratorSnapshotTest<EnumExtensionsGenerator>.RunAsync without passing the
snapshotFileNameSelector (i.e., omit GetSnapshotFileName) to exercise the
default/null branch; update EnumExtensionsGeneratorSnapshotTests.cs to include
at least one invocation per the listed blocks (current occurrences around the
call sites using GetSnapshotFileName at lines similar to 31–35, 52–56, 76–80,
98–102, 120–124, 142–145) where you replace or add a variant that calls
RunAsync(source, GetSnapshotFolder("...")) so the code path that handles a
missing snapshotFileNameSelector is covered. Ensure the new test uses the same
source input and snapshot folder name as the paired tests so only the selector
absence is exercised.
GFramework.SourceGenerators.Tests/Core/GeneratorSnapshotTest.cs (1)

40-45: 建议约束快照文件名映射结果,避免越界到快照目录之外。

当前直接把 snapshotFileNameSelector 的返回值参与 Path.Combine。如果返回绝对路径或 .. 片段,会读写到快照目录之外,容易造成误写文件。

建议修改
             // 不同测试套件可能需要将生成文件映射到非 .cs 快照,以避免测试资产被当作可编译源码参与构建。
             var snapshotFileName = snapshotFileNameSelector?.Invoke(filename) ?? filename;
-            var path = Path.Combine(
-                snapshotFolder,
-                snapshotFileName);
+            if (string.IsNullOrWhiteSpace(snapshotFileName) || Path.IsPathRooted(snapshotFileName))
+            {
+                throw new InvalidOperationException($"Invalid snapshot file name: {snapshotFileName}");
+            }
+
+            var snapshotRoot = Path.GetFullPath(snapshotFolder);
+            var path = Path.GetFullPath(Path.Combine(snapshotRoot, snapshotFileName));
+            if (!path.StartsWith(snapshotRoot + Path.DirectorySeparatorChar, StringComparison.Ordinal))
+            {
+                throw new InvalidOperationException($"Snapshot path escapes root folder: {snapshotFileName}");
+            }
As per coding guidelines: “Validate external or user-controlled input before it reaches file system, serialization, reflection, code generation, or process boundaries”.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@GFramework.SourceGenerators.Tests/Core/GeneratorSnapshotTest.cs` around lines
40 - 45, The code currently trusts snapshotFileNameSelector's return and
directly combines it into path; validate and sanitize that result
(snapshotFileName) before Path.Combine: if snapshotFileNameSelector returns null
use filename; if Path.IsPathRooted(snapshotFileName) replace it with
Path.GetFileName(snapshotFileName) or reject it; resolve
Path.GetFullPath(Path.Combine(snapshotFolder, snapshotFileName)) and compare
against Path.GetFullPath(snapshotFolder) to ensure the resulting full path is
inside snapshotFolder (reject or fallback to filename if not), and also strip or
reject any ".." segments so the final combined path variable cannot escape the
snapshotFolder.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@GFramework.SourceGenerators.Tests/Core/GeneratorSnapshotTest.cs`:
- Around line 40-45: The code currently trusts snapshotFileNameSelector's return
and directly combines it into path; validate and sanitize that result
(snapshotFileName) before Path.Combine: if snapshotFileNameSelector returns null
use filename; if Path.IsPathRooted(snapshotFileName) replace it with
Path.GetFileName(snapshotFileName) or reject it; resolve
Path.GetFullPath(Path.Combine(snapshotFolder, snapshotFileName)) and compare
against Path.GetFullPath(snapshotFolder) to ensure the resulting full path is
inside snapshotFolder (reject or fallback to filename if not), and also strip or
reject any ".." segments so the final combined path variable cannot escape the
snapshotFolder.

In
`@GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs`:
- Around line 31-35: Add a test case that calls
GeneratorSnapshotTest<EnumExtensionsGenerator>.RunAsync without passing the
snapshotFileNameSelector (i.e., omit GetSnapshotFileName) to exercise the
default/null branch; update EnumExtensionsGeneratorSnapshotTests.cs to include
at least one invocation per the listed blocks (current occurrences around the
call sites using GetSnapshotFileName at lines similar to 31–35, 52–56, 76–80,
98–102, 120–124, 142–145) where you replace or add a variant that calls
RunAsync(source, GetSnapshotFolder("...")) so the code path that handles a
missing snapshotFileNameSelector is covered. Ensure the new test uses the same
source input and snapshot folder name as the paired tests so only the selector
absence is exercised.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 373c04f9-9952-4628-976c-11a976717e36

📥 Commits

Reviewing files that changed from the base of the PR and between 534818f and fe27dfe.

📒 Files selected for processing (11)
  • GFramework.Core.SourceGenerators/Enums/EnumExtensionsGenerator.cs
  • GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.cs
  • GFramework.SourceGenerators.Tests/Core/GeneratorSnapshotTest.cs
  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
  • GFramework.SourceGenerators.Tests/Enums/snapshots/EnumExtensionsGenerator/BasicEnum_IsInMethod/Status.EnumExtensions.g.txt
  • GFramework.SourceGenerators.Tests/Enums/snapshots/EnumExtensionsGenerator/BasicEnum_IsMethods/Status.EnumExtensions.g.txt
  • GFramework.SourceGenerators.Tests/Enums/snapshots/EnumExtensionsGenerator/DisableAllGeneratedMethods/Status.EnumExtensions.g.txt
  • GFramework.SourceGenerators.Tests/Enums/snapshots/EnumExtensionsGenerator/DisableIsInMethod/Status.EnumExtensions.g.txt
  • GFramework.SourceGenerators.Tests/Enums/snapshots/EnumExtensionsGenerator/DisableIsMethods/Status.EnumExtensions.g.txt
  • GFramework.SourceGenerators.Tests/Enums/snapshots/EnumExtensionsGenerator/EnumWithFlagValues/Permissions.EnumExtensions.g.txt
  • GFramework.SourceGenerators.Tests/GFramework.SourceGenerators.Tests.csproj
✅ Files skipped from review due to trivial changes (8)
  • GFramework.SourceGenerators.Tests/GFramework.SourceGenerators.Tests.csproj
  • GFramework.SourceGenerators.Tests/Enums/snapshots/EnumExtensionsGenerator/DisableAllGeneratedMethods/Status.EnumExtensions.g.txt
  • GFramework.SourceGenerators.Tests/Enums/snapshots/EnumExtensionsGenerator/DisableIsInMethod/Status.EnumExtensions.g.txt
  • GFramework.SourceGenerators.Tests/Enums/snapshots/EnumExtensionsGenerator/DisableIsMethods/Status.EnumExtensions.g.txt
  • GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.cs
  • GFramework.SourceGenerators.Tests/Enums/snapshots/EnumExtensionsGenerator/BasicEnum_IsInMethod/Status.EnumExtensions.g.txt
  • GFramework.SourceGenerators.Tests/Enums/snapshots/EnumExtensionsGenerator/EnumWithFlagValues/Permissions.EnumExtensions.g.txt
  • GFramework.SourceGenerators.Tests/Enums/snapshots/EnumExtensionsGenerator/BasicEnum_IsMethods/Status.EnumExtensions.g.txt
🚧 Files skipped from review as they are similar to previous changes (1)
  • GFramework.Core.SourceGenerators/Enums/EnumExtensionsGenerator.cs
📜 Review details
🧰 Additional context used
📓 Path-based instructions (2)
**/*.cs

📄 CodeRabbit inference engine (AGENTS.md)

**/*.cs: All public, protected, and internal types and members in C# MUST include XML documentation comments (///) using <summary>, <param>, <returns>, <exception>, and <remarks> tags where applicable
XML documentation comments must explain intent, contract, and usage constraints instead of restating syntax
If a member participates in lifecycle, threading, registration, or disposal behavior, document that behavior explicitly in XML documentation
Add inline comments for non-trivial logic, concurrency or threading behavior, performance-sensitive paths, workarounds and edge cases, and registration order or lifecycle sequencing
Avoid obvious comments such as // increment i
Core framework components such as Architecture, Module, System, Context, Registry, Service Module, and Lifecycle types MUST include high-level explanations of responsibilities, lifecycle, interaction with other components, why the abstraction exists, and when to use it instead of alternatives
Generated logic and generator pipelines MUST explain what is generated, why it is generated, the semantic assumptions the generator relies on, and any diagnostics or fallback behavior
Methods with non-trivial logic MUST document the core idea, key decisions, and edge case handling, if any
Comments MUST NOT be trivial, redundant, or misleading. Prefer explaining why and when, not just what
Code should remain understandable without requiring external context. Prefer slightly more explanation over too little for framework code
Missing required documentation is a coding standards violation. Code that does not meet the documentation rules is considered incomplete
Do not rely on implicit imports. Declare every required using explicitly in C# files
Write null-safe code that respects nullable annotations instead of suppressing warnings by default
Use the namespace pattern GFramework.{Module}.{Feature} with PascalCase segments
Follow standard C# naming: Types, methods, properties, events, and con...

Files:

  • GFramework.SourceGenerators.Tests/Core/GeneratorSnapshotTest.cs
  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
**/GFramework.SourceGenerators*/**/*.cs

📄 CodeRabbit inference engine (CLAUDE.md)

SourceGenerators projects should contain Roslyn incremental source generators and shared infrastructure

Files:

  • GFramework.SourceGenerators.Tests/Core/GeneratorSnapshotTest.cs
  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
🧠 Learnings (17)
📓 Common learnings
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-16T11:54:13.310Z
Learning: Applies to **/*.cs : Use CQRS with 'Cqrs' naming for new code; legacy 'Mediator' aliases are deprecated
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T14:44:01.785Z
Learning: Follow all coding rules defined in AGENTS.md
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T14:44:01.785Z
Learning: Model layer (IModel) should be responsible for long-term state and business data modeling
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T14:44:01.785Z
Learning: System layer (ISystem) should handle command execution, process orchestration, and rule implementation
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T14:44:01.785Z
Learning: Utility layer (IUtility) should provide stateless utilities for reuse by other layers
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T14:44:01.785Z
Learning: Organize repository code using abstraction layer + implementation layer + integration layer + generator layer structure
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-16T14:44:01.785Z
Learning: Design the framework with clear module boundaries, composable service registration, stable abstraction contracts, and moderate automation through source generation for long-term evolution
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.SourceGenerators.Tests.cs : Preserve snapshot-based verification patterns already used in the repository for source generator tests

Applied to files:

  • GFramework.SourceGenerators.Tests/Core/GeneratorSnapshotTest.cs
  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.SourceGenerators.cs : When generator behavior changes intentionally, update snapshots together with the implementation

Applied to files:

  • GFramework.SourceGenerators.Tests/Core/GeneratorSnapshotTest.cs
  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.SourceGenerators.Tests.cs : Source generator changes MUST be covered by generator tests

Applied to files:

  • GFramework.SourceGenerators.Tests/Core/GeneratorSnapshotTest.cs
  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
📚 Learning: 2026-04-16T11:54:13.310Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-16T11:54:13.310Z
Learning: Applies to **/GFramework.SourceGenerators/**/*.cs : SourceGenerators project should focus on Roslyn incremental source code generation and shared infrastructure

Applied to files:

  • GFramework.SourceGenerators.Tests/Core/GeneratorSnapshotTest.cs
  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
📚 Learning: 2026-04-16T13:25:59.124Z
Learnt from: GeWuYou
Repo: GeWuYou/GFramework PR: 235
File: GFramework.SourceGenerators.Tests/Rule/ContextAwareGeneratorSnapshotTests.cs:1-3
Timestamp: 2026-04-16T13:25:59.124Z
Learning: In the GeWuYou/GFramework repo, treat `global using NUnit.Framework;` as provided project-wide by `GFramework.SourceGenerators.Tests/GlobalUsings.cs` (via GlobalUsings.cs). Do not require or flag missing per-file `using NUnit.Framework;` directives in test `.cs` files under `GFramework.SourceGenerators.Tests/`, since the project-wide global usings already include NUnit (along with other common namespaces).

Applied to files:

  • GFramework.SourceGenerators.Tests/Core/GeneratorSnapshotTest.cs
  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.SourceGenerators.cs : Keep source generators deterministic and free of hidden environment or network dependencies

Applied to files:

  • GFramework.SourceGenerators.Tests/Core/GeneratorSnapshotTest.cs
  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.Tests.csproj : Public API changes must be covered by unit or integration tests

Applied to files:

  • GFramework.SourceGenerators.Tests/Core/GeneratorSnapshotTest.cs
  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
📚 Learning: 2026-04-16T11:54:13.310Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-16T11:54:13.310Z
Learning: Applies to **/GFramework.SourceGenerators/**/*.cs : Source generators should be used to reduce boilerplate code while maintaining framework API consistency and maintainability

Applied to files:

  • GFramework.SourceGenerators.Tests/Core/GeneratorSnapshotTest.cs
  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.Tests.cs : Regression fixes should include a test that fails before the fix and passes after it

Applied to files:

  • GFramework.SourceGenerators.Tests/Core/GeneratorSnapshotTest.cs
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.Tests.csproj : Every non-trivial feature, bug fix, or behavior change MUST include tests or an explicit justification for why a test is not practical

Applied to files:

  • GFramework.SourceGenerators.Tests/Core/GeneratorSnapshotTest.cs
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.cs : Use the namespace pattern `GFramework.{Module}.{Feature}` with PascalCase segments

Applied to files:

  • GFramework.SourceGenerators.Tests/Core/GeneratorSnapshotTest.cs
📚 Learning: 2026-04-06T12:45:43.921Z
Learnt from: GeWuYou
Repo: GeWuYou/GFramework PR: 190
File: GFramework.Game/Config/GameConfigBootstrap.cs:1-3
Timestamp: 2026-04-06T12:45:43.921Z
Learning: In the GeWuYou/GFramework repository, C# files may omit explicit `using System*` imports because the project-wide `GlobalUsings.cs` (referenced via manual global `using` directives) supplies common namespaces (e.g., `System`, `System.Threading`, `System.Threading.Tasks`). During code review, do not flag missing `using System...` directives in `.cs` files as long as `GlobalUsings.cs` is present/used to provide those namespaces.

Applied to files:

  • GFramework.SourceGenerators.Tests/Core/GeneratorSnapshotTest.cs
  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
📚 Learning: 2026-04-16T11:54:13.310Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-16T11:54:13.310Z
Learning: Applies to **/{GFramework.Core,GFramework.Game,GFramework.Ecs.Arch}/**/*.cs : Core / Game / Ecs.Arch implementation projects should be platform-agnostic

Applied to files:

  • GFramework.SourceGenerators.Tests/Core/GeneratorSnapshotTest.cs
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.Tests.cs : Keep tests focused on observable behavior, not implementation trivia

Applied to files:

  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
📚 Learning: 2026-04-16T11:55:23.932Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.932Z
Learning: Applies to **/*.Tests.cs : When a public API defines multiple contract branches, tests MUST cover the meaningful variants, including null, empty, default, and filtered inputs when those branches change behavior

Applied to files:

  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
📚 Learning: 2026-04-16T11:55:23.931Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-16T11:55:23.931Z
Learning: Applies to **/*.cs : Generated logic and generator pipelines MUST explain what is generated, why it is generated, the semantic assumptions the generator relies on, and any diagnostics or fallback behavior

Applied to files:

  • GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs
🔇 Additional comments (2)
GFramework.SourceGenerators.Tests/Core/GeneratorSnapshotTest.cs (1)

17-23: 扩展点设计与文档同步做得很好。

RunAsync 通过可选参数保持了向后兼容,同时断言信息改为使用映射后的快照名,排障体验更直观。

Also applies to: 61-61

GFramework.SourceGenerators.Tests/Enums/EnumExtensionsGeneratorSnapshotTests.cs (1)

126-146: 测试基建重构与场景补充方向正确。

新增“两个开关都关闭”的快照场景 + BuildSource 的语义约束说明,让生成器行为契约更清晰,也更利于后续重构。

Based on learnings: “Preserve snapshot-based verification patterns already used in the repository for source generator tests” and “Source generator changes MUST be covered by generator tests”.

Also applies to: 148-212

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