diff --git a/README.md b/README.md index ad02b9f..5576a6a 100644 --- a/README.md +++ b/README.md @@ -32,19 +32,19 @@ inside a sandbox — no Node.js APIs, no direct file or network access. Everything reaches the outside world through capabilities you declare in the manifest, and users see exactly what you asked for at install time. -## Plugin operations (unreleased) +## Plugin operations (SDK 2.2.0+) -The development operations protocol lets a plugin declare a host-rendered form, +The operations protocol lets a plugin declare a host-rendered form, entry points and a sandbox handler. No React or renderer code is required. Start with the [authoring guide](docs/operations.md), then the complete [text deduplication](examples/text-tools/README.md) and [media merge](examples/media-merge/README.md) examples. -This interface is **not released**. Use the guide's matching-source build -instructions, not the published scaffold above. The development CLI includes an `operation` template; see the guide for local -SDK dependency setup. Example engine ranges and package versions do not establish support in -an already released host, including beta.47. New components/capabilities require -host support; compatible plugin-only UI and business changes can update live. +The operation protocol, API and CLI template are available in **SDK 2.2.0**. +They require a compatible Motrix host; beta.48 is the planned first supporting +release, and beta.47 is incompatible. SDK publication does not establish host +availability. New components/capabilities require host support; compatible +plugin-only UI and business changes can update live. See the guide for setup. ## Quick start @@ -59,7 +59,7 @@ Templates: |---|---| | `basic-resolver` (default) | A `beforeCreate` hook that inspects and rewrites downloads (`site-resolver` category) | | `post-action` | An `afterComplete` hook that fires a desktop notification (`post-action` category) | -| `operation` (unreleased) | A text deduplication form, scoped handler, both locales and typecheck/validate/pack/lint scripts | +| `operation` (SDK 2.2.0+) | A text deduplication form, scoped handler, both locales and typecheck/validate/pack/lint scripts | The scaffolded plugin id starts as `me.`. Set your real publisher (the `.` prefix) either by editing `id` in `motrix-plugin.json`, @@ -156,7 +156,7 @@ Field reference (enforced by `motrix-plugin validate`): | `activationEvents` | When the host loads you (e.g. `onTaskType:http`, `onStartup`). Required. | | `contributes.hooks` | Which lifecycle hooks you implement, each with a `role`. | | `contributes.commands` | Commands you register: id `..`, max 64. Commands marked `public: true` must declare `argsSchema` + `resultSchema` (a bounded JSON-Schema subset — no `$ref`/`oneOf`, ≤ 8 KiB, depth ≤ 8). | -| `contributes.operations` | **Unreleased:** host-rendered forms and scoped operation handlers. See the [operations guide](docs/operations.md). | +| `contributes.operations` | **SDK 2.2.0+:** host-rendered forms and scoped operation handlers. See the [operations guide](docs/operations.md). | | `contributes.configuration` | Your settings schema (same bounded subset). Read values via the `config` capability. | | `requestedHeapMB` | Sandbox heap, 32 (default) to 64. | | `l10n` | Directory of locale JSON files. | diff --git a/README.zh-CN.md b/README.zh-CN.md index 47961ca..9f93100 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -28,11 +28,11 @@ pnpm run pack # produce a distributable .moext 里 —— 没有 Node.js API,不能直接访问文件或网络。与外界的一切交互都要 经过你在 manifest 里声明的 capability,用户在安装时能看到你申请了什么。 -## 插件操作(尚未发布) +## 插件操作(SDK 2.2.0+) -开发中的操作协议允许插件声明宿主渲染的表单、入口和沙箱处理函数,无需编写 React 或 renderer 代码。先阅读 [编写指南](docs/operations.zh-CN.md),再参考完整的 [文本去重](examples/text-tools/README.zh-CN.md) 和 [音视频合并](examples/media-merge/README.zh-CN.md) 示例。 +操作协议允许插件声明宿主渲染的表单、入口和沙箱处理函数,无需编写 React 或 renderer 代码。先阅读 [编写指南](docs/operations.zh-CN.md),再参考完整的 [文本去重](examples/text-tools/README.zh-CN.md) 和 [音视频合并](examples/media-merge/README.zh-CN.md) 示例。 -此接口**尚未发布**。请按指南使用匹配源码构建,不能直接使用上方已发布的脚手架流程;开发版 CLI 已包含 `operation` 模板,本地 SDK 依赖配置见指南。示例的引擎范围和包版本不能证明 beta.47 等已发布宿主支持。新组件和能力需要宿主支持;兼容协议范围内的插件界面和业务更新可以热生效。 +操作协议、API 和 CLI 模板已随 **SDK 2.2.0** 发布。运行仍需要兼容的 Motrix 宿主,beta.48 是计划中的首个支持版本,beta.47 不兼容;SDK 发布不代表宿主功能已发布。新组件和能力需要宿主支持;兼容协议范围内的插件界面和业务更新可以热生效。依赖安装方式见指南。 ## 快速开始 @@ -47,7 +47,7 @@ pnpm create motrix-plugin my-plugin post-action # template as second argument |---|---| | `basic-resolver`(默认) | 一个检查并改写下载的 `beforeCreate` hook(`site-resolver` category) | | `post-action` | 一个下载完成后发桌面通知的 `afterComplete` hook(`post-action` category) | -| `operation`(尚未发布) | 文本去重表单、受限处理函数、中英文文案及 typecheck/validate/pack/lint 脚本 | +| `operation`(SDK 2.2.0+) | 文本去重表单、受限处理函数、中英文文案及 typecheck/validate/pack/lint 脚本 | 脚手架生成的插件 id 初始为 `me.`。要设置真实的 publisher (`.` 的前缀),可以直接编辑 `motrix-plugin.json` 里的 @@ -142,7 +142,7 @@ pnpm 内置的 tarball 打包命令,而不是脚手架里的 script。) | `activationEvents` | host 何时加载你(如 `onTaskType:http`、`onStartup`)。必填。 | | `contributes.hooks` | 你实现了哪些生命周期 hook,每个都要带 `role`。 | | `contributes.commands` | 你注册的 command:id 形如 `..`,最多 64 个。标记 `public: true` 的 command 必须声明 `argsSchema` + `resultSchema`(受限的 JSON-Schema 子集 —— 不支持 `$ref`/`oneOf`,≤ 8 KiB,深度 ≤ 8)。 | -| `contributes.operations` | **尚未发布:**宿主渲染的操作表单与受限处理函数,见 [操作指南](docs/operations.zh-CN.md)。 | +| `contributes.operations` | **SDK 2.2.0+:**宿主渲染的操作表单与受限处理函数,见 [操作指南](docs/operations.zh-CN.md)。 | | `contributes.configuration` | 你的设置 schema(同一受限子集)。运行时通过 `config` capability 读取。 | | `requestedHeapMB` | 沙箱堆大小,32(默认)到 64。 | | `l10n` | locale JSON 文件所在目录。 | diff --git a/docs/operations.md b/docs/operations.md index 92abcf6..58b0074 100644 --- a/docs/operations.md +++ b/docs/operations.md @@ -1,15 +1,15 @@ -# Authoring plugin operations (unreleased) +# Authoring plugin operations (SDK 2.2.0+) **English** | [简体中文](./operations.zh-CN.md) -> Development implementation, not a released SDK/host contract. Use a matching -> development checkout of the SDK and a Motrix build that implements the required -> capabilities. Examples and the operation template require -> `>=2.0.0-beta.48 <3.0.0`; beta.48 is the planned first supporting host release, -> not a claim that these features have shipped. Beta.47 is rejected, including -> development builds still reporting that version. Matching SDK packages remain -> unpublished, and a public JSON Schema URL does not establish support. The -> examples are not marketplace releases. +> The operation schema, API and CLI template are published in SDK 2.2.0. +> Runtime support still requires a Motrix host implementing the declared +> capabilities. Examples and the template require `>=2.0.0-beta.48 <3.0.0`; +> beta.48 is the planned first supporting host release, not a claim that it has +> shipped. Beta.47 is rejected, including development builds with that version. +> Raise the minimum if the host feature ships later. SDK publication and a +> public JSON Schema URL do not establish host support. These examples are not +> marketplace releases. ## Start with a complete example @@ -29,44 +29,43 @@ For a TypeScript author, adapting an example is a small task; defining a new operation from scratch has a moderate learning cost. The main work is aligning schema fields, UI references, locale keys and file grants. No React or CSS is needed. This is a source-based assessment, not a measured usability study. -The development CLI provides an `operation` template that creates the initial +The CLI provides an `operation` template that creates the initial references and files for you. `basic-resolver` and `post-action` remain lifecycle-hook templates. Types are still handwritten; schema-to-TypeScript generation and UI preview are not implemented. ### Generate your own operation project -The development CLI now includes `operation`, starting from text deduplication. -From the SDK repository root, choose an unused project name: +Use the published SDK 2.2.0 CLI from any working directory, choosing an unused +project name: ```sh -pnpm install --frozen-lockfile -pnpm build -node packages/plugin-cli/dist/bin/motrix-plugin.js init my-operation -t operation -p acme +pnpm --package=@motrix/plugin-cli@2.2.0 dlx motrix-plugin init my-operation -t operation -p acme cd my-operation -pnpm add -D @motrix/plugin-api@file:../packages/plugin-api @motrix/plugin-cli@file:../packages/plugin-cli +pnpm install pnpm run typecheck pnpm run validate pnpm run pack pnpm run lint ``` -This local dependency step is necessary while the operation API/CLI are -unreleased. The generated version ranges do not imply published support. If you -create the project elsewhere, adjust the two `file:` paths to the matching built -SDK packages. Do not change the host's schema or permissions to install it. +The generated project declares API/CLI 2.2.0 or compatible newer versions; local +SDK links are not required. The immutable 2.2.0 CLI still prints an outdated +"unreleased" notice and generates source-checkout setup instructions. For that +version, use `pnpm install` as above instead of the generated `file:` setup. +This documentation and the next CLI release correct the wording. The host +compatibility requirement remains in force; never change its schema or permissions +to install the example. -Alternatively, from the SDK root, the create wrapper supports: +Alternatively, use the published create wrapper: ```sh -node packages/create-motrix-plugin/bin/create.mjs my-operation operation +pnpm create motrix-plugin@2.2.0 my-operation operation ``` It defaults to publisher `me`; use the full CLI's `-p` option for a custom one. -Once matching versions are released, the public entry points will be -`motrix-plugin init my-operation -t operation -p acme` and -`pnpm create motrix-plugin my-operation operation`. They are not a claim that -currently published packages contain the template. +For SDK development only, build this repository, invoke its CLI binary and use +matching local API/CLI dependencies to test changes that are not yet published. The generator creates the complete manifest, handler, English/Chinese locales, strict package-based `tsconfig.json`, esbuild config, package scripts, `.gitignore` @@ -99,12 +98,11 @@ Neither command publishes or signs anything. Install through the compatible host's normal third-party package flow and review the requested permissions. The examples deliberately use this checkout's CLI and ambient API declaration; -there is no separate example dependency installation. Installing the currently -published npm packages is not a substitute for building these development -sources. When moving an example into a standalone project, use matching released -CLI/API packages once available, and replace the relative ambient declaration -include with the package's `types` setup. Keep `motrix:plugin-api` external when -bundling. `pack` validates and bundles; it does not replace TypeScript checking. +there is no separate example dependency installation. Standalone projects can +use the published CLI/API 2.2.0 packages and package-based `types` configuration, +as generated by the template, instead of the relative ambient declaration include. +Keep `motrix:plugin-api` external when bundling. `pack` validates and bundles; +it does not replace TypeScript checking. ## Ownership and files diff --git a/docs/operations.zh-CN.md b/docs/operations.zh-CN.md index 7d42f4f..2aa214c 100644 --- a/docs/operations.zh-CN.md +++ b/docs/operations.zh-CN.md @@ -1,8 +1,8 @@ -# 编写插件操作(尚未发布) +# 编写插件操作(SDK 2.2.0+) [English](./operations.md) | **简体中文** -> 本文描述开发中的实现,不代表已经发布的 SDK 或宿主契约。请使用匹配的 SDK 开发源码和具备所需能力的 Motrix 构建。示例与 operation 模板要求 `>=2.0.0-beta.48 <3.0.0`;beta.48 是计划中的首个支持版本,不代表这些功能已发布。beta.47 会被拒绝,包括仍使用该版本号的开发构建。配套 SDK 包仍未发布,公开 JSON Schema 地址也不能证明已支持;示例不是已经上架的插件。 +> 操作 Schema、API 和 CLI 模板已随 SDK 2.2.0 发布。运行仍需宿主提供声明的能力。示例和模板要求 `>=2.0.0-beta.48 <3.0.0`;beta.48 是计划中的首个支持版本,不代表宿主功能已发布。beta.47 会被拒绝,包括仍使用该版本号的开发构建;若宿主功能延期,必须提高最低版本。SDK 发布及公开 JSON Schema 地址不能证明宿主支持;这些示例不是已上架插件。 ## 从完整示例开始 @@ -11,33 +11,31 @@ 两个目录都包含完整清单、处理函数、中英文语言文件和 TypeScript 配置,是可以执行的源码示例。下文代码片段只解释局部字段,不是完整清单。 -对熟悉 TypeScript 的开发者,修改现有示例的工作量较小;从零定义操作的学习成本中等。主要难点是对齐参数 Schema、UI 引用、翻译键和文件授权,无需编写 React 或 CSS。这是基于源码的评估,没有经过开发者可用性研究。开发版 CLI 已提供 `operation` 模板,自动生成初始引用和文件;`basic-resolver` 和 `post-action` 仍为生命周期 Hook 模板。类型仍需手写维护,尚未实现从 Schema 生成 TypeScript 类型或 UI 预览。 +对熟悉 TypeScript 的开发者,修改现有示例的工作量较小;从零定义操作的学习成本中等。主要难点是对齐参数 Schema、UI 引用、翻译键和文件授权,无需编写 React 或 CSS。这是基于源码的评估,没有经过开发者可用性研究。CLI 已提供 `operation` 模板,自动生成初始引用和文件;`basic-resolver` 和 `post-action` 仍为生命周期 Hook 模板。类型仍需手写维护,尚未实现从 Schema 生成 TypeScript 类型或 UI 预览。 ### 生成自己的操作项目 -开发版 CLI 现已提供 `operation` 模板,以文本去重为起点。从 SDK 仓库根目录开始,使用尚未占用的项目名: +在任意工作目录使用已发布的 SDK 2.2.0 CLI,选择尚未占用的项目名: ```sh -pnpm install --frozen-lockfile -pnpm build -node packages/plugin-cli/dist/bin/motrix-plugin.js init my-operation -t operation -p acme +pnpm --package=@motrix/plugin-cli@2.2.0 dlx motrix-plugin init my-operation -t operation -p acme cd my-operation -pnpm add -D @motrix/plugin-api@file:../packages/plugin-api @motrix/plugin-cli@file:../packages/plugin-cli +pnpm install pnpm run typecheck pnpm run validate pnpm run pack pnpm run lint ``` -操作 API/CLI 尚未发布时,需要上述本地依赖步骤,生成的版本范围不代表已发布支持。若在其他位置创建项目,将两个 `file:` 路径调整为匹配且已构建的 SDK 包位置。不能通过修改宿主 Schema 或权限来安装。 +生成项目声明 API/CLI 2.2.0 或兼容的新版本,无需链接本地 SDK。已发布的 2.2.0 CLI 仍会显示过时的“尚未发布”提示,并生成源码依赖安装说明;该版本请按上方执行 `pnpm install`,不用生成文档里的 `file:` 配置。本次文档和下一版 CLI 会修正文案。宿主兼容性要求仍有效,不能通过修改宿主 Schema 或权限来安装。 -也可以从 SDK 根目录使用 create 包装器: +也可使用已发布的 create 包装器: ```sh -node packages/create-motrix-plugin/bin/create.mjs my-operation operation +pnpm create motrix-plugin@2.2.0 my-operation operation ``` -它默认使用发布者 `me`;自定义发布者请使用完整 CLI 的 `-p`。配套版本正式发布后,公开入口为 `motrix-plugin init my-operation -t operation -p acme` 和 `pnpm create motrix-plugin my-operation operation`,这不代表当前已发布包包含该模板。 +它默认使用发布者 `me`;自定义发布者请使用完整 CLI 的 `-p`。仅在开发 SDK 未发布改动时,才需要构建本仓库、调用仓库内 CLI,并使用匹配的本地 API/CLI 依赖。 生成器提供完整清单、处理函数、中英文语言文件、基于安装包的严格 `tsconfig.json`、esbuild 配置、package scripts、`.gitignore` 和成对 README。操作、命令和激活 ID 自动使用项目的发布者与名称。模板只申请所选文件读写权限,包含插件页面及单任务菜单入口,使用 `preserve-inputs`。提供明确的 typecheck、validate、pack、lint 脚本;pack 不代替类型检查,处理函数类型仍需手写维护。生成项目不会安装、启动、签名或发布插件。 @@ -57,7 +55,7 @@ node ../../packages/plugin-cli/dist/bin/motrix-plugin.js lint 将 `text-tools` 换成 `media-merge` 即可运行另一个示例。`pack` 会自行打包 `src/index.ts`,将未签名 `.moext` 写入示例目录下被 Git 忽略的 `dist/`。`lint` 读取构建后的 bundle,必须放在 **pack 之后**。这些命令不会签名或发布。通过兼容宿主的正常第三方安装流程安装,并检查所申请的权限。 -示例直接使用当前仓库的 CLI 和 ambient API 类型声明,不需要为示例单独安装依赖。安装当前 npm 已发布包不能替代构建这些开发源码。将示例移到独立项目时,应在匹配版本正式发布后使用配套 CLI/API 包,将相对路径类型声明改成包的 `types` 配置;打包时保持 `motrix:plugin-api` 为 external。`pack` 负责校验和打包,不代替 TypeScript 类型检查。 +示例直接使用当前仓库的 CLI 和 ambient API 类型声明,不需要为示例单独安装依赖。独立项目可使用已发布的 CLI/API 2.2.0 及模板生成的包级 `types` 配置,替代相对路径类型声明。打包时保持 `motrix:plugin-api` 为 external。`pack` 负责校验和打包,不代替 TypeScript 类型检查。 ## 文件与职责 diff --git a/examples/media-merge/README.md b/examples/media-merge/README.md index b588972..8e150f0 100644 --- a/examples/media-merge/README.md +++ b/examples/media-merge/README.md @@ -1,4 +1,4 @@ -# Media merge operation example (unreleased) +# Media merge operation example (requires a compatible host) **English** | [简体中文](./README.zh-CN.md) @@ -9,7 +9,7 @@ This teaching copy uses **`example.media-merge`** and a distinct display name so it can be installed as an unsigned third-party example without impersonating the official plugin or requiring its signing key. It is not a marketplace release. -**Requires the unreleased operations implementation in both the SDK and host.** +**SDK 2.2.0 is published; runtime support requires a compatible Motrix host.** `engines.motrix` is `>=2.0.0-beta.48 <3.0.0`, targeting beta.48 as the first supporting host release. This is a release target, not published availability. Beta.47 is rejected, including development builds still reporting that version. @@ -48,8 +48,8 @@ publish. Install using the compatible host's normal third-party package flow. Review `ffmpeg`, `files.selected.read` and `files.selected.write` permissions. There is no network permission or download lifecycle hook. A published CLI with an older embedded schema cannot validate this example. The TypeScript include is -checkout-relative by design; standalone projects need matching API types when -those packages are released. +checkout-relative by design; standalone projects can use the published +API/CLI 2.2.0 packages with package-based types. ## Behavior and UI diff --git a/examples/media-merge/README.zh-CN.md b/examples/media-merge/README.zh-CN.md index 3820dd1..d759650 100644 --- a/examples/media-merge/README.zh-CN.md +++ b/examples/media-merge/README.zh-CN.md @@ -1,10 +1,10 @@ -# 音视频合并操作示例(尚未发布) +# 音视频合并操作示例(需要兼容宿主) [English](./README.md) | **简体中文** 这是根据官方可选插件 `motrix.media-merge` 改编的完整 SDK 示例。官方实现和签名权限仍属于 [motrixapp/builtin-plugins](https://github.com/motrixapp/builtin-plugins)。教学版本使用 **`example.media-merge`** 和独立显示名称,可以作为未签名第三方示例安装,不冒用官方插件,也不需要官方签名密钥。它不是已经上架的插件。 -**需要 SDK 和宿主都包含尚未发布的操作实现。** `engines.motrix` 为 `>=2.0.0-beta.48 <3.0.0`,以 beta.48 为首个支持版本目标,不代表已经发布。beta.47 会被拒绝,包括仍使用该版本号的开发构建。若功能延期,最低版本也必须相应提高。使用匹配的 SDK 包,并在兼容宿主中配置 FFmpeg。 +**SDK 2.2.0 已发布;运行仍需要兼容的 Motrix 宿主。** `engines.motrix` 为 `>=2.0.0-beta.48 <3.0.0`,以 beta.48 为首个支持版本目标,不代表已经发布。beta.47 会被拒绝,包括仍使用该版本号的开发构建。若功能延期,最低版本也必须相应提高。使用匹配的 SDK 包,并在兼容宿主中配置 FFmpeg。 ## 完整源码 @@ -32,7 +32,7 @@ node ../../packages/plugin-cli/dist/bin/motrix-plugin.js pack node ../../packages/plugin-cli/dist/bin/motrix-plugin.js lint ``` -输出为 `dist/example.media-merge-0.1.0.moext`。这些命令不会签名或发布。通过兼容宿主的正常第三方安装流程安装,检查 `ffmpeg`、`files.selected.read`、`files.selected.write` 权限。示例没有网络权限或下载生命周期 Hook。内嵌旧 Schema 的已发布 CLI 不能校验此示例。TypeScript include 有意使用仓库相对路径;独立项目需要在相关包发布后使用匹配的 API 类型。 +输出为 `dist/example.media-merge-0.1.0.moext`。这些命令不会签名或发布。通过兼容宿主的正常第三方安装流程安装,检查 `ffmpeg`、`files.selected.read`、`files.selected.write` 权限。示例没有网络权限或下载生命周期 Hook。内嵌旧 Schema 的已发布 CLI 不能校验此示例。TypeScript include 有意使用仓库相对路径;独立项目可使用已发布的 CLI/API 2.2.0 和包级类型配置。 ## 行为与界面 diff --git a/examples/text-tools/README.md b/examples/text-tools/README.md index f254440..427111c 100644 --- a/examples/text-tools/README.md +++ b/examples/text-tools/README.md @@ -1,4 +1,4 @@ -# Text deduplication operation example (unreleased) +# Text deduplication operation example (requires a compatible host) **English** | [简体中文](./README.zh-CN.md) @@ -7,12 +7,12 @@ duplicate lines from a user-selected UTF-8 file and saves a new file. It uses th same operation protocol as the media example, without FFmpeg, network permission or unrestricted filesystem access. It is not a marketplace release. -**Requires the unreleased operations implementation in both the SDK and host.** +**SDK 2.2.0 is published; runtime support requires a compatible Motrix host.** The engine range is `>=2.0.0-beta.48 <3.0.0`, targeting beta.48 as the first supporting host release. It must actually provide `operations.ui.v1` and `files.text.v1`; raise the minimum if those features ship later. Beta.47 is rejected, including development builds still reporting that version. This target -does not imply published host or npm package support. +does not imply published host support. ## Complete source @@ -117,8 +117,9 @@ the sandbox handler, not `visibleWhen` or an invented UI callback. ## Generate a project with your own identity -The development CLI now provides `init -t operation [-p publisher]` and -`create-motrix-plugin operation`. They generate this text-operation starting -point with substituted identities, standalone package-based type checking, build -scripts and paired READMEs. Follow the [guide](../../docs/operations.md) for the -matching local SDK dependency setup; published template/API support is not implied. +The published SDK 2.2.0 CLI provides `init -t operation [-p publisher]` +and `create-motrix-plugin operation`. They generate this starting point +with substituted identities, package-based types, build scripts and paired +READMEs. Follow the [guide](../../docs/operations.md) for registry installation +and the outdated notice in the immutable 2.2.0 CLI. A compatible host is still +required. diff --git a/examples/text-tools/README.zh-CN.md b/examples/text-tools/README.zh-CN.md index 8ab327d..cd072e0 100644 --- a/examples/text-tools/README.zh-CN.md +++ b/examples/text-tools/README.zh-CN.md @@ -1,10 +1,10 @@ -# 文本去重操作示例(尚未发布) +# 文本去重操作示例(需要兼容宿主) [English](./README.md) | **简体中文** 这是完整的未签名第三方示例 `community.text-tools`,去除用户所选 UTF-8 文件中的重复行并另存新文件。它与媒体示例使用相同的操作协议,不需要 FFmpeg、网络权限或任意文件系统访问。它不是已经上架的插件。 -**需要 SDK 和宿主都包含尚未发布的操作实现。** 引擎范围为 `>=2.0.0-beta.48 <3.0.0`,以 beta.48 为首个支持版本目标;它必须实际提供 `operations.ui.v1` 和 `files.text.v1`,若延期须同步提高最低版本。beta.47 会被拒绝,包括仍使用该版本号的开发构建。此目标不代表宿主或 npm 包已发布支持。 +**SDK 2.2.0 已发布;运行仍需要兼容的 Motrix 宿主。** 引擎范围为 `>=2.0.0-beta.48 <3.0.0`,以 beta.48 为首个支持版本目标;它必须实际提供 `operations.ui.v1` 和 `files.text.v1`,若延期须同步提高最低版本。beta.47 会被拒绝,包括仍使用该版本号的开发构建。此目标不代表宿主已发布支持。 ## 完整源码 @@ -71,4 +71,4 @@ node ../../packages/plugin-cli/dist/bin/motrix-plugin.js lint ## 生成自己的项目 -开发版 CLI 现提供 `init -t operation [-p publisher]` 和 `create-motrix-plugin operation`,以此文本操作为起点,自动替换身份,生成基于安装包的独立类型检查配置、构建脚本和成对 README。请按 [指南](../../docs/operations.zh-CN.md) 配置匹配的本地 SDK 依赖,不能据此推断已发布模板或 API 支持。 +已发布的 SDK 2.2.0 CLI 提供 `init -t operation [-p publisher]` 和 `create-motrix-plugin operation`,自动替换身份,生成包级类型配置、构建脚本和成对 README。[指南](../../docs/operations.zh-CN.md) 说明 npm 依赖安装方式,以及不可修改的 2.2.0 CLI 中过时提示的处理方式。运行仍需要兼容宿主。 diff --git a/packages/plugin-cli/src/commands/init.ts b/packages/plugin-cli/src/commands/init.ts index 42db623..eeb84cd 100644 --- a/packages/plugin-cli/src/commands/init.ts +++ b/packages/plugin-cli/src/commands/init.ts @@ -40,7 +40,7 @@ export async function init( ...(opts.template === 'operation' ? { notice: - 'Unreleased operation template: use matching development SDK packages and host. Read README.md before installing dependencies; published package versions do not establish operation support.', + 'Operation template requires SDK 2.2.0+ and a compatible Motrix host with operations support. Read README.md for the planned beta.48 host minimum; SDK publication does not establish host availability.', } : {}), } diff --git a/packages/plugin-cli/src/templates/operation/README.md.tpl b/packages/plugin-cli/src/templates/operation/README.md.tpl index 57deccd..15e7be6 100644 --- a/packages/plugin-cli/src/templates/operation/README.md.tpl +++ b/packages/plugin-cli/src/templates/operation/README.md.tpl @@ -4,28 +4,25 @@ A text deduplication operation scaffolded for `{{PLUGIN_ID}}`. -> **Unreleased protocol and template.** Use a Motrix development build and SDK -> packages that implement operations v1, composable UI and scoped text files. -> The host range is `>=2.0.0-beta.48 <3.0.0`, targeting beta.48 as the first -> supporting release. Beta.47 is rejected, including development builds still -> reporting that version. This target and the dependency ranges do not establish -> published support. Raise the host floor if these features ship after beta.48. +> **Requires SDK 2.2.0+ and a compatible Motrix host.** The SDK operation +> protocol and template are published. The host must implement operations v1, +> composable UI and scoped text files. The host range is +> `>=2.0.0-beta.48 <3.0.0`, targeting beta.48 as the first supporting release. +> Beta.47 is rejected, including development builds reporting that version. +> SDK publication does not establish host availability. Raise the host floor if +> these features ship after beta.48. -## Set up matching development dependencies +## Install dependencies -Build a matching plugin-sdk checkout first with `pnpm install --frozen-lockfile` -and `pnpm build` in that checkout. If this project was created immediately inside -that checkout's root, run the following **from this project directory**: +From this project directory, install the published dependencies: ```sh -pnpm add -D @motrix/plugin-api@file:../packages/plugin-api @motrix/plugin-cli@file:../packages/plugin-cli +pnpm install ``` -If the project lives elsewhere, adjust both `file:` paths to the matching built -SDK packages. Do not replace this step with a plain install of the older published -API/CLI. The source checkout's schema is embedded in its CLI build. When matching -SDK packages are released, replace these local dependencies with their actual -released versions; no minimum published SDK package version is assigned here. +The project declares API/CLI 2.2.0 or compatible newer versions. A local SDK +checkout is unnecessary. Use matching local API/CLI dependencies only when +testing SDK changes that are not yet released. ## Check and pack @@ -89,6 +86,5 @@ The template requests no FFmpeg, network or unrestricted filesystem capability. For current controls, layout/condition rules, file grants, limits and unsupported features, read the [SDK operation guide](https://github.com/motrixapp/plugin-sdk/blob/main/docs/operations.md). -Before these sources are published, read `docs/operations.md` in the matching SDK -checkout instead. New UI nodes/capabilities need host support; the template does +New UI nodes/capabilities need host support; the template does not provide custom renderer HTML, JavaScript or CSS. diff --git a/packages/plugin-cli/src/templates/operation/README.zh-CN.md.tpl b/packages/plugin-cli/src/templates/operation/README.zh-CN.md.tpl index 774dce9..a9a08ed 100644 --- a/packages/plugin-cli/src/templates/operation/README.zh-CN.md.tpl +++ b/packages/plugin-cli/src/templates/operation/README.zh-CN.md.tpl @@ -4,17 +4,17 @@ 为 `{{PLUGIN_ID}}` 生成的文本去重操作项目。 -> **协议与模板尚未发布。** 使用包含操作 v1、可组合 UI 和受限文本文件能力的 Motrix 构建及 SDK 包。宿主范围为 `>=2.0.0-beta.48 <3.0.0`,以 beta.48 为首个支持版本目标。beta.47 会被拒绝,包括仍使用该版本号的开发构建。此目标与依赖版本范围不代表已发布支持;若功能晚于 beta.48 发布,须同步提高最低宿主版本。 +> **需要 SDK 2.2.0+ 和兼容的 Motrix 宿主。** SDK 操作协议与模板已发布,宿主仍需提供操作 v1、可组合 UI 和受限文本文件能力。宿主范围为 `>=2.0.0-beta.48 <3.0.0`,以 beta.48 为首个支持版本目标。beta.47 会被拒绝,包括仍使用该版本号的开发构建。SDK 发布不代表宿主功能已发布;若功能晚于 beta.48 发布,须同步提高最低宿主版本。 -## 配置匹配的开发依赖 +## 安装依赖 -先在匹配的 plugin-sdk 源码仓库执行 `pnpm install --frozen-lockfile` 和 `pnpm build`。如果本项目直接创建在该仓库根目录下,请在**本项目目录**执行: +在本项目目录安装已发布依赖: ```sh -pnpm add -D @motrix/plugin-api@file:../packages/plugin-api @motrix/plugin-cli@file:../packages/plugin-cli +pnpm install ``` -如果项目位于其他位置,将两个 `file:` 路径改为实际构建好的 SDK 包位置。不能用普通安装旧版 npm API/CLI 来代替这一步;源码中的 Schema 会内嵌到 CLI 构建产物中。配套 SDK 正式发布后,再将本地依赖改为实际发布版本;模板目前不指定已发布 SDK 包的最低版本。 +项目声明 API/CLI 2.2.0 或兼容的新版本,不需要本地 SDK 仓库。仅在测试尚未发布的 SDK 改动时,才使用匹配的本地 API/CLI 依赖。 ## 检查与打包 @@ -54,4 +54,4 @@ pnpm run lint - 已有目标、过期或变化的输入、未经授权引用应被拒绝;不能移除宿主授权检查来运行示例。 - 在保存前取消并等待清理。小文件可能快到无法手工取消,不能将其算作取消验证证据。 -控件、布局及条件、文件授权、限制和未支持能力见 [SDK 操作指南](https://github.com/motrixapp/plugin-sdk/blob/main/docs/operations.zh-CN.md)。源码发布前,请改为阅读配套 SDK 仓库中的 `docs/operations.zh-CN.md`。新增 UI 节点或能力需要宿主支持;模板不提供自定义 renderer HTML、JavaScript 或 CSS。 +控件、布局及条件、文件授权、限制和未支持能力见 [SDK 操作指南](https://github.com/motrixapp/plugin-sdk/blob/main/docs/operations.zh-CN.md)。新增 UI 节点或能力需要宿主支持;模板不提供自定义 renderer HTML、JavaScript 或 CSS。 diff --git a/packages/plugin-cli/tests/cli.test.ts b/packages/plugin-cli/tests/cli.test.ts index a686bc6..d79713f 100644 --- a/packages/plugin-cli/tests/cli.test.ts +++ b/packages/plugin-cli/tests/cli.test.ts @@ -144,7 +144,7 @@ describe('motrix-plugin CLI', () => { cwd: tmpDir, encoding: 'utf8', }) - expect(stdout).toContain('Unreleased operation template') + expect(stdout).toContain('Operation template requires SDK 2.2.0+') const project = path.join(tmpDir, 'text-demo') const manifest = JSON.parse( await readFile(path.join(project, 'motrix-plugin.json'), 'utf8')