Skip to content

feat: 添加 WebGAL 引擎描述文件规范实现#859

Open
A-kirami wants to merge 1 commit intoOpenWebGAL:devfrom
A-kirami:feat/engine-descriptor
Open

feat: 添加 WebGAL 引擎描述文件规范实现#859
A-kirami wants to merge 1 commit intoOpenWebGAL:devfrom
A-kirami:feat/engine-descriptor

Conversation

@A-kirami
Copy link
Contributor

@A-kirami A-kirami commented Feb 5, 2026

🎯 PR 目的

实现 WebGAL 引擎描述文件规范(RFC v2.0),为引擎提供标准化的元数据描述,便于第三方工具识别和管理。

📦 主要变更

1. 新增引擎描述文件 (webgal-engine.json)

  • 包含引擎的基本信息(名称、版本、类型)
  • 提供多语言描述支持(中文、英文、日文)
  • 包含作者信息、许可证、图标路径
  • 提供相关链接(主页、仓库、文档、演示等)

2. 新增版本同步脚本 (update-engine-version.js)

  • 自动从 package.json 读取版本号
  • 同步更新 webgal-engine.json 中的 versionwebgalVersion 字段
  • 在构建前自动执行,确保版本一致性
  • 提供友好的控制台输出

3. 修改构建流程

  • build 脚本中添加版本同步步骤
  • 确保每次构建时引擎描述文件版本与 package.json 保持同步

🎨 设计亮点

  1. 自动化:版本号管理完全自动化,避免手动维护导致的不一致
  2. 标准化:遵循 RFC 规范,为生态系统提供统一的引擎识别标准
  3. 可扩展:描述文件支持多语言和自定义字段扩展
  4. 向后兼容:不影响现有功能,纯增量式改进

📚 相关文档

✅ 测试建议

  • 运行 npm run build 验证版本同步脚本正常工作
  • 检查构建后 webgal-engine.json 版本号是否正确更新
  • 验证 JSON 文件格式正确性

- 新增 webgal-engine.json 引擎描述文件,包含引擎元数据
- 新增 update-engine-version.js 脚本,自动同步版本号
- 修改构建流程,在构建前自动更新引擎描述文件版本
- 为第三方工具提供标准化的引擎识别和版本管理支持
@gemini-code-assist
Copy link

Summary of Changes

Hello @A-kirami, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

此拉取请求旨在实现 WebGAL 引擎描述文件规范(RFC v2.0),通过引入标准化的元数据描述文件 webgal-engine.json,为引擎提供统一的识别和管理方式。同时,通过自动化脚本确保引擎描述文件中的版本号与项目主版本号保持同步,提升了版本管理的自动化程度和一致性,为第三方工具集成和生态系统发展奠定基础。

Highlights

  • 新增 WebGAL 引擎描述文件: 引入 webgal-engine.json 文件,用于存储引擎的基本信息(名称、版本、类型)、多语言描述、作者信息、许可证、图标路径以及相关链接,遵循 RFC v2.0 规范,便于第三方工具识别和管理。
  • 引入版本同步脚本: 添加 update-engine-version.js 脚本,该脚本能自动从 package.json 读取版本号,并同步更新 webgal-engine.json 中的 versionwebgalVersion 字段,确保版本一致性。
  • 更新构建流程: 修改 package.json 中的 build 脚本,使其在执行构建前自动运行版本同步脚本,保证每次构建时引擎描述文件的版本与主 package.json 同步。

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • packages/webgal/package.json
    • 修改了 build 脚本,在原有命令前增加了 node scripts/update-engine-version.js,以在构建前执行版本同步脚本。
  • packages/webgal/public/webgal-engine.json
    • 新增了 webgal-engine.json 文件,定义了 WebGAL 引擎的元数据,包括名称、版本、类型、多语言描述(中文、英文、日文)、作者、许可证、图标路径和各类相关链接(主页、仓库、文档、演示、Discord)。
  • packages/webgal/scripts/update-engine-version.js
    • 新增了 update-engine-version.js 脚本,该脚本负责读取 package.json 中的版本号,并将其同步更新到 webgal-engine.json 文件的 versionwebgalVersion 字段中,并提供执行结果的控制台输出。
Activity
  • 目前没有发现任何评论或审查活动。
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

本次 PR 实现了一个自动化脚本,用于在构建时同步 package.jsonwebgal-engine.json 的版本号,并添加了引擎描述文件 webgal-engine.json。这是一个很好的改进,遵循了 RFC 规范,提高了版本管理的一致性和自动化程度。代码整体实现清晰,错误处理也比较周全。我只在版本更新脚本中发现了一个可以优化的地方,即在版本号未变更时跳过文件写入操作,以避免不必要的 I/O。具体建议请见文件评论。

Comment on lines +29 to +38
const oldVersion = engineJson.version;
engineJson.version = version;
engineJson.webgalVersion = version;

// 写回文件(保持格式化)
fs.writeFileSync(engineJsonPath, JSON.stringify(engineJson, null, 2) + '\n', 'utf-8');

console.log('✅ 成功更新引擎描述文件版本号');
console.log(` ${oldVersion} → ${version}`);
console.log(` 文件: ${path.relative(process.cwd(), engineJsonPath)}`);

Choose a reason for hiding this comment

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

medium

脚本目前即使版本号没有变化也会执行文件写操作。建议增加一个判断,当版本号相同时,跳过文件写入,并打印提示信息。这样可以避免不必要的文件 I/O 操作,并使脚本在版本未变更时也能提供清晰的输出。

  const oldVersion = engineJson.version;

  if (oldVersion === version && engineJson.webgalVersion === version) {
    console.log(`ℹ️ 引擎描述文件版本号已是最新 (${version}),无需更新。`);
    console.log(`   文件: ${path.relative(process.cwd(), engineJsonPath)}`);
  } else {
    engineJson.version = version;
    engineJson.webgalVersion = version;

    // 写回文件(保持格式化)
    fs.writeFileSync(engineJsonPath, JSON.stringify(engineJson, null, 2) + '\n', 'utf-8');

    console.log('✅ 成功更新引擎描述文件版本号');
    console.log(`   ${oldVersion}${version}`);
    console.log(`   文件: ${path.relative(process.cwd(), engineJsonPath)}`);
  }

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