@zaisma/cli 0.37.0 → 0.39.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/package.json +1 -1
- package/zaisma.mjs +32 -10
package/package.json
CHANGED
package/zaisma.mjs
CHANGED
|
@@ -153,6 +153,7 @@ const COMMANDS = {
|
|
|
153
153
|
flags: {
|
|
154
154
|
game: { hasValue: true, isRequired: true, placeholder: "<slug>", about: "The game to upload to" },
|
|
155
155
|
"patch-notes": { hasValue: true, placeholder: '"…"', about: "What changed, shown with the update" },
|
|
156
|
+
"after-review": { about: "With --publish-when-approved: go live only once the AI review passes, for a developer who could go first" },
|
|
156
157
|
"publish-when-approved": { hasValue: false, about: "Go live as soon as it passes review" },
|
|
157
158
|
"big-update": { hasValue: false, about: "With --publish-when-approved and --patch-notes: mark it a big update; left out, it goes live as a quiet patch" },
|
|
158
159
|
"match-update-mode": { hasValue: true, choices: MATCH_UPDATE_MODES, about: "With --publish-when-approved: when running matches get it: next_match (they finish on the version they started; the default) or now (every live match switches within seconds, in the same room)" },
|
|
@@ -173,12 +174,14 @@ const COMMANDS = {
|
|
|
173
174
|
about: "Publish a version that passed, or roll back to an older one",
|
|
174
175
|
arguments: [{ name: "slug" }, { name: "version_id" }],
|
|
175
176
|
flags: {
|
|
177
|
+
"after-review": { about: "Go live only once the AI review passes, for a developer who could go first" },
|
|
176
178
|
"scheduled-publish-at": { hasValue: true, placeholder: "<time>", about: 'Publish later instead: an ISO 8601 time with Z or an offset, like "2026-11-01T17:00:00Z" or "2026-11-01T17:00+01:00"' },
|
|
177
179
|
"big-update": { hasValue: false, about: "Mark it a big update, which must say what's new; left out, it's a quiet patch" },
|
|
178
180
|
"patch-notes": { hasValue: true, placeholder: '"…"', about: "What changed, in place of what it was uploaded with; only for a version that has never been live" },
|
|
179
181
|
"match-update-mode": { hasValue: true, choices: MATCH_UPDATE_MODES, about: "When running matches get it: next_match (they finish on the version they started; the default) or now (every live match switches within seconds, in the same room)" },
|
|
180
182
|
},
|
|
181
183
|
},
|
|
184
|
+
"ai-review": { about: "Start a version's AI review without publishing it, ahead of a launch", arguments: [{ name: "slug" }, { name: "version_id" }], flags: {} },
|
|
182
185
|
unschedule: { about: "Cancel a publish-later", arguments: [{ name: "slug" }, { name: "version_id" }], flags: {} },
|
|
183
186
|
visibility: { about: "Set who can see a game: everyone (listed), people with the link (unlisted), or only you and tester links (private, draft)", arguments: [{ name: "slug" }, { name: "visibility", choices: VISIBILITIES }], flags: {} },
|
|
184
187
|
"allowed-hosts": {
|
|
@@ -209,7 +212,9 @@ const COMMANDS = {
|
|
|
209
212
|
},
|
|
210
213
|
"items remove": { about: "Remove an item nobody bought or was granted", arguments: [{ name: "slug" }, { name: "item_name" }], flags: {} },
|
|
211
214
|
"kept-rooms": { about: "A game's kept rooms (room.setKept), worlds that sleep with nobody in them: each one's code, name, size and when it was last played, and the game's storage", arguments: [{ name: "slug" }], flags: {} },
|
|
212
|
-
"kept-rooms delete": { about: "Delete a kept room's world
|
|
215
|
+
"kept-rooms delete": { about: "Delete a kept room's world; players in it are sent out, and it waits a week before it's erased", arguments: [{ name: "slug" }, { name: "room_code" }], flags: {} },
|
|
216
|
+
"kept-rooms bring-back": { about: "Bring back a kept room's world waiting to be erased, as it was", arguments: [{ name: "slug" }, { name: "room_code" }], flags: {} },
|
|
217
|
+
"kept-rooms erase-now": { about: "Erase a waiting kept room's world at once; answers a link where the developer approves with a passkey tap", arguments: [{ name: "slug" }, { name: "room_code" }], flags: {} },
|
|
213
218
|
rooms: { about: "A game's live rooms on Zaisma, newest first: each one's code, name, labels, players and spectators, and whether it's kept", arguments: [{ name: "slug" }], flags: {} },
|
|
214
219
|
logs: {
|
|
215
220
|
about: "What a game's server printed on Zaisma in the last 30 days, oldest first: the newest lines, older ones with --cursor, or new ones as they come with --follow",
|
|
@@ -312,7 +317,7 @@ const COMMANDS = {
|
|
|
312
317
|
help: { about: "This help; with --json, every command, flag, exit code and error code", arguments: [], flags: {} },
|
|
313
318
|
};
|
|
314
319
|
/** Commands with a second word, like zaisma forum post. */
|
|
315
|
-
const SUBCOMMANDS = { links: ["set", "remove"], forum: ["post", "message", "reply"], database: ["query", "batch", "export", "import", "restore", "undo-restore"], saves: ["get", "change", "replace", "reset", "copies", "copy", "restore"], secrets: ["set", "delete"], items: ["set", "remove"], "kept-rooms": ["delete"] };
|
|
320
|
+
const SUBCOMMANDS = { links: ["set", "remove"], forum: ["post", "message", "reply"], database: ["query", "batch", "export", "import", "restore", "undo-restore"], saves: ["get", "change", "replace", "reset", "copies", "copy", "restore"], secrets: ["set", "delete"], items: ["set", "remove"], "kept-rooms": ["delete", "bring-back", "erase-now"] };
|
|
316
321
|
/** Flags every command takes. */
|
|
317
322
|
const GLOBAL_FLAGS = {
|
|
318
323
|
json: { hasValue: false, about: "Print the API's answer as JSON, as-is (on failure its { error }), and nothing else" },
|
|
@@ -1187,7 +1192,7 @@ async function sendVersion(slug, fixedFiles, flags) {
|
|
|
1187
1192
|
);
|
|
1188
1193
|
if (todo.length && !isJson) process.stdout.write("\n");
|
|
1189
1194
|
|
|
1190
|
-
let answer = await api("POST", `/games/${slug}/versions`, { files: list, patch_notes: flags["patch-notes"] ?? "", publish_when_approved: flags["publish-when-approved"] === true, ...(flags["match-update-mode"] !== undefined ? { match_update_mode: flags["match-update-mode"] } : {}), ...(flags["big-update"] === true ? { is_big_update: true } : {}) });
|
|
1195
|
+
let answer = await api("POST", `/games/${slug}/versions`, { files: list, patch_notes: flags["patch-notes"] ?? "", publish_when_approved: flags["publish-when-approved"] === true, ...(flags["match-update-mode"] !== undefined ? { match_update_mode: flags["match-update-mode"] } : {}), ...(flags["big-update"] === true ? { is_big_update: true } : {}), ...(flags["after-review"] === true ? { publish_after_ai_review_enabled: true } : {}) });
|
|
1191
1196
|
const versionId = answer.version.id;
|
|
1192
1197
|
say(`Version ${versionId} is being scanned. This usually takes under a minute…`);
|
|
1193
1198
|
|
|
@@ -1945,19 +1950,28 @@ async function liveRooms(values) {
|
|
|
1945
1950
|
if (answer.next_cursor) console.log(`${answer.room_count} rooms in all; --json, or list_rooms with cursor, gives the rest.`);
|
|
1946
1951
|
}
|
|
1947
1952
|
|
|
1948
|
-
/** A game's kept rooms (…/games/<slug>/kept-rooms…), as the MCP's list_kept_rooms and
|
|
1953
|
+
/** A game's kept rooms (…/games/<slug>/kept-rooms…), as the MCP's list_kept_rooms, delete_kept_room, bring_back_kept_room and erase_kept_room_now. */
|
|
1949
1954
|
async function keptRooms(command, values) {
|
|
1950
1955
|
if (command === "kept-rooms") {
|
|
1951
1956
|
const answer = await api("GET", `/games/${values.slug}/kept-rooms`);
|
|
1952
1957
|
if (isJson) return printJson(answer);
|
|
1953
1958
|
if (!answer.kept_rooms.length) console.log(`No kept rooms. A game server keeps one with room.setKept(true).`);
|
|
1954
|
-
for (const keptRoom of answer.kept_rooms) console.log(`${keptRoom.room_code} ${(keptRoom.name ?? "").padEnd(24)} ${sizeText(keptRoom.saved_size_bytes).padStart(9)} played ${keptRoom.last_played_at ? when(keptRoom.last_played_at) : "never"}`);
|
|
1959
|
+
for (const keptRoom of answer.kept_rooms) console.log(`${keptRoom.room_code} ${(keptRoom.name ?? "").padEnd(24)} ${sizeText(keptRoom.saved_size_bytes).padStart(9)} played ${keptRoom.erases_at ? `waiting, erased ${when(keptRoom.erases_at)} ` : ""}${keptRoom.last_played_at ? when(keptRoom.last_played_at) : "never"}`);
|
|
1955
1960
|
console.log(`Storage: ${sizeText(answer.storage_size_bytes)} of the ${sizeText(answer.maximum_storage_size_bytes)} a game can keep (database and kept rooms).`);
|
|
1956
1961
|
return;
|
|
1957
1962
|
}
|
|
1958
|
-
const
|
|
1963
|
+
const roomPath = `/games/${values.slug}/kept-rooms/${encodeURIComponent(values.room_code)}`;
|
|
1964
|
+
const code = values.room_code.toUpperCase();
|
|
1965
|
+
if (command === "kept-rooms bring-back" || command === "kept-rooms erase-now") {
|
|
1966
|
+
const isBringingBack = command === "kept-rooms bring-back";
|
|
1967
|
+
const answer = await api("POST", `${roomPath}/${isBringingBack ? "bring-back" : "erase-now"}`);
|
|
1968
|
+
if (isJson) return printJson(answer);
|
|
1969
|
+
console.log(isBringingBack ? `Kept room ${code} of ${values.slug} is back, as it was.` : `Erased kept room ${code} of ${values.slug} for good.`);
|
|
1970
|
+
return;
|
|
1971
|
+
}
|
|
1972
|
+
const answer = await api("DELETE", roomPath);
|
|
1959
1973
|
if (isJson) return printJson(answer);
|
|
1960
|
-
console.log(`Deleted kept room ${values.
|
|
1974
|
+
console.log(answer.erases_at ? `Deleted kept room ${code} from ${values.slug}. Its world waits until ${when(answer.erases_at)}: zaisma kept-rooms bring-back ${values.slug} ${code} brings it back.` : `Deleted kept room ${code} from ${values.slug}, and its world with it.`);
|
|
1961
1975
|
}
|
|
1962
1976
|
|
|
1963
1977
|
/** A game server's logs (GET …/games/<slug>/logs), as the MCP's get_logs; --follow asks for new lines every 2 seconds. */
|
|
@@ -2153,17 +2167,25 @@ async function run({ command, values, flags, globalFlags, rest }) {
|
|
|
2153
2167
|
const { slug, version_id: versionId } = values;
|
|
2154
2168
|
const scheduledPublishAt = flags["scheduled-publish-at"] === undefined ? undefined : checkPublishTime(flags["scheduled-publish-at"]);
|
|
2155
2169
|
const matchUpdateMode = flags["match-update-mode"];
|
|
2156
|
-
const publishBody = { ...(scheduledPublishAt ? { scheduled_publish_at: scheduledPublishAt } : {}), ...(matchUpdateMode !== undefined ? { match_update_mode: matchUpdateMode } : {}), ...(flags["big-update"] === true ? { is_big_update: true } : {}), ...(flags["patch-notes"] !== undefined ? { patch_notes: flags["patch-notes"] } : {}) };
|
|
2170
|
+
const publishBody = { ...(scheduledPublishAt ? { scheduled_publish_at: scheduledPublishAt } : {}), ...(matchUpdateMode !== undefined ? { match_update_mode: matchUpdateMode } : {}), ...(flags["big-update"] === true ? { is_big_update: true } : {}), ...(flags["patch-notes"] !== undefined ? { patch_notes: flags["patch-notes"] } : {}), ...(flags["after-review"] === true ? { publish_after_ai_review_enabled: true } : {}) };
|
|
2157
2171
|
const answer = await api("POST", `/games/${slug}/versions/${versionId}/publish`, Object.keys(publishBody).length ? publishBody : undefined);
|
|
2158
2172
|
if (isJson) return printAnswer(answer);
|
|
2159
2173
|
const { game, version } = answer;
|
|
2160
2174
|
if (scheduledPublishAt) console.log(`Version ${versionId} will go live at ${when(version.scheduled_publish_at)}${version.scan_status === "scanning" ? ", if it has passed the scan by then" : ""}.`);
|
|
2161
|
-
else {
|
|
2162
|
-
console.log(`Version ${versionId}
|
|
2175
|
+
else if (!version.is_live) {
|
|
2176
|
+
console.log(`Version ${versionId} goes live once its AI review passes${version.usual_ai_review_duration_min === null ? "" : `, usually in about ${version.usual_ai_review_duration_min} minutes`}.`);
|
|
2177
|
+
} else {
|
|
2178
|
+
console.log(`Version ${versionId} is live at ${game.page_url}${matchUpdateMode === "now" ? "; running matches switch to it within seconds" : ""}${version.usual_ai_review_duration_min === null ? "" : `, with its AI review pending (usually about ${version.usual_ai_review_duration_min} minutes)`}`);
|
|
2163
2179
|
if (game.visibility === "draft") console.log(`The game is still a draft, so only you can see it. Show it to everyone with: zaisma visibility ${slug} listed`);
|
|
2164
2180
|
}
|
|
2165
2181
|
return EXIT_CODES.done;
|
|
2166
2182
|
}
|
|
2183
|
+
if (command === "ai-review") {
|
|
2184
|
+
const answer = await api("POST", `/games/${values.slug}/versions/${values.version_id}/ai-review`);
|
|
2185
|
+
if (isJson) return printAnswer(answer);
|
|
2186
|
+
console.log(answer.version.usual_ai_review_duration_min === null ? `Version ${values.version_id}'s AI review has ended: ${answer.version.ai_review_status}.` : `Version ${values.version_id}'s AI review is on its way. It usually takes about ${answer.version.usual_ai_review_duration_min} minutes.`);
|
|
2187
|
+
return EXIT_CODES.done;
|
|
2188
|
+
}
|
|
2167
2189
|
if (command === "unschedule") {
|
|
2168
2190
|
const answer = await api("DELETE", `/games/${values.slug}/versions/${values.version_id}/publish`);
|
|
2169
2191
|
if (isJson) return printAnswer(answer);
|