@zaisma/cli 0.31.0 → 0.33.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 +17 -2
package/package.json
CHANGED
package/zaisma.mjs
CHANGED
|
@@ -65,6 +65,7 @@ const TEXTURE_CHECK_COUNT = 20;
|
|
|
65
65
|
/** The choices the API takes, checked before anything is sent (test/node/cli.test.ts holds them to the API's lists). */
|
|
66
66
|
const VISIBILITIES = ["listed", "unlisted", "private", "draft"];
|
|
67
67
|
const SCREENS = ["wide", "phone"];
|
|
68
|
+
const MATCH_UPDATE_MODES = ["next_match", "now"];
|
|
68
69
|
const TOPIC_KINDS = ["bug", "gap", "feature", "question", "talk"];
|
|
69
70
|
const MESSAGE_KINDS = ["bug", "gap", "feature", "question"];
|
|
70
71
|
const FORUM_CATEGORIES = ["publishing", "scans", "pages", "rooms", "servers", "passes", "sdk", "saves", "stats", "mcp", "api", "cli", "accounts", "dashboard", "reports", "rules", "docs", "other"];
|
|
@@ -153,7 +154,7 @@ const COMMANDS = {
|
|
|
153
154
|
game: { hasValue: true, isRequired: true, placeholder: "<slug>", about: "The game to upload to" },
|
|
154
155
|
"patch-notes": { hasValue: true, placeholder: '"…"', about: "What changed, shown with the update" },
|
|
155
156
|
"publish-when-approved": { hasValue: false, about: "Go live as soon as it passes review" },
|
|
156
|
-
"match-update-mode": { hasValue: true,
|
|
157
|
+
"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)" },
|
|
157
158
|
},
|
|
158
159
|
},
|
|
159
160
|
shader: {
|
|
@@ -172,7 +173,7 @@ const COMMANDS = {
|
|
|
172
173
|
arguments: [{ name: "slug" }, { name: "version_id" }],
|
|
173
174
|
flags: {
|
|
174
175
|
"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"' },
|
|
175
|
-
"match-update-mode": { hasValue: true,
|
|
176
|
+
"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)" },
|
|
176
177
|
},
|
|
177
178
|
},
|
|
178
179
|
unschedule: { about: "Cancel a publish-later", arguments: [{ name: "slug" }, { name: "version_id" }], flags: {} },
|
|
@@ -206,6 +207,7 @@ const COMMANDS = {
|
|
|
206
207
|
"items remove": { about: "Remove an item nobody bought or was granted", arguments: [{ name: "slug" }, { name: "item_name" }], flags: {} },
|
|
207
208
|
"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: {} },
|
|
208
209
|
"kept-rooms delete": { about: "Delete a kept room's world for good; players in it are sent out", arguments: [{ name: "slug" }, { name: "room_code" }], flags: {} },
|
|
210
|
+
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: {} },
|
|
209
211
|
logs: {
|
|
210
212
|
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",
|
|
211
213
|
arguments: [{ name: "slug" }],
|
|
@@ -1931,6 +1933,18 @@ async function items(command, values) {
|
|
|
1931
1933
|
console.log(`Refund policy: ${answer.refund_policy === "own_words" ? answer.refund_policy_text : (answer.refund_policy ?? "none yet (set_purchase_settings), needed before anything goes on sale")}`);
|
|
1932
1934
|
}
|
|
1933
1935
|
|
|
1936
|
+
/** A game's live rooms (GET …/games/<slug>/rooms), as the MCP's list_rooms. */
|
|
1937
|
+
async function liveRooms(values) {
|
|
1938
|
+
const answer = await api("GET", `/games/${values.slug}/rooms`);
|
|
1939
|
+
if (isJson) return printJson(answer);
|
|
1940
|
+
if (!answer.rooms.length) console.log(`No live rooms on Zaisma right now.`);
|
|
1941
|
+
for (const room of answer.rooms) {
|
|
1942
|
+
const labels = Object.entries(room.labels).map(([labelName, labelValue]) => `${labelName}: ${labelValue}`).join(", ");
|
|
1943
|
+
console.log(`${room.room_code} ${(room.name ?? "").padEnd(24)} ${`${room.player_count}/${room.maximum_player_count}`.padStart(7)} players${room.spectator_count ? `, ${room.spectator_count} watching` : ""}${room.is_kept ? ", kept" : ""}${labels ? ` ${labels}` : ""}`);
|
|
1944
|
+
}
|
|
1945
|
+
if (answer.next_cursor) console.log(`${answer.room_count} rooms in all; --json, or list_rooms with cursor, gives the rest.`);
|
|
1946
|
+
}
|
|
1947
|
+
|
|
1934
1948
|
/** A game's kept rooms (…/games/<slug>/kept-rooms…), as the MCP's list_kept_rooms and delete_kept_room. */
|
|
1935
1949
|
async function keptRooms(command, values) {
|
|
1936
1950
|
if (command === "kept-rooms") {
|
|
@@ -2167,6 +2181,7 @@ async function run({ command, values, flags, globalFlags, rest }) {
|
|
|
2167
2181
|
else if (command === "links" || command.startsWith("links ")) await links(command, values, flags);
|
|
2168
2182
|
else if (command === "secrets" || command.startsWith("secrets ")) await secrets(command, values);
|
|
2169
2183
|
else if (command === "items" || command.startsWith("items ")) await items(command, values);
|
|
2184
|
+
else if (command === "rooms") await liveRooms(values);
|
|
2170
2185
|
else if (command === "kept-rooms" || command.startsWith("kept-rooms ")) await keptRooms(command, values);
|
|
2171
2186
|
else if (command === "logs") await logs(values, flags);
|
|
2172
2187
|
else if (command === "database" || command.startsWith("database ")) await database(command, values, flags);
|