66
new URL('../.github/scripts/cli-release/verify-assets.sh', import.meta.url),
67
'utf8'
68
);
69
+const generateChecksumsScriptUrl = new URL(
70
+ '../ts/packages/cli/scripts/generate-checksums.ts',
71
+ import.meta.url
72
+);
73
+const generateChecksumsScriptPath = generateChecksumsScriptUrl.pathname;
74
+const generateChecksumsScript = readFileSync(generateChecksumsScriptUrl, 'utf8');
75
76
function requireMatch(text, pattern, label) {
77
const match = text.match(pattern);
533
);
534
}
535
536
+if (
537
+ !generateChecksumsScript.includes("from './_teardown'") ||
538
+ generateChecksumsScript.includes("from './_shared'")
539
+) {
540
+ throw new Error(
541
+ 'CLI checksum generation must use the dependency-light teardown without loading CLI runtime helpers'
542
+ );
543
+}
544
+
545
+// The release job runs checksum generation in a fresh checkout where workspace packages have not
546
+// been built. Exercise the script from an unrelated working directory to prevent imports from
547
+// pulling in the CLI runtime and its unbuilt @composio/core dependency.
548
+{
549
+ const fixtureDir = mkdtempSync(join(tmpdir(), 'composio-cli-checksums-'));
550
+ try {
551
+ const binariesDir = join(fixtureDir, 'dist/binaries');
552
+ mkdirSync(binariesDir, { recursive: true });
553
+ writeFileSync(join(binariesDir, 'composio-linux-x64.zip'), 'release archive fixture\n');
554
+
555
+ const result = spawnSync(process.execPath, [generateChecksumsScriptPath], {
556
+ cwd: fixtureDir,
557
+ encoding: 'utf8',
558
+ env: process.env,
559
+ });
560
+
561
+ if (result.status !== 0) {
562
+ throw new Error(
563
+ `CLI checksum generation must run without built workspace packages\nstdout:\n${result.stdout}\nstderr:\n${result.stderr}`
564
+ );
565
+ }
566
+
567
+ const checksums = readFileSync(join(binariesDir, 'checksums.txt'), 'utf8');
568
+ if (!/^[a-f0-9]{64} composio-linux-x64\.zip\n$/.test(checksums)) {
569
+ throw new Error(`CLI checksum generation wrote an invalid manifest:\n${checksums}`);
570
+ }
571
+ } finally {
572
+ rmSync(fixtureDir, { recursive: true, force: true });
573
+ }
574
+}
575
+
576
// Per-tag concurrency prevents two runs clobbering the same release without serializing betas.
577
if (!buildCliWorkflow.includes('group: cli-release-${{ needs.prepare.outputs.release_tag }}')) {
578
throw new Error(