@dropthis/cli 0.2.0 → 0.2.1

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/cli.cjs CHANGED
@@ -226,7 +226,11 @@ function writeEmpty(deps, message, json) {
226
226
 
227
227
  // src/commands/account.ts
228
228
  async function runAccountGet(_input, deps) {
229
- if (await resolveCredential({ env: deps.env, store: deps.store }) === null) {
229
+ if (await resolveCredential({
230
+ ...deps.apiKey ? { apiKey: deps.apiKey } : {},
231
+ env: deps.env,
232
+ store: deps.store
233
+ }) === null) {
230
234
  return writeAuthError(deps);
231
235
  }
232
236
  const result = await deps.client.account.get();
@@ -243,6 +247,7 @@ async function runAccountGet(_input, deps) {
243
247
  }
244
248
 
245
249
  // src/commands/api-keys.ts
250
+ var prompts = __toESM(require("@clack/prompts"), 1);
246
251
  async function runApiKeysCreate(input, deps) {
247
252
  if (!await hasCredential(deps)) return writeAuthError(deps);
248
253
  const result = await deps.client.apiKeys.create({ label: input.label });
@@ -285,6 +290,14 @@ async function runApiKeysDelete(keyId, input, deps) {
285
290
  "Pass --yes to delete in non-interactive mode."
286
291
  );
287
292
  }
293
+ if (!input.yes && input.interactive !== false) {
294
+ const confirmed = await prompts.confirm({
295
+ message: `Delete API key ${keyId}?`
296
+ });
297
+ if (prompts.isCancel(confirmed) || !confirmed) {
298
+ return { exitCode: 0 };
299
+ }
300
+ }
288
301
  if (!await hasCredential(deps)) return writeAuthError(deps);
289
302
  const result = await deps.client.apiKeys.delete(keyId);
290
303
  if (result?.error) return writeApiErrorSimple(deps, result.error.message);
@@ -296,7 +309,11 @@ async function runApiKeysDelete(keyId, input, deps) {
296
309
  return { exitCode: 0 };
297
310
  }
298
311
  async function hasCredential(deps) {
299
- return await resolveCredential({ env: deps.env, store: deps.store }) !== null;
312
+ return await resolveCredential({
313
+ ...deps.apiKey ? { apiKey: deps.apiKey } : {},
314
+ env: deps.env,
315
+ store: deps.store
316
+ }) !== null;
300
317
  }
301
318
  function listItems(data) {
302
319
  if (data && typeof data === "object" && "data" in data) {
@@ -472,19 +489,22 @@ async function runDoctor(_input, deps) {
472
489
  const authSource = credential?.source ?? "missing";
473
490
  const storageBackend = stored?.storage ?? "none";
474
491
  const pairs = [
475
- ["Version", "0.1.0"],
492
+ ["Version", "0.2.1"],
476
493
  ["Auth", authSource],
477
494
  ["Storage", storageBackend]
478
495
  ];
479
496
  writeKv(deps, pairs, {
480
497
  ok: true,
481
- version: "0.1.0",
498
+ version: "0.2.1",
482
499
  auth: { source: authSource },
483
500
  storage: { backend: storageBackend }
484
501
  });
485
502
  return { exitCode: 0 };
486
503
  }
487
504
 
505
+ // src/commands/drops.ts
506
+ var prompts2 = __toESM(require("@clack/prompts"), 1);
507
+
488
508
  // src/options.ts
489
509
  var import_promises = require("fs/promises");
490
510
  async function parseDropOptions(raw) {
@@ -595,6 +615,14 @@ async function runDropsDelete(dropId, input, deps) {
595
615
  "Pass --yes to delete in non-interactive mode."
596
616
  );
597
617
  }
618
+ if (!input.yes && input.interactive !== false) {
619
+ const confirmed = await prompts2.confirm({
620
+ message: `Delete ${dropId}?`
621
+ });
622
+ if (prompts2.isCancel(confirmed) || !confirmed) {
623
+ return { exitCode: 0 };
624
+ }
625
+ }
598
626
  if (!await hasCredential3(deps)) return writeAuthError(deps);
599
627
  const result = await deps.client.drops.delete(dropId);
600
628
  if (result?.error) return writeApiErrorSimple(deps, result.error.message);
@@ -606,7 +634,11 @@ async function runDropsDelete(dropId, input, deps) {
606
634
  return { exitCode: 0 };
607
635
  }
608
636
  async function hasCredential3(deps) {
609
- return await resolveCredential({ env: deps.env, store: deps.store }) !== null;
637
+ return await resolveCredential({
638
+ ...deps.apiKey ? { apiKey: deps.apiKey } : {},
639
+ env: deps.env,
640
+ store: deps.store
641
+ }) !== null;
610
642
  }
611
643
  function listItems2(data) {
612
644
  if (data && typeof data === "object" && "data" in data) {
@@ -619,38 +651,38 @@ function listItems2(data) {
619
651
  }
620
652
 
621
653
  // src/commands/login.ts
622
- var prompts = __toESM(require("@clack/prompts"), 1);
654
+ var prompts3 = __toESM(require("@clack/prompts"), 1);
623
655
  async function runLoginInteractive(deps) {
624
- prompts.intro("dropthis login");
625
- const email = await prompts.text({
656
+ prompts3.intro("dropthis login");
657
+ const email = await prompts3.text({
626
658
  message: "Email address",
627
659
  validate: (v) => v?.includes("@") ? void 0 : "Enter a valid email"
628
660
  });
629
- if (prompts.isCancel(email)) {
630
- prompts.cancel("Login cancelled.");
661
+ if (prompts3.isCancel(email)) {
662
+ prompts3.cancel("Login cancelled.");
631
663
  return { exitCode: 0 };
632
664
  }
633
665
  const requestResult = await deps.client.auth.requestEmailOtp({ email });
634
666
  if (requestResult.error) {
635
- prompts.cancel(requestResult.error.message);
667
+ prompts3.cancel(requestResult.error.message);
636
668
  return { exitCode: exitCodeFor("api_error") };
637
669
  }
638
- const otp = await prompts.text({
670
+ const otp = await prompts3.text({
639
671
  message: "Paste the code from your email"
640
672
  });
641
- if (prompts.isCancel(otp)) {
642
- prompts.cancel("Login cancelled.");
673
+ if (prompts3.isCancel(otp)) {
674
+ prompts3.cancel("Login cancelled.");
643
675
  return { exitCode: 0 };
644
676
  }
645
677
  const session = await deps.client.auth.verifyEmailOtp({ email, code: otp });
646
678
  if (session.error) {
647
- prompts.cancel(session.error.message);
679
+ prompts3.cancel(session.error.message);
648
680
  return { exitCode: exitCodeFor("api_error") };
649
681
  }
650
682
  const authedClient = deps.createClient(session.data.token);
651
683
  const apiKey = await authedClient.apiKeys.create({ label: "CLI" });
652
684
  if (apiKey.error) {
653
- prompts.cancel(apiKey.error.message);
685
+ prompts3.cancel(apiKey.error.message);
654
686
  return { exitCode: exitCodeFor("api_error") };
655
687
  }
656
688
  await deps.store.save({
@@ -661,7 +693,7 @@ async function runLoginInteractive(deps) {
661
693
  email,
662
694
  storage: "secure"
663
695
  });
664
- prompts.outro("Logged in successfully.");
696
+ prompts3.outro("Logged in successfully.");
665
697
  return { exitCode: 0 };
666
698
  }
667
699
  async function runLoginRequest(input, deps) {
@@ -697,7 +729,8 @@ async function runLoginVerify(input, deps) {
697
729
  );
698
730
  return { exitCode: exitCodeFor("api_error") };
699
731
  }
700
- const apiKey = await deps.client.apiKeys.create({ label: "CLI" });
732
+ const authedClient = deps.createClient(session.data.token);
733
+ const apiKey = await authedClient.apiKeys.create({ label: "CLI" });
701
734
  if (apiKey.error) {
702
735
  deps.stderr(
703
736
  `${JSON.stringify(errorEnvelope("api_error", apiKey.error.message))}
@@ -734,10 +767,10 @@ async function runLogout(input, deps) {
734
767
  const result = await deps.client.apiKeys.delete(stored.keyId);
735
768
  if (result?.error) revokeError = result.error.message;
736
769
  }
737
- await deps.store.clear();
738
770
  if (revokeError) {
739
771
  return writeApiErrorSimple(deps, revokeError);
740
772
  }
773
+ await deps.store.clear();
741
774
  writeHumanOrJson(deps, success("Logged out."), { ok: true });
742
775
  return { exitCode: 0 };
743
776
  }
@@ -793,7 +826,7 @@ async function readJsonObjectFile(path) {
793
826
  var MAX_BUNDLE_FILE_COUNT = 200;
794
827
  async function runPublish(input, raw, deps) {
795
828
  const credential = await resolveCredential({
796
- ...raw.apiKey ? { apiKey: raw.apiKey } : {},
829
+ ...raw.apiKey ?? deps.apiKey ? { apiKey: raw.apiKey ?? deps.apiKey } : {},
797
830
  env: deps.env,
798
831
  store: deps.store
799
832
  });
@@ -1002,7 +1035,7 @@ function withPublishIdempotency(options) {
1002
1035
  var import_node_crypto2 = require("crypto");
1003
1036
  async function runUpdate(target, input, raw, deps) {
1004
1037
  const credential = await resolveCredential({
1005
- ...raw.apiKey ? { apiKey: raw.apiKey } : {},
1038
+ ...raw.apiKey ?? deps.apiKey ? { apiKey: raw.apiKey ?? deps.apiKey } : {},
1006
1039
  env: deps.env,
1007
1040
  store: deps.store
1008
1041
  });
@@ -1234,7 +1267,9 @@ var InsecureFileCredentialStore = class {
1234
1267
  }
1235
1268
  async read() {
1236
1269
  const value = await readJsonFile(this.filePath);
1237
- return value ? { ...value, storage: "insecure" } : null;
1270
+ if (!value) return null;
1271
+ if (typeof value.apiKey !== "string" || !value.apiKey) return null;
1272
+ return { ...value, storage: "insecure" };
1238
1273
  }
1239
1274
  async save(credential) {
1240
1275
  await writeCredentialFile(this.filePath, {
@@ -1257,7 +1292,7 @@ var KeyringCredentialStore = class {
1257
1292
  const metadata = await readJsonFile(this.filePath);
1258
1293
  if (!metadata) return null;
1259
1294
  const apiKey = await this.keyring.getPassword();
1260
- if (!apiKey) return null;
1295
+ if (typeof apiKey !== "string" || !apiKey) return null;
1261
1296
  return { ...metadata, apiKey, storage: "secure" };
1262
1297
  }
1263
1298
  async save(credential) {
@@ -1316,7 +1351,7 @@ async function writeCredentialFile(path, credential) {
1316
1351
  function buildProgram(options = {}) {
1317
1352
  const program = new import_commander.Command();
1318
1353
  const store = options.store ?? new MemoryCredentialStore();
1319
- program.name("dropthis").description("Publish anything online and get a URL back.").version("0.2.0");
1354
+ program.name("dropthis").description("Publish anything online and get a URL back.").version("0.2.1");
1320
1355
  program.option("--api-key <key>", "Override API key for this invocation");
1321
1356
  program.option("--api-url <url>", "Override API base URL");
1322
1357
  program.option("--json", "Force JSON output");
@@ -1325,8 +1360,8 @@ function buildProgram(options = {}) {
1325
1360
  async (commandOptions) => {
1326
1361
  if (!commandOptions.email || !commandOptions.otp) {
1327
1362
  const deps2 = await commandDeps(program, options, store, commandOptions);
1328
- const global = globalOptions(program, commandOptions);
1329
- const context = createContext({ global });
1363
+ const global2 = globalOptions(program, commandOptions);
1364
+ const context = createContext({ global: global2 });
1330
1365
  const result2 = await runLoginInteractive({
1331
1366
  ...deps2,
1332
1367
  createClient: (apiKey) => context.createClient(apiKey)
@@ -1335,13 +1370,18 @@ function buildProgram(options = {}) {
1335
1370
  return;
1336
1371
  }
1337
1372
  const deps = await commandDeps(program, options, store, commandOptions);
1373
+ const global = globalOptions(program, commandOptions);
1374
+ const verifyContext = createContext({ global });
1338
1375
  const result = await runLoginVerify(
1339
1376
  {
1340
1377
  email: commandOptions.email,
1341
1378
  otp: commandOptions.otp,
1342
1379
  ...commandOptions.json !== void 0 ? { json: commandOptions.json } : {}
1343
1380
  },
1344
- deps
1381
+ {
1382
+ ...deps,
1383
+ createClient: (apiKey) => verifyContext.createClient(apiKey)
1384
+ }
1345
1385
  );
1346
1386
  process.exitCode = result.exitCode;
1347
1387
  }
@@ -1355,7 +1395,12 @@ function buildProgram(options = {}) {
1355
1395
  login?.command("verify").description("Verify email OTP and store an API key").requiredOption("--email <email>", "Email address").requiredOption("--otp <otp>", "One-time passcode").option("--json", "Force JSON output").action(
1356
1396
  async (commandOptions) => {
1357
1397
  const deps = await commandDeps(program, options, store, commandOptions);
1358
- const result = await runLoginVerify(commandOptions, deps);
1398
+ const global = globalOptions(program, commandOptions);
1399
+ const verifySubContext = createContext({ global });
1400
+ const result = await runLoginVerify(commandOptions, {
1401
+ ...deps,
1402
+ createClient: (apiKey) => verifySubContext.createClient(apiKey)
1403
+ });
1359
1404
  process.exitCode = result.exitCode;
1360
1405
  }
1361
1406
  );
@@ -1577,7 +1622,9 @@ function toDropOptions(options) {
1577
1622
  };
1578
1623
  }
1579
1624
  function parseInteger(value) {
1580
- return Number.parseInt(value, 10);
1625
+ const n = Number.parseInt(value, 10);
1626
+ if (Number.isNaN(n)) throw new import_commander.InvalidArgumentError("Expected an integer.");
1627
+ return n;
1581
1628
  }
1582
1629
  async function resolveCommandInput(input, stdin) {
1583
1630
  if (input !== "-") return input;
@@ -1598,22 +1645,33 @@ async function resolvePublishInputs(inputs, stdin, stdinIsTTY) {
1598
1645
  }
1599
1646
  return inputs[0];
1600
1647
  }
1648
+ const {
1649
+ mkdtemp,
1650
+ copyFile,
1651
+ writeFile: writeFile2,
1652
+ stat: fsStat
1653
+ } = await import("fs/promises");
1654
+ const { join: join2, basename: pathBasename } = await import("path");
1655
+ const { tmpdir } = await import("os");
1656
+ const tmpDir = await mkdtemp(join2(tmpdir(), "dropthis-multi-"));
1601
1657
  const resolved = [];
1602
1658
  for (const input of inputs) {
1603
1659
  if (input === "-") {
1604
1660
  const buf = await readStdinBytes(stdin ?? process.stdin);
1605
- const tmpPath = `/tmp/.dropthis-stdin-${Date.now()}`;
1606
- const { writeFile: writeFile2 } = await import("fs/promises");
1661
+ const tmpPath = join2(tmpDir, `stdin-${Date.now()}`);
1607
1662
  await writeFile2(tmpPath, buf);
1608
1663
  resolved.push(tmpPath);
1609
1664
  } else {
1610
1665
  resolved.push(input);
1611
1666
  }
1612
1667
  }
1613
- const { mkdtemp, copyFile, stat: fsStat } = await import("fs/promises");
1614
- const { join: join2, basename: pathBasename } = await import("path");
1615
- const { tmpdir } = await import("os");
1616
- const tmpDir = await mkdtemp(join2(tmpdir(), "dropthis-multi-"));
1668
+ const names = resolved.map((f) => pathBasename(f));
1669
+ const dupes = names.filter((n, i) => names.indexOf(n) !== i);
1670
+ if (dupes.length > 0) {
1671
+ throw new Error(
1672
+ `Duplicate file names: ${[...new Set(dupes)].join(", ")}. Rename files to avoid collisions.`
1673
+ );
1674
+ }
1617
1675
  for (const filePath of resolved) {
1618
1676
  const info = await fsStat(filePath);
1619
1677
  if (info.isDirectory()) {
package/dist/cli.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/program.ts","../src/auth.ts","../src/output.ts","../src/ui.ts","../src/fmt.ts","../src/commands/account.ts","../src/commands/api-keys.ts","../src/commands/commands.ts","../src/commands/deployments.ts","../src/commands/doctor.ts","../src/options.ts","../src/commands/drops.ts","../src/commands/login.ts","../src/commands/logout.ts","../src/commands/publish.ts","../src/spinner.ts","../src/commands/json_body.ts","../src/commands/update.ts","../src/commands/whoami.ts","../src/context.ts","../src/storage.ts","../src/cli.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { resolveCredential } from \"./auth.js\";\nimport { runAccountGet } from \"./commands/account.js\";\nimport {\n\trunApiKeysCreate,\n\trunApiKeysDelete,\n\trunApiKeysList,\n} from \"./commands/api-keys.js\";\nimport { runCommands } from \"./commands/commands.js\";\nimport {\n\trunDeploymentsGet,\n\trunDeploymentsList,\n} from \"./commands/deployments.js\";\nimport { runDoctor } from \"./commands/doctor.js\";\nimport {\n\trunDropsDelete,\n\trunDropsGet,\n\trunDropsList,\n\trunDropsUpdate,\n} from \"./commands/drops.js\";\nimport {\n\trunLoginInteractive,\n\trunLoginRequest,\n\trunLoginVerify,\n} from \"./commands/login.js\";\nimport { runLogout } from \"./commands/logout.js\";\nimport { runPublish } from \"./commands/publish.js\";\nimport { runUpdate } from \"./commands/update.js\";\nimport { runWhoami } from \"./commands/whoami.js\";\nimport { createContext, type GlobalOptions } from \"./context.js\";\nimport type { RawDropOptions } from \"./options.js\";\nimport { type CredentialStore, MemoryCredentialStore } from \"./storage.js\";\n\ntype BuildProgramOptions = {\n\tstore?: CredentialStore;\n\tclient?: unknown;\n\tenv?: Record<string, string | undefined>;\n\tstdin?: AsyncIterable<string | Uint8Array>;\n\tstdout?: (value: string) => void;\n\tstderr?: (value: string) => void;\n\tstdoutIsTTY?: boolean;\n\tstdinIsTTY?: boolean;\n};\n\nexport function buildProgram(options: BuildProgramOptions = {}): Command {\n\tconst program = new Command();\n\tconst store = options.store ?? new MemoryCredentialStore();\n\tprogram\n\t\t.name(\"dropthis\")\n\t\t.description(\"Publish anything online and get a URL back.\")\n\t\t.version(PKG_VERSION);\n\tprogram.option(\"--api-key <key>\", \"Override API key for this invocation\");\n\tprogram.option(\"--api-url <url>\", \"Override API base URL\");\n\tprogram.option(\"--json\", \"Force JSON output\");\n\tprogram.option(\"-q, --quiet\", \"Suppress status output and imply JSON\");\n\n\tprogram\n\t\t.command(\"login\")\n\t\t.description(\"Authenticate with email OTP\")\n\t\t.option(\"--email <email>\", \"Email address\")\n\t\t.option(\"--otp <otp>\", \"One-time passcode\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(\n\t\t\tasync (commandOptions: {\n\t\t\t\temail?: string;\n\t\t\t\totp?: string;\n\t\t\t\tjson?: boolean;\n\t\t\t}) => {\n\t\t\t\tif (!commandOptions.email || !commandOptions.otp) {\n\t\t\t\t\tconst deps = await commandDeps<\n\t\t\t\t\t\tParameters<typeof runLoginInteractive>[0][\"client\"]\n\t\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\t\tconst global = globalOptions(program, commandOptions);\n\t\t\t\t\tconst context = createContext({ global });\n\t\t\t\t\tconst result = await runLoginInteractive({\n\t\t\t\t\t\t...deps,\n\t\t\t\t\t\tcreateClient: (apiKey) =>\n\t\t\t\t\t\t\tcontext.createClient(apiKey) as Parameters<\n\t\t\t\t\t\t\t\ttypeof runLoginInteractive\n\t\t\t\t\t\t\t>[0][\"client\"],\n\t\t\t\t\t});\n\t\t\t\t\tprocess.exitCode = result.exitCode;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst deps = await commandDeps<\n\t\t\t\t\tParameters<typeof runLoginVerify>[1][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst result = await runLoginVerify(\n\t\t\t\t\t{\n\t\t\t\t\t\temail: commandOptions.email,\n\t\t\t\t\t\totp: commandOptions.otp,\n\t\t\t\t\t\t...(commandOptions.json !== undefined\n\t\t\t\t\t\t\t? { json: commandOptions.json }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t},\n\t\t\t\t\tdeps,\n\t\t\t\t);\n\t\t\t\tprocess.exitCode = result.exitCode;\n\t\t\t},\n\t\t);\n\n\tconst login = program.commands.find((command) => command.name() === \"login\");\n\tlogin\n\t\t?.command(\"request\")\n\t\t.description(\"Request an email OTP\")\n\t\t.requiredOption(\"--email <email>\", \"Email address\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(async (commandOptions: { email: string; json?: boolean }) => {\n\t\t\tconst deps = await commandDeps<\n\t\t\t\tParameters<typeof runLoginRequest>[1][\"client\"]\n\t\t\t>(program, options, store, commandOptions);\n\t\t\tconst result = await runLoginRequest(commandOptions, deps);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\tlogin\n\t\t?.command(\"verify\")\n\t\t.description(\"Verify email OTP and store an API key\")\n\t\t.requiredOption(\"--email <email>\", \"Email address\")\n\t\t.requiredOption(\"--otp <otp>\", \"One-time passcode\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(\n\t\t\tasync (commandOptions: {\n\t\t\t\temail: string;\n\t\t\t\totp: string;\n\t\t\t\tjson?: boolean;\n\t\t\t}) => {\n\t\t\t\tconst deps = await commandDeps<\n\t\t\t\t\tParameters<typeof runLoginVerify>[1][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst result = await runLoginVerify(commandOptions, deps);\n\t\t\t\tprocess.exitCode = result.exitCode;\n\t\t\t},\n\t\t);\n\n\tprogram\n\t\t.command(\"logout\")\n\t\t.description(\"Remove stored credentials\")\n\t\t.option(\"--revoke\", \"Best-effort revoke the saved API key\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(async (commandOptions: { revoke?: boolean; json?: boolean }) => {\n\t\t\tconst deps = await commandDeps<Parameters<typeof runLogout>[1][\"client\"]>(\n\t\t\t\tprogram,\n\t\t\t\toptions,\n\t\t\t\tstore,\n\t\t\t\tcommandOptions,\n\t\t\t);\n\t\t\tconst result = await runLogout(commandOptions, deps);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\n\tprogram\n\t\t.command(\"whoami\")\n\t\t.description(\"Show current authentication status\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(async (commandOptions: { json?: boolean }) => {\n\t\t\tconst deps = await commandDeps<unknown>(\n\t\t\t\tprogram,\n\t\t\t\toptions,\n\t\t\t\tstore,\n\t\t\t\tcommandOptions,\n\t\t\t);\n\t\t\tconst result = await runWhoami(commandOptions, deps);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\n\tprogram\n\t\t.command(\"account\")\n\t\t.description(\"Account commands\")\n\t\t.command(\"get\")\n\t\t.description(\"Get account details\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(async (commandOptions: { json?: boolean }) => {\n\t\t\tconst deps = await commandDeps<\n\t\t\t\tParameters<typeof runAccountGet>[1][\"client\"]\n\t\t\t>(program, options, store, commandOptions);\n\t\t\tconst result = await runAccountGet(commandOptions, deps);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\n\tprogram\n\t\t.command(\"publish [input...]\")\n\t\t.description(\n\t\t\t\"Publish files, folders, URLs, strings, or stdin.\\nMultiple files are bundled into one drop.\\nUse - to read stdin explicitly, or pipe without args.\",\n\t\t)\n\t\t.option(\"--from-json <path>\", \"Read exact POST /drops JSON request body\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.option(\"--title <title>\", \"Drop title\")\n\t\t.option(\"--visibility <visibility>\", \"Drop visibility\")\n\t\t.option(\"--password <password>\", \"Set password\")\n\t\t.option(\"--no-password\", \"Clear password\")\n\t\t.option(\"--noindex\", \"Prevent indexing\")\n\t\t.option(\"--index\", \"Allow indexing\")\n\t\t.option(\"--expires-at <datetime>\", \"Expiration datetime\")\n\t\t.option(\"--metadata <json>\", \"Metadata JSON object\")\n\t\t.option(\"--metadata-file <path>\", \"Metadata JSON file\")\n\t\t.option(\"--entry <path>\", \"Entry file path\")\n\t\t.option(\"--content-type <mime>\", \"Content type\")\n\t\t.option(\"--path <path>\", \"Path for stdin or byte input\")\n\t\t.option(\"--idempotency-key <key>\", \"Idempotency key\")\n\t\t.option(\"--url\", \"Print only the published URL\")\n\t\t.option(\"--dry-run\", \"Validate without publishing\")\n\t\t.action(async (inputs: string[], commandOptions: RawCommandOptions) => {\n\t\t\tconst deps = await commandDeps<\n\t\t\t\tParameters<typeof runPublish>[2][\"client\"]\n\t\t\t>(program, options, store, commandOptions);\n\t\t\tconst stdinIsTTY = options.stdinIsTTY ?? process.stdin.isTTY ?? false;\n\t\t\tlet publishInput: string | string[] | undefined;\n\t\t\tif (commandOptions.dryRun && inputs.length > 1) {\n\t\t\t\tpublishInput = inputs;\n\t\t\t} else {\n\t\t\t\tpublishInput = await resolvePublishInputs(\n\t\t\t\t\tinputs,\n\t\t\t\t\toptions.stdin,\n\t\t\t\t\tstdinIsTTY,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst result = await runPublish(\n\t\t\t\tpublishInput,\n\t\t\t\ttoDropOptions(commandOptions),\n\t\t\t\tdeps,\n\t\t\t);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\n\tprogram\n\t\t.command(\"update <target> [input]\")\n\t\t.description(\"Update an existing drop by id\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.option(\"--slug <slug>\", \"Replace shared hosted drop slug\")\n\t\t.option(\"--title <title>\", \"Drop title\")\n\t\t.option(\"--visibility <visibility>\", \"Drop visibility\")\n\t\t.option(\"--password <password>\", \"Set password\")\n\t\t.option(\"--no-password\", \"Clear password\")\n\t\t.option(\"--noindex\", \"Prevent indexing\")\n\t\t.option(\"--index\", \"Allow indexing\")\n\t\t.option(\"--expires-at <datetime>\", \"Expiration datetime\")\n\t\t.option(\"--metadata <json>\", \"Metadata JSON object\")\n\t\t.option(\"--metadata-file <path>\", \"Metadata JSON file\")\n\t\t.option(\"--entry <path>\", \"Entry file path\")\n\t\t.option(\"--content-type <mime>\", \"Content type\")\n\t\t.option(\"--path <path>\", \"Path for stdin or byte input\")\n\t\t.option(\"--idempotency-key <key>\", \"Idempotency key\")\n\t\t.option(\"--if-revision <n>\", \"Expected current revision\", parseInteger)\n\t\t.option(\n\t\t\t\"--from-json <path>\",\n\t\t\t\"Read exact POST /drops/{drop_id}/deployments JSON request body\",\n\t\t)\n\t\t.option(\"--url\", \"Print only the published URL\")\n\t\t.option(\"--dry-run\", \"Validate without publishing\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\ttarget: string,\n\t\t\t\tinput: string | undefined,\n\t\t\t\tcommandOptions: RawCommandOptions & { ifRevision?: number },\n\t\t\t) => {\n\t\t\t\tconst deps = await commandDeps<\n\t\t\t\t\tParameters<typeof runUpdate>[3][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst updateInput = input\n\t\t\t\t\t? await resolveCommandInput(input, options.stdin)\n\t\t\t\t\t: undefined;\n\t\t\t\tconst result = await runUpdate(\n\t\t\t\t\ttarget,\n\t\t\t\t\tupdateInput,\n\t\t\t\t\ttoDropOptions(commandOptions),\n\t\t\t\t\tdeps,\n\t\t\t\t);\n\t\t\t\tprocess.exitCode = result.exitCode;\n\t\t\t},\n\t\t);\n\n\tconst drops = program.command(\"drops\").description(\"Drop resource commands\");\n\tdrops\n\t\t.command(\"list\")\n\t\t.option(\"--limit <n>\", \"Page size\", parseInteger)\n\t\t.option(\"--cursor <cursor>\", \"Pagination cursor\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(\n\t\t\tasync (commandOptions: {\n\t\t\t\tlimit?: number;\n\t\t\t\tcursor?: string;\n\t\t\t\tjson?: boolean;\n\t\t\t}) => {\n\t\t\t\tconst deps = await commandDeps<\n\t\t\t\t\tParameters<typeof runDropsList>[1][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst result = await runDropsList(commandOptions, deps);\n\t\t\t\tprocess.exitCode = result.exitCode;\n\t\t\t},\n\t\t);\n\tdrops\n\t\t.command(\"get <dropId>\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(async (dropId: string, commandOptions: { json?: boolean }) => {\n\t\t\tconst deps = await commandDeps<\n\t\t\t\tParameters<typeof runDropsGet>[2][\"client\"]\n\t\t\t>(program, options, store, commandOptions);\n\t\t\tconst result = await runDropsGet(dropId, commandOptions, deps);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\tdrops\n\t\t.command(\"update <dropId>\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.option(\"--title <title>\", \"Drop title\")\n\t\t.option(\"--visibility <visibility>\", \"Drop visibility\")\n\t\t.option(\"--password <password>\", \"Set password\")\n\t\t.option(\"--no-password\", \"Clear password\")\n\t\t.option(\"--noindex\", \"Prevent indexing\")\n\t\t.option(\"--index\", \"Allow indexing\")\n\t\t.option(\"--expires-at <datetime>\", \"Expiration datetime\")\n\t\t.option(\"--metadata <json>\", \"Metadata JSON object\")\n\t\t.option(\"--metadata-file <path>\", \"Metadata JSON file\")\n\t\t.action(async (dropId: string, commandOptions: RawCommandOptions) => {\n\t\t\tconst deps = await commandDeps<\n\t\t\t\tParameters<typeof runDropsUpdate>[2][\"client\"]\n\t\t\t>(program, options, store, commandOptions);\n\t\t\tconst result = await runDropsUpdate(\n\t\t\t\tdropId,\n\t\t\t\ttoDropOptions(commandOptions),\n\t\t\t\tdeps,\n\t\t\t);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\tdrops\n\t\t.command(\"delete <dropId>\")\n\t\t.option(\"--yes\", \"Confirm deletion\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tdropId: string,\n\t\t\t\tcommandOptions: { yes?: boolean; json?: boolean },\n\t\t\t) => {\n\t\t\t\tconst deps = await commandDeps<\n\t\t\t\t\tParameters<typeof runDropsDelete>[2][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst result = await runDropsDelete(\n\t\t\t\t\tdropId,\n\t\t\t\t\t{ ...commandOptions, interactive: deps.outputMode === \"human\" },\n\t\t\t\t\tdeps,\n\t\t\t\t);\n\t\t\t\tprocess.exitCode = result.exitCode;\n\t\t\t},\n\t\t);\n\n\tconst apiKeys = program.command(\"api-keys\").description(\"API key commands\");\n\tapiKeys\n\t\t.command(\"create\")\n\t\t.option(\"--label <label>\", \"API key label\", \"CLI\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(async (commandOptions: { label: string; json?: boolean }) => {\n\t\t\tconst deps = await commandDeps<\n\t\t\t\tParameters<typeof runApiKeysCreate>[1][\"client\"]\n\t\t\t>(program, options, store, commandOptions);\n\t\t\tconst result = await runApiKeysCreate(commandOptions, deps);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\tapiKeys\n\t\t.command(\"list\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(async (commandOptions: { json?: boolean }) => {\n\t\t\tconst deps = await commandDeps<\n\t\t\t\tParameters<typeof runApiKeysList>[1][\"client\"]\n\t\t\t>(program, options, store, commandOptions);\n\t\t\tconst result = await runApiKeysList(commandOptions, deps);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\tapiKeys\n\t\t.command(\"delete <keyId>\")\n\t\t.option(\"--yes\", \"Confirm deletion\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tkeyId: string,\n\t\t\t\tcommandOptions: { yes?: boolean; json?: boolean },\n\t\t\t) => {\n\t\t\t\tconst deps = await commandDeps<\n\t\t\t\t\tParameters<typeof runApiKeysDelete>[2][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst result = await runApiKeysDelete(\n\t\t\t\t\tkeyId,\n\t\t\t\t\t{ ...commandOptions, interactive: deps.outputMode === \"human\" },\n\t\t\t\t\tdeps,\n\t\t\t\t);\n\t\t\t\tprocess.exitCode = result.exitCode;\n\t\t\t},\n\t\t);\n\n\tconst deployments = program\n\t\t.command(\"deployments\")\n\t\t.description(\"Deployment commands\");\n\tdeployments\n\t\t.command(\"list <dropId>\")\n\t\t.option(\"--limit <n>\", \"Page size\", parseInteger)\n\t\t.option(\"--cursor <cursor>\", \"Pagination cursor\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tdropId: string,\n\t\t\t\tcommandOptions: { limit?: number; cursor?: string; json?: boolean },\n\t\t\t) => {\n\t\t\t\tconst deps = await commandDeps<\n\t\t\t\t\tParameters<typeof runDeploymentsList>[2][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst result = await runDeploymentsList(dropId, commandOptions, deps);\n\t\t\t\tprocess.exitCode = result.exitCode;\n\t\t\t},\n\t\t);\n\tdeployments\n\t\t.command(\"get <dropId> <deploymentId>\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tdropId: string,\n\t\t\t\tdeploymentId: string,\n\t\t\t\tcommandOptions: { json?: boolean },\n\t\t\t) => {\n\t\t\t\tconst deps = await commandDeps<\n\t\t\t\t\tParameters<typeof runDeploymentsGet>[3][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst result = await runDeploymentsGet(\n\t\t\t\t\tdropId,\n\t\t\t\t\tdeploymentId,\n\t\t\t\t\tcommandOptions,\n\t\t\t\t\tdeps,\n\t\t\t\t);\n\t\t\t\tprocess.exitCode = result.exitCode;\n\t\t\t},\n\t\t);\n\n\tprogram\n\t\t.command(\"doctor\")\n\t\t.description(\"Report CLI diagnostics\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(async (commandOptions: { json?: boolean }) => {\n\t\t\tconst deps = await commandDeps<unknown>(\n\t\t\t\tprogram,\n\t\t\t\toptions,\n\t\t\t\tstore,\n\t\t\t\tcommandOptions,\n\t\t\t);\n\t\t\tconst result = await runDoctor(commandOptions, deps);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\n\tprogram\n\t\t.command(\"commands\")\n\t\t.description(\"Print machine-readable command metadata\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(async (commandOptions: { json?: boolean }) => {\n\t\t\tconst deps = await commandDeps<unknown>(\n\t\t\t\tprogram,\n\t\t\t\toptions,\n\t\t\t\tstore,\n\t\t\t\tcommandOptions,\n\t\t\t);\n\t\t\tconst result = await runCommands(commandOptions, deps);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\n\treturn program;\n}\n\ntype RawCommandOptions = Omit<RawDropOptions, \"password\"> & {\n\tjson?: boolean;\n\tquiet?: boolean;\n\turl?: boolean;\n\tifRevision?: number;\n\tfromJson?: string;\n\tdryRun?: boolean;\n\tpassword?: string | boolean;\n};\n\ntype RunnerDeps<TClient> = {\n\tstore: CredentialStore;\n\tclient: TClient;\n\tapiKey?: string;\n\tenv: Record<string, string | undefined>;\n\tstdout: (value: string) => void;\n\tstderr: (value: string) => void;\n\toutputMode: \"human\" | \"json\";\n};\n\nasync function commandDeps<TClient>(\n\tprogram: Command,\n\toptions: BuildProgramOptions,\n\tstore: CredentialStore,\n\tcommandOptions: { json?: boolean; quiet?: boolean },\n): Promise<RunnerDeps<TClient>> {\n\tconst global = globalOptions(program, commandOptions);\n\tconst context = createContext({\n\t\tglobal,\n\t\t...(options.env !== undefined ? { env: options.env } : {}),\n\t\t...(options.stdout !== undefined ? { stdout: options.stdout } : {}),\n\t\t...(options.stderr !== undefined ? { stderr: options.stderr } : {}),\n\t\t...(options.stdoutIsTTY !== undefined\n\t\t\t? { stdoutIsTTY: options.stdoutIsTTY }\n\t\t\t: {}),\n\t});\n\tconst credential = await resolveCredential({\n\t\t...(global.apiKey ? { apiKey: global.apiKey } : {}),\n\t\tenv: context.env,\n\t\tstore,\n\t});\n\treturn {\n\t\tstore,\n\t\tclient: (options.client ??\n\t\t\tcontext.createClient(credential?.apiKey)) as TClient,\n\t\t...(global.apiKey ? { apiKey: global.apiKey } : {}),\n\t\tenv: context.env,\n\t\tstdout: context.stdout,\n\t\tstderr: context.stderr,\n\t\toutputMode: context.output.mode,\n\t};\n}\n\nfunction globalOptions(\n\tprogram: Command,\n\tcommandOptions: { json?: boolean; quiet?: boolean },\n): GlobalOptions {\n\tconst opts = program.opts<GlobalOptions>();\n\treturn {\n\t\t...(opts.apiKey ? { apiKey: opts.apiKey } : {}),\n\t\t...(opts.apiUrl ? { apiUrl: opts.apiUrl } : {}),\n\t\t...(commandOptions.json !== undefined\n\t\t\t? { json: commandOptions.json }\n\t\t\t: opts.json !== undefined\n\t\t\t\t? { json: opts.json }\n\t\t\t\t: {}),\n\t\t...(commandOptions.quiet !== undefined\n\t\t\t? { quiet: commandOptions.quiet }\n\t\t\t: opts.quiet !== undefined\n\t\t\t\t? { quiet: opts.quiet }\n\t\t\t\t: {}),\n\t};\n}\n\nfunction toDropOptions(options: RawCommandOptions): RawDropOptions & {\n\tjson?: boolean;\n\tquiet?: boolean;\n\turl?: boolean;\n\tifRevision?: number;\n\tfromJson?: string;\n\tdryRun?: boolean;\n} {\n\treturn {\n\t\t...(options.slug ? { slug: options.slug } : {}),\n\t\t...(options.title ? { title: options.title } : {}),\n\t\t...(options.visibility === \"public\" || options.visibility === \"unlisted\"\n\t\t\t? { visibility: options.visibility }\n\t\t\t: {}),\n\t\t...(typeof options.password === \"string\"\n\t\t\t? { password: options.password }\n\t\t\t: {}),\n\t\t...(options.password === false || options.noPassword\n\t\t\t? { noPassword: true }\n\t\t\t: {}),\n\t\t...(options.noindex ? { noindex: true } : {}),\n\t\t...(options.index ? { index: true } : {}),\n\t\t...(options.expiresAt ? { expiresAt: options.expiresAt } : {}),\n\t\t...(options.metadata ? { metadata: options.metadata } : {}),\n\t\t...(options.metadataFile ? { metadataFile: options.metadataFile } : {}),\n\t\t...(options.entry ? { entry: options.entry } : {}),\n\t\t...(options.contentType ? { contentType: options.contentType } : {}),\n\t\t...(options.path ? { path: options.path } : {}),\n\t\t...(options.idempotencyKey\n\t\t\t? { idempotencyKey: options.idempotencyKey }\n\t\t\t: {}),\n\t\t...(options.json !== undefined ? { json: options.json } : {}),\n\t\t...(options.quiet !== undefined ? { quiet: options.quiet } : {}),\n\t\t...(options.url !== undefined ? { url: options.url } : {}),\n\t\t...(options.ifRevision !== undefined\n\t\t\t? { ifRevision: options.ifRevision }\n\t\t\t: {}),\n\t\t...(options.fromJson ? { fromJson: options.fromJson } : {}),\n\t\t...(options.dryRun ? { dryRun: options.dryRun } : {}),\n\t};\n}\n\nfunction parseInteger(value: string): number {\n\treturn Number.parseInt(value, 10);\n}\n\nasync function resolveCommandInput(\n\tinput: string,\n\tstdin?: AsyncIterable<string | Uint8Array>,\n): Promise<string> {\n\tif (input !== \"-\") return input;\n\tconst buf = await readStdinBytes(stdin ?? process.stdin);\n\treturn buf.toString(\"utf8\");\n}\n\nasync function resolvePublishInputs(\n\tinputs: string[],\n\tstdin?: AsyncIterable<string | Uint8Array>,\n\tstdinIsTTY?: boolean,\n): Promise<string | undefined> {\n\tif (inputs.length === 0) {\n\t\tif (stdinIsTTY) return undefined;\n\t\tconst buf = await readStdinBytes(stdin ?? process.stdin);\n\t\tif (buf.length === 0) return undefined;\n\t\treturn buf.toString(\"utf8\");\n\t}\n\tif (inputs.length === 1) {\n\t\tif (inputs[0] === \"-\") {\n\t\t\tconst buf = await readStdinBytes(stdin ?? process.stdin);\n\t\t\treturn buf.toString(\"utf8\");\n\t\t}\n\t\treturn inputs[0];\n\t}\n\tconst resolved: string[] = [];\n\tfor (const input of inputs) {\n\t\tif (input === \"-\") {\n\t\t\tconst buf = await readStdinBytes(stdin ?? process.stdin);\n\t\t\tconst tmpPath = `/tmp/.dropthis-stdin-${Date.now()}`;\n\t\t\tconst { writeFile } = await import(\"node:fs/promises\");\n\t\t\tawait writeFile(tmpPath, buf);\n\t\t\tresolved.push(tmpPath);\n\t\t} else {\n\t\t\tresolved.push(input);\n\t\t}\n\t}\n\tconst { mkdtemp, copyFile, stat: fsStat } = await import(\"node:fs/promises\");\n\tconst { join, basename: pathBasename } = await import(\"node:path\");\n\tconst { tmpdir } = await import(\"node:os\");\n\tconst tmpDir = await mkdtemp(join(tmpdir(), \"dropthis-multi-\"));\n\tfor (const filePath of resolved) {\n\t\tconst info = await fsStat(filePath);\n\t\tif (info.isDirectory()) {\n\t\t\tthrow new Error(\n\t\t\t\t`Cannot mix directories with multiple file arguments. Use a single folder instead: dropthis publish ${filePath}`,\n\t\t\t);\n\t\t}\n\t\tconst destName = pathBasename(filePath);\n\t\tawait copyFile(filePath, join(tmpDir, destName));\n\t}\n\treturn tmpDir;\n}\n\nasync function readStdinBytes(\n\tstdin: AsyncIterable<string | Uint8Array>,\n): Promise<Buffer> {\n\tconst chunks: Buffer[] = [];\n\tfor await (const chunk of stdin) {\n\t\tchunks.push(\n\t\t\ttypeof chunk === \"string\" ? Buffer.from(chunk) : Buffer.from(chunk),\n\t\t);\n\t}\n\treturn Buffer.concat(chunks);\n}\n","import type { CredentialStore } from \"./storage.js\";\n\nexport type ResolvedCredential = {\n\tapiKey: string;\n\tsource: \"flag\" | \"env\" | \"storage\";\n\tkeyId?: string;\n\tkeyLast4?: string;\n\taccountId?: string;\n\temail?: string;\n};\n\nexport async function resolveCredential(input: {\n\tapiKey?: string;\n\tenv: Record<string, string | undefined>;\n\tstore: CredentialStore;\n}): Promise<ResolvedCredential | null> {\n\tif (input.apiKey) return { apiKey: input.apiKey, source: \"flag\" };\n\tif (input.env.DROPTHIS_API_KEY) {\n\t\treturn { apiKey: input.env.DROPTHIS_API_KEY, source: \"env\" };\n\t}\n\tconst stored = await input.store.read();\n\tif (!stored) return null;\n\treturn {\n\t\tapiKey: stored.apiKey,\n\t\tsource: \"storage\",\n\t\t...(stored.keyId ? { keyId: stored.keyId } : {}),\n\t\t...(stored.keyLast4 ? { keyLast4: stored.keyLast4 } : {}),\n\t\t...(stored.accountId ? { accountId: stored.accountId } : {}),\n\t\t...(stored.email ? { email: stored.email } : {}),\n\t};\n}\n\nexport function maskKey(apiKey: string): string {\n\treturn apiKey.length <= 8\n\t\t? \"sk_...\"\n\t\t: `${apiKey.slice(0, 3)}...${apiKey.slice(-4)}`;\n}\n","export type OutputMode = \"human\" | \"json\";\nexport type CliErrorCode =\n\t| \"api_error\"\n\t| \"auth_error\"\n\t| \"credential_storage_unavailable\"\n\t| \"generic_error\"\n\t| \"invalid_usage\"\n\t| \"local_input_error\"\n\t| \"network_error\";\n\nexport type Output = {\n\tmode: OutputMode;\n\tquiet: boolean;\n};\n\nexport type ApiErrorDetails = {\n\tcode?: string;\n\tmessage: string;\n\tstatusCode?: number | null;\n\tdetail?: unknown;\n\tparam?: string | null;\n\tcurrentRevision?: number;\n\trequestId?: string | null;\n};\n\nconst UPLOAD_NEXT_ACTIONS: Record<string, string> = {\n\tupload_expired: \"Create a new upload session and retry the publish.\",\n\tupload_already_used:\n\t\t\"Create a new upload session; upload sessions are single-use.\",\n\tupload_verification_failed:\n\t\t\"Re-upload the file bytes and complete the upload again.\",\n\ttoo_many_active_uploads:\n\t\t\"Cancel unused uploads or wait for expired uploads to be cleaned.\",\n\tupload_not_complete: \"Complete the upload session before publishing.\",\n};\n\nexport function createOutput(input: {\n\tjson?: boolean;\n\tquiet?: boolean;\n\tstdoutIsTTY: boolean;\n\tenv: Record<string, string | undefined>;\n}): Output {\n\tconst json =\n\t\tinput.json === true ||\n\t\tinput.quiet === true ||\n\t\tinput.stdoutIsTTY === false ||\n\t\tinput.env.CI === \"true\";\n\treturn { mode: json ? \"json\" : \"human\", quiet: input.quiet === true };\n}\n\nexport function successEnvelope<T>(data: T): { ok: true; data: T } {\n\treturn { ok: true, data };\n}\n\nexport function errorEnvelope(\n\tcode: CliErrorCode,\n\tmessage: string,\n\tnextAction?: string,\n): {\n\tok: false;\n\terror: { code: CliErrorCode; message: string; next_action?: string };\n} {\n\treturn {\n\t\tok: false,\n\t\terror: {\n\t\t\tcode,\n\t\t\tmessage,\n\t\t\t...(nextAction ? { next_action: nextAction } : {}),\n\t\t},\n\t};\n}\n\nexport function apiErrorEnvelope(error: ApiErrorDetails): {\n\tok: false;\n\terror: Record<string, unknown>;\n} {\n\treturn {\n\t\tok: false,\n\t\terror: {\n\t\t\tcode: error.code ?? \"api_error\",\n\t\t\tmessage: error.message,\n\t\t\t...(error.statusCode !== undefined ? { status: error.statusCode } : {}),\n\t\t\t...(typeof error.detail === \"string\" ? { detail: error.detail } : {}),\n\t\t\t...(error.param ? { param: error.param } : {}),\n\t\t\t...(error.currentRevision !== undefined\n\t\t\t\t? { current_revision: error.currentRevision }\n\t\t\t\t: {}),\n\t\t\t...(error.requestId ? { request_id: error.requestId } : {}),\n\t\t\tnext_action: nextActionForApiError(error),\n\t\t},\n\t};\n}\n\nfunction nextActionForApiError(error: ApiErrorDetails): string {\n\tconst uploadNextAction = error.code\n\t\t? UPLOAD_NEXT_ACTIONS[error.code]\n\t\t: undefined;\n\tif (uploadNextAction) return uploadNextAction;\n\tif (error.code === \"revision_conflict\") {\n\t\treturn \"Fetch the drop, merge your changes, and retry with the current revision.\";\n\t}\n\tif (error.statusCode === 401 || error.code === \"missing_api_key\") {\n\t\treturn \"Authenticate with dropthis login or set DROPTHIS_API_KEY.\";\n\t}\n\tif (error.statusCode === 413 || error.code === \"quota_exceeded\") {\n\t\treturn \"Reduce the upload size or upgrade the account limit.\";\n\t}\n\tif (error.statusCode === 422) {\n\t\treturn \"Fix the input shown in the error detail and retry.\";\n\t}\n\tif (\n\t\terror.statusCode !== undefined &&\n\t\terror.statusCode !== null &&\n\t\terror.statusCode >= 500\n\t) {\n\t\treturn \"Retry the request with the same idempotency key, or contact support with the request id.\";\n\t}\n\treturn \"Fix the request or retry after checking the drop state.\";\n}\n\nexport function exitCodeFor(code: CliErrorCode): number {\n\tif (code === \"invalid_usage\") return 2;\n\tif (code === \"auth_error\") return 3;\n\tif (code === \"local_input_error\") return 4;\n\tif (code === \"network_error\") return 5;\n\treturn 1;\n}\n","import pc from \"picocolors\";\n\nexport const symbols = {\n\tsuccess: \"✓\",\n\terror: \"✗\",\n\twarning: \"!\",\n} as const;\n\nexport function success(msg: string): string {\n\treturn `${pc.green(symbols.success)} ${msg}`;\n}\n\nexport function error(msg: string): string {\n\treturn `${pc.red(symbols.error)} ${msg}`;\n}\n\nexport function warn(msg: string): string {\n\treturn `${pc.yellow(symbols.warning)} ${msg}`;\n}\n\nexport function hint(msg: string): string {\n\treturn ` ${pc.dim(msg)}`;\n}\n\nexport function url(u: string): string {\n\treturn pc.cyan(u);\n}\n\nexport function label(key: string, value: string): string {\n\treturn `${pc.dim(`${key}:`)} ${value}`;\n}\n\nexport function kvLines(pairs: Array<[key: string, value: string]>): string {\n\tif (pairs.length === 0) return \"\";\n\tconst maxKey = Math.max(...pairs.map(([k]) => k.length));\n\treturn pairs\n\t\t.map(([k, v]) => ` ${pc.dim(`${k.padEnd(maxKey)}:`)} ${v}`)\n\t\t.join(\"\\n\");\n}\n","import type { ApiErrorDetails } from \"./output.js\";\nimport {\n\tapiErrorEnvelope,\n\ttype CliErrorCode,\n\terrorEnvelope,\n\texitCodeFor,\n} from \"./output.js\";\nimport { error, hint, kvLines, success, url } from \"./ui.js\";\n\ntype WriterDeps = {\n\tstdout: (value: string) => void;\n\tstderr: (value: string) => void;\n\toutputMode?: \"human\" | \"json\";\n};\n\nexport function writeSuccess(\n\tdeps: WriterDeps,\n\tmessage: string,\n\tlink?: string,\n): void {\n\tif (deps.outputMode === \"human\") {\n\t\tconst text = link ? `${message} ${url(link)}` : message;\n\t\tdeps.stdout(`${success(text)}\\n`);\n\t}\n}\n\nexport function writeUrl(deps: WriterDeps, link: string): void {\n\tdeps.stdout(`${url(link)}\\n`);\n}\n\nexport function writeResult(\n\tdeps: WriterDeps,\n\tlink: string,\n\tverb: string,\n\tdata: Record<string, unknown>,\n): void {\n\tif (deps.outputMode === \"human\") {\n\t\tdeps.stdout(`${success(`${verb} ${url(link)}`)}\\n`);\n\t} else {\n\t\tdeps.stdout(`${JSON.stringify({ ok: true, drop: data })}\\n`);\n\t}\n}\n\nexport function writeJson(\n\tdeps: WriterDeps,\n\tenvelope: Record<string, unknown>,\n): void {\n\tdeps.stdout(`${JSON.stringify(envelope)}\\n`);\n}\n\nexport function writeKv(\n\tdeps: WriterDeps,\n\tpairs: Array<[string, string]>,\n\tjson: Record<string, unknown>,\n): void {\n\tif (deps.outputMode === \"human\") {\n\t\tdeps.stdout(`${kvLines(pairs)}\\n`);\n\t} else {\n\t\tdeps.stdout(`${JSON.stringify(json)}\\n`);\n\t}\n}\n\nexport function writeHumanOrJson(\n\tdeps: WriterDeps,\n\thumanText: string,\n\tjson: Record<string, unknown>,\n): void {\n\tif (deps.outputMode === \"human\") {\n\t\tdeps.stdout(`${humanText}\\n`);\n\t} else {\n\t\tdeps.stdout(`${JSON.stringify(json)}\\n`);\n\t}\n}\n\nexport function writeError(\n\tdeps: WriterDeps,\n\tcode: CliErrorCode,\n\tmessage: string,\n\tnextAction?: string,\n): { exitCode: number } {\n\tif (deps.outputMode === \"human\") {\n\t\tdeps.stderr(`${error(message)}\\n`);\n\t\tif (nextAction) deps.stderr(`${hint(nextAction)}\\n`);\n\t} else {\n\t\tdeps.stderr(\n\t\t\t`${JSON.stringify(errorEnvelope(code, message, nextAction))}\\n`,\n\t\t);\n\t}\n\treturn { exitCode: exitCodeFor(code) };\n}\n\nexport function writeApiError(\n\tdeps: WriterDeps,\n\tdetails: ApiErrorDetails,\n): { exitCode: number } {\n\tif (deps.outputMode === \"human\") {\n\t\tdeps.stderr(`${error(details.message)}\\n`);\n\t\tconst nextAction = details.requestId\n\t\t\t? `Request ID: ${details.requestId}`\n\t\t\t: undefined;\n\t\tif (nextAction) deps.stderr(`${hint(nextAction)}\\n`);\n\t} else {\n\t\tdeps.stderr(`${JSON.stringify(apiErrorEnvelope(details))}\\n`);\n\t}\n\treturn { exitCode: exitCodeFor(\"api_error\") };\n}\n\nexport function writeApiErrorSimple(\n\tdeps: WriterDeps,\n\tmessage: string,\n): { exitCode: number } {\n\tif (deps.outputMode === \"human\") {\n\t\tdeps.stderr(`${error(message)}\\n`);\n\t} else {\n\t\tdeps.stderr(`${JSON.stringify(errorEnvelope(\"api_error\", message))}\\n`);\n\t}\n\treturn { exitCode: exitCodeFor(\"api_error\") };\n}\n\nexport function writeAuthError(deps: WriterDeps): { exitCode: number } {\n\treturn writeError(\n\t\tdeps,\n\t\t\"auth_error\",\n\t\t\"No API key found.\",\n\t\t\"Set DROPTHIS_API_KEY or run dropthis login.\",\n\t);\n}\n\nexport function writeEmpty(\n\tdeps: WriterDeps,\n\tmessage: string,\n\tjson: Record<string, unknown>,\n): void {\n\tif (deps.outputMode === \"human\") {\n\t\tdeps.stdout(`${message}\\n`);\n\t} else {\n\t\tdeps.stdout(`${JSON.stringify(json)}\\n`);\n\t}\n}\n","import { resolveCredential } from \"../auth.js\";\nimport { writeApiErrorSimple, writeAuthError, writeKv } from \"../fmt.js\";\nimport type { CredentialStore } from \"../storage.js\";\n\ntype SdkResult<T> =\n\t| { data: T; error: null; headers?: Record<string, string> }\n\t| {\n\t\t\tdata: null;\n\t\t\terror: { message: string };\n\t\t\theaders?: Record<string, string>;\n\t };\n\ntype AccountClient = {\n\taccount: { get(): Promise<SdkResult<unknown>> };\n};\n\ntype CommandDeps = {\n\tstore: CredentialStore;\n\tclient: AccountClient;\n\tenv: Record<string, string | undefined>;\n\tstdout: (value: string) => void;\n\tstderr: (value: string) => void;\n\toutputMode?: \"human\" | \"json\";\n};\n\nexport async function runAccountGet(\n\t_input: { json?: boolean },\n\tdeps: CommandDeps,\n): Promise<{ exitCode: number }> {\n\tif (\n\t\t(await resolveCredential({ env: deps.env, store: deps.store })) === null\n\t) {\n\t\treturn writeAuthError(deps);\n\t}\n\tconst result = await deps.client.account.get();\n\tif (result.error) {\n\t\treturn writeApiErrorSimple(deps, result.error.message);\n\t}\n\tconst data = result.data as Record<string, unknown> | null;\n\tconst pairs: Array<[string, string]> = [];\n\tif (data?.id) pairs.push([\"ID\", String(data.id)]);\n\tif (data?.email) pairs.push([\"Email\", String(data.email)]);\n\tif (data?.plan) pairs.push([\"Plan\", String(data.plan)]);\n\n\twriteKv(deps, pairs, { ok: true, account: result.data });\n\treturn { exitCode: 0 };\n}\n","import { resolveCredential } from \"../auth.js\";\nimport {\n\twriteApiErrorSimple,\n\twriteAuthError,\n\twriteEmpty,\n\twriteError,\n\twriteHumanOrJson,\n\twriteJson,\n\twriteKv,\n} from \"../fmt.js\";\nimport type { CredentialStore } from \"../storage.js\";\nimport { success } from \"../ui.js\";\n\ntype SdkResult<T> =\n\t| { data: T; error: null; headers?: Record<string, string> }\n\t| {\n\t\t\tdata: null;\n\t\t\terror: { message: string };\n\t\t\theaders?: Record<string, string>;\n\t };\n\ntype ApiKeysCreateClient = {\n\tapiKeys: {\n\t\tcreate(input: {\n\t\t\tlabel: string;\n\t\t}): Promise<SdkResult<Record<string, unknown>>>;\n\t};\n};\n\ntype ApiKeysListClient = {\n\tapiKeys: {\n\t\tlist(): Promise<SdkResult<unknown>>;\n\t};\n};\n\ntype ApiKeysDeleteClient = {\n\tapiKeys: {\n\t\tdelete(\n\t\t\tkeyId: string,\n\t\t): Promise<SdkResult<null>> | SdkResult<null> | undefined;\n\t};\n};\n\ntype CommandDeps<TClient> = {\n\tstore: CredentialStore;\n\tclient: TClient;\n\tenv: Record<string, string | undefined>;\n\tstdout: (value: string) => void;\n\tstderr: (value: string) => void;\n\toutputMode?: \"human\" | \"json\";\n};\n\nexport async function runApiKeysCreate(\n\tinput: { label: string; json?: boolean },\n\tdeps: CommandDeps<ApiKeysCreateClient>,\n): Promise<{ exitCode: number }> {\n\tif (!(await hasCredential(deps))) return writeAuthError(deps);\n\tconst result = await deps.client.apiKeys.create({ label: input.label });\n\tif (result.error) return writeApiErrorSimple(deps, result.error.message);\n\tconst data = result.data;\n\tconst pairs: Array<[string, string]> = [];\n\tif (data.id) pairs.push([\"ID\", String(data.id)]);\n\tif (data.key) pairs.push([\"Key\", String(data.key)]);\n\tif (data.last4) pairs.push([\"Last 4\", String(data.last4)]);\n\twriteKv(deps, pairs, { ok: true, api_key: result.data });\n\treturn { exitCode: 0 };\n}\n\nexport async function runApiKeysList(\n\t_input: { json?: boolean },\n\tdeps: CommandDeps<ApiKeysListClient>,\n): Promise<{ exitCode: number }> {\n\tif (!(await hasCredential(deps))) return writeAuthError(deps);\n\tconst result = await deps.client.apiKeys.list();\n\tif (result.error) return writeApiErrorSimple(deps, result.error.message);\n\tconst raw = listItems(result.data);\n\tconst items = Array.isArray(raw)\n\t\t? (raw as Array<Record<string, unknown>>)\n\t\t: undefined;\n\tif (deps.outputMode === \"human\") {\n\t\tif (!items || items.length === 0) {\n\t\t\twriteEmpty(deps, \"No API keys found.\", { ok: true, api_keys: [] });\n\t\t} else {\n\t\t\tfor (const item of items) {\n\t\t\t\tdeps.stdout(\n\t\t\t\t\t`${item.id ?? \"\"} ${item.label ?? \"\"} ...${item.last4 ?? \"\"}\\n`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t} else {\n\t\twriteJson(deps, { ok: true, api_keys: items ?? raw });\n\t}\n\treturn { exitCode: 0 };\n}\n\nexport async function runApiKeysDelete(\n\tkeyId: string,\n\tinput: { yes?: boolean; json?: boolean; interactive?: boolean },\n\tdeps: CommandDeps<ApiKeysDeleteClient>,\n): Promise<{ exitCode: number }> {\n\tif (!input.yes && input.interactive === false) {\n\t\treturn writeError(\n\t\t\tdeps,\n\t\t\t\"invalid_usage\",\n\t\t\t\"Pass --yes to delete in non-interactive mode.\",\n\t\t);\n\t}\n\tif (!(await hasCredential(deps))) return writeAuthError(deps);\n\tconst result = await deps.client.apiKeys.delete(keyId);\n\tif (result?.error) return writeApiErrorSimple(deps, result.error.message);\n\twriteHumanOrJson(deps, success(`Deleted ${keyId}`), {\n\t\tok: true,\n\t\tdeleted: true,\n\t\tid: keyId,\n\t});\n\treturn { exitCode: 0 };\n}\n\nasync function hasCredential(deps: CommandDeps<unknown>): Promise<boolean> {\n\treturn (\n\t\t(await resolveCredential({ env: deps.env, store: deps.store })) !== null\n\t);\n}\n\nfunction listItems(data: unknown): unknown {\n\tif (data && typeof data === \"object\" && \"data\" in data) {\n\t\treturn (data as { data: unknown }).data;\n\t}\n\tif (data && typeof data === \"object\" && \"apiKeys\" in data) {\n\t\treturn (data as { apiKeys: unknown }).apiKeys;\n\t}\n\treturn data;\n}\n","const COMMANDS = [\n\t{\n\t\tname: \"publish\",\n\t\tdescription: \"Publish an input and return a Dropthis URL.\",\n\t\targuments: [\"input\"],\n\t\toptions: [\"--json\", \"--url\", \"--dry-run\", \"--title\", \"--metadata\"],\n\t\texamples: [\n\t\t\t\"dropthis publish ./site --json\",\n\t\t\t\"dropthis publish ./site --url\",\n\t\t\t\"dropthis publish ./dist --dry-run\",\n\t\t],\n\t},\n\t{\n\t\tname: \"update\",\n\t\tdescription: \"Update an existing drop by id.\",\n\t\targuments: [\"target\", \"input\"],\n\t\toptions: [\"--json\", \"--url\", \"--dry-run\", \"--if-revision\"],\n\t\texamples: [\n\t\t\t\"dropthis update drop_abc ./site --json\",\n\t\t\t\"dropthis update drop_abc --title 'New Title' --dry-run\",\n\t\t],\n\t},\n\t{\n\t\tname: \"deployments list <dropId>\",\n\t\tdescription: \"List deployments for a drop.\",\n\t\targuments: [\"dropId\"],\n\t\toptions: [\"--json\", \"--limit\", \"--cursor\"],\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis deployments list drop_abc --json\"],\n\t},\n\t{\n\t\tname: \"deployments get <dropId> <deploymentId>\",\n\t\tdescription: \"Get deployment details for a drop.\",\n\t\targuments: [\"dropId\", \"deploymentId\"],\n\t\toptions: [\"--json\"],\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis deployments get drop_abc dep_abc --json\"],\n\t},\n\t{\n\t\tname: \"drops\",\n\t\tdescription: \"List, inspect, update, and delete drops.\",\n\t\texamples: [\"dropthis drops list --json\"],\n\t},\n\t{\n\t\tname: \"api-keys\",\n\t\tdescription: \"Create, list, and delete API keys.\",\n\t\texamples: [\"dropthis api-keys create --label CI --json\"],\n\t},\n\t{\n\t\tname: \"login\",\n\t\tdescription: \"Authenticate with email OTP and store an API key.\",\n\t\texamples: [\n\t\t\t\"dropthis login verify --email user@example.com --otp 123456 --json\",\n\t\t],\n\t},\n\t{\n\t\tname: \"logout\",\n\t\tdescription: \"Remove stored local credentials.\",\n\t\texamples: [\"dropthis logout --json\"],\n\t},\n\t{\n\t\tname: \"whoami\",\n\t\tdescription: \"Show current auth source and credential metadata.\",\n\t\texamples: [\"dropthis whoami --json\"],\n\t},\n\t{\n\t\tname: \"account\",\n\t\tdescription: \"Get account details.\",\n\t\texamples: [\"dropthis account get --json\"],\n\t},\n\t{\n\t\tname: \"doctor\",\n\t\tdescription: \"Report local CLI diagnostics.\",\n\t\texamples: [\"dropthis doctor --json\"],\n\t},\n\t{\n\t\tname: \"commands\",\n\t\tdescription: \"Print this machine-readable command tree.\",\n\t\texamples: [\"dropthis commands --json\"],\n\t},\n];\n\nexport async function runCommands(\n\t_input: { json?: boolean },\n\tdeps: { stdout: (value: string) => void },\n): Promise<{ exitCode: number }> {\n\tdeps.stdout(\n\t\t`${JSON.stringify({\n\t\t\tok: true,\n\t\t\toutput: \"JSON by default in CI, pipes, non-TTY, --json, or --quiet.\",\n\t\t\tcommands: COMMANDS,\n\t\t})}\\n`,\n\t);\n\treturn { exitCode: 0 };\n}\n","import { resolveCredential } from \"../auth.js\";\nimport {\n\twriteApiError,\n\twriteAuthError,\n\twriteEmpty,\n\twriteJson,\n\twriteKv,\n} from \"../fmt.js\";\nimport type { CredentialStore } from \"../storage.js\";\n\ntype ApiError = {\n\tmessage: string;\n\tcode?: string;\n\tstatusCode?: number | null;\n\tdetail?: unknown;\n\tparam?: string | null;\n\trequestId?: string | null;\n};\n\ntype SdkResult<T> =\n\t| { data: T; error: null; headers?: Record<string, string> }\n\t| { data: null; error: ApiError; headers?: Record<string, string> };\n\ntype DeploymentsClient = {\n\tdeployments: {\n\t\tlist(\n\t\t\tdropId: string,\n\t\t\tparams?: { limit?: number; cursor?: string },\n\t\t): Promise<SdkResult<unknown>>;\n\t\tget(dropId: string, deploymentId: string): Promise<SdkResult<unknown>>;\n\t};\n};\n\ntype Deps = {\n\tstore: CredentialStore;\n\tclient: DeploymentsClient;\n\tapiKey?: string;\n\tenv: Record<string, string | undefined>;\n\tstdout: (value: string) => void;\n\tstderr: (value: string) => void;\n\toutputMode?: \"human\" | \"json\";\n};\n\nexport async function runDeploymentsList(\n\tdropId: string,\n\tinput: { limit?: number; cursor?: string; json?: boolean },\n\tdeps: Deps,\n): Promise<{ exitCode: number }> {\n\tif (!(await hasCredential(deps))) return writeAuthError(deps);\n\tconst params = {\n\t\t...(input.limit !== undefined ? { limit: input.limit } : {}),\n\t\t...(input.cursor ? { cursor: input.cursor } : {}),\n\t};\n\tconst result = await deps.client.deployments.list(dropId, params);\n\tif (result.error) {\n\t\treturn writeApiError(deps, result.error);\n\t}\n\tconst spread = spreadData(result.data);\n\tconst items = (spread.deployments ?? spread.data ?? result.data) as\n\t\t| Array<Record<string, unknown>>\n\t\t| undefined;\n\tif (deps.outputMode === \"human\") {\n\t\tif (!items || (Array.isArray(items) && items.length === 0)) {\n\t\t\twriteEmpty(deps, \"No deployments found.\", {\n\t\t\t\tok: true,\n\t\t\t\t...spread,\n\t\t\t});\n\t\t} else if (Array.isArray(items)) {\n\t\t\tfor (const item of items) {\n\t\t\t\tdeps.stdout(\n\t\t\t\t\t`${item.id ?? \"\"} rev ${item.revision ?? \"?\"} ${item.created_at ?? \"\"}\\n`,\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\twriteJson(deps, { ok: true, ...spread });\n\t\t}\n\t} else {\n\t\twriteJson(deps, { ok: true, ...spread });\n\t}\n\treturn { exitCode: 0 };\n}\n\nexport async function runDeploymentsGet(\n\tdropId: string,\n\tdeploymentId: string,\n\t_input: { json?: boolean },\n\tdeps: Deps,\n): Promise<{ exitCode: number }> {\n\tif (!(await hasCredential(deps))) return writeAuthError(deps);\n\tconst result = await deps.client.deployments.get(dropId, deploymentId);\n\tif (result.error) {\n\t\treturn writeApiError(deps, result.error);\n\t}\n\tconst data = result.data as Record<string, unknown>;\n\tconst pairs: Array<[string, string]> = [];\n\tif (data.id) pairs.push([\"ID\", String(data.id)]);\n\tif (data.revision !== undefined)\n\t\tpairs.push([\"Revision\", String(data.revision)]);\n\tif (data.created_at) pairs.push([\"Created\", String(data.created_at)]);\n\twriteKv(deps, pairs, { ok: true, deployment: result.data });\n\treturn { exitCode: 0 };\n}\n\nasync function hasCredential(\n\tdeps: Pick<Deps, \"apiKey\" | \"env\" | \"store\">,\n): Promise<boolean> {\n\treturn (\n\t\t(await resolveCredential({\n\t\t\t...(deps.apiKey ? { apiKey: deps.apiKey } : {}),\n\t\t\tenv: deps.env,\n\t\t\tstore: deps.store,\n\t\t})) !== null\n\t);\n}\n\nfunction spreadData(data: unknown): Record<string, unknown> {\n\treturn data && typeof data === \"object\"\n\t\t? (data as Record<string, unknown>)\n\t\t: { data };\n}\n","import { resolveCredential } from \"../auth.js\";\nimport { writeKv } from \"../fmt.js\";\nimport type { CredentialStore } from \"../storage.js\";\n\ntype CommandDeps = {\n\tstore: CredentialStore;\n\tclient: unknown;\n\tenv: Record<string, string | undefined>;\n\tstdout: (value: string) => void;\n\tstderr: (value: string) => void;\n\toutputMode?: \"human\" | \"json\";\n};\n\nexport async function runDoctor(\n\t_input: { json?: boolean },\n\tdeps: CommandDeps,\n): Promise<{ exitCode: number }> {\n\tconst stored = await deps.store.read();\n\tconst credential = await resolveCredential({\n\t\tenv: deps.env,\n\t\tstore: deps.store,\n\t});\n\tconst authSource = credential?.source ?? \"missing\";\n\tconst storageBackend = stored?.storage ?? \"none\";\n\n\tconst pairs: Array<[string, string]> = [\n\t\t[\"Version\", \"0.1.0\"],\n\t\t[\"Auth\", authSource],\n\t\t[\"Storage\", storageBackend],\n\t];\n\n\twriteKv(deps, pairs, {\n\t\tok: true,\n\t\tversion: \"0.1.0\",\n\t\tauth: { source: authSource },\n\t\tstorage: { backend: storageBackend },\n\t});\n\treturn { exitCode: 0 };\n}\n","import { readFile } from \"node:fs/promises\";\n\nexport type RawDropOptions = {\n\tslug?: string;\n\ttitle?: string;\n\tvisibility?: \"public\" | \"unlisted\";\n\tpassword?: string;\n\tnoPassword?: boolean;\n\tnoindex?: boolean;\n\tindex?: boolean;\n\texpiresAt?: string;\n\tmetadata?: string;\n\tmetadataFile?: string;\n\tentry?: string;\n\tcontentType?: string;\n\tpath?: string;\n\tidempotencyKey?: string;\n};\n\nexport type ParsedDropOptions = {\n\tslug?: string;\n\ttitle?: string;\n\tvisibility?: \"public\" | \"unlisted\";\n\tpassword?: string | null;\n\tnoindex?: boolean;\n\texpiresAt?: string;\n\tmetadata?: Record<string, unknown>;\n\tentry?: string;\n\tcontentType?: string;\n\tpath?: string;\n\tidempotencyKey?: string;\n};\n\nexport async function parseDropOptions(\n\traw: RawDropOptions,\n): Promise<ParsedDropOptions> {\n\tif (raw.metadata && raw.metadataFile) {\n\t\tthrow new Error(\"Use either --metadata or --metadata-file, not both.\");\n\t}\n\tif (raw.password && raw.noPassword) {\n\t\tthrow new Error(\"Use either --password or --no-password, not both.\");\n\t}\n\tif (raw.noindex && raw.index) {\n\t\tthrow new Error(\"Use either --noindex or --index, not both.\");\n\t}\n\tconst metadata = raw.metadata\n\t\t? parseJsonObject(raw.metadata, \"--metadata\")\n\t\t: raw.metadataFile\n\t\t\t? parseJsonObject(\n\t\t\t\t\tawait readFile(raw.metadataFile, \"utf8\"),\n\t\t\t\t\t\"--metadata-file\",\n\t\t\t\t)\n\t\t\t: undefined;\n\treturn {\n\t\t...(raw.slug ? { slug: raw.slug } : {}),\n\t\t...(raw.title ? { title: raw.title } : {}),\n\t\t...(raw.visibility ? { visibility: raw.visibility } : {}),\n\t\t...(raw.password ? { password: raw.password } : {}),\n\t\t...(raw.noPassword ? { password: null } : {}),\n\t\t...(raw.noindex ? { noindex: true } : {}),\n\t\t...(raw.index ? { noindex: false } : {}),\n\t\t...(raw.expiresAt ? { expiresAt: raw.expiresAt } : {}),\n\t\t...(metadata ? { metadata } : {}),\n\t\t...(raw.entry ? { entry: raw.entry } : {}),\n\t\t...(raw.contentType ? { contentType: raw.contentType } : {}),\n\t\t...(raw.path ? { path: raw.path } : {}),\n\t\t...(raw.idempotencyKey ? { idempotencyKey: raw.idempotencyKey } : {}),\n\t};\n}\n\nfunction parseJsonObject(\n\tvalue: string,\n\tlabel: string,\n): Record<string, unknown> {\n\tconst parsed = JSON.parse(value) as unknown;\n\tif (!parsed || typeof parsed !== \"object\" || Array.isArray(parsed)) {\n\t\tthrow new Error(`${label} must be a JSON object.`);\n\t}\n\treturn parsed as Record<string, unknown>;\n}\n","import { resolveCredential } from \"../auth.js\";\nimport {\n\twriteApiErrorSimple,\n\twriteAuthError,\n\twriteEmpty,\n\twriteError,\n\twriteHumanOrJson,\n\twriteJson,\n\twriteKv,\n} from \"../fmt.js\";\nimport { parseDropOptions, type RawDropOptions } from \"../options.js\";\nimport type { CredentialStore } from \"../storage.js\";\nimport { url as fmtUrl, success } from \"../ui.js\";\n\ntype SdkResult<T> =\n\t| { data: T; error: null; headers?: Record<string, string> }\n\t| {\n\t\t\tdata: null;\n\t\t\terror: { message: string };\n\t\t\theaders?: Record<string, string>;\n\t };\n\ntype DropsListClient = {\n\tdrops: {\n\t\tlist(params: {\n\t\t\tlimit?: number;\n\t\t\tcursor?: string;\n\t\t}): Promise<SdkResult<unknown>>;\n\t};\n};\n\ntype DropsGetClient = {\n\tdrops: {\n\t\tget(dropId: string): Promise<SdkResult<unknown>>;\n\t};\n};\n\ntype DropsUpdateClient = {\n\tdrops: {\n\t\tupdate(\n\t\t\tdropId: string,\n\t\t\tinput: Record<string, unknown>,\n\t\t): Promise<SdkResult<unknown>>;\n\t};\n};\n\ntype DropsDeleteClient = {\n\tdrops: {\n\t\tdelete(\n\t\t\tdropId: string,\n\t\t): Promise<SdkResult<null>> | SdkResult<null> | undefined;\n\t};\n};\n\ntype CommandDeps<TClient> = {\n\tstore: CredentialStore;\n\tclient: TClient;\n\tenv: Record<string, string | undefined>;\n\tstdout: (value: string) => void;\n\tstderr: (value: string) => void;\n\toutputMode?: \"human\" | \"json\";\n};\n\nexport async function runDropsList(\n\tinput: { limit?: number; cursor?: string; json?: boolean },\n\tdeps: CommandDeps<DropsListClient>,\n): Promise<{ exitCode: number }> {\n\tif (!(await hasCredential(deps))) return writeAuthError(deps);\n\tconst params = {\n\t\t...(input.limit !== undefined ? { limit: input.limit } : {}),\n\t\t...(input.cursor ? { cursor: input.cursor } : {}),\n\t};\n\tconst result = await deps.client.drops.list(params);\n\tif (result.error) return writeApiErrorSimple(deps, result.error.message);\n\tconst raw = listItems(result.data);\n\tconst items = Array.isArray(raw)\n\t\t? (raw as Array<Record<string, unknown>>)\n\t\t: undefined;\n\tif (deps.outputMode === \"human\") {\n\t\tif (!items || items.length === 0) {\n\t\t\twriteEmpty(deps, \"No drops found.\", { ok: true, drops: [] });\n\t\t} else {\n\t\t\tfor (const item of items) {\n\t\t\t\tdeps.stdout(\n\t\t\t\t\t`${item.id ?? \"\"} ${item.title ?? \"\"} ${item.url ? fmtUrl(String(item.url)) : \"\"}\\n`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t} else {\n\t\twriteJson(deps, { ok: true, drops: items ?? raw });\n\t}\n\treturn { exitCode: 0 };\n}\n\nexport async function runDropsGet(\n\tdropId: string,\n\t_input: { json?: boolean },\n\tdeps: CommandDeps<DropsGetClient>,\n): Promise<{ exitCode: number }> {\n\tif (!(await hasCredential(deps))) return writeAuthError(deps);\n\tconst result = await deps.client.drops.get(dropId);\n\tif (result.error) return writeApiErrorSimple(deps, result.error.message);\n\tconst data = result.data as Record<string, unknown>;\n\tconst pairs: Array<[string, string]> = [];\n\tif (data.id) pairs.push([\"ID\", String(data.id)]);\n\tif (data.url) pairs.push([\"URL\", fmtUrl(String(data.url))]);\n\tif (data.title) pairs.push([\"Title\", String(data.title)]);\n\tif (data.visibility) pairs.push([\"Visibility\", String(data.visibility)]);\n\tif (data.revision !== undefined)\n\t\tpairs.push([\"Revision\", String(data.revision)]);\n\tif (data.created_at) pairs.push([\"Created\", String(data.created_at)]);\n\twriteKv(deps, pairs, { ok: true, drop: result.data });\n\treturn { exitCode: 0 };\n}\n\nexport async function runDropsUpdate(\n\tdropId: string,\n\tinput: RawDropOptions & { json?: boolean },\n\tdeps: CommandDeps<DropsUpdateClient>,\n): Promise<{ exitCode: number }> {\n\tif (!(await hasCredential(deps))) return writeAuthError(deps);\n\ttry {\n\t\tconst options = await parseDropOptions(input);\n\t\tconst result = await deps.client.drops.update(dropId, options);\n\t\tif (result.error) return writeApiErrorSimple(deps, result.error.message);\n\t\twriteHumanOrJson(deps, success(`Updated ${dropId}`), {\n\t\t\tok: true,\n\t\t\tdrop: result.data,\n\t\t});\n\t\treturn { exitCode: 0 };\n\t} catch (error) {\n\t\treturn writeError(\n\t\t\tdeps,\n\t\t\t\"invalid_usage\",\n\t\t\terror instanceof Error ? error.message : \"Invalid drop options.\",\n\t\t);\n\t}\n}\n\nexport async function runDropsDelete(\n\tdropId: string,\n\tinput: { yes?: boolean; json?: boolean; interactive?: boolean },\n\tdeps: CommandDeps<DropsDeleteClient>,\n): Promise<{ exitCode: number }> {\n\tif (!input.yes && input.interactive === false) {\n\t\treturn writeError(\n\t\t\tdeps,\n\t\t\t\"invalid_usage\",\n\t\t\t\"Pass --yes to delete in non-interactive mode.\",\n\t\t);\n\t}\n\tif (!(await hasCredential(deps))) return writeAuthError(deps);\n\tconst result = await deps.client.drops.delete(dropId);\n\tif (result?.error) return writeApiErrorSimple(deps, result.error.message);\n\twriteHumanOrJson(deps, success(`Deleted ${dropId}`), {\n\t\tok: true,\n\t\tdeleted: true,\n\t\tid: dropId,\n\t});\n\treturn { exitCode: 0 };\n}\n\nasync function hasCredential(deps: CommandDeps<unknown>): Promise<boolean> {\n\treturn (\n\t\t(await resolveCredential({ env: deps.env, store: deps.store })) !== null\n\t);\n}\n\nfunction listItems(data: unknown): unknown {\n\tif (data && typeof data === \"object\" && \"data\" in data) {\n\t\treturn (data as { data: unknown }).data;\n\t}\n\tif (data && typeof data === \"object\" && \"drops\" in data) {\n\t\treturn (data as { drops: unknown }).drops;\n\t}\n\treturn data;\n}\n","import * as prompts from \"@clack/prompts\";\nimport { errorEnvelope, exitCodeFor } from \"../output.js\";\nimport type { CredentialStore } from \"../storage.js\";\n\ntype SdkResult<T> =\n\t| { data: T; error: null; headers?: Record<string, string> }\n\t| {\n\t\t\tdata: null;\n\t\t\terror: { message: string };\n\t\t\theaders?: Record<string, string>;\n\t };\n\ntype OtpRequestData = {\n\tok: true;\n\texpiresIn: number;\n};\n\ntype SessionData = {\n\ttoken: string;\n\taccountId: string;\n\tisNewAccount: boolean;\n};\n\ntype ApiKeyData = {\n\tid: string;\n\tkey: string;\n\tkeyLast4: string;\n\taccountId?: string | null;\n\tisNewAccount?: boolean;\n};\n\ntype LoginRequestClient = {\n\tauth: {\n\t\trequestEmailOtp(input: {\n\t\t\temail: string;\n\t\t}): Promise<SdkResult<OtpRequestData>>;\n\t};\n};\n\ntype LoginClient = {\n\tauth: {\n\t\tverifyEmailOtp(input: {\n\t\t\temail: string;\n\t\t\tcode: string;\n\t\t}): Promise<SdkResult<SessionData>>;\n\t};\n\tapiKeys: {\n\t\tcreate(input: { label: string }): Promise<SdkResult<ApiKeyData>>;\n\t};\n};\n\ntype LoginInteractiveClient = LoginRequestClient & LoginClient;\n\nexport async function runLoginInteractive(deps: {\n\tclient: LoginInteractiveClient;\n\tcreateClient: (apiKey: string) => LoginInteractiveClient;\n\tstore: CredentialStore;\n\tstdout: (value: string) => void;\n\tstderr: (value: string) => void;\n}): Promise<{ exitCode: number }> {\n\tprompts.intro(\"dropthis login\");\n\n\tconst email = await prompts.text({\n\t\tmessage: \"Email address\",\n\t\tvalidate: (v) => (v?.includes(\"@\") ? undefined : \"Enter a valid email\"),\n\t});\n\tif (prompts.isCancel(email)) {\n\t\tprompts.cancel(\"Login cancelled.\");\n\t\treturn { exitCode: 0 };\n\t}\n\n\tconst requestResult = await deps.client.auth.requestEmailOtp({ email });\n\tif (requestResult.error) {\n\t\tprompts.cancel(requestResult.error.message);\n\t\treturn { exitCode: exitCodeFor(\"api_error\") };\n\t}\n\n\tconst otp = await prompts.text({\n\t\tmessage: \"Paste the code from your email\",\n\t});\n\tif (prompts.isCancel(otp)) {\n\t\tprompts.cancel(\"Login cancelled.\");\n\t\treturn { exitCode: 0 };\n\t}\n\n\tconst session = await deps.client.auth.verifyEmailOtp({ email, code: otp });\n\tif (session.error) {\n\t\tprompts.cancel(session.error.message);\n\t\treturn { exitCode: exitCodeFor(\"api_error\") };\n\t}\n\n\tconst authedClient = deps.createClient(session.data.token);\n\tconst apiKey = await authedClient.apiKeys.create({ label: \"CLI\" });\n\tif (apiKey.error) {\n\t\tprompts.cancel(apiKey.error.message);\n\t\treturn { exitCode: exitCodeFor(\"api_error\") };\n\t}\n\n\tawait deps.store.save({\n\t\tapiKey: apiKey.data.key,\n\t\tkeyId: apiKey.data.id,\n\t\tkeyLast4: apiKey.data.keyLast4,\n\t\taccountId: apiKey.data.accountId ?? session.data.accountId,\n\t\temail,\n\t\tstorage: \"secure\",\n\t});\n\n\tprompts.outro(\"Logged in successfully.\");\n\treturn { exitCode: 0 };\n}\n\nexport async function runLoginRequest(\n\tinput: { email: string; json?: boolean },\n\tdeps: {\n\t\tclient: LoginRequestClient;\n\t\tstdout: (value: string) => void;\n\t\tstderr: (value: string) => void;\n\t},\n): Promise<{ exitCode: number }> {\n\tconst result = await deps.client.auth.requestEmailOtp({\n\t\temail: input.email,\n\t});\n\tif (result.error) {\n\t\tdeps.stderr(\n\t\t\t`${JSON.stringify(errorEnvelope(\"api_error\", result.error.message))}\\n`,\n\t\t);\n\t\treturn { exitCode: exitCodeFor(\"api_error\") };\n\t}\n\tdeps.stdout(\n\t\t`${JSON.stringify({\n\t\t\tok: true,\n\t\t\temail: input.email,\n\t\t\texpires_in: result.data.expiresIn,\n\t\t})}\\n`,\n\t);\n\treturn { exitCode: 0 };\n}\n\nexport async function runLoginVerify(\n\tinput: { email: string; otp: string; json?: boolean },\n\tdeps: {\n\t\tclient: LoginClient;\n\t\tstore: CredentialStore;\n\t\tstdout: (value: string) => void;\n\t\tstderr: (value: string) => void;\n\t},\n): Promise<{ exitCode: number }> {\n\tconst session = await deps.client.auth.verifyEmailOtp({\n\t\temail: input.email,\n\t\tcode: input.otp,\n\t});\n\tif (session.error) {\n\t\tdeps.stderr(\n\t\t\t`${JSON.stringify(errorEnvelope(\"api_error\", session.error.message))}\\n`,\n\t\t);\n\t\treturn { exitCode: exitCodeFor(\"api_error\") };\n\t}\n\tconst apiKey = await deps.client.apiKeys.create({ label: \"CLI\" });\n\tif (apiKey.error) {\n\t\tdeps.stderr(\n\t\t\t`${JSON.stringify(errorEnvelope(\"api_error\", apiKey.error.message))}\\n`,\n\t\t);\n\t\treturn { exitCode: exitCodeFor(\"api_error\") };\n\t}\n\tawait deps.store.save({\n\t\tapiKey: apiKey.data.key,\n\t\tkeyId: apiKey.data.id,\n\t\tkeyLast4: apiKey.data.keyLast4,\n\t\taccountId: apiKey.data.accountId ?? session.data.accountId,\n\t\temail: input.email,\n\t\tstorage: \"secure\",\n\t});\n\tdeps.stdout(\n\t\t`${JSON.stringify({\n\t\t\tok: true,\n\t\t\taccount_id: apiKey.data.accountId ?? session.data.accountId,\n\t\t\tkey_id: apiKey.data.id,\n\t\t\tkey_last4: apiKey.data.keyLast4,\n\t\t\tis_new_account: apiKey.data.isNewAccount ?? session.data.isNewAccount,\n\t\t})}\\n`,\n\t);\n\treturn { exitCode: 0 };\n}\n","import { writeApiErrorSimple, writeHumanOrJson } from \"../fmt.js\";\nimport type { CredentialStore } from \"../storage.js\";\nimport { success } from \"../ui.js\";\n\ntype DeleteResult =\n\t| { data: null; error: null; headers?: Record<string, string> }\n\t| {\n\t\t\tdata: null;\n\t\t\terror: { message: string };\n\t\t\theaders?: Record<string, string>;\n\t };\n\ntype LogoutClient = {\n\tapiKeys: {\n\t\tdelete(\n\t\t\tkeyId: string,\n\t\t): DeleteResult | Promise<DeleteResult> | undefined | Promise<undefined>;\n\t};\n};\n\nexport async function runLogout(\n\tinput: { json?: boolean; revoke?: boolean },\n\tdeps: {\n\t\tstore: CredentialStore;\n\t\tclient: LogoutClient;\n\t\tstdout: (value: string) => void;\n\t\tstderr: (value: string) => void;\n\t\toutputMode?: \"human\" | \"json\";\n\t},\n): Promise<{ exitCode: number }> {\n\tconst stored = await deps.store.read();\n\tlet revokeError: string | undefined;\n\tif (input.revoke && stored?.keyId) {\n\t\tconst result = await deps.client.apiKeys.delete(stored.keyId);\n\t\tif (result?.error) revokeError = result.error.message;\n\t}\n\tawait deps.store.clear();\n\tif (revokeError) {\n\t\treturn writeApiErrorSimple(deps, revokeError);\n\t}\n\twriteHumanOrJson(deps, success(\"Logged out.\"), { ok: true });\n\treturn { exitCode: 0 };\n}\n","import { randomUUID } from \"node:crypto\";\nimport { stat } from \"node:fs/promises\";\nimport { basename, extname } from \"node:path\";\nimport { resolveCredential } from \"../auth.js\";\nimport {\n\twriteApiError,\n\twriteAuthError,\n\twriteError,\n\twriteResult,\n} from \"../fmt.js\";\nimport {\n\ttype ParsedDropOptions,\n\tparseDropOptions,\n\ttype RawDropOptions,\n} from \"../options.js\";\nimport type { ApiErrorDetails } from \"../output.js\";\nimport { createSpinner, shouldSpin } from \"../spinner.js\";\nimport type { CredentialStore } from \"../storage.js\";\nimport { readJsonObjectFile } from \"./json_body.js\";\n\ntype SdkResult<T> =\n\t| { data: T; error: null; headers?: Record<string, string> }\n\t| {\n\t\t\tdata: null;\n\t\t\terror: ApiErrorDetails;\n\t\t\theaders?: Record<string, string>;\n\t };\n\ntype DropData = { url: string; [key: string]: unknown };\n\ntype ManifestFile = {\n\tpath: string;\n\tcontentType: string;\n\tsizeBytes: number;\n};\n\ntype PreparedResult = {\n\tkind: \"staged\";\n\tmanifest: { files: ManifestFile[]; entry?: string | null };\n\toptions: Record<string, unknown>;\n\tmetadata?: Record<string, unknown>;\n};\n\ntype PublishClient = {\n\tpublish(\n\t\tinput: string,\n\t\toptions: ParsedDropOptions,\n\t): Promise<SdkResult<DropData>>;\n\tprepare?(input: string, options: ParsedDropOptions): Promise<PreparedResult>;\n\tdrops: {\n\t\tcreateRaw(\n\t\t\tbody: unknown,\n\t\t\toptions?: { idempotencyKey?: string },\n\t\t): Promise<SdkResult<DropData>>;\n\t};\n};\n\ntype PublishOptions = RawDropOptions & {\n\tdryRun?: boolean;\n\tfromJson?: string;\n\tjson?: boolean;\n\tquiet?: boolean;\n\turl?: boolean;\n\tapiKey?: string;\n};\n\ntype PublishDeps = {\n\tstore: CredentialStore;\n\tclient: PublishClient;\n\tenv: Record<string, string | undefined>;\n\tstdout: (value: string) => void;\n\tstderr: (value: string) => void;\n\treadJsonObject?: (path: string) => Promise<Record<string, unknown>>;\n\toutputMode?: \"human\" | \"json\";\n};\n\nconst MAX_BUNDLE_FILE_COUNT = 200;\n\nexport async function runPublish(\n\tinput: string | string[] | undefined,\n\traw: PublishOptions,\n\tdeps: PublishDeps,\n): Promise<{ exitCode: number }> {\n\tconst credential = await resolveCredential({\n\t\t...(raw.apiKey ? { apiKey: raw.apiKey } : {}),\n\t\tenv: deps.env,\n\t\tstore: deps.store,\n\t});\n\tif (!credential) {\n\t\treturn writeAuthError(deps);\n\t}\n\n\tif (raw.dryRun) {\n\t\treturn handlePublishDryRun(input, raw, deps);\n\t}\n\n\tconst singleInput = Array.isArray(input) ? input[0] : input;\n\tconst spin = shouldSpin(deps.outputMode)\n\t\t? createSpinner(\"Publishing…\", deps.stderr)\n\t\t: undefined;\n\ttry {\n\t\tif (raw.fromJson && singleInput) {\n\t\t\tthrow new Error(\"Use either <input> or --from-json, not both.\");\n\t\t}\n\t\tconst options = withPublishIdempotency(await parseDropOptions(raw));\n\t\tconst result = raw.fromJson\n\t\t\t? await deps.client.drops.createRaw(\n\t\t\t\t\tawait (deps.readJsonObject ?? readJsonObjectFile)(raw.fromJson),\n\t\t\t\t\toptions.idempotencyKey\n\t\t\t\t\t\t? { idempotencyKey: options.idempotencyKey }\n\t\t\t\t\t\t: {},\n\t\t\t\t)\n\t\t\t: singleInput\n\t\t\t\t? await deps.client.publish(singleInput, options)\n\t\t\t\t: (() => {\n\t\t\t\t\t\tthrow new Error(\"Publish requires <input> or --from-json.\");\n\t\t\t\t\t})();\n\t\tif (result.error) {\n\t\t\tspin?.fail();\n\t\t\treturn writeApiError(deps, result.error);\n\t\t}\n\t\tspin?.stop(\"Published\");\n\t\tif (raw.url) deps.stdout(`${result.data.url}\\n`);\n\t\telse writeResult(deps, result.data.url, \"Published\", result.data);\n\t\treturn { exitCode: 0 };\n\t} catch (error) {\n\t\tconst message = error instanceof Error ? error.message : \"Publish failed.\";\n\t\tspin?.fail();\n\t\treturn writeError(deps, \"invalid_usage\", message);\n\t}\n}\n\nasync function handlePublishDryRun(\n\tinput: string | string[] | undefined,\n\traw: PublishOptions,\n\tdeps: PublishDeps,\n): Promise<{ exitCode: number }> {\n\tif (raw.url) {\n\t\treturn writeError(\n\t\t\tdeps,\n\t\t\t\"invalid_usage\",\n\t\t\t\"--url and --dry-run cannot be combined.\",\n\t\t\t\"Remove --url; dry-run outputs JSON describing what would be published.\",\n\t\t);\n\t}\n\ttry {\n\t\tif (raw.fromJson) {\n\t\t\tif (input)\n\t\t\t\tthrow new Error(\"Use either <input> or --from-json, not both.\");\n\t\t\tconst body = await (deps.readJsonObject ?? readJsonObjectFile)(\n\t\t\t\traw.fromJson,\n\t\t\t);\n\t\t\tdeps.stdout(\n\t\t\t\t`${JSON.stringify({ dryRun: true, kind: \"raw_json\", endpoint: \"POST /drops\", body }, null, 2)}\\n`,\n\t\t\t);\n\t\t\treturn { exitCode: 0 };\n\t\t}\n\n\t\tif (!input || (Array.isArray(input) && input.length === 0)) {\n\t\t\tthrow new Error(\"Publish requires <input> or --from-json.\");\n\t\t}\n\n\t\tconst options = await parseDropOptions(raw);\n\n\t\tif (Array.isArray(input)) {\n\t\t\treturn dryRunMultiFile(input, options, deps);\n\t\t}\n\n\t\tif (!deps.client.prepare) {\n\t\t\tthrow new Error(\"Client does not support dry-run.\");\n\t\t}\n\t\tconst prepared = await deps.client.prepare(input, options);\n\t\tconst output = formatDryRunOutput(prepared);\n\t\tvalidateDryRunOutput(output);\n\t\tdeps.stdout(`${JSON.stringify(output, null, 2)}\\n`);\n\t\treturn { exitCode: 0 };\n\t} catch (error) {\n\t\tconst code = isFileSystemError(error)\n\t\t\t? \"local_input_error\"\n\t\t\t: \"invalid_usage\";\n\t\tconst message = error instanceof Error ? error.message : \"Dry-run failed.\";\n\t\treturn writeError(deps, code, message);\n\t}\n}\n\nasync function dryRunMultiFile(\n\tinputs: string[],\n\toptions: ParsedDropOptions,\n\tdeps: PublishDeps,\n): Promise<{ exitCode: number }> {\n\tconst files: ManifestFile[] = [];\n\tfor (const filePath of inputs) {\n\t\tlet info: Awaited<ReturnType<typeof stat>>;\n\t\ttry {\n\t\t\tinfo = await stat(filePath);\n\t\t} catch {\n\t\t\treturn writeError(\n\t\t\t\tdeps,\n\t\t\t\t\"local_input_error\",\n\t\t\t\t`File not found: ${filePath}`,\n\t\t\t);\n\t\t}\n\t\tif (info.isDirectory()) {\n\t\t\treturn writeError(\n\t\t\t\tdeps,\n\t\t\t\t\"local_input_error\",\n\t\t\t\t`Cannot mix directories with multiple file arguments. Use a single folder instead: dropthis publish ${filePath}`,\n\t\t\t);\n\t\t}\n\t\tfiles.push({\n\t\t\tpath: basename(filePath),\n\t\t\tcontentType: mimeForPath(filePath),\n\t\t\tsizeBytes: info.size,\n\t\t});\n\t}\n\n\tif (files.length > MAX_BUNDLE_FILE_COUNT) {\n\t\treturn writeError(\n\t\t\tdeps,\n\t\t\t\"local_input_error\",\n\t\t\t`Bundle contains ${files.length} files, exceeding the maximum of ${MAX_BUNDLE_FILE_COUNT}.`,\n\t\t);\n\t}\n\n\tconst entry =\n\t\toptions.entry ??\n\t\tfiles.find((f) => f.path === \"index.html\")?.path ??\n\t\tfiles[0]?.path ??\n\t\tnull;\n\tconst totalBytes = files.reduce((sum, f) => sum + f.sizeBytes, 0);\n\tconst output = {\n\t\tdryRun: true as const,\n\t\tkind: \"staged\" as const,\n\t\tmanifest: { files, entry },\n\t\toptions: dryRunOptionsBody(options),\n\t\ttotalBytes,\n\t};\n\n\tdeps.stdout(`${JSON.stringify(output, null, 2)}\\n`);\n\treturn { exitCode: 0 };\n}\n\nfunction formatDryRunOutput(prepared: PreparedResult): Record<string, unknown> {\n\tconst totalBytes = prepared.manifest.files.reduce(\n\t\t(sum, f) => sum + f.sizeBytes,\n\t\t0,\n\t);\n\treturn {\n\t\tdryRun: true,\n\t\tkind: \"staged\",\n\t\tmanifest: {\n\t\t\tfiles: prepared.manifest.files,\n\t\t\tentry: prepared.manifest.entry ?? null,\n\t\t},\n\t\toptions: prepared.options,\n\t\t...(prepared.metadata ? { metadata: prepared.metadata } : {}),\n\t\ttotalBytes,\n\t};\n}\n\nfunction validateDryRunOutput(output: Record<string, unknown>): void {\n\tif (output.kind !== \"staged\") return;\n\tconst manifest = output.manifest as {\n\t\tfiles: ManifestFile[];\n\t};\n\tif (manifest.files.length > MAX_BUNDLE_FILE_COUNT) {\n\t\tthrow Object.assign(\n\t\t\tnew Error(\n\t\t\t\t`Bundle contains ${manifest.files.length} files, exceeding the maximum of ${MAX_BUNDLE_FILE_COUNT}.`,\n\t\t\t),\n\t\t\t{ code: \"ELIMIT\" },\n\t\t);\n\t}\n}\n\nfunction dryRunOptionsBody(\n\toptions: ParsedDropOptions,\n): Record<string, unknown> {\n\tconst result: Record<string, unknown> = {};\n\tif (options.title) result.title = options.title;\n\tif (options.visibility) result.visibility = options.visibility;\n\tif (options.password !== undefined) result.password = options.password;\n\tif (options.noindex !== undefined) result.noindex = options.noindex;\n\tif (options.expiresAt) result.expires_at = options.expiresAt;\n\treturn result;\n}\n\nfunction mimeForPath(filePath: string): string {\n\tconst ext = extname(filePath).toLowerCase();\n\tconst types: Record<string, string> = {\n\t\t\".html\": \"text/html\",\n\t\t\".htm\": \"text/html\",\n\t\t\".css\": \"text/css\",\n\t\t\".js\": \"text/javascript\",\n\t\t\".mjs\": \"text/javascript\",\n\t\t\".json\": \"application/json\",\n\t\t\".xml\": \"application/xml\",\n\t\t\".svg\": \"image/svg+xml\",\n\t\t\".txt\": \"text/plain\",\n\t\t\".md\": \"text/markdown\",\n\t\t\".jpg\": \"image/jpeg\",\n\t\t\".jpeg\": \"image/jpeg\",\n\t\t\".png\": \"image/png\",\n\t\t\".gif\": \"image/gif\",\n\t\t\".webp\": \"image/webp\",\n\t\t\".ico\": \"image/x-icon\",\n\t\t\".avif\": \"image/avif\",\n\t\t\".pdf\": \"application/pdf\",\n\t\t\".zip\": \"application/zip\",\n\t\t\".woff\": \"font/woff\",\n\t\t\".woff2\": \"font/woff2\",\n\t\t\".ttf\": \"font/ttf\",\n\t\t\".mp4\": \"video/mp4\",\n\t\t\".webm\": \"video/webm\",\n\t};\n\treturn types[ext] ?? \"application/octet-stream\";\n}\n\nfunction isFileSystemError(error: unknown): boolean {\n\tif (!(error instanceof Error)) return false;\n\tconst code = (error as NodeJS.ErrnoException).code;\n\treturn code === \"ENOENT\" || code === \"ENOTDIR\" || code === \"ELIMIT\";\n}\n\nfunction withPublishIdempotency(options: ParsedDropOptions): ParsedDropOptions {\n\treturn options.idempotencyKey\n\t\t? options\n\t\t: { ...options, idempotencyKey: `cli_pub_${randomUUID()}` };\n}\n","import pc from \"picocolors\";\nimport { symbols } from \"./ui.js\";\n\nconst frames = [\"⠋\", \"⠙\", \"⠹\", \"⠸\", \"⠼\", \"⠴\", \"⠦\", \"⠧\", \"⠇\", \"⠏\"];\n\nexport type Spinner = {\n\tstop(finalMessage?: string): void;\n\tfail(): void;\n};\n\nexport function createSpinner(\n\tmessage: string,\n\tstderr: (value: string) => void,\n): Spinner {\n\tlet i = 0;\n\tconst timer = setInterval(() => {\n\t\tstderr(`\\r\\x1B[2K${pc.cyan(frames[i % frames.length])} ${message}`);\n\t\ti++;\n\t}, 80);\n\n\treturn {\n\t\tstop(finalMessage?: string) {\n\t\t\tclearInterval(timer);\n\t\t\tconst text = finalMessage ?? message;\n\t\t\tstderr(`\\r\\x1B[2K${pc.green(symbols.success)} ${text}\\n`);\n\t\t},\n\t\tfail() {\n\t\t\tclearInterval(timer);\n\t\t\tstderr(\"\\r\\x1B[2K\");\n\t\t},\n\t};\n}\n\nexport function shouldSpin(outputMode?: \"human\" | \"json\"): boolean {\n\treturn (\n\t\toutputMode === \"human\" && process.stderr.isTTY === true && !process.env.CI\n\t);\n}\n","import { readFile } from \"node:fs/promises\";\n\nexport async function readJsonObjectFile(\n\tpath: string,\n): Promise<Record<string, unknown>> {\n\tlet parsed: unknown;\n\ttry {\n\t\tparsed = JSON.parse(await readFile(path, \"utf8\"));\n\t} catch (error) {\n\t\tconst message =\n\t\t\terror instanceof Error ? error.message : \"Unknown parse error\";\n\t\tthrow new Error(`Invalid JSON body in ${path}: ${message}`);\n\t}\n\tif (!parsed || typeof parsed !== \"object\" || Array.isArray(parsed)) {\n\t\tthrow new Error(\"JSON body must be an object.\");\n\t}\n\treturn parsed as Record<string, unknown>;\n}\n","import { randomUUID } from \"node:crypto\";\nimport { resolveCredential } from \"../auth.js\";\nimport {\n\twriteApiError,\n\twriteAuthError,\n\twriteError,\n\twriteResult,\n} from \"../fmt.js\";\nimport {\n\ttype ParsedDropOptions,\n\tparseDropOptions,\n\ttype RawDropOptions,\n} from \"../options.js\";\nimport type { ApiErrorDetails } from \"../output.js\";\nimport { createSpinner, shouldSpin } from \"../spinner.js\";\nimport type { CredentialStore } from \"../storage.js\";\nimport { readJsonObjectFile } from \"./json_body.js\";\n\ntype SdkResult<T> =\n\t| { data: T; error: null; headers?: Record<string, string> }\n\t| { data: null; error: ApiErrorDetails; headers?: Record<string, string> };\n\ntype DropData = { url: string; [key: string]: unknown };\ntype UpdateOptions = ParsedDropOptions & { ifRevision?: number };\n\ntype ManifestFile = {\n\tpath: string;\n\tcontentType: string;\n\tsizeBytes: number;\n};\n\ntype PreparedResult = {\n\tkind: \"staged\";\n\tmanifest: { files: ManifestFile[]; entry?: string | null };\n\toptions: Record<string, unknown>;\n\tmetadata?: Record<string, unknown>;\n};\n\ntype UpdateClient = {\n\tupdate(\n\t\ttarget: string,\n\t\tinputOrOptions: string | UpdateOptions,\n\t\toptions?: UpdateOptions,\n\t): Promise<SdkResult<DropData>>;\n\tprepare?(input: string, options: ParsedDropOptions): Promise<PreparedResult>;\n\tdeployments: {\n\t\tcreateRaw(\n\t\t\tdropId: string,\n\t\t\tbody: unknown,\n\t\t\toptions?: { idempotencyKey?: string; ifRevision?: number },\n\t\t): Promise<SdkResult<DropData>>;\n\t};\n};\n\ntype RawUpdateOptions = RawDropOptions & {\n\tdryRun?: boolean;\n\tifRevision?: number;\n\tfromJson?: string;\n\tjson?: boolean;\n\tquiet?: boolean;\n\turl?: boolean;\n\tapiKey?: string;\n};\n\ntype UpdateDeps = {\n\tstore: CredentialStore;\n\tclient: UpdateClient;\n\tenv: Record<string, string | undefined>;\n\tstdout: (value: string) => void;\n\tstderr: (value: string) => void;\n\treadJsonObject?: (path: string) => Promise<Record<string, unknown>>;\n\toutputMode?: \"human\" | \"json\";\n};\n\nexport async function runUpdate(\n\ttarget: string,\n\tinput: string | undefined,\n\traw: RawUpdateOptions,\n\tdeps: UpdateDeps,\n): Promise<{ exitCode: number }> {\n\tconst credential = await resolveCredential({\n\t\t...(raw.apiKey ? { apiKey: raw.apiKey } : {}),\n\t\tenv: deps.env,\n\t\tstore: deps.store,\n\t});\n\tif (!credential) {\n\t\treturn writeAuthError(deps);\n\t}\n\n\tif (raw.dryRun) {\n\t\treturn handleUpdateDryRun(target, input, raw, deps);\n\t}\n\n\tconst spin = shouldSpin(deps.outputMode)\n\t\t? createSpinner(\"Updating…\", deps.stderr)\n\t\t: undefined;\n\ttry {\n\t\tassertDropId(target);\n\t\tif (raw.fromJson && input) {\n\t\t\tthrow new Error(\"Use either [input] or --from-json, not both.\");\n\t\t}\n\t\tconst parsed = await parseDropOptions(raw);\n\t\tconst revisionOptions =\n\t\t\traw.ifRevision !== undefined\n\t\t\t\t? { ifRevision: Number(raw.ifRevision) }\n\t\t\t\t: {};\n\t\tconst result = raw.fromJson\n\t\t\t? await deps.client.deployments.createRaw(\n\t\t\t\t\ttarget,\n\t\t\t\t\tawait (deps.readJsonObject ?? readJsonObjectFile)(raw.fromJson),\n\t\t\t\t\twithUpdateIdempotency({\n\t\t\t\t\t\t...revisionOptions,\n\t\t\t\t\t\t...(parsed.idempotencyKey\n\t\t\t\t\t\t\t? { idempotencyKey: parsed.idempotencyKey }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t: input\n\t\t\t\t? await deps.client.update(\n\t\t\t\t\t\ttarget,\n\t\t\t\t\t\tinput,\n\t\t\t\t\t\twithUpdateIdempotency({\n\t\t\t\t\t\t\t...parsed,\n\t\t\t\t\t\t\t...revisionOptions,\n\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\t\t\t\t: await deps.client.update(target, parsed, revisionOptions);\n\t\tif (result.error) {\n\t\t\tspin?.fail();\n\t\t\treturn writeApiError(deps, result.error);\n\t\t}\n\t\tspin?.stop(\"Updated\");\n\t\tif (raw.url) deps.stdout(`${result.data.url}\\n`);\n\t\telse writeResult(deps, result.data.url, \"Updated\", result.data);\n\t\treturn { exitCode: 0 };\n\t} catch (error) {\n\t\tconst message = error instanceof Error ? error.message : \"Update failed.\";\n\t\tspin?.fail();\n\t\treturn writeError(deps, \"invalid_usage\", message);\n\t}\n}\n\nasync function handleUpdateDryRun(\n\ttarget: string,\n\tinput: string | undefined,\n\traw: RawUpdateOptions,\n\tdeps: UpdateDeps,\n): Promise<{ exitCode: number }> {\n\tif (raw.url) {\n\t\treturn writeError(\n\t\t\tdeps,\n\t\t\t\"invalid_usage\",\n\t\t\t\"--url and --dry-run cannot be combined.\",\n\t\t\t\"Remove --url; dry-run outputs JSON describing what would be published.\",\n\t\t);\n\t}\n\ttry {\n\t\tassertDropId(target);\n\n\t\tif (raw.fromJson) {\n\t\t\tif (input)\n\t\t\t\tthrow new Error(\"Use either [input] or --from-json, not both.\");\n\t\t\tconst body = await (deps.readJsonObject ?? readJsonObjectFile)(\n\t\t\t\traw.fromJson,\n\t\t\t);\n\t\t\tdeps.stdout(\n\t\t\t\t`${JSON.stringify({ dryRun: true, kind: \"raw_json\", endpoint: `POST /drops/${target}/deployments`, body }, null, 2)}\\n`,\n\t\t\t);\n\t\t\treturn { exitCode: 0 };\n\t\t}\n\n\t\tconst options = await parseDropOptions(raw);\n\n\t\tif (!input) {\n\t\t\tconst fields: Record<string, unknown> = {};\n\t\t\tif (options.slug) fields.slug = options.slug;\n\t\t\tif (options.title) fields.title = options.title;\n\t\t\tif (options.visibility) fields.visibility = options.visibility;\n\t\t\tif (options.password !== undefined) fields.password = options.password;\n\t\t\tif (options.noindex !== undefined) fields.noindex = options.noindex;\n\t\t\tif (options.expiresAt) fields.expires_at = options.expiresAt;\n\t\t\tif (options.metadata) fields.metadata = options.metadata;\n\t\t\tdeps.stdout(\n\t\t\t\t`${JSON.stringify({ dryRun: true, kind: \"options_update\", target, fields }, null, 2)}\\n`,\n\t\t\t);\n\t\t\treturn { exitCode: 0 };\n\t\t}\n\n\t\tif (!deps.client.prepare) {\n\t\t\tthrow new Error(\"Client does not support dry-run.\");\n\t\t}\n\t\tconst prepared = await deps.client.prepare(input, options);\n\t\tconst output = formatUpdateDryRun(target, prepared);\n\t\tvalidateDryRunFileCount(output);\n\t\tdeps.stdout(`${JSON.stringify(output, null, 2)}\\n`);\n\t\treturn { exitCode: 0 };\n\t} catch (error) {\n\t\tconst code = isFileSystemError(error)\n\t\t\t? \"local_input_error\"\n\t\t\t: \"invalid_usage\";\n\t\tconst message = error instanceof Error ? error.message : \"Dry-run failed.\";\n\t\treturn writeError(deps, code, message);\n\t}\n}\n\nconst MAX_BUNDLE_FILE_COUNT = 200;\n\nfunction formatUpdateDryRun(\n\ttarget: string,\n\tprepared: PreparedResult,\n): Record<string, unknown> {\n\tconst totalBytes = prepared.manifest.files.reduce(\n\t\t(sum, f) => sum + f.sizeBytes,\n\t\t0,\n\t);\n\treturn {\n\t\tdryRun: true,\n\t\tkind: \"staged\",\n\t\ttarget,\n\t\tmanifest: {\n\t\t\tfiles: prepared.manifest.files,\n\t\t\tentry: prepared.manifest.entry ?? null,\n\t\t},\n\t\toptions: prepared.options,\n\t\t...(prepared.metadata ? { metadata: prepared.metadata } : {}),\n\t\ttotalBytes,\n\t};\n}\n\nfunction validateDryRunFileCount(output: Record<string, unknown>): void {\n\tif (output.kind !== \"staged\") return;\n\tconst manifest = output.manifest as { files: ManifestFile[] };\n\tif (manifest.files.length > MAX_BUNDLE_FILE_COUNT) {\n\t\tthrow Object.assign(\n\t\t\tnew Error(\n\t\t\t\t`Bundle contains ${manifest.files.length} files, exceeding the maximum of ${MAX_BUNDLE_FILE_COUNT}.`,\n\t\t\t),\n\t\t\t{ code: \"ELIMIT\" },\n\t\t);\n\t}\n}\n\nfunction isFileSystemError(error: unknown): boolean {\n\tif (!(error instanceof Error)) return false;\n\tconst code = (error as NodeJS.ErrnoException).code;\n\treturn code === \"ENOENT\" || code === \"ENOTDIR\";\n}\n\nfunction withUpdateIdempotency(options: UpdateOptions): UpdateOptions {\n\treturn options.idempotencyKey\n\t\t? options\n\t\t: { ...options, idempotencyKey: `cli_upd_${randomUUID()}` };\n}\n\nfunction assertDropId(target: string): void {\n\tif (!target.startsWith(\"drop_\")) {\n\t\tthrow new Error(\n\t\t\t\"Update target must be a drop id returned by --json output, for example drop_...\",\n\t\t);\n\t}\n}\n","import { maskKey, resolveCredential } from \"../auth.js\";\nimport { writeHumanOrJson, writeKv } from \"../fmt.js\";\nimport type { CredentialStore } from \"../storage.js\";\n\nexport async function runWhoami(\n\t_input: { json?: boolean },\n\tdeps: {\n\t\tstore: CredentialStore;\n\t\tenv: Record<string, string | undefined>;\n\t\tstdout: (value: string) => void;\n\t\tstderr: (value: string) => void;\n\t\toutputMode?: \"human\" | \"json\";\n\t},\n): Promise<{ exitCode: number }> {\n\tconst credential = await resolveCredential({\n\t\tenv: deps.env,\n\t\tstore: deps.store,\n\t});\n\tif (!credential) {\n\t\twriteHumanOrJson(deps, \"Not authenticated. Run dropthis login.\", {\n\t\t\tok: true,\n\t\t\tauthenticated: false,\n\t\t});\n\t\treturn { exitCode: 0 };\n\t}\n\tconst masked = maskKey(credential.apiKey);\n\tconst pairs: Array<[string, string]> = [];\n\tif (credential.email) pairs.push([\"Email\", credential.email]);\n\tpairs.push([\"Key\", masked]);\n\tpairs.push([\"Source\", credential.source]);\n\tif (credential.accountId) pairs.push([\"Account\", credential.accountId]);\n\n\tconst jsonEnvelope = {\n\t\tok: true,\n\t\tauthenticated: true,\n\t\tsource: credential.source,\n\t\tmasked_key: masked,\n\t\t...(credential.keyId ? { key_id: credential.keyId } : {}),\n\t\t...(credential.keyLast4 ? { key_last4: credential.keyLast4 } : {}),\n\t\t...(credential.accountId ? { account_id: credential.accountId } : {}),\n\t\t...(credential.email ? { email: credential.email } : {}),\n\t};\n\twriteKv(deps, pairs, jsonEnvelope);\n\treturn { exitCode: 0 };\n}\n","import { Dropthis } from \"@dropthis/node\";\nimport { createOutput, type Output } from \"./output.js\";\n\nexport type GlobalOptions = {\n\tapiKey?: string;\n\tapiUrl?: string;\n\tjson?: boolean;\n\tquiet?: boolean;\n};\n\nexport type CliContext = {\n\tenv: Record<string, string | undefined>;\n\tglobal: GlobalOptions;\n\toutput: Output;\n\tstdout: (value: string) => void;\n\tstderr: (value: string) => void;\n\tcreateClient: (apiKey?: string) => Dropthis;\n};\n\nexport function createContext(input: {\n\tglobal?: GlobalOptions;\n\tenv?: Record<string, string | undefined>;\n\tstdout?: (value: string) => void;\n\tstderr?: (value: string) => void;\n\tstdoutIsTTY?: boolean;\n}): CliContext {\n\tconst env = input.env ?? process.env;\n\tconst global = input.global ?? {};\n\treturn {\n\t\tenv,\n\t\tglobal,\n\t\toutput: createOutput({\n\t\t\t...(global.json !== undefined ? { json: global.json } : {}),\n\t\t\t...(global.quiet !== undefined ? { quiet: global.quiet } : {}),\n\t\t\tstdoutIsTTY: input.stdoutIsTTY ?? process.stdout.isTTY === true,\n\t\t\tenv,\n\t\t}),\n\t\tstdout: input.stdout ?? ((value) => process.stdout.write(value)),\n\t\tstderr: input.stderr ?? ((value) => process.stderr.write(value)),\n\t\tcreateClient(apiKey) {\n\t\t\tconst baseUrl = global.apiUrl ?? env.DROPTHIS_API_URL;\n\t\t\treturn new Dropthis({\n\t\t\t\t...(apiKey ? { apiKey } : {}),\n\t\t\t\t...(baseUrl ? { baseUrl } : {}),\n\t\t\t});\n\t\t},\n\t};\n}\n","import { chmod, mkdir, readFile, rm, writeFile } from \"node:fs/promises\";\nimport { homedir } from \"node:os\";\nimport { dirname, join } from \"node:path\";\nimport { Entry } from \"@napi-rs/keyring\";\n\nexport type StoredCredential = {\n\tapiKey: string;\n\tkeyId?: string;\n\tkeyLast4?: string;\n\taccountId?: string;\n\temail?: string;\n\tstorage: \"secure\" | \"insecure\";\n};\n\nexport interface CredentialStore {\n\tread(): Promise<StoredCredential | null>;\n\tsave(credential: StoredCredential): Promise<void>;\n\tclear(): Promise<void>;\n}\n\nexport type KeyringAdapter = {\n\tgetPassword(): string | null | undefined | Promise<string | null | undefined>;\n\tsetPassword(value: string): void | Promise<void>;\n\tdeletePassword(): void | Promise<void>;\n};\n\nexport class MemoryCredentialStore implements CredentialStore {\n\tprivate credential: StoredCredential | null = null;\n\n\tasync read(): Promise<StoredCredential | null> {\n\t\treturn this.credential;\n\t}\n\n\tasync save(credential: StoredCredential): Promise<void> {\n\t\tthis.credential = credential;\n\t}\n\n\tasync clear(): Promise<void> {\n\t\tthis.credential = null;\n\t}\n}\n\nexport class InsecureFileCredentialStore implements CredentialStore {\n\tprivate readonly filePath: string;\n\n\tconstructor(options: { configDir?: string } = {}) {\n\t\tthis.filePath = credentialPath(options.configDir);\n\t}\n\n\tasync read(): Promise<StoredCredential | null> {\n\t\tconst value = await readJsonFile(this.filePath);\n\t\treturn value\n\t\t\t? ({ ...value, storage: \"insecure\" } as StoredCredential)\n\t\t\t: null;\n\t}\n\n\tasync save(credential: StoredCredential): Promise<void> {\n\t\tawait writeCredentialFile(this.filePath, {\n\t\t\t...credential,\n\t\t\tstorage: \"insecure\",\n\t\t});\n\t}\n\n\tasync clear(): Promise<void> {\n\t\tawait rm(this.filePath, { force: true });\n\t}\n}\n\nexport class KeyringCredentialStore implements CredentialStore {\n\tprivate readonly filePath: string;\n\tprivate readonly keyring: KeyringAdapter;\n\n\tconstructor(options: { configDir?: string; keyring?: KeyringAdapter } = {}) {\n\t\tthis.filePath = credentialPath(options.configDir);\n\t\tthis.keyring = options.keyring ?? defaultKeyringAdapter();\n\t}\n\n\tasync read(): Promise<StoredCredential | null> {\n\t\tconst metadata = await readJsonFile(this.filePath);\n\t\tif (!metadata) return null;\n\t\tconst apiKey = await this.keyring.getPassword();\n\t\tif (!apiKey) return null;\n\t\treturn { ...metadata, apiKey, storage: \"secure\" } as StoredCredential;\n\t}\n\n\tasync save(credential: StoredCredential): Promise<void> {\n\t\tawait this.keyring.setPassword(credential.apiKey);\n\t\tconst { apiKey: _apiKey, ...metadata } = credential;\n\t\tawait writeCredentialFile(this.filePath, {\n\t\t\t...metadata,\n\t\t\tstorage: \"secure\",\n\t\t});\n\t}\n\n\tasync clear(): Promise<void> {\n\t\tawait this.keyring.deletePassword();\n\t\tawait rm(this.filePath, { force: true });\n\t}\n}\n\nexport function createCredentialStore(\n\toptions: { insecure?: boolean; configDir?: string } = {},\n): CredentialStore {\n\tif (options.insecure) return new InsecureFileCredentialStore(options);\n\treturn new KeyringCredentialStore(options);\n}\n\nfunction defaultKeyringAdapter(): KeyringAdapter {\n\tconst entry = new Entry(\"dropthis\", \"default\");\n\treturn {\n\t\tgetPassword: () => entry.getPassword(),\n\t\tsetPassword: (value) => entry.setPassword(value),\n\t\tdeletePassword: () => {\n\t\t\tentry.deletePassword();\n\t\t},\n\t};\n}\n\nfunction credentialPath(configDir?: string): string {\n\treturn join(\n\t\tconfigDir ?? join(homedir(), \".config\", \"dropthis\"),\n\t\t\"credentials.json\",\n\t);\n}\n\nasync function readJsonFile(\n\tpath: string,\n): Promise<Record<string, unknown> | null> {\n\ttry {\n\t\treturn JSON.parse(await readFile(path, \"utf8\")) as Record<string, unknown>;\n\t} catch (error) {\n\t\tif (\n\t\t\terror &&\n\t\t\ttypeof error === \"object\" &&\n\t\t\t\"code\" in error &&\n\t\t\terror.code === \"ENOENT\"\n\t\t) {\n\t\t\treturn null;\n\t\t}\n\t\tthrow error;\n\t}\n}\n\nasync function writeCredentialFile(\n\tpath: string,\n\tcredential: Record<string, unknown>,\n): Promise<void> {\n\tawait mkdir(dirname(path), { recursive: true });\n\tawait writeFile(path, `${JSON.stringify(credential, null, 2)}\\n`, {\n\t\tmode: 0o600,\n\t});\n\tawait chmod(path, 0o600);\n}\n","#!/usr/bin/env node\nimport { buildProgram } from \"./program.js\";\nimport { createCredentialStore } from \"./storage.js\";\n\nbuildProgram({ store: createCredentialStore() })\n\t.parseAsync(process.argv)\n\t.catch((error: unknown) => {\n\t\tconsole.error(error);\n\t\tprocess.exitCode = 1;\n\t});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uBAAwB;;;ACWxB,eAAsB,kBAAkB,OAID;AACtC,MAAI,MAAM,OAAQ,QAAO,EAAE,QAAQ,MAAM,QAAQ,QAAQ,OAAO;AAChE,MAAI,MAAM,IAAI,kBAAkB;AAC/B,WAAO,EAAE,QAAQ,MAAM,IAAI,kBAAkB,QAAQ,MAAM;AAAA,EAC5D;AACA,QAAM,SAAS,MAAM,MAAM,MAAM,KAAK;AACtC,MAAI,CAAC,OAAQ,QAAO;AACpB,SAAO;AAAA,IACN,QAAQ,OAAO;AAAA,IACf,QAAQ;AAAA,IACR,GAAI,OAAO,QAAQ,EAAE,OAAO,OAAO,MAAM,IAAI,CAAC;AAAA,IAC9C,GAAI,OAAO,WAAW,EAAE,UAAU,OAAO,SAAS,IAAI,CAAC;AAAA,IACvD,GAAI,OAAO,YAAY,EAAE,WAAW,OAAO,UAAU,IAAI,CAAC;AAAA,IAC1D,GAAI,OAAO,QAAQ,EAAE,OAAO,OAAO,MAAM,IAAI,CAAC;AAAA,EAC/C;AACD;AAEO,SAAS,QAAQ,QAAwB;AAC/C,SAAO,OAAO,UAAU,IACrB,WACA,GAAG,OAAO,MAAM,GAAG,CAAC,CAAC,MAAM,OAAO,MAAM,EAAE,CAAC;AAC/C;;;ACXA,IAAM,sBAA8C;AAAA,EACnD,gBAAgB;AAAA,EAChB,qBACC;AAAA,EACD,4BACC;AAAA,EACD,yBACC;AAAA,EACD,qBAAqB;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mB,CAAC;AAC1B,mBAAiB,SAAS,OAAO;AAChC,WAAO;AAAA,MACN,OAAO,UAAU,WAAW,OAAO,KAAK,KAAK,IAAI,OAAO,KAAK,KAAK;AAAA,IACnE;AAAA,EACD;AACA,SAAO,OAAO,OAAO,MAAM;AAC5B;;;AqBpoBA,aAAa,EAAE,OAAO,sBAAsB,EAAE,CAAC,EAC7C,WAAW,QAAQ,IAAI,EACvB,MAAM,CAACC,WAAmB;AAC1B,UAAQ,MAAMA,MAAK;AACnB,UAAQ,WAAW;AACpB,CAAC;","names":["error","pc","pc","pc","hasCredential","hasCredential","listItems","error","import_promises","import_picocolors","pc","text","import_promises","error","error","import_node_crypto","error","isFileSystemError","MAX_BUNDLE_FILE_COUNT","import_promises","import_node_path","error","deps","result","writeFile","join","error"]}
1
+ {"version":3,"sources":["../src/program.ts","../src/auth.ts","../src/output.ts","../src/ui.ts","../src/fmt.ts","../src/commands/account.ts","../src/commands/api-keys.ts","../src/commands/commands.ts","../src/commands/deployments.ts","../src/commands/doctor.ts","../src/commands/drops.ts","../src/options.ts","../src/commands/login.ts","../src/commands/logout.ts","../src/commands/publish.ts","../src/spinner.ts","../src/commands/json_body.ts","../src/commands/update.ts","../src/commands/whoami.ts","../src/context.ts","../src/storage.ts","../src/cli.ts"],"sourcesContent":["import { Command, InvalidArgumentError } from \"commander\";\nimport { resolveCredential } from \"./auth.js\";\nimport { runAccountGet } from \"./commands/account.js\";\nimport {\n\trunApiKeysCreate,\n\trunApiKeysDelete,\n\trunApiKeysList,\n} from \"./commands/api-keys.js\";\nimport { runCommands } from \"./commands/commands.js\";\nimport {\n\trunDeploymentsGet,\n\trunDeploymentsList,\n} from \"./commands/deployments.js\";\nimport { runDoctor } from \"./commands/doctor.js\";\nimport {\n\trunDropsDelete,\n\trunDropsGet,\n\trunDropsList,\n\trunDropsUpdate,\n} from \"./commands/drops.js\";\nimport {\n\trunLoginInteractive,\n\trunLoginRequest,\n\trunLoginVerify,\n} from \"./commands/login.js\";\nimport { runLogout } from \"./commands/logout.js\";\nimport { runPublish } from \"./commands/publish.js\";\nimport { runUpdate } from \"./commands/update.js\";\nimport { runWhoami } from \"./commands/whoami.js\";\nimport { createContext, type GlobalOptions } from \"./context.js\";\nimport type { RawDropOptions } from \"./options.js\";\nimport { type CredentialStore, MemoryCredentialStore } from \"./storage.js\";\n\ntype BuildProgramOptions = {\n\tstore?: CredentialStore;\n\tclient?: unknown;\n\tenv?: Record<string, string | undefined>;\n\tstdin?: AsyncIterable<string | Uint8Array>;\n\tstdout?: (value: string) => void;\n\tstderr?: (value: string) => void;\n\tstdoutIsTTY?: boolean;\n\tstdinIsTTY?: boolean;\n};\n\nexport function buildProgram(options: BuildProgramOptions = {}): Command {\n\tconst program = new Command();\n\tconst store = options.store ?? new MemoryCredentialStore();\n\tprogram\n\t\t.name(\"dropthis\")\n\t\t.description(\"Publish anything online and get a URL back.\")\n\t\t.version(PKG_VERSION);\n\tprogram.option(\"--api-key <key>\", \"Override API key for this invocation\");\n\tprogram.option(\"--api-url <url>\", \"Override API base URL\");\n\tprogram.option(\"--json\", \"Force JSON output\");\n\tprogram.option(\"-q, --quiet\", \"Suppress status output and imply JSON\");\n\n\tprogram\n\t\t.command(\"login\")\n\t\t.description(\"Authenticate with email OTP\")\n\t\t.option(\"--email <email>\", \"Email address\")\n\t\t.option(\"--otp <otp>\", \"One-time passcode\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(\n\t\t\tasync (commandOptions: {\n\t\t\t\temail?: string;\n\t\t\t\totp?: string;\n\t\t\t\tjson?: boolean;\n\t\t\t}) => {\n\t\t\t\tif (!commandOptions.email || !commandOptions.otp) {\n\t\t\t\t\tconst deps = await commandDeps<\n\t\t\t\t\t\tParameters<typeof runLoginInteractive>[0][\"client\"]\n\t\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\t\tconst global = globalOptions(program, commandOptions);\n\t\t\t\t\tconst context = createContext({ global });\n\t\t\t\t\tconst result = await runLoginInteractive({\n\t\t\t\t\t\t...deps,\n\t\t\t\t\t\tcreateClient: (apiKey) =>\n\t\t\t\t\t\t\tcontext.createClient(apiKey) as Parameters<\n\t\t\t\t\t\t\t\ttypeof runLoginInteractive\n\t\t\t\t\t\t\t>[0][\"client\"],\n\t\t\t\t\t});\n\t\t\t\t\tprocess.exitCode = result.exitCode;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst deps = await commandDeps<\n\t\t\t\t\tParameters<typeof runLoginVerify>[1][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst global = globalOptions(program, commandOptions);\n\t\t\t\tconst verifyContext = createContext({ global });\n\t\t\t\tconst result = await runLoginVerify(\n\t\t\t\t\t{\n\t\t\t\t\t\temail: commandOptions.email,\n\t\t\t\t\t\totp: commandOptions.otp,\n\t\t\t\t\t\t...(commandOptions.json !== undefined\n\t\t\t\t\t\t\t? { json: commandOptions.json }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t...deps,\n\t\t\t\t\t\tcreateClient: (apiKey) =>\n\t\t\t\t\t\t\tverifyContext.createClient(apiKey) as Parameters<\n\t\t\t\t\t\t\t\ttypeof runLoginVerify\n\t\t\t\t\t\t\t>[1][\"client\"],\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t\tprocess.exitCode = result.exitCode;\n\t\t\t},\n\t\t);\n\n\tconst login = program.commands.find((command) => command.name() === \"login\");\n\tlogin\n\t\t?.command(\"request\")\n\t\t.description(\"Request an email OTP\")\n\t\t.requiredOption(\"--email <email>\", \"Email address\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(async (commandOptions: { email: string; json?: boolean }) => {\n\t\t\tconst deps = await commandDeps<\n\t\t\t\tParameters<typeof runLoginRequest>[1][\"client\"]\n\t\t\t>(program, options, store, commandOptions);\n\t\t\tconst result = await runLoginRequest(commandOptions, deps);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\tlogin\n\t\t?.command(\"verify\")\n\t\t.description(\"Verify email OTP and store an API key\")\n\t\t.requiredOption(\"--email <email>\", \"Email address\")\n\t\t.requiredOption(\"--otp <otp>\", \"One-time passcode\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(\n\t\t\tasync (commandOptions: {\n\t\t\t\temail: string;\n\t\t\t\totp: string;\n\t\t\t\tjson?: boolean;\n\t\t\t}) => {\n\t\t\t\tconst deps = await commandDeps<\n\t\t\t\t\tParameters<typeof runLoginVerify>[1][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst global = globalOptions(program, commandOptions);\n\t\t\t\tconst verifySubContext = createContext({ global });\n\t\t\t\tconst result = await runLoginVerify(commandOptions, {\n\t\t\t\t\t...deps,\n\t\t\t\t\tcreateClient: (apiKey) =>\n\t\t\t\t\t\tverifySubContext.createClient(apiKey) as Parameters<\n\t\t\t\t\t\t\ttypeof runLoginVerify\n\t\t\t\t\t\t>[1][\"client\"],\n\t\t\t\t});\n\t\t\t\tprocess.exitCode = result.exitCode;\n\t\t\t},\n\t\t);\n\n\tprogram\n\t\t.command(\"logout\")\n\t\t.description(\"Remove stored credentials\")\n\t\t.option(\"--revoke\", \"Best-effort revoke the saved API key\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(async (commandOptions: { revoke?: boolean; json?: boolean }) => {\n\t\t\tconst deps = await commandDeps<Parameters<typeof runLogout>[1][\"client\"]>(\n\t\t\t\tprogram,\n\t\t\t\toptions,\n\t\t\t\tstore,\n\t\t\t\tcommandOptions,\n\t\t\t);\n\t\t\tconst result = await runLogout(commandOptions, deps);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\n\tprogram\n\t\t.command(\"whoami\")\n\t\t.description(\"Show current authentication status\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(async (commandOptions: { json?: boolean }) => {\n\t\t\tconst deps = await commandDeps<unknown>(\n\t\t\t\tprogram,\n\t\t\t\toptions,\n\t\t\t\tstore,\n\t\t\t\tcommandOptions,\n\t\t\t);\n\t\t\tconst result = await runWhoami(commandOptions, deps);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\n\tprogram\n\t\t.command(\"account\")\n\t\t.description(\"Account commands\")\n\t\t.command(\"get\")\n\t\t.description(\"Get account details\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(async (commandOptions: { json?: boolean }) => {\n\t\t\tconst deps = await commandDeps<\n\t\t\t\tParameters<typeof runAccountGet>[1][\"client\"]\n\t\t\t>(program, options, store, commandOptions);\n\t\t\tconst result = await runAccountGet(commandOptions, deps);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\n\tprogram\n\t\t.command(\"publish [input...]\")\n\t\t.description(\n\t\t\t\"Publish files, folders, URLs, strings, or stdin.\\nMultiple files are bundled into one drop.\\nUse - to read stdin explicitly, or pipe without args.\",\n\t\t)\n\t\t.option(\"--from-json <path>\", \"Read exact POST /drops JSON request body\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.option(\"--title <title>\", \"Drop title\")\n\t\t.option(\"--visibility <visibility>\", \"Drop visibility\")\n\t\t.option(\"--password <password>\", \"Set password\")\n\t\t.option(\"--no-password\", \"Clear password\")\n\t\t.option(\"--noindex\", \"Prevent indexing\")\n\t\t.option(\"--index\", \"Allow indexing\")\n\t\t.option(\"--expires-at <datetime>\", \"Expiration datetime\")\n\t\t.option(\"--metadata <json>\", \"Metadata JSON object\")\n\t\t.option(\"--metadata-file <path>\", \"Metadata JSON file\")\n\t\t.option(\"--entry <path>\", \"Entry file path\")\n\t\t.option(\"--content-type <mime>\", \"Content type\")\n\t\t.option(\"--path <path>\", \"Path for stdin or byte input\")\n\t\t.option(\"--idempotency-key <key>\", \"Idempotency key\")\n\t\t.option(\"--url\", \"Print only the published URL\")\n\t\t.option(\"--dry-run\", \"Validate without publishing\")\n\t\t.action(async (inputs: string[], commandOptions: RawCommandOptions) => {\n\t\t\tconst deps = await commandDeps<\n\t\t\t\tParameters<typeof runPublish>[2][\"client\"]\n\t\t\t>(program, options, store, commandOptions);\n\t\t\tconst stdinIsTTY = options.stdinIsTTY ?? process.stdin.isTTY ?? false;\n\t\t\tlet publishInput: string | string[] | undefined;\n\t\t\tif (commandOptions.dryRun && inputs.length > 1) {\n\t\t\t\tpublishInput = inputs;\n\t\t\t} else {\n\t\t\t\tpublishInput = await resolvePublishInputs(\n\t\t\t\t\tinputs,\n\t\t\t\t\toptions.stdin,\n\t\t\t\t\tstdinIsTTY,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst result = await runPublish(\n\t\t\t\tpublishInput,\n\t\t\t\ttoDropOptions(commandOptions),\n\t\t\t\tdeps,\n\t\t\t);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\n\tprogram\n\t\t.command(\"update <target> [input]\")\n\t\t.description(\"Update an existing drop by id\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.option(\"--slug <slug>\", \"Replace shared hosted drop slug\")\n\t\t.option(\"--title <title>\", \"Drop title\")\n\t\t.option(\"--visibility <visibility>\", \"Drop visibility\")\n\t\t.option(\"--password <password>\", \"Set password\")\n\t\t.option(\"--no-password\", \"Clear password\")\n\t\t.option(\"--noindex\", \"Prevent indexing\")\n\t\t.option(\"--index\", \"Allow indexing\")\n\t\t.option(\"--expires-at <datetime>\", \"Expiration datetime\")\n\t\t.option(\"--metadata <json>\", \"Metadata JSON object\")\n\t\t.option(\"--metadata-file <path>\", \"Metadata JSON file\")\n\t\t.option(\"--entry <path>\", \"Entry file path\")\n\t\t.option(\"--content-type <mime>\", \"Content type\")\n\t\t.option(\"--path <path>\", \"Path for stdin or byte input\")\n\t\t.option(\"--idempotency-key <key>\", \"Idempotency key\")\n\t\t.option(\"--if-revision <n>\", \"Expected current revision\", parseInteger)\n\t\t.option(\n\t\t\t\"--from-json <path>\",\n\t\t\t\"Read exact POST /drops/{drop_id}/deployments JSON request body\",\n\t\t)\n\t\t.option(\"--url\", \"Print only the published URL\")\n\t\t.option(\"--dry-run\", \"Validate without publishing\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\ttarget: string,\n\t\t\t\tinput: string | undefined,\n\t\t\t\tcommandOptions: RawCommandOptions & { ifRevision?: number },\n\t\t\t) => {\n\t\t\t\tconst deps = await commandDeps<\n\t\t\t\t\tParameters<typeof runUpdate>[3][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst updateInput = input\n\t\t\t\t\t? await resolveCommandInput(input, options.stdin)\n\t\t\t\t\t: undefined;\n\t\t\t\tconst result = await runUpdate(\n\t\t\t\t\ttarget,\n\t\t\t\t\tupdateInput,\n\t\t\t\t\ttoDropOptions(commandOptions),\n\t\t\t\t\tdeps,\n\t\t\t\t);\n\t\t\t\tprocess.exitCode = result.exitCode;\n\t\t\t},\n\t\t);\n\n\tconst drops = program.command(\"drops\").description(\"Drop resource commands\");\n\tdrops\n\t\t.command(\"list\")\n\t\t.option(\"--limit <n>\", \"Page size\", parseInteger)\n\t\t.option(\"--cursor <cursor>\", \"Pagination cursor\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(\n\t\t\tasync (commandOptions: {\n\t\t\t\tlimit?: number;\n\t\t\t\tcursor?: string;\n\t\t\t\tjson?: boolean;\n\t\t\t}) => {\n\t\t\t\tconst deps = await commandDeps<\n\t\t\t\t\tParameters<typeof runDropsList>[1][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst result = await runDropsList(commandOptions, deps);\n\t\t\t\tprocess.exitCode = result.exitCode;\n\t\t\t},\n\t\t);\n\tdrops\n\t\t.command(\"get <dropId>\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(async (dropId: string, commandOptions: { json?: boolean }) => {\n\t\t\tconst deps = await commandDeps<\n\t\t\t\tParameters<typeof runDropsGet>[2][\"client\"]\n\t\t\t>(program, options, store, commandOptions);\n\t\t\tconst result = await runDropsGet(dropId, commandOptions, deps);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\tdrops\n\t\t.command(\"update <dropId>\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.option(\"--title <title>\", \"Drop title\")\n\t\t.option(\"--visibility <visibility>\", \"Drop visibility\")\n\t\t.option(\"--password <password>\", \"Set password\")\n\t\t.option(\"--no-password\", \"Clear password\")\n\t\t.option(\"--noindex\", \"Prevent indexing\")\n\t\t.option(\"--index\", \"Allow indexing\")\n\t\t.option(\"--expires-at <datetime>\", \"Expiration datetime\")\n\t\t.option(\"--metadata <json>\", \"Metadata JSON object\")\n\t\t.option(\"--metadata-file <path>\", \"Metadata JSON file\")\n\t\t.action(async (dropId: string, commandOptions: RawCommandOptions) => {\n\t\t\tconst deps = await commandDeps<\n\t\t\t\tParameters<typeof runDropsUpdate>[2][\"client\"]\n\t\t\t>(program, options, store, commandOptions);\n\t\t\tconst result = await runDropsUpdate(\n\t\t\t\tdropId,\n\t\t\t\ttoDropOptions(commandOptions),\n\t\t\t\tdeps,\n\t\t\t);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\tdrops\n\t\t.command(\"delete <dropId>\")\n\t\t.option(\"--yes\", \"Confirm deletion\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tdropId: string,\n\t\t\t\tcommandOptions: { yes?: boolean; json?: boolean },\n\t\t\t) => {\n\t\t\t\tconst deps = await commandDeps<\n\t\t\t\t\tParameters<typeof runDropsDelete>[2][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst result = await runDropsDelete(\n\t\t\t\t\tdropId,\n\t\t\t\t\t{ ...commandOptions, interactive: deps.outputMode === \"human\" },\n\t\t\t\t\tdeps,\n\t\t\t\t);\n\t\t\t\tprocess.exitCode = result.exitCode;\n\t\t\t},\n\t\t);\n\n\tconst apiKeys = program.command(\"api-keys\").description(\"API key commands\");\n\tapiKeys\n\t\t.command(\"create\")\n\t\t.option(\"--label <label>\", \"API key label\", \"CLI\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(async (commandOptions: { label: string; json?: boolean }) => {\n\t\t\tconst deps = await commandDeps<\n\t\t\t\tParameters<typeof runApiKeysCreate>[1][\"client\"]\n\t\t\t>(program, options, store, commandOptions);\n\t\t\tconst result = await runApiKeysCreate(commandOptions, deps);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\tapiKeys\n\t\t.command(\"list\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(async (commandOptions: { json?: boolean }) => {\n\t\t\tconst deps = await commandDeps<\n\t\t\t\tParameters<typeof runApiKeysList>[1][\"client\"]\n\t\t\t>(program, options, store, commandOptions);\n\t\t\tconst result = await runApiKeysList(commandOptions, deps);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\tapiKeys\n\t\t.command(\"delete <keyId>\")\n\t\t.option(\"--yes\", \"Confirm deletion\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tkeyId: string,\n\t\t\t\tcommandOptions: { yes?: boolean; json?: boolean },\n\t\t\t) => {\n\t\t\t\tconst deps = await commandDeps<\n\t\t\t\t\tParameters<typeof runApiKeysDelete>[2][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst result = await runApiKeysDelete(\n\t\t\t\t\tkeyId,\n\t\t\t\t\t{ ...commandOptions, interactive: deps.outputMode === \"human\" },\n\t\t\t\t\tdeps,\n\t\t\t\t);\n\t\t\t\tprocess.exitCode = result.exitCode;\n\t\t\t},\n\t\t);\n\n\tconst deployments = program\n\t\t.command(\"deployments\")\n\t\t.description(\"Deployment commands\");\n\tdeployments\n\t\t.command(\"list <dropId>\")\n\t\t.option(\"--limit <n>\", \"Page size\", parseInteger)\n\t\t.option(\"--cursor <cursor>\", \"Pagination cursor\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tdropId: string,\n\t\t\t\tcommandOptions: { limit?: number; cursor?: string; json?: boolean },\n\t\t\t) => {\n\t\t\t\tconst deps = await commandDeps<\n\t\t\t\t\tParameters<typeof runDeploymentsList>[2][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst result = await runDeploymentsList(dropId, commandOptions, deps);\n\t\t\t\tprocess.exitCode = result.exitCode;\n\t\t\t},\n\t\t);\n\tdeployments\n\t\t.command(\"get <dropId> <deploymentId>\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tdropId: string,\n\t\t\t\tdeploymentId: string,\n\t\t\t\tcommandOptions: { json?: boolean },\n\t\t\t) => {\n\t\t\t\tconst deps = await commandDeps<\n\t\t\t\t\tParameters<typeof runDeploymentsGet>[3][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst result = await runDeploymentsGet(\n\t\t\t\t\tdropId,\n\t\t\t\t\tdeploymentId,\n\t\t\t\t\tcommandOptions,\n\t\t\t\t\tdeps,\n\t\t\t\t);\n\t\t\t\tprocess.exitCode = result.exitCode;\n\t\t\t},\n\t\t);\n\n\tprogram\n\t\t.command(\"doctor\")\n\t\t.description(\"Report CLI diagnostics\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(async (commandOptions: { json?: boolean }) => {\n\t\t\tconst deps = await commandDeps<unknown>(\n\t\t\t\tprogram,\n\t\t\t\toptions,\n\t\t\t\tstore,\n\t\t\t\tcommandOptions,\n\t\t\t);\n\t\t\tconst result = await runDoctor(commandOptions, deps);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\n\tprogram\n\t\t.command(\"commands\")\n\t\t.description(\"Print machine-readable command metadata\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(async (commandOptions: { json?: boolean }) => {\n\t\t\tconst deps = await commandDeps<unknown>(\n\t\t\t\tprogram,\n\t\t\t\toptions,\n\t\t\t\tstore,\n\t\t\t\tcommandOptions,\n\t\t\t);\n\t\t\tconst result = await runCommands(commandOptions, deps);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\n\treturn program;\n}\n\ntype RawCommandOptions = Omit<RawDropOptions, \"password\"> & {\n\tjson?: boolean;\n\tquiet?: boolean;\n\turl?: boolean;\n\tifRevision?: number;\n\tfromJson?: string;\n\tdryRun?: boolean;\n\tpassword?: string | boolean;\n};\n\ntype RunnerDeps<TClient> = {\n\tstore: CredentialStore;\n\tclient: TClient;\n\tapiKey?: string;\n\tenv: Record<string, string | undefined>;\n\tstdout: (value: string) => void;\n\tstderr: (value: string) => void;\n\toutputMode: \"human\" | \"json\";\n};\n\nasync function commandDeps<TClient>(\n\tprogram: Command,\n\toptions: BuildProgramOptions,\n\tstore: CredentialStore,\n\tcommandOptions: { json?: boolean; quiet?: boolean },\n): Promise<RunnerDeps<TClient>> {\n\tconst global = globalOptions(program, commandOptions);\n\tconst context = createContext({\n\t\tglobal,\n\t\t...(options.env !== undefined ? { env: options.env } : {}),\n\t\t...(options.stdout !== undefined ? { stdout: options.stdout } : {}),\n\t\t...(options.stderr !== undefined ? { stderr: options.stderr } : {}),\n\t\t...(options.stdoutIsTTY !== undefined\n\t\t\t? { stdoutIsTTY: options.stdoutIsTTY }\n\t\t\t: {}),\n\t});\n\tconst credential = await resolveCredential({\n\t\t...(global.apiKey ? { apiKey: global.apiKey } : {}),\n\t\tenv: context.env,\n\t\tstore,\n\t});\n\treturn {\n\t\tstore,\n\t\tclient: (options.client ??\n\t\t\tcontext.createClient(credential?.apiKey)) as TClient,\n\t\t...(global.apiKey ? { apiKey: global.apiKey } : {}),\n\t\tenv: context.env,\n\t\tstdout: context.stdout,\n\t\tstderr: context.stderr,\n\t\toutputMode: context.output.mode,\n\t};\n}\n\nfunction globalOptions(\n\tprogram: Command,\n\tcommandOptions: { json?: boolean; quiet?: boolean },\n): GlobalOptions {\n\tconst opts = program.opts<GlobalOptions>();\n\treturn {\n\t\t...(opts.apiKey ? { apiKey: opts.apiKey } : {}),\n\t\t...(opts.apiUrl ? { apiUrl: opts.apiUrl } : {}),\n\t\t...(commandOptions.json !== undefined\n\t\t\t? { json: commandOptions.json }\n\t\t\t: opts.json !== undefined\n\t\t\t\t? { json: opts.json }\n\t\t\t\t: {}),\n\t\t...(commandOptions.quiet !== undefined\n\t\t\t? { quiet: commandOptions.quiet }\n\t\t\t: opts.quiet !== undefined\n\t\t\t\t? { quiet: opts.quiet }\n\t\t\t\t: {}),\n\t};\n}\n\nfunction toDropOptions(options: RawCommandOptions): RawDropOptions & {\n\tjson?: boolean;\n\tquiet?: boolean;\n\turl?: boolean;\n\tifRevision?: number;\n\tfromJson?: string;\n\tdryRun?: boolean;\n} {\n\treturn {\n\t\t...(options.slug ? { slug: options.slug } : {}),\n\t\t...(options.title ? { title: options.title } : {}),\n\t\t...(options.visibility === \"public\" || options.visibility === \"unlisted\"\n\t\t\t? { visibility: options.visibility }\n\t\t\t: {}),\n\t\t...(typeof options.password === \"string\"\n\t\t\t? { password: options.password }\n\t\t\t: {}),\n\t\t...(options.password === false || options.noPassword\n\t\t\t? { noPassword: true }\n\t\t\t: {}),\n\t\t...(options.noindex ? { noindex: true } : {}),\n\t\t...(options.index ? { index: true } : {}),\n\t\t...(options.expiresAt ? { expiresAt: options.expiresAt } : {}),\n\t\t...(options.metadata ? { metadata: options.metadata } : {}),\n\t\t...(options.metadataFile ? { metadataFile: options.metadataFile } : {}),\n\t\t...(options.entry ? { entry: options.entry } : {}),\n\t\t...(options.contentType ? { contentType: options.contentType } : {}),\n\t\t...(options.path ? { path: options.path } : {}),\n\t\t...(options.idempotencyKey\n\t\t\t? { idempotencyKey: options.idempotencyKey }\n\t\t\t: {}),\n\t\t...(options.json !== undefined ? { json: options.json } : {}),\n\t\t...(options.quiet !== undefined ? { quiet: options.quiet } : {}),\n\t\t...(options.url !== undefined ? { url: options.url } : {}),\n\t\t...(options.ifRevision !== undefined\n\t\t\t? { ifRevision: options.ifRevision }\n\t\t\t: {}),\n\t\t...(options.fromJson ? { fromJson: options.fromJson } : {}),\n\t\t...(options.dryRun ? { dryRun: options.dryRun } : {}),\n\t};\n}\n\nfunction parseInteger(value: string): number {\n\tconst n = Number.parseInt(value, 10);\n\tif (Number.isNaN(n)) throw new InvalidArgumentError(\"Expected an integer.\");\n\treturn n;\n}\n\nasync function resolveCommandInput(\n\tinput: string,\n\tstdin?: AsyncIterable<string | Uint8Array>,\n): Promise<string> {\n\tif (input !== \"-\") return input;\n\tconst buf = await readStdinBytes(stdin ?? process.stdin);\n\treturn buf.toString(\"utf8\");\n}\n\nasync function resolvePublishInputs(\n\tinputs: string[],\n\tstdin?: AsyncIterable<string | Uint8Array>,\n\tstdinIsTTY?: boolean,\n): Promise<string | undefined> {\n\tif (inputs.length === 0) {\n\t\tif (stdinIsTTY) return undefined;\n\t\tconst buf = await readStdinBytes(stdin ?? process.stdin);\n\t\tif (buf.length === 0) return undefined;\n\t\treturn buf.toString(\"utf8\");\n\t}\n\tif (inputs.length === 1) {\n\t\tif (inputs[0] === \"-\") {\n\t\t\tconst buf = await readStdinBytes(stdin ?? process.stdin);\n\t\t\treturn buf.toString(\"utf8\");\n\t\t}\n\t\treturn inputs[0];\n\t}\n\tconst {\n\t\tmkdtemp,\n\t\tcopyFile,\n\t\twriteFile,\n\t\tstat: fsStat,\n\t} = await import(\"node:fs/promises\");\n\tconst { join, basename: pathBasename } = await import(\"node:path\");\n\tconst { tmpdir } = await import(\"node:os\");\n\tconst tmpDir = await mkdtemp(join(tmpdir(), \"dropthis-multi-\"));\n\tconst resolved: string[] = [];\n\tfor (const input of inputs) {\n\t\tif (input === \"-\") {\n\t\t\tconst buf = await readStdinBytes(stdin ?? process.stdin);\n\t\t\tconst tmpPath = join(tmpDir, `stdin-${Date.now()}`);\n\t\t\tawait writeFile(tmpPath, buf);\n\t\t\tresolved.push(tmpPath);\n\t\t} else {\n\t\t\tresolved.push(input);\n\t\t}\n\t}\n\tconst names = resolved.map((f) => pathBasename(f));\n\tconst dupes = names.filter((n, i) => names.indexOf(n) !== i);\n\tif (dupes.length > 0) {\n\t\tthrow new Error(\n\t\t\t`Duplicate file names: ${[...new Set(dupes)].join(\", \")}. Rename files to avoid collisions.`,\n\t\t);\n\t}\n\tfor (const filePath of resolved) {\n\t\tconst info = await fsStat(filePath);\n\t\tif (info.isDirectory()) {\n\t\t\tthrow new Error(\n\t\t\t\t`Cannot mix directories with multiple file arguments. Use a single folder instead: dropthis publish ${filePath}`,\n\t\t\t);\n\t\t}\n\t\tconst destName = pathBasename(filePath);\n\t\tawait copyFile(filePath, join(tmpDir, destName));\n\t}\n\treturn tmpDir;\n}\n\nasync function readStdinBytes(\n\tstdin: AsyncIterable<string | Uint8Array>,\n): Promise<Buffer> {\n\tconst chunks: Buffer[] = [];\n\tfor await (const chunk of stdin) {\n\t\tchunks.push(\n\t\t\ttypeof chunk === \"string\" ? Buffer.from(chunk) : Buffer.from(chunk),\n\t\t);\n\t}\n\treturn Buffer.concat(chunks);\n}\n","import type { CredentialStore } from \"./storage.js\";\n\nexport type ResolvedCredential = {\n\tapiKey: string;\n\tsource: \"flag\" | \"env\" | \"storage\";\n\tkeyId?: string;\n\tkeyLast4?: string;\n\taccountId?: string;\n\temail?: string;\n};\n\nexport async function resolveCredential(input: {\n\tapiKey?: string;\n\tenv: Record<string, string | undefined>;\n\tstore: CredentialStore;\n}): Promise<ResolvedCredential | null> {\n\tif (input.apiKey) return { apiKey: input.apiKey, source: \"flag\" };\n\tif (input.env.DROPTHIS_API_KEY) {\n\t\treturn { apiKey: input.env.DROPTHIS_API_KEY, source: \"env\" };\n\t}\n\tconst stored = await input.store.read();\n\tif (!stored) return null;\n\treturn {\n\t\tapiKey: stored.apiKey,\n\t\tsource: \"storage\",\n\t\t...(stored.keyId ? { keyId: stored.keyId } : {}),\n\t\t...(stored.keyLast4 ? { keyLast4: stored.keyLast4 } : {}),\n\t\t...(stored.accountId ? { accountId: stored.accountId } : {}),\n\t\t...(stored.email ? { email: stored.email } : {}),\n\t};\n}\n\nexport function maskKey(apiKey: string): string {\n\treturn apiKey.length <= 8\n\t\t? \"sk_...\"\n\t\t: `${apiKey.slice(0, 3)}...${apiKey.slice(-4)}`;\n}\n","export type OutputMode = \"human\" | \"json\";\nexport type CliErrorCode =\n\t| \"api_error\"\n\t| \"auth_error\"\n\t| \"credential_storage_unavailable\"\n\t| \"generic_error\"\n\t| \"invalid_usage\"\n\t| \"local_input_error\"\n\t| \"network_error\";\n\nexport type Output = {\n\tmode: OutputMode;\n\tquiet: boolean;\n};\n\nexport type ApiErrorDetails = {\n\tcode?: string;\n\tmessage: string;\n\tstatusCode?: number | null;\n\tdetail?: unknown;\n\tparam?: string | null;\n\tcurrentRevision?: number;\n\trequestId?: string | null;\n};\n\nconst UPLOAD_NEXT_ACTIONS: Record<string, string> = {\n\tupload_expired: \"Create a new upload session and retry the publish.\",\n\tupload_already_used:\n\t\t\"Create a new upload session; upload sessions are single-use.\",\n\tupload_verification_failed:\n\t\t\"Re-upload the file bytes and complete the upload again.\",\n\ttoo_many_active_uploads:\n\t\t\"Cancel unused uploads or wait for expired uploads to be cleaned.\",\n\tupload_not_complete: \"Complete the upload session before publishing.\",\n};\n\nexport function createOutput(input: {\n\tjson?: boolean;\n\tquiet?: boolean;\n\tstdoutIsTTY: boolean;\n\tenv: Record<string, string | undefined>;\n}): Output {\n\tconst json =\n\t\tinput.json === true ||\n\t\tinput.quiet === true ||\n\t\tinput.stdoutIsTTY === false ||\n\t\tinput.env.CI === \"true\";\n\treturn { mode: json ? \"json\" : \"human\", quiet: input.quiet === true };\n}\n\nexport function successEnvelope<T>(data: T): { ok: true; data: T } {\n\treturn { ok: true, data };\n}\n\nexport function errorEnvelope(\n\tcode: CliErrorCode,\n\tmessage: string,\n\tnextAction?: string,\n): {\n\tok: false;\n\terror: { code: CliErrorCode; message: string; next_action?: string };\n} {\n\treturn {\n\t\tok: false,\n\t\terror: {\n\t\t\tcode,\n\t\t\tmessage,\n\t\t\t...(nextAction ? { next_action: nextAction } : {}),\n\t\t},\n\t};\n}\n\nexport function apiErrorEnvelope(error: ApiErrorDetails): {\n\tok: false;\n\terror: Record<string, unknown>;\n} {\n\treturn {\n\t\tok: false,\n\t\terror: {\n\t\t\tcode: error.code ?? \"api_error\",\n\t\t\tmessage: error.message,\n\t\t\t...(error.statusCode !== undefined ? { status: error.statusCode } : {}),\n\t\t\t...(typeof error.detail === \"string\" ? { detail: error.detail } : {}),\n\t\t\t...(error.param ? { param: error.param } : {}),\n\t\t\t...(error.currentRevision !== undefined\n\t\t\t\t? { current_revision: error.currentRevision }\n\t\t\t\t: {}),\n\t\t\t...(error.requestId ? { request_id: error.requestId } : {}),\n\t\t\tnext_action: nextActionForApiError(error),\n\t\t},\n\t};\n}\n\nfunction nextActionForApiError(error: ApiErrorDetails): string {\n\tconst uploadNextAction = error.code\n\t\t? UPLOAD_NEXT_ACTIONS[error.code]\n\t\t: undefined;\n\tif (uploadNextAction) return uploadNextAction;\n\tif (error.code === \"revision_conflict\") {\n\t\treturn \"Fetch the drop, merge your changes, and retry with the current revision.\";\n\t}\n\tif (error.statusCode === 401 || error.code === \"missing_api_key\") {\n\t\treturn \"Authenticate with dropthis login or set DROPTHIS_API_KEY.\";\n\t}\n\tif (error.statusCode === 413 || error.code === \"quota_exceeded\") {\n\t\treturn \"Reduce the upload size or upgrade the account limit.\";\n\t}\n\tif (error.statusCode === 422) {\n\t\treturn \"Fix the input shown in the error detail and retry.\";\n\t}\n\tif (\n\t\terror.statusCode !== undefined &&\n\t\terror.statusCode !== null &&\n\t\terror.statusCode >= 500\n\t) {\n\t\treturn \"Retry the request with the same idempotency key, or contact support with the request id.\";\n\t}\n\treturn \"Fix the request or retry after checking the drop state.\";\n}\n\nexport function exitCodeFor(code: CliErrorCode): number {\n\tif (code === \"invalid_usage\") return 2;\n\tif (code === \"auth_error\") return 3;\n\tif (code === \"local_input_error\") return 4;\n\tif (code === \"network_error\") return 5;\n\treturn 1;\n}\n","import pc from \"picocolors\";\n\nexport const symbols = {\n\tsuccess: \"✓\",\n\terror: \"✗\",\n\twarning: \"!\",\n} as const;\n\nexport function success(msg: string): string {\n\treturn `${pc.green(symbols.success)} ${msg}`;\n}\n\nexport function error(msg: string): string {\n\treturn `${pc.red(symbols.error)} ${msg}`;\n}\n\nexport function warn(msg: string): string {\n\treturn `${pc.yellow(symbols.warning)} ${msg}`;\n}\n\nexport function hint(msg: string): string {\n\treturn ` ${pc.dim(msg)}`;\n}\n\nexport function url(u: string): string {\n\treturn pc.cyan(u);\n}\n\nexport function label(key: string, value: string): string {\n\treturn `${pc.dim(`${key}:`)} ${value}`;\n}\n\nexport function kvLines(pairs: Array<[key: string, value: string]>): string {\n\tif (pairs.length === 0) return \"\";\n\tconst maxKey = Math.max(...pairs.map(([k]) => k.length));\n\treturn pairs\n\t\t.map(([k, v]) => ` ${pc.dim(`${k.padEnd(maxKey)}:`)} ${v}`)\n\t\t.join(\"\\n\");\n}\n","import type { ApiErrorDetails } from \"./output.js\";\nimport {\n\tapiErrorEnvelope,\n\ttype CliErrorCode,\n\terrorEnvelope,\n\texitCodeFor,\n} from \"./output.js\";\nimport { error, hint, kvLines, success, url } from \"./ui.js\";\n\ntype WriterDeps = {\n\tstdout: (value: string) => void;\n\tstderr: (value: string) => void;\n\toutputMode?: \"human\" | \"json\";\n};\n\nexport function writeSuccess(\n\tdeps: WriterDeps,\n\tmessage: string,\n\tlink?: string,\n): void {\n\tif (deps.outputMode === \"human\") {\n\t\tconst text = link ? `${message} ${url(link)}` : message;\n\t\tdeps.stdout(`${success(text)}\\n`);\n\t}\n}\n\nexport function writeUrl(deps: WriterDeps, link: string): void {\n\tdeps.stdout(`${url(link)}\\n`);\n}\n\nexport function writeResult(\n\tdeps: WriterDeps,\n\tlink: string,\n\tverb: string,\n\tdata: Record<string, unknown>,\n): void {\n\tif (deps.outputMode === \"human\") {\n\t\tdeps.stdout(`${success(`${verb} ${url(link)}`)}\\n`);\n\t} else {\n\t\tdeps.stdout(`${JSON.stringify({ ok: true, drop: data })}\\n`);\n\t}\n}\n\nexport function writeJson(\n\tdeps: WriterDeps,\n\tenvelope: Record<string, unknown>,\n): void {\n\tdeps.stdout(`${JSON.stringify(envelope)}\\n`);\n}\n\nexport function writeKv(\n\tdeps: WriterDeps,\n\tpairs: Array<[string, string]>,\n\tjson: Record<string, unknown>,\n): void {\n\tif (deps.outputMode === \"human\") {\n\t\tdeps.stdout(`${kvLines(pairs)}\\n`);\n\t} else {\n\t\tdeps.stdout(`${JSON.stringify(json)}\\n`);\n\t}\n}\n\nexport function writeHumanOrJson(\n\tdeps: WriterDeps,\n\thumanText: string,\n\tjson: Record<string, unknown>,\n): void {\n\tif (deps.outputMode === \"human\") {\n\t\tdeps.stdout(`${humanText}\\n`);\n\t} else {\n\t\tdeps.stdout(`${JSON.stringify(json)}\\n`);\n\t}\n}\n\nexport function writeError(\n\tdeps: WriterDeps,\n\tcode: CliErrorCode,\n\tmessage: string,\n\tnextAction?: string,\n): { exitCode: number } {\n\tif (deps.outputMode === \"human\") {\n\t\tdeps.stderr(`${error(message)}\\n`);\n\t\tif (nextAction) deps.stderr(`${hint(nextAction)}\\n`);\n\t} else {\n\t\tdeps.stderr(\n\t\t\t`${JSON.stringify(errorEnvelope(code, message, nextAction))}\\n`,\n\t\t);\n\t}\n\treturn { exitCode: exitCodeFor(code) };\n}\n\nexport function writeApiError(\n\tdeps: WriterDeps,\n\tdetails: ApiErrorDetails,\n): { exitCode: number } {\n\tif (deps.outputMode === \"human\") {\n\t\tdeps.stderr(`${error(details.message)}\\n`);\n\t\tconst nextAction = details.requestId\n\t\t\t? `Request ID: ${details.requestId}`\n\t\t\t: undefined;\n\t\tif (nextAction) deps.stderr(`${hint(nextAction)}\\n`);\n\t} else {\n\t\tdeps.stderr(`${JSON.stringify(apiErrorEnvelope(details))}\\n`);\n\t}\n\treturn { exitCode: exitCodeFor(\"api_error\") };\n}\n\nexport function writeApiErrorSimple(\n\tdeps: WriterDeps,\n\tmessage: string,\n): { exitCode: number } {\n\tif (deps.outputMode === \"human\") {\n\t\tdeps.stderr(`${error(message)}\\n`);\n\t} else {\n\t\tdeps.stderr(`${JSON.stringify(errorEnvelope(\"api_error\", message))}\\n`);\n\t}\n\treturn { exitCode: exitCodeFor(\"api_error\") };\n}\n\nexport function writeAuthError(deps: WriterDeps): { exitCode: number } {\n\treturn writeError(\n\t\tdeps,\n\t\t\"auth_error\",\n\t\t\"No API key found.\",\n\t\t\"Set DROPTHIS_API_KEY or run dropthis login.\",\n\t);\n}\n\nexport function writeEmpty(\n\tdeps: WriterDeps,\n\tmessage: string,\n\tjson: Record<string, unknown>,\n): void {\n\tif (deps.outputMode === \"human\") {\n\t\tdeps.stdout(`${message}\\n`);\n\t} else {\n\t\tdeps.stdout(`${JSON.stringify(json)}\\n`);\n\t}\n}\n","import { resolveCredential } from \"../auth.js\";\nimport { writeApiErrorSimple, writeAuthError, writeKv } from \"../fmt.js\";\nimport type { CredentialStore } from \"../storage.js\";\n\ntype SdkResult<T> =\n\t| { data: T; error: null; headers?: Record<string, string> }\n\t| {\n\t\t\tdata: null;\n\t\t\terror: { message: string };\n\t\t\theaders?: Record<string, string>;\n\t };\n\ntype AccountClient = {\n\taccount: { get(): Promise<SdkResult<unknown>> };\n};\n\ntype CommandDeps = {\n\tstore: CredentialStore;\n\tclient: AccountClient;\n\tapiKey?: string;\n\tenv: Record<string, string | undefined>;\n\tstdout: (value: string) => void;\n\tstderr: (value: string) => void;\n\toutputMode?: \"human\" | \"json\";\n};\n\nexport async function runAccountGet(\n\t_input: { json?: boolean },\n\tdeps: CommandDeps,\n): Promise<{ exitCode: number }> {\n\tif (\n\t\t(await resolveCredential({\n\t\t\t...(deps.apiKey ? { apiKey: deps.apiKey } : {}),\n\t\t\tenv: deps.env,\n\t\t\tstore: deps.store,\n\t\t})) === null\n\t) {\n\t\treturn writeAuthError(deps);\n\t}\n\tconst result = await deps.client.account.get();\n\tif (result.error) {\n\t\treturn writeApiErrorSimple(deps, result.error.message);\n\t}\n\tconst data = result.data as Record<string, unknown> | null;\n\tconst pairs: Array<[string, string]> = [];\n\tif (data?.id) pairs.push([\"ID\", String(data.id)]);\n\tif (data?.email) pairs.push([\"Email\", String(data.email)]);\n\tif (data?.plan) pairs.push([\"Plan\", String(data.plan)]);\n\n\twriteKv(deps, pairs, { ok: true, account: result.data });\n\treturn { exitCode: 0 };\n}\n","import * as prompts from \"@clack/prompts\";\nimport { resolveCredential } from \"../auth.js\";\nimport {\n\twriteApiErrorSimple,\n\twriteAuthError,\n\twriteEmpty,\n\twriteError,\n\twriteHumanOrJson,\n\twriteJson,\n\twriteKv,\n} from \"../fmt.js\";\nimport type { CredentialStore } from \"../storage.js\";\nimport { success } from \"../ui.js\";\n\ntype SdkResult<T> =\n\t| { data: T; error: null; headers?: Record<string, string> }\n\t| {\n\t\t\tdata: null;\n\t\t\terror: { message: string };\n\t\t\theaders?: Record<string, string>;\n\t };\n\ntype ApiKeysCreateClient = {\n\tapiKeys: {\n\t\tcreate(input: {\n\t\t\tlabel: string;\n\t\t}): Promise<SdkResult<Record<string, unknown>>>;\n\t};\n};\n\ntype ApiKeysListClient = {\n\tapiKeys: {\n\t\tlist(): Promise<SdkResult<unknown>>;\n\t};\n};\n\ntype ApiKeysDeleteClient = {\n\tapiKeys: {\n\t\tdelete(\n\t\t\tkeyId: string,\n\t\t): Promise<SdkResult<null>> | SdkResult<null> | undefined;\n\t};\n};\n\ntype CommandDeps<TClient> = {\n\tstore: CredentialStore;\n\tclient: TClient;\n\tapiKey?: string;\n\tenv: Record<string, string | undefined>;\n\tstdout: (value: string) => void;\n\tstderr: (value: string) => void;\n\toutputMode?: \"human\" | \"json\";\n};\n\nexport async function runApiKeysCreate(\n\tinput: { label: string; json?: boolean },\n\tdeps: CommandDeps<ApiKeysCreateClient>,\n): Promise<{ exitCode: number }> {\n\tif (!(await hasCredential(deps))) return writeAuthError(deps);\n\tconst result = await deps.client.apiKeys.create({ label: input.label });\n\tif (result.error) return writeApiErrorSimple(deps, result.error.message);\n\tconst data = result.data;\n\tconst pairs: Array<[string, string]> = [];\n\tif (data.id) pairs.push([\"ID\", String(data.id)]);\n\tif (data.key) pairs.push([\"Key\", String(data.key)]);\n\tif (data.last4) pairs.push([\"Last 4\", String(data.last4)]);\n\twriteKv(deps, pairs, { ok: true, api_key: result.data });\n\treturn { exitCode: 0 };\n}\n\nexport async function runApiKeysList(\n\t_input: { json?: boolean },\n\tdeps: CommandDeps<ApiKeysListClient>,\n): Promise<{ exitCode: number }> {\n\tif (!(await hasCredential(deps))) return writeAuthError(deps);\n\tconst result = await deps.client.apiKeys.list();\n\tif (result.error) return writeApiErrorSimple(deps, result.error.message);\n\tconst raw = listItems(result.data);\n\tconst items = Array.isArray(raw)\n\t\t? (raw as Array<Record<string, unknown>>)\n\t\t: undefined;\n\tif (deps.outputMode === \"human\") {\n\t\tif (!items || items.length === 0) {\n\t\t\twriteEmpty(deps, \"No API keys found.\", { ok: true, api_keys: [] });\n\t\t} else {\n\t\t\tfor (const item of items) {\n\t\t\t\tdeps.stdout(\n\t\t\t\t\t`${item.id ?? \"\"} ${item.label ?? \"\"} ...${item.last4 ?? \"\"}\\n`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t} else {\n\t\twriteJson(deps, { ok: true, api_keys: items ?? raw });\n\t}\n\treturn { exitCode: 0 };\n}\n\nexport async function runApiKeysDelete(\n\tkeyId: string,\n\tinput: { yes?: boolean; json?: boolean; interactive?: boolean },\n\tdeps: CommandDeps<ApiKeysDeleteClient>,\n): Promise<{ exitCode: number }> {\n\tif (!input.yes && input.interactive === false) {\n\t\treturn writeError(\n\t\t\tdeps,\n\t\t\t\"invalid_usage\",\n\t\t\t\"Pass --yes to delete in non-interactive mode.\",\n\t\t);\n\t}\n\tif (!input.yes && input.interactive !== false) {\n\t\tconst confirmed = await prompts.confirm({\n\t\t\tmessage: `Delete API key ${keyId}?`,\n\t\t});\n\t\tif (prompts.isCancel(confirmed) || !confirmed) {\n\t\t\treturn { exitCode: 0 };\n\t\t}\n\t}\n\tif (!(await hasCredential(deps))) return writeAuthError(deps);\n\tconst result = await deps.client.apiKeys.delete(keyId);\n\tif (result?.error) return writeApiErrorSimple(deps, result.error.message);\n\twriteHumanOrJson(deps, success(`Deleted ${keyId}`), {\n\t\tok: true,\n\t\tdeleted: true,\n\t\tid: keyId,\n\t});\n\treturn { exitCode: 0 };\n}\n\nasync function hasCredential(deps: CommandDeps<unknown>): Promise<boolean> {\n\treturn (\n\t\t(await resolveCredential({\n\t\t\t...(deps.apiKey ? { apiKey: deps.apiKey } : {}),\n\t\t\tenv: deps.env,\n\t\t\tstore: deps.store,\n\t\t})) !== null\n\t);\n}\n\nfunction listItems(data: unknown): unknown {\n\tif (data && typeof data === \"object\" && \"data\" in data) {\n\t\treturn (data as { data: unknown }).data;\n\t}\n\tif (data && typeof data === \"object\" && \"apiKeys\" in data) {\n\t\treturn (data as { apiKeys: unknown }).apiKeys;\n\t}\n\treturn data;\n}\n","const COMMANDS = [\n\t{\n\t\tname: \"publish\",\n\t\tdescription: \"Publish an input and return a Dropthis URL.\",\n\t\targuments: [\"input\"],\n\t\toptions: [\"--json\", \"--url\", \"--dry-run\", \"--title\", \"--metadata\"],\n\t\texamples: [\n\t\t\t\"dropthis publish ./site --json\",\n\t\t\t\"dropthis publish ./site --url\",\n\t\t\t\"dropthis publish ./dist --dry-run\",\n\t\t],\n\t},\n\t{\n\t\tname: \"update\",\n\t\tdescription: \"Update an existing drop by id.\",\n\t\targuments: [\"target\", \"input\"],\n\t\toptions: [\"--json\", \"--url\", \"--dry-run\", \"--if-revision\"],\n\t\texamples: [\n\t\t\t\"dropthis update drop_abc ./site --json\",\n\t\t\t\"dropthis update drop_abc --title 'New Title' --dry-run\",\n\t\t],\n\t},\n\t{\n\t\tname: \"deployments list <dropId>\",\n\t\tdescription: \"List deployments for a drop.\",\n\t\targuments: [\"dropId\"],\n\t\toptions: [\"--json\", \"--limit\", \"--cursor\"],\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis deployments list drop_abc --json\"],\n\t},\n\t{\n\t\tname: \"deployments get <dropId> <deploymentId>\",\n\t\tdescription: \"Get deployment details for a drop.\",\n\t\targuments: [\"dropId\", \"deploymentId\"],\n\t\toptions: [\"--json\"],\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis deployments get drop_abc dep_abc --json\"],\n\t},\n\t{\n\t\tname: \"drops\",\n\t\tdescription: \"List, inspect, update, and delete drops.\",\n\t\texamples: [\"dropthis drops list --json\"],\n\t},\n\t{\n\t\tname: \"api-keys\",\n\t\tdescription: \"Create, list, and delete API keys.\",\n\t\texamples: [\"dropthis api-keys create --label CI --json\"],\n\t},\n\t{\n\t\tname: \"login\",\n\t\tdescription: \"Authenticate with email OTP and store an API key.\",\n\t\texamples: [\n\t\t\t\"dropthis login verify --email user@example.com --otp 123456 --json\",\n\t\t],\n\t},\n\t{\n\t\tname: \"logout\",\n\t\tdescription: \"Remove stored local credentials.\",\n\t\texamples: [\"dropthis logout --json\"],\n\t},\n\t{\n\t\tname: \"whoami\",\n\t\tdescription: \"Show current auth source and credential metadata.\",\n\t\texamples: [\"dropthis whoami --json\"],\n\t},\n\t{\n\t\tname: \"account\",\n\t\tdescription: \"Get account details.\",\n\t\texamples: [\"dropthis account get --json\"],\n\t},\n\t{\n\t\tname: \"doctor\",\n\t\tdescription: \"Report local CLI diagnostics.\",\n\t\texamples: [\"dropthis doctor --json\"],\n\t},\n\t{\n\t\tname: \"commands\",\n\t\tdescription: \"Print this machine-readable command tree.\",\n\t\texamples: [\"dropthis commands --json\"],\n\t},\n];\n\nexport async function runCommands(\n\t_input: { json?: boolean },\n\tdeps: { stdout: (value: string) => void },\n): Promise<{ exitCode: number }> {\n\tdeps.stdout(\n\t\t`${JSON.stringify({\n\t\t\tok: true,\n\t\t\toutput: \"JSON by default in CI, pipes, non-TTY, --json, or --quiet.\",\n\t\t\tcommands: COMMANDS,\n\t\t})}\\n`,\n\t);\n\treturn { exitCode: 0 };\n}\n","import { resolveCredential } from \"../auth.js\";\nimport {\n\twriteApiError,\n\twriteAuthError,\n\twriteEmpty,\n\twriteJson,\n\twriteKv,\n} from \"../fmt.js\";\nimport type { CredentialStore } from \"../storage.js\";\n\ntype ApiError = {\n\tmessage: string;\n\tcode?: string;\n\tstatusCode?: number | null;\n\tdetail?: unknown;\n\tparam?: string | null;\n\trequestId?: string | null;\n};\n\ntype SdkResult<T> =\n\t| { data: T; error: null; headers?: Record<string, string> }\n\t| { data: null; error: ApiError; headers?: Record<string, string> };\n\ntype DeploymentsClient = {\n\tdeployments: {\n\t\tlist(\n\t\t\tdropId: string,\n\t\t\tparams?: { limit?: number; cursor?: string },\n\t\t): Promise<SdkResult<unknown>>;\n\t\tget(dropId: string, deploymentId: string): Promise<SdkResult<unknown>>;\n\t};\n};\n\ntype Deps = {\n\tstore: CredentialStore;\n\tclient: DeploymentsClient;\n\tapiKey?: string;\n\tenv: Record<string, string | undefined>;\n\tstdout: (value: string) => void;\n\tstderr: (value: string) => void;\n\toutputMode?: \"human\" | \"json\";\n};\n\nexport async function runDeploymentsList(\n\tdropId: string,\n\tinput: { limit?: number; cursor?: string; json?: boolean },\n\tdeps: Deps,\n): Promise<{ exitCode: number }> {\n\tif (!(await hasCredential(deps))) return writeAuthError(deps);\n\tconst params = {\n\t\t...(input.limit !== undefined ? { limit: input.limit } : {}),\n\t\t...(input.cursor ? { cursor: input.cursor } : {}),\n\t};\n\tconst result = await deps.client.deployments.list(dropId, params);\n\tif (result.error) {\n\t\treturn writeApiError(deps, result.error);\n\t}\n\tconst spread = spreadData(result.data);\n\tconst items = (spread.deployments ?? spread.data ?? result.data) as\n\t\t| Array<Record<string, unknown>>\n\t\t| undefined;\n\tif (deps.outputMode === \"human\") {\n\t\tif (!items || (Array.isArray(items) && items.length === 0)) {\n\t\t\twriteEmpty(deps, \"No deployments found.\", {\n\t\t\t\tok: true,\n\t\t\t\t...spread,\n\t\t\t});\n\t\t} else if (Array.isArray(items)) {\n\t\t\tfor (const item of items) {\n\t\t\t\tdeps.stdout(\n\t\t\t\t\t`${item.id ?? \"\"} rev ${item.revision ?? \"?\"} ${item.created_at ?? \"\"}\\n`,\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\twriteJson(deps, { ok: true, ...spread });\n\t\t}\n\t} else {\n\t\twriteJson(deps, { ok: true, ...spread });\n\t}\n\treturn { exitCode: 0 };\n}\n\nexport async function runDeploymentsGet(\n\tdropId: string,\n\tdeploymentId: string,\n\t_input: { json?: boolean },\n\tdeps: Deps,\n): Promise<{ exitCode: number }> {\n\tif (!(await hasCredential(deps))) return writeAuthError(deps);\n\tconst result = await deps.client.deployments.get(dropId, deploymentId);\n\tif (result.error) {\n\t\treturn writeApiError(deps, result.error);\n\t}\n\tconst data = result.data as Record<string, unknown>;\n\tconst pairs: Array<[string, string]> = [];\n\tif (data.id) pairs.push([\"ID\", String(data.id)]);\n\tif (data.revision !== undefined)\n\t\tpairs.push([\"Revision\", String(data.revision)]);\n\tif (data.created_at) pairs.push([\"Created\", String(data.created_at)]);\n\twriteKv(deps, pairs, { ok: true, deployment: result.data });\n\treturn { exitCode: 0 };\n}\n\nasync function hasCredential(\n\tdeps: Pick<Deps, \"apiKey\" | \"env\" | \"store\">,\n): Promise<boolean> {\n\treturn (\n\t\t(await resolveCredential({\n\t\t\t...(deps.apiKey ? { apiKey: deps.apiKey } : {}),\n\t\t\tenv: deps.env,\n\t\t\tstore: deps.store,\n\t\t})) !== null\n\t);\n}\n\nfunction spreadData(data: unknown): Record<string, unknown> {\n\treturn data && typeof data === \"object\"\n\t\t? (data as Record<string, unknown>)\n\t\t: { data };\n}\n","import { resolveCredential } from \"../auth.js\";\nimport { writeKv } from \"../fmt.js\";\nimport type { CredentialStore } from \"../storage.js\";\n\ntype CommandDeps = {\n\tstore: CredentialStore;\n\tclient: unknown;\n\tenv: Record<string, string | undefined>;\n\tstdout: (value: string) => void;\n\tstderr: (value: string) => void;\n\toutputMode?: \"human\" | \"json\";\n};\n\nexport async function runDoctor(\n\t_input: { json?: boolean },\n\tdeps: CommandDeps,\n): Promise<{ exitCode: number }> {\n\tconst stored = await deps.store.read();\n\tconst credential = await resolveCredential({\n\t\tenv: deps.env,\n\t\tstore: deps.store,\n\t});\n\tconst authSource = credential?.source ?? \"missing\";\n\tconst storageBackend = stored?.storage ?? \"none\";\n\n\tconst pairs: Array<[string, string]> = [\n\t\t[\"Version\", PKG_VERSION],\n\t\t[\"Auth\", authSource],\n\t\t[\"Storage\", storageBackend],\n\t];\n\n\twriteKv(deps, pairs, {\n\t\tok: true,\n\t\tversion: PKG_VERSION,\n\t\tauth: { source: authSource },\n\t\tstorage: { backend: storageBackend },\n\t});\n\treturn { exitCode: 0 };\n}\n","import * as prompts from \"@clack/prompts\";\nimport { resolveCredential } from \"../auth.js\";\nimport {\n\twriteApiErrorSimple,\n\twriteAuthError,\n\twriteEmpty,\n\twriteError,\n\twriteHumanOrJson,\n\twriteJson,\n\twriteKv,\n} from \"../fmt.js\";\nimport { parseDropOptions, type RawDropOptions } from \"../options.js\";\nimport type { CredentialStore } from \"../storage.js\";\nimport { url as fmtUrl, success } from \"../ui.js\";\n\ntype SdkResult<T> =\n\t| { data: T; error: null; headers?: Record<string, string> }\n\t| {\n\t\t\tdata: null;\n\t\t\terror: { message: string };\n\t\t\theaders?: Record<string, string>;\n\t };\n\ntype DropsListClient = {\n\tdrops: {\n\t\tlist(params: {\n\t\t\tlimit?: number;\n\t\t\tcursor?: string;\n\t\t}): Promise<SdkResult<unknown>>;\n\t};\n};\n\ntype DropsGetClient = {\n\tdrops: {\n\t\tget(dropId: string): Promise<SdkResult<unknown>>;\n\t};\n};\n\ntype DropsUpdateClient = {\n\tdrops: {\n\t\tupdate(\n\t\t\tdropId: string,\n\t\t\tinput: Record<string, unknown>,\n\t\t): Promise<SdkResult<unknown>>;\n\t};\n};\n\ntype DropsDeleteClient = {\n\tdrops: {\n\t\tdelete(\n\t\t\tdropId: string,\n\t\t): Promise<SdkResult<null>> | SdkResult<null> | undefined;\n\t};\n};\n\ntype CommandDeps<TClient> = {\n\tstore: CredentialStore;\n\tclient: TClient;\n\tapiKey?: string;\n\tenv: Record<string, string | undefined>;\n\tstdout: (value: string) => void;\n\tstderr: (value: string) => void;\n\toutputMode?: \"human\" | \"json\";\n};\n\nexport async function runDropsList(\n\tinput: { limit?: number; cursor?: string; json?: boolean },\n\tdeps: CommandDeps<DropsListClient>,\n): Promise<{ exitCode: number }> {\n\tif (!(await hasCredential(deps))) return writeAuthError(deps);\n\tconst params = {\n\t\t...(input.limit !== undefined ? { limit: input.limit } : {}),\n\t\t...(input.cursor ? { cursor: input.cursor } : {}),\n\t};\n\tconst result = await deps.client.drops.list(params);\n\tif (result.error) return writeApiErrorSimple(deps, result.error.message);\n\tconst raw = listItems(result.data);\n\tconst items = Array.isArray(raw)\n\t\t? (raw as Array<Record<string, unknown>>)\n\t\t: undefined;\n\tif (deps.outputMode === \"human\") {\n\t\tif (!items || items.length === 0) {\n\t\t\twriteEmpty(deps, \"No drops found.\", { ok: true, drops: [] });\n\t\t} else {\n\t\t\tfor (const item of items) {\n\t\t\t\tdeps.stdout(\n\t\t\t\t\t`${item.id ?? \"\"} ${item.title ?? \"\"} ${item.url ? fmtUrl(String(item.url)) : \"\"}\\n`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t} else {\n\t\twriteJson(deps, { ok: true, drops: items ?? raw });\n\t}\n\treturn { exitCode: 0 };\n}\n\nexport async function runDropsGet(\n\tdropId: string,\n\t_input: { json?: boolean },\n\tdeps: CommandDeps<DropsGetClient>,\n): Promise<{ exitCode: number }> {\n\tif (!(await hasCredential(deps))) return writeAuthError(deps);\n\tconst result = await deps.client.drops.get(dropId);\n\tif (result.error) return writeApiErrorSimple(deps, result.error.message);\n\tconst data = result.data as Record<string, unknown>;\n\tconst pairs: Array<[string, string]> = [];\n\tif (data.id) pairs.push([\"ID\", String(data.id)]);\n\tif (data.url) pairs.push([\"URL\", fmtUrl(String(data.url))]);\n\tif (data.title) pairs.push([\"Title\", String(data.title)]);\n\tif (data.visibility) pairs.push([\"Visibility\", String(data.visibility)]);\n\tif (data.revision !== undefined)\n\t\tpairs.push([\"Revision\", String(data.revision)]);\n\tif (data.created_at) pairs.push([\"Created\", String(data.created_at)]);\n\twriteKv(deps, pairs, { ok: true, drop: result.data });\n\treturn { exitCode: 0 };\n}\n\nexport async function runDropsUpdate(\n\tdropId: string,\n\tinput: RawDropOptions & { json?: boolean },\n\tdeps: CommandDeps<DropsUpdateClient>,\n): Promise<{ exitCode: number }> {\n\tif (!(await hasCredential(deps))) return writeAuthError(deps);\n\ttry {\n\t\tconst options = await parseDropOptions(input);\n\t\tconst result = await deps.client.drops.update(dropId, options);\n\t\tif (result.error) return writeApiErrorSimple(deps, result.error.message);\n\t\twriteHumanOrJson(deps, success(`Updated ${dropId}`), {\n\t\t\tok: true,\n\t\t\tdrop: result.data,\n\t\t});\n\t\treturn { exitCode: 0 };\n\t} catch (error) {\n\t\treturn writeError(\n\t\t\tdeps,\n\t\t\t\"invalid_usage\",\n\t\t\terror instanceof Error ? error.message : \"Invalid drop options.\",\n\t\t);\n\t}\n}\n\nexport async function runDropsDelete(\n\tdropId: string,\n\tinput: { yes?: boolean; json?: boolean; interactive?: boolean },\n\tdeps: CommandDeps<DropsDeleteClient>,\n): Promise<{ exitCode: number }> {\n\tif (!input.yes && input.interactive === false) {\n\t\treturn writeError(\n\t\t\tdeps,\n\t\t\t\"invalid_usage\",\n\t\t\t\"Pass --yes to delete in non-interactive mode.\",\n\t\t);\n\t}\n\tif (!input.yes && input.interactive !== false) {\n\t\tconst confirmed = await prompts.confirm({\n\t\t\tmessage: `Delete ${dropId}?`,\n\t\t});\n\t\tif (prompts.isCancel(confirmed) || !confirmed) {\n\t\t\treturn { exitCode: 0 };\n\t\t}\n\t}\n\tif (!(await hasCredential(deps))) return writeAuthError(deps);\n\tconst result = await deps.client.drops.delete(dropId);\n\tif (result?.error) return writeApiErrorSimple(deps, result.error.message);\n\twriteHumanOrJson(deps, success(`Deleted ${dropId}`), {\n\t\tok: true,\n\t\tdeleted: true,\n\t\tid: dropId,\n\t});\n\treturn { exitCode: 0 };\n}\n\nasync function hasCredential(deps: CommandDeps<unknown>): Promise<boolean> {\n\treturn (\n\t\t(await resolveCredential({\n\t\t\t...(deps.apiKey ? { apiKey: deps.apiKey } : {}),\n\t\t\tenv: deps.env,\n\t\t\tstore: deps.store,\n\t\t})) !== null\n\t);\n}\n\nfunction listItems(data: unknown): unknown {\n\tif (data && typeof data === \"object\" && \"data\" in data) {\n\t\treturn (data as { data: unknown }).data;\n\t}\n\tif (data && typeof data === \"object\" && \"drops\" in data) {\n\t\treturn (data as { drops: unknown }).drops;\n\t}\n\treturn data;\n}\n","import { readFile } from \"node:fs/promises\";\n\nexport type RawDropOptions = {\n\tslug?: string;\n\ttitle?: string;\n\tvisibility?: \"public\" | \"unlisted\";\n\tpassword?: string;\n\tnoPassword?: boolean;\n\tnoindex?: boolean;\n\tindex?: boolean;\n\texpiresAt?: string;\n\tmetadata?: string;\n\tmetadataFile?: string;\n\tentry?: string;\n\tcontentType?: string;\n\tpath?: string;\n\tidempotencyKey?: string;\n};\n\nexport type ParsedDropOptions = {\n\tslug?: string;\n\ttitle?: string;\n\tvisibility?: \"public\" | \"unlisted\";\n\tpassword?: string | null;\n\tnoindex?: boolean;\n\texpiresAt?: string;\n\tmetadata?: Record<string, unknown>;\n\tentry?: string;\n\tcontentType?: string;\n\tpath?: string;\n\tidempotencyKey?: string;\n};\n\nexport async function parseDropOptions(\n\traw: RawDropOptions,\n): Promise<ParsedDropOptions> {\n\tif (raw.metadata && raw.metadataFile) {\n\t\tthrow new Error(\"Use either --metadata or --metadata-file, not both.\");\n\t}\n\tif (raw.password && raw.noPassword) {\n\t\tthrow new Error(\"Use either --password or --no-password, not both.\");\n\t}\n\tif (raw.noindex && raw.index) {\n\t\tthrow new Error(\"Use either --noindex or --index, not both.\");\n\t}\n\tconst metadata = raw.metadata\n\t\t? parseJsonObject(raw.metadata, \"--metadata\")\n\t\t: raw.metadataFile\n\t\t\t? parseJsonObject(\n\t\t\t\t\tawait readFile(raw.metadataFile, \"utf8\"),\n\t\t\t\t\t\"--metadata-file\",\n\t\t\t\t)\n\t\t\t: undefined;\n\treturn {\n\t\t...(raw.slug ? { slug: raw.slug } : {}),\n\t\t...(raw.title ? { title: raw.title } : {}),\n\t\t...(raw.visibility ? { visibility: raw.visibility } : {}),\n\t\t...(raw.password ? { password: raw.password } : {}),\n\t\t...(raw.noPassword ? { password: null } : {}),\n\t\t...(raw.noindex ? { noindex: true } : {}),\n\t\t...(raw.index ? { noindex: false } : {}),\n\t\t...(raw.expiresAt ? { expiresAt: raw.expiresAt } : {}),\n\t\t...(metadata ? { metadata } : {}),\n\t\t...(raw.entry ? { entry: raw.entry } : {}),\n\t\t...(raw.contentType ? { contentType: raw.contentType } : {}),\n\t\t...(raw.path ? { path: raw.path } : {}),\n\t\t...(raw.idempotencyKey ? { idempotencyKey: raw.idempotencyKey } : {}),\n\t};\n}\n\nfunction parseJsonObject(\n\tvalue: string,\n\tlabel: string,\n): Record<string, unknown> {\n\tconst parsed = JSON.parse(value) as unknown;\n\tif (!parsed || typeof parsed !== \"object\" || Array.isArray(parsed)) {\n\t\tthrow new Error(`${label} must be a JSON object.`);\n\t}\n\treturn parsed as Record<string, unknown>;\n}\n","import * as prompts from \"@clack/prompts\";\nimport { errorEnvelope, exitCodeFor } from \"../output.js\";\nimport type { CredentialStore } from \"../storage.js\";\n\ntype SdkResult<T> =\n\t| { data: T; error: null; headers?: Record<string, string> }\n\t| {\n\t\t\tdata: null;\n\t\t\terror: { message: string };\n\t\t\theaders?: Record<string, string>;\n\t };\n\ntype OtpRequestData = {\n\tok: true;\n\texpiresIn: number;\n};\n\ntype SessionData = {\n\ttoken: string;\n\taccountId: string;\n\tisNewAccount: boolean;\n};\n\ntype ApiKeyData = {\n\tid: string;\n\tkey: string;\n\tkeyLast4: string;\n\taccountId?: string | null;\n\tisNewAccount?: boolean;\n};\n\ntype LoginRequestClient = {\n\tauth: {\n\t\trequestEmailOtp(input: {\n\t\t\temail: string;\n\t\t}): Promise<SdkResult<OtpRequestData>>;\n\t};\n};\n\ntype LoginClient = {\n\tauth: {\n\t\tverifyEmailOtp(input: {\n\t\t\temail: string;\n\t\t\tcode: string;\n\t\t}): Promise<SdkResult<SessionData>>;\n\t};\n\tapiKeys: {\n\t\tcreate(input: { label: string }): Promise<SdkResult<ApiKeyData>>;\n\t};\n};\n\ntype LoginInteractiveClient = LoginRequestClient & LoginClient;\n\nexport async function runLoginInteractive(deps: {\n\tclient: LoginInteractiveClient;\n\tcreateClient: (apiKey: string) => LoginInteractiveClient;\n\tstore: CredentialStore;\n\tstdout: (value: string) => void;\n\tstderr: (value: string) => void;\n}): Promise<{ exitCode: number }> {\n\tprompts.intro(\"dropthis login\");\n\n\tconst email = await prompts.text({\n\t\tmessage: \"Email address\",\n\t\tvalidate: (v) => (v?.includes(\"@\") ? undefined : \"Enter a valid email\"),\n\t});\n\tif (prompts.isCancel(email)) {\n\t\tprompts.cancel(\"Login cancelled.\");\n\t\treturn { exitCode: 0 };\n\t}\n\n\tconst requestResult = await deps.client.auth.requestEmailOtp({ email });\n\tif (requestResult.error) {\n\t\tprompts.cancel(requestResult.error.message);\n\t\treturn { exitCode: exitCodeFor(\"api_error\") };\n\t}\n\n\tconst otp = await prompts.text({\n\t\tmessage: \"Paste the code from your email\",\n\t});\n\tif (prompts.isCancel(otp)) {\n\t\tprompts.cancel(\"Login cancelled.\");\n\t\treturn { exitCode: 0 };\n\t}\n\n\tconst session = await deps.client.auth.verifyEmailOtp({ email, code: otp });\n\tif (session.error) {\n\t\tprompts.cancel(session.error.message);\n\t\treturn { exitCode: exitCodeFor(\"api_error\") };\n\t}\n\n\tconst authedClient = deps.createClient(session.data.token);\n\tconst apiKey = await authedClient.apiKeys.create({ label: \"CLI\" });\n\tif (apiKey.error) {\n\t\tprompts.cancel(apiKey.error.message);\n\t\treturn { exitCode: exitCodeFor(\"api_error\") };\n\t}\n\n\tawait deps.store.save({\n\t\tapiKey: apiKey.data.key,\n\t\tkeyId: apiKey.data.id,\n\t\tkeyLast4: apiKey.data.keyLast4,\n\t\taccountId: apiKey.data.accountId ?? session.data.accountId,\n\t\temail,\n\t\tstorage: \"secure\",\n\t});\n\n\tprompts.outro(\"Logged in successfully.\");\n\treturn { exitCode: 0 };\n}\n\nexport async function runLoginRequest(\n\tinput: { email: string; json?: boolean },\n\tdeps: {\n\t\tclient: LoginRequestClient;\n\t\tstdout: (value: string) => void;\n\t\tstderr: (value: string) => void;\n\t},\n): Promise<{ exitCode: number }> {\n\tconst result = await deps.client.auth.requestEmailOtp({\n\t\temail: input.email,\n\t});\n\tif (result.error) {\n\t\tdeps.stderr(\n\t\t\t`${JSON.stringify(errorEnvelope(\"api_error\", result.error.message))}\\n`,\n\t\t);\n\t\treturn { exitCode: exitCodeFor(\"api_error\") };\n\t}\n\tdeps.stdout(\n\t\t`${JSON.stringify({\n\t\t\tok: true,\n\t\t\temail: input.email,\n\t\t\texpires_in: result.data.expiresIn,\n\t\t})}\\n`,\n\t);\n\treturn { exitCode: 0 };\n}\n\nexport async function runLoginVerify(\n\tinput: { email: string; otp: string; json?: boolean },\n\tdeps: {\n\t\tclient: LoginClient;\n\t\tcreateClient: (apiKey: string) => LoginClient;\n\t\tstore: CredentialStore;\n\t\tstdout: (value: string) => void;\n\t\tstderr: (value: string) => void;\n\t},\n): Promise<{ exitCode: number }> {\n\tconst session = await deps.client.auth.verifyEmailOtp({\n\t\temail: input.email,\n\t\tcode: input.otp,\n\t});\n\tif (session.error) {\n\t\tdeps.stderr(\n\t\t\t`${JSON.stringify(errorEnvelope(\"api_error\", session.error.message))}\\n`,\n\t\t);\n\t\treturn { exitCode: exitCodeFor(\"api_error\") };\n\t}\n\tconst authedClient = deps.createClient(session.data.token);\n\tconst apiKey = await authedClient.apiKeys.create({ label: \"CLI\" });\n\tif (apiKey.error) {\n\t\tdeps.stderr(\n\t\t\t`${JSON.stringify(errorEnvelope(\"api_error\", apiKey.error.message))}\\n`,\n\t\t);\n\t\treturn { exitCode: exitCodeFor(\"api_error\") };\n\t}\n\tawait deps.store.save({\n\t\tapiKey: apiKey.data.key,\n\t\tkeyId: apiKey.data.id,\n\t\tkeyLast4: apiKey.data.keyLast4,\n\t\taccountId: apiKey.data.accountId ?? session.data.accountId,\n\t\temail: input.email,\n\t\tstorage: \"secure\",\n\t});\n\tdeps.stdout(\n\t\t`${JSON.stringify({\n\t\t\tok: true,\n\t\t\taccount_id: apiKey.data.accountId ?? session.data.accountId,\n\t\t\tkey_id: apiKey.data.id,\n\t\t\tkey_last4: apiKey.data.keyLast4,\n\t\t\tis_new_account: apiKey.data.isNewAccount ?? session.data.isNewAccount,\n\t\t})}\\n`,\n\t);\n\treturn { exitCode: 0 };\n}\n","import { writeApiErrorSimple, writeHumanOrJson } from \"../fmt.js\";\nimport type { CredentialStore } from \"../storage.js\";\nimport { success } from \"../ui.js\";\n\ntype DeleteResult =\n\t| { data: null; error: null; headers?: Record<string, string> }\n\t| {\n\t\t\tdata: null;\n\t\t\terror: { message: string };\n\t\t\theaders?: Record<string, string>;\n\t };\n\ntype LogoutClient = {\n\tapiKeys: {\n\t\tdelete(\n\t\t\tkeyId: string,\n\t\t): DeleteResult | Promise<DeleteResult> | undefined | Promise<undefined>;\n\t};\n};\n\nexport async function runLogout(\n\tinput: { json?: boolean; revoke?: boolean },\n\tdeps: {\n\t\tstore: CredentialStore;\n\t\tclient: LogoutClient;\n\t\tstdout: (value: string) => void;\n\t\tstderr: (value: string) => void;\n\t\toutputMode?: \"human\" | \"json\";\n\t},\n): Promise<{ exitCode: number }> {\n\tconst stored = await deps.store.read();\n\tlet revokeError: string | undefined;\n\tif (input.revoke && stored?.keyId) {\n\t\tconst result = await deps.client.apiKeys.delete(stored.keyId);\n\t\tif (result?.error) revokeError = result.error.message;\n\t}\n\tif (revokeError) {\n\t\treturn writeApiErrorSimple(deps, revokeError);\n\t}\n\tawait deps.store.clear();\n\twriteHumanOrJson(deps, success(\"Logged out.\"), { ok: true });\n\treturn { exitCode: 0 };\n}\n","import { randomUUID } from \"node:crypto\";\nimport { stat } from \"node:fs/promises\";\nimport { basename, extname } from \"node:path\";\nimport { resolveCredential } from \"../auth.js\";\nimport {\n\twriteApiError,\n\twriteAuthError,\n\twriteError,\n\twriteResult,\n} from \"../fmt.js\";\nimport {\n\ttype ParsedDropOptions,\n\tparseDropOptions,\n\ttype RawDropOptions,\n} from \"../options.js\";\nimport type { ApiErrorDetails } from \"../output.js\";\nimport { createSpinner, shouldSpin } from \"../spinner.js\";\nimport type { CredentialStore } from \"../storage.js\";\nimport { readJsonObjectFile } from \"./json_body.js\";\n\ntype SdkResult<T> =\n\t| { data: T; error: null; headers?: Record<string, string> }\n\t| {\n\t\t\tdata: null;\n\t\t\terror: ApiErrorDetails;\n\t\t\theaders?: Record<string, string>;\n\t };\n\ntype DropData = { url: string; [key: string]: unknown };\n\ntype ManifestFile = {\n\tpath: string;\n\tcontentType: string;\n\tsizeBytes: number;\n};\n\ntype PreparedResult = {\n\tkind: \"staged\";\n\tmanifest: { files: ManifestFile[]; entry?: string | null };\n\toptions: Record<string, unknown>;\n\tmetadata?: Record<string, unknown>;\n};\n\ntype PublishClient = {\n\tpublish(\n\t\tinput: string,\n\t\toptions: ParsedDropOptions,\n\t): Promise<SdkResult<DropData>>;\n\tprepare?(input: string, options: ParsedDropOptions): Promise<PreparedResult>;\n\tdrops: {\n\t\tcreateRaw(\n\t\t\tbody: unknown,\n\t\t\toptions?: { idempotencyKey?: string },\n\t\t): Promise<SdkResult<DropData>>;\n\t};\n};\n\ntype PublishOptions = RawDropOptions & {\n\tdryRun?: boolean;\n\tfromJson?: string;\n\tjson?: boolean;\n\tquiet?: boolean;\n\turl?: boolean;\n\tapiKey?: string;\n};\n\ntype PublishDeps = {\n\tstore: CredentialStore;\n\tclient: PublishClient;\n\tapiKey?: string;\n\tenv: Record<string, string | undefined>;\n\tstdout: (value: string) => void;\n\tstderr: (value: string) => void;\n\treadJsonObject?: (path: string) => Promise<Record<string, unknown>>;\n\toutputMode?: \"human\" | \"json\";\n};\n\nconst MAX_BUNDLE_FILE_COUNT = 200;\n\nexport async function runPublish(\n\tinput: string | string[] | undefined,\n\traw: PublishOptions,\n\tdeps: PublishDeps,\n): Promise<{ exitCode: number }> {\n\tconst credential = await resolveCredential({\n\t\t...((raw.apiKey ?? deps.apiKey)\n\t\t\t? { apiKey: raw.apiKey ?? deps.apiKey }\n\t\t\t: {}),\n\t\tenv: deps.env,\n\t\tstore: deps.store,\n\t});\n\tif (!credential) {\n\t\treturn writeAuthError(deps);\n\t}\n\n\tif (raw.dryRun) {\n\t\treturn handlePublishDryRun(input, raw, deps);\n\t}\n\n\tconst singleInput = Array.isArray(input) ? input[0] : input;\n\tconst spin = shouldSpin(deps.outputMode)\n\t\t? createSpinner(\"Publishing…\", deps.stderr)\n\t\t: undefined;\n\ttry {\n\t\tif (raw.fromJson && singleInput) {\n\t\t\tthrow new Error(\"Use either <input> or --from-json, not both.\");\n\t\t}\n\t\tconst options = withPublishIdempotency(await parseDropOptions(raw));\n\t\tconst result = raw.fromJson\n\t\t\t? await deps.client.drops.createRaw(\n\t\t\t\t\tawait (deps.readJsonObject ?? readJsonObjectFile)(raw.fromJson),\n\t\t\t\t\toptions.idempotencyKey\n\t\t\t\t\t\t? { idempotencyKey: options.idempotencyKey }\n\t\t\t\t\t\t: {},\n\t\t\t\t)\n\t\t\t: singleInput\n\t\t\t\t? await deps.client.publish(singleInput, options)\n\t\t\t\t: (() => {\n\t\t\t\t\t\tthrow new Error(\"Publish requires <input> or --from-json.\");\n\t\t\t\t\t})();\n\t\tif (result.error) {\n\t\t\tspin?.fail();\n\t\t\treturn writeApiError(deps, result.error);\n\t\t}\n\t\tspin?.stop(\"Published\");\n\t\tif (raw.url) deps.stdout(`${result.data.url}\\n`);\n\t\telse writeResult(deps, result.data.url, \"Published\", result.data);\n\t\treturn { exitCode: 0 };\n\t} catch (error) {\n\t\tconst message = error instanceof Error ? error.message : \"Publish failed.\";\n\t\tspin?.fail();\n\t\treturn writeError(deps, \"invalid_usage\", message);\n\t}\n}\n\nasync function handlePublishDryRun(\n\tinput: string | string[] | undefined,\n\traw: PublishOptions,\n\tdeps: PublishDeps,\n): Promise<{ exitCode: number }> {\n\tif (raw.url) {\n\t\treturn writeError(\n\t\t\tdeps,\n\t\t\t\"invalid_usage\",\n\t\t\t\"--url and --dry-run cannot be combined.\",\n\t\t\t\"Remove --url; dry-run outputs JSON describing what would be published.\",\n\t\t);\n\t}\n\ttry {\n\t\tif (raw.fromJson) {\n\t\t\tif (input)\n\t\t\t\tthrow new Error(\"Use either <input> or --from-json, not both.\");\n\t\t\tconst body = await (deps.readJsonObject ?? readJsonObjectFile)(\n\t\t\t\traw.fromJson,\n\t\t\t);\n\t\t\tdeps.stdout(\n\t\t\t\t`${JSON.stringify({ dryRun: true, kind: \"raw_json\", endpoint: \"POST /drops\", body }, null, 2)}\\n`,\n\t\t\t);\n\t\t\treturn { exitCode: 0 };\n\t\t}\n\n\t\tif (!input || (Array.isArray(input) && input.length === 0)) {\n\t\t\tthrow new Error(\"Publish requires <input> or --from-json.\");\n\t\t}\n\n\t\tconst options = await parseDropOptions(raw);\n\n\t\tif (Array.isArray(input)) {\n\t\t\treturn dryRunMultiFile(input, options, deps);\n\t\t}\n\n\t\tif (!deps.client.prepare) {\n\t\t\tthrow new Error(\"Client does not support dry-run.\");\n\t\t}\n\t\tconst prepared = await deps.client.prepare(input, options);\n\t\tconst output = formatDryRunOutput(prepared);\n\t\tvalidateDryRunOutput(output);\n\t\tdeps.stdout(`${JSON.stringify(output, null, 2)}\\n`);\n\t\treturn { exitCode: 0 };\n\t} catch (error) {\n\t\tconst code = isFileSystemError(error)\n\t\t\t? \"local_input_error\"\n\t\t\t: \"invalid_usage\";\n\t\tconst message = error instanceof Error ? error.message : \"Dry-run failed.\";\n\t\treturn writeError(deps, code, message);\n\t}\n}\n\nasync function dryRunMultiFile(\n\tinputs: string[],\n\toptions: ParsedDropOptions,\n\tdeps: PublishDeps,\n): Promise<{ exitCode: number }> {\n\tconst files: ManifestFile[] = [];\n\tfor (const filePath of inputs) {\n\t\tlet info: Awaited<ReturnType<typeof stat>>;\n\t\ttry {\n\t\t\tinfo = await stat(filePath);\n\t\t} catch {\n\t\t\treturn writeError(\n\t\t\t\tdeps,\n\t\t\t\t\"local_input_error\",\n\t\t\t\t`File not found: ${filePath}`,\n\t\t\t);\n\t\t}\n\t\tif (info.isDirectory()) {\n\t\t\treturn writeError(\n\t\t\t\tdeps,\n\t\t\t\t\"local_input_error\",\n\t\t\t\t`Cannot mix directories with multiple file arguments. Use a single folder instead: dropthis publish ${filePath}`,\n\t\t\t);\n\t\t}\n\t\tfiles.push({\n\t\t\tpath: basename(filePath),\n\t\t\tcontentType: mimeForPath(filePath),\n\t\t\tsizeBytes: info.size,\n\t\t});\n\t}\n\n\tif (files.length > MAX_BUNDLE_FILE_COUNT) {\n\t\treturn writeError(\n\t\t\tdeps,\n\t\t\t\"local_input_error\",\n\t\t\t`Bundle contains ${files.length} files, exceeding the maximum of ${MAX_BUNDLE_FILE_COUNT}.`,\n\t\t);\n\t}\n\n\tconst entry =\n\t\toptions.entry ??\n\t\tfiles.find((f) => f.path === \"index.html\")?.path ??\n\t\tfiles[0]?.path ??\n\t\tnull;\n\tconst totalBytes = files.reduce((sum, f) => sum + f.sizeBytes, 0);\n\tconst output = {\n\t\tdryRun: true as const,\n\t\tkind: \"staged\" as const,\n\t\tmanifest: { files, entry },\n\t\toptions: dryRunOptionsBody(options),\n\t\ttotalBytes,\n\t};\n\n\tdeps.stdout(`${JSON.stringify(output, null, 2)}\\n`);\n\treturn { exitCode: 0 };\n}\n\nfunction formatDryRunOutput(prepared: PreparedResult): Record<string, unknown> {\n\tconst totalBytes = prepared.manifest.files.reduce(\n\t\t(sum, f) => sum + f.sizeBytes,\n\t\t0,\n\t);\n\treturn {\n\t\tdryRun: true,\n\t\tkind: \"staged\",\n\t\tmanifest: {\n\t\t\tfiles: prepared.manifest.files,\n\t\t\tentry: prepared.manifest.entry ?? null,\n\t\t},\n\t\toptions: prepared.options,\n\t\t...(prepared.metadata ? { metadata: prepared.metadata } : {}),\n\t\ttotalBytes,\n\t};\n}\n\nfunction validateDryRunOutput(output: Record<string, unknown>): void {\n\tif (output.kind !== \"staged\") return;\n\tconst manifest = output.manifest as {\n\t\tfiles: ManifestFile[];\n\t};\n\tif (manifest.files.length > MAX_BUNDLE_FILE_COUNT) {\n\t\tthrow Object.assign(\n\t\t\tnew Error(\n\t\t\t\t`Bundle contains ${manifest.files.length} files, exceeding the maximum of ${MAX_BUNDLE_FILE_COUNT}.`,\n\t\t\t),\n\t\t\t{ code: \"ELIMIT\" },\n\t\t);\n\t}\n}\n\nfunction dryRunOptionsBody(\n\toptions: ParsedDropOptions,\n): Record<string, unknown> {\n\tconst result: Record<string, unknown> = {};\n\tif (options.title) result.title = options.title;\n\tif (options.visibility) result.visibility = options.visibility;\n\tif (options.password !== undefined) result.password = options.password;\n\tif (options.noindex !== undefined) result.noindex = options.noindex;\n\tif (options.expiresAt) result.expires_at = options.expiresAt;\n\treturn result;\n}\n\nfunction mimeForPath(filePath: string): string {\n\tconst ext = extname(filePath).toLowerCase();\n\tconst types: Record<string, string> = {\n\t\t\".html\": \"text/html\",\n\t\t\".htm\": \"text/html\",\n\t\t\".css\": \"text/css\",\n\t\t\".js\": \"text/javascript\",\n\t\t\".mjs\": \"text/javascript\",\n\t\t\".json\": \"application/json\",\n\t\t\".xml\": \"application/xml\",\n\t\t\".svg\": \"image/svg+xml\",\n\t\t\".txt\": \"text/plain\",\n\t\t\".md\": \"text/markdown\",\n\t\t\".jpg\": \"image/jpeg\",\n\t\t\".jpeg\": \"image/jpeg\",\n\t\t\".png\": \"image/png\",\n\t\t\".gif\": \"image/gif\",\n\t\t\".webp\": \"image/webp\",\n\t\t\".ico\": \"image/x-icon\",\n\t\t\".avif\": \"image/avif\",\n\t\t\".pdf\": \"application/pdf\",\n\t\t\".zip\": \"application/zip\",\n\t\t\".woff\": \"font/woff\",\n\t\t\".woff2\": \"font/woff2\",\n\t\t\".ttf\": \"font/ttf\",\n\t\t\".mp4\": \"video/mp4\",\n\t\t\".webm\": \"video/webm\",\n\t};\n\treturn types[ext] ?? \"application/octet-stream\";\n}\n\nfunction isFileSystemError(error: unknown): boolean {\n\tif (!(error instanceof Error)) return false;\n\tconst code = (error as NodeJS.ErrnoException).code;\n\treturn code === \"ENOENT\" || code === \"ENOTDIR\" || code === \"ELIMIT\";\n}\n\nfunction withPublishIdempotency(options: ParsedDropOptions): ParsedDropOptions {\n\treturn options.idempotencyKey\n\t\t? options\n\t\t: { ...options, idempotencyKey: `cli_pub_${randomUUID()}` };\n}\n","import pc from \"picocolors\";\nimport { symbols } from \"./ui.js\";\n\nconst frames = [\"⠋\", \"⠙\", \"⠹\", \"⠸\", \"⠼\", \"⠴\", \"⠦\", \"⠧\", \"⠇\", \"⠏\"];\n\nexport type Spinner = {\n\tstop(finalMessage?: string): void;\n\tfail(): void;\n};\n\nexport function createSpinner(\n\tmessage: string,\n\tstderr: (value: string) => void,\n): Spinner {\n\tlet i = 0;\n\tconst timer = setInterval(() => {\n\t\tstderr(`\\r\\x1B[2K${pc.cyan(frames[i % frames.length])} ${message}`);\n\t\ti++;\n\t}, 80);\n\n\treturn {\n\t\tstop(finalMessage?: string) {\n\t\t\tclearInterval(timer);\n\t\t\tconst text = finalMessage ?? message;\n\t\t\tstderr(`\\r\\x1B[2K${pc.green(symbols.success)} ${text}\\n`);\n\t\t},\n\t\tfail() {\n\t\t\tclearInterval(timer);\n\t\t\tstderr(\"\\r\\x1B[2K\");\n\t\t},\n\t};\n}\n\nexport function shouldSpin(outputMode?: \"human\" | \"json\"): boolean {\n\treturn (\n\t\toutputMode === \"human\" && process.stderr.isTTY === true && !process.env.CI\n\t);\n}\n","import { readFile } from \"node:fs/promises\";\n\nexport async function readJsonObjectFile(\n\tpath: string,\n): Promise<Record<string, unknown>> {\n\tlet parsed: unknown;\n\ttry {\n\t\tparsed = JSON.parse(await readFile(path, \"utf8\"));\n\t} catch (error) {\n\t\tconst message =\n\t\t\terror instanceof Error ? error.message : \"Unknown parse error\";\n\t\tthrow new Error(`Invalid JSON body in ${path}: ${message}`);\n\t}\n\tif (!parsed || typeof parsed !== \"object\" || Array.isArray(parsed)) {\n\t\tthrow new Error(\"JSON body must be an object.\");\n\t}\n\treturn parsed as Record<string, unknown>;\n}\n","import { randomUUID } from \"node:crypto\";\nimport { resolveCredential } from \"../auth.js\";\nimport {\n\twriteApiError,\n\twriteAuthError,\n\twriteError,\n\twriteResult,\n} from \"../fmt.js\";\nimport {\n\ttype ParsedDropOptions,\n\tparseDropOptions,\n\ttype RawDropOptions,\n} from \"../options.js\";\nimport type { ApiErrorDetails } from \"../output.js\";\nimport { createSpinner, shouldSpin } from \"../spinner.js\";\nimport type { CredentialStore } from \"../storage.js\";\nimport { readJsonObjectFile } from \"./json_body.js\";\n\ntype SdkResult<T> =\n\t| { data: T; error: null; headers?: Record<string, string> }\n\t| { data: null; error: ApiErrorDetails; headers?: Record<string, string> };\n\ntype DropData = { url: string; [key: string]: unknown };\ntype UpdateOptions = ParsedDropOptions & { ifRevision?: number };\n\ntype ManifestFile = {\n\tpath: string;\n\tcontentType: string;\n\tsizeBytes: number;\n};\n\ntype PreparedResult = {\n\tkind: \"staged\";\n\tmanifest: { files: ManifestFile[]; entry?: string | null };\n\toptions: Record<string, unknown>;\n\tmetadata?: Record<string, unknown>;\n};\n\ntype UpdateClient = {\n\tupdate(\n\t\ttarget: string,\n\t\tinputOrOptions: string | UpdateOptions,\n\t\toptions?: UpdateOptions,\n\t): Promise<SdkResult<DropData>>;\n\tprepare?(input: string, options: ParsedDropOptions): Promise<PreparedResult>;\n\tdeployments: {\n\t\tcreateRaw(\n\t\t\tdropId: string,\n\t\t\tbody: unknown,\n\t\t\toptions?: { idempotencyKey?: string; ifRevision?: number },\n\t\t): Promise<SdkResult<DropData>>;\n\t};\n};\n\ntype RawUpdateOptions = RawDropOptions & {\n\tdryRun?: boolean;\n\tifRevision?: number;\n\tfromJson?: string;\n\tjson?: boolean;\n\tquiet?: boolean;\n\turl?: boolean;\n\tapiKey?: string;\n};\n\ntype UpdateDeps = {\n\tstore: CredentialStore;\n\tclient: UpdateClient;\n\tapiKey?: string;\n\tenv: Record<string, string | undefined>;\n\tstdout: (value: string) => void;\n\tstderr: (value: string) => void;\n\treadJsonObject?: (path: string) => Promise<Record<string, unknown>>;\n\toutputMode?: \"human\" | \"json\";\n};\n\nexport async function runUpdate(\n\ttarget: string,\n\tinput: string | undefined,\n\traw: RawUpdateOptions,\n\tdeps: UpdateDeps,\n): Promise<{ exitCode: number }> {\n\tconst credential = await resolveCredential({\n\t\t...((raw.apiKey ?? deps.apiKey)\n\t\t\t? { apiKey: raw.apiKey ?? deps.apiKey }\n\t\t\t: {}),\n\t\tenv: deps.env,\n\t\tstore: deps.store,\n\t});\n\tif (!credential) {\n\t\treturn writeAuthError(deps);\n\t}\n\n\tif (raw.dryRun) {\n\t\treturn handleUpdateDryRun(target, input, raw, deps);\n\t}\n\n\tconst spin = shouldSpin(deps.outputMode)\n\t\t? createSpinner(\"Updating…\", deps.stderr)\n\t\t: undefined;\n\ttry {\n\t\tassertDropId(target);\n\t\tif (raw.fromJson && input) {\n\t\t\tthrow new Error(\"Use either [input] or --from-json, not both.\");\n\t\t}\n\t\tconst parsed = await parseDropOptions(raw);\n\t\tconst revisionOptions =\n\t\t\traw.ifRevision !== undefined\n\t\t\t\t? { ifRevision: Number(raw.ifRevision) }\n\t\t\t\t: {};\n\t\tconst result = raw.fromJson\n\t\t\t? await deps.client.deployments.createRaw(\n\t\t\t\t\ttarget,\n\t\t\t\t\tawait (deps.readJsonObject ?? readJsonObjectFile)(raw.fromJson),\n\t\t\t\t\twithUpdateIdempotency({\n\t\t\t\t\t\t...revisionOptions,\n\t\t\t\t\t\t...(parsed.idempotencyKey\n\t\t\t\t\t\t\t? { idempotencyKey: parsed.idempotencyKey }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t: input\n\t\t\t\t? await deps.client.update(\n\t\t\t\t\t\ttarget,\n\t\t\t\t\t\tinput,\n\t\t\t\t\t\twithUpdateIdempotency({\n\t\t\t\t\t\t\t...parsed,\n\t\t\t\t\t\t\t...revisionOptions,\n\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\t\t\t\t: await deps.client.update(target, parsed, revisionOptions);\n\t\tif (result.error) {\n\t\t\tspin?.fail();\n\t\t\treturn writeApiError(deps, result.error);\n\t\t}\n\t\tspin?.stop(\"Updated\");\n\t\tif (raw.url) deps.stdout(`${result.data.url}\\n`);\n\t\telse writeResult(deps, result.data.url, \"Updated\", result.data);\n\t\treturn { exitCode: 0 };\n\t} catch (error) {\n\t\tconst message = error instanceof Error ? error.message : \"Update failed.\";\n\t\tspin?.fail();\n\t\treturn writeError(deps, \"invalid_usage\", message);\n\t}\n}\n\nasync function handleUpdateDryRun(\n\ttarget: string,\n\tinput: string | undefined,\n\traw: RawUpdateOptions,\n\tdeps: UpdateDeps,\n): Promise<{ exitCode: number }> {\n\tif (raw.url) {\n\t\treturn writeError(\n\t\t\tdeps,\n\t\t\t\"invalid_usage\",\n\t\t\t\"--url and --dry-run cannot be combined.\",\n\t\t\t\"Remove --url; dry-run outputs JSON describing what would be published.\",\n\t\t);\n\t}\n\ttry {\n\t\tassertDropId(target);\n\n\t\tif (raw.fromJson) {\n\t\t\tif (input)\n\t\t\t\tthrow new Error(\"Use either [input] or --from-json, not both.\");\n\t\t\tconst body = await (deps.readJsonObject ?? readJsonObjectFile)(\n\t\t\t\traw.fromJson,\n\t\t\t);\n\t\t\tdeps.stdout(\n\t\t\t\t`${JSON.stringify({ dryRun: true, kind: \"raw_json\", endpoint: `POST /drops/${target}/deployments`, body }, null, 2)}\\n`,\n\t\t\t);\n\t\t\treturn { exitCode: 0 };\n\t\t}\n\n\t\tconst options = await parseDropOptions(raw);\n\n\t\tif (!input) {\n\t\t\tconst fields: Record<string, unknown> = {};\n\t\t\tif (options.slug) fields.slug = options.slug;\n\t\t\tif (options.title) fields.title = options.title;\n\t\t\tif (options.visibility) fields.visibility = options.visibility;\n\t\t\tif (options.password !== undefined) fields.password = options.password;\n\t\t\tif (options.noindex !== undefined) fields.noindex = options.noindex;\n\t\t\tif (options.expiresAt) fields.expires_at = options.expiresAt;\n\t\t\tif (options.metadata) fields.metadata = options.metadata;\n\t\t\tdeps.stdout(\n\t\t\t\t`${JSON.stringify({ dryRun: true, kind: \"options_update\", target, fields }, null, 2)}\\n`,\n\t\t\t);\n\t\t\treturn { exitCode: 0 };\n\t\t}\n\n\t\tif (!deps.client.prepare) {\n\t\t\tthrow new Error(\"Client does not support dry-run.\");\n\t\t}\n\t\tconst prepared = await deps.client.prepare(input, options);\n\t\tconst output = formatUpdateDryRun(target, prepared);\n\t\tvalidateDryRunFileCount(output);\n\t\tdeps.stdout(`${JSON.stringify(output, null, 2)}\\n`);\n\t\treturn { exitCode: 0 };\n\t} catch (error) {\n\t\tconst code = isFileSystemError(error)\n\t\t\t? \"local_input_error\"\n\t\t\t: \"invalid_usage\";\n\t\tconst message = error instanceof Error ? error.message : \"Dry-run failed.\";\n\t\treturn writeError(deps, code, message);\n\t}\n}\n\nconst MAX_BUNDLE_FILE_COUNT = 200;\n\nfunction formatUpdateDryRun(\n\ttarget: string,\n\tprepared: PreparedResult,\n): Record<string, unknown> {\n\tconst totalBytes = prepared.manifest.files.reduce(\n\t\t(sum, f) => sum + f.sizeBytes,\n\t\t0,\n\t);\n\treturn {\n\t\tdryRun: true,\n\t\tkind: \"staged\",\n\t\ttarget,\n\t\tmanifest: {\n\t\t\tfiles: prepared.manifest.files,\n\t\t\tentry: prepared.manifest.entry ?? null,\n\t\t},\n\t\toptions: prepared.options,\n\t\t...(prepared.metadata ? { metadata: prepared.metadata } : {}),\n\t\ttotalBytes,\n\t};\n}\n\nfunction validateDryRunFileCount(output: Record<string, unknown>): void {\n\tif (output.kind !== \"staged\") return;\n\tconst manifest = output.manifest as { files: ManifestFile[] };\n\tif (manifest.files.length > MAX_BUNDLE_FILE_COUNT) {\n\t\tthrow Object.assign(\n\t\t\tnew Error(\n\t\t\t\t`Bundle contains ${manifest.files.length} files, exceeding the maximum of ${MAX_BUNDLE_FILE_COUNT}.`,\n\t\t\t),\n\t\t\t{ code: \"ELIMIT\" },\n\t\t);\n\t}\n}\n\nfunction isFileSystemError(error: unknown): boolean {\n\tif (!(error instanceof Error)) return false;\n\tconst code = (error as NodeJS.ErrnoException).code;\n\treturn code === \"ENOENT\" || code === \"ENOTDIR\";\n}\n\nfunction withUpdateIdempotency(options: UpdateOptions): UpdateOptions {\n\treturn options.idempotencyKey\n\t\t? options\n\t\t: { ...options, idempotencyKey: `cli_upd_${randomUUID()}` };\n}\n\nfunction assertDropId(target: string): void {\n\tif (!target.startsWith(\"drop_\")) {\n\t\tthrow new Error(\n\t\t\t\"Update target must be a drop id returned by --json output, for example drop_...\",\n\t\t);\n\t}\n}\n","import { maskKey, resolveCredential } from \"../auth.js\";\nimport { writeHumanOrJson, writeKv } from \"../fmt.js\";\nimport type { CredentialStore } from \"../storage.js\";\n\nexport async function runWhoami(\n\t_input: { json?: boolean },\n\tdeps: {\n\t\tstore: CredentialStore;\n\t\tenv: Record<string, string | undefined>;\n\t\tstdout: (value: string) => void;\n\t\tstderr: (value: string) => void;\n\t\toutputMode?: \"human\" | \"json\";\n\t},\n): Promise<{ exitCode: number }> {\n\tconst credential = await resolveCredential({\n\t\tenv: deps.env,\n\t\tstore: deps.store,\n\t});\n\tif (!credential) {\n\t\twriteHumanOrJson(deps, \"Not authenticated. Run dropthis login.\", {\n\t\t\tok: true,\n\t\t\tauthenticated: false,\n\t\t});\n\t\treturn { exitCode: 0 };\n\t}\n\tconst masked = maskKey(credential.apiKey);\n\tconst pairs: Array<[string, string]> = [];\n\tif (credential.email) pairs.push([\"Email\", credential.email]);\n\tpairs.push([\"Key\", masked]);\n\tpairs.push([\"Source\", credential.source]);\n\tif (credential.accountId) pairs.push([\"Account\", credential.accountId]);\n\n\tconst jsonEnvelope = {\n\t\tok: true,\n\t\tauthenticated: true,\n\t\tsource: credential.source,\n\t\tmasked_key: masked,\n\t\t...(credential.keyId ? { key_id: credential.keyId } : {}),\n\t\t...(credential.keyLast4 ? { key_last4: credential.keyLast4 } : {}),\n\t\t...(credential.accountId ? { account_id: credential.accountId } : {}),\n\t\t...(credential.email ? { email: credential.email } : {}),\n\t};\n\twriteKv(deps, pairs, jsonEnvelope);\n\treturn { exitCode: 0 };\n}\n","import { Dropthis } from \"@dropthis/node\";\nimport { createOutput, type Output } from \"./output.js\";\n\nexport type GlobalOptions = {\n\tapiKey?: string;\n\tapiUrl?: string;\n\tjson?: boolean;\n\tquiet?: boolean;\n};\n\nexport type CliContext = {\n\tenv: Record<string, string | undefined>;\n\tglobal: GlobalOptions;\n\toutput: Output;\n\tstdout: (value: string) => void;\n\tstderr: (value: string) => void;\n\tcreateClient: (apiKey?: string) => Dropthis;\n};\n\nexport function createContext(input: {\n\tglobal?: GlobalOptions;\n\tenv?: Record<string, string | undefined>;\n\tstdout?: (value: string) => void;\n\tstderr?: (value: string) => void;\n\tstdoutIsTTY?: boolean;\n}): CliContext {\n\tconst env = input.env ?? process.env;\n\tconst global = input.global ?? {};\n\treturn {\n\t\tenv,\n\t\tglobal,\n\t\toutput: createOutput({\n\t\t\t...(global.json !== undefined ? { json: global.json } : {}),\n\t\t\t...(global.quiet !== undefined ? { quiet: global.quiet } : {}),\n\t\t\tstdoutIsTTY: input.stdoutIsTTY ?? process.stdout.isTTY === true,\n\t\t\tenv,\n\t\t}),\n\t\tstdout: input.stdout ?? ((value) => process.stdout.write(value)),\n\t\tstderr: input.stderr ?? ((value) => process.stderr.write(value)),\n\t\tcreateClient(apiKey) {\n\t\t\tconst baseUrl = global.apiUrl ?? env.DROPTHIS_API_URL;\n\t\t\treturn new Dropthis({\n\t\t\t\t...(apiKey ? { apiKey } : {}),\n\t\t\t\t...(baseUrl ? { baseUrl } : {}),\n\t\t\t});\n\t\t},\n\t};\n}\n","import { chmod, mkdir, readFile, rm, writeFile } from \"node:fs/promises\";\nimport { homedir } from \"node:os\";\nimport { dirname, join } from \"node:path\";\nimport { Entry } from \"@napi-rs/keyring\";\n\nexport type StoredCredential = {\n\tapiKey: string;\n\tkeyId?: string;\n\tkeyLast4?: string;\n\taccountId?: string;\n\temail?: string;\n\tstorage: \"secure\" | \"insecure\";\n};\n\nexport interface CredentialStore {\n\tread(): Promise<StoredCredential | null>;\n\tsave(credential: StoredCredential): Promise<void>;\n\tclear(): Promise<void>;\n}\n\nexport type KeyringAdapter = {\n\tgetPassword(): string | null | undefined | Promise<string | null | undefined>;\n\tsetPassword(value: string): void | Promise<void>;\n\tdeletePassword(): void | Promise<void>;\n};\n\nexport class MemoryCredentialStore implements CredentialStore {\n\tprivate credential: StoredCredential | null = null;\n\n\tasync read(): Promise<StoredCredential | null> {\n\t\treturn this.credential;\n\t}\n\n\tasync save(credential: StoredCredential): Promise<void> {\n\t\tthis.credential = credential;\n\t}\n\n\tasync clear(): Promise<void> {\n\t\tthis.credential = null;\n\t}\n}\n\nexport class InsecureFileCredentialStore implements CredentialStore {\n\tprivate readonly filePath: string;\n\n\tconstructor(options: { configDir?: string } = {}) {\n\t\tthis.filePath = credentialPath(options.configDir);\n\t}\n\n\tasync read(): Promise<StoredCredential | null> {\n\t\tconst value = await readJsonFile(this.filePath);\n\t\tif (!value) return null;\n\t\tif (typeof value.apiKey !== \"string\" || !value.apiKey) return null;\n\t\treturn { ...value, storage: \"insecure\" } as StoredCredential;\n\t}\n\n\tasync save(credential: StoredCredential): Promise<void> {\n\t\tawait writeCredentialFile(this.filePath, {\n\t\t\t...credential,\n\t\t\tstorage: \"insecure\",\n\t\t});\n\t}\n\n\tasync clear(): Promise<void> {\n\t\tawait rm(this.filePath, { force: true });\n\t}\n}\n\nexport class KeyringCredentialStore implements CredentialStore {\n\tprivate readonly filePath: string;\n\tprivate readonly keyring: KeyringAdapter;\n\n\tconstructor(options: { configDir?: string; keyring?: KeyringAdapter } = {}) {\n\t\tthis.filePath = credentialPath(options.configDir);\n\t\tthis.keyring = options.keyring ?? defaultKeyringAdapter();\n\t}\n\n\tasync read(): Promise<StoredCredential | null> {\n\t\tconst metadata = await readJsonFile(this.filePath);\n\t\tif (!metadata) return null;\n\t\tconst apiKey = await this.keyring.getPassword();\n\t\tif (typeof apiKey !== \"string\" || !apiKey) return null;\n\t\treturn { ...metadata, apiKey, storage: \"secure\" } as StoredCredential;\n\t}\n\n\tasync save(credential: StoredCredential): Promise<void> {\n\t\tawait this.keyring.setPassword(credential.apiKey);\n\t\tconst { apiKey: _apiKey, ...metadata } = credential;\n\t\tawait writeCredentialFile(this.filePath, {\n\t\t\t...metadata,\n\t\t\tstorage: \"secure\",\n\t\t});\n\t}\n\n\tasync clear(): Promise<void> {\n\t\tawait this.keyring.deletePassword();\n\t\tawait rm(this.filePath, { force: true });\n\t}\n}\n\nexport function createCredentialStore(\n\toptions: { insecure?: boolean; configDir?: string } = {},\n): CredentialStore {\n\tif (options.insecure) return new InsecureFileCredentialStore(options);\n\treturn new KeyringCredentialStore(options);\n}\n\nfunction defaultKeyringAdapter(): KeyringAdapter {\n\tconst entry = new Entry(\"dropthis\", \"default\");\n\treturn {\n\t\tgetPassword: () => entry.getPassword(),\n\t\tsetPassword: (value) => entry.setPassword(value),\n\t\tdeletePassword: () => {\n\t\t\tentry.deletePassword();\n\t\t},\n\t};\n}\n\nfunction credentialPath(configDir?: string): string {\n\treturn join(\n\t\tconfigDir ?? join(homedir(), \".config\", \"dropthis\"),\n\t\t\"credentials.json\",\n\t);\n}\n\nasync function readJsonFile(\n\tpath: string,\n): Promise<Record<string, unknown> | null> {\n\ttry {\n\t\treturn JSON.parse(await readFile(path, \"utf8\")) as Record<string, unknown>;\n\t} catch (error) {\n\t\tif (\n\t\t\terror &&\n\t\t\ttypeof error === \"object\" &&\n\t\t\t\"code\" in error &&\n\t\t\terror.code === \"ENOENT\"\n\t\t) {\n\t\t\treturn null;\n\t\t}\n\t\tthrow error;\n\t}\n}\n\nasync function writeCredentialFile(\n\tpath: string,\n\tcredential: Record<string, unknown>,\n): Promise<void> {\n\tawait mkdir(dirname(path), { recursive: true });\n\tawait writeFile(path, `${JSON.stringify(credential, null, 2)}\\n`, {\n\t\tmode: 0o600,\n\t});\n\tawait chmod(path, 0o600);\n}\n","#!/usr/bin/env node\nimport { buildProgram } from \"./program.js\";\nimport { createCredentialStore } from \"./storage.js\";\n\nbuildProgram({ store: createCredentialStore() })\n\t.parseAsync(process.argv)\n\t.catch((error: unknown) => {\n\t\tconsole.error(error);\n\t\tprocess.exitCode = 1;\n\t});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uBAA8C;;;ACW9C,eAAsB,kBAAkB,OAID;AACtC,MAAI,MAAM,OAAQ,QAAO,EAAE,QAAQ,MAAM,QAAQ,QAAQ,OAAO;AAChE,MAAI,MAAM,IAAI,kBAAkB;AAC/B,WAAO,EAAE,QAAQ,MAAM,IAAI,kBAAkB,QAAQ,MAAM;AAAA,EAC5D;AACA,QAAM,SAAS,MAAM,MAAM,MAAM,KAAK;AACtC,MAAI,CAAC,OAAQ,QAAO;AACpB,SAAO;AAAA,IACN,QAAQ,OAAO;AAAA,IACf,QAAQ;AAAA,IACR,GAAI,OAAO,QAAQ,EAAE,OAAO,OAAO,MAAM,IAAI,CAAC;AAAA,IAC9C,GAAI,OAAO,WAAW,EAAE,UAAU,OAAO,SAAS,IAAI,CAAC;AAAA,IACvD,GAAI,OAAO,YAAY,EAAE,WAAW,OAAO,UAAU,IAAI,CAAC;AAAA,IAC1D,GAAI,OAAO,QAAQ,EAAE,OAAO,OAAO,MAAM,IAAI,CAAC;AAAA,EAC/C;AACD;AAEO,SAAS,QAAQ,QAAwB;AAC/C,SAAO,OAAO,UAAU,IACrB,WACA,GAAG,OAAO,MAAM,GAAG,CAAC,CAAC,MAAM,OAAO,MAAM,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CAAC,CAAC;AACjD,QAAM,QAAQ,MAAM,OAAO,CAAC,GAAG,MAAM,MAAM,QAAQ,CAAC,MAAM,CAAC;AAC3D,MAAI,MAAM,SAAS,GAAG;AACrB,UAAM,IAAI;AAAA,MACT,yBAAyB,CAAC,GAAG,IAAI,IAAI,KAAK,CAAC,EAAE,KAAK,IAAI,CAAC;AAAA,IACxD;AAAA,EACD;AACA,aAAW,YAAY,UAAU;AAChC,UAAM,OAAO,MAAM,OAAO,QAAQ;AAClC,QAAI,KAAK,YAAY,GAAG;AACvB,YAAM,IAAI;AAAA,QACT,sGAAsG,QAAQ;AAAA,MAC/G;AAAA,IACD;AACA,UAAM,WAAW,aAAa,QAAQ;AACtC,UAAM,SAAS,UAAUC,MAAK,QAAQ,QAAQ,CAAC;AAAA,EAChD;AACA,SAAO;AACR;AAEA,eAAe,eACd,OACkB;AAClB,QAAM,SAAmB,CAAC;AAC1B,mBAAiB,SAAS,OAAO;AAChC,WAAO;AAAA,MACN,OAAO,UAAU,WAAW,OAAO,KAAK,KAAK,IAAI,OAAO,KAAK,KAAK;AAAA,IACnE;AAAA,EACD;AACA,SAAO,OAAO,OAAO,MAAM;AAC5B;;;AqBjqBA,aAAa,EAAE,OAAO,sBAAsB,EAAE,CAAC,EAC7C,WAAW,QAAQ,IAAI,EACvB,MAAM,CAACC,WAAmB;AAC1B,UAAQ,MAAMA,MAAK;AACnB,UAAQ,WAAW;AACpB,CAAC;","names":["error","pc","pc","pc","hasCredential","prompts","hasCredential","listItems","error","prompts","import_promises","import_picocolors","pc","text","import_promises","error","error","import_node_crypto","error","isFileSystemError","MAX_BUNDLE_FILE_COUNT","import_promises","import_node_path","error","deps","global","result","writeFile","join","error"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dropthis/cli",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Official CLI for Dropthis.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -32,11 +32,9 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@clack/prompts": "1.4.0",
35
- "@commander-js/extra-typings": "14.0.0",
36
35
  "@dropthis/node": "^0.1.0",
37
36
  "@napi-rs/keyring": "1.3.0",
38
37
  "commander": "14.0.3",
39
- "conf": "15.1.0",
40
38
  "picocolors": "1.1.1"
41
39
  },
42
40
  "devDependencies": {