Skip to content

refactor(pi): 拆分 CLI 并支持独立构建 - #1466

Open
Craun718 wants to merge 11 commits into
MaaXYZ:mainfrom
Craun718:refactor/split-maapicli
Open

refactor(pi): 拆分 CLI 并支持独立构建#1466
Craun718 wants to merge 11 commits into
MaaXYZ:mainfrom
Craun718:refactor/split-maapicli

Conversation

@Craun718

@Craun718 Craun718 commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Refs [RFC] 将 MaaPiCli 从 MaaFramework 本体仓库拆分 #1465.
  • Move ProjectInterface parser, configurator, runner, and protocol types into the MaaPiCli tree.
  • Build MaaPiCli as a reusable static core plus executable, and allow the directory to be configured as a standalone CMake project.
  • Replace private runtime C++ interfaces in Runner with the public C API.
  • Export MaaUtils and meojson headers plus their CMake dependencies, and add an installed-package consumer test on Windows, Linux, and macOS CI.

Notes

This branch is based on upstream/main and intentionally excludes the welcome feature stack.

Tests

  • Configured and built tree-wide MaaPiCli on macOS arm64.
  • Installed the local build, then configured, built, and passed test/package with ctest.
  • Configured and built source/MaaPiCli independently against the installed MaaFramework package.

Sourcery 总结

将 MaaPiCli 重构为可独立构建的静态核心库和可执行文件,同时改进已安装软件包的使用方式。

新功能:

  • 支持将 MaaPiCli 构建为可复用的静态核心库,并可选择构建可执行文件。
  • 允许将 MaaPiCli 配置为独立的 CMake 项目,并基于已安装的 MaaFramework 软件包进行构建。

增强:

  • 将 ProjectInterface 头文件和实现移入 MaaPiCli 目录。
  • 使用公开的 MaaFramework C API 执行 MaaPiCli 运行时操作。
  • 导出 MaaUtils 和 meojson 头文件,以及使用者所需的软件包依赖。

构建:

  • 重构 MaaPiCli 的 CMake 目标和安装配置,以支持核心库和可执行文件的独立构建。

CI:

  • 在 Windows、Linux 和 macOS CI 中添加已安装软件包的使用者构建和测试。

测试:

  • 添加软件包使用者测试,涵盖 MaaFramework、MaaUtils 和 meojson 的使用。
Original summary in English

Sourcery 总结

将 MaaPiCli 重构为可独立构建的静态核心库和可执行文件,同时改进已安装软件包的使用方式。

新功能:

  • 将 MaaPiCli 构建为可复用的静态核心库,并支持可选的可执行文件。
  • 支持 MaaPiCli 基于已安装的 MaaFramework 软件包独立配置和构建。

增强:

  • 将 ProjectInterface 接口移至 MaaPiCli,并使用 MaaFramework 公共 C API 执行运行时操作。
  • 导出 MaaUtils 和 meojson 头文件,以及使用者所需的软件包依赖项。

构建:

  • 重构 MaaPiCli 的 CMake 目标和安装规则,以支持独立的核心库和可执行文件构建。

CI:

  • 在 Windows、Linux 和 macOS CI 中添加已安装软件包的使用者构建和测试。

测试:

  • 添加软件包使用者测试,覆盖 MaaFramework、MaaUtils 和 meojson 的使用。
Original summary in English

Sourcery 摘要

将 MaaPiCli 重构为可独立构建的可复用组件,并改进已安装软件包的使用方式。

新功能:

  • 将 MaaPiCli 构建为可复用的静态核心库,并支持可选的可执行文件。
  • 支持基于已安装的 MaaFramework 软件包独立配置和构建 MaaPiCli。

增强功能:

  • 将 ProjectInterface 的头文件和实现移至 MaaPiCli 组件中。
  • 使用公开的 MaaFramework C API 执行 MaaPiCli 运行时操作。
  • 导出 MaaUtils 和 meojson 的头文件及其所需的软件包依赖项。

构建:

  • 重构 MaaPiCli 的 CMake 目标和安装规则,以支持独立的核心库和可执行文件构建。

CI:

  • 在 Windows、Linux 和 macOS CI 中添加已安装软件包的使用者构建和测试。

