Skip to content

feat: support custom reco & act for vscode & maa-tools#1599

Merged
MistEO merged 4 commits intov2from
feat/CustomRefs
Mar 25, 2026
Merged

feat: support custom reco & act for vscode & maa-tools#1599
MistEO merged 4 commits intov2from
feat/CustomRefs

Conversation

@neko-para
Copy link
Copy Markdown
Contributor

@neko-para neko-para commented Mar 25, 2026

识别custom里面的task引用

暂时不支持anchor

@he0119 来帮补下(

Summary by Sourcery

添加自定义解析器配置,以支持在 maatools 中解析自定义识别与动作任务引用,并更新格式化和工具配置。

新功能:

  • 通过接入 maatools 的解析器配置,支持自定义识别任务引用解析。
  • 在 maatools 中为子任务及相关结构支持自定义动作任务引用解析。

增强:

  • 调整针对 TypeScript 和 .mts 文件的 Prettier 配置,以控制多行数组换行行为。

构建:

  • 将开发依赖 @nekosu/maa-tools 升级到 1.0.22 版本。
Original summary in English

Summary by Sourcery

Add custom parser configuration to support resolving custom recognition and action task references in maatools, and update formatting and tooling configuration.

New Features:

  • Support custom recognition task reference parsing via a parser configuration wired into maatools.
  • Support custom action task reference parsing for subtasks and related constructs in maatools.

Enhancements:

  • Adjust Prettier configuration for TypeScript and .mts files to control multiline array wrapping behavior.

Build:

  • Upgrade the @nekosu/maa-tools development dependency to version 1.0.22.

新功能:

  • maatools.config 中为特定识别函数配置自定义识别任务引用解析。
  • maatools.config 中为子任务配置自定义行动任务引用解析。

改进:

  • 调整 Prettier 配置以控制多行数组的换行行为。

构建:

  • 将开发依赖 @nekosu/maa-tools 升级到 1.0.20 版本。
Original summary in English

Summary by Sourcery

添加自定义解析器配置,以支持在 maatools 中解析自定义识别与动作任务引用,并更新格式化和工具配置。

新功能:

  • 通过接入 maatools 的解析器配置,支持自定义识别任务引用解析。
  • 在 maatools 中为子任务及相关结构支持自定义动作任务引用解析。

增强:

  • 调整针对 TypeScript 和 .mts 文件的 Prettier 配置,以控制多行数组换行行为。

构建:

  • 将开发依赖 @nekosu/maa-tools 升级到 1.0.22 版本。
Original summary in English

Summary by Sourcery

Add custom parser configuration to support resolving custom recognition and action task references in maatools, and update formatting and tooling configuration.

New Features:

  • Support custom recognition task reference parsing via a parser configuration wired into maatools.
  • Support custom action task reference parsing for subtasks and related constructs in maatools.

Enhancements:

  • Adjust Prettier configuration for TypeScript and .mts files to control multiline array wrapping behavior.

Build:

  • Upgrade the @nekosu/maa-tools development dependency to version 1.0.22.

@neko-para neko-para marked this pull request as ready for review March 25, 2026 14:59
@neko-para
Copy link
Copy Markdown
Contributor Author

@Windsland52 要给m9a来个不(

Copy link
Copy Markdown
Contributor

@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.

Hey - 我在这里给出了一些高层次的反馈:

  • tools/parser.ts 中的自定义解析逻辑对多个“魔法字符串”键进行了硬编码(例如 'RecognitionNodeName''SubTask''ClearHitCount''QuantizedSliding')。建议将它们提取为命名清晰的常量或配置映射(config map),以便让未来的更新更安全,并降低拼写错误带来的风险。
  • customActParser 在多个分支中重复使用相同的模式:utils.parseObject + utils.parseArray + utils.isString。你可以将这部分逻辑抽取成一个小的辅助函数,来避免重复代码,同时让每个分支的意图更清晰。
  • 目前 customActParser 中基于 name 的分支逻辑是一连串的 if/else 块;可以考虑改成一个分发表(dispatch table)或 switch 语句,这样在增加新的动作类型时,更容易扩展而不会继续让该函数膨胀。
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The custom parser logic in tools/parser.ts hardcodes multiple magic string keys (e.g., 'RecognitionNodeName', 'SubTask', 'ClearHitCount', 'QuantizedSliding'); consider extracting these into well-named constants or a config map to make future updates safer and reduce the chance of typos.
- customActParser repeats the same pattern of `utils.parseObject` + `utils.parseArray` + `utils.isString` in several branches; you could factor this into a small helper to avoid duplication and make the intent of each case clearer.
- The branching in customActParser based on `name` is currently a chain of if/else blocks; switching to a dispatch table or switch statement could make it easier to extend with new action types without growing the function further.

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

Hey - I've left some high level feedback:

  • The custom parser logic in tools/parser.ts hardcodes multiple magic string keys (e.g., 'RecognitionNodeName', 'SubTask', 'ClearHitCount', 'QuantizedSliding'); consider extracting these into well-named constants or a config map to make future updates safer and reduce the chance of typos.
  • customActParser repeats the same pattern of utils.parseObject + utils.parseArray + utils.isString in several branches; you could factor this into a small helper to avoid duplication and make the intent of each case clearer.
  • The branching in customActParser based on name is currently a chain of if/else blocks; switching to a dispatch table or switch statement could make it easier to extend with new action types without growing the function further.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The custom parser logic in tools/parser.ts hardcodes multiple magic string keys (e.g., 'RecognitionNodeName', 'SubTask', 'ClearHitCount', 'QuantizedSliding'); consider extracting these into well-named constants or a config map to make future updates safer and reduce the chance of typos.
- customActParser repeats the same pattern of `utils.parseObject` + `utils.parseArray` + `utils.isString` in several branches; you could factor this into a small helper to avoid duplication and make the intent of each case clearer.
- The branching in customActParser based on `name` is currently a chain of if/else blocks; switching to a dispatch table or switch statement could make it easier to extend with new action types without growing the function further.

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.

@neko-para neko-para requested review from MistEO and he0119 March 25, 2026 15:05
@MistEO MistEO merged commit e75aeda into v2 Mar 25, 2026
17 checks passed
@MistEO MistEO deleted the feat/CustomRefs branch March 25, 2026 15:43
@ocsin1
Copy link
Copy Markdown
Contributor

ocsin1 commented Mar 26, 2026

我好早之前就想要这个了,但想到插件是通用的就没说( 也许还可以在custom_action_param约定一个参数(比如 nodes)表示这个参数的字段需要填节点,同理一些其他的也能这么处理?

@he0119
Copy link
Copy Markdown
Contributor

he0119 commented Mar 26, 2026

我好早之前就想要这个了,但想到插件是通用的就没说( 也许还可以在custom_action_param约定一个参数(比如 nodes)表示这个参数的字段需要填节点,同理一些其他的也能这么处理?

感觉可以,我们项目内配置好然后统一就行。

@neko-para
Copy link
Copy Markdown
Contributor Author

反正现在走项目配置了就无所谓了呗(

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.

4 participants