@nuelink/nuelink-cli 1.6.1 → 1.6.3
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 +10 -0
- package/README.md +10 -4
- package/package.json +51 -51
- package/src/output.js +12 -5
- package/test/cli.test.mjs +64 -0
- package/test/mock-fetch.cjs +5 -0
- package/test/mock-fetch.mjs +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.6.3
|
|
4
|
+
|
|
5
|
+
- Show automation draft behavior and refresh interval in table output.
|
|
6
|
+
- Document CLI options for setting automation draft behavior and refresh interval.
|
|
7
|
+
|
|
8
|
+
## 1.6.2
|
|
9
|
+
|
|
10
|
+
- Show effective channel names in table output for posts and other resources with channel summaries.
|
|
11
|
+
- Document the post channels response shape and target-versus-collection behavior.
|
|
12
|
+
|
|
3
13
|
## 1.6.1
|
|
4
14
|
|
|
5
15
|
- Reject HTTP redirects for API requests so mutation bodies and credentials are never forwarded to redirect destinations.
|
package/README.md
CHANGED
|
@@ -191,7 +191,8 @@ with `--description`.
|
|
|
191
191
|
nuelink-cli automations --brand-id 13493 --per-page 5 --page 1
|
|
192
192
|
```
|
|
193
193
|
|
|
194
|
-
|
|
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.
|
|
195
196
|
|
|
196
197
|
Create automation:
|
|
197
198
|
|
|
@@ -205,6 +206,8 @@ nuelink-cli automations:create \
|
|
|
205
206
|
--type RSS \
|
|
206
207
|
--title "{{title}}" \
|
|
207
208
|
--caption "{{description}} {{link}}" \
|
|
209
|
+
--add-posts-as-draft true \
|
|
210
|
+
--refresh-rate 6 \
|
|
208
211
|
--dry-run
|
|
209
212
|
```
|
|
210
213
|
|
|
@@ -246,7 +249,10 @@ List posts:
|
|
|
246
249
|
nuelink-cli posts --brand-id 13493 --collection-id 33273 --per-page 5 --page 1
|
|
247
250
|
```
|
|
248
251
|
|
|
249
|
-
Post list output highlights the post ID, type, status,
|
|
252
|
+
Post list output highlights the post ID, type, status, publish date, and
|
|
253
|
+
effective channel names. In JSON mode, each post retains the API's full
|
|
254
|
+
channels array with id, name, status, and type; it lists post-targeted channels
|
|
255
|
+
when configured, otherwise the channels assigned to the collection.
|
|
250
256
|
Optional filters include `--status`, `--post-type`, `--posting-type`,
|
|
251
257
|
`--view` (`QUEUE`, `SCHEDULED`, `DRAFT`, or `PUBLISHED`), `--created-from`,
|
|
252
258
|
`--created-to`, `--sort-by`, and `--sort-order`.
|
|
@@ -267,7 +273,7 @@ nuelink-cli posts:add-json --brand-id 13493 --collection-id 33273 --payload ./po
|
|
|
267
273
|
```
|
|
268
274
|
|
|
269
275
|
You can also pipe JSON through stdin with `--payload -`.
|
|
270
|
-
CLI 1.6.0 preserves contract-nullable fields exactly; the dry-run body matches
|
|
276
|
+
CLI 1.6.0 and later preserves contract-nullable fields exactly; the dry-run body matches
|
|
271
277
|
the JSON body sent by the request.
|
|
272
278
|
|
|
273
279
|
Example `post.json`:
|
|
@@ -432,7 +438,7 @@ npm run check:pack:installed
|
|
|
432
438
|
|
|
433
439
|
## Release Checklist
|
|
434
440
|
|
|
435
|
-
1. Update version in
|
|
441
|
+
1. Update the version in package.json and package-lock.json, and add a matching entry at the top of CHANGELOG.md
|
|
436
442
|
2. Run `npm test`
|
|
437
443
|
3. Run `npm run check:pack`
|
|
438
444
|
4. Run `npm run check:pack:installed`
|
package/package.json
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@nuelink/nuelink-cli",
|
|
3
|
-
"version": "1.6.
|
|
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
|
-
"license": "MIT",
|
|
6
|
-
"author": "Nuelink",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/kreatinc/nuelink-cli.git"
|
|
10
|
-
},
|
|
11
|
-
"homepage": "https://github.com/kreatinc/nuelink-cli#readme",
|
|
12
|
-
"bugs": {
|
|
13
|
-
"url": "https://github.com/kreatinc/nuelink-cli/issues"
|
|
14
|
-
},
|
|
15
|
-
"type": "module",
|
|
16
|
-
"main": "./src/cli.js",
|
|
17
|
-
"scripts": {
|
|
18
|
-
"test": "node --test test/cli.test.mjs",
|
|
19
|
-
"smoke:auth": "node src/cli.js auth:status",
|
|
20
|
-
"check:pack": "node scripts/check-pack.mjs",
|
|
21
|
-
"check:pack:installed": "node scripts/check-packed-package.mjs"
|
|
22
|
-
},
|
|
23
|
-
"engines": {
|
|
24
|
-
"node": ">=18.17"
|
|
25
|
-
},
|
|
26
|
-
"files": [
|
|
27
|
-
"src",
|
|
28
|
-
"test",
|
|
29
|
-
"CHANGELOG.md",
|
|
30
|
-
"README.md",
|
|
31
|
-
"CONTRIBUTING.md",
|
|
32
|
-
"SECURITY.md",
|
|
33
|
-
"LICENSE"
|
|
34
|
-
],
|
|
35
|
-
"publishConfig": {
|
|
36
|
-
"access": "public"
|
|
37
|
-
},
|
|
38
|
-
"keywords": [
|
|
39
|
-
"nuelink",
|
|
40
|
-
"cli",
|
|
41
|
-
"social-media",
|
|
42
|
-
"automation"
|
|
43
|
-
],
|
|
44
|
-
"dependencies": {
|
|
45
|
-
"chalk": "^5.6.2",
|
|
46
|
-
"commander": "^13.1.0"
|
|
47
|
-
},
|
|
48
|
-
"bin": {
|
|
49
|
-
"nuelink-cli": "src/cli.js"
|
|
50
|
-
}
|
|
51
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@nuelink/nuelink-cli",
|
|
3
|
+
"version": "1.6.3",
|
|
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
|
+
"license": "MIT",
|
|
6
|
+
"author": "Nuelink",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/kreatinc/nuelink-cli.git"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/kreatinc/nuelink-cli#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/kreatinc/nuelink-cli/issues"
|
|
14
|
+
},
|
|
15
|
+
"type": "module",
|
|
16
|
+
"main": "./src/cli.js",
|
|
17
|
+
"scripts": {
|
|
18
|
+
"test": "node --test test/cli.test.mjs",
|
|
19
|
+
"smoke:auth": "node src/cli.js auth:status",
|
|
20
|
+
"check:pack": "node scripts/check-pack.mjs",
|
|
21
|
+
"check:pack:installed": "node scripts/check-packed-package.mjs"
|
|
22
|
+
},
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=18.17"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"src",
|
|
28
|
+
"test",
|
|
29
|
+
"CHANGELOG.md",
|
|
30
|
+
"README.md",
|
|
31
|
+
"CONTRIBUTING.md",
|
|
32
|
+
"SECURITY.md",
|
|
33
|
+
"LICENSE"
|
|
34
|
+
],
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public"
|
|
37
|
+
},
|
|
38
|
+
"keywords": [
|
|
39
|
+
"nuelink",
|
|
40
|
+
"cli",
|
|
41
|
+
"social-media",
|
|
42
|
+
"automation"
|
|
43
|
+
],
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"chalk": "^5.6.2",
|
|
46
|
+
"commander": "^13.1.0"
|
|
47
|
+
},
|
|
48
|
+
"bin": {
|
|
49
|
+
"nuelink-cli": "src/cli.js"
|
|
50
|
+
}
|
|
51
|
+
}
|
package/src/output.js
CHANGED
|
@@ -19,7 +19,11 @@ function formatCell(value, maxLength = 42) {
|
|
|
19
19
|
} else if (typeof value === "number" || typeof value === "boolean") {
|
|
20
20
|
text = String(value);
|
|
21
21
|
} else if (Array.isArray(value)) {
|
|
22
|
-
|
|
22
|
+
if (value.every((item) => item && typeof item === "object" && !Array.isArray(item))) {
|
|
23
|
+
text = value.map((item) => item.name ?? item.id ?? JSON.stringify(item)).join(", ") || "none";
|
|
24
|
+
} else {
|
|
25
|
+
text = "[" + value.map((item) => formatCell(item, 18)).join(", ") + "]";
|
|
26
|
+
}
|
|
23
27
|
} else {
|
|
24
28
|
text = JSON.stringify(value);
|
|
25
29
|
}
|
|
@@ -45,6 +49,9 @@ function pickColumns(items) {
|
|
|
45
49
|
"queueStatus",
|
|
46
50
|
"timezone",
|
|
47
51
|
"collectionId",
|
|
52
|
+
"addPostsAsDraft",
|
|
53
|
+
"refreshRate",
|
|
54
|
+
"channels",
|
|
48
55
|
"postType",
|
|
49
56
|
"postingType",
|
|
50
57
|
"postDate",
|
|
@@ -53,7 +60,7 @@ function pickColumns(items) {
|
|
|
53
60
|
"createdAt",
|
|
54
61
|
"updatedAt",
|
|
55
62
|
];
|
|
56
|
-
const excludedKeys = new Set(["body", "caption", "media", "poll", "platforms", "queues"
|
|
63
|
+
const excludedKeys = new Set(["body", "caption", "media", "poll", "platforms", "queues"]);
|
|
57
64
|
const presentKeys = new Set(items.flatMap((item) => Object.keys(item)));
|
|
58
65
|
|
|
59
66
|
const columns = preferredKeys.filter((key) => presentKeys.has(key) && !excludedKeys.has(key));
|
|
@@ -64,17 +71,17 @@ function pickColumns(items) {
|
|
|
64
71
|
columns.push(key);
|
|
65
72
|
}
|
|
66
73
|
|
|
67
|
-
if (columns.length >=
|
|
74
|
+
if (columns.length >= 8) {
|
|
68
75
|
break;
|
|
69
76
|
}
|
|
70
77
|
}
|
|
71
78
|
|
|
72
|
-
if (columns.length >=
|
|
79
|
+
if (columns.length >= 8) {
|
|
73
80
|
break;
|
|
74
81
|
}
|
|
75
82
|
}
|
|
76
83
|
|
|
77
|
-
return columns.slice(0,
|
|
84
|
+
return columns.slice(0, 8);
|
|
78
85
|
}
|
|
79
86
|
|
|
80
87
|
function renderTable(items) {
|
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");
|
|
@@ -318,6 +332,36 @@ test("brands command renders table output", async () => {
|
|
|
318
332
|
assert.match(result.stdout, /zapier/);
|
|
319
333
|
});
|
|
320
334
|
|
|
335
|
+
test("post list table shows effective channel names", async () => {
|
|
336
|
+
const homeDir = await setupTempHome();
|
|
337
|
+
const capturePath = path.join(homeDir, "capture-post-channels.json");
|
|
338
|
+
const result = runCli({
|
|
339
|
+
args: ["posts", "--brand-id", "42", "--collection-id", "77"],
|
|
340
|
+
homeDir,
|
|
341
|
+
capturePath,
|
|
342
|
+
});
|
|
343
|
+
|
|
344
|
+
assert.equal(result.status, 0, result.stderr);
|
|
345
|
+
assert.match(result.stdout, /\|\s*Channels\s*\|/);
|
|
346
|
+
assert.match(result.stdout, /Product Instagram/);
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
test("post JSON output preserves effective channel summaries", async () => {
|
|
350
|
+
const homeDir = await setupTempHome();
|
|
351
|
+
const capturePath = path.join(homeDir, "capture-post-channels-json.json");
|
|
352
|
+
const result = runCli({
|
|
353
|
+
args: ["--json", "posts", "--brand-id", "42", "--collection-id", "77"],
|
|
354
|
+
homeDir,
|
|
355
|
+
capturePath,
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
assert.equal(result.status, 0, result.stderr);
|
|
359
|
+
const output = JSON.parse(result.stdout);
|
|
360
|
+
assert.deepEqual(output.data[0].channels, [
|
|
361
|
+
{ id: 501, name: "Product Instagram", status: "ACTIVE", type: "Instagram" },
|
|
362
|
+
]);
|
|
363
|
+
});
|
|
364
|
+
|
|
321
365
|
test("brands command can force json output", async () => {
|
|
322
366
|
const homeDir = await setupTempHome();
|
|
323
367
|
const capturePath = path.join(homeDir, "capture-brands-json.json");
|
|
@@ -470,6 +514,26 @@ test("automations:create works when boolean flags are omitted", async () => {
|
|
|
470
514
|
assert.equal(capture.body.addPostsAsDraft, undefined);
|
|
471
515
|
});
|
|
472
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
|
+
|
|
473
537
|
test("auth:login stores token in isolated home config", async () => {
|
|
474
538
|
const homeDir = await setupTempHome();
|
|
475
539
|
const result = runCli({
|
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}}",
|
|
@@ -242,6 +244,9 @@ globalThis.fetch = async (input, init = {}) => {
|
|
|
242
244
|
postType: "IMAGE",
|
|
243
245
|
postingType: "SCHEDULE",
|
|
244
246
|
status: "PUBLISHED",
|
|
247
|
+
channels: [
|
|
248
|
+
{ id: 501, name: "Product Instagram", status: "ACTIVE", type: "Instagram" },
|
|
249
|
+
],
|
|
245
250
|
postDate: "2026-05-12 14:00:00",
|
|
246
251
|
createdAt: "2026-05-11T08:59:13.000000Z",
|
|
247
252
|
updatedAt: "2026-05-12T14:00:53.000000Z",
|
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}}",
|
|
@@ -242,6 +244,9 @@ globalThis.fetch = async (input, init = {}) => {
|
|
|
242
244
|
postType: "IMAGE",
|
|
243
245
|
postingType: "SCHEDULE",
|
|
244
246
|
status: "PUBLISHED",
|
|
247
|
+
channels: [
|
|
248
|
+
{ id: 501, name: "Product Instagram", status: "ACTIVE", type: "Instagram" },
|
|
249
|
+
],
|
|
245
250
|
postDate: "2026-05-12 14:00:00",
|
|
246
251
|
createdAt: "2026-05-11T08:59:13.000000Z",
|
|
247
252
|
updatedAt: "2026-05-12T14:00:53.000000Z",
|