测试:

  • 添加软件包使用者测试,涵盖 MaaFramework、MaaUtils 和 meojson 的使用。
Original summary in English

Sourcery 总结

将 MaaPiCli 重构为独立且可复用的组件,并改进已安装 MaaFramework 软件包的使用方式。

新功能:

  • 将 MaaPiCli 构建为可复用的静态核心库,并支持可选的可执行文件。
  • 支持独立配置和构建 MaaPiCli,并基于已安装的 MaaFramework 软件包进行构建。

增强:

  • 将 ProjectInterface API 移入 MaaPiCli,并使用公开的 MaaFramework C API 执行运行时操作。
  • 导出 MaaUtils 和 meojson 头文件,以及软件包使用者所需的依赖项。

构建:

  • 重构 MaaPiCli 的 CMake 目标和安装规则,以支持独立的核心库和可执行文件构建。

CI:

  • 在 Windows、Linux 和 macOS CI 中添加已安装软件包的使用者构建和测试。

测试:

  • 添加软件包使用者测试,覆盖 MaaFramework、MaaUtils 和 meojson 的使用。
Original summary in English

Sourcery 总结

将 MaaPiCli 重构为可独立构建的可复用组件,并改进已安装软件包的使用体验。

新功能:

  • 将 MaaPiCli 构建为可复用的静态核心库,并支持可选的可执行文件。
  • 支持针对已安装的 MaaFramework 软件包独立配置和构建 MaaPiCli。

增强功能:

  • 将 ProjectInterface 头文件和实现移入 MaaPiCli 组件。
  • 使用公开的 MaaFramework C API 执行 MaaPiCli 运行时操作。
  • 通过已安装的软件包导出 MaaUtils 和 meojson 头文件及其使用者依赖项。

构建:

  • 重构 MaaPiCli 的 CMake 目标和安装规则,以支持独立的核心库和可执行文件构建。

CI:

  • 在 Windows、Linux 和 macOS CI 中添加已安装软件包的使用者构建和测试。

测试:

  • 添加软件包使用者测试,涵盖 MaaFramework、MaaUtils 和 meojson 的使用。
Original summary in English

Sourcery 摘要

将 MaaPiCli 重构为独立且可复用的组件,并改进已安装 MaaFramework 软件包的使用方式。

新功能:

  • 提供可复用的 MaaPiCli 静态核心库,并支持按需构建可执行文件。
  • 支持独立配置和构建 MaaPiCli,并链接到已安装的 MaaFramework 软件包。

增强功能:

  • 将 ProjectInterface 的头文件和实现移入 MaaPiCli,并使用 MaaFramework 公共 C API 执行运行时操作。
  • 导出 MaaUtils 和 meojson 的头文件及其所需的软件包依赖,供下游使用者使用。

构建:

  • 重构 MaaPiCli 的 CMake 目标和安装规则,以支持独立核心库和可执行文件构建。

CI:

  • 在 Windows、Linux 和 macOS CI 中添加已安装软件包的使用者构建与测试,以及独立 MaaPiCli 构建。

测试:

  • 添加软件包使用者测试,涵盖 MaaFramework、MaaUtils 和 meojson 的使用。
Original summary in English

Sourcery 摘要

将 MaaPiCli 重构为可独立构建的可复用组件,并改进 MaaFramework 软件包的使用方式。

新功能:

  • 提供可复用的 MaaPiCli 静态核心库,并支持可选的可执行文件。
  • 支持基于已安装的 MaaFramework 软件包独立配置和构建 MaaPiCli。

增强功能:

  • 将 ProjectInterface API 移至 MaaPiCli 组件中,并使用公开的 MaaFramework C API 执行运行时操作。
  • 同时导出 MaaUtils 和 meojson 头文件,以及软件包使用者所需的依赖项。

构建:

  • 重新组织 MaaPiCli 和 MaaUtils 的 CMake 目标及安装规则,以支持独立构建和可复用的软件包使用。

持续集成:

  • 在 Windows、Linux 和 macOS 工作流中添加已安装软件包的使用者检查,以及独立的 MaaPiCli 构建。

