Skip to content

docs(generators): 添加 Priority 和 Context Get 生成器文档#149

Merged
GeWuYou merged 3 commits into
mainfrom
docs/generators-priority-context-injection
Mar 29, 2026
Merged

docs(generators): 添加 Priority 和 Context Get 生成器文档#149
GeWuYou merged 3 commits into
mainfrom
docs/generators-priority-context-injection

Conversation

@GeWuYou
Copy link
Copy Markdown
Owner

@GeWuYou GeWuYou commented Mar 29, 2026

  • 新增 Priority 生成器文档,介绍自动实现 IPrioritized 接口的功能
  • 新增 Context Get 注入生成器文档,说明自动注入架构组件的特性
  • 更新索引页面,添加新生成器的导航链接和功能描述
  • 补充 EnumGenerator 配置选项说明,列出已实现和未实现的选项
  • 添加完整的诊断信息说明,涵盖新生成器的所有错误场景

Summary by Sourcery

为 Priority 和 Context Get 源生成器及其诊断编写文档,并明确 EnumGenerator 的配置选项。

Documentation:

  • 新增 Priority 生成器文档,包括概览、使用模式、最佳实践以及完整的诊断参考。
  • 新增 Context Get 注入生成器文档,涵盖支持的特性(attributes)、使用场景、智能推断规则和诊断信息。
  • 更新源生成器索引,将 Priority 和 Context Get 生成器及其关键能力纳入其中。
  • 记录当前已支持和尚未实现的枚举扩展生成器特性(enum extensions generator attribute)配置选项。
Original summary in English

Summary by Sourcery

Document Priority and Context Get source generators and their diagnostics, and clarify EnumGenerator configuration options.

Documentation:

  • Add Priority generator documentation including overview, usage patterns, best practices, and full diagnostic reference.
  • Add Context Get injection generator documentation covering supported attributes, scenarios, smart inference rules, and diagnostics.
  • Update source generators index to include Priority and Context Get generators along with their key capabilities.
  • Document currently supported and not-yet-implemented options for the enum extensions generator attribute.

- 新增 Priority 生成器文档,介绍自动实现 IPrioritized 接口的功能
- 新增 Context Get 注入生成器文档,说明自动注入架构组件的特性
- 更新索引页面,添加新生成器的导航链接和功能描述
- 补充 EnumGenerator 配置选项说明,列出已实现和未实现的选项
- 添加完整的诊断信息说明,涵盖新生成器的所有错误场景
@deepsource-io
Copy link
Copy Markdown

deepsource-io Bot commented Mar 29, 2026

DeepSource Code Review

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

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
C# Mar 29, 2026 12:23p.m. Review ↗
Secrets Mar 29, 2026 12:23p.m. Review ↗

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Mar 29, 2026

审阅者指南

为新的 Priority 和 Context Get 源生成器添加了完整的中文文档,将它们接入生成器索引(包括诊断和分析器行为),澄清了 EnumGenerator 已支持/未支持的选项,并为这些新生成器相关的所有诊断项编写了文档。

Context Get 注入与 __InjectContextBindings_Generated 的时序图

sequenceDiagram
    participant Architecture as Architecture
    participant PlayerController as PlayerController
    participant ContextGetGenerator as ContextGetGenerator

    rect rgb(230,230,230)
        ContextGetGenerator->>ContextGetGenerator: Analyze PlayerController fields
        ContextGetGenerator->>ContextGetGenerator: Detect GetModel GetSystem GetUtility GetService attributes
        ContextGetGenerator->>PlayerController: Generate __InjectContextBindings_Generated()
    end

    PlayerController->>PlayerController: __InjectContextBindings_Generated()
    PlayerController->>Architecture: GetModel~IPlayerModel~()
    Architecture-->>PlayerController: IPlayerModel instance
    PlayerController->>PlayerController: assign _playerModel

    PlayerController->>Architecture: GetSystem~ICombatSystem~()
    Architecture-->>PlayerController: ICombatSystem instance
    PlayerController->>PlayerController: assign _combatSystem

    PlayerController->>Architecture: GetUtility~IPathFinder~()
    Architecture-->>PlayerController: IPathFinder instance
    PlayerController->>PlayerController: assign _pathFinder

    PlayerController->>Architecture: GetService~IAudioService~()
    Architecture-->>PlayerController: IAudioService instance
    PlayerController->>PlayerController: assign _audioService

    PlayerController->>PlayerController: Initialize() uses injected fields
Loading

基于 Priority 的检索与分析器推荐的时序图

