@navipartner/demo-video 0.4.0 → 0.5.1

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.
package/README.md CHANGED
@@ -1,109 +1,128 @@
1
- # @navipartner/demo-video
2
-
3
- Marketing demo videos of a React app, filmed by Playwright on the app's own
4
- e2e mocks, in the NaviPartner house look, with any customer's brand. For
5
- pnpm repos on GitHub Actions.
6
-
7
- ## Setup
8
-
9
- The package is public on npm, so nothing needs a token or registry setup.
10
-
11
- ### Once per project repo
12
-
13
- From the repo root:
14
-
15
- npx --ignore-scripts @navipartner/demo-video init
16
-
17
- It sets up `.gitignore`, the skill, the `demo video` label and
18
- `.github/workflows/demo-video.yml`. Safe to re-run; `--dry-run` previews.
19
- (`--ignore-scripts` skips downloading ffmpeg, which `init` doesn't need.)
20
-
21
- ### Per app
22
-
23
- npx --ignore-scripts @navipartner/demo-video init --app apps/<name>
24
- pnpm install
25
-
26
- Then ask Claude for a demo video of the app. It finishes
27
- `demo/demo.config.ts` from the e2e tests and writes the app's primary story.
28
- The app needs `@playwright/test` 1.59 or later.
29
-
30
- ## Getting a video
31
-
32
- | Way | Who | Films | Where the video lands |
33
- |---|---|---|---|
34
- | **Run workflow form:** Actions → Demo video → Run workflow; fill in App, Story, Brand (each may be empty) | anyone who can write to the repo | an existing story with a brand, from the branch chosen | the run's Summary page |
35
- | **PR comment:** `/demo-video checkout in acme branding` | members, on any PR | an existing story with a brand, from the PR's branch | a reply on the PR |
36
- | **The `demo video` label** on a PR | whoever labels it | every story the PR adds or changes, on every push | a comment on the PR |
37
- | **Locally:** `pnpm --dir apps/<name> exec demo-video render [--story <name>] [--brand <name>]` | a developer | any story | `demo/out/` |
38
-
39
- - An empty story means the app's primary story; an empty brand, the app's
40
- default. A request that doesn't name one existing story, or names a brand
41
- that doesn't exist, gets the list of stories and brands instead (the form
42
- run is then marked failed, so a typo is noticed).
43
- - The form and the comment only choose: they never write or change a story.
44
- New stories are written by a developer, locally (ask Claude, which uses
45
- the skill), and reviewed through the label. A PR has no default video.
46
-
47
- ## Stories and brands
48
-
49
- - **Stories** are `<app>/demo/stories/<name>.json`, built only from what the
50
- e2e mocks return. One per app is `"primary": true`: the journey the app
51
- exists for.
52
- - **Variants** (`checkout.acme.json`) are a story in a customer's words:
53
- the base story's steps, with its own title, closing and card text, filmed
54
- with one brand. Asking for the story in that brand films the variant.
55
- - **Brands** are `<app>/demo/brands/<name>.json` plus a folder of assets;
56
- the engine ships `navipartner`, the default.
57
-
58
- Claude writes both with the skill (`skills/np-demo-video/`), which also holds
59
- the look and every field.
60
-
61
- ## Commands
62
-
63
- Run in the app: `pnpm --dir apps/<name> exec demo-video <command>`.
64
-
65
- | Command | |
66
- |---|---|
67
- | `list` | The stories, primary first. |
68
- | `check` | Dry run in seconds. Fails on anything that would film badly (a zoom on the wrong area, a click whose result is off-screen, code or unproven numbers on a card) and names the step. |
69
- | `render` | Films the story frame by frame (60 fps, about 5× its length) to `demo/out/<story>-<brand>-demo.mp4`, with a contact sheet (`review/sheet.jpg`, one frame a second) and ten stills. |
70
- | `record`, `encode`, `stills` | `render` in parts: record only, encode the last take, redo the stills. |
71
-
72
- `--story <name>` (default: primary), `--brand <name>` (default:
73
- `navipartner`), `--draft` (`render` at 30 fps in about half the time, while
74
- tuning), `--json` (machine-readable output).
75
-
76
- ## Developing and releasing
77
-
78
- pnpm install
79
- pnpm test && pnpm typecheck && pnpm build
80
-
81
- **Release:** bump `version` in `package.json` on `main`, then
82
- `git tag vX.Y.Z && git push origin vX.Y.Z`. That publishes it to npm as
83
- `latest` and moves the `v0` tag, which every project's workflow follows.
84
- Running `release.yml` by hand publishes a `next` prerelease.
85
-
86
- **The first release, once, by an npm owner of the `navipartner` org:**
87
- trusted publishing can only be set up for a package that exists.
88
-
89
- 1. On main at the release commit: `pnpm install && pnpm pack`, then
90
- `node scripts/check-public.mjs navipartner-demo-video-*.tgz`.
91
- 2. `npm login`, then `npm publish navipartner-demo-video-*.tgz --access public`.
92
- 3. On npmjs.com, the package → Settings → Trusted publisher: GitHub Actions,
93
- repository `navipartner/demo-video`, workflow `release.yml`. Then set
94
- "Publishing access" to require trusted publishing (no tokens).
95
- 4. Push the tag as usual: `release.yml` sees the version is already on npm,
96
- skips publishing and moves `v0`.
97
-
98
- The package is public; this repo is not. `release.yml` publishes through npm
99
- trusted publishing (no npm token is stored), and only after
100
- `scripts/check-public.mjs` has checked the tarball: only the allowed files,
101
- no source maps, nothing shaped like a secret, an email or a local path. CI
102
- runs the same check on every PR. Names it can't catch: keep customers and
103
- people out of the skill and the README.
104
-
105
- Projects get a new CLI only with `pnpm up -r --latest @navipartner/demo-video`
106
- (their lockfile pins it), but their workflow follows `v0` at once. So
107
- `render.yml` and `request.yml` must work with every CLI
108
- from 0.4 (older ones get a reply asking for the update); a change that
109
- can't is `v1`.
1
+ # @navipartner/demo-video
2
+
3
+ Marketing demo videos of React apps.
4
+
5
+ - Filmed on the app's own e2e mocks.
6
+ - NaviPartner look: camera pushes, serif cards.
7
+ - Any customer's brand, chosen per video.
8
+ - Smooth 60 fps, frame by frame.
9
+ - pnpm repos, GitHub Actions, `@playwright/test` 1.59+.
10
+
11
+ ## Setup
12
+
13
+ npx --ignore-scripts @navipartner/demo-video init
14
+ pnpm install
15
+
16
+ - Adds the skill, label and workflow.
17
+ - Finds apps with a `playwright.config`.
18
+ - One app: set up directly.
19
+ - Several apps: `init --app <folder>` each.
20
+ - Safe to re-run; `--dry-run` previews.
21
+ - Then ask Claude for a video.
22
+
23
+ ## Get a video
24
+
25
+ | Ask | Who | You get |
26
+ |---|---|---|
27
+ | @Linear "video of checkout from np-pos for Acme" | Linear users | that story in Acme's brand, attached |
28
+ | @Linear "pitch draft of checkout for Northwind (northwind.example)" | Linear users | a researched brand, attached |
29
+ | `/demo-video` on a PR | members | primary story, from the PR branch |
30
+ | `/demo-video checkout in acme branding` | members | that story, that brand |
31
+ | `/demo-video help` | members | menu of stories and brands |
32
+ | `demo video` label on a PR | whoever labels | every changed story, each push |
33
+ | Actions → Demo video → Run workflow | repo writers | any story, any branch |
34
+ | `pnpm exec demo-video render` | developers | any story, locally |
35
+
36
+ - Requests only pick existing stories.
37
+ - New stories come via PRs.
38
+ - PR comments: first line is the request.
39
+ - Unknown names get the menu.
40
+
41
+ ### In Linear
42
+
43
+ - Ask @Linear in plain words.
44
+ - Name the repo, story and customer.
45
+ - Follows the skill's `linear.md`.
46
+ - Brand in the repo: 60 fps video.
47
+ - No brand yet: a pitch draft.
48
+ - MP4 and contact sheet attached.
49
+ - Nothing committed, nothing kept.
50
+ - Linear AI credits, no API key.
51
+ - Slow sandbox: ~15× video length.
52
+
53
+ ### Pitch drafts
54
+
55
+ - @Linear researches the customer's own website.
56
+ - Brand checked, then filmed at 30 fps.
57
+ - Google Fonts stand-ins only.
58
+ - That customer only; check before sending.
59
+
60
+ ## Stories and brands
61
+
62
+ - **Story:** `demo/stories/<name>.json`, scenes as JSON.
63
+ - Built only from the mocks.
64
+ - One story per app is primary.
65
+ - **Variant:** `checkout.acme.json`, customer's own words.
66
+ - **Brand:** `demo/brands/<name>.json` plus assets.
67
+ - `navipartner` ships as the default.
68
+ - **Brand needs:** the adapter lists what brands need.
69
+ - Missing needs fail `check`.
70
+ - Customer brands need customer permission.
71
+ - The skill has fields and the look.
72
+
73
+ ## Commands
74
+
75
+ Run in the app's folder: `pnpm exec demo-video <command>`.
76
+
77
+ | Command | Does |
78
+ |---|---|
79
+ | `init` | sets up a repo or app |
80
+ | `list` | stories, primary first |
81
+ | `check` | dry run in seconds, names problems |
82
+ | `render` | MP4, contact sheet, ten stills |
83
+ | `record` / `encode` / `stills` | render in parts |
84
+ | `brand-needs` | what a brand must give |
85
+ | `pitch <proposal.json>` | pitch draft from a researched brand |
86
+ | `pick` | what a request means (workflows) |
87
+
88
+ | Flag | Means |
89
+ |---|---|
90
+ | `--story <name>` | default: primary story |
91
+ | `--brand <name>` | default: `navipartner` |
92
+ | `--draft` | 30 fps, twice as fast |
93
+ | `--brands <dir>` | extra brands folder, searched first |
94
+ | `--app <dir>` | app folder, default `.` |
95
+ | `--json` | machine-readable output |
96
+
97
+ Output lands in `demo/out/`. Failures keep Playwright's output in `demo/out/failed/`.
98
+
99
+ ## Develop
100
+
101
+ pnpm install
102
+ pnpm test && pnpm typecheck && pnpm lint && pnpm build
103
+
104
+ - CI runs tests, actionlint, smoke render.
105
+
106
+ ## Release
107
+
108
+ 1. Bump `version` on main.
109
+ 2. `git tag vX.Y.Z && git push origin vX.Y.Z`.
110
+
111
+ - CI publishes to npm (`latest`).
112
+ - Trusted publishing, no npm token.
113
+ - `v0` tag moves along.
114
+ - Manual `release.yml` run: `next` prerelease.
115
+
116
+ ## Public package, private repo
117
+
118
+ - `check-public.mjs` checks every tarball.
119
+ - Allowed files only, no source maps.
120
+ - No secrets, emails or local paths.
121
+ - Names aren't caught: keep customers out.
122
+
123
+ ## Compatibility
124
+
125
+ - Projects pin the CLI version.
126
+ - Their workflows follow `v0` immediately.
127
+ - Workflows must support CLI 0.4+.
128
+ - Breaking that means `v1`.
package/bin/args.d.mts CHANGED
@@ -1,30 +1,39 @@
1
- export interface DemoArgs {
2
- command: "check" | "render" | "record" | "encode" | "stills" | "list";
3
- appDir: string;
4
- demoDir: string;
5
- adapterPath: string;
6
- workDir: string;
7
- runnerDir: string;
8
- configPath: string;
9
- outDir: string;
10
- storyboardPath: string | null;
11
- brand: string | null;
12
- json: boolean;
13
- draft: boolean;
14
- }
15
- export const COMMANDS: readonly string[];
16
- export function parseArgs(argv: string[], cwd: string): DemoArgs;
17
- export interface StoryEntry {
18
- name: string;
19
- description: string | null;
20
- primary: boolean;
21
- /** A variant: the story it extends, and the brand it is for. */
22
- extends?: string;
23
- brand?: string | null;
24
- }
25
- export function listStories(demoDir: string): StoryEntry[];
26
- export function resolveStoryboard(
27
- value: string,
28
- cwd: string,
29
- demoDir: string,
30
- ): string;
1
+ export interface DemoArgs {
2
+ command:
3
+ | "check"
4
+ | "render"
5
+ | "record"
6
+ | "encode"
7
+ | "stills"
8
+ | "list"
9
+ | "brand-needs";
10
+ appDir: string;
11
+ demoDir: string;
12
+ adapterPath: string;
13
+ workDir: string;
14
+ runnerDir: string;
15
+ configPath: string;
16
+ outDir: string;
17
+ storyboardPath: string | null;
18
+ brand: string | null;
19
+ /** `--brands`: a brands folder outside the repo, searched first. */
20
+ brandsDir: string | null;
21
+ json: boolean;
22
+ draft: boolean;
23
+ }
24
+ export const COMMANDS: readonly string[];
25
+ export function parseArgs(argv: string[], cwd: string): DemoArgs;
26
+ export interface StoryEntry {
27
+ name: string;
28
+ description: string | null;
29
+ primary: boolean;
30
+ /** A variant: the story it extends, and the brand it is for. */
31
+ extends?: string;
32
+ brand?: string | null;
33
+ }
34
+ export function listStories(demoDir: string): StoryEntry[];
35
+ export function resolveStoryboard(
36
+ value: string,
37
+ cwd: string,
38
+ demoDir: string,
39
+ ): string;
package/bin/args.mjs CHANGED
@@ -1,153 +1,158 @@
1
- import fs from "node:fs";
2
- import path from "node:path";
3
-
4
- export const COMMANDS = [
5
- "check",
6
- "render",
7
- "record",
8
- "encode",
9
- "stills",
10
- "list",
11
- ];
12
- const NEEDS_STORYBOARD = new Set(["check", "render", "record"]);
13
- const USAGE = `Usage: demo-video <${COMMANDS.join("|")}> [--app <dir>] [--story <name|file.json>] [--brand <name>] [--draft] [--json]
14
- Without --story, check, render and record use the app's primary story.
15
- --draft renders at 30 fps (about half the time) to iterate on a story.
16
- Setup: demo-video init [--app <dir>] [--dry-run]
17
- For a /demo-video request: demo-video pick --request "<text>" [--json] <app dir>...`;
18
-
19
- export const resolveStoryboard = (value, cwd, demoDir) => {
20
- if (value.endsWith(".json")) {
21
- const file = path.resolve(cwd, value);
22
- if (!fs.existsSync(file)) {
23
- throw new Error(`Story file ${file} does not exist`);
24
- }
25
- return file;
26
- }
27
- const dir = path.join(demoDir, "stories");
28
- const file = path.join(dir, `${value}.json`);
29
- if (!fs.existsSync(file)) {
30
- const known = fs.existsSync(dir)
31
- ? fs
32
- .readdirSync(dir)
33
- .filter((f) => f.endsWith(".json"))
34
- .map((f) => f.slice(0, -".json".length))
35
- : [];
36
- throw new Error(
37
- `No story "${value}" in ${dir}. Known: ${known.join(", ") || "(none)"}`,
38
- );
39
- }
40
- return file;
41
- };
42
-
43
- /**
44
- * The app's stories, primary first, then by name. Reads only `description`
45
- * and `primary`: the full check needs the adapter and runs in `check`.
46
- */
47
- export const listStories = (demoDir) => {
48
- const dir = path.join(demoDir, "stories");
49
- if (!fs.existsSync(dir)) {
50
- return [];
51
- }
52
- const stories = fs
53
- .readdirSync(dir)
54
- .filter((f) => f.endsWith(".json"))
55
- .map((f) => {
56
- const story = JSON.parse(fs.readFileSync(path.join(dir, f), "utf8"));
57
- return {
58
- name: f.slice(0, -".json".length),
59
- description: story.description ?? null,
60
- primary: story.primary === true,
61
- // A variant: the base story's flow, for one brand.
62
- ...(story.extends
63
- ? { extends: story.extends, brand: story.brand ?? null }
64
- : {}),
65
- };
66
- })
67
- .sort(
68
- (a, b) =>
69
- Number(b.primary) - Number(a.primary) || a.name.localeCompare(b.name),
70
- );
71
- const primaries = stories.filter((s) => s.primary).map((s) => s.name);
72
- if (primaries.length > 1) {
73
- throw new Error(
74
- `Only one story can be primary; ${primaries.join(", ")} all are (in ${dir})`,
75
- );
76
- }
77
- return stories;
78
- };
79
-
80
- export const parseArgs = (argv, cwd) => {
81
- const [command, ...rest] = argv;
82
- if (!COMMANDS.includes(command)) {
83
- throw new Error(USAGE);
84
- }
85
- const opts = {
86
- app: ".",
87
- story: undefined,
88
- brand: undefined,
89
- json: false,
90
- draft: false,
91
- };
92
- for (let i = 0; i < rest.length; i++) {
93
- const arg = rest[i];
94
- if (arg === "--json") {
95
- opts.json = true;
96
- } else if (arg === "--draft") {
97
- opts.draft = true;
98
- } else if (["--app", "--story", "--brand"].includes(arg)) {
99
- const value = rest[++i];
100
- if (!value) {
101
- throw new Error(`${arg} needs a value`);
102
- }
103
- opts[arg.slice(2)] = value;
104
- } else {
105
- throw new Error(`Unknown option ${arg}\n${USAGE}`);
106
- }
107
- }
108
- const appDir = path.resolve(cwd, opts.app);
109
- const demoDir = path.join(appDir, "demo");
110
- const adapterPath = path.join(demoDir, "demo.config.ts");
111
- if (!fs.existsSync(adapterPath)) {
112
- throw new Error(`No demo adapter: expected ${adapterPath}`);
113
- }
114
- // Everything a run needs only while it runs (the generated Playwright
115
- // config and spec, the check report, the raw recording, Playwright's
116
- // results) goes here, inside demo/out/ (gitignored), and is deleted when
117
- // the command ends. Only a failure's results are kept, in demo/out/failed/.
118
- // `check` has its own folder, so it never touches the take that `record`
119
- // leaves for `encode`.
120
- const workDir = path.join(
121
- demoDir,
122
- "out",
123
- ".work",
124
- command === "check" ? "check" : "take",
125
- );
126
- const runnerDir = path.join(workDir, "runner");
127
- let storyboardPath = null;
128
- if (NEEDS_STORYBOARD.has(command)) {
129
- // No --story: the app's primary story, its main journey.
130
- const story =
131
- opts.story ?? listStories(demoDir).find((s) => s.primary)?.name;
132
- if (!story) {
133
- throw new Error(
134
- `No --story given and no primary story in ${path.join(demoDir, "stories")}. Name one with --story, or mark the app's main journey "primary": true.`,
135
- );
136
- }
137
- storyboardPath = resolveStoryboard(story, cwd, demoDir);
138
- }
139
- return {
140
- command,
141
- appDir,
142
- demoDir,
143
- adapterPath,
144
- workDir,
145
- runnerDir,
146
- configPath: path.join(runnerDir, "playwright.config.mjs"),
147
- outDir: path.join(demoDir, "out"),
148
- storyboardPath,
149
- brand: opts.brand ?? null,
150
- json: opts.json,
151
- draft: opts.draft,
152
- };
153
- };
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+
4
+ export const COMMANDS = [
5
+ "check",
6
+ "render",
7
+ "record",
8
+ "encode",
9
+ "stills",
10
+ "list",
11
+ "brand-needs",
12
+ ];
13
+ const NEEDS_STORYBOARD = new Set(["check", "render", "record"]);
14
+ const USAGE = `Usage: demo-video <${COMMANDS.join("|")}> [--app <dir>] [--story <name|file.json>] [--brand <name>] [--brands <dir>] [--draft] [--json]
15
+ Without --story, check, render and record use the app's primary story.
16
+ --draft renders at 30 fps (about half the time) to iterate on a story.
17
+ --brands adds a brands folder outside the repo, searched first.
18
+ brand-needs: what a brand must give this app (its adapter's brandNeeds).
19
+ Setup: demo-video init [--app <dir>] [--dry-run]
20
+ For a /demo-video request: demo-video pick --request "<text>" [--json] <app dir>...
21
+ For a pitch draft (the skill's linear.md): demo-video pitch <proposal.json> [--app <dir>] [--story <name>] [--out <dir>] [--json]`;
22
+
23
+ export const resolveStoryboard = (value, cwd, demoDir) => {
24
+ if (value.endsWith(".json")) {
25
+ const file = path.resolve(cwd, value);
26
+ if (!fs.existsSync(file)) {
27
+ throw new Error(`Story file ${file} does not exist`);
28
+ }
29
+ return file;
30
+ }
31
+ const dir = path.join(demoDir, "stories");
32
+ const file = path.join(dir, `${value}.json`);
33
+ if (!fs.existsSync(file)) {
34
+ const known = fs.existsSync(dir)
35
+ ? fs
36
+ .readdirSync(dir)
37
+ .filter((f) => f.endsWith(".json"))
38
+ .map((f) => f.slice(0, -".json".length))
39
+ : [];
40
+ throw new Error(
41
+ `No story "${value}" in ${dir}. Known: ${known.join(", ") || "(none)"}`,
42
+ );
43
+ }
44
+ return file;
45
+ };
46
+
47
+ /**
48
+ * The app's stories, primary first, then by name. Reads only `description`
49
+ * and `primary`: the full check needs the adapter and runs in `check`.
50
+ */
51
+ export const listStories = (demoDir) => {
52
+ const dir = path.join(demoDir, "stories");
53
+ if (!fs.existsSync(dir)) {
54
+ return [];
55
+ }
56
+ const stories = fs
57
+ .readdirSync(dir)
58
+ .filter((f) => f.endsWith(".json"))
59
+ .map((f) => {
60
+ const story = JSON.parse(fs.readFileSync(path.join(dir, f), "utf8"));
61
+ return {
62
+ name: f.slice(0, -".json".length),
63
+ description: story.description ?? null,
64
+ primary: story.primary === true,
65
+ // A variant: the base story's flow, for one brand.
66
+ ...(story.extends
67
+ ? { extends: story.extends, brand: story.brand ?? null }
68
+ : {}),
69
+ };
70
+ })
71
+ .sort(
72
+ (a, b) =>
73
+ Number(b.primary) - Number(a.primary) || a.name.localeCompare(b.name),
74
+ );
75
+ const primaries = stories.filter((s) => s.primary).map((s) => s.name);
76
+ if (primaries.length > 1) {
77
+ throw new Error(
78
+ `Only one story can be primary; ${primaries.join(", ")} all are (in ${dir})`,
79
+ );
80
+ }
81
+ return stories;
82
+ };
83
+
84
+ export const parseArgs = (argv, cwd) => {
85
+ const [command, ...rest] = argv;
86
+ if (!COMMANDS.includes(command)) {
87
+ throw new Error(USAGE);
88
+ }
89
+ const opts = {
90
+ app: ".",
91
+ story: undefined,
92
+ brand: undefined,
93
+ json: false,
94
+ draft: false,
95
+ };
96
+ for (let i = 0; i < rest.length; i++) {
97
+ const arg = rest[i];
98
+ if (arg === "--json") {
99
+ opts.json = true;
100
+ } else if (arg === "--draft") {
101
+ opts.draft = true;
102
+ } else if (["--app", "--story", "--brand", "--brands"].includes(arg)) {
103
+ const value = rest[++i];
104
+ if (!value) {
105
+ throw new Error(`${arg} needs a value`);
106
+ }
107
+ opts[arg.slice(2)] = value;
108
+ } else {
109
+ throw new Error(`Unknown option ${arg}\n${USAGE}`);
110
+ }
111
+ }
112
+ const appDir = path.resolve(cwd, opts.app);
113
+ const demoDir = path.join(appDir, "demo");
114
+ const adapterPath = path.join(demoDir, "demo.config.ts");
115
+ if (!fs.existsSync(adapterPath)) {
116
+ throw new Error(`No demo adapter: expected ${adapterPath}`);
117
+ }
118
+ // Everything a run needs only while it runs (the generated Playwright
119
+ // config and spec, the check report, the raw recording, Playwright's
120
+ // results) goes here, inside demo/out/ (gitignored), and is deleted when
121
+ // the command ends. Only a failure's results are kept, in demo/out/failed/.
122
+ // `check` has its own folder, so it never touches the take that `record`
123
+ // leaves for `encode`.
124
+ const workDir = path.join(
125
+ demoDir,
126
+ "out",
127
+ ".work",
128
+ command === "check" || command === "brand-needs" ? command : "take",
129
+ );
130
+ const runnerDir = path.join(workDir, "runner");
131
+ let storyboardPath = null;
132
+ if (NEEDS_STORYBOARD.has(command)) {
133
+ // No --story: the app's primary story, its main journey.
134
+ const story =
135
+ opts.story ?? listStories(demoDir).find((s) => s.primary)?.name;
136
+ if (!story) {
137
+ throw new Error(
138
+ `No --story given and no primary story in ${path.join(demoDir, "stories")}. Name one with --story, or mark the app's main journey "primary": true.`,
139
+ );
140
+ }
141
+ storyboardPath = resolveStoryboard(story, cwd, demoDir);
142
+ }
143
+ return {
144
+ command,
145
+ appDir,
146
+ demoDir,
147
+ adapterPath,
148
+ workDir,
149
+ runnerDir,
150
+ configPath: path.join(runnerDir, "playwright.config.mjs"),
151
+ outDir: path.join(demoDir, "out"),
152
+ storyboardPath,
153
+ brand: opts.brand ?? null,
154
+ brandsDir: opts.brands ? path.resolve(cwd, opts.brands) : null,
155
+ json: opts.json,
156
+ draft: opts.draft,
157
+ };
158
+ };