diff --git a/apps/direction/src/check.rs b/apps/direction/src/check.rs index 8086db64..ffc95948 100644 --- a/apps/direction/src/check.rs +++ b/apps/direction/src/check.rs @@ -249,10 +249,7 @@ fn check_one(tsx: &Path, id: Option, rules: &[Rule], args: &[String], wh needs(&mut waits, r); continue; } - let k = files.iter().position(|f| *f == m.file).unwrap_or_else(|| { - files.push(m.file.clone()); - files.len() - 1 - }); + let k = file_index(&mut files, &m.file); let mut on = m.frames.pick(&worlds); if let (true, Some(j)) = (m.render, &join_on_of(&worlds)) { on.retain(|f| j.contains(f)); @@ -272,6 +269,14 @@ fn check_one(tsx: &Path, id: Option, rules: &[Rule], args: &[String], wh Ok(Checked { file: tsx.to_path_buf(), id, found: finding::ranked(found), waits, render, shots, fps }) } +/// Where `f` is in `files`, added at the end when it isn't yet: the one run's checks, each file once. +fn file_index(files: &mut Vec, f: &Path) -> usize { + files.iter().position(|x| x == f).unwrap_or_else(|| { + files.push(f.to_path_buf()); + files.len() - 1 + }) +} + /// Whether `r` runs on the composition `tsx` (`id` where its file registers several) of `project`: a rule a note's ask /// scopes to one (`of`) runs there alone. fn applies(r: &Rule, project: &Path, tsx: &Path, id: Option<&str>) -> bool { @@ -376,10 +381,7 @@ fn check_story(file: &Path, rules: &[Rule], unread: Vec, args: &[String let Some(f) = r.file() else { continue }; match ts::meta(f, &host.ts) { Ok(m) if m.story => { - let k = files.iter().position(|x| *x == m.file).unwrap_or_else(|| { - files.push(m.file.clone()); - files.len() - 1 - }); + let k = file_index(&mut files, &m.file); plan.push(ts::Planned { check: k, frames: Vec::new(), values: r.values.clone(), level: r.level, by: r.by.clone() }); } Ok(_) => {} diff --git a/docs/manual/reference/sdk/brief.md b/docs/manual/reference/sdk/brief.md index fe303119..acaab026 100644 --- a/docs/manual/reference/sdk/brief.md +++ b/docs/manual/reference/sdk/brief.md @@ -219,7 +219,7 @@ type RuleLevel = "error" | "warn" | "note" ### `Scene` ```ts -type Scene = { /** * where and when ("INT. SENATE - NIGHT", or "The brief page") */ heading?: string, beats: Array, /** * what the scene must land */ payoff?: string, } +type Scene = { /** * where and when ("INT. SENATE - NIGHT", or "The brief page") */ heading?: string, beats: Array, /** * what the scene must land */ payoff?: string, /** * the story beat it plays, by its id (raea/story's compileScript writes it; docs/story.feature ST0c) */ beat?: string, } ``` ### `Script` diff --git a/docs/manual/reference/sdk/check.md b/docs/manual/reference/sdk/check.md index 8e69fef6..83a19b63 100644 --- a/docs/manual/reference/sdk/check.md +++ b/docs/manual/reference/sdk/check.md @@ -224,6 +224,7 @@ type Camera = { eye: [number, number, number], look: [number, number, number], / | `needs` | `"render"` | "render": it reads what only a render has (Contrast, Picture, Mix, Onset, Covers); with none, it waits for one | | `level` | `Level` | how bad what it finds is, where a finding doesn't say (error when unset) | | `frames` | `Frames` | where it runs ("all" when unset) | +| `over` | `"frames" \| "story" \| "both"` | what it reads: a composition's frames (the default), a story with no frames (`raea check NAME.story.ts` runs only these and "both", with its `after` alone), or both | ### `CheckFn` @@ -242,6 +243,7 @@ type CheckFn = (world: World, frame: number, values: Values, memo: Memo) => void | `needs` | `"render"` | "render": it reads what only a render has (Contrast, Picture, Mix, Onset, Covers); with none, it waits for one | | `level` | `Level` | how bad what it finds is, where a finding doesn't say (error when unset) | | `frames` | `Frames` | where it runs ("all" when unset) | +| `over` | `"frames" \| "story" \| "both"` | what it reads: a composition's frames (the default), a story with no frames (`raea check NAME.story.ts` runs only these and "both", with its `after` alone), or both | ### `Clip`