@nuelink/nuelink-cli 1.4.4 → 1.4.5

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/README.md CHANGED
@@ -177,7 +177,7 @@ nuelink-cli collections:create \
177
177
  nuelink-cli automations --brand-id 13493 --per-page 5 --page 1
178
178
  ```
179
179
 
180
- This table view is especially useful for quickly scanning automation status, sub-type, and feed URL.
180
+ This table view is especially useful for quickly scanning automation status, feed type, and feed URL.
181
181
 
182
182
  Create automation:
183
183
 
@@ -187,11 +187,10 @@ nuelink-cli automations:create \
187
187
  --collection-id 720 \
188
188
  --feed-url "https://www.nasa.gov/rss/dyn/breaking_news.rss" \
189
189
  --import-as-type IMAGE \
190
- --sub-type RSS \
191
- --title "NASA Breaking News" \
192
- --type FEED \
193
- --dynamic-title "{{title}}" \
194
- --dynamic-body "{{description}} {{link}}" \
190
+ --name "NASA Breaking News" \
191
+ --type RSS \
192
+ --title "{{title}}" \
193
+ --caption "{{description}} {{link}}" \
195
194
  --dry-run
196
195
  ```
197
196
 
@@ -232,6 +231,14 @@ Optional filters include `--status`, `--post-type`, `--posting-type`,
232
231
  `--created-from`, `--created-to`, `--sort-by`, and `--sort-order`.
233
232
  Creation date filters use `YYYY-MM-DD HH:mm:ss` UTC timestamps.
234
233
 
234
+ List posts across all collections, inspect the brand queue, or review published results:
235
+
236
+ ```bash
237
+ nuelink-cli brand-posts --brand-id 13493 --view SCHEDULED
238
+ nuelink-cli schedule --brand-id 13493
239
+ nuelink-cli published-posts --brand-id 13493 --status PUBLISHED --sort-by likes
240
+ ```
241
+
235
242
  Create post from JSON payload file:
236
243
 
