mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-05-07 00:27:16 +08:00
- 新增 Generator 与 Tooling 的 anyOf 和坏形状回归覆盖,补齐组合关键字与未知 type 拒绝 - 修复 VS Code 配置工具的 object-array 直属项收集与 contains 文案一致性问题 - 更新 README、Game 文档与工具说明,明确 additionalProperties 显式 false 边界与最小接入路径 - 补充 ai-plan 跟踪与 trace,记录 PR 306 open threads 收口结果和验证摘要
6.4 KiB
6.4 KiB
GFramework Config Tool
VS Code extension for browsing, validating, and lightweight editing in the GFramework AI-First config workflow.
Purpose
This extension is the editor-side companion for the GFramework.Game config pipeline:
config/**/*.yamlschemas/**/*.schema.json- source-generated config types and tables
It is intended to speed up browsing, validation, lightweight form editing, and domain-level maintenance inside VS Code. It is not a replacement for the runtime or generator packages, and it does not attempt to be a full JSON Schema editor.
Recommended Workspace Layout
By default, the extension expects:
GameProject/
├─ config/
│ ├─ monster/
│ │ ├─ slime.yaml
│ │ └─ goblin.yaml
│ └─ item/
│ └─ potion.yaml
└─ schemas/
├─ monster.schema.json
└─ item.schema.json
What It Adds
Explorer View
- Browse config files from the first workspace folder's
config/directory - Group files by config domain
- Open matching schema files from
schemas/
File-Level Actions
- Open raw YAML
- Open the matching schema
- Open a lightweight form preview
- Revalidate saved config files automatically when they change
Domain-Level Actions
- Batch edit one config domain across multiple files for top-level scalar and scalar-array fields
- Validate all discovered config files from the explorer view
Form / Validation Support
- Localize extension UI text in English and Simplified Chinese, including the form preview, prompts, and notifications
- Render existing YAML comments in the form preview and edit per-field YAML comments directly from the form
- Jump from reference fields to the referenced schema, config domain, or direct config file when a reference value is present
- Initialize empty config files from schema-derived example YAML
- Edit nested object fields recursively inside the form preview
- Edit arrays of objects in the form preview, including nested object fields inside each item
- Surface schema metadata such as
title,description,default,enum, andx-gframework-ref-tablein the lightweight editors
Validation Coverage
The extension currently validates the repository's current schema subset:
- required properties in nested objects
- unknown properties in nested objects
- scalar compatibility for
integer,number,boolean, andstring - scalar arrays with scalar item type checks
- arrays of objects whose items use the same supported subset recursively
- scalar
enumconstraints and scalar-array itemenumconstraints - scalar
constconstraints - numeric range constraints such as
minimum,exclusiveMinimum,maximum,exclusiveMaximum, andmultipleOf - string constraints such as
minLength,maxLength, andpattern - array constraints such as
minItems,maxItems,contains,minContains,maxContains, anduniqueItems - object constraints such as
minProperties,maxProperties,dependentRequired,dependentSchemas,allOf, and object-focusedif/then/else - closed-object validation through
additionalProperties: false - explicit rejection for unsupported combinators such as
oneOfandanyOf, instead of silently ignoring them
Contract Boundary
This extension is an editor-side helper. It does not define the runtime contract for GFramework.Game.
- The runtime and source generator remain the source of truth for which schema shapes are formally supported
- The VS Code experience mirrors that shared subset so unsupported shapes fail early during browsing or validation
- If a shape is too complex for the lightweight editors, fall back to raw YAML and the schema file first; do not assume the runtime accepts a broader contract just because the editor has no custom form for it
Workspace Settings
{
"gframeworkConfig.configPath": "config",
"gframeworkConfig.schemasPath": "schemas"
}
Quick Start
- Install the extension in VS Code and open the workspace that contains your
config/andschemas/directories. - Keep the default workspace layout, or set
gframeworkConfig.configPathandgframeworkConfig.schemasPathto your project-specific paths relative to the first workspace folder. - Open the
GFramework Configexplorer view and select a config file or domain. - Run validation first to confirm the current YAML files still match the supported schema subset.
- Open the lightweight form preview or domain batch editing actions, then fall back to raw YAML for deeper nested edits when needed.
Minimal adoption checklist:
- Keep one workspace folder that contains both
config/andschemas/ - Place each config domain under
config/<domain>/*.yaml - Place the matching schema at
schemas/<domain>.schema.json - Use
x-gframework-ref-tableonly on fields that should link to another config domain or reference file - Keep
additionalPropertiesexplicitly set tofalsewhen you need closed-object validation; omitting it or setting it totrueis outside the supported subset
Use raw YAML directly when you need:
- deeper or more heterogeneous array shapes
- supported object rules such as
allOf,dependentSchemas, or object-focusedif/then/elseonly when they push the edit path beyond the lightweight form boundary contains/minContains/maxContainswhen the structure is easier to reason about directly in YAML- schema designs outside the current shared subset, including
oneOf,anyOf, or non-falseadditionalProperties
Documentation
Current Constraints
- Multi-root workspaces use the first workspace folder
- Validation only covers the repository's current schema subset
- Form preview supports nested objects and object-array editing, but deeper nested object arrays inside array items still fall back to raw YAML
- Batch editing remains limited to top-level scalar fields and top-level scalar arrays
- Closed-object support is limited to
additionalProperties: false, and unsupported combinators such asoneOf/anyOfare rejected on purpose
Local Testing
cd tools/gframework-config-tool
bun install
bun run test
Packaging And Publishing
cd tools/gframework-config-tool
bun install
bun run package:vsix
VSCE_PAT=your_marketplace_pat bun run publish:marketplace