测试:

  • 添加软件包使用者测试,涵盖 MaaFramework、MaaUtils 和 meojson 的使用。
Original summary in English

Sourcery 摘要

将 MaaPiCli 重构为可独立构建的可复用组件,同时改进 MaaFramework 软件包的使用方式。

新功能:

  • 提供可复用的 MaaPiCli 静态核心库,并支持构建可选的可执行文件;还支持将其作为独立的 CMake 项目,基于已安装的 MaaFramework 软件包进行构建。

改进:

  • 将 ProjectInterface API 移入 MaaPiCli,并使用公开的 MaaFramework C API 执行运行时操作。
  • 导出 MaaUtils 和 meojson 头文件,以及已安装软件包所需的使用者依赖项。

构建:

  • 重构 MaaPiCli 目标和安装规则,以支持独立的核心库和可执行文件构建。

CI:

  • 在 Windows、Linux 和 macOS 工作流中添加已安装软件包使用者检查,以及独立的 MaaPiCli 构建。

测试:

  • 添加软件包使用者测试,覆盖 MaaFramework、MaaUtils 和 meojson 的使用。
Original summary in English

Sourcery 总结

将 MaaPiCli 与主构建流程解耦,并将其作为独立、可复用的组件进行分发,同时添加包使用者验证。

新功能:

  • 提供可安装的 MaaPiCli 静态核心库,并支持可选的可执行文件;支持将其作为独立的 CMake 项目,基于已安装的 MaaFramework 软件包进行构建。

增强功能:

  • 将 ProjectInterface API 移至 MaaPiCli,并使用 MaaFramework 的公共 C API 执行运行时操作。
  • 通过已安装的 MaaFramework 软件包导出 MaaUtils 和 meojson 头文件及其使用者依赖项。
  • 将 MaaPiCli 与 MaaFramework 的主构建流程和分发软件包分离。

构建:

  • 重构 MaaPiCli 和软件包安装目标,以支持独立的核心库和可执行文件构建。

CI:

  • 在 Windows、Linux 和 macOS 工作流中添加已安装软件包、独立 MaaPiCli 以及打包 CLI 检查。

文档:

  • 记录独立的 MaaPiCli 分发方式和独立构建说明。

测试:

  • 添加使用者测试,覆盖已安装的 MaaFramework 和 MaaPiCli 软件包。
Original summary in English

Sourcery 总结

将 MaaPiCli 与主 MaaFramework 构建流程分离,并将其作为独立、可复用的组件进行分发,同时添加软件包使用者验证。

新功能:

  • 提供可安装的 MaaPiCli 静态核心库,并支持可选的可执行文件。
  • 支持基于已安装的 MaaFramework 软件包,独立配置和构建 MaaPiCli。

增强:

  • 将 ProjectInterface API 移入 MaaPiCli,并使用 MaaFramework 的公共 C API 执行运行时操作。
  • 通过已安装的软件包导出 MaaUtils 和 meojson 头文件及其下游 CMake 依赖项。
  • 将 MaaPiCli 与主 MaaFramework 构建流程和分发软件包分离。

构建:

  • 重构 MaaPiCli 和软件包安装目标,以支持独立的核心库和可执行文件构建。

CI:

  • 在 Windows、Linux 和 macOS 工作流中添加已安装软件包、独立 CLI 和打包 CLI 验证。

部署:

  • 为受支持的操作系统和体系结构生成独立的 MaaPiCli 发布产物。

文档:

  • 记录独立的 MaaPiCli 分发方式和独立构建流程。

测试:

  • 添加软件包使用者测试,覆盖 MaaFramework、MaaUtils、meojson 和 MaaPiCli。
Original summary in English

Sourcery 摘要

将 MaaPiCli 与 MaaFramework 主构建流程解耦,并将其打包为可独立复用的组件,同时验证下游使用情况。

新功能:

  • 提供可独立构建和安装的 MaaPiCli 静态核心库,并支持可选的可执行文件。
  • 支持将 MaaPiCli 作为独立的 CMake 项目,基于已安装的 MaaFramework 软件包进行构建。
  • 为 Windows、Linux 和 macOS 构建产物分发独立的 MaaPiCli 软件包。

