Skip to content

Install

There are two ways in. The init CLI sets up Vitest or Playwright in one command. Every other adapter takes about two minutes by hand.

Run this in your project root:

Terminal window
npm create executable-stories@latest

The CLI reads your project, works out your package manager and workspace layout, asks two or three questions, and writes the adapter, the reporter config, a sample story, and your package.json scripts.

  1. It tells you what it found. Package manager, TypeScript, monorepo layout.

    ◆ executable-stories
    │ package manager: pnpm
    │ typescript: yes
    │ monorepo: yes (3 workspace packages)
  2. You pick the target packages. Monorepos only. A single-package repo skips this.

  3. You pick a framework. Vitest for unit and integration tests, Playwright for end-to-end. Anything already in devDependencies is flagged and left alone.

  4. You approve the plan. Nothing is written until you confirm. The CLI lists every package it will install, every file it will create, and every script it will patch.

Then run your tests:

Terminal window
npm test
open reports/executable-stories.html

You get one passing story and two files in reports/. Open executable-stories.html in a browser. Commit executable-stories.md next to your code.

Report Outputwhat this code generatesOpen live report ↗
The generated HTML report: run summary, search and status filters, and a passing scenario with Given/When/Then steps, code, and a table
This is executable-stories.html from the test you just ran. Search it, filter it, toggle dark mode. Click to open the live one.

On Playwright, install the browser binaries too:

Terminal window
npx playwright install
  • Node.js 22+
  • TypeScript 5.6+
  • Vitest 3+
  • Jest 29+
  • Playwright 1.45+
  • Cypress 13+
  • pnpm 9+
  • npm 10+
  • Yarn 4+

Non-JavaScript adapters have their own floors: Go 1.22, Python 3.12, Rust 1.85 (edition 2024), Java 21 with JUnit 5.12, and the .NET 10 SDK with xUnit v3.

Pick your framework. The choice follows you across the rest of the docs.

Terminal window
pnpm add -D vitest executable-stories-vitest executable-stories-formatters

In vitest.config.ts, import the reporter from the /reporter subpath:

import { StoryReporter } from 'executable-stories-vitest/reporter';
import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
reporters: ['default', new StoryReporter()],
},
});

With no options the reporter writes reports/index.html and keeps one canonical report per test source under reports/by-file/. For Markdown instead, pass formats: ['markdown'], outputDir: 'docs', and outputName: 'user-stories'. See Vitest reporter options.

Terminal window
pnpm vitest run

The prompts cover everything, so most people never touch these. For CI and agents:

Flag Effect
--vitest / --playwright / --both Choose frameworks without prompting
--target <pkg...> Set up specific workspace packages. Pass root for the repo root
--ts / --no-ts Write a minimal tsconfig.json if one is missing
--yes, -y Accept defaults and suppress prompts
--dry-run Print the plan without writing or installing
--json Emit a machine-readable plan and result. Implies --yes
--force Overwrite existing config files that differ
--interactive Force prompts even when stdin is piped

Non-interactive Vitest setup in a CI script:

Terminal window
pnpm create executable-stories@latest --vitest --yes

Preview a monorepo change without touching anything:

Terminal window
pnpm dlx executable-stories-init --both --target apps/web --dry-run

Per framework, the CLI adds these to your target’s devDependencies, skipping anything already installed at any version:

Framework Packages
Vitest vitest, executable-stories-vitest, executable-stories-formatters
Playwright @playwright/test, executable-stories-playwright, executable-stories-formatters

The init CLI auto-installs Vitest and Playwright only. Everything else uses the manual setup above.

If Vitest or Playwright is installed but the CLI missed it, check that the package sits in your target’s own devDependencies rather than a parent workspace package’s dependencies.

You already have a vitest.config.ts or playwright.config.ts, and the CLI will not clobber it. Either copy the reporter block from the manual setup above into your existing config, or re-run with --force and lose what you had.

Monorepo: it set things up in the wrong package

Section titled “Monorepo: it set things up in the wrong package”

Running --yes in a monorepo without --target defaults to the repo root. Re-run with --target apps/web, or just --target web when the name is unambiguous.

Pass --json for a parseable plan and result:

Terminal window
pnpm dlx executable-stories-init --vitest --target apps/web --yes --json

You get one JSON object: { ok, plan: { ops, summary }, result: { written, installed, patched, skipped, notes } }.

For agents that cannot run the CLI, the executable-stories-init skill hands them the same checklist the CLI follows.

Almost always a network problem or a missing pnpm-lock.yaml. Run the install yourself to see the real error: cd <target> && pnpm install. Fix it, then re-run the init CLI.