The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 03:15 UTC
perf(release): macOS CLI notarization no longer blocks the desktop build (#31945)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Theo Browne committed
Nov 6, 2026 at 13:08 UTC
423254e27dc58e6bb14c994fc0e69fd2f40c8312
3 files changed
+423
-31
.github/workflows/release-desktop.yml
+53
-6
@@ -408,6 +408,7 @@ jobs:
408
run: command -v patchelf || { sudo apt-get update && sudo apt-get install -y patchelf; }
409
410
- name: Build CLI archive
411
+ id: build_cli
412
if: inputs.cli_archive
413
shell: bash
414
env:
@@ -425,25 +426,38 @@ jobs:
426
AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME }}
427
run: |
428
set -euo pipefail
428
- if [[ "${{ inputs.platform }}" == "mac" && -n "${APPLE_API_KEY:-}" ]]; then
429
- key_path="$RUNNER_TEMP/AuthKey_cli_${APPLE_API_KEY_ID}.p8"
430
- printf '%s' "$APPLE_API_KEY" > "$key_path"
431
- export APPLE_API_KEY="$key_path"
429
+ extra_args=()
430
+ if [[ "${{ inputs.platform }}" == "mac" ]]; then
431
+ if [[ -n "${APPLE_API_KEY:-}" ]]; then
432
+ key_dir="$(mktemp -d "$RUNNER_TEMP/t3-cli-notary.XXXXXXXX")"
433
+ trap 'rm -rf "$key_dir"' EXIT
434
+ key_path="$key_dir/AuthKey.p8"
435
+ (umask 077 && printf '%s' "$APPLE_API_KEY" > "$key_path")
436
+ export APPLE_API_KEY="$key_path"
437
+ fi
438
+ # Older release refs lack deferred notarization and still wait here.
439
+ cli_help="$(node scripts/build-cli-archive.ts --help)"
440
+ if [[ "$cli_help" == *--notary-submission-file* ]]; then
441
+ extra_args=(--notary-submission-file "$RUNNER_TEMP/t3-cli-notary-submission")
442
+ echo "deferred_notarization=true" >> "$GITHUB_OUTPUT"
443
+ fi
444
fi
445
node scripts/build-cli-archive.ts \
446
--platform "${{ inputs.platform }}" \
447
--arch "${{ inputs.arch }}" \
448
--version "${{ inputs.version }}" \
449
--resource-monitor-dir "$RUNNER_TEMP/cli-resource-monitor" \
438
- --output-dir release-cli
450
+ --output-dir release-cli \
451
+ ${extra_args[@]+"${extra_args[@]}"}
452
453
- name: Smoke-test CLI archive
454
if: inputs.cli_archive && inputs.verify_runner == ''
455
shell: bash
456
run: node scripts/smoke-cli-archive.ts --archive release-cli/* --expect-version "${{ inputs.version }}"
457
458
+ # macOS uploads its archive after "Await CLI notarization" instead.
459
- name: Upload CLI archive
446
- if: inputs.cli_archive
460
+ if: inputs.cli_archive && inputs.platform != 'mac'
461
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
462
with:
463
name: cli-${{ inputs.platform }}-${{ inputs.arch }}
@@ -620,6 +634,39 @@ jobs:
634
635
vp run dist:desktop:artifact "${args[@]}"
636
637
+ # The CLI was submitted without waiting so Apple reviews it while the
638
+ # desktop builds. Notarization does not change the archive bytes, but
639
+ # nothing uploads them, so nothing publishes them, until Apple accepts.
640
+ # With signing configured, a missing submission id fails this step.
641
+ - name: Await CLI notarization
642
+ if: inputs.cli_archive && inputs.platform == 'mac' && steps.build_cli.outputs.deferred_notarization == 'true'
643
+ shell: bash
644
+ env:
645
+ APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
646
+ APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
647
+ APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
648
+ run: |
649
+ set -euo pipefail
650
+ if [[ -n "${APPLE_API_KEY:-}" ]]; then
651
+ key_dir="$(mktemp -d "$RUNNER_TEMP/t3-cli-notary.XXXXXXXX")"
652
+ trap 'rm -rf "$key_dir"' EXIT
653
+ key_path="$key_dir/AuthKey.p8"
654
+ (umask 077 && printf '%s' "$APPLE_API_KEY" > "$key_path")
655
+ export APPLE_API_KEY="$key_path"
656
+ fi
657
+ node scripts/build-cli-archive.ts await-notarization \
658
+ --submission-file "$RUNNER_TEMP/t3-cli-notary-submission"
659
+
660
+ - name: Upload notarized CLI archive
661
+ if: inputs.cli_archive && inputs.platform == 'mac'
662
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
663
+ with:
664
+ name: cli-${{ inputs.platform }}-${{ inputs.arch }}
665
+ path: release-cli/*
666
+ if-no-files-found: error
667
+ # The archive is already gzip or zip; deflating it again saves under 2%.
668
+ compression-level: 0
669
+
670
# Warm installs only touch the store index, so new content means a fetch.
671
- name: Check staged install cache for new content
672
id: stage_pnpm_changed
scripts/build-cli-archive.test.ts
new
+216
@@ -0,0 +1,216 @@
1
+import * as NodeServices from "@effect/platform-node/NodeServices";
2
+import { assert, it } from "@effect/vitest";
3
+import * as ConfigProvider from "effect/ConfigProvider";
4
+import * as Effect from "effect/Effect";
5
+import * as FileSystem from "effect/FileSystem";
6
+import * as Option from "effect/Option";
7
+import * as Path from "effect/Path";
8
+import * as Sink from "effect/Sink";
9
+import * as Stream from "effect/Stream";
10
+import { ChildProcess, ChildProcessSpawner } from "effect/process";
11
+
12
+import { awaitCliNotarization, signMacArchiveContents } from "./build-cli-archive.ts";
13
+
14
+const signedEnv = {
15
+ T3CODE_CLI_MAC_SIGN_IDENTITY: "Developer ID Application: Test (TEAM)",
16
+ APPLE_API_KEY: "/tmp/AuthKey_TEST.p8",
17
+ APPLE_API_KEY_ID: "TEST",
18
+ APPLE_API_ISSUER: "issuer",
19
+};
20
+
21
+type NotaryReply = { readonly exitCode: number; readonly stdout?: string };
22
+
23
+/** Stands in for `xcrun notarytool`, codesign and ditto; records each invocation. */
24
+function stubSpawner(notary: (subcommand: string) => NotaryReply) {
25
+ const calls: Array<ReadonlyArray<string>> = [];
26
+ const spawner = ChildProcessSpawner.make((command) => {
27
+ const argv = ChildProcess.isStandardCommand(command)
28
+ ? [command.command, ...command.args.map(String)]
29
+ : [];
30
+ calls.push(argv);
31
+ const reply = argv[1] === "notarytool" ? notary(argv[2] ?? "") : { exitCode: 0 };
32
+ return Effect.succeed(
33
+ ChildProcessSpawner.makeHandle({
34
+ pid: ChildProcessSpawner.ProcessId(1),
35
+ exitCode: Effect.succeed(ChildProcessSpawner.ExitCode(reply.exitCode)),
36
+ isRunning: Effect.succeed(false),
37
+ kill: () => Effect.void,
38
+ unref: Effect.succeed(Effect.void),
39
+ stdin: Sink.drain,
40
+ stdout: reply.stdout ? Stream.make(new TextEncoder().encode(reply.stdout)) : Stream.empty,
41
+ stderr: Stream.empty,
42
+ all: Stream.empty,
43
+ getInputFd: () => Sink.drain,
44
+ getOutputFd: () => Stream.empty,
45
+ }),
46
+ );
47
+ });
48
+ return { calls, spawner };
49
+}
50
+
51
+const withStubs = <A, E, R>(
52
+ effect: Effect.Effect<A, E, R>,
53
+ stub: ReturnType<typeof stubSpawner>,
54
+ env: Record<string, string> = signedEnv,
55
+) =>
56
+ effect.pipe(
57
+ Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, stub.spawner),
58
+ Effect.provide(ConfigProvider.layer(ConfigProvider.fromEnv({ env }))),
59
+ );
60
+
61
+const makeContent = Effect.fn("test.makeContent")(function* () {
62
+ const fs = yield* FileSystem.FileSystem;
63
+ const path = yield* Path.Path;
64
+ const root = yield* fs.makeTempDirectoryScoped({ prefix: "t3-cli-notary-" });
65
+ const contentDir = path.join(root, "content");
66
+ yield* fs.makeDirectory(contentDir);
67
+ const executablePath = path.join(contentDir, "t3");
68
+ yield* fs.writeFileString(executablePath, "t3");
69
+ return { root, contentDir, executablePath, submissionFile: path.join(root, "submission") };
70
+});
71
+
72
+const notarySubcommands = (calls: ReadonlyArray<ReadonlyArray<string>>) =>
73
+ calls.filter((argv) => argv[1] === "notarytool").map((argv) => argv.slice(2));
74
+
75
+it.layer(NodeServices.layer)("build-cli-archive notarization", (it) => {
76
+ it.effect("records a deferred submission without waiting, then gates on Accepted", () =>
77
+ Effect.gen(function* () {
78
+ const fs = yield* FileSystem.FileSystem;
79
+ // Apple documents id and path for an unwaited submit; a pending status must not fail it.
80
+ for (const submitted of [
81
+ '{"id":"new-id","message":"Successfully uploaded file","path":"t3.zip"}',
82
+ '{"id":"new-id","status":"In Progress"}',
83
+ ]) {
84
+ const content = yield* makeContent();
85
+ yield* fs.writeFileString(content.submissionFile, "stale-id");
86
+ const stub = stubSpawner((subcommand) =>
87
+ subcommand === "submit"
88
+ ? { exitCode: 0, stdout: submitted }
89
+ : { exitCode: 0, stdout: '{"id":"new-id","status":"Accepted"}' },
90
+ );
91
+
92
+ yield* withStubs(
93
+ signMacArchiveContents({
94
+ repoRoot: content.root,
95
+ contentDir: content.contentDir,
96
+ executablePath: content.executablePath,
97
+ notarySubmissionFile: Option.some(content.submissionFile),
98
+ }),
99
+ stub,
100
+ );
101
+ assert.equal(yield* fs.readFileString(content.submissionFile), "new-id");
102
+ const [submit] = notarySubcommands(stub.calls);
103
+ assert.equal(submit?.[0], "submit");
104
+ assert.isFalse(submit?.includes("--wait"));
105
+
106
+ yield* withStubs(awaitCliNotarization(content.submissionFile), stub);
107
+ assert.deepEqual(notarySubcommands(stub.calls)[1]?.slice(0, 2), ["wait", "new-id"]);
108
+ }
109
+ }).pipe(Effect.scoped),
110
+ );
111
+
112
+ it.effect("fails the gate unless Apple accepted the submission", () =>
113
+ Effect.gen(function* () {
114
+ const fs = yield* FileSystem.FileSystem;
115
+ const cases: ReadonlyArray<{
116
+ readonly name: string;
117
+ readonly wait: NotaryReply;
118
+ readonly submitted?: boolean;
119
+ readonly env?: Record<string, string>;
120
+ readonly error: string | undefined;
121
+ readonly fetchesLog?: boolean;
122
+ }> = [
123
+ {
124
+ name: "invalid",
125
+ wait: { exitCode: 0, stdout: '{"id":"sub","status":"Invalid"}' },
126
+ error: "CliArchiveNotarizationRejectedError",
127
+ fetchesLog: true,
128
+ },
129
+ {
130
+ name: "rejected with a non-zero exit",
131
+ wait: { exitCode: 1, stdout: '{"id":"sub","status":"Rejected"}' },
132
+ error: "CliArchiveNotarizationRejectedError",
133
+ fetchesLog: true,
134
+ },
135
+ {
136
+ name: "still in progress",
137
+ wait: { exitCode: 0, stdout: '{"id":"sub","status":"In Progress"}' },
138
+ error: "CliArchiveNotarizationRejectedError",
139
+ },
140
+ {
141
+ name: "still in progress with a non-zero exit",
142
+ wait: { exitCode: 1, stdout: '{"id":"sub","status":"In Progress"}' },
143
+ error: "CliArchiveCommandFailedError",
144
+ },
145
+ {
146
+ name: "notarytool failed",
147
+ wait: { exitCode: 69 },
148
+ error: "CliArchiveCommandFailedError",
149
+ },
150
+ {
151
+ name: "no status",
152
+ wait: { exitCode: 0, stdout: '{"id":"sub"}' },
153
+ error: "CliArchiveNotarizationRejectedError",
154
+ },
155
+ {
156
+ name: "accepted with a non-zero exit",
157
+ wait: { exitCode: 1, stdout: '{"id":"sub","status":"Accepted"}' },
158
+ error: "CliArchiveCommandFailedError",
159
+ },
160
+ {
161
+ name: "submission missing",
162
+ wait: { exitCode: 0, stdout: '{"id":"sub","status":"Accepted"}' },
163
+ submitted: false,
164
+ error: "CliArchiveInputMissingError",
165
+ },
166
+ {
167
+ name: "submission without credentials",
168
+ wait: { exitCode: 0, stdout: '{"id":"sub","status":"Accepted"}' },
169
+ env: { T3CODE_CLI_MAC_SIGN_IDENTITY: signedEnv.T3CODE_CLI_MAC_SIGN_IDENTITY },
170
+ error: "CliArchiveInputMissingError",
171
+ },
172
+ {
173
+ name: "notarization not configured",
174
+ wait: { exitCode: 0 },
175
+ submitted: false,
176
+ env: {},
177
+ error: undefined,
178
+ },
179
+ ];
180
+ for (const testCase of cases) {
181
+ const content = yield* makeContent();
182
+ if (testCase.submitted !== false) yield* fs.writeFileString(content.submissionFile, "sub");
183
+ const stub = stubSpawner(() => testCase.wait);
184
+ const exit = yield* withStubs(
185
+ awaitCliNotarization(content.submissionFile),
186
+ stub,
187
+ testCase.env,
188
+ ).pipe(Effect.flip, Effect.option);
189
+ assert.equal(Option.getOrUndefined(exit)?._tag, testCase.error, testCase.name);
190
+ assert.equal(
191
+ notarySubcommands(stub.calls).some((argv) => argv[0] === "log"),
192
+ testCase.fetchesLog ?? false,
193
+ testCase.name,
194
+ );
195
+ }
196
+ }).pipe(Effect.scoped),
197
+ );
198
+
199
+ it.effect("fails a standalone build whose waited submission is not Accepted", () =>
200
+ Effect.gen(function* () {
201
+ const content = yield* makeContent();
202
+ const stub = stubSpawner(() => ({ exitCode: 0, stdout: '{"id":"sub","status":"Invalid"}' }));
203
+ const error = yield* withStubs(
204
+ signMacArchiveContents({
205
+ repoRoot: content.root,
206
+ contentDir: content.contentDir,
207
+ executablePath: content.executablePath,
208
+ notarySubmissionFile: Option.none(),
209
+ }),
210
+ stub,
211
+ ).pipe(Effect.flip);
212
+ assert.equal(error._tag, "CliArchiveNotarizationRejectedError");
213
+ assert.isTrue(notarySubcommands(stub.calls)[0]?.includes("--wait"));
214
+ }).pipe(Effect.scoped),
215
+ );
216
+});
scripts/build-cli-archive.ts
+154
-25
@@ -11,6 +11,7 @@ import * as Option from "effect/Option";
11
import * as Path from "effect/Path";
12
import * as PlatformError from "effect/PlatformError";
13
import * as Schema from "effect/Schema";
14
+import * as Stream from "effect/Stream";
15
import { Command, Flag } from "effect/cli";
16
import { ChildProcess, ChildProcessSpawner } from "effect/process";
17
@@ -330,16 +331,99 @@ const MacSigningConfig = Config.all({
331
appleApiIssuer: Config.String("APPLE_API_ISSUER").pipe(Config.option),
332
});
333
334
+export class CliArchiveNotarizationRejectedError extends Schema.TaggedError<CliArchiveNotarizationRejectedError>()(
335
+ "CliArchiveNotarizationRejectedError",
336
+ { submissionId: Schema.String, status: Schema.String },
337
+) {
338
+ override get message(): string {
339
+ return `Apple notarization ${this.submissionId} is ${this.status}, not Accepted.`;
340
+ }
341
+}
342
+
343
+const NotarySubmission = Schema.Struct({
344
+ id: Schema.NonEmptyString,
345
+ status: Schema.optional(Schema.String),
346
+});
347
+// Final failures from Apple's Notary API. "In Progress" is pending and has no log yet.
348
+const rejectedNotaryStatuses: ReadonlySet<string> = new Set(["Invalid", "Rejected"]);
349
+const decodeNotarySubmission = Schema.decodeEffect(Schema.fromJsonString(NotarySubmission));
350
+
351
+/** Notarization runs only for a Developer ID identity with all three App Store Connect key values. */
352
+const resolveNotaryCredentials = Effect.fn("resolveNotaryCredentials")(function* () {
353
+ const signing = yield* MacSigningConfig;
354
+ const identity = Option.getOrUndefined(signing.identity)?.trim() || "-";
355
+ const key = Option.getOrUndefined(signing.appleApiKey);
356
+ const keyId = Option.getOrUndefined(signing.appleApiKeyId);
357
+ const issuer = Option.getOrUndefined(signing.appleApiIssuer);
358
+ const credentials =
359
+ identity !== "-" && key && keyId && issuer
360
+ ? Option.some(["--key", key, "--key-id", keyId, "--issuer", issuer])
361
+ : Option.none<ReadonlyArray<string>>();
362
+ return { identity, credentials };
363
+});
364
+
365
+const notarytool = Effect.fn("notarytool")(function* (
366
+ args: ReadonlyArray<string>,
367
+ credentials: ReadonlyArray<string>,
368
+) {
369
+ const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
370
+ const child = yield* spawner.spawn(
371
+ ChildProcess.make("xcrun", ["notarytool", ...args, ...credentials, "--output-format", "json"], {
372
+ stdout: "pipe",
373
+ stderr: "inherit",
374
+ }),
375
+ );
376
+ const [stdout, exitCode] = yield* Effect.all(
377
+ [Stream.mkString(Stream.decodeText(child.stdout)), child.exitCode],
378
+ { concurrency: "unbounded" },
379
+ );
380
+ const submission = yield* decodeNotarySubmission(stdout).pipe(Effect.option);
381
+ const status = Option.getOrUndefined(submission)?.status;
382
+ // A finished submission reports its status even when notarytool exits non-zero for it.
383
+ if (Option.isSome(submission) && status !== undefined && rejectedNotaryStatuses.has(status)) {
384
+ yield* runCommand(
385
+ ChildProcess.make("xcrun", ["notarytool", "log", submission.value.id, ...credentials]),
386
+ "notarytool log",
387
+ ).pipe(Effect.ignore);
388
+ return yield* new CliArchiveNotarizationRejectedError({
389
+ submissionId: submission.value.id,
390
+ status,
391
+ });
392
+ }
393
+ if (Number(exitCode) !== 0 || Option.isNone(submission)) {
394
+ return yield* new CliArchiveCommandFailedError({
395
+ command: `notarytool ${args[0]}`,
396
+ exitCode: Number(exitCode),
397
+ });
398
+ }
399
+ return submission.value;
400
+}, Effect.scoped);
401
+
402
+const requireAccepted = Effect.fn("requireAccepted")(function* (
403
+ submission: typeof NotarySubmission.Type,
404
+) {
405
+ if (submission.status !== "Accepted") {
406
+ return yield* new CliArchiveNotarizationRejectedError({
407
+ submissionId: submission.id,
408
+ status: submission.status ?? "without a status",
409
+ });
410
+ }
411
+ yield* Effect.log(`[cli-archive] Notarized t3 (${submission.id}).`);
412
+});
413
+
414
/** Apple Silicon requires signed binaries; notarization's hardened runtime also requires every native addon signed. */
334
-const signMacArchiveContents = Effect.fn("signMacArchiveContents")(function* (input: {
415
+export const signMacArchiveContents = Effect.fn("signMacArchiveContents")(function* (input: {
416
readonly repoRoot: string;
417
readonly contentDir: string;
418
readonly executablePath: string;
419
+ readonly notarySubmissionFile: Option.Option<string>;
420
}) {
421
const fs = yield* FileSystem.FileSystem;
422
const path = yield* Path.Path;
341
- const signing = yield* MacSigningConfig;
342
- const identity = Option.getOrUndefined(signing.identity)?.trim() || "-";
423
+ const { identity, credentials } = yield* resolveNotaryCredentials();
424
+ const deferred = Option.getOrUndefined(input.notarySubmissionFile);
425
+ // A stale id would let await-notarization approve bytes from an earlier build.
426
+ if (deferred !== undefined) yield* fs.remove(deferred, { force: true });
427
428
const entitlements = path.join(input.repoRoot, "apps/server/resources/cli-entitlements.plist");
429
const libraries = (yield* fs.readDirectory(input.contentDir, { recursive: true }))
@@ -369,11 +453,7 @@ const signMacArchiveContents = Effect.fn("signMacArchiveContents")(function* (in
453
yield* Effect.log("[cli-archive] Signed ad hoc (no T3CODE_CLI_MAC_SIGN_IDENTITY).");
454
return;
455
}
372
-
373
- const apiKey = Option.getOrUndefined(signing.appleApiKey);
374
- const apiKeyId = Option.getOrUndefined(signing.appleApiKeyId);
375
- const apiIssuer = Option.getOrUndefined(signing.appleApiIssuer);
376
- if (!apiKey || !apiKeyId || !apiIssuer) {
456
+ if (Option.isNone(credentials)) {
457
yield* Effect.logWarning(
458
"[cli-archive] Developer ID signed but not notarized (missing APPLE_API_KEY*).",
459
);
@@ -385,22 +465,46 @@ const signMacArchiveContents = Effect.fn("signMacArchiveContents")(function* (in
465
ChildProcess.make("ditto", ["-c", "-k", "--keepParent", input.executablePath, notarizeZip]),
466
"ditto (notarization zip)",
467
);
388
- yield* runCommand(
389
- ChildProcess.make("xcrun", [
390
- "notarytool",
391
- "submit",
392
- notarizeZip,
393
- "--key",
394
- apiKey,
395
- "--key-id",
396
- apiKeyId,
397
- "--issuer",
398
- apiIssuer,
399
- "--wait",
400
- ]),
401
- "notarytool submit",
468
+ const submission = yield* notarytool(
469
+ ["submit", notarizeZip, ...(deferred === undefined ? ["--wait"] : [])],
470
+ credentials.value,
471
).pipe(Effect.ensuring(fs.remove(notarizeZip, { force: true }).pipe(Effect.ignore)));
403
- yield* Effect.log("[cli-archive] Notarized t3.");
472
+ if (deferred === undefined) {
473
+ yield* requireAccepted(submission);
474
+ return;
475
+ }
476
+ // The ticket lives with Apple, not in the archive, so the archive bytes are final before approval.
477
+ yield* fs.writeFileString(deferred, submission.id);
478
+ yield* Effect.log(
479
+ `[cli-archive] Submitted t3 for notarization (${submission.id}). Run await-notarization before publishing.`,
480
+ );
481
+});
482
+
483
+/** Publication gate for a deferred submission: fails unless Apple accepted it. */
484
+export const awaitCliNotarization = Effect.fn("awaitCliNotarization")(function* (
485
+ submissionFile: string,
486
+) {
487
+ const fs = yield* FileSystem.FileSystem;
488
+ const { credentials } = yield* resolveNotaryCredentials();
489
+ const submitted = yield* fs.exists(submissionFile);
490
+ if (Option.isNone(credentials)) {
491
+ if (submitted) {
492
+ return yield* new CliArchiveInputMissingError({
493
+ inputPath: "T3CODE_CLI_MAC_SIGN_IDENTITY and APPLE_API_KEY*",
494
+ hint: `${submissionFile} names a submission, but its credentials are not set.`,
495
+ });
496
+ }
497
+ yield* Effect.log("[cli-archive] No notarization to await (signing or APPLE_API_KEY* unset).");
498
+ return;
499
+ }
500
+ if (!submitted) {
501
+ return yield* new CliArchiveInputMissingError({
502
+ inputPath: submissionFile,
503
+ hint: "Notarization is configured, but build-cli-archive recorded no submission.",
504
+ });
505
+ }
506
+ const id = (yield* fs.readFileString(submissionFile)).trim();
507
+ yield* requireAccepted(yield* notarytool(["wait", id], credentials.value));
508
});
509
510
const WindowsSigningConfig = Config.all({
@@ -486,6 +590,7 @@ const buildCliArchive = Effect.fn("buildCliArchive")(function* (input: {
590
readonly version: string;
591
readonly outputDir: string;
592
readonly resourceMonitorDir: Option.Option<string>;
593
+ readonly notarySubmissionFile: Option.Option<string>;
594
}) {
595
const fs = yield* FileSystem.FileSystem;
596
const path = yield* Path.Path;
@@ -552,7 +657,12 @@ const buildCliArchive = Effect.fn("buildCliArchive")(function* (input: {
657
});
658
}
659
if (input.platform === "mac") {
555
- yield* signMacArchiveContents({ repoRoot, contentDir, executablePath });
660
+ yield* signMacArchiveContents({
661
+ repoRoot,
662
+ contentDir,
663
+ executablePath,
664
+ notarySubmissionFile: input.notarySubmissionFile,
665
+ });
666
} else if (input.platform === "win") {
667
yield* signWindowsExecutable(executablePath);
668
}
@@ -615,9 +725,28 @@ const command = Command.make(
725
),
726
Flag.optional,
727
),
728
+ notarySubmissionFile: Flag.String("notary-submission-file").pipe(
729
+ Flag.withDescription(
730
+ "macOS: submit for notarization without waiting and write the submission id here. Publish only after await-notarization succeeds.",
731
+ ),
732
+ Flag.optional,
733
+ ),
734
},
735
(input) => buildCliArchive(input).pipe(Effect.scoped),
620
-).pipe(Command.withDescription("Package the t3 single-executable into a per-platform archive."));
736
+).pipe(
737
+ Command.withDescription("Package the t3 single-executable into a per-platform archive."),
738
+ Command.withSubcommands([
739
+ Command.make(
740
+ "await-notarization",
741
+ { submissionFile: Flag.String("submission-file") },
742
+ (input) => awaitCliNotarization(input.submissionFile),
743
+ ).pipe(
744
+ Command.withDescription(
745
+ "Wait for a --notary-submission-file submission; fail unless Accepted.",
746
+ ),
747
+ ),
748
+ ]),
749
+);
750
751
if (import.meta.main) {
752
Command.run(command, { version: "0.0.0" }).pipe(