增强功能:

  • 将 ProjectInterface API 移入 MaaPiCli,并使用 MaaFramework 的公共 C API 执行运行时操作。
  • 导出 MaaUtils 和 meojson 头文件及其下游软件包依赖,供使用者使用。

构建:

  • 重构 CMake 目标、安装规则和软件包配置,以支持 MaaPiCli 核心库和可执行文件的独立构建。

CI:

  • 在 CI 中添加跨平台的已安装软件包、独立 CLI 和已打包 CLI 验证。

部署:

  • 将 MaaPiCli 二进制文件与 MaaFramework 主软件包分离,并发布针对不同平台的独立 CLI 构建产物。

文档:

  • 记录 MaaPiCli 的独立分发方式和独立构建说明。

测试:

  • 添加使用者测试,涵盖已安装的 MaaFramework 和 MaaPiCli 软件包,包括 MaaUtils 和 meojson 的使用。
Original summary in English

Sourcery 总结

将 MaaPiCli 与主 MaaFramework 构建流程解耦,并将其打包为可复用的独立组件,同时增加下游使用者验证。

新功能:

  • 提供可独立构建和安装的 MaaPiCli 静态核心库,并支持可选的可执行文件。
  • 支持将 MaaPiCli 作为独立 CMake 项目,基于已安装的 MaaFramework 软件包进行构建。
  • 为 Windows、Linux 和 macOS 发布独立的 MaaPiCli 构建产物。

增强功能:

  • 将 ProjectInterface API 移入 MaaPiCli,并使用公开的 MaaFramework C API 执行运行时操作。
  • 导出 MaaUtils 和 meojson 头文件及其下游软件包依赖,供使用者使用。

构建:

  • 将 MaaPiCli 与主 MaaFramework 构建流程分离,并重构其 CMake 目标和安装规则。

CI:

  • 在 CI 中增加跨平台的已安装软件包、独立 CLI 和已打包 CLI 验证。

部署:

  • 将 MaaPiCli 二进制文件与主 MaaFramework 软件包分开发布。

文档:

  • 记录独立 MaaPiCli 的分发和构建说明。

测试:

  • 增加软件包使用者测试,涵盖 MaaFramework、MaaUtils、meojson 和 MaaPiCli 的使用。
Original summary in English

Summary by Sourcery

Decouple MaaPiCli from the main MaaFramework build and package it as a reusable standalone component with downstream consumer validation.

New Features:

  • Provide MaaPiCli as an independently buildable and installable static core library with an optional executable.
  • Support building MaaPiCli as a standalone CMake project against an installed MaaFramework package.
  • Distribute standalone MaaPiCli artifacts for Windows, Linux, and macOS.

Enhancements:

  • Move ProjectInterface APIs into MaaPiCli and use the public MaaFramework C API for runtime operations.
  • Export MaaUtils and meojson headers and their downstream package dependencies for consumers.

Build:

  • Separate MaaPiCli from the main MaaFramework build and restructure its CMake targets and installation rules.

CI:

  • Add cross-platform installed-package, standalone CLI, and packaged CLI validation to CI.

Deployment:

  • Publish MaaPiCli binaries separately from the main MaaFramework packages.

Documentation:

  • Document standalone MaaPiCli distribution and build instructions.

Tests:

  • Add package-consumer tests covering MaaFramework, MaaUtils, meojson, and MaaPiCli usage.

将 ProjectInterface 解析与配置实现移动到 MaaPiCli,并改用公开 C API 访问框架运行时。

导出 MaaUtils 与 meojson 的安装信息,补充安装包消费者测试和 CI 覆盖。

Refs MaaXYZ#1465.
@Craun718
Craun718 force-pushed the refactor/split-maapicli branch from 9d9a4e3 to 6702c06 Compare August 27, 2026 06:26
@Craun718
Craun718 marked this pull request as ready for review August 27, 2026 19:51

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

您好——我发现了 1 个问题

面向 AI 代理的提示
请处理本次代码审查中的评论:

## 单独评论

