@rolino/cli 0.6.0 → 0.7.0

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.
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/exit-codes.ts","../src/mcp-setup.ts","../src/cli.ts","../package.json","../src/browser-login.ts","../src/output.ts"],"sourcesContent":["export const EXIT_CODES = {\r\n success: 0,\r\n unexpected: 1,\r\n usage: 2,\r\n authentication: 3,\r\n permission: 4,\r\n notFound: 5,\r\n conflict: 6,\r\n validation: 7,\r\n rateLimited: 8,\r\n server: 9,\r\n network: 10,\r\n timeout: 11,\r\n cancelled: 12,\r\n} as const;\r\n\r\nexport type ExitCode = (typeof EXIT_CODES)[keyof typeof EXIT_CODES];\n","import { spawnSync } from \"node:child_process\"\r\nimport { constants } from \"node:fs\"\r\nimport {\r\n access,\r\n chmod,\r\n mkdir,\r\n readFile,\r\n rename,\r\n unlink,\r\n writeFile,\r\n} from \"node:fs/promises\"\r\nimport { createRequire } from \"node:module\"\r\nimport { homedir } from \"node:os\"\r\nimport { dirname, isAbsolute, join, resolve } from \"node:path\"\r\n\r\nexport type McpClientName = \"codex\" | \"claude-code\"\r\nexport type McpSetupScope = \"user\" | \"project\"\r\n\r\nexport type McpSetupResult = {\r\n client: McpClientName\r\n scope: McpSetupScope\r\n target: string\r\n backupPath: string | null\r\n changed: boolean\r\n dryRun: boolean\r\n server: {\r\n command: string\r\n args: string[]\r\n env: { ROLINO_URL: string }\r\n }\r\n}\r\n\r\nexport type McpSetupOptions = {\r\n client: McpClientName\r\n scope: McpSetupScope\r\n baseUrl: string\r\n cwd: string\r\n env: Record<string, string | undefined>\r\n nodePath: string\r\n cliEntryPath: string\r\n serverPath?: string\r\n dryRun?: boolean\r\n force?: boolean\r\n}\r\n\r\nconst CODEX_BEGIN = \"# BEGIN ROLINO MCP (managed by rolino setup mcp)\"\r\nconst CODEX_END = \"# END ROLINO MCP\"\r\n\r\nfunction homeDirectory(env: Record<string, string | undefined>) {\r\n return env.USERPROFILE || env.HOME || homedir()\r\n}\r\n\r\nfunction tomlString(value: string) {\r\n return JSON.stringify(value)\r\n}\r\n\r\nasync function pathExists(path: string) {\r\n try {\r\n await access(path, constants.F_OK)\r\n return true\r\n } catch {\r\n return false\r\n }\r\n}\r\n\r\nasync function resolveServerPath(options: McpSetupOptions) {\r\n if (options.serverPath) {\r\n const path = isAbsolute(options.serverPath)\r\n ? options.serverPath\r\n : resolve(options.cwd, options.serverPath)\r\n if (await pathExists(path)) return path\r\n throw new TypeError(\r\n `Rolino MCP server was not found at ${path}. Check --server-path and try again.`,\r\n )\r\n }\r\n\r\n try {\r\n const requireFromCli = createRequire(resolve(options.cliEntryPath))\r\n const installedPath = join(\r\n dirname(requireFromCli.resolve(\"@rolino/mcp\")),\r\n \"bin.js\",\r\n )\r\n if (await pathExists(installedPath)) return installedPath\r\n throw new TypeError(\r\n \"The installed @rolino/mcp package is incomplete. Reinstall it with npm install --global @rolino/mcp, or pass --server-path.\",\r\n )\r\n } catch (error) {\r\n if (error instanceof TypeError) throw error\r\n }\r\n\r\n const workspacePath = resolve(\r\n dirname(resolve(options.cliEntryPath)),\r\n \"../../mcp/dist/bin.js\",\r\n )\r\n if (await pathExists(workspacePath)) return workspacePath\r\n\r\n throw new TypeError(\r\n \"Rolino MCP is not installed. Run npm install --global @rolino/mcp, then rerun this command. From a Rolino source checkout, run npm run packages:build instead. You can also pass --server-path.\",\r\n )\r\n}\r\n\r\nasync function readOptional(path: string) {\r\n try {\r\n return { exists: true, value: await readFile(path, \"utf8\") }\r\n } catch (error) {\r\n if ((error as NodeJS.ErrnoException).code === \"ENOENT\") {\r\n return { exists: false, value: \"\" }\r\n }\r\n throw error\r\n }\r\n}\r\n\r\nasync function replaceFile(path: string, value: string) {\r\n await mkdir(dirname(path), { recursive: true, mode: 0o700 })\r\n const temporaryPath = `${path}.rolino-${process.pid}.tmp`\r\n await writeFile(temporaryPath, value, { encoding: \"utf8\", mode: 0o600 })\r\n try {\r\n await rename(temporaryPath, path)\r\n } catch {\r\n // Windows does not consistently replace an existing file with rename().\r\n await writeFile(path, value, { encoding: \"utf8\", mode: 0o600 })\r\n await unlink(temporaryPath).catch(() => undefined)\r\n }\r\n await chmod(path, 0o600).catch(() => undefined)\r\n}\r\n\r\nasync function writeConfiguredFile(\r\n path: string,\r\n previous: { exists: boolean; value: string },\r\n value: string,\r\n) {\r\n const backupPath = previous.exists ? `${path}.rolino-backup` : null\r\n if (backupPath) await replaceFile(backupPath, previous.value)\r\n await replaceFile(path, value)\r\n return backupPath\r\n}\r\n\r\nfunction removeExistingCodexEntry(source: string, newline: string) {\r\n if (/^\\s*\\[\\[mcp_servers\\.rolino(?:\\.|\\]\\])/m.test(source)) {\r\n throw new TypeError(\r\n \"Codex config uses an unsupported array-table entry for mcp_servers.rolino.\",\r\n )\r\n }\r\n\r\n const lines = source.split(/\\r?\\n/)\r\n const kept: string[] = []\r\n let insideRolino = false\r\n\r\n for (const line of lines) {\r\n const header = line.match(/^\\s*\\[([^\\]]+)]\\s*(?:#.*)?$/)?.[1]?.trim()\r\n if (header) {\r\n insideRolino = header === \"mcp_servers.rolino\"\r\n || header.startsWith(\"mcp_servers.rolino.\")\r\n }\r\n if (!insideRolino) kept.push(line)\r\n }\r\n\r\n return kept.join(newline).trimEnd()\r\n}\r\n\r\nfunction codexBlock(server: McpSetupResult[\"server\"], newline: string) {\r\n return [\r\n CODEX_BEGIN,\r\n \"[mcp_servers.rolino]\",\r\n `command = ${tomlString(server.command)}`,\r\n `args = [${server.args.map(tomlString).join(\", \")}]`,\r\n `env = { ROLINO_URL = ${tomlString(server.env.ROLINO_URL)} }`,\r\n CODEX_END,\r\n ].join(newline)\r\n}\r\n\r\nexport function updateCodexConfig(\r\n source: string,\r\n server: McpSetupResult[\"server\"],\r\n) {\r\n const newline = source.includes(\"\\r\\n\") ? \"\\r\\n\" : \"\\n\"\r\n const block = codexBlock(server, newline)\r\n const begin = source.indexOf(CODEX_BEGIN)\r\n const end = source.indexOf(CODEX_END)\r\n\r\n if ((begin === -1) !== (end === -1) || (begin !== -1 && end < begin)) {\r\n throw new TypeError(\"Codex config contains an incomplete Rolino-managed block.\")\r\n }\r\n\r\n let unmanagedSource = source\r\n if (begin !== -1) {\r\n const after = end + CODEX_END.length\r\n unmanagedSource = `${source.slice(0, begin)}${source.slice(after)}`\r\n }\r\n\r\n const withoutRolino = removeExistingCodexEntry(unmanagedSource, newline)\r\n return `${withoutRolino ? `${withoutRolino}${newline}${newline}` : \"\"}${block}${newline}`\r\n}\r\n\r\nexport function updateClaudeProjectConfig(\r\n source: string,\r\n server: McpSetupResult[\"server\"],\r\n) {\r\n let parsed: Record<string, unknown> = {}\r\n if (source.trim()) {\r\n try {\r\n parsed = JSON.parse(source) as Record<string, unknown>\r\n } catch {\r\n throw new TypeError(\"Claude project .mcp.json is not valid JSON.\")\r\n }\r\n }\r\n if (!parsed || Array.isArray(parsed) || typeof parsed !== \"object\") {\r\n throw new TypeError(\"Claude project .mcp.json must contain a JSON object.\")\r\n }\r\n\r\n const currentServers = parsed.mcpServers\r\n if (\r\n currentServers !== undefined\r\n && (!currentServers || Array.isArray(currentServers) || typeof currentServers !== \"object\")\r\n ) {\r\n throw new TypeError(\"Claude project .mcp.json mcpServers must be an object.\")\r\n }\r\n\r\n return `${JSON.stringify({\r\n ...parsed,\r\n mcpServers: {\r\n ...(currentServers as Record<string, unknown> | undefined),\r\n rolino: { type: \"stdio\", ...server },\r\n },\r\n }, null, 2)}\\n`\r\n}\r\n\r\nfunction claudeCommand(\r\n args: string[],\r\n options: Pick<McpSetupOptions, \"cwd\" | \"env\">,\r\n) {\r\n const command = options.env.ROLINO_CLAUDE_COMMAND || \"claude\"\r\n const executable = process.platform === \"win32\"\r\n ? options.env.ComSpec || options.env.COMSPEC || \"cmd.exe\"\r\n : command\r\n const commandArgs = process.platform === \"win32\"\r\n ? [\"/d\", \"/s\", \"/c\", command, ...args]\r\n : args\r\n return spawnSync(executable, commandArgs, {\r\n cwd: options.cwd,\r\n env: options.env as NodeJS.ProcessEnv,\r\n encoding: \"utf8\",\r\n windowsHide: true,\r\n })\r\n}\r\n\r\nasync function setupCodex(\r\n options: McpSetupOptions,\r\n server: McpSetupResult[\"server\"],\r\n): Promise<McpSetupResult> {\r\n const target = options.scope === \"project\"\r\n ? join(options.cwd, \".codex\", \"config.toml\")\r\n : join(options.env.CODEX_HOME || join(homeDirectory(options.env), \".codex\"), \"config.toml\")\r\n const current = await readOptional(target)\r\n const updated = updateCodexConfig(current.value, server)\r\n const changed = updated !== current.value\r\n const backupPath = changed && current.exists\r\n ? `${target}.rolino-backup`\r\n : null\r\n if (changed && !options.dryRun) {\r\n await writeConfiguredFile(target, current, updated)\r\n }\r\n\r\n return {\r\n client: \"codex\",\r\n scope: options.scope,\r\n target,\r\n backupPath,\r\n changed,\r\n dryRun: options.dryRun ?? false,\r\n server,\r\n }\r\n}\r\n\r\nasync function setupClaudeCode(\r\n options: McpSetupOptions,\r\n server: McpSetupResult[\"server\"],\r\n): Promise<McpSetupResult> {\r\n if (options.scope === \"project\") {\r\n const target = join(options.cwd, \".mcp.json\")\r\n const current = await readOptional(target)\r\n const updated = updateClaudeProjectConfig(current.value, server)\r\n const changed = updated !== current.value\r\n const backupPath = changed && current.exists\r\n ? `${target}.rolino-backup`\r\n : null\r\n if (changed && !options.dryRun) {\r\n await writeConfiguredFile(target, current, updated)\r\n }\r\n return {\r\n client: \"claude-code\",\r\n scope: \"project\",\r\n target,\r\n backupPath,\r\n changed,\r\n dryRun: options.dryRun ?? false,\r\n server,\r\n }\r\n }\r\n\r\n const target = \"Claude Code user MCP configuration\"\r\n if (options.dryRun) {\r\n return {\r\n client: \"claude-code\",\r\n scope: \"user\",\r\n target,\r\n backupPath: null,\r\n changed: true,\r\n dryRun: true,\r\n server,\r\n }\r\n }\r\n\r\n if (options.force) {\r\n claudeCommand(\r\n [\"mcp\", \"remove\", \"rolino\", \"--scope\", \"user\"],\r\n options,\r\n )\r\n }\r\n const result = claudeCommand([\r\n \"mcp\",\r\n \"add-json\",\r\n \"rolino\",\r\n JSON.stringify({ type: \"stdio\", ...server }),\r\n \"--scope\",\r\n \"user\",\r\n ], options)\r\n if (result.error || result.status !== 0) {\r\n throw new TypeError(\r\n \"Claude Code could not add the Rolino MCP server. Install the `claude` command, or use --scope project. If Rolino already exists, rerun with --force.\",\r\n )\r\n }\r\n\r\n return {\r\n client: \"claude-code\",\r\n scope: \"user\",\r\n target,\r\n backupPath: null,\r\n changed: true,\r\n dryRun: false,\r\n server,\r\n }\r\n}\r\n\r\nexport async function setupMcp(options: McpSetupOptions): Promise<McpSetupResult> {\r\n const serverPath = await resolveServerPath(options)\r\n const server = {\r\n command: options.nodePath,\r\n args: [serverPath],\r\n env: { ROLINO_URL: options.baseUrl },\r\n }\r\n\r\n return options.client === \"codex\"\r\n ? setupCodex(options, server)\r\n : setupClaudeCode(options, server)\r\n}\r\n","import { randomUUID } from \"node:crypto\";\r\nimport { openAsBlob } from \"node:fs\";\r\nimport { readFile, stat } from \"node:fs/promises\";\r\nimport { basename, extname, resolve } from \"node:path\";\r\nimport { createInterface } from \"node:readline/promises\";\r\n\r\nimport { Command, CommanderError, InvalidArgumentError } from \"commander\";\r\nimport packageManifest from \"../package.json\" with { type: \"json\" };\r\nimport {\r\n PostStatusSchema,\r\n AgentBlogDraftUpdateSchema,\r\n ProjectCreateInputSchema,\r\n ProjectTypeSchema,\r\n ProviderDeliveryOptionsProviderSchema,\r\n PublishingProviderSchema,\r\n SeoOpportunityKindSchema,\r\n SeoExpectedImpactSchema,\r\n SeoReportCompletenessSchema,\r\n TikTokDraftSettingsSchema,\r\n YouTubePostSettingsSchema,\r\n type DraftPostInput,\r\n type AgentBlogDraftUpdate,\r\n type AgentBlogConnectionRequest,\r\n type AgentBlogWebhookDestinationChange,\r\n type DraftPostUpdateInput,\r\n type PostStatus,\r\n type ProjectType,\r\n type ProviderDeliveryOptionsProvider,\r\n type PublishingProvider,\r\n type SeoExpectedImpact,\r\n type SeoOpportunityKind,\r\n type SeoReportCompleteness,\r\n} from \"@rolino/contracts\";\r\nimport {\r\n RolinoApiError,\r\n RolinoClient,\r\n RolinoNetworkError,\r\n normalizeRolinoBaseUrl,\r\n parseRolinoTimeout,\r\n} from \"@rolino/sdk\";\r\n\r\nimport {\r\n OAuthAuthorizationDeniedError,\n loginWithBrowser,\r\n} from \"./browser-login.js\";\r\nimport {\n clearOAuthTokenSet,\n createOAuthAccessTokenProvider,\n resolveLocalAuthentication,\n saveOAuthTokenSet,\n} from \"@rolino/local-auth\";\nimport { EXIT_CODES, type ExitCode } from \"./exit-codes.js\";\r\nimport {\r\n formatActor,\r\n formatCalendarEvents,\r\n formatIntegrationHealth,\r\n formatProviderDeliveryOptions,\r\n formatMediaAsset,\r\n formatMediaAssets,\r\n formatPost,\r\n formatPostPublishPreview,\r\n formatPostReadiness,\r\n formatPostSchedulePreview,\r\n formatPostSchedulePending,\r\n formatPosts,\r\n formatProject,\r\n formatProjects,\r\n formatSeoOpportunities,\r\n formatSeoOpportunity,\r\n formatSeoReports,\r\n formatSeoReport,\r\n writeFailure,\r\n writeSuccess,\r\n type OutputContext,\r\n type OutputFormat,\r\n type WritableOutput,\r\n} from \"./output.js\";\r\nimport {\r\n setupMcp,\r\n type McpClientName,\r\n type McpSetupScope,\r\n} from \"./mcp-setup.js\";\r\n\r\nexport const ROLINO_CLI_VERSION = packageManifest.version;\r\n\r\ntype Runtime = {\r\n stdout: WritableOutput;\r\n stderr: WritableOutput;\r\n isTTY: boolean;\r\n env: Record<string, string | undefined>;\r\n fetch?: typeof globalThis.fetch;\r\n cwd: string;\r\n nodePath: string;\r\n cliEntryPath: string;\r\n confirm(message: string): Promise<boolean>;\r\n};\r\n\r\ntype GlobalOptions = {\r\n baseUrl?: string;\r\n output?: OutputFormat;\r\n json?: boolean;\r\n agent?: boolean;\r\n color?: boolean;\r\n timeout?: number;\r\n requestId?: string;\r\n};\r\n\r\nconst REQUEST_ID_PATTERN = /^[A-Za-z0-9._-]{1,128}$/;\r\n\r\nfunction duration(value: string) {\r\n try {\r\n return parseRolinoTimeout(value);\r\n } catch (error) {\r\n throw new InvalidArgumentError(\r\n error instanceof Error ? error.message : \"Timeout is invalid.\",\r\n );\r\n }\r\n}\r\n\r\nfunction requestId(value: string) {\r\n if (!REQUEST_ID_PATTERN.test(value)) {\r\n throw new InvalidArgumentError(\r\n \"Request ID must be 1-128 letters, numbers, dots, underscores, or dashes.\",\r\n );\r\n }\r\n return value;\r\n}\r\n\r\nfunction outputFormat(value: string): OutputFormat {\r\n if (value === \"human\" || value === \"json\" || value === \"jsonl\") return value;\r\n throw new InvalidArgumentError(\"Output must be human, json, or jsonl.\");\r\n}\r\n\r\nfunction postStatus(value: string): PostStatus {\r\n const parsed = PostStatusSchema.safeParse(value.toUpperCase());\r\n if (parsed.success) return parsed.data;\r\n throw new InvalidArgumentError(\r\n `Status must be one of ${PostStatusSchema.options.join(\", \")}.`,\r\n );\r\n}\r\n\r\nfunction seoOpportunityKind(value: string): SeoOpportunityKind {\r\n const parsed = SeoOpportunityKindSchema.safeParse(value.toUpperCase());\r\n if (parsed.success) return parsed.data;\r\n throw new InvalidArgumentError(`SEO kind must be one of ${SeoOpportunityKindSchema.options.join(\", \")}.`);\r\n}\r\n\r\nfunction seoExpectedImpact(value: string): SeoExpectedImpact {\r\n const parsed = SeoExpectedImpactSchema.safeParse(value.toUpperCase());\r\n if (parsed.success) return parsed.data;\r\n throw new InvalidArgumentError(\"SEO impact must be HIGH, MEDIUM, or LOW.\");\r\n}\r\n\r\nfunction seoReportCompleteness(value: string): SeoReportCompleteness {\r\n const parsed = SeoReportCompletenessSchema.safeParse(value.toUpperCase());\r\n if (parsed.success) return parsed.data;\r\n throw new InvalidArgumentError(\"Report status must be COMPLETE or PARTIAL.\");\r\n}\r\n\r\nfunction projectType(value: string): ProjectType {\r\n const parsed = ProjectTypeSchema.safeParse(value.toUpperCase());\r\n if (parsed.success) return parsed.data;\r\n throw new InvalidArgumentError(\r\n `Type must be one of ${ProjectTypeSchema.options.join(\", \")}.`,\r\n );\r\n}\r\n\r\nfunction publishingProvider(value: string): PublishingProvider {\r\n const normalized = value.toUpperCase();\r\n const parsed = PublishingProviderSchema.safeParse(normalized);\r\n if (parsed.success) return parsed.data;\r\n throw new InvalidArgumentError(\r\n `Platform must be one of ${PublishingProviderSchema.options.join(\", \")}.`,\r\n );\r\n}\r\n\r\nfunction collectPublishingProvider(\r\n value: string,\r\n previous: PublishingProvider[] | undefined,\r\n) {\r\n return [...(previous ?? []), publishingProvider(value)];\r\n}\r\n\r\nfunction collectString(value: string, previous: string[] | undefined) {\r\n return [...(previous ?? []), value];\r\n}\r\n\r\nfunction deliveryOptionsProvider(value: string): ProviderDeliveryOptionsProvider {\r\n const normalized = value.toUpperCase();\r\n const parsed = ProviderDeliveryOptionsProviderSchema.safeParse(normalized);\r\n if (parsed.success) return parsed.data;\r\n throw new InvalidArgumentError(\r\n `Provider must be one of ${ProviderDeliveryOptionsProviderSchema.options.join(\", \")}.`,\r\n );\r\n}\r\n\r\nfunction tiktokPostMode(value: string) {\r\n const normalized = value.trim().toLowerCase();\r\n if (normalized === \"direct\" || normalized === \"direct_post\") {\r\n return \"DIRECT_POST\" as const;\r\n }\r\n if (normalized === \"inbox\" || normalized === \"media_upload\") {\r\n return \"MEDIA_UPLOAD\" as const;\r\n }\r\n throw new InvalidArgumentError(\"TikTok mode must be direct or inbox.\");\r\n}\r\n\r\nfunction nonnegativeInteger(value: string) {\r\n const parsed = Number(value);\r\n if (!Number.isSafeInteger(parsed) || parsed < 0) {\r\n throw new InvalidArgumentError(\"Expected a nonnegative integer.\");\r\n }\r\n return parsed;\r\n}\r\n\r\nfunction youtubePrivacy(value: string) {\r\n const normalized = value.toUpperCase();\r\n if (\r\n normalized === \"PUBLIC\"\r\n || normalized === \"UNLISTED\"\r\n || normalized === \"PRIVATE\"\r\n ) {\r\n return normalized;\r\n }\r\n throw new InvalidArgumentError(\r\n \"YouTube privacy must be PUBLIC, UNLISTED, or PRIVATE.\",\r\n );\r\n}\r\n\r\nfunction yesOrNo(value: string) {\r\n const normalized = value.trim().toLowerCase();\r\n if (normalized === \"yes\") return true;\r\n if (normalized === \"no\") return false;\r\n throw new InvalidArgumentError(\"Expected yes or no.\");\r\n}\r\n\r\ntype YouTubeDraftOptions = {\r\n platform?: PublishingProvider[];\r\n youtubeTitle?: string;\r\n youtubeCategoryId?: string;\r\n youtubePrivacy?: \"PUBLIC\" | \"UNLISTED\" | \"PRIVATE\";\r\n youtubeMadeForKids?: boolean;\r\n youtubeSyntheticMedia?: boolean;\r\n youtubeNotifySubscribers?: boolean;\r\n youtubeTag?: string[];\r\n};\r\n\r\nfunction youtubeSettings(options: YouTubeDraftOptions) {\r\n const hasYouTubeOptions = options.youtubeTitle !== undefined\r\n || options.youtubeCategoryId !== undefined\r\n || options.youtubePrivacy !== undefined\r\n || options.youtubeMadeForKids !== undefined\r\n || options.youtubeSyntheticMedia === true\r\n || options.youtubeNotifySubscribers === false\r\n || (options.youtubeTag?.length ?? 0) > 0;\r\n if (!hasYouTubeOptions) return null;\r\n\r\n return YouTubePostSettingsSchema.parse({\r\n title: options.youtubeTitle,\r\n categoryId: options.youtubeCategoryId,\r\n privacyStatus: options.youtubePrivacy,\r\n madeForKids: options.youtubeMadeForKids,\r\n containsSyntheticMedia: options.youtubeSyntheticMedia ?? false,\r\n notifySubscribers: options.youtubeNotifySubscribers ?? true,\r\n tags: options.youtubeTag ?? [],\r\n });\r\n}\r\n\r\nfunction positiveInteger(value: string) {\r\n const parsed = Number(value);\r\n if (!Number.isSafeInteger(parsed) || parsed < 1) {\r\n throw new InvalidArgumentError(\"Expected version must be a positive integer.\");\r\n }\r\n return parsed;\r\n}\r\n\r\nfunction mcpClient(value: string): McpClientName {\r\n if (value === \"codex\" || value === \"claude-code\") return value;\r\n throw new InvalidArgumentError(\"MCP client must be codex or claude-code.\");\r\n}\r\n\r\nfunction mcpScope(value: string): McpSetupScope {\r\n if (value === \"user\" || value === \"project\") return value;\r\n throw new InvalidArgumentError(\"MCP setup scope must be user or project.\");\r\n}\r\n\r\nfunction isoDateTime(value: string) {\r\n const date = new Date(value);\r\n if (Number.isNaN(date.getTime())) {\r\n throw new InvalidArgumentError(\"Date and time must be a valid ISO-8601 value.\");\r\n }\r\n return date.toISOString();\r\n}\r\n\r\nclass CliUserCancelledError extends Error {\r\n constructor(message: string) {\r\n super(message);\r\n this.name = \"CliUserCancelledError\";\r\n }\r\n}\r\n\r\nasync function confirmInTerminal(message: string) {\r\n const prompt = createInterface({ input: process.stdin, output: process.stderr });\r\n try {\r\n const answer = await prompt.question(`${message}\\nContinue? [y/N] `);\r\n return answer.trim().toLowerCase() === \"y\"\r\n || answer.trim().toLowerCase() === \"yes\";\r\n } finally {\r\n prompt.close();\r\n }\r\n}\r\n\r\nasync function requireWriteConsent(options: {\r\n yes?: boolean;\r\n global: GlobalOptions;\r\n runtime: Runtime;\r\n preview: string;\r\n subject?: \"draft\" | \"project\" | \"media\";\r\n}) {\r\n if (options.yes) return;\r\n const projectCreation = options.subject === \"project\";\r\n const mediaUpload = options.subject === \"media\";\r\n if (options.global.agent || !options.runtime.isTTY) {\r\n throw new TypeError(\r\n projectCreation\r\n ? \"Project creation requires explicit consent. Review the command and pass --yes.\"\r\n : mediaUpload\r\n ? \"Media upload requires explicit consent. Review the command and pass --yes.\"\r\n : \"Draft writes require explicit consent. Review the command and pass --yes.\",\r\n );\r\n }\r\n if (!await options.runtime.confirm(options.preview)) {\r\n throw new CliUserCancelledError(\r\n projectCreation\r\n ? \"Project creation was cancelled.\"\r\n : mediaUpload\r\n ? \"The media upload was cancelled.\"\r\n : \"The draft write was cancelled.\",\r\n );\r\n }\r\n}\r\n\r\nconst BLOG_WEEKDAY_VALUES: Record<string, number> = {\r\n sun: 0,\r\n mon: 1,\r\n tue: 2,\r\n wed: 3,\r\n thu: 4,\r\n fri: 5,\r\n sat: 6,\r\n};\r\n\r\nfunction parseBlogWeekdays(value: string) {\r\n const names = value.split(\",\").map((day) => day.trim().toLowerCase());\r\n const weekdays = names.map((day) => BLOG_WEEKDAY_VALUES[day]).filter((day): day is number => day !== undefined);\r\n if (!weekdays.length || weekdays.length !== names.length || new Set(weekdays).size !== weekdays.length) {\r\n throw new TypeError(\"--weekdays must contain unique comma-separated sun,mon,tue,wed,thu,fri,sat values.\");\r\n }\r\n return weekdays;\r\n}\r\n\r\nfunction requireBlogExecutionConsent(options: {\r\n yes?: boolean;\r\n global: GlobalOptions;\r\n runtime: Runtime;\r\n}) {\r\n if (options.yes || resolveFormat(options.global, options.runtime) !== \"human\") return;\r\n throw new TypeError(\"This Blog execute command requires explicit consent. Review the confirmed operation and pass --yes.\");\r\n}\r\n\r\nfunction formatMcpSetupPreview(result: Awaited<ReturnType<typeof setupMcp>>) {\r\n return [\r\n `Client: ${result.client === \"codex\" ? \"Codex\" : \"Claude Code\"}`,\r\n `Scope: ${result.scope}`,\r\n `Target: ${result.target}`,\r\n `Command: ${result.server.command}`,\r\n `Arguments: ${result.server.args.join(\" \")}`,\r\n `Rolino URL: ${result.server.env.ROLINO_URL}`,\r\n \"No token will be written to MCP configuration.\",\r\n ].join(\"\\n\");\r\n}\r\n\r\nfunction resolveFormat(options: GlobalOptions, runtime: Runtime): OutputFormat {\r\n if (options.agent || options.json) return \"json\";\r\n if (options.output) return options.output;\r\n const fromEnvironment = runtime.env.ROLINO_OUTPUT;\r\n if (fromEnvironment) return outputFormat(fromEnvironment);\r\n return runtime.isTTY ? \"human\" : \"json\";\r\n}\r\n\r\nfunction baseUrlFor(options: GlobalOptions, runtime: Runtime) {\r\n return normalizeRolinoBaseUrl(\r\n options.baseUrl ?? runtime.env.ROLINO_URL ?? \"https://getrolino.com\",\r\n );\r\n}\r\n\r\nfunction clientFor(options: GlobalOptions, runtime: Runtime) {\r\n const timeoutMs = options.timeout\r\n ?? (runtime.env.ROLINO_TIMEOUT ? duration(runtime.env.ROLINO_TIMEOUT) : 15_000);\r\n\r\n const baseUrl = baseUrlFor(options, runtime);\n const token = runtime.env.ROLINO_TOKEN\n ?? createOAuthAccessTokenProvider({ baseUrl, env: runtime.env, fetch: runtime.fetch });\n return new RolinoClient({\n baseUrl,\n token,\n timeoutMs,\r\n fetch: runtime.fetch,\r\n });\r\n}\r\n\r\nfunction exitCodeFor(error: unknown): ExitCode {\r\n if (error instanceof OAuthAuthorizationDeniedError\n || error instanceof CliUserCancelledError) {\r\n return EXIT_CODES.cancelled;\r\n }\r\n if (error instanceof RolinoNetworkError) {\r\n return error.kind === \"TIMEOUT\" ? EXIT_CODES.timeout : EXIT_CODES.network;\r\n }\r\n if (error instanceof RolinoApiError) {\r\n switch (error.code) {\r\n case \"AUTH_REQUIRED\": return EXIT_CODES.authentication;\r\n case \"FORBIDDEN\": return EXIT_CODES.permission;\r\n case \"BILLING_REQUIRED\": return EXIT_CODES.permission;\r\n case \"NOT_FOUND\":\r\n case \"FEATURE_DISABLED\": return EXIT_CODES.notFound;\r\n case \"LIMIT_REACHED\": return EXIT_CODES.conflict;\r\n case \"CONFLICT\": return EXIT_CODES.conflict;\r\n case \"VALIDATION_ERROR\": return EXIT_CODES.validation;\r\n case \"RATE_LIMITED\": return EXIT_CODES.rateLimited;\r\n case \"INTERNAL_ERROR\": return EXIT_CODES.server;\r\n }\r\n }\r\n if (error instanceof TypeError) return EXIT_CODES.usage;\r\n return EXIT_CODES.unexpected;\r\n}\r\n\r\nfunction errorForOutput(error: unknown) {\r\n if (error instanceof OAuthAuthorizationDeniedError\n || error instanceof CliUserCancelledError) {\r\n return { code: \"CANCELLED\", message: error.message };\r\n }\r\n if (error instanceof RolinoApiError) {\r\n return {\r\n code: error.code,\r\n message: error.message,\r\n requestId: error.requestId,\r\n retryAfterSeconds: error.retryAfterSeconds,\r\n };\r\n }\r\n if (error instanceof RolinoNetworkError) {\r\n return { code: error.kind, message: error.message };\r\n }\r\n if (error instanceof TypeError) {\r\n return { code: \"USAGE_ERROR\", message: error.message };\r\n }\r\n if (error instanceof Error) {\r\n return { code: \"CLI_ERROR\", message: error.message };\r\n }\r\n return { code: \"CLI_ERROR\", message: \"The command failed unexpectedly.\" };\r\n}\r\n\r\ntype TikTokDraftOptions = {\r\n tiktokMode?: \"DIRECT_POST\" | \"MEDIA_UPLOAD\";\r\n tiktokVisibility?: string;\r\n tiktokComments?: boolean;\r\n tiktokDuet?: boolean;\r\n tiktokStitch?: boolean;\r\n tiktokCommercialContent?: boolean;\r\n tiktokPromotesOwnBrand?: boolean;\r\n tiktokPromotesThirdParty?: boolean;\r\n tiktokAiGenerated?: boolean;\r\n tiktokCoverTimestampMs?: number;\r\n tiktokSettingsReviewed?: boolean;\r\n};\r\n\r\nfunction tiktokSettings(options: TikTokDraftOptions) {\r\n const hasTikTokOptions = options.tiktokMode !== undefined\r\n || options.tiktokVisibility !== undefined\r\n || options.tiktokComments !== undefined\r\n || options.tiktokDuet !== undefined\r\n || options.tiktokStitch !== undefined\r\n || options.tiktokCommercialContent !== undefined\r\n || options.tiktokPromotesOwnBrand !== undefined\r\n || options.tiktokPromotesThirdParty !== undefined\r\n || options.tiktokAiGenerated !== undefined\r\n || options.tiktokCoverTimestampMs !== undefined\r\n || options.tiktokSettingsReviewed === true;\r\n if (!hasTikTokOptions) return undefined;\r\n\r\n return TikTokDraftSettingsSchema.parse({\r\n postMode: options.tiktokMode,\r\n privacyLevel: options.tiktokVisibility,\r\n allowComment: options.tiktokComments,\r\n allowDuet: options.tiktokDuet,\r\n allowStitch: options.tiktokStitch,\r\n commercialContentEnabled: options.tiktokCommercialContent,\r\n promotesOwnBrand: options.tiktokPromotesOwnBrand,\r\n promotesThirdParty: options.tiktokPromotesThirdParty,\r\n isAiGenerated: options.tiktokAiGenerated,\r\n videoCoverTimestampMs: options.tiktokCoverTimestampMs,\r\n reviewed: options.tiktokSettingsReviewed === true,\r\n });\r\n}\r\n\r\nfunction recoverySuggestions(code: string, command: string) {\r\n switch (code) {\r\n case \"AUTH_REQUIRED\":\r\n return [\r\n \"rolino auth login\",\r\n \"After browser approval, run: rolino --agent auth status\",\r\n ];\r\n case \"FORBIDDEN\":\r\n return [\r\n \"Check granted access: rolino --agent auth status\",\r\n \"Ask the user to reauthorize Rolino with the required capability.\",\r\n ];\r\n case \"BILLING_REQUIRED\":\r\n case \"LIMIT_REACHED\":\r\n return [\"Open the workspace billing page: https://getrolino.com/settings/billing\"];\r\n case \"FEATURE_DISABLED\":\r\n return [\"Check the project Connections page and hosted channel availability.\"];\r\n case \"VALIDATION_ERROR\":\r\n case \"USAGE_ERROR\":\r\n return [`rolino ${command} --help`];\r\n case \"CONFLICT\":\r\n return [\"Fetch the latest resource state before retrying with a new decision.\"];\r\n case \"RATE_LIMITED\":\r\n return [\"Wait for retryAfterSeconds before retrying.\"];\r\n case \"TIMEOUT\":\r\n case \"NETWORK\":\r\n return [\r\n \"rolino --agent doctor\",\r\n \"Inspect current Rolino state before retrying a schedule or publish operation.\",\r\n ];\r\n default:\r\n return [];\r\n }\r\n}\r\n\r\nfunction commandContext(\r\n command: string,\r\n options: GlobalOptions,\r\n runtime: Runtime,\r\n): OutputContext {\r\n return {\r\n stdout: runtime.stdout,\r\n stderr: runtime.stderr,\r\n format: resolveFormat(options, runtime),\r\n agent: options.agent ?? false,\r\n command,\r\n requestId: options.requestId ?? randomUUID(),\r\n };\r\n}\r\n\r\nasync function execute(options: {\r\n command: string;\r\n global: GlobalOptions;\r\n runtime: Runtime;\r\n action(context: OutputContext, client: RolinoClient): Promise<void>;\r\n}) {\r\n let context: OutputContext = {\r\n stdout: options.runtime.stdout,\r\n stderr: options.runtime.stderr,\r\n format: options.runtime.isTTY ? \"human\" : \"json\",\r\n agent: options.global.agent ?? false,\r\n command: options.command,\r\n requestId: options.global.requestId ?? randomUUID(),\r\n };\r\n\r\n try {\r\n context = commandContext(options.command, options.global, options.runtime);\r\n await options.action(context, clientFor(options.global, options.runtime));\r\n return EXIT_CODES.success;\r\n } catch (error) {\r\n const outputError = errorForOutput(error);\r\n writeFailure(context, {\r\n ...outputError,\r\n suggestions: recoverySuggestions(outputError.code, options.command),\r\n });\r\n return exitCodeFor(error);\r\n }\r\n}\r\n\r\nexport async function runCli(\r\n argv: string[] = process.argv,\r\n overrides: Partial<Runtime> = {},\r\n) {\r\n const runtime: Runtime = {\r\n stdout: overrides.stdout ?? process.stdout,\r\n stderr: overrides.stderr ?? process.stderr,\r\n isTTY: overrides.isTTY ?? Boolean(process.stdout.isTTY),\r\n env: overrides.env ?? process.env,\r\n fetch: overrides.fetch,\r\n cwd: overrides.cwd ?? process.cwd(),\r\n nodePath: overrides.nodePath ?? process.execPath,\r\n cliEntryPath: overrides.cliEntryPath ?? process.argv[1] ?? process.execPath,\r\n confirm: overrides.confirm ?? confirmInTerminal,\r\n };\r\n let commandExitCode: ExitCode = EXIT_CODES.success;\r\n const parserStderr: string[] = [];\r\n\r\n const program = new Command()\r\n .name(\"rolino\")\r\n .description(\"Agent-friendly command-line interface for Rolino\")\r\n .version(ROLINO_CLI_VERSION)\r\n .option(\"--base-url <url>\", \"hosted or self-hosted Rolino base URL\")\r\n .option(\"--output <format>\", \"human, json, or jsonl output\", outputFormat)\r\n .option(\"--json\", \"alias for --output json\")\r\n .option(\"--agent\", \"deterministic machine mode with next-step suggestions\")\r\n .option(\"--no-color\", \"disable color in human output\")\r\n .option(\"--timeout <duration>\", \"request timeout, for example 15s\", duration)\r\n .option(\"--request-id <id>\", \"caller correlation ID\", requestId)\r\n .showHelpAfterError()\r\n .exitOverride()\r\n .configureOutput({\r\n writeOut: (value) => runtime.stdout.write(value),\r\n writeErr: (value) => parserStderr.push(value),\r\n });\r\n\r\n program.command(\"whoami\")\r\n .description(\"Show the authenticated Rolino identity and organization\")\r\n .action(async () => {\r\n const global = program.opts<GlobalOptions>();\r\n commandExitCode = await execute({\r\n command: \"whoami\",\r\n global,\r\n runtime,\r\n async action(context, client) {\r\n const actor = await client.whoami({ requestId: context.requestId });\r\n writeSuccess(\r\n context,\r\n actor,\r\n formatActor(actor),\r\n [\"rolino projects list --agent\"],\r\n );\r\n },\r\n });\r\n });\r\n\r\n const projects = program.command(\"projects\")\r\n .description(\"Read and create projects for the current Rolino actor\");\r\n\r\n projects.command(\"list\")\r\n .description(\"List projects\")\r\n .option(\"--limit <number>\", \"maximum projects to return\", (value) => {\r\n const parsed = Number(value);\r\n if (!Number.isInteger(parsed) || parsed < 1 || parsed > 100) {\r\n throw new InvalidArgumentError(\"Limit must be an integer from 1 to 100.\");\r\n }\r\n return parsed;\r\n })\r\n .option(\"--cursor <id>\", \"continue after a project ID\")\r\n .action(async (local: { limit?: number; cursor?: string }) => {\r\n const global = program.opts<GlobalOptions>();\r\n commandExitCode = await execute({\r\n command: \"projects list\",\r\n global,\r\n runtime,\r\n async action(context, client) {\r\n const data = await client.projects.list(local, {\r\n requestId: context.requestId,\r\n });\r\n const suggestions = data.items.slice(0, 3).map((project) => (\r\n `rolino posts list --project ${project.id} --agent`\r\n ));\r\n writeSuccess(context, data, formatProjects(data), suggestions);\r\n },\r\n });\r\n });\r\n\r\n projects.command(\"create\")\r\n .description(\"Create a saved project with its paired brand\")\r\n .requiredOption(\"--name <name>\", \"project and paired brand name\")\r\n .option(\"--type <type>\", \"project type; defaults to PRODUCT\", projectType)\r\n .option(\"--website <url>\", \"absolute http or https website URL\")\r\n .option(\"--description <text>\", \"optional project description\")\r\n .option(\"--idempotency-key <key>\", \"stable retry key; defaults to the request ID\")\r\n .option(\"--yes\", \"confirm creation without an interactive prompt\")\r\n .action(async (local: {\r\n name: string;\r\n type?: ProjectType;\r\n website?: string;\r\n description?: string;\r\n idempotencyKey?: string;\r\n yes?: boolean;\r\n }) => {\r\n const global = program.opts<GlobalOptions>();\r\n commandExitCode = await execute({\r\n command: \"projects create\",\r\n global,\r\n runtime,\r\n async action(context, client) {\r\n const parsed = ProjectCreateInputSchema.safeParse({\r\n name: local.name,\r\n type: local.type,\r\n websiteUrl: local.website,\r\n description: local.description,\r\n });\r\n if (!parsed.success) {\r\n throw new TypeError(\r\n parsed.error.issues[0]?.message\r\n ?? \"Project creation input is invalid.\",\r\n );\r\n }\r\n await requireWriteConsent({\r\n yes: local.yes,\r\n global,\r\n runtime,\r\n subject: \"project\",\r\n preview: [\r\n `Create project \"${parsed.data.name}\"?`,\r\n `Type: ${parsed.data.type}`,\r\n `Website: ${parsed.data.websiteUrl ?? \"none\"}`,\r\n \"A paired brand will be saved with the project.\",\r\n \"No research, connection, scheduling, or publishing will occur.\",\r\n ].join(\"\\n\"),\r\n });\r\n const project = await client.projects.create(parsed.data, {\r\n requestId: context.requestId,\r\n idempotencyKey: local.idempotencyKey ?? context.requestId,\r\n });\r\n writeSuccess(\r\n context,\r\n project,\r\n formatProject(project),\r\n [`rolino projects show ${project.id} --agent`],\r\n );\r\n },\r\n });\r\n });\r\n\r\n const media = program.command(\"media\")\r\n .description(\"List and upload reusable project media\");\r\n\r\n media.command(\"list\")\r\n .description(\"List media assets in a project\")\r\n .requiredOption(\"--project <project-id>\", \"exact Rolino project ID\")\r\n .option(\"--limit <number>\", \"maximum assets to return\", (value) => {\r\n const parsed = Number(value);\r\n if (!Number.isInteger(parsed) || parsed < 1 || parsed > 100) throw new InvalidArgumentError(\"Limit must be an integer from 1 to 100.\");\r\n return parsed;\r\n })\r\n .option(\"--cursor <id>\", \"continue after a media asset ID\")\r\n .option(\"--type <type>\", \"IMAGE or VIDEO\", (value) => {\r\n const normalized = value.toUpperCase();\r\n if (normalized !== \"IMAGE\" && normalized !== \"VIDEO\") throw new InvalidArgumentError(\"Type must be IMAGE or VIDEO.\");\r\n return normalized;\r\n })\r\n .option(\"--query <text>\", \"filter by original file name\")\r\n .action(async (local: { project: string; limit?: number; cursor?: string; type?: \"IMAGE\" | \"VIDEO\"; query?: string }) => {\r\n const global = program.opts<GlobalOptions>();\r\n commandExitCode = await execute({\r\n command: \"media list\", global, runtime,\r\n async action(context, client) {\r\n const { project, ...options } = local;\r\n const data = await client.media.list(project, options, { requestId: context.requestId });\r\n writeSuccess(context, data, formatMediaAssets(data), data.items.slice(0, 3).map((asset) => `rolino posts create --project ${project} --caption <text> --media ${asset.id} --agent --yes`));\r\n },\r\n });\r\n });\r\n\r\n media.command(\"upload\")\r\n .description(\"Upload one local image or video to a project's media library\")\r\n .argument(\"<file-path>\")\r\n .requiredOption(\"--project <project-id>\", \"exact Rolino project ID\")\r\n .option(\"--yes\", \"confirm upload without an interactive prompt\")\r\n .action(async (filePath: string, local: { project: string; yes?: boolean }) => {\r\n const global = program.opts<GlobalOptions>();\r\n commandExitCode = await execute({\r\n command: \"media upload\", global, runtime,\r\n async action(context, client) {\r\n const absolutePath = resolve(runtime.cwd, filePath);\r\n const details = await stat(absolutePath).catch(() => null);\r\n if (!details?.isFile()) throw new TypeError(\"The media path must point to a readable file.\");\r\n const contentTypes: Record<string, string> = { \".jpg\": \"image/jpeg\", \".jpeg\": \"image/jpeg\", \".png\": \"image/png\", \".webp\": \"image/webp\", \".mp4\": \"video/mp4\", \".mov\": \"video/quicktime\" };\r\n const contentType = contentTypes[extname(absolutePath).toLowerCase()];\r\n if (!contentType) throw new TypeError(\"Use a JPEG, PNG, WebP, MP4, or MOV file.\");\r\n await requireWriteConsent({ yes: local.yes, global, runtime, subject: \"media\", preview: [`Upload ${basename(absolutePath)} to Rolino?`, `Project: ${local.project}`, `Size: ${details.size} bytes`, \"This adds a reusable media asset but does not create, schedule, or publish a post.\"].join(\"\\n\") });\r\n const body = await openAsBlob(absolutePath, { type: contentType });\r\n const asset = await client.media.upload(local.project, { fileName: basename(absolutePath), contentType, fileSize: details.size, body }, { requestId: context.requestId });\r\n writeSuccess(context, asset, formatMediaAsset(asset), [`rolino posts create --project ${local.project} --caption <text> --media ${asset.id} --agent --yes`]);\r\n },\r\n });\r\n });\r\n\r\n const authCommands = program.command(\"auth\")\r\n .description(\"Authenticate the Rolino CLI\");\r\n\r\n authCommands.command(\"login\")\r\n .description(\"Authorize this CLI through your browser\")\r\n .action(async () => {\r\n const global = program.opts<GlobalOptions>();\r\n commandExitCode = await execute({\r\n command: \"auth login\",\r\n global,\r\n runtime,\r\n async action(context, client) {\r\n if (runtime.env.ROLINO_TOKEN) {\r\n throw new TypeError(\r\n \"ROLINO_TOKEN is set and overrides browser login. Unset it before saving a CLI credential.\",\r\n );\r\n }\r\n\r\n const tokenSet = await loginWithBrowser({\n baseUrl: client.baseUrl,\n stderr: runtime.stderr,\n fetch: runtime.fetch,\n });\n const authenticatedClient = new RolinoClient({\n baseUrl: client.baseUrl,\n token: tokenSet.accessToken,\n timeoutMs: client.timeoutMs,\n fetch: runtime.fetch,\n });\r\n let credentialSaved = false;\r\n\r\n try {\r\n const actor = await authenticatedClient.whoami({\r\n requestId: context.requestId,\r\n });\r\n const path = saveOAuthTokenSet(tokenSet, runtime.env);\n credentialSaved = true;\r\n writeSuccess(\r\n context,\r\n {\r\n authenticated: true,\r\n user: actor.user,\r\n organization: actor.organization,\r\n capabilities: actor.capabilities,\r\n expiresAt: tokenSet.accessTokenExpiresAt,\n },\r\n [\r\n `Authenticated as ${actor.user.email}.`,\r\n `Workspace: ${actor.organization.name}`,\r\n `Access token expires: ${tokenSet.accessTokenExpiresAt}`,\n `Credential saved in a permission-restricted file at ${path}`,\r\n ].join(\"\\n\"),\r\n [\"rolino whoami --agent\", \"rolino projects list --agent\"],\r\n );\r\n } catch (error) {\r\n if (credentialSaved) {\r\n clearOAuthTokenSet(client.baseUrl, runtime.env);\n }\n throw error;\n }\r\n },\r\n });\r\n });\r\n\r\n authCommands.command(\"status\")\r\n .description(\"Show the active CLI authentication source and identity\")\r\n .action(async () => {\r\n const global = program.opts<GlobalOptions>();\r\n commandExitCode = await execute({\r\n command: \"auth status\",\r\n global,\r\n runtime,\r\n async action(context, client) {\r\n const credential = resolveLocalAuthentication(client.baseUrl, runtime.env);\n if (credential.source === \"none\") {\r\n writeSuccess(\r\n context,\r\n { authenticated: false, source: \"none\", baseUrl: client.baseUrl },\r\n `Not authenticated for ${client.baseUrl}`,\r\n [\"rolino auth login\"],\r\n );\r\n return;\r\n }\r\n const actor = await client.whoami({ requestId: context.requestId });\r\n writeSuccess(\r\n context,\r\n {\r\n authenticated: true,\r\n source: credential.source,\r\n baseUrl: client.baseUrl,\r\n user: actor.user,\r\n organization: actor.organization,\r\n ...(credential.source === \"oauth\" && credential.tokenSet\n ? { expiresAt: credential.tokenSet.accessTokenExpiresAt }\n : {}),\n },\r\n [\r\n `Authenticated as ${actor.user.email}.`,\r\n `Workspace: ${actor.organization.name}`,\r\n `Source: ${credential.source}`,\r\n ].join(\"\\n\"),\r\n );\r\n },\r\n });\r\n });\r\n\r\n authCommands.command(\"logout\")\r\n .description(\"Revoke and remove the saved CLI credential\")\r\n .action(async () => {\r\n const global = program.opts<GlobalOptions>();\r\n commandExitCode = await execute({\r\n command: \"auth logout\",\r\n global,\r\n runtime,\r\n async action(context, client) {\r\n const credential = resolveLocalAuthentication(client.baseUrl, runtime.env);\n if (credential.source === \"environment\") {\r\n throw new TypeError(\r\n \"ROLINO_TOKEN is set. Remove it from the environment instead of using auth logout.\",\r\n );\r\n }\r\n if (credential.source === \"none\") {\r\n writeSuccess(\r\n context,\r\n { revoked: false, reason: \"not_authenticated\", baseUrl: client.baseUrl },\r\n `No saved credential exists for ${client.baseUrl}`,\r\n );\r\n return;\r\n }\n\n const tokenSet = credential.tokenSet!;\n const fetchImplementation = runtime.fetch ?? globalThis.fetch;\n const accessToken = await createOAuthAccessTokenProvider({\n baseUrl: client.baseUrl,\n env: runtime.env,\n fetch: fetchImplementation,\n })();\n if (accessToken) {\n const disconnect = await fetchImplementation(`${client.baseUrl}/api/v1/oauth/logout`, {\n method: \"POST\",\n headers: {\n authorization: `Bearer ${accessToken}`,\n accept: \"application/json\",\n \"x-request-id\": context.requestId,\n },\n });\n if (!disconnect.ok && disconnect.status !== 401 && disconnect.status !== 404) {\n throw new TypeError(\"Rolino could not disconnect the OAuth workspace grant.\");\n }\n }\n await fetchImplementation(`${tokenSet.issuer}/oauth2/revoke`, {\n method: \"POST\",\n headers: { \"content-type\": \"application/x-www-form-urlencoded\" },\n body: new URLSearchParams({\n token: tokenSet.refreshToken,\n token_type_hint: \"refresh_token\",\n client_id: tokenSet.clientId,\n }),\n }).catch(() => undefined);\n clearOAuthTokenSet(client.baseUrl, runtime.env);\n writeSuccess(\r\n context,\r\n { revoked: true, baseUrl: client.baseUrl },\r\n \"The CLI credential was revoked and removed from this machine.\",\r\n );\r\n },\r\n });\r\n });\r\n\r\n const setup = program.command(\"setup\")\r\n .description(\"Configure local agent tools for Rolino\");\r\n\r\n setup.command(\"mcp\")\r\n .description(\"Configure the Rolino stdio MCP server for a supported client\")\r\n .requiredOption(\"--client <client>\", \"codex or claude-code\", mcpClient)\r\n .option(\"--scope <scope>\", \"user or project\", mcpScope, \"user\")\r\n .option(\"--server-path <path>\", \"absolute or working-directory-relative MCP server path\")\r\n .option(\"--dry-run\", \"show the intended configuration without writing it\")\r\n .option(\"--yes\", \"apply without an interactive confirmation\")\r\n .option(\"--force\", \"replace an existing Claude Code user-scoped Rolino server\")\r\n .action(async (local: {\r\n client: McpClientName;\r\n scope: McpSetupScope;\r\n serverPath?: string;\r\n dryRun?: boolean;\r\n yes?: boolean;\r\n force?: boolean;\r\n }) => {\r\n const global = program.opts<GlobalOptions>();\r\n commandExitCode = await execute({\r\n command: \"setup mcp\",\r\n global,\r\n runtime,\r\n async action(context, client) {\r\n const setupOptions = {\r\n ...local,\r\n baseUrl: client.baseUrl,\r\n cwd: runtime.cwd,\r\n env: runtime.env,\r\n nodePath: runtime.nodePath,\r\n cliEntryPath: runtime.cliEntryPath,\r\n };\r\n const preview = await setupMcp({ ...setupOptions, dryRun: true });\r\n let result = preview;\r\n\r\n if (!local.dryRun && preview.changed) {\r\n if (!local.yes) {\r\n if (global.agent || !runtime.isTTY) {\r\n throw new TypeError(\r\n \"MCP setup requires confirmation. Preview with --dry-run or apply with --yes.\",\r\n );\r\n }\r\n const approved = await runtime.confirm(formatMcpSetupPreview(preview));\r\n if (!approved) {\r\n throw new CliUserCancelledError(\"MCP setup was cancelled.\");\r\n }\r\n }\r\n result = await setupMcp({ ...setupOptions, dryRun: false });\r\n }\r\n const state = result.dryRun\r\n ? \"Would configure\"\r\n : result.changed\r\n ? \"Configured\"\r\n : \"Already configured\";\r\n const clientLabel = result.client === \"codex\" ? \"Codex\" : \"Claude Code\";\r\n writeSuccess(\r\n context,\r\n result,\r\n [\r\n `${state} Rolino MCP for ${clientLabel}.`,\r\n `Scope: ${result.scope}`,\r\n `Target: ${result.target}`,\r\n ...(result.backupPath && !result.dryRun\r\n ? [`Backup: ${result.backupPath}`]\r\n : []),\r\n `Rolino URL: ${client.baseUrl}`,\r\n \"No token was written to MCP configuration.\",\r\n ].join(\"\\n\"),\r\n result.client === \"codex\"\r\n ? [\"codex mcp list\", \"rolino auth login\"]\r\n : [\"claude mcp get rolino\", \"rolino auth login\"],\r\n );\r\n },\r\n });\r\n });\r\n\r\n projects.command(\"show\")\r\n .description(\"Show one project\")\r\n .argument(\"<project-id>\")\r\n .action(async (projectId: string) => {\r\n const global = program.opts<GlobalOptions>();\r\n commandExitCode = await execute({\r\n command: \"projects show\",\r\n global,\r\n runtime,\r\n async action(context, client) {\r\n const project = await client.projects.get(projectId, {\r\n requestId: context.requestId,\r\n });\r\n writeSuccess(\r\n context,\r\n project,\r\n formatProject(project),\r\n [`rolino posts list --project ${project.id} --agent`],\r\n );\r\n },\r\n });\r\n });\r\n\r\n const posts = program.command(\"posts\")\r\n .description(\"Read and prepare posts in a Rolino project\");\r\n\r\n posts.command(\"create\")\r\n .description(\"Create a draft post without scheduling or publishing it\")\r\n .requiredOption(\"--project <project-id>\", \"exact Rolino project ID\")\r\n .requiredOption(\"--caption <text>\", \"draft caption; use an empty string for media-only drafts\")\r\n .option(\"--platform <provider>\", \"INSTAGRAM, TIKTOK, YOUTUBE, BLUESKY, LINKEDIN, or GOOGLE_BUSINESS_PROFILE; repeat as needed\", collectPublishingProvider, [])\r\n .option(\"--media <asset-id>\", \"existing project media asset ID; repeat for multiple\", collectString, [])\r\n .option(\"--instagram-caption <text>\", \"Instagram-specific caption override\")\r\n .option(\"--tiktok-caption <text>\", \"TikTok-specific caption override\")\r\n .option(\"--tiktok-mode <mode>\", \"direct publishing or inbox draft delivery\", tiktokPostMode)\r\n .option(\"--tiktok-visibility <value>\", \"exact visibility returned by integrations delivery-options\")\r\n .option(\"--tiktok-comments <yes|no>\", \"allow TikTok comments\", yesOrNo)\r\n .option(\"--tiktok-duet <yes|no>\", \"allow TikTok duets\", yesOrNo)\r\n .option(\"--tiktok-stitch <yes|no>\", \"allow TikTok stitches\", yesOrNo)\r\n .option(\"--tiktok-commercial-content <yes|no>\", \"declare commercial TikTok content\", yesOrNo)\r\n .option(\"--tiktok-promotes-own-brand <yes|no>\", \"declare own-brand promotion\", yesOrNo)\r\n .option(\"--tiktok-promotes-third-party <yes|no>\", \"declare third-party promotion\", yesOrNo)\r\n .option(\"--tiktok-ai-generated <yes|no>\", \"declare AI-generated TikTok content\", yesOrNo)\r\n .option(\"--tiktok-cover-timestamp-ms <number>\", \"video cover timestamp in milliseconds\", nonnegativeInteger)\r\n .option(\"--tiktok-settings-reviewed\", \"confirm the TikTok account choices were reviewed; separate from --yes\")\r\n .option(\"--youtube-caption <text>\", \"YouTube description override; otherwise the shared caption is used\")\r\n .option(\"--bluesky-caption <text>\", \"Bluesky-specific caption override; limited to 300 graphemes\")\r\n .option(\"--linkedin-caption <text>\", \"LinkedIn-specific caption override; limited to 3,000 characters\")\r\n .option(\"--google-business-profile-caption <text>\", \"Google Business Profile update override; limited to 1,500 characters\")\r\n .option(\"--youtube-title <text>\", \"required YouTube video title\")\r\n .option(\"--youtube-category-id <id>\", \"required numeric YouTube video category ID\")\r\n .option(\"--youtube-privacy <status>\", \"required PUBLIC, UNLISTED, or PRIVATE visibility\", youtubePrivacy)\r\n .option(\"--youtube-made-for-kids <yes|no>\", \"required explicit YouTube audience declaration\", yesOrNo)\r\n .option(\"--youtube-synthetic-media\", \"declare realistic altered or synthetic media to YouTube\")\r\n .option(\"--no-youtube-notify-subscribers\", \"disable eligible YouTube subscriber notifications\")\r\n .option(\"--youtube-tag <tag>\", \"YouTube tag; repeat as needed\", collectString, [])\r\n .option(\"--idempotency-key <key>\", \"stable retry key; defaults to the request ID\")\r\n .option(\"--yes\", \"confirm creation without an interactive prompt\")\r\n .action(async (local: {\r\n project: string;\r\n caption: string;\r\n platform: PublishingProvider[];\r\n media: string[];\r\n instagramCaption?: string;\r\n tiktokCaption?: string;\r\n tiktokMode?: \"DIRECT_POST\" | \"MEDIA_UPLOAD\";\r\n tiktokVisibility?: string;\r\n tiktokComments?: boolean;\r\n tiktokDuet?: boolean;\r\n tiktokStitch?: boolean;\r\n tiktokCommercialContent?: boolean;\r\n tiktokPromotesOwnBrand?: boolean;\r\n tiktokPromotesThirdParty?: boolean;\r\n tiktokAiGenerated?: boolean;\r\n tiktokCoverTimestampMs?: number;\r\n tiktokSettingsReviewed?: boolean;\r\n youtubeCaption?: string;\r\n blueskyCaption?: string;\r\n linkedinCaption?: string;\r\n googleBusinessProfileCaption?: string;\r\n youtubeTitle?: string;\r\n youtubeCategoryId?: string;\r\n youtubePrivacy?: \"PUBLIC\" | \"UNLISTED\" | \"PRIVATE\";\r\n youtubeMadeForKids?: boolean;\r\n youtubeSyntheticMedia?: boolean;\r\n youtubeNotifySubscribers?: boolean;\r\n youtubeTag: string[];\r\n idempotencyKey?: string;\r\n yes?: boolean;\r\n }) => {\r\n const global = program.opts<GlobalOptions>();\r\n commandExitCode = await execute({\r\n command: \"posts create\",\r\n global,\r\n runtime,\r\n async action(context, client) {\r\n await requireWriteConsent({\r\n yes: local.yes,\r\n global,\r\n runtime,\r\n preview: [\r\n \"Create a Rolino draft post?\",\r\n `Project: ${local.project}`,\r\n `Destinations: ${local.platform.join(\", \") || \"none\"}`,\r\n \"This will not schedule or publish the post.\",\r\n ].join(\"\\n\"),\r\n });\r\n const input: DraftPostInput = {\r\n caption: local.caption,\r\n platforms: local.platform,\r\n mediaAssetIds: local.media,\r\n captionOverrides: {\r\n ...(local.instagramCaption === undefined\r\n ? {} : { INSTAGRAM: local.instagramCaption }),\r\n ...(local.tiktokCaption === undefined\r\n ? {} : { TIKTOK: local.tiktokCaption }),\r\n ...(local.youtubeCaption === undefined\r\n ? {} : { YOUTUBE: local.youtubeCaption }),\r\n ...(local.blueskyCaption === undefined\r\n ? {} : { BLUESKY: local.blueskyCaption }),\r\n ...(local.linkedinCaption === undefined\r\n ? {} : { LINKEDIN: local.linkedinCaption }),\r\n ...(local.googleBusinessProfileCaption === undefined\r\n ? {} : { GOOGLE_BUSINESS_PROFILE: local.googleBusinessProfileCaption }),\r\n },\r\n tiktokSettings: tiktokSettings(local) ?? null,\r\n youtubeSettings: youtubeSettings(local),\r\n };\r\n const post = await client.posts.create(local.project, input, {\r\n requestId: context.requestId,\r\n idempotencyKey: local.idempotencyKey ?? context.requestId,\r\n });\r\n writeSuccess(\r\n context,\r\n post,\r\n formatPost(post),\r\n [`rolino posts readiness ${post.id} --project ${local.project} --agent`],\r\n );\r\n },\r\n });\r\n });\r\n\r\n posts.command(\"update\")\r\n .description(\"Update selected draft fields using optimistic concurrency\")\r\n .argument(\"<post-id>\")\r\n .requiredOption(\"--project <project-id>\", \"exact Rolino project ID\")\r\n .requiredOption(\"--expected-version <number>\", \"current post version from posts show\", positiveInteger)\r\n .option(\"--caption <text>\", \"replacement draft caption; omitted fields are preserved\")\r\n .option(\"--platform <provider>\", \"replacement destinations; repeat as needed\", collectPublishingProvider)\r\n .option(\"--clear-platforms\", \"remove every draft destination\")\r\n .option(\"--media <asset-id>\", \"replacement media asset ID; repeat for multiple\", collectString)\r\n .option(\"--clear-media\", \"remove every media asset from the draft\")\r\n .option(\"--instagram-caption <text>\", \"Instagram-specific caption override\")\r\n .option(\"--tiktok-caption <text>\", \"TikTok-specific caption override\")\r\n .option(\"--tiktok-mode <mode>\", \"direct publishing or inbox draft delivery\", tiktokPostMode)\r\n .option(\"--tiktok-visibility <value>\", \"exact visibility returned by integrations delivery-options\")\r\n .option(\"--tiktok-comments <yes|no>\", \"allow TikTok comments\", yesOrNo)\r\n .option(\"--tiktok-duet <yes|no>\", \"allow TikTok duets\", yesOrNo)\r\n .option(\"--tiktok-stitch <yes|no>\", \"allow TikTok stitches\", yesOrNo)\r\n .option(\"--tiktok-commercial-content <yes|no>\", \"declare commercial TikTok content\", yesOrNo)\r\n .option(\"--tiktok-promotes-own-brand <yes|no>\", \"declare own-brand promotion\", yesOrNo)\r\n .option(\"--tiktok-promotes-third-party <yes|no>\", \"declare third-party promotion\", yesOrNo)\r\n .option(\"--tiktok-ai-generated <yes|no>\", \"declare AI-generated TikTok content\", yesOrNo)\r\n .option(\"--tiktok-cover-timestamp-ms <number>\", \"video cover timestamp in milliseconds\", nonnegativeInteger)\r\n .option(\"--tiktok-settings-reviewed\", \"confirm the TikTok account choices were reviewed; separate from --yes\")\r\n .option(\"--youtube-caption <text>\", \"YouTube description override; otherwise the shared caption is used\")\r\n .option(\"--bluesky-caption <text>\", \"Bluesky-specific caption override; limited to 300 graphemes\")\r\n .option(\"--linkedin-caption <text>\", \"LinkedIn-specific caption override; limited to 3,000 characters\")\r\n .option(\"--google-business-profile-caption <text>\", \"Google Business Profile update override; limited to 1,500 characters\")\r\n .option(\"--youtube-title <text>\", \"required YouTube video title\")\r\n .option(\"--youtube-category-id <id>\", \"required numeric YouTube video category ID\")\r\n .option(\"--youtube-privacy <status>\", \"required PUBLIC, UNLISTED, or PRIVATE visibility\", youtubePrivacy)\r\n .option(\"--youtube-made-for-kids <yes|no>\", \"required explicit YouTube audience declaration\", yesOrNo)\r\n .option(\"--youtube-synthetic-media\", \"declare realistic altered or synthetic media to YouTube\")\r\n .option(\"--no-youtube-notify-subscribers\", \"disable eligible YouTube subscriber notifications\")\r\n .option(\"--youtube-tag <tag>\", \"replacement YouTube tag; repeat as needed\", collectString)\r\n .option(\"--idempotency-key <key>\", \"stable retry key; defaults to the request ID\")\r\n .option(\"--yes\", \"confirm the update without an interactive prompt\")\r\n .action(async (postId: string, local: {\r\n project: string;\r\n expectedVersion: number;\r\n caption?: string;\r\n platform?: PublishingProvider[];\r\n clearPlatforms?: boolean;\r\n media?: string[];\r\n clearMedia?: boolean;\r\n instagramCaption?: string;\r\n tiktokCaption?: string;\r\n tiktokMode?: \"DIRECT_POST\" | \"MEDIA_UPLOAD\";\r\n tiktokVisibility?: string;\r\n tiktokComments?: boolean;\r\n tiktokDuet?: boolean;\r\n tiktokStitch?: boolean;\r\n tiktokCommercialContent?: boolean;\r\n tiktokPromotesOwnBrand?: boolean;\r\n tiktokPromotesThirdParty?: boolean;\r\n tiktokAiGenerated?: boolean;\r\n tiktokCoverTimestampMs?: number;\r\n tiktokSettingsReviewed?: boolean;\r\n youtubeCaption?: string;\r\n blueskyCaption?: string;\r\n linkedinCaption?: string;\r\n googleBusinessProfileCaption?: string;\r\n youtubeTitle?: string;\r\n youtubeCategoryId?: string;\r\n youtubePrivacy?: \"PUBLIC\" | \"UNLISTED\" | \"PRIVATE\";\r\n youtubeMadeForKids?: boolean;\r\n youtubeSyntheticMedia?: boolean;\r\n youtubeNotifySubscribers?: boolean;\r\n youtubeTag?: string[];\r\n idempotencyKey?: string;\r\n yes?: boolean;\r\n }) => {\r\n const global = program.opts<GlobalOptions>();\r\n commandExitCode = await execute({\r\n command: \"posts update\",\r\n global,\r\n runtime,\r\n async action(context, client) {\r\n await requireWriteConsent({\r\n yes: local.yes,\r\n global,\r\n runtime,\r\n preview: [\r\n `Update draft ${postId}?`,\r\n `Project: ${local.project}`,\r\n `Expected version: ${local.expectedVersion}`,\r\n \"This will not schedule or publish the post.\",\r\n ].join(\"\\n\"),\r\n });\r\n if (local.clearPlatforms && local.platform !== undefined) {\r\n throw new TypeError(\"Use either --platform or --clear-platforms, not both.\");\r\n }\r\n if (local.clearMedia && local.media !== undefined) {\r\n throw new TypeError(\"Use either --media or --clear-media, not both.\");\r\n }\r\n const captionOverrides = {\r\n ...(local.instagramCaption === undefined\r\n ? {} : { INSTAGRAM: local.instagramCaption }),\r\n ...(local.tiktokCaption === undefined\r\n ? {} : { TIKTOK: local.tiktokCaption }),\r\n ...(local.youtubeCaption === undefined\r\n ? {} : { YOUTUBE: local.youtubeCaption }),\r\n ...(local.blueskyCaption === undefined\r\n ? {} : { BLUESKY: local.blueskyCaption }),\r\n ...(local.linkedinCaption === undefined\r\n ? {} : { LINKEDIN: local.linkedinCaption }),\r\n ...(local.googleBusinessProfileCaption === undefined\r\n ? {} : { GOOGLE_BUSINESS_PROFILE: local.googleBusinessProfileCaption }),\r\n };\r\n const resolvedTikTokSettings = tiktokSettings(local);\r\n const resolvedYouTubeSettings = youtubeSettings(local);\r\n const input: DraftPostUpdateInput = {\r\n ...(local.caption === undefined ? {} : { caption: local.caption }),\r\n ...(local.platform === undefined && !local.clearPlatforms\r\n ? {} : { platforms: local.clearPlatforms ? [] : local.platform }),\r\n ...(local.media === undefined && !local.clearMedia\r\n ? {} : { mediaAssetIds: local.clearMedia ? [] : local.media }),\r\n ...(Object.keys(captionOverrides).length ? { captionOverrides } : {}),\r\n ...(resolvedTikTokSettings === undefined\r\n ? {} : { tiktokSettings: resolvedTikTokSettings }),\r\n ...(resolvedYouTubeSettings === null\r\n ? {} : { youtubeSettings: resolvedYouTubeSettings }),\r\n };\r\n const post = await client.posts.update(local.project, postId, input, {\r\n requestId: context.requestId,\r\n idempotencyKey: local.idempotencyKey ?? context.requestId,\r\n expectedVersion: local.expectedVersion,\r\n });\r\n writeSuccess(\r\n context,\r\n post,\r\n formatPost(post),\r\n [`rolino posts readiness ${post.id} --project ${local.project} --agent`],\r\n );\r\n },\r\n });\r\n });\r\n\r\n posts.command(\"list\")\r\n .description(\"List posts in a project\")\r\n .requiredOption(\"--project <project-id>\", \"exact Rolino project ID\")\r\n .option(\"--limit <number>\", \"maximum posts to return\", (value) => {\r\n const parsed = Number(value);\r\n if (!Number.isInteger(parsed) || parsed < 1 || parsed > 100) {\r\n throw new InvalidArgumentError(\"Limit must be an integer from 1 to 100.\");\r\n }\r\n return parsed;\r\n })\r\n .option(\"--cursor <id>\", \"continue after a post ID\")\r\n .option(\"--status <status>\", \"filter by post status\", postStatus)\r\n .action(async (local: {\r\n project: string;\r\n limit?: number;\r\n cursor?: string;\r\n status?: PostStatus;\r\n }) => {\r\n const global = program.opts<GlobalOptions>();\r\n commandExitCode = await execute({\r\n command: \"posts list\",\r\n global,\r\n runtime,\r\n async action(context, client) {\r\n const { project, ...options } = local;\r\n const data = await client.posts.list(project, options, {\r\n requestId: context.requestId,\r\n });\r\n const suggestions = data.items.slice(0, 3).map((post) => (\r\n `rolino posts show ${post.id} --project ${project} --agent`\r\n ));\r\n writeSuccess(context, data, formatPosts(data), suggestions);\r\n },\r\n });\r\n });\r\n\r\n posts.command(\"show\")\r\n .description(\"Show one post\")\r\n .argument(\"<post-id>\")\r\n .requiredOption(\"--project <project-id>\", \"exact Rolino project ID\")\r\n .action(async (postId: string, local: { project: string }) => {\r\n const global = program.opts<GlobalOptions>();\r\n commandExitCode = await execute({\r\n command: \"posts show\",\r\n global,\r\n runtime,\r\n async action(context, client) {\r\n const post = await client.posts.get(local.project, postId, {\r\n requestId: context.requestId,\r\n });\r\n writeSuccess(context, post, formatPost(post));\r\n },\r\n });\r\n });\r\n\r\n posts.command(\"readiness\")\r\n .description(\"Show deterministic publishing readiness for one post\")\r\n .argument(\"<post-id>\")\r\n .requiredOption(\"--project <project-id>\", \"exact Rolino project ID\")\r\n .action(async (postId: string, local: { project: string }) => {\r\n const global = program.opts<GlobalOptions>();\r\n commandExitCode = await execute({\r\n command: \"posts readiness\",\r\n global,\r\n runtime,\r\n async action(context, client) {\r\n const readiness = await client.posts.readiness(\r\n local.project,\r\n postId,\r\n { requestId: context.requestId },\r\n );\r\n writeSuccess(\r\n context,\r\n readiness,\r\n formatPostReadiness(readiness),\r\n [`rolino integrations health --project ${local.project} --agent`],\r\n );\r\n },\r\n });\r\n });\r\n\r\n const schedule = posts.command(\"schedule\")\r\n .description(\"Preview and execute server-confirmed post scheduling\");\r\n\r\n schedule.command(\"preview\")\r\n .description(\"Validate an exact schedule and issue a five-minute confirmation\")\r\n .argument(\"<post-id>\")\r\n .requiredOption(\"--project <project-id>\", \"exact Rolino project ID\")\r\n .requiredOption(\"--expected-version <number>\", \"current post version from posts show\", positiveInteger)\r\n .requiredOption(\"--at <datetime>\", \"ISO-8601 publishing time\", isoDateTime)\r\n .requiredOption(\"--timezone <iana-timezone>\", \"IANA timezone such as America/Toronto\")\r\n .action(async (postId: string, local: {\r\n project: string;\r\n expectedVersion: number;\r\n at: string;\r\n timezone: string;\r\n }) => {\r\n const global = program.opts<GlobalOptions>();\r\n commandExitCode = await execute({\r\n command: \"posts schedule preview\",\r\n global,\r\n runtime,\r\n async action(context, client) {\r\n const preview = await client.posts.previewSchedule(\r\n local.project,\r\n postId,\r\n { scheduledAt: local.at, timezone: local.timezone },\r\n {\r\n expectedVersion: local.expectedVersion,\r\n requestId: context.requestId,\r\n },\r\n );\r\n writeSuccess(\r\n context,\r\n preview,\r\n formatPostSchedulePreview(preview),\r\n [\r\n `rolino posts schedule execute ${postId} --project ${local.project} --expected-version ${local.expectedVersion} --at ${preview.schedule.scheduledAt} --timezone ${preview.schedule.timezone} --confirmation-token <token> --agent`,\r\n ],\r\n );\r\n },\r\n });\r\n });\r\n\r\n schedule.command(\"execute\")\r\n .description(\"Consume a matching confirmation and schedule the post\")\r\n .argument(\"<post-id>\")\r\n .requiredOption(\"--project <project-id>\", \"exact Rolino project ID\")\r\n .requiredOption(\"--expected-version <number>\", \"version used by schedule preview\", positiveInteger)\r\n .requiredOption(\"--at <datetime>\", \"exact ISO-8601 time returned by preview\", isoDateTime)\r\n .requiredOption(\"--timezone <iana-timezone>\", \"exact IANA timezone returned by preview\")\r\n .option(\"--confirmation-token <token>\", \"one-time token returned by schedule preview; ROLINO_CONFIRMATION_TOKEN is safer for scripts\")\r\n .option(\"--idempotency-key <key>\", \"stable retry key; defaults to the request ID\")\r\n .action(async (postId: string, local: {\r\n project: string;\r\n expectedVersion: number;\r\n at: string;\r\n timezone: string;\r\n confirmationToken?: string;\r\n idempotencyKey?: string;\r\n }) => {\r\n const global = program.opts<GlobalOptions>();\r\n commandExitCode = await execute({\r\n command: \"posts schedule execute\",\r\n global,\r\n runtime,\r\n async action(context, client) {\r\n const confirmationToken = local.confirmationToken\r\n ?? runtime.env.ROLINO_CONFIRMATION_TOKEN;\r\n if (!confirmationToken) {\r\n throw new TypeError(\r\n \"A confirmation token is required. Preview first, then use --confirmation-token or ROLINO_CONFIRMATION_TOKEN.\",\r\n );\r\n }\r\n const result = await client.posts.executeSchedule(\r\n local.project,\r\n postId,\r\n {\r\n scheduledAt: local.at,\r\n timezone: local.timezone,\r\n confirmationToken,\r\n },\r\n {\r\n expectedVersion: local.expectedVersion,\r\n idempotencyKey: local.idempotencyKey ?? context.requestId,\r\n requestId: context.requestId,\r\n },\r\n );\r\n writeSuccess(\r\n context,\r\n result,\r\n result.status === \"PENDING\"\r\n ? formatPostSchedulePending(result)\r\n : formatPost(result),\r\n [`rolino calendar list --project ${local.project} --agent`],\r\n );\r\n },\r\n });\r\n });\r\n\r\n const publish = posts.command(\"publish\")\r\n .description(\"Preview and queue server-confirmed immediate publishing\");\r\n\r\n publish.command(\"preview\")\r\n .description(\"Validate exact destinations and issue a five-minute confirmation\")\r\n .argument(\"<post-id>\")\r\n .requiredOption(\"--project <project-id>\", \"exact Rolino project ID\")\r\n .requiredOption(\"--expected-version <number>\", \"current post version from posts show\", positiveInteger)\r\n .requiredOption(\"--platform <provider>\", \"INSTAGRAM, TIKTOK, YOUTUBE, BLUESKY, LINKEDIN, or GOOGLE_BUSINESS_PROFILE; repeat as needed\", collectPublishingProvider)\r\n .action(async (postId: string, local: {\r\n project: string;\r\n expectedVersion: number;\r\n platform: PublishingProvider[];\r\n }) => {\r\n const global = program.opts<GlobalOptions>();\r\n commandExitCode = await execute({\r\n command: \"posts publish preview\",\r\n global,\r\n runtime,\r\n async action(context, client) {\r\n const preview = await client.posts.previewPublish(\r\n local.project,\r\n postId,\r\n { destinations: local.platform },\r\n {\r\n expectedVersion: local.expectedVersion,\r\n requestId: context.requestId,\r\n },\r\n );\r\n const platforms = preview.destinations\r\n .map((provider) => `--platform ${provider}`)\r\n .join(\" \");\r\n writeSuccess(\r\n context,\r\n preview,\r\n formatPostPublishPreview(preview),\r\n [\r\n `rolino posts publish execute ${postId} --project ${local.project} --expected-version ${local.expectedVersion} ${platforms} --confirmation-token <token> --agent`,\r\n ],\r\n );\r\n },\r\n });\r\n });\r\n\r\n publish.command(\"execute\")\r\n .description(\"Consume a matching confirmation and queue publishing now\")\r\n .argument(\"<post-id>\")\r\n .requiredOption(\"--project <project-id>\", \"exact Rolino project ID\")\r\n .requiredOption(\"--expected-version <number>\", \"version used by publish preview\", positiveInteger)\r\n .requiredOption(\"--platform <provider>\", \"exact destination from preview; repeat for both\", collectPublishingProvider)\r\n .option(\"--confirmation-token <token>\", \"one-time token returned by publish preview; ROLINO_CONFIRMATION_TOKEN is safer for scripts\")\r\n .option(\"--idempotency-key <key>\", \"stable retry key; defaults to the request ID\")\r\n .action(async (postId: string, local: {\r\n project: string;\r\n expectedVersion: number;\r\n platform: PublishingProvider[];\r\n confirmationToken?: string;\r\n idempotencyKey?: string;\r\n }) => {\r\n const global = program.opts<GlobalOptions>();\r\n commandExitCode = await execute({\r\n command: \"posts publish execute\",\r\n global,\r\n runtime,\r\n async action(context, client) {\r\n const confirmationToken = local.confirmationToken\r\n ?? runtime.env.ROLINO_CONFIRMATION_TOKEN;\r\n if (!confirmationToken) {\r\n throw new TypeError(\r\n \"A confirmation token is required. Preview first, then use --confirmation-token or ROLINO_CONFIRMATION_TOKEN.\",\r\n );\r\n }\r\n const post = await client.posts.executePublish(\r\n local.project,\r\n postId,\r\n {\r\n destinations: local.platform,\r\n confirmationToken,\r\n },\r\n {\r\n expectedVersion: local.expectedVersion,\r\n idempotencyKey: local.idempotencyKey ?? context.requestId,\r\n requestId: context.requestId,\r\n },\r\n );\r\n writeSuccess(\r\n context,\r\n post,\r\n formatPost(post),\r\n [`rolino posts show ${postId} --project ${local.project} --agent`],\r\n );\r\n },\r\n });\r\n });\r\n\r\n const integrations = program.command(\"integrations\")\r\n .description(\"Read publishing integration state\");\r\n\r\n integrations.command(\"health\")\r\n .description(\"Show cached health for every enabled publishing provider\")\r\n .requiredOption(\"--project <project-id>\", \"exact Rolino project ID\")\r\n .action(async (local: { project: string }) => {\r\n const global = program.opts<GlobalOptions>();\r\n commandExitCode = await execute({\r\n command: \"integrations health\",\r\n global,\r\n runtime,\r\n async action(context, client) {\r\n const health = await client.integrations.health(local.project, {\r\n requestId: context.requestId,\r\n });\r\n writeSuccess(\r\n context,\r\n health,\r\n formatIntegrationHealth(health),\r\n [`rolino posts list --project ${local.project} --agent`],\r\n );\r\n },\r\n });\r\n });\r\n\r\n integrations.command(\"delivery-options\")\r\n .description(\"Refresh secret-safe creator delivery choices for one provider\")\r\n .requiredOption(\"--project <project-id>\", \"exact Rolino project ID\")\r\n .requiredOption(\"--provider <provider>\", \"publishing provider; TIKTOK or LINKEDIN\", deliveryOptionsProvider)\r\n .action(async (local: { project: string; provider: ProviderDeliveryOptionsProvider }) => {\r\n const global = program.opts<GlobalOptions>();\r\n commandExitCode = await execute({\r\n command: \"integrations delivery-options\",\r\n global,\r\n runtime,\r\n async action(context, client) {\r\n const options = await client.integrations.deliveryOptions(\r\n local.project,\r\n local.provider,\r\n { requestId: context.requestId },\r\n );\r\n writeSuccess(\r\n context,\r\n options,\r\n formatProviderDeliveryOptions(options),\r\n [`rolino posts create --project ${local.project} --caption <text> --platform ${local.provider} --agent --yes`],\r\n );\r\n },\r\n });\r\n });\r\n\r\n const calendar = program.command(\"calendar\")\r\n .description(\"Read scheduled publishing events\");\r\n\r\n calendar.command(\"list\")\r\n .description(\"List scheduled posts in a bounded calendar window\")\r\n .requiredOption(\"--project <project-id>\", \"exact Rolino project ID\")\r\n .option(\"--from <datetime>\", \"inclusive ISO-8601 window start\", isoDateTime)\r\n .option(\"--to <datetime>\", \"exclusive ISO-8601 window end\", isoDateTime)\r\n .option(\"--limit <number>\", \"maximum events to return\", (value) => {\r\n const parsed = Number(value);\r\n if (!Number.isInteger(parsed) || parsed < 1 || parsed > 100) {\r\n throw new InvalidArgumentError(\"Limit must be an integer from 1 to 100.\");\r\n }\r\n return parsed;\r\n })\r\n .option(\"--cursor <cursor>\", \"continue from a calendar cursor\")\r\n .action(async (local: {\r\n project: string;\r\n from?: string;\r\n to?: string;\r\n limit?: number;\r\n cursor?: string;\r\n }) => {\r\n const global = program.opts<GlobalOptions>();\r\n commandExitCode = await execute({\r\n command: \"calendar list\",\r\n global,\r\n runtime,\r\n async action(context, client) {\r\n if ((local.from === undefined) !== (local.to === undefined)) {\r\n throw new TypeError(\"--from and --to must be provided together.\");\r\n }\r\n const { project, ...options } = local;\r\n const events = await client.calendar.list(project, options, {\r\n requestId: context.requestId,\r\n });\r\n writeSuccess(\r\n context,\r\n events,\r\n formatCalendarEvents(events),\r\n events.items.slice(0, 3).map((event) => (\r\n `rolino posts show ${event.postId} --project ${project} --agent`\r\n )),\r\n );\r\n },\r\n });\r\n });\r\n\r\n const blog = program.command(\"blog\").description(\"Read and manage Blog Studio\")\r\n const blogPublishing = blog.command(\"destinations\").description(\"Inspect Blog publishing providers, destinations, and delivery attempts\")\r\n blogPublishing.command(\"providers\").requiredOption(\"--project <project-id>\", \"exact Rolino project ID\").action(async (local: { project: string }) => {\r\n const global = program.opts<GlobalOptions>(); commandExitCode = await execute({ command: \"blog destinations providers\", global, runtime, async action(context, client) { const data = await client.blog.publishing.providers(local.project, { requestId: context.requestId }); writeSuccess(context, data, JSON.stringify(data, null, 2)); } });\r\n });\r\n blogPublishing.command(\"list\").requiredOption(\"--project <project-id>\", \"exact Rolino project ID\").action(async (local: { project: string }) => {\r\n const global = program.opts<GlobalOptions>(); commandExitCode = await execute({ command: \"blog destinations list\", global, runtime, async action(context, client) { const data = await client.blog.publishing.destinations(local.project, { requestId: context.requestId }); writeSuccess(context, data, JSON.stringify(data, null, 2)); } });\r\n });\r\n blogPublishing.command(\"deliveries\").requiredOption(\"--project <project-id>\", \"exact Rolino project ID\").option(\"--article <article-id>\", \"filter by exact Blog article ID\").action(async (local: { project: string; article?: string }) => {\r\n const global = program.opts<GlobalOptions>(); commandExitCode = await execute({ command: \"blog destinations deliveries\", global, runtime, async action(context, client) { const data = await client.blog.publishing.deliveries(local.project, local.article, { requestId: context.requestId }); writeSuccess(context, data, JSON.stringify(data, null, 2)); } });\r\n });\r\n const blogWebhook = blogPublishing.command(\"webhook\").description(\"Configure a signed custom Blog publishing webhook\")\r\n const addWebhookChangeOptions = (command: Command, executeChange: boolean) => {\r\n command.requiredOption(\"--project <project-id>\", \"exact Rolino project ID\")\r\n .requiredOption(\"--site <site-id>\", \"exact Blog site ID\")\r\n .requiredOption(\"--name <name>\", \"destination name\")\r\n .requiredOption(\"--endpoint <https-url>\", \"public HTTPS receiver URL\")\r\n .requiredOption(\"--semantics <mode>\", \"DRAFT or LIVE\")\r\n .option(\"--destination <destination-id>\", \"saved destination to update\");\r\n if (executeChange) command.requiredOption(\"--confirmation-token <token>\", \"short-lived token returned by preview\").requiredOption(\"--idempotency-key <key>\", \"stable retry key\").option(\"--yes\", \"confirm the exact webhook change\");\r\n return command;\r\n };\r\n addWebhookChangeOptions(blogWebhook.command(\"preview\"), false).action(async (local: { project: string; site: string; destination?: string; name: string; endpoint: string; semantics: string }) => {\r\n const input = { destinationId: local.destination, siteId: local.site, name: local.name, endpoint: local.endpoint, semantics: local.semantics.toUpperCase() } as AgentBlogWebhookDestinationChange;\r\n const global = program.opts<GlobalOptions>(); commandExitCode = await execute({ command: \"blog destinations webhook preview\", global, runtime, async action(context, client) { const data = await client.blog.publishing.webhook.preview(local.project, input, { requestId: context.requestId }); writeSuccess(context, data, JSON.stringify(data, null, 2)); } });\r\n });\r\n addWebhookChangeOptions(blogWebhook.command(\"execute\"), true).action(async (local: { project: string; site: string; destination?: string; name: string; endpoint: string; semantics: string; confirmationToken: string; idempotencyKey: string; yes?: boolean }) => {\r\n const input = { destinationId: local.destination, siteId: local.site, name: local.name, endpoint: local.endpoint, semantics: local.semantics.toUpperCase() } as AgentBlogWebhookDestinationChange;\r\n const global = program.opts<GlobalOptions>(); commandExitCode = await execute({ command: \"blog destinations webhook execute\", global, runtime, async action(context, client) { await requireWriteConsent({ yes: local.yes, global, runtime, preview: `Apply the previewed custom webhook change for project ${local.project}? Store a returned signing secret only in the receiver's server environment. Test the connection before publication.` }); const data = await client.blog.publishing.webhook.execute(local.project, { ...input, confirmationToken: local.confirmationToken, idempotencyKey: local.idempotencyKey }, { requestId: context.requestId }); writeSuccess(context, data, JSON.stringify(data, null, 2)); } });\r\n });\r\n blogWebhook.command(\"test\").requiredOption(\"--project <project-id>\", \"exact Rolino project ID\").requiredOption(\"--site <site-id>\", \"exact Blog site ID\").requiredOption(\"--destination <destination-id>\", \"saved destination ID\").option(\"--make-primary\", \"make a successful LIVE destination primary\").action(async (local: { project: string; site: string; destination: string; makePrimary?: boolean }) => {\r\n const global = program.opts<GlobalOptions>(); commandExitCode = await execute({ command: \"blog destinations webhook test\", global, runtime, async action(context, client) { const data = await client.blog.publishing.webhook.test(local.project, { siteId: local.site, destinationId: local.destination, makePrimary: local.makePrimary }, { requestId: context.requestId }); writeSuccess(context, data, JSON.stringify(data, null, 2)); } });\r\n });\r\n const blogWebhookRotate = blogWebhook.command(\"rotate\").description(\"Rotate the server-only signing secret\")\r\n blogWebhookRotate.command(\"preview\").requiredOption(\"--project <project-id>\", \"exact Rolino project ID\").requiredOption(\"--site <site-id>\", \"exact Blog site ID\").requiredOption(\"--destination <destination-id>\", \"saved destination ID\").action(async (local: { project: string; site: string; destination: string }) => {\r\n const global = program.opts<GlobalOptions>(); commandExitCode = await execute({ command: \"blog destinations webhook rotate preview\", global, runtime, async action(context, client) { const data = await client.blog.publishing.webhook.previewRotation(local.project, { siteId: local.site, destinationId: local.destination }, { requestId: context.requestId }); writeSuccess(context, data, JSON.stringify(data, null, 2)); } });\r\n });\r\n blogWebhookRotate.command(\"execute\").requiredOption(\"--project <project-id>\", \"exact Rolino project ID\").requiredOption(\"--site <site-id>\", \"exact Blog site ID\").requiredOption(\"--destination <destination-id>\", \"saved destination ID\").requiredOption(\"--confirmation-token <token>\", \"short-lived token returned by rotation preview\").requiredOption(\"--idempotency-key <key>\", \"stable retry key\").option(\"--yes\", \"confirm immediate secret invalidation\").action(async (local: { project: string; site: string; destination: string; confirmationToken: string; idempotencyKey: string; yes?: boolean }) => {\r\n const global = program.opts<GlobalOptions>(); commandExitCode = await execute({ command: \"blog destinations webhook rotate execute\", global, runtime, async action(context, client) { await requireWriteConsent({ yes: local.yes, global, runtime, preview: `Rotate the signing secret for destination ${local.destination}? The old secret stops working at once. Store the new secret only in the receiver's server environment, then test before publication.` }); const data = await client.blog.publishing.webhook.executeRotation(local.project, { siteId: local.site, destinationId: local.destination, confirmationToken: local.confirmationToken, idempotencyKey: local.idempotencyKey }, { requestId: context.requestId }); writeSuccess(context, data, JSON.stringify(data, null, 2)); } });\r\n });\r\n const blogSetup = blog.command(\"setup\").description(\"Inspect agent-first Blog setup readiness\")\r\n blogSetup.command(\"status\")\r\n .requiredOption(\"--project <project-id>\", \"exact Rolino project ID\")\r\n .action(async (local: { project: string }) => {\r\n const global = program.opts<GlobalOptions>(); commandExitCode = await execute({ command: \"blog setup status\", global, runtime, async action(context, client) { const data = await client.blog.setup.status(local.project, { requestId: context.requestId }); writeSuccess(context, data, JSON.stringify(data, null, 2)); } });\r\n });\r\n\r\n const blogSite = blog.command(\"site\").description(\"Initialize or retry the Blog website import\")\r\n blogSite.command(\"import\")\r\n .requiredOption(\"--project <project-id>\", \"exact Rolino project ID\")\r\n .requiredOption(\"--idempotency-key <key>\", \"stable retry key\")\r\n .action(async (local: { project: string; idempotencyKey: string }) => {\r\n const global = program.opts<GlobalOptions>(); commandExitCode = await execute({ command: \"blog site import\", global, runtime, async action(context, client) { const data = await client.blog.site.import(local.project, local.idempotencyKey, { requestId: context.requestId }); writeSuccess(context, data, JSON.stringify(data, null, 2), [`rolino blog job ${data.id} --project ${local.project} --agent`]); } });\r\n });\r\n blogSite.command(\"retry\")\r\n .requiredOption(\"--project <project-id>\", \"exact Rolino project ID\")\r\n .requiredOption(\"--idempotency-key <key>\", \"stable retry key\")\r\n .action(async (local: { project: string; idempotencyKey: string }) => {\r\n const global = program.opts<GlobalOptions>(); commandExitCode = await execute({ command: \"blog site retry\", global, runtime, async action(context, client) { const data = await client.blog.site.retry(local.project, local.idempotencyKey, { requestId: context.requestId }); writeSuccess(context, data, JSON.stringify(data, null, 2), [`rolino blog job ${data.id} --project ${local.project} --agent`]); } });\r\n });\r\n\r\n blog.command(\"plans\")\r\n .description(\"List Blog Studio plans\")\r\n .requiredOption(\"--project <project-id>\", \"exact Rolino project ID\")\r\n .action(async (local: { project: string }) => {\r\n const global = program.opts<GlobalOptions>(); commandExitCode = await execute({ command: \"blog plans\", global, runtime, async action(context, client) { const data = await client.blog.plans.list(local.project, { requestId: context.requestId }); writeSuccess(context, data, JSON.stringify(data, null, 2)); } });\r\n });\r\n\r\n const blogPlan = blog.command(\"plan\").description(\"Create, retry, and review a Blog cadence plan\")\r\n blogPlan.command(\"create\")\r\n .requiredOption(\"--project <project-id>\", \"exact Rolino project ID\")\r\n .requiredOption(\"--start <date>\", \"local start date as YYYY-MM-DD\")\r\n .requiredOption(\"--weekdays <days>\", \"comma-separated weekday names such as mon,wed,fri\")\r\n .option(\"--time-zone <zone>\", \"IANA time zone\", \"UTC\")\r\n .requiredOption(\"--idempotency-key <key>\", \"stable retry key\")\r\n .action(async (local: { project: string; start: string; weekdays: string; timeZone: string; idempotencyKey: string }) => {\r\n const weekdays = parseBlogWeekdays(local.weekdays);\r\n const global = program.opts<GlobalOptions>(); commandExitCode = await execute({ command: \"blog plan create\", global, runtime, async action(context, client) { const data = await client.blog.plans.create(local.project, { startsOn: local.start, weekdays, timeZone: local.timeZone }, local.idempotencyKey, { requestId: context.requestId }); writeSuccess(context, data, JSON.stringify(data, null, 2), [`rolino blog job ${data.job.id} --project ${local.project} --agent`]); } });\r\n });\r\n blogPlan.command(\"retry\")\r\n .requiredOption(\"--project <project-id>\", \"exact Rolino project ID\")\r\n .requiredOption(\"--plan <plan-id>\", \"exact Blog plan ID\")\r\n .requiredOption(\"--idempotency-key <key>\", \"stable retry key\")\r\n .action(async (local: { project: string; plan: string; idempotencyKey: string }) => {\r\n const global = program.opts<GlobalOptions>(); commandExitCode = await execute({ command: \"blog plan retry\", global, runtime, async action(context, client) { const data = await client.blog.plans.retry(local.project, local.plan, local.idempotencyKey, { requestId: context.requestId }); writeSuccess(context, data, JSON.stringify(data, null, 2)); } });\r\n });\r\n const blogPlanCadence = blogPlan.command(\"cadence\").description(\"Preview or apply editorial cadence changes without publishing\")\r\n blogPlanCadence.command(\"preview\")\r\n .requiredOption(\"--project <project-id>\", \"exact Rolino project ID\")\r\n .requiredOption(\"--plan <plan-id>\", \"exact Blog plan ID\")\r\n .requiredOption(\"--weekdays <days>\", \"unique comma-separated weekday names such as mon,wed,fri\")\r\n .requiredOption(\"--expected-plan-version <version>\", \"version returned by the latest plan read\", Number)\r\n .action(async (local: { project: string; plan: string; weekdays: string; expectedPlanVersion: number }) => {\r\n const global = program.opts<GlobalOptions>(); commandExitCode = await execute({ command: \"blog plan cadence preview\", global, runtime, async action(context, client) { const data = await client.blog.plans.previewCadence(local.project, local.plan, { weekdays: parseBlogWeekdays(local.weekdays), expectedPlanVersion: local.expectedPlanVersion }, { requestId: context.requestId }); writeSuccess(context, data, JSON.stringify(data, null, 2)); } });\r\n });\r\n blogPlanCadence.command(\"apply\")\r\n .requiredOption(\"--project <project-id>\", \"exact Rolino project ID\")\r\n .requiredOption(\"--plan <plan-id>\", \"exact Blog plan ID\")\r\n .requiredOption(\"--weekdays <days>\", \"unchanged weekdays from cadence preview\")\r\n .requiredOption(\"--expected-plan-version <version>\", \"unchanged plan version from cadence preview\", Number)\r\n .requiredOption(\"--expected-schedule-digest <digest>\", \"unchanged schedule digest from cadence preview\")\r\n .requiredOption(\"--confirmation-token <token>\", \"short-lived token returned by cadence preview\")\r\n .requiredOption(\"--idempotency-key <key>\", \"stable retry key\")\r\n .option(\"--yes\", \"confirm the editorial cadence change\")\r\n .action(async (local: { project: string; plan: string; weekdays: string; expectedPlanVersion: number; expectedScheduleDigest: string; confirmationToken: string; idempotencyKey: string; yes?: boolean }) => {\r\n const global = program.opts<GlobalOptions>(); commandExitCode = await execute({ command: \"blog plan cadence apply\", global, runtime, async action(context, client) { await requireWriteConsent({ yes: local.yes, global, runtime, preview: `Apply the previewed editorial cadence change?\\nProject: ${local.project}\\nPlan: ${local.plan}\\nThis moves eligible editorial dates only. It does not schedule, publish, or unpublish an article.` }); const data = await client.blog.plans.executeCadence(local.project, local.plan, { weekdays: parseBlogWeekdays(local.weekdays), expectedPlanVersion: local.expectedPlanVersion, expectedScheduleDigest: local.expectedScheduleDigest, confirmationToken: local.confirmationToken, idempotencyKey: local.idempotencyKey }, { requestId: context.requestId }); writeSuccess(context, data, JSON.stringify(data, null, 2)); } });\r\n });\r\n blogPlan.command(\"items\")\r\n .requiredOption(\"--project <project-id>\", \"exact Rolino project ID\")\r\n .requiredOption(\"--plan <plan-id>\", \"exact Blog plan ID\")\r\n .action(async (local: { project: string; plan: string }) => {\r\n const global = program.opts<GlobalOptions>(); commandExitCode = await execute({ command: \"blog plan items\", global, runtime, async action(context, client) { const data = await client.blog.plans.items.list(local.project, local.plan, { requestId: context.requestId }); writeSuccess(context, data, JSON.stringify(data, null, 2)); } });\r\n });\r\n const blogPlanItem = blogPlan.command(\"item\").description(\"Accept or dismiss a reviewed Blog plan item\")\r\n for (const state of [\"accept\", \"dismiss\"] as const) {\r\n blogPlanItem.command(state)\r\n .requiredOption(\"--project <project-id>\", \"exact Rolino project ID\")\r\n .requiredOption(\"--plan <plan-id>\", \"exact Blog plan ID\")\r\n .requiredOption(\"--item <item-id>\", \"exact plan item ID\")\r\n .requiredOption(\"--expected-state <state>\", \"state returned by the latest item read\")\r\n .requiredOption(\"--expected-version <version>\", \"version returned by the latest item read\", Number)\r\n .requiredOption(\"--idempotency-key <key>\", \"stable retry key\")\r\n .action(async (local: { project: string; plan: string; item: string; expectedState: string; expectedVersion: number; idempotencyKey: string }) => {\r\n const global = program.opts<GlobalOptions>(); commandExitCode = await execute({ command: `blog plan item ${state}`, global, runtime, async action(context, client) { const data = await client.blog.plans.items.setState(local.project, local.plan, local.item, { state: state === \"accept\" ? \"ACCEPTED\" : \"DISMISSED\", expectedState: local.expectedState, expectedVersion: local.expectedVersion, idempotencyKey: local.idempotencyKey }, { requestId: context.requestId }); writeSuccess(context, data, JSON.stringify(data, null, 2)); } });\r\n });\r\n }\r\n\r\n const blogArticle = blog.command(\"article\").description(\"Create an editable Blog article from an accepted item\")\r\n blogArticle.command(\"create\")\r\n .requiredOption(\"--project <project-id>\", \"exact Rolino project ID\")\r\n .requiredOption(\"--plan <plan-id>\", \"exact Blog plan ID\")\r\n .requiredOption(\"--item <item-id>\", \"exact accepted item ID\")\r\n .requiredOption(\"--expected-version <version>\", \"version returned by the latest item read\", Number)\r\n .requiredOption(\"--idempotency-key <key>\", \"stable retry key\")\r\n .action(async (local: { project: string; plan: string; item: string; expectedVersion: number; idempotencyKey: string }) => {\r\n const global = program.opts<GlobalOptions>(); commandExitCode = await execute({ command: \"blog article create\", global, runtime, async action(context, client) { const data = await client.blog.plans.items.createArticle(local.project, local.plan, local.item, { expectedState: \"ACCEPTED\", expectedVersion: local.expectedVersion, idempotencyKey: local.idempotencyKey }, { requestId: context.requestId }); writeSuccess(context, data, JSON.stringify(data, null, 2)); } });\r\n });\r\n\r\n const blogConnection = blog.command(\"connection\").description(\"Configure and verify the server-only Next.js Blog connection\")\r\n blogConnection.command(\"status\").requiredOption(\"--project <project-id>\", \"exact Rolino project ID\").action(async (local: { project: string }) => {\r\n const global = program.opts<GlobalOptions>(); commandExitCode = await execute({ command: \"blog connection status\", global, runtime, async action(context, client) { const data = await client.blog.connection.status(local.project, { requestId: context.requestId }); writeSuccess(context, data, JSON.stringify(data, null, 2)); } });\r\n });\r\n const addConnectionOptions = (command: Command, execute: boolean) => {\r\n command.requiredOption(\"--project <project-id>\", \"exact Rolino project ID\")\r\n .option(\"--endpoint <url>\", \"same-host signed revalidation endpoint\")\r\n .option(\"--credential-action <action>\", \"KEEP, CREATE, ROTATE, or REVOKE\", \"KEEP\")\r\n .option(\"--credential-id <id>\", \"credential to rotate or revoke\")\r\n .option(\"--secret-action <action>\", \"KEEP, CREATE, or ROTATE\", \"KEEP\");\r\n if (execute) command.requiredOption(\"--confirmation-token <token>\", \"short-lived token returned by preview\").requiredOption(\"--idempotency-key <key>\", \"stable retry key\").option(\"--yes\", \"confirm the exact connection change\");\r\n return command;\r\n };\r\n addConnectionOptions(blogConnection.command(\"preview\"), false).action(async (local: { project: string; endpoint?: string; credentialAction: string; credentialId?: string; secretAction: string }) => {\r\n const input = { endpoint: local.endpoint ?? null, credentialAction: local.credentialAction.toUpperCase(), credentialId: local.credentialId ?? null, secretAction: local.secretAction.toUpperCase() } as AgentBlogConnectionRequest;\r\n const global = program.opts<GlobalOptions>(); commandExitCode = await execute({ command: \"blog connection preview\", global, runtime, async action(context, client) { const data = await client.blog.connection.preview(local.project, input, { requestId: context.requestId }); writeSuccess(context, data, JSON.stringify(data, null, 2)); } });\r\n });\r\n addConnectionOptions(blogConnection.command(\"execute\"), true).action(async (local: { project: string; endpoint?: string; credentialAction: string; credentialId?: string; secretAction: string; confirmationToken: string; idempotencyKey: string; yes?: boolean }) => {\r\n const input = { endpoint: local.endpoint ?? null, credentialAction: local.credentialAction.toUpperCase(), credentialId: local.credentialId ?? null, secretAction: local.secretAction.toUpperCase() } as AgentBlogConnectionRequest;\r\n const global = program.opts<GlobalOptions>(); commandExitCode = await execute({ command: \"blog connection execute\", global, runtime, async action(context, client) { await requireWriteConsent({ yes: local.yes, global, runtime, preview: `Apply the previewed Blog connection change for project ${local.project}? One-time secrets may be returned and must stay server-only.` }); const data = await client.blog.connection.execute(local.project, { ...input, confirmationToken: local.confirmationToken, idempotencyKey: local.idempotencyKey }, { requestId: context.requestId }); writeSuccess(context, data, JSON.stringify(data, null, 2)); } });\r\n });\r\n blogConnection.command(\"test\").requiredOption(\"--project <project-id>\", \"exact Rolino project ID\").requiredOption(\"--idempotency-key <key>\", \"stable retry key\").action(async (local: { project: string; idempotencyKey: string }) => {\r\n const global = program.opts<GlobalOptions>(); commandExitCode = await execute({ command: \"blog connection test\", global, runtime, async action(context, client) { const data = await client.blog.connection.test(local.project, local.idempotencyKey, { requestId: context.requestId }); writeSuccess(context, data, JSON.stringify(data, null, 2)); } });\r\n });\r\n\r\n const blogArticles = blog.command(\"articles\").description(\"Read and edit Blog Studio articles\")\r\n blogArticles.command(\"list\").requiredOption(\"--project <project-id>\", \"exact Rolino project ID\").action(async (local: { project: string }) => {\r\n const global = program.opts<GlobalOptions>(); commandExitCode = await execute({ command: \"blog articles list\", global, runtime, async action(context, client) { const data = await client.blog.articles.list(local.project, { requestId: context.requestId }); writeSuccess(context, data, JSON.stringify(data, null, 2)); } });\r\n });\r\n blogArticles.command(\"show\").argument(\"<article-id>\").requiredOption(\"--project <project-id>\", \"exact Rolino project ID\").action(async (articleId: string, local: { project: string }) => {\r\n const global = program.opts<GlobalOptions>(); commandExitCode = await execute({ command: \"blog articles show\", global, runtime, async action(context, client) { const data = await client.blog.articles.get(local.project, articleId, { requestId: context.requestId }); writeSuccess(context, data, JSON.stringify(data, null, 2)); } });\r\n });\r\n blogArticles.command(\"update\")\r\n .argument(\"<article-id>\")\r\n .requiredOption(\"--project <project-id>\", \"exact Rolino project ID\")\r\n .requiredOption(\"--input <json-file>\", \"complete Blog draft JSON file\")\r\n .option(\"--yes\", \"confirm the draft save\")\r\n .action(async (articleId: string, local: { project: string; input: string; yes?: boolean }) => {\r\n const global = program.opts<GlobalOptions>(); commandExitCode = await execute({ command: \"blog articles update\", global, runtime, async action(context, client) {\r\n const draft = AgentBlogDraftUpdateSchema.parse(JSON.parse(await readFile(resolve(runtime.cwd, local.input), \"utf8\"))) as AgentBlogDraftUpdate;\r\n await requireWriteConsent({ yes: local.yes, global, runtime, preview: `Save a new immutable Blog draft revision?\\nProject: ${local.project}\\nArticle: ${articleId}\\nThis will not publish.` });\r\n const data = await client.blog.articles.updateDraft(local.project, articleId, draft, { requestId: context.requestId }); writeSuccess(context, data, JSON.stringify(data, null, 2));\r\n } });\r\n });\r\n blogArticles.command(\"generate\")\r\n .argument(\"<article-id>\")\r\n .requiredOption(\"--project <project-id>\", \"exact Rolino project ID\")\r\n .option(\"--idempotency-key <key>\", \"stable retry key; defaults to request ID\")\r\n .option(\"--yes\", \"confirm the generation request\")\r\n .action(async (articleId: string, local: { project: string; idempotencyKey?: string; yes?: boolean }) => {\r\n const global = program.opts<GlobalOptions>(); commandExitCode = await execute({ command: \"blog articles generate\", global, runtime, async action(context, client) {\r\n await requireWriteConsent({ yes: local.yes, global, runtime, preview: `Queue durable Blog article generation?\\nProject: ${local.project}\\nArticle: ${articleId}` });\r\n const data = await client.blog.articles.generate(local.project, articleId, local.idempotencyKey ?? context.requestId, { requestId: context.requestId }); writeSuccess(context, data, JSON.stringify(data, null, 2));\r\n } });\r\n });\r\n\r\n const blogImages = blog.command(\"images\").description(\"Create and review Blog images with blog:write; cannot approve or publish\")\r\n blogImages.command(\"generate\")\r\n .description(\"Queue one exact-revision featured image with blog:write; cannot approve or publish\")\r\n .argument(\"<article-id>\")\r\n .requiredOption(\"--project <project-id>\", \"exact Rolino project ID\")\r\n .requiredOption(\"--revision <revision-id>\", \"exact Blog revision ID\")\r\n .option(\"--editorial-brief <text>\", \"bounded visual direction; provider controls stay on the server\")\r\n .option(\"--idempotency-key <key>\", \"stable retry key; defaults to request ID\")\r\n .action(async (articleId: string, local: { project: string; revision: string; editorialBrief?: string; idempotencyKey?: string }) => {\r\n const global = program.opts<GlobalOptions>(); commandExitCode = await execute({ command: \"blog images generate\", global, runtime, async action(context, client) {\r\n const data = await client.blog.articles.generateImage(local.project, articleId, { revisionId: local.revision, idempotencyKey: local.idempotencyKey ?? context.requestId, editorialBrief: local.editorialBrief }, { requestId: context.requestId });\r\n writeSuccess(context, data, `Blog image generation queued.\\nImage: ${data.image.id}\\nJob: ${data.job.id}`);\r\n } });\r\n });\r\n blogImages.command(\"upload\")\r\n .description(\"Upload one JPEG, PNG, or WebP for an exact Blog revision with blog:write; cannot approve or publish\")\r\n .argument(\"<article-id>\")\r\n .argument(\"<file-path>\")\r\n .requiredOption(\"--project <project-id>\", \"exact Rolino project ID\")\r\n .requiredOption(\"--revision <revision-id>\", \"exact Blog revision ID\")\r\n .requiredOption(\"--alt-text <text>\", \"reviewable image alt text\")\r\n .action(async (articleId: string, filePath: string, local: { project: string; revision: string; altText: string }) => {\r\n const global = program.opts<GlobalOptions>(); commandExitCode = await execute({ command: \"blog images upload\", global, runtime, async action(context, client) {\r\n const absolutePath = resolve(runtime.cwd, filePath);\r\n const details = await stat(absolutePath).catch(() => null);\r\n if (!details?.isFile()) throw new TypeError(\"The Blog image path must point to a readable file.\");\r\n const contentTypes = { \".jpg\": \"image/jpeg\", \".jpeg\": \"image/jpeg\", \".png\": \"image/png\", \".webp\": \"image/webp\" } as const;\r\n const extension = extname(absolutePath).toLowerCase() as keyof typeof contentTypes;\r\n const contentType = contentTypes[extension];\r\n if (!contentType) throw new TypeError(\"Use a JPEG, PNG, or WebP Blog image.\");\r\n const body = await openAsBlob(absolutePath, { type: contentType });\r\n const data = await client.blog.articles.uploadImage(local.project, articleId, { revisionId: local.revision, fileName: basename(absolutePath), contentType, fileSize: details.size, altText: local.altText, body }, { requestId: context.requestId });\r\n writeSuccess(context, data, `Blog image uploaded for review.\\nImage: ${data.id}\\nState: ${data.state}`);\r\n } });\r\n });\r\n blogImages.command(\"review\")\r\n .description(\"Review one exact Blog image with blog:write; does not approve the article or publish\")\r\n .argument(\"<article-id>\")\r\n .argument(\"<image-id>\")\r\n .requiredOption(\"--project <project-id>\", \"exact Rolino project ID\")\r\n .requiredOption(\"--decision <decision>\", \"APPROVED or REJECTED\")\r\n .requiredOption(\"--expected-version <version>\", \"current image version\", positiveInteger)\r\n .option(\"--alt-text <text>\", \"final image alt text; required by the server for approval\")\r\n .option(\"--idempotency-key <key>\", \"stable retry key; defaults to request ID\")\r\n .action(async (articleId: string, imageId: string, local: { project: string; decision: string; expectedVersion: number; altText?: string; idempotencyKey?: string }) => {\r\n const decision = local.decision.toUpperCase(); if (decision !== \"APPROVED\" && decision !== \"REJECTED\") throw new TypeError(\"--decision must be APPROVED or REJECTED.\");\r\n const global = program.opts<GlobalOptions>(); commandExitCode = await execute({ command: \"blog images review\", global, runtime, async action(context, client) {\r\n const data = await client.blog.articles.reviewImage(local.project, articleId, imageId, { decision, expectedVersion: local.expectedVersion, altText: local.altText ?? \"\", idempotencyKey: local.idempotencyKey ?? context.requestId }, { requestId: context.requestId });\r\n writeSuccess(context, data, `Blog image review saved.\\nImage: ${data.id}\\nState: ${data.state}`);\r\n } });\r\n });\r\n\r\n const blogApprove = blog.command(\"approve\").description(\"Approve one exact Blog bundle with blog:approve; cannot publish\")\r\n blogApprove.command(\"preview\").description(\"Preview one exact approval bundle with blog:approve; creates a confirmation but cannot publish\")\r\n .argument(\"<article-id>\").requiredOption(\"--project <project-id>\", \"exact Rolino project ID\").requiredOption(\"--revision <revision-id>\", \"exact Blog revision ID\")\r\n .action(async (articleId: string, local: { project: string; revision: string }) => {\r\n const global = program.opts<GlobalOptions>(); commandExitCode = await execute({ command: \"blog approve preview\", global, runtime, async action(context, client) { const data = await client.blog.articles.previewApproval(local.project, articleId, { revisionId: local.revision }, { requestId: context.requestId }); writeSuccess(context, data, JSON.stringify(data, null, 2)); } });\r\n });\r\n blogApprove.command(\"execute\").description(\"Approve the confirmed exact bundle with blog:approve; separate blog:publish access is still required\")\r\n .argument(\"<article-id>\").requiredOption(\"--project <project-id>\", \"exact Rolino project ID\").requiredOption(\"--revision <revision-id>\", \"same exact revision used for preview\").requiredOption(\"--confirmation-token <token>\", \"short-lived token returned by preview\").requiredOption(\"--idempotency-key <key>\", \"stable retry key\").option(\"--yes\", \"confirm exact bundle approval\")\r\n .action(async (articleId: string, local: { project: string; revision: string; confirmationToken: string; idempotencyKey: string; yes?: boolean }) => {\r\n const global = program.opts<GlobalOptions>(); commandExitCode = await execute({ command: \"blog approve execute\", global, runtime, async action(context, client) { requireBlogExecutionConsent({ yes: local.yes, global, runtime }); const data = await client.blog.articles.executeApproval(local.project, articleId, { revisionId: local.revision, confirmationToken: local.confirmationToken, idempotencyKey: local.idempotencyKey }, { requestId: context.requestId }); writeSuccess(context, data, `Exact Blog bundle approved.\\nRevision: ${data.revisionId}\\nPublishing still requires blog:publish.`); } });\r\n });\r\n\r\n const blogSchedule = blog.command(\"schedule\").description(\"Schedule exact approved Blog bundles with blog:publish; does not grant approval\")\r\n const addScheduleOptions = (command: Command, executeSchedule: boolean) => {\r\n command.argument(\"<article-id>\").requiredOption(\"--project <project-id>\", \"exact Rolino project ID\").requiredOption(\"--revision <revision-id>\", \"exact approved Blog revision ID\").requiredOption(\"--at <iso>\", \"future ISO date-time with UTC offset\").requiredOption(\"--timezone <iana>\", \"explicit IANA timezone\").option(\"--destination <destination-id...>\", \"exact destination IDs; defaults to the current primary\");\r\n if (executeSchedule) command.requiredOption(\"--confirmation-token <token>\", \"short-lived token returned by preview\").requiredOption(\"--idempotency-key <key>\", \"stable retry key\").option(\"--yes\", \"confirm future external publication\");\r\n return command;\r\n };\r\n addScheduleOptions(blogSchedule.command(\"preview\").description(\"Preview an exact future Blog schedule with blog:publish; does not publish now\"), false)\r\n .action(async (articleId: string, local: { project: string; revision: string; at: string; timezone: string; destination?: string[] }) => { const global = program.opts<GlobalOptions>(); commandExitCode = await execute({ command: \"blog schedule preview\", global, runtime, async action(context, client) { const data = await client.blog.articles.previewSchedule(local.project, articleId, { revisionId: local.revision, scheduledAt: local.at, timezone: local.timezone, destinationIds: local.destination }, { requestId: context.requestId }); writeSuccess(context, data, JSON.stringify(data, null, 2)); } }); });\r\n addScheduleOptions(blogSchedule.command(\"execute\").description(\"Execute a confirmed future Blog schedule with blog:publish; causes future external publication\"), true)\r\n .action(async (articleId: string, local: { project: string; revision: string; at: string; timezone: string; destination?: string[]; confirmationToken: string; idempotencyKey: string; yes?: boolean }) => { const global = program.opts<GlobalOptions>(); commandExitCode = await execute({ command: \"blog schedule execute\", global, runtime, async action(context, client) { requireBlogExecutionConsent({ yes: local.yes, global, runtime }); const data = await client.blog.articles.executeSchedule(local.project, articleId, { revisionId: local.revision, scheduledAt: local.at, timezone: local.timezone, destinationIds: local.destination, confirmationToken: local.confirmationToken, idempotencyKey: local.idempotencyKey }, { requestId: context.requestId }); writeSuccess(context, data, `Blog article scheduled.\\nTime: ${data.scheduledAt}\\nTimezone: ${data.timezone}`); } }); });\r\n const blogScheduleCancel = blogSchedule.command(\"cancel\").description(\"Cancel one future Blog schedule with blog:publish; never unpublishes a live article\")\r\n blogScheduleCancel.command(\"preview\").description(\"Preview exact schedule cancellation with blog:publish; does not unpublish\")\r\n .argument(\"<article-id>\").requiredOption(\"--project <project-id>\", \"exact Rolino project ID\")\r\n .action(async (articleId: string, local: { project: string }) => { const global = program.opts<GlobalOptions>(); commandExitCode = await execute({ command: \"blog schedule cancel preview\", global, runtime, async action(context, client) { const data = await client.blog.articles.previewScheduleCancellation(local.project, articleId, { requestId: context.requestId }); writeSuccess(context, data, JSON.stringify(data, null, 2)); } }); });\r\n blogScheduleCancel.command(\"execute\").description(\"Cancel the confirmed future schedule with blog:publish; never unpublishes a live article\")\r\n .argument(\"<article-id>\").requiredOption(\"--project <project-id>\", \"exact Rolino project ID\").requiredOption(\"--confirmation-token <token>\", \"short-lived token returned by preview\").requiredOption(\"--idempotency-key <key>\", \"stable retry key\").option(\"--yes\", \"confirm schedule cancellation\")\r\n .action(async (articleId: string, local: { project: string; confirmationToken: string; idempotencyKey: string; yes?: boolean }) => { const global = program.opts<GlobalOptions>(); commandExitCode = await execute({ command: \"blog schedule cancel execute\", global, runtime, async action(context, client) { requireBlogExecutionConsent({ yes: local.yes, global, runtime }); const data = await client.blog.articles.executeScheduleCancellation(local.project, articleId, { confirmationToken: local.confirmationToken, idempotencyKey: local.idempotencyKey }, { requestId: context.requestId }); writeSuccess(context, data, `Future Blog schedule canceled.\\nArticle: ${data.articleId}\\nA live article was not unpublished.`); } }); });\r\n\r\n blog.command(\"job\")\r\n .argument(\"<job-id>\")\r\n .requiredOption(\"--project <project-id>\", \"exact Rolino project ID\")\r\n .action(async (jobId: string, local: { project: string }) => {\r\n const global = program.opts<GlobalOptions>(); commandExitCode = await execute({ command: \"blog job\", global, runtime, async action(context, client) { const data = await client.blog.jobs.get(local.project, jobId, { requestId: context.requestId }); writeSuccess(context, data, JSON.stringify(data, null, 2)); } });\r\n });\r\n\r\n const blogPublish = blog.command(\"publish\").description(\"Preview or execute exact approved Blog publication\")\r\n blogPublish.command(\"preview\")\r\n .argument(\"<article-id>\")\r\n .requiredOption(\"--project <project-id>\", \"exact Rolino project ID\")\r\n .requiredOption(\"--revision <revision-id>\", \"exact user-approved revision ID\")\r\n .option(\"--destination <destination-id...>\", \"exact destination IDs; defaults to the current primary\")\r\n .action(async (articleId: string, local: { project: string; revision: string; destination?: string[] }) => {\r\n const global = program.opts<GlobalOptions>(); commandExitCode = await execute({ command: \"blog publish preview\", global, runtime, async action(context, client) { const data = await client.blog.articles.previewPublish(local.project, articleId, local.revision, { requestId: context.requestId }, local.destination); writeSuccess(context, data, JSON.stringify(data, null, 2)); } });\r\n });\r\n blogPublish.command(\"execute\")\r\n .argument(\"<article-id>\")\r\n .requiredOption(\"--project <project-id>\", \"exact Rolino project ID\")\r\n .requiredOption(\"--revision <revision-id>\", \"same exact revision used for preview\")\r\n .requiredOption(\"--confirmation-token <token>\", \"short-lived token returned by preview\")\r\n .option(\"--destination <destination-id...>\", \"same exact destination IDs used for preview\")\r\n .option(\"--idempotency-key <key>\", \"stable retry key; defaults to request ID\")\r\n .option(\"--yes\", \"confirm publication\")\r\n .action(async (articleId: string, local: { project: string; revision: string; destination?: string[]; confirmationToken: string; idempotencyKey?: string; yes?: boolean }) => {\r\n const global = program.opts<GlobalOptions>(); commandExitCode = await execute({ command: \"blog publish execute\", global, runtime, async action(context, client) {\r\n await requireWriteConsent({ yes: local.yes, global, runtime, preview: `Publish the exact approved Blog revision?\\nProject: ${local.project}\\nArticle: ${articleId}\\nRevision: ${local.revision}` });\r\n const data = await client.blog.articles.executePublish(local.project, articleId, { revisionId: local.revision, destinationIds: local.destination, confirmationToken: local.confirmationToken, idempotencyKey: local.idempotencyKey ?? context.requestId }, { requestId: context.requestId }); writeSuccess(context, data, JSON.stringify(data, null, 2));\r\n } });\r\n });\r\n\r\n const seo = program.command(\"seo\")\r\n .description(\"Read authorized SEO opportunities and weekly reports\");\r\n const seoOpportunities = seo.command(\"opportunities\")\r\n .description(\"Read accepted SEO opportunities\");\r\n\r\n seoOpportunities.command(\"list\")\r\n .description(\"List bounded SEO opportunities\")\r\n .requiredOption(\"--project <project-id>\", \"exact Rolino project ID\")\r\n .option(\"--limit <number>\", \"maximum opportunities to return\", (value) => {\r\n const parsed = Number(value);\r\n if (!Number.isInteger(parsed) || parsed < 1 || parsed > 50) {\r\n throw new InvalidArgumentError(\"Limit must be an integer from 1 to 50.\");\r\n }\r\n return parsed;\r\n })\r\n .option(\"--cursor <cursor>\", \"continue from an SEO opportunity cursor\")\r\n .option(\"--kind <kind>\", \"filter by exact SEO opportunity kind\", seoOpportunityKind)\r\n .option(\"--impact <impact>\", \"filter by HIGH, MEDIUM, or LOW impact\", seoExpectedImpact)\r\n .action(async (local: {\r\n project: string;\r\n limit?: number;\r\n cursor?: string;\r\n kind?: SeoOpportunityKind;\r\n impact?: SeoExpectedImpact;\r\n }) => {\r\n const global = program.opts<GlobalOptions>();\r\n commandExitCode = await execute({\r\n command: \"seo opportunities list\",\r\n global,\r\n runtime,\r\n async action(context, client) {\r\n const data = await client.seo.opportunities.list(local.project, {\r\n limit: local.limit,\r\n cursor: local.cursor,\r\n kind: local.kind,\r\n expectedImpact: local.impact,\r\n }, { requestId: context.requestId });\r\n writeSuccess(context, data, formatSeoOpportunities(data), data.items.slice(0, 3).map((item) => (\r\n `rolino seo opportunities show ${item.id} --project ${local.project} --agent`\r\n )));\r\n },\r\n });\r\n });\r\n\r\n seoOpportunities.command(\"show\")\r\n .description(\"Show one canonical SEO opportunity task\")\r\n .argument(\"<opportunity-id>\")\r\n .requiredOption(\"--project <project-id>\", \"exact Rolino project ID\")\r\n .action(async (opportunityId: string, local: { project: string }) => {\r\n const global = program.opts<GlobalOptions>();\r\n commandExitCode = await execute({\r\n command: \"seo opportunities show\",\r\n global,\r\n runtime,\r\n async action(context, client) {\r\n const opportunity = await client.seo.opportunities.get(local.project, opportunityId, { requestId: context.requestId });\r\n writeSuccess(context, opportunity, formatSeoOpportunity(opportunity));\r\n },\r\n });\r\n });\r\n\r\n const seoReports = seo.command(\"reports\")\r\n .description(\"Read immutable weekly SEO report snapshots\");\r\n\r\n seoReports.command(\"list\")\r\n .description(\"List bounded weekly SEO reports\")\r\n .requiredOption(\"--project <project-id>\", \"exact Rolino project ID\")\r\n .option(\"--limit <number>\", \"maximum reports to return\", (value) => {\r\n const parsed = Number(value);\r\n if (!Number.isInteger(parsed) || parsed < 1 || parsed > 26) {\r\n throw new InvalidArgumentError(\"Limit must be an integer from 1 to 26.\");\r\n }\r\n return parsed;\r\n })\r\n .option(\"--cursor <cursor>\", \"continue from an SEO report cursor\")\r\n .option(\"--status <status>\", \"filter by COMPLETE or PARTIAL\", seoReportCompleteness)\r\n .action(async (local: {\r\n project: string;\r\n limit?: number;\r\n cursor?: string;\r\n status?: SeoReportCompleteness;\r\n }) => {\r\n const global = program.opts<GlobalOptions>();\r\n commandExitCode = await execute({\r\n command: \"seo reports list\",\r\n global,\r\n runtime,\r\n async action(context, client) {\r\n const data = await client.seo.reports.list(local.project, {\r\n limit: local.limit,\r\n cursor: local.cursor,\r\n completeness: local.status,\r\n }, { requestId: context.requestId });\r\n writeSuccess(context, data, formatSeoReports(data), data.items.slice(0, 3).map((item) => (\r\n `rolino seo reports show ${item.id} --project ${local.project} --agent`\r\n )));\r\n },\r\n });\r\n });\r\n\r\n seoReports.command(\"show\")\r\n .description(\"Show one weekly SEO report snapshot\")\r\n .argument(\"<report-id>\")\r\n .requiredOption(\"--project <project-id>\", \"exact Rolino project ID\")\r\n .action(async (reportId: string, local: { project: string }) => {\r\n const global = program.opts<GlobalOptions>();\r\n commandExitCode = await execute({\r\n command: \"seo reports show\",\r\n global,\r\n runtime,\r\n async action(context, client) {\r\n const report = await client.seo.reports.get(local.project, reportId, { requestId: context.requestId });\r\n writeSuccess(context, report, formatSeoReport(report));\r\n },\r\n });\r\n });\r\n\r\n program.command(\"doctor\")\r\n .description(\"Check configuration, compatibility, and authentication\")\r\n .action(async () => {\r\n const global = program.opts<GlobalOptions>();\r\n commandExitCode = await execute({\r\n command: \"doctor\",\r\n global,\r\n runtime,\r\n async action(context, client) {\r\n const meta = await client.meta({ requestId: context.requestId });\r\n const checks = [\r\n {\r\n name: \"server\",\r\n status: \"pass\",\r\n message: `${meta.name} ${meta.serverVersion} is reachable.`,\r\n },\r\n {\r\n name: \"api\",\r\n status: meta.apiVersion === \"v1\" ? \"pass\" : \"fail\",\r\n message: `API ${meta.apiVersion}, contracts ${meta.contractVersion}.`,\r\n },\r\n {\r\n name: \"remote-mcp\",\r\n status: meta.mcp.streamableHttp ? \"pass\" : \"info\",\r\n message: meta.mcp.streamableHttp\r\n ? \"Remote Streamable HTTP is available.\"\r\n : \"Remote MCP is gated; use the stdio server.\",\r\n },\r\n ];\r\n\r\n const credential = resolveLocalAuthentication(client.baseUrl, runtime.env);\n if (credential.source !== \"none\") {\r\n const actor = await client.whoami({ requestId: context.requestId });\r\n checks.push({\r\n name: \"authentication\",\r\n status: \"pass\",\r\n message: `Authenticated as ${actor.user.email} via ${credential.source} credential.`,\r\n });\r\n } else {\r\n checks.push({\r\n name: \"authentication\",\r\n status: \"info\",\r\n message: \"No environment or saved credential is available; run rolino auth login.\",\r\n });\r\n }\r\n\r\n const data = { healthy: true, checks, server: meta };\r\n const human = checks\r\n .map((check) => `${check.status.toUpperCase()}\\t${check.name}\\t${check.message}`)\r\n .join(\"\\n\");\r\n writeSuccess(context, data, human);\r\n },\r\n });\r\n });\r\n\r\n try {\r\n await program.parseAsync(argv);\r\n return commandExitCode;\r\n } catch (error) {\r\n if (error instanceof CommanderError) {\r\n if (error.code === \"commander.helpDisplayed\"\r\n || error.code === \"commander.version\") {\r\n return EXIT_CODES.success;\r\n }\r\n\r\n const global = program.opts<GlobalOptions>();\r\n let context: OutputContext;\r\n try {\r\n context = commandContext(\"usage\", global, runtime);\r\n } catch {\r\n context = {\r\n stdout: runtime.stdout,\r\n stderr: runtime.stderr,\r\n format: runtime.isTTY ? \"human\" : \"json\",\r\n agent: global.agent ?? false,\r\n command: \"usage\",\r\n requestId: global.requestId ?? randomUUID(),\r\n };\r\n }\r\n\r\n if (context.format === \"human\") {\r\n runtime.stderr.write(\r\n parserStderr.join(\"\") || `Error: ${error.message}\\n`,\r\n );\r\n } else {\r\n writeFailure(context, {\r\n code: \"USAGE_ERROR\",\r\n message: error.message,\r\n });\r\n }\r\n return EXIT_CODES.usage;\r\n }\r\n throw error;\r\n }\r\n}\r\n","{\n \"name\": \"@rolino/cli\",\n \"version\": \"0.6.0\",\n \"description\": \"Agent-friendly command-line interface for Rolino\",\n \"type\": \"module\",\n \"license\": \"MIT\",\n \"keywords\": [\n \"rolino\",\n \"cli\",\n \"social-media\",\n \"automation\",\n \"ai-agent\"\n ],\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/deifos/rolino.git\",\n \"directory\": \"packages/cli\"\n },\n \"homepage\": \"https://github.com/deifos/rolino/tree/main/packages/cli#readme\",\n \"bugs\": {\n \"url\": \"https://github.com/deifos/rolino/issues\"\n },\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"bin\": {\n \"rolino\": \"./dist/bin.js\"\n },\n \"exports\": {\n \".\": {\n \"import\": {\n \"types\": \"./dist/index.d.ts\",\n \"default\": \"./dist/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/index.d.cts\",\n \"default\": \"./dist/index.cjs\"\n }\n }\n },\n \"files\": [\n \"dist/**/*.js\",\n \"dist/**/*.cjs\",\n \"dist/**/*.map\",\n \"dist/**/*.d.ts\",\n \"dist/**/*.d.cts\",\n \"README.md\",\n \"CHANGELOG.md\",\n \"LICENSE\"\n ],\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"scripts\": {\n \"build\": \"tsup src/index.ts src/bin.ts --format esm,cjs --dts --sourcemap --clean\",\n \"typecheck\": \"tsc --noEmit\",\n \"dev\": \"tsx src/bin.ts\"\n },\n \"dependencies\": {\n \"@rolino/contracts\": \"0.6.0\",\n \"@rolino/local-auth\": \"0.6.0\",\n \"@rolino/sdk\": \"0.6.0\",\n \"commander\": \"^15.0.0\",\n \"open\": \"^11.0.0\"\n },\n \"devDependencies\": {\n \"tsx\": \"^4.23.12\"\n },\n \"engines\": {\n \"node\": \">=20.19.0\"\n }\n}\n","import { createHash, randomBytes, timingSafeEqual } from \"node:crypto\";\nimport { createServer, type ServerResponse } from \"node:http\";\n\nimport {\n oauthConfiguration,\n type OAuthTokenSet,\n} from \"@rolino/local-auth\";\nimport open from \"open\";\n\nimport type { WritableOutput } from \"./output.js\";\n\nconst OAUTH_CALLBACK_PORT = 48_391;\nconst OAUTH_CALLBACK_PATH = \"/oauth/callback\";\nconst OAUTH_TIMEOUT_MS = 5 * 60 * 1_000;\nconst DEFAULT_SCOPES = [\n \"offline_access\",\n \"identity:read\",\n \"projects:read\",\n \"posts:read\",\n \"integrations:read\",\n \"calendar:read\",\n] as const;\n\nfunction escapeHtml(value: string) {\n return value.replace(/[&<>\"']/g, (character) => ({\n \"&\": \"&amp;\", \"<\": \"&lt;\", \">\": \"&gt;\", '\"': \"&quot;\", \"'\": \"&#039;\",\n })[character]!);\n}\n\nexport function renderOAuthAuthorizationResultPage(options: {\n title: string;\n message: string;\n success: boolean;\n}) {\n const color = options.success ? \"#087f5b\" : \"#b42318\";\n return `<!doctype html><html lang=\"en\"><head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"><meta name=\"color-scheme\" content=\"light dark\"><title>${escapeHtml(options.title)} · Rolino</title><style>body{min-height:100vh;margin:0;display:grid;place-items:center;background:#faf9f1;color:#0f172a;font:16px/1.5 system-ui,sans-serif}.card{width:min(34rem,calc(100% - 2rem));box-sizing:border-box;padding:2.5rem;border:1px solid #dfe3ea;border-radius:1.5rem;background:#fff;text-align:center;box-shadow:0 24px 70px #0f172a20}h1{margin:0 0 .75rem;color:${color};font-size:2rem}p{margin:0;color:#52607a}@media(prefers-color-scheme:dark){body{background:#111827;color:#f8fafc}.card{background:#182235;border-color:#344258}p{color:#cbd5e1}}</style></head><body><main class=\"card\"><h1>${escapeHtml(options.title)}</h1><p>${escapeHtml(options.message)}</p></main></body></html>`;\n}\n\nfunction writePage(response: ServerResponse, status: number, html: string) {\n response.writeHead(status, {\n \"cache-control\": \"no-store\",\n \"content-security-policy\": \"default-src 'none'; style-src 'unsafe-inline'; base-uri 'none'; frame-ancestors 'none'\",\n \"content-type\": \"text/html; charset=utf-8\",\n \"referrer-policy\": \"no-referrer\",\n \"x-content-type-options\": \"nosniff\",\n });\n response.end(html);\n}\n\nfunction secretsMatch(left: string, right: string) {\n const leftBytes = Buffer.from(left);\n const rightBytes = Buffer.from(right);\n return leftBytes.length === rightBytes.length && timingSafeEqual(leftBytes, rightBytes);\n}\n\nexport function createBrowserAuthorizationRequest(baseUrl: string) {\n const configuration = oauthConfiguration(baseUrl);\n const state = randomBytes(32).toString(\"base64url\");\n const codeVerifier = randomBytes(32).toString(\"base64url\");\n const codeChallenge = createHash(\"sha256\").update(codeVerifier).digest(\"base64url\");\n const redirectUri = `http://127.0.0.1:${OAUTH_CALLBACK_PORT}${OAUTH_CALLBACK_PATH}`;\n const url = new URL(`${configuration.issuer}/oauth2/authorize`);\n url.searchParams.set(\"response_type\", \"code\");\n url.searchParams.set(\"client_id\", configuration.clientId);\n url.searchParams.set(\"redirect_uri\", redirectUri);\n url.searchParams.set(\"scope\", DEFAULT_SCOPES.join(\" \"));\n url.searchParams.set(\"resource\", configuration.resource);\n url.searchParams.set(\"state\", state);\n url.searchParams.set(\"code_challenge\", codeChallenge);\n url.searchParams.set(\"code_challenge_method\", \"S256\");\n return { configuration, url: url.toString(), redirectUri, state, codeVerifier, codeChallenge };\n}\n\nexport class OAuthAuthorizationDeniedError extends Error {\n constructor() {\n super(\"Authorization was denied.\");\n this.name = \"OAuthAuthorizationDeniedError\";\n }\n}\n\nasync function exchangeAuthorizationCode(options: {\n authorization: ReturnType<typeof createBrowserAuthorizationRequest>;\n code: string;\n fetch: typeof globalThis.fetch;\n}) {\n const { authorization } = options;\n const response = await options.fetch(`${authorization.configuration.issuer}/oauth2/token`, {\n method: \"POST\",\n headers: { \"content-type\": \"application/x-www-form-urlencoded\", accept: \"application/json\" },\n body: new URLSearchParams({\n grant_type: \"authorization_code\",\n code: options.code,\n redirect_uri: authorization.redirectUri,\n client_id: authorization.configuration.clientId,\n code_verifier: authorization.codeVerifier,\n resource: authorization.configuration.resource,\n }),\n });\n const payload = await response.json().catch(() => null) as Record<string, unknown> | null;\n if (\n !response.ok\n || !payload\n || typeof payload.access_token !== \"string\"\n || typeof payload.refresh_token !== \"string\"\n ) throw new Error(\"Rolino could not exchange the OAuth authorization code.\");\n const expiresIn = typeof payload.expires_in === \"number\" ? payload.expires_in : 300;\n return {\n host: authorization.configuration.host,\n issuer: authorization.configuration.issuer,\n clientId: authorization.configuration.clientId,\n resource: authorization.configuration.resource,\n accessToken: payload.access_token,\n accessTokenExpiresAt: new Date(Date.now() + expiresIn * 1_000).toISOString(),\n refreshToken: payload.refresh_token,\n refreshTokenExpiresAt: new Date(Date.now() + 30 * 24 * 60 * 60 * 1_000).toISOString(),\n scopes: typeof payload.scope === \"string\" ? payload.scope.split(/\\s+/).filter(Boolean) : [...DEFAULT_SCOPES],\n } satisfies OAuthTokenSet;\n}\n\nexport async function loginWithBrowser(options: {\n baseUrl: string;\n stderr: WritableOutput;\n fetch?: typeof globalThis.fetch;\n}) {\n const fetchImplementation = options.fetch ?? globalThis.fetch;\n return new Promise<OAuthTokenSet>((resolve, reject) => {\n let settled = false;\n const authorization = createBrowserAuthorizationRequest(options.baseUrl);\n const finish = (callback: () => void) => {\n if (settled) return;\n settled = true;\n clearTimeout(timeout);\n server.close();\n callback();\n };\n const server = createServer((request, response) => {\n const url = new URL(request.url ?? \"/\", \"http://127.0.0.1\");\n if (request.method !== \"GET\" || url.pathname !== OAUTH_CALLBACK_PATH) {\n response.writeHead(404, { \"content-type\": \"text/plain; charset=utf-8\" });\n response.end(\"Not found\");\n return;\n }\n void (async () => {\n if (!secretsMatch(url.searchParams.get(\"state\") ?? \"\", authorization.state)) {\n writePage(response, 400, renderOAuthAuthorizationResultPage({ title: \"Authorization failed\", message: \"The callback state did not match.\", success: false }));\n finish(() => reject(new Error(\"The OAuth callback state did not match.\")));\n return;\n }\n if (url.searchParams.get(\"error\") === \"access_denied\") {\n writePage(response, 200, renderOAuthAuthorizationResultPage({ title: \"Access denied\", message: \"No OAuth token was saved.\", success: false }));\n finish(() => reject(new OAuthAuthorizationDeniedError()));\n return;\n }\n if (url.searchParams.get(\"iss\") !== authorization.configuration.issuer) {\n writePage(response, 400, renderOAuthAuthorizationResultPage({ title: \"Authorization failed\", message: \"The authorization server did not match.\", success: false }));\n finish(() => reject(new Error(\"The OAuth callback issuer did not match.\")));\n return;\n }\n const code = url.searchParams.get(\"code\");\n if (!code || code.length > 2048) {\n writePage(response, 400, renderOAuthAuthorizationResultPage({ title: \"Authorization failed\", message: \"Rolino did not return a valid code.\", success: false }));\n finish(() => reject(new Error(\"The OAuth callback did not include a valid code.\")));\n return;\n }\n try {\n const tokenSet = await exchangeAuthorizationCode({ authorization, code, fetch: fetchImplementation });\n writePage(response, 200, renderOAuthAuthorizationResultPage({ title: \"Terminal connected\", message: \"You can close this window and return to your terminal.\", success: true }));\n finish(() => resolve(tokenSet));\n } catch (error) {\n writePage(response, 502, renderOAuthAuthorizationResultPage({ title: \"Authorization failed\", message: \"The CLI could not exchange the code.\", success: false }));\n finish(() => reject(error));\n }\n })();\n });\n server.once(\"error\", (error) => finish(() => reject(error)));\n server.listen(OAUTH_CALLBACK_PORT, \"127.0.0.1\", () => {\n options.stderr.write(\"Opening Rolino OAuth sign-in in your browser…\\n\");\n options.stderr.write(`If it does not open, visit:\\n${authorization.url}\\n`);\n options.stderr.write(\"Waiting for authorization…\\n\");\n void open(authorization.url).catch(() => undefined);\n });\n const timeout = setTimeout(() => {\n finish(() => reject(new Error(\"OAuth sign-in timed out after 5 minutes.\")));\n }, OAUTH_TIMEOUT_MS);\n });\n}\n","import type {\r\n Actor,\r\n CalendarListData,\r\n IntegrationHealthListData,\r\n MediaAsset,\r\n MediaAssetListData,\r\n Post,\r\n PostListData,\r\n PostPublishPreview,\r\n PostReadiness,\r\n PostSchedulePreview,\r\n PostSchedulePending,\r\n ProviderDeliveryOptions,\r\n Project,\r\n ProjectListData,\r\n SeoOpportunity,\r\n SeoOpportunityListData,\r\n SeoReport,\r\n SeoReportListData,\r\n} from \"@rolino/contracts\";\r\n\r\nexport type OutputFormat = \"human\" | \"json\" | \"jsonl\";\r\n\r\nexport type WritableOutput = {\r\n write(chunk: string): unknown;\r\n};\r\n\r\nexport type OutputContext = {\r\n stdout: WritableOutput;\r\n stderr: WritableOutput;\r\n format: OutputFormat;\r\n agent: boolean;\r\n command: string;\r\n requestId: string;\r\n};\r\n\r\nfunction jsonLine(value: unknown) {\r\n return `${JSON.stringify(value)}\\n`;\r\n}\r\n\r\nexport function writeSuccess(\r\n context: OutputContext,\r\n data: unknown,\r\n human: string,\r\n suggestions: string[] = [],\r\n) {\r\n if (context.format === \"human\") {\r\n context.stdout.write(human.endsWith(\"\\n\") ? human : `${human}\\n`);\r\n return;\r\n }\r\n\r\n context.stdout.write(jsonLine({\r\n ok: true,\r\n data,\r\n meta: {\r\n command: context.command,\r\n requestId: context.requestId,\r\n ...(context.agent && suggestions.length > 0 ? { suggestions } : {}),\r\n },\r\n }));\r\n}\r\n\r\nexport function writeFailure(\r\n context: OutputContext,\r\n error: {\r\n code: string;\r\n message: string;\r\n requestId?: string | null;\r\n retryAfterSeconds?: number | null;\r\n suggestions?: string[];\r\n },\r\n) {\r\n const requestId = error.requestId ?? context.requestId;\r\n if (context.format === \"human\") {\r\n context.stderr.write(`Error [${error.code}]: ${error.message}\\n`);\r\n for (const suggestion of error.suggestions ?? []) {\r\n context.stderr.write(`Next: ${suggestion}\\n`);\r\n }\r\n context.stderr.write(`Request ID: ${requestId}\\n`);\r\n return;\r\n }\r\n\r\n context.stdout.write(jsonLine({\r\n ok: false,\r\n error: {\r\n code: error.code,\r\n message: error.message,\r\n ...(error.retryAfterSeconds === null\r\n || error.retryAfterSeconds === undefined\r\n ? {}\r\n : { retryAfterSeconds: error.retryAfterSeconds }),\r\n },\r\n meta: {\r\n command: context.command,\r\n requestId,\r\n ...(context.agent && error.suggestions?.length\r\n ? { suggestions: error.suggestions }\r\n : {}),\r\n },\r\n }));\r\n}\r\n\r\nexport function formatActor(actor: Actor) {\r\n return [\r\n `${actor.user.name} <${actor.user.email}>`,\r\n `Organization: ${actor.organization.name} (${actor.organization.role})`,\r\n `Authentication: ${actor.authentication.kind}`,\r\n `Capabilities: ${actor.capabilities.join(\", \") || \"none\"}`,\r\n ].join(\"\\n\");\r\n}\r\n\r\nexport function formatProjects(data: ProjectListData) {\r\n if (data.items.length === 0) return \"No projects found.\";\r\n\r\n const rows = data.items.map((project) => (\r\n `${project.id}\\t${project.name}\\t${project.status}`\r\n ));\r\n return [\"ID\\tNAME\\tSTATUS\", ...rows].join(\"\\n\");\r\n}\r\n\r\nexport function formatProject(project: Project) {\r\n return [\r\n `${project.name} (${project.id})`,\r\n `Status: ${project.status}`,\r\n `Type: ${project.type}`,\r\n `Slug: ${project.slug}`,\r\n ...(project.websiteUrl ? [`Website: ${project.websiteUrl}`] : []),\r\n ...(project.description ? [`Description: ${project.description}`] : []),\r\n ].join(\"\\n\");\r\n}\r\n\r\nexport function formatMediaAssets(data: MediaAssetListData) {\r\n if (data.items.length === 0) return \"No media assets found.\";\r\n return [\r\n \"ID\\tTYPE\\tSIZE\\tFILE\",\r\n ...data.items.map((asset) => `${asset.id}\\t${asset.type}\\t${asset.sizeBytes ?? \"-\"}\\t${asset.originalFileName ?? \"-\"}`),\r\n ].join(\"\\n\");\r\n}\r\n\r\nexport function formatMediaAsset(asset: MediaAsset) {\r\n return [\r\n `${asset.originalFileName ?? \"Media asset\"} (${asset.id})`,\r\n `Type: ${asset.type}`,\r\n `Content type: ${asset.mimeType}`,\r\n `Size: ${asset.sizeBytes ?? \"unknown\"} bytes`,\r\n `URL: ${asset.url}`,\r\n ].join(\"\\n\");\r\n}\r\n\r\nexport function formatPosts(data: PostListData) {\r\n if (data.items.length === 0) return \"No posts found.\";\r\n\r\n const rows = data.items.map((post) => (\r\n `${post.id}\\t${post.status}\\t${post.scheduledAt ?? \"-\"}\\t${post.caption.replace(/\\s+/g, \" \").slice(0, 60) || \"-\"}`\r\n ));\r\n return [\"ID\\tSTATUS\\tSCHEDULED\\tCAPTION\", ...rows].join(\"\\n\");\r\n}\r\n\r\nexport function formatPost(post: Post) {\r\n return [\r\n `Post ${post.id}`,\r\n `Project: ${post.projectId}`,\r\n `Version: ${post.version}`,\r\n `Status: ${post.status}`,\r\n `Caption: ${post.caption || \"-\"}`,\r\n ...(post.campaign ? [`Campaign: ${post.campaign.title} (${post.campaign.id})`] : []),\r\n ...(post.scheduledAt ? [\r\n `Scheduled: ${post.scheduledAt}${post.timezone ? ` (${post.timezone})` : \"\"}`,\r\n ] : []),\r\n ...(post.publishedAt ? [`Published: ${post.publishedAt}`] : []),\r\n `Media: ${post.media.length}`,\r\n `Destinations: ${post.destinations.map((destination) => (\r\n `${destination.provider}:${destination.deliveryMode}:${destination.stage}`\r\n )).join(\", \") || \"none\"}`,\r\n ...(post.providerSettings?.TIKTOK ? [\r\n `TikTok: ${post.providerSettings.TIKTOK.postMode}, ${post.providerSettings.TIKTOK.privacyLevel ?? \"visibility not set\"}, settings ${post.providerSettings.TIKTOK.consentedAt ? \"reviewed\" : \"not reviewed\"}`,\r\n ] : []),\r\n ...(post.providerSettings?.YOUTUBE ? [\r\n `YouTube: ${post.providerSettings.YOUTUBE.privacyStatus}, ${post.providerSettings.YOUTUBE.title}`,\r\n ] : []),\r\n ].join(\"\\n\");\r\n}\r\n\r\nexport function formatPostSchedulePending(pending: PostSchedulePending) {\r\n return [\r\n `YouTube publish-time confirmation pending for post ${pending.postId}.`,\r\n \"Video upload: complete (the video remains private).\",\r\n pending.message,\r\n `Mutation: ${pending.mutationId}`,\r\n ].join(\"\\n\");\r\n}\r\n\r\nexport function formatIntegrationHealth(data: IntegrationHealthListData) {\r\n const rows = data.items.map((item) => (\r\n `${item.provider}\\t${item.connected ? \"connected\" : \"disconnected\"}\\t${item.health.status}\\t${item.health.isStale ? \"stale\" : \"current\"}\\t${item.health.message}`\r\n ));\r\n return [\"PROVIDER\\tCONNECTION\\tHEALTH\\tFRESHNESS\\tDETAIL\", ...rows].join(\"\\n\");\r\n}\r\n\r\nexport function formatProviderDeliveryOptions(options: ProviderDeliveryOptions) {\r\n switch (options.provider) {\r\n case \"TIKTOK\":\r\n return [\r\n `TikTok delivery options for ${options.account.displayName ?? options.account.username ?? \"connected account\"}`,\r\n `Checked: ${options.checkedAt}`,\r\n `Health: ${options.health.status} (${options.health.code}) ${options.health.message}`,\r\n `Modes: ${options.allowedPostModes.join(\", \") || \"none\"}`,\r\n `Visibility: ${options.visibilityOptions.join(\", \") || \"none\"}`,\r\n `Interactions: comments ${options.interactions.comment.available ? \"available\" : \"disabled\"}, duet ${options.interactions.duet.available ? \"available\" : \"disabled\"}, stitch ${options.interactions.stitch.available ? \"available\" : \"disabled\"}`,\r\n `Maximum video duration: ${options.maxVideoDurationMs === null ? \"unknown\" : `${options.maxVideoDurationMs} ms`}`,\r\n ].join(\"\\n\");\r\n case \"LINKEDIN\":\r\n return [\r\n `LinkedIn delivery options for ${options.account.displayName ?? \"connected member\"}`,\r\n `Checked: ${options.checkedAt}`,\r\n `Health: ${options.health.status} (${options.health.code}) ${options.health.message}`,\r\n `Post types: ${options.supportedPostTypes.join(\", \")}`,\r\n `Images: up to ${options.image.maxItems}; ${options.image.mimeTypes.join(\", \")}; under ${options.image.maxPixelsExclusive.toLocaleString()} pixels`,\r\n `Video: one ${options.video.mimeTypes.join(\", \")}; ${options.video.minDurationMs / 1_000}s to ${options.video.maxDurationMs / 60_000}m; ${options.video.minBytes.toLocaleString()} to ${options.video.maxBytes.toLocaleString()} bytes`,\r\n ].join(\"\\n\");\r\n }\r\n}\r\n\r\nexport function formatPostReadiness(readiness: PostReadiness) {\r\n const attention = readiness.checks.filter((check) => check.status !== \"pass\");\r\n const summary = readiness.hasBlockingChecks\r\n ? \"Post is not ready to publish.\"\r\n : readiness.requiresLiveRefresh.length\r\n ? \"Local checks passed; live provider health must be refreshed.\"\r\n : \"Post is ready to publish.\";\r\n if (!attention.length) return summary;\r\n return [\r\n summary,\r\n ...attention.map((check) => (\r\n `${check.status.toUpperCase()}\\t${check.provider ?? \"POST\"}\\t${check.code}\\t${check.message}`\r\n )),\r\n ].join(\"\\n\");\r\n}\r\n\r\nexport function formatPostSchedulePreview(preview: PostSchedulePreview) {\r\n const attention = preview.readiness.checks.filter((check) => check.status !== \"pass\");\r\n return [\r\n `Schedule preview for post ${preview.post.id}`,\r\n `Current version: ${preview.post.version}`,\r\n `Delivery mode: ${preview.deliveryMode}`,\r\n `Publish at: ${preview.schedule.scheduledAt} (${preview.schedule.timezone})`,\r\n `Destinations: ${preview.destinations.join(\", \")}`,\r\n ...(preview.youtube ? [\r\n \"YouTube preparation: starts immediately as PRIVATE.\",\r\n `YouTube scheduled visibility: ${preview.youtube.publishVisibility}.`,\r\n `YouTube confirmation: ${preview.youtube.confirmationMeaning}`,\r\n ] : []),\r\n ...(preview.providerReconciliation\r\n ? [`Provider reconciliation: ${preview.providerReconciliation.message}`]\r\n : []),\r\n `Confirmation expires: ${preview.confirmation.expiresAt}`,\r\n `Confirmation token: ${preview.confirmation.token}`,\r\n ...(attention.length\r\n ? [\"Readiness notes:\", ...attention.map((check) => (\r\n `${check.status.toUpperCase()}\\t${check.provider ?? \"POST\"}\\t${check.code}\\t${check.message}`\r\n ))]\r\n : [\"All required readiness checks passed.\"]),\r\n ].join(\"\\n\");\r\n}\r\n\r\nexport function formatPostPublishPreview(preview: PostPublishPreview) {\r\n const attention = preview.readiness.checks.filter((check) => check.status !== \"pass\");\r\n return [\r\n `Immediate publish preview for post ${preview.post.id}`,\r\n `Current version: ${preview.post.version}`,\r\n `Delivery mode: ${preview.deliveryMode}`,\r\n `Destinations: ${preview.destinations.join(\", \")}`,\r\n \"Effect: confirmed execution queues these destinations for immediate publishing.\",\r\n ...(preview.youtube\r\n ? [`YouTube effect: execution starts a resumable upload using ${preview.youtube.visibility}; it does not create a schedule. PREPARING remains visible until upload, processing, and visibility are provider-confirmed.`]\r\n : []),\r\n `Confirmation expires: ${preview.confirmation.expiresAt}`,\r\n `Confirmation token: ${preview.confirmation.token}`,\r\n ...(attention.length\r\n ? [\"Readiness notes:\", ...attention.map((check) => (\r\n `${check.status.toUpperCase()}\\t${check.provider ?? \"POST\"}\\t${check.code}\\t${check.message}`\r\n ))]\r\n : [\"All required readiness checks passed.\"]),\r\n ].join(\"\\n\");\r\n}\r\n\r\nexport function formatCalendarEvents(data: CalendarListData) {\r\n if (!data.items.length) {\r\n return `No scheduled posts found from ${data.window.from} to ${data.window.to}.`;\r\n }\r\n const rows = data.items.map((event) => (\r\n `${event.postId}\\t${event.scheduledAt}\\t${event.status}\\t${event.destinations.map((item) => item.provider).join(\",\") || \"-\"}\\t${event.title}`\r\n ));\r\n return [\"POST ID\\tSCHEDULED\\tSTATUS\\tDESTINATIONS\\tTITLE\", ...rows].join(\"\\n\");\r\n}\r\n\r\nexport function formatSeoOpportunities(data: SeoOpportunityListData) {\r\n if (!data.items.length) return \"No active SEO tasks found.\";\r\n return [\r\n \"ID\\tDECISION\\tFORMAT\\tSCORE\\tTOPIC RELEVANCE\\tACTION READINESS\\tTITLE\",\r\n ...data.items.map((item) => (\r\n `${item.id}\\t${item.task.decision}\\t${item.task.primaryFormat}\\t${item.score}\\t${item.confidence.topicRelevance.label}\\t${item.confidence.actionReadiness.label}\\t${item.title}`\r\n )),\r\n ].join(\"\\n\");\r\n}\r\n\r\nexport function formatSeoOpportunity(opportunity: SeoOpportunity) {\r\n return [\r\n `${opportunity.title} (${opportunity.id})`,\r\n `Project: ${opportunity.projectId}`,\r\n `Decision: ${opportunity.task.decision}`,\r\n `Primary format: ${opportunity.task.primaryFormat}`,\r\n `Objective: ${opportunity.task.objective}`,\r\n `Next step: ${opportunity.task.nextStep}`,\r\n `Priority: ${opportunity.score}/100`,\r\n `Topic relevance: ${opportunity.confidence.topicRelevance.label}${opportunity.confidence.topicRelevance.score === null ? \"\" : ` (${opportunity.confidence.topicRelevance.score}/100)`}`,\r\n `Topic relevance explanation: ${opportunity.confidence.topicRelevance.explanation}`,\r\n `Action readiness: ${opportunity.confidence.actionReadiness.label}${opportunity.confidence.actionReadiness.score === null ? \"\" : ` (${opportunity.confidence.actionReadiness.score}/100)`}`,\r\n `Action readiness explanation: ${opportunity.confidence.actionReadiness.explanation}`,\r\n \"\",\r\n opportunity.brief,\r\n ].join(\"\\n\");\r\n}\r\n\r\nexport function formatSeoReports(data: SeoReportListData) {\r\n if (!data.items.length) return \"No weekly SEO reports found.\";\r\n return [\r\n \"ID\\tPERIOD START\\tPERIOD END\\tSTATUS\\tREADY\\tRESEARCH\\tREJECTED\\tLEGACY\",\r\n ...data.items.map((item) => (\r\n `${item.id}\\t${item.periodStart}\\t${item.periodEnd}\\t${item.completeness}\\t${item.readyTaskCount}\\t${item.researchTaskCount}\\t${item.rejectedFindingCount}\\t${item.legacy}`\r\n )),\r\n ].join(\"\\n\");\r\n}\r\n\r\nexport function formatSeoReport(report: SeoReport) {\r\n return [\r\n `Weekly SEO report ${report.id}`,\r\n `Project: ${report.projectId}`,\r\n `Period: ${report.periodStart} to ${report.periodEnd}`,\r\n `Schedule: day ${report.deliveryDay} in ${report.timeZone}`,\r\n `Status: ${report.completeness}`,\r\n ...(report.partialLabel ? [`Note: ${report.partialLabel}`] : []),\r\n `Ready tasks: ${report.readyTaskCount}`,\r\n `Research tasks: ${report.researchTaskCount}`,\r\n `Rejected or filtered findings: ${report.rejectedFindingCount}`,\r\n `Legacy report: ${report.legacy}`,\r\n \"\",\r\n ...report.opportunities.flatMap((item, index) => [\r\n `${index + 1}. ${item.title}`,\r\n ` Decision: ${item.task.decision}`,\r\n ` Format: ${item.task.primaryFormat}`,\r\n ` Objective: ${item.task.objective}`,\r\n ` Next step: ${item.task.nextStep}`,\r\n ` Topic relevance: ${item.confidence.topicRelevance.label}${item.confidence.topicRelevance.score === null ? \"\" : ` (${item.confidence.topicRelevance.score}/100)`}`,\r\n ` Action readiness: ${item.confidence.actionReadiness.label}${item.confidence.actionReadiness.score === null ? \"\" : ` (${item.confidence.actionReadiness.score}/100)`}`,\r\n ]),\r\n ...report.rejectedFindings.flatMap((item, index) => [\r\n `Rejected ${index + 1}: ${item.query}`,\r\n ` Reason: ${item.reason}`,\r\n ]),\r\n ].join(\"\\n\");\r\n}\r\n"],"mappings":";AAAO,IAAM,aAAa;AAAA,EACxB,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,gBAAgB;AAAA,EAChB,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,SAAS;AAAA,EACT,WAAW;AACb;;;ACdA,SAAS,iBAAiB;AAC1B,SAAS,iB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