@rolino/cli 0.3.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/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.3.0",
37
+ version: "0.5.0-beta.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.3.0",
95
- "@rolino/local-auth": "0.3.0",
96
- "@rolino/sdk": "0.3.0",
94
+ "@rolino/contracts": "0.5.0-beta.0",
95
+ "@rolino/local-auth": "0.5.0-beta.0",
96
+ "@rolino/sdk": "0.5.0-beta.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");
@@ -515,7 +515,8 @@ function formatProviderDeliveryOptions(options) {
515
515
  `Checked: ${options.checkedAt}`,
516
516
  `Health: ${options.health.status} (${options.health.code}) ${options.health.message}`,
517
517
  `Post types: ${options.supportedPostTypes.join(", ")}`,
518
- `Images: up to ${options.image.maxItems}; ${options.image.mimeTypes.join(", ")}; under ${options.image.maxPixelsExclusive.toLocaleString()} pixels`
518
+ `Images: up to ${options.image.maxItems}; ${options.image.mimeTypes.join(", ")}; under ${options.image.maxPixelsExclusive.toLocaleString()} pixels`,
519
+ `Video: one ${options.video.mimeTypes.join(", ")}; ${options.video.minDurationMs / 1e3}s to ${options.video.maxDurationMs / 6e4}m; ${options.video.minBytes.toLocaleString()} to ${options.video.maxBytes.toLocaleString()} bytes`
519
520
  ].join("\n");
520
521
  }
521
522
  }
