@nodaro/cli 1.24.0 → 1.25.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/README.md +3 -1
- package/dist/index.js +470 -32
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import { createClient, StaticTokenAuth, UnauthorizedError, NodaroError, LOCATION
|
|
|
13
13
|
import select from '@inquirer/select';
|
|
14
14
|
import checkbox from '@inquirer/checkbox';
|
|
15
15
|
import input from '@inquirer/input';
|
|
16
|
-
import { CHARACTER_STYLES, TRANSCRIBE_PROVIDERS, transcribeLaneSupportsWordTimestamps, ALL_CAPTION_STYLES, DEFAULT_CAPTION_LOOK, CAPTION_LOOK_IDS, CAPTION_MAX_WORDS_PER_LINE_MIN, CAPTION_MAX_WORDS_PER_LINE_MAX, TRANSCRIBE_LANES, SUPPORTED_FONT_NAMES, OVERLAY_ANCHORS, OVERLAY_PLATFORM_IDS, VIDEO_OVERLAY_PRESET_IDS, VIDEO_OVERLAY_CORNERS, VIDEO_OVERLAY_OUTPUT_ASPECTS, isVideoOverlayPresetId, isVideoOverlayCorner, isVideoOverlayOutputAspect, VIDEO_OVERLAY_FITS, DEFAULT_TRANSCRIBE_PROVIDER } from '@nodaro/shared';
|
|
16
|
+
import { CHARACTER_STYLES, TRANSCRIBE_PROVIDERS, transcribeLaneSupportsWordTimestamps, ALL_CAPTION_STYLES, DEFAULT_CAPTION_LOOK, CAPTION_LOOK_IDS, CAPTION_MAX_WORDS_PER_LINE_MIN, CAPTION_MAX_WORDS_PER_LINE_MAX, TRANSCRIBE_LANES, SUPPORTED_FONT_NAMES, OVERLAY_ANCHORS, OVERLAY_PLATFORM_IDS, VIDEO_OVERLAY_PRESET_IDS, VIDEO_OVERLAY_CORNERS, VIDEO_OVERLAY_OUTPUT_ASPECTS, isVideoOverlayPresetId, isVideoOverlayCorner, isVideoOverlayOutputAspect, VIDEO_OVERLAY_FITS, DEFAULT_TRANSCRIBE_PROVIDER, SOCIAL_PLATFORMS, COMPETITOR_ACCOUNT_KEYS, isMeasurableCard, isSocialPost, COMPETITOR_ABOUT_PLATFORMS, COMPETITOR_SCHEDULES, RECAST_SEGMENT_PACKS } from '@nodaro/shared';
|
|
17
17
|
|
|
18
18
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
19
19
|
var __commonJS = (cb, mod) => function __require() {
|
|
@@ -29,7 +29,7 @@ var require_package = __commonJS({
|
|
|
29
29
|
"package.json"(exports$1, module) {
|
|
30
30
|
module.exports = {
|
|
31
31
|
name: "@nodaro/cli",
|
|
32
|
-
version: "1.
|
|
32
|
+
version: "1.25.0",
|
|
33
33
|
description: "Command-line interface for Nodaro \u2014 list and run workflows, inspect jobs and executions, manage projects from the terminal.",
|
|
34
34
|
type: "module",
|
|
35
35
|
license: "Apache-2.0",
|
|
@@ -70,11 +70,11 @@ var require_package = __commonJS({
|
|
|
70
70
|
"@inquirer/confirm": "^6.0.12",
|
|
71
71
|
"@inquirer/input": "^5.0.12",
|
|
72
72
|
"@inquirer/select": "^5.1.4",
|
|
73
|
-
"@nodaro/sdk": "^2.
|
|
74
|
-
"@nodaro/shared": "^3.
|
|
73
|
+
"@nodaro/sdk": "^2.18.0",
|
|
74
|
+
"@nodaro/shared": "^3.15.0",
|
|
75
75
|
commander: "^12.1.0",
|
|
76
76
|
picocolors: "^1.1.1",
|
|
77
|
-
"@nodaro/prompts": "^1.
|
|
77
|
+
"@nodaro/prompts": "^1.28.0"
|
|
78
78
|
},
|
|
79
79
|
devDependencies: {
|
|
80
80
|
tsup: "^8.5.0",
|
|
@@ -168,14 +168,14 @@ function dim(line) {
|
|
|
168
168
|
function warn(line) {
|
|
169
169
|
console.error(pc3.yellow("\u26A0") + " " + line);
|
|
170
170
|
}
|
|
171
|
-
function table(
|
|
172
|
-
if (
|
|
171
|
+
function table(rows2, columns) {
|
|
172
|
+
if (rows2.length === 0) {
|
|
173
173
|
console.log(pc3.dim("(empty)"));
|
|
174
174
|
return;
|
|
175
175
|
}
|
|
176
176
|
const widths = {};
|
|
177
177
|
for (const col of columns) widths[col] = col.length;
|
|
178
|
-
for (const row of
|
|
178
|
+
for (const row of rows2) {
|
|
179
179
|
for (const col of columns) {
|
|
180
180
|
const cell = format(row[col]);
|
|
181
181
|
if (cell.length > widths[col]) widths[col] = cell.length;
|
|
@@ -184,7 +184,7 @@ function table(rows, columns) {
|
|
|
184
184
|
for (const col of columns) widths[col] = Math.min(widths[col], 60);
|
|
185
185
|
console.log(columns.map((c) => pc3.bold(c.padEnd(widths[c]))).join(" "));
|
|
186
186
|
console.log(columns.map((c) => "-".repeat(widths[c])).join(" "));
|
|
187
|
-
for (const row of
|
|
187
|
+
for (const row of rows2) {
|
|
188
188
|
console.log(
|
|
189
189
|
columns.map((c) => {
|
|
190
190
|
const cell = format(row[c]);
|
|
@@ -398,7 +398,7 @@ function saveWorkspace(profileName, workspaceId) {
|
|
|
398
398
|
}
|
|
399
399
|
|
|
400
400
|
// src/client.ts
|
|
401
|
-
var CLI_VERSION = "1.
|
|
401
|
+
var CLI_VERSION = "1.25.0" ;
|
|
402
402
|
function buildClient(profileName) {
|
|
403
403
|
const { name, profile } = getProfile(profileName);
|
|
404
404
|
if (!profile) {
|
|
@@ -1687,7 +1687,7 @@ function promptCommand() {
|
|
|
1687
1687
|
const cmd = new Command("prompt").description(
|
|
1688
1688
|
"AI prompt wizard \u2014 analyze, generate, and enhance prompts for generation nodes"
|
|
1689
1689
|
);
|
|
1690
|
-
cmd.command("wizard").description("interactive: answer guided questions and get an optimized prompt").option("--node-type <type>", "target node type (omit for an interactive picker)").option("--prompt <text>", "your rough idea (optional)").option("--provider <name>").option("--style <name>").option("--aspect-ratio <ratio>").option("--duration <seconds>", "clip duration in seconds", (v) => parseInt(v, 10)).option("--llm-model <id>").option("--reasoning-effort <level>", "reasoning effort: none|low|medium|high|xhigh|max (model-dependent)").option("--advanced", "Gemini models only: run on the provider's own API so --temperature/--max-tokens/the full reasoning range apply. Bills one credit tier up.").option("--temperature <n>", "Sampling temperature (only with --advanced)", parseFloat).option("--max-tokens <n>", "Output token cap (only with --advanced)", (v) => parseInt(v, 10)).option("--profile <name>").action(async (opts) => {
|
|
1690
|
+
cmd.command("wizard").description("interactive: answer guided questions and get an optimized prompt").option("--node-type <type>", "target node type (omit for an interactive picker)").option("--prompt <text>", "your rough idea (optional)").option("--provider <name>").option("--style <name>").option("--aspect-ratio <ratio>").option("--duration <seconds>", "clip duration in seconds", (v) => parseInt(v, 10)).option("--llm-model <id>").option("--reasoning-effort <level>", "reasoning effort: none|low|medium|high|xhigh|max (model-dependent)").option("--advanced", "Gemini models only: run on the provider's own API so --temperature/--max-tokens/the full reasoning range apply. Bills one credit tier up, capped at premium.").option("--temperature <n>", "Sampling temperature (only with --advanced)", parseFloat).option("--max-tokens <n>", "Output token cap (only with --advanced)", (v) => parseInt(v, 10)).option("--profile <name>").action(async (opts) => {
|
|
1691
1691
|
try {
|
|
1692
1692
|
if (!isInteractive()) {
|
|
1693
1693
|
warn("`prompt wizard` needs an interactive terminal \u2014 use `prompt analyze` + `prompt generate`, or `prompt enhance`, in scripts.");
|
|
@@ -1737,7 +1737,7 @@ function promptCommand() {
|
|
|
1737
1737
|
handleError(err);
|
|
1738
1738
|
}
|
|
1739
1739
|
});
|
|
1740
|
-
cmd.command("analyze").description("return guided questions for a rough prompt idea").requiredOption("--node-type <type>").option("--prompt <text>").option("--provider <name>").option("--style <name>").option("--aspect-ratio <ratio>").option("--duration <seconds>", "clip duration in seconds", (v) => parseInt(v, 10)).option("--llm-model <id>").option("--reasoning-effort <level>", "reasoning effort: none|low|medium|high|xhigh|max (model-dependent)").option("--advanced", "Gemini models only: run on the provider's own API so --temperature/--max-tokens/the full reasoning range apply. Bills one credit tier up.").option("--temperature <n>", "Sampling temperature (only with --advanced)", parseFloat).option("--max-tokens <n>", "Output token cap (only with --advanced)", (v) => parseInt(v, 10)).option("--profile <name>").option("--json").action(async (opts) => {
|
|
1740
|
+
cmd.command("analyze").description("return guided questions for a rough prompt idea").requiredOption("--node-type <type>").option("--prompt <text>").option("--provider <name>").option("--style <name>").option("--aspect-ratio <ratio>").option("--duration <seconds>", "clip duration in seconds", (v) => parseInt(v, 10)).option("--llm-model <id>").option("--reasoning-effort <level>", "reasoning effort: none|low|medium|high|xhigh|max (model-dependent)").option("--advanced", "Gemini models only: run on the provider's own API so --temperature/--max-tokens/the full reasoning range apply. Bills one credit tier up, capped at premium.").option("--temperature <n>", "Sampling temperature (only with --advanced)", parseFloat).option("--max-tokens <n>", "Output token cap (only with --advanced)", (v) => parseInt(v, 10)).option("--profile <name>").option("--json").action(async (opts) => {
|
|
1741
1741
|
try {
|
|
1742
1742
|
const client = buildClient(opts.profile);
|
|
1743
1743
|
const { jobId, questions } = await client.promptHelper.analyze({
|
|
@@ -1762,7 +1762,7 @@ function promptCommand() {
|
|
|
1762
1762
|
handleError(err);
|
|
1763
1763
|
}
|
|
1764
1764
|
});
|
|
1765
|
-
cmd.command("generate").description("build an optimized prompt from --selection category=value flags").requiredOption("--node-type <type>").option("--selection <pairs...>", "category=value (repeat); custom answers are wizard-only", collectVariadic).option("--original-prompt <text>").option("--provider <name>").option("--style <name>").option("--aspect-ratio <ratio>").option("--duration <seconds>", "clip duration in seconds", (v) => parseInt(v, 10)).option("--llm-model <id>").option("--reasoning-effort <level>", "reasoning effort: none|low|medium|high|xhigh|max (model-dependent)").option("--advanced", "Gemini models only: run on the provider's own API so --temperature/--max-tokens/the full reasoning range apply. Bills one credit tier up.").option("--temperature <n>", "Sampling temperature (only with --advanced)", parseFloat).option("--max-tokens <n>", "Output token cap (only with --advanced)", (v) => parseInt(v, 10)).option("--profile <name>").option("--json").action(async (opts) => {
|
|
1765
|
+
cmd.command("generate").description("build an optimized prompt from --selection category=value flags").requiredOption("--node-type <type>").option("--selection <pairs...>", "category=value (repeat); custom answers are wizard-only", collectVariadic).option("--original-prompt <text>").option("--provider <name>").option("--style <name>").option("--aspect-ratio <ratio>").option("--duration <seconds>", "clip duration in seconds", (v) => parseInt(v, 10)).option("--llm-model <id>").option("--reasoning-effort <level>", "reasoning effort: none|low|medium|high|xhigh|max (model-dependent)").option("--advanced", "Gemini models only: run on the provider's own API so --temperature/--max-tokens/the full reasoning range apply. Bills one credit tier up, capped at premium.").option("--temperature <n>", "Sampling temperature (only with --advanced)", parseFloat).option("--max-tokens <n>", "Output token cap (only with --advanced)", (v) => parseInt(v, 10)).option("--profile <name>").option("--json").action(async (opts) => {
|
|
1766
1766
|
try {
|
|
1767
1767
|
const client = buildClient(opts.profile);
|
|
1768
1768
|
const selections = parseSelectionPairs(opts.selection);
|
|
@@ -1782,7 +1782,7 @@ function promptCommand() {
|
|
|
1782
1782
|
handleError(err);
|
|
1783
1783
|
}
|
|
1784
1784
|
});
|
|
1785
|
-
cmd.command("enhance").description("rewrite a rough idea into one optimized prompt (no questions)").requiredOption("--node-type <type>").option("--prompt <text>").option("--provider <name>").option("--style <name>").option("--aspect-ratio <ratio>").option("--duration <seconds>", "clip duration in seconds", (v) => parseInt(v, 10)).option("--llm-model <id>").option("--reasoning-effort <level>", "reasoning effort: none|low|medium|high|xhigh|max (model-dependent)").option("--advanced", "Gemini models only: run on the provider's own API so --temperature/--max-tokens/the full reasoning range apply. Bills one credit tier up.").option("--temperature <n>", "Sampling temperature (only with --advanced)", parseFloat).option("--max-tokens <n>", "Output token cap (only with --advanced)", (v) => parseInt(v, 10)).option("--profile <name>").option("--json").action(async (opts) => {
|
|
1785
|
+
cmd.command("enhance").description("rewrite a rough idea into one optimized prompt (no questions)").requiredOption("--node-type <type>").option("--prompt <text>").option("--provider <name>").option("--style <name>").option("--aspect-ratio <ratio>").option("--duration <seconds>", "clip duration in seconds", (v) => parseInt(v, 10)).option("--llm-model <id>").option("--reasoning-effort <level>", "reasoning effort: none|low|medium|high|xhigh|max (model-dependent)").option("--advanced", "Gemini models only: run on the provider's own API so --temperature/--max-tokens/the full reasoning range apply. Bills one credit tier up, capped at premium.").option("--temperature <n>", "Sampling temperature (only with --advanced)", parseFloat).option("--max-tokens <n>", "Output token cap (only with --advanced)", (v) => parseInt(v, 10)).option("--profile <name>").option("--json").action(async (opts) => {
|
|
1786
1786
|
try {
|
|
1787
1787
|
const client = buildClient(opts.profile);
|
|
1788
1788
|
const result = await client.promptHelper.enhance({
|
|
@@ -2246,16 +2246,16 @@ Example:
|
|
|
2246
2246
|
clones.command("list").description("list your voice clones").option("--profile <name>").option("--json").action(async (opts) => {
|
|
2247
2247
|
try {
|
|
2248
2248
|
const client = buildClient(opts.profile);
|
|
2249
|
-
const
|
|
2249
|
+
const rows2 = await client.voices.listClones();
|
|
2250
2250
|
if (opts.json) {
|
|
2251
|
-
emit(
|
|
2251
|
+
emit(rows2, opts);
|
|
2252
2252
|
return;
|
|
2253
2253
|
}
|
|
2254
2254
|
table(
|
|
2255
|
-
|
|
2255
|
+
rows2.map((c) => ({ name: c.name, voice_id: c.elevenlabsVoiceId, clone_id: c.id, created: c.createdAt })),
|
|
2256
2256
|
["name", "voice_id", "clone_id", "created"]
|
|
2257
2257
|
);
|
|
2258
|
-
dim(`${
|
|
2258
|
+
dim(`${rows2.length} clone${rows2.length === 1 ? "" : "s"} \u2014 pass voice_id to --voice / --voices`);
|
|
2259
2259
|
} catch (err) {
|
|
2260
2260
|
handleError(err);
|
|
2261
2261
|
}
|
|
@@ -3199,6 +3199,401 @@ function presetsCommand() {
|
|
|
3199
3199
|
});
|
|
3200
3200
|
return cmd;
|
|
3201
3201
|
}
|
|
3202
|
+
function postFromJson(value, index2 = 0) {
|
|
3203
|
+
const candidate = Array.isArray(value) ? value[index2] : value;
|
|
3204
|
+
if (!isSocialPost(candidate)) {
|
|
3205
|
+
throw new Error(
|
|
3206
|
+
Array.isArray(value) ? `item ${index2} of the file is not a Social Search post` : "the file is not a Social Search post (or a list of them)"
|
|
3207
|
+
);
|
|
3208
|
+
}
|
|
3209
|
+
return candidate;
|
|
3210
|
+
}
|
|
3211
|
+
function readJson(path) {
|
|
3212
|
+
let raw;
|
|
3213
|
+
try {
|
|
3214
|
+
raw = readFileSync(path === "-" ? 0 : path, "utf8");
|
|
3215
|
+
} catch (err) {
|
|
3216
|
+
throw new Error(`cannot read ${path}: ${err.message}`);
|
|
3217
|
+
}
|
|
3218
|
+
try {
|
|
3219
|
+
return JSON.parse(raw);
|
|
3220
|
+
} catch (err) {
|
|
3221
|
+
throw new Error(`${path} is not valid JSON: ${err.message}`);
|
|
3222
|
+
}
|
|
3223
|
+
}
|
|
3224
|
+
function parsePlatform(raw) {
|
|
3225
|
+
if (raw === void 0) return void 0;
|
|
3226
|
+
if (!SOCIAL_PLATFORMS.includes(raw)) {
|
|
3227
|
+
throw new Error(`--platform must be one of ${SOCIAL_PLATFORMS.join(", ")}`);
|
|
3228
|
+
}
|
|
3229
|
+
return raw;
|
|
3230
|
+
}
|
|
3231
|
+
function shorten(text, max) {
|
|
3232
|
+
const flat = text.replace(/\s+/g, " ").trim();
|
|
3233
|
+
return flat.length > max ? `${flat.slice(0, max - 1)}\u2026` : flat;
|
|
3234
|
+
}
|
|
3235
|
+
function savedPostsCommand() {
|
|
3236
|
+
const cmd = new Command("saved-posts").description(
|
|
3237
|
+
"your inspiration wall: posts saved from Social Search, with notes and tags"
|
|
3238
|
+
);
|
|
3239
|
+
cmd.command("list").description("list your saved posts, newest first").option("--platform <platform>", `one of ${SOCIAL_PLATFORMS.join(", ")}`).option("--tag <tag>", "only saves with this tag").option("--q <words>", "words in the note or the post").option("--limit <n>", "page size, 1-100 (default 40)").option("--cursor <cursor>", "the next cursor printed by the previous page").option("--profile <name>").option("--json").action(async (opts) => {
|
|
3240
|
+
try {
|
|
3241
|
+
const client = buildClient(opts.profile);
|
|
3242
|
+
const page = await client.savedPosts.list({
|
|
3243
|
+
platform: parsePlatform(opts.platform),
|
|
3244
|
+
tag: opts.tag,
|
|
3245
|
+
q: opts.q,
|
|
3246
|
+
limit: opts.limit ? Number(opts.limit) : void 0,
|
|
3247
|
+
cursor: opts.cursor
|
|
3248
|
+
});
|
|
3249
|
+
if (opts.json) {
|
|
3250
|
+
emit(page, opts);
|
|
3251
|
+
return;
|
|
3252
|
+
}
|
|
3253
|
+
table(
|
|
3254
|
+
page.data.map((s) => ({
|
|
3255
|
+
id: s.id,
|
|
3256
|
+
platform: s.platform,
|
|
3257
|
+
author: s.post.author.handle ? `@${s.post.author.handle.replace(/^@/, "")}` : s.post.author.name,
|
|
3258
|
+
saved: s.createdAt.slice(0, 10),
|
|
3259
|
+
note: shorten(s.note, 40),
|
|
3260
|
+
tags: s.tags.join(","),
|
|
3261
|
+
url: s.url
|
|
3262
|
+
})),
|
|
3263
|
+
["id", "platform", "author", "saved", "note", "tags", "url"]
|
|
3264
|
+
);
|
|
3265
|
+
if (page.nextCursor) success(`more: --cursor "${page.nextCursor}"`);
|
|
3266
|
+
} catch (err) {
|
|
3267
|
+
handleError(err);
|
|
3268
|
+
}
|
|
3269
|
+
});
|
|
3270
|
+
cmd.command("save").description("save a post from a JSON file (one post, or a Social Search output list with --index)").requiredOption("--file <path>", "the post as JSON; - reads stdin").option("--index <n>", "which post of a list to save (default 0)").option("--note <text>", "why it is worth keeping").option("--tag <tag>", "a tag (repeat for more)", collectVariadic).option("--profile <name>").option("--json").action(async (opts) => {
|
|
3271
|
+
try {
|
|
3272
|
+
const post = postFromJson(readJson(opts.file), opts.index ? Number(opts.index) : 0);
|
|
3273
|
+
const client = buildClient(opts.profile);
|
|
3274
|
+
const save = await client.savedPosts.save({ post, note: opts.note, tags: opts.tag, source: "manual" });
|
|
3275
|
+
if (opts.json) {
|
|
3276
|
+
emit(save, opts);
|
|
3277
|
+
return;
|
|
3278
|
+
}
|
|
3279
|
+
success(`saved ${save.url} (id ${save.id})`);
|
|
3280
|
+
} catch (err) {
|
|
3281
|
+
handleError(err);
|
|
3282
|
+
}
|
|
3283
|
+
});
|
|
3284
|
+
cmd.command("update <id>").description("change a save's note or tags (the tags you give replace the old ones)").option("--note <text>", "the new note; an empty string clears it").option("--tag <tag>", "a tag (repeat for more)", collectVariadic).option("--clear-tags", "remove every tag").option("--profile <name>").option("--json").action(async (id, opts) => {
|
|
3285
|
+
try {
|
|
3286
|
+
const tags = opts.clearTags ? [] : opts.tag;
|
|
3287
|
+
if (opts.note === void 0 && tags === void 0) {
|
|
3288
|
+
throw new Error("nothing to change: give --note, --tag or --clear-tags");
|
|
3289
|
+
}
|
|
3290
|
+
const client = buildClient(opts.profile);
|
|
3291
|
+
const save = await client.savedPosts.update(id, { note: opts.note, tags });
|
|
3292
|
+
if (opts.json) {
|
|
3293
|
+
emit(save, opts);
|
|
3294
|
+
return;
|
|
3295
|
+
}
|
|
3296
|
+
success(`updated ${save.id}`);
|
|
3297
|
+
} catch (err) {
|
|
3298
|
+
handleError(err);
|
|
3299
|
+
}
|
|
3300
|
+
});
|
|
3301
|
+
cmd.command("delete <id>").description("remove a save and its copied still").option("--profile <name>").action(async (id, opts) => {
|
|
3302
|
+
try {
|
|
3303
|
+
const client = buildClient(opts.profile);
|
|
3304
|
+
await client.savedPosts.delete(id);
|
|
3305
|
+
success(`deleted ${id}`);
|
|
3306
|
+
} catch (err) {
|
|
3307
|
+
handleError(err);
|
|
3308
|
+
}
|
|
3309
|
+
});
|
|
3310
|
+
return cmd;
|
|
3311
|
+
}
|
|
3312
|
+
function accountsFromFlags(flags) {
|
|
3313
|
+
const pairs = [
|
|
3314
|
+
["tiktok", flags.tiktok],
|
|
3315
|
+
["instagram", flags.instagram],
|
|
3316
|
+
["youtube", flags.youtube],
|
|
3317
|
+
["x", flags.x],
|
|
3318
|
+
["linkedin", flags.linkedin],
|
|
3319
|
+
["meta_ads", flags.metaAds]
|
|
3320
|
+
];
|
|
3321
|
+
return Object.fromEntries(pairs.filter(([, v]) => v !== void 0 && v.trim() !== ""));
|
|
3322
|
+
}
|
|
3323
|
+
function parseClear(raw) {
|
|
3324
|
+
if (raw === void 0) return [];
|
|
3325
|
+
const wanted = raw.split(",").map((p) => p.trim().replace(/-/g, "_")).filter(Boolean);
|
|
3326
|
+
const bad = wanted.filter((p) => !COMPETITOR_ACCOUNT_KEYS.includes(p));
|
|
3327
|
+
if (bad.length > 0) throw new Error(`--clear takes ${COMPETITOR_ACCOUNT_KEYS.join(", ")} (got ${bad.join(", ")})`);
|
|
3328
|
+
return wanted;
|
|
3329
|
+
}
|
|
3330
|
+
function mergeAccounts(current, set, clear) {
|
|
3331
|
+
const both = clear.filter((key2) => set[key2] !== void 0);
|
|
3332
|
+
if (both.length > 0) throw new Error(`cannot both set and clear ${both.join(", ")}`);
|
|
3333
|
+
const merged = { ...current, ...set };
|
|
3334
|
+
return Object.fromEntries(
|
|
3335
|
+
Object.entries(merged).filter(([key2, value]) => !clear.includes(key2) && typeof value === "string" && value.trim() !== "")
|
|
3336
|
+
);
|
|
3337
|
+
}
|
|
3338
|
+
function parseAbout(raw) {
|
|
3339
|
+
if (raw === void 0) return void 0;
|
|
3340
|
+
const wanted = raw.split(",").map((p) => p.trim()).filter(Boolean);
|
|
3341
|
+
const bad = wanted.filter((p) => !COMPETITOR_ABOUT_PLATFORMS.includes(p));
|
|
3342
|
+
if (bad.length > 0) throw new Error(`--about takes ${COMPETITOR_ABOUT_PLATFORMS.join(", ")} (got ${bad.join(", ")})`);
|
|
3343
|
+
return wanted;
|
|
3344
|
+
}
|
|
3345
|
+
function parseSchedule(raw) {
|
|
3346
|
+
if (raw === void 0) return void 0;
|
|
3347
|
+
if (!COMPETITOR_SCHEDULES.includes(raw)) throw new Error(`--schedule takes ${COMPETITOR_SCHEDULES.join(", ")}`);
|
|
3348
|
+
return raw;
|
|
3349
|
+
}
|
|
3350
|
+
function withAccountFlags(cmd) {
|
|
3351
|
+
return cmd.option("--tiktok <handle>", "TikTok account (handle or link)").option("--instagram <handle>", "Instagram account").option("--youtube <channel>", "YouTube channel (@handle or link)").option("--x <handle>", "X account").option("--linkedin <page>", "LinkedIn company page (link or slug)").option("--meta-ads <advertiser>", "Meta ads advertiser name or page id").option("--about <platforms>", `where to search posts naming it, comma separated: ${COMPETITOR_ABOUT_PLATFORMS.join(",")}`).option("--schedule <when>", `${COMPETITOR_SCHEDULES.join(" | ")} (default weekly)`);
|
|
3352
|
+
}
|
|
3353
|
+
var FAMILY_LABEL = {
|
|
3354
|
+
sound: "Sound advice",
|
|
3355
|
+
outlier: "Making a post like a hit",
|
|
3356
|
+
launch: "Answering a launch",
|
|
3357
|
+
complaints: "Answering complaints"
|
|
3358
|
+
};
|
|
3359
|
+
function checkPostLink(url) {
|
|
3360
|
+
const value = url.trim();
|
|
3361
|
+
if (!/^https?:\/\/\S+$/i.test(value) || value.length > 1e3) throw new Error("give the post's full link (http or https)");
|
|
3362
|
+
return value;
|
|
3363
|
+
}
|
|
3364
|
+
function outcomeLine(o) {
|
|
3365
|
+
const ratio = typeof o.ratio === "number" ? `${o.ratio}x` : "";
|
|
3366
|
+
const numbers = typeof o.reach === "number" && typeof o.usual === "number" ? ` (${o.reach} ${o.unit ?? "views"} against your usual ${o.usual}${o.platform ? ` on ${o.platform}` : ""})` : "";
|
|
3367
|
+
switch (o.state) {
|
|
3368
|
+
case "worked":
|
|
3369
|
+
return `worked: ${ratio} your usual${numbers}`;
|
|
3370
|
+
case "flat":
|
|
3371
|
+
return `about your usual: ${ratio}${numbers}`;
|
|
3372
|
+
case "missed":
|
|
3373
|
+
return `below your usual: ${ratio}${numbers}`;
|
|
3374
|
+
case "waiting":
|
|
3375
|
+
return "checking: the post needs a few more days and a scan of your brand";
|
|
3376
|
+
case "not_found":
|
|
3377
|
+
return "the linked post is not among your brand's scanned posts: check the link";
|
|
3378
|
+
case "older_than_advice":
|
|
3379
|
+
return "the linked post went up before this advice: link the one that came of it";
|
|
3380
|
+
case "no_baseline":
|
|
3381
|
+
return `not enough of your posts${o.platform ? ` on ${o.platform}` : ""} yet to compare with`;
|
|
3382
|
+
case "posts_since":
|
|
3383
|
+
return `your posts since: ${ratio} your usual; link the one that came of it for a verdict`;
|
|
3384
|
+
case "no_posts_yet":
|
|
3385
|
+
return "marked; your next posts will be checked";
|
|
3386
|
+
case "no_brand":
|
|
3387
|
+
return "add your own brand (--own) and scan it to see if it worked";
|
|
3388
|
+
default:
|
|
3389
|
+
return o.state;
|
|
3390
|
+
}
|
|
3391
|
+
}
|
|
3392
|
+
function recordLines(record) {
|
|
3393
|
+
return record.filter((r) => r.shown).map((r) => `${FAMILY_LABEL[r.family]}: ${r.worked} of ${r.tried} worked for you (on average ${r.avgRatio}x your usual)`);
|
|
3394
|
+
}
|
|
3395
|
+
function rows(list) {
|
|
3396
|
+
return list.map((c) => ({
|
|
3397
|
+
id: c.id,
|
|
3398
|
+
brand: c.isOwn ? `${c.brand} (yours)` : c.brand,
|
|
3399
|
+
searches: c.searches,
|
|
3400
|
+
schedule: c.schedule,
|
|
3401
|
+
lastScan: c.scanning ? "scanning" : (c.lastScanAt ?? "").slice(0, 10) || "never",
|
|
3402
|
+
note: c.lastScanError ?? ""
|
|
3403
|
+
}));
|
|
3404
|
+
}
|
|
3405
|
+
function competitorsCommand() {
|
|
3406
|
+
const cmd = new Command("competitors").description("brands you track (competitors or your own), their scans and action cards (Nodaro Cloud)");
|
|
3407
|
+
cmd.command("list").description("list tracked brands").option("--profile <name>").option("--json").action(async (opts) => {
|
|
3408
|
+
try {
|
|
3409
|
+
const list = await buildClient(opts.profile).competitors.list();
|
|
3410
|
+
if (opts.json) return emit(list, opts);
|
|
3411
|
+
table(rows(list), ["id", "brand", "searches", "schedule", "lastScan", "note"]);
|
|
3412
|
+
} catch (err) {
|
|
3413
|
+
handleError(err);
|
|
3414
|
+
}
|
|
3415
|
+
});
|
|
3416
|
+
cmd.command("show <id>").description("one brand: accounts, its latest scan and its cards").option("--profile <name>").option("--json").action(async (id, opts) => {
|
|
3417
|
+
try {
|
|
3418
|
+
const found = await buildClient(opts.profile).competitors.get(id);
|
|
3419
|
+
if (opts.json) return emit(found, opts);
|
|
3420
|
+
detail({ ...found, latestScan: found.latestScan ? { at: found.latestScan.at, counts: found.latestScan.counts, cards: found.latestScan.cards.map((c) => c.title) } : null });
|
|
3421
|
+
} catch (err) {
|
|
3422
|
+
handleError(err);
|
|
3423
|
+
}
|
|
3424
|
+
});
|
|
3425
|
+
withAccountFlags(
|
|
3426
|
+
cmd.command("add").description("track a brand; with --website and no account flags, its accounts are found from the site").option("--brand <name>", "its name (read from the website when left out)").option("--website <url>", "its website").option("--own", "your own brand")
|
|
3427
|
+
).option("--profile <name>").option("--json").action(async (opts) => {
|
|
3428
|
+
try {
|
|
3429
|
+
const client = buildClient(opts.profile);
|
|
3430
|
+
let accounts = accountsFromFlags(opts);
|
|
3431
|
+
let brand = opts.brand?.trim() ?? "";
|
|
3432
|
+
let guessed = [];
|
|
3433
|
+
if (opts.website && Object.keys(accounts).length === 0) {
|
|
3434
|
+
const found = await client.competitors.discover(opts.website);
|
|
3435
|
+
brand = brand || found.brand;
|
|
3436
|
+
accounts = Object.fromEntries(Object.entries(found.accounts).map(([k, v]) => [k, v.value]));
|
|
3437
|
+
guessed = Object.entries(found.accounts).flatMap(([k, v]) => v.from === "guess" ? [k] : []);
|
|
3438
|
+
}
|
|
3439
|
+
if (!brand) throw new Error("give --brand, or --website to read it from");
|
|
3440
|
+
const created = await client.competitors.create({
|
|
3441
|
+
brand,
|
|
3442
|
+
...opts.website ? { website: opts.website } : {},
|
|
3443
|
+
accounts,
|
|
3444
|
+
...opts.about !== void 0 ? { aboutPlatforms: parseAbout(opts.about) } : {},
|
|
3445
|
+
...opts.own ? { isOwn: true } : {},
|
|
3446
|
+
...opts.schedule !== void 0 ? { schedule: parseSchedule(opts.schedule) } : {}
|
|
3447
|
+
});
|
|
3448
|
+
if (opts.json) return emit(created, opts);
|
|
3449
|
+
success(`tracking ${created.brand} (${created.id}): ${created.searches} searches per scan, ${created.schedule}`);
|
|
3450
|
+
if (guessed.length > 0) info(`guessed, check them: ${guessed.join(", ")}`);
|
|
3451
|
+
} catch (err) {
|
|
3452
|
+
handleError(err);
|
|
3453
|
+
}
|
|
3454
|
+
});
|
|
3455
|
+
withAccountFlags(cmd.command("update <id>").description("change a brand's accounts, platforms or schedule").option("--brand <name>").option("--website <url>")).option("--clear <platforms>", `accounts to remove, comma separated: ${COMPETITOR_ACCOUNT_KEYS.join(",")}`).option("--profile <name>").option("--json").action(async (id, opts) => {
|
|
3456
|
+
try {
|
|
3457
|
+
const set = accountsFromFlags(opts);
|
|
3458
|
+
const clear = parseClear(opts.clear);
|
|
3459
|
+
const client = buildClient(opts.profile);
|
|
3460
|
+
const changesAccounts = Object.keys(set).length > 0 || clear.length > 0;
|
|
3461
|
+
const input2 = {
|
|
3462
|
+
...opts.brand !== void 0 ? { brand: opts.brand } : {},
|
|
3463
|
+
...opts.website !== void 0 ? { website: opts.website } : {},
|
|
3464
|
+
...opts.about !== void 0 ? { aboutPlatforms: parseAbout(opts.about) } : {},
|
|
3465
|
+
...opts.schedule !== void 0 ? { schedule: parseSchedule(opts.schedule) } : {}
|
|
3466
|
+
};
|
|
3467
|
+
if (!changesAccounts && Object.keys(input2).length === 0) throw new Error("nothing to change");
|
|
3468
|
+
const accounts = changesAccounts ? mergeAccounts((await client.competitors.get(id)).accounts, set, clear) : void 0;
|
|
3469
|
+
const updated = await client.competitors.update(id, { ...input2, ...accounts ? { accounts } : {} });
|
|
3470
|
+
if (opts.json) return emit(updated, opts);
|
|
3471
|
+
success(`updated ${updated.brand}`);
|
|
3472
|
+
} catch (err) {
|
|
3473
|
+
handleError(err);
|
|
3474
|
+
}
|
|
3475
|
+
});
|
|
3476
|
+
cmd.command("remove <id>").description("stop tracking a brand (its scans go too)").option("--profile <name>").action(async (id, opts) => {
|
|
3477
|
+
try {
|
|
3478
|
+
await buildClient(opts.profile).competitors.delete(id);
|
|
3479
|
+
success(`removed ${id}`);
|
|
3480
|
+
} catch (err) {
|
|
3481
|
+
handleError(err);
|
|
3482
|
+
}
|
|
3483
|
+
});
|
|
3484
|
+
cmd.command("discover <website>").description("find a brand's accounts from its website (free)").option("--profile <name>").option("--json").action(async (website, opts) => {
|
|
3485
|
+
try {
|
|
3486
|
+
const found = await buildClient(opts.profile).competitors.discover(website);
|
|
3487
|
+
if (opts.json) return emit(found, opts);
|
|
3488
|
+
info(`${found.brand} \u2014 ${found.website}`);
|
|
3489
|
+
table(
|
|
3490
|
+
Object.entries(found.accounts).map(([platform2, v]) => ({ platform: platform2, account: v.value, from: v.from })),
|
|
3491
|
+
["platform", "account", "from"]
|
|
3492
|
+
);
|
|
3493
|
+
} catch (err) {
|
|
3494
|
+
handleError(err);
|
|
3495
|
+
}
|
|
3496
|
+
});
|
|
3497
|
+
cmd.command("scan <id>").description("scan a brand now (one Social Search page per search; failed searches are not charged)").option("--watch", "wait for the scan to finish").option("--profile <name>").option("--json").action(async (id, opts) => {
|
|
3498
|
+
try {
|
|
3499
|
+
const client = buildClient(opts.profile);
|
|
3500
|
+
const result = await client.competitors.scan(id);
|
|
3501
|
+
await reportQueuedJob(result, () => client.jobs.get(result.jobId), { ...opts, note: "competitor scan" });
|
|
3502
|
+
} catch (err) {
|
|
3503
|
+
handleError(err);
|
|
3504
|
+
}
|
|
3505
|
+
});
|
|
3506
|
+
cmd.command("cards").description("what to do now: every action card, most urgent first").option("--profile <name>").option("--json").action(async (opts) => {
|
|
3507
|
+
try {
|
|
3508
|
+
const result = await buildClient(opts.profile).competitors.cards();
|
|
3509
|
+
if (opts.json) return emit(result, opts);
|
|
3510
|
+
if (result.cards.length === 0) return info("no cards yet: scan a brand first (nodaro competitors scan <id>)");
|
|
3511
|
+
for (const card of result.cards) {
|
|
3512
|
+
info(`[${card.priority === 1 ? "act now" : card.priority === 2 ? "opening" : "good to know"}] ${card.title}`);
|
|
3513
|
+
info(` ${card.why}`);
|
|
3514
|
+
info(` \u2192 ${card.action}`);
|
|
3515
|
+
for (const postId of card.evidence) {
|
|
3516
|
+
const url = result.posts[postId]?.url;
|
|
3517
|
+
if (url) info(` ${url}`);
|
|
3518
|
+
}
|
|
3519
|
+
if (isMeasurableCard(card)) info(` did it? nodaro competitors done ${card.id} [--link <your post>]`);
|
|
3520
|
+
}
|
|
3521
|
+
for (const line of recordLines(result.record ?? [])) info(line);
|
|
3522
|
+
} catch (err) {
|
|
3523
|
+
handleError(err);
|
|
3524
|
+
}
|
|
3525
|
+
});
|
|
3526
|
+
cmd.command("lessons <id>").description("what works for a brand: what its best posts share, per platform (free)").option("--profile <name>").option("--json").action(async (id, opts) => {
|
|
3527
|
+
try {
|
|
3528
|
+
const result = await buildClient(opts.profile).competitors.lessons(id);
|
|
3529
|
+
if (opts.json) return emit(result, opts);
|
|
3530
|
+
const { platforms, minPosts } = result.lessons;
|
|
3531
|
+
if (platforms.length === 0) return info("no posts of its own yet: add an account and scan (nodaro competitors scan <id>)");
|
|
3532
|
+
for (const pl of platforms) {
|
|
3533
|
+
if (pl.usual === null) {
|
|
3534
|
+
info(`${pl.platform}: ${pl.posts} posts \u2014 needs ${minPosts} to tell what works`);
|
|
3535
|
+
continue;
|
|
3536
|
+
}
|
|
3537
|
+
info(`${pl.platform}: ${pl.posts} posts, usually ${Math.round(pl.usual)} ${pl.unit}`);
|
|
3538
|
+
if (pl.lessons.length === 0) info(" nothing stands out yet");
|
|
3539
|
+
for (const lesson of pl.lessons) {
|
|
3540
|
+
info(` \u2022 ${lesson.text}`);
|
|
3541
|
+
for (const postId of lesson.evidence) {
|
|
3542
|
+
const url = result.posts[postId]?.url;
|
|
3543
|
+
if (url) info(` ${url}`);
|
|
3544
|
+
}
|
|
3545
|
+
}
|
|
3546
|
+
}
|
|
3547
|
+
} catch (err) {
|
|
3548
|
+
handleError(err);
|
|
3549
|
+
}
|
|
3550
|
+
});
|
|
3551
|
+
cmd.command("done <card-id>").description('"I did this" on a card (its id from `nodaro competitors cards`); each scan of your own brand then checks how it went (free)').option("--link <url>", "the full link to your post that came of it").option("--profile <name>").option("--json").action(async (cardId, opts) => {
|
|
3552
|
+
try {
|
|
3553
|
+
const result = await buildClient(opts.profile).competitors.markDone(cardId, opts.link ? { postUrl: checkPostLink(opts.link) } : {});
|
|
3554
|
+
if (opts.json) return emit(result, opts);
|
|
3555
|
+
success(`${result.created === false ? "already marked" : "marked"} (${result.action.id}): ${outcomeLine(result.action.outcome)}`);
|
|
3556
|
+
} catch (err) {
|
|
3557
|
+
handleError(err);
|
|
3558
|
+
}
|
|
3559
|
+
});
|
|
3560
|
+
cmd.command("tried").description("the cards you marked done, how each went, and what has worked for you (free)").option("--profile <name>").option("--json").action(async (opts) => {
|
|
3561
|
+
try {
|
|
3562
|
+
const result = await buildClient(opts.profile).competitors.tried();
|
|
3563
|
+
if (opts.json) return emit(result, opts);
|
|
3564
|
+
if (result.actions.length === 0) return info("nothing marked yet: nodaro competitors done <card-id>");
|
|
3565
|
+
for (const line of recordLines(result.record)) info(line);
|
|
3566
|
+
for (const action of result.actions) {
|
|
3567
|
+
info(`${action.actedAt.slice(0, 10)} ${action.card.title || action.cardId}${action.onWall ? "" : " (no longer on the wall)"}`);
|
|
3568
|
+
info(` ${outcomeLine(action.outcome)}`);
|
|
3569
|
+
if (action.postUrl) info(` ${action.postUrl}`);
|
|
3570
|
+
info(` mark: ${action.id}`);
|
|
3571
|
+
}
|
|
3572
|
+
} catch (err) {
|
|
3573
|
+
handleError(err);
|
|
3574
|
+
}
|
|
3575
|
+
});
|
|
3576
|
+
cmd.command("link <mark-id> [url]").description("link the post that came of a marked card (its full link), or --remove the link").option("--remove", "remove the link").option("--profile <name>").option("--json").action(async (markId, url, opts) => {
|
|
3577
|
+
try {
|
|
3578
|
+
if (!url && !opts.remove) throw new Error("give the post's link, or --remove");
|
|
3579
|
+
if (url && opts.remove) throw new Error("give a link or --remove, not both");
|
|
3580
|
+
const result = await buildClient(opts.profile).competitors.linkPost(markId, opts.remove ? null : checkPostLink(url));
|
|
3581
|
+
if (opts.json) return emit(result, opts);
|
|
3582
|
+
success(`${opts.remove ? "unlinked" : "linked"}: ${outcomeLine(result.action.outcome)}`);
|
|
3583
|
+
} catch (err) {
|
|
3584
|
+
handleError(err);
|
|
3585
|
+
}
|
|
3586
|
+
});
|
|
3587
|
+
cmd.command("undo <mark-id>").description('undo "I did this" (its verdict leaves your track record)').option("--profile <name>").action(async (markId, opts) => {
|
|
3588
|
+
try {
|
|
3589
|
+
await buildClient(opts.profile).competitors.unmark(markId);
|
|
3590
|
+
success(`removed mark ${markId}`);
|
|
3591
|
+
} catch (err) {
|
|
3592
|
+
handleError(err);
|
|
3593
|
+
}
|
|
3594
|
+
});
|
|
3595
|
+
return cmd;
|
|
3596
|
+
}
|
|
3202
3597
|
function parseList(value) {
|
|
3203
3598
|
return value.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
|
|
3204
3599
|
}
|
|
@@ -3622,7 +4017,7 @@ Examples:
|
|
|
3622
4017
|
emit(result, opts);
|
|
3623
4018
|
return;
|
|
3624
4019
|
}
|
|
3625
|
-
const
|
|
4020
|
+
const rows2 = result.sections.flatMap(
|
|
3626
4021
|
(section) => section.families.flatMap(
|
|
3627
4022
|
(group) => group.models.map((m) => ({
|
|
3628
4023
|
id: m.id,
|
|
@@ -3635,7 +4030,7 @@ Examples:
|
|
|
3635
4030
|
}))
|
|
3636
4031
|
)
|
|
3637
4032
|
);
|
|
3638
|
-
table(
|
|
4033
|
+
table(rows2, ["id", "kind", "family", "modes", "credits", "featured", "doctrine"]);
|
|
3639
4034
|
} catch (err) {
|
|
3640
4035
|
handleError(err);
|
|
3641
4036
|
}
|
|
@@ -3714,6 +4109,12 @@ Examples:
|
|
|
3714
4109
|
});
|
|
3715
4110
|
return cmd;
|
|
3716
4111
|
}
|
|
4112
|
+
function segmentPackOption() {
|
|
4113
|
+
return new Option(
|
|
4114
|
+
"--segment-pack <pack>",
|
|
4115
|
+
"how scenes are packed into parts: scenes-max (fewest seams), scenes (shorter parts) or max (longest parts)"
|
|
4116
|
+
).choices([...RECAST_SEGMENT_PACKS]);
|
|
4117
|
+
}
|
|
3717
4118
|
function readScript(path) {
|
|
3718
4119
|
let raw;
|
|
3719
4120
|
try {
|
|
@@ -3783,7 +4184,7 @@ function recastCommand() {
|
|
|
3783
4184
|
handleError(err);
|
|
3784
4185
|
}
|
|
3785
4186
|
});
|
|
3786
|
-
cmd.command("estimate").description("quote a run in credits before creating it").requiredOption("--analysis-job <id>", "the source analysis job id").option("--fidelity <f>", "render fidelity", "faithful").option("--resolution <r>").
|
|
4187
|
+
cmd.command("estimate").description("quote a run in credits before creating it").requiredOption("--analysis-job <id>", "the source analysis job id").option("--fidelity <f>", "render fidelity", "faithful").option("--resolution <r>").addOption(segmentPackOption()).option("--profile <name>").option("--json").action(
|
|
3787
4188
|
async (opts) => {
|
|
3788
4189
|
try {
|
|
3789
4190
|
const client = buildClient(opts.profile);
|
|
@@ -3791,7 +4192,7 @@ function recastCommand() {
|
|
|
3791
4192
|
analysisJobId: opts.analysisJob,
|
|
3792
4193
|
fidelity: opts.fidelity,
|
|
3793
4194
|
resolution: opts.resolution,
|
|
3794
|
-
segmentSec: opts.
|
|
4195
|
+
segmentSec: opts.segmentPack
|
|
3795
4196
|
});
|
|
3796
4197
|
if (opts.json) emit(result, opts);
|
|
3797
4198
|
else detail(result);
|
|
@@ -3800,7 +4201,7 @@ function recastCommand() {
|
|
|
3800
4201
|
}
|
|
3801
4202
|
}
|
|
3802
4203
|
);
|
|
3803
|
-
cmd.command("create").description("create a run \u2014 BUYS THE PLAN (credits); run `estimate` first").requiredOption("--workflow <id>", "workflow the run attaches to").requiredOption("--analysis-job <id>", "the source analysis job id").option("--fidelity <f>", "render fidelity", "faithful").option("--rights-attested", "required for faithful renders of authored scripts").option("--resolution <r>").
|
|
4204
|
+
cmd.command("create").description("create a run \u2014 BUYS THE PLAN (credits); run `estimate` first").requiredOption("--workflow <id>", "workflow the run attaches to").requiredOption("--analysis-job <id>", "the source analysis job id").option("--fidelity <f>", "render fidelity", "faithful").option("--rights-attested", "required for faithful renders of authored scripts").option("--resolution <r>").addOption(segmentPackOption()).option("--profile <name>").option("--json").action(
|
|
3804
4205
|
async (opts) => {
|
|
3805
4206
|
try {
|
|
3806
4207
|
const client = buildClient(opts.profile);
|
|
@@ -3810,7 +4211,7 @@ function recastCommand() {
|
|
|
3810
4211
|
fidelity: opts.fidelity,
|
|
3811
4212
|
rightsAttested: opts.rightsAttested,
|
|
3812
4213
|
resolution: opts.resolution,
|
|
3813
|
-
segmentSec: opts.
|
|
4214
|
+
segmentSec: opts.segmentPack
|
|
3814
4215
|
});
|
|
3815
4216
|
if (opts.json) emit(result, opts);
|
|
3816
4217
|
else success(`run ${result.recastId} created (planning) \u2014 poll: nodaro recast status ${result.recastId}`);
|
|
@@ -3819,10 +4220,10 @@ function recastCommand() {
|
|
|
3819
4220
|
}
|
|
3820
4221
|
}
|
|
3821
4222
|
);
|
|
3822
|
-
cmd.command("start <recastId>").description("start rendering a planned run (idempotent)").
|
|
4223
|
+
cmd.command("start <recastId>").description("start rendering a planned run (idempotent)").addOption(segmentPackOption()).option("--profile <name>").option("--json").action(async (recastId, opts) => {
|
|
3823
4224
|
try {
|
|
3824
4225
|
const client = buildClient(opts.profile);
|
|
3825
|
-
const result = await client.recast.start(recastId, { segmentSec: opts.
|
|
4226
|
+
const result = await client.recast.start(recastId, { segmentSec: opts.segmentPack });
|
|
3826
4227
|
if (opts.json) emit(result, opts);
|
|
3827
4228
|
else success(`rendering${result.gvpJobId ? ` \u2014 gvp job ${result.gvpJobId}` : ""}`);
|
|
3828
4229
|
} catch (err) {
|
|
@@ -4973,14 +5374,17 @@ function readJsonFile(path) {
|
|
|
4973
5374
|
}
|
|
4974
5375
|
}
|
|
4975
5376
|
function parseSourceSpec(spec, index2) {
|
|
4976
|
-
const
|
|
5377
|
+
const named = /^([^=\s]{1,200})=(https?:\/\/.+)$/.exec(spec);
|
|
5378
|
+
const id = named ? named[1] : `source-${index2 + 1}`;
|
|
5379
|
+
const rest = named ? named[2] : spec;
|
|
5380
|
+
const at = rest.lastIndexOf("@");
|
|
4977
5381
|
if (at > 0) {
|
|
4978
|
-
const suffix =
|
|
5382
|
+
const suffix = rest.slice(at + 1);
|
|
4979
5383
|
if (suffix === "audio" || suffix === "video") {
|
|
4980
|
-
return { id
|
|
5384
|
+
return { id, url: rest.slice(0, at), kind: suffix };
|
|
4981
5385
|
}
|
|
4982
5386
|
}
|
|
4983
|
-
return { id
|
|
5387
|
+
return { id, url: rest, kind: "video" };
|
|
4984
5388
|
}
|
|
4985
5389
|
function parseAudioSyncSource(spec, index2) {
|
|
4986
5390
|
const named = /^([^=\s]{1,200})=(https?:\/\/.+)$/.exec(spec);
|
|
@@ -5082,9 +5486,12 @@ function editCommand() {
|
|
|
5082
5486
|
);
|
|
5083
5487
|
cmd.command("plan").description("plan a transcript-driven cut / clips / chapters (Cloud edition)").requiredOption("--mode <mode>", "tighten | clips | chapters").requiredOption("--plan-tier <tier>", "economy | standard | premium").requiredOption("--transcript <file>", "path to a timed transcript JSON file").option("--silence <file>", "optional silence JSON \u2014 the silence-detect job's output_data.json ({ version, ranges, durationMs })").option(
|
|
5084
5488
|
"--source <url>",
|
|
5085
|
-
"a media source as url
|
|
5489
|
+
"a media source as [id=]url[@audio|@video] (repeatable); id defaults to source-N, kind to video",
|
|
5086
5490
|
collectVariadic
|
|
5087
|
-
).option("--sources-file <file>", "JSON array of full EditPlanSource rows (overrides --source)").option(
|
|
5491
|
+
).option("--sources-file <file>", "JSON array of full EditPlanSource rows (overrides --source)").option(
|
|
5492
|
+
"--offsets <file>",
|
|
5493
|
+
"multicam: an audio-sync result JSON (the job's output_data.json) over the same source ids \u2014 each source's measured offset is applied before the request"
|
|
5494
|
+
).option("--transcript-source <id>", "the id of the source the transcript was made from (refused if it is off the master's clock)").option("--instructions <text>", "free-text editing steer").option("--style-guide <text>", "style guide applied to the plan").option("--count <n>", "clips mode: how many clips to cut", (v) => parseInt(v, 10)).option("--target-duration-sec <n>", "clips mode: target duration per clip (seconds)", (v) => parseInt(v, 10)).option("--target-aspect <ratio>", "clips aspect: 16:9 | 9:16 | 1:1 | 4:5").option("--platform <name>", "target platform hint").option("--watch", "poll the job until it finishes").option("--poll-interval <ms>", "poll interval with --watch", (v) => parseInt(v, 10)).option("--profile <name>").option("--json").action(
|
|
5088
5495
|
async (opts) => {
|
|
5089
5496
|
if (opts.mode !== "tighten" && opts.mode !== "clips" && opts.mode !== "chapters") {
|
|
5090
5497
|
warn(`--mode must be "tighten", "clips" or "chapters" (got "${opts.mode}")`);
|
|
@@ -5121,6 +5528,8 @@ function editCommand() {
|
|
|
5121
5528
|
transcript: readJsonFile(opts.transcript),
|
|
5122
5529
|
sources,
|
|
5123
5530
|
...opts.silence ? { silence: readJsonFile(opts.silence) } : {},
|
|
5531
|
+
...opts.offsets ? { offsets: readJsonFile(opts.offsets) } : {},
|
|
5532
|
+
...opts.transcriptSource ? { transcriptSourceId: opts.transcriptSource } : {},
|
|
5124
5533
|
...opts.instructions !== void 0 ? { instructions: opts.instructions } : {},
|
|
5125
5534
|
...opts.styleGuide !== void 0 ? { styleGuide: opts.styleGuide } : {},
|
|
5126
5535
|
...opts.count !== void 0 ? { count: opts.count } : {},
|
|
@@ -5140,6 +5549,33 @@ function editCommand() {
|
|
|
5140
5549
|
}
|
|
5141
5550
|
}
|
|
5142
5551
|
);
|
|
5552
|
+
cmd.command("switch-cameras").description("choose which camera shows each cut of an edit by who is speaking (Cloud edition; flat price)").requiredOption("--edl <file>", "path to ONE EDL JSON (an `edit plan` result)").requiredOption("--transcript <file>", "path to the transcript JSON WITH speaker labels (transcribe with speaker detection)").option("--speaker-map <file>", "JSON object: speaker label \u2192 EDL source id of their camera").option("--speaker-names <file>", "JSON object: speaker label \u2192 display name").option("--min-shot-ms <ms>", "shortest shot (default 2500)", (v) => parseInt(v, 10)).option("--lead-ms <ms>", "cut this long before the new speaker (default 200)", (v) => parseInt(v, 10)).option("--max-shot-ms <ms>", "with a wide source: break to it after this long (default 20000)", (v) => parseInt(v, 10)).option("--wide-every <n>", "with a wide source: every N-th cut to the wide (default 0 = off)", (v) => parseInt(v, 10)).option("--layout-hints", "suggest side-by-side / stacked layouts for crosstalk (Apply EDL renders cut-only edits)").option("--watch", "poll the job until it finishes").option("--poll-interval <ms>", "poll interval with --watch", (v) => parseInt(v, 10)).option("--profile <name>").option("--json").action(
|
|
5553
|
+
async (opts) => {
|
|
5554
|
+
try {
|
|
5555
|
+
const client = buildClient(opts.profile);
|
|
5556
|
+
const input2 = {
|
|
5557
|
+
edl: readJsonFile(opts.edl),
|
|
5558
|
+
transcript: readJsonFile(opts.transcript),
|
|
5559
|
+
...opts.speakerMap ? { speakerMap: readJsonFile(opts.speakerMap) } : {},
|
|
5560
|
+
...opts.speakerNames ? { speakerNames: readJsonFile(opts.speakerNames) } : {},
|
|
5561
|
+
...opts.minShotMs !== void 0 ? { minShotMs: opts.minShotMs } : {},
|
|
5562
|
+
...opts.leadMs !== void 0 ? { leadMs: opts.leadMs } : {},
|
|
5563
|
+
...opts.maxShotMs !== void 0 ? { maxShotMs: opts.maxShotMs } : {},
|
|
5564
|
+
...opts.wideEvery !== void 0 ? { wideEvery: opts.wideEvery } : {},
|
|
5565
|
+
...opts.layoutHints ? { layoutHints: true } : {}
|
|
5566
|
+
};
|
|
5567
|
+
const result = await client.edit.cameraSwitch(input2);
|
|
5568
|
+
await reportQueuedJob(result, () => client.jobs.getStatus(result.jobId), {
|
|
5569
|
+
json: opts.json,
|
|
5570
|
+
watch: opts.watch,
|
|
5571
|
+
pollInterval: opts.pollInterval,
|
|
5572
|
+
note: "camera-switch"
|
|
5573
|
+
});
|
|
5574
|
+
} catch (err) {
|
|
5575
|
+
handleError(err);
|
|
5576
|
+
}
|
|
5577
|
+
}
|
|
5578
|
+
);
|
|
5143
5579
|
return cmd;
|
|
5144
5580
|
}
|
|
5145
5581
|
|
|
@@ -5169,6 +5605,8 @@ program.addCommand(voiceCommand());
|
|
|
5169
5605
|
program.addCommand(mediaCommand());
|
|
5170
5606
|
program.addCommand(audioCommand());
|
|
5171
5607
|
program.addCommand(presetsCommand());
|
|
5608
|
+
program.addCommand(savedPostsCommand());
|
|
5609
|
+
program.addCommand(competitorsCommand());
|
|
5172
5610
|
program.addCommand(communityCommand());
|
|
5173
5611
|
program.addCommand(pickerCatalogsCommand());
|
|
5174
5612
|
program.addCommand(catalogCommand());
|