sequenceDiagram
    participant Architecture as Architecture
    participant GameArchitecture as GameArchitecture
    participant SystemA as InputSystem
    participant SystemB as PhysicsSystem
    participant SystemC as GameplaySystem
    participant PriorityUsageAnalyzer as PriorityUsageAnalyzer

    rect rgb(230,230,230)
        PriorityUsageAnalyzer->>GameArchitecture: Inspect call GetAll~ISystem~()
        PriorityUsageAnalyzer-->>GameArchitecture: Diagnostic GF_Priority_Usage_001
    end

    GameArchitecture->>Architecture: GetAllByPriority~ISystem~()
    Architecture->>SystemA: read Priority
    Architecture->>SystemB: read Priority
    Architecture->>SystemC: read Priority
    Architecture-->>GameArchitecture: List~ISystem~ sortedByPriority

    loop ForEach system in sorted list
        GameArchitecture->>SystemA: Init()
        GameArchitecture->>SystemB: Init()
        GameArchitecture->>SystemC: Init()
    end
Loading

Priority 生成器与 IPrioritized 生态的类图

classDiagram
    class IPrioritized {
        +int Priority
    }

    class PriorityAttribute {
        +int value
    }

    class PriorityGroup {
        +const int Critical
        +const int High
        +const int Normal
        +const int Low
        +const int Deferred
    }

    class AbstractSystem {
        <<abstract>>
        +void Init()
        +void InitAsync()
    }

    class InputSystem {
        +void OnInit()
    }

    class PhysicsSystem {
        +void OnInit()
    }

    class GameplaySystem {
        +void OnInit()
    }

    class AudioSystem {
        +void OnInit()
    }

    class CleanupSystem {
        +void OnInit()
    }

    class Architecture {
        +List~T~ GetAll~T~()
        +List~T~ GetAllByPriority~T~()
    }

    class PriorityGenerator {
        +void Execute()
    }

    class PriorityUsageAnalyzer {
        +void AnalyzeInvocation()
    }

    PriorityAttribute o-- PriorityGroup : uses
    PriorityAttribute ..> IPrioritized : generates_implementation

    IPrioritized <|.. AbstractSystem
    AbstractSystem <|-- InputSystem
    AbstractSystem <|-- PhysicsSystem
    AbstractSystem <|-- GameplaySystem
    AbstractSystem <|-- AudioSystem
    AbstractSystem <|-- CleanupSystem

    Architecture ..> IPrioritized : GetAllByPriority

    PriorityGenerator ..> PriorityAttribute : reads
    PriorityGenerator ..> IPrioritized : implements

    PriorityUsageAnalyzer ..> Architecture : inspects_GetAll
    PriorityUsageAnalyzer ..> IPrioritized : detects_usage
Loading

Context Get 注入与 ContextAware 生态的类图

classDiagram
    class IContextAware {
        +IArchitecture Architecture
        +void SetContextProvider(IContextProvider provider)
    }

    class ContextAwareAttribute {
    }

    class ContextAwareBase {
        +IArchitecture Architecture
        +void SetContextProvider(IContextProvider provider)
    }

    class IArchitecture {
        +T GetModel~T~()
        +IReadOnlyList~T~ GetModels~T~()
        +T GetSystem~T~()
        +IReadOnlyList~T~ GetSystems~T~()
        +T GetUtility~T~()
        +IReadOnlyList~T~ GetUtilities~T~()
        +T GetService~T~()
        +IReadOnlyList~T~ GetServices~T~()
    }

    class IModel {
    }

    class ISystem {
    }

    class IUtility {
    }

    class GetModelAttribute {
    }

    class GetModelsAttribute {
    }

    class GetSystemAttribute {
    }

    class GetSystemsAttribute {
    }

    class GetUtilityAttribute {
    }

    class GetUtilitiesAttribute {
    }

    class GetServiceAttribute {
    }

    class GetServicesAttribute {
    }

    class GetAllAttribute {
    }

    class PlayerController {
        -IPlayerModel _playerModel
        -ICombatSystem _combatSystem
        -IPathFinder _pathFinder
        -IAudioService _audioService
        -void __InjectContextBindings_Generated()
        +void Initialize()
    }

    IContextAware <|.. ContextAwareBase
    ContextAwareAttribute ..> IContextAware : marks

    IArchitecture ..> IModel
    IArchitecture ..> ISystem
    IArchitecture ..> IUtility

    GetModelAttribute ..> IModel : target_type
    GetModelsAttribute ..> IModel : collection_type
    GetSystemAttribute ..> ISystem : target_type
    GetSystemsAttribute ..> ISystem : collection_type
    GetUtilityAttribute ..> IUtility : target_type
    GetUtilitiesAttribute ..> IUtility : collection_type
    GetServiceAttribute ..> IArchitecture : target_type
    GetServicesAttribute ..> IArchitecture : collection_type

    GetAllAttribute ..> IModel : infers
    GetAllAttribute ..> ISystem : infers
    GetAllAttribute ..> IUtility : infers

    PlayerController ..|> IContextAware
    PlayerController ..> GetModelAttribute
    PlayerController ..> GetSystemAttribute
    PlayerController ..> GetUtilityAttribute
    PlayerController ..> GetServiceAttribute
    PlayerController ..> GetAllAttribute
Loading

文件级变更

Change Details Files
在主源生成器索引中暴露 Priority 和 Context Get 生成器,并描述它们的高层行为和诊断信息。
  • 扩展生成器索引导航,增加指向 Priority attribute 生成器和 Context Get 注入生成器的锚点。
  • 添加简要特性要点,说明 Priority 会自动实现 IPrioritized,而 Context Get 会自动注入架构组件(包括 GetAll 的智能推断)。
  • 在索引中为 Priority 和 Context Get 生成器新增诊断小节,记录分析器使用建议,例如 GetAllByPriority。
docs/zh-CN/source-generators/index.md
澄清 GenerateEnumExtensions 实际已支持和当前尚未实现的配置选项。
  • 新增配置表,仅列出 GenerateIsMethods 和 GenerateIsInMethod 为已支持选项,并给出默认值和行为说明。
  • 明确指出 GenerateHasMethod 和 IncludeToString 目前只是定义但尚未实现,通过示例说明它们会被忽略,并注明它们计划在未来版本中实现。
docs/zh-CN/source-generators/enum-generator.md
为 Priority 源生成器添加完整文档,包括使用模式、语义、分析器集成、诊断以及最佳实践。
  • 描述 Priority 生成器的作用(自动实现 IPrioritized)、典型用例以及生成代码的形态。
  • 记录 Priority 数值语义、PriorityGroup 常量,以及多种应用场景(系统初始化顺序、事件处理程序、服务等),并配有示例。
  • 解释与 PriorityUsageAnalyzer 的集成,并详细说明所有 GF_Priority_00x 诊断项,附带代码示例和修复方式。
  • 提供最佳实践、高级用法(泛型、与其他生成器组合)、常见问题解答(FAQ),以及端到端使用示例。
docs/zh-CN/source-generators/priority-generator.md
为 Context Get 注入生成器添加完整文档,涵盖属性集合、注入规则、生成代码、诊断和实践指南。
  • 介绍 9 个受支持的注入属性、它们的作用目标、行为和类型约束,并解释它们与 ContextAware/IContextAware 的关系。
  • 说明基础的单实例和集合注入,以及类级别 [GetAll] 的智能推断及其包含/排除规则(例如 services、Godot.Node)。
  • 展示生成的注入方法模式和推荐的调用时机,并给出多种使用场景(控制器、策略、Godot 集成)。
  • 详细说明所有 GF_ContextGet_00x 诊断项,附示例和解决方案,并提供最佳实践、高级场景(泛型、多架构、测试)以及常见问题解答(FAQ)。
docs/zh-CN/source-generators/context-get-generator.md

提示与命令

与 Sourcery 交互

  • 触发新审阅: 在 pull request 中评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审阅评论。
  • 从审阅评论生成 GitHub issue: 在某条审阅评论下回复,要求 Sourcery 基于该评论创建 issue。你也可以直接在该评论下回复 @sourcery-ai issue 来创建 issue。
  • 生成 pull request 标题: 在 pull request 标题中任意位置写上 @sourcery-ai,即可随时生成标题。你也可以在 pull request 中评论 @sourcery-ai title 以(重新)生成标题。
  • 生成 pull request 摘要: 在 pull request 正文中任意位置写上 @sourcery-ai summary,即可在对应位置生成 PR 摘要。你也可以评论 @sourcery-ai summary 以在任意时间(重新)生成摘要。
  • 生成审阅者指南: 在 pull request 中评论 @sourcery-ai guide,即可随时(重新)生成审阅者指南。
  • 一次性解决所有 Sourcery 评论: 在 pull request 中评论 @sourcery-ai resolve,以标记所有 Sourcery 评论为已解决。如果你已经处理完所有评论且不希望再看到它们,这个命令非常有用。
  • 忽略所有 Sourcery 审阅: 在 pull request 中评论 @sourcery-ai dismiss,即可忽略所有现有 Sourcery 审阅。特别适合你想从头开始一次全新审阅的情况 —— 别忘了随后再评论 @sourcery-ai review 以触发新审阅!

