@nodaro/cli 1.29.0 → 1.30.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/dist/index.js CHANGED
@@ -9,11 +9,19 @@ import { join } from 'path';
9
9
  import { createServer } from 'http';
10
10
  import { randomBytes } from 'crypto';
11
11
  import { spawn } from 'child_process';
12
- import { createClient, StaticTokenAuth, UnauthorizedError, NodaroError, LOCATION_ASSET_TYPES, LOCATION_ATTACH_COLUMNS, OBJECT_ASSET_TYPES, OBJECT_ATTACH_COLUMNS } from '@nodaro/sdk';
12
+ import { ContinuationRefusedError, createClient, StaticTokenAuth, UnauthorizedError, NodaroError, LOCATION_ASSET_TYPES, LOCATION_ATTACH_COLUMNS, OBJECT_ASSET_TYPES, OBJECT_ATTACH_COLUMNS } from '@nodaro/sdk';
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, 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_VIDEO_MASK_PROVIDER, VIDEO_MASK_PROVIDERS, VIDEO_MASK_LIMITS, MASK_COMPOSITE_BOUNDS, MASK_COMPOSITE_DEFAULTS, MASK_COMPOSITE_BACKGROUND_FITS, MASK_COMPOSITE_AUDIO_SOURCES, 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';
16
+ import { CHARACTER_STYLES } from '@nodaro/shared/entities';
17
+ import { TRANSCRIBE_PROVIDERS, transcribeLaneSupportsWordTimestamps, DIALOGUE_PROVIDERS, dialogueStabilityAccepted, dialogueProviderOf, getDialogueCapabilities, TRANSCRIBE_LANES, DEFAULT_TRANSCRIBE_PROVIDER } from '@nodaro/shared/models';
18
+ import { OVERLAY_ANCHORS, OVERLAY_PLATFORM_IDS, DEFAULT_VIDEO_MASK_PROVIDER, VIDEO_MASK_PROVIDERS, VIDEO_MASK_LIMITS, MASK_COMPOSITE_BOUNDS, MASK_COMPOSITE_DEFAULTS, MASK_COMPOSITE_BACKGROUND_FITS, MASK_COMPOSITE_AUDIO_SOURCES } from '@nodaro/shared/media';
19
+ import { ALL_CAPTION_STYLES, DEFAULT_CAPTION_LOOK, CAPTION_LOOK_IDS, CAPTION_MAX_WORDS_PER_LINE_MIN, CAPTION_MAX_WORDS_PER_LINE_MAX, SUPPORTED_FONT_NAMES } from '@nodaro/shared/captions';
20
+ import { VIDEO_OVERLAY_PRESET_IDS, VIDEO_OVERLAY_CORNERS, VIDEO_OVERLAY_OUTPUT_ASPECTS, isVideoOverlayPresetId, isVideoOverlayCorner, isVideoOverlayOutputAspect, VIDEO_OVERLAY_FITS } from '@nodaro/shared/video';
21
+ import { SOCIAL_PLATFORMS, COMPETITOR_ACCOUNT_KEYS, isMeasurableCard, isSocialPost, COMPETITOR_ABOUT_PLATFORMS, COMPETITOR_SCHEDULES } from '@nodaro/shared/social';
22
+ import { collectionRecordHeadline } from '@nodaro/shared/nodes';
23
+ import { RECAST_SEGMENT_PACKS } from '@nodaro/shared/apps';
24
+ import { SPEAKER_LAYOUT_IDS, EDL_TARGET_ASPECTS, EDIT_PLAN_TIERS, EDIT_PLAN_MODES } from '@nodaro/shared/edl';
17
25
 
18
26
  var __getOwnPropNames = Object.getOwnPropertyNames;
