@cxyhhhhh/qraft-plugin-system 0.0.0-stage → 0.1.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.
@@ -0,0 +1,8 @@
1
+ import { type PluginDefinition } from "@cxyhhhhh/qraft-core";
2
+ export declare const PLUGIN_ID: "@cxyhhhhh/qraft-plugin-system";
3
+ export interface SystemPluginOptions {
4
+ /** Label supplied by the application that created the store. */
5
+ storageType?: string;
6
+ }
7
+ export declare function systemPlugin(options?: SystemPluginOptions): PluginDefinition;
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAElE,eAAO,MAAM,SAAS,EAAG,sBAA+B,CAAC;AAEzD,MAAM,WAAW,mBAAmB;IAClC,gEAAgE;IAChE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,YAAY,CAAC,OAAO,GAAE,mBAAwB,GAAG,gBAAgB,CAsDhF"}
package/dist/index.js ADDED
@@ -0,0 +1,58 @@
1
+ import { definePlugin } from "@cxyhhhhh/qraft-core";
2
+ export const PLUGIN_ID = "@cxyhhhhh/qraft-plugin-system";
3
+ export function systemPlugin(options = {}) {
4
+ return definePlugin({
5
+ manifest: {
6
+ id: PLUGIN_ID,
7
+ permissions: ["command.register"],
8
+ description: "Help, status, and plugin list",
9
+ },
10
+ setup(ctx) {
11
+ ctx.router.register({
12
+ kind: "system",
13
+ name: "help",
14
+ description: "查看命令",
15
+ async handler(event) {
16
+ const lines = ctx.router.listCommands().map((command) => {
17
+ const aliases = command.aliases.length > 0 ? ` (${command.aliases.map((alias) => `/${alias}`).join(", ")})` : "";
18
+ const description = command.description ? ` ${command.description}` : "";
19
+ return `/${command.name}${aliases}${description}`;
20
+ });
21
+ await event.session?.reply(lines.join("\n"));
22
+ },
23
+ });
24
+ ctx.router.register({
25
+ kind: "system",
26
+ name: "status",
27
+ description: "查看运行状态",
28
+ async handler(event) {
29
+ const plugins = ctx.pluginIds().length;
30
+ const commands = ctx.router.listCommands().length;
31
+ await event.session?.reply(`插件 ${plugins}\n命令 ${commands}`);
32
+ },
33
+ });
34
+ ctx.router.register({
35
+ kind: "system",
36
+ name: "plugins",
37
+ description: "查看已加载插件",
38
+ async handler(event) {
39
+ await event.session?.reply(ctx.pluginIds().join("\n"));
40
+ },
41
+ });
42
+ ctx.router.register({
43
+ kind: "system",
44
+ name: "runtime",
45
+ description: "查看运行时诊断",
46
+ async handler(event) {
47
+ await event.session?.reply([
48
+ `版本 ${ctx.runtime.version}`,
49
+ `插件 ${ctx.pluginIds().length}`,
50
+ `命令 ${ctx.router.listCommands().length}`,
51
+ `存储 ${options.storageType ?? ctx.runtime.storageType}`,
52
+ ].join("\n"));
53
+ },
54
+ });
55
+ },
56
+ });
57
+ }
58
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAyB,MAAM,aAAa,CAAC;AAElE,MAAM,CAAC,MAAM,SAAS,GAAG,sBAA+B,CAAC;AAOzD,MAAM,UAAU,YAAY,CAAC,UAA+B,EAAE;IAC5D,OAAO,YAAY,CAAC;QAClB,QAAQ,EAAE;YACR,EAAE,EAAE,SAAS;YACb,WAAW,EAAE,CAAC,kBAAkB,CAAC;YACjC,WAAW,EAAE,+BAA+B;SAC7C;QACD,KAAK,CAAC,GAAG;YACP,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC;gBAClB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,MAAM;gBACZ,WAAW,EAAE,MAAM;gBACnB,KAAK,CAAC,OAAO,CAAC,KAAK;oBACjB,MAAM,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,YAAY,EAAE,CAA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AAK,CAAC,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;gBACzD,CAAC;aACF,CAAC,CAAC;YACH,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC;gBAClB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,SAAS;gBACtB,KAAK,CAAC,OAAO,CAAC,KAAK;oBACjB,MAAM,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC;wBACzB,MAAM,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE;wBAC3B,MAAM,GAAG,CAAC,SAAS,EAAE,CAAC,MAAM,EAAE;wBAC9B,MAAM,GAAG,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,MAAM,EAAE;wBACxC,MAAM,OAAO,CAAC,WAAW,IAAI,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE;qBACvD,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;gBAChB,CAAC;aACF,CAAC,CAAC;QACL,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,24 @@
1
1
  {
2
2
  "name": "@cxyhhhhh/qraft-plugin-system",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "Built-in help and status commands.",
5
+ "type": "module",
6
+ "files": ["dist"],
7
+ "publishConfig": { "access": "public" },
8
+ "engines": { "node": ">=22.5" },
9
+ "main": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "import": "./dist/index.js"
15
+ }
16
+ },
17
+ "scripts": {
18
+ "build": "tsc -p tsconfig.json",
19
+ "typecheck": "tsc -p tsconfig.json --noEmit"
20
+ },
21
+ "dependencies": {
22
+ "@cxyhhhhh/qraft-core": "0.1.0"
23
+ }
24
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.