自定义体验

打开你的 dashboard 以:

  • 启用或禁用审阅特性,例如 Sourcery 生成的 pull request 摘要、审阅者指南等。
  • 更改审阅语言。
  • 添加、移除或编辑自定义审阅指令。
  • 调整其他审阅设置。

获取帮助

Original review guide in English

Reviewer's Guide

Adds comprehensive Chinese documentation for the new Priority and Context Get source generators, wires them into the generators index (including diagnostics and analyzer behavior), clarifies supported/unsupported EnumGenerator options, and documents all related diagnostics for the new generators.

Sequence diagram for Context Get injection and __InjectContextBindings_Generated

sequenceDiagram
    participant Architecture as Architecture
    participant PlayerController as PlayerController
    participant ContextGetGenerator as ContextGetGenerator

    rect rgb(230,230,230)
        ContextGetGenerator->>ContextGetGenerator: Analyze PlayerController fields
        ContextGetGenerator->>ContextGetGenerator: Detect GetModel GetSystem GetUtility GetService attributes
        ContextGetGenerator->>PlayerController: Generate __InjectContextBindings_Generated()
    end

    PlayerController->>PlayerController: __InjectContextBindings_Generated()
    PlayerController->>Architecture: GetModel~IPlayerModel~()
    Architecture-->>PlayerController: IPlayerModel instance
    PlayerController->>PlayerController: assign _playerModel

    PlayerController->>Architecture: GetSystem~ICombatSystem~()
    Architecture-->>PlayerController: ICombatSystem instance
    PlayerController->>PlayerController: assign _combatSystem

    PlayerController->>Architecture: GetUtility~IPathFinder~()
    Architecture-->>PlayerController: IPathFinder instance
    PlayerController->>PlayerController: assign _pathFinder

    PlayerController->>Architecture: GetService~IAudioService~()
    Architecture-->>PlayerController: IAudioService instance
    PlayerController->>PlayerController: assign _audioService

    PlayerController->>PlayerController: Initialize() uses injected fields
Loading

Sequence diagram for Priority based retrieval and analyzer recommendation

sequenceDiagram
    participant Architecture as Architecture
    participant GameArchitecture as GameArchitecture
    participant SystemA as InputSystem
    participant SystemB as PhysicsSystem
    participant SystemC as GameplaySystem
    participant PriorityUsageAnalyzer as PriorityUsageAnalyzer

    rect rgb(230,230,230)
        PriorityUsageAnalyzer->>GameArchitecture: Inspect call GetAll~ISystem~()
        PriorityUsageAnalyzer-->>GameArchitecture: Diagnostic GF_Priority_Usage_001
    end

    GameArchitecture->>Architecture: GetAllByPriority~ISystem~()
    Architecture->>SystemA: read Priority
    Architecture->>SystemB: read Priority
    Architecture->>SystemC: read Priority
    Architecture-->>GameArchitecture: List~ISystem~ sortedByPriority

    loop ForEach system in sorted list
        GameArchitecture->>SystemA: Init()
        GameArchitecture->>SystemB: Init()
        GameArchitecture->>SystemC: Init()
    end
Loading

Class diagram for Priority generator and IPrioritized ecosystem

classDiagram
    class IPrioritized {
        +int Priority
    }

    class PriorityAttribute {
        +int value
    }

    class PriorityGroup {
        +const int Critical
        +const int High
        +const int Normal
        +const int Low
        +const int Deferred
    }

    class AbstractSystem {
        <<abstract>>
        +void Init()
        +void InitAsync()
    }

    class InputSystem {
        +void OnInit()
    }

    class PhysicsSystem {
        +void OnInit()
    }

    class GameplaySystem {
        +void OnInit()
    }

    class AudioSystem {
        +void OnInit()
    }

    class CleanupSystem {
        +void OnInit()
    }

    class Architecture {
        +List~T~ GetAll~T~()
        +List~T~ GetAllByPriority~T~()
    }

    class PriorityGenerator {
        +void Execute()
    }

    class PriorityUsageAnalyzer {
        +void AnalyzeInvocation()
    }

    PriorityAttribute o-- PriorityGroup : uses
    PriorityAttribute ..> IPrioritized : generates_implementation

    IPrioritized <|.. AbstractSystem
    AbstractSystem <|-- InputSystem
    AbstractSystem <|-- PhysicsSystem
    AbstractSystem <|-- GameplaySystem
    AbstractSystem <|-- AudioSystem
    AbstractSystem <|-- CleanupSystem

    Architecture ..> IPrioritized : GetAllByPriority

    PriorityGenerator ..> PriorityAttribute : reads
    PriorityGenerator ..> IPrioritized : implements

    PriorityUsageAnalyzer ..> Architecture : inspects_GetAll
    PriorityUsageAnalyzer ..> IPrioritized : detects_usage
