@clickminded/coauthor-cli 0.0.30 → 0.0.32

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/client.d.ts CHANGED
@@ -24,8 +24,8 @@ export declare class AgentClient {
24
24
  constructor(options: AgentClientOptions);
25
25
  request(options: RequestOptions): Promise<JsonValue>;
26
26
  /**
27
- * Fetches a public file (for example a rendered MP4 on the CDN) as bytes.
28
- * Sends no Authorization header: the URL is not an agent API endpoint.
27
+ * Fetches a public file (a rendered MP4 or slide PNG on the CDN) as bytes.
28
+ * Sends no Authorization header: these URLs are not on the CoAuthor API.
29
29
  */
30
30
  download(url: string): Promise<Uint8Array>;
31
31
  }
package/dist/client.js CHANGED
@@ -58,13 +58,16 @@ export class AgentClient {
58
58
  return parsedBody;
59
59
  }
60
60
  /**
61
- * Fetches a public file (for example a rendered MP4 on the CDN) as bytes.
62
- * Sends no Authorization header: the URL is not an agent API endpoint.
61
+ * Fetches a public file (a rendered MP4 or slide PNG on the CDN) as bytes.
62
+ * Sends no Authorization header: these URLs are not on the CoAuthor API.
63
63
  */
64
64
  async download(url) {
65
- const response = await this.fetchImpl(url, { method: 'GET' });
65
+ const target = new URL(url);
66
+ if (target.protocol !== 'https:' && target.protocol !== 'http:')
67
+ throw new Error(`Refusing to download a non-http URL: ${url}`);
68
+ const response = await this.fetchImpl(target, { method: 'GET' });
66
69
  if (!response.ok)
67
- throw new Error(`Download failed with HTTP ${response.status} for ${url}`);
70
+ throw new Error(`Download failed with HTTP ${response.status}: ${url}`);
68
71
  return new Uint8Array(await response.arrayBuffer());
69
72
  }
70
73
  }
@@ -9,5 +9,10 @@ export type CommandContext = {
9
9
  token: string;
10
10
  };
11
11
  export declare function runCommand(input: ParsedCommand, context: CommandContext): Promise<CommandResult>;
12
+ /**
13
+ * `--cta save,follow,custom:Join the webinar` -> the web app's cta_variants
14
+ * list (at most 4 endings, at most one custom).
15
+ */
16
+ export declare function parseSlideshowCtaOption(raw: string): JsonValue[];
12
17
  export declare function creditsExhaustedPauseResult(projectId: string, target: 'research' | 'draft', message: string, data: JsonValue): CommandResult;
13
18
  export declare function helpResult(command?: string[]): CommandResult;
package/dist/commands.js CHANGED
@@ -595,10 +595,16 @@ async function runDraftReviseCommand(projectId, input, context) {
595
595
  const applied = await applyRevision(context.client, projectId, revisionId, input);
596
596
  return { ok: true, message: `Applied revision ${revisionId}.`, data: { revision, applied } };
597
597
  }
598
+ // The user's editor is blocked while the revision waits, so CoAuthor
599
+ // discards an unreviewed agent revision after a deadline.
600
+ const expiresIn = getResponseValue(revision, 'expires_in_seconds');
601
+ const deadline = typeof expiresIn === 'number'
602
+ ? ` It is discarded automatically if not applied within ${Math.max(1, Math.ceil(expiresIn / 60))} minutes.`
603
+ : '';
598
604
  return {
599
605
  ok: true,
600
606
  status: 'awaiting_review',
601
- message: `Revision ${revisionId} is ready to review. Apply with: coauthor draft revision apply ${projectId} ${revisionId} (or --accept/--reject <group ids>), or discard it.`,
607
+ message: `Revision ${revisionId} is ready to review. Apply with: coauthor draft revision apply ${projectId} ${revisionId} (or --accept/--reject <group ids>), or discard it.${deadline}`,
602
608
  data: revision,
603
609
  };
604
610
  }
@@ -1488,6 +1494,52 @@ async function runLogCommand(action, input, client) {
1488
1494
  }
1489
1495
  const REPURPOSE_FORMATS = ['x-thread', 'x-post', 'linkedin', 'facebook', 'email', 'slideshow', 'video'];
1490
1496
  const REPURPOSE_GENERATABLE = ['x-thread', 'x-post', 'linkedin', 'facebook', 'email'];
