SuperAPI AI 工具集

stac-custom-extensions

编程与开发

查看项目

更新于 10-16 01:12

技能介绍

用途:为 Stac 应用添加自定义 widget 或 action,使其能够正确序列化并在应用中完成注册。

主要能力:按 widget 或 action 类型生成 model 与 parser 文件对,保持类型 id 一致;提供注册代码片段用于 Stac.initialize;在涉及 JSON 序列化时给出 build_runner 命令;可检查 main.dart 中的解析器注册情况。

使用方式:先选择扩展类型(widget 或 action);使用脚本脚手架生成模型与解析器文件;将生成文件加入应用代码库并运行 codegen;在 main.dart 中确认解析器注册;用最小示例验证运行时接线。需要提供 PascalCase 扩展名、运行时类型 id(type 或 actionType)、输出目录以及 main.dart 路径。

脚本: scripts/scaffold_custom_widget.py --name <Name> --type <widgetType> --out-dir <path> scripts/scaffold_custom_action.py --name <Name> --action-type <actionType> --out-dir <path> scripts/check_parser_registration.py --main-dart <path> --parser-class <ClassName>

模板与参考:assets/templates 下提供 custom_widget.dart.tmpl、custom_widget_parser.dart.tmpl、custom_action.dart.tmpl、custom_action_parser.dart.tmpl;references 下提供 custom-widget-checklist.md、custom-action-checklist.md、parser-registration.md、converters-guide.md。

限制:暂未提供关于支持平台、收费或价格、效果保证的说明。