237
244
  ```bash
@@ -291,6 +298,18 @@ only when you intend to send it.
291
298
 
292
299
  Supported publish modes are `DRAFT`, `QUEUE`, `SCHEDULE`, and `IMMEDIATE`. When using `SCHEDULE`, pass `--scheduled-at` in `YYYY-MM-DD HH:mm:ss` format. Poll correct-option indexes are zero-based.
293
300
 
301
+ Preview a post lifecycle update or sensitive deletion before executing it:
302
+
303
+ ```bash
304
+ nuelink-cli posts:update --brand-id 13493 --post-id 8801 \
305
+ --publish-mode SCHEDULE --scheduled-at "2026-10-12 09:00:00" --dry-run
306
+ nuelink-cli posts:update --brand-id 13493 --post-id 8801 \
307
+ --queue-position FRONT --dry-run
308
+ nuelink-cli posts:delete --brand-id 13493 --post-id 8801 --dry-run
309
+ ```
310
+
311
+ Deletion is permanent and the API rejects it unless sensitive AI actions are enabled for the account.
312
+
294
313
  Pagination uses `--page >= 1` and `--per-page` from 1 through 100. Media type
295
314
  filters are `IMAGE`, `VIDEO`, `GIF`, `APPLICATION`, `DOCUMENT`, and `CSV`.
296
315
  Uploads accept JPEG, PNG, BMP, MP4, MOV, or PDF files up to 100 MiB.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuelink/nuelink-cli",
3
- "version": "1.4.4",
3
+ "version": "1.4.5",
4
4
  "description": "The official Nuelink CLI for automating social media workflows from your terminal. Schedule posts, upload media, manage brands, and integrate Nuelink into scripts, CI/CD pipelines, and AI agents.",
5
5
  "license": "MIT",
6
6
  "author": "Nuelink",
@@ -41,7 +41,7 @@
41
41
  "automation"
42
42
  ],
43
43
  "dependencies": {
44
- "@nuelink/nuelink-cli": "^1.4.4",
44
+ "@nuelink/nuelink-cli": "^1.4.5",
45
45
  "chalk": "^5.6.2",
46
46
  "commander": "^13.1.0"
47
47
  },
package/src/commands.js CHANGED
@@ -8,20 +8,25 @@ import { CliError, printCliError } from "./errors.js";
8
8
  import { brandPath, collectionPath, nuelinkRequest } from "./http.js";
9
9
  import { buildPostPayload, parseCsv, validateRawPostPayload, VALID_PUBLISH_MODES } from "./postPayload.js";
10
10
  import {
11
- VALID_AUTOMATION_SUB_TYPES,
12
- VALID_AUTOMATION_TYPES,
11
+ VALID_FEED_TYPES,
13
12
  VALID_IMPORT_AS_TYPES,
14
13
  VALID_MEDIA_FILTER_TYPES,
15
14
  VALID_POST_STATUSES,
16
15
  VALID_POST_TYPES,
17
16
  VALID_POSTING_TYPES,
17
+ VALID_POST_VIEWS,
18
18
  VALID_POST_SORT_FIELDS,
19
+ VALID_POST_UPDATE_MODES,
20
+ VALID_QUEUE_POSITIONS,
21
+ VALID_PUBLISHED_POST_STATUSES,
22
+ VALID_PUBLISHED_POST_SORT_FIELDS,
19
23
  VALID_SORT_ORDERS,
20
24
  normalizeEnum,
21
25
  parseBooleanStrict,
22
26
  parseIntegerInRange,
23
27
  parseJsonString,
24
28
  parseOptionalNonNegativeInteger,
29
+ parseOptionalPositiveInteger,
25
30
  parsePositiveInteger,
26
31
  splitCsv,
27
32
  validateHttpUrl,
@@ -395,12 +400,10 @@ function registerCommands(program, runtimeApiKey, cliVersion) {
395
400
  .requiredOption("--collection-id <id>", "Collection ID")
396
401
  .requiredOption("--feed-url <url>", "Feed URL")
397
402
  .requiredOption("--import-as-type <type>", "Import type, e.g. IMAGE")
398
- .requiredOption("--sub-type <type>", "Sub type, e.g. RSS")
399
- .requiredOption("--title <title>", "Automation title")
400
- .option("--type <type>", "Automation type", "FEED")
401
- .option("--dynamic-title <text>", "Dynamic title", "{{title}}")
402
- .option("--dynamic-body <text>", "Dynamic body")
403
- .option("--description <text>", "Automation description")
403
+ .requiredOption("--name <name>", "Automation name")
404
+ .requiredOption("--type <type>", `Feed type (${VALID_FEED_TYPES.join(", ")})`)
405
+ .option("--title <text>", "Imported post title template", "{{title}}")
406
+ .option("--caption <text>", "Imported post caption template")
404
407
  .option("--load-old-posts <boolean>", "Import existing feed items: true/false")
405
408
  .option("--add-posts-as-draft <boolean>", "Create imported posts as drafts: true/false")
406
409
  .option("--refresh-rate <hours>", "Refresh interval (24, 12, 6, or 1 hours)")
@@ -409,15 +412,13 @@ function registerCommands(program, runtimeApiKey, cliVersion) {
409
412
  method: "POST",
410
413
  endpoint: `${brandPath(parsePositiveInteger(options.brandId, "brand-id"))}/automations`,
411
414
  body: {
415
+ name: validateRequiredString(options.name, 255, "name"),
412
416
  collectionId: parsePositiveInteger(options.collectionId, "collection-id"),
417
+ type: normalizeEnum(options.type, "type", VALID_FEED_TYPES),
413
418
  feedUrl: validateHttpUrl(options.feedUrl, "feed-url"),
414
419
  importAsType: normalizeEnum(options.importAsType, "import-as-type", VALID_IMPORT_AS_TYPES),
415
- subType: normalizeEnum(options.subType, "sub-type", VALID_AUTOMATION_SUB_TYPES),
416
- title: validateRequiredString(options.title, 255, "title"),
417
- type: normalizeEnum(options.type, "type", VALID_AUTOMATION_TYPES),
418
- dynamicTitle: validateMaxLength(options.dynamicTitle, 255, "dynamic-title"),
419
- dynamicBody: validateMaxLength(options.dynamicBody, 255, "dynamic-body"),
420
- description: options.description,
420
+ title: validateMaxLength(options.title, 255, "title"),
421
+ caption: validateMaxLength(options.caption, 255, "caption"),
421
422
  loadOldPosts: parseBooleanStrict(options.loadOldPosts, "load-old-posts"),
422
423
  addPostsAsDraft: parseBooleanStrict(options.addPostsAsDraft, "add-posts-as-draft"),
423
424
  refreshRate: options.refreshRate === undefined
@@ -552,6 +553,163 @@ function registerCommands(program, runtimeApiKey, cliVersion) {
552
553
  });
553
554
  }));
554
555
 
556
+ program
557
+ .command("schedule")
558
+ .description("Get the weekly queue schedule for a brand")
559
+ .requiredOption("--brand-id <id>", "Brand ID")
560
+ .action(withCommandErrorHandling(program, async (options) => {
561
+ await executeRequest(program, runtimeApiKey, {
562
+ endpoint: `${brandPath(parsePositiveInteger(options.brandId, "brand-id"))}/schedule`,
563
+ });
564
+ }));
565
+
566
+ program
567
+ .command("brand-posts")
568
+ .description("List posts across all collections in a brand")
569
+ .requiredOption("--brand-id <id>", "Brand ID")
570
+ .option("--collection-id <id>", "Only return posts from this collection")
571
+ .option("--view <view>", `Post view (${VALID_POST_VIEWS.join(", ")})`)
572
+ .option("--per-page <number>", "Items per page", "25")
573
+ .option("--page <number>", "Page number", "1")
574
+ .option("--status <status>", `Post status (${VALID_POST_STATUSES.join(", ")})`)
575
+ .option("--post-type <type>", `Post type (${VALID_POST_TYPES.join(", ")})`)
576
+ .option("--posting-type <type>", `Posting type (${VALID_POSTING_TYPES.join(", ")})`)
577
+ .option("--created-from <datetime>", "Created at or after UTC time (YYYY-MM-DD HH:mm:ss)")
578
+ .option("--created-to <datetime>", "Created at or before UTC time (YYYY-MM-DD HH:mm:ss)")
579
+ .option("--sort-by <field>", `Sort field (${VALID_POST_SORT_FIELDS.join(", ")})`)
580
+ .option("--sort-order <order>", `Sort order (${VALID_SORT_ORDERS.join(", ")})`)
581
+ .action(withCommandErrorHandling(program, async (options) => {
582
+ const createdFrom = validatePostDateTime(options.createdFrom, "created-from");
583
+ const createdTo = validatePostDateTime(options.createdTo, "created-to");
584
+ if (createdFrom && createdTo && createdTo < createdFrom) {
585
+ throw new Error("created-to must not precede created-from.");
586
+ }
587
+ const sortBy = options.sortBy === undefined ? undefined : String(options.sortBy).trim().toLowerCase();
588
+ if (sortBy && !VALID_POST_SORT_FIELDS.includes(sortBy)) {
589
+ throw new Error(`Invalid sort-by "${options.sortBy}". Expected one of: ${VALID_POST_SORT_FIELDS.join(", ")}.`);
590
+ }
591
+ const sortOrder = options.sortOrder === undefined ? undefined : String(options.sortOrder).trim().toLowerCase();
592
+ if (sortOrder && !VALID_SORT_ORDERS.includes(sortOrder)) {
593
+ throw new Error(`Invalid sort-order "${options.sortOrder}". Expected one of: ${VALID_SORT_ORDERS.join(", ")}.`);
594
+ }
595
+
596
+ await executeRequest(program, runtimeApiKey, {
597
+ endpoint: `${brandPath(parsePositiveInteger(options.brandId, "brand-id"))}/posts`,
598
+ query: {
599
+ collection_id: parseOptionalPositiveInteger(options.collectionId, "collection-id"),
600
+ view: options.view ? normalizeEnum(options.view, "view", VALID_POST_VIEWS) : undefined,
601
+ per_page: parseIntegerInRange(options.perPage, "per-page", 1, 100),
602
+ page: parsePositiveInteger(options.page, "page"),
603
+ status: options.status ? normalizeEnum(options.status, "status", VALID_POST_STATUSES) : undefined,
604
+ post_type: options.postType ? normalizeEnum(options.postType, "post-type", VALID_POST_TYPES) : undefined,
605
+ posting_type: options.postingType ? normalizeEnum(options.postingType, "posting-type", VALID_POSTING_TYPES) : undefined,
606
+ created_from: createdFrom,
607
+ created_to: createdTo,
608
+ sort_by: sortBy,
609
+ sort_order: sortOrder,
610
+ },
611
+ });
612
+ }));
613
+
614
+ program
615
+ .command("posts:update")
616
+ .description("Reschedule, re-queue, draft, or reposition a post")
617
+ .requiredOption("--brand-id <id>", "Brand ID")
618
+ .requiredOption("--post-id <id>", "Post ID")
619
+ .option("--publish-mode <mode>", `Publish mode (${VALID_POST_UPDATE_MODES.join(", ")})`)
620
+ .option("--scheduled-at <value>", "Brand-local publish datetime (YYYY-MM-DD HH:mm:ss)")
621
+ .option("--queue-position <position>", `Queue position (${VALID_QUEUE_POSITIONS.join(", ")})`)
622
+ .action(withCommandErrorHandling(program, async (options) => {
623
+ const publishMode = options.publishMode
624
+ ? normalizeEnum(options.publishMode, "publish-mode", VALID_POST_UPDATE_MODES)
625
+ : undefined;
626
+ const queuePosition = options.queuePosition
627
+ ? normalizeEnum(options.queuePosition, "queue-position", VALID_QUEUE_POSITIONS)
628
+ : undefined;
629
+ const scheduledAt = validatePostDateTime(options.scheduledAt, "scheduled-at");
630
+ if (!publishMode && !queuePosition) {
631
+ throw new Error("At least one of publish-mode or queue-position is required.");
632
+ }
633
+ if (publishMode === "SCHEDULE" && !scheduledAt) {
634
+ throw new Error("scheduled-at is required when publish-mode is SCHEDULE.");
635
+ }
636
+ if (publishMode !== "SCHEDULE" && scheduledAt) {
637
+ throw new Error("scheduled-at is only allowed when publish-mode is SCHEDULE.");
638
+ }
639
+
640
+ await executeRequest(program, runtimeApiKey, {
641
+ method: "PATCH",
642
+ endpoint: `${brandPath(parsePositiveInteger(options.brandId, "brand-id"))}/posts/${parsePositiveInteger(options.postId, "post-id")}`,
643
+ body: {
644
+ publishMode,
645
+ scheduledAt,
646
+ queuePosition,
647
+ },
648
+ });
649
+ }));
650
+
651
+ program
652
+ .command("posts:delete")
653
+ .description("Permanently delete a post (requires sensitive actions to be enabled)")
654
+ .requiredOption("--brand-id <id>", "Brand ID")
655
+ .requiredOption("--post-id <id>", "Post ID")
656
+ .action(withCommandErrorHandling(program, async (options) => {
657
+ await executeRequest(program, runtimeApiKey, {
658
+ method: "DELETE",
659
+ endpoint: `${brandPath(parsePositiveInteger(options.brandId, "brand-id"))}/posts/${parsePositiveInteger(options.postId, "post-id")}`,
660
+ });
661
+ }));
662
+
663
+ program
664
+ .command("published-posts")
665
+ .description("List published posts and engagement results for a brand")
666
+ .requiredOption("--brand-id <id>", "Brand ID")
667
+ .option("--per-page <number>", "Items per page", "25")
668
+ .option("--page <number>", "Page number", "1")
669
+ .option("--status <status>", `Published status (${VALID_PUBLISHED_POST_STATUSES.join(", ")})`, "PUBLISHED")
670
+ .option("--collection-id <id>", "Collection ID")
671
+ .option("--channel-id <id>", "Channel ID")
672
+ .option("--post-id <id>", "Source post ID")
673
+ .option("--post-type <type>", "Post type")
674
+ .option("--search <text>", "Search published text")
675
+ .option("--published-from <datetime>", "Published at or after UTC time (YYYY-MM-DD HH:mm:ss)")
676
+ .option("--published-to <datetime>", "Published at or before UTC time (YYYY-MM-DD HH:mm:ss)")
677
+ .option("--sort-by <field>", `Sort field (${VALID_PUBLISHED_POST_SORT_FIELDS.join(", ")})`, "id")
678
+ .option("--sort-order <order>", `Sort order (${VALID_SORT_ORDERS.join(", ")})`, "desc")
679
+ .action(withCommandErrorHandling(program, async (options) => {
680
+ const publishedFrom = validatePostDateTime(options.publishedFrom, "published-from");
681
+ const publishedTo = validatePostDateTime(options.publishedTo, "published-to");
682
+ if (publishedFrom && publishedTo && publishedTo < publishedFrom) {
683
+ throw new Error("published-to must not precede published-from.");
684
+ }
685
+ const sortBy = String(options.sortBy).trim().toLowerCase();
686
+ if (!VALID_PUBLISHED_POST_SORT_FIELDS.includes(sortBy)) {
687
+ throw new Error(`Invalid sort-by "${options.sortBy}". Expected one of: ${VALID_PUBLISHED_POST_SORT_FIELDS.join(", ")}.`);
688
+ }
689
+ const sortOrder = String(options.sortOrder).trim().toLowerCase();
690
+ if (!VALID_SORT_ORDERS.includes(sortOrder)) {
691
+ throw new Error(`Invalid sort-order "${options.sortOrder}". Expected one of: ${VALID_SORT_ORDERS.join(", ")}.`);
692
+ }
693
+
694
+ await executeRequest(program, runtimeApiKey, {
695
+ endpoint: `${brandPath(parsePositiveInteger(options.brandId, "brand-id"))}/published-posts`,
696
+ query: {
697
+ per_page: parseIntegerInRange(options.perPage, "per-page", 1, 100),
698
+ page: parsePositiveInteger(options.page, "page"),
699
+ status: normalizeEnum(options.status, "status", VALID_PUBLISHED_POST_STATUSES),
700
+ collection_id: parseOptionalPositiveInteger(options.collectionId, "collection-id"),
701
+ channel_id: parseOptionalPositiveInteger(options.channelId, "channel-id"),
702
+ post_id: parseOptionalPositiveInteger(options.postId, "post-id"),
703
+ post_type: options.postType,
704
+ search: validateMaxLength(options.search, 255, "search"),
705
+ published_from: publishedFrom,
706
+ published_to: publishedTo,
707
+ sort_by: sortBy,
708
+ sort_order: sortOrder,
709
+ },
710
+ });
711
+ }));
712
+
555
713
  program
556
714
  .command("posts:add-json")
557
715
  .description("Create a post using a JSON payload file")
package/src/output.js CHANGED
@@ -42,6 +42,7 @@ function pickColumns(items) {
42
42
  "status",
43
43
  "type",
44
44
  "subType",
45
+ "queueStatus",
45
46
  "timezone",
46
47
  "collectionId",
47
48
  "postType",
@@ -180,4 +181,4 @@ export {
180
181
  printApiResponse,
181
182
  renderPagination,
182
183
  renderTable,
183
- };
184
+ };
package/src/validation.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import path from "node:path";
2
2
 
3
- const VALID_AUTOMATION_TYPES = ["FEED"];
4
- const VALID_AUTOMATION_SUB_TYPES = [
3
+ const VALID_FEED_TYPES = [
5
4
  "YOUTUBE",
6
5
  "RSS",
7
6
  "ATOM",
@@ -38,7 +37,12 @@ const VALID_POST_TYPES = [
38
37
  "SLIDES", "REEL", "TIKTOK", "STORY", "POLL", "ENGAGE_COMMENT",
39
38
  ];
40
39
  const VALID_POSTING_TYPES = ["NOW", "SCHEDULE", "QUEUE", "DRAFT"];
40
+ const VALID_POST_VIEWS = ["QUEUE", "SCHEDULED", "DRAFT", "PUBLISHED"];
41
41
  const VALID_POST_SORT_FIELDS = ["id", "title", "post_date", "created_at", "updated_at"];
42
+ const VALID_POST_UPDATE_MODES = ["DRAFT", "SCHEDULE", "QUEUE"];
43
+ const VALID_QUEUE_POSITIONS = ["FRONT", "BACK"];
44
+ const VALID_PUBLISHED_POST_STATUSES = ["PUBLISHED", "FAILED", "RETRYING", "SKIPPED", "SENT"];
45
+ const VALID_PUBLISHED_POST_SORT_FIELDS = ["id", "created_at", "likes", "comments", "shares"];
42
46
  const VALID_SORT_ORDERS = ["asc", "desc"];
43
47
  const SUPPORTED_MEDIA_TYPES = new Map([
44
48
  [".jpg", "image/jpeg"],
@@ -266,8 +270,9 @@ function validatePollOptions(options, correctOptionIndex) {
266
270
  throw new Error("Polls require at least two options.");
267
271
  }
268
272
 
269
- if (correctOptionIndex !== undefined && (correctOptionIndex < 0 || correctOptionIndex >= options.length)) {
270
- throw new Error("poll-correct-option-index must point to an existing poll option.");
273
+ if (correctOptionIndex !== undefined && correctOptionIndex !== null
274
+ && (!Number.isInteger(correctOptionIndex) || correctOptionIndex < 0)) {
275
+ throw new Error("poll-correct-option-index must be a non-negative integer.");
271
276
  }
272
277
  }
273
278
 
@@ -312,14 +317,18 @@ function validateMediaFile(filePath, fileStat) {
312
317
  }
313
318
 
314
319
  export {
315
- VALID_AUTOMATION_SUB_TYPES,
316
- VALID_AUTOMATION_TYPES,
320
+ VALID_FEED_TYPES,
317
321
  VALID_IMPORT_AS_TYPES,
318
322
  VALID_MEDIA_FILTER_TYPES,
319
323
  VALID_POST_STATUSES,
320
324
  VALID_POST_TYPES,
321
325
  VALID_POSTING_TYPES,
326
+ VALID_POST_VIEWS,
322
327
  VALID_POST_SORT_FIELDS,
328
+ VALID_POST_UPDATE_MODES,
329
+ VALID_QUEUE_POSITIONS,
330
+ VALID_PUBLISHED_POST_STATUSES,
331
+ VALID_PUBLISHED_POST_SORT_FIELDS,
323
332
  VALID_SORT_ORDERS,
324
333
  parseBooleanStrict,
325
334
  parseIntegerInRange,
package/test/cli.test.mjs CHANGED
@@ -294,7 +294,7 @@ test("version flags print package version", async () => {
294
294
  });
295
295
 
296
296
  assert.equal(result.status, 0, result.stderr);
297
- assert.equal(result.stdout.trim(), "1.4.4");
297
+ assert.equal(result.stdout.trim(), "1.4.5");
298
298
  assert.equal(result.stderr, "");
299
299
  }
300
300
  });
@@ -364,9 +364,9 @@ test("automations:create works when boolean flags are omitted", async () => {
364
364
  "https://example.com/feed.xml",
365
365
  "--import-as-type",
366
366
  "IMAGE",
367
- "--sub-type",
367
+ "--type",
368
368
  "RSS",
369
- "--title",
369
+ "--name",
370
370
  "Automation",
371
371
  ],
372
372
  homeDir,
@@ -377,6 +377,10 @@ test("automations:create works when boolean flags are omitted", async () => {
377
377
 
378
378
  const capture = JSON.parse(await readFile(capturePath, "utf8"));
379
379
  assert.equal(capture.method, "POST");
380
+ assert.equal(capture.body.name, "Automation");
381
+ assert.equal(capture.body.type, "RSS");
382
+ assert.equal(capture.body.title, "{{title}}");
383
+ assert.equal(capture.body.subType, undefined);
380
384
  assert.equal(capture.body.loadOldPosts, undefined);
381
385
  assert.equal(capture.body.addPostsAsDraft, undefined);
382
386
  });
@@ -924,9 +928,9 @@ test("automations:create rejects invalid feed urls", async () => {
924
928
  "notaurl",
925
929
  "--import-as-type",
926
930
  "IMAGE",
927
- "--sub-type",
931
+ "--type",
928
932
  "RSS",
929
- "--title",
933
+ "--name",
930
934
  "Automation",
931
935
  ],
932
936
  homeDir,
@@ -951,9 +955,9 @@ test("automations:create rejects invalid enum values", async () => {
951
955
  "https://www.nasa.gov/rss/dyn/breaking_news.rss",
952
956
  "--import-as-type",
953
957
  "AUDIO",
954
- "--sub-type",
958
+ "--type",
955
959
  "RSS",
956
- "--title",
960
+ "--name",
957
961
  "Automation",
958
962
  ],
959
963
  homeDir,
@@ -1012,6 +1016,112 @@ test("posts:create requires scheduled-at for scheduled posts", async () => {
1012
1016
  assert.match(result.stderr, /scheduledAt is required/);
1013
1017
  });
1014
1018
 
1019
+ test("schedule requests the brand weekly schedule", async () => {
1020
+ const homeDir = await setupTempHome();
1021
+ const capturePath = path.join(homeDir, "capture-schedule.json");
1022
+ const result = runCli({
1023
+ args: ["schedule", "--brand-id", "42"],
1024
+ homeDir,
1025
+ capturePath,
1026
+ });
1027
+
1028
+ assert.equal(result.status, 0, result.stderr);
1029
+ const capture = JSON.parse(await readFile(capturePath, "utf8"));
1030
+ assert.equal(new URL(capture.url).pathname, "/api/public/v1/brands/42/schedule");
1031
+ });
1032
+
1033
+ test("brand-posts forwards brand-wide post filters", async () => {
1034
+ const homeDir = await setupTempHome();
1035
+ const capturePath = path.join(homeDir, "capture-brand-posts.json");
1036
+ const result = runCli({
1037
+ args: [
1038
+ "brand-posts", "--brand-id", "42", "--collection-id", "77",
1039
+ "--view", "scheduled", "--status", "pending", "--sort-by", "post_date",
1040
+ ],
1041
+ homeDir,
1042
+ capturePath,
1043
+ });
1044
+
1045
+ assert.equal(result.status, 0, result.stderr);
1046
+ const capture = JSON.parse(await readFile(capturePath, "utf8"));
1047
+ const url = new URL(capture.url);
1048
+ assert.equal(url.pathname, "/api/public/v1/brands/42/posts");
1049
+ assert.equal(url.searchParams.get("collection_id"), "77");
1050
+ assert.equal(url.searchParams.get("view"), "SCHEDULED");
1051
+ assert.equal(url.searchParams.get("status"), "PENDING");
1052
+ });
1053
+
1054
+ test("posts:update builds the documented patch payload", async () => {
1055
+ const homeDir = await setupTempHome();
1056
+ const capturePath = path.join(homeDir, "capture-post-update.json");
1057
+ const result = runCli({
1058
+ args: [
1059
+ "posts:update", "--brand-id", "42", "--post-id", "8801",
1060
+ "--publish-mode", "schedule", "--scheduled-at", "2026-10-12 09:00:00",
1061
+ ],
1062
+ homeDir,
1063
+ capturePath,
1064
+ });
1065
+
1066
+ assert.equal(result.status, 0, result.stderr);
1067
+ const capture = JSON.parse(await readFile(capturePath, "utf8"));
1068
+ assert.equal(capture.method, "PATCH");
1069
+ assert.equal(new URL(capture.url).pathname, "/api/public/v1/brands/42/posts/8801");
1070
+ assert.deepEqual(capture.body, {
1071
+ publishMode: "SCHEDULE",
1072
+ scheduledAt: "2026-10-12 09:00:00",
1073
+ });
1074
+ });
1075
+
1076
+ test("posts:update requires an update operation", async () => {
1077
+ const homeDir = await setupTempHome();
1078
+ const result = runCli({
1079
+ args: ["posts:update", "--brand-id", "42", "--post-id", "8801"],
1080
+ homeDir,
1081
+ capturePath: path.join(homeDir, "capture-empty-post-update.json"),
1082
+ });
1083
+
1084
+ assert.equal(result.status, 1);
1085
+ assert.match(result.stderr, /At least one of publish-mode or queue-position is required/);
1086
+ });
1087
+
1088
+ test("posts:delete targets the sensitive delete endpoint", async () => {
1089
+ const homeDir = await setupTempHome();
1090
+ const capturePath = path.join(homeDir, "capture-post-delete.json");
1091
+ const result = runCli({
1092
+ args: ["posts:delete", "--brand-id", "42", "--post-id", "8801"],
1093
+ homeDir,
1094
+ capturePath,
1095
+ });
1096
+
1097
+ assert.equal(result.status, 0, result.stderr);
1098
+ const capture = JSON.parse(await readFile(capturePath, "utf8"));
1099
+ assert.equal(capture.method, "DELETE");
1100
+ assert.equal(new URL(capture.url).pathname, "/api/public/v1/brands/42/posts/8801");
1101
+ });
1102
+
1103
+ test("published-posts forwards result filters", async () => {
1104
+ const homeDir = await setupTempHome();
1105
+ const capturePath = path.join(homeDir, "capture-published-posts.json");
1106
+ const result = runCli({
1107
+ args: [
1108
+ "published-posts", "--brand-id", "42", "--status", "failed",
1109
+ "--channel-id", "501", "--search", "launch", "--sort-by", "likes",
1110
+ ],
1111
+ homeDir,
1112
+ capturePath,
1113
+ });
1114
+
1115
+ assert.equal(result.status, 0, result.stderr);
1116
+ const capture = JSON.parse(await readFile(capturePath, "utf8"));
1117
+ const url = new URL(capture.url);
1118
+ assert.equal(url.pathname, "/api/public/v1/brands/42/published-posts");
1119
+ assert.equal(url.searchParams.get("status"), "FAILED");
1120
+ assert.equal(url.searchParams.get("channel_id"), "501");
1121
+ assert.equal(url.searchParams.get("search"), "launch");
1122
+ assert.equal(url.searchParams.get("sort_by"), "likes");
1123
+ });
1124
+
1015
1125
  test("base url can be overridden for testing", async () => {
1016
1126
  const homeDir = await setupTempHome();
1017
1127
  const capturePath = path.join(homeDir, "capture-base-url.json");
@@ -1116,11 +1226,11 @@ for (const fixture of [
1116
1226
  args: ["collections:create", "--brand-id", "1", "--title", " ", "--dry-run"],
1117
1227
  },
1118
1228
  {
1119
- name: "automation titles",
1229
+ name: "automation names",
1120
1230
  args: [
1121
1231
  "automations:create", "--brand-id", "1", "--collection-id", "2",
1122
1232
  "--feed-url", "https://example.com/feed.xml", "--import-as-type", "IMAGE",
1123
- "--sub-type", "RSS", "--title", " ", "--dry-run",
1233
+ "--type", "RSS", "--name", " ", "--dry-run",
1124
1234
  ],
1125
1235
  },
1126
1236
  {
@@ -165,12 +165,16 @@ globalThis.fetch = async (input, init = {}) => {
165
165
  payload.data = [
166
166
  {
167
167
  id: 21682,
168
- title: "NASA Breaking News",
169
- description: "NASA Breaking News RSS Automation",
168
+ name: "NASA Breaking News",
170
169
  collectionId: 720,
171
170
  status: "ACTIVE",
172
- subType: "RSS",
171
+ type: "RSS",
173
172
  feedUrl: "https://www.nasa.gov/rss/dyn/breaking_news.rss",
173
+ runCount: 0,
174
+ importAsType: "IMAGE",
175
+ lastRun: 0,
176
+ title: "{{title}}",
177
+ caption: "{{description}} {{link}}",
174
178
  createdAt: "2026-06-29T14:24:13.000000Z",
175
179
  updatedAt: "2026-06-29T14:24:13.000000Z",
176
180
  },
@@ -165,12 +165,16 @@ globalThis.fetch = async (input, init = {}) => {
165
165
  payload.data = [
166
166
  {
167
167
  id: 21682,
168
- title: "NASA Breaking News",
169
- description: "NASA Breaking News RSS Automation",
168
+ name: "NASA Breaking News",
170
169
  collectionId: 720,
171
170
  status: "ACTIVE",
172
- subType: "RSS",
171
+ type: "RSS",
173
172
  feedUrl: "https://www.nasa.gov/rss/dyn/breaking_news.rss",
173
+ runCount: 0,
174
+ importAsType: "IMAGE",
175
+ lastRun: 0,
176
+ title: "{{title}}",
177
+ caption: "{{description}} {{link}}",
174
178
  createdAt: "2026-06-29T14:24:13.000000Z",
175
179
  updatedAt: "2026-06-29T14:24:13.000000Z",
176
180
  },