### 评论 1
<location path="source/MaaPiCli/CMakeLists.txt" line_range="25" />
<code_context>
+    Impl/Parser.cpp
+    Impl/Runner.cpp)
+
+add_library(MaaPiCliCore STATIC ${maa_pi_cli_core_src} ${maa_pi_cli_header})
+
+target_include_directories(
</code_context>
<issue_to_address>
**issue (bug_risk):** 可复用的 `MaaPiCliCore` 静态库及其 `ProjectInterface` 头文件从未被安装或导出;`cmake --install` 只会安装 `MaaPiCli` 可执行文件。因此,下游项目无法从独立安装中使用所宣传的可复用核心库。

**触发条件:** 当使用者安装独立的 MaaPiCli 项目并尝试链接可复用核心库时。

**建议修复:** 安装并导出 `MaaPiCliCore`,同时安装 `include/ProjectInterface` 头文件,并提供适当的包配置。
</issue_to_address>

Sourcery 对开源项目免费——如果您喜欢我们的审查结果,请考虑分享它们 ✨
帮助我变得更有用!请在每条评论上点击 👍 或 👎,我会利用您的反馈来改进审查结果。
Original comment in English

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="source/MaaPiCli/CMakeLists.txt" line_range="25" />
<code_context>
+    Impl/Parser.cpp
+    Impl/Runner.cpp)
+
+add_library(MaaPiCliCore STATIC ${maa_pi_cli_core_src} ${maa_pi_cli_header})
+
+target_include_directories(
</code_context>
<issue_to_address>
**issue (bug_risk):** The reusable `MaaPiCliCore` static library and its `ProjectInterface` headers are never installed or exported; `cmake --install` installs only the `MaaPiCli` executable. A downstream project therefore cannot consume the advertised reusable core from the standalone installation.

**Triggers:** When a consumer installs the standalone MaaPiCli project and attempts to link against the reusable core.

**Suggested fix:** Install and export `MaaPiCliCore`, and install the `include/ProjectInterface` headers alongside an appropriate package configuration.
</issue_to_address>

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.

Comment thread source/MaaPiCli/CMakeLists.txt
@Craun718 Craun718 changed the title refactor(pi): 拆分 CLI 并支持独立构建 [WIP] refactor(pi): 拆分 CLI 并支持独立构建 Aug 28, 2026
主 MAA 包不再构建或安装 MaaPiCli,standalone 项目导出 Core 目标,并由 CI 生成独立平台包。
@Craun718

Copy link
Copy Markdown
Contributor Author

@sourcery-ai review

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

你好——我已经审阅了你的更改,看起来非常棒!


Sourcery 对开源项目免费——如果你喜欢我们的评审,请考虑分享它们 ✨
帮助我变得更有用!请在每条评论上点击 👍 或 👎,我会利用这些反馈来改进评审。
Original comment in English

Hey - I've reviewed your changes and they look great!


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.

@Craun718 Craun718 changed the title [WIP] refactor(pi): 拆分 CLI 并支持独立构建 refactor(pi): 拆分 CLI 并支持独立构建 Aug 28, 2026
Comment thread source/MaaPiCli/README.md Outdated

## 获取

从 MaaFramework Release 下载对应平台的 `MAA-PiCli-<os>-<arch>` 独立包。`MaaPiCli` 不再包含在 `MAA-*` 主包中。

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

MaaPiCli 啦,名字统一一哈(也包括文件名),其他地方也康康

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

MaaPiCli,不要 MAA-MaaPiCli (

@MistEO

MistEO commented Sep 2, 2026

Copy link
Copy Markdown
Member

话说 cli 都拆出去了,构建流程还要放在 maafw 这边么。我想的是直接作为一个独立 UI,跟 maafw 没关系了,可能只有文档提一句

@Craun718

Craun718 commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

话说 cli 都拆出去了,构建流程还要放在 maafw 这边么。我想的是直接作为一个独立 UI,跟 maafw 没关系了,可能只有文档提一句

当前提交的ci只是为了验证这两者独立编译打包后是否能正常运行,只是为了测会不会出问题。如果你想更激进一点的话的话,也可以继续推进。

@MistEO

MistEO commented Sep 3, 2026

Copy link
Copy Markdown
Member

对的对的,直接整吧(

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.

2 participants