@dropthis/cli 0.9.0 → 0.9.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 +4 -4
- package/dist/cli.cjs.map +1 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -769,13 +769,13 @@ async function runDoctor(_input, deps) {
|
|
|
769
769
|
const authSource = credential?.source ?? "missing";
|
|
770
770
|
const storageBackend = stored?.storage ?? "none";
|
|
771
771
|
const pairs = [
|
|
772
|
-
["Version", "0.9.
|
|
772
|
+
["Version", "0.9.1"],
|
|
773
773
|
["Auth", authSource],
|
|
774
774
|
["Storage", storageBackend]
|
|
775
775
|
];
|
|
776
776
|
writeKv(deps, pairs, {
|
|
777
777
|
ok: true,
|
|
778
|
-
version: "0.9.
|
|
778
|
+
version: "0.9.1",
|
|
779
779
|
auth: { source: authSource },
|
|
780
780
|
storage: { backend: storageBackend }
|
|
781
781
|
});
|
|
@@ -1833,7 +1833,7 @@ function buildProgram(options = {}) {
|
|
|
1833
1833
|
` ${import_picocolors4.default.cyan("dropthis login")}`,
|
|
1834
1834
|
` ${import_picocolors4.default.cyan("dropthis publish ./dist")}`
|
|
1835
1835
|
].join("\n")
|
|
1836
|
-
).version("0.9.
|
|
1836
|
+
).version("0.9.1").configureHelp({
|
|
1837
1837
|
subcommandTerm(cmd) {
|
|
1838
1838
|
const args = cmd.registeredArguments.map((a) => {
|
|
1839
1839
|
const name = a.name();
|
|
@@ -1853,7 +1853,7 @@ function buildProgram(options = {}) {
|
|
|
1853
1853
|
program.option("-q, --quiet", "Suppress status output and imply JSON");
|
|
1854
1854
|
program.option("--no-interactive", "Disable interactive prompts");
|
|
1855
1855
|
program.command("publish [input...]", { isDefault: true }).description(
|
|
1856
|
-
"Publish
|
|
1856
|
+
"Publish content to a permanent public URL (also: share, post, put online, make public, get a link).\nFiles, folders, URLs, strings, or stdin; multiple files bundle into one drop. Use - for stdin, or pipe without args.\nCreates a NEW drop each run \u2014 to change one you already published, use update-content (the files) or update-settings (title/visibility/password/slug/expiry/metadata) with its drop_\u2026 id, not publish again."
|
|
1857
1857
|
).option("--title <title>", "Drop title").option("--visibility <v>", "public or unlisted (default: public)").option("--password <password>", "Require password to view").option("--noindex", "Prevent search-engine indexing").option("--expires-at <datetime>", "Auto-delete after this ISO 8601 date").option(
|
|
1858
1858
|
"--content-type <mime>",
|
|
1859
1859
|
"Override MIME type (auto-detected from extension)"
|
package/dist/cli.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/inline-auth.ts","../src/cli.ts","../src/output.ts","../src/program.ts","../src/auth.ts","../src/fmt.ts","../src/ui.ts","../src/commands/account.ts","../src/commands/api-keys.ts","../src/types.ts","../src/catalog.ts","../src/commands/commands.ts","../src/commands/deployments.ts","../src/commands/doctor.ts","../src/commands/drops.ts","../src/commands/login.ts","../src/commands/logout.ts","../src/drop-operations.ts","../src/options.ts","../src/spinner.ts","../src/commands/publish.ts","../src/commands/update-content.ts","../src/commands/update-settings.ts","../src/commands/whoami.ts","../src/context.ts","../src/storage.ts"],"sourcesContent":["import { hostname as osHostname } from \"node:os\";\nimport { createInterface } from \"node:readline\";\nimport type { ResolvedCredential } from \"./auth.js\";\nimport type { CredentialStore } from \"./storage.js\";\nimport type { SdkErrorMessage, SdkResult } from \"./types.js\";\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\nexport type InlineAuthClient = {\n\tauth: {\n\t\trequestEmailOtp(input: {\n\t\t\temail: string;\n\t\t}): Promise<SdkResult<OtpRequestData, SdkErrorMessage>>;\n\t\tverifyEmailOtp(input: {\n\t\t\temail: string;\n\t\t\tcode: string;\n\t\t}): Promise<SdkResult<SessionData, SdkErrorMessage>>;\n\t};\n\tapiKeys: {\n\t\tcreate(input: {\n\t\t\tlabel: string;\n\t\t}): Promise<SdkResult<ApiKeyData, SdkErrorMessage>>;\n\t};\n};\n\ntype InlineAuthDeps = {\n\tclient: InlineAuthClient;\n\tcreateClient: (apiKey: string) => InlineAuthClient;\n\tstore: CredentialStore;\n\tstderr: (value: string) => void;\n\thostname?: string;\n\tprompt?: {\n\t\temail: () => Promise<string | symbol>;\n\t\tcode: (attempt: number, maxAttempts: number) => Promise<string | symbol>;\n\t};\n};\n\nexport async function runInlineAuth(\n\tdeps: InlineAuthDeps,\n): Promise<ResolvedCredential | null> {\n\ttry {\n\t\tconst prompt = deps.prompt ?? defaultPrompts();\n\n\t\tdeps.stderr(\"\\nNot logged in. Let's fix that:\\n\");\n\n\t\tconst emailResult = await prompt.email();\n\t\tif (typeof emailResult === \"symbol\") {\n\t\t\treturn null;\n\t\t}\n\t\tconst email = emailResult;\n\n\t\tconst otpRequest = await deps.client.auth.requestEmailOtp({ email });\n\t\tif (otpRequest.error) {\n\t\t\tdeps.stderr(`${otpRequest.error.message}\\n`);\n\t\t\treturn null;\n\t\t}\n\n\t\tdeps.stderr(\"Code sent! Check your inbox.\\n\");\n\n\t\tconst maxAttempts = 3;\n\t\tlet session: SessionData | null = null;\n\n\t\tfor (let attempt = 1; attempt <= maxAttempts; attempt++) {\n\t\t\tconst codeResult = await prompt.code(attempt, maxAttempts);\n\t\t\tif (typeof codeResult === \"symbol\") {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst code = codeResult;\n\n\t\t\tconst verifyResult = await deps.client.auth.verifyEmailOtp({\n\t\t\t\temail,\n\t\t\t\tcode,\n\t\t\t});\n\t\t\tif (!verifyResult.error) {\n\t\t\t\tsession = verifyResult.data;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (attempt < maxAttempts) {\n\t\t\t\tdeps.stderr(`${verifyResult.error.message}\\n`);\n\t\t\t} else {\n\t\t\t\tdeps.stderr(\n\t\t\t\t\t\"Too many attempts. Run `dropthis login` to request a new code.\\n\",\n\t\t\t\t);\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\n\t\tif (!session) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst authedClient = deps.createClient(session.token);\n\t\tconst apiKeyResult = await authedClient.apiKeys.create({\n\t\t\tlabel: `CLI on ${deps.hostname ?? osHostname()}`,\n\t\t});\n\t\tif (apiKeyResult.error) {\n\t\t\tdeps.stderr(`${apiKeyResult.error.message}\\n`);\n\t\t\treturn null;\n\t\t}\n\n\t\tconst { id: keyId, key: apiKey, keyLast4, accountId } = apiKeyResult.data;\n\n\t\ttry {\n\t\t\tawait deps.store.save({\n\t\t\t\tapiKey,\n\t\t\t\tkeyId,\n\t\t\t\tkeyLast4,\n\t\t\t\taccountId: accountId ?? session.accountId,\n\t\t\t\temail,\n\t\t\t\tstorage: \"secure\",\n\t\t\t});\n\t\t} catch (err) {\n\t\t\tconst message = err instanceof Error ? err.message : String(err);\n\t\t\tdeps.stderr(`Failed to save credentials: ${message}\\n`);\n\t\t\treturn null;\n\t\t}\n\n\t\tdeps.stderr(\"✓ Logged in\\n\\n\");\n\n\t\treturn {\n\t\t\tapiKey,\n\t\t\tsource: \"storage\",\n\t\t\tkeyId,\n\t\t\tkeyLast4,\n\t\t\taccountId: accountId ?? session.accountId,\n\t\t\temail,\n\t\t};\n\t} catch (err) {\n\t\tconst message = err instanceof Error ? err.message : String(err);\n\t\tdeps.stderr(`Login failed: ${message}\\n`);\n\t\treturn null;\n\t}\n}\n\nfunction defaultPrompts(): NonNullable<InlineAuthDeps[\"prompt\"]> {\n\treturn {\n\t\temail: () => readlineQuestion(\"Email: \"),\n\t\tcode: (attempt) =>\n\t\t\treadlineQuestion(\n\t\t\t\tattempt === 1 ? \"Code: \" : \"Try again — enter the code: \",\n\t\t\t),\n\t};\n}\n\nfunction readlineQuestion(question: string): Promise<string> {\n\tconst rl = createInterface({\n\t\tinput: process.stdin,\n\t\toutput: process.stderr,\n\t});\n\treturn new Promise((resolve) => {\n\t\trl.question(question, (answer) => {\n\t\t\trl.close();\n\t\t\tresolve(answer);\n\t\t});\n\t});\n}\n","#!/usr/bin/env node\nimport { errorEnvelope } from \"./output.js\";\nimport { buildProgram } from \"./program.js\";\nimport { createCredentialStore } from \"./storage.js\";\n\nexport function writeUsageErrorEnvelope(input: {\n\tmessage: string;\n\tjson: boolean;\n\tstderr: (value: string) => void;\n}): number {\n\tif (input.json) {\n\t\tinput.stderr(\n\t\t\t`${JSON.stringify(errorEnvelope(\"usage_error\", input.message))}\\n`,\n\t\t);\n\t} else {\n\t\tinput.stderr(`${input.message}\\n`);\n\t}\n\treturn 2;\n}\n\nfunction isCommanderError(\n\terr: unknown,\n): err is { code: string; message: string; exitCode: number } {\n\treturn (\n\t\ttypeof err === \"object\" &&\n\t\terr !== null &&\n\t\ttypeof (err as { code?: unknown }).code === \"string\" &&\n\t\t(err as { code: string }).code.startsWith(\"commander.\")\n\t);\n}\n\nfunction wantsJson(argv: string[]): boolean {\n\treturn (\n\t\targv.includes(\"--json\") ||\n\t\targv.includes(\"--quiet\") ||\n\t\targv.includes(\"-q\") ||\n\t\tprocess.env.CI === \"true\" ||\n\t\tprocess.stdout.isTTY !== true\n\t);\n}\n\nbuildProgram({ store: createCredentialStore() })\n\t.parseAsync(process.argv)\n\t.catch((error: unknown) => {\n\t\tif (isCommanderError(error)) {\n\t\t\t// commander.help / commander.helpDisplayed / commander.version are\n\t\t\t// non-error exits — render nothing and exit 0.\n\t\t\tif (\n\t\t\t\terror.code === \"commander.help\" ||\n\t\t\t\terror.code === \"commander.helpDisplayed\" ||\n\t\t\t\terror.code === \"commander.version\"\n\t\t\t) {\n\t\t\t\tprocess.exitCode = 0;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tprocess.exitCode = writeUsageErrorEnvelope({\n\t\t\t\tmessage: error.message,\n\t\t\t\tjson: wantsJson(process.argv.slice(2)),\n\t\t\t\tstderr: (value) => process.stderr.write(value),\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconsole.error(error);\n\t\tprocess.exitCode = 1;\n\t});\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\t| \"usage_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\tsuggestion?: string | null;\n\tretryable?: boolean | 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: normalizeApiErrorCode(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\t...(error.suggestion ? { suggestion: error.suggestion } : {}),\n\t\t\t...(error.retryable !== undefined && error.retryable !== null\n\t\t\t\t? { retryable: error.retryable }\n\t\t\t\t: {}),\n\t\t\tnext_action: nextActionForApiError(error),\n\t\t},\n\t};\n}\n\nexport function normalizeApiErrorCode(error: ApiErrorDetails): string {\n\tif (error.code) return error.code;\n\tif (error.statusCode === 404) return \"not_found\";\n\treturn \"api_error\";\n}\n\nexport function nextActionForApiError(error: ApiErrorDetails): string {\n\tif (error.suggestion) return error.suggestion;\n\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 === 404 || error.code === \"not_found\") {\n\t\treturn \"Check the drop id or slug and retry; list your drops with dropthis list.\";\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 === \"usage_error\") return 2;\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 { Command, InvalidArgumentError } from \"commander\";\nimport pc from \"picocolors\";\nimport { type ResolvedCredential, resolveCredential } from \"./auth.js\";\nimport {\n\trunAccountDelete,\n\trunAccountGet,\n\trunAccountUpdate,\n} 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 { runDropsDelete, runDropsGet, runDropsList } 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 { runUpdateContent } from \"./commands/update-content.js\";\nimport { runUpdateSettings } from \"./commands/update-settings.js\";\nimport { runWhoami } from \"./commands/whoami.js\";\nimport { createContext, type GlobalOptions } from \"./context.js\";\nimport { writeError } from \"./fmt.js\";\nimport type { InlineAuthClient } from \"./inline-auth.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\tconst writeErr =\n\t\toptions.stderr ?? ((value: string) => process.stderr.write(value));\n\tconst jsonModeForOutput = (): boolean => {\n\t\tconst argv =\n\t\t\t(program as Command & { rawArgs?: string[] }).rawArgs ?? process.argv;\n\t\treturn (\n\t\t\targv.includes(\"--json\") ||\n\t\t\targv.includes(\"--quiet\") ||\n\t\t\targv.includes(\"-q\") ||\n\t\t\toptions.env?.CI === \"true\" ||\n\t\t\t(options.env === undefined && process.env.CI === \"true\") ||\n\t\t\toptions.stdoutIsTTY === false ||\n\t\t\t(options.stdoutIsTTY === undefined && process.stdout.isTTY !== true)\n\t\t);\n\t};\n\tprogram.exitOverride();\n\tprogram.configureOutput({\n\t\twriteErr,\n\t\t// In JSON mode, suppress commander's default plain-text error so the\n\t\t// single JSON envelope written by cli.ts's catch is the only output.\n\t\toutputError: (str, write) => {\n\t\t\tif (!jsonModeForOutput()) write(str);\n\t\t},\n\t});\n\tprogram\n\t\t.name(\"dropthis\")\n\t\t.description(\n\t\t\t[\n\t\t\t\tpc.dim(\"Publish anything online and get a URL back.\"),\n\t\t\t\t\"\",\n\t\t\t\t`${pc.bold(\"Quick start:\")}`,\n\t\t\t\t` ${pc.cyan(\"dropthis login\")}`,\n\t\t\t\t` ${pc.cyan(\"dropthis publish ./dist\")}`,\n\t\t\t].join(\"\\n\"),\n\t\t)\n\t\t.version(PKG_VERSION)\n\t\t.configureHelp({\n\t\t\tsubcommandTerm(cmd) {\n\t\t\t\tconst args = cmd.registeredArguments\n\t\t\t\t\t.map((a) => {\n\t\t\t\t\t\tconst name = a.name();\n\t\t\t\t\t\tconst variadic = a.variadic ? \"...\" : \"\";\n\t\t\t\t\t\treturn a.required ? `<${name}${variadic}>` : `[${name}${variadic}]`;\n\t\t\t\t\t})\n\t\t\t\t\t.join(\" \");\n\t\t\t\treturn args ? `${cmd.name()} ${args}` : cmd.name();\n\t\t\t},\n\t\t\tstyleTitle: (title) => pc.bold(title),\n\t\t\tstyleCommandText: (str) => pc.cyan(str),\n\t\t\tstyleSubcommandText: (str) => pc.cyan(str),\n\t\t\tstyleOptionText: (str) => pc.yellow(str),\n\t\t});\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\tprogram.option(\"--no-interactive\", \"Disable interactive prompts\");\n\n\tprogram\n\t\t.command(\"publish [input...]\", { isDefault: true })\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(\"--title <title>\", \"Drop title\")\n\t\t.option(\"--visibility <v>\", \"public or unlisted (default: public)\")\n\t\t.option(\"--password <password>\", \"Require password to view\")\n\t\t.option(\"--noindex\", \"Prevent search-engine indexing\")\n\t\t.option(\"--expires-at <datetime>\", \"Auto-delete after this ISO 8601 date\")\n\t\t.option(\n\t\t\t\"--content-type <mime>\",\n\t\t\t\"Override MIME type (auto-detected from extension)\",\n\t\t)\n\t\t.option(\n\t\t\t\"--entry <path>\",\n\t\t\t\"Entry file for multi-file bundles (default: index.html)\",\n\t\t)\n\t\t.option(\n\t\t\t\"--metadata <json>\",\n\t\t\t'Attach JSON key-value pairs, e.g. \\'{\"source\":\"ci\"}\\'',\n\t\t)\n\t\t.option(\"--metadata-file <path>\", \"Read metadata JSON from a file\")\n\t\t.option(\"--path <name>\", \"Set filename when publishing from stdin\")\n\t\t.option(\"--url\", \"Print only the published URL (no JSON envelope)\")\n\t\t.option(\n\t\t\t\"--dry-run\",\n\t\t\t\"Show what would be published without publishing (JSON; cannot combine with --url)\",\n\t\t)\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.option(\n\t\t\t\"--idempotency-key <key>\",\n\t\t\t\"Prevent duplicate publishes on retry (auto-generated)\",\n\t\t)\n\t\t.action(async (inputs: string[], commandOptions: RawCommandOptions) => {\n\t\t\tconst stdinIsTTY = options.stdinIsTTY ?? process.stdin.isTTY ?? false;\n\t\t\tif (inputs.length === 0 && stdinIsTTY) {\n\t\t\t\tprogram.outputHelp();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst { deps } = await buildPublishDeps(\n\t\t\t\tprogram,\n\t\t\t\toptions,\n\t\t\t\tstore,\n\t\t\t\tcommandOptions,\n\t\t\t\tstdinIsTTY,\n\t\t\t);\n\n\t\t\tlet publishInput: string | string[] | undefined;\n\t\t\ttry {\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} catch (err) {\n\t\t\t\tconst msg = err instanceof Error ? err.message : \"Invalid input.\";\n\t\t\t\tprocess.exitCode = writeError(deps, \"local_input_error\", msg).exitCode;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tlet dropOpts: ReturnType<typeof toDropOptions>;\n\t\t\ttry {\n\t\t\t\tdropOpts = toDropOptions(commandOptions);\n\t\t\t} catch (err) {\n\t\t\t\tconst msg = err instanceof Error ? err.message : \"Invalid option.\";\n\t\t\t\tprocess.exitCode = writeError(deps, \"invalid_usage\", msg).exitCode;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst result = await runPublish(publishInput, dropOpts, deps);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\n\tprogram\n\t\t.command(\"update-content <dropId> [input...]\")\n\t\t.description(\n\t\t\t\"Replace a drop's content, same URL (pass the full drop_… id, not the slug).\\nShips a new deployment. Settings stay unchanged — use update-settings for title, visibility, password, slug, expiry, or metadata.\",\n\t\t)\n\t\t.option(\n\t\t\t\"--entry <path>\",\n\t\t\t\"Entry file for multi-file bundles (default: index.html)\",\n\t\t)\n\t\t.option(\n\t\t\t\"--content-type <mime>\",\n\t\t\t\"Override MIME type (auto-detected from extension)\",\n\t\t)\n\t\t.option(\"--path <name>\", \"Set filename for stdin content\")\n\t\t.option(\n\t\t\t\"--if-revision <n>\",\n\t\t\t\"Fail if current revision doesn't match (optimistic lock)\",\n\t\t\tparseInteger,\n\t\t)\n\t\t.option(\"--url\", \"Print only the published URL (no JSON envelope)\")\n\t\t.option(\n\t\t\t\"--dry-run\",\n\t\t\t\"Show what would be shipped without updating (JSON; cannot combine with --url)\",\n\t\t)\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.option(\n\t\t\t\"--idempotency-key <key>\",\n\t\t\t\"Prevent duplicate updates on retry (auto-generated)\",\n\t\t)\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tdropId: string,\n\t\t\t\tinputs: string[],\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 runUpdateContent>[3][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst stdinIsTTY = options.stdinIsTTY ?? process.stdin.isTTY ?? false;\n\t\t\t\tlet updateInput: string | string[] | undefined;\n\t\t\t\ttry {\n\t\t\t\t\tupdateInput = await resolvePublishInputs(\n\t\t\t\t\t\tinputs,\n\t\t\t\t\t\toptions.stdin,\n\t\t\t\t\t\tstdinIsTTY,\n\t\t\t\t\t);\n\t\t\t\t} catch (err) {\n\t\t\t\t\tconst msg = err instanceof Error ? err.message : \"Invalid input.\";\n\t\t\t\t\tprocess.exitCode = writeError(\n\t\t\t\t\t\tdeps,\n\t\t\t\t\t\t\"local_input_error\",\n\t\t\t\t\t\tmsg,\n\t\t\t\t\t).exitCode;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tlet dropOpts: ReturnType<typeof toDropOptions>;\n\t\t\t\ttry {\n\t\t\t\t\tdropOpts = toDropOptions(commandOptions);\n\t\t\t\t} catch (err) {\n\t\t\t\t\tconst msg = err instanceof Error ? err.message : \"Invalid option.\";\n\t\t\t\t\tprocess.exitCode = writeError(deps, \"invalid_usage\", msg).exitCode;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst result = await runUpdateContent(\n\t\t\t\t\tdropId,\n\t\t\t\t\tupdateInput,\n\t\t\t\t\tdropOpts,\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(\"update-settings <dropId>\")\n\t\t.description(\n\t\t\t\"Change a drop's title, visibility, password, vanity slug, expiry, or metadata (pass the full drop_… id, not the slug).\\nContent stays unchanged — use update-content to replace the files at the URL.\",\n\t\t)\n\t\t.option(\"--slug <slug>\", \"Change the vanity slug\")\n\t\t.option(\"--title <title>\", \"Change title\")\n\t\t.option(\"--visibility <v>\", \"Set to public or unlisted\")\n\t\t.option(\"--password <password>\", \"Require password to view\")\n\t\t.option(\"--no-password\", \"Remove password protection\")\n\t\t.option(\"--noindex\", \"Prevent search-engine indexing\")\n\t\t.option(\"--index\", \"Allow search-engine indexing\")\n\t\t.option(\"--expires-at <datetime>\", \"Auto-delete after this ISO 8601 date\")\n\t\t.option(\n\t\t\t\"--metadata <json>\",\n\t\t\t'Attach JSON key-value pairs, e.g. \\'{\"source\":\"ci\"}\\'',\n\t\t)\n\t\t.option(\"--metadata-file <path>\", \"Read metadata JSON from a file\")\n\t\t.option(\n\t\t\t\"--if-revision <n>\",\n\t\t\t\"Fail if current revision doesn't match (optimistic lock)\",\n\t\t\tparseInteger,\n\t\t)\n\t\t.option(\"--url\", \"Print only the published URL (no JSON envelope)\")\n\t\t.option(\n\t\t\t\"--dry-run\",\n\t\t\t\"Show what would change without updating (JSON; cannot combine with --url)\",\n\t\t)\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.option(\n\t\t\t\"--idempotency-key <key>\",\n\t\t\t\"Prevent duplicate updates on retry (auto-generated)\",\n\t\t)\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tdropId: string,\n\t\t\t\tcommandOptions: RawCommandOptions & { ifRevision?: number },\n\t\t\t) => {\n\t\t\t\tconst stdinIsTTY = options.stdinIsTTY ?? process.stdin.isTTY ?? false;\n\t\t\t\tconst global = globalOptions(program, commandOptions);\n\t\t\t\tconst deps = await commandDeps<\n\t\t\t\t\tParameters<typeof runUpdateSettings>[2][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tlet dropOpts: ReturnType<typeof toDropOptions>;\n\t\t\t\ttry {\n\t\t\t\t\tdropOpts = toDropOptions(commandOptions);\n\t\t\t\t} catch (err) {\n\t\t\t\t\tconst msg = err instanceof Error ? err.message : \"Invalid option.\";\n\t\t\t\t\tprocess.exitCode = writeError(deps, \"invalid_usage\", msg).exitCode;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst result = await runUpdateSettings(dropId, dropOpts, {\n\t\t\t\t\t...deps,\n\t\t\t\t\tinteractive: isInteractive(stdinIsTTY, deps.env, global),\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(\"get <dropId>\")\n\t\t.description(\"Show drop details (pass the full drop_… id)\")\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\n\tprogram\n\t\t.command(\"list\")\n\t\t.description(\"List your drops\")\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\n\tprogram\n\t\t.command(\"delete <dropId>\")\n\t\t.description(\"Delete a drop (pass the full drop_… id)\")\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 stdinIsTTY = options.stdinIsTTY ?? process.stdin.isTTY ?? false;\n\t\t\t\tconst global = globalOptions(program, commandOptions);\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{\n\t\t\t\t\t\t...commandOptions,\n\t\t\t\t\t\tinteractive: isInteractive(stdinIsTTY, deps.env, global),\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 deployments = program\n\t\t.command(\"deployments\")\n\t\t.description(\"View deployment history\");\n\tdeployments\n\t\t.command(\"list <dropId>\")\n\t\t.description(\"List deployments for a drop\")\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.description(\"Show deployment details\")\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\tconst apiKeys = program.command(\"api-keys\").description(\"Manage API keys\");\n\tapiKeys\n\t\t.command(\"create\")\n\t\t.description(\"Create an API key\")\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.description(\"List API keys\")\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.description(\"Delete an API key\")\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 stdinIsTTY = options.stdinIsTTY ?? process.stdin.isTTY ?? false;\n\t\t\t\tconst global = globalOptions(program, commandOptions);\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{\n\t\t\t\t\t\t...commandOptions,\n\t\t\t\t\t\tinteractive: isInteractive(stdinIsTTY, deps.env, global),\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\t// --- Auth commands ---\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<Parameters<typeof runWhoami>[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 runWhoami(commandOptions, deps);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\n\tconst account = program\n\t\t.command(\"account\")\n\t\t.description(\"Show or manage your account\");\n\taccount\n\t\t.command(\"get\", { isDefault: true })\n\t\t.description(\"Show 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\taccount\n\t\t.command(\"update\")\n\t\t.description(\"Update account display name\")\n\t\t.requiredOption(\"--display-name <name>\", \"Set the display name\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(async (commandOptions: { displayName: string; json?: boolean }) => {\n\t\t\tconst deps = await commandDeps<\n\t\t\t\tParameters<typeof runAccountUpdate>[1][\"client\"]\n\t\t\t>(program, options, store, commandOptions);\n\t\t\tconst result = await runAccountUpdate(\n\t\t\t\t{\n\t\t\t\t\tdisplayName: commandOptions.displayName,\n\t\t\t\t\t...(commandOptions.json !== undefined\n\t\t\t\t\t\t? { json: commandOptions.json }\n\t\t\t\t\t\t: {}),\n\t\t\t\t},\n\t\t\t\tdeps,\n\t\t\t);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\taccount\n\t\t.command(\"delete\")\n\t\t.description(\"Delete your account\")\n\t\t.option(\"--yes\", \"Confirm deletion\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(async (commandOptions: { yes?: boolean; json?: boolean }) => {\n\t\t\tconst stdinIsTTY = options.stdinIsTTY ?? process.stdin.isTTY ?? false;\n\t\t\tconst global = globalOptions(program, commandOptions);\n\t\t\tconst deps = await commandDeps<\n\t\t\t\tParameters<typeof runAccountDelete>[1][\"client\"]\n\t\t\t>(program, options, store, commandOptions);\n\t\t\tconst result = await runAccountDelete(\n\t\t\t\t{\n\t\t\t\t\t...commandOptions,\n\t\t\t\t\tinteractive: isInteractive(stdinIsTTY, deps.env, global),\n\t\t\t\t},\n\t\t\t\tdeps,\n\t\t\t);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\n\t// --- Diagnostics ---\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, program });\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\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\nasync function buildPublishDeps(\n\tprogram: Command,\n\toptions: BuildProgramOptions,\n\tstore: CredentialStore,\n\tcommandOptions: { json?: boolean; quiet?: boolean },\n\tstdinIsTTY: boolean,\n): Promise<{\n\tdeps: RunnerDeps<Parameters<typeof runPublish>[2][\"client\"]> & {\n\t\tinteractive: boolean;\n\t\tinlineAuth: () => Promise<ResolvedCredential | null>;\n\t\tcreateClient: (\n\t\t\tapiKey: string,\n\t\t) => Parameters<typeof runPublish>[2][\"client\"];\n\t};\n}> {\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\tconst interactive = isInteractive(stdinIsTTY, context.env, global);\n\n\tconst inlineAuth = async () => {\n\t\tconst { runInlineAuth } = await import(\"./inline-auth.js\");\n\t\treturn runInlineAuth({\n\t\t\tclient: context.createClient() as unknown as InlineAuthClient,\n\t\t\tcreateClient: (apiKey: string) =>\n\t\t\t\tcontext.createClient(apiKey) as unknown as InlineAuthClient,\n\t\t\tstore,\n\t\t\tstderr: context.stderr,\n\t\t});\n\t};\n\n\treturn {\n\t\tdeps: {\n\t\t\tstore,\n\t\t\tclient: (options.client ??\n\t\t\t\tcontext.createClient(credential?.apiKey)) as Parameters<\n\t\t\t\ttypeof runPublish\n\t\t\t>[2][\"client\"],\n\t\t\t...(global.apiKey ? { apiKey: global.apiKey } : {}),\n\t\t\tenv: context.env,\n\t\t\tstdout: context.stdout,\n\t\t\tstderr: context.stderr,\n\t\t\toutputMode: context.output.mode,\n\t\t\tinteractive,\n\t\t\tinlineAuth,\n\t\t\tcreateClient: (apiKey: string) =>\n\t\t\t\tcontext.createClient(apiKey) as unknown as Parameters<\n\t\t\t\t\ttypeof runPublish\n\t\t\t\t>[2][\"client\"],\n\t\t},\n\t};\n}\n\nfunction isInteractive(\n\tstdinIsTTY: boolean,\n\tenv: Record<string, string | undefined>,\n\tglobal: GlobalOptions,\n): boolean {\n\treturn (\n\t\tstdinIsTTY &&\n\t\t!env.CI &&\n\t\t!env.DROPTHIS_NON_INTERACTIVE &&\n\t\tglobal.interactive !== false\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\t...(opts.interactive !== undefined\n\t\t\t? { interactive: opts.interactive }\n\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\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\n\t\t\t? { visibility: options.visibility as \"public\" | \"unlisted\" }\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.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 resolvePublishInputs(\n\tinputs: string[],\n\tstdin?: AsyncIterable<string | Uint8Array>,\n\tstdinIsTTY?: boolean,\n): Promise<string | 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\tif (inputs.includes(\"-\")) {\n\t\tthrow new Error(\n\t\t\t\"Cannot read stdin (-) alongside multiple file arguments. Pass file paths only.\",\n\t\t);\n\t}\n\treturn inputs;\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 async function requireCredential(input: {\n\tapiKey?: string;\n\tenv: Record<string, string | undefined>;\n\tstore: CredentialStore;\n}): Promise<ResolvedCredential> {\n\tconst credential = await resolveCredential(input);\n\tif (!credential) {\n\t\tthrow Object.assign(new Error(\"No API key found.\"), {\n\t\t\tcode: \"auth_error\" as const,\n\t\t});\n\t}\n\treturn credential;\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","import pc from \"picocolors\";\nimport type { ApiErrorDetails } from \"./output.js\";\nimport {\n\tapiErrorEnvelope,\n\ttype CliErrorCode,\n\terrorEnvelope,\n\texitCodeFor,\n\tnextActionForApiError,\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\tconst details = formatDropDetails(data);\n\t\tif (details) deps.stdout(`${details}\\n`);\n\t} else {\n\t\tdeps.stdout(`${JSON.stringify({ ok: true, drop: data })}\\n`);\n\t}\n}\n\nfunction formatDropDetails(data: Record<string, unknown>): string {\n\tconst parts: string[] = [];\n\tconst size = data.sizeBytes;\n\tif (typeof size === \"number\") parts.push(formatBytes(size));\n\tconst ct = data.contentType;\n\tif (typeof ct === \"string\") parts.push(ct.split(\";\")[0]!);\n\tconst vis = data.visibility;\n\tif (vis === \"unlisted\") parts.push(\"unlisted\");\n\tconst exp = data.expiresAt;\n\tif (typeof exp === \"string\") parts.push(`expires ${exp.split(\"T\")[0]}`);\n\tif (parts.length === 0) return \"\";\n\treturn ` ${pc.dim(parts.join(\" · \"))}`;\n}\n\nfunction formatBytes(bytes: number): string {\n\tif (bytes < 1024) return `${bytes} B`;\n\tif (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;\n\treturn `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\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 = nextActionForApiError(details);\n\t\tif (nextAction) deps.stderr(`${hint(nextAction)}\\n`);\n\t\tif (details.requestId)\n\t\t\tdeps.stderr(`${pc.dim(`Request ID: ${details.requestId}`)}\\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 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 { requireCredential } from \"../auth.js\";\nimport {\n\twriteApiError,\n\twriteAuthError,\n\twriteError,\n\twriteHumanOrJson,\n\twriteKv,\n} from \"../fmt.js\";\nimport type { CommandDeps, SdkResult } from \"../types.js\";\nimport { success } from \"../ui.js\";\n\ntype AccountClient = {\n\taccount: { get(): Promise<SdkResult<unknown>> };\n};\n\ntype AccountUpdateClient = {\n\taccount: {\n\t\tupdate(input: { displayName: string | null }): Promise<SdkResult<unknown>>;\n\t};\n};\n\ntype AccountDeleteClient = {\n\taccount: { delete(): Promise<SdkResult<null>> };\n};\n\nexport async function runAccountGet(\n\t_input: { json?: boolean },\n\tdeps: CommandDeps<AccountClient>,\n): Promise<{ exitCode: number }> {\n\ttry {\n\t\tawait requireCredential({\n\t\t\t...(deps.apiKey ? { apiKey: deps.apiKey } : {}),\n\t\t\tenv: deps.env,\n\t\t\tstore: deps.store,\n\t\t});\n\t} catch {\n\t\treturn writeAuthError(deps);\n\t}\n\tconst result = await deps.client.account.get();\n\tif (result.error) {\n\t\treturn writeApiError(deps, result.error);\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\tif (data?.displayName) pairs.push([\"Name\", String(data.displayName)]);\n\tif (data?.status) pairs.push([\"Status\", String(data.status)]);\n\tif (data?.createdAt)\n\t\tpairs.push([\"Created\", String(data.createdAt).split(\"T\")[0]!]);\n\n\twriteKv(deps, pairs, { ok: true, account: result.data });\n\treturn { exitCode: 0 };\n}\n\nexport async function runAccountUpdate(\n\tinput: { displayName: string | null; json?: boolean },\n\tdeps: CommandDeps<AccountUpdateClient>,\n): Promise<{ exitCode: number }> {\n\ttry {\n\t\tawait requireCredential({\n\t\t\t...(deps.apiKey ? { apiKey: deps.apiKey } : {}),\n\t\t\tenv: deps.env,\n\t\t\tstore: deps.store,\n\t\t});\n\t} catch {\n\t\treturn writeAuthError(deps);\n\t}\n\tconst result = await deps.client.account.update({\n\t\tdisplayName: input.displayName,\n\t});\n\tif (result.error) return writeApiError(deps, result.error);\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?.displayName) pairs.push([\"Name\", String(data.displayName)]);\n\twriteKv(deps, pairs, { ok: true, account: result.data });\n\treturn { exitCode: 0 };\n}\n\nexport async function runAccountDelete(\n\tinput: { yes?: boolean; json?: boolean; interactive?: boolean },\n\tdeps: CommandDeps<AccountDeleteClient>,\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 the account in non-interactive mode.\",\n\t\t);\n\t}\n\ttry {\n\t\tawait requireCredential({\n\t\t\t...(deps.apiKey ? { apiKey: deps.apiKey } : {}),\n\t\t\tenv: deps.env,\n\t\t\tstore: deps.store,\n\t\t});\n\t} catch {\n\t\treturn writeAuthError(deps);\n\t}\n\tconst result = await deps.client.account.delete();\n\tif (result.error) return writeApiError(deps, result.error);\n\twriteHumanOrJson(deps, success(\"Account deleted\"), {\n\t\tok: true,\n\t\tdeleted: true,\n\t});\n\treturn { exitCode: 0 };\n}\n","import * as prompts from \"@clack/prompts\";\nimport { requireCredential } from \"../auth.js\";\nimport {\n\twriteApiError,\n\twriteAuthError,\n\twriteEmpty,\n\twriteError,\n\twriteHumanOrJson,\n\twriteJson,\n\twriteKv,\n} from \"../fmt.js\";\nimport { type CommandDeps, type SdkResult, unwrapListData } from \"../types.js\";\nimport { success } from \"../ui.js\";\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<{ ok: true }>> | SdkResult<{ ok: true }> | undefined;\n\t};\n};\n\nexport async function runApiKeysCreate(\n\tinput: { label: string; json?: boolean },\n\tdeps: CommandDeps<ApiKeysCreateClient>,\n): Promise<{ exitCode: number }> {\n\ttry {\n\t\tawait requireCredential({\n\t\t\t...(deps.apiKey ? { apiKey: deps.apiKey } : {}),\n\t\t\tenv: deps.env,\n\t\t\tstore: deps.store,\n\t\t});\n\t} catch {\n\t\treturn writeAuthError(deps);\n\t}\n\tconst result = await deps.client.apiKeys.create({ label: input.label });\n\tif (result.error) return writeApiError(deps, result.error);\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.keyLast4) pairs.push([\"Last 4\", String(data.keyLast4)]);\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\ttry {\n\t\tawait requireCredential({\n\t\t\t...(deps.apiKey ? { apiKey: deps.apiKey } : {}),\n\t\t\tenv: deps.env,\n\t\t\tstore: deps.store,\n\t\t});\n\t} catch {\n\t\treturn writeAuthError(deps);\n\t}\n\tconst result = await deps.client.apiKeys.list();\n\tif (result.error) return writeApiError(deps, result.error);\n\tconst raw = unwrapListData(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.keyLast4 ?? \"\"}\\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\ttry {\n\t\tawait requireCredential({\n\t\t\t...(deps.apiKey ? { apiKey: deps.apiKey } : {}),\n\t\t\tenv: deps.env,\n\t\t\tstore: deps.store,\n\t\t});\n\t} catch {\n\t\treturn writeAuthError(deps);\n\t}\n\tconst result = await deps.client.apiKeys.delete(keyId);\n\tif (result?.error) return writeApiError(deps, result.error);\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","import type { ApiErrorDetails } from \"./output.js\";\nimport type { CredentialStore } from \"./storage.js\";\n\nexport type SdkErrorMessage = { message: string };\n\nexport type SdkResult<T, E extends SdkErrorMessage = ApiErrorDetails> =\n\t| { data: T; error: null; headers?: Record<string, string> }\n\t| { data: null; error: E; headers?: Record<string, string> };\n\nexport type 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 function unwrapListData(\n\tdata: unknown,\n\t...fallbackKeys: string[]\n): unknown {\n\tif (data && typeof data === \"object\") {\n\t\tif (\"data\" in data) {\n\t\t\treturn (data as Record<string, unknown>).data;\n\t\t}\n\t\tfor (const key of fallbackKeys) {\n\t\t\tif (key in data) {\n\t\t\t\treturn (data as Record<string, unknown>)[key];\n\t\t\t}\n\t\t}\n\t}\n\treturn data;\n}\n","import type { Command } from \"commander\";\n\nexport type CommandEntry = {\n\tname: string;\n\tdescription: string;\n\targuments?: string[];\n\toptions?: string[];\n\tauth?: \"required\";\n\texamples?: string[];\n\tsubcommands?: CommandEntry[];\n};\n\ntype CommandAnnotation = {\n\tauth?: \"required\";\n\texamples?: string[];\n};\n\n// Agent-helpful metadata the commander tree does not carry. Keyed by the\n// space-joined command path (e.g. \"publish\", \"account update\"). Structure\n// (name/description/arguments/options/subcommands) is generated from the live\n// program, so this map only supplies auth + examples and cannot drift it.\nconst COMMAND_ANNOTATIONS: Record<string, CommandAnnotation> = {\n\tpublish: {\n\t\tauth: \"required\",\n\t\texamples: [\n\t\t\t\"dropthis ./report.html\",\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\"update-content\": {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis update-content drop_abc ./site --json\"],\n\t},\n\t\"update-settings\": {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis update-settings drop_abc --title 'Launch' --json\"],\n\t},\n\tget: {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis get drop_abc --json\"],\n\t},\n\tlist: {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis list --json\"],\n\t},\n\tdelete: {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis delete drop_abc --yes --json\"],\n\t},\n\tdeployments: {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis deployments drop_abc --json\"],\n\t},\n\t\"deployments list\": {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis deployments list drop_abc --json\"],\n\t},\n\t\"deployments get\": {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis deployments get drop_abc dep_abc --json\"],\n\t},\n\t\"api-keys\": {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis api-keys create --label CI --json\"],\n\t},\n\tlogin: {\n\t\texamples: [\n\t\t\t\"dropthis login verify --email user@example.com --otp 123456 --json\",\n\t\t],\n\t},\n\tlogout: { examples: [\"dropthis logout --json\"] },\n\twhoami: { auth: \"required\", examples: [\"dropthis whoami --json\"] },\n\taccount: { auth: \"required\", examples: [\"dropthis account --json\"] },\n\t\"account get\": { auth: \"required\" },\n\t\"account update\": {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis account update --display-name 'Ada' --json\"],\n\t},\n\t\"account delete\": {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis account delete --yes --json\"],\n\t},\n\tdoctor: { examples: [\"dropthis doctor --json\"] },\n\tcommands: { examples: [\"dropthis commands --json\"] },\n};\n\nfunction describeArgs(cmd: Command): string[] {\n\treturn cmd.registeredArguments.map((a) => a.name());\n}\n\nfunction describeOptions(cmd: Command): string[] {\n\treturn cmd.options.map((o) => o.long ?? o.short ?? o.flags);\n}\n\nfunction toEntry(cmd: Command, path: string[]): CommandEntry {\n\tconst fullPath = [...path, cmd.name()];\n\tconst annotation = COMMAND_ANNOTATIONS[fullPath.join(\" \")];\n\tconst subs = cmd.commands.map((sub) => toEntry(sub, fullPath));\n\treturn {\n\t\tname: cmd.name(),\n\t\tdescription: cmd.description(),\n\t\t...(describeArgs(cmd).length ? { arguments: describeArgs(cmd) } : {}),\n\t\t...(describeOptions(cmd).length ? { options: describeOptions(cmd) } : {}),\n\t\t...(annotation?.auth ? { auth: annotation.auth } : {}),\n\t\t...(annotation?.examples ? { examples: annotation.examples } : {}),\n\t\t...(subs.length ? { subcommands: subs } : {}),\n\t};\n}\n\nexport function buildCatalog(program: Command): CommandEntry[] {\n\treturn program.commands.map((cmd) => toEntry(cmd, []));\n}\n","import type { Command } from \"commander\";\nimport { buildCatalog } from \"../catalog.js\";\n\nexport async function runCommands(\n\t_input: { json?: boolean },\n\tdeps: { stdout: (value: string) => void; program: Command },\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: buildCatalog(deps.program),\n\t\t})}\\n`,\n\t);\n\treturn { exitCode: 0 };\n}\n","import { requireCredential } from \"../auth.js\";\nimport {\n\twriteApiError,\n\twriteAuthError,\n\twriteEmpty,\n\twriteJson,\n\twriteKv,\n} from \"../fmt.js\";\nimport type { CommandDeps, SdkResult } from \"../types.js\";\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\nexport async function runDeploymentsList(\n\tdropId: string,\n\tinput: { limit?: number; cursor?: string; json?: boolean },\n\tdeps: CommandDeps<DeploymentsClient>,\n): Promise<{ exitCode: number }> {\n\ttry {\n\t\tawait requireCredential({\n\t\t\t...(deps.apiKey ? { apiKey: deps.apiKey } : {}),\n\t\t\tenv: deps.env,\n\t\t\tstore: deps.store,\n\t\t});\n\t} catch {\n\t\treturn writeAuthError(deps);\n\t}\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.createdAt ?? \"\"}\\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: CommandDeps<DeploymentsClient>,\n): Promise<{ exitCode: number }> {\n\ttry {\n\t\tawait requireCredential({\n\t\t\t...(deps.apiKey ? { apiKey: deps.apiKey } : {}),\n\t\t\tenv: deps.env,\n\t\t\tstore: deps.store,\n\t\t});\n\t} catch {\n\t\treturn writeAuthError(deps);\n\t}\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.createdAt) pairs.push([\"Created\", String(data.createdAt)]);\n\twriteKv(deps, pairs, { ok: true, deployment: result.data });\n\treturn { exitCode: 0 };\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 { requireCredential } from \"../auth.js\";\nimport {\n\twriteApiError,\n\twriteAuthError,\n\twriteEmpty,\n\twriteError,\n\twriteHumanOrJson,\n\twriteJson,\n\twriteKv,\n} from \"../fmt.js\";\nimport { type CommandDeps, type SdkResult, unwrapListData } from \"../types.js\";\nimport { url as fmtUrl, success } from \"../ui.js\";\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 DropsDeleteClient = {\n\tdrops: {\n\t\tdelete(\n\t\t\tdropId: string,\n\t\t): Promise<SdkResult<null>> | SdkResult<null> | undefined;\n\t};\n};\n\nexport async function runDropsList(\n\tinput: { limit?: number; cursor?: string; json?: boolean },\n\tdeps: CommandDeps<DropsListClient>,\n): Promise<{ exitCode: number }> {\n\ttry {\n\t\tawait requireCredential({\n\t\t\t...(deps.apiKey ? { apiKey: deps.apiKey } : {}),\n\t\t\tenv: deps.env,\n\t\t\tstore: deps.store,\n\t\t});\n\t} catch {\n\t\treturn writeAuthError(deps);\n\t}\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 writeApiError(deps, result.error);\n\tconst raw = unwrapListData(result.data, \"drops\");\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\ttry {\n\t\tawait requireCredential({\n\t\t\t...(deps.apiKey ? { apiKey: deps.apiKey } : {}),\n\t\t\tenv: deps.env,\n\t\t\tstore: deps.store,\n\t\t});\n\t} catch {\n\t\treturn writeAuthError(deps);\n\t}\n\tconst result = await deps.client.drops.get(dropId);\n\tif (result.error) return writeApiError(deps, result.error);\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.createdAt) pairs.push([\"Created\", String(data.createdAt)]);\n\tif (data.accessible !== undefined)\n\t\tpairs.push([\"Accessible\", String(data.accessible)]);\n\tif (data.persistent !== undefined)\n\t\tpairs.push([\"Persistent\", String(data.persistent)]);\n\tconst tier = data.tier as Record<string, unknown> | undefined;\n\tif (tier?.name) pairs.push([\"Tier\", String(tier.name)]);\n\twriteKv(deps, pairs, { ok: true, drop: result.data });\n\treturn { exitCode: 0 };\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\ttry {\n\t\tawait requireCredential({\n\t\t\t...(deps.apiKey ? { apiKey: deps.apiKey } : {}),\n\t\t\tenv: deps.env,\n\t\t\tstore: deps.store,\n\t\t});\n\t} catch {\n\t\treturn writeAuthError(deps);\n\t}\n\tconst result = await deps.client.drops.delete(dropId);\n\tif (result?.error) return writeApiError(deps, result.error);\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","import * as prompts from \"@clack/prompts\";\nimport { errorEnvelope, exitCodeFor } from \"../output.js\";\nimport type { CredentialStore } from \"../storage.js\";\nimport type { SdkErrorMessage, SdkResult } from \"../types.js\";\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, SdkErrorMessage>>;\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, SdkErrorMessage>>;\n\t};\n\tapiKeys: {\n\t\tcreate(input: {\n\t\t\tlabel: string;\n\t\t}): Promise<SdkResult<ApiKeyData, SdkErrorMessage>>;\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 maxAttempts = 3;\n\tlet session: { data: SessionData; error: null } | undefined;\n\tfor (let attempt = 1; attempt <= maxAttempts; attempt++) {\n\t\tconst otp = await prompts.text({\n\t\t\tmessage:\n\t\t\t\tattempt === 1\n\t\t\t\t\t? \"Paste the code from your email\"\n\t\t\t\t\t: \"Try again — paste the code from your email\",\n\t\t\tvalidate: (v) =>\n\t\t\t\tv && v.length >= 4 && v.length <= 8\n\t\t\t\t\t? undefined\n\t\t\t\t\t: \"Code must be 4–8 characters.\",\n\t\t});\n\t\tif (prompts.isCancel(otp)) {\n\t\t\tprompts.cancel(\"Login cancelled.\");\n\t\t\treturn { exitCode: 0 };\n\t\t}\n\n\t\tconst result = await deps.client.auth.verifyEmailOtp({\n\t\t\temail,\n\t\t\tcode: otp,\n\t\t});\n\t\tif (!result.error) {\n\t\t\tsession = result as { data: SessionData; error: null };\n\t\t\tbreak;\n\t\t}\n\t\tif (attempt < maxAttempts) {\n\t\t\tprompts.log.warning(result.error.message);\n\t\t} else {\n\t\t\tprompts.cancel(result.error.message);\n\t\t\treturn { exitCode: exitCodeFor(\"api_error\") };\n\t\t}\n\t}\n\tif (!session) {\n\t\tprompts.cancel(\"Login failed.\");\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 type { SdkErrorMessage, SdkResult } from \"../types.js\";\nimport { success } from \"../ui.js\";\n\ntype LogoutClient = {\n\tapiKeys: {\n\t\tdelete(\n\t\t\tkeyId: string,\n\t\t):\n\t\t\t| SdkResult<null, SdkErrorMessage>\n\t\t\t| Promise<SdkResult<null, SdkErrorMessage>>\n\t\t\t| undefined\n\t\t\t| 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\";\n\nexport type DropData = { url: string; [key: string]: unknown };\n\nexport type ManifestFile = {\n\tpath: string;\n\tcontentType: string;\n\tsizeBytes: number;\n};\n\nexport type PreparedStagedResult = {\n\tkind: \"staged\";\n\tmanifest: { files: ManifestFile[]; entry?: string | null };\n\toptions: Record<string, unknown>;\n\tmetadata?: Record<string, unknown>;\n};\n\nexport type PreparedSourceResult = {\n\tkind: \"source\";\n\tsourceUrl: string;\n\toptions: Record<string, unknown>;\n\tmetadata?: Record<string, unknown>;\n};\n\nexport type PreparedResult = PreparedStagedResult | PreparedSourceResult;\n\nexport const MAX_BUNDLE_FILE_COUNT = 200;\n\nexport function isFileSystemError(error: unknown): boolean {\n\tif (!(error instanceof Error)) return false;\n\tconst code = (error as NodeJS.ErrnoException).code;\n\treturn (\n\t\tcode === \"ENOENT\" ||\n\t\tcode === \"ENOTDIR\" ||\n\t\tcode === \"EACCES\" ||\n\t\tcode === \"ELIMIT\"\n\t);\n}\n\nexport function withIdempotencyKey<T extends { idempotencyKey?: string }>(\n\toptions: T,\n\t_prefix: \"pub\" | \"upd\",\n): T & { idempotencyKey: string } {\n\treturn options.idempotencyKey\n\t\t? (options as T & { idempotencyKey: string })\n\t\t: { ...options, idempotencyKey: randomUUID() };\n}\n\nexport function validateManifestFileCount(count: number): void {\n\tif (count > MAX_BUNDLE_FILE_COUNT) {\n\t\tthrow Object.assign(\n\t\t\tnew Error(\n\t\t\t\t`Bundle contains ${count} 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\nexport function formatDryRunManifest(\n\tprepared: PreparedResult,\n\textra?: Record<string, unknown>,\n): Record<string, unknown> {\n\tif (prepared.kind === \"source\") {\n\t\treturn {\n\t\t\tok: true,\n\t\t\tdryRun: true,\n\t\t\tkind: \"source\",\n\t\t\t...extra,\n\t\t\tsourceUrl: prepared.sourceUrl,\n\t\t\toptions: prepared.options,\n\t\t\t...(prepared.metadata ? { metadata: prepared.metadata } : {}),\n\t\t};\n\t}\n\tconst totalBytes = prepared.manifest.files.reduce(\n\t\t(sum, f) => sum + f.sizeBytes,\n\t\t0,\n\t);\n\treturn {\n\t\tok: true,\n\t\tdryRun: true,\n\t\tkind: \"staged\",\n\t\t...extra,\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","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\tif (\n\t\traw.visibility &&\n\t\traw.visibility !== \"public\" &&\n\t\traw.visibility !== \"unlisted\"\n\t) {\n\t\tthrow new Error(\n\t\t\t`Invalid visibility \"${raw.visibility}\". Use \"public\" or \"unlisted\".`,\n\t\t);\n\t}\n\tif (raw.expiresAt) {\n\t\tconst d = new Date(raw.expiresAt);\n\t\tif (Number.isNaN(d.getTime())) {\n\t\t\tthrow new Error(\n\t\t\t\t`Invalid date \"${raw.expiresAt}\". Use ISO 8601 format, e.g. 2025-12-31T23:59:59Z.`,\n\t\t\t);\n\t\t}\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 pc from \"picocolors\";\n\nconst frames = [\"⠋\", \"⠙\", \"⠹\", \"⠸\", \"⠼\", \"⠴\", \"⠦\", \"⠧\", \"⠇\", \"⠏\"];\n\nexport type Spinner = {\n\tstop(): 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() {\n\t\t\tclearInterval(timer);\n\t\t\tstderr(\"\\r\\x1B[2K\");\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 type { PublishInput } from \"@dropthis/node\";\nimport { type ResolvedCredential, resolveCredential } from \"../auth.js\";\nimport {\n\ttype DropData,\n\tformatDryRunManifest,\n\tisFileSystemError,\n\ttype PreparedResult,\n\tvalidateManifestFileCount,\n\twithIdempotencyKey,\n} from \"../drop-operations.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 { createSpinner, shouldSpin } from \"../spinner.js\";\nimport type { CredentialStore } from \"../storage.js\";\nimport type { SdkResult } from \"../types.js\";\n\ntype PublishClient = {\n\tdrops: {\n\t\tpublish(\n\t\t\tinput: PublishInput,\n\t\t\toptions: ParsedDropOptions,\n\t\t): Promise<SdkResult<DropData>>;\n\t};\n\tprepare?(\n\t\tinput: PublishInput,\n\t\toptions: ParsedDropOptions,\n\t): Promise<PreparedResult>;\n};\n\ntype PublishOptions = RawDropOptions & {\n\tdryRun?: boolean;\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\toutputMode?: \"human\" | \"json\";\n\tinteractive?: boolean;\n\tinlineAuth?: () => Promise<ResolvedCredential | null>;\n\tcreateClient?: (apiKey: string) => PublishClient;\n};\n\nexport async function runPublish(\n\tinput: string | string[] | undefined,\n\traw: PublishOptions,\n\tdeps: PublishDeps,\n): Promise<{ exitCode: number }> {\n\tlet credential: ResolvedCredential | null;\n\ttry {\n\t\tcredential = await resolveCredential({\n\t\t\t...((raw.apiKey ?? deps.apiKey)\n\t\t\t\t? { apiKey: raw.apiKey ?? deps.apiKey }\n\t\t\t\t: {}),\n\t\t\tenv: deps.env,\n\t\t\tstore: deps.store,\n\t\t});\n\t} catch {\n\t\treturn writeAuthError(deps);\n\t}\n\n\tlet didInlineAuth = false;\n\tif (!credential) {\n\t\tif (deps.interactive && deps.inlineAuth) {\n\t\t\ttry {\n\t\t\t\tcredential = await deps.inlineAuth();\n\t\t\t} catch {\n\t\t\t\treturn writeAuthError(deps);\n\t\t\t}\n\t\t\tif (!credential) return writeAuthError(deps);\n\t\t\tdidInlineAuth = true;\n\t\t} else {\n\t\t\treturn writeAuthError(deps);\n\t\t}\n\t}\n\n\tlet client = deps.client;\n\tif (didInlineAuth && deps.createClient) {\n\t\tclient = deps.createClient(credential.apiKey);\n\t}\n\n\tif (raw.dryRun) {\n\t\treturn handlePublishDryRun(input, raw, deps, client);\n\t}\n\n\tconst hasInput = Array.isArray(input)\n\t\t? input.length > 0\n\t\t: input !== undefined;\n\tconst spin = shouldSpin(deps.outputMode)\n\t\t? createSpinner(\"Publishing…\", deps.stderr)\n\t\t: undefined;\n\ttry {\n\t\tconst options = withIdempotencyKey(await parseDropOptions(raw), \"pub\");\n\t\tconst doPublish = (c: PublishClient) =>\n\t\t\thasInput\n\t\t\t\t? c.drops.publish(input as PublishInput, options)\n\t\t\t\t: (() => {\n\t\t\t\t\t\tthrow new Error(\"Publish requires <input>.\");\n\t\t\t\t\t})();\n\t\tconst result = await doPublish(client);\n\t\tif (result.error) {\n\t\t\tif (\n\t\t\t\tresult.error.statusCode === 401 &&\n\t\t\t\tdeps.interactive &&\n\t\t\t\tdeps.inlineAuth &&\n\t\t\t\t!didInlineAuth\n\t\t\t) {\n\t\t\t\tspin?.stop();\n\t\t\t\tconst newCredential = await deps.inlineAuth();\n\t\t\t\tif (newCredential && deps.createClient) {\n\t\t\t\t\tclient = deps.createClient(newCredential.apiKey);\n\t\t\t\t\tconst retrySpin = shouldSpin(deps.outputMode)\n\t\t\t\t\t\t? createSpinner(\"Publishing…\", deps.stderr)\n\t\t\t\t\t\t: undefined;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst retryResult = await doPublish(client);\n\t\t\t\t\t\tif (retryResult.error) {\n\t\t\t\t\t\t\tretrySpin?.fail();\n\t\t\t\t\t\t\treturn writeApiError(deps, retryResult.error);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tretrySpin?.stop();\n\t\t\t\t\t\tif (raw.url) deps.stdout(`${retryResult.data.url}\\n`);\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\twriteResult(\n\t\t\t\t\t\t\t\tdeps,\n\t\t\t\t\t\t\t\tretryResult.data.url,\n\t\t\t\t\t\t\t\t\"Published\",\n\t\t\t\t\t\t\t\tretryResult.data,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\treturn { exitCode: 0 };\n\t\t\t\t\t} catch (retryError) {\n\t\t\t\t\t\tretrySpin?.fail();\n\t\t\t\t\t\tconst message =\n\t\t\t\t\t\t\tretryError instanceof Error\n\t\t\t\t\t\t\t\t? retryError.message\n\t\t\t\t\t\t\t\t: \"Publish failed.\";\n\t\t\t\t\t\tconst code = isFileSystemError(retryError)\n\t\t\t\t\t\t\t? \"local_input_error\"\n\t\t\t\t\t\t\t: \"invalid_usage\";\n\t\t\t\t\t\treturn writeError(deps, code, message);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tspin?.fail();\n\t\t\treturn writeApiError(deps, result.error);\n\t\t}\n\t\tspin?.stop();\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\tconst code = isFileSystemError(error)\n\t\t\t? \"local_input_error\"\n\t\t\t: \"invalid_usage\";\n\t\tspin?.fail();\n\t\treturn writeError(deps, code, message);\n\t}\n}\n\nasync function handlePublishDryRun(\n\tinput: string | string[] | undefined,\n\traw: PublishOptions,\n\tdeps: PublishDeps,\n\tclient: PublishClient,\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 (!input || (Array.isArray(input) && input.length === 0)) {\n\t\t\tthrow new Error(\"Publish requires <input>.\");\n\t\t}\n\n\t\tconst options = await parseDropOptions(raw);\n\n\t\tif (!client.prepare) {\n\t\t\tthrow new Error(\"Client does not support dry-run.\");\n\t\t}\n\t\tconst prepared = await client.prepare(input as PublishInput, options);\n\t\tconst output = formatDryRunManifest(prepared);\n\t\tif (prepared.kind === \"staged\") {\n\t\t\tvalidateManifestFileCount(prepared.manifest.files.length);\n\t\t}\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","import type { PublishInput, UpdateContentOptions } from \"@dropthis/node\";\nimport { requireCredential } from \"../auth.js\";\nimport {\n\ttype DropData,\n\tformatDryRunManifest,\n\tisFileSystemError,\n\ttype PreparedResult,\n\tvalidateManifestFileCount,\n\twithIdempotencyKey,\n} from \"../drop-operations.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 { createSpinner, shouldSpin } from \"../spinner.js\";\nimport type { CredentialStore } from \"../storage.js\";\nimport type { SdkResult } from \"../types.js\";\n\ntype UpdateContentClient = {\n\tdrops: {\n\t\tupdateContent(\n\t\t\tdropId: string,\n\t\t\tinput: PublishInput,\n\t\t\toptions: UpdateContentOptions,\n\t\t): Promise<SdkResult<DropData>>;\n\t};\n\tprepare?(\n\t\tinput: PublishInput,\n\t\toptions: ParsedDropOptions,\n\t): Promise<PreparedResult>;\n};\n\ntype RawUpdateContentOptions = RawDropOptions & {\n\tdryRun?: boolean;\n\tifRevision?: number;\n\tjson?: boolean;\n\tquiet?: boolean;\n\turl?: boolean;\n\tapiKey?: string;\n};\n\ntype UpdateContentDeps = {\n\tstore: CredentialStore;\n\tclient: UpdateContentClient;\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\nconst NO_CONTENT_MESSAGE =\n\t\"update-content requires content. Provide a file, folder, URL, or text to ship a new deployment.\";\n\nconst NO_CONTENT_NEXT_ACTION =\n\t\"Pass an input, e.g. dropthis update-content <dropId> ./dist. \" +\n\t\"To change title, visibility, password, slug, expiry, or metadata, use dropthis update-settings <dropId> instead.\";\n\n/** Content-prep subset safe to pass to a content-only updateContent(). */\nfunction contentOptions(options: ParsedDropOptions): UpdateContentOptions {\n\tconst out: UpdateContentOptions = {};\n\tif (options.entry !== undefined) out.entry = options.entry;\n\tif (options.contentType !== undefined) out.contentType = options.contentType;\n\tif (options.path !== undefined) out.path = options.path;\n\treturn out;\n}\n\nexport async function runUpdateContent(\n\tdropId: string,\n\tinput: PublishInput | undefined,\n\traw: RawUpdateContentOptions,\n\tdeps: UpdateContentDeps,\n): Promise<{ exitCode: number }> {\n\ttry {\n\t\tawait requireCredential({\n\t\t\t...((raw.apiKey ?? deps.apiKey)\n\t\t\t\t? { apiKey: raw.apiKey ?? deps.apiKey }\n\t\t\t\t: {}),\n\t\t\tenv: deps.env,\n\t\t\tstore: deps.store,\n\t\t});\n\t} catch {\n\t\treturn writeAuthError(deps);\n\t}\n\n\tif (raw.dryRun) {\n\t\treturn handleDryRun(dropId, input, raw, deps);\n\t}\n\n\tlet spin: ReturnType<typeof createSpinner> | undefined;\n\ttry {\n\t\tassertDropId(dropId);\n\t\tconst hasInput = Array.isArray(input)\n\t\t\t? input.length > 0\n\t\t\t: input !== undefined;\n\t\tif (!hasInput) {\n\t\t\treturn writeError(\n\t\t\t\tdeps,\n\t\t\t\t\"invalid_usage\",\n\t\t\t\tNO_CONTENT_MESSAGE,\n\t\t\t\tNO_CONTENT_NEXT_ACTION,\n\t\t\t);\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\tspin = shouldSpin(deps.outputMode)\n\t\t\t? createSpinner(\"Updating content…\", deps.stderr)\n\t\t\t: undefined;\n\t\tconst result = await deps.client.drops.updateContent(\n\t\t\tdropId,\n\t\t\tinput as PublishInput,\n\t\t\twithIdempotencyKey(\n\t\t\t\t{ ...contentOptions(parsed), ...revisionOptions },\n\t\t\t\t\"upd\",\n\t\t\t),\n\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();\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\tconst code = isFileSystemError(error)\n\t\t\t? \"local_input_error\"\n\t\t\t: \"invalid_usage\";\n\t\tspin?.fail();\n\t\treturn writeError(deps, code, message);\n\t}\n}\n\nasync function handleDryRun(\n\tdropId: string,\n\tinput: PublishInput | undefined,\n\traw: RawUpdateContentOptions,\n\tdeps: UpdateContentDeps,\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(dropId);\n\t\tconst hasInput = Array.isArray(input)\n\t\t\t? input.length > 0\n\t\t\t: input !== undefined;\n\t\tif (!hasInput) {\n\t\t\treturn writeError(\n\t\t\t\tdeps,\n\t\t\t\t\"invalid_usage\",\n\t\t\t\tNO_CONTENT_MESSAGE,\n\t\t\t\tNO_CONTENT_NEXT_ACTION,\n\t\t\t);\n\t\t}\n\t\tconst options = await parseDropOptions(raw);\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 as PublishInput, options);\n\t\tconst output = formatDryRunManifest(prepared, { target: dropId });\n\t\tif (prepared.kind === \"staged\") {\n\t\t\tvalidateManifestFileCount(prepared.manifest.files.length);\n\t\t}\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\nfunction assertDropId(target: string): void {\n\tif (!target.startsWith(\"drop_\")) {\n\t\tthrow new Error(\n\t\t\t\"update-content needs the full drop_… id from the publish response, not the URL slug, for example drop_...\",\n\t\t);\n\t}\n}\n","import * as prompts from \"@clack/prompts\";\nimport type { DropOptions, RequestControls } from \"@dropthis/node\";\nimport { requireCredential } from \"../auth.js\";\nimport { type DropData, withIdempotencyKey } from \"../drop-operations.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 { createSpinner, shouldSpin } from \"../spinner.js\";\nimport type { CredentialStore } from \"../storage.js\";\nimport type { SdkResult } from \"../types.js\";\n\ntype UpdateSettingsClient = {\n\tdrops: {\n\t\tupdateSettings(\n\t\t\tdropId: string,\n\t\t\toptions: DropOptions & RequestControls,\n\t\t): Promise<SdkResult<DropData>>;\n\t};\n};\n\ntype RawUpdateSettingsOptions = RawDropOptions & {\n\tdryRun?: boolean;\n\tifRevision?: number;\n\tjson?: boolean;\n\tquiet?: boolean;\n\turl?: boolean;\n\tapiKey?: string;\n};\n\ntype UpdateSettingsDeps = {\n\tstore: CredentialStore;\n\tclient: UpdateSettingsClient;\n\tapiKey?: string;\n\tenv: Record<string, string | undefined>;\n\tstdout: (value: string) => void;\n\tstderr: (value: string) => void;\n\toutputMode?: \"human\" | \"json\";\n\tinteractive?: boolean;\n\tprompts?: UpdateSettingsPromptApi;\n};\n\ntype UpdateSettingsPromptApi = {\n\tintro: typeof prompts.intro;\n\tcancel: typeof prompts.cancel;\n\tmultiselect: typeof prompts.multiselect;\n\tselect: typeof prompts.select;\n\ttext: typeof prompts.text;\n\tpassword: typeof prompts.password;\n\tisCancel: typeof prompts.isCancel;\n};\n\ntype InteractiveSettingsField =\n\t| \"title\"\n\t| \"slug\"\n\t| \"visibility\"\n\t| \"password\"\n\t| \"indexing\"\n\t| \"expiresAt\"\n\t| \"metadata\";\n\nconst NO_SETTINGS_MESSAGE =\n\t\"Nothing to update. Provide at least one settings option.\";\n\nconst NO_SETTINGS_NEXT_ACTION =\n\t\"Run dropthis update-settings --help, or retry with one of: \" +\n\t\"--title, --slug, --visibility, --password, --no-password, --noindex, \" +\n\t\"--index, --expires-at, --metadata, or --metadata-file. \" +\n\t\"To replace the content at the URL instead, use dropthis update-content <dropId> ./dist.\";\n\nexport async function runUpdateSettings(\n\tdropId: string,\n\traw: RawUpdateSettingsOptions,\n\tdeps: UpdateSettingsDeps,\n): Promise<{ exitCode: number }> {\n\ttry {\n\t\tawait requireCredential({\n\t\t\t...((raw.apiKey ?? deps.apiKey)\n\t\t\t\t? { apiKey: raw.apiKey ?? deps.apiKey }\n\t\t\t\t: {}),\n\t\t\tenv: deps.env,\n\t\t\tstore: deps.store,\n\t\t});\n\t} catch {\n\t\treturn writeAuthError(deps);\n\t}\n\n\tif (raw.dryRun) {\n\t\treturn handleDryRun(dropId, raw, deps);\n\t}\n\n\tlet spin: ReturnType<typeof createSpinner> | undefined;\n\ttry {\n\t\tassertDropId(dropId);\n\t\tlet parsed = await parseDropOptions(raw);\n\t\tif (!hasSettingsFields(parsed)) {\n\t\t\tif (shouldPrompt(deps)) {\n\t\t\t\tconst prompted = await promptForSettings(\n\t\t\t\t\tdropId,\n\t\t\t\t\tdeps.prompts ?? prompts,\n\t\t\t\t);\n\t\t\t\tif (!prompted) return { exitCode: 0 };\n\t\t\t\tparsed = { ...parsed, ...prompted };\n\t\t\t} else {\n\t\t\t\treturn writeError(\n\t\t\t\t\tdeps,\n\t\t\t\t\t\"invalid_usage\",\n\t\t\t\t\tNO_SETTINGS_MESSAGE,\n\t\t\t\t\tNO_SETTINGS_NEXT_ACTION,\n\t\t\t\t);\n\t\t\t}\n\t\t}\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\tspin = shouldSpin(deps.outputMode)\n\t\t\t? createSpinner(\"Updating settings…\", deps.stderr)\n\t\t\t: undefined;\n\t\tconst result = await deps.client.drops.updateSettings(\n\t\t\tdropId,\n\t\t\twithIdempotencyKey({ ...parsed, ...revisionOptions }, \"upd\"),\n\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();\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\n/** True if any drop-settings field is set. */\nfunction hasSettingsFields(options: ParsedDropOptions): boolean {\n\tconst {\n\t\tidempotencyKey: _,\n\t\tentry: __,\n\t\tcontentType: ___,\n\t\tpath: ____,\n\t\t...settings\n\t} = options;\n\treturn Object.values(settings).some((value) => value !== undefined);\n}\n\nfunction shouldPrompt(deps: UpdateSettingsDeps): boolean {\n\treturn deps.outputMode === \"human\" && deps.interactive === true;\n}\n\nasync function promptForSettings(\n\ttarget: string,\n\tprompt: UpdateSettingsPromptApi,\n): Promise<ParsedDropOptions | undefined> {\n\tprompt.intro(`Update settings for ${target}`);\n\tconst fields = await prompt.multiselect<InteractiveSettingsField>({\n\t\tmessage: \"What do you want to change?\",\n\t\trequired: true,\n\t\toptions: [\n\t\t\t{ value: \"title\", label: \"Title\", hint: \"--title\" },\n\t\t\t{ value: \"slug\", label: \"Slug\", hint: \"--slug\" },\n\t\t\t{ value: \"visibility\", label: \"Visibility\", hint: \"--visibility\" },\n\t\t\t{\n\t\t\t\tvalue: \"password\",\n\t\t\t\tlabel: \"Password\",\n\t\t\t\thint: \"--password or --no-password\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tvalue: \"indexing\",\n\t\t\t\tlabel: \"Search indexing\",\n\t\t\t\thint: \"--noindex or --index\",\n\t\t\t},\n\t\t\t{ value: \"expiresAt\", label: \"Expiration\", hint: \"--expires-at\" },\n\t\t\t{ value: \"metadata\", label: \"Metadata\", hint: \"--metadata\" },\n\t\t],\n\t});\n\tif (prompt.isCancel(fields)) {\n\t\tprompt.cancel(\"Update cancelled.\");\n\t\treturn undefined;\n\t}\n\n\tconst selected = new Set(fields);\n\tconst options: ParsedDropOptions = {};\n\n\tif (selected.has(\"title\")) {\n\t\tconst value = await prompt.text({\n\t\t\tmessage: \"Title\",\n\t\t\tvalidate: requireNonEmpty(\"Enter a title.\"),\n\t\t});\n\t\tif (prompt.isCancel(value)) return cancel(prompt);\n\t\toptions.title = value.trim();\n\t}\n\n\tif (selected.has(\"slug\")) {\n\t\tconst value = await prompt.text({\n\t\t\tmessage: \"Slug\",\n\t\t\tvalidate: requireNonEmpty(\"Enter a slug.\"),\n\t\t});\n\t\tif (prompt.isCancel(value)) return cancel(prompt);\n\t\toptions.slug = value.trim();\n\t}\n\n\tif (selected.has(\"visibility\")) {\n\t\tconst value = await prompt.select<\"public\" | \"unlisted\">({\n\t\t\tmessage: \"Visibility\",\n\t\t\toptions: [\n\t\t\t\t{ value: \"public\", label: \"Public\" },\n\t\t\t\t{ value: \"unlisted\", label: \"Unlisted\" },\n\t\t\t],\n\t\t});\n\t\tif (prompt.isCancel(value)) return cancel(prompt);\n\t\toptions.visibility = value;\n\t}\n\n\tif (selected.has(\"password\")) {\n\t\tconst action = await prompt.select<\"set\" | \"remove\">({\n\t\t\tmessage: \"Password\",\n\t\t\toptions: [\n\t\t\t\t{ value: \"set\", label: \"Set password\" },\n\t\t\t\t{ value: \"remove\", label: \"Remove password\" },\n\t\t\t],\n\t\t});\n\t\tif (prompt.isCancel(action)) return cancel(prompt);\n\t\tif (action === \"set\") {\n\t\t\tconst value = await prompt.password({\n\t\t\t\tmessage: \"Password\",\n\t\t\t\tvalidate: requireNonEmpty(\"Enter a password.\"),\n\t\t\t});\n\t\t\tif (prompt.isCancel(value)) return cancel(prompt);\n\t\t\toptions.password = value;\n\t\t} else {\n\t\t\toptions.password = null;\n\t\t}\n\t}\n\n\tif (selected.has(\"indexing\")) {\n\t\tconst value = await prompt.select<\"noindex\" | \"index\">({\n\t\t\tmessage: \"Search indexing\",\n\t\t\toptions: [\n\t\t\t\t{ value: \"noindex\", label: \"Prevent indexing\" },\n\t\t\t\t{ value: \"index\", label: \"Allow indexing\" },\n\t\t\t],\n\t\t});\n\t\tif (prompt.isCancel(value)) return cancel(prompt);\n\t\toptions.noindex = value === \"noindex\";\n\t}\n\n\tif (selected.has(\"expiresAt\")) {\n\t\tconst value = await prompt.text({\n\t\t\tmessage: \"Expiration date\",\n\t\t\tplaceholder: \"2025-12-31T23:59:59Z\",\n\t\t\tvalidate: validateIsoDate,\n\t\t});\n\t\tif (prompt.isCancel(value)) return cancel(prompt);\n\t\toptions.expiresAt = value.trim();\n\t}\n\n\tif (selected.has(\"metadata\")) {\n\t\tconst value = await prompt.text({\n\t\t\tmessage: \"Metadata JSON object\",\n\t\t\tplaceholder: '{\"source\":\"cli\"}',\n\t\t\tvalidate: validateJsonObject,\n\t\t});\n\t\tif (prompt.isCancel(value)) return cancel(prompt);\n\t\toptions.metadata = parseJsonObject(value);\n\t}\n\n\treturn options;\n}\n\nfunction cancel(prompt: UpdateSettingsPromptApi): undefined {\n\tprompt.cancel(\"Update cancelled.\");\n\treturn undefined;\n}\n\nfunction requireNonEmpty(message: string) {\n\treturn (value: string | undefined): string | undefined =>\n\t\tvalue?.trim() ? undefined : message;\n}\n\nfunction validateIsoDate(value: string | undefined): string | undefined {\n\tif (!value?.trim()) return \"Enter an ISO 8601 date.\";\n\tconst d = new Date(value);\n\treturn Number.isNaN(d.getTime()) ? \"Enter a valid ISO 8601 date.\" : undefined;\n}\n\nfunction validateJsonObject(value: string | undefined): string | undefined {\n\tif (!value?.trim()) return \"Enter a JSON object.\";\n\ttry {\n\t\tparseJsonObject(value);\n\t\treturn undefined;\n\t} catch {\n\t\treturn \"Enter a valid JSON object.\";\n\t}\n}\n\nfunction parseJsonObject(value: string): 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(\"Metadata must be a JSON object.\");\n\t}\n\treturn parsed as Record<string, unknown>;\n}\n\nasync function handleDryRun(\n\tdropId: string,\n\traw: RawUpdateSettingsOptions,\n\tdeps: UpdateSettingsDeps,\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 change.\",\n\t\t);\n\t}\n\ttry {\n\t\tassertDropId(dropId);\n\t\tconst options = await parseDropOptions(raw);\n\t\tconst fields: Record<string, unknown> = {};\n\t\tif (options.slug) fields.slug = options.slug;\n\t\tif (options.title) fields.title = options.title;\n\t\tif (options.visibility) fields.visibility = options.visibility;\n\t\tif (options.password !== undefined) fields.password = options.password;\n\t\tif (options.noindex !== undefined) fields.noindex = options.noindex;\n\t\tif (options.expiresAt) fields.expires_at = options.expiresAt;\n\t\tif (options.metadata) fields.metadata = options.metadata;\n\t\tdeps.stdout(\n\t\t\t`${JSON.stringify({ ok: true, dryRun: true, kind: \"settings_update\", target: dropId, fields }, null, 2)}\\n`,\n\t\t);\n\t\treturn { exitCode: 0 };\n\t} catch (error) {\n\t\tconst message = error instanceof Error ? error.message : \"Dry-run failed.\";\n\t\treturn writeError(deps, \"invalid_usage\", message);\n\t}\n}\n\nfunction assertDropId(target: string): void {\n\tif (!target.startsWith(\"drop_\")) {\n\t\tthrow new Error(\n\t\t\t\"update-settings needs the full drop_… id from the publish response, not the URL slug, 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\";\nimport type { SdkErrorMessage, SdkResult } from \"../types.js\";\n\ntype WhoamiClient = {\n\taccount: { get(): Promise<SdkResult<unknown, SdkErrorMessage>> };\n};\n\nexport async function runWhoami(\n\t_input: { json?: boolean },\n\tdeps: {\n\t\tstore: CredentialStore;\n\t\tclient: WhoamiClient;\n\t\tapiKey?: string;\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\t...(deps.apiKey ? { apiKey: deps.apiKey } : {}),\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\n\tconst result = await deps.client.account.get();\n\tif (result.error) {\n\t\twriteHumanOrJson(\n\t\t\tdeps,\n\t\t\t`Not authenticated: ${result.error.message}. Run dropthis login.`,\n\t\t\t{ ok: true, authenticated: false, reason: result.error.message },\n\t\t);\n\t\treturn { exitCode: 0 };\n\t}\n\n\tconst account = (result.data ?? {}) as Record<string, unknown>;\n\tconst masked = maskKey(credential.apiKey);\n\tconst last4 = credential.keyLast4 ?? credential.apiKey.slice(-4);\n\tconst pairs: Array<[string, string]> = [];\n\tif (credential.email ?? account.email)\n\t\tpairs.push([\"Email\", String(credential.email ?? account.email)]);\n\tpairs.push([\"Key\", masked]);\n\tpairs.push([\"Source\", credential.source]);\n\tif (credential.accountId ?? account.id)\n\t\tpairs.push([\"Account\", String(credential.accountId ?? account.id)]);\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...(last4 ? { key_last4: last4 } : {}),\n\t\t...((credential.accountId ?? account.id)\n\t\t\t? { account_id: String(credential.accountId ?? account.id) }\n\t\t\t: {}),\n\t\t...((credential.email ?? account.email)\n\t\t\t? { email: String(credential.email ?? account.email) }\n\t\t\t: {}),\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\tinteractive?: 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 {\n\tchmod,\n\tmkdir,\n\treadFile,\n\trename,\n\trm,\n\twriteFile,\n} 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\tconst tmpPath = `${path}.${process.pid}.tmp`;\n\tawait writeFile(tmpPath, `${JSON.stringify(credential, null, 2)}\\n`, {\n\t\tmode: 0o600,\n\t});\n\tawait chmod(tmpPath, 0o600);\n\tawait rename(tmpPath, path);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAsDA,eAAsB,cACrB,MACqC;AACrC,MAAI;AACH,UAAM,SAAS,KAAK,UAAU,eAAe;AAE7C,SAAK,OAAO,oCAAoC;AAEhD,UAAM,cAAc,MAAM,OAAO,MAAM;AACvC,QAAI,OAAO,gBAAgB,UAAU;AACpC,aAAO;AAAA,IACR;AACA,UAAM,QAAQ;AAEd,UAAM,aAAa,MAAM,KAAK,OAAO,KAAK,gBAAgB,EAAE,MAAM,CAAC;AACnE,QAAI,WAAW,OAAO;AACrB,WAAK,OAAO,GAAG,WAAW,MAAM,OAAO;AAAA,CAAI;AAC3C,aAAO;AAAA,IACR;AAEA,SAAK,OAAO,gCAAgC;AAE5C,UAAM,cAAc;AACpB,QAAI,UAA8B;AAElC,aAAS,UAAU,GAAG,WAAW,aAAa,WAAW;AACxD,YAAM,aAAa,MAAM,OAAO,KAAK,SAAS,WAAW;AACzD,UAAI,OAAO,eAAe,UAAU;AACnC,eAAO;AAAA,MACR;AACA,YAAM,OAAO;AAEb,YAAM,eAAe,MAAM,KAAK,OAAO,KAAK,eAAe;AAAA,QAC1D;AAAA,QACA;AAAA,MACD,CAAC;AACD,UAAI,CAAC,aAAa,OAAO;AACxB,kBAAU,aAAa;AACvB;AAAA,MACD;AAEA,UAAI,UAAU,aAAa;AA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;AACf,UAAM;AAAA,MACL,GAAG,KAAK,UAAU,cAAc,eAAe,MAAM,OAAO,CAAC,CAAC;AAAA;AAAA,IAC/D;AAAA,EACD,OAAO;AACN,UAAM,OAAO,GAAG,MAAM,OAAO;AAAA,CAAI;AAAA,EAClC;AACA,SAAO;AACR;AAEA,SAAS,iBACR,KAC6D;AAC7D,SACC,OAAO,QAAQ,YACf,QAAQ,QACR,OAAQ,IAA2B,SAAS,YAC3C,IAAyB,KAAK,WAAW,YAAY;AAExD;AAEA,SAAS,UAAU,MAAyB;AAC3C,SACC,KAAK,SAAS,QAAQ,KACtB,KAAK,SAAS,SAAS,KACvB,KAAK,SAAS,IAAI,KAClB,QAAQ,IAAI,OAAO,UACnB,QAAQ,OAAO,UAAU;AAE3B;AAEA,aAAa,EAAE,OAAO,sBAAsB,EAAE,CAAC,EAC7C,WAAW,QAAQ,IAAI,EACvB,MAAM,CAACC,WAAmB;AAC1B,MAAI,iBAAiBA,MAAK,GAAG;AAG5B,QACCA,OAAM,SAAS,oBACfA,OAAM,SAAS,6BACfA,OAAM,SAAS,qBACd;AACD,cAAQ,WAAW;AACnB;AAAA,IACD;AACA,YAAQ,WAAW,wBAAwB;AAAA,MAC1C,SAASA,OAAM;AAAA,MACf,MAAM,UAAU,QAAQ,KAAK,MAAM,CAAC,CAAC;AAAA,MACrC,QAAQ,CAAC,UAAU,QAAQ,OAAO,MAAM,KAAK;AAAA,IAC9C,CAAC;AACD;AAAA,EACD;AACA,UAAQ,MAAMA,MAAK;AACnB,UAAQ,WAAW;AACpB,CAAC;","names":["osHostname","import_node_os","error","import_picocolors","import_picocolors","pc","pc","pc","pc","prompts","prompts","error","import_picocolors","pc","error","error","prompts","handleDryRun","assertDropId","prompts","error","cancel","parseJsonObject","import_promises","error","pc","deps","global","result","runInlineAuth","error"]}
|
|
1
|
+
{"version":3,"sources":["../src/inline-auth.ts","../src/cli.ts","../src/output.ts","../src/program.ts","../src/auth.ts","../src/fmt.ts","../src/ui.ts","../src/commands/account.ts","../src/commands/api-keys.ts","../src/types.ts","../src/catalog.ts","../src/commands/commands.ts","../src/commands/deployments.ts","../src/commands/doctor.ts","../src/commands/drops.ts","../src/commands/login.ts","../src/commands/logout.ts","../src/drop-operations.ts","../src/options.ts","../src/spinner.ts","../src/commands/publish.ts","../src/commands/update-content.ts","../src/commands/update-settings.ts","../src/commands/whoami.ts","../src/context.ts","../src/storage.ts"],"sourcesContent":["import { hostname as osHostname } from \"node:os\";\nimport { createInterface } from \"node:readline\";\nimport type { ResolvedCredential } from \"./auth.js\";\nimport type { CredentialStore } from \"./storage.js\";\nimport type { SdkErrorMessage, SdkResult } from \"./types.js\";\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\nexport type InlineAuthClient = {\n\tauth: {\n\t\trequestEmailOtp(input: {\n\t\t\temail: string;\n\t\t}): Promise<SdkResult<OtpRequestData, SdkErrorMessage>>;\n\t\tverifyEmailOtp(input: {\n\t\t\temail: string;\n\t\t\tcode: string;\n\t\t}): Promise<SdkResult<SessionData, SdkErrorMessage>>;\n\t};\n\tapiKeys: {\n\t\tcreate(input: {\n\t\t\tlabel: string;\n\t\t}): Promise<SdkResult<ApiKeyData, SdkErrorMessage>>;\n\t};\n};\n\ntype InlineAuthDeps = {\n\tclient: InlineAuthClient;\n\tcreateClient: (apiKey: string) => InlineAuthClient;\n\tstore: CredentialStore;\n\tstderr: (value: string) => void;\n\thostname?: string;\n\tprompt?: {\n\t\temail: () => Promise<string | symbol>;\n\t\tcode: (attempt: number, maxAttempts: number) => Promise<string | symbol>;\n\t};\n};\n\nexport async function runInlineAuth(\n\tdeps: InlineAuthDeps,\n): Promise<ResolvedCredential | null> {\n\ttry {\n\t\tconst prompt = deps.prompt ?? defaultPrompts();\n\n\t\tdeps.stderr(\"\\nNot logged in. Let's fix that:\\n\");\n\n\t\tconst emailResult = await prompt.email();\n\t\tif (typeof emailResult === \"symbol\") {\n\t\t\treturn null;\n\t\t}\n\t\tconst email = emailResult;\n\n\t\tconst otpRequest = await deps.client.auth.requestEmailOtp({ email });\n\t\tif (otpRequest.error) {\n\t\t\tdeps.stderr(`${otpRequest.error.message}\\n`);\n\t\t\treturn null;\n\t\t}\n\n\t\tdeps.stderr(\"Code sent! Check your inbox.\\n\");\n\n\t\tconst maxAttempts = 3;\n\t\tlet session: SessionData | null = null;\n\n\t\tfor (let attempt = 1; attempt <= maxAttempts; attempt++) {\n\t\t\tconst codeResult = await prompt.code(attempt, maxAttempts);\n\t\t\tif (typeof codeResult === \"symbol\") {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst code = codeResult;\n\n\t\t\tconst verifyResult = await deps.client.auth.verifyEmailOtp({\n\t\t\t\temail,\n\t\t\t\tcode,\n\t\t\t});\n\t\t\tif (!verifyResult.error) {\n\t\t\t\tsession = verifyResult.data;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (attempt < maxAttempts) {\n\t\t\t\tdeps.stderr(`${verifyResult.error.message}\\n`);\n\t\t\t} else {\n\t\t\t\tdeps.stderr(\n\t\t\t\t\t\"Too many attempts. Run `dropthis login` to request a new code.\\n\",\n\t\t\t\t);\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\n\t\tif (!session) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst authedClient = deps.createClient(session.token);\n\t\tconst apiKeyResult = await authedClient.apiKeys.create({\n\t\t\tlabel: `CLI on ${deps.hostname ?? osHostname()}`,\n\t\t});\n\t\tif (apiKeyResult.error) {\n\t\t\tdeps.stderr(`${apiKeyResult.error.message}\\n`);\n\t\t\treturn null;\n\t\t}\n\n\t\tconst { id: keyId, key: apiKey, keyLast4, accountId } = apiKeyResult.data;\n\n\t\ttry {\n\t\t\tawait deps.store.save({\n\t\t\t\tapiKey,\n\t\t\t\tkeyId,\n\t\t\t\tkeyLast4,\n\t\t\t\taccountId: accountId ?? session.accountId,\n\t\t\t\temail,\n\t\t\t\tstorage: \"secure\",\n\t\t\t});\n\t\t} catch (err) {\n\t\t\tconst message = err instanceof Error ? err.message : String(err);\n\t\t\tdeps.stderr(`Failed to save credentials: ${message}\\n`);\n\t\t\treturn null;\n\t\t}\n\n\t\tdeps.stderr(\"✓ Logged in\\n\\n\");\n\n\t\treturn {\n\t\t\tapiKey,\n\t\t\tsource: \"storage\",\n\t\t\tkeyId,\n\t\t\tkeyLast4,\n\t\t\taccountId: accountId ?? session.accountId,\n\t\t\temail,\n\t\t};\n\t} catch (err) {\n\t\tconst message = err instanceof Error ? err.message : String(err);\n\t\tdeps.stderr(`Login failed: ${message}\\n`);\n\t\treturn null;\n\t}\n}\n\nfunction defaultPrompts(): NonNullable<InlineAuthDeps[\"prompt\"]> {\n\treturn {\n\t\temail: () => readlineQuestion(\"Email: \"),\n\t\tcode: (attempt) =>\n\t\t\treadlineQuestion(\n\t\t\t\tattempt === 1 ? \"Code: \" : \"Try again — enter the code: \",\n\t\t\t),\n\t};\n}\n\nfunction readlineQuestion(question: string): Promise<string> {\n\tconst rl = createInterface({\n\t\tinput: process.stdin,\n\t\toutput: process.stderr,\n\t});\n\treturn new Promise((resolve) => {\n\t\trl.question(question, (answer) => {\n\t\t\trl.close();\n\t\t\tresolve(answer);\n\t\t});\n\t});\n}\n","#!/usr/bin/env node\nimport { errorEnvelope } from \"./output.js\";\nimport { buildProgram } from \"./program.js\";\nimport { createCredentialStore } from \"./storage.js\";\n\nexport function writeUsageErrorEnvelope(input: {\n\tmessage: string;\n\tjson: boolean;\n\tstderr: (value: string) => void;\n}): number {\n\tif (input.json) {\n\t\tinput.stderr(\n\t\t\t`${JSON.stringify(errorEnvelope(\"usage_error\", input.message))}\\n`,\n\t\t);\n\t} else {\n\t\tinput.stderr(`${input.message}\\n`);\n\t}\n\treturn 2;\n}\n\nfunction isCommanderError(\n\terr: unknown,\n): err is { code: string; message: string; exitCode: number } {\n\treturn (\n\t\ttypeof err === \"object\" &&\n\t\terr !== null &&\n\t\ttypeof (err as { code?: unknown }).code === \"string\" &&\n\t\t(err as { code: string }).code.startsWith(\"commander.\")\n\t);\n}\n\nfunction wantsJson(argv: string[]): boolean {\n\treturn (\n\t\targv.includes(\"--json\") ||\n\t\targv.includes(\"--quiet\") ||\n\t\targv.includes(\"-q\") ||\n\t\tprocess.env.CI === \"true\" ||\n\t\tprocess.stdout.isTTY !== true\n\t);\n}\n\nbuildProgram({ store: createCredentialStore() })\n\t.parseAsync(process.argv)\n\t.catch((error: unknown) => {\n\t\tif (isCommanderError(error)) {\n\t\t\t// commander.help / commander.helpDisplayed / commander.version are\n\t\t\t// non-error exits — render nothing and exit 0.\n\t\t\tif (\n\t\t\t\terror.code === \"commander.help\" ||\n\t\t\t\terror.code === \"commander.helpDisplayed\" ||\n\t\t\t\terror.code === \"commander.version\"\n\t\t\t) {\n\t\t\t\tprocess.exitCode = 0;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tprocess.exitCode = writeUsageErrorEnvelope({\n\t\t\t\tmessage: error.message,\n\t\t\t\tjson: wantsJson(process.argv.slice(2)),\n\t\t\t\tstderr: (value) => process.stderr.write(value),\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconsole.error(error);\n\t\tprocess.exitCode = 1;\n\t});\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\t| \"usage_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\tsuggestion?: string | null;\n\tretryable?: boolean | 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: normalizeApiErrorCode(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\t...(error.suggestion ? { suggestion: error.suggestion } : {}),\n\t\t\t...(error.retryable !== undefined && error.retryable !== null\n\t\t\t\t? { retryable: error.retryable }\n\t\t\t\t: {}),\n\t\t\tnext_action: nextActionForApiError(error),\n\t\t},\n\t};\n}\n\nexport function normalizeApiErrorCode(error: ApiErrorDetails): string {\n\tif (error.code) return error.code;\n\tif (error.statusCode === 404) return \"not_found\";\n\treturn \"api_error\";\n}\n\nexport function nextActionForApiError(error: ApiErrorDetails): string {\n\tif (error.suggestion) return error.suggestion;\n\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 === 404 || error.code === \"not_found\") {\n\t\treturn \"Check the drop id or slug and retry; list your drops with dropthis list.\";\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 === \"usage_error\") return 2;\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 { Command, InvalidArgumentError } from \"commander\";\nimport pc from \"picocolors\";\nimport { type ResolvedCredential, resolveCredential } from \"./auth.js\";\nimport {\n\trunAccountDelete,\n\trunAccountGet,\n\trunAccountUpdate,\n} 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 { runDropsDelete, runDropsGet, runDropsList } 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 { runUpdateContent } from \"./commands/update-content.js\";\nimport { runUpdateSettings } from \"./commands/update-settings.js\";\nimport { runWhoami } from \"./commands/whoami.js\";\nimport { createContext, type GlobalOptions } from \"./context.js\";\nimport { writeError } from \"./fmt.js\";\nimport type { InlineAuthClient } from \"./inline-auth.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\tconst writeErr =\n\t\toptions.stderr ?? ((value: string) => process.stderr.write(value));\n\tconst jsonModeForOutput = (): boolean => {\n\t\tconst argv =\n\t\t\t(program as Command & { rawArgs?: string[] }).rawArgs ?? process.argv;\n\t\treturn (\n\t\t\targv.includes(\"--json\") ||\n\t\t\targv.includes(\"--quiet\") ||\n\t\t\targv.includes(\"-q\") ||\n\t\t\toptions.env?.CI === \"true\" ||\n\t\t\t(options.env === undefined && process.env.CI === \"true\") ||\n\t\t\toptions.stdoutIsTTY === false ||\n\t\t\t(options.stdoutIsTTY === undefined && process.stdout.isTTY !== true)\n\t\t);\n\t};\n\tprogram.exitOverride();\n\tprogram.configureOutput({\n\t\twriteErr,\n\t\t// In JSON mode, suppress commander's default plain-text error so the\n\t\t// single JSON envelope written by cli.ts's catch is the only output.\n\t\toutputError: (str, write) => {\n\t\t\tif (!jsonModeForOutput()) write(str);\n\t\t},\n\t});\n\tprogram\n\t\t.name(\"dropthis\")\n\t\t.description(\n\t\t\t[\n\t\t\t\tpc.dim(\"Publish anything online and get a URL back.\"),\n\t\t\t\t\"\",\n\t\t\t\t`${pc.bold(\"Quick start:\")}`,\n\t\t\t\t` ${pc.cyan(\"dropthis login\")}`,\n\t\t\t\t` ${pc.cyan(\"dropthis publish ./dist\")}`,\n\t\t\t].join(\"\\n\"),\n\t\t)\n\t\t.version(PKG_VERSION)\n\t\t.configureHelp({\n\t\t\tsubcommandTerm(cmd) {\n\t\t\t\tconst args = cmd.registeredArguments\n\t\t\t\t\t.map((a) => {\n\t\t\t\t\t\tconst name = a.name();\n\t\t\t\t\t\tconst variadic = a.variadic ? \"...\" : \"\";\n\t\t\t\t\t\treturn a.required ? `<${name}${variadic}>` : `[${name}${variadic}]`;\n\t\t\t\t\t})\n\t\t\t\t\t.join(\" \");\n\t\t\t\treturn args ? `${cmd.name()} ${args}` : cmd.name();\n\t\t\t},\n\t\t\tstyleTitle: (title) => pc.bold(title),\n\t\t\tstyleCommandText: (str) => pc.cyan(str),\n\t\t\tstyleSubcommandText: (str) => pc.cyan(str),\n\t\t\tstyleOptionText: (str) => pc.yellow(str),\n\t\t});\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\tprogram.option(\"--no-interactive\", \"Disable interactive prompts\");\n\n\tprogram\n\t\t.command(\"publish [input...]\", { isDefault: true })\n\t\t.description(\n\t\t\t\"Publish content to a permanent public URL (also: share, post, put online, make public, get a link).\\nFiles, folders, URLs, strings, or stdin; multiple files bundle into one drop. Use - for stdin, or pipe without args.\\nCreates a NEW drop each run — to change one you already published, use update-content (the files) or update-settings (title/visibility/password/slug/expiry/metadata) with its drop_… id, not publish again.\",\n\t\t)\n\t\t.option(\"--title <title>\", \"Drop title\")\n\t\t.option(\"--visibility <v>\", \"public or unlisted (default: public)\")\n\t\t.option(\"--password <password>\", \"Require password to view\")\n\t\t.option(\"--noindex\", \"Prevent search-engine indexing\")\n\t\t.option(\"--expires-at <datetime>\", \"Auto-delete after this ISO 8601 date\")\n\t\t.option(\n\t\t\t\"--content-type <mime>\",\n\t\t\t\"Override MIME type (auto-detected from extension)\",\n\t\t)\n\t\t.option(\n\t\t\t\"--entry <path>\",\n\t\t\t\"Entry file for multi-file bundles (default: index.html)\",\n\t\t)\n\t\t.option(\n\t\t\t\"--metadata <json>\",\n\t\t\t'Attach JSON key-value pairs, e.g. \\'{\"source\":\"ci\"}\\'',\n\t\t)\n\t\t.option(\"--metadata-file <path>\", \"Read metadata JSON from a file\")\n\t\t.option(\"--path <name>\", \"Set filename when publishing from stdin\")\n\t\t.option(\"--url\", \"Print only the published URL (no JSON envelope)\")\n\t\t.option(\n\t\t\t\"--dry-run\",\n\t\t\t\"Show what would be published without publishing (JSON; cannot combine with --url)\",\n\t\t)\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.option(\n\t\t\t\"--idempotency-key <key>\",\n\t\t\t\"Prevent duplicate publishes on retry (auto-generated)\",\n\t\t)\n\t\t.action(async (inputs: string[], commandOptions: RawCommandOptions) => {\n\t\t\tconst stdinIsTTY = options.stdinIsTTY ?? process.stdin.isTTY ?? false;\n\t\t\tif (inputs.length === 0 && stdinIsTTY) {\n\t\t\t\tprogram.outputHelp();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst { deps } = await buildPublishDeps(\n\t\t\t\tprogram,\n\t\t\t\toptions,\n\t\t\t\tstore,\n\t\t\t\tcommandOptions,\n\t\t\t\tstdinIsTTY,\n\t\t\t);\n\n\t\t\tlet publishInput: string | string[] | undefined;\n\t\t\ttry {\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} catch (err) {\n\t\t\t\tconst msg = err instanceof Error ? err.message : \"Invalid input.\";\n\t\t\t\tprocess.exitCode = writeError(deps, \"local_input_error\", msg).exitCode;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tlet dropOpts: ReturnType<typeof toDropOptions>;\n\t\t\ttry {\n\t\t\t\tdropOpts = toDropOptions(commandOptions);\n\t\t\t} catch (err) {\n\t\t\t\tconst msg = err instanceof Error ? err.message : \"Invalid option.\";\n\t\t\t\tprocess.exitCode = writeError(deps, \"invalid_usage\", msg).exitCode;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst result = await runPublish(publishInput, dropOpts, deps);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\n\tprogram\n\t\t.command(\"update-content <dropId> [input...]\")\n\t\t.description(\n\t\t\t\"Replace a drop's content, same URL (pass the full drop_… id, not the slug).\\nShips a new deployment. Settings stay unchanged — use update-settings for title, visibility, password, slug, expiry, or metadata.\",\n\t\t)\n\t\t.option(\n\t\t\t\"--entry <path>\",\n\t\t\t\"Entry file for multi-file bundles (default: index.html)\",\n\t\t)\n\t\t.option(\n\t\t\t\"--content-type <mime>\",\n\t\t\t\"Override MIME type (auto-detected from extension)\",\n\t\t)\n\t\t.option(\"--path <name>\", \"Set filename for stdin content\")\n\t\t.option(\n\t\t\t\"--if-revision <n>\",\n\t\t\t\"Fail if current revision doesn't match (optimistic lock)\",\n\t\t\tparseInteger,\n\t\t)\n\t\t.option(\"--url\", \"Print only the published URL (no JSON envelope)\")\n\t\t.option(\n\t\t\t\"--dry-run\",\n\t\t\t\"Show what would be shipped without updating (JSON; cannot combine with --url)\",\n\t\t)\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.option(\n\t\t\t\"--idempotency-key <key>\",\n\t\t\t\"Prevent duplicate updates on retry (auto-generated)\",\n\t\t)\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tdropId: string,\n\t\t\t\tinputs: string[],\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 runUpdateContent>[3][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst stdinIsTTY = options.stdinIsTTY ?? process.stdin.isTTY ?? false;\n\t\t\t\tlet updateInput: string | string[] | undefined;\n\t\t\t\ttry {\n\t\t\t\t\tupdateInput = await resolvePublishInputs(\n\t\t\t\t\t\tinputs,\n\t\t\t\t\t\toptions.stdin,\n\t\t\t\t\t\tstdinIsTTY,\n\t\t\t\t\t);\n\t\t\t\t} catch (err) {\n\t\t\t\t\tconst msg = err instanceof Error ? err.message : \"Invalid input.\";\n\t\t\t\t\tprocess.exitCode = writeError(\n\t\t\t\t\t\tdeps,\n\t\t\t\t\t\t\"local_input_error\",\n\t\t\t\t\t\tmsg,\n\t\t\t\t\t).exitCode;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tlet dropOpts: ReturnType<typeof toDropOptions>;\n\t\t\t\ttry {\n\t\t\t\t\tdropOpts = toDropOptions(commandOptions);\n\t\t\t\t} catch (err) {\n\t\t\t\t\tconst msg = err instanceof Error ? err.message : \"Invalid option.\";\n\t\t\t\t\tprocess.exitCode = writeError(deps, \"invalid_usage\", msg).exitCode;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst result = await runUpdateContent(\n\t\t\t\t\tdropId,\n\t\t\t\t\tupdateInput,\n\t\t\t\t\tdropOpts,\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(\"update-settings <dropId>\")\n\t\t.description(\n\t\t\t\"Change a drop's title, visibility, password, vanity slug, expiry, or metadata (pass the full drop_… id, not the slug).\\nContent stays unchanged — use update-content to replace the files at the URL.\",\n\t\t)\n\t\t.option(\"--slug <slug>\", \"Change the vanity slug\")\n\t\t.option(\"--title <title>\", \"Change title\")\n\t\t.option(\"--visibility <v>\", \"Set to public or unlisted\")\n\t\t.option(\"--password <password>\", \"Require password to view\")\n\t\t.option(\"--no-password\", \"Remove password protection\")\n\t\t.option(\"--noindex\", \"Prevent search-engine indexing\")\n\t\t.option(\"--index\", \"Allow search-engine indexing\")\n\t\t.option(\"--expires-at <datetime>\", \"Auto-delete after this ISO 8601 date\")\n\t\t.option(\n\t\t\t\"--metadata <json>\",\n\t\t\t'Attach JSON key-value pairs, e.g. \\'{\"source\":\"ci\"}\\'',\n\t\t)\n\t\t.option(\"--metadata-file <path>\", \"Read metadata JSON from a file\")\n\t\t.option(\n\t\t\t\"--if-revision <n>\",\n\t\t\t\"Fail if current revision doesn't match (optimistic lock)\",\n\t\t\tparseInteger,\n\t\t)\n\t\t.option(\"--url\", \"Print only the published URL (no JSON envelope)\")\n\t\t.option(\n\t\t\t\"--dry-run\",\n\t\t\t\"Show what would change without updating (JSON; cannot combine with --url)\",\n\t\t)\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.option(\n\t\t\t\"--idempotency-key <key>\",\n\t\t\t\"Prevent duplicate updates on retry (auto-generated)\",\n\t\t)\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tdropId: string,\n\t\t\t\tcommandOptions: RawCommandOptions & { ifRevision?: number },\n\t\t\t) => {\n\t\t\t\tconst stdinIsTTY = options.stdinIsTTY ?? process.stdin.isTTY ?? false;\n\t\t\t\tconst global = globalOptions(program, commandOptions);\n\t\t\t\tconst deps = await commandDeps<\n\t\t\t\t\tParameters<typeof runUpdateSettings>[2][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tlet dropOpts: ReturnType<typeof toDropOptions>;\n\t\t\t\ttry {\n\t\t\t\t\tdropOpts = toDropOptions(commandOptions);\n\t\t\t\t} catch (err) {\n\t\t\t\t\tconst msg = err instanceof Error ? err.message : \"Invalid option.\";\n\t\t\t\t\tprocess.exitCode = writeError(deps, \"invalid_usage\", msg).exitCode;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst result = await runUpdateSettings(dropId, dropOpts, {\n\t\t\t\t\t...deps,\n\t\t\t\t\tinteractive: isInteractive(stdinIsTTY, deps.env, global),\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(\"get <dropId>\")\n\t\t.description(\"Show drop details (pass the full drop_… id)\")\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\n\tprogram\n\t\t.command(\"list\")\n\t\t.description(\"List your drops\")\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\n\tprogram\n\t\t.command(\"delete <dropId>\")\n\t\t.description(\"Delete a drop (pass the full drop_… id)\")\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 stdinIsTTY = options.stdinIsTTY ?? process.stdin.isTTY ?? false;\n\t\t\t\tconst global = globalOptions(program, commandOptions);\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{\n\t\t\t\t\t\t...commandOptions,\n\t\t\t\t\t\tinteractive: isInteractive(stdinIsTTY, deps.env, global),\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 deployments = program\n\t\t.command(\"deployments\")\n\t\t.description(\"View deployment history\");\n\tdeployments\n\t\t.command(\"list <dropId>\")\n\t\t.description(\"List deployments for a drop\")\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.description(\"Show deployment details\")\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\tconst apiKeys = program.command(\"api-keys\").description(\"Manage API keys\");\n\tapiKeys\n\t\t.command(\"create\")\n\t\t.description(\"Create an API key\")\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.description(\"List API keys\")\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.description(\"Delete an API key\")\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 stdinIsTTY = options.stdinIsTTY ?? process.stdin.isTTY ?? false;\n\t\t\t\tconst global = globalOptions(program, commandOptions);\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{\n\t\t\t\t\t\t...commandOptions,\n\t\t\t\t\t\tinteractive: isInteractive(stdinIsTTY, deps.env, global),\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\t// --- Auth commands ---\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<Parameters<typeof runWhoami>[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 runWhoami(commandOptions, deps);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\n\tconst account = program\n\t\t.command(\"account\")\n\t\t.description(\"Show or manage your account\");\n\taccount\n\t\t.command(\"get\", { isDefault: true })\n\t\t.description(\"Show 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\taccount\n\t\t.command(\"update\")\n\t\t.description(\"Update account display name\")\n\t\t.requiredOption(\"--display-name <name>\", \"Set the display name\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(async (commandOptions: { displayName: string; json?: boolean }) => {\n\t\t\tconst deps = await commandDeps<\n\t\t\t\tParameters<typeof runAccountUpdate>[1][\"client\"]\n\t\t\t>(program, options, store, commandOptions);\n\t\t\tconst result = await runAccountUpdate(\n\t\t\t\t{\n\t\t\t\t\tdisplayName: commandOptions.displayName,\n\t\t\t\t\t...(commandOptions.json !== undefined\n\t\t\t\t\t\t? { json: commandOptions.json }\n\t\t\t\t\t\t: {}),\n\t\t\t\t},\n\t\t\t\tdeps,\n\t\t\t);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\taccount\n\t\t.command(\"delete\")\n\t\t.description(\"Delete your account\")\n\t\t.option(\"--yes\", \"Confirm deletion\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(async (commandOptions: { yes?: boolean; json?: boolean }) => {\n\t\t\tconst stdinIsTTY = options.stdinIsTTY ?? process.stdin.isTTY ?? false;\n\t\t\tconst global = globalOptions(program, commandOptions);\n\t\t\tconst deps = await commandDeps<\n\t\t\t\tParameters<typeof runAccountDelete>[1][\"client\"]\n\t\t\t>(program, options, store, commandOptions);\n\t\t\tconst result = await runAccountDelete(\n\t\t\t\t{\n\t\t\t\t\t...commandOptions,\n\t\t\t\t\tinteractive: isInteractive(stdinIsTTY, deps.env, global),\n\t\t\t\t},\n\t\t\t\tdeps,\n\t\t\t);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\n\t// --- Diagnostics ---\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, program });\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\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\nasync function buildPublishDeps(\n\tprogram: Command,\n\toptions: BuildProgramOptions,\n\tstore: CredentialStore,\n\tcommandOptions: { json?: boolean; quiet?: boolean },\n\tstdinIsTTY: boolean,\n): Promise<{\n\tdeps: RunnerDeps<Parameters<typeof runPublish>[2][\"client\"]> & {\n\t\tinteractive: boolean;\n\t\tinlineAuth: () => Promise<ResolvedCredential | null>;\n\t\tcreateClient: (\n\t\t\tapiKey: string,\n\t\t) => Parameters<typeof runPublish>[2][\"client\"];\n\t};\n}> {\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\tconst interactive = isInteractive(stdinIsTTY, context.env, global);\n\n\tconst inlineAuth = async () => {\n\t\tconst { runInlineAuth } = await import(\"./inline-auth.js\");\n\t\treturn runInlineAuth({\n\t\t\tclient: context.createClient() as unknown as InlineAuthClient,\n\t\t\tcreateClient: (apiKey: string) =>\n\t\t\t\tcontext.createClient(apiKey) as unknown as InlineAuthClient,\n\t\t\tstore,\n\t\t\tstderr: context.stderr,\n\t\t});\n\t};\n\n\treturn {\n\t\tdeps: {\n\t\t\tstore,\n\t\t\tclient: (options.client ??\n\t\t\t\tcontext.createClient(credential?.apiKey)) as Parameters<\n\t\t\t\ttypeof runPublish\n\t\t\t>[2][\"client\"],\n\t\t\t...(global.apiKey ? { apiKey: global.apiKey } : {}),\n\t\t\tenv: context.env,\n\t\t\tstdout: context.stdout,\n\t\t\tstderr: context.stderr,\n\t\t\toutputMode: context.output.mode,\n\t\t\tinteractive,\n\t\t\tinlineAuth,\n\t\t\tcreateClient: (apiKey: string) =>\n\t\t\t\tcontext.createClient(apiKey) as unknown as Parameters<\n\t\t\t\t\ttypeof runPublish\n\t\t\t\t>[2][\"client\"],\n\t\t},\n\t};\n}\n\nfunction isInteractive(\n\tstdinIsTTY: boolean,\n\tenv: Record<string, string | undefined>,\n\tglobal: GlobalOptions,\n): boolean {\n\treturn (\n\t\tstdinIsTTY &&\n\t\t!env.CI &&\n\t\t!env.DROPTHIS_NON_INTERACTIVE &&\n\t\tglobal.interactive !== false\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\t...(opts.interactive !== undefined\n\t\t\t? { interactive: opts.interactive }\n\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\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\n\t\t\t? { visibility: options.visibility as \"public\" | \"unlisted\" }\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.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 resolvePublishInputs(\n\tinputs: string[],\n\tstdin?: AsyncIterable<string | Uint8Array>,\n\tstdinIsTTY?: boolean,\n): Promise<string | 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\tif (inputs.includes(\"-\")) {\n\t\tthrow new Error(\n\t\t\t\"Cannot read stdin (-) alongside multiple file arguments. Pass file paths only.\",\n\t\t);\n\t}\n\treturn inputs;\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 async function requireCredential(input: {\n\tapiKey?: string;\n\tenv: Record<string, string | undefined>;\n\tstore: CredentialStore;\n}): Promise<ResolvedCredential> {\n\tconst credential = await resolveCredential(input);\n\tif (!credential) {\n\t\tthrow Object.assign(new Error(\"No API key found.\"), {\n\t\t\tcode: \"auth_error\" as const,\n\t\t});\n\t}\n\treturn credential;\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","import pc from \"picocolors\";\nimport type { ApiErrorDetails } from \"./output.js\";\nimport {\n\tapiErrorEnvelope,\n\ttype CliErrorCode,\n\terrorEnvelope,\n\texitCodeFor,\n\tnextActionForApiError,\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\tconst details = formatDropDetails(data);\n\t\tif (details) deps.stdout(`${details}\\n`);\n\t} else {\n\t\tdeps.stdout(`${JSON.stringify({ ok: true, drop: data })}\\n`);\n\t}\n}\n\nfunction formatDropDetails(data: Record<string, unknown>): string {\n\tconst parts: string[] = [];\n\tconst size = data.sizeBytes;\n\tif (typeof size === \"number\") parts.push(formatBytes(size));\n\tconst ct = data.contentType;\n\tif (typeof ct === \"string\") parts.push(ct.split(\";\")[0]!);\n\tconst vis = data.visibility;\n\tif (vis === \"unlisted\") parts.push(\"unlisted\");\n\tconst exp = data.expiresAt;\n\tif (typeof exp === \"string\") parts.push(`expires ${exp.split(\"T\")[0]}`);\n\tif (parts.length === 0) return \"\";\n\treturn ` ${pc.dim(parts.join(\" · \"))}`;\n}\n\nfunction formatBytes(bytes: number): string {\n\tif (bytes < 1024) return `${bytes} B`;\n\tif (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;\n\treturn `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\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 = nextActionForApiError(details);\n\t\tif (nextAction) deps.stderr(`${hint(nextAction)}\\n`);\n\t\tif (details.requestId)\n\t\t\tdeps.stderr(`${pc.dim(`Request ID: ${details.requestId}`)}\\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 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 { requireCredential } from \"../auth.js\";\nimport {\n\twriteApiError,\n\twriteAuthError,\n\twriteError,\n\twriteHumanOrJson,\n\twriteKv,\n} from \"../fmt.js\";\nimport type { CommandDeps, SdkResult } from \"../types.js\";\nimport { success } from \"../ui.js\";\n\ntype AccountClient = {\n\taccount: { get(): Promise<SdkResult<unknown>> };\n};\n\ntype AccountUpdateClient = {\n\taccount: {\n\t\tupdate(input: { displayName: string | null }): Promise<SdkResult<unknown>>;\n\t};\n};\n\ntype AccountDeleteClient = {\n\taccount: { delete(): Promise<SdkResult<null>> };\n};\n\nexport async function runAccountGet(\n\t_input: { json?: boolean },\n\tdeps: CommandDeps<AccountClient>,\n): Promise<{ exitCode: number }> {\n\ttry {\n\t\tawait requireCredential({\n\t\t\t...(deps.apiKey ? { apiKey: deps.apiKey } : {}),\n\t\t\tenv: deps.env,\n\t\t\tstore: deps.store,\n\t\t});\n\t} catch {\n\t\treturn writeAuthError(deps);\n\t}\n\tconst result = await deps.client.account.get();\n\tif (result.error) {\n\t\treturn writeApiError(deps, result.error);\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\tif (data?.displayName) pairs.push([\"Name\", String(data.displayName)]);\n\tif (data?.status) pairs.push([\"Status\", String(data.status)]);\n\tif (data?.createdAt)\n\t\tpairs.push([\"Created\", String(data.createdAt).split(\"T\")[0]!]);\n\n\twriteKv(deps, pairs, { ok: true, account: result.data });\n\treturn { exitCode: 0 };\n}\n\nexport async function runAccountUpdate(\n\tinput: { displayName: string | null; json?: boolean },\n\tdeps: CommandDeps<AccountUpdateClient>,\n): Promise<{ exitCode: number }> {\n\ttry {\n\t\tawait requireCredential({\n\t\t\t...(deps.apiKey ? { apiKey: deps.apiKey } : {}),\n\t\t\tenv: deps.env,\n\t\t\tstore: deps.store,\n\t\t});\n\t} catch {\n\t\treturn writeAuthError(deps);\n\t}\n\tconst result = await deps.client.account.update({\n\t\tdisplayName: input.displayName,\n\t});\n\tif (result.error) return writeApiError(deps, result.error);\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?.displayName) pairs.push([\"Name\", String(data.displayName)]);\n\twriteKv(deps, pairs, { ok: true, account: result.data });\n\treturn { exitCode: 0 };\n}\n\nexport async function runAccountDelete(\n\tinput: { yes?: boolean; json?: boolean; interactive?: boolean },\n\tdeps: CommandDeps<AccountDeleteClient>,\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 the account in non-interactive mode.\",\n\t\t);\n\t}\n\ttry {\n\t\tawait requireCredential({\n\t\t\t...(deps.apiKey ? { apiKey: deps.apiKey } : {}),\n\t\t\tenv: deps.env,\n\t\t\tstore: deps.store,\n\t\t});\n\t} catch {\n\t\treturn writeAuthError(deps);\n\t}\n\tconst result = await deps.client.account.delete();\n\tif (result.error) return writeApiError(deps, result.error);\n\twriteHumanOrJson(deps, success(\"Account deleted\"), {\n\t\tok: true,\n\t\tdeleted: true,\n\t});\n\treturn { exitCode: 0 };\n}\n","import * as prompts from \"@clack/prompts\";\nimport { requireCredential } from \"../auth.js\";\nimport {\n\twriteApiError,\n\twriteAuthError,\n\twriteEmpty,\n\twriteError,\n\twriteHumanOrJson,\n\twriteJson,\n\twriteKv,\n} from \"../fmt.js\";\nimport { type CommandDeps, type SdkResult, unwrapListData } from \"../types.js\";\nimport { success } from \"../ui.js\";\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<{ ok: true }>> | SdkResult<{ ok: true }> | undefined;\n\t};\n};\n\nexport async function runApiKeysCreate(\n\tinput: { label: string; json?: boolean },\n\tdeps: CommandDeps<ApiKeysCreateClient>,\n): Promise<{ exitCode: number }> {\n\ttry {\n\t\tawait requireCredential({\n\t\t\t...(deps.apiKey ? { apiKey: deps.apiKey } : {}),\n\t\t\tenv: deps.env,\n\t\t\tstore: deps.store,\n\t\t});\n\t} catch {\n\t\treturn writeAuthError(deps);\n\t}\n\tconst result = await deps.client.apiKeys.create({ label: input.label });\n\tif (result.error) return writeApiError(deps, result.error);\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.keyLast4) pairs.push([\"Last 4\", String(data.keyLast4)]);\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\ttry {\n\t\tawait requireCredential({\n\t\t\t...(deps.apiKey ? { apiKey: deps.apiKey } : {}),\n\t\t\tenv: deps.env,\n\t\t\tstore: deps.store,\n\t\t});\n\t} catch {\n\t\treturn writeAuthError(deps);\n\t}\n\tconst result = await deps.client.apiKeys.list();\n\tif (result.error) return writeApiError(deps, result.error);\n\tconst raw = unwrapListData(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.keyLast4 ?? \"\"}\\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\ttry {\n\t\tawait requireCredential({\n\t\t\t...(deps.apiKey ? { apiKey: deps.apiKey } : {}),\n\t\t\tenv: deps.env,\n\t\t\tstore: deps.store,\n\t\t});\n\t} catch {\n\t\treturn writeAuthError(deps);\n\t}\n\tconst result = await deps.client.apiKeys.delete(keyId);\n\tif (result?.error) return writeApiError(deps, result.error);\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","import type { ApiErrorDetails } from \"./output.js\";\nimport type { CredentialStore } from \"./storage.js\";\n\nexport type SdkErrorMessage = { message: string };\n\nexport type SdkResult<T, E extends SdkErrorMessage = ApiErrorDetails> =\n\t| { data: T; error: null; headers?: Record<string, string> }\n\t| { data: null; error: E; headers?: Record<string, string> };\n\nexport type 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 function unwrapListData(\n\tdata: unknown,\n\t...fallbackKeys: string[]\n): unknown {\n\tif (data && typeof data === \"object\") {\n\t\tif (\"data\" in data) {\n\t\t\treturn (data as Record<string, unknown>).data;\n\t\t}\n\t\tfor (const key of fallbackKeys) {\n\t\t\tif (key in data) {\n\t\t\t\treturn (data as Record<string, unknown>)[key];\n\t\t\t}\n\t\t}\n\t}\n\treturn data;\n}\n","import type { Command } from \"commander\";\n\nexport type CommandEntry = {\n\tname: string;\n\tdescription: string;\n\targuments?: string[];\n\toptions?: string[];\n\tauth?: \"required\";\n\texamples?: string[];\n\tsubcommands?: CommandEntry[];\n};\n\ntype CommandAnnotation = {\n\tauth?: \"required\";\n\texamples?: string[];\n};\n\n// Agent-helpful metadata the commander tree does not carry. Keyed by the\n// space-joined command path (e.g. \"publish\", \"account update\"). Structure\n// (name/description/arguments/options/subcommands) is generated from the live\n// program, so this map only supplies auth + examples and cannot drift it.\nconst COMMAND_ANNOTATIONS: Record<string, CommandAnnotation> = {\n\tpublish: {\n\t\tauth: \"required\",\n\t\texamples: [\n\t\t\t\"dropthis ./report.html\",\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\"update-content\": {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis update-content drop_abc ./site --json\"],\n\t},\n\t\"update-settings\": {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis update-settings drop_abc --title 'Launch' --json\"],\n\t},\n\tget: {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis get drop_abc --json\"],\n\t},\n\tlist: {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis list --json\"],\n\t},\n\tdelete: {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis delete drop_abc --yes --json\"],\n\t},\n\tdeployments: {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis deployments drop_abc --json\"],\n\t},\n\t\"deployments list\": {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis deployments list drop_abc --json\"],\n\t},\n\t\"deployments get\": {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis deployments get drop_abc dep_abc --json\"],\n\t},\n\t\"api-keys\": {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis api-keys create --label CI --json\"],\n\t},\n\tlogin: {\n\t\texamples: [\n\t\t\t\"dropthis login verify --email user@example.com --otp 123456 --json\",\n\t\t],\n\t},\n\tlogout: { examples: [\"dropthis logout --json\"] },\n\twhoami: { auth: \"required\", examples: [\"dropthis whoami --json\"] },\n\taccount: { auth: \"required\", examples: [\"dropthis account --json\"] },\n\t\"account get\": { auth: \"required\" },\n\t\"account update\": {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis account update --display-name 'Ada' --json\"],\n\t},\n\t\"account delete\": {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis account delete --yes --json\"],\n\t},\n\tdoctor: { examples: [\"dropthis doctor --json\"] },\n\tcommands: { examples: [\"dropthis commands --json\"] },\n};\n\nfunction describeArgs(cmd: Command): string[] {\n\treturn cmd.registeredArguments.map((a) => a.name());\n}\n\nfunction describeOptions(cmd: Command): string[] {\n\treturn cmd.options.map((o) => o.long ?? o.short ?? o.flags);\n}\n\nfunction toEntry(cmd: Command, path: string[]): CommandEntry {\n\tconst fullPath = [...path, cmd.name()];\n\tconst annotation = COMMAND_ANNOTATIONS[fullPath.join(\" \")];\n\tconst subs = cmd.commands.map((sub) => toEntry(sub, fullPath));\n\treturn {\n\t\tname: cmd.name(),\n\t\tdescription: cmd.description(),\n\t\t...(describeArgs(cmd).length ? { arguments: describeArgs(cmd) } : {}),\n\t\t...(describeOptions(cmd).length ? { options: describeOptions(cmd) } : {}),\n\t\t...(annotation?.auth ? { auth: annotation.auth } : {}),\n\t\t...(annotation?.examples ? { examples: annotation.examples } : {}),\n\t\t...(subs.length ? { subcommands: subs } : {}),\n\t};\n}\n\nexport function buildCatalog(program: Command): CommandEntry[] {\n\treturn program.commands.map((cmd) => toEntry(cmd, []));\n}\n","import type { Command } from \"commander\";\nimport { buildCatalog } from \"../catalog.js\";\n\nexport async function runCommands(\n\t_input: { json?: boolean },\n\tdeps: { stdout: (value: string) => void; program: Command },\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: buildCatalog(deps.program),\n\t\t})}\\n`,\n\t);\n\treturn { exitCode: 0 };\n}\n","import { requireCredential } from \"../auth.js\";\nimport {\n\twriteApiError,\n\twriteAuthError,\n\twriteEmpty,\n\twriteJson,\n\twriteKv,\n} from \"../fmt.js\";\nimport type { CommandDeps, SdkResult } from \"../types.js\";\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\nexport async function runDeploymentsList(\n\tdropId: string,\n\tinput: { limit?: number; cursor?: string; json?: boolean },\n\tdeps: CommandDeps<DeploymentsClient>,\n): Promise<{ exitCode: number }> {\n\ttry {\n\t\tawait requireCredential({\n\t\t\t...(deps.apiKey ? { apiKey: deps.apiKey } : {}),\n\t\t\tenv: deps.env,\n\t\t\tstore: deps.store,\n\t\t});\n\t} catch {\n\t\treturn writeAuthError(deps);\n\t}\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.createdAt ?? \"\"}\\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: CommandDeps<DeploymentsClient>,\n): Promise<{ exitCode: number }> {\n\ttry {\n\t\tawait requireCredential({\n\t\t\t...(deps.apiKey ? { apiKey: deps.apiKey } : {}),\n\t\t\tenv: deps.env,\n\t\t\tstore: deps.store,\n\t\t});\n\t} catch {\n\t\treturn writeAuthError(deps);\n\t}\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.createdAt) pairs.push([\"Created\", String(data.createdAt)]);\n\twriteKv(deps, pairs, { ok: true, deployment: result.data });\n\treturn { exitCode: 0 };\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 { requireCredential } from \"../auth.js\";\nimport {\n\twriteApiError,\n\twriteAuthError,\n\twriteEmpty,\n\twriteError,\n\twriteHumanOrJson,\n\twriteJson,\n\twriteKv,\n} from \"../fmt.js\";\nimport { type CommandDeps, type SdkResult, unwrapListData } from \"../types.js\";\nimport { url as fmtUrl, success } from \"../ui.js\";\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 DropsDeleteClient = {\n\tdrops: {\n\t\tdelete(\n\t\t\tdropId: string,\n\t\t): Promise<SdkResult<null>> | SdkResult<null> | undefined;\n\t};\n};\n\nexport async function runDropsList(\n\tinput: { limit?: number; cursor?: string; json?: boolean },\n\tdeps: CommandDeps<DropsListClient>,\n): Promise<{ exitCode: number }> {\n\ttry {\n\t\tawait requireCredential({\n\t\t\t...(deps.apiKey ? { apiKey: deps.apiKey } : {}),\n\t\t\tenv: deps.env,\n\t\t\tstore: deps.store,\n\t\t});\n\t} catch {\n\t\treturn writeAuthError(deps);\n\t}\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 writeApiError(deps, result.error);\n\tconst raw = unwrapListData(result.data, \"drops\");\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\ttry {\n\t\tawait requireCredential({\n\t\t\t...(deps.apiKey ? { apiKey: deps.apiKey } : {}),\n\t\t\tenv: deps.env,\n\t\t\tstore: deps.store,\n\t\t});\n\t} catch {\n\t\treturn writeAuthError(deps);\n\t}\n\tconst result = await deps.client.drops.get(dropId);\n\tif (result.error) return writeApiError(deps, result.error);\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.createdAt) pairs.push([\"Created\", String(data.createdAt)]);\n\tif (data.accessible !== undefined)\n\t\tpairs.push([\"Accessible\", String(data.accessible)]);\n\tif (data.persistent !== undefined)\n\t\tpairs.push([\"Persistent\", String(data.persistent)]);\n\tconst tier = data.tier as Record<string, unknown> | undefined;\n\tif (tier?.name) pairs.push([\"Tier\", String(tier.name)]);\n\twriteKv(deps, pairs, { ok: true, drop: result.data });\n\treturn { exitCode: 0 };\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\ttry {\n\t\tawait requireCredential({\n\t\t\t...(deps.apiKey ? { apiKey: deps.apiKey } : {}),\n\t\t\tenv: deps.env,\n\t\t\tstore: deps.store,\n\t\t});\n\t} catch {\n\t\treturn writeAuthError(deps);\n\t}\n\tconst result = await deps.client.drops.delete(dropId);\n\tif (result?.error) return writeApiError(deps, result.error);\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","import * as prompts from \"@clack/prompts\";\nimport { errorEnvelope, exitCodeFor } from \"../output.js\";\nimport type { CredentialStore } from \"../storage.js\";\nimport type { SdkErrorMessage, SdkResult } from \"../types.js\";\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, SdkErrorMessage>>;\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, SdkErrorMessage>>;\n\t};\n\tapiKeys: {\n\t\tcreate(input: {\n\t\t\tlabel: string;\n\t\t}): Promise<SdkResult<ApiKeyData, SdkErrorMessage>>;\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 maxAttempts = 3;\n\tlet session: { data: SessionData; error: null } | undefined;\n\tfor (let attempt = 1; attempt <= maxAttempts; attempt++) {\n\t\tconst otp = await prompts.text({\n\t\t\tmessage:\n\t\t\t\tattempt === 1\n\t\t\t\t\t? \"Paste the code from your email\"\n\t\t\t\t\t: \"Try again — paste the code from your email\",\n\t\t\tvalidate: (v) =>\n\t\t\t\tv && v.length >= 4 && v.length <= 8\n\t\t\t\t\t? undefined\n\t\t\t\t\t: \"Code must be 4–8 characters.\",\n\t\t});\n\t\tif (prompts.isCancel(otp)) {\n\t\t\tprompts.cancel(\"Login cancelled.\");\n\t\t\treturn { exitCode: 0 };\n\t\t}\n\n\t\tconst result = await deps.client.auth.verifyEmailOtp({\n\t\t\temail,\n\t\t\tcode: otp,\n\t\t});\n\t\tif (!result.error) {\n\t\t\tsession = result as { data: SessionData; error: null };\n\t\t\tbreak;\n\t\t}\n\t\tif (attempt < maxAttempts) {\n\t\t\tprompts.log.warning(result.error.message);\n\t\t} else {\n\t\t\tprompts.cancel(result.error.message);\n\t\t\treturn { exitCode: exitCodeFor(\"api_error\") };\n\t\t}\n\t}\n\tif (!session) {\n\t\tprompts.cancel(\"Login failed.\");\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 type { SdkErrorMessage, SdkResult } from \"../types.js\";\nimport { success } from \"../ui.js\";\n\ntype LogoutClient = {\n\tapiKeys: {\n\t\tdelete(\n\t\t\tkeyId: string,\n\t\t):\n\t\t\t| SdkResult<null, SdkErrorMessage>\n\t\t\t| Promise<SdkResult<null, SdkErrorMessage>>\n\t\t\t| undefined\n\t\t\t| 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\";\n\nexport type DropData = { url: string; [key: string]: unknown };\n\nexport type ManifestFile = {\n\tpath: string;\n\tcontentType: string;\n\tsizeBytes: number;\n};\n\nexport type PreparedStagedResult = {\n\tkind: \"staged\";\n\tmanifest: { files: ManifestFile[]; entry?: string | null };\n\toptions: Record<string, unknown>;\n\tmetadata?: Record<string, unknown>;\n};\n\nexport type PreparedSourceResult = {\n\tkind: \"source\";\n\tsourceUrl: string;\n\toptions: Record<string, unknown>;\n\tmetadata?: Record<string, unknown>;\n};\n\nexport type PreparedResult = PreparedStagedResult | PreparedSourceResult;\n\nexport const MAX_BUNDLE_FILE_COUNT = 200;\n\nexport function isFileSystemError(error: unknown): boolean {\n\tif (!(error instanceof Error)) return false;\n\tconst code = (error as NodeJS.ErrnoException).code;\n\treturn (\n\t\tcode === \"ENOENT\" ||\n\t\tcode === \"ENOTDIR\" ||\n\t\tcode === \"EACCES\" ||\n\t\tcode === \"ELIMIT\"\n\t);\n}\n\nexport function withIdempotencyKey<T extends { idempotencyKey?: string }>(\n\toptions: T,\n\t_prefix: \"pub\" | \"upd\",\n): T & { idempotencyKey: string } {\n\treturn options.idempotencyKey\n\t\t? (options as T & { idempotencyKey: string })\n\t\t: { ...options, idempotencyKey: randomUUID() };\n}\n\nexport function validateManifestFileCount(count: number): void {\n\tif (count > MAX_BUNDLE_FILE_COUNT) {\n\t\tthrow Object.assign(\n\t\t\tnew Error(\n\t\t\t\t`Bundle contains ${count} 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\nexport function formatDryRunManifest(\n\tprepared: PreparedResult,\n\textra?: Record<string, unknown>,\n): Record<string, unknown> {\n\tif (prepared.kind === \"source\") {\n\t\treturn {\n\t\t\tok: true,\n\t\t\tdryRun: true,\n\t\t\tkind: \"source\",\n\t\t\t...extra,\n\t\t\tsourceUrl: prepared.sourceUrl,\n\t\t\toptions: prepared.options,\n\t\t\t...(prepared.metadata ? { metadata: prepared.metadata } : {}),\n\t\t};\n\t}\n\tconst totalBytes = prepared.manifest.files.reduce(\n\t\t(sum, f) => sum + f.sizeBytes,\n\t\t0,\n\t);\n\treturn {\n\t\tok: true,\n\t\tdryRun: true,\n\t\tkind: \"staged\",\n\t\t...extra,\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","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\tif (\n\t\traw.visibility &&\n\t\traw.visibility !== \"public\" &&\n\t\traw.visibility !== \"unlisted\"\n\t) {\n\t\tthrow new Error(\n\t\t\t`Invalid visibility \"${raw.visibility}\". Use \"public\" or \"unlisted\".`,\n\t\t);\n\t}\n\tif (raw.expiresAt) {\n\t\tconst d = new Date(raw.expiresAt);\n\t\tif (Number.isNaN(d.getTime())) {\n\t\t\tthrow new Error(\n\t\t\t\t`Invalid date \"${raw.expiresAt}\". Use ISO 8601 format, e.g. 2025-12-31T23:59:59Z.`,\n\t\t\t);\n\t\t}\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 pc from \"picocolors\";\n\nconst frames = [\"⠋\", \"⠙\", \"⠹\", \"⠸\", \"⠼\", \"⠴\", \"⠦\", \"⠧\", \"⠇\", \"⠏\"];\n\nexport type Spinner = {\n\tstop(): 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() {\n\t\t\tclearInterval(timer);\n\t\t\tstderr(\"\\r\\x1B[2K\");\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 type { PublishInput } from \"@dropthis/node\";\nimport { type ResolvedCredential, resolveCredential } from \"../auth.js\";\nimport {\n\ttype DropData,\n\tformatDryRunManifest,\n\tisFileSystemError,\n\ttype PreparedResult,\n\tvalidateManifestFileCount,\n\twithIdempotencyKey,\n} from \"../drop-operations.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 { createSpinner, shouldSpin } from \"../spinner.js\";\nimport type { CredentialStore } from \"../storage.js\";\nimport type { SdkResult } from \"../types.js\";\n\ntype PublishClient = {\n\tdrops: {\n\t\tpublish(\n\t\t\tinput: PublishInput,\n\t\t\toptions: ParsedDropOptions,\n\t\t): Promise<SdkResult<DropData>>;\n\t};\n\tprepare?(\n\t\tinput: PublishInput,\n\t\toptions: ParsedDropOptions,\n\t): Promise<PreparedResult>;\n};\n\ntype PublishOptions = RawDropOptions & {\n\tdryRun?: boolean;\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\toutputMode?: \"human\" | \"json\";\n\tinteractive?: boolean;\n\tinlineAuth?: () => Promise<ResolvedCredential | null>;\n\tcreateClient?: (apiKey: string) => PublishClient;\n};\n\nexport async function runPublish(\n\tinput: string | string[] | undefined,\n\traw: PublishOptions,\n\tdeps: PublishDeps,\n): Promise<{ exitCode: number }> {\n\tlet credential: ResolvedCredential | null;\n\ttry {\n\t\tcredential = await resolveCredential({\n\t\t\t...((raw.apiKey ?? deps.apiKey)\n\t\t\t\t? { apiKey: raw.apiKey ?? deps.apiKey }\n\t\t\t\t: {}),\n\t\t\tenv: deps.env,\n\t\t\tstore: deps.store,\n\t\t});\n\t} catch {\n\t\treturn writeAuthError(deps);\n\t}\n\n\tlet didInlineAuth = false;\n\tif (!credential) {\n\t\tif (deps.interactive && deps.inlineAuth) {\n\t\t\ttry {\n\t\t\t\tcredential = await deps.inlineAuth();\n\t\t\t} catch {\n\t\t\t\treturn writeAuthError(deps);\n\t\t\t}\n\t\t\tif (!credential) return writeAuthError(deps);\n\t\t\tdidInlineAuth = true;\n\t\t} else {\n\t\t\treturn writeAuthError(deps);\n\t\t}\n\t}\n\n\tlet client = deps.client;\n\tif (didInlineAuth && deps.createClient) {\n\t\tclient = deps.createClient(credential.apiKey);\n\t}\n\n\tif (raw.dryRun) {\n\t\treturn handlePublishDryRun(input, raw, deps, client);\n\t}\n\n\tconst hasInput = Array.isArray(input)\n\t\t? input.length > 0\n\t\t: input !== undefined;\n\tconst spin = shouldSpin(deps.outputMode)\n\t\t? createSpinner(\"Publishing…\", deps.stderr)\n\t\t: undefined;\n\ttry {\n\t\tconst options = withIdempotencyKey(await parseDropOptions(raw), \"pub\");\n\t\tconst doPublish = (c: PublishClient) =>\n\t\t\thasInput\n\t\t\t\t? c.drops.publish(input as PublishInput, options)\n\t\t\t\t: (() => {\n\t\t\t\t\t\tthrow new Error(\"Publish requires <input>.\");\n\t\t\t\t\t})();\n\t\tconst result = await doPublish(client);\n\t\tif (result.error) {\n\t\t\tif (\n\t\t\t\tresult.error.statusCode === 401 &&\n\t\t\t\tdeps.interactive &&\n\t\t\t\tdeps.inlineAuth &&\n\t\t\t\t!didInlineAuth\n\t\t\t) {\n\t\t\t\tspin?.stop();\n\t\t\t\tconst newCredential = await deps.inlineAuth();\n\t\t\t\tif (newCredential && deps.createClient) {\n\t\t\t\t\tclient = deps.createClient(newCredential.apiKey);\n\t\t\t\t\tconst retrySpin = shouldSpin(deps.outputMode)\n\t\t\t\t\t\t? createSpinner(\"Publishing…\", deps.stderr)\n\t\t\t\t\t\t: undefined;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst retryResult = await doPublish(client);\n\t\t\t\t\t\tif (retryResult.error) {\n\t\t\t\t\t\t\tretrySpin?.fail();\n\t\t\t\t\t\t\treturn writeApiError(deps, retryResult.error);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tretrySpin?.stop();\n\t\t\t\t\t\tif (raw.url) deps.stdout(`${retryResult.data.url}\\n`);\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\twriteResult(\n\t\t\t\t\t\t\t\tdeps,\n\t\t\t\t\t\t\t\tretryResult.data.url,\n\t\t\t\t\t\t\t\t\"Published\",\n\t\t\t\t\t\t\t\tretryResult.data,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\treturn { exitCode: 0 };\n\t\t\t\t\t} catch (retryError) {\n\t\t\t\t\t\tretrySpin?.fail();\n\t\t\t\t\t\tconst message =\n\t\t\t\t\t\t\tretryError instanceof Error\n\t\t\t\t\t\t\t\t? retryError.message\n\t\t\t\t\t\t\t\t: \"Publish failed.\";\n\t\t\t\t\t\tconst code = isFileSystemError(retryError)\n\t\t\t\t\t\t\t? \"local_input_error\"\n\t\t\t\t\t\t\t: \"invalid_usage\";\n\t\t\t\t\t\treturn writeError(deps, code, message);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tspin?.fail();\n\t\t\treturn writeApiError(deps, result.error);\n\t\t}\n\t\tspin?.stop();\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\tconst code = isFileSystemError(error)\n\t\t\t? \"local_input_error\"\n\t\t\t: \"invalid_usage\";\n\t\tspin?.fail();\n\t\treturn writeError(deps, code, message);\n\t}\n}\n\nasync function handlePublishDryRun(\n\tinput: string | string[] | undefined,\n\traw: PublishOptions,\n\tdeps: PublishDeps,\n\tclient: PublishClient,\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 (!input || (Array.isArray(input) && input.length === 0)) {\n\t\t\tthrow new Error(\"Publish requires <input>.\");\n\t\t}\n\n\t\tconst options = await parseDropOptions(raw);\n\n\t\tif (!client.prepare) {\n\t\t\tthrow new Error(\"Client does not support dry-run.\");\n\t\t}\n\t\tconst prepared = await client.prepare(input as PublishInput, options);\n\t\tconst output = formatDryRunManifest(prepared);\n\t\tif (prepared.kind === \"staged\") {\n\t\t\tvalidateManifestFileCount(prepared.manifest.files.length);\n\t\t}\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","import type { PublishInput, UpdateContentOptions } from \"@dropthis/node\";\nimport { requireCredential } from \"../auth.js\";\nimport {\n\ttype DropData,\n\tformatDryRunManifest,\n\tisFileSystemError,\n\ttype PreparedResult,\n\tvalidateManifestFileCount,\n\twithIdempotencyKey,\n} from \"../drop-operations.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 { createSpinner, shouldSpin } from \"../spinner.js\";\nimport type { CredentialStore } from \"../storage.js\";\nimport type { SdkResult } from \"../types.js\";\n\ntype UpdateContentClient = {\n\tdrops: {\n\t\tupdateContent(\n\t\t\tdropId: string,\n\t\t\tinput: PublishInput,\n\t\t\toptions: UpdateContentOptions,\n\t\t): Promise<SdkResult<DropData>>;\n\t};\n\tprepare?(\n\t\tinput: PublishInput,\n\t\toptions: ParsedDropOptions,\n\t): Promise<PreparedResult>;\n};\n\ntype RawUpdateContentOptions = RawDropOptions & {\n\tdryRun?: boolean;\n\tifRevision?: number;\n\tjson?: boolean;\n\tquiet?: boolean;\n\turl?: boolean;\n\tapiKey?: string;\n};\n\ntype UpdateContentDeps = {\n\tstore: CredentialStore;\n\tclient: UpdateContentClient;\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\nconst NO_CONTENT_MESSAGE =\n\t\"update-content requires content. Provide a file, folder, URL, or text to ship a new deployment.\";\n\nconst NO_CONTENT_NEXT_ACTION =\n\t\"Pass an input, e.g. dropthis update-content <dropId> ./dist. \" +\n\t\"To change title, visibility, password, slug, expiry, or metadata, use dropthis update-settings <dropId> instead.\";\n\n/** Content-prep subset safe to pass to a content-only updateContent(). */\nfunction contentOptions(options: ParsedDropOptions): UpdateContentOptions {\n\tconst out: UpdateContentOptions = {};\n\tif (options.entry !== undefined) out.entry = options.entry;\n\tif (options.contentType !== undefined) out.contentType = options.contentType;\n\tif (options.path !== undefined) out.path = options.path;\n\treturn out;\n}\n\nexport async function runUpdateContent(\n\tdropId: string,\n\tinput: PublishInput | undefined,\n\traw: RawUpdateContentOptions,\n\tdeps: UpdateContentDeps,\n): Promise<{ exitCode: number }> {\n\ttry {\n\t\tawait requireCredential({\n\t\t\t...((raw.apiKey ?? deps.apiKey)\n\t\t\t\t? { apiKey: raw.apiKey ?? deps.apiKey }\n\t\t\t\t: {}),\n\t\t\tenv: deps.env,\n\t\t\tstore: deps.store,\n\t\t});\n\t} catch {\n\t\treturn writeAuthError(deps);\n\t}\n\n\tif (raw.dryRun) {\n\t\treturn handleDryRun(dropId, input, raw, deps);\n\t}\n\n\tlet spin: ReturnType<typeof createSpinner> | undefined;\n\ttry {\n\t\tassertDropId(dropId);\n\t\tconst hasInput = Array.isArray(input)\n\t\t\t? input.length > 0\n\t\t\t: input !== undefined;\n\t\tif (!hasInput) {\n\t\t\treturn writeError(\n\t\t\t\tdeps,\n\t\t\t\t\"invalid_usage\",\n\t\t\t\tNO_CONTENT_MESSAGE,\n\t\t\t\tNO_CONTENT_NEXT_ACTION,\n\t\t\t);\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\tspin = shouldSpin(deps.outputMode)\n\t\t\t? createSpinner(\"Updating content…\", deps.stderr)\n\t\t\t: undefined;\n\t\tconst result = await deps.client.drops.updateContent(\n\t\t\tdropId,\n\t\t\tinput as PublishInput,\n\t\t\twithIdempotencyKey(\n\t\t\t\t{ ...contentOptions(parsed), ...revisionOptions },\n\t\t\t\t\"upd\",\n\t\t\t),\n\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();\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\tconst code = isFileSystemError(error)\n\t\t\t? \"local_input_error\"\n\t\t\t: \"invalid_usage\";\n\t\tspin?.fail();\n\t\treturn writeError(deps, code, message);\n\t}\n}\n\nasync function handleDryRun(\n\tdropId: string,\n\tinput: PublishInput | undefined,\n\traw: RawUpdateContentOptions,\n\tdeps: UpdateContentDeps,\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(dropId);\n\t\tconst hasInput = Array.isArray(input)\n\t\t\t? input.length > 0\n\t\t\t: input !== undefined;\n\t\tif (!hasInput) {\n\t\t\treturn writeError(\n\t\t\t\tdeps,\n\t\t\t\t\"invalid_usage\",\n\t\t\t\tNO_CONTENT_MESSAGE,\n\t\t\t\tNO_CONTENT_NEXT_ACTION,\n\t\t\t);\n\t\t}\n\t\tconst options = await parseDropOptions(raw);\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 as PublishInput, options);\n\t\tconst output = formatDryRunManifest(prepared, { target: dropId });\n\t\tif (prepared.kind === \"staged\") {\n\t\t\tvalidateManifestFileCount(prepared.manifest.files.length);\n\t\t}\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\nfunction assertDropId(target: string): void {\n\tif (!target.startsWith(\"drop_\")) {\n\t\tthrow new Error(\n\t\t\t\"update-content needs the full drop_… id from the publish response, not the URL slug, for example drop_...\",\n\t\t);\n\t}\n}\n","import * as prompts from \"@clack/prompts\";\nimport type { DropOptions, RequestControls } from \"@dropthis/node\";\nimport { requireCredential } from \"../auth.js\";\nimport { type DropData, withIdempotencyKey } from \"../drop-operations.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 { createSpinner, shouldSpin } from \"../spinner.js\";\nimport type { CredentialStore } from \"../storage.js\";\nimport type { SdkResult } from \"../types.js\";\n\ntype UpdateSettingsClient = {\n\tdrops: {\n\t\tupdateSettings(\n\t\t\tdropId: string,\n\t\t\toptions: DropOptions & RequestControls,\n\t\t): Promise<SdkResult<DropData>>;\n\t};\n};\n\ntype RawUpdateSettingsOptions = RawDropOptions & {\n\tdryRun?: boolean;\n\tifRevision?: number;\n\tjson?: boolean;\n\tquiet?: boolean;\n\turl?: boolean;\n\tapiKey?: string;\n};\n\ntype UpdateSettingsDeps = {\n\tstore: CredentialStore;\n\tclient: UpdateSettingsClient;\n\tapiKey?: string;\n\tenv: Record<string, string | undefined>;\n\tstdout: (value: string) => void;\n\tstderr: (value: string) => void;\n\toutputMode?: \"human\" | \"json\";\n\tinteractive?: boolean;\n\tprompts?: UpdateSettingsPromptApi;\n};\n\ntype UpdateSettingsPromptApi = {\n\tintro: typeof prompts.intro;\n\tcancel: typeof prompts.cancel;\n\tmultiselect: typeof prompts.multiselect;\n\tselect: typeof prompts.select;\n\ttext: typeof prompts.text;\n\tpassword: typeof prompts.password;\n\tisCancel: typeof prompts.isCancel;\n};\n\ntype InteractiveSettingsField =\n\t| \"title\"\n\t| \"slug\"\n\t| \"visibility\"\n\t| \"password\"\n\t| \"indexing\"\n\t| \"expiresAt\"\n\t| \"metadata\";\n\nconst NO_SETTINGS_MESSAGE =\n\t\"Nothing to update. Provide at least one settings option.\";\n\nconst NO_SETTINGS_NEXT_ACTION =\n\t\"Run dropthis update-settings --help, or retry with one of: \" +\n\t\"--title, --slug, --visibility, --password, --no-password, --noindex, \" +\n\t\"--index, --expires-at, --metadata, or --metadata-file. \" +\n\t\"To replace the content at the URL instead, use dropthis update-content <dropId> ./dist.\";\n\nexport async function runUpdateSettings(\n\tdropId: string,\n\traw: RawUpdateSettingsOptions,\n\tdeps: UpdateSettingsDeps,\n): Promise<{ exitCode: number }> {\n\ttry {\n\t\tawait requireCredential({\n\t\t\t...((raw.apiKey ?? deps.apiKey)\n\t\t\t\t? { apiKey: raw.apiKey ?? deps.apiKey }\n\t\t\t\t: {}),\n\t\t\tenv: deps.env,\n\t\t\tstore: deps.store,\n\t\t});\n\t} catch {\n\t\treturn writeAuthError(deps);\n\t}\n\n\tif (raw.dryRun) {\n\t\treturn handleDryRun(dropId, raw, deps);\n\t}\n\n\tlet spin: ReturnType<typeof createSpinner> | undefined;\n\ttry {\n\t\tassertDropId(dropId);\n\t\tlet parsed = await parseDropOptions(raw);\n\t\tif (!hasSettingsFields(parsed)) {\n\t\t\tif (shouldPrompt(deps)) {\n\t\t\t\tconst prompted = await promptForSettings(\n\t\t\t\t\tdropId,\n\t\t\t\t\tdeps.prompts ?? prompts,\n\t\t\t\t);\n\t\t\t\tif (!prompted) return { exitCode: 0 };\n\t\t\t\tparsed = { ...parsed, ...prompted };\n\t\t\t} else {\n\t\t\t\treturn writeError(\n\t\t\t\t\tdeps,\n\t\t\t\t\t\"invalid_usage\",\n\t\t\t\t\tNO_SETTINGS_MESSAGE,\n\t\t\t\t\tNO_SETTINGS_NEXT_ACTION,\n\t\t\t\t);\n\t\t\t}\n\t\t}\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\tspin = shouldSpin(deps.outputMode)\n\t\t\t? createSpinner(\"Updating settings…\", deps.stderr)\n\t\t\t: undefined;\n\t\tconst result = await deps.client.drops.updateSettings(\n\t\t\tdropId,\n\t\t\twithIdempotencyKey({ ...parsed, ...revisionOptions }, \"upd\"),\n\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();\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\n/** True if any drop-settings field is set. */\nfunction hasSettingsFields(options: ParsedDropOptions): boolean {\n\tconst {\n\t\tidempotencyKey: _,\n\t\tentry: __,\n\t\tcontentType: ___,\n\t\tpath: ____,\n\t\t...settings\n\t} = options;\n\treturn Object.values(settings).some((value) => value !== undefined);\n}\n\nfunction shouldPrompt(deps: UpdateSettingsDeps): boolean {\n\treturn deps.outputMode === \"human\" && deps.interactive === true;\n}\n\nasync function promptForSettings(\n\ttarget: string,\n\tprompt: UpdateSettingsPromptApi,\n): Promise<ParsedDropOptions | undefined> {\n\tprompt.intro(`Update settings for ${target}`);\n\tconst fields = await prompt.multiselect<InteractiveSettingsField>({\n\t\tmessage: \"What do you want to change?\",\n\t\trequired: true,\n\t\toptions: [\n\t\t\t{ value: \"title\", label: \"Title\", hint: \"--title\" },\n\t\t\t{ value: \"slug\", label: \"Slug\", hint: \"--slug\" },\n\t\t\t{ value: \"visibility\", label: \"Visibility\", hint: \"--visibility\" },\n\t\t\t{\n\t\t\t\tvalue: \"password\",\n\t\t\t\tlabel: \"Password\",\n\t\t\t\thint: \"--password or --no-password\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tvalue: \"indexing\",\n\t\t\t\tlabel: \"Search indexing\",\n\t\t\t\thint: \"--noindex or --index\",\n\t\t\t},\n\t\t\t{ value: \"expiresAt\", label: \"Expiration\", hint: \"--expires-at\" },\n\t\t\t{ value: \"metadata\", label: \"Metadata\", hint: \"--metadata\" },\n\t\t],\n\t});\n\tif (prompt.isCancel(fields)) {\n\t\tprompt.cancel(\"Update cancelled.\");\n\t\treturn undefined;\n\t}\n\n\tconst selected = new Set(fields);\n\tconst options: ParsedDropOptions = {};\n\n\tif (selected.has(\"title\")) {\n\t\tconst value = await prompt.text({\n\t\t\tmessage: \"Title\",\n\t\t\tvalidate: requireNonEmpty(\"Enter a title.\"),\n\t\t});\n\t\tif (prompt.isCancel(value)) return cancel(prompt);\n\t\toptions.title = value.trim();\n\t}\n\n\tif (selected.has(\"slug\")) {\n\t\tconst value = await prompt.text({\n\t\t\tmessage: \"Slug\",\n\t\t\tvalidate: requireNonEmpty(\"Enter a slug.\"),\n\t\t});\n\t\tif (prompt.isCancel(value)) return cancel(prompt);\n\t\toptions.slug = value.trim();\n\t}\n\n\tif (selected.has(\"visibility\")) {\n\t\tconst value = await prompt.select<\"public\" | \"unlisted\">({\n\t\t\tmessage: \"Visibility\",\n\t\t\toptions: [\n\t\t\t\t{ value: \"public\", label: \"Public\" },\n\t\t\t\t{ value: \"unlisted\", label: \"Unlisted\" },\n\t\t\t],\n\t\t});\n\t\tif (prompt.isCancel(value)) return cancel(prompt);\n\t\toptions.visibility = value;\n\t}\n\n\tif (selected.has(\"password\")) {\n\t\tconst action = await prompt.select<\"set\" | \"remove\">({\n\t\t\tmessage: \"Password\",\n\t\t\toptions: [\n\t\t\t\t{ value: \"set\", label: \"Set password\" },\n\t\t\t\t{ value: \"remove\", label: \"Remove password\" },\n\t\t\t],\n\t\t});\n\t\tif (prompt.isCancel(action)) return cancel(prompt);\n\t\tif (action === \"set\") {\n\t\t\tconst value = await prompt.password({\n\t\t\t\tmessage: \"Password\",\n\t\t\t\tvalidate: requireNonEmpty(\"Enter a password.\"),\n\t\t\t});\n\t\t\tif (prompt.isCancel(value)) return cancel(prompt);\n\t\t\toptions.password = value;\n\t\t} else {\n\t\t\toptions.password = null;\n\t\t}\n\t}\n\n\tif (selected.has(\"indexing\")) {\n\t\tconst value = await prompt.select<\"noindex\" | \"index\">({\n\t\t\tmessage: \"Search indexing\",\n\t\t\toptions: [\n\t\t\t\t{ value: \"noindex\", label: \"Prevent indexing\" },\n\t\t\t\t{ value: \"index\", label: \"Allow indexing\" },\n\t\t\t],\n\t\t});\n\t\tif (prompt.isCancel(value)) return cancel(prompt);\n\t\toptions.noindex = value === \"noindex\";\n\t}\n\n\tif (selected.has(\"expiresAt\")) {\n\t\tconst value = await prompt.text({\n\t\t\tmessage: \"Expiration date\",\n\t\t\tplaceholder: \"2025-12-31T23:59:59Z\",\n\t\t\tvalidate: validateIsoDate,\n\t\t});\n\t\tif (prompt.isCancel(value)) return cancel(prompt);\n\t\toptions.expiresAt = value.trim();\n\t}\n\n\tif (selected.has(\"metadata\")) {\n\t\tconst value = await prompt.text({\n\t\t\tmessage: \"Metadata JSON object\",\n\t\t\tplaceholder: '{\"source\":\"cli\"}',\n\t\t\tvalidate: validateJsonObject,\n\t\t});\n\t\tif (prompt.isCancel(value)) return cancel(prompt);\n\t\toptions.metadata = parseJsonObject(value);\n\t}\n\n\treturn options;\n}\n\nfunction cancel(prompt: UpdateSettingsPromptApi): undefined {\n\tprompt.cancel(\"Update cancelled.\");\n\treturn undefined;\n}\n\nfunction requireNonEmpty(message: string) {\n\treturn (value: string | undefined): string | undefined =>\n\t\tvalue?.trim() ? undefined : message;\n}\n\nfunction validateIsoDate(value: string | undefined): string | undefined {\n\tif (!value?.trim()) return \"Enter an ISO 8601 date.\";\n\tconst d = new Date(value);\n\treturn Number.isNaN(d.getTime()) ? \"Enter a valid ISO 8601 date.\" : undefined;\n}\n\nfunction validateJsonObject(value: string | undefined): string | undefined {\n\tif (!value?.trim()) return \"Enter a JSON object.\";\n\ttry {\n\t\tparseJsonObject(value);\n\t\treturn undefined;\n\t} catch {\n\t\treturn \"Enter a valid JSON object.\";\n\t}\n}\n\nfunction parseJsonObject(value: string): 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(\"Metadata must be a JSON object.\");\n\t}\n\treturn parsed as Record<string, unknown>;\n}\n\nasync function handleDryRun(\n\tdropId: string,\n\traw: RawUpdateSettingsOptions,\n\tdeps: UpdateSettingsDeps,\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 change.\",\n\t\t);\n\t}\n\ttry {\n\t\tassertDropId(dropId);\n\t\tconst options = await parseDropOptions(raw);\n\t\tconst fields: Record<string, unknown> = {};\n\t\tif (options.slug) fields.slug = options.slug;\n\t\tif (options.title) fields.title = options.title;\n\t\tif (options.visibility) fields.visibility = options.visibility;\n\t\tif (options.password !== undefined) fields.password = options.password;\n\t\tif (options.noindex !== undefined) fields.noindex = options.noindex;\n\t\tif (options.expiresAt) fields.expires_at = options.expiresAt;\n\t\tif (options.metadata) fields.metadata = options.metadata;\n\t\tdeps.stdout(\n\t\t\t`${JSON.stringify({ ok: true, dryRun: true, kind: \"settings_update\", target: dropId, fields }, null, 2)}\\n`,\n\t\t);\n\t\treturn { exitCode: 0 };\n\t} catch (error) {\n\t\tconst message = error instanceof Error ? error.message : \"Dry-run failed.\";\n\t\treturn writeError(deps, \"invalid_usage\", message);\n\t}\n}\n\nfunction assertDropId(target: string): void {\n\tif (!target.startsWith(\"drop_\")) {\n\t\tthrow new Error(\n\t\t\t\"update-settings needs the full drop_… id from the publish response, not the URL slug, 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\";\nimport type { SdkErrorMessage, SdkResult } from \"../types.js\";\n\ntype WhoamiClient = {\n\taccount: { get(): Promise<SdkResult<unknown, SdkErrorMessage>> };\n};\n\nexport async function runWhoami(\n\t_input: { json?: boolean },\n\tdeps: {\n\t\tstore: CredentialStore;\n\t\tclient: WhoamiClient;\n\t\tapiKey?: string;\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\t...(deps.apiKey ? { apiKey: deps.apiKey } : {}),\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\n\tconst result = await deps.client.account.get();\n\tif (result.error) {\n\t\twriteHumanOrJson(\n\t\t\tdeps,\n\t\t\t`Not authenticated: ${result.error.message}. Run dropthis login.`,\n\t\t\t{ ok: true, authenticated: false, reason: result.error.message },\n\t\t);\n\t\treturn { exitCode: 0 };\n\t}\n\n\tconst account = (result.data ?? {}) as Record<string, unknown>;\n\tconst masked = maskKey(credential.apiKey);\n\tconst last4 = credential.keyLast4 ?? credential.apiKey.slice(-4);\n\tconst pairs: Array<[string, string]> = [];\n\tif (credential.email ?? account.email)\n\t\tpairs.push([\"Email\", String(credential.email ?? account.email)]);\n\tpairs.push([\"Key\", masked]);\n\tpairs.push([\"Source\", credential.source]);\n\tif (credential.accountId ?? account.id)\n\t\tpairs.push([\"Account\", String(credential.accountId ?? account.id)]);\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...(last4 ? { key_last4: last4 } : {}),\n\t\t...((credential.accountId ?? account.id)\n\t\t\t? { account_id: String(credential.accountId ?? account.id) }\n\t\t\t: {}),\n\t\t...((credential.email ?? account.email)\n\t\t\t? { email: String(credential.email ?? account.email) }\n\t\t\t: {}),\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\tinteractive?: 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 {\n\tchmod,\n\tmkdir,\n\treadFile,\n\trename,\n\trm,\n\twriteFile,\n} 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\tconst tmpPath = `${path}.${process.pid}.tmp`;\n\tawait writeFile(tmpPath, `${JSON.stringify(credential, null, 2)}\\n`, {\n\t\tmode: 0o600,\n\t});\n\tawait chmod(tmpPath, 0o600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3C,SACC,KAAK,SAAS,QAAQ,KACtB,KAAK,SAAS,SAAS,KACvB,KAAK,SAAS,IAAI,KAClB,QAAQ,IAAI,OAAO,UACnB,QAAQ,OAAO,UAAU;AAE3B;AAEA,aAAa,EAAE,OAAO,sBAAsB,EAAE,CAAC,EAC7C,WAAW,QAAQ,IAAI,EACvB,MAAM,CAACC,WAAmB;AAC1B,MAAI,iBAAiBA,MAAK,GAAG;AAG5B,QACCA,OAAM,SAAS,oBACfA,OAAM,SAAS,6BACfA,OAAM,SAAS,qBACd;AACD,cAAQ,WAAW;AACnB;AAAA,IACD;AACA,YAAQ,WAAW,wBAAwB;AAAA,MAC1C,SAASA,OAAM;AAAA,MACf,MAAM,UAAU,QAAQ,KAAK,MAAM,CAAC,CAAC;AAAA,MACrC,QAAQ,CAAC,UAAU,QAAQ,OAAO,MAAM,KAAK;AAAA,IAC9C,CAAC;AACD;AAAA,EACD;AACA,UAAQ,MAAMA,MAAK;AACnB,UAAQ,WAAW;AACpB,CAAC;","names":["osHostname","import_node_os","error","import_picocolors","import_picocolors","pc","pc","pc","pc","prompts","prompts","error","import_picocolors","pc","error","error","prompts","handleDryRun","assertDropId","prompts","error","cancel","parseJsonObject","import_promises","error","pc","deps","global","result","runInlineAuth","error"]}
|