@rolino/cli 0.4.0 → 0.5.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.
package/dist/bin.cjs CHANGED
@@ -34,7 +34,7 @@ var import_commander = require("commander");
34
34
  // package.json
35
35
  var package_default = {
36
36
  name: "@rolino/cli",
37
- version: "0.4.0",
37
+ version: "0.5.0",
38
38
  description: "Agent-friendly command-line interface for Rolino",
39
39
  type: "module",
40
40
  license: "MIT",
@@ -91,9 +91,9 @@ var package_default = {
91
91
  dev: "tsx src/bin.ts"
92
92
  },
93
93
  dependencies: {
94
- "@rolino/contracts": "0.4.0",
95
- "@rolino/local-auth": "0.4.0",
96
- "@rolino/sdk": "0.4.0",
94
+ "@rolino/contracts": "0.5.0",
95
+ "@rolino/local-auth": "0.5.0",
96
+ "@rolino/sdk": "0.5.0",
97
97
  commander: "^15.0.0",
98
98
  open: "^11.0.0"
99
99
  },
@@ -464,7 +464,6 @@ function formatPosts(data) {
464
464
  return ["ID STATUS SCHEDULED CAPTION", ...rows].join("\n");
465
465
  }
466
466
  function formatPost(post) {
467
- const queued = post.status === "PUBLISHING";
468
467
  return [
469
468
  `Post ${post.id}`,
470
469
  `Project: ${post.projectId}`,
@@ -473,11 +472,11 @@ function formatPost(post) {
473
472
  `Caption: ${post.caption || "-"}`,
474
473
  ...post.campaign ? [`Campaign: ${post.campaign.title} (${post.campaign.id})`] : [],
475
474
  ...post.scheduledAt ? [
476
- `${queued ? "Queued for publishing" : "Scheduled"}: ${post.scheduledAt}${post.timezone ? ` (${post.timezone})` : ""}`
475
+ `Scheduled: ${post.scheduledAt}${post.timezone ? ` (${post.timezone})` : ""}`
477
476
  ] : [],
478
477
  ...post.publishedAt ? [`Published: ${post.publishedAt}`] : [],
479
478
  `Media: ${post.media.length}`,
480
- `Destinations: ${post.destinations.map((destination) => `${destination.provider}:${queued && destination.status === "SCHEDULED" ? "QUEUED" : destination.status}`).join(", ") || "none"}`,
479
+ `Destinations: ${post.destinations.map((destination) => `${destination.provider}:${destination.deliveryMode}:${destination.stage}`).join(", ") || "none"}`,
481
480
  ...post.providerSettings?.TIKTOK ? [
482
481
  `TikTok: ${post.providerSettings.TIKTOK.postMode}, ${post.providerSettings.TIKTOK.privacyLevel ?? "visibility not set"}, settings ${post.providerSettings.TIKTOK.consentedAt ? "reviewed" : "not reviewed"}`
483
482
  ] : [],
@@ -488,7 +487,8 @@ function formatPost(post) {
488
487
  }
489
488
  function formatPostSchedulePending(pending) {
490
489
  return [
491
- `YouTube schedule change pending for post ${pending.postId}.`,
490
+ `YouTube publish-time confirmation pending for post ${pending.postId}.`,
491
+ "Video upload: complete (the video remains private).",
492
492
  pending.message,
493
493
  `Mutation: ${pending.mutationId}`
494
494
  ].join("\n");
@@ -534,8 +534,14 @@ function formatPostSchedulePreview(preview) {
534
534
  return [
535
535
  `Schedule preview for post ${preview.post.id}`,
536
536
  `Current version: ${preview.post.version}`,
537
+ `Delivery mode: ${preview.deliveryMode}`,
537
538
  `Publish at: ${preview.schedule.scheduledAt} (${preview.schedule.timezone})`,
538
539
  `Destinations: ${preview.destinations.join(", ")}`,
540
+ ...preview.youtube ? [
541
+ "YouTube preparation: starts immediately as PRIVATE.",
542
+ `YouTube scheduled visibility: ${preview.youtube.publishVisibility}.`,
543
+ `YouTube confirmation: ${preview.youtube.confirmationMeaning}`
544
+ ] : [],
539
545
  ...preview.providerReconciliation ? [`Provider reconciliation: ${preview.providerReconciliation.message}`] : [],
540
546
  `Confirmation expires: ${preview.confirmation.expiresAt}`,
541
547
  `Confirmation token: ${preview.confirmation.token}`,
@@ -547,9 +553,10 @@ function formatPostPublishPreview(preview) {
547
553
  return [
548
554
  `Immediate publish preview for post ${preview.post.id}`,
549
555
  `Current version: ${preview.post.version}`,
556
+ `Delivery mode: ${preview.deliveryMode}`,
550
557
  `Destinations: ${preview.destinations.join(", ")}`,
551
558
  "Effect: confirmed execution queues these destinations for immediate publishing.",
552
- ...preview.destinations.includes("YOUTUBE") ? ["YouTube effect: execution starts a resumable upload; PREPARING remains visible until upload, processing, and configured visibility are provider-confirmed."] : [],
559
+ ...preview.youtube ? [`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.`] : [],
553
560
  `Confirmation expires: ${preview.confirmation.expiresAt}`,
554
561
  `Confirmation token: ${preview.confirmation.token}`,
555
562
  ...attention.length ? ["Readiness notes:", ...attention.map((check) => `${check.status.toUpperCase()} ${check.provider ?? "POST"} ${check.code} ${check.message}`)] : ["All required readiness checks passed."]
@@ -562,6 +569,65 @@ function formatCalendarEvents(data) {
562
569
  const rows = data.items.map((event) => `${event.postId} ${event.scheduledAt} ${event.status} ${event.destinations.map((item) => item.provider).join(",") || "-"} ${event.title}`);
563
570
  return ["POST ID SCHEDULED STATUS DESTINATIONS TITLE", ...rows].join("\n");
564
571
  }
572
+ function formatSeoOpportunities(data) {
573
+ if (!data.items.length) return "No active SEO tasks found.";
574
+ return [
575
+ "ID DECISION FORMAT SCORE TOPIC RELEVANCE ACTION READINESS TITLE",
576
+ ...data.items.map((item) => `${item.id} ${item.task.decision} ${item.task.primaryFormat} ${item.score} ${item.confidence.topicRelevance.label} ${item.confidence.actionReadiness.label} ${item.title}`)
577
+ ].join("\n");
578
+ }
579
+ function formatSeoOpportunity(opportunity) {
580
+ return [
581
+ `${opportunity.title} (${opportunity.id})`,
582
+ `Project: ${opportunity.projectId}`,
583
+ `Decision: ${opportunity.task.decision}`,
584
+ `Primary format: ${opportunity.task.primaryFormat}`,
585
+ `Objective: ${opportunity.task.objective}`,
586
+ `Next step: ${opportunity.task.nextStep}`,
587
+ `Priority: ${opportunity.score}/100`,
588
+ `Topic relevance: ${opportunity.confidence.topicRelevance.label}${opportunity.confidence.topicRelevance.score === null ? "" : ` (${opportunity.confidence.topicRelevance.score}/100)`}`,
589
+ `Topic relevance explanation: ${opportunity.confidence.topicRelevance.explanation}`,
590
+ `Action readiness: ${opportunity.confidence.actionReadiness.label}${opportunity.confidence.actionReadiness.score === null ? "" : ` (${opportunity.confidence.actionReadiness.score}/100)`}`,
591
+ `Action readiness explanation: ${opportunity.confidence.actionReadiness.explanation}`,
592
+ "",
593
+ opportunity.brief
594
+ ].join("\n");
595
+ }
596
+ function formatSeoReports(data) {
597
+ if (!data.items.length) return "No weekly SEO reports found.";
598
+ return [
599
+ "ID PERIOD START PERIOD END STATUS READY RESEARCH REJECTED LEGACY",
600
+ ...data.items.map((item) => `${item.id} ${item.periodStart} ${item.periodEnd} ${item.completeness} ${item.readyTaskCount} ${item.researchTaskCount} ${item.rejectedFindingCount} ${item.legacy}`)
601
+ ].join("\n");
602
+ }
603
+ function formatSeoReport(report) {
604
+ return [
605
+ `Weekly SEO report ${report.id}`,
606
+ `Project: ${report.projectId}`,
607
+ `Period: ${report.periodStart} to ${report.periodEnd}`,
608
+ `Schedule: day ${report.deliveryDay} in ${report.timeZone}`,
609
+ `Status: ${report.completeness}`,
610
+ ...report.partialLabel ? [`Note: ${report.partialLabel}`] : [],
611
+ `Ready tasks: ${report.readyTaskCount}`,
612
+ `Research tasks: ${report.researchTaskCount}`,
613
+ `Rejected or filtered findings: ${report.rejectedFindingCount}`,
614
+ `Legacy report: ${report.legacy}`,
615
+ "",
616
+ ...report.opportunities.flatMap((item, index) => [
617
+ `${index + 1}. ${item.title}`,
618
+ ` Decision: ${item.task.decision}`,
619
+ ` Format: ${item.task.primaryFormat}`,
620
+ ` Objective: ${item.task.objective}`,
621
+ ` Next step: ${item.task.nextStep}`,
622
+ ` Topic relevance: ${item.confidence.topicRelevance.label}${item.confidence.topicRelevance.score === null ? "" : ` (${item.confidence.topicRelevance.score}/100)`}`,
623
+ ` Action readiness: ${item.confidence.actionReadiness.label}${item.confidence.actionReadiness.score === null ? "" : ` (${item.confidence.actionReadiness.score}/100)`}`
624
+ ]),
625
+ ...report.rejectedFindings.flatMap((item, index) => [
626
+ `Rejected ${index + 1}: ${item.query}`,
627
+ ` Reason: ${item.reason}`
628
+ ])
629
+ ].join("\n");
630
+ }
565
631
 
566
632
  // src/mcp-setup.ts
567
633
  var import_node_child_process = require("child_process");
@@ -845,6 +911,21 @@ function postStatus(value) {
845
911
  `Status must be one of ${import_contracts2.PostStatusSchema.options.join(", ")}.`
846
912
  );
847
913
  }
914
+ function seoOpportunityKind(value) {
915
+ const parsed = import_contracts2.SeoOpportunityKindSchema.safeParse(value.toUpperCase());
916
+ if (parsed.success) return parsed.data;
917
+ throw new import_commander.InvalidArgumentError(`SEO kind must be one of ${import_contracts2.SeoOpportunityKindSchema.options.join(", ")}.`);
918
+ }
919
+ function seoExpectedImpact(value) {
920
+ const parsed = import_contracts2.SeoExpectedImpactSchema.safeParse(value.toUpperCase());
921
+ if (parsed.success) return parsed.data;
922
+ throw new import_commander.InvalidArgumentError("SEO impact must be HIGH, MEDIUM, or LOW.");
923
+ }
924
+ function seoReportCompleteness(value) {
925
+ const parsed = import_contracts2.SeoReportCompletenessSchema.safeParse(value.toUpperCase());
926
+ if (parsed.success) return parsed.data;
927
+ throw new import_commander.InvalidArgumentError("Report status must be COMPLETE or PARTIAL.");
928
+ }
848
929
  function projectType(value) {
849
930
  const parsed = import_contracts2.ProjectTypeSchema.safeParse(value.toUpperCase());
850
931
  if (parsed.success) return parsed.data;
@@ -972,6 +1053,10 @@ async function requireWriteConsent(options) {
972
1053
  );
973
1054
  }
974
1055
  }
1056
+ function requireBlogExecutionConsent(options) {
1057
+ if (options.yes || resolveFormat(options.global, options.runtime) !== "human") return;
1058
+ throw new TypeError("This Blog execute command requires explicit consent. Review the confirmed operation and pass --yes.");
1059
+ }
975
1060
  function formatMcpSetupPreview(result) {
976
1061
  return [
977
1062
  `Client: ${result.client === "codex" ? "Codex" : "Claude Code"}`,
@@ -1862,6 +1947,371 @@ async function runCli(argv = process.argv, overrides = {}) {
1862
1947
  }
1863
1948
  });
1864
1949
  });
1950
+ const blog = program.command("blog").description("Read and manage Blog Studio");
1951
+ const blogPublishing = blog.command("destinations").description("Inspect Blog publishing providers, destinations, and delivery attempts");
1952
+ blogPublishing.command("providers").requiredOption("--project <project-id>", "exact Rolino project ID").action(async (local) => {
1953
+ const global = program.opts();
1954
+ commandExitCode = await execute({ command: "blog destinations providers", global, runtime, async action(context, client) {
1955
+ const data = await client.blog.publishing.providers(local.project, { requestId: context.requestId });
1956
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
1957
+ } });
1958
+ });
1959
+ blogPublishing.command("list").requiredOption("--project <project-id>", "exact Rolino project ID").action(async (local) => {
1960
+ const global = program.opts();
1961
+ commandExitCode = await execute({ command: "blog destinations list", global, runtime, async action(context, client) {
1962
+ const data = await client.blog.publishing.destinations(local.project, { requestId: context.requestId });
1963
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
1964
+ } });
1965
+ });
1966
+ blogPublishing.command("deliveries").requiredOption("--project <project-id>", "exact Rolino project ID").option("--article <article-id>", "filter by exact Blog article ID").action(async (local) => {
1967
+ const global = program.opts();
1968
+ commandExitCode = await execute({ command: "blog destinations deliveries", global, runtime, async action(context, client) {
1969
+ const data = await client.blog.publishing.deliveries(local.project, local.article, { requestId: context.requestId });
1970
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
1971
+ } });
1972
+ });
1973
+ const blogSetup = blog.command("setup").description("Inspect agent-first Blog setup readiness");
1974
+ blogSetup.command("status").requiredOption("--project <project-id>", "exact Rolino project ID").action(async (local) => {
1975
+ const global = program.opts();
1976
+ commandExitCode = await execute({ command: "blog setup status", global, runtime, async action(context, client) {
1977
+ const data = await client.blog.setup.status(local.project, { requestId: context.requestId });
1978
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
1979
+ } });
1980
+ });
1981
+ const blogSite = blog.command("site").description("Initialize or retry the Blog website import");
1982
+ blogSite.command("import").requiredOption("--project <project-id>", "exact Rolino project ID").requiredOption("--idempotency-key <key>", "stable retry key").action(async (local) => {
1983
+ const global = program.opts();
1984
+ commandExitCode = await execute({ command: "blog site import", global, runtime, async action(context, client) {
1985
+ const data = await client.blog.site.import(local.project, local.idempotencyKey, { requestId: context.requestId });
1986
+ writeSuccess(context, data, JSON.stringify(data, null, 2), [`rolino blog job ${data.id} --project ${local.project} --agent`]);
1987
+ } });
1988
+ });
1989
+ blogSite.command("retry").requiredOption("--project <project-id>", "exact Rolino project ID").requiredOption("--idempotency-key <key>", "stable retry key").action(async (local) => {
1990
+ const global = program.opts();
1991
+ commandExitCode = await execute({ command: "blog site retry", global, runtime, async action(context, client) {
1992
+ const data = await client.blog.site.retry(local.project, local.idempotencyKey, { requestId: context.requestId });
1993
+ writeSuccess(context, data, JSON.stringify(data, null, 2), [`rolino blog job ${data.id} --project ${local.project} --agent`]);
1994
+ } });
1995
+ });
1996
+ blog.command("plans").description("List Blog Studio plans").requiredOption("--project <project-id>", "exact Rolino project ID").action(async (local) => {
1997
+ const global = program.opts();
1998
+ commandExitCode = await execute({ command: "blog plans", global, runtime, async action(context, client) {
1999
+ const data = await client.blog.plans.list(local.project, { requestId: context.requestId });
2000
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2001
+ } });
2002
+ });
2003
+ const blogPlan = blog.command("plan").description("Create, retry, and review a Blog cadence plan");
2004
+ blogPlan.command("create").requiredOption("--project <project-id>", "exact Rolino project ID").requiredOption("--start <date>", "local start date as YYYY-MM-DD").requiredOption("--weekdays <days>", "comma-separated weekday names such as mon,wed,fri").option("--time-zone <zone>", "IANA time zone", "UTC").requiredOption("--idempotency-key <key>", "stable retry key").action(async (local) => {
2005
+ const weekdayMap = { sun: 0, mon: 1, tue: 2, wed: 3, thu: 4, fri: 5, sat: 6 };
2006
+ const weekdays = local.weekdays.split(",").map((day) => weekdayMap[day.trim().toLowerCase()]).filter((day) => day !== void 0);
2007
+ if (!weekdays.length || weekdays.length !== local.weekdays.split(",").length) throw new TypeError("--weekdays must contain comma-separated sun,mon,tue,wed,thu,fri,sat values.");
2008
+ const global = program.opts();
2009
+ commandExitCode = await execute({ command: "blog plan create", global, runtime, async action(context, client) {
2010
+ const data = await client.blog.plans.create(local.project, { startsOn: local.start, weekdays, timeZone: local.timeZone }, local.idempotencyKey, { requestId: context.requestId });
2011
+ writeSuccess(context, data, JSON.stringify(data, null, 2), [`rolino blog job ${data.job.id} --project ${local.project} --agent`]);
2012
+ } });
2013
+ });
2014
+ blogPlan.command("retry").requiredOption("--project <project-id>", "exact Rolino project ID").requiredOption("--plan <plan-id>", "exact Blog plan ID").requiredOption("--idempotency-key <key>", "stable retry key").action(async (local) => {
2015
+ const global = program.opts();
2016
+ commandExitCode = await execute({ command: "blog plan retry", global, runtime, async action(context, client) {
2017
+ const data = await client.blog.plans.retry(local.project, local.plan, local.idempotencyKey, { requestId: context.requestId });
2018
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2019
+ } });
2020
+ });
2021
+ blogPlan.command("items").requiredOption("--project <project-id>", "exact Rolino project ID").requiredOption("--plan <plan-id>", "exact Blog plan ID").action(async (local) => {
2022
+ const global = program.opts();
2023
+ commandExitCode = await execute({ command: "blog plan items", global, runtime, async action(context, client) {
2024
+ const data = await client.blog.plans.items.list(local.project, local.plan, { requestId: context.requestId });
2025
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2026
+ } });
2027
+ });
2028
+ const blogPlanItem = blogPlan.command("item").description("Accept or dismiss a reviewed Blog plan item");
2029
+ for (const state of ["accept", "dismiss"]) {
2030
+ blogPlanItem.command(state).requiredOption("--project <project-id>", "exact Rolino project ID").requiredOption("--plan <plan-id>", "exact Blog plan ID").requiredOption("--item <item-id>", "exact plan item ID").requiredOption("--expected-state <state>", "state returned by the latest item read").requiredOption("--expected-version <version>", "version returned by the latest item read", Number).requiredOption("--idempotency-key <key>", "stable retry key").action(async (local) => {
2031
+ const global = program.opts();
2032
+ commandExitCode = await execute({ command: `blog plan item ${state}`, global, runtime, async action(context, client) {
2033
+ 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 });
2034
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2035
+ } });
2036
+ });
2037
+ }
2038
+ const blogArticle = blog.command("article").description("Create an editable Blog article from an accepted item");
2039
+ blogArticle.command("create").requiredOption("--project <project-id>", "exact Rolino project ID").requiredOption("--plan <plan-id>", "exact Blog plan ID").requiredOption("--item <item-id>", "exact accepted item ID").requiredOption("--expected-version <version>", "version returned by the latest item read", Number).requiredOption("--idempotency-key <key>", "stable retry key").action(async (local) => {
2040
+ const global = program.opts();
2041
+ commandExitCode = await execute({ command: "blog article create", global, runtime, async action(context, client) {
2042
+ 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 });
2043
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2044
+ } });
2045
+ });
2046
+ const blogConnection = blog.command("connection").description("Configure and verify the server-only Next.js Blog connection");
2047
+ blogConnection.command("status").requiredOption("--project <project-id>", "exact Rolino project ID").action(async (local) => {
2048
+ const global = program.opts();
2049
+ commandExitCode = await execute({ command: "blog connection status", global, runtime, async action(context, client) {
2050
+ const data = await client.blog.connection.status(local.project, { requestId: context.requestId });
2051
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2052
+ } });
2053
+ });
2054
+ const addConnectionOptions = (command, execute2) => {
2055
+ command.requiredOption("--project <project-id>", "exact Rolino project ID").option("--endpoint <url>", "same-host signed revalidation endpoint").option("--credential-action <action>", "KEEP, CREATE, ROTATE, or REVOKE", "KEEP").option("--credential-id <id>", "credential to rotate or revoke").option("--secret-action <action>", "KEEP, CREATE, or ROTATE", "KEEP");
2056
+ if (execute2) 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");
2057
+ return command;
2058
+ };
2059
+ addConnectionOptions(blogConnection.command("preview"), false).action(async (local) => {
2060
+ const input = { endpoint: local.endpoint ?? null, credentialAction: local.credentialAction.toUpperCase(), credentialId: local.credentialId ?? null, secretAction: local.secretAction.toUpperCase() };
2061
+ const global = program.opts();
2062
+ commandExitCode = await execute({ command: "blog connection preview", global, runtime, async action(context, client) {
2063
+ const data = await client.blog.connection.preview(local.project, input, { requestId: context.requestId });
2064
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2065
+ } });
2066
+ });
2067
+ addConnectionOptions(blogConnection.command("execute"), true).action(async (local) => {
2068
+ const input = { endpoint: local.endpoint ?? null, credentialAction: local.credentialAction.toUpperCase(), credentialId: local.credentialId ?? null, secretAction: local.secretAction.toUpperCase() };
2069
+ const global = program.opts();
2070
+ commandExitCode = await execute({ command: "blog connection execute", global, runtime, async action(context, client) {
2071
+ 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.` });
2072
+ const data = await client.blog.connection.execute(local.project, { ...input, confirmationToken: local.confirmationToken, idempotencyKey: local.idempotencyKey }, { requestId: context.requestId });
2073
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2074
+ } });
2075
+ });
2076
+ blogConnection.command("test").requiredOption("--project <project-id>", "exact Rolino project ID").requiredOption("--idempotency-key <key>", "stable retry key").action(async (local) => {
2077
+ const global = program.opts();
2078
+ commandExitCode = await execute({ command: "blog connection test", global, runtime, async action(context, client) {
2079
+ const data = await client.blog.connection.test(local.project, local.idempotencyKey, { requestId: context.requestId });
2080
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2081
+ } });
2082
+ });
2083
+ const blogArticles = blog.command("articles").description("Read and edit Blog Studio articles");
2084
+ blogArticles.command("list").requiredOption("--project <project-id>", "exact Rolino project ID").action(async (local) => {
2085
+ const global = program.opts();
2086
+ commandExitCode = await execute({ command: "blog articles list", global, runtime, async action(context, client) {
2087
+ const data = await client.blog.articles.list(local.project, { requestId: context.requestId });
2088
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2089
+ } });
2090
+ });
2091
+ blogArticles.command("show").argument("<article-id>").requiredOption("--project <project-id>", "exact Rolino project ID").action(async (articleId, local) => {
2092
+ const global = program.opts();
2093
+ commandExitCode = await execute({ command: "blog articles show", global, runtime, async action(context, client) {
2094
+ const data = await client.blog.articles.get(local.project, articleId, { requestId: context.requestId });
2095
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2096
+ } });
2097
+ });
2098
+ blogArticles.command("update").argument("<article-id>").requiredOption("--project <project-id>", "exact Rolino project ID").requiredOption("--input <json-file>", "complete Blog draft JSON file").option("--yes", "confirm the draft save").action(async (articleId, local) => {
2099
+ const global = program.opts();
2100
+ commandExitCode = await execute({ command: "blog articles update", global, runtime, async action(context, client) {
2101
+ const draft = import_contracts2.AgentBlogDraftUpdateSchema.parse(JSON.parse(await (0, import_promises2.readFile)((0, import_node_path2.resolve)(runtime.cwd, local.input), "utf8")));
2102
+ await requireWriteConsent({ yes: local.yes, global, runtime, preview: `Save a new immutable Blog draft revision?
2103
+ Project: ${local.project}
2104
+ Article: ${articleId}
2105
+ This will not publish.` });
2106
+ const data = await client.blog.articles.updateDraft(local.project, articleId, draft, { requestId: context.requestId });
2107
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2108
+ } });
2109
+ });
2110
+ blogArticles.command("generate").argument("<article-id>").requiredOption("--project <project-id>", "exact Rolino project ID").option("--idempotency-key <key>", "stable retry key; defaults to request ID").option("--yes", "confirm the generation request").action(async (articleId, local) => {
2111
+ const global = program.opts();
2112
+ commandExitCode = await execute({ command: "blog articles generate", global, runtime, async action(context, client) {
2113
+ await requireWriteConsent({ yes: local.yes, global, runtime, preview: `Queue durable Blog article generation?
2114
+ Project: ${local.project}
2115
+ Article: ${articleId}` });
2116
+ const data = await client.blog.articles.generate(local.project, articleId, local.idempotencyKey ?? context.requestId, { requestId: context.requestId });
2117
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2118
+ } });
2119
+ });
2120
+ const blogImages = blog.command("images").description("Create and review Blog images with blog:write; cannot approve or publish");
2121
+ blogImages.command("generate").description("Queue one exact-revision featured image with blog:write; cannot approve or publish").argument("<article-id>").requiredOption("--project <project-id>", "exact Rolino project ID").requiredOption("--revision <revision-id>", "exact Blog revision ID").option("--editorial-brief <text>", "bounded visual direction; provider controls stay on the server").option("--idempotency-key <key>", "stable retry key; defaults to request ID").action(async (articleId, local) => {
2122
+ const global = program.opts();
2123
+ commandExitCode = await execute({ command: "blog images generate", global, runtime, async action(context, client) {
2124
+ const data = await client.blog.articles.generateImage(local.project, articleId, { revisionId: local.revision, idempotencyKey: local.idempotencyKey ?? context.requestId, editorialBrief: local.editorialBrief }, { requestId: context.requestId });
2125
+ writeSuccess(context, data, `Blog image generation queued.
2126
+ Image: ${data.image.id}
2127
+ Job: ${data.job.id}`);
2128
+ } });
2129
+ });
2130
+ blogImages.command("upload").description("Upload one JPEG, PNG, or WebP for an exact Blog revision with blog:write; cannot approve or publish").argument("<article-id>").argument("<file-path>").requiredOption("--project <project-id>", "exact Rolino project ID").requiredOption("--revision <revision-id>", "exact Blog revision ID").requiredOption("--alt-text <text>", "reviewable image alt text").action(async (articleId, filePath, local) => {
2131
+ const global = program.opts();
2132
+ commandExitCode = await execute({ command: "blog images upload", global, runtime, async action(context, client) {
2133
+ const absolutePath = (0, import_node_path2.resolve)(runtime.cwd, filePath);
2134
+ const details = await (0, import_promises2.stat)(absolutePath).catch(() => null);
2135
+ if (!details?.isFile()) throw new TypeError("The Blog image path must point to a readable file.");
2136
+ const contentTypes = { ".jpg": "image/jpeg", ".jpeg": "image/jpeg", ".png": "image/png", ".webp": "image/webp" };
2137
+ const extension = (0, import_node_path2.extname)(absolutePath).toLowerCase();
2138
+ const contentType = contentTypes[extension];
2139
+ if (!contentType) throw new TypeError("Use a JPEG, PNG, or WebP Blog image.");
2140
+ const body = await (0, import_node_fs2.openAsBlob)(absolutePath, { type: contentType });
2141
+ const data = await client.blog.articles.uploadImage(local.project, articleId, { revisionId: local.revision, fileName: (0, import_node_path2.basename)(absolutePath), contentType, fileSize: details.size, altText: local.altText, body }, { requestId: context.requestId });
2142
+ writeSuccess(context, data, `Blog image uploaded for review.
2143
+ Image: ${data.id}
2144
+ State: ${data.state}`);
2145
+ } });
2146
+ });
2147
+ blogImages.command("review").description("Review one exact Blog image with blog:write; does not approve the article or publish").argument("<article-id>").argument("<image-id>").requiredOption("--project <project-id>", "exact Rolino project ID").requiredOption("--decision <decision>", "APPROVED or REJECTED").requiredOption("--expected-version <version>", "current image version", positiveInteger).option("--alt-text <text>", "final image alt text; required by the server for approval").option("--idempotency-key <key>", "stable retry key; defaults to request ID").action(async (articleId, imageId, local) => {
2148
+ const decision = local.decision.toUpperCase();
2149
+ if (decision !== "APPROVED" && decision !== "REJECTED") throw new TypeError("--decision must be APPROVED or REJECTED.");
2150
+ const global = program.opts();
2151
+ commandExitCode = await execute({ command: "blog images review", global, runtime, async action(context, client) {
2152
+ 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 });
2153
+ writeSuccess(context, data, `Blog image review saved.
2154
+ Image: ${data.id}
2155
+ State: ${data.state}`);
2156
+ } });
2157
+ });
2158
+ const blogApprove = blog.command("approve").description("Approve one exact Blog bundle with blog:approve; cannot publish");
2159
+ blogApprove.command("preview").description("Preview one exact approval bundle with blog:approve; creates a confirmation but cannot publish").argument("<article-id>").requiredOption("--project <project-id>", "exact Rolino project ID").requiredOption("--revision <revision-id>", "exact Blog revision ID").action(async (articleId, local) => {
2160
+ const global = program.opts();
2161
+ commandExitCode = await execute({ command: "blog approve preview", global, runtime, async action(context, client) {
2162
+ const data = await client.blog.articles.previewApproval(local.project, articleId, { revisionId: local.revision }, { requestId: context.requestId });
2163
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2164
+ } });
2165
+ });
2166
+ blogApprove.command("execute").description("Approve the confirmed exact bundle with blog:approve; separate blog:publish access is still required").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").action(async (articleId, local) => {
2167
+ const global = program.opts();
2168
+ commandExitCode = await execute({ command: "blog approve execute", global, runtime, async action(context, client) {
2169
+ requireBlogExecutionConsent({ yes: local.yes, global, runtime });
2170
+ const data = await client.blog.articles.executeApproval(local.project, articleId, { revisionId: local.revision, confirmationToken: local.confirmationToken, idempotencyKey: local.idempotencyKey }, { requestId: context.requestId });
2171
+ writeSuccess(context, data, `Exact Blog bundle approved.
2172
+ Revision: ${data.revisionId}
2173
+ Publishing still requires blog:publish.`);
2174
+ } });
2175
+ });
2176
+ const blogSchedule = blog.command("schedule").description("Schedule exact approved Blog bundles with blog:publish; does not grant approval");
2177
+ const addScheduleOptions = (command, executeSchedule) => {
2178
+ 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");
2179
+ 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");
2180
+ return command;
2181
+ };
2182
+ addScheduleOptions(blogSchedule.command("preview").description("Preview an exact future Blog schedule with blog:publish; does not publish now"), false).action(async (articleId, local) => {
2183
+ const global = program.opts();
2184
+ commandExitCode = await execute({ command: "blog schedule preview", global, runtime, async action(context, client) {
2185
+ 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 });
2186
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2187
+ } });
2188
+ });
2189
+ addScheduleOptions(blogSchedule.command("execute").description("Execute a confirmed future Blog schedule with blog:publish; causes future external publication"), true).action(async (articleId, local) => {
2190
+ const global = program.opts();
2191
+ commandExitCode = await execute({ command: "blog schedule execute", global, runtime, async action(context, client) {
2192
+ requireBlogExecutionConsent({ yes: local.yes, global, runtime });
2193
+ 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 });
2194
+ writeSuccess(context, data, `Blog article scheduled.
2195
+ Time: ${data.scheduledAt}
2196
+ Timezone: ${data.timezone}`);
2197
+ } });
2198
+ });
2199
+ const blogScheduleCancel = blogSchedule.command("cancel").description("Cancel one future Blog schedule with blog:publish; never unpublishes a live article");
2200
+ blogScheduleCancel.command("preview").description("Preview exact schedule cancellation with blog:publish; does not unpublish").argument("<article-id>").requiredOption("--project <project-id>", "exact Rolino project ID").action(async (articleId, local) => {
2201
+ const global = program.opts();
2202
+ commandExitCode = await execute({ command: "blog schedule cancel preview", global, runtime, async action(context, client) {
2203
+ const data = await client.blog.articles.previewScheduleCancellation(local.project, articleId, { requestId: context.requestId });
2204
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2205
+ } });
2206
+ });
2207
+ blogScheduleCancel.command("execute").description("Cancel the confirmed future schedule with blog:publish; never unpublishes a live article").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").action(async (articleId, local) => {
2208
+ const global = program.opts();
2209
+ commandExitCode = await execute({ command: "blog schedule cancel execute", global, runtime, async action(context, client) {
2210
+ requireBlogExecutionConsent({ yes: local.yes, global, runtime });
2211
+ const data = await client.blog.articles.executeScheduleCancellation(local.project, articleId, { confirmationToken: local.confirmationToken, idempotencyKey: local.idempotencyKey }, { requestId: context.requestId });
2212
+ writeSuccess(context, data, `Future Blog schedule canceled.
2213
+ Article: ${data.articleId}
2214
+ A live article was not unpublished.`);
2215
+ } });
2216
+ });
2217
+ blog.command("job").argument("<job-id>").requiredOption("--project <project-id>", "exact Rolino project ID").action(async (jobId, local) => {
2218
+ const global = program.opts();
2219
+ commandExitCode = await execute({ command: "blog job", global, runtime, async action(context, client) {
2220
+ const data = await client.blog.jobs.get(local.project, jobId, { requestId: context.requestId });
2221
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2222
+ } });
2223
+ });
2224
+ const blogPublish = blog.command("publish").description("Preview or execute exact approved Blog publication");
2225
+ blogPublish.command("preview").argument("<article-id>").requiredOption("--project <project-id>", "exact Rolino project ID").requiredOption("--revision <revision-id>", "exact user-approved revision ID").option("--destination <destination-id...>", "exact destination IDs; defaults to the current primary").action(async (articleId, local) => {
2226
+ const global = program.opts();
2227
+ commandExitCode = await execute({ command: "blog publish preview", global, runtime, async action(context, client) {
2228
+ const data = await client.blog.articles.previewPublish(local.project, articleId, local.revision, { requestId: context.requestId }, local.destination);
2229
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2230
+ } });
2231
+ });
2232
+ blogPublish.command("execute").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").option("--destination <destination-id...>", "same exact destination IDs used for preview").option("--idempotency-key <key>", "stable retry key; defaults to request ID").option("--yes", "confirm publication").action(async (articleId, local) => {
2233
+ const global = program.opts();
2234
+ commandExitCode = await execute({ command: "blog publish execute", global, runtime, async action(context, client) {
2235
+ await requireWriteConsent({ yes: local.yes, global, runtime, preview: `Publish the exact approved Blog revision?
2236
+ Project: ${local.project}
2237
+ Article: ${articleId}
2238
+ Revision: ${local.revision}` });
2239
+ 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 });
2240
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2241
+ } });
2242
+ });
2243
+ const seo = program.command("seo").description("Read authorized SEO opportunities and weekly reports");
2244
+ const seoOpportunities = seo.command("opportunities").description("Read accepted SEO opportunities");
2245
+ seoOpportunities.command("list").description("List bounded SEO opportunities").requiredOption("--project <project-id>", "exact Rolino project ID").option("--limit <number>", "maximum opportunities to return", (value) => {
2246
+ const parsed = Number(value);
2247
+ if (!Number.isInteger(parsed) || parsed < 1 || parsed > 50) {
2248
+ throw new import_commander.InvalidArgumentError("Limit must be an integer from 1 to 50.");
2249
+ }
2250
+ return parsed;
2251
+ }).option("--cursor <cursor>", "continue from an SEO opportunity cursor").option("--kind <kind>", "filter by exact SEO opportunity kind", seoOpportunityKind).option("--impact <impact>", "filter by HIGH, MEDIUM, or LOW impact", seoExpectedImpact).action(async (local) => {
2252
+ const global = program.opts();
2253
+ commandExitCode = await execute({
2254
+ command: "seo opportunities list",
2255
+ global,
2256
+ runtime,
2257
+ async action(context, client) {
2258
+ const data = await client.seo.opportunities.list(local.project, {
2259
+ limit: local.limit,
2260
+ cursor: local.cursor,
2261
+ kind: local.kind,
2262
+ expectedImpact: local.impact
2263
+ }, { requestId: context.requestId });
2264
+ writeSuccess(context, data, formatSeoOpportunities(data), data.items.slice(0, 3).map((item) => `rolino seo opportunities show ${item.id} --project ${local.project} --agent`));
2265
+ }
2266
+ });
2267
+ });
2268
+ seoOpportunities.command("show").description("Show one canonical SEO opportunity task").argument("<opportunity-id>").requiredOption("--project <project-id>", "exact Rolino project ID").action(async (opportunityId, local) => {
2269
+ const global = program.opts();
2270
+ commandExitCode = await execute({
2271
+ command: "seo opportunities show",
2272
+ global,
2273
+ runtime,
2274
+ async action(context, client) {
2275
+ const opportunity = await client.seo.opportunities.get(local.project, opportunityId, { requestId: context.requestId });
2276
+ writeSuccess(context, opportunity, formatSeoOpportunity(opportunity));
2277
+ }
2278
+ });
2279
+ });
2280
+ const seoReports = seo.command("reports").description("Read immutable weekly SEO report snapshots");
2281
+ seoReports.command("list").description("List bounded weekly SEO reports").requiredOption("--project <project-id>", "exact Rolino project ID").option("--limit <number>", "maximum reports to return", (value) => {
2282
+ const parsed = Number(value);
2283
+ if (!Number.isInteger(parsed) || parsed < 1 || parsed > 26) {
2284
+ throw new import_commander.InvalidArgumentError("Limit must be an integer from 1 to 26.");
2285
+ }
2286
+ return parsed;
2287
+ }).option("--cursor <cursor>", "continue from an SEO report cursor").option("--status <status>", "filter by COMPLETE or PARTIAL", seoReportCompleteness).action(async (local) => {
2288
+ const global = program.opts();
2289
+ commandExitCode = await execute({
2290
+ command: "seo reports list",
2291
+ global,
2292
+ runtime,
2293
+ async action(context, client) {
2294
+ const data = await client.seo.reports.list(local.project, {
2295
+ limit: local.limit,
2296
+ cursor: local.cursor,
2297
+ completeness: local.status
2298
+ }, { requestId: context.requestId });
2299
+ writeSuccess(context, data, formatSeoReports(data), data.items.slice(0, 3).map((item) => `rolino seo reports show ${item.id} --project ${local.project} --agent`));
2300
+ }
2301
+ });
2302
+ });
2303
+ seoReports.command("show").description("Show one weekly SEO report snapshot").argument("<report-id>").requiredOption("--project <project-id>", "exact Rolino project ID").action(async (reportId, local) => {
2304
+ const global = program.opts();
2305
+ commandExitCode = await execute({
2306
+ command: "seo reports show",
2307
+ global,
2308
+ runtime,
2309
+ async action(context, client) {
2310
+ const report = await client.seo.reports.get(local.project, reportId, { requestId: context.requestId });
2311
+ writeSuccess(context, report, formatSeoReport(report));
2312
+ }
2313
+ });
2314
+ });
1865
2315
  program.command("doctor").description("Check configuration, compatibility, and authentication").action(async () => {
1866
2316
  const global = program.opts();
1867
2317
  commandExitCode = await execute({