@mereon/demo 0.2.0 → 0.4.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.
Files changed (4) hide show
  1. package/NOTICE +19 -0
  2. package/README.md +127 -20
  3. package/dist/demo.mjs +19401 -6277
  4. package/package.json +4 -3
package/NOTICE CHANGED
@@ -34,3 +34,22 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
34
34
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
35
35
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
36
36
  SOFTWARE.
37
+
38
+ ------------------------------------------------------------------------------
39
+ yaml
40
+ https://github.com/eemeli/yaml
41
+ ISC License
42
+
43
+ Copyright Eemeli Aro <eemeli@gmail.com>
44
+
45
+ Permission to use, copy, modify, and/or distribute this software for any purpose
46
+ with or without fee is hereby granted, provided that the above copyright notice
47
+ and this permission notice appear in all copies.
48
+
49
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
50
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
51
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
52
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
53
+ OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
54
+ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
55
+ THIS SOFTWARE.
package/README.md CHANGED
@@ -16,11 +16,11 @@ npx @mereon/demo login
16
16
  npx @mereon/demo doctor
17
17
  ```
18
18
 
19
- `init` writes `demo/config.json` and a `demo/scripts/` folder, and installs instructions for the coding agent it finds in your project (or the ones you name with `--harness <name>`) so the agent knows when and how to record a demo. Commit what it writes. The instructions pin the version of this tool that wrote them.
19
+ `init` writes `demo/config.json` and a `demo/scripts/` folder, and installs instructions for the coding agent it finds in your project (or the ones you name with `--harness <name>`) so the agent knows when and how to record a demo. At a terminal it first asks where your app opens when you start it for development (`url`), because a guessed port is often one another project is already answering on; run by an agent, it writes `http://localhost:3000` and says that is a guess. Commit what it writes. The instructions pin the version of this tool that wrote them, and so does `demo/config.json` (`version`): a bare `npx @mereon/demo` that starts another version runs the pinned one instead, and says so (`DEMO_VERSION_CHECK=off` runs it as it is). To move a project to a newer version, run `init` with it, which updates the instructions and the pin together. You can also add the tool as a devDependency (`npm install --save-dev @mereon/demo`), which npx then runs without downloading it. The instructions are a short guide, `demo/AGENT.md`, and six files under `demo/agent/` that it sends the agent to only when a demo needs them: who it is for and what it is filed under, branding, secrets, announcing, showing more than one page, and showing more (a before-and-after, a loop, a slow push in).
20
20
 
21
21
  `init` also installs a research skill. Ask your agent to research a change, or say yes when it offers, and it checks the feature, fix or chore against how your organization works: who does the work it touches, the procedures and policies that govern it, problems people have reported, and the training that describes it today. It reports blockers, warnings and ideas in the conversation, each with the code it would change, and with your agreement it can file a gap in your organization's own material as a Mereon issue. It needs the [Mereon MCP server](https://docs.mereon.ai/mcp/overview/) connected to your organization, and it only reads otherwise.
22
22
 
23
- `login` opens your browser to sign in and remembers the grant on this machine. `doctor` checks that everything the tool needs is in place and says what to fix if it is not.
23
+ `login` opens your browser to sign in and remembers the grant on this machine. When the project does not yet say which organization its demos are filed in, `init` asks, listing the organizations you are signed in to by name, or signs you in to choose one, and writes the choice to `demo/config.json`. Then `login` has nothing left to do. `doctor` checks that everything the tool needs is in place and says what to fix if it is not.
24
24
 
25
25
  You need Node 24 or later, and ffmpeg on your path (with Opus support, plus H.264 and AAC if you want video). The tool downloads the browser it records with the first time it needs it. It runs on macOS and Linux, including Windows through WSL.
26
26
 
@@ -33,11 +33,31 @@ npx @mereon/demo record <script-id> # render it
33
33
  npx @mereon/demo upload # file the latest recording
34
34
  ```
35
35
 
36
- `record` checks the whole script first, without spending anything, and fails naming the step if a selector does not match one visible element. It starts your app if you have told it how, records, and stops the app afterwards. A guide is a screenshot for each step with one narration track. A video is one continuous recording with the voice placed against the picture, and `--draft` makes a smaller one for a quick look.
36
+ `record` checks the whole script first, without spending anything, and fails naming the step if a selector does not match one visible element. It starts your app if you have told it how, records, and stops the app afterwards. A guide is a screenshot for each step with one narration track. A video is the steps' narration with the voice placed against the picture, and `--draft` makes a smaller one for a quick look, laid out exactly as the final will be.
37
37
 
38
- `upload` files the recording. Running the same script again updates the guide it made instead of adding another. If you cannot publish to your whole organization, the upload becomes a proposal for an administrator and the tool tells you so, and an update to a guide that is already published stays a proposal until it is approved: the published guide is not touched before then.
38
+ Name several scripts to record a series in one run: `record intro invoices reports`. The app is started once and the takes are recorded one after another, since they share the app and its seed data. Each video is made once every take is in, two at a time, or as many as `--parallel <n>` says. A script that fails does not stop the rest, and the run then fails, listing what was recorded and what was not.
39
39
 
40
- When an upload updates a published guide, `--retraining` says whether people who already learned it should be retrained: `changed-material` gives them a short lesson on what changed, `full-retake` has them take the original lesson again, and `none` (the default) asks nothing of them. A video cannot be updated yet, so the flag is for guides.
40
+ A viewer only sees narrated steps on settled screens, never the plumbing between them:
41
+
42
+ - **Setup is off camera.** A script's `setup({ page, baseUrl, secret })` runs before anything is recorded, in the same browser, to sign in, prepare data or open the first screen. Or the browser starts already signed in, from a session you saved by hand (`auth`, below) or a storage state file (`storageState`).
43
+ - **Actions are cut.** Each step's action (navigating, filling in, waiting for data) is cut from the video, and the step before dissolves into the new one. A step can ask for a plain `transition: 'cut'`, or `'show'` to keep its action on screen when moving between screens is the point.
44
+ - **Narration waits for the page.** After the action, the recorder waits until the page is still: fonts loaded, no requests in flight, nothing marked busy or moving, for at most three seconds. A step can wait for a selector instead (`settle: '#cards'`), or skip it (`settle: false`).
45
+ - **A slow cue makes the narration wait.** Each cue runs as its words are spoken. When the cue before it is still running, it can start up to half a second late; later than that, the narration stops at its words until it starts, and the wait is cut from the video, so a slow save does not cost a take.
46
+ - **Warnings say what to fix.** The result's `warnings` names a screen that flashes by, a step that signed in on camera, narration that started over a page still loading, or a wait for a slow cue, each with its step and a hint.
47
+
48
+ `inspect /invoices` opens that page of your app as a recording would (signed in with `--auth <profile>`, settled, at the recording's size) and lists the headings and the elements a script can act on, in reading order, each with its role, accessible name, and a selector in the tool's syntax that matches exactly it: its role and whole name where that is unique, a `data-testid` where names repeat, its text otherwise. `--near "<text>"` puts what is closest to that text first. JSON on stdout, for an agent writing a script.
49
+
50
+ `check` runs a script's actions and cues as fast as the page allows, with no narration and nothing bought or written, and reports every problem in one pass: each step or cue whose selector did not match exactly one visible element, and any secret that showed uncovered. For a video (`--output video`, or the project's `output`), it also times each cue, counts the cursor's glides, typing and pauses a video adds, and, for the steps whose narration is already made, fails a cue its own motion would make late: typing a name with one word before the next cue, say. `record` makes the same check once it has made the narration, before the take. It carries on past a failing cue, and past a step whose action fails, so a script with three broken selectors is fixed in one round rather than three. `--only-step <n>` runs the steps before it to reach it, then checks only that step; `--from-step <n>` checks from there to the end. It needs no Mereon sign-in. A check of every step that passes stands for `record`'s own check for ten minutes, while the script and the app's address are unchanged, so `record` goes straight to the take.
51
+
52
+ A video keeps its take beside it, in `demo/out/<script-id>/video/take/`: the raw recording and when each step, narration and cue happened. `render` makes the video again from it in seconds, with no browser and no app, when what changed is post-production: the branding (title and end cards, the frame, step labels, zoom), a step's `transition`, or narration that still fits the time each step took. `--brand` tries a level or parts (`--brand standard`, `--brand titleCard,frame`) without changing the script. It refuses, saying why, when the take no longer matches the script: a step's action, cues or settle, the setup or saved session, the secrets or redact list, narration too long for its step or a cue whose words moved more than half a second, or the highlights, which are drawn in the page while it is recorded. Then record again.
53
+
54
+ The helpers wait for what they act on: an element the app draws again under them (a list that renders twice as its data arrives) is found again, and a click or a key that loads another screen or saves something waits for the page to settle before the next cue runs. `demo.select(selector, option)` chooses an option of a native select, and `demo.type` fills a date or time input with the value whole (`2026-08-01`, `14:30`). An outline on something a dialog then opens over is cleared.
55
+
56
+ Selectors are Playwright's. In `role=link[name="..."]` the name must be the whole accessible name, exactly; add `i` after the closing quote to ignore case, or use a regular expression such as `role=link[name=/Reply to/]` to match part of it. When a role selector matches nothing, the error lists the names that role has on the page.
57
+
58
+ `upload` files the recording. A video carries its script, which Mereon keeps as the transcript instead of transcribing the narration, and, when every step has a `label`, its steps as the video's chapters. It also carries the screen each step was recorded on, which Mereon Embed matches to your app's screens (see "Showing demos in your app"), and says how many steps it sent. Running the same script again updates the guide or video it made instead of adding another: a guide gets a new version, and a video a new recording, which replaces the current one once it has finished processing. If you cannot publish to your whole organization, the upload becomes a proposal for an administrator and the tool tells you so, and an update to a guide or video that is already published stays a proposal until it is approved: the published one is not touched before then.
59
+
60
+ When an upload updates a published guide or video, `--retraining` says whether people who already learned it should be retrained: `changed-material` gives them a short lesson on what changed, `full-retake` has them take the original lesson again, and `none` (the default) asks nothing of them.
41
61
 
42
62
  | Command | What it does |
43
63
  | --- | --- |
@@ -47,26 +67,38 @@ When an upload updates a published guide, `--retraining` says whether people who
47
67
  | `logout [--organization <id>]` | Signs out of one organization and revokes its grants, the one for announcements included. |
48
68
  | `logout --all` | Signs out of every organization and deletes this tool's credentials, the ElevenLabs key included. Run it when you remove the tool. |
49
69
  | `logout --elevenlabs` | Forgets the stored ElevenLabs key and leaves your sign-ins. |
50
- | `doctor` | Checks that everything needed is in place. |
70
+ | `auth capture [--name <profile>] [--url <path>]` | Opens your app in a browser for you to sign in by hand, and saves the session for scripts to start from. See below. |
71
+ | `secrets set <NAME>` / `secrets list` | Sets a secret a script uses, asked for without showing it, or lists them by name and whether each is set. See "Secrets and personal data". |
72
+ | `doctor` | Checks that everything needed is in place, and whether each saved session still signs in. When the app is not running, it runs your start command to show that it starts the app, and stops it again. |
51
73
  | `config set <key> <value>` | Changes a setting in `demo/config.json`. |
52
74
  | `voices` | Lists the narration voices and says which one this project uses. Needs no login. |
53
75
  | `audience` | Lists your organization's roles and teams, so your agent can check with you who a demo is for. |
54
76
  | `tags` | Lists your organization's tags, so your agent can suggest what a demo is filed under. |
55
- | `record <script-id> [--output guide\|video] [--draft] [--allow-remote]` | Records a script. |
77
+ | `tags create <name>` | Adds a tag to your organization, if you may edit content. Mereon stores the name lowercase with hyphens. |
78
+ | `record <script-id>... [--output guide\|video] [--draft] [--parallel <n>] [--allow-remote]` | Records a script, or several in one run. See below. |
79
+ | `inspect <path> [--auth <profile>] [--near <text>] [--limit <n>] [--split] [--allow-remote]` | Lists a page's elements and headings, each with a selector that matches only it. See below. |
80
+ | `check <script-id> [--only-step <n> \| --from-step <n>] [--output guide\|video] [--allow-remote]` | Runs a script's actions and cues headless, without narration, and reports every problem in one pass. See below. |
81
+ | `render <script-id> [--brand <level or parts>]` | Makes a recorded video again from its kept take, without the browser. See below. |
56
82
  | `upload [<script-id>] [--output guide\|video] [--tag <name>]... [--stack] [--hold\|--publish-now] [--retraining <choice>] [--confirm-redacted]` | Files a recording in your organization, under the script's tags and any `--tag`. A recording that used secrets needs `--confirm-redacted`. |
57
83
  | `announce [<script-id>] --text-file <path> [--tell <who>] [--title <title>] [--visible-to everyone\|admins] [--tag <name>]... [--pop-quiz\|--no-pop-quiz] [--publish-now] [--confirm-redacted] [--send]` | Files a video and announces it to the people you choose. Sends only with `--send`. See below. |
58
84
  | `release [--dry-run] [--strict]` | In CI after a deploy, publishes the demos held for it. See below. |
85
+ | `ci setup [--after <job>] [--workflow <file>] [--yes]` | Adds the job that runs `release` after your GitHub Actions production deploy, holds uploads for it, and stores the release token as its secret, checked first. See below. |
59
86
  | `reel <script-id>... [--title <text>] [--output <file>] [--confirm-redacted]` | Joins the latest videos of those scripts behind a card that lists them, for sharing what a release changed. Nothing is uploaded. A recording that used secrets needs `--confirm-redacted`, as for `upload`. |
60
87
 
61
88
  Logs go to stderr, and a command that succeeds prints one JSON object to stdout.
62
89
 
63
90
  ## Showing a change
64
91
 
65
- Every video's cursor glides to what it points at, and while a demo highlights or calls out something, the rest of the page dims. A script can also:
92
+ Every video's cursor glides to what it points at, the page glides to something off screen rather than jumping, and while a demo highlights or calls out something, the rest of the page dims. A script can also:
66
93
 
67
94
  - show a keyboard shortcut as it is pressed, with `demo.press('ControlOrMeta+K')`;
68
95
  - show the screen before the change and wipe across to it now, with `demo.before('http://localhost:3001/invoices')`, given the earlier version of your app running on another local port;
69
- - cut a few silent seconds of one step as `loop.mp4` for the pull request, with `loop: { step: 2 }`.
96
+ - cut a few silent seconds of one step as `loop.mp4` for the pull request, with `loop: { step: 2 }`;
97
+ - show two people's screens at once, each signed in as someone else: name the other pages in `pages`, and a step shows one beside the app's with `side: 'client'`, split side by side or, with `layout: 'pip'`, small in a corner. A cue acts on another page with `demo.on('client')`, so the viewer sees the cause in one screen and the effect in the other;
98
+ - burn in captions of everything said, as it is said, with `captions: true`;
99
+ - push in slowly on a screen the viewer reads for a while, with `camera: 'drift'` on the step, keeping what it highlights in view;
100
+ - open a long overview with a card listing what it covers, with `intro: { contents: true }`, from the steps' labels;
101
+ - put a card between two steps, as a map between screens: a step's `interlude` is a section heading, a short list, or a flow of stages drawn in left to right with the one coming next picked out, in your brand's look when the demo is branded, with narration of its own if you like.
70
102
 
71
103
  Your agent decides when these help, from the instructions `init` installed. Once several demos for one release are recorded, `reel` joins them into one video.
72
104
 
@@ -92,10 +124,22 @@ A demo can be filed under your organization's tags, the labels your library is f
92
124
  tags: ['billing', 'onboarding'],
93
125
  ```
94
126
 
95
- Write them as you like: `Fire Safety` is the tag `fire-safety`. `upload --tag <name>` adds a tag for that one upload, and can be given more than once. Each has to be a tag your organization already has. The tool cannot create one, so someone who can edit content creates a new tag in Mereon. `record` checks the script's tags before it records anything, and `upload` refuses a `--tag` your organization lacks before anything is sent. Both messages list the tags it has. A tag renamed or deleted after recording is left out of the upload with a warning, so the recording can still be filed.
127
+ Write them as you like: `Fire Safety` is the tag `fire-safety`. `upload --tag <name>` adds a tag for that one upload, and can be given more than once. Each has to be a tag your organization already has. If none fits, `demo tags create <name>` adds one, if you may edit content (or someone who can adds it in Mereon); your agent runs it only once you agree to the name. `record` checks the script's tags before it records anything, and `upload` refuses a `--tag` your organization lacks before anything is sent. Both messages list the tags it has. A tag renamed or deleted after recording is left out of the upload with a warning, so the recording can still be filed.
96
128
 
97
129
  A demo that goes to an administrator for review carries its tags too. An upload that updates a guide adds the tags it lacks and keeps the ones it has, so to take a tag off, do it in Mereon. An update that waits for a release or a reviewer adds them when it is applied. `announce` takes `--tag` only on the run that uploads the video.
98
130
 
131
+ ## Signing in once, by hand
132
+
133
+ An app whose sign-in sends a code by email or text, goes through single sign-on, or asks for a passkey is hard to sign in to from a script. Sign in yourself instead, once:
134
+
135
+ ```sh
136
+ npx @mereon/demo auth capture --name support
137
+ ```
138
+
139
+ It starts your app if it is not running and opens it in a browser. Sign in however the app asks, and when you see the app signed in, press Enter in the terminal. The session (the browser's cookies, local storage and IndexedDB) is saved as `demo/.auth/support.json`, which `init` and `auth capture` keep out of git. Where your machine has a keychain (the macOS Keychain, or the Secret Service on most Linux desktops) the file is encrypted with a key kept there; where it has none, the file is readable only by you, and `auth capture` says so. Without `--name` the profile is called `default`, and `--url /inbox` opens a page other than the app's address.
140
+
141
+ A script starts from it with `auth: 'support'`, so it declares no secrets for signing in and its `setup` does not sign in. Save one profile for each role a demo shows, such as `admin` and `client`. Sessions expire: `record` opens the page you saved it on before anything is recorded, and if that page asks you to sign in again it stops and says to run `auth capture` again. `doctor` lists every saved session with its age and whether it still signs in.
142
+
99
143
  ## Secrets and personal data
100
144
 
101
145
  Some demos need real values: an account to sign in with, an API key an integration checks before it saves, or a page that shows a person's email address or phone number. A script can use them without ever holding them. It names the values it uses and types them with `demo.typeSecret`:
@@ -106,7 +150,13 @@ secrets: ['DEMO_EMAIL', 'DEMO_PASSWORD'],
106
150
  do: async ({ demo }) => demo.typeSecret('input[type="password"]', 'DEMO_PASSWORD'),
107
151
  ```
108
152
 
109
- The values come from `demo/.secrets`, a file of `NAME=value` lines that `init` keeps out of git. To use a file you already keep, point at it in `demo/config.json` with `"secrets": { "file": "api/.env", "names": { "DEMO_PASSWORD": "SEED_ADMIN_PASSWORD" } }`. `doctor` lists any secret a script declares that the file lacks, by name only.
153
+ The values come from `demo/.secrets`, a file of `NAME=value` lines that `init` keeps out of git. Set one without opening it:
154
+
155
+ ```sh
156
+ npx @mereon/demo secrets set DEMO_PASSWORD
157
+ ```
158
+
159
+ It asks for the value without showing it (or reads it from a pipe, such as `op read ... | npx @mereon/demo secrets set DEMO_PASSWORD`), writes it so it reads back exactly, and keeps the file readable only by you. `secrets list` shows each secret the scripts declare, by name, whether it is set, and which scripts use it. To use a file you already keep, point at it in `demo/config.json` with `"secrets": { "file": "api/.env", "names": { "DEMO_PASSWORD": "SEED_ADMIN_PASSWORD" } }`; `secrets set` then writes there, under the mapped name, and leaves the rest of the file and its permissions as they were. `doctor` and `record` name any secret a script declares that the file lacks, with the command that sets it.
110
160
 
111
161
  The recorder covers each value with a solid mask (or a heavy blur, with `redactStyle` below) wherever it shows, from the first frame it appears in: the field it was typed into, text that contains it, and its last four characters when those are letters and digits, which is how apps show a saved key ("Key ending ABCD") or a phone number ("ending 4477"). That includes a modal dialog, which the browser draws above everything else. A run fails, naming the step and the element, if a value shows anywhere without a mask over it, and the check runs on the trial pass before any narration is paid for. It cannot see inside a canvas or an image, so list a CSS selector for anything like that in the script's `redact` list, and use `demo.redact(selector)` for something private that is not one of the values, such as another person's details on the same screen. The page's address and title, narration, cue phrases, callouts and selectors are refused if they hold a value, and logs and errors print its name instead.
112
162
 
@@ -136,19 +186,36 @@ The cards show what the script gives them: `intro: { subtitle, narration }` and
136
186
  | `url` | Where your app is served. Must be on your own machine unless you pass `--allow-remote`. |
137
187
  | `start` | The command that starts your app, used only if nothing is already listening at `url`. |
138
188
  | `ready` | A URL that answers when the app is ready. Defaults to `url`. |
139
- | `seed` | A command that puts the app in a known state. It runs before the check and again before the recording. |
189
+ | `seed` | A command that puts the app in a known state. It runs before the check and again before the recording, and must leave the app ready to serve: end it by polling an address that reads the database and is not rate-limited. A failed seed's message leads with its own last error line. |
140
190
  | `output` | `guide` (default) or `video`. |
141
191
  | `upload` | Whether recordings are filed in Mereon. |
142
192
  | `voiceProvider` | `mereon` uses your organization's included narration. `byo` uses your own ElevenLabs key. |
143
193
  | `voiceId` | The narrating voice, by name (`Matilda`) or id. Run `voices` to see the choices. With `voiceProvider` set to `byo`, any voice id from your own ElevenLabs account also works. Changing it narrates every step again. |
194
+ | `voices` | A voice for each speaker, for demos in which more than one person talks: `config set voices.owner Matilda`. A step or a card says who speaks with `voice: 'owner'`; the rest use `voiceId`. Each speaker's narration is kept apart in the cache, as each voice's is. |
195
+ | `music` | A music bed under every video's narration: an audio file, from the project root, that you have the right to use. It is brought to a level under speech, turned down further while anyone speaks, and faded in and out. A script's own `music` replaces it, and `music: false` turns it off for one demo. |
144
196
  | `organization` | The Mereon organization this project files into, by id. `login` sets it the first time. See below. |
145
197
  | `release` | `upload` (default): a demo goes live when it is uploaded. `ci`: it is held until your CI runs `release` after the change is deployed. See below. |
146
198
  | `releaseBranch` | The branch a held upload must already be on. Defaults to the remote's default branch. |
147
199
  | `source.repo` | Names where demos come from, so a second upload updates the first. |
200
+ | `version` | The version of this tool the project uses, which `init` writes. A bare `npx @mereon/demo` of another version runs this one. |
148
201
  | `brand` | How branded demos are when a script does not say: `none` (default), `light`, `standard` or `full`. See "Branding". |
149
202
  | `redactStyle` | How a covered value looks: `mask` (default), a solid fill, or `blur`, a heavy blur with a faint tint that lets viewers see typing happen. A blur still shows roughly how long a value is, so choose it only where that is fine. |
150
203
  | `secrets` | Where the values of a script's secrets are read from: `file` (default `demo/.secrets`), `names` to map a script's name to the name in that file, and `suffix` to change how many of a value's last characters count as showing it (4 by default, and only when they are letters and digits; 0 for only the whole value; a number you set applies whatever the characters). Edit it by hand: `config set` refuses anything that looks like a credential. |
151
204
 
205
+ ### On one machine
206
+
207
+ Where the app runs, and how it starts and is seeded, can differ from one machine to the next: port 3000 may belong to another project on yours. `url`, `ready`, `start` and `seed` can be set for this machine alone, over `demo/config.json`, in `demo/config.local.json` (which `init` keeps out of git, and which takes only those four), and over both in the environment: `DEMO_URL`, `DEMO_START` and `DEMO_SEED`. A `ready` URL on the same address as `url` moves with it. `doctor` and `record` say which settings this machine overrides and where each came from, and `config set` says when the value it just wrote is overridden here.
208
+
209
+ When nothing answers at the app's address and there is no `start`, `doctor` lists the commands that look like they start and seed the app, from your `package.json` scripts (run with the package manager your lockfile names), a Docker Compose file, or a `Procfile.dev`. In a terminal it offers them, and sets what you choose. `start` waits up to two minutes for the app to answer, and shows the end of what the command printed if it does not.
210
+
211
+ ## The three credentials
212
+
213
+ The tool uses up to three, each kept apart from the others, and `doctor` names each one it checks:
214
+
215
+ - **Your own sign-in** (`login`), for recording, uploading and narrating with your organization's voices. Stored on your machine, in `~/.config/mereon/`.
216
+ - **The release token**, for CI to publish held demos after a deploy. It belongs to the organization, lives only in your CI as `MEREON_RELEASE_TOKEN`, and `ci setup` stores it there.
217
+ - **An ElevenLabs key** (`login --elevenlabs`), only for narrating with your own ElevenLabs account.
218
+
152
219
  ## More than one organization
153
220
 
154
221
  A login belongs to one organization, which you choose on the sign-in page. If you work with several, sign in once for each: `login` keeps all of them. A project says which one it files into with `organization` in `demo/config.json`, and the first `login` you run from a project writes it for you. Commit it, so a teammate signed in to a different organization is stopped instead of filing into the wrong library.
@@ -157,7 +224,18 @@ The first login from a project has nothing to start the sign-in page on, so it s
157
224
 
158
225
  From then on the project uses only that organization. The sign-in page starts on it, `record` and `upload` stop if you are not signed in to it, and `login` saves nothing if you choose a different one on the page. `upload` says which organization it is filing into before it sends anything, and `doctor` shows it too.
159
226
 
160
- A project that names no organization uses the only one you are signed in to, and stops with a list as soon as you sign in to a second. Name one with `demo config set organization <id>`. The id is what `login` and `doctor` print. `logout` signs out of the project's organization and leaves the others signed in. Outside a project, say which with `logout --organization <id>`. `logout --all` signs out of all of them at once.
227
+ A project that names no organization uses the only one you are signed in to, and stops with a list as soon as you sign in to a second. Name one with `demo config set organization <id>`, or run `init` in a terminal to choose by name. `login`, `doctor` and the refusal that lists your organizations show each one's name beside its id. `logout` signs out of the project's organization and leaves the others signed in. Outside a project, say which with `logout --organization <id>`. `logout --all` signs out of all of them at once.
228
+
229
+ ## Showing demos in your app
230
+
231
+ [Mereon Embed](https://docs.mereon.ai/api/embed/) shows the people using your app the demos recorded on the screen they are on. Each step of a video is uploaded with the page it was on, the page's title, the step's `label`, and what identifies the element it acted on, including the `data-mereon-anchor` of that element or the nearest one around it, and of the selected tab the step ended on.
232
+
233
+ - **Mark every view.** A screen that shows different things at one address (tabs, segmented views, a `?tab=` parameter) needs each tab or view marked with `data-mereon-anchor`, and the app reporting the one in view, or Embed lists every demo recorded on the screen for every view. Mark them before recording: a recording made before cannot be matched to a view. A recording warns (`unmarked-view`) when a step ends on a selected tab with no anchor on a page that marks other elements; `checkViews: false` in a script turns that off for an app that does not use Embed.
234
+ - **Give each screen its own title, and each step a label.** The recorder keeps the page's title and the step's `label`, and Embed shows them beside the step's number.
235
+ - **Check what it will match.** `coverage` lists the screens the recordings here visit, the views seen on each, and the steps Embed could not tell apart or label.
236
+ - **Share it beyond administrators.** A demo shared with administrators only never appears to someone the app's server signs in.
237
+
238
+ Videos uploaded before 0.3.0 went up without their steps, so Embed never finds them. `steps` gives them the steps of their recordings on this machine, without uploading them again: `steps <script-id>` for one, or `steps` for every video recorded here. Each step goes with its label, from the recording's chapters for one made before steps kept their labels. Each is found by its source key, and one that was never uploaded, or has a new recording on its way, is left as it is and reported. The steps line up only with the recording that was uploaded, so run it before recording a script again.
161
239
 
162
240
  ## Publishing when the change ships
163
241
 
@@ -169,29 +247,58 @@ The workflow:
169
247
  2. Once the pull request has merged, upload from the default branch: `demo upload`. The upload records the commit it was made from, and is refused from a commit that is not on the default branch yet.
170
248
  3. After each production deploy, CI runs `demo release`. It publishes each held demo whose script is unchanged in the deployed code and whose upload commit is part of the deploy, and reports the rest.
171
249
 
172
- An update to a guide that is already published is held the same way. The published guide stays exactly as it is until the release replaces it, then learners are asked to retrain as the upload's `--retraining` said. A video cannot be updated yet, so only a video's first upload can be held.
250
+ An update to a guide or video that is already published is held the same way. The published one stays exactly as it is until the release replaces it, then learners are asked to retrain as the upload's `--retraining` said. A video's new recording is processed while it is held, and replaces the current one once the release has published it and it has been brought into the knowledge base.
251
+
252
+ CI authenticates with a release token, which an administrator creates in Mereon under Settings, Release tokens, for this repository (the `source.repo` above). It belongs to the organization rather than a person, can only release this repository's held demos, and is never written anywhere by the tool.
253
+
254
+ With GitHub Actions, one command sets all of it up:
173
255
 
174
- CI authenticates with a release token, which an administrator creates in Mereon under Settings, Release tokens, for this repository (the `source.repo` above). Store it as a secret named `MEREON_RELEASE_TOKEN`. It belongs to the organization rather than a person, can only release this repository's held demos, and is never written anywhere by the tool.
256
+ ```sh
257
+ npx @mereon/demo ci setup
258
+ ```
175
259
 
176
- In GitHub Actions, after the job that deploys to production:
260
+ It finds the job that deploys to production (or the one you name with `--after <job>`), shows the job it adds after it as a diff, and writes it when you agree. It sets `release` to `ci`. Then it asks you to paste the release token, without showing it, checks it with Mereon, and stores it as the repository's `MEREON_RELEASE_TOKEN` Actions secret with `gh` (or says where to add it by hand). Run it again at any time: it skips what is already done, and asks before replacing a secret that is already set. A `MEREON_RELEASE_TOKEN` in your shell's environment is used instead of asking, and it says so; one that is not a release token, or that Mereon refuses, is set aside and you are asked to paste one. `--paste` asks even when the variable is set. A coding agent can add the job with `--yes`, but pasting the token is yours to do.
261
+
262
+ The job it adds, which you can also write yourself, in GitHub Actions or adapted to another CI:
177
263
 
178
264
  ```yaml
179
265
  release-demos:
266
+ name: Release demos
180
267
  needs: deploy-production
181
268
  runs-on: ubuntu-latest
269
+ permissions:
270
+ contents: read
182
271
  steps:
272
+ - name: Check for the release token
273
+ id: token
274
+ env:
275
+ MEREON_RELEASE_TOKEN: ${{ secrets.MEREON_RELEASE_TOKEN }}
276
+ run: |
277
+ if [ -z "$MEREON_RELEASE_TOKEN" ]; then
278
+ echo "::notice title=Demos not released::MEREON_RELEASE_TOKEN is not set, so no held demos were released. Run demo ci setup to set it."
279
+ echo "present=false" >> "$GITHUB_OUTPUT"
280
+ else
281
+ echo "present=true" >> "$GITHUB_OUTPUT"
282
+ fi
183
283
  - uses: actions/checkout@v4
284
+ if: steps.token.outputs.present == 'true'
184
285
  with:
286
+ ref: ${{ github.sha }} # what was deployed
185
287
  fetch-depth: 0 # release checks the upload commits against this history
186
288
  - uses: actions/setup-node@v4
289
+ if: steps.token.outputs.present == 'true'
187
290
  with:
188
291
  node-version: 24
189
- - run: npx @mereon/demo@<version> release
292
+ - name: Release held demos
293
+ if: steps.token.outputs.present == 'true'
294
+ run: npx --yes @mereon/demo@<version> release
190
295
  env:
191
296
  MEREON_RELEASE_TOKEN: ${{ secrets.MEREON_RELEASE_TOKEN }}
192
297
  ```
193
298
 
194
- `release` fails the step only when it cannot release at all (a missing or revoked token, a network error, a shallow checkout) or when a demo could not be published this time, which the next run retries. A demo whose script changed after it was recorded, that is still processing, or whose upload commit is no longer in the repository's history (the default branch was force-pushed), is reported and left held, and the others are released. `--strict` fails on those too, and `--dry-run` reports what would happen without publishing anything, which is how to check a new token. `release` refuses to publish from a pull request build, because a pull request opened after the merge contains everything a release looks for.
299
+ It has no `environment`, so it runs without asking the production environment's reviewers a second time, and that is why the token is a repository secret rather than an environment's. It skips with a notice while the secret is not set, so a deploy never fails for want of it. In a workflow started by another (`workflow_run`), check out `${{ github.event.workflow_run.head_sha }}` instead.
300
+
301
+ `release` fails the step only when it cannot release at all (a missing or revoked token, a network error, a shallow checkout) or when a demo could not be published this time, which the next run retries. A demo whose script changed after it was recorded, that is still processing, or whose upload commit is no longer in the repository's history (the default branch was force-pushed), is reported and left held, and the others are released. `--strict` fails on those too, and `--dry-run` reports what would happen without publishing anything, which is how to check a new token. Every run says which repository and organization the token releases for, and checks it with Mereon even before the repository has any scripts. `release` refuses to publish from a pull request build, because a pull request opened after the merge contains everything a release looks for.
195
302
 
196
303
  ## Announcing a demo
197
304
 
@@ -219,13 +326,13 @@ An announcement tells people about a screen they need to have, so make it once t
219
326
  The tool sends something only when you run a command, and there is no telemetry and no update check. What it sends goes to Mereon: its API at `api.mereon.ai`, and Mereon's file storage at the signed addresses the API gives it for each upload and download.
220
327
 
221
328
  - `login` opens Mereon in your browser and keeps the tokens Mereon issues for you. Logos and the brand's font files come from Mereon too, so a branded demo needs no font service of its own.
222
- - An upload sends the screenshots and narration, or the video, to your organization. A guide's steps also carry each page's path and title and what identifies the element acted on (its id, `aria-label`, `name`, `title` and role), and every upload carries its source key (`repo#script-id`). An upload held for a release also sends the commit it was made from and a hash of its script.
329
+ - An upload sends the screenshots and narration, or the video, to your organization. A guide's or video's steps also carry each page's path and title, a video step's label, what identifies the element acted on (its id, `aria-label`, `name`, `title`, role and `data-mereon-anchor`), and the selected tab's `data-mereon-anchor`, and every upload carries its source key (`repo#script-id`). `steps` sends a video's steps alone. An upload held for a release also sends the commit it was made from and a hash of its script.
223
330
  - Narration text goes to Mereon, which turns it into speech with ElevenLabs. With your own ElevenLabs key, the text goes straight to ElevenLabs under your own account instead, and never through Mereon.
224
331
  - `audience` reads your organization's role and team names, and `tags`, and a `record` or upload whose script names tags, read its tag names. `announce` sends the announcement's text and who it is for.
225
332
 
226
333
  Two other places are contacted. The first `record` downloads Chromium with Playwright's own installer, from Playwright's download servers, and a recording opens the app you are demoing, which is one served from your own machine unless you say otherwise. Your coding agent reads what the tool prints, so the role and team names from `audience`, like the rest of its output, reach whichever model your agent uses.
227
334
 
228
- `announce` keeps a note of the announcement it started beside the recording, in `demo/out/<script-id>/video/announcement.json`, which is not committed. Your Mereon sign-ins and any ElevenLabs key are stored in `~/.config/mereon/`, in files only you can read, and are never written to your project.
335
+ `announce` keeps a note of the announcement it started beside the recording, in `demo/out/<script-id>/video/announcement.json`, which is not committed. Sessions saved with `auth capture` stay in `demo/.auth/`, which is not committed either, and are never printed or sent anywhere. Your Mereon sign-ins and any ElevenLabs key are stored in `~/.config/mereon/`, in files only you can read, and are never written to your project.
229
336
 
230
337
  `logout` signs you out of one organization: it hands that organization's grants back to Mereon and removes them here, and leaves your other organizations and your ElevenLabs key as they are. To remove everything, run `logout --all`, which signs you out of every organization and deletes both credentials files, your ElevenLabs key included. `logout --elevenlabs` forgets only the key. If Mereon cannot be reached, signing out still removes the grants here and names the ones that were not revoked, and you can end those from your connected apps in the web app. None of these touches what is in your projects, such as `demo/.secrets`, or an `ELEVENLABS_API_KEY` you set in your environment.
231
338