@kinetune/cli 0.4.0 → 0.6.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 CHANGED
@@ -19,6 +19,14 @@ kinetune auth login --api-key kt_live_KEY # or store an organization API key
19
19
  kinetune auth status
20
20
  ```
21
21
 
22
+ A sign-in acts for the organization you picked. To work in another one, sign in again and pick it:
23
+
24
+ ```bash
25
+ kinetune organizations list # yours, with your role; "current" is the one you act for
26
+ kinetune organizations create --name "Night Shift Records"
27
+ kinetune auth login --organization ORG_ID # the consent screen preselects it
28
+ ```
29
+
22
30
  In CI, set `KINETUNE_API_KEY` instead; it wins over the stored sign-in. Credentials live in `~/.config/kinetune/config.json` (mode 600, `KINETUNE_CONFIG_DIR` to move it).
23
31
 
24
32
  ## Make a video
@@ -34,6 +42,18 @@ kinetune videos download VIDEO_ID
34
42
 
35
43
  `kinetune create …` never spends credits without asking: pass `--yes`, or `--max-credits N` to refuse anything pricier.
36
44
 
45
+ ## The song's own lyrics
46
+
47
+ Every song is transcribed, and a transcription can mishear a word. Give the song its lyrics (plain text, Suno
48
+ `[Verse]`/`[Chorus]` tags are fine, or an `.srt`, `.vtt` or `.lrc` file) and videos spell every word your way and
49
+ break lines where you do; the timing still comes from the audio.
50
+
51
+ ```bash
52
+ kinetune songs create --artist-id ARTIST_ID --title "Midnight Drive" --audio ./midnight-drive.wav --cover-art ./cover.jpg --lyrics-file ./midnight-drive.txt
53
+ kinetune songs set-lyrics SONG_ID --lyrics-file ./midnight-drive.srt # add or replace them later
54
+ kinetune songs clear-lyrics SONG_ID # back to the transcribed words
55
+ ```
56
+
37
57
  ## Find artists and songs
38
58
 
39
59
  Lists return 50 per page, sorted by name; search with `--q` and page with `--limit` (1-100) and `--offset`.
package/dist/kinetune.mjs CHANGED
@@ -15769,7 +15769,7 @@ function extractDefs(ctx, schema) {
15769
15769
  return;
15770
15770
  }
15771
15771
  const seen = entry[1];
15772
- const { ref, defId } = makeURI(entry);
15772
+ const { ref: ref2, defId } = makeURI(entry);
15773
15773
  seen.def = { ...seen.schema };
15774
15774
  if (defId)
15775
15775
  seen.defId = defId;
@@ -15777,7 +15777,7 @@ function extractDefs(ctx, schema) {
15777
15777
  for (const key in schema2) {
15778
15778
  delete schema2[key];
15779
15779
  }
15780
- schema2.$ref = ref;
15780
+ schema2.$ref = ref2;
15781
15781
  };
15782
15782
  if (ctx.cycles === "throw") {
15783
15783
  for (const entry of ctx.seen.entries()) {
@@ -15938,11 +15938,11 @@ function finalize(ctx, schema) {
15938
15938
  return;
15939
15939
  const schema2 = seen.def ?? seen.schema;
15940
15940
  const _cached = { ...schema2 };
15941
- const ref = seen.ref;
15941
+ const ref2 = seen.ref;
15942
15942
  seen.ref = null;
15943
- if (ref) {
15944
- flattenRef(ref);
15945
- const refSeen = ctx.seen.get(ref);
15943
+ if (ref2) {
15944
+ flattenRef(ref2);
15945
+ const refSeen = ctx.seen.get(ref2);
15946
15946
  const refSchema = refSeen.schema;
15947
15947
  if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
15948
15948
  schema2.allOf = schema2.allOf ?? [];
@@ -15951,7 +15951,7 @@ function finalize(ctx, schema) {
15951
15951
  assignProps(schema2, refSchema);
15952
15952
  }
15953
15953
  assignProps(schema2, _cached);
15954
- const isParentRef = zodSchema._zod.parent === ref;
15954
+ const isParentRef = zodSchema._zod.parent === ref2;
15955
15955
  if (isParentRef) {
15956
15956
  for (const key in schema2) {
15957
15957
  if (key === "$ref" || key === "allOf")
@@ -15972,7 +15972,7 @@ function finalize(ctx, schema) {
15972
15972
  }
15973
15973
  }
15974
15974
  const parent = zodSchema._zod.parent;
15975
- if (parent && parent !== ref) {
15975
+ if (parent && parent !== ref2) {
15976
15976
  flattenRef(parent);
15977
15977
  const parentSeen = ctx.seen.get(parent);
15978
15978
  if (parentSeen?.schema.$ref) {
@@ -18870,11 +18870,11 @@ function applyMinItems(items, minItems) {
18870
18870
  function decodeJSONPointerSegment(segment) {
18871
18871
  return segment.replace(/~1/g, "/").replace(/~0/g, "~");
18872
18872
  }
18873
- function resolveRef(ref, ctx) {
18874
- if (!ref.startsWith("#")) {
18873
+ function resolveRef(ref2, ctx) {
18874
+ if (!ref2.startsWith("#")) {
18875
18875
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
18876
18876
  }
18877
- const path4 = ref.slice(1).split("/").filter(Boolean);
18877
+ const path4 = ref2.slice(1).split("/").filter(Boolean);
18878
18878
  if (path4.length === 0) {
18879
18879
  return ctx.rootSchema;
18880
18880
  }
@@ -18882,11 +18882,11 @@ function resolveRef(ref, ctx) {
18882
18882
  if (path4[0] === defsKey) {
18883
18883
  const key = path4[1] === void 0 ? void 0 : decodeJSONPointerSegment(path4[1]);
18884
18884
  if (!key || !ctx.defs[key]) {
18885
- throw new Error(`Reference not found: ${ref}`);
18885
+ throw new Error(`Reference not found: ${ref2}`);
18886
18886
  }
18887
18887
  return ctx.defs[key];
18888
18888
  }
18889
- throw new Error(`Reference not found: ${ref}`);
18889
+ throw new Error(`Reference not found: ${ref2}`);
18890
18890
  }
18891
18891
  function checkObjectGuards(objectSchema, guards) {
18892
18892
  const guard = z.transform((value) => value).check((payload) => {
@@ -20370,15 +20370,15 @@ var MEDIA_BACKGROUND_SOURCES = ["ai-image", "ai-video", "stock-photo", "stock-vi
20370
20370
  var BACKGROUND_SOURCES2 = {
20371
20371
  "ai-image": { label: "AI image", description: "An image made for this Look, moving slowly across the song.", kind: "image", source: "generated" },
20372
20372
  "ai-video": { label: "AI video loop", description: "An AI image brought to life as a seamless loop.", kind: "video", source: "generated" },
20373
- "stock-photo": { label: "Stock photo", description: "A Pexels photo, picked by the director or by you.", kind: "image", source: "stock" },
20374
- "stock-video": { label: "Stock video", description: "A Pexels clip made into a seamless loop.", kind: "video", source: "stock" },
20373
+ "stock-photo": { label: "Stock photo", description: "A stock photo, picked by the director or by you.", kind: "image", source: "stock" },
20374
+ "stock-video": { label: "Stock video", description: "A stock clip made into a seamless loop.", kind: "video", source: "stock" },
20375
20375
  "upload-photo": { label: "Your photo", description: "A photo you upload, moving slowly across the song.", kind: "image", source: "upload" },
20376
20376
  "upload-video": { label: "Your video", description: "A clip you upload, made into a seamless loop.", kind: "video", source: "upload" },
20377
20377
  designed: { label: "Designed", description: "A drawn gradient or pattern.", kind: null, source: null }
20378
20378
  };
20379
20379
  var MAX_BACKGROUND_SCENES = 4;
20380
20380
  var SINGLE_SCENE_STYLES = ["behind", "screen"];
20381
- var StockIdSchema = external_exports.string().regex(/^\d{1,20}$/, "A Pexels photo or video id (digits)");
20381
+ var StockIdSchema = external_exports.string().regex(/^\d{1,20}$/, "A stock photo or video id (digits)");
20382
20382
  var BackgroundRequestSchema = external_exports.object({
20383
20383
  source: external_exports.enum(BACKGROUND_SOURCE_IDS).optional(),
20384
20384
  quality: external_exports.enum(BACKGROUND_TIERS).default("high"),
@@ -20386,7 +20386,7 @@ var BackgroundRequestSchema = external_exports.object({
20386
20386
  upload_id: external_exports.string().min(1).max(120).optional(),
20387
20387
  /** How many scenes an AI image background has (1 by default). */
20388
20388
  scenes: external_exports.number().int().min(1).max(MAX_BACKGROUND_SCENES).optional(),
20389
- /** The Pexels photo or video (GET /stock) for the stock-photo and stock-video sources; omitted, the director searches and picks. */
20389
+ /** The stock photo or video (GET /stock) for the stock-photo and stock-video sources; omitted, the director searches and picks. */
20390
20390
  stock_id: StockIdSchema.optional()
20391
20391
  }).strict();
20392
20392
  var BACKGROUND_UPLOAD_LIMITS = {
@@ -20459,8 +20459,8 @@ var CANVAS_SOURCE_IDS = ["ai-video", "ai-image", "stock-photo", "stock-video"];
20459
20459
  var CANVAS_SOURCES = {
20460
20460
  "ai-video": { label: "AI video", description: "An image made from your cover\u2019s world, brought to life by a video model.", kind: "video", source: "generated" },
20461
20461
  "ai-image": { label: "AI image", description: "An image made from your cover\u2019s world, moved by our motion engine.", kind: "image", source: "generated" },
20462
- "stock-photo": { label: "Stock photo", description: "A Pexels photo moved by our motion engine.", kind: "image", source: "stock" },
20463
- "stock-video": { label: "Stock video", description: "A Pexels clip cut into a seamless loop.", kind: "video", source: "stock" }
20462
+ "stock-photo": { label: "Stock photo", description: "A stock photo moved by our motion engine.", kind: "image", source: "stock" },
20463
+ "stock-video": { label: "Stock video", description: "A stock clip cut into a seamless loop.", kind: "video", source: "stock" }
20464
20464
  };
20465
20465
  var CANVAS_QUALITIES = ["standard", "high"];
20466
20466
  var CANVAS_RESOLUTIONS = ["720p", "1080p"];
@@ -20475,7 +20475,7 @@ var CanvasRequestSchema = external_exports.object({
20475
20475
  direction: external_exports.string().trim().max(2e3).optional(),
20476
20476
  feature_artist: external_exports.enum(CANVAS_FEATURE_ARTIST_MODES).default("auto"),
20477
20477
  seconds: external_exports.number().int().min(CANVAS_MIN_SECONDS).max(CANVAS_MAX_SECONDS).default(CANVAS_MAX_SECONDS),
20478
- /** The Pexels photo or video (GET /stock) for the stock sources; omitted, the director searches and picks. */
20478
+ /** The stock photo or video (GET /stock) for the stock sources; omitted, the director searches and picks. */
20479
20479
  stock_id: StockIdSchema.optional()
20480
20480
  }).strict().superRefine((value, ctx) => {
20481
20481
  if (value.feature_artist === "always" && CANVAS_SOURCES[value.source].source === "stock")
@@ -20486,14 +20486,16 @@ var CanvasRequestSchema = external_exports.object({
20486
20486
  var VideoRequestSchema = external_exports.discriminatedUnion("type", [LyricVideoRequestSchema, CanvasRequestSchema]);
20487
20487
 
20488
20488
  // ../api-spec/src/index.ts
20489
- var SCOPES = ["videos:read", "videos:write", "music:read", "music:write", "library:read", "library:write"];
20489
+ var SCOPES = ["videos:read", "videos:write", "music:read", "music:write", "library:read", "library:write", "organizations:read", "organizations:write"];
20490
20490
  var SCOPE_DESCRIPTIONS = {
20491
20491
  "videos:read": "See videos, quotes and your credit balance",
20492
20492
  "videos:write": "Quote, create, cancel, retry and delete videos (spends credits)",
20493
20493
  "music:read": "See artists, their photos and songs",
20494
20494
  "music:write": "Add, rename and archive artists and songs, upload songs and artist photos",
20495
20495
  "library:read": "Browse Looks",
20496
- "library:write": "Rename, delete and publish your Looks"
20496
+ "library:write": "Rename, delete and publish your Looks",
20497
+ "organizations:read": "See the organizations you belong to",
20498
+ "organizations:write": "Create organizations you own"
20497
20499
  };
20498
20500
  var id = (what) => external_exports.string().min(1).max(120).describe(`The ${what} id`);
20499
20501
  var songId = id("song");
@@ -20506,6 +20508,7 @@ var search = (q) => ({
20506
20508
  offset: external_exports.number().int().min(0).optional().describe("How many results to skip")
20507
20509
  });
20508
20510
  var httpsUrl = (what) => external_exports.string().url().max(2e3).describe(`A public https URL of ${what}`);
20511
+ var LYRICS = "The song\u2019s lyrics as text: plain (Suno-style [Verse]/[Chorus] tags and (x2) marks are fine), or the contents of an SRT, WebVTT or LRC file. Every word is still timed from the audio: your text fixes misheard words and sets where lines break in videos. A part sung again (a chorus) can be written once; lyrics that don\u2019t match what\u2019s sung, or cover only part of it, are refused";
20509
20512
  var COVER_SIZES = "cover_art.url is the cover at up to 1536 px (JPEG; width and height describe it), preview_url a 640 px and thumbnail_url a 160 px WebP. Image links are signed for 7 days and stay the same all day, so they can be cached.";
20510
20513
  var { type: _lyricType, quote_id: _lyricQuote, ...lyricShape } = LyricVideoRequestSchema.shape;
20511
20514
  var { type: _canvasType, quote_id: _canvasQuote, ...canvasShape } = CanvasRequestSchema.shape;
@@ -20517,7 +20520,7 @@ var lyricInput = external_exports.object({
20517
20520
  song_id: songId,
20518
20521
  callback_url: CALLBACK,
20519
20522
  metadata: METADATA,
20520
- look: lyricShape.look.describe(`{"mode":"existing","id":"look_\u2026"} to reuse a saved Look (add "lyric_style" to render it in another lyric style, at no extra cost), or {"mode":"new","category":"\u2026","lyric_style":"\u2026","background":{"source":"ai-image","quality":"high"},"visibility":"private","direction":"\u2026"} to have one designed (background.source "upload-photo"/"upload-video" with background.upload_id from upload_background designs it around your own media; such a Look stays private. "stock-photo"/"stock-video" with background.stock_id from search_stock uses that Pexels item instead of the director's pick). lyric_style (optional, from get_options) sets how the lyrics are presented and animated: block-stack, punch, player, neon, terminal, cinematic\u2026 Omit it and the director picks one. background.scenes (2\u20134, AI image only) makes that many shots of the same world that cut on the song's sections, each priced like the first. The singer is left out unless asked: feature_artist "always" (default "never") makes them the subject of the background, recognizable from their artist photos (add_artist_photos); it needs an AI image or AI video background, a private Look and display.cover false (the cover would hide them), and that Look then only serves this artist's songs. A saved Look that shows an artist (featured_artist) only serves that artist's songs, also with display.cover false`),
20523
+ look: lyricShape.look.describe(`{"mode":"existing","id":"look_\u2026"} to reuse a saved Look (add "lyric_style" to render it in another lyric style, at no extra cost), or {"mode":"new","category":"\u2026","lyric_style":"\u2026","background":{"source":"ai-image","quality":"high"},"visibility":"private","direction":"\u2026"} to have one designed (background.source "upload-photo"/"upload-video" with background.upload_id from upload_background designs it around your own media; such a Look stays private. "stock-photo"/"stock-video" with background.stock_id from search_stock uses that stock photo or clip instead of the director's pick). lyric_style (optional, from get_options) sets how the lyrics are presented and animated: block-stack, punch, player, neon, terminal, cinematic\u2026 Omit it and the director picks one. background.scenes (2\u20134, AI image only) makes that many shots of the same world that cut on the song's sections, each priced like the first. The singer is left out unless asked: feature_artist "always" (default "never") makes them the subject of the background, recognizable from their artist photos (add_artist_photos); it needs an AI image or AI video background, a private Look and display.cover false (the cover would hide them), and that Look then only serves this artist's songs. A saved Look that shows an artist (featured_artist) only serves that artist's songs, also with display.cover false`),
20521
20524
  aspect_ratios: lyricShape.aspect_ratios.describe('Formats to render, each its own file: "9:16" (vertical), "16:9" (wide), "1:1" (square)'),
20522
20525
  display: lyricShape.display.describe("Which elements show (title, artist, cover, lyrics, badges, headline) and their sizes. cover must be false to show the artist in the background"),
20523
20526
  trim: lyricShape.trim.describe("Render only this section of the song (at least 8 seconds)"),
@@ -20529,7 +20532,7 @@ var canvasInput = external_exports.object({
20529
20532
  callback_url: CALLBACK,
20530
20533
  metadata: METADATA,
20531
20534
  source: canvasShape.source.describe("ai-video (default), ai-image, stock-photo or stock-video"),
20532
- stock_id: canvasShape.stock_id.describe("With a stock source: the Pexels photo or video (search_stock with seconds) to use instead of the director's pick"),
20535
+ stock_id: canvasShape.stock_id.describe("With a stock source: the stock photo or video (search_stock with seconds) to use instead of the director's pick"),
20533
20536
  quality: canvasShape.quality.describe("AI video model tier: standard or high"),
20534
20537
  resolution: canvasShape.resolution.describe("1080p (1080\xD71920) or 720p"),
20535
20538
  style: canvasShape.style.describe("Optional visual style"),
@@ -20539,6 +20542,43 @@ var canvasInput = external_exports.object({
20539
20542
  variations: canvasShape.variations.describe("1\u20134 different Canvases")
20540
20543
  });
20541
20544
  var QUOTE_FIRST = "Always quote first and tell the user the credits before creating; credits are reserved at creation and charged only when the video is delivered.";
20545
+ var VideoOutputSchema = external_exports.looseObject({
20546
+ aspect_ratio: external_exports.enum(["9:16", "16:9", "1:1"]).describe("The format of this file"),
20547
+ url: external_exports.string().optional().describe("The full-quality file"),
20548
+ download_url: external_exports.string().optional().describe("The full-quality file, saved under a readable name"),
20549
+ web_url: external_exports.string().optional().describe("A 720p copy, for playback"),
20550
+ poster_url: external_exports.string().optional().describe("A still of the video: for a lyric video one whole lyric line on screen (the hook when it can be), for a Canvas its first frame"),
20551
+ poster_seconds: external_exports.number().nullable().describe("Where poster_url was cut, in seconds from the start of this file (a trimmed clip counts from its own start): the cover frame offset for a post that takes one instead of an image (TikTok). Null for videos made before it was kept"),
20552
+ url_expires_in_seconds: external_exports.number().int().optional().describe("How long the links stay valid"),
20553
+ duration_seconds: external_exports.number().nullable().optional(),
20554
+ size_bytes: external_exports.number().int().nullable().optional(),
20555
+ bitrate_kbps: external_exports.number().int().nullable().optional(),
20556
+ web_size_bytes: external_exports.number().int().nullable().optional()
20557
+ });
20558
+ var VideoSchema = external_exports.looseObject({
20559
+ id: external_exports.string(),
20560
+ type: external_exports.enum(["lyric-video", "canvas"]),
20561
+ variation: external_exports.number().int(),
20562
+ variation_count: external_exports.number().int(),
20563
+ quote_id: external_exports.string().nullable(),
20564
+ status: external_exports.enum(["queued", "processing", "completed", "failed", "cancelled"]),
20565
+ stage: external_exports.string().describe("The step it is at while it is made"),
20566
+ progress: external_exports.number().describe("0\u2013100"),
20567
+ outputs: external_exports.array(VideoOutputSchema).describe("One file per format, once delivered"),
20568
+ song: external_exports.object({ id: external_exports.string().nullable(), title: external_exports.string().nullable(), artist_name: external_exports.string().nullable() }),
20569
+ request: external_exports.record(external_exports.string(), external_exports.unknown()).describe("What the video was made from, with your metadata"),
20570
+ look_id: external_exports.string().nullable(),
20571
+ look: external_exports.record(external_exports.string(), external_exports.unknown()).nullable(),
20572
+ canvas: external_exports.record(external_exports.string(), external_exports.unknown()).nullable().optional().describe("A Canvas: its design and, for stock, the credit to show"),
20573
+ quoted_credits: external_exports.number().nullable(),
20574
+ charged_credits: external_exports.number().nullable(),
20575
+ error: external_exports.string().nullable(),
20576
+ error_code: external_exports.string().nullable(),
20577
+ retry_of_job_id: external_exports.string().nullable(),
20578
+ created_at: external_exports.string(),
20579
+ updated_at: external_exports.string()
20580
+ });
20581
+ var CALLBACK_EVENTS = ["video.completed", "video.failed", "video.cancelled"];
20542
20582
  var OPERATIONS = [
20543
20583
  /* Account */
20544
20584
  {
@@ -20546,7 +20586,7 @@ var OPERATIONS = [
20546
20586
  group: "account",
20547
20587
  title: "Get the account",
20548
20588
  summary: "Who you are signed in as, the organization and its credit balance",
20549
- description: "Returns the organization the credentials act for, how they authenticate and their scopes, and the credit balance (available, monthly, top-ups). Check it before creating videos.",
20589
+ description: "Returns the organization the credentials act for, how they authenticate and their scopes, the credit balance (available, monthly, top-ups) and its plan, if any (where it is billed, when the period ends, and a downgrade or interval switch waiting for the renewal as scheduled_change). Check it before creating videos.",
20550
20590
  method: "GET",
20551
20591
  path: "/api/v1/account",
20552
20592
  scopes: ["videos:read", "music:read", "library:read"],
@@ -20573,6 +20613,39 @@ var OPERATIONS = [
20573
20613
  cli: ["options"],
20574
20614
  mcp: "get_options"
20575
20615
  },
20616
+ {
20617
+ id: "organizations.list",
20618
+ group: "account",
20619
+ title: "List your organizations",
20620
+ summary: "The organizations you belong to, your role in each and the one these credentials act for",
20621
+ description: "Every organization the signed-in person is a member of; with an API key, the member who created it (the key needs organizations:read). current marks the organization these credentials act for. Each organization has its own music, videos, Looks and credits: to work in another one, sign in again and pick it on the consent screen, or use an API key created in it.",
20622
+ method: "GET",
20623
+ path: "/api/v1/organizations",
20624
+ scopes: ["organizations:read"],
20625
+ input: external_exports.object({}),
20626
+ readOnly: true,
20627
+ destructive: false,
20628
+ idempotent: true,
20629
+ cli: ["organizations", "list"],
20630
+ mcp: "list_organizations"
20631
+ },
20632
+ {
20633
+ id: "organizations.create",
20634
+ group: "account",
20635
+ title: "Create an organization",
20636
+ summary: "A new organization owned by you, with its own music, videos, Looks and credits",
20637
+ description: "Creates an empty organization with the signed-in person as its owner; with an API key, the member who created the key (the key needs organizations:write). It starts with no credits. These credentials keep acting for their current organization: to work in the new one, sign in again and pick it, or create an API key in it.",
20638
+ method: "POST",
20639
+ path: "/api/v1/organizations",
20640
+ scopes: ["organizations:write"],
20641
+ input: external_exports.object({ name: external_exports.string().trim().min(2).max(80).describe("The organization name, as people see it in the app") }),
20642
+ readOnly: false,
20643
+ destructive: false,
20644
+ idempotent: false,
20645
+ cli: ["organizations", "create"],
20646
+ mcp: "create_organization",
20647
+ example: { name: "Night Shift Records" }
20648
+ },
20576
20649
  /* Artists */
20577
20650
  {
20578
20651
  id: "artists.list",
@@ -20757,7 +20830,7 @@ var OPERATIONS = [
20757
20830
  group: "songs",
20758
20831
  title: "Upload a song",
20759
20832
  summary: "Add a song: master audio and square cover art",
20760
- description: 'Audio: MP3, WAV or M4A up to 250 MB. Cover: a square JPEG or PNG, 1000\u20136000 px (3000\xD73000 recommended), up to 20 MB; it is kept at 1536, 640 and 160 px, not as uploaded. The song is analyzed next (lyrics, beats, sections): poll get_song until analysis.status is "ready", usually about a minute.',
20833
+ description: 'Audio: MP3, WAV or M4A up to 250 MB. Cover: a square JPEG or PNG, 1000\u20136000 px (3000\xD73000 recommended), up to 20 MB; it is kept at 1536, 640 and 160 px, not as uploaded. The song is analyzed next (lyrics, beats, sections): poll get_song until analysis.status is "ready", usually about a minute. Pass lyrics (or set them later with set_song_lyrics) to have the videos spell every word right.',
20761
20834
  method: "POST",
20762
20835
  path: "/api/v1/songs",
20763
20836
  scopes: ["music:write", "videos:write"],
@@ -20766,12 +20839,14 @@ var OPERATIONS = [
20766
20839
  title: external_exports.string().trim().min(1).max(300).describe("The song title"),
20767
20840
  language: external_exports.string().regex(/^[a-z]{2,3}$/).optional().describe('Lyrics language (ISO 639-1, e.g. "en"); detected when omitted'),
20768
20841
  audio_url: httpsUrl("the master audio").optional(),
20769
- cover_art_url: httpsUrl("the square cover art").optional()
20842
+ cover_art_url: httpsUrl("the square cover art").optional(),
20843
+ lyrics: external_exports.string().max(1e5).optional().describe(`Optional. ${LYRICS} once the song is analyzed (get_song: analysis.lyrics.status "mismatch")`)
20770
20844
  }),
20771
20845
  files: [
20772
20846
  { field: "audio", urlField: "audio_url", accept: ["audio/mpeg", "audio/wav", "audio/mp4"], description: "Master audio (MP3, WAV or M4A)" },
20773
20847
  { field: "cover_art", urlField: "cover_art_url", accept: ["image/jpeg", "image/png"], description: "Square cover art (JPEG or PNG)" }
20774
20848
  ],
20849
+ textFiles: ["lyrics"],
20775
20850
  readOnly: false,
20776
20851
  destructive: false,
20777
20852
  idempotent: false,
@@ -20783,7 +20858,7 @@ var OPERATIONS = [
20783
20858
  group: "songs",
20784
20859
  title: "Get a song",
20785
20860
  summary: "One song and its analysis status",
20786
- description: COVER_SIZES,
20861
+ description: `${COVER_SIZES} analysis.lyrics.status says whose words its videos show: "transcribed" (as heard), "checked" (your lyrics, timed from the audio; corrected, added and kept count what checking did), "waiting" (your lyrics, checked once the analysis finishes) or "mismatch" (your lyrics didn\u2019t match what\u2019s sung, so the transcription is used).`,
20787
20862
  method: "GET",
20788
20863
  path: "/api/v1/songs/{song_id}",
20789
20864
  scopes: ["music:read", "videos:read"],
@@ -20831,7 +20906,7 @@ var OPERATIONS = [
20831
20906
  group: "songs",
20832
20907
  title: "Get a song\u2019s analysis",
20833
20908
  summary: "Word-timed lyrics, tempo, beats, sections and hook",
20834
- description: "Use the section times to choose a trim for a lyric video.",
20909
+ description: "Use the section times to choose a trim for a lyric video. lyrics.text is the song\u2019s lyrics to edit: yours as you gave them, or the transcription a line per phrase (lyrics.yours says which).",
20835
20910
  method: "GET",
20836
20911
  path: "/api/v1/songs/{song_id}/analysis",
20837
20912
  scopes: ["music:read", "videos:read"],
@@ -20858,6 +20933,39 @@ var OPERATIONS = [
20858
20933
  cli: ["songs", "reanalyze"],
20859
20934
  mcp: "reanalyze_song"
20860
20935
  },
20936
+ {
20937
+ id: "songs.set_lyrics",
20938
+ group: "songs",
20939
+ title: "Set a song\u2019s lyrics",
20940
+ summary: "Give a song its own lyrics, or replace them",
20941
+ description: `${LYRICS} (409, the song unchanged). They are checked right away (analysis.lyrics in the answer says what changed), or once the analysis finishes if it hasn\u2019t (202). Videos made from then on use them; videos already made stay as they are.`,
20942
+ method: "POST",
20943
+ path: "/api/v1/songs/{song_id}/lyrics",
20944
+ scopes: ["music:write", "videos:write"],
20945
+ input: external_exports.object({ song_id: songId, lyrics: external_exports.string().min(1).max(1e5).describe("The lyrics: text, or an SRT, WebVTT or LRC file\u2019s contents") }),
20946
+ textFiles: ["lyrics"],
20947
+ readOnly: false,
20948
+ destructive: false,
20949
+ idempotent: true,
20950
+ cli: ["songs", "set-lyrics"],
20951
+ mcp: "set_song_lyrics"
20952
+ },
20953
+ {
20954
+ id: "songs.clear_lyrics",
20955
+ group: "songs",
20956
+ title: "Remove a song\u2019s lyrics",
20957
+ summary: "Go back to the transcribed words",
20958
+ description: "Videos made from then on show the words as transcribed.",
20959
+ method: "DELETE",
20960
+ path: "/api/v1/songs/{song_id}/lyrics",
20961
+ scopes: ["music:write", "videos:write"],
20962
+ input: external_exports.object({ song_id: songId }),
20963
+ readOnly: false,
20964
+ destructive: true,
20965
+ idempotent: true,
20966
+ cli: ["songs", "clear-lyrics"],
20967
+ mcp: "clear_song_lyrics"
20968
+ },
20861
20969
  /* Looks */
20862
20970
  {
20863
20971
  id: "looks.list",
@@ -20969,7 +21077,7 @@ var OPERATIONS = [
20969
21077
  id: "stock.search",
20970
21078
  group: "looks",
20971
21079
  title: "Search stock media",
20972
- summary: "Find Pexels photos or clips to use as a stock background",
21080
+ summary: "Find stock photos or clips to use as a background",
20973
21081
  description: `24 results a page. Pass an item's id as look.background.stock_id (source "stock-photo" or "stock-video") or as a Canvas's stock_id to use it instead of the director's pick, and credit the photographer (credit) wherever you show it. orientation: portrait for 9:16 and 1:1, landscape when 16:9 is among the formats (a Canvas is portrait). Clips too short for the loop are left out: pass seconds for a Canvas. thumbnail_url is a 480 px still, preview_url a 1280 px one (the photo, or the clip's poster), preview_video_url a small MP4 of a clip.`,
20974
21082
  method: "GET",
20975
21083
  path: "/api/v1/stock",
@@ -21064,7 +21172,7 @@ var OPERATIONS = [
21064
21172
  group: "videos",
21065
21173
  title: "List videos",
21066
21174
  summary: "Videos, newest first, with status and thumbnails",
21067
- description: "",
21175
+ description: "Each video's outputs carry aspect_ratio, poster_url, poster_seconds and web_url (for thumbnails and previews); get_video has the download links.",
21068
21176
  method: "GET",
21069
21177
  path: "/api/v1/videos",
21070
21178
  scopes: ["videos:read"],
@@ -21080,7 +21188,7 @@ var OPERATIONS = [
21080
21188
  group: "videos",
21081
21189
  title: "Get a video",
21082
21190
  summary: "Status, progress, credits and, when completed, the download links",
21083
- description: "status is queued, processing, completed, failed or cancelled. Completed videos have outputs with download_url (full quality), web_url (720p) and poster_url, signed for 7 days.",
21191
+ description: "status is queued, processing, completed, failed or cancelled. Completed videos have outputs with download_url (full quality), web_url (720p) and poster_url, signed for 7 days. A lyric video's poster is a frame with one whole lyric line on screen (the hook when it can be), ready to set as the thumbnail where you post it; a Canvas's is its first frame. poster_seconds says where in that file the poster was cut, for posts that take a cover frame offset instead of an image (TikTok); null on videos made before it was kept. Failed videos have error and error_code; AI_VIDEO_UNAVAILABLE means the AI video couldn\u2019t be made for a reason on our side, so make it again later.",
21084
21192
  method: "GET",
21085
21193
  path: "/api/v1/videos/{video_id}",
21086
21194
  scopes: ["videos:read"],
@@ -21089,7 +21197,8 @@ var OPERATIONS = [
21089
21197
  destructive: false,
21090
21198
  idempotent: true,
21091
21199
  cli: ["videos", "get"],
21092
- mcp: "get_video"
21200
+ mcp: "get_video",
21201
+ output: { name: "Video", schema: VideoSchema }
21093
21202
  },
21094
21203
  {
21095
21204
  id: "videos.cancel",
@@ -21112,7 +21221,7 @@ var OPERATIONS = [
21112
21221
  group: "videos",
21113
21222
  title: "Make a video again",
21114
21223
  summary: "Run a finished, failed or cancelled video again (new charge)",
21115
- description: "Reuses its Look, background media and loops, so nothing already made is paid for again.",
21224
+ description: "Reuses the Look it made, with its background media and loops, so nothing already made is paid for again. A video that failed before its Look was saved is designed afresh.",
21116
21225
  method: "POST",
21117
21226
  path: "/api/v1/videos/{video_id}/retry",
21118
21227
  scopes: ["videos:write"],
@@ -21164,8 +21273,13 @@ function buildRequest(op, input2, baseUrl) {
21164
21273
  function inputJsonSchema(op) {
21165
21274
  return external_exports.toJSONSchema(op.input, { io: "input", unrepresentable: "any" });
21166
21275
  }
21276
+ function outputJsonSchema(schema) {
21277
+ const { $schema: _, ...rest } = external_exports.toJSONSchema(schema, { io: "output", unrepresentable: "any" });
21278
+ return rest;
21279
+ }
21167
21280
  function openApiDocument(input2) {
21168
21281
  const paths = {};
21282
+ const schemas = { Video: outputJsonSchema(VideoSchema) };
21169
21283
  const groups = /* @__PURE__ */ new Map();
21170
21284
  for (const op of OPERATIONS) {
21171
21285
  const key = `${op.method} ${op.path}`;
@@ -21198,6 +21312,7 @@ function openApiDocument(input2) {
21198
21312
  "application/json": { schema: variants.length > 1 ? { oneOf: variants.map(bodyOf) } : bodyOf(variants[0]) },
21199
21313
  ...first.files ? { "multipart/form-data": { schema: { type: "object", properties: Object.fromEntries(first.files.map((f) => [f.field, f.multiple ? { type: "array", items: { type: "string", format: "binary" } } : { type: "string", format: "binary" }])) } } } : {}
21200
21314
  } } } : {};
21315
+ if (first.output) schemas[first.output.name] ??= outputJsonSchema(first.output.schema);
21201
21316
  (paths[first.path] ??= {})[first.method.toLowerCase()] = {
21202
21317
  operationId: variants.length > 1 ? `${first.id.split(".")[0]}.create` : first.id,
21203
21318
  summary: variants.length > 1 ? variants.map((v) => v.op.title).join(" or ") : first.title,
@@ -21208,7 +21323,7 @@ function openApiDocument(input2) {
21208
21323
  security: [{ bearer: [] }, { oauth2: [...first.scopes] }],
21209
21324
  "x-operations": variants.map((v) => ({ id: v.op.id, mcpTool: v.op.mcp, cli: `kinetune ${v.op.cli.join(" ")}` })),
21210
21325
  responses: {
21211
- "200": { description: "OK" },
21326
+ "200": first.output ? { description: "OK", content: { "application/json": { schema: ref(first.output.name) } } } : { description: "OK" },
21212
21327
  "201": { description: "Created" },
21213
21328
  "400": { description: "Invalid request" },
21214
21329
  "401": { description: "Missing or invalid credentials" },
@@ -21216,7 +21331,8 @@ function openApiDocument(input2) {
21216
21331
  "403": { description: "Missing scope" },
21217
21332
  "404": { description: "Not found" },
21218
21333
  "409": { description: "Conflict" },
21219
- "422": { description: "Unprocessable" }
21334
+ "422": { description: "Unprocessable" },
21335
+ "503": { description: "Temporarily unavailable (AI video): nothing was held; try again after Retry-After seconds" }
21220
21336
  }
21221
21337
  };
21222
21338
  }
@@ -21231,10 +21347,24 @@ function openApiDocument(input2) {
21231
21347
  tokenUrl: `${input2.authorizationServer}/api/auth/oauth2/token`,
21232
21348
  scopes: SCOPE_DESCRIPTIONS
21233
21349
  } } } } : {}
21234
- } },
21235
- paths
21236
- };
21237
- }
21350
+ }, schemas },
21351
+ paths,
21352
+ webhooks: { video: { post: {
21353
+ operationId: "videos.callback",
21354
+ summary: "A video is finished",
21355
+ tags: ["videos"],
21356
+ description: `POSTed to the request's callback_url once the video is completed, failed or cancelled: the video as get_video returns it. Kinetune-Signature is t=<unix seconds>,v1=<hex HMAC-SHA256 of "<t>.<body>"> with your callback secret. Answer with any 2xx within 10 seconds; anything else is retried after 30 s, 2 min, 10 min, 30 min and 2 h.`,
21357
+ parameters: [
21358
+ { name: "Kinetune-Event", in: "header", required: true, schema: { type: "string", enum: [...CALLBACK_EVENTS] } },
21359
+ { name: "Kinetune-Delivery", in: "header", required: true, description: "A new id for every attempt", schema: { type: "string", format: "uuid" } },
21360
+ { name: "Kinetune-Signature", in: "header", required: true, schema: { type: "string" } }
21361
+ ],
21362
+ requestBody: { required: true, content: { "application/json": { schema: ref("Video") } } },
21363
+ responses: { "2XX": { description: "Received" } }
21364
+ } } }
21365
+ };
21366
+ }
21367
+ var ref = (name) => ({ $ref: `#/components/schemas/${name}` });
21238
21368
 
21239
21369
  // ../../node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/error.js
21240
21370
  var CommanderError = class extends Error {
@@ -24702,7 +24832,9 @@ async function login(config2, input2) {
24702
24832
  state,
24703
24833
  code_challenge: challenge,
24704
24834
  code_challenge_method: "S256",
24705
- resource
24835
+ resource,
24836
+ // The consent screen preselects this organization (one of `kinetune organizations list`).
24837
+ ...input2.organization ? { organization_hint: input2.organization } : {}
24706
24838
  })) authorize.searchParams.set(k, v);
24707
24839
  input2.log(`Opening your browser to sign in. If it doesn't open, visit:
24708
24840
  ${authorize}`);
@@ -24759,7 +24891,7 @@ async function revoke(config2) {
24759
24891
  // package.json
24760
24892
  var package_default = {
24761
24893
  name: "@kinetune/cli",
24762
- version: "0.4.0",
24894
+ version: "0.6.0",
24763
24895
  description: "Command line for Kinetune: lyric videos and Spotify Canvas loops from your songs, for people and AI agents.",
24764
24896
  license: "MIT",
24765
24897
  homepage: "https://kinetune.com/developers#cli",
@@ -24868,12 +25000,13 @@ async function call(op, input2, files = []) {
24868
25000
  if (!response.ok) throw new ApiError(response.status, data);
24869
25001
  return response.status === 204 ? { done: true } : data;
24870
25002
  }
25003
+ var readText = (source) => source === "-" ? new Promise((resolve) => {
25004
+ let s = "";
25005
+ process.stdin.on("data", (d) => s += d).on("end", () => resolve(s));
25006
+ }) : readFile2(source, "utf8");
24871
25007
  async function readInput(source) {
24872
25008
  if (!source) return {};
24873
- const text = source === "-" ? await new Promise((resolve) => {
24874
- let s = "";
24875
- process.stdin.on("data", (d) => s += d).on("end", () => resolve(s));
24876
- }) : await readFile2(source, "utf8");
25009
+ const text = await readText(source);
24877
25010
  try {
24878
25011
  return JSON.parse(text);
24879
25012
  } catch {
@@ -24920,6 +25053,7 @@ MCP tool: ${op.mcp} REST: ${op.method} ${op.path}`);
24920
25053
  }));
24921
25054
  else cmd.addOption(new Option(`--${kebab(name)} <value>`, desc));
24922
25055
  }
25056
+ for (const name of op.textFiles ?? []) cmd.option(`--${kebab(name)}-file <file>`, `${props[name]?.description ?? name}: read from a file (or - for stdin)`);
24923
25057
  cmd.option("--input <file>", "The whole input as JSON (a file, or - for stdin); flags override it");
24924
25058
  const creates = op.id.startsWith("videos.create_");
24925
25059
  if (creates) {
@@ -24947,6 +25081,10 @@ MCP tool: ${op.mcp} REST: ${op.method} ${op.path}`);
24947
25081
  if (value !== void 0) input2[name] = value;
24948
25082
  }
24949
25083
  if (files.length) for (const f of op.files ?? []) delete input2[f.urlField];
25084
+ for (const name of op.textFiles ?? []) {
25085
+ const source = options[camel(name) + "File"];
25086
+ if (source !== void 0 && input2[name] === void 0) input2[name] = await readText(source);
25087
+ }
24950
25088
  if (creates && !input2.quote_id) {
24951
25089
  const quoteOp = operation(op.id.replace("videos.create_", "quotes."));
24952
25090
  const { callback_url: _c, ...quoteInput } = input2;
@@ -25012,13 +25150,13 @@ function program2() {
25012
25150
  };
25013
25151
  for (const op of OPERATIONS) addOperation(group(op.cli.slice(0, -1)), op);
25014
25152
  const auth = root.command("auth").description("Sign in with the app (OAuth) or an organization API key");
25015
- auth.command("login").description("Sign in: opens the browser to sign in with the app, or stores an API key").option("--api-key <key>", "Use an organization API key instead (created in the app under API keys)").option("--no-browser", "Print the sign-in URL instead of opening the browser").option("--api-url <url>", "API base URL").option("--app-url <url>", "App base URL").action(async (options) => {
25153
+ auth.command("login").description("Sign in: opens the browser to sign in with the app, or stores an API key").option("--api-key <key>", "Use an organization API key instead (created in the app under API keys)").option("--no-browser", "Print the sign-in URL instead of opening the browser").option("--organization <id>", "Preselect this organization on the consent screen (an id from `kinetune organizations list`)").option("--api-url <url>", "API base URL").option("--app-url <url>", "App base URL").action(async (options) => {
25016
25154
  const config2 = { ...await loadConfig(), ...options.apiUrl ? { api_url: options.apiUrl } : {}, ...options.appUrl ? { app_url: options.appUrl } : {} };
25017
25155
  if (options.apiKey) {
25018
25156
  await saveConfig({ ...config2, auth: { type: "api_key", api_key: options.apiKey } });
25019
25157
  } else {
25020
25158
  await saveConfig(config2);
25021
- await login(config2, { log: say, noBrowser: options.browser === false });
25159
+ await login(config2, { log: say, noBrowser: options.browser === false, organization: options.organization });
25022
25160
  }
25023
25161
  const account = await call(operation("account.get"), {});
25024
25162
  say(`Signed in to ${account.organization.name} (${account.credits.available} credits). Credentials: ${configFile()}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kinetune/cli",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "description": "Command line for Kinetune: lyric videos and Spotify Canvas loops from your songs, for people and AI agents.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://kinetune.com/developers#cli",