@botiverse/hands-cli 0.5.27 → 0.5.31
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/agc.d.ts +21 -0
- package/dist/commands/agc.js +143 -0
- package/dist/commands/agc.js.map +1 -0
- package/dist/commands/apps.js +43 -0
- package/dist/commands/apps.js.map +1 -1
- package/dist/commands/builds.js +129 -2
- package/dist/commands/builds.js.map +1 -1
- package/dist/commands/feedback.js +4 -3
- package/dist/commands/feedback.js.map +1 -1
- package/dist/commands/releases.js +32 -0
- package/dist/commands/releases.js.map +1 -1
- package/dist/commands/testflight.d.ts +31 -0
- package/dist/commands/testflight.js +136 -0
- package/dist/commands/testflight.js.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
export type AgcSubmission = {
|
|
3
|
+
id: string;
|
|
4
|
+
build_id: string;
|
|
5
|
+
state: string;
|
|
6
|
+
external_app_id: string | null;
|
|
7
|
+
external_version_id: string | null;
|
|
8
|
+
external_package_id: string | null;
|
|
9
|
+
error_message: string | null;
|
|
10
|
+
provider_state: Record<string, unknown>;
|
|
11
|
+
created_at: number;
|
|
12
|
+
updated_at: number;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* `hands agc …` — AppGallery Connect invitation testing for OHOS builds
|
|
16
|
+
* (Huawei App Testing, releaseType 6). Store listing / phased release is not
|
|
17
|
+
* automated. Every `status` read makes the server re-read Huawei while the
|
|
18
|
+
* review outcome is open.
|
|
19
|
+
*/
|
|
20
|
+
export declare function registerAgcCommands(program: Command): void;
|
|
21
|
+
export declare function formatSubmission(sub: AgcSubmission, syncError?: string): string;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { apiRequest } from "../lib/api.js";
|
|
2
|
+
/**
|
|
3
|
+
* `hands agc …` — AppGallery Connect invitation testing for OHOS builds
|
|
4
|
+
* (Huawei App Testing, releaseType 6). Store listing / phased release is not
|
|
5
|
+
* automated. Every `status` read makes the server re-read Huawei while the
|
|
6
|
+
* review outcome is open.
|
|
7
|
+
*/
|
|
8
|
+
export function registerAgcCommands(program) {
|
|
9
|
+
const agc = program.command("agc").description("AppGallery Connect packages and invitation testing for HarmonyOS builds.");
|
|
10
|
+
const wantsJson = (opts) => Boolean(opts.json || program.opts().json);
|
|
11
|
+
agc
|
|
12
|
+
.command("upload-market <appIdOrSlug> <buildId>")
|
|
13
|
+
.description("Upload a signed HarmonyOS .app to AppGallery formal package management; does not submit review.")
|
|
14
|
+
.requiredOption("--package-name <name>", "HarmonyOS bundle name.")
|
|
15
|
+
.option("--json", "Output JSON.", false)
|
|
16
|
+
.action(async (app, buildId, opts) => {
|
|
17
|
+
const appId = await resolveAppId(app);
|
|
18
|
+
const result = await apiRequest(`/api/apps/${appId}/builds/${encodeURIComponent(buildId)}/agc-market-package`, {
|
|
19
|
+
method: "POST", body: { package_name: opts.packageName },
|
|
20
|
+
});
|
|
21
|
+
console.log(JSON.stringify(result, null, 2));
|
|
22
|
+
if (!wantsJson(opts))
|
|
23
|
+
console.log(`Check parsing: hands agc market-status ${app} ${buildId}`);
|
|
24
|
+
});
|
|
25
|
+
agc
|
|
26
|
+
.command("market-status <appIdOrSlug> <buildId>")
|
|
27
|
+
.description("Refresh formal package parsing status (ready means selectable, not published).")
|
|
28
|
+
.option("--json", "Output JSON.", false)
|
|
29
|
+
.action(async (app, buildId) => {
|
|
30
|
+
const appId = await resolveAppId(app);
|
|
31
|
+
console.log(JSON.stringify(await apiRequest(`/api/apps/${appId}/builds/${encodeURIComponent(buildId)}/agc-market-package`), null, 2));
|
|
32
|
+
});
|
|
33
|
+
agc
|
|
34
|
+
.command("groups <appIdOrSlug>")
|
|
35
|
+
.description("List AGC test user groups (group id, name, tester count).")
|
|
36
|
+
.option("--json", "Output JSON.", false)
|
|
37
|
+
.action(async (appIdOrSlug, opts) => {
|
|
38
|
+
const appId = await resolveAppId(appIdOrSlug);
|
|
39
|
+
const res = await apiRequest(`/api/apps/${appId}/agc-test-groups`);
|
|
40
|
+
if (wantsJson(opts))
|
|
41
|
+
return void console.log(JSON.stringify(res, null, 2));
|
|
42
|
+
if (res.groups.length === 0)
|
|
43
|
+
return void console.log("No AGC test groups. Create one in AppGallery Connect → App Testing.");
|
|
44
|
+
for (const g of res.groups)
|
|
45
|
+
console.log([g.groupId, g.groupName ?? "-", `${g.addedTestersNum ?? "?"} testers`].join("\t"));
|
|
46
|
+
});
|
|
47
|
+
agc
|
|
48
|
+
.command("upload <appIdOrSlug> <buildId>")
|
|
49
|
+
.description("Upload the build's signed .app to AGC and create an invitation-test version (idempotent per build; repeats after failed/rejected/stopped start a new attempt).")
|
|
50
|
+
.requiredOption("--package-name <name>", "HarmonyOS bundle name, e.g. build.raft.mobile.")
|
|
51
|
+
.option("--test-desc <text>", "Test description shown to testers.")
|
|
52
|
+
.option("--wait", "Poll until Huawei finishes compiling (ready or failed).", false)
|
|
53
|
+
.option("--timeout <seconds>", "Max seconds for --wait.", "600")
|
|
54
|
+
.option("--json", "Output JSON.", false)
|
|
55
|
+
.action(async (appIdOrSlug, buildId, opts) => {
|
|
56
|
+
const appId = await resolveAppId(appIdOrSlug);
|
|
57
|
+
const started = await apiRequest(`/api/apps/${appId}/builds/${encodeURIComponent(buildId)}/agc-invitation-test`, { method: "POST", body: { package_name: opts.packageName, ...(opts.testDesc ? { test_desc: opts.testDesc } : {}) } });
|
|
58
|
+
const submissionId = started.submission_id ?? started.submission?.id;
|
|
59
|
+
if (!submissionId)
|
|
60
|
+
throw new Error("server did not return a submission id");
|
|
61
|
+
let result = await getStatus(appId, submissionId);
|
|
62
|
+
if (opts.wait)
|
|
63
|
+
result = await waitFor(appId, submissionId, (s) => s !== "uploading" && s !== "processing", Number(opts.timeout));
|
|
64
|
+
if (wantsJson(opts))
|
|
65
|
+
return void console.log(JSON.stringify(result, null, 2));
|
|
66
|
+
console.log(formatSubmission(result.submission, result.sync_error));
|
|
67
|
+
if (result.submission.state === "ready")
|
|
68
|
+
console.log(`Next: hands agc submit ${appIdOrSlug} ${submissionId} --group <groupId>`);
|
|
69
|
+
});
|
|
70
|
+
agc
|
|
71
|
+
.command("submit <appIdOrSlug> <submissionId>")
|
|
72
|
+
.description("Submit a ready test version to Huawei review for the given test group(s). Required when the app has more than one group.")
|
|
73
|
+
.option("--group <groupId...>", "AGC test group id(s); see `hands agc groups`.")
|
|
74
|
+
.option("--json", "Output JSON.", false)
|
|
75
|
+
.action(async (appIdOrSlug, submissionId, opts) => {
|
|
76
|
+
const appId = await resolveAppId(appIdOrSlug);
|
|
77
|
+
const res = await apiRequest(`/api/apps/${appId}/agc-submissions/${encodeURIComponent(submissionId)}/submit`, { method: "POST", body: opts.group?.length ? { group_ids: opts.group } : {} });
|
|
78
|
+
if (wantsJson(opts))
|
|
79
|
+
return void console.log(JSON.stringify(res, null, 2));
|
|
80
|
+
console.log(`✔ Submitted ${submissionId} to AppGallery invitation-test review (groups: ${(res.group_ids ?? []).join(", ") || "-"}).`);
|
|
81
|
+
console.log(`Check the outcome: hands agc status ${appIdOrSlug} ${submissionId}`);
|
|
82
|
+
});
|
|
83
|
+
agc
|
|
84
|
+
.command("status <appIdOrSlug> <submissionIdOrBuildId>")
|
|
85
|
+
.description("Show a submission (refreshed from Huawei). Accepts a submission id, or a full build id with --build.")
|
|
86
|
+
.option("--build", "Treat the id as a build id and show its latest submission.", false)
|
|
87
|
+
.option("--events", "Include the state history.", false)
|
|
88
|
+
.option("--json", "Output JSON.", false)
|
|
89
|
+
.action(async (appIdOrSlug, id, opts) => {
|
|
90
|
+
const appId = await resolveAppId(appIdOrSlug);
|
|
91
|
+
let submissionId = id;
|
|
92
|
+
if (opts.build) {
|
|
93
|
+
const latest = await apiRequest(`/api/apps/${appId}/builds/${encodeURIComponent(id)}/agc-invitation-test`);
|
|
94
|
+
if (!latest.submission)
|
|
95
|
+
throw new Error(`No AppGallery submission for build ${id}`);
|
|
96
|
+
submissionId = latest.submission.id;
|
|
97
|
+
}
|
|
98
|
+
const res = await getStatus(appId, submissionId);
|
|
99
|
+
if (wantsJson(opts))
|
|
100
|
+
return void console.log(JSON.stringify(res, null, 2));
|
|
101
|
+
console.log(formatSubmission(res.submission, res.sync_error));
|
|
102
|
+
if (opts.events)
|
|
103
|
+
for (const e of res.events)
|
|
104
|
+
console.log(` ${new Date(e.created_at).toISOString()}\t${e.state}`);
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
async function getStatus(appId, submissionId) {
|
|
108
|
+
return apiRequest(`/api/apps/${appId}/agc-submissions/${encodeURIComponent(submissionId)}`);
|
|
109
|
+
}
|
|
110
|
+
async function waitFor(appId, submissionId, done, timeoutSeconds, intervalMs = 5000) {
|
|
111
|
+
const deadline = Date.now() + Math.max(1, timeoutSeconds) * 1000;
|
|
112
|
+
for (;;) {
|
|
113
|
+
const res = await getStatus(appId, submissionId);
|
|
114
|
+
if (done(res.submission.state) || Date.now() >= deadline)
|
|
115
|
+
return res;
|
|
116
|
+
await new Promise((r) => setTimeout(r, intervalMs));
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
export function formatSubmission(sub, syncError) {
|
|
120
|
+
const ps = sub.provider_state ?? {};
|
|
121
|
+
const lines = [`${sub.id}\t${sub.state}\tbuild ${sub.build_id}`];
|
|
122
|
+
if (typeof ps.release_state === "number")
|
|
123
|
+
lines.push(` huawei releaseState: ${ps.release_state}`);
|
|
124
|
+
if (typeof ps.audit_opinion === "string" && ps.audit_opinion)
|
|
125
|
+
lines.push(` huawei opinion: ${ps.audit_opinion}`);
|
|
126
|
+
if (Array.isArray(ps.group_ids) && ps.group_ids.length)
|
|
127
|
+
lines.push(` groups: ${ps.group_ids.join(", ")}`);
|
|
128
|
+
if (sub.error_message)
|
|
129
|
+
lines.push(` error: ${sub.error_message}`);
|
|
130
|
+
if (syncError)
|
|
131
|
+
lines.push(` (could not refresh from Huawei: ${syncError})`);
|
|
132
|
+
return lines.join("\n");
|
|
133
|
+
}
|
|
134
|
+
async function resolveAppId(input) {
|
|
135
|
+
if (/^[0-9a-f]{8}-[0-9a-f-]{27,}$/i.test(input))
|
|
136
|
+
return input;
|
|
137
|
+
const { apps } = await apiRequest("/api/apps");
|
|
138
|
+
const app = apps.find((item) => item.slug === input);
|
|
139
|
+
if (!app)
|
|
140
|
+
throw new Error(`App not found: ${input}`);
|
|
141
|
+
return app.id;
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=agc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agc.js","sourceRoot":"","sources":["../../src/commands/agc.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAiB3C;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAgB;IAClD,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,0EAA0E,CAAC,CAAC;IAC3H,MAAM,SAAS,GAAG,CAAC,IAAwB,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,EAAsB,CAAC,IAAI,CAAC,CAAC;IAE9G,GAAG;SACA,OAAO,CAAC,uCAAuC,CAAC;SAChD,WAAW,CAAC,iGAAiG,CAAC;SAC9G,cAAc,CAAC,uBAAuB,EAAE,wBAAwB,CAAC;SACjE,MAAM,CAAC,QAAQ,EAAE,cAAc,EAAE,KAAK,CAAC;SACvC,MAAM,CAAC,KAAK,EAAE,GAAW,EAAE,OAAe,EAAE,IAA6C,EAAE,EAAE;QAC5F,MAAM,KAAK,GAAG,MAAM,YAAY,CAAC,GAAG,CAAC,CAAC;QACtC,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,aAAa,KAAK,WAAW,kBAAkB,CAAC,OAAO,CAAC,qBAAqB,EAAE;YAC7G,MAAM,EAAE,MAAM,EAAE,IA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,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"}
|
package/dist/commands/apps.js
CHANGED
|
@@ -101,6 +101,49 @@ export function registerAppCommands(program) {
|
|
|
101
101
|
// response bodies, so the value does not leak into debug logs.
|
|
102
102
|
console.log(result.client_key);
|
|
103
103
|
});
|
|
104
|
+
apps
|
|
105
|
+
.command("add-member <appIdOrSlug> <accountId> <role>")
|
|
106
|
+
.description("Grant a Hands account a direct role on one app (admin, publisher or viewer). " +
|
|
107
|
+
"The account id comes from that principal's `whoami`.")
|
|
108
|
+
.option("--json", "Output JSON.", false)
|
|
109
|
+
.action(async (appIdOrSlug, accountId, role, opts) => {
|
|
110
|
+
const appId = await resolveAppId(appIdOrSlug);
|
|
111
|
+
const result = await apiRequest(`/api/apps/${appId}/members`, {
|
|
112
|
+
method: "POST",
|
|
113
|
+
body: { account_id: accountId, app_role: role },
|
|
114
|
+
});
|
|
115
|
+
if (opts.json) {
|
|
116
|
+
console.log(JSON.stringify(result, null, 2));
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
console.log(`Granted ${role} on app ${appId} to account ${accountId}.`);
|
|
120
|
+
});
|
|
121
|
+
apps
|
|
122
|
+
.command("update-member <appIdOrSlug> <accountId> <role>")
|
|
123
|
+
.description("Change a Hands account's direct role on one app (admin, publisher or viewer).")
|
|
124
|
+
.option("--json", "Output JSON.", false)
|
|
125
|
+
.action(async (appIdOrSlug, accountId, role, opts) => {
|
|
126
|
+
const appId = await resolveAppId(appIdOrSlug);
|
|
127
|
+
const result = await apiRequest(`/api/apps/${appId}/members/${accountId}`, { method: "PATCH", body: { app_role: role } });
|
|
128
|
+
if (opts.json) {
|
|
129
|
+
console.log(JSON.stringify(result, null, 2));
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
console.log(`Changed account ${accountId} to ${role} on app ${appId}.`);
|
|
133
|
+
});
|
|
134
|
+
apps
|
|
135
|
+
.command("remove-member <appIdOrSlug> <accountId>")
|
|
136
|
+
.description("Revoke a Hands account's direct role on one app.")
|
|
137
|
+
.option("--json", "Output JSON.", false)
|
|
138
|
+
.action(async (appIdOrSlug, accountId, opts) => {
|
|
139
|
+
const appId = await resolveAppId(appIdOrSlug);
|
|
140
|
+
const result = await apiRequest(`/api/apps/${appId}/members/${accountId}`, { method: "DELETE" });
|
|
141
|
+
if (opts.json) {
|
|
142
|
+
console.log(JSON.stringify(result, null, 2));
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
console.log(`Removed account ${accountId} from app ${appId}.`);
|
|
146
|
+
});
|
|
104
147
|
}
|
|
105
148
|
async function resolveAppId(input) {
|
|
106
149
|
if (input.length === 36 && appIdOrUuidDash(input))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apps.js","sourceRoot":"","sources":["../../src/commands/apps.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAyB3C,MAAM,UAAU,mBAAmB,CAAC,OAAgB;IAClD,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,0BAA0B,CAAC,CAAC;IAE7E,IAAI;SACD,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,kDAAkD,CAAC;SAC/D,cAAc,CAAC,eAAe,EAAE,kBAAkB,CAAC;SACnD,cAAc,CAAC,eAAe,EAAE,eAAe,CAAC;SAChD,cAAc,CACb,uBAAuB,EACvB,uEAA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ACjE,CAAC,CAAC,CAAC;AACP,CAAC;AAED,KAAK,UAAU,YAAY,CAAC,KAAa;IACvC,IAAI,KAAK,CAAC,MAAM,KAAK,EAAE,IAAI,eAAe,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAChE,MAAM,GAAG,GAAG,MAAM,UAAU,CAAqB,WAAW,CAAC,CAAC;IAC9D,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC;IACzD,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,qBAAqB,KAAK,IAAI,CAAC,CAAC;IAC5D,OAAO,KAAK,CAAC,EAAE,CAAC;AAClB,CAAC;AAED,SAAS,eAAe,CAAC,CAAS;IAChC,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;AACnC,CAAC"}
|
package/dist/commands/builds.js
CHANGED
|
@@ -65,6 +65,33 @@ export async function assertGzipAndroidDeltaPatch(filePath) {
|
|
|
65
65
|
throw new Error(`--delta-patch does not contain an archive-patcher v1 stream: ${filePath}`);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Asset slots declared when an Android build is created.
|
|
70
|
+
*
|
|
71
|
+
* ONLY the ProGuard mapping is declared, and only when --mapping is given.
|
|
72
|
+
*
|
|
73
|
+
* Why not every asset: the server refuses to move a protocol-v1 build to
|
|
74
|
+
* `succeeded` until every declared slot has a verified asset, so declaring more
|
|
75
|
+
* than necessary adds failure modes without adding capability. Two concrete ones
|
|
76
|
+
* that a "mirror everything" version hit during review:
|
|
77
|
+
* - the slot key is kind/platform/arch/variant/filetype, which cannot express
|
|
78
|
+
* fromVersionCode, so two --delta-patch flags produced two identical keys and
|
|
79
|
+
* the build was rejected with "duplicate slot" (builds.ts:457);
|
|
80
|
+
* - --generate-deltas uploads patches through the legacy path that never touched
|
|
81
|
+
* the declared slots, so "declare every uploaded asset" was not actually true.
|
|
82
|
+
*
|
|
83
|
+
* The mapping is the one asset that NEEDS this: an R8 mapping is routinely hundreds
|
|
84
|
+
* of megabytes, which exceeds the 200 MB cap on POST /upload and was the whole
|
|
85
|
+
* reason for this change. Every other asset stays on the legacy registration path,
|
|
86
|
+
* which is already exercised in production.
|
|
87
|
+
*/
|
|
88
|
+
function androidRequiredAssetSlots(args) {
|
|
89
|
+
if (!args.mapping)
|
|
90
|
+
return [];
|
|
91
|
+
return [
|
|
92
|
+
{ artifact_kind: "proguard-mapping", platform: "android", arch: null, variant: null, filetype: "mapping.txt" },
|
|
93
|
+
];
|
|
94
|
+
}
|
|
68
95
|
async function preflightAndroidDeltaPatches(specs = []) {
|
|
69
96
|
const parsed = specs.map((spec) => {
|
|
70
97
|
const eq = spec.indexOf("=");
|
|
@@ -409,6 +436,35 @@ export function registerBuildCommands(program) {
|
|
|
409
436
|
console.log(`\n changelog:\n${build.changelog.split("\n").map((l) => " " + l).join("\n")}`);
|
|
410
437
|
}
|
|
411
438
|
});
|
|
439
|
+
builds
|
|
440
|
+
.command("presign-asset <appIdOrSlug> <buildId> <assetId>")
|
|
441
|
+
.description("Return a short-lived direct download URL for an authenticated build asset. " +
|
|
442
|
+
"Fetch it outside the CLI transport for binary verification.")
|
|
443
|
+
.option("--json", "Output JSON.", false)
|
|
444
|
+
.action(async (appIdOrSlug, buildId, assetId, opts) => {
|
|
445
|
+
const id = await resolveAppId(appIdOrSlug);
|
|
446
|
+
const result = await apiRequest(`/api/apps/${id}/builds/${buildId}/assets/${assetId}/download?presign=1`);
|
|
447
|
+
if (shouldOutputJson(program, opts.json)) {
|
|
448
|
+
console.log(JSON.stringify(result, null, 2));
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
const url = typeof result.url === "string" ? result.url : undefined;
|
|
452
|
+
console.log(url ?? JSON.stringify(result));
|
|
453
|
+
});
|
|
454
|
+
builds
|
|
455
|
+
.command("delete-asset <appIdOrSlug> <buildId> <assetId>")
|
|
456
|
+
.description("Delete one non-installable build-asset metadata row; the R2 object is preserved. " +
|
|
457
|
+
"Requires app admin and fails closed on installable assets or mismatched objects.")
|
|
458
|
+
.option("--json", "Output JSON.", false)
|
|
459
|
+
.action(async (appIdOrSlug, buildId, assetId, opts) => {
|
|
460
|
+
const id = await resolveAppId(appIdOrSlug);
|
|
461
|
+
const result = await apiRequest(`/api/apps/${id}/builds/${buildId}/assets/${assetId}`, { method: "DELETE" });
|
|
462
|
+
if (shouldOutputJson(program, opts.json)) {
|
|
463
|
+
console.log(JSON.stringify(result, null, 2));
|
|
464
|
+
return;
|
|
465
|
+
}
|
|
466
|
+
console.log(`Deleted asset ${assetId} from build ${buildId}.`);
|
|
467
|
+
});
|
|
412
468
|
builds
|
|
413
469
|
.command("publish-version <appIdOrSlug>")
|
|
414
470
|
.description("Register an immutable externally hosted Node/CLI build target.")
|
|
@@ -744,7 +800,18 @@ export function registerBuildCommands(program) {
|
|
|
744
800
|
version_code: versionCode,
|
|
745
801
|
changelog,
|
|
746
802
|
source: "cli",
|
|
747
|
-
|
|
803
|
+
// With --mapping the build is created pending so the mapping can stream to
|
|
804
|
+
// R2 through the direct-upload path (POST /upload would cap the body at
|
|
805
|
+
// 200 MB and buffer the whole file in memory). Without --mapping there is
|
|
806
|
+
// nothing to stream, so the build is created succeeded exactly as before
|
|
807
|
+
// and no protocol fields are sent at all.
|
|
808
|
+
...(opts.mapping
|
|
809
|
+
? {
|
|
810
|
+
status: "pending",
|
|
811
|
+
asset_ingest_protocol_version: 1,
|
|
812
|
+
required_asset_slots_json: androidRequiredAssetSlots(opts),
|
|
813
|
+
}
|
|
814
|
+
: { status: "succeeded" }),
|
|
748
815
|
build_metadata_json: metadataJson,
|
|
749
816
|
provenance_json: provenance,
|
|
750
817
|
should_force_update: Boolean(opts.forceUpdate),
|
|
@@ -795,7 +862,10 @@ export function registerBuildCommands(program) {
|
|
|
795
862
|
assets.push(...generated);
|
|
796
863
|
}
|
|
797
864
|
if (opts.mapping) {
|
|
798
|
-
|
|
865
|
+
// Direct streaming upload, not POST /upload: an R8 mapping is routinely
|
|
866
|
+
// hundreds of MB, which exceeds that route's 200 MB body cap and would also
|
|
867
|
+
// be buffered entirely in memory before hashing.
|
|
868
|
+
assets.push(await uploadDirectBuildAsset(appId, build.id, opts.mapping, {
|
|
799
869
|
artifact_kind: "proguard-mapping",
|
|
800
870
|
platform: "android",
|
|
801
871
|
arch: null,
|
|
@@ -828,6 +898,17 @@ export function registerBuildCommands(program) {
|
|
|
828
898
|
metadata_json: { filename: basename(opts.metadata) },
|
|
829
899
|
}));
|
|
830
900
|
}
|
|
901
|
+
// Only a build created pending needs activating; when there is no --mapping it
|
|
902
|
+
// was already created succeeded above.
|
|
903
|
+
if (opts.mapping) {
|
|
904
|
+
// Every declared slot is uploaded and verified now. The server re-checks
|
|
905
|
+
// each one and returns REQUIRED_ASSETS_INCOMPLETE if any is missing, so a
|
|
906
|
+
// failure here is a real signal rather than a formality.
|
|
907
|
+
await apiRequest(`/api/apps/${appId}/builds/${build.id}`, {
|
|
908
|
+
method: "PATCH",
|
|
909
|
+
body: { status: "succeeded" },
|
|
910
|
+
});
|
|
911
|
+
}
|
|
831
912
|
const release = await createReleaseOrTerminalizeVersionConflict({
|
|
832
913
|
appId,
|
|
833
914
|
buildId: build.id,
|
|
@@ -1014,6 +1095,33 @@ export function registerBuildCommands(program) {
|
|
|
1014
1095
|
}
|
|
1015
1096
|
console.log(" note: upload this Hands build with the server-side upload-testflight-build action.");
|
|
1016
1097
|
});
|
|
1098
|
+
builds
|
|
1099
|
+
.command("attach-symbols <appIdOrSlug> <buildId> <file>")
|
|
1100
|
+
.description("Attach a debug-symbol file (ProGuard mapping, native symbols or dSYM) to an existing build, " +
|
|
1101
|
+
"including one that has already published. Add-only: an existing asset for the same slot is not replaced.")
|
|
1102
|
+
.option("--kind <kind>", "proguard-mapping | native-symbols | dsym. Inferred from the filename when omitted.")
|
|
1103
|
+
.option("--json", "Output JSON.", false)
|
|
1104
|
+
.action(async (appIdOrSlug, buildId, filePath, opts) => {
|
|
1105
|
+
if (!existsSync(filePath))
|
|
1106
|
+
throw new Error(`missing file: ${filePath}`);
|
|
1107
|
+
const kind = opts.kind ?? inferSymbolKind(filePath);
|
|
1108
|
+
if (!SYMBOL_KINDS.has(kind)) {
|
|
1109
|
+
throw new Error(`--kind must be one of ${[...SYMBOL_KINDS].join(", ")}; got ${kind}. ` +
|
|
1110
|
+
"Only debug symbols can be attached to an existing build.");
|
|
1111
|
+
}
|
|
1112
|
+
const appId = await resolveAppId(appIdOrSlug);
|
|
1113
|
+
const asset = await uploadDirectBuildAsset(appId, buildId, filePath, {
|
|
1114
|
+
artifact_kind: kind,
|
|
1115
|
+
platform: inferSymbolPlatform(filePath),
|
|
1116
|
+
arch: null,
|
|
1117
|
+
filetype: SYMBOL_FILETYPE[kind] ?? "mapping.txt",
|
|
1118
|
+
});
|
|
1119
|
+
if (shouldOutputJson(program, opts.json)) {
|
|
1120
|
+
console.log(JSON.stringify(asset, null, 2));
|
|
1121
|
+
return;
|
|
1122
|
+
}
|
|
1123
|
+
console.log(`Attached ${kind} to build ${buildId} (sha256 ${asset.file_hash}).`);
|
|
1124
|
+
});
|
|
1017
1125
|
builds
|
|
1018
1126
|
.command("testflight-groups <appIdOrSlug> <buildId>")
|
|
1019
1127
|
.description("List App Store Connect internal/external beta groups for an existing Hands iOS build.")
|
|
@@ -1525,6 +1633,25 @@ async function uploadAndRegisterAsset(appId, buildId, filePath, metadata) {
|
|
|
1525
1633
|
size_bytes: uploaded.size_bytes,
|
|
1526
1634
|
};
|
|
1527
1635
|
}
|
|
1636
|
+
/** Debug-symbol kinds the server accepts for appending. */
|
|
1637
|
+
const SYMBOL_KINDS = new Set(["proguard-mapping", "native-symbols", "dsym"]);
|
|
1638
|
+
const SYMBOL_FILETYPE = {
|
|
1639
|
+
"proguard-mapping": "mapping.txt",
|
|
1640
|
+
"native-symbols": "symbols.zip",
|
|
1641
|
+
dsym: "dSYM.zip",
|
|
1642
|
+
};
|
|
1643
|
+
function inferSymbolKind(filePath) {
|
|
1644
|
+
const name = basename(filePath).toLowerCase();
|
|
1645
|
+
if (name.includes("mapping"))
|
|
1646
|
+
return "proguard-mapping";
|
|
1647
|
+
if (name.includes("dsym"))
|
|
1648
|
+
return "dsym";
|
|
1649
|
+
return "native-symbols";
|
|
1650
|
+
}
|
|
1651
|
+
/** A ProGuard mapping describes Android code; dSYM and native symbols are Apple-side. */
|
|
1652
|
+
function inferSymbolPlatform(filePath) {
|
|
1653
|
+
return inferSymbolKind(filePath) === "proguard-mapping" ? "android" : "ios";
|
|
1654
|
+
}
|
|
1528
1655
|
async function uploadDirectBuildAsset(appId, buildId, filePath, metadata) {
|
|
1529
1656
|
const local = await sha256File(filePath);
|
|
1530
1657
|
const idempotencyKey = createHash("sha256").update(JSON.stringify({
|