@zaisma/cli 0.37.0 → 0.38.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/zaisma.mjs +15 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zaisma/cli",
3
- "version": "0.37.0",
3
+ "version": "0.38.0",
4
4
  "description": "Upload and publish browser games on Zaisma from the command line.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://zaisma.com",
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": {
@@ -1187,7 +1190,7 @@ async function sendVersion(slug, fixedFiles, flags) {
1187
1190
  );
1188
1191
  if (todo.length && !isJson) process.stdout.write("\n");
1189
1192
 
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 } : {}) });
1193
+ 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
1194
  const versionId = answer.version.id;
1192
1195
  say(`Version ${versionId} is being scanned. This usually takes under a minute…`);
1193
1196
 
@@ -2153,17 +2156,25 @@ async function run({ command, values, flags, globalFlags, rest }) {
2153
2156
  const { slug, version_id: versionId } = values;
2154
2157
  const scheduledPublishAt = flags["scheduled-publish-at"] === undefined ? undefined : checkPublishTime(flags["scheduled-publish-at"]);
2155
2158
  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"] } : {}) };
2159
+ 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
2160
  const answer = await api("POST", `/games/${slug}/versions/${versionId}/publish`, Object.keys(publishBody).length ? publishBody : undefined);
2158
2161
  if (isJson) return printAnswer(answer);
2159
2162
  const { game, version } = answer;
2160
2163
  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} is live at ${game.page_url}${matchUpdateMode === "now" ? "; running matches switch to it within seconds" : ""}`);
2164
+ else if (!version.is_live) {
2165
+ 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`}.`);
2166
+ } else {
2167
+ 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
2168
  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
2169
  }
2165
2170
  return EXIT_CODES.done;
2166
2171
  }
2172
+ if (command === "ai-review") {
2173
+ const answer = await api("POST", `/games/${values.slug}/versions/${values.version_id}/ai-review`);
2174
+ if (isJson) return printAnswer(answer);
2175
+ 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.`);
2176
+ return EXIT_CODES.done;
2177
+ }
2167
2178
  if (command === "unschedule") {
2168
2179
  const answer = await api("DELETE", `/games/${values.slug}/versions/${values.version_id}/publish`);
2169
2180
  if (isJson) return printAnswer(answer);