Refresh SCUM plugin page contract
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
"id": "game.scum",
|
"id": "game.scum",
|
||||||
"name": "SCUM Server",
|
"name": "SCUM Server",
|
||||||
"description": "First-party SCUM game server operations plugin with platform-mediated lifecycle and companion bridge support.",
|
"description": "First-party SCUM game server operations plugin with platform-mediated lifecycle and companion bridge support.",
|
||||||
"version": "0.1.4",
|
"version": "0.1.5",
|
||||||
"kind": "game-plugin",
|
"kind": "game-plugin",
|
||||||
"tags": [
|
"tags": [
|
||||||
"scum",
|
"scum",
|
||||||
@@ -374,8 +374,8 @@
|
|||||||
"approvalRequired": ["disable", "rollback", "retire"]
|
"approvalRequired": ["disable", "rollback", "retire"]
|
||||||
},
|
},
|
||||||
"pages": [
|
"pages": [
|
||||||
{ "key": "files-config", "title": "文件管理", "path": "/files-config", "bundleKey": "scum-server-plugin", "bundleVersion": "1.0.3", "bundleIntegritySha256": "sha256:797c4e303c102f0316e71e4e5bda50a6ca96506a7cb368a42ecf858b236609b2", "permissions": ["server.read", "server.files.read", "server.files.write", "server.logs.read"], "bridgeActions": ["server.instances.read", "files.request", "logs.query"], "featureKeys": ["config.manage"] },
|
{ "key": "files-config", "title": "文件管理", "path": "/files-config", "bundleKey": "scum-server-plugin", "bundleVersion": "1.0.3", "bundleIntegritySha256": "sha256:797c4e303c102f0316e71e4e5bda50a6ca96506a7cb368a42ecf858b236609b2", "permissions": ["server.read", "server.files.read", "server.files.write", "server.logs.read", "server.game-client.read", "server.game-client.command", "server.game-client.maintenance"], "bridgeActions": ["server.instances.read", "files.request", "logs.query"], "featureKeys": ["config.manage"] },
|
||||||
{ "key": "players", "title": "用户管理", "path": "/players", "bundleKey": "scum-server-plugin", "bundleVersion": "1.0.3", "bundleIntegritySha256": "sha256:797c4e303c102f0316e71e4e5bda50a6ca96506a7cb368a42ecf858b236609b2", "permissions": ["server.read", "server.game-client.read", "server.game-client.command"], "bridgeActions": ["server.instances.read"], "featureKeys": ["player.intelligence", "state.patch"] },
|
{ "key": "players", "title": "用户管理", "path": "/players", "bundleKey": "scum-server-plugin", "bundleVersion": "1.0.3", "bundleIntegritySha256": "sha256:797c4e303c102f0316e71e4e5bda50a6ca96506a7cb368a42ecf858b236609b2", "permissions": ["server.read", "server.game-client.read", "server.game-client.command", "server.game-client.maintenance"], "bridgeActions": ["server.instances.read"], "featureKeys": ["player.intelligence", "state.patch"] },
|
||||||
{ "key": "squads", "title": "队伍管理", "path": "/squads", "bundleKey": "scum-server-plugin", "bundleVersion": "1.0.3", "bundleIntegritySha256": "sha256:797c4e303c102f0316e71e4e5bda50a6ca96506a7cb368a42ecf858b236609b2", "permissions": ["server.read", "server.game-client.read"], "bridgeActions": ["server.instances.read"], "featureKeys": ["player.intelligence"] },
|
{ "key": "squads", "title": "队伍管理", "path": "/squads", "bundleKey": "scum-server-plugin", "bundleVersion": "1.0.3", "bundleIntegritySha256": "sha256:797c4e303c102f0316e71e4e5bda50a6ca96506a7cb368a42ecf858b236609b2", "permissions": ["server.read", "server.game-client.read"], "bridgeActions": ["server.instances.read"], "featureKeys": ["player.intelligence"] },
|
||||||
{ "key": "live-map", "title": "实时地图", "path": "/live-map", "bundleKey": "scum-server-plugin", "bundleVersion": "1.0.3", "bundleIntegritySha256": "sha256:797c4e303c102f0316e71e4e5bda50a6ca96506a7cb368a42ecf858b236609b2", "permissions": ["server.read", "server.game-client.read"], "bridgeActions": ["server.instances.read"], "featureKeys": ["trajectory.collect"] },
|
{ "key": "live-map", "title": "实时地图", "path": "/live-map", "bundleKey": "scum-server-plugin", "bundleVersion": "1.0.3", "bundleIntegritySha256": "sha256:797c4e303c102f0316e71e4e5bda50a6ca96506a7cb368a42ecf858b236609b2", "permissions": ["server.read", "server.game-client.read"], "bridgeActions": ["server.instances.read"], "featureKeys": ["trajectory.collect"] },
|
||||||
{ "key": "gifts", "title": "礼包管理", "path": "/gifts", "bundleKey": "scum-server-plugin", "bundleVersion": "1.0.3", "bundleIntegritySha256": "sha256:797c4e303c102f0316e71e4e5bda50a6ca96506a7cb368a42ecf858b236609b2", "permissions": ["server.read", "server.game-client.read", "server.game-client.command"], "bridgeActions": ["server.instances.read"], "featureKeys": ["reward.delivery"] }
|
{ "key": "gifts", "title": "礼包管理", "path": "/gifts", "bundleKey": "scum-server-plugin", "bundleVersion": "1.0.3", "bundleIntegritySha256": "sha256:797c4e303c102f0316e71e4e5bda50a6ca96506a7cb368a42ecf858b236609b2", "permissions": ["server.read", "server.game-client.read", "server.game-client.command"], "bridgeActions": ["server.instances.read"], "featureKeys": ["reward.delivery"] }
|
||||||
|
|||||||
@@ -441,7 +441,7 @@ describe("plugin manifest validation", () => {
|
|||||||
snapshots: Array<{ type: string; schemaVersion: string; schemaRef: string }>;
|
snapshots: Array<{ type: string; schemaVersion: string; schemaRef: string }>;
|
||||||
pages: Array<{ pageKey: string; commandTypes?: string[]; snapshotTypes?: string[] }>;
|
pages: Array<{ pageKey: string; commandTypes?: string[]; snapshotTypes?: string[] }>;
|
||||||
};
|
};
|
||||||
pages: Array<{ key: string }>;
|
pages: Array<{ key: string; permissions?: string[] }>;
|
||||||
fileWorkspace?: {
|
fileWorkspace?: {
|
||||||
defaultDirectoryKey: string;
|
defaultDirectoryKey: string;
|
||||||
directories: Array<{ key: string; label: string; scope: string }>;
|
directories: Array<{ key: string; label: string; scope: string }>;
|
||||||
@@ -459,11 +459,13 @@ describe("plugin manifest validation", () => {
|
|||||||
health?: { intervalSeconds?: number; degradedAfterSeconds?: number; offlineAfterSeconds?: number };
|
health?: { intervalSeconds?: number; degradedAfterSeconds?: number; offlineAfterSeconds?: number };
|
||||||
}>;
|
}>;
|
||||||
};
|
};
|
||||||
|
version: string;
|
||||||
};
|
};
|
||||||
const installAction = JSON.parse(fs.readFileSync(path.join(pluginsRoot, "examples/scum-server-plugin/actions/install.json"), "utf8")) as { environment?: Record<string, string> };
|
const installAction = JSON.parse(fs.readFileSync(path.join(pluginsRoot, "examples/scum-server-plugin/actions/install.json"), "utf8")) as { environment?: Record<string, string> };
|
||||||
const serialized = JSON.stringify(manifest).toLowerCase();
|
const serialized = JSON.stringify(manifest).toLowerCase();
|
||||||
|
|
||||||
expect(serialized).not.toContain("local-proof");
|
expect(serialized).not.toContain("local-proof");
|
||||||
|
expect(manifest.version).toBe("0.1.5");
|
||||||
expect(installAction.environment?.SERVER_TEMPLATE).toBe("scum-server");
|
expect(installAction.environment?.SERVER_TEMPLATE).toBe("scum-server");
|
||||||
expect(manifest.permissions).toEqual(expect.arrayContaining(["server.game-client.read", "server.game-client.command", "server.game-client.maintenance"]));
|
expect(manifest.permissions).toEqual(expect.arrayContaining(["server.game-client.read", "server.game-client.command", "server.game-client.maintenance"]));
|
||||||
expect(manifest.gameClientBridge.commands.map((command) => command.type)).toEqual(expect.arrayContaining([
|
expect(manifest.gameClientBridge.commands.map((command) => command.type)).toEqual(expect.arrayContaining([
|
||||||
@@ -487,6 +489,8 @@ describe("plugin manifest validation", () => {
|
|||||||
"maintenance.prepare"
|
"maintenance.prepare"
|
||||||
]));
|
]));
|
||||||
expect(manifest.pages.map((page) => page.key)).toEqual(expect.arrayContaining(["files-config", "players", "squads", "live-map", "gifts"]));
|
expect(manifest.pages.map((page) => page.key)).toEqual(expect.arrayContaining(["files-config", "players", "squads", "live-map", "gifts"]));
|
||||||
|
expect(manifest.pages.find((page) => page.key === "files-config")?.permissions).toEqual(expect.arrayContaining(["server.game-client.read", "server.game-client.command", "server.game-client.maintenance"]));
|
||||||
|
expect(manifest.pages.find((page) => page.key === "players")?.permissions).toEqual(expect.arrayContaining(["server.game-client.read", "server.game-client.command", "server.game-client.maintenance"]));
|
||||||
expect(manifest.fileWorkspace?.defaultDirectoryKey).toBe("scum-config");
|
expect(manifest.fileWorkspace?.defaultDirectoryKey).toBe("scum-config");
|
||||||
expect(manifest.fileWorkspace?.directories.map((directory) => directory.key)).toEqual(["scum-config", "scum-logs"]);
|
expect(manifest.fileWorkspace?.directories.map((directory) => directory.key)).toEqual(["scum-config", "scum-logs"]);
|
||||||
expect(manifest.fileWorkspace?.files.map((file) => file.key)).toEqual(expect.arrayContaining(["scum-server-settings", "scum-game-config", "scum-engine-config", "scum-game-user-settings", "scum-admin-log", "scum-chat-log", "scum-kill-log", "scum-login-log", "scum-server-log"]));
|
expect(manifest.fileWorkspace?.files.map((file) => file.key)).toEqual(expect.arrayContaining(["scum-server-settings", "scum-game-config", "scum-engine-config", "scum-game-user-settings", "scum-admin-log", "scum-chat-log", "scum-kill-log", "scum-login-log", "scum-server-log"]));
|
||||||
|
|||||||
@@ -306,6 +306,7 @@ const missing = [];
|
|||||||
const declaredPermissions = Array.isArray(plugin.declaredPermissions) ? plugin.declaredPermissions : [];
|
const declaredPermissions = Array.isArray(plugin.declaredPermissions) ? plugin.declaredPermissions : [];
|
||||||
const bridgeActions = Array.isArray(plugin.bridgeActions) ? plugin.bridgeActions : [];
|
const bridgeActions = Array.isArray(plugin.bridgeActions) ? plugin.bridgeActions : [];
|
||||||
const lifecycleProfiles = plugin.runtimeProfiles?.lifecycleProfiles ?? [];
|
const lifecycleProfiles = plugin.runtimeProfiles?.lifecycleProfiles ?? [];
|
||||||
|
const pageKeys = (plugin.pages ?? []).map((page) => page.key);
|
||||||
if (plugin.version !== expectedVersion) {
|
if (plugin.version !== expectedVersion) {
|
||||||
missing.push(`version ${expectedVersion}`);
|
missing.push(`version ${expectedVersion}`);
|
||||||
}
|
}
|
||||||
@@ -321,6 +322,11 @@ if (!lifecycleProfiles.some((profile) => profile.key === "run-local")) {
|
|||||||
if (!plugin.gameClientBridge?.commands?.length) {
|
if (!plugin.gameClientBridge?.commands?.length) {
|
||||||
missing.push("game client bridge declarations");
|
missing.push("game client bridge declarations");
|
||||||
}
|
}
|
||||||
|
for (const pageKey of ["files-config", "players", "squads", "live-map", "gifts"]) {
|
||||||
|
if (!pageKeys.includes(pageKey)) {
|
||||||
|
missing.push(`SCUM page ${pageKey}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (missing.length > 0) {
|
if (missing.length > 0) {
|
||||||
console.error(`SCUM plugin registration is stale or incomplete: missing ${missing.join(", ")}`);
|
console.error(`SCUM plugin registration is stale or incomplete: missing ${missing.join(", ")}`);
|
||||||
console.error("Run scripts/dev-reset.sh, restart the local debug stack, then rerun scripts/dev-smoke.sh.");
|
console.error("Run scripts/dev-reset.sh, restart the local debug stack, then rerun scripts/dev-smoke.sh.");
|
||||||
@@ -777,7 +783,7 @@ const manifest = {
|
|||||||
gameClientBridge: localGameClientBridge
|
gameClientBridge: localGameClientBridge
|
||||||
};
|
};
|
||||||
fs.writeFileSync(outputPath, JSON.stringify({
|
fs.writeFileSync(outputPath, JSON.stringify({
|
||||||
manifestRef: "artifact://manifests/game.scum/0.1.0",
|
manifestRef: `artifact://manifests/game.scum/${source.version}`,
|
||||||
manifest,
|
manifest,
|
||||||
assetFiles: readAssetFiles(source)
|
assetFiles: readAssetFiles(source)
|
||||||
}, null, 2));
|
}, null, 2));
|
||||||
|
|||||||
Reference in New Issue
Block a user