@nuelink/nuelink-cli 1.5.0 → 1.6.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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.6.0
4
+
5
+ - Add collection update, channel assignment, and queue slot management commands.
6
+ - Add automation pause and activate support.
7
+ - Support collection post view filtering and caption-only post updates.
8
+ - Add an explicit option to clear a collection description.
9
+
3
10
  ## 1.5.0
4
11
 
5
12
  - Preserve nullable post fields in `posts:add-json` and keep dry-run bodies aligned with sent requests.
package/README.md CHANGED
@@ -171,6 +171,20 @@ nuelink-cli collections:create \
171
171
  --dry-run
172
172
  ```
173
173
 
174
+ Update collection settings and manage channel assignments or queue slots:
175
+
176
+ ```bash
177
+ nuelink-cli collections:update --brand-id 13493 --collection-id 33273 --status PAUSED --dry-run
178
+ nuelink-cli collections:update --brand-id 13493 --collection-id 33273 --clear-description --dry-run
179
+ nuelink-cli collections:add-channel --brand-id 13493 --collection-id 33273 --channel-id 300294 --dry-run
180
+ nuelink-cli collections:remove-channel --brand-id 13493 --collection-id 33273 --channel-id 300294 --dry-run
181
+ nuelink-cli collections:add-queue --brand-id 13493 --collection-id 33273 --date "Mon 09:30" --dry-run
182
+ nuelink-cli collections:delete-queue --brand-id 13493 --collection-id 33273 --queue-id 911 --dry-run
183
+ ```
184
+
185
+ Use `--clear-description` to send `description: null`; it cannot be combined
186
+ with `--description`.
187
+
174
188
  ### Automations
175
189
 
176
190
  ```bash
@@ -194,6 +208,12 @@ nuelink-cli automations:create \
194
208
  --dry-run
195
209
  ```
196
210
 
211
+ Pause or activate an automation:
212
+
213
+ ```bash
214
+ nuelink-cli automations:update-status --brand-id 13493 --automation-id 315 --status PAUSED --dry-run
215
+ ```
216
+
197
217
  ### Channels
198
218
 
199
219
  ```bash
@@ -228,7 +248,8 @@ nuelink-cli posts --brand-id 13493 --collection-id 33273 --per-page 5 --page 1
228
248
 
229
249
  Post list output highlights the post ID, type, status, and publish date.
230
250
  Optional filters include `--status`, `--post-type`, `--posting-type`,
231
- `--created-from`, `--created-to`, `--sort-by`, and `--sort-order`.
251
+ `--view` (`QUEUE`, `SCHEDULED`, `DRAFT`, or `PUBLISHED`), `--created-from`,
252
+ `--created-to`, `--sort-by`, and `--sort-order`.
232
253
  Creation date filters use `YYYY-MM-DD HH:mm:ss` UTC timestamps.
233
254
 
234
255
  List posts across all collections, inspect the brand queue, or review published results:
@@ -306,6 +327,8 @@ Supported publish modes are `DRAFT`, `QUEUE`, `SCHEDULE`, and `IMMEDIATE`. When
306
327
  Preview a post lifecycle update or sensitive deletion before executing it:
307
328
 
308
329
  ```bash
330
+ nuelink-cli posts:update --brand-id 13493 --post-id 8801 \
331
+ --caption "Updated launch announcement." --dry-run
309
332
  nuelink-cli posts:update --brand-id 13493 --post-id 8801 \
310
333
  --publish-mode SCHEDULE --scheduled-at "BRAND_LOCAL_YYYY-MM-DD_HH:mm:ss" --dry-run
311
334
  nuelink-cli posts:update --brand-id 13493 --post-id 8801 \
@@ -315,7 +338,7 @@ nuelink-cli posts:move --brand-id 13493 --source-collection-id 33273 \
315
338
  nuelink-cli posts:delete --brand-id 13493 --post-id 8801 --dry-run
316
339
  ```
317
340
 
318
- Moving is atomic: all supplied posts (at most 100) must belong to the source collection. Deletion is permanent and the API rejects it unless sensitive AI actions are enabled for the account.
341
+ `posts:update` accepts `--caption` (1–3000 characters) alongside or instead of a scheduling change. Caption edits are not available for poll or published posts. Moving is atomic: all supplied posts (at most 100) must belong to the source collection. Deletion is permanent and the API rejects it unless sensitive AI actions are enabled for the account.
319
342
 
320
343
  Published-post results are returned unchanged in `--json` mode. Each per-channel
321
344
  record includes `likes`, `comments`, `shares`, `views`, `saves`, `engagement`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuelink/nuelink-cli",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
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",
package/src/commands.js CHANGED
@@ -377,6 +377,95 @@ function registerCommands(program, runtimeApiKey, cliVersion) {
377
377
  });
378
378
  }));
379
379
 
380
+ program
381
+ .command("collections:update")
382
+ .description("Update collection properties")
383
+ .requiredOption("--brand-id <id>", "Brand ID")
384
+ .requiredOption("--collection-id <id>", "Collection ID")
385
+ .option("--title <title>", "Collection title")
386
+ .option("--description <text>", "Collection description")
387
+ .option("--clear-description", "Set the collection description to null")
388
+ .option("--status <status>", "Collection status (ACTIVE or PAUSED)")
389
+ .option("--max-republish <number>", "Maximum republish count")
390
+ .action(withCommandErrorHandling(program, async (options) => {
391
+ if (options.clearDescription && options.description !== undefined) {
392
+ throw new Error("Use either --description or --clear-description, not both.");
393
+ }
394
+ const body = {
395
+ title: options.title === undefined ? undefined : validateRequiredString(options.title, 255, "title"),
396
+ description: options.clearDescription
397
+ ? null
398
+ : options.description === undefined
399
+ ? undefined
400
+ : validateMaxLength(options.description, 1000, "description"),
401
+ status: options.status === undefined ? undefined : normalizeEnum(options.status, "status", ["ACTIVE", "PAUSED"]),
402
+ maxRepublish: parseOptionalNonNegativeInteger(options.maxRepublish, "max-republish"),
403
+ };
404
+ if (Object.values(body).every((value) => value === undefined)) {
405
+ throw new Error("Provide at least one collection property to update.");
406
+ }
407
+ await executeRequest(program, runtimeApiKey, {
408
+ method: "PATCH",
409
+ endpoint: `${collectionPath(parsePositiveInteger(options.brandId, "brand-id"), parsePositiveInteger(options.collectionId, "collection-id"))}`,
410
+ body,
411
+ });
412
+ }));
413
+
414
+ program
415
+ .command("collections:add-channel")
416
+ .description("Add a channel to a collection")
417
+ .requiredOption("--brand-id <id>", "Brand ID")
418
+ .requiredOption("--collection-id <id>", "Collection ID")
419
+ .requiredOption("--channel-id <id>", "Channel ID")
420
+ .action(withCommandErrorHandling(program, async (options) => {
421
+ await executeRequest(program, runtimeApiKey, {
422
+ method: "POST",
423
+ endpoint: `${collectionPath(parsePositiveInteger(options.brandId, "brand-id"), parsePositiveInteger(options.collectionId, "collection-id"))}/channels`,
424
+ body: { channelId: parsePositiveInteger(options.channelId, "channel-id") },
425
+ });
426
+ }));
427
+
428
+ program
429
+ .command("collections:remove-channel")
430
+ .description("Remove a channel from a collection")
431
+ .requiredOption("--brand-id <id>", "Brand ID")
432
+ .requiredOption("--collection-id <id>", "Collection ID")
433
+ .requiredOption("--channel-id <id>", "Channel ID")
434
+ .action(withCommandErrorHandling(program, async (options) => {
435
+ await executeRequest(program, runtimeApiKey, {
436
+ method: "DELETE",
437
+ endpoint: `${collectionPath(parsePositiveInteger(options.brandId, "brand-id"), parsePositiveInteger(options.collectionId, "collection-id"))}/channels/${parsePositiveInteger(options.channelId, "channel-id")}`,
438
+ });
439
+ }));
440
+
441
+ program
442
+ .command("collections:add-queue")
443
+ .description("Add a weekly queue slot to a collection")
444
+ .requiredOption("--brand-id <id>", "Brand ID")
445
+ .requiredOption("--collection-id <id>", "Collection ID")
446
+ .requiredOption("--date <slot>", "Weekly slot in brand timezone (e.g. Mon 09:30)")
447
+ .action(withCommandErrorHandling(program, async (options) => {
448
+ const [date] = validateQueueSlots([options.date]);
449
+ await executeRequest(program, runtimeApiKey, {
450
+ method: "POST",
451
+ endpoint: `${collectionPath(parsePositiveInteger(options.brandId, "brand-id"), parsePositiveInteger(options.collectionId, "collection-id"))}/queues`,
452
+ body: { date },
453
+ });
454
+ }));
455
+
456
+ program
457
+ .command("collections:delete-queue")
458
+ .description("Delete a weekly queue slot")
459
+ .requiredOption("--brand-id <id>", "Brand ID")
460
+ .requiredOption("--collection-id <id>", "Collection ID")
461
+ .requiredOption("--queue-id <id>", "Queue slot ID")
462
+ .action(withCommandErrorHandling(program, async (options) => {
463
+ await executeRequest(program, runtimeApiKey, {
464
+ method: "DELETE",
465
+ endpoint: `${collectionPath(parsePositiveInteger(options.brandId, "brand-id"), parsePositiveInteger(options.collectionId, "collection-id"))}/queues/${parsePositiveInteger(options.queueId, "queue-id")}`,
466
+ });
467
+ }));
468
+
380
469
  program
381
470
  .command("automations")
382
471
  .description("List automations for a brand")
@@ -428,6 +517,20 @@ function registerCommands(program, runtimeApiKey, cliVersion) {
428
517
  });
429
518
  }));
430
519
 
520
+ program
521
+ .command("automations:update-status")
522
+ .description("Pause or activate an automation")
523
+ .requiredOption("--brand-id <id>", "Brand ID")
524
+ .requiredOption("--automation-id <id>", "Automation ID")
525
+ .requiredOption("--status <status>", "Automation status (ACTIVE, PAUSED, or INACTIVE)")
526
+ .action(withCommandErrorHandling(program, async (options) => {
527
+ await executeRequest(program, runtimeApiKey, {
528
+ method: "PATCH",
529
+ endpoint: `${brandPath(parsePositiveInteger(options.brandId, "brand-id"))}/automations/${parsePositiveInteger(options.automationId, "automation-id")}`,
530
+ body: { status: normalizeEnum(options.status, "status", ["ACTIVE", "PAUSED", "INACTIVE"]) },
531
+ });
532
+ }));
533
+
431
534
  program
432
535
  .command("channels")
433
536
  .description("List channels for a brand")
@@ -502,6 +605,7 @@ function registerCommands(program, runtimeApiKey, cliVersion) {
502
605
  .requiredOption("--collection-id <id>", "Collection ID")
503
606
  .option("--per-page <number>", "Items per page", "25")
504
607
  .option("--page <number>", "Page number", "1")
608
+ .option("--view <view>", `Post view (${VALID_POST_VIEWS.join(", ")})`)
505
609
  .option("--status <status>", `Post status (${VALID_POST_STATUSES.join(", ")})`)
506
610
  .option("--post-type <type>", `Post type (${VALID_POST_TYPES.join(", ")})`)
507
611
  .option("--posting-type <type>", `Posting type (${VALID_POSTING_TYPES.join(", ")})`)
@@ -536,6 +640,7 @@ function registerCommands(program, runtimeApiKey, cliVersion) {
536
640
  query: {
537
641
  per_page: parseIntegerInRange(options.perPage, "per-page", 1, 100),
538
642
  page: parsePositiveInteger(options.page, "page"),
643
+ view: options.view ? normalizeEnum(options.view, "view", VALID_POST_VIEWS) : undefined,
539
644
  status: options.status
540
645
  ? normalizeEnum(options.status, "status", VALID_POST_STATUSES)
541
646
  : undefined,
@@ -645,12 +750,13 @@ function registerCommands(program, runtimeApiKey, cliVersion) {
645
750
 
646
751
  program
647
752
  .command("posts:update")
648
- .description("Reschedule, re-queue, draft, or reposition a post")
753
+ .description("Edit a caption or change lifecycle of an unpublished non-poll post")
649
754
  .requiredOption("--brand-id <id>", "Brand ID")
650
755
  .requiredOption("--post-id <id>", "Post ID")
651
756
  .option("--publish-mode <mode>", `Publish mode (${VALID_POST_UPDATE_MODES.join(", ")})`)
652
757
  .option("--scheduled-at <value>", "Brand-local publish datetime (YYYY-MM-DD HH:mm:ss)")
653
758
  .option("--queue-position <position>", `Queue position (${VALID_QUEUE_POSITIONS.join(", ")})`)
759
+ .option("--caption <text>", "Updated post caption (up to 3000 characters)")
654
760
  .action(withCommandErrorHandling(program, async (options) => {
655
761
  const publishMode = options.publishMode
656
762
  ? normalizeEnum(options.publishMode, "publish-mode", VALID_POST_UPDATE_MODES)
@@ -659,8 +765,9 @@ function registerCommands(program, runtimeApiKey, cliVersion) {
659
765
  ? normalizeEnum(options.queuePosition, "queue-position", VALID_QUEUE_POSITIONS)
660
766
  : undefined;
661
767
  const scheduledAt = validatePostDateTime(options.scheduledAt, "scheduled-at");
662
- if (!publishMode && !queuePosition) {
663
- throw new Error("At least one of publish-mode or queue-position is required.");
768
+ const caption = options.caption === undefined ? undefined : validateRequiredString(options.caption, 3000, "caption");
769
+ if (!caption && !publishMode && !queuePosition) {
770
+ throw new Error("At least one of caption, publish-mode, or queue-position is required.");
664
771
  }
665
772
  if (publishMode === "SCHEDULE" && !scheduledAt) {
666
773
  throw new Error("scheduled-at is required when publish-mode is SCHEDULE.");
@@ -676,6 +783,7 @@ function registerCommands(program, runtimeApiKey, cliVersion) {
676
783
  publishMode,
677
784
  scheduledAt,
678
785
  queuePosition,
786
+ caption,
679
787
  },
680
788
  });
681
789
  }));
package/test/cli.test.mjs CHANGED
@@ -158,7 +158,7 @@ test("posts command supports all documented filter parameters", async () => {
158
158
  const result = runCli({
159
159
  args: [
160
160
  "posts", "--brand-id", "13493", "--collection-id", "33273",
161
- "--status", "pending", "--post-type", "image", "--posting-type", "schedule",
161
+ "--view", "queue", "--status", "pending", "--post-type", "image", "--posting-type", "schedule",
162
162
  "--created-from", "2026-10-01 00:00:00", "--created-to", "2026-10-31 23:59:59",
163
163
  "--sort-by", "post_date", "--sort-order", "ASC",
164
164
  ],
@@ -168,6 +168,7 @@ test("posts command supports all documented filter parameters", async () => {
168
168
 
169
169
  assert.equal(result.status, 0, result.stderr);
170
170
  const url = new URL(JSON.parse(await readFile(capturePath, "utf8")).url);
171
+ assert.equal(url.searchParams.get("view"), "QUEUE");
171
172
  assert.equal(url.searchParams.get("status"), "PENDING");
172
173
  assert.equal(url.searchParams.get("post_type"), "IMAGE");
173
174
  assert.equal(url.searchParams.get("posting_type"), "SCHEDULE");
@@ -284,6 +285,7 @@ test("quiet mode suppresses success banner", async () => {
284
285
 
285
286
  test("version flags print package version", async () => {
286
287
  const homeDir = await setupTempHome();
288
+ const packageManifest = JSON.parse(await readFile(path.join(workspaceRoot, "package.json"), "utf8"));
287
289
 
288
290
  for (const flag of ["--version", "-V"]) {
289
291
  const result = runCli({
@@ -294,7 +296,7 @@ test("version flags print package version", async () => {
294
296
  });
295
297
 
296
298
  assert.equal(result.status, 0, result.stderr);
297
- assert.equal(result.stdout.trim(), "1.5.0");
299
+ assert.equal(result.stdout.trim(), packageManifest.version);
298
300
  assert.equal(result.stderr, "");
299
301
  }
300
302
  });
@@ -743,6 +745,67 @@ test("dry-run prints validated request without sending", async () => {
743
745
  await assert.rejects(readFile(capturePath, "utf8"));
744
746
  });
745
747
 
748
+ test("new public API management commands build the documented requests", async () => {
749
+ const cases = [
750
+ {
751
+ args: ["automations:update-status", "--brand-id", "42", "--automation-id", "15", "--status", "paused"],
752
+ method: "PATCH",
753
+ pathname: "/api/public/v1/brands/42/automations/15",
754
+ body: { status: "PAUSED" },
755
+ },
756
+ {
757
+ args: ["collections:update", "--brand-id", "42", "--collection-id", "77", "--status", "paused"],
758
+ method: "PATCH",
759
+ pathname: "/api/public/v1/brands/42/collections/77",
760
+ body: { status: "PAUSED" },
761
+ },
762
+ {
763
+ args: ["collections:update", "--brand-id", "42", "--collection-id", "77", "--clear-description"],
764
+ method: "PATCH",
765
+ pathname: "/api/public/v1/brands/42/collections/77",
766
+ body: { description: null },
767
+ },
768
+ {
769
+ args: ["collections:add-channel", "--brand-id", "42", "--collection-id", "77", "--channel-id", "501"],
770
+ method: "POST",
771
+ pathname: "/api/public/v1/brands/42/collections/77/channels",
772
+ body: { channelId: 501 },
773
+ },
774
+ {
775
+ args: ["collections:remove-channel", "--brand-id", "42", "--collection-id", "77", "--channel-id", "501"],
776
+ method: "DELETE",
777
+ pathname: "/api/public/v1/brands/42/collections/77/channels/501",
778
+ },
779
+ {
780
+ args: ["collections:add-queue", "--brand-id", "42", "--collection-id", "77", "--date", "Mon 09:30"],
781
+ method: "POST",
782
+ pathname: "/api/public/v1/brands/42/collections/77/queues",
783
+ body: { date: "Mon 09:30" },
784
+ },
785
+ {
786
+ args: ["collections:delete-queue", "--brand-id", "42", "--collection-id", "77", "--queue-id", "911"],
787
+ method: "DELETE",
788
+ pathname: "/api/public/v1/brands/42/collections/77/queues/911",
789
+ },
790
+ ];
791
+
792
+ for (const [index, expected] of cases.entries()) {
793
+ const homeDir = await setupTempHome();
794
+ const result = runCli({
795
+ args: ["--dry-run", ...expected.args],
796
+ homeDir,
797
+ capturePath: path.join(homeDir, `capture-management-${index}.json`),
798
+ extraEnv: { NUELINK_API_KEY: "" },
799
+ });
800
+ assert.equal(result.status, 0, result.stderr);
801
+ const output = JSON.parse(result.stdout);
802
+ assert.equal(output.dryRun, true);
803
+ assert.equal(output.method, expected.method);
804
+ assert.equal(new URL(output.url).pathname, expected.pathname);
805
+ if (expected.body) assert.deepEqual(output.body, expected.body);
806
+ }
807
+ });
808
+
746
809
  test("posts:create builds full payload from options", async () => {
747
810
  const homeDir = await setupTempHome();
748
811
  const capturePath = path.join(homeDir, "capture-posts-create.json");
@@ -1121,6 +1184,22 @@ test("posts:update builds the documented patch payload", async () => {
1121
1184
  });
1122
1185
  });
1123
1186
 
1187
+ test("posts:update can edit a caption without changing its lifecycle state", async () => {
1188
+ const homeDir = await setupTempHome();
1189
+ const capturePath = path.join(homeDir, "capture-post-caption-update.json");
1190
+ const result = runCli({
1191
+ args: ["posts:update", "--brand-id", "42", "--post-id", "8801", "--caption", "Updated launch announcement."],
1192
+ homeDir,
1193
+ capturePath,
1194
+ });
1195
+
1196
+ assert.equal(result.status, 0, result.stderr);
1197
+ const capture = JSON.parse(await readFile(capturePath, "utf8"));
1198
+ assert.equal(capture.method, "PATCH");
1199
+ assert.equal(new URL(capture.url).pathname, "/api/public/v1/brands/42/posts/8801");
1200
+ assert.deepEqual(capture.body, { caption: "Updated launch announcement." });
1201
+ });
1202
+
1124
1203
  test("posts:move builds the documented atomic move payload", async () => {
1125
1204
  const homeDir = await setupTempHome();
1126
1205
  const capturePath = path.join(homeDir, "capture-post-move.json");
@@ -1168,7 +1247,7 @@ test("posts:update requires an update operation", async () => {
1168
1247
  });
1169
1248
 
1170
1249
  assert.equal(result.status, 1);
1171
- assert.match(result.stderr, /At least one of publish-mode or queue-position is required/);
1250
+ assert.match(result.stderr, /At least one of caption, publish-mode, or queue-position is required/);
1172
1251
  });
1173
1252
 
1174
1253
  test("posts:delete targets the sensitive delete endpoint", async () => {