1497
+ const SLIDESHOW_FORMAT_ALIASES = ['slideshow', 'carousel'];
1498
+ // Labels match the web app's CTA picker.
1499
+ const SLIDESHOW_CTA_LABELS = {
1500
+ save: 'Save post',
1501
+ follow: 'Follow account',
1502
+ comment: 'Leave a comment',
1503
+ share: 'Share with others',
1504
+ read_more: 'Read the full article',
1505
+ };
1506
+ /**
1507
+ * `--cta save,follow,custom:Join the webinar` -> the web app's cta_variants
1508
+ * list (at most 4 endings, at most one custom).
1509
+ */
1510
+ export function parseSlideshowCtaOption(raw) {
1511
+ const entries = raw.split(',').map((entry) => entry.trim()).filter(Boolean);
1512
+ if (entries.length === 0)
1513
+ throw new Error('--cta needs at least one of: save, follow, comment, share, read_more, custom:<text>');
1514
+ const intents = [];
1515
+ const seen = new Set();
1516
+ let customCount = 0;
1517
+ for (const entry of entries) {
1518
+ const customMatch = /^custom\s*:\s*(.+)$/i.exec(entry);
1519
+ if (customMatch) {
1520
+ customCount += 1;
1521
+ if (customCount > 1)
1522
+ throw new Error('--cta allows at most one custom ending (custom:<text>).');
1523
+ const text = customMatch[1].trim().slice(0, 120);
1524
+ intents.push({ id: 'custom-0', type: 'custom', label: text, custom_text: text });
1525
+ continue;
1526
+ }
1527
+ const type = entry.toLowerCase().replace(/[\s-]+/g, '_');
1528
+ const label = SLIDESHOW_CTA_LABELS[type];
1529
+ if (!label)
1530
+ throw new Error(`Unknown --cta "${entry}". Use save, follow, comment, share, read_more, or custom:<text>.`);
1531
+ if (seen.has(type))
1532
+ continue;
1533
+ seen.add(type);
1534
+ intents.push({ id: type, type, label, custom_text: null });
1535
+ }
1536
+ if (intents.length > 4)
1537
+ throw new Error('--cta allows at most 4 endings.');
1538
+ return intents;
1539
+ }
1540
+ function isSlideshowFormat(format) {
1541
+ return Boolean(format && SLIDESHOW_FORMAT_ALIASES.includes(format.trim().toLowerCase()));
1542
+ }
1491
1543
  async function runRepurposeCommand(action, input, client) {
1492
1544
  const projectId = requireProjectId(input);
1493
1545
  const base = `projects/${encodeURIComponent(projectId)}/repurpose`;
@@ -1501,12 +1553,14 @@ async function runRepurposeCommand(action, input, client) {
1501
1553
  }
1502
1554
  if (action === 'generate') {
1503
1555
  if (!format)
1504
- throw new Error(`Usage: coauthor repurpose generate <project-id> --format <${[...REPURPOSE_GENERATABLE, 'video'].join('|')}|all> [--writing-model <id>] [--cta save,follow]`);
1556
+ throw new Error(`Usage: coauthor repurpose generate <project-id> --format <${[...REPURPOSE_GENERATABLE, 'slideshow', 'video'].join('|')}|all> [--writing-model <id>] [--cta save,follow]`);
1557
+ if (isSlideshowFormat(format))
1558
+ return generateSlideshow(projectId, base, input, client);
1505
1559
  const formats = format === 'all' ? REPURPOSE_GENERATABLE : [format];
1506
1560
  const writingModel = getString(input.values, 'writing-model');
1507
1561
  const cta = getString(input.values, 'cta');
1508
1562
  if (cta !== undefined && format !== 'video')
1509
- throw new Error('--cta only applies to --format video.');
1563
+ throw new Error('--cta only applies to --format video or slideshow.');
1510
1564
  const results = {};
1511
1565
  for (const entry of formats) {
1512
1566
  results[entry] = await client.request({
@@ -1541,18 +1595,21 @@ async function runRepurposeCommand(action, input, client) {
1541
1595
  };
1542
1596
  }
1543
1597
  if (action === 'status') {
1598
+ if (isSlideshowFormat(format))
1599
+ return slideshowStatus(projectId, base, getBoolean(input.values, 'wait'), client);
1544
1600
  if (format !== 'video')
1545
- throw new Error('Usage: coauthor repurpose status <project-id> --format video [--wait]');
1601
+ throw new Error('Usage: coauthor repurpose status <project-id> --format <slideshow|video> [--wait]');
1546
1602
  return videoStatus(client, base, getBoolean(input.values, 'wait'));
1547
1603
  }
1548
1604
  if (action === 'render') {
1549
1605
  if (format !== 'video')
1550
- throw new Error('Usage: coauthor repurpose render <project-id> --format video [--variant <id>] [--wait]');
1606
+ throw new Error('Usage: coauthor repurpose render <project-id> --format video [--variant <id>] [--wait] (slideshow PNGs are rendered by repurpose download)');
1551
1607
  return videoRender(client, projectId, base, getString(input.values, 'variant'), getBoolean(input.values, 'wait'));
1552
1608
  }
1553
- if (action === 'download')
1554
- return downloadRepurposed(projectId, format ?? 'all', getString(input.values, 'out'), client, getString(input.values, 'variant'));
1555
- throw new Error('Usage: coauthor repurpose <list|show|generate|save|download|status|render> <project-id> --format <format>');
1609
+ if (action === 'download') {
1610
+ return downloadRepurposed(projectId, isSlideshowFormat(format) ? 'slideshow' : format ?? 'all', getString(input.values, 'out'), client, getString(input.values, 'variant'));
1611
+ }
1612
+ throw new Error('Usage: coauthor repurpose <list|show|generate|save|status|render|download> <project-id> --format <format>');
1556
1613
  }
1557
1614
  /** "save,follow,custom:Reply with a question" -> ["save","follow","custom:Reply with a question"]. */
1558
1615
  function parseCtaList(value) {
@@ -1604,6 +1661,26 @@ async function videoStatus(client, base, wait) {
1604
1661
  data,
1605
1662
  };
1606
1663
  }
1664
+ async function generateSlideshow(projectId, base, input, client) {
1665
+ const cta = getString(input.values, 'cta');
1666
+ const writingModel = getString(input.values, 'writing-model');
1667
+ const body = {};
1668
+ if (cta !== undefined)
1669
+ body.cta_variants = parseSlideshowCtaOption(cta);
1670
+ if (writingModel)
1671
+ body.writingModel = writingModel;
1672
+ const data = await client.request({ method: 'POST', path: `${base}/slideshow/generate`, body });
1673
+ const total = extractNestedNumber(data, ['panels', 'total']);
1674
+ return {
1675
+ ok: true,
1676
+ message: [
1677
+ `Generated the slideshow text${total !== undefined ? ` and queued ${total} panel image${total === 1 ? '' : 's'}` : ''}.`,
1678
+ `Wait for the images with: coauthor repurpose status ${projectId} --format slideshow --wait`,
1679
+ `Then save the PNGs with: coauthor repurpose download ${projectId} --format slideshow`,
1680
+ ].join('\n'),
1681
+ data,
1682
+ };
1683
+ }
1607
1684
  async function videoRender(client, projectId, base, variant, wait) {
1608
1685
  const deadline = Date.now() + waitTimeoutMs(9 * 60_000);
1609
1686
  if (wait) {
@@ -1670,6 +1747,86 @@ async function downloadVideoRenders(client, shown, outDir, variant) {
1670
1747
  }
1671
1748
  return { files, pending };
1672
1749
  }
1750
+ function slideshowCounts(data) {
1751
+ const read = (key) => {
1752
+ const value = getResponseValue(data, key);
1753
+ return typeof value === 'number' ? value : 0;
1754
+ };
1755
+ return { total: read('total'), ready: read('ready'), generating: read('generating'), failed: read('failed') };
1756
+ }
1757
+ // Polls panel image status until nothing is generating, capped under the
1758
+ // 10-minute agent shell limit (resumable still_running on timeout).
1759
+ async function slideshowStatus(projectId, base, wait, client) {
1760
+ const statusPath = `${base}/slideshow/status`;
1761
+ let data = await client.request({ path: statusPath });
1762
+ if (wait) {
1763
+ const deadline = Date.now() + waitTimeoutMs(9 * 60_000);
1764
+ const pollMs = Math.max(waitPollMs(), 0);
1765
+ while (slideshowCounts(data).generating > 0 && Date.now() < deadline) {
1766
+ await sleep(Math.min(pollMs, 15_000));
1767
+ data = await client.request({ path: statusPath });
1768
+ }
1769
+ }
1770
+ const counts = slideshowCounts(data);
1771
+ const stillRunning = wait && counts.generating > 0;
1772
+ const nextStep = counts.generating > 0
1773
+ ? ` Check again with: coauthor repurpose status ${projectId} --format slideshow --wait`
1774
+ : counts.failed > 0
1775
+ ? ' Retry the failed panels in the web app (Promote > Slideshow) or with coauthor image generate, then download.'
1776
+ : ` Save the PNGs with: coauthor repurpose download ${projectId} --format slideshow`;
1777
+ return {
1778
+ ok: counts.failed === 0 && !stillRunning,
1779
+ status: stillRunning ? 'still_running' : undefined,
1780
+ exitCode: stillRunning ? 2 : undefined,
1781
+ resume_command: stillRunning ? `coauthor repurpose status ${projectId} --format slideshow --wait` : undefined,
1782
+ message: `Slideshow images: ${counts.ready}/${counts.total} ready, ${counts.failed} failed, ${counts.generating} still generating.${nextStep}`,
1783
+ data,
1784
+ };
1785
+ }
1786
+ /** Path-safe folder for a CTA variant id (same rule the worker uses for its R2 keys). */
1787
+ function slideshowVariantFolder(variant) {
1788
+ return variant.trim().toLowerCase().replace(/[^a-z0-9_-]+/g, '-').replace(/^-+|-+$/g, '') || 'variant';
1789
+ }
1790
+ /**
1791
+ * Renders the slideshow on the server and saves the PNGs as
1792
+ * <outDir>/slideshow/<variant>/slide-NN.png. Returns the relative paths written.
1793
+ */
1794
+ async function downloadSlideshowPngs(projectId, outDir, client, variant) {
1795
+ const rendered = await client.request({
1796
+ method: 'POST',
1797
+ path: `projects/${encodeURIComponent(projectId)}/repurpose/slideshow/render`,
1798
+ body: variant ? { variant } : {},
1799
+ });
1800
+ const variants = getResponseValue(rendered, 'variants');
1801
+ const files = [];
1802
+ const byVariant = {};
1803
+ for (const entry of Array.isArray(variants) ? variants : []) {
1804
+ const name = getResponseString(entry, 'variant');
1805
+ const slides = getResponseValue(entry, 'slides');
1806
+ if (!name || !Array.isArray(slides))
1807
+ continue;
1808
+ const folder = join('slideshow', slideshowVariantFolder(name));
1809
+ await mkdir(join(outDir, folder), { recursive: true });
1810
+ const written = [];
1811
+ for (const slide of slides) {
1812
+ const url = getResponseString(slide, 'url');
1813
+ const index = getResponseValue(slide, 'index');
1814
+ if (!url || typeof index !== 'number')
1815
+ continue;
1816
+ const relative = join(folder, `slide-${String(index).padStart(2, '0')}.png`);
1817
+ await writeFile(join(outDir, relative), await client.download(url));
1818
+ written.push(relative);
1819
+ }
1820
+ files.push(...written);
1821
+ byVariant[name] = written;
1822
+ }
1823
+ return {
1824
+ files,
1825
+ render_hash: getResponseString(rendered, 'render_hash') ?? null,
1826
+ stale: Boolean(getResponseValue(rendered, 'stale')),
1827
+ variants: byVariant,
1828
+ };
1829
+ }
1673
1830
  async function downloadRepurposed(projectId, format, outOption, client, variant) {
1674
1831
  const outDir = resolve(outOption ?? `coauthor-${projectId.slice(0, 8)}`);
1675
1832
  await mkdir(outDir, { recursive: true });
@@ -1692,6 +1849,7 @@ async function downloadRepurposed(projectId, format, outOption, client, variant)
1692
1849
  const manifest = {};
1693
1850
  const missingLink = [];
1694
1851
  let noVideoFile = false;
1852
+ const notReady = [];
1695
1853
  for (const entry of formats) {
1696
1854
  const shown = await client.request({ path: `projects/${encodeURIComponent(projectId)}/repurpose/${encodeURIComponent(entry)}` });
1697
1855
  const artifact = getResponseValue(shown, 'artifact');
@@ -1714,6 +1872,25 @@ async function downloadRepurposed(projectId, format, outOption, client, variant)
1714
1872
  noVideoFile = true;
1715
1873
  continue;
1716
1874
  }
1875
+ if (entry === 'slideshow' && artifact) {
1876
+ const panelsReady = extractNestedBoolean(shown, ['panels', 'all_ready']);
1877
+ // --format all skips a slideshow whose images are unfinished; an explicit
1878
+ // --format slideshow asks the server, which explains what is missing.
1879
+ if (format === 'all' && panelsReady !== true) {
1880
+ notReady.push(entry);
1881
+ continue;
1882
+ }
1883
+ const slideshow = await downloadSlideshowPngs(projectId, outDir, client, variant);
1884
+ written.push(...slideshow.files);
1885
+ await write('slideshow.json', JSON.stringify(artifact, null, 2));
1886
+ manifest[entry] = {
1887
+ stale: slideshow.stale || Boolean(getResponseValue(artifact, 'stale_at')),
1888
+ updated_at: getResponseValue(artifact, 'updated_at') ?? null,
1889
+ render_hash: slideshow.render_hash,
1890
+ variants: slideshow.variants,
1891
+ };
1892
+ continue;
1893
+ }
1717
1894
  if (!artifact || !copy) {
1718
1895
  skipped.push(entry);
1719
1896
  continue;
@@ -1728,20 +1905,21 @@ async function downloadRepurposed(projectId, format, outOption, client, variant)
1728
1905
  updated_at: getResponseValue(artifact, 'updated_at') ?? null,
1729
1906
  };
1730
1907
  }
1731
- await write('manifest.json', JSON.stringify({ project_id: projectId, downloaded_at: new Date().toISOString(), formats: manifest, skipped, missing_article_link: missingLink }, null, 2));
1908
+ await write('manifest.json', JSON.stringify({ project_id: projectId, downloaded_at: new Date().toISOString(), formats: manifest, skipped, not_ready: notReady, missing_article_link: missingLink }, null, 2));
1732
1909
  const staleNote = Object.entries(manifest).filter(([, value]) => value.stale).map(([key]) => key);
1733
1910
  return {
1734
1911
  ok: true,
1735
1912
  message: [
1736
1913
  `Wrote ${written.length} files to ${outDir}`,
1737
- skipped.length > 0 ? `Not generated yet: ${skipped.join(', ')} (coauthor repurpose generate ${projectId} --format <format>; slideshows are made in the web app).` : '',
1914
+ skipped.length > 0 ? `Not generated yet: ${skipped.join(', ')} (coauthor repurpose generate ${projectId} --format <format>).` : '',
1738
1915
  noVideoFile ? `The video has no finished render yet: coauthor repurpose render ${projectId} --format video --wait, then download again.` : '',
1916
+ notReady.length > 0 ? `Skipped the slideshow: its images are not all ready. Run coauthor repurpose status ${projectId} --format slideshow --wait, then download again.` : '',
1739
1917
  staleNote.length > 0 ? `Stale (the draft changed since they were made): ${staleNote.join(', ')}. Regenerate them before posting.` : '',
1740
1918
  missingLink.length > 0
1741
1919
  ? `No article link yet: ${missingLink.join(', ')} still contain {{POST_URL}}. Set it with coauthor repurpose save ${projectId} --format <format> --data '{"destination_url":"https://..."}' and download again, or replace it when posting.`
1742
1920
  : '',
1743
1921
  ].filter(Boolean).join('\n'),
1744
- data: { out_dir: outDir, files: written, skipped },
1922
+ data: { out_dir: outDir, files: written, skipped, not_ready: notReady },
1745
1923
  };
1746
1924
  }
1747
1925
  function renderRepurposeMarkdown(format, copy) {
@@ -1943,6 +2121,14 @@ function extractNestedString(value, path) {
1943
2121
  const current = extractNestedValue(value, path);
1944
2122
  return typeof current === 'string' ? current : undefined;
1945
2123
  }
2124
+ function extractNestedNumber(value, path) {
2125
+ const current = extractNestedValue(value, path);
2126
+ return typeof current === 'number' && Number.isFinite(current) ? current : undefined;
2127
+ }
2128
+ function extractNestedBoolean(value, path) {
2129
+ const current = extractNestedValue(value, path);
2130
+ return typeof current === 'boolean' ? current : undefined;
2131
+ }
1946
2132
  function extractNestedValue(value, path) {
1947
2133
  let current = value;
1948
2134
  for (const key of path) {
@@ -2014,7 +2200,7 @@ export function helpResult(command = []) {
2014
2200
  ' contract show|save|approve',
2015
2201
  ' outline show|generate|revise|save|approve',
2016
2202
  ' research-plan show|generate|revise|save|approve',
2017
- ' repurpose list|generate|show|save|download|status|render',
2203
+ ' repurpose list|generate|show|save|status|render|download',
2018
2204
  ' brief review|answer',
2019
2205
  ' profile list|show',
2020
2206
  ' source list|add|remove',
@@ -2125,18 +2311,22 @@ function commandHelp(command) {
2125
2311
  repurpose: [
2126
2312
  'Usage: coauthor repurpose list <project-id> [--json]',
2127
2313
  ' coauthor repurpose generate <project-id> --format <x-thread|x-post|linkedin|facebook|email|all> [--writing-model <id>] [--json]',
2314
+ ' coauthor repurpose generate <project-id> --format slideshow [--cta save,follow,comment,share,read_more,custom:<text>] [--writing-model <id>] [--json]',
2128
2315
  ' coauthor repurpose show <project-id> --format <format> [--json]',
2316
+ ' coauthor repurpose status <project-id> --format slideshow [--wait] [--json]',
2129
2317
  ' coauthor repurpose save <project-id> --format <format> --data @edits.json [--json]',
2130
2318
  ' coauthor repurpose download <project-id> [--format <format|article|all>] [--out <dir>] [--variant <id>]',
2131
- ' coauthor repurpose generate <project-id> --format video [--cta save,follow] [--writing-model <id>] [--json]',
2132
- ' coauthor repurpose status <project-id> --format video [--wait] [--json]',
2319
+ ' coauthor repurpose generate <project-id> --format <slideshow|video> [--cta save,follow] [--writing-model <id>] [--json]',
2320
+ ' coauthor repurpose status <project-id> --format <slideshow|video> [--wait] [--json]',
2133
2321
  ' coauthor repurpose render <project-id> --format video [--variant <id>] [--wait] [--json]',
2134
2322
  '',
2135
- 'Turns the finished draft into social posts and an email newsletter. generate takes about 20-90 seconds per format and replaces the previous version.',
2323
+ 'Turns the finished draft into social posts, an email newsletter, and a carousel slideshow. generate takes about 20-90 seconds per format and replaces the previous version.',
2136
2324
  'show returns data.copy (copy-ready text with the destination link filled in). download writes article.md, <format>.md, <format>.json, and manifest.json.',
2137
2325
  'Video: generate writes a short vertical deck and starts its slide images (1-3 minutes); --cta picks the ending call to action (comma-separated: save, follow, comment, share, read_more, custom:<text>; default save).',
2138
2326
  'status shows panels done/failed/generating and each render; render makes the MP4 (about 3 minutes, one render at a time per account; --wait polls up to 9 minutes, exit code 2 if still running); download saves finished MP4s as <out>/video-<variant>.mp4.',
2139
- 'Slideshows are generated in the web app; download includes them only as JSON once they exist. Publish an X thread with coauthor publish thread.',
2327
+ 'Slideshow: generate writes the slides and queues one image per panel (--cta picks up to 4 ending slides, default save; all is text formats only). status --wait waits up to 9 minutes for the images.',
2328
+ 'download --format slideshow renders 1080x1350 PNGs on the server into <out>/slideshow/<cta>/slide-NN.png (--variant picks one CTA); --format all includes them once every image is ready.',
2329
+ 'Publish an X thread with coauthor publish thread.',
2140
2330
  ].join('\n'),
2141
2331
  brief: [
2142
2332
  'Usage: coauthor brief review <project-id> [--json]',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clickminded/coauthor-cli",
3
- "version": "0.0.30",
3
+ "version": "0.0.32",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "coauthor": "dist/index.js",
@@ -66,4 +66,4 @@ Everything else, including auth problems: `references/troubleshooting.md`. Credi
66
66
 
67
67
  ## Not in the CLI yet
68
68
 
69
- Creating or editing writer profiles, PDFs over about 3.3 MB, adding more images than CoAuthor planned, and slideshows. Point the user to the CoAuthor web app at https://tools.clickminded.com/coauthor for these instead of improvising.
69
+ Creating or editing writer profiles, PDFs over about 3.3 MB, and adding more images than CoAuthor planned. Point the user to the CoAuthor web app at https://tools.clickminded.com/coauthor for these instead of improvising.
@@ -14,7 +14,7 @@ coauthor draft revise <id> --instruction "Cut the intro to two sentences and lea
14
14
  - Apply all groups: `coauthor draft revision apply <id> <revision-id> --json`. Keep only some with `--accept <group id>,<group id>`, or all but some with `--reject <group id>`, copying the ids (`review_…`) from `data.groups[].id`. Groups not named in `--accept` are dropped. Drop the whole revision with `coauthor draft revision discard <id> <revision-id> --json`.
15
15
  - `status: "no_changes"` usually means CoAuthor asked a question instead of guessing. Read `data.assistant_message`, then run `draft revise` again with a clearer instruction.
16
16
  - Name the place precisely ("the paragraph after the 'Write the first line' heading") and give numbers for cuts ("under 60 words"). Vague targets get a clarifying question back, and a vague "tighten" changes little.
17
- - One revision can be open on a draft at a time, and an open one blocks the user's saves in the browser. Always apply or discard it. `revision_pending` means one is already open.
17
+ - One revision can be open on a draft at a time, and an open one blocks the user's saves in the browser. Always apply or discard it. `revision_pending` means one is already open. A revision you leave waiting for review is discarded automatically after 30 minutes (`expires_at` in `draft revision show`), so review it promptly; after that, start a new one.
18
18
  - If `--wait` returns `still_running`, check again with `coauthor draft revision show <id> <revision-id> --json`.
19
19
  - `revise_unavailable` means this account cannot revise by instruction yet; use a direct edit.
20
20
 
@@ -25,4 +25,4 @@ Images cost credits each time they are generated or edited, so check the brief a
25
25
 
26
26
  ## Other formats
27
27
 
28
- X posts, LinkedIn, Facebook, and email newsletter versions: see `references/repurposing.md`. Carousel slideshows and short videos are generated in the CoAuthor web app (open the project, then Promote).
28
+ X posts, LinkedIn, Facebook, and email newsletter versions: see `references/repurposing.md`. Carousel slideshows and short vertical videos: same file, under Slideshow and Video.
@@ -1,4 +1,4 @@
1
- # Repurposing: social posts and an email newsletter
1
+ # Repurposing: social posts, an email newsletter, slideshows, and video
2
2
 
3
3
  Once the draft is final, CoAuthor turns it into distribution copy in the project's voice.
4
4
 
@@ -10,7 +10,7 @@ Once the draft is final, CoAuthor turns it into distribution copy in the project
10
10
  | Facebook post | `facebook` | Variations with alternate hooks |
11
11
  | Email newsletter | `email` | Variations with subject line, preheader, and body |
12
12
 
13
- Slideshows (carousels) are generated in the CoAuthor web app (open the project, then Promote); `repurpose download` includes them as JSON once they exist. Short vertical videos can be made from the CLI (see below).
13
+ Carousel slideshows and short vertical videos have their own steps, because their illustrated panels are generated as images first (see Slideshow and Video below).
14
14
 
15
15
  ## Generate
16
16
 
@@ -44,6 +44,16 @@ coauthor repurpose save <id> --format x-thread --data '{"posts":[...]}' --json
44
44
 
45
45
  Add `"destination_url": "https://..."` to point the posts at the published article. Keep the `{{POST_URL}}` placeholder in stored text; it is replaced with the destination URL on copy.
46
46
 
47
+ ## Slideshow
48
+
49
+ A carousel of 1080x1350 slides (for LinkedIn or Instagram) with illustrated panels and a closing call-to-action slide.
50
+
51
+ 1. `coauthor repurpose generate <id> --format slideshow [--cta save,follow] --json` writes the slides and queues one image per panel. Up to 4 endings: `save`, `follow`, `comment`, `share`, `read_more`, plus one `custom:<text>`; the default is `save`. Panel images cost image credits, which is why slideshows are not part of `--format all`.
52
+ 2. `coauthor repurpose status <id> --format slideshow --wait --json` waits until no panel is still generating. If some failed, retry them with `coauthor image generate` or in the web app.
53
+ 3. `coauthor repurpose download <id> --format slideshow [--variant <cta>] --out <dir>` renders the PNGs on the server and saves them as `slideshow/<cta>/slide-NN.png`, one folder per ending. `panels_not_ready` (409) means images are still generating or failed. Rendering again with no changes returns the same files.
54
+
55
+ The server draws the slides with the Inter font, so line breaks can differ slightly from the web app's own PNG download.
56
+
47
57
  ## Video
48
58
 
49
59
  A short vertical video (1080x1920) of the article's key points, with illustrated panels and a closing call to action.
@@ -24,7 +24,7 @@ Every failure prints JSON on stderr with `ok: false`, `error` (a readable messag
24
24
  | `stale_draft` | The draft changed after you read it. | Re-read with `draft get`, reapply your edit, save. |
25
25
  | `user_recently_editing` | The user saved in the browser in the last 90 seconds. | Wait, or ask them. `--force` only with their OK. |
26
26
  | `review_pending`, `document_locked` | An AI review or edit is in progress in the editor. | Wait, or apply or discard it. |
27
- | `revision_pending` | Another draft revision is open. | Apply or discard it (`details.revision_id`). |
27
+ | `revision_pending` | Another draft revision is open. | Apply or discard it (`details.revision_id`). An agent revision left in review is discarded automatically at `details.expires_at`. |
28
28
  | `revise_unavailable` | Revise by instruction isn't available on this account. | Use a direct edit (`references/editing-drafts.md`). |
29
29
  | `invalid_document` | `draft save` content isn't an editor document. | Send the edited `data.content` from `draft get --format json`, never markdown. |
30
30
  | `workflow_token_mismatch`, `conflict` | The project moved on since you read it (for example someone used the web app). | Re-read the state with `coauthor workflow status <id> --json` and continue from there. |
@@ -68,7 +68,7 @@ Everything else, including auth problems: `references/troubleshooting.md`. Credi
68
68
 
69
69
  ## Not in the CLI yet
70
70
 
71
- Creating or editing writer profiles, PDFs over about 3.3 MB, adding more images than CoAuthor planned, and slideshows. Point the user to the CoAuthor web app at https://tools.clickminded.com/coauthor for these instead of improvising.
71
+ Creating or editing writer profiles, PDFs over about 3.3 MB, and adding more images than CoAuthor planned. Point the user to the CoAuthor web app at https://tools.clickminded.com/coauthor for these instead of improvising.
72
72
 
73
73
  # Reference sections
74
74
 
@@ -281,7 +281,7 @@ coauthor draft revise <id> --instruction "Cut the intro to two sentences and lea
281
281
  - Apply all groups: `coauthor draft revision apply <id> <revision-id> --json`. Keep only some with `--accept <group id>,<group id>`, or all but some with `--reject <group id>`, copying the ids (`review_…`) from `data.groups[].id`. Groups not named in `--accept` are dropped. Drop the whole revision with `coauthor draft revision discard <id> <revision-id> --json`.
282
282
  - `status: "no_changes"` usually means CoAuthor asked a question instead of guessing. Read `data.assistant_message`, then run `draft revise` again with a clearer instruction.
283
283
  - Name the place precisely ("the paragraph after the 'Write the first line' heading") and give numbers for cuts ("under 60 words"). Vague targets get a clarifying question back, and a vague "tighten" changes little.
284
- - One revision can be open on a draft at a time, and an open one blocks the user's saves in the browser. Always apply or discard it. `revision_pending` means one is already open.
284
+ - One revision can be open on a draft at a time, and an open one blocks the user's saves in the browser. Always apply or discard it. `revision_pending` means one is already open. A revision you leave waiting for review is discarded automatically after 30 minutes (`expires_at` in `draft revision show`), so review it promptly; after that, start a new one.
285
285
  - If `--wait` returns `still_running`, check again with `coauthor draft revision show <id> <revision-id> --json`.
286
286
  - `revise_unavailable` means this account cannot revise by instruction yet; use a direct edit.
287
287
 
@@ -354,7 +354,7 @@ Images cost credits each time they are generated or edited, so check the brief a
354
354
 
355
355
  ### Other formats
356
356
 
357
- X posts, LinkedIn, Facebook, and email newsletter versions: see `references/repurposing.md`. Carousel slideshows and short videos are generated in the CoAuthor web app (open the project, then Promote).
357
+ X posts, LinkedIn, Facebook, and email newsletter versions: see `references/repurposing.md`. Carousel slideshows and short vertical videos: same file, under Slideshow and Video.
358
358
 
359
359
  ## references/publishing-and-export.md
360
360
 
@@ -398,7 +398,7 @@ After a network error or an unclear result on an export or publish, do not run i
398
398
 
399
399
  ## references/repurposing.md
400
400
 
401
- ## Repurposing: social posts and an email newsletter
401
+ ## Repurposing: social posts, an email newsletter, slideshows, and video
402
402
 
403
403
  Once the draft is final, CoAuthor turns it into distribution copy in the project's voice.
404
404
 
@@ -410,7 +410,7 @@ Once the draft is final, CoAuthor turns it into distribution copy in the project
410
410
  | Facebook post | `facebook` | Variations with alternate hooks |
411
411
  | Email newsletter | `email` | Variations with subject line, preheader, and body |
412
412
 
413
- Slideshows (carousels) are generated in the CoAuthor web app (open the project, then Promote); `repurpose download` includes them as JSON once they exist. Short vertical videos can be made from the CLI (see below).
413
+ Carousel slideshows and short vertical videos have their own steps, because their illustrated panels are generated as images first (see Slideshow and Video below).
414
414
 
415
415
  ### Generate
416
416
 
@@ -444,6 +444,16 @@ coauthor repurpose save <id> --format x-thread --data '{"posts":[...]}' --json
444
444
 
445
445
  Add `"destination_url": "https://..."` to point the posts at the published article. Keep the `{{POST_URL}}` placeholder in stored text; it is replaced with the destination URL on copy.
446
446
 
447
+ ### Slideshow
448
+
449
+ A carousel of 1080x1350 slides (for LinkedIn or Instagram) with illustrated panels and a closing call-to-action slide.
450
+
451
+ 1. `coauthor repurpose generate <id> --format slideshow [--cta save,follow] --json` writes the slides and queues one image per panel. Up to 4 endings: `save`, `follow`, `comment`, `share`, `read_more`, plus one `custom:<text>`; the default is `save`. Panel images cost image credits, which is why slideshows are not part of `--format all`.
452
+ 2. `coauthor repurpose status <id> --format slideshow --wait --json` waits until no panel is still generating. If some failed, retry them with `coauthor image generate` or in the web app.
453
+ 3. `coauthor repurpose download <id> --format slideshow [--variant <cta>] --out <dir>` renders the PNGs on the server and saves them as `slideshow/<cta>/slide-NN.png`, one folder per ending. `panels_not_ready` (409) means images are still generating or failed. Rendering again with no changes returns the same files.
454
+
455
+ The server draws the slides with the Inter font, so line breaks can differ slightly from the web app's own PNG download.
456
+
447
457
  ### Video
448
458
 
449
459
  A short vertical video (1080x1920) of the article's key points, with illustrated panels and a closing call to action.
@@ -492,7 +502,7 @@ Every failure prints JSON on stderr with `ok: false`, `error` (a readable messag
492
502
  | `stale_draft` | The draft changed after you read it. | Re-read with `draft get`, reapply your edit, save. |
493
503
  | `user_recently_editing` | The user saved in the browser in the last 90 seconds. | Wait, or ask them. `--force` only with their OK. |
494
504
  | `review_pending`, `document_locked` | An AI review or edit is in progress in the editor. | Wait, or apply or discard it. |
495
- | `revision_pending` | Another draft revision is open. | Apply or discard it (`details.revision_id`). |
505
+ | `revision_pending` | Another draft revision is open. | Apply or discard it (`details.revision_id`). An agent revision left in review is discarded automatically at `details.expires_at`. |
496
506
  | `revise_unavailable` | Revise by instruction isn't available on this account. | Use a direct edit (`references/editing-drafts.md`). |
497
507
  | `invalid_document` | `draft save` content isn't an editor document. | Send the edited `data.content` from `draft get --format json`, never markdown. |
498
508
  | `workflow_token_mismatch`, `conflict` | The project moved on since you read it (for example someone used the web app). | Re-read the state with `coauthor workflow status <id> --json` and continue from there. |