Loading

Class diagram for Context Get injection and ContextAware ecosystem

classDiagram
    class IContextAware {
        +IArchitecture Architecture
        +void SetContextProvider(IContextProvider provider)
    }

    class ContextAwareAttribute {
    }

    class ContextAwareBase {
        +IArchitecture Architecture
        +void SetContextProvider(IContextProvider provider)
    }

    class IArchitecture {
        +T GetModel~T~()
        +IReadOnlyList~T~ GetModels~T~()
        +T GetSystem~T~()
        +IReadOnlyList~T~ GetSystems~T~()
        +T GetUtility~T~()
        +IReadOnlyList~T~ GetUtilities~T~()
        +T GetService~T~()
        +IReadOnlyList~T~ GetServices~T~()
    }

    class IModel {
    }

    class ISystem {
    }

    class IUtility {
    }

    class GetModelAttribute {
    }

    class GetModelsAttribute {
    }

    class GetSystemAttribute {
    }

    class GetSystemsAttribute {
    }

    class GetUtilityAttribute {
    }

    class GetUtilitiesAttribute {
    }

    class GetServiceAttribute {
    }

    class GetServicesAttribute {
    }

    class GetAllAttribute {
    }

    class PlayerController {
        -IPlayerModel _playerModel
        -ICombatSystem _combatSystem
        -IPathFinder _pathFinder
        -IAudioService _audioService
        -void __InjectContextBindings_Generated()
        +void Initialize()
    }

    IContextAware <|.. ContextAwareBase
    ContextAwareAttribute ..> IContextAware : marks

    IArchitecture ..> IModel
    IArchitecture ..> ISystem
    IArchitecture ..> IUtility

    GetModelAttribute ..> IModel : target_type
    GetModelsAttribute ..> IModel : collection_type
    GetSystemAttribute ..> ISystem : target_type
    GetSystemsAttribute ..> ISystem : collection_type
    GetUtilityAttribute ..> IUtility : target_type
    GetUtilitiesAttribute ..> IUtility : collection_type
    GetServiceAttribute ..> IArchitecture : target_type
    GetServicesAttribute ..> IArchitecture : collection_type

    GetAllAttribute ..> IModel : infers
    GetAllAttribute ..> ISystem : infers
    GetAllAttribute ..> IUtility : infers

    PlayerController ..|> IContextAware
    PlayerController ..> GetModelAttribute
    PlayerController ..> GetSystemAttribute
    PlayerController ..> GetUtilityAttribute
    PlayerController ..> GetServiceAttribute
    PlayerController ..> GetAllAttribute
Loading

File-Level Changes

Change Details Files
Expose Priority and Context Get generators in the main source-generators index and describe their high-level behavior and diagnostics.
  • Extend the generators index navigation with anchors for Priority attribute generator and Context Get injection generator.
  • Add brief feature bullets explaining that Priority auto-implements IPrioritized and Context Get auto-injects architecture components including GetAll intelligent inference.
  • Document new diagnostics sections in the index for Priority and Context Get generators, including analyzer usage recommendations like GetAllByPriority.
docs/zh-CN/source-generators/index.md
Clarify the actual supported and currently-unimplemented configuration options for GenerateEnumExtensions.
  • Add a configuration table listing GenerateIsMethods and GenerateIsInMethod as the only supported options with defaults and behavior.
  • Explicitly call out GenerateHasMethod and IncludeToString as defined-but-unimplemented options, with example showing they are ignored and a note that they are planned for future versions.
docs/zh-CN/source-generators/enum-generator.md
Add full documentation for the Priority source generator, including usage patterns, semantics, analyzer integration, diagnostics, and best practices.
  • Describe what the Priority generator does (auto-implements IPrioritized), typical use cases, and generated code shape.
  • Document Priority value semantics, the PriorityGroup constants, and multiple application scenarios (system init ordering, event handlers, services) with examples.
  • Explain integration with PriorityUsageAnalyzer and detail all GF_Priority_00x diagnostics with code samples and fixes.
  • Provide best practices, advanced usage (generics, composition with other generators), FAQs, and end-to-end examples.