19
27
  var __commonJS = (cb, mod) => function __require() {
@@ -29,7 +37,7 @@ var require_package = __commonJS({
29
37
  "package.json"(exports$1, module) {
30
38
  module.exports = {
31
39
  name: "@nodaro/cli",
32
- version: "1.29.0",
40
+ version: "1.30.0",
33
41
  description: "Command-line interface for Nodaro \u2014 list and run workflows, inspect jobs and executions, manage projects from the terminal.",
34
42
  type: "module",
35
43
  license: "Apache-2.0",
@@ -70,11 +78,11 @@ var require_package = __commonJS({
70
78
  "@inquirer/confirm": "^6.0.12",
71
79
  "@inquirer/input": "^5.0.12",
72
80
  "@inquirer/select": "^5.1.4",
73
- "@nodaro/sdk": "^2.26.0",
74
- "@nodaro/shared": "^3.31.0",
81
+ "@nodaro/sdk": "^2.27.0",
82
+ "@nodaro/shared": "^3.32.0",
75
83
  commander: "^12.1.0",
76
84
  picocolors: "^1.1.1",
77
- "@nodaro/prompts": "^1.37.1"
85
+ "@nodaro/prompts": "^1.38.0"
78
86
  },
79
87
  devDependencies: {
80
88
  tsup: "^8.5.0",
@@ -398,7 +406,7 @@ function saveWorkspace(profileName, workspaceId) {
398
406
  }
399
407
 
400
408
  // src/client.ts
401
- var CLI_VERSION = "1.29.0" ;
409
+ var CLI_VERSION = "1.30.0" ;
402
410
  function buildClient(profileName) {
403
411
  const { name, profile } = getProfile(profileName);
404
412
  if (!profile) {
@@ -5822,6 +5830,11 @@ var SOURCE_LABELS = {
5822
5830
  function isEditPlanMode(v) {
5823
5831
  return EDIT_PLAN_MODES.includes(v);
5824
5832
  }
5833
+ var CONTINUATION_NEXT_STEP = {
5834
+ already_running: (id) => ` \u2014 follow it: nodaro jobs get ${id}`,
5835
+ continuation_superseded: (id) => ` \u2014 continue that one: nodaro edit continue-use-case ${id} --mode from-failed`,
5836
+ render_final_already_rendered: (id) => ` \u2014 its result is the one to use: nodaro jobs get ${id}`
5837
+ };
5825
5838
  function readJsonFile(path) {
5826
5839
  let raw;
5827
5840
  try {
@@ -5950,6 +5963,92 @@ function editCommand() {
5950
5963
  }
5951
5964
  }
5952
5965
  );
5966
+ const framingLayouts = ["auto", ...SPEAKER_LAYOUT_IDS];
5967
+ cmd.command("tighten-episode").description("tighten a podcast recording in one step (transcribe, cut silences, render; optional captions, music and framing)").requiredOption("--media <url>", "the recording (video or audio URL, up to 3 hours)").option("--music <url>", "optional music bed, ducked under the voice").option("--output <kind>", "video | audio (an audio recording always makes an audio episode)").option("--framing <aspect>", `frame a video episode on its speakers: ${EDL_TARGET_ASPECTS.join(" | ")}`).option("--layout <layout>", `layout with --framing (default auto): ${framingLayouts.join(" | ")}`).option("--no-captions", "no captions on a video episode").option("--review", "stop at a preview to review (render the final with `nodaro edit continue-use-case <jobId> --mode render-final`)").option("--plan-tier <tier>", EDIT_PLAN_TIERS.join(" | ")).option("--instructions <text>", "editing instructions for the planner").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(
5968
+ async (opts) => {
5969
+ if (opts.output !== void 0 && opts.output !== "video" && opts.output !== "audio") {
5970
+ warn(`--output must be "video" or "audio" (got "${opts.output}")`);
5971
+ process.exit(1);
5972
+ }
5973
+ if (opts.planTier !== void 0 && !EDIT_PLAN_TIERS.includes(opts.planTier)) {
5974
+ warn(`--plan-tier must be ${EDIT_PLAN_TIERS.join(", ")} (got "${opts.planTier}")`);
5975
+ process.exit(1);
5976
+ }
5977
+ if (opts.framing !== void 0 && !EDL_TARGET_ASPECTS.includes(opts.framing)) {
5978
+ warn(`--framing must be ${EDL_TARGET_ASPECTS.join(", ")} (got "${opts.framing}")`);
5979
+ process.exit(1);
5980
+ }
5981
+ if (opts.layout !== void 0 && opts.framing === void 0) {
5982
+ warn("--layout applies with --framing only (it picks the framed layout)");
5983
+ process.exit(1);
5984
+ }
5985
+ if (opts.layout !== void 0 && !framingLayouts.includes(opts.layout)) {
5986
+ warn(`--layout must be ${framingLayouts.join(", ")} (got "${opts.layout}")`);
5987
+ process.exit(1);
5988
+ }
5989
+ try {
5990
+ const client = buildClient(opts.profile);
5991
+ const result = await client.edit.tightenEpisode({
5992
+ mediaUrl: opts.media,
5993
+ ...opts.music ? { musicUrl: opts.music } : {},
5994
+ ...opts.output ? { output: opts.output } : {},
5995
+ ...opts.framing ? { framing: { aspect: opts.framing, layout: opts.layout ?? "auto" } } : {},
5996
+ // commander's --no-captions defaults `captions` to true: send it only when turned off.
5997
+ ...opts.captions === false ? { captions: false } : {},
5998
+ ...opts.review ? { reviewBeforeRender: true } : {},
5999
+ ...opts.planTier ? { planTier: opts.planTier } : {},
6000
+ ...opts.instructions ? { instructions: opts.instructions } : {}
6001
+ });
6002
+ await reportQueuedJob(result, () => client.jobs.getStatus(result.jobId), {
6003
+ json: opts.json,
6004
+ watch: opts.watch,
6005
+ pollInterval: opts.pollInterval,
6006
+ note: "tighten-episode"
6007
+ });
6008
+ } catch (err) {
6009
+ handleError(err);
6010
+ }
6011
+ }
6012
+ );
6013
+ cmd.command("continue-use-case <jobId>").description("continue a Tighten Episode run as a new job: from where it failed, or its Render final after a review").requiredOption("--mode <mode>", "from-failed | render-final").option("--edit <file>", "render-final only: a JSON file holding the reviewer's edit of the plan (an EDL)").option("--idempotency-key <key>", "sent as Idempotency-Key: a retry with the same key answers the run already started").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(async (jobId, opts) => {
6014
+ if (opts.mode !== "from-failed" && opts.mode !== "render-final") {
6015
+ warn(`--mode must be "from-failed" or "render-final" (got "${opts.mode}")`);
6016
+ process.exit(1);
6017
+ }
6018
+ if (opts.edit !== void 0 && opts.mode !== "render-final") {
6019
+ warn("--edit applies to --mode render-final only");
6020
+ process.exit(1);
6021
+ }
6022
+ try {
6023
+ const client = buildClient(opts.profile);
6024
+ const result = await client.edit.continueUseCase(
6025
+ {
6026
+ jobId,
6027
+ mode: opts.mode,
6028
+ ...opts.edit !== void 0 ? { editedEdl: readJsonFile(opts.edit) } : {}
6029
+ },
6030
+ opts.idempotencyKey ? { idempotencyKey: opts.idempotencyKey } : void 0
6031
+ );
6032
+ await reportQueuedJob(result, () => client.jobs.getStatus(result.jobId), {
6033
+ json: opts.json,
6034
+ watch: opts.watch,
6035
+ pollInterval: opts.pollInterval,
6036
+ note: `continue-use-case (${opts.mode})`
6037
+ });
6038
+ } catch (err) {
6039
+ if (err instanceof ContinuationRefusedError) {
6040
+ if (opts.json) {
6041
+ emit({ error: { code: err.code, message: err.message }, jobId: err.jobId }, opts);
6042
+ } else {
6043
+ console.error(pc3.red(`\u2717 ${err.message}`));
6044
+ console.error(pc3.dim(` code: ${err.code}`));
6045
+ console.error(pc3.dim(` job: ${err.jobId}${CONTINUATION_NEXT_STEP[err.code]?.(err.jobId) ?? ""}`));
6046
+ }
6047
+ process.exit(1);
6048
+ }
6049
+ handleError(err);
6050
+ }
6051
+ });
5953
6052
  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(
5954
6053
  "--source <url>",
5955
6054
  "a media source as [id=]url[@audio|@video] (repeatable); id defaults to source-N, kind to video",