MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / run

Function run

packages/cli/src/commands/cloud/delete.ts:43–85  ·  view source on GitHub ↗
({ args })

Source from the content-addressed store, hash-verified

41 },
42 // fallow-ignore-next-line complexity
43 async run({ args }) {
44 if (args.confirm) {
45 // Don't auto-bypass the prompt just because stdin isn't a TTY
46 // or `--json` was passed — both used to silently skip the
47 // safety check. Force the caller to opt in via `--no-confirm`
48 // so cron jobs, CI shells, and JSON consumers can't soft-delete
49 // by accident.
50 if (args.json || !process.stdin.isTTY) {
51 errorBox(
52 "Confirmation required",
53 "delete cannot prompt for confirmation here — stdin isn't a TTY or --json was passed.",
54 "Re-run with --no-confirm to acknowledge the irreversible delete.",
55 );
56 process.exit(1);
57 }
58 const ok = await confirmDelete(args.id);
59 if (!ok) {
60 // Distinct exit code so wrapper scripts can tell an explicit
61 // decline apart from an API/system error.
62 console.log(c.dim("Aborted."));
63 process.exit(2);
64 }
65 }
66 const client = await createCloudClient();
67 try {
68 const response = await client.deleteRender({ render_id: args.id });
69 if (args.json) {
70 console.log(
71 JSON.stringify(
72 withMeta({ render: { render_id: response.render_id }, deleted: true }),
73 null,
74 2,
75 ),
76 );
77 return;
78 }
79 console.log(`${c.success("✓")} Deleted ${c.accent(response.render_id)}`);
80 } catch (err) {
81 reportApiError("Could not delete render", err, {
82 notFound: `No render found with id "${args.id}".`,
83 });
84 }
85 },
86});
87
88async function confirmDelete(id: string): Promise<boolean> {

Callers

nothing calls this directly

Calls 6

errorBoxFunction · 0.85
confirmDeleteFunction · 0.85
createCloudClientFunction · 0.85
withMetaFunction · 0.85
reportApiErrorFunction · 0.85
deleteRenderMethod · 0.80

Tested by

no test coverage detected