@nuelink/nuelink-cli 1.6.2 → 1.6.4
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 +9 -0
- package/README.md +9 -3
- package/package.json +1 -1
- package/src/commands.js +1 -1
- package/src/output.js +2 -0
- package/src/postPayload.js +2 -3
- package/test/cli.test.mjs +57 -0
- package/test/mock-fetch.cjs +2 -0
- package/test/mock-fetch.mjs +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.6.4
|
|
4
|
+
|
|
5
|
+
- Default `posts:create --auto-thread-text` to true, with false available to disable automatic splitting.
|
|
6
|
+
|
|
7
|
+
## 1.6.3
|
|
8
|
+
|
|
9
|
+
- Show automation draft behavior and refresh interval in table output.
|
|
10
|
+
- Document CLI options for setting automation draft behavior and refresh interval.
|
|
11
|
+
|
|
3
12
|
## 1.6.2
|
|
4
13
|
|
|
5
14
|
- Show effective channel names in table output for posts and other resources with channel summaries.
|
package/README.md
CHANGED
|
@@ -191,9 +191,8 @@ with `--description`.
|
|
|
191
191
|
nuelink-cli automations --brand-id 13493 --per-page 5 --page 1
|
|
192
192
|
```
|
|
193
193
|
|
|
194
|
-
|
|
195
|
-
JSON
|
|
196
|
-
`refreshRate` (hours; 1, 6, 12, or 24).
|
|
194
|
+
The table and JSON output include `addPostsAsDraft` and `refreshRate`
|
|
195
|
+
(hours; 1, 6, 12, or 24). JSON also includes other fields returned by the API.
|
|
197
196
|
|
|
198
197
|
Create automation:
|
|
199
198
|
|
|
@@ -207,6 +206,8 @@ nuelink-cli automations:create \
|
|
|
207
206
|
--type RSS \
|
|
208
207
|
--title "{{title}}" \
|
|
209
208
|
--caption "{{description}} {{link}}" \
|
|
209
|
+
--add-posts-as-draft true \
|
|
210
|
+
--refresh-rate 6 \
|
|
210
211
|
--dry-run
|
|
211
212
|
```
|
|
212
213
|
|
|
@@ -275,6 +276,10 @@ You can also pipe JSON through stdin with `--payload -`.
|
|
|
275
276
|
CLI 1.6.0 and later preserves contract-nullable fields exactly; the dry-run body matches
|
|
276
277
|
the JSON body sent by the request.
|
|
277
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
|
+
|
|
278
283
|
Example `post.json`:
|
|
279
284
|
|
|
280
285
|
```json
|
|
@@ -295,6 +300,7 @@ nuelink-cli posts:create \
|
|
|
295
300
|
--caption "body here as well" \
|
|
296
301
|
--alt "is this fine" \
|
|
297
302
|
--link "https://nuelink.com" \
|
|
303
|
+
--auto-thread-text true \
|
|
298
304
|
--publish-mode DRAFT \
|
|
299
305
|
--post-as-story true \
|
|
300
306
|
--comment "this is a comment" \
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuelink/nuelink-cli",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.4",
|
|
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,7 +881,7 @@ 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")
|
package/src/output.js
CHANGED
package/src/postPayload.js
CHANGED
|
@@ -142,6 +142,7 @@ function buildPostPayload(options) {
|
|
|
142
142
|
const media = mergeMedia(options.mediaIds, options.mediaUrls);
|
|
143
143
|
const publishMode = normalizePublishMode(options.publishMode);
|
|
144
144
|
const scheduledAt = validateScheduledAt(options.scheduledAt);
|
|
145
|
+
const autoThreadText = parseBooleanStrict(options.autoThreadText, "auto-thread-text") ?? true;
|
|
145
146
|
|
|
146
147
|
if (publishMode === "SCHEDULE" && !scheduledAt) {
|
|
147
148
|
throw new Error("scheduledAt is required when publishMode is SCHEDULE.");
|
|
@@ -288,9 +289,7 @@ function buildPostPayload(options) {
|
|
|
288
289
|
...(options.link ? { link: validateHttpUrl(options.link, "link") } : {}),
|
|
289
290
|
publishMode,
|
|
290
291
|
scheduledAt,
|
|
291
|
-
|
|
292
|
-
? { autoThreadText: parseBooleanStrict(options.autoThreadText, "auto-thread-text") }
|
|
293
|
-
: {}),
|
|
292
|
+
autoThreadText,
|
|
294
293
|
...(parseBooleanStrict(options.postAsStory, "post-as-story") !== undefined
|
|
295
294
|
? { postAsStory: parseBooleanStrict(options.postAsStory, "post-as-story") }
|
|
296
295
|
: {}),
|
package/test/cli.test.mjs
CHANGED
|
@@ -177,6 +177,20 @@ test("automations command builds pagination query", async () => {
|
|
|
177
177
|
assert.equal(url.searchParams.get("page"), "2");
|
|
178
178
|
});
|
|
179
179
|
|
|
180
|
+
test("automation table shows draft setting and refresh interval", async () => {
|
|
181
|
+
const homeDir = await setupTempHome();
|
|
182
|
+
const result = runCli({
|
|
183
|
+
args: ["automations", "--brand-id", "13493"],
|
|
184
|
+
homeDir,
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
assert.equal(result.status, 0, result.stderr);
|
|
188
|
+
assert.match(result.stdout, /\|\s*Add Posts As Draft\s*\|/);
|
|
189
|
+
assert.match(result.stdout, /\|\s*Refresh Rate\s*\|/);
|
|
190
|
+
assert.match(result.stdout, /\|\s*true\s*\|/);
|
|
191
|
+
assert.match(result.stdout, /\|\s*6\s*\|/);
|
|
192
|
+
});
|
|
193
|
+
|
|
180
194
|
test("media command builds pagination query", async () => {
|
|
181
195
|
const homeDir = await setupTempHome();
|
|
182
196
|
const capturePath = path.join(homeDir, "capture-media.json");
|
|
@@ -500,6 +514,26 @@ test("automations:create works when boolean flags are omitted", async () => {
|
|
|
500
514
|
assert.equal(capture.body.addPostsAsDraft, undefined);
|
|
501
515
|
});
|
|
502
516
|
|
|
517
|
+
test("automations:create sends draft setting and refresh interval", async () => {
|
|
518
|
+
const homeDir = await setupTempHome();
|
|
519
|
+
const capturePath = path.join(homeDir, "capture-automation-options.json");
|
|
520
|
+
const result = runCli({
|
|
521
|
+
args: [
|
|
522
|
+
"automations:create", "--brand-id", "10", "--collection-id", "20",
|
|
523
|
+
"--feed-url", "https://example.com/feed.xml", "--import-as-type", "IMAGE",
|
|
524
|
+
"--type", "RSS", "--name", "Automation", "--add-posts-as-draft", "true",
|
|
525
|
+
"--refresh-rate", "6",
|
|
526
|
+
],
|
|
527
|
+
homeDir,
|
|
528
|
+
capturePath,
|
|
529
|
+
});
|
|
530
|
+
|
|
531
|
+
assert.equal(result.status, 0, result.stderr);
|
|
532
|
+
const capture = JSON.parse(await readFile(capturePath, "utf8"));
|
|
533
|
+
assert.equal(capture.body.addPostsAsDraft, true);
|
|
534
|
+
assert.equal(capture.body.refreshRate, 6);
|
|
535
|
+
});
|
|
536
|
+
|
|
503
537
|
test("auth:login stores token in isolated home config", async () => {
|
|
504
538
|
const homeDir = await setupTempHome();
|
|
505
539
|
const result = runCli({
|
|
@@ -1016,6 +1050,29 @@ test("posts:create builds full payload from options", async () => {
|
|
|
1016
1050
|
assert.equal(capture.body.platforms.googlemybusiness.uploadToPhotosSection, true);
|
|
1017
1051
|
});
|
|
1018
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
|
+
|
|
1019
1076
|
test("posts:create rejects invalid boolean values", async () => {
|
|
1020
1077
|
const homeDir = await setupTempHome();
|
|
1021
1078
|
|
package/test/mock-fetch.cjs
CHANGED
|
@@ -173,6 +173,8 @@ globalThis.fetch = async (input, init = {}) => {
|
|
|
173
173
|
feedUrl: "https://www.nasa.gov/rss/dyn/breaking_news.rss",
|
|
174
174
|
runCount: 0,
|
|
175
175
|
importAsType: "IMAGE",
|
|
176
|
+
addPostsAsDraft: true,
|
|
177
|
+
refreshRate: 6,
|
|
176
178
|
lastRun: 0,
|
|
177
179
|
title: "{{title}}",
|
|
178
180
|
caption: "{{description}} {{link}}",
|
package/test/mock-fetch.mjs
CHANGED
|
@@ -173,6 +173,8 @@ globalThis.fetch = async (input, init = {}) => {
|
|
|
173
173
|
feedUrl: "https://www.nasa.gov/rss/dyn/breaking_news.rss",
|
|
174
174
|
runCount: 0,
|
|
175
175
|
importAsType: "IMAGE",
|
|
176
|
+
addPostsAsDraft: true,
|
|
177
|
+
refreshRate: 6,
|
|
176
178
|
lastRun: 0,
|
|
177
179
|
title: "{{title}}",
|
|
178
180
|
caption: "{{description}} {{link}}",
|