@botiverse/hands-cli 0.5.32 → 0.5.34
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/dist/commands/app_store.d.ts +22 -0
- package/dist/commands/app_store.js +350 -0
- package/dist/commands/app_store.js.map +1 -0
- package/dist/commands/builds.js +83 -0
- package/dist/commands/builds.js.map +1 -1
- package/dist/commands/releases.js +48 -1
- package/dist/commands/releases.js.map +1 -1
- package/dist/commands/store_listing.d.ts +95 -0
- package/dist/commands/store_listing.js +400 -0
- package/dist/commands/store_listing.js.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
/** Must match the server's per-push bound. */
|
|
3
|
+
export declare const MAX_SCREENSHOT_PUSH_BYTES: number;
|
|
4
|
+
export interface ScreenshotSetPlan {
|
|
5
|
+
locale: string;
|
|
6
|
+
display_type: string;
|
|
7
|
+
files: string[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Read `<dir>/<locale>/<display_type>/NN-name.png`. Locale and display type are
|
|
11
|
+
* passed through as written (en-US, APP_IPHONE_67); the server validates both.
|
|
12
|
+
* Files are ordered by name, numeric-aware, which is the App Store display order.
|
|
13
|
+
*/
|
|
14
|
+
export declare function collectScreenshotSets(dir: string, locales?: string[]): Promise<ScreenshotSetPlan[]>;
|
|
15
|
+
export declare function formatScreenshotResult(body: any): string;
|
|
16
|
+
export declare function formatLocalizationResult(body: any): string;
|
|
17
|
+
/**
|
|
18
|
+
* localizations file: { "<locale>": { description, keywords, promotionalText,
|
|
19
|
+
* marketingUrl, supportUrl, whatsNew } }. Passed through; the server validates.
|
|
20
|
+
*/
|
|
21
|
+
export declare function parseLocalizationsFile(raw: unknown): Record<string, Record<string, string>>;
|
|
22
|
+
export declare function registerAppStoreCommands(program: Command): void;
|
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { readdir, readFile, stat } from "node:fs/promises";
|
|
3
|
+
import { extname, join } from "node:path";
|
|
4
|
+
import { agentAwareFetch, apiRequest, getApiBase, QuiverApiError } from "../lib/api.js";
|
|
5
|
+
import { jsonRequested } from "../lib/json_output.js";
|
|
6
|
+
const IMAGE_EXTENSIONS = new Set([".png", ".jpg", ".jpeg"]);
|
|
7
|
+
/** Must match the server's per-push bound. */
|
|
8
|
+
export const MAX_SCREENSHOT_PUSH_BYTES = 24 * 1024 * 1024;
|
|
9
|
+
async function resolveAppId(input) {
|
|
10
|
+
if (/^[0-9a-f]{8}-[0-9a-f-]{27,}$/i.test(input))
|
|
11
|
+
return input;
|
|
12
|
+
const { apps } = await apiRequest("/api/apps");
|
|
13
|
+
const app = apps.find((item) => item.slug === input);
|
|
14
|
+
if (!app)
|
|
15
|
+
throw new Error(`App not found: ${input}`);
|
|
16
|
+
return app.id;
|
|
17
|
+
}
|
|
18
|
+
async function status(appId, versionString, platform) {
|
|
19
|
+
return apiRequest(`/api/apps/${appId}/app-store/status`, {
|
|
20
|
+
query: { version_string: versionString, ...(platform ? { platform } : {}) },
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/** --version-id wins; otherwise --version is resolved through the status endpoint. */
|
|
24
|
+
async function resolveVersionId(appId, opts) {
|
|
25
|
+
if (opts.versionId && opts.version)
|
|
26
|
+
throw new Error("pass --version or --version-id, not both");
|
|
27
|
+
if (opts.versionId)
|
|
28
|
+
return opts.versionId;
|
|
29
|
+
if (!opts.version)
|
|
30
|
+
throw new Error("pass --version <marketing version> or --version-id <ASC version id>");
|
|
31
|
+
return (await status(appId, opts.version, opts.platform)).version_id;
|
|
32
|
+
}
|
|
33
|
+
async function subdirs(dir) {
|
|
34
|
+
const entries = await readdir(dir, { withFileTypes: true });
|
|
35
|
+
return entries.filter((e) => e.isDirectory() && !e.name.startsWith(".")).map((e) => e.name).sort();
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Read `<dir>/<locale>/<display_type>/NN-name.png`. Locale and display type are
|
|
39
|
+
* passed through as written (en-US, APP_IPHONE_67); the server validates both.
|
|
40
|
+
* Files are ordered by name, numeric-aware, which is the App Store display order.
|
|
41
|
+
*/
|
|
42
|
+
export async function collectScreenshotSets(dir, locales) {
|
|
43
|
+
const sets = [];
|
|
44
|
+
for (const locale of await subdirs(dir)) {
|
|
45
|
+
if (locales && !locales.includes(locale))
|
|
46
|
+
continue;
|
|
47
|
+
for (const displayType of await subdirs(join(dir, locale))) {
|
|
48
|
+
const folder = join(dir, locale, displayType);
|
|
49
|
+
const entries = await readdir(folder, { withFileTypes: true });
|
|
50
|
+
const names = entries.filter((e) => e.isFile() && !e.name.startsWith(".")).map((e) => e.name);
|
|
51
|
+
for (const name of names) {
|
|
52
|
+
if (!IMAGE_EXTENSIONS.has(extname(name).toLowerCase()))
|
|
53
|
+
throw new Error(`${join(folder, name)}: only .png, .jpg and .jpeg are uploaded`);
|
|
54
|
+
}
|
|
55
|
+
const files = names.sort((a, b) => a.localeCompare(b, "en", { numeric: true })).map((name) => join(folder, name));
|
|
56
|
+
if (files.length > 0)
|
|
57
|
+
sets.push({ locale, display_type: displayType, files });
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (locales) {
|
|
61
|
+
const missing = locales.filter((l) => !sets.some((s) => s.locale === l));
|
|
62
|
+
if (missing.length)
|
|
63
|
+
throw new Error(`--locales names locales with no screenshots in ${dir}: ${missing.join(", ")}`);
|
|
64
|
+
}
|
|
65
|
+
return sets;
|
|
66
|
+
}
|
|
67
|
+
async function buildScreenshotRequest(sets, mode) {
|
|
68
|
+
const parts = [];
|
|
69
|
+
let total = 0;
|
|
70
|
+
const declared = [];
|
|
71
|
+
for (const set of sets) {
|
|
72
|
+
const images = [];
|
|
73
|
+
for (const path of set.files) {
|
|
74
|
+
const bytes = await readFile(path);
|
|
75
|
+
const name = `img${parts.length + 1}`;
|
|
76
|
+
parts.push({ name, path, bytes });
|
|
77
|
+
total += bytes.byteLength;
|
|
78
|
+
images.push({ part: name, sha256: createHash("sha256").update(bytes).digest("hex") });
|
|
79
|
+
}
|
|
80
|
+
declared.push({ locale: set.locale, display_type: set.display_type, images });
|
|
81
|
+
}
|
|
82
|
+
if (total > MAX_SCREENSHOT_PUSH_BYTES) {
|
|
83
|
+
throw new Error(`screenshots total ${total} bytes; Hands accepts ${MAX_SCREENSHOT_PUSH_BYTES} per push. Push fewer locales at a time with --locales.`);
|
|
84
|
+
}
|
|
85
|
+
return { request: { mode, sets: declared }, parts };
|
|
86
|
+
}
|
|
87
|
+
async function postMultipart(path, request, parts) {
|
|
88
|
+
const url = new URL(path, getApiBase());
|
|
89
|
+
const res = await agentAwareFetch((bearer) => {
|
|
90
|
+
const form = new FormData();
|
|
91
|
+
form.append("request", JSON.stringify(request));
|
|
92
|
+
for (const part of parts) {
|
|
93
|
+
const type = extname(part.path).toLowerCase() === ".png" ? "image/png" : "image/jpeg";
|
|
94
|
+
form.append(part.name, new Blob([new Uint8Array(part.bytes)], { type }), part.path.split(/[\\/]/).pop());
|
|
95
|
+
}
|
|
96
|
+
const headers = { accept: "application/json" };
|
|
97
|
+
if (bearer)
|
|
98
|
+
headers.authorization = `Bearer ${bearer}`;
|
|
99
|
+
return fetch(url.toString(), { method: "POST", headers, body: form });
|
|
100
|
+
});
|
|
101
|
+
const text = await res.text();
|
|
102
|
+
let data = text;
|
|
103
|
+
try {
|
|
104
|
+
data = JSON.parse(text);
|
|
105
|
+
}
|
|
106
|
+
catch { /* keep text */ }
|
|
107
|
+
if (!res.ok) {
|
|
108
|
+
const message = data && typeof data === "object" && "error" in data ? String(data.error) : `${res.status} ${res.statusText}`;
|
|
109
|
+
throw new QuiverApiError(res.status, data, message);
|
|
110
|
+
}
|
|
111
|
+
return data;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* A refused or failed push still carries the plan / per-item detail. Print it (or
|
|
115
|
+
* the whole body under --json) before the top-level handler prints the error.
|
|
116
|
+
*/
|
|
117
|
+
async function withDetail(json, format, run) {
|
|
118
|
+
try {
|
|
119
|
+
return await run();
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
if (error instanceof QuiverApiError && error.body && typeof error.body === "object") {
|
|
123
|
+
const body = error.body;
|
|
124
|
+
if (json)
|
|
125
|
+
console.log(JSON.stringify(body, null, 2));
|
|
126
|
+
else if (body.sets || body.localizations || body.results || body.versions)
|
|
127
|
+
console.error(format(body));
|
|
128
|
+
}
|
|
129
|
+
throw error;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
export function formatScreenshotResult(body) {
|
|
133
|
+
const lines = [];
|
|
134
|
+
const v = body.version;
|
|
135
|
+
if (v)
|
|
136
|
+
lines.push(`Version ${v.version_string} (${v.id}, ${v.state})`);
|
|
137
|
+
for (const set of body.sets ?? []) {
|
|
138
|
+
const head = ` ${set.locale} ${set.display_type}: ${set.blocker ? `BLOCKED (${set.blocker})` : set.action}${set.status ? ` -> ${set.status}` : ""}`;
|
|
139
|
+
lines.push(head);
|
|
140
|
+
if (set.existing && set.desired && !set.status)
|
|
141
|
+
lines.push(` ${set.existing.length} on Apple -> ${set.desired.length} requested`);
|
|
142
|
+
for (const image of set.images ?? []) {
|
|
143
|
+
lines.push(` #${image.index + 1} ${image.screenshot_id ?? "-"} ${image.state}${image.error ? ` (${image.error})` : ""}${image.errors?.length ? ` ${image.errors.map((e) => e.code).join(",")}` : ""}`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
if (body.outcome === "planned")
|
|
147
|
+
lines.push("Dry run: nothing was written. Run again with --commit to apply.");
|
|
148
|
+
else if (body.outcome === "no_changes")
|
|
149
|
+
lines.push("No changes: Apple already has these screenshots in this order.");
|
|
150
|
+
else if (body.outcome === "committed")
|
|
151
|
+
lines.push("Committed and read back from Apple.");
|
|
152
|
+
return lines.join("\n");
|
|
153
|
+
}
|
|
154
|
+
function preview(value) {
|
|
155
|
+
if (value === undefined)
|
|
156
|
+
return "(not sent)";
|
|
157
|
+
if (value === null)
|
|
158
|
+
return "(unset)";
|
|
159
|
+
const flat = value.replace(/\s+/g, " ");
|
|
160
|
+
const chars = [...flat];
|
|
161
|
+
return JSON.stringify(chars.length > 60 ? `${chars.slice(0, 60).join("")}…` : flat) + ` [${[...value].length}]`;
|
|
162
|
+
}
|
|
163
|
+
export function formatLocalizationResult(body) {
|
|
164
|
+
const lines = [];
|
|
165
|
+
const v = body.version;
|
|
166
|
+
if (v)
|
|
167
|
+
lines.push(`Version ${v.version_string} (${v.id}, ${v.state})`);
|
|
168
|
+
for (const plan of body.localizations ?? []) {
|
|
169
|
+
lines.push(` ${plan.blocker ? `BLOCKED (${plan.blocker})` : plan.action.padEnd(9)} ${plan.locale}`);
|
|
170
|
+
for (const field of plan.changed_fields ?? []) {
|
|
171
|
+
lines.push(` ${field}: ${preview(plan.before?.[field])} -> ${preview(plan.after?.[field])}`);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
for (const result of body.results ?? []) {
|
|
175
|
+
if (!body.localizations)
|
|
176
|
+
lines.push(` ${result.status.padEnd(13)} ${result.locale}`);
|
|
177
|
+
}
|
|
178
|
+
for (const mismatch of body.mismatches ?? [])
|
|
179
|
+
lines.push(` read-back mismatch: ${mismatch.locale} ${mismatch.field}`);
|
|
180
|
+
if (body.outcome === "planned")
|
|
181
|
+
lines.push("Dry run: nothing was written. Run again with --commit to apply.");
|
|
182
|
+
else if (body.outcome === "committed")
|
|
183
|
+
lines.push("Committed and read back from Apple.");
|
|
184
|
+
else if (body.outcome === "no_changes")
|
|
185
|
+
lines.push("No changes.");
|
|
186
|
+
return lines.join("\n");
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* localizations file: { "<locale>": { description, keywords, promotionalText,
|
|
190
|
+
* marketingUrl, supportUrl, whatsNew } }. Passed through; the server validates.
|
|
191
|
+
*/
|
|
192
|
+
export function parseLocalizationsFile(raw) {
|
|
193
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw))
|
|
194
|
+
throw new Error("localizations file must be a JSON object keyed by locale");
|
|
195
|
+
for (const [locale, value] of Object.entries(raw)) {
|
|
196
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
197
|
+
throw new Error(`${locale}: expected an object of fields`);
|
|
198
|
+
}
|
|
199
|
+
return raw;
|
|
200
|
+
}
|
|
201
|
+
export function registerAppStoreCommands(program) {
|
|
202
|
+
const group = program.command("app-store").description("App Store release through Hands: prepare, listing text, screenshots, submit, withdraw, status. Writes need --commit.");
|
|
203
|
+
group
|
|
204
|
+
.command("status <appIdOrSlug>")
|
|
205
|
+
.description("Review state of one version: state, build attached, pending submission. Read-only.")
|
|
206
|
+
.requiredOption("--version <version>", "Marketing version, e.g. 1.17.0.")
|
|
207
|
+
.option("--platform <platform>", "IOS (default) or MAC_OS.")
|
|
208
|
+
.option("--json", "Output JSON.", false)
|
|
209
|
+
.action(async (appIdOrSlug, opts) => {
|
|
210
|
+
const result = await status(await resolveAppId(appIdOrSlug), opts.version, opts.platform);
|
|
211
|
+
if (jsonRequested(program, opts.json)) {
|
|
212
|
+
console.log(JSON.stringify(result, null, 2));
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
console.log(`${result.version_string} ${result.version_id}: ${result.state}; build ${result.build_attached ? "attached" : "not attached"}; pending submission: ${result.pending_submission ? `${result.pending_submission.id} (${result.pending_submission.state})` : "none"}`);
|
|
216
|
+
});
|
|
217
|
+
group
|
|
218
|
+
.command("prepare <appIdOrSlug>")
|
|
219
|
+
.description("Create, reuse, or rename the App Store version and attach a build. Dry run by default; --commit writes.")
|
|
220
|
+
.requiredOption("--version <version>", "Marketing version, e.g. 1.17.0.")
|
|
221
|
+
.option("--build <ascBuildId>", "App Store Connect build id to attach.")
|
|
222
|
+
.option("--platform <platform>", "IOS (default) or MAC_OS.")
|
|
223
|
+
.option("--release-type <type>", "MANUAL (default) | AFTER_APPROVAL | SCHEDULED (only when a version is created).")
|
|
224
|
+
.option("--commit", "Apply the plan.", false)
|
|
225
|
+
.option("--json", "Output JSON.", false)
|
|
226
|
+
.action(async (appIdOrSlug, opts) => {
|
|
227
|
+
const appId = await resolveAppId(appIdOrSlug);
|
|
228
|
+
const json = jsonRequested(program, opts.json);
|
|
229
|
+
const result = await withDetail(json, (b) => JSON.stringify(b.versions ?? b, null, 2), () => apiRequest(`/api/apps/${appId}/app-store/versions`, {
|
|
230
|
+
method: "POST",
|
|
231
|
+
body: {
|
|
232
|
+
version_string: opts.version,
|
|
233
|
+
mode: opts.commit ? "commit" : "dry_run",
|
|
234
|
+
...(opts.build ? { asc_build_id: opts.build } : {}),
|
|
235
|
+
...(opts.platform ? { platform: opts.platform } : {}),
|
|
236
|
+
...(opts.releaseType ? { release_type: opts.releaseType } : {}),
|
|
237
|
+
},
|
|
238
|
+
}));
|
|
239
|
+
if (json) {
|
|
240
|
+
console.log(JSON.stringify(result, null, 2));
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
const what = result.action === "renamed"
|
|
244
|
+
? `rename ${result.previous_version_string} (${result.version_id}, ${result.state}) to ${result.version_string}`
|
|
245
|
+
: result.action === "reused" ? `reuse ${result.version_string} (${result.version_id}, ${result.state})` : `create ${result.version_string}`;
|
|
246
|
+
if (result.mode === "dry_run") {
|
|
247
|
+
console.log(`Dry run: would ${what}${opts.build ? ` and attach build ${opts.build}` : ""}. Nothing was written. Run again with --commit to apply.`);
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
console.log(`Done: ${result.action} ${result.version_string} (${result.version_id}, ${result.state}); build ${result.build_attached === null ? "unknown" : result.build_attached ? result.build_id : "not attached"}. Read back from Apple.`);
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
const screenshots = group.command("screenshots").description("App Store screenshot sets.");
|
|
254
|
+
screenshots
|
|
255
|
+
.command("push <appIdOrSlug>")
|
|
256
|
+
.description("Replace screenshot sets from <dir>/<locale>/<display_type>/NN.png. Identical sets are skipped. Dry run by default; --commit writes (deletes and re-uploads changed sets).")
|
|
257
|
+
.requiredOption("--dir <dir>", "Screenshots directory, e.g. shots/en-US/APP_IPHONE_67/01.png.")
|
|
258
|
+
.option("--version <version>", "Marketing version (resolved to its ASC id).")
|
|
259
|
+
.option("--version-id <id>", "ASC appStoreVersions id.")
|
|
260
|
+
.option("--platform <platform>", "Platform for --version lookup.")
|
|
261
|
+
.option("--locales <list>", "Only these locales, comma-separated.")
|
|
262
|
+
.option("--commit", "Apply the plan.", false)
|
|
263
|
+
.option("--json", "Output JSON.", false)
|
|
264
|
+
.action(async (appIdOrSlug, opts) => {
|
|
265
|
+
if (!(await stat(opts.dir).catch(() => null))?.isDirectory())
|
|
266
|
+
throw new Error(`${opts.dir} is not a directory`);
|
|
267
|
+
const locales = opts.locales?.split(",").map((l) => l.trim()).filter(Boolean);
|
|
268
|
+
const sets = await collectScreenshotSets(opts.dir, locales);
|
|
269
|
+
if (sets.length === 0)
|
|
270
|
+
throw new Error(`${opts.dir} has no <locale>/<display_type>/ image folders`);
|
|
271
|
+
const appId = await resolveAppId(appIdOrSlug);
|
|
272
|
+
const versionId = await resolveVersionId(appId, opts);
|
|
273
|
+
const { request, parts } = await buildScreenshotRequest(sets, opts.commit ? "commit" : "dry_run");
|
|
274
|
+
const json = jsonRequested(program, opts.json);
|
|
275
|
+
const result = await withDetail(json, formatScreenshotResult, () => postMultipart(`/api/apps/${appId}/app-store/versions/${encodeURIComponent(versionId)}/screenshots`, request, parts));
|
|
276
|
+
console.log(json ? JSON.stringify(result, null, 2) : formatScreenshotResult(result));
|
|
277
|
+
});
|
|
278
|
+
const localizations = group.command("localizations").description("App Store listing text (appStoreVersionLocalizations).");
|
|
279
|
+
localizations
|
|
280
|
+
.command("push <appIdOrSlug>")
|
|
281
|
+
.description("Write listing text from a JSON file keyed by locale. Dry run by default; --commit writes.")
|
|
282
|
+
.requiredOption("--file <json>", '{"en-US":{"description":"...","keywords":"...","promotionalText":"...","whatsNew":"...","supportUrl":"...","marketingUrl":"..."}}')
|
|
283
|
+
.option("--version <version>", "Marketing version (resolved to its ASC id).")
|
|
284
|
+
.option("--version-id <id>", "ASC appStoreVersions id.")
|
|
285
|
+
.option("--platform <platform>", "Platform for --version lookup.")
|
|
286
|
+
.option("--commit", "Apply the plan.", false)
|
|
287
|
+
.option("--json", "Output JSON.", false)
|
|
288
|
+
.action(async (appIdOrSlug, opts) => {
|
|
289
|
+
let raw;
|
|
290
|
+
try {
|
|
291
|
+
raw = JSON.parse(await readFile(opts.file, "utf8"));
|
|
292
|
+
}
|
|
293
|
+
catch (error) {
|
|
294
|
+
throw new Error(`cannot read ${opts.file}: ${error.message}`);
|
|
295
|
+
}
|
|
296
|
+
const body = { mode: opts.commit ? "commit" : "dry_run", localizations: parseLocalizationsFile(raw) };
|
|
297
|
+
const appId = await resolveAppId(appIdOrSlug);
|
|
298
|
+
const versionId = await resolveVersionId(appId, opts);
|
|
299
|
+
const json = jsonRequested(program, opts.json);
|
|
300
|
+
const result = await withDetail(json, formatLocalizationResult, () => apiRequest(`/api/apps/${appId}/app-store/versions/${encodeURIComponent(versionId)}/localizations`, { method: "POST", body }));
|
|
301
|
+
console.log(json ? JSON.stringify(result, null, 2) : formatLocalizationResult(result));
|
|
302
|
+
});
|
|
303
|
+
group
|
|
304
|
+
.command("submit <appIdOrSlug>")
|
|
305
|
+
.description("Submit a prepared version for App Store review. Without --commit, only shows what would be submitted.")
|
|
306
|
+
.requiredOption("--version <version>", "Marketing version to submit.")
|
|
307
|
+
.option("--platform <platform>", "IOS (default) or MAC_OS.")
|
|
308
|
+
.option("--commit", "Really submit for review.", false)
|
|
309
|
+
.option("--json", "Output JSON.", false)
|
|
310
|
+
.action(async (appIdOrSlug, opts) => {
|
|
311
|
+
const appId = await resolveAppId(appIdOrSlug);
|
|
312
|
+
const current = await status(appId, opts.version, opts.platform);
|
|
313
|
+
const json = jsonRequested(program, opts.json);
|
|
314
|
+
if (!opts.commit) {
|
|
315
|
+
if (json) {
|
|
316
|
+
console.log(JSON.stringify({ mode: "dry_run", would_submit: current }, null, 2));
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
console.log(`Dry run: would submit ${current.version_string} (${current.version_id}, ${current.state}; build ${current.build_attached ? "attached" : "NOT attached"}). Pending submission: ${current.pending_submission ? `${current.pending_submission.id} (${current.pending_submission.state})` : "none"}.`);
|
|
320
|
+
console.log("Run again with --commit to submit for review.");
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
const result = await apiRequest(`/api/apps/${appId}/app-store/versions/${encodeURIComponent(current.version_id)}/submit`, { method: "POST" });
|
|
324
|
+
console.log(json ? JSON.stringify(result, null, 2) : `Submitted ${current.version_string} (${current.version_id}); review submission ${result.submission_id}.`);
|
|
325
|
+
});
|
|
326
|
+
group
|
|
327
|
+
.command("withdraw <appIdOrSlug>")
|
|
328
|
+
.description("Withdraw the pending review of a version (cancels its review submission). Without --commit, only shows what would be withdrawn.")
|
|
329
|
+
.requiredOption("--version <version>", "Marketing version whose review to withdraw.")
|
|
330
|
+
.option("--platform <platform>", "IOS (default) or MAC_OS.")
|
|
331
|
+
.option("--commit", "Really withdraw.", false)
|
|
332
|
+
.option("--json", "Output JSON.", false)
|
|
333
|
+
.action(async (appIdOrSlug, opts) => {
|
|
334
|
+
const appId = await resolveAppId(appIdOrSlug);
|
|
335
|
+
const current = await status(appId, opts.version, opts.platform);
|
|
336
|
+
const json = jsonRequested(program, opts.json);
|
|
337
|
+
if (!opts.commit) {
|
|
338
|
+
if (json) {
|
|
339
|
+
console.log(JSON.stringify({ mode: "dry_run", would_withdraw: current }, null, 2));
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
console.log(`Dry run: would withdraw the pending review of ${current.version_string} (${current.version_id}, ${current.state}).`);
|
|
343
|
+
console.log("Run again with --commit to withdraw.");
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
const result = await apiRequest(`/api/apps/${appId}/app-store/withdraw`, { method: "POST", body: { version_id: current.version_id } });
|
|
347
|
+
console.log(json ? JSON.stringify(result, null, 2) : `Withdrew review submission ${result.submission_id} for ${current.version_string}.`);
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
//# sourceMappingURL=app_store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app_store.js","sourceRoot":"","sources":["../../src/commands/app_store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACxF,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAWtD,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAC5D,8CAA8C;AAC9C,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAE1D,KAAK,UAAU,YAAY,CAAC,KAAa;IACvC,IAAI,+BAA+B,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAC9D,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,UAAU,CAAqB,WAAW,CAAC,CAAC;IACnE,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC;IACrD,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,KAAK,EAAE,CAAC,CAAC;IACrD,OAAO,GAAG,CAAC,EAAE,CAAC;AAChB,CAAC;AAUD,KA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ACD,MAAM,MAAM,GAAG,MAAM,UAAU,CAAM,aAAa,KAAK,qBAAqB,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;QAC5I,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,8BAA8B,MAAM,CAAC,aAAa,QAAQ,OAAO,CAAC,cAAc,GAAG,CAAC,CAAC;IAC5I,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/dist/commands/builds.js
CHANGED
|
@@ -466,6 +466,89 @@ export function registerBuildCommands(program) {
|
|
|
466
466
|
}
|
|
467
467
|
console.log(`Deleted asset ${assetId} from build ${buildId}.`);
|
|
468
468
|
});
|
|
469
|
+
/**
|
|
470
|
+
* GET /builds/:buildId returns the build object directly. Some Hands surfaces
|
|
471
|
+
* wrap it as { build: {...} }, so accept both: an assumed wrapper silently
|
|
472
|
+
* yields a report of nulls, which reads as a successful empty result rather
|
|
473
|
+
* than an error -- the failure mode this helper exists to prevent.
|
|
474
|
+
*/
|
|
475
|
+
async function readBuild(appId, buildId) {
|
|
476
|
+
const detail = await apiRequest(`/api/apps/${appId}/builds/${buildId}`);
|
|
477
|
+
const unwrapped = detail.build;
|
|
478
|
+
if (unwrapped && typeof unwrapped === "object") {
|
|
479
|
+
return unwrapped;
|
|
480
|
+
}
|
|
481
|
+
return detail;
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* What is about to be deleted, recorded before the delete rather than after:
|
|
485
|
+
* once the row is gone the success message is the only trace, and "it had no
|
|
486
|
+
* releases and no assets" says nothing about which build disappeared.
|
|
487
|
+
*/
|
|
488
|
+
function describeBuild(buildId, build) {
|
|
489
|
+
const assets = Array.isArray(build.assets) ? build.assets : [];
|
|
490
|
+
return {
|
|
491
|
+
build_id: buildId,
|
|
492
|
+
status: build.status ?? null,
|
|
493
|
+
version_name: build.version_name ?? null,
|
|
494
|
+
version_code: build.version_code ?? null,
|
|
495
|
+
asset_count: Number(build.asset_count ?? assets.length),
|
|
496
|
+
asset_sha256: assets
|
|
497
|
+
.map((asset) => asset.sha256)
|
|
498
|
+
.filter((value) => typeof value === "string"),
|
|
499
|
+
checked: "server enforces: no releases referencing this build, no assets attached",
|
|
500
|
+
};
|
|
501
|
+
}
|
|
502
|
+
function formatBuildRecord(build) {
|
|
503
|
+
const lines = [
|
|
504
|
+
`Build ${build.build_id}:`,
|
|
505
|
+
` status=${String(build.status)}`,
|
|
506
|
+
` version=${String(build.version_name)} (${String(build.version_code)})`,
|
|
507
|
+
];
|
|
508
|
+
if (typeof build.asset_count === "number") {
|
|
509
|
+
lines.push(` assets=${build.asset_count}`);
|
|
510
|
+
}
|
|
511
|
+
for (const sha of build.asset_sha256 ?? [])
|
|
512
|
+
lines.push(` asset sha256=${sha}`);
|
|
513
|
+
return lines.join("\n");
|
|
514
|
+
}
|
|
515
|
+
builds
|
|
516
|
+
.command("delete <appIdOrSlug> <buildId>")
|
|
517
|
+
.description("Delete a build that has never been released and has no assets. " +
|
|
518
|
+
"Requires app admin. Hands refuses (409) while any release references the build " +
|
|
519
|
+
"or any asset is attached, so this can only remove a build that never shipped -- " +
|
|
520
|
+
"a test leftover, not a release record.")
|
|
521
|
+
.option("--json", "Output JSON.", false)
|
|
522
|
+
.option("--dry-run", "Check whether the build can be deleted without deleting it.", false)
|
|
523
|
+
.action(async (appIdOrSlug, buildId, opts) => {
|
|
524
|
+
const id = await resolveAppId(appIdOrSlug);
|
|
525
|
+
const asJson = shouldOutputJson(program, jsonRequested(program, opts.json));
|
|
526
|
+
if (opts.dryRun) {
|
|
527
|
+
// Read the build so the refusal reasons can be reported before anyone
|
|
528
|
+
// commits to the delete: a 409 later is far less useful than knowing
|
|
529
|
+
// up front which condition blocks it.
|
|
530
|
+
const build = await readBuild(id, buildId);
|
|
531
|
+
const report = describeBuild(buildId, build);
|
|
532
|
+
if (asJson) {
|
|
533
|
+
console.log(JSON.stringify(report, null, 2));
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
536
|
+
console.log(formatBuildRecord(report));
|
|
537
|
+
console.log("A delete would be refused if any release references it or any asset is attached.");
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
// Record what is being removed BEFORE removing it: afterwards this
|
|
541
|
+
// message is the only evidence of which build disappeared.
|
|
542
|
+
const before = describeBuild(buildId, await readBuild(id, buildId));
|
|
543
|
+
const result = await apiRequest(`/api/apps/${id}/builds/${buildId}`, { method: "DELETE" });
|
|
544
|
+
if (asJson) {
|
|
545
|
+
console.log(JSON.stringify({ deleted: before, result }, null, 2));
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
548
|
+
console.log(`Deleting build of ${appIdOrSlug}:`);
|
|
549
|
+
console.log(formatBuildRecord(before));
|
|
550
|
+
console.log(`Deleted build ${buildId}. It had no releases and no assets, so no release record referenced it.`);
|
|
551
|
+
});
|
|
469
552
|
builds
|
|
470
553
|
.command("publish-version <appIdOrSlug>")
|
|
471
554
|
.description("Register an immutable externally hosted Node/CLI build target.")
|