@motrix/plugin-cli 2.1.1 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -5
- package/dist/bin/create-motrix-plugin.js +15 -5
- package/dist/bin/motrix-plugin.js +2143 -912
- package/dist/templates/operation/.gitignore.tpl +8 -0
- package/dist/templates/operation/README.md.tpl +94 -0
- package/dist/templates/operation/README.zh-CN.md.tpl +57 -0
- package/dist/templates/operation/esbuild.config.mjs.tpl +13 -0
- package/dist/templates/operation/locales/en-US.json.tpl +19 -0
- package/dist/templates/operation/locales/zh-CN.json.tpl +19 -0
- package/dist/templates/operation/motrix-plugin.json.tpl +181 -0
- package/dist/templates/operation/package.json.tpl +23 -0
- package/dist/templates/operation/src/index.ts.tpl +19 -0
- package/dist/templates/operation/tsconfig.json.tpl +14 -0
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -19,10 +19,12 @@ pnpm dlx @motrix/plugin-cli init my-plugin
|
|
|
19
19
|
## Commands
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
|
-
motrix-plugin init <name> [-t basic-resolver|post-action] [-p <publisher>]
|
|
22
|
+
motrix-plugin init <name> [-t basic-resolver|post-action|operation] [-p <publisher>]
|
|
23
23
|
```
|
|
24
|
-
Scaffold a new plugin project from
|
|
25
|
-
`
|
|
24
|
+
Scaffold a new plugin project from `basic-resolver`, `post-action` or the
|
|
25
|
+
**unreleased** `operation` template into `./<name>`. `operation` starts with text
|
|
26
|
+
deduplication, a host-rendered form, a private handler, both locales, strict type
|
|
27
|
+
checking and paired READMEs. Use the operations guide for matching local SDK setup.
|
|
26
28
|
|
|
27
29
|
```bash
|
|
28
30
|
motrix-plugin dev
|
|
@@ -98,9 +100,13 @@ pnpm create motrix-plugin my-plugin [template]
|
|
|
98
100
|
Equivalent to `motrix-plugin init`, usable without a prior install via the
|
|
99
101
|
`create-*` npm convention.
|
|
100
102
|
|
|
103
|
+
## Plugin operations (unreleased)
|
|
104
|
+
|
|
105
|
+
The development CLI validates and packs operation manifests using its embedded development schema. Use `init <name> -t operation [-p publisher]` or `create-motrix-plugin <name> operation` to generate a complete text-operation project. Build this checkout and follow the guide's local dependency setup; installing a published CLI with an older embedded schema is insufficient. Run `validate`, then `pack`, then `lint` (which reads the bundle), with TypeScript checking separately.
|
|
106
|
+
|
|
107
|
+
See the [English guide](../../docs/operations.md) or [Chinese guide](../../docs/operations.zh-CN.md), including complete media and text examples, supported controls, limits and compatibility requirements. The examples target Motrix beta.48 or later (below 3.0.0), contingent on that release shipping the required features; this is not a claim of published support.
|
|
108
|
+
|
|
101
109
|
## Learn more
|
|
102
110
|
|
|
103
111
|
- Manifest shape reference: [`@motrix/plugin-manifest-schema`](https://www.npmjs.com/package/@motrix/plugin-manifest-schema)
|
|
104
112
|
- Plugin runtime types: [`@motrix/plugin-api`](https://www.npmjs.com/package/@motrix/plugin-api)
|
|
105
|
-
- Design background: `docs/superpowers/specs/2026-05-09-plugin-ecosystem-design.md`
|
|
106
|
-
in the [motrix-turbo](https://gitlab.com/agalwood/motrix-turbo) repository
|
|
@@ -8,6 +8,11 @@ var TEMPLATES = path.resolve(
|
|
|
8
8
|
fileURLToPath(import.meta.url),
|
|
9
9
|
"../../templates"
|
|
10
10
|
);
|
|
11
|
+
var templateNames = [
|
|
12
|
+
"basic-resolver",
|
|
13
|
+
"post-action",
|
|
14
|
+
"operation"
|
|
15
|
+
];
|
|
11
16
|
async function init(opts) {
|
|
12
17
|
const target = path.resolve(opts.destDir, opts.projectName);
|
|
13
18
|
await mkdir(target, { recursive: true });
|
|
@@ -17,7 +22,12 @@ async function init(opts) {
|
|
|
17
22
|
PUBLISHER: opts.publisher,
|
|
18
23
|
PLUGIN_ID: `${opts.publisher}.${opts.projectName}`
|
|
19
24
|
});
|
|
20
|
-
return {
|
|
25
|
+
return {
|
|
26
|
+
created: target,
|
|
27
|
+
...opts.template === "operation" ? {
|
|
28
|
+
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."
|
|
29
|
+
} : {}
|
|
30
|
+
};
|
|
21
31
|
}
|
|
22
32
|
async function copyTree(src, dst, vars) {
|
|
23
33
|
for (const e of await readdir(src, { withFileTypes: true })) {
|
|
@@ -38,19 +48,19 @@ async function copyTree(src, dst, vars) {
|
|
|
38
48
|
}
|
|
39
49
|
|
|
40
50
|
// src/bin/create-motrix-plugin.ts
|
|
41
|
-
var validTemplates = ["basic-resolver", "post-action"];
|
|
42
51
|
var [name = "my-plugin", rawTemplate = "basic-resolver"] = process.argv.slice(2);
|
|
43
|
-
if (!
|
|
52
|
+
if (!templateNames.includes(rawTemplate)) {
|
|
44
53
|
console.error(
|
|
45
|
-
`Unknown template: ${rawTemplate}. Available: ${
|
|
54
|
+
`Unknown template: ${rawTemplate}. Available: ${templateNames.join(", ")}`
|
|
46
55
|
);
|
|
47
56
|
process.exit(1);
|
|
48
57
|
}
|
|
49
58
|
var template = rawTemplate;
|
|
50
|
-
await init({
|
|
59
|
+
var result = await init({
|
|
51
60
|
projectName: name,
|
|
52
61
|
template,
|
|
53
62
|
destDir: process.cwd(),
|
|
54
63
|
publisher: "me"
|
|
55
64
|
});
|
|
56
65
|
console.log("Created", name);
|
|
66
|
+
if (result.notice) console.log(result.notice);
|