@dropthis/cli 0.33.0 → 0.33.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 +51 -1
- package/dist/cli.cjs.map +1 -1
- package/package.json +1 -1
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/version.ts","../src/commands/doctor.ts","../src/commands/domains.ts","../src/commands/drops.ts","../src/commands/invitations.ts","../src/commands/login.ts","../src/commands/logout.ts","../src/commands/members.ts","../src/drop-operations.ts","../src/options.ts","../src/spinner.ts","../src/commands/publish.ts","../src/commands/pull.ts","../src/commands/update-content.ts","../src/commands/update-settings.ts","../src/commands/upgrade.ts","../src/semver.ts","../src/commands/whoami.ts","../src/commands/workspace.ts","../src/context.ts","../src/storage.ts","../src/typo-guard.ts","../src/update-check.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\";\nimport { hint } from \"./ui.js\";\nimport {\n\tnoticeFromCache,\n\treadCache,\n\tscheduleBackgroundRefresh,\n\tshouldRefresh,\n\tshouldShowNotice,\n\tupdateCachePath,\n} from \"./update-check.js\";\nimport { CLI_VERSION } from \"./version.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}\n\t// Human mode: commander's configureOutput.outputError already printed the\n\t// usage error (with suggestions) — printing it again would double it.\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\n// Read cache once; both notice and refresh scheduling use the same snapshot.\nconst updateCache = readCache(updateCachePath());\nconst showNotice = shouldShowNotice({\n\tenv: process.env as Record<string, string | undefined>,\n\tstderrIsTTY: process.stderr.isTTY === true,\n\targv: process.argv.slice(2),\n});\n\n// Print cached notice to stderr BEFORE dispatch — zero latency.\nif (showNotice) {\n\tconst notice = noticeFromCache({\n\t\tcache: updateCache,\n\t\tcurrentVersion: CLI_VERSION,\n\t});\n\tif (notice) {\n\t\tprocess.stderr.write(`\\n${hint(notice)}\\n\\n`);\n\t}\n}\n\nbuildProgram({ store: createCredentialStore() })\n\t.parseAsync(process.argv)\n\t.finally(() => {\n\t\t// Only humans on TTYs ever see the notice, so only they pay for the refresh.\n\t\tif (showNotice && shouldRefresh(updateCache, new Date())) {\n\t\t\tscheduleBackgroundRefresh(updateCachePath());\n\t\t}\n\t})\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| \"unsupported_install\"\n\t| \"upgrade_check_failed\"\n\t| \"upgrade_failed\"\n\t| \"usage_error\"\n\t| \"verify_pending\"\n\t| \"verify_timeout\";\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\t// Unified plan-gate fields (feature_not_in_plan / quota_exceeded).\n\tfeature?: string | null;\n\tcurrentPlan?: string | null;\n\trequiredPlan?: string | null;\n\tupgradeUrl?: string | null;\n\tlimit?: number | null;\n\tused?: number | null;\n\trequested?: number | null;\n\tbody?: unknown;\n};\n\nexport type FileFailure = { path: string; reason: string; sourceUrl?: string };\n\nexport function failuresFromApiError(error: ApiErrorDetails): FileFailure[] {\n\tconst body = error.body;\n\tconst raw =\n\t\tbody && typeof body === \"object\"\n\t\t\t? (body as { failures?: unknown }).failures\n\t\t\t: undefined;\n\tif (!Array.isArray(raw)) return [];\n\treturn raw\n\t\t.filter(\n\t\t\t(f): f is Record<string, unknown> =>\n\t\t\t\t!!f &&\n\t\t\t\ttypeof f === \"object\" &&\n\t\t\t\ttypeof (f as { path?: unknown }).path === \"string\" &&\n\t\t\t\t(f as { path: string }).path.length > 0,\n\t\t)\n\t\t.map((f) => ({\n\t\t\tpath: String(f.path),\n\t\t\treason: String(f.reason ?? \"unknown\"),\n\t\t\t...(typeof f.source_url === \"string\" ? { sourceUrl: f.source_url } : {}),\n\t\t}));\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\tconst failures = failuresFromApiError(error);\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\t...(error.feature ? { feature: error.feature } : {}),\n\t\t\t...(error.currentPlan ? { current_plan: error.currentPlan } : {}),\n\t\t\t...(error.requiredPlan ? { required_plan: error.requiredPlan } : {}),\n\t\t\t...(error.upgradeUrl ? { upgrade_url: error.upgradeUrl } : {}),\n\t\t\t...(typeof error.limit === \"number\" ? { limit: error.limit } : {}),\n\t\t\t...(typeof error.used === \"number\" ? { used: error.used } : {}),\n\t\t\t...(typeof error.requested === \"number\"\n\t\t\t\t? { requested: error.requested }\n\t\t\t\t: {}),\n\t\t\t...(failures.length ? { failures } : {}),\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\n/**\n * Picks the next_action line for an API error. JSON mode keeps the server's\n * `suggestion` verbatim (agent contract). Human mode prefers the CLI-register\n * hint for codes the CLI has a native fallback for — server suggestions speak\n * REST, while a terminal user needs a runnable command.\n */\nexport function nextActionForApiError(\n\terror: ApiErrorDetails,\n\tmode: \"human\" | \"json\" = \"json\",\n): string {\n\tconst cliHint = cliNextAction(error);\n\t// workspace_choice_required: the server suggestion speaks the SDK/REST contract\n\t// (`options.workspace`), which is NOT a CLI surface — a CLI agent that obeys it\n\t// literally walks off a cliff. The runnable CLI command must win in BOTH modes.\n\tif (error.code === \"workspace_choice_required\" && cliHint) return cliHint;\n\tif (mode === \"human\" && cliHint) return cliHint;\n\tif (error.suggestion) return error.suggestion;\n\tif (cliHint) return cliHint;\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\n/** Slugs of the eligible workspaces a `workspace_choice_required` 409 carries in\n * its RFC 7807 `choices` field, so the CLI can name the actual targets to pick from. */\nfunction workspaceChoiceSlugs(error: ApiErrorDetails): string[] {\n\tconst body = error.body;\n\tconst raw =\n\t\tbody && typeof body === \"object\"\n\t\t\t? (body as { choices?: unknown }).choices\n\t\t\t: undefined;\n\tif (!Array.isArray(raw)) return [];\n\treturn raw\n\t\t.map((c) =>\n\t\t\tc && typeof c === \"object\" ? (c as { slug?: unknown }).slug : undefined,\n\t\t)\n\t\t.filter((s): s is string => typeof s === \"string\" && s.length > 0);\n}\n\n/** CLI-register hints for known error codes; undefined when not in the table. */\nfunction cliNextAction(error: ApiErrorDetails): string | undefined {\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 === \"workspace_choice_required\") {\n\t\tconst slugs = workspaceChoiceSlugs(error);\n\t\tconst example = slugs[0] ?? \"<slug>\";\n\t\tconst list = slugs.length ? ` Workspaces: ${slugs.join(\", \")}.` : \"\";\n\t\treturn `This account belongs to more than one workspace — pick one. Switch it for every later command with: dropthis workspace use ${example} — or target just this one with: --workspace ${example}.${list}`;\n\t}\n\tif (error.code === \"network_error\") {\n\t\treturn \"Could not reach the dropthis API — check your network or DROPTHIS_API_URL.\";\n\t}\n\tif (error.code === \"workspace_pinned\") {\n\t\treturn \"Service keys are pinned to one workspace. To switch workspaces, use a delegated login (run: dropthis login) instead of a service key.\";\n\t}\n\tif (error.code === \"workspace_selector_not_allowed\") {\n\t\treturn \"Service keys (sk_) are pinned to one workspace and cannot target another with --workspace. Use a delegated login key (run: dropthis login), or run without --workspace.\";\n\t}\n\tif (error.code === \"revision_conflict\") {\n\t\treturn \"Re-read the drop with dropthis get <drop-id>, merge your changes, and retry with --if-revision set to the current revision.\";\n\t}\n\tif (error.code === \"publish_conflict\") {\n\t\treturn \"The drop changed state mid-publish (likely deleted). Run dropthis publish again to create a fresh drop.\";\n\t}\n\tif (error.code === \"access_token_cannot_delete_account\") {\n\t\treturn \"Account deletion needs a real API key, not a login session. Create one with dropthis api-keys create, then re-run with --api-key sk_…\";\n\t}\n\t// OTP login outcomes (dropthis#80): expired codes are safe to resend; a wrong\n\t// code is not — re-check the digits, don't churn a fresh code.\n\tif (error.code === \"otp_expired\") {\n\t\treturn \"Request a fresh code with: dropthis login request --email <email>.\";\n\t}\n\tif (error.code === \"otp_invalid\") {\n\t\treturn \"Re-enter the code from your email; if it keeps failing, request a fresh one with dropthis login request --email <email>.\";\n\t}\n\tif (error.code === \"workspace_not_found\") {\n\t\treturn \"Workspace not found. List your workspaces with: dropthis workspace list\";\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.code === \"invalid_api_key\") {\n\t\treturn \"API key is invalid or revoked. Run dropthis login to re-authenticate, or set a valid DROPTHIS_API_KEY.\";\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\treturn undefined;\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\tif (code === \"verify_pending\") return 6;\n\tif (code === \"verify_timeout\") return 7;\n\treturn 1;\n}\n\n/**\n * Documented meaning of every process exit code, for the machine catalog\n * (`dropthis commands --json`). Mirrors exitCodeFor so an agent can branch on\n * the outcome — distinguishing re-auth (3) from network-retry (5) from a\n * domain still verifying (6) without parsing prose. Keep in sync with\n * exitCodeFor when adding a code.\n */\nexport const EXIT_CODES: Record<string, string> = {\n\t\"0\": \"success\",\n\t\"1\": \"api_error — the server returned an error (see the error envelope)\",\n\t\"2\": \"invalid_usage — bad arguments, bad options, or an unknown command\",\n\t\"3\": \"auth_error — missing or invalid credential; re-authenticate (dropthis login)\",\n\t\"4\": \"local_input_error — a local file or path could not be read\",\n\t\"5\": \"network_error — could not reach the API; safe to retry\",\n\t\"6\": \"verify_pending — a domain is not verified yet; retry later (domains verify)\",\n\t\"7\": \"verify_timeout — domain verification timed out while waiting (--wait)\",\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 {\n\trunDomainsConnect,\n\trunDomainsList,\n\trunDomainsRemove,\n\trunDomainsStatus,\n\trunDomainsUpdate,\n\trunDomainsVerify,\n} from \"./commands/domains.js\";\nimport {\n\trunDropsDelete,\n\trunDropsGet,\n\trunDropsList,\n\trunDropsResolve,\n} from \"./commands/drops.js\";\nimport {\n\trunInvitationsAccept,\n\trunInvitationsAcceptById,\n\trunInvitationsList,\n} from \"./commands/invitations.js\";\nimport {\n\trunLoginInteractive,\n\trunLoginRequest,\n\trunLoginVerify,\n} from \"./commands/login.js\";\nimport { runLogout } from \"./commands/logout.js\";\nimport {\n\trunMembersInvite,\n\trunMembersList,\n\trunMembersRemove,\n\trunMembersRole,\n} from \"./commands/members.js\";\nimport { runPublish } from \"./commands/publish.js\";\nimport { runPull } from \"./commands/pull.js\";\nimport { runUpdateContent } from \"./commands/update-content.js\";\nimport { runUpdateSettings } from \"./commands/update-settings.js\";\nimport { runUpgrade } from \"./commands/upgrade.js\";\nimport { runWhoami } from \"./commands/whoami.js\";\nimport {\n\trunWorkspaceCreate,\n\trunWorkspaceDelete,\n\trunWorkspaceList,\n\trunWorkspaceRename,\n\trunWorkspaceUse,\n} from \"./commands/workspace.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\";\nimport { isBareWordToken, pathExists, suggestCommand } from \"./typo-guard.js\";\nimport { CLI_VERSION } from \"./version.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.showSuggestionAfterError();\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(CLI_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\tprogram.addHelpText(\n\t\t\"after\",\n\t\t[\n\t\t\t\"\",\n\t\t\t\"Output is JSON when piped/CI/--json; human tables in a terminal.\",\n\t\t\t\"Docs: https://dropthis.app\",\n\t\t].join(\"\\n\"),\n\t);\n\n\tconst examplesBlock = (lines: string[]): string =>\n\t\t`\\n${pc.bold(\"Examples:\")}\\n${lines.map((l) => ` ${l}`).join(\"\\n\")}\\n`;\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/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(\n\t\t\t\"--domain <hostname>\",\n\t\t\t\"Serve this drop under a connected custom domain (must be live — see: dropthis domains list). Path-mode: drop lives at https://domain/{slug}/. Dedicated: drop is at the root (409 if occupied). Omit to use the account's default path domain. To publish to the shared pool instead, use --shared.\",\n\t\t)\n\t\t.option(\n\t\t\t\"--shared\",\n\t\t\t\"Deliberately publish to the shared dropthis pool, bypassing your default custom domain (an off-domain publish). Cannot combine with --domain.\",\n\t\t)\n\t\t.option(\n\t\t\t\"--slug <vanity-slug>\",\n\t\t\t\"Vanity slug for path-mode custom domains (1–63 lowercase letters/digits/hyphens). Auto-suffixed if taken. Only valid with --domain on a path-mode domain.\",\n\t\t)\n\t\t.option(\n\t\t\t\"--manifest <file>\",\n\t\t\t\"Publish a multi-file bundle defined in a JSON file (path, content/source_url/content_base64 per file). Cannot combine with a positional input.\",\n\t\t)\n\t\t.option(\n\t\t\t\"--workspace <slugOrId>\",\n\t\t\t\"Target workspace slug or id for this publish (delegated keys only; overrides server-side active workspace for this call)\",\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 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.addHelpText(\n\t\t\t\"after\",\n\t\t\texamplesBlock([\n\t\t\t\t\"dropthis publish ./report.html\",\n\t\t\t\t\"dropthis publish ./dist --title 'Launch page'\",\n\t\t\t\t\"cat report.md | dropthis publish - --content-type text/markdown --path report.md\",\n\t\t\t\t\"dropthis publish ./dist --domain reports.example.com --slug launch\",\n\t\t\t\t\"dropthis publish ./report.html --shared # bypass your default domain → shared pool\",\n\t\t\t\t\"URL=$(dropthis publish ./dist --url)\",\n\t\t\t]),\n\t\t)\n\t\t.addHelpText(\n\t\t\t\"after\",\n\t\t\t[\n\t\t\t\t`\\n${pc.bold(\"Canonical vs raw URLs:\")}`,\n\t\t\t\t\" The canonical URL (the one printed) is always a branded human view, so the\",\n\t\t\t\t\" badge is guaranteed — hand it to people. For a single non-HTML file (e.g. a\",\n\t\t\t\t\" .md or .json), publish also prints a 'Raw:' line: the raw bytes at their\",\n\t\t\t\t\" natural path, with no wrapper — hand this to other agents. HTML drops and\",\n\t\t\t\t\" multi-file collections have no raw URL (the page IS the artifact / per-file\",\n\t\t\t\t\" paths come from the manifest).\",\n\t\t\t].join(\"\\n\"),\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 && !commandOptions.manifest) {\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\t// When --manifest is given without positional args, skip stdin resolution\n\t\t\t// entirely (reading stdin would block). The manifest loading happens inside\n\t\t\t// runPublish after auth resolves.\n\t\t\tlet publishInput: string | string[] | undefined;\n\t\t\tif (inputs.length > 0 || !commandOptions.manifest) {\n\t\t\t\ttry {\n\t\t\t\t\tpublishInput = 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}\n\n\t\t\t// Typo guard: a single bare extension-less argv token that is not an\n\t\t\t// existing file and closely matches a command name is more likely a\n\t\t\t// mistyped command than inline text — `dropthis lst` must not mint a\n\t\t\t// ghost drop \"lst\". The command-match branch fires in EVERY mode:\n\t\t\t// agents run non-interactive, so this footgun-prone path was previously\n\t\t\t// the LEAST protected. A bare word that matches no command still\n\t\t\t// publishes (legit short text); only in human/TTY mode do we then\n\t\t\t// confirm before publishing such a word.\n\t\t\t//\n\t\t\t// Only the DEFAULT-command path is guarded. When the user types\n\t\t\t// `dropthis publish <text>` explicitly, the text is intentional and is\n\t\t\t// NEVER second-guessed — even when it equals a command name (so\n\t\t\t// `dropthis publish list` publishes the literal word \"list\"). `rawArgs`\n\t\t\t// holds the full argv (same source as jsonModeForOutput above).\n\t\t\tconst publishWasExplicit = (\n\t\t\t\t(program as Command & { rawArgs?: string[] }).rawArgs ?? []\n\t\t\t).includes(\"publish\");\n\t\t\tif (\n\t\t\t\t!publishWasExplicit &&\n\t\t\t\tinputs.length === 1 &&\n\t\t\t\ttypeof publishInput === \"string\" &&\n\t\t\t\tisBareWordToken(publishInput) &&\n\t\t\t\t!(await pathExists(publishInput))\n\t\t\t) {\n\t\t\t\tconst suggestion = suggestCommand(\n\t\t\t\t\tpublishInput,\n\t\t\t\t\tprogram.commands.map((c) => c.name()),\n\t\t\t\t);\n\t\t\t\tif (suggestion) {\n\t\t\t\t\tprocess.exitCode = writeError(\n\t\t\t\t\t\tdeps,\n\t\t\t\t\t\t\"invalid_usage\",\n\t\t\t\t\t\t`Unknown command '${publishInput}' — did you mean '${suggestion}'?`,\n\t\t\t\t\t\t`To publish the literal text, pipe it: echo '${publishInput}' | dropthis publish`,\n\t\t\t\t\t).exitCode;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (deps.outputMode === \"human\" && deps.interactive) {\n\t\t\t\t\tconst prompts = await import(\"@clack/prompts\");\n\t\t\t\t\tconst confirmed = await prompts.confirm({\n\t\t\t\t\t\tmessage: `Publish '${publishInput}' as inline text?`,\n\t\t\t\t\t\tinitialValue: false,\n\t\t\t\t\t});\n\t\t\t\t\tif (prompts.isCancel(confirmed) || !confirmed) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\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, 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\"--manifest <file>\",\n\t\t\t\"Update content from a multi-file bundle defined in a JSON file (path, content/source_url/content_base64 per file). Cannot combine with a positional input.\",\n\t\t)\n\t\t.option(\n\t\t\t\"--mode <mode>\",\n\t\t\t\"patch (default: provided files upsert, the rest carry forward) or replace (provided files become the whole content set)\",\n\t\t\tparseMode,\n\t\t)\n\t\t.option(\"--replace\", \"Shortcut for --mode replace (full content swap)\")\n\t\t.option(\n\t\t\t\"--delete-path <path>\",\n\t\t\t\"Remove a file by path (patch-mode only; repeatable). Invalid with --replace.\",\n\t\t\tcollect,\n\t\t\t[] as string[],\n\t\t)\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 & {\n\t\t\t\t\tifRevision?: number;\n\t\t\t\t\tmode?: \"patch\" | \"replace\";\n\t\t\t\t\treplace?: boolean;\n\t\t\t\t\tdeletePath?: string[];\n\t\t\t\t},\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\t// When --manifest is given without positional args, skip stdin resolution\n\t\t\t\t// entirely (reading stdin would block). The manifest loading happens inside\n\t\t\t\t// runUpdateContent after auth resolves.\n\t\t\t\tlet updateInput: string | string[] | undefined;\n\t\t\t\tif (inputs.length > 0 || !commandOptions.manifest) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tupdateInput = await resolvePublishInputs(\n\t\t\t\t\t\t\tinputs,\n\t\t\t\t\t\t\toptions.stdin,\n\t\t\t\t\t\t\tstdinIsTTY,\n\t\t\t\t\t\t);\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\tconst msg = err instanceof Error ? err.message : \"Invalid input.\";\n\t\t\t\t\t\tprocess.exitCode = writeError(\n\t\t\t\t\t\t\tdeps,\n\t\t\t\t\t\t\t\"local_input_error\",\n\t\t\t\t\t\t\tmsg,\n\t\t\t\t\t\t).exitCode;\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\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\t// Partial-update controls (ADR 0065): mode/replace/delete-path are\n\t\t\t\t// content-update-specific and aren't carried by toDropOptions. --replace\n\t\t\t\t// wins as mode:\"replace\"; the server enforces all validation.\n\t\t\t\tconst deletePaths = commandOptions.deletePath ?? [];\n\t\t\t\tconst updateOpts = {\n\t\t\t\t\t...dropOpts,\n\t\t\t\t\t...(commandOptions.replace\n\t\t\t\t\t\t? { mode: \"replace\" as const }\n\t\t\t\t\t\t: commandOptions.mode !== undefined\n\t\t\t\t\t\t\t? { mode: commandOptions.mode }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t...(deletePaths.length > 0 ? { deletePaths } : {}),\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\tupdateOpts,\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, 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(\"--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(\"--no-expires\", \"Clear the auto-delete expiry\")\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\"--domain <hostname>\",\n\t\t\t\"Move this drop to a connected custom domain (must be live — see: dropthis domains list).\",\n\t\t)\n\t\t.option(\n\t\t\t\"--shared\",\n\t\t\t\"Unmount this drop back to the shared dropthis pool. Cannot combine with --domain.\",\n\t\t)\n\t\t.option(\n\t\t\t\"--slug <vanity-slug>\",\n\t\t\t\"Rename the vanity slug on a path-mode custom domain (1–63 lowercase letters/digits/hyphens). 409 on conflict — does not auto-suffix.\",\n\t\t)\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(\"pull <target>\")\n\t\t.description(\n\t\t\t\"Download a drop's files into a local directory (accepts the drop_… id, the drop URL, or its slug).\\nFetches the current deployment's file manifest and writes every file. Pull, edit, then update-content to ship the changes back to the same URL — also the rollback path.\",\n\t\t)\n\t\t.option(\"-o, --output <dir>\", \"Output directory (default: ./<slug-or-id>)\")\n\t\t.option(\"--deployment <deploymentId>\", \"Download a specific deployment\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.addHelpText(\n\t\t\t\"after\",\n\t\t\texamplesBlock([\n\t\t\t\t\"dropthis pull drop_abc123 -o ./site # download the drop's files\",\n\t\t\t\t\"$EDITOR ./site/index.html # edit locally\",\n\t\t\t\t\"dropthis update-content drop_abc123 ./site # ship back to the same URL\",\n\t\t\t]),\n\t\t)\n\t\t.action(\n\t\t\tasync (\n\t\t\t\ttarget: string,\n\t\t\t\tcommandOptions: {\n\t\t\t\t\toutput?: string;\n\t\t\t\t\tdeployment?: string;\n\t\t\t\t\tjson?: boolean;\n\t\t\t\t},\n\t\t\t) => {\n\t\t\t\tconst deps = await commandDeps<Parameters<typeof runPull>[2][\"client\"]>(\n\t\t\t\t\tprogram,\n\t\t\t\t\toptions,\n\t\t\t\t\tstore,\n\t\t\t\t\tcommandOptions,\n\t\t\t\t);\n\t\t\t\tconst result = await runPull(target, commandOptions, deps);\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(\n\t\t\t\"Show drop details (accepts the drop_… id, the drop URL, or its slug)\",\n\t\t)\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(\"resolve <target>\")\n\t\t.description(\n\t\t\t\"Resolve a public drop URL or slug back to its drop_… id (accepts the id too).\\nWrites are id-only — use this to recover the id from a URL, then update-content/update-settings/delete by that id.\",\n\t\t)\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.addHelpText(\n\t\t\t\"after\",\n\t\t\texamplesBlock([\n\t\t\t\t\"dropthis resolve https://abc123.dropthis.app/ # → drop_… id + url\",\n\t\t\t\t\"dropthis resolve abc123 --json | jq -r .drop.id\",\n\t\t\t]),\n\t\t)\n\t\t.action(async (target: string, commandOptions: { json?: boolean }) => {\n\t\t\tconst deps = await commandDeps<\n\t\t\t\tParameters<typeof runDropsResolve>[2][\"client\"]\n\t\t\t>(program, options, store, commandOptions);\n\t\t\tconst result = await runDropsResolve(target, 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(\"--domain <hostname>\", \"Only drops mounted on this custom domain\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.addHelpText(\n\t\t\t\"after\",\n\t\t\texamplesBlock([\n\t\t\t\t\"dropthis list\",\n\t\t\t\t\"dropthis list --json | jq -r '.drops[] | [.id, .url] | @tsv' # recover drop ids\",\n\t\t\t\t\"dropthis list --domain reports.example.com --json # drops on a custom domain\",\n\t\t\t]),\n\t\t)\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\tdomain?: 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(\n\t\t\t\"Delete a drop (accepts the drop_… id, the drop URL, or its slug)\",\n\t\t)\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\t// --- Domains commands ---\n\n\tconst domains = program\n\t\t.command(\"domains\")\n\t\t.description(\n\t\t\t\"Manage custom domains. Loop: connect → create the CNAME at your DNS provider → verify --wait → publish --domain\",\n\t\t);\n\tdomains\n\t\t.command(\"connect <hostname>\")\n\t\t.description(\n\t\t\t\"Connect a custom domain. Returns DNS records to create at your provider.\\nAfter adding them: dropthis domains verify <hostname> --wait\",\n\t\t)\n\t\t.requiredOption(\n\t\t\t\"--mode <mode>\",\n\t\t\t\"Mount mode: path (many drops at hostname/{slug}/) or dedicated (one drop at root)\",\n\t\t)\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.addHelpText(\n\t\t\t\"after\",\n\t\t\texamplesBlock([\n\t\t\t\t\"dropthis domains connect reports.example.com --mode path\",\n\t\t\t\t\"# add the CNAME shown above at your DNS provider, then:\",\n\t\t\t\t\"dropthis domains verify reports.example.com --wait\",\n\t\t\t\t\"dropthis publish ./report.html --domain reports.example.com\",\n\t\t\t]),\n\t\t)\n\t\t.action(\n\t\t\tasync (\n\t\t\t\thostname: string,\n\t\t\t\tcommandOptions: { mode: string; json?: boolean },\n\t\t\t) => {\n\t\t\t\t// Validate --mode BEFORE commandDeps so a bad value never resolves\n\t\t\t\t// credentials / touches the keyring (codex P2). runDomainsConnect keeps\n\t\t\t\t// the same defensive check, so the envelope is identical either way.\n\t\t\t\tif (\n\t\t\t\t\tcommandOptions.mode !== \"path\" &&\n\t\t\t\t\tcommandOptions.mode !== \"dedicated\"\n\t\t\t\t) {\n\t\t\t\t\tprocess.exitCode = writeError(\n\t\t\t\t\t\toutputWriter(program, options, commandOptions),\n\t\t\t\t\t\t\"invalid_usage\",\n\t\t\t\t\t\t'--mode must be \"path\" or \"dedicated\"',\n\t\t\t\t\t).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 runDomainsConnect>[1][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst result = await runDomainsConnect(\n\t\t\t\t\t{ hostname, mode: commandOptions.mode },\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\tdomains\n\t\t.command(\"list\")\n\t\t.description(\"List connected custom domains\")\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 runDomainsList>[1][\"client\"]\n\t\t\t>(program, options, store, commandOptions);\n\t\t\tconst result = await runDomainsList(commandOptions, deps);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\tdomains\n\t\t.command(\"status <hostname>\")\n\t\t.description(\"Show domain details and DNS record status\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(async (hostname: string, commandOptions: { json?: boolean }) => {\n\t\t\tconst deps = await commandDeps<\n\t\t\t\tParameters<typeof runDomainsStatus>[2][\"client\"]\n\t\t\t>(program, options, store, commandOptions);\n\t\t\tconst result = await runDomainsStatus(hostname, commandOptions, deps);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\tdomains\n\t\t.command(\"verify <hostname>\")\n\t\t.description(\n\t\t\t\"Trigger a DNS verification check. With --wait, polls until live or failed.\\nUse after adding the DNS records from: dropthis domains connect\\n\\nExit codes (one-shot): 0=live, 1=failed, 6=still pending (retry). With --wait: 0=live, 1=failed, 7=timed out.\",\n\t\t)\n\t\t.option(\"--wait\", \"Poll until live (or failed/timeout)\")\n\t\t.option(\n\t\t\t\"--timeout <secs>\",\n\t\t\t\"Max seconds to wait (default: 300)\",\n\t\t\tparseInteger,\n\t\t)\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.addHelpText(\n\t\t\t\"after\",\n\t\t\texamplesBlock([\n\t\t\t\t\"dropthis domains verify reports.example.com --wait\",\n\t\t\t\t\"dropthis domains verify reports.example.com --wait --timeout 600\",\n\t\t\t]),\n\t\t)\n\t\t.action(\n\t\t\tasync (\n\t\t\t\thostname: string,\n\t\t\t\tcommandOptions: { wait?: boolean; timeout?: number; json?: boolean },\n\t\t\t) => {\n\t\t\t\tconst deps = await commandDeps<\n\t\t\t\t\tParameters<typeof runDomainsVerify>[2][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst result = await runDomainsVerify(hostname, commandOptions, deps);\n\t\t\t\tprocess.exitCode = result.exitCode;\n\t\t\t},\n\t\t);\n\tdomains\n\t\t.command(\"update <hostname>\")\n\t\t.description(\n\t\t\t\"Update a domain — repoint to a different drop (dedicated mode) or set/clear as account default (path mode). At least one option required.\",\n\t\t)\n\t\t.option(\"--drop <dropId>\", \"Repoint to a different drop (dedicated mode)\")\n\t\t.option(\"--default\", \"Set as account default publish domain (path mode)\")\n\t\t.option(\n\t\t\t\"--no-default\",\n\t\t\t\"Clear the account default publish domain (defaultless publishes revert to the shared pool)\",\n\t\t)\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\thostname: string,\n\t\t\t\tcommandOptions: { drop?: string; default?: boolean; json?: boolean },\n\t\t\t) => {\n\t\t\t\tconst deps = await commandDeps<\n\t\t\t\t\tParameters<typeof runDomainsUpdate>[2][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst result = await runDomainsUpdate(\n\t\t\t\t\thostname,\n\t\t\t\t\t{\n\t\t\t\t\t\t...(commandOptions.drop !== undefined\n\t\t\t\t\t\t\t? { drop: commandOptions.drop }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t...(commandOptions.default !== undefined\n\t\t\t\t\t\t\t? { setDefault: commandOptions.default }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t},\n\t\t\t\t\tdeps,\n\t\t\t\t);\n\t\t\t\tprocess.exitCode = result.exitCode;\n\t\t\t},\n\t\t);\n\tdomains\n\t\t.command(\"remove <hostname>\")\n\t\t.description(\n\t\t\t\"Remove a custom domain (unmounts its drops). IMPORTANT: also delete the DNS CNAME at your provider to prevent DNS hijacking.\",\n\t\t)\n\t\t.option(\"--yes\", \"Confirm removal\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\thostname: 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 runDomainsRemove>[2][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst result = await runDomainsRemove(\n\t\t\t\t\thostname,\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 apiKeys = program.command(\"api-keys\").description(\"Manage API keys\");\n\tapiKeys\n\t\t.command(\"create\")\n\t\t.description(\n\t\t\t\"Create an API key. Without --service, mints a delegated account-scoped key (default for login). With --service --workspace <ws>, mints a CI key pinned to that workspace.\",\n\t\t)\n\t\t.option(\"--label <label>\", \"API key label\")\n\t\t.option(\n\t\t\t\"--service\",\n\t\t\t\"Mint a pinned service key for CI/automation (requires --workspace to pin it)\",\n\t\t)\n\t\t.option(\n\t\t\t\"--workspace <slugOrId>\",\n\t\t\t\"Pin this service key to the given workspace slug or id (only valid with --service)\",\n\t\t)\n\t\t.option(\n\t\t\t\"--allowed-workspace <slugOrId>\",\n\t\t\t\"Allow a delegated key to access the given workspace slug or id\",\n\t\t\tcollect,\n\t\t\t[],\n\t\t)\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(\n\t\t\tasync (commandOptions: {\n\t\t\t\tlabel?: string;\n\t\t\t\tservice?: boolean;\n\t\t\t\tworkspace?: string;\n\t\t\t\tallowedWorkspace?: 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 runApiKeysCreate>[1][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst result = await runApiKeysCreate(\n\t\t\t\t\t{\n\t\t\t\t\t\t...(commandOptions.label !== undefined\n\t\t\t\t\t\t\t? { label: commandOptions.label }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\ttype: commandOptions.service ? \"service\" : \"delegated\",\n\t\t\t\t\t\t...(commandOptions.workspace !== undefined\n\t\t\t\t\t\t\t? { workspace: commandOptions.workspace }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t...(commandOptions.allowedWorkspace?.length\n\t\t\t\t\t\t\t? { allowedWorkspaces: commandOptions.allowedWorkspace }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t...(commandOptions.json !== undefined\n\t\t\t\t\t\t\t? { json: commandOptions.json }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t},\n\t\t\t\t\tdeps,\n\t\t\t\t);\n\t\t\t\tprocess.exitCode = result.exitCode;\n\t\t\t},\n\t\t);\n\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// --- Workspace commands ---\n\n\tconst workspace = program\n\t\t.command(\"workspace\")\n\t\t.description(\n\t\t\t\"Manage workspaces. Switch your active workspace (delegated keys only) or list all workspaces you belong to.\",\n\t\t);\n\tworkspace\n\t\t.command(\"list\", { isDefault: true })\n\t\t.description(\"List workspaces you belong to\")\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 runWorkspaceList>[1][\"client\"]\n\t\t\t>(program, options, store, commandOptions);\n\t\t\tconst result = await runWorkspaceList(commandOptions, deps);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\tworkspace\n\t\t.command(\"use <slugOrId>\")\n\t\t.description(\n\t\t\t\"Switch your active workspace (server-side, persists on the credential). Delegated keys only — pinned service keys cannot switch.\",\n\t\t)\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(async (slugOrId: string, commandOptions: { json?: boolean }) => {\n\t\t\tconst deps = await commandDeps<\n\t\t\t\tParameters<typeof runWorkspaceUse>[2][\"client\"]\n\t\t\t>(program, options, store, commandOptions);\n\t\t\tconst result = await runWorkspaceUse(slugOrId, commandOptions, deps);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\tworkspace\n\t\t.command(\"create <name>\")\n\t\t.description(\"Create a new team workspace\")\n\t\t.option(\"--slug <slug>\", \"Vanity slug for the workspace\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tname: string,\n\t\t\t\tcommandOptions: { slug?: string; json?: boolean },\n\t\t\t) => {\n\t\t\t\tconst deps = await commandDeps<\n\t\t\t\t\tParameters<typeof runWorkspaceCreate>[1][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst result = await runWorkspaceCreate(\n\t\t\t\t\t{\n\t\t\t\t\t\tname,\n\t\t\t\t\t\t...(commandOptions.slug !== undefined\n\t\t\t\t\t\t\t? { slug: commandOptions.slug }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t...(commandOptions.json !== undefined\n\t\t\t\t\t\t\t? { json: commandOptions.json }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t},\n\t\t\t\t\tdeps,\n\t\t\t\t);\n\t\t\t\tprocess.exitCode = result.exitCode;\n\t\t\t},\n\t\t);\n\tworkspace\n\t\t.command(\"rename <workspaceId>\")\n\t\t.description(\"Rename a workspace or change its vanity slug\")\n\t\t.option(\"--name <name>\", \"New workspace name\")\n\t\t.option(\"--slug <slug>\", \"New vanity slug\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tworkspaceId: string,\n\t\t\t\tcommandOptions: { name?: string; slug?: string; json?: boolean },\n\t\t\t) => {\n\t\t\t\tconst deps = await commandDeps<\n\t\t\t\t\tParameters<typeof runWorkspaceRename>[2][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst result = await runWorkspaceRename(\n\t\t\t\t\tworkspaceId,\n\t\t\t\t\t{\n\t\t\t\t\t\t...(commandOptions.name !== undefined\n\t\t\t\t\t\t\t? { name: commandOptions.name }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t...(commandOptions.slug !== undefined\n\t\t\t\t\t\t\t? { slug: commandOptions.slug }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t...(commandOptions.json !== undefined\n\t\t\t\t\t\t\t? { json: commandOptions.json }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t},\n\t\t\t\t\tdeps,\n\t\t\t\t);\n\t\t\t\tprocess.exitCode = result.exitCode;\n\t\t\t},\n\t\t);\n\tworkspace\n\t\t.command(\"delete <workspaceId>\")\n\t\t.description(\"Delete a workspace\")\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\tworkspaceId: 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 runWorkspaceDelete>[2][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst result = await runWorkspaceDelete(\n\t\t\t\t\tworkspaceId,\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// --- Members commands ---\n\n\tconst members = program.command(\"members\").description(\"Manage team members\");\n\tmembers\n\t\t.command(\"list <workspaceId>\")\n\t\t.description(\"List members of a workspace\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(async (workspaceId: string, commandOptions: { json?: boolean }) => {\n\t\t\tconst deps = await commandDeps<\n\t\t\t\tParameters<typeof runMembersList>[2][\"client\"]\n\t\t\t>(program, options, store, commandOptions);\n\t\t\tconst result = await runMembersList(workspaceId, commandOptions, deps);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\tmembers\n\t\t.command(\"invite <workspaceId>\")\n\t\t.description(\"Invite someone to a workspace by email\")\n\t\t.requiredOption(\"--email <email>\", \"Email address to invite\")\n\t\t.option(\"--role <role>\", \"Role to grant (admin or member)\", \"member\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tworkspaceId: string,\n\t\t\t\tcommandOptions: {\n\t\t\t\t\temail: string;\n\t\t\t\t\trole?: \"admin\" | \"member\";\n\t\t\t\t\tjson?: boolean;\n\t\t\t\t},\n\t\t\t) => {\n\t\t\t\tconst deps = await commandDeps<\n\t\t\t\t\tParameters<typeof runMembersInvite>[2][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst result = await runMembersInvite(\n\t\t\t\t\tworkspaceId,\n\t\t\t\t\t{\n\t\t\t\t\t\temail: commandOptions.email,\n\t\t\t\t\t\t...(commandOptions.role !== undefined\n\t\t\t\t\t\t\t? { role: commandOptions.role }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t...(commandOptions.json !== undefined\n\t\t\t\t\t\t\t? { json: commandOptions.json }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t},\n\t\t\t\t\tdeps,\n\t\t\t\t);\n\t\t\t\tprocess.exitCode = result.exitCode;\n\t\t\t},\n\t\t);\n\tmembers\n\t\t.command(\"role <workspaceId> <accountId>\")\n\t\t.description(\"Change a member's role\")\n\t\t.requiredOption(\"--role <role>\", \"New role (owner, admin, or member)\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tworkspaceId: string,\n\t\t\t\taccountId: string,\n\t\t\t\tcommandOptions: {\n\t\t\t\t\trole: \"owner\" | \"admin\" | \"member\";\n\t\t\t\t\tjson?: boolean;\n\t\t\t\t},\n\t\t\t) => {\n\t\t\t\tconst deps = await commandDeps<\n\t\t\t\t\tParameters<typeof runMembersRole>[3][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst result = await runMembersRole(\n\t\t\t\t\tworkspaceId,\n\t\t\t\t\taccountId,\n\t\t\t\t\t{\n\t\t\t\t\t\trole: commandOptions.role,\n\t\t\t\t\t\t...(commandOptions.json !== undefined\n\t\t\t\t\t\t\t? { json: commandOptions.json }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t},\n\t\t\t\t\tdeps,\n\t\t\t\t);\n\t\t\t\tprocess.exitCode = result.exitCode;\n\t\t\t},\n\t\t);\n\tmembers\n\t\t.command(\"remove <workspaceId> <accountId>\")\n\t\t.description(\"Remove a member from a workspace\")\n\t\t.option(\"--yes\", \"Confirm removal\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tworkspaceId: string,\n\t\t\t\taccountId: 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 runMembersRemove>[3][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst result = await runMembersRemove(\n\t\t\t\t\tworkspaceId,\n\t\t\t\t\taccountId,\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// --- Invitations commands ---\n\n\tconst invitations = program\n\t\t.command(\"invitations\")\n\t\t.description(\"Manage your workspace invitations\");\n\tinvitations\n\t\t.command(\"list\", { isDefault: true })\n\t\t.description(\"List your pending workspace invitations\")\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 runInvitationsList>[1][\"client\"]\n\t\t\t>(program, options, store, commandOptions);\n\t\t\tconst result = await runInvitationsList(commandOptions, deps);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\tinvitations\n\t\t.command(\"accept\")\n\t\t.description(\"Accept a workspace invitation by token\")\n\t\t.requiredOption(\"--token <token>\", \"Invitation token\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(async (commandOptions: { token: string; json?: boolean }) => {\n\t\t\tconst deps = await commandDeps<\n\t\t\t\tParameters<typeof runInvitationsAccept>[1][\"client\"]\n\t\t\t>(program, options, store, commandOptions);\n\t\t\tconst result = await runInvitationsAccept(commandOptions, deps);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\tinvitations\n\t\t.command(\"accept-by-id <invitationId>\")\n\t\t.description(\"Accept a workspace invitation by its id\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(\n\t\t\tasync (invitationId: string, commandOptions: { json?: boolean }) => {\n\t\t\t\tconst deps = await commandDeps<\n\t\t\t\t\tParameters<typeof runInvitationsAcceptById>[1][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst result = await runInvitationsAcceptById(\n\t\t\t\t\t{\n\t\t\t\t\t\tinvitationId,\n\t\t\t\t\t\t...(commandOptions.json !== undefined\n\t\t\t\t\t\t\t? { json: commandOptions.json }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t},\n\t\t\t\t\tdeps,\n\t\t\t\t);\n\t\t\t\tprocess.exitCode = result.exitCode;\n\t\t\t},\n\t\t);\n\n\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(\n\t\t\t\"--scope <scope>\",\n\t\t\t\"Capability scope to request for the minted key (e.g. team)\",\n\t\t)\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\tscope?: 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 stdinIsTTY = options.stdinIsTTY ?? process.stdin.isTTY ?? false;\n\t\t\t\t\tif (!isInteractive(stdinIsTTY, deps.env, global)) {\n\t\t\t\t\t\t// Fail fast instead of hanging on a prompt that can never answer.\n\t\t\t\t\t\tprocess.exitCode = writeError(\n\t\t\t\t\t\t\tdeps,\n\t\t\t\t\t\t\t\"invalid_usage\",\n\t\t\t\t\t\t\t\"dropthis login is interactive and needs a terminal.\",\n\t\t\t\t\t\t\t\"Set DROPTHIS_API_KEY, or run: dropthis login request --email <email>, then dropthis login verify --email <email> --otp <code>.\",\n\t\t\t\t\t\t).exitCode;\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\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\t...(commandOptions.scope ? { scope: commandOptions.scope } : {}),\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.scope ? { scope: commandOptions.scope } : {}),\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(\n\t\t\t\"--scope <scope>\",\n\t\t\t\"Capability scope to request for the minted key (e.g. team)\",\n\t\t)\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\tscope?: 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.option(\"--display-name <name>\", \"Set the display name\")\n\t\t.option(\"--clear-display-name\", \"Clear the display name\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(\n\t\t\tasync (commandOptions: {\n\t\t\t\tdisplayName?: string;\n\t\t\t\tclearDisplayName?: boolean;\n\t\t\t\tjson?: boolean;\n\t\t\t}) => {\n\t\t\t\tif (\n\t\t\t\t\t(commandOptions.displayName === undefined &&\n\t\t\t\t\t\t!commandOptions.clearDisplayName) ||\n\t\t\t\t\t(commandOptions.displayName !== undefined &&\n\t\t\t\t\t\tcommandOptions.clearDisplayName)\n\t\t\t\t) {\n\t\t\t\t\tconst writer = outputWriter(program, options, commandOptions);\n\t\t\t\t\tprocess.exitCode = writeError(\n\t\t\t\t\t\twriter,\n\t\t\t\t\t\t\"invalid_usage\",\n\t\t\t\t\t\t\"Use either --display-name <name> or --clear-display-name.\",\n\t\t\t\t\t).exitCode;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst displayName = commandOptions.clearDisplayName\n\t\t\t\t\t? null\n\t\t\t\t\t: commandOptions.displayName;\n\t\t\t\tif (displayName === undefined) return;\n\t\t\t\tconst deps = await commandDeps<\n\t\t\t\t\tParameters<typeof runAccountUpdate>[1][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst result = await runAccountUpdate(\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName,\n\t\t\t\t\t\t...(commandOptions.json !== undefined\n\t\t\t\t\t\t\t? { json: commandOptions.json }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t},\n\t\t\t\t\tdeps,\n\t\t\t\t);\n\t\t\t\tprocess.exitCode = result.exitCode;\n\t\t\t},\n\t\t);\n\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.option(\n\t\t\t\"--online\",\n\t\t\t\"Run a network preflight (auth + active workspace + custom-domain status) — exits 3 on auth failure, 5 on a network failure\",\n\t\t)\n\t\t.action(async (commandOptions: { json?: boolean; online?: boolean }) => {\n\t\t\tconst deps = await commandDeps<Parameters<typeof runDoctor>[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 runDoctor(commandOptions, deps);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\n\tprogram\n\t\t.command(\"upgrade\")\n\t\t.description(\"Update the CLI to the latest version from npm\")\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 runUpgrade(commandOptions, {\n\t\t\t\t...deps,\n\t\t\t\tcurrentVersion: CLI_VERSION,\n\t\t\t});\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\texpires?: boolean;\n\tworkspace?: string;\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\n/**\n * Build a credential-free writer ({stdout, stderr, outputMode}) from the output\n * context. Use for usage validation that must reject a bad flag BEFORE\n * commandDeps resolves credentials — so an invalid argument never touches the\n * credential store (keyring) and a user with a locked store still gets the\n * usage error, not a storage failure.\n */\nfunction outputWriter(\n\tprogram: Command,\n\toptions: BuildProgramOptions,\n\tcommandOptions: { json?: boolean; quiet?: boolean },\n): {\n\tstdout: (value: string) => void;\n\tstderr: (value: string) => void;\n\toutputMode: \"human\" | \"json\";\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\treturn {\n\t\tstdout: context.stdout,\n\t\tstderr: context.stderr,\n\t\toutputMode: context.output.mode,\n\t};\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.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.expires === false || options.noExpires\n\t\t\t? { noExpires: true }\n\t\t\t: {}),\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.domain ? { domain: options.domain } : {}),\n\t\t...(options.shared ? { shared: true } : {}),\n\t\t...(options.slug ? { slug: options.slug } : {}),\n\t\t...(options.manifest ? { manifest: options.manifest } : {}),\n\t\t...(options.workspace ? { workspace: options.workspace } : {}),\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\nfunction parseMode(value: string): \"patch\" | \"replace\" {\n\tif (value !== \"patch\" && value !== \"replace\") {\n\t\tthrow new InvalidArgumentError('Use \"patch\" or \"replace\".');\n\t}\n\treturn value;\n}\n\n/** Accumulator for repeatable options (e.g. --delete-path). */\nfunction collect(value: string, previous: string[]): string[] {\n\treturn [...previous, value];\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\tscopes?: 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\t...(stored.scopes?.length ? { scopes: stored.scopes } : {}),\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\tfailuresFromApiError,\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\t// Single non-HTML drops (file_viewer) expose a raw-bytes URL: the canonical\n\t\t// URL serves the branded human view (badge guaranteed), rawUrl serves the\n\t\t// exact bytes at their natural path — the path to hand other agents (ADR 0061).\n\t\t// null for HTML drops (the page IS the artifact) and collections.\n\t\tconst rawUrl = data.rawUrl;\n\t\tif (typeof rawUrl === \"string\" && rawUrl.length > 0) {\n\t\t\tdeps.stdout(`${hint(`Raw: ${url(rawUrl)}`)}\\n`);\n\t\t}\n\t\t// Surface server warnings: slug_suffixed gets a tailored line, anything\n\t\t// else renders dim as-is (JSON mode already carries all warnings).\n\t\tconst warnings = data.warnings as\n\t\t\t| Array<Record<string, unknown>>\n\t\t\t| undefined;\n\t\tif (Array.isArray(warnings)) {\n\t\t\tfor (const w of warnings) {\n\t\t\t\tif (w.code === \"slug_suffixed\") {\n\t\t\t\t\tdeps.stderr(\n\t\t\t\t\t\t`${hint(`Vanity slug was taken — served at: ${w.detail ?? \"see URL\"}`)}\\n`,\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tconst text =\n\t\t\t\t\t\ttypeof w.detail === \"string\"\n\t\t\t\t\t\t\t? w.detail\n\t\t\t\t\t\t\t: typeof w.message === \"string\"\n\t\t\t\t\t\t\t\t? w.message\n\t\t\t\t\t\t\t\t: typeof w.code === \"string\"\n\t\t\t\t\t\t\t\t\t? w.code\n\t\t\t\t\t\t\t\t\t: undefined;\n\t\t\t\t\tif (text) deps.stderr(`${hint(text)}\\n`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\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\t// Name the team a drop landed in so multi-workspace users see *where* it went\n\t// — every other surface (console, extension, MCP) echoes this. A solo/personal\n\t// workspace is the implicit default, so we skip it to keep the common case quiet.\n\t// JSON mode always carries the full workspace object regardless.\n\tconst ws = data.workspace as { name?: unknown; kind?: unknown } | undefined;\n\tif (ws && ws.kind === \"team\" && typeof ws.name === \"string\") {\n\t\tparts.push(`team: ${ws.name}`);\n\t}\n\tif (parts.length === 0) return \"\";\n\treturn ` ${pc.dim(parts.join(\" · \"))}`;\n}\n\n/** Trims an ISO timestamp to its date part for human output. */\nexport function formatDate(iso: string): string {\n\treturn iso.split(\"T\")[0] ?? iso;\n}\n\n/** Trims an ISO timestamp to \"YYYY-MM-DD HH:MM\" for human output. */\nexport function formatDateTime(iso: string): string {\n\tconst match = iso.match(/^(\\d{4}-\\d{2}-\\d{2})T(\\d{2}:\\d{2})/);\n\treturn match ? `${match[1]} ${match[2]}` : iso;\n}\n\nexport function formatBytes(bytes: number): string {\n\tif (bytes < 1024) return `${bytes} B`;\n\tif (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;\n\tif (bytes < 1024 * 1024 * 1024)\n\t\treturn `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n\treturn `${(bytes / (1024 * 1024 * 1024)).toFixed(1)} GB`;\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 failures = failuresFromApiError(details);\n\t\tfor (const f of failures) {\n\t\t\tdeps.stderr(` ${f.path}: ${f.reason}\\n`);\n\t\t}\n\t\t// Plan gates name the wall plainly: current → required tier (no retry hint —\n\t\t// the server marks these retryable:false; re-running can never succeed).\n\t\tif (\n\t\t\tdetails.code === \"feature_not_in_plan\" ||\n\t\t\tdetails.code === \"quota_exceeded\"\n\t\t) {\n\t\t\tif (details.currentPlan && details.requiredPlan) {\n\t\t\t\tdeps.stderr(\n\t\t\t\t\t`${hint(`Plan: ${details.currentPlan} → needs ${details.requiredPlan}`)}\\n`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tconst nextAction = nextActionForApiError(details, \"human\");\n\t\tif (nextAction) deps.stderr(`${hint(nextAction)}\\n`);\n\t\t// 409 revision conflicts carry the drop's current revision — name the CLI\n\t\t// flag so the retry path is copy-pasteable from the terminal.\n\t\tif (details.currentRevision !== undefined)\n\t\t\tdeps.stderr(\n\t\t\t\t`${hint(`Current revision: ${details.currentRevision} — retry with --if-revision ${details.currentRevision}`)}\\n`,\n\t\t\t);\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(cliErrorCodeFor(details)) };\n}\n\n/**\n * Maps SDK-side error codes onto the CLI exit-code contract: transport\n * failures are network errors (5), and the SDK's local file_not_found\n * (\"No file or directory at …\") is a local input error (4), not an API error.\n */\nexport function cliErrorCodeFor(details: ApiErrorDetails): CliErrorCode {\n\tif (details.code === \"network_error\") return \"network_error\";\n\tif (details.code === \"file_not_found\") return \"local_input_error\";\n\t// \"Authenticate\" is one scriptable signal: a server-side 401 must exit 3\n\t// (auth_error) just like the local \"no API key\" path, so an agent/CI script\n\t// can key off exit 3 = re-auth regardless of where the gap was caught.\n\tif (\n\t\tdetails.statusCode === 401 ||\n\t\tdetails.code === \"authentication_required\" ||\n\t\tdetails.code === \"missing_api_key\"\n\t) {\n\t\treturn \"auth_error\";\n\t}\n\treturn \"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\tformatBytes,\n\twriteApiError,\n\twriteAuthError,\n\twriteError,\n\twriteHumanOrJson,\n\twriteKv,\n} from \"../fmt.js\";\nimport type { CommandDeps, SdkResult } from \"../types.js\";\nimport { hint, 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\tconst ws = data?.workspace as Record<string, unknown> | undefined;\n\tif (ws?.name) {\n\t\tconst role = ws.role ? ` · your role: ${String(ws.role)}` : \"\";\n\t\tpairs.push([\"Workspace\", `${String(ws.name)} (${String(ws.kind)})${role}`]);\n\t}\n\n\tconst usage = data?.usage as Record<string, unknown> | undefined;\n\tconst entitlements = data?.entitlements as\n\t\t| Record<string, unknown>\n\t\t| undefined;\n\tconst limits = entitlements?.limits as Record<string, unknown> | undefined;\n\n\tif (typeof usage?.storageUsedBytes === \"number\") {\n\t\tif (typeof limits?.maxStorageBytes === \"number\") {\n\t\t\tpairs.push([\n\t\t\t\t\"Storage\",\n\t\t\t\t`${formatBytes(usage.storageUsedBytes)} of ${formatBytes(limits.maxStorageBytes)}`,\n\t\t\t]);\n\t\t} else {\n\t\t\tpairs.push([\"Storage\", formatBytes(usage.storageUsedBytes)]);\n\t\t}\n\t}\n\n\tif (\n\t\ttypeof usage?.customDomainsUsed === \"number\" &&\n\t\ttypeof limits?.maxCustomHostnames === \"number\"\n\t) {\n\t\tpairs.push([\n\t\t\t\"Domains\",\n\t\t\t`${usage.customDomainsUsed} of ${limits.maxCustomHostnames}`,\n\t\t]);\n\t}\n\n\tif (\n\t\ttypeof usage?.seatsUsed === \"number\" &&\n\t\ttypeof limits?.seatLimit === \"number\"\n\t) {\n\t\tpairs.push([\"Seats\", `${usage.seatsUsed} of ${limits.seatLimit}`]);\n\t}\n\n\twriteKv(deps, pairs, { ok: true, account: result.data });\n\n\tif (typeof data?.upgradeUrl === \"string\") {\n\t\tdeps.stderr(`${hint(`Upgrade: ${data.upgradeUrl}`)}\\n`);\n\t}\n\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 { hint, success } from \"../ui.js\";\n\ntype ApiKeysCreateClient = {\n\tapiKeys: {\n\t\tcreate(input: {\n\t\t\tlabel: string;\n\t\t\ttype: \"delegated\" | \"service\";\n\t\t\tworkspace?: string;\n\t\t\tallowedWorkspaces?: 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\n// DELETE /v1/api-keys/{id} returns 204 No Content; the SDK types it\n// DropthisResult<null>. Success is `error === null` — never read result.data.\ntype ApiKeysDeleteClient = {\n\tapiKeys: {\n\t\tdelete(\n\t\t\tkeyId: string,\n\t\t): Promise<SdkResult<null>> | SdkResult<null> | undefined;\n\t};\n};\n\nexport async function runApiKeysCreate(\n\tinput: {\n\t\tlabel?: string;\n\t\ttype?: \"delegated\" | \"service\";\n\t\tworkspace?: string;\n\t\tallowedWorkspaces?: string[];\n\t\tjson?: boolean;\n\t},\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\n\tconst keyType = input.type ?? \"delegated\";\n\n\t// --workspace pins a SERVICE key to a chosen workspace; it is meaningless for a\n\t// delegated key (account-scoped, switchable). Reject the combination loudly rather\n\t// than silently minting a broader account-scoped key than the user intended.\n\tif (input.workspace && keyType !== \"service\") {\n\t\treturn writeError(\n\t\t\tdeps,\n\t\t\t\"invalid_usage\",\n\t\t\t\"--workspace is only valid with --service (it pins a CI service key to one workspace). A delegated login key is account-scoped and switchable — use `dropthis workspace use <slug>` to change its active workspace.\",\n\t\t);\n\t}\n\n\tif (input.allowedWorkspaces?.length && keyType === \"service\") {\n\t\treturn writeError(\n\t\t\tdeps,\n\t\t\t\"invalid_usage\",\n\t\t\t\"--allowed-workspace is only valid for delegated keys; do not combine it with --service.\",\n\t\t);\n\t}\n\n\t// A SERVICE key is for CI/automation and is pinned to ONE workspace for its whole life;\n\t// make the target explicit so a CI key is never accidentally pinned to the wrong (e.g.\n\t// personal) workspace just because that happened to be active.\n\tif (keyType === \"service\" && !input.workspace) {\n\t\treturn writeError(\n\t\t\tdeps,\n\t\t\t\"invalid_usage\",\n\t\t\t\"Service keys must be pinned to a workspace.\",\n\t\t\t\"Run: dropthis workspace list to see slugs, then: dropthis api-keys create --service --workspace <slug>\",\n\t\t);\n\t}\n\n\tconst label =\n\t\tinput.label ??\n\t\t(keyType === \"service\"\n\t\t\t? `Service key${input.workspace ? ` (${input.workspace})` : \"\"}`\n\t\t\t: \"CLI key\");\n\n\tconst createInput: {\n\t\tlabel: string;\n\t\ttype: \"delegated\" | \"service\";\n\t\tworkspace?: string;\n\t\tallowedWorkspaces?: string[];\n\t} = {\n\t\tlabel,\n\t\ttype: keyType,\n\t};\n\tif (keyType === \"service\" && input.workspace) {\n\t\tcreateInput.workspace = input.workspace;\n\t}\n\tif (input.allowedWorkspaces?.length) {\n\t\tcreateInput.allowedWorkspaces = input.allowedWorkspaces;\n\t}\n\n\tconst result = await deps.client.apiKeys.create(createInput);\n\tif (result.error) return writeApiError(deps, result.error);\n\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\tif (data.label) pairs.push([\"Label\", String(data.label)]);\n\n\twriteKv(deps, pairs, { ok: true, api_key: result.data });\n\n\t// Warn (human mode only) that the key is shown once. In JSON/CI mode we MUST keep\n\t// stderr clean so `... --json 2>&1 | jq` parses — the JSON envelope already carries\n\t// the raw key, which is self-evidently the only time it is returned.\n\tif (deps.outputMode === \"human\") {\n\t\tdeps.stderr(\n\t\t\t`${hint(\"Store this key now — it will not be shown again.\")}\\n`,\n\t\t);\n\t}\n\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\n/**\n * Pulls cursor pagination off a list wrapper (SDK CursorPage or raw wire\n * shape). Returns undefined when the shape does not paginate, so callers can\n * leave non-paginated envelopes untouched.\n */\nexport function extractPagination(\n\tdata: unknown,\n): { nextCursor: string | null; hasMore: boolean } | undefined {\n\tif (!data || typeof data !== \"object\") return undefined;\n\tconst rec = data as Record<string, unknown>;\n\tif (!(\"nextCursor\" in rec) && !(\"hasMore\" in rec)) return undefined;\n\tconst nextCursor = typeof rec.nextCursor === \"string\" ? rec.nextCursor : null;\n\tconst hasMore =\n\t\ttypeof rec.hasMore === \"boolean\" ? rec.hasMore : nextCursor !== null;\n\treturn { nextCursor, hasMore };\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\t\"dropthis publish ./report.html --workspace acme --json # target a specific workspace (delegated keys only)\",\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\tpull: {\n\t\tauth: \"required\",\n\t\texamples: [\n\t\t\t\"dropthis pull drop_abc -o ./site\",\n\t\t\t\"dropthis pull https://abc123.dropthis.app\",\n\t\t],\n\t},\n\tget: {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis get drop_abc --json\"],\n\t},\n\tresolve: {\n\t\tauth: \"required\",\n\t\texamples: [\n\t\t\t\"dropthis resolve https://abc123.dropthis.app/\",\n\t\t\t\"dropthis resolve abc123 --json\",\n\t\t],\n\t},\n\tlist: {\n\t\tauth: \"required\",\n\t\texamples: [\n\t\t\t\"dropthis list --json\",\n\t\t\t\"dropthis list --domain reports.example.com --json\",\n\t\t],\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 list 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\tdomains: {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis domains list --json\"],\n\t},\n\t\"domains connect\": {\n\t\tauth: \"required\",\n\t\texamples: [\n\t\t\t\"dropthis domains connect reports.example.com --mode path --json\",\n\t\t],\n\t},\n\t\"domains list\": {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis domains list --json\"],\n\t},\n\t\"domains status\": {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis domains status reports.example.com --json\"],\n\t},\n\t\"domains verify\": {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis domains verify reports.example.com --wait --json\"],\n\t},\n\t\"domains update\": {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis domains update reports.example.com --default --json\"],\n\t},\n\t\"domains remove\": {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis domains remove reports.example.com --yes --json\"],\n\t},\n\t\"api-keys\": {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis api-keys create --label CI --json\"],\n\t},\n\t\"api-keys create\": {\n\t\tauth: \"required\",\n\t\texamples: [\n\t\t\t\"dropthis api-keys create --label CI --json\",\n\t\t\t\"dropthis api-keys create --service --workspace acme --json\",\n\t\t],\n\t},\n\t\"api-keys list\": {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis api-keys list --json\"],\n\t},\n\t\"api-keys delete\": {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis api-keys delete key_abc --yes --json\"],\n\t},\n\tworkspace: {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis workspace list --json\", \"dropthis workspace use acme\"],\n\t},\n\t\"workspace list\": {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis workspace list --json\"],\n\t},\n\t\"workspace use\": {\n\t\tauth: \"required\",\n\t\texamples: [\n\t\t\t\"dropthis workspace use acme\",\n\t\t\t\"dropthis workspace use ws_team123\",\n\t\t],\n\t},\n\tlogin: {\n\t\texamples: [\n\t\t\t\"dropthis login\",\n\t\t\t\"dropthis login request --email user@example.com --json\",\n\t\t\t\"dropthis login verify --email user@example.com --otp 123456 --json\",\n\t\t],\n\t},\n\t\"login request\": {\n\t\texamples: [\"dropthis login request --email user@example.com --json\"],\n\t},\n\t\"login verify\": {\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: {\n\t\texamples: [\"dropthis doctor --json\", \"dropthis doctor --online --json\"],\n\t},\n\tupgrade: { examples: [\"dropthis upgrade\", \"dropthis upgrade --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\nexport type GlobalOption = { flags: string; description: string };\n\n/**\n * The program-level flags (--api-key, --api-url, --json, --quiet,\n * --no-interactive) an agent can pass to ANY command. Generated from the live\n * program so it cannot drift from what Commander actually accepts.\n */\nexport function buildGlobalOptions(program: Command): GlobalOption[] {\n\treturn program.options.map((o) => ({\n\t\tflags: o.flags,\n\t\tdescription: o.description,\n\t}));\n}\n","import type { Command } from \"commander\";\nimport { buildCatalog, buildGlobalOptions } from \"../catalog.js\";\nimport { EXIT_CODES } from \"../output.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\tglobal_options: buildGlobalOptions(deps.program),\n\t\t\texit_codes: EXIT_CODES,\n\t\t})}\\n`,\n\t);\n\treturn { exitCode: 0 };\n}\n","import { requireCredential } from \"../auth.js\";\nimport {\n\tformatDateTime,\n\twriteApiError,\n\twriteAuthError,\n\twriteEmpty,\n\twriteJson,\n\twriteKv,\n} from \"../fmt.js\";\nimport {\n\ttype CommandDeps,\n\textractPagination,\n\ttype SdkResult,\n} from \"../types.js\";\nimport { hint } from \"../ui.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 page = extractPagination(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\tconst created =\n\t\t\t\t\ttypeof item.createdAt === \"string\"\n\t\t\t\t\t\t? formatDateTime(item.createdAt)\n\t\t\t\t\t\t: \"\";\n\t\t\t\tdeps.stdout(\n\t\t\t\t\t`${item.id ?? \"\"} rev ${item.revision ?? \"?\"} ${created}\\n`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (page?.hasMore && page.nextCursor) {\n\t\t\t\tdeps.stdout(\n\t\t\t\t\t`${hint(`More deployments: dropthis deployments list ${dropId} --cursor ${page.nextCursor}`)}\\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, {\n\t\t\tok: true,\n\t\t\t...spread,\n\t\t\t...(page ? { next_cursor: page.nextCursor, has_more: page.hasMore } : {}),\n\t\t});\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)\n\t\tpairs.push([\"Created\", formatDateTime(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","// `PKG_VERSION` is a tsup build-time define (inlined as a string literal in the\n// built bundle). Under `tsx`/dev mode (`npm run dev`, the `make smoke/local`\n// harness) it is never defined; `typeof` on an undeclared identifier is safe and\n// does not throw. Centralize the guard so every runtime read works in both modes.\nexport const CLI_VERSION: string =\n\ttypeof PKG_VERSION === \"string\" ? PKG_VERSION : \"0.0.0-dev\";\n","import { resolveCredential } from \"../auth.js\";\nimport { cliErrorCodeFor, writeKv } from \"../fmt.js\";\nimport { type ApiErrorDetails, exitCodeFor } from \"../output.js\";\nimport type { CredentialStore } from \"../storage.js\";\nimport type { SdkResult } from \"../types.js\";\nimport { CLI_VERSION } from \"../version.js\";\n\ntype DoctorClient = {\n\taccount: { get(): Promise<SdkResult<unknown>> };\n\tdomains: { list(): Promise<SdkResult<unknown>> };\n};\n\ntype CommandDeps = {\n\tstore: CredentialStore;\n\tclient: DoctorClient;\n\tenv: Record<string, string | undefined>;\n\tstdout: (value: string) => void;\n\tstderr: (value: string) => void;\n\toutputMode?: \"human\" | \"json\";\n};\n\ntype Check = { name: string; status: \"ok\" | \"warn\" | \"fail\"; detail: string };\n\n/**\n * The online preflight: an agent runs `dropthis doctor --online` BEFORE a\n * publish to tell apart the recurring failure modes — re-auth (exit 3) vs a\n * network blip (exit 5) vs an unresolved workspace — instead of flailing on a\n * failed publish. Pure composition over GET /v1/account + GET /v1/domains.\n */\nasync function onlineChecks(\n\tdeps: CommandDeps,\n\thasCredential: boolean,\n): Promise<{ checks: Check[]; exitCode: number }> {\n\tif (!hasCredential) {\n\t\treturn {\n\t\t\tchecks: [\n\t\t\t\t{\n\t\t\t\t\tname: \"auth\",\n\t\t\t\t\tstatus: \"fail\",\n\t\t\t\t\tdetail:\n\t\t\t\t\t\t\"No credential found — run `dropthis login` or set DROPTHIS_API_KEY.\",\n\t\t\t\t},\n\t\t\t],\n\t\t\texitCode: exitCodeFor(\"auth_error\"),\n\t\t};\n\t}\n\n\tconst account = await deps.client.account.get();\n\tif (account.error) {\n\t\tconst code = cliErrorCodeFor(account.error as ApiErrorDetails);\n\t\tconst isAuth = code === \"auth_error\";\n\t\treturn {\n\t\t\tchecks: [\n\t\t\t\t{\n\t\t\t\t\tname: \"api_reachable\",\n\t\t\t\t\tstatus: isAuth ? \"ok\" : \"fail\",\n\t\t\t\t\tdetail: isAuth\n\t\t\t\t\t\t? \"reached the API\"\n\t\t\t\t\t\t: `could not reach the API: ${account.error.message}`,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: \"auth\",\n\t\t\t\t\tstatus: isAuth ? \"fail\" : \"warn\",\n\t\t\t\t\tdetail: isAuth\n\t\t\t\t\t\t? \"credential rejected — re-authenticate with `dropthis login`\"\n\t\t\t\t\t\t: account.error.message,\n\t\t\t\t},\n\t\t\t],\n\t\t\texitCode: exitCodeFor(code),\n\t\t};\n\t}\n\n\tconst data = account.data as Record<string, unknown> | null;\n\tconst checks: Check[] = [\n\t\t{ name: \"api_reachable\", status: \"ok\", detail: \"reached the API\" },\n\t\t{ name: \"auth\", status: \"ok\", detail: \"credential accepted\" },\n\t];\n\tconst ws = data?.workspace as Record<string, unknown> | undefined;\n\tchecks.push(\n\t\tws?.name\n\t\t\t? {\n\t\t\t\t\tname: \"workspace\",\n\t\t\t\t\tstatus: \"ok\",\n\t\t\t\t\tdetail: `active: ${String(ws.name)} (${String(ws.kind)})`,\n\t\t\t\t}\n\t\t\t: {\n\t\t\t\t\tname: \"workspace\",\n\t\t\t\t\tstatus: \"warn\",\n\t\t\t\t\tdetail:\n\t\t\t\t\t\t\"no active workspace resolved — pass --workspace or run `dropthis workspace use`\",\n\t\t\t\t},\n\t);\n\tif (data?.plan) {\n\t\tchecks.push({ name: \"plan\", status: \"ok\", detail: String(data.plan) });\n\t}\n\n\t// Custom-domain verification status (best-effort; a read error here doesn't fail the preflight).\n\tconst domains = await deps.client.domains.list();\n\tif (!domains.error) {\n\t\tconst list =\n\t\t\t((domains.data as Record<string, unknown> | null)?.domains as\n\t\t\t\t| Array<Record<string, unknown>>\n\t\t\t\t| undefined) ?? [];\n\t\tconst live = list.filter((d) => d.status === \"live\").length;\n\t\tconst pending = list.length - live;\n\t\tchecks.push({\n\t\t\tname: \"domains\",\n\t\t\tstatus: pending > 0 ? \"warn\" : \"ok\",\n\t\t\tdetail: `${list.length} connected, ${live} live${\n\t\t\t\tpending > 0 ? `, ${pending} pending verification` : \"\"\n\t\t\t}`,\n\t\t});\n\t}\n\n\treturn { checks, exitCode: 0 };\n}\n\nexport async function runDoctor(\n\tinput: { json?: boolean; online?: 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\", CLI_VERSION],\n\t\t[\"Auth\", authSource],\n\t\t[\"Storage\", storageBackend],\n\t];\n\n\tif (!input.online) {\n\t\twriteKv(deps, pairs, {\n\t\t\tok: true,\n\t\t\tversion: CLI_VERSION,\n\t\t\tauth: { source: authSource },\n\t\t\tstorage: { backend: storageBackend },\n\t\t});\n\t\treturn { exitCode: 0 };\n\t}\n\n\tconst { checks, exitCode } = await onlineChecks(\n\t\tdeps,\n\t\tcredential !== undefined,\n\t);\n\tfor (const c of checks) {\n\t\tpairs.push([c.name, `${c.status} — ${c.detail}`]);\n\t}\n\twriteKv(deps, pairs, {\n\t\tok: exitCode === 0,\n\t\tversion: CLI_VERSION,\n\t\tauth: { source: authSource },\n\t\tstorage: { backend: storageBackend },\n\t\tchecks,\n\t});\n\treturn { exitCode };\n}\n","import * as prompts from \"@clack/prompts\";\nimport pc from \"picocolors\";\nimport { requireCredential } from \"../auth.js\";\nimport {\n\tformatDate,\n\twriteApiError,\n\twriteAuthError,\n\twriteEmpty,\n\twriteError,\n\twriteHumanOrJson,\n\twriteJson,\n} from \"../fmt.js\";\nimport { errorEnvelope } from \"../output.js\";\nimport type { CommandDeps, SdkResult } from \"../types.js\";\nimport { hint, success, warn } from \"../ui.js\";\n\n// ---------------------------------------------------------------------------\n// Client types (structural — the actual SDK class satisfies these)\n// ---------------------------------------------------------------------------\n\ntype DnsRecord = {\n\tpurpose: string;\n\ttype: string;\n\tname: string;\n\tvalue: string;\n\tstatus: \"missing\" | \"ok\" | \"mismatch\";\n\tobserved?: string | null;\n\thint?: string | null;\n\tretryAfter?: number | null;\n};\n\ntype NextHint = {\n\taction: string;\n\tmessage: string;\n};\n\ntype DomainResponse = {\n\tobject: \"domain\";\n\tid: string;\n\thostname: string;\n\tmode: \"path\" | \"dedicated\";\n\tstatus: \"pending_dns\" | \"verifying\" | \"live\" | \"failed\";\n\tfailureReason?: string | null;\n\tdefault: boolean;\n\tdropId?: string | null;\n\tdns: DnsRecord[];\n\tcreatedAt: string;\n\tverifiedAt?: string | null;\n\tnext: NextHint[];\n\tconsoleUrl?: string;\n};\n\ntype DomainDeletedResponse = {\n\tobject: \"domain.deleted\";\n\tid: string;\n\thostname: string;\n\twarning: string;\n};\n\ntype DomainListResponse = {\n\tobject: \"domain.list\";\n\tdomains: DomainResponse[];\n};\n\ntype DomainsClient = {\n\tdomains: {\n\t\tconnect(input: {\n\t\t\thostname: string;\n\t\t\tmode: \"path\" | \"dedicated\";\n\t\t}): Promise<SdkResult<DomainResponse>>;\n\t\tlist(): Promise<SdkResult<DomainListResponse>>;\n\t\tget(idOrHostname: string): Promise<SdkResult<DomainResponse>>;\n\t\tverify(idOrHostname: string): Promise<SdkResult<DomainResponse>>;\n\t\tupdate(\n\t\t\tidOrHostname: string,\n\t\t\tinput: { dropId?: string | null; default?: boolean | null },\n\t\t): Promise<SdkResult<DomainResponse>>;\n\t\tdelete(idOrHostname: string): Promise<SdkResult<DomainDeletedResponse>>;\n\t};\n};\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\n/** Render a DNS records table for human output. */\nfunction formatDnsTable(records: DnsRecord[]): string {\n\tif (records.length === 0) return \"\";\n\tconst rows: string[] = [];\n\tconst colWidths = {\n\t\ttype: Math.max(4, ...records.map((r) => r.type.length)),\n\t\tname: Math.max(4, ...records.map((r) => r.name.length)),\n\t\tvalue: Math.max(5, ...records.map((r) => r.value.length)),\n\t\tstatus: Math.max(6, ...records.map((r) => r.status.length)),\n\t};\n\tconst header = [\n\t\t\"Type\".padEnd(colWidths.type),\n\t\t\"Name\".padEnd(colWidths.name),\n\t\t\"Value\".padEnd(colWidths.value),\n\t\t\"Status\".padEnd(colWidths.status),\n\t].join(\" \");\n\trows.push(pc.dim(header));\n\trows.push(pc.dim(\"─\".repeat(header.length)));\n\tfor (const rec of records) {\n\t\tconst statusColor =\n\t\t\trec.status === \"ok\"\n\t\t\t\t? pc.green(rec.status.padEnd(colWidths.status))\n\t\t\t\t: rec.status === \"mismatch\"\n\t\t\t\t\t? pc.yellow(rec.status.padEnd(colWidths.status))\n\t\t\t\t\t: pc.red(rec.status.padEnd(colWidths.status));\n\t\trows.push(\n\t\t\t[\n\t\t\t\trec.type.padEnd(colWidths.type),\n\t\t\t\trec.name.padEnd(colWidths.name),\n\t\t\t\trec.value.padEnd(colWidths.value),\n\t\t\t\tstatusColor,\n\t\t\t].join(\" \"),\n\t\t);\n\t\tif (rec.hint) {\n\t\t\trows.push(` ${pc.dim(rec.hint)}`);\n\t\t}\n\t\tif (rec.observed) {\n\t\t\trows.push(` ${pc.dim(`Observed: ${rec.observed}`)}`);\n\t\t}\n\t}\n\treturn rows.join(\"\\n\");\n}\n\n/** Translate a server next-hint into a CLI-register string for human output. */\nfunction renderNextHint(\n\th: NextHint,\n\thostname: string,\n\tmaxRetryAfter: number,\n): string {\n\tif (h.action === \"verify\") {\n\t\tconst recheck =\n\t\t\tmaxRetryAfter > 0 ? ` (re-checks every ${maxRetryAfter}s)` : \"\";\n\t\treturn `Run: dropthis domains verify ${hostname} --wait${recheck}`;\n\t}\n\tif (h.action === \"publish\") {\n\t\treturn `Run: dropthis publish <file> --domain ${hostname}`;\n\t}\n\t// \"dns\" hints and unknown actions: message is register-neutral, keep verbatim\n\treturn h.message;\n}\n\n/**\n * True when a \"dns\" next-hint repeats what a record-table hint already says\n * (same record name and value). The table line wins; the duplicate prose is\n * dropped so the create-this-CNAME instruction appears once.\n */\nfunction duplicatesRecordHint(h: NextHint, dns: DnsRecord[]): boolean {\n\tif (h.action !== \"dns\") return false;\n\treturn dns.some(\n\t\t(r) => r.hint && h.message.includes(r.name) && h.message.includes(r.value),\n\t);\n}\n\n/** Print next-step hints for human output. */\nfunction printNextHints(\n\tdeps: { stdout: (v: string) => void },\n\thints: NextHint[],\n\thostname: string,\n\tdns: DnsRecord[],\n): void {\n\tconst lines = hints.filter((h) => !duplicatesRecordHint(h, dns));\n\tif (lines.length === 0) return;\n\tconst maxRetryAfter = dns.reduce(\n\t\t(max, r) => Math.max(max, r.retryAfter ?? 0),\n\t\t0,\n\t);\n\tdeps.stdout(\"\\n\");\n\tfor (const h of lines) {\n\t\tdeps.stdout(`${hint(renderNextHint(h, hostname, maxRetryAfter))}\\n`);\n\t}\n}\n\n/**\n * Point the user at the console setup page (consoleUrl) until the domain is live.\n * Adding the DNS record is theirs to do; the console shows it with copy buttons and\n * flips to live automatically — friendlier than the raw record for a non-CLI human.\n */\nfunction printConsoleHandoff(\n\tdeps: { stdout: (v: string) => void },\n\tdomain: DomainResponse,\n): void {\n\tif (domain.status === \"live\" || !domain.consoleUrl) return;\n\tdeps.stdout(\n\t\t`\\n${hint(`Or finish it in the console: ${domain.consoleUrl}`)}\\n`,\n\t);\n}\n\n/** Compute the sleep duration for --wait polling. Caps at remaining timeout. */\nfunction computeSleepMs(\n\trecords: DnsRecord[],\n\telapsedMs: number,\n\ttimeoutMs: number,\n): number {\n\tconst maxRetryAfter = records.reduce(\n\t\t(max, r) => Math.max(max, r.retryAfter ?? 0),\n\t\t0,\n\t);\n\tconst defaultSeconds = maxRetryAfter > 0 ? maxRetryAfter : 15;\n\tconst desiredMs = defaultSeconds * 1000;\n\tconst remainingMs = timeoutMs - elapsedMs;\n\treturn Math.min(desiredMs, Math.max(0, remainingMs));\n}\n\n// ---------------------------------------------------------------------------\n// connect\n// ---------------------------------------------------------------------------\n\nexport async function runDomainsConnect(\n\tinput: { hostname: string; mode: string },\n\tdeps: CommandDeps<DomainsClient>,\n): Promise<{ exitCode: number }> {\n\tif (input.mode !== \"path\" && input.mode !== \"dedicated\") {\n\t\treturn writeError(\n\t\t\tdeps,\n\t\t\t\"invalid_usage\",\n\t\t\t'--mode must be \"path\" or \"dedicated\"',\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.domains.connect(\n\t\tinput as { hostname: string; mode: \"path\" | \"dedicated\" },\n\t);\n\tif (result.error) return writeApiError(deps, result.error);\n\tconst domain = result.data;\n\tif (deps.outputMode === \"human\") {\n\t\tdeps.stdout(\n\t\t\t`${success(`Connected ${domain.hostname} (${domain.mode} mode)`)}\\n`,\n\t\t);\n\t\tif (domain.dns.length > 0) {\n\t\t\tdeps.stdout(\"\\nDNS records to create at your provider:\\n\\n\");\n\t\t\tdeps.stdout(`${formatDnsTable(domain.dns)}\\n`);\n\t\t}\n\t\tprintNextHints(deps, domain.next, domain.hostname, domain.dns);\n\t\tprintConsoleHandoff(deps, domain);\n\t} else {\n\t\twriteJson(deps, { ok: true, domain });\n\t}\n\treturn { exitCode: 0 };\n}\n\n// ---------------------------------------------------------------------------\n// list\n// ---------------------------------------------------------------------------\n\nexport async function runDomainsList(\n\t_input: { json?: boolean },\n\tdeps: CommandDeps<DomainsClient>,\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.domains.list();\n\tif (result.error) return writeApiError(deps, result.error);\n\tconst domains: DomainResponse[] = result.data?.domains ?? [];\n\tif (deps.outputMode === \"human\") {\n\t\tif (domains.length === 0) {\n\t\t\twriteEmpty(deps, \"No domains connected yet.\", { ok: true, domains: [] });\n\t\t} else {\n\t\t\tfor (const d of domains) {\n\t\t\t\tconst defaultMark = d.default ? pc.green(\" (default)\") : \"\";\n\t\t\t\tconst drop = d.dropId ? pc.dim(` → ${d.dropId}`) : \"\";\n\t\t\t\tdeps.stdout(\n\t\t\t\t\t` ${d.hostname}${defaultMark} ${pc.dim(d.mode)} ${pc.dim(d.status)}${drop}\\n`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t} else {\n\t\twriteJson(deps, { ok: true, domains });\n\t}\n\treturn { exitCode: 0 };\n}\n\n// ---------------------------------------------------------------------------\n// status (get)\n// ---------------------------------------------------------------------------\n\nexport async function runDomainsStatus(\n\tidOrHostname: string,\n\t_input: { json?: boolean },\n\tdeps: CommandDeps<DomainsClient>,\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.domains.get(idOrHostname);\n\tif (result.error) return writeApiError(deps, result.error);\n\tconst domain = result.data;\n\tif (deps.outputMode === \"human\") {\n\t\tdeps.stdout(` ${pc.dim(\"Hostname:\")} ${domain.hostname}\\n`);\n\t\tdeps.stdout(` ${pc.dim(\"Mode: \")} ${domain.mode}\\n`);\n\t\tdeps.stdout(` ${pc.dim(\"Status: \")} ${domain.status}\\n`);\n\t\tif (domain.failureReason) {\n\t\t\tdeps.stdout(\n\t\t\t\t` ${pc.dim(\"Reason: \")} ${pc.red(domain.failureReason)}\\n`,\n\t\t\t);\n\t\t}\n\t\tif (domain.dropId) {\n\t\t\tdeps.stdout(` ${pc.dim(\"Drop: \")} ${domain.dropId}\\n`);\n\t\t}\n\t\tif (domain.verifiedAt) {\n\t\t\tdeps.stdout(\n\t\t\t\t` ${pc.dim(\"Verified:\")} ${formatDate(domain.verifiedAt)}\\n`,\n\t\t\t);\n\t\t}\n\t\tdeps.stdout(` ${pc.dim(\"Created: \")} ${formatDate(domain.createdAt)}\\n`);\n\t\tif (domain.dns.length > 0) {\n\t\t\tdeps.stdout(\"\\nDNS records:\\n\\n\");\n\t\t\tdeps.stdout(`${formatDnsTable(domain.dns)}\\n`);\n\t\t}\n\t\tprintNextHints(deps, domain.next, domain.hostname, domain.dns);\n\t\tprintConsoleHandoff(deps, domain);\n\t} else {\n\t\twriteJson(deps, { ok: true, domain });\n\t}\n\treturn { exitCode: 0 };\n}\n\n// ---------------------------------------------------------------------------\n// verify\n// ---------------------------------------------------------------------------\n\n/** Sleep function injectable for testing. */\nexport type SleepFn = (ms: number) => Promise<void>;\n\nconst defaultSleep: SleepFn = (ms) =>\n\tnew Promise((resolve) => setTimeout(resolve, ms));\n\nexport async function runDomainsVerify(\n\tidOrHostname: string,\n\tinput: { wait?: boolean; timeout?: number; json?: boolean },\n\tdeps: CommandDeps<DomainsClient>,\n\tsleep: SleepFn = defaultSleep,\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\n\tconst timeoutMs = (input.timeout ?? 300) * 1000;\n\n\tconst doVerify = async (elapsedMs: number): Promise<{ exitCode: number }> => {\n\t\tconst result = await deps.client.domains.verify(idOrHostname);\n\t\tif (result.error) return writeApiError(deps, result.error);\n\t\tconst domain = result.data;\n\n\t\tif (!input.wait) {\n\t\t\t// One-shot: handle pending/verifying separately\n\t\t\tif (domain.status !== \"live\" && domain.status !== \"failed\") {\n\t\t\t\t// pending_dns or verifying: not ready yet\n\t\t\t\tif (deps.outputMode === \"human\") {\n\t\t\t\t\tdeps.stdout(`${warn(`${idOrHostname}: ${domain.status}`)}\\n`);\n\t\t\t\t\tif (domain.dns.length > 0) {\n\t\t\t\t\t\tdeps.stdout(\"\\n\");\n\t\t\t\t\t\tdeps.stdout(`${formatDnsTable(domain.dns)}\\n`);\n\t\t\t\t\t}\n\t\t\t\t\tprintNextHints(deps, domain.next, domain.hostname, domain.dns);\n\t\t\t\t\tprintConsoleHandoff(deps, domain);\n\t\t\t\t} else {\n\t\t\t\t\twriteError(\n\t\t\t\t\t\tdeps,\n\t\t\t\t\t\t\"verify_pending\",\n\t\t\t\t\t\t`${idOrHostname}: ${domain.status}`,\n\t\t\t\t\t\t`Re-run: dropthis domains verify ${idOrHostname}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn { exitCode: 6 };\n\t\t\t}\n\n\t\t\t// live or failed\n\t\t\tif (deps.outputMode === \"human\") {\n\t\t\t\tdeps.stdout(\n\t\t\t\t\t`${domain.status === \"live\" ? success(`${idOrHostname} is live`) : warn(`${idOrHostname}: ${domain.status}`)}\\n`,\n\t\t\t\t);\n\t\t\t\tif (domain.dns.length > 0) {\n\t\t\t\t\tdeps.stdout(\"\\n\");\n\t\t\t\t\tdeps.stdout(`${formatDnsTable(domain.dns)}\\n`);\n\t\t\t\t}\n\t\t\t\tprintNextHints(deps, domain.next, domain.hostname, domain.dns);\n\t\t\t\tprintConsoleHandoff(deps, domain);\n\t\t\t} else {\n\t\t\t\twriteJson(deps, { ok: true, domain });\n\t\t\t}\n\t\t\treturn {\n\t\t\t\texitCode: domain.status === \"live\" ? 0 : 1,\n\t\t\t};\n\t\t}\n\n\t\t// --wait mode: loop until live/failed/timeout\n\t\tif (domain.status === \"live\" || domain.status === \"failed\") {\n\t\t\tif (deps.outputMode === \"human\") {\n\t\t\t\tdeps.stdout(\n\t\t\t\t\t`${domain.status === \"live\" ? success(`${idOrHostname} is live`) : warn(`${idOrHostname}: ${domain.status}`)}\\n`,\n\t\t\t\t);\n\t\t\t\tif (domain.dns.length > 0) {\n\t\t\t\t\tdeps.stdout(\"\\n\");\n\t\t\t\t\tdeps.stdout(`${formatDnsTable(domain.dns)}\\n`);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\twriteJson(deps, { ok: true, domain });\n\t\t\t}\n\t\t\treturn { exitCode: domain.status === \"live\" ? 0 : 1 };\n\t\t}\n\n\t\t// Not terminal — check timeout\n\t\tconst sleepMs = computeSleepMs(domain.dns, elapsedMs, timeoutMs);\n\t\tconst newElapsed = elapsedMs + sleepMs;\n\t\tif (newElapsed >= timeoutMs) {\n\t\t\t// Timed out\n\t\t\tconst timeoutSecs = input.timeout ?? 300;\n\t\t\tconst message = `Timed out waiting for ${idOrHostname} to go live after ${timeoutSecs}s`;\n\t\t\tif (deps.outputMode === \"human\") {\n\t\t\t\tdeps.stderr(\n\t\t\t\t\t` ${pc.red(\"Timed out waiting for\")} ${idOrHostname} ${pc.red(\"to go live\")}\\n`,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tdeps.stderr(\n\t\t\t\t\t`${JSON.stringify(errorEnvelope(\"verify_timeout\", message, `DNS is still propagating. Re-run: dropthis domains verify ${idOrHostname}`))}\\n`,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn { exitCode: 7 };\n\t\t}\n\n\t\tif (deps.outputMode === \"json\" && domain.dns.length > 0) {\n\t\t\tconst elapsed = Math.round(elapsedMs / 1000);\n\t\t\tdeps.stderr(\n\t\t\t\t`${JSON.stringify({ ok: false, pending: true, status: domain.status, elapsed })}\\n`,\n\t\t\t);\n\t\t}\n\n\t\tif (deps.outputMode === \"human\" && domain.dns.length > 0) {\n\t\t\tdeps.stdout(`${formatDnsTable(domain.dns)}\\n`);\n\t\t}\n\n\t\tawait sleep(sleepMs);\n\t\treturn doVerify(newElapsed);\n\t};\n\n\treturn doVerify(0);\n}\n\n// ---------------------------------------------------------------------------\n// update\n// ---------------------------------------------------------------------------\n\nexport async function runDomainsUpdate(\n\tidOrHostname: string,\n\tinput: { drop?: string; setDefault?: boolean; json?: boolean },\n\tdeps: CommandDeps<DomainsClient>,\n): Promise<{ exitCode: number }> {\n\t// At least one option is required\n\tif (input.drop === undefined && input.setDefault === undefined) {\n\t\treturn writeError(\n\t\t\tdeps,\n\t\t\t\"invalid_usage\",\n\t\t\t\"Provide at least one option: --drop <dropId> or --default\",\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 updateInput: { dropId?: string | null; default?: boolean | null } = {};\n\tif (input.drop !== undefined) updateInput.dropId = input.drop;\n\tif (input.setDefault !== undefined) updateInput.default = input.setDefault;\n\n\tconst result = await deps.client.domains.update(idOrHostname, updateInput);\n\tif (result.error) return writeApiError(deps, result.error);\n\tconst domain = result.data;\n\twriteHumanOrJson(deps, `${success(`Updated ${domain.hostname}`)}\\n`, {\n\t\tok: true,\n\t\tdomain,\n\t});\n\treturn { exitCode: 0 };\n}\n\n// ---------------------------------------------------------------------------\n// remove\n// ---------------------------------------------------------------------------\n\nexport async function runDomainsRemove(\n\tidOrHostname: string,\n\tinput: { yes?: boolean; json?: boolean; interactive?: boolean },\n\tdeps: CommandDeps<DomainsClient>,\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 remove the domain 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: `Remove ${idOrHostname}? This removes the domain and unmounts its drops.`,\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.domains.delete(idOrHostname);\n\tif (result.error) return writeApiError(deps, result.error);\n\tconst deleted = result.data;\n\tif (deps.outputMode === \"human\") {\n\t\tdeps.stdout(`${success(`Removed ${deleted.hostname}`)}\\n`);\n\t\tif (deleted.warning) {\n\t\t\tdeps.stderr(`${warn(deleted.warning)}\\n`);\n\t\t}\n\t} else {\n\t\twriteJson(deps, {\n\t\t\tok: true,\n\t\t\tdeleted: true,\n\t\t\tid: deleted.id,\n\t\t\thostname: deleted.hostname,\n\t\t\twarning: deleted.warning,\n\t\t});\n\t}\n\treturn { exitCode: 0 };\n}\n","import * as prompts from \"@clack/prompts\";\nimport pc from \"picocolors\";\nimport { requireCredential } from \"../auth.js\";\nimport {\n\tformatDate,\n\twriteApiError,\n\twriteAuthError,\n\twriteEmpty,\n\twriteError,\n\twriteHumanOrJson,\n\twriteJson,\n\twriteKv,\n} from \"../fmt.js\";\nimport {\n\ttype CommandDeps,\n\textractPagination,\n\ttype SdkResult,\n\tunwrapListData,\n} from \"../types.js\";\nimport { url as fmtUrl, hint, 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\tdomain?: string;\n\t\t}): Promise<SdkResult<unknown>>;\n\t};\n};\n\ntype ResolvedDrop = { id: string; slug?: string; [key: string]: unknown };\n\nexport type DropsResolveClient = {\n\tdrops: {\n\t\tresolve(urlOrSlug: string): Promise<SdkResult<ResolvedDrop | null>>;\n\t};\n};\n\ntype DropsGetClient = DropsResolveClient & {\n\tdrops: {\n\t\tget(dropId: string): Promise<SdkResult<unknown>>;\n\t};\n};\n\ntype DropsDeleteClient = DropsResolveClient & {\n\tdrops: {\n\t\tdelete(\n\t\t\tdropId: string,\n\t\t): Promise<SdkResult<null>> | SdkResult<null> | undefined;\n\t};\n};\n\n/**\n * Accepts what users actually have in their clipboard: the full drop_… id, a\n * drop URL, or a bare slug. Ids pass through; anything else resolves through\n * drops.resolve (owner-scoped). On failure the API error is already written.\n */\nexport async function resolveDropTarget(\n\ttarget: string,\n\tdeps: CommandDeps<DropsResolveClient>,\n): Promise<\n\t| {\n\t\t\tok: true;\n\t\t\tdropId: string;\n\t\t\tslug?: string;\n\t\t\tresolvedFrom?: string;\n\t\t\ttitle?: string;\n\t }\n\t| { ok: false; exitCode: number }\n> {\n\tif (target.startsWith(\"drop_\")) return { ok: true, dropId: target };\n\tconst resolved = await deps.client.drops.resolve(target);\n\tif (resolved.error) {\n\t\treturn { ok: false, ...writeApiError(deps, resolved.error) };\n\t}\n\tif (resolved.data === null) {\n\t\treturn {\n\t\t\tok: false,\n\t\t\t...writeApiError(deps, {\n\t\t\t\tcode: \"not_found\",\n\t\t\t\tmessage: `No drop matching \"${target}\" found in your account.`,\n\t\t\t\tsuggestion:\n\t\t\t\t\t\"It may belong to another account or have been deleted. \" +\n\t\t\t\t\t\"Run dropthis list to see your drops, or pass the full drop_… id.\",\n\t\t\t}),\n\t\t};\n\t}\n\treturn {\n\t\tok: true,\n\t\tdropId: resolved.data.id,\n\t\tresolvedFrom: target,\n\t\t...(resolved.data.slug ? { slug: resolved.data.slug } : {}),\n\t\t...(typeof resolved.data.title === \"string\"\n\t\t\t? { title: resolved.data.title }\n\t\t\t: {}),\n\t};\n}\n\n/** Human-mode breadcrumb so a resolved write shows which drop the URL/slug mapped to. */\nexport function writeResolvedLine(\n\tdeps: CommandDeps<DropsResolveClient>,\n\tresolved: { dropId: string; resolvedFrom?: string; title?: string },\n): void {\n\tif (!resolved.resolvedFrom || deps.outputMode !== \"human\") return;\n\tconst title = resolved.title ? ` (${resolved.title})` : \"\";\n\tdeps.stdout(\n\t\t`${hint(`resolved ${resolved.resolvedFrom} → ${resolved.dropId}${title}`)}\\n`,\n\t);\n}\n\nexport async function runDropsList(\n\tinput: { limit?: number; cursor?: string; domain?: 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\t...(input.domain ? { domain: input.domain } : {}),\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 page = extractPagination(result.data);\n\tconst items = Array.isArray(raw)\n\t\t? (raw as Array<Record<string, unknown>>)\n\t\t: undefined;\n\tif (deps.outputMode === \"human\") {\n\t\tif (!items || items.length === 0) {\n\t\t\twriteEmpty(deps, \"No drops found.\", { ok: true, drops: [] });\n\t\t} else {\n\t\t\tfor (const item of items) {\n\t\t\t\tconst created =\n\t\t\t\t\ttypeof item.createdAt === \"string\"\n\t\t\t\t\t\t? pc.dim(formatDate(item.createdAt))\n\t\t\t\t\t\t: \"\";\n\t\t\t\tdeps.stdout(\n\t\t\t\t\t`${item.id ?? \"\"} ${created} ${item.title ?? \"\"} ${item.url ? fmtUrl(String(item.url)) : \"\"}\\n`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tdeps.stdout(\n\t\t\t\t`${pc.dim(`${items.length} ${items.length === 1 ? \"drop\" : \"drops\"}`)}\\n`,\n\t\t\t);\n\t\t\tif (page?.hasMore && page.nextCursor) {\n\t\t\t\tdeps.stdout(\n\t\t\t\t\t`${hint(`More drops: dropthis list --cursor ${page.nextCursor}`)}\\n`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t} else {\n\t\twriteJson(deps, {\n\t\t\tok: true,\n\t\t\tdrops: items ?? raw,\n\t\t\t...(page ? { next_cursor: page.nextCursor, has_more: page.hasMore } : {}),\n\t\t});\n\t}\n\treturn { exitCode: 0 };\n}\n\nexport async function runDropsGet(\n\ttarget: 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 resolved = await resolveDropTarget(target, deps);\n\tif (!resolved.ok) return { exitCode: resolved.exitCode };\n\twriteResolvedLine(deps, resolved);\n\tconst result = await deps.client.drops.get(resolved.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)\n\t\tpairs.push([\"Created\", formatDate(String(data.createdAt))]);\n\tif (data.domain) pairs.push([\"Domain\", String(data.domain)]);\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\n/**\n * Resolve a public drop URL or bare slug (or a drop_… id — the server resolver\n * accepts ids too) back to the drop, printing its id + url. The single lenient\n * on-ramp: writes are id-only, so this is how you recover the id from a URL.\n */\nexport async function runDropsResolve(\n\ttarget: string,\n\t_input: { json?: boolean },\n\tdeps: CommandDeps<DropsResolveClient>,\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.resolve(target);\n\tif (result.error) return writeApiError(deps, result.error);\n\tif (result.data === null) {\n\t\treturn writeApiError(deps, {\n\t\t\tcode: \"not_found\",\n\t\t\tmessage: `No drop matching \"${target}\" found in your account.`,\n\t\t\tsuggestion:\n\t\t\t\t\"It may belong to another account or have been deleted. \" +\n\t\t\t\t\"Run dropthis list to see your drops, or pass the full drop_… id.\",\n\t\t});\n\t}\n\tconst drop = result.data as Record<string, unknown>;\n\tconst pairs: Array<[string, string]> = [];\n\tif (drop.id) pairs.push([\"ID\", String(drop.id)]);\n\tif (drop.url) pairs.push([\"URL\", fmtUrl(String(drop.url))]);\n\tif (drop.title) pairs.push([\"Title\", String(drop.title)]);\n\tif (drop.slug) pairs.push([\"Slug\", String(drop.slug)]);\n\twriteKv(deps, pairs, { ok: true, drop });\n\treturn { exitCode: 0 };\n}\n\nexport async function runDropsDelete(\n\ttarget: 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\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\t// Resolve before confirming so the prompt names the actual drop.\n\tconst resolved = await resolveDropTarget(target, deps);\n\tif (!resolved.ok) return { exitCode: resolved.exitCode };\n\twriteResolvedLine(deps, resolved);\n\tconst dropId = resolved.dropId;\n\tif (!input.yes && input.interactive !== false) {\n\t\tconst confirmed = await prompts.confirm({\n\t\t\tmessage: `Delete ${dropId}${dropId === target ? \"\" : ` (${target})`}?`,\n\t\t});\n\t\tif (prompts.isCancel(confirmed) || !confirmed) {\n\t\t\treturn { exitCode: 0 };\n\t\t}\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 { requireCredential } from \"../auth.js\";\nimport {\n\twriteApiError,\n\twriteAuthError,\n\twriteEmpty,\n\twriteHumanOrJson,\n\twriteJson,\n} from \"../fmt.js\";\nimport { type CommandDeps, type SdkResult, unwrapListData } from \"../types.js\";\nimport { success } from \"../ui.js\";\n\ntype Invitation = {\n\tid: string;\n\tworkspaceId: string;\n\temail: string;\n\trole: string;\n\tstatus: string;\n\texpiresAt: string;\n\tcreatedAt: string;\n\tacceptedAt?: string;\n};\n\ntype Workspace = {\n\tid: string;\n\tname: string;\n\tslug: string;\n\tkind: string;\n\trole: string;\n\tplan: string;\n\tisActive: boolean;\n};\n\ntype InvitationsListClient = {\n\tinvitations: {\n\t\t// GET /v1/invitations returns { invitations: [...] }, not a page.\n\t\tlist(): Promise<SdkResult<{ invitations: Invitation[] } | null>>;\n\t};\n};\n\ntype InvitationsAcceptClient = {\n\tinvitations: {\n\t\taccept(input: { token: string }): Promise<SdkResult<Workspace>>;\n\t};\n};\n\ntype InvitationsAcceptByIdClient = {\n\tinvitations: {\n\t\tacceptById(input: { invitationId: string }): Promise<SdkResult<Workspace>>;\n\t};\n};\n\nexport async function runInvitationsList(\n\t_input: { json?: boolean },\n\tdeps: CommandDeps<InvitationsListClient>,\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\n\tconst result = await deps.client.invitations.list();\n\tif (result.error) return writeApiError(deps, result.error);\n\n\t// GET returns { invitations: [...] } (not a { data } page), so fall back to\n\t// the `invitations` key — otherwise the list came back empty.\n\tconst raw = unwrapListData(result.data, \"invitations\");\n\tconst items = Array.isArray(raw) ? (raw as Invitation[]) : [];\n\n\tif (deps.outputMode === \"human\") {\n\t\tif (items.length === 0) {\n\t\t\twriteEmpty(deps, \"No pending invitations.\", {\n\t\t\t\tok: true,\n\t\t\t\tinvitations: [],\n\t\t\t});\n\t\t} else {\n\t\t\tfor (const inv of items) {\n\t\t\t\tdeps.stdout(`${inv.email} ${inv.role} ${inv.status} ${inv.id}\\n`);\n\t\t\t}\n\t\t}\n\t} else {\n\t\twriteJson(deps, { ok: true, invitations: items });\n\t}\n\n\treturn { exitCode: 0 };\n}\n\nexport async function runInvitationsAccept(\n\tinput: { token: string; json?: boolean },\n\tdeps: CommandDeps<InvitationsAcceptClient>,\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\n\tconst result = await deps.client.invitations.accept({ token: input.token });\n\tif (result.error) return writeApiError(deps, result.error);\n\n\tconst ws = result.data;\n\twriteHumanOrJson(\n\t\tdeps,\n\t\tsuccess(`Joined ${ws.name} (${ws.slug}) — now your active workspace.`),\n\t\t{ ok: true, workspace: ws },\n\t);\n\n\treturn { exitCode: 0 };\n}\n\nexport async function runInvitationsAcceptById(\n\tinput: { invitationId: string; json?: boolean },\n\tdeps: CommandDeps<InvitationsAcceptByIdClient>,\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\n\tconst result = await deps.client.invitations.acceptById({\n\t\tinvitationId: input.invitationId,\n\t});\n\tif (result.error) return writeApiError(deps, result.error);\n\n\tconst ws = result.data;\n\twriteHumanOrJson(\n\t\tdeps,\n\t\tsuccess(`Joined ${ws.name} (${ws.slug}) — now your active workspace.`),\n\t\t{ ok: true, workspace: ws },\n\t);\n\n\treturn { exitCode: 0 };\n}\n","import * as prompts from \"@clack/prompts\";\nimport { writeApiError, writeHumanOrJson } from \"../fmt.js\";\nimport { type ApiErrorDetails, exitCodeFor } from \"../output.js\";\nimport type { CredentialStore } from \"../storage.js\";\nimport type { SdkResult } from \"../types.js\";\nimport { success } from \"../ui.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\tscopes?: string[];\n};\n\n// All login endpoints fail with the full SDK error envelope (code, statusCode,\n// suggestion, requestId, …) so errors render API truth via writeApiError and a\n// 401 maps to exit 3. The typed `code` (dropthis#80) — `otp_expired` (no active\n// code) vs `otp_invalid` (wrong digits) — rides on ApiErrorDetails.\ntype LoginRequestClient = {\n\tauth: {\n\t\trequestEmailOtp(input: {\n\t\t\temail: string;\n\t\t}): Promise<SdkResult<OtpRequestData, ApiErrorDetails>>;\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, ApiErrorDetails>>;\n\t};\n\tapiKeys: {\n\t\tcreate(input: {\n\t\t\tlabel: string;\n\t\t\ttype?: \"delegated\" | \"service\";\n\t\t\tscopes?: string[];\n\t\t}): Promise<SdkResult<ApiKeyData, ApiErrorDetails>>;\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\t/** A single bundle name (e.g. \"team\") to request a capability-scoped login key. */\n\tscope?: string;\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\t// The code aged out (not a typo): request a fresh one automatically\n\t\t// instead of asking the user to retype an already-expired code.\n\t\tif (result.error.code === \"otp_expired\" && attempt < maxAttempts) {\n\t\t\tconst resend = await deps.client.auth.requestEmailOtp({ email });\n\t\t\tif (resend.error) {\n\t\t\t\tprompts.cancel(resend.error.message);\n\t\t\t\treturn { exitCode: exitCodeFor(\"api_error\") };\n\t\t\t}\n\t\t\tprompts.log.info(\"That code expired — we sent a new one.\");\n\t\t\tcontinue;\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({\n\t\tlabel: \"CLI\",\n\t\ttype: \"delegated\",\n\t\t...(deps.scope ? { scopes: [deps.scope] } : {}),\n\t});\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\t...(apiKey.data.scopes ? { scopes: apiKey.data.scopes } : {}),\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\toutputMode?: \"human\" | \"json\";\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\treturn writeApiError(deps, result.error);\n\t}\n\twriteHumanOrJson(\n\t\tdeps,\n\t\tsuccess(`Code sent to ${input.email}. Check your inbox.`),\n\t\t{\n\t\t\tok: true,\n\t\t\temail: input.email,\n\t\t\texpires_in: result.data.expiresIn,\n\t\t},\n\t);\n\treturn { exitCode: 0 };\n}\n\nexport async function runLoginVerify(\n\tinput: { email: string; otp: string; scope?: 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\toutputMode?: \"human\" | \"json\";\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\t// writeApiError renders the server suggestion + request_id; the otp_expired\n\t\t// vs otp_invalid next-action split lives in cliNextAction (output.ts).\n\t\treturn writeApiError(deps, session.error);\n\t}\n\tconst authedClient = deps.createClient(session.data.token);\n\tconst apiKey = await authedClient.apiKeys.create({\n\t\tlabel: \"CLI\",\n\t\ttype: \"delegated\",\n\t\t// A single bundle name (e.g. \"team\") requests a capability-scoped key; the\n\t\t// server returns the resolved scope list on the mint response.\n\t\t...(input.scope ? { scopes: [input.scope] } : {}),\n\t});\n\tif (apiKey.error) {\n\t\treturn writeApiError(deps, apiKey.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\t...(apiKey.data.scopes ? { scopes: apiKey.data.scopes } : {}),\n\t\tstorage: \"secure\",\n\t});\n\twriteHumanOrJson(deps, success(`Logged in as ${input.email}.`), {\n\t\tok: true,\n\t\taccount_id: apiKey.data.accountId ?? session.data.accountId,\n\t\tkey_id: apiKey.data.id,\n\t\tkey_last4: apiKey.data.keyLast4,\n\t\tis_new_account: apiKey.data.isNewAccount ?? session.data.isNewAccount,\n\t});\n\treturn { exitCode: 0 };\n}\n","import { writeApiError, writeHumanOrJson } from \"../fmt.js\";\nimport type { ApiErrorDetails } from \"../output.js\";\nimport type { CredentialStore } from \"../storage.js\";\nimport type { 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, ApiErrorDetails>\n\t\t\t| Promise<SdkResult<null, ApiErrorDetails>>\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: ApiErrorDetails | 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;\n\t}\n\t// Clear local state unconditionally: logout must never leave a key on disk,\n\t// even when the server-side revoke failed (offline, already revoked, 500).\n\t// Clearing locally is exactly the case the user cares about on a lost or\n\t// compromised machine.\n\tawait deps.store.clear();\n\tif (revokeError) {\n\t\t// Render the full server error (suggestion + request_id) and map a 401 to\n\t\t// exit 3, consistent with every other command's API-error path.\n\t\treturn writeApiError(deps, revokeError);\n\t}\n\twriteHumanOrJson(deps, success(\"Logged out.\"), { ok: true });\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} from \"../fmt.js\";\nimport { type CommandDeps, type SdkResult, unwrapListData } from \"../types.js\";\nimport { success } from \"../ui.js\";\n\ntype Member = {\n\taccountId: string;\n\temail: string;\n\trole: string;\n\tisYou: boolean;\n\tjoinedAt: string;\n};\n\ntype Invitation = {\n\tid: string;\n\tworkspaceId: string;\n\temail: string;\n\trole: string;\n\tstatus: string;\n\texpiresAt: string;\n\tcreatedAt: string;\n};\n\ntype MembersListClient = {\n\tmembers: {\n\t\t// GET /v1/workspaces/{id}/members returns { members: [...] }, not a page.\n\t\tlist(workspaceId: string): Promise<SdkResult<{ members: Member[] } | null>>;\n\t};\n};\n\ntype MembersInviteClient = {\n\tmembers: {\n\t\tinvite(\n\t\t\tworkspaceId: string,\n\t\t\tinput: { email: string; role: \"admin\" | \"member\" },\n\t\t): Promise<SdkResult<Invitation>>;\n\t};\n};\n\ntype MembersRoleClient = {\n\tmembers: {\n\t\tupdateRole(\n\t\t\tworkspaceId: string,\n\t\t\taccountId: string,\n\t\t\tinput: { role: \"owner\" | \"admin\" | \"member\" },\n\t\t): Promise<SdkResult<Member>>;\n\t};\n};\n\n// DELETE /v1/workspaces/{id}/members/{accountId} returns 204 No Content; the SDK\n// types it DropthisResult<null>. Success is `error === null` — never read data.\ntype MembersRemoveClient = {\n\tmembers: {\n\t\tremove(\n\t\t\tworkspaceId: string,\n\t\t\taccountId: string,\n\t\t): Promise<SdkResult<null>> | SdkResult<null> | undefined;\n\t};\n};\n\nexport async function runMembersList(\n\tworkspaceId: string,\n\t_input: { json?: boolean },\n\tdeps: CommandDeps<MembersListClient>,\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\n\tconst result = await deps.client.members.list(workspaceId);\n\tif (result.error) return writeApiError(deps, result.error);\n\n\t// GET returns { members: [...] } (not a { data } page), so fall back to the\n\t// `members` key — otherwise the list came back empty.\n\tconst raw = unwrapListData(result.data, \"members\");\n\tconst items = Array.isArray(raw) ? (raw as Member[]) : [];\n\n\tif (deps.outputMode === \"human\") {\n\t\tif (items.length === 0) {\n\t\t\twriteEmpty(deps, \"No members.\", { ok: true, members: [] });\n\t\t} else {\n\t\t\tfor (const m of items) {\n\t\t\t\tconst who = m.email || m.accountId;\n\t\t\t\tconst you = m.isYou ? \"(you)\" : \"\";\n\t\t\t\tdeps.stdout(`${who} ${m.role} ${you}\\n`);\n\t\t\t}\n\t\t}\n\t} else {\n\t\twriteJson(deps, { ok: true, members: items });\n\t}\n\n\treturn { exitCode: 0 };\n}\n\nexport async function runMembersInvite(\n\tworkspaceId: string,\n\tinput: { email: string; role?: \"admin\" | \"member\"; json?: boolean },\n\tdeps: CommandDeps<MembersInviteClient>,\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\n\tconst role = input.role ?? \"member\";\n\tconst result = await deps.client.members.invite(workspaceId, {\n\t\temail: input.email,\n\t\trole,\n\t});\n\tif (result.error) return writeApiError(deps, result.error);\n\n\twriteHumanOrJson(deps, success(`Invited ${input.email} as ${role}`), {\n\t\tok: true,\n\t\tinvitation: result.data,\n\t});\n\n\treturn { exitCode: 0 };\n}\n\nexport async function runMembersRole(\n\tworkspaceId: string,\n\taccountId: string,\n\tinput: { role: \"owner\" | \"admin\" | \"member\"; json?: boolean },\n\tdeps: CommandDeps<MembersRoleClient>,\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\n\tconst result = await deps.client.members.updateRole(workspaceId, accountId, {\n\t\trole: input.role,\n\t});\n\tif (result.error) return writeApiError(deps, result.error);\n\n\twriteHumanOrJson(deps, success(`Set ${accountId} to ${input.role}`), {\n\t\tok: true,\n\t\tmember: result.data,\n\t});\n\n\treturn { exitCode: 0 };\n}\n\nexport async function runMembersRemove(\n\tworkspaceId: string,\n\taccountId: string,\n\tinput: { yes?: boolean; json?: boolean; interactive?: boolean },\n\tdeps: CommandDeps<MembersRemoveClient>,\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 remove 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: `Remove ${accountId} from workspace ${workspaceId}?`,\n\t\t});\n\t\tif (prompts.isCancel(confirmed) || !confirmed) {\n\t\t\treturn { exitCode: 0 };\n\t\t}\n\t}\n\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\n\tconst result = await deps.client.members.remove(workspaceId, accountId);\n\tif (result?.error) return writeApiError(deps, result.error);\n\n\twriteHumanOrJson(deps, success(`Removed ${accountId}`), {\n\t\tok: true,\n\t\tremoved: true,\n\t\taccount_id: accountId,\n\t});\n\n\treturn { exitCode: 0 };\n}\n","import { randomUUID } from \"node:crypto\";\nimport { readFile } from \"node:fs/promises\";\nimport type { PublishFileInput } from \"@dropthis/node\";\n\nexport type DropData = { url: string; [key: string]: unknown };\n\nexport type ManifestFile = {\n\tpath: string;\n\tcontentType: string;\n\t/** Size in bytes for inline files. Undefined for remote (source_url) files whose size is determined server-side on fetch. */\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\n/**\n * Raw shape of one file entry in a --manifest JSON bundle (snake_case, as\n * written by users/agents in the JSON file). Exactly one of content,\n * content_base64, or source_url must be present (or bytes for programmatic use,\n * though the CLI JSON format only supports the string variants).\n */\ntype ManifestJsonFileEntry = {\n\tpath: string;\n\tcontent?: string;\n\tcontent_base64?: string;\n\tsource_url?: string;\n\tcontent_type?: string;\n\tsize_bytes?: number;\n\tchecksum_sha256?: string;\n};\n\n/**\n * Load and validate a --manifest JSON file, returning the SDK-ready\n * `{kind:\"files\", files:[...]}` input.\n *\n * The JSON file must have the shape:\n * { \"files\": [ { \"path\": \"...\", \"content\"|\"content_base64\"|\"source_url\": \"...\" } ] }\n *\n * snake_case keys are mapped to camelCase (source_url → sourceUrl, etc.).\n *\n * Throws a plain Error (message suitable for writeError) on validation failure.\n */\nexport async function loadManifestFile(\n\tmanifestPath: string,\n): Promise<{ kind: \"files\"; files: PublishFileInput[] }> {\n\tlet raw: unknown;\n\ttry {\n\t\traw = JSON.parse(await readFile(manifestPath, \"utf8\")) as unknown;\n\t} catch (err) {\n\t\tconst msg =\n\t\t\terr instanceof Error ? err.message : \"Could not read manifest file.\";\n\t\tthrow new Error(`Failed to read manifest file: ${msg}`);\n\t}\n\n\tif (!raw || typeof raw !== \"object\" || Array.isArray(raw)) {\n\t\tthrow new Error(\"Manifest must be a JSON object with a 'files' array.\");\n\t}\n\tconst obj = raw as Record<string, unknown>;\n\tif (!Array.isArray(obj.files)) {\n\t\tthrow new Error(\"Manifest must have a 'files' array.\");\n\t}\n\n\tconst files: PublishFileInput[] = (obj.files as ManifestJsonFileEntry[]).map(\n\t\t(entry, i) => {\n\t\t\tif (!entry || typeof entry !== \"object\") {\n\t\t\t\tthrow new Error(`Manifest files[${i}] must be an object.`);\n\t\t\t}\n\t\t\tconst {\n\t\t\t\tpath,\n\t\t\t\tcontent,\n\t\t\t\tcontent_base64,\n\t\t\t\tsource_url,\n\t\t\t\tcontent_type,\n\t\t\t\tsize_bytes,\n\t\t\t\tchecksum_sha256,\n\t\t\t} = entry;\n\t\t\tif (!path || typeof path !== \"string\") {\n\t\t\t\tthrow new Error(`Manifest files[${i}] must have a 'path' string.`);\n\t\t\t}\n\t\t\tconst contentKeys = [content, content_base64, source_url].filter(\n\t\t\t\t(v) => v !== undefined,\n\t\t\t);\n\t\t\tif (contentKeys.length === 0) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Manifest files[${i}] (path: \"${path}\") must have exactly one of: content, content_base64, source_url.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (contentKeys.length > 1) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Manifest files[${i}] (path: \"${path}\") must have only one of: content, content_base64, source_url.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (\n\t\t\t\tsource_url !== undefined &&\n\t\t\t\t!source_url.startsWith(\"http://\") &&\n\t\t\t\t!source_url.startsWith(\"https://\")\n\t\t\t) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Manifest files[${i}] (path: \"${path}\") has an invalid source_url \"${source_url}\": source_url must be an http(s) URL.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst file: PublishFileInput = { path };\n\t\t\tif (content !== undefined) file.content = content;\n\t\t\tif (content_base64 !== undefined) file.contentBase64 = content_base64;\n\t\t\tif (source_url !== undefined) file.sourceUrl = source_url;\n\t\t\tif (content_type !== undefined) file.contentType = content_type;\n\t\t\t// size_bytes and checksum_sha256 are not in PublishFileInput — they are\n\t\t\t// upload-session fields. Pass them only if the SDK type accepts them.\n\t\t\t// For now, we silently ignore them (they are hints for the server on the\n\t\t\t// upload path, not needed here since we pass content/source_url directly).\n\t\t\t// If the SDK adds them to PublishFileInput, add a cast here.\n\t\t\tif (size_bytes !== undefined)\n\t\t\t\t(file as Record<string, unknown>).sizeBytes = size_bytes;\n\t\t\tif (checksum_sha256 !== undefined)\n\t\t\t\t(file as Record<string, unknown>).checksumSha256 = checksum_sha256;\n\t\t\treturn file;\n\t\t},\n\t);\n\n\treturn { kind: \"files\", files };\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\t// Remote (source_url) files have no sizeBytes — their size is determined\n\t// server-side on fetch. Sum only the numeric values to avoid NaN.\n\tconst remoteFileCount = prepared.manifest.files.filter(\n\t\t(f) => typeof f.sizeBytes !== \"number\",\n\t).length;\n\tconst totalBytes = prepared.manifest.files.reduce(\n\t\t(sum, f) => sum + (typeof f.sizeBytes === \"number\" ? f.sizeBytes : 0),\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\t// Only include remoteFileCount when there are remote files, to preserve\n\t\t// the existing output shape for all-inline bundles.\n\t\t...(remoteFileCount > 0 ? { remoteFileCount } : {}),\n\t};\n}\n","import { readFile } from \"node:fs/promises\";\nimport { SHARED_POOL } from \"@dropthis/node\";\n\nexport type RawDropOptions = {\n\ttitle?: string;\n\tvisibility?: \"public\" | \"unlisted\";\n\tpassword?: string;\n\tnoPassword?: boolean;\n\tnoindex?: boolean;\n\tindex?: boolean;\n\texpiresAt?: string;\n\tnoExpires?: boolean;\n\tmetadata?: string;\n\tmetadataFile?: string;\n\tentry?: string;\n\tcontentType?: string;\n\tpath?: string;\n\tidempotencyKey?: string;\n\tdomain?: string;\n\tshared?: boolean;\n\tslug?: string;\n\t/** Path to a manifest JSON file (--manifest). */\n\tmanifest?: string;\n\t/** Target workspace slug or id for this publish (delegated keys only). */\n\tworkspace?: string;\n};\n\nexport type ParsedDropOptions = {\n\ttitle?: string;\n\tvisibility?: \"public\" | \"unlisted\";\n\tpassword?: string | null;\n\tnoindex?: boolean;\n\texpiresAt?: string | null;\n\tmetadata?: Record<string, unknown>;\n\tentry?: string;\n\tcontentType?: string;\n\tpath?: string;\n\tidempotencyKey?: string;\n\tdomain?: string;\n\tslug?: string;\n\t/** Target workspace slug or id for this publish (delegated keys only). */\n\tworkspace?: 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 (raw.expiresAt && raw.noExpires) {\n\t\tthrow new Error(\"Use either --expires-at or --no-expires, not both.\");\n\t}\n\tif (raw.shared && raw.domain) {\n\t\tthrow new Error(\"Use either --shared or --domain <hostname>, 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.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...(raw.noExpires ? { expiresAt: null } : {}),\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\t...(raw.shared\n\t\t\t? { domain: SHARED_POOL }\n\t\t\t: raw.domain\n\t\t\t\t? { domain: raw.domain }\n\t\t\t\t: {}),\n\t\t...(raw.slug ? { slug: raw.slug } : {}),\n\t\t...(raw.workspace ? { workspace: raw.workspace } : {}),\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\tloadManifestFile,\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\tmanifest?: 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: PublishInput | 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\t// --manifest: load a JSON bundle file. Error if combined with positional input.\n\tif (raw.manifest) {\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\t\"--manifest cannot be combined with a positional input.\",\n\t\t\t\t\"Remove the positional argument, or omit --manifest and pass your files directly.\",\n\t\t\t);\n\t\t}\n\t\tlet manifestInput: PublishInput;\n\t\ttry {\n\t\t\tmanifestInput = await loadManifestFile(raw.manifest);\n\t\t} catch (err) {\n\t\t\tconst msg = err instanceof Error ? err.message : \"Invalid manifest.\";\n\t\t\treturn writeError(deps, \"invalid_usage\", msg);\n\t\t}\n\t\tinput = manifestInput;\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: PublishInput | 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\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\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 { mkdir, writeFile } from \"node:fs/promises\";\nimport { dirname, isAbsolute, join, relative, resolve } from \"node:path\";\nimport { requireCredential } from \"../auth.js\";\nimport {\n\twriteApiError,\n\twriteAuthError,\n\twriteError,\n\twriteHumanOrJson,\n} from \"../fmt.js\";\nimport { createSpinner, shouldSpin } from \"../spinner.js\";\nimport type { CommandDeps, SdkResult } from \"../types.js\";\nimport { success } from \"../ui.js\";\nimport {\n\ttype DropsResolveClient,\n\tresolveDropTarget,\n\twriteResolvedLine,\n} from \"./drops.js\";\n\ntype PullManifestFile = {\n\tpath: string;\n\tcontentType?: string;\n\tsizeBytes?: number;\n};\n\ntype PullManifest = {\n\tdropId: string;\n\tdeploymentId: string;\n\trevision: number;\n\tstatus?: string;\n\tsizeBytes?: number;\n\tentry?: string | null;\n\tfiles: PullManifestFile[];\n};\n\ntype PulledFile = {\n\tpath: string;\n\tcontentType: string | null;\n\tbytes: Uint8Array;\n};\n\ntype PullClient = DropsResolveClient & {\n\tdrops: {\n\t\tgetContent(\n\t\t\tdropId: string,\n\t\t\toptions?: { path?: string; deploymentId?: string },\n\t\t): Promise<SdkResult<PullManifest | PulledFile>>;\n\t};\n};\n\ntype PullDeps = CommandDeps<PullClient> & { cwd?: string };\n\nexport async function runPull(\n\ttarget: string,\n\tinput: { output?: string; deployment?: string; json?: boolean },\n\tdeps: PullDeps,\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\n\t// Resolve a URL/slug to the drop; a full drop_… id skips the round trip.\n\tconst resolved = await resolveDropTarget(target, deps);\n\tif (!resolved.ok) return { exitCode: resolved.exitCode };\n\twriteResolvedLine(deps, resolved);\n\tconst dropId = resolved.dropId;\n\tconst defaultDirName = resolved.slug || resolved.dropId;\n\n\tconst spin = shouldSpin(deps.outputMode)\n\t\t? createSpinner(\"Pulling content…\", deps.stderr)\n\t\t: undefined;\n\n\tconst deploymentId = input.deployment;\n\tconst manifestOptions = deploymentId ? { deploymentId } : undefined;\n\tconst manifestResult = manifestOptions\n\t\t? await deps.client.drops.getContent(dropId, manifestOptions)\n\t\t: await deps.client.drops.getContent(dropId);\n\tif (manifestResult.error) {\n\t\tspin?.fail();\n\t\treturn writeApiError(deps, manifestResult.error);\n\t}\n\tconst manifest = manifestResult.data as PullManifest;\n\n\tconst outDir = resolve(\n\t\tdeps.cwd ?? process.cwd(),\n\t\tinput.output ?? defaultDirName,\n\t);\n\tlet destinations: Array<{ path: string; dest: string }>;\n\ttry {\n\t\tdestinations = manifest.files.map((file) => ({\n\t\t\tpath: file.path,\n\t\t\tdest: safeDestination(outDir, file.path),\n\t\t}));\n\t} catch (error) {\n\t\tspin?.fail();\n\t\tconst message =\n\t\t\terror instanceof Error ? error.message : \"Invalid manifest path.\";\n\t\treturn writeError(deps, \"local_input_error\", message);\n\t}\n\n\ttry {\n\t\tawait mkdir(outDir, { recursive: true });\n\t\tfor (const { path, dest } of destinations) {\n\t\t\tconst fileResult = await deps.client.drops.getContent(dropId, {\n\t\t\t\tpath,\n\t\t\t\t...(deploymentId ? { deploymentId } : {}),\n\t\t\t});\n\t\t\tif (fileResult.error) {\n\t\t\t\tspin?.fail();\n\t\t\t\treturn writeApiError(deps, {\n\t\t\t\t\t...fileResult.error,\n\t\t\t\t\tmessage: `${path}: ${fileResult.error.message}`,\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst file = fileResult.data as PulledFile;\n\t\t\tawait mkdir(dirname(dest), { recursive: true });\n\t\t\tawait writeFile(dest, file.bytes);\n\t\t}\n\t} catch (error) {\n\t\tspin?.fail();\n\t\tconst message =\n\t\t\terror instanceof Error ? error.message : \"Failed to write files.\";\n\t\treturn writeError(deps, \"local_input_error\", message);\n\t}\n\n\tspin?.stop();\n\tconst count = manifest.files.length;\n\twriteHumanOrJson(\n\t\tdeps,\n\t\tsuccess(`Pulled ${count} ${count === 1 ? \"file\" : \"files\"} to ${outDir}`),\n\t\t{\n\t\t\tok: true,\n\t\t\tpulled: {\n\t\t\t\tdropId: manifest.dropId,\n\t\t\t\tdeploymentId: manifest.deploymentId,\n\t\t\t\trevision: manifest.revision,\n\t\t\t\t...(manifest.entry !== undefined ? { entry: manifest.entry } : {}),\n\t\t\t\tdir: outDir,\n\t\t\t\tfiles: manifest.files,\n\t\t\t},\n\t\t},\n\t);\n\treturn { exitCode: 0 };\n}\n\n/**\n * Joins a manifest file path under the output dir, refusing absolute paths and\n * anything that escapes it. Manifest paths come from the server, but a pulled\n * drop must never write outside the chosen directory.\n */\nfunction safeDestination(outDir: string, filePath: string): string {\n\tif (!filePath || isAbsolute(filePath)) {\n\t\tthrow new Error(`Unsafe file path in content manifest: \"${filePath}\"`);\n\t}\n\tconst dest = join(outDir, filePath);\n\tconst rel = relative(outDir, dest);\n\tif (rel.startsWith(\"..\") || isAbsolute(rel)) {\n\t\tthrow new Error(`Unsafe file path in content manifest: \"${filePath}\"`);\n\t}\n\treturn dest;\n}\n","import type { PublishInput, UpdateContentOptions } from \"@dropthis/node\";\nimport { requireCredential } from \"../auth.js\";\nimport {\n\ttype DropData,\n\tformatDryRunManifest,\n\tisFileSystemError,\n\tloadManifestFile,\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 { CommandDeps, SdkResult } from \"../types.js\";\nimport {\n\ttype DropsResolveClient,\n\tresolveDropTarget,\n\twriteResolvedLine,\n} from \"./drops.js\";\n\ntype UpdateContentClient = DropsResolveClient & {\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\tmanifest?: string;\n\t/** Partial-update mode (ADR 0065). Defaults to \"patch\" when omitted. */\n\tmode?: \"patch\" | \"replace\";\n\t/** Shortcut for `mode: \"replace\"` — wins over an explicit --mode. */\n\treplace?: boolean;\n\t/** Repeatable --delete-path; removes named files (patch-mode only). */\n\tdeletePaths?: 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, 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\n/**\n * Partial-update controls (ADR 0065): the logical mode and the paths to remove.\n * `--replace` wins over an explicit `--mode`. Both fields are omitted unless set,\n * so the server applies its default (\"patch\"). The server enforces all validation\n * (e.g. delete_paths invalid with replace) — the CLI just passes the fields through.\n */\nfunction partialOptions(raw: RawUpdateContentOptions): UpdateContentOptions {\n\tconst out: UpdateContentOptions = {};\n\tif (raw.replace) out.mode = \"replace\";\n\telse if (raw.mode !== undefined) out.mode = raw.mode;\n\tif (raw.deletePaths !== undefined && raw.deletePaths.length > 0) {\n\t\tout.deletePaths = raw.deletePaths;\n\t}\n\treturn out;\n}\n\nexport async function runUpdateContent(\n\ttarget: string,\n\tinput: PublishInput | undefined,\n\traw: RawUpdateContentOptions,\n\tdeps: UpdateContentDeps,\n): Promise<{ exitCode: number }> {\n\tconst apiKey = raw.apiKey ?? deps.apiKey;\n\ttry {\n\t\tawait requireCredential({\n\t\t\t...(apiKey ? { 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\n\t// Accept a drop_… id, a drop URL, or a bare slug. Ids skip resolution; a\n\t// URL/slug resolves owner-scoped to the id, then we mutate strictly by id.\n\tconst resolveDeps: CommandDeps<DropsResolveClient> = {\n\t\t...deps,\n\t\t...(apiKey ? { apiKey } : {}),\n\t};\n\tconst resolved = await resolveDropTarget(target, resolveDeps);\n\tif (!resolved.ok) return { exitCode: resolved.exitCode };\n\tconst dropId = resolved.dropId;\n\n\t// --manifest: load a JSON bundle file. Error if combined with positional input.\n\tif (raw.manifest) {\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\t\"--manifest cannot be combined with a positional input.\",\n\t\t\t\t\"Remove the positional argument, or omit --manifest and pass your files directly.\",\n\t\t\t);\n\t\t}\n\t\ttry {\n\t\t\tinput = await loadManifestFile(raw.manifest);\n\t\t} catch (err) {\n\t\t\tconst msg = err instanceof Error ? err.message : \"Invalid manifest.\";\n\t\t\treturn writeError(deps, \"invalid_usage\", msg);\n\t\t}\n\t}\n\n\tif (raw.dryRun) {\n\t\treturn handleDryRun(dropId, input, raw, deps);\n\t}\n\n\twriteResolvedLine(deps, resolved);\n\n\tlet spin: ReturnType<typeof createSpinner> | undefined;\n\ttry {\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{\n\t\t\t\t\t...contentOptions(parsed),\n\t\t\t\t\t...partialOptions(raw),\n\t\t\t\t\t...revisionOptions,\n\t\t\t\t},\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\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","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 { CommandDeps, SdkResult } from \"../types.js\";\nimport {\n\ttype DropsResolveClient,\n\tresolveDropTarget,\n\twriteResolvedLine,\n} from \"./drops.js\";\n\ntype UpdateSettingsClient = DropsResolveClient & {\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| \"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, --visibility, --password, --no-password, --noindex, \" +\n\t\"--index, --expires-at, --no-expires, --domain, --shared, --slug, --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\ttarget: string,\n\traw: RawUpdateSettingsOptions,\n\tdeps: UpdateSettingsDeps,\n): Promise<{ exitCode: number }> {\n\tconst apiKey = raw.apiKey ?? deps.apiKey;\n\ttry {\n\t\tawait requireCredential({\n\t\t\t...(apiKey ? { 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\n\t// Accept a drop_… id, a drop URL, or a bare slug. Ids skip resolution; a\n\t// URL/slug resolves owner-scoped to the id, then we mutate strictly by id.\n\tconst resolveDeps: CommandDeps<DropsResolveClient> = {\n\t\t...deps,\n\t\t...(apiKey ? { apiKey } : {}),\n\t};\n\tconst resolved = await resolveDropTarget(target, resolveDeps);\n\tif (!resolved.ok) return { exitCode: resolved.exitCode };\n\tconst dropId = resolved.dropId;\n\n\tif (raw.dryRun) {\n\t\treturn handleDryRun(dropId, raw, deps);\n\t}\n\n\twriteResolvedLine(deps, resolved);\n\n\tlet spin: ReturnType<typeof createSpinner> | undefined;\n\ttry {\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: \"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(\"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\tconst options = await parseDropOptions(raw);\n\t\tconst fields: Record<string, unknown> = {};\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 !== undefined) fields.expires_at = options.expiresAt;\n\t\tif (options.metadata) fields.metadata = options.metadata;\n\t\tif (options.domain) fields.domain = options.domain;\n\t\tif (options.slug) fields.slug = options.slug;\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","import { execFile } from \"node:child_process\";\nimport { realpathSync } from \"node:fs\";\nimport { promisify } from \"node:util\";\nimport { writeError, writeHumanOrJson } from \"../fmt.js\";\nimport { compareSemver } from \"../semver.js\";\n\nconst execFileAsync = promisify(execFile);\nconst REGISTRY_LATEST = \"https://registry.npmjs.org/@dropthis%2fcli/latest\";\n\nexport type UpgradeDeps = {\n\tstdout: (value: string) => void;\n\tstderr: (value: string) => void;\n\toutputMode?: \"human\" | \"json\";\n\tcurrentVersion: string;\n\t/** Latest published version from the npm registry, or null when unreachable. */\n\tfetchLatest?: () => Promise<string | null>;\n\t/** True when the running binary lives under npm's global root. */\n\tisNpmGlobalInstall?: () => Promise<boolean>;\n\trunNpmInstall?: () => Promise<{ ok: boolean; message?: string }>;\n};\n\nexport async function fetchLatestFromRegistry(): Promise<string | null> {\n\ttry {\n\t\tconst res = await fetch(REGISTRY_LATEST, {\n\t\t\tsignal: AbortSignal.timeout(10_000),\n\t\t});\n\t\tif (!res.ok) return null;\n\t\tconst body = (await res.json()) as { version?: unknown };\n\t\treturn typeof body.version === \"string\" ? body.version : null;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\n/**\n * deno-upgrade-style detection: only self-update what `npm install -g` owns.\n *\n * Windows limitation: npm-global on Windows uses prefix shims (e.g.\n * %APPDATA%\\npm\\dropthis.cmd) that live outside node_modules, so\n * `entry.startsWith(root)` is always false there. This returns false safely\n * (the CLI refuses to self-update) rather than crashing.\n */\nexport async function detectNpmGlobalInstall(): Promise<boolean> {\n\ttry {\n\t\tconst argv1 = process.argv[1];\n\t\tif (!argv1) return false;\n\t\tconst entry = realpathSync(argv1);\n\t\tconst { stdout } = await execFileAsync(\"npm\", [\"root\", \"-g\"]);\n\t\tconst root = realpathSync(stdout.trim());\n\t\treturn entry.startsWith(root);\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nasync function npmInstallLatest(): Promise<{ ok: boolean; message?: string }> {\n\ttry {\n\t\tawait execFileAsync(\"npm\", [\"install\", \"-g\", \"@dropthis/cli@latest\"]);\n\t\treturn { ok: true };\n\t} catch (err) {\n\t\treturn {\n\t\t\tok: false,\n\t\t\tmessage: err instanceof Error ? err.message : String(err),\n\t\t};\n\t}\n}\n\nexport async function runUpgrade(\n\t_input: { json?: boolean },\n\tdeps: UpgradeDeps,\n): Promise<{ exitCode: number }> {\n\tconst fetchLatest = deps.fetchLatest ?? fetchLatestFromRegistry;\n\tconst isNpmGlobal = deps.isNpmGlobalInstall ?? detectNpmGlobalInstall;\n\tconst install = deps.runNpmInstall ?? npmInstallLatest;\n\n\tconst latest = await fetchLatest();\n\tif (!latest) {\n\t\treturn writeError(\n\t\t\tdeps,\n\t\t\t\"upgrade_check_failed\",\n\t\t\t\"Could not reach the npm registry to check for updates. Try again, or run: npm install -g @dropthis/cli@latest\",\n\t\t);\n\t}\n\n\tif (compareSemver(latest, deps.currentVersion) <= 0) {\n\t\twriteHumanOrJson(\n\t\t\tdeps,\n\t\t\t`Already on latest version (${deps.currentVersion})`,\n\t\t\t{ ok: true, status: \"already-latest\", version: deps.currentVersion },\n\t\t);\n\t\treturn { exitCode: 0 };\n\t}\n\n\tif (!(await isNpmGlobal())) {\n\t\treturn writeError(\n\t\t\tdeps,\n\t\t\t\"unsupported_install\",\n\t\t\t`Update available (${deps.currentVersion} → ${latest}), but this install was not made with \\`npm install -g\\`. Upgrade with the installer you used, e.g.: npm install -g @dropthis/cli@latest`,\n\t\t);\n\t}\n\n\tif (deps.outputMode === \"human\") {\n\t\tdeps.stdout(`Updating ${deps.currentVersion} → ${latest}...\\n`);\n\t}\n\n\tconst result = await install();\n\tif (!result.ok) {\n\t\treturn writeError(\n\t\t\tdeps,\n\t\t\t\"upgrade_failed\",\n\t\t\t`npm install failed${result.message ? `: ${result.message}` : \"\"}. Try: npm install -g @dropthis/cli@latest`,\n\t\t);\n\t}\n\n\twriteHumanOrJson(deps, `Updated ${deps.currentVersion} → ${latest}`, {\n\t\tok: true,\n\t\tstatus: \"upgraded\",\n\t\tfrom: deps.currentVersion,\n\t\tto: latest,\n\t});\n\treturn { exitCode: 0 };\n}\n","/** Numeric x.y.z comparison (pre-release suffixes compare on the core triplet only). */\nexport function compareSemver(a: string, b: string): number {\n\tconst parse = (v: string) => (v.split(\"-\")[0] ?? v).split(\".\").map(Number);\n\tconst pa = parse(a);\n\tconst pb = parse(b);\n\tfor (let i = 0; i < 3; i++) {\n\t\tconst d = (pa[i] ?? 0) - (pb[i] ?? 0);\n\t\tif (d !== 0) return d < 0 ? -1 : 1;\n\t}\n\treturn 0;\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\t// Capability scopes are read from the STORED credential (recorded at mint\n\t// time) — no server round-trip — so a scoped key visibly advertises what it\n\t// can do (ADR 0068).\n\tif (credential.scopes?.length)\n\t\tpairs.push([\"Scopes\", credential.scopes.join(\", \")]);\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\t...(credential.scopes?.length ? { scopes: credential.scopes } : {}),\n\t};\n\twriteKv(deps, pairs, jsonEnvelope);\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} from \"../fmt.js\";\nimport { type CommandDeps, type SdkResult, unwrapListData } from \"../types.js\";\nimport { hint, success } from \"../ui.js\";\n\ntype WorkspaceRow = {\n\tid: string;\n\tname: string;\n\tslug: string;\n\tkind: string;\n\trole: string;\n\tplan: string;\n\tisActive: boolean;\n\tcreatorCanReach?: boolean;\n};\n\ntype WorkspaceListClient = {\n\tworkspaces: {\n\t\t// GET /v1/workspaces returns { workspaces: [...] }, not a { object, data } page.\n\t\tlist(): Promise<SdkResult<{ workspaces: WorkspaceRow[] } | null>>;\n\t};\n};\n\ntype WorkspaceUseClient = {\n\tworkspaces: {\n\t\tuse(slugOrId: string): Promise<SdkResult<WorkspaceRow>>;\n\t};\n};\n\ntype WorkspaceCreateClient = {\n\tworkspaces: {\n\t\tcreate(input: {\n\t\t\tname: string;\n\t\t\tslug?: string;\n\t\t}): Promise<SdkResult<WorkspaceRow>>;\n\t};\n};\n\ntype WorkspaceRenameClient = {\n\tworkspaces: {\n\t\trename(\n\t\t\tworkspaceId: string,\n\t\t\tinput: { name?: string; slug?: string },\n\t\t): Promise<SdkResult<WorkspaceRow>>;\n\t};\n};\n\n// DELETE /v1/workspaces/{id} returns 204 No Content; the SDK types it\n// DropthisResult<null>. Success is `error === null` — never read result.data.\ntype WorkspaceDeleteClient = {\n\tworkspaces: {\n\t\tdelete(\n\t\t\tworkspaceId: string,\n\t\t): Promise<SdkResult<null>> | SdkResult<null> | undefined;\n\t};\n};\n\nexport async function runWorkspaceList(\n\t_input: { json?: boolean },\n\tdeps: CommandDeps<WorkspaceListClient>,\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\n\tconst result = await deps.client.workspaces.list();\n\tif (result.error) return writeApiError(deps, result.error);\n\n\t// GET /v1/workspaces returns { workspaces: [...] } (not a { data } page), so fall back to the\n\t// `workspaces` key — otherwise the list came back empty.\n\tconst raw = unwrapListData(result.data, \"workspaces\");\n\tconst items = Array.isArray(raw) ? (raw as WorkspaceRow[]) : [];\n\n\tif (deps.outputMode === \"human\") {\n\t\tif (items.length === 0) {\n\t\t\twriteEmpty(deps, \"No workspaces found.\", { ok: true, workspaces: [] });\n\t\t} else {\n\t\t\tfor (const ws of items) {\n\t\t\t\tconst active = ws.isActive ? \"* \" : \" \";\n\t\t\t\tdeps.stdout(\n\t\t\t\t\t`${active}${ws.slug} ${ws.name} (${ws.kind}, ${ws.role}, ${ws.plan})\\n`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tconst activeWorkspace = items.find((w) => w.isActive) ?? null;\n\t\twriteJson(deps, { ok: true, workspaces: items, active: activeWorkspace });\n\t}\n\n\treturn { exitCode: 0 };\n}\n\nexport async function runWorkspaceUse(\n\tslugOrId: string,\n\t_input: { json?: boolean },\n\tdeps: CommandDeps<WorkspaceUseClient>,\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\n\tconst result = await deps.client.workspaces.use(slugOrId);\n\tif (result.error) return writeApiError(deps, result.error);\n\n\tconst ws = result.data;\n\twriteHumanOrJson(\n\t\tdeps,\n\t\tsuccess(`Now using workspace: ${ws.name} (${ws.slug})`),\n\t\t{ ok: true, workspace: ws },\n\t);\n\n\treturn { exitCode: 0 };\n}\n\nexport async function runWorkspaceCreate(\n\tinput: { name: string; slug?: string; json?: boolean },\n\tdeps: CommandDeps<WorkspaceCreateClient>,\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\n\tconst createInput: { name: string; slug?: string } = { name: input.name };\n\tif (input.slug !== undefined) createInput.slug = input.slug;\n\n\tconst result = await deps.client.workspaces.create(createInput);\n\tif (result.error) return writeApiError(deps, result.error);\n\n\tconst ws = result.data;\n\twriteHumanOrJson(\n\t\tdeps,\n\t\tsuccess(`Created workspace: ${ws.name} (${ws.slug})`),\n\t\t{\n\t\t\tok: true,\n\t\t\tworkspace: ws,\n\t\t},\n\t);\n\n\t// The minting key may not be able to reach a brand-new workspace (e.g. its\n\t// allowlist is fixed at mint time). Flag it on stderr in human mode so the\n\t// user knows to re-authenticate; JSON output stays clean for piping.\n\tif (ws.creatorCanReach === false && deps.outputMode === \"human\") {\n\t\tdeps.stderr(\n\t\t\t`${hint(\"This key can't reach the new workspace — re-authenticate (dropthis login) to pick it up.\")}\\n`,\n\t\t);\n\t}\n\n\treturn { exitCode: 0 };\n}\n\nexport async function runWorkspaceRename(\n\tworkspaceId: string,\n\tinput: { name?: string; slug?: string; json?: boolean },\n\tdeps: CommandDeps<WorkspaceRenameClient>,\n): Promise<{ exitCode: number }> {\n\tif (input.name === undefined && input.slug === undefined) {\n\t\treturn writeError(\n\t\t\tdeps,\n\t\t\t\"invalid_usage\",\n\t\t\t\"Provide --name and/or --slug to rename.\",\n\t\t);\n\t}\n\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\n\tconst renameInput: { name?: string; slug?: string } = {};\n\tif (input.name !== undefined) renameInput.name = input.name;\n\tif (input.slug !== undefined) renameInput.slug = input.slug;\n\n\tconst result = await deps.client.workspaces.rename(workspaceId, renameInput);\n\tif (result.error) return writeApiError(deps, result.error);\n\n\tconst ws = result.data;\n\twriteHumanOrJson(\n\t\tdeps,\n\t\tsuccess(`Renamed workspace: ${ws.name} (${ws.slug})`),\n\t\t{\n\t\t\tok: true,\n\t\t\tworkspace: ws,\n\t\t},\n\t);\n\n\treturn { exitCode: 0 };\n}\n\nexport async function runWorkspaceDelete(\n\tworkspaceId: string,\n\tinput: { yes?: boolean; json?: boolean; interactive?: boolean },\n\tdeps: CommandDeps<WorkspaceDeleteClient>,\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 workspace ${workspaceId}?`,\n\t\t});\n\t\tif (prompts.isCancel(confirmed) || !confirmed) {\n\t\t\treturn { exitCode: 0 };\n\t\t}\n\t}\n\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\n\tconst result = await deps.client.workspaces.delete(workspaceId);\n\tif (result?.error) return writeApiError(deps, result.error);\n\n\twriteHumanOrJson(deps, success(`Deleted workspace ${workspaceId}`), {\n\t\tok: true,\n\t\tdeleted: true,\n\t\tid: workspaceId,\n\t});\n\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\tscopes?: 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","import { stat } from \"node:fs/promises\";\n\n/**\n * Guards the publish path against typo-publishing a ghost drop: `dropthis lst`\n * would otherwise publish the literal text \"lst\". Pure helpers live here;\n * program.ts wires them into the publish action. The command-match guard fires\n * in EVERY mode (agents run non-interactive, so that path was the least\n * protected); the inline-text confirmation prompt stays human/TTY-only.\n */\n\n/** Levenshtein edit distance. Inputs are command-name sized; O(m*n) is fine. */\nexport function levenshtein(a: string, b: string): number {\n\tif (a === b) return 0;\n\tif (a.length === 0) return b.length;\n\tif (b.length === 0) return a.length;\n\tlet prev = Array.from({ length: b.length + 1 }, (_, j) => j);\n\tfor (let i = 1; i <= a.length; i++) {\n\t\tconst curr = [i];\n\t\tfor (let j = 1; j <= b.length; j++) {\n\t\t\tconst cost = a[i - 1] === b[j - 1] ? 0 : 1;\n\t\t\tconst deletion = (prev[j] ?? 0) + 1;\n\t\t\tconst insertion = (curr[j - 1] ?? 0) + 1;\n\t\t\tconst substitution = (prev[j - 1] ?? 0) + cost;\n\t\t\tcurr[j] = Math.min(deletion, insertion, substitution);\n\t\t}\n\t\tprev = curr;\n\t}\n\treturn prev[b.length] ?? 0;\n}\n\n/**\n * Returns the command name a bare token most likely meant, or null when\n * nothing is close. A prefix of a command (length >= 2) or an edit distance\n * <= 2 (and strictly less than the token length) counts as similar.\n */\nexport function suggestCommand(token: string, names: string[]): string | null {\n\tconst lower = token.toLowerCase();\n\tlet best: { name: string; dist: number } | null = null;\n\tfor (const name of names) {\n\t\tif (lower.length >= 2 && name.startsWith(lower)) return name;\n\t\tconst dist = levenshtein(lower, name);\n\t\tif (best === null || dist < best.dist) best = { name, dist };\n\t}\n\tif (best !== null && best.dist <= 2 && best.dist < lower.length) {\n\t\treturn best.name;\n\t}\n\treturn null;\n}\n\n/**\n * True when a publish argv token is a single bare extension-less non-URL\n * word — the shape that is more likely a mistyped command than content.\n */\nexport function isBareWordToken(token: string): boolean {\n\tif (token === \"\" || token === \"-\") return false;\n\tif (/\\s/.test(token)) return false;\n\tif (token.includes(\"/\") || token.includes(\"\\\\\")) return false;\n\tif (token.includes(\".\")) return false;\n\treturn true;\n}\n\n/** True when the token names an existing file or directory. */\nexport async function pathExists(path: string): Promise<boolean> {\n\ttry {\n\t\tawait stat(path);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n","import { spawn } from \"node:child_process\";\nimport { readFileSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { compareSemver } from \"./semver.js\";\n\nexport type UpdateCheckCache = {\n\tlastCheckedAt: string;\n\tlatestVersion: string;\n};\n\nconst CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000;\nconst REGISTRY_LATEST = \"https://registry.npmjs.org/@dropthis%2fcli/latest\";\n\n/** Same config dir as credentials.json (see storage.ts credentialPath). */\nexport function updateCachePath(configDir?: string): string {\n\treturn join(\n\t\tconfigDir ?? join(homedir(), \".config\", \"dropthis\"),\n\t\t\"update-check.json\",\n\t);\n}\n\nexport function readCache(path: string): UpdateCheckCache | null {\n\ttry {\n\t\tconst value = JSON.parse(readFileSync(path, \"utf8\")) as Record<\n\t\t\tstring,\n\t\t\tunknown\n\t\t>;\n\t\tif (\n\t\t\ttypeof value.lastCheckedAt !== \"string\" ||\n\t\t\ttypeof value.latestVersion !== \"string\"\n\t\t)\n\t\t\treturn null;\n\t\treturn {\n\t\t\tlastCheckedAt: value.lastCheckedAt,\n\t\t\tlatestVersion: value.latestVersion,\n\t\t};\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nexport function shouldShowNotice(input: {\n\tenv: Record<string, string | undefined>;\n\tstderrIsTTY: boolean;\n\targv: string[];\n}): boolean {\n\tif (input.env.CI) return false;\n\tif (input.env.DROPTHIS_NO_UPDATE_NOTIFIER) return false;\n\tif (!input.stderrIsTTY) return false;\n\tif (\n\t\tinput.argv.includes(\"--json\") ||\n\t\tinput.argv.includes(\"--quiet\") ||\n\t\tinput.argv.includes(\"-q\")\n\t)\n\t\treturn false;\n\treturn true;\n}\n\nexport function noticeFromCache(input: {\n\tcache: UpdateCheckCache | null;\n\tcurrentVersion: string;\n}): string | null {\n\tif (!input.cache) return null;\n\tif (compareSemver(input.cache.latestVersion, input.currentVersion) <= 0)\n\t\treturn null;\n\treturn `Update available ${input.currentVersion} → ${input.cache.latestVersion} · run \\`dropthis upgrade\\``;\n}\n\nexport function shouldRefresh(\n\tcache: UpdateCheckCache | null,\n\tnow: Date,\n): boolean {\n\tif (!cache) return true;\n\tconst last = Date.parse(cache.lastCheckedAt);\n\tif (Number.isNaN(last)) return true;\n\treturn now.getTime() - last >= CHECK_INTERVAL_MS;\n}\n\ntype SpawnFn = (\n\tcommand: string,\n\targs: string[],\n\toptions: { detached: boolean; stdio: \"ignore\" },\n) => { unref(): void };\n\n/**\n * update-notifier approach: a detached child fetches the registry and writes the\n * cache so THIS run pays zero latency; the notice shows on the NEXT run.\n */\nexport function scheduleBackgroundRefresh(\n\tcachePath: string,\n\tspawnFn: SpawnFn = spawn as SpawnFn,\n): void {\n\tconst script = `\nconst [, cachePath] = process.argv;\nfetch(${JSON.stringify(REGISTRY_LATEST)}, { signal: AbortSignal.timeout(5000) })\n\t.then((r) => (r.ok ? r.json() : Promise.reject(new Error(String(r.status)))))\n\t.then((d) => {\n\t\tconst fs = require(\"node:fs\");\n\t\tconst path = require(\"node:path\");\n\t\tfs.mkdirSync(path.dirname(cachePath), { recursive: true });\n\t\tfs.writeFileSync(cachePath, JSON.stringify({ lastCheckedAt: new Date().toISOString(), latestVersion: String(d.version) }));\n\t})\n\t.catch(() => {});\n`;\n\tconst child = spawnFn(process.execPath, [\"-e\", script, cachePath], {\n\t\tdetached: true,\n\t\tstdio: \"ignore\",\n\t});\n\tchild.unref();\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;AAC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AAM,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","resolve","import_node_os","error","error","import_picocolors","import_picocolors","pc","pc","text","pc","prompts","import_picocolors","pc","resolve","prompts","import_picocolors","pc","prompts","prompts","error","import_promises","import_picocolors","pc","hasInput","error","import_promises","error","error","prompts","handleDryRun","prompts","error","cancel","parseJsonObject","prompts","import_node","import_promises","import_node_path","error","import_promises","pc","prompts","deps","global","result","runInlineAuth","import_node_child_process","import_node_fs","import_node_os","import_node_path","REGISTRY_LATEST","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/version.ts","../src/commands/doctor.ts","../src/commands/domains.ts","../src/commands/drops.ts","../src/commands/invitations.ts","../src/commands/login.ts","../src/commands/logout.ts","../src/commands/members.ts","../src/drop-operations.ts","../src/options.ts","../src/spinner.ts","../src/commands/publish.ts","../src/commands/pull.ts","../src/commands/update-content.ts","../src/commands/update-settings.ts","../src/commands/upgrade.ts","../src/semver.ts","../src/commands/whoami.ts","../src/commands/workspace.ts","../src/context.ts","../src/storage.ts","../src/typo-guard.ts","../src/update-check.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\";\nimport { hint } from \"./ui.js\";\nimport {\n\tnoticeFromCache,\n\treadCache,\n\tscheduleBackgroundRefresh,\n\tshouldRefresh,\n\tshouldShowNotice,\n\tupdateCachePath,\n} from \"./update-check.js\";\nimport { CLI_VERSION } from \"./version.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}\n\t// Human mode: commander's configureOutput.outputError already printed the\n\t// usage error (with suggestions) — printing it again would double it.\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\n// Read cache once; both notice and refresh scheduling use the same snapshot.\nconst updateCache = readCache(updateCachePath());\nconst showNotice = shouldShowNotice({\n\tenv: process.env as Record<string, string | undefined>,\n\tstderrIsTTY: process.stderr.isTTY === true,\n\targv: process.argv.slice(2),\n});\n\n// Print cached notice to stderr BEFORE dispatch — zero latency.\nif (showNotice) {\n\tconst notice = noticeFromCache({\n\t\tcache: updateCache,\n\t\tcurrentVersion: CLI_VERSION,\n\t});\n\tif (notice) {\n\t\tprocess.stderr.write(`\\n${hint(notice)}\\n\\n`);\n\t}\n}\n\nbuildProgram({ store: createCredentialStore() })\n\t.parseAsync(process.argv)\n\t.finally(() => {\n\t\t// Only humans on TTYs ever see the notice, so only they pay for the refresh.\n\t\tif (showNotice && shouldRefresh(updateCache, new Date())) {\n\t\t\tscheduleBackgroundRefresh(updateCachePath());\n\t\t}\n\t})\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| \"unsupported_install\"\n\t| \"upgrade_check_failed\"\n\t| \"upgrade_failed\"\n\t| \"usage_error\"\n\t| \"verify_pending\"\n\t| \"verify_timeout\";\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\t// Unified plan-gate fields (feature_not_in_plan / quota_exceeded).\n\tfeature?: string | null;\n\tcurrentPlan?: string | null;\n\trequiredPlan?: string | null;\n\tupgradeUrl?: string | null;\n\tlimit?: number | null;\n\tused?: number | null;\n\trequested?: number | null;\n\tbody?: unknown;\n};\n\nexport type FileFailure = { path: string; reason: string; sourceUrl?: string };\n\nexport function failuresFromApiError(error: ApiErrorDetails): FileFailure[] {\n\tconst body = error.body;\n\tconst raw =\n\t\tbody && typeof body === \"object\"\n\t\t\t? (body as { failures?: unknown }).failures\n\t\t\t: undefined;\n\tif (!Array.isArray(raw)) return [];\n\treturn raw\n\t\t.filter(\n\t\t\t(f): f is Record<string, unknown> =>\n\t\t\t\t!!f &&\n\t\t\t\ttypeof f === \"object\" &&\n\t\t\t\ttypeof (f as { path?: unknown }).path === \"string\" &&\n\t\t\t\t(f as { path: string }).path.length > 0,\n\t\t)\n\t\t.map((f) => ({\n\t\t\tpath: String(f.path),\n\t\t\treason: String(f.reason ?? \"unknown\"),\n\t\t\t...(typeof f.source_url === \"string\" ? { sourceUrl: f.source_url } : {}),\n\t\t}));\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\tconst failures = failuresFromApiError(error);\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\t...(error.feature ? { feature: error.feature } : {}),\n\t\t\t...(error.currentPlan ? { current_plan: error.currentPlan } : {}),\n\t\t\t...(error.requiredPlan ? { required_plan: error.requiredPlan } : {}),\n\t\t\t...(error.upgradeUrl ? { upgrade_url: error.upgradeUrl } : {}),\n\t\t\t...(typeof error.limit === \"number\" ? { limit: error.limit } : {}),\n\t\t\t...(typeof error.used === \"number\" ? { used: error.used } : {}),\n\t\t\t...(typeof error.requested === \"number\"\n\t\t\t\t? { requested: error.requested }\n\t\t\t\t: {}),\n\t\t\t...(failures.length ? { failures } : {}),\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\n/**\n * Picks the next_action line for an API error. JSON mode keeps the server's\n * `suggestion` verbatim (agent contract). Human mode prefers the CLI-register\n * hint for codes the CLI has a native fallback for — server suggestions speak\n * REST, while a terminal user needs a runnable command.\n */\nexport function nextActionForApiError(\n\terror: ApiErrorDetails,\n\tmode: \"human\" | \"json\" = \"json\",\n): string {\n\tconst cliHint = cliNextAction(error);\n\t// workspace_choice_required: the server suggestion speaks the SDK/REST contract\n\t// (`options.workspace`), which is NOT a CLI surface — a CLI agent that obeys it\n\t// literally walks off a cliff. The runnable CLI command must win in BOTH modes.\n\tif (error.code === \"workspace_choice_required\" && cliHint) return cliHint;\n\tif (mode === \"human\" && cliHint) return cliHint;\n\tif (error.suggestion) return error.suggestion;\n\tif (cliHint) return cliHint;\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\n/** Slugs of the eligible workspaces a `workspace_choice_required` 409 carries in\n * its RFC 7807 `choices` field, so the CLI can name the actual targets to pick from. */\nfunction workspaceChoiceSlugs(error: ApiErrorDetails): string[] {\n\tconst body = error.body;\n\tconst raw =\n\t\tbody && typeof body === \"object\"\n\t\t\t? (body as { choices?: unknown }).choices\n\t\t\t: undefined;\n\tif (!Array.isArray(raw)) return [];\n\treturn raw\n\t\t.map((c) =>\n\t\t\tc && typeof c === \"object\" ? (c as { slug?: unknown }).slug : undefined,\n\t\t)\n\t\t.filter((s): s is string => typeof s === \"string\" && s.length > 0);\n}\n\n/** CLI-register hints for known error codes; undefined when not in the table. */\nfunction cliNextAction(error: ApiErrorDetails): string | undefined {\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 === \"workspace_choice_required\") {\n\t\tconst slugs = workspaceChoiceSlugs(error);\n\t\tconst example = slugs[0] ?? \"<slug>\";\n\t\tconst list = slugs.length ? ` Workspaces: ${slugs.join(\", \")}.` : \"\";\n\t\treturn `This account belongs to more than one workspace — pick one. Switch it for every later command with: dropthis workspace use ${example} — or target just this one with: --workspace ${example}.${list}`;\n\t}\n\tif (error.code === \"network_error\") {\n\t\treturn \"Could not reach the dropthis API — check your network or DROPTHIS_API_URL.\";\n\t}\n\tif (error.code === \"workspace_pinned\") {\n\t\treturn \"Service keys are pinned to one workspace. To switch workspaces, use a delegated login (run: dropthis login) instead of a service key.\";\n\t}\n\tif (error.code === \"workspace_selector_not_allowed\") {\n\t\treturn \"Service keys (sk_) are pinned to one workspace and cannot target another with --workspace. Use a delegated login key (run: dropthis login), or run without --workspace.\";\n\t}\n\tif (error.code === \"revision_conflict\") {\n\t\treturn \"Re-read the drop with dropthis get <drop-id>, merge your changes, and retry with --if-revision set to the current revision.\";\n\t}\n\tif (error.code === \"publish_conflict\") {\n\t\treturn \"The drop changed state mid-publish (likely deleted). Run dropthis publish again to create a fresh drop.\";\n\t}\n\tif (error.code === \"access_token_cannot_delete_account\") {\n\t\treturn \"Account deletion needs a real API key, not a login session. Create one with dropthis api-keys create, then re-run with --api-key sk_…\";\n\t}\n\t// OTP login outcomes (dropthis#80): expired codes are safe to resend; a wrong\n\t// code is not — re-check the digits, don't churn a fresh code.\n\tif (error.code === \"otp_expired\") {\n\t\treturn \"Request a fresh code with: dropthis login request --email <email>.\";\n\t}\n\tif (error.code === \"otp_invalid\") {\n\t\treturn \"Re-enter the code from your email; if it keeps failing, request a fresh one with dropthis login request --email <email>.\";\n\t}\n\tif (error.code === \"workspace_not_found\") {\n\t\treturn \"Workspace not found. List your workspaces with: dropthis workspace list\";\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.code === \"invalid_api_key\") {\n\t\treturn \"API key is invalid or revoked. Run dropthis login to re-authenticate, or set a valid DROPTHIS_API_KEY.\";\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\treturn undefined;\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\tif (code === \"verify_pending\") return 6;\n\tif (code === \"verify_timeout\") return 7;\n\treturn 1;\n}\n\n/**\n * Documented meaning of every process exit code, for the machine catalog\n * (`dropthis commands --json`). Mirrors exitCodeFor so an agent can branch on\n * the outcome — distinguishing re-auth (3) from network-retry (5) from a\n * domain still verifying (6) without parsing prose. Keep in sync with\n * exitCodeFor when adding a code.\n */\nexport const EXIT_CODES: Record<string, string> = {\n\t\"0\": \"success\",\n\t\"1\": \"api_error — the server returned an error (see the error envelope)\",\n\t\"2\": \"invalid_usage — bad arguments, bad options, or an unknown command\",\n\t\"3\": \"auth_error — missing or invalid credential; re-authenticate (dropthis login)\",\n\t\"4\": \"local_input_error — a local file or path could not be read\",\n\t\"5\": \"network_error — could not reach the API; safe to retry\",\n\t\"6\": \"verify_pending — a domain is not verified yet; retry later (domains verify)\",\n\t\"7\": \"verify_timeout — domain verification timed out while waiting (--wait)\",\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 {\n\trunDomainsConnect,\n\trunDomainsList,\n\trunDomainsRemove,\n\trunDomainsStatus,\n\trunDomainsUpdate,\n\trunDomainsVerify,\n} from \"./commands/domains.js\";\nimport {\n\trunDropsDelete,\n\trunDropsGet,\n\trunDropsList,\n\trunDropsResolve,\n} from \"./commands/drops.js\";\nimport {\n\trunInvitationsAccept,\n\trunInvitationsAcceptById,\n\trunInvitationsList,\n} from \"./commands/invitations.js\";\nimport {\n\trunLoginInteractive,\n\trunLoginRequest,\n\trunLoginVerify,\n} from \"./commands/login.js\";\nimport { runLogout } from \"./commands/logout.js\";\nimport {\n\trunMembersInvite,\n\trunMembersList,\n\trunMembersRemove,\n\trunMembersRole,\n} from \"./commands/members.js\";\nimport { runPublish } from \"./commands/publish.js\";\nimport { runPull } from \"./commands/pull.js\";\nimport { runUpdateContent } from \"./commands/update-content.js\";\nimport { runUpdateSettings } from \"./commands/update-settings.js\";\nimport { runUpgrade } from \"./commands/upgrade.js\";\nimport { runWhoami } from \"./commands/whoami.js\";\nimport {\n\trunWorkspaceCreate,\n\trunWorkspaceDelete,\n\trunWorkspaceList,\n\trunWorkspaceRename,\n\trunWorkspaceUse,\n} from \"./commands/workspace.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\";\nimport { isBareWordToken, pathExists, suggestCommand } from \"./typo-guard.js\";\nimport { CLI_VERSION } from \"./version.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.showSuggestionAfterError();\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(CLI_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\tprogram.addHelpText(\n\t\t\"after\",\n\t\t[\n\t\t\t\"\",\n\t\t\t\"Output is JSON when piped/CI/--json; human tables in a terminal.\",\n\t\t\t\"Docs: https://dropthis.app\",\n\t\t].join(\"\\n\"),\n\t);\n\n\tconst examplesBlock = (lines: string[]): string =>\n\t\t`\\n${pc.bold(\"Examples:\")}\\n${lines.map((l) => ` ${l}`).join(\"\\n\")}\\n`;\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/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(\n\t\t\t\"--domain <hostname>\",\n\t\t\t\"Serve this drop under a connected custom domain (must be live — see: dropthis domains list). Path-mode: drop lives at https://domain/{slug}/. Dedicated: drop is at the root (409 if occupied). Omit to use the account's default path domain. To publish to the shared pool instead, use --shared.\",\n\t\t)\n\t\t.option(\n\t\t\t\"--shared\",\n\t\t\t\"Deliberately publish to the shared dropthis pool, bypassing your default custom domain (an off-domain publish). Cannot combine with --domain.\",\n\t\t)\n\t\t.option(\n\t\t\t\"--slug <vanity-slug>\",\n\t\t\t\"Vanity slug for path-mode custom domains (1–63 lowercase letters/digits/hyphens). Auto-suffixed if taken. Only valid with --domain on a path-mode domain.\",\n\t\t)\n\t\t.option(\n\t\t\t\"--manifest <file>\",\n\t\t\t\"Publish a multi-file bundle defined in a JSON file (path, content/source_url/content_base64 per file). Cannot combine with a positional input.\",\n\t\t)\n\t\t.option(\n\t\t\t\"--workspace <slugOrId>\",\n\t\t\t\"Target workspace slug or id for this publish (delegated keys only; overrides server-side active workspace for this call)\",\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 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.addHelpText(\n\t\t\t\"after\",\n\t\t\texamplesBlock([\n\t\t\t\t\"dropthis publish ./report.html\",\n\t\t\t\t\"dropthis publish ./dist --title 'Launch page'\",\n\t\t\t\t\"cat report.md | dropthis publish - --content-type text/markdown --path report.md\",\n\t\t\t\t\"dropthis publish ./dist --domain reports.example.com --slug launch\",\n\t\t\t\t\"dropthis publish ./report.html --shared # bypass your default domain → shared pool\",\n\t\t\t\t\"URL=$(dropthis publish ./dist --url)\",\n\t\t\t]),\n\t\t)\n\t\t.addHelpText(\n\t\t\t\"after\",\n\t\t\t[\n\t\t\t\t`\\n${pc.bold(\"Canonical vs raw URLs:\")}`,\n\t\t\t\t\" The canonical URL (the one printed) is always a branded human view, so the\",\n\t\t\t\t\" badge is guaranteed — hand it to people. For a single non-HTML file (e.g. a\",\n\t\t\t\t\" .md or .json), publish also prints a 'Raw:' line: the raw bytes at their\",\n\t\t\t\t\" natural path, with no wrapper — hand this to other agents. HTML drops and\",\n\t\t\t\t\" multi-file collections have no raw URL (the page IS the artifact / per-file\",\n\t\t\t\t\" paths come from the manifest).\",\n\t\t\t].join(\"\\n\"),\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 && !commandOptions.manifest) {\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\t// When --manifest is given without positional args, skip stdin resolution\n\t\t\t// entirely (reading stdin would block). The manifest loading happens inside\n\t\t\t// runPublish after auth resolves.\n\t\t\tlet publishInput: string | string[] | undefined;\n\t\t\tif (inputs.length > 0 || !commandOptions.manifest) {\n\t\t\t\ttry {\n\t\t\t\t\tpublishInput = 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}\n\n\t\t\t// Typo guard: a single bare extension-less argv token that is not an\n\t\t\t// existing file and closely matches a command name is more likely a\n\t\t\t// mistyped command than inline text — `dropthis lst` must not mint a\n\t\t\t// ghost drop \"lst\". The command-match branch fires in EVERY mode:\n\t\t\t// agents run non-interactive, so this footgun-prone path was previously\n\t\t\t// the LEAST protected. A bare word that matches no command still\n\t\t\t// publishes (legit short text); only in human/TTY mode do we then\n\t\t\t// confirm before publishing such a word.\n\t\t\t//\n\t\t\t// Only the DEFAULT-command path is guarded. When the user types\n\t\t\t// `dropthis publish <text>` explicitly, the text is intentional and is\n\t\t\t// NEVER second-guessed — even when it equals a command name (so\n\t\t\t// `dropthis publish list` publishes the literal word \"list\"). `rawArgs`\n\t\t\t// holds the full argv (same source as jsonModeForOutput above).\n\t\t\tconst publishWasExplicit = (\n\t\t\t\t(program as Command & { rawArgs?: string[] }).rawArgs ?? []\n\t\t\t).includes(\"publish\");\n\t\t\tif (\n\t\t\t\t!publishWasExplicit &&\n\t\t\t\tinputs.length === 1 &&\n\t\t\t\ttypeof publishInput === \"string\" &&\n\t\t\t\tisBareWordToken(publishInput) &&\n\t\t\t\t!(await pathExists(publishInput))\n\t\t\t) {\n\t\t\t\tconst suggestion = suggestCommand(\n\t\t\t\t\tpublishInput,\n\t\t\t\t\tprogram.commands.map((c) => c.name()),\n\t\t\t\t);\n\t\t\t\tif (suggestion) {\n\t\t\t\t\tprocess.exitCode = writeError(\n\t\t\t\t\t\tdeps,\n\t\t\t\t\t\t\"invalid_usage\",\n\t\t\t\t\t\t`Unknown command '${publishInput}' — did you mean '${suggestion}'?`,\n\t\t\t\t\t\t`To publish the literal text, pipe it: echo '${publishInput}' | dropthis publish`,\n\t\t\t\t\t).exitCode;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (deps.outputMode === \"human\" && deps.interactive) {\n\t\t\t\t\tconst prompts = await import(\"@clack/prompts\");\n\t\t\t\t\tconst confirmed = await prompts.confirm({\n\t\t\t\t\t\tmessage: `Publish '${publishInput}' as inline text?`,\n\t\t\t\t\t\tinitialValue: false,\n\t\t\t\t\t});\n\t\t\t\t\tif (prompts.isCancel(confirmed) || !confirmed) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\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, 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\"--manifest <file>\",\n\t\t\t\"Update content from a multi-file bundle defined in a JSON file (path, content/source_url/content_base64 per file). Cannot combine with a positional input.\",\n\t\t)\n\t\t.option(\n\t\t\t\"--mode <mode>\",\n\t\t\t\"patch (default: provided files upsert, the rest carry forward) or replace (provided files become the whole content set)\",\n\t\t\tparseMode,\n\t\t)\n\t\t.option(\"--replace\", \"Shortcut for --mode replace (full content swap)\")\n\t\t.option(\n\t\t\t\"--delete-path <path>\",\n\t\t\t\"Remove a file by path (patch-mode only; repeatable). Invalid with --replace.\",\n\t\t\tcollect,\n\t\t\t[] as string[],\n\t\t)\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 & {\n\t\t\t\t\tifRevision?: number;\n\t\t\t\t\tmode?: \"patch\" | \"replace\";\n\t\t\t\t\treplace?: boolean;\n\t\t\t\t\tdeletePath?: string[];\n\t\t\t\t},\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\t// When --manifest is given without positional args, skip stdin resolution\n\t\t\t\t// entirely (reading stdin would block). The manifest loading happens inside\n\t\t\t\t// runUpdateContent after auth resolves.\n\t\t\t\tlet updateInput: string | string[] | undefined;\n\t\t\t\tif (inputs.length > 0 || !commandOptions.manifest) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tupdateInput = await resolvePublishInputs(\n\t\t\t\t\t\t\tinputs,\n\t\t\t\t\t\t\toptions.stdin,\n\t\t\t\t\t\t\tstdinIsTTY,\n\t\t\t\t\t\t);\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\tconst msg = err instanceof Error ? err.message : \"Invalid input.\";\n\t\t\t\t\t\tprocess.exitCode = writeError(\n\t\t\t\t\t\t\tdeps,\n\t\t\t\t\t\t\t\"local_input_error\",\n\t\t\t\t\t\t\tmsg,\n\t\t\t\t\t\t).exitCode;\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\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\t// Partial-update controls (ADR 0065): mode/replace/delete-path are\n\t\t\t\t// content-update-specific and aren't carried by toDropOptions. --replace\n\t\t\t\t// wins as mode:\"replace\"; the server enforces all validation.\n\t\t\t\tconst deletePaths = commandOptions.deletePath ?? [];\n\t\t\t\tconst updateOpts = {\n\t\t\t\t\t...dropOpts,\n\t\t\t\t\t...(commandOptions.replace\n\t\t\t\t\t\t? { mode: \"replace\" as const }\n\t\t\t\t\t\t: commandOptions.mode !== undefined\n\t\t\t\t\t\t\t? { mode: commandOptions.mode }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t...(deletePaths.length > 0 ? { deletePaths } : {}),\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\tupdateOpts,\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, 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(\"--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(\"--no-expires\", \"Clear the auto-delete expiry\")\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\"--domain <hostname>\",\n\t\t\t\"Move this drop to a connected custom domain (must be live — see: dropthis domains list).\",\n\t\t)\n\t\t.option(\n\t\t\t\"--shared\",\n\t\t\t\"Unmount this drop back to the shared dropthis pool. Cannot combine with --domain.\",\n\t\t)\n\t\t.option(\n\t\t\t\"--slug <vanity-slug>\",\n\t\t\t\"Rename the vanity slug on a path-mode custom domain (1–63 lowercase letters/digits/hyphens). 409 on conflict — does not auto-suffix.\",\n\t\t)\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(\"pull <target>\")\n\t\t.description(\n\t\t\t\"Download a drop's files into a local directory (accepts the drop_… id, the drop URL, or its slug).\\nFetches the current deployment's file manifest and writes every file. Pull, edit, then update-content to ship the changes back to the same URL — also the rollback path.\",\n\t\t)\n\t\t.option(\"-o, --output <dir>\", \"Output directory (default: ./<slug-or-id>)\")\n\t\t.option(\"--deployment <deploymentId>\", \"Download a specific deployment\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.addHelpText(\n\t\t\t\"after\",\n\t\t\texamplesBlock([\n\t\t\t\t\"dropthis pull drop_abc123 -o ./site # download the drop's files\",\n\t\t\t\t\"$EDITOR ./site/index.html # edit locally\",\n\t\t\t\t\"dropthis update-content drop_abc123 ./site # ship back to the same URL\",\n\t\t\t]),\n\t\t)\n\t\t.action(\n\t\t\tasync (\n\t\t\t\ttarget: string,\n\t\t\t\tcommandOptions: {\n\t\t\t\t\toutput?: string;\n\t\t\t\t\tdeployment?: string;\n\t\t\t\t\tjson?: boolean;\n\t\t\t\t},\n\t\t\t) => {\n\t\t\t\tconst deps = await commandDeps<Parameters<typeof runPull>[2][\"client\"]>(\n\t\t\t\t\tprogram,\n\t\t\t\t\toptions,\n\t\t\t\t\tstore,\n\t\t\t\t\tcommandOptions,\n\t\t\t\t);\n\t\t\t\tconst result = await runPull(target, commandOptions, deps);\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(\n\t\t\t\"Show drop details (accepts the drop_… id, the drop URL, or its slug)\",\n\t\t)\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(\"resolve <target>\")\n\t\t.description(\n\t\t\t\"Resolve a public drop URL or slug back to its drop_… id (accepts the id too).\\nWrites are id-only — use this to recover the id from a URL, then update-content/update-settings/delete by that id.\",\n\t\t)\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.addHelpText(\n\t\t\t\"after\",\n\t\t\texamplesBlock([\n\t\t\t\t\"dropthis resolve https://abc123.dropthis.app/ # → drop_… id + url\",\n\t\t\t\t\"dropthis resolve abc123 --json | jq -r .drop.id\",\n\t\t\t]),\n\t\t)\n\t\t.action(async (target: string, commandOptions: { json?: boolean }) => {\n\t\t\tconst deps = await commandDeps<\n\t\t\t\tParameters<typeof runDropsResolve>[2][\"client\"]\n\t\t\t>(program, options, store, commandOptions);\n\t\t\tconst result = await runDropsResolve(target, 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(\"--domain <hostname>\", \"Only drops mounted on this custom domain\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.addHelpText(\n\t\t\t\"after\",\n\t\t\texamplesBlock([\n\t\t\t\t\"dropthis list\",\n\t\t\t\t\"dropthis list --json | jq -r '.drops[] | [.id, .url] | @tsv' # recover drop ids\",\n\t\t\t\t\"dropthis list --domain reports.example.com --json # drops on a custom domain\",\n\t\t\t]),\n\t\t)\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\tdomain?: 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(\n\t\t\t\"Delete a drop (accepts the drop_… id, the drop URL, or its slug)\",\n\t\t)\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\t// --- Domains commands ---\n\n\tconst domains = program\n\t\t.command(\"domains\")\n\t\t.description(\n\t\t\t\"Manage custom domains. Loop: connect → create the CNAME at your DNS provider → verify --wait → publish --domain\",\n\t\t);\n\tdomains\n\t\t.command(\"connect <hostname>\")\n\t\t.description(\n\t\t\t\"Connect a custom domain. Returns DNS records to create at your provider.\\nAfter adding them: dropthis domains verify <hostname> --wait\",\n\t\t)\n\t\t.requiredOption(\n\t\t\t\"--mode <mode>\",\n\t\t\t\"Mount mode: path (many drops at hostname/{slug}/) or dedicated (one drop at root)\",\n\t\t)\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.addHelpText(\n\t\t\t\"after\",\n\t\t\texamplesBlock([\n\t\t\t\t\"dropthis domains connect reports.example.com --mode path\",\n\t\t\t\t\"# add the CNAME shown above at your DNS provider, then:\",\n\t\t\t\t\"dropthis domains verify reports.example.com --wait\",\n\t\t\t\t\"dropthis publish ./report.html --domain reports.example.com\",\n\t\t\t]),\n\t\t)\n\t\t.action(\n\t\t\tasync (\n\t\t\t\thostname: string,\n\t\t\t\tcommandOptions: { mode: string; json?: boolean },\n\t\t\t) => {\n\t\t\t\t// Validate --mode BEFORE commandDeps so a bad value never resolves\n\t\t\t\t// credentials / touches the keyring (codex P2). runDomainsConnect keeps\n\t\t\t\t// the same defensive check, so the envelope is identical either way.\n\t\t\t\tif (\n\t\t\t\t\tcommandOptions.mode !== \"path\" &&\n\t\t\t\t\tcommandOptions.mode !== \"dedicated\"\n\t\t\t\t) {\n\t\t\t\t\tprocess.exitCode = writeError(\n\t\t\t\t\t\toutputWriter(program, options, commandOptions),\n\t\t\t\t\t\t\"invalid_usage\",\n\t\t\t\t\t\t'--mode must be \"path\" or \"dedicated\"',\n\t\t\t\t\t).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 runDomainsConnect>[1][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst result = await runDomainsConnect(\n\t\t\t\t\t{ hostname, mode: commandOptions.mode },\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\tdomains\n\t\t.command(\"list\")\n\t\t.description(\"List connected custom domains\")\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 runDomainsList>[1][\"client\"]\n\t\t\t>(program, options, store, commandOptions);\n\t\t\tconst result = await runDomainsList(commandOptions, deps);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\tdomains\n\t\t.command(\"status <hostname>\")\n\t\t.description(\"Show domain details and DNS record status\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(async (hostname: string, commandOptions: { json?: boolean }) => {\n\t\t\tconst deps = await commandDeps<\n\t\t\t\tParameters<typeof runDomainsStatus>[2][\"client\"]\n\t\t\t>(program, options, store, commandOptions);\n\t\t\tconst result = await runDomainsStatus(hostname, commandOptions, deps);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\tdomains\n\t\t.command(\"verify <hostname>\")\n\t\t.description(\n\t\t\t\"Trigger a DNS verification check. With --wait, polls until live or failed.\\nUse after adding the DNS records from: dropthis domains connect\\n\\nExit codes (one-shot): 0=live, 1=failed, 6=still pending (retry). With --wait: 0=live, 1=failed, 7=timed out.\",\n\t\t)\n\t\t.option(\"--wait\", \"Poll until live (or failed/timeout)\")\n\t\t.option(\n\t\t\t\"--timeout <secs>\",\n\t\t\t\"Max seconds to wait (default: 300)\",\n\t\t\tparseInteger,\n\t\t)\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.addHelpText(\n\t\t\t\"after\",\n\t\t\texamplesBlock([\n\t\t\t\t\"dropthis domains verify reports.example.com --wait\",\n\t\t\t\t\"dropthis domains verify reports.example.com --wait --timeout 600\",\n\t\t\t]),\n\t\t)\n\t\t.action(\n\t\t\tasync (\n\t\t\t\thostname: string,\n\t\t\t\tcommandOptions: { wait?: boolean; timeout?: number; json?: boolean },\n\t\t\t) => {\n\t\t\t\tconst deps = await commandDeps<\n\t\t\t\t\tParameters<typeof runDomainsVerify>[2][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst result = await runDomainsVerify(hostname, commandOptions, deps);\n\t\t\t\tprocess.exitCode = result.exitCode;\n\t\t\t},\n\t\t);\n\tdomains\n\t\t.command(\"update <hostname>\")\n\t\t.description(\n\t\t\t\"Update a domain — repoint to a different drop (dedicated mode) or set/clear as account default (path mode). At least one option required.\",\n\t\t)\n\t\t.option(\"--drop <dropId>\", \"Repoint to a different drop (dedicated mode)\")\n\t\t.option(\"--default\", \"Set as account default publish domain (path mode)\")\n\t\t.option(\n\t\t\t\"--no-default\",\n\t\t\t\"Clear the account default publish domain (defaultless publishes revert to the shared pool)\",\n\t\t)\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\thostname: string,\n\t\t\t\tcommandOptions: { drop?: string; default?: boolean; json?: boolean },\n\t\t\t) => {\n\t\t\t\tconst deps = await commandDeps<\n\t\t\t\t\tParameters<typeof runDomainsUpdate>[2][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst result = await runDomainsUpdate(\n\t\t\t\t\thostname,\n\t\t\t\t\t{\n\t\t\t\t\t\t...(commandOptions.drop !== undefined\n\t\t\t\t\t\t\t? { drop: commandOptions.drop }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t...(commandOptions.default !== undefined\n\t\t\t\t\t\t\t? { setDefault: commandOptions.default }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t},\n\t\t\t\t\tdeps,\n\t\t\t\t);\n\t\t\t\tprocess.exitCode = result.exitCode;\n\t\t\t},\n\t\t);\n\tdomains\n\t\t.command(\"remove <hostname>\")\n\t\t.description(\n\t\t\t\"Remove a custom domain (unmounts its drops). IMPORTANT: also delete the DNS CNAME at your provider to prevent DNS hijacking.\",\n\t\t)\n\t\t.option(\"--yes\", \"Confirm removal\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\thostname: 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 runDomainsRemove>[2][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst result = await runDomainsRemove(\n\t\t\t\t\thostname,\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 apiKeys = program.command(\"api-keys\").description(\"Manage API keys\");\n\tapiKeys\n\t\t.command(\"create\")\n\t\t.description(\n\t\t\t\"Create an API key. Without --service, mints a delegated account-scoped key (default for login). With --service --workspace <ws>, mints a CI key pinned to that workspace.\",\n\t\t)\n\t\t.option(\"--label <label>\", \"API key label\")\n\t\t.option(\n\t\t\t\"--service\",\n\t\t\t\"Mint a pinned service key for CI/automation (requires --workspace to pin it)\",\n\t\t)\n\t\t.option(\n\t\t\t\"--workspace <slugOrId>\",\n\t\t\t\"Pin this service key to the given workspace slug or id (only valid with --service)\",\n\t\t)\n\t\t.option(\n\t\t\t\"--allowed-workspace <slugOrId>\",\n\t\t\t\"Allow a delegated key to access the given workspace slug or id\",\n\t\t\tcollect,\n\t\t\t[],\n\t\t)\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(\n\t\t\tasync (commandOptions: {\n\t\t\t\tlabel?: string;\n\t\t\t\tservice?: boolean;\n\t\t\t\tworkspace?: string;\n\t\t\t\tallowedWorkspace?: 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 runApiKeysCreate>[1][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst result = await runApiKeysCreate(\n\t\t\t\t\t{\n\t\t\t\t\t\t...(commandOptions.label !== undefined\n\t\t\t\t\t\t\t? { label: commandOptions.label }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\ttype: commandOptions.service ? \"service\" : \"delegated\",\n\t\t\t\t\t\t...(commandOptions.workspace !== undefined\n\t\t\t\t\t\t\t? { workspace: commandOptions.workspace }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t...(commandOptions.allowedWorkspace?.length\n\t\t\t\t\t\t\t? { allowedWorkspaces: commandOptions.allowedWorkspace }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t...(commandOptions.json !== undefined\n\t\t\t\t\t\t\t? { json: commandOptions.json }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t},\n\t\t\t\t\tdeps,\n\t\t\t\t);\n\t\t\t\tprocess.exitCode = result.exitCode;\n\t\t\t},\n\t\t);\n\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// --- Workspace commands ---\n\n\tconst workspace = program\n\t\t.command(\"workspace\")\n\t\t.description(\n\t\t\t\"Manage workspaces. Switch your active workspace (delegated keys only) or list all workspaces you belong to.\",\n\t\t);\n\tworkspace\n\t\t.command(\"list\", { isDefault: true })\n\t\t.description(\"List workspaces you belong to\")\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 runWorkspaceList>[1][\"client\"]\n\t\t\t>(program, options, store, commandOptions);\n\t\t\tconst result = await runWorkspaceList(commandOptions, deps);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\tworkspace\n\t\t.command(\"use <slugOrId>\")\n\t\t.description(\n\t\t\t\"Switch your active workspace (server-side, persists on the credential). Delegated keys only — pinned service keys cannot switch.\",\n\t\t)\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(async (slugOrId: string, commandOptions: { json?: boolean }) => {\n\t\t\tconst deps = await commandDeps<\n\t\t\t\tParameters<typeof runWorkspaceUse>[2][\"client\"]\n\t\t\t>(program, options, store, commandOptions);\n\t\t\tconst result = await runWorkspaceUse(slugOrId, commandOptions, deps);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\tworkspace\n\t\t.command(\"create <name>\")\n\t\t.description(\"Create a new team workspace\")\n\t\t.option(\"--slug <slug>\", \"Vanity slug for the workspace\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tname: string,\n\t\t\t\tcommandOptions: { slug?: string; json?: boolean },\n\t\t\t) => {\n\t\t\t\tconst deps = await commandDeps<\n\t\t\t\t\tParameters<typeof runWorkspaceCreate>[1][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst result = await runWorkspaceCreate(\n\t\t\t\t\t{\n\t\t\t\t\t\tname,\n\t\t\t\t\t\t...(commandOptions.slug !== undefined\n\t\t\t\t\t\t\t? { slug: commandOptions.slug }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t...(commandOptions.json !== undefined\n\t\t\t\t\t\t\t? { json: commandOptions.json }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t},\n\t\t\t\t\tdeps,\n\t\t\t\t);\n\t\t\t\tprocess.exitCode = result.exitCode;\n\t\t\t},\n\t\t);\n\tworkspace\n\t\t.command(\"rename <workspaceId>\")\n\t\t.description(\"Rename a workspace or change its vanity slug\")\n\t\t.option(\"--name <name>\", \"New workspace name\")\n\t\t.option(\"--slug <slug>\", \"New vanity slug\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tworkspaceId: string,\n\t\t\t\tcommandOptions: { name?: string; slug?: string; json?: boolean },\n\t\t\t) => {\n\t\t\t\tconst deps = await commandDeps<\n\t\t\t\t\tParameters<typeof runWorkspaceRename>[2][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst result = await runWorkspaceRename(\n\t\t\t\t\tworkspaceId,\n\t\t\t\t\t{\n\t\t\t\t\t\t...(commandOptions.name !== undefined\n\t\t\t\t\t\t\t? { name: commandOptions.name }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t...(commandOptions.slug !== undefined\n\t\t\t\t\t\t\t? { slug: commandOptions.slug }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t...(commandOptions.json !== undefined\n\t\t\t\t\t\t\t? { json: commandOptions.json }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t},\n\t\t\t\t\tdeps,\n\t\t\t\t);\n\t\t\t\tprocess.exitCode = result.exitCode;\n\t\t\t},\n\t\t);\n\tworkspace\n\t\t.command(\"delete <workspaceId>\")\n\t\t.description(\"Delete a workspace\")\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\tworkspaceId: 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 runWorkspaceDelete>[2][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst result = await runWorkspaceDelete(\n\t\t\t\t\tworkspaceId,\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// --- Members commands ---\n\n\tconst members = program.command(\"members\").description(\"Manage team members\");\n\tmembers\n\t\t.command(\"list <workspaceId>\")\n\t\t.description(\"List members of a workspace\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(async (workspaceId: string, commandOptions: { json?: boolean }) => {\n\t\t\tconst deps = await commandDeps<\n\t\t\t\tParameters<typeof runMembersList>[2][\"client\"]\n\t\t\t>(program, options, store, commandOptions);\n\t\t\tconst result = await runMembersList(workspaceId, commandOptions, deps);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\tmembers\n\t\t.command(\"invite <workspaceId>\")\n\t\t.description(\"Invite someone to a workspace by email\")\n\t\t.requiredOption(\"--email <email>\", \"Email address to invite\")\n\t\t.option(\"--role <role>\", \"Role to grant (admin or member)\", \"member\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tworkspaceId: string,\n\t\t\t\tcommandOptions: {\n\t\t\t\t\temail: string;\n\t\t\t\t\trole?: \"admin\" | \"member\";\n\t\t\t\t\tjson?: boolean;\n\t\t\t\t},\n\t\t\t) => {\n\t\t\t\tconst deps = await commandDeps<\n\t\t\t\t\tParameters<typeof runMembersInvite>[2][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst result = await runMembersInvite(\n\t\t\t\t\tworkspaceId,\n\t\t\t\t\t{\n\t\t\t\t\t\temail: commandOptions.email,\n\t\t\t\t\t\t...(commandOptions.role !== undefined\n\t\t\t\t\t\t\t? { role: commandOptions.role }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t...(commandOptions.json !== undefined\n\t\t\t\t\t\t\t? { json: commandOptions.json }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t},\n\t\t\t\t\tdeps,\n\t\t\t\t);\n\t\t\t\tprocess.exitCode = result.exitCode;\n\t\t\t},\n\t\t);\n\tmembers\n\t\t.command(\"role <workspaceId> <accountId>\")\n\t\t.description(\"Change a member's role\")\n\t\t.requiredOption(\"--role <role>\", \"New role (owner, admin, or member)\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tworkspaceId: string,\n\t\t\t\taccountId: string,\n\t\t\t\tcommandOptions: {\n\t\t\t\t\trole: \"owner\" | \"admin\" | \"member\";\n\t\t\t\t\tjson?: boolean;\n\t\t\t\t},\n\t\t\t) => {\n\t\t\t\tconst deps = await commandDeps<\n\t\t\t\t\tParameters<typeof runMembersRole>[3][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst result = await runMembersRole(\n\t\t\t\t\tworkspaceId,\n\t\t\t\t\taccountId,\n\t\t\t\t\t{\n\t\t\t\t\t\trole: commandOptions.role,\n\t\t\t\t\t\t...(commandOptions.json !== undefined\n\t\t\t\t\t\t\t? { json: commandOptions.json }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t},\n\t\t\t\t\tdeps,\n\t\t\t\t);\n\t\t\t\tprocess.exitCode = result.exitCode;\n\t\t\t},\n\t\t);\n\tmembers\n\t\t.command(\"remove <workspaceId> <accountId>\")\n\t\t.description(\"Remove a member from a workspace\")\n\t\t.option(\"--yes\", \"Confirm removal\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(\n\t\t\tasync (\n\t\t\t\tworkspaceId: string,\n\t\t\t\taccountId: 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 runMembersRemove>[3][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst result = await runMembersRemove(\n\t\t\t\t\tworkspaceId,\n\t\t\t\t\taccountId,\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// --- Invitations commands ---\n\n\tconst invitations = program\n\t\t.command(\"invitations\")\n\t\t.description(\"Manage your workspace invitations\");\n\tinvitations\n\t\t.command(\"list\", { isDefault: true })\n\t\t.description(\"List your pending workspace invitations\")\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 runInvitationsList>[1][\"client\"]\n\t\t\t>(program, options, store, commandOptions);\n\t\t\tconst result = await runInvitationsList(commandOptions, deps);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\tinvitations\n\t\t.command(\"accept\")\n\t\t.description(\"Accept a workspace invitation by token\")\n\t\t.requiredOption(\"--token <token>\", \"Invitation token\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(async (commandOptions: { token: string; json?: boolean }) => {\n\t\t\tconst deps = await commandDeps<\n\t\t\t\tParameters<typeof runInvitationsAccept>[1][\"client\"]\n\t\t\t>(program, options, store, commandOptions);\n\t\t\tconst result = await runInvitationsAccept(commandOptions, deps);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\tinvitations\n\t\t.command(\"accept-by-id <invitationId>\")\n\t\t.description(\"Accept a workspace invitation by its id\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(\n\t\t\tasync (invitationId: string, commandOptions: { json?: boolean }) => {\n\t\t\t\tconst deps = await commandDeps<\n\t\t\t\t\tParameters<typeof runInvitationsAcceptById>[1][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst result = await runInvitationsAcceptById(\n\t\t\t\t\t{\n\t\t\t\t\t\tinvitationId,\n\t\t\t\t\t\t...(commandOptions.json !== undefined\n\t\t\t\t\t\t\t? { json: commandOptions.json }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t},\n\t\t\t\t\tdeps,\n\t\t\t\t);\n\t\t\t\tprocess.exitCode = result.exitCode;\n\t\t\t},\n\t\t);\n\n\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(\n\t\t\t\"--scope <scope>\",\n\t\t\t\"Capability scope to request for the minted key (e.g. team)\",\n\t\t)\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\tscope?: 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 stdinIsTTY = options.stdinIsTTY ?? process.stdin.isTTY ?? false;\n\t\t\t\t\tif (!isInteractive(stdinIsTTY, deps.env, global)) {\n\t\t\t\t\t\t// Fail fast instead of hanging on a prompt that can never answer.\n\t\t\t\t\t\tprocess.exitCode = writeError(\n\t\t\t\t\t\t\tdeps,\n\t\t\t\t\t\t\t\"invalid_usage\",\n\t\t\t\t\t\t\t\"dropthis login is interactive and needs a terminal.\",\n\t\t\t\t\t\t\t\"Set DROPTHIS_API_KEY, or run: dropthis login request --email <email>, then dropthis login verify --email <email> --otp <code>.\",\n\t\t\t\t\t\t).exitCode;\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\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\t...(commandOptions.scope ? { scope: commandOptions.scope } : {}),\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.scope ? { scope: commandOptions.scope } : {}),\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(\n\t\t\t\"--scope <scope>\",\n\t\t\t\"Capability scope to request for the minted key (e.g. team)\",\n\t\t)\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\tscope?: 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.option(\"--display-name <name>\", \"Set the display name\")\n\t\t.option(\"--clear-display-name\", \"Clear the display name\")\n\t\t.option(\"--json\", \"Force JSON output\")\n\t\t.action(\n\t\t\tasync (commandOptions: {\n\t\t\t\tdisplayName?: string;\n\t\t\t\tclearDisplayName?: boolean;\n\t\t\t\tjson?: boolean;\n\t\t\t}) => {\n\t\t\t\tif (\n\t\t\t\t\t(commandOptions.displayName === undefined &&\n\t\t\t\t\t\t!commandOptions.clearDisplayName) ||\n\t\t\t\t\t(commandOptions.displayName !== undefined &&\n\t\t\t\t\t\tcommandOptions.clearDisplayName)\n\t\t\t\t) {\n\t\t\t\t\tconst writer = outputWriter(program, options, commandOptions);\n\t\t\t\t\tprocess.exitCode = writeError(\n\t\t\t\t\t\twriter,\n\t\t\t\t\t\t\"invalid_usage\",\n\t\t\t\t\t\t\"Use either --display-name <name> or --clear-display-name.\",\n\t\t\t\t\t).exitCode;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst displayName = commandOptions.clearDisplayName\n\t\t\t\t\t? null\n\t\t\t\t\t: commandOptions.displayName;\n\t\t\t\tif (displayName === undefined) return;\n\t\t\t\tconst deps = await commandDeps<\n\t\t\t\t\tParameters<typeof runAccountUpdate>[1][\"client\"]\n\t\t\t\t>(program, options, store, commandOptions);\n\t\t\t\tconst result = await runAccountUpdate(\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName,\n\t\t\t\t\t\t...(commandOptions.json !== undefined\n\t\t\t\t\t\t\t? { json: commandOptions.json }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t},\n\t\t\t\t\tdeps,\n\t\t\t\t);\n\t\t\t\tprocess.exitCode = result.exitCode;\n\t\t\t},\n\t\t);\n\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.option(\n\t\t\t\"--online\",\n\t\t\t\"Run a network preflight (auth + active workspace + custom-domain status) — exits 3 on auth failure, 5 on a network failure\",\n\t\t)\n\t\t.action(async (commandOptions: { json?: boolean; online?: boolean }) => {\n\t\t\tconst deps = await commandDeps<Parameters<typeof runDoctor>[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 runDoctor(commandOptions, deps);\n\t\t\tprocess.exitCode = result.exitCode;\n\t\t});\n\n\tprogram\n\t\t.command(\"upgrade\")\n\t\t.description(\"Update the CLI to the latest version from npm\")\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 runUpgrade(commandOptions, {\n\t\t\t\t...deps,\n\t\t\t\tcurrentVersion: CLI_VERSION,\n\t\t\t});\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\texpires?: boolean;\n\tworkspace?: string;\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\n/**\n * Build a credential-free writer ({stdout, stderr, outputMode}) from the output\n * context. Use for usage validation that must reject a bad flag BEFORE\n * commandDeps resolves credentials — so an invalid argument never touches the\n * credential store (keyring) and a user with a locked store still gets the\n * usage error, not a storage failure.\n */\nfunction outputWriter(\n\tprogram: Command,\n\toptions: BuildProgramOptions,\n\tcommandOptions: { json?: boolean; quiet?: boolean },\n): {\n\tstdout: (value: string) => void;\n\tstderr: (value: string) => void;\n\toutputMode: \"human\" | \"json\";\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\treturn {\n\t\tstdout: context.stdout,\n\t\tstderr: context.stderr,\n\t\toutputMode: context.output.mode,\n\t};\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.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.expires === false || options.noExpires\n\t\t\t? { noExpires: true }\n\t\t\t: {}),\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.domain ? { domain: options.domain } : {}),\n\t\t...(options.shared ? { shared: true } : {}),\n\t\t...(options.slug ? { slug: options.slug } : {}),\n\t\t...(options.manifest ? { manifest: options.manifest } : {}),\n\t\t...(options.workspace ? { workspace: options.workspace } : {}),\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\nfunction parseMode(value: string): \"patch\" | \"replace\" {\n\tif (value !== \"patch\" && value !== \"replace\") {\n\t\tthrow new InvalidArgumentError('Use \"patch\" or \"replace\".');\n\t}\n\treturn value;\n}\n\n/** Accumulator for repeatable options (e.g. --delete-path). */\nfunction collect(value: string, previous: string[]): string[] {\n\treturn [...previous, value];\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\tscopes?: 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\t...(stored.scopes?.length ? { scopes: stored.scopes } : {}),\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\tfailuresFromApiError,\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\t// Single non-HTML drops (file_viewer) expose a raw-bytes URL: the canonical\n\t\t// URL serves the branded human view (badge guaranteed), rawUrl serves the\n\t\t// exact bytes at their natural path — the path to hand other agents (ADR 0061).\n\t\t// null for HTML drops (the page IS the artifact) and collections.\n\t\tconst rawUrl = data.rawUrl;\n\t\tif (typeof rawUrl === \"string\" && rawUrl.length > 0) {\n\t\t\tdeps.stdout(`${hint(`Raw: ${url(rawUrl)}`)}\\n`);\n\t\t}\n\t\t// Surface server warnings: slug_suffixed gets a tailored line, anything\n\t\t// else renders dim as-is (JSON mode already carries all warnings).\n\t\tconst warnings = data.warnings as\n\t\t\t| Array<Record<string, unknown>>\n\t\t\t| undefined;\n\t\tif (Array.isArray(warnings)) {\n\t\t\tfor (const w of warnings) {\n\t\t\t\tif (w.code === \"slug_suffixed\") {\n\t\t\t\t\tdeps.stderr(\n\t\t\t\t\t\t`${hint(`Vanity slug was taken — served at: ${w.detail ?? \"see URL\"}`)}\\n`,\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tconst text =\n\t\t\t\t\t\ttypeof w.detail === \"string\"\n\t\t\t\t\t\t\t? w.detail\n\t\t\t\t\t\t\t: typeof w.message === \"string\"\n\t\t\t\t\t\t\t\t? w.message\n\t\t\t\t\t\t\t\t: typeof w.code === \"string\"\n\t\t\t\t\t\t\t\t\t? w.code\n\t\t\t\t\t\t\t\t\t: undefined;\n\t\t\t\t\tif (text) deps.stderr(`${hint(text)}\\n`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\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\t// Name the team a drop landed in so multi-workspace users see *where* it went\n\t// — every other surface (console, extension, MCP) echoes this. A solo/personal\n\t// workspace is the implicit default, so we skip it to keep the common case quiet.\n\t// JSON mode always carries the full workspace object regardless.\n\tconst ws = data.workspace as { name?: unknown; kind?: unknown } | undefined;\n\tif (ws && ws.kind === \"team\" && typeof ws.name === \"string\") {\n\t\tparts.push(`team: ${ws.name}`);\n\t}\n\tif (parts.length === 0) return \"\";\n\treturn ` ${pc.dim(parts.join(\" · \"))}`;\n}\n\n/** Trims an ISO timestamp to its date part for human output. */\nexport function formatDate(iso: string): string {\n\treturn iso.split(\"T\")[0] ?? iso;\n}\n\n/** Trims an ISO timestamp to \"YYYY-MM-DD HH:MM\" for human output. */\nexport function formatDateTime(iso: string): string {\n\tconst match = iso.match(/^(\\d{4}-\\d{2}-\\d{2})T(\\d{2}:\\d{2})/);\n\treturn match ? `${match[1]} ${match[2]}` : iso;\n}\n\nexport function formatBytes(bytes: number): string {\n\tif (bytes < 1024) return `${bytes} B`;\n\tif (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;\n\tif (bytes < 1024 * 1024 * 1024)\n\t\treturn `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n\treturn `${(bytes / (1024 * 1024 * 1024)).toFixed(1)} GB`;\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 failures = failuresFromApiError(details);\n\t\tfor (const f of failures) {\n\t\t\tdeps.stderr(` ${f.path}: ${f.reason}\\n`);\n\t\t}\n\t\t// Plan gates name the wall plainly: current → required tier (no retry hint —\n\t\t// the server marks these retryable:false; re-running can never succeed).\n\t\tif (\n\t\t\tdetails.code === \"feature_not_in_plan\" ||\n\t\t\tdetails.code === \"quota_exceeded\"\n\t\t) {\n\t\t\tif (details.currentPlan && details.requiredPlan) {\n\t\t\t\tdeps.stderr(\n\t\t\t\t\t`${hint(`Plan: ${details.currentPlan} → needs ${details.requiredPlan}`)}\\n`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tconst nextAction = nextActionForApiError(details, \"human\");\n\t\tif (nextAction) deps.stderr(`${hint(nextAction)}\\n`);\n\t\t// 409 revision conflicts carry the drop's current revision — name the CLI\n\t\t// flag so the retry path is copy-pasteable from the terminal.\n\t\tif (details.currentRevision !== undefined)\n\t\t\tdeps.stderr(\n\t\t\t\t`${hint(`Current revision: ${details.currentRevision} — retry with --if-revision ${details.currentRevision}`)}\\n`,\n\t\t\t);\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(cliErrorCodeFor(details)) };\n}\n\n/**\n * Maps SDK-side error codes onto the CLI exit-code contract: transport\n * failures are network errors (5), and the SDK's local file_not_found\n * (\"No file or directory at …\") is a local input error (4), not an API error.\n */\nexport function cliErrorCodeFor(details: ApiErrorDetails): CliErrorCode {\n\tif (details.code === \"network_error\") return \"network_error\";\n\tif (details.code === \"file_not_found\") return \"local_input_error\";\n\t// \"Authenticate\" is one scriptable signal: a server-side 401 must exit 3\n\t// (auth_error) just like the local \"no API key\" path, so an agent/CI script\n\t// can key off exit 3 = re-auth regardless of where the gap was caught.\n\tif (\n\t\tdetails.statusCode === 401 ||\n\t\tdetails.code === \"authentication_required\" ||\n\t\tdetails.code === \"missing_api_key\"\n\t) {\n\t\treturn \"auth_error\";\n\t}\n\treturn \"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\tformatBytes,\n\twriteApiError,\n\twriteAuthError,\n\twriteError,\n\twriteHumanOrJson,\n\twriteKv,\n} from \"../fmt.js\";\nimport type { CommandDeps, SdkResult } from \"../types.js\";\nimport { hint, 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\tconst ws = data?.workspace as Record<string, unknown> | undefined;\n\tif (ws?.name) {\n\t\tconst role = ws.role ? ` · your role: ${String(ws.role)}` : \"\";\n\t\tpairs.push([\"Workspace\", `${String(ws.name)} (${String(ws.kind)})${role}`]);\n\t}\n\n\tconst usage = data?.usage as Record<string, unknown> | undefined;\n\tconst entitlements = data?.entitlements as\n\t\t| Record<string, unknown>\n\t\t| undefined;\n\tconst limits = entitlements?.limits as Record<string, unknown> | undefined;\n\n\tif (typeof usage?.storageUsedBytes === \"number\") {\n\t\tif (typeof limits?.maxStorageBytes === \"number\") {\n\t\t\tpairs.push([\n\t\t\t\t\"Storage\",\n\t\t\t\t`${formatBytes(usage.storageUsedBytes)} of ${formatBytes(limits.maxStorageBytes)}`,\n\t\t\t]);\n\t\t} else {\n\t\t\tpairs.push([\"Storage\", formatBytes(usage.storageUsedBytes)]);\n\t\t}\n\t}\n\n\tif (\n\t\ttypeof usage?.customDomainsUsed === \"number\" &&\n\t\ttypeof limits?.maxCustomHostnames === \"number\"\n\t) {\n\t\tpairs.push([\n\t\t\t\"Domains\",\n\t\t\t`${usage.customDomainsUsed} of ${limits.maxCustomHostnames}`,\n\t\t]);\n\t}\n\n\tif (\n\t\ttypeof usage?.seatsUsed === \"number\" &&\n\t\ttypeof limits?.seatLimit === \"number\"\n\t) {\n\t\tpairs.push([\"Seats\", `${usage.seatsUsed} of ${limits.seatLimit}`]);\n\t}\n\n\twriteKv(deps, pairs, { ok: true, account: result.data });\n\n\tif (typeof data?.upgradeUrl === \"string\") {\n\t\tdeps.stderr(`${hint(`Upgrade: ${data.upgradeUrl}`)}\\n`);\n\t}\n\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 { hint, success } from \"../ui.js\";\n\ntype ApiKeysCreateClient = {\n\tapiKeys: {\n\t\tcreate(input: {\n\t\t\tlabel: string;\n\t\t\ttype: \"delegated\" | \"service\";\n\t\t\tworkspace?: string;\n\t\t\tallowedWorkspaces?: 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\n// DELETE /v1/api-keys/{id} returns 204 No Content; the SDK types it\n// DropthisResult<null>. Success is `error === null` — never read result.data.\ntype ApiKeysDeleteClient = {\n\tapiKeys: {\n\t\tdelete(\n\t\t\tkeyId: string,\n\t\t): Promise<SdkResult<null>> | SdkResult<null> | undefined;\n\t};\n};\n\nexport async function runApiKeysCreate(\n\tinput: {\n\t\tlabel?: string;\n\t\ttype?: \"delegated\" | \"service\";\n\t\tworkspace?: string;\n\t\tallowedWorkspaces?: string[];\n\t\tjson?: boolean;\n\t},\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\n\tconst keyType = input.type ?? \"delegated\";\n\n\t// --workspace pins a SERVICE key to a chosen workspace; it is meaningless for a\n\t// delegated key (account-scoped, switchable). Reject the combination loudly rather\n\t// than silently minting a broader account-scoped key than the user intended.\n\tif (input.workspace && keyType !== \"service\") {\n\t\treturn writeError(\n\t\t\tdeps,\n\t\t\t\"invalid_usage\",\n\t\t\t\"--workspace is only valid with --service (it pins a CI service key to one workspace). A delegated login key is account-scoped and switchable — use `dropthis workspace use <slug>` to change its active workspace.\",\n\t\t);\n\t}\n\n\tif (input.allowedWorkspaces?.length && keyType === \"service\") {\n\t\treturn writeError(\n\t\t\tdeps,\n\t\t\t\"invalid_usage\",\n\t\t\t\"--allowed-workspace is only valid for delegated keys; do not combine it with --service.\",\n\t\t);\n\t}\n\n\t// A SERVICE key is for CI/automation and is pinned to ONE workspace for its whole life;\n\t// make the target explicit so a CI key is never accidentally pinned to the wrong (e.g.\n\t// personal) workspace just because that happened to be active.\n\tif (keyType === \"service\" && !input.workspace) {\n\t\treturn writeError(\n\t\t\tdeps,\n\t\t\t\"invalid_usage\",\n\t\t\t\"Service keys must be pinned to a workspace.\",\n\t\t\t\"Run: dropthis workspace list to see slugs, then: dropthis api-keys create --service --workspace <slug>\",\n\t\t);\n\t}\n\n\tconst label =\n\t\tinput.label ??\n\t\t(keyType === \"service\"\n\t\t\t? `Service key${input.workspace ? ` (${input.workspace})` : \"\"}`\n\t\t\t: \"CLI key\");\n\n\tconst createInput: {\n\t\tlabel: string;\n\t\ttype: \"delegated\" | \"service\";\n\t\tworkspace?: string;\n\t\tallowedWorkspaces?: string[];\n\t} = {\n\t\tlabel,\n\t\ttype: keyType,\n\t};\n\tif (keyType === \"service\" && input.workspace) {\n\t\tcreateInput.workspace = input.workspace;\n\t}\n\tif (input.allowedWorkspaces?.length) {\n\t\tcreateInput.allowedWorkspaces = input.allowedWorkspaces;\n\t}\n\n\tconst result = await deps.client.apiKeys.create(createInput);\n\tif (result.error) return writeApiError(deps, result.error);\n\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\tif (data.label) pairs.push([\"Label\", String(data.label)]);\n\n\twriteKv(deps, pairs, { ok: true, api_key: result.data });\n\n\t// Warn (human mode only) that the key is shown once. In JSON/CI mode we MUST keep\n\t// stderr clean so `... --json 2>&1 | jq` parses — the JSON envelope already carries\n\t// the raw key, which is self-evidently the only time it is returned.\n\tif (deps.outputMode === \"human\") {\n\t\tdeps.stderr(\n\t\t\t`${hint(\"Store this key now — it will not be shown again.\")}\\n`,\n\t\t);\n\t}\n\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\n/**\n * Pulls cursor pagination off a list wrapper (SDK CursorPage or raw wire\n * shape). Returns undefined when the shape does not paginate, so callers can\n * leave non-paginated envelopes untouched.\n */\nexport function extractPagination(\n\tdata: unknown,\n): { nextCursor: string | null; hasMore: boolean } | undefined {\n\tif (!data || typeof data !== \"object\") return undefined;\n\tconst rec = data as Record<string, unknown>;\n\tif (!(\"nextCursor\" in rec) && !(\"hasMore\" in rec)) return undefined;\n\tconst nextCursor = typeof rec.nextCursor === \"string\" ? rec.nextCursor : null;\n\tconst hasMore =\n\t\ttypeof rec.hasMore === \"boolean\" ? rec.hasMore : nextCursor !== null;\n\treturn { nextCursor, hasMore };\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\t\"dropthis publish ./report.html --workspace acme --json # target a specific workspace (delegated keys only)\",\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\tpull: {\n\t\tauth: \"required\",\n\t\texamples: [\n\t\t\t\"dropthis pull drop_abc -o ./site\",\n\t\t\t\"dropthis pull https://abc123.dropthis.app\",\n\t\t],\n\t},\n\tget: {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis get drop_abc --json\"],\n\t},\n\tresolve: {\n\t\tauth: \"required\",\n\t\texamples: [\n\t\t\t\"dropthis resolve https://abc123.dropthis.app/\",\n\t\t\t\"dropthis resolve abc123 --json\",\n\t\t],\n\t},\n\tlist: {\n\t\tauth: \"required\",\n\t\texamples: [\n\t\t\t\"dropthis list --json\",\n\t\t\t\"dropthis list --domain reports.example.com --json\",\n\t\t],\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 list 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\tdomains: {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis domains list --json\"],\n\t},\n\t\"domains connect\": {\n\t\tauth: \"required\",\n\t\texamples: [\n\t\t\t\"dropthis domains connect reports.example.com --mode path --json\",\n\t\t],\n\t},\n\t\"domains list\": {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis domains list --json\"],\n\t},\n\t\"domains status\": {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis domains status reports.example.com --json\"],\n\t},\n\t\"domains verify\": {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis domains verify reports.example.com --wait --json\"],\n\t},\n\t\"domains update\": {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis domains update reports.example.com --default --json\"],\n\t},\n\t\"domains remove\": {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis domains remove reports.example.com --yes --json\"],\n\t},\n\t\"api-keys\": {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis api-keys create --label CI --json\"],\n\t},\n\t\"api-keys create\": {\n\t\tauth: \"required\",\n\t\texamples: [\n\t\t\t\"dropthis api-keys create --label CI --json\",\n\t\t\t\"dropthis api-keys create --service --workspace acme --json\",\n\t\t],\n\t},\n\t\"api-keys list\": {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis api-keys list --json\"],\n\t},\n\t\"api-keys delete\": {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis api-keys delete key_abc --yes --json\"],\n\t},\n\tworkspace: {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis workspace list --json\", \"dropthis workspace use acme\"],\n\t},\n\t\"workspace list\": {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis workspace list --json\"],\n\t},\n\t\"workspace use\": {\n\t\tauth: \"required\",\n\t\texamples: [\n\t\t\t\"dropthis workspace use acme\",\n\t\t\t\"dropthis workspace use ws_team123\",\n\t\t],\n\t},\n\t\"workspace create\": {\n\t\tauth: \"required\",\n\t\texamples: ['dropthis workspace create \"Acme\" --slug acme --json'],\n\t},\n\t\"workspace rename\": {\n\t\tauth: \"required\",\n\t\texamples: ['dropthis workspace rename ws_team123 --name \"Acme Inc\" --json'],\n\t},\n\t\"workspace delete\": {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis workspace delete ws_team123 --yes --json\"],\n\t},\n\tmembers: {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis members list ws_team123 --json\"],\n\t},\n\t\"members list\": {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis members list ws_team123 --json\"],\n\t},\n\t\"members invite\": {\n\t\tauth: \"required\",\n\t\texamples: [\n\t\t\t\"dropthis members invite ws_team123 --email teammate@acme.com --role member --json\",\n\t\t],\n\t},\n\t\"members role\": {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis members role ws_team123 acc_123 --role admin --json\"],\n\t},\n\t\"members remove\": {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis members remove ws_team123 acc_123 --yes --json\"],\n\t},\n\tinvitations: {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis invitations --json\"],\n\t},\n\t\"invitations list\": {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis invitations list --json\"],\n\t},\n\t\"invitations accept\": {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis invitations accept --token inv_tok_abc --json\"],\n\t},\n\t\"invitations accept-by-id\": {\n\t\tauth: \"required\",\n\t\texamples: [\"dropthis invitations accept-by-id inv_123 --json\"],\n\t},\n\tlogin: {\n\t\texamples: [\n\t\t\t\"dropthis login\",\n\t\t\t\"dropthis login request --email user@example.com --json\",\n\t\t\t\"dropthis login verify --email user@example.com --otp 123456 --json\",\n\t\t],\n\t},\n\t\"login request\": {\n\t\texamples: [\"dropthis login request --email user@example.com --json\"],\n\t},\n\t\"login verify\": {\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: {\n\t\texamples: [\"dropthis doctor --json\", \"dropthis doctor --online --json\"],\n\t},\n\tupgrade: { examples: [\"dropthis upgrade\", \"dropthis upgrade --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\nexport type GlobalOption = { flags: string; description: string };\n\n/**\n * The program-level flags (--api-key, --api-url, --json, --quiet,\n * --no-interactive) an agent can pass to ANY command. Generated from the live\n * program so it cannot drift from what Commander actually accepts.\n */\nexport function buildGlobalOptions(program: Command): GlobalOption[] {\n\treturn program.options.map((o) => ({\n\t\tflags: o.flags,\n\t\tdescription: o.description,\n\t}));\n}\n","import type { Command } from \"commander\";\nimport { buildCatalog, buildGlobalOptions } from \"../catalog.js\";\nimport { EXIT_CODES } from \"../output.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\tglobal_options: buildGlobalOptions(deps.program),\n\t\t\texit_codes: EXIT_CODES,\n\t\t})}\\n`,\n\t);\n\treturn { exitCode: 0 };\n}\n","import { requireCredential } from \"../auth.js\";\nimport {\n\tformatDateTime,\n\twriteApiError,\n\twriteAuthError,\n\twriteEmpty,\n\twriteJson,\n\twriteKv,\n} from \"../fmt.js\";\nimport {\n\ttype CommandDeps,\n\textractPagination,\n\ttype SdkResult,\n} from \"../types.js\";\nimport { hint } from \"../ui.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 page = extractPagination(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\tconst created =\n\t\t\t\t\ttypeof item.createdAt === \"string\"\n\t\t\t\t\t\t? formatDateTime(item.createdAt)\n\t\t\t\t\t\t: \"\";\n\t\t\t\tdeps.stdout(\n\t\t\t\t\t`${item.id ?? \"\"} rev ${item.revision ?? \"?\"} ${created}\\n`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (page?.hasMore && page.nextCursor) {\n\t\t\t\tdeps.stdout(\n\t\t\t\t\t`${hint(`More deployments: dropthis deployments list ${dropId} --cursor ${page.nextCursor}`)}\\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, {\n\t\t\tok: true,\n\t\t\t...spread,\n\t\t\t...(page ? { next_cursor: page.nextCursor, has_more: page.hasMore } : {}),\n\t\t});\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)\n\t\tpairs.push([\"Created\", formatDateTime(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","// `PKG_VERSION` is a tsup build-time define (inlined as a string literal in the\n// built bundle). Under `tsx`/dev mode (`npm run dev`, the `make smoke/local`\n// harness) it is never defined; `typeof` on an undeclared identifier is safe and\n// does not throw. Centralize the guard so every runtime read works in both modes.\nexport const CLI_VERSION: string =\n\ttypeof PKG_VERSION === \"string\" ? PKG_VERSION : \"0.0.0-dev\";\n","import { resolveCredential } from \"../auth.js\";\nimport { cliErrorCodeFor, writeKv } from \"../fmt.js\";\nimport { type ApiErrorDetails, exitCodeFor } from \"../output.js\";\nimport type { CredentialStore } from \"../storage.js\";\nimport type { SdkResult } from \"../types.js\";\nimport { CLI_VERSION } from \"../version.js\";\n\ntype DoctorClient = {\n\taccount: { get(): Promise<SdkResult<unknown>> };\n\tdomains: { list(): Promise<SdkResult<unknown>> };\n};\n\ntype CommandDeps = {\n\tstore: CredentialStore;\n\tclient: DoctorClient;\n\tenv: Record<string, string | undefined>;\n\tstdout: (value: string) => void;\n\tstderr: (value: string) => void;\n\toutputMode?: \"human\" | \"json\";\n};\n\ntype Check = { name: string; status: \"ok\" | \"warn\" | \"fail\"; detail: string };\n\n/**\n * The online preflight: an agent runs `dropthis doctor --online` BEFORE a\n * publish to tell apart the recurring failure modes — re-auth (exit 3) vs a\n * network blip (exit 5) vs an unresolved workspace — instead of flailing on a\n * failed publish. Pure composition over GET /v1/account + GET /v1/domains.\n */\nasync function onlineChecks(\n\tdeps: CommandDeps,\n\thasCredential: boolean,\n): Promise<{ checks: Check[]; exitCode: number }> {\n\tif (!hasCredential) {\n\t\treturn {\n\t\t\tchecks: [\n\t\t\t\t{\n\t\t\t\t\tname: \"auth\",\n\t\t\t\t\tstatus: \"fail\",\n\t\t\t\t\tdetail:\n\t\t\t\t\t\t\"No credential found — run `dropthis login` or set DROPTHIS_API_KEY.\",\n\t\t\t\t},\n\t\t\t],\n\t\t\texitCode: exitCodeFor(\"auth_error\"),\n\t\t};\n\t}\n\n\tconst account = await deps.client.account.get();\n\tif (account.error) {\n\t\tconst code = cliErrorCodeFor(account.error as ApiErrorDetails);\n\t\tconst isAuth = code === \"auth_error\";\n\t\treturn {\n\t\t\tchecks: [\n\t\t\t\t{\n\t\t\t\t\tname: \"api_reachable\",\n\t\t\t\t\tstatus: isAuth ? \"ok\" : \"fail\",\n\t\t\t\t\tdetail: isAuth\n\t\t\t\t\t\t? \"reached the API\"\n\t\t\t\t\t\t: `could not reach the API: ${account.error.message}`,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: \"auth\",\n\t\t\t\t\tstatus: isAuth ? \"fail\" : \"warn\",\n\t\t\t\t\tdetail: isAuth\n\t\t\t\t\t\t? \"credential rejected — re-authenticate with `dropthis login`\"\n\t\t\t\t\t\t: account.error.message,\n\t\t\t\t},\n\t\t\t],\n\t\t\texitCode: exitCodeFor(code),\n\t\t};\n\t}\n\n\tconst data = account.data as Record<string, unknown> | null;\n\tconst checks: Check[] = [\n\t\t{ name: \"api_reachable\", status: \"ok\", detail: \"reached the API\" },\n\t\t{ name: \"auth\", status: \"ok\", detail: \"credential accepted\" },\n\t];\n\tconst ws = data?.workspace as Record<string, unknown> | undefined;\n\tchecks.push(\n\t\tws?.name\n\t\t\t? {\n\t\t\t\t\tname: \"workspace\",\n\t\t\t\t\tstatus: \"ok\",\n\t\t\t\t\tdetail: `active: ${String(ws.name)} (${String(ws.kind)})`,\n\t\t\t\t}\n\t\t\t: {\n\t\t\t\t\tname: \"workspace\",\n\t\t\t\t\tstatus: \"warn\",\n\t\t\t\t\tdetail:\n\t\t\t\t\t\t\"no active workspace resolved — pass --workspace or run `dropthis workspace use`\",\n\t\t\t\t},\n\t);\n\tif (data?.plan) {\n\t\tchecks.push({ name: \"plan\", status: \"ok\", detail: String(data.plan) });\n\t}\n\n\t// Custom-domain verification status (best-effort; a read error here doesn't fail the preflight).\n\tconst domains = await deps.client.domains.list();\n\tif (!domains.error) {\n\t\tconst list =\n\t\t\t((domains.data as Record<string, unknown> | null)?.domains as\n\t\t\t\t| Array<Record<string, unknown>>\n\t\t\t\t| undefined) ?? [];\n\t\tconst live = list.filter((d) => d.status === \"live\").length;\n\t\tconst pending = list.length - live;\n\t\tchecks.push({\n\t\t\tname: \"domains\",\n\t\t\tstatus: pending > 0 ? \"warn\" : \"ok\",\n\t\t\tdetail: `${list.length} connected, ${live} live${\n\t\t\t\tpending > 0 ? `, ${pending} pending verification` : \"\"\n\t\t\t}`,\n\t\t});\n\t}\n\n\treturn { checks, exitCode: 0 };\n}\n\nexport async function runDoctor(\n\tinput: { json?: boolean; online?: 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\", CLI_VERSION],\n\t\t[\"Auth\", authSource],\n\t\t[\"Storage\", storageBackend],\n\t];\n\n\tif (!input.online) {\n\t\twriteKv(deps, pairs, {\n\t\t\tok: true,\n\t\t\tversion: CLI_VERSION,\n\t\t\tauth: { source: authSource },\n\t\t\tstorage: { backend: storageBackend },\n\t\t});\n\t\treturn { exitCode: 0 };\n\t}\n\n\tconst { checks, exitCode } = await onlineChecks(\n\t\tdeps,\n\t\tcredential !== undefined,\n\t);\n\tfor (const c of checks) {\n\t\tpairs.push([c.name, `${c.status} — ${c.detail}`]);\n\t}\n\twriteKv(deps, pairs, {\n\t\tok: exitCode === 0,\n\t\tversion: CLI_VERSION,\n\t\tauth: { source: authSource },\n\t\tstorage: { backend: storageBackend },\n\t\tchecks,\n\t});\n\treturn { exitCode };\n}\n","import * as prompts from \"@clack/prompts\";\nimport pc from \"picocolors\";\nimport { requireCredential } from \"../auth.js\";\nimport {\n\tformatDate,\n\twriteApiError,\n\twriteAuthError,\n\twriteEmpty,\n\twriteError,\n\twriteHumanOrJson,\n\twriteJson,\n} from \"../fmt.js\";\nimport { errorEnvelope } from \"../output.js\";\nimport type { CommandDeps, SdkResult } from \"../types.js\";\nimport { hint, success, warn } from \"../ui.js\";\n\n// ---------------------------------------------------------------------------\n// Client types (structural — the actual SDK class satisfies these)\n// ---------------------------------------------------------------------------\n\ntype DnsRecord = {\n\tpurpose: string;\n\ttype: string;\n\tname: string;\n\tvalue: string;\n\tstatus: \"missing\" | \"ok\" | \"mismatch\";\n\tobserved?: string | null;\n\thint?: string | null;\n\tretryAfter?: number | null;\n};\n\ntype NextHint = {\n\taction: string;\n\tmessage: string;\n};\n\ntype DomainResponse = {\n\tobject: \"domain\";\n\tid: string;\n\thostname: string;\n\tmode: \"path\" | \"dedicated\";\n\tstatus: \"pending_dns\" | \"verifying\" | \"live\" | \"failed\";\n\tfailureReason?: string | null;\n\tdefault: boolean;\n\tdropId?: string | null;\n\tdns: DnsRecord[];\n\tcreatedAt: string;\n\tverifiedAt?: string | null;\n\tnext: NextHint[];\n\tconsoleUrl?: string;\n};\n\ntype DomainDeletedResponse = {\n\tobject: \"domain.deleted\";\n\tid: string;\n\thostname: string;\n\twarning: string;\n};\n\ntype DomainListResponse = {\n\tobject: \"domain.list\";\n\tdomains: DomainResponse[];\n};\n\ntype DomainsClient = {\n\tdomains: {\n\t\tconnect(input: {\n\t\t\thostname: string;\n\t\t\tmode: \"path\" | \"dedicated\";\n\t\t}): Promise<SdkResult<DomainResponse>>;\n\t\tlist(): Promise<SdkResult<DomainListResponse>>;\n\t\tget(idOrHostname: string): Promise<SdkResult<DomainResponse>>;\n\t\tverify(idOrHostname: string): Promise<SdkResult<DomainResponse>>;\n\t\tupdate(\n\t\t\tidOrHostname: string,\n\t\t\tinput: { dropId?: string | null; default?: boolean | null },\n\t\t): Promise<SdkResult<DomainResponse>>;\n\t\tdelete(idOrHostname: string): Promise<SdkResult<DomainDeletedResponse>>;\n\t};\n};\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\n/** Render a DNS records table for human output. */\nfunction formatDnsTable(records: DnsRecord[]): string {\n\tif (records.length === 0) return \"\";\n\tconst rows: string[] = [];\n\tconst colWidths = {\n\t\ttype: Math.max(4, ...records.map((r) => r.type.length)),\n\t\tname: Math.max(4, ...records.map((r) => r.name.length)),\n\t\tvalue: Math.max(5, ...records.map((r) => r.value.length)),\n\t\tstatus: Math.max(6, ...records.map((r) => r.status.length)),\n\t};\n\tconst header = [\n\t\t\"Type\".padEnd(colWidths.type),\n\t\t\"Name\".padEnd(colWidths.name),\n\t\t\"Value\".padEnd(colWidths.value),\n\t\t\"Status\".padEnd(colWidths.status),\n\t].join(\" \");\n\trows.push(pc.dim(header));\n\trows.push(pc.dim(\"─\".repeat(header.length)));\n\tfor (const rec of records) {\n\t\tconst statusColor =\n\t\t\trec.status === \"ok\"\n\t\t\t\t? pc.green(rec.status.padEnd(colWidths.status))\n\t\t\t\t: rec.status === \"mismatch\"\n\t\t\t\t\t? pc.yellow(rec.status.padEnd(colWidths.status))\n\t\t\t\t\t: pc.red(rec.status.padEnd(colWidths.status));\n\t\trows.push(\n\t\t\t[\n\t\t\t\trec.type.padEnd(colWidths.type),\n\t\t\t\trec.name.padEnd(colWidths.name),\n\t\t\t\trec.value.padEnd(colWidths.value),\n\t\t\t\tstatusColor,\n\t\t\t].join(\" \"),\n\t\t);\n\t\tif (rec.hint) {\n\t\t\trows.push(` ${pc.dim(rec.hint)}`);\n\t\t}\n\t\tif (rec.observed) {\n\t\t\trows.push(` ${pc.dim(`Observed: ${rec.observed}`)}`);\n\t\t}\n\t}\n\treturn rows.join(\"\\n\");\n}\n\n/** Translate a server next-hint into a CLI-register string for human output. */\nfunction renderNextHint(\n\th: NextHint,\n\thostname: string,\n\tmaxRetryAfter: number,\n): string {\n\tif (h.action === \"verify\") {\n\t\tconst recheck =\n\t\t\tmaxRetryAfter > 0 ? ` (re-checks every ${maxRetryAfter}s)` : \"\";\n\t\treturn `Run: dropthis domains verify ${hostname} --wait${recheck}`;\n\t}\n\tif (h.action === \"publish\") {\n\t\treturn `Run: dropthis publish <file> --domain ${hostname}`;\n\t}\n\t// \"dns\" hints and unknown actions: message is register-neutral, keep verbatim\n\treturn h.message;\n}\n\n/**\n * True when a \"dns\" next-hint repeats what a record-table hint already says\n * (same record name and value). The table line wins; the duplicate prose is\n * dropped so the create-this-CNAME instruction appears once.\n */\nfunction duplicatesRecordHint(h: NextHint, dns: DnsRecord[]): boolean {\n\tif (h.action !== \"dns\") return false;\n\treturn dns.some(\n\t\t(r) => r.hint && h.message.includes(r.name) && h.message.includes(r.value),\n\t);\n}\n\n/** Print next-step hints for human output. */\nfunction printNextHints(\n\tdeps: { stdout: (v: string) => void },\n\thints: NextHint[],\n\thostname: string,\n\tdns: DnsRecord[],\n): void {\n\tconst lines = hints.filter((h) => !duplicatesRecordHint(h, dns));\n\tif (lines.length === 0) return;\n\tconst maxRetryAfter = dns.reduce(\n\t\t(max, r) => Math.max(max, r.retryAfter ?? 0),\n\t\t0,\n\t);\n\tdeps.stdout(\"\\n\");\n\tfor (const h of lines) {\n\t\tdeps.stdout(`${hint(renderNextHint(h, hostname, maxRetryAfter))}\\n`);\n\t}\n}\n\n/**\n * Point the user at the console setup page (consoleUrl) until the domain is live.\n * Adding the DNS record is theirs to do; the console shows it with copy buttons and\n * flips to live automatically — friendlier than the raw record for a non-CLI human.\n */\nfunction printConsoleHandoff(\n\tdeps: { stdout: (v: string) => void },\n\tdomain: DomainResponse,\n): void {\n\tif (domain.status === \"live\" || !domain.consoleUrl) return;\n\tdeps.stdout(\n\t\t`\\n${hint(`Or finish it in the console: ${domain.consoleUrl}`)}\\n`,\n\t);\n}\n\n/** Compute the sleep duration for --wait polling. Caps at remaining timeout. */\nfunction computeSleepMs(\n\trecords: DnsRecord[],\n\telapsedMs: number,\n\ttimeoutMs: number,\n): number {\n\tconst maxRetryAfter = records.reduce(\n\t\t(max, r) => Math.max(max, r.retryAfter ?? 0),\n\t\t0,\n\t);\n\tconst defaultSeconds = maxRetryAfter > 0 ? maxRetryAfter : 15;\n\tconst desiredMs = defaultSeconds * 1000;\n\tconst remainingMs = timeoutMs - elapsedMs;\n\treturn Math.min(desiredMs, Math.max(0, remainingMs));\n}\n\n// ---------------------------------------------------------------------------\n// connect\n// ---------------------------------------------------------------------------\n\nexport async function runDomainsConnect(\n\tinput: { hostname: string; mode: string },\n\tdeps: CommandDeps<DomainsClient>,\n): Promise<{ exitCode: number }> {\n\tif (input.mode !== \"path\" && input.mode !== \"dedicated\") {\n\t\treturn writeError(\n\t\t\tdeps,\n\t\t\t\"invalid_usage\",\n\t\t\t'--mode must be \"path\" or \"dedicated\"',\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.domains.connect(\n\t\tinput as { hostname: string; mode: \"path\" | \"dedicated\" },\n\t);\n\tif (result.error) return writeApiError(deps, result.error);\n\tconst domain = result.data;\n\tif (deps.outputMode === \"human\") {\n\t\tdeps.stdout(\n\t\t\t`${success(`Connected ${domain.hostname} (${domain.mode} mode)`)}\\n`,\n\t\t);\n\t\tif (domain.dns.length > 0) {\n\t\t\tdeps.stdout(\"\\nDNS records to create at your provider:\\n\\n\");\n\t\t\tdeps.stdout(`${formatDnsTable(domain.dns)}\\n`);\n\t\t}\n\t\tprintNextHints(deps, domain.next, domain.hostname, domain.dns);\n\t\tprintConsoleHandoff(deps, domain);\n\t} else {\n\t\twriteJson(deps, { ok: true, domain });\n\t}\n\treturn { exitCode: 0 };\n}\n\n// ---------------------------------------------------------------------------\n// list\n// ---------------------------------------------------------------------------\n\nexport async function runDomainsList(\n\t_input: { json?: boolean },\n\tdeps: CommandDeps<DomainsClient>,\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.domains.list();\n\tif (result.error) return writeApiError(deps, result.error);\n\tconst domains: DomainResponse[] = result.data?.domains ?? [];\n\tif (deps.outputMode === \"human\") {\n\t\tif (domains.length === 0) {\n\t\t\twriteEmpty(deps, \"No domains connected yet.\", { ok: true, domains: [] });\n\t\t} else {\n\t\t\tfor (const d of domains) {\n\t\t\t\tconst defaultMark = d.default ? pc.green(\" (default)\") : \"\";\n\t\t\t\tconst drop = d.dropId ? pc.dim(` → ${d.dropId}`) : \"\";\n\t\t\t\tdeps.stdout(\n\t\t\t\t\t` ${d.hostname}${defaultMark} ${pc.dim(d.mode)} ${pc.dim(d.status)}${drop}\\n`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t} else {\n\t\twriteJson(deps, { ok: true, domains });\n\t}\n\treturn { exitCode: 0 };\n}\n\n// ---------------------------------------------------------------------------\n// status (get)\n// ---------------------------------------------------------------------------\n\nexport async function runDomainsStatus(\n\tidOrHostname: string,\n\t_input: { json?: boolean },\n\tdeps: CommandDeps<DomainsClient>,\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.domains.get(idOrHostname);\n\tif (result.error) return writeApiError(deps, result.error);\n\tconst domain = result.data;\n\tif (deps.outputMode === \"human\") {\n\t\tdeps.stdout(` ${pc.dim(\"Hostname:\")} ${domain.hostname}\\n`);\n\t\tdeps.stdout(` ${pc.dim(\"Mode: \")} ${domain.mode}\\n`);\n\t\tdeps.stdout(` ${pc.dim(\"Status: \")} ${domain.status}\\n`);\n\t\tif (domain.failureReason) {\n\t\t\tdeps.stdout(\n\t\t\t\t` ${pc.dim(\"Reason: \")} ${pc.red(domain.failureReason)}\\n`,\n\t\t\t);\n\t\t}\n\t\tif (domain.dropId) {\n\t\t\tdeps.stdout(` ${pc.dim(\"Drop: \")} ${domain.dropId}\\n`);\n\t\t}\n\t\tif (domain.verifiedAt) {\n\t\t\tdeps.stdout(\n\t\t\t\t` ${pc.dim(\"Verified:\")} ${formatDate(domain.verifiedAt)}\\n`,\n\t\t\t);\n\t\t}\n\t\tdeps.stdout(` ${pc.dim(\"Created: \")} ${formatDate(domain.createdAt)}\\n`);\n\t\tif (domain.dns.length > 0) {\n\t\t\tdeps.stdout(\"\\nDNS records:\\n\\n\");\n\t\t\tdeps.stdout(`${formatDnsTable(domain.dns)}\\n`);\n\t\t}\n\t\tprintNextHints(deps, domain.next, domain.hostname, domain.dns);\n\t\tprintConsoleHandoff(deps, domain);\n\t} else {\n\t\twriteJson(deps, { ok: true, domain });\n\t}\n\treturn { exitCode: 0 };\n}\n\n// ---------------------------------------------------------------------------\n// verify\n// ---------------------------------------------------------------------------\n\n/** Sleep function injectable for testing. */\nexport type SleepFn = (ms: number) => Promise<void>;\n\nconst defaultSleep: SleepFn = (ms) =>\n\tnew Promise((resolve) => setTimeout(resolve, ms));\n\nexport async function runDomainsVerify(\n\tidOrHostname: string,\n\tinput: { wait?: boolean; timeout?: number; json?: boolean },\n\tdeps: CommandDeps<DomainsClient>,\n\tsleep: SleepFn = defaultSleep,\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\n\tconst timeoutMs = (input.timeout ?? 300) * 1000;\n\n\tconst doVerify = async (elapsedMs: number): Promise<{ exitCode: number }> => {\n\t\tconst result = await deps.client.domains.verify(idOrHostname);\n\t\tif (result.error) return writeApiError(deps, result.error);\n\t\tconst domain = result.data;\n\n\t\tif (!input.wait) {\n\t\t\t// One-shot: handle pending/verifying separately\n\t\t\tif (domain.status !== \"live\" && domain.status !== \"failed\") {\n\t\t\t\t// pending_dns or verifying: not ready yet\n\t\t\t\tif (deps.outputMode === \"human\") {\n\t\t\t\t\tdeps.stdout(`${warn(`${idOrHostname}: ${domain.status}`)}\\n`);\n\t\t\t\t\tif (domain.dns.length > 0) {\n\t\t\t\t\t\tdeps.stdout(\"\\n\");\n\t\t\t\t\t\tdeps.stdout(`${formatDnsTable(domain.dns)}\\n`);\n\t\t\t\t\t}\n\t\t\t\t\tprintNextHints(deps, domain.next, domain.hostname, domain.dns);\n\t\t\t\t\tprintConsoleHandoff(deps, domain);\n\t\t\t\t} else {\n\t\t\t\t\twriteError(\n\t\t\t\t\t\tdeps,\n\t\t\t\t\t\t\"verify_pending\",\n\t\t\t\t\t\t`${idOrHostname}: ${domain.status}`,\n\t\t\t\t\t\t`Re-run: dropthis domains verify ${idOrHostname}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn { exitCode: 6 };\n\t\t\t}\n\n\t\t\t// live or failed\n\t\t\tif (deps.outputMode === \"human\") {\n\t\t\t\tdeps.stdout(\n\t\t\t\t\t`${domain.status === \"live\" ? success(`${idOrHostname} is live`) : warn(`${idOrHostname}: ${domain.status}`)}\\n`,\n\t\t\t\t);\n\t\t\t\tif (domain.dns.length > 0) {\n\t\t\t\t\tdeps.stdout(\"\\n\");\n\t\t\t\t\tdeps.stdout(`${formatDnsTable(domain.dns)}\\n`);\n\t\t\t\t}\n\t\t\t\tprintNextHints(deps, domain.next, domain.hostname, domain.dns);\n\t\t\t\tprintConsoleHandoff(deps, domain);\n\t\t\t} else {\n\t\t\t\twriteJson(deps, { ok: true, domain });\n\t\t\t}\n\t\t\treturn {\n\t\t\t\texitCode: domain.status === \"live\" ? 0 : 1,\n\t\t\t};\n\t\t}\n\n\t\t// --wait mode: loop until live/failed/timeout\n\t\tif (domain.status === \"live\" || domain.status === \"failed\") {\n\t\t\tif (deps.outputMode === \"human\") {\n\t\t\t\tdeps.stdout(\n\t\t\t\t\t`${domain.status === \"live\" ? success(`${idOrHostname} is live`) : warn(`${idOrHostname}: ${domain.status}`)}\\n`,\n\t\t\t\t);\n\t\t\t\tif (domain.dns.length > 0) {\n\t\t\t\t\tdeps.stdout(\"\\n\");\n\t\t\t\t\tdeps.stdout(`${formatDnsTable(domain.dns)}\\n`);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\twriteJson(deps, { ok: true, domain });\n\t\t\t}\n\t\t\treturn { exitCode: domain.status === \"live\" ? 0 : 1 };\n\t\t}\n\n\t\t// Not terminal — check timeout\n\t\tconst sleepMs = computeSleepMs(domain.dns, elapsedMs, timeoutMs);\n\t\tconst newElapsed = elapsedMs + sleepMs;\n\t\tif (newElapsed >= timeoutMs) {\n\t\t\t// Timed out\n\t\t\tconst timeoutSecs = input.timeout ?? 300;\n\t\t\tconst message = `Timed out waiting for ${idOrHostname} to go live after ${timeoutSecs}s`;\n\t\t\tif (deps.outputMode === \"human\") {\n\t\t\t\tdeps.stderr(\n\t\t\t\t\t` ${pc.red(\"Timed out waiting for\")} ${idOrHostname} ${pc.red(\"to go live\")}\\n`,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tdeps.stderr(\n\t\t\t\t\t`${JSON.stringify(errorEnvelope(\"verify_timeout\", message, `DNS is still propagating. Re-run: dropthis domains verify ${idOrHostname}`))}\\n`,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn { exitCode: 7 };\n\t\t}\n\n\t\tif (deps.outputMode === \"json\" && domain.dns.length > 0) {\n\t\t\tconst elapsed = Math.round(elapsedMs / 1000);\n\t\t\tdeps.stderr(\n\t\t\t\t`${JSON.stringify({ ok: false, pending: true, status: domain.status, elapsed })}\\n`,\n\t\t\t);\n\t\t}\n\n\t\tif (deps.outputMode === \"human\" && domain.dns.length > 0) {\n\t\t\tdeps.stdout(`${formatDnsTable(domain.dns)}\\n`);\n\t\t}\n\n\t\tawait sleep(sleepMs);\n\t\treturn doVerify(newElapsed);\n\t};\n\n\treturn doVerify(0);\n}\n\n// ---------------------------------------------------------------------------\n// update\n// ---------------------------------------------------------------------------\n\nexport async function runDomainsUpdate(\n\tidOrHostname: string,\n\tinput: { drop?: string; setDefault?: boolean; json?: boolean },\n\tdeps: CommandDeps<DomainsClient>,\n): Promise<{ exitCode: number }> {\n\t// At least one option is required\n\tif (input.drop === undefined && input.setDefault === undefined) {\n\t\treturn writeError(\n\t\t\tdeps,\n\t\t\t\"invalid_usage\",\n\t\t\t\"Provide at least one option: --drop <dropId> or --default\",\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 updateInput: { dropId?: string | null; default?: boolean | null } = {};\n\tif (input.drop !== undefined) updateInput.dropId = input.drop;\n\tif (input.setDefault !== undefined) updateInput.default = input.setDefault;\n\n\tconst result = await deps.client.domains.update(idOrHostname, updateInput);\n\tif (result.error) return writeApiError(deps, result.error);\n\tconst domain = result.data;\n\twriteHumanOrJson(deps, `${success(`Updated ${domain.hostname}`)}\\n`, {\n\t\tok: true,\n\t\tdomain,\n\t});\n\treturn { exitCode: 0 };\n}\n\n// ---------------------------------------------------------------------------\n// remove\n// ---------------------------------------------------------------------------\n\nexport async function runDomainsRemove(\n\tidOrHostname: string,\n\tinput: { yes?: boolean; json?: boolean; interactive?: boolean },\n\tdeps: CommandDeps<DomainsClient>,\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 remove the domain 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: `Remove ${idOrHostname}? This removes the domain and unmounts its drops.`,\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.domains.delete(idOrHostname);\n\tif (result.error) return writeApiError(deps, result.error);\n\tconst deleted = result.data;\n\tif (deps.outputMode === \"human\") {\n\t\tdeps.stdout(`${success(`Removed ${deleted.hostname}`)}\\n`);\n\t\tif (deleted.warning) {\n\t\t\tdeps.stderr(`${warn(deleted.warning)}\\n`);\n\t\t}\n\t} else {\n\t\twriteJson(deps, {\n\t\t\tok: true,\n\t\t\tdeleted: true,\n\t\t\tid: deleted.id,\n\t\t\thostname: deleted.hostname,\n\t\t\twarning: deleted.warning,\n\t\t});\n\t}\n\treturn { exitCode: 0 };\n}\n","import * as prompts from \"@clack/prompts\";\nimport pc from \"picocolors\";\nimport { requireCredential } from \"../auth.js\";\nimport {\n\tformatDate,\n\twriteApiError,\n\twriteAuthError,\n\twriteEmpty,\n\twriteError,\n\twriteHumanOrJson,\n\twriteJson,\n\twriteKv,\n} from \"../fmt.js\";\nimport {\n\ttype CommandDeps,\n\textractPagination,\n\ttype SdkResult,\n\tunwrapListData,\n} from \"../types.js\";\nimport { url as fmtUrl, hint, 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\tdomain?: string;\n\t\t}): Promise<SdkResult<unknown>>;\n\t};\n};\n\ntype ResolvedDrop = { id: string; slug?: string; [key: string]: unknown };\n\nexport type DropsResolveClient = {\n\tdrops: {\n\t\tresolve(urlOrSlug: string): Promise<SdkResult<ResolvedDrop | null>>;\n\t};\n};\n\ntype DropsGetClient = DropsResolveClient & {\n\tdrops: {\n\t\tget(dropId: string): Promise<SdkResult<unknown>>;\n\t};\n};\n\ntype DropsDeleteClient = DropsResolveClient & {\n\tdrops: {\n\t\tdelete(\n\t\t\tdropId: string,\n\t\t): Promise<SdkResult<null>> | SdkResult<null> | undefined;\n\t};\n};\n\n/**\n * Accepts what users actually have in their clipboard: the full drop_… id, a\n * drop URL, or a bare slug. Ids pass through; anything else resolves through\n * drops.resolve (owner-scoped). On failure the API error is already written.\n */\nexport async function resolveDropTarget(\n\ttarget: string,\n\tdeps: CommandDeps<DropsResolveClient>,\n): Promise<\n\t| {\n\t\t\tok: true;\n\t\t\tdropId: string;\n\t\t\tslug?: string;\n\t\t\tresolvedFrom?: string;\n\t\t\ttitle?: string;\n\t }\n\t| { ok: false; exitCode: number }\n> {\n\tif (target.startsWith(\"drop_\")) return { ok: true, dropId: target };\n\tconst resolved = await deps.client.drops.resolve(target);\n\tif (resolved.error) {\n\t\treturn { ok: false, ...writeApiError(deps, resolved.error) };\n\t}\n\tif (resolved.data === null) {\n\t\treturn {\n\t\t\tok: false,\n\t\t\t...writeApiError(deps, {\n\t\t\t\tcode: \"not_found\",\n\t\t\t\tmessage: `No drop matching \"${target}\" found in your account.`,\n\t\t\t\tsuggestion:\n\t\t\t\t\t\"It may belong to another account or have been deleted. \" +\n\t\t\t\t\t\"Run dropthis list to see your drops, or pass the full drop_… id.\",\n\t\t\t}),\n\t\t};\n\t}\n\treturn {\n\t\tok: true,\n\t\tdropId: resolved.data.id,\n\t\tresolvedFrom: target,\n\t\t...(resolved.data.slug ? { slug: resolved.data.slug } : {}),\n\t\t...(typeof resolved.data.title === \"string\"\n\t\t\t? { title: resolved.data.title }\n\t\t\t: {}),\n\t};\n}\n\n/** Human-mode breadcrumb so a resolved write shows which drop the URL/slug mapped to. */\nexport function writeResolvedLine(\n\tdeps: CommandDeps<DropsResolveClient>,\n\tresolved: { dropId: string; resolvedFrom?: string; title?: string },\n): void {\n\tif (!resolved.resolvedFrom || deps.outputMode !== \"human\") return;\n\tconst title = resolved.title ? ` (${resolved.title})` : \"\";\n\tdeps.stdout(\n\t\t`${hint(`resolved ${resolved.resolvedFrom} → ${resolved.dropId}${title}`)}\\n`,\n\t);\n}\n\nexport async function runDropsList(\n\tinput: { limit?: number; cursor?: string; domain?: 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\t...(input.domain ? { domain: input.domain } : {}),\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 page = extractPagination(result.data);\n\tconst items = Array.isArray(raw)\n\t\t? (raw as Array<Record<string, unknown>>)\n\t\t: undefined;\n\tif (deps.outputMode === \"human\") {\n\t\tif (!items || items.length === 0) {\n\t\t\twriteEmpty(deps, \"No drops found.\", { ok: true, drops: [] });\n\t\t} else {\n\t\t\tfor (const item of items) {\n\t\t\t\tconst created =\n\t\t\t\t\ttypeof item.createdAt === \"string\"\n\t\t\t\t\t\t? pc.dim(formatDate(item.createdAt))\n\t\t\t\t\t\t: \"\";\n\t\t\t\tdeps.stdout(\n\t\t\t\t\t`${item.id ?? \"\"} ${created} ${item.title ?? \"\"} ${item.url ? fmtUrl(String(item.url)) : \"\"}\\n`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tdeps.stdout(\n\t\t\t\t`${pc.dim(`${items.length} ${items.length === 1 ? \"drop\" : \"drops\"}`)}\\n`,\n\t\t\t);\n\t\t\tif (page?.hasMore && page.nextCursor) {\n\t\t\t\tdeps.stdout(\n\t\t\t\t\t`${hint(`More drops: dropthis list --cursor ${page.nextCursor}`)}\\n`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t} else {\n\t\twriteJson(deps, {\n\t\t\tok: true,\n\t\t\tdrops: items ?? raw,\n\t\t\t...(page ? { next_cursor: page.nextCursor, has_more: page.hasMore } : {}),\n\t\t});\n\t}\n\treturn { exitCode: 0 };\n}\n\nexport async function runDropsGet(\n\ttarget: 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 resolved = await resolveDropTarget(target, deps);\n\tif (!resolved.ok) return { exitCode: resolved.exitCode };\n\twriteResolvedLine(deps, resolved);\n\tconst result = await deps.client.drops.get(resolved.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)\n\t\tpairs.push([\"Created\", formatDate(String(data.createdAt))]);\n\tif (data.domain) pairs.push([\"Domain\", String(data.domain)]);\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\n/**\n * Resolve a public drop URL or bare slug (or a drop_… id — the server resolver\n * accepts ids too) back to the drop, printing its id + url. The single lenient\n * on-ramp: writes are id-only, so this is how you recover the id from a URL.\n */\nexport async function runDropsResolve(\n\ttarget: string,\n\t_input: { json?: boolean },\n\tdeps: CommandDeps<DropsResolveClient>,\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.resolve(target);\n\tif (result.error) return writeApiError(deps, result.error);\n\tif (result.data === null) {\n\t\treturn writeApiError(deps, {\n\t\t\tcode: \"not_found\",\n\t\t\tmessage: `No drop matching \"${target}\" found in your account.`,\n\t\t\tsuggestion:\n\t\t\t\t\"It may belong to another account or have been deleted. \" +\n\t\t\t\t\"Run dropthis list to see your drops, or pass the full drop_… id.\",\n\t\t});\n\t}\n\tconst drop = result.data as Record<string, unknown>;\n\tconst pairs: Array<[string, string]> = [];\n\tif (drop.id) pairs.push([\"ID\", String(drop.id)]);\n\tif (drop.url) pairs.push([\"URL\", fmtUrl(String(drop.url))]);\n\tif (drop.title) pairs.push([\"Title\", String(drop.title)]);\n\tif (drop.slug) pairs.push([\"Slug\", String(drop.slug)]);\n\twriteKv(deps, pairs, { ok: true, drop });\n\treturn { exitCode: 0 };\n}\n\nexport async function runDropsDelete(\n\ttarget: 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\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\t// Resolve before confirming so the prompt names the actual drop.\n\tconst resolved = await resolveDropTarget(target, deps);\n\tif (!resolved.ok) return { exitCode: resolved.exitCode };\n\twriteResolvedLine(deps, resolved);\n\tconst dropId = resolved.dropId;\n\tif (!input.yes && input.interactive !== false) {\n\t\tconst confirmed = await prompts.confirm({\n\t\t\tmessage: `Delete ${dropId}${dropId === target ? \"\" : ` (${target})`}?`,\n\t\t});\n\t\tif (prompts.isCancel(confirmed) || !confirmed) {\n\t\t\treturn { exitCode: 0 };\n\t\t}\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 { requireCredential } from \"../auth.js\";\nimport {\n\twriteApiError,\n\twriteAuthError,\n\twriteEmpty,\n\twriteHumanOrJson,\n\twriteJson,\n} from \"../fmt.js\";\nimport { type CommandDeps, type SdkResult, unwrapListData } from \"../types.js\";\nimport { success } from \"../ui.js\";\n\ntype Invitation = {\n\tid: string;\n\tworkspaceId: string;\n\temail: string;\n\trole: string;\n\tstatus: string;\n\texpiresAt: string;\n\tcreatedAt: string;\n\tacceptedAt?: string;\n};\n\ntype Workspace = {\n\tid: string;\n\tname: string;\n\tslug: string;\n\tkind: string;\n\trole: string;\n\tplan: string;\n\tisActive: boolean;\n};\n\ntype InvitationsListClient = {\n\tinvitations: {\n\t\t// GET /v1/invitations returns { invitations: [...] }, not a page.\n\t\tlist(): Promise<SdkResult<{ invitations: Invitation[] } | null>>;\n\t};\n};\n\ntype InvitationsAcceptClient = {\n\tinvitations: {\n\t\taccept(input: { token: string }): Promise<SdkResult<Workspace>>;\n\t};\n};\n\ntype InvitationsAcceptByIdClient = {\n\tinvitations: {\n\t\tacceptById(input: { invitationId: string }): Promise<SdkResult<Workspace>>;\n\t};\n};\n\nexport async function runInvitationsList(\n\t_input: { json?: boolean },\n\tdeps: CommandDeps<InvitationsListClient>,\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\n\tconst result = await deps.client.invitations.list();\n\tif (result.error) return writeApiError(deps, result.error);\n\n\t// GET returns { invitations: [...] } (not a { data } page), so fall back to\n\t// the `invitations` key — otherwise the list came back empty.\n\tconst raw = unwrapListData(result.data, \"invitations\");\n\tconst items = Array.isArray(raw) ? (raw as Invitation[]) : [];\n\n\tif (deps.outputMode === \"human\") {\n\t\tif (items.length === 0) {\n\t\t\twriteEmpty(deps, \"No pending invitations.\", {\n\t\t\t\tok: true,\n\t\t\t\tinvitations: [],\n\t\t\t});\n\t\t} else {\n\t\t\tfor (const inv of items) {\n\t\t\t\tdeps.stdout(`${inv.email} ${inv.role} ${inv.status} ${inv.id}\\n`);\n\t\t\t}\n\t\t}\n\t} else {\n\t\twriteJson(deps, { ok: true, invitations: items });\n\t}\n\n\treturn { exitCode: 0 };\n}\n\nexport async function runInvitationsAccept(\n\tinput: { token: string; json?: boolean },\n\tdeps: CommandDeps<InvitationsAcceptClient>,\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\n\tconst result = await deps.client.invitations.accept({ token: input.token });\n\tif (result.error) return writeApiError(deps, result.error);\n\n\tconst ws = result.data;\n\twriteHumanOrJson(\n\t\tdeps,\n\t\tsuccess(`Joined ${ws.name} (${ws.slug}) — now your active workspace.`),\n\t\t{ ok: true, workspace: ws },\n\t);\n\n\treturn { exitCode: 0 };\n}\n\nexport async function runInvitationsAcceptById(\n\tinput: { invitationId: string; json?: boolean },\n\tdeps: CommandDeps<InvitationsAcceptByIdClient>,\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\n\tconst result = await deps.client.invitations.acceptById({\n\t\tinvitationId: input.invitationId,\n\t});\n\tif (result.error) return writeApiError(deps, result.error);\n\n\tconst ws = result.data;\n\twriteHumanOrJson(\n\t\tdeps,\n\t\tsuccess(`Joined ${ws.name} (${ws.slug}) — now your active workspace.`),\n\t\t{ ok: true, workspace: ws },\n\t);\n\n\treturn { exitCode: 0 };\n}\n","import * as prompts from \"@clack/prompts\";\nimport { writeApiError, writeHumanOrJson } from \"../fmt.js\";\nimport { type ApiErrorDetails, exitCodeFor } from \"../output.js\";\nimport type { CredentialStore } from \"../storage.js\";\nimport type { SdkResult } from \"../types.js\";\nimport { success } from \"../ui.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\tscopes?: string[];\n};\n\n// All login endpoints fail with the full SDK error envelope (code, statusCode,\n// suggestion, requestId, …) so errors render API truth via writeApiError and a\n// 401 maps to exit 3. The typed `code` (dropthis#80) — `otp_expired` (no active\n// code) vs `otp_invalid` (wrong digits) — rides on ApiErrorDetails.\ntype LoginRequestClient = {\n\tauth: {\n\t\trequestEmailOtp(input: {\n\t\t\temail: string;\n\t\t}): Promise<SdkResult<OtpRequestData, ApiErrorDetails>>;\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, ApiErrorDetails>>;\n\t};\n\tapiKeys: {\n\t\tcreate(input: {\n\t\t\tlabel: string;\n\t\t\ttype?: \"delegated\" | \"service\";\n\t\t\tscopes?: string[];\n\t\t}): Promise<SdkResult<ApiKeyData, ApiErrorDetails>>;\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\t/** A single bundle name (e.g. \"team\") to request a capability-scoped login key. */\n\tscope?: string;\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\t// The code aged out (not a typo): request a fresh one automatically\n\t\t// instead of asking the user to retype an already-expired code.\n\t\tif (result.error.code === \"otp_expired\" && attempt < maxAttempts) {\n\t\t\tconst resend = await deps.client.auth.requestEmailOtp({ email });\n\t\t\tif (resend.error) {\n\t\t\t\tprompts.cancel(resend.error.message);\n\t\t\t\treturn { exitCode: exitCodeFor(\"api_error\") };\n\t\t\t}\n\t\t\tprompts.log.info(\"That code expired — we sent a new one.\");\n\t\t\tcontinue;\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({\n\t\tlabel: \"CLI\",\n\t\ttype: \"delegated\",\n\t\t...(deps.scope ? { scopes: [deps.scope] } : {}),\n\t});\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\t...(apiKey.data.scopes ? { scopes: apiKey.data.scopes } : {}),\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\toutputMode?: \"human\" | \"json\";\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\treturn writeApiError(deps, result.error);\n\t}\n\twriteHumanOrJson(\n\t\tdeps,\n\t\tsuccess(`Code sent to ${input.email}. Check your inbox.`),\n\t\t{\n\t\t\tok: true,\n\t\t\temail: input.email,\n\t\t\texpires_in: result.data.expiresIn,\n\t\t},\n\t);\n\treturn { exitCode: 0 };\n}\n\nexport async function runLoginVerify(\n\tinput: { email: string; otp: string; scope?: 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\toutputMode?: \"human\" | \"json\";\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\t// writeApiError renders the server suggestion + request_id; the otp_expired\n\t\t// vs otp_invalid next-action split lives in cliNextAction (output.ts).\n\t\treturn writeApiError(deps, session.error);\n\t}\n\tconst authedClient = deps.createClient(session.data.token);\n\tconst apiKey = await authedClient.apiKeys.create({\n\t\tlabel: \"CLI\",\n\t\ttype: \"delegated\",\n\t\t// A single bundle name (e.g. \"team\") requests a capability-scoped key; the\n\t\t// server returns the resolved scope list on the mint response.\n\t\t...(input.scope ? { scopes: [input.scope] } : {}),\n\t});\n\tif (apiKey.error) {\n\t\treturn writeApiError(deps, apiKey.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\t...(apiKey.data.scopes ? { scopes: apiKey.data.scopes } : {}),\n\t\tstorage: \"secure\",\n\t});\n\twriteHumanOrJson(deps, success(`Logged in as ${input.email}.`), {\n\t\tok: true,\n\t\taccount_id: apiKey.data.accountId ?? session.data.accountId,\n\t\tkey_id: apiKey.data.id,\n\t\tkey_last4: apiKey.data.keyLast4,\n\t\tis_new_account: apiKey.data.isNewAccount ?? session.data.isNewAccount,\n\t});\n\treturn { exitCode: 0 };\n}\n","import { writeApiError, writeHumanOrJson } from \"../fmt.js\";\nimport type { ApiErrorDetails } from \"../output.js\";\nimport type { CredentialStore } from \"../storage.js\";\nimport type { 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, ApiErrorDetails>\n\t\t\t| Promise<SdkResult<null, ApiErrorDetails>>\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: ApiErrorDetails | 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;\n\t}\n\t// Clear local state unconditionally: logout must never leave a key on disk,\n\t// even when the server-side revoke failed (offline, already revoked, 500).\n\t// Clearing locally is exactly the case the user cares about on a lost or\n\t// compromised machine.\n\tawait deps.store.clear();\n\tif (revokeError) {\n\t\t// Render the full server error (suggestion + request_id) and map a 401 to\n\t\t// exit 3, consistent with every other command's API-error path.\n\t\treturn writeApiError(deps, revokeError);\n\t}\n\twriteHumanOrJson(deps, success(\"Logged out.\"), { ok: true });\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} from \"../fmt.js\";\nimport { type CommandDeps, type SdkResult, unwrapListData } from \"../types.js\";\nimport { success } from \"../ui.js\";\n\ntype Member = {\n\taccountId: string;\n\temail: string;\n\trole: string;\n\tisYou: boolean;\n\tjoinedAt: string;\n};\n\ntype Invitation = {\n\tid: string;\n\tworkspaceId: string;\n\temail: string;\n\trole: string;\n\tstatus: string;\n\texpiresAt: string;\n\tcreatedAt: string;\n};\n\ntype MembersListClient = {\n\tmembers: {\n\t\t// GET /v1/workspaces/{id}/members returns { members: [...] }, not a page.\n\t\tlist(workspaceId: string): Promise<SdkResult<{ members: Member[] } | null>>;\n\t};\n};\n\ntype MembersInviteClient = {\n\tmembers: {\n\t\tinvite(\n\t\t\tworkspaceId: string,\n\t\t\tinput: { email: string; role: \"admin\" | \"member\" },\n\t\t): Promise<SdkResult<Invitation>>;\n\t};\n};\n\ntype MembersRoleClient = {\n\tmembers: {\n\t\tupdateRole(\n\t\t\tworkspaceId: string,\n\t\t\taccountId: string,\n\t\t\tinput: { role: \"owner\" | \"admin\" | \"member\" },\n\t\t): Promise<SdkResult<Member>>;\n\t};\n};\n\n// DELETE /v1/workspaces/{id}/members/{accountId} returns 204 No Content; the SDK\n// types it DropthisResult<null>. Success is `error === null` — never read data.\ntype MembersRemoveClient = {\n\tmembers: {\n\t\tremove(\n\t\t\tworkspaceId: string,\n\t\t\taccountId: string,\n\t\t): Promise<SdkResult<null>> | SdkResult<null> | undefined;\n\t};\n};\n\nexport async function runMembersList(\n\tworkspaceId: string,\n\t_input: { json?: boolean },\n\tdeps: CommandDeps<MembersListClient>,\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\n\tconst result = await deps.client.members.list(workspaceId);\n\tif (result.error) return writeApiError(deps, result.error);\n\n\t// GET returns { members: [...] } (not a { data } page), so fall back to the\n\t// `members` key — otherwise the list came back empty.\n\tconst raw = unwrapListData(result.data, \"members\");\n\tconst items = Array.isArray(raw) ? (raw as Member[]) : [];\n\n\tif (deps.outputMode === \"human\") {\n\t\tif (items.length === 0) {\n\t\t\twriteEmpty(deps, \"No members.\", { ok: true, members: [] });\n\t\t} else {\n\t\t\tfor (const m of items) {\n\t\t\t\tconst who = m.email || m.accountId;\n\t\t\t\tconst you = m.isYou ? \"(you)\" : \"\";\n\t\t\t\tdeps.stdout(`${who} ${m.role} ${you}\\n`);\n\t\t\t}\n\t\t}\n\t} else {\n\t\twriteJson(deps, { ok: true, members: items });\n\t}\n\n\treturn { exitCode: 0 };\n}\n\nexport async function runMembersInvite(\n\tworkspaceId: string,\n\tinput: { email: string; role?: \"admin\" | \"member\"; json?: boolean },\n\tdeps: CommandDeps<MembersInviteClient>,\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\n\tconst role = input.role ?? \"member\";\n\tconst result = await deps.client.members.invite(workspaceId, {\n\t\temail: input.email,\n\t\trole,\n\t});\n\tif (result.error) return writeApiError(deps, result.error);\n\n\twriteHumanOrJson(deps, success(`Invited ${input.email} as ${role}`), {\n\t\tok: true,\n\t\tinvitation: result.data,\n\t});\n\n\treturn { exitCode: 0 };\n}\n\nexport async function runMembersRole(\n\tworkspaceId: string,\n\taccountId: string,\n\tinput: { role: \"owner\" | \"admin\" | \"member\"; json?: boolean },\n\tdeps: CommandDeps<MembersRoleClient>,\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\n\tconst result = await deps.client.members.updateRole(workspaceId, accountId, {\n\t\trole: input.role,\n\t});\n\tif (result.error) return writeApiError(deps, result.error);\n\n\twriteHumanOrJson(deps, success(`Set ${accountId} to ${input.role}`), {\n\t\tok: true,\n\t\tmember: result.data,\n\t});\n\n\treturn { exitCode: 0 };\n}\n\nexport async function runMembersRemove(\n\tworkspaceId: string,\n\taccountId: string,\n\tinput: { yes?: boolean; json?: boolean; interactive?: boolean },\n\tdeps: CommandDeps<MembersRemoveClient>,\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 remove 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: `Remove ${accountId} from workspace ${workspaceId}?`,\n\t\t});\n\t\tif (prompts.isCancel(confirmed) || !confirmed) {\n\t\t\treturn { exitCode: 0 };\n\t\t}\n\t}\n\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\n\tconst result = await deps.client.members.remove(workspaceId, accountId);\n\tif (result?.error) return writeApiError(deps, result.error);\n\n\twriteHumanOrJson(deps, success(`Removed ${accountId}`), {\n\t\tok: true,\n\t\tremoved: true,\n\t\taccount_id: accountId,\n\t});\n\n\treturn { exitCode: 0 };\n}\n","import { randomUUID } from \"node:crypto\";\nimport { readFile } from \"node:fs/promises\";\nimport type { PublishFileInput } from \"@dropthis/node\";\n\nexport type DropData = { url: string; [key: string]: unknown };\n\nexport type ManifestFile = {\n\tpath: string;\n\tcontentType: string;\n\t/** Size in bytes for inline files. Undefined for remote (source_url) files whose size is determined server-side on fetch. */\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\n/**\n * Raw shape of one file entry in a --manifest JSON bundle (snake_case, as\n * written by users/agents in the JSON file). Exactly one of content,\n * content_base64, or source_url must be present (or bytes for programmatic use,\n * though the CLI JSON format only supports the string variants).\n */\ntype ManifestJsonFileEntry = {\n\tpath: string;\n\tcontent?: string;\n\tcontent_base64?: string;\n\tsource_url?: string;\n\tcontent_type?: string;\n\tsize_bytes?: number;\n\tchecksum_sha256?: string;\n};\n\n/**\n * Load and validate a --manifest JSON file, returning the SDK-ready\n * `{kind:\"files\", files:[...]}` input.\n *\n * The JSON file must have the shape:\n * { \"files\": [ { \"path\": \"...\", \"content\"|\"content_base64\"|\"source_url\": \"...\" } ] }\n *\n * snake_case keys are mapped to camelCase (source_url → sourceUrl, etc.).\n *\n * Throws a plain Error (message suitable for writeError) on validation failure.\n */\nexport async function loadManifestFile(\n\tmanifestPath: string,\n): Promise<{ kind: \"files\"; files: PublishFileInput[] }> {\n\tlet raw: unknown;\n\ttry {\n\t\traw = JSON.parse(await readFile(manifestPath, \"utf8\")) as unknown;\n\t} catch (err) {\n\t\tconst msg =\n\t\t\terr instanceof Error ? err.message : \"Could not read manifest file.\";\n\t\tthrow new Error(`Failed to read manifest file: ${msg}`);\n\t}\n\n\tif (!raw || typeof raw !== \"object\" || Array.isArray(raw)) {\n\t\tthrow new Error(\"Manifest must be a JSON object with a 'files' array.\");\n\t}\n\tconst obj = raw as Record<string, unknown>;\n\tif (!Array.isArray(obj.files)) {\n\t\tthrow new Error(\"Manifest must have a 'files' array.\");\n\t}\n\n\tconst files: PublishFileInput[] = (obj.files as ManifestJsonFileEntry[]).map(\n\t\t(entry, i) => {\n\t\t\tif (!entry || typeof entry !== \"object\") {\n\t\t\t\tthrow new Error(`Manifest files[${i}] must be an object.`);\n\t\t\t}\n\t\t\tconst {\n\t\t\t\tpath,\n\t\t\t\tcontent,\n\t\t\t\tcontent_base64,\n\t\t\t\tsource_url,\n\t\t\t\tcontent_type,\n\t\t\t\tsize_bytes,\n\t\t\t\tchecksum_sha256,\n\t\t\t} = entry;\n\t\t\tif (!path || typeof path !== \"string\") {\n\t\t\t\tthrow new Error(`Manifest files[${i}] must have a 'path' string.`);\n\t\t\t}\n\t\t\tconst contentKeys = [content, content_base64, source_url].filter(\n\t\t\t\t(v) => v !== undefined,\n\t\t\t);\n\t\t\tif (contentKeys.length === 0) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Manifest files[${i}] (path: \"${path}\") must have exactly one of: content, content_base64, source_url.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (contentKeys.length > 1) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Manifest files[${i}] (path: \"${path}\") must have only one of: content, content_base64, source_url.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (\n\t\t\t\tsource_url !== undefined &&\n\t\t\t\t!source_url.startsWith(\"http://\") &&\n\t\t\t\t!source_url.startsWith(\"https://\")\n\t\t\t) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Manifest files[${i}] (path: \"${path}\") has an invalid source_url \"${source_url}\": source_url must be an http(s) URL.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst file: PublishFileInput = { path };\n\t\t\tif (content !== undefined) file.content = content;\n\t\t\tif (content_base64 !== undefined) file.contentBase64 = content_base64;\n\t\t\tif (source_url !== undefined) file.sourceUrl = source_url;\n\t\t\tif (content_type !== undefined) file.contentType = content_type;\n\t\t\t// size_bytes and checksum_sha256 are not in PublishFileInput — they are\n\t\t\t// upload-session fields. Pass them only if the SDK type accepts them.\n\t\t\t// For now, we silently ignore them (they are hints for the server on the\n\t\t\t// upload path, not needed here since we pass content/source_url directly).\n\t\t\t// If the SDK adds them to PublishFileInput, add a cast here.\n\t\t\tif (size_bytes !== undefined)\n\t\t\t\t(file as Record<string, unknown>).sizeBytes = size_bytes;\n\t\t\tif (checksum_sha256 !== undefined)\n\t\t\t\t(file as Record<string, unknown>).checksumSha256 = checksum_sha256;\n\t\t\treturn file;\n\t\t},\n\t);\n\n\treturn { kind: \"files\", files };\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\t// Remote (source_url) files have no sizeBytes — their size is determined\n\t// server-side on fetch. Sum only the numeric values to avoid NaN.\n\tconst remoteFileCount = prepared.manifest.files.filter(\n\t\t(f) => typeof f.sizeBytes !== \"number\",\n\t).length;\n\tconst totalBytes = prepared.manifest.files.reduce(\n\t\t(sum, f) => sum + (typeof f.sizeBytes === \"number\" ? f.sizeBytes : 0),\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\t// Only include remoteFileCount when there are remote files, to preserve\n\t\t// the existing output shape for all-inline bundles.\n\t\t...(remoteFileCount > 0 ? { remoteFileCount } : {}),\n\t};\n}\n","import { readFile } from \"node:fs/promises\";\nimport { SHARED_POOL } from \"@dropthis/node\";\n\nexport type RawDropOptions = {\n\ttitle?: string;\n\tvisibility?: \"public\" | \"unlisted\";\n\tpassword?: string;\n\tnoPassword?: boolean;\n\tnoindex?: boolean;\n\tindex?: boolean;\n\texpiresAt?: string;\n\tnoExpires?: boolean;\n\tmetadata?: string;\n\tmetadataFile?: string;\n\tentry?: string;\n\tcontentType?: string;\n\tpath?: string;\n\tidempotencyKey?: string;\n\tdomain?: string;\n\tshared?: boolean;\n\tslug?: string;\n\t/** Path to a manifest JSON file (--manifest). */\n\tmanifest?: string;\n\t/** Target workspace slug or id for this publish (delegated keys only). */\n\tworkspace?: string;\n};\n\nexport type ParsedDropOptions = {\n\ttitle?: string;\n\tvisibility?: \"public\" | \"unlisted\";\n\tpassword?: string | null;\n\tnoindex?: boolean;\n\texpiresAt?: string | null;\n\tmetadata?: Record<string, unknown>;\n\tentry?: string;\n\tcontentType?: string;\n\tpath?: string;\n\tidempotencyKey?: string;\n\tdomain?: string;\n\tslug?: string;\n\t/** Target workspace slug or id for this publish (delegated keys only). */\n\tworkspace?: 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 (raw.expiresAt && raw.noExpires) {\n\t\tthrow new Error(\"Use either --expires-at or --no-expires, not both.\");\n\t}\n\tif (raw.shared && raw.domain) {\n\t\tthrow new Error(\"Use either --shared or --domain <hostname>, 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.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...(raw.noExpires ? { expiresAt: null } : {}),\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\t...(raw.shared\n\t\t\t? { domain: SHARED_POOL }\n\t\t\t: raw.domain\n\t\t\t\t? { domain: raw.domain }\n\t\t\t\t: {}),\n\t\t...(raw.slug ? { slug: raw.slug } : {}),\n\t\t...(raw.workspace ? { workspace: raw.workspace } : {}),\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\tloadManifestFile,\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\tmanifest?: 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: PublishInput | 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\t// --manifest: load a JSON bundle file. Error if combined with positional input.\n\tif (raw.manifest) {\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\t\"--manifest cannot be combined with a positional input.\",\n\t\t\t\t\"Remove the positional argument, or omit --manifest and pass your files directly.\",\n\t\t\t);\n\t\t}\n\t\tlet manifestInput: PublishInput;\n\t\ttry {\n\t\t\tmanifestInput = await loadManifestFile(raw.manifest);\n\t\t} catch (err) {\n\t\t\tconst msg = err instanceof Error ? err.message : \"Invalid manifest.\";\n\t\t\treturn writeError(deps, \"invalid_usage\", msg);\n\t\t}\n\t\tinput = manifestInput;\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: PublishInput | 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\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\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 { mkdir, writeFile } from \"node:fs/promises\";\nimport { dirname, isAbsolute, join, relative, resolve } from \"node:path\";\nimport { requireCredential } from \"../auth.js\";\nimport {\n\twriteApiError,\n\twriteAuthError,\n\twriteError,\n\twriteHumanOrJson,\n} from \"../fmt.js\";\nimport { createSpinner, shouldSpin } from \"../spinner.js\";\nimport type { CommandDeps, SdkResult } from \"../types.js\";\nimport { success } from \"../ui.js\";\nimport {\n\ttype DropsResolveClient,\n\tresolveDropTarget,\n\twriteResolvedLine,\n} from \"./drops.js\";\n\ntype PullManifestFile = {\n\tpath: string;\n\tcontentType?: string;\n\tsizeBytes?: number;\n};\n\ntype PullManifest = {\n\tdropId: string;\n\tdeploymentId: string;\n\trevision: number;\n\tstatus?: string;\n\tsizeBytes?: number;\n\tentry?: string | null;\n\tfiles: PullManifestFile[];\n};\n\ntype PulledFile = {\n\tpath: string;\n\tcontentType: string | null;\n\tbytes: Uint8Array;\n};\n\ntype PullClient = DropsResolveClient & {\n\tdrops: {\n\t\tgetContent(\n\t\t\tdropId: string,\n\t\t\toptions?: { path?: string; deploymentId?: string },\n\t\t): Promise<SdkResult<PullManifest | PulledFile>>;\n\t};\n};\n\ntype PullDeps = CommandDeps<PullClient> & { cwd?: string };\n\nexport async function runPull(\n\ttarget: string,\n\tinput: { output?: string; deployment?: string; json?: boolean },\n\tdeps: PullDeps,\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\n\t// Resolve a URL/slug to the drop; a full drop_… id skips the round trip.\n\tconst resolved = await resolveDropTarget(target, deps);\n\tif (!resolved.ok) return { exitCode: resolved.exitCode };\n\twriteResolvedLine(deps, resolved);\n\tconst dropId = resolved.dropId;\n\tconst defaultDirName = resolved.slug || resolved.dropId;\n\n\tconst spin = shouldSpin(deps.outputMode)\n\t\t? createSpinner(\"Pulling content…\", deps.stderr)\n\t\t: undefined;\n\n\tconst deploymentId = input.deployment;\n\tconst manifestOptions = deploymentId ? { deploymentId } : undefined;\n\tconst manifestResult = manifestOptions\n\t\t? await deps.client.drops.getContent(dropId, manifestOptions)\n\t\t: await deps.client.drops.getContent(dropId);\n\tif (manifestResult.error) {\n\t\tspin?.fail();\n\t\treturn writeApiError(deps, manifestResult.error);\n\t}\n\tconst manifest = manifestResult.data as PullManifest;\n\n\tconst outDir = resolve(\n\t\tdeps.cwd ?? process.cwd(),\n\t\tinput.output ?? defaultDirName,\n\t);\n\tlet destinations: Array<{ path: string; dest: string }>;\n\ttry {\n\t\tdestinations = manifest.files.map((file) => ({\n\t\t\tpath: file.path,\n\t\t\tdest: safeDestination(outDir, file.path),\n\t\t}));\n\t} catch (error) {\n\t\tspin?.fail();\n\t\tconst message =\n\t\t\terror instanceof Error ? error.message : \"Invalid manifest path.\";\n\t\treturn writeError(deps, \"local_input_error\", message);\n\t}\n\n\ttry {\n\t\tawait mkdir(outDir, { recursive: true });\n\t\tfor (const { path, dest } of destinations) {\n\t\t\tconst fileResult = await deps.client.drops.getContent(dropId, {\n\t\t\t\tpath,\n\t\t\t\t...(deploymentId ? { deploymentId } : {}),\n\t\t\t});\n\t\t\tif (fileResult.error) {\n\t\t\t\tspin?.fail();\n\t\t\t\treturn writeApiError(deps, {\n\t\t\t\t\t...fileResult.error,\n\t\t\t\t\tmessage: `${path}: ${fileResult.error.message}`,\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst file = fileResult.data as PulledFile;\n\t\t\tawait mkdir(dirname(dest), { recursive: true });\n\t\t\tawait writeFile(dest, file.bytes);\n\t\t}\n\t} catch (error) {\n\t\tspin?.fail();\n\t\tconst message =\n\t\t\terror instanceof Error ? error.message : \"Failed to write files.\";\n\t\treturn writeError(deps, \"local_input_error\", message);\n\t}\n\n\tspin?.stop();\n\tconst count = manifest.files.length;\n\twriteHumanOrJson(\n\t\tdeps,\n\t\tsuccess(`Pulled ${count} ${count === 1 ? \"file\" : \"files\"} to ${outDir}`),\n\t\t{\n\t\t\tok: true,\n\t\t\tpulled: {\n\t\t\t\tdropId: manifest.dropId,\n\t\t\t\tdeploymentId: manifest.deploymentId,\n\t\t\t\trevision: manifest.revision,\n\t\t\t\t...(manifest.entry !== undefined ? { entry: manifest.entry } : {}),\n\t\t\t\tdir: outDir,\n\t\t\t\tfiles: manifest.files,\n\t\t\t},\n\t\t},\n\t);\n\treturn { exitCode: 0 };\n}\n\n/**\n * Joins a manifest file path under the output dir, refusing absolute paths and\n * anything that escapes it. Manifest paths come from the server, but a pulled\n * drop must never write outside the chosen directory.\n */\nfunction safeDestination(outDir: string, filePath: string): string {\n\tif (!filePath || isAbsolute(filePath)) {\n\t\tthrow new Error(`Unsafe file path in content manifest: \"${filePath}\"`);\n\t}\n\tconst dest = join(outDir, filePath);\n\tconst rel = relative(outDir, dest);\n\tif (rel.startsWith(\"..\") || isAbsolute(rel)) {\n\t\tthrow new Error(`Unsafe file path in content manifest: \"${filePath}\"`);\n\t}\n\treturn dest;\n}\n","import type { PublishInput, UpdateContentOptions } from \"@dropthis/node\";\nimport { requireCredential } from \"../auth.js\";\nimport {\n\ttype DropData,\n\tformatDryRunManifest,\n\tisFileSystemError,\n\tloadManifestFile,\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 { CommandDeps, SdkResult } from \"../types.js\";\nimport {\n\ttype DropsResolveClient,\n\tresolveDropTarget,\n\twriteResolvedLine,\n} from \"./drops.js\";\n\ntype UpdateContentClient = DropsResolveClient & {\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\tmanifest?: string;\n\t/** Partial-update mode (ADR 0065). Defaults to \"patch\" when omitted. */\n\tmode?: \"patch\" | \"replace\";\n\t/** Shortcut for `mode: \"replace\"` — wins over an explicit --mode. */\n\treplace?: boolean;\n\t/** Repeatable --delete-path; removes named files (patch-mode only). */\n\tdeletePaths?: 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, 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\n/**\n * Partial-update controls (ADR 0065): the logical mode and the paths to remove.\n * `--replace` wins over an explicit `--mode`. Both fields are omitted unless set,\n * so the server applies its default (\"patch\"). The server enforces all validation\n * (e.g. delete_paths invalid with replace) — the CLI just passes the fields through.\n */\nfunction partialOptions(raw: RawUpdateContentOptions): UpdateContentOptions {\n\tconst out: UpdateContentOptions = {};\n\tif (raw.replace) out.mode = \"replace\";\n\telse if (raw.mode !== undefined) out.mode = raw.mode;\n\tif (raw.deletePaths !== undefined && raw.deletePaths.length > 0) {\n\t\tout.deletePaths = raw.deletePaths;\n\t}\n\treturn out;\n}\n\nexport async function runUpdateContent(\n\ttarget: string,\n\tinput: PublishInput | undefined,\n\traw: RawUpdateContentOptions,\n\tdeps: UpdateContentDeps,\n): Promise<{ exitCode: number }> {\n\tconst apiKey = raw.apiKey ?? deps.apiKey;\n\ttry {\n\t\tawait requireCredential({\n\t\t\t...(apiKey ? { 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\n\t// Accept a drop_… id, a drop URL, or a bare slug. Ids skip resolution; a\n\t// URL/slug resolves owner-scoped to the id, then we mutate strictly by id.\n\tconst resolveDeps: CommandDeps<DropsResolveClient> = {\n\t\t...deps,\n\t\t...(apiKey ? { apiKey } : {}),\n\t};\n\tconst resolved = await resolveDropTarget(target, resolveDeps);\n\tif (!resolved.ok) return { exitCode: resolved.exitCode };\n\tconst dropId = resolved.dropId;\n\n\t// --manifest: load a JSON bundle file. Error if combined with positional input.\n\tif (raw.manifest) {\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\t\"--manifest cannot be combined with a positional input.\",\n\t\t\t\t\"Remove the positional argument, or omit --manifest and pass your files directly.\",\n\t\t\t);\n\t\t}\n\t\ttry {\n\t\t\tinput = await loadManifestFile(raw.manifest);\n\t\t} catch (err) {\n\t\t\tconst msg = err instanceof Error ? err.message : \"Invalid manifest.\";\n\t\t\treturn writeError(deps, \"invalid_usage\", msg);\n\t\t}\n\t}\n\n\tif (raw.dryRun) {\n\t\treturn handleDryRun(dropId, input, raw, deps);\n\t}\n\n\twriteResolvedLine(deps, resolved);\n\n\tlet spin: ReturnType<typeof createSpinner> | undefined;\n\ttry {\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{\n\t\t\t\t\t...contentOptions(parsed),\n\t\t\t\t\t...partialOptions(raw),\n\t\t\t\t\t...revisionOptions,\n\t\t\t\t},\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\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","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 { CommandDeps, SdkResult } from \"../types.js\";\nimport {\n\ttype DropsResolveClient,\n\tresolveDropTarget,\n\twriteResolvedLine,\n} from \"./drops.js\";\n\ntype UpdateSettingsClient = DropsResolveClient & {\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| \"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, --visibility, --password, --no-password, --noindex, \" +\n\t\"--index, --expires-at, --no-expires, --domain, --shared, --slug, --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\ttarget: string,\n\traw: RawUpdateSettingsOptions,\n\tdeps: UpdateSettingsDeps,\n): Promise<{ exitCode: number }> {\n\tconst apiKey = raw.apiKey ?? deps.apiKey;\n\ttry {\n\t\tawait requireCredential({\n\t\t\t...(apiKey ? { 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\n\t// Accept a drop_… id, a drop URL, or a bare slug. Ids skip resolution; a\n\t// URL/slug resolves owner-scoped to the id, then we mutate strictly by id.\n\tconst resolveDeps: CommandDeps<DropsResolveClient> = {\n\t\t...deps,\n\t\t...(apiKey ? { apiKey } : {}),\n\t};\n\tconst resolved = await resolveDropTarget(target, resolveDeps);\n\tif (!resolved.ok) return { exitCode: resolved.exitCode };\n\tconst dropId = resolved.dropId;\n\n\tif (raw.dryRun) {\n\t\treturn handleDryRun(dropId, raw, deps);\n\t}\n\n\twriteResolvedLine(deps, resolved);\n\n\tlet spin: ReturnType<typeof createSpinner> | undefined;\n\ttry {\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: \"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(\"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\tconst options = await parseDropOptions(raw);\n\t\tconst fields: Record<string, unknown> = {};\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 !== undefined) fields.expires_at = options.expiresAt;\n\t\tif (options.metadata) fields.metadata = options.metadata;\n\t\tif (options.domain) fields.domain = options.domain;\n\t\tif (options.slug) fields.slug = options.slug;\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","import { execFile } from \"node:child_process\";\nimport { realpathSync } from \"node:fs\";\nimport { promisify } from \"node:util\";\nimport { writeError, writeHumanOrJson } from \"../fmt.js\";\nimport { compareSemver } from \"../semver.js\";\n\nconst execFileAsync = promisify(execFile);\nconst REGISTRY_LATEST = \"https://registry.npmjs.org/@dropthis%2fcli/latest\";\n\nexport type UpgradeDeps = {\n\tstdout: (value: string) => void;\n\tstderr: (value: string) => void;\n\toutputMode?: \"human\" | \"json\";\n\tcurrentVersion: string;\n\t/** Latest published version from the npm registry, or null when unreachable. */\n\tfetchLatest?: () => Promise<string | null>;\n\t/** True when the running binary lives under npm's global root. */\n\tisNpmGlobalInstall?: () => Promise<boolean>;\n\trunNpmInstall?: () => Promise<{ ok: boolean; message?: string }>;\n};\n\nexport async function fetchLatestFromRegistry(): Promise<string | null> {\n\ttry {\n\t\tconst res = await fetch(REGISTRY_LATEST, {\n\t\t\tsignal: AbortSignal.timeout(10_000),\n\t\t});\n\t\tif (!res.ok) return null;\n\t\tconst body = (await res.json()) as { version?: unknown };\n\t\treturn typeof body.version === \"string\" ? body.version : null;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\n/**\n * deno-upgrade-style detection: only self-update what `npm install -g` owns.\n *\n * Windows limitation: npm-global on Windows uses prefix shims (e.g.\n * %APPDATA%\\npm\\dropthis.cmd) that live outside node_modules, so\n * `entry.startsWith(root)` is always false there. This returns false safely\n * (the CLI refuses to self-update) rather than crashing.\n */\nexport async function detectNpmGlobalInstall(): Promise<boolean> {\n\ttry {\n\t\tconst argv1 = process.argv[1];\n\t\tif (!argv1) return false;\n\t\tconst entry = realpathSync(argv1);\n\t\tconst { stdout } = await execFileAsync(\"npm\", [\"root\", \"-g\"]);\n\t\tconst root = realpathSync(stdout.trim());\n\t\treturn entry.startsWith(root);\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nasync function npmInstallLatest(): Promise<{ ok: boolean; message?: string }> {\n\ttry {\n\t\tawait execFileAsync(\"npm\", [\"install\", \"-g\", \"@dropthis/cli@latest\"]);\n\t\treturn { ok: true };\n\t} catch (err) {\n\t\treturn {\n\t\t\tok: false,\n\t\t\tmessage: err instanceof Error ? err.message : String(err),\n\t\t};\n\t}\n}\n\nexport async function runUpgrade(\n\t_input: { json?: boolean },\n\tdeps: UpgradeDeps,\n): Promise<{ exitCode: number }> {\n\tconst fetchLatest = deps.fetchLatest ?? fetchLatestFromRegistry;\n\tconst isNpmGlobal = deps.isNpmGlobalInstall ?? detectNpmGlobalInstall;\n\tconst install = deps.runNpmInstall ?? npmInstallLatest;\n\n\tconst latest = await fetchLatest();\n\tif (!latest) {\n\t\treturn writeError(\n\t\t\tdeps,\n\t\t\t\"upgrade_check_failed\",\n\t\t\t\"Could not reach the npm registry to check for updates. Try again, or run: npm install -g @dropthis/cli@latest\",\n\t\t);\n\t}\n\n\tif (compareSemver(latest, deps.currentVersion) <= 0) {\n\t\twriteHumanOrJson(\n\t\t\tdeps,\n\t\t\t`Already on latest version (${deps.currentVersion})`,\n\t\t\t{ ok: true, status: \"already-latest\", version: deps.currentVersion },\n\t\t);\n\t\treturn { exitCode: 0 };\n\t}\n\n\tif (!(await isNpmGlobal())) {\n\t\treturn writeError(\n\t\t\tdeps,\n\t\t\t\"unsupported_install\",\n\t\t\t`Update available (${deps.currentVersion} → ${latest}), but this install was not made with \\`npm install -g\\`. Upgrade with the installer you used, e.g.: npm install -g @dropthis/cli@latest`,\n\t\t);\n\t}\n\n\tif (deps.outputMode === \"human\") {\n\t\tdeps.stdout(`Updating ${deps.currentVersion} → ${latest}...\\n`);\n\t}\n\n\tconst result = await install();\n\tif (!result.ok) {\n\t\treturn writeError(\n\t\t\tdeps,\n\t\t\t\"upgrade_failed\",\n\t\t\t`npm install failed${result.message ? `: ${result.message}` : \"\"}. Try: npm install -g @dropthis/cli@latest`,\n\t\t);\n\t}\n\n\twriteHumanOrJson(deps, `Updated ${deps.currentVersion} → ${latest}`, {\n\t\tok: true,\n\t\tstatus: \"upgraded\",\n\t\tfrom: deps.currentVersion,\n\t\tto: latest,\n\t});\n\treturn { exitCode: 0 };\n}\n","/** Numeric x.y.z comparison (pre-release suffixes compare on the core triplet only). */\nexport function compareSemver(a: string, b: string): number {\n\tconst parse = (v: string) => (v.split(\"-\")[0] ?? v).split(\".\").map(Number);\n\tconst pa = parse(a);\n\tconst pb = parse(b);\n\tfor (let i = 0; i < 3; i++) {\n\t\tconst d = (pa[i] ?? 0) - (pb[i] ?? 0);\n\t\tif (d !== 0) return d < 0 ? -1 : 1;\n\t}\n\treturn 0;\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\t// Capability scopes are read from the STORED credential (recorded at mint\n\t// time) — no server round-trip — so a scoped key visibly advertises what it\n\t// can do (ADR 0068).\n\tif (credential.scopes?.length)\n\t\tpairs.push([\"Scopes\", credential.scopes.join(\", \")]);\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\t...(credential.scopes?.length ? { scopes: credential.scopes } : {}),\n\t};\n\twriteKv(deps, pairs, jsonEnvelope);\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} from \"../fmt.js\";\nimport { type CommandDeps, type SdkResult, unwrapListData } from \"../types.js\";\nimport { hint, success } from \"../ui.js\";\n\ntype WorkspaceRow = {\n\tid: string;\n\tname: string;\n\tslug: string;\n\tkind: string;\n\trole: string;\n\tplan: string;\n\tisActive: boolean;\n\tcreatorCanReach?: boolean;\n};\n\ntype WorkspaceListClient = {\n\tworkspaces: {\n\t\t// GET /v1/workspaces returns { workspaces: [...] }, not a { object, data } page.\n\t\tlist(): Promise<SdkResult<{ workspaces: WorkspaceRow[] } | null>>;\n\t};\n};\n\ntype WorkspaceUseClient = {\n\tworkspaces: {\n\t\tuse(slugOrId: string): Promise<SdkResult<WorkspaceRow>>;\n\t};\n};\n\ntype WorkspaceCreateClient = {\n\tworkspaces: {\n\t\tcreate(input: {\n\t\t\tname: string;\n\t\t\tslug?: string;\n\t\t}): Promise<SdkResult<WorkspaceRow>>;\n\t};\n};\n\ntype WorkspaceRenameClient = {\n\tworkspaces: {\n\t\trename(\n\t\t\tworkspaceId: string,\n\t\t\tinput: { name?: string; slug?: string },\n\t\t): Promise<SdkResult<WorkspaceRow>>;\n\t};\n};\n\n// DELETE /v1/workspaces/{id} returns 204 No Content; the SDK types it\n// DropthisResult<null>. Success is `error === null` — never read result.data.\ntype WorkspaceDeleteClient = {\n\tworkspaces: {\n\t\tdelete(\n\t\t\tworkspaceId: string,\n\t\t): Promise<SdkResult<null>> | SdkResult<null> | undefined;\n\t};\n};\n\nexport async function runWorkspaceList(\n\t_input: { json?: boolean },\n\tdeps: CommandDeps<WorkspaceListClient>,\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\n\tconst result = await deps.client.workspaces.list();\n\tif (result.error) return writeApiError(deps, result.error);\n\n\t// GET /v1/workspaces returns { workspaces: [...] } (not a { data } page), so fall back to the\n\t// `workspaces` key — otherwise the list came back empty.\n\tconst raw = unwrapListData(result.data, \"workspaces\");\n\tconst items = Array.isArray(raw) ? (raw as WorkspaceRow[]) : [];\n\n\tif (deps.outputMode === \"human\") {\n\t\tif (items.length === 0) {\n\t\t\twriteEmpty(deps, \"No workspaces found.\", { ok: true, workspaces: [] });\n\t\t} else {\n\t\t\tfor (const ws of items) {\n\t\t\t\tconst active = ws.isActive ? \"* \" : \" \";\n\t\t\t\tdeps.stdout(\n\t\t\t\t\t`${active}${ws.slug} ${ws.name} (${ws.kind}, ${ws.role}, ${ws.plan})\\n`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tconst activeWorkspace = items.find((w) => w.isActive) ?? null;\n\t\twriteJson(deps, { ok: true, workspaces: items, active: activeWorkspace });\n\t}\n\n\treturn { exitCode: 0 };\n}\n\nexport async function runWorkspaceUse(\n\tslugOrId: string,\n\t_input: { json?: boolean },\n\tdeps: CommandDeps<WorkspaceUseClient>,\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\n\tconst result = await deps.client.workspaces.use(slugOrId);\n\tif (result.error) return writeApiError(deps, result.error);\n\n\tconst ws = result.data;\n\twriteHumanOrJson(\n\t\tdeps,\n\t\tsuccess(`Now using workspace: ${ws.name} (${ws.slug})`),\n\t\t{ ok: true, workspace: ws },\n\t);\n\n\treturn { exitCode: 0 };\n}\n\nexport async function runWorkspaceCreate(\n\tinput: { name: string; slug?: string; json?: boolean },\n\tdeps: CommandDeps<WorkspaceCreateClient>,\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\n\tconst createInput: { name: string; slug?: string } = { name: input.name };\n\tif (input.slug !== undefined) createInput.slug = input.slug;\n\n\tconst result = await deps.client.workspaces.create(createInput);\n\tif (result.error) return writeApiError(deps, result.error);\n\n\tconst ws = result.data;\n\twriteHumanOrJson(\n\t\tdeps,\n\t\tsuccess(`Created workspace: ${ws.name} (${ws.slug})`),\n\t\t{\n\t\t\tok: true,\n\t\t\tworkspace: ws,\n\t\t},\n\t);\n\n\t// The minting key may not be able to reach a brand-new workspace (e.g. its\n\t// allowlist is fixed at mint time). Flag it on stderr in human mode so the\n\t// user knows to re-authenticate; JSON output stays clean for piping.\n\tif (ws.creatorCanReach === false && deps.outputMode === \"human\") {\n\t\tdeps.stderr(\n\t\t\t`${hint(\"This key can't reach the new workspace — re-authenticate (dropthis login) to pick it up.\")}\\n`,\n\t\t);\n\t}\n\n\treturn { exitCode: 0 };\n}\n\nexport async function runWorkspaceRename(\n\tworkspaceId: string,\n\tinput: { name?: string; slug?: string; json?: boolean },\n\tdeps: CommandDeps<WorkspaceRenameClient>,\n): Promise<{ exitCode: number }> {\n\tif (input.name === undefined && input.slug === undefined) {\n\t\treturn writeError(\n\t\t\tdeps,\n\t\t\t\"invalid_usage\",\n\t\t\t\"Provide --name and/or --slug to rename.\",\n\t\t);\n\t}\n\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\n\tconst renameInput: { name?: string; slug?: string } = {};\n\tif (input.name !== undefined) renameInput.name = input.name;\n\tif (input.slug !== undefined) renameInput.slug = input.slug;\n\n\tconst result = await deps.client.workspaces.rename(workspaceId, renameInput);\n\tif (result.error) return writeApiError(deps, result.error);\n\n\tconst ws = result.data;\n\twriteHumanOrJson(\n\t\tdeps,\n\t\tsuccess(`Renamed workspace: ${ws.name} (${ws.slug})`),\n\t\t{\n\t\t\tok: true,\n\t\t\tworkspace: ws,\n\t\t},\n\t);\n\n\treturn { exitCode: 0 };\n}\n\nexport async function runWorkspaceDelete(\n\tworkspaceId: string,\n\tinput: { yes?: boolean; json?: boolean; interactive?: boolean },\n\tdeps: CommandDeps<WorkspaceDeleteClient>,\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 workspace ${workspaceId}?`,\n\t\t});\n\t\tif (prompts.isCancel(confirmed) || !confirmed) {\n\t\t\treturn { exitCode: 0 };\n\t\t}\n\t}\n\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\n\tconst result = await deps.client.workspaces.delete(workspaceId);\n\tif (result?.error) return writeApiError(deps, result.error);\n\n\twriteHumanOrJson(deps, success(`Deleted workspace ${workspaceId}`), {\n\t\tok: true,\n\t\tdeleted: true,\n\t\tid: workspaceId,\n\t});\n\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\tscopes?: 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","import { stat } from \"node:fs/promises\";\n\n/**\n * Guards the publish path against typo-publishing a ghost drop: `dropthis lst`\n * would otherwise publish the literal text \"lst\". Pure helpers live here;\n * program.ts wires them into the publish action. The command-match guard fires\n * in EVERY mode (agents run non-interactive, so that path was the least\n * protected); the inline-text confirmation prompt stays human/TTY-only.\n */\n\n/** Levenshtein edit distance. Inputs are command-name sized; O(m*n) is fine. */\nexport function levenshtein(a: string, b: string): number {\n\tif (a === b) return 0;\n\tif (a.length === 0) return b.length;\n\tif (b.length === 0) return a.length;\n\tlet prev = Array.from({ length: b.length + 1 }, (_, j) => j);\n\tfor (let i = 1; i <= a.length; i++) {\n\t\tconst curr = [i];\n\t\tfor (let j = 1; j <= b.length; j++) {\n\t\t\tconst cost = a[i - 1] === b[j - 1] ? 0 : 1;\n\t\t\tconst deletion = (prev[j] ?? 0) + 1;\n\t\t\tconst insertion = (curr[j - 1] ?? 0) + 1;\n\t\t\tconst substitution = (prev[j - 1] ?? 0) + cost;\n\t\t\tcurr[j] = Math.min(deletion, insertion, substitution);\n\t\t}\n\t\tprev = curr;\n\t}\n\treturn prev[b.length] ?? 0;\n}\n\n/**\n * Returns the command name a bare token most likely meant, or null when\n * nothing is close. A prefix of a command (length >= 2) or an edit distance\n * <= 2 (and strictly less than the token length) counts as similar.\n */\nexport function suggestCommand(token: string, names: string[]): string | null {\n\tconst lower = token.toLowerCase();\n\tlet best: { name: string; dist: number } | null = null;\n\tfor (const name of names) {\n\t\tif (lower.length >= 2 && name.startsWith(lower)) return name;\n\t\tconst dist = levenshtein(lower, name);\n\t\tif (best === null || dist < best.dist) best = { name, dist };\n\t}\n\tif (best !== null && best.dist <= 2 && best.dist < lower.length) {\n\t\treturn best.name;\n\t}\n\treturn null;\n}\n\n/**\n * True when a publish argv token is a single bare extension-less non-URL\n * word — the shape that is more likely a mistyped command than content.\n */\nexport function isBareWordToken(token: string): boolean {\n\tif (token === \"\" || token === \"-\") return false;\n\tif (/\\s/.test(token)) return false;\n\tif (token.includes(\"/\") || token.includes(\"\\\\\")) return false;\n\tif (token.includes(\".\")) return false;\n\treturn true;\n}\n\n/** True when the token names an existing file or directory. */\nexport async function pathExists(path: string): Promise<boolean> {\n\ttry {\n\t\tawait stat(path);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n","import { spawn } from \"node:child_process\";\nimport { readFileSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { compareSemver } from \"./semver.js\";\n\nexport type UpdateCheckCache = {\n\tlastCheckedAt: string;\n\tlatestVersion: string;\n};\n\nconst CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000;\nconst REGISTRY_LATEST = \"https://registry.npmjs.org/@dropthis%2fcli/latest\";\n\n/** Same config dir as credentials.json (see storage.ts credentialPath). */\nexport function updateCachePath(configDir?: string): string {\n\treturn join(\n\t\tconfigDir ?? join(homedir(), \".config\", \"dropthis\"),\n\t\t\"update-check.json\",\n\t);\n}\n\nexport function readCache(path: string): UpdateCheckCache | null {\n\ttry {\n\t\tconst value = JSON.parse(readFileSync(path, \"utf8\")) as Record<\n\t\t\tstring,\n\t\t\tunknown\n\t\t>;\n\t\tif (\n\t\t\ttypeof value.lastCheckedAt !== \"string\" ||\n\t\t\ttypeof value.latestVersion !== \"string\"\n\t\t)\n\t\t\treturn null;\n\t\treturn {\n\t\t\tlastCheckedAt: value.lastCheckedAt,\n\t\t\tlatestVersion: value.latestVersion,\n\t\t};\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nexport function shouldShowNotice(input: {\n\tenv: Record<string, string | undefined>;\n\tstderrIsTTY: boolean;\n\targv: string[];\n}): boolean {\n\tif (input.env.CI) return false;\n\tif (input.env.DROPTHIS_NO_UPDATE_NOTIFIER) return false;\n\tif (!input.stderrIsTTY) return false;\n\tif (\n\t\tinput.argv.includes(\"--json\") ||\n\t\tinput.argv.includes(\"--quiet\") ||\n\t\tinput.argv.includes(\"-q\")\n\t)\n\t\treturn false;\n\treturn true;\n}\n\nexport function noticeFromCache(input: {\n\tcache: UpdateCheckCache | null;\n\tcurrentVersion: string;\n}): string | null {\n\tif (!input.cache) return null;\n\tif (compareSemver(input.cache.latestVersion, input.currentVersion) <= 0)\n\t\treturn null;\n\treturn `Update available ${input.currentVersion} → ${input.cache.latestVersion} · run \\`dropthis upgrade\\``;\n}\n\nexport function shouldRefresh(\n\tcache: UpdateCheckCache | null,\n\tnow: Date,\n): boolean {\n\tif (!cache) return true;\n\tconst last = Date.parse(cache.lastCheckedAt);\n\tif (Number.isNaN(last)) return true;\n\treturn now.getTime() - last >= CHECK_INTERVAL_MS;\n}\n\ntype SpawnFn = (\n\tcommand: string,\n\targs: string[],\n\toptions: { detached: boolean; stdio: \"ignore\" },\n) => { unref(): void };\n\n/**\n * update-notifier approach: a detached child fetches the registry and writes the\n * cache so THIS run pays zero latency; the notice shows on the NEXT run.\n */\nexport function scheduleBackgroundRefresh(\n\tcachePath: string,\n\tspawnFn: SpawnFn = spawn as SpawnFn,\n): void {\n\tconst script = `\nconst [, cachePath] = process.argv;\nfetch(${JSON.stringify(REGISTRY_LATEST)}, { signal: AbortSignal.timeout(5000) })\n\t.then((r) => (r.ok ? r.json() : Promise.reject(new Error(String(r.status)))))\n\t.then((d) => {\n\t\tconst fs = require(\"node:fs\");\n\t\tconst path = require(\"node:path\");\n\t\tfs.mkdirSync(path.dirname(cachePath), { recursive: true });\n\t\tfs.writeFileSync(cachePath, JSON.stringify({ lastCheckedAt: new Date().toISOString(), latestVersion: String(d.version) }));\n\t})\n\t.catch(() => {});\n`;\n\tconst child = spawnFn(process.execPath, [\"-e\", script, cachePath], {\n\t\tdetached: true,\n\t\tstdio: \"ignore\",\n\t});\n\tchild.unref();\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,U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tB,KAAK,SAAS,SAAS,KACvB,KAAK,SAAS,IAAI,KAClB,QAAQ,IAAI,OAAO,UACnB,QAAQ,OAAO,UAAU;AAE3B;AAGA,IAAM,cAAc,UAAU,gBAAgB,CAAC;AAC/C,IAAM,aAAa,iBAAiB;AAAA,EACnC,KAAK,QAAQ;AAAA,EACb,aAAa,QAAQ,OAAO,UAAU;AAAA,EACtC,MAAM,QAAQ,KAAK,MAAM,CAAC;AAC3B,CAAC;AAGD,IAAI,YAAY;AACf,QAAM,SAAS,gBAAgB;AAAA,IAC9B,OAAO;AAAA,IACP,gBAAgB;AAAA,EACjB,CAAC;AACD,MAAI,QAAQ;AACX,YAAQ,OAAO,MAAM;AAAA,EAAK,KAAK,MAAM,CAAC;AAAA;AAAA,CAAM;AAAA,EAC7C;AACD;AAEA,aAAa,EAAE,OAAO,sBAAsB,EAAE,CAAC,EAC7C,WAAW,QAAQ,IAAI,EACvB,QAAQ,MAAM;AAEd,MAAI,cAAc,cAAc,aAAa,oBAAI,KAAK,CAAC,GAAG;AACzD,8BAA0B,gBAAgB,CAAC;AAAA,EAC5C;AACD,CAAC,EACA,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","resolve","import_node_os","error","error","import_picocolors","import_picocolors","pc","pc","text","pc","prompts","import_picocolors","pc","resolve","prompts","import_picocolors","pc","prompts","prompts","error","import_promises","import_picocolors","pc","hasInput","error","import_promises","error","error","prompts","handleDryRun","prompts","error","cancel","parseJsonObject","prompts","import_node","import_promises","import_node_path","error","import_promises","pc","prompts","deps","global","result","runInlineAuth","import_node_child_process","import_node_fs","import_node_os","import_node_path","REGISTRY_LATEST","error"]}
|