rushes 0.7.2 → 0.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rushes",
3
3
  "description": "A local review desk for video made with AI agents: timecoded notes, script edits and audio picks your agent reads and acts on.",
4
- "version": "0.7.2",
4
+ "version": "0.7.3",
5
5
  "author": { "name": "Red Morley Hewitt" },
6
6
  "homepage": "https://github.com/iamredmh/rushes",
7
7
  "repository": "https://github.com/iamredmh/rushes",
package/dist/cli/main.js CHANGED
@@ -410,6 +410,8 @@ export async function main(argv, io) {
410
410
  return usage(io, "rushes add variant <music|sfx|voice> <file> --name NAME");
411
411
  const r = await (await client()).post("/api/variants", { stage: a, file: resolve(io.cwd, b), name: o.name, lane: o.lane, round: o.round, description: o.description, video: o.video });
412
412
  io.out(`Added ${r.lane.name}: ${r.variant.name}`);
413
+ if (r.warning)
414
+ io.out(`Warning: ${r.warning}`);
413
415
  return 0;
414
416
  }
415
417
  if (what === "shots") {
@@ -108,11 +108,23 @@ function resolveVersion(video, versionId) {
108
108
  throw new NotFoundError("version", versionId);
109
109
  return v;
110
110
  }
111
+ /** The words of a name or file name, lower-cased: "f3a SFX pass 3" and "f3a-sfx-v3.wav" both start with "f3a". */
112
+ const firstWord = (text) => text.replace(/\.[a-z0-9]{2,4}$/i, "").toLowerCase().match(/[a-z0-9]+/)?.[0] ?? "";
113
+ /**
114
+ * The film a variant is for when nobody said: the one film in play whose name starts with the same
115
+ * word as the variant's name or its file's name ("f3a One phone, four buttons" and "f3a SFX pass 3").
116
+ * With none matching, or more than one, no film: the variant then shows on every film, as it always has.
117
+ */
118
+ export function inferFilm(p, name, file) {
119
+ const words = new Set([firstWord(name), firstWord(basename(file))].filter((w) => w.length >= 2));
120
+ const films = p.videos.filter((v) => inPlay(v) && words.has(firstWord(v.name)));
121
+ return films.length === 1 ? films[0].id : undefined;
122
+ }
111
123
  const LANE_NAMES = { voice: "Voiceover", music: "Music", sfx: "Sound effects" };
112
124
  export function addVariant(p, input) {
113
125
  // The film and (§23) the cues first, so an unknown film or a cue refused for its file leaves the
114
126
  // project untouched.
115
- const video = input.video === undefined ? undefined : resolveVideo(p, input.video).id;
127
+ const video = input.video === undefined ? inferFilm(p, input.name, input.file) : resolveVideo(p, input.video).id;
116
128
  const cues = [];
117
129
  for (const c of input.cues ?? []) {
118
130
  const cue = { id: uniqueId(slugify(c.name), cues.map((x) => x.id)), name: c.name, t: c.t };
package/dist/mcp/tools.js CHANGED
@@ -251,7 +251,7 @@ export function createMcpServer(ctx) {
251
251
  .string()
252
252
  .min(1)
253
253
  .optional()
254
- .describe("The film (id or name) this read, bed or pass is for: only that film's Voiceover, Music, Sound effects and Mix list it. Leave it out only when it is for every film. In a project with more than one film, always give it."),
254
+ .describe("The film (id or name) this read, bed or pass is for: only that film's Voiceover, Music, Sound effects and Mix list it. Rushes works the film out when the read, bed or pass's name or file name starts with the film's first word (\"f3a SFX pass 3\" for \"f3a One phone\"), but always give it in a project with more than one film. The reply carries a `warning` when it ended up on every film."),
255
255
  cues: z
256
256
  .array(z.object({
257
257
  name: z.string(),
@@ -2,7 +2,7 @@ import { Hono } from "hono";
2
2
  import { streamSSE } from "hono/streaming";
3
3
  import { z } from "zod";
4
4
  import { RushesError, InvalidError, NotFoundError } from "../core/errors.js";
5
- import { addFile, addFormat, addVariant, addVersion, ensureProjectIdOnce, lockPicture, noteInPlay, resolveCut, resolveVideo, setShots, shelveFilm, shotAt } from "../core/project.js";
5
+ import { addFile, addFormat, addVariant, addVersion, ensureProjectIdOnce, inPlay, lockPicture, noteInPlay, resolveCut, resolveVideo, setShots, shelveFilm, shotAt } from "../core/project.js";
6
6
  import { addTake, editSection, setSections } from "../core/script.js";
7
7
  import { addNote, applyReply, applyUserEdit, checkNoteFormat, filterNotes } from "../core/notes.js";
8
8
  import { FORMAT_ID_RE, MAX_FORMATS, isPictureSize, labelOfId, versionFormats } from "../core/formats.js";
@@ -33,7 +33,7 @@ import { buildState, planWarning } from "../core/plan.js";
33
33
  import { broughtInEvent, cutEvent, fileEvent, filmEvent, formatEvent, lineEvent, lockEvent, notesSentEvent, picksEvent, repliesEvent, scriptEvent, takeEvent, variantEvent, visualEvent, } from "../core/logEvents.js";
34
34
  import { LOG_AREAS, LOG_MAX, changeLogFileName, logText, recentChanges } from "../core/logText.js";
35
35
  import { defaultRunner, measureMix } from "./loudness.js";
36
- export const VERSION = "0.7.2";
36
+ export const VERSION = "0.7.3";
37
37
  async function body(c, schema) {
38
38
  let json;
39
39
  try {
@@ -1130,7 +1130,15 @@ export function createApp(store, opts = {}) {
1130
1130
  const b = await body(c, VariantBody);
1131
1131
  // §23: a cue's file is stored as a manifest path, like the variant's own.
1132
1132
  const cues = b.cues?.map((q) => (q.file === undefined ? q : { ...q, file: toManifestPath(store.root, q.file) }));
1133
- const { result } = await store.update("project", (p) => addVariant(p, { ...b, cues, file: toManifestPath(store.root, b.file) }));
1133
+ const { result } = await store.update("project", (p) => {
1134
+ const added = addVariant(p, { ...b, cues, file: toManifestPath(store.root, b.file) });
1135
+ // With several films in play, a variant with no film shows on all of them: say so, so the agent names one.
1136
+ const films = p.videos.filter(inPlay).length;
1137
+ const warning = added.variant.video === undefined && films > 1
1138
+ ? `No film was named, and none could be told from the names, so this ${added.lane.stage === "voice" ? "read" : added.lane.stage === "music" ? "bed" : "pass"} shows on all ${films} films. Pass \`video\` (the film's id or name) to put it on one.`
1139
+ : undefined;
1140
+ return { ...added, ...(warning ? { warning } : {}) };
1141
+ });
1134
1142
  await log.add(() => variantEvent(result.lane, result.variant), by(c));
1135
1143
  return c.json(result, 201);
1136
1144
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rushes",
3
- "version": "0.7.2",
3
+ "version": "0.7.3",
4
4
  "description": "A local review desk for video made with AI agents: timecoded notes, script edits and audio picks your agent can read and act on.",
5
5
  "keywords": [
6
6
  "video",