@plaintake/scenario
v1.30.0
Published
Authoring SDK for PlainTake demo scenarios: defineDemo and the scenario DSL types. Install for editor autocomplete; the PlainTake binary ships a runtime fallback.
Readme
@plaintake/scenario
The authoring SDK for PlainTake demo scenarios:
defineDemo and the scenario DSL types used to write *.demo.ts files that the PlainTake
CLI records into a video.
Do you need to install this?
No, strictly speaking. The PlainTake binary already ships a runtime fallback for
@plaintake/scenario, so a scenario file's import { defineDemo } from '@plaintake/scenario'
resolves and runs with nothing installed at all.
What this package buys you is editor autocomplete and typechecking while you write a
scenario: real types for defineDemo's input, DemoContext, DemoStep, and the rest of the
DSL, instead of an untyped any.
If you do install it, your copy is what actually gets used — module resolution tries your
project's own node_modules first, and only falls back to the binary's built-in copy when
that lookup fails. Nothing is overridden or shadowed; it is simply resolved before the
fallback is ever consulted.
Install
npm install --save-dev @plaintake/scenarioUsage
// login.demo.ts
import { defineDemo } from '@plaintake/scenario';
export default defineDemo({
schema: 'agent-demo.scenario/v1',
id: 'sign-in',
title: 'Sign in to the dashboard',
viewport: { width: 1920, height: 1080, deviceScaleFactor: 1 },
locale: 'en-US',
timezoneId: 'UTC',
colorScheme: 'light',
reducedMotion: 'reduce',
async run({ page, demo, baseURL }) {
await page.goto(baseURL);
await demo.step({
id: 'submit',
title: 'Submit the sign-in form',
target: page.getByRole('button', { name: 'Sign in' }),
action: 'click',
run: () => page.getByRole('button', { name: 'Sign in' }).click(),
});
},
});The PlainTake CLI discovers and records files matching *.demo.ts. See the
scenario guide for the full DSL — chapters,
assertions, masks, waits, and handoffs to a person for steps PlainTake cannot perform itself
(entering a one-time code, for example).
A scenario can also declare terminal to record a live command-line program (run is then
handed a term with run, type, press, waitForText and friends), and with
terminal.browser: true it can take turns between the terminal and a web app:
demo.turn(term.actor) and demo.turn(web) switch with a hard cut by default, and
demo.turn(actor, { card }) or { card: false } decides per turn. See the scenario guide.
For TikTok and YouTube Shorts, a scenario can declare a hook — '3 PDFs → 1, free' or
{ text, durationMs } — drawn above the picture for the video's first seconds when it is
recorded with --for tiktok or --for shorts. One or two lines; emoji are drawn as outlines.
Licence
This package (@plaintake/scenario) is MIT licensed — see LICENSE.
That covers only the authoring SDK. PlainTake itself — the CLI/binary that records and renders the video — is separate, proprietary software; installing this package does not grant any rights to it. See the PlainTake licence for those terms.
