Feat/game config#158
Conversation
- 新增游戏内容配置系统完整文档,介绍AI-First配表方案 - 实现YAML配置源文件和JSON Schema结构描述功能 - 添加运行时只读查询和Source Generator类型生成能力 - 集成VSCode插件提供配置浏览、校验和表单编辑功能 - 支持开发期热重载和跨表引用校验机制 - 提供批量编辑和嵌套对象安全表单入口
- 创建 VS Code 扩展用于浏览、验证和编辑 GFramework 项目的配置文件 - 实现配置文件浏览器视图和相关命令功能 - 添加 YAML 文件和匹配模式文件的打开功能 - 实现嵌套对象字段的轻量级表单预览功能 - 添加批量编辑配置域的功能 - 集成轻量级模式验证支持 - 创建 GitHub Actions 工作流用于打包和发布扩展 - 配置扩展的激活事件和菜单贡献点 - 设置工作区配置选项用于指定配置和模式路径
- 将 publisher 字段从 gewuyou 更改为 GeWuYou - 保持其他配置信息不变
- 添加项目配置验证模块 configValidation.js - 创建扩展功能模块 extension.js - 添加配置验证测试文件 configValidation.test.js - 配置 .gitignore 忽略规则 - 添加 LICENSE 许可证文件 - 创建 package.json 项目依赖配置 - 添加 README.md 项目说明文档
- 实现了配置模式解析器,支持嵌套对象和数组结构 - 添加了YAML解析和验证功能,支持语法检查和类型匹配 - 实现了批量编辑器,支持标量和标量数组属性的更新 - 添加了表单更新应用功能,可将更改写回YAML文件 - 提供了完整的单元测试覆盖核心功能验证 - 配置了项目依赖管理和忽略规则 - 添加了Apache 2.0许可证文件
- 注释掉整个 GitHub Actions 工作流配置文件 - 暂时停用扩展发布到 Visual Studio Marketplace 的功能 - 保留原始配置代码以备后续启用
审阅者指南将 VS Code 配置扩展重构和更名为 从 VS Code 表单预览中保存对象数组编辑的序列图sequenceDiagram
actor User
participant VSCodeFormWebview as VSCodeFormWebview
participant VSCodeExtension as VSCodeExtension
participant applyFormUpdates as applyFormUpdates
participant FileSystem as FileSystem
User->>VSCodeFormWebview: Edit scalar fields, scalar arrays, object-array items
User->>VSCodeFormWebview: Click Save
VSCodeFormWebview->>VSCodeFormWebview: Collect scalars from [data-path]
VSCodeFormWebview->>VSCodeFormWebview: Collect arrays from textarea[data-array-path]
VSCodeFormWebview->>VSCodeFormWebview: Collect objectArrays via data-object-array-editor
VSCodeFormWebview->>VSCodeFormWebview: Build nested item values with setNestedObjectValue
VSCodeFormWebview->>VSCodeExtension: postMessage {type: save, scalars, arrays, objectArrays}
VSCodeExtension->>FileSystem: readFile(configUri)
FileSystem-->>VSCodeExtension: originalYaml
VSCodeExtension->>applyFormUpdates: applyFormUpdates(originalYaml, {scalars, arrays, objectArrays})
applyFormUpdates->>applyFormUpdates: parseTopLevelYaml + normalizeRootNode
applyFormUpdates->>applyFormUpdates: set scalar nodes via setNodeAtPath
applyFormUpdates->>applyFormUpdates: set scalar-array nodes via createArrayNode
applyFormUpdates->>applyFormUpdates: build object arrays with createNodeFromFormValue
applyFormUpdates-->>VSCodeExtension: updatedYaml
VSCodeExtension->>FileSystem: writeFile(configUri, updatedYaml)
VSCodeExtension->>VSCodeExtension: openTextDocument(configUri)
VSCodeExtension->>VSCodeExtension: showTextDocument(document)
VSCodeExtension-->>VSCodeFormWebview: (implicit) updated file visible in editor
更新后的表单模型与 YAML 更新流水线的类图classDiagram
class FormModel {
+FormField[] fields
+UnsupportedField[] unsupported
}
class FormField {
<<interface>>
+string kind
+string path
+string displayPath
+string label
+boolean required
+number depth
+any schema
+boolean itemMode
}
class SectionField {
+string kind~section~
+string description
}
class ScalarField {
+string kind~scalar~
+any value
}
class ArrayField {
+string kind~array~
+string itemType
+string[] value
}
class ObjectArrayField {
+string kind~objectArray~
+ObjectArrayItem[] items
+FormField[] templateFields
}
class ObjectArrayItem {
+string title
+FormField[] fields
}
class UnsupportedField {
+string path
+string message
}
class collectFormFields {
+collectFormFields(schemaNode, yamlNode, currentPath, depth, fields, unsupported)
}
class collectObjectArrayItemFields {
+collectObjectArrayItemFields(schemaNode, yamlNode, localPath, displayPath, depth, fields, unsupported)
}
class buildObjectArrayItemModels {
+buildObjectArrayItemModels(itemSchema, yamlNode, propertyPath, depth, unsupported) ObjectArrayItem[]
}
class applyFormUpdates {
+applyFormUpdates(originalYaml, updates) string
}
class createNodeFromFormValue {
+createNodeFromFormValue(value) YamlNode
}
class YamlNode {
<<interface>>
+string kind
}
class YamlScalarNode {
+string kind~scalar~
+string value
}
class YamlArrayNode {
+string kind~array~
+YamlNode[] items
}
class YamlObjectNode {
+string kind~object~
+YamlObjectEntry[] entries
}
class YamlObjectEntry {
+string key
+YamlNode node
}
class renderFormField {
+renderFormField(field) string
}
class renderObjectArrayItem {
+renderObjectArrayItem(item) string
}
FormModel "1" --> "*" FormField : fields
FormModel "1" --> "*" UnsupportedField : unsupported
FormField <|-- SectionField
FormField <|-- ScalarField
FormField <|-- ArrayField
FormField <|-- ObjectArrayField
ObjectArrayField "1" --> "*" ObjectArrayItem : items
ObjectArrayField "1" --> "*" FormField : templateFields
ObjectArrayItem "1" --> "*" FormField : fields
collectFormFields ..> SectionField : creates
collectFormFields ..> ScalarField : creates
collectFormFields ..> ArrayField : creates
collectFormFields ..> ObjectArrayField : creates
collectFormFields ..> buildObjectArrayItemModels : uses
collectFormFields ..> collectObjectArrayItemFields : uses
collectObjectArrayItemFields ..> SectionField : creates
collectObjectArrayItemFields ..> ScalarField : creates
collectObjectArrayItemFields ..> ArrayField : creates
buildObjectArrayItemModels ..> ObjectArrayItem : creates
buildObjectArrayItemModels ..> collectObjectArrayItemFields : uses
renderFormField ..> SectionField : renders
renderFormField ..> ScalarField : renders
renderFormField ..> ArrayField : renders
renderFormField ..> ObjectArrayField : renders
renderFormField ..> renderObjectArrayItem : uses
renderObjectArrayItem ..> FormField : renders via renderFormField
YamlNode <|-- YamlScalarNode
YamlNode <|-- YamlArrayNode
YamlNode <|-- YamlObjectNode
applyFormUpdates ..> YamlNode : manipulates
applyFormUpdates ..> createNodeFromFormValue : uses
createNodeFromFormValue ..> YamlScalarNode : creates
createNodeFromFormValue ..> YamlArrayNode : creates
createNodeFromFormValue ..> YamlObjectNode : creates
YamlObjectNode "1" --> "*" YamlObjectEntry : entries
文件级变更
技巧与命令与 Sourcery 交互
自定义你的体验访问你的 控制面板 来:
获取帮助Original review guide in EnglishReviewer's GuideRefactors and rebrands the VS Code config extension into Sequence diagram for saving object-array edits from the VS Code form previewsequenceDiagram
actor User
participant VSCodeFormWebview as VSCodeFormWebview
participant VSCodeExtension as VSCodeExtension
participant applyFormUpdates as applyFormUpdates
participant FileSystem as FileSystem
User->>VSCodeFormWebview: Edit scalar fields, scalar arrays, object-array items
User->>VSCodeFormWebview: Click Save
VSCodeFormWebview->>VSCodeFormWebview: Collect scalars from [data-path]
VSCodeFormWebview->>VSCodeFormWebview: Collect arrays from textarea[data-array-path]
VSCodeFormWebview->>VSCodeFormWebview: Collect objectArrays via data-object-array-editor
VSCodeFormWebview->>VSCodeFormWebview: Build nested item values with setNestedObjectValue
VSCodeFormWebview->>VSCodeExtension: postMessage {type: save, scalars, arrays, objectArrays}
VSCodeExtension->>FileSystem: readFile(configUri)
FileSystem-->>VSCodeExtension: originalYaml
VSCodeExtension->>applyFormUpdates: applyFormUpdates(originalYaml, {scalars, arrays, objectArrays})
applyFormUpdates->>applyFormUpdates: parseTopLevelYaml + normalizeRootNode
applyFormUpdates->>applyFormUpdates: set scalar nodes via setNodeAtPath
applyFormUpdates->>applyFormUpdates: set scalar-array nodes via createArrayNode
applyFormUpdates->>applyFormUpdates: build object arrays with createNodeFromFormValue
applyFormUpdates-->>VSCodeExtension: updatedYaml
VSCodeExtension->>FileSystem: writeFile(configUri, updatedYaml)
VSCodeExtension->>VSCodeExtension: openTextDocument(configUri)
VSCodeExtension->>VSCodeExtension: showTextDocument(document)
VSCodeExtension-->>VSCodeFormWebview: (implicit) updated file visible in editor
Class diagram for updated form model and YAML update pipelineclassDiagram
class FormModel {
+FormField[] fields
+UnsupportedField[] unsupported
}
class FormField {
<<interface>>
+string kind
+string path
+string displayPath
+string label
+boolean required
+number depth
+any schema
+boolean itemMode
}
class SectionField {
+string kind~section~
+string description
}
class ScalarField {
+string kind~scalar~
+any value
}
class ArrayField {
+string kind~array~
+string itemType
+string[] value
}
class ObjectArrayField {
+string kind~objectArray~
+ObjectArrayItem[] items
+FormField[] templateFields
}
class ObjectArrayItem {
+string title
+FormField[] fields
}
class UnsupportedField {
+string path
+string message
}
class collectFormFields {
+collectFormFields(schemaNode, yamlNode, currentPath, depth, fields, unsupported)
}
class collectObjectArrayItemFields {
+collectObjectArrayItemFields(schemaNode, yamlNode, localPath, displayPath, depth, fields, unsupported)
}
class buildObjectArrayItemModels {
+buildObjectArrayItemModels(itemSchema, yamlNode, propertyPath, depth, unsupported) ObjectArrayItem[]
}
class applyFormUpdates {
+applyFormUpdates(originalYaml, updates) string
}
class createNodeFromFormValue {
+createNodeFromFormValue(value) YamlNode
}
class YamlNode {
<<interface>>
+string kind
}
class YamlScalarNode {
+string kind~scalar~
+string value
}
class YamlArrayNode {
+string kind~array~
+YamlNode[] items
}
class YamlObjectNode {
+string kind~object~
+YamlObjectEntry[] entries
}
class YamlObjectEntry {
+string key
+YamlNode node
}
class renderFormField {
+renderFormField(field) string
}
class renderObjectArrayItem {
+renderObjectArrayItem(item) string
}
FormModel "1" --> "*" FormField : fields
FormModel "1" --> "*" UnsupportedField : unsupported
FormField <|-- SectionField
FormField <|-- ScalarField
FormField <|-- ArrayField
FormField <|-- ObjectArrayField
ObjectArrayField "1" --> "*" ObjectArrayItem : items
ObjectArrayField "1" --> "*" FormField : templateFields
ObjectArrayItem "1" --> "*" FormField : fields
collectFormFields ..> SectionField : creates
collectFormFields ..> ScalarField : creates
collectFormFields ..> ArrayField : creates
collectFormFields ..> ObjectArrayField : creates
collectFormFields ..> buildObjectArrayItemModels : uses
collectFormFields ..> collectObjectArrayItemFields : uses
collectObjectArrayItemFields ..> SectionField : creates
collectObjectArrayItemFields ..> ScalarField : creates
collectObjectArrayItemFields ..> ArrayField : creates
buildObjectArrayItemModels ..> ObjectArrayItem : creates
buildObjectArrayItemModels ..> collectObjectArrayItemFields : uses
renderFormField ..> SectionField : renders
renderFormField ..> ScalarField : renders
renderFormField ..> ArrayField : renders
renderFormField ..> ObjectArrayField : renders
renderFormField ..> renderObjectArrayItem : uses
renderObjectArrayItem ..> FormField : renders via renderFormField
YamlNode <|-- YamlScalarNode
YamlNode <|-- YamlArrayNode
YamlNode <|-- YamlObjectNode
applyFormUpdates ..> YamlNode : manipulates
applyFormUpdates ..> createNodeFromFormValue : uses
createNodeFromFormValue ..> YamlScalarNode : creates
createNodeFromFormValue ..> YamlArrayNode : creates
createNodeFromFormValue ..> YamlObjectNode : creates
YamlObjectNode "1" --> "*" YamlObjectEntry : entries
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
|
Overall Grade |
Security Reliability Complexity Hygiene |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| C# | Apr 2, 2026 12:46a.m. | Review ↗ | |
| Secrets | Apr 2, 2026 12:46a.m. | Review ↗ |
There was a problem hiding this comment.
Hey - 我在这里给出了一些整体性的反馈:
- README 在使用示例中仍然引用
cd tools/vscode-config-extension,但扩展文件夹/包已经重命名为gframework-config-tool;请更新这些路径,使本地命令与新的目录结构保持一致。 - 在
tools/gframework-config-tool/package.json中,repository.directory字段仍然指向tools/vscode-config-extension;请将其更新为新的tools/gframework-config-tool路径,以保持元数据准确。 - 被注释掉的
publish-vscode-extensionworkflow 仍然使用working-directory: tools/vscode-config-extension;如果你计划之后启用它,建议现在就更新这个路径,或者在尚未迁移到新的gframework-config-tool位置之前先删除该文件。
给 AI Agent 的提示
Please address the comments from this code review:
## Overall Comments
- README 在使用示例中仍然引用 `cd tools/vscode-config-extension`,但扩展文件夹/包已经重命名为 `gframework-config-tool`;请更新这些路径,使本地命令与新的目录结构保持一致。
- 在 `tools/gframework-config-tool/package.json` 中,`repository.directory` 字段仍然指向 `tools/vscode-config-extension`;请将其更新为新的 `tools/gframework-config-tool` 路径,以保持元数据准确。
- 被注释掉的 `publish-vscode-extension` workflow 仍然使用 `working-directory: tools/vscode-config-extension`;如果你计划之后启用它,建议现在就更新这个路径,或者在尚未迁移到新的 `gframework-config-tool` 位置之前先删除该文件。帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈改进后续的 Review。
Original comment in English
Hey - I've left some high level feedback:
- The README still references
cd tools/vscode-config-extensionin the usage examples, but the extension folder/package has been renamed togframework-config-tool; please update those paths so local commands match the new layout. - In
tools/gframework-config-tool/package.json, therepository.directoryfield still points totools/vscode-config-extension; this should be updated to the newtools/gframework-config-toolpath to keep metadata accurate. - The commented-out
publish-vscode-extensionworkflow usesworking-directory: tools/vscode-config-extension; if you plan to enable it later, consider updating this path or removing the file until it's wired up to the newgframework-config-toollocation.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The README still references `cd tools/vscode-config-extension` in the usage examples, but the extension folder/package has been renamed to `gframework-config-tool`; please update those paths so local commands match the new layout.
- In `tools/gframework-config-tool/package.json`, the `repository.directory` field still points to `tools/vscode-config-extension`; this should be updated to the new `tools/gframework-config-tool` path to keep metadata accurate.
- The commented-out `publish-vscode-extension` workflow uses `working-directory: tools/vscode-config-extension`; if you plan to enable it later, consider updating this path or removing the file until it's wired up to the new `gframework-config-tool` location.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
- 更新GitHub工作流中工具路径配置 - 新增游戏内容配置系统详细文档 - 创建VS Code扩展包描述文件 - 添加VS Code扩展功能说明文档
Summary by Sourcery
在 GFramework VS Code 配置工具中支持编辑由 schema 定义的对象数组,并在新的
gframework-config-tool包名下对该扩展进行重命名和品牌更新。New Features:
Enhancements:
gframework-config-tool包为契机进行优化。Build:
CI:
Documentation:
Tests:
applyFormUpdates在对象数组负载上的行为的测试,包括重写数组项和清空数组的场景。Chores:
tools/gframework-config-tool下新增扩展专用的忽略文件、许可证和锁定文件。Original summary in English
Summary by Sourcery
Support editing schema-defined object arrays in the GFramework VS Code config tool and rebrand the extension under the new gframework-config-tool package.
New Features:
Enhancements:
Build:
CI:
Documentation:
Tests:
Chores: