Skip to content

Installation

Create a new experiment

Run the create command with your project name:

bash
npx create-experiment my-experiment

The CLI guides you through a series of prompts, then generates a complete project, installs dependencies, and optionally runs Playwright setup and a smoke test.

CLI prompts

PromptDefaultWhat it controls
Select boilerplateminimalWhich template to use. minimal generates a button with no API integration. product-card includes Samsung product API helpers and a Preact card.
Number of variations1Generates src/js/v1/ through src/js/vN/. Pick 2 for A/B, 3 for A/B/C.
Window namespacesgdThe IIFE output name on window (e.g. window.sgd). Must be a valid JS identifier. Keep the default unless it conflicts with another experiment on the same page.
Include emergency braketrueRecords includeEmergencyBrake in experiment.config.js. The current build/runtime does not consume this field, so verify the deployment integration before relying on it.
Enable E2E testingfalseGenerates e2e/, playwright.config.js, and wires up pnpm test:e2e. Enable if you have a stable preview URL to test against.
Base URL (E2E only)https://samsung.comThe root URL for Playwright tests.
Market (E2E only)-Selects which Samsung market(s) to parametrise tests against. See the Markets reference.
Run smoke test (E2E only)falseRuns pnpm build and pnpm test:e2e immediately after setup.

After scaffolding

The CLI prints the next steps. Start developing immediately:

bash
cd my-experiment

# Watch variation 1 - rebuilds on save and copies IIFE to clipboard
pnpm start 0

Open Adobe Target, navigate to your experiment's custom code editor, and paste. That's the full inner loop.

Optional: create AI documentation

Generated projects do not include AI instruction files automatically. From the project root, create the file used by your tooling:

bash
pnpm init-claude
pnpm init-agents

These commands create CLAUDE.md and AGENTS.md, respectively. They infer the experiment name, boilerplate type, and E2E setup from the scaffolded project.

Choosing a boilerplate

Use product-card when your experiment displays Samsung product data (image, price, CTA). Use minimal for layout tests, copy changes, or anything that doesn't need the Samsung product API.

Existing directories

If the destination directory already exists and is not empty, the CLI asks before continuing. It does not remove unrelated files from that directory.

Internal tool - Samsung / Sogody experimentation team