@@ -533,8 +534,14 @@ function formatPostSchedulePreview(preview) {
533
534
  return [
534
535
  `Schedule preview for post ${preview.post.id}`,
535
536
  `Current version: ${preview.post.version}`,
537
+ `Delivery mode: ${preview.deliveryMode}`,
536
538
  `Publish at: ${preview.schedule.scheduledAt} (${preview.schedule.timezone})`,
537
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
+ ] : [],
538
545
  ...preview.providerReconciliation ? [`Provider reconciliation: ${preview.providerReconciliation.message}`] : [],
539
546
  `Confirmation expires: ${preview.confirmation.expiresAt}`,
540
547
  `Confirmation token: ${preview.confirmation.token}`,
@@ -546,9 +553,10 @@ function formatPostPublishPreview(preview) {
546
553
  return [
547
554
  `Immediate publish preview for post ${preview.post.id}`,
548
555
  `Current version: ${preview.post.version}`,
556
+ `Delivery mode: ${preview.deliveryMode}`,
549
557
  `Destinations: ${preview.destinations.join(", ")}`,
550
558
  "Effect: confirmed execution queues these destinations for immediate publishing.",
551
- ...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.`] : [],
552
560
  `Confirmation expires: ${preview.confirmation.expiresAt}`,
553
561
  `Confirmation token: ${preview.confirmation.token}`,
554
562
  ...attention.length ? ["Readiness notes:", ...attention.map((check) => `${check.status.toUpperCase()} ${check.provider ?? "POST"} ${check.code} ${check.message}`)] : ["All required readiness checks passed."]
@@ -561,6 +569,65 @@ function formatCalendarEvents(data) {
561
569
  const rows = data.items.map((event) => `${event.postId} ${event.scheduledAt} ${event.status} ${event.destinations.map((item) => item.provider).join(",") || "-"} ${event.title}`);
562
570
  return ["POST ID SCHEDULED STATUS DESTINATIONS TITLE", ...rows].join("\n");
563
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
+ }
564
631
 
565
632
  // src/mcp-setup.ts
566
633
  var import_node_child_process = require("child_process");
@@ -844,6 +911,21 @@ function postStatus(value) {
844
911
  `Status must be one of ${import_contracts2.PostStatusSchema.options.join(", ")}.`
845
912
  );
846
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
+ }
847
929
  function projectType(value) {
848
930
  const parsed = import_contracts2.ProjectTypeSchema.safeParse(value.toUpperCase());
849
931
  if (parsed.success) return parsed.data;
@@ -1861,6 +1943,274 @@ async function runCli(argv = process.argv, overrides = {}) {
1861
1943
  }
1862
1944
  });
1863
1945
  });
1946
+ const blog = program.command("blog").description("Read and manage Blog Studio");
1947
+ const blogPublishing = blog.command("destinations").description("Inspect Blog publishing providers, destinations, and delivery attempts");
1948
+ blogPublishing.command("providers").requiredOption("--project <project-id>", "exact Rolino project ID").action(async (local) => {
1949
+ const global = program.opts();
1950
+ commandExitCode = await execute({ command: "blog destinations providers", global, runtime, async action(context, client) {
1951
+ const data = await client.blog.publishing.providers(local.project, { requestId: context.requestId });
1952
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
1953
+ } });
1954
+ });
1955
+ blogPublishing.command("list").requiredOption("--project <project-id>", "exact Rolino project ID").action(async (local) => {
1956
+ const global = program.opts();
1957
+ commandExitCode = await execute({ command: "blog destinations list", global, runtime, async action(context, client) {
1958
+ const data = await client.blog.publishing.destinations(local.project, { requestId: context.requestId });
1959
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
1960
+ } });
1961
+ });
1962
+ blogPublishing.command("deliveries").requiredOption("--project <project-id>", "exact Rolino project ID").option("--article <article-id>", "filter by exact Blog article ID").action(async (local) => {
1963
+ const global = program.opts();
1964
+ commandExitCode = await execute({ command: "blog destinations deliveries", global, runtime, async action(context, client) {
1965
+ const data = await client.blog.publishing.deliveries(local.project, local.article, { requestId: context.requestId });
1966
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
1967
+ } });
1968
+ });
1969
+ const blogSetup = blog.command("setup").description("Inspect agent-first Blog setup readiness");
1970
+ blogSetup.command("status").requiredOption("--project <project-id>", "exact Rolino project ID").action(async (local) => {
1971
+ const global = program.opts();
1972
+ commandExitCode = await execute({ command: "blog setup status", global, runtime, async action(context, client) {
1973
+ const data = await client.blog.setup.status(local.project, { requestId: context.requestId });
1974
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
1975
+ } });
1976
+ });
1977
+ const blogSite = blog.command("site").description("Initialize or retry the Blog website import");
1978
+ blogSite.command("import").requiredOption("--project <project-id>", "exact Rolino project ID").requiredOption("--idempotency-key <key>", "stable retry key").action(async (local) => {
1979
+ const global = program.opts();
1980
+ commandExitCode = await execute({ command: "blog site import", global, runtime, async action(context, client) {
1981
+ const data = await client.blog.site.import(local.project, local.idempotencyKey, { requestId: context.requestId });
1982
+ writeSuccess(context, data, JSON.stringify(data, null, 2), [`rolino blog job ${data.id} --project ${local.project} --agent`]);
1983
+ } });
1984
+ });
1985
+ blogSite.command("retry").requiredOption("--project <project-id>", "exact Rolino project ID").requiredOption("--idempotency-key <key>", "stable retry key").action(async (local) => {
1986
+ const global = program.opts();
1987
+ commandExitCode = await execute({ command: "blog site retry", global, runtime, async action(context, client) {
1988
+ const data = await client.blog.site.retry(local.project, local.idempotencyKey, { requestId: context.requestId });
1989
+ writeSuccess(context, data, JSON.stringify(data, null, 2), [`rolino blog job ${data.id} --project ${local.project} --agent`]);
1990
+ } });
1991
+ });
1992
+ blog.command("plans").description("List Blog Studio plans").requiredOption("--project <project-id>", "exact Rolino project ID").action(async (local) => {
1993
+ const global = program.opts();
1994
+ commandExitCode = await execute({ command: "blog plans", global, runtime, async action(context, client) {
1995
+ const data = await client.blog.plans.list(local.project, { requestId: context.requestId });
1996
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
1997
+ } });
1998
+ });
1999
+ const blogPlan = blog.command("plan").description("Create, retry, and review a Blog cadence plan");
2000
+ 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) => {
2001
+ const weekdayMap = { sun: 0, mon: 1, tue: 2, wed: 3, thu: 4, fri: 5, sat: 6 };
2002
+ const weekdays = local.weekdays.split(",").map((day) => weekdayMap[day.trim().toLowerCase()]).filter((day) => day !== void 0);
2003
+ 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.");
2004
+ const global = program.opts();
2005
+ commandExitCode = await execute({ command: "blog plan create", global, runtime, async action(context, client) {
2006
+ const data = await client.blog.plans.create(local.project, { startsOn: local.start, weekdays, timeZone: local.timeZone }, local.idempotencyKey, { requestId: context.requestId });
2007
+ writeSuccess(context, data, JSON.stringify(data, null, 2), [`rolino blog job ${data.job.id} --project ${local.project} --agent`]);
2008
+ } });
2009
+ });
2010
+ 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) => {
2011
+ const global = program.opts();
2012
+ commandExitCode = await execute({ command: "blog plan retry", global, runtime, async action(context, client) {
2013
+ const data = await client.blog.plans.retry(local.project, local.plan, local.idempotencyKey, { requestId: context.requestId });
2014
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2015
+ } });
2016
+ });
2017
+ blogPlan.command("items").requiredOption("--project <project-id>", "exact Rolino project ID").requiredOption("--plan <plan-id>", "exact Blog plan ID").action(async (local) => {
2018
+ const global = program.opts();
2019
+ commandExitCode = await execute({ command: "blog plan items", global, runtime, async action(context, client) {
2020
+ const data = await client.blog.plans.items.list(local.project, local.plan, { requestId: context.requestId });
2021
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2022
+ } });
2023
+ });
2024
+ const blogPlanItem = blogPlan.command("item").description("Accept or dismiss a reviewed Blog plan item");
2025
+ for (const state of ["accept", "dismiss"]) {
2026
+ 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) => {
2027
+ const global = program.opts();
2028
+ commandExitCode = await execute({ command: `blog plan item ${state}`, global, runtime, async action(context, client) {
2029
+ 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 });
2030
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2031
+ } });
2032
+ });
2033
+ }
2034
+ const blogArticle = blog.command("article").description("Create an editable Blog article from an accepted item");
2035
+ 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) => {
2036
+ const global = program.opts();
2037
+ commandExitCode = await execute({ command: "blog article create", global, runtime, async action(context, client) {
2038
+ 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 });
2039
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2040
+ } });
2041
+ });
2042
+ const blogConnection = blog.command("connection").description("Configure and verify the server-only Next.js Blog connection");
2043
+ blogConnection.command("status").requiredOption("--project <project-id>", "exact Rolino project ID").action(async (local) => {
2044
+ const global = program.opts();
2045
+ commandExitCode = await execute({ command: "blog connection status", global, runtime, async action(context, client) {
2046
+ const data = await client.blog.connection.status(local.project, { requestId: context.requestId });
2047
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2048
+ } });
2049
+ });
2050
+ const addConnectionOptions = (command, execute2) => {
2051
+ 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");
2052
+ 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");
2053
+ return command;
2054
+ };
2055
+ addConnectionOptions(blogConnection.command("preview"), false).action(async (local) => {
2056
+ const input = { endpoint: local.endpoint ?? null, credentialAction: local.credentialAction.toUpperCase(), credentialId: local.credentialId ?? null, secretAction: local.secretAction.toUpperCase() };
2057
+ const global = program.opts();
2058
+ commandExitCode = await execute({ command: "blog connection preview", global, runtime, async action(context, client) {
2059
+ const data = await client.blog.connection.preview(local.project, input, { requestId: context.requestId });
2060
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2061
+ } });
2062
+ });
2063
+ addConnectionOptions(blogConnection.command("execute"), true).action(async (local) => {
2064
+ const input = { endpoint: local.endpoint ?? null, credentialAction: local.credentialAction.toUpperCase(), credentialId: local.credentialId ?? null, secretAction: local.secretAction.toUpperCase() };
2065
+ const global = program.opts();
2066
+ commandExitCode = await execute({ command: "blog connection execute", global, runtime, async action(context, client) {
2067
+ 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.` });
2068
+ const data = await client.blog.connection.execute(local.project, { ...input, confirmationToken: local.confirmationToken, idempotencyKey: local.idempotencyKey }, { requestId: context.requestId });
2069
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2070
+ } });
2071
+ });
2072
+ blogConnection.command("test").requiredOption("--project <project-id>", "exact Rolino project ID").requiredOption("--idempotency-key <key>", "stable retry key").action(async (local) => {
2073
+ const global = program.opts();
2074
+ commandExitCode = await execute({ command: "blog connection test", global, runtime, async action(context, client) {
2075
+ const data = await client.blog.connection.test(local.project, local.idempotencyKey, { requestId: context.requestId });
2076
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2077
+ } });
2078
+ });
2079
+ const blogArticles = blog.command("articles").description("Read and edit Blog Studio articles");
2080
+ blogArticles.command("list").requiredOption("--project <project-id>", "exact Rolino project ID").action(async (local) => {
2081
+ const global = program.opts();
2082
+ commandExitCode = await execute({ command: "blog articles list", global, runtime, async action(context, client) {
2083
+ const data = await client.blog.articles.list(local.project, { requestId: context.requestId });
2084
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2085
+ } });
2086
+ });
2087
+ blogArticles.command("show").argument("<article-id>").requiredOption("--project <project-id>", "exact Rolino project ID").action(async (articleId, local) => {
2088
+ const global = program.opts();
2089
+ commandExitCode = await execute({ command: "blog articles show", global, runtime, async action(context, client) {
2090
+ const data = await client.blog.articles.get(local.project, articleId, { requestId: context.requestId });
2091
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2092
+ } });
2093
+ });
2094
+ 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) => {
2095
+ const global = program.opts();
2096
+ commandExitCode = await execute({ command: "blog articles update", global, runtime, async action(context, client) {
2097
+ const draft = import_contracts2.AgentBlogDraftUpdateSchema.parse(JSON.parse(await (0, import_promises2.readFile)((0, import_node_path2.resolve)(runtime.cwd, local.input), "utf8")));
2098
+ await requireWriteConsent({ yes: local.yes, global, runtime, preview: `Save a new immutable Blog draft revision?
2099
+ Project: ${local.project}
2100
+ Article: ${articleId}
2101
+ This will not publish.` });
2102
+ const data = await client.blog.articles.updateDraft(local.project, articleId, draft, { requestId: context.requestId });
2103
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2104
+ } });
2105
+ });
2106
+ 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) => {
2107
+ const global = program.opts();
2108
+ commandExitCode = await execute({ command: "blog articles generate", global, runtime, async action(context, client) {
2109
+ await requireWriteConsent({ yes: local.yes, global, runtime, preview: `Queue durable Blog article generation?
2110
+ Project: ${local.project}
2111
+ Article: ${articleId}` });
2112
+ const data = await client.blog.articles.generate(local.project, articleId, local.idempotencyKey ?? context.requestId, { requestId: context.requestId });
2113
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2114
+ } });
2115
+ });
2116
+ blog.command("job").argument("<job-id>").requiredOption("--project <project-id>", "exact Rolino project ID").action(async (jobId, local) => {
2117
+ const global = program.opts();
2118
+ commandExitCode = await execute({ command: "blog job", global, runtime, async action(context, client) {
2119
+ const data = await client.blog.jobs.get(local.project, jobId, { requestId: context.requestId });
2120
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2121
+ } });
2122
+ });
2123
+ const blogPublish = blog.command("publish").description("Preview or execute exact approved Blog publication");
2124
+ 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) => {
2125
+ const global = program.opts();
2126
+ commandExitCode = await execute({ command: "blog publish preview", global, runtime, async action(context, client) {
2127
+ const data = await client.blog.articles.previewPublish(local.project, articleId, local.revision, { requestId: context.requestId }, local.destination);
2128
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2129
+ } });
2130
+ });
2131
+ 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) => {
2132
+ const global = program.opts();
2133
+ commandExitCode = await execute({ command: "blog publish execute", global, runtime, async action(context, client) {
2134
+ await requireWriteConsent({ yes: local.yes, global, runtime, preview: `Publish the exact approved Blog revision?
2135
+ Project: ${local.project}
2136
+ Article: ${articleId}
2137
+ Revision: ${local.revision}` });
2138
+ 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 });
2139
+ writeSuccess(context, data, JSON.stringify(data, null, 2));
2140
+ } });
2141
+ });
2142
+ const seo = program.command("seo").description("Read authorized SEO opportunities and weekly reports");
2143
+ const seoOpportunities = seo.command("opportunities").description("Read accepted SEO opportunities");
2144
+ seoOpportunities.command("list").description("List bounded SEO opportunities").requiredOption("--project <project-id>", "exact Rolino project ID").option("--limit <number>", "maximum opportunities to return", (value) => {
2145
+ const parsed = Number(value);
2146
+ if (!Number.isInteger(parsed) || parsed < 1 || parsed > 50) {
2147
+ throw new import_commander.InvalidArgumentError("Limit must be an integer from 1 to 50.");
2148
+ }
2149
+ return parsed;
2150
+ }).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) => {
2151
+ const global = program.opts();
2152
+ commandExitCode = await execute({
2153
+ command: "seo opportunities list",
2154
+ global,
2155
+ runtime,
2156
+ async action(context, client) {
2157
+ const data = await client.seo.opportunities.list(local.project, {
2158
+ limit: local.limit,
2159
+ cursor: local.cursor,
2160
+ kind: local.kind,
2161
+ expectedImpact: local.impact
2162
+ }, { requestId: context.requestId });
2163
+ writeSuccess(context, data, formatSeoOpportunities(data), data.items.slice(0, 3).map((item) => `rolino seo opportunities show ${item.id} --project ${local.project} --agent`));
2164
+ }
2165
+ });
2166
+ });
2167
+ 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) => {
2168
+ const global = program.opts();
2169
+ commandExitCode = await execute({
2170
+ command: "seo opportunities show",
2171
+ global,
2172
+ runtime,
2173
+ async action(context, client) {
2174
+ const opportunity = await client.seo.opportunities.get(local.project, opportunityId, { requestId: context.requestId });
2175
+ writeSuccess(context, opportunity, formatSeoOpportunity(opportunity));
2176
+ }
2177
+ });
2178
+ });
2179
+ const seoReports = seo.command("reports").description("Read immutable weekly SEO report snapshots");
2180
+ 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) => {
2181
+ const parsed = Number(value);
2182
+ if (!Number.isInteger(parsed) || parsed < 1 || parsed > 26) {
2183
+ throw new import_commander.InvalidArgumentError("Limit must be an integer from 1 to 26.");
2184
+ }
2185
+ return parsed;
2186
+ }).option("--cursor <cursor>", "continue from an SEO report cursor").option("--status <status>", "filter by COMPLETE or PARTIAL", seoReportCompleteness).action(async (local) => {
2187
+ const global = program.opts();
2188
+ commandExitCode = await execute({
2189
+ command: "seo reports list",
2190
+ global,
2191
+ runtime,
2192
+ async action(context, client) {
2193
+ const data = await client.seo.reports.list(local.project, {
2194
+ limit: local.limit,
2195
+ cursor: local.cursor,
2196
+ completeness: local.status
2197
+ }, { requestId: context.requestId });
2198
+ writeSuccess(context, data, formatSeoReports(data), data.items.slice(0, 3).map((item) => `rolino seo reports show ${item.id} --project ${local.project} --agent`));
2199
+ }
2200
+ });
2201
+ });
2202
+ 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) => {
2203
+ const global = program.opts();
2204
+ commandExitCode = await execute({
2205
+ command: "seo reports show",
2206
+ global,
2207
+ runtime,
2208
+ async action(context, client) {
2209
+ const report = await client.seo.reports.get(local.project, reportId, { requestId: context.requestId });
2210
+ writeSuccess(context, report, formatSeoReport(report));
2211
+ }
2212
+ });
2213
+ });
1864
2214
  program.command("doctor").description("Check configuration, compatibility, and authentication").action(async () => {
1865
2215
  const global = program.opts();
1866
2216
  commandExitCode = await execute({