docs/zh-CN/source-generators/priority-generator.md
Add full documentation for the Context Get injection generator, covering attribute set, injection rules, generated code, diagnostics, and practices.
  • Introduce the 9 supported injection attributes, their targets, behaviors, and type constraints, and explain the relationship with ContextAware/IContextAware.
  • Describe basic single-instance and collection injection, as well as class-level [GetAll] intelligent inference and its inclusion/exclusion rules (e.g., services, Godot.Node).
  • Show the generated injection method pattern and recommended call timing, with several usage scenarios (controllers, strategies, Godot integration).
  • Detail all GF_ContextGet_00x diagnostics with examples and resolutions, plus best practices, advanced scenarios (generics, multi-architecture, testing), and FAQs.
docs/zh-CN/source-generators/context-get-generator.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

嗨,我这边有一些整体性的反馈:

  • The diagnostic sections for Priority 和 Context Get 在 index.md 与各自的专用文档中存在较大重复,建议保留一处为权威来源并在另一处做简化或链接引用,以便后续规则变更时减少同步维护成本。
  • Context Get 的示例中 __InjectContextBindings_Generated() 的调用方式比较分散(构造函数、_Ready、Initialize 等),可以在文档中集中增加一小节明确推荐的调用时机和模式,避免读者误以为可以在构造函数体中使用尚未注入的字段。
给 AI Agents 的提示
请根据本次代码评审中的评论进行修改:

## 总体评论
- The diagnostic sections for Priority 和 Context Get 在 index.md 与各自的专用文档中存在较大重复,建议保留一处为权威来源并在另一处做简化或链接引用,以便后续规则变更时减少同步维护成本。
- Context Get 的示例中 `__InjectContextBindings_Generated()` 的调用方式比较分散(构造函数、_Ready、Initialize 等),可以在文档中集中增加一小节明确推荐的调用时机和模式,避免读者误以为可以在构造函数体中使用尚未注入的字段。

Sourcery 对开源项目是免费的——如果你觉得我们的评审有帮助,欢迎分享 ✨
帮我变得更有用!请在每条评论上点击 👍 或 👎,我会根据你的反馈改进评审质量。
Original comment in English

Hey - I've left some high level feedback:

  • The diagnostic sections for Priority 和 Context Get 在 index.md 与各自的专用文档中存在较大重复,建议保留一处为权威来源并在另一处做简化或链接引用,以便后续规则变更时减少同步维护成本。
  • Context Get 的示例中 __InjectContextBindings_Generated() 的调用方式比较分散(构造函数、_Ready、Initialize 等),可以在文档中集中增加一小节明确推荐的调用时机和模式,避免读者误以为可以在构造函数体中使用尚未注入的字段。
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The diagnostic sections for Priority 和 Context Get 在 index.md 与各自的专用文档中存在较大重复,建议保留一处为权威来源并在另一处做简化或链接引用,以便后续规则变更时减少同步维护成本。
- Context Get 的示例中 `__InjectContextBindings_Generated()` 的调用方式比较分散(构造函数、_Ready、Initialize 等),可以在文档中集中增加一小节明确推荐的调用时机和模式,避免读者误以为可以在构造函数体中使用尚未注入的字段。

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

GeWuYou added 2 commits March 29, 2026 20:08
- 实现 safeGenericEscapePlugin 插件保护 Markdown 中的泛型语法
- 配置 Vite 构建选项提高代码块大小警告阈值至 1000
- 添加 Priority 生成器和 Context Get 注入文档链接
- 重构配置文件结构将插件函数移至顶部定义
- 确保代码块和 HTML 标签在转义过程中得到正确保护
- 在多个示例中添加 __InjectContextBindings_Generated() 调用
- 重写推荐调用时机与模式章节,强调在生命周期入口统一调用
- 添加 Godot 节点和测试场景的具体使用模式
- 重构诊断信息表格,整合 Priority 和 Context Get 相关诊断
- 更新 FAQ 部分关于构造函数使用的建议
@GeWuYou GeWuYou merged commit 76a1406 into main Mar 29, 2026
9 checks passed
@GeWuYou GeWuYou deleted the docs/generators-priority-context-injection branch March 29, 2026 12:30
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