@nodaro/cli 1.25.0 → 1.26.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 +1 -1
- package/dist/index.js +298 -29
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -176,7 +176,7 @@ nodaro audio combine --segment <url> --segment "<url>@12-95" --watch
|
|
|
176
176
|
# prompt — the prompt wizard (analyze / generate / wizard)
|
|
177
177
|
# presets — node presets (factory + your own)
|
|
178
178
|
# saved-posts — the inspiration wall: posts saved from Social Search
|
|
179
|
-
# competitors — tracked brands, their scans, action cards, and did it work? (Cloud)
|
|
179
|
+
# competitors — tracked brands, their scans, action cards, history and compare, did it work? (Cloud)
|
|
180
180
|
# community — shared characters/locations/objects: browse, clone, favorites
|
|
181
181
|
```
|
|
182
182
|
|
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, SOCIAL_PLATFORMS, COMPETITOR_ACCOUNT_KEYS, isMeasurableCard, isSocialPost, COMPETITOR_ABOUT_PLATFORMS, COMPETITOR_SCHEDULES, RECAST_SEGMENT_PACKS } from '@nodaro/shared';
|
|
16
|
+
import { CHARACTER_STYLES, TRANSCRIBE_PROVIDERS, transcribeLaneSupportsWordTimestamps, DIALOGUE_PROVIDERS, dialogueStabilityAccepted, dialogueProviderOf, getDialogueCapabilities, 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, collectionRecordHeadline, COMPETITOR_ACCOUNT_KEYS, isMeasurableCard, EDIT_PLAN_MODES, 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.26.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.20.0",
|
|
74
|
+
"@nodaro/shared": "^3.22.0",
|
|
75
75
|
commander: "^12.1.0",
|
|
76
76
|
picocolors: "^1.1.1",
|
|
77
|
-
"@nodaro/prompts": "^1.
|
|
77
|
+
"@nodaro/prompts": "^1.31.0"
|
|
78
78
|
},
|
|
79
79
|
devDependencies: {
|
|
80
80
|
tsup: "^8.5.0",
|
|
@@ -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.26.0" ;
|
|
402
402
|
function buildClient(profileName) {
|
|
403
403
|
const { name, profile } = getProfile(profileName);
|
|
404
404
|
if (!profile) {
|
|
@@ -1303,6 +1303,7 @@ Examples:
|
|
|
1303
1303
|
$ nodaro nodes run generate-image --param prompt="hi" --param provider=flux --param resolution=2K --watch
|
|
1304
1304
|
$ echo '{"prompt":"hi","provider":"flux"}' > body.json
|
|
1305
1305
|
$ nodaro nodes run generate-image --params-file body.json --watch
|
|
1306
|
+
$ nodaro nodes run text-to-speech --param text="And so it begins." --param previousText="The night before, nobody slept." --param nextText="By noon the harbour was empty." --watch
|
|
1306
1307
|
|
|
1307
1308
|
Structured references (the editor's wired-reference shape) \u2014 let a {image:N} prompt
|
|
1308
1309
|
token bind a labeled reference, assembled server-side into @image_N (same as the
|
|
@@ -1897,6 +1898,9 @@ Examples:
|
|
|
1897
1898
|
).option(
|
|
1898
1899
|
"--v3 <indexes>",
|
|
1899
1900
|
"comma-separated 1-based speaker indexes converted with the Re-speak (eleven_v3) engine instead of the recast \u2014 the performance is regenerated from the transcript ([audio tags] supported; delivery replaced; lips won't match on video). With --analysis-file the analysis text is the script; without one the engine re-speaks from its own transcription"
|
|
1901
|
+
).option(
|
|
1902
|
+
"--v4 <indexes>",
|
|
1903
|
+
"comma-separated 1-based speaker indexes converted with the Re-speak (eleven_v4) engine \u2014 like --v3, but stability takes any value 0\u20131, similarityBoost is honoured, and each line is generated with its neighbouring lines as context. An index may appear in --v3 or --v4, not both"
|
|
1900
1904
|
).option("--model <id>", "speech-to-speech model override").option("--output <mode>", "output mode: video (default \u2014 merged, rendered result) or stems (dry per-track stems for an interactive mix; render later with `voice export`)").option("--analysis-json <json>", "a completed `voice analyze` job's output_data, inline \u2014 skips re-detection (the interactive-flow fast-path)").option("--analysis-file <path>", "same as --analysis-json but read from a JSON file").option("--no-preserve-background", "drop the separated music/SFX bed for a clean voice-only result (kept by default)").option("--separation-quality <q>", "voice/music separation quality: fast (default) or best").option("--music-volume-mode <mode>", "preserved background level: match (default), normalize, or manual").option("--music-volume <n>", "background level % (0-200) when --music-volume-mode is manual", parseFloat).option("--remove-background-noise", "denoise for a cleaner voice-only result").option("--voice-fx <preset>", `reverb/echo on the combined recast voices: ${FX_PRESETS}`).option("--voice-fx-mix <n>", "reverb wet/dry mix % (0-100) \u2014 reverb presets", parseFloat).option("--voice-fx-delay <ms>", "echo delay in ms (20-2000) \u2014 echo/custom presets", (v) => parseInt(v, 10)).option("--voice-fx-decay <n>", "echo decay (0-1) \u2014 echo/custom presets", parseFloat).option("--watch", "poll until the job completes").option("--poll-interval <ms>", "watch poll interval in ms", (v) => parseInt(v, 10), 2e3).option("--profile <name>").option("--json").addHelpText("after", `
|
|
1901
1905
|
Examples:
|
|
1902
1906
|
$ nodaro voice recast --audio https://.../podcast.mp3 --voices Rachel,Aria --watch
|
|
@@ -1906,7 +1910,9 @@ Examples:
|
|
|
1906
1910
|
--voices-json '[{"voiceId":"Rachel","stability":0.6},null,"Aria"]' --no-preserve-background
|
|
1907
1911
|
$ nodaro voice recast --video https://.../panel.mp4 --voices Rachel,Aria \\
|
|
1908
1912
|
--analysis-file analysis.json --output stems --watch
|
|
1909
|
-
# interactive flow: reuse a \`voice analyze\` result, get dry stems to mix, render with \`voice export
|
|
1913
|
+
# interactive flow: reuse a \`voice analyze\` result, get dry stems to mix, render with \`voice export\`
|
|
1914
|
+
$ nodaro voice recast --audio https://.../podcast.mp3 --voices Rachel,Aria --v4 2 --watch
|
|
1915
|
+
# speaker 2 is re-spoken from the transcript on the v4 Re-speak engine; speaker 1 is a recast`).action(
|
|
1910
1916
|
async (opts) => {
|
|
1911
1917
|
try {
|
|
1912
1918
|
if (!opts.audio && !opts.video) {
|
|
@@ -1951,19 +1957,30 @@ Examples:
|
|
|
1951
1957
|
warn("At least one speaker must get a new voice \u2014 `keep` only marks speakers whose original voice stays");
|
|
1952
1958
|
process.exit(1);
|
|
1953
1959
|
}
|
|
1954
|
-
|
|
1955
|
-
|
|
1960
|
+
const respeakIndexes = (raw) => raw === void 0 ? [] : raw.split(",").map((s) => parseInt(s.trim(), 10));
|
|
1961
|
+
const v3Idxs = respeakIndexes(opts.v3);
|
|
1962
|
+
const v4Idxs = respeakIndexes(opts.v4);
|
|
1963
|
+
const inBoth = v3Idxs.filter((n) => v4Idxs.includes(n));
|
|
1964
|
+
if (inBoth.length > 0) {
|
|
1965
|
+
warn(`speaker index ${inBoth.join(", ")} is named in both --v3 and --v4 \u2014 a speaker is re-spoken by one engine`);
|
|
1966
|
+
process.exit(1);
|
|
1967
|
+
}
|
|
1968
|
+
for (const [flag, idxs, engine] of [
|
|
1969
|
+
["--v3", v3Idxs, "v3"],
|
|
1970
|
+
["--v4", v4Idxs, "v4"]
|
|
1971
|
+
]) {
|
|
1972
|
+
if (idxs.length === 0) continue;
|
|
1956
1973
|
if (idxs.some((n) => !Number.isInteger(n) || n < 1 || n > orderedVoices.length)) {
|
|
1957
|
-
warn(
|
|
1974
|
+
warn(`${flag} indexes must be 1..${orderedVoices.length} (matching --voices positions)`);
|
|
1958
1975
|
process.exit(1);
|
|
1959
1976
|
}
|
|
1960
1977
|
for (const n of idxs) {
|
|
1961
1978
|
const v = orderedVoices[n - 1];
|
|
1962
1979
|
if (v === null) {
|
|
1963
|
-
warn(
|
|
1980
|
+
warn(`${flag} index ${n} is a keep-slot \u2014 a kept speaker is not converted at all`);
|
|
1964
1981
|
process.exit(1);
|
|
1965
1982
|
}
|
|
1966
|
-
orderedVoices[n - 1] = typeof v === "string" ? { voiceId: v, engine
|
|
1983
|
+
orderedVoices[n - 1] = typeof v === "string" ? { voiceId: v, engine } : { ...v, engine };
|
|
1967
1984
|
}
|
|
1968
1985
|
}
|
|
1969
1986
|
const voiceFx = buildVoiceFx(opts);
|
|
@@ -2166,17 +2183,18 @@ Examples:
|
|
|
2166
2183
|
}
|
|
2167
2184
|
}
|
|
2168
2185
|
);
|
|
2169
|
-
cmd.command("dialogue").description('voice a multi-speaker script as one audio file (ElevenLabs Dialogue v3) \u2014 each --line is "Voice: text"').requiredOption(
|
|
2186
|
+
cmd.command("dialogue").description('voice a multi-speaker script as one audio file (ElevenLabs Dialogue v3 by default, v4 with --model) \u2014 each --line is "Voice: text"').requiredOption(
|
|
2170
2187
|
"--line <line>",
|
|
2171
2188
|
'one script line as "Voice: text" (e.g. "Rachel: Hello there") \u2014 repeat in speaking order; the voice is a premade name or an ElevenLabs voice UUID',
|
|
2172
2189
|
(v, prev) => [...prev, v],
|
|
2173
2190
|
[]
|
|
2174
|
-
).option("--stability <n>", "0 (most variable) | 0.5 (balanced) | 1 (most stable)", (v) => parseFloat(v)).option("--language <code>", 'ISO 639-1 language hint, e.g. "en" (auto-detected when omitted)').option("--seed <n>", "deterministic sampling seed (0-4294967295); omit for random", (v) => parseInt(v, 10)).option("--text-normalization <mode>", "spell out numbers/dates: auto | on | off").option("--watch", "poll until the job completes").option("--poll-interval <ms>", "watch poll interval in ms", (v) => parseInt(v, 10), 2e3).option("--profile <name>").option("--json").addHelpText("after", `
|
|
2175
|
-
Limits: 5,000 characters total (under 2,000 recommended), up to 10 unique voices.
|
|
2191
|
+
).option("--model <id>", `dialogue model: ${DIALOGUE_PROVIDERS.join(" | ")} (default elevenlabs-dialogue, v3)`).option("--stability <n>", "v3: 0 (most variable) | 0.5 (balanced) | 1 (most stable); v4: any value 0..1", (v) => parseFloat(v)).option("--similarity <n>", "v4 only (v3 ignores it): how closely each line keeps its voice's character, 0..1", (v) => parseFloat(v)).option("--language <code>", 'ISO 639-1 language hint, e.g. "en" (auto-detected when omitted)').option("--seed <n>", "deterministic sampling seed (0-4294967295); omit for random", (v) => parseInt(v, 10)).option("--text-normalization <mode>", "spell out numbers/dates: auto | on | off").option("--watch", "poll until the job completes").option("--poll-interval <ms>", "watch poll interval in ms", (v) => parseInt(v, 10), 2e3).option("--profile <name>").option("--json").addHelpText("after", `
|
|
2192
|
+
Limits: 5,000 characters total on either model (under 2,000 recommended), up to 10 unique voices.
|
|
2176
2193
|
Line text may carry [audio tags] like [laughs].
|
|
2177
2194
|
|
|
2178
|
-
|
|
2179
|
-
$ nodaro voice dialogue --line "Rachel: [excited] We did it!" --line "Daniel: I never doubted us." --watch
|
|
2195
|
+
Examples:
|
|
2196
|
+
$ nodaro voice dialogue --line "Rachel: [excited] We did it!" --line "Daniel: I never doubted us." --watch
|
|
2197
|
+
$ nodaro voice dialogue --model elevenlabs-dialogue-v4 --stability 0.3 --similarity 0.8 --line "Rachel: Hello there"`).action(
|
|
2180
2198
|
async (opts) => {
|
|
2181
2199
|
try {
|
|
2182
2200
|
if (opts.line.length === 0) {
|
|
@@ -2189,8 +2207,18 @@ Example:
|
|
|
2189
2207
|
}
|
|
2190
2208
|
return { voice: raw.slice(0, idx).trim(), text: raw.slice(idx + 1).trim() };
|
|
2191
2209
|
});
|
|
2192
|
-
if (opts.
|
|
2193
|
-
throw new Error(
|
|
2210
|
+
if (opts.model !== void 0 && !DIALOGUE_PROVIDERS.includes(opts.model)) {
|
|
2211
|
+
throw new Error(`--model must be one of ${DIALOGUE_PROVIDERS.join(", ")}`);
|
|
2212
|
+
}
|
|
2213
|
+
const model = opts.model;
|
|
2214
|
+
if (opts.stability !== void 0 && !dialogueStabilityAccepted(dialogueProviderOf(model), opts.stability)) {
|
|
2215
|
+
const steps = getDialogueCapabilities(model).stabilitySteps;
|
|
2216
|
+
throw new Error(
|
|
2217
|
+
steps ? `--stability must be exactly ${steps.slice(0, -1).join(", ")}, or ${steps[steps.length - 1]}` : "--stability must be between 0 and 1"
|
|
2218
|
+
);
|
|
2219
|
+
}
|
|
2220
|
+
if (opts.similarity !== void 0 && !(opts.similarity >= 0 && opts.similarity <= 1)) {
|
|
2221
|
+
throw new Error("--similarity must be between 0 and 1");
|
|
2194
2222
|
}
|
|
2195
2223
|
if (opts.textNormalization !== void 0 && !["auto", "on", "off"].includes(opts.textNormalization)) {
|
|
2196
2224
|
throw new Error("--text-normalization must be auto, on, or off");
|
|
@@ -2198,7 +2226,9 @@ Example:
|
|
|
2198
2226
|
const client = buildClient(opts.profile);
|
|
2199
2227
|
const result = await client.voices.textToDialogue({
|
|
2200
2228
|
dialogue,
|
|
2229
|
+
...model !== void 0 ? { provider: model } : {},
|
|
2201
2230
|
...opts.stability !== void 0 ? { stability: opts.stability } : {},
|
|
2231
|
+
...opts.similarity !== void 0 ? { similarityBoost: opts.similarity } : {},
|
|
2202
2232
|
...opts.language ? { languageCode: opts.language } : {},
|
|
2203
2233
|
...opts.seed !== void 0 ? { seed: opts.seed } : {},
|
|
2204
2234
|
...opts.textNormalization ? { applyTextNormalization: opts.textNormalization } : {}
|
|
@@ -2994,9 +3024,10 @@ Example:
|
|
|
2994
3024
|
}
|
|
2995
3025
|
}
|
|
2996
3026
|
);
|
|
2997
|
-
cmd.command("mix").description("layer multiple audio tracks into one (tracks are summed)").option("--audio <url>", "audio track URL \u2014 repeat the flag for each track (2-20)", collectVariadic).option("--volumes <csv>", 'per-track level %, positionally (0-200 each), e.g. "100,80"').option("--watch", "poll until the job completes").option("--poll-interval <ms>", "watch poll interval in ms", (v) => parseInt(v, 10), 2e3).option("--profile <name>").option("--json").addHelpText("after", `
|
|
3027
|
+
cmd.command("mix").description("layer multiple audio tracks into one (tracks are summed)").option("--audio <url>", "audio track URL \u2014 repeat the flag for each track (2-20)", collectVariadic).option("--volumes <csv>", 'per-track level %, positionally (0-200 each), e.g. "100,80"').option("--duck-under <index>", "duck every OTHER track under this track (0-based index of the voice) \u2014 a music bed that dips under speech", (v) => parseInt(v, 10)).option("--duck-amount <n>", "how hard the others dip, 0-100 (default 75); needs --duck-under", parseFloat).option("--watch", "poll until the job completes").option("--poll-interval <ms>", "watch poll interval in ms", (v) => parseInt(v, 10), 2e3).option("--profile <name>").option("--json").addHelpText("after", `
|
|
2998
3028
|
Example:
|
|
2999
|
-
$ nodaro audio mix --audio https://.../voice.mp3 --audio https://.../bed.mp3 --volumes 100,60 --watch
|
|
3029
|
+
$ nodaro audio mix --audio https://.../voice.mp3 --audio https://.../bed.mp3 --volumes 100,60 --watch
|
|
3030
|
+
$ nodaro audio mix --audio https://.../voice.mp3 --audio https://.../bed.mp3 --duck-under 0 --duck-amount 80 --watch`).action(
|
|
3000
3031
|
async (opts) => {
|
|
3001
3032
|
try {
|
|
3002
3033
|
const urls = opts.audio ?? [];
|
|
@@ -3012,10 +3043,19 @@ Example:
|
|
|
3012
3043
|
process.exit(1);
|
|
3013
3044
|
}
|
|
3014
3045
|
}
|
|
3046
|
+
if (opts.duckAmount !== void 0 && opts.duckUnder === void 0) {
|
|
3047
|
+
warn("--duck-amount needs --duck-under <index> (the track the others duck under)");
|
|
3048
|
+
process.exit(1);
|
|
3049
|
+
}
|
|
3050
|
+
if (opts.duckUnder !== void 0 && (!Number.isInteger(opts.duckUnder) || opts.duckUnder < 0 || opts.duckUnder >= urls.length)) {
|
|
3051
|
+
warn(`--duck-under must be the 0-based index of one of the ${urls.length} --audio tracks (0-${urls.length - 1})`);
|
|
3052
|
+
process.exit(1);
|
|
3053
|
+
}
|
|
3015
3054
|
const client = buildClient(opts.profile);
|
|
3016
3055
|
const result = await client.audio.mix({
|
|
3017
3056
|
audioUrls: urls,
|
|
3018
|
-
...trackVolumes ? { trackVolumes } : {}
|
|
3057
|
+
...trackVolumes ? { trackVolumes } : {},
|
|
3058
|
+
...opts.duckUnder !== void 0 ? { duck: { under: opts.duckUnder, ...opts.duckAmount !== void 0 ? { amount: opts.duckAmount } : {} } } : {}
|
|
3019
3059
|
});
|
|
3020
3060
|
await reportQueuedJob(result, () => client.jobs.get(result.jobId), { ...opts, note: `${urls.length} tracks` });
|
|
3021
3061
|
} catch (err) {
|
|
@@ -3309,6 +3349,185 @@ function savedPostsCommand() {
|
|
|
3309
3349
|
});
|
|
3310
3350
|
return cmd;
|
|
3311
3351
|
}
|
|
3352
|
+
function readJson2(path) {
|
|
3353
|
+
let raw;
|
|
3354
|
+
try {
|
|
3355
|
+
raw = readFileSync(path === "-" ? 0 : path, "utf8");
|
|
3356
|
+
} catch (err) {
|
|
3357
|
+
throw new Error(`cannot read ${path}: ${err.message}`);
|
|
3358
|
+
}
|
|
3359
|
+
try {
|
|
3360
|
+
return JSON.parse(raw);
|
|
3361
|
+
} catch (err) {
|
|
3362
|
+
throw new Error(`${path} is not valid JSON: ${err.message}`);
|
|
3363
|
+
}
|
|
3364
|
+
}
|
|
3365
|
+
function itemFromJson(value, index2 = 0) {
|
|
3366
|
+
const candidate = Array.isArray(value) ? value[index2] : value;
|
|
3367
|
+
if (candidate === void 0 || candidate === null) {
|
|
3368
|
+
throw new Error(Array.isArray(value) ? `the file has no item ${index2}` : "the file holds nothing to save");
|
|
3369
|
+
}
|
|
3370
|
+
return candidate;
|
|
3371
|
+
}
|
|
3372
|
+
function parseFormat(raw) {
|
|
3373
|
+
if (raw === void 0) return "csv";
|
|
3374
|
+
if (raw !== "csv" && raw !== "json") throw new Error("--format must be csv or json");
|
|
3375
|
+
return raw;
|
|
3376
|
+
}
|
|
3377
|
+
function shorten2(text, max) {
|
|
3378
|
+
const flat = text.replace(/\s+/g, " ").trim();
|
|
3379
|
+
return flat.length > max ? `${flat.slice(0, max - 1)}\u2026` : flat;
|
|
3380
|
+
}
|
|
3381
|
+
function collectionsCommand() {
|
|
3382
|
+
const cmd = new Command("collections").description(
|
|
3383
|
+
"your collections: the records a workflow saves (Save to Collection) and reads back (Read Collection)"
|
|
3384
|
+
);
|
|
3385
|
+
cmd.command("list").description("list your collections with their record counts").option("--profile <name>").option("--json").action(async (opts) => {
|
|
3386
|
+
try {
|
|
3387
|
+
const client = buildClient(opts.profile);
|
|
3388
|
+
const page = await client.collections.list();
|
|
3389
|
+
if (opts.json) {
|
|
3390
|
+
emit(page, opts);
|
|
3391
|
+
return;
|
|
3392
|
+
}
|
|
3393
|
+
if (!page.available) {
|
|
3394
|
+
info("collections are not available on this server yet");
|
|
3395
|
+
return;
|
|
3396
|
+
}
|
|
3397
|
+
table(
|
|
3398
|
+
page.data.map((c) => ({ id: c.id, name: c.name, records: c.recordCount, description: shorten2(c.description, 48), updated: c.updatedAt.slice(0, 10) })),
|
|
3399
|
+
["id", "name", "records", "description", "updated"]
|
|
3400
|
+
);
|
|
3401
|
+
info(`caps: ${page.caps.collections ?? "unlimited"} collections, ${page.caps.records ?? "unlimited"} records each`);
|
|
3402
|
+
} catch (err) {
|
|
3403
|
+
handleError(err);
|
|
3404
|
+
}
|
|
3405
|
+
});
|
|
3406
|
+
cmd.command("create <name>").description("create a collection").option("--description <text>", "what goes in it").option("--profile <name>").option("--json").action(async (name, opts) => {
|
|
3407
|
+
try {
|
|
3408
|
+
const client = buildClient(opts.profile);
|
|
3409
|
+
const collection = await client.collections.create({ name, description: opts.description });
|
|
3410
|
+
if (opts.json) {
|
|
3411
|
+
emit(collection, opts);
|
|
3412
|
+
return;
|
|
3413
|
+
}
|
|
3414
|
+
success(`created "${collection.name}" (id ${collection.id})`);
|
|
3415
|
+
} catch (err) {
|
|
3416
|
+
handleError(err);
|
|
3417
|
+
}
|
|
3418
|
+
});
|
|
3419
|
+
cmd.command("show <id>").description("one collection").option("--profile <name>").option("--json").action(async (id, opts) => {
|
|
3420
|
+
try {
|
|
3421
|
+
const client = buildClient(opts.profile);
|
|
3422
|
+
emit(await client.collections.get(id), opts);
|
|
3423
|
+
} catch (err) {
|
|
3424
|
+
handleError(err);
|
|
3425
|
+
}
|
|
3426
|
+
});
|
|
3427
|
+
cmd.command("update <id>").description("rename or re-describe a collection").option("--name <name>", "the new name").option("--description <text>", "the new description; an empty string clears it").option("--profile <name>").option("--json").action(async (id, opts) => {
|
|
3428
|
+
try {
|
|
3429
|
+
if (opts.name === void 0 && opts.description === void 0) {
|
|
3430
|
+
throw new Error("nothing to change: give --name or --description");
|
|
3431
|
+
}
|
|
3432
|
+
const client = buildClient(opts.profile);
|
|
3433
|
+
const collection = await client.collections.update(id, { name: opts.name, description: opts.description });
|
|
3434
|
+
if (opts.json) {
|
|
3435
|
+
emit(collection, opts);
|
|
3436
|
+
return;
|
|
3437
|
+
}
|
|
3438
|
+
success(`updated ${collection.id}`);
|
|
3439
|
+
} catch (err) {
|
|
3440
|
+
handleError(err);
|
|
3441
|
+
}
|
|
3442
|
+
});
|
|
3443
|
+
cmd.command("delete <id>").description("remove a collection and every record in it").option("--profile <name>").action(async (id, opts) => {
|
|
3444
|
+
try {
|
|
3445
|
+
const client = buildClient(opts.profile);
|
|
3446
|
+
await client.collections.delete(id);
|
|
3447
|
+
success(`deleted ${id}`);
|
|
3448
|
+
} catch (err) {
|
|
3449
|
+
handleError(err);
|
|
3450
|
+
}
|
|
3451
|
+
});
|
|
3452
|
+
cmd.command("records <id>").description("a collection's records, newest first").option("--q <words>", "words in the title, text or link").option("--since <iso>", "only records saved at or after this time (ISO)").option("--limit <n>", "page size, 1-100 (default 50)").option("--cursor <cursor>", "the next cursor printed by the previous page").option("--profile <name>").option("--json").action(async (id, opts) => {
|
|
3453
|
+
try {
|
|
3454
|
+
const client = buildClient(opts.profile);
|
|
3455
|
+
const page = await client.collections.records(id, {
|
|
3456
|
+
q: opts.q,
|
|
3457
|
+
since: opts.since,
|
|
3458
|
+
limit: opts.limit ? Number(opts.limit) : void 0,
|
|
3459
|
+
cursor: opts.cursor
|
|
3460
|
+
});
|
|
3461
|
+
if (opts.json) {
|
|
3462
|
+
emit(page, opts);
|
|
3463
|
+
return;
|
|
3464
|
+
}
|
|
3465
|
+
table(
|
|
3466
|
+
page.data.map((r) => ({ id: r.id, saved: r.createdAt.slice(0, 10), headline: shorten2(collectionRecordHeadline(r), 56), url: r.url ?? "" })),
|
|
3467
|
+
["id", "saved", "headline", "url"]
|
|
3468
|
+
);
|
|
3469
|
+
if (page.nextCursor) success(`more: --cursor "${page.nextCursor}"`);
|
|
3470
|
+
} catch (err) {
|
|
3471
|
+
handleError(err);
|
|
3472
|
+
}
|
|
3473
|
+
});
|
|
3474
|
+
cmd.command("add <id>").description("save one record: give the fields, or --file with any JSON item (a post, a search result) to map").option("--title <text>").option("--text <text>").option("--url <link>", "an http(s) link; the default dedupe key").option("--file <path>", "an item as JSON (- reads stdin); a list with --index picks one").option("--index <n>", "which item of a list to save (default 0)").option("--dedupe-key <key>", "overrides the link as the dedupe key").option("--idempotency-key <key>", "the same key twice saves once").option("--profile <name>").option("--json").action(
|
|
3475
|
+
async (id, opts) => {
|
|
3476
|
+
try {
|
|
3477
|
+
const input2 = {
|
|
3478
|
+
title: opts.title,
|
|
3479
|
+
text: opts.text,
|
|
3480
|
+
url: opts.url,
|
|
3481
|
+
dedupeKey: opts.dedupeKey,
|
|
3482
|
+
...opts.file ? { item: itemFromJson(readJson2(opts.file), opts.index ? Number(opts.index) : 0) } : {}
|
|
3483
|
+
};
|
|
3484
|
+
if (!opts.file && opts.title === void 0 && opts.text === void 0 && opts.url === void 0) {
|
|
3485
|
+
throw new Error("nothing to save: give --title, --text, --url or --file");
|
|
3486
|
+
}
|
|
3487
|
+
const client = buildClient(opts.profile);
|
|
3488
|
+
const result = await client.collections.addRecord(id, input2, { idempotencyKey: opts.idempotencyKey });
|
|
3489
|
+
if (opts.json) {
|
|
3490
|
+
emit(result, opts);
|
|
3491
|
+
return;
|
|
3492
|
+
}
|
|
3493
|
+
if (result.outcome === "inserted") {
|
|
3494
|
+
success(`saved ${result.record.id}${result.evicted > 0 ? ` (${result.evicted} oldest evicted past the cap)` : ""}`);
|
|
3495
|
+
} else if (result.outcome === "duplicate") {
|
|
3496
|
+
info(`already there as ${result.record.id} (same link or key, saved ${result.record.createdAt.slice(0, 10)})`);
|
|
3497
|
+
} else {
|
|
3498
|
+
info(`already saved by this same write: ${result.record.id}`);
|
|
3499
|
+
}
|
|
3500
|
+
} catch (err) {
|
|
3501
|
+
handleError(err);
|
|
3502
|
+
}
|
|
3503
|
+
}
|
|
3504
|
+
);
|
|
3505
|
+
cmd.command("remove <id> <recordId>").description("remove one record").option("--profile <name>").action(async (id, recordId, opts) => {
|
|
3506
|
+
try {
|
|
3507
|
+
const client = buildClient(opts.profile);
|
|
3508
|
+
await client.collections.deleteRecord(id, recordId);
|
|
3509
|
+
success(`removed ${recordId}`);
|
|
3510
|
+
} catch (err) {
|
|
3511
|
+
handleError(err);
|
|
3512
|
+
}
|
|
3513
|
+
});
|
|
3514
|
+
cmd.command("export <id>").description("the whole collection as CSV (default) or JSON, to stdout or a file").option("--format <format>", "csv or json (default csv)").option("--since <iso>", "only records saved at or after this time (ISO)").option("--q <words>", "words in the title, text or link").option("--out <path>", "write to this file instead of stdout").option("--profile <name>").action(async (id, opts) => {
|
|
3515
|
+
try {
|
|
3516
|
+
const format2 = parseFormat(opts.format);
|
|
3517
|
+
const client = buildClient(opts.profile);
|
|
3518
|
+
const body = await client.collections.export(id, { format: format2, since: opts.since, q: opts.q });
|
|
3519
|
+
if (opts.out) {
|
|
3520
|
+
writeFileSync(opts.out, body, "utf8");
|
|
3521
|
+
success(`wrote ${opts.out}`);
|
|
3522
|
+
return;
|
|
3523
|
+
}
|
|
3524
|
+
process.stdout.write(body);
|
|
3525
|
+
} catch (err) {
|
|
3526
|
+
handleError(err);
|
|
3527
|
+
}
|
|
3528
|
+
});
|
|
3529
|
+
return cmd;
|
|
3530
|
+
}
|
|
3312
3531
|
function accountsFromFlags(flags) {
|
|
3313
3532
|
const pairs = [
|
|
3314
3533
|
["tiktok", flags.tiktok],
|
|
@@ -3348,7 +3567,7 @@ function parseSchedule(raw) {
|
|
|
3348
3567
|
return raw;
|
|
3349
3568
|
}
|
|
3350
3569
|
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)`);
|
|
3570
|
+
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 or person's profile (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
3571
|
}
|
|
3353
3572
|
var FAMILY_LABEL = {
|
|
3354
3573
|
sound: "Sound advice",
|
|
@@ -3548,6 +3767,48 @@ function competitorsCommand() {
|
|
|
3548
3767
|
handleError(err);
|
|
3549
3768
|
}
|
|
3550
3769
|
});
|
|
3770
|
+
cmd.command("history <id>").description("the brand's scans oldest first: per platform what each found and read (free)").option("--profile <name>").option("--json").action(async (id, opts) => {
|
|
3771
|
+
try {
|
|
3772
|
+
const result = await buildClient(opts.profile).competitors.history(id);
|
|
3773
|
+
if (opts.json) return emit(result, opts);
|
|
3774
|
+
if (result.scans.length === 0) return info("no scans yet");
|
|
3775
|
+
for (const scan of result.scans) {
|
|
3776
|
+
info(`${scan.at.slice(0, 10)} ${scan.id}`);
|
|
3777
|
+
for (const p of scan.platforms) {
|
|
3778
|
+
const parts = [`${p.own ?? "?"} own`, `${p.about ?? "?"} about`];
|
|
3779
|
+
if (p.followers !== null) parts.push(`${p.followers} followers`);
|
|
3780
|
+
if (p.usual !== null) parts.push(`usually ${Math.round(p.usual)} ${p.unit}`);
|
|
3781
|
+
info(` ${p.platform}: ${parts.join(", ")}`);
|
|
3782
|
+
}
|
|
3783
|
+
}
|
|
3784
|
+
} catch (err) {
|
|
3785
|
+
handleError(err);
|
|
3786
|
+
}
|
|
3787
|
+
});
|
|
3788
|
+
cmd.command("compare <id>").description("the brand over a period, and a second one to compare with (free; ISO datetimes, a period is at most a year)").requiredOption("--from <iso>").requiredOption("--to <iso>").option("--vs-from <iso>").option("--vs-to <iso>").option("--profile <name>").option("--json").action(async (id, opts) => {
|
|
3789
|
+
try {
|
|
3790
|
+
if (opts.vsFrom === void 0 !== (opts.vsTo === void 0)) throw new Error("--vs-from and --vs-to go together");
|
|
3791
|
+
const result = await buildClient(opts.profile).competitors.compare(id, { from: opts.from, to: opts.to, ...opts.vsFrom && opts.vsTo ? { vsFrom: opts.vsFrom, vsTo: opts.vsTo } : {} });
|
|
3792
|
+
if (opts.json) return emit(result, opts);
|
|
3793
|
+
for (const period of result.periods) {
|
|
3794
|
+
info(`${period.from.slice(0, 10)} \u2013 ${period.to.slice(0, 10)}`);
|
|
3795
|
+
if (period.platforms.length === 0) info(" nothing was read in these days");
|
|
3796
|
+
for (const p of period.platforms) {
|
|
3797
|
+
const parts = [`${p.own} own`, `${p.about} about`];
|
|
3798
|
+
if (p.usual !== null) parts.push(`usually ${Math.round(p.usual)} ${p.unit}`);
|
|
3799
|
+
if (p.followers) parts.push(`${p.followers.value} followers${p.change === null ? "" : ` (${p.change >= 0 ? "+" : ""}${p.change})`}`);
|
|
3800
|
+
info(` ${p.platform}: ${parts.join(", ")}`);
|
|
3801
|
+
for (const lesson of p.lessons) info(` \u2022 ${lesson.text}`);
|
|
3802
|
+
for (const postId of p.best) {
|
|
3803
|
+
const url = result.posts[postId]?.url;
|
|
3804
|
+
if (url) info(` ${url}`);
|
|
3805
|
+
}
|
|
3806
|
+
}
|
|
3807
|
+
}
|
|
3808
|
+
} catch (err) {
|
|
3809
|
+
handleError(err);
|
|
3810
|
+
}
|
|
3811
|
+
});
|
|
3551
3812
|
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
3813
|
try {
|
|
3553
3814
|
const result = await buildClient(opts.profile).competitors.markDone(cardId, opts.link ? { postUrl: checkPostLink(opts.link) } : {});
|
|
@@ -5360,6 +5621,9 @@ var SOURCE_LABELS = {
|
|
|
5360
5621
|
profile: "the profile's saved workspace",
|
|
5361
5622
|
none: "nothing \u2014 the personal space"
|
|
5362
5623
|
};
|
|
5624
|
+
function isEditPlanMode(v) {
|
|
5625
|
+
return EDIT_PLAN_MODES.includes(v);
|
|
5626
|
+
}
|
|
5363
5627
|
function readJsonFile(path) {
|
|
5364
5628
|
let raw;
|
|
5365
5629
|
try {
|
|
@@ -5453,7 +5717,10 @@ function editCommand() {
|
|
|
5453
5717
|
}
|
|
5454
5718
|
}
|
|
5455
5719
|
);
|
|
5456
|
-
cmd.command("apply-edl").description("render an edit decision list into a video or audio cut").requiredOption("--edl <file>", "path to a JSON file holding the EDL").option("--transcript <file>", "optional transcript JSON to remap through the cut").option("--source <url>", "positional media-URL override for edl.sources[i] (repeatable)", collectVariadic).option("--output <kind>", "video | audio", "video").option("--quality <q>", "proxy | final", "final").option("--crossfade-ms <ms>", "default crossfade on boundaries with no transition", (v) => parseInt(v, 10)).option(
|
|
5720
|
+
cmd.command("apply-edl").description("render an edit decision list into a video or audio cut").requiredOption("--edl <file>", "path to a JSON file holding the EDL").option("--transcript <file>", "optional transcript JSON to remap through the cut").option("--source <url>", "positional media-URL override for edl.sources[i] (repeatable)", collectVariadic).option("--output <kind>", "video | audio", "video").option("--quality <q>", "proxy | final", "final").option("--crossfade-ms <ms>", "default crossfade on boundaries with no transition", (v) => parseInt(v, 10)).option(
|
|
5721
|
+
"--clip-key <key>",
|
|
5722
|
+
'the plan clip this render cuts, "<first inMs>-<last outMs>" of a clips-mode plan clip; stamped back on the result as clipKey'
|
|
5723
|
+
).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(
|
|
5457
5724
|
async (opts) => {
|
|
5458
5725
|
if (opts.output !== "video" && opts.output !== "audio") {
|
|
5459
5726
|
warn(`--output must be "video" or "audio" (got "${opts.output}")`);
|
|
@@ -5471,7 +5738,8 @@ function editCommand() {
|
|
|
5471
5738
|
...opts.transcript ? { transcript: readJsonFile(opts.transcript) } : {},
|
|
5472
5739
|
output: opts.output,
|
|
5473
5740
|
quality: opts.quality,
|
|
5474
|
-
...opts.crossfadeMs !== void 0 ? { crossfadeMs: opts.crossfadeMs } : {}
|
|
5741
|
+
...opts.crossfadeMs !== void 0 ? { crossfadeMs: opts.crossfadeMs } : {},
|
|
5742
|
+
...opts.clipKey !== void 0 ? { clipKey: opts.clipKey } : {}
|
|
5475
5743
|
});
|
|
5476
5744
|
await reportQueuedJob(result, () => client.jobs.getStatus(result.jobId), {
|
|
5477
5745
|
json: opts.json,
|
|
@@ -5484,17 +5752,17 @@ function editCommand() {
|
|
|
5484
5752
|
}
|
|
5485
5753
|
}
|
|
5486
5754
|
);
|
|
5487
|
-
cmd.command("plan").description("plan a transcript-driven cut / clips / chapters (Cloud edition)").requiredOption("--mode <mode>", "
|
|
5755
|
+
cmd.command("plan").description("plan a transcript-driven cut / clips / chapters / trailer (Cloud edition)").requiredOption("--mode <mode>", EDIT_PLAN_MODES.join(" | ")).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(
|
|
5488
5756
|
"--source <url>",
|
|
5489
5757
|
"a media source as [id=]url[@audio|@video] (repeatable); id defaults to source-N, kind to video",
|
|
5490
5758
|
collectVariadic
|
|
5491
5759
|
).option("--sources-file <file>", "JSON array of full EditPlanSource rows (overrides --source)").option(
|
|
5492
5760
|
"--offsets <file>",
|
|
5493
5761
|
"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(
|
|
5762
|
+
).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 / trailer 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(
|
|
5495
5763
|
async (opts) => {
|
|
5496
|
-
if (opts.mode
|
|
5497
|
-
warn(`--mode must be "
|
|
5764
|
+
if (!isEditPlanMode(opts.mode)) {
|
|
5765
|
+
warn(`--mode must be one of ${EDIT_PLAN_MODES.join(", ")} (got "${opts.mode}")`);
|
|
5498
5766
|
process.exit(1);
|
|
5499
5767
|
}
|
|
5500
5768
|
if (opts.planTier !== "economy" && opts.planTier !== "standard" && opts.planTier !== "premium") {
|
|
@@ -5606,6 +5874,7 @@ program.addCommand(mediaCommand());
|
|
|
5606
5874
|
program.addCommand(audioCommand());
|
|
5607
5875
|
program.addCommand(presetsCommand());
|
|
5608
5876
|
program.addCommand(savedPostsCommand());
|
|
5877
|
+
program.addCommand(collectionsCommand());
|
|
5609
5878
|
program.addCommand(competitorsCommand());
|
|
5610
5879
|
program.addCommand(communityCommand());
|
|
5611
5880
|
program.addCommand(pickerCatalogsCommand());
|