@nuelink/nuelink-cli 1.6.3 → 1.6.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/CHANGELOG.md +8 -0
- package/README.md +9 -0
- package/package.json +1 -1
- package/src/commands.js +2 -2
- package/src/postPayload.js +5 -5
- package/test/cli.test.mjs +45 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.6.5
|
|
4
|
+
|
|
5
|
+
- Use minutes, with a minimum of 1, for delayed-comment values in post creation.
|
|
6
|
+
|
|
7
|
+
## 1.6.4
|
|
8
|
+
|
|
9
|
+
- Default `posts:create --auto-thread-text` to true, with false available to disable automatic splitting.
|
|
10
|
+
|
|
3
11
|
## 1.6.3
|
|
4
12
|
|
|
5
13
|
- Show automation draft behavior and refresh interval in table output.
|
package/README.md
CHANGED
|
@@ -276,6 +276,10 @@ You can also pipe JSON through stdin with `--payload -`.
|
|
|
276
276
|
CLI 1.6.0 and later preserves contract-nullable fields exactly; the dry-run body matches
|
|
277
277
|
the JSON body sent by the request.
|
|
278
278
|
|
|
279
|
+
If `autoThreadText` is omitted, the Public API defaults it to `true` and
|
|
280
|
+
automatically splits long text on supported platforms. Set it to `false` to
|
|
281
|
+
disable automatic splitting.
|
|
282
|
+
|
|
279
283
|
Example `post.json`:
|
|
280
284
|
|
|
281
285
|
```json
|
|
@@ -296,6 +300,7 @@ nuelink-cli posts:create \
|
|
|
296
300
|
--caption "body here as well" \
|
|
297
301
|
--alt "is this fine" \
|
|
298
302
|
--link "https://nuelink.com" \
|
|
303
|
+
--auto-thread-text true \
|
|
299
304
|
--publish-mode DRAFT \
|
|
300
305
|
--post-as-story true \
|
|
301
306
|
--comment "this is a comment" \
|
|
@@ -322,6 +327,10 @@ nuelink-cli posts:create \
|
|
|
322
327
|
--dry-run
|
|
323
328
|
```
|
|
324
329
|
|
|
330
|
+
`--comment-delay` is measured in minutes after publishing and must be a positive
|
|
331
|
+
integer (minimum `1`). Provide it together with `--comment`; the JSON/API field
|
|
332
|
+
is `comment.delay` and uses the same minutes unit.
|
|
333
|
+
|
|
325
334
|
Review each mutation preview, then repeat the same command without `--dry-run`
|
|
326
335
|
only when you intend to send it. `--dry-run` is supported for mutations; GET
|
|
327
336
|
commands reject it instead of silently suppressing the read. Post creation and
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuelink/nuelink-cli",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.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",
|
package/src/commands.js
CHANGED
|
@@ -881,12 +881,12 @@ function registerCommands(program, runtimeApiKey, cliVersion) {
|
|
|
881
881
|
.option("--caption <text>", "Post caption/body")
|
|
882
882
|
.option("--alt <text>", "Alt text")
|
|
883
883
|
.option("--link <url>", "Post link")
|
|
884
|
-
.option("--auto-thread-text <boolean>", "Automatically thread text: true/false")
|
|
884
|
+
.option("--auto-thread-text <boolean>", "Automatically thread text: true/false (defaults to true)")
|
|
885
885
|
.option("--publish-mode <mode>", `Publish mode (${VALID_PUBLISH_MODES.join(", ")})`, "DRAFT")
|
|
886
886
|
.option("--scheduled-at <value>", "Publish datetime (YYYY-MM-DD HH:mm:ss) or null")
|
|
887
887
|
.option("--post-as-story <boolean>", "Post as story: true/false")
|
|
888
888
|
.option("--comment <text>", "First comment")
|
|
889
|
-
.option("--comment-delay <
|
|
889
|
+
.option("--comment-delay <minutes>", "First comment delay in minutes (minimum 1)")
|
|
890
890
|
.option("--media-ids <ids>", "Comma-separated media IDs")
|
|
891
891
|
.option("--media-urls <urls>", "Comma-separated media URLs")
|
|
892
892
|
.option("--poll-question <text>", "Poll question")
|
package/src/postPayload.js
CHANGED
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
parseBooleanStrict,
|
|
3
3
|
parseJsonString,
|
|
4
4
|
parseOptionalNonNegativeInteger,
|
|
5
|
+
parseOptionalPositiveInteger,
|
|
5
6
|
splitCsv,
|
|
6
7
|
validateHttpUrl,
|
|
7
8
|
validatePollOptions,
|
|
@@ -142,6 +143,7 @@ function buildPostPayload(options) {
|
|
|
142
143
|
const media = mergeMedia(options.mediaIds, options.mediaUrls);
|
|
143
144
|
const publishMode = normalizePublishMode(options.publishMode);
|
|
144
145
|
const scheduledAt = validateScheduledAt(options.scheduledAt);
|
|
146
|
+
const autoThreadText = parseBooleanStrict(options.autoThreadText, "auto-thread-text") ?? true;
|
|
145
147
|
|
|
146
148
|
if (publishMode === "SCHEDULE" && !scheduledAt) {
|
|
147
149
|
throw new Error("scheduledAt is required when publishMode is SCHEDULE.");
|
|
@@ -288,9 +290,7 @@ function buildPostPayload(options) {
|
|
|
288
290
|
...(options.link ? { link: validateHttpUrl(options.link, "link") } : {}),
|
|
289
291
|
publishMode,
|
|
290
292
|
scheduledAt,
|
|
291
|
-
|
|
292
|
-
? { autoThreadText: parseBooleanStrict(options.autoThreadText, "auto-thread-text") }
|
|
293
|
-
: {}),
|
|
293
|
+
autoThreadText,
|
|
294
294
|
...(parseBooleanStrict(options.postAsStory, "post-as-story") !== undefined
|
|
295
295
|
? { postAsStory: parseBooleanStrict(options.postAsStory, "post-as-story") }
|
|
296
296
|
: {}),
|
|
@@ -298,8 +298,8 @@ function buildPostPayload(options) {
|
|
|
298
298
|
? {
|
|
299
299
|
comment: {
|
|
300
300
|
comment: options.comment,
|
|
301
|
-
...(
|
|
302
|
-
? { delay:
|
|
301
|
+
...(parseOptionalPositiveInteger(options.commentDelay, "comment-delay") !== undefined
|
|
302
|
+
? { delay: parseOptionalPositiveInteger(options.commentDelay, "comment-delay") }
|
|
303
303
|
: {}),
|
|
304
304
|
},
|
|
305
305
|
}
|
package/test/cli.test.mjs
CHANGED
|
@@ -1050,6 +1050,29 @@ test("posts:create builds full payload from options", async () => {
|
|
|
1050
1050
|
assert.equal(capture.body.platforms.googlemybusiness.uploadToPhotosSection, true);
|
|
1051
1051
|
});
|
|
1052
1052
|
|
|
1053
|
+
test("posts:create defaults autoThreadText to true and accepts false override", async () => {
|
|
1054
|
+
const homeDir = await setupTempHome();
|
|
1055
|
+
|
|
1056
|
+
for (const [suffix, extraArgs, expected] of [
|
|
1057
|
+
["default", [], true],
|
|
1058
|
+
["disabled", ["--auto-thread-text", "false"], false],
|
|
1059
|
+
]) {
|
|
1060
|
+
const capturePath = path.join(homeDir, `capture-post-thread-text-${suffix}.json`);
|
|
1061
|
+
const result = runCli({
|
|
1062
|
+
args: [
|
|
1063
|
+
"posts:create", "--brand-id", "13493", "--collection-id", "33273",
|
|
1064
|
+
"--caption", "Post body", ...extraArgs,
|
|
1065
|
+
],
|
|
1066
|
+
homeDir,
|
|
1067
|
+
capturePath,
|
|
1068
|
+
});
|
|
1069
|
+
|
|
1070
|
+
assert.equal(result.status, 0, result.stderr);
|
|
1071
|
+
const capture = JSON.parse(await readFile(capturePath, "utf8"));
|
|
1072
|
+
assert.equal(capture.body.autoThreadText, expected);
|
|
1073
|
+
}
|
|
1074
|
+
});
|
|
1075
|
+
|
|
1053
1076
|
test("posts:create rejects invalid boolean values", async () => {
|
|
1054
1077
|
const homeDir = await setupTempHome();
|
|
1055
1078
|
|
|
@@ -1506,6 +1529,28 @@ test("posts:create requires comment and comment-delay as a pair", async () => {
|
|
|
1506
1529
|
}
|
|
1507
1530
|
});
|
|
1508
1531
|
|
|
1532
|
+
test("posts:create requires a positive comment delay in minutes", async () => {
|
|
1533
|
+
const homeDir = await setupTempHome();
|
|
1534
|
+
const capturePath = path.join(homeDir, "capture-comment-zero.json");
|
|
1535
|
+
const result = runCli({
|
|
1536
|
+
args: [
|
|
1537
|
+
"posts:create",
|
|
1538
|
+
"--brand-id", "1",
|
|
1539
|
+
"--collection-id", "2",
|
|
1540
|
+
"--caption", "Post body",
|
|
1541
|
+
"--comment", "First comment",
|
|
1542
|
+
"--comment-delay", "0",
|
|
1543
|
+
"--dry-run",
|
|
1544
|
+
],
|
|
1545
|
+
homeDir,
|
|
1546
|
+
capturePath,
|
|
1547
|
+
});
|
|
1548
|
+
|
|
1549
|
+
assert.equal(result.status, 1);
|
|
1550
|
+
assert.match(result.stderr, /Invalid comment-delay\. Expected a positive integer/);
|
|
1551
|
+
await assert.rejects(readFile(capturePath, "utf8"));
|
|
1552
|
+
});
|
|
1553
|
+
|
|
1509
1554
|
test("JSON mode without a command returns a structured usage error", async () => {
|
|
1510
1555
|
const homeDir = await setupTempHome();
|
|
1511
1556
|
const result = runCli({
|