@botiverse/hands-cli 0.5.30 → 0.5.32
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.js +2 -1
- package/dist/commands/agc.js.map +1 -1
- package/dist/commands/apps.js +48 -4
- package/dist/commands/apps.js.map +1 -1
- package/dist/commands/builds.js +175 -16
- package/dist/commands/builds.js.map +1 -1
- package/dist/commands/channels.js +5 -4
- package/dist/commands/channels.js.map +1 -1
- package/dist/commands/deploy_tokens.js +3 -2
- package/dist/commands/deploy_tokens.js.map +1 -1
- package/dist/commands/device_groups.js +7 -6
- package/dist/commands/device_groups.js.map +1 -1
- package/dist/commands/feedback.js +5 -4
- package/dist/commands/feedback.js.map +1 -1
- package/dist/commands/releases.js +41 -8
- package/dist/commands/releases.js.map +1 -1
- package/dist/commands/testflight.js +4 -3
- package/dist/commands/testflight.js.map +1 -1
- package/dist/commands/webhooks.js +6 -5
- package/dist/commands/webhooks.js.map +1 -1
- package/dist/lib/json_output.d.ts +18 -0
- package/dist/lib/json_output.js +22 -0
- package/dist/lib/json_output.js.map +1 -0
- package/package.json +1 -1
package/dist/commands/agc.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { apiRequest } from "../lib/api.js";
|
|
2
|
+
import { jsonRequested } from "../lib/json_output.js";
|
|
2
3
|
/**
|
|
3
4
|
* `hands agc …` — AppGallery Connect invitation testing for OHOS builds
|
|
4
5
|
* (Huawei App Testing, releaseType 6). Store listing / phased release is not
|
|
@@ -7,7 +8,7 @@ import { apiRequest } from "../lib/api.js";
|
|
|
7
8
|
*/
|
|
8
9
|
export function registerAgcCommands(program) {
|
|
9
10
|
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
|
+
const wantsJson = (opts) => Boolean(jsonRequested(program, opts.json) || program.opts().json);
|
|
11
12
|
agc
|
|
12
13
|
.command("upload-market <appIdOrSlug> <buildId>")
|
|
13
14
|
.description("Upload a signed HarmonyOS .app to AppGallery formal package management; does not submit review.")
|
package/dist/commands/agc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agc.js","sourceRoot":"","sources":["../../src/commands/agc.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"agc.js","sourceRoot":"","sources":["../../src/commands/agc.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAiBtD;;;;;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,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,EAAsB,CAAC,IAAI,CAAC,CAAC;IAEtI,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,IAAI,EAAE,EAAE,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C9D,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
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* app-admin-only client-key read endpoint.
|
|
6
6
|
*/
|
|
7
7
|
import { apiRequest } from "../lib/api.js";
|
|
8
|
+
import { jsonRequested } from "../lib/json_output.js";
|
|
8
9
|
export function registerAppCommands(program) {
|
|
9
10
|
const apps = program.command("apps").description("Manage apps in your org.");
|
|
10
11
|
apps
|
|
@@ -27,7 +28,7 @@ export function registerAppCommands(program) {
|
|
|
27
28
|
: {}),
|
|
28
29
|
},
|
|
29
30
|
});
|
|
30
|
-
if (opts.json) {
|
|
31
|
+
if (jsonRequested(program, opts.json)) {
|
|
31
32
|
console.log(JSON.stringify(app, null, 2));
|
|
32
33
|
return;
|
|
33
34
|
}
|
|
@@ -45,7 +46,7 @@ export function registerAppCommands(program) {
|
|
|
45
46
|
const res = await apiRequest("/api/apps", {
|
|
46
47
|
query: { include_archived: opts.includeArchived ? "1" : "0" },
|
|
47
48
|
});
|
|
48
|
-
if (opts.json) {
|
|
49
|
+
if (jsonRequested(program, opts.json)) {
|
|
49
50
|
console.log(JSON.stringify(res, null, 2));
|
|
50
51
|
return;
|
|
51
52
|
}
|
|
@@ -71,7 +72,7 @@ export function registerAppCommands(program) {
|
|
|
71
72
|
.action(async (appIdOrSlug, opts) => {
|
|
72
73
|
const id = await resolveAppId(appIdOrSlug);
|
|
73
74
|
const app = await apiRequest(`/api/apps/${id}`);
|
|
74
|
-
if (opts.json) {
|
|
75
|
+
if (jsonRequested(program, opts.json)) {
|
|
75
76
|
console.log(JSON.stringify(app, null, 2));
|
|
76
77
|
return;
|
|
77
78
|
}
|
|
@@ -88,7 +89,7 @@ export function registerAppCommands(program) {
|
|
|
88
89
|
.action(async (appIdOrSlug, opts) => {
|
|
89
90
|
const appId = await resolveAppId(appIdOrSlug);
|
|
90
91
|
const result = await apiRequest(`/api/apps/${appId}/client-key`);
|
|
91
|
-
if (opts.json) {
|
|
92
|
+
if (jsonRequested(program, opts.json)) {
|
|
92
93
|
console.log(JSON.stringify(result, null, 2));
|
|
93
94
|
return;
|
|
94
95
|
}
|
|
@@ -101,6 +102,49 @@ export function registerAppCommands(program) {
|
|
|
101
102
|
// response bodies, so the value does not leak into debug logs.
|
|
102
103
|
console.log(result.client_key);
|
|
103
104
|
});
|
|
105
|
+
apps
|
|
106
|
+
.command("add-member <appIdOrSlug> <accountId> <role>")
|
|
107
|
+
.description("Grant a Hands account a direct role on one app (admin, publisher or viewer). " +
|
|
108
|
+
"The account id comes from that principal's `whoami`.")
|
|
109
|
+
.option("--json", "Output JSON.", false)
|
|
110
|
+
.action(async (appIdOrSlug, accountId, role, opts) => {
|
|
111
|
+
const appId = await resolveAppId(appIdOrSlug);
|
|
112
|
+
const result = await apiRequest(`/api/apps/${appId}/members`, {
|
|
113
|
+
method: "POST",
|
|
114
|
+
body: { account_id: accountId, app_role: role },
|
|
115
|
+
});
|
|
116
|
+
if (jsonRequested(program, opts.json)) {
|
|
117
|
+
console.log(JSON.stringify(result, null, 2));
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
console.log(`Granted ${role} on app ${appId} to account ${accountId}.`);
|
|
121
|
+
});
|
|
122
|
+
apps
|
|
123
|
+
.command("update-member <appIdOrSlug> <accountId> <role>")
|
|
124
|
+
.description("Change a Hands account's direct role on one app (admin, publisher or viewer).")
|
|
125
|
+
.option("--json", "Output JSON.", false)
|
|
126
|
+
.action(async (appIdOrSlug, accountId, role, opts) => {
|
|
127
|
+
const appId = await resolveAppId(appIdOrSlug);
|
|
128
|
+
const result = await apiRequest(`/api/apps/${appId}/members/${accountId}`, { method: "PATCH", body: { app_role: role } });
|
|
129
|
+
if (jsonRequested(program, opts.json)) {
|
|
130
|
+
console.log(JSON.stringify(result, null, 2));
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
console.log(`Changed account ${accountId} to ${role} on app ${appId}.`);
|
|
134
|
+
});
|
|
135
|
+
apps
|
|
136
|
+
.command("remove-member <appIdOrSlug> <accountId>")
|
|
137
|
+
.description("Revoke a Hands account's direct role on one app.")
|
|
138
|
+
.option("--json", "Output JSON.", false)
|
|
139
|
+
.action(async (appIdOrSlug, accountId, opts) => {
|
|
140
|
+
const appId = await resolveAppId(appIdOrSlug);
|
|
141
|
+
const result = await apiRequest(`/api/apps/${appId}/members/${accountId}`, { method: "DELETE" });
|
|
142
|
+
if (jsonRequested(program, opts.json)) {
|
|
143
|
+
console.log(JSON.stringify(result, null, 2));
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
console.log(`Removed account ${accountId} from app ${appId}.`);
|
|
147
|
+
});
|
|
104
148
|
}
|
|
105
149
|
async function resolveAppId(input) {
|
|
106
150
|
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;
|
|
1
|
+
{"version":3,"file":"apps.js","sourceRoot":"","sources":["../../src/commands/apps.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAyBtD,MAAM,UAAU,mBAAmB,CAAC,OAAgB;IAClD,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO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AM,GAAG,MAAM,UAAU,CAC7B,aAAa,KAAK,YAAY,SAAS,EAAE,EACzC,EAAE,MAAM,EAAE,QAAQ,EAAE,CACrB,CAAC;QACF,IAAI,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACtC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;YAC7C,OAAO;QACT,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,mBAAmB,SAAS,aAAa,KAAK,GAAG,CAAC,CAAC;IACjE,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
|
@@ -15,6 +15,7 @@ import { promisify } from "node:util";
|
|
|
15
15
|
import { createGunzip } from "node:zlib";
|
|
16
16
|
import { apiRequest, apiUploadFile, QuiverApiError } from "../lib/api.js";
|
|
17
17
|
import { createHash } from "node:crypto";
|
|
18
|
+
import { jsonRequested } from "../lib/json_output.js";
|
|
18
19
|
const execFileAsync = promisify(execFile);
|
|
19
20
|
/**
|
|
20
21
|
* Digest and byte length of a local file, streamed so a multi-hundred-megabyte
|
|
@@ -65,6 +66,33 @@ export async function assertGzipAndroidDeltaPatch(filePath) {
|
|
|
65
66
|
throw new Error(`--delta-patch does not contain an archive-patcher v1 stream: ${filePath}`);
|
|
66
67
|
}
|
|
67
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Asset slots declared when an Android build is created.
|
|
71
|
+
*
|
|
72
|
+
* ONLY the ProGuard mapping is declared, and only when --mapping is given.
|
|
73
|
+
*
|
|
74
|
+
* Why not every asset: the server refuses to move a protocol-v1 build to
|
|
75
|
+
* `succeeded` until every declared slot has a verified asset, so declaring more
|
|
76
|
+
* than necessary adds failure modes without adding capability. Two concrete ones
|
|
77
|
+
* that a "mirror everything" version hit during review:
|
|
78
|
+
* - the slot key is kind/platform/arch/variant/filetype, which cannot express
|
|
79
|
+
* fromVersionCode, so two --delta-patch flags produced two identical keys and
|
|
80
|
+
* the build was rejected with "duplicate slot" (builds.ts:457);
|
|
81
|
+
* - --generate-deltas uploads patches through the legacy path that never touched
|
|
82
|
+
* the declared slots, so "declare every uploaded asset" was not actually true.
|
|
83
|
+
*
|
|
84
|
+
* The mapping is the one asset that NEEDS this: an R8 mapping is routinely hundreds
|
|
85
|
+
* of megabytes, which exceeds the 200 MB cap on POST /upload and was the whole
|
|
86
|
+
* reason for this change. Every other asset stays on the legacy registration path,
|
|
87
|
+
* which is already exercised in production.
|
|
88
|
+
*/
|
|
89
|
+
function androidRequiredAssetSlots(args) {
|
|
90
|
+
if (!args.mapping)
|
|
91
|
+
return [];
|
|
92
|
+
return [
|
|
93
|
+
{ artifact_kind: "proguard-mapping", platform: "android", arch: null, variant: null, filetype: "mapping.txt" },
|
|
94
|
+
];
|
|
95
|
+
}
|
|
68
96
|
async function preflightAndroidDeltaPatches(specs = []) {
|
|
69
97
|
const parsed = specs.map((spec) => {
|
|
70
98
|
const eq = spec.indexOf("=");
|
|
@@ -372,7 +400,7 @@ export function registerBuildCommands(program) {
|
|
|
372
400
|
.action(async (appIdOrSlug, opts) => {
|
|
373
401
|
const id = await resolveAppId(appIdOrSlug);
|
|
374
402
|
const res = await apiRequest(`/api/apps/${id}/builds`, { query: { limit: opts.limit } });
|
|
375
|
-
if (shouldOutputJson(program, opts.json)) {
|
|
403
|
+
if (shouldOutputJson(program, jsonRequested(program, opts.json))) {
|
|
376
404
|
console.log(JSON.stringify(res, null, 2));
|
|
377
405
|
return;
|
|
378
406
|
}
|
|
@@ -392,7 +420,7 @@ export function registerBuildCommands(program) {
|
|
|
392
420
|
.action(async (appIdOrSlug, buildId, opts) => {
|
|
393
421
|
const id = await resolveAppId(appIdOrSlug);
|
|
394
422
|
const build = await apiRequest(`/api/apps/${id}/builds/${buildId}`);
|
|
395
|
-
if (shouldOutputJson(program, opts.json)) {
|
|
423
|
+
if (shouldOutputJson(program, jsonRequested(program, opts.json))) {
|
|
396
424
|
console.log(JSON.stringify(build, null, 2));
|
|
397
425
|
return;
|
|
398
426
|
}
|
|
@@ -409,6 +437,35 @@ export function registerBuildCommands(program) {
|
|
|
409
437
|
console.log(`\n changelog:\n${build.changelog.split("\n").map((l) => " " + l).join("\n")}`);
|
|
410
438
|
}
|
|
411
439
|
});
|
|
440
|
+
builds
|
|
441
|
+
.command("presign-asset <appIdOrSlug> <buildId> <assetId>")
|
|
442
|
+
.description("Return a short-lived direct download URL for an authenticated build asset. " +
|
|
443
|
+
"Fetch it outside the CLI transport for binary verification.")
|
|
444
|
+
.option("--json", "Output JSON.", false)
|
|
445
|
+
.action(async (appIdOrSlug, buildId, assetId, opts) => {
|
|
446
|
+
const id = await resolveAppId(appIdOrSlug);
|
|
447
|
+
const result = await apiRequest(`/api/apps/${id}/builds/${buildId}/assets/${assetId}/download?presign=1`);
|
|
448
|
+
if (shouldOutputJson(program, jsonRequested(program, opts.json))) {
|
|
449
|
+
console.log(JSON.stringify(result, null, 2));
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
const url = typeof result.url === "string" ? result.url : undefined;
|
|
453
|
+
console.log(url ?? JSON.stringify(result));
|
|
454
|
+
});
|
|
455
|
+
builds
|
|
456
|
+
.command("delete-asset <appIdOrSlug> <buildId> <assetId>")
|
|
457
|
+
.description("Delete one non-installable build-asset metadata row; the R2 object is preserved. " +
|
|
458
|
+
"Requires app admin and fails closed on installable assets or mismatched objects.")
|
|
459
|
+
.option("--json", "Output JSON.", false)
|
|
460
|
+
.action(async (appIdOrSlug, buildId, assetId, opts) => {
|
|
461
|
+
const id = await resolveAppId(appIdOrSlug);
|
|
462
|
+
const result = await apiRequest(`/api/apps/${id}/builds/${buildId}/assets/${assetId}`, { method: "DELETE" });
|
|
463
|
+
if (shouldOutputJson(program, jsonRequested(program, opts.json))) {
|
|
464
|
+
console.log(JSON.stringify(result, null, 2));
|
|
465
|
+
return;
|
|
466
|
+
}
|
|
467
|
+
console.log(`Deleted asset ${assetId} from build ${buildId}.`);
|
|
468
|
+
});
|
|
412
469
|
builds
|
|
413
470
|
.command("publish-version <appIdOrSlug>")
|
|
414
471
|
.description("Register an immutable externally hosted Node/CLI build target.")
|
|
@@ -467,7 +524,7 @@ export function registerBuildCommands(program) {
|
|
|
467
524
|
},
|
|
468
525
|
},
|
|
469
526
|
});
|
|
470
|
-
if (shouldOutputJson(program, opts.json)) {
|
|
527
|
+
if (shouldOutputJson(program, jsonRequested(program, opts.json))) {
|
|
471
528
|
console.log(JSON.stringify(result, null, 2));
|
|
472
529
|
return;
|
|
473
530
|
}
|
|
@@ -667,7 +724,7 @@ export function registerBuildCommands(program) {
|
|
|
667
724
|
size_bytes: asset.size_bytes,
|
|
668
725
|
})),
|
|
669
726
|
};
|
|
670
|
-
if (shouldOutputJson(program, opts.json)) {
|
|
727
|
+
if (shouldOutputJson(program, jsonRequested(program, opts.json))) {
|
|
671
728
|
console.log(JSON.stringify(result, null, 2));
|
|
672
729
|
return;
|
|
673
730
|
}
|
|
@@ -744,7 +801,18 @@ export function registerBuildCommands(program) {
|
|
|
744
801
|
version_code: versionCode,
|
|
745
802
|
changelog,
|
|
746
803
|
source: "cli",
|
|
747
|
-
|
|
804
|
+
// With --mapping the build is created pending so the mapping can stream to
|
|
805
|
+
// R2 through the direct-upload path (POST /upload would cap the body at
|
|
806
|
+
// 200 MB and buffer the whole file in memory). Without --mapping there is
|
|
807
|
+
// nothing to stream, so the build is created succeeded exactly as before
|
|
808
|
+
// and no protocol fields are sent at all.
|
|
809
|
+
...(opts.mapping
|
|
810
|
+
? {
|
|
811
|
+
status: "pending",
|
|
812
|
+
asset_ingest_protocol_version: 1,
|
|
813
|
+
required_asset_slots_json: androidRequiredAssetSlots(opts),
|
|
814
|
+
}
|
|
815
|
+
: { status: "succeeded" }),
|
|
748
816
|
build_metadata_json: metadataJson,
|
|
749
817
|
provenance_json: provenance,
|
|
750
818
|
should_force_update: Boolean(opts.forceUpdate),
|
|
@@ -795,7 +863,10 @@ export function registerBuildCommands(program) {
|
|
|
795
863
|
assets.push(...generated);
|
|
796
864
|
}
|
|
797
865
|
if (opts.mapping) {
|
|
798
|
-
|
|
866
|
+
// Direct streaming upload, not POST /upload: an R8 mapping is routinely
|
|
867
|
+
// hundreds of MB, which exceeds that route's 200 MB body cap and would also
|
|
868
|
+
// be buffered entirely in memory before hashing.
|
|
869
|
+
assets.push(await uploadDirectBuildAsset(appId, build.id, opts.mapping, {
|
|
799
870
|
artifact_kind: "proguard-mapping",
|
|
800
871
|
platform: "android",
|
|
801
872
|
arch: null,
|
|
@@ -828,6 +899,17 @@ export function registerBuildCommands(program) {
|
|
|
828
899
|
metadata_json: { filename: basename(opts.metadata) },
|
|
829
900
|
}));
|
|
830
901
|
}
|
|
902
|
+
// Only a build created pending needs activating; when there is no --mapping it
|
|
903
|
+
// was already created succeeded above.
|
|
904
|
+
if (opts.mapping) {
|
|
905
|
+
// Every declared slot is uploaded and verified now. The server re-checks
|
|
906
|
+
// each one and returns REQUIRED_ASSETS_INCOMPLETE if any is missing, so a
|
|
907
|
+
// failure here is a real signal rather than a formality.
|
|
908
|
+
await apiRequest(`/api/apps/${appId}/builds/${build.id}`, {
|
|
909
|
+
method: "PATCH",
|
|
910
|
+
body: { status: "succeeded" },
|
|
911
|
+
});
|
|
912
|
+
}
|
|
831
913
|
const release = await createReleaseOrTerminalizeVersionConflict({
|
|
832
914
|
appId,
|
|
833
915
|
buildId: build.id,
|
|
@@ -853,7 +935,7 @@ export function registerBuildCommands(program) {
|
|
|
853
935
|
version_code: versionCode,
|
|
854
936
|
assets,
|
|
855
937
|
};
|
|
856
|
-
if (shouldOutputJson(program, opts.json)) {
|
|
938
|
+
if (shouldOutputJson(program, jsonRequested(program, opts.json))) {
|
|
857
939
|
console.log(JSON.stringify(result, null, 2));
|
|
858
940
|
return;
|
|
859
941
|
}
|
|
@@ -1000,7 +1082,7 @@ export function registerBuildCommands(program) {
|
|
|
1000
1082
|
version_code: versionCode,
|
|
1001
1083
|
assets,
|
|
1002
1084
|
};
|
|
1003
|
-
if (shouldOutputJson(program, opts.json)) {
|
|
1085
|
+
if (shouldOutputJson(program, jsonRequested(program, opts.json))) {
|
|
1004
1086
|
console.log(JSON.stringify(result, null, 2));
|
|
1005
1087
|
return;
|
|
1006
1088
|
}
|
|
@@ -1014,6 +1096,33 @@ export function registerBuildCommands(program) {
|
|
|
1014
1096
|
}
|
|
1015
1097
|
console.log(" note: upload this Hands build with the server-side upload-testflight-build action.");
|
|
1016
1098
|
});
|
|
1099
|
+
builds
|
|
1100
|
+
.command("attach-symbols <appIdOrSlug> <buildId> <file>")
|
|
1101
|
+
.description("Attach a debug-symbol file (ProGuard mapping, native symbols or dSYM) to an existing build, " +
|
|
1102
|
+
"including one that has already published. Add-only: an existing asset for the same slot is not replaced.")
|
|
1103
|
+
.option("--kind <kind>", "proguard-mapping | native-symbols | dsym. Inferred from the filename when omitted.")
|
|
1104
|
+
.option("--json", "Output JSON.", false)
|
|
1105
|
+
.action(async (appIdOrSlug, buildId, filePath, opts) => {
|
|
1106
|
+
if (!existsSync(filePath))
|
|
1107
|
+
throw new Error(`missing file: ${filePath}`);
|
|
1108
|
+
const kind = opts.kind ?? inferSymbolKind(filePath);
|
|
1109
|
+
if (!SYMBOL_KINDS.has(kind)) {
|
|
1110
|
+
throw new Error(`--kind must be one of ${[...SYMBOL_KINDS].join(", ")}; got ${kind}. ` +
|
|
1111
|
+
"Only debug symbols can be attached to an existing build.");
|
|
1112
|
+
}
|
|
1113
|
+
const appId = await resolveAppId(appIdOrSlug);
|
|
1114
|
+
const asset = await uploadDirectBuildAsset(appId, buildId, filePath, {
|
|
1115
|
+
artifact_kind: kind,
|
|
1116
|
+
platform: inferSymbolPlatform(filePath),
|
|
1117
|
+
arch: null,
|
|
1118
|
+
filetype: SYMBOL_FILETYPE[kind] ?? "mapping.txt",
|
|
1119
|
+
});
|
|
1120
|
+
if (shouldOutputJson(program, jsonRequested(program, opts.json))) {
|
|
1121
|
+
console.log(JSON.stringify(asset, null, 2));
|
|
1122
|
+
return;
|
|
1123
|
+
}
|
|
1124
|
+
console.log(`Attached ${kind} to build ${buildId} (sha256 ${asset.file_hash}).`);
|
|
1125
|
+
});
|
|
1017
1126
|
builds
|
|
1018
1127
|
.command("testflight-groups <appIdOrSlug> <buildId>")
|
|
1019
1128
|
.description("List App Store Connect internal/external beta groups for an existing Hands iOS build.")
|
|
@@ -1024,7 +1133,7 @@ export function registerBuildCommands(program) {
|
|
|
1024
1133
|
const result = await apiRequest(`/api/apps/${appId}/builds/${buildId}/testflight-groups`, {
|
|
1025
1134
|
query: { bundle_id: opts.bundleId },
|
|
1026
1135
|
});
|
|
1027
|
-
if (shouldOutputJson(program, opts.json)) {
|
|
1136
|
+
if (shouldOutputJson(program, jsonRequested(program, opts.json))) {
|
|
1028
1137
|
console.log(JSON.stringify(result, null, 2));
|
|
1029
1138
|
return;
|
|
1030
1139
|
}
|
|
@@ -1052,7 +1161,7 @@ export function registerBuildCommands(program) {
|
|
|
1052
1161
|
}
|
|
1053
1162
|
const appId = await resolveAppId(appIdOrSlug);
|
|
1054
1163
|
const status = await getTestflightPublishStatus(appId, buildId, opts);
|
|
1055
|
-
if (shouldOutputJson(program, opts.json)) {
|
|
1164
|
+
if (shouldOutputJson(program, jsonRequested(program, opts.json))) {
|
|
1056
1165
|
console.log(JSON.stringify(status, null, 2));
|
|
1057
1166
|
return;
|
|
1058
1167
|
}
|
|
@@ -1092,7 +1201,7 @@ export function registerBuildCommands(program) {
|
|
|
1092
1201
|
const appId = await resolveAppId(appIdOrSlug);
|
|
1093
1202
|
const intervalSeconds = positiveSeconds(opts.pollIntervalSeconds, "--poll-interval-seconds");
|
|
1094
1203
|
const timeoutSeconds = positiveSeconds(opts.timeoutSeconds, "--timeout-seconds");
|
|
1095
|
-
const quiet = shouldOutputJson(program, opts.json);
|
|
1204
|
+
const quiet = shouldOutputJson(program, jsonRequested(program, opts.json));
|
|
1096
1205
|
const distribution = opts.distribution;
|
|
1097
1206
|
const waitStartedAt = Date.now();
|
|
1098
1207
|
if (opts.wait) {
|
|
@@ -1305,7 +1414,7 @@ export function registerBuildCommands(program) {
|
|
|
1305
1414
|
version_code: versionCode,
|
|
1306
1415
|
assets,
|
|
1307
1416
|
};
|
|
1308
|
-
if (shouldOutputJson(program, opts.json)) {
|
|
1417
|
+
if (shouldOutputJson(program, jsonRequested(program, opts.json))) {
|
|
1309
1418
|
console.log(JSON.stringify(result, null, 2));
|
|
1310
1419
|
return;
|
|
1311
1420
|
}
|
|
@@ -1468,7 +1577,7 @@ export function registerBuildCommands(program) {
|
|
|
1468
1577
|
version_code: versionCode,
|
|
1469
1578
|
assets,
|
|
1470
1579
|
};
|
|
1471
|
-
if (shouldOutputJson(program, opts.json)) {
|
|
1580
|
+
if (shouldOutputJson(program, jsonRequested(program, opts.json))) {
|
|
1472
1581
|
console.log(JSON.stringify(result, null, 2));
|
|
1473
1582
|
return;
|
|
1474
1583
|
}
|
|
@@ -1525,6 +1634,53 @@ async function uploadAndRegisterAsset(appId, buildId, filePath, metadata) {
|
|
|
1525
1634
|
size_bytes: uploaded.size_bytes,
|
|
1526
1635
|
};
|
|
1527
1636
|
}
|
|
1637
|
+
/** Debug-symbol kinds the server accepts for appending. */
|
|
1638
|
+
const SYMBOL_KINDS = new Set(["proguard-mapping", "native-symbols", "dsym"]);
|
|
1639
|
+
const SYMBOL_FILETYPE = {
|
|
1640
|
+
"proguard-mapping": "mapping.txt",
|
|
1641
|
+
"native-symbols": "symbols.zip",
|
|
1642
|
+
dsym: "dSYM.zip",
|
|
1643
|
+
};
|
|
1644
|
+
function inferSymbolKind(filePath) {
|
|
1645
|
+
const name = basename(filePath).toLowerCase();
|
|
1646
|
+
if (name.includes("mapping"))
|
|
1647
|
+
return "proguard-mapping";
|
|
1648
|
+
if (name.includes("dsym"))
|
|
1649
|
+
return "dsym";
|
|
1650
|
+
return "native-symbols";
|
|
1651
|
+
}
|
|
1652
|
+
/** A ProGuard mapping describes Android code; dSYM and native symbols are Apple-side. */
|
|
1653
|
+
function inferSymbolPlatform(filePath) {
|
|
1654
|
+
return inferSymbolKind(filePath) === "proguard-mapping" ? "android" : "ios";
|
|
1655
|
+
}
|
|
1656
|
+
/**
|
|
1657
|
+
* POST the completion step, retrying transient transport failures.
|
|
1658
|
+
*
|
|
1659
|
+
* Safe because the endpoint is a replay when the asset is already committed
|
|
1660
|
+
* (build_asset_uploads.ts returns the stored row when state='ready'), so a retry
|
|
1661
|
+
* can only produce the same result. Bounded: three attempts with short backoff,
|
|
1662
|
+
* then surface the last error so a real failure is not hidden.
|
|
1663
|
+
*/
|
|
1664
|
+
async function completeWithRetry(appId, buildId, assetId) {
|
|
1665
|
+
const attempts = 3;
|
|
1666
|
+
let lastError;
|
|
1667
|
+
for (let attempt = 1; attempt <= attempts; attempt += 1) {
|
|
1668
|
+
try {
|
|
1669
|
+
return await apiRequest(`/api/apps/${appId}/builds/${buildId}/assets/${assetId}/upload/complete`, {
|
|
1670
|
+
method: "POST",
|
|
1671
|
+
});
|
|
1672
|
+
}
|
|
1673
|
+
catch (error) {
|
|
1674
|
+
lastError = error;
|
|
1675
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1676
|
+
const transient = /fetch failed|network|timeout|socket hang up|ECONNRESET|EAI_AGAIN/i.test(message);
|
|
1677
|
+
if (!transient || attempt === attempts)
|
|
1678
|
+
throw error;
|
|
1679
|
+
await new Promise((resolve) => setTimeout(resolve, 500 * attempt));
|
|
1680
|
+
}
|
|
1681
|
+
}
|
|
1682
|
+
throw lastError;
|
|
1683
|
+
}
|
|
1528
1684
|
async function uploadDirectBuildAsset(appId, buildId, filePath, metadata) {
|
|
1529
1685
|
const local = await sha256File(filePath);
|
|
1530
1686
|
const idempotencyKey = createHash("sha256").update(JSON.stringify({
|
|
@@ -1572,9 +1728,12 @@ async function uploadDirectBuildAsset(appId, buildId, filePath, metadata) {
|
|
|
1572
1728
|
throw new Error(`direct R2 upload failed: ${uploadResponse.status} ${uploadResponse.statusText}`);
|
|
1573
1729
|
}
|
|
1574
1730
|
}
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1731
|
+
// Completion is idempotent server-side: if the row is already 'ready' with a
|
|
1732
|
+
// committed key, the endpoint replays the stored result. So a transient network
|
|
1733
|
+
// failure here can be retried without risking a duplicate asset -- and NOT
|
|
1734
|
+
// retrying would report "fetch failed" for an upload that actually committed,
|
|
1735
|
+
// which is exactly what happened during the first real use of attach-symbols.
|
|
1736
|
+
const completed = await completeWithRetry(appId, buildId, declared.asset_id);
|
|
1578
1737
|
return {
|
|
1579
1738
|
id: completed.asset_id,
|
|
1580
1739
|
artifact_kind: metadata.artifact_kind,
|