@rolino/cli 0.4.0 → 0.5.0-beta.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/index.cjs CHANGED
@@ -50,7 +50,7 @@ var import_commander = require("commander");
50
50
  // package.json
51
51
  var package_default = {
52
52
  name: "@rolino/cli",
53
- version: "0.4.0",
53
+ version: "0.5.0-beta.0",
54
54
  description: "Agent-friendly command-line interface for Rolino",
55
55
  type: "module",
56
56
  license: "MIT",
@@ -107,9 +107,9 @@ var package_default = {
107
107
  dev: "tsx src/bin.ts"
108
108
  },
109
109
  dependencies: {
110
- "@rolino/contracts": "0.4.0",
111
- "@rolino/local-auth": "0.4.0",
112
- "@rolino/sdk": "0.4.0",
110
+ "@rolino/contracts": "0.5.0-beta.0",
111
+ "@rolino/local-auth": "0.5.0-beta.0",
112
+ "@rolino/sdk": "0.5.0-beta.0",
113
113
  commander: "^15.0.0",
114
114
  open: "^11.0.0"
115
115
  },
@@ -480,7 +480,6 @@ function formatPosts(data) {
480
480
  return ["ID STATUS SCHEDULED CAPTION", ...rows].join("\n");
481
481
  }
482
482
  function formatPost(post) {
483
- const queued = post.status === "PUBLISHING";
484
483
  return [
485
484
  `Post ${post.id}`,
486
485
  `Project: ${post.projectId}`,
@@ -489,11 +488,11 @@ function formatPost(post) {
489
488
  `Caption: ${post.caption || "-"}`,
490
489
  ...post.campaign ? [`Campaign: ${post.campaign.title} (${post.campaign.id})`] : [],
491
490
  ...post.scheduledAt ? [
492
- `${queued ? "Queued for publishing" : "Scheduled"}: ${post.scheduledAt}${post.timezone ? ` (${post.timezone})` : ""}`
491
+ `Scheduled: ${post.scheduledAt}${post.timezone ? ` (${post.timezone})` : ""}`
493
492
  ] : [],
494
493
  ...post.publishedAt ? [`Published: ${post.publishedAt}`] : [],
495
494
  `Media: ${post.media.length}`,
496
- `Destinations: ${post.destinations.map((destination) => `${destination.provider}:${queued && destination.status === "SCHEDULED" ? "QUEUED" : destination.status}`).join(", ") || "none"}`,
495
+ `Destinations: ${post.destinations.map((destination) => `${destination.provider}:${destination.deliveryMode}:${destination.stage}`).join(", ") || "none"}`,
497
496
  ...post.providerSettings?.TIKTOK ? [
498
497
  `TikTok: ${post.providerSettings.TIKTOK.postMode}, ${post.providerSettings.TIKTOK.privacyLevel ?? "visibility not set"}, settings ${post.providerSettings.TIKTOK.consentedAt ? "reviewed" : "not reviewed"}`
499
498
  ] : [],
@@ -504,7 +503,8 @@ function formatPost(post) {
504
503
  }
505
504
  function formatPostSchedulePending(pending) {
506
505
  return [
507
- `YouTube schedule change pending for post ${pending.postId}.`,
506
+ `YouTube publish-time confirmation pending for post ${pending.postId}.`,
507
+ "Video upload: complete (the video remains private).",
508
508
  pending.message,
509
509
  `Mutation: ${pending.mutationId}`
510
510
  ].join("\n");
@@ -550,8 +550,14 @@ function formatPostSchedulePreview(preview) {
550
550
  return [
551
551
  `Schedule preview for post ${preview.post.id}`,
552
552
  `Current version: ${preview.post.version}`,
553
+ `Delivery mode: ${preview.deliveryMode}`,
553
554
  `Publish at: ${preview.schedule.scheduledAt} (${preview.schedule.timezone})`,
554
555
  `Destinations: ${preview.destinations.join(", ")}`,
556
+ ...preview.youtube ? [
557
+ "YouTube preparation: starts immediately as PRIVATE.",
558
+ `YouTube scheduled visibility: ${preview.youtube.publishVisibility}.`,
559
+ `YouTube confirmation: ${preview.youtube.confirmationMeaning}`
560
+ ] : [],
555
561
  ...preview.providerReconciliation ? [`Provider reconciliation: ${preview.providerReconciliation.message}`] : [],
556
562
  `Confirmation expires: ${preview.confirmation.expiresAt}`,
557
563
  `Confirmation token: ${preview.confirmation.token}`,
@@ -563,9 +569,10 @@ function formatPostPublishPreview(preview) {
563
569
  return [
564
570
  `Immediate publish preview for post ${preview.post.id}`,
565
571
  `Current version: ${preview.post.version}`,
572
+ `Delivery mode: ${preview.deliveryMode}`,
566
573
  `Destinations: ${preview.destinations.join(", ")}`,
567
574
  "Effect: confirmed execution queues these destinations for immediate publishing.",
568
- ...preview.destinations.includes("YOUTUBE") ? ["YouTube effect: execution starts a resumable upload; PREPARING remains visible until upload, processing, and configured visibility are provider-confirmed."] : [],
575
+ ...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.`] : [],
569
576
  `Confirmation expires: ${preview.confirmation.expiresAt}`,
570
577
  `Confirmation token: ${preview.confirmation.token}`,
571
578
  ...attention.length ? ["Readiness notes:", ...attention.map((check) => `${check.status.toUpperCase()} ${check.provider ?? "POST"} ${check.code} ${check.message}`)] : ["All required readiness checks passed."]
@@ -578,6 +585,65 @@ function formatCalendarEvents(data) {
578
585
  const rows = data.items.map((event) => `${event.postId} ${event.scheduledAt} ${event.status} ${event.destinations.map((item) => item.provider).join(",") || "-"} ${event.title}`);
579
586
  return ["POST ID SCHEDULED STATUS DESTINATIONS TITLE", ...rows].join("\n");
580
587
  }
588
+ function formatSeoOpportunities(data) {
589
+ if (!data.items.length) return "No active SEO tasks found.";
590
+ return [
591
+ "ID DECISION FORMAT SCORE TOPIC RELEVANCE ACTION READINESS TITLE",
592
+ ...data.items.map((item) => `${item.id} ${item.task.decision} ${item.task.primaryFormat} ${item.score} ${item.confidence.topicRelevance.label} ${item.confidence.actionReadiness.label} ${item.title}`)
593
+ ].join("\n");
594
+ }
595
+ function formatSeoOpportunity(opportunity) {
596
+ return [
597
+ `${opportunity.title} (${opportunity.id})`,
598
+ `Project: ${opportunity.projectId}`,
599
+ `Decision: ${opportunity.task.decision}`,
600
+ `Primary format: ${opportunity.task.primaryFormat}`,
601
+ `Objective: ${opportunity.task.objective}`,
602
+ `Next step: ${opportunity.task.nextStep}`,
603
+ `Priority: ${opportunity.score}/100`,
604
+ `Topic relevance: ${opportunity.confidence.topicRelevance.label}${opportunity.confidence.topicRelevance.score === null ? "" : ` (${opportunity.confidence.topicRelevance.score}/100)`}`,
605
+ `Topic relevance explanation: ${opportunity.confidence.topicRelevance.explanation}`,
606
+ `Action readiness: ${opportunity.confidence.actionReadiness.label}${opportunity.confidence.actionReadiness.score === null ? "" : ` (${opportunity.confidence.actionReadiness.score}/100)`}`,
607
+ `Action readiness explanation: ${opportunity.confidence.actionReadiness.explanation}`,
608
+ "",
609
+ opportunity.brief
610
+ ].join("\n");
611
+ }
612
+ function formatSeoReports(data) {
613
+ if (!data.items.length) return "No weekly SEO reports found.";
614
+ return [
615
+ "ID PERIOD START PERIOD END STATUS READY RESEARCH REJECTED LEGACY",
616
+ ...data.items.map((item) => `${item.id} ${item.periodStart} ${item.periodEnd} ${item.completeness} ${item.readyTaskCount} ${item.researchTaskCount} ${item.rejectedFindingCount} ${item.legacy}`)
617
+ ].join("\n");
618
+ }
619
+ function formatSeoReport(report) {
620
+ return [
621
+ `Weekly SEO report ${report.id}`,
622
+ `Project: ${report.projectId}`,
623
+ `Period: ${report.periodStart} to ${report.periodEnd}`,
624
+ `Schedule: day ${report.deliveryDay} in ${report.timeZone}`,
625
+ `Status: ${report.completeness}`,
626
+ ...report.partialLabel ? [`Note: ${report.partialLabel}`] : [],
627
+ `Ready tasks: ${report.readyTaskCount}`,
628
+ `Research tasks: ${report.researchTaskCount}`,
629
+ `Rejected or filtered findings: ${report.rejectedFindingCount}`,
630
+ `Legacy report: ${report.legacy}`,
631
+ "",
632
+ ...report.opportunities.flatMap((item, index) => [
633
+ `${index + 1}. ${item.title}`,
634
+ ` Decision: ${item.task.decision}`,
635
+ ` Format: ${item.task.primaryFormat}`,
636
+ ` Objective: ${item.task.objective}`,
637
+ ` Next step: ${item.task.nextStep}`,
638
+ ` Topic relevance: ${item.confidence.topicRelevance.label}${item.confidence.topicRelevance.score === null ? "" : ` (${item.confidence.topicRelevance.score}/100)`}`,
639
+ ` Action readiness: ${item.confidence.actionReadiness.label}${item.confidence.actionReadiness.score === null ? "" : ` (${item.confidence.actionReadiness.score}/100)`}`
640
+ ]),
641
+ ...report.rejectedFindings.flatMap((item, index) => [
642
+ `Rejected ${index + 1}: ${item.query}`,
643
+ ` Reason: ${item.reason}`
644
+ ])
645
+ ].join("\n");
646
+ }
581
647
 
582
648
  // src/mcp-setup.ts
583
649
  var import_node_child_process = require("child_process");
@@ -861,6 +927,21 @@ function postStatus(value) {
861
927
  `Status must be one of ${import_contracts2.PostStatusSchema.options.join(", ")}.`
862
928
  );
863
929
  }
930
+ function seoOpportunityKind(value) {
931
+ const parsed = import_contracts2.SeoOpportunityKindSchema.safeParse(value.toUpperCase());
932
+ if (parsed.success) return parsed.data;
933
+ throw new import_commander.InvalidArgumentError(`SEO kind must be one of ${import_contracts2.SeoOpportunityKindSchema.options.join(", ")}.`);
934
+ }
935
+ function seoExpectedImpact(value) {
936
+ const parsed = import_contracts2.SeoExpectedImpactSchema.safeParse(value.toUpperCase());
937
+ if (parsed.success) return parsed.data;
938
+ throw new import_commander.InvalidArgumentError("SEO impact must be HIGH, MEDIUM, or LOW.");
939
+ }
940
+ function seoReportCompleteness(value) {
941
+ const parsed = import_contracts2.SeoReportCompletenessSchema.safeParse(value.toUpperCase());
942
+ if (parsed.success) return parsed.data;
943
+ throw new import_commander.InvalidArgumentError("Report status must be COMPLETE or PARTIAL.");
944
+ }
864
945
  function projectType(value) {
865
946
  const parsed = import_contracts2.ProjectTypeSchema.safeParse(value.toUpperCase());
866
947
  if (parsed.success) return parsed.data;
@@ -1878,6 +1959,274 @@ async function runCli(argv = process.argv, overrides = {}) {
1878
1959
  }
1879
1960
  });
1880
1961
  });
1962
+ const blog = program.command("blog").description("Read and manage Blog Studio");
1963
+ const blogPublishing = blog.command("destinations").description("Inspect Blog publishing providers, destinations, and delivery attempts");
1964
+ blogPublishing.command("providers").requiredOption("--project <project-id>", "exact Rolino project ID").action(async (local) => {
1965
+ const global = program.opts();
1966
+ commandExitCode = await execute({ command: "blog destinations providers", global, runtime, async action(context, client) {
1967
+ const data = await client.blog.publishing.providers(local.project, { requestId: context.requestId });
1968
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
1969
+ } });
1970
+ });
1971
+ blogPublishing.command("list").requiredOption("--project <project-id>", "exact Rolino project ID").action(async (local) => {
1972
+ const global = program.opts();
1973
+ commandExitCode = await execute({ command: "blog destinations list", global, runtime, async action(context, client) {
1974
+ const data = await client.blog.publishing.destinations(local.project, { requestId: context.requestId });
1975
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
1976
+ } });
1977
+ });
1978
+ blogPublishing.command("deliveries").requiredOption("--project <project-id>", "exact Rolino project ID").option("--article <article-id>", "filter by exact Blog article ID").action(async (local) => {
1979
+ const global = program.opts();
1980
+ commandExitCode = await execute({ command: "blog destinations deliveries", global, runtime, async action(context, client) {
1981
+ const data = await client.blog.publishing.deliveries(local.project, local.article, { requestId: context.requestId });
1982
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
1983
+ } });
1984
+ });
1985
+ const blogSetup = blog.command("setup").description("Inspect agent-first Blog setup readiness");
1986
+ blogSetup.command("status").requiredOption("--project <project-id>", "exact Rolino project ID").action(async (local) => {
1987
+ const global = program.opts();
1988
+ commandExitCode = await execute({ command: "blog setup status", global, runtime, async action(context, client) {
1989
+ const data = await client.blog.setup.status(local.project, { requestId: context.requestId });
1990
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
1991
+ } });
1992
+ });
1993
+ const blogSite = blog.command("site").description("Initialize or retry the Blog website import");
1994
+ blogSite.command("import").requiredOption("--project <project-id>", "exact Rolino project ID").requiredOption("--idempotency-key <key>", "stable retry key").action(async (local) => {
1995
+ const global = program.opts();
1996
+ commandExitCode = await execute({ command: "blog site import", global, runtime, async action(context, client) {
1997
+ const data = await client.blog.site.import(local.project, local.idempotencyKey, { requestId: context.requestId });
1998
+ writeSuccess(context, data, JSON.stringify(data, null, 2), [`rolino blog job ${data.id} --project ${local.project} --agent`]);
1999
+ } });
2000
+ });
2001
+ blogSite.command("retry").requiredOption("--project <project-id>", "exact Rolino project ID").requiredOption("--idempotency-key <key>", "stable retry key").action(async (local) => {
2002
+ const global = program.opts();
2003
+ commandExitCode = await execute({ command: "blog site retry", global, runtime, async action(context, client) {
2004
+ const data = await client.blog.site.retry(local.project, local.idempotencyKey, { requestId: context.requestId });
2005
+ writeSuccess(context, data, JSON.stringify(data, null, 2), [`rolino blog job ${data.id} --project ${local.project} --agent`]);
2006
+ } });
2007
+ });
2008
+ blog.command("plans").description("List Blog Studio plans").requiredOption("--project <project-id>", "exact Rolino project ID").action(async (local) => {
2009
+ const global = program.opts();
2010
+ commandExitCode = await execute({ command: "blog plans", global, runtime, async action(context, client) {
2011
+ const data = await client.blog.plans.list(local.project, { requestId: context.requestId });
2012
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2013
+ } });
2014
+ });
2015
+ const blogPlan = blog.command("plan").description("Create, retry, and review a Blog cadence plan");
2016
+ 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) => {
2017
+ const weekdayMap = { sun: 0, mon: 1, tue: 2, wed: 3, thu: 4, fri: 5, sat: 6 };
2018
+ const weekdays = local.weekdays.split(",").map((day) => weekdayMap[day.trim().toLowerCase()]).filter((day) => day !== void 0);
2019
+ 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.");
2020
+ const global = program.opts();
2021
+ commandExitCode = await execute({ command: "blog plan create", global, runtime, async action(context, client) {
2022
+ const data = await client.blog.plans.create(local.project, { startsOn: local.start, weekdays, timeZone: local.timeZone }, local.idempotencyKey, { requestId: context.requestId });
2023
+ writeSuccess(context, data, JSON.stringify(data, null, 2), [`rolino blog job ${data.job.id} --project ${local.project} --agent`]);
2024
+ } });
2025
+ });
2026
+ 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) => {
2027
+ const global = program.opts();
2028
+ commandExitCode = await execute({ command: "blog plan retry", global, runtime, async action(context, client) {
2029
+ const data = await client.blog.plans.retry(local.project, local.plan, local.idempotencyKey, { requestId: context.requestId });
2030
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2031
+ } });
2032
+ });
2033
+ blogPlan.command("items").requiredOption("--project <project-id>", "exact Rolino project ID").requiredOption("--plan <plan-id>", "exact Blog plan ID").action(async (local) => {
2034
+ const global = program.opts();
2035
+ commandExitCode = await execute({ command: "blog plan items", global, runtime, async action(context, client) {
2036
+ const data = await client.blog.plans.items.list(local.project, local.plan, { requestId: context.requestId });
2037
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2038
+ } });
2039
+ });
2040
+ const blogPlanItem = blogPlan.command("item").description("Accept or dismiss a reviewed Blog plan item");
2041
+ for (const state of ["accept", "dismiss"]) {
2042
+ 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) => {
2043
+ const global = program.opts();
2044
+ commandExitCode = await execute({ command: `blog plan item ${state}`, global, runtime, async action(context, client) {
2045
+ 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 });
2046
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2047
+ } });
2048
+ });
2049
+ }
2050
+ const blogArticle = blog.command("article").description("Create an editable Blog article from an accepted item");
2051
+ 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) => {
2052
+ const global = program.opts();
2053
+ commandExitCode = await execute({ command: "blog article create", global, runtime, async action(context, client) {
2054
+ 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 });
2055
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2056
+ } });
2057
+ });
2058
+ const blogConnection = blog.command("connection").description("Configure and verify the server-only Next.js Blog connection");
2059
+ blogConnection.command("status").requiredOption("--project <project-id>", "exact Rolino project ID").action(async (local) => {
2060
+ const global = program.opts();
2061
+ commandExitCode = await execute({ command: "blog connection status", global, runtime, async action(context, client) {
2062
+ const data = await client.blog.connection.status(local.project, { requestId: context.requestId });
2063
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2064
+ } });
2065
+ });
2066
+ const addConnectionOptions = (command, execute2) => {
2067
+ 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");
2068
+ 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");
2069
+ return command;
2070
+ };
2071
+ addConnectionOptions(blogConnection.command("preview"), false).action(async (local) => {
2072
+ const input = { endpoint: local.endpoint ?? null, credentialAction: local.credentialAction.toUpperCase(), credentialId: local.credentialId ?? null, secretAction: local.secretAction.toUpperCase() };
2073
+ const global = program.opts();
2074
+ commandExitCode = await execute({ command: "blog connection preview", global, runtime, async action(context, client) {
2075
+ const data = await client.blog.connection.preview(local.project, input, { requestId: context.requestId });
2076
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2077
+ } });
2078
+ });
2079
+ addConnectionOptions(blogConnection.command("execute"), true).action(async (local) => {
2080
+ const input = { endpoint: local.endpoint ?? null, credentialAction: local.credentialAction.toUpperCase(), credentialId: local.credentialId ?? null, secretAction: local.secretAction.toUpperCase() };
2081
+ const global = program.opts();
2082
+ commandExitCode = await execute({ command: "blog connection execute", global, runtime, async action(context, client) {
2083
+ 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.` });
2084
+ const data = await client.blog.connection.execute(local.project, { ...input, confirmationToken: local.confirmationToken, idempotencyKey: local.idempotencyKey }, { requestId: context.requestId });
2085
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2086
+ } });
2087
+ });
2088
+ blogConnection.command("test").requiredOption("--project <project-id>", "exact Rolino project ID").requiredOption("--idempotency-key <key>", "stable retry key").action(async (local) => {
2089
+ const global = program.opts();
2090
+ commandExitCode = await execute({ command: "blog connection test", global, runtime, async action(context, client) {
2091
+ const data = await client.blog.connection.test(local.project, local.idempotencyKey, { requestId: context.requestId });
2092
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2093
+ } });
2094
+ });
2095
+ const blogArticles = blog.command("articles").description("Read and edit Blog Studio articles");
2096
+ blogArticles.command("list").requiredOption("--project <project-id>", "exact Rolino project ID").action(async (local) => {
2097
+ const global = program.opts();
2098
+ commandExitCode = await execute({ command: "blog articles list", global, runtime, async action(context, client) {
2099
+ const data = await client.blog.articles.list(local.project, { requestId: context.requestId });
2100
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2101
+ } });
2102
+ });
2103
+ blogArticles.command("show").argument("<article-id>").requiredOption("--project <project-id>", "exact Rolino project ID").action(async (articleId, local) => {
2104
+ const global = program.opts();
2105
+ commandExitCode = await execute({ command: "blog articles show", global, runtime, async action(context, client) {
2106
+ const data = await client.blog.articles.get(local.project, articleId, { requestId: context.requestId });
2107
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2108
+ } });
2109
+ });
2110
+ 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) => {
2111
+ const global = program.opts();
2112
+ commandExitCode = await execute({ command: "blog articles update", global, runtime, async action(context, client) {
2113
+ const draft = import_contracts2.AgentBlogDraftUpdateSchema.parse(JSON.parse(await (0, import_promises2.readFile)((0, import_node_path2.resolve)(runtime.cwd, local.input), "utf8")));
2114
+ await requireWriteConsent({ yes: local.yes, global, runtime, preview: `Save a new immutable Blog draft revision?
2115
+ Project: ${local.project}
2116
+ Article: ${articleId}
2117
+ This will not publish.` });
2118
+ const data = await client.blog.articles.updateDraft(local.project, articleId, draft, { requestId: context.requestId });
2119
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2120
+ } });
2121
+ });
2122
+ 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) => {
2123
+ const global = program.opts();
2124
+ commandExitCode = await execute({ command: "blog articles generate", global, runtime, async action(context, client) {
2125
+ await requireWriteConsent({ yes: local.yes, global, runtime, preview: `Queue durable Blog article generation?
2126
+ Project: ${local.project}
2127
+ Article: ${articleId}` });
2128
+ const data = await client.blog.articles.generate(local.project, articleId, local.idempotencyKey ?? context.requestId, { requestId: context.requestId });
2129
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2130
+ } });
2131
+ });
2132
+ blog.command("job").argument("<job-id>").requiredOption("--project <project-id>", "exact Rolino project ID").action(async (jobId, local) => {
2133
+ const global = program.opts();
2134
+ commandExitCode = await execute({ command: "blog job", global, runtime, async action(context, client) {
2135
+ const data = await client.blog.jobs.get(local.project, jobId, { requestId: context.requestId });
2136
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2137
+ } });
2138
+ });
2139
+ const blogPublish = blog.command("publish").description("Preview or execute exact approved Blog publication");
2140
+ 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) => {
2141
+ const global = program.opts();
2142
+ commandExitCode = await execute({ command: "blog publish preview", global, runtime, async action(context, client) {
2143
+ const data = await client.blog.articles.previewPublish(local.project, articleId, local.revision, { requestId: context.requestId }, local.destination);
2144
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2145
+ } });
2146
+ });
2147
+ 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) => {
2148
+ const global = program.opts();
2149
+ commandExitCode = await execute({ command: "blog publish execute", global, runtime, async action(context, client) {
2150
+ await requireWriteConsent({ yes: local.yes, global, runtime, preview: `Publish the exact approved Blog revision?
2151
+ Project: ${local.project}
2152
+ Article: ${articleId}
2153
+ Revision: ${local.revision}` });
2154
+ 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 });
2155
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2156
+ } });
2157
+ });
2158
+ const seo = program.command("seo").description("Read authorized SEO opportunities and weekly reports");
2159
+ const seoOpportunities = seo.command("opportunities").description("Read accepted SEO opportunities");
2160
+ seoOpportunities.command("list").description("List bounded SEO opportunities").requiredOption("--project <project-id>", "exact Rolino project ID").option("--limit <number>", "maximum opportunities to return", (value) => {
2161
+ const parsed = Number(value);
2162
+ if (!Number.isInteger(parsed) || parsed < 1 || parsed > 50) {
2163
+ throw new import_commander.InvalidArgumentError("Limit must be an integer from 1 to 50.");
2164
+ }
2165
+ return parsed;
2166
+ }).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) => {
2167
+ const global = program.opts();
2168
+ commandExitCode = await execute({
2169
+ command: "seo opportunities list",
2170
+ global,
2171
+ runtime,
2172
+ async action(context, client) {
2173
+ const data = await client.seo.opportunities.list(local.project, {
2174
+ limit: local.limit,
2175
+ cursor: local.cursor,
2176
+ kind: local.kind,
2177
+ expectedImpact: local.impact
2178
+ }, { requestId: context.requestId });
2179
+ writeSuccess(context, data, formatSeoOpportunities(data), data.items.slice(0, 3).map((item) => `rolino seo opportunities show ${item.id} --project ${local.project} --agent`));
2180
+ }
2181
+ });
2182
+ });
2183
+ 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) => {
2184
+ const global = program.opts();
2185
+ commandExitCode = await execute({
2186
+ command: "seo opportunities show",
2187
+ global,
2188
+ runtime,
2189
+ async action(context, client) {
2190
+ const opportunity = await client.seo.opportunities.get(local.project, opportunityId, { requestId: context.requestId });
2191
+ writeSuccess(context, opportunity, formatSeoOpportunity(opportunity));
2192
+ }
2193
+ });
2194
+ });
2195
+ const seoReports = seo.command("reports").description("Read immutable weekly SEO report snapshots");
2196
+ 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) => {
2197
+ const parsed = Number(value);
2198
+ if (!Number.isInteger(parsed) || parsed < 1 || parsed > 26) {
2199
+ throw new import_commander.InvalidArgumentError("Limit must be an integer from 1 to 26.");
2200
+ }
2201
+ return parsed;
2202
+ }).option("--cursor <cursor>", "continue from an SEO report cursor").option("--status <status>", "filter by COMPLETE or PARTIAL", seoReportCompleteness).action(async (local) => {
2203
+ const global = program.opts();
2204
+ commandExitCode = await execute({
2205
+ command: "seo reports list",
2206
+ global,
2207
+ runtime,
2208
+ async action(context, client) {
2209
+ const data = await client.seo.reports.list(local.project, {
2210
+ limit: local.limit,
2211
+ cursor: local.cursor,
2212
+ completeness: local.status
2213
+ }, { requestId: context.requestId });
2214
+ writeSuccess(context, data, formatSeoReports(data), data.items.slice(0, 3).map((item) => `rolino seo reports show ${item.id} --project ${local.project} --agent`));
2215
+ }
2216
+ });
2217
+ });
2218
+ 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) => {
2219
+ const global = program.opts();
2220
+ commandExitCode = await execute({
2221
+ command: "seo reports show",
2222
+ global,
2223
+ runtime,
2224
+ async action(context, client) {
2225
+ const report = await client.seo.reports.get(local.project, reportId, { requestId: context.requestId });
2226
+ writeSuccess(context, report, formatSeoReport(report));
2227
+ }
2228
+ });
2229
+ });
1881
2230
  program.command("doctor").description("Check configuration, compatibility, and authentication").action(async () => {
1882
2231
  const global = program.opts();
1883
2232
  commandExitCode = await execute({