diff --git a/CHANGELOG.md b/CHANGELOG.md index 7bdc382..97618ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,132 @@ # Changelog -## Unreleased +## 0.26.0 +- **Journey podcasts (prototype).** A journey with an audio episode next to it (`.podcast.json` and its + audio, [docs/podcast-format.md](docs/podcast-format.md)) gets a ▶ on its row and a player at the bottom of the + journey panel: play and pause, back and forward 15 s, previous and next step, speed (1×, 1.25×, 1.5×), and a + timeline marked by step (hover names the step; click or drag to go there). The walk follows the voice: steps open + and animations move beat by beat, exactly as when you walk them; any seek puts the walk where it is at that time, + backwards too. Next, Previous, a step or a beat you pick moves the audio to its part. The audio goes on while the + panel is behind another tab or VS Code is in the background. Ctrl+' Space plays and pauses from anywhere, Ctrl+' ← → + skip; the status bar shows where it is. + - Seeking works in VS Code for the web and remote windows too: the panel loads the audio whole, and the walk, the + player and the status bar always show where the audio actually is (a seek that can't get there is said and + logged). One clock: the status bar shows the player's second. + - Where you were is kept per journey: another journey, ending the walk, closing the panel, a reload, or saving the + podcast file again (the same moment of the same segment) keep it, and ▶ goes on from there. + - A step the podcast skips: the walk stays on it, the audio pauses and says so, and ▶ goes on after that step. + - A beat whose code is in another file opens that file directly; a part on the map closes the walk's code tab. + - Space and K play and pause anywhere in the panel, also after clicking the animation's ‹ ›. An audio that can't + play stays paused and says why. +- **Listen: the podcast player, reworked.** Podcasts are called **Listen** now: ▶ Listen on the row, **Code Notes: + Listen to Journey**, **Listen: Play/Pause**, **Back 15 s**, **Forward 15 s**, **Previous Step**, **Next Step** + (new, Ctrl+' Shift+← →). The command ids and the `.podcast.json` format are unchanged. + - The audio lives in a new **Listen** view (Code Notes side bar): closing the journey panel, or a layout that hides + it, no longer stops the episode. The panel's player and the status bar are remotes; the status bar says + **Listening · 6:58** / **Paused · 6:58** (the glyph shows the state), its tooltip lists the actions with their + keys, and its click opens the journey's map, whose player shows where the audio is. + - ▶ starts the sound where you pressed it: no second ▶ to find in the Listen view. VS Code lets a webview play + audio only after a click or a key in that webview, so ▶ in the journey panel plays the audio in the panel (the + Listen view follows it, and takes the audio over when the panel closes, once it has been clicked too). A start + from a row, the palette or a key before any click in either player opens the panel with its ▶ focused: Space or + one click there plays it, and later starts play at once. + - The caption is the sentence being said, two lines at most and never cut (a long sentence in parts), with the + speaker's name when the voice changes. A segment may give its own sentence times (`sentences`, checked when + present); else they are estimated from the text. + - The timeline: the player's whole width, a mark per step with its number (at least 8 px to hit), the playhead + always shown, hover says the time and the step in full and goes when the pointer leaves, the part a cut-off audio + can't reach greyed. The ±15 s buttons are gone (the keys stay); a narrow panel keeps ▶ ⏮ ⏭ first. Speed is a menu + from 0.75× to 2× (< > too); mute (M) is new; both are remembered. K works by its place on the keyboard. A seek + after the end plays on; the end offers Replay, Walk it yourself and Next journey. + - The storyline is the chapter list: start times, ♪ on the step being said, "not narrated" on a skipped step, ▶ per + step (plays that step and stops), a transcript per step (current sentence marked, click to go there, found by + Ctrl+F when shut). While it plays the panel's header is one line ("Step 6 of 14 · …"), and the animation's own + sentence and the code snippet give way to the caption; the panel scrolls to a step the voice moves to. + - Rows mark journeys with a podcast ("♪ 12:47"; "♪ Listening", "♪ Paused at 3:38"), with ⏸ / Resume on the row and a + tooltip line; the journey being walked is listed once (not again under "In this file"); Open Journey… and the + panel's journey list mark podcasts too. The scene's beat shows as dots. + - Accessibility: the timeline is an ARIA slider (↑ ↓ Home End Page Up/Down) whose value text gives the time, the + total and the step; step changes are announced once; controls have names and keys. Media keys and the system's + "now playing" work (Media Session). +- **Listen: the panel, calmer.** One player: while the journey panel shows the episode the Listen view is one line + (the journey, ⏸ / ▶, the time). While it plays the panel is the one-line header and the step's animation alone, in + the same box every step (the map where there is none, names only at the intro and the recap); the chapter list + comes back on pause, as number and title (▶ on hover) with one **Transcript** switch. The header stays one line + until the episode ends. The player: plain ⏸, ticks for the steps (hover "Step 6 · title · 5:23"), a "1×" that + cycles 1×–2×, no mute button (M stays), neutral greys; the end is Replay · Walk it yourself · Next journey only. + Beside the code the panel is 360–420 px while an episode is on. A caption or transcript sentence no longer splits + at the dot inside `repo.ReadTestFile`; the animation draws no wire stub to an actor out of view. +- **Listen: the side bar, the status bar and the palette, quieter.** The Listen view is there only while a journey is + listened to (playing or paused), with no empty-state text. A Journeys row says "♪ 12:47" and nothing more (no + "Listening", no "Paused at", no step, no speaker icon); its ▶ shows unless it plays (paused, ▶ goes on), with no ⏸ or + Resume row action and no podcast line in the tooltip unless the podcast can't play (then no ▶: the tooltip says + why). Open Journey… marks a podcast with a ♪ after the title, and the journey listened to says "listening" without a + ▶. The status item shows only while the journey panel is off screen ("Listening · 6:58", a one-line tooltip), is + gone after the end, and the walk's "3/14" item steps aside meanwhile. No status-bar flashes (resume, the follow + lock, a note being written, a removed step): the output logs them. The transport commands are in the palette only + while a journey is listened to (**Listen: Pause/Play**, **Listen: Open the Map**). The panel's notice is one line, + "⚠ 3 problems · Show why", counting what the Problems view lists; a bad beat is said by the step ("Step 1: no beat 99 + (it has 5); showing the whole step") and its marks aren't reported again; "Code changed since recording: steps 2, 5, + 9". A journey panel closed while VS Code was restoring it no longer fails the extension's activation. +- **Listen: the editor while it plays.** The editor is calmer: a view is held at least 8 s (a shorter part in + another file stays in the view before; beats in the same file just move the highlight). Scroll or click in the + narrated code and it stops following until the next step; **Follow along** on the step card snaps back. While it + plays the step card is one line ("narrating · beat 2/6", ⏸, ⏮ ⏭) and its ⏮ ⏭, Ctrl+' A / D and the player's are one + transport (⏮ is always the part before; in the Intro and Recap the keys move the episode). The Intro and Recap close + the walk's code so the map has the editor; the code comes back in one group beside the panel, never on your own + unsaved or untitled file. The first play says "The walk follows the voice: code opens beside the map". A note or a + question being written pauses it (closing the panel does not: the audio is in the Listen view). The panel no longer changes width on its own: focusing it, ‹ Journeys and the row + of the journey you're in keep its width (VS Code widening a panel focused at its minimum is undone), a reload never + closes it, and the journey you're in is focused, not reopened; Ctrl+' V gives a narrow panel room for the map. A + journey edited under the podcast keeps the step (by id); a removed step shows what the podcast says at its time; + quick ⏭ ⏭ open only the last target; a beat it doesn't narrate pauses it; End Journey ends the listening (▶ says + where it goes on); Ctrl+' Space in a journey without a podcast says so instead of starting another one. Reopened, + the panel shows the beat it was at; the output logs plays, pauses and stops with why. +- **Listen: marks, highlights as the words are said.** A segment may carry `marks`: while the voice says "requires a + model", that check lights, down to the characters (`match`, its `nth`); on "right there", the line that rejects it. + The newest mark is a strong tint (whole lines: one tinted block with a bar on the left, no lines between rows), the + segment's earlier ones stay, lighter, over the beat's own line; + the next segment clears them. A mark lights 0.12 s before its word; marks with the same phrase light together; at + any time (a seek, paused too) exactly the marks said by then show. Code that moved is found within 20 lines (said + once in the output), else the whole lines light. An off-screen mark is scrolled to, never under a reader who is + looking around; a mark in another file opens it only after the view hold (8 s). The check (extension and + `journey.py podcast`) says marks that can't be used, phrases not in the text, marks out of order, and, reading the + code, a missing file, lines past its end, or a `match` not where it says (and whether it is found nearby). +- **Listen: camera moves give you time to read.** When the next mark, beat or step is out of view, a cue at the + editor's edge says where the code goes ("↓ 340", "↑ 212", "→ main.ts") 0.8 s before; the code moves only once what + was just lit has been on screen 2.5 s (`codeNotes.listen.readBeforeMove`), and the audio then waits 0.8 s with the + new mark lit (`codeNotes.listen.settleAfterMove`). A wait is not a pause: the player, the status bar, the Journeys + row and the step card stay as they are; the cue is all that shows it. No waits when the code is on screen, under the + follow lock, after your own seeks, or on the map. The walk never lags the voice: if the audio doesn't stop for a + wait (checked against the audio's own time), or you play on or scroll during one, the wait is dropped and the code + goes to what is being said now; waits then stay off for 30 s. +- **Listen: the player and the walk keep time with the audio.** The panel's player (a remote of the Listen view) + counts from when the audio said its time, not from when the message arrived, so a busy extension never puts its + caption behind the voice; a run of time reports that piled up is applied once, its newest. Captions of a long + sentence change part when its words are said (the marks' phrases are word-timed) instead of by character count. +- **Listen: a quieter editor while it plays.** The step card is its header line ("3/14 · title", and Follow along + while you read on your own) above the function the step is in; the full card comes back on pause. The newest mark + is the one colour on the code (its own theme colour, `codeNotes.markBackground`; no bar, no scrollbar ticks); the + step's lines keep a thin grey bar, and the beat's box, value hints and note bars wait for the pause. +- **Listen: the follow lock sees the reader.** A slow scroll in small steps now counts (measured from where the + extension left the code), and the step card growing or shrinking on pause and play no longer counts as the reader + scrolling. A mark brought on screen keeps column 1 in view; the code scrolls right only when the mark starts past + the right edge. +- **Listen: more checks of the podcast file.** A step the journey doesn't have is said once with its segments and times; a beat written + as a string, a reused segment id (with both times), and narration in another order than the journey's are warnings; + a podcast recorded for an older commit whose steps' code changed since gets a quiet note; a podcast file not named + after its journey says in the output why it's ignored. `journey.py podcast` stays in step. +- **Podcasts: broken files are explained.** One check of the podcast file, with errors (it can't be played) and + warnings (a part is not what the file says: a step or beat the journey doesn't have, overlapping or out-of-order + times, an end before its start or past the audio, a cut-off audio, written for another journey). Every problem is + in the Problems view on the `.podcast.json` and in the output at warning level. A podcast that can't be played + keeps a greyed ▶ on its row (the tooltip says why) and a "Podcast unavailable · Show why" line in the panel; one + with warnings says them in one short line. A file that breaks while it plays keeps the last good version playing; + the status item goes with its podcast; putting the audio file back brings the podcast back. `audio` outside the + journeys folder is refused at load. `journey.py podcast` (the code-journey skill) runs the same checks, and + `journey.py check` runs them too. Segments may carry other fields, e.g. `say`, the spoken form (ignored). + [docs/podcast-format.md](docs/podcast-format.md) ships with the extension. - **Understanding check: a tour of the change.** Right after the questions, Claude writes a short journey of the change (6-10 steps through the changed code and the code it depends on), each question placed after the step that shows its answer. Check my understanding (or **Walk the tour** in the Check view) walks it in the journey panel: the diff --git a/README.md b/README.md index f250456..9ee629c 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,13 @@ write one. the line of code that does it, and shows that line with a few around it under the caption. - **Steps follow the code** like notes do: moved code is followed, changed code is flagged. Your own edits to a step's lines (typing, an applied fix) are followed, not flagged. +- **Listen:** a journey with an audio episode next to it (`.podcast.json`) has ▶ Listen on its row. The walk + follows the voice: each step's code opens, the animation moves beat by beat, the caption shows the sentence being + said. The timeline is marked by step; click or drag anywhere and the walk is exactly where it is at that time. The + storyline becomes the chapter list (▶ for one step, the transcript of the step being said). The audio plays in the + Listen view, so it goes on when the journey panel is closed or VS Code is in the background. + [docs/podcast-format.md](docs/podcast-format.md) describes the format and its checks: problems show in the + Problems view, and a podcast that can't play says why in its row's tooltip. ![What a step's animation can draw](docs/images/objects.png) @@ -179,6 +186,9 @@ One chord: **Ctrl+'** (or **Ctrl+<** on ISO keyboards), then a letter. | **V** | The journey map | | **P** | The current step's animation, on or off | | **J** | Search journeys | +| **Space** | Listen: play or pause | +| **←** / **→** | Listen: back / forward 15 s | +| **Shift+←** / **Shift+→** | Listen: previous / next step | ## Requirements diff --git a/docs/journey-format.md b/docs/journey-format.md index db13cf0..c1b23fb 100644 --- a/docs/journey-format.md +++ b/docs/journey-format.md @@ -33,6 +33,7 @@ personal. ], "links": [ /* { phrase, file, start, end, anchor }: a phrase of the lead or details linked to those lines */ ], "values": [ /* { name, value, file, line, text, note? }: a value hint above that line */ ], + "marks": [ /* { lines, match?, nth?, file? }: the part of the code the text names (see "Marks") */ ], "scene": { /* the step's animation: actors, wires, beats (see "Step animations") */ } } ] @@ -145,6 +146,45 @@ parent rule stays a `check` problem for readability, but nothing is hidden when shortened (first clause, no timings; a generic "calls" is not drawn); the whole label and `detail` are the label's tooltip. Function boxes open `at` (lines selected), else `path`, else their first step's lines. +## Marks: the part of a line the step is about + +A step, and each beat of its animation, may carry `marks`: the few characters its text names (one call, one argument, +one condition, one field) instead of whole lines. The same shape as a podcast segment's marks +(docs/podcast-format.md, "Marks") without the time: `lines`, an optional `match` and `nth`, an optional `file`. + +```jsonc +"steps": [{ + "title": "An empty cart is refused first", "file": "api/orders.js", "range": { "start": 10, "end": 15 }, + "marks": [{ "lines": [12, 12], "match": "total <= 0" }], + "scene": { "actors": […], "beats": [ + { "focus": "api", "caption": "It holds the stock for 30 s.", "code": { "file": "api/orders.js", "line": 13, "text": "…" }, + "marks": [{ "lines": [13, 13], "match": "{ hold: 30 }" }] } + ] } +}] +``` + +| Field | | +|---|---| +| `lines` | `[first, last]`, 1-based, inclusive, in the code at the journey's commit | +| `match` | Optional: only this text within `lines` lights (whitespace as written; it may span the lines). Without it the whole lines light | +| `nth` | Optional, 1-based: which occurrence of `match` within `lines` (default 1) | +| `file` | Optional, relative to the repository. Default: the step's file; on a beat, the beat's `code` file, else the step's | + +While the step is walked: + +- Opening the step lights its marks. A beat lights its own as the focus (`codeNotes.markBackground`); the step's + marks and earlier beats' stay, a lighter grey. A beat without marks keeps the newest ones before it as the focus. + The look is a podcast's: fills only, a mark within a line tints its characters, a mark of whole lines the lines. +- While there are marks, the step's lines get a thin grey bar instead of the bar and tint, and a beat with marks has + no box on its line: the marks carry the attention. A step without marks looks as it always did. +- Marks in the step's file move with the step (its anchor). `match` not where `lines` say: the nearest place with the + same lines shifted up to 20 lines up or down; not there either, the mark lights nothing (said once in the output). + Lines past the end of the file: nothing. +- `journey.py check` checks them (the file, the lines, `match` on them and its `nth`); `journey.py marks [n]` + prints each mark with the characters it lights. + +Keep them sparse: at most ~3 per step or beat, and only what the text names. + ## Step animations (`scene`) A step may carry a `scene`: a few actors (`app`, `browser`, `service`, `table`, `cluster`, `terminal`, `file`, diff --git a/docs/podcast-format.md b/docs/podcast-format.md new file mode 100644 index 0000000..b1693fb --- /dev/null +++ b/docs/podcast-format.md @@ -0,0 +1,290 @@ +# Journey podcasts + +A journey can have a podcast: one audio file that talks through the journey, whose parts are linked to the journey's +steps and animation beats. Code Notes plays it in the journey panel and moves the walk with the voice: each step's code +opens as the voice reaches it, and its animation goes to the beat being talked about. The extension only plays +podcasts; how you make one (a text-to-speech service, a recording) is up to you. + +## Where it goes + +Next to its journey, with the same name (a podcast file named otherwise is not played; the "Code Notes" output says +why, and which journey its `journey.id` names): + +``` +journeys/ + place-order.json the journey + place-order.podcast.json its podcast (this format) + place-order.mp3 the audio (any name: `audio` says which) +``` + +`audio` is a path relative to the podcast file. It must be inside the journeys folder (or a folder under it): the +panel can only load files from there, so a path that leaves it (`../x.mp3`), an absolute path or a URL is refused +("audio must be in the journeys folder (got ../x.mp3)"). mp3 plays in VS Code (tested); so do ogg/opus and wav. The +Listen view loads the file whole before it plays (it is held in memory while it is loaded), so seeking works wherever +VS Code runs: in the browser and in remote windows a webview's files are served without HTTP Range requests, and a +streamed file can't be sought in. + +A journey with a podcast has ▶ Listen on its row in the Journeys view (and its length, "♪ 12:47"), and its panel has +the player at the bottom. + +## The file + +```jsonc +{ + "version": 1, + "title": "Placing an order, end to end", + "journey": { "id": "place-order", "file": "journeys/place-order.json", "commit": "a1b2c3d" }, + "audio": "place-order.mp3", + "duration": 767.88, + "segments": [ + { "id": "s01", "at": null, "cue": "map", "speaker": "host", "text": "Welcome…", "start": 0, "end": 29.2 }, + { "id": "s04", "at": { "step": "checks-first", "beat": 1 }, "cue": "open", "speaker": "host", "text": "First, the page…", "start": 57.22, "end": 71.14 }, + { "id": "s05", "at": { "step": "checks-first", "beat": 3 }, "cue": "beat", "speaker": "host", "text": "Then it sends…", "start": 71.44, "end": 79.28 } + ] +} +``` + +| Field | | +|---|---| +| `version` | `1` | +| `title` | The episode's title | +| `journey` | The journey it was written for: `id`, and optionally `file` and `commit`. The player uses the journey next to the file; a different `id` is a warning, and the player says "Written for “…”" | +| `audio` | The audio file, relative to this file | +| `duration` | Seconds (optional; the audio's own length wins, and a difference of more than 1 s, or 1 %, is a warning) | +| `segments` | The parts, each with the fields below | + +A segment: + +| Field | | +|---|---| +| `id` | Stable when segments are edited or removed | +| `at` | Where it belongs: `null` (the whole journey: the map, no step open), `{ "step": "" }` (the step, without its animation), or `{ "step": "", "beat": n }` (the step's animation at beat `n`, 1-based, counted in the step's `scene.beats`) | +| `cue` | How the change of place is shown: `map`, `open` or `beat`. The player shows what `at` says; `cue: "map"` on a step shows the step without its animation | +| `speaker`, `text` | Who says what. The caption shows the sentence being said, two lines at most (a long sentence in parts), and the speaker's name when the voice changes (in an episode with more than one) | +| `say` | Optional: the spoken form a generator sent to text-to-speech (numbers, names spelled out). The player ignores it | +| `start`, `end` | Seconds in the audio. Gaps between segments belong to the segment before them | +| `sentences` | Optional: when each sentence of `text` starts, `[{ "start": , "text": "" }]` (e.g. a text-to-speech service's alignment); the caption shows the current one. Used only when every item has a number `start` and a `text`, the starts go up, and each is within the segment (its `start` to its `end`, or the next segment's start); otherwise it is a warning, and, as without it, the player estimates each sentence's time by its share of the text | +| `marks` | Optional: parts of the code that light up while the voice says a phrase ([Marks](#marks-highlights-as-words-are-said)) | + +Other fields, in the file or in a segment, are ignored: generators can keep their own data there. + +Steps are named by id, so reordering a journey's steps keeps the podcast right. Beats have no ids: they are linked by +position. + +## What the player does + +- **At any time the walk is where the podcast is at that time**: the segment playing then (the last one started) + says the step and beat. Seeking anywhere, backwards too, applies that directly, never the parts in between; of quick + seeks (a drag, a key held down), only the last one moves the walk. +- **Moving the walk yourself moves the audio**: a step in the storyline or a beat of the animation (‹ ›), and, while + paused, Next and Previous, jump the audio to the first segment about it. Ending the walk or opening another journey + pauses it and ends the listening (the status item and the Listen view go; ▶ goes on where it was). Pausing never + ends the walk. +- **One transport while it plays**: the step card's ⏮ ⏭, Ctrl+' A / D and the player's ⏮ ⏭ do the same thing: the + part before or after, in the order of the audio. ⏮ always goes to the part before (it never restarts the one + playing). In the Intro and the Recap, Ctrl+' A / D move the episode too. +- **A step the podcast never talks about**: the walk stays on it, the audio pauses, and the player says the step isn't + in the podcast. ▶ then goes on with the first segment after that step (the next step it talks about), not back to + where the audio was. A beat of the animation it doesn't narrate, picked while it plays, is the same: shown, the + audio paused ("Beat 4 isn't narrated"), ▶ goes on with the next part. +- **The journey edited under it** keeps the step (by id), not its number: the walk and the audio stay where they are. + The step on screen removed: the walk shows what the podcast says at its time now (the view before a part about a + step that is gone). Quick ⏭ ⏭ open only the last target. +- **On a beat whose code is in another file**, that file opens directly (never the step's own file first). A segment + on the map (`at: null`) ends the walk and closes the code tab the walk opened. +- **Where it was is kept, per journey**: opening another journey, ending the walk, closing the Listen view or reloading the + window keeps the time, and ▶ goes on from there. When the walk is on another step than that time is about, ▶ starts + at that step's first segment. +- **The podcast file saved again** while it plays keeps its place: the same time, or, when the segment playing then has + new times, the same moment of that segment (by `id`); it keeps playing if it was. +- **The time shown is the audio's own**: after a seek, the walk, the player and the status bar show where the audio + actually is. If it could not get there, the player says so and the Code Notes output channel logs it, as it logs + audio errors. +- **A link the journey can't show degrades**: a beat the step doesn't have (the journey was edited) shows the step + without its animation; a step id that isn't in the journey keeps the view of the segment before it. Each is a + warning (below), said by the step ("Step 3: no beat 9 (it has 5); showing the whole step"); marks on that beat's code + aren't checked against the step's file as well. + +## Listening + +- **▶ Listen** on the journey's row (not while it plays; paused, it goes on where it was), the ▶ on its row in + **Open Journey…** (a ♪ after the title; the one listened to says "listening"), the command **Code Notes: Listen to + Journey**, or the player's ▶ in the panel. The row says the length ("♪ 12:47") and nothing more. +- **Where the audio lives**: in the **Listen** view (in the Code Notes side bar, under Journeys; there only while a + journey is listened to, playing or paused). It goes on when the journey panel is closed, behind another tab, or VS Code isn't focused. While the + journey panel shows the episode, its player is the player and the Listen view is one line (the journey, ⏸ / ▶, the + time); the whole player shows there when the panel is closed. Closing the Listen view itself stops it (where it was + is kept). +- **The player**: the caption, the timeline with a tick where each step starts (click: that step's start; hover: + "Step 6 · title · 5:23"; the part a cut-off audio can't reach is greyed), ⏮ ⏸ ⏭, the time, and the speed ("1×": a + click goes 1× → 1.25× → 1.5× → 2×). In a narrow panel the total time, then the speed give way; ⏮ ▶ ⏭ stay. At the + end only **Replay**, **Walk it yourself** and **Next journey** (the next one with a podcast). A seek after the end + plays on. +- **The panel while an episode is on**: its header is one line, "Step 6 of 14 · title" (or "Intro", "Recap"), until + the episode ends. While it plays the panel shows the step's animation alone, in the same box every step (the map + for a step without one, and at the intro and the recap, with the areas' and boxes' names only); the caption is the + one text. On pause the chapter list comes back, with ‹ and End. Beside the code the panel is 360–420 px wide while + the episode is on (the code gets the rest). +- **The storyline is the chapter list**: number and title, the step being said in bold, a step the podcast skips + muted; ▶ on a row (under the pointer) plays that step alone and stops at its end. **Transcript** above the list shows + the transcript of the step being said under its row, following the voice (the sentence being said marked, a click + goes there; Ctrl+F finds words in shut transcripts too). The intro and the recap have rows. +- **Keys in the panel**: Space or K play and pause (K by its place on the keyboard: Caps Lock and other layouts too; + anywhere but a text field, also after clicking a button such as the animation's ‹ ›; a button you reached with Tab + still presses with Space), M mutes, < > change the speed (0.75× to 2×), ← → go back and forward 15 s, Shift+← → the previous and + next step (⏮ is always the part before). On the timeline (a slider): ↑ → and ↓ ← 15 s, Home and End, Page Up + and Page Down a step. +- **From anywhere** (the editor too): **Ctrl+' Space** plays and pauses, **Ctrl+' ←** / **→** go back and forward + 15 s, **Ctrl+' Shift+←** / **→** the previous and next step (commands **Listen: Pause/Play**, **Listen: Back 15 s**, + **Listen: Forward 15 s**, **Listen: Previous Step**, **Listen: Next Step**, in the palette only while a journey is + listened to). While the journey panel is not on screen, the status bar says **Listening · 6:58** or **Paused · + 6:58** (it is the only Code Notes item then; gone after the end); a click opens the journey's map. Headphone and + media keys work too (the system's "now playing" names the journey and the step). +- The speed and muting are remembered (every journey). + +## The editor while it plays + +- **The walk follows the voice: code opens beside the map.** The first play says so once. Step code always opens in + one group beside the panel: the group the walk used before (another journey, the map's moments and a reload keep + it), never a group holding your own unsaved or untitled file, never in two groups. +- **A view is held at least 8 s** (`VIEW_HOLD_S`): a part shorter than that whose `at` would show another file stays in + the view before it; beats in the same file move the highlight. A seek shows exactly its time. (Generators: merge + brief beats by the same rule.) +- **Reading around**: scroll or click in the narrated code yourself and the editor stops following (the beat is still + lit where it is); the step card says **Follow along** to snap back, and the next step follows again. +- **The step card** is its header line while it plays ("3/14 · title"; **Follow along** under it while you read on + your own), above the signature of the function the step is in. Paused, the full card comes back above the step's + first line, with ▶ Play. +- **Only the marks are coloured while it plays**: the step's lines have a thin grey bar (no tint), and the beat's box, + value hints, note bars and scrollbar ticks are off on the narrated code. They come back on pause. +- **The map's moments** (Intro, Recap, `at: null`): the walk's code tabs close, so the map has the editor; the code + comes back beside it at the next step. The editor at a time depends only on that time. +- **A note or a question** (Ctrl+' C, Ask on the card) pauses it: the code stays under your draft; ▶ (the card, + Ctrl+' Space) goes on. +- **The panel keeps its width**: focusing it, ‹ Journeys, its row in the Journeys view or Open Journey… on the journey + you're in (which focus it, never close it) don't resize it, and a reload doesn't close it. Ctrl+' V in a panel too + narrow for the map gives it the room. +- Reopened mid-episode, the panel shows the beat at the time it was left, paused there. + The output logs each play, pause and stop with why. +- If the audio can't play (a broken or cut file), ▶ stays paused and the player says why; it never shows "playing" + with the clock standing still. +- VS Code lets a view play sound only after a click or a key in it: the first time the Listen view plays, it takes + the keyboard and says "Press Space to play" (the panel says to click ▶ there). After that, the keys and commands + play it directly. +- For screen readers: the timeline is a slider whose value says the time, the total and the step (once a second); + a step change while playing is announced once, politely; every control has a name and its keys in its tooltip. + +## Marks: highlights as words are said + +A segment may carry `marks`: parts of the code that light up while the voice says a phrase. The segment's `at` (its +step and beat) decides the file and the view; marks light parts of it, down to a few characters. "If the test requires +a model and the run is strict, it is rejected right there": on "requires a model" the check lights, on "right there" +the line that rejects it. + +```jsonc +"marks": [ + { "phrase": "requires a model", "at": 2.8, "lines": [338, 338], "match": "spec.NeedsModel(steps)" }, + { "phrase": "right there", "at": 11.36, "lines": [339, 340] }, + { "phrase": "the replay file", "at": 13.0, "file": "runner/src/replay.ts", "lines": [40, 52] } +] +``` + +A journey's steps and beats have marks of the same shape, without `phrase` and `at` (docs/journey-format.md, +"Marks"); both are read and found by the same code (`src/marks/`). + +| Field | | +|---|---| +| `phrase` | The words in `text` the mark goes with (the first occurrence after the mark before's phrase). Marks with the same phrase one after the other light together (two places at once) | +| `at` | Seconds from the segment's `start` when the phrase is said (its first character), within the segment | +| `file` | Optional: the file, relative to the repository. Default: the segment's beat's file, else its step's. Required in a segment whose `at` is `null` | +| `lines` | `[first, last]`, 1-based, inclusive, in the code at the journey's commit | +| `match` | Optional: only this text within `lines` lights (whitespace as written; it may span the lines) | +| `nth` | Optional, 1-based: which occurrence of `match` within `lines` (default 1) | + +While it plays: + +- A mark lights 0.12 s before `start + at` (the eye gets there as the word is said). Marks are fills only (no + borders, nothing in the scrollbar): a mark within a line tints its characters, a mark of whole lines tints the full + lines as one block. The newest mark is the one colour on the code (`codeNotes.markBackground`), the segment's + earlier marks stay, a lighter grey. The next segment clears them. +- At any time T, exactly the marks lit by T in the segment playing at T show: a seek forward lights them, a seek back + takes them away, also while paused. +- `match` not where `lines` say (the code moved): the nearest place with the same lines shifted up to 20 lines up or + down (nearer first, up before down; `nth` counts within the shifted lines), said once in the output; not found + there either: the whole `lines` light (each line from its text, never its indentation). Lines past the end of the file: nothing. +- A mark that lights while it plays and is off screen is scrolled to (centred), with column 1 kept in view: the code + scrolls right only when the mark starts past the right edge. One on screen never moves the editor. + A reader looking around on their own (the follow lock) is never scrolled: marks still light where they are. +- A mark in another file than the one on screen is a view change: it opens that file only once the view has been on + screen at least `VIEW_HOLD_S` (8 s); sooner, it is skipped (the output says so at debug level). + +## Camera moves: time to read before the code moves + +A camera move is the narrated editor scrolling or switching files while it plays: a new step or beat, or a mark, +whose code is out of view. Quick moves leave no time to read what was just lit, so: + +- **A heads-up**: 0.8 s before a move, a quiet cue at the editor's edge says where it goes: "↓ 340" on the last line + on screen, "↑ 212" on the first, "→ main.ts" for another file. It goes when its code comes into view anyway. +- **Time to read before leaving**: what the view on screen lit last (a mark, a beat, a step arriving) stays at least + `codeNotes.listen.readBeforeMove` seconds (2.5) before the code moves; the audio waits for the rest. +- **A moment after arriving**: the audio waits `codeNotes.listen.settleAfterMove` seconds (0.8) more, the new mark lit. +- A wait is a hold, not a pause: the audio stops, but the player, the status item and the step card go on + showing it playing; the edge cue is all that shows it. The time stays the audio's. ⏸ or Space during a + wait pauses (the move is dropped). 0 turns a wait off. +- The walk never lags the voice. Whether the audio stopped is what it reports itself: still moving 0.25 s after the + hold was asked, the wait is dropped, the log says so once, the walk goes to what the audio says now (its view and + marks at that time, no late moves), and waits stay off for 30 s. Playing on during a wait (another ▶, a headset + key) or scrolling the code (the follow lock) also drops it the same way. +- No waits when nothing moves (its code is on screen), under the follow lock (nothing moves then), for the reader's + own seeks and skips (the moves in the 1.5 s of audio after one), and at the map's moments (to the map, or from it). +- Generators: the moves are where the script makes the editor jump; merging or reordering marks avoids most waits. + +## Validation + +The extension checks the file every time it, the journey or the audio file changes. The code-journey skill